diff options
449 files changed, 3719 insertions, 2472 deletions
@@ -88,6 +88,7 @@ Kay Sievers <kay.sievers@vrfy.org> | |||
88 | Kenneth W Chen <kenneth.w.chen@intel.com> | 88 | Kenneth W Chen <kenneth.w.chen@intel.com> |
89 | Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com> | 89 | Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com> |
90 | Koushik <raghavendra.koushik@neterion.com> | 90 | Koushik <raghavendra.koushik@neterion.com> |
91 | Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski@samsung.com> | ||
91 | Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski.k@gmail.com> | 92 | Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski.k@gmail.com> |
92 | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 93 | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
93 | Leonid I Ananiev <leonid.i.ananiev@intel.com> | 94 | Leonid I Ananiev <leonid.i.ananiev@intel.com> |
diff --git a/Documentation/arm/CCN.txt b/Documentation/arm/CCN.txt index ffca443a19b4..15cdb7bc57c3 100644 --- a/Documentation/arm/CCN.txt +++ b/Documentation/arm/CCN.txt | |||
@@ -18,13 +18,17 @@ and config2 fields of the perf_event_attr structure. The "events" | |||
18 | directory provides configuration templates for all documented | 18 | directory provides configuration templates for all documented |
19 | events, that can be used with perf tool. For example "xp_valid_flit" | 19 | events, that can be used with perf tool. For example "xp_valid_flit" |
20 | is an equivalent of "type=0x8,event=0x4". Other parameters must be | 20 | is an equivalent of "type=0x8,event=0x4". Other parameters must be |
21 | explicitly specified. For events originating from device, "node" | 21 | explicitly specified. |
22 | defines its index. All crosspoint events require "xp" (index), | ||
23 | "port" (device port number) and "vc" (virtual channel ID) and | ||
24 | "dir" (direction). Watchpoints (special "event" value 0xfe) also | ||
25 | require comparator values ("cmp_l" and "cmp_h") and "mask", being | ||
26 | index of the comparator mask. | ||
27 | 22 | ||
23 | For events originating from device, "node" defines its index. | ||
24 | |||
25 | Crosspoint PMU events require "xp" (index), "bus" (bus number) | ||
26 | and "vc" (virtual channel ID). | ||
27 | |||
28 | Crosspoint watchpoint-based events (special "event" value 0xfe) | ||
29 | require "xp" and "vc" as as above plus "port" (device port index), | ||
30 | "dir" (transmit/receive direction), comparator values ("cmp_l" | ||
31 | and "cmp_h") and "mask", being index of the comparator mask. | ||
28 | Masks are defined separately from the event description | 32 | Masks are defined separately from the event description |
29 | (due to limited number of the config values) in the "cmp_mask" | 33 | (due to limited number of the config values) in the "cmp_mask" |
30 | directory, with first 8 configurable by user and additional | 34 | directory, with first 8 configurable by user and additional |
diff --git a/Documentation/cpu-freq/cpufreq-stats.txt b/Documentation/cpu-freq/cpufreq-stats.txt index fc647492e940..8d9773f23550 100644 --- a/Documentation/cpu-freq/cpufreq-stats.txt +++ b/Documentation/cpu-freq/cpufreq-stats.txt | |||
@@ -103,7 +103,7 @@ Config Main Menu | |||
103 | Power management options (ACPI, APM) ---> | 103 | Power management options (ACPI, APM) ---> |
104 | CPU Frequency scaling ---> | 104 | CPU Frequency scaling ---> |
105 | [*] CPU Frequency scaling | 105 | [*] CPU Frequency scaling |
106 | <*> CPU frequency translation statistics | 106 | [*] CPU frequency translation statistics |
107 | [*] CPU frequency translation statistics details | 107 | [*] CPU frequency translation statistics details |
108 | 108 | ||
109 | 109 | ||
diff --git a/Documentation/devicetree/bindings/mmc/sdhci-st.txt b/Documentation/devicetree/bindings/mmc/sdhci-st.txt index 88faa91125bf..3cd4c43a3260 100644 --- a/Documentation/devicetree/bindings/mmc/sdhci-st.txt +++ b/Documentation/devicetree/bindings/mmc/sdhci-st.txt | |||
@@ -10,7 +10,7 @@ Required properties: | |||
10 | subsystem (mmcss) inside the FlashSS (available in STiH407 SoC | 10 | subsystem (mmcss) inside the FlashSS (available in STiH407 SoC |
11 | family). | 11 | family). |
12 | 12 | ||
13 | - clock-names: Should be "mmc". | 13 | - clock-names: Should be "mmc" and "icn". (NB: The latter is not compulsory) |
14 | See: Documentation/devicetree/bindings/resource-names.txt | 14 | See: Documentation/devicetree/bindings/resource-names.txt |
15 | - clocks: Phandle to the clock. | 15 | - clocks: Phandle to the clock. |
16 | See: Documentation/devicetree/bindings/clock/clock-bindings.txt | 16 | See: Documentation/devicetree/bindings/clock/clock-bindings.txt |
diff --git a/Documentation/i2c/slave-interface b/Documentation/i2c/slave-interface index 80807adb8ded..7e2a228f21bc 100644 --- a/Documentation/i2c/slave-interface +++ b/Documentation/i2c/slave-interface | |||
@@ -145,6 +145,11 @@ If you want to add slave support to the bus driver: | |||
145 | 145 | ||
146 | * Catch the slave interrupts and send appropriate i2c_slave_events to the backend. | 146 | * Catch the slave interrupts and send appropriate i2c_slave_events to the backend. |
147 | 147 | ||
148 | Note that most hardware supports being master _and_ slave on the same bus. So, | ||
149 | if you extend a bus driver, please make sure that the driver supports that as | ||
150 | well. In almost all cases, slave support does not need to disable the master | ||
151 | functionality. | ||
152 | |||
148 | Check the i2c-rcar driver as an example. | 153 | Check the i2c-rcar driver as an example. |
149 | 154 | ||
150 | 155 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 007d05acbb5f..1a5d07053e11 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1624,7 +1624,8 @@ N: rockchip | |||
1624 | 1624 | ||
1625 | ARM/SAMSUNG EXYNOS ARM ARCHITECTURES | 1625 | ARM/SAMSUNG EXYNOS ARM ARCHITECTURES |
1626 | M: Kukjin Kim <kgene@kernel.org> | 1626 | M: Kukjin Kim <kgene@kernel.org> |
1627 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 1627 | M: Krzysztof Kozlowski <krzk@kernel.org> |
1628 | R: Javier Martinez Canillas <javier@osg.samsung.com> | ||
1628 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1629 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1629 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 1630 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
1630 | S: Maintained | 1631 | S: Maintained |
@@ -1644,7 +1645,6 @@ F: drivers/*/*s3c64xx* | |||
1644 | F: drivers/*/*s5pv210* | 1645 | F: drivers/*/*s5pv210* |
1645 | F: drivers/memory/samsung/* | 1646 | F: drivers/memory/samsung/* |
1646 | F: drivers/soc/samsung/* | 1647 | F: drivers/soc/samsung/* |
1647 | F: drivers/spi/spi-s3c* | ||
1648 | F: Documentation/arm/Samsung/ | 1648 | F: Documentation/arm/Samsung/ |
1649 | F: Documentation/devicetree/bindings/arm/samsung/ | 1649 | F: Documentation/devicetree/bindings/arm/samsung/ |
1650 | F: Documentation/devicetree/bindings/sram/samsung-sram.txt | 1650 | F: Documentation/devicetree/bindings/sram/samsung-sram.txt |
@@ -1832,6 +1832,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git | |||
1832 | ARM/UNIPHIER ARCHITECTURE | 1832 | ARM/UNIPHIER ARCHITECTURE |
1833 | M: Masahiro Yamada <yamada.masahiro@socionext.com> | 1833 | M: Masahiro Yamada <yamada.masahiro@socionext.com> |
1834 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1834 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1835 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-uniphier.git | ||
1835 | S: Maintained | 1836 | S: Maintained |
1836 | F: arch/arm/boot/dts/uniphier* | 1837 | F: arch/arm/boot/dts/uniphier* |
1837 | F: arch/arm/include/asm/hardware/cache-uniphier.h | 1838 | F: arch/arm/include/asm/hardware/cache-uniphier.h |
@@ -2485,7 +2486,7 @@ F: include/net/bluetooth/ | |||
2485 | BONDING DRIVER | 2486 | BONDING DRIVER |
2486 | M: Jay Vosburgh <j.vosburgh@gmail.com> | 2487 | M: Jay Vosburgh <j.vosburgh@gmail.com> |
2487 | M: Veaceslav Falico <vfalico@gmail.com> | 2488 | M: Veaceslav Falico <vfalico@gmail.com> |
2488 | M: Andy Gospodarek <gospo@cumulusnetworks.com> | 2489 | M: Andy Gospodarek <andy@greyhouse.net> |
2489 | L: netdev@vger.kernel.org | 2490 | L: netdev@vger.kernel.org |
2490 | W: http://sourceforge.net/projects/bonding/ | 2491 | W: http://sourceforge.net/projects/bonding/ |
2491 | S: Supported | 2492 | S: Supported |
@@ -3269,7 +3270,7 @@ S: Maintained | |||
3269 | F: drivers/net/wan/cosa* | 3270 | F: drivers/net/wan/cosa* |
3270 | 3271 | ||
3271 | CPMAC ETHERNET DRIVER | 3272 | CPMAC ETHERNET DRIVER |
3272 | M: Florian Fainelli <florian@openwrt.org> | 3273 | M: Florian Fainelli <f.fainelli@gmail.com> |
3273 | L: netdev@vger.kernel.org | 3274 | L: netdev@vger.kernel.org |
3274 | S: Maintained | 3275 | S: Maintained |
3275 | F: drivers/net/ethernet/ti/cpmac.c | 3276 | F: drivers/net/ethernet/ti/cpmac.c |
@@ -6109,7 +6110,7 @@ S: Supported | |||
6109 | F: drivers/cpufreq/intel_pstate.c | 6110 | F: drivers/cpufreq/intel_pstate.c |
6110 | 6111 | ||
6111 | INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) | 6112 | INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) |
6112 | M: Maik Broemme <mbroemme@plusserver.de> | 6113 | M: Maik Broemme <mbroemme@libmpq.org> |
6113 | L: linux-fbdev@vger.kernel.org | 6114 | L: linux-fbdev@vger.kernel.org |
6114 | S: Maintained | 6115 | S: Maintained |
6115 | F: Documentation/fb/intelfb.txt | 6116 | F: Documentation/fb/intelfb.txt |
@@ -7472,7 +7473,8 @@ F: Documentation/devicetree/bindings/sound/max9860.txt | |||
7472 | F: sound/soc/codecs/max9860.* | 7473 | F: sound/soc/codecs/max9860.* |
7473 | 7474 | ||
7474 | MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS | 7475 | MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS |
7475 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 7476 | M: Krzysztof Kozlowski <krzk@kernel.org> |
7477 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | ||
7476 | L: linux-pm@vger.kernel.org | 7478 | L: linux-pm@vger.kernel.org |
7477 | S: Supported | 7479 | S: Supported |
7478 | F: drivers/power/max14577_charger.c | 7480 | F: drivers/power/max14577_charger.c |
@@ -7488,7 +7490,8 @@ F: include/dt-bindings/*/*max77802.h | |||
7488 | 7490 | ||
7489 | MAXIM PMIC AND MUIC DRIVERS FOR EXYNOS BASED BOARDS | 7491 | MAXIM PMIC AND MUIC DRIVERS FOR EXYNOS BASED BOARDS |
7490 | M: Chanwoo Choi <cw00.choi@samsung.com> | 7492 | M: Chanwoo Choi <cw00.choi@samsung.com> |
7491 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 7493 | M: Krzysztof Kozlowski <krzk@kernel.org> |
7494 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | ||
7492 | L: linux-kernel@vger.kernel.org | 7495 | L: linux-kernel@vger.kernel.org |
7493 | S: Supported | 7496 | S: Supported |
7494 | F: drivers/*/max14577*.c | 7497 | F: drivers/*/max14577*.c |
@@ -9254,7 +9257,7 @@ F: drivers/pinctrl/sh-pfc/ | |||
9254 | 9257 | ||
9255 | PIN CONTROLLER - SAMSUNG | 9258 | PIN CONTROLLER - SAMSUNG |
9256 | M: Tomasz Figa <tomasz.figa@gmail.com> | 9259 | M: Tomasz Figa <tomasz.figa@gmail.com> |
9257 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 9260 | M: Krzysztof Kozlowski <krzk@kernel.org> |
9258 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> | 9261 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> |
9259 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 9262 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
9260 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 9263 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
@@ -10187,7 +10190,7 @@ S: Maintained | |||
10187 | F: drivers/platform/x86/samsung-laptop.c | 10190 | F: drivers/platform/x86/samsung-laptop.c |
10188 | 10191 | ||
10189 | SAMSUNG AUDIO (ASoC) DRIVERS | 10192 | SAMSUNG AUDIO (ASoC) DRIVERS |
10190 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 10193 | M: Krzysztof Kozlowski <krzk@kernel.org> |
10191 | M: Sangbeom Kim <sbkim73@samsung.com> | 10194 | M: Sangbeom Kim <sbkim73@samsung.com> |
10192 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> | 10195 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> |
10193 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) | 10196 | L: alsa-devel@alsa-project.org (moderated for non-subscribers) |
@@ -10202,7 +10205,8 @@ F: drivers/video/fbdev/s3c-fb.c | |||
10202 | 10205 | ||
10203 | SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS | 10206 | SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS |
10204 | M: Sangbeom Kim <sbkim73@samsung.com> | 10207 | M: Sangbeom Kim <sbkim73@samsung.com> |
10205 | M: Krzysztof Kozlowski <k.kozlowski@samsung.com> | 10208 | M: Krzysztof Kozlowski <krzk@kernel.org> |
10209 | M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | ||
10206 | L: linux-kernel@vger.kernel.org | 10210 | L: linux-kernel@vger.kernel.org |
10207 | L: linux-samsung-soc@vger.kernel.org | 10211 | L: linux-samsung-soc@vger.kernel.org |
10208 | S: Supported | 10212 | S: Supported |
@@ -10261,6 +10265,17 @@ S: Supported | |||
10261 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 10265 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
10262 | F: drivers/clk/samsung/ | 10266 | F: drivers/clk/samsung/ |
10263 | 10267 | ||
10268 | SAMSUNG SPI DRIVERS | ||
10269 | M: Kukjin Kim <kgene@kernel.org> | ||
10270 | M: Krzysztof Kozlowski <krzk@kernel.org> | ||
10271 | M: Andi Shyti <andi.shyti@samsung.com> | ||
10272 | L: linux-spi@vger.kernel.org | ||
10273 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | ||
10274 | S: Maintained | ||
10275 | F: Documentation/devicetree/bindings/spi/spi-samsung.txt | ||
10276 | F: drivers/spi/spi-s3c* | ||
10277 | F: include/linux/platform_data/spi-s3c64xx.h | ||
10278 | |||
10264 | SAMSUNG SXGBE DRIVERS | 10279 | SAMSUNG SXGBE DRIVERS |
10265 | M: Byungho An <bh74.an@samsung.com> | 10280 | M: Byungho An <bh74.an@samsung.com> |
10266 | M: Girish K S <ks.giri@samsung.com> | 10281 | M: Girish K S <ks.giri@samsung.com> |
@@ -12561,7 +12576,7 @@ F: include/linux/if_*vlan.h | |||
12561 | F: net/8021q/ | 12576 | F: net/8021q/ |
12562 | 12577 | ||
12563 | VLYNQ BUS | 12578 | VLYNQ BUS |
12564 | M: Florian Fainelli <florian@openwrt.org> | 12579 | M: Florian Fainelli <f.fainelli@gmail.com> |
12565 | L: openwrt-devel@lists.openwrt.org (subscribers-only) | 12580 | L: openwrt-devel@lists.openwrt.org (subscribers-only) |
12566 | S: Maintained | 12581 | S: Maintained |
12567 | F: drivers/vlynq/vlynq.c | 12582 | F: drivers/vlynq/vlynq.c |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 8 | 2 | PATCHLEVEL = 8 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Psychotic Stoned Sheep | 5 | NAME = Psychotic Stoned Sheep |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/Kconfig b/arch/Kconfig index e9c9334507dd..fd6e9712af81 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -336,17 +336,6 @@ config HAVE_ARCH_SECCOMP_FILTER | |||
336 | results in the system call being skipped immediately. | 336 | results in the system call being skipped immediately. |
337 | - seccomp syscall wired up | 337 | - seccomp syscall wired up |
338 | 338 | ||
339 | For best performance, an arch should use seccomp_phase1 and | ||
340 | seccomp_phase2 directly. It should call seccomp_phase1 for all | ||
341 | syscalls if TIF_SECCOMP is set, but seccomp_phase1 does not | ||
342 | need to be called from a ptrace-safe context. It must then | ||
343 | call seccomp_phase2 if seccomp_phase1 returns anything other | ||
344 | than SECCOMP_PHASE1_OK or SECCOMP_PHASE1_SKIP. | ||
345 | |||
346 | As an additional optimization, an arch may provide seccomp_data | ||
347 | directly to seccomp_phase1; this avoids multiple calls | ||
348 | to the syscall_xyz helpers for every syscall. | ||
349 | |||
350 | config SECCOMP_FILTER | 339 | config SECCOMP_FILTER |
351 | def_bool y | 340 | def_bool y |
352 | depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET | 341 | depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET |
diff --git a/arch/alpha/include/asm/uaccess.h b/arch/alpha/include/asm/uaccess.h index c419b43c461d..466e42e96bfa 100644 --- a/arch/alpha/include/asm/uaccess.h +++ b/arch/alpha/include/asm/uaccess.h | |||
@@ -371,14 +371,6 @@ __copy_tofrom_user_nocheck(void *to, const void *from, long len) | |||
371 | return __cu_len; | 371 | return __cu_len; |
372 | } | 372 | } |
373 | 373 | ||
374 | extern inline long | ||
375 | __copy_tofrom_user(void *to, const void *from, long len, const void __user *validate) | ||
376 | { | ||
377 | if (__access_ok((unsigned long)validate, len, get_fs())) | ||
378 | len = __copy_tofrom_user_nocheck(to, from, len); | ||
379 | return len; | ||
380 | } | ||
381 | |||
382 | #define __copy_to_user(to, from, n) \ | 374 | #define __copy_to_user(to, from, n) \ |
383 | ({ \ | 375 | ({ \ |
384 | __chk_user_ptr(to); \ | 376 | __chk_user_ptr(to); \ |
@@ -393,17 +385,22 @@ __copy_tofrom_user(void *to, const void *from, long len, const void __user *vali | |||
393 | #define __copy_to_user_inatomic __copy_to_user | 385 | #define __copy_to_user_inatomic __copy_to_user |
394 | #define __copy_from_user_inatomic __copy_from_user | 386 | #define __copy_from_user_inatomic __copy_from_user |
395 | 387 | ||
396 | |||
397 | extern inline long | 388 | extern inline long |
398 | copy_to_user(void __user *to, const void *from, long n) | 389 | copy_to_user(void __user *to, const void *from, long n) |
399 | { | 390 | { |
400 | return __copy_tofrom_user((__force void *)to, from, n, to); | 391 | if (likely(__access_ok((unsigned long)to, n, get_fs()))) |
392 | n = __copy_tofrom_user_nocheck((__force void *)to, from, n); | ||
393 | return n; | ||
401 | } | 394 | } |
402 | 395 | ||
403 | extern inline long | 396 | extern inline long |
404 | copy_from_user(void *to, const void __user *from, long n) | 397 | copy_from_user(void *to, const void __user *from, long n) |
405 | { | 398 | { |
406 | return __copy_tofrom_user(to, (__force void *)from, n, from); | 399 | if (likely(__access_ok((unsigned long)from, n, get_fs()))) |
400 | n = __copy_tofrom_user_nocheck(to, (__force void *)from, n); | ||
401 | else | ||
402 | memset(to, 0, n); | ||
403 | return n; | ||
407 | } | 404 | } |
408 | 405 | ||
409 | extern void __do_clear_user(void); | 406 | extern void __do_clear_user(void); |
diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h index a78d5670884f..41faf17cd28d 100644 --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h | |||
@@ -83,7 +83,10 @@ | |||
83 | "2: ;nop\n" \ | 83 | "2: ;nop\n" \ |
84 | " .section .fixup, \"ax\"\n" \ | 84 | " .section .fixup, \"ax\"\n" \ |
85 | " .align 4\n" \ | 85 | " .align 4\n" \ |
86 | "3: mov %0, %3\n" \ | 86 | "3: # return -EFAULT\n" \ |
87 | " mov %0, %3\n" \ | ||
88 | " # zero out dst ptr\n" \ | ||
89 | " mov %1, 0\n" \ | ||
87 | " j 2b\n" \ | 90 | " j 2b\n" \ |
88 | " .previous\n" \ | 91 | " .previous\n" \ |
89 | " .section __ex_table, \"a\"\n" \ | 92 | " .section __ex_table, \"a\"\n" \ |
@@ -101,7 +104,11 @@ | |||
101 | "2: ;nop\n" \ | 104 | "2: ;nop\n" \ |
102 | " .section .fixup, \"ax\"\n" \ | 105 | " .section .fixup, \"ax\"\n" \ |
103 | " .align 4\n" \ | 106 | " .align 4\n" \ |
104 | "3: mov %0, %3\n" \ | 107 | "3: # return -EFAULT\n" \ |
108 | " mov %0, %3\n" \ | ||
109 | " # zero out dst ptr\n" \ | ||
110 | " mov %1, 0\n" \ | ||
111 | " mov %R1, 0\n" \ | ||
105 | " j 2b\n" \ | 112 | " j 2b\n" \ |
106 | " .previous\n" \ | 113 | " .previous\n" \ |
107 | " .section __ex_table, \"a\"\n" \ | 114 | " .section __ex_table, \"a\"\n" \ |
diff --git a/arch/arm/boot/dts/am335x-baltos.dtsi b/arch/arm/boot/dts/am335x-baltos.dtsi index c8609d8d2c55..b689172632ef 100644 --- a/arch/arm/boot/dts/am335x-baltos.dtsi +++ b/arch/arm/boot/dts/am335x-baltos.dtsi | |||
@@ -226,7 +226,7 @@ | |||
226 | 226 | ||
227 | #address-cells = <1>; | 227 | #address-cells = <1>; |
228 | #size-cells = <1>; | 228 | #size-cells = <1>; |
229 | elm_id = <&elm>; | 229 | ti,elm-id = <&elm>; |
230 | }; | 230 | }; |
231 | }; | 231 | }; |
232 | 232 | ||
diff --git a/arch/arm/boot/dts/am335x-igep0033.dtsi b/arch/arm/boot/dts/am335x-igep0033.dtsi index df63484ef9b3..e7d9ca1305fa 100644 --- a/arch/arm/boot/dts/am335x-igep0033.dtsi +++ b/arch/arm/boot/dts/am335x-igep0033.dtsi | |||
@@ -161,7 +161,7 @@ | |||
161 | 161 | ||
162 | #address-cells = <1>; | 162 | #address-cells = <1>; |
163 | #size-cells = <1>; | 163 | #size-cells = <1>; |
164 | elm_id = <&elm>; | 164 | ti,elm-id = <&elm>; |
165 | 165 | ||
166 | /* MTD partition table */ | 166 | /* MTD partition table */ |
167 | partition@0 { | 167 | partition@0 { |
diff --git a/arch/arm/boot/dts/am335x-phycore-som.dtsi b/arch/arm/boot/dts/am335x-phycore-som.dtsi index 86f773165d5c..1263c9d4cba3 100644 --- a/arch/arm/boot/dts/am335x-phycore-som.dtsi +++ b/arch/arm/boot/dts/am335x-phycore-som.dtsi | |||
@@ -197,7 +197,7 @@ | |||
197 | gpmc,wr-access-ns = <30>; | 197 | gpmc,wr-access-ns = <30>; |
198 | gpmc,wr-data-mux-bus-ns = <0>; | 198 | gpmc,wr-data-mux-bus-ns = <0>; |
199 | 199 | ||
200 | elm_id = <&elm>; | 200 | ti,elm-id = <&elm>; |
201 | 201 | ||
202 | #address-cells = <1>; | 202 | #address-cells = <1>; |
203 | #size-cells = <1>; | 203 | #size-cells = <1>; |
diff --git a/arch/arm/boot/dts/armada-388-clearfog.dts b/arch/arm/boot/dts/armada-388-clearfog.dts index 2e0556af6e5e..d3e6bd805006 100644 --- a/arch/arm/boot/dts/armada-388-clearfog.dts +++ b/arch/arm/boot/dts/armada-388-clearfog.dts | |||
@@ -390,12 +390,12 @@ | |||
390 | 390 | ||
391 | port@0 { | 391 | port@0 { |
392 | reg = <0>; | 392 | reg = <0>; |
393 | label = "lan1"; | 393 | label = "lan5"; |
394 | }; | 394 | }; |
395 | 395 | ||
396 | port@1 { | 396 | port@1 { |
397 | reg = <1>; | 397 | reg = <1>; |
398 | label = "lan2"; | 398 | label = "lan4"; |
399 | }; | 399 | }; |
400 | 400 | ||
401 | port@2 { | 401 | port@2 { |
@@ -405,12 +405,12 @@ | |||
405 | 405 | ||
406 | port@3 { | 406 | port@3 { |
407 | reg = <3>; | 407 | reg = <3>; |
408 | label = "lan4"; | 408 | label = "lan2"; |
409 | }; | 409 | }; |
410 | 410 | ||
411 | port@4 { | 411 | port@4 { |
412 | reg = <4>; | 412 | reg = <4>; |
413 | label = "lan5"; | 413 | label = "lan1"; |
414 | }; | 414 | }; |
415 | 415 | ||
416 | port@5 { | 416 | port@5 { |
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi index caf2707680c1..e9b47b2bbc33 100644 --- a/arch/arm/boot/dts/bcm2835-rpi.dtsi +++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | / { | 3 | / { |
4 | memory { | 4 | memory { |
5 | device_type = "memory"; | ||
5 | reg = <0 0x10000000>; | 6 | reg = <0 0x10000000>; |
6 | }; | 7 | }; |
7 | 8 | ||
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi index b98252232d20..445624a1a1de 100644 --- a/arch/arm/boot/dts/bcm283x.dtsi +++ b/arch/arm/boot/dts/bcm283x.dtsi | |||
@@ -2,7 +2,6 @@ | |||
2 | #include <dt-bindings/clock/bcm2835.h> | 2 | #include <dt-bindings/clock/bcm2835.h> |
3 | #include <dt-bindings/clock/bcm2835-aux.h> | 3 | #include <dt-bindings/clock/bcm2835-aux.h> |
4 | #include <dt-bindings/gpio/gpio.h> | 4 | #include <dt-bindings/gpio/gpio.h> |
5 | #include "skeleton.dtsi" | ||
6 | 5 | ||
7 | /* This include file covers the common peripherals and configuration between | 6 | /* This include file covers the common peripherals and configuration between |
8 | * bcm2835 and bcm2836 implementations, leaving the CPU configuration to | 7 | * bcm2835 and bcm2836 implementations, leaving the CPU configuration to |
@@ -13,6 +12,8 @@ | |||
13 | compatible = "brcm,bcm2835"; | 12 | compatible = "brcm,bcm2835"; |
14 | model = "BCM2835"; | 13 | model = "BCM2835"; |
15 | interrupt-parent = <&intc>; | 14 | interrupt-parent = <&intc>; |
15 | #address-cells = <1>; | ||
16 | #size-cells = <1>; | ||
16 | 17 | ||
17 | chosen { | 18 | chosen { |
18 | bootargs = "earlyprintk console=ttyAMA0"; | 19 | bootargs = "earlyprintk console=ttyAMA0"; |
diff --git a/arch/arm/boot/dts/exynos5410-odroidxu.dts b/arch/arm/boot/dts/exynos5410-odroidxu.dts index d9499310a301..f6d135245a4b 100644 --- a/arch/arm/boot/dts/exynos5410-odroidxu.dts +++ b/arch/arm/boot/dts/exynos5410-odroidxu.dts | |||
@@ -447,14 +447,11 @@ | |||
447 | samsung,dw-mshc-ciu-div = <3>; | 447 | samsung,dw-mshc-ciu-div = <3>; |
448 | samsung,dw-mshc-sdr-timing = <0 4>; | 448 | samsung,dw-mshc-sdr-timing = <0 4>; |
449 | samsung,dw-mshc-ddr-timing = <0 2>; | 449 | samsung,dw-mshc-ddr-timing = <0 2>; |
450 | samsung,dw-mshc-hs400-timing = <0 2>; | ||
451 | samsung,read-strobe-delay = <90>; | ||
452 | pinctrl-names = "default"; | 450 | pinctrl-names = "default"; |
453 | pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus1 &sd0_bus4 &sd0_bus8 &sd0_cd>; | 451 | pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus1 &sd0_bus4 &sd0_bus8 &sd0_cd>; |
454 | bus-width = <8>; | 452 | bus-width = <8>; |
455 | cap-mmc-highspeed; | 453 | cap-mmc-highspeed; |
456 | mmc-hs200-1_8v; | 454 | mmc-hs200-1_8v; |
457 | mmc-hs400-1_8v; | ||
458 | vmmc-supply = <&ldo20_reg>; | 455 | vmmc-supply = <&ldo20_reg>; |
459 | vqmmc-supply = <&ldo11_reg>; | 456 | vqmmc-supply = <&ldo11_reg>; |
460 | }; | 457 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index b620ac884cfd..b13b0b2db881 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi | |||
@@ -243,7 +243,7 @@ | |||
243 | clocks = <&clks IMX6QDL_CLK_SPDIF_GCLK>, <&clks IMX6QDL_CLK_OSC>, | 243 | clocks = <&clks IMX6QDL_CLK_SPDIF_GCLK>, <&clks IMX6QDL_CLK_OSC>, |
244 | <&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_ASRC>, | 244 | <&clks IMX6QDL_CLK_SPDIF>, <&clks IMX6QDL_CLK_ASRC>, |
245 | <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_ESAI_EXTAL>, | 245 | <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_ESAI_EXTAL>, |
246 | <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_MLB>, | 246 | <&clks IMX6QDL_CLK_IPG>, <&clks IMX6QDL_CLK_DUMMY>, |
247 | <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_SPBA>; | 247 | <&clks IMX6QDL_CLK_DUMMY>, <&clks IMX6QDL_CLK_SPBA>; |
248 | clock-names = "core", "rxtx0", | 248 | clock-names = "core", "rxtx0", |
249 | "rxtx1", "rxtx2", | 249 | "rxtx1", "rxtx2", |
diff --git a/arch/arm/boot/dts/imx6sx-sabreauto.dts b/arch/arm/boot/dts/imx6sx-sabreauto.dts index 96ea936eeeb0..240a2864d044 100644 --- a/arch/arm/boot/dts/imx6sx-sabreauto.dts +++ b/arch/arm/boot/dts/imx6sx-sabreauto.dts | |||
@@ -64,7 +64,7 @@ | |||
64 | cd-gpios = <&gpio7 11 GPIO_ACTIVE_LOW>; | 64 | cd-gpios = <&gpio7 11 GPIO_ACTIVE_LOW>; |
65 | no-1-8-v; | 65 | no-1-8-v; |
66 | keep-power-in-suspend; | 66 | keep-power-in-suspend; |
67 | enable-sdio-wakup; | 67 | wakeup-source; |
68 | status = "okay"; | 68 | status = "okay"; |
69 | }; | 69 | }; |
70 | 70 | ||
diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts index 95ee268ed510..2f33c463cbce 100644 --- a/arch/arm/boot/dts/imx7d-sdb.dts +++ b/arch/arm/boot/dts/imx7d-sdb.dts | |||
@@ -131,7 +131,7 @@ | |||
131 | ti,y-min = /bits/ 16 <0>; | 131 | ti,y-min = /bits/ 16 <0>; |
132 | ti,y-max = /bits/ 16 <0>; | 132 | ti,y-max = /bits/ 16 <0>; |
133 | ti,pressure-max = /bits/ 16 <0>; | 133 | ti,pressure-max = /bits/ 16 <0>; |
134 | ti,x-plat-ohms = /bits/ 16 <400>; | 134 | ti,x-plate-ohms = /bits/ 16 <400>; |
135 | wakeup-source; | 135 | wakeup-source; |
136 | }; | 136 | }; |
137 | }; | 137 | }; |
diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts index ef84d8699a76..5bf62897014c 100644 --- a/arch/arm/boot/dts/kirkwood-ib62x0.dts +++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts | |||
@@ -113,7 +113,7 @@ | |||
113 | 113 | ||
114 | partition@e0000 { | 114 | partition@e0000 { |
115 | label = "u-boot environment"; | 115 | label = "u-boot environment"; |
116 | reg = <0xe0000 0x100000>; | 116 | reg = <0xe0000 0x20000>; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | partition@100000 { | 119 | partition@100000 { |
diff --git a/arch/arm/boot/dts/kirkwood-openrd.dtsi b/arch/arm/boot/dts/kirkwood-openrd.dtsi index e4ecab112601..7175511a92da 100644 --- a/arch/arm/boot/dts/kirkwood-openrd.dtsi +++ b/arch/arm/boot/dts/kirkwood-openrd.dtsi | |||
@@ -116,6 +116,10 @@ | |||
116 | }; | 116 | }; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | &pciec { | ||
120 | status = "okay"; | ||
121 | }; | ||
122 | |||
119 | &pcie0 { | 123 | &pcie0 { |
120 | status = "okay"; | 124 | status = "okay"; |
121 | }; | 125 | }; |
diff --git a/arch/arm/boot/dts/logicpd-som-lv.dtsi b/arch/arm/boot/dts/logicpd-som-lv.dtsi index 365f39ff58bb..0ff1c2de95bf 100644 --- a/arch/arm/boot/dts/logicpd-som-lv.dtsi +++ b/arch/arm/boot/dts/logicpd-som-lv.dtsi | |||
@@ -35,10 +35,15 @@ | |||
35 | ranges = <0 0 0x00000000 0x1000000>; /* CS0: 16MB for NAND */ | 35 | ranges = <0 0 0x00000000 0x1000000>; /* CS0: 16MB for NAND */ |
36 | 36 | ||
37 | nand@0,0 { | 37 | nand@0,0 { |
38 | linux,mtd-name = "micron,mt29f4g16abbda3w"; | 38 | compatible = "ti,omap2-nand"; |
39 | reg = <0 0 4>; /* CS0, offset 0, IO size 4 */ | 39 | reg = <0 0 4>; /* CS0, offset 0, IO size 4 */ |
40 | interrupt-parent = <&gpmc>; | ||
41 | interrupts = <0 IRQ_TYPE_NONE>, /* fifoevent */ | ||
42 | <1 IRQ_TYPE_NONE>; /* termcount */ | ||
43 | linux,mtd-name = "micron,mt29f4g16abbda3w"; | ||
40 | nand-bus-width = <16>; | 44 | nand-bus-width = <16>; |
41 | ti,nand-ecc-opt = "bch8"; | 45 | ti,nand-ecc-opt = "bch8"; |
46 | rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>; /* gpmc_wait0 */ | ||
42 | gpmc,sync-clk-ps = <0>; | 47 | gpmc,sync-clk-ps = <0>; |
43 | gpmc,cs-on-ns = <0>; | 48 | gpmc,cs-on-ns = <0>; |
44 | gpmc,cs-rd-off-ns = <44>; | 49 | gpmc,cs-rd-off-ns = <44>; |
@@ -54,10 +59,6 @@ | |||
54 | gpmc,wr-access-ns = <40>; | 59 | gpmc,wr-access-ns = <40>; |
55 | gpmc,wr-data-mux-bus-ns = <0>; | 60 | gpmc,wr-data-mux-bus-ns = <0>; |
56 | gpmc,device-width = <2>; | 61 | gpmc,device-width = <2>; |
57 | |||
58 | gpmc,page-burst-access-ns = <5>; | ||
59 | gpmc,cycle2cycle-delay-ns = <50>; | ||
60 | |||
61 | #address-cells = <1>; | 62 | #address-cells = <1>; |
62 | #size-cells = <1>; | 63 | #size-cells = <1>; |
63 | 64 | ||
diff --git a/arch/arm/boot/dts/logicpd-torpedo-som.dtsi b/arch/arm/boot/dts/logicpd-torpedo-som.dtsi index 5e9a13c0eaf7..1c2c74655416 100644 --- a/arch/arm/boot/dts/logicpd-torpedo-som.dtsi +++ b/arch/arm/boot/dts/logicpd-torpedo-som.dtsi | |||
@@ -46,6 +46,7 @@ | |||
46 | linux,mtd-name = "micron,mt29f4g16abbda3w"; | 46 | linux,mtd-name = "micron,mt29f4g16abbda3w"; |
47 | nand-bus-width = <16>; | 47 | nand-bus-width = <16>; |
48 | ti,nand-ecc-opt = "bch8"; | 48 | ti,nand-ecc-opt = "bch8"; |
49 | rb-gpios = <&gpmc 0 GPIO_ACTIVE_HIGH>; /* gpmc_wait0 */ | ||
49 | gpmc,sync-clk-ps = <0>; | 50 | gpmc,sync-clk-ps = <0>; |
50 | gpmc,cs-on-ns = <0>; | 51 | gpmc,cs-on-ns = <0>; |
51 | gpmc,cs-rd-off-ns = <44>; | 52 | gpmc,cs-rd-off-ns = <44>; |
diff --git a/arch/arm/boot/dts/omap3-overo-base.dtsi b/arch/arm/boot/dts/omap3-overo-base.dtsi index de256fa8da48..3e946cac55f3 100644 --- a/arch/arm/boot/dts/omap3-overo-base.dtsi +++ b/arch/arm/boot/dts/omap3-overo-base.dtsi | |||
@@ -223,7 +223,9 @@ | |||
223 | }; | 223 | }; |
224 | 224 | ||
225 | &gpmc { | 225 | &gpmc { |
226 | ranges = <0 0 0x00000000 0x20000000>; | 226 | ranges = <0 0 0x30000000 0x1000000>, /* CS0 */ |
227 | <4 0 0x2b000000 0x1000000>, /* CS4 */ | ||
228 | <5 0 0x2c000000 0x1000000>; /* CS5 */ | ||
227 | 229 | ||
228 | nand@0,0 { | 230 | nand@0,0 { |
229 | compatible = "ti,omap2-nand"; | 231 | compatible = "ti,omap2-nand"; |
diff --git a/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi b/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi index 7df27926ead2..4f4c6efbd518 100644 --- a/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi +++ b/arch/arm/boot/dts/omap3-overo-chestnut43-common.dtsi | |||
@@ -55,8 +55,6 @@ | |||
55 | #include "omap-gpmc-smsc9221.dtsi" | 55 | #include "omap-gpmc-smsc9221.dtsi" |
56 | 56 | ||
57 | &gpmc { | 57 | &gpmc { |
58 | ranges = <5 0 0x2c000000 0x1000000>; /* CS5 */ | ||
59 | |||
60 | ethernet@gpmc { | 58 | ethernet@gpmc { |
61 | reg = <5 0 0xff>; | 59 | reg = <5 0 0xff>; |
62 | interrupt-parent = <&gpio6>; | 60 | interrupt-parent = <&gpio6>; |
diff --git a/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi b/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi index 9e24b6a1d07b..1b304e2f1bd2 100644 --- a/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi +++ b/arch/arm/boot/dts/omap3-overo-tobi-common.dtsi | |||
@@ -27,8 +27,6 @@ | |||
27 | #include "omap-gpmc-smsc9221.dtsi" | 27 | #include "omap-gpmc-smsc9221.dtsi" |
28 | 28 | ||
29 | &gpmc { | 29 | &gpmc { |
30 | ranges = <5 0 0x2c000000 0x1000000>; /* CS5 */ | ||
31 | |||
32 | ethernet@gpmc { | 30 | ethernet@gpmc { |
33 | reg = <5 0 0xff>; | 31 | reg = <5 0 0xff>; |
34 | interrupt-parent = <&gpio6>; | 32 | interrupt-parent = <&gpio6>; |
diff --git a/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi b/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi index 334109e14613..82e98ee3023a 100644 --- a/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi +++ b/arch/arm/boot/dts/omap3-overo-tobiduo-common.dtsi | |||
@@ -15,9 +15,6 @@ | |||
15 | #include "omap-gpmc-smsc9221.dtsi" | 15 | #include "omap-gpmc-smsc9221.dtsi" |
16 | 16 | ||
17 | &gpmc { | 17 | &gpmc { |
18 | ranges = <4 0 0x2b000000 0x1000000>, /* CS4 */ | ||
19 | <5 0 0x2c000000 0x1000000>; /* CS5 */ | ||
20 | |||
21 | smsc1: ethernet@gpmc { | 18 | smsc1: ethernet@gpmc { |
22 | reg = <5 0 0xff>; | 19 | reg = <5 0 0xff>; |
23 | interrupt-parent = <&gpio6>; | 20 | interrupt-parent = <&gpio6>; |
diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi index d294e82447a2..8b063ab10c19 100644 --- a/arch/arm/boot/dts/stih407-family.dtsi +++ b/arch/arm/boot/dts/stih407-family.dtsi | |||
@@ -550,8 +550,9 @@ | |||
550 | interrupt-names = "mmcirq"; | 550 | interrupt-names = "mmcirq"; |
551 | pinctrl-names = "default"; | 551 | pinctrl-names = "default"; |
552 | pinctrl-0 = <&pinctrl_mmc0>; | 552 | pinctrl-0 = <&pinctrl_mmc0>; |
553 | clock-names = "mmc"; | 553 | clock-names = "mmc", "icn"; |
554 | clocks = <&clk_s_c0_flexgen CLK_MMC_0>; | 554 | clocks = <&clk_s_c0_flexgen CLK_MMC_0>, |
555 | <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; | ||
555 | bus-width = <8>; | 556 | bus-width = <8>; |
556 | non-removable; | 557 | non-removable; |
557 | }; | 558 | }; |
@@ -565,8 +566,9 @@ | |||
565 | interrupt-names = "mmcirq"; | 566 | interrupt-names = "mmcirq"; |
566 | pinctrl-names = "default"; | 567 | pinctrl-names = "default"; |
567 | pinctrl-0 = <&pinctrl_sd1>; | 568 | pinctrl-0 = <&pinctrl_sd1>; |
568 | clock-names = "mmc"; | 569 | clock-names = "mmc", "icn"; |
569 | clocks = <&clk_s_c0_flexgen CLK_MMC_1>; | 570 | clocks = <&clk_s_c0_flexgen CLK_MMC_1>, |
571 | <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; | ||
570 | resets = <&softreset STIH407_MMC1_SOFTRESET>; | 572 | resets = <&softreset STIH407_MMC1_SOFTRESET>; |
571 | bus-width = <4>; | 573 | bus-width = <4>; |
572 | }; | 574 | }; |
diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi index 18ed1ad10d32..40318869c733 100644 --- a/arch/arm/boot/dts/stih410.dtsi +++ b/arch/arm/boot/dts/stih410.dtsi | |||
@@ -41,7 +41,8 @@ | |||
41 | compatible = "st,st-ohci-300x"; | 41 | compatible = "st,st-ohci-300x"; |
42 | reg = <0x9a03c00 0x100>; | 42 | reg = <0x9a03c00 0x100>; |
43 | interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; | 43 | interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; |
44 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 44 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
45 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
45 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, | 46 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, |
46 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; | 47 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; |
47 | reset-names = "power", "softreset"; | 48 | reset-names = "power", "softreset"; |
@@ -57,7 +58,8 @@ | |||
57 | interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; | 58 | interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; |
58 | pinctrl-names = "default"; | 59 | pinctrl-names = "default"; |
59 | pinctrl-0 = <&pinctrl_usb0>; | 60 | pinctrl-0 = <&pinctrl_usb0>; |
60 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 61 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
62 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
61 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, | 63 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, |
62 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; | 64 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; |
63 | reset-names = "power", "softreset"; | 65 | reset-names = "power", "softreset"; |
@@ -71,7 +73,8 @@ | |||
71 | compatible = "st,st-ohci-300x"; | 73 | compatible = "st,st-ohci-300x"; |
72 | reg = <0x9a83c00 0x100>; | 74 | reg = <0x9a83c00 0x100>; |
73 | interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; | 75 | interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; |
74 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 76 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
77 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
75 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, | 78 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, |
76 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; | 79 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; |
77 | reset-names = "power", "softreset"; | 80 | reset-names = "power", "softreset"; |
@@ -87,7 +90,8 @@ | |||
87 | interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; | 90 | interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; |
88 | pinctrl-names = "default"; | 91 | pinctrl-names = "default"; |
89 | pinctrl-0 = <&pinctrl_usb1>; | 92 | pinctrl-0 = <&pinctrl_usb1>; |
90 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 93 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
94 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
91 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, | 95 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, |
92 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; | 96 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; |
93 | reset-names = "power", "softreset"; | 97 | reset-names = "power", "softreset"; |
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi index e012890e0cf2..a17ba0243db3 100644 --- a/arch/arm/boot/dts/sun5i-a13.dtsi +++ b/arch/arm/boot/dts/sun5i-a13.dtsi | |||
@@ -84,7 +84,7 @@ | |||
84 | trips { | 84 | trips { |
85 | cpu_alert0: cpu_alert0 { | 85 | cpu_alert0: cpu_alert0 { |
86 | /* milliCelsius */ | 86 | /* milliCelsius */ |
87 | temperature = <850000>; | 87 | temperature = <85000>; |
88 | hysteresis = <2000>; | 88 | hysteresis = <2000>; |
89 | type = "passive"; | 89 | type = "passive"; |
90 | }; | 90 | }; |
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts index 1dfc492cc004..1444fbd543e7 100644 --- a/arch/arm/boot/dts/tegra114-dalmore.dts +++ b/arch/arm/boot/dts/tegra114-dalmore.dts | |||
@@ -897,7 +897,7 @@ | |||
897 | palmas: tps65913@58 { | 897 | palmas: tps65913@58 { |
898 | compatible = "ti,palmas"; | 898 | compatible = "ti,palmas"; |
899 | reg = <0x58>; | 899 | reg = <0x58>; |
900 | interrupts = <0 86 IRQ_TYPE_LEVEL_LOW>; | 900 | interrupts = <0 86 IRQ_TYPE_LEVEL_HIGH>; |
901 | 901 | ||
902 | #interrupt-cells = <2>; | 902 | #interrupt-cells = <2>; |
903 | interrupt-controller; | 903 | interrupt-controller; |
diff --git a/arch/arm/boot/dts/tegra114-roth.dts b/arch/arm/boot/dts/tegra114-roth.dts index 70cf40996c3f..966a7fc044af 100644 --- a/arch/arm/boot/dts/tegra114-roth.dts +++ b/arch/arm/boot/dts/tegra114-roth.dts | |||
@@ -802,7 +802,7 @@ | |||
802 | palmas: pmic@58 { | 802 | palmas: pmic@58 { |
803 | compatible = "ti,palmas"; | 803 | compatible = "ti,palmas"; |
804 | reg = <0x58>; | 804 | reg = <0x58>; |
805 | interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_LOW>; | 805 | interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; |
806 | 806 | ||
807 | #interrupt-cells = <2>; | 807 | #interrupt-cells = <2>; |
808 | interrupt-controller; | 808 | interrupt-controller; |
diff --git a/arch/arm/boot/dts/tegra114-tn7.dts b/arch/arm/boot/dts/tegra114-tn7.dts index 17dd14545862..a161fa1dfb61 100644 --- a/arch/arm/boot/dts/tegra114-tn7.dts +++ b/arch/arm/boot/dts/tegra114-tn7.dts | |||
@@ -63,7 +63,7 @@ | |||
63 | palmas: pmic@58 { | 63 | palmas: pmic@58 { |
64 | compatible = "ti,palmas"; | 64 | compatible = "ti,palmas"; |
65 | reg = <0x58>; | 65 | reg = <0x58>; |
66 | interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_LOW>; | 66 | interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; |
67 | 67 | ||
68 | #interrupt-cells = <2>; | 68 | #interrupt-cells = <2>; |
69 | interrupt-controller; | 69 | interrupt-controller; |
diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts index 6403e0de540e..e52b82449a79 100644 --- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts +++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts | |||
@@ -1382,7 +1382,7 @@ | |||
1382 | * Pin 41: BR_UART1_TXD | 1382 | * Pin 41: BR_UART1_TXD |
1383 | * Pin 44: BR_UART1_RXD | 1383 | * Pin 44: BR_UART1_RXD |
1384 | */ | 1384 | */ |
1385 | serial@0,70006000 { | 1385 | serial@70006000 { |
1386 | compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart"; | 1386 | compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart"; |
1387 | status = "okay"; | 1387 | status = "okay"; |
1388 | }; | 1388 | }; |
@@ -1394,7 +1394,7 @@ | |||
1394 | * Pin 71: UART2_CTS_L | 1394 | * Pin 71: UART2_CTS_L |
1395 | * Pin 74: UART2_RTS_L | 1395 | * Pin 74: UART2_RTS_L |
1396 | */ | 1396 | */ |
1397 | serial@0,70006040 { | 1397 | serial@70006040 { |
1398 | compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart"; | 1398 | compatible = "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart"; |
1399 | status = "okay"; | 1399 | status = "okay"; |
1400 | }; | 1400 | }; |
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c index 0e97b4b871f9..6c7b06854fce 100644 --- a/arch/arm/common/locomo.c +++ b/arch/arm/common/locomo.c | |||
@@ -140,7 +140,7 @@ static struct locomo_dev_info locomo_devices[] = { | |||
140 | 140 | ||
141 | static void locomo_handler(struct irq_desc *desc) | 141 | static void locomo_handler(struct irq_desc *desc) |
142 | { | 142 | { |
143 | struct locomo *lchip = irq_desc_get_chip_data(desc); | 143 | struct locomo *lchip = irq_desc_get_handler_data(desc); |
144 | int req, i; | 144 | int req, i; |
145 | 145 | ||
146 | /* Acknowledge the parent IRQ */ | 146 | /* Acknowledge the parent IRQ */ |
@@ -200,8 +200,7 @@ static void locomo_setup_irq(struct locomo *lchip) | |||
200 | * Install handler for IRQ_LOCOMO_HW. | 200 | * Install handler for IRQ_LOCOMO_HW. |
201 | */ | 201 | */ |
202 | irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); | 202 | irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); |
203 | irq_set_chip_data(lchip->irq, lchip); | 203 | irq_set_chained_handler_and_data(lchip->irq, locomo_handler, lchip); |
204 | irq_set_chained_handler(lchip->irq, locomo_handler); | ||
205 | 204 | ||
206 | /* Install handlers for IRQ_LOCOMO_* */ | 205 | /* Install handlers for IRQ_LOCOMO_* */ |
207 | for ( ; irq <= lchip->irq_base + 3; irq++) { | 206 | for ( ; irq <= lchip->irq_base + 3; irq++) { |
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index fb0a0a4dfea4..2e076c492005 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c | |||
@@ -472,8 +472,8 @@ static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base) | |||
472 | * specifies that S0ReadyInt and S1ReadyInt should be '1'. | 472 | * specifies that S0ReadyInt and S1ReadyInt should be '1'. |
473 | */ | 473 | */ |
474 | sa1111_writel(0, irqbase + SA1111_INTPOL0); | 474 | sa1111_writel(0, irqbase + SA1111_INTPOL0); |
475 | sa1111_writel(SA1111_IRQMASK_HI(IRQ_S0_READY_NINT) | | 475 | sa1111_writel(BIT(IRQ_S0_READY_NINT & 31) | |
476 | SA1111_IRQMASK_HI(IRQ_S1_READY_NINT), | 476 | BIT(IRQ_S1_READY_NINT & 31), |
477 | irqbase + SA1111_INTPOL1); | 477 | irqbase + SA1111_INTPOL1); |
478 | 478 | ||
479 | /* clear all IRQs */ | 479 | /* clear all IRQs */ |
@@ -754,7 +754,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
754 | if (sachip->irq != NO_IRQ) { | 754 | if (sachip->irq != NO_IRQ) { |
755 | ret = sa1111_setup_irq(sachip, pd->irq_base); | 755 | ret = sa1111_setup_irq(sachip, pd->irq_base); |
756 | if (ret) | 756 | if (ret) |
757 | goto err_unmap; | 757 | goto err_clk; |
758 | } | 758 | } |
759 | 759 | ||
760 | #ifdef CONFIG_ARCH_SA1100 | 760 | #ifdef CONFIG_ARCH_SA1100 |
@@ -799,6 +799,8 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
799 | 799 | ||
800 | return 0; | 800 | return 0; |
801 | 801 | ||
802 | err_clk: | ||
803 | clk_disable(sachip->clk); | ||
802 | err_unmap: | 804 | err_unmap: |
803 | iounmap(sachip->base); | 805 | iounmap(sachip->base); |
804 | err_clk_unprep: | 806 | err_clk_unprep: |
@@ -869,9 +871,9 @@ struct sa1111_save_data { | |||
869 | 871 | ||
870 | #ifdef CONFIG_PM | 872 | #ifdef CONFIG_PM |
871 | 873 | ||
872 | static int sa1111_suspend(struct platform_device *dev, pm_message_t state) | 874 | static int sa1111_suspend_noirq(struct device *dev) |
873 | { | 875 | { |
874 | struct sa1111 *sachip = platform_get_drvdata(dev); | 876 | struct sa1111 *sachip = dev_get_drvdata(dev); |
875 | struct sa1111_save_data *save; | 877 | struct sa1111_save_data *save; |
876 | unsigned long flags; | 878 | unsigned long flags; |
877 | unsigned int val; | 879 | unsigned int val; |
@@ -934,9 +936,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state) | |||
934 | * restored by their respective drivers, and must be called | 936 | * restored by their respective drivers, and must be called |
935 | * via LDM after this function. | 937 | * via LDM after this function. |
936 | */ | 938 | */ |
937 | static int sa1111_resume(struct platform_device *dev) | 939 | static int sa1111_resume_noirq(struct device *dev) |
938 | { | 940 | { |
939 | struct sa1111 *sachip = platform_get_drvdata(dev); | 941 | struct sa1111 *sachip = dev_get_drvdata(dev); |
940 | struct sa1111_save_data *save; | 942 | struct sa1111_save_data *save; |
941 | unsigned long flags, id; | 943 | unsigned long flags, id; |
942 | void __iomem *base; | 944 | void __iomem *base; |
@@ -952,7 +954,7 @@ static int sa1111_resume(struct platform_device *dev) | |||
952 | id = sa1111_readl(sachip->base + SA1111_SKID); | 954 | id = sa1111_readl(sachip->base + SA1111_SKID); |
953 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { | 955 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { |
954 | __sa1111_remove(sachip); | 956 | __sa1111_remove(sachip); |
955 | platform_set_drvdata(dev, NULL); | 957 | dev_set_drvdata(dev, NULL); |
956 | kfree(save); | 958 | kfree(save); |
957 | return 0; | 959 | return 0; |
958 | } | 960 | } |
@@ -1003,8 +1005,8 @@ static int sa1111_resume(struct platform_device *dev) | |||
1003 | } | 1005 | } |
1004 | 1006 | ||
1005 | #else | 1007 | #else |
1006 | #define sa1111_suspend NULL | 1008 | #define sa1111_suspend_noirq NULL |
1007 | #define sa1111_resume NULL | 1009 | #define sa1111_resume_noirq NULL |
1008 | #endif | 1010 | #endif |
1009 | 1011 | ||
1010 | static int sa1111_probe(struct platform_device *pdev) | 1012 | static int sa1111_probe(struct platform_device *pdev) |
@@ -1017,7 +1019,7 @@ static int sa1111_probe(struct platform_device *pdev) | |||
1017 | return -EINVAL; | 1019 | return -EINVAL; |
1018 | irq = platform_get_irq(pdev, 0); | 1020 | irq = platform_get_irq(pdev, 0); |
1019 | if (irq < 0) | 1021 | if (irq < 0) |
1020 | return -ENXIO; | 1022 | return irq; |
1021 | 1023 | ||
1022 | return __sa1111_probe(&pdev->dev, mem, irq); | 1024 | return __sa1111_probe(&pdev->dev, mem, irq); |
1023 | } | 1025 | } |
@@ -1038,6 +1040,11 @@ static int sa1111_remove(struct platform_device *pdev) | |||
1038 | return 0; | 1040 | return 0; |
1039 | } | 1041 | } |
1040 | 1042 | ||
1043 | static struct dev_pm_ops sa1111_pm_ops = { | ||
1044 | .suspend_noirq = sa1111_suspend_noirq, | ||
1045 | .resume_noirq = sa1111_resume_noirq, | ||
1046 | }; | ||
1047 | |||
1041 | /* | 1048 | /* |
1042 | * Not sure if this should be on the system bus or not yet. | 1049 | * Not sure if this should be on the system bus or not yet. |
1043 | * We really want some way to register a system device at | 1050 | * We really want some way to register a system device at |
@@ -1050,10 +1057,9 @@ static int sa1111_remove(struct platform_device *pdev) | |||
1050 | static struct platform_driver sa1111_device_driver = { | 1057 | static struct platform_driver sa1111_device_driver = { |
1051 | .probe = sa1111_probe, | 1058 | .probe = sa1111_probe, |
1052 | .remove = sa1111_remove, | 1059 | .remove = sa1111_remove, |
1053 | .suspend = sa1111_suspend, | ||
1054 | .resume = sa1111_resume, | ||
1055 | .driver = { | 1060 | .driver = { |
1056 | .name = "sa1111", | 1061 | .name = "sa1111", |
1062 | .pm = &sa1111_pm_ops, | ||
1057 | }, | 1063 | }, |
1058 | }; | 1064 | }; |
1059 | 1065 | ||
diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig index 71b42e66488a..78cd2f197e01 100644 --- a/arch/arm/configs/keystone_defconfig +++ b/arch/arm/configs/keystone_defconfig | |||
@@ -161,6 +161,7 @@ CONFIG_USB_MON=y | |||
161 | CONFIG_USB_XHCI_HCD=y | 161 | CONFIG_USB_XHCI_HCD=y |
162 | CONFIG_USB_STORAGE=y | 162 | CONFIG_USB_STORAGE=y |
163 | CONFIG_USB_DWC3=y | 163 | CONFIG_USB_DWC3=y |
164 | CONFIG_NOP_USB_XCEIV=y | ||
164 | CONFIG_KEYSTONE_USB_PHY=y | 165 | CONFIG_KEYSTONE_USB_PHY=y |
165 | CONFIG_NEW_LEDS=y | 166 | CONFIG_NEW_LEDS=y |
166 | CONFIG_LEDS_CLASS=y | 167 | CONFIG_LEDS_CLASS=y |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 2c8665cd9dc5..ea3566fb92e2 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -781,7 +781,7 @@ CONFIG_MXS_DMA=y | |||
781 | CONFIG_DMA_BCM2835=y | 781 | CONFIG_DMA_BCM2835=y |
782 | CONFIG_DMA_OMAP=y | 782 | CONFIG_DMA_OMAP=y |
783 | CONFIG_QCOM_BAM_DMA=y | 783 | CONFIG_QCOM_BAM_DMA=y |
784 | CONFIG_XILINX_VDMA=y | 784 | CONFIG_XILINX_DMA=y |
785 | CONFIG_DMA_SUN6I=y | 785 | CONFIG_DMA_SUN6I=y |
786 | CONFIG_STAGING=y | 786 | CONFIG_STAGING=y |
787 | CONFIG_SENSORS_ISL29018=y | 787 | CONFIG_SENSORS_ISL29018=y |
diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c index da3c0428507b..aef022a87c53 100644 --- a/arch/arm/crypto/aes-ce-glue.c +++ b/arch/arm/crypto/aes-ce-glue.c | |||
@@ -284,7 +284,7 @@ static int ctr_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
284 | err = blkcipher_walk_done(desc, &walk, | 284 | err = blkcipher_walk_done(desc, &walk, |
285 | walk.nbytes % AES_BLOCK_SIZE); | 285 | walk.nbytes % AES_BLOCK_SIZE); |
286 | } | 286 | } |
287 | if (nbytes) { | 287 | if (walk.nbytes % AES_BLOCK_SIZE) { |
288 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; | 288 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; |
289 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; | 289 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; |
290 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; | 290 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; |
diff --git a/arch/arm/include/asm/pgtable-2level-hwdef.h b/arch/arm/include/asm/pgtable-2level-hwdef.h index d0131ee6f6af..3f82e9da7cec 100644 --- a/arch/arm/include/asm/pgtable-2level-hwdef.h +++ b/arch/arm/include/asm/pgtable-2level-hwdef.h | |||
@@ -47,6 +47,7 @@ | |||
47 | #define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) | 47 | #define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) |
48 | #define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE) | 48 | #define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE) |
49 | #define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) | 49 | #define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) |
50 | #define PMD_SECT_CACHE_MASK (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) | ||
50 | #define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2)) | 51 | #define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2)) |
51 | 52 | ||
52 | /* | 53 | /* |
diff --git a/arch/arm/include/asm/pgtable-3level-hwdef.h b/arch/arm/include/asm/pgtable-3level-hwdef.h index f8f1cff62065..4cd664abfcd3 100644 --- a/arch/arm/include/asm/pgtable-3level-hwdef.h +++ b/arch/arm/include/asm/pgtable-3level-hwdef.h | |||
@@ -62,6 +62,7 @@ | |||
62 | #define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */ | 62 | #define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */ |
63 | #define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */ | 63 | #define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */ |
64 | #define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */ | 64 | #define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */ |
65 | #define PMD_SECT_CACHE_MASK (_AT(pmdval_t, 7) << 2) | ||
65 | 66 | ||
66 | /* | 67 | /* |
67 | * + Level 3 descriptor (PTE) | 68 | * + Level 3 descriptor (PTE) |
diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S index 0b1e4a93d67e..15d073ae5da2 100644 --- a/arch/arm/kernel/hyp-stub.S +++ b/arch/arm/kernel/hyp-stub.S | |||
@@ -142,6 +142,19 @@ ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE | |||
142 | and r7, #0x1f @ Preserve HPMN | 142 | and r7, #0x1f @ Preserve HPMN |
143 | mcr p15, 4, r7, c1, c1, 1 @ HDCR | 143 | mcr p15, 4, r7, c1, c1, 1 @ HDCR |
144 | 144 | ||
145 | @ Make sure NS-SVC is initialised appropriately | ||
146 | mrc p15, 0, r7, c1, c0, 0 @ SCTLR | ||
147 | orr r7, #(1 << 5) @ CP15 barriers enabled | ||
148 | bic r7, #(3 << 7) @ Clear SED/ITD for v8 (RES0 for v7) | ||
149 | bic r7, #(3 << 19) @ WXN and UWXN disabled | ||
150 | mcr p15, 0, r7, c1, c0, 0 @ SCTLR | ||
151 | |||
152 | mrc p15, 0, r7, c0, c0, 0 @ MIDR | ||
153 | mcr p15, 4, r7, c0, c0, 0 @ VPIDR | ||
154 | |||
155 | mrc p15, 0, r7, c0, c0, 5 @ MPIDR | ||
156 | mcr p15, 4, r7, c0, c0, 5 @ VMPIDR | ||
157 | |||
145 | #if !defined(ZIMAGE) && defined(CONFIG_ARM_ARCH_TIMER) | 158 | #if !defined(ZIMAGE) && defined(CONFIG_ARM_ARCH_TIMER) |
146 | @ make CNTP_* and CNTPCT accessible from PL1 | 159 | @ make CNTP_* and CNTPCT accessible from PL1 |
147 | mrc p15, 0, r7, c0, c1, 1 @ ID_PFR1 | 160 | mrc p15, 0, r7, c0, c1, 1 @ ID_PFR1 |
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 75f130ef6504..c94b90d43772 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c | |||
@@ -158,8 +158,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm) | |||
158 | { | 158 | { |
159 | int i; | 159 | int i; |
160 | 160 | ||
161 | kvm_free_stage2_pgd(kvm); | ||
162 | |||
163 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | 161 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { |
164 | if (kvm->vcpus[i]) { | 162 | if (kvm->vcpus[i]) { |
165 | kvm_arch_vcpu_free(kvm->vcpus[i]); | 163 | kvm_arch_vcpu_free(kvm->vcpus[i]); |
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 29d0b23af2a9..e9a5c0e0c115 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c | |||
@@ -1714,7 +1714,8 @@ int kvm_mmu_init(void) | |||
1714 | kern_hyp_va(PAGE_OFFSET), kern_hyp_va(~0UL)); | 1714 | kern_hyp_va(PAGE_OFFSET), kern_hyp_va(~0UL)); |
1715 | 1715 | ||
1716 | if (hyp_idmap_start >= kern_hyp_va(PAGE_OFFSET) && | 1716 | if (hyp_idmap_start >= kern_hyp_va(PAGE_OFFSET) && |
1717 | hyp_idmap_start < kern_hyp_va(~0UL)) { | 1717 | hyp_idmap_start < kern_hyp_va(~0UL) && |
1718 | hyp_idmap_start != (unsigned long)__hyp_idmap_text_start) { | ||
1718 | /* | 1719 | /* |
1719 | * The idmap page is intersecting with the VA space, | 1720 | * The idmap page is intersecting with the VA space, |
1720 | * it is not safe to continue further. | 1721 | * it is not safe to continue further. |
@@ -1893,6 +1894,7 @@ void kvm_arch_memslots_updated(struct kvm *kvm, struct kvm_memslots *slots) | |||
1893 | 1894 | ||
1894 | void kvm_arch_flush_shadow_all(struct kvm *kvm) | 1895 | void kvm_arch_flush_shadow_all(struct kvm *kvm) |
1895 | { | 1896 | { |
1897 | kvm_free_stage2_pgd(kvm); | ||
1896 | } | 1898 | } |
1897 | 1899 | ||
1898 | void kvm_arch_flush_shadow_memslot(struct kvm *kvm, | 1900 | void kvm_arch_flush_shadow_memslot(struct kvm *kvm, |
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 3750575c73c5..06332f626565 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c | |||
@@ -255,6 +255,12 @@ static int __init exynos_pmu_irq_init(struct device_node *node, | |||
255 | return -ENOMEM; | 255 | return -ENOMEM; |
256 | } | 256 | } |
257 | 257 | ||
258 | /* | ||
259 | * Clear the OF_POPULATED flag set in of_irq_init so that | ||
260 | * later the Exynos PMU platform device won't be skipped. | ||
261 | */ | ||
262 | of_node_clear_flag(node, OF_POPULATED); | ||
263 | |||
258 | return 0; | 264 | return 0; |
259 | } | 265 | } |
260 | 266 | ||
diff --git a/arch/arm/mach-imx/mach-imx6ul.c b/arch/arm/mach-imx/mach-imx6ul.c index 5d9bfab279dd..6bb7d9cf1e38 100644 --- a/arch/arm/mach-imx/mach-imx6ul.c +++ b/arch/arm/mach-imx/mach-imx6ul.c | |||
@@ -64,6 +64,7 @@ static void __init imx6ul_init_machine(void) | |||
64 | if (parent == NULL) | 64 | if (parent == NULL) |
65 | pr_warn("failed to initialize soc device\n"); | 65 | pr_warn("failed to initialize soc device\n"); |
66 | 66 | ||
67 | of_platform_default_populate(NULL, NULL, parent); | ||
67 | imx6ul_enet_init(); | 68 | imx6ul_enet_init(); |
68 | imx_anatop_init(); | 69 | imx_anatop_init(); |
69 | imx6ul_pm_init(); | 70 | imx6ul_pm_init(); |
diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index 58924b3844df..fe708e26d021 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c | |||
@@ -295,7 +295,7 @@ int imx6_set_lpm(enum mxc_cpu_pwr_mode mode) | |||
295 | val &= ~BM_CLPCR_SBYOS; | 295 | val &= ~BM_CLPCR_SBYOS; |
296 | if (cpu_is_imx6sl()) | 296 | if (cpu_is_imx6sl()) |
297 | val |= BM_CLPCR_BYPASS_PMIC_READY; | 297 | val |= BM_CLPCR_BYPASS_PMIC_READY; |
298 | if (cpu_is_imx6sl() || cpu_is_imx6sx()) | 298 | if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul()) |
299 | val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; | 299 | val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; |
300 | else | 300 | else |
301 | val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS; | 301 | val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS; |
@@ -310,7 +310,7 @@ int imx6_set_lpm(enum mxc_cpu_pwr_mode mode) | |||
310 | val |= 0x3 << BP_CLPCR_STBY_COUNT; | 310 | val |= 0x3 << BP_CLPCR_STBY_COUNT; |
311 | val |= BM_CLPCR_VSTBY; | 311 | val |= BM_CLPCR_VSTBY; |
312 | val |= BM_CLPCR_SBYOS; | 312 | val |= BM_CLPCR_SBYOS; |
313 | if (cpu_is_imx6sl()) | 313 | if (cpu_is_imx6sl() || cpu_is_imx6sx()) |
314 | val |= BM_CLPCR_BYPASS_PMIC_READY; | 314 | val |= BM_CLPCR_BYPASS_PMIC_READY; |
315 | if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul()) | 315 | if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul()) |
316 | val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; | 316 | val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; |
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c index c073fb57dd13..6f2d0aec0513 100644 --- a/arch/arm/mach-omap2/cm33xx.c +++ b/arch/arm/mach-omap2/cm33xx.c | |||
@@ -220,9 +220,6 @@ static int am33xx_cm_wait_module_ready(u8 part, s16 inst, u16 clkctrl_offs, | |||
220 | { | 220 | { |
221 | int i = 0; | 221 | int i = 0; |
222 | 222 | ||
223 | if (!clkctrl_offs) | ||
224 | return 0; | ||
225 | |||
226 | omap_test_timeout(_is_module_ready(inst, clkctrl_offs), | 223 | omap_test_timeout(_is_module_ready(inst, clkctrl_offs), |
227 | MAX_MODULE_READY_TIME, i); | 224 | MAX_MODULE_READY_TIME, i); |
228 | 225 | ||
@@ -246,9 +243,6 @@ static int am33xx_cm_wait_module_idle(u8 part, s16 inst, u16 clkctrl_offs, | |||
246 | { | 243 | { |
247 | int i = 0; | 244 | int i = 0; |
248 | 245 | ||
249 | if (!clkctrl_offs) | ||
250 | return 0; | ||
251 | |||
252 | omap_test_timeout((_clkctrl_idlest(inst, clkctrl_offs) == | 246 | omap_test_timeout((_clkctrl_idlest(inst, clkctrl_offs) == |
253 | CLKCTRL_IDLEST_DISABLED), | 247 | CLKCTRL_IDLEST_DISABLED), |
254 | MAX_MODULE_READY_TIME, i); | 248 | MAX_MODULE_READY_TIME, i); |
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c index 2c0e07ed6b99..2ab27ade136a 100644 --- a/arch/arm/mach-omap2/cminst44xx.c +++ b/arch/arm/mach-omap2/cminst44xx.c | |||
@@ -278,9 +278,6 @@ static int omap4_cminst_wait_module_ready(u8 part, s16 inst, u16 clkctrl_offs, | |||
278 | { | 278 | { |
279 | int i = 0; | 279 | int i = 0; |
280 | 280 | ||
281 | if (!clkctrl_offs) | ||
282 | return 0; | ||
283 | |||
284 | omap_test_timeout(_is_module_ready(part, inst, clkctrl_offs), | 281 | omap_test_timeout(_is_module_ready(part, inst, clkctrl_offs), |
285 | MAX_MODULE_READY_TIME, i); | 282 | MAX_MODULE_READY_TIME, i); |
286 | 283 | ||
@@ -304,9 +301,6 @@ static int omap4_cminst_wait_module_idle(u8 part, s16 inst, u16 clkctrl_offs, | |||
304 | { | 301 | { |
305 | int i = 0; | 302 | int i = 0; |
306 | 303 | ||
307 | if (!clkctrl_offs) | ||
308 | return 0; | ||
309 | |||
310 | omap_test_timeout((_clkctrl_idlest(part, inst, clkctrl_offs) == | 304 | omap_test_timeout((_clkctrl_idlest(part, inst, clkctrl_offs) == |
311 | CLKCTRL_IDLEST_DISABLED), | 305 | CLKCTRL_IDLEST_DISABLED), |
312 | MAX_MODULE_DISABLE_TIME, i); | 306 | MAX_MODULE_DISABLE_TIME, i); |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 5b709383381c..1052b29697b8 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -1053,6 +1053,10 @@ static int _omap4_wait_target_disable(struct omap_hwmod *oh) | |||
1053 | if (oh->flags & HWMOD_NO_IDLEST) | 1053 | if (oh->flags & HWMOD_NO_IDLEST) |
1054 | return 0; | 1054 | return 0; |
1055 | 1055 | ||
1056 | if (!oh->prcm.omap4.clkctrl_offs && | ||
1057 | !(oh->prcm.omap4.flags & HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET)) | ||
1058 | return 0; | ||
1059 | |||
1056 | return omap_cm_wait_module_idle(oh->clkdm->prcm_partition, | 1060 | return omap_cm_wait_module_idle(oh->clkdm->prcm_partition, |
1057 | oh->clkdm->cm_inst, | 1061 | oh->clkdm->cm_inst, |
1058 | oh->prcm.omap4.clkctrl_offs, 0); | 1062 | oh->prcm.omap4.clkctrl_offs, 0); |
@@ -2971,6 +2975,10 @@ static int _omap4_wait_target_ready(struct omap_hwmod *oh) | |||
2971 | if (!_find_mpu_rt_port(oh)) | 2975 | if (!_find_mpu_rt_port(oh)) |
2972 | return 0; | 2976 | return 0; |
2973 | 2977 | ||
2978 | if (!oh->prcm.omap4.clkctrl_offs && | ||
2979 | !(oh->prcm.omap4.flags & HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET)) | ||
2980 | return 0; | ||
2981 | |||
2974 | /* XXX check module SIDLEMODE, hardreset status */ | 2982 | /* XXX check module SIDLEMODE, hardreset status */ |
2975 | 2983 | ||
2976 | return omap_cm_wait_module_ready(oh->clkdm->prcm_partition, | 2984 | return omap_cm_wait_module_ready(oh->clkdm->prcm_partition, |
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h index 4041bad79a9a..78904017f18c 100644 --- a/arch/arm/mach-omap2/omap_hwmod.h +++ b/arch/arm/mach-omap2/omap_hwmod.h | |||
@@ -443,8 +443,12 @@ struct omap_hwmod_omap2_prcm { | |||
443 | * HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT: Some IP blocks don't have a PRCM | 443 | * HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT: Some IP blocks don't have a PRCM |
444 | * module-level context loss register associated with them; this | 444 | * module-level context loss register associated with them; this |
445 | * flag bit should be set in those cases | 445 | * flag bit should be set in those cases |
446 | * HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET: Some IP blocks have a valid CLKCTRL | ||
447 | * offset of zero; this flag bit should be set in those cases to | ||
448 | * distinguish from hwmods that have no clkctrl offset. | ||
446 | */ | 449 | */ |
447 | #define HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT (1 << 0) | 450 | #define HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT (1 << 0) |
451 | #define HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET (1 << 1) | ||
448 | 452 | ||
449 | /** | 453 | /** |
450 | * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data | 454 | * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data |
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c index 55c5878577f4..e2d84aa7f595 100644 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl)) | 29 | #define CLKCTRL(oh, clkctrl) ((oh).prcm.omap4.clkctrl_offs = (clkctrl)) |
30 | #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl)) | 30 | #define RSTCTRL(oh, rstctrl) ((oh).prcm.omap4.rstctrl_offs = (rstctrl)) |
31 | #define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst)) | 31 | #define RSTST(oh, rstst) ((oh).prcm.omap4.rstst_offs = (rstst)) |
32 | #define PRCM_FLAGS(oh, flag) ((oh).prcm.omap4.flags = (flag)) | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * 'l3' class | 35 | * 'l3' class |
@@ -1296,6 +1297,7 @@ static void omap_hwmod_am33xx_clkctrl(void) | |||
1296 | CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET); | 1297 | CLKCTRL(am33xx_i2c1_hwmod, AM33XX_CM_WKUP_I2C0_CLKCTRL_OFFSET); |
1297 | CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET); | 1298 | CLKCTRL(am33xx_wd_timer1_hwmod, AM33XX_CM_WKUP_WDT1_CLKCTRL_OFFSET); |
1298 | CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET); | 1299 | CLKCTRL(am33xx_rtc_hwmod, AM33XX_CM_RTC_RTC_CLKCTRL_OFFSET); |
1300 | PRCM_FLAGS(am33xx_rtc_hwmod, HWMOD_OMAP4_ZERO_CLKCTRL_OFFSET); | ||
1299 | CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET); | 1301 | CLKCTRL(am33xx_mmc2_hwmod, AM33XX_CM_PER_MMC2_CLKCTRL_OFFSET); |
1300 | CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET); | 1302 | CLKCTRL(am33xx_gpmc_hwmod, AM33XX_CM_PER_GPMC_CLKCTRL_OFFSET); |
1301 | CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET); | 1303 | CLKCTRL(am33xx_l4_ls_hwmod, AM33XX_CM_PER_L4LS_CLKCTRL_OFFSET); |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index d72ee6185d5e..1cc4a6f3954e 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -722,8 +722,20 @@ static struct omap_hwmod omap3xxx_dss_dispc_hwmod = { | |||
722 | * display serial interface controller | 722 | * display serial interface controller |
723 | */ | 723 | */ |
724 | 724 | ||
725 | static struct omap_hwmod_class_sysconfig omap3xxx_dsi_sysc = { | ||
726 | .rev_offs = 0x0000, | ||
727 | .sysc_offs = 0x0010, | ||
728 | .syss_offs = 0x0014, | ||
729 | .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | | ||
730 | SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | | ||
731 | SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), | ||
732 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), | ||
733 | .sysc_fields = &omap_hwmod_sysc_type1, | ||
734 | }; | ||
735 | |||
725 | static struct omap_hwmod_class omap3xxx_dsi_hwmod_class = { | 736 | static struct omap_hwmod_class omap3xxx_dsi_hwmod_class = { |
726 | .name = "dsi", | 737 | .name = "dsi", |
738 | .sysc = &omap3xxx_dsi_sysc, | ||
727 | }; | 739 | }; |
728 | 740 | ||
729 | static struct omap_hwmod_irq_info omap3xxx_dsi1_irqs[] = { | 741 | static struct omap_hwmod_irq_info omap3xxx_dsi1_irqs[] = { |
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index 7245f3359564..d6159f8ef0c2 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -137,6 +137,18 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = { | |||
137 | // no D+ pullup; lubbock can't connect/disconnect in software | 137 | // no D+ pullup; lubbock can't connect/disconnect in software |
138 | }; | 138 | }; |
139 | 139 | ||
140 | static void lubbock_init_pcmcia(void) | ||
141 | { | ||
142 | struct clk *clk; | ||
143 | |||
144 | /* Add an alias for the SA1111 PCMCIA clock */ | ||
145 | clk = clk_get_sys("pxa2xx-pcmcia", NULL); | ||
146 | if (!IS_ERR(clk)) { | ||
147 | clkdev_create(clk, NULL, "1800"); | ||
148 | clk_put(clk); | ||
149 | } | ||
150 | } | ||
151 | |||
140 | static struct resource sa1111_resources[] = { | 152 | static struct resource sa1111_resources[] = { |
141 | [0] = { | 153 | [0] = { |
142 | .start = 0x10000000, | 154 | .start = 0x10000000, |
@@ -467,6 +479,8 @@ static void __init lubbock_init(void) | |||
467 | pxa_set_btuart_info(NULL); | 479 | pxa_set_btuart_info(NULL); |
468 | pxa_set_stuart_info(NULL); | 480 | pxa_set_stuart_info(NULL); |
469 | 481 | ||
482 | lubbock_init_pcmcia(); | ||
483 | |||
470 | clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); | 484 | clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); |
471 | pxa_set_udc_info(&udc_info); | 485 | pxa_set_udc_info(&udc_info); |
472 | pxa_set_fb_info(NULL, &sharp_lm8v31); | 486 | pxa_set_fb_info(NULL, &sharp_lm8v31); |
diff --git a/arch/arm/mach-sa1100/clock.c b/arch/arm/mach-sa1100/clock.c index cbf53bb9c814..0db46895c82a 100644 --- a/arch/arm/mach-sa1100/clock.c +++ b/arch/arm/mach-sa1100/clock.c | |||
@@ -125,6 +125,8 @@ static unsigned long clk_36864_get_rate(struct clk *clk) | |||
125 | } | 125 | } |
126 | 126 | ||
127 | static struct clkops clk_36864_ops = { | 127 | static struct clkops clk_36864_ops = { |
128 | .enable = clk_cpu_enable, | ||
129 | .disable = clk_cpu_disable, | ||
128 | .get_rate = clk_36864_get_rate, | 130 | .get_rate = clk_36864_get_rate, |
129 | }; | 131 | }; |
130 | 132 | ||
@@ -140,9 +142,8 @@ static struct clk_lookup sa11xx_clkregs[] = { | |||
140 | CLKDEV_INIT(NULL, "OSTIMER0", &clk_36864), | 142 | CLKDEV_INIT(NULL, "OSTIMER0", &clk_36864), |
141 | }; | 143 | }; |
142 | 144 | ||
143 | static int __init sa11xx_clk_init(void) | 145 | int __init sa11xx_clk_init(void) |
144 | { | 146 | { |
145 | clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs)); | 147 | clkdev_add_table(sa11xx_clkregs, ARRAY_SIZE(sa11xx_clkregs)); |
146 | return 0; | 148 | return 0; |
147 | } | 149 | } |
148 | core_initcall(sa11xx_clk_init); | ||
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index 345e63f4eb71..3e09beddb6e8 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
36 | #include <mach/irqs.h> | 36 | #include <mach/irqs.h> |
37 | #include <mach/reset.h> | ||
37 | 38 | ||
38 | #include "generic.h" | 39 | #include "generic.h" |
39 | #include <clocksource/pxa.h> | 40 | #include <clocksource/pxa.h> |
@@ -95,6 +96,8 @@ static void sa1100_power_off(void) | |||
95 | 96 | ||
96 | void sa11x0_restart(enum reboot_mode mode, const char *cmd) | 97 | void sa11x0_restart(enum reboot_mode mode, const char *cmd) |
97 | { | 98 | { |
99 | clear_reset_status(RESET_STATUS_ALL); | ||
100 | |||
98 | if (mode == REBOOT_SOFT) { | 101 | if (mode == REBOOT_SOFT) { |
99 | /* Jump into ROM at address 0 */ | 102 | /* Jump into ROM at address 0 */ |
100 | soft_restart(0); | 103 | soft_restart(0); |
@@ -388,6 +391,7 @@ void __init sa1100_init_irq(void) | |||
388 | sa11x0_init_irq_nodt(IRQ_GPIO0_SC, irq_resource.start); | 391 | sa11x0_init_irq_nodt(IRQ_GPIO0_SC, irq_resource.start); |
389 | 392 | ||
390 | sa1100_init_gpio(); | 393 | sa1100_init_gpio(); |
394 | sa11xx_clk_init(); | ||
391 | } | 395 | } |
392 | 396 | ||
393 | /* | 397 | /* |
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h index 0d92e119b36b..68199b603ff7 100644 --- a/arch/arm/mach-sa1100/generic.h +++ b/arch/arm/mach-sa1100/generic.h | |||
@@ -44,3 +44,5 @@ int sa11x0_pm_init(void); | |||
44 | #else | 44 | #else |
45 | static inline int sa11x0_pm_init(void) { return 0; } | 45 | static inline int sa11x0_pm_init(void) { return 0; } |
46 | #endif | 46 | #endif |
47 | |||
48 | int sa11xx_clk_init(void); | ||
diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c index 62437b57813e..73e3adbc1330 100644 --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | |||
@@ -41,39 +41,26 @@ | |||
41 | 41 | ||
42 | #define REGULATOR_IRQ_MASK BIT(2) /* IRQ2, active low */ | 42 | #define REGULATOR_IRQ_MASK BIT(2) /* IRQ2, active low */ |
43 | 43 | ||
44 | static void __iomem *irqc; | 44 | /* start of DA9210 System Control and Event Registers */ |
45 | |||
46 | static const u8 da9063_mask_regs[] = { | ||
47 | DA9063_REG_IRQ_MASK_A, | ||
48 | DA9063_REG_IRQ_MASK_B, | ||
49 | DA9063_REG_IRQ_MASK_C, | ||
50 | DA9063_REG_IRQ_MASK_D, | ||
51 | }; | ||
52 | |||
53 | /* DA9210 System Control and Event Registers */ | ||
54 | #define DA9210_REG_MASK_A 0x54 | 45 | #define DA9210_REG_MASK_A 0x54 |
55 | #define DA9210_REG_MASK_B 0x55 | ||
56 | |||
57 | static const u8 da9210_mask_regs[] = { | ||
58 | DA9210_REG_MASK_A, | ||
59 | DA9210_REG_MASK_B, | ||
60 | }; | ||
61 | |||
62 | static void da9xxx_mask_irqs(struct i2c_client *client, const u8 regs[], | ||
63 | unsigned int nregs) | ||
64 | { | ||
65 | unsigned int i; | ||
66 | 46 | ||
67 | dev_info(&client->dev, "Masking %s interrupt sources\n", client->name); | 47 | static void __iomem *irqc; |
68 | 48 | ||
69 | for (i = 0; i < nregs; i++) { | 49 | /* first byte sets the memory pointer, following are consecutive reg values */ |
70 | int error = i2c_smbus_write_byte_data(client, regs[i], ~0); | 50 | static u8 da9063_irq_clr[] = { DA9063_REG_IRQ_MASK_A, 0xff, 0xff, 0xff, 0xff }; |
71 | if (error) { | 51 | static u8 da9210_irq_clr[] = { DA9210_REG_MASK_A, 0xff, 0xff }; |
72 | dev_err(&client->dev, "i2c error %d\n", error); | 52 | |
73 | return; | 53 | static struct i2c_msg da9xxx_msgs[2] = { |
74 | } | 54 | { |
75 | } | 55 | .addr = 0x58, |
76 | } | 56 | .len = ARRAY_SIZE(da9063_irq_clr), |
57 | .buf = da9063_irq_clr, | ||
58 | }, { | ||
59 | .addr = 0x68, | ||
60 | .len = ARRAY_SIZE(da9210_irq_clr), | ||
61 | .buf = da9210_irq_clr, | ||
62 | }, | ||
63 | }; | ||
77 | 64 | ||
78 | static int regulator_quirk_notify(struct notifier_block *nb, | 65 | static int regulator_quirk_notify(struct notifier_block *nb, |
79 | unsigned long action, void *data) | 66 | unsigned long action, void *data) |
@@ -93,12 +80,15 @@ static int regulator_quirk_notify(struct notifier_block *nb, | |||
93 | client = to_i2c_client(dev); | 80 | client = to_i2c_client(dev); |
94 | dev_dbg(dev, "Detected %s\n", client->name); | 81 | dev_dbg(dev, "Detected %s\n", client->name); |
95 | 82 | ||
96 | if ((client->addr == 0x58 && !strcmp(client->name, "da9063"))) | 83 | if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) || |
97 | da9xxx_mask_irqs(client, da9063_mask_regs, | 84 | (client->addr == 0x68 && !strcmp(client->name, "da9210"))) { |
98 | ARRAY_SIZE(da9063_mask_regs)); | 85 | int ret; |
99 | else if (client->addr == 0x68 && !strcmp(client->name, "da9210")) | 86 | |
100 | da9xxx_mask_irqs(client, da9210_mask_regs, | 87 | dev_info(&client->dev, "clearing da9063/da9210 interrupts\n"); |
101 | ARRAY_SIZE(da9210_mask_regs)); | 88 | ret = i2c_transfer(client->adapter, da9xxx_msgs, ARRAY_SIZE(da9xxx_msgs)); |
89 | if (ret != ARRAY_SIZE(da9xxx_msgs)) | ||
90 | dev_err(&client->dev, "i2c error %d\n", ret); | ||
91 | } | ||
102 | 92 | ||
103 | mon = ioread32(irqc + IRQC_MONITOR); | 93 | mon = ioread32(irqc + IRQC_MONITOR); |
104 | if (mon & REGULATOR_IRQ_MASK) | 94 | if (mon & REGULATOR_IRQ_MASK) |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 6344913f0804..30fe03f95c85 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -137,7 +137,7 @@ void __init init_default_cache_policy(unsigned long pmd) | |||
137 | 137 | ||
138 | initial_pmd_value = pmd; | 138 | initial_pmd_value = pmd; |
139 | 139 | ||
140 | pmd &= PMD_SECT_TEX(1) | PMD_SECT_BUFFERABLE | PMD_SECT_CACHEABLE; | 140 | pmd &= PMD_SECT_CACHE_MASK; |
141 | 141 | ||
142 | for (i = 0; i < ARRAY_SIZE(cache_policies); i++) | 142 | for (i = 0; i < ARRAY_SIZE(cache_policies); i++) |
143 | if (cache_policies[i].pmd == pmd) { | 143 | if (cache_policies[i].pmd == pmd) { |
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index a7123b4e129d..d00d52c9de3e 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <asm/hwcap.h> | 16 | #include <asm/hwcap.h> |
17 | #include <asm/pgtable-hwdef.h> | 17 | #include <asm/pgtable-hwdef.h> |
18 | #include <asm/pgtable.h> | 18 | #include <asm/pgtable.h> |
19 | #include <asm/memory.h> | ||
19 | 20 | ||
20 | #include "proc-macros.S" | 21 | #include "proc-macros.S" |
21 | 22 | ||
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 3d2cef6488ea..f193414d0f6f 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c | |||
@@ -170,9 +170,6 @@ static int xen_starting_cpu(unsigned int cpu) | |||
170 | pr_info("Xen: initializing cpu%d\n", cpu); | 170 | pr_info("Xen: initializing cpu%d\n", cpu); |
171 | vcpup = per_cpu_ptr(xen_vcpu_info, cpu); | 171 | vcpup = per_cpu_ptr(xen_vcpu_info, cpu); |
172 | 172 | ||
173 | /* Direct vCPU id mapping for ARM guests. */ | ||
174 | per_cpu(xen_vcpu_id, cpu) = cpu; | ||
175 | |||
176 | info.mfn = virt_to_gfn(vcpup); | 173 | info.mfn = virt_to_gfn(vcpup); |
177 | info.offset = xen_offset_in_page(vcpup); | 174 | info.offset = xen_offset_in_page(vcpup); |
178 | 175 | ||
@@ -330,6 +327,7 @@ static int __init xen_guest_init(void) | |||
330 | { | 327 | { |
331 | struct xen_add_to_physmap xatp; | 328 | struct xen_add_to_physmap xatp; |
332 | struct shared_info *shared_info_page = NULL; | 329 | struct shared_info *shared_info_page = NULL; |
330 | int cpu; | ||
333 | 331 | ||
334 | if (!xen_domain()) | 332 | if (!xen_domain()) |
335 | return 0; | 333 | return 0; |
@@ -380,7 +378,8 @@ static int __init xen_guest_init(void) | |||
380 | return -ENOMEM; | 378 | return -ENOMEM; |
381 | 379 | ||
382 | /* Direct vCPU id mapping for ARM guests. */ | 380 | /* Direct vCPU id mapping for ARM guests. */ |
383 | per_cpu(xen_vcpu_id, 0) = 0; | 381 | for_each_possible_cpu(cpu) |
382 | per_cpu(xen_vcpu_id, cpu) = cpu; | ||
384 | 383 | ||
385 | xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); | 384 | xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); |
386 | if (xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn, | 385 | if (xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn, |
diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi index 445aa678f914..c2b9bcb0ef61 100644 --- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | |||
@@ -255,10 +255,10 @@ | |||
255 | /* Local timer */ | 255 | /* Local timer */ |
256 | timer { | 256 | timer { |
257 | compatible = "arm,armv8-timer"; | 257 | compatible = "arm,armv8-timer"; |
258 | interrupts = <1 13 0xf01>, | 258 | interrupts = <1 13 0xf08>, |
259 | <1 14 0xf01>, | 259 | <1 14 0xf08>, |
260 | <1 11 0xf01>, | 260 | <1 11 0xf08>, |
261 | <1 10 0xf01>; | 261 | <1 10 0xf08>; |
262 | }; | 262 | }; |
263 | 263 | ||
264 | timer0: timer0@ffc03000 { | 264 | timer0: timer0@ffc03000 { |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi index e502c24b0ac7..bf6c8d051002 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | |||
@@ -102,13 +102,13 @@ | |||
102 | timer { | 102 | timer { |
103 | compatible = "arm,armv8-timer"; | 103 | compatible = "arm,armv8-timer"; |
104 | interrupts = <GIC_PPI 13 | 104 | interrupts = <GIC_PPI 13 |
105 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, | 105 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, |
106 | <GIC_PPI 14 | 106 | <GIC_PPI 14 |
107 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, | 107 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, |
108 | <GIC_PPI 11 | 108 | <GIC_PPI 11 |
109 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, | 109 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, |
110 | <GIC_PPI 10 | 110 | <GIC_PPI 10 |
111 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>; | 111 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | xtal: xtal-clk { | 114 | xtal: xtal-clk { |
diff --git a/arch/arm64/boot/dts/apm/apm-storm.dtsi b/arch/arm64/boot/dts/apm/apm-storm.dtsi index f1c2c713f9b0..c29dab9d1834 100644 --- a/arch/arm64/boot/dts/apm/apm-storm.dtsi +++ b/arch/arm64/boot/dts/apm/apm-storm.dtsi | |||
@@ -110,10 +110,10 @@ | |||
110 | 110 | ||
111 | timer { | 111 | timer { |
112 | compatible = "arm,armv8-timer"; | 112 | compatible = "arm,armv8-timer"; |
113 | interrupts = <1 0 0xff01>, /* Secure Phys IRQ */ | 113 | interrupts = <1 0 0xff08>, /* Secure Phys IRQ */ |
114 | <1 13 0xff01>, /* Non-secure Phys IRQ */ | 114 | <1 13 0xff08>, /* Non-secure Phys IRQ */ |
115 | <1 14 0xff01>, /* Virt IRQ */ | 115 | <1 14 0xff08>, /* Virt IRQ */ |
116 | <1 15 0xff01>; /* Hyp IRQ */ | 116 | <1 15 0xff08>; /* Hyp IRQ */ |
117 | clock-frequency = <50000000>; | 117 | clock-frequency = <50000000>; |
118 | }; | 118 | }; |
119 | 119 | ||
diff --git a/arch/arm64/boot/dts/broadcom/bcm2835-rpi.dtsi b/arch/arm64/boot/dts/broadcom/bcm2835-rpi.dtsi new file mode 120000 index 000000000000..3937b77cb310 --- /dev/null +++ b/arch/arm64/boot/dts/broadcom/bcm2835-rpi.dtsi | |||
@@ -0,0 +1 @@ | |||
../../../../arm/boot/dts/bcm2835-rpi.dtsi \ No newline at end of file | |||
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts index 6f47dd2bb1db..7841b724e340 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | |||
@@ -1,7 +1,7 @@ | |||
1 | /dts-v1/; | 1 | /dts-v1/; |
2 | #include "bcm2837.dtsi" | 2 | #include "bcm2837.dtsi" |
3 | #include "../../../../arm/boot/dts/bcm2835-rpi.dtsi" | 3 | #include "bcm2835-rpi.dtsi" |
4 | #include "../../../../arm/boot/dts/bcm283x-rpi-smsc9514.dtsi" | 4 | #include "bcm283x-rpi-smsc9514.dtsi" |
5 | 5 | ||
6 | / { | 6 | / { |
7 | compatible = "raspberrypi,3-model-b", "brcm,bcm2837"; | 7 | compatible = "raspberrypi,3-model-b", "brcm,bcm2837"; |
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837.dtsi b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi index f2a31d06845d..8216bbb29fe0 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2837.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "../../../../arm/boot/dts/bcm283x.dtsi" | 1 | #include "bcm283x.dtsi" |
2 | 2 | ||
3 | / { | 3 | / { |
4 | compatible = "brcm,bcm2836"; | 4 | compatible = "brcm,bcm2836"; |
diff --git a/arch/arm64/boot/dts/broadcom/bcm283x-rpi-smsc9514.dtsi b/arch/arm64/boot/dts/broadcom/bcm283x-rpi-smsc9514.dtsi new file mode 120000 index 000000000000..dca7c057d5a5 --- /dev/null +++ b/arch/arm64/boot/dts/broadcom/bcm283x-rpi-smsc9514.dtsi | |||
@@ -0,0 +1 @@ | |||
../../../../arm/boot/dts/bcm283x-rpi-smsc9514.dtsi \ No newline at end of file | |||
diff --git a/arch/arm64/boot/dts/broadcom/bcm283x.dtsi b/arch/arm64/boot/dts/broadcom/bcm283x.dtsi new file mode 120000 index 000000000000..5f54e4cab99b --- /dev/null +++ b/arch/arm64/boot/dts/broadcom/bcm283x.dtsi | |||
@@ -0,0 +1 @@ | |||
../../../../arm/boot/dts/bcm283x.dtsi \ No newline at end of file | |||
diff --git a/arch/arm64/boot/dts/broadcom/ns2.dtsi b/arch/arm64/boot/dts/broadcom/ns2.dtsi index f53b0955bfd3..d4a12fad8afd 100644 --- a/arch/arm64/boot/dts/broadcom/ns2.dtsi +++ b/arch/arm64/boot/dts/broadcom/ns2.dtsi | |||
@@ -88,13 +88,13 @@ | |||
88 | timer { | 88 | timer { |
89 | compatible = "arm,armv8-timer"; | 89 | compatible = "arm,armv8-timer"; |
90 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(0xff) | | 90 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(0xff) | |
91 | IRQ_TYPE_EDGE_RISING)>, | 91 | IRQ_TYPE_LEVEL_LOW)>, |
92 | <GIC_PPI 14 (GIC_CPU_MASK_RAW(0xff) | | 92 | <GIC_PPI 14 (GIC_CPU_MASK_RAW(0xff) | |
93 | IRQ_TYPE_EDGE_RISING)>, | 93 | IRQ_TYPE_LEVEL_LOW)>, |
94 | <GIC_PPI 11 (GIC_CPU_MASK_RAW(0xff) | | 94 | <GIC_PPI 11 (GIC_CPU_MASK_RAW(0xff) | |
95 | IRQ_TYPE_EDGE_RISING)>, | 95 | IRQ_TYPE_LEVEL_LOW)>, |
96 | <GIC_PPI 10 (GIC_CPU_MASK_RAW(0xff) | | 96 | <GIC_PPI 10 (GIC_CPU_MASK_RAW(0xff) | |
97 | IRQ_TYPE_EDGE_RISING)>; | 97 | IRQ_TYPE_LEVEL_LOW)>; |
98 | }; | 98 | }; |
99 | 99 | ||
100 | pmu { | 100 | pmu { |
diff --git a/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi b/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi index 2eb9b225f0bc..04dc8a8d1539 100644 --- a/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi +++ b/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi | |||
@@ -354,10 +354,10 @@ | |||
354 | 354 | ||
355 | timer { | 355 | timer { |
356 | compatible = "arm,armv8-timer"; | 356 | compatible = "arm,armv8-timer"; |
357 | interrupts = <1 13 0xff01>, | 357 | interrupts = <1 13 4>, |
358 | <1 14 0xff01>, | 358 | <1 14 4>, |
359 | <1 11 0xff01>, | 359 | <1 11 4>, |
360 | <1 10 0xff01>; | 360 | <1 10 4>; |
361 | }; | 361 | }; |
362 | 362 | ||
363 | pmu { | 363 | pmu { |
diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi index ca663dfe5189..162831546e18 100644 --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi | |||
@@ -473,10 +473,10 @@ | |||
473 | 473 | ||
474 | timer { | 474 | timer { |
475 | compatible = "arm,armv8-timer"; | 475 | compatible = "arm,armv8-timer"; |
476 | interrupts = <1 13 0xff01>, | 476 | interrupts = <1 13 0xff08>, |
477 | <1 14 0xff01>, | 477 | <1 14 0xff08>, |
478 | <1 11 0xff01>, | 478 | <1 11 0xff08>, |
479 | <1 10 0xff01>; | 479 | <1 10 0xff08>; |
480 | }; | 480 | }; |
481 | 481 | ||
482 | pmu_system_controller: system-controller@105c0000 { | 482 | pmu_system_controller: system-controller@105c0000 { |
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi index e669fbd7f9c3..a67e210e2019 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi | |||
@@ -119,10 +119,10 @@ | |||
119 | 119 | ||
120 | timer { | 120 | timer { |
121 | compatible = "arm,armv8-timer"; | 121 | compatible = "arm,armv8-timer"; |
122 | interrupts = <1 13 0x1>, /* Physical Secure PPI */ | 122 | interrupts = <1 13 0xf08>, /* Physical Secure PPI */ |
123 | <1 14 0x1>, /* Physical Non-Secure PPI */ | 123 | <1 14 0xf08>, /* Physical Non-Secure PPI */ |
124 | <1 11 0x1>, /* Virtual PPI */ | 124 | <1 11 0xf08>, /* Virtual PPI */ |
125 | <1 10 0x1>; /* Hypervisor PPI */ | 125 | <1 10 0xf08>; /* Hypervisor PPI */ |
126 | }; | 126 | }; |
127 | 127 | ||
128 | pmu { | 128 | pmu { |
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi index 21023a388c29..e3b6034ea5d9 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi | |||
@@ -191,10 +191,10 @@ | |||
191 | 191 | ||
192 | timer { | 192 | timer { |
193 | compatible = "arm,armv8-timer"; | 193 | compatible = "arm,armv8-timer"; |
194 | interrupts = <1 13 0x8>, /* Physical Secure PPI, active-low */ | 194 | interrupts = <1 13 4>, /* Physical Secure PPI, active-low */ |
195 | <1 14 0x8>, /* Physical Non-Secure PPI, active-low */ | 195 | <1 14 4>, /* Physical Non-Secure PPI, active-low */ |
196 | <1 11 0x8>, /* Virtual PPI, active-low */ | 196 | <1 11 4>, /* Virtual PPI, active-low */ |
197 | <1 10 0x8>; /* Hypervisor PPI, active-low */ | 197 | <1 10 4>; /* Hypervisor PPI, active-low */ |
198 | }; | 198 | }; |
199 | 199 | ||
200 | pmu { | 200 | pmu { |
diff --git a/arch/arm64/boot/dts/marvell/armada-ap806.dtsi b/arch/arm64/boot/dts/marvell/armada-ap806.dtsi index eab1a42fb934..c2a6745f168c 100644 --- a/arch/arm64/boot/dts/marvell/armada-ap806.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-ap806.dtsi | |||
@@ -122,10 +122,10 @@ | |||
122 | 122 | ||
123 | timer { | 123 | timer { |
124 | compatible = "arm,armv8-timer"; | 124 | compatible = "arm,armv8-timer"; |
125 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, | 125 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
126 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, | 126 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
127 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, | 127 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
128 | <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; | 128 | <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | odmi: odmi@300000 { | 131 | odmi: odmi@300000 { |
diff --git a/arch/arm64/boot/dts/socionext/uniphier-ph1-ld20.dtsi b/arch/arm64/boot/dts/socionext/uniphier-ph1-ld20.dtsi index c223915f0907..d73bdc8c9115 100644 --- a/arch/arm64/boot/dts/socionext/uniphier-ph1-ld20.dtsi +++ b/arch/arm64/boot/dts/socionext/uniphier-ph1-ld20.dtsi | |||
@@ -129,10 +129,10 @@ | |||
129 | 129 | ||
130 | timer { | 130 | timer { |
131 | compatible = "arm,armv8-timer"; | 131 | compatible = "arm,armv8-timer"; |
132 | interrupts = <1 13 0xf01>, | 132 | interrupts = <1 13 4>, |
133 | <1 14 0xf01>, | 133 | <1 14 4>, |
134 | <1 11 0xf01>, | 134 | <1 11 4>, |
135 | <1 10 0xf01>; | 135 | <1 10 4>; |
136 | }; | 136 | }; |
137 | 137 | ||
138 | soc { | 138 | soc { |
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi index e595f22e7e4b..3e2e51fbd2bc 100644 --- a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi +++ b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi | |||
@@ -65,10 +65,10 @@ | |||
65 | timer { | 65 | timer { |
66 | compatible = "arm,armv8-timer"; | 66 | compatible = "arm,armv8-timer"; |
67 | interrupt-parent = <&gic>; | 67 | interrupt-parent = <&gic>; |
68 | interrupts = <1 13 0xf01>, | 68 | interrupts = <1 13 0xf08>, |
69 | <1 14 0xf01>, | 69 | <1 14 0xf08>, |
70 | <1 11 0xf01>, | 70 | <1 11 0xf08>, |
71 | <1 10 0xf01>; | 71 | <1 10 0xf08>; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | amba_apu { | 74 | amba_apu { |
diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c index 5c888049d061..6b2aa0fd6cd0 100644 --- a/arch/arm64/crypto/aes-glue.c +++ b/arch/arm64/crypto/aes-glue.c | |||
@@ -216,7 +216,7 @@ static int ctr_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
216 | err = blkcipher_walk_done(desc, &walk, | 216 | err = blkcipher_walk_done(desc, &walk, |
217 | walk.nbytes % AES_BLOCK_SIZE); | 217 | walk.nbytes % AES_BLOCK_SIZE); |
218 | } | 218 | } |
219 | if (nbytes) { | 219 | if (walk.nbytes % AES_BLOCK_SIZE) { |
220 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; | 220 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; |
221 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; | 221 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; |
222 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; | 222 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; |
diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index 0a456bef8c79..2fee2f59288c 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h | |||
@@ -199,19 +199,19 @@ static inline unsigned long __percpu_xchg(void *ptr, unsigned long val, | |||
199 | #define _percpu_read(pcp) \ | 199 | #define _percpu_read(pcp) \ |
200 | ({ \ | 200 | ({ \ |
201 | typeof(pcp) __retval; \ | 201 | typeof(pcp) __retval; \ |
202 | preempt_disable(); \ | 202 | preempt_disable_notrace(); \ |
203 | __retval = (typeof(pcp))__percpu_read(raw_cpu_ptr(&(pcp)), \ | 203 | __retval = (typeof(pcp))__percpu_read(raw_cpu_ptr(&(pcp)), \ |
204 | sizeof(pcp)); \ | 204 | sizeof(pcp)); \ |
205 | preempt_enable(); \ | 205 | preempt_enable_notrace(); \ |
206 | __retval; \ | 206 | __retval; \ |
207 | }) | 207 | }) |
208 | 208 | ||
209 | #define _percpu_write(pcp, val) \ | 209 | #define _percpu_write(pcp, val) \ |
210 | do { \ | 210 | do { \ |
211 | preempt_disable(); \ | 211 | preempt_disable_notrace(); \ |
212 | __percpu_write(raw_cpu_ptr(&(pcp)), (unsigned long)(val), \ | 212 | __percpu_write(raw_cpu_ptr(&(pcp)), (unsigned long)(val), \ |
213 | sizeof(pcp)); \ | 213 | sizeof(pcp)); \ |
214 | preempt_enable(); \ | 214 | preempt_enable_notrace(); \ |
215 | } while(0) \ | 215 | } while(0) \ |
216 | 216 | ||
217 | #define _pcp_protect(operation, pcp, val) \ | 217 | #define _pcp_protect(operation, pcp, val) \ |
diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h index e875a5a551d7..89206b568cd4 100644 --- a/arch/arm64/include/asm/spinlock.h +++ b/arch/arm64/include/asm/spinlock.h | |||
@@ -363,4 +363,14 @@ static inline int arch_read_trylock(arch_rwlock_t *rw) | |||
363 | #define arch_read_relax(lock) cpu_relax() | 363 | #define arch_read_relax(lock) cpu_relax() |
364 | #define arch_write_relax(lock) cpu_relax() | 364 | #define arch_write_relax(lock) cpu_relax() |
365 | 365 | ||
366 | /* | ||
367 | * Accesses appearing in program order before a spin_lock() operation | ||
368 | * can be reordered with accesses inside the critical section, by virtue | ||
369 | * of arch_spin_lock being constructed using acquire semantics. | ||
370 | * | ||
371 | * In cases where this is problematic (e.g. try_to_wake_up), an | ||
372 | * smp_mb__before_spinlock() can restore the required ordering. | ||
373 | */ | ||
374 | #define smp_mb__before_spinlock() smp_mb() | ||
375 | |||
366 | #endif /* __ASM_SPINLOCK_H */ | 376 | #endif /* __ASM_SPINLOCK_H */ |
diff --git a/arch/avr32/include/asm/uaccess.h b/arch/avr32/include/asm/uaccess.h index 68cf638faf48..b1ec1fa06463 100644 --- a/arch/avr32/include/asm/uaccess.h +++ b/arch/avr32/include/asm/uaccess.h | |||
@@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void *to, const void *from, | |||
74 | 74 | ||
75 | extern __kernel_size_t copy_to_user(void __user *to, const void *from, | 75 | extern __kernel_size_t copy_to_user(void __user *to, const void *from, |
76 | __kernel_size_t n); | 76 | __kernel_size_t n); |
77 | extern __kernel_size_t copy_from_user(void *to, const void __user *from, | 77 | extern __kernel_size_t ___copy_from_user(void *to, const void __user *from, |
78 | __kernel_size_t n); | 78 | __kernel_size_t n); |
79 | 79 | ||
80 | static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, | 80 | static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, |
@@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_from_user(void *to, | |||
88 | { | 88 | { |
89 | return __copy_user(to, (const void __force *)from, n); | 89 | return __copy_user(to, (const void __force *)from, n); |
90 | } | 90 | } |
91 | static inline __kernel_size_t copy_from_user(void *to, | ||
92 | const void __user *from, | ||
93 | __kernel_size_t n) | ||
94 | { | ||
95 | size_t res = ___copy_from_user(to, from, n); | ||
96 | if (unlikely(res)) | ||
97 | memset(to + (n - res), 0, res); | ||
98 | return res; | ||
99 | } | ||
91 | 100 | ||
92 | #define __copy_to_user_inatomic __copy_to_user | 101 | #define __copy_to_user_inatomic __copy_to_user |
93 | #define __copy_from_user_inatomic __copy_from_user | 102 | #define __copy_from_user_inatomic __copy_from_user |
diff --git a/arch/avr32/kernel/avr32_ksyms.c b/arch/avr32/kernel/avr32_ksyms.c index d93ead02daed..7c6cf14f0985 100644 --- a/arch/avr32/kernel/avr32_ksyms.c +++ b/arch/avr32/kernel/avr32_ksyms.c | |||
@@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page); | |||
36 | /* | 36 | /* |
37 | * Userspace access stuff. | 37 | * Userspace access stuff. |
38 | */ | 38 | */ |
39 | EXPORT_SYMBOL(copy_from_user); | 39 | EXPORT_SYMBOL(___copy_from_user); |
40 | EXPORT_SYMBOL(copy_to_user); | 40 | EXPORT_SYMBOL(copy_to_user); |
41 | EXPORT_SYMBOL(__copy_user); | 41 | EXPORT_SYMBOL(__copy_user); |
42 | EXPORT_SYMBOL(strncpy_from_user); | 42 | EXPORT_SYMBOL(strncpy_from_user); |
diff --git a/arch/avr32/lib/copy_user.S b/arch/avr32/lib/copy_user.S index ea59c04b07de..075373471da1 100644 --- a/arch/avr32/lib/copy_user.S +++ b/arch/avr32/lib/copy_user.S | |||
@@ -23,13 +23,13 @@ | |||
23 | */ | 23 | */ |
24 | .text | 24 | .text |
25 | .align 1 | 25 | .align 1 |
26 | .global copy_from_user | 26 | .global ___copy_from_user |
27 | .type copy_from_user, @function | 27 | .type ___copy_from_user, @function |
28 | copy_from_user: | 28 | ___copy_from_user: |
29 | branch_if_kernel r8, __copy_user | 29 | branch_if_kernel r8, __copy_user |
30 | ret_if_privileged r8, r11, r10, r10 | 30 | ret_if_privileged r8, r11, r10, r10 |
31 | rjmp __copy_user | 31 | rjmp __copy_user |
32 | .size copy_from_user, . - copy_from_user | 32 | .size ___copy_from_user, . - ___copy_from_user |
33 | 33 | ||
34 | .global copy_to_user | 34 | .global copy_to_user |
35 | .type copy_to_user, @function | 35 | .type copy_to_user, @function |
diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h index 12f5d6851bbc..0a2a70096d8b 100644 --- a/arch/blackfin/include/asm/uaccess.h +++ b/arch/blackfin/include/asm/uaccess.h | |||
@@ -171,11 +171,12 @@ static inline int bad_user_access_length(void) | |||
171 | static inline unsigned long __must_check | 171 | static inline unsigned long __must_check |
172 | copy_from_user(void *to, const void __user *from, unsigned long n) | 172 | copy_from_user(void *to, const void __user *from, unsigned long n) |
173 | { | 173 | { |
174 | if (access_ok(VERIFY_READ, from, n)) | 174 | if (likely(access_ok(VERIFY_READ, from, n))) { |
175 | memcpy(to, (const void __force *)from, n); | 175 | memcpy(to, (const void __force *)from, n); |
176 | else | 176 | return 0; |
177 | return n; | 177 | } |
178 | return 0; | 178 | memset(to, 0, n); |
179 | return n; | ||
179 | } | 180 | } |
180 | 181 | ||
181 | static inline unsigned long __must_check | 182 | static inline unsigned long __must_check |
diff --git a/arch/cris/include/asm/uaccess.h b/arch/cris/include/asm/uaccess.h index e3530d0f13ee..56c7d5750abd 100644 --- a/arch/cris/include/asm/uaccess.h +++ b/arch/cris/include/asm/uaccess.h | |||
@@ -194,30 +194,6 @@ extern unsigned long __copy_user(void __user *to, const void *from, unsigned lon | |||
194 | extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n); | 194 | extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n); |
195 | extern unsigned long __do_clear_user(void __user *to, unsigned long n); | 195 | extern unsigned long __do_clear_user(void __user *to, unsigned long n); |
196 | 196 | ||
197 | static inline unsigned long | ||
198 | __generic_copy_to_user(void __user *to, const void *from, unsigned long n) | ||
199 | { | ||
200 | if (access_ok(VERIFY_WRITE, to, n)) | ||
201 | return __copy_user(to, from, n); | ||
202 | return n; | ||
203 | } | ||
204 | |||
205 | static inline unsigned long | ||
206 | __generic_copy_from_user(void *to, const void __user *from, unsigned long n) | ||
207 | { | ||
208 | if (access_ok(VERIFY_READ, from, n)) | ||
209 | return __copy_user_zeroing(to, from, n); | ||
210 | return n; | ||
211 | } | ||
212 | |||
213 | static inline unsigned long | ||
214 | __generic_clear_user(void __user *to, unsigned long n) | ||
215 | { | ||
216 | if (access_ok(VERIFY_WRITE, to, n)) | ||
217 | return __do_clear_user(to, n); | ||
218 | return n; | ||
219 | } | ||
220 | |||
221 | static inline long | 197 | static inline long |
222 | __strncpy_from_user(char *dst, const char __user *src, long count) | 198 | __strncpy_from_user(char *dst, const char __user *src, long count) |
223 | { | 199 | { |
@@ -282,7 +258,7 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n) | |||
282 | else if (n == 24) | 258 | else if (n == 24) |
283 | __asm_copy_from_user_24(to, from, ret); | 259 | __asm_copy_from_user_24(to, from, ret); |
284 | else | 260 | else |
285 | ret = __generic_copy_from_user(to, from, n); | 261 | ret = __copy_user_zeroing(to, from, n); |
286 | 262 | ||
287 | return ret; | 263 | return ret; |
288 | } | 264 | } |
@@ -333,7 +309,7 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n) | |||
333 | else if (n == 24) | 309 | else if (n == 24) |
334 | __asm_copy_to_user_24(to, from, ret); | 310 | __asm_copy_to_user_24(to, from, ret); |
335 | else | 311 | else |
336 | ret = __generic_copy_to_user(to, from, n); | 312 | ret = __copy_user(to, from, n); |
337 | 313 | ||
338 | return ret; | 314 | return ret; |
339 | } | 315 | } |
@@ -366,26 +342,43 @@ __constant_clear_user(void __user *to, unsigned long n) | |||
366 | else if (n == 24) | 342 | else if (n == 24) |
367 | __asm_clear_24(to, ret); | 343 | __asm_clear_24(to, ret); |
368 | else | 344 | else |
369 | ret = __generic_clear_user(to, n); | 345 | ret = __do_clear_user(to, n); |
370 | 346 | ||
371 | return ret; | 347 | return ret; |
372 | } | 348 | } |
373 | 349 | ||
374 | 350 | ||
375 | #define clear_user(to, n) \ | 351 | static inline size_t clear_user(void __user *to, size_t n) |
376 | (__builtin_constant_p(n) ? \ | 352 | { |
377 | __constant_clear_user(to, n) : \ | 353 | if (unlikely(!access_ok(VERIFY_WRITE, to, n))) |
378 | __generic_clear_user(to, n)) | 354 | return n; |
355 | if (__builtin_constant_p(n)) | ||
356 | return __constant_clear_user(to, n); | ||
357 | else | ||
358 | return __do_clear_user(to, n); | ||
359 | } | ||
379 | 360 | ||
380 | #define copy_from_user(to, from, n) \ | 361 | static inline size_t copy_from_user(void *to, const void __user *from, size_t n) |
381 | (__builtin_constant_p(n) ? \ | 362 | { |
382 | __constant_copy_from_user(to, from, n) : \ | 363 | if (unlikely(!access_ok(VERIFY_READ, from, n))) { |
383 | __generic_copy_from_user(to, from, n)) | 364 | memset(to, 0, n); |
365 | return n; | ||
366 | } | ||
367 | if (__builtin_constant_p(n)) | ||
368 | return __constant_copy_from_user(to, from, n); | ||
369 | else | ||
370 | return __copy_user_zeroing(to, from, n); | ||
371 | } | ||
384 | 372 | ||
385 | #define copy_to_user(to, from, n) \ | 373 | static inline size_t copy_to_user(void __user *to, const void *from, size_t n) |
386 | (__builtin_constant_p(n) ? \ | 374 | { |
387 | __constant_copy_to_user(to, from, n) : \ | 375 | if (unlikely(!access_ok(VERIFY_WRITE, to, n))) |
388 | __generic_copy_to_user(to, from, n)) | 376 | return n; |
377 | if (__builtin_constant_p(n)) | ||
378 | return __constant_copy_to_user(to, from, n); | ||
379 | else | ||
380 | return __copy_user(to, from, n); | ||
381 | } | ||
389 | 382 | ||
390 | /* We let the __ versions of copy_from/to_user inline, because they're often | 383 | /* We let the __ versions of copy_from/to_user inline, because they're often |
391 | * used in fast paths and have only a small space overhead. | 384 | * used in fast paths and have only a small space overhead. |
diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h index 3ac9a59d65d4..87d9e34c5df8 100644 --- a/arch/frv/include/asm/uaccess.h +++ b/arch/frv/include/asm/uaccess.h | |||
@@ -263,19 +263,25 @@ do { \ | |||
263 | extern long __memset_user(void *dst, unsigned long count); | 263 | extern long __memset_user(void *dst, unsigned long count); |
264 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); | 264 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); |
265 | 265 | ||
266 | #define clear_user(dst,count) __memset_user(____force(dst), (count)) | 266 | #define __clear_user(dst,count) __memset_user(____force(dst), (count)) |
267 | #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) | 267 | #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) |
268 | #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) | 268 | #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) |
269 | 269 | ||
270 | #else | 270 | #else |
271 | 271 | ||
272 | #define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) | 272 | #define __clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) |
273 | #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) | 273 | #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) |
274 | #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) | 274 | #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) |
275 | 275 | ||
276 | #endif | 276 | #endif |
277 | 277 | ||
278 | #define __clear_user clear_user | 278 | static inline unsigned long __must_check |
279 | clear_user(void __user *to, unsigned long n) | ||
280 | { | ||
281 | if (likely(__access_ok(to, n))) | ||
282 | n = __clear_user(to, n); | ||
283 | return n; | ||
284 | } | ||
279 | 285 | ||
280 | static inline unsigned long __must_check | 286 | static inline unsigned long __must_check |
281 | __copy_to_user(void __user *to, const void *from, unsigned long n) | 287 | __copy_to_user(void __user *to, const void *from, unsigned long n) |
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h index f000a382bc7f..f61cfb28e9f2 100644 --- a/arch/hexagon/include/asm/uaccess.h +++ b/arch/hexagon/include/asm/uaccess.h | |||
@@ -103,7 +103,8 @@ static inline long hexagon_strncpy_from_user(char *dst, const char __user *src, | |||
103 | { | 103 | { |
104 | long res = __strnlen_user(src, n); | 104 | long res = __strnlen_user(src, n); |
105 | 105 | ||
106 | /* return from strnlen can't be zero -- that would be rubbish. */ | 106 | if (unlikely(!res)) |
107 | return -EFAULT; | ||
107 | 108 | ||
108 | if (res > n) { | 109 | if (res > n) { |
109 | copy_from_user(dst, src, n); | 110 | copy_from_user(dst, src, n); |
diff --git a/arch/ia64/include/asm/uaccess.h b/arch/ia64/include/asm/uaccess.h index 465c70982f40..bfe13196f770 100644 --- a/arch/ia64/include/asm/uaccess.h +++ b/arch/ia64/include/asm/uaccess.h | |||
@@ -241,8 +241,7 @@ extern unsigned long __must_check __copy_user (void __user *to, const void __use | |||
241 | static inline unsigned long | 241 | static inline unsigned long |
242 | __copy_to_user (void __user *to, const void *from, unsigned long count) | 242 | __copy_to_user (void __user *to, const void *from, unsigned long count) |
243 | { | 243 | { |
244 | if (!__builtin_constant_p(count)) | 244 | check_object_size(from, count, true); |
245 | check_object_size(from, count, true); | ||
246 | 245 | ||
247 | return __copy_user(to, (__force void __user *) from, count); | 246 | return __copy_user(to, (__force void __user *) from, count); |
248 | } | 247 | } |
@@ -250,8 +249,7 @@ __copy_to_user (void __user *to, const void *from, unsigned long count) | |||
250 | static inline unsigned long | 249 | static inline unsigned long |
251 | __copy_from_user (void *to, const void __user *from, unsigned long count) | 250 | __copy_from_user (void *to, const void __user *from, unsigned long count) |
252 | { | 251 | { |
253 | if (!__builtin_constant_p(count)) | 252 | check_object_size(to, count, false); |
254 | check_object_size(to, count, false); | ||
255 | 253 | ||
256 | return __copy_user((__force void __user *) to, from, count); | 254 | return __copy_user((__force void __user *) to, from, count); |
257 | } | 255 | } |
@@ -265,27 +263,22 @@ __copy_from_user (void *to, const void __user *from, unsigned long count) | |||
265 | long __cu_len = (n); \ | 263 | long __cu_len = (n); \ |
266 | \ | 264 | \ |
267 | if (__access_ok(__cu_to, __cu_len, get_fs())) { \ | 265 | if (__access_ok(__cu_to, __cu_len, get_fs())) { \ |
268 | if (!__builtin_constant_p(n)) \ | 266 | check_object_size(__cu_from, __cu_len, true); \ |
269 | check_object_size(__cu_from, __cu_len, true); \ | ||
270 | __cu_len = __copy_user(__cu_to, (__force void __user *) __cu_from, __cu_len); \ | 267 | __cu_len = __copy_user(__cu_to, (__force void __user *) __cu_from, __cu_len); \ |
271 | } \ | 268 | } \ |
272 | __cu_len; \ | 269 | __cu_len; \ |
273 | }) | 270 | }) |
274 | 271 | ||
275 | #define copy_from_user(to, from, n) \ | 272 | static inline unsigned long |
276 | ({ \ | 273 | copy_from_user(void *to, const void __user *from, unsigned long n) |
277 | void *__cu_to = (to); \ | 274 | { |
278 | const void __user *__cu_from = (from); \ | 275 | check_object_size(to, n, false); |
279 | long __cu_len = (n); \ | 276 | if (likely(__access_ok(from, n, get_fs()))) |
280 | \ | 277 | n = __copy_user((__force void __user *) to, from, n); |
281 | __chk_user_ptr(__cu_from); \ | 278 | else |
282 | if (__access_ok(__cu_from, __cu_len, get_fs())) { \ | 279 | memset(to, 0, n); |
283 | if (!__builtin_constant_p(n)) \ | 280 | return n; |
284 | check_object_size(__cu_to, __cu_len, false); \ | 281 | } |
285 | __cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len); \ | ||
286 | } \ | ||
287 | __cu_len; \ | ||
288 | }) | ||
289 | 282 | ||
290 | #define __copy_in_user(to, from, size) __copy_user((to), (from), (size)) | 283 | #define __copy_in_user(to, from, size) __copy_user((to), (from), (size)) |
291 | 284 | ||
diff --git a/arch/m32r/include/asm/uaccess.h b/arch/m32r/include/asm/uaccess.h index cac7014daef3..6f8982157a75 100644 --- a/arch/m32r/include/asm/uaccess.h +++ b/arch/m32r/include/asm/uaccess.h | |||
@@ -219,7 +219,7 @@ extern int fixup_exception(struct pt_regs *regs); | |||
219 | #define __get_user_nocheck(x, ptr, size) \ | 219 | #define __get_user_nocheck(x, ptr, size) \ |
220 | ({ \ | 220 | ({ \ |
221 | long __gu_err = 0; \ | 221 | long __gu_err = 0; \ |
222 | unsigned long __gu_val; \ | 222 | unsigned long __gu_val = 0; \ |
223 | might_fault(); \ | 223 | might_fault(); \ |
224 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ | 224 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ |
225 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ | 225 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ |
diff --git a/arch/metag/include/asm/uaccess.h b/arch/metag/include/asm/uaccess.h index 8282cbce7e39..273e61225c27 100644 --- a/arch/metag/include/asm/uaccess.h +++ b/arch/metag/include/asm/uaccess.h | |||
@@ -204,8 +204,9 @@ extern unsigned long __must_check __copy_user_zeroing(void *to, | |||
204 | static inline unsigned long | 204 | static inline unsigned long |
205 | copy_from_user(void *to, const void __user *from, unsigned long n) | 205 | copy_from_user(void *to, const void __user *from, unsigned long n) |
206 | { | 206 | { |
207 | if (access_ok(VERIFY_READ, from, n)) | 207 | if (likely(access_ok(VERIFY_READ, from, n))) |
208 | return __copy_user_zeroing(to, from, n); | 208 | return __copy_user_zeroing(to, from, n); |
209 | memset(to, 0, n); | ||
209 | return n; | 210 | return n; |
210 | } | 211 | } |
211 | 212 | ||
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 331b0d35f89c..826676778094 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
@@ -227,7 +227,7 @@ extern long __user_bad(void); | |||
227 | 227 | ||
228 | #define __get_user(x, ptr) \ | 228 | #define __get_user(x, ptr) \ |
229 | ({ \ | 229 | ({ \ |
230 | unsigned long __gu_val; \ | 230 | unsigned long __gu_val = 0; \ |
231 | /*unsigned long __gu_ptr = (unsigned long)(ptr);*/ \ | 231 | /*unsigned long __gu_ptr = (unsigned long)(ptr);*/ \ |
232 | long __gu_err; \ | 232 | long __gu_err; \ |
233 | switch (sizeof(*(ptr))) { \ | 233 | switch (sizeof(*(ptr))) { \ |
@@ -373,10 +373,13 @@ extern long __user_bad(void); | |||
373 | static inline long copy_from_user(void *to, | 373 | static inline long copy_from_user(void *to, |
374 | const void __user *from, unsigned long n) | 374 | const void __user *from, unsigned long n) |
375 | { | 375 | { |
376 | unsigned long res = n; | ||
376 | might_fault(); | 377 | might_fault(); |
377 | if (access_ok(VERIFY_READ, from, n)) | 378 | if (likely(access_ok(VERIFY_READ, from, n))) |
378 | return __copy_from_user(to, from, n); | 379 | res = __copy_from_user(to, from, n); |
379 | return n; | 380 | if (unlikely(res)) |
381 | memset(to + (n - res), 0, res); | ||
382 | return res; | ||
380 | } | 383 | } |
381 | 384 | ||
382 | #define __copy_to_user(to, from, n) \ | 385 | #define __copy_to_user(to, from, n) \ |
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index 11b965f98d95..21a2aaba20d5 100644 --- a/arch/mips/include/asm/uaccess.h +++ b/arch/mips/include/asm/uaccess.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/thread_info.h> | 16 | #include <linux/thread_info.h> |
17 | #include <linux/string.h> | ||
17 | #include <asm/asm-eva.h> | 18 | #include <asm/asm-eva.h> |
18 | 19 | ||
19 | /* | 20 | /* |
@@ -1170,6 +1171,8 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n); | |||
1170 | __cu_len = __invoke_copy_from_user(__cu_to, \ | 1171 | __cu_len = __invoke_copy_from_user(__cu_to, \ |
1171 | __cu_from, \ | 1172 | __cu_from, \ |
1172 | __cu_len); \ | 1173 | __cu_len); \ |
1174 | } else { \ | ||
1175 | memset(__cu_to, 0, __cu_len); \ | ||
1173 | } \ | 1176 | } \ |
1174 | } \ | 1177 | } \ |
1175 | __cu_len; \ | 1178 | __cu_len; \ |
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index 20f7bf6de384..d012e877a95a 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h | |||
@@ -166,6 +166,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
166 | "2:\n" \ | 166 | "2:\n" \ |
167 | " .section .fixup,\"ax\"\n" \ | 167 | " .section .fixup,\"ax\"\n" \ |
168 | "3:\n\t" \ | 168 | "3:\n\t" \ |
169 | " mov 0,%1\n" \ | ||
169 | " mov %3,%0\n" \ | 170 | " mov %3,%0\n" \ |
170 | " jmp 2b\n" \ | 171 | " jmp 2b\n" \ |
171 | " .previous\n" \ | 172 | " .previous\n" \ |
diff --git a/arch/mn10300/lib/usercopy.c b/arch/mn10300/lib/usercopy.c index 7826e6c364e7..ce8899e5e171 100644 --- a/arch/mn10300/lib/usercopy.c +++ b/arch/mn10300/lib/usercopy.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * as published by the Free Software Foundation; either version | 9 | * as published by the Free Software Foundation; either version |
10 | * 2 of the Licence, or (at your option) any later version. | 10 | * 2 of the Licence, or (at your option) any later version. |
11 | */ | 11 | */ |
12 | #include <asm/uaccess.h> | 12 | #include <linux/uaccess.h> |
13 | 13 | ||
14 | unsigned long | 14 | unsigned long |
15 | __generic_copy_to_user(void *to, const void *from, unsigned long n) | 15 | __generic_copy_to_user(void *to, const void *from, unsigned long n) |
@@ -24,6 +24,8 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n) | |||
24 | { | 24 | { |
25 | if (access_ok(VERIFY_READ, from, n)) | 25 | if (access_ok(VERIFY_READ, from, n)) |
26 | __copy_user_zeroing(to, from, n); | 26 | __copy_user_zeroing(to, from, n); |
27 | else | ||
28 | memset(to, 0, n); | ||
27 | return n; | 29 | return n; |
28 | } | 30 | } |
29 | 31 | ||
diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h index caa51ff85a3c..0ab82324c817 100644 --- a/arch/nios2/include/asm/uaccess.h +++ b/arch/nios2/include/asm/uaccess.h | |||
@@ -102,9 +102,12 @@ extern long __copy_to_user(void __user *to, const void *from, unsigned long n); | |||
102 | static inline long copy_from_user(void *to, const void __user *from, | 102 | static inline long copy_from_user(void *to, const void __user *from, |
103 | unsigned long n) | 103 | unsigned long n) |
104 | { | 104 | { |
105 | if (!access_ok(VERIFY_READ, from, n)) | 105 | unsigned long res = n; |
106 | return n; | 106 | if (access_ok(VERIFY_READ, from, n)) |
107 | return __copy_from_user(to, from, n); | 107 | res = __copy_from_user(to, from, n); |
108 | if (unlikely(res)) | ||
109 | memset(to + (n - res), 0, res); | ||
110 | return res; | ||
108 | } | 111 | } |
109 | 112 | ||
110 | static inline long copy_to_user(void __user *to, const void *from, | 113 | static inline long copy_to_user(void __user *to, const void *from, |
@@ -139,7 +142,7 @@ extern long strnlen_user(const char __user *s, long n); | |||
139 | 142 | ||
140 | #define __get_user_unknown(val, size, ptr, err) do { \ | 143 | #define __get_user_unknown(val, size, ptr, err) do { \ |
141 | err = 0; \ | 144 | err = 0; \ |
142 | if (copy_from_user(&(val), ptr, size)) { \ | 145 | if (__copy_from_user(&(val), ptr, size)) { \ |
143 | err = -EFAULT; \ | 146 | err = -EFAULT; \ |
144 | } \ | 147 | } \ |
145 | } while (0) | 148 | } while (0) |
@@ -166,7 +169,7 @@ do { \ | |||
166 | ({ \ | 169 | ({ \ |
167 | long __gu_err = -EFAULT; \ | 170 | long __gu_err = -EFAULT; \ |
168 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ | 171 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ |
169 | unsigned long __gu_val; \ | 172 | unsigned long __gu_val = 0; \ |
170 | __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ | 173 | __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ |
171 | (x) = (__force __typeof__(x))__gu_val; \ | 174 | (x) = (__force __typeof__(x))__gu_val; \ |
172 | __gu_err; \ | 175 | __gu_err; \ |
diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h index a6bd07ca3d6c..5cc6b4f1b795 100644 --- a/arch/openrisc/include/asm/uaccess.h +++ b/arch/openrisc/include/asm/uaccess.h | |||
@@ -273,28 +273,20 @@ __copy_tofrom_user(void *to, const void *from, unsigned long size); | |||
273 | static inline unsigned long | 273 | static inline unsigned long |
274 | copy_from_user(void *to, const void *from, unsigned long n) | 274 | copy_from_user(void *to, const void *from, unsigned long n) |
275 | { | 275 | { |
276 | unsigned long over; | 276 | unsigned long res = n; |
277 | 277 | ||
278 | if (access_ok(VERIFY_READ, from, n)) | 278 | if (likely(access_ok(VERIFY_READ, from, n))) |
279 | return __copy_tofrom_user(to, from, n); | 279 | res = __copy_tofrom_user(to, from, n); |
280 | if ((unsigned long)from < TASK_SIZE) { | 280 | if (unlikely(res)) |
281 | over = (unsigned long)from + n - TASK_SIZE; | 281 | memset(to + (n - res), 0, res); |
282 | return __copy_tofrom_user(to, from, n - over) + over; | 282 | return res; |
283 | } | ||
284 | return n; | ||
285 | } | 283 | } |
286 | 284 | ||
287 | static inline unsigned long | 285 | static inline unsigned long |
288 | copy_to_user(void *to, const void *from, unsigned long n) | 286 | copy_to_user(void *to, const void *from, unsigned long n) |
289 | { | 287 | { |
290 | unsigned long over; | 288 | if (likely(access_ok(VERIFY_WRITE, to, n))) |
291 | 289 | n = __copy_tofrom_user(to, from, n); | |
292 | if (access_ok(VERIFY_WRITE, to, n)) | ||
293 | return __copy_tofrom_user(to, from, n); | ||
294 | if ((unsigned long)to < TASK_SIZE) { | ||
295 | over = (unsigned long)to + n - TASK_SIZE; | ||
296 | return __copy_tofrom_user(to, from, n - over) + over; | ||
297 | } | ||
298 | return n; | 290 | return n; |
299 | } | 291 | } |
300 | 292 | ||
@@ -303,13 +295,8 @@ extern unsigned long __clear_user(void *addr, unsigned long size); | |||
303 | static inline __must_check unsigned long | 295 | static inline __must_check unsigned long |
304 | clear_user(void *addr, unsigned long size) | 296 | clear_user(void *addr, unsigned long size) |
305 | { | 297 | { |
306 | 298 | if (likely(access_ok(VERIFY_WRITE, addr, size))) | |
307 | if (access_ok(VERIFY_WRITE, addr, size)) | 299 | size = __clear_user(addr, size); |
308 | return __clear_user(addr, size); | ||
309 | if ((unsigned long)addr < TASK_SIZE) { | ||
310 | unsigned long over = (unsigned long)addr + size - TASK_SIZE; | ||
311 | return __clear_user(addr, size - over) + over; | ||
312 | } | ||
313 | return size; | 300 | return size; |
314 | } | 301 | } |
315 | 302 | ||
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index e9150487e20d..482847865dac 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <asm-generic/uaccess-unaligned.h> | 10 | #include <asm-generic/uaccess-unaligned.h> |
11 | 11 | ||
12 | #include <linux/bug.h> | 12 | #include <linux/bug.h> |
13 | #include <linux/string.h> | ||
13 | 14 | ||
14 | #define VERIFY_READ 0 | 15 | #define VERIFY_READ 0 |
15 | #define VERIFY_WRITE 1 | 16 | #define VERIFY_WRITE 1 |
@@ -221,7 +222,7 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
221 | unsigned long n) | 222 | unsigned long n) |
222 | { | 223 | { |
223 | int sz = __compiletime_object_size(to); | 224 | int sz = __compiletime_object_size(to); |
224 | int ret = -EFAULT; | 225 | unsigned long ret = n; |
225 | 226 | ||
226 | if (likely(sz == -1 || sz >= n)) | 227 | if (likely(sz == -1 || sz >= n)) |
227 | ret = __copy_from_user(to, from, n); | 228 | ret = __copy_from_user(to, from, n); |
@@ -230,6 +231,8 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
230 | else | 231 | else |
231 | __bad_copy_user(); | 232 | __bad_copy_user(); |
232 | 233 | ||
234 | if (unlikely(ret)) | ||
235 | memset(to + (n - ret), 0, ret); | ||
233 | return ret; | 236 | return ret; |
234 | } | 237 | } |
235 | 238 | ||
diff --git a/arch/powerpc/include/asm/cpu_has_feature.h b/arch/powerpc/include/asm/cpu_has_feature.h index 2ef55f8968a2..b312b152461b 100644 --- a/arch/powerpc/include/asm/cpu_has_feature.h +++ b/arch/powerpc/include/asm/cpu_has_feature.h | |||
@@ -15,7 +15,7 @@ static inline bool early_cpu_has_feature(unsigned long feature) | |||
15 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS | 15 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS |
16 | #include <linux/jump_label.h> | 16 | #include <linux/jump_label.h> |
17 | 17 | ||
18 | #define NUM_CPU_FTR_KEYS 64 | 18 | #define NUM_CPU_FTR_KEYS BITS_PER_LONG |
19 | 19 | ||
20 | extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS]; | 20 | extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS]; |
21 | 21 | ||
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index c1dc6c14deb8..c266227fdd5b 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h | |||
@@ -308,40 +308,21 @@ extern unsigned long __copy_tofrom_user(void __user *to, | |||
308 | static inline unsigned long copy_from_user(void *to, | 308 | static inline unsigned long copy_from_user(void *to, |
309 | const void __user *from, unsigned long n) | 309 | const void __user *from, unsigned long n) |
310 | { | 310 | { |
311 | unsigned long over; | 311 | if (likely(access_ok(VERIFY_READ, from, n))) { |
312 | 312 | check_object_size(to, n, false); | |
313 | if (access_ok(VERIFY_READ, from, n)) { | ||
314 | if (!__builtin_constant_p(n)) | ||
315 | check_object_size(to, n, false); | ||
316 | return __copy_tofrom_user((__force void __user *)to, from, n); | 313 | return __copy_tofrom_user((__force void __user *)to, from, n); |
317 | } | 314 | } |
318 | if ((unsigned long)from < TASK_SIZE) { | 315 | memset(to, 0, n); |
319 | over = (unsigned long)from + n - TASK_SIZE; | ||
320 | if (!__builtin_constant_p(n - over)) | ||
321 | check_object_size(to, n - over, false); | ||
322 | return __copy_tofrom_user((__force void __user *)to, from, | ||
323 | n - over) + over; | ||
324 | } | ||
325 | return n; | 316 | return n; |
326 | } | 317 | } |
327 | 318 | ||
328 | static inline unsigned long copy_to_user(void __user *to, | 319 | static inline unsigned long copy_to_user(void __user *to, |
329 | const void *from, unsigned long n) | 320 | const void *from, unsigned long n) |
330 | { | 321 | { |
331 | unsigned long over; | ||
332 | |||
333 | if (access_ok(VERIFY_WRITE, to, n)) { | 322 | if (access_ok(VERIFY_WRITE, to, n)) { |
334 | if (!__builtin_constant_p(n)) | 323 | check_object_size(from, n, true); |
335 | check_object_size(from, n, true); | ||
336 | return __copy_tofrom_user(to, (__force void __user *)from, n); | 324 | return __copy_tofrom_user(to, (__force void __user *)from, n); |
337 | } | 325 | } |
338 | if ((unsigned long)to < TASK_SIZE) { | ||
339 | over = (unsigned long)to + n - TASK_SIZE; | ||
340 | if (!__builtin_constant_p(n)) | ||
341 | check_object_size(from, n - over, true); | ||
342 | return __copy_tofrom_user(to, (__force void __user *)from, | ||
343 | n - over) + over; | ||
344 | } | ||
345 | return n; | 326 | return n; |
346 | } | 327 | } |
347 | 328 | ||
@@ -383,8 +364,7 @@ static inline unsigned long __copy_from_user_inatomic(void *to, | |||
383 | return 0; | 364 | return 0; |
384 | } | 365 | } |
385 | 366 | ||
386 | if (!__builtin_constant_p(n)) | 367 | check_object_size(to, n, false); |
387 | check_object_size(to, n, false); | ||
388 | 368 | ||
389 | return __copy_tofrom_user((__force void __user *)to, from, n); | 369 | return __copy_tofrom_user((__force void __user *)to, from, n); |
390 | } | 370 | } |
@@ -412,8 +392,8 @@ static inline unsigned long __copy_to_user_inatomic(void __user *to, | |||
412 | if (ret == 0) | 392 | if (ret == 0) |
413 | return 0; | 393 | return 0; |
414 | } | 394 | } |
415 | if (!__builtin_constant_p(n)) | 395 | |
416 | check_object_size(from, n, true); | 396 | check_object_size(from, n, true); |
417 | 397 | ||
418 | return __copy_tofrom_user(to, (__force const void __user *)from, n); | 398 | return __copy_tofrom_user(to, (__force const void __user *)from, n); |
419 | } | 399 | } |
@@ -439,10 +419,6 @@ static inline unsigned long clear_user(void __user *addr, unsigned long size) | |||
439 | might_fault(); | 419 | might_fault(); |
440 | if (likely(access_ok(VERIFY_WRITE, addr, size))) | 420 | if (likely(access_ok(VERIFY_WRITE, addr, size))) |
441 | return __clear_user(addr, size); | 421 | return __clear_user(addr, size); |
442 | if ((unsigned long)addr < TASK_SIZE) { | ||
443 | unsigned long over = (unsigned long)addr + size - TASK_SIZE; | ||
444 | return __clear_user(addr, size - over) + over; | ||
445 | } | ||
446 | return size; | 422 | return size; |
447 | } | 423 | } |
448 | 424 | ||
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S index 2265c6398a17..bd739fed26e3 100644 --- a/arch/powerpc/kernel/idle_book3s.S +++ b/arch/powerpc/kernel/idle_book3s.S | |||
@@ -411,7 +411,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) | |||
411 | * | 411 | * |
412 | * r13 - PACA | 412 | * r13 - PACA |
413 | * cr3 - gt if waking up with partial/complete hypervisor state loss | 413 | * cr3 - gt if waking up with partial/complete hypervisor state loss |
414 | * cr4 - eq if waking up from complete hypervisor state loss. | 414 | * cr4 - gt or eq if waking up from complete hypervisor state loss. |
415 | */ | 415 | */ |
416 | _GLOBAL(pnv_wakeup_tb_loss) | 416 | _GLOBAL(pnv_wakeup_tb_loss) |
417 | ld r1,PACAR1(r13) | 417 | ld r1,PACAR1(r13) |
@@ -453,7 +453,7 @@ lwarx_loop2: | |||
453 | * At this stage | 453 | * At this stage |
454 | * cr2 - eq if first thread to wakeup in core | 454 | * cr2 - eq if first thread to wakeup in core |
455 | * cr3- gt if waking up with partial/complete hypervisor state loss | 455 | * cr3- gt if waking up with partial/complete hypervisor state loss |
456 | * cr4 - eq if waking up from complete hypervisor state loss. | 456 | * cr4 - gt or eq if waking up from complete hypervisor state loss. |
457 | */ | 457 | */ |
458 | 458 | ||
459 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT | 459 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT |
@@ -481,7 +481,7 @@ first_thread_in_subcore: | |||
481 | * If waking up from sleep, subcore state is not lost. Hence | 481 | * If waking up from sleep, subcore state is not lost. Hence |
482 | * skip subcore state restore | 482 | * skip subcore state restore |
483 | */ | 483 | */ |
484 | bne cr4,subcore_state_restored | 484 | blt cr4,subcore_state_restored |
485 | 485 | ||
486 | /* Restore per-subcore state */ | 486 | /* Restore per-subcore state */ |
487 | ld r4,_SDR1(r1) | 487 | ld r4,_SDR1(r1) |
@@ -526,7 +526,7 @@ timebase_resync: | |||
526 | * If waking up from sleep, per core state is not lost, skip to | 526 | * If waking up from sleep, per core state is not lost, skip to |
527 | * clear_lock. | 527 | * clear_lock. |
528 | */ | 528 | */ |
529 | bne cr4,clear_lock | 529 | blt cr4,clear_lock |
530 | 530 | ||
531 | /* | 531 | /* |
532 | * First thread in the core to wake up and its waking up with | 532 | * First thread in the core to wake up and its waking up with |
@@ -557,7 +557,7 @@ common_exit: | |||
557 | * If waking up from sleep, hypervisor state is not lost. Hence | 557 | * If waking up from sleep, hypervisor state is not lost. Hence |
558 | * skip hypervisor state restore. | 558 | * skip hypervisor state restore. |
559 | */ | 559 | */ |
560 | bne cr4,hypervisor_state_restored | 560 | blt cr4,hypervisor_state_restored |
561 | 561 | ||
562 | /* Waking up from winkle */ | 562 | /* Waking up from winkle */ |
563 | 563 | ||
diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S index 0a57fe6d49cc..aa8214f30c92 100644 --- a/arch/powerpc/lib/checksum_32.S +++ b/arch/powerpc/lib/checksum_32.S | |||
@@ -127,18 +127,19 @@ _GLOBAL(csum_partial_copy_generic) | |||
127 | stw r7,12(r1) | 127 | stw r7,12(r1) |
128 | stw r8,8(r1) | 128 | stw r8,8(r1) |
129 | 129 | ||
130 | rlwinm r0,r4,3,0x8 | ||
131 | rlwnm r6,r6,r0,0,31 /* odd destination address: rotate one byte */ | ||
132 | cmplwi cr7,r0,0 /* is destination address even ? */ | ||
133 | addic r12,r6,0 | 130 | addic r12,r6,0 |
134 | addi r6,r4,-4 | 131 | addi r6,r4,-4 |
135 | neg r0,r4 | 132 | neg r0,r4 |
136 | addi r4,r3,-4 | 133 | addi r4,r3,-4 |
137 | andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */ | 134 | andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */ |
135 | crset 4*cr7+eq | ||
138 | beq 58f | 136 | beq 58f |
139 | 137 | ||
140 | cmplw 0,r5,r0 /* is this more than total to do? */ | 138 | cmplw 0,r5,r0 /* is this more than total to do? */ |
141 | blt 63f /* if not much to do */ | 139 | blt 63f /* if not much to do */ |
140 | rlwinm r7,r6,3,0x8 | ||
141 | rlwnm r12,r12,r7,0,31 /* odd destination address: rotate one byte */ | ||
142 | cmplwi cr7,r7,0 /* is destination address even ? */ | ||
142 | andi. r8,r0,3 /* get it word-aligned first */ | 143 | andi. r8,r0,3 /* get it word-aligned first */ |
143 | mtctr r8 | 144 | mtctr r8 |
144 | beq+ 61f | 145 | beq+ 61f |
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S index dfdb90cb4403..9f1983404e1a 100644 --- a/arch/powerpc/mm/slb_low.S +++ b/arch/powerpc/mm/slb_low.S | |||
@@ -113,7 +113,12 @@ BEGIN_FTR_SECTION | |||
113 | END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) | 113 | END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) |
114 | b slb_finish_load_1T | 114 | b slb_finish_load_1T |
115 | 115 | ||
116 | 0: | 116 | 0: /* |
117 | * For userspace addresses, make sure this is region 0. | ||
118 | */ | ||
119 | cmpdi r9, 0 | ||
120 | bne 8f | ||
121 | |||
117 | /* when using slices, we extract the psize off the slice bitmaps | 122 | /* when using slices, we extract the psize off the slice bitmaps |
118 | * and then we need to get the sllp encoding off the mmu_psize_defs | 123 | * and then we need to get the sllp encoding off the mmu_psize_defs |
119 | * array. | 124 | * array. |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 13218263e66e..bc0c91e84ca0 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -162,11 +162,12 @@ static struct pnv_ioda_pe *pnv_ioda_alloc_pe(struct pnv_phb *phb) | |||
162 | static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe) | 162 | static void pnv_ioda_free_pe(struct pnv_ioda_pe *pe) |
163 | { | 163 | { |
164 | struct pnv_phb *phb = pe->phb; | 164 | struct pnv_phb *phb = pe->phb; |
165 | unsigned int pe_num = pe->pe_number; | ||
165 | 166 | ||
166 | WARN_ON(pe->pdev); | 167 | WARN_ON(pe->pdev); |
167 | 168 | ||
168 | memset(pe, 0, sizeof(struct pnv_ioda_pe)); | 169 | memset(pe, 0, sizeof(struct pnv_ioda_pe)); |
169 | clear_bit(pe->pe_number, phb->ioda.pe_alloc); | 170 | clear_bit(pe_num, phb->ioda.pe_alloc); |
170 | } | 171 | } |
171 | 172 | ||
172 | /* The default M64 BAR is shared by all PEs */ | 173 | /* The default M64 BAR is shared by all PEs */ |
@@ -2216,7 +2217,7 @@ static long pnv_pci_ioda2_set_window(struct iommu_table_group *table_group, | |||
2216 | 2217 | ||
2217 | pnv_pci_link_table_and_group(phb->hose->node, num, | 2218 | pnv_pci_link_table_and_group(phb->hose->node, num, |
2218 | tbl, &pe->table_group); | 2219 | tbl, &pe->table_group); |
2219 | pnv_pci_phb3_tce_invalidate_pe(pe); | 2220 | pnv_pci_ioda2_tce_invalidate_pe(pe); |
2220 | 2221 | ||
2221 | return 0; | 2222 | return 0; |
2222 | } | 2223 | } |
@@ -2354,7 +2355,7 @@ static long pnv_pci_ioda2_unset_window(struct iommu_table_group *table_group, | |||
2354 | if (ret) | 2355 | if (ret) |
2355 | pe_warn(pe, "Unmapping failed, ret = %ld\n", ret); | 2356 | pe_warn(pe, "Unmapping failed, ret = %ld\n", ret); |
2356 | else | 2357 | else |
2357 | pnv_pci_phb3_tce_invalidate_pe(pe); | 2358 | pnv_pci_ioda2_tce_invalidate_pe(pe); |
2358 | 2359 | ||
2359 | pnv_pci_unlink_table_and_group(table_group->tables[num], table_group); | 2360 | pnv_pci_unlink_table_and_group(table_group->tables[num], table_group); |
2360 | 2361 | ||
@@ -3402,12 +3403,6 @@ static void pnv_ioda_release_pe(struct pnv_ioda_pe *pe) | |||
3402 | struct pnv_phb *phb = pe->phb; | 3403 | struct pnv_phb *phb = pe->phb; |
3403 | struct pnv_ioda_pe *slave, *tmp; | 3404 | struct pnv_ioda_pe *slave, *tmp; |
3404 | 3405 | ||
3405 | /* Release slave PEs in compound PE */ | ||
3406 | if (pe->flags & PNV_IODA_PE_MASTER) { | ||
3407 | list_for_each_entry_safe(slave, tmp, &pe->slaves, list) | ||
3408 | pnv_ioda_release_pe(slave); | ||
3409 | } | ||
3410 | |||
3411 | list_del(&pe->list); | 3406 | list_del(&pe->list); |
3412 | switch (phb->type) { | 3407 | switch (phb->type) { |
3413 | case PNV_PHB_IODA1: | 3408 | case PNV_PHB_IODA1: |
@@ -3422,7 +3417,26 @@ static void pnv_ioda_release_pe(struct pnv_ioda_pe *pe) | |||
3422 | 3417 | ||
3423 | pnv_ioda_release_pe_seg(pe); | 3418 | pnv_ioda_release_pe_seg(pe); |
3424 | pnv_ioda_deconfigure_pe(pe->phb, pe); | 3419 | pnv_ioda_deconfigure_pe(pe->phb, pe); |
3425 | pnv_ioda_free_pe(pe); | 3420 | |
3421 | /* Release slave PEs in the compound PE */ | ||
3422 | if (pe->flags & PNV_IODA_PE_MASTER) { | ||
3423 | list_for_each_entry_safe(slave, tmp, &pe->slaves, list) { | ||
3424 | list_del(&slave->list); | ||
3425 | pnv_ioda_free_pe(slave); | ||
3426 | } | ||
3427 | } | ||
3428 | |||
3429 | /* | ||
3430 | * The PE for root bus can be removed because of hotplug in EEH | ||
3431 | * recovery for fenced PHB error. We need to mark the PE dead so | ||
3432 | * that it can be populated again in PCI hot add path. The PE | ||
3433 | * shouldn't be destroyed as it's the global reserved resource. | ||
3434 | */ | ||
3435 | if (phb->ioda.root_pe_populated && | ||
3436 | phb->ioda.root_pe_idx == pe->pe_number) | ||
3437 | phb->ioda.root_pe_populated = false; | ||
3438 | else | ||
3439 | pnv_ioda_free_pe(pe); | ||
3426 | } | 3440 | } |
3427 | 3441 | ||
3428 | static void pnv_pci_release_device(struct pci_dev *pdev) | 3442 | static void pnv_pci_release_device(struct pci_dev *pdev) |
@@ -3438,7 +3452,17 @@ static void pnv_pci_release_device(struct pci_dev *pdev) | |||
3438 | if (!pdn || pdn->pe_number == IODA_INVALID_PE) | 3452 | if (!pdn || pdn->pe_number == IODA_INVALID_PE) |
3439 | return; | 3453 | return; |
3440 | 3454 | ||
3455 | /* | ||
3456 | * PCI hotplug can happen as part of EEH error recovery. The @pdn | ||
3457 | * isn't removed and added afterwards in this scenario. We should | ||
3458 | * set the PE number in @pdn to an invalid one. Otherwise, the PE's | ||
3459 | * device count is decreased on removing devices while failing to | ||
3460 | * be increased on adding devices. It leads to unbalanced PE's device | ||
3461 | * count and eventually make normal PCI hotplug path broken. | ||
3462 | */ | ||
3441 | pe = &phb->ioda.pe_array[pdn->pe_number]; | 3463 | pe = &phb->ioda.pe_array[pdn->pe_number]; |
3464 | pdn->pe_number = IODA_INVALID_PE; | ||
3465 | |||
3442 | WARN_ON(--pe->device_count < 0); | 3466 | WARN_ON(--pe->device_count < 0); |
3443 | if (pe->device_count == 0) | 3467 | if (pe->device_count == 0) |
3444 | pnv_ioda_release_pe(pe); | 3468 | pnv_ioda_release_pe(pe); |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 4ffcaa6f8670..a39d20e8623d 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <linux/root_dev.h> | 41 | #include <linux/root_dev.h> |
42 | #include <linux/of.h> | 42 | #include <linux/of.h> |
43 | #include <linux/of_pci.h> | 43 | #include <linux/of_pci.h> |
44 | #include <linux/kexec.h> | ||
45 | 44 | ||
46 | #include <asm/mmu.h> | 45 | #include <asm/mmu.h> |
47 | #include <asm/processor.h> | 46 | #include <asm/processor.h> |
@@ -66,6 +65,7 @@ | |||
66 | #include <asm/eeh.h> | 65 | #include <asm/eeh.h> |
67 | #include <asm/reg.h> | 66 | #include <asm/reg.h> |
68 | #include <asm/plpar_wrappers.h> | 67 | #include <asm/plpar_wrappers.h> |
68 | #include <asm/kexec.h> | ||
69 | 69 | ||
70 | #include "pseries.h" | 70 | #include "pseries.h" |
71 | 71 | ||
diff --git a/arch/powerpc/sysdev/xics/icp-opal.c b/arch/powerpc/sysdev/xics/icp-opal.c index 57d72f10a97f..9114243fa1b5 100644 --- a/arch/powerpc/sysdev/xics/icp-opal.c +++ b/arch/powerpc/sysdev/xics/icp-opal.c | |||
@@ -23,10 +23,10 @@ | |||
23 | 23 | ||
24 | static void icp_opal_teardown_cpu(void) | 24 | static void icp_opal_teardown_cpu(void) |
25 | { | 25 | { |
26 | int cpu = smp_processor_id(); | 26 | int hw_cpu = hard_smp_processor_id(); |
27 | 27 | ||
28 | /* Clear any pending IPI */ | 28 | /* Clear any pending IPI */ |
29 | opal_int_set_mfrr(cpu, 0xff); | 29 | opal_int_set_mfrr(hw_cpu, 0xff); |
30 | } | 30 | } |
31 | 31 | ||
32 | static void icp_opal_flush_ipi(void) | 32 | static void icp_opal_flush_ipi(void) |
@@ -101,14 +101,16 @@ static void icp_opal_eoi(struct irq_data *d) | |||
101 | 101 | ||
102 | static void icp_opal_cause_ipi(int cpu, unsigned long data) | 102 | static void icp_opal_cause_ipi(int cpu, unsigned long data) |
103 | { | 103 | { |
104 | opal_int_set_mfrr(cpu, IPI_PRIORITY); | 104 | int hw_cpu = get_hard_smp_processor_id(cpu); |
105 | |||
106 | opal_int_set_mfrr(hw_cpu, IPI_PRIORITY); | ||
105 | } | 107 | } |
106 | 108 | ||
107 | static irqreturn_t icp_opal_ipi_action(int irq, void *dev_id) | 109 | static irqreturn_t icp_opal_ipi_action(int irq, void *dev_id) |
108 | { | 110 | { |
109 | int cpu = smp_processor_id(); | 111 | int hw_cpu = hard_smp_processor_id(); |
110 | 112 | ||
111 | opal_int_set_mfrr(cpu, 0xff); | 113 | opal_int_set_mfrr(hw_cpu, 0xff); |
112 | 114 | ||
113 | return smp_ipi_demux(); | 115 | return smp_ipi_demux(); |
114 | } | 116 | } |
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h index 95aefdba4be2..52d7c8709279 100644 --- a/arch/s390/include/asm/uaccess.h +++ b/arch/s390/include/asm/uaccess.h | |||
@@ -266,28 +266,28 @@ int __put_user_bad(void) __attribute__((noreturn)); | |||
266 | __chk_user_ptr(ptr); \ | 266 | __chk_user_ptr(ptr); \ |
267 | switch (sizeof(*(ptr))) { \ | 267 | switch (sizeof(*(ptr))) { \ |
268 | case 1: { \ | 268 | case 1: { \ |
269 | unsigned char __x; \ | 269 | unsigned char __x = 0; \ |
270 | __gu_err = __get_user_fn(&__x, ptr, \ | 270 | __gu_err = __get_user_fn(&__x, ptr, \ |
271 | sizeof(*(ptr))); \ | 271 | sizeof(*(ptr))); \ |
272 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 272 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
273 | break; \ | 273 | break; \ |
274 | }; \ | 274 | }; \ |
275 | case 2: { \ | 275 | case 2: { \ |
276 | unsigned short __x; \ | 276 | unsigned short __x = 0; \ |
277 | __gu_err = __get_user_fn(&__x, ptr, \ | 277 | __gu_err = __get_user_fn(&__x, ptr, \ |
278 | sizeof(*(ptr))); \ | 278 | sizeof(*(ptr))); \ |
279 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 279 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
280 | break; \ | 280 | break; \ |
281 | }; \ | 281 | }; \ |
282 | case 4: { \ | 282 | case 4: { \ |
283 | unsigned int __x; \ | 283 | unsigned int __x = 0; \ |
284 | __gu_err = __get_user_fn(&__x, ptr, \ | 284 | __gu_err = __get_user_fn(&__x, ptr, \ |
285 | sizeof(*(ptr))); \ | 285 | sizeof(*(ptr))); \ |
286 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 286 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
287 | break; \ | 287 | break; \ |
288 | }; \ | 288 | }; \ |
289 | case 8: { \ | 289 | case 8: { \ |
290 | unsigned long long __x; \ | 290 | unsigned long long __x = 0; \ |
291 | __gu_err = __get_user_fn(&__x, ptr, \ | 291 | __gu_err = __get_user_fn(&__x, ptr, \ |
292 | sizeof(*(ptr))); \ | 292 | sizeof(*(ptr))); \ |
293 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 293 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index f142215ed30d..607ec91966c7 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -2231,9 +2231,10 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) | |||
2231 | return -EINVAL; | 2231 | return -EINVAL; |
2232 | current->thread.fpu.fpc = fpu->fpc; | 2232 | current->thread.fpu.fpc = fpu->fpc; |
2233 | if (MACHINE_HAS_VX) | 2233 | if (MACHINE_HAS_VX) |
2234 | convert_fp_to_vx(current->thread.fpu.vxrs, (freg_t *)fpu->fprs); | 2234 | convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs, |
2235 | (freg_t *) fpu->fprs); | ||
2235 | else | 2236 | else |
2236 | memcpy(current->thread.fpu.fprs, &fpu->fprs, sizeof(fpu->fprs)); | 2237 | memcpy(vcpu->run->s.regs.fprs, &fpu->fprs, sizeof(fpu->fprs)); |
2237 | return 0; | 2238 | return 0; |
2238 | } | 2239 | } |
2239 | 2240 | ||
@@ -2242,9 +2243,10 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) | |||
2242 | /* make sure we have the latest values */ | 2243 | /* make sure we have the latest values */ |
2243 | save_fpu_regs(); | 2244 | save_fpu_regs(); |
2244 | if (MACHINE_HAS_VX) | 2245 | if (MACHINE_HAS_VX) |
2245 | convert_vx_to_fp((freg_t *)fpu->fprs, current->thread.fpu.vxrs); | 2246 | convert_vx_to_fp((freg_t *) fpu->fprs, |
2247 | (__vector128 *) vcpu->run->s.regs.vrs); | ||
2246 | else | 2248 | else |
2247 | memcpy(fpu->fprs, current->thread.fpu.fprs, sizeof(fpu->fprs)); | 2249 | memcpy(fpu->fprs, vcpu->run->s.regs.fprs, sizeof(fpu->fprs)); |
2248 | fpu->fpc = current->thread.fpu.fpc; | 2250 | fpu->fpc = current->thread.fpu.fpc; |
2249 | return 0; | 2251 | return 0; |
2250 | } | 2252 | } |
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c index c106488b4137..d8673e243f13 100644 --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c | |||
@@ -584,7 +584,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) | |||
584 | /* Validity 0x0044 will be checked by SIE */ | 584 | /* Validity 0x0044 will be checked by SIE */ |
585 | if (rc) | 585 | if (rc) |
586 | goto unpin; | 586 | goto unpin; |
587 | scb_s->gvrd = hpa; | 587 | scb_s->riccbd = hpa; |
588 | } | 588 | } |
589 | return 0; | 589 | return 0; |
590 | unpin: | 590 | unpin: |
diff --git a/arch/score/include/asm/uaccess.h b/arch/score/include/asm/uaccess.h index 20a3591225cc..01aec8ccde83 100644 --- a/arch/score/include/asm/uaccess.h +++ b/arch/score/include/asm/uaccess.h | |||
@@ -163,7 +163,7 @@ do { \ | |||
163 | __get_user_asm(val, "lw", ptr); \ | 163 | __get_user_asm(val, "lw", ptr); \ |
164 | break; \ | 164 | break; \ |
165 | case 8: \ | 165 | case 8: \ |
166 | if ((copy_from_user((void *)&val, ptr, 8)) == 0) \ | 166 | if (__copy_from_user((void *)&val, ptr, 8) == 0) \ |
167 | __gu_err = 0; \ | 167 | __gu_err = 0; \ |
168 | else \ | 168 | else \ |
169 | __gu_err = -EFAULT; \ | 169 | __gu_err = -EFAULT; \ |
@@ -188,6 +188,8 @@ do { \ | |||
188 | \ | 188 | \ |
189 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ | 189 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ |
190 | __get_user_common((x), size, __gu_ptr); \ | 190 | __get_user_common((x), size, __gu_ptr); \ |
191 | else \ | ||
192 | (x) = 0; \ | ||
191 | \ | 193 | \ |
192 | __gu_err; \ | 194 | __gu_err; \ |
193 | }) | 195 | }) |
@@ -201,6 +203,7 @@ do { \ | |||
201 | "2:\n" \ | 203 | "2:\n" \ |
202 | ".section .fixup,\"ax\"\n" \ | 204 | ".section .fixup,\"ax\"\n" \ |
203 | "3:li %0, %4\n" \ | 205 | "3:li %0, %4\n" \ |
206 | "li %1, 0\n" \ | ||
204 | "j 2b\n" \ | 207 | "j 2b\n" \ |
205 | ".previous\n" \ | 208 | ".previous\n" \ |
206 | ".section __ex_table,\"a\"\n" \ | 209 | ".section __ex_table,\"a\"\n" \ |
@@ -298,35 +301,34 @@ extern int __copy_tofrom_user(void *to, const void *from, unsigned long len); | |||
298 | static inline unsigned long | 301 | static inline unsigned long |
299 | copy_from_user(void *to, const void *from, unsigned long len) | 302 | copy_from_user(void *to, const void *from, unsigned long len) |
300 | { | 303 | { |
301 | unsigned long over; | 304 | unsigned long res = len; |
302 | 305 | ||
303 | if (access_ok(VERIFY_READ, from, len)) | 306 | if (likely(access_ok(VERIFY_READ, from, len))) |
304 | return __copy_tofrom_user(to, from, len); | 307 | res = __copy_tofrom_user(to, from, len); |
305 | 308 | ||
306 | if ((unsigned long)from < TASK_SIZE) { | 309 | if (unlikely(res)) |
307 | over = (unsigned long)from + len - TASK_SIZE; | 310 | memset(to + (len - res), 0, res); |
308 | return __copy_tofrom_user(to, from, len - over) + over; | 311 | |
309 | } | 312 | return res; |
310 | return len; | ||
311 | } | 313 | } |
312 | 314 | ||
313 | static inline unsigned long | 315 | static inline unsigned long |
314 | copy_to_user(void *to, const void *from, unsigned long len) | 316 | copy_to_user(void *to, const void *from, unsigned long len) |
315 | { | 317 | { |
316 | unsigned long over; | 318 | if (likely(access_ok(VERIFY_WRITE, to, len))) |
317 | 319 | len = __copy_tofrom_user(to, from, len); | |
318 | if (access_ok(VERIFY_WRITE, to, len)) | ||
319 | return __copy_tofrom_user(to, from, len); | ||
320 | 320 | ||
321 | if ((unsigned long)to < TASK_SIZE) { | ||
322 | over = (unsigned long)to + len - TASK_SIZE; | ||
323 | return __copy_tofrom_user(to, from, len - over) + over; | ||
324 | } | ||
325 | return len; | 321 | return len; |
326 | } | 322 | } |
327 | 323 | ||
328 | #define __copy_from_user(to, from, len) \ | 324 | static inline unsigned long |
329 | __copy_tofrom_user((to), (from), (len)) | 325 | __copy_from_user(void *to, const void *from, unsigned long len) |
326 | { | ||
327 | unsigned long left = __copy_tofrom_user(to, from, len); | ||
328 | if (unlikely(left)) | ||
329 | memset(to + (len - left), 0, left); | ||
330 | return left; | ||
331 | } | ||
330 | 332 | ||
331 | #define __copy_to_user(to, from, len) \ | 333 | #define __copy_to_user(to, from, len) \ |
332 | __copy_tofrom_user((to), (from), (len)) | 334 | __copy_tofrom_user((to), (from), (len)) |
@@ -340,17 +342,17 @@ __copy_to_user_inatomic(void *to, const void *from, unsigned long len) | |||
340 | static inline unsigned long | 342 | static inline unsigned long |
341 | __copy_from_user_inatomic(void *to, const void *from, unsigned long len) | 343 | __copy_from_user_inatomic(void *to, const void *from, unsigned long len) |
342 | { | 344 | { |
343 | return __copy_from_user(to, from, len); | 345 | return __copy_tofrom_user(to, from, len); |
344 | } | 346 | } |
345 | 347 | ||
346 | #define __copy_in_user(to, from, len) __copy_from_user(to, from, len) | 348 | #define __copy_in_user(to, from, len) __copy_tofrom_user(to, from, len) |
347 | 349 | ||
348 | static inline unsigned long | 350 | static inline unsigned long |
349 | copy_in_user(void *to, const void *from, unsigned long len) | 351 | copy_in_user(void *to, const void *from, unsigned long len) |
350 | { | 352 | { |
351 | if (access_ok(VERIFY_READ, from, len) && | 353 | if (access_ok(VERIFY_READ, from, len) && |
352 | access_ok(VERFITY_WRITE, to, len)) | 354 | access_ok(VERFITY_WRITE, to, len)) |
353 | return copy_from_user(to, from, len); | 355 | return __copy_tofrom_user(to, from, len); |
354 | } | 356 | } |
355 | 357 | ||
356 | /* | 358 | /* |
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index a49635c51266..92ade79ac427 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h | |||
@@ -151,7 +151,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n) | |||
151 | __kernel_size_t __copy_size = (__kernel_size_t) n; | 151 | __kernel_size_t __copy_size = (__kernel_size_t) n; |
152 | 152 | ||
153 | if (__copy_size && __access_ok(__copy_from, __copy_size)) | 153 | if (__copy_size && __access_ok(__copy_from, __copy_size)) |
154 | return __copy_user(to, from, __copy_size); | 154 | __copy_size = __copy_user(to, from, __copy_size); |
155 | |||
156 | if (unlikely(__copy_size)) | ||
157 | memset(to + (n - __copy_size), 0, __copy_size); | ||
155 | 158 | ||
156 | return __copy_size; | 159 | return __copy_size; |
157 | } | 160 | } |
diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h index c01376c76b86..ca5073dd4596 100644 --- a/arch/sh/include/asm/uaccess_64.h +++ b/arch/sh/include/asm/uaccess_64.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #define __get_user_size(x,ptr,size,retval) \ | 24 | #define __get_user_size(x,ptr,size,retval) \ |
25 | do { \ | 25 | do { \ |
26 | retval = 0; \ | 26 | retval = 0; \ |
27 | x = 0; \ | ||
27 | switch (size) { \ | 28 | switch (size) { \ |
28 | case 1: \ | 29 | case 1: \ |
29 | retval = __get_user_asm_b((void *)&x, \ | 30 | retval = __get_user_asm_b((void *)&x, \ |
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h index 341a5a133f48..ea55f86d7ccd 100644 --- a/arch/sparc/include/asm/uaccess_32.h +++ b/arch/sparc/include/asm/uaccess_32.h | |||
@@ -249,8 +249,7 @@ unsigned long __copy_user(void __user *to, const void __user *from, unsigned lon | |||
249 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) | 249 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) |
250 | { | 250 | { |
251 | if (n && __access_ok((unsigned long) to, n)) { | 251 | if (n && __access_ok((unsigned long) to, n)) { |
252 | if (!__builtin_constant_p(n)) | 252 | check_object_size(from, n, true); |
253 | check_object_size(from, n, true); | ||
254 | return __copy_user(to, (__force void __user *) from, n); | 253 | return __copy_user(to, (__force void __user *) from, n); |
255 | } else | 254 | } else |
256 | return n; | 255 | return n; |
@@ -258,19 +257,19 @@ static inline unsigned long copy_to_user(void __user *to, const void *from, unsi | |||
258 | 257 | ||
259 | static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) | 258 | static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) |
260 | { | 259 | { |
261 | if (!__builtin_constant_p(n)) | 260 | check_object_size(from, n, true); |
262 | check_object_size(from, n, true); | ||
263 | return __copy_user(to, (__force void __user *) from, n); | 261 | return __copy_user(to, (__force void __user *) from, n); |
264 | } | 262 | } |
265 | 263 | ||
266 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) | 264 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) |
267 | { | 265 | { |
268 | if (n && __access_ok((unsigned long) from, n)) { | 266 | if (n && __access_ok((unsigned long) from, n)) { |
269 | if (!__builtin_constant_p(n)) | 267 | check_object_size(to, n, false); |
270 | check_object_size(to, n, false); | ||
271 | return __copy_user((__force void __user *) to, from, n); | 268 | return __copy_user((__force void __user *) to, from, n); |
272 | } else | 269 | } else { |
270 | memset(to, 0, n); | ||
273 | return n; | 271 | return n; |
272 | } | ||
274 | } | 273 | } |
275 | 274 | ||
276 | static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) | 275 | static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) |
diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index 8bda94fab8e8..37a315d0ddd4 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h | |||
@@ -212,8 +212,7 @@ copy_from_user(void *to, const void __user *from, unsigned long size) | |||
212 | { | 212 | { |
213 | unsigned long ret; | 213 | unsigned long ret; |
214 | 214 | ||
215 | if (!__builtin_constant_p(size)) | 215 | check_object_size(to, size, false); |
216 | check_object_size(to, size, false); | ||
217 | 216 | ||
218 | ret = ___copy_from_user(to, from, size); | 217 | ret = ___copy_from_user(to, from, size); |
219 | if (unlikely(ret)) | 218 | if (unlikely(ret)) |
@@ -233,8 +232,8 @@ copy_to_user(void __user *to, const void *from, unsigned long size) | |||
233 | { | 232 | { |
234 | unsigned long ret; | 233 | unsigned long ret; |
235 | 234 | ||
236 | if (!__builtin_constant_p(size)) | 235 | check_object_size(from, size, true); |
237 | check_object_size(from, size, true); | 236 | |
238 | ret = ___copy_to_user(to, from, size); | 237 | ret = ___copy_to_user(to, from, size); |
239 | if (unlikely(ret)) | 238 | if (unlikely(ret)) |
240 | ret = copy_to_user_fixup(to, from, size); | 239 | ret = copy_to_user_fixup(to, from, size); |
diff --git a/arch/um/kernel/skas/syscall.c b/arch/um/kernel/skas/syscall.c index ef4b8f949b51..b783ac87d98a 100644 --- a/arch/um/kernel/skas/syscall.c +++ b/arch/um/kernel/skas/syscall.c | |||
@@ -21,21 +21,17 @@ void handle_syscall(struct uml_pt_regs *r) | |||
21 | PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS); | 21 | PT_REGS_SET_SYSCALL_RETURN(regs, -ENOSYS); |
22 | 22 | ||
23 | if (syscall_trace_enter(regs)) | 23 | if (syscall_trace_enter(regs)) |
24 | return; | 24 | goto out; |
25 | 25 | ||
26 | /* Do the seccomp check after ptrace; failures should be fast. */ | 26 | /* Do the seccomp check after ptrace; failures should be fast. */ |
27 | if (secure_computing(NULL) == -1) | 27 | if (secure_computing(NULL) == -1) |
28 | return; | 28 | goto out; |
29 | 29 | ||
30 | /* Update the syscall number after orig_ax has potentially been updated | ||
31 | * with ptrace. | ||
32 | */ | ||
33 | UPT_SYSCALL_NR(r) = PT_SYSCALL_NR(r->gp); | ||
34 | syscall = UPT_SYSCALL_NR(r); | 30 | syscall = UPT_SYSCALL_NR(r); |
35 | |||
36 | if (syscall >= 0 && syscall <= __NR_syscall_max) | 31 | if (syscall >= 0 && syscall <= __NR_syscall_max) |
37 | PT_REGS_SET_SYSCALL_RETURN(regs, | 32 | PT_REGS_SET_SYSCALL_RETURN(regs, |
38 | EXECUTE_SYSCALL(syscall, regs)); | 33 | EXECUTE_SYSCALL(syscall, regs)); |
39 | 34 | ||
35 | out: | ||
40 | syscall_trace_leave(regs); | 36 | syscall_trace_leave(regs); |
41 | } | 37 | } |
diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index e07a22bb9308..f5f4b3fbbbc2 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c | |||
@@ -119,8 +119,8 @@ static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = | |||
119 | { | 119 | { |
120 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | 120 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
121 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 121 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
122 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080, | 122 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, |
123 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0081, | 123 | [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, |
124 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, | 124 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
125 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, | 125 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
126 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ | 126 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ |
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index e6131d4454e6..65577f081d07 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c | |||
@@ -29,6 +29,8 @@ | |||
29 | 29 | ||
30 | #define COUNTER_SHIFT 16 | 30 | #define COUNTER_SHIFT 16 |
31 | 31 | ||
32 | static HLIST_HEAD(uncore_unused_list); | ||
33 | |||
32 | struct amd_uncore { | 34 | struct amd_uncore { |
33 | int id; | 35 | int id; |
34 | int refcnt; | 36 | int refcnt; |
@@ -39,7 +41,7 @@ struct amd_uncore { | |||
39 | cpumask_t *active_mask; | 41 | cpumask_t *active_mask; |
40 | struct pmu *pmu; | 42 | struct pmu *pmu; |
41 | struct perf_event *events[MAX_COUNTERS]; | 43 | struct perf_event *events[MAX_COUNTERS]; |
42 | struct amd_uncore *free_when_cpu_online; | 44 | struct hlist_node node; |
43 | }; | 45 | }; |
44 | 46 | ||
45 | static struct amd_uncore * __percpu *amd_uncore_nb; | 47 | static struct amd_uncore * __percpu *amd_uncore_nb; |
@@ -306,6 +308,7 @@ static int amd_uncore_cpu_up_prepare(unsigned int cpu) | |||
306 | uncore_nb->msr_base = MSR_F15H_NB_PERF_CTL; | 308 | uncore_nb->msr_base = MSR_F15H_NB_PERF_CTL; |
307 | uncore_nb->active_mask = &amd_nb_active_mask; | 309 | uncore_nb->active_mask = &amd_nb_active_mask; |
308 | uncore_nb->pmu = &amd_nb_pmu; | 310 | uncore_nb->pmu = &amd_nb_pmu; |
311 | uncore_nb->id = -1; | ||
309 | *per_cpu_ptr(amd_uncore_nb, cpu) = uncore_nb; | 312 | *per_cpu_ptr(amd_uncore_nb, cpu) = uncore_nb; |
310 | } | 313 | } |
311 | 314 | ||
@@ -319,6 +322,7 @@ static int amd_uncore_cpu_up_prepare(unsigned int cpu) | |||
319 | uncore_l2->msr_base = MSR_F16H_L2I_PERF_CTL; | 322 | uncore_l2->msr_base = MSR_F16H_L2I_PERF_CTL; |
320 | uncore_l2->active_mask = &amd_l2_active_mask; | 323 | uncore_l2->active_mask = &amd_l2_active_mask; |
321 | uncore_l2->pmu = &amd_l2_pmu; | 324 | uncore_l2->pmu = &amd_l2_pmu; |
325 | uncore_l2->id = -1; | ||
322 | *per_cpu_ptr(amd_uncore_l2, cpu) = uncore_l2; | 326 | *per_cpu_ptr(amd_uncore_l2, cpu) = uncore_l2; |
323 | } | 327 | } |
324 | 328 | ||
@@ -348,7 +352,7 @@ amd_uncore_find_online_sibling(struct amd_uncore *this, | |||
348 | continue; | 352 | continue; |
349 | 353 | ||
350 | if (this->id == that->id) { | 354 | if (this->id == that->id) { |
351 | that->free_when_cpu_online = this; | 355 | hlist_add_head(&this->node, &uncore_unused_list); |
352 | this = that; | 356 | this = that; |
353 | break; | 357 | break; |
354 | } | 358 | } |
@@ -388,13 +392,23 @@ static int amd_uncore_cpu_starting(unsigned int cpu) | |||
388 | return 0; | 392 | return 0; |
389 | } | 393 | } |
390 | 394 | ||
395 | static void uncore_clean_online(void) | ||
396 | { | ||
397 | struct amd_uncore *uncore; | ||
398 | struct hlist_node *n; | ||
399 | |||
400 | hlist_for_each_entry_safe(uncore, n, &uncore_unused_list, node) { | ||
401 | hlist_del(&uncore->node); | ||
402 | kfree(uncore); | ||
403 | } | ||
404 | } | ||
405 | |||
391 | static void uncore_online(unsigned int cpu, | 406 | static void uncore_online(unsigned int cpu, |
392 | struct amd_uncore * __percpu *uncores) | 407 | struct amd_uncore * __percpu *uncores) |
393 | { | 408 | { |
394 | struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu); | 409 | struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu); |
395 | 410 | ||
396 | kfree(uncore->free_when_cpu_online); | 411 | uncore_clean_online(); |
397 | uncore->free_when_cpu_online = NULL; | ||
398 | 412 | ||
399 | if (cpu == uncore->cpu) | 413 | if (cpu == uncore->cpu) |
400 | cpumask_set_cpu(cpu, uncore->active_mask); | 414 | cpumask_set_cpu(cpu, uncore->active_mask); |
diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c index 0a6e393a2e62..bdcd6510992c 100644 --- a/arch/x86/events/intel/bts.c +++ b/arch/x86/events/intel/bts.c | |||
@@ -31,7 +31,17 @@ | |||
31 | struct bts_ctx { | 31 | struct bts_ctx { |
32 | struct perf_output_handle handle; | 32 | struct perf_output_handle handle; |
33 | struct debug_store ds_back; | 33 | struct debug_store ds_back; |
34 | int started; | 34 | int state; |
35 | }; | ||
36 | |||
37 | /* BTS context states: */ | ||
38 | enum { | ||
39 | /* no ongoing AUX transactions */ | ||
40 | BTS_STATE_STOPPED = 0, | ||
41 | /* AUX transaction is on, BTS tracing is disabled */ | ||
42 | BTS_STATE_INACTIVE, | ||
43 | /* AUX transaction is on, BTS tracing is running */ | ||
44 | BTS_STATE_ACTIVE, | ||
35 | }; | 45 | }; |
36 | 46 | ||
37 | static DEFINE_PER_CPU(struct bts_ctx, bts_ctx); | 47 | static DEFINE_PER_CPU(struct bts_ctx, bts_ctx); |
@@ -204,6 +214,15 @@ static void bts_update(struct bts_ctx *bts) | |||
204 | static int | 214 | static int |
205 | bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle); | 215 | bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle); |
206 | 216 | ||
217 | /* | ||
218 | * Ordering PMU callbacks wrt themselves and the PMI is done by means | ||
219 | * of bts::state, which: | ||
220 | * - is set when bts::handle::event is valid, that is, between | ||
221 | * perf_aux_output_begin() and perf_aux_output_end(); | ||
222 | * - is zero otherwise; | ||
223 | * - is ordered against bts::handle::event with a compiler barrier. | ||
224 | */ | ||
225 | |||
207 | static void __bts_event_start(struct perf_event *event) | 226 | static void __bts_event_start(struct perf_event *event) |
208 | { | 227 | { |
209 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 228 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
@@ -221,10 +240,13 @@ static void __bts_event_start(struct perf_event *event) | |||
221 | 240 | ||
222 | /* | 241 | /* |
223 | * local barrier to make sure that ds configuration made it | 242 | * local barrier to make sure that ds configuration made it |
224 | * before we enable BTS | 243 | * before we enable BTS and bts::state goes ACTIVE |
225 | */ | 244 | */ |
226 | wmb(); | 245 | wmb(); |
227 | 246 | ||
247 | /* INACTIVE/STOPPED -> ACTIVE */ | ||
248 | WRITE_ONCE(bts->state, BTS_STATE_ACTIVE); | ||
249 | |||
228 | intel_pmu_enable_bts(config); | 250 | intel_pmu_enable_bts(config); |
229 | 251 | ||
230 | } | 252 | } |
@@ -251,9 +273,6 @@ static void bts_event_start(struct perf_event *event, int flags) | |||
251 | 273 | ||
252 | __bts_event_start(event); | 274 | __bts_event_start(event); |
253 | 275 | ||
254 | /* PMI handler: this counter is running and likely generating PMIs */ | ||
255 | ACCESS_ONCE(bts->started) = 1; | ||
256 | |||
257 | return; | 276 | return; |
258 | 277 | ||
259 | fail_end_stop: | 278 | fail_end_stop: |
@@ -263,30 +282,34 @@ fail_stop: | |||
263 | event->hw.state = PERF_HES_STOPPED; | 282 | event->hw.state = PERF_HES_STOPPED; |
264 | } | 283 | } |
265 | 284 | ||
266 | static void __bts_event_stop(struct perf_event *event) | 285 | static void __bts_event_stop(struct perf_event *event, int state) |
267 | { | 286 | { |
287 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | ||
288 | |||
289 | /* ACTIVE -> INACTIVE(PMI)/STOPPED(->stop()) */ | ||
290 | WRITE_ONCE(bts->state, state); | ||
291 | |||
268 | /* | 292 | /* |
269 | * No extra synchronization is mandated by the documentation to have | 293 | * No extra synchronization is mandated by the documentation to have |
270 | * BTS data stores globally visible. | 294 | * BTS data stores globally visible. |
271 | */ | 295 | */ |
272 | intel_pmu_disable_bts(); | 296 | intel_pmu_disable_bts(); |
273 | |||
274 | if (event->hw.state & PERF_HES_STOPPED) | ||
275 | return; | ||
276 | |||
277 | ACCESS_ONCE(event->hw.state) |= PERF_HES_STOPPED; | ||
278 | } | 297 | } |
279 | 298 | ||
280 | static void bts_event_stop(struct perf_event *event, int flags) | 299 | static void bts_event_stop(struct perf_event *event, int flags) |
281 | { | 300 | { |
282 | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); | 301 | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); |
283 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 302 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
284 | struct bts_buffer *buf = perf_get_aux(&bts->handle); | 303 | struct bts_buffer *buf = NULL; |
304 | int state = READ_ONCE(bts->state); | ||
285 | 305 | ||
286 | /* PMI handler: don't restart this counter */ | 306 | if (state == BTS_STATE_ACTIVE) |
287 | ACCESS_ONCE(bts->started) = 0; | 307 | __bts_event_stop(event, BTS_STATE_STOPPED); |
288 | 308 | ||
289 | __bts_event_stop(event); | 309 | if (state != BTS_STATE_STOPPED) |
310 | buf = perf_get_aux(&bts->handle); | ||
311 | |||
312 | event->hw.state |= PERF_HES_STOPPED; | ||
290 | 313 | ||
291 | if (flags & PERF_EF_UPDATE) { | 314 | if (flags & PERF_EF_UPDATE) { |
292 | bts_update(bts); | 315 | bts_update(bts); |
@@ -296,6 +319,7 @@ static void bts_event_stop(struct perf_event *event, int flags) | |||
296 | bts->handle.head = | 319 | bts->handle.head = |
297 | local_xchg(&buf->data_size, | 320 | local_xchg(&buf->data_size, |
298 | buf->nr_pages << PAGE_SHIFT); | 321 | buf->nr_pages << PAGE_SHIFT); |
322 | |||
299 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), | 323 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), |
300 | !!local_xchg(&buf->lost, 0)); | 324 | !!local_xchg(&buf->lost, 0)); |
301 | } | 325 | } |
@@ -310,8 +334,20 @@ static void bts_event_stop(struct perf_event *event, int flags) | |||
310 | void intel_bts_enable_local(void) | 334 | void intel_bts_enable_local(void) |
311 | { | 335 | { |
312 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 336 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
337 | int state = READ_ONCE(bts->state); | ||
338 | |||
339 | /* | ||
340 | * Here we transition from INACTIVE to ACTIVE; | ||
341 | * if we instead are STOPPED from the interrupt handler, | ||
342 | * stay that way. Can't be ACTIVE here though. | ||
343 | */ | ||
344 | if (WARN_ON_ONCE(state == BTS_STATE_ACTIVE)) | ||
345 | return; | ||
346 | |||
347 | if (state == BTS_STATE_STOPPED) | ||
348 | return; | ||
313 | 349 | ||
314 | if (bts->handle.event && bts->started) | 350 | if (bts->handle.event) |
315 | __bts_event_start(bts->handle.event); | 351 | __bts_event_start(bts->handle.event); |
316 | } | 352 | } |
317 | 353 | ||
@@ -319,8 +355,15 @@ void intel_bts_disable_local(void) | |||
319 | { | 355 | { |
320 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 356 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
321 | 357 | ||
358 | /* | ||
359 | * Here we transition from ACTIVE to INACTIVE; | ||
360 | * do nothing for STOPPED or INACTIVE. | ||
361 | */ | ||
362 | if (READ_ONCE(bts->state) != BTS_STATE_ACTIVE) | ||
363 | return; | ||
364 | |||
322 | if (bts->handle.event) | 365 | if (bts->handle.event) |
323 | __bts_event_stop(bts->handle.event); | 366 | __bts_event_stop(bts->handle.event, BTS_STATE_INACTIVE); |
324 | } | 367 | } |
325 | 368 | ||
326 | static int | 369 | static int |
@@ -335,8 +378,6 @@ bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle) | |||
335 | return 0; | 378 | return 0; |
336 | 379 | ||
337 | head = handle->head & ((buf->nr_pages << PAGE_SHIFT) - 1); | 380 | head = handle->head & ((buf->nr_pages << PAGE_SHIFT) - 1); |
338 | if (WARN_ON_ONCE(head != local_read(&buf->head))) | ||
339 | return -EINVAL; | ||
340 | 381 | ||
341 | phys = &buf->buf[buf->cur_buf]; | 382 | phys = &buf->buf[buf->cur_buf]; |
342 | space = phys->offset + phys->displacement + phys->size - head; | 383 | space = phys->offset + phys->displacement + phys->size - head; |
@@ -403,22 +444,37 @@ bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle) | |||
403 | 444 | ||
404 | int intel_bts_interrupt(void) | 445 | int intel_bts_interrupt(void) |
405 | { | 446 | { |
447 | struct debug_store *ds = this_cpu_ptr(&cpu_hw_events)->ds; | ||
406 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 448 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
407 | struct perf_event *event = bts->handle.event; | 449 | struct perf_event *event = bts->handle.event; |
408 | struct bts_buffer *buf; | 450 | struct bts_buffer *buf; |
409 | s64 old_head; | 451 | s64 old_head; |
410 | int err; | 452 | int err = -ENOSPC, handled = 0; |
411 | 453 | ||
412 | if (!event || !bts->started) | 454 | /* |
413 | return 0; | 455 | * The only surefire way of knowing if this NMI is ours is by checking |
456 | * the write ptr against the PMI threshold. | ||
457 | */ | ||
458 | if (ds->bts_index >= ds->bts_interrupt_threshold) | ||
459 | handled = 1; | ||
460 | |||
461 | /* | ||
462 | * this is wrapped in intel_bts_enable_local/intel_bts_disable_local, | ||
463 | * so we can only be INACTIVE or STOPPED | ||
464 | */ | ||
465 | if (READ_ONCE(bts->state) == BTS_STATE_STOPPED) | ||
466 | return handled; | ||
414 | 467 | ||
415 | buf = perf_get_aux(&bts->handle); | 468 | buf = perf_get_aux(&bts->handle); |
469 | if (!buf) | ||
470 | return handled; | ||
471 | |||
416 | /* | 472 | /* |
417 | * Skip snapshot counters: they don't use the interrupt, but | 473 | * Skip snapshot counters: they don't use the interrupt, but |
418 | * there's no other way of telling, because the pointer will | 474 | * there's no other way of telling, because the pointer will |
419 | * keep moving | 475 | * keep moving |
420 | */ | 476 | */ |
421 | if (!buf || buf->snapshot) | 477 | if (buf->snapshot) |
422 | return 0; | 478 | return 0; |
423 | 479 | ||
424 | old_head = local_read(&buf->head); | 480 | old_head = local_read(&buf->head); |
@@ -426,18 +482,27 @@ int intel_bts_interrupt(void) | |||
426 | 482 | ||
427 | /* no new data */ | 483 | /* no new data */ |
428 | if (old_head == local_read(&buf->head)) | 484 | if (old_head == local_read(&buf->head)) |
429 | return 0; | 485 | return handled; |
430 | 486 | ||
431 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), | 487 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), |
432 | !!local_xchg(&buf->lost, 0)); | 488 | !!local_xchg(&buf->lost, 0)); |
433 | 489 | ||
434 | buf = perf_aux_output_begin(&bts->handle, event); | 490 | buf = perf_aux_output_begin(&bts->handle, event); |
435 | if (!buf) | 491 | if (buf) |
436 | return 1; | 492 | err = bts_buffer_reset(buf, &bts->handle); |
493 | |||
494 | if (err) { | ||
495 | WRITE_ONCE(bts->state, BTS_STATE_STOPPED); | ||
437 | 496 | ||
438 | err = bts_buffer_reset(buf, &bts->handle); | 497 | if (buf) { |
439 | if (err) | 498 | /* |
440 | perf_aux_output_end(&bts->handle, 0, false); | 499 | * BTS_STATE_STOPPED should be visible before |
500 | * cleared handle::event | ||
501 | */ | ||
502 | barrier(); | ||
503 | perf_aux_output_end(&bts->handle, 0, false); | ||
504 | } | ||
505 | } | ||
441 | 506 | ||
442 | return 1; | 507 | return 1; |
443 | } | 508 | } |
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 2cbde2f449aa..4c9a79b9cd69 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c | |||
@@ -1730,9 +1730,11 @@ static __initconst const u64 knl_hw_cache_extra_regs | |||
1730 | * disabled state if called consecutively. | 1730 | * disabled state if called consecutively. |
1731 | * | 1731 | * |
1732 | * During consecutive calls, the same disable value will be written to related | 1732 | * During consecutive calls, the same disable value will be written to related |
1733 | * registers, so the PMU state remains unchanged. hw.state in | 1733 | * registers, so the PMU state remains unchanged. |
1734 | * intel_bts_disable_local will remain PERF_HES_STOPPED too in consecutive | 1734 | * |
1735 | * calls. | 1735 | * intel_bts events don't coexist with intel PMU's BTS events because of |
1736 | * x86_add_exclusive(x86_lbr_exclusive_lbr); there's no need to keep them | ||
1737 | * disabled around intel PMU's event batching etc, only inside the PMI handler. | ||
1736 | */ | 1738 | */ |
1737 | static void __intel_pmu_disable_all(void) | 1739 | static void __intel_pmu_disable_all(void) |
1738 | { | 1740 | { |
@@ -1742,8 +1744,6 @@ static void __intel_pmu_disable_all(void) | |||
1742 | 1744 | ||
1743 | if (test_bit(INTEL_PMC_IDX_FIXED_BTS, cpuc->active_mask)) | 1745 | if (test_bit(INTEL_PMC_IDX_FIXED_BTS, cpuc->active_mask)) |
1744 | intel_pmu_disable_bts(); | 1746 | intel_pmu_disable_bts(); |
1745 | else | ||
1746 | intel_bts_disable_local(); | ||
1747 | 1747 | ||
1748 | intel_pmu_pebs_disable_all(); | 1748 | intel_pmu_pebs_disable_all(); |
1749 | } | 1749 | } |
@@ -1771,8 +1771,7 @@ static void __intel_pmu_enable_all(int added, bool pmi) | |||
1771 | return; | 1771 | return; |
1772 | 1772 | ||
1773 | intel_pmu_enable_bts(event->hw.config); | 1773 | intel_pmu_enable_bts(event->hw.config); |
1774 | } else | 1774 | } |
1775 | intel_bts_enable_local(); | ||
1776 | } | 1775 | } |
1777 | 1776 | ||
1778 | static void intel_pmu_enable_all(int added) | 1777 | static void intel_pmu_enable_all(int added) |
@@ -2073,6 +2072,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs) | |||
2073 | */ | 2072 | */ |
2074 | if (!x86_pmu.late_ack) | 2073 | if (!x86_pmu.late_ack) |
2075 | apic_write(APIC_LVTPC, APIC_DM_NMI); | 2074 | apic_write(APIC_LVTPC, APIC_DM_NMI); |
2075 | intel_bts_disable_local(); | ||
2076 | __intel_pmu_disable_all(); | 2076 | __intel_pmu_disable_all(); |
2077 | handled = intel_pmu_drain_bts_buffer(); | 2077 | handled = intel_pmu_drain_bts_buffer(); |
2078 | handled += intel_bts_interrupt(); | 2078 | handled += intel_bts_interrupt(); |
@@ -2172,6 +2172,7 @@ done: | |||
2172 | /* Only restore PMU state when it's active. See x86_pmu_disable(). */ | 2172 | /* Only restore PMU state when it's active. See x86_pmu_disable(). */ |
2173 | if (cpuc->enabled) | 2173 | if (cpuc->enabled) |
2174 | __intel_pmu_enable_all(0, true); | 2174 | __intel_pmu_enable_all(0, true); |
2175 | intel_bts_enable_local(); | ||
2175 | 2176 | ||
2176 | /* | 2177 | /* |
2177 | * Only unmask the NMI after the overflow counters | 2178 | * Only unmask the NMI after the overflow counters |
diff --git a/arch/x86/events/intel/cqm.c b/arch/x86/events/intel/cqm.c index 783c49ddef29..8f82b02934fa 100644 --- a/arch/x86/events/intel/cqm.c +++ b/arch/x86/events/intel/cqm.c | |||
@@ -458,6 +458,11 @@ static void __intel_cqm_event_count(void *info); | |||
458 | static void init_mbm_sample(u32 rmid, u32 evt_type); | 458 | static void init_mbm_sample(u32 rmid, u32 evt_type); |
459 | static void __intel_mbm_event_count(void *info); | 459 | static void __intel_mbm_event_count(void *info); |
460 | 460 | ||
461 | static bool is_cqm_event(int e) | ||
462 | { | ||
463 | return (e == QOS_L3_OCCUP_EVENT_ID); | ||
464 | } | ||
465 | |||
461 | static bool is_mbm_event(int e) | 466 | static bool is_mbm_event(int e) |
462 | { | 467 | { |
463 | return (e >= QOS_MBM_TOTAL_EVENT_ID && e <= QOS_MBM_LOCAL_EVENT_ID); | 468 | return (e >= QOS_MBM_TOTAL_EVENT_ID && e <= QOS_MBM_LOCAL_EVENT_ID); |
@@ -1366,6 +1371,10 @@ static int intel_cqm_event_init(struct perf_event *event) | |||
1366 | (event->attr.config > QOS_MBM_LOCAL_EVENT_ID)) | 1371 | (event->attr.config > QOS_MBM_LOCAL_EVENT_ID)) |
1367 | return -EINVAL; | 1372 | return -EINVAL; |
1368 | 1373 | ||
1374 | if ((is_cqm_event(event->attr.config) && !cqm_enabled) || | ||
1375 | (is_mbm_event(event->attr.config) && !mbm_enabled)) | ||
1376 | return -EINVAL; | ||
1377 | |||
1369 | /* unsupported modes and filters */ | 1378 | /* unsupported modes and filters */ |
1370 | if (event->attr.exclude_user || | 1379 | if (event->attr.exclude_user || |
1371 | event->attr.exclude_kernel || | 1380 | event->attr.exclude_kernel || |
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 7ce9f3f669e6..9b983a474253 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c | |||
@@ -1274,18 +1274,18 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) | |||
1274 | struct pebs_record_nhm *p = at; | 1274 | struct pebs_record_nhm *p = at; |
1275 | u64 pebs_status; | 1275 | u64 pebs_status; |
1276 | 1276 | ||
1277 | /* PEBS v3 has accurate status bits */ | 1277 | pebs_status = p->status & cpuc->pebs_enabled; |
1278 | pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; | ||
1279 | |||
1280 | /* PEBS v3 has more accurate status bits */ | ||
1278 | if (x86_pmu.intel_cap.pebs_format >= 3) { | 1281 | if (x86_pmu.intel_cap.pebs_format >= 3) { |
1279 | for_each_set_bit(bit, (unsigned long *)&p->status, | 1282 | for_each_set_bit(bit, (unsigned long *)&pebs_status, |
1280 | MAX_PEBS_EVENTS) | 1283 | x86_pmu.max_pebs_events) |
1281 | counts[bit]++; | 1284 | counts[bit]++; |
1282 | 1285 | ||
1283 | continue; | 1286 | continue; |
1284 | } | 1287 | } |
1285 | 1288 | ||
1286 | pebs_status = p->status & cpuc->pebs_enabled; | ||
1287 | pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; | ||
1288 | |||
1289 | /* | 1289 | /* |
1290 | * On some CPUs the PEBS status can be zero when PEBS is | 1290 | * On some CPUs the PEBS status can be zero when PEBS is |
1291 | * racing with clearing of GLOBAL_STATUS. | 1291 | * racing with clearing of GLOBAL_STATUS. |
@@ -1333,8 +1333,11 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) | |||
1333 | continue; | 1333 | continue; |
1334 | 1334 | ||
1335 | event = cpuc->events[bit]; | 1335 | event = cpuc->events[bit]; |
1336 | WARN_ON_ONCE(!event); | 1336 | if (WARN_ON_ONCE(!event)) |
1337 | WARN_ON_ONCE(!event->attr.precise_ip); | 1337 | continue; |
1338 | |||
1339 | if (WARN_ON_ONCE(!event->attr.precise_ip)) | ||
1340 | continue; | ||
1338 | 1341 | ||
1339 | /* log dropped samples number */ | 1342 | /* log dropped samples number */ |
1340 | if (error[bit]) | 1343 | if (error[bit]) |
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c index 04bb5fb5a8d7..861a7d9cb60f 100644 --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c | |||
@@ -1074,6 +1074,11 @@ static void pt_addr_filters_fini(struct perf_event *event) | |||
1074 | event->hw.addr_filters = NULL; | 1074 | event->hw.addr_filters = NULL; |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | static inline bool valid_kernel_ip(unsigned long ip) | ||
1078 | { | ||
1079 | return virt_addr_valid(ip) && kernel_ip(ip); | ||
1080 | } | ||
1081 | |||
1077 | static int pt_event_addr_filters_validate(struct list_head *filters) | 1082 | static int pt_event_addr_filters_validate(struct list_head *filters) |
1078 | { | 1083 | { |
1079 | struct perf_addr_filter *filter; | 1084 | struct perf_addr_filter *filter; |
@@ -1081,11 +1086,16 @@ static int pt_event_addr_filters_validate(struct list_head *filters) | |||
1081 | 1086 | ||
1082 | list_for_each_entry(filter, filters, entry) { | 1087 | list_for_each_entry(filter, filters, entry) { |
1083 | /* PT doesn't support single address triggers */ | 1088 | /* PT doesn't support single address triggers */ |
1084 | if (!filter->range) | 1089 | if (!filter->range || !filter->size) |
1085 | return -EOPNOTSUPP; | 1090 | return -EOPNOTSUPP; |
1086 | 1091 | ||
1087 | if (!filter->inode && !kernel_ip(filter->offset)) | 1092 | if (!filter->inode) { |
1088 | return -EINVAL; | 1093 | if (!valid_kernel_ip(filter->offset)) |
1094 | return -EINVAL; | ||
1095 | |||
1096 | if (!valid_kernel_ip(filter->offset + filter->size)) | ||
1097 | return -EINVAL; | ||
1098 | } | ||
1089 | 1099 | ||
1090 | if (++range > pt_cap_get(PT_CAP_num_address_ranges)) | 1100 | if (++range > pt_cap_get(PT_CAP_num_address_ranges)) |
1091 | return -EOPNOTSUPP; | 1101 | return -EOPNOTSUPP; |
@@ -1111,7 +1121,7 @@ static void pt_event_addr_filters_sync(struct perf_event *event) | |||
1111 | } else { | 1121 | } else { |
1112 | /* apply the offset */ | 1122 | /* apply the offset */ |
1113 | msr_a = filter->offset + offs[range]; | 1123 | msr_a = filter->offset + offs[range]; |
1114 | msr_b = filter->size + msr_a; | 1124 | msr_b = filter->size + msr_a - 1; |
1115 | } | 1125 | } |
1116 | 1126 | ||
1117 | filters->filter[range].msr_a = msr_a; | 1127 | filters->filter[range].msr_a = msr_a; |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index c3f291195294..2131c4ce7d8a 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -433,7 +433,11 @@ do { \ | |||
433 | #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ | 433 | #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ |
434 | asm volatile("1: mov"itype" %1,%"rtype"0\n" \ | 434 | asm volatile("1: mov"itype" %1,%"rtype"0\n" \ |
435 | "2:\n" \ | 435 | "2:\n" \ |
436 | _ASM_EXTABLE_EX(1b, 2b) \ | 436 | ".section .fixup,\"ax\"\n" \ |
437 | "3:xor"itype" %"rtype"0,%"rtype"0\n" \ | ||
438 | " jmp 2b\n" \ | ||
439 | ".previous\n" \ | ||
440 | _ASM_EXTABLE_EX(1b, 3b) \ | ||
437 | : ltype(x) : "m" (__m(addr))) | 441 | : ltype(x) : "m" (__m(addr))) |
438 | 442 | ||
439 | #define __put_user_nocheck(x, ptr, size) \ | 443 | #define __put_user_nocheck(x, ptr, size) \ |
@@ -705,7 +709,7 @@ static inline void copy_user_overflow(int size, unsigned long count) | |||
705 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); | 709 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); |
706 | } | 710 | } |
707 | 711 | ||
708 | static inline unsigned long __must_check | 712 | static __always_inline unsigned long __must_check |
709 | copy_from_user(void *to, const void __user *from, unsigned long n) | 713 | copy_from_user(void *to, const void __user *from, unsigned long n) |
710 | { | 714 | { |
711 | int sz = __compiletime_object_size(to); | 715 | int sz = __compiletime_object_size(to); |
@@ -725,7 +729,7 @@ copy_from_user(void *to, const void __user *from, unsigned long n) | |||
725 | return n; | 729 | return n; |
726 | } | 730 | } |
727 | 731 | ||
728 | static inline unsigned long __must_check | 732 | static __always_inline unsigned long __must_check |
729 | copy_to_user(void __user *to, const void *from, unsigned long n) | 733 | copy_to_user(void __user *to, const void *from, unsigned long n) |
730 | { | 734 | { |
731 | int sz = __compiletime_object_size(from); | 735 | int sz = __compiletime_object_size(from); |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 50c95af0f017..f3e9b2df4b16 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version) | |||
2093 | return -EINVAL; | 2093 | return -EINVAL; |
2094 | } | 2094 | } |
2095 | 2095 | ||
2096 | num_processors++; | ||
2097 | if (apicid == boot_cpu_physical_apicid) { | 2096 | if (apicid == boot_cpu_physical_apicid) { |
2098 | /* | 2097 | /* |
2099 | * x86_bios_cpu_apicid is required to have processors listed | 2098 | * x86_bios_cpu_apicid is required to have processors listed |
@@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version) | |||
2116 | 2115 | ||
2117 | pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", | 2116 | pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", |
2118 | thiscpu, apicid); | 2117 | thiscpu, apicid); |
2118 | |||
2119 | disabled_cpus++; | 2119 | disabled_cpus++; |
2120 | return -ENOSPC; | 2120 | return -ENOSPC; |
2121 | } | 2121 | } |
2122 | 2122 | ||
2123 | num_processors++; | ||
2124 | |||
2123 | /* | 2125 | /* |
2124 | * Validate version | 2126 | * Validate version |
2125 | */ | 2127 | */ |
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index b816971f5da4..620ab06bcf45 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c | |||
@@ -54,6 +54,7 @@ static LIST_HEAD(pcache); | |||
54 | */ | 54 | */ |
55 | static u8 *container; | 55 | static u8 *container; |
56 | static size_t container_size; | 56 | static size_t container_size; |
57 | static bool ucode_builtin; | ||
57 | 58 | ||
58 | static u32 ucode_new_rev; | 59 | static u32 ucode_new_rev; |
59 | static u8 amd_ucode_patch[PATCH_MAX_SIZE]; | 60 | static u8 amd_ucode_patch[PATCH_MAX_SIZE]; |
@@ -281,18 +282,22 @@ static bool __init load_builtin_amd_microcode(struct cpio_data *cp, | |||
281 | void __init load_ucode_amd_bsp(unsigned int family) | 282 | void __init load_ucode_amd_bsp(unsigned int family) |
282 | { | 283 | { |
283 | struct cpio_data cp; | 284 | struct cpio_data cp; |
285 | bool *builtin; | ||
284 | void **data; | 286 | void **data; |
285 | size_t *size; | 287 | size_t *size; |
286 | 288 | ||
287 | #ifdef CONFIG_X86_32 | 289 | #ifdef CONFIG_X86_32 |
288 | data = (void **)__pa_nodebug(&ucode_cpio.data); | 290 | data = (void **)__pa_nodebug(&ucode_cpio.data); |
289 | size = (size_t *)__pa_nodebug(&ucode_cpio.size); | 291 | size = (size_t *)__pa_nodebug(&ucode_cpio.size); |
292 | builtin = (bool *)__pa_nodebug(&ucode_builtin); | ||
290 | #else | 293 | #else |
291 | data = &ucode_cpio.data; | 294 | data = &ucode_cpio.data; |
292 | size = &ucode_cpio.size; | 295 | size = &ucode_cpio.size; |
296 | builtin = &ucode_builtin; | ||
293 | #endif | 297 | #endif |
294 | 298 | ||
295 | if (!load_builtin_amd_microcode(&cp, family)) | 299 | *builtin = load_builtin_amd_microcode(&cp, family); |
300 | if (!*builtin) | ||
296 | cp = find_ucode_in_initrd(); | 301 | cp = find_ucode_in_initrd(); |
297 | 302 | ||
298 | if (!(cp.data && cp.size)) | 303 | if (!(cp.data && cp.size)) |
@@ -373,7 +378,8 @@ void load_ucode_amd_ap(void) | |||
373 | return; | 378 | return; |
374 | 379 | ||
375 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ | 380 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ |
376 | cont += PAGE_OFFSET - __PAGE_OFFSET_BASE; | 381 | if (!ucode_builtin) |
382 | cont += PAGE_OFFSET - __PAGE_OFFSET_BASE; | ||
377 | 383 | ||
378 | eax = cpuid_eax(0x00000001); | 384 | eax = cpuid_eax(0x00000001); |
379 | eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ); | 385 | eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ); |
@@ -439,7 +445,8 @@ int __init save_microcode_in_initrd_amd(void) | |||
439 | container = cont_va; | 445 | container = cont_va; |
440 | 446 | ||
441 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ | 447 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ |
442 | container += PAGE_OFFSET - __PAGE_OFFSET_BASE; | 448 | if (!ucode_builtin) |
449 | container += PAGE_OFFSET - __PAGE_OFFSET_BASE; | ||
443 | 450 | ||
444 | eax = cpuid_eax(0x00000001); | 451 | eax = cpuid_eax(0x00000001); |
445 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); | 452 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 1d39bfbd26bb..3692249a70f1 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -289,6 +289,7 @@ void __init kvmclock_init(void) | |||
289 | put_cpu(); | 289 | put_cpu(); |
290 | 290 | ||
291 | x86_platform.calibrate_tsc = kvm_get_tsc_khz; | 291 | x86_platform.calibrate_tsc = kvm_get_tsc_khz; |
292 | x86_platform.calibrate_cpu = kvm_get_tsc_khz; | ||
292 | x86_platform.get_wallclock = kvm_get_wallclock; | 293 | x86_platform.get_wallclock = kvm_get_wallclock; |
293 | x86_platform.set_wallclock = kvm_set_wallclock; | 294 | x86_platform.set_wallclock = kvm_set_wallclock; |
294 | #ifdef CONFIG_X86_LOCAL_APIC | 295 | #ifdef CONFIG_X86_LOCAL_APIC |
diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c index 5f42d038fcb4..c7220ba94aa7 100644 --- a/arch/x86/kvm/ioapic.c +++ b/arch/x86/kvm/ioapic.c | |||
@@ -109,6 +109,7 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) | |||
109 | { | 109 | { |
110 | bool new_val, old_val; | 110 | bool new_val, old_val; |
111 | struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; | 111 | struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; |
112 | struct dest_map *dest_map = &ioapic->rtc_status.dest_map; | ||
112 | union kvm_ioapic_redirect_entry *e; | 113 | union kvm_ioapic_redirect_entry *e; |
113 | 114 | ||
114 | e = &ioapic->redirtbl[RTC_GSI]; | 115 | e = &ioapic->redirtbl[RTC_GSI]; |
@@ -117,16 +118,17 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) | |||
117 | return; | 118 | return; |
118 | 119 | ||
119 | new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector); | 120 | new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector); |
120 | old_val = test_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); | 121 | old_val = test_bit(vcpu->vcpu_id, dest_map->map); |
121 | 122 | ||
122 | if (new_val == old_val) | 123 | if (new_val == old_val) |
123 | return; | 124 | return; |
124 | 125 | ||
125 | if (new_val) { | 126 | if (new_val) { |
126 | __set_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); | 127 | __set_bit(vcpu->vcpu_id, dest_map->map); |
128 | dest_map->vectors[vcpu->vcpu_id] = e->fields.vector; | ||
127 | ioapic->rtc_status.pending_eoi++; | 129 | ioapic->rtc_status.pending_eoi++; |
128 | } else { | 130 | } else { |
129 | __clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); | 131 | __clear_bit(vcpu->vcpu_id, dest_map->map); |
130 | ioapic->rtc_status.pending_eoi--; | 132 | ioapic->rtc_status.pending_eoi--; |
131 | rtc_status_pending_eoi_check_valid(ioapic); | 133 | rtc_status_pending_eoi_check_valid(ioapic); |
132 | } | 134 | } |
diff --git a/arch/x86/kvm/pmu_amd.c b/arch/x86/kvm/pmu_amd.c index 39b91127ef07..cd944435dfbd 100644 --- a/arch/x86/kvm/pmu_amd.c +++ b/arch/x86/kvm/pmu_amd.c | |||
@@ -23,8 +23,8 @@ | |||
23 | static struct kvm_event_hw_type_mapping amd_event_mapping[] = { | 23 | static struct kvm_event_hw_type_mapping amd_event_mapping[] = { |
24 | [0] = { 0x76, 0x00, PERF_COUNT_HW_CPU_CYCLES }, | 24 | [0] = { 0x76, 0x00, PERF_COUNT_HW_CPU_CYCLES }, |
25 | [1] = { 0xc0, 0x00, PERF_COUNT_HW_INSTRUCTIONS }, | 25 | [1] = { 0xc0, 0x00, PERF_COUNT_HW_INSTRUCTIONS }, |
26 | [2] = { 0x80, 0x00, PERF_COUNT_HW_CACHE_REFERENCES }, | 26 | [2] = { 0x7d, 0x07, PERF_COUNT_HW_CACHE_REFERENCES }, |
27 | [3] = { 0x81, 0x00, PERF_COUNT_HW_CACHE_MISSES }, | 27 | [3] = { 0x7e, 0x07, PERF_COUNT_HW_CACHE_MISSES }, |
28 | [4] = { 0xc2, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, | 28 | [4] = { 0xc2, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, |
29 | [5] = { 0xc3, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, | 29 | [5] = { 0xc3, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, |
30 | [6] = { 0xd0, 0x00, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND }, | 30 | [6] = { 0xd0, 0x00, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND }, |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 19f9f9e05c2a..699f8726539a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -2743,16 +2743,16 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
2743 | if (tsc_delta < 0) | 2743 | if (tsc_delta < 0) |
2744 | mark_tsc_unstable("KVM discovered backwards TSC"); | 2744 | mark_tsc_unstable("KVM discovered backwards TSC"); |
2745 | 2745 | ||
2746 | if (kvm_lapic_hv_timer_in_use(vcpu) && | ||
2747 | kvm_x86_ops->set_hv_timer(vcpu, | ||
2748 | kvm_get_lapic_tscdeadline_msr(vcpu))) | ||
2749 | kvm_lapic_switch_to_sw_timer(vcpu); | ||
2750 | if (check_tsc_unstable()) { | 2746 | if (check_tsc_unstable()) { |
2751 | u64 offset = kvm_compute_tsc_offset(vcpu, | 2747 | u64 offset = kvm_compute_tsc_offset(vcpu, |
2752 | vcpu->arch.last_guest_tsc); | 2748 | vcpu->arch.last_guest_tsc); |
2753 | kvm_x86_ops->write_tsc_offset(vcpu, offset); | 2749 | kvm_x86_ops->write_tsc_offset(vcpu, offset); |
2754 | vcpu->arch.tsc_catchup = 1; | 2750 | vcpu->arch.tsc_catchup = 1; |
2755 | } | 2751 | } |
2752 | if (kvm_lapic_hv_timer_in_use(vcpu) && | ||
2753 | kvm_x86_ops->set_hv_timer(vcpu, | ||
2754 | kvm_get_lapic_tscdeadline_msr(vcpu))) | ||
2755 | kvm_lapic_switch_to_sw_timer(vcpu); | ||
2756 | /* | 2756 | /* |
2757 | * On a host with synchronized TSC, there is no need to update | 2757 | * On a host with synchronized TSC, there is no need to update |
2758 | * kvmclock on vcpu->cpu migration | 2758 | * kvmclock on vcpu->cpu migration |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 849dc09fa4f0..e3353c97d086 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -917,11 +917,11 @@ static void populate_pte(struct cpa_data *cpa, | |||
917 | } | 917 | } |
918 | } | 918 | } |
919 | 919 | ||
920 | static int populate_pmd(struct cpa_data *cpa, | 920 | static long populate_pmd(struct cpa_data *cpa, |
921 | unsigned long start, unsigned long end, | 921 | unsigned long start, unsigned long end, |
922 | unsigned num_pages, pud_t *pud, pgprot_t pgprot) | 922 | unsigned num_pages, pud_t *pud, pgprot_t pgprot) |
923 | { | 923 | { |
924 | unsigned int cur_pages = 0; | 924 | long cur_pages = 0; |
925 | pmd_t *pmd; | 925 | pmd_t *pmd; |
926 | pgprot_t pmd_pgprot; | 926 | pgprot_t pmd_pgprot; |
927 | 927 | ||
@@ -991,12 +991,12 @@ static int populate_pmd(struct cpa_data *cpa, | |||
991 | return num_pages; | 991 | return num_pages; |
992 | } | 992 | } |
993 | 993 | ||
994 | static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd, | 994 | static long populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd, |
995 | pgprot_t pgprot) | 995 | pgprot_t pgprot) |
996 | { | 996 | { |
997 | pud_t *pud; | 997 | pud_t *pud; |
998 | unsigned long end; | 998 | unsigned long end; |
999 | int cur_pages = 0; | 999 | long cur_pages = 0; |
1000 | pgprot_t pud_pgprot; | 1000 | pgprot_t pud_pgprot; |
1001 | 1001 | ||
1002 | end = start + (cpa->numpages << PAGE_SHIFT); | 1002 | end = start + (cpa->numpages << PAGE_SHIFT); |
@@ -1052,7 +1052,7 @@ static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd, | |||
1052 | 1052 | ||
1053 | /* Map trailing leftover */ | 1053 | /* Map trailing leftover */ |
1054 | if (start < end) { | 1054 | if (start < end) { |
1055 | int tmp; | 1055 | long tmp; |
1056 | 1056 | ||
1057 | pud = pud_offset(pgd, start); | 1057 | pud = pud_offset(pgd, start); |
1058 | if (pud_none(*pud)) | 1058 | if (pud_none(*pud)) |
@@ -1078,7 +1078,7 @@ static int populate_pgd(struct cpa_data *cpa, unsigned long addr) | |||
1078 | pgprot_t pgprot = __pgprot(_KERNPG_TABLE); | 1078 | pgprot_t pgprot = __pgprot(_KERNPG_TABLE); |
1079 | pud_t *pud = NULL; /* shut up gcc */ | 1079 | pud_t *pud = NULL; /* shut up gcc */ |
1080 | pgd_t *pgd_entry; | 1080 | pgd_t *pgd_entry; |
1081 | int ret; | 1081 | long ret; |
1082 | 1082 | ||
1083 | pgd_entry = cpa->pgd + pgd_index(addr); | 1083 | pgd_entry = cpa->pgd + pgd_index(addr); |
1084 | 1084 | ||
@@ -1327,7 +1327,8 @@ static int cpa_process_alias(struct cpa_data *cpa) | |||
1327 | 1327 | ||
1328 | static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias) | 1328 | static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias) |
1329 | { | 1329 | { |
1330 | int ret, numpages = cpa->numpages; | 1330 | unsigned long numpages = cpa->numpages; |
1331 | int ret; | ||
1331 | 1332 | ||
1332 | while (numpages) { | 1333 | while (numpages) { |
1333 | /* | 1334 | /* |
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index ecb1b69c1651..170cc4ff057b 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c | |||
@@ -927,9 +927,10 @@ int track_pfn_copy(struct vm_area_struct *vma) | |||
927 | } | 927 | } |
928 | 928 | ||
929 | /* | 929 | /* |
930 | * prot is passed in as a parameter for the new mapping. If the vma has a | 930 | * prot is passed in as a parameter for the new mapping. If the vma has |
931 | * linear pfn mapping for the entire range reserve the entire vma range with | 931 | * a linear pfn mapping for the entire range, or no vma is provided, |
932 | * single reserve_pfn_range call. | 932 | * reserve the entire pfn + size range with single reserve_pfn_range |
933 | * call. | ||
933 | */ | 934 | */ |
934 | int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot, | 935 | int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot, |
935 | unsigned long pfn, unsigned long addr, unsigned long size) | 936 | unsigned long pfn, unsigned long addr, unsigned long size) |
@@ -938,11 +939,12 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot, | |||
938 | enum page_cache_mode pcm; | 939 | enum page_cache_mode pcm; |
939 | 940 | ||
940 | /* reserve the whole chunk starting from paddr */ | 941 | /* reserve the whole chunk starting from paddr */ |
941 | if (addr == vma->vm_start && size == (vma->vm_end - vma->vm_start)) { | 942 | if (!vma || (addr == vma->vm_start |
943 | && size == (vma->vm_end - vma->vm_start))) { | ||
942 | int ret; | 944 | int ret; |
943 | 945 | ||
944 | ret = reserve_pfn_range(paddr, size, prot, 0); | 946 | ret = reserve_pfn_range(paddr, size, prot, 0); |
945 | if (!ret) | 947 | if (ret == 0 && vma) |
946 | vma->vm_flags |= VM_PAT; | 948 | vma->vm_flags |= VM_PAT; |
947 | return ret; | 949 | return ret; |
948 | } | 950 | } |
@@ -997,7 +999,7 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, | |||
997 | resource_size_t paddr; | 999 | resource_size_t paddr; |
998 | unsigned long prot; | 1000 | unsigned long prot; |
999 | 1001 | ||
1000 | if (!(vma->vm_flags & VM_PAT)) | 1002 | if (vma && !(vma->vm_flags & VM_PAT)) |
1001 | return; | 1003 | return; |
1002 | 1004 | ||
1003 | /* free the chunk starting from pfn or the whole chunk */ | 1005 | /* free the chunk starting from pfn or the whole chunk */ |
@@ -1011,7 +1013,8 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, | |||
1011 | size = vma->vm_end - vma->vm_start; | 1013 | size = vma->vm_end - vma->vm_start; |
1012 | } | 1014 | } |
1013 | free_pfn_range(paddr, size); | 1015 | free_pfn_range(paddr, size); |
1014 | vma->vm_flags &= ~VM_PAT; | 1016 | if (vma) |
1017 | vma->vm_flags &= ~VM_PAT; | ||
1015 | } | 1018 | } |
1016 | 1019 | ||
1017 | /* | 1020 | /* |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index 837ea36a837d..6d52b94f4bb9 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -553,15 +553,21 @@ static void twinhead_reserve_killing_zone(struct pci_dev *dev) | |||
553 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone); | 553 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone); |
554 | 554 | ||
555 | /* | 555 | /* |
556 | * Broadwell EP Home Agent BARs erroneously return non-zero values when read. | 556 | * Device [8086:2fc0] |
557 | * Erratum HSE43 | ||
558 | * CONFIG_TDP_NOMINAL CSR Implemented at Incorrect Offset | ||
559 | * http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v3-spec-update.html | ||
557 | * | 560 | * |
558 | * See http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html | 561 | * Devices [8086:6f60,6fa0,6fc0] |
559 | * entry BDF2. | 562 | * Erratum BDF2 |
563 | * PCI BARs in the Home Agent Will Return Non-Zero Values During Enumeration | ||
564 | * http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html | ||
560 | */ | 565 | */ |
561 | static void pci_bdwep_bar(struct pci_dev *dev) | 566 | static void pci_invalid_bar(struct pci_dev *dev) |
562 | { | 567 | { |
563 | dev->non_compliant_bars = 1; | 568 | dev->non_compliant_bars = 1; |
564 | } | 569 | } |
565 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_bdwep_bar); | 570 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2fc0, pci_invalid_bar); |
566 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_bdwep_bar); | 571 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_invalid_bar); |
567 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_bdwep_bar); | 572 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_invalid_bar); |
573 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_invalid_bar); | ||
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index d65cdadaa6b6..58b0f801f66f 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -244,7 +244,7 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) | |||
244 | * text and allocate a new stack because we can't rely on the | 244 | * text and allocate a new stack because we can't rely on the |
245 | * stack pointer being < 4GB. | 245 | * stack pointer being < 4GB. |
246 | */ | 246 | */ |
247 | if (!IS_ENABLED(CONFIG_EFI_MIXED)) | 247 | if (!IS_ENABLED(CONFIG_EFI_MIXED) || efi_is_native()) |
248 | return 0; | 248 | return 0; |
249 | 249 | ||
250 | page = alloc_page(GFP_KERNEL|__GFP_DMA32); | 250 | page = alloc_page(GFP_KERNEL|__GFP_DMA32); |
diff --git a/arch/x86/um/ptrace_32.c b/arch/x86/um/ptrace_32.c index ebd4dd6ef73b..a7ef7b131e25 100644 --- a/arch/x86/um/ptrace_32.c +++ b/arch/x86/um/ptrace_32.c | |||
@@ -84,7 +84,10 @@ int putreg(struct task_struct *child, int regno, unsigned long value) | |||
84 | case EAX: | 84 | case EAX: |
85 | case EIP: | 85 | case EIP: |
86 | case UESP: | 86 | case UESP: |
87 | break; | ||
87 | case ORIG_EAX: | 88 | case ORIG_EAX: |
89 | /* Update the syscall number. */ | ||
90 | UPT_SYSCALL_NR(&child->thread.regs.regs) = value; | ||
88 | break; | 91 | break; |
89 | case FS: | 92 | case FS: |
90 | if (value && (value & 3) != 3) | 93 | if (value && (value & 3) != 3) |
diff --git a/arch/x86/um/ptrace_64.c b/arch/x86/um/ptrace_64.c index faab418876ce..0b5c184dd5b3 100644 --- a/arch/x86/um/ptrace_64.c +++ b/arch/x86/um/ptrace_64.c | |||
@@ -78,7 +78,11 @@ int putreg(struct task_struct *child, int regno, unsigned long value) | |||
78 | case RSI: | 78 | case RSI: |
79 | case RDI: | 79 | case RDI: |
80 | case RBP: | 80 | case RBP: |
81 | break; | ||
82 | |||
81 | case ORIG_RAX: | 83 | case ORIG_RAX: |
84 | /* Update the syscall number. */ | ||
85 | UPT_SYSCALL_NR(&child->thread.regs.regs) = value; | ||
82 | break; | 86 | break; |
83 | 87 | ||
84 | case FS: | 88 | case FS: |
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 369999530108..a832426820e8 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -233,6 +233,8 @@ static int blkcipher_walk_next(struct blkcipher_desc *desc, | |||
233 | return blkcipher_walk_done(desc, walk, -EINVAL); | 233 | return blkcipher_walk_done(desc, walk, -EINVAL); |
234 | } | 234 | } |
235 | 235 | ||
236 | bsize = min(walk->walk_blocksize, n); | ||
237 | |||
236 | walk->flags &= ~(BLKCIPHER_WALK_SLOW | BLKCIPHER_WALK_COPY | | 238 | walk->flags &= ~(BLKCIPHER_WALK_SLOW | BLKCIPHER_WALK_COPY | |
237 | BLKCIPHER_WALK_DIFF); | 239 | BLKCIPHER_WALK_DIFF); |
238 | if (!scatterwalk_aligned(&walk->in, walk->alignmask) || | 240 | if (!scatterwalk_aligned(&walk->in, walk->alignmask) || |
@@ -245,7 +247,6 @@ static int blkcipher_walk_next(struct blkcipher_desc *desc, | |||
245 | } | 247 | } |
246 | } | 248 | } |
247 | 249 | ||
248 | bsize = min(walk->walk_blocksize, n); | ||
249 | n = scatterwalk_clamp(&walk->in, n); | 250 | n = scatterwalk_clamp(&walk->in, n); |
250 | n = scatterwalk_clamp(&walk->out, n); | 251 | n = scatterwalk_clamp(&walk->out, n); |
251 | 252 | ||
diff --git a/crypto/cryptd.c b/crypto/cryptd.c index cf8037a87b2d..0c654e59f215 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c | |||
@@ -631,9 +631,14 @@ static int cryptd_hash_export(struct ahash_request *req, void *out) | |||
631 | 631 | ||
632 | static int cryptd_hash_import(struct ahash_request *req, const void *in) | 632 | static int cryptd_hash_import(struct ahash_request *req, const void *in) |
633 | { | 633 | { |
634 | struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); | 634 | struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); |
635 | struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm); | ||
636 | struct shash_desc *desc = cryptd_shash_desc(req); | ||
637 | |||
638 | desc->tfm = ctx->child; | ||
639 | desc->flags = req->base.flags; | ||
635 | 640 | ||
636 | return crypto_shash_import(&rctx->desc, in); | 641 | return crypto_shash_import(desc, in); |
637 | } | 642 | } |
638 | 643 | ||
639 | static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, | 644 | static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, |
@@ -733,13 +738,14 @@ static void cryptd_aead_crypt(struct aead_request *req, | |||
733 | rctx = aead_request_ctx(req); | 738 | rctx = aead_request_ctx(req); |
734 | compl = rctx->complete; | 739 | compl = rctx->complete; |
735 | 740 | ||
741 | tfm = crypto_aead_reqtfm(req); | ||
742 | |||
736 | if (unlikely(err == -EINPROGRESS)) | 743 | if (unlikely(err == -EINPROGRESS)) |
737 | goto out; | 744 | goto out; |
738 | aead_request_set_tfm(req, child); | 745 | aead_request_set_tfm(req, child); |
739 | err = crypt( req ); | 746 | err = crypt( req ); |
740 | 747 | ||
741 | out: | 748 | out: |
742 | tfm = crypto_aead_reqtfm(req); | ||
743 | ctx = crypto_aead_ctx(tfm); | 749 | ctx = crypto_aead_ctx(tfm); |
744 | refcnt = atomic_read(&ctx->refcnt); | 750 | refcnt = atomic_read(&ctx->refcnt); |
745 | 751 | ||
diff --git a/crypto/echainiv.c b/crypto/echainiv.c index 1b01fe98e91f..e3d889b122e0 100644 --- a/crypto/echainiv.c +++ b/crypto/echainiv.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * echainiv: Encrypted Chain IV Generator | 2 | * echainiv: Encrypted Chain IV Generator |
3 | * | 3 | * |
4 | * This generator generates an IV based on a sequence number by xoring it | 4 | * This generator generates an IV based on a sequence number by multiplying |
5 | * with a salt and then encrypting it with the same key as used to encrypt | 5 | * it with a salt and then encrypting it with the same key as used to encrypt |
6 | * the plain text. This algorithm requires that the block size be equal | 6 | * the plain text. This algorithm requires that the block size be equal |
7 | * to the IV size. It is mainly useful for CBC. | 7 | * to the IV size. It is mainly useful for CBC. |
8 | * | 8 | * |
@@ -24,81 +24,17 @@ | |||
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/mm.h> | ||
28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
29 | #include <linux/percpu.h> | 28 | #include <linux/slab.h> |
30 | #include <linux/spinlock.h> | ||
31 | #include <linux/string.h> | 29 | #include <linux/string.h> |
32 | 30 | ||
33 | #define MAX_IV_SIZE 16 | ||
34 | |||
35 | static DEFINE_PER_CPU(u32 [MAX_IV_SIZE / sizeof(u32)], echainiv_iv); | ||
36 | |||
37 | /* We don't care if we get preempted and read/write IVs from the next CPU. */ | ||
38 | static void echainiv_read_iv(u8 *dst, unsigned size) | ||
39 | { | ||
40 | u32 *a = (u32 *)dst; | ||
41 | u32 __percpu *b = echainiv_iv; | ||
42 | |||
43 | for (; size >= 4; size -= 4) { | ||
44 | *a++ = this_cpu_read(*b); | ||
45 | b++; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | static void echainiv_write_iv(const u8 *src, unsigned size) | ||
50 | { | ||
51 | const u32 *a = (const u32 *)src; | ||
52 | u32 __percpu *b = echainiv_iv; | ||
53 | |||
54 | for (; size >= 4; size -= 4) { | ||
55 | this_cpu_write(*b, *a); | ||
56 | a++; | ||
57 | b++; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | static void echainiv_encrypt_complete2(struct aead_request *req, int err) | ||
62 | { | ||
63 | struct aead_request *subreq = aead_request_ctx(req); | ||
64 | struct crypto_aead *geniv; | ||
65 | unsigned int ivsize; | ||
66 | |||
67 | if (err == -EINPROGRESS) | ||
68 | return; | ||
69 | |||
70 | if (err) | ||
71 | goto out; | ||
72 | |||
73 | geniv = crypto_aead_reqtfm(req); | ||
74 | ivsize = crypto_aead_ivsize(geniv); | ||
75 | |||
76 | echainiv_write_iv(subreq->iv, ivsize); | ||
77 | |||
78 | if (req->iv != subreq->iv) | ||
79 | memcpy(req->iv, subreq->iv, ivsize); | ||
80 | |||
81 | out: | ||
82 | if (req->iv != subreq->iv) | ||
83 | kzfree(subreq->iv); | ||
84 | } | ||
85 | |||
86 | static void echainiv_encrypt_complete(struct crypto_async_request *base, | ||
87 | int err) | ||
88 | { | ||
89 | struct aead_request *req = base->data; | ||
90 | |||
91 | echainiv_encrypt_complete2(req, err); | ||
92 | aead_request_complete(req, err); | ||
93 | } | ||
94 | |||
95 | static int echainiv_encrypt(struct aead_request *req) | 31 | static int echainiv_encrypt(struct aead_request *req) |
96 | { | 32 | { |
97 | struct crypto_aead *geniv = crypto_aead_reqtfm(req); | 33 | struct crypto_aead *geniv = crypto_aead_reqtfm(req); |
98 | struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv); | 34 | struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv); |
99 | struct aead_request *subreq = aead_request_ctx(req); | 35 | struct aead_request *subreq = aead_request_ctx(req); |
100 | crypto_completion_t compl; | 36 | __be64 nseqno; |
101 | void *data; | 37 | u64 seqno; |
102 | u8 *info; | 38 | u8 *info; |
103 | unsigned int ivsize = crypto_aead_ivsize(geniv); | 39 | unsigned int ivsize = crypto_aead_ivsize(geniv); |
104 | int err; | 40 | int err; |
@@ -108,8 +44,6 @@ static int echainiv_encrypt(struct aead_request *req) | |||
108 | 44 | ||
109 | aead_request_set_tfm(subreq, ctx->child); | 45 | aead_request_set_tfm(subreq, ctx->child); |
110 | 46 | ||
111 | compl = echainiv_encrypt_complete; | ||
112 | data = req; | ||
113 | info = req->iv; | 47 | info = req->iv; |
114 | 48 | ||
115 | if (req->src != req->dst) { | 49 | if (req->src != req->dst) { |
@@ -127,29 +61,30 @@ static int echainiv_encrypt(struct aead_request *req) | |||
127 | return err; | 61 | return err; |
128 | } | 62 | } |
129 | 63 | ||
130 | if (unlikely(!IS_ALIGNED((unsigned long)info, | 64 | aead_request_set_callback(subreq, req->base.flags, |
131 | crypto_aead_alignmask(geniv) + 1))) { | 65 | req->base.complete, req->base.data); |
132 | info = kmalloc(ivsize, req->base.flags & | ||
133 | CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL: | ||
134 | GFP_ATOMIC); | ||
135 | if (!info) | ||
136 | return -ENOMEM; | ||
137 | |||
138 | memcpy(info, req->iv, ivsize); | ||
139 | } | ||
140 | |||
141 | aead_request_set_callback(subreq, req->base.flags, compl, data); | ||
142 | aead_request_set_crypt(subreq, req->dst, req->dst, | 66 | aead_request_set_crypt(subreq, req->dst, req->dst, |
143 | req->cryptlen, info); | 67 | req->cryptlen, info); |
144 | aead_request_set_ad(subreq, req->assoclen); | 68 | aead_request_set_ad(subreq, req->assoclen); |
145 | 69 | ||
146 | crypto_xor(info, ctx->salt, ivsize); | 70 | memcpy(&nseqno, info + ivsize - 8, 8); |
71 | seqno = be64_to_cpu(nseqno); | ||
72 | memset(info, 0, ivsize); | ||
73 | |||
147 | scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1); | 74 | scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1); |
148 | echainiv_read_iv(info, ivsize); | ||
149 | 75 | ||
150 | err = crypto_aead_encrypt(subreq); | 76 | do { |
151 | echainiv_encrypt_complete2(req, err); | 77 | u64 a; |
152 | return err; | 78 | |
79 | memcpy(&a, ctx->salt + ivsize - 8, 8); | ||
80 | |||
81 | a |= 1; | ||
82 | a *= seqno; | ||
83 | |||
84 | memcpy(info + ivsize - 8, &a, 8); | ||
85 | } while ((ivsize -= 8)); | ||
86 | |||
87 | return crypto_aead_encrypt(subreq); | ||
153 | } | 88 | } |
154 | 89 | ||
155 | static int echainiv_decrypt(struct aead_request *req) | 90 | static int echainiv_decrypt(struct aead_request *req) |
@@ -196,8 +131,7 @@ static int echainiv_aead_create(struct crypto_template *tmpl, | |||
196 | alg = crypto_spawn_aead_alg(spawn); | 131 | alg = crypto_spawn_aead_alg(spawn); |
197 | 132 | ||
198 | err = -EINVAL; | 133 | err = -EINVAL; |
199 | if (inst->alg.ivsize & (sizeof(u32) - 1) || | 134 | if (inst->alg.ivsize & (sizeof(u64) - 1) || !inst->alg.ivsize) |
200 | inst->alg.ivsize > MAX_IV_SIZE) | ||
201 | goto free_inst; | 135 | goto free_inst; |
202 | 136 | ||
203 | inst->alg.encrypt = echainiv_encrypt; | 137 | inst->alg.encrypt = echainiv_encrypt; |
@@ -206,7 +140,6 @@ static int echainiv_aead_create(struct crypto_template *tmpl, | |||
206 | inst->alg.init = aead_init_geniv; | 140 | inst->alg.init = aead_init_geniv; |
207 | inst->alg.exit = aead_exit_geniv; | 141 | inst->alg.exit = aead_exit_geniv; |
208 | 142 | ||
209 | inst->alg.base.cra_alignmask |= __alignof__(u32) - 1; | ||
210 | inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx); | 143 | inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx); |
211 | inst->alg.base.cra_ctxsize += inst->alg.ivsize; | 144 | inst->alg.base.cra_ctxsize += inst->alg.ivsize; |
212 | 145 | ||
diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c index 4c745bf389fe..161f91539ae6 100644 --- a/drivers/acpi/nfit/mce.c +++ b/drivers/acpi/nfit/mce.c | |||
@@ -42,7 +42,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val, | |||
42 | list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { | 42 | list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { |
43 | struct acpi_nfit_system_address *spa = nfit_spa->spa; | 43 | struct acpi_nfit_system_address *spa = nfit_spa->spa; |
44 | 44 | ||
45 | if (nfit_spa_type(spa) == NFIT_SPA_PM) | 45 | if (nfit_spa_type(spa) != NFIT_SPA_PM) |
46 | continue; | 46 | continue; |
47 | /* find the spa that covers the mce addr */ | 47 | /* find the spa that covers the mce addr */ |
48 | if (spa->address > mce->addr) | 48 | if (spa->address > mce->addr) |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 17995fadebd7..82a081ea4317 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -419,7 +419,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
419 | struct device *parent = NULL; | 419 | struct device *parent = NULL; |
420 | int retval; | 420 | int retval; |
421 | 421 | ||
422 | trace_rpm_suspend(dev, rpmflags); | 422 | trace_rpm_suspend_rcuidle(dev, rpmflags); |
423 | 423 | ||
424 | repeat: | 424 | repeat: |
425 | retval = rpm_check_suspend_allowed(dev); | 425 | retval = rpm_check_suspend_allowed(dev); |
@@ -549,7 +549,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
549 | } | 549 | } |
550 | 550 | ||
551 | out: | 551 | out: |
552 | trace_rpm_return_int(dev, _THIS_IP_, retval); | 552 | trace_rpm_return_int_rcuidle(dev, _THIS_IP_, retval); |
553 | 553 | ||
554 | return retval; | 554 | return retval; |
555 | 555 | ||
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index aa56af87d941..b11af3f2c1db 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -404,6 +404,7 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg, | |||
404 | unsigned int new_base_reg, new_top_reg; | 404 | unsigned int new_base_reg, new_top_reg; |
405 | unsigned int min, max; | 405 | unsigned int min, max; |
406 | unsigned int max_dist; | 406 | unsigned int max_dist; |
407 | unsigned int dist, best_dist = UINT_MAX; | ||
407 | 408 | ||
408 | max_dist = map->reg_stride * sizeof(*rbnode_tmp) / | 409 | max_dist = map->reg_stride * sizeof(*rbnode_tmp) / |
409 | map->cache_word_size; | 410 | map->cache_word_size; |
@@ -423,24 +424,41 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg, | |||
423 | &base_reg, &top_reg); | 424 | &base_reg, &top_reg); |
424 | 425 | ||
425 | if (base_reg <= max && top_reg >= min) { | 426 | if (base_reg <= max && top_reg >= min) { |
426 | new_base_reg = min(reg, base_reg); | 427 | if (reg < base_reg) |
427 | new_top_reg = max(reg, top_reg); | 428 | dist = base_reg - reg; |
428 | } else { | 429 | else if (reg > top_reg) |
429 | if (max < base_reg) | 430 | dist = reg - top_reg; |
430 | node = node->rb_left; | ||
431 | else | 431 | else |
432 | node = node->rb_right; | 432 | dist = 0; |
433 | 433 | if (dist < best_dist) { | |
434 | continue; | 434 | rbnode = rbnode_tmp; |
435 | best_dist = dist; | ||
436 | new_base_reg = min(reg, base_reg); | ||
437 | new_top_reg = max(reg, top_reg); | ||
438 | } | ||
435 | } | 439 | } |
436 | 440 | ||
437 | ret = regcache_rbtree_insert_to_block(map, rbnode_tmp, | 441 | /* |
442 | * Keep looking, we want to choose the closest block, | ||
443 | * otherwise we might end up creating overlapping | ||
444 | * blocks, which breaks the rbtree. | ||
445 | */ | ||
446 | if (reg < base_reg) | ||
447 | node = node->rb_left; | ||
448 | else if (reg > top_reg) | ||
449 | node = node->rb_right; | ||
450 | else | ||
451 | break; | ||
452 | } | ||
453 | |||
454 | if (rbnode) { | ||
455 | ret = regcache_rbtree_insert_to_block(map, rbnode, | ||
438 | new_base_reg, | 456 | new_base_reg, |
439 | new_top_reg, reg, | 457 | new_top_reg, reg, |
440 | value); | 458 | value); |
441 | if (ret) | 459 | if (ret) |
442 | return ret; | 460 | return ret; |
443 | rbtree_ctx->cached_rbnode = rbnode_tmp; | 461 | rbtree_ctx->cached_rbnode = rbnode; |
444 | return 0; | 462 | return 0; |
445 | } | 463 | } |
446 | 464 | ||
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index df7ff7290821..4e582561e1e7 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -38,10 +38,11 @@ static int regcache_hw_init(struct regmap *map) | |||
38 | 38 | ||
39 | /* calculate the size of reg_defaults */ | 39 | /* calculate the size of reg_defaults */ |
40 | for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) | 40 | for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) |
41 | if (!regmap_volatile(map, i * map->reg_stride)) | 41 | if (regmap_readable(map, i * map->reg_stride) && |
42 | !regmap_volatile(map, i * map->reg_stride)) | ||
42 | count++; | 43 | count++; |
43 | 44 | ||
44 | /* all registers are volatile, so just bypass */ | 45 | /* all registers are unreadable or volatile, so just bypass */ |
45 | if (!count) { | 46 | if (!count) { |
46 | map->cache_bypass = true; | 47 | map->cache_bypass = true; |
47 | return 0; | 48 | return 0; |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 51fa7d66a393..25d26bb18970 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -1474,6 +1474,8 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, | |||
1474 | ret = map->bus->write(map->bus_context, buf, len); | 1474 | ret = map->bus->write(map->bus_context, buf, len); |
1475 | 1475 | ||
1476 | kfree(buf); | 1476 | kfree(buf); |
1477 | } else if (ret != 0 && !map->cache_bypass && map->format.parse_val) { | ||
1478 | regcache_drop_region(map, reg, reg + 1); | ||
1477 | } | 1479 | } |
1478 | 1480 | ||
1479 | trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes); | 1481 | trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes); |
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c index 5755907f836f..ffa7c9dcbd7a 100644 --- a/drivers/bus/arm-cci.c +++ b/drivers/bus/arm-cci.c | |||
@@ -551,7 +551,7 @@ static struct attribute *cci5xx_pmu_event_attrs[] = { | |||
551 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_wrq, 0xB), | 551 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_wrq, 0xB), |
552 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_cd_hs, 0xC), | 552 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_cd_hs, 0xC), |
553 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_rq_stall_addr_hazard, 0xD), | 553 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_rq_stall_addr_hazard, 0xD), |
554 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snopp_rq_stall_tt_full, 0xE), | 554 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_rq_stall_tt_full, 0xE), |
555 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_rq_tzmp1_prot, 0xF), | 555 | CCI5xx_GLOBAL_EVENT_EXT_ATTR_ENTRY(cci_snoop_rq_tzmp1_prot, 0xF), |
556 | NULL | 556 | NULL |
557 | }; | 557 | }; |
diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c index 97a9185af433..884c0305e290 100644 --- a/drivers/bus/arm-ccn.c +++ b/drivers/bus/arm-ccn.c | |||
@@ -187,6 +187,7 @@ struct arm_ccn { | |||
187 | struct arm_ccn_component *xp; | 187 | struct arm_ccn_component *xp; |
188 | 188 | ||
189 | struct arm_ccn_dt dt; | 189 | struct arm_ccn_dt dt; |
190 | int mn_id; | ||
190 | }; | 191 | }; |
191 | 192 | ||
192 | static DEFINE_MUTEX(arm_ccn_mutex); | 193 | static DEFINE_MUTEX(arm_ccn_mutex); |
@@ -212,6 +213,7 @@ static int arm_ccn_node_to_xp_port(int node) | |||
212 | #define CCN_CONFIG_TYPE(_config) (((_config) >> 8) & 0xff) | 213 | #define CCN_CONFIG_TYPE(_config) (((_config) >> 8) & 0xff) |
213 | #define CCN_CONFIG_EVENT(_config) (((_config) >> 16) & 0xff) | 214 | #define CCN_CONFIG_EVENT(_config) (((_config) >> 16) & 0xff) |
214 | #define CCN_CONFIG_PORT(_config) (((_config) >> 24) & 0x3) | 215 | #define CCN_CONFIG_PORT(_config) (((_config) >> 24) & 0x3) |
216 | #define CCN_CONFIG_BUS(_config) (((_config) >> 24) & 0x3) | ||
215 | #define CCN_CONFIG_VC(_config) (((_config) >> 26) & 0x7) | 217 | #define CCN_CONFIG_VC(_config) (((_config) >> 26) & 0x7) |
216 | #define CCN_CONFIG_DIR(_config) (((_config) >> 29) & 0x1) | 218 | #define CCN_CONFIG_DIR(_config) (((_config) >> 29) & 0x1) |
217 | #define CCN_CONFIG_MASK(_config) (((_config) >> 30) & 0xf) | 219 | #define CCN_CONFIG_MASK(_config) (((_config) >> 30) & 0xf) |
@@ -241,6 +243,7 @@ static CCN_FORMAT_ATTR(xp, "config:0-7"); | |||
241 | static CCN_FORMAT_ATTR(type, "config:8-15"); | 243 | static CCN_FORMAT_ATTR(type, "config:8-15"); |
242 | static CCN_FORMAT_ATTR(event, "config:16-23"); | 244 | static CCN_FORMAT_ATTR(event, "config:16-23"); |
243 | static CCN_FORMAT_ATTR(port, "config:24-25"); | 245 | static CCN_FORMAT_ATTR(port, "config:24-25"); |
246 | static CCN_FORMAT_ATTR(bus, "config:24-25"); | ||
244 | static CCN_FORMAT_ATTR(vc, "config:26-28"); | 247 | static CCN_FORMAT_ATTR(vc, "config:26-28"); |
245 | static CCN_FORMAT_ATTR(dir, "config:29-29"); | 248 | static CCN_FORMAT_ATTR(dir, "config:29-29"); |
246 | static CCN_FORMAT_ATTR(mask, "config:30-33"); | 249 | static CCN_FORMAT_ATTR(mask, "config:30-33"); |
@@ -253,6 +256,7 @@ static struct attribute *arm_ccn_pmu_format_attrs[] = { | |||
253 | &arm_ccn_pmu_format_attr_type.attr.attr, | 256 | &arm_ccn_pmu_format_attr_type.attr.attr, |
254 | &arm_ccn_pmu_format_attr_event.attr.attr, | 257 | &arm_ccn_pmu_format_attr_event.attr.attr, |
255 | &arm_ccn_pmu_format_attr_port.attr.attr, | 258 | &arm_ccn_pmu_format_attr_port.attr.attr, |
259 | &arm_ccn_pmu_format_attr_bus.attr.attr, | ||
256 | &arm_ccn_pmu_format_attr_vc.attr.attr, | 260 | &arm_ccn_pmu_format_attr_vc.attr.attr, |
257 | &arm_ccn_pmu_format_attr_dir.attr.attr, | 261 | &arm_ccn_pmu_format_attr_dir.attr.attr, |
258 | &arm_ccn_pmu_format_attr_mask.attr.attr, | 262 | &arm_ccn_pmu_format_attr_mask.attr.attr, |
@@ -328,6 +332,7 @@ struct arm_ccn_pmu_event { | |||
328 | static ssize_t arm_ccn_pmu_event_show(struct device *dev, | 332 | static ssize_t arm_ccn_pmu_event_show(struct device *dev, |
329 | struct device_attribute *attr, char *buf) | 333 | struct device_attribute *attr, char *buf) |
330 | { | 334 | { |
335 | struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev)); | ||
331 | struct arm_ccn_pmu_event *event = container_of(attr, | 336 | struct arm_ccn_pmu_event *event = container_of(attr, |
332 | struct arm_ccn_pmu_event, attr); | 337 | struct arm_ccn_pmu_event, attr); |
333 | ssize_t res; | 338 | ssize_t res; |
@@ -349,10 +354,17 @@ static ssize_t arm_ccn_pmu_event_show(struct device *dev, | |||
349 | break; | 354 | break; |
350 | case CCN_TYPE_XP: | 355 | case CCN_TYPE_XP: |
351 | res += snprintf(buf + res, PAGE_SIZE - res, | 356 | res += snprintf(buf + res, PAGE_SIZE - res, |
352 | ",xp=?,port=?,vc=?,dir=?"); | 357 | ",xp=?,vc=?"); |
353 | if (event->event == CCN_EVENT_WATCHPOINT) | 358 | if (event->event == CCN_EVENT_WATCHPOINT) |
354 | res += snprintf(buf + res, PAGE_SIZE - res, | 359 | res += snprintf(buf + res, PAGE_SIZE - res, |
355 | ",cmp_l=?,cmp_h=?,mask=?"); | 360 | ",port=?,dir=?,cmp_l=?,cmp_h=?,mask=?"); |
361 | else | ||
362 | res += snprintf(buf + res, PAGE_SIZE - res, | ||
363 | ",bus=?"); | ||
364 | |||
365 | break; | ||
366 | case CCN_TYPE_MN: | ||
367 | res += snprintf(buf + res, PAGE_SIZE - res, ",node=%d", ccn->mn_id); | ||
356 | break; | 368 | break; |
357 | default: | 369 | default: |
358 | res += snprintf(buf + res, PAGE_SIZE - res, ",node=?"); | 370 | res += snprintf(buf + res, PAGE_SIZE - res, ",node=?"); |
@@ -383,9 +395,9 @@ static umode_t arm_ccn_pmu_events_is_visible(struct kobject *kobj, | |||
383 | } | 395 | } |
384 | 396 | ||
385 | static struct arm_ccn_pmu_event arm_ccn_pmu_events[] = { | 397 | static struct arm_ccn_pmu_event arm_ccn_pmu_events[] = { |
386 | CCN_EVENT_MN(eobarrier, "dir=0,vc=0,cmp_h=0x1c00", CCN_IDX_MASK_OPCODE), | 398 | CCN_EVENT_MN(eobarrier, "dir=1,vc=0,cmp_h=0x1c00", CCN_IDX_MASK_OPCODE), |
387 | CCN_EVENT_MN(ecbarrier, "dir=0,vc=0,cmp_h=0x1e00", CCN_IDX_MASK_OPCODE), | 399 | CCN_EVENT_MN(ecbarrier, "dir=1,vc=0,cmp_h=0x1e00", CCN_IDX_MASK_OPCODE), |
388 | CCN_EVENT_MN(dvmop, "dir=0,vc=0,cmp_h=0x2800", CCN_IDX_MASK_OPCODE), | 400 | CCN_EVENT_MN(dvmop, "dir=1,vc=0,cmp_h=0x2800", CCN_IDX_MASK_OPCODE), |
389 | CCN_EVENT_HNI(txdatflits, "dir=1,vc=3", CCN_IDX_MASK_ANY), | 401 | CCN_EVENT_HNI(txdatflits, "dir=1,vc=3", CCN_IDX_MASK_ANY), |
390 | CCN_EVENT_HNI(rxdatflits, "dir=0,vc=3", CCN_IDX_MASK_ANY), | 402 | CCN_EVENT_HNI(rxdatflits, "dir=0,vc=3", CCN_IDX_MASK_ANY), |
391 | CCN_EVENT_HNI(txreqflits, "dir=1,vc=0", CCN_IDX_MASK_ANY), | 403 | CCN_EVENT_HNI(txreqflits, "dir=1,vc=0", CCN_IDX_MASK_ANY), |
@@ -733,9 +745,10 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) | |||
733 | 745 | ||
734 | if (has_branch_stack(event) || event->attr.exclude_user || | 746 | if (has_branch_stack(event) || event->attr.exclude_user || |
735 | event->attr.exclude_kernel || event->attr.exclude_hv || | 747 | event->attr.exclude_kernel || event->attr.exclude_hv || |
736 | event->attr.exclude_idle) { | 748 | event->attr.exclude_idle || event->attr.exclude_host || |
749 | event->attr.exclude_guest) { | ||
737 | dev_warn(ccn->dev, "Can't exclude execution levels!\n"); | 750 | dev_warn(ccn->dev, "Can't exclude execution levels!\n"); |
738 | return -EOPNOTSUPP; | 751 | return -EINVAL; |
739 | } | 752 | } |
740 | 753 | ||
741 | if (event->cpu < 0) { | 754 | if (event->cpu < 0) { |
@@ -759,6 +772,12 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) | |||
759 | 772 | ||
760 | /* Validate node/xp vs topology */ | 773 | /* Validate node/xp vs topology */ |
761 | switch (type) { | 774 | switch (type) { |
775 | case CCN_TYPE_MN: | ||
776 | if (node_xp != ccn->mn_id) { | ||
777 | dev_warn(ccn->dev, "Invalid MN ID %d!\n", node_xp); | ||
778 | return -EINVAL; | ||
779 | } | ||
780 | break; | ||
762 | case CCN_TYPE_XP: | 781 | case CCN_TYPE_XP: |
763 | if (node_xp >= ccn->num_xps) { | 782 | if (node_xp >= ccn->num_xps) { |
764 | dev_warn(ccn->dev, "Invalid XP ID %d!\n", node_xp); | 783 | dev_warn(ccn->dev, "Invalid XP ID %d!\n", node_xp); |
@@ -886,6 +905,10 @@ static void arm_ccn_pmu_xp_dt_config(struct perf_event *event, int enable) | |||
886 | struct arm_ccn_component *xp; | 905 | struct arm_ccn_component *xp; |
887 | u32 val, dt_cfg; | 906 | u32 val, dt_cfg; |
888 | 907 | ||
908 | /* Nothing to do for cycle counter */ | ||
909 | if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER) | ||
910 | return; | ||
911 | |||
889 | if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP) | 912 | if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP) |
890 | xp = &ccn->xp[CCN_CONFIG_XP(event->attr.config)]; | 913 | xp = &ccn->xp[CCN_CONFIG_XP(event->attr.config)]; |
891 | else | 914 | else |
@@ -917,38 +940,17 @@ static void arm_ccn_pmu_event_start(struct perf_event *event, int flags) | |||
917 | arm_ccn_pmu_read_counter(ccn, hw->idx)); | 940 | arm_ccn_pmu_read_counter(ccn, hw->idx)); |
918 | hw->state = 0; | 941 | hw->state = 0; |
919 | 942 | ||
920 | /* | ||
921 | * Pin the timer, so that the overflows are handled by the chosen | ||
922 | * event->cpu (this is the same one as presented in "cpumask" | ||
923 | * attribute). | ||
924 | */ | ||
925 | if (!ccn->irq) | ||
926 | hrtimer_start(&ccn->dt.hrtimer, arm_ccn_pmu_timer_period(), | ||
927 | HRTIMER_MODE_REL_PINNED); | ||
928 | |||
929 | /* Set the DT bus input, engaging the counter */ | 943 | /* Set the DT bus input, engaging the counter */ |
930 | arm_ccn_pmu_xp_dt_config(event, 1); | 944 | arm_ccn_pmu_xp_dt_config(event, 1); |
931 | } | 945 | } |
932 | 946 | ||
933 | static void arm_ccn_pmu_event_stop(struct perf_event *event, int flags) | 947 | static void arm_ccn_pmu_event_stop(struct perf_event *event, int flags) |
934 | { | 948 | { |
935 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
936 | struct hw_perf_event *hw = &event->hw; | 949 | struct hw_perf_event *hw = &event->hw; |
937 | u64 timeout; | ||
938 | 950 | ||
939 | /* Disable counting, setting the DT bus to pass-through mode */ | 951 | /* Disable counting, setting the DT bus to pass-through mode */ |
940 | arm_ccn_pmu_xp_dt_config(event, 0); | 952 | arm_ccn_pmu_xp_dt_config(event, 0); |
941 | 953 | ||
942 | if (!ccn->irq) | ||
943 | hrtimer_cancel(&ccn->dt.hrtimer); | ||
944 | |||
945 | /* Let the DT bus drain */ | ||
946 | timeout = arm_ccn_pmu_read_counter(ccn, CCN_IDX_PMU_CYCLE_COUNTER) + | ||
947 | ccn->num_xps; | ||
948 | while (arm_ccn_pmu_read_counter(ccn, CCN_IDX_PMU_CYCLE_COUNTER) < | ||
949 | timeout) | ||
950 | cpu_relax(); | ||
951 | |||
952 | if (flags & PERF_EF_UPDATE) | 954 | if (flags & PERF_EF_UPDATE) |
953 | arm_ccn_pmu_event_update(event); | 955 | arm_ccn_pmu_event_update(event); |
954 | 956 | ||
@@ -988,7 +990,7 @@ static void arm_ccn_pmu_xp_watchpoint_config(struct perf_event *event) | |||
988 | 990 | ||
989 | /* Comparison values */ | 991 | /* Comparison values */ |
990 | writel(cmp_l & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_L(wp)); | 992 | writel(cmp_l & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_L(wp)); |
991 | writel((cmp_l >> 32) & 0xefffffff, | 993 | writel((cmp_l >> 32) & 0x7fffffff, |
992 | source->base + CCN_XP_DT_CMP_VAL_L(wp) + 4); | 994 | source->base + CCN_XP_DT_CMP_VAL_L(wp) + 4); |
993 | writel(cmp_h & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_H(wp)); | 995 | writel(cmp_h & 0xffffffff, source->base + CCN_XP_DT_CMP_VAL_H(wp)); |
994 | writel((cmp_h >> 32) & 0x0fffffff, | 996 | writel((cmp_h >> 32) & 0x0fffffff, |
@@ -996,7 +998,7 @@ static void arm_ccn_pmu_xp_watchpoint_config(struct perf_event *event) | |||
996 | 998 | ||
997 | /* Mask */ | 999 | /* Mask */ |
998 | writel(mask_l & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_L(wp)); | 1000 | writel(mask_l & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_L(wp)); |
999 | writel((mask_l >> 32) & 0xefffffff, | 1001 | writel((mask_l >> 32) & 0x7fffffff, |
1000 | source->base + CCN_XP_DT_CMP_MASK_L(wp) + 4); | 1002 | source->base + CCN_XP_DT_CMP_MASK_L(wp) + 4); |
1001 | writel(mask_h & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_H(wp)); | 1003 | writel(mask_h & 0xffffffff, source->base + CCN_XP_DT_CMP_MASK_H(wp)); |
1002 | writel((mask_h >> 32) & 0x0fffffff, | 1004 | writel((mask_h >> 32) & 0x0fffffff, |
@@ -1014,7 +1016,7 @@ static void arm_ccn_pmu_xp_event_config(struct perf_event *event) | |||
1014 | hw->event_base = CCN_XP_DT_CONFIG__DT_CFG__XP_PMU_EVENT(hw->config_base); | 1016 | hw->event_base = CCN_XP_DT_CONFIG__DT_CFG__XP_PMU_EVENT(hw->config_base); |
1015 | 1017 | ||
1016 | id = (CCN_CONFIG_VC(event->attr.config) << 4) | | 1018 | id = (CCN_CONFIG_VC(event->attr.config) << 4) | |
1017 | (CCN_CONFIG_PORT(event->attr.config) << 3) | | 1019 | (CCN_CONFIG_BUS(event->attr.config) << 3) | |
1018 | (CCN_CONFIG_EVENT(event->attr.config) << 0); | 1020 | (CCN_CONFIG_EVENT(event->attr.config) << 0); |
1019 | 1021 | ||
1020 | val = readl(source->base + CCN_XP_PMU_EVENT_SEL); | 1022 | val = readl(source->base + CCN_XP_PMU_EVENT_SEL); |
@@ -1099,15 +1101,31 @@ static void arm_ccn_pmu_event_config(struct perf_event *event) | |||
1099 | spin_unlock(&ccn->dt.config_lock); | 1101 | spin_unlock(&ccn->dt.config_lock); |
1100 | } | 1102 | } |
1101 | 1103 | ||
1104 | static int arm_ccn_pmu_active_counters(struct arm_ccn *ccn) | ||
1105 | { | ||
1106 | return bitmap_weight(ccn->dt.pmu_counters_mask, | ||
1107 | CCN_NUM_PMU_EVENT_COUNTERS + 1); | ||
1108 | } | ||
1109 | |||
1102 | static int arm_ccn_pmu_event_add(struct perf_event *event, int flags) | 1110 | static int arm_ccn_pmu_event_add(struct perf_event *event, int flags) |
1103 | { | 1111 | { |
1104 | int err; | 1112 | int err; |
1105 | struct hw_perf_event *hw = &event->hw; | 1113 | struct hw_perf_event *hw = &event->hw; |
1114 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
1106 | 1115 | ||
1107 | err = arm_ccn_pmu_event_alloc(event); | 1116 | err = arm_ccn_pmu_event_alloc(event); |
1108 | if (err) | 1117 | if (err) |
1109 | return err; | 1118 | return err; |
1110 | 1119 | ||
1120 | /* | ||
1121 | * Pin the timer, so that the overflows are handled by the chosen | ||
1122 | * event->cpu (this is the same one as presented in "cpumask" | ||
1123 | * attribute). | ||
1124 | */ | ||
1125 | if (!ccn->irq && arm_ccn_pmu_active_counters(ccn) == 1) | ||
1126 | hrtimer_start(&ccn->dt.hrtimer, arm_ccn_pmu_timer_period(), | ||
1127 | HRTIMER_MODE_REL_PINNED); | ||
1128 | |||
1111 | arm_ccn_pmu_event_config(event); | 1129 | arm_ccn_pmu_event_config(event); |
1112 | 1130 | ||
1113 | hw->state = PERF_HES_STOPPED; | 1131 | hw->state = PERF_HES_STOPPED; |
@@ -1120,9 +1138,14 @@ static int arm_ccn_pmu_event_add(struct perf_event *event, int flags) | |||
1120 | 1138 | ||
1121 | static void arm_ccn_pmu_event_del(struct perf_event *event, int flags) | 1139 | static void arm_ccn_pmu_event_del(struct perf_event *event, int flags) |
1122 | { | 1140 | { |
1141 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
1142 | |||
1123 | arm_ccn_pmu_event_stop(event, PERF_EF_UPDATE); | 1143 | arm_ccn_pmu_event_stop(event, PERF_EF_UPDATE); |
1124 | 1144 | ||
1125 | arm_ccn_pmu_event_release(event); | 1145 | arm_ccn_pmu_event_release(event); |
1146 | |||
1147 | if (!ccn->irq && arm_ccn_pmu_active_counters(ccn) == 0) | ||
1148 | hrtimer_cancel(&ccn->dt.hrtimer); | ||
1126 | } | 1149 | } |
1127 | 1150 | ||
1128 | static void arm_ccn_pmu_event_read(struct perf_event *event) | 1151 | static void arm_ccn_pmu_event_read(struct perf_event *event) |
@@ -1130,6 +1153,24 @@ static void arm_ccn_pmu_event_read(struct perf_event *event) | |||
1130 | arm_ccn_pmu_event_update(event); | 1153 | arm_ccn_pmu_event_update(event); |
1131 | } | 1154 | } |
1132 | 1155 | ||
1156 | static void arm_ccn_pmu_enable(struct pmu *pmu) | ||
1157 | { | ||
1158 | struct arm_ccn *ccn = pmu_to_arm_ccn(pmu); | ||
1159 | |||
1160 | u32 val = readl(ccn->dt.base + CCN_DT_PMCR); | ||
1161 | val |= CCN_DT_PMCR__PMU_EN; | ||
1162 | writel(val, ccn->dt.base + CCN_DT_PMCR); | ||
1163 | } | ||
1164 | |||
1165 | static void arm_ccn_pmu_disable(struct pmu *pmu) | ||
1166 | { | ||
1167 | struct arm_ccn *ccn = pmu_to_arm_ccn(pmu); | ||
1168 | |||
1169 | u32 val = readl(ccn->dt.base + CCN_DT_PMCR); | ||
1170 | val &= ~CCN_DT_PMCR__PMU_EN; | ||
1171 | writel(val, ccn->dt.base + CCN_DT_PMCR); | ||
1172 | } | ||
1173 | |||
1133 | static irqreturn_t arm_ccn_pmu_overflow_handler(struct arm_ccn_dt *dt) | 1174 | static irqreturn_t arm_ccn_pmu_overflow_handler(struct arm_ccn_dt *dt) |
1134 | { | 1175 | { |
1135 | u32 pmovsr = readl(dt->base + CCN_DT_PMOVSR); | 1176 | u32 pmovsr = readl(dt->base + CCN_DT_PMOVSR); |
@@ -1252,6 +1293,8 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) | |||
1252 | .start = arm_ccn_pmu_event_start, | 1293 | .start = arm_ccn_pmu_event_start, |
1253 | .stop = arm_ccn_pmu_event_stop, | 1294 | .stop = arm_ccn_pmu_event_stop, |
1254 | .read = arm_ccn_pmu_event_read, | 1295 | .read = arm_ccn_pmu_event_read, |
1296 | .pmu_enable = arm_ccn_pmu_enable, | ||
1297 | .pmu_disable = arm_ccn_pmu_disable, | ||
1255 | }; | 1298 | }; |
1256 | 1299 | ||
1257 | /* No overflow interrupt? Have to use a timer instead. */ | 1300 | /* No overflow interrupt? Have to use a timer instead. */ |
@@ -1361,6 +1404,8 @@ static int arm_ccn_init_nodes(struct arm_ccn *ccn, int region, | |||
1361 | 1404 | ||
1362 | switch (type) { | 1405 | switch (type) { |
1363 | case CCN_TYPE_MN: | 1406 | case CCN_TYPE_MN: |
1407 | ccn->mn_id = id; | ||
1408 | return 0; | ||
1364 | case CCN_TYPE_DT: | 1409 | case CCN_TYPE_DT: |
1365 | return 0; | 1410 | return 0; |
1366 | case CCN_TYPE_XP: | 1411 | case CCN_TYPE_XP: |
@@ -1471,8 +1516,9 @@ static int arm_ccn_probe(struct platform_device *pdev) | |||
1471 | /* Can set 'disable' bits, so can acknowledge interrupts */ | 1516 | /* Can set 'disable' bits, so can acknowledge interrupts */ |
1472 | writel(CCN_MN_ERRINT_STATUS__PMU_EVENTS__ENABLE, | 1517 | writel(CCN_MN_ERRINT_STATUS__PMU_EVENTS__ENABLE, |
1473 | ccn->base + CCN_MN_ERRINT_STATUS); | 1518 | ccn->base + CCN_MN_ERRINT_STATUS); |
1474 | err = devm_request_irq(ccn->dev, irq, arm_ccn_irq_handler, 0, | 1519 | err = devm_request_irq(ccn->dev, irq, arm_ccn_irq_handler, |
1475 | dev_name(ccn->dev), ccn); | 1520 | IRQF_NOBALANCING | IRQF_NO_THREAD, |
1521 | dev_name(ccn->dev), ccn); | ||
1476 | if (err) | 1522 | if (err) |
1477 | return err; | 1523 | return err; |
1478 | 1524 | ||
diff --git a/drivers/bus/vexpress-config.c b/drivers/bus/vexpress-config.c index c3cb76b363c6..9efdf1de4035 100644 --- a/drivers/bus/vexpress-config.c +++ b/drivers/bus/vexpress-config.c | |||
@@ -178,6 +178,7 @@ static int vexpress_config_populate(struct device_node *node) | |||
178 | 178 | ||
179 | parent = class_find_device(vexpress_config_class, NULL, bridge, | 179 | parent = class_find_device(vexpress_config_class, NULL, bridge, |
180 | vexpress_config_node_match); | 180 | vexpress_config_node_match); |
181 | of_node_put(bridge); | ||
181 | if (WARN_ON(!parent)) | 182 | if (WARN_ON(!parent)) |
182 | return -ENODEV; | 183 | return -ENODEV; |
183 | 184 | ||
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index d2406fe25533..5da47e26a012 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -165,6 +165,12 @@ struct ports_device { | |||
165 | */ | 165 | */ |
166 | struct virtqueue *c_ivq, *c_ovq; | 166 | struct virtqueue *c_ivq, *c_ovq; |
167 | 167 | ||
168 | /* | ||
169 | * A control packet buffer for guest->host requests, protected | ||
170 | * by c_ovq_lock. | ||
171 | */ | ||
172 | struct virtio_console_control cpkt; | ||
173 | |||
168 | /* Array of per-port IO virtqueues */ | 174 | /* Array of per-port IO virtqueues */ |
169 | struct virtqueue **in_vqs, **out_vqs; | 175 | struct virtqueue **in_vqs, **out_vqs; |
170 | 176 | ||
@@ -560,28 +566,29 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, | |||
560 | unsigned int event, unsigned int value) | 566 | unsigned int event, unsigned int value) |
561 | { | 567 | { |
562 | struct scatterlist sg[1]; | 568 | struct scatterlist sg[1]; |
563 | struct virtio_console_control cpkt; | ||
564 | struct virtqueue *vq; | 569 | struct virtqueue *vq; |
565 | unsigned int len; | 570 | unsigned int len; |
566 | 571 | ||
567 | if (!use_multiport(portdev)) | 572 | if (!use_multiport(portdev)) |
568 | return 0; | 573 | return 0; |
569 | 574 | ||
570 | cpkt.id = cpu_to_virtio32(portdev->vdev, port_id); | ||
571 | cpkt.event = cpu_to_virtio16(portdev->vdev, event); | ||
572 | cpkt.value = cpu_to_virtio16(portdev->vdev, value); | ||
573 | |||
574 | vq = portdev->c_ovq; | 575 | vq = portdev->c_ovq; |
575 | 576 | ||
576 | sg_init_one(sg, &cpkt, sizeof(cpkt)); | ||
577 | |||
578 | spin_lock(&portdev->c_ovq_lock); | 577 | spin_lock(&portdev->c_ovq_lock); |
579 | if (virtqueue_add_outbuf(vq, sg, 1, &cpkt, GFP_ATOMIC) == 0) { | 578 | |
579 | portdev->cpkt.id = cpu_to_virtio32(portdev->vdev, port_id); | ||
580 | portdev->cpkt.event = cpu_to_virtio16(portdev->vdev, event); | ||
581 | portdev->cpkt.value = cpu_to_virtio16(portdev->vdev, value); | ||
582 | |||
583 | sg_init_one(sg, &portdev->cpkt, sizeof(struct virtio_console_control)); | ||
584 | |||
585 | if (virtqueue_add_outbuf(vq, sg, 1, &portdev->cpkt, GFP_ATOMIC) == 0) { | ||
580 | virtqueue_kick(vq); | 586 | virtqueue_kick(vq); |
581 | while (!virtqueue_get_buf(vq, &len) | 587 | while (!virtqueue_get_buf(vq, &len) |
582 | && !virtqueue_is_broken(vq)) | 588 | && !virtqueue_is_broken(vq)) |
583 | cpu_relax(); | 589 | cpu_relax(); |
584 | } | 590 | } |
591 | |||
585 | spin_unlock(&portdev->c_ovq_lock); | 592 | spin_unlock(&portdev->c_ovq_lock); |
586 | return 0; | 593 | return 0; |
587 | } | 594 | } |
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c index 9af359544110..267f99523fbe 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c | |||
@@ -783,14 +783,14 @@ static struct ccu_reset_map sun8i_h3_ccu_resets[] = { | |||
783 | [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, | 783 | [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, |
784 | [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, | 784 | [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, |
785 | 785 | ||
786 | [RST_BUS_I2C0] = { 0x2d4, BIT(0) }, | 786 | [RST_BUS_I2C0] = { 0x2d8, BIT(0) }, |
787 | [RST_BUS_I2C1] = { 0x2d4, BIT(1) }, | 787 | [RST_BUS_I2C1] = { 0x2d8, BIT(1) }, |
788 | [RST_BUS_I2C2] = { 0x2d4, BIT(2) }, | 788 | [RST_BUS_I2C2] = { 0x2d8, BIT(2) }, |
789 | [RST_BUS_UART0] = { 0x2d4, BIT(16) }, | 789 | [RST_BUS_UART0] = { 0x2d8, BIT(16) }, |
790 | [RST_BUS_UART1] = { 0x2d4, BIT(17) }, | 790 | [RST_BUS_UART1] = { 0x2d8, BIT(17) }, |
791 | [RST_BUS_UART2] = { 0x2d4, BIT(18) }, | 791 | [RST_BUS_UART2] = { 0x2d8, BIT(18) }, |
792 | [RST_BUS_UART3] = { 0x2d4, BIT(19) }, | 792 | [RST_BUS_UART3] = { 0x2d8, BIT(19) }, |
793 | [RST_BUS_SCR] = { 0x2d4, BIT(20) }, | 793 | [RST_BUS_SCR] = { 0x2d8, BIT(20) }, |
794 | }; | 794 | }; |
795 | 795 | ||
796 | static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = { | 796 | static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = { |
diff --git a/drivers/clk/sunxi-ng/ccu_nk.c b/drivers/clk/sunxi-ng/ccu_nk.c index 4470ffc8cf0d..d6fafb397489 100644 --- a/drivers/clk/sunxi-ng/ccu_nk.c +++ b/drivers/clk/sunxi-ng/ccu_nk.c | |||
@@ -14,9 +14,9 @@ | |||
14 | #include "ccu_gate.h" | 14 | #include "ccu_gate.h" |
15 | #include "ccu_nk.h" | 15 | #include "ccu_nk.h" |
16 | 16 | ||
17 | void ccu_nk_find_best(unsigned long parent, unsigned long rate, | 17 | static void ccu_nk_find_best(unsigned long parent, unsigned long rate, |
18 | unsigned int max_n, unsigned int max_k, | 18 | unsigned int max_n, unsigned int max_k, |
19 | unsigned int *n, unsigned int *k) | 19 | unsigned int *n, unsigned int *k) |
20 | { | 20 | { |
21 | unsigned long best_rate = 0; | 21 | unsigned long best_rate = 0; |
22 | unsigned int best_k = 0, best_n = 0; | 22 | unsigned int best_k = 0, best_n = 0; |
diff --git a/drivers/clk/sunxi/clk-a10-pll2.c b/drivers/clk/sunxi/clk-a10-pll2.c index 0ee1f363e4be..d8eab90ae661 100644 --- a/drivers/clk/sunxi/clk-a10-pll2.c +++ b/drivers/clk/sunxi/clk-a10-pll2.c | |||
@@ -73,7 +73,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, | |||
73 | SUN4I_PLL2_PRE_DIV_WIDTH, | 73 | SUN4I_PLL2_PRE_DIV_WIDTH, |
74 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, | 74 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, |
75 | &sun4i_a10_pll2_lock); | 75 | &sun4i_a10_pll2_lock); |
76 | if (!prediv_clk) { | 76 | if (IS_ERR(prediv_clk)) { |
77 | pr_err("Couldn't register the prediv clock\n"); | 77 | pr_err("Couldn't register the prediv clock\n"); |
78 | goto err_free_array; | 78 | goto err_free_array; |
79 | } | 79 | } |
@@ -106,7 +106,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, | |||
106 | &mult->hw, &clk_multiplier_ops, | 106 | &mult->hw, &clk_multiplier_ops, |
107 | &gate->hw, &clk_gate_ops, | 107 | &gate->hw, &clk_gate_ops, |
108 | CLK_SET_RATE_PARENT); | 108 | CLK_SET_RATE_PARENT); |
109 | if (!base_clk) { | 109 | if (IS_ERR(base_clk)) { |
110 | pr_err("Couldn't register the base multiplier clock\n"); | 110 | pr_err("Couldn't register the base multiplier clock\n"); |
111 | goto err_free_multiplier; | 111 | goto err_free_multiplier; |
112 | } | 112 | } |
diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c index 411d3033a96e..b200ebf159ee 100644 --- a/drivers/clk/sunxi/clk-sun8i-mbus.c +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c | |||
@@ -48,7 +48,7 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) | |||
48 | return; | 48 | return; |
49 | 49 | ||
50 | reg = of_io_request_and_map(node, 0, of_node_full_name(node)); | 50 | reg = of_io_request_and_map(node, 0, of_node_full_name(node)); |
51 | if (!reg) { | 51 | if (IS_ERR(reg)) { |
52 | pr_err("Could not get registers for sun8i-mbus-clk\n"); | 52 | pr_err("Could not get registers for sun8i-mbus-clk\n"); |
53 | goto err_free_parents; | 53 | goto err_free_parents; |
54 | } | 54 | } |
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 6dc597126b79..b3044219772c 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
@@ -556,7 +556,10 @@ skip_enc: | |||
556 | 556 | ||
557 | /* Read and write assoclen bytes */ | 557 | /* Read and write assoclen bytes */ |
558 | append_math_add(desc, VARSEQINLEN, ZERO, REG3, CAAM_CMD_SZ); | 558 | append_math_add(desc, VARSEQINLEN, ZERO, REG3, CAAM_CMD_SZ); |
559 | append_math_add(desc, VARSEQOUTLEN, ZERO, REG3, CAAM_CMD_SZ); | 559 | if (alg->caam.geniv) |
560 | append_math_add_imm_u32(desc, VARSEQOUTLEN, REG3, IMM, ivsize); | ||
561 | else | ||
562 | append_math_add(desc, VARSEQOUTLEN, ZERO, REG3, CAAM_CMD_SZ); | ||
560 | 563 | ||
561 | /* Skip assoc data */ | 564 | /* Skip assoc data */ |
562 | append_seq_fifo_store(desc, 0, FIFOST_TYPE_SKIP | FIFOLDST_VLF); | 565 | append_seq_fifo_store(desc, 0, FIFOST_TYPE_SKIP | FIFOLDST_VLF); |
@@ -565,6 +568,14 @@ skip_enc: | |||
565 | append_seq_fifo_load(desc, 0, FIFOLD_CLASS_CLASS2 | FIFOLD_TYPE_MSG | | 568 | append_seq_fifo_load(desc, 0, FIFOLD_CLASS_CLASS2 | FIFOLD_TYPE_MSG | |
566 | KEY_VLF); | 569 | KEY_VLF); |
567 | 570 | ||
571 | if (alg->caam.geniv) { | ||
572 | append_seq_load(desc, ivsize, LDST_CLASS_1_CCB | | ||
573 | LDST_SRCDST_BYTE_CONTEXT | | ||
574 | (ctx1_iv_off << LDST_OFFSET_SHIFT)); | ||
575 | append_move(desc, MOVE_SRC_CLASS1CTX | MOVE_DEST_CLASS2INFIFO | | ||
576 | (ctx1_iv_off << MOVE_OFFSET_SHIFT) | ivsize); | ||
577 | } | ||
578 | |||
568 | /* Load Counter into CONTEXT1 reg */ | 579 | /* Load Counter into CONTEXT1 reg */ |
569 | if (is_rfc3686) | 580 | if (is_rfc3686) |
570 | append_load_imm_u32(desc, be32_to_cpu(1), LDST_IMM | | 581 | append_load_imm_u32(desc, be32_to_cpu(1), LDST_IMM | |
@@ -2150,7 +2161,7 @@ static void init_authenc_job(struct aead_request *req, | |||
2150 | 2161 | ||
2151 | init_aead_job(req, edesc, all_contig, encrypt); | 2162 | init_aead_job(req, edesc, all_contig, encrypt); |
2152 | 2163 | ||
2153 | if (ivsize && (is_rfc3686 || !(alg->caam.geniv && encrypt))) | 2164 | if (ivsize && ((is_rfc3686 && encrypt) || !alg->caam.geniv)) |
2154 | append_load_as_imm(desc, req->iv, ivsize, | 2165 | append_load_as_imm(desc, req->iv, ivsize, |
2155 | LDST_CLASS_1_CCB | | 2166 | LDST_CLASS_1_CCB | |
2156 | LDST_SRCDST_BYTE_CONTEXT | | 2167 | LDST_SRCDST_BYTE_CONTEXT | |
@@ -2537,20 +2548,6 @@ static int aead_decrypt(struct aead_request *req) | |||
2537 | return ret; | 2548 | return ret; |
2538 | } | 2549 | } |
2539 | 2550 | ||
2540 | static int aead_givdecrypt(struct aead_request *req) | ||
2541 | { | ||
2542 | struct crypto_aead *aead = crypto_aead_reqtfm(req); | ||
2543 | unsigned int ivsize = crypto_aead_ivsize(aead); | ||
2544 | |||
2545 | if (req->cryptlen < ivsize) | ||
2546 | return -EINVAL; | ||
2547 | |||
2548 | req->cryptlen -= ivsize; | ||
2549 | req->assoclen += ivsize; | ||
2550 | |||
2551 | return aead_decrypt(req); | ||
2552 | } | ||
2553 | |||
2554 | /* | 2551 | /* |
2555 | * allocate and map the ablkcipher extended descriptor for ablkcipher | 2552 | * allocate and map the ablkcipher extended descriptor for ablkcipher |
2556 | */ | 2553 | */ |
@@ -3210,7 +3207,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3210 | .setkey = aead_setkey, | 3207 | .setkey = aead_setkey, |
3211 | .setauthsize = aead_setauthsize, | 3208 | .setauthsize = aead_setauthsize, |
3212 | .encrypt = aead_encrypt, | 3209 | .encrypt = aead_encrypt, |
3213 | .decrypt = aead_givdecrypt, | 3210 | .decrypt = aead_decrypt, |
3214 | .ivsize = AES_BLOCK_SIZE, | 3211 | .ivsize = AES_BLOCK_SIZE, |
3215 | .maxauthsize = MD5_DIGEST_SIZE, | 3212 | .maxauthsize = MD5_DIGEST_SIZE, |
3216 | }, | 3213 | }, |
@@ -3256,7 +3253,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3256 | .setkey = aead_setkey, | 3253 | .setkey = aead_setkey, |
3257 | .setauthsize = aead_setauthsize, | 3254 | .setauthsize = aead_setauthsize, |
3258 | .encrypt = aead_encrypt, | 3255 | .encrypt = aead_encrypt, |
3259 | .decrypt = aead_givdecrypt, | 3256 | .decrypt = aead_decrypt, |
3260 | .ivsize = AES_BLOCK_SIZE, | 3257 | .ivsize = AES_BLOCK_SIZE, |
3261 | .maxauthsize = SHA1_DIGEST_SIZE, | 3258 | .maxauthsize = SHA1_DIGEST_SIZE, |
3262 | }, | 3259 | }, |
@@ -3302,7 +3299,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3302 | .setkey = aead_setkey, | 3299 | .setkey = aead_setkey, |
3303 | .setauthsize = aead_setauthsize, | 3300 | .setauthsize = aead_setauthsize, |
3304 | .encrypt = aead_encrypt, | 3301 | .encrypt = aead_encrypt, |
3305 | .decrypt = aead_givdecrypt, | 3302 | .decrypt = aead_decrypt, |
3306 | .ivsize = AES_BLOCK_SIZE, | 3303 | .ivsize = AES_BLOCK_SIZE, |
3307 | .maxauthsize = SHA224_DIGEST_SIZE, | 3304 | .maxauthsize = SHA224_DIGEST_SIZE, |
3308 | }, | 3305 | }, |
@@ -3348,7 +3345,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3348 | .setkey = aead_setkey, | 3345 | .setkey = aead_setkey, |
3349 | .setauthsize = aead_setauthsize, | 3346 | .setauthsize = aead_setauthsize, |
3350 | .encrypt = aead_encrypt, | 3347 | .encrypt = aead_encrypt, |
3351 | .decrypt = aead_givdecrypt, | 3348 | .decrypt = aead_decrypt, |
3352 | .ivsize = AES_BLOCK_SIZE, | 3349 | .ivsize = AES_BLOCK_SIZE, |
3353 | .maxauthsize = SHA256_DIGEST_SIZE, | 3350 | .maxauthsize = SHA256_DIGEST_SIZE, |
3354 | }, | 3351 | }, |
@@ -3394,7 +3391,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3394 | .setkey = aead_setkey, | 3391 | .setkey = aead_setkey, |
3395 | .setauthsize = aead_setauthsize, | 3392 | .setauthsize = aead_setauthsize, |
3396 | .encrypt = aead_encrypt, | 3393 | .encrypt = aead_encrypt, |
3397 | .decrypt = aead_givdecrypt, | 3394 | .decrypt = aead_decrypt, |
3398 | .ivsize = AES_BLOCK_SIZE, | 3395 | .ivsize = AES_BLOCK_SIZE, |
3399 | .maxauthsize = SHA384_DIGEST_SIZE, | 3396 | .maxauthsize = SHA384_DIGEST_SIZE, |
3400 | }, | 3397 | }, |
@@ -3440,7 +3437,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3440 | .setkey = aead_setkey, | 3437 | .setkey = aead_setkey, |
3441 | .setauthsize = aead_setauthsize, | 3438 | .setauthsize = aead_setauthsize, |
3442 | .encrypt = aead_encrypt, | 3439 | .encrypt = aead_encrypt, |
3443 | .decrypt = aead_givdecrypt, | 3440 | .decrypt = aead_decrypt, |
3444 | .ivsize = AES_BLOCK_SIZE, | 3441 | .ivsize = AES_BLOCK_SIZE, |
3445 | .maxauthsize = SHA512_DIGEST_SIZE, | 3442 | .maxauthsize = SHA512_DIGEST_SIZE, |
3446 | }, | 3443 | }, |
@@ -3486,7 +3483,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3486 | .setkey = aead_setkey, | 3483 | .setkey = aead_setkey, |
3487 | .setauthsize = aead_setauthsize, | 3484 | .setauthsize = aead_setauthsize, |
3488 | .encrypt = aead_encrypt, | 3485 | .encrypt = aead_encrypt, |
3489 | .decrypt = aead_givdecrypt, | 3486 | .decrypt = aead_decrypt, |
3490 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3487 | .ivsize = DES3_EDE_BLOCK_SIZE, |
3491 | .maxauthsize = MD5_DIGEST_SIZE, | 3488 | .maxauthsize = MD5_DIGEST_SIZE, |
3492 | }, | 3489 | }, |
@@ -3534,7 +3531,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3534 | .setkey = aead_setkey, | 3531 | .setkey = aead_setkey, |
3535 | .setauthsize = aead_setauthsize, | 3532 | .setauthsize = aead_setauthsize, |
3536 | .encrypt = aead_encrypt, | 3533 | .encrypt = aead_encrypt, |
3537 | .decrypt = aead_givdecrypt, | 3534 | .decrypt = aead_decrypt, |
3538 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3535 | .ivsize = DES3_EDE_BLOCK_SIZE, |
3539 | .maxauthsize = SHA1_DIGEST_SIZE, | 3536 | .maxauthsize = SHA1_DIGEST_SIZE, |
3540 | }, | 3537 | }, |
@@ -3582,7 +3579,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3582 | .setkey = aead_setkey, | 3579 | .setkey = aead_setkey, |
3583 | .setauthsize = aead_setauthsize, | 3580 | .setauthsize = aead_setauthsize, |
3584 | .encrypt = aead_encrypt, | 3581 | .encrypt = aead_encrypt, |
3585 | .decrypt = aead_givdecrypt, | 3582 | .decrypt = aead_decrypt, |
3586 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3583 | .ivsize = DES3_EDE_BLOCK_SIZE, |
3587 | .maxauthsize = SHA224_DIGEST_SIZE, | 3584 | .maxauthsize = SHA224_DIGEST_SIZE, |
3588 | }, | 3585 | }, |
@@ -3630,7 +3627,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3630 | .setkey = aead_setkey, | 3627 | .setkey = aead_setkey, |
3631 | .setauthsize = aead_setauthsize, | 3628 | .setauthsize = aead_setauthsize, |
3632 | .encrypt = aead_encrypt, | 3629 | .encrypt = aead_encrypt, |
3633 | .decrypt = aead_givdecrypt, | 3630 | .decrypt = aead_decrypt, |
3634 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3631 | .ivsize = DES3_EDE_BLOCK_SIZE, |
3635 | .maxauthsize = SHA256_DIGEST_SIZE, | 3632 | .maxauthsize = SHA256_DIGEST_SIZE, |
3636 | }, | 3633 | }, |
@@ -3678,7 +3675,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3678 | .setkey = aead_setkey, | 3675 | .setkey = aead_setkey, |
3679 | .setauthsize = aead_setauthsize, | 3676 | .setauthsize = aead_setauthsize, |
3680 | .encrypt = aead_encrypt, | 3677 | .encrypt = aead_encrypt, |
3681 | .decrypt = aead_givdecrypt, | 3678 | .decrypt = aead_decrypt, |
3682 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3679 | .ivsize = DES3_EDE_BLOCK_SIZE, |
3683 | .maxauthsize = SHA384_DIGEST_SIZE, | 3680 | .maxauthsize = SHA384_DIGEST_SIZE, |
3684 | }, | 3681 | }, |
@@ -3726,7 +3723,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3726 | .setkey = aead_setkey, | 3723 | .setkey = aead_setkey, |
3727 | .setauthsize = aead_setauthsize, | 3724 | .setauthsize = aead_setauthsize, |
3728 | .encrypt = aead_encrypt, | 3725 | .encrypt = aead_encrypt, |
3729 | .decrypt = aead_givdecrypt, | 3726 | .decrypt = aead_decrypt, |
3730 | .ivsize = DES3_EDE_BLOCK_SIZE, | 3727 | .ivsize = DES3_EDE_BLOCK_SIZE, |
3731 | .maxauthsize = SHA512_DIGEST_SIZE, | 3728 | .maxauthsize = SHA512_DIGEST_SIZE, |
3732 | }, | 3729 | }, |
@@ -3772,7 +3769,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3772 | .setkey = aead_setkey, | 3769 | .setkey = aead_setkey, |
3773 | .setauthsize = aead_setauthsize, | 3770 | .setauthsize = aead_setauthsize, |
3774 | .encrypt = aead_encrypt, | 3771 | .encrypt = aead_encrypt, |
3775 | .decrypt = aead_givdecrypt, | 3772 | .decrypt = aead_decrypt, |
3776 | .ivsize = DES_BLOCK_SIZE, | 3773 | .ivsize = DES_BLOCK_SIZE, |
3777 | .maxauthsize = MD5_DIGEST_SIZE, | 3774 | .maxauthsize = MD5_DIGEST_SIZE, |
3778 | }, | 3775 | }, |
@@ -3818,7 +3815,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3818 | .setkey = aead_setkey, | 3815 | .setkey = aead_setkey, |
3819 | .setauthsize = aead_setauthsize, | 3816 | .setauthsize = aead_setauthsize, |
3820 | .encrypt = aead_encrypt, | 3817 | .encrypt = aead_encrypt, |
3821 | .decrypt = aead_givdecrypt, | 3818 | .decrypt = aead_decrypt, |
3822 | .ivsize = DES_BLOCK_SIZE, | 3819 | .ivsize = DES_BLOCK_SIZE, |
3823 | .maxauthsize = SHA1_DIGEST_SIZE, | 3820 | .maxauthsize = SHA1_DIGEST_SIZE, |
3824 | }, | 3821 | }, |
@@ -3864,7 +3861,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3864 | .setkey = aead_setkey, | 3861 | .setkey = aead_setkey, |
3865 | .setauthsize = aead_setauthsize, | 3862 | .setauthsize = aead_setauthsize, |
3866 | .encrypt = aead_encrypt, | 3863 | .encrypt = aead_encrypt, |
3867 | .decrypt = aead_givdecrypt, | 3864 | .decrypt = aead_decrypt, |
3868 | .ivsize = DES_BLOCK_SIZE, | 3865 | .ivsize = DES_BLOCK_SIZE, |
3869 | .maxauthsize = SHA224_DIGEST_SIZE, | 3866 | .maxauthsize = SHA224_DIGEST_SIZE, |
3870 | }, | 3867 | }, |
@@ -3910,7 +3907,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3910 | .setkey = aead_setkey, | 3907 | .setkey = aead_setkey, |
3911 | .setauthsize = aead_setauthsize, | 3908 | .setauthsize = aead_setauthsize, |
3912 | .encrypt = aead_encrypt, | 3909 | .encrypt = aead_encrypt, |
3913 | .decrypt = aead_givdecrypt, | 3910 | .decrypt = aead_decrypt, |
3914 | .ivsize = DES_BLOCK_SIZE, | 3911 | .ivsize = DES_BLOCK_SIZE, |
3915 | .maxauthsize = SHA256_DIGEST_SIZE, | 3912 | .maxauthsize = SHA256_DIGEST_SIZE, |
3916 | }, | 3913 | }, |
@@ -3956,7 +3953,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
3956 | .setkey = aead_setkey, | 3953 | .setkey = aead_setkey, |
3957 | .setauthsize = aead_setauthsize, | 3954 | .setauthsize = aead_setauthsize, |
3958 | .encrypt = aead_encrypt, | 3955 | .encrypt = aead_encrypt, |
3959 | .decrypt = aead_givdecrypt, | 3956 | .decrypt = aead_decrypt, |
3960 | .ivsize = DES_BLOCK_SIZE, | 3957 | .ivsize = DES_BLOCK_SIZE, |
3961 | .maxauthsize = SHA384_DIGEST_SIZE, | 3958 | .maxauthsize = SHA384_DIGEST_SIZE, |
3962 | }, | 3959 | }, |
@@ -4002,7 +3999,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
4002 | .setkey = aead_setkey, | 3999 | .setkey = aead_setkey, |
4003 | .setauthsize = aead_setauthsize, | 4000 | .setauthsize = aead_setauthsize, |
4004 | .encrypt = aead_encrypt, | 4001 | .encrypt = aead_encrypt, |
4005 | .decrypt = aead_givdecrypt, | 4002 | .decrypt = aead_decrypt, |
4006 | .ivsize = DES_BLOCK_SIZE, | 4003 | .ivsize = DES_BLOCK_SIZE, |
4007 | .maxauthsize = SHA512_DIGEST_SIZE, | 4004 | .maxauthsize = SHA512_DIGEST_SIZE, |
4008 | }, | 4005 | }, |
@@ -4051,7 +4048,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
4051 | .setkey = aead_setkey, | 4048 | .setkey = aead_setkey, |
4052 | .setauthsize = aead_setauthsize, | 4049 | .setauthsize = aead_setauthsize, |
4053 | .encrypt = aead_encrypt, | 4050 | .encrypt = aead_encrypt, |
4054 | .decrypt = aead_givdecrypt, | 4051 | .decrypt = aead_decrypt, |
4055 | .ivsize = CTR_RFC3686_IV_SIZE, | 4052 | .ivsize = CTR_RFC3686_IV_SIZE, |
4056 | .maxauthsize = MD5_DIGEST_SIZE, | 4053 | .maxauthsize = MD5_DIGEST_SIZE, |
4057 | }, | 4054 | }, |
@@ -4102,7 +4099,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
4102 | .setkey = aead_setkey, | 4099 | .setkey = aead_setkey, |
4103 | .setauthsize = aead_setauthsize, | 4100 | .setauthsize = aead_setauthsize, |
4104 | .encrypt = aead_encrypt, | 4101 | .encrypt = aead_encrypt, |
4105 | .decrypt = aead_givdecrypt, | 4102 | .decrypt = aead_decrypt, |
4106 | .ivsize = CTR_RFC3686_IV_SIZE, | 4103 | .ivsize = CTR_RFC3686_IV_SIZE, |
4107 | .maxauthsize = SHA1_DIGEST_SIZE, | 4104 | .maxauthsize = SHA1_DIGEST_SIZE, |
4108 | }, | 4105 | }, |
@@ -4153,7 +4150,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
4153 | .setkey = aead_setkey, | 4150 | .setkey = aead_setkey, |
4154 | .setauthsize = aead_setauthsize, | 4151 | .setauthsize = aead_setauthsize, |
4155 | .encrypt = aead_encrypt, | 4152 | .encrypt = aead_encrypt, |
4156 | .decrypt = aead_givdecrypt, | 4153 | .decrypt = aead_decrypt, |
4157 | .ivsize = CTR_RFC3686_IV_SIZE, | 4154 | .ivsize = CTR_RFC3686_IV_SIZE, |
4158 | .maxauthsize = SHA224_DIGEST_SIZE, | 4155 | .maxauthsize = SHA224_DIGEST_SIZE, |
4159 | }, | 4156 | }, |
@@ -4204,7 +4201,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
4204 | .setkey = aead_setkey, | 4201 | .setkey = aead_setkey, |
4205 | .setauthsize = aead_setauthsize, | 4202 | .setauthsize = aead_setauthsize, |
4206 | .encrypt = aead_encrypt, | 4203 | .encrypt = aead_encrypt, |
4207 | .decrypt = aead_givdecrypt, | 4204 | .decrypt = aead_decrypt, |
4208 | .ivsize = CTR_RFC3686_IV_SIZE, | 4205 | .ivsize = CTR_RFC3686_IV_SIZE, |
4209 | .maxauthsize = SHA256_DIGEST_SIZE, | 4206 | .maxauthsize = SHA256_DIGEST_SIZE, |
4210 | }, | 4207 | }, |
@@ -4255,7 +4252,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
4255 | .setkey = aead_setkey, | 4252 | .setkey = aead_setkey, |
4256 | .setauthsize = aead_setauthsize, | 4253 | .setauthsize = aead_setauthsize, |
4257 | .encrypt = aead_encrypt, | 4254 | .encrypt = aead_encrypt, |
4258 | .decrypt = aead_givdecrypt, | 4255 | .decrypt = aead_decrypt, |
4259 | .ivsize = CTR_RFC3686_IV_SIZE, | 4256 | .ivsize = CTR_RFC3686_IV_SIZE, |
4260 | .maxauthsize = SHA384_DIGEST_SIZE, | 4257 | .maxauthsize = SHA384_DIGEST_SIZE, |
4261 | }, | 4258 | }, |
@@ -4306,7 +4303,7 @@ static struct caam_aead_alg driver_aeads[] = { | |||
4306 | .setkey = aead_setkey, | 4303 | .setkey = aead_setkey, |
4307 | .setauthsize = aead_setauthsize, | 4304 | .setauthsize = aead_setauthsize, |
4308 | .encrypt = aead_encrypt, | 4305 | .encrypt = aead_encrypt, |
4309 | .decrypt = aead_givdecrypt, | 4306 | .decrypt = aead_decrypt, |
4310 | .ivsize = CTR_RFC3686_IV_SIZE, | 4307 | .ivsize = CTR_RFC3686_IV_SIZE, |
4311 | .maxauthsize = SHA512_DIGEST_SIZE, | 4308 | .maxauthsize = SHA512_DIGEST_SIZE, |
4312 | }, | 4309 | }, |
diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c index 803f3953b341..29f600f2c447 100644 --- a/drivers/dax/dax.c +++ b/drivers/dax/dax.c | |||
@@ -459,7 +459,7 @@ static int __dax_dev_pmd_fault(struct dax_dev *dax_dev, | |||
459 | } | 459 | } |
460 | 460 | ||
461 | pgoff = linear_page_index(vma, pmd_addr); | 461 | pgoff = linear_page_index(vma, pmd_addr); |
462 | phys = pgoff_to_phys(dax_dev, pgoff, PAGE_SIZE); | 462 | phys = pgoff_to_phys(dax_dev, pgoff, PMD_SIZE); |
463 | if (phys == -1) { | 463 | if (phys == -1) { |
464 | dev_dbg(dev, "%s: phys_to_pgoff(%#lx) failed\n", __func__, | 464 | dev_dbg(dev, "%s: phys_to_pgoff(%#lx) failed\n", __func__, |
465 | pgoff); | 465 | pgoff); |
diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index 438893762076..ce2bc2a38101 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c | |||
@@ -709,9 +709,10 @@ static int scpi_probe(struct platform_device *pdev) | |||
709 | struct mbox_client *cl = &pchan->cl; | 709 | struct mbox_client *cl = &pchan->cl; |
710 | struct device_node *shmem = of_parse_phandle(np, "shmem", idx); | 710 | struct device_node *shmem = of_parse_phandle(np, "shmem", idx); |
711 | 711 | ||
712 | if (of_address_to_resource(shmem, 0, &res)) { | 712 | ret = of_address_to_resource(shmem, 0, &res); |
713 | of_node_put(shmem); | ||
714 | if (ret) { | ||
713 | dev_err(dev, "failed to get SCPI payload mem resource\n"); | 715 | dev_err(dev, "failed to get SCPI payload mem resource\n"); |
714 | ret = -EINVAL; | ||
715 | goto err; | 716 | goto err; |
716 | } | 717 | } |
717 | 718 | ||
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c index 94a58a082b99..44c01390d035 100644 --- a/drivers/firmware/dmi-id.c +++ b/drivers/firmware/dmi-id.c | |||
@@ -229,14 +229,14 @@ static int __init dmi_id_init(void) | |||
229 | 229 | ||
230 | ret = device_register(dmi_dev); | 230 | ret = device_register(dmi_dev); |
231 | if (ret) | 231 | if (ret) |
232 | goto fail_free_dmi_dev; | 232 | goto fail_put_dmi_dev; |
233 | 233 | ||
234 | return 0; | 234 | return 0; |
235 | 235 | ||
236 | fail_free_dmi_dev: | 236 | fail_put_dmi_dev: |
237 | kfree(dmi_dev); | 237 | put_device(dmi_dev); |
238 | fail_class_unregister: | ||
239 | 238 | ||
239 | fail_class_unregister: | ||
240 | class_unregister(&dmi_class); | 240 | class_unregister(&dmi_class); |
241 | 241 | ||
242 | return ret; | 242 | return ret; |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 66a94103798b..24caedb00a7a 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -1131,6 +1131,7 @@ menu "SPI or I2C GPIO expanders" | |||
1131 | 1131 | ||
1132 | config GPIO_MCP23S08 | 1132 | config GPIO_MCP23S08 |
1133 | tristate "Microchip MCP23xxx I/O expander" | 1133 | tristate "Microchip MCP23xxx I/O expander" |
1134 | depends on OF_GPIO | ||
1134 | select GPIOLIB_IRQCHIP | 1135 | select GPIOLIB_IRQCHIP |
1135 | help | 1136 | help |
1136 | SPI/I2C driver for Microchip MCP23S08/MCP23S17/MCP23008/MCP23017 | 1137 | SPI/I2C driver for Microchip MCP23S08/MCP23S17/MCP23008/MCP23017 |
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c index ac22efc1840e..99d37b56c258 100644 --- a/drivers/gpio/gpio-mcp23s08.c +++ b/drivers/gpio/gpio-mcp23s08.c | |||
@@ -564,7 +564,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, | |||
564 | mcp->chip.direction_output = mcp23s08_direction_output; | 564 | mcp->chip.direction_output = mcp23s08_direction_output; |
565 | mcp->chip.set = mcp23s08_set; | 565 | mcp->chip.set = mcp23s08_set; |
566 | mcp->chip.dbg_show = mcp23s08_dbg_show; | 566 | mcp->chip.dbg_show = mcp23s08_dbg_show; |
567 | #ifdef CONFIG_OF | 567 | #ifdef CONFIG_OF_GPIO |
568 | mcp->chip.of_gpio_n_cells = 2; | 568 | mcp->chip.of_gpio_n_cells = 2; |
569 | mcp->chip.of_node = dev->of_node; | 569 | mcp->chip.of_node = dev->of_node; |
570 | #endif | 570 | #endif |
diff --git a/drivers/gpio/gpio-sa1100.c b/drivers/gpio/gpio-sa1100.c index 0c99e8fb9af3..8d8ee0ebf14c 100644 --- a/drivers/gpio/gpio-sa1100.c +++ b/drivers/gpio/gpio-sa1100.c | |||
@@ -155,7 +155,7 @@ static int sa1100_gpio_irqdomain_map(struct irq_domain *d, | |||
155 | { | 155 | { |
156 | irq_set_chip_and_handler(irq, &sa1100_gpio_irq_chip, | 156 | irq_set_chip_and_handler(irq, &sa1100_gpio_irq_chip, |
157 | handle_edge_irq); | 157 | handle_edge_irq); |
158 | irq_set_noprobe(irq); | 158 | irq_set_probe(irq); |
159 | 159 | ||
160 | return 0; | 160 | return 0; |
161 | } | 161 | } |
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 75e7b3919ea7..a28feb3edf33 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/io-mapping.h> | ||
20 | #include <linux/gpio/consumer.h> | 19 | #include <linux/gpio/consumer.h> |
21 | #include <linux/of.h> | 20 | #include <linux/of.h> |
22 | #include <linux/of_address.h> | 21 | #include <linux/of_address.h> |
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index a978381ef95b..9b17a66cf0e1 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | |||
@@ -387,7 +387,7 @@ void atmel_hlcdc_crtc_irq(struct drm_crtc *c) | |||
387 | atmel_hlcdc_crtc_finish_page_flip(drm_crtc_to_atmel_hlcdc_crtc(c)); | 387 | atmel_hlcdc_crtc_finish_page_flip(drm_crtc_to_atmel_hlcdc_crtc(c)); |
388 | } | 388 | } |
389 | 389 | ||
390 | void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) | 390 | static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) |
391 | { | 391 | { |
392 | struct atmel_hlcdc_crtc_state *state; | 392 | struct atmel_hlcdc_crtc_state *state; |
393 | 393 | ||
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index 016c191221f3..52c527f6642a 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | |||
@@ -320,19 +320,19 @@ atmel_hlcdc_plane_update_pos_and_size(struct atmel_hlcdc_plane *plane, | |||
320 | u32 *coeff_tab = heo_upscaling_ycoef; | 320 | u32 *coeff_tab = heo_upscaling_ycoef; |
321 | u32 max_memsize; | 321 | u32 max_memsize; |
322 | 322 | ||
323 | if (state->crtc_w < state->src_w) | 323 | if (state->crtc_h < state->src_h) |
324 | coeff_tab = heo_downscaling_ycoef; | 324 | coeff_tab = heo_downscaling_ycoef; |
325 | for (i = 0; i < ARRAY_SIZE(heo_upscaling_ycoef); i++) | 325 | for (i = 0; i < ARRAY_SIZE(heo_upscaling_ycoef); i++) |
326 | atmel_hlcdc_layer_update_cfg(&plane->layer, | 326 | atmel_hlcdc_layer_update_cfg(&plane->layer, |
327 | 33 + i, | 327 | 33 + i, |
328 | 0xffffffff, | 328 | 0xffffffff, |
329 | coeff_tab[i]); | 329 | coeff_tab[i]); |
330 | factor = ((8 * 256 * state->src_w) - (256 * 4)) / | 330 | factor = ((8 * 256 * state->src_h) - (256 * 4)) / |
331 | state->crtc_w; | 331 | state->crtc_h; |
332 | factor++; | 332 | factor++; |
333 | max_memsize = ((factor * state->crtc_w) + (256 * 4)) / | 333 | max_memsize = ((factor * state->crtc_h) + (256 * 4)) / |
334 | 2048; | 334 | 2048; |
335 | if (max_memsize > state->src_w) | 335 | if (max_memsize > state->src_h) |
336 | factor--; | 336 | factor--; |
337 | factor_reg |= (factor << 16) | 0x80000000; | 337 | factor_reg |= (factor << 16) | 0x80000000; |
338 | } | 338 | } |
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index 57676f8d7ecf..a6289752be16 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c | |||
@@ -1015,6 +1015,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, | |||
1015 | return 0; | 1015 | return 0; |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | ||
1018 | typedef struct drm_mode_fb_cmd232 { | 1019 | typedef struct drm_mode_fb_cmd232 { |
1019 | u32 fb_id; | 1020 | u32 fb_id; |
1020 | u32 width; | 1021 | u32 width; |
@@ -1071,6 +1072,7 @@ static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd, | |||
1071 | 1072 | ||
1072 | return 0; | 1073 | return 0; |
1073 | } | 1074 | } |
1075 | #endif | ||
1074 | 1076 | ||
1075 | static drm_ioctl_compat_t *drm_compat_ioctls[] = { | 1077 | static drm_ioctl_compat_t *drm_compat_ioctls[] = { |
1076 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, | 1078 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, |
@@ -1104,7 +1106,9 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = { | |||
1104 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, | 1106 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, |
1105 | #endif | 1107 | #endif |
1106 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, | 1108 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, |
1109 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | ||
1107 | [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, | 1110 | [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, |
1111 | #endif | ||
1108 | }; | 1112 | }; |
1109 | 1113 | ||
1110 | /** | 1114 | /** |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index e0166403b4bd..40ce841eb952 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c | |||
@@ -55,11 +55,11 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev, | |||
55 | flags = exynos_gem->flags; | 55 | flags = exynos_gem->flags; |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * without iommu support, not support physically non-continuous memory | 58 | * Physically non-contiguous memory type for framebuffer is not |
59 | * for framebuffer. | 59 | * supported without IOMMU. |
60 | */ | 60 | */ |
61 | if (IS_NONCONTIG_BUFFER(flags)) { | 61 | if (IS_NONCONTIG_BUFFER(flags)) { |
62 | DRM_ERROR("cannot use this gem memory type for fb.\n"); | 62 | DRM_ERROR("Non-contiguous GEM memory is not supported.\n"); |
63 | return -EINVAL; | 63 | return -EINVAL; |
64 | } | 64 | } |
65 | 65 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 0525c56145db..147ef0d298cb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
@@ -1753,32 +1753,6 @@ static int fimc_clk_ctrl(struct fimc_context *ctx, bool enable) | |||
1753 | return 0; | 1753 | return 0; |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | #ifdef CONFIG_PM_SLEEP | ||
1757 | static int fimc_suspend(struct device *dev) | ||
1758 | { | ||
1759 | struct fimc_context *ctx = get_fimc_context(dev); | ||
1760 | |||
1761 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
1762 | |||
1763 | if (pm_runtime_suspended(dev)) | ||
1764 | return 0; | ||
1765 | |||
1766 | return fimc_clk_ctrl(ctx, false); | ||
1767 | } | ||
1768 | |||
1769 | static int fimc_resume(struct device *dev) | ||
1770 | { | ||
1771 | struct fimc_context *ctx = get_fimc_context(dev); | ||
1772 | |||
1773 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
1774 | |||
1775 | if (!pm_runtime_suspended(dev)) | ||
1776 | return fimc_clk_ctrl(ctx, true); | ||
1777 | |||
1778 | return 0; | ||
1779 | } | ||
1780 | #endif | ||
1781 | |||
1782 | static int fimc_runtime_suspend(struct device *dev) | 1756 | static int fimc_runtime_suspend(struct device *dev) |
1783 | { | 1757 | { |
1784 | struct fimc_context *ctx = get_fimc_context(dev); | 1758 | struct fimc_context *ctx = get_fimc_context(dev); |
@@ -1799,7 +1773,8 @@ static int fimc_runtime_resume(struct device *dev) | |||
1799 | #endif | 1773 | #endif |
1800 | 1774 | ||
1801 | static const struct dev_pm_ops fimc_pm_ops = { | 1775 | static const struct dev_pm_ops fimc_pm_ops = { |
1802 | SET_SYSTEM_SLEEP_PM_OPS(fimc_suspend, fimc_resume) | 1776 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
1777 | pm_runtime_force_resume) | ||
1803 | SET_RUNTIME_PM_OPS(fimc_runtime_suspend, fimc_runtime_resume, NULL) | 1778 | SET_RUNTIME_PM_OPS(fimc_runtime_suspend, fimc_runtime_resume, NULL) |
1804 | }; | 1779 | }; |
1805 | 1780 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 4bf00f57ffe8..6eca8bb88648 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
@@ -1475,8 +1475,8 @@ static int g2d_remove(struct platform_device *pdev) | |||
1475 | return 0; | 1475 | return 0; |
1476 | } | 1476 | } |
1477 | 1477 | ||
1478 | #ifdef CONFIG_PM_SLEEP | 1478 | #ifdef CONFIG_PM |
1479 | static int g2d_suspend(struct device *dev) | 1479 | static int g2d_runtime_suspend(struct device *dev) |
1480 | { | 1480 | { |
1481 | struct g2d_data *g2d = dev_get_drvdata(dev); | 1481 | struct g2d_data *g2d = dev_get_drvdata(dev); |
1482 | 1482 | ||
@@ -1490,25 +1490,6 @@ static int g2d_suspend(struct device *dev) | |||
1490 | 1490 | ||
1491 | flush_work(&g2d->runqueue_work); | 1491 | flush_work(&g2d->runqueue_work); |
1492 | 1492 | ||
1493 | return 0; | ||
1494 | } | ||
1495 | |||
1496 | static int g2d_resume(struct device *dev) | ||
1497 | { | ||
1498 | struct g2d_data *g2d = dev_get_drvdata(dev); | ||
1499 | |||
1500 | g2d->suspended = false; | ||
1501 | g2d_exec_runqueue(g2d); | ||
1502 | |||
1503 | return 0; | ||
1504 | } | ||
1505 | #endif | ||
1506 | |||
1507 | #ifdef CONFIG_PM | ||
1508 | static int g2d_runtime_suspend(struct device *dev) | ||
1509 | { | ||
1510 | struct g2d_data *g2d = dev_get_drvdata(dev); | ||
1511 | |||
1512 | clk_disable_unprepare(g2d->gate_clk); | 1493 | clk_disable_unprepare(g2d->gate_clk); |
1513 | 1494 | ||
1514 | return 0; | 1495 | return 0; |
@@ -1523,12 +1504,16 @@ static int g2d_runtime_resume(struct device *dev) | |||
1523 | if (ret < 0) | 1504 | if (ret < 0) |
1524 | dev_warn(dev, "failed to enable clock.\n"); | 1505 | dev_warn(dev, "failed to enable clock.\n"); |
1525 | 1506 | ||
1507 | g2d->suspended = false; | ||
1508 | g2d_exec_runqueue(g2d); | ||
1509 | |||
1526 | return ret; | 1510 | return ret; |
1527 | } | 1511 | } |
1528 | #endif | 1512 | #endif |
1529 | 1513 | ||
1530 | static const struct dev_pm_ops g2d_pm_ops = { | 1514 | static const struct dev_pm_ops g2d_pm_ops = { |
1531 | SET_SYSTEM_SLEEP_PM_OPS(g2d_suspend, g2d_resume) | 1515 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
1516 | pm_runtime_force_resume) | ||
1532 | SET_RUNTIME_PM_OPS(g2d_runtime_suspend, g2d_runtime_resume, NULL) | 1517 | SET_RUNTIME_PM_OPS(g2d_runtime_suspend, g2d_runtime_resume, NULL) |
1533 | }; | 1518 | }; |
1534 | 1519 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 5d20da8f957e..52a9d269484e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c | |||
@@ -1760,34 +1760,7 @@ static int gsc_remove(struct platform_device *pdev) | |||
1760 | return 0; | 1760 | return 0; |
1761 | } | 1761 | } |
1762 | 1762 | ||
1763 | #ifdef CONFIG_PM_SLEEP | 1763 | static int __maybe_unused gsc_runtime_suspend(struct device *dev) |
1764 | static int gsc_suspend(struct device *dev) | ||
1765 | { | ||
1766 | struct gsc_context *ctx = get_gsc_context(dev); | ||
1767 | |||
1768 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
1769 | |||
1770 | if (pm_runtime_suspended(dev)) | ||
1771 | return 0; | ||
1772 | |||
1773 | return gsc_clk_ctrl(ctx, false); | ||
1774 | } | ||
1775 | |||
1776 | static int gsc_resume(struct device *dev) | ||
1777 | { | ||
1778 | struct gsc_context *ctx = get_gsc_context(dev); | ||
1779 | |||
1780 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
1781 | |||
1782 | if (!pm_runtime_suspended(dev)) | ||
1783 | return gsc_clk_ctrl(ctx, true); | ||
1784 | |||
1785 | return 0; | ||
1786 | } | ||
1787 | #endif | ||
1788 | |||
1789 | #ifdef CONFIG_PM | ||
1790 | static int gsc_runtime_suspend(struct device *dev) | ||
1791 | { | 1764 | { |
1792 | struct gsc_context *ctx = get_gsc_context(dev); | 1765 | struct gsc_context *ctx = get_gsc_context(dev); |
1793 | 1766 | ||
@@ -1796,7 +1769,7 @@ static int gsc_runtime_suspend(struct device *dev) | |||
1796 | return gsc_clk_ctrl(ctx, false); | 1769 | return gsc_clk_ctrl(ctx, false); |
1797 | } | 1770 | } |
1798 | 1771 | ||
1799 | static int gsc_runtime_resume(struct device *dev) | 1772 | static int __maybe_unused gsc_runtime_resume(struct device *dev) |
1800 | { | 1773 | { |
1801 | struct gsc_context *ctx = get_gsc_context(dev); | 1774 | struct gsc_context *ctx = get_gsc_context(dev); |
1802 | 1775 | ||
@@ -1804,10 +1777,10 @@ static int gsc_runtime_resume(struct device *dev) | |||
1804 | 1777 | ||
1805 | return gsc_clk_ctrl(ctx, true); | 1778 | return gsc_clk_ctrl(ctx, true); |
1806 | } | 1779 | } |
1807 | #endif | ||
1808 | 1780 | ||
1809 | static const struct dev_pm_ops gsc_pm_ops = { | 1781 | static const struct dev_pm_ops gsc_pm_ops = { |
1810 | SET_SYSTEM_SLEEP_PM_OPS(gsc_suspend, gsc_resume) | 1782 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
1783 | pm_runtime_force_resume) | ||
1811 | SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) | 1784 | SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) |
1812 | }; | 1785 | }; |
1813 | 1786 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 404367a430b5..6591e406084c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c | |||
@@ -794,29 +794,6 @@ static int rotator_clk_crtl(struct rot_context *rot, bool enable) | |||
794 | return 0; | 794 | return 0; |
795 | } | 795 | } |
796 | 796 | ||
797 | |||
798 | #ifdef CONFIG_PM_SLEEP | ||
799 | static int rotator_suspend(struct device *dev) | ||
800 | { | ||
801 | struct rot_context *rot = dev_get_drvdata(dev); | ||
802 | |||
803 | if (pm_runtime_suspended(dev)) | ||
804 | return 0; | ||
805 | |||
806 | return rotator_clk_crtl(rot, false); | ||
807 | } | ||
808 | |||
809 | static int rotator_resume(struct device *dev) | ||
810 | { | ||
811 | struct rot_context *rot = dev_get_drvdata(dev); | ||
812 | |||
813 | if (!pm_runtime_suspended(dev)) | ||
814 | return rotator_clk_crtl(rot, true); | ||
815 | |||
816 | return 0; | ||
817 | } | ||
818 | #endif | ||
819 | |||
820 | static int rotator_runtime_suspend(struct device *dev) | 797 | static int rotator_runtime_suspend(struct device *dev) |
821 | { | 798 | { |
822 | struct rot_context *rot = dev_get_drvdata(dev); | 799 | struct rot_context *rot = dev_get_drvdata(dev); |
@@ -833,7 +810,8 @@ static int rotator_runtime_resume(struct device *dev) | |||
833 | #endif | 810 | #endif |
834 | 811 | ||
835 | static const struct dev_pm_ops rotator_pm_ops = { | 812 | static const struct dev_pm_ops rotator_pm_ops = { |
836 | SET_SYSTEM_SLEEP_PM_OPS(rotator_suspend, rotator_resume) | 813 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
814 | pm_runtime_force_resume) | ||
837 | SET_RUNTIME_PM_OPS(rotator_runtime_suspend, rotator_runtime_resume, | 815 | SET_RUNTIME_PM_OPS(rotator_runtime_suspend, rotator_runtime_resume, |
838 | NULL) | 816 | NULL) |
839 | }; | 817 | }; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 95ddd56b89f0..5de36d8dcc68 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -1281,6 +1281,11 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1281 | 1281 | ||
1282 | intel_runtime_pm_enable(dev_priv); | 1282 | intel_runtime_pm_enable(dev_priv); |
1283 | 1283 | ||
1284 | /* Everything is in place, we can now relax! */ | ||
1285 | DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n", | ||
1286 | driver.name, driver.major, driver.minor, driver.patchlevel, | ||
1287 | driver.date, pci_name(pdev), dev_priv->drm.primary->index); | ||
1288 | |||
1284 | intel_runtime_pm_put(dev_priv); | 1289 | intel_runtime_pm_put(dev_priv); |
1285 | 1290 | ||
1286 | return 0; | 1291 | return 0; |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 7a30af79d799..f38ceffd82c3 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -122,8 +122,11 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, | |||
122 | has_full_48bit_ppgtt = | 122 | has_full_48bit_ppgtt = |
123 | IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9; | 123 | IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9; |
124 | 124 | ||
125 | if (intel_vgpu_active(dev_priv)) | 125 | if (intel_vgpu_active(dev_priv)) { |
126 | has_full_ppgtt = false; /* emulation is too hard */ | 126 | /* emulation is too hard */ |
127 | has_full_ppgtt = false; | ||
128 | has_full_48bit_ppgtt = false; | ||
129 | } | ||
127 | 130 | ||
128 | if (!has_aliasing_ppgtt) | 131 | if (!has_aliasing_ppgtt) |
129 | return 0; | 132 | return 0; |
@@ -158,7 +161,7 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, | |||
158 | return 0; | 161 | return 0; |
159 | } | 162 | } |
160 | 163 | ||
161 | if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists) | 164 | if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists && has_full_ppgtt) |
162 | return has_full_48bit_ppgtt ? 3 : 2; | 165 | return has_full_48bit_ppgtt ? 3 : 2; |
163 | else | 166 | else |
164 | return has_aliasing_ppgtt ? 1 : 0; | 167 | return has_aliasing_ppgtt ? 1 : 0; |
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c index f6acb5a0e701..b81cfb3b22ec 100644 --- a/drivers/gpu/drm/i915/i915_vgpu.c +++ b/drivers/gpu/drm/i915/i915_vgpu.c | |||
@@ -65,9 +65,6 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv) | |||
65 | 65 | ||
66 | BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE); | 66 | BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE); |
67 | 67 | ||
68 | if (!IS_HASWELL(dev_priv)) | ||
69 | return; | ||
70 | |||
71 | magic = __raw_i915_read64(dev_priv, vgtif_reg(magic)); | 68 | magic = __raw_i915_read64(dev_priv, vgtif_reg(magic)); |
72 | if (magic != VGT_MAGIC) | 69 | if (magic != VGT_MAGIC) |
73 | return; | 70 | return; |
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index 47bdf9dad0d3..b9e5a63a7c9e 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c | |||
@@ -554,7 +554,6 @@ void intel_dvo_init(struct drm_device *dev) | |||
554 | return; | 554 | return; |
555 | } | 555 | } |
556 | 556 | ||
557 | drm_encoder_cleanup(&intel_encoder->base); | ||
558 | kfree(intel_dvo); | 557 | kfree(intel_dvo); |
559 | kfree(intel_connector); | 558 | kfree(intel_connector); |
560 | } | 559 | } |
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index adca262d591a..7acbbbf97833 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c | |||
@@ -1047,6 +1047,23 @@ err_out: | |||
1047 | return err; | 1047 | return err; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | static int intel_use_opregion_panel_type_callback(const struct dmi_system_id *id) | ||
1051 | { | ||
1052 | DRM_INFO("Using panel type from OpRegion on %s\n", id->ident); | ||
1053 | return 1; | ||
1054 | } | ||
1055 | |||
1056 | static const struct dmi_system_id intel_use_opregion_panel_type[] = { | ||
1057 | { | ||
1058 | .callback = intel_use_opregion_panel_type_callback, | ||
1059 | .ident = "Conrac GmbH IX45GM2", | ||
1060 | .matches = {DMI_MATCH(DMI_SYS_VENDOR, "Conrac GmbH"), | ||
1061 | DMI_MATCH(DMI_PRODUCT_NAME, "IX45GM2"), | ||
1062 | }, | ||
1063 | }, | ||
1064 | { } | ||
1065 | }; | ||
1066 | |||
1050 | int | 1067 | int |
1051 | intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) | 1068 | intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) |
1052 | { | 1069 | { |
@@ -1073,6 +1090,16 @@ intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) | |||
1073 | } | 1090 | } |
1074 | 1091 | ||
1075 | /* | 1092 | /* |
1093 | * So far we know that some machined must use it, others must not use it. | ||
1094 | * There doesn't seem to be any way to determine which way to go, except | ||
1095 | * via a quirk list :( | ||
1096 | */ | ||
1097 | if (!dmi_check_system(intel_use_opregion_panel_type)) { | ||
1098 | DRM_DEBUG_KMS("Ignoring OpRegion panel type (%d)\n", ret - 1); | ||
1099 | return -ENODEV; | ||
1100 | } | ||
1101 | |||
1102 | /* | ||
1076 | * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us | 1103 | * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us |
1077 | * low vswing for eDP, whereas the VBT panel type (2) gives us normal | 1104 | * low vswing for eDP, whereas the VBT panel type (2) gives us normal |
1078 | * vswing instead. Low vswing results in some display flickers, so | 1105 | * vswing instead. Low vswing results in some display flickers, so |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 53e13c10e4ea..2d2481392824 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -7859,6 +7859,7 @@ static inline int gen6_check_mailbox_status(struct drm_i915_private *dev_priv) | |||
7859 | case GEN6_PCODE_ILLEGAL_CMD: | 7859 | case GEN6_PCODE_ILLEGAL_CMD: |
7860 | return -ENXIO; | 7860 | return -ENXIO; |
7861 | case GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: | 7861 | case GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: |
7862 | case GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: | ||
7862 | return -EOVERFLOW; | 7863 | return -EOVERFLOW; |
7863 | case GEN6_PCODE_TIMEOUT: | 7864 | case GEN6_PCODE_TIMEOUT: |
7864 | return -ETIMEDOUT; | 7865 | return -ETIMEDOUT; |
diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c index 2b0d1baf15b3..cf171b4b8c67 100644 --- a/drivers/gpu/drm/i915/intel_psr.c +++ b/drivers/gpu/drm/i915/intel_psr.c | |||
@@ -255,14 +255,14 @@ static void hsw_psr_enable_source(struct intel_dp *intel_dp) | |||
255 | struct drm_i915_private *dev_priv = to_i915(dev); | 255 | struct drm_i915_private *dev_priv = to_i915(dev); |
256 | 256 | ||
257 | uint32_t max_sleep_time = 0x1f; | 257 | uint32_t max_sleep_time = 0x1f; |
258 | /* Lately it was identified that depending on panel idle frame count | 258 | /* |
259 | * calculated at HW can be off by 1. So let's use what came | 259 | * Let's respect VBT in case VBT asks a higher idle_frame value. |
260 | * from VBT + 1. | 260 | * Let's use 6 as the minimum to cover all known cases including |
261 | * There are also other cases where panel demands at least 4 | 261 | * the off-by-one issue that HW has in some cases. Also there are |
262 | * but VBT is not being set. To cover these 2 cases lets use | 262 | * cases where sink should be able to train |
263 | * at least 5 when VBT isn't set to be on the safest side. | 263 | * with the 5 or 6 idle patterns. |
264 | */ | 264 | */ |
265 | uint32_t idle_frames = dev_priv->vbt.psr.idle_frames + 1; | 265 | uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames); |
266 | uint32_t val = EDP_PSR_ENABLE; | 266 | uint32_t val = EDP_PSR_ENABLE; |
267 | 267 | ||
268 | val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT; | 268 | val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT; |
diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c index 59adcf8532dd..3f6704cf6608 100644 --- a/drivers/gpu/drm/vc4/vc4_bo.c +++ b/drivers/gpu/drm/vc4/vc4_bo.c | |||
@@ -144,7 +144,7 @@ static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, | |||
144 | return &vc4->bo_cache.size_list[page_index]; | 144 | return &vc4->bo_cache.size_list[page_index]; |
145 | } | 145 | } |
146 | 146 | ||
147 | void vc4_bo_cache_purge(struct drm_device *dev) | 147 | static void vc4_bo_cache_purge(struct drm_device *dev) |
148 | { | 148 | { |
149 | struct vc4_dev *vc4 = to_vc4_dev(dev); | 149 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
150 | 150 | ||
diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c index 46527e989ce3..2543cf5b8b51 100644 --- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c +++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c | |||
@@ -309,8 +309,14 @@ validate_uniform_address_write(struct vc4_validated_shader_info *validated_shade | |||
309 | * of uniforms on each side. However, this scheme is easy to | 309 | * of uniforms on each side. However, this scheme is easy to |
310 | * validate so it's all we allow for now. | 310 | * validate so it's all we allow for now. |
311 | */ | 311 | */ |
312 | 312 | switch (QPU_GET_FIELD(inst, QPU_SIG)) { | |
313 | if (QPU_GET_FIELD(inst, QPU_SIG) != QPU_SIG_NONE) { | 313 | case QPU_SIG_NONE: |
314 | case QPU_SIG_SCOREBOARD_UNLOCK: | ||
315 | case QPU_SIG_COLOR_LOAD: | ||
316 | case QPU_SIG_LOAD_TMU0: | ||
317 | case QPU_SIG_LOAD_TMU1: | ||
318 | break; | ||
319 | default: | ||
314 | DRM_ERROR("uniforms address change must be " | 320 | DRM_ERROR("uniforms address change must be " |
315 | "normal math\n"); | 321 | "normal math\n"); |
316 | return false; | 322 | return false; |
diff --git a/drivers/i2c/busses/i2c-bcm-kona.c b/drivers/i2c/busses/i2c-bcm-kona.c index f98743277e3c..258cb9a40ab3 100644 --- a/drivers/i2c/busses/i2c-bcm-kona.c +++ b/drivers/i2c/busses/i2c-bcm-kona.c | |||
@@ -643,7 +643,7 @@ static int bcm_kona_i2c_xfer(struct i2c_adapter *adapter, | |||
643 | if (rc < 0) { | 643 | if (rc < 0) { |
644 | dev_err(dev->device, | 644 | dev_err(dev->device, |
645 | "restart cmd failed rc = %d\n", rc); | 645 | "restart cmd failed rc = %d\n", rc); |
646 | goto xfer_send_stop; | 646 | goto xfer_send_stop; |
647 | } | 647 | } |
648 | } | 648 | } |
649 | 649 | ||
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index 90bbd9f9dd8f..3c16a2f7c673 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c | |||
@@ -767,7 +767,7 @@ static int cdns_i2c_setclk(unsigned long clk_in, struct cdns_i2c *id) | |||
767 | * depending on the scaling direction. | 767 | * depending on the scaling direction. |
768 | * | 768 | * |
769 | * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK | 769 | * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK |
770 | * to acknowedge the change, NOTIFY_DONE if the notification is | 770 | * to acknowledge the change, NOTIFY_DONE if the notification is |
771 | * considered irrelevant. | 771 | * considered irrelevant. |
772 | */ | 772 | */ |
773 | static int cdns_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long | 773 | static int cdns_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long |
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index c6922b806fb7..fcd973d5131e 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c | |||
@@ -367,13 +367,17 @@ int i2c_dw_init(struct dw_i2c_dev *dev) | |||
367 | dev_dbg(dev->dev, "Fast-mode HCNT:LCNT = %d:%d\n", hcnt, lcnt); | 367 | dev_dbg(dev->dev, "Fast-mode HCNT:LCNT = %d:%d\n", hcnt, lcnt); |
368 | 368 | ||
369 | /* Configure SDA Hold Time if required */ | 369 | /* Configure SDA Hold Time if required */ |
370 | if (dev->sda_hold_time) { | 370 | reg = dw_readl(dev, DW_IC_COMP_VERSION); |
371 | reg = dw_readl(dev, DW_IC_COMP_VERSION); | 371 | if (reg >= DW_IC_SDA_HOLD_MIN_VERS) { |
372 | if (reg >= DW_IC_SDA_HOLD_MIN_VERS) | 372 | if (dev->sda_hold_time) { |
373 | dw_writel(dev, dev->sda_hold_time, DW_IC_SDA_HOLD); | 373 | dw_writel(dev, dev->sda_hold_time, DW_IC_SDA_HOLD); |
374 | else | 374 | } else { |
375 | dev_warn(dev->dev, | 375 | /* Keep previous hold time setting if no one set it */ |
376 | "Hardware too old to adjust SDA hold time."); | 376 | dev->sda_hold_time = dw_readl(dev, DW_IC_SDA_HOLD); |
377 | } | ||
378 | } else { | ||
379 | dev_warn(dev->dev, | ||
380 | "Hardware too old to adjust SDA hold time.\n"); | ||
377 | } | 381 | } |
378 | 382 | ||
379 | /* Configure Tx/Rx FIFO threshold levels */ | 383 | /* Configure Tx/Rx FIFO threshold levels */ |
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 52407f3c9e1c..9bd849dacee8 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c | |||
@@ -378,7 +378,7 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv) | |||
378 | } | 378 | } |
379 | 379 | ||
380 | dma_addr = dma_map_single(chan->device->dev, buf, len, dir); | 380 | dma_addr = dma_map_single(chan->device->dev, buf, len, dir); |
381 | if (dma_mapping_error(dev, dma_addr)) { | 381 | if (dma_mapping_error(chan->device->dev, dma_addr)) { |
382 | dev_dbg(dev, "dma map failed, using PIO\n"); | 382 | dev_dbg(dev, "dma map failed, using PIO\n"); |
383 | return; | 383 | return; |
384 | } | 384 | } |
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index 2bc8b01153d6..5c5b7cada8be 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c | |||
@@ -918,7 +918,7 @@ static void rk3x_i2c_adapt_div(struct rk3x_i2c *i2c, unsigned long clk_rate) | |||
918 | * Code adapted from i2c-cadence.c. | 918 | * Code adapted from i2c-cadence.c. |
919 | * | 919 | * |
920 | * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK | 920 | * Return: NOTIFY_STOP if the rate change should be aborted, NOTIFY_OK |
921 | * to acknowedge the change, NOTIFY_DONE if the notification is | 921 | * to acknowledge the change, NOTIFY_DONE if the notification is |
922 | * considered irrelevant. | 922 | * considered irrelevant. |
923 | */ | 923 | */ |
924 | static int rk3x_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long | 924 | static int rk3x_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long |
@@ -1111,6 +1111,15 @@ static int rk3x_i2c_xfer(struct i2c_adapter *adap, | |||
1111 | return ret < 0 ? ret : num; | 1111 | return ret < 0 ? ret : num; |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | static __maybe_unused int rk3x_i2c_resume(struct device *dev) | ||
1115 | { | ||
1116 | struct rk3x_i2c *i2c = dev_get_drvdata(dev); | ||
1117 | |||
1118 | rk3x_i2c_adapt_div(i2c, clk_get_rate(i2c->clk)); | ||
1119 | |||
1120 | return 0; | ||
1121 | } | ||
1122 | |||
1114 | static u32 rk3x_i2c_func(struct i2c_adapter *adap) | 1123 | static u32 rk3x_i2c_func(struct i2c_adapter *adap) |
1115 | { | 1124 | { |
1116 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; | 1125 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; |
@@ -1334,12 +1343,15 @@ static int rk3x_i2c_remove(struct platform_device *pdev) | |||
1334 | return 0; | 1343 | return 0; |
1335 | } | 1344 | } |
1336 | 1345 | ||
1346 | static SIMPLE_DEV_PM_OPS(rk3x_i2c_pm_ops, NULL, rk3x_i2c_resume); | ||
1347 | |||
1337 | static struct platform_driver rk3x_i2c_driver = { | 1348 | static struct platform_driver rk3x_i2c_driver = { |
1338 | .probe = rk3x_i2c_probe, | 1349 | .probe = rk3x_i2c_probe, |
1339 | .remove = rk3x_i2c_remove, | 1350 | .remove = rk3x_i2c_remove, |
1340 | .driver = { | 1351 | .driver = { |
1341 | .name = "rk3x-i2c", | 1352 | .name = "rk3x-i2c", |
1342 | .of_match_table = rk3x_i2c_match, | 1353 | .of_match_table = rk3x_i2c_match, |
1354 | .pm = &rk3x_i2c_pm_ops, | ||
1343 | }, | 1355 | }, |
1344 | }; | 1356 | }; |
1345 | 1357 | ||
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 6fb3e2645992..05b1eeab9cf5 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c | |||
@@ -610,7 +610,7 @@ static void sh_mobile_i2c_xfer_dma(struct sh_mobile_i2c_data *pd) | |||
610 | return; | 610 | return; |
611 | 611 | ||
612 | dma_addr = dma_map_single(chan->device->dev, pd->msg->buf, pd->msg->len, dir); | 612 | dma_addr = dma_map_single(chan->device->dev, pd->msg->buf, pd->msg->len, dir); |
613 | if (dma_mapping_error(pd->dev, dma_addr)) { | 613 | if (dma_mapping_error(chan->device->dev, dma_addr)) { |
614 | dev_dbg(pd->dev, "dma map failed, using PIO\n"); | 614 | dev_dbg(pd->dev, "dma map failed, using PIO\n"); |
615 | return; | 615 | return; |
616 | } | 616 | } |
diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c index 215ac87f606d..b3893f6282ba 100644 --- a/drivers/i2c/muxes/i2c-demux-pinctrl.c +++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c | |||
@@ -37,8 +37,6 @@ struct i2c_demux_pinctrl_priv { | |||
37 | struct i2c_demux_pinctrl_chan chan[]; | 37 | struct i2c_demux_pinctrl_chan chan[]; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static struct property status_okay = { .name = "status", .length = 3, .value = "ok" }; | ||
41 | |||
42 | static int i2c_demux_master_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | 40 | static int i2c_demux_master_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) |
43 | { | 41 | { |
44 | struct i2c_demux_pinctrl_priv *priv = adap->algo_data; | 42 | struct i2c_demux_pinctrl_priv *priv = adap->algo_data; |
@@ -107,6 +105,7 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne | |||
107 | of_changeset_revert(&priv->chan[new_chan].chgset); | 105 | of_changeset_revert(&priv->chan[new_chan].chgset); |
108 | err: | 106 | err: |
109 | dev_err(priv->dev, "failed to setup demux-adapter %d (%d)\n", new_chan, ret); | 107 | dev_err(priv->dev, "failed to setup demux-adapter %d (%d)\n", new_chan, ret); |
108 | priv->cur_chan = -EINVAL; | ||
110 | return ret; | 109 | return ret; |
111 | } | 110 | } |
112 | 111 | ||
@@ -192,6 +191,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) | |||
192 | { | 191 | { |
193 | struct device_node *np = pdev->dev.of_node; | 192 | struct device_node *np = pdev->dev.of_node; |
194 | struct i2c_demux_pinctrl_priv *priv; | 193 | struct i2c_demux_pinctrl_priv *priv; |
194 | struct property *props; | ||
195 | int num_chan, i, j, err; | 195 | int num_chan, i, j, err; |
196 | 196 | ||
197 | num_chan = of_count_phandle_with_args(np, "i2c-parent", NULL); | 197 | num_chan = of_count_phandle_with_args(np, "i2c-parent", NULL); |
@@ -202,7 +202,10 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) | |||
202 | 202 | ||
203 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv) | 203 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv) |
204 | + num_chan * sizeof(struct i2c_demux_pinctrl_chan), GFP_KERNEL); | 204 | + num_chan * sizeof(struct i2c_demux_pinctrl_chan), GFP_KERNEL); |
205 | if (!priv) | 205 | |
206 | props = devm_kcalloc(&pdev->dev, num_chan, sizeof(*props), GFP_KERNEL); | ||
207 | |||
208 | if (!priv || !props) | ||
206 | return -ENOMEM; | 209 | return -ENOMEM; |
207 | 210 | ||
208 | err = of_property_read_string(np, "i2c-bus-name", &priv->bus_name); | 211 | err = of_property_read_string(np, "i2c-bus-name", &priv->bus_name); |
@@ -220,8 +223,12 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) | |||
220 | } | 223 | } |
221 | priv->chan[i].parent_np = adap_np; | 224 | priv->chan[i].parent_np = adap_np; |
222 | 225 | ||
226 | props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL); | ||
227 | props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL); | ||
228 | props[i].length = 3; | ||
229 | |||
223 | of_changeset_init(&priv->chan[i].chgset); | 230 | of_changeset_init(&priv->chan[i].chgset); |
224 | of_changeset_update_property(&priv->chan[i].chgset, adap_np, &status_okay); | 231 | of_changeset_update_property(&priv->chan[i].chgset, adap_np, &props[i]); |
225 | } | 232 | } |
226 | 233 | ||
227 | priv->num_chan = num_chan; | 234 | priv->num_chan = num_chan; |
diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index bf17aae66145..59b380dbf27f 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c | |||
@@ -67,6 +67,9 @@ | |||
67 | #define BMC150_ACCEL_REG_PMU_BW 0x10 | 67 | #define BMC150_ACCEL_REG_PMU_BW 0x10 |
68 | #define BMC150_ACCEL_DEF_BW 125 | 68 | #define BMC150_ACCEL_DEF_BW 125 |
69 | 69 | ||
70 | #define BMC150_ACCEL_REG_RESET 0x14 | ||
71 | #define BMC150_ACCEL_RESET_VAL 0xB6 | ||
72 | |||
70 | #define BMC150_ACCEL_REG_INT_MAP_0 0x19 | 73 | #define BMC150_ACCEL_REG_INT_MAP_0 0x19 |
71 | #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE BIT(2) | 74 | #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE BIT(2) |
72 | 75 | ||
@@ -1497,6 +1500,14 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data) | |||
1497 | int ret, i; | 1500 | int ret, i; |
1498 | unsigned int val; | 1501 | unsigned int val; |
1499 | 1502 | ||
1503 | /* | ||
1504 | * Reset chip to get it in a known good state. A delay of 1.8ms after | ||
1505 | * reset is required according to the data sheets of supported chips. | ||
1506 | */ | ||
1507 | regmap_write(data->regmap, BMC150_ACCEL_REG_RESET, | ||
1508 | BMC150_ACCEL_RESET_VAL); | ||
1509 | usleep_range(1800, 2500); | ||
1510 | |||
1500 | ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val); | 1511 | ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val); |
1501 | if (ret < 0) { | 1512 | if (ret < 0) { |
1502 | dev_err(dev, "Error: Reading chip id\n"); | 1513 | dev_err(dev, "Error: Reading chip id\n"); |
diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c index da5fb67ecb34..9d72d4bcf5e9 100644 --- a/drivers/iio/accel/kxsd9.c +++ b/drivers/iio/accel/kxsd9.c | |||
@@ -166,6 +166,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, | |||
166 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); | 166 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); |
167 | if (ret < 0) | 167 | if (ret < 0) |
168 | goto error_ret; | 168 | goto error_ret; |
169 | *val = 0; | ||
169 | *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; | 170 | *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; |
170 | ret = IIO_VAL_INT_PLUS_MICRO; | 171 | ret = IIO_VAL_INT_PLUS_MICRO; |
171 | break; | 172 | break; |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c index e81f434760f4..dc33c1dd5191 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c | |||
@@ -56,8 +56,8 @@ static struct { | |||
56 | {HID_USAGE_SENSOR_ALS, 0, 1, 0}, | 56 | {HID_USAGE_SENSOR_ALS, 0, 1, 0}, |
57 | {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0}, | 57 | {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0}, |
58 | 58 | ||
59 | {HID_USAGE_SENSOR_PRESSURE, 0, 100000, 0}, | 59 | {HID_USAGE_SENSOR_PRESSURE, 0, 100, 0}, |
60 | {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 1, 0}, | 60 | {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000}, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static int pow_10(unsigned power) | 63 | static int pow_10(unsigned power) |
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 49bf9c59f117..158aaf44dd95 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c | |||
@@ -110,7 +110,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, | |||
110 | DEFINE_WAIT_FUNC(wait, woken_wake_function); | 110 | DEFINE_WAIT_FUNC(wait, woken_wake_function); |
111 | size_t datum_size; | 111 | size_t datum_size; |
112 | size_t to_wait; | 112 | size_t to_wait; |
113 | int ret; | 113 | int ret = 0; |
114 | 114 | ||
115 | if (!indio_dev->info) | 115 | if (!indio_dev->info) |
116 | return -ENODEV; | 116 | return -ENODEV; |
@@ -153,7 +153,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, | |||
153 | ret = rb->access->read_first_n(rb, n, buf); | 153 | ret = rb->access->read_first_n(rb, n, buf); |
154 | if (ret == 0 && (filp->f_flags & O_NONBLOCK)) | 154 | if (ret == 0 && (filp->f_flags & O_NONBLOCK)) |
155 | ret = -EAGAIN; | 155 | ret = -EAGAIN; |
156 | } while (ret == 0); | 156 | } while (ret == 0); |
157 | remove_wait_queue(&rb->pollq, &wait); | 157 | remove_wait_queue(&rb->pollq, &wait); |
158 | 158 | ||
159 | return ret; | 159 | return ret; |
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index f914d5d140e4..d2b889918c3e 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c | |||
@@ -613,9 +613,8 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals) | |||
613 | return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); | 613 | return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); |
614 | case IIO_VAL_FRACTIONAL: | 614 | case IIO_VAL_FRACTIONAL: |
615 | tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]); | 615 | tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]); |
616 | vals[1] = do_div(tmp, 1000000000LL); | 616 | vals[0] = (int)div_s64_rem(tmp, 1000000000, &vals[1]); |
617 | vals[0] = tmp; | 617 | return sprintf(buf, "%d.%09u\n", vals[0], abs(vals[1])); |
618 | return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); | ||
619 | case IIO_VAL_FRACTIONAL_LOG2: | 618 | case IIO_VAL_FRACTIONAL_LOG2: |
620 | tmp = (s64)vals[0] * 1000000000LL >> vals[1]; | 619 | tmp = (s64)vals[0] * 1000000000LL >> vals[1]; |
621 | vals[1] = do_div(tmp, 1000000000LL); | 620 | vals[1] = do_div(tmp, 1000000000LL); |
diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c index 3a3c5d73bbfc..51c79b2fb0b8 100644 --- a/drivers/infiniband/core/multicast.c +++ b/drivers/infiniband/core/multicast.c | |||
@@ -106,7 +106,6 @@ struct mcast_group { | |||
106 | atomic_t refcount; | 106 | atomic_t refcount; |
107 | enum mcast_group_state state; | 107 | enum mcast_group_state state; |
108 | struct ib_sa_query *query; | 108 | struct ib_sa_query *query; |
109 | int query_id; | ||
110 | u16 pkey_index; | 109 | u16 pkey_index; |
111 | u8 leave_state; | 110 | u8 leave_state; |
112 | int retries; | 111 | int retries; |
@@ -340,11 +339,7 @@ static int send_join(struct mcast_group *group, struct mcast_member *member) | |||
340 | member->multicast.comp_mask, | 339 | member->multicast.comp_mask, |
341 | 3000, GFP_KERNEL, join_handler, group, | 340 | 3000, GFP_KERNEL, join_handler, group, |
342 | &group->query); | 341 | &group->query); |
343 | if (ret >= 0) { | 342 | return (ret > 0) ? 0 : ret; |
344 | group->query_id = ret; | ||
345 | ret = 0; | ||
346 | } | ||
347 | return ret; | ||
348 | } | 343 | } |
349 | 344 | ||
350 | static int send_leave(struct mcast_group *group, u8 leave_state) | 345 | static int send_leave(struct mcast_group *group, u8 leave_state) |
@@ -364,11 +359,7 @@ static int send_leave(struct mcast_group *group, u8 leave_state) | |||
364 | IB_SA_MCMEMBER_REC_JOIN_STATE, | 359 | IB_SA_MCMEMBER_REC_JOIN_STATE, |
365 | 3000, GFP_KERNEL, leave_handler, | 360 | 3000, GFP_KERNEL, leave_handler, |
366 | group, &group->query); | 361 | group, &group->query); |
367 | if (ret >= 0) { | 362 | return (ret > 0) ? 0 : ret; |
368 | group->query_id = ret; | ||
369 | ret = 0; | ||
370 | } | ||
371 | return ret; | ||
372 | } | 363 | } |
373 | 364 | ||
374 | static void join_group(struct mcast_group *group, struct mcast_member *member, | 365 | static void join_group(struct mcast_group *group, struct mcast_member *member, |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index b6a953aed7e8..80f988984f44 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -333,6 +333,8 @@ static void remove_ep_tid(struct c4iw_ep *ep) | |||
333 | 333 | ||
334 | spin_lock_irqsave(&ep->com.dev->lock, flags); | 334 | spin_lock_irqsave(&ep->com.dev->lock, flags); |
335 | _remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid, 0); | 335 | _remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid, 0); |
336 | if (idr_is_empty(&ep->com.dev->hwtid_idr)) | ||
337 | wake_up(&ep->com.dev->wait); | ||
336 | spin_unlock_irqrestore(&ep->com.dev->lock, flags); | 338 | spin_unlock_irqrestore(&ep->com.dev->lock, flags); |
337 | } | 339 | } |
338 | 340 | ||
@@ -2117,8 +2119,10 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, | |||
2117 | } | 2119 | } |
2118 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, | 2120 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, |
2119 | n, pdev, rt_tos2priority(tos)); | 2121 | n, pdev, rt_tos2priority(tos)); |
2120 | if (!ep->l2t) | 2122 | if (!ep->l2t) { |
2123 | dev_put(pdev); | ||
2121 | goto out; | 2124 | goto out; |
2125 | } | ||
2122 | ep->mtu = pdev->mtu; | 2126 | ep->mtu = pdev->mtu; |
2123 | ep->tx_chan = cxgb4_port_chan(pdev); | 2127 | ep->tx_chan = cxgb4_port_chan(pdev); |
2124 | ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, | 2128 | ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, |
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index 071d7332ec06..3c4b2126e0d1 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c | |||
@@ -872,9 +872,13 @@ static void c4iw_rdev_close(struct c4iw_rdev *rdev) | |||
872 | static void c4iw_dealloc(struct uld_ctx *ctx) | 872 | static void c4iw_dealloc(struct uld_ctx *ctx) |
873 | { | 873 | { |
874 | c4iw_rdev_close(&ctx->dev->rdev); | 874 | c4iw_rdev_close(&ctx->dev->rdev); |
875 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->cqidr)); | ||
875 | idr_destroy(&ctx->dev->cqidr); | 876 | idr_destroy(&ctx->dev->cqidr); |
877 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->qpidr)); | ||
876 | idr_destroy(&ctx->dev->qpidr); | 878 | idr_destroy(&ctx->dev->qpidr); |
879 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->mmidr)); | ||
877 | idr_destroy(&ctx->dev->mmidr); | 880 | idr_destroy(&ctx->dev->mmidr); |
881 | wait_event(ctx->dev->wait, idr_is_empty(&ctx->dev->hwtid_idr)); | ||
878 | idr_destroy(&ctx->dev->hwtid_idr); | 882 | idr_destroy(&ctx->dev->hwtid_idr); |
879 | idr_destroy(&ctx->dev->stid_idr); | 883 | idr_destroy(&ctx->dev->stid_idr); |
880 | idr_destroy(&ctx->dev->atid_idr); | 884 | idr_destroy(&ctx->dev->atid_idr); |
@@ -992,6 +996,7 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) | |||
992 | mutex_init(&devp->rdev.stats.lock); | 996 | mutex_init(&devp->rdev.stats.lock); |
993 | mutex_init(&devp->db_mutex); | 997 | mutex_init(&devp->db_mutex); |
994 | INIT_LIST_HEAD(&devp->db_fc_list); | 998 | INIT_LIST_HEAD(&devp->db_fc_list); |
999 | init_waitqueue_head(&devp->wait); | ||
995 | devp->avail_ird = devp->rdev.lldi.max_ird_adapter; | 1000 | devp->avail_ird = devp->rdev.lldi.max_ird_adapter; |
996 | 1001 | ||
997 | if (c4iw_debugfs_root) { | 1002 | if (c4iw_debugfs_root) { |
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index aa47e0ae80bc..4b83b84f7ddf 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
@@ -263,6 +263,7 @@ struct c4iw_dev { | |||
263 | struct idr stid_idr; | 263 | struct idr stid_idr; |
264 | struct list_head db_fc_list; | 264 | struct list_head db_fc_list; |
265 | u32 avail_ird; | 265 | u32 avail_ird; |
266 | wait_queue_head_t wait; | ||
266 | }; | 267 | }; |
267 | 268 | ||
268 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) | 269 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index edb1172b6f54..690435229be7 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -683,7 +683,7 @@ static int build_inv_stag(union t4_wr *wqe, struct ib_send_wr *wr, | |||
683 | return 0; | 683 | return 0; |
684 | } | 684 | } |
685 | 685 | ||
686 | void _free_qp(struct kref *kref) | 686 | static void _free_qp(struct kref *kref) |
687 | { | 687 | { |
688 | struct c4iw_qp *qhp; | 688 | struct c4iw_qp *qhp; |
689 | 689 | ||
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c index b32638d58ae8..cc38004cea42 100644 --- a/drivers/infiniband/hw/hfi1/chip.c +++ b/drivers/infiniband/hw/hfi1/chip.c | |||
@@ -9490,6 +9490,78 @@ static void init_lcb(struct hfi1_devdata *dd) | |||
9490 | write_csr(dd, DC_LCB_CFG_TX_FIFOS_RESET, 0x00); | 9490 | write_csr(dd, DC_LCB_CFG_TX_FIFOS_RESET, 0x00); |
9491 | } | 9491 | } |
9492 | 9492 | ||
9493 | /* | ||
9494 | * Perform a test read on the QSFP. Return 0 on success, -ERRNO | ||
9495 | * on error. | ||
9496 | */ | ||
9497 | static int test_qsfp_read(struct hfi1_pportdata *ppd) | ||
9498 | { | ||
9499 | int ret; | ||
9500 | u8 status; | ||
9501 | |||
9502 | /* report success if not a QSFP */ | ||
9503 | if (ppd->port_type != PORT_TYPE_QSFP) | ||
9504 | return 0; | ||
9505 | |||
9506 | /* read byte 2, the status byte */ | ||
9507 | ret = one_qsfp_read(ppd, ppd->dd->hfi1_id, 2, &status, 1); | ||
9508 | if (ret < 0) | ||
9509 | return ret; | ||
9510 | if (ret != 1) | ||
9511 | return -EIO; | ||
9512 | |||
9513 | return 0; /* success */ | ||
9514 | } | ||
9515 | |||
9516 | /* | ||
9517 | * Values for QSFP retry. | ||
9518 | * | ||
9519 | * Give up after 10s (20 x 500ms). The overall timeout was empirically | ||
9520 | * arrived at from experience on a large cluster. | ||
9521 | */ | ||
9522 | #define MAX_QSFP_RETRIES 20 | ||
9523 | #define QSFP_RETRY_WAIT 500 /* msec */ | ||
9524 | |||
9525 | /* | ||
9526 | * Try a QSFP read. If it fails, schedule a retry for later. | ||
9527 | * Called on first link activation after driver load. | ||
9528 | */ | ||
9529 | static void try_start_link(struct hfi1_pportdata *ppd) | ||
9530 | { | ||
9531 | if (test_qsfp_read(ppd)) { | ||
9532 | /* read failed */ | ||
9533 | if (ppd->qsfp_retry_count >= MAX_QSFP_RETRIES) { | ||
9534 | dd_dev_err(ppd->dd, "QSFP not responding, giving up\n"); | ||
9535 | return; | ||
9536 | } | ||
9537 | dd_dev_info(ppd->dd, | ||
9538 | "QSFP not responding, waiting and retrying %d\n", | ||
9539 | (int)ppd->qsfp_retry_count); | ||
9540 | ppd->qsfp_retry_count++; | ||
9541 | queue_delayed_work(ppd->hfi1_wq, &ppd->start_link_work, | ||
9542 | msecs_to_jiffies(QSFP_RETRY_WAIT)); | ||
9543 | return; | ||
9544 | } | ||
9545 | ppd->qsfp_retry_count = 0; | ||
9546 | |||
9547 | /* | ||
9548 | * Tune the SerDes to a ballpark setting for optimal signal and bit | ||
9549 | * error rate. Needs to be done before starting the link. | ||
9550 | */ | ||
9551 | tune_serdes(ppd); | ||
9552 | start_link(ppd); | ||
9553 | } | ||
9554 | |||
9555 | /* | ||
9556 | * Workqueue function to start the link after a delay. | ||
9557 | */ | ||
9558 | void handle_start_link(struct work_struct *work) | ||
9559 | { | ||
9560 | struct hfi1_pportdata *ppd = container_of(work, struct hfi1_pportdata, | ||
9561 | start_link_work.work); | ||
9562 | try_start_link(ppd); | ||
9563 | } | ||
9564 | |||
9493 | int bringup_serdes(struct hfi1_pportdata *ppd) | 9565 | int bringup_serdes(struct hfi1_pportdata *ppd) |
9494 | { | 9566 | { |
9495 | struct hfi1_devdata *dd = ppd->dd; | 9567 | struct hfi1_devdata *dd = ppd->dd; |
@@ -9525,14 +9597,8 @@ int bringup_serdes(struct hfi1_pportdata *ppd) | |||
9525 | set_qsfp_int_n(ppd, 1); | 9597 | set_qsfp_int_n(ppd, 1); |
9526 | } | 9598 | } |
9527 | 9599 | ||
9528 | /* | 9600 | try_start_link(ppd); |
9529 | * Tune the SerDes to a ballpark setting for | 9601 | return 0; |
9530 | * optimal signal and bit error rate | ||
9531 | * Needs to be done before starting the link | ||
9532 | */ | ||
9533 | tune_serdes(ppd); | ||
9534 | |||
9535 | return start_link(ppd); | ||
9536 | } | 9602 | } |
9537 | 9603 | ||
9538 | void hfi1_quiet_serdes(struct hfi1_pportdata *ppd) | 9604 | void hfi1_quiet_serdes(struct hfi1_pportdata *ppd) |
@@ -9549,6 +9615,10 @@ void hfi1_quiet_serdes(struct hfi1_pportdata *ppd) | |||
9549 | ppd->driver_link_ready = 0; | 9615 | ppd->driver_link_ready = 0; |
9550 | ppd->link_enabled = 0; | 9616 | ppd->link_enabled = 0; |
9551 | 9617 | ||
9618 | ppd->qsfp_retry_count = MAX_QSFP_RETRIES; /* prevent more retries */ | ||
9619 | flush_delayed_work(&ppd->start_link_work); | ||
9620 | cancel_delayed_work_sync(&ppd->start_link_work); | ||
9621 | |||
9552 | ppd->offline_disabled_reason = | 9622 | ppd->offline_disabled_reason = |
9553 | HFI1_ODR_MASK(OPA_LINKDOWN_REASON_SMA_DISABLED); | 9623 | HFI1_ODR_MASK(OPA_LINKDOWN_REASON_SMA_DISABLED); |
9554 | set_link_down_reason(ppd, OPA_LINKDOWN_REASON_SMA_DISABLED, 0, | 9624 | set_link_down_reason(ppd, OPA_LINKDOWN_REASON_SMA_DISABLED, 0, |
@@ -12865,7 +12935,7 @@ fail: | |||
12865 | */ | 12935 | */ |
12866 | static int set_up_context_variables(struct hfi1_devdata *dd) | 12936 | static int set_up_context_variables(struct hfi1_devdata *dd) |
12867 | { | 12937 | { |
12868 | int num_kernel_contexts; | 12938 | unsigned long num_kernel_contexts; |
12869 | int total_contexts; | 12939 | int total_contexts; |
12870 | int ret; | 12940 | int ret; |
12871 | unsigned ngroups; | 12941 | unsigned ngroups; |
@@ -12894,9 +12964,9 @@ static int set_up_context_variables(struct hfi1_devdata *dd) | |||
12894 | */ | 12964 | */ |
12895 | if (num_kernel_contexts > (dd->chip_send_contexts - num_vls - 1)) { | 12965 | if (num_kernel_contexts > (dd->chip_send_contexts - num_vls - 1)) { |
12896 | dd_dev_err(dd, | 12966 | dd_dev_err(dd, |
12897 | "Reducing # kernel rcv contexts to: %d, from %d\n", | 12967 | "Reducing # kernel rcv contexts to: %d, from %lu\n", |
12898 | (int)(dd->chip_send_contexts - num_vls - 1), | 12968 | (int)(dd->chip_send_contexts - num_vls - 1), |
12899 | (int)num_kernel_contexts); | 12969 | num_kernel_contexts); |
12900 | num_kernel_contexts = dd->chip_send_contexts - num_vls - 1; | 12970 | num_kernel_contexts = dd->chip_send_contexts - num_vls - 1; |
12901 | } | 12971 | } |
12902 | /* | 12972 | /* |
diff --git a/drivers/infiniband/hw/hfi1/chip.h b/drivers/infiniband/hw/hfi1/chip.h index ed11107c50fe..e29573769efc 100644 --- a/drivers/infiniband/hw/hfi1/chip.h +++ b/drivers/infiniband/hw/hfi1/chip.h | |||
@@ -706,6 +706,7 @@ void handle_link_up(struct work_struct *work); | |||
706 | void handle_link_down(struct work_struct *work); | 706 | void handle_link_down(struct work_struct *work); |
707 | void handle_link_downgrade(struct work_struct *work); | 707 | void handle_link_downgrade(struct work_struct *work); |
708 | void handle_link_bounce(struct work_struct *work); | 708 | void handle_link_bounce(struct work_struct *work); |
709 | void handle_start_link(struct work_struct *work); | ||
709 | void handle_sma_message(struct work_struct *work); | 710 | void handle_sma_message(struct work_struct *work); |
710 | void reset_qsfp(struct hfi1_pportdata *ppd); | 711 | void reset_qsfp(struct hfi1_pportdata *ppd); |
711 | void qsfp_event(struct work_struct *work); | 712 | void qsfp_event(struct work_struct *work); |
diff --git a/drivers/infiniband/hw/hfi1/debugfs.c b/drivers/infiniband/hw/hfi1/debugfs.c index a49cc88f08a2..5e9be16f6cd3 100644 --- a/drivers/infiniband/hw/hfi1/debugfs.c +++ b/drivers/infiniband/hw/hfi1/debugfs.c | |||
@@ -59,6 +59,40 @@ | |||
59 | 59 | ||
60 | static struct dentry *hfi1_dbg_root; | 60 | static struct dentry *hfi1_dbg_root; |
61 | 61 | ||
62 | /* wrappers to enforce srcu in seq file */ | ||
63 | static ssize_t hfi1_seq_read( | ||
64 | struct file *file, | ||
65 | char __user *buf, | ||
66 | size_t size, | ||
67 | loff_t *ppos) | ||
68 | { | ||
69 | struct dentry *d = file->f_path.dentry; | ||
70 | int srcu_idx; | ||
71 | ssize_t r; | ||
72 | |||
73 | r = debugfs_use_file_start(d, &srcu_idx); | ||
74 | if (likely(!r)) | ||
75 | r = seq_read(file, buf, size, ppos); | ||
76 | debugfs_use_file_finish(srcu_idx); | ||
77 | return r; | ||
78 | } | ||
79 | |||
80 | static loff_t hfi1_seq_lseek( | ||
81 | struct file *file, | ||
82 | loff_t offset, | ||
83 | int whence) | ||
84 | { | ||
85 | struct dentry *d = file->f_path.dentry; | ||
86 | int srcu_idx; | ||
87 | loff_t r; | ||
88 | |||
89 | r = debugfs_use_file_start(d, &srcu_idx); | ||
90 | if (likely(!r)) | ||
91 | r = seq_lseek(file, offset, whence); | ||
92 | debugfs_use_file_finish(srcu_idx); | ||
93 | return r; | ||
94 | } | ||
95 | |||
62 | #define private2dd(file) (file_inode(file)->i_private) | 96 | #define private2dd(file) (file_inode(file)->i_private) |
63 | #define private2ppd(file) (file_inode(file)->i_private) | 97 | #define private2ppd(file) (file_inode(file)->i_private) |
64 | 98 | ||
@@ -87,8 +121,8 @@ static int _##name##_open(struct inode *inode, struct file *s) \ | |||
87 | static const struct file_operations _##name##_file_ops = { \ | 121 | static const struct file_operations _##name##_file_ops = { \ |
88 | .owner = THIS_MODULE, \ | 122 | .owner = THIS_MODULE, \ |
89 | .open = _##name##_open, \ | 123 | .open = _##name##_open, \ |
90 | .read = seq_read, \ | 124 | .read = hfi1_seq_read, \ |
91 | .llseek = seq_lseek, \ | 125 | .llseek = hfi1_seq_lseek, \ |
92 | .release = seq_release \ | 126 | .release = seq_release \ |
93 | } | 127 | } |
94 | 128 | ||
@@ -105,11 +139,9 @@ do { \ | |||
105 | DEBUGFS_FILE_CREATE(#name, parent, data, &_##name##_file_ops, S_IRUGO) | 139 | DEBUGFS_FILE_CREATE(#name, parent, data, &_##name##_file_ops, S_IRUGO) |
106 | 140 | ||
107 | static void *_opcode_stats_seq_start(struct seq_file *s, loff_t *pos) | 141 | static void *_opcode_stats_seq_start(struct seq_file *s, loff_t *pos) |
108 | __acquires(RCU) | ||
109 | { | 142 | { |
110 | struct hfi1_opcode_stats_perctx *opstats; | 143 | struct hfi1_opcode_stats_perctx *opstats; |
111 | 144 | ||
112 | rcu_read_lock(); | ||
113 | if (*pos >= ARRAY_SIZE(opstats->stats)) | 145 | if (*pos >= ARRAY_SIZE(opstats->stats)) |
114 | return NULL; | 146 | return NULL; |
115 | return pos; | 147 | return pos; |
@@ -126,9 +158,7 @@ static void *_opcode_stats_seq_next(struct seq_file *s, void *v, loff_t *pos) | |||
126 | } | 158 | } |
127 | 159 | ||
128 | static void _opcode_stats_seq_stop(struct seq_file *s, void *v) | 160 | static void _opcode_stats_seq_stop(struct seq_file *s, void *v) |
129 | __releases(RCU) | ||
130 | { | 161 | { |
131 | rcu_read_unlock(); | ||
132 | } | 162 | } |
133 | 163 | ||
134 | static int _opcode_stats_seq_show(struct seq_file *s, void *v) | 164 | static int _opcode_stats_seq_show(struct seq_file *s, void *v) |
@@ -285,12 +315,10 @@ DEBUGFS_SEQ_FILE_OPEN(qp_stats) | |||
285 | DEBUGFS_FILE_OPS(qp_stats); | 315 | DEBUGFS_FILE_OPS(qp_stats); |
286 | 316 | ||
287 | static void *_sdes_seq_start(struct seq_file *s, loff_t *pos) | 317 | static void *_sdes_seq_start(struct seq_file *s, loff_t *pos) |
288 | __acquires(RCU) | ||
289 | { | 318 | { |
290 | struct hfi1_ibdev *ibd; | 319 | struct hfi1_ibdev *ibd; |
291 | struct hfi1_devdata *dd; | 320 | struct hfi1_devdata *dd; |
292 | 321 | ||
293 | rcu_read_lock(); | ||
294 | ibd = (struct hfi1_ibdev *)s->private; | 322 | ibd = (struct hfi1_ibdev *)s->private; |
295 | dd = dd_from_dev(ibd); | 323 | dd = dd_from_dev(ibd); |
296 | if (!dd->per_sdma || *pos >= dd->num_sdma) | 324 | if (!dd->per_sdma || *pos >= dd->num_sdma) |
@@ -310,9 +338,7 @@ static void *_sdes_seq_next(struct seq_file *s, void *v, loff_t *pos) | |||
310 | } | 338 | } |
311 | 339 | ||
312 | static void _sdes_seq_stop(struct seq_file *s, void *v) | 340 | static void _sdes_seq_stop(struct seq_file *s, void *v) |
313 | __releases(RCU) | ||
314 | { | 341 | { |
315 | rcu_read_unlock(); | ||
316 | } | 342 | } |
317 | 343 | ||
318 | static int _sdes_seq_show(struct seq_file *s, void *v) | 344 | static int _sdes_seq_show(struct seq_file *s, void *v) |
@@ -339,11 +365,9 @@ static ssize_t dev_counters_read(struct file *file, char __user *buf, | |||
339 | struct hfi1_devdata *dd; | 365 | struct hfi1_devdata *dd; |
340 | ssize_t rval; | 366 | ssize_t rval; |
341 | 367 | ||
342 | rcu_read_lock(); | ||
343 | dd = private2dd(file); | 368 | dd = private2dd(file); |
344 | avail = hfi1_read_cntrs(dd, NULL, &counters); | 369 | avail = hfi1_read_cntrs(dd, NULL, &counters); |
345 | rval = simple_read_from_buffer(buf, count, ppos, counters, avail); | 370 | rval = simple_read_from_buffer(buf, count, ppos, counters, avail); |
346 | rcu_read_unlock(); | ||
347 | return rval; | 371 | return rval; |
348 | } | 372 | } |
349 | 373 | ||
@@ -356,11 +380,9 @@ static ssize_t dev_names_read(struct file *file, char __user *buf, | |||
356 | struct hfi1_devdata *dd; | 380 | struct hfi1_devdata *dd; |
357 | ssize_t rval; | 381 | ssize_t rval; |
358 | 382 | ||
359 | rcu_read_lock(); | ||
360 | dd = private2dd(file); | 383 | dd = private2dd(file); |
361 | avail = hfi1_read_cntrs(dd, &names, NULL); | 384 | avail = hfi1_read_cntrs(dd, &names, NULL); |
362 | rval = simple_read_from_buffer(buf, count, ppos, names, avail); | 385 | rval = simple_read_from_buffer(buf, count, ppos, names, avail); |
363 | rcu_read_unlock(); | ||
364 | return rval; | 386 | return rval; |
365 | } | 387 | } |
366 | 388 | ||
@@ -383,11 +405,9 @@ static ssize_t portnames_read(struct file *file, char __user *buf, | |||
383 | struct hfi1_devdata *dd; | 405 | struct hfi1_devdata *dd; |
384 | ssize_t rval; | 406 | ssize_t rval; |
385 | 407 | ||
386 | rcu_read_lock(); | ||
387 | dd = private2dd(file); | 408 | dd = private2dd(file); |
388 | avail = hfi1_read_portcntrs(dd->pport, &names, NULL); | 409 | avail = hfi1_read_portcntrs(dd->pport, &names, NULL); |
389 | rval = simple_read_from_buffer(buf, count, ppos, names, avail); | 410 | rval = simple_read_from_buffer(buf, count, ppos, names, avail); |
390 | rcu_read_unlock(); | ||
391 | return rval; | 411 | return rval; |
392 | } | 412 | } |
393 | 413 | ||
@@ -400,11 +420,9 @@ static ssize_t portcntrs_debugfs_read(struct file *file, char __user *buf, | |||
400 | struct hfi1_pportdata *ppd; | 420 | struct hfi1_pportdata *ppd; |
401 | ssize_t rval; | 421 | ssize_t rval; |
402 | 422 | ||
403 | rcu_read_lock(); | ||
404 | ppd = private2ppd(file); | 423 | ppd = private2ppd(file); |
405 | avail = hfi1_read_portcntrs(ppd, NULL, &counters); | 424 | avail = hfi1_read_portcntrs(ppd, NULL, &counters); |
406 | rval = simple_read_from_buffer(buf, count, ppos, counters, avail); | 425 | rval = simple_read_from_buffer(buf, count, ppos, counters, avail); |
407 | rcu_read_unlock(); | ||
408 | return rval; | 426 | return rval; |
409 | } | 427 | } |
410 | 428 | ||
@@ -434,16 +452,13 @@ static ssize_t asic_flags_read(struct file *file, char __user *buf, | |||
434 | int used; | 452 | int used; |
435 | int i; | 453 | int i; |
436 | 454 | ||
437 | rcu_read_lock(); | ||
438 | ppd = private2ppd(file); | 455 | ppd = private2ppd(file); |
439 | dd = ppd->dd; | 456 | dd = ppd->dd; |
440 | size = PAGE_SIZE; | 457 | size = PAGE_SIZE; |
441 | used = 0; | 458 | used = 0; |
442 | tmp = kmalloc(size, GFP_KERNEL); | 459 | tmp = kmalloc(size, GFP_KERNEL); |
443 | if (!tmp) { | 460 | if (!tmp) |
444 | rcu_read_unlock(); | ||
445 | return -ENOMEM; | 461 | return -ENOMEM; |
446 | } | ||
447 | 462 | ||
448 | scratch0 = read_csr(dd, ASIC_CFG_SCRATCH); | 463 | scratch0 = read_csr(dd, ASIC_CFG_SCRATCH); |
449 | used += scnprintf(tmp + used, size - used, | 464 | used += scnprintf(tmp + used, size - used, |
@@ -470,7 +485,6 @@ static ssize_t asic_flags_read(struct file *file, char __user *buf, | |||
470 | used += scnprintf(tmp + used, size - used, "Write bits to clear\n"); | 485 | used += scnprintf(tmp + used, size - used, "Write bits to clear\n"); |
471 | 486 | ||
472 | ret = simple_read_from_buffer(buf, count, ppos, tmp, used); | 487 | ret = simple_read_from_buffer(buf, count, ppos, tmp, used); |
473 | rcu_read_unlock(); | ||
474 | kfree(tmp); | 488 | kfree(tmp); |
475 | return ret; | 489 | return ret; |
476 | } | 490 | } |
@@ -486,15 +500,12 @@ static ssize_t asic_flags_write(struct file *file, const char __user *buf, | |||
486 | u64 scratch0; | 500 | u64 scratch0; |
487 | u64 clear; | 501 | u64 clear; |
488 | 502 | ||
489 | rcu_read_lock(); | ||
490 | ppd = private2ppd(file); | 503 | ppd = private2ppd(file); |
491 | dd = ppd->dd; | 504 | dd = ppd->dd; |
492 | 505 | ||
493 | buff = kmalloc(count + 1, GFP_KERNEL); | 506 | buff = kmalloc(count + 1, GFP_KERNEL); |
494 | if (!buff) { | 507 | if (!buff) |
495 | ret = -ENOMEM; | 508 | return -ENOMEM; |
496 | goto do_return; | ||
497 | } | ||
498 | 509 | ||
499 | ret = copy_from_user(buff, buf, count); | 510 | ret = copy_from_user(buff, buf, count); |
500 | if (ret > 0) { | 511 | if (ret > 0) { |
@@ -527,8 +538,6 @@ static ssize_t asic_flags_write(struct file *file, const char __user *buf, | |||
527 | 538 | ||
528 | do_free: | 539 | do_free: |
529 | kfree(buff); | 540 | kfree(buff); |
530 | do_return: | ||
531 | rcu_read_unlock(); | ||
532 | return ret; | 541 | return ret; |
533 | } | 542 | } |
534 | 543 | ||
@@ -542,18 +551,14 @@ static ssize_t qsfp_debugfs_dump(struct file *file, char __user *buf, | |||
542 | char *tmp; | 551 | char *tmp; |
543 | int ret; | 552 | int ret; |
544 | 553 | ||
545 | rcu_read_lock(); | ||
546 | ppd = private2ppd(file); | 554 | ppd = private2ppd(file); |
547 | tmp = kmalloc(PAGE_SIZE, GFP_KERNEL); | 555 | tmp = kmalloc(PAGE_SIZE, GFP_KERNEL); |
548 | if (!tmp) { | 556 | if (!tmp) |
549 | rcu_read_unlock(); | ||
550 | return -ENOMEM; | 557 | return -ENOMEM; |
551 | } | ||
552 | 558 | ||
553 | ret = qsfp_dump(ppd, tmp, PAGE_SIZE); | 559 | ret = qsfp_dump(ppd, tmp, PAGE_SIZE); |
554 | if (ret > 0) | 560 | if (ret > 0) |
555 | ret = simple_read_from_buffer(buf, count, ppos, tmp, ret); | 561 | ret = simple_read_from_buffer(buf, count, ppos, tmp, ret); |
556 | rcu_read_unlock(); | ||
557 | kfree(tmp); | 562 | kfree(tmp); |
558 | return ret; | 563 | return ret; |
559 | } | 564 | } |
@@ -569,7 +574,6 @@ static ssize_t __i2c_debugfs_write(struct file *file, const char __user *buf, | |||
569 | int offset; | 574 | int offset; |
570 | int total_written; | 575 | int total_written; |
571 | 576 | ||
572 | rcu_read_lock(); | ||
573 | ppd = private2ppd(file); | 577 | ppd = private2ppd(file); |
574 | 578 | ||
575 | /* byte offset format: [offsetSize][i2cAddr][offsetHigh][offsetLow] */ | 579 | /* byte offset format: [offsetSize][i2cAddr][offsetHigh][offsetLow] */ |
@@ -577,16 +581,12 @@ static ssize_t __i2c_debugfs_write(struct file *file, const char __user *buf, | |||
577 | offset = *ppos & 0xffff; | 581 | offset = *ppos & 0xffff; |
578 | 582 | ||
579 | /* explicitly reject invalid address 0 to catch cp and cat */ | 583 | /* explicitly reject invalid address 0 to catch cp and cat */ |
580 | if (i2c_addr == 0) { | 584 | if (i2c_addr == 0) |
581 | ret = -EINVAL; | 585 | return -EINVAL; |
582 | goto _return; | ||
583 | } | ||
584 | 586 | ||
585 | buff = kmalloc(count, GFP_KERNEL); | 587 | buff = kmalloc(count, GFP_KERNEL); |
586 | if (!buff) { | 588 | if (!buff) |
587 | ret = -ENOMEM; | 589 | return -ENOMEM; |
588 | goto _return; | ||
589 | } | ||
590 | 590 | ||
591 | ret = copy_from_user(buff, buf, count); | 591 | ret = copy_from_user(buff, buf, count); |
592 | if (ret > 0) { | 592 | if (ret > 0) { |
@@ -606,8 +606,6 @@ static ssize_t __i2c_debugfs_write(struct file *file, const char __user *buf, | |||
606 | 606 | ||
607 | _free: | 607 | _free: |
608 | kfree(buff); | 608 | kfree(buff); |
609 | _return: | ||
610 | rcu_read_unlock(); | ||
611 | return ret; | 609 | return ret; |
612 | } | 610 | } |
613 | 611 | ||
@@ -636,7 +634,6 @@ static ssize_t __i2c_debugfs_read(struct file *file, char __user *buf, | |||
636 | int offset; | 634 | int offset; |
637 | int total_read; | 635 | int total_read; |
638 | 636 | ||
639 | rcu_read_lock(); | ||
640 | ppd = private2ppd(file); | 637 | ppd = private2ppd(file); |
641 | 638 | ||
642 | /* byte offset format: [offsetSize][i2cAddr][offsetHigh][offsetLow] */ | 639 | /* byte offset format: [offsetSize][i2cAddr][offsetHigh][offsetLow] */ |
@@ -644,16 +641,12 @@ static ssize_t __i2c_debugfs_read(struct file *file, char __user *buf, | |||
644 | offset = *ppos & 0xffff; | 641 | offset = *ppos & 0xffff; |
645 | 642 | ||
646 | /* explicitly reject invalid address 0 to catch cp and cat */ | 643 | /* explicitly reject invalid address 0 to catch cp and cat */ |
647 | if (i2c_addr == 0) { | 644 | if (i2c_addr == 0) |
648 | ret = -EINVAL; | 645 | return -EINVAL; |
649 | goto _return; | ||
650 | } | ||
651 | 646 | ||
652 | buff = kmalloc(count, GFP_KERNEL); | 647 | buff = kmalloc(count, GFP_KERNEL); |
653 | if (!buff) { | 648 | if (!buff) |
654 | ret = -ENOMEM; | 649 | return -ENOMEM; |
655 | goto _return; | ||
656 | } | ||
657 | 650 | ||
658 | total_read = i2c_read(ppd, target, i2c_addr, offset, buff, count); | 651 | total_read = i2c_read(ppd, target, i2c_addr, offset, buff, count); |
659 | if (total_read < 0) { | 652 | if (total_read < 0) { |
@@ -673,8 +666,6 @@ static ssize_t __i2c_debugfs_read(struct file *file, char __user *buf, | |||
673 | 666 | ||
674 | _free: | 667 | _free: |
675 | kfree(buff); | 668 | kfree(buff); |
676 | _return: | ||
677 | rcu_read_unlock(); | ||
678 | return ret; | 669 | return ret; |
679 | } | 670 | } |
680 | 671 | ||
@@ -701,26 +692,20 @@ static ssize_t __qsfp_debugfs_write(struct file *file, const char __user *buf, | |||
701 | int ret; | 692 | int ret; |
702 | int total_written; | 693 | int total_written; |
703 | 694 | ||
704 | rcu_read_lock(); | 695 | if (*ppos + count > QSFP_PAGESIZE * 4) /* base page + page00-page03 */ |
705 | if (*ppos + count > QSFP_PAGESIZE * 4) { /* base page + page00-page03 */ | 696 | return -EINVAL; |
706 | ret = -EINVAL; | ||
707 | goto _return; | ||
708 | } | ||
709 | 697 | ||
710 | ppd = private2ppd(file); | 698 | ppd = private2ppd(file); |
711 | 699 | ||
712 | buff = kmalloc(count, GFP_KERNEL); | 700 | buff = kmalloc(count, GFP_KERNEL); |
713 | if (!buff) { | 701 | if (!buff) |
714 | ret = -ENOMEM; | 702 | return -ENOMEM; |
715 | goto _return; | ||
716 | } | ||
717 | 703 | ||
718 | ret = copy_from_user(buff, buf, count); | 704 | ret = copy_from_user(buff, buf, count); |
719 | if (ret > 0) { | 705 | if (ret > 0) { |
720 | ret = -EFAULT; | 706 | ret = -EFAULT; |
721 | goto _free; | 707 | goto _free; |
722 | } | 708 | } |
723 | |||
724 | total_written = qsfp_write(ppd, target, *ppos, buff, count); | 709 | total_written = qsfp_write(ppd, target, *ppos, buff, count); |
725 | if (total_written < 0) { | 710 | if (total_written < 0) { |
726 | ret = total_written; | 711 | ret = total_written; |
@@ -733,8 +718,6 @@ static ssize_t __qsfp_debugfs_write(struct file *file, const char __user *buf, | |||
733 | 718 | ||
734 | _free: | 719 | _free: |
735 | kfree(buff); | 720 | kfree(buff); |
736 | _return: | ||
737 | rcu_read_unlock(); | ||
738 | return ret; | 721 | return ret; |
739 | } | 722 | } |
740 | 723 | ||
@@ -761,7 +744,6 @@ static ssize_t __qsfp_debugfs_read(struct file *file, char __user *buf, | |||
761 | int ret; | 744 | int ret; |
762 | int total_read; | 745 | int total_read; |
763 | 746 | ||
764 | rcu_read_lock(); | ||
765 | if (*ppos + count > QSFP_PAGESIZE * 4) { /* base page + page00-page03 */ | 747 | if (*ppos + count > QSFP_PAGESIZE * 4) { /* base page + page00-page03 */ |
766 | ret = -EINVAL; | 748 | ret = -EINVAL; |
767 | goto _return; | 749 | goto _return; |
@@ -794,7 +776,6 @@ static ssize_t __qsfp_debugfs_read(struct file *file, char __user *buf, | |||
794 | _free: | 776 | _free: |
795 | kfree(buff); | 777 | kfree(buff); |
796 | _return: | 778 | _return: |
797 | rcu_read_unlock(); | ||
798 | return ret; | 779 | return ret; |
799 | } | 780 | } |
800 | 781 | ||
@@ -1010,7 +991,6 @@ void hfi1_dbg_ibdev_exit(struct hfi1_ibdev *ibd) | |||
1010 | debugfs_remove_recursive(ibd->hfi1_ibdev_dbg); | 991 | debugfs_remove_recursive(ibd->hfi1_ibdev_dbg); |
1011 | out: | 992 | out: |
1012 | ibd->hfi1_ibdev_dbg = NULL; | 993 | ibd->hfi1_ibdev_dbg = NULL; |
1013 | synchronize_rcu(); | ||
1014 | } | 994 | } |
1015 | 995 | ||
1016 | /* | 996 | /* |
@@ -1035,9 +1015,7 @@ static const char * const hfi1_statnames[] = { | |||
1035 | }; | 1015 | }; |
1036 | 1016 | ||
1037 | static void *_driver_stats_names_seq_start(struct seq_file *s, loff_t *pos) | 1017 | static void *_driver_stats_names_seq_start(struct seq_file *s, loff_t *pos) |
1038 | __acquires(RCU) | ||
1039 | { | 1018 | { |
1040 | rcu_read_lock(); | ||
1041 | if (*pos >= ARRAY_SIZE(hfi1_statnames)) | 1019 | if (*pos >= ARRAY_SIZE(hfi1_statnames)) |
1042 | return NULL; | 1020 | return NULL; |
1043 | return pos; | 1021 | return pos; |
@@ -1055,9 +1033,7 @@ static void *_driver_stats_names_seq_next( | |||
1055 | } | 1033 | } |
1056 | 1034 | ||
1057 | static void _driver_stats_names_seq_stop(struct seq_file *s, void *v) | 1035 | static void _driver_stats_names_seq_stop(struct seq_file *s, void *v) |
1058 | __releases(RCU) | ||
1059 | { | 1036 | { |
1060 | rcu_read_unlock(); | ||
1061 | } | 1037 | } |
1062 | 1038 | ||
1063 | static int _driver_stats_names_seq_show(struct seq_file *s, void *v) | 1039 | static int _driver_stats_names_seq_show(struct seq_file *s, void *v) |
@@ -1073,9 +1049,7 @@ DEBUGFS_SEQ_FILE_OPEN(driver_stats_names) | |||
1073 | DEBUGFS_FILE_OPS(driver_stats_names); | 1049 | DEBUGFS_FILE_OPS(driver_stats_names); |
1074 | 1050 | ||
1075 | static void *_driver_stats_seq_start(struct seq_file *s, loff_t *pos) | 1051 | static void *_driver_stats_seq_start(struct seq_file *s, loff_t *pos) |
1076 | __acquires(RCU) | ||
1077 | { | 1052 | { |
1078 | rcu_read_lock(); | ||
1079 | if (*pos >= ARRAY_SIZE(hfi1_statnames)) | 1053 | if (*pos >= ARRAY_SIZE(hfi1_statnames)) |
1080 | return NULL; | 1054 | return NULL; |
1081 | return pos; | 1055 | return pos; |
@@ -1090,9 +1064,7 @@ static void *_driver_stats_seq_next(struct seq_file *s, void *v, loff_t *pos) | |||
1090 | } | 1064 | } |
1091 | 1065 | ||
1092 | static void _driver_stats_seq_stop(struct seq_file *s, void *v) | 1066 | static void _driver_stats_seq_stop(struct seq_file *s, void *v) |
1093 | __releases(RCU) | ||
1094 | { | 1067 | { |
1095 | rcu_read_unlock(); | ||
1096 | } | 1068 | } |
1097 | 1069 | ||
1098 | static u64 hfi1_sps_ints(void) | 1070 | static u64 hfi1_sps_ints(void) |
diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h index a021e660d482..325ec211370f 100644 --- a/drivers/infiniband/hw/hfi1/hfi.h +++ b/drivers/infiniband/hw/hfi1/hfi.h | |||
@@ -605,6 +605,7 @@ struct hfi1_pportdata { | |||
605 | struct work_struct freeze_work; | 605 | struct work_struct freeze_work; |
606 | struct work_struct link_downgrade_work; | 606 | struct work_struct link_downgrade_work; |
607 | struct work_struct link_bounce_work; | 607 | struct work_struct link_bounce_work; |
608 | struct delayed_work start_link_work; | ||
608 | /* host link state variables */ | 609 | /* host link state variables */ |
609 | struct mutex hls_lock; | 610 | struct mutex hls_lock; |
610 | u32 host_link_state; | 611 | u32 host_link_state; |
@@ -659,6 +660,7 @@ struct hfi1_pportdata { | |||
659 | u8 linkinit_reason; | 660 | u8 linkinit_reason; |
660 | u8 local_tx_rate; /* rate given to 8051 firmware */ | 661 | u8 local_tx_rate; /* rate given to 8051 firmware */ |
661 | u8 last_pstate; /* info only */ | 662 | u8 last_pstate; /* info only */ |
663 | u8 qsfp_retry_count; | ||
662 | 664 | ||
663 | /* placeholders for IB MAD packet settings */ | 665 | /* placeholders for IB MAD packet settings */ |
664 | u8 overrun_threshold; | 666 | u8 overrun_threshold; |
@@ -1804,7 +1806,7 @@ extern unsigned int hfi1_max_mtu; | |||
1804 | extern unsigned int hfi1_cu; | 1806 | extern unsigned int hfi1_cu; |
1805 | extern unsigned int user_credit_return_threshold; | 1807 | extern unsigned int user_credit_return_threshold; |
1806 | extern int num_user_contexts; | 1808 | extern int num_user_contexts; |
1807 | extern unsigned n_krcvqs; | 1809 | extern unsigned long n_krcvqs; |
1808 | extern uint krcvqs[]; | 1810 | extern uint krcvqs[]; |
1809 | extern int krcvqsset; | 1811 | extern int krcvqsset; |
1810 | extern uint kdeth_qp; | 1812 | extern uint kdeth_qp; |
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c index b7935451093c..384b43d2fd49 100644 --- a/drivers/infiniband/hw/hfi1/init.c +++ b/drivers/infiniband/hw/hfi1/init.c | |||
@@ -94,7 +94,7 @@ module_param_array(krcvqs, uint, &krcvqsset, S_IRUGO); | |||
94 | MODULE_PARM_DESC(krcvqs, "Array of the number of non-control kernel receive queues by VL"); | 94 | MODULE_PARM_DESC(krcvqs, "Array of the number of non-control kernel receive queues by VL"); |
95 | 95 | ||
96 | /* computed based on above array */ | 96 | /* computed based on above array */ |
97 | unsigned n_krcvqs; | 97 | unsigned long n_krcvqs; |
98 | 98 | ||
99 | static unsigned hfi1_rcvarr_split = 25; | 99 | static unsigned hfi1_rcvarr_split = 25; |
100 | module_param_named(rcvarr_split, hfi1_rcvarr_split, uint, S_IRUGO); | 100 | module_param_named(rcvarr_split, hfi1_rcvarr_split, uint, S_IRUGO); |
@@ -500,6 +500,7 @@ void hfi1_init_pportdata(struct pci_dev *pdev, struct hfi1_pportdata *ppd, | |||
500 | INIT_WORK(&ppd->link_downgrade_work, handle_link_downgrade); | 500 | INIT_WORK(&ppd->link_downgrade_work, handle_link_downgrade); |
501 | INIT_WORK(&ppd->sma_message_work, handle_sma_message); | 501 | INIT_WORK(&ppd->sma_message_work, handle_sma_message); |
502 | INIT_WORK(&ppd->link_bounce_work, handle_link_bounce); | 502 | INIT_WORK(&ppd->link_bounce_work, handle_link_bounce); |
503 | INIT_DELAYED_WORK(&ppd->start_link_work, handle_start_link); | ||
503 | INIT_WORK(&ppd->linkstate_active_work, receive_interrupt_work); | 504 | INIT_WORK(&ppd->linkstate_active_work, receive_interrupt_work); |
504 | INIT_WORK(&ppd->qsfp_info.qsfp_work, qsfp_event); | 505 | INIT_WORK(&ppd->qsfp_info.qsfp_work, qsfp_event); |
505 | 506 | ||
diff --git a/drivers/infiniband/hw/hfi1/mad.c b/drivers/infiniband/hw/hfi1/mad.c index 39e42c373a01..7ffc14f21523 100644 --- a/drivers/infiniband/hw/hfi1/mad.c +++ b/drivers/infiniband/hw/hfi1/mad.c | |||
@@ -2604,7 +2604,7 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, | |||
2604 | u8 lq, num_vls; | 2604 | u8 lq, num_vls; |
2605 | u8 res_lli, res_ler; | 2605 | u8 res_lli, res_ler; |
2606 | u64 port_mask; | 2606 | u64 port_mask; |
2607 | unsigned long port_num; | 2607 | u8 port_num; |
2608 | unsigned long vl; | 2608 | unsigned long vl; |
2609 | u32 vl_select_mask; | 2609 | u32 vl_select_mask; |
2610 | int vfi; | 2610 | int vfi; |
@@ -2638,9 +2638,9 @@ static int pma_get_opa_datacounters(struct opa_pma_mad *pmp, | |||
2638 | */ | 2638 | */ |
2639 | port_mask = be64_to_cpu(req->port_select_mask[3]); | 2639 | port_mask = be64_to_cpu(req->port_select_mask[3]); |
2640 | port_num = find_first_bit((unsigned long *)&port_mask, | 2640 | port_num = find_first_bit((unsigned long *)&port_mask, |
2641 | sizeof(port_mask)); | 2641 | sizeof(port_mask) * 8); |
2642 | 2642 | ||
2643 | if ((u8)port_num != port) { | 2643 | if (port_num != port) { |
2644 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | 2644 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
2645 | return reply((struct ib_mad_hdr *)pmp); | 2645 | return reply((struct ib_mad_hdr *)pmp); |
2646 | } | 2646 | } |
@@ -2842,7 +2842,7 @@ static int pma_get_opa_porterrors(struct opa_pma_mad *pmp, | |||
2842 | */ | 2842 | */ |
2843 | port_mask = be64_to_cpu(req->port_select_mask[3]); | 2843 | port_mask = be64_to_cpu(req->port_select_mask[3]); |
2844 | port_num = find_first_bit((unsigned long *)&port_mask, | 2844 | port_num = find_first_bit((unsigned long *)&port_mask, |
2845 | sizeof(port_mask)); | 2845 | sizeof(port_mask) * 8); |
2846 | 2846 | ||
2847 | if (port_num != port) { | 2847 | if (port_num != port) { |
2848 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | 2848 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
@@ -3015,7 +3015,7 @@ static int pma_get_opa_errorinfo(struct opa_pma_mad *pmp, | |||
3015 | */ | 3015 | */ |
3016 | port_mask = be64_to_cpu(req->port_select_mask[3]); | 3016 | port_mask = be64_to_cpu(req->port_select_mask[3]); |
3017 | port_num = find_first_bit((unsigned long *)&port_mask, | 3017 | port_num = find_first_bit((unsigned long *)&port_mask, |
3018 | sizeof(port_mask)); | 3018 | sizeof(port_mask) * 8); |
3019 | 3019 | ||
3020 | if (port_num != port) { | 3020 | if (port_num != port) { |
3021 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | 3021 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
@@ -3252,7 +3252,7 @@ static int pma_set_opa_errorinfo(struct opa_pma_mad *pmp, | |||
3252 | */ | 3252 | */ |
3253 | port_mask = be64_to_cpu(req->port_select_mask[3]); | 3253 | port_mask = be64_to_cpu(req->port_select_mask[3]); |
3254 | port_num = find_first_bit((unsigned long *)&port_mask, | 3254 | port_num = find_first_bit((unsigned long *)&port_mask, |
3255 | sizeof(port_mask)); | 3255 | sizeof(port_mask) * 8); |
3256 | 3256 | ||
3257 | if (port_num != port) { | 3257 | if (port_num != port) { |
3258 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; | 3258 | pmp->mad_hdr.status |= IB_SMP_INVALID_FIELD; |
diff --git a/drivers/infiniband/hw/hfi1/pio_copy.c b/drivers/infiniband/hw/hfi1/pio_copy.c index 8c25e1b58849..3a1ef3056282 100644 --- a/drivers/infiniband/hw/hfi1/pio_copy.c +++ b/drivers/infiniband/hw/hfi1/pio_copy.c | |||
@@ -771,6 +771,9 @@ void seg_pio_copy_mid(struct pio_buf *pbuf, const void *from, size_t nbytes) | |||
771 | read_extra_bytes(pbuf, from, to_fill); | 771 | read_extra_bytes(pbuf, from, to_fill); |
772 | from += to_fill; | 772 | from += to_fill; |
773 | nbytes -= to_fill; | 773 | nbytes -= to_fill; |
774 | /* may not be enough valid bytes left to align */ | ||
775 | if (extra > nbytes) | ||
776 | extra = nbytes; | ||
774 | 777 | ||
775 | /* ...now write carry */ | 778 | /* ...now write carry */ |
776 | dest = pbuf->start + (pbuf->qw_written * sizeof(u64)); | 779 | dest = pbuf->start + (pbuf->qw_written * sizeof(u64)); |
@@ -798,6 +801,15 @@ void seg_pio_copy_mid(struct pio_buf *pbuf, const void *from, size_t nbytes) | |||
798 | read_low_bytes(pbuf, from, extra); | 801 | read_low_bytes(pbuf, from, extra); |
799 | from += extra; | 802 | from += extra; |
800 | nbytes -= extra; | 803 | nbytes -= extra; |
804 | /* | ||
805 | * If no bytes are left, return early - we are done. | ||
806 | * NOTE: This short-circuit is *required* because | ||
807 | * "extra" may have been reduced in size and "from" | ||
808 | * is not aligned, as required when leaving this | ||
809 | * if block. | ||
810 | */ | ||
811 | if (nbytes == 0) | ||
812 | return; | ||
801 | } | 813 | } |
802 | 814 | ||
803 | /* at this point, from is QW aligned */ | 815 | /* at this point, from is QW aligned */ |
diff --git a/drivers/infiniband/hw/hfi1/user_sdma.c b/drivers/infiniband/hw/hfi1/user_sdma.c index 0ecf27903dc2..1694037d1eee 100644 --- a/drivers/infiniband/hw/hfi1/user_sdma.c +++ b/drivers/infiniband/hw/hfi1/user_sdma.c | |||
@@ -114,6 +114,8 @@ MODULE_PARM_DESC(sdma_comp_size, "Size of User SDMA completion ring. Default: 12 | |||
114 | #define KDETH_HCRC_LOWER_SHIFT 24 | 114 | #define KDETH_HCRC_LOWER_SHIFT 24 |
115 | #define KDETH_HCRC_LOWER_MASK 0xff | 115 | #define KDETH_HCRC_LOWER_MASK 0xff |
116 | 116 | ||
117 | #define AHG_KDETH_INTR_SHIFT 12 | ||
118 | |||
117 | #define PBC2LRH(x) ((((x) & 0xfff) << 2) - 4) | 119 | #define PBC2LRH(x) ((((x) & 0xfff) << 2) - 4) |
118 | #define LRH2PBC(x) ((((x) >> 2) + 1) & 0xfff) | 120 | #define LRH2PBC(x) ((((x) >> 2) + 1) & 0xfff) |
119 | 121 | ||
@@ -1480,7 +1482,8 @@ static int set_txreq_header_ahg(struct user_sdma_request *req, | |||
1480 | /* Clear KDETH.SH on last packet */ | 1482 | /* Clear KDETH.SH on last packet */ |
1481 | if (unlikely(tx->flags & TXREQ_FLAGS_REQ_LAST_PKT)) { | 1483 | if (unlikely(tx->flags & TXREQ_FLAGS_REQ_LAST_PKT)) { |
1482 | val |= cpu_to_le16(KDETH_GET(hdr->kdeth.ver_tid_offset, | 1484 | val |= cpu_to_le16(KDETH_GET(hdr->kdeth.ver_tid_offset, |
1483 | INTR) >> 16); | 1485 | INTR) << |
1486 | AHG_KDETH_INTR_SHIFT); | ||
1484 | val &= cpu_to_le16(~(1U << 13)); | 1487 | val &= cpu_to_le16(~(1U << 13)); |
1485 | AHG_HEADER_SET(req->ahg, diff, 7, 16, 14, val); | 1488 | AHG_HEADER_SET(req->ahg, diff, 7, 16, 14, val); |
1486 | } else { | 1489 | } else { |
diff --git a/drivers/infiniband/hw/i40iw/i40iw_hw.c b/drivers/infiniband/hw/i40iw/i40iw_hw.c index 3ee0cad96bc6..0c92a40b3e86 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_hw.c +++ b/drivers/infiniband/hw/i40iw/i40iw_hw.c | |||
@@ -265,6 +265,7 @@ void i40iw_next_iw_state(struct i40iw_qp *iwqp, | |||
265 | info.dont_send_fin = false; | 265 | info.dont_send_fin = false; |
266 | if (iwqp->sc_qp.term_flags && (state == I40IW_QP_STATE_ERROR)) | 266 | if (iwqp->sc_qp.term_flags && (state == I40IW_QP_STATE_ERROR)) |
267 | info.reset_tcp_conn = true; | 267 | info.reset_tcp_conn = true; |
268 | iwqp->hw_iwarp_state = state; | ||
268 | i40iw_hw_modify_qp(iwqp->iwdev, iwqp, &info, 0); | 269 | i40iw_hw_modify_qp(iwqp->iwdev, iwqp, &info, 0); |
269 | } | 270 | } |
270 | 271 | ||
diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c index 0cbbe4038298..445e230d5ff8 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_main.c +++ b/drivers/infiniband/hw/i40iw/i40iw_main.c | |||
@@ -100,7 +100,7 @@ static struct notifier_block i40iw_net_notifier = { | |||
100 | .notifier_call = i40iw_net_event | 100 | .notifier_call = i40iw_net_event |
101 | }; | 101 | }; |
102 | 102 | ||
103 | static int i40iw_notifiers_registered; | 103 | static atomic_t i40iw_notifiers_registered; |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * i40iw_find_i40e_handler - find a handler given a client info | 106 | * i40iw_find_i40e_handler - find a handler given a client info |
@@ -1342,12 +1342,11 @@ exit: | |||
1342 | */ | 1342 | */ |
1343 | static void i40iw_register_notifiers(void) | 1343 | static void i40iw_register_notifiers(void) |
1344 | { | 1344 | { |
1345 | if (!i40iw_notifiers_registered) { | 1345 | if (atomic_inc_return(&i40iw_notifiers_registered) == 1) { |
1346 | register_inetaddr_notifier(&i40iw_inetaddr_notifier); | 1346 | register_inetaddr_notifier(&i40iw_inetaddr_notifier); |
1347 | register_inet6addr_notifier(&i40iw_inetaddr6_notifier); | 1347 | register_inet6addr_notifier(&i40iw_inetaddr6_notifier); |
1348 | register_netevent_notifier(&i40iw_net_notifier); | 1348 | register_netevent_notifier(&i40iw_net_notifier); |
1349 | } | 1349 | } |
1350 | i40iw_notifiers_registered++; | ||
1351 | } | 1350 | } |
1352 | 1351 | ||
1353 | /** | 1352 | /** |
@@ -1429,8 +1428,7 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset, bool del | |||
1429 | i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx); | 1428 | i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx); |
1430 | /* fallthrough */ | 1429 | /* fallthrough */ |
1431 | case INET_NOTIFIER: | 1430 | case INET_NOTIFIER: |
1432 | if (i40iw_notifiers_registered > 0) { | 1431 | if (!atomic_dec_return(&i40iw_notifiers_registered)) { |
1433 | i40iw_notifiers_registered--; | ||
1434 | unregister_netevent_notifier(&i40iw_net_notifier); | 1432 | unregister_netevent_notifier(&i40iw_net_notifier); |
1435 | unregister_inetaddr_notifier(&i40iw_inetaddr_notifier); | 1433 | unregister_inetaddr_notifier(&i40iw_inetaddr_notifier); |
1436 | unregister_inet6addr_notifier(&i40iw_inetaddr6_notifier); | 1434 | unregister_inet6addr_notifier(&i40iw_inetaddr6_notifier); |
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index 006db6436e3b..5df63dacaaa3 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c | |||
@@ -687,12 +687,6 @@ repoll: | |||
687 | is_error = (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == | 687 | is_error = (cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == |
688 | MLX4_CQE_OPCODE_ERROR; | 688 | MLX4_CQE_OPCODE_ERROR; |
689 | 689 | ||
690 | if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == MLX4_OPCODE_NOP && | ||
691 | is_send)) { | ||
692 | pr_warn("Completion for NOP opcode detected!\n"); | ||
693 | return -EAGAIN; | ||
694 | } | ||
695 | |||
696 | /* Resize CQ in progress */ | 690 | /* Resize CQ in progress */ |
697 | if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == MLX4_CQE_OPCODE_RESIZE)) { | 691 | if (unlikely((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) == MLX4_CQE_OPCODE_RESIZE)) { |
698 | if (cq->resize_buf) { | 692 | if (cq->resize_buf) { |
@@ -718,12 +712,6 @@ repoll: | |||
718 | */ | 712 | */ |
719 | mqp = __mlx4_qp_lookup(to_mdev(cq->ibcq.device)->dev, | 713 | mqp = __mlx4_qp_lookup(to_mdev(cq->ibcq.device)->dev, |
720 | be32_to_cpu(cqe->vlan_my_qpn)); | 714 | be32_to_cpu(cqe->vlan_my_qpn)); |
721 | if (unlikely(!mqp)) { | ||
722 | pr_warn("CQ %06x with entry for unknown QPN %06x\n", | ||
723 | cq->mcq.cqn, be32_to_cpu(cqe->vlan_my_qpn) & MLX4_CQE_QPN_MASK); | ||
724 | return -EAGAIN; | ||
725 | } | ||
726 | |||
727 | *cur_qp = to_mibqp(mqp); | 715 | *cur_qp = to_mibqp(mqp); |
728 | } | 716 | } |
729 | 717 | ||
@@ -736,11 +724,6 @@ repoll: | |||
736 | /* SRQ is also in the radix tree */ | 724 | /* SRQ is also in the radix tree */ |
737 | msrq = mlx4_srq_lookup(to_mdev(cq->ibcq.device)->dev, | 725 | msrq = mlx4_srq_lookup(to_mdev(cq->ibcq.device)->dev, |
738 | srq_num); | 726 | srq_num); |
739 | if (unlikely(!msrq)) { | ||
740 | pr_warn("CQ %06x with entry for unknown SRQN %06x\n", | ||
741 | cq->mcq.cqn, srq_num); | ||
742 | return -EAGAIN; | ||
743 | } | ||
744 | } | 727 | } |
745 | 728 | ||
746 | if (is_send) { | 729 | if (is_send) { |
@@ -891,7 +874,6 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) | |||
891 | struct mlx4_ib_qp *cur_qp = NULL; | 874 | struct mlx4_ib_qp *cur_qp = NULL; |
892 | unsigned long flags; | 875 | unsigned long flags; |
893 | int npolled; | 876 | int npolled; |
894 | int err = 0; | ||
895 | struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); | 877 | struct mlx4_ib_dev *mdev = to_mdev(cq->ibcq.device); |
896 | 878 | ||
897 | spin_lock_irqsave(&cq->lock, flags); | 879 | spin_lock_irqsave(&cq->lock, flags); |
@@ -901,8 +883,7 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) | |||
901 | } | 883 | } |
902 | 884 | ||
903 | for (npolled = 0; npolled < num_entries; ++npolled) { | 885 | for (npolled = 0; npolled < num_entries; ++npolled) { |
904 | err = mlx4_ib_poll_one(cq, &cur_qp, wc + npolled); | 886 | if (mlx4_ib_poll_one(cq, &cur_qp, wc + npolled)) |
905 | if (err) | ||
906 | break; | 887 | break; |
907 | } | 888 | } |
908 | 889 | ||
@@ -911,10 +892,7 @@ int mlx4_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) | |||
911 | out: | 892 | out: |
912 | spin_unlock_irqrestore(&cq->lock, flags); | 893 | spin_unlock_irqrestore(&cq->lock, flags); |
913 | 894 | ||
914 | if (err == 0 || err == -EAGAIN) | 895 | return npolled; |
915 | return npolled; | ||
916 | else | ||
917 | return err; | ||
918 | } | 896 | } |
919 | 897 | ||
920 | int mlx4_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) | 898 | int mlx4_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 9c2e53d28f98..0f21c3a25552 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -1128,6 +1128,27 @@ void handle_port_mgmt_change_event(struct work_struct *work) | |||
1128 | 1128 | ||
1129 | /* Generate GUID changed event */ | 1129 | /* Generate GUID changed event */ |
1130 | if (changed_attr & MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK) { | 1130 | if (changed_attr & MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK) { |
1131 | if (mlx4_is_master(dev->dev)) { | ||
1132 | union ib_gid gid; | ||
1133 | int err = 0; | ||
1134 | |||
1135 | if (!eqe->event.port_mgmt_change.params.port_info.gid_prefix) | ||
1136 | err = __mlx4_ib_query_gid(&dev->ib_dev, port, 0, &gid, 1); | ||
1137 | else | ||
1138 | gid.global.subnet_prefix = | ||
1139 | eqe->event.port_mgmt_change.params.port_info.gid_prefix; | ||
1140 | if (err) { | ||
1141 | pr_warn("Could not change QP1 subnet prefix for port %d: query_gid error (%d)\n", | ||
1142 | port, err); | ||
1143 | } else { | ||
1144 | pr_debug("Changing QP1 subnet prefix for port %d. old=0x%llx. new=0x%llx\n", | ||
1145 | port, | ||
1146 | (u64)atomic64_read(&dev->sriov.demux[port - 1].subnet_prefix), | ||
1147 | be64_to_cpu(gid.global.subnet_prefix)); | ||
1148 | atomic64_set(&dev->sriov.demux[port - 1].subnet_prefix, | ||
1149 | be64_to_cpu(gid.global.subnet_prefix)); | ||
1150 | } | ||
1151 | } | ||
1131 | mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE); | 1152 | mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE); |
1132 | /*if master, notify all slaves*/ | 1153 | /*if master, notify all slaves*/ |
1133 | if (mlx4_is_master(dev->dev)) | 1154 | if (mlx4_is_master(dev->dev)) |
@@ -2202,6 +2223,8 @@ int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev) | |||
2202 | if (err) | 2223 | if (err) |
2203 | goto demux_err; | 2224 | goto demux_err; |
2204 | dev->sriov.demux[i].guid_cache[0] = gid.global.interface_id; | 2225 | dev->sriov.demux[i].guid_cache[0] = gid.global.interface_id; |
2226 | atomic64_set(&dev->sriov.demux[i].subnet_prefix, | ||
2227 | be64_to_cpu(gid.global.subnet_prefix)); | ||
2205 | err = alloc_pv_object(dev, mlx4_master_func_num(dev->dev), i + 1, | 2228 | err = alloc_pv_object(dev, mlx4_master_func_num(dev->dev), i + 1, |
2206 | &dev->sriov.sqps[i]); | 2229 | &dev->sriov.sqps[i]); |
2207 | if (err) | 2230 | if (err) |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 2af44c2de262..87ba9bca4181 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -2202,6 +2202,9 @@ static int mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev) | |||
2202 | bool per_port = !!(ibdev->dev->caps.flags2 & | 2202 | bool per_port = !!(ibdev->dev->caps.flags2 & |
2203 | MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT); | 2203 | MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT); |
2204 | 2204 | ||
2205 | if (mlx4_is_slave(ibdev->dev)) | ||
2206 | return 0; | ||
2207 | |||
2205 | for (i = 0; i < MLX4_DIAG_COUNTERS_TYPES; i++) { | 2208 | for (i = 0; i < MLX4_DIAG_COUNTERS_TYPES; i++) { |
2206 | /* i == 1 means we are building port counters */ | 2209 | /* i == 1 means we are building port counters */ |
2207 | if (i && !per_port) | 2210 | if (i && !per_port) |
diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c index 8f7ad07915b0..097bfcc4ee99 100644 --- a/drivers/infiniband/hw/mlx4/mcg.c +++ b/drivers/infiniband/hw/mlx4/mcg.c | |||
@@ -489,7 +489,7 @@ static u8 get_leave_state(struct mcast_group *group) | |||
489 | if (!group->members[i]) | 489 | if (!group->members[i]) |
490 | leave_state |= (1 << i); | 490 | leave_state |= (1 << i); |
491 | 491 | ||
492 | return leave_state & (group->rec.scope_join_state & 7); | 492 | return leave_state & (group->rec.scope_join_state & 0xf); |
493 | } | 493 | } |
494 | 494 | ||
495 | static int join_group(struct mcast_group *group, int slave, u8 join_mask) | 495 | static int join_group(struct mcast_group *group, int slave, u8 join_mask) |
@@ -564,8 +564,8 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work) | |||
564 | } else | 564 | } else |
565 | mcg_warn_group(group, "DRIVER BUG\n"); | 565 | mcg_warn_group(group, "DRIVER BUG\n"); |
566 | } else if (group->state == MCAST_LEAVE_SENT) { | 566 | } else if (group->state == MCAST_LEAVE_SENT) { |
567 | if (group->rec.scope_join_state & 7) | 567 | if (group->rec.scope_join_state & 0xf) |
568 | group->rec.scope_join_state &= 0xf8; | 568 | group->rec.scope_join_state &= 0xf0; |
569 | group->state = MCAST_IDLE; | 569 | group->state = MCAST_IDLE; |
570 | mutex_unlock(&group->lock); | 570 | mutex_unlock(&group->lock); |
571 | if (release_group(group, 1)) | 571 | if (release_group(group, 1)) |
@@ -605,7 +605,7 @@ static int handle_leave_req(struct mcast_group *group, u8 leave_mask, | |||
605 | static int handle_join_req(struct mcast_group *group, u8 join_mask, | 605 | static int handle_join_req(struct mcast_group *group, u8 join_mask, |
606 | struct mcast_req *req) | 606 | struct mcast_req *req) |
607 | { | 607 | { |
608 | u8 group_join_state = group->rec.scope_join_state & 7; | 608 | u8 group_join_state = group->rec.scope_join_state & 0xf; |
609 | int ref = 0; | 609 | int ref = 0; |
610 | u16 status; | 610 | u16 status; |
611 | struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; | 611 | struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; |
@@ -690,8 +690,8 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work) | |||
690 | u8 cur_join_state; | 690 | u8 cur_join_state; |
691 | 691 | ||
692 | resp_join_state = ((struct ib_sa_mcmember_data *) | 692 | resp_join_state = ((struct ib_sa_mcmember_data *) |
693 | group->response_sa_mad.data)->scope_join_state & 7; | 693 | group->response_sa_mad.data)->scope_join_state & 0xf; |
694 | cur_join_state = group->rec.scope_join_state & 7; | 694 | cur_join_state = group->rec.scope_join_state & 0xf; |
695 | 695 | ||
696 | if (method == IB_MGMT_METHOD_GET_RESP) { | 696 | if (method == IB_MGMT_METHOD_GET_RESP) { |
697 | /* successfull join */ | 697 | /* successfull join */ |
@@ -710,7 +710,7 @@ process_requests: | |||
710 | req = list_first_entry(&group->pending_list, struct mcast_req, | 710 | req = list_first_entry(&group->pending_list, struct mcast_req, |
711 | group_list); | 711 | group_list); |
712 | sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; | 712 | sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; |
713 | req_join_state = sa_data->scope_join_state & 0x7; | 713 | req_join_state = sa_data->scope_join_state & 0xf; |
714 | 714 | ||
715 | /* For a leave request, we will immediately answer the VF, and | 715 | /* For a leave request, we will immediately answer the VF, and |
716 | * update our internal counters. The actual leave will be sent | 716 | * update our internal counters. The actual leave will be sent |
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index 7c5832ede4bd..686ab48ff644 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h | |||
@@ -448,7 +448,7 @@ struct mlx4_ib_demux_ctx { | |||
448 | struct workqueue_struct *wq; | 448 | struct workqueue_struct *wq; |
449 | struct workqueue_struct *ud_wq; | 449 | struct workqueue_struct *ud_wq; |
450 | spinlock_t ud_lock; | 450 | spinlock_t ud_lock; |
451 | __be64 subnet_prefix; | 451 | atomic64_t subnet_prefix; |
452 | __be64 guid_cache[128]; | 452 | __be64 guid_cache[128]; |
453 | struct mlx4_ib_dev *dev; | 453 | struct mlx4_ib_dev *dev; |
454 | /* the following lock protects both mcg_table and mcg_mgid0_list */ | 454 | /* the following lock protects both mcg_table and mcg_mgid0_list */ |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 768085f59566..7fb9629bd12b 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -2493,24 +2493,27 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr, | |||
2493 | sqp->ud_header.grh.flow_label = | 2493 | sqp->ud_header.grh.flow_label = |
2494 | ah->av.ib.sl_tclass_flowlabel & cpu_to_be32(0xfffff); | 2494 | ah->av.ib.sl_tclass_flowlabel & cpu_to_be32(0xfffff); |
2495 | sqp->ud_header.grh.hop_limit = ah->av.ib.hop_limit; | 2495 | sqp->ud_header.grh.hop_limit = ah->av.ib.hop_limit; |
2496 | if (is_eth) | 2496 | if (is_eth) { |
2497 | memcpy(sqp->ud_header.grh.source_gid.raw, sgid.raw, 16); | 2497 | memcpy(sqp->ud_header.grh.source_gid.raw, sgid.raw, 16); |
2498 | else { | 2498 | } else { |
2499 | if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { | 2499 | if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { |
2500 | /* When multi-function is enabled, the ib_core gid | 2500 | /* When multi-function is enabled, the ib_core gid |
2501 | * indexes don't necessarily match the hw ones, so | 2501 | * indexes don't necessarily match the hw ones, so |
2502 | * we must use our own cache */ | 2502 | * we must use our own cache |
2503 | sqp->ud_header.grh.source_gid.global.subnet_prefix = | 2503 | */ |
2504 | to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. | 2504 | sqp->ud_header.grh.source_gid.global.subnet_prefix = |
2505 | subnet_prefix; | 2505 | cpu_to_be64(atomic64_read(&(to_mdev(ib_dev)->sriov. |
2506 | sqp->ud_header.grh.source_gid.global.interface_id = | 2506 | demux[sqp->qp.port - 1]. |
2507 | to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. | 2507 | subnet_prefix))); |
2508 | guid_cache[ah->av.ib.gid_index]; | 2508 | sqp->ud_header.grh.source_gid.global.interface_id = |
2509 | } else | 2509 | to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. |
2510 | ib_get_cached_gid(ib_dev, | 2510 | guid_cache[ah->av.ib.gid_index]; |
2511 | be32_to_cpu(ah->av.ib.port_pd) >> 24, | 2511 | } else { |
2512 | ah->av.ib.gid_index, | 2512 | ib_get_cached_gid(ib_dev, |
2513 | &sqp->ud_header.grh.source_gid, NULL); | 2513 | be32_to_cpu(ah->av.ib.port_pd) >> 24, |
2514 | ah->av.ib.gid_index, | ||
2515 | &sqp->ud_header.grh.source_gid, NULL); | ||
2516 | } | ||
2514 | } | 2517 | } |
2515 | memcpy(sqp->ud_header.grh.destination_gid.raw, | 2518 | memcpy(sqp->ud_header.grh.destination_gid.raw, |
2516 | ah->av.ib.dgid, 16); | 2519 | ah->av.ib.dgid, 16); |
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c index 308a358e5b46..e4fac9292e4a 100644 --- a/drivers/infiniband/hw/mlx5/cq.c +++ b/drivers/infiniband/hw/mlx5/cq.c | |||
@@ -553,12 +553,6 @@ repoll: | |||
553 | * from the table. | 553 | * from the table. |
554 | */ | 554 | */ |
555 | mqp = __mlx5_qp_lookup(dev->mdev, qpn); | 555 | mqp = __mlx5_qp_lookup(dev->mdev, qpn); |
556 | if (unlikely(!mqp)) { | ||
557 | mlx5_ib_warn(dev, "CQE@CQ %06x for unknown QPN %6x\n", | ||
558 | cq->mcq.cqn, qpn); | ||
559 | return -EINVAL; | ||
560 | } | ||
561 | |||
562 | *cur_qp = to_mibqp(mqp); | 556 | *cur_qp = to_mibqp(mqp); |
563 | } | 557 | } |
564 | 558 | ||
@@ -619,13 +613,6 @@ repoll: | |||
619 | read_lock(&dev->mdev->priv.mkey_table.lock); | 613 | read_lock(&dev->mdev->priv.mkey_table.lock); |
620 | mmkey = __mlx5_mr_lookup(dev->mdev, | 614 | mmkey = __mlx5_mr_lookup(dev->mdev, |
621 | mlx5_base_mkey(be32_to_cpu(sig_err_cqe->mkey))); | 615 | mlx5_base_mkey(be32_to_cpu(sig_err_cqe->mkey))); |
622 | if (unlikely(!mmkey)) { | ||
623 | read_unlock(&dev->mdev->priv.mkey_table.lock); | ||
624 | mlx5_ib_warn(dev, "CQE@CQ %06x for unknown MR %6x\n", | ||
625 | cq->mcq.cqn, be32_to_cpu(sig_err_cqe->mkey)); | ||
626 | return -EINVAL; | ||
627 | } | ||
628 | |||
629 | mr = to_mibmr(mmkey); | 616 | mr = to_mibmr(mmkey); |
630 | get_sig_err_item(sig_err_cqe, &mr->sig->err_item); | 617 | get_sig_err_item(sig_err_cqe, &mr->sig->err_item); |
631 | mr->sig->sig_err_exists = true; | 618 | mr->sig->sig_err_exists = true; |
@@ -676,7 +663,6 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) | |||
676 | unsigned long flags; | 663 | unsigned long flags; |
677 | int soft_polled = 0; | 664 | int soft_polled = 0; |
678 | int npolled; | 665 | int npolled; |
679 | int err = 0; | ||
680 | 666 | ||
681 | spin_lock_irqsave(&cq->lock, flags); | 667 | spin_lock_irqsave(&cq->lock, flags); |
682 | if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { | 668 | if (mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { |
@@ -688,8 +674,7 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) | |||
688 | soft_polled = poll_soft_wc(cq, num_entries, wc); | 674 | soft_polled = poll_soft_wc(cq, num_entries, wc); |
689 | 675 | ||
690 | for (npolled = 0; npolled < num_entries - soft_polled; npolled++) { | 676 | for (npolled = 0; npolled < num_entries - soft_polled; npolled++) { |
691 | err = mlx5_poll_one(cq, &cur_qp, wc + soft_polled + npolled); | 677 | if (mlx5_poll_one(cq, &cur_qp, wc + soft_polled + npolled)) |
692 | if (err) | ||
693 | break; | 678 | break; |
694 | } | 679 | } |
695 | 680 | ||
@@ -698,10 +683,7 @@ int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc) | |||
698 | out: | 683 | out: |
699 | spin_unlock_irqrestore(&cq->lock, flags); | 684 | spin_unlock_irqrestore(&cq->lock, flags); |
700 | 685 | ||
701 | if (err == 0 || err == -EAGAIN) | 686 | return soft_polled + npolled; |
702 | return soft_polled + npolled; | ||
703 | else | ||
704 | return err; | ||
705 | } | 687 | } |
706 | 688 | ||
707 | int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) | 689 | int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags) |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 1b4094baa2de..e19537cf44ab 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -288,7 +288,9 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num, | |||
288 | 288 | ||
289 | static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev) | 289 | static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev) |
290 | { | 290 | { |
291 | return !MLX5_CAP_GEN(dev->mdev, ib_virt); | 291 | if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB) |
292 | return !MLX5_CAP_GEN(dev->mdev, ib_virt); | ||
293 | return 0; | ||
292 | } | 294 | } |
293 | 295 | ||
294 | enum { | 296 | enum { |
@@ -1428,6 +1430,13 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v, | |||
1428 | dmac_47_16), | 1430 | dmac_47_16), |
1429 | ib_spec->eth.val.dst_mac); | 1431 | ib_spec->eth.val.dst_mac); |
1430 | 1432 | ||
1433 | ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_c, | ||
1434 | smac_47_16), | ||
1435 | ib_spec->eth.mask.src_mac); | ||
1436 | ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_v, | ||
1437 | smac_47_16), | ||
1438 | ib_spec->eth.val.src_mac); | ||
1439 | |||
1431 | if (ib_spec->eth.mask.vlan_tag) { | 1440 | if (ib_spec->eth.mask.vlan_tag) { |
1432 | MLX5_SET(fte_match_set_lyr_2_4, outer_headers_c, | 1441 | MLX5_SET(fte_match_set_lyr_2_4, outer_headers_c, |
1433 | vlan_tag, 1); | 1442 | vlan_tag, 1); |
@@ -1849,6 +1858,7 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp, | |||
1849 | int domain) | 1858 | int domain) |
1850 | { | 1859 | { |
1851 | struct mlx5_ib_dev *dev = to_mdev(qp->device); | 1860 | struct mlx5_ib_dev *dev = to_mdev(qp->device); |
1861 | struct mlx5_ib_qp *mqp = to_mqp(qp); | ||
1852 | struct mlx5_ib_flow_handler *handler = NULL; | 1862 | struct mlx5_ib_flow_handler *handler = NULL; |
1853 | struct mlx5_flow_destination *dst = NULL; | 1863 | struct mlx5_flow_destination *dst = NULL; |
1854 | struct mlx5_ib_flow_prio *ft_prio; | 1864 | struct mlx5_ib_flow_prio *ft_prio; |
@@ -1875,7 +1885,10 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp, | |||
1875 | } | 1885 | } |
1876 | 1886 | ||
1877 | dst->type = MLX5_FLOW_DESTINATION_TYPE_TIR; | 1887 | dst->type = MLX5_FLOW_DESTINATION_TYPE_TIR; |
1878 | dst->tir_num = to_mqp(qp)->raw_packet_qp.rq.tirn; | 1888 | if (mqp->flags & MLX5_IB_QP_RSS) |
1889 | dst->tir_num = mqp->rss_qp.tirn; | ||
1890 | else | ||
1891 | dst->tir_num = mqp->raw_packet_qp.rq.tirn; | ||
1879 | 1892 | ||
1880 | if (flow_attr->type == IB_FLOW_ATTR_NORMAL) { | 1893 | if (flow_attr->type == IB_FLOW_ATTR_NORMAL) { |
1881 | if (flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) { | 1894 | if (flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) { |
diff --git a/drivers/infiniband/hw/mlx5/mem.c b/drivers/infiniband/hw/mlx5/mem.c index 40df2cca0609..996b54e366b0 100644 --- a/drivers/infiniband/hw/mlx5/mem.c +++ b/drivers/infiniband/hw/mlx5/mem.c | |||
@@ -71,7 +71,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, | |||
71 | 71 | ||
72 | addr = addr >> page_shift; | 72 | addr = addr >> page_shift; |
73 | tmp = (unsigned long)addr; | 73 | tmp = (unsigned long)addr; |
74 | m = find_first_bit(&tmp, sizeof(tmp)); | 74 | m = find_first_bit(&tmp, BITS_PER_LONG); |
75 | skip = 1 << m; | 75 | skip = 1 << m; |
76 | mask = skip - 1; | 76 | mask = skip - 1; |
77 | i = 0; | 77 | i = 0; |
@@ -81,7 +81,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, | |||
81 | for (k = 0; k < len; k++) { | 81 | for (k = 0; k < len; k++) { |
82 | if (!(i & mask)) { | 82 | if (!(i & mask)) { |
83 | tmp = (unsigned long)pfn; | 83 | tmp = (unsigned long)pfn; |
84 | m = min_t(unsigned long, m, find_first_bit(&tmp, sizeof(tmp))); | 84 | m = min_t(unsigned long, m, find_first_bit(&tmp, BITS_PER_LONG)); |
85 | skip = 1 << m; | 85 | skip = 1 << m; |
86 | mask = skip - 1; | 86 | mask = skip - 1; |
87 | base = pfn; | 87 | base = pfn; |
@@ -89,7 +89,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, | |||
89 | } else { | 89 | } else { |
90 | if (base + p != pfn) { | 90 | if (base + p != pfn) { |
91 | tmp = (unsigned long)p; | 91 | tmp = (unsigned long)p; |
92 | m = find_first_bit(&tmp, sizeof(tmp)); | 92 | m = find_first_bit(&tmp, BITS_PER_LONG); |
93 | skip = 1 << m; | 93 | skip = 1 << m; |
94 | mask = skip - 1; | 94 | mask = skip - 1; |
95 | base = pfn; | 95 | base = pfn; |
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index 372385d0f993..95146f4aa3e3 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h | |||
@@ -402,6 +402,7 @@ enum mlx5_ib_qp_flags { | |||
402 | /* QP uses 1 as its source QP number */ | 402 | /* QP uses 1 as its source QP number */ |
403 | MLX5_IB_QP_SQPN_QP1 = 1 << 6, | 403 | MLX5_IB_QP_SQPN_QP1 = 1 << 6, |
404 | MLX5_IB_QP_CAP_SCATTER_FCS = 1 << 7, | 404 | MLX5_IB_QP_CAP_SCATTER_FCS = 1 << 7, |
405 | MLX5_IB_QP_RSS = 1 << 8, | ||
405 | }; | 406 | }; |
406 | 407 | ||
407 | struct mlx5_umr_wr { | 408 | struct mlx5_umr_wr { |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 0dd7d93cac95..affc3f6598ca 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
@@ -1449,6 +1449,7 @@ create_tir: | |||
1449 | kvfree(in); | 1449 | kvfree(in); |
1450 | /* qpn is reserved for that QP */ | 1450 | /* qpn is reserved for that QP */ |
1451 | qp->trans_qp.base.mqp.qpn = 0; | 1451 | qp->trans_qp.base.mqp.qpn = 0; |
1452 | qp->flags |= MLX5_IB_QP_RSS; | ||
1452 | return 0; | 1453 | return 0; |
1453 | 1454 | ||
1454 | err: | 1455 | err: |
@@ -3658,12 +3659,8 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, | |||
3658 | struct ib_send_wr *wr, unsigned *idx, | 3659 | struct ib_send_wr *wr, unsigned *idx, |
3659 | int *size, int nreq) | 3660 | int *size, int nreq) |
3660 | { | 3661 | { |
3661 | int err = 0; | 3662 | if (unlikely(mlx5_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq))) |
3662 | 3663 | return -ENOMEM; | |
3663 | if (unlikely(mlx5_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq))) { | ||
3664 | err = -ENOMEM; | ||
3665 | return err; | ||
3666 | } | ||
3667 | 3664 | ||
3668 | *idx = qp->sq.cur_post & (qp->sq.wqe_cnt - 1); | 3665 | *idx = qp->sq.cur_post & (qp->sq.wqe_cnt - 1); |
3669 | *seg = mlx5_get_send_wqe(qp, *idx); | 3666 | *seg = mlx5_get_send_wqe(qp, *idx); |
@@ -3679,7 +3676,7 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg, | |||
3679 | *seg += sizeof(**ctrl); | 3676 | *seg += sizeof(**ctrl); |
3680 | *size = sizeof(**ctrl) / 16; | 3677 | *size = sizeof(**ctrl) / 16; |
3681 | 3678 | ||
3682 | return err; | 3679 | return 0; |
3683 | } | 3680 | } |
3684 | 3681 | ||
3685 | static void finish_wqe(struct mlx5_ib_qp *qp, | 3682 | static void finish_wqe(struct mlx5_ib_qp *qp, |
@@ -3758,7 +3755,7 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, | |||
3758 | num_sge = wr->num_sge; | 3755 | num_sge = wr->num_sge; |
3759 | if (unlikely(num_sge > qp->sq.max_gs)) { | 3756 | if (unlikely(num_sge > qp->sq.max_gs)) { |
3760 | mlx5_ib_warn(dev, "\n"); | 3757 | mlx5_ib_warn(dev, "\n"); |
3761 | err = -ENOMEM; | 3758 | err = -EINVAL; |
3762 | *bad_wr = wr; | 3759 | *bad_wr = wr; |
3763 | goto out; | 3760 | goto out; |
3764 | } | 3761 | } |
diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c index 80c4b6b401b8..46b64970058e 100644 --- a/drivers/infiniband/sw/rdmavt/mr.c +++ b/drivers/infiniband/sw/rdmavt/mr.c | |||
@@ -294,7 +294,7 @@ static void __rvt_free_mr(struct rvt_mr *mr) | |||
294 | { | 294 | { |
295 | rvt_deinit_mregion(&mr->mr); | 295 | rvt_deinit_mregion(&mr->mr); |
296 | rvt_free_lkey(&mr->mr); | 296 | rvt_free_lkey(&mr->mr); |
297 | vfree(mr); | 297 | kfree(mr); |
298 | } | 298 | } |
299 | 299 | ||
300 | /** | 300 | /** |
diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c index 55f0e8f0ca79..ddd59270ff6d 100644 --- a/drivers/infiniband/sw/rxe/rxe.c +++ b/drivers/infiniband/sw/rxe/rxe.c | |||
@@ -362,15 +362,34 @@ static int __init rxe_module_init(void) | |||
362 | return err; | 362 | return err; |
363 | } | 363 | } |
364 | 364 | ||
365 | err = rxe_net_init(); | 365 | err = rxe_net_ipv4_init(); |
366 | if (err) { | 366 | if (err) { |
367 | pr_err("rxe: unable to init\n"); | 367 | pr_err("rxe: unable to init ipv4 tunnel\n"); |
368 | rxe_cache_exit(); | 368 | rxe_cache_exit(); |
369 | return err; | 369 | goto exit; |
370 | } | ||
371 | |||
372 | err = rxe_net_ipv6_init(); | ||
373 | if (err) { | ||
374 | pr_err("rxe: unable to init ipv6 tunnel\n"); | ||
375 | rxe_cache_exit(); | ||
376 | goto exit; | ||
370 | } | 377 | } |
378 | |||
379 | err = register_netdevice_notifier(&rxe_net_notifier); | ||
380 | if (err) { | ||
381 | pr_err("rxe: Failed to rigister netdev notifier\n"); | ||
382 | goto exit; | ||
383 | } | ||
384 | |||
371 | pr_info("rxe: loaded\n"); | 385 | pr_info("rxe: loaded\n"); |
372 | 386 | ||
373 | return 0; | 387 | return 0; |
388 | |||
389 | exit: | ||
390 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
391 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
392 | return err; | ||
374 | } | 393 | } |
375 | 394 | ||
376 | static void __exit rxe_module_exit(void) | 395 | static void __exit rxe_module_exit(void) |
diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c index 36f67de44095..1c59ef2c67aa 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c | |||
@@ -689,7 +689,14 @@ int rxe_completer(void *arg) | |||
689 | qp->req.need_retry = 1; | 689 | qp->req.need_retry = 1; |
690 | rxe_run_task(&qp->req.task, 1); | 690 | rxe_run_task(&qp->req.task, 1); |
691 | } | 691 | } |
692 | |||
693 | if (pkt) { | ||
694 | rxe_drop_ref(pkt->qp); | ||
695 | kfree_skb(skb); | ||
696 | } | ||
697 | |||
692 | goto exit; | 698 | goto exit; |
699 | |||
693 | } else { | 700 | } else { |
694 | wqe->status = IB_WC_RETRY_EXC_ERR; | 701 | wqe->status = IB_WC_RETRY_EXC_ERR; |
695 | state = COMPST_ERROR; | 702 | state = COMPST_ERROR; |
@@ -716,6 +723,12 @@ int rxe_completer(void *arg) | |||
716 | case COMPST_ERROR: | 723 | case COMPST_ERROR: |
717 | do_complete(qp, wqe); | 724 | do_complete(qp, wqe); |
718 | rxe_qp_error(qp); | 725 | rxe_qp_error(qp); |
726 | |||
727 | if (pkt) { | ||
728 | rxe_drop_ref(pkt->qp); | ||
729 | kfree_skb(skb); | ||
730 | } | ||
731 | |||
719 | goto exit; | 732 | goto exit; |
720 | } | 733 | } |
721 | } | 734 | } |
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index 0b8d2ea8b41d..eedf2f1cafdf 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c | |||
@@ -275,9 +275,10 @@ static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port, | |||
275 | return sock; | 275 | return sock; |
276 | } | 276 | } |
277 | 277 | ||
278 | static void rxe_release_udp_tunnel(struct socket *sk) | 278 | void rxe_release_udp_tunnel(struct socket *sk) |
279 | { | 279 | { |
280 | udp_tunnel_sock_release(sk); | 280 | if (sk) |
281 | udp_tunnel_sock_release(sk); | ||
281 | } | 282 | } |
282 | 283 | ||
283 | static void prepare_udp_hdr(struct sk_buff *skb, __be16 src_port, | 284 | static void prepare_udp_hdr(struct sk_buff *skb, __be16 src_port, |
@@ -658,51 +659,45 @@ out: | |||
658 | return NOTIFY_OK; | 659 | return NOTIFY_OK; |
659 | } | 660 | } |
660 | 661 | ||
661 | static struct notifier_block rxe_net_notifier = { | 662 | struct notifier_block rxe_net_notifier = { |
662 | .notifier_call = rxe_notify, | 663 | .notifier_call = rxe_notify, |
663 | }; | 664 | }; |
664 | 665 | ||
665 | int rxe_net_init(void) | 666 | int rxe_net_ipv4_init(void) |
666 | { | 667 | { |
667 | int err; | ||
668 | |||
669 | spin_lock_init(&dev_list_lock); | 668 | spin_lock_init(&dev_list_lock); |
670 | 669 | ||
671 | recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net, | ||
672 | htons(ROCE_V2_UDP_DPORT), true); | ||
673 | if (IS_ERR(recv_sockets.sk6)) { | ||
674 | recv_sockets.sk6 = NULL; | ||
675 | pr_err("rxe: Failed to create IPv6 UDP tunnel\n"); | ||
676 | return -1; | ||
677 | } | ||
678 | |||
679 | recv_sockets.sk4 = rxe_setup_udp_tunnel(&init_net, | 670 | recv_sockets.sk4 = rxe_setup_udp_tunnel(&init_net, |
680 | htons(ROCE_V2_UDP_DPORT), false); | 671 | htons(ROCE_V2_UDP_DPORT), false); |
681 | if (IS_ERR(recv_sockets.sk4)) { | 672 | if (IS_ERR(recv_sockets.sk4)) { |
682 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
683 | recv_sockets.sk4 = NULL; | 673 | recv_sockets.sk4 = NULL; |
684 | recv_sockets.sk6 = NULL; | ||
685 | pr_err("rxe: Failed to create IPv4 UDP tunnel\n"); | 674 | pr_err("rxe: Failed to create IPv4 UDP tunnel\n"); |
686 | return -1; | 675 | return -1; |
687 | } | 676 | } |
688 | 677 | ||
689 | err = register_netdevice_notifier(&rxe_net_notifier); | 678 | return 0; |
690 | if (err) { | ||
691 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
692 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
693 | pr_err("rxe: Failed to rigister netdev notifier\n"); | ||
694 | } | ||
695 | |||
696 | return err; | ||
697 | } | 679 | } |
698 | 680 | ||
699 | void rxe_net_exit(void) | 681 | int rxe_net_ipv6_init(void) |
700 | { | 682 | { |
701 | if (recv_sockets.sk6) | 683 | #if IS_ENABLED(CONFIG_IPV6) |
702 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
703 | 684 | ||
704 | if (recv_sockets.sk4) | 685 | spin_lock_init(&dev_list_lock); |
705 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
706 | 686 | ||
687 | recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net, | ||
688 | htons(ROCE_V2_UDP_DPORT), true); | ||
689 | if (IS_ERR(recv_sockets.sk6)) { | ||
690 | recv_sockets.sk6 = NULL; | ||
691 | pr_err("rxe: Failed to create IPv6 UDP tunnel\n"); | ||
692 | return -1; | ||
693 | } | ||
694 | #endif | ||
695 | return 0; | ||
696 | } | ||
697 | |||
698 | void rxe_net_exit(void) | ||
699 | { | ||
700 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
701 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
707 | unregister_netdevice_notifier(&rxe_net_notifier); | 702 | unregister_netdevice_notifier(&rxe_net_notifier); |
708 | } | 703 | } |
diff --git a/drivers/infiniband/sw/rxe/rxe_net.h b/drivers/infiniband/sw/rxe/rxe_net.h index 7b06f76d16cc..0daf7f09e5b5 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.h +++ b/drivers/infiniband/sw/rxe/rxe_net.h | |||
@@ -44,10 +44,13 @@ struct rxe_recv_sockets { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | extern struct rxe_recv_sockets recv_sockets; | 46 | extern struct rxe_recv_sockets recv_sockets; |
47 | extern struct notifier_block rxe_net_notifier; | ||
48 | void rxe_release_udp_tunnel(struct socket *sk); | ||
47 | 49 | ||
48 | struct rxe_dev *rxe_net_add(struct net_device *ndev); | 50 | struct rxe_dev *rxe_net_add(struct net_device *ndev); |
49 | 51 | ||
50 | int rxe_net_init(void); | 52 | int rxe_net_ipv4_init(void); |
53 | int rxe_net_ipv6_init(void); | ||
51 | void rxe_net_exit(void); | 54 | void rxe_net_exit(void); |
52 | 55 | ||
53 | #endif /* RXE_NET_H */ | 56 | #endif /* RXE_NET_H */ |
diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c index 3d464c23e08b..144d2f129fcd 100644 --- a/drivers/infiniband/sw/rxe/rxe_recv.c +++ b/drivers/infiniband/sw/rxe/rxe_recv.c | |||
@@ -312,7 +312,7 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) | |||
312 | * make a copy of the skb to post to the next qp | 312 | * make a copy of the skb to post to the next qp |
313 | */ | 313 | */ |
314 | skb_copy = (mce->qp_list.next != &mcg->qp_list) ? | 314 | skb_copy = (mce->qp_list.next != &mcg->qp_list) ? |
315 | skb_clone(skb, GFP_KERNEL) : NULL; | 315 | skb_clone(skb, GFP_ATOMIC) : NULL; |
316 | 316 | ||
317 | pkt->qp = qp; | 317 | pkt->qp = qp; |
318 | rxe_add_ref(qp); | 318 | rxe_add_ref(qp); |
diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index 33b2d9d77021..13a848a518e8 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c | |||
@@ -511,24 +511,21 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | |||
511 | } | 511 | } |
512 | 512 | ||
513 | static void update_wqe_state(struct rxe_qp *qp, | 513 | static void update_wqe_state(struct rxe_qp *qp, |
514 | struct rxe_send_wqe *wqe, | 514 | struct rxe_send_wqe *wqe, |
515 | struct rxe_pkt_info *pkt, | 515 | struct rxe_pkt_info *pkt) |
516 | enum wqe_state *prev_state) | ||
517 | { | 516 | { |
518 | enum wqe_state prev_state_ = wqe->state; | ||
519 | |||
520 | if (pkt->mask & RXE_END_MASK) { | 517 | if (pkt->mask & RXE_END_MASK) { |
521 | if (qp_type(qp) == IB_QPT_RC) | 518 | if (qp_type(qp) == IB_QPT_RC) |
522 | wqe->state = wqe_state_pending; | 519 | wqe->state = wqe_state_pending; |
523 | } else { | 520 | } else { |
524 | wqe->state = wqe_state_processing; | 521 | wqe->state = wqe_state_processing; |
525 | } | 522 | } |
526 | |||
527 | *prev_state = prev_state_; | ||
528 | } | 523 | } |
529 | 524 | ||
530 | static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | 525 | static void update_wqe_psn(struct rxe_qp *qp, |
531 | struct rxe_pkt_info *pkt, int payload) | 526 | struct rxe_send_wqe *wqe, |
527 | struct rxe_pkt_info *pkt, | ||
528 | int payload) | ||
532 | { | 529 | { |
533 | /* number of packets left to send including current one */ | 530 | /* number of packets left to send including current one */ |
534 | int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu; | 531 | int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu; |
@@ -546,9 +543,34 @@ static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | |||
546 | qp->req.psn = (wqe->first_psn + num_pkt) & BTH_PSN_MASK; | 543 | qp->req.psn = (wqe->first_psn + num_pkt) & BTH_PSN_MASK; |
547 | else | 544 | else |
548 | qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK; | 545 | qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK; |
546 | } | ||
549 | 547 | ||
550 | qp->req.opcode = pkt->opcode; | 548 | static void save_state(struct rxe_send_wqe *wqe, |
549 | struct rxe_qp *qp, | ||
550 | struct rxe_send_wqe *rollback_wqe, | ||
551 | struct rxe_qp *rollback_qp) | ||
552 | { | ||
553 | rollback_wqe->state = wqe->state; | ||
554 | rollback_wqe->first_psn = wqe->first_psn; | ||
555 | rollback_wqe->last_psn = wqe->last_psn; | ||
556 | rollback_qp->req.psn = qp->req.psn; | ||
557 | } | ||
551 | 558 | ||
559 | static void rollback_state(struct rxe_send_wqe *wqe, | ||
560 | struct rxe_qp *qp, | ||
561 | struct rxe_send_wqe *rollback_wqe, | ||
562 | struct rxe_qp *rollback_qp) | ||
563 | { | ||
564 | wqe->state = rollback_wqe->state; | ||
565 | wqe->first_psn = rollback_wqe->first_psn; | ||
566 | wqe->last_psn = rollback_wqe->last_psn; | ||
567 | qp->req.psn = rollback_qp->req.psn; | ||
568 | } | ||
569 | |||
570 | static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | ||
571 | struct rxe_pkt_info *pkt, int payload) | ||
572 | { | ||
573 | qp->req.opcode = pkt->opcode; | ||
552 | 574 | ||
553 | if (pkt->mask & RXE_END_MASK) | 575 | if (pkt->mask & RXE_END_MASK) |
554 | qp->req.wqe_index = next_index(qp->sq.queue, qp->req.wqe_index); | 576 | qp->req.wqe_index = next_index(qp->sq.queue, qp->req.wqe_index); |
@@ -571,7 +593,8 @@ int rxe_requester(void *arg) | |||
571 | int mtu; | 593 | int mtu; |
572 | int opcode; | 594 | int opcode; |
573 | int ret; | 595 | int ret; |
574 | enum wqe_state prev_state; | 596 | struct rxe_qp rollback_qp; |
597 | struct rxe_send_wqe rollback_wqe; | ||
575 | 598 | ||
576 | next_wqe: | 599 | next_wqe: |
577 | if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) | 600 | if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) |
@@ -688,13 +711,21 @@ next_wqe: | |||
688 | goto err; | 711 | goto err; |
689 | } | 712 | } |
690 | 713 | ||
691 | update_wqe_state(qp, wqe, &pkt, &prev_state); | 714 | /* |
715 | * To prevent a race on wqe access between requester and completer, | ||
716 | * wqe members state and psn need to be set before calling | ||
717 | * rxe_xmit_packet(). | ||
718 | * Otherwise, completer might initiate an unjustified retry flow. | ||
719 | */ | ||
720 | save_state(wqe, qp, &rollback_wqe, &rollback_qp); | ||
721 | update_wqe_state(qp, wqe, &pkt); | ||
722 | update_wqe_psn(qp, wqe, &pkt, payload); | ||
692 | ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb); | 723 | ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb); |
693 | if (ret) { | 724 | if (ret) { |
694 | qp->need_req_skb = 1; | 725 | qp->need_req_skb = 1; |
695 | kfree_skb(skb); | 726 | kfree_skb(skb); |
696 | 727 | ||
697 | wqe->state = prev_state; | 728 | rollback_state(wqe, qp, &rollback_wqe, &rollback_qp); |
698 | 729 | ||
699 | if (ret == -EAGAIN) { | 730 | if (ret == -EAGAIN) { |
700 | rxe_run_task(&qp->req.task, 1); | 731 | rxe_run_task(&qp->req.task, 1); |
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index ebb03b46e2ad..3e0f0f2baace 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c | |||
@@ -972,11 +972,13 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, | |||
972 | free_rd_atomic_resource(qp, res); | 972 | free_rd_atomic_resource(qp, res); |
973 | rxe_advance_resp_resource(qp); | 973 | rxe_advance_resp_resource(qp); |
974 | 974 | ||
975 | memcpy(SKB_TO_PKT(skb), &ack_pkt, sizeof(skb->cb)); | ||
976 | |||
975 | res->type = RXE_ATOMIC_MASK; | 977 | res->type = RXE_ATOMIC_MASK; |
976 | res->atomic.skb = skb; | 978 | res->atomic.skb = skb; |
977 | res->first_psn = qp->resp.psn; | 979 | res->first_psn = ack_pkt.psn; |
978 | res->last_psn = qp->resp.psn; | 980 | res->last_psn = ack_pkt.psn; |
979 | res->cur_psn = qp->resp.psn; | 981 | res->cur_psn = ack_pkt.psn; |
980 | 982 | ||
981 | rc = rxe_xmit_packet(rxe, qp, &ack_pkt, skb_copy); | 983 | rc = rxe_xmit_packet(rxe, qp, &ack_pkt, skb_copy); |
982 | if (rc) { | 984 | if (rc) { |
@@ -1116,8 +1118,7 @@ static enum resp_states duplicate_request(struct rxe_qp *qp, | |||
1116 | rc = RESPST_CLEANUP; | 1118 | rc = RESPST_CLEANUP; |
1117 | goto out; | 1119 | goto out; |
1118 | } | 1120 | } |
1119 | bth_set_psn(SKB_TO_PKT(skb_copy), | 1121 | |
1120 | qp->resp.psn - 1); | ||
1121 | /* Resend the result. */ | 1122 | /* Resend the result. */ |
1122 | rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, | 1123 | rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, |
1123 | pkt, skb_copy); | 1124 | pkt, skb_copy); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 4f7d9b48df64..9dbfcc0ab577 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -478,6 +478,7 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, | |||
478 | struct ipoib_ah *address, u32 qpn); | 478 | struct ipoib_ah *address, u32 qpn); |
479 | void ipoib_reap_ah(struct work_struct *work); | 479 | void ipoib_reap_ah(struct work_struct *work); |
480 | 480 | ||
481 | struct ipoib_path *__path_find(struct net_device *dev, void *gid); | ||
481 | void ipoib_mark_paths_invalid(struct net_device *dev); | 482 | void ipoib_mark_paths_invalid(struct net_device *dev); |
482 | void ipoib_flush_paths(struct net_device *dev); | 483 | void ipoib_flush_paths(struct net_device *dev); |
483 | int ipoib_check_sm_sendonly_fullmember_support(struct ipoib_dev_priv *priv); | 484 | int ipoib_check_sm_sendonly_fullmember_support(struct ipoib_dev_priv *priv); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 951d9abcca8b..4ad297d3de89 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -1318,6 +1318,8 @@ void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx) | |||
1318 | } | 1318 | } |
1319 | } | 1319 | } |
1320 | 1320 | ||
1321 | #define QPN_AND_OPTIONS_OFFSET 4 | ||
1322 | |||
1321 | static void ipoib_cm_tx_start(struct work_struct *work) | 1323 | static void ipoib_cm_tx_start(struct work_struct *work) |
1322 | { | 1324 | { |
1323 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, | 1325 | struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv, |
@@ -1326,6 +1328,7 @@ static void ipoib_cm_tx_start(struct work_struct *work) | |||
1326 | struct ipoib_neigh *neigh; | 1328 | struct ipoib_neigh *neigh; |
1327 | struct ipoib_cm_tx *p; | 1329 | struct ipoib_cm_tx *p; |
1328 | unsigned long flags; | 1330 | unsigned long flags; |
1331 | struct ipoib_path *path; | ||
1329 | int ret; | 1332 | int ret; |
1330 | 1333 | ||
1331 | struct ib_sa_path_rec pathrec; | 1334 | struct ib_sa_path_rec pathrec; |
@@ -1338,7 +1341,19 @@ static void ipoib_cm_tx_start(struct work_struct *work) | |||
1338 | p = list_entry(priv->cm.start_list.next, typeof(*p), list); | 1341 | p = list_entry(priv->cm.start_list.next, typeof(*p), list); |
1339 | list_del_init(&p->list); | 1342 | list_del_init(&p->list); |
1340 | neigh = p->neigh; | 1343 | neigh = p->neigh; |
1344 | |||
1341 | qpn = IPOIB_QPN(neigh->daddr); | 1345 | qpn = IPOIB_QPN(neigh->daddr); |
1346 | /* | ||
1347 | * As long as the search is with these 2 locks, | ||
1348 | * path existence indicates its validity. | ||
1349 | */ | ||
1350 | path = __path_find(dev, neigh->daddr + QPN_AND_OPTIONS_OFFSET); | ||
1351 | if (!path) { | ||
1352 | pr_info("%s ignore not valid path %pI6\n", | ||
1353 | __func__, | ||
1354 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); | ||
1355 | goto free_neigh; | ||
1356 | } | ||
1342 | memcpy(&pathrec, &p->path->pathrec, sizeof pathrec); | 1357 | memcpy(&pathrec, &p->path->pathrec, sizeof pathrec); |
1343 | 1358 | ||
1344 | spin_unlock_irqrestore(&priv->lock, flags); | 1359 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -1350,6 +1365,7 @@ static void ipoib_cm_tx_start(struct work_struct *work) | |||
1350 | spin_lock_irqsave(&priv->lock, flags); | 1365 | spin_lock_irqsave(&priv->lock, flags); |
1351 | 1366 | ||
1352 | if (ret) { | 1367 | if (ret) { |
1368 | free_neigh: | ||
1353 | neigh = p->neigh; | 1369 | neigh = p->neigh; |
1354 | if (neigh) { | 1370 | if (neigh) { |
1355 | neigh->cm = NULL; | 1371 | neigh->cm = NULL; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index dc6d241b9406..be11d5d5b8c1 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -1161,8 +1161,17 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | |||
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | if (level == IPOIB_FLUSH_LIGHT) { | 1163 | if (level == IPOIB_FLUSH_LIGHT) { |
1164 | int oper_up; | ||
1164 | ipoib_mark_paths_invalid(dev); | 1165 | ipoib_mark_paths_invalid(dev); |
1166 | /* Set IPoIB operation as down to prevent races between: | ||
1167 | * the flush flow which leaves MCG and on the fly joins | ||
1168 | * which can happen during that time. mcast restart task | ||
1169 | * should deal with join requests we missed. | ||
1170 | */ | ||
1171 | oper_up = test_and_clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags); | ||
1165 | ipoib_mcast_dev_flush(dev); | 1172 | ipoib_mcast_dev_flush(dev); |
1173 | if (oper_up) | ||
1174 | set_bit(IPOIB_FLAG_OPER_UP, &priv->flags); | ||
1166 | ipoib_flush_ah(dev); | 1175 | ipoib_flush_ah(dev); |
1167 | } | 1176 | } |
1168 | 1177 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 74bcaa064226..cc1c1b062ea5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -485,7 +485,7 @@ int ipoib_set_mode(struct net_device *dev, const char *buf) | |||
485 | return -EINVAL; | 485 | return -EINVAL; |
486 | } | 486 | } |
487 | 487 | ||
488 | static struct ipoib_path *__path_find(struct net_device *dev, void *gid) | 488 | struct ipoib_path *__path_find(struct net_device *dev, void *gid) |
489 | { | 489 | { |
490 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 490 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
491 | struct rb_node *n = priv->path_tree.rb_node; | 491 | struct rb_node *n = priv->path_tree.rb_node; |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 7914c14478cd..cae9bbcc27e7 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -403,6 +403,7 @@ isert_init_conn(struct isert_conn *isert_conn) | |||
403 | INIT_LIST_HEAD(&isert_conn->node); | 403 | INIT_LIST_HEAD(&isert_conn->node); |
404 | init_completion(&isert_conn->login_comp); | 404 | init_completion(&isert_conn->login_comp); |
405 | init_completion(&isert_conn->login_req_comp); | 405 | init_completion(&isert_conn->login_req_comp); |
406 | init_waitqueue_head(&isert_conn->rem_wait); | ||
406 | kref_init(&isert_conn->kref); | 407 | kref_init(&isert_conn->kref); |
407 | mutex_init(&isert_conn->mutex); | 408 | mutex_init(&isert_conn->mutex); |
408 | INIT_WORK(&isert_conn->release_work, isert_release_work); | 409 | INIT_WORK(&isert_conn->release_work, isert_release_work); |
@@ -578,7 +579,8 @@ isert_connect_release(struct isert_conn *isert_conn) | |||
578 | BUG_ON(!device); | 579 | BUG_ON(!device); |
579 | 580 | ||
580 | isert_free_rx_descriptors(isert_conn); | 581 | isert_free_rx_descriptors(isert_conn); |
581 | if (isert_conn->cm_id) | 582 | if (isert_conn->cm_id && |
583 | !isert_conn->dev_removed) | ||
582 | rdma_destroy_id(isert_conn->cm_id); | 584 | rdma_destroy_id(isert_conn->cm_id); |
583 | 585 | ||
584 | if (isert_conn->qp) { | 586 | if (isert_conn->qp) { |
@@ -593,7 +595,10 @@ isert_connect_release(struct isert_conn *isert_conn) | |||
593 | 595 | ||
594 | isert_device_put(device); | 596 | isert_device_put(device); |
595 | 597 | ||
596 | kfree(isert_conn); | 598 | if (isert_conn->dev_removed) |
599 | wake_up_interruptible(&isert_conn->rem_wait); | ||
600 | else | ||
601 | kfree(isert_conn); | ||
597 | } | 602 | } |
598 | 603 | ||
599 | static void | 604 | static void |
@@ -753,6 +758,7 @@ static int | |||
753 | isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | 758 | isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) |
754 | { | 759 | { |
755 | struct isert_np *isert_np = cma_id->context; | 760 | struct isert_np *isert_np = cma_id->context; |
761 | struct isert_conn *isert_conn; | ||
756 | int ret = 0; | 762 | int ret = 0; |
757 | 763 | ||
758 | isert_info("%s (%d): status %d id %p np %p\n", | 764 | isert_info("%s (%d): status %d id %p np %p\n", |
@@ -773,10 +779,21 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
773 | break; | 779 | break; |
774 | case RDMA_CM_EVENT_ADDR_CHANGE: /* FALLTHRU */ | 780 | case RDMA_CM_EVENT_ADDR_CHANGE: /* FALLTHRU */ |
775 | case RDMA_CM_EVENT_DISCONNECTED: /* FALLTHRU */ | 781 | case RDMA_CM_EVENT_DISCONNECTED: /* FALLTHRU */ |
776 | case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ | ||
777 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ | 782 | case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ |
778 | ret = isert_disconnected_handler(cma_id, event->event); | 783 | ret = isert_disconnected_handler(cma_id, event->event); |
779 | break; | 784 | break; |
785 | case RDMA_CM_EVENT_DEVICE_REMOVAL: | ||
786 | isert_conn = cma_id->qp->qp_context; | ||
787 | isert_conn->dev_removed = true; | ||
788 | isert_disconnected_handler(cma_id, event->event); | ||
789 | wait_event_interruptible(isert_conn->rem_wait, | ||
790 | isert_conn->state == ISER_CONN_DOWN); | ||
791 | kfree(isert_conn); | ||
792 | /* | ||
793 | * return non-zero from the callback to destroy | ||
794 | * the rdma cm id | ||
795 | */ | ||
796 | return 1; | ||
780 | case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */ | 797 | case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */ |
781 | case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */ | 798 | case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */ |
782 | case RDMA_CM_EVENT_CONNECT_ERROR: | 799 | case RDMA_CM_EVENT_CONNECT_ERROR: |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h index fc791efe3a10..c02ada57d7f5 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.h +++ b/drivers/infiniband/ulp/isert/ib_isert.h | |||
@@ -158,6 +158,8 @@ struct isert_conn { | |||
158 | struct work_struct release_work; | 158 | struct work_struct release_work; |
159 | bool logout_posted; | 159 | bool logout_posted; |
160 | bool snd_w_inv; | 160 | bool snd_w_inv; |
161 | wait_queue_head_t rem_wait; | ||
162 | bool dev_removed; | ||
161 | }; | 163 | }; |
162 | 164 | ||
163 | #define ISERT_MAX_CQ 64 | 165 | #define ISERT_MAX_CQ 64 |
diff --git a/drivers/irqchip/irq-atmel-aic.c b/drivers/irqchip/irq-atmel-aic.c index 112e17c2768b..37f952dd9fc9 100644 --- a/drivers/irqchip/irq-atmel-aic.c +++ b/drivers/irqchip/irq-atmel-aic.c | |||
@@ -176,6 +176,7 @@ static int aic_irq_domain_xlate(struct irq_domain *d, | |||
176 | { | 176 | { |
177 | struct irq_domain_chip_generic *dgc = d->gc; | 177 | struct irq_domain_chip_generic *dgc = d->gc; |
178 | struct irq_chip_generic *gc; | 178 | struct irq_chip_generic *gc; |
179 | unsigned long flags; | ||
179 | unsigned smr; | 180 | unsigned smr; |
180 | int idx; | 181 | int idx; |
181 | int ret; | 182 | int ret; |
@@ -194,11 +195,11 @@ static int aic_irq_domain_xlate(struct irq_domain *d, | |||
194 | 195 | ||
195 | gc = dgc->gc[idx]; | 196 | gc = dgc->gc[idx]; |
196 | 197 | ||
197 | irq_gc_lock(gc); | 198 | irq_gc_lock_irqsave(gc, flags); |
198 | smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq)); | 199 | smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq)); |
199 | aic_common_set_priority(intspec[2], &smr); | 200 | aic_common_set_priority(intspec[2], &smr); |
200 | irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq)); | 201 | irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq)); |
201 | irq_gc_unlock(gc); | 202 | irq_gc_unlock_irqrestore(gc, flags); |
202 | 203 | ||
203 | return ret; | 204 | return ret; |
204 | } | 205 | } |
diff --git a/drivers/irqchip/irq-atmel-aic5.c b/drivers/irqchip/irq-atmel-aic5.c index 4f0d068e1abe..2a624d87a035 100644 --- a/drivers/irqchip/irq-atmel-aic5.c +++ b/drivers/irqchip/irq-atmel-aic5.c | |||
@@ -258,6 +258,7 @@ static int aic5_irq_domain_xlate(struct irq_domain *d, | |||
258 | unsigned int *out_type) | 258 | unsigned int *out_type) |
259 | { | 259 | { |
260 | struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0); | 260 | struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0); |
261 | unsigned long flags; | ||
261 | unsigned smr; | 262 | unsigned smr; |
262 | int ret; | 263 | int ret; |
263 | 264 | ||
@@ -269,12 +270,12 @@ static int aic5_irq_domain_xlate(struct irq_domain *d, | |||
269 | if (ret) | 270 | if (ret) |
270 | return ret; | 271 | return ret; |
271 | 272 | ||
272 | irq_gc_lock(bgc); | 273 | irq_gc_lock_irqsave(bgc, flags); |
273 | irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR); | 274 | irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR); |
274 | smr = irq_reg_readl(bgc, AT91_AIC5_SMR); | 275 | smr = irq_reg_readl(bgc, AT91_AIC5_SMR); |
275 | aic_common_set_priority(intspec[2], &smr); | 276 | aic_common_set_priority(intspec[2], &smr); |
276 | irq_reg_writel(bgc, smr, AT91_AIC5_SMR); | 277 | irq_reg_writel(bgc, smr, AT91_AIC5_SMR); |
277 | irq_gc_unlock(bgc); | 278 | irq_gc_unlock_irqrestore(bgc, flags); |
278 | 279 | ||
279 | return ret; | 280 | return ret; |
280 | } | 281 | } |
diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig index 97c372908e78..7817d40d81e7 100644 --- a/drivers/mailbox/Kconfig +++ b/drivers/mailbox/Kconfig | |||
@@ -127,6 +127,7 @@ config XGENE_SLIMPRO_MBOX | |||
127 | config BCM_PDC_MBOX | 127 | config BCM_PDC_MBOX |
128 | tristate "Broadcom PDC Mailbox" | 128 | tristate "Broadcom PDC Mailbox" |
129 | depends on ARM64 || COMPILE_TEST | 129 | depends on ARM64 || COMPILE_TEST |
130 | depends on HAS_DMA | ||
130 | default ARCH_BCM_IPROC | 131 | default ARCH_BCM_IPROC |
131 | help | 132 | help |
132 | Mailbox implementation for the Broadcom PDC ring manager, | 133 | Mailbox implementation for the Broadcom PDC ring manager, |
diff --git a/drivers/mailbox/bcm-pdc-mailbox.c b/drivers/mailbox/bcm-pdc-mailbox.c index cbe0c1ee4ba9..c19dd820ea9b 100644 --- a/drivers/mailbox/bcm-pdc-mailbox.c +++ b/drivers/mailbox/bcm-pdc-mailbox.c | |||
@@ -469,7 +469,7 @@ static const struct file_operations pdc_debugfs_stats = { | |||
469 | * this directory for a SPU. | 469 | * this directory for a SPU. |
470 | * @pdcs: PDC state structure | 470 | * @pdcs: PDC state structure |
471 | */ | 471 | */ |
472 | void pdc_setup_debugfs(struct pdc_state *pdcs) | 472 | static void pdc_setup_debugfs(struct pdc_state *pdcs) |
473 | { | 473 | { |
474 | char spu_stats_name[16]; | 474 | char spu_stats_name[16]; |
475 | 475 | ||
@@ -485,7 +485,7 @@ void pdc_setup_debugfs(struct pdc_state *pdcs) | |||
485 | &pdc_debugfs_stats); | 485 | &pdc_debugfs_stats); |
486 | } | 486 | } |
487 | 487 | ||
488 | void pdc_free_debugfs(void) | 488 | static void pdc_free_debugfs(void) |
489 | { | 489 | { |
490 | if (debugfs_dir && simple_empty(debugfs_dir)) { | 490 | if (debugfs_dir && simple_empty(debugfs_dir)) { |
491 | debugfs_remove_recursive(debugfs_dir); | 491 | debugfs_remove_recursive(debugfs_dir); |
@@ -1191,10 +1191,11 @@ static void pdc_shutdown(struct mbox_chan *chan) | |||
1191 | { | 1191 | { |
1192 | struct pdc_state *pdcs = chan->con_priv; | 1192 | struct pdc_state *pdcs = chan->con_priv; |
1193 | 1193 | ||
1194 | if (pdcs) | 1194 | if (!pdcs) |
1195 | dev_dbg(&pdcs->pdev->dev, | 1195 | return; |
1196 | "Shutdown mailbox channel for PDC %u", pdcs->pdc_idx); | ||
1197 | 1196 | ||
1197 | dev_dbg(&pdcs->pdev->dev, | ||
1198 | "Shutdown mailbox channel for PDC %u", pdcs->pdc_idx); | ||
1198 | pdc_ring_free(pdcs); | 1199 | pdc_ring_free(pdcs); |
1199 | } | 1200 | } |
1200 | 1201 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 67642bacd597..915e84d631a2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7610,16 +7610,12 @@ EXPORT_SYMBOL(unregister_md_cluster_operations); | |||
7610 | 7610 | ||
7611 | int md_setup_cluster(struct mddev *mddev, int nodes) | 7611 | int md_setup_cluster(struct mddev *mddev, int nodes) |
7612 | { | 7612 | { |
7613 | int err; | 7613 | if (!md_cluster_ops) |
7614 | 7614 | request_module("md-cluster"); | |
7615 | err = request_module("md-cluster"); | ||
7616 | if (err) { | ||
7617 | pr_err("md-cluster module not found.\n"); | ||
7618 | return -ENOENT; | ||
7619 | } | ||
7620 | |||
7621 | spin_lock(&pers_lock); | 7615 | spin_lock(&pers_lock); |
7616 | /* ensure module won't be unloaded */ | ||
7622 | if (!md_cluster_ops || !try_module_get(md_cluster_mod)) { | 7617 | if (!md_cluster_ops || !try_module_get(md_cluster_mod)) { |
7618 | pr_err("can't find md-cluster module or get it's reference.\n"); | ||
7623 | spin_unlock(&pers_lock); | 7619 | spin_unlock(&pers_lock); |
7624 | return -ENOENT; | 7620 | return -ENOENT; |
7625 | } | 7621 | } |
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 51f76ddbe265..1b1ab4a1d132 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c | |||
@@ -96,7 +96,6 @@ struct r5l_log { | |||
96 | spinlock_t no_space_stripes_lock; | 96 | spinlock_t no_space_stripes_lock; |
97 | 97 | ||
98 | bool need_cache_flush; | 98 | bool need_cache_flush; |
99 | bool in_teardown; | ||
100 | }; | 99 | }; |
101 | 100 | ||
102 | /* | 101 | /* |
@@ -704,31 +703,22 @@ static void r5l_write_super_and_discard_space(struct r5l_log *log, | |||
704 | 703 | ||
705 | mddev = log->rdev->mddev; | 704 | mddev = log->rdev->mddev; |
706 | /* | 705 | /* |
707 | * This is to avoid a deadlock. r5l_quiesce holds reconfig_mutex and | 706 | * Discard could zero data, so before discard we must make sure |
708 | * wait for this thread to finish. This thread waits for | 707 | * superblock is updated to new log tail. Updating superblock (either |
709 | * MD_CHANGE_PENDING clear, which is supposed to be done in | 708 | * directly call md_update_sb() or depend on md thread) must hold |
710 | * md_check_recovery(). md_check_recovery() tries to get | 709 | * reconfig mutex. On the other hand, raid5_quiesce is called with |
711 | * reconfig_mutex. Since r5l_quiesce already holds the mutex, | 710 | * reconfig_mutex hold. The first step of raid5_quiesce() is waitting |
712 | * md_check_recovery() fails, so the PENDING never get cleared. The | 711 | * for all IO finish, hence waitting for reclaim thread, while reclaim |
713 | * in_teardown check workaround this issue. | 712 | * thread is calling this function and waitting for reconfig mutex. So |
713 | * there is a deadlock. We workaround this issue with a trylock. | ||
714 | * FIXME: we could miss discard if we can't take reconfig mutex | ||
714 | */ | 715 | */ |
715 | if (!log->in_teardown) { | 716 | set_mask_bits(&mddev->flags, 0, |
716 | set_mask_bits(&mddev->flags, 0, | 717 | BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); |
717 | BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); | 718 | if (!mddev_trylock(mddev)) |
718 | md_wakeup_thread(mddev->thread); | 719 | return; |
719 | wait_event(mddev->sb_wait, | 720 | md_update_sb(mddev, 1); |
720 | !test_bit(MD_CHANGE_PENDING, &mddev->flags) || | 721 | mddev_unlock(mddev); |
721 | log->in_teardown); | ||
722 | /* | ||
723 | * r5l_quiesce could run after in_teardown check and hold | ||
724 | * mutex first. Superblock might get updated twice. | ||
725 | */ | ||
726 | if (log->in_teardown) | ||
727 | md_update_sb(mddev, 1); | ||
728 | } else { | ||
729 | WARN_ON(!mddev_is_locked(mddev)); | ||
730 | md_update_sb(mddev, 1); | ||
731 | } | ||
732 | 722 | ||
733 | /* discard IO error really doesn't matter, ignore it */ | 723 | /* discard IO error really doesn't matter, ignore it */ |
734 | if (log->last_checkpoint < end) { | 724 | if (log->last_checkpoint < end) { |
@@ -827,7 +817,6 @@ void r5l_quiesce(struct r5l_log *log, int state) | |||
827 | if (!log || state == 2) | 817 | if (!log || state == 2) |
828 | return; | 818 | return; |
829 | if (state == 0) { | 819 | if (state == 0) { |
830 | log->in_teardown = 0; | ||
831 | /* | 820 | /* |
832 | * This is a special case for hotadd. In suspend, the array has | 821 | * This is a special case for hotadd. In suspend, the array has |
833 | * no journal. In resume, journal is initialized as well as the | 822 | * no journal. In resume, journal is initialized as well as the |
@@ -838,11 +827,6 @@ void r5l_quiesce(struct r5l_log *log, int state) | |||
838 | log->reclaim_thread = md_register_thread(r5l_reclaim_thread, | 827 | log->reclaim_thread = md_register_thread(r5l_reclaim_thread, |
839 | log->rdev->mddev, "reclaim"); | 828 | log->rdev->mddev, "reclaim"); |
840 | } else if (state == 1) { | 829 | } else if (state == 1) { |
841 | /* | ||
842 | * at this point all stripes are finished, so io_unit is at | ||
843 | * least in STRIPE_END state | ||
844 | */ | ||
845 | log->in_teardown = 1; | ||
846 | /* make sure r5l_write_super_and_discard_space exits */ | 830 | /* make sure r5l_write_super_and_discard_space exits */ |
847 | mddev = log->rdev->mddev; | 831 | mddev = log->rdev->mddev; |
848 | wake_up(&mddev->sb_wait); | 832 | wake_up(&mddev->sb_wait); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index da583bb43c84..ee7fc3701700 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2423,10 +2423,10 @@ static void raid5_end_read_request(struct bio * bi) | |||
2423 | } | 2423 | } |
2424 | } | 2424 | } |
2425 | rdev_dec_pending(rdev, conf->mddev); | 2425 | rdev_dec_pending(rdev, conf->mddev); |
2426 | bio_reset(bi); | ||
2426 | clear_bit(R5_LOCKED, &sh->dev[i].flags); | 2427 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
2427 | set_bit(STRIPE_HANDLE, &sh->state); | 2428 | set_bit(STRIPE_HANDLE, &sh->state); |
2428 | raid5_release_stripe(sh); | 2429 | raid5_release_stripe(sh); |
2429 | bio_reset(bi); | ||
2430 | } | 2430 | } |
2431 | 2431 | ||
2432 | static void raid5_end_write_request(struct bio *bi) | 2432 | static void raid5_end_write_request(struct bio *bi) |
@@ -2498,6 +2498,7 @@ static void raid5_end_write_request(struct bio *bi) | |||
2498 | if (sh->batch_head && bi->bi_error && !replacement) | 2498 | if (sh->batch_head && bi->bi_error && !replacement) |
2499 | set_bit(STRIPE_BATCH_ERR, &sh->batch_head->state); | 2499 | set_bit(STRIPE_BATCH_ERR, &sh->batch_head->state); |
2500 | 2500 | ||
2501 | bio_reset(bi); | ||
2501 | if (!test_and_clear_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags)) | 2502 | if (!test_and_clear_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags)) |
2502 | clear_bit(R5_LOCKED, &sh->dev[i].flags); | 2503 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
2503 | set_bit(STRIPE_HANDLE, &sh->state); | 2504 | set_bit(STRIPE_HANDLE, &sh->state); |
@@ -2505,7 +2506,6 @@ static void raid5_end_write_request(struct bio *bi) | |||
2505 | 2506 | ||
2506 | if (sh->batch_head && sh != sh->batch_head) | 2507 | if (sh->batch_head && sh != sh->batch_head) |
2507 | raid5_release_stripe(sh->batch_head); | 2508 | raid5_release_stripe(sh->batch_head); |
2508 | bio_reset(bi); | ||
2509 | } | 2509 | } |
2510 | 2510 | ||
2511 | static void raid5_build_block(struct stripe_head *sh, int i, int previous) | 2511 | static void raid5_build_block(struct stripe_head *sh, int i, int previous) |
@@ -6639,6 +6639,16 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
6639 | } | 6639 | } |
6640 | 6640 | ||
6641 | conf->min_nr_stripes = NR_STRIPES; | 6641 | conf->min_nr_stripes = NR_STRIPES; |
6642 | if (mddev->reshape_position != MaxSector) { | ||
6643 | int stripes = max_t(int, | ||
6644 | ((mddev->chunk_sectors << 9) / STRIPE_SIZE) * 4, | ||
6645 | ((mddev->new_chunk_sectors << 9) / STRIPE_SIZE) * 4); | ||
6646 | conf->min_nr_stripes = max(NR_STRIPES, stripes); | ||
6647 | if (conf->min_nr_stripes != NR_STRIPES) | ||
6648 | printk(KERN_INFO | ||
6649 | "md/raid:%s: force stripe size %d for reshape\n", | ||
6650 | mdname(mddev), conf->min_nr_stripes); | ||
6651 | } | ||
6642 | memory = conf->min_nr_stripes * (sizeof(struct stripe_head) + | 6652 | memory = conf->min_nr_stripes * (sizeof(struct stripe_head) + |
6643 | max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; | 6653 | max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; |
6644 | atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS); | 6654 | atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS); |
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index 869c83fb3c5d..f00f3e742265 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c | |||
@@ -2185,7 +2185,7 @@ static int gpmc_probe_dt(struct platform_device *pdev) | |||
2185 | return 0; | 2185 | return 0; |
2186 | } | 2186 | } |
2187 | 2187 | ||
2188 | static int gpmc_probe_dt_children(struct platform_device *pdev) | 2188 | static void gpmc_probe_dt_children(struct platform_device *pdev) |
2189 | { | 2189 | { |
2190 | int ret; | 2190 | int ret; |
2191 | struct device_node *child; | 2191 | struct device_node *child; |
@@ -2200,11 +2200,11 @@ static int gpmc_probe_dt_children(struct platform_device *pdev) | |||
2200 | else | 2200 | else |
2201 | ret = gpmc_probe_generic_child(pdev, child); | 2201 | ret = gpmc_probe_generic_child(pdev, child); |
2202 | 2202 | ||
2203 | if (ret) | 2203 | if (ret) { |
2204 | return ret; | 2204 | dev_err(&pdev->dev, "failed to probe DT child '%s': %d\n", |
2205 | child->name, ret); | ||
2206 | } | ||
2205 | } | 2207 | } |
2206 | |||
2207 | return 0; | ||
2208 | } | 2208 | } |
2209 | #else | 2209 | #else |
2210 | static int gpmc_probe_dt(struct platform_device *pdev) | 2210 | static int gpmc_probe_dt(struct platform_device *pdev) |
@@ -2212,9 +2212,8 @@ static int gpmc_probe_dt(struct platform_device *pdev) | |||
2212 | return 0; | 2212 | return 0; |
2213 | } | 2213 | } |
2214 | 2214 | ||
2215 | static int gpmc_probe_dt_children(struct platform_device *pdev) | 2215 | static void gpmc_probe_dt_children(struct platform_device *pdev) |
2216 | { | 2216 | { |
2217 | return 0; | ||
2218 | } | 2217 | } |
2219 | #endif /* CONFIG_OF */ | 2218 | #endif /* CONFIG_OF */ |
2220 | 2219 | ||
@@ -2369,16 +2368,10 @@ static int gpmc_probe(struct platform_device *pdev) | |||
2369 | goto setup_irq_failed; | 2368 | goto setup_irq_failed; |
2370 | } | 2369 | } |
2371 | 2370 | ||
2372 | rc = gpmc_probe_dt_children(pdev); | 2371 | gpmc_probe_dt_children(pdev); |
2373 | if (rc < 0) { | ||
2374 | dev_err(gpmc->dev, "failed to probe DT children\n"); | ||
2375 | goto dt_children_failed; | ||
2376 | } | ||
2377 | 2372 | ||
2378 | return 0; | 2373 | return 0; |
2379 | 2374 | ||
2380 | dt_children_failed: | ||
2381 | gpmc_free_irq(gpmc); | ||
2382 | setup_irq_failed: | 2375 | setup_irq_failed: |
2383 | gpmc_gpio_exit(gpmc); | 2376 | gpmc_gpio_exit(gpmc); |
2384 | gpio_init_failed: | 2377 | gpio_init_failed: |
diff --git a/drivers/misc/lkdtm_usercopy.c b/drivers/misc/lkdtm_usercopy.c index 5525a204db93..1dd611423d8b 100644 --- a/drivers/misc/lkdtm_usercopy.c +++ b/drivers/misc/lkdtm_usercopy.c | |||
@@ -9,7 +9,15 @@ | |||
9 | #include <linux/uaccess.h> | 9 | #include <linux/uaccess.h> |
10 | #include <asm/cacheflush.h> | 10 | #include <asm/cacheflush.h> |
11 | 11 | ||
12 | static size_t cache_size = 1024; | 12 | /* |
13 | * Many of the tests here end up using const sizes, but those would | ||
14 | * normally be ignored by hardened usercopy, so force the compiler | ||
15 | * into choosing the non-const path to make sure we trigger the | ||
16 | * hardened usercopy checks by added "unconst" to all the const copies, | ||
17 | * and making sure "cache_size" isn't optimized into a const. | ||
18 | */ | ||
19 | static volatile size_t unconst = 0; | ||
20 | static volatile size_t cache_size = 1024; | ||
13 | static struct kmem_cache *bad_cache; | 21 | static struct kmem_cache *bad_cache; |
14 | 22 | ||
15 | static const unsigned char test_text[] = "This is a test.\n"; | 23 | static const unsigned char test_text[] = "This is a test.\n"; |
@@ -67,14 +75,14 @@ static noinline void do_usercopy_stack(bool to_user, bool bad_frame) | |||
67 | if (to_user) { | 75 | if (to_user) { |
68 | pr_info("attempting good copy_to_user of local stack\n"); | 76 | pr_info("attempting good copy_to_user of local stack\n"); |
69 | if (copy_to_user((void __user *)user_addr, good_stack, | 77 | if (copy_to_user((void __user *)user_addr, good_stack, |
70 | sizeof(good_stack))) { | 78 | unconst + sizeof(good_stack))) { |
71 | pr_warn("copy_to_user failed unexpectedly?!\n"); | 79 | pr_warn("copy_to_user failed unexpectedly?!\n"); |
72 | goto free_user; | 80 | goto free_user; |
73 | } | 81 | } |
74 | 82 | ||
75 | pr_info("attempting bad copy_to_user of distant stack\n"); | 83 | pr_info("attempting bad copy_to_user of distant stack\n"); |
76 | if (copy_to_user((void __user *)user_addr, bad_stack, | 84 | if (copy_to_user((void __user *)user_addr, bad_stack, |
77 | sizeof(good_stack))) { | 85 | unconst + sizeof(good_stack))) { |
78 | pr_warn("copy_to_user failed, but lacked Oops\n"); | 86 | pr_warn("copy_to_user failed, but lacked Oops\n"); |
79 | goto free_user; | 87 | goto free_user; |
80 | } | 88 | } |
@@ -88,14 +96,14 @@ static noinline void do_usercopy_stack(bool to_user, bool bad_frame) | |||
88 | 96 | ||
89 | pr_info("attempting good copy_from_user of local stack\n"); | 97 | pr_info("attempting good copy_from_user of local stack\n"); |
90 | if (copy_from_user(good_stack, (void __user *)user_addr, | 98 | if (copy_from_user(good_stack, (void __user *)user_addr, |
91 | sizeof(good_stack))) { | 99 | unconst + sizeof(good_stack))) { |
92 | pr_warn("copy_from_user failed unexpectedly?!\n"); | 100 | pr_warn("copy_from_user failed unexpectedly?!\n"); |
93 | goto free_user; | 101 | goto free_user; |
94 | } | 102 | } |
95 | 103 | ||
96 | pr_info("attempting bad copy_from_user of distant stack\n"); | 104 | pr_info("attempting bad copy_from_user of distant stack\n"); |
97 | if (copy_from_user(bad_stack, (void __user *)user_addr, | 105 | if (copy_from_user(bad_stack, (void __user *)user_addr, |
98 | sizeof(good_stack))) { | 106 | unconst + sizeof(good_stack))) { |
99 | pr_warn("copy_from_user failed, but lacked Oops\n"); | 107 | pr_warn("copy_from_user failed, but lacked Oops\n"); |
100 | goto free_user; | 108 | goto free_user; |
101 | } | 109 | } |
@@ -109,7 +117,7 @@ static void do_usercopy_heap_size(bool to_user) | |||
109 | { | 117 | { |
110 | unsigned long user_addr; | 118 | unsigned long user_addr; |
111 | unsigned char *one, *two; | 119 | unsigned char *one, *two; |
112 | const size_t size = 1024; | 120 | size_t size = unconst + 1024; |
113 | 121 | ||
114 | one = kmalloc(size, GFP_KERNEL); | 122 | one = kmalloc(size, GFP_KERNEL); |
115 | two = kmalloc(size, GFP_KERNEL); | 123 | two = kmalloc(size, GFP_KERNEL); |
@@ -285,13 +293,14 @@ void lkdtm_USERCOPY_KERNEL(void) | |||
285 | 293 | ||
286 | pr_info("attempting good copy_to_user from kernel rodata\n"); | 294 | pr_info("attempting good copy_to_user from kernel rodata\n"); |
287 | if (copy_to_user((void __user *)user_addr, test_text, | 295 | if (copy_to_user((void __user *)user_addr, test_text, |
288 | sizeof(test_text))) { | 296 | unconst + sizeof(test_text))) { |
289 | pr_warn("copy_to_user failed unexpectedly?!\n"); | 297 | pr_warn("copy_to_user failed unexpectedly?!\n"); |
290 | goto free_user; | 298 | goto free_user; |
291 | } | 299 | } |
292 | 300 | ||
293 | pr_info("attempting bad copy_to_user from kernel text\n"); | 301 | pr_info("attempting bad copy_to_user from kernel text\n"); |
294 | if (copy_to_user((void __user *)user_addr, vm_mmap, PAGE_SIZE)) { | 302 | if (copy_to_user((void __user *)user_addr, vm_mmap, |
303 | unconst + PAGE_SIZE)) { | ||
295 | pr_warn("copy_to_user failed, but lacked Oops\n"); | 304 | pr_warn("copy_to_user failed, but lacked Oops\n"); |
296 | goto free_user; | 305 | goto free_user; |
297 | } | 306 | } |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index f23d65eb070d..be3c49fa7382 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -1016,14 +1016,16 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req) | |||
1016 | 1016 | ||
1017 | /* Only reconfigure if we have a different burst size */ | 1017 | /* Only reconfigure if we have a different burst size */ |
1018 | if (*bp != burst) { | 1018 | if (*bp != burst) { |
1019 | struct dma_slave_config cfg; | 1019 | struct dma_slave_config cfg = { |
1020 | 1020 | .src_addr = host->phys_base + | |
1021 | cfg.src_addr = host->phys_base + OMAP_MMC_REG(host, DATA); | 1021 | OMAP_MMC_REG(host, DATA), |
1022 | cfg.dst_addr = host->phys_base + OMAP_MMC_REG(host, DATA); | 1022 | .dst_addr = host->phys_base + |
1023 | cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | 1023 | OMAP_MMC_REG(host, DATA), |
1024 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | 1024 | .src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, |
1025 | cfg.src_maxburst = burst; | 1025 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, |
1026 | cfg.dst_maxburst = burst; | 1026 | .src_maxburst = burst, |
1027 | .dst_maxburst = burst, | ||
1028 | }; | ||
1027 | 1029 | ||
1028 | if (dmaengine_slave_config(c, &cfg)) | 1030 | if (dmaengine_slave_config(c, &cfg)) |
1029 | goto use_pio; | 1031 | goto use_pio; |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 24ebc9a8de89..5f2f24a7360d 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -1409,11 +1409,18 @@ static int omap_hsmmc_pre_dma_transfer(struct omap_hsmmc_host *host, | |||
1409 | static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, | 1409 | static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, |
1410 | struct mmc_request *req) | 1410 | struct mmc_request *req) |
1411 | { | 1411 | { |
1412 | struct dma_slave_config cfg; | ||
1413 | struct dma_async_tx_descriptor *tx; | 1412 | struct dma_async_tx_descriptor *tx; |
1414 | int ret = 0, i; | 1413 | int ret = 0, i; |
1415 | struct mmc_data *data = req->data; | 1414 | struct mmc_data *data = req->data; |
1416 | struct dma_chan *chan; | 1415 | struct dma_chan *chan; |
1416 | struct dma_slave_config cfg = { | ||
1417 | .src_addr = host->mapbase + OMAP_HSMMC_DATA, | ||
1418 | .dst_addr = host->mapbase + OMAP_HSMMC_DATA, | ||
1419 | .src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, | ||
1420 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, | ||
1421 | .src_maxburst = data->blksz / 4, | ||
1422 | .dst_maxburst = data->blksz / 4, | ||
1423 | }; | ||
1417 | 1424 | ||
1418 | /* Sanity check: all the SG entries must be aligned by block size. */ | 1425 | /* Sanity check: all the SG entries must be aligned by block size. */ |
1419 | for (i = 0; i < data->sg_len; i++) { | 1426 | for (i = 0; i < data->sg_len; i++) { |
@@ -1433,13 +1440,6 @@ static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, | |||
1433 | 1440 | ||
1434 | chan = omap_hsmmc_get_dma_chan(host, data); | 1441 | chan = omap_hsmmc_get_dma_chan(host, data); |
1435 | 1442 | ||
1436 | cfg.src_addr = host->mapbase + OMAP_HSMMC_DATA; | ||
1437 | cfg.dst_addr = host->mapbase + OMAP_HSMMC_DATA; | ||
1438 | cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
1439 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
1440 | cfg.src_maxburst = data->blksz / 4; | ||
1441 | cfg.dst_maxburst = data->blksz / 4; | ||
1442 | |||
1443 | ret = dmaengine_slave_config(chan, &cfg); | 1443 | ret = dmaengine_slave_config(chan, &cfg); |
1444 | if (ret) | 1444 | if (ret) |
1445 | return ret; | 1445 | return ret; |
diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c index c95ba83366a0..ed92ce729dde 100644 --- a/drivers/mmc/host/sdhci-st.c +++ b/drivers/mmc/host/sdhci-st.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | struct st_mmc_platform_data { | 29 | struct st_mmc_platform_data { |
30 | struct reset_control *rstc; | 30 | struct reset_control *rstc; |
31 | struct clk *icnclk; | ||
31 | void __iomem *top_ioaddr; | 32 | void __iomem *top_ioaddr; |
32 | }; | 33 | }; |
33 | 34 | ||
@@ -353,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
353 | struct sdhci_host *host; | 354 | struct sdhci_host *host; |
354 | struct st_mmc_platform_data *pdata; | 355 | struct st_mmc_platform_data *pdata; |
355 | struct sdhci_pltfm_host *pltfm_host; | 356 | struct sdhci_pltfm_host *pltfm_host; |
356 | struct clk *clk; | 357 | struct clk *clk, *icnclk; |
357 | int ret = 0; | 358 | int ret = 0; |
358 | u16 host_version; | 359 | u16 host_version; |
359 | struct resource *res; | 360 | struct resource *res; |
@@ -365,6 +366,11 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
365 | return PTR_ERR(clk); | 366 | return PTR_ERR(clk); |
366 | } | 367 | } |
367 | 368 | ||
369 | /* ICN clock isn't compulsory, but use it if it's provided. */ | ||
370 | icnclk = devm_clk_get(&pdev->dev, "icn"); | ||
371 | if (IS_ERR(icnclk)) | ||
372 | icnclk = NULL; | ||
373 | |||
368 | rstc = devm_reset_control_get(&pdev->dev, NULL); | 374 | rstc = devm_reset_control_get(&pdev->dev, NULL); |
369 | if (IS_ERR(rstc)) | 375 | if (IS_ERR(rstc)) |
370 | rstc = NULL; | 376 | rstc = NULL; |
@@ -389,6 +395,7 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
389 | } | 395 | } |
390 | 396 | ||
391 | clk_prepare_enable(clk); | 397 | clk_prepare_enable(clk); |
398 | clk_prepare_enable(icnclk); | ||
392 | 399 | ||
393 | /* Configure the FlashSS Top registers for setting eMMC TX/RX delay */ | 400 | /* Configure the FlashSS Top registers for setting eMMC TX/RX delay */ |
394 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 401 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
@@ -400,6 +407,7 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
400 | } | 407 | } |
401 | 408 | ||
402 | pltfm_host->clk = clk; | 409 | pltfm_host->clk = clk; |
410 | pdata->icnclk = icnclk; | ||
403 | 411 | ||
404 | /* Configure the Arasan HC inside the flashSS */ | 412 | /* Configure the Arasan HC inside the flashSS */ |
405 | st_mmcss_cconfig(np, host); | 413 | st_mmcss_cconfig(np, host); |
@@ -422,6 +430,7 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
422 | return 0; | 430 | return 0; |
423 | 431 | ||
424 | err_out: | 432 | err_out: |
433 | clk_disable_unprepare(icnclk); | ||
425 | clk_disable_unprepare(clk); | 434 | clk_disable_unprepare(clk); |
426 | err_of: | 435 | err_of: |
427 | sdhci_pltfm_free(pdev); | 436 | sdhci_pltfm_free(pdev); |
@@ -442,6 +451,8 @@ static int sdhci_st_remove(struct platform_device *pdev) | |||
442 | 451 | ||
443 | ret = sdhci_pltfm_unregister(pdev); | 452 | ret = sdhci_pltfm_unregister(pdev); |
444 | 453 | ||
454 | clk_disable_unprepare(pdata->icnclk); | ||
455 | |||
445 | if (rstc) | 456 | if (rstc) |
446 | reset_control_assert(rstc); | 457 | reset_control_assert(rstc); |
447 | 458 | ||
@@ -462,6 +473,7 @@ static int sdhci_st_suspend(struct device *dev) | |||
462 | if (pdata->rstc) | 473 | if (pdata->rstc) |
463 | reset_control_assert(pdata->rstc); | 474 | reset_control_assert(pdata->rstc); |
464 | 475 | ||
476 | clk_disable_unprepare(pdata->icnclk); | ||
465 | clk_disable_unprepare(pltfm_host->clk); | 477 | clk_disable_unprepare(pltfm_host->clk); |
466 | out: | 478 | out: |
467 | return ret; | 479 | return ret; |
@@ -475,6 +487,7 @@ static int sdhci_st_resume(struct device *dev) | |||
475 | struct device_node *np = dev->of_node; | 487 | struct device_node *np = dev->of_node; |
476 | 488 | ||
477 | clk_prepare_enable(pltfm_host->clk); | 489 | clk_prepare_enable(pltfm_host->clk); |
490 | clk_prepare_enable(pdata->icnclk); | ||
478 | 491 | ||
479 | if (pdata->rstc) | 492 | if (pdata->rstc) |
480 | reset_control_deassert(pdata->rstc); | 493 | reset_control_deassert(pdata->rstc); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 217e8da0628c..9599ed6f1213 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1341,9 +1341,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1341 | slave_dev->name); | 1341 | slave_dev->name); |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | /* already enslaved */ | 1344 | /* already in-use? */ |
1345 | if (slave_dev->flags & IFF_SLAVE) { | 1345 | if (netdev_is_rx_handler_busy(slave_dev)) { |
1346 | netdev_dbg(bond_dev, "Error: Device was already enslaved\n"); | 1346 | netdev_err(bond_dev, |
1347 | "Error: Device is in use and cannot be enslaved\n"); | ||
1347 | return -EBUSY; | 1348 | return -EBUSY; |
1348 | } | 1349 | } |
1349 | 1350 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 97e892511666..fa3386bb14f7 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -772,6 +772,11 @@ void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl) | |||
772 | (bp->common.bc_ver & 0xff00) >> 8, | 772 | (bp->common.bc_ver & 0xff00) >> 8, |
773 | (bp->common.bc_ver & 0xff)); | 773 | (bp->common.bc_ver & 0xff)); |
774 | 774 | ||
775 | if (pci_channel_offline(bp->pdev)) { | ||
776 | BNX2X_ERR("Cannot dump MCP info while in PCI error\n"); | ||
777 | return; | ||
778 | } | ||
779 | |||
775 | val = REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER); | 780 | val = REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER); |
776 | if (val == REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER)) | 781 | if (val == REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER)) |
777 | BNX2X_ERR("%s" "MCP PC at 0x%x\n", lvl, val); | 782 | BNX2X_ERR("%s" "MCP PC at 0x%x\n", lvl, val); |
@@ -9415,10 +9420,16 @@ unload_error: | |||
9415 | /* Release IRQs */ | 9420 | /* Release IRQs */ |
9416 | bnx2x_free_irq(bp); | 9421 | bnx2x_free_irq(bp); |
9417 | 9422 | ||
9418 | /* Reset the chip */ | 9423 | /* Reset the chip, unless PCI function is offline. If we reach this |
9419 | rc = bnx2x_reset_hw(bp, reset_code); | 9424 | * point following a PCI error handling, it means device is really |
9420 | if (rc) | 9425 | * in a bad state and we're about to remove it, so reset the chip |
9421 | BNX2X_ERR("HW_RESET failed\n"); | 9426 | * is not a good idea. |
9427 | */ | ||
9428 | if (!pci_channel_offline(bp->pdev)) { | ||
9429 | rc = bnx2x_reset_hw(bp, reset_code); | ||
9430 | if (rc) | ||
9431 | BNX2X_ERR("HW_RESET failed\n"); | ||
9432 | } | ||
9422 | 9433 | ||
9423 | /* Report UNLOAD_DONE to MCP */ | 9434 | /* Report UNLOAD_DONE to MCP */ |
9424 | bnx2x_send_unload_done(bp, keep_link); | 9435 | bnx2x_send_unload_done(bp, keep_link); |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 2cf79100c9cb..228c964e709a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
@@ -353,8 +353,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
353 | push_len = (length + sizeof(*tx_push) + 7) / 8; | 353 | push_len = (length + sizeof(*tx_push) + 7) / 8; |
354 | if (push_len > 16) { | 354 | if (push_len > 16) { |
355 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, 16); | 355 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, 16); |
356 | __iowrite64_copy(txr->tx_doorbell + 4, tx_push_buf + 1, | 356 | __iowrite32_copy(txr->tx_doorbell + 4, tx_push_buf + 1, |
357 | push_len - 16); | 357 | (push_len - 16) << 1); |
358 | } else { | 358 | } else { |
359 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, | 359 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, |
360 | push_len); | 360 | push_len); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 659261218d9f..a2551bcd1027 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -14012,6 +14012,7 @@ static int tg3_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) | |||
14012 | if ((ec->rx_coalesce_usecs > MAX_RXCOL_TICKS) || | 14012 | if ((ec->rx_coalesce_usecs > MAX_RXCOL_TICKS) || |
14013 | (!ec->rx_coalesce_usecs) || | 14013 | (!ec->rx_coalesce_usecs) || |
14014 | (ec->tx_coalesce_usecs > MAX_TXCOL_TICKS) || | 14014 | (ec->tx_coalesce_usecs > MAX_TXCOL_TICKS) || |
14015 | (!ec->tx_coalesce_usecs) || | ||
14015 | (ec->rx_max_coalesced_frames > MAX_RXMAX_FRAMES) || | 14016 | (ec->rx_max_coalesced_frames > MAX_RXMAX_FRAMES) || |
14016 | (ec->tx_max_coalesced_frames > MAX_TXMAX_FRAMES) || | 14017 | (ec->tx_max_coalesced_frames > MAX_TXMAX_FRAMES) || |
14017 | (ec->rx_coalesce_usecs_irq > max_rxcoal_tick_int) || | 14018 | (ec->rx_coalesce_usecs_irq > max_rxcoal_tick_int) || |
@@ -14022,16 +14023,6 @@ static int tg3_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) | |||
14022 | (ec->stats_block_coalesce_usecs < min_stat_coal_ticks)) | 14023 | (ec->stats_block_coalesce_usecs < min_stat_coal_ticks)) |
14023 | return -EINVAL; | 14024 | return -EINVAL; |
14024 | 14025 | ||
14025 | /* No rx interrupts will be generated if both are zero */ | ||
14026 | if ((ec->rx_coalesce_usecs == 0) && | ||
14027 | (ec->rx_max_coalesced_frames == 0)) | ||
14028 | return -EINVAL; | ||
14029 | |||
14030 | /* No tx interrupts will be generated if both are zero */ | ||
14031 | if ((ec->tx_coalesce_usecs == 0) && | ||
14032 | (ec->tx_max_coalesced_frames == 0)) | ||
14033 | return -EINVAL; | ||
14034 | |||
14035 | /* Only copy relevant parameters, ignore all others. */ | 14026 | /* Only copy relevant parameters, ignore all others. */ |
14036 | tp->coal.rx_coalesce_usecs = ec->rx_coalesce_usecs; | 14027 | tp->coal.rx_coalesce_usecs = ec->rx_coalesce_usecs; |
14037 | tp->coal.tx_coalesce_usecs = ec->tx_coalesce_usecs; | 14028 | tp->coal.tx_coalesce_usecs = ec->tx_coalesce_usecs; |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 89c0cfa9719f..d954a97b0b0b 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -1323,6 +1323,24 @@ dma_error: | |||
1323 | return 0; | 1323 | return 0; |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | static inline int macb_clear_csum(struct sk_buff *skb) | ||
1327 | { | ||
1328 | /* no change for packets without checksum offloading */ | ||
1329 | if (skb->ip_summed != CHECKSUM_PARTIAL) | ||
1330 | return 0; | ||
1331 | |||
1332 | /* make sure we can modify the header */ | ||
1333 | if (unlikely(skb_cow_head(skb, 0))) | ||
1334 | return -1; | ||
1335 | |||
1336 | /* initialize checksum field | ||
1337 | * This is required - at least for Zynq, which otherwise calculates | ||
1338 | * wrong UDP header checksums for UDP packets with UDP data len <=2 | ||
1339 | */ | ||
1340 | *(__sum16 *)(skb_checksum_start(skb) + skb->csum_offset) = 0; | ||
1341 | return 0; | ||
1342 | } | ||
1343 | |||
1326 | static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | 1344 | static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1327 | { | 1345 | { |
1328 | u16 queue_index = skb_get_queue_mapping(skb); | 1346 | u16 queue_index = skb_get_queue_mapping(skb); |
@@ -1362,6 +1380,11 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1362 | return NETDEV_TX_BUSY; | 1380 | return NETDEV_TX_BUSY; |
1363 | } | 1381 | } |
1364 | 1382 | ||
1383 | if (macb_clear_csum(skb)) { | ||
1384 | dev_kfree_skb_any(skb); | ||
1385 | return NETDEV_TX_OK; | ||
1386 | } | ||
1387 | |||
1365 | /* Map socket buffer for DMA transfer */ | 1388 | /* Map socket buffer for DMA transfer */ |
1366 | if (!macb_tx_map(bp, queue, skb)) { | 1389 | if (!macb_tx_map(bp, queue, skb)) { |
1367 | dev_kfree_skb_any(skb); | 1390 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h index 83025bb4737c..e29815d9e6f4 100644 --- a/drivers/net/ethernet/cavium/thunder/nic.h +++ b/drivers/net/ethernet/cavium/thunder/nic.h | |||
@@ -279,6 +279,7 @@ struct nicvf { | |||
279 | u8 sqs_id; | 279 | u8 sqs_id; |
280 | bool sqs_mode; | 280 | bool sqs_mode; |
281 | bool hw_tso; | 281 | bool hw_tso; |
282 | bool t88; | ||
282 | 283 | ||
283 | /* Receive buffer alloc */ | 284 | /* Receive buffer alloc */ |
284 | u32 rb_page_offset; | 285 | u32 rb_page_offset; |
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 16ed20357c5c..85cc782b9060 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c | |||
@@ -251,9 +251,14 @@ static void nic_set_tx_pkt_pad(struct nicpf *nic, int size) | |||
251 | int lmac; | 251 | int lmac; |
252 | u64 lmac_cfg; | 252 | u64 lmac_cfg; |
253 | 253 | ||
254 | /* Max value that can be set is 60 */ | 254 | /* There is a issue in HW where-in while sending GSO sized |
255 | if (size > 60) | 255 | * pkts as part of TSO, if pkt len falls below this size |
256 | size = 60; | 256 | * NIC will zero PAD packet and also updates IP total length. |
257 | * Hence set this value to lessthan min pkt size of MAC+IP+TCP | ||
258 | * headers, BGX will do the padding to transmit 64 byte pkt. | ||
259 | */ | ||
260 | if (size > 52) | ||
261 | size = 52; | ||
257 | 262 | ||
258 | for (lmac = 0; lmac < (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX); lmac++) { | 263 | for (lmac = 0; lmac < (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX); lmac++) { |
259 | lmac_cfg = nic_reg_read(nic, NIC_PF_LMAC_0_7_CFG | (lmac << 3)); | 264 | lmac_cfg = nic_reg_read(nic, NIC_PF_LMAC_0_7_CFG | (lmac << 3)); |
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index a19e73f11d73..3240349615bd 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c | |||
@@ -513,6 +513,7 @@ static void nicvf_snd_pkt_handler(struct net_device *netdev, | |||
513 | struct nicvf *nic = netdev_priv(netdev); | 513 | struct nicvf *nic = netdev_priv(netdev); |
514 | struct snd_queue *sq; | 514 | struct snd_queue *sq; |
515 | struct sq_hdr_subdesc *hdr; | 515 | struct sq_hdr_subdesc *hdr; |
516 | struct sq_hdr_subdesc *tso_sqe; | ||
516 | 517 | ||
517 | sq = &nic->qs->sq[cqe_tx->sq_idx]; | 518 | sq = &nic->qs->sq[cqe_tx->sq_idx]; |
518 | 519 | ||
@@ -527,17 +528,21 @@ static void nicvf_snd_pkt_handler(struct net_device *netdev, | |||
527 | 528 | ||
528 | nicvf_check_cqe_tx_errs(nic, cq, cqe_tx); | 529 | nicvf_check_cqe_tx_errs(nic, cq, cqe_tx); |
529 | skb = (struct sk_buff *)sq->skbuff[cqe_tx->sqe_ptr]; | 530 | skb = (struct sk_buff *)sq->skbuff[cqe_tx->sqe_ptr]; |
530 | /* For TSO offloaded packets only one SQE will have a valid SKB */ | ||
531 | if (skb) { | 531 | if (skb) { |
532 | /* Check for dummy descriptor used for HW TSO offload on 88xx */ | ||
533 | if (hdr->dont_send) { | ||
534 | /* Get actual TSO descriptors and free them */ | ||
535 | tso_sqe = | ||
536 | (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, hdr->rsvd2); | ||
537 | nicvf_put_sq_desc(sq, tso_sqe->subdesc_cnt + 1); | ||
538 | } | ||
532 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); | 539 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); |
533 | prefetch(skb); | 540 | prefetch(skb); |
534 | dev_consume_skb_any(skb); | 541 | dev_consume_skb_any(skb); |
535 | sq->skbuff[cqe_tx->sqe_ptr] = (u64)NULL; | 542 | sq->skbuff[cqe_tx->sqe_ptr] = (u64)NULL; |
536 | } else { | 543 | } else { |
537 | /* In case of HW TSO, HW sends a CQE for each segment of a TSO | 544 | /* In case of SW TSO on 88xx, only last segment will have |
538 | * packet instead of a single CQE for the whole TSO packet | 545 | * a SKB attached, so just free SQEs here. |
539 | * transmitted. Each of this CQE points to the same SQE, so | ||
540 | * avoid freeing same SQE multiple times. | ||
541 | */ | 546 | */ |
542 | if (!nic->hw_tso) | 547 | if (!nic->hw_tso) |
543 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); | 548 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); |
@@ -1502,6 +1507,7 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1502 | struct net_device *netdev; | 1507 | struct net_device *netdev; |
1503 | struct nicvf *nic; | 1508 | struct nicvf *nic; |
1504 | int err, qcount; | 1509 | int err, qcount; |
1510 | u16 sdevid; | ||
1505 | 1511 | ||
1506 | err = pci_enable_device(pdev); | 1512 | err = pci_enable_device(pdev); |
1507 | if (err) { | 1513 | if (err) { |
@@ -1575,6 +1581,10 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1575 | if (!pass1_silicon(nic->pdev)) | 1581 | if (!pass1_silicon(nic->pdev)) |
1576 | nic->hw_tso = true; | 1582 | nic->hw_tso = true; |
1577 | 1583 | ||
1584 | pci_read_config_word(nic->pdev, PCI_SUBSYSTEM_ID, &sdevid); | ||
1585 | if (sdevid == 0xA134) | ||
1586 | nic->t88 = true; | ||
1587 | |||
1578 | /* Check if this VF is in QS only mode */ | 1588 | /* Check if this VF is in QS only mode */ |
1579 | if (nic->sqs_mode) | 1589 | if (nic->sqs_mode) |
1580 | return 0; | 1590 | return 0; |
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 0ff8e60deccb..dda3ea3f3bb6 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c | |||
@@ -938,6 +938,8 @@ static int nicvf_tso_count_subdescs(struct sk_buff *skb) | |||
938 | return num_edescs + sh->gso_segs; | 938 | return num_edescs + sh->gso_segs; |
939 | } | 939 | } |
940 | 940 | ||
941 | #define POST_CQE_DESC_COUNT 2 | ||
942 | |||
941 | /* Get the number of SQ descriptors needed to xmit this skb */ | 943 | /* Get the number of SQ descriptors needed to xmit this skb */ |
942 | static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) | 944 | static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) |
943 | { | 945 | { |
@@ -948,6 +950,10 @@ static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) | |||
948 | return subdesc_cnt; | 950 | return subdesc_cnt; |
949 | } | 951 | } |
950 | 952 | ||
953 | /* Dummy descriptors to get TSO pkt completion notification */ | ||
954 | if (nic->t88 && nic->hw_tso && skb_shinfo(skb)->gso_size) | ||
955 | subdesc_cnt += POST_CQE_DESC_COUNT; | ||
956 | |||
951 | if (skb_shinfo(skb)->nr_frags) | 957 | if (skb_shinfo(skb)->nr_frags) |
952 | subdesc_cnt += skb_shinfo(skb)->nr_frags; | 958 | subdesc_cnt += skb_shinfo(skb)->nr_frags; |
953 | 959 | ||
@@ -965,14 +971,21 @@ nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct snd_queue *sq, int qentry, | |||
965 | struct sq_hdr_subdesc *hdr; | 971 | struct sq_hdr_subdesc *hdr; |
966 | 972 | ||
967 | hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); | 973 | hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); |
968 | sq->skbuff[qentry] = (u64)skb; | ||
969 | |||
970 | memset(hdr, 0, SND_QUEUE_DESC_SIZE); | 974 | memset(hdr, 0, SND_QUEUE_DESC_SIZE); |
971 | hdr->subdesc_type = SQ_DESC_TYPE_HEADER; | 975 | hdr->subdesc_type = SQ_DESC_TYPE_HEADER; |
972 | /* Enable notification via CQE after processing SQE */ | 976 | |
973 | hdr->post_cqe = 1; | 977 | if (nic->t88 && nic->hw_tso && skb_shinfo(skb)->gso_size) { |
974 | /* No of subdescriptors following this */ | 978 | /* post_cqe = 0, to avoid HW posting a CQE for every TSO |
975 | hdr->subdesc_cnt = subdesc_cnt; | 979 | * segment transmitted on 88xx. |
980 | */ | ||
981 | hdr->subdesc_cnt = subdesc_cnt - POST_CQE_DESC_COUNT; | ||
982 | } else { | ||
983 | sq->skbuff[qentry] = (u64)skb; | ||
984 | /* Enable notification via CQE after processing SQE */ | ||
985 | hdr->post_cqe = 1; | ||
986 | /* No of subdescriptors following this */ | ||
987 | hdr->subdesc_cnt = subdesc_cnt; | ||
988 | } | ||
976 | hdr->tot_len = len; | 989 | hdr->tot_len = len; |
977 | 990 | ||
978 | /* Offload checksum calculation to HW */ | 991 | /* Offload checksum calculation to HW */ |
@@ -1023,6 +1036,37 @@ static inline void nicvf_sq_add_gather_subdesc(struct snd_queue *sq, int qentry, | |||
1023 | gather->addr = data; | 1036 | gather->addr = data; |
1024 | } | 1037 | } |
1025 | 1038 | ||
1039 | /* Add HDR + IMMEDIATE subdescriptors right after descriptors of a TSO | ||
1040 | * packet so that a CQE is posted as a notifation for transmission of | ||
1041 | * TSO packet. | ||
1042 | */ | ||
1043 | static inline void nicvf_sq_add_cqe_subdesc(struct snd_queue *sq, int qentry, | ||
1044 | int tso_sqe, struct sk_buff *skb) | ||
1045 | { | ||
1046 | struct sq_imm_subdesc *imm; | ||
1047 | struct sq_hdr_subdesc *hdr; | ||
1048 | |||
1049 | sq->skbuff[qentry] = (u64)skb; | ||
1050 | |||
1051 | hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); | ||
1052 | memset(hdr, 0, SND_QUEUE_DESC_SIZE); | ||
1053 | hdr->subdesc_type = SQ_DESC_TYPE_HEADER; | ||
1054 | /* Enable notification via CQE after processing SQE */ | ||
1055 | hdr->post_cqe = 1; | ||
1056 | /* There is no packet to transmit here */ | ||
1057 | hdr->dont_send = 1; | ||
1058 | hdr->subdesc_cnt = POST_CQE_DESC_COUNT - 1; | ||
1059 | hdr->tot_len = 1; | ||
1060 | /* Actual TSO header SQE index, needed for cleanup */ | ||
1061 | hdr->rsvd2 = tso_sqe; | ||
1062 | |||
1063 | qentry = nicvf_get_nxt_sqentry(sq, qentry); | ||
1064 | imm = (struct sq_imm_subdesc *)GET_SQ_DESC(sq, qentry); | ||
1065 | memset(imm, 0, SND_QUEUE_DESC_SIZE); | ||
1066 | imm->subdesc_type = SQ_DESC_TYPE_IMMEDIATE; | ||
1067 | imm->len = 1; | ||
1068 | } | ||
1069 | |||
1026 | /* Segment a TSO packet into 'gso_size' segments and append | 1070 | /* Segment a TSO packet into 'gso_size' segments and append |
1027 | * them to SQ for transfer | 1071 | * them to SQ for transfer |
1028 | */ | 1072 | */ |
@@ -1096,7 +1140,7 @@ static int nicvf_sq_append_tso(struct nicvf *nic, struct snd_queue *sq, | |||
1096 | int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) | 1140 | int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) |
1097 | { | 1141 | { |
1098 | int i, size; | 1142 | int i, size; |
1099 | int subdesc_cnt; | 1143 | int subdesc_cnt, tso_sqe = 0; |
1100 | int sq_num, qentry; | 1144 | int sq_num, qentry; |
1101 | struct queue_set *qs; | 1145 | struct queue_set *qs; |
1102 | struct snd_queue *sq; | 1146 | struct snd_queue *sq; |
@@ -1131,6 +1175,7 @@ int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) | |||
1131 | /* Add SQ header subdesc */ | 1175 | /* Add SQ header subdesc */ |
1132 | nicvf_sq_add_hdr_subdesc(nic, sq, qentry, subdesc_cnt - 1, | 1176 | nicvf_sq_add_hdr_subdesc(nic, sq, qentry, subdesc_cnt - 1, |
1133 | skb, skb->len); | 1177 | skb, skb->len); |
1178 | tso_sqe = qentry; | ||
1134 | 1179 | ||
1135 | /* Add SQ gather subdescs */ | 1180 | /* Add SQ gather subdescs */ |
1136 | qentry = nicvf_get_nxt_sqentry(sq, qentry); | 1181 | qentry = nicvf_get_nxt_sqentry(sq, qentry); |
@@ -1154,6 +1199,11 @@ int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) | |||
1154 | } | 1199 | } |
1155 | 1200 | ||
1156 | doorbell: | 1201 | doorbell: |
1202 | if (nic->t88 && skb_shinfo(skb)->gso_size) { | ||
1203 | qentry = nicvf_get_nxt_sqentry(sq, qentry); | ||
1204 | nicvf_sq_add_cqe_subdesc(sq, qentry, tso_sqe, skb); | ||
1205 | } | ||
1206 | |||
1157 | /* make sure all memory stores are done before ringing doorbell */ | 1207 | /* make sure all memory stores are done before ringing doorbell */ |
1158 | smp_wmb(); | 1208 | smp_wmb(); |
1159 | 1209 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 828ed28c3c14..d0b3a1bb82ca 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -5113,9 +5113,13 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf) | |||
5113 | DCB_CAP_DCBX_VER_IEEE; | 5113 | DCB_CAP_DCBX_VER_IEEE; |
5114 | 5114 | ||
5115 | pf->flags |= I40E_FLAG_DCB_CAPABLE; | 5115 | pf->flags |= I40E_FLAG_DCB_CAPABLE; |
5116 | /* Enable DCB tagging only when more than one TC */ | 5116 | /* Enable DCB tagging only when more than one TC |
5117 | * or explicitly disable if only one TC | ||
5118 | */ | ||
5117 | if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1) | 5119 | if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1) |
5118 | pf->flags |= I40E_FLAG_DCB_ENABLED; | 5120 | pf->flags |= I40E_FLAG_DCB_ENABLED; |
5121 | else | ||
5122 | pf->flags &= ~I40E_FLAG_DCB_ENABLED; | ||
5119 | dev_dbg(&pf->pdev->dev, | 5123 | dev_dbg(&pf->pdev->dev, |
5120 | "DCBX offload is supported for this PF.\n"); | 5124 | "DCBX offload is supported for this PF.\n"); |
5121 | } | 5125 | } |
@@ -5716,7 +5720,7 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf, | |||
5716 | u8 type; | 5720 | u8 type; |
5717 | 5721 | ||
5718 | /* Not DCB capable or capability disabled */ | 5722 | /* Not DCB capable or capability disabled */ |
5719 | if (!(pf->flags & I40E_FLAG_DCB_CAPABLE)) | 5723 | if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) |
5720 | return ret; | 5724 | return ret; |
5721 | 5725 | ||
5722 | /* Ignore if event is not for Nearest Bridge */ | 5726 | /* Ignore if event is not for Nearest Bridge */ |
@@ -7896,6 +7900,7 @@ static int i40e_init_interrupt_scheme(struct i40e_pf *pf) | |||
7896 | #endif | 7900 | #endif |
7897 | I40E_FLAG_RSS_ENABLED | | 7901 | I40E_FLAG_RSS_ENABLED | |
7898 | I40E_FLAG_DCB_CAPABLE | | 7902 | I40E_FLAG_DCB_CAPABLE | |
7903 | I40E_FLAG_DCB_ENABLED | | ||
7899 | I40E_FLAG_SRIOV_ENABLED | | 7904 | I40E_FLAG_SRIOV_ENABLED | |
7900 | I40E_FLAG_FD_SB_ENABLED | | 7905 | I40E_FLAG_FD_SB_ENABLED | |
7901 | I40E_FLAG_FD_ATR_ENABLED | | 7906 | I40E_FLAG_FD_ATR_ENABLED | |
@@ -10502,6 +10507,7 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) | |||
10502 | I40E_FLAG_FD_SB_ENABLED | | 10507 | I40E_FLAG_FD_SB_ENABLED | |
10503 | I40E_FLAG_FD_ATR_ENABLED | | 10508 | I40E_FLAG_FD_ATR_ENABLED | |
10504 | I40E_FLAG_DCB_CAPABLE | | 10509 | I40E_FLAG_DCB_CAPABLE | |
10510 | I40E_FLAG_DCB_ENABLED | | ||
10505 | I40E_FLAG_SRIOV_ENABLED | | 10511 | I40E_FLAG_SRIOV_ENABLED | |
10506 | I40E_FLAG_VMDQ_ENABLED); | 10512 | I40E_FLAG_VMDQ_ENABLED); |
10507 | } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | | 10513 | } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | |
@@ -10525,7 +10531,8 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) | |||
10525 | /* Not enough queues for all TCs */ | 10531 | /* Not enough queues for all TCs */ |
10526 | if ((pf->flags & I40E_FLAG_DCB_CAPABLE) && | 10532 | if ((pf->flags & I40E_FLAG_DCB_CAPABLE) && |
10527 | (queues_left < I40E_MAX_TRAFFIC_CLASS)) { | 10533 | (queues_left < I40E_MAX_TRAFFIC_CLASS)) { |
10528 | pf->flags &= ~I40E_FLAG_DCB_CAPABLE; | 10534 | pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | |
10535 | I40E_FLAG_DCB_ENABLED); | ||
10529 | dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); | 10536 | dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); |
10530 | } | 10537 | } |
10531 | pf->num_lan_qps = max_t(int, pf->rss_size_max, | 10538 | pf->num_lan_qps = max_t(int, pf->rss_size_max, |
@@ -10922,7 +10929,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
10922 | err = i40e_init_pf_dcb(pf); | 10929 | err = i40e_init_pf_dcb(pf); |
10923 | if (err) { | 10930 | if (err) { |
10924 | dev_info(&pdev->dev, "DCB init failed %d, disabled\n", err); | 10931 | dev_info(&pdev->dev, "DCB init failed %d, disabled\n", err); |
10925 | pf->flags &= ~I40E_FLAG_DCB_CAPABLE; | 10932 | pf->flags &= ~(I40E_FLAG_DCB_CAPABLE & I40E_FLAG_DCB_ENABLED); |
10926 | /* Continue without DCB enabled */ | 10933 | /* Continue without DCB enabled */ |
10927 | } | 10934 | } |
10928 | #endif /* CONFIG_I40E_DCB */ | 10935 | #endif /* CONFIG_I40E_DCB */ |
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index f1609542adf1..d9199151a83e 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | |||
@@ -50,6 +50,10 @@ static const struct mtk_ethtool_stats { | |||
50 | MTK_ETHTOOL_STAT(rx_flow_control_packets), | 50 | MTK_ETHTOOL_STAT(rx_flow_control_packets), |
51 | }; | 51 | }; |
52 | 52 | ||
53 | static const char * const mtk_clks_source_name[] = { | ||
54 | "ethif", "esw", "gp1", "gp2" | ||
55 | }; | ||
56 | |||
53 | void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) | 57 | void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) |
54 | { | 58 | { |
55 | __raw_writel(val, eth->base + reg); | 59 | __raw_writel(val, eth->base + reg); |
@@ -291,7 +295,7 @@ err_phy: | |||
291 | static int mtk_mdio_init(struct mtk_eth *eth) | 295 | static int mtk_mdio_init(struct mtk_eth *eth) |
292 | { | 296 | { |
293 | struct device_node *mii_np; | 297 | struct device_node *mii_np; |
294 | int err; | 298 | int ret; |
295 | 299 | ||
296 | mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus"); | 300 | mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus"); |
297 | if (!mii_np) { | 301 | if (!mii_np) { |
@@ -300,13 +304,13 @@ static int mtk_mdio_init(struct mtk_eth *eth) | |||
300 | } | 304 | } |
301 | 305 | ||
302 | if (!of_device_is_available(mii_np)) { | 306 | if (!of_device_is_available(mii_np)) { |
303 | err = 0; | 307 | ret = -ENODEV; |
304 | goto err_put_node; | 308 | goto err_put_node; |
305 | } | 309 | } |
306 | 310 | ||
307 | eth->mii_bus = mdiobus_alloc(); | 311 | eth->mii_bus = devm_mdiobus_alloc(eth->dev); |
308 | if (!eth->mii_bus) { | 312 | if (!eth->mii_bus) { |
309 | err = -ENOMEM; | 313 | ret = -ENOMEM; |
310 | goto err_put_node; | 314 | goto err_put_node; |
311 | } | 315 | } |
312 | 316 | ||
@@ -317,19 +321,11 @@ static int mtk_mdio_init(struct mtk_eth *eth) | |||
317 | eth->mii_bus->parent = eth->dev; | 321 | eth->mii_bus->parent = eth->dev; |
318 | 322 | ||
319 | snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%s", mii_np->name); | 323 | snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%s", mii_np->name); |
320 | err = of_mdiobus_register(eth->mii_bus, mii_np); | 324 | ret = of_mdiobus_register(eth->mii_bus, mii_np); |
321 | if (err) | ||
322 | goto err_free_bus; | ||
323 | |||
324 | return 0; | ||
325 | |||
326 | err_free_bus: | ||
327 | mdiobus_free(eth->mii_bus); | ||
328 | 325 | ||
329 | err_put_node: | 326 | err_put_node: |
330 | of_node_put(mii_np); | 327 | of_node_put(mii_np); |
331 | eth->mii_bus = NULL; | 328 | return ret; |
332 | return err; | ||
333 | } | 329 | } |
334 | 330 | ||
335 | static void mtk_mdio_cleanup(struct mtk_eth *eth) | 331 | static void mtk_mdio_cleanup(struct mtk_eth *eth) |
@@ -338,8 +334,6 @@ static void mtk_mdio_cleanup(struct mtk_eth *eth) | |||
338 | return; | 334 | return; |
339 | 335 | ||
340 | mdiobus_unregister(eth->mii_bus); | 336 | mdiobus_unregister(eth->mii_bus); |
341 | of_node_put(eth->mii_bus->dev.of_node); | ||
342 | mdiobus_free(eth->mii_bus); | ||
343 | } | 337 | } |
344 | 338 | ||
345 | static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) | 339 | static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) |
@@ -588,14 +582,15 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
588 | dma_addr_t mapped_addr; | 582 | dma_addr_t mapped_addr; |
589 | unsigned int nr_frags; | 583 | unsigned int nr_frags; |
590 | int i, n_desc = 1; | 584 | int i, n_desc = 1; |
591 | u32 txd4 = 0; | 585 | u32 txd4 = 0, fport; |
592 | 586 | ||
593 | itxd = ring->next_free; | 587 | itxd = ring->next_free; |
594 | if (itxd == ring->last_free) | 588 | if (itxd == ring->last_free) |
595 | return -ENOMEM; | 589 | return -ENOMEM; |
596 | 590 | ||
597 | /* set the forward port */ | 591 | /* set the forward port */ |
598 | txd4 |= (mac->id + 1) << TX_DMA_FPORT_SHIFT; | 592 | fport = (mac->id + 1) << TX_DMA_FPORT_SHIFT; |
593 | txd4 |= fport; | ||
599 | 594 | ||
600 | tx_buf = mtk_desc_to_tx_buf(ring, itxd); | 595 | tx_buf = mtk_desc_to_tx_buf(ring, itxd); |
601 | memset(tx_buf, 0, sizeof(*tx_buf)); | 596 | memset(tx_buf, 0, sizeof(*tx_buf)); |
@@ -653,7 +648,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
653 | WRITE_ONCE(txd->txd3, (TX_DMA_SWC | | 648 | WRITE_ONCE(txd->txd3, (TX_DMA_SWC | |
654 | TX_DMA_PLEN0(frag_map_size) | | 649 | TX_DMA_PLEN0(frag_map_size) | |
655 | last_frag * TX_DMA_LS0)); | 650 | last_frag * TX_DMA_LS0)); |
656 | WRITE_ONCE(txd->txd4, 0); | 651 | WRITE_ONCE(txd->txd4, fport); |
657 | 652 | ||
658 | tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC; | 653 | tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC; |
659 | tx_buf = mtk_desc_to_tx_buf(ring, txd); | 654 | tx_buf = mtk_desc_to_tx_buf(ring, txd); |
@@ -865,7 +860,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, | |||
865 | /* receive data */ | 860 | /* receive data */ |
866 | skb = build_skb(data, ring->frag_size); | 861 | skb = build_skb(data, ring->frag_size); |
867 | if (unlikely(!skb)) { | 862 | if (unlikely(!skb)) { |
868 | put_page(virt_to_head_page(new_data)); | 863 | skb_free_frag(new_data); |
869 | netdev->stats.rx_dropped++; | 864 | netdev->stats.rx_dropped++; |
870 | goto release_desc; | 865 | goto release_desc; |
871 | } | 866 | } |
@@ -1506,10 +1501,7 @@ static void mtk_uninit(struct net_device *dev) | |||
1506 | struct mtk_eth *eth = mac->hw; | 1501 | struct mtk_eth *eth = mac->hw; |
1507 | 1502 | ||
1508 | phy_disconnect(mac->phy_dev); | 1503 | phy_disconnect(mac->phy_dev); |
1509 | mtk_mdio_cleanup(eth); | ||
1510 | mtk_irq_disable(eth, ~0); | 1504 | mtk_irq_disable(eth, ~0); |
1511 | free_irq(eth->irq[1], dev); | ||
1512 | free_irq(eth->irq[2], dev); | ||
1513 | } | 1505 | } |
1514 | 1506 | ||
1515 | static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 1507 | static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
@@ -1813,6 +1805,7 @@ static int mtk_probe(struct platform_device *pdev) | |||
1813 | if (!eth) | 1805 | if (!eth) |
1814 | return -ENOMEM; | 1806 | return -ENOMEM; |
1815 | 1807 | ||
1808 | eth->dev = &pdev->dev; | ||
1816 | eth->base = devm_ioremap_resource(&pdev->dev, res); | 1809 | eth->base = devm_ioremap_resource(&pdev->dev, res); |
1817 | if (IS_ERR(eth->base)) | 1810 | if (IS_ERR(eth->base)) |
1818 | return PTR_ERR(eth->base); | 1811 | return PTR_ERR(eth->base); |
@@ -1847,21 +1840,21 @@ static int mtk_probe(struct platform_device *pdev) | |||
1847 | return -ENXIO; | 1840 | return -ENXIO; |
1848 | } | 1841 | } |
1849 | } | 1842 | } |
1843 | for (i = 0; i < ARRAY_SIZE(eth->clks); i++) { | ||
1844 | eth->clks[i] = devm_clk_get(eth->dev, | ||
1845 | mtk_clks_source_name[i]); | ||
1846 | if (IS_ERR(eth->clks[i])) { | ||
1847 | if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER) | ||
1848 | return -EPROBE_DEFER; | ||
1849 | return -ENODEV; | ||
1850 | } | ||
1851 | } | ||
1850 | 1852 | ||
1851 | eth->clk_ethif = devm_clk_get(&pdev->dev, "ethif"); | 1853 | clk_prepare_enable(eth->clks[MTK_CLK_ETHIF]); |
1852 | eth->clk_esw = devm_clk_get(&pdev->dev, "esw"); | 1854 | clk_prepare_enable(eth->clks[MTK_CLK_ESW]); |
1853 | eth->clk_gp1 = devm_clk_get(&pdev->dev, "gp1"); | 1855 | clk_prepare_enable(eth->clks[MTK_CLK_GP1]); |
1854 | eth->clk_gp2 = devm_clk_get(&pdev->dev, "gp2"); | 1856 | clk_prepare_enable(eth->clks[MTK_CLK_GP2]); |
1855 | if (IS_ERR(eth->clk_esw) || IS_ERR(eth->clk_gp1) || | ||
1856 | IS_ERR(eth->clk_gp2) || IS_ERR(eth->clk_ethif)) | ||
1857 | return -ENODEV; | ||
1858 | |||
1859 | clk_prepare_enable(eth->clk_ethif); | ||
1860 | clk_prepare_enable(eth->clk_esw); | ||
1861 | clk_prepare_enable(eth->clk_gp1); | ||
1862 | clk_prepare_enable(eth->clk_gp2); | ||
1863 | 1857 | ||
1864 | eth->dev = &pdev->dev; | ||
1865 | eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE); | 1858 | eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE); |
1866 | INIT_WORK(ð->pending_work, mtk_pending_work); | 1859 | INIT_WORK(ð->pending_work, mtk_pending_work); |
1867 | 1860 | ||
@@ -1903,15 +1896,24 @@ err_free_dev: | |||
1903 | static int mtk_remove(struct platform_device *pdev) | 1896 | static int mtk_remove(struct platform_device *pdev) |
1904 | { | 1897 | { |
1905 | struct mtk_eth *eth = platform_get_drvdata(pdev); | 1898 | struct mtk_eth *eth = platform_get_drvdata(pdev); |
1899 | int i; | ||
1906 | 1900 | ||
1907 | clk_disable_unprepare(eth->clk_ethif); | 1901 | /* stop all devices to make sure that dma is properly shut down */ |
1908 | clk_disable_unprepare(eth->clk_esw); | 1902 | for (i = 0; i < MTK_MAC_COUNT; i++) { |
1909 | clk_disable_unprepare(eth->clk_gp1); | 1903 | if (!eth->netdev[i]) |
1910 | clk_disable_unprepare(eth->clk_gp2); | 1904 | continue; |
1905 | mtk_stop(eth->netdev[i]); | ||
1906 | } | ||
1907 | |||
1908 | clk_disable_unprepare(eth->clks[MTK_CLK_ETHIF]); | ||
1909 | clk_disable_unprepare(eth->clks[MTK_CLK_ESW]); | ||
1910 | clk_disable_unprepare(eth->clks[MTK_CLK_GP1]); | ||
1911 | clk_disable_unprepare(eth->clks[MTK_CLK_GP2]); | ||
1911 | 1912 | ||
1912 | netif_napi_del(ð->tx_napi); | 1913 | netif_napi_del(ð->tx_napi); |
1913 | netif_napi_del(ð->rx_napi); | 1914 | netif_napi_del(ð->rx_napi); |
1914 | mtk_cleanup(eth); | 1915 | mtk_cleanup(eth); |
1916 | mtk_mdio_cleanup(eth); | ||
1915 | platform_set_drvdata(pdev, NULL); | 1917 | platform_set_drvdata(pdev, NULL); |
1916 | 1918 | ||
1917 | return 0; | 1919 | return 0; |
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index f82e3acb947b..6e1ade7a25c5 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h | |||
@@ -290,6 +290,17 @@ enum mtk_tx_flags { | |||
290 | MTK_TX_FLAGS_PAGE0 = 0x02, | 290 | MTK_TX_FLAGS_PAGE0 = 0x02, |
291 | }; | 291 | }; |
292 | 292 | ||
293 | /* This enum allows us to identify how the clock is defined on the array of the | ||
294 | * clock in the order | ||
295 | */ | ||
296 | enum mtk_clks_map { | ||
297 | MTK_CLK_ETHIF, | ||
298 | MTK_CLK_ESW, | ||
299 | MTK_CLK_GP1, | ||
300 | MTK_CLK_GP2, | ||
301 | MTK_CLK_MAX | ||
302 | }; | ||
303 | |||
293 | /* struct mtk_tx_buf - This struct holds the pointers to the memory pointed at | 304 | /* struct mtk_tx_buf - This struct holds the pointers to the memory pointed at |
294 | * by the TX descriptor s | 305 | * by the TX descriptor s |
295 | * @skb: The SKB pointer of the packet being sent | 306 | * @skb: The SKB pointer of the packet being sent |
@@ -370,10 +381,7 @@ struct mtk_rx_ring { | |||
370 | * @scratch_ring: Newer SoCs need memory for a second HW managed TX ring | 381 | * @scratch_ring: Newer SoCs need memory for a second HW managed TX ring |
371 | * @phy_scratch_ring: physical address of scratch_ring | 382 | * @phy_scratch_ring: physical address of scratch_ring |
372 | * @scratch_head: The scratch memory that scratch_ring points to. | 383 | * @scratch_head: The scratch memory that scratch_ring points to. |
373 | * @clk_ethif: The ethif clock | 384 | * @clks: clock array for all clocks required |
374 | * @clk_esw: The switch clock | ||
375 | * @clk_gp1: The gmac1 clock | ||
376 | * @clk_gp2: The gmac2 clock | ||
377 | * @mii_bus: If there is a bus we need to create an instance for it | 385 | * @mii_bus: If there is a bus we need to create an instance for it |
378 | * @pending_work: The workqueue used to reset the dma ring | 386 | * @pending_work: The workqueue used to reset the dma ring |
379 | */ | 387 | */ |
@@ -400,10 +408,8 @@ struct mtk_eth { | |||
400 | struct mtk_tx_dma *scratch_ring; | 408 | struct mtk_tx_dma *scratch_ring; |
401 | dma_addr_t phy_scratch_ring; | 409 | dma_addr_t phy_scratch_ring; |
402 | void *scratch_head; | 410 | void *scratch_head; |
403 | struct clk *clk_ethif; | 411 | struct clk *clks[MTK_CLK_MAX]; |
404 | struct clk *clk_esw; | 412 | |
405 | struct clk *clk_gp1; | ||
406 | struct clk *clk_gp2; | ||
407 | struct mii_bus *mii_bus; | 413 | struct mii_bus *mii_bus; |
408 | struct work_struct pending_work; | 414 | struct work_struct pending_work; |
409 | }; | 415 | }; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c index 99c6bbdff501..b04760a5034b 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c | |||
@@ -94,7 +94,7 @@ static u8 mlx4_en_dcbnl_getcap(struct net_device *dev, int capid, u8 *cap) | |||
94 | *cap = true; | 94 | *cap = true; |
95 | break; | 95 | break; |
96 | case DCB_CAP_ATTR_DCBX: | 96 | case DCB_CAP_ATTR_DCBX: |
97 | *cap = priv->cee_params.dcbx_cap; | 97 | *cap = priv->dcbx_cap; |
98 | break; | 98 | break; |
99 | case DCB_CAP_ATTR_PFC_TCS: | 99 | case DCB_CAP_ATTR_PFC_TCS: |
100 | *cap = 1 << mlx4_max_tc(priv->mdev->dev); | 100 | *cap = 1 << mlx4_max_tc(priv->mdev->dev); |
@@ -111,14 +111,14 @@ static u8 mlx4_en_dcbnl_getpfcstate(struct net_device *netdev) | |||
111 | { | 111 | { |
112 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 112 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
113 | 113 | ||
114 | return priv->cee_params.dcb_cfg.pfc_state; | 114 | return priv->cee_config.pfc_state; |
115 | } | 115 | } |
116 | 116 | ||
117 | static void mlx4_en_dcbnl_setpfcstate(struct net_device *netdev, u8 state) | 117 | static void mlx4_en_dcbnl_setpfcstate(struct net_device *netdev, u8 state) |
118 | { | 118 | { |
119 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 119 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
120 | 120 | ||
121 | priv->cee_params.dcb_cfg.pfc_state = state; | 121 | priv->cee_config.pfc_state = state; |
122 | } | 122 | } |
123 | 123 | ||
124 | static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, | 124 | static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, |
@@ -126,7 +126,7 @@ static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, | |||
126 | { | 126 | { |
127 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 127 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
128 | 128 | ||
129 | *setting = priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc; | 129 | *setting = priv->cee_config.dcb_pfc[priority]; |
130 | } | 130 | } |
131 | 131 | ||
132 | static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, | 132 | static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, |
@@ -134,8 +134,8 @@ static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, | |||
134 | { | 134 | { |
135 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 135 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
136 | 136 | ||
137 | priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc = setting; | 137 | priv->cee_config.dcb_pfc[priority] = setting; |
138 | priv->cee_params.dcb_cfg.pfc_state = true; | 138 | priv->cee_config.pfc_state = true; |
139 | } | 139 | } |
140 | 140 | ||
141 | static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) | 141 | static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) |
@@ -157,13 +157,11 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) | |||
157 | { | 157 | { |
158 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 158 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
159 | struct mlx4_en_dev *mdev = priv->mdev; | 159 | struct mlx4_en_dev *mdev = priv->mdev; |
160 | struct mlx4_en_cee_config *dcb_cfg = &priv->cee_params.dcb_cfg; | ||
161 | int err = 0; | ||
162 | 160 | ||
163 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 161 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
164 | return -EINVAL; | 162 | return 1; |
165 | 163 | ||
166 | if (dcb_cfg->pfc_state) { | 164 | if (priv->cee_config.pfc_state) { |
167 | int tc; | 165 | int tc; |
168 | 166 | ||
169 | priv->prof->rx_pause = 0; | 167 | priv->prof->rx_pause = 0; |
@@ -171,7 +169,7 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) | |||
171 | for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { | 169 | for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { |
172 | u8 tc_mask = 1 << tc; | 170 | u8 tc_mask = 1 << tc; |
173 | 171 | ||
174 | switch (dcb_cfg->tc_config[tc].dcb_pfc) { | 172 | switch (priv->cee_config.dcb_pfc[tc]) { |
175 | case pfc_disabled: | 173 | case pfc_disabled: |
176 | priv->prof->tx_ppp &= ~tc_mask; | 174 | priv->prof->tx_ppp &= ~tc_mask; |
177 | priv->prof->rx_ppp &= ~tc_mask; | 175 | priv->prof->rx_ppp &= ~tc_mask; |
@@ -199,15 +197,17 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) | |||
199 | en_dbg(DRV, priv, "Set pfc off\n"); | 197 | en_dbg(DRV, priv, "Set pfc off\n"); |
200 | } | 198 | } |
201 | 199 | ||
202 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 200 | if (mlx4_SET_PORT_general(mdev->dev, priv->port, |
203 | priv->rx_skb_size + ETH_FCS_LEN, | 201 | priv->rx_skb_size + ETH_FCS_LEN, |
204 | priv->prof->tx_pause, | 202 | priv->prof->tx_pause, |
205 | priv->prof->tx_ppp, | 203 | priv->prof->tx_ppp, |
206 | priv->prof->rx_pause, | 204 | priv->prof->rx_pause, |
207 | priv->prof->rx_ppp); | 205 | priv->prof->rx_ppp)) { |
208 | if (err) | ||
209 | en_err(priv, "Failed setting pause params\n"); | 206 | en_err(priv, "Failed setting pause params\n"); |
210 | return err; | 207 | return 1; |
208 | } | ||
209 | |||
210 | return 0; | ||
211 | } | 211 | } |
212 | 212 | ||
213 | static u8 mlx4_en_dcbnl_get_state(struct net_device *dev) | 213 | static u8 mlx4_en_dcbnl_get_state(struct net_device *dev) |
@@ -225,7 +225,7 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state) | |||
225 | struct mlx4_en_priv *priv = netdev_priv(dev); | 225 | struct mlx4_en_priv *priv = netdev_priv(dev); |
226 | int num_tcs = 0; | 226 | int num_tcs = 0; |
227 | 227 | ||
228 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 228 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
229 | return 1; | 229 | return 1; |
230 | 230 | ||
231 | if (!!(state) == !!(priv->flags & MLX4_EN_FLAG_DCB_ENABLED)) | 231 | if (!!(state) == !!(priv->flags & MLX4_EN_FLAG_DCB_ENABLED)) |
@@ -238,7 +238,10 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state) | |||
238 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; | 238 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; |
239 | } | 239 | } |
240 | 240 | ||
241 | return mlx4_en_setup_tc(dev, num_tcs); | 241 | if (mlx4_en_setup_tc(dev, num_tcs)) |
242 | return 1; | ||
243 | |||
244 | return 0; | ||
242 | } | 245 | } |
243 | 246 | ||
244 | /* On success returns a non-zero 802.1p user priority bitmap | 247 | /* On success returns a non-zero 802.1p user priority bitmap |
@@ -252,7 +255,7 @@ static int mlx4_en_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id) | |||
252 | .selector = idtype, | 255 | .selector = idtype, |
253 | .protocol = id, | 256 | .protocol = id, |
254 | }; | 257 | }; |
255 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 258 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
256 | return 0; | 259 | return 0; |
257 | 260 | ||
258 | return dcb_getapp(netdev, &app); | 261 | return dcb_getapp(netdev, &app); |
@@ -264,7 +267,7 @@ static int mlx4_en_dcbnl_setapp(struct net_device *netdev, u8 idtype, | |||
264 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 267 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
265 | struct dcb_app app; | 268 | struct dcb_app app; |
266 | 269 | ||
267 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 270 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
268 | return -EINVAL; | 271 | return -EINVAL; |
269 | 272 | ||
270 | memset(&app, 0, sizeof(struct dcb_app)); | 273 | memset(&app, 0, sizeof(struct dcb_app)); |
@@ -433,7 +436,7 @@ static u8 mlx4_en_dcbnl_getdcbx(struct net_device *dev) | |||
433 | { | 436 | { |
434 | struct mlx4_en_priv *priv = netdev_priv(dev); | 437 | struct mlx4_en_priv *priv = netdev_priv(dev); |
435 | 438 | ||
436 | return priv->cee_params.dcbx_cap; | 439 | return priv->dcbx_cap; |
437 | } | 440 | } |
438 | 441 | ||
439 | static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) | 442 | static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) |
@@ -442,7 +445,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) | |||
442 | struct ieee_ets ets = {0}; | 445 | struct ieee_ets ets = {0}; |
443 | struct ieee_pfc pfc = {0}; | 446 | struct ieee_pfc pfc = {0}; |
444 | 447 | ||
445 | if (mode == priv->cee_params.dcbx_cap) | 448 | if (mode == priv->dcbx_cap) |
446 | return 0; | 449 | return 0; |
447 | 450 | ||
448 | if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || | 451 | if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || |
@@ -451,7 +454,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) | |||
451 | !(mode & DCB_CAP_DCBX_HOST)) | 454 | !(mode & DCB_CAP_DCBX_HOST)) |
452 | goto err; | 455 | goto err; |
453 | 456 | ||
454 | priv->cee_params.dcbx_cap = mode; | 457 | priv->dcbx_cap = mode; |
455 | 458 | ||
456 | ets.ets_cap = IEEE_8021QAZ_MAX_TCS; | 459 | ets.ets_cap = IEEE_8021QAZ_MAX_TCS; |
457 | pfc.pfc_cap = IEEE_8021QAZ_MAX_TCS; | 460 | pfc.pfc_cap = IEEE_8021QAZ_MAX_TCS; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 4198e9bf89d0..fedb829276f4 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -71,10 +71,11 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up) | |||
71 | #ifdef CONFIG_MLX4_EN_DCB | 71 | #ifdef CONFIG_MLX4_EN_DCB |
72 | if (!mlx4_is_slave(priv->mdev->dev)) { | 72 | if (!mlx4_is_slave(priv->mdev->dev)) { |
73 | if (up) { | 73 | if (up) { |
74 | priv->flags |= MLX4_EN_FLAG_DCB_ENABLED; | 74 | if (priv->dcbx_cap) |
75 | priv->flags |= MLX4_EN_FLAG_DCB_ENABLED; | ||
75 | } else { | 76 | } else { |
76 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; | 77 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; |
77 | priv->cee_params.dcb_cfg.pfc_state = false; | 78 | priv->cee_config.pfc_state = false; |
78 | } | 79 | } |
79 | } | 80 | } |
80 | #endif /* CONFIG_MLX4_EN_DCB */ | 81 | #endif /* CONFIG_MLX4_EN_DCB */ |
@@ -3048,9 +3049,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
3048 | struct mlx4_en_priv *priv; | 3049 | struct mlx4_en_priv *priv; |
3049 | int i; | 3050 | int i; |
3050 | int err; | 3051 | int err; |
3051 | #ifdef CONFIG_MLX4_EN_DCB | ||
3052 | struct tc_configuration *tc; | ||
3053 | #endif | ||
3054 | 3052 | ||
3055 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), | 3053 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), |
3056 | MAX_TX_RINGS, MAX_RX_RINGS); | 3054 | MAX_TX_RINGS, MAX_RX_RINGS); |
@@ -3117,16 +3115,13 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
3117 | priv->msg_enable = MLX4_EN_MSG_LEVEL; | 3115 | priv->msg_enable = MLX4_EN_MSG_LEVEL; |
3118 | #ifdef CONFIG_MLX4_EN_DCB | 3116 | #ifdef CONFIG_MLX4_EN_DCB |
3119 | if (!mlx4_is_slave(priv->mdev->dev)) { | 3117 | if (!mlx4_is_slave(priv->mdev->dev)) { |
3120 | priv->cee_params.dcbx_cap = DCB_CAP_DCBX_VER_CEE | | 3118 | priv->dcbx_cap = DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_HOST | |
3121 | DCB_CAP_DCBX_HOST | | 3119 | DCB_CAP_DCBX_VER_IEEE; |
3122 | DCB_CAP_DCBX_VER_IEEE; | ||
3123 | priv->flags |= MLX4_EN_DCB_ENABLED; | 3120 | priv->flags |= MLX4_EN_DCB_ENABLED; |
3124 | priv->cee_params.dcb_cfg.pfc_state = false; | 3121 | priv->cee_config.pfc_state = false; |
3125 | 3122 | ||
3126 | for (i = 0; i < MLX4_EN_NUM_UP; i++) { | 3123 | for (i = 0; i < MLX4_EN_NUM_UP; i++) |
3127 | tc = &priv->cee_params.dcb_cfg.tc_config[i]; | 3124 | priv->cee_config.dcb_pfc[i] = pfc_disabled; |
3128 | tc->dcb_pfc = pfc_disabled; | ||
3129 | } | ||
3130 | 3125 | ||
3131 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) { | 3126 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) { |
3132 | dev->dcbnl_ops = &mlx4_en_dcbnl_ops; | 3127 | dev->dcbnl_ops = &mlx4_en_dcbnl_ops; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 9df87ca0515a..e2509bba3e7c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -818,7 +818,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
818 | real_size = get_real_size(skb, shinfo, dev, &lso_header_size, | 818 | real_size = get_real_size(skb, shinfo, dev, &lso_header_size, |
819 | &inline_ok, &fragptr); | 819 | &inline_ok, &fragptr); |
820 | if (unlikely(!real_size)) | 820 | if (unlikely(!real_size)) |
821 | goto tx_drop; | 821 | goto tx_drop_count; |
822 | 822 | ||
823 | /* Align descriptor to TXBB size */ | 823 | /* Align descriptor to TXBB size */ |
824 | desc_size = ALIGN(real_size, TXBB_SIZE); | 824 | desc_size = ALIGN(real_size, TXBB_SIZE); |
@@ -826,7 +826,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
826 | if (unlikely(nr_txbb > MAX_DESC_TXBBS)) { | 826 | if (unlikely(nr_txbb > MAX_DESC_TXBBS)) { |
827 | if (netif_msg_tx_err(priv)) | 827 | if (netif_msg_tx_err(priv)) |
828 | en_warn(priv, "Oversized header or SG list\n"); | 828 | en_warn(priv, "Oversized header or SG list\n"); |
829 | goto tx_drop; | 829 | goto tx_drop_count; |
830 | } | 830 | } |
831 | 831 | ||
832 | bf_ok = ring->bf_enabled; | 832 | bf_ok = ring->bf_enabled; |
@@ -1071,9 +1071,10 @@ tx_drop_unmap: | |||
1071 | PCI_DMA_TODEVICE); | 1071 | PCI_DMA_TODEVICE); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | tx_drop_count: | ||
1075 | ring->tx_dropped++; | ||
1074 | tx_drop: | 1076 | tx_drop: |
1075 | dev_kfree_skb_any(skb); | 1077 | dev_kfree_skb_any(skb); |
1076 | ring->tx_dropped++; | ||
1077 | return NETDEV_TX_OK; | 1078 | return NETDEV_TX_OK; |
1078 | } | 1079 | } |
1079 | 1080 | ||
@@ -1106,7 +1107,7 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame, | |||
1106 | goto tx_drop; | 1107 | goto tx_drop; |
1107 | 1108 | ||
1108 | if (mlx4_en_is_tx_ring_full(ring)) | 1109 | if (mlx4_en_is_tx_ring_full(ring)) |
1109 | goto tx_drop; | 1110 | goto tx_drop_count; |
1110 | 1111 | ||
1111 | /* fetch ring->cons far ahead before needing it to avoid stall */ | 1112 | /* fetch ring->cons far ahead before needing it to avoid stall */ |
1112 | ring_cons = READ_ONCE(ring->cons); | 1113 | ring_cons = READ_ONCE(ring->cons); |
@@ -1176,7 +1177,8 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame, | |||
1176 | 1177 | ||
1177 | return NETDEV_TX_OK; | 1178 | return NETDEV_TX_OK; |
1178 | 1179 | ||
1179 | tx_drop: | 1180 | tx_drop_count: |
1180 | ring->tx_dropped++; | 1181 | ring->tx_dropped++; |
1182 | tx_drop: | ||
1181 | return NETDEV_TX_BUSY; | 1183 | return NETDEV_TX_BUSY; |
1182 | } | 1184 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 2c2913dcae98..9099dbd04951 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -482,20 +482,10 @@ enum dcb_pfc_type { | |||
482 | pfc_enabled_rx | 482 | pfc_enabled_rx |
483 | }; | 483 | }; |
484 | 484 | ||
485 | struct tc_configuration { | ||
486 | enum dcb_pfc_type dcb_pfc; | ||
487 | }; | ||
488 | |||
489 | struct mlx4_en_cee_config { | 485 | struct mlx4_en_cee_config { |
490 | bool pfc_state; | 486 | bool pfc_state; |
491 | struct tc_configuration tc_config[MLX4_EN_NUM_UP]; | 487 | enum dcb_pfc_type dcb_pfc[MLX4_EN_NUM_UP]; |
492 | }; | 488 | }; |
493 | |||
494 | struct mlx4_en_cee_params { | ||
495 | u8 dcbx_cap; | ||
496 | struct mlx4_en_cee_config dcb_cfg; | ||
497 | }; | ||
498 | |||
499 | #endif | 489 | #endif |
500 | 490 | ||
501 | struct ethtool_flow_id { | 491 | struct ethtool_flow_id { |
@@ -624,7 +614,8 @@ struct mlx4_en_priv { | |||
624 | struct ieee_ets ets; | 614 | struct ieee_ets ets; |
625 | u16 maxrate[IEEE_8021QAZ_MAX_TCS]; | 615 | u16 maxrate[IEEE_8021QAZ_MAX_TCS]; |
626 | enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS]; | 616 | enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS]; |
627 | struct mlx4_en_cee_params cee_params; | 617 | struct mlx4_en_cee_config cee_config; |
618 | u8 dcbx_cap; | ||
628 | #endif | 619 | #endif |
629 | #ifdef CONFIG_RFS_ACCEL | 620 | #ifdef CONFIG_RFS_ACCEL |
630 | spinlock_t filters_lock; | 621 | spinlock_t filters_lock; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 3d2095e5c61c..c5b2064297a1 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | #define MLX4_FLAG_V_IGNORE_FCS_MASK 0x2 | 53 | #define MLX4_FLAG_V_IGNORE_FCS_MASK 0x2 |
54 | #define MLX4_IGNORE_FCS_MASK 0x1 | 54 | #define MLX4_IGNORE_FCS_MASK 0x1 |
55 | #define MLNX4_TX_MAX_NUMBER 8 | 55 | #define MLX4_TC_MAX_NUMBER 8 |
56 | 56 | ||
57 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) | 57 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) |
58 | { | 58 | { |
@@ -2022,7 +2022,7 @@ int mlx4_max_tc(struct mlx4_dev *dev) | |||
2022 | u8 num_tc = dev->caps.max_tc_eth; | 2022 | u8 num_tc = dev->caps.max_tc_eth; |
2023 | 2023 | ||
2024 | if (!num_tc) | 2024 | if (!num_tc) |
2025 | num_tc = MLNX4_TX_MAX_NUMBER; | 2025 | num_tc = MLX4_TC_MAX_NUMBER; |
2026 | 2026 | ||
2027 | return num_tc; | 2027 | return num_tc; |
2028 | } | 2028 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index d0cf8fa22659..7a346bb2ed00 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
@@ -331,7 +331,7 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev, | |||
331 | if (mlx5e_query_global_pause_combined(priv)) { | 331 | if (mlx5e_query_global_pause_combined(priv)) { |
332 | for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) { | 332 | for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) { |
333 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0], | 333 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0], |
334 | pport_per_prio_pfc_stats_desc, 0); | 334 | pport_per_prio_pfc_stats_desc, i); |
335 | } | 335 | } |
336 | } | 336 | } |
337 | 337 | ||
@@ -659,9 +659,10 @@ out: | |||
659 | static void ptys2ethtool_supported_link(unsigned long *supported_modes, | 659 | static void ptys2ethtool_supported_link(unsigned long *supported_modes, |
660 | u32 eth_proto_cap) | 660 | u32 eth_proto_cap) |
661 | { | 661 | { |
662 | unsigned long proto_cap = eth_proto_cap; | ||
662 | int proto; | 663 | int proto; |
663 | 664 | ||
664 | for_each_set_bit(proto, (unsigned long *)ð_proto_cap, MLX5E_LINK_MODES_NUMBER) | 665 | for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER) |
665 | bitmap_or(supported_modes, supported_modes, | 666 | bitmap_or(supported_modes, supported_modes, |
666 | ptys2ethtool_table[proto].supported, | 667 | ptys2ethtool_table[proto].supported, |
667 | __ETHTOOL_LINK_MODE_MASK_NBITS); | 668 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
@@ -670,9 +671,10 @@ static void ptys2ethtool_supported_link(unsigned long *supported_modes, | |||
670 | static void ptys2ethtool_adver_link(unsigned long *advertising_modes, | 671 | static void ptys2ethtool_adver_link(unsigned long *advertising_modes, |
671 | u32 eth_proto_cap) | 672 | u32 eth_proto_cap) |
672 | { | 673 | { |
674 | unsigned long proto_cap = eth_proto_cap; | ||
673 | int proto; | 675 | int proto; |
674 | 676 | ||
675 | for_each_set_bit(proto, (unsigned long *)ð_proto_cap, MLX5E_LINK_MODES_NUMBER) | 677 | for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER) |
676 | bitmap_or(advertising_modes, advertising_modes, | 678 | bitmap_or(advertising_modes, advertising_modes, |
677 | ptys2ethtool_table[proto].advertised, | 679 | ptys2ethtool_table[proto].advertised, |
678 | __ETHTOOL_LINK_MODE_MASK_NBITS); | 680 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index b6f8ebbdb487..e7c969df3dad 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | |||
@@ -637,24 +637,32 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq) | |||
637 | static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe, | 637 | static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe, |
638 | u32 cqe_bcnt) | 638 | u32 cqe_bcnt) |
639 | { | 639 | { |
640 | struct ethhdr *eth = (struct ethhdr *)(skb->data); | 640 | struct ethhdr *eth = (struct ethhdr *)(skb->data); |
641 | struct iphdr *ipv4 = (struct iphdr *)(skb->data + ETH_HLEN); | 641 | struct iphdr *ipv4; |
642 | struct ipv6hdr *ipv6 = (struct ipv6hdr *)(skb->data + ETH_HLEN); | 642 | struct ipv6hdr *ipv6; |
643 | struct tcphdr *tcp; | 643 | struct tcphdr *tcp; |
644 | int network_depth = 0; | ||
645 | __be16 proto; | ||
646 | u16 tot_len; | ||
644 | 647 | ||
645 | u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe); | 648 | u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe); |
646 | int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || | 649 | int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || |
647 | (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); | 650 | (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); |
648 | 651 | ||
649 | u16 tot_len = cqe_bcnt - ETH_HLEN; | 652 | skb->mac_len = ETH_HLEN; |
653 | proto = __vlan_get_protocol(skb, eth->h_proto, &network_depth); | ||
650 | 654 | ||
651 | if (eth->h_proto == htons(ETH_P_IP)) { | 655 | ipv4 = (struct iphdr *)(skb->data + network_depth); |
652 | tcp = (struct tcphdr *)(skb->data + ETH_HLEN + | 656 | ipv6 = (struct ipv6hdr *)(skb->data + network_depth); |
657 | tot_len = cqe_bcnt - network_depth; | ||
658 | |||
659 | if (proto == htons(ETH_P_IP)) { | ||
660 | tcp = (struct tcphdr *)(skb->data + network_depth + | ||
653 | sizeof(struct iphdr)); | 661 | sizeof(struct iphdr)); |
654 | ipv6 = NULL; | 662 | ipv6 = NULL; |
655 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; | 663 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; |
656 | } else { | 664 | } else { |
657 | tcp = (struct tcphdr *)(skb->data + ETH_HLEN + | 665 | tcp = (struct tcphdr *)(skb->data + network_depth + |
658 | sizeof(struct ipv6hdr)); | 666 | sizeof(struct ipv6hdr)); |
659 | ipv4 = NULL; | 667 | ipv4 = NULL; |
660 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; | 668 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 988eca99ee0f..eb0e72537f10 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | |||
@@ -356,6 +356,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) | |||
356 | sq->stats.stopped++; | 356 | sq->stats.stopped++; |
357 | } | 357 | } |
358 | 358 | ||
359 | sq->stats.xmit_more += skb->xmit_more; | ||
359 | if (!skb->xmit_more || netif_xmit_stopped(sq->txq)) { | 360 | if (!skb->xmit_more || netif_xmit_stopped(sq->txq)) { |
360 | int bf_sz = 0; | 361 | int bf_sz = 0; |
361 | 362 | ||
@@ -375,7 +376,6 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) | |||
375 | 376 | ||
376 | sq->stats.packets++; | 377 | sq->stats.packets++; |
377 | sq->stats.bytes += num_bytes; | 378 | sq->stats.bytes += num_bytes; |
378 | sq->stats.xmit_more += skb->xmit_more; | ||
379 | return NETDEV_TX_OK; | 379 | return NETDEV_TX_OK; |
380 | 380 | ||
381 | dma_unmap_wqe_err: | 381 | dma_unmap_wqe_err: |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 7291f2c4b0c7..d48873bcbddf 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <generated/utsrelease.h> | 56 | #include <generated/utsrelease.h> |
57 | #include <net/pkt_cls.h> | 57 | #include <net/pkt_cls.h> |
58 | #include <net/tc_act/tc_mirred.h> | 58 | #include <net/tc_act/tc_mirred.h> |
59 | #include <net/netevent.h> | ||
59 | 60 | ||
60 | #include "spectrum.h" | 61 | #include "spectrum.h" |
61 | #include "core.h" | 62 | #include "core.h" |
@@ -2105,6 +2106,13 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, | |||
2105 | dev->netdev_ops = &mlxsw_sp_port_netdev_ops; | 2106 | dev->netdev_ops = &mlxsw_sp_port_netdev_ops; |
2106 | dev->ethtool_ops = &mlxsw_sp_port_ethtool_ops; | 2107 | dev->ethtool_ops = &mlxsw_sp_port_ethtool_ops; |
2107 | 2108 | ||
2109 | err = mlxsw_sp_port_swid_set(mlxsw_sp_port, 0); | ||
2110 | if (err) { | ||
2111 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n", | ||
2112 | mlxsw_sp_port->local_port); | ||
2113 | goto err_port_swid_set; | ||
2114 | } | ||
2115 | |||
2108 | err = mlxsw_sp_port_dev_addr_init(mlxsw_sp_port); | 2116 | err = mlxsw_sp_port_dev_addr_init(mlxsw_sp_port); |
2109 | if (err) { | 2117 | if (err) { |
2110 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unable to init port mac address\n", | 2118 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unable to init port mac address\n", |
@@ -2130,13 +2138,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, | |||
2130 | goto err_port_system_port_mapping_set; | 2138 | goto err_port_system_port_mapping_set; |
2131 | } | 2139 | } |
2132 | 2140 | ||
2133 | err = mlxsw_sp_port_swid_set(mlxsw_sp_port, 0); | ||
2134 | if (err) { | ||
2135 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n", | ||
2136 | mlxsw_sp_port->local_port); | ||
2137 | goto err_port_swid_set; | ||
2138 | } | ||
2139 | |||
2140 | err = mlxsw_sp_port_speed_by_width_set(mlxsw_sp_port, width); | 2141 | err = mlxsw_sp_port_speed_by_width_set(mlxsw_sp_port, width); |
2141 | if (err) { | 2142 | if (err) { |
2142 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to enable speeds\n", | 2143 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to enable speeds\n", |
@@ -2218,10 +2219,10 @@ err_port_buffers_init: | |||
2218 | err_port_admin_status_set: | 2219 | err_port_admin_status_set: |
2219 | err_port_mtu_set: | 2220 | err_port_mtu_set: |
2220 | err_port_speed_by_width_set: | 2221 | err_port_speed_by_width_set: |
2221 | mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT); | ||
2222 | err_port_swid_set: | ||
2223 | err_port_system_port_mapping_set: | 2222 | err_port_system_port_mapping_set: |
2224 | err_dev_addr_init: | 2223 | err_dev_addr_init: |
2224 | mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT); | ||
2225 | err_port_swid_set: | ||
2225 | free_percpu(mlxsw_sp_port->pcpu_stats); | 2226 | free_percpu(mlxsw_sp_port->pcpu_stats); |
2226 | err_alloc_stats: | 2227 | err_alloc_stats: |
2227 | kfree(mlxsw_sp_port->untagged_vlans); | 2228 | kfree(mlxsw_sp_port->untagged_vlans); |
@@ -4541,18 +4542,26 @@ static struct notifier_block mlxsw_sp_inetaddr_nb __read_mostly = { | |||
4541 | .priority = 10, /* Must be called before FIB notifier block */ | 4542 | .priority = 10, /* Must be called before FIB notifier block */ |
4542 | }; | 4543 | }; |
4543 | 4544 | ||
4545 | static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { | ||
4546 | .notifier_call = mlxsw_sp_router_netevent_event, | ||
4547 | }; | ||
4548 | |||
4544 | static int __init mlxsw_sp_module_init(void) | 4549 | static int __init mlxsw_sp_module_init(void) |
4545 | { | 4550 | { |
4546 | int err; | 4551 | int err; |
4547 | 4552 | ||
4548 | register_netdevice_notifier(&mlxsw_sp_netdevice_nb); | 4553 | register_netdevice_notifier(&mlxsw_sp_netdevice_nb); |
4549 | register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); | 4554 | register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); |
4555 | register_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
4556 | |||
4550 | err = mlxsw_core_driver_register(&mlxsw_sp_driver); | 4557 | err = mlxsw_core_driver_register(&mlxsw_sp_driver); |
4551 | if (err) | 4558 | if (err) |
4552 | goto err_core_driver_register; | 4559 | goto err_core_driver_register; |
4553 | return 0; | 4560 | return 0; |
4554 | 4561 | ||
4555 | err_core_driver_register: | 4562 | err_core_driver_register: |
4563 | unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
4564 | unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); | ||
4556 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); | 4565 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); |
4557 | return err; | 4566 | return err; |
4558 | } | 4567 | } |
@@ -4560,6 +4569,7 @@ err_core_driver_register: | |||
4560 | static void __exit mlxsw_sp_module_exit(void) | 4569 | static void __exit mlxsw_sp_module_exit(void) |
4561 | { | 4570 | { |
4562 | mlxsw_core_driver_unregister(&mlxsw_sp_driver); | 4571 | mlxsw_core_driver_unregister(&mlxsw_sp_driver); |
4572 | unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
4563 | unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); | 4573 | unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); |
4564 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); | 4574 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); |
4565 | } | 4575 | } |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index ab3feb81bd43..ac48abebe904 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h | |||
@@ -587,6 +587,8 @@ int mlxsw_sp_router_neigh_construct(struct net_device *dev, | |||
587 | struct neighbour *n); | 587 | struct neighbour *n); |
588 | void mlxsw_sp_router_neigh_destroy(struct net_device *dev, | 588 | void mlxsw_sp_router_neigh_destroy(struct net_device *dev, |
589 | struct neighbour *n); | 589 | struct neighbour *n); |
590 | int mlxsw_sp_router_netevent_event(struct notifier_block *unused, | ||
591 | unsigned long event, void *ptr); | ||
590 | 592 | ||
591 | int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count); | 593 | int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count); |
592 | void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index); | 594 | void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index); |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 917ddd1e422f..3f5c51da6d3e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | |||
@@ -107,6 +107,7 @@ mlxsw_sp_prefix_usage_clear(struct mlxsw_sp_prefix_usage *prefix_usage, | |||
107 | } | 107 | } |
108 | 108 | ||
109 | struct mlxsw_sp_fib_key { | 109 | struct mlxsw_sp_fib_key { |
110 | struct net_device *dev; | ||
110 | unsigned char addr[sizeof(struct in6_addr)]; | 111 | unsigned char addr[sizeof(struct in6_addr)]; |
111 | unsigned char prefix_len; | 112 | unsigned char prefix_len; |
112 | }; | 113 | }; |
@@ -123,7 +124,7 @@ struct mlxsw_sp_fib_entry { | |||
123 | struct rhash_head ht_node; | 124 | struct rhash_head ht_node; |
124 | struct mlxsw_sp_fib_key key; | 125 | struct mlxsw_sp_fib_key key; |
125 | enum mlxsw_sp_fib_entry_type type; | 126 | enum mlxsw_sp_fib_entry_type type; |
126 | u8 added:1; | 127 | unsigned int ref_count; |
127 | u16 rif; /* used for action local */ | 128 | u16 rif; /* used for action local */ |
128 | struct mlxsw_sp_vr *vr; | 129 | struct mlxsw_sp_vr *vr; |
129 | struct list_head nexthop_group_node; | 130 | struct list_head nexthop_group_node; |
@@ -171,13 +172,15 @@ static void mlxsw_sp_fib_entry_remove(struct mlxsw_sp_fib *fib, | |||
171 | 172 | ||
172 | static struct mlxsw_sp_fib_entry * | 173 | static struct mlxsw_sp_fib_entry * |
173 | mlxsw_sp_fib_entry_create(struct mlxsw_sp_fib *fib, const void *addr, | 174 | mlxsw_sp_fib_entry_create(struct mlxsw_sp_fib *fib, const void *addr, |
174 | size_t addr_len, unsigned char prefix_len) | 175 | size_t addr_len, unsigned char prefix_len, |
176 | struct net_device *dev) | ||
175 | { | 177 | { |
176 | struct mlxsw_sp_fib_entry *fib_entry; | 178 | struct mlxsw_sp_fib_entry *fib_entry; |
177 | 179 | ||
178 | fib_entry = kzalloc(sizeof(*fib_entry), GFP_KERNEL); | 180 | fib_entry = kzalloc(sizeof(*fib_entry), GFP_KERNEL); |
179 | if (!fib_entry) | 181 | if (!fib_entry) |
180 | return NULL; | 182 | return NULL; |
183 | fib_entry->key.dev = dev; | ||
181 | memcpy(fib_entry->key.addr, addr, addr_len); | 184 | memcpy(fib_entry->key.addr, addr, addr_len); |
182 | fib_entry->key.prefix_len = prefix_len; | 185 | fib_entry->key.prefix_len = prefix_len; |
183 | return fib_entry; | 186 | return fib_entry; |
@@ -190,10 +193,13 @@ static void mlxsw_sp_fib_entry_destroy(struct mlxsw_sp_fib_entry *fib_entry) | |||
190 | 193 | ||
191 | static struct mlxsw_sp_fib_entry * | 194 | static struct mlxsw_sp_fib_entry * |
192 | mlxsw_sp_fib_entry_lookup(struct mlxsw_sp_fib *fib, const void *addr, | 195 | mlxsw_sp_fib_entry_lookup(struct mlxsw_sp_fib *fib, const void *addr, |
193 | size_t addr_len, unsigned char prefix_len) | 196 | size_t addr_len, unsigned char prefix_len, |
197 | struct net_device *dev) | ||
194 | { | 198 | { |
195 | struct mlxsw_sp_fib_key key = {{ 0 } }; | 199 | struct mlxsw_sp_fib_key key; |
196 | 200 | ||
201 | memset(&key, 0, sizeof(key)); | ||
202 | key.dev = dev; | ||
197 | memcpy(key.addr, addr, addr_len); | 203 | memcpy(key.addr, addr, addr_len); |
198 | key.prefix_len = prefix_len; | 204 | key.prefix_len = prefix_len; |
199 | return rhashtable_lookup_fast(&fib->ht, &key, mlxsw_sp_fib_ht_params); | 205 | return rhashtable_lookup_fast(&fib->ht, &key, mlxsw_sp_fib_ht_params); |
@@ -938,8 +944,8 @@ static void mlxsw_sp_router_neigh_update_hw(struct work_struct *work) | |||
938 | mlxsw_sp_port_dev_put(mlxsw_sp_port); | 944 | mlxsw_sp_port_dev_put(mlxsw_sp_port); |
939 | } | 945 | } |
940 | 946 | ||
941 | static int mlxsw_sp_router_netevent_event(struct notifier_block *unused, | 947 | int mlxsw_sp_router_netevent_event(struct notifier_block *unused, |
942 | unsigned long event, void *ptr) | 948 | unsigned long event, void *ptr) |
943 | { | 949 | { |
944 | struct mlxsw_sp_neigh_entry *neigh_entry; | 950 | struct mlxsw_sp_neigh_entry *neigh_entry; |
945 | struct mlxsw_sp_port *mlxsw_sp_port; | 951 | struct mlxsw_sp_port *mlxsw_sp_port; |
@@ -1009,10 +1015,6 @@ static int mlxsw_sp_router_netevent_event(struct notifier_block *unused, | |||
1009 | return NOTIFY_DONE; | 1015 | return NOTIFY_DONE; |
1010 | } | 1016 | } |
1011 | 1017 | ||
1012 | static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { | ||
1013 | .notifier_call = mlxsw_sp_router_netevent_event, | ||
1014 | }; | ||
1015 | |||
1016 | static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) | 1018 | static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) |
1017 | { | 1019 | { |
1018 | int err; | 1020 | int err; |
@@ -1027,10 +1029,6 @@ static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) | |||
1027 | */ | 1029 | */ |
1028 | mlxsw_sp_router_neighs_update_interval_init(mlxsw_sp); | 1030 | mlxsw_sp_router_neighs_update_interval_init(mlxsw_sp); |
1029 | 1031 | ||
1030 | err = register_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
1031 | if (err) | ||
1032 | goto err_register_netevent_notifier; | ||
1033 | |||
1034 | /* Create the delayed works for the activity_update */ | 1032 | /* Create the delayed works for the activity_update */ |
1035 | INIT_DELAYED_WORK(&mlxsw_sp->router.neighs_update.dw, | 1033 | INIT_DELAYED_WORK(&mlxsw_sp->router.neighs_update.dw, |
1036 | mlxsw_sp_router_neighs_update_work); | 1034 | mlxsw_sp_router_neighs_update_work); |
@@ -1039,17 +1037,12 @@ static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) | |||
1039 | mlxsw_core_schedule_dw(&mlxsw_sp->router.neighs_update.dw, 0); | 1037 | mlxsw_core_schedule_dw(&mlxsw_sp->router.neighs_update.dw, 0); |
1040 | mlxsw_core_schedule_dw(&mlxsw_sp->router.nexthop_probe_dw, 0); | 1038 | mlxsw_core_schedule_dw(&mlxsw_sp->router.nexthop_probe_dw, 0); |
1041 | return 0; | 1039 | return 0; |
1042 | |||
1043 | err_register_netevent_notifier: | ||
1044 | rhashtable_destroy(&mlxsw_sp->router.neigh_ht); | ||
1045 | return err; | ||
1046 | } | 1040 | } |
1047 | 1041 | ||
1048 | static void mlxsw_sp_neigh_fini(struct mlxsw_sp *mlxsw_sp) | 1042 | static void mlxsw_sp_neigh_fini(struct mlxsw_sp *mlxsw_sp) |
1049 | { | 1043 | { |
1050 | cancel_delayed_work_sync(&mlxsw_sp->router.neighs_update.dw); | 1044 | cancel_delayed_work_sync(&mlxsw_sp->router.neighs_update.dw); |
1051 | cancel_delayed_work_sync(&mlxsw_sp->router.nexthop_probe_dw); | 1045 | cancel_delayed_work_sync(&mlxsw_sp->router.nexthop_probe_dw); |
1052 | unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
1053 | rhashtable_destroy(&mlxsw_sp->router.neigh_ht); | 1046 | rhashtable_destroy(&mlxsw_sp->router.neigh_ht); |
1054 | } | 1047 | } |
1055 | 1048 | ||
@@ -1524,7 +1517,14 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp) | |||
1524 | return err; | 1517 | return err; |
1525 | mlxsw_sp_lpm_init(mlxsw_sp); | 1518 | mlxsw_sp_lpm_init(mlxsw_sp); |
1526 | mlxsw_sp_vrs_init(mlxsw_sp); | 1519 | mlxsw_sp_vrs_init(mlxsw_sp); |
1527 | return mlxsw_sp_neigh_init(mlxsw_sp); | 1520 | err = mlxsw_sp_neigh_init(mlxsw_sp); |
1521 | if (err) | ||
1522 | goto err_neigh_init; | ||
1523 | return 0; | ||
1524 | |||
1525 | err_neigh_init: | ||
1526 | __mlxsw_sp_router_fini(mlxsw_sp); | ||
1527 | return err; | ||
1528 | } | 1528 | } |
1529 | 1529 | ||
1530 | void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp) | 1530 | void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp) |
@@ -1626,11 +1626,8 @@ static int mlxsw_sp_fib_entry_op(struct mlxsw_sp *mlxsw_sp, | |||
1626 | static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp, | 1626 | static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp, |
1627 | struct mlxsw_sp_fib_entry *fib_entry) | 1627 | struct mlxsw_sp_fib_entry *fib_entry) |
1628 | { | 1628 | { |
1629 | enum mlxsw_reg_ralue_op op; | 1629 | return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry, |
1630 | 1630 | MLXSW_REG_RALUE_OP_WRITE_WRITE); | |
1631 | op = !fib_entry->added ? MLXSW_REG_RALUE_OP_WRITE_WRITE : | ||
1632 | MLXSW_REG_RALUE_OP_WRITE_UPDATE; | ||
1633 | return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry, op); | ||
1634 | } | 1631 | } |
1635 | 1632 | ||
1636 | static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp, | 1633 | static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp, |
@@ -1695,34 +1692,93 @@ mlxsw_sp_router_fib4_entry_fini(struct mlxsw_sp *mlxsw_sp, | |||
1695 | mlxsw_sp_nexthop_group_put(mlxsw_sp, fib_entry); | 1692 | mlxsw_sp_nexthop_group_put(mlxsw_sp, fib_entry); |
1696 | } | 1693 | } |
1697 | 1694 | ||
1698 | static int | 1695 | static struct mlxsw_sp_fib_entry * |
1699 | mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, | 1696 | mlxsw_sp_fib_entry_get(struct mlxsw_sp *mlxsw_sp, |
1700 | const struct switchdev_obj_ipv4_fib *fib4, | 1697 | const struct switchdev_obj_ipv4_fib *fib4) |
1701 | struct switchdev_trans *trans) | ||
1702 | { | 1698 | { |
1703 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | ||
1704 | struct mlxsw_sp_router_fib4_add_info *info; | ||
1705 | struct mlxsw_sp_fib_entry *fib_entry; | 1699 | struct mlxsw_sp_fib_entry *fib_entry; |
1700 | struct fib_info *fi = fib4->fi; | ||
1706 | struct mlxsw_sp_vr *vr; | 1701 | struct mlxsw_sp_vr *vr; |
1707 | int err; | 1702 | int err; |
1708 | 1703 | ||
1709 | vr = mlxsw_sp_vr_get(mlxsw_sp, fib4->dst_len, fib4->tb_id, | 1704 | vr = mlxsw_sp_vr_get(mlxsw_sp, fib4->dst_len, fib4->tb_id, |
1710 | MLXSW_SP_L3_PROTO_IPV4); | 1705 | MLXSW_SP_L3_PROTO_IPV4); |
1711 | if (IS_ERR(vr)) | 1706 | if (IS_ERR(vr)) |
1712 | return PTR_ERR(vr); | 1707 | return ERR_CAST(vr); |
1713 | 1708 | ||
1709 | fib_entry = mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, | ||
1710 | sizeof(fib4->dst), | ||
1711 | fib4->dst_len, fi->fib_dev); | ||
1712 | if (fib_entry) { | ||
1713 | /* Already exists, just take a reference */ | ||
1714 | fib_entry->ref_count++; | ||
1715 | return fib_entry; | ||
1716 | } | ||
1714 | fib_entry = mlxsw_sp_fib_entry_create(vr->fib, &fib4->dst, | 1717 | fib_entry = mlxsw_sp_fib_entry_create(vr->fib, &fib4->dst, |
1715 | sizeof(fib4->dst), fib4->dst_len); | 1718 | sizeof(fib4->dst), |
1719 | fib4->dst_len, fi->fib_dev); | ||
1716 | if (!fib_entry) { | 1720 | if (!fib_entry) { |
1717 | err = -ENOMEM; | 1721 | err = -ENOMEM; |
1718 | goto err_fib_entry_create; | 1722 | goto err_fib_entry_create; |
1719 | } | 1723 | } |
1720 | fib_entry->vr = vr; | 1724 | fib_entry->vr = vr; |
1725 | fib_entry->ref_count = 1; | ||
1721 | 1726 | ||
1722 | err = mlxsw_sp_router_fib4_entry_init(mlxsw_sp, fib4, fib_entry); | 1727 | err = mlxsw_sp_router_fib4_entry_init(mlxsw_sp, fib4, fib_entry); |
1723 | if (err) | 1728 | if (err) |
1724 | goto err_fib4_entry_init; | 1729 | goto err_fib4_entry_init; |
1725 | 1730 | ||
1731 | return fib_entry; | ||
1732 | |||
1733 | err_fib4_entry_init: | ||
1734 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
1735 | err_fib_entry_create: | ||
1736 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
1737 | |||
1738 | return ERR_PTR(err); | ||
1739 | } | ||
1740 | |||
1741 | static struct mlxsw_sp_fib_entry * | ||
1742 | mlxsw_sp_fib_entry_find(struct mlxsw_sp *mlxsw_sp, | ||
1743 | const struct switchdev_obj_ipv4_fib *fib4) | ||
1744 | { | ||
1745 | struct mlxsw_sp_vr *vr; | ||
1746 | |||
1747 | vr = mlxsw_sp_vr_find(mlxsw_sp, fib4->tb_id, MLXSW_SP_L3_PROTO_IPV4); | ||
1748 | if (!vr) | ||
1749 | return NULL; | ||
1750 | |||
1751 | return mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, | ||
1752 | sizeof(fib4->dst), fib4->dst_len, | ||
1753 | fib4->fi->fib_dev); | ||
1754 | } | ||
1755 | |||
1756 | void mlxsw_sp_fib_entry_put(struct mlxsw_sp *mlxsw_sp, | ||
1757 | struct mlxsw_sp_fib_entry *fib_entry) | ||
1758 | { | ||
1759 | struct mlxsw_sp_vr *vr = fib_entry->vr; | ||
1760 | |||
1761 | if (--fib_entry->ref_count == 0) { | ||
1762 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | ||
1763 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
1764 | } | ||
1765 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
1766 | } | ||
1767 | |||
1768 | static int | ||
1769 | mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, | ||
1770 | const struct switchdev_obj_ipv4_fib *fib4, | ||
1771 | struct switchdev_trans *trans) | ||
1772 | { | ||
1773 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | ||
1774 | struct mlxsw_sp_router_fib4_add_info *info; | ||
1775 | struct mlxsw_sp_fib_entry *fib_entry; | ||
1776 | int err; | ||
1777 | |||
1778 | fib_entry = mlxsw_sp_fib_entry_get(mlxsw_sp, fib4); | ||
1779 | if (IS_ERR(fib_entry)) | ||
1780 | return PTR_ERR(fib_entry); | ||
1781 | |||
1726 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1782 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1727 | if (!info) { | 1783 | if (!info) { |
1728 | err = -ENOMEM; | 1784 | err = -ENOMEM; |
@@ -1736,11 +1792,7 @@ mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, | |||
1736 | return 0; | 1792 | return 0; |
1737 | 1793 | ||
1738 | err_alloc_info: | 1794 | err_alloc_info: |
1739 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | 1795 | mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); |
1740 | err_fib4_entry_init: | ||
1741 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
1742 | err_fib_entry_create: | ||
1743 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
1744 | return err; | 1796 | return err; |
1745 | } | 1797 | } |
1746 | 1798 | ||
@@ -1759,11 +1811,14 @@ mlxsw_sp_router_fib4_add_commit(struct mlxsw_sp_port *mlxsw_sp_port, | |||
1759 | fib_entry = info->fib_entry; | 1811 | fib_entry = info->fib_entry; |
1760 | kfree(info); | 1812 | kfree(info); |
1761 | 1813 | ||
1814 | if (fib_entry->ref_count != 1) | ||
1815 | return 0; | ||
1816 | |||
1762 | vr = fib_entry->vr; | 1817 | vr = fib_entry->vr; |
1763 | err = mlxsw_sp_fib_entry_insert(fib_entry->vr->fib, fib_entry); | 1818 | err = mlxsw_sp_fib_entry_insert(vr->fib, fib_entry); |
1764 | if (err) | 1819 | if (err) |
1765 | goto err_fib_entry_insert; | 1820 | goto err_fib_entry_insert; |
1766 | err = mlxsw_sp_fib_entry_update(mlxsw_sp, fib_entry); | 1821 | err = mlxsw_sp_fib_entry_update(mlxsw_sp_port->mlxsw_sp, fib_entry); |
1767 | if (err) | 1822 | if (err) |
1768 | goto err_fib_entry_add; | 1823 | goto err_fib_entry_add; |
1769 | return 0; | 1824 | return 0; |
@@ -1771,9 +1826,7 @@ mlxsw_sp_router_fib4_add_commit(struct mlxsw_sp_port *mlxsw_sp_port, | |||
1771 | err_fib_entry_add: | 1826 | err_fib_entry_add: |
1772 | mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); | 1827 | mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); |
1773 | err_fib_entry_insert: | 1828 | err_fib_entry_insert: |
1774 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | 1829 | mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); |
1775 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
1776 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
1777 | return err; | 1830 | return err; |
1778 | } | 1831 | } |
1779 | 1832 | ||
@@ -1793,23 +1846,18 @@ int mlxsw_sp_router_fib4_del(struct mlxsw_sp_port *mlxsw_sp_port, | |||
1793 | { | 1846 | { |
1794 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | 1847 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; |
1795 | struct mlxsw_sp_fib_entry *fib_entry; | 1848 | struct mlxsw_sp_fib_entry *fib_entry; |
1796 | struct mlxsw_sp_vr *vr; | ||
1797 | 1849 | ||
1798 | vr = mlxsw_sp_vr_find(mlxsw_sp, fib4->tb_id, MLXSW_SP_L3_PROTO_IPV4); | 1850 | fib_entry = mlxsw_sp_fib_entry_find(mlxsw_sp, fib4); |
1799 | if (!vr) { | ||
1800 | dev_warn(mlxsw_sp->bus_info->dev, "Failed to find virtual router for FIB4 entry being removed.\n"); | ||
1801 | return -ENOENT; | ||
1802 | } | ||
1803 | fib_entry = mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, | ||
1804 | sizeof(fib4->dst), fib4->dst_len); | ||
1805 | if (!fib_entry) { | 1851 | if (!fib_entry) { |
1806 | dev_warn(mlxsw_sp->bus_info->dev, "Failed to find FIB4 entry being removed.\n"); | 1852 | dev_warn(mlxsw_sp->bus_info->dev, "Failed to find FIB4 entry being removed.\n"); |
1807 | return -ENOENT; | 1853 | return -ENOENT; |
1808 | } | 1854 | } |
1809 | mlxsw_sp_fib_entry_del(mlxsw_sp_port->mlxsw_sp, fib_entry); | 1855 | |
1810 | mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); | 1856 | if (fib_entry->ref_count == 1) { |
1811 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | 1857 | mlxsw_sp_fib_entry_del(mlxsw_sp, fib_entry); |
1812 | mlxsw_sp_fib_entry_destroy(fib_entry); | 1858 | mlxsw_sp_fib_entry_remove(fib_entry->vr->fib, fib_entry); |
1813 | mlxsw_sp_vr_put(mlxsw_sp, vr); | 1859 | } |
1860 | |||
1861 | mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); | ||
1814 | return 0; | 1862 | return 0; |
1815 | } | 1863 | } |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index d1b59cdfacc1..7b654c517b91 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | |||
@@ -167,8 +167,8 @@ static int mlxsw_sp_port_attr_stp_state_set(struct mlxsw_sp_port *mlxsw_sp_port, | |||
167 | } | 167 | } |
168 | 168 | ||
169 | static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, | 169 | static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, |
170 | u16 idx_begin, u16 idx_end, bool set, | 170 | u16 idx_begin, u16 idx_end, bool uc_set, |
171 | bool only_uc) | 171 | bool bm_set) |
172 | { | 172 | { |
173 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | 173 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; |
174 | u16 local_port = mlxsw_sp_port->local_port; | 174 | u16 local_port = mlxsw_sp_port->local_port; |
@@ -187,28 +187,22 @@ static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, | |||
187 | return -ENOMEM; | 187 | return -ENOMEM; |
188 | 188 | ||
189 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, | 189 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, |
190 | table_type, range, local_port, set); | 190 | table_type, range, local_port, uc_set); |
191 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | 191 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); |
192 | if (err) | 192 | if (err) |
193 | goto buffer_out; | 193 | goto buffer_out; |
194 | 194 | ||
195 | /* Flooding control allows one to decide whether a given port will | ||
196 | * flood unicast traffic for which there is no FDB entry. | ||
197 | */ | ||
198 | if (only_uc) | ||
199 | goto buffer_out; | ||
200 | |||
201 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, idx_begin, | 195 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, idx_begin, |
202 | table_type, range, local_port, set); | 196 | table_type, range, local_port, bm_set); |
203 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | 197 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); |
204 | if (err) | 198 | if (err) |
205 | goto err_flood_bm_set; | 199 | goto err_flood_bm_set; |
206 | else | 200 | |
207 | goto buffer_out; | 201 | goto buffer_out; |
208 | 202 | ||
209 | err_flood_bm_set: | 203 | err_flood_bm_set: |
210 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, | 204 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, |
211 | table_type, range, local_port, !set); | 205 | table_type, range, local_port, !uc_set); |
212 | mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | 206 | mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); |
213 | buffer_out: | 207 | buffer_out: |
214 | kfree(sftr_pl); | 208 | kfree(sftr_pl); |
@@ -257,8 +251,7 @@ int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 fid, | |||
257 | * the start of the vFIDs range. | 251 | * the start of the vFIDs range. |
258 | */ | 252 | */ |
259 | vfid = mlxsw_sp_fid_to_vfid(fid); | 253 | vfid = mlxsw_sp_fid_to_vfid(fid); |
260 | return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, | 254 | return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, set); |
261 | false); | ||
262 | } | 255 | } |
263 | 256 | ||
264 | static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, | 257 | static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, |
@@ -460,6 +453,9 @@ static int __mlxsw_sp_port_fid_join(struct mlxsw_sp_port *mlxsw_sp_port, | |||
460 | { | 453 | { |
461 | struct mlxsw_sp_fid *f; | 454 | struct mlxsw_sp_fid *f; |
462 | 455 | ||
456 | if (test_bit(fid, mlxsw_sp_port->active_vlans)) | ||
457 | return 0; | ||
458 | |||
463 | f = mlxsw_sp_fid_find(mlxsw_sp_port->mlxsw_sp, fid); | 459 | f = mlxsw_sp_fid_find(mlxsw_sp_port->mlxsw_sp, fid); |
464 | if (!f) { | 460 | if (!f) { |
465 | f = mlxsw_sp_fid_create(mlxsw_sp_port->mlxsw_sp, fid); | 461 | f = mlxsw_sp_fid_create(mlxsw_sp_port->mlxsw_sp, fid); |
@@ -517,7 +513,7 @@ static int mlxsw_sp_port_fid_join(struct mlxsw_sp_port *mlxsw_sp_port, | |||
517 | } | 513 | } |
518 | 514 | ||
519 | err = __mlxsw_sp_port_flood_set(mlxsw_sp_port, fid_begin, fid_end, | 515 | err = __mlxsw_sp_port_flood_set(mlxsw_sp_port, fid_begin, fid_end, |
520 | true, false); | 516 | mlxsw_sp_port->uc_flood, true); |
521 | if (err) | 517 | if (err) |
522 | goto err_port_flood_set; | 518 | goto err_port_flood_set; |
523 | 519 | ||
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 88678c172b19..252e4924de0f 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c | |||
@@ -41,7 +41,6 @@ | |||
41 | * Chris Telfer <chris.telfer@netronome.com> | 41 | * Chris Telfer <chris.telfer@netronome.com> |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/version.h> | ||
45 | #include <linux/module.h> | 44 | #include <linux/module.h> |
46 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
47 | #include <linux/init.h> | 46 | #include <linux/init.h> |
@@ -1441,10 +1440,6 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget) | |||
1441 | 1440 | ||
1442 | nfp_net_set_hash(nn->netdev, skb, rxd); | 1441 | nfp_net_set_hash(nn->netdev, skb, rxd); |
1443 | 1442 | ||
1444 | /* Pad small frames to minimum */ | ||
1445 | if (skb_put_padto(skb, 60)) | ||
1446 | break; | ||
1447 | |||
1448 | /* Stats update */ | 1443 | /* Stats update */ |
1449 | u64_stats_update_begin(&r_vec->rx_sync); | 1444 | u64_stats_update_begin(&r_vec->rx_sync); |
1450 | r_vec->rx_pkts++; | 1445 | r_vec->rx_pkts++; |
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c index 7d7933d00b8f..4c9897220969 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | |||
@@ -40,7 +40,6 @@ | |||
40 | * Brad Petrus <brad.petrus@netronome.com> | 40 | * Brad Petrus <brad.petrus@netronome.com> |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include <linux/version.h> | ||
44 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
45 | #include <linux/netdevice.h> | 44 | #include <linux/netdevice.h> |
46 | #include <linux/etherdevice.h> | 45 | #include <linux/etherdevice.h> |
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c b/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c index 37abef016a0a..f7062cb648e1 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c | |||
@@ -38,7 +38,6 @@ | |||
38 | * Rolf Neugebauer <rolf.neugebauer@netronome.com> | 38 | * Rolf Neugebauer <rolf.neugebauer@netronome.com> |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include <linux/version.h> | ||
42 | #include <linux/module.h> | 41 | #include <linux/module.h> |
43 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
44 | #include <linux/init.h> | 43 | #include <linux/init.h> |
@@ -134,7 +133,7 @@ static int nfp_netvf_pci_probe(struct pci_dev *pdev, | |||
134 | } | 133 | } |
135 | 134 | ||
136 | nfp_net_get_fw_version(&fw_ver, ctrl_bar); | 135 | nfp_net_get_fw_version(&fw_ver, ctrl_bar); |
137 | if (fw_ver.class != NFP_NET_CFG_VERSION_CLASS_GENERIC) { | 136 | if (fw_ver.resv || fw_ver.class != NFP_NET_CFG_VERSION_CLASS_GENERIC) { |
138 | dev_err(&pdev->dev, "Unknown Firmware ABI %d.%d.%d.%d\n", | 137 | dev_err(&pdev->dev, "Unknown Firmware ABI %d.%d.%d.%d\n", |
139 | fw_ver.resv, fw_ver.class, fw_ver.major, fw_ver.minor); | 138 | fw_ver.resv, fw_ver.class, fw_ver.major, fw_ver.minor); |
140 | err = -EINVAL; | 139 | err = -EINVAL; |
@@ -142,9 +141,7 @@ static int nfp_netvf_pci_probe(struct pci_dev *pdev, | |||
142 | } | 141 | } |
143 | 142 | ||
144 | /* Determine stride */ | 143 | /* Determine stride */ |
145 | if (nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0, 0) || | 144 | if (nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0, 1)) { |
146 | nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0, 1) || | ||
147 | nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0x12, 0x48)) { | ||
148 | stride = 2; | 145 | stride = 2; |
149 | tx_bar_no = NFP_NET_Q0_BAR; | 146 | tx_bar_no = NFP_NET_Q0_BAR; |
150 | rx_bar_no = NFP_NET_Q1_BAR; | 147 | rx_bar_no = NFP_NET_Q1_BAR; |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c index 226cb08cc055..3656d2fd673d 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "qed_dcbx.h" | 19 | #include "qed_dcbx.h" |
20 | #include "qed_hsi.h" | 20 | #include "qed_hsi.h" |
21 | #include "qed_sp.h" | 21 | #include "qed_sp.h" |
22 | #include "qed_sriov.h" | ||
22 | #ifdef CONFIG_DCB | 23 | #ifdef CONFIG_DCB |
23 | #include <linux/qed/qed_eth_if.h> | 24 | #include <linux/qed/qed_eth_if.h> |
24 | #endif | 25 | #endif |
@@ -945,6 +946,9 @@ static int qed_dcbx_query_params(struct qed_hwfn *p_hwfn, | |||
945 | struct qed_ptt *p_ptt; | 946 | struct qed_ptt *p_ptt; |
946 | int rc; | 947 | int rc; |
947 | 948 | ||
949 | if (IS_VF(p_hwfn->cdev)) | ||
950 | return -EINVAL; | ||
951 | |||
948 | p_ptt = qed_ptt_acquire(p_hwfn); | 952 | p_ptt = qed_ptt_acquire(p_hwfn); |
949 | if (!p_ptt) | 953 | if (!p_ptt) |
950 | return -EBUSY; | 954 | return -EBUSY; |
@@ -984,6 +988,7 @@ qed_dcbx_set_pfc_data(struct qed_hwfn *p_hwfn, | |||
984 | if (p_params->pfc.prio[i]) | 988 | if (p_params->pfc.prio[i]) |
985 | pfc_map |= BIT(i); | 989 | pfc_map |= BIT(i); |
986 | 990 | ||
991 | *pfc &= ~DCBX_PFC_PRI_EN_BITMAP_MASK; | ||
987 | *pfc |= (pfc_map << DCBX_PFC_PRI_EN_BITMAP_SHIFT); | 992 | *pfc |= (pfc_map << DCBX_PFC_PRI_EN_BITMAP_SHIFT); |
988 | 993 | ||
989 | DP_VERBOSE(p_hwfn, QED_MSG_DCB, "pfc = 0x%x\n", *pfc); | 994 | DP_VERBOSE(p_hwfn, QED_MSG_DCB, "pfc = 0x%x\n", *pfc); |
@@ -1058,24 +1063,33 @@ qed_dcbx_set_app_data(struct qed_hwfn *p_hwfn, | |||
1058 | 1063 | ||
1059 | for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++) { | 1064 | for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++) { |
1060 | entry = &p_app->app_pri_tbl[i].entry; | 1065 | entry = &p_app->app_pri_tbl[i].entry; |
1066 | *entry = 0; | ||
1061 | if (ieee) { | 1067 | if (ieee) { |
1062 | *entry &= ~DCBX_APP_SF_IEEE_MASK; | 1068 | *entry &= ~(DCBX_APP_SF_IEEE_MASK | DCBX_APP_SF_MASK); |
1063 | switch (p_params->app_entry[i].sf_ieee) { | 1069 | switch (p_params->app_entry[i].sf_ieee) { |
1064 | case QED_DCBX_SF_IEEE_ETHTYPE: | 1070 | case QED_DCBX_SF_IEEE_ETHTYPE: |
1065 | *entry |= ((u32)DCBX_APP_SF_IEEE_ETHTYPE << | 1071 | *entry |= ((u32)DCBX_APP_SF_IEEE_ETHTYPE << |
1066 | DCBX_APP_SF_IEEE_SHIFT); | 1072 | DCBX_APP_SF_IEEE_SHIFT); |
1073 | *entry |= ((u32)DCBX_APP_SF_ETHTYPE << | ||
1074 | DCBX_APP_SF_SHIFT); | ||
1067 | break; | 1075 | break; |
1068 | case QED_DCBX_SF_IEEE_TCP_PORT: | 1076 | case QED_DCBX_SF_IEEE_TCP_PORT: |
1069 | *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_PORT << | 1077 | *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_PORT << |
1070 | DCBX_APP_SF_IEEE_SHIFT); | 1078 | DCBX_APP_SF_IEEE_SHIFT); |
1079 | *entry |= ((u32)DCBX_APP_SF_PORT << | ||
1080 | DCBX_APP_SF_SHIFT); | ||
1071 | break; | 1081 | break; |
1072 | case QED_DCBX_SF_IEEE_UDP_PORT: | 1082 | case QED_DCBX_SF_IEEE_UDP_PORT: |
1073 | *entry |= ((u32)DCBX_APP_SF_IEEE_UDP_PORT << | 1083 | *entry |= ((u32)DCBX_APP_SF_IEEE_UDP_PORT << |
1074 | DCBX_APP_SF_IEEE_SHIFT); | 1084 | DCBX_APP_SF_IEEE_SHIFT); |
1085 | *entry |= ((u32)DCBX_APP_SF_PORT << | ||
1086 | DCBX_APP_SF_SHIFT); | ||
1075 | break; | 1087 | break; |
1076 | case QED_DCBX_SF_IEEE_TCP_UDP_PORT: | 1088 | case QED_DCBX_SF_IEEE_TCP_UDP_PORT: |
1077 | *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_UDP_PORT << | 1089 | *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_UDP_PORT << |
1078 | DCBX_APP_SF_IEEE_SHIFT); | 1090 | DCBX_APP_SF_IEEE_SHIFT); |
1091 | *entry |= ((u32)DCBX_APP_SF_PORT << | ||
1092 | DCBX_APP_SF_SHIFT); | ||
1079 | break; | 1093 | break; |
1080 | } | 1094 | } |
1081 | } else { | 1095 | } else { |
@@ -1175,7 +1189,7 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn, | |||
1175 | return 0; | 1189 | return 0; |
1176 | } | 1190 | } |
1177 | 1191 | ||
1178 | dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_KERNEL); | 1192 | dcbx_info = kzalloc(sizeof(*dcbx_info), GFP_KERNEL); |
1179 | if (!dcbx_info) { | 1193 | if (!dcbx_info) { |
1180 | DP_ERR(p_hwfn, "Failed to allocate struct qed_dcbx_info\n"); | 1194 | DP_ERR(p_hwfn, "Failed to allocate struct qed_dcbx_info\n"); |
1181 | return -ENOMEM; | 1195 | return -ENOMEM; |
@@ -1212,7 +1226,7 @@ static struct qed_dcbx_get *qed_dcbnl_get_dcbx(struct qed_hwfn *hwfn, | |||
1212 | { | 1226 | { |
1213 | struct qed_dcbx_get *dcbx_info; | 1227 | struct qed_dcbx_get *dcbx_info; |
1214 | 1228 | ||
1215 | dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_KERNEL); | 1229 | dcbx_info = kzalloc(sizeof(*dcbx_info), GFP_KERNEL); |
1216 | if (!dcbx_info) { | 1230 | if (!dcbx_info) { |
1217 | DP_ERR(hwfn->cdev, "Failed to allocate memory for dcbx_info\n"); | 1231 | DP_ERR(hwfn->cdev, "Failed to allocate memory for dcbx_info\n"); |
1218 | return NULL; | 1232 | return NULL; |
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index a6eb6af8cbe8..9544e4c41359 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c | |||
@@ -2520,7 +2520,8 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, | |||
2520 | edev->ops->register_ops(cdev, &qede_ll_ops, edev); | 2520 | edev->ops->register_ops(cdev, &qede_ll_ops, edev); |
2521 | 2521 | ||
2522 | #ifdef CONFIG_DCB | 2522 | #ifdef CONFIG_DCB |
2523 | qede_set_dcbnl_ops(edev->ndev); | 2523 | if (!IS_VF(edev)) |
2524 | qede_set_dcbnl_ops(edev->ndev); | ||
2524 | #endif | 2525 | #endif |
2525 | 2526 | ||
2526 | INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task); | 2527 | INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task); |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 799d58d86e6d..054e795df90f 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -201,9 +201,14 @@ static const u16 sh_eth_offset_fast_rz[SH_ETH_MAX_REGISTER_OFFSET] = { | |||
201 | 201 | ||
202 | [ARSTR] = 0x0000, | 202 | [ARSTR] = 0x0000, |
203 | [TSU_CTRST] = 0x0004, | 203 | [TSU_CTRST] = 0x0004, |
204 | [TSU_FWSLC] = 0x0038, | ||
204 | [TSU_VTAG0] = 0x0058, | 205 | [TSU_VTAG0] = 0x0058, |
205 | [TSU_ADSBSY] = 0x0060, | 206 | [TSU_ADSBSY] = 0x0060, |
206 | [TSU_TEN] = 0x0064, | 207 | [TSU_TEN] = 0x0064, |
208 | [TSU_POST1] = 0x0070, | ||
209 | [TSU_POST2] = 0x0074, | ||
210 | [TSU_POST3] = 0x0078, | ||
211 | [TSU_POST4] = 0x007c, | ||
207 | [TSU_ADRH0] = 0x0100, | 212 | [TSU_ADRH0] = 0x0100, |
208 | 213 | ||
209 | [TXNLCR0] = 0x0080, | 214 | [TXNLCR0] = 0x0080, |
@@ -2786,6 +2791,8 @@ static void sh_eth_tsu_init(struct sh_eth_private *mdp) | |||
2786 | { | 2791 | { |
2787 | if (sh_eth_is_rz_fast_ether(mdp)) { | 2792 | if (sh_eth_is_rz_fast_ether(mdp)) { |
2788 | sh_eth_tsu_write(mdp, 0, TSU_TEN); /* Disable all CAM entry */ | 2793 | sh_eth_tsu_write(mdp, 0, TSU_TEN); /* Disable all CAM entry */ |
2794 | sh_eth_tsu_write(mdp, TSU_FWSLC_POSTENU | TSU_FWSLC_POSTENL, | ||
2795 | TSU_FWSLC); /* Enable POST registers */ | ||
2789 | return; | 2796 | return; |
2790 | } | 2797 | } |
2791 | 2798 | ||
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index e17671c9d1b0..ea8465467469 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h | |||
@@ -470,7 +470,9 @@ smc_pxa_dma_insw(void __iomem *ioaddr, struct smc_local *lp, int reg, int dma, | |||
470 | #endif | 470 | #endif |
471 | 471 | ||
472 | #if ! SMC_CAN_USE_8BIT | 472 | #if ! SMC_CAN_USE_8BIT |
473 | #undef SMC_inb | ||
473 | #define SMC_inb(ioaddr, reg) ({ BUG(); 0; }) | 474 | #define SMC_inb(ioaddr, reg) ({ BUG(); 0; }) |
475 | #undef SMC_outb | ||
474 | #define SMC_outb(x, ioaddr, reg) BUG() | 476 | #define SMC_outb(x, ioaddr, reg) BUG() |
475 | #define SMC_insb(a, r, p, l) BUG() | 477 | #define SMC_insb(a, r, p, l) BUG() |
476 | #define SMC_outsb(a, r, p, l) BUG() | 478 | #define SMC_outsb(a, r, p, l) BUG() |
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index ca3134540d2d..4f8910b7db2e 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -1099,15 +1099,8 @@ static int smsc911x_mii_init(struct platform_device *pdev, | |||
1099 | goto err_out_free_bus_2; | 1099 | goto err_out_free_bus_2; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | if (smsc911x_mii_probe(dev) < 0) { | ||
1103 | SMSC_WARN(pdata, probe, "Error registering mii bus"); | ||
1104 | goto err_out_unregister_bus_3; | ||
1105 | } | ||
1106 | |||
1107 | return 0; | 1102 | return 0; |
1108 | 1103 | ||
1109 | err_out_unregister_bus_3: | ||
1110 | mdiobus_unregister(pdata->mii_bus); | ||
1111 | err_out_free_bus_2: | 1104 | err_out_free_bus_2: |
1112 | mdiobus_free(pdata->mii_bus); | 1105 | mdiobus_free(pdata->mii_bus); |
1113 | err_out_1: | 1106 | err_out_1: |
@@ -1514,23 +1507,90 @@ static void smsc911x_disable_irq_chip(struct net_device *dev) | |||
1514 | smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF); | 1507 | smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF); |
1515 | } | 1508 | } |
1516 | 1509 | ||
1510 | static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id) | ||
1511 | { | ||
1512 | struct net_device *dev = dev_id; | ||
1513 | struct smsc911x_data *pdata = netdev_priv(dev); | ||
1514 | u32 intsts = smsc911x_reg_read(pdata, INT_STS); | ||
1515 | u32 inten = smsc911x_reg_read(pdata, INT_EN); | ||
1516 | int serviced = IRQ_NONE; | ||
1517 | u32 temp; | ||
1518 | |||
1519 | if (unlikely(intsts & inten & INT_STS_SW_INT_)) { | ||
1520 | temp = smsc911x_reg_read(pdata, INT_EN); | ||
1521 | temp &= (~INT_EN_SW_INT_EN_); | ||
1522 | smsc911x_reg_write(pdata, INT_EN, temp); | ||
1523 | smsc911x_reg_write(pdata, INT_STS, INT_STS_SW_INT_); | ||
1524 | pdata->software_irq_signal = 1; | ||
1525 | smp_wmb(); | ||
1526 | serviced = IRQ_HANDLED; | ||
1527 | } | ||
1528 | |||
1529 | if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) { | ||
1530 | /* Called when there is a multicast update scheduled and | ||
1531 | * it is now safe to complete the update */ | ||
1532 | SMSC_TRACE(pdata, intr, "RX Stop interrupt"); | ||
1533 | smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_); | ||
1534 | if (pdata->multicast_update_pending) | ||
1535 | smsc911x_rx_multicast_update_workaround(pdata); | ||
1536 | serviced = IRQ_HANDLED; | ||
1537 | } | ||
1538 | |||
1539 | if (intsts & inten & INT_STS_TDFA_) { | ||
1540 | temp = smsc911x_reg_read(pdata, FIFO_INT); | ||
1541 | temp |= FIFO_INT_TX_AVAIL_LEVEL_; | ||
1542 | smsc911x_reg_write(pdata, FIFO_INT, temp); | ||
1543 | smsc911x_reg_write(pdata, INT_STS, INT_STS_TDFA_); | ||
1544 | netif_wake_queue(dev); | ||
1545 | serviced = IRQ_HANDLED; | ||
1546 | } | ||
1547 | |||
1548 | if (unlikely(intsts & inten & INT_STS_RXE_)) { | ||
1549 | SMSC_TRACE(pdata, intr, "RX Error interrupt"); | ||
1550 | smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_); | ||
1551 | serviced = IRQ_HANDLED; | ||
1552 | } | ||
1553 | |||
1554 | if (likely(intsts & inten & INT_STS_RSFL_)) { | ||
1555 | if (likely(napi_schedule_prep(&pdata->napi))) { | ||
1556 | /* Disable Rx interrupts */ | ||
1557 | temp = smsc911x_reg_read(pdata, INT_EN); | ||
1558 | temp &= (~INT_EN_RSFL_EN_); | ||
1559 | smsc911x_reg_write(pdata, INT_EN, temp); | ||
1560 | /* Schedule a NAPI poll */ | ||
1561 | __napi_schedule(&pdata->napi); | ||
1562 | } else { | ||
1563 | SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed"); | ||
1564 | } | ||
1565 | serviced = IRQ_HANDLED; | ||
1566 | } | ||
1567 | |||
1568 | return serviced; | ||
1569 | } | ||
1570 | |||
1517 | static int smsc911x_open(struct net_device *dev) | 1571 | static int smsc911x_open(struct net_device *dev) |
1518 | { | 1572 | { |
1519 | struct smsc911x_data *pdata = netdev_priv(dev); | 1573 | struct smsc911x_data *pdata = netdev_priv(dev); |
1520 | unsigned int timeout; | 1574 | unsigned int timeout; |
1521 | unsigned int temp; | 1575 | unsigned int temp; |
1522 | unsigned int intcfg; | 1576 | unsigned int intcfg; |
1577 | int retval; | ||
1578 | int irq_flags; | ||
1523 | 1579 | ||
1524 | /* if the phy is not yet registered, retry later*/ | 1580 | /* find and start the given phy */ |
1525 | if (!dev->phydev) { | 1581 | if (!dev->phydev) { |
1526 | SMSC_WARN(pdata, hw, "phy_dev is NULL"); | 1582 | retval = smsc911x_mii_probe(dev); |
1527 | return -EAGAIN; | 1583 | if (retval < 0) { |
1584 | SMSC_WARN(pdata, probe, "Error starting phy"); | ||
1585 | goto out; | ||
1586 | } | ||
1528 | } | 1587 | } |
1529 | 1588 | ||
1530 | /* Reset the LAN911x */ | 1589 | /* Reset the LAN911x */ |
1531 | if (smsc911x_soft_reset(pdata)) { | 1590 | retval = smsc911x_soft_reset(pdata); |
1591 | if (retval) { | ||
1532 | SMSC_WARN(pdata, hw, "soft reset failed"); | 1592 | SMSC_WARN(pdata, hw, "soft reset failed"); |
1533 | return -EIO; | 1593 | goto mii_free_out; |
1534 | } | 1594 | } |
1535 | 1595 | ||
1536 | smsc911x_reg_write(pdata, HW_CFG, 0x00050000); | 1596 | smsc911x_reg_write(pdata, HW_CFG, 0x00050000); |
@@ -1586,6 +1646,15 @@ static int smsc911x_open(struct net_device *dev) | |||
1586 | pdata->software_irq_signal = 0; | 1646 | pdata->software_irq_signal = 0; |
1587 | smp_wmb(); | 1647 | smp_wmb(); |
1588 | 1648 | ||
1649 | irq_flags = irq_get_trigger_type(dev->irq); | ||
1650 | retval = request_irq(dev->irq, smsc911x_irqhandler, | ||
1651 | irq_flags | IRQF_SHARED, dev->name, dev); | ||
1652 | if (retval) { | ||
1653 | SMSC_WARN(pdata, probe, | ||
1654 | "Unable to claim requested irq: %d", dev->irq); | ||
1655 | goto mii_free_out; | ||
1656 | } | ||
1657 | |||
1589 | temp = smsc911x_reg_read(pdata, INT_EN); | 1658 | temp = smsc911x_reg_read(pdata, INT_EN); |
1590 | temp |= INT_EN_SW_INT_EN_; | 1659 | temp |= INT_EN_SW_INT_EN_; |
1591 | smsc911x_reg_write(pdata, INT_EN, temp); | 1660 | smsc911x_reg_write(pdata, INT_EN, temp); |
@@ -1600,7 +1669,8 @@ static int smsc911x_open(struct net_device *dev) | |||
1600 | if (!pdata->software_irq_signal) { | 1669 | if (!pdata->software_irq_signal) { |
1601 | netdev_warn(dev, "ISR failed signaling test (IRQ %d)\n", | 1670 | netdev_warn(dev, "ISR failed signaling test (IRQ %d)\n", |
1602 | dev->irq); | 1671 | dev->irq); |
1603 | return -ENODEV; | 1672 | retval = -ENODEV; |
1673 | goto irq_stop_out; | ||
1604 | } | 1674 | } |
1605 | SMSC_TRACE(pdata, ifup, "IRQ handler passed test using IRQ %d", | 1675 | SMSC_TRACE(pdata, ifup, "IRQ handler passed test using IRQ %d", |
1606 | dev->irq); | 1676 | dev->irq); |
@@ -1646,6 +1716,14 @@ static int smsc911x_open(struct net_device *dev) | |||
1646 | 1716 | ||
1647 | netif_start_queue(dev); | 1717 | netif_start_queue(dev); |
1648 | return 0; | 1718 | return 0; |
1719 | |||
1720 | irq_stop_out: | ||
1721 | free_irq(dev->irq, dev); | ||
1722 | mii_free_out: | ||
1723 | phy_disconnect(dev->phydev); | ||
1724 | dev->phydev = NULL; | ||
1725 | out: | ||
1726 | return retval; | ||
1649 | } | 1727 | } |
1650 | 1728 | ||
1651 | /* Entry point for stopping the interface */ | 1729 | /* Entry point for stopping the interface */ |
@@ -1667,9 +1745,15 @@ static int smsc911x_stop(struct net_device *dev) | |||
1667 | dev->stats.rx_dropped += smsc911x_reg_read(pdata, RX_DROP); | 1745 | dev->stats.rx_dropped += smsc911x_reg_read(pdata, RX_DROP); |
1668 | smsc911x_tx_update_txcounters(dev); | 1746 | smsc911x_tx_update_txcounters(dev); |
1669 | 1747 | ||
1748 | free_irq(dev->irq, dev); | ||
1749 | |||
1670 | /* Bring the PHY down */ | 1750 | /* Bring the PHY down */ |
1671 | if (dev->phydev) | 1751 | if (dev->phydev) { |
1672 | phy_stop(dev->phydev); | 1752 | phy_stop(dev->phydev); |
1753 | phy_disconnect(dev->phydev); | ||
1754 | dev->phydev = NULL; | ||
1755 | } | ||
1756 | netif_carrier_off(dev); | ||
1673 | 1757 | ||
1674 | SMSC_TRACE(pdata, ifdown, "Interface stopped"); | 1758 | SMSC_TRACE(pdata, ifdown, "Interface stopped"); |
1675 | return 0; | 1759 | return 0; |
@@ -1811,67 +1895,6 @@ static void smsc911x_set_multicast_list(struct net_device *dev) | |||
1811 | spin_unlock_irqrestore(&pdata->mac_lock, flags); | 1895 | spin_unlock_irqrestore(&pdata->mac_lock, flags); |
1812 | } | 1896 | } |
1813 | 1897 | ||
1814 | static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id) | ||
1815 | { | ||
1816 | struct net_device *dev = dev_id; | ||
1817 | struct smsc911x_data *pdata = netdev_priv(dev); | ||
1818 | u32 intsts = smsc911x_reg_read(pdata, INT_STS); | ||
1819 | u32 inten = smsc911x_reg_read(pdata, INT_EN); | ||
1820 | int serviced = IRQ_NONE; | ||
1821 | u32 temp; | ||
1822 | |||
1823 | if (unlikely(intsts & inten & INT_STS_SW_INT_)) { | ||
1824 | temp = smsc911x_reg_read(pdata, INT_EN); | ||
1825 | temp &= (~INT_EN_SW_INT_EN_); | ||
1826 | smsc911x_reg_write(pdata, INT_EN, temp); | ||
1827 | smsc911x_reg_write(pdata, INT_STS, INT_STS_SW_INT_); | ||
1828 | pdata->software_irq_signal = 1; | ||
1829 | smp_wmb(); | ||
1830 | serviced = IRQ_HANDLED; | ||
1831 | } | ||
1832 | |||
1833 | if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) { | ||
1834 | /* Called when there is a multicast update scheduled and | ||
1835 | * it is now safe to complete the update */ | ||
1836 | SMSC_TRACE(pdata, intr, "RX Stop interrupt"); | ||
1837 | smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_); | ||
1838 | if (pdata->multicast_update_pending) | ||
1839 | smsc911x_rx_multicast_update_workaround(pdata); | ||
1840 | serviced = IRQ_HANDLED; | ||
1841 | } | ||
1842 | |||
1843 | if (intsts & inten & INT_STS_TDFA_) { | ||
1844 | temp = smsc911x_reg_read(pdata, FIFO_INT); | ||
1845 | temp |= FIFO_INT_TX_AVAIL_LEVEL_; | ||
1846 | smsc911x_reg_write(pdata, FIFO_INT, temp); | ||
1847 | smsc911x_reg_write(pdata, INT_STS, INT_STS_TDFA_); | ||
1848 | netif_wake_queue(dev); | ||
1849 | serviced = IRQ_HANDLED; | ||
1850 | } | ||
1851 | |||
1852 | if (unlikely(intsts & inten & INT_STS_RXE_)) { | ||
1853 | SMSC_TRACE(pdata, intr, "RX Error interrupt"); | ||
1854 | smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_); | ||
1855 | serviced = IRQ_HANDLED; | ||
1856 | } | ||
1857 | |||
1858 | if (likely(intsts & inten & INT_STS_RSFL_)) { | ||
1859 | if (likely(napi_schedule_prep(&pdata->napi))) { | ||
1860 | /* Disable Rx interrupts */ | ||
1861 | temp = smsc911x_reg_read(pdata, INT_EN); | ||
1862 | temp &= (~INT_EN_RSFL_EN_); | ||
1863 | smsc911x_reg_write(pdata, INT_EN, temp); | ||
1864 | /* Schedule a NAPI poll */ | ||
1865 | __napi_schedule(&pdata->napi); | ||
1866 | } else { | ||
1867 | SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed"); | ||
1868 | } | ||
1869 | serviced = IRQ_HANDLED; | ||
1870 | } | ||
1871 | |||
1872 | return serviced; | ||
1873 | } | ||
1874 | |||
1875 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1898 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1876 | static void smsc911x_poll_controller(struct net_device *dev) | 1899 | static void smsc911x_poll_controller(struct net_device *dev) |
1877 | { | 1900 | { |
@@ -2291,16 +2314,14 @@ static int smsc911x_drv_remove(struct platform_device *pdev) | |||
2291 | pdata = netdev_priv(dev); | 2314 | pdata = netdev_priv(dev); |
2292 | BUG_ON(!pdata); | 2315 | BUG_ON(!pdata); |
2293 | BUG_ON(!pdata->ioaddr); | 2316 | BUG_ON(!pdata->ioaddr); |
2294 | BUG_ON(!dev->phydev); | 2317 | WARN_ON(dev->phydev); |
2295 | 2318 | ||
2296 | SMSC_TRACE(pdata, ifdown, "Stopping driver"); | 2319 | SMSC_TRACE(pdata, ifdown, "Stopping driver"); |
2297 | 2320 | ||
2298 | phy_disconnect(dev->phydev); | ||
2299 | mdiobus_unregister(pdata->mii_bus); | 2321 | mdiobus_unregister(pdata->mii_bus); |
2300 | mdiobus_free(pdata->mii_bus); | 2322 | mdiobus_free(pdata->mii_bus); |
2301 | 2323 | ||
2302 | unregister_netdev(dev); | 2324 | unregister_netdev(dev); |
2303 | free_irq(dev->irq, dev); | ||
2304 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 2325 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
2305 | "smsc911x-memory"); | 2326 | "smsc911x-memory"); |
2306 | if (!res) | 2327 | if (!res) |
@@ -2385,8 +2406,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2385 | struct smsc911x_data *pdata; | 2406 | struct smsc911x_data *pdata; |
2386 | struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev); | 2407 | struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev); |
2387 | struct resource *res; | 2408 | struct resource *res; |
2388 | unsigned int intcfg = 0; | 2409 | int res_size, irq; |
2389 | int res_size, irq, irq_flags; | ||
2390 | int retval; | 2410 | int retval; |
2391 | 2411 | ||
2392 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 2412 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
@@ -2425,7 +2445,6 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2425 | 2445 | ||
2426 | pdata = netdev_priv(dev); | 2446 | pdata = netdev_priv(dev); |
2427 | dev->irq = irq; | 2447 | dev->irq = irq; |
2428 | irq_flags = irq_get_trigger_type(irq); | ||
2429 | pdata->ioaddr = ioremap_nocache(res->start, res_size); | 2448 | pdata->ioaddr = ioremap_nocache(res->start, res_size); |
2430 | 2449 | ||
2431 | pdata->dev = dev; | 2450 | pdata->dev = dev; |
@@ -2472,43 +2491,23 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2472 | if (retval < 0) | 2491 | if (retval < 0) |
2473 | goto out_disable_resources; | 2492 | goto out_disable_resources; |
2474 | 2493 | ||
2475 | /* configure irq polarity and type before connecting isr */ | 2494 | netif_carrier_off(dev); |
2476 | if (pdata->config.irq_polarity == SMSC911X_IRQ_POLARITY_ACTIVE_HIGH) | ||
2477 | intcfg |= INT_CFG_IRQ_POL_; | ||
2478 | |||
2479 | if (pdata->config.irq_type == SMSC911X_IRQ_TYPE_PUSH_PULL) | ||
2480 | intcfg |= INT_CFG_IRQ_TYPE_; | ||
2481 | |||
2482 | smsc911x_reg_write(pdata, INT_CFG, intcfg); | ||
2483 | |||
2484 | /* Ensure interrupts are globally disabled before connecting ISR */ | ||
2485 | smsc911x_disable_irq_chip(dev); | ||
2486 | 2495 | ||
2487 | retval = request_irq(dev->irq, smsc911x_irqhandler, | 2496 | retval = smsc911x_mii_init(pdev, dev); |
2488 | irq_flags | IRQF_SHARED, dev->name, dev); | ||
2489 | if (retval) { | 2497 | if (retval) { |
2490 | SMSC_WARN(pdata, probe, | 2498 | SMSC_WARN(pdata, probe, "Error %i initialising mii", retval); |
2491 | "Unable to claim requested irq: %d", dev->irq); | ||
2492 | goto out_disable_resources; | 2499 | goto out_disable_resources; |
2493 | } | 2500 | } |
2494 | 2501 | ||
2495 | netif_carrier_off(dev); | ||
2496 | |||
2497 | retval = register_netdev(dev); | 2502 | retval = register_netdev(dev); |
2498 | if (retval) { | 2503 | if (retval) { |
2499 | SMSC_WARN(pdata, probe, "Error %i registering device", retval); | 2504 | SMSC_WARN(pdata, probe, "Error %i registering device", retval); |
2500 | goto out_free_irq; | 2505 | goto out_disable_resources; |
2501 | } else { | 2506 | } else { |
2502 | SMSC_TRACE(pdata, probe, | 2507 | SMSC_TRACE(pdata, probe, |
2503 | "Network interface: \"%s\"", dev->name); | 2508 | "Network interface: \"%s\"", dev->name); |
2504 | } | 2509 | } |
2505 | 2510 | ||
2506 | retval = smsc911x_mii_init(pdev, dev); | ||
2507 | if (retval) { | ||
2508 | SMSC_WARN(pdata, probe, "Error %i initialising mii", retval); | ||
2509 | goto out_unregister_netdev_5; | ||
2510 | } | ||
2511 | |||
2512 | spin_lock_irq(&pdata->mac_lock); | 2511 | spin_lock_irq(&pdata->mac_lock); |
2513 | 2512 | ||
2514 | /* Check if mac address has been specified when bringing interface up */ | 2513 | /* Check if mac address has been specified when bringing interface up */ |
@@ -2544,10 +2543,6 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2544 | 2543 | ||
2545 | return 0; | 2544 | return 0; |
2546 | 2545 | ||
2547 | out_unregister_netdev_5: | ||
2548 | unregister_netdev(dev); | ||
2549 | out_free_irq: | ||
2550 | free_irq(dev->irq, dev); | ||
2551 | out_disable_resources: | 2546 | out_disable_resources: |
2552 | pm_runtime_put(&pdev->dev); | 2547 | pm_runtime_put(&pdev->dev); |
2553 | pm_runtime_disable(&pdev->dev); | 2548 | pm_runtime_disable(&pdev->dev); |
diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c index 5a3941bf250f..4490ebaed127 100644 --- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c +++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c | |||
@@ -1246,7 +1246,7 @@ static int dwceqos_mii_init(struct net_local *lp) | |||
1246 | lp->mii_bus->read = &dwceqos_mdio_read; | 1246 | lp->mii_bus->read = &dwceqos_mdio_read; |
1247 | lp->mii_bus->write = &dwceqos_mdio_write; | 1247 | lp->mii_bus->write = &dwceqos_mdio_write; |
1248 | lp->mii_bus->priv = lp; | 1248 | lp->mii_bus->priv = lp; |
1249 | lp->mii_bus->parent = &lp->ndev->dev; | 1249 | lp->mii_bus->parent = &lp->pdev->dev; |
1250 | 1250 | ||
1251 | of_address_to_resource(lp->pdev->dev.of_node, 0, &res); | 1251 | of_address_to_resource(lp->pdev->dev.of_node, 0, &res); |
1252 | snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%.8llx", | 1252 | snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%.8llx", |
@@ -2853,25 +2853,17 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2853 | 2853 | ||
2854 | ndev->features = ndev->hw_features; | 2854 | ndev->features = ndev->hw_features; |
2855 | 2855 | ||
2856 | netif_napi_add(ndev, &lp->napi, dwceqos_rx_poll, NAPI_POLL_WEIGHT); | ||
2857 | |||
2858 | ret = register_netdev(ndev); | ||
2859 | if (ret) { | ||
2860 | dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); | ||
2861 | goto err_out_clk_dis_aper; | ||
2862 | } | ||
2863 | |||
2864 | lp->phy_ref_clk = devm_clk_get(&pdev->dev, "phy_ref_clk"); | 2856 | lp->phy_ref_clk = devm_clk_get(&pdev->dev, "phy_ref_clk"); |
2865 | if (IS_ERR(lp->phy_ref_clk)) { | 2857 | if (IS_ERR(lp->phy_ref_clk)) { |
2866 | dev_err(&pdev->dev, "phy_ref_clk clock not found.\n"); | 2858 | dev_err(&pdev->dev, "phy_ref_clk clock not found.\n"); |
2867 | ret = PTR_ERR(lp->phy_ref_clk); | 2859 | ret = PTR_ERR(lp->phy_ref_clk); |
2868 | goto err_out_unregister_netdev; | 2860 | goto err_out_clk_dis_aper; |
2869 | } | 2861 | } |
2870 | 2862 | ||
2871 | ret = clk_prepare_enable(lp->phy_ref_clk); | 2863 | ret = clk_prepare_enable(lp->phy_ref_clk); |
2872 | if (ret) { | 2864 | if (ret) { |
2873 | dev_err(&pdev->dev, "Unable to enable device clock.\n"); | 2865 | dev_err(&pdev->dev, "Unable to enable device clock.\n"); |
2874 | goto err_out_unregister_netdev; | 2866 | goto err_out_clk_dis_aper; |
2875 | } | 2867 | } |
2876 | 2868 | ||
2877 | lp->phy_node = of_parse_phandle(lp->pdev->dev.of_node, | 2869 | lp->phy_node = of_parse_phandle(lp->pdev->dev.of_node, |
@@ -2880,7 +2872,7 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2880 | ret = of_phy_register_fixed_link(lp->pdev->dev.of_node); | 2872 | ret = of_phy_register_fixed_link(lp->pdev->dev.of_node); |
2881 | if (ret < 0) { | 2873 | if (ret < 0) { |
2882 | dev_err(&pdev->dev, "invalid fixed-link"); | 2874 | dev_err(&pdev->dev, "invalid fixed-link"); |
2883 | goto err_out_unregister_clk_notifier; | 2875 | goto err_out_clk_dis_phy; |
2884 | } | 2876 | } |
2885 | 2877 | ||
2886 | lp->phy_node = of_node_get(lp->pdev->dev.of_node); | 2878 | lp->phy_node = of_node_get(lp->pdev->dev.of_node); |
@@ -2889,7 +2881,7 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2889 | ret = of_get_phy_mode(lp->pdev->dev.of_node); | 2881 | ret = of_get_phy_mode(lp->pdev->dev.of_node); |
2890 | if (ret < 0) { | 2882 | if (ret < 0) { |
2891 | dev_err(&lp->pdev->dev, "error in getting phy i/f\n"); | 2883 | dev_err(&lp->pdev->dev, "error in getting phy i/f\n"); |
2892 | goto err_out_unregister_clk_notifier; | 2884 | goto err_out_clk_dis_phy; |
2893 | } | 2885 | } |
2894 | 2886 | ||
2895 | lp->phy_interface = ret; | 2887 | lp->phy_interface = ret; |
@@ -2897,14 +2889,14 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2897 | ret = dwceqos_mii_init(lp); | 2889 | ret = dwceqos_mii_init(lp); |
2898 | if (ret) { | 2890 | if (ret) { |
2899 | dev_err(&lp->pdev->dev, "error in dwceqos_mii_init\n"); | 2891 | dev_err(&lp->pdev->dev, "error in dwceqos_mii_init\n"); |
2900 | goto err_out_unregister_clk_notifier; | 2892 | goto err_out_clk_dis_phy; |
2901 | } | 2893 | } |
2902 | 2894 | ||
2903 | ret = dwceqos_mii_probe(ndev); | 2895 | ret = dwceqos_mii_probe(ndev); |
2904 | if (ret != 0) { | 2896 | if (ret != 0) { |
2905 | netdev_err(ndev, "mii_probe fail.\n"); | 2897 | netdev_err(ndev, "mii_probe fail.\n"); |
2906 | ret = -ENXIO; | 2898 | ret = -ENXIO; |
2907 | goto err_out_unregister_clk_notifier; | 2899 | goto err_out_clk_dis_phy; |
2908 | } | 2900 | } |
2909 | 2901 | ||
2910 | dwceqos_set_umac_addr(lp, lp->ndev->dev_addr, 0); | 2902 | dwceqos_set_umac_addr(lp, lp->ndev->dev_addr, 0); |
@@ -2922,7 +2914,7 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2922 | if (ret) { | 2914 | if (ret) { |
2923 | dev_err(&lp->pdev->dev, "Unable to retrieve DT, error %d\n", | 2915 | dev_err(&lp->pdev->dev, "Unable to retrieve DT, error %d\n", |
2924 | ret); | 2916 | ret); |
2925 | goto err_out_unregister_clk_notifier; | 2917 | goto err_out_clk_dis_phy; |
2926 | } | 2918 | } |
2927 | dev_info(&lp->pdev->dev, "pdev->id %d, baseaddr 0x%08lx, irq %d\n", | 2919 | dev_info(&lp->pdev->dev, "pdev->id %d, baseaddr 0x%08lx, irq %d\n", |
2928 | pdev->id, ndev->base_addr, ndev->irq); | 2920 | pdev->id, ndev->base_addr, ndev->irq); |
@@ -2932,18 +2924,24 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2932 | if (ret) { | 2924 | if (ret) { |
2933 | dev_err(&lp->pdev->dev, "Unable to request IRQ %d, error %d\n", | 2925 | dev_err(&lp->pdev->dev, "Unable to request IRQ %d, error %d\n", |
2934 | ndev->irq, ret); | 2926 | ndev->irq, ret); |
2935 | goto err_out_unregister_clk_notifier; | 2927 | goto err_out_clk_dis_phy; |
2936 | } | 2928 | } |
2937 | 2929 | ||
2938 | if (netif_msg_probe(lp)) | 2930 | if (netif_msg_probe(lp)) |
2939 | netdev_dbg(ndev, "net_local@%p\n", lp); | 2931 | netdev_dbg(ndev, "net_local@%p\n", lp); |
2940 | 2932 | ||
2933 | netif_napi_add(ndev, &lp->napi, dwceqos_rx_poll, NAPI_POLL_WEIGHT); | ||
2934 | |||
2935 | ret = register_netdev(ndev); | ||
2936 | if (ret) { | ||
2937 | dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); | ||
2938 | goto err_out_clk_dis_phy; | ||
2939 | } | ||
2940 | |||
2941 | return 0; | 2941 | return 0; |
2942 | 2942 | ||
2943 | err_out_unregister_clk_notifier: | 2943 | err_out_clk_dis_phy: |
2944 | clk_disable_unprepare(lp->phy_ref_clk); | 2944 | clk_disable_unprepare(lp->phy_ref_clk); |
2945 | err_out_unregister_netdev: | ||
2946 | unregister_netdev(ndev); | ||
2947 | err_out_clk_dis_aper: | 2945 | err_out_clk_dis_aper: |
2948 | clk_disable_unprepare(lp->apb_pclk); | 2946 | clk_disable_unprepare(lp->apb_pclk); |
2949 | err_out_free_netdev: | 2947 | err_out_free_netdev: |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 47a64342cc16..b4863e4e522b 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -303,6 +303,7 @@ config MDIO_HISI_FEMAC | |||
303 | 303 | ||
304 | config MDIO_XGENE | 304 | config MDIO_XGENE |
305 | tristate "APM X-Gene SoC MDIO bus controller" | 305 | tristate "APM X-Gene SoC MDIO bus controller" |
306 | depends on ARCH_XGENE || COMPILE_TEST | ||
306 | help | 307 | help |
307 | This module provides a driver for the MDIO busses found in the | 308 | This module provides a driver for the MDIO busses found in the |
308 | APM X-Gene SoC's. | 309 | APM X-Gene SoC's. |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index c0dda6fc0921..6e65832051d6 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -2782,14 +2782,15 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
2782 | struct net_device *lowerdev = NULL; | 2782 | struct net_device *lowerdev = NULL; |
2783 | 2783 | ||
2784 | if (conf->flags & VXLAN_F_GPE) { | 2784 | if (conf->flags & VXLAN_F_GPE) { |
2785 | if (conf->flags & ~VXLAN_F_ALLOWED_GPE) | ||
2786 | return -EINVAL; | ||
2787 | /* For now, allow GPE only together with COLLECT_METADATA. | 2785 | /* For now, allow GPE only together with COLLECT_METADATA. |
2788 | * This can be relaxed later; in such case, the other side | 2786 | * This can be relaxed later; in such case, the other side |
2789 | * of the PtP link will have to be provided. | 2787 | * of the PtP link will have to be provided. |
2790 | */ | 2788 | */ |
2791 | if (!(conf->flags & VXLAN_F_COLLECT_METADATA)) | 2789 | if ((conf->flags & ~VXLAN_F_ALLOWED_GPE) || |
2790 | !(conf->flags & VXLAN_F_COLLECT_METADATA)) { | ||
2791 | pr_info("unsupported combination of extensions\n"); | ||
2792 | return -EINVAL; | 2792 | return -EINVAL; |
2793 | } | ||
2793 | 2794 | ||
2794 | vxlan_raw_setup(dev); | 2795 | vxlan_raw_setup(dev); |
2795 | } else { | 2796 | } else { |
@@ -2842,6 +2843,9 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
2842 | dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); | 2843 | dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); |
2843 | 2844 | ||
2844 | needed_headroom = lowerdev->hard_header_len; | 2845 | needed_headroom = lowerdev->hard_header_len; |
2846 | } else if (vxlan_addr_multicast(&dst->remote_ip)) { | ||
2847 | pr_info("multicast destination requires interface to be specified\n"); | ||
2848 | return -EINVAL; | ||
2845 | } | 2849 | } |
2846 | 2850 | ||
2847 | if (conf->mtu) { | 2851 | if (conf->mtu) { |
@@ -2874,8 +2878,10 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
2874 | tmp->cfg.saddr.sa.sa_family == AF_INET6) == use_ipv6 && | 2878 | tmp->cfg.saddr.sa.sa_family == AF_INET6) == use_ipv6 && |
2875 | tmp->cfg.dst_port == vxlan->cfg.dst_port && | 2879 | tmp->cfg.dst_port == vxlan->cfg.dst_port && |
2876 | (tmp->flags & VXLAN_F_RCV_FLAGS) == | 2880 | (tmp->flags & VXLAN_F_RCV_FLAGS) == |
2877 | (vxlan->flags & VXLAN_F_RCV_FLAGS)) | 2881 | (vxlan->flags & VXLAN_F_RCV_FLAGS)) { |
2878 | return -EEXIST; | 2882 | pr_info("duplicate VNI %u\n", be32_to_cpu(conf->vni)); |
2883 | return -EEXIST; | ||
2884 | } | ||
2879 | } | 2885 | } |
2880 | 2886 | ||
2881 | dev->ethtool_ops = &vxlan_ethtool_ops; | 2887 | dev->ethtool_ops = &vxlan_ethtool_ops; |
@@ -2909,7 +2915,6 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev, | |||
2909 | struct nlattr *tb[], struct nlattr *data[]) | 2915 | struct nlattr *tb[], struct nlattr *data[]) |
2910 | { | 2916 | { |
2911 | struct vxlan_config conf; | 2917 | struct vxlan_config conf; |
2912 | int err; | ||
2913 | 2918 | ||
2914 | memset(&conf, 0, sizeof(conf)); | 2919 | memset(&conf, 0, sizeof(conf)); |
2915 | 2920 | ||
@@ -3018,26 +3023,7 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev, | |||
3018 | if (tb[IFLA_MTU]) | 3023 | if (tb[IFLA_MTU]) |
3019 | conf.mtu = nla_get_u32(tb[IFLA_MTU]); | 3024 | conf.mtu = nla_get_u32(tb[IFLA_MTU]); |
3020 | 3025 | ||
3021 | err = vxlan_dev_configure(src_net, dev, &conf); | 3026 | return vxlan_dev_configure(src_net, dev, &conf); |
3022 | switch (err) { | ||
3023 | case -ENODEV: | ||
3024 | pr_info("ifindex %d does not exist\n", conf.remote_ifindex); | ||
3025 | break; | ||
3026 | |||
3027 | case -EPERM: | ||
3028 | pr_info("IPv6 is disabled via sysctl\n"); | ||
3029 | break; | ||
3030 | |||
3031 | case -EEXIST: | ||
3032 | pr_info("duplicate VNI %u\n", be32_to_cpu(conf.vni)); | ||
3033 | break; | ||
3034 | |||
3035 | case -EINVAL: | ||
3036 | pr_info("unsupported combination of extensions\n"); | ||
3037 | break; | ||
3038 | } | ||
3039 | |||
3040 | return err; | ||
3041 | } | 3027 | } |
3042 | 3028 | ||
3043 | static void vxlan_dellink(struct net_device *dev, struct list_head *head) | 3029 | static void vxlan_dellink(struct net_device *dev, struct list_head *head) |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 78db5d679f19..24c8d65bcf34 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struct ath10k *ar, | |||
1525 | static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) | 1525 | static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) |
1526 | { | 1526 | { |
1527 | struct ath10k *ar = htt->ar; | 1527 | struct ath10k *ar = htt->ar; |
1528 | static struct ieee80211_rx_status rx_status; | 1528 | struct ieee80211_rx_status *rx_status = &htt->rx_status; |
1529 | struct sk_buff_head amsdu; | 1529 | struct sk_buff_head amsdu; |
1530 | int ret; | 1530 | int ret; |
1531 | 1531 | ||
@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) | |||
1549 | return ret; | 1549 | return ret; |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff); | 1552 | ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff); |
1553 | ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0); | 1553 | ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0); |
1554 | ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status); | 1554 | ath10k_htt_rx_h_filter(ar, &amsdu, rx_status); |
1555 | ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status); | 1555 | ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status); |
1556 | ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status); | 1556 | ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status); |
1557 | 1557 | ||
1558 | return 0; | 1558 | return 0; |
1559 | } | 1559 | } |
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 9a22c478dd1b..07933c51a850 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c | |||
@@ -3162,7 +3162,6 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
3162 | pci_hard_reset = ath10k_pci_qca988x_chip_reset; | 3162 | pci_hard_reset = ath10k_pci_qca988x_chip_reset; |
3163 | break; | 3163 | break; |
3164 | case QCA9887_1_0_DEVICE_ID: | 3164 | case QCA9887_1_0_DEVICE_ID: |
3165 | dev_warn(&pdev->dev, "QCA9887 support is still experimental, there are likely bugs. You have been warned.\n"); | ||
3166 | hw_rev = ATH10K_HW_QCA9887; | 3165 | hw_rev = ATH10K_HW_QCA9887; |
3167 | pci_ps = false; | 3166 | pci_ps = false; |
3168 | pci_soft_reset = ath10k_pci_warm_reset; | 3167 | pci_soft_reset = ath10k_pci_warm_reset; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index d1d0c06d627c..14b13f07cd1f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -2482,6 +2482,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2482 | return -EINVAL; | 2482 | return -EINVAL; |
2483 | } | 2483 | } |
2484 | 2484 | ||
2485 | ath9k_gpio_cap_init(ah); | ||
2486 | |||
2485 | if (AR_SREV_9485(ah) || | 2487 | if (AR_SREV_9485(ah) || |
2486 | AR_SREV_9285(ah) || | 2488 | AR_SREV_9285(ah) || |
2487 | AR_SREV_9330(ah) || | 2489 | AR_SREV_9330(ah) || |
@@ -2531,8 +2533,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2531 | else | 2533 | else |
2532 | pCap->hw_caps &= ~ATH9K_HW_CAP_HT; | 2534 | pCap->hw_caps &= ~ATH9K_HW_CAP_HT; |
2533 | 2535 | ||
2534 | ath9k_gpio_cap_init(ah); | ||
2535 | |||
2536 | if (AR_SREV_9160_10_OR_LATER(ah) || AR_SREV_9100(ah)) | 2536 | if (AR_SREV_9160_10_OR_LATER(ah) || AR_SREV_9100(ah)) |
2537 | pCap->rts_aggr_limit = ATH_AMPDU_LIMIT_MAX; | 2537 | pCap->rts_aggr_limit = ATH_AMPDU_LIMIT_MAX; |
2538 | else | 2538 | else |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index a394622c9022..7cb65c303f8d 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -718,9 +718,12 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
718 | if (!ath_complete_reset(sc, false)) | 718 | if (!ath_complete_reset(sc, false)) |
719 | ah->reset_power_on = false; | 719 | ah->reset_power_on = false; |
720 | 720 | ||
721 | if (ah->led_pin >= 0) | 721 | if (ah->led_pin >= 0) { |
722 | ath9k_hw_set_gpio(ah, ah->led_pin, | 722 | ath9k_hw_set_gpio(ah, ah->led_pin, |
723 | (ah->config.led_active_high) ? 1 : 0); | 723 | (ah->config.led_active_high) ? 1 : 0); |
724 | ath9k_hw_gpio_request_out(ah, ah->led_pin, NULL, | ||
725 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||
726 | } | ||
724 | 727 | ||
725 | /* | 728 | /* |
726 | * Reset key cache to sane defaults (all entries cleared) instead of | 729 | * Reset key cache to sane defaults (all entries cleared) instead of |
@@ -864,9 +867,11 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
864 | 867 | ||
865 | spin_lock_bh(&sc->sc_pcu_lock); | 868 | spin_lock_bh(&sc->sc_pcu_lock); |
866 | 869 | ||
867 | if (ah->led_pin >= 0) | 870 | if (ah->led_pin >= 0) { |
868 | ath9k_hw_set_gpio(ah, ah->led_pin, | 871 | ath9k_hw_set_gpio(ah, ah->led_pin, |
869 | (ah->config.led_active_high) ? 0 : 1); | 872 | (ah->config.led_active_high) ? 0 : 1); |
873 | ath9k_hw_gpio_request_in(ah, ah->led_pin, NULL); | ||
874 | } | ||
870 | 875 | ||
871 | ath_prepare_reset(sc); | 876 | ath_prepare_reset(sc); |
872 | 877 | ||
@@ -1154,6 +1159,7 @@ void ath9k_calculate_summary_state(struct ath_softc *sc, | |||
1154 | bool changed = (iter_data.primary_sta != ctx->primary_sta); | 1159 | bool changed = (iter_data.primary_sta != ctx->primary_sta); |
1155 | 1160 | ||
1156 | if (iter_data.primary_sta) { | 1161 | if (iter_data.primary_sta) { |
1162 | iter_data.primary_beacon_vif = iter_data.primary_sta; | ||
1157 | iter_data.beacons = true; | 1163 | iter_data.beacons = true; |
1158 | ath9k_set_assoc_state(sc, iter_data.primary_sta, | 1164 | ath9k_set_assoc_state(sc, iter_data.primary_sta, |
1159 | changed); | 1165 | changed); |
@@ -1563,13 +1569,13 @@ static int ath9k_sta_state(struct ieee80211_hw *hw, | |||
1563 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1569 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1564 | int ret = 0; | 1570 | int ret = 0; |
1565 | 1571 | ||
1566 | if (old_state == IEEE80211_STA_AUTH && | 1572 | if (old_state == IEEE80211_STA_NOTEXIST && |
1567 | new_state == IEEE80211_STA_ASSOC) { | 1573 | new_state == IEEE80211_STA_NONE) { |
1568 | ret = ath9k_sta_add(hw, vif, sta); | 1574 | ret = ath9k_sta_add(hw, vif, sta); |
1569 | ath_dbg(common, CONFIG, | 1575 | ath_dbg(common, CONFIG, |
1570 | "Add station: %pM\n", sta->addr); | 1576 | "Add station: %pM\n", sta->addr); |
1571 | } else if (old_state == IEEE80211_STA_ASSOC && | 1577 | } else if (old_state == IEEE80211_STA_NONE && |
1572 | new_state == IEEE80211_STA_AUTH) { | 1578 | new_state == IEEE80211_STA_NOTEXIST) { |
1573 | ret = ath9k_sta_remove(hw, vif, sta); | 1579 | ret = ath9k_sta_remove(hw, vif, sta); |
1574 | ath_dbg(common, CONFIG, | 1580 | ath_dbg(common, CONFIG, |
1575 | "Remove station: %pM\n", sta->addr); | 1581 | "Remove station: %pM\n", sta->addr); |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 2628d5e12c64..b8aec5e5ef93 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | |||
@@ -4527,7 +4527,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
4527 | (u8 *)&settings->beacon.head[ie_offset], | 4527 | (u8 *)&settings->beacon.head[ie_offset], |
4528 | settings->beacon.head_len - ie_offset, | 4528 | settings->beacon.head_len - ie_offset, |
4529 | WLAN_EID_SSID); | 4529 | WLAN_EID_SSID); |
4530 | if (!ssid_ie) | 4530 | if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN) |
4531 | return -EINVAL; | 4531 | return -EINVAL; |
4532 | 4532 | ||
4533 | memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); | 4533 | memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); |
@@ -5635,7 +5635,7 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp, | |||
5635 | ifevent->action, ifevent->flags, ifevent->ifidx, | 5635 | ifevent->action, ifevent->flags, ifevent->ifidx, |
5636 | ifevent->bsscfgidx); | 5636 | ifevent->bsscfgidx); |
5637 | 5637 | ||
5638 | mutex_lock(&event->vif_event_lock); | 5638 | spin_lock(&event->vif_event_lock); |
5639 | event->action = ifevent->action; | 5639 | event->action = ifevent->action; |
5640 | vif = event->vif; | 5640 | vif = event->vif; |
5641 | 5641 | ||
@@ -5643,7 +5643,7 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp, | |||
5643 | case BRCMF_E_IF_ADD: | 5643 | case BRCMF_E_IF_ADD: |
5644 | /* waiting process may have timed out */ | 5644 | /* waiting process may have timed out */ |
5645 | if (!cfg->vif_event.vif) { | 5645 | if (!cfg->vif_event.vif) { |
5646 | mutex_unlock(&event->vif_event_lock); | 5646 | spin_unlock(&event->vif_event_lock); |
5647 | return -EBADF; | 5647 | return -EBADF; |
5648 | } | 5648 | } |
5649 | 5649 | ||
@@ -5654,24 +5654,24 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp, | |||
5654 | ifp->ndev->ieee80211_ptr = &vif->wdev; | 5654 | ifp->ndev->ieee80211_ptr = &vif->wdev; |
5655 | SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy)); | 5655 | SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy)); |
5656 | } | 5656 | } |
5657 | mutex_unlock(&event->vif_event_lock); | 5657 | spin_unlock(&event->vif_event_lock); |
5658 | wake_up(&event->vif_wq); | 5658 | wake_up(&event->vif_wq); |
5659 | return 0; | 5659 | return 0; |
5660 | 5660 | ||
5661 | case BRCMF_E_IF_DEL: | 5661 | case BRCMF_E_IF_DEL: |
5662 | mutex_unlock(&event->vif_event_lock); | 5662 | spin_unlock(&event->vif_event_lock); |
5663 | /* event may not be upon user request */ | 5663 | /* event may not be upon user request */ |
5664 | if (brcmf_cfg80211_vif_event_armed(cfg)) | 5664 | if (brcmf_cfg80211_vif_event_armed(cfg)) |
5665 | wake_up(&event->vif_wq); | 5665 | wake_up(&event->vif_wq); |
5666 | return 0; | 5666 | return 0; |
5667 | 5667 | ||
5668 | case BRCMF_E_IF_CHANGE: | 5668 | case BRCMF_E_IF_CHANGE: |
5669 | mutex_unlock(&event->vif_event_lock); | 5669 | spin_unlock(&event->vif_event_lock); |
5670 | wake_up(&event->vif_wq); | 5670 | wake_up(&event->vif_wq); |
5671 | return 0; | 5671 | return 0; |
5672 | 5672 | ||
5673 | default: | 5673 | default: |
5674 | mutex_unlock(&event->vif_event_lock); | 5674 | spin_unlock(&event->vif_event_lock); |
5675 | break; | 5675 | break; |
5676 | } | 5676 | } |
5677 | return -EINVAL; | 5677 | return -EINVAL; |
@@ -5792,7 +5792,7 @@ static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg) | |||
5792 | static void init_vif_event(struct brcmf_cfg80211_vif_event *event) | 5792 | static void init_vif_event(struct brcmf_cfg80211_vif_event *event) |
5793 | { | 5793 | { |
5794 | init_waitqueue_head(&event->vif_wq); | 5794 | init_waitqueue_head(&event->vif_wq); |
5795 | mutex_init(&event->vif_event_lock); | 5795 | spin_lock_init(&event->vif_event_lock); |
5796 | } | 5796 | } |
5797 | 5797 | ||
5798 | static s32 brcmf_dongle_roam(struct brcmf_if *ifp) | 5798 | static s32 brcmf_dongle_roam(struct brcmf_if *ifp) |
@@ -6691,9 +6691,9 @@ static inline bool vif_event_equals(struct brcmf_cfg80211_vif_event *event, | |||
6691 | { | 6691 | { |
6692 | u8 evt_action; | 6692 | u8 evt_action; |
6693 | 6693 | ||
6694 | mutex_lock(&event->vif_event_lock); | 6694 | spin_lock(&event->vif_event_lock); |
6695 | evt_action = event->action; | 6695 | evt_action = event->action; |
6696 | mutex_unlock(&event->vif_event_lock); | 6696 | spin_unlock(&event->vif_event_lock); |
6697 | return evt_action == action; | 6697 | return evt_action == action; |
6698 | } | 6698 | } |
6699 | 6699 | ||
@@ -6702,10 +6702,10 @@ void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, | |||
6702 | { | 6702 | { |
6703 | struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; | 6703 | struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; |
6704 | 6704 | ||
6705 | mutex_lock(&event->vif_event_lock); | 6705 | spin_lock(&event->vif_event_lock); |
6706 | event->vif = vif; | 6706 | event->vif = vif; |
6707 | event->action = 0; | 6707 | event->action = 0; |
6708 | mutex_unlock(&event->vif_event_lock); | 6708 | spin_unlock(&event->vif_event_lock); |
6709 | } | 6709 | } |
6710 | 6710 | ||
6711 | bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg) | 6711 | bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg) |
@@ -6713,9 +6713,9 @@ bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg) | |||
6713 | struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; | 6713 | struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; |
6714 | bool armed; | 6714 | bool armed; |
6715 | 6715 | ||
6716 | mutex_lock(&event->vif_event_lock); | 6716 | spin_lock(&event->vif_event_lock); |
6717 | armed = event->vif != NULL; | 6717 | armed = event->vif != NULL; |
6718 | mutex_unlock(&event->vif_event_lock); | 6718 | spin_unlock(&event->vif_event_lock); |
6719 | 6719 | ||
6720 | return armed; | 6720 | return armed; |
6721 | } | 6721 | } |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h index 7d77f869b7f1..8889832c17e0 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | |||
@@ -227,7 +227,7 @@ struct escan_info { | |||
227 | */ | 227 | */ |
228 | struct brcmf_cfg80211_vif_event { | 228 | struct brcmf_cfg80211_vif_event { |
229 | wait_queue_head_t vif_wq; | 229 | wait_queue_head_t vif_wq; |
230 | struct mutex vif_event_lock; | 230 | spinlock_t vif_event_lock; |
231 | u8 action; | 231 | u8 action; |
232 | struct brcmf_cfg80211_vif *vif; | 232 | struct brcmf_cfg80211_vif *vif; |
233 | }; | 233 | }; |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 8d16f0204985..65e8c8766441 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | |||
@@ -743,7 +743,7 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, | |||
743 | * serious troublesome side effects. The p2p module will clean | 743 | * serious troublesome side effects. The p2p module will clean |
744 | * up the ifp if needed. | 744 | * up the ifp if needed. |
745 | */ | 745 | */ |
746 | brcmf_p2p_ifp_removed(ifp); | 746 | brcmf_p2p_ifp_removed(ifp, rtnl_locked); |
747 | kfree(ifp); | 747 | kfree(ifp); |
748 | } | 748 | } |
749 | } | 749 | } |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c index 66f942f7448e..de19c7c92bc6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | |||
@@ -2297,7 +2297,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
2297 | return err; | 2297 | return err; |
2298 | } | 2298 | } |
2299 | 2299 | ||
2300 | void brcmf_p2p_ifp_removed(struct brcmf_if *ifp) | 2300 | void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked) |
2301 | { | 2301 | { |
2302 | struct brcmf_cfg80211_info *cfg; | 2302 | struct brcmf_cfg80211_info *cfg; |
2303 | struct brcmf_cfg80211_vif *vif; | 2303 | struct brcmf_cfg80211_vif *vif; |
@@ -2306,9 +2306,11 @@ void brcmf_p2p_ifp_removed(struct brcmf_if *ifp) | |||
2306 | vif = ifp->vif; | 2306 | vif = ifp->vif; |
2307 | cfg = wdev_to_cfg(&vif->wdev); | 2307 | cfg = wdev_to_cfg(&vif->wdev); |
2308 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; | 2308 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; |
2309 | rtnl_lock(); | 2309 | if (!rtnl_locked) |
2310 | rtnl_lock(); | ||
2310 | cfg80211_unregister_wdev(&vif->wdev); | 2311 | cfg80211_unregister_wdev(&vif->wdev); |
2311 | rtnl_unlock(); | 2312 | if (!rtnl_locked) |
2313 | rtnl_unlock(); | ||
2312 | brcmf_free_vif(vif); | 2314 | brcmf_free_vif(vif); |
2313 | } | 2315 | } |
2314 | 2316 | ||
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h index a3bd18c2360b..8ce9447533ef 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | |||
@@ -155,7 +155,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name, | |||
155 | int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev); | 155 | int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev); |
156 | int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg, | 156 | int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg, |
157 | enum brcmf_fil_p2p_if_types if_type); | 157 | enum brcmf_fil_p2p_if_types if_type); |
158 | void brcmf_p2p_ifp_removed(struct brcmf_if *ifp); | 158 | void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked); |
159 | int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev); | 159 | int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev); |
160 | void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev); | 160 | void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev); |
161 | int brcmf_p2p_scan_prep(struct wiphy *wiphy, | 161 | int brcmf_p2p_scan_prep(struct wiphy *wiphy, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c index 1abcabb9b6cd..46b52bf705fb 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c | |||
@@ -960,5 +960,6 @@ int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm *mvm, u8 conf_id) | |||
960 | } | 960 | } |
961 | 961 | ||
962 | mvm->fw_dbg_conf = conf_id; | 962 | mvm->fw_dbg_conf = conf_id; |
963 | return ret; | 963 | |
964 | return 0; | ||
964 | } | 965 | } |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h index f7dff7612c9c..e9f1be9da7d4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h | |||
@@ -105,7 +105,8 @@ iwl_fw_dbg_trigger_vif_match(struct iwl_fw_dbg_trigger_tlv *trig, | |||
105 | { | 105 | { |
106 | u32 trig_vif = le32_to_cpu(trig->vif_type); | 106 | u32 trig_vif = le32_to_cpu(trig->vif_type); |
107 | 107 | ||
108 | return trig_vif == IWL_FW_DBG_CONF_VIF_ANY || vif->type == trig_vif; | 108 | return trig_vif == IWL_FW_DBG_CONF_VIF_ANY || |
109 | ieee80211_vif_type_p2p(vif) == trig_vif; | ||
109 | } | 110 | } |
110 | 111 | ||
111 | static inline bool | 112 | static inline bool |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 6d6064534d59..5dd77e336617 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | |||
@@ -624,6 +624,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
624 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | | 624 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | |
625 | NL80211_FEATURE_LOW_PRIORITY_SCAN | | 625 | NL80211_FEATURE_LOW_PRIORITY_SCAN | |
626 | NL80211_FEATURE_P2P_GO_OPPPS | | 626 | NL80211_FEATURE_P2P_GO_OPPPS | |
627 | NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | | ||
627 | NL80211_FEATURE_DYNAMIC_SMPS | | 628 | NL80211_FEATURE_DYNAMIC_SMPS | |
628 | NL80211_FEATURE_STATIC_SMPS | | 629 | NL80211_FEATURE_STATIC_SMPS | |
629 | NL80211_FEATURE_SUPPORTS_WMM_ADMISSION; | 630 | NL80211_FEATURE_SUPPORTS_WMM_ADMISSION; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index b4fc86d5d7ef..6a615bb73042 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | |||
@@ -467,6 +467,8 @@ struct iwl_mvm_vif { | |||
467 | static inline struct iwl_mvm_vif * | 467 | static inline struct iwl_mvm_vif * |
468 | iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif) | 468 | iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif) |
469 | { | 469 | { |
470 | if (!vif) | ||
471 | return NULL; | ||
470 | return (void *)vif->drv_priv; | 472 | return (void *)vif->drv_priv; |
471 | } | 473 | } |
472 | 474 | ||
diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c index dc49c3de1f25..c47d6366875d 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c | |||
@@ -205,7 +205,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
205 | 205 | ||
206 | do { | 206 | do { |
207 | /* Check if AMSDU can accommodate this MSDU */ | 207 | /* Check if AMSDU can accommodate this MSDU */ |
208 | if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN)) | 208 | if ((skb_aggr->len + skb_src->len + LLC_SNAP_LEN) > |
209 | adapter->tx_buf_size) | ||
209 | break; | 210 | break; |
210 | 211 | ||
211 | skb_src = skb_dequeue(&pra_list->skb_head); | 212 | skb_src = skb_dequeue(&pra_list->skb_head); |
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 458daf927336..935866fe5ec2 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c | |||
@@ -185,8 +185,12 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys, | |||
185 | return -ENXIO; | 185 | return -ENXIO; |
186 | 186 | ||
187 | nd_desc = nvdimm_bus->nd_desc; | 187 | nd_desc = nvdimm_bus->nd_desc; |
188 | /* | ||
189 | * if ndctl does not exist, it's PMEM_LEGACY and | ||
190 | * we want to just pretend everything is handled. | ||
191 | */ | ||
188 | if (!nd_desc->ndctl) | 192 | if (!nd_desc->ndctl) |
189 | return -ENXIO; | 193 | return len; |
190 | 194 | ||
191 | memset(&ars_cap, 0, sizeof(ars_cap)); | 195 | memset(&ars_cap, 0, sizeof(ars_cap)); |
192 | ars_cap.address = phys; | 196 | ars_cap.address = phys; |
diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig index 0c644f7bdf80..f7d37a62f874 100644 --- a/drivers/nvme/host/Kconfig +++ b/drivers/nvme/host/Kconfig | |||
@@ -30,7 +30,7 @@ config NVME_FABRICS | |||
30 | 30 | ||
31 | config NVME_RDMA | 31 | config NVME_RDMA |
32 | tristate "NVM Express over Fabrics RDMA host driver" | 32 | tristate "NVM Express over Fabrics RDMA host driver" |
33 | depends on INFINIBAND | 33 | depends on INFINIBAND && BLOCK |
34 | select NVME_CORE | 34 | select NVME_CORE |
35 | select NVME_FABRICS | 35 | select NVME_FABRICS |
36 | select SG_POOL | 36 | select SG_POOL |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 8dcf5a960951..60f7eab11865 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -1693,7 +1693,12 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) | |||
1693 | nvme_suspend_queue(dev->queues[i]); | 1693 | nvme_suspend_queue(dev->queues[i]); |
1694 | 1694 | ||
1695 | if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { | 1695 | if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { |
1696 | nvme_suspend_queue(dev->queues[0]); | 1696 | /* A device might become IO incapable very soon during |
1697 | * probe, before the admin queue is configured. Thus, | ||
1698 | * queue_count can be 0 here. | ||
1699 | */ | ||
1700 | if (dev->queue_count) | ||
1701 | nvme_suspend_queue(dev->queues[0]); | ||
1697 | } else { | 1702 | } else { |
1698 | nvme_disable_io_queues(dev); | 1703 | nvme_disable_io_queues(dev); |
1699 | nvme_disable_admin_queue(dev, shutdown); | 1704 | nvme_disable_admin_queue(dev, shutdown); |
@@ -2112,6 +2117,8 @@ static const struct pci_device_id nvme_id_table[] = { | |||
2112 | .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, | 2117 | .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, |
2113 | { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ | 2118 | { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ |
2114 | .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, | 2119 | .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, |
2120 | { PCI_DEVICE(0x1c5f, 0x0540), /* Memblaze Pblaze4 adapter */ | ||
2121 | .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, | ||
2115 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, | 2122 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, |
2116 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, | 2123 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, |
2117 | { 0, } | 2124 | { 0, } |
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index ab545fb347a0..c2c2c28e6eb5 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c | |||
@@ -82,6 +82,8 @@ struct nvme_rdma_request { | |||
82 | 82 | ||
83 | enum nvme_rdma_queue_flags { | 83 | enum nvme_rdma_queue_flags { |
84 | NVME_RDMA_Q_CONNECTED = (1 << 0), | 84 | NVME_RDMA_Q_CONNECTED = (1 << 0), |
85 | NVME_RDMA_IB_QUEUE_ALLOCATED = (1 << 1), | ||
86 | NVME_RDMA_Q_DELETING = (1 << 2), | ||
85 | }; | 87 | }; |
86 | 88 | ||
87 | struct nvme_rdma_queue { | 89 | struct nvme_rdma_queue { |
@@ -291,6 +293,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq) | |||
291 | if (IS_ERR(req->mr)) { | 293 | if (IS_ERR(req->mr)) { |
292 | ret = PTR_ERR(req->mr); | 294 | ret = PTR_ERR(req->mr); |
293 | req->mr = NULL; | 295 | req->mr = NULL; |
296 | goto out; | ||
294 | } | 297 | } |
295 | 298 | ||
296 | req->mr->need_inval = false; | 299 | req->mr->need_inval = false; |
@@ -480,9 +483,14 @@ out_err: | |||
480 | 483 | ||
481 | static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) | 484 | static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) |
482 | { | 485 | { |
483 | struct nvme_rdma_device *dev = queue->device; | 486 | struct nvme_rdma_device *dev; |
484 | struct ib_device *ibdev = dev->dev; | 487 | struct ib_device *ibdev; |
488 | |||
489 | if (!test_and_clear_bit(NVME_RDMA_IB_QUEUE_ALLOCATED, &queue->flags)) | ||
490 | return; | ||
485 | 491 | ||
492 | dev = queue->device; | ||
493 | ibdev = dev->dev; | ||
486 | rdma_destroy_qp(queue->cm_id); | 494 | rdma_destroy_qp(queue->cm_id); |
487 | ib_free_cq(queue->ib_cq); | 495 | ib_free_cq(queue->ib_cq); |
488 | 496 | ||
@@ -533,6 +541,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue, | |||
533 | ret = -ENOMEM; | 541 | ret = -ENOMEM; |
534 | goto out_destroy_qp; | 542 | goto out_destroy_qp; |
535 | } | 543 | } |
544 | set_bit(NVME_RDMA_IB_QUEUE_ALLOCATED, &queue->flags); | ||
536 | 545 | ||
537 | return 0; | 546 | return 0; |
538 | 547 | ||
@@ -552,6 +561,7 @@ static int nvme_rdma_init_queue(struct nvme_rdma_ctrl *ctrl, | |||
552 | 561 | ||
553 | queue = &ctrl->queues[idx]; | 562 | queue = &ctrl->queues[idx]; |
554 | queue->ctrl = ctrl; | 563 | queue->ctrl = ctrl; |
564 | queue->flags = 0; | ||
555 | init_completion(&queue->cm_done); | 565 | init_completion(&queue->cm_done); |
556 | 566 | ||
557 | if (idx > 0) | 567 | if (idx > 0) |
@@ -590,6 +600,7 @@ static int nvme_rdma_init_queue(struct nvme_rdma_ctrl *ctrl, | |||
590 | return 0; | 600 | return 0; |
591 | 601 | ||
592 | out_destroy_cm_id: | 602 | out_destroy_cm_id: |
603 | nvme_rdma_destroy_queue_ib(queue); | ||
593 | rdma_destroy_id(queue->cm_id); | 604 | rdma_destroy_id(queue->cm_id); |
594 | return ret; | 605 | return ret; |
595 | } | 606 | } |
@@ -608,7 +619,7 @@ static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) | |||
608 | 619 | ||
609 | static void nvme_rdma_stop_and_free_queue(struct nvme_rdma_queue *queue) | 620 | static void nvme_rdma_stop_and_free_queue(struct nvme_rdma_queue *queue) |
610 | { | 621 | { |
611 | if (!test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags)) | 622 | if (test_and_set_bit(NVME_RDMA_Q_DELETING, &queue->flags)) |
612 | return; | 623 | return; |
613 | nvme_rdma_stop_queue(queue); | 624 | nvme_rdma_stop_queue(queue); |
614 | nvme_rdma_free_queue(queue); | 625 | nvme_rdma_free_queue(queue); |
@@ -652,7 +663,7 @@ static int nvme_rdma_init_io_queues(struct nvme_rdma_ctrl *ctrl) | |||
652 | return 0; | 663 | return 0; |
653 | 664 | ||
654 | out_free_queues: | 665 | out_free_queues: |
655 | for (; i >= 1; i--) | 666 | for (i--; i >= 1; i--) |
656 | nvme_rdma_stop_and_free_queue(&ctrl->queues[i]); | 667 | nvme_rdma_stop_and_free_queue(&ctrl->queues[i]); |
657 | 668 | ||
658 | return ret; | 669 | return ret; |
@@ -761,8 +772,13 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work) | |||
761 | { | 772 | { |
762 | struct nvme_rdma_ctrl *ctrl = container_of(work, | 773 | struct nvme_rdma_ctrl *ctrl = container_of(work, |
763 | struct nvme_rdma_ctrl, err_work); | 774 | struct nvme_rdma_ctrl, err_work); |
775 | int i; | ||
764 | 776 | ||
765 | nvme_stop_keep_alive(&ctrl->ctrl); | 777 | nvme_stop_keep_alive(&ctrl->ctrl); |
778 | |||
779 | for (i = 0; i < ctrl->queue_count; i++) | ||
780 | clear_bit(NVME_RDMA_Q_CONNECTED, &ctrl->queues[i].flags); | ||
781 | |||
766 | if (ctrl->queue_count > 1) | 782 | if (ctrl->queue_count > 1) |
767 | nvme_stop_queues(&ctrl->ctrl); | 783 | nvme_stop_queues(&ctrl->ctrl); |
768 | blk_mq_stop_hw_queues(ctrl->ctrl.admin_q); | 784 | blk_mq_stop_hw_queues(ctrl->ctrl.admin_q); |
@@ -1305,58 +1321,6 @@ out_destroy_queue_ib: | |||
1305 | return ret; | 1321 | return ret; |
1306 | } | 1322 | } |
1307 | 1323 | ||
1308 | /** | ||
1309 | * nvme_rdma_device_unplug() - Handle RDMA device unplug | ||
1310 | * @queue: Queue that owns the cm_id that caught the event | ||
1311 | * | ||
1312 | * DEVICE_REMOVAL event notifies us that the RDMA device is about | ||
1313 | * to unplug so we should take care of destroying our RDMA resources. | ||
1314 | * This event will be generated for each allocated cm_id. | ||
1315 | * | ||
1316 | * In our case, the RDMA resources are managed per controller and not | ||
1317 | * only per queue. So the way we handle this is we trigger an implicit | ||
1318 | * controller deletion upon the first DEVICE_REMOVAL event we see, and | ||
1319 | * hold the event inflight until the controller deletion is completed. | ||
1320 | * | ||
1321 | * One exception that we need to handle is the destruction of the cm_id | ||
1322 | * that caught the event. Since we hold the callout until the controller | ||
1323 | * deletion is completed, we'll deadlock if the controller deletion will | ||
1324 | * call rdma_destroy_id on this queue's cm_id. Thus, we claim ownership | ||
1325 | * of destroying this queue before-hand, destroy the queue resources, | ||
1326 | * then queue the controller deletion which won't destroy this queue and | ||
1327 | * we destroy the cm_id implicitely by returning a non-zero rc to the callout. | ||
1328 | */ | ||
1329 | static int nvme_rdma_device_unplug(struct nvme_rdma_queue *queue) | ||
1330 | { | ||
1331 | struct nvme_rdma_ctrl *ctrl = queue->ctrl; | ||
1332 | int ret = 0; | ||
1333 | |||
1334 | /* Own the controller deletion */ | ||
1335 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING)) | ||
1336 | return 0; | ||
1337 | |||
1338 | dev_warn(ctrl->ctrl.device, | ||
1339 | "Got rdma device removal event, deleting ctrl\n"); | ||
1340 | |||
1341 | /* Get rid of reconnect work if its running */ | ||
1342 | cancel_delayed_work_sync(&ctrl->reconnect_work); | ||
1343 | |||
1344 | /* Disable the queue so ctrl delete won't free it */ | ||
1345 | if (test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags)) { | ||
1346 | /* Free this queue ourselves */ | ||
1347 | nvme_rdma_stop_queue(queue); | ||
1348 | nvme_rdma_destroy_queue_ib(queue); | ||
1349 | |||
1350 | /* Return non-zero so the cm_id will destroy implicitly */ | ||
1351 | ret = 1; | ||
1352 | } | ||
1353 | |||
1354 | /* Queue controller deletion */ | ||
1355 | queue_work(nvme_rdma_wq, &ctrl->delete_work); | ||
1356 | flush_work(&ctrl->delete_work); | ||
1357 | return ret; | ||
1358 | } | ||
1359 | |||
1360 | static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, | 1324 | static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, |
1361 | struct rdma_cm_event *ev) | 1325 | struct rdma_cm_event *ev) |
1362 | { | 1326 | { |
@@ -1398,8 +1362,8 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, | |||
1398 | nvme_rdma_error_recovery(queue->ctrl); | 1362 | nvme_rdma_error_recovery(queue->ctrl); |
1399 | break; | 1363 | break; |
1400 | case RDMA_CM_EVENT_DEVICE_REMOVAL: | 1364 | case RDMA_CM_EVENT_DEVICE_REMOVAL: |
1401 | /* return 1 means impliciy CM ID destroy */ | 1365 | /* device removal is handled via the ib_client API */ |
1402 | return nvme_rdma_device_unplug(queue); | 1366 | break; |
1403 | default: | 1367 | default: |
1404 | dev_err(queue->ctrl->ctrl.device, | 1368 | dev_err(queue->ctrl->ctrl.device, |
1405 | "Unexpected RDMA CM event (%d)\n", ev->event); | 1369 | "Unexpected RDMA CM event (%d)\n", ev->event); |
@@ -1700,15 +1664,19 @@ static int __nvme_rdma_del_ctrl(struct nvme_rdma_ctrl *ctrl) | |||
1700 | static int nvme_rdma_del_ctrl(struct nvme_ctrl *nctrl) | 1664 | static int nvme_rdma_del_ctrl(struct nvme_ctrl *nctrl) |
1701 | { | 1665 | { |
1702 | struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); | 1666 | struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); |
1703 | int ret; | 1667 | int ret = 0; |
1704 | 1668 | ||
1669 | /* | ||
1670 | * Keep a reference until all work is flushed since | ||
1671 | * __nvme_rdma_del_ctrl can free the ctrl mem | ||
1672 | */ | ||
1673 | if (!kref_get_unless_zero(&ctrl->ctrl.kref)) | ||
1674 | return -EBUSY; | ||
1705 | ret = __nvme_rdma_del_ctrl(ctrl); | 1675 | ret = __nvme_rdma_del_ctrl(ctrl); |
1706 | if (ret) | 1676 | if (!ret) |
1707 | return ret; | 1677 | flush_work(&ctrl->delete_work); |
1708 | 1678 | nvme_put_ctrl(&ctrl->ctrl); | |
1709 | flush_work(&ctrl->delete_work); | 1679 | return ret; |
1710 | |||
1711 | return 0; | ||
1712 | } | 1680 | } |
1713 | 1681 | ||
1714 | static void nvme_rdma_remove_ctrl_work(struct work_struct *work) | 1682 | static void nvme_rdma_remove_ctrl_work(struct work_struct *work) |
@@ -2005,27 +1973,57 @@ static struct nvmf_transport_ops nvme_rdma_transport = { | |||
2005 | .create_ctrl = nvme_rdma_create_ctrl, | 1973 | .create_ctrl = nvme_rdma_create_ctrl, |
2006 | }; | 1974 | }; |
2007 | 1975 | ||
1976 | static void nvme_rdma_add_one(struct ib_device *ib_device) | ||
1977 | { | ||
1978 | } | ||
1979 | |||
1980 | static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data) | ||
1981 | { | ||
1982 | struct nvme_rdma_ctrl *ctrl; | ||
1983 | |||
1984 | /* Delete all controllers using this device */ | ||
1985 | mutex_lock(&nvme_rdma_ctrl_mutex); | ||
1986 | list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) { | ||
1987 | if (ctrl->device->dev != ib_device) | ||
1988 | continue; | ||
1989 | dev_info(ctrl->ctrl.device, | ||
1990 | "Removing ctrl: NQN \"%s\", addr %pISp\n", | ||
1991 | ctrl->ctrl.opts->subsysnqn, &ctrl->addr); | ||
1992 | __nvme_rdma_del_ctrl(ctrl); | ||
1993 | } | ||
1994 | mutex_unlock(&nvme_rdma_ctrl_mutex); | ||
1995 | |||
1996 | flush_workqueue(nvme_rdma_wq); | ||
1997 | } | ||
1998 | |||
1999 | static struct ib_client nvme_rdma_ib_client = { | ||
2000 | .name = "nvme_rdma", | ||
2001 | .add = nvme_rdma_add_one, | ||
2002 | .remove = nvme_rdma_remove_one | ||
2003 | }; | ||
2004 | |||
2008 | static int __init nvme_rdma_init_module(void) | 2005 | static int __init nvme_rdma_init_module(void) |
2009 | { | 2006 | { |
2007 | int ret; | ||
2008 | |||
2010 | nvme_rdma_wq = create_workqueue("nvme_rdma_wq"); | 2009 | nvme_rdma_wq = create_workqueue("nvme_rdma_wq"); |
2011 | if (!nvme_rdma_wq) | 2010 | if (!nvme_rdma_wq) |
2012 | return -ENOMEM; | 2011 | return -ENOMEM; |
2013 | 2012 | ||
2013 | ret = ib_register_client(&nvme_rdma_ib_client); | ||
2014 | if (ret) { | ||
2015 | destroy_workqueue(nvme_rdma_wq); | ||
2016 | return ret; | ||
2017 | } | ||
2018 | |||
2014 | nvmf_register_transport(&nvme_rdma_transport); | 2019 | nvmf_register_transport(&nvme_rdma_transport); |
2015 | return 0; | 2020 | return 0; |
2016 | } | 2021 | } |
2017 | 2022 | ||
2018 | static void __exit nvme_rdma_cleanup_module(void) | 2023 | static void __exit nvme_rdma_cleanup_module(void) |
2019 | { | 2024 | { |
2020 | struct nvme_rdma_ctrl *ctrl; | ||
2021 | |||
2022 | nvmf_unregister_transport(&nvme_rdma_transport); | 2025 | nvmf_unregister_transport(&nvme_rdma_transport); |
2023 | 2026 | ib_unregister_client(&nvme_rdma_ib_client); | |
2024 | mutex_lock(&nvme_rdma_ctrl_mutex); | ||
2025 | list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) | ||
2026 | __nvme_rdma_del_ctrl(ctrl); | ||
2027 | mutex_unlock(&nvme_rdma_ctrl_mutex); | ||
2028 | |||
2029 | destroy_workqueue(nvme_rdma_wq); | 2027 | destroy_workqueue(nvme_rdma_wq); |
2030 | } | 2028 | } |
2031 | 2029 | ||
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index d1ef7acf6930..f9357e09e9b3 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -40,6 +40,7 @@ static void pci_destroy_dev(struct pci_dev *dev) | |||
40 | list_del(&dev->bus_list); | 40 | list_del(&dev->bus_list); |
41 | up_write(&pci_bus_sem); | 41 | up_write(&pci_bus_sem); |
42 | 42 | ||
43 | pci_bridge_d3_device_removed(dev); | ||
43 | pci_free_resources(dev); | 44 | pci_free_resources(dev); |
44 | put_device(&dev->dev); | 45 | put_device(&dev->dev); |
45 | } | 46 | } |
@@ -96,8 +97,6 @@ static void pci_remove_bus_device(struct pci_dev *dev) | |||
96 | dev->subordinate = NULL; | 97 | dev->subordinate = NULL; |
97 | } | 98 | } |
98 | 99 | ||
99 | pci_bridge_d3_device_removed(dev); | ||
100 | |||
101 | pci_destroy_dev(dev); | 100 | pci_destroy_dev(dev); |
102 | } | 101 | } |
103 | 102 | ||
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 489ea1098c96..69b5e811ea2b 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -977,7 +977,7 @@ static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
977 | 977 | ||
978 | /************************ runtime PM support ***************************/ | 978 | /************************ runtime PM support ***************************/ |
979 | 979 | ||
980 | static int pcmcia_dev_suspend(struct device *dev, pm_message_t state); | 980 | static int pcmcia_dev_suspend(struct device *dev); |
981 | static int pcmcia_dev_resume(struct device *dev); | 981 | static int pcmcia_dev_resume(struct device *dev); |
982 | 982 | ||
983 | static int runtime_suspend(struct device *dev) | 983 | static int runtime_suspend(struct device *dev) |
@@ -985,7 +985,7 @@ static int runtime_suspend(struct device *dev) | |||
985 | int rc; | 985 | int rc; |
986 | 986 | ||
987 | device_lock(dev); | 987 | device_lock(dev); |
988 | rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND); | 988 | rc = pcmcia_dev_suspend(dev); |
989 | device_unlock(dev); | 989 | device_unlock(dev); |
990 | return rc; | 990 | return rc; |
991 | } | 991 | } |
@@ -1135,7 +1135,7 @@ ATTRIBUTE_GROUPS(pcmcia_dev); | |||
1135 | 1135 | ||
1136 | /* PM support, also needed for reset */ | 1136 | /* PM support, also needed for reset */ |
1137 | 1137 | ||
1138 | static int pcmcia_dev_suspend(struct device *dev, pm_message_t state) | 1138 | static int pcmcia_dev_suspend(struct device *dev) |
1139 | { | 1139 | { |
1140 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 1140 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
1141 | struct pcmcia_driver *p_drv = NULL; | 1141 | struct pcmcia_driver *p_drv = NULL; |
@@ -1410,6 +1410,9 @@ static struct class_interface pcmcia_bus_interface __refdata = { | |||
1410 | .remove_dev = &pcmcia_bus_remove_socket, | 1410 | .remove_dev = &pcmcia_bus_remove_socket, |
1411 | }; | 1411 | }; |
1412 | 1412 | ||
1413 | static const struct dev_pm_ops pcmcia_bus_pm_ops = { | ||
1414 | SET_SYSTEM_SLEEP_PM_OPS(pcmcia_dev_suspend, pcmcia_dev_resume) | ||
1415 | }; | ||
1413 | 1416 | ||
1414 | struct bus_type pcmcia_bus_type = { | 1417 | struct bus_type pcmcia_bus_type = { |
1415 | .name = "pcmcia", | 1418 | .name = "pcmcia", |
@@ -1418,8 +1421,7 @@ struct bus_type pcmcia_bus_type = { | |||
1418 | .dev_groups = pcmcia_dev_groups, | 1421 | .dev_groups = pcmcia_dev_groups, |
1419 | .probe = pcmcia_device_probe, | 1422 | .probe = pcmcia_device_probe, |
1420 | .remove = pcmcia_device_remove, | 1423 | .remove = pcmcia_device_remove, |
1421 | .suspend = pcmcia_dev_suspend, | 1424 | .pm = &pcmcia_bus_pm_ops, |
1422 | .resume = pcmcia_dev_resume, | ||
1423 | }; | 1425 | }; |
1424 | 1426 | ||
1425 | 1427 | ||
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 483f919e0d2e..91b5f5724cba 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -214,9 +214,8 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, | |||
214 | } | 214 | } |
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | void pxa2xx_configure_sockets(struct device *dev) | 217 | void pxa2xx_configure_sockets(struct device *dev, struct pcmcia_low_level *ops) |
218 | { | 218 | { |
219 | struct pcmcia_low_level *ops = dev->platform_data; | ||
220 | /* | 219 | /* |
221 | * We have at least one socket, so set MECR:CIT | 220 | * We have at least one socket, so set MECR:CIT |
222 | * (Card Is There) | 221 | * (Card Is There) |
@@ -322,7 +321,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) | |||
322 | goto err1; | 321 | goto err1; |
323 | } | 322 | } |
324 | 323 | ||
325 | pxa2xx_configure_sockets(&dev->dev); | 324 | pxa2xx_configure_sockets(&dev->dev, ops); |
326 | dev_set_drvdata(&dev->dev, sinfo); | 325 | dev_set_drvdata(&dev->dev, sinfo); |
327 | 326 | ||
328 | return 0; | 327 | return 0; |
@@ -348,7 +347,9 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev) | |||
348 | 347 | ||
349 | static int pxa2xx_drv_pcmcia_resume(struct device *dev) | 348 | static int pxa2xx_drv_pcmcia_resume(struct device *dev) |
350 | { | 349 | { |
351 | pxa2xx_configure_sockets(dev); | 350 | struct pcmcia_low_level *ops = (struct pcmcia_low_level *)dev->platform_data; |
351 | |||
352 | pxa2xx_configure_sockets(dev, ops); | ||
352 | return 0; | 353 | return 0; |
353 | } | 354 | } |
354 | 355 | ||
diff --git a/drivers/pcmcia/pxa2xx_base.h b/drivers/pcmcia/pxa2xx_base.h index b609b45469ed..e58c7a415418 100644 --- a/drivers/pcmcia/pxa2xx_base.h +++ b/drivers/pcmcia/pxa2xx_base.h | |||
@@ -1,4 +1,4 @@ | |||
1 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); | 1 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); |
2 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); | 2 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); |
3 | void pxa2xx_configure_sockets(struct device *dev); | 3 | void pxa2xx_configure_sockets(struct device *dev, struct pcmcia_low_level *ops); |
4 | 4 | ||
diff --git a/drivers/pcmcia/sa1111_badge4.c b/drivers/pcmcia/sa1111_badge4.c index 12f0dd091477..2f490930430d 100644 --- a/drivers/pcmcia/sa1111_badge4.c +++ b/drivers/pcmcia/sa1111_badge4.c | |||
@@ -134,20 +134,14 @@ static struct pcmcia_low_level badge4_pcmcia_ops = { | |||
134 | 134 | ||
135 | int pcmcia_badge4_init(struct sa1111_dev *dev) | 135 | int pcmcia_badge4_init(struct sa1111_dev *dev) |
136 | { | 136 | { |
137 | int ret = -ENODEV; | 137 | printk(KERN_INFO |
138 | 138 | "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", | |
139 | if (machine_is_badge4()) { | 139 | __func__, |
140 | printk(KERN_INFO | 140 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); |
141 | "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", | 141 | |
142 | __func__, | 142 | sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); |
143 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); | 143 | return sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, |
144 | 144 | sa11xx_drv_pcmcia_add_one); | |
145 | sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); | ||
146 | ret = sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, | ||
147 | sa11xx_drv_pcmcia_add_one); | ||
148 | } | ||
149 | |||
150 | return ret; | ||
151 | } | 145 | } |
152 | 146 | ||
153 | static int __init pcmv_setup(char *s) | 147 | static int __init pcmv_setup(char *s) |
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c index a1531feb8460..3d95dffcff7a 100644 --- a/drivers/pcmcia/sa1111_generic.c +++ b/drivers/pcmcia/sa1111_generic.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <mach/hardware.h> | 19 | #include <mach/hardware.h> |
20 | #include <asm/hardware/sa1111.h> | 20 | #include <asm/hardware/sa1111.h> |
21 | #include <asm/mach-types.h> | ||
21 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
22 | 23 | ||
23 | #include "sa1111_generic.h" | 24 | #include "sa1111_generic.h" |
@@ -203,19 +204,30 @@ static int pcmcia_probe(struct sa1111_dev *dev) | |||
203 | sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR); | 204 | sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR); |
204 | sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR); | 205 | sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR); |
205 | 206 | ||
207 | ret = -ENODEV; | ||
206 | #ifdef CONFIG_SA1100_BADGE4 | 208 | #ifdef CONFIG_SA1100_BADGE4 |
207 | pcmcia_badge4_init(dev); | 209 | if (machine_is_badge4()) |
210 | ret = pcmcia_badge4_init(dev); | ||
208 | #endif | 211 | #endif |
209 | #ifdef CONFIG_SA1100_JORNADA720 | 212 | #ifdef CONFIG_SA1100_JORNADA720 |
210 | pcmcia_jornada720_init(dev); | 213 | if (machine_is_jornada720()) |
214 | ret = pcmcia_jornada720_init(dev); | ||
211 | #endif | 215 | #endif |
212 | #ifdef CONFIG_ARCH_LUBBOCK | 216 | #ifdef CONFIG_ARCH_LUBBOCK |
213 | pcmcia_lubbock_init(dev); | 217 | if (machine_is_lubbock()) |
218 | ret = pcmcia_lubbock_init(dev); | ||
214 | #endif | 219 | #endif |
215 | #ifdef CONFIG_ASSABET_NEPONSET | 220 | #ifdef CONFIG_ASSABET_NEPONSET |
216 | pcmcia_neponset_init(dev); | 221 | if (machine_is_assabet()) |
222 | ret = pcmcia_neponset_init(dev); | ||
217 | #endif | 223 | #endif |
218 | return 0; | 224 | |
225 | if (ret) { | ||
226 | release_mem_region(dev->res.start, 512); | ||
227 | sa1111_disable_device(dev); | ||
228 | } | ||
229 | |||
230 | return ret; | ||
219 | } | 231 | } |
220 | 232 | ||
221 | static int pcmcia_remove(struct sa1111_dev *dev) | 233 | static int pcmcia_remove(struct sa1111_dev *dev) |
diff --git a/drivers/pcmcia/sa1111_jornada720.c b/drivers/pcmcia/sa1111_jornada720.c index c2c30580c83f..480a3ede27c8 100644 --- a/drivers/pcmcia/sa1111_jornada720.c +++ b/drivers/pcmcia/sa1111_jornada720.c | |||
@@ -94,22 +94,17 @@ static struct pcmcia_low_level jornada720_pcmcia_ops = { | |||
94 | 94 | ||
95 | int pcmcia_jornada720_init(struct sa1111_dev *sadev) | 95 | int pcmcia_jornada720_init(struct sa1111_dev *sadev) |
96 | { | 96 | { |
97 | int ret = -ENODEV; | 97 | unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; |
98 | 98 | ||
99 | if (machine_is_jornada720()) { | 99 | /* Fixme: why messing around with SA11x0's GPIO1? */ |
100 | unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; | 100 | GRER |= 0x00000002; |
101 | 101 | ||
102 | GRER |= 0x00000002; | 102 | /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ |
103 | sa1111_set_io_dir(sadev, pin, 0, 0); | ||
104 | sa1111_set_io(sadev, pin, 0); | ||
105 | sa1111_set_sleep_io(sadev, pin, 0); | ||
103 | 106 | ||
104 | /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ | 107 | sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); |
105 | sa1111_set_io_dir(sadev, pin, 0, 0); | 108 | return sa1111_pcmcia_add(sadev, &jornada720_pcmcia_ops, |
106 | sa1111_set_io(sadev, pin, 0); | 109 | sa11xx_drv_pcmcia_add_one); |
107 | sa1111_set_sleep_io(sadev, pin, 0); | ||
108 | |||
109 | sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); | ||
110 | ret = sa1111_pcmcia_add(sadev, &jornada720_pcmcia_ops, | ||
111 | sa11xx_drv_pcmcia_add_one); | ||
112 | } | ||
113 | |||
114 | return ret; | ||
115 | } | 110 | } |
diff --git a/drivers/pcmcia/sa1111_lubbock.c b/drivers/pcmcia/sa1111_lubbock.c index c5caf5790451..e741f499c875 100644 --- a/drivers/pcmcia/sa1111_lubbock.c +++ b/drivers/pcmcia/sa1111_lubbock.c | |||
@@ -210,27 +210,21 @@ static struct pcmcia_low_level lubbock_pcmcia_ops = { | |||
210 | 210 | ||
211 | int pcmcia_lubbock_init(struct sa1111_dev *sadev) | 211 | int pcmcia_lubbock_init(struct sa1111_dev *sadev) |
212 | { | 212 | { |
213 | int ret = -ENODEV; | 213 | /* |
214 | 214 | * Set GPIO_A<3:0> to be outputs for the MAX1600, | |
215 | if (machine_is_lubbock()) { | 215 | * and switch to standby mode. |
216 | /* | 216 | */ |
217 | * Set GPIO_A<3:0> to be outputs for the MAX1600, | 217 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); |
218 | * and switch to standby mode. | 218 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
219 | */ | 219 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
220 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | ||
221 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | ||
222 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | ||
223 | |||
224 | /* Set CF Socket 1 power to standby mode. */ | ||
225 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); | ||
226 | 220 | ||
227 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); | 221 | /* Set CF Socket 1 power to standby mode. */ |
228 | pxa2xx_configure_sockets(&sadev->dev); | 222 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); |
229 | ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, | ||
230 | pxa2xx_drv_pcmcia_add_one); | ||
231 | } | ||
232 | 223 | ||
233 | return ret; | 224 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); |
225 | pxa2xx_configure_sockets(&sadev->dev, &lubbock_pcmcia_ops); | ||
226 | return sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, | ||
227 | pxa2xx_drv_pcmcia_add_one); | ||
234 | } | 228 | } |
235 | 229 | ||
236 | MODULE_LICENSE("GPL"); | 230 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/pcmcia/sa1111_neponset.c b/drivers/pcmcia/sa1111_neponset.c index 1d78739c4c07..019c395eb4bf 100644 --- a/drivers/pcmcia/sa1111_neponset.c +++ b/drivers/pcmcia/sa1111_neponset.c | |||
@@ -110,20 +110,14 @@ static struct pcmcia_low_level neponset_pcmcia_ops = { | |||
110 | 110 | ||
111 | int pcmcia_neponset_init(struct sa1111_dev *sadev) | 111 | int pcmcia_neponset_init(struct sa1111_dev *sadev) |
112 | { | 112 | { |
113 | int ret = -ENODEV; | 113 | /* |
114 | 114 | * Set GPIO_A<3:0> to be outputs for the MAX1600, | |
115 | if (machine_is_assabet()) { | 115 | * and switch to standby mode. |
116 | /* | 116 | */ |
117 | * Set GPIO_A<3:0> to be outputs for the MAX1600, | 117 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); |
118 | * and switch to standby mode. | 118 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
119 | */ | 119 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
120 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | 120 | sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); |
121 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | 121 | return sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, |
122 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | 122 | sa11xx_drv_pcmcia_add_one); |
123 | sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); | ||
124 | ret = sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, | ||
125 | sa11xx_drv_pcmcia_add_one); | ||
126 | } | ||
127 | |||
128 | return ret; | ||
129 | } | 123 | } |
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index 9f6ec87b9f9e..48140ac73ed6 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c | |||
@@ -144,19 +144,19 @@ static int | |||
144 | sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf) | 144 | sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf) |
145 | { | 145 | { |
146 | struct soc_pcmcia_timing timing; | 146 | struct soc_pcmcia_timing timing; |
147 | unsigned int clock = clk_get_rate(skt->clk); | 147 | unsigned int clock = clk_get_rate(skt->clk) / 1000; |
148 | unsigned long mecr = MECR; | 148 | unsigned long mecr = MECR; |
149 | char *p = buf; | 149 | char *p = buf; |
150 | 150 | ||
151 | soc_common_pcmcia_get_timing(skt, &timing); | 151 | soc_common_pcmcia_get_timing(skt, &timing); |
152 | 152 | ||
153 | p+=sprintf(p, "I/O : %u (%u)\n", timing.io, | 153 | p+=sprintf(p, "I/O : %uns (%uns)\n", timing.io, |
154 | sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr))); | 154 | sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr))); |
155 | 155 | ||
156 | p+=sprintf(p, "attribute: %u (%u)\n", timing.attr, | 156 | p+=sprintf(p, "attribute: %uns (%uns)\n", timing.attr, |
157 | sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr))); | 157 | sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr))); |
158 | 158 | ||
159 | p+=sprintf(p, "common : %u (%u)\n", timing.mem, | 159 | p+=sprintf(p, "common : %uns (%uns)\n", timing.mem, |
160 | sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr))); | 160 | sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr))); |
161 | 161 | ||
162 | return p - buf; | 162 | return p - buf; |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index eed5e9c05353..d5ca760c4eb2 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
@@ -235,7 +235,7 @@ static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt) | |||
235 | stat |= skt->cs_state.Vcc ? SS_POWERON : 0; | 235 | stat |= skt->cs_state.Vcc ? SS_POWERON : 0; |
236 | 236 | ||
237 | if (skt->cs_state.flags & SS_IOCARD) | 237 | if (skt->cs_state.flags & SS_IOCARD) |
238 | stat |= state.bvd1 ? SS_STSCHG : 0; | 238 | stat |= state.bvd1 ? 0 : SS_STSCHG; |
239 | else { | 239 | else { |
240 | if (state.bvd1 == 0) | 240 | if (state.bvd1 == 0) |
241 | stat |= SS_BATDEAD; | 241 | stat |= SS_BATDEAD; |
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index 5749a4eee746..0fe8fad25e4d 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c | |||
@@ -1539,12 +1539,11 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq) | |||
1539 | offset += range->npins; | 1539 | offset += range->npins; |
1540 | } | 1540 | } |
1541 | 1541 | ||
1542 | /* Mask and clear all interrupts */ | 1542 | /* Clear all interrupts */ |
1543 | chv_writel(0, pctrl->regs + CHV_INTMASK); | ||
1544 | chv_writel(0xffff, pctrl->regs + CHV_INTSTAT); | 1543 | chv_writel(0xffff, pctrl->regs + CHV_INTSTAT); |
1545 | 1544 | ||
1546 | ret = gpiochip_irqchip_add(chip, &chv_gpio_irqchip, 0, | 1545 | ret = gpiochip_irqchip_add(chip, &chv_gpio_irqchip, 0, |
1547 | handle_simple_irq, IRQ_TYPE_NONE); | 1546 | handle_bad_irq, IRQ_TYPE_NONE); |
1548 | if (ret) { | 1547 | if (ret) { |
1549 | dev_err(pctrl->dev, "failed to add IRQ chip\n"); | 1548 | dev_err(pctrl->dev, "failed to add IRQ chip\n"); |
1550 | goto fail; | 1549 | goto fail; |
diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c index 7bad200bd67c..55375b1b3cc8 100644 --- a/drivers/pinctrl/pinctrl-pistachio.c +++ b/drivers/pinctrl/pinctrl-pistachio.c | |||
@@ -809,17 +809,17 @@ static const struct pistachio_pin_group pistachio_groups[] = { | |||
809 | PADS_FUNCTION_SELECT2, 12, 0x3), | 809 | PADS_FUNCTION_SELECT2, 12, 0x3), |
810 | MFIO_MUX_PIN_GROUP(83, MIPS_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG, | 810 | MFIO_MUX_PIN_GROUP(83, MIPS_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG, |
811 | PADS_FUNCTION_SELECT2, 14, 0x3), | 811 | PADS_FUNCTION_SELECT2, 14, 0x3), |
812 | MFIO_MUX_PIN_GROUP(84, SYS_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG, | 812 | MFIO_MUX_PIN_GROUP(84, AUDIO_PLL_LOCK, MIPS_TRACE_DATA, USB_DEBUG, |
813 | PADS_FUNCTION_SELECT2, 16, 0x3), | 813 | PADS_FUNCTION_SELECT2, 16, 0x3), |
814 | MFIO_MUX_PIN_GROUP(85, WIFI_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG, | 814 | MFIO_MUX_PIN_GROUP(85, RPU_V_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG, |
815 | PADS_FUNCTION_SELECT2, 18, 0x3), | 815 | PADS_FUNCTION_SELECT2, 18, 0x3), |
816 | MFIO_MUX_PIN_GROUP(86, BT_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG, | 816 | MFIO_MUX_PIN_GROUP(86, RPU_L_PLL_LOCK, MIPS_TRACE_DATA, SDHOST_DEBUG, |
817 | PADS_FUNCTION_SELECT2, 20, 0x3), | 817 | PADS_FUNCTION_SELECT2, 20, 0x3), |
818 | MFIO_MUX_PIN_GROUP(87, RPU_V_PLL_LOCK, DREQ2, SOCIF_DEBUG, | 818 | MFIO_MUX_PIN_GROUP(87, SYS_PLL_LOCK, DREQ2, SOCIF_DEBUG, |
819 | PADS_FUNCTION_SELECT2, 22, 0x3), | 819 | PADS_FUNCTION_SELECT2, 22, 0x3), |
820 | MFIO_MUX_PIN_GROUP(88, RPU_L_PLL_LOCK, DREQ3, SOCIF_DEBUG, | 820 | MFIO_MUX_PIN_GROUP(88, WIFI_PLL_LOCK, DREQ3, SOCIF_DEBUG, |
821 | PADS_FUNCTION_SELECT2, 24, 0x3), | 821 | PADS_FUNCTION_SELECT2, 24, 0x3), |
822 | MFIO_MUX_PIN_GROUP(89, AUDIO_PLL_LOCK, DREQ4, DREQ5, | 822 | MFIO_MUX_PIN_GROUP(89, BT_PLL_LOCK, DREQ4, DREQ5, |
823 | PADS_FUNCTION_SELECT2, 26, 0x3), | 823 | PADS_FUNCTION_SELECT2, 26, 0x3), |
824 | PIN_GROUP(TCK, "tck"), | 824 | PIN_GROUP(TCK, "tck"), |
825 | PIN_GROUP(TRSTN, "trstn"), | 825 | PIN_GROUP(TRSTN, "trstn"), |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c index ce483b03a263..f9d661e5c14a 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | |||
@@ -485,12 +485,12 @@ static const struct sunxi_desc_pin sun8i_a23_pins[] = { | |||
485 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8), | 485 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8), |
486 | SUNXI_FUNCTION(0x0, "gpio_in"), | 486 | SUNXI_FUNCTION(0x0, "gpio_in"), |
487 | SUNXI_FUNCTION(0x1, "gpio_out"), | 487 | SUNXI_FUNCTION(0x1, "gpio_out"), |
488 | SUNXI_FUNCTION(0x2, "uart2"), /* RTS */ | 488 | SUNXI_FUNCTION(0x2, "uart1"), /* RTS */ |
489 | SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 8)), /* PG_EINT8 */ | 489 | SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 8)), /* PG_EINT8 */ |
490 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9), | 490 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9), |
491 | SUNXI_FUNCTION(0x0, "gpio_in"), | 491 | SUNXI_FUNCTION(0x0, "gpio_in"), |
492 | SUNXI_FUNCTION(0x1, "gpio_out"), | 492 | SUNXI_FUNCTION(0x1, "gpio_out"), |
493 | SUNXI_FUNCTION(0x2, "uart2"), /* CTS */ | 493 | SUNXI_FUNCTION(0x2, "uart1"), /* CTS */ |
494 | SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 9)), /* PG_EINT9 */ | 494 | SUNXI_FUNCTION_IRQ_BANK(0x4, 2, 9)), /* PG_EINT9 */ |
495 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10), | 495 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10), |
496 | SUNXI_FUNCTION(0x0, "gpio_in"), | 496 | SUNXI_FUNCTION(0x0, "gpio_in"), |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c index 3040abe6f73a..3131cac2b76f 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | |||
@@ -407,12 +407,12 @@ static const struct sunxi_desc_pin sun8i_a33_pins[] = { | |||
407 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8), | 407 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8), |
408 | SUNXI_FUNCTION(0x0, "gpio_in"), | 408 | SUNXI_FUNCTION(0x0, "gpio_in"), |
409 | SUNXI_FUNCTION(0x1, "gpio_out"), | 409 | SUNXI_FUNCTION(0x1, "gpio_out"), |
410 | SUNXI_FUNCTION(0x2, "uart2"), /* RTS */ | 410 | SUNXI_FUNCTION(0x2, "uart1"), /* RTS */ |
411 | SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 8)), /* PG_EINT8 */ | 411 | SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 8)), /* PG_EINT8 */ |
412 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9), | 412 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9), |
413 | SUNXI_FUNCTION(0x0, "gpio_in"), | 413 | SUNXI_FUNCTION(0x0, "gpio_in"), |
414 | SUNXI_FUNCTION(0x1, "gpio_out"), | 414 | SUNXI_FUNCTION(0x1, "gpio_out"), |
415 | SUNXI_FUNCTION(0x2, "uart2"), /* CTS */ | 415 | SUNXI_FUNCTION(0x2, "uart1"), /* CTS */ |
416 | SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 9)), /* PG_EINT9 */ | 416 | SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 9)), /* PG_EINT9 */ |
417 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10), | 417 | SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10), |
418 | SUNXI_FUNCTION(0x0, "gpio_in"), | 418 | SUNXI_FUNCTION(0x0, "gpio_in"), |
diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c index 3fa17ac8df54..cebc296463ad 100644 --- a/drivers/rapidio/rio_cm.c +++ b/drivers/rapidio/rio_cm.c | |||
@@ -2247,17 +2247,30 @@ static int rio_cm_shutdown(struct notifier_block *nb, unsigned long code, | |||
2247 | { | 2247 | { |
2248 | struct rio_channel *ch; | 2248 | struct rio_channel *ch; |
2249 | unsigned int i; | 2249 | unsigned int i; |
2250 | LIST_HEAD(list); | ||
2250 | 2251 | ||
2251 | riocm_debug(EXIT, "."); | 2252 | riocm_debug(EXIT, "."); |
2252 | 2253 | ||
2254 | /* | ||
2255 | * If there are any channels left in connected state send | ||
2256 | * close notification to the connection partner. | ||
2257 | * First build a list of channels that require a closing | ||
2258 | * notification because function riocm_send_close() should | ||
2259 | * be called outside of spinlock protected code. | ||
2260 | */ | ||
2253 | spin_lock_bh(&idr_lock); | 2261 | spin_lock_bh(&idr_lock); |
2254 | idr_for_each_entry(&ch_idr, ch, i) { | 2262 | idr_for_each_entry(&ch_idr, ch, i) { |
2255 | riocm_debug(EXIT, "close ch %d", ch->id); | 2263 | if (ch->state == RIO_CM_CONNECTED) { |
2256 | if (ch->state == RIO_CM_CONNECTED) | 2264 | riocm_debug(EXIT, "close ch %d", ch->id); |
2257 | riocm_send_close(ch); | 2265 | idr_remove(&ch_idr, ch->id); |
2266 | list_add(&ch->ch_node, &list); | ||
2267 | } | ||
2258 | } | 2268 | } |
2259 | spin_unlock_bh(&idr_lock); | 2269 | spin_unlock_bh(&idr_lock); |
2260 | 2270 | ||
2271 | list_for_each_entry(ch, &list, ch_node) | ||
2272 | riocm_send_close(ch); | ||
2273 | |||
2261 | return NOTIFY_DONE; | 2274 | return NOTIFY_DONE; |
2262 | } | 2275 | } |
2263 | 2276 | ||
diff --git a/drivers/regulator/max14577-regulator.c b/drivers/regulator/max14577-regulator.c index b2daa6641417..c9ff26199711 100644 --- a/drivers/regulator/max14577-regulator.c +++ b/drivers/regulator/max14577-regulator.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * max14577.c - Regulator driver for the Maxim 14577/77836 | 2 | * max14577.c - Regulator driver for the Maxim 14577/77836 |
3 | * | 3 | * |
4 | * Copyright (C) 2013,2014 Samsung Electronics | 4 | * Copyright (C) 2013,2014 Samsung Electronics |
5 | * Krzysztof Kozlowski <k.kozlowski@samsung.com> | 5 | * Krzysztof Kozlowski <krzk@kernel.org> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -331,7 +331,7 @@ static void __exit max14577_regulator_exit(void) | |||
331 | } | 331 | } |
332 | module_exit(max14577_regulator_exit); | 332 | module_exit(max14577_regulator_exit); |
333 | 333 | ||
334 | MODULE_AUTHOR("Krzysztof Kozlowski <k.kozlowski@samsung.com>"); | 334 | MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>"); |
335 | MODULE_DESCRIPTION("Maxim 14577/77836 regulator driver"); | 335 | MODULE_DESCRIPTION("Maxim 14577/77836 regulator driver"); |
336 | MODULE_LICENSE("GPL"); | 336 | MODULE_LICENSE("GPL"); |
337 | MODULE_ALIAS("platform:max14577-regulator"); | 337 | MODULE_ALIAS("platform:max14577-regulator"); |
diff --git a/drivers/regulator/max77693-regulator.c b/drivers/regulator/max77693-regulator.c index de730fd3f8a5..cfbb9512e486 100644 --- a/drivers/regulator/max77693-regulator.c +++ b/drivers/regulator/max77693-regulator.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2013-2015 Samsung Electronics | 4 | * Copyright (C) 2013-2015 Samsung Electronics |
5 | * Jonghwa Lee <jonghwa3.lee@samsung.com> | 5 | * Jonghwa Lee <jonghwa3.lee@samsung.com> |
6 | * Krzysztof Kozlowski <k.kozlowski.k@gmail.com> | 6 | * Krzysztof Kozlowski <krzk@kernel.org> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
@@ -314,5 +314,5 @@ module_exit(max77693_pmic_cleanup); | |||
314 | 314 | ||
315 | MODULE_DESCRIPTION("MAXIM 77693/77843 regulator driver"); | 315 | MODULE_DESCRIPTION("MAXIM 77693/77843 regulator driver"); |
316 | MODULE_AUTHOR("Jonghwa Lee <jonghwa3.lee@samsung.com>"); | 316 | MODULE_AUTHOR("Jonghwa Lee <jonghwa3.lee@samsung.com>"); |
317 | MODULE_AUTHOR("Krzysztof Kozlowski <k.kozlowski.k@gmail.com>"); | 317 | MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>"); |
318 | MODULE_LICENSE("GPL"); | 318 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c index 5022fa8d10c6..8ed46a9a55c8 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c | |||
@@ -178,20 +178,21 @@ static const struct regulator_desc pma8084_hfsmps = { | |||
178 | static const struct regulator_desc pma8084_ftsmps = { | 178 | static const struct regulator_desc pma8084_ftsmps = { |
179 | .linear_ranges = (struct regulator_linear_range[]) { | 179 | .linear_ranges = (struct regulator_linear_range[]) { |
180 | REGULATOR_LINEAR_RANGE(350000, 0, 184, 5000), | 180 | REGULATOR_LINEAR_RANGE(350000, 0, 184, 5000), |
181 | REGULATOR_LINEAR_RANGE(700000, 185, 339, 10000), | 181 | REGULATOR_LINEAR_RANGE(1280000, 185, 261, 10000), |
182 | }, | 182 | }, |
183 | .n_linear_ranges = 2, | 183 | .n_linear_ranges = 2, |
184 | .n_voltages = 340, | 184 | .n_voltages = 262, |
185 | .ops = &rpm_smps_ldo_ops, | 185 | .ops = &rpm_smps_ldo_ops, |
186 | }; | 186 | }; |
187 | 187 | ||
188 | static const struct regulator_desc pma8084_pldo = { | 188 | static const struct regulator_desc pma8084_pldo = { |
189 | .linear_ranges = (struct regulator_linear_range[]) { | 189 | .linear_ranges = (struct regulator_linear_range[]) { |
190 | REGULATOR_LINEAR_RANGE(750000, 0, 30, 25000), | 190 | REGULATOR_LINEAR_RANGE( 750000, 0, 63, 12500), |
191 | REGULATOR_LINEAR_RANGE(1500000, 31, 99, 50000), | 191 | REGULATOR_LINEAR_RANGE(1550000, 64, 126, 25000), |
192 | REGULATOR_LINEAR_RANGE(3100000, 127, 163, 50000), | ||
192 | }, | 193 | }, |
193 | .n_linear_ranges = 2, | 194 | .n_linear_ranges = 3, |
194 | .n_voltages = 100, | 195 | .n_voltages = 164, |
195 | .ops = &rpm_smps_ldo_ops, | 196 | .ops = &rpm_smps_ldo_ops, |
196 | }; | 197 | }; |
197 | 198 | ||
@@ -221,29 +222,30 @@ static const struct regulator_desc pm8x41_hfsmps = { | |||
221 | static const struct regulator_desc pm8841_ftsmps = { | 222 | static const struct regulator_desc pm8841_ftsmps = { |
222 | .linear_ranges = (struct regulator_linear_range[]) { | 223 | .linear_ranges = (struct regulator_linear_range[]) { |
223 | REGULATOR_LINEAR_RANGE(350000, 0, 184, 5000), | 224 | REGULATOR_LINEAR_RANGE(350000, 0, 184, 5000), |
224 | REGULATOR_LINEAR_RANGE(700000, 185, 339, 10000), | 225 | REGULATOR_LINEAR_RANGE(1280000, 185, 261, 10000), |
225 | }, | 226 | }, |
226 | .n_linear_ranges = 2, | 227 | .n_linear_ranges = 2, |
227 | .n_voltages = 340, | 228 | .n_voltages = 262, |
228 | .ops = &rpm_smps_ldo_ops, | 229 | .ops = &rpm_smps_ldo_ops, |
229 | }; | 230 | }; |
230 | 231 | ||
231 | static const struct regulator_desc pm8941_boost = { | 232 | static const struct regulator_desc pm8941_boost = { |
232 | .linear_ranges = (struct regulator_linear_range[]) { | 233 | .linear_ranges = (struct regulator_linear_range[]) { |
233 | REGULATOR_LINEAR_RANGE(4000000, 0, 15, 100000), | 234 | REGULATOR_LINEAR_RANGE(4000000, 0, 30, 50000), |
234 | }, | 235 | }, |
235 | .n_linear_ranges = 1, | 236 | .n_linear_ranges = 1, |
236 | .n_voltages = 16, | 237 | .n_voltages = 31, |
237 | .ops = &rpm_smps_ldo_ops, | 238 | .ops = &rpm_smps_ldo_ops, |
238 | }; | 239 | }; |
239 | 240 | ||
240 | static const struct regulator_desc pm8941_pldo = { | 241 | static const struct regulator_desc pm8941_pldo = { |
241 | .linear_ranges = (struct regulator_linear_range[]) { | 242 | .linear_ranges = (struct regulator_linear_range[]) { |
242 | REGULATOR_LINEAR_RANGE( 750000, 0, 30, 25000), | 243 | REGULATOR_LINEAR_RANGE( 750000, 0, 63, 12500), |
243 | REGULATOR_LINEAR_RANGE(1500000, 31, 99, 50000), | 244 | REGULATOR_LINEAR_RANGE(1550000, 64, 126, 25000), |
245 | REGULATOR_LINEAR_RANGE(3100000, 127, 163, 50000), | ||
244 | }, | 246 | }, |
245 | .n_linear_ranges = 2, | 247 | .n_linear_ranges = 3, |
246 | .n_voltages = 100, | 248 | .n_voltages = 164, |
247 | .ops = &rpm_smps_ldo_ops, | 249 | .ops = &rpm_smps_ldo_ops, |
248 | }; | 250 | }; |
249 | 251 | ||
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 83458f7a2824..6dc96c8dfe75 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c | |||
@@ -361,8 +361,9 @@ static const char * const snstext[] = { | |||
361 | 361 | ||
362 | /* Get sense key string or NULL if not available */ | 362 | /* Get sense key string or NULL if not available */ |
363 | const char * | 363 | const char * |
364 | scsi_sense_key_string(unsigned char key) { | 364 | scsi_sense_key_string(unsigned char key) |
365 | if (key <= 0xE) | 365 | { |
366 | if (key < ARRAY_SIZE(snstext)) | ||
366 | return snstext[key]; | 367 | return snstext[key]; |
367 | return NULL; | 368 | return NULL; |
368 | } | 369 | } |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index eaccd651ccda..246456925335 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -246,6 +246,10 @@ static struct { | |||
246 | {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | 246 | {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
247 | {"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | 247 | {"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
248 | {"DELL", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | 248 | {"DELL", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, |
249 | {"STK", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
250 | {"NETAPP", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
251 | {"LSI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
252 | {"ENGENIO", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, | ||
249 | {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, | 253 | {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36}, |
250 | {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, | 254 | {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN}, |
251 | {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ | 255 | {"SONY", "TSL", NULL, BLIST_FORCELUN}, /* DDS3 & DDS4 autoloaders */ |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 3f0ff072184b..60b651bfaa01 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -341,22 +341,6 @@ static int do_sas_phy_delete(struct device *dev, void *data) | |||
341 | } | 341 | } |
342 | 342 | ||
343 | /** | 343 | /** |
344 | * is_sas_attached - check if device is SAS attached | ||
345 | * @sdev: scsi device to check | ||
346 | * | ||
347 | * returns true if the device is SAS attached | ||
348 | */ | ||
349 | int is_sas_attached(struct scsi_device *sdev) | ||
350 | { | ||
351 | struct Scsi_Host *shost = sdev->host; | ||
352 | |||
353 | return shost->transportt->host_attrs.ac.class == | ||
354 | &sas_host_class.class; | ||
355 | } | ||
356 | EXPORT_SYMBOL(is_sas_attached); | ||
357 | |||
358 | |||
359 | /** | ||
360 | * sas_remove_children - tear down a devices SAS data structures | 344 | * sas_remove_children - tear down a devices SAS data structures |
361 | * @dev: device belonging to the sas object | 345 | * @dev: device belonging to the sas object |
362 | * | 346 | * |
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index 0e8601aa877a..8c9a35c91705 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c | |||
@@ -587,7 +587,7 @@ static void ses_match_to_enclosure(struct enclosure_device *edev, | |||
587 | 587 | ||
588 | ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0); | 588 | ses_enclosure_data_process(edev, to_scsi_device(edev->edev.parent), 0); |
589 | 589 | ||
590 | if (is_sas_attached(sdev)) | 590 | if (scsi_is_sas_rphy(&sdev->sdev_gendev)) |
591 | efd.addr = sas_get_address(sdev); | 591 | efd.addr = sas_get_address(sdev); |
592 | 592 | ||
593 | if (efd.addr) { | 593 | if (efd.addr) { |
diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index 823cbc92d1e7..7a37090dabbe 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c | |||
@@ -720,8 +720,6 @@ static int img_spfi_remove(struct platform_device *pdev) | |||
720 | clk_disable_unprepare(spfi->sys_clk); | 720 | clk_disable_unprepare(spfi->sys_clk); |
721 | } | 721 | } |
722 | 722 | ||
723 | spi_master_put(master); | ||
724 | |||
725 | return 0; | 723 | return 0; |
726 | } | 724 | } |
727 | 725 | ||
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c index 0be89e052428..899d7a8f0889 100644 --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c | |||
@@ -685,7 +685,6 @@ static int mtk_spi_remove(struct platform_device *pdev) | |||
685 | pm_runtime_disable(&pdev->dev); | 685 | pm_runtime_disable(&pdev->dev); |
686 | 686 | ||
687 | mtk_spi_reset(mdata); | 687 | mtk_spi_reset(mdata); |
688 | spi_master_put(master); | ||
689 | 688 | ||
690 | return 0; | 689 | return 0; |
691 | } | 690 | } |
diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index f3df522db93b..58d2d48e16a5 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c | |||
@@ -214,6 +214,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev, | |||
214 | return PTR_ERR(ssp->clk); | 214 | return PTR_ERR(ssp->clk); |
215 | 215 | ||
216 | memset(&pi, 0, sizeof(pi)); | 216 | memset(&pi, 0, sizeof(pi)); |
217 | pi.fwnode = dev->dev.fwnode; | ||
217 | pi.parent = &dev->dev; | 218 | pi.parent = &dev->dev; |
218 | pi.name = "pxa2xx-spi"; | 219 | pi.name = "pxa2xx-spi"; |
219 | pi.id = ssp->port_id; | 220 | pi.id = ssp->port_id; |
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index c338ef1136f6..7f1555621f8e 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c | |||
@@ -1030,7 +1030,6 @@ static int spi_qup_remove(struct platform_device *pdev) | |||
1030 | 1030 | ||
1031 | pm_runtime_put_noidle(&pdev->dev); | 1031 | pm_runtime_put_noidle(&pdev->dev); |
1032 | pm_runtime_disable(&pdev->dev); | 1032 | pm_runtime_disable(&pdev->dev); |
1033 | spi_master_put(master); | ||
1034 | 1033 | ||
1035 | return 0; | 1034 | return 0; |
1036 | } | 1035 | } |
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 0f83ad1d5a58..1de3a772eb7d 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c | |||
@@ -262,6 +262,9 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p, | |||
262 | 262 | ||
263 | for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) { | 263 | for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) { |
264 | brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div); | 264 | brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div); |
265 | /* SCR_BRDV_DIV_1 is valid only if BRPS is x 1/1 or x 1/2 */ | ||
266 | if (sh_msiof_spi_div_table[k].div == 1 && brps > 2) | ||
267 | continue; | ||
265 | if (brps <= 32) /* max of brdv is 32 */ | 268 | if (brps <= 32) /* max of brdv is 32 */ |
266 | break; | 269 | break; |
267 | } | 270 | } |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 51ad42fad567..200ca228d885 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -960,7 +960,7 @@ static int spi_transfer_one_message(struct spi_master *master, | |||
960 | struct spi_transfer *xfer; | 960 | struct spi_transfer *xfer; |
961 | bool keep_cs = false; | 961 | bool keep_cs = false; |
962 | int ret = 0; | 962 | int ret = 0; |
963 | unsigned long ms = 1; | 963 | unsigned long long ms = 1; |
964 | struct spi_statistics *statm = &master->statistics; | 964 | struct spi_statistics *statm = &master->statistics; |
965 | struct spi_statistics *stats = &msg->spi->statistics; | 965 | struct spi_statistics *stats = &msg->spi->statistics; |
966 | 966 | ||
@@ -991,9 +991,13 @@ static int spi_transfer_one_message(struct spi_master *master, | |||
991 | 991 | ||
992 | if (ret > 0) { | 992 | if (ret > 0) { |
993 | ret = 0; | 993 | ret = 0; |
994 | ms = xfer->len * 8 * 1000 / xfer->speed_hz; | 994 | ms = 8LL * 1000LL * xfer->len; |
995 | do_div(ms, xfer->speed_hz); | ||
995 | ms += ms + 100; /* some tolerance */ | 996 | ms += ms + 100; /* some tolerance */ |
996 | 997 | ||
998 | if (ms > UINT_MAX) | ||
999 | ms = UINT_MAX; | ||
1000 | |||
997 | ms = wait_for_completion_timeout(&master->xfer_completion, | 1001 | ms = wait_for_completion_timeout(&master->xfer_completion, |
998 | msecs_to_jiffies(ms)); | 1002 | msecs_to_jiffies(ms)); |
999 | } | 1003 | } |
@@ -1159,6 +1163,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread) | |||
1159 | if (ret < 0) { | 1163 | if (ret < 0) { |
1160 | dev_err(&master->dev, "Failed to power device: %d\n", | 1164 | dev_err(&master->dev, "Failed to power device: %d\n", |
1161 | ret); | 1165 | ret); |
1166 | mutex_unlock(&master->io_mutex); | ||
1162 | return; | 1167 | return; |
1163 | } | 1168 | } |
1164 | } | 1169 | } |
@@ -1174,6 +1179,7 @@ static void __spi_pump_messages(struct spi_master *master, bool in_kthread) | |||
1174 | 1179 | ||
1175 | if (master->auto_runtime_pm) | 1180 | if (master->auto_runtime_pm) |
1176 | pm_runtime_put(master->dev.parent); | 1181 | pm_runtime_put(master->dev.parent); |
1182 | mutex_unlock(&master->io_mutex); | ||
1177 | return; | 1183 | return; |
1178 | } | 1184 | } |
1179 | } | 1185 | } |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 71a339271fa5..5f817923f374 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -504,6 +504,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
504 | if (IS_ERR(priv->zone)) { | 504 | if (IS_ERR(priv->zone)) { |
505 | dev_err(dev, "can't register thermal zone\n"); | 505 | dev_err(dev, "can't register thermal zone\n"); |
506 | ret = PTR_ERR(priv->zone); | 506 | ret = PTR_ERR(priv->zone); |
507 | priv->zone = NULL; | ||
507 | goto error_unregister; | 508 | goto error_unregister; |
508 | } | 509 | } |
509 | 510 | ||
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index dfec5a176315..b93356834bb5 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
@@ -949,6 +949,15 @@ static int isr_setup_status_phase(struct ci_hdrc *ci) | |||
949 | int retval; | 949 | int retval; |
950 | struct ci_hw_ep *hwep; | 950 | struct ci_hw_ep *hwep; |
951 | 951 | ||
952 | /* | ||
953 | * Unexpected USB controller behavior, caused by bad signal integrity | ||
954 | * or ground reference problems, can lead to isr_setup_status_phase | ||
955 | * being called with ci->status equal to NULL. | ||
956 | * If this situation occurs, you should review your USB hardware design. | ||
957 | */ | ||
958 | if (WARN_ON_ONCE(!ci->status)) | ||
959 | return -EPIPE; | ||
960 | |||
952 | hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; | 961 | hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; |
953 | ci->status->context = ci; | 962 | ci->status->context = ci; |
954 | ci->status->complete = isr_setup_status_complete; | 963 | ci->status->complete = isr_setup_status_complete; |
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 15ce4ab11688..a2d90aca779f 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -240,8 +240,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
240 | memcpy(&endpoint->desc, d, n); | 240 | memcpy(&endpoint->desc, d, n); |
241 | INIT_LIST_HEAD(&endpoint->urb_list); | 241 | INIT_LIST_HEAD(&endpoint->urb_list); |
242 | 242 | ||
243 | /* Fix up bInterval values outside the legal range. Use 32 ms if no | 243 | /* |
244 | * proper value can be guessed. */ | 244 | * Fix up bInterval values outside the legal range. |
245 | * Use 10 or 8 ms if no proper value can be guessed. | ||
246 | */ | ||
245 | i = 0; /* i = min, j = max, n = default */ | 247 | i = 0; /* i = min, j = max, n = default */ |
246 | j = 255; | 248 | j = 255; |
247 | if (usb_endpoint_xfer_int(d)) { | 249 | if (usb_endpoint_xfer_int(d)) { |
@@ -250,13 +252,15 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
250 | case USB_SPEED_SUPER_PLUS: | 252 | case USB_SPEED_SUPER_PLUS: |
251 | case USB_SPEED_SUPER: | 253 | case USB_SPEED_SUPER: |
252 | case USB_SPEED_HIGH: | 254 | case USB_SPEED_HIGH: |
253 | /* Many device manufacturers are using full-speed | 255 | /* |
256 | * Many device manufacturers are using full-speed | ||
254 | * bInterval values in high-speed interrupt endpoint | 257 | * bInterval values in high-speed interrupt endpoint |
255 | * descriptors. Try to fix those and fall back to a | 258 | * descriptors. Try to fix those and fall back to an |
256 | * 32 ms default value otherwise. */ | 259 | * 8-ms default value otherwise. |
260 | */ | ||
257 | n = fls(d->bInterval*8); | 261 | n = fls(d->bInterval*8); |
258 | if (n == 0) | 262 | if (n == 0) |
259 | n = 9; /* 32 ms = 2^(9-1) uframes */ | 263 | n = 7; /* 8 ms = 2^(7-1) uframes */ |
260 | j = 16; | 264 | j = 16; |
261 | 265 | ||
262 | /* | 266 | /* |
@@ -271,10 +275,12 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
271 | } | 275 | } |
272 | break; | 276 | break; |
273 | default: /* USB_SPEED_FULL or _LOW */ | 277 | default: /* USB_SPEED_FULL or _LOW */ |
274 | /* For low-speed, 10 ms is the official minimum. | 278 | /* |
279 | * For low-speed, 10 ms is the official minimum. | ||
275 | * But some "overclocked" devices might want faster | 280 | * But some "overclocked" devices might want faster |
276 | * polling so we'll allow it. */ | 281 | * polling so we'll allow it. |
277 | n = 32; | 282 | */ |
283 | n = 10; | ||
278 | break; | 284 | break; |
279 | } | 285 | } |
280 | } else if (usb_endpoint_xfer_isoc(d)) { | 286 | } else if (usb_endpoint_xfer_isoc(d)) { |
@@ -282,10 +288,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
282 | j = 16; | 288 | j = 16; |
283 | switch (to_usb_device(ddev)->speed) { | 289 | switch (to_usb_device(ddev)->speed) { |
284 | case USB_SPEED_HIGH: | 290 | case USB_SPEED_HIGH: |
285 | n = 9; /* 32 ms = 2^(9-1) uframes */ | 291 | n = 7; /* 8 ms = 2^(7-1) uframes */ |
286 | break; | 292 | break; |
287 | default: /* USB_SPEED_FULL */ | 293 | default: /* USB_SPEED_FULL */ |
288 | n = 6; /* 32 ms = 2^(6-1) frames */ | 294 | n = 4; /* 8 ms = 2^(4-1) frames */ |
289 | break; | 295 | break; |
290 | } | 296 | } |
291 | } | 297 | } |
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 0a32430f4c41..6df0f5dad9a4 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -249,7 +249,9 @@ static int dwc3_pci_runtime_resume(struct device *dev) | |||
249 | 249 | ||
250 | return pm_runtime_get(&dwc3->dev); | 250 | return pm_runtime_get(&dwc3->dev); |
251 | } | 251 | } |
252 | #endif /* CONFIG_PM */ | ||
252 | 253 | ||
254 | #ifdef CONFIG_PM_SLEEP | ||
253 | static int dwc3_pci_pm_dummy(struct device *dev) | 255 | static int dwc3_pci_pm_dummy(struct device *dev) |
254 | { | 256 | { |
255 | /* | 257 | /* |
@@ -262,7 +264,7 @@ static int dwc3_pci_pm_dummy(struct device *dev) | |||
262 | */ | 264 | */ |
263 | return 0; | 265 | return 0; |
264 | } | 266 | } |
265 | #endif /* CONFIG_PM */ | 267 | #endif /* CONFIG_PM_SLEEP */ |
266 | 268 | ||
267 | static struct dev_pm_ops dwc3_pci_dev_pm_ops = { | 269 | static struct dev_pm_ops dwc3_pci_dev_pm_ops = { |
268 | SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_pm_dummy, dwc3_pci_pm_dummy) | 270 | SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_pm_dummy, dwc3_pci_pm_dummy) |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 7a8d3d822b54..122e64df2f4d 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -884,9 +884,12 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep) | |||
884 | return DWC3_TRB_NUM - 1; | 884 | return DWC3_TRB_NUM - 1; |
885 | } | 885 | } |
886 | 886 | ||
887 | trbs_left = dep->trb_dequeue - dep->trb_enqueue - 1; | 887 | trbs_left = dep->trb_dequeue - dep->trb_enqueue; |
888 | trbs_left &= (DWC3_TRB_NUM - 1); | 888 | trbs_left &= (DWC3_TRB_NUM - 1); |
889 | 889 | ||
890 | if (dep->trb_dequeue < dep->trb_enqueue) | ||
891 | trbs_left--; | ||
892 | |||
890 | return trbs_left; | 893 | return trbs_left; |
891 | } | 894 | } |
892 | 895 | ||
diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c index 8741fd740174..007ec6e4a5d4 100644 --- a/drivers/usb/gadget/function/f_eem.c +++ b/drivers/usb/gadget/function/f_eem.c | |||
@@ -342,7 +342,7 @@ static struct sk_buff *eem_wrap(struct gether *port, struct sk_buff *skb) | |||
342 | struct sk_buff *skb2 = NULL; | 342 | struct sk_buff *skb2 = NULL; |
343 | struct usb_ep *in = port->in_ep; | 343 | struct usb_ep *in = port->in_ep; |
344 | int headroom, tailroom, padlen = 0; | 344 | int headroom, tailroom, padlen = 0; |
345 | u16 len = skb->len; | 345 | u16 len; |
346 | 346 | ||
347 | if (!skb) | 347 | if (!skb) |
348 | return NULL; | 348 | return NULL; |
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c index 93a3bec81df7..fb8fc34827ab 100644 --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c | |||
@@ -106,6 +106,7 @@ | |||
106 | 106 | ||
107 | /* DRD_CON */ | 107 | /* DRD_CON */ |
108 | #define DRD_CON_PERI_CON BIT(24) | 108 | #define DRD_CON_PERI_CON BIT(24) |
109 | #define DRD_CON_VBOUT BIT(0) | ||
109 | 110 | ||
110 | /* USB_INT_ENA_1 and USB_INT_STA_1 */ | 111 | /* USB_INT_ENA_1 and USB_INT_STA_1 */ |
111 | #define USB_INT_1_B3_PLLWKUP BIT(31) | 112 | #define USB_INT_1_B3_PLLWKUP BIT(31) |
@@ -363,6 +364,7 @@ static void usb3_init_epc_registers(struct renesas_usb3 *usb3) | |||
363 | { | 364 | { |
364 | /* FIXME: How to change host / peripheral mode as well? */ | 365 | /* FIXME: How to change host / peripheral mode as well? */ |
365 | usb3_set_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON); | 366 | usb3_set_bit(usb3, DRD_CON_PERI_CON, USB3_DRD_CON); |
367 | usb3_clear_bit(usb3, DRD_CON_VBOUT, USB3_DRD_CON); | ||
366 | 368 | ||
367 | usb3_write(usb3, ~0, USB3_USB_INT_STA_1); | 369 | usb3_write(usb3, ~0, USB3_USB_INT_STA_1); |
368 | usb3_enable_irq_1(usb3, USB_INT_1_VBUS_CNG); | 370 | usb3_enable_irq_1(usb3, USB_INT_1_VBUS_CNG); |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index fd9fd12e4861..797137e26549 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -850,6 +850,10 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg) | |||
850 | spin_lock_irqsave(&xhci->lock, flags); | 850 | spin_lock_irqsave(&xhci->lock, flags); |
851 | 851 | ||
852 | ep->stop_cmds_pending--; | 852 | ep->stop_cmds_pending--; |
853 | if (xhci->xhc_state & XHCI_STATE_REMOVING) { | ||
854 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
855 | return; | ||
856 | } | ||
853 | if (xhci->xhc_state & XHCI_STATE_DYING) { | 857 | if (xhci->xhc_state & XHCI_STATE_DYING) { |
854 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 858 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
855 | "Stop EP timer ran, but another timer marked " | 859 | "Stop EP timer ran, but another timer marked " |
@@ -903,7 +907,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg) | |||
903 | spin_unlock_irqrestore(&xhci->lock, flags); | 907 | spin_unlock_irqrestore(&xhci->lock, flags); |
904 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 908 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
905 | "Calling usb_hc_died()"); | 909 | "Calling usb_hc_died()"); |
906 | usb_hc_died(xhci_to_hcd(xhci)->primary_hcd); | 910 | usb_hc_died(xhci_to_hcd(xhci)); |
907 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 911 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
908 | "xHCI host controller is dead."); | 912 | "xHCI host controller is dead."); |
909 | } | 913 | } |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 886526b5fcdd..73cfa13fc0dc 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -87,7 +87,7 @@ config USB_MUSB_DA8XX | |||
87 | config USB_MUSB_TUSB6010 | 87 | config USB_MUSB_TUSB6010 |
88 | tristate "TUSB6010" | 88 | tristate "TUSB6010" |
89 | depends on HAS_IOMEM | 89 | depends on HAS_IOMEM |
90 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | 90 | depends on (ARCH_OMAP2PLUS || COMPILE_TEST) && !BLACKFIN |
91 | depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules | 91 | depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules |
92 | 92 | ||
93 | config USB_MUSB_OMAP2PLUS | 93 | config USB_MUSB_OMAP2PLUS |
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index 980c9dee09eb..427efb5eebae 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c | |||
@@ -144,14 +144,18 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data) | |||
144 | int usb_gen_phy_init(struct usb_phy *phy) | 144 | int usb_gen_phy_init(struct usb_phy *phy) |
145 | { | 145 | { |
146 | struct usb_phy_generic *nop = dev_get_drvdata(phy->dev); | 146 | struct usb_phy_generic *nop = dev_get_drvdata(phy->dev); |
147 | int ret; | ||
147 | 148 | ||
148 | if (!IS_ERR(nop->vcc)) { | 149 | if (!IS_ERR(nop->vcc)) { |
149 | if (regulator_enable(nop->vcc)) | 150 | if (regulator_enable(nop->vcc)) |
150 | dev_err(phy->dev, "Failed to enable power\n"); | 151 | dev_err(phy->dev, "Failed to enable power\n"); |
151 | } | 152 | } |
152 | 153 | ||
153 | if (!IS_ERR(nop->clk)) | 154 | if (!IS_ERR(nop->clk)) { |
154 | clk_prepare_enable(nop->clk); | 155 | ret = clk_prepare_enable(nop->clk); |
156 | if (ret) | ||
157 | return ret; | ||
158 | } | ||
155 | 159 | ||
156 | nop_reset(nop); | 160 | nop_reset(nop); |
157 | 161 | ||
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c index d4be5d594896..28965ef4f824 100644 --- a/drivers/usb/renesas_usbhs/mod.c +++ b/drivers/usb/renesas_usbhs/mod.c | |||
@@ -282,9 +282,16 @@ static irqreturn_t usbhs_interrupt(int irq, void *data) | |||
282 | if (usbhs_mod_is_host(priv)) | 282 | if (usbhs_mod_is_host(priv)) |
283 | usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC); | 283 | usbhs_write(priv, INTSTS1, ~irq_state.intsts1 & INTSTS1_MAGIC); |
284 | 284 | ||
285 | usbhs_write(priv, BRDYSTS, ~irq_state.brdysts); | 285 | /* |
286 | * The driver should not clear the xxxSTS after the line of | ||
287 | * "call irq callback functions" because each "if" statement is | ||
288 | * possible to call the callback function for avoiding any side effects. | ||
289 | */ | ||
290 | if (irq_state.intsts0 & BRDY) | ||
291 | usbhs_write(priv, BRDYSTS, ~irq_state.brdysts); | ||
286 | usbhs_write(priv, NRDYSTS, ~irq_state.nrdysts); | 292 | usbhs_write(priv, NRDYSTS, ~irq_state.nrdysts); |
287 | usbhs_write(priv, BEMPSTS, ~irq_state.bempsts); | 293 | if (irq_state.intsts0 & BEMP) |
294 | usbhs_write(priv, BEMPSTS, ~irq_state.bempsts); | ||
288 | 295 | ||
289 | /* | 296 | /* |
290 | * call irq callback functions | 297 | * call irq callback functions |
diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c index a204782ae530..e98b6e57b703 100644 --- a/drivers/usb/serial/usb-serial-simple.c +++ b/drivers/usb/serial/usb-serial-simple.c | |||
@@ -54,7 +54,8 @@ DEVICE(funsoft, FUNSOFT_IDS); | |||
54 | /* Infineon Flashloader driver */ | 54 | /* Infineon Flashloader driver */ |
55 | #define FLASHLOADER_IDS() \ | 55 | #define FLASHLOADER_IDS() \ |
56 | { USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \ | 56 | { USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \ |
57 | { USB_DEVICE(0x8087, 0x0716) } | 57 | { USB_DEVICE(0x8087, 0x0716) }, \ |
58 | { USB_DEVICE(0x8087, 0x0801) } | ||
58 | DEVICE(flashloader, FLASHLOADER_IDS); | 59 | DEVICE(flashloader, FLASHLOADER_IDS); |
59 | 60 | ||
60 | /* Google Serial USB SubClass */ | 61 | /* Google Serial USB SubClass */ |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index e383ecdaca59..ed9c9eeedfe5 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -167,7 +167,7 @@ static bool vring_use_dma_api(struct virtio_device *vdev) | |||
167 | * making all of the arch DMA ops work on the vring device itself | 167 | * making all of the arch DMA ops work on the vring device itself |
168 | * is a mess. For now, we use the parent device for DMA ops. | 168 | * is a mess. For now, we use the parent device for DMA ops. |
169 | */ | 169 | */ |
170 | struct device *vring_dma_dev(const struct vring_virtqueue *vq) | 170 | static struct device *vring_dma_dev(const struct vring_virtqueue *vq) |
171 | { | 171 | { |
172 | return vq->vq.vdev->dev.parent; | 172 | return vq->vq.vdev->dev.parent; |
173 | } | 173 | } |
@@ -239,7 +239,12 @@ static struct dentry *aio_mount(struct file_system_type *fs_type, | |||
239 | static const struct dentry_operations ops = { | 239 | static const struct dentry_operations ops = { |
240 | .d_dname = simple_dname, | 240 | .d_dname = simple_dname, |
241 | }; | 241 | }; |
242 | return mount_pseudo(fs_type, "aio:", NULL, &ops, AIO_RING_MAGIC); | 242 | struct dentry *root = mount_pseudo(fs_type, "aio:", NULL, &ops, |
243 | AIO_RING_MAGIC); | ||
244 | |||
245 | if (!IS_ERR(root)) | ||
246 | root->d_sb->s_iflags |= SB_I_NOEXEC; | ||
247 | return root; | ||
243 | } | 248 | } |
244 | 249 | ||
245 | /* aio_setup | 250 | /* aio_setup |
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index b493909e7492..d8e6d421c27f 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -417,6 +417,7 @@ static struct dentry *should_expire(struct dentry *dentry, | |||
417 | } | 417 | } |
418 | return NULL; | 418 | return NULL; |
419 | } | 419 | } |
420 | |||
420 | /* | 421 | /* |
421 | * Find an eligible tree to time-out | 422 | * Find an eligible tree to time-out |
422 | * A tree is eligible if :- | 423 | * A tree is eligible if :- |
@@ -432,6 +433,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
432 | struct dentry *root = sb->s_root; | 433 | struct dentry *root = sb->s_root; |
433 | struct dentry *dentry; | 434 | struct dentry *dentry; |
434 | struct dentry *expired; | 435 | struct dentry *expired; |
436 | struct dentry *found; | ||
435 | struct autofs_info *ino; | 437 | struct autofs_info *ino; |
436 | 438 | ||
437 | if (!root) | 439 | if (!root) |
@@ -442,31 +444,46 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
442 | 444 | ||
443 | dentry = NULL; | 445 | dentry = NULL; |
444 | while ((dentry = get_next_positive_subdir(dentry, root))) { | 446 | while ((dentry = get_next_positive_subdir(dentry, root))) { |
447 | int flags = how; | ||
448 | |||
445 | spin_lock(&sbi->fs_lock); | 449 | spin_lock(&sbi->fs_lock); |
446 | ino = autofs4_dentry_ino(dentry); | 450 | ino = autofs4_dentry_ino(dentry); |
447 | if (ino->flags & AUTOFS_INF_WANT_EXPIRE) | 451 | if (ino->flags & AUTOFS_INF_WANT_EXPIRE) { |
448 | expired = NULL; | ||
449 | else | ||
450 | expired = should_expire(dentry, mnt, timeout, how); | ||
451 | if (!expired) { | ||
452 | spin_unlock(&sbi->fs_lock); | 452 | spin_unlock(&sbi->fs_lock); |
453 | continue; | 453 | continue; |
454 | } | 454 | } |
455 | spin_unlock(&sbi->fs_lock); | ||
456 | |||
457 | expired = should_expire(dentry, mnt, timeout, flags); | ||
458 | if (!expired) | ||
459 | continue; | ||
460 | |||
461 | spin_lock(&sbi->fs_lock); | ||
455 | ino = autofs4_dentry_ino(expired); | 462 | ino = autofs4_dentry_ino(expired); |
456 | ino->flags |= AUTOFS_INF_WANT_EXPIRE; | 463 | ino->flags |= AUTOFS_INF_WANT_EXPIRE; |
457 | spin_unlock(&sbi->fs_lock); | 464 | spin_unlock(&sbi->fs_lock); |
458 | synchronize_rcu(); | 465 | synchronize_rcu(); |
459 | spin_lock(&sbi->fs_lock); | ||
460 | if (should_expire(expired, mnt, timeout, how)) { | ||
461 | if (expired != dentry) | ||
462 | dput(dentry); | ||
463 | goto found; | ||
464 | } | ||
465 | 466 | ||
467 | /* Make sure a reference is not taken on found if | ||
468 | * things have changed. | ||
469 | */ | ||
470 | flags &= ~AUTOFS_EXP_LEAVES; | ||
471 | found = should_expire(expired, mnt, timeout, how); | ||
472 | if (!found || found != expired) | ||
473 | /* Something has changed, continue */ | ||
474 | goto next; | ||
475 | |||
476 | if (expired != dentry) | ||
477 | dput(dentry); | ||
478 | |||
479 | spin_lock(&sbi->fs_lock); | ||
480 | goto found; | ||
481 | next: | ||
482 | spin_lock(&sbi->fs_lock); | ||
466 | ino->flags &= ~AUTOFS_INF_WANT_EXPIRE; | 483 | ino->flags &= ~AUTOFS_INF_WANT_EXPIRE; |
484 | spin_unlock(&sbi->fs_lock); | ||
467 | if (expired != dentry) | 485 | if (expired != dentry) |
468 | dput(expired); | 486 | dput(expired); |
469 | spin_unlock(&sbi->fs_lock); | ||
470 | } | 487 | } |
471 | return NULL; | 488 | return NULL; |
472 | 489 | ||
@@ -483,6 +500,7 @@ int autofs4_expire_wait(struct dentry *dentry, int rcu_walk) | |||
483 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 500 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
484 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 501 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
485 | int status; | 502 | int status; |
503 | int state; | ||
486 | 504 | ||
487 | /* Block on any pending expire */ | 505 | /* Block on any pending expire */ |
488 | if (!(ino->flags & AUTOFS_INF_WANT_EXPIRE)) | 506 | if (!(ino->flags & AUTOFS_INF_WANT_EXPIRE)) |
@@ -490,8 +508,19 @@ int autofs4_expire_wait(struct dentry *dentry, int rcu_walk) | |||
490 | if (rcu_walk) | 508 | if (rcu_walk) |
491 | return -ECHILD; | 509 | return -ECHILD; |
492 | 510 | ||
511 | retry: | ||
493 | spin_lock(&sbi->fs_lock); | 512 | spin_lock(&sbi->fs_lock); |
494 | if (ino->flags & AUTOFS_INF_EXPIRING) { | 513 | state = ino->flags & (AUTOFS_INF_WANT_EXPIRE | AUTOFS_INF_EXPIRING); |
514 | if (state == AUTOFS_INF_WANT_EXPIRE) { | ||
515 | spin_unlock(&sbi->fs_lock); | ||
516 | /* | ||
517 | * Possibly being selected for expire, wait until | ||
518 | * it's selected or not. | ||
519 | */ | ||
520 | schedule_timeout_uninterruptible(HZ/10); | ||
521 | goto retry; | ||
522 | } | ||
523 | if (state & AUTOFS_INF_EXPIRING) { | ||
495 | spin_unlock(&sbi->fs_lock); | 524 | spin_unlock(&sbi->fs_lock); |
496 | 525 | ||
497 | pr_debug("waiting for expire %p name=%pd\n", dentry, dentry); | 526 | pr_debug("waiting for expire %p name=%pd\n", dentry, dentry); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index eff3993c77b3..33fe03551105 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -427,6 +427,7 @@ struct btrfs_space_info { | |||
427 | struct list_head ro_bgs; | 427 | struct list_head ro_bgs; |
428 | struct list_head priority_tickets; | 428 | struct list_head priority_tickets; |
429 | struct list_head tickets; | 429 | struct list_head tickets; |
430 | u64 tickets_id; | ||
430 | 431 | ||
431 | struct rw_semaphore groups_sem; | 432 | struct rw_semaphore groups_sem; |
432 | /* for block groups in our same type */ | 433 | /* for block groups in our same type */ |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 8c8a4d1e02b9..38c2df84cabd 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -4966,12 +4966,12 @@ static void wake_all_tickets(struct list_head *head) | |||
4966 | */ | 4966 | */ |
4967 | static void btrfs_async_reclaim_metadata_space(struct work_struct *work) | 4967 | static void btrfs_async_reclaim_metadata_space(struct work_struct *work) |
4968 | { | 4968 | { |
4969 | struct reserve_ticket *last_ticket = NULL; | ||
4970 | struct btrfs_fs_info *fs_info; | 4969 | struct btrfs_fs_info *fs_info; |
4971 | struct btrfs_space_info *space_info; | 4970 | struct btrfs_space_info *space_info; |
4972 | u64 to_reclaim; | 4971 | u64 to_reclaim; |
4973 | int flush_state; | 4972 | int flush_state; |
4974 | int commit_cycles = 0; | 4973 | int commit_cycles = 0; |
4974 | u64 last_tickets_id; | ||
4975 | 4975 | ||
4976 | fs_info = container_of(work, struct btrfs_fs_info, async_reclaim_work); | 4976 | fs_info = container_of(work, struct btrfs_fs_info, async_reclaim_work); |
4977 | space_info = __find_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA); | 4977 | space_info = __find_space_info(fs_info, BTRFS_BLOCK_GROUP_METADATA); |
@@ -4984,8 +4984,7 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work) | |||
4984 | spin_unlock(&space_info->lock); | 4984 | spin_unlock(&space_info->lock); |
4985 | return; | 4985 | return; |
4986 | } | 4986 | } |
4987 | last_ticket = list_first_entry(&space_info->tickets, | 4987 | last_tickets_id = space_info->tickets_id; |
4988 | struct reserve_ticket, list); | ||
4989 | spin_unlock(&space_info->lock); | 4988 | spin_unlock(&space_info->lock); |
4990 | 4989 | ||
4991 | flush_state = FLUSH_DELAYED_ITEMS_NR; | 4990 | flush_state = FLUSH_DELAYED_ITEMS_NR; |
@@ -5005,10 +5004,10 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work) | |||
5005 | space_info); | 5004 | space_info); |
5006 | ticket = list_first_entry(&space_info->tickets, | 5005 | ticket = list_first_entry(&space_info->tickets, |
5007 | struct reserve_ticket, list); | 5006 | struct reserve_ticket, list); |
5008 | if (last_ticket == ticket) { | 5007 | if (last_tickets_id == space_info->tickets_id) { |
5009 | flush_state++; | 5008 | flush_state++; |
5010 | } else { | 5009 | } else { |
5011 | last_ticket = ticket; | 5010 | last_tickets_id = space_info->tickets_id; |
5012 | flush_state = FLUSH_DELAYED_ITEMS_NR; | 5011 | flush_state = FLUSH_DELAYED_ITEMS_NR; |
5013 | if (commit_cycles) | 5012 | if (commit_cycles) |
5014 | commit_cycles--; | 5013 | commit_cycles--; |
@@ -5384,6 +5383,7 @@ again: | |||
5384 | list_del_init(&ticket->list); | 5383 | list_del_init(&ticket->list); |
5385 | num_bytes -= ticket->bytes; | 5384 | num_bytes -= ticket->bytes; |
5386 | ticket->bytes = 0; | 5385 | ticket->bytes = 0; |
5386 | space_info->tickets_id++; | ||
5387 | wake_up(&ticket->wait); | 5387 | wake_up(&ticket->wait); |
5388 | } else { | 5388 | } else { |
5389 | ticket->bytes -= num_bytes; | 5389 | ticket->bytes -= num_bytes; |
@@ -5426,6 +5426,7 @@ again: | |||
5426 | num_bytes -= ticket->bytes; | 5426 | num_bytes -= ticket->bytes; |
5427 | space_info->bytes_may_use += ticket->bytes; | 5427 | space_info->bytes_may_use += ticket->bytes; |
5428 | ticket->bytes = 0; | 5428 | ticket->bytes = 0; |
5429 | space_info->tickets_id++; | ||
5429 | wake_up(&ticket->wait); | 5430 | wake_up(&ticket->wait); |
5430 | } else { | 5431 | } else { |
5431 | trace_btrfs_space_reservation(fs_info, "space_info", | 5432 | trace_btrfs_space_reservation(fs_info, "space_info", |
@@ -8216,6 +8217,7 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans, | |||
8216 | { | 8217 | { |
8217 | int ret; | 8218 | int ret; |
8218 | struct btrfs_block_group_cache *block_group; | 8219 | struct btrfs_block_group_cache *block_group; |
8220 | struct btrfs_space_info *space_info; | ||
8219 | 8221 | ||
8220 | /* | 8222 | /* |
8221 | * Mixed block groups will exclude before processing the log so we only | 8223 | * Mixed block groups will exclude before processing the log so we only |
@@ -8231,9 +8233,14 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans, | |||
8231 | if (!block_group) | 8233 | if (!block_group) |
8232 | return -EINVAL; | 8234 | return -EINVAL; |
8233 | 8235 | ||
8234 | ret = btrfs_add_reserved_bytes(block_group, ins->offset, | 8236 | space_info = block_group->space_info; |
8235 | ins->offset, 0); | 8237 | spin_lock(&space_info->lock); |
8236 | BUG_ON(ret); /* logic error */ | 8238 | spin_lock(&block_group->lock); |
8239 | space_info->bytes_reserved += ins->offset; | ||
8240 | block_group->reserved += ins->offset; | ||
8241 | spin_unlock(&block_group->lock); | ||
8242 | spin_unlock(&space_info->lock); | ||
8243 | |||
8237 | ret = alloc_reserved_file_extent(trans, root, 0, root_objectid, | 8244 | ret = alloc_reserved_file_extent(trans, root, 0, root_objectid, |
8238 | 0, owner, offset, ins, 1); | 8245 | 0, owner, offset, ins, 1); |
8239 | btrfs_put_block_group(block_group); | 8246 | btrfs_put_block_group(block_group); |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index e935035ac034..ef9c55bc7907 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2867,6 +2867,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
2867 | 2867 | ||
2868 | if (log_root_tree->log_transid_committed >= root_log_ctx.log_transid) { | 2868 | if (log_root_tree->log_transid_committed >= root_log_ctx.log_transid) { |
2869 | blk_finish_plug(&plug); | 2869 | blk_finish_plug(&plug); |
2870 | list_del_init(&root_log_ctx.list); | ||
2870 | mutex_unlock(&log_root_tree->log_mutex); | 2871 | mutex_unlock(&log_root_tree->log_mutex); |
2871 | ret = root_log_ctx.log_ret; | 2872 | ret = root_log_ctx.log_ret; |
2872 | goto out; | 2873 | goto out; |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index c64a0b794d49..df4b3e6fa563 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -597,7 +597,7 @@ static bool need_reset_readdir(struct ceph_file_info *fi, loff_t new_pos) | |||
597 | if (is_hash_order(new_pos)) { | 597 | if (is_hash_order(new_pos)) { |
598 | /* no need to reset last_name for a forward seek when | 598 | /* no need to reset last_name for a forward seek when |
599 | * dentries are sotred in hash order */ | 599 | * dentries are sotred in hash order */ |
600 | } else if (fi->frag |= fpos_frag(new_pos)) { | 600 | } else if (fi->frag != fpos_frag(new_pos)) { |
601 | return true; | 601 | return true; |
602 | } | 602 | } |
603 | rinfo = fi->last_readdir ? &fi->last_readdir->r_reply_info : NULL; | 603 | rinfo = fi->last_readdir ? &fi->last_readdir->r_reply_info : NULL; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 6bbec5e784cd..14ae4b8e1a3c 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -609,6 +609,9 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) | |||
609 | char *s, *p; | 609 | char *s, *p; |
610 | char sep; | 610 | char sep; |
611 | 611 | ||
612 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) | ||
613 | return dget(sb->s_root); | ||
614 | |||
612 | full_path = cifs_build_path_to_root(vol, cifs_sb, | 615 | full_path = cifs_build_path_to_root(vol, cifs_sb, |
613 | cifs_sb_master_tcon(cifs_sb)); | 616 | cifs_sb_master_tcon(cifs_sb)); |
614 | if (full_path == NULL) | 617 | if (full_path == NULL) |
@@ -686,26 +689,22 @@ cifs_do_mount(struct file_system_type *fs_type, | |||
686 | cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); | 689 | cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); |
687 | if (cifs_sb->mountdata == NULL) { | 690 | if (cifs_sb->mountdata == NULL) { |
688 | root = ERR_PTR(-ENOMEM); | 691 | root = ERR_PTR(-ENOMEM); |
689 | goto out_cifs_sb; | 692 | goto out_free; |
690 | } | 693 | } |
691 | 694 | ||
692 | if (volume_info->prepath) { | 695 | rc = cifs_setup_cifs_sb(volume_info, cifs_sb); |
693 | cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL); | 696 | if (rc) { |
694 | if (cifs_sb->prepath == NULL) { | 697 | root = ERR_PTR(rc); |
695 | root = ERR_PTR(-ENOMEM); | 698 | goto out_free; |
696 | goto out_cifs_sb; | ||
697 | } | ||
698 | } | 699 | } |
699 | 700 | ||
700 | cifs_setup_cifs_sb(volume_info, cifs_sb); | ||
701 | |||
702 | rc = cifs_mount(cifs_sb, volume_info); | 701 | rc = cifs_mount(cifs_sb, volume_info); |
703 | if (rc) { | 702 | if (rc) { |
704 | if (!(flags & MS_SILENT)) | 703 | if (!(flags & MS_SILENT)) |
705 | cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", | 704 | cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", |
706 | rc); | 705 | rc); |
707 | root = ERR_PTR(rc); | 706 | root = ERR_PTR(rc); |
708 | goto out_mountdata; | 707 | goto out_free; |
709 | } | 708 | } |
710 | 709 | ||
711 | mnt_data.vol = volume_info; | 710 | mnt_data.vol = volume_info; |
@@ -735,11 +734,7 @@ cifs_do_mount(struct file_system_type *fs_type, | |||
735 | sb->s_flags |= MS_ACTIVE; | 734 | sb->s_flags |= MS_ACTIVE; |
736 | } | 735 | } |
737 | 736 | ||
738 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) | 737 | root = cifs_get_root(volume_info, sb); |
739 | root = dget(sb->s_root); | ||
740 | else | ||
741 | root = cifs_get_root(volume_info, sb); | ||
742 | |||
743 | if (IS_ERR(root)) | 738 | if (IS_ERR(root)) |
744 | goto out_super; | 739 | goto out_super; |
745 | 740 | ||
@@ -752,9 +747,9 @@ out: | |||
752 | cifs_cleanup_volume_info(volume_info); | 747 | cifs_cleanup_volume_info(volume_info); |
753 | return root; | 748 | return root; |
754 | 749 | ||
755 | out_mountdata: | 750 | out_free: |
751 | kfree(cifs_sb->prepath); | ||
756 | kfree(cifs_sb->mountdata); | 752 | kfree(cifs_sb->mountdata); |
757 | out_cifs_sb: | ||
758 | kfree(cifs_sb); | 753 | kfree(cifs_sb); |
759 | out_nls: | 754 | out_nls: |
760 | unload_nls(volume_info->local_nls); | 755 | unload_nls(volume_info->local_nls); |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 1243bd326591..95dab43646f0 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -184,7 +184,7 @@ extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf, | |||
184 | unsigned int to_read); | 184 | unsigned int to_read); |
185 | extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, | 185 | extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, |
186 | struct page *page, unsigned int to_read); | 186 | struct page *page, unsigned int to_read); |
187 | extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | 187 | extern int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, |
188 | struct cifs_sb_info *cifs_sb); | 188 | struct cifs_sb_info *cifs_sb); |
189 | extern int cifs_match_super(struct super_block *, void *); | 189 | extern int cifs_match_super(struct super_block *, void *); |
190 | extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info); | 190 | extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 7ae03283bd61..2e4f4bad8b1e 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2781,6 +2781,24 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) | |||
2781 | return 1; | 2781 | return 1; |
2782 | } | 2782 | } |
2783 | 2783 | ||
2784 | static int | ||
2785 | match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data) | ||
2786 | { | ||
2787 | struct cifs_sb_info *old = CIFS_SB(sb); | ||
2788 | struct cifs_sb_info *new = mnt_data->cifs_sb; | ||
2789 | |||
2790 | if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) { | ||
2791 | if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)) | ||
2792 | return 0; | ||
2793 | /* The prepath should be null terminated strings */ | ||
2794 | if (strcmp(new->prepath, old->prepath)) | ||
2795 | return 0; | ||
2796 | |||
2797 | return 1; | ||
2798 | } | ||
2799 | return 0; | ||
2800 | } | ||
2801 | |||
2784 | int | 2802 | int |
2785 | cifs_match_super(struct super_block *sb, void *data) | 2803 | cifs_match_super(struct super_block *sb, void *data) |
2786 | { | 2804 | { |
@@ -2808,7 +2826,8 @@ cifs_match_super(struct super_block *sb, void *data) | |||
2808 | 2826 | ||
2809 | if (!match_server(tcp_srv, volume_info) || | 2827 | if (!match_server(tcp_srv, volume_info) || |
2810 | !match_session(ses, volume_info) || | 2828 | !match_session(ses, volume_info) || |
2811 | !match_tcon(tcon, volume_info->UNC)) { | 2829 | !match_tcon(tcon, volume_info->UNC) || |
2830 | !match_prepath(sb, mnt_data)) { | ||
2812 | rc = 0; | 2831 | rc = 0; |
2813 | goto out; | 2832 | goto out; |
2814 | } | 2833 | } |
@@ -3222,7 +3241,7 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, | |||
3222 | } | 3241 | } |
3223 | } | 3242 | } |
3224 | 3243 | ||
3225 | void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | 3244 | int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, |
3226 | struct cifs_sb_info *cifs_sb) | 3245 | struct cifs_sb_info *cifs_sb) |
3227 | { | 3246 | { |
3228 | INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); | 3247 | INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); |
@@ -3316,6 +3335,14 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | |||
3316 | 3335 | ||
3317 | if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm)) | 3336 | if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm)) |
3318 | cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n"); | 3337 | cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n"); |
3338 | |||
3339 | if (pvolume_info->prepath) { | ||
3340 | cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL); | ||
3341 | if (cifs_sb->prepath == NULL) | ||
3342 | return -ENOMEM; | ||
3343 | } | ||
3344 | |||
3345 | return 0; | ||
3319 | } | 3346 | } |
3320 | 3347 | ||
3321 | static void | 3348 | static void |
diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c index 0f9961eede1e..ed115acb5dee 100644 --- a/fs/crypto/policy.c +++ b/fs/crypto/policy.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/random.h> | 11 | #include <linux/random.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/fscrypto.h> | 13 | #include <linux/fscrypto.h> |
14 | #include <linux/mount.h> | ||
14 | 15 | ||
15 | static int inode_has_encryption_context(struct inode *inode) | 16 | static int inode_has_encryption_context(struct inode *inode) |
16 | { | 17 | { |
@@ -92,26 +93,42 @@ static int create_encryption_context_from_policy(struct inode *inode, | |||
92 | return inode->i_sb->s_cop->set_context(inode, &ctx, sizeof(ctx), NULL); | 93 | return inode->i_sb->s_cop->set_context(inode, &ctx, sizeof(ctx), NULL); |
93 | } | 94 | } |
94 | 95 | ||
95 | int fscrypt_process_policy(struct inode *inode, | 96 | int fscrypt_process_policy(struct file *filp, |
96 | const struct fscrypt_policy *policy) | 97 | const struct fscrypt_policy *policy) |
97 | { | 98 | { |
99 | struct inode *inode = file_inode(filp); | ||
100 | int ret; | ||
101 | |||
102 | if (!inode_owner_or_capable(inode)) | ||
103 | return -EACCES; | ||
104 | |||
98 | if (policy->version != 0) | 105 | if (policy->version != 0) |
99 | return -EINVAL; | 106 | return -EINVAL; |
100 | 107 | ||
108 | ret = mnt_want_write_file(filp); | ||
109 | if (ret) | ||
110 | return ret; | ||
111 | |||
101 | if (!inode_has_encryption_context(inode)) { | 112 | if (!inode_has_encryption_context(inode)) { |
102 | if (!inode->i_sb->s_cop->empty_dir) | 113 | if (!S_ISDIR(inode->i_mode)) |
103 | return -EOPNOTSUPP; | 114 | ret = -EINVAL; |
104 | if (!inode->i_sb->s_cop->empty_dir(inode)) | 115 | else if (!inode->i_sb->s_cop->empty_dir) |
105 | return -ENOTEMPTY; | 116 | ret = -EOPNOTSUPP; |
106 | return create_encryption_context_from_policy(inode, policy); | 117 | else if (!inode->i_sb->s_cop->empty_dir(inode)) |
118 | ret = -ENOTEMPTY; | ||
119 | else | ||
120 | ret = create_encryption_context_from_policy(inode, | ||
121 | policy); | ||
122 | } else if (!is_encryption_context_consistent_with_policy(inode, | ||
123 | policy)) { | ||
124 | printk(KERN_WARNING | ||
125 | "%s: Policy inconsistent with encryption context\n", | ||
126 | __func__); | ||
127 | ret = -EINVAL; | ||
107 | } | 128 | } |
108 | 129 | ||
109 | if (is_encryption_context_consistent_with_policy(inode, policy)) | 130 | mnt_drop_write_file(filp); |
110 | return 0; | 131 | return ret; |
111 | |||
112 | printk(KERN_WARNING "%s: Policy inconsistent with encryption context\n", | ||
113 | __func__); | ||
114 | return -EINVAL; | ||
115 | } | 132 | } |
116 | EXPORT_SYMBOL(fscrypt_process_policy); | 133 | EXPORT_SYMBOL(fscrypt_process_policy); |
117 | 134 | ||
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 10686fd67fb4..1bb7df5e4536 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -776,7 +776,7 @@ resizefs_out: | |||
776 | (struct fscrypt_policy __user *)arg, | 776 | (struct fscrypt_policy __user *)arg, |
777 | sizeof(policy))) | 777 | sizeof(policy))) |
778 | return -EFAULT; | 778 | return -EFAULT; |
779 | return fscrypt_process_policy(inode, &policy); | 779 | return fscrypt_process_policy(filp, &policy); |
780 | #else | 780 | #else |
781 | return -EOPNOTSUPP; | 781 | return -EOPNOTSUPP; |
782 | #endif | 782 | #endif |
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 47abb96098e4..28f4f4cbb8d8 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -1757,21 +1757,14 @@ static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg) | |||
1757 | { | 1757 | { |
1758 | struct fscrypt_policy policy; | 1758 | struct fscrypt_policy policy; |
1759 | struct inode *inode = file_inode(filp); | 1759 | struct inode *inode = file_inode(filp); |
1760 | int ret; | ||
1761 | 1760 | ||
1762 | if (copy_from_user(&policy, (struct fscrypt_policy __user *)arg, | 1761 | if (copy_from_user(&policy, (struct fscrypt_policy __user *)arg, |
1763 | sizeof(policy))) | 1762 | sizeof(policy))) |
1764 | return -EFAULT; | 1763 | return -EFAULT; |
1765 | 1764 | ||
1766 | ret = mnt_want_write_file(filp); | ||
1767 | if (ret) | ||
1768 | return ret; | ||
1769 | |||
1770 | f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); | 1765 | f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); |
1771 | ret = fscrypt_process_policy(inode, &policy); | ||
1772 | 1766 | ||
1773 | mnt_drop_write_file(filp); | 1767 | return fscrypt_process_policy(filp, &policy); |
1774 | return ret; | ||
1775 | } | 1768 | } |
1776 | 1769 | ||
1777 | static int f2fs_ioc_get_encryption_policy(struct file *filp, unsigned long arg) | 1770 | static int f2fs_ioc_get_encryption_policy(struct file *filp, unsigned long arg) |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index f394aff59c36..3988b43c2f5a 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -530,13 +530,13 @@ void fuse_read_fill(struct fuse_req *req, struct file *file, loff_t pos, | |||
530 | req->out.args[0].size = count; | 530 | req->out.args[0].size = count; |
531 | } | 531 | } |
532 | 532 | ||
533 | static void fuse_release_user_pages(struct fuse_req *req, int write) | 533 | static void fuse_release_user_pages(struct fuse_req *req, bool should_dirty) |
534 | { | 534 | { |
535 | unsigned i; | 535 | unsigned i; |
536 | 536 | ||
537 | for (i = 0; i < req->num_pages; i++) { | 537 | for (i = 0; i < req->num_pages; i++) { |
538 | struct page *page = req->pages[i]; | 538 | struct page *page = req->pages[i]; |
539 | if (write) | 539 | if (should_dirty) |
540 | set_page_dirty_lock(page); | 540 | set_page_dirty_lock(page); |
541 | put_page(page); | 541 | put_page(page); |
542 | } | 542 | } |
@@ -1320,6 +1320,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, | |||
1320 | loff_t *ppos, int flags) | 1320 | loff_t *ppos, int flags) |
1321 | { | 1321 | { |
1322 | int write = flags & FUSE_DIO_WRITE; | 1322 | int write = flags & FUSE_DIO_WRITE; |
1323 | bool should_dirty = !write && iter_is_iovec(iter); | ||
1323 | int cuse = flags & FUSE_DIO_CUSE; | 1324 | int cuse = flags & FUSE_DIO_CUSE; |
1324 | struct file *file = io->file; | 1325 | struct file *file = io->file; |
1325 | struct inode *inode = file->f_mapping->host; | 1326 | struct inode *inode = file->f_mapping->host; |
@@ -1363,7 +1364,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, | |||
1363 | nres = fuse_send_read(req, io, pos, nbytes, owner); | 1364 | nres = fuse_send_read(req, io, pos, nbytes, owner); |
1364 | 1365 | ||
1365 | if (!io->async) | 1366 | if (!io->async) |
1366 | fuse_release_user_pages(req, !write); | 1367 | fuse_release_user_pages(req, should_dirty); |
1367 | if (req->out.h.error) { | 1368 | if (req->out.h.error) { |
1368 | err = req->out.h.error; | 1369 | err = req->out.h.error; |
1369 | break; | 1370 | break; |
diff --git a/fs/ioctl.c b/fs/ioctl.c index 0f56deb24ce6..c415668c86d4 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -568,7 +568,7 @@ static int ioctl_fsthaw(struct file *filp) | |||
568 | return thaw_super(sb); | 568 | return thaw_super(sb); |
569 | } | 569 | } |
570 | 570 | ||
571 | static long ioctl_file_dedupe_range(struct file *file, void __user *arg) | 571 | static int ioctl_file_dedupe_range(struct file *file, void __user *arg) |
572 | { | 572 | { |
573 | struct file_dedupe_range __user *argp = arg; | 573 | struct file_dedupe_range __user *argp = arg; |
574 | struct file_dedupe_range *same = NULL; | 574 | struct file_dedupe_range *same = NULL; |
@@ -582,6 +582,10 @@ static long ioctl_file_dedupe_range(struct file *file, void __user *arg) | |||
582 | } | 582 | } |
583 | 583 | ||
584 | size = offsetof(struct file_dedupe_range __user, info[count]); | 584 | size = offsetof(struct file_dedupe_range __user, info[count]); |
585 | if (size > PAGE_SIZE) { | ||
586 | ret = -ENOMEM; | ||
587 | goto out; | ||
588 | } | ||
585 | 589 | ||
586 | same = memdup_user(argp, size); | 590 | same = memdup_user(argp, size); |
587 | if (IS_ERR(same)) { | 591 | if (IS_ERR(same)) { |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 7d620970f2e1..ca699ddc11c1 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -657,7 +657,10 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from) | |||
657 | if (result <= 0) | 657 | if (result <= 0) |
658 | goto out; | 658 | goto out; |
659 | 659 | ||
660 | written = generic_write_sync(iocb, result); | 660 | result = generic_write_sync(iocb, result); |
661 | if (result < 0) | ||
662 | goto out; | ||
663 | written = result; | ||
661 | iocb->ki_pos += written; | 664 | iocb->ki_pos += written; |
662 | 665 | ||
663 | /* Return error values */ | 666 | /* Return error values */ |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f5aecaabcb7c..a9dec32ba9ba 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -7570,12 +7570,20 @@ static int _nfs4_proc_create_session(struct nfs_client *clp, | |||
7570 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); | 7570 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
7571 | trace_nfs4_create_session(clp, status); | 7571 | trace_nfs4_create_session(clp, status); |
7572 | 7572 | ||
7573 | switch (status) { | ||
7574 | case -NFS4ERR_STALE_CLIENTID: | ||
7575 | case -NFS4ERR_DELAY: | ||
7576 | case -ETIMEDOUT: | ||
7577 | case -EACCES: | ||
7578 | case -EAGAIN: | ||
7579 | goto out; | ||
7580 | }; | ||
7581 | |||
7582 | clp->cl_seqid++; | ||
7573 | if (!status) { | 7583 | if (!status) { |
7574 | /* Verify the session's negotiated channel_attrs values */ | 7584 | /* Verify the session's negotiated channel_attrs values */ |
7575 | status = nfs4_verify_channel_attrs(&args, &res); | 7585 | status = nfs4_verify_channel_attrs(&args, &res); |
7576 | /* Increment the clientid slot sequence id */ | 7586 | /* Increment the clientid slot sequence id */ |
7577 | if (clp->cl_seqid == res.seqid) | ||
7578 | clp->cl_seqid++; | ||
7579 | if (status) | 7587 | if (status) |
7580 | goto out; | 7588 | goto out; |
7581 | nfs4_update_session(session, &res); | 7589 | nfs4_update_session(session, &res); |
@@ -8190,10 +8198,13 @@ static void nfs4_layoutreturn_release(void *calldata) | |||
8190 | 8198 | ||
8191 | dprintk("--> %s\n", __func__); | 8199 | dprintk("--> %s\n", __func__); |
8192 | spin_lock(&lo->plh_inode->i_lock); | 8200 | spin_lock(&lo->plh_inode->i_lock); |
8193 | pnfs_mark_matching_lsegs_invalid(lo, &freeme, &lrp->args.range, | 8201 | if (lrp->res.lrs_present) { |
8194 | be32_to_cpu(lrp->args.stateid.seqid)); | 8202 | pnfs_mark_matching_lsegs_invalid(lo, &freeme, |
8195 | if (lrp->res.lrs_present && pnfs_layout_is_valid(lo)) | 8203 | &lrp->args.range, |
8204 | be32_to_cpu(lrp->args.stateid.seqid)); | ||
8196 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); | 8205 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); |
8206 | } else | ||
8207 | pnfs_mark_layout_stateid_invalid(lo, &freeme); | ||
8197 | pnfs_clear_layoutreturn_waitbit(lo); | 8208 | pnfs_clear_layoutreturn_waitbit(lo); |
8198 | spin_unlock(&lo->plh_inode->i_lock); | 8209 | spin_unlock(&lo->plh_inode->i_lock); |
8199 | nfs4_sequence_free_slot(&lrp->res.seq_res); | 8210 | nfs4_sequence_free_slot(&lrp->res.seq_res); |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 6daf034645c8..2c93a85eda51 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -365,7 +365,8 @@ pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo, | |||
365 | /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */ | 365 | /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */ |
366 | atomic_dec(&lo->plh_refcount); | 366 | atomic_dec(&lo->plh_refcount); |
367 | if (list_empty(&lo->plh_segs)) { | 367 | if (list_empty(&lo->plh_segs)) { |
368 | set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | 368 | if (atomic_read(&lo->plh_outstanding) == 0) |
369 | set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | ||
369 | clear_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags); | 370 | clear_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags); |
370 | } | 371 | } |
371 | rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq); | 372 | rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq); |
@@ -768,17 +769,32 @@ pnfs_destroy_all_layouts(struct nfs_client *clp) | |||
768 | pnfs_destroy_layouts_byclid(clp, false); | 769 | pnfs_destroy_layouts_byclid(clp, false); |
769 | } | 770 | } |
770 | 771 | ||
772 | static void | ||
773 | pnfs_clear_layoutreturn_info(struct pnfs_layout_hdr *lo) | ||
774 | { | ||
775 | lo->plh_return_iomode = 0; | ||
776 | lo->plh_return_seq = 0; | ||
777 | clear_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags); | ||
778 | } | ||
779 | |||
771 | /* update lo->plh_stateid with new if is more recent */ | 780 | /* update lo->plh_stateid with new if is more recent */ |
772 | void | 781 | void |
773 | pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, | 782 | pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, |
774 | bool update_barrier) | 783 | bool update_barrier) |
775 | { | 784 | { |
776 | u32 oldseq, newseq, new_barrier = 0; | 785 | u32 oldseq, newseq, new_barrier = 0; |
777 | bool invalid = !pnfs_layout_is_valid(lo); | ||
778 | 786 | ||
779 | oldseq = be32_to_cpu(lo->plh_stateid.seqid); | 787 | oldseq = be32_to_cpu(lo->plh_stateid.seqid); |
780 | newseq = be32_to_cpu(new->seqid); | 788 | newseq = be32_to_cpu(new->seqid); |
781 | if (invalid || pnfs_seqid_is_newer(newseq, oldseq)) { | 789 | |
790 | if (!pnfs_layout_is_valid(lo)) { | ||
791 | nfs4_stateid_copy(&lo->plh_stateid, new); | ||
792 | lo->plh_barrier = newseq; | ||
793 | pnfs_clear_layoutreturn_info(lo); | ||
794 | clear_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | ||
795 | return; | ||
796 | } | ||
797 | if (pnfs_seqid_is_newer(newseq, oldseq)) { | ||
782 | nfs4_stateid_copy(&lo->plh_stateid, new); | 798 | nfs4_stateid_copy(&lo->plh_stateid, new); |
783 | /* | 799 | /* |
784 | * Because of wraparound, we want to keep the barrier | 800 | * Because of wraparound, we want to keep the barrier |
@@ -790,7 +806,7 @@ pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, | |||
790 | new_barrier = be32_to_cpu(new->seqid); | 806 | new_barrier = be32_to_cpu(new->seqid); |
791 | else if (new_barrier == 0) | 807 | else if (new_barrier == 0) |
792 | return; | 808 | return; |
793 | if (invalid || pnfs_seqid_is_newer(new_barrier, lo->plh_barrier)) | 809 | if (pnfs_seqid_is_newer(new_barrier, lo->plh_barrier)) |
794 | lo->plh_barrier = new_barrier; | 810 | lo->plh_barrier = new_barrier; |
795 | } | 811 | } |
796 | 812 | ||
@@ -886,19 +902,14 @@ void pnfs_clear_layoutreturn_waitbit(struct pnfs_layout_hdr *lo) | |||
886 | rpc_wake_up(&NFS_SERVER(lo->plh_inode)->roc_rpcwaitq); | 902 | rpc_wake_up(&NFS_SERVER(lo->plh_inode)->roc_rpcwaitq); |
887 | } | 903 | } |
888 | 904 | ||
889 | static void | ||
890 | pnfs_clear_layoutreturn_info(struct pnfs_layout_hdr *lo) | ||
891 | { | ||
892 | lo->plh_return_iomode = 0; | ||
893 | lo->plh_return_seq = 0; | ||
894 | clear_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags); | ||
895 | } | ||
896 | |||
897 | static bool | 905 | static bool |
898 | pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo, | 906 | pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo, |
899 | nfs4_stateid *stateid, | 907 | nfs4_stateid *stateid, |
900 | enum pnfs_iomode *iomode) | 908 | enum pnfs_iomode *iomode) |
901 | { | 909 | { |
910 | /* Serialise LAYOUTGET/LAYOUTRETURN */ | ||
911 | if (atomic_read(&lo->plh_outstanding) != 0) | ||
912 | return false; | ||
902 | if (test_and_set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) | 913 | if (test_and_set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) |
903 | return false; | 914 | return false; |
904 | pnfs_get_layout_hdr(lo); | 915 | pnfs_get_layout_hdr(lo); |
@@ -1798,16 +1809,11 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) | |||
1798 | */ | 1809 | */ |
1799 | pnfs_mark_layout_stateid_invalid(lo, &free_me); | 1810 | pnfs_mark_layout_stateid_invalid(lo, &free_me); |
1800 | 1811 | ||
1801 | nfs4_stateid_copy(&lo->plh_stateid, &res->stateid); | 1812 | pnfs_set_layout_stateid(lo, &res->stateid, true); |
1802 | lo->plh_barrier = be32_to_cpu(res->stateid.seqid); | ||
1803 | } | 1813 | } |
1804 | 1814 | ||
1805 | pnfs_get_lseg(lseg); | 1815 | pnfs_get_lseg(lseg); |
1806 | pnfs_layout_insert_lseg(lo, lseg, &free_me); | 1816 | pnfs_layout_insert_lseg(lo, lseg, &free_me); |
1807 | if (!pnfs_layout_is_valid(lo)) { | ||
1808 | pnfs_clear_layoutreturn_info(lo); | ||
1809 | clear_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | ||
1810 | } | ||
1811 | 1817 | ||
1812 | 1818 | ||
1813 | if (res->return_on_close) | 1819 | if (res->return_on_close) |
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index d2f97ecca6a5..e0e5f7c3c99f 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
@@ -67,18 +67,7 @@ static int fanotify_get_response(struct fsnotify_group *group, | |||
67 | 67 | ||
68 | pr_debug("%s: group=%p event=%p\n", __func__, group, event); | 68 | pr_debug("%s: group=%p event=%p\n", __func__, group, event); |
69 | 69 | ||
70 | wait_event(group->fanotify_data.access_waitq, event->response || | 70 | wait_event(group->fanotify_data.access_waitq, event->response); |
71 | atomic_read(&group->fanotify_data.bypass_perm)); | ||
72 | |||
73 | if (!event->response) { /* bypass_perm set */ | ||
74 | /* | ||
75 | * Event was canceled because group is being destroyed. Remove | ||
76 | * it from group's event list because we are responsible for | ||
77 | * freeing the permission event. | ||
78 | */ | ||
79 | fsnotify_remove_event(group, &event->fae.fse); | ||
80 | return 0; | ||
81 | } | ||
82 | 71 | ||
83 | /* userspace responded, convert to something usable */ | 72 | /* userspace responded, convert to something usable */ |
84 | switch (event->response) { | 73 | switch (event->response) { |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 8e8e6bcd1d43..a64313868d3a 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -358,16 +358,20 @@ static int fanotify_release(struct inode *ignored, struct file *file) | |||
358 | 358 | ||
359 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 359 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
360 | struct fanotify_perm_event_info *event, *next; | 360 | struct fanotify_perm_event_info *event, *next; |
361 | struct fsnotify_event *fsn_event; | ||
361 | 362 | ||
362 | /* | 363 | /* |
363 | * There may be still new events arriving in the notification queue | 364 | * Stop new events from arriving in the notification queue. since |
364 | * but since userspace cannot use fanotify fd anymore, no event can | 365 | * userspace cannot use fanotify fd anymore, no event can enter or |
365 | * enter or leave access_list by now. | 366 | * leave access_list by now either. |
366 | */ | 367 | */ |
367 | spin_lock(&group->fanotify_data.access_lock); | 368 | fsnotify_group_stop_queueing(group); |
368 | |||
369 | atomic_inc(&group->fanotify_data.bypass_perm); | ||
370 | 369 | ||
370 | /* | ||
371 | * Process all permission events on access_list and notification queue | ||
372 | * and simulate reply from userspace. | ||
373 | */ | ||
374 | spin_lock(&group->fanotify_data.access_lock); | ||
371 | list_for_each_entry_safe(event, next, &group->fanotify_data.access_list, | 375 | list_for_each_entry_safe(event, next, &group->fanotify_data.access_list, |
372 | fae.fse.list) { | 376 | fae.fse.list) { |
373 | pr_debug("%s: found group=%p event=%p\n", __func__, group, | 377 | pr_debug("%s: found group=%p event=%p\n", __func__, group, |
@@ -379,12 +383,21 @@ static int fanotify_release(struct inode *ignored, struct file *file) | |||
379 | spin_unlock(&group->fanotify_data.access_lock); | 383 | spin_unlock(&group->fanotify_data.access_lock); |
380 | 384 | ||
381 | /* | 385 | /* |
382 | * Since bypass_perm is set, newly queued events will not wait for | 386 | * Destroy all non-permission events. For permission events just |
383 | * access response. Wake up the already sleeping ones now. | 387 | * dequeue them and set the response. They will be freed once the |
384 | * synchronize_srcu() in fsnotify_destroy_group() will wait for all | 388 | * response is consumed and fanotify_get_response() returns. |
385 | * processes sleeping in fanotify_handle_event() waiting for access | ||
386 | * response and thus also for all permission events to be freed. | ||
387 | */ | 389 | */ |
390 | mutex_lock(&group->notification_mutex); | ||
391 | while (!fsnotify_notify_queue_is_empty(group)) { | ||
392 | fsn_event = fsnotify_remove_first_event(group); | ||
393 | if (!(fsn_event->mask & FAN_ALL_PERM_EVENTS)) | ||
394 | fsnotify_destroy_event(group, fsn_event); | ||
395 | else | ||
396 | FANOTIFY_PE(fsn_event)->response = FAN_ALLOW; | ||
397 | } | ||
398 | mutex_unlock(&group->notification_mutex); | ||
399 | |||
400 | /* Response for all permission events it set, wakeup waiters */ | ||
388 | wake_up(&group->fanotify_data.access_waitq); | 401 | wake_up(&group->fanotify_data.access_waitq); |
389 | #endif | 402 | #endif |
390 | 403 | ||
@@ -755,7 +768,6 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
755 | spin_lock_init(&group->fanotify_data.access_lock); | 768 | spin_lock_init(&group->fanotify_data.access_lock); |
756 | init_waitqueue_head(&group->fanotify_data.access_waitq); | 769 | init_waitqueue_head(&group->fanotify_data.access_waitq); |
757 | INIT_LIST_HEAD(&group->fanotify_data.access_list); | 770 | INIT_LIST_HEAD(&group->fanotify_data.access_list); |
758 | atomic_set(&group->fanotify_data.bypass_perm, 0); | ||
759 | #endif | 771 | #endif |
760 | switch (flags & FAN_ALL_CLASS_BITS) { | 772 | switch (flags & FAN_ALL_CLASS_BITS) { |
761 | case FAN_CLASS_NOTIF: | 773 | case FAN_CLASS_NOTIF: |
diff --git a/fs/notify/group.c b/fs/notify/group.c index 3e2dd85be5dd..b47f7cfdcaa4 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c | |||
@@ -40,6 +40,17 @@ static void fsnotify_final_destroy_group(struct fsnotify_group *group) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * Stop queueing new events for this group. Once this function returns | ||
44 | * fsnotify_add_event() will not add any new events to the group's queue. | ||
45 | */ | ||
46 | void fsnotify_group_stop_queueing(struct fsnotify_group *group) | ||
47 | { | ||
48 | mutex_lock(&group->notification_mutex); | ||
49 | group->shutdown = true; | ||
50 | mutex_unlock(&group->notification_mutex); | ||
51 | } | ||
52 | |||
53 | /* | ||
43 | * Trying to get rid of a group. Remove all marks, flush all events and release | 54 | * Trying to get rid of a group. Remove all marks, flush all events and release |
44 | * the group reference. | 55 | * the group reference. |
45 | * Note that another thread calling fsnotify_clear_marks_by_group() may still | 56 | * Note that another thread calling fsnotify_clear_marks_by_group() may still |
@@ -47,6 +58,14 @@ static void fsnotify_final_destroy_group(struct fsnotify_group *group) | |||
47 | */ | 58 | */ |
48 | void fsnotify_destroy_group(struct fsnotify_group *group) | 59 | void fsnotify_destroy_group(struct fsnotify_group *group) |
49 | { | 60 | { |
61 | /* | ||
62 | * Stop queueing new events. The code below is careful enough to not | ||
63 | * require this but fanotify needs to stop queuing events even before | ||
64 | * fsnotify_destroy_group() is called and this makes the other callers | ||
65 | * of fsnotify_destroy_group() to see the same behavior. | ||
66 | */ | ||
67 | fsnotify_group_stop_queueing(group); | ||
68 | |||
50 | /* clear all inode marks for this group, attach them to destroy_list */ | 69 | /* clear all inode marks for this group, attach them to destroy_list */ |
51 | fsnotify_detach_group_marks(group); | 70 | fsnotify_detach_group_marks(group); |
52 | 71 | ||
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index a95d8e037aeb..e455e83ceeeb 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
@@ -82,7 +82,8 @@ void fsnotify_destroy_event(struct fsnotify_group *group, | |||
82 | * Add an event to the group notification queue. The group can later pull this | 82 | * Add an event to the group notification queue. The group can later pull this |
83 | * event off the queue to deal with. The function returns 0 if the event was | 83 | * event off the queue to deal with. The function returns 0 if the event was |
84 | * added to the queue, 1 if the event was merged with some other queued event, | 84 | * added to the queue, 1 if the event was merged with some other queued event, |
85 | * 2 if the queue of events has overflown. | 85 | * 2 if the event was not queued - either the queue of events has overflown |
86 | * or the group is shutting down. | ||
86 | */ | 87 | */ |
87 | int fsnotify_add_event(struct fsnotify_group *group, | 88 | int fsnotify_add_event(struct fsnotify_group *group, |
88 | struct fsnotify_event *event, | 89 | struct fsnotify_event *event, |
@@ -96,6 +97,11 @@ int fsnotify_add_event(struct fsnotify_group *group, | |||
96 | 97 | ||
97 | mutex_lock(&group->notification_mutex); | 98 | mutex_lock(&group->notification_mutex); |
98 | 99 | ||
100 | if (group->shutdown) { | ||
101 | mutex_unlock(&group->notification_mutex); | ||
102 | return 2; | ||
103 | } | ||
104 | |||
99 | if (group->q_len >= group->max_events) { | 105 | if (group->q_len >= group->max_events) { |
100 | ret = 2; | 106 | ret = 2; |
101 | /* Queue overflow event only if it isn't already queued */ | 107 | /* Queue overflow event only if it isn't already queued */ |
@@ -126,21 +132,6 @@ queue: | |||
126 | } | 132 | } |
127 | 133 | ||
128 | /* | 134 | /* |
129 | * Remove @event from group's notification queue. It is the responsibility of | ||
130 | * the caller to destroy the event. | ||
131 | */ | ||
132 | void fsnotify_remove_event(struct fsnotify_group *group, | ||
133 | struct fsnotify_event *event) | ||
134 | { | ||
135 | mutex_lock(&group->notification_mutex); | ||
136 | if (!list_empty(&event->list)) { | ||
137 | list_del_init(&event->list); | ||
138 | group->q_len--; | ||
139 | } | ||
140 | mutex_unlock(&group->notification_mutex); | ||
141 | } | ||
142 | |||
143 | /* | ||
144 | * Remove and return the first event from the notification list. It is the | 135 | * Remove and return the first event from the notification list. It is the |
145 | * responsibility of the caller to destroy the obtained event | 136 | * responsibility of the caller to destroy the obtained event |
146 | */ | 137 | */ |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 7dabbc31060e..f165f867f332 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -5922,7 +5922,6 @@ bail: | |||
5922 | } | 5922 | } |
5923 | 5923 | ||
5924 | static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | 5924 | static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, |
5925 | handle_t *handle, | ||
5926 | struct inode *data_alloc_inode, | 5925 | struct inode *data_alloc_inode, |
5927 | struct buffer_head *data_alloc_bh) | 5926 | struct buffer_head *data_alloc_bh) |
5928 | { | 5927 | { |
@@ -5935,11 +5934,19 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | |||
5935 | struct ocfs2_truncate_log *tl; | 5934 | struct ocfs2_truncate_log *tl; |
5936 | struct inode *tl_inode = osb->osb_tl_inode; | 5935 | struct inode *tl_inode = osb->osb_tl_inode; |
5937 | struct buffer_head *tl_bh = osb->osb_tl_bh; | 5936 | struct buffer_head *tl_bh = osb->osb_tl_bh; |
5937 | handle_t *handle; | ||
5938 | 5938 | ||
5939 | di = (struct ocfs2_dinode *) tl_bh->b_data; | 5939 | di = (struct ocfs2_dinode *) tl_bh->b_data; |
5940 | tl = &di->id2.i_dealloc; | 5940 | tl = &di->id2.i_dealloc; |
5941 | i = le16_to_cpu(tl->tl_used) - 1; | 5941 | i = le16_to_cpu(tl->tl_used) - 1; |
5942 | while (i >= 0) { | 5942 | while (i >= 0) { |
5943 | handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC); | ||
5944 | if (IS_ERR(handle)) { | ||
5945 | status = PTR_ERR(handle); | ||
5946 | mlog_errno(status); | ||
5947 | goto bail; | ||
5948 | } | ||
5949 | |||
5943 | /* Caller has given us at least enough credits to | 5950 | /* Caller has given us at least enough credits to |
5944 | * update the truncate log dinode */ | 5951 | * update the truncate log dinode */ |
5945 | status = ocfs2_journal_access_di(handle, INODE_CACHE(tl_inode), tl_bh, | 5952 | status = ocfs2_journal_access_di(handle, INODE_CACHE(tl_inode), tl_bh, |
@@ -5974,12 +5981,7 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | |||
5974 | } | 5981 | } |
5975 | } | 5982 | } |
5976 | 5983 | ||
5977 | status = ocfs2_extend_trans(handle, | 5984 | ocfs2_commit_trans(osb, handle); |
5978 | OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC); | ||
5979 | if (status < 0) { | ||
5980 | mlog_errno(status); | ||
5981 | goto bail; | ||
5982 | } | ||
5983 | i--; | 5985 | i--; |
5984 | } | 5986 | } |
5985 | 5987 | ||
@@ -5994,7 +5996,6 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
5994 | { | 5996 | { |
5995 | int status; | 5997 | int status; |
5996 | unsigned int num_to_flush; | 5998 | unsigned int num_to_flush; |
5997 | handle_t *handle; | ||
5998 | struct inode *tl_inode = osb->osb_tl_inode; | 5999 | struct inode *tl_inode = osb->osb_tl_inode; |
5999 | struct inode *data_alloc_inode = NULL; | 6000 | struct inode *data_alloc_inode = NULL; |
6000 | struct buffer_head *tl_bh = osb->osb_tl_bh; | 6001 | struct buffer_head *tl_bh = osb->osb_tl_bh; |
@@ -6038,21 +6039,11 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
6038 | goto out_mutex; | 6039 | goto out_mutex; |
6039 | } | 6040 | } |
6040 | 6041 | ||
6041 | handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC); | 6042 | status = ocfs2_replay_truncate_records(osb, data_alloc_inode, |
6042 | if (IS_ERR(handle)) { | ||
6043 | status = PTR_ERR(handle); | ||
6044 | mlog_errno(status); | ||
6045 | goto out_unlock; | ||
6046 | } | ||
6047 | |||
6048 | status = ocfs2_replay_truncate_records(osb, handle, data_alloc_inode, | ||
6049 | data_alloc_bh); | 6043 | data_alloc_bh); |
6050 | if (status < 0) | 6044 | if (status < 0) |
6051 | mlog_errno(status); | 6045 | mlog_errno(status); |
6052 | 6046 | ||
6053 | ocfs2_commit_trans(osb, handle); | ||
6054 | |||
6055 | out_unlock: | ||
6056 | brelse(data_alloc_bh); | 6047 | brelse(data_alloc_bh); |
6057 | ocfs2_inode_unlock(data_alloc_inode, 1); | 6048 | ocfs2_inode_unlock(data_alloc_inode, 1); |
6058 | 6049 | ||
@@ -6413,43 +6404,34 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb, | |||
6413 | goto out_mutex; | 6404 | goto out_mutex; |
6414 | } | 6405 | } |
6415 | 6406 | ||
6416 | handle = ocfs2_start_trans(osb, OCFS2_SUBALLOC_FREE); | ||
6417 | if (IS_ERR(handle)) { | ||
6418 | ret = PTR_ERR(handle); | ||
6419 | mlog_errno(ret); | ||
6420 | goto out_unlock; | ||
6421 | } | ||
6422 | |||
6423 | while (head) { | 6407 | while (head) { |
6424 | if (head->free_bg) | 6408 | if (head->free_bg) |
6425 | bg_blkno = head->free_bg; | 6409 | bg_blkno = head->free_bg; |
6426 | else | 6410 | else |
6427 | bg_blkno = ocfs2_which_suballoc_group(head->free_blk, | 6411 | bg_blkno = ocfs2_which_suballoc_group(head->free_blk, |
6428 | head->free_bit); | 6412 | head->free_bit); |
6413 | handle = ocfs2_start_trans(osb, OCFS2_SUBALLOC_FREE); | ||
6414 | if (IS_ERR(handle)) { | ||
6415 | ret = PTR_ERR(handle); | ||
6416 | mlog_errno(ret); | ||
6417 | goto out_unlock; | ||
6418 | } | ||
6419 | |||
6429 | trace_ocfs2_free_cached_blocks( | 6420 | trace_ocfs2_free_cached_blocks( |
6430 | (unsigned long long)head->free_blk, head->free_bit); | 6421 | (unsigned long long)head->free_blk, head->free_bit); |
6431 | 6422 | ||
6432 | ret = ocfs2_free_suballoc_bits(handle, inode, di_bh, | 6423 | ret = ocfs2_free_suballoc_bits(handle, inode, di_bh, |
6433 | head->free_bit, bg_blkno, 1); | 6424 | head->free_bit, bg_blkno, 1); |
6434 | if (ret) { | 6425 | if (ret) |
6435 | mlog_errno(ret); | 6426 | mlog_errno(ret); |
6436 | goto out_journal; | ||
6437 | } | ||
6438 | 6427 | ||
6439 | ret = ocfs2_extend_trans(handle, OCFS2_SUBALLOC_FREE); | 6428 | ocfs2_commit_trans(osb, handle); |
6440 | if (ret) { | ||
6441 | mlog_errno(ret); | ||
6442 | goto out_journal; | ||
6443 | } | ||
6444 | 6429 | ||
6445 | tmp = head; | 6430 | tmp = head; |
6446 | head = head->free_next; | 6431 | head = head->free_next; |
6447 | kfree(tmp); | 6432 | kfree(tmp); |
6448 | } | 6433 | } |
6449 | 6434 | ||
6450 | out_journal: | ||
6451 | ocfs2_commit_trans(osb, handle); | ||
6452 | |||
6453 | out_unlock: | 6435 | out_unlock: |
6454 | ocfs2_inode_unlock(inode, 1); | 6436 | ocfs2_inode_unlock(inode, 1); |
6455 | brelse(di_bh); | 6437 | brelse(di_bh); |
diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h index 94b18369b1cc..b95e7df5b76a 100644 --- a/fs/ocfs2/cluster/tcp_internal.h +++ b/fs/ocfs2/cluster/tcp_internal.h | |||
@@ -44,9 +44,6 @@ | |||
44 | * version here in tcp_internal.h should not need to be bumped for | 44 | * version here in tcp_internal.h should not need to be bumped for |
45 | * filesystem locking changes. | 45 | * filesystem locking changes. |
46 | * | 46 | * |
47 | * New in version 12 | ||
48 | * - Negotiate hb timeout when storage is down. | ||
49 | * | ||
50 | * New in version 11 | 47 | * New in version 11 |
51 | * - Negotiation of filesystem locking in the dlm join. | 48 | * - Negotiation of filesystem locking in the dlm join. |
52 | * | 49 | * |
@@ -78,7 +75,7 @@ | |||
78 | * - full 64 bit i_size in the metadata lock lvbs | 75 | * - full 64 bit i_size in the metadata lock lvbs |
79 | * - introduction of "rw" lock and pushing meta/data locking down | 76 | * - introduction of "rw" lock and pushing meta/data locking down |
80 | */ | 77 | */ |
81 | #define O2NET_PROTOCOL_VERSION 12ULL | 78 | #define O2NET_PROTOCOL_VERSION 11ULL |
82 | struct o2net_handshake { | 79 | struct o2net_handshake { |
83 | __be64 protocol_version; | 80 | __be64 protocol_version; |
84 | __be64 connector_id; | 81 | __be64 connector_id; |
diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index cdeafb4e7ed6..0bb128659d4b 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c | |||
@@ -268,7 +268,6 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, | |||
268 | struct dlm_lock *lock, int flags, int type) | 268 | struct dlm_lock *lock, int flags, int type) |
269 | { | 269 | { |
270 | enum dlm_status status; | 270 | enum dlm_status status; |
271 | u8 old_owner = res->owner; | ||
272 | 271 | ||
273 | mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type, | 272 | mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type, |
274 | lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS); | 273 | lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS); |
@@ -335,7 +334,6 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, | |||
335 | 334 | ||
336 | spin_lock(&res->spinlock); | 335 | spin_lock(&res->spinlock); |
337 | res->state &= ~DLM_LOCK_RES_IN_PROGRESS; | 336 | res->state &= ~DLM_LOCK_RES_IN_PROGRESS; |
338 | lock->convert_pending = 0; | ||
339 | /* if it failed, move it back to granted queue. | 337 | /* if it failed, move it back to granted queue. |
340 | * if master returns DLM_NORMAL and then down before sending ast, | 338 | * if master returns DLM_NORMAL and then down before sending ast, |
341 | * it may have already been moved to granted queue, reset to | 339 | * it may have already been moved to granted queue, reset to |
@@ -344,12 +342,14 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, | |||
344 | if (status != DLM_NOTQUEUED) | 342 | if (status != DLM_NOTQUEUED) |
345 | dlm_error(status); | 343 | dlm_error(status); |
346 | dlm_revert_pending_convert(res, lock); | 344 | dlm_revert_pending_convert(res, lock); |
347 | } else if ((res->state & DLM_LOCK_RES_RECOVERING) || | 345 | } else if (!lock->convert_pending) { |
348 | (old_owner != res->owner)) { | 346 | mlog(0, "%s: res %.*s, owner died and lock has been moved back " |
349 | mlog(0, "res %.*s is in recovering or has been recovered.\n", | 347 | "to granted list, retry convert.\n", |
350 | res->lockname.len, res->lockname.name); | 348 | dlm->name, res->lockname.len, res->lockname.name); |
351 | status = DLM_RECOVERING; | 349 | status = DLM_RECOVERING; |
352 | } | 350 | } |
351 | |||
352 | lock->convert_pending = 0; | ||
353 | bail: | 353 | bail: |
354 | spin_unlock(&res->spinlock); | 354 | spin_unlock(&res->spinlock); |
355 | 355 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 4e7b0dc22450..0b055bfb8e86 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1506,7 +1506,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1506 | u64 start, u64 len) | 1506 | u64 start, u64 len) |
1507 | { | 1507 | { |
1508 | int ret = 0; | 1508 | int ret = 0; |
1509 | u64 tmpend, end = start + len; | 1509 | u64 tmpend = 0; |
1510 | u64 end = start + len; | ||
1510 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1511 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1511 | unsigned int csize = osb->s_clustersize; | 1512 | unsigned int csize = osb->s_clustersize; |
1512 | handle_t *handle; | 1513 | handle_t *handle; |
@@ -1538,18 +1539,31 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1538 | } | 1539 | } |
1539 | 1540 | ||
1540 | /* | 1541 | /* |
1541 | * We want to get the byte offset of the end of the 1st cluster. | 1542 | * If start is on a cluster boundary and end is somewhere in another |
1543 | * cluster, we have not COWed the cluster starting at start, unless | ||
1544 | * end is also within the same cluster. So, in this case, we skip this | ||
1545 | * first call to ocfs2_zero_range_for_truncate() truncate and move on | ||
1546 | * to the next one. | ||
1542 | */ | 1547 | */ |
1543 | tmpend = (u64)osb->s_clustersize + (start & ~(osb->s_clustersize - 1)); | 1548 | if ((start & (csize - 1)) != 0) { |
1544 | if (tmpend > end) | 1549 | /* |
1545 | tmpend = end; | 1550 | * We want to get the byte offset of the end of the 1st |
1551 | * cluster. | ||
1552 | */ | ||
1553 | tmpend = (u64)osb->s_clustersize + | ||
1554 | (start & ~(osb->s_clustersize - 1)); | ||
1555 | if (tmpend > end) | ||
1556 | tmpend = end; | ||
1546 | 1557 | ||
1547 | trace_ocfs2_zero_partial_clusters_range1((unsigned long long)start, | 1558 | trace_ocfs2_zero_partial_clusters_range1( |
1548 | (unsigned long long)tmpend); | 1559 | (unsigned long long)start, |
1560 | (unsigned long long)tmpend); | ||
1549 | 1561 | ||
1550 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, tmpend); | 1562 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, |
1551 | if (ret) | 1563 | tmpend); |
1552 | mlog_errno(ret); | 1564 | if (ret) |
1565 | mlog_errno(ret); | ||
1566 | } | ||
1553 | 1567 | ||
1554 | if (tmpend < end) { | 1568 | if (tmpend < end) { |
1555 | /* | 1569 | /* |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index ea47120a85ff..6ad3533940ba 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -1199,14 +1199,24 @@ retry: | |||
1199 | inode_unlock((*ac)->ac_inode); | 1199 | inode_unlock((*ac)->ac_inode); |
1200 | 1200 | ||
1201 | ret = ocfs2_try_to_free_truncate_log(osb, bits_wanted); | 1201 | ret = ocfs2_try_to_free_truncate_log(osb, bits_wanted); |
1202 | if (ret == 1) | 1202 | if (ret == 1) { |
1203 | iput((*ac)->ac_inode); | ||
1204 | (*ac)->ac_inode = NULL; | ||
1203 | goto retry; | 1205 | goto retry; |
1206 | } | ||
1204 | 1207 | ||
1205 | if (ret < 0) | 1208 | if (ret < 0) |
1206 | mlog_errno(ret); | 1209 | mlog_errno(ret); |
1207 | 1210 | ||
1208 | inode_lock((*ac)->ac_inode); | 1211 | inode_lock((*ac)->ac_inode); |
1209 | ocfs2_inode_lock((*ac)->ac_inode, NULL, 1); | 1212 | ret = ocfs2_inode_lock((*ac)->ac_inode, NULL, 1); |
1213 | if (ret < 0) { | ||
1214 | mlog_errno(ret); | ||
1215 | inode_unlock((*ac)->ac_inode); | ||
1216 | iput((*ac)->ac_inode); | ||
1217 | (*ac)->ac_inode = NULL; | ||
1218 | goto bail; | ||
1219 | } | ||
1210 | } | 1220 | } |
1211 | if (status < 0) { | 1221 | if (status < 0) { |
1212 | if (status != -ENOSPC) | 1222 | if (status != -ENOSPC) |
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index a4585f961bf9..e2a94a26767b 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
@@ -835,11 +835,11 @@ retry: | |||
835 | goto out_dput; | 835 | goto out_dput; |
836 | 836 | ||
837 | err = vfs_removexattr(work, XATTR_NAME_POSIX_ACL_DEFAULT); | 837 | err = vfs_removexattr(work, XATTR_NAME_POSIX_ACL_DEFAULT); |
838 | if (err && err != -ENODATA) | 838 | if (err && err != -ENODATA && err != -EOPNOTSUPP) |
839 | goto out_dput; | 839 | goto out_dput; |
840 | 840 | ||
841 | err = vfs_removexattr(work, XATTR_NAME_POSIX_ACL_ACCESS); | 841 | err = vfs_removexattr(work, XATTR_NAME_POSIX_ACL_ACCESS); |
842 | if (err && err != -ENODATA) | 842 | if (err && err != -ENODATA && err != -EOPNOTSUPP) |
843 | goto out_dput; | 843 | goto out_dput; |
844 | 844 | ||
845 | /* Clear any inherited mode bits */ | 845 | /* Clear any inherited mode bits */ |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 187d84ef9de9..f6fa99eca515 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -581,6 +581,8 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, | |||
581 | mss->anonymous_thp += HPAGE_PMD_SIZE; | 581 | mss->anonymous_thp += HPAGE_PMD_SIZE; |
582 | else if (PageSwapBacked(page)) | 582 | else if (PageSwapBacked(page)) |
583 | mss->shmem_thp += HPAGE_PMD_SIZE; | 583 | mss->shmem_thp += HPAGE_PMD_SIZE; |
584 | else if (is_zone_device_page(page)) | ||
585 | /* pass */; | ||
584 | else | 586 | else |
585 | VM_BUG_ON_PAGE(1, page); | 587 | VM_BUG_ON_PAGE(1, page); |
586 | smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd)); | 588 | smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd)); |
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c index 183a212694bf..12af0490322f 100644 --- a/fs/ramfs/file-mmu.c +++ b/fs/ramfs/file-mmu.c | |||
@@ -27,9 +27,17 @@ | |||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/ramfs.h> | 29 | #include <linux/ramfs.h> |
30 | #include <linux/sched.h> | ||
30 | 31 | ||
31 | #include "internal.h" | 32 | #include "internal.h" |
32 | 33 | ||
34 | static unsigned long ramfs_mmu_get_unmapped_area(struct file *file, | ||
35 | unsigned long addr, unsigned long len, unsigned long pgoff, | ||
36 | unsigned long flags) | ||
37 | { | ||
38 | return current->mm->get_unmapped_area(file, addr, len, pgoff, flags); | ||
39 | } | ||
40 | |||
33 | const struct file_operations ramfs_file_operations = { | 41 | const struct file_operations ramfs_file_operations = { |
34 | .read_iter = generic_file_read_iter, | 42 | .read_iter = generic_file_read_iter, |
35 | .write_iter = generic_file_write_iter, | 43 | .write_iter = generic_file_write_iter, |
@@ -38,6 +46,7 @@ const struct file_operations ramfs_file_operations = { | |||
38 | .splice_read = generic_file_splice_read, | 46 | .splice_read = generic_file_splice_read, |
39 | .splice_write = iter_file_splice_write, | 47 | .splice_write = iter_file_splice_write, |
40 | .llseek = generic_file_llseek, | 48 | .llseek = generic_file_llseek, |
49 | .get_unmapped_area = ramfs_mmu_get_unmapped_area, | ||
41 | }; | 50 | }; |
42 | 51 | ||
43 | const struct inode_operations ramfs_file_inode_operations = { | 52 | const struct inode_operations ramfs_file_inode_operations = { |
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index 5dea1fb6979c..6df9b0749671 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h | |||
@@ -231,14 +231,18 @@ extern int __put_user_bad(void) __attribute__((noreturn)); | |||
231 | might_fault(); \ | 231 | might_fault(); \ |
232 | access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \ | 232 | access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \ |
233 | __get_user((x), (__typeof__(*(ptr)) *)__p) : \ | 233 | __get_user((x), (__typeof__(*(ptr)) *)__p) : \ |
234 | -EFAULT; \ | 234 | ((x) = (__typeof__(*(ptr)))0,-EFAULT); \ |
235 | }) | 235 | }) |
236 | 236 | ||
237 | #ifndef __get_user_fn | 237 | #ifndef __get_user_fn |
238 | static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) | 238 | static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) |
239 | { | 239 | { |
240 | size = __copy_from_user(x, ptr, size); | 240 | size_t n = __copy_from_user(x, ptr, size); |
241 | return size ? -EFAULT : size; | 241 | if (unlikely(n)) { |
242 | memset(x + (size - n), 0, n); | ||
243 | return -EFAULT; | ||
244 | } | ||
245 | return 0; | ||
242 | } | 246 | } |
243 | 247 | ||
244 | #define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k) | 248 | #define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k) |
@@ -258,11 +262,13 @@ extern int __get_user_bad(void) __attribute__((noreturn)); | |||
258 | static inline long copy_from_user(void *to, | 262 | static inline long copy_from_user(void *to, |
259 | const void __user * from, unsigned long n) | 263 | const void __user * from, unsigned long n) |
260 | { | 264 | { |
265 | unsigned long res = n; | ||
261 | might_fault(); | 266 | might_fault(); |
262 | if (access_ok(VERIFY_READ, from, n)) | 267 | if (likely(access_ok(VERIFY_READ, from, n))) |
263 | return __copy_from_user(to, from, n); | 268 | res = __copy_from_user(to, from, n); |
264 | else | 269 | if (unlikely(res)) |
265 | return n; | 270 | memset(to + (n - res), 0, res); |
271 | return res; | ||
266 | } | 272 | } |
267 | 273 | ||
268 | static inline long copy_to_user(void __user *to, | 274 | static inline long copy_to_user(void __user *to, |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 436aa4e42221..668569844d37 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -527,13 +527,14 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s | |||
527 | * object's lifetime is managed by something other than RCU. That | 527 | * object's lifetime is managed by something other than RCU. That |
528 | * "something other" might be reference counting or simple immortality. | 528 | * "something other" might be reference counting or simple immortality. |
529 | * | 529 | * |
530 | * The seemingly unused size_t variable is to validate @p is indeed a pointer | 530 | * The seemingly unused variable ___typecheck_p validates that @p is |
531 | * type by making sure it can be dereferenced. | 531 | * indeed a pointer type by using a pointer to typeof(*p) as the type. |
532 | * Taking a pointer to typeof(*p) again is needed in case p is void *. | ||
532 | */ | 533 | */ |
533 | #define lockless_dereference(p) \ | 534 | #define lockless_dereference(p) \ |
534 | ({ \ | 535 | ({ \ |
535 | typeof(p) _________p1 = READ_ONCE(p); \ | 536 | typeof(p) _________p1 = READ_ONCE(p); \ |
536 | size_t __maybe_unused __size_of_ptr = sizeof(*(p)); \ | 537 | typeof(*(p)) *___typecheck_p __maybe_unused; \ |
537 | smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ | 538 | smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ |
538 | (_________p1); \ | 539 | (_________p1); \ |
539 | }) | 540 | }) |
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 242bf530edfc..34bd80512a0c 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __CPUHOTPLUG_H | 1 | #ifndef __CPUHOTPLUG_H |
2 | #define __CPUHOTPLUG_H | 2 | #define __CPUHOTPLUG_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | |||
4 | enum cpuhp_state { | 6 | enum cpuhp_state { |
5 | CPUHP_OFFLINE, | 7 | CPUHP_OFFLINE, |
6 | CPUHP_CREATE_THREADS, | 8 | CPUHP_CREATE_THREADS, |
diff --git a/include/linux/fscrypto.h b/include/linux/fscrypto.h index cfa6cde25f8e..76cff18bb032 100644 --- a/include/linux/fscrypto.h +++ b/include/linux/fscrypto.h | |||
@@ -274,8 +274,7 @@ extern void fscrypt_restore_control_page(struct page *); | |||
274 | extern int fscrypt_zeroout_range(struct inode *, pgoff_t, sector_t, | 274 | extern int fscrypt_zeroout_range(struct inode *, pgoff_t, sector_t, |
275 | unsigned int); | 275 | unsigned int); |
276 | /* policy.c */ | 276 | /* policy.c */ |
277 | extern int fscrypt_process_policy(struct inode *, | 277 | extern int fscrypt_process_policy(struct file *, const struct fscrypt_policy *); |
278 | const struct fscrypt_policy *); | ||
279 | extern int fscrypt_get_policy(struct inode *, struct fscrypt_policy *); | 278 | extern int fscrypt_get_policy(struct inode *, struct fscrypt_policy *); |
280 | extern int fscrypt_has_permitted_context(struct inode *, struct inode *); | 279 | extern int fscrypt_has_permitted_context(struct inode *, struct inode *); |
281 | extern int fscrypt_inherit_context(struct inode *, struct inode *, | 280 | extern int fscrypt_inherit_context(struct inode *, struct inode *, |
@@ -345,7 +344,7 @@ static inline int fscrypt_notsupp_zeroout_range(struct inode *i, pgoff_t p, | |||
345 | } | 344 | } |
346 | 345 | ||
347 | /* policy.c */ | 346 | /* policy.c */ |
348 | static inline int fscrypt_notsupp_process_policy(struct inode *i, | 347 | static inline int fscrypt_notsupp_process_policy(struct file *f, |
349 | const struct fscrypt_policy *p) | 348 | const struct fscrypt_policy *p) |
350 | { | 349 | { |
351 | return -EOPNOTSUPP; | 350 | return -EOPNOTSUPP; |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 58205f33af02..7268ed076be8 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -148,6 +148,7 @@ struct fsnotify_group { | |||
148 | #define FS_PRIO_1 1 /* fanotify content based access control */ | 148 | #define FS_PRIO_1 1 /* fanotify content based access control */ |
149 | #define FS_PRIO_2 2 /* fanotify pre-content access */ | 149 | #define FS_PRIO_2 2 /* fanotify pre-content access */ |
150 | unsigned int priority; | 150 | unsigned int priority; |
151 | bool shutdown; /* group is being shut down, don't queue more events */ | ||
151 | 152 | ||
152 | /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ | 153 | /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ |
153 | struct mutex mark_mutex; /* protect marks_list */ | 154 | struct mutex mark_mutex; /* protect marks_list */ |
@@ -179,7 +180,6 @@ struct fsnotify_group { | |||
179 | spinlock_t access_lock; | 180 | spinlock_t access_lock; |
180 | struct list_head access_list; | 181 | struct list_head access_list; |
181 | wait_queue_head_t access_waitq; | 182 | wait_queue_head_t access_waitq; |
182 | atomic_t bypass_perm; | ||
183 | #endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */ | 183 | #endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */ |
184 | int f_flags; | 184 | int f_flags; |
185 | unsigned int max_marks; | 185 | unsigned int max_marks; |
@@ -292,6 +292,8 @@ extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *op | |||
292 | extern void fsnotify_get_group(struct fsnotify_group *group); | 292 | extern void fsnotify_get_group(struct fsnotify_group *group); |
293 | /* drop reference on a group from fsnotify_alloc_group */ | 293 | /* drop reference on a group from fsnotify_alloc_group */ |
294 | extern void fsnotify_put_group(struct fsnotify_group *group); | 294 | extern void fsnotify_put_group(struct fsnotify_group *group); |
295 | /* group destruction begins, stop queuing new events */ | ||
296 | extern void fsnotify_group_stop_queueing(struct fsnotify_group *group); | ||
295 | /* destroy group */ | 297 | /* destroy group */ |
296 | extern void fsnotify_destroy_group(struct fsnotify_group *group); | 298 | extern void fsnotify_destroy_group(struct fsnotify_group *group); |
297 | /* fasync handler function */ | 299 | /* fasync handler function */ |
@@ -304,8 +306,6 @@ extern int fsnotify_add_event(struct fsnotify_group *group, | |||
304 | struct fsnotify_event *event, | 306 | struct fsnotify_event *event, |
305 | int (*merge)(struct list_head *, | 307 | int (*merge)(struct list_head *, |
306 | struct fsnotify_event *)); | 308 | struct fsnotify_event *)); |
307 | /* Remove passed event from groups notification queue */ | ||
308 | extern void fsnotify_remove_event(struct fsnotify_group *group, struct fsnotify_event *event); | ||
309 | /* true if the group notification queue is empty */ | 309 | /* true if the group notification queue is empty */ |
310 | extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); | 310 | extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); |
311 | /* return, but do not dequeue the first event on the notification queue */ | 311 | /* return, but do not dequeue the first event on the notification queue */ |
diff --git a/include/linux/irq.h b/include/linux/irq.h index b52424eaa0ed..0ac26c892fe2 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -945,6 +945,16 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { } | |||
945 | static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } | 945 | static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } |
946 | #endif | 946 | #endif |
947 | 947 | ||
948 | /* | ||
949 | * The irqsave variants are for usage in non interrupt code. Do not use | ||
950 | * them in irq_chip callbacks. Use irq_gc_lock() instead. | ||
951 | */ | ||
952 | #define irq_gc_lock_irqsave(gc, flags) \ | ||
953 | raw_spin_lock_irqsave(&(gc)->lock, flags) | ||
954 | |||
955 | #define irq_gc_unlock_irqrestore(gc, flags) \ | ||
956 | raw_spin_unlock_irqrestore(&(gc)->lock, flags) | ||
957 | |||
948 | static inline void irq_reg_writel(struct irq_chip_generic *gc, | 958 | static inline void irq_reg_writel(struct irq_chip_generic *gc, |
949 | u32 val, int reg_offset) | 959 | u32 val, int reg_offset) |
950 | { | 960 | { |
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 21bc4557b67a..d1f9a581aca8 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
@@ -6710,9 +6710,10 @@ struct mlx5_ifc_pude_reg_bits { | |||
6710 | }; | 6710 | }; |
6711 | 6711 | ||
6712 | struct mlx5_ifc_ptys_reg_bits { | 6712 | struct mlx5_ifc_ptys_reg_bits { |
6713 | u8 an_disable_cap[0x1]; | 6713 | u8 reserved_at_0[0x1]; |
6714 | u8 an_disable_admin[0x1]; | 6714 | u8 an_disable_admin[0x1]; |
6715 | u8 reserved_at_2[0x6]; | 6715 | u8 an_disable_cap[0x1]; |
6716 | u8 reserved_at_3[0x5]; | ||
6716 | u8 local_port[0x8]; | 6717 | u8 local_port[0x8]; |
6717 | u8 reserved_at_10[0xd]; | 6718 | u8 reserved_at_10[0xd]; |
6718 | u8 proto_mask[0x3]; | 6719 | u8 proto_mask[0x3]; |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3a788bf0affd..e8d79d4ebcfe 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -3267,6 +3267,7 @@ static inline void napi_free_frags(struct napi_struct *napi) | |||
3267 | napi->skb = NULL; | 3267 | napi->skb = NULL; |
3268 | } | 3268 | } |
3269 | 3269 | ||
3270 | bool netdev_is_rx_handler_busy(struct net_device *dev); | ||
3270 | int netdev_rx_handler_register(struct net_device *dev, | 3271 | int netdev_rx_handler_register(struct net_device *dev, |
3271 | rx_handler_func_t *rx_handler, | 3272 | rx_handler_func_t *rx_handler, |
3272 | void *rx_handler_data); | 3273 | void *rx_handler_data); |
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index cbd8990e2e77..2b5b10eed74f 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h | |||
@@ -118,10 +118,11 @@ static inline int arch_within_stack_frames(const void * const stack, | |||
118 | extern void __check_object_size(const void *ptr, unsigned long n, | 118 | extern void __check_object_size(const void *ptr, unsigned long n, |
119 | bool to_user); | 119 | bool to_user); |
120 | 120 | ||
121 | static inline void check_object_size(const void *ptr, unsigned long n, | 121 | static __always_inline void check_object_size(const void *ptr, unsigned long n, |
122 | bool to_user) | 122 | bool to_user) |
123 | { | 123 | { |
124 | __check_object_size(ptr, n, to_user); | 124 | if (!__builtin_constant_p(n)) |
125 | __check_object_size(ptr, n, to_user); | ||
125 | } | 126 | } |
126 | #else | 127 | #else |
127 | static inline void check_object_size(const void *ptr, unsigned long n, | 128 | static inline void check_object_size(const void *ptr, unsigned long n, |
diff --git a/include/linux/uio.h b/include/linux/uio.h index 1b5d1cd796e2..75b4aaf31a9d 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
@@ -76,7 +76,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page, | |||
76 | struct iov_iter *i, unsigned long offset, size_t bytes); | 76 | struct iov_iter *i, unsigned long offset, size_t bytes); |
77 | void iov_iter_advance(struct iov_iter *i, size_t bytes); | 77 | void iov_iter_advance(struct iov_iter *i, size_t bytes); |
78 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); | 78 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); |
79 | int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes); | 79 | #define iov_iter_fault_in_multipages_readable iov_iter_fault_in_readable |
80 | size_t iov_iter_single_seg_count(const struct iov_iter *i); | 80 | size_t iov_iter_single_seg_count(const struct iov_iter *i); |
81 | size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, | 81 | size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, |
82 | struct iov_iter *i); | 82 | struct iov_iter *i); |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 9b4c418bebd8..fd60eccb59a6 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -52,7 +52,7 @@ struct unix_sock { | |||
52 | struct sock sk; | 52 | struct sock sk; |
53 | struct unix_address *addr; | 53 | struct unix_address *addr; |
54 | struct path path; | 54 | struct path path; |
55 | struct mutex readlock; | 55 | struct mutex iolock, bindlock; |
56 | struct sock *peer; | 56 | struct sock *peer; |
57 | struct list_head link; | 57 | struct list_head link; |
58 | atomic_long_t inflight; | 58 | atomic_long_t inflight; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9c23f4d33e06..beb7610d64e9 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1102,6 +1102,7 @@ struct station_info { | |||
1102 | struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; | 1102 | struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; |
1103 | }; | 1103 | }; |
1104 | 1104 | ||
1105 | #if IS_ENABLED(CONFIG_CFG80211) | ||
1105 | /** | 1106 | /** |
1106 | * cfg80211_get_station - retrieve information about a given station | 1107 | * cfg80211_get_station - retrieve information about a given station |
1107 | * @dev: the device where the station is supposed to be connected to | 1108 | * @dev: the device where the station is supposed to be connected to |
@@ -1114,6 +1115,14 @@ struct station_info { | |||
1114 | */ | 1115 | */ |
1115 | int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, | 1116 | int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, |
1116 | struct station_info *sinfo); | 1117 | struct station_info *sinfo); |
1118 | #else | ||
1119 | static inline int cfg80211_get_station(struct net_device *dev, | ||
1120 | const u8 *mac_addr, | ||
1121 | struct station_info *sinfo) | ||
1122 | { | ||
1123 | return -ENOENT; | ||
1124 | } | ||
1125 | #endif | ||
1117 | 1126 | ||
1118 | /** | 1127 | /** |
1119 | * enum monitor_flags - monitor flags | 1128 | * enum monitor_flags - monitor flags |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 4079fc18ffe4..7d4a72e75f33 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -111,6 +111,7 @@ struct fib_info { | |||
111 | unsigned char fib_scope; | 111 | unsigned char fib_scope; |
112 | unsigned char fib_type; | 112 | unsigned char fib_type; |
113 | __be32 fib_prefsrc; | 113 | __be32 fib_prefsrc; |
114 | u32 fib_tb_id; | ||
114 | u32 fib_priority; | 115 | u32 fib_priority; |
115 | u32 *fib_metrics; | 116 | u32 *fib_metrics; |
116 | #define fib_mtu fib_metrics[RTAX_MTU-1] | 117 | #define fib_mtu fib_metrics[RTAX_MTU-1] |
@@ -319,7 +320,7 @@ void fib_flush_external(struct net *net); | |||
319 | /* Exported by fib_semantics.c */ | 320 | /* Exported by fib_semantics.c */ |
320 | int ip_fib_check_default(__be32 gw, struct net_device *dev); | 321 | int ip_fib_check_default(__be32 gw, struct net_device *dev); |
321 | int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); | 322 | int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); |
322 | int fib_sync_down_addr(struct net *net, __be32 local); | 323 | int fib_sync_down_addr(struct net_device *dev, __be32 local); |
323 | int fib_sync_up(struct net_device *dev, unsigned int nh_flags); | 324 | int fib_sync_up(struct net_device *dev, unsigned int nh_flags); |
324 | 325 | ||
325 | extern u32 fib_multipath_secret __read_mostly; | 326 | extern u32 fib_multipath_secret __read_mostly; |
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h index d27588c8dbd9..1139cde0fdc5 100644 --- a/include/net/netfilter/nft_meta.h +++ b/include/net/netfilter/nft_meta.h | |||
@@ -36,4 +36,8 @@ void nft_meta_set_eval(const struct nft_expr *expr, | |||
36 | void nft_meta_set_destroy(const struct nft_ctx *ctx, | 36 | void nft_meta_set_destroy(const struct nft_ctx *ctx, |
37 | const struct nft_expr *expr); | 37 | const struct nft_expr *expr); |
38 | 38 | ||
39 | int nft_meta_set_validate(const struct nft_ctx *ctx, | ||
40 | const struct nft_expr *expr, | ||
41 | const struct nft_data **data); | ||
42 | |||
39 | #endif | 43 | #endif |
diff --git a/include/net/netfilter/nft_reject.h b/include/net/netfilter/nft_reject.h index 60fa1530006b..02e28c529b29 100644 --- a/include/net/netfilter/nft_reject.h +++ b/include/net/netfilter/nft_reject.h | |||
@@ -8,6 +8,10 @@ struct nft_reject { | |||
8 | 8 | ||
9 | extern const struct nla_policy nft_reject_policy[]; | 9 | extern const struct nla_policy nft_reject_policy[]; |
10 | 10 | ||
11 | int nft_reject_validate(const struct nft_ctx *ctx, | ||
12 | const struct nft_expr *expr, | ||
13 | const struct nft_data **data); | ||
14 | |||
11 | int nft_reject_init(const struct nft_ctx *ctx, | 15 | int nft_reject_init(const struct nft_ctx *ctx, |
12 | const struct nft_expr *expr, | 16 | const struct nft_expr *expr, |
13 | const struct nlattr * const tb[]); | 17 | const struct nlattr * const tb[]); |
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index 13c0b2ba1b6c..73d870918939 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h | |||
@@ -11,12 +11,12 @@ struct sas_rphy; | |||
11 | struct request; | 11 | struct request; |
12 | 12 | ||
13 | #if !IS_ENABLED(CONFIG_SCSI_SAS_ATTRS) | 13 | #if !IS_ENABLED(CONFIG_SCSI_SAS_ATTRS) |
14 | static inline int is_sas_attached(struct scsi_device *sdev) | 14 | static inline int scsi_is_sas_rphy(const struct device *sdev) |
15 | { | 15 | { |
16 | return 0; | 16 | return 0; |
17 | } | 17 | } |
18 | #else | 18 | #else |
19 | extern int is_sas_attached(struct scsi_device *sdev); | 19 | extern int scsi_is_sas_rphy(const struct device *); |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | static inline int sas_protocol_ata(enum sas_protocol proto) | 22 | static inline int sas_protocol_ata(enum sas_protocol proto) |
@@ -202,7 +202,6 @@ extern int sas_rphy_add(struct sas_rphy *); | |||
202 | extern void sas_rphy_remove(struct sas_rphy *); | 202 | extern void sas_rphy_remove(struct sas_rphy *); |
203 | extern void sas_rphy_delete(struct sas_rphy *); | 203 | extern void sas_rphy_delete(struct sas_rphy *); |
204 | extern void sas_rphy_unlink(struct sas_rphy *); | 204 | extern void sas_rphy_unlink(struct sas_rphy *); |
205 | extern int scsi_is_sas_rphy(const struct device *); | ||
206 | 205 | ||
207 | struct sas_port *sas_port_alloc(struct device *, int); | 206 | struct sas_port *sas_port_alloc(struct device *, int); |
208 | struct sas_port *sas_port_alloc_num(struct device *); | 207 | struct sas_port *sas_port_alloc_num(struct device *); |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index d1c51b7f5221..5e8dab5bf9ad 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -6270,6 +6270,12 @@ void cgroup_sk_alloc(struct sock_cgroup_data *skcd) | |||
6270 | if (cgroup_sk_alloc_disabled) | 6270 | if (cgroup_sk_alloc_disabled) |
6271 | return; | 6271 | return; |
6272 | 6272 | ||
6273 | /* Socket clone path */ | ||
6274 | if (skcd->val) { | ||
6275 | cgroup_get(sock_cgroup_ptr(skcd)); | ||
6276 | return; | ||
6277 | } | ||
6278 | |||
6273 | rcu_read_lock(); | 6279 | rcu_read_lock(); |
6274 | 6280 | ||
6275 | while (true) { | 6281 | while (true) { |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 3cfabdf7b942..a54f2c2cdb20 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -2496,11 +2496,11 @@ static int __perf_event_stop(void *info) | |||
2496 | return 0; | 2496 | return 0; |
2497 | } | 2497 | } |
2498 | 2498 | ||
2499 | static int perf_event_restart(struct perf_event *event) | 2499 | static int perf_event_stop(struct perf_event *event, int restart) |
2500 | { | 2500 | { |
2501 | struct stop_event_data sd = { | 2501 | struct stop_event_data sd = { |
2502 | .event = event, | 2502 | .event = event, |
2503 | .restart = 1, | 2503 | .restart = restart, |
2504 | }; | 2504 | }; |
2505 | int ret = 0; | 2505 | int ret = 0; |
2506 | 2506 | ||
@@ -3549,10 +3549,18 @@ static int perf_event_read(struct perf_event *event, bool group) | |||
3549 | .group = group, | 3549 | .group = group, |
3550 | .ret = 0, | 3550 | .ret = 0, |
3551 | }; | 3551 | }; |
3552 | ret = smp_call_function_single(event->oncpu, __perf_event_read, &data, 1); | 3552 | /* |
3553 | /* The event must have been read from an online CPU: */ | 3553 | * Purposely ignore the smp_call_function_single() return |
3554 | WARN_ON_ONCE(ret); | 3554 | * value. |
3555 | ret = ret ? : data.ret; | 3555 | * |
3556 | * If event->oncpu isn't a valid CPU it means the event got | ||
3557 | * scheduled out and that will have updated the event count. | ||
3558 | * | ||
3559 | * Therefore, either way, we'll have an up-to-date event count | ||
3560 | * after this. | ||
3561 | */ | ||
3562 | (void)smp_call_function_single(event->oncpu, __perf_event_read, &data, 1); | ||
3563 | ret = data.ret; | ||
3556 | } else if (event->state == PERF_EVENT_STATE_INACTIVE) { | 3564 | } else if (event->state == PERF_EVENT_STATE_INACTIVE) { |
3557 | struct perf_event_context *ctx = event->ctx; | 3565 | struct perf_event_context *ctx = event->ctx; |
3558 | unsigned long flags; | 3566 | unsigned long flags; |
@@ -4837,6 +4845,19 @@ static void ring_buffer_attach(struct perf_event *event, | |||
4837 | spin_unlock_irqrestore(&rb->event_lock, flags); | 4845 | spin_unlock_irqrestore(&rb->event_lock, flags); |
4838 | } | 4846 | } |
4839 | 4847 | ||
4848 | /* | ||
4849 | * Avoid racing with perf_mmap_close(AUX): stop the event | ||
4850 | * before swizzling the event::rb pointer; if it's getting | ||
4851 | * unmapped, its aux_mmap_count will be 0 and it won't | ||
4852 | * restart. See the comment in __perf_pmu_output_stop(). | ||
4853 | * | ||
4854 | * Data will inevitably be lost when set_output is done in | ||
4855 | * mid-air, but then again, whoever does it like this is | ||
4856 | * not in for the data anyway. | ||
4857 | */ | ||
4858 | if (has_aux(event)) | ||
4859 | perf_event_stop(event, 0); | ||
4860 | |||
4840 | rcu_assign_pointer(event->rb, rb); | 4861 | rcu_assign_pointer(event->rb, rb); |
4841 | 4862 | ||
4842 | if (old_rb) { | 4863 | if (old_rb) { |
@@ -6112,7 +6133,7 @@ static void perf_event_addr_filters_exec(struct perf_event *event, void *data) | |||
6112 | raw_spin_unlock_irqrestore(&ifh->lock, flags); | 6133 | raw_spin_unlock_irqrestore(&ifh->lock, flags); |
6113 | 6134 | ||
6114 | if (restart) | 6135 | if (restart) |
6115 | perf_event_restart(event); | 6136 | perf_event_stop(event, 1); |
6116 | } | 6137 | } |
6117 | 6138 | ||
6118 | void perf_event_exec(void) | 6139 | void perf_event_exec(void) |
@@ -6156,7 +6177,13 @@ static void __perf_event_output_stop(struct perf_event *event, void *data) | |||
6156 | 6177 | ||
6157 | /* | 6178 | /* |
6158 | * In case of inheritance, it will be the parent that links to the | 6179 | * In case of inheritance, it will be the parent that links to the |
6159 | * ring-buffer, but it will be the child that's actually using it: | 6180 | * ring-buffer, but it will be the child that's actually using it. |
6181 | * | ||
6182 | * We are using event::rb to determine if the event should be stopped, | ||
6183 | * however this may race with ring_buffer_attach() (through set_output), | ||
6184 | * which will make us skip the event that actually needs to be stopped. | ||
6185 | * So ring_buffer_attach() has to stop an aux event before re-assigning | ||
6186 | * its rb pointer. | ||
6160 | */ | 6187 | */ |
6161 | if (rcu_dereference(parent->rb) == rb) | 6188 | if (rcu_dereference(parent->rb) == rb) |
6162 | ro->err = __perf_event_stop(&sd); | 6189 | ro->err = __perf_event_stop(&sd); |
@@ -6670,7 +6697,7 @@ static void __perf_addr_filters_adjust(struct perf_event *event, void *data) | |||
6670 | raw_spin_unlock_irqrestore(&ifh->lock, flags); | 6697 | raw_spin_unlock_irqrestore(&ifh->lock, flags); |
6671 | 6698 | ||
6672 | if (restart) | 6699 | if (restart) |
6673 | perf_event_restart(event); | 6700 | perf_event_stop(event, 1); |
6674 | } | 6701 | } |
6675 | 6702 | ||
6676 | /* | 6703 | /* |
@@ -7859,7 +7886,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event) | |||
7859 | mmput(mm); | 7886 | mmput(mm); |
7860 | 7887 | ||
7861 | restart: | 7888 | restart: |
7862 | perf_event_restart(event); | 7889 | perf_event_stop(event, 1); |
7863 | } | 7890 | } |
7864 | 7891 | ||
7865 | /* | 7892 | /* |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index ae9b90dc9a5a..257fa460b846 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -330,15 +330,22 @@ void *perf_aux_output_begin(struct perf_output_handle *handle, | |||
330 | if (!rb) | 330 | if (!rb) |
331 | return NULL; | 331 | return NULL; |
332 | 332 | ||
333 | if (!rb_has_aux(rb) || !atomic_inc_not_zero(&rb->aux_refcount)) | 333 | if (!rb_has_aux(rb)) |
334 | goto err; | 334 | goto err; |
335 | 335 | ||
336 | /* | 336 | /* |
337 | * If rb::aux_mmap_count is zero (and rb_has_aux() above went through), | 337 | * If aux_mmap_count is zero, the aux buffer is in perf_mmap_close(), |
338 | * the aux buffer is in perf_mmap_close(), about to get freed. | 338 | * about to get freed, so we leave immediately. |
339 | * | ||
340 | * Checking rb::aux_mmap_count and rb::refcount has to be done in | ||
341 | * the same order, see perf_mmap_close. Otherwise we end up freeing | ||
342 | * aux pages in this path, which is a bug, because in_atomic(). | ||
339 | */ | 343 | */ |
340 | if (!atomic_read(&rb->aux_mmap_count)) | 344 | if (!atomic_read(&rb->aux_mmap_count)) |
341 | goto err_put; | 345 | goto err; |
346 | |||
347 | if (!atomic_inc_not_zero(&rb->aux_refcount)) | ||
348 | goto err; | ||
342 | 349 | ||
343 | /* | 350 | /* |
344 | * Nesting is not supported for AUX area, make sure nested | 351 | * Nesting is not supported for AUX area, make sure nested |
diff --git a/kernel/memremap.c b/kernel/memremap.c index 251d16b4cb41..b501e390bb34 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c | |||
@@ -247,6 +247,7 @@ static void devm_memremap_pages_release(struct device *dev, void *data) | |||
247 | align_start = res->start & ~(SECTION_SIZE - 1); | 247 | align_start = res->start & ~(SECTION_SIZE - 1); |
248 | align_size = ALIGN(resource_size(res), SECTION_SIZE); | 248 | align_size = ALIGN(resource_size(res), SECTION_SIZE); |
249 | arch_remove_memory(align_start, align_size); | 249 | arch_remove_memory(align_start, align_size); |
250 | untrack_pfn(NULL, PHYS_PFN(align_start), align_size); | ||
250 | pgmap_radix_release(res); | 251 | pgmap_radix_release(res); |
251 | dev_WARN_ONCE(dev, pgmap->altmap && pgmap->altmap->alloc, | 252 | dev_WARN_ONCE(dev, pgmap->altmap && pgmap->altmap->alloc, |
252 | "%s: failed to free all reserved pages\n", __func__); | 253 | "%s: failed to free all reserved pages\n", __func__); |
@@ -282,6 +283,7 @@ void *devm_memremap_pages(struct device *dev, struct resource *res, | |||
282 | struct percpu_ref *ref, struct vmem_altmap *altmap) | 283 | struct percpu_ref *ref, struct vmem_altmap *altmap) |
283 | { | 284 | { |
284 | resource_size_t key, align_start, align_size, align_end; | 285 | resource_size_t key, align_start, align_size, align_end; |
286 | pgprot_t pgprot = PAGE_KERNEL; | ||
285 | struct dev_pagemap *pgmap; | 287 | struct dev_pagemap *pgmap; |
286 | struct page_map *page_map; | 288 | struct page_map *page_map; |
287 | int error, nid, is_ram; | 289 | int error, nid, is_ram; |
@@ -351,6 +353,11 @@ void *devm_memremap_pages(struct device *dev, struct resource *res, | |||
351 | if (nid < 0) | 353 | if (nid < 0) |
352 | nid = numa_mem_id(); | 354 | nid = numa_mem_id(); |
353 | 355 | ||
356 | error = track_pfn_remap(NULL, &pgprot, PHYS_PFN(align_start), 0, | ||
357 | align_size); | ||
358 | if (error) | ||
359 | goto err_pfn_remap; | ||
360 | |||
354 | error = arch_add_memory(nid, align_start, align_size, true); | 361 | error = arch_add_memory(nid, align_start, align_size, true); |
355 | if (error) | 362 | if (error) |
356 | goto err_add_memory; | 363 | goto err_add_memory; |
@@ -371,6 +378,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res, | |||
371 | return __va(res->start); | 378 | return __va(res->start); |
372 | 379 | ||
373 | err_add_memory: | 380 | err_add_memory: |
381 | untrack_pfn(NULL, PHYS_PFN(align_start), align_size); | ||
382 | err_pfn_remap: | ||
374 | err_radix: | 383 | err_radix: |
375 | pgmap_radix_release(res); | 384 | pgmap_radix_release(res); |
376 | devres_free(page_map); | 385 | devres_free(page_map); |
diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 97b0df71303e..168ff442ebde 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c | |||
@@ -482,7 +482,16 @@ void pm_qos_update_request(struct pm_qos_request *req, | |||
482 | return; | 482 | return; |
483 | } | 483 | } |
484 | 484 | ||
485 | cancel_delayed_work_sync(&req->work); | 485 | /* |
486 | * This function may be called very early during boot, for example, | ||
487 | * from of_clk_init(), where irq needs to stay disabled. | ||
488 | * cancel_delayed_work_sync() assumes that irq is enabled on | ||
489 | * invocation and re-enables it on return. Avoid calling it until | ||
490 | * workqueue is initialized. | ||
491 | */ | ||
492 | if (keventd_up()) | ||
493 | cancel_delayed_work_sync(&req->work); | ||
494 | |||
486 | __pm_qos_update_request(req, new_value); | 495 | __pm_qos_update_request(req, new_value); |
487 | } | 496 | } |
488 | EXPORT_SYMBOL_GPL(pm_qos_update_request); | 497 | EXPORT_SYMBOL_GPL(pm_qos_update_request); |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 2a906f20fba7..44817c640e99 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -2016,6 +2016,28 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) | |||
2016 | success = 1; /* we're going to change ->state */ | 2016 | success = 1; /* we're going to change ->state */ |
2017 | cpu = task_cpu(p); | 2017 | cpu = task_cpu(p); |
2018 | 2018 | ||
2019 | /* | ||
2020 | * Ensure we load p->on_rq _after_ p->state, otherwise it would | ||
2021 | * be possible to, falsely, observe p->on_rq == 0 and get stuck | ||
2022 | * in smp_cond_load_acquire() below. | ||
2023 | * | ||
2024 | * sched_ttwu_pending() try_to_wake_up() | ||
2025 | * [S] p->on_rq = 1; [L] P->state | ||
2026 | * UNLOCK rq->lock -----. | ||
2027 | * \ | ||
2028 | * +--- RMB | ||
2029 | * schedule() / | ||
2030 | * LOCK rq->lock -----' | ||
2031 | * UNLOCK rq->lock | ||
2032 | * | ||
2033 | * [task p] | ||
2034 | * [S] p->state = UNINTERRUPTIBLE [L] p->on_rq | ||
2035 | * | ||
2036 | * Pairs with the UNLOCK+LOCK on rq->lock from the | ||
2037 | * last wakeup of our task and the schedule that got our task | ||
2038 | * current. | ||
2039 | */ | ||
2040 | smp_rmb(); | ||
2019 | if (p->on_rq && ttwu_remote(p, wake_flags)) | 2041 | if (p->on_rq && ttwu_remote(p, wake_flags)) |
2020 | goto stat; | 2042 | goto stat; |
2021 | 2043 | ||
diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 9e8c7386b3a0..7e3138cfc8c9 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c | |||
@@ -291,33 +291,13 @@ done: | |||
291 | } | 291 | } |
292 | 292 | ||
293 | /* | 293 | /* |
294 | * Fault in the first iovec of the given iov_iter, to a maximum length | ||
295 | * of bytes. Returns 0 on success, or non-zero if the memory could not be | ||
296 | * accessed (ie. because it is an invalid address). | ||
297 | * | ||
298 | * writev-intensive code may want this to prefault several iovecs -- that | ||
299 | * would be possible (callers must not rely on the fact that _only_ the | ||
300 | * first iovec will be faulted with the current implementation). | ||
301 | */ | ||
302 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) | ||
303 | { | ||
304 | if (!(i->type & (ITER_BVEC|ITER_KVEC))) { | ||
305 | char __user *buf = i->iov->iov_base + i->iov_offset; | ||
306 | bytes = min(bytes, i->iov->iov_len - i->iov_offset); | ||
307 | return fault_in_pages_readable(buf, bytes); | ||
308 | } | ||
309 | return 0; | ||
310 | } | ||
311 | EXPORT_SYMBOL(iov_iter_fault_in_readable); | ||
312 | |||
313 | /* | ||
314 | * Fault in one or more iovecs of the given iov_iter, to a maximum length of | 294 | * Fault in one or more iovecs of the given iov_iter, to a maximum length of |
315 | * bytes. For each iovec, fault in each page that constitutes the iovec. | 295 | * bytes. For each iovec, fault in each page that constitutes the iovec. |
316 | * | 296 | * |
317 | * Return 0 on success, or non-zero if the memory could not be accessed (i.e. | 297 | * Return 0 on success, or non-zero if the memory could not be accessed (i.e. |
318 | * because it is an invalid address). | 298 | * because it is an invalid address). |
319 | */ | 299 | */ |
320 | int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes) | 300 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) |
321 | { | 301 | { |
322 | size_t skip = i->iov_offset; | 302 | size_t skip = i->iov_offset; |
323 | const struct iovec *iov; | 303 | const struct iovec *iov; |
@@ -334,7 +314,7 @@ int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes) | |||
334 | } | 314 | } |
335 | return 0; | 315 | return 0; |
336 | } | 316 | } |
337 | EXPORT_SYMBOL(iov_iter_fault_in_multipages_readable); | 317 | EXPORT_SYMBOL(iov_iter_fault_in_readable); |
338 | 318 | ||
339 | void iov_iter_init(struct iov_iter *i, int direction, | 319 | void iov_iter_init(struct iov_iter *i, int direction, |
340 | const struct iovec *iov, unsigned long nr_segs, | 320 | const struct iovec *iov, unsigned long nr_segs, |
diff --git a/mm/debug.c b/mm/debug.c index 8865bfb41b0b..74c7cae4f683 100644 --- a/mm/debug.c +++ b/mm/debug.c | |||
@@ -42,9 +42,11 @@ const struct trace_print_flags vmaflag_names[] = { | |||
42 | 42 | ||
43 | void __dump_page(struct page *page, const char *reason) | 43 | void __dump_page(struct page *page, const char *reason) |
44 | { | 44 | { |
45 | int mapcount = PageSlab(page) ? 0 : page_mapcount(page); | ||
46 | |||
45 | pr_emerg("page:%p count:%d mapcount:%d mapping:%p index:%#lx", | 47 | pr_emerg("page:%p count:%d mapcount:%d mapping:%p index:%#lx", |
46 | page, page_ref_count(page), page_mapcount(page), | 48 | page, page_ref_count(page), mapcount, |
47 | page->mapping, page->index); | 49 | page->mapping, page_to_pgoff(page)); |
48 | if (PageCompound(page)) | 50 | if (PageCompound(page)) |
49 | pr_cont(" compound_mapcount: %d", compound_mapcount(page)); | 51 | pr_cont(" compound_mapcount: %d", compound_mapcount(page)); |
50 | pr_cont("\n"); | 52 | pr_cont("\n"); |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 2db2112aa31e..a6abd76baa72 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1078,7 +1078,7 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, | |||
1078 | goto out; | 1078 | goto out; |
1079 | 1079 | ||
1080 | page = pmd_page(*pmd); | 1080 | page = pmd_page(*pmd); |
1081 | VM_BUG_ON_PAGE(!PageHead(page), page); | 1081 | VM_BUG_ON_PAGE(!PageHead(page) && !is_zone_device_page(page), page); |
1082 | if (flags & FOLL_TOUCH) | 1082 | if (flags & FOLL_TOUCH) |
1083 | touch_pmd(vma, addr, pmd); | 1083 | touch_pmd(vma, addr, pmd); |
1084 | if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) { | 1084 | if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) { |
@@ -1116,7 +1116,7 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, | |||
1116 | } | 1116 | } |
1117 | skip_mlock: | 1117 | skip_mlock: |
1118 | page += (addr & ~HPAGE_PMD_MASK) >> PAGE_SHIFT; | 1118 | page += (addr & ~HPAGE_PMD_MASK) >> PAGE_SHIFT; |
1119 | VM_BUG_ON_PAGE(!PageCompound(page), page); | 1119 | VM_BUG_ON_PAGE(!PageCompound(page) && !is_zone_device_page(page), page); |
1120 | if (flags & FOLL_GET) | 1120 | if (flags & FOLL_GET) |
1121 | get_page(page); | 1121 | get_page(page); |
1122 | 1122 | ||
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 79c52d0061af..728d7790dc2d 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c | |||
@@ -838,7 +838,8 @@ static bool hugepage_vma_check(struct vm_area_struct *vma) | |||
838 | * value (scan code). | 838 | * value (scan code). |
839 | */ | 839 | */ |
840 | 840 | ||
841 | static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address) | 841 | static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address, |
842 | struct vm_area_struct **vmap) | ||
842 | { | 843 | { |
843 | struct vm_area_struct *vma; | 844 | struct vm_area_struct *vma; |
844 | unsigned long hstart, hend; | 845 | unsigned long hstart, hend; |
@@ -846,7 +847,7 @@ static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address) | |||
846 | if (unlikely(khugepaged_test_exit(mm))) | 847 | if (unlikely(khugepaged_test_exit(mm))) |
847 | return SCAN_ANY_PROCESS; | 848 | return SCAN_ANY_PROCESS; |
848 | 849 | ||
849 | vma = find_vma(mm, address); | 850 | *vmap = vma = find_vma(mm, address); |
850 | if (!vma) | 851 | if (!vma) |
851 | return SCAN_VMA_NULL; | 852 | return SCAN_VMA_NULL; |
852 | 853 | ||
@@ -881,6 +882,11 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, | |||
881 | .pmd = pmd, | 882 | .pmd = pmd, |
882 | }; | 883 | }; |
883 | 884 | ||
885 | /* we only decide to swapin, if there is enough young ptes */ | ||
886 | if (referenced < HPAGE_PMD_NR/2) { | ||
887 | trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); | ||
888 | return false; | ||
889 | } | ||
884 | fe.pte = pte_offset_map(pmd, address); | 890 | fe.pte = pte_offset_map(pmd, address); |
885 | for (; fe.address < address + HPAGE_PMD_NR*PAGE_SIZE; | 891 | for (; fe.address < address + HPAGE_PMD_NR*PAGE_SIZE; |
886 | fe.pte++, fe.address += PAGE_SIZE) { | 892 | fe.pte++, fe.address += PAGE_SIZE) { |
@@ -888,17 +894,12 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, | |||
888 | if (!is_swap_pte(pteval)) | 894 | if (!is_swap_pte(pteval)) |
889 | continue; | 895 | continue; |
890 | swapped_in++; | 896 | swapped_in++; |
891 | /* we only decide to swapin, if there is enough young ptes */ | ||
892 | if (referenced < HPAGE_PMD_NR/2) { | ||
893 | trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); | ||
894 | return false; | ||
895 | } | ||
896 | ret = do_swap_page(&fe, pteval); | 897 | ret = do_swap_page(&fe, pteval); |
897 | 898 | ||
898 | /* do_swap_page returns VM_FAULT_RETRY with released mmap_sem */ | 899 | /* do_swap_page returns VM_FAULT_RETRY with released mmap_sem */ |
899 | if (ret & VM_FAULT_RETRY) { | 900 | if (ret & VM_FAULT_RETRY) { |
900 | down_read(&mm->mmap_sem); | 901 | down_read(&mm->mmap_sem); |
901 | if (hugepage_vma_revalidate(mm, address)) { | 902 | if (hugepage_vma_revalidate(mm, address, &fe.vma)) { |
902 | /* vma is no longer available, don't continue to swapin */ | 903 | /* vma is no longer available, don't continue to swapin */ |
903 | trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); | 904 | trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); |
904 | return false; | 905 | return false; |
@@ -923,7 +924,6 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, | |||
923 | static void collapse_huge_page(struct mm_struct *mm, | 924 | static void collapse_huge_page(struct mm_struct *mm, |
924 | unsigned long address, | 925 | unsigned long address, |
925 | struct page **hpage, | 926 | struct page **hpage, |
926 | struct vm_area_struct *vma, | ||
927 | int node, int referenced) | 927 | int node, int referenced) |
928 | { | 928 | { |
929 | pmd_t *pmd, _pmd; | 929 | pmd_t *pmd, _pmd; |
@@ -933,6 +933,7 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
933 | spinlock_t *pmd_ptl, *pte_ptl; | 933 | spinlock_t *pmd_ptl, *pte_ptl; |
934 | int isolated = 0, result = 0; | 934 | int isolated = 0, result = 0; |
935 | struct mem_cgroup *memcg; | 935 | struct mem_cgroup *memcg; |
936 | struct vm_area_struct *vma; | ||
936 | unsigned long mmun_start; /* For mmu_notifiers */ | 937 | unsigned long mmun_start; /* For mmu_notifiers */ |
937 | unsigned long mmun_end; /* For mmu_notifiers */ | 938 | unsigned long mmun_end; /* For mmu_notifiers */ |
938 | gfp_t gfp; | 939 | gfp_t gfp; |
@@ -961,7 +962,7 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
961 | } | 962 | } |
962 | 963 | ||
963 | down_read(&mm->mmap_sem); | 964 | down_read(&mm->mmap_sem); |
964 | result = hugepage_vma_revalidate(mm, address); | 965 | result = hugepage_vma_revalidate(mm, address, &vma); |
965 | if (result) { | 966 | if (result) { |
966 | mem_cgroup_cancel_charge(new_page, memcg, true); | 967 | mem_cgroup_cancel_charge(new_page, memcg, true); |
967 | up_read(&mm->mmap_sem); | 968 | up_read(&mm->mmap_sem); |
@@ -994,7 +995,7 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
994 | * handled by the anon_vma lock + PG_lock. | 995 | * handled by the anon_vma lock + PG_lock. |
995 | */ | 996 | */ |
996 | down_write(&mm->mmap_sem); | 997 | down_write(&mm->mmap_sem); |
997 | result = hugepage_vma_revalidate(mm, address); | 998 | result = hugepage_vma_revalidate(mm, address, &vma); |
998 | if (result) | 999 | if (result) |
999 | goto out; | 1000 | goto out; |
1000 | /* check if the pmd is still valid */ | 1001 | /* check if the pmd is still valid */ |
@@ -1202,7 +1203,7 @@ out_unmap: | |||
1202 | if (ret) { | 1203 | if (ret) { |
1203 | node = khugepaged_find_target_node(); | 1204 | node = khugepaged_find_target_node(); |
1204 | /* collapse_huge_page will return with the mmap_sem released */ | 1205 | /* collapse_huge_page will return with the mmap_sem released */ |
1205 | collapse_huge_page(mm, address, hpage, vma, node, referenced); | 1206 | collapse_huge_page(mm, address, hpage, node, referenced); |
1206 | } | 1207 | } |
1207 | out: | 1208 | out: |
1208 | trace_mm_khugepaged_scan_pmd(mm, page, writable, referenced, | 1209 | trace_mm_khugepaged_scan_pmd(mm, page, writable, referenced, |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9a6a51a7c416..4be518d4e68a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1740,17 +1740,22 @@ static DEFINE_MUTEX(percpu_charge_mutex); | |||
1740 | static bool consume_stock(struct mem_cgroup *memcg, unsigned int nr_pages) | 1740 | static bool consume_stock(struct mem_cgroup *memcg, unsigned int nr_pages) |
1741 | { | 1741 | { |
1742 | struct memcg_stock_pcp *stock; | 1742 | struct memcg_stock_pcp *stock; |
1743 | unsigned long flags; | ||
1743 | bool ret = false; | 1744 | bool ret = false; |
1744 | 1745 | ||
1745 | if (nr_pages > CHARGE_BATCH) | 1746 | if (nr_pages > CHARGE_BATCH) |
1746 | return ret; | 1747 | return ret; |
1747 | 1748 | ||
1748 | stock = &get_cpu_var(memcg_stock); | 1749 | local_irq_save(flags); |
1750 | |||
1751 | stock = this_cpu_ptr(&memcg_stock); | ||
1749 | if (memcg == stock->cached && stock->nr_pages >= nr_pages) { | 1752 | if (memcg == stock->cached && stock->nr_pages >= nr_pages) { |
1750 | stock->nr_pages -= nr_pages; | 1753 | stock->nr_pages -= nr_pages; |
1751 | ret = true; | 1754 | ret = true; |
1752 | } | 1755 | } |
1753 | put_cpu_var(memcg_stock); | 1756 | |
1757 | local_irq_restore(flags); | ||
1758 | |||
1754 | return ret; | 1759 | return ret; |
1755 | } | 1760 | } |
1756 | 1761 | ||
@@ -1771,15 +1776,18 @@ static void drain_stock(struct memcg_stock_pcp *stock) | |||
1771 | stock->cached = NULL; | 1776 | stock->cached = NULL; |
1772 | } | 1777 | } |
1773 | 1778 | ||
1774 | /* | ||
1775 | * This must be called under preempt disabled or must be called by | ||
1776 | * a thread which is pinned to local cpu. | ||
1777 | */ | ||
1778 | static void drain_local_stock(struct work_struct *dummy) | 1779 | static void drain_local_stock(struct work_struct *dummy) |
1779 | { | 1780 | { |
1780 | struct memcg_stock_pcp *stock = this_cpu_ptr(&memcg_stock); | 1781 | struct memcg_stock_pcp *stock; |
1782 | unsigned long flags; | ||
1783 | |||
1784 | local_irq_save(flags); | ||
1785 | |||
1786 | stock = this_cpu_ptr(&memcg_stock); | ||
1781 | drain_stock(stock); | 1787 | drain_stock(stock); |
1782 | clear_bit(FLUSHING_CACHED_CHARGE, &stock->flags); | 1788 | clear_bit(FLUSHING_CACHED_CHARGE, &stock->flags); |
1789 | |||
1790 | local_irq_restore(flags); | ||
1783 | } | 1791 | } |
1784 | 1792 | ||
1785 | /* | 1793 | /* |
@@ -1788,14 +1796,19 @@ static void drain_local_stock(struct work_struct *dummy) | |||
1788 | */ | 1796 | */ |
1789 | static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) | 1797 | static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) |
1790 | { | 1798 | { |
1791 | struct memcg_stock_pcp *stock = &get_cpu_var(memcg_stock); | 1799 | struct memcg_stock_pcp *stock; |
1800 | unsigned long flags; | ||
1801 | |||
1802 | local_irq_save(flags); | ||
1792 | 1803 | ||
1804 | stock = this_cpu_ptr(&memcg_stock); | ||
1793 | if (stock->cached != memcg) { /* reset if necessary */ | 1805 | if (stock->cached != memcg) { /* reset if necessary */ |
1794 | drain_stock(stock); | 1806 | drain_stock(stock); |
1795 | stock->cached = memcg; | 1807 | stock->cached = memcg; |
1796 | } | 1808 | } |
1797 | stock->nr_pages += nr_pages; | 1809 | stock->nr_pages += nr_pages; |
1798 | put_cpu_var(memcg_stock); | 1810 | |
1811 | local_irq_restore(flags); | ||
1799 | } | 1812 | } |
1800 | 1813 | ||
1801 | /* | 1814 | /* |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 41266dc29f33..b58906b6215c 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -1567,7 +1567,9 @@ static struct page *new_node_page(struct page *page, unsigned long private, | |||
1567 | return alloc_huge_page_node(page_hstate(compound_head(page)), | 1567 | return alloc_huge_page_node(page_hstate(compound_head(page)), |
1568 | next_node_in(nid, nmask)); | 1568 | next_node_in(nid, nmask)); |
1569 | 1569 | ||
1570 | node_clear(nid, nmask); | 1570 | if (nid != next_node_in(nid, nmask)) |
1571 | node_clear(nid, nmask); | ||
1572 | |||
1571 | if (PageHighMem(page) | 1573 | if (PageHighMem(page) |
1572 | || (zone_idx(page_zone(page)) == ZONE_MOVABLE)) | 1574 | || (zone_idx(page_zone(page)) == ZONE_MOVABLE)) |
1573 | gfp_mask |= __GFP_HIGHMEM; | 1575 | gfp_mask |= __GFP_HIGHMEM; |
diff --git a/mm/page_io.c b/mm/page_io.c index 16bd82fad38c..eafe5ddc2b54 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
@@ -264,6 +264,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc, | |||
264 | int ret; | 264 | int ret; |
265 | struct swap_info_struct *sis = page_swap_info(page); | 265 | struct swap_info_struct *sis = page_swap_info(page); |
266 | 266 | ||
267 | BUG_ON(!PageSwapCache(page)); | ||
267 | if (sis->flags & SWP_FILE) { | 268 | if (sis->flags & SWP_FILE) { |
268 | struct kiocb kiocb; | 269 | struct kiocb kiocb; |
269 | struct file *swap_file = sis->swap_file; | 270 | struct file *swap_file = sis->swap_file; |
@@ -337,6 +338,7 @@ int swap_readpage(struct page *page) | |||
337 | int ret = 0; | 338 | int ret = 0; |
338 | struct swap_info_struct *sis = page_swap_info(page); | 339 | struct swap_info_struct *sis = page_swap_info(page); |
339 | 340 | ||
341 | BUG_ON(!PageSwapCache(page)); | ||
340 | VM_BUG_ON_PAGE(!PageLocked(page), page); | 342 | VM_BUG_ON_PAGE(!PageLocked(page), page); |
341 | VM_BUG_ON_PAGE(PageUptodate(page), page); | 343 | VM_BUG_ON_PAGE(PageUptodate(page), page); |
342 | if (frontswap_load(page) == 0) { | 344 | if (frontswap_load(page) == 0) { |
@@ -386,6 +388,7 @@ int swap_set_page_dirty(struct page *page) | |||
386 | 388 | ||
387 | if (sis->flags & SWP_FILE) { | 389 | if (sis->flags & SWP_FILE) { |
388 | struct address_space *mapping = sis->swap_file->f_mapping; | 390 | struct address_space *mapping = sis->swap_file->f_mapping; |
391 | BUG_ON(!PageSwapCache(page)); | ||
389 | return mapping->a_ops->set_page_dirty(page); | 392 | return mapping->a_ops->set_page_dirty(page); |
390 | } else { | 393 | } else { |
391 | return __set_page_dirty_no_writeback(page); | 394 | return __set_page_dirty_no_writeback(page); |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 78cfa292a29a..2657accc6e2b 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -2724,7 +2724,6 @@ int swapcache_prepare(swp_entry_t entry) | |||
2724 | struct swap_info_struct *page_swap_info(struct page *page) | 2724 | struct swap_info_struct *page_swap_info(struct page *page) |
2725 | { | 2725 | { |
2726 | swp_entry_t swap = { .val = page_private(page) }; | 2726 | swp_entry_t swap = { .val = page_private(page) }; |
2727 | BUG_ON(!PageSwapCache(page)); | ||
2728 | return swap_info[swp_type(swap)]; | 2727 | return swap_info[swp_type(swap)]; |
2729 | } | 2728 | } |
2730 | 2729 | ||
diff --git a/mm/usercopy.c b/mm/usercopy.c index a3cc3052f830..089328f2b920 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c | |||
@@ -134,31 +134,16 @@ static inline const char *check_bogus_address(const void *ptr, unsigned long n) | |||
134 | return NULL; | 134 | return NULL; |
135 | } | 135 | } |
136 | 136 | ||
137 | static inline const char *check_heap_object(const void *ptr, unsigned long n, | 137 | /* Checks for allocs that are marked in some way as spanning multiple pages. */ |
138 | bool to_user) | 138 | static inline const char *check_page_span(const void *ptr, unsigned long n, |
139 | struct page *page, bool to_user) | ||
139 | { | 140 | { |
140 | struct page *page, *endpage; | 141 | #ifdef CONFIG_HARDENED_USERCOPY_PAGESPAN |
141 | const void *end = ptr + n - 1; | 142 | const void *end = ptr + n - 1; |
143 | struct page *endpage; | ||
142 | bool is_reserved, is_cma; | 144 | bool is_reserved, is_cma; |
143 | 145 | ||
144 | /* | 146 | /* |
145 | * Some architectures (arm64) return true for virt_addr_valid() on | ||
146 | * vmalloced addresses. Work around this by checking for vmalloc | ||
147 | * first. | ||
148 | */ | ||
149 | if (is_vmalloc_addr(ptr)) | ||
150 | return NULL; | ||
151 | |||
152 | if (!virt_addr_valid(ptr)) | ||
153 | return NULL; | ||
154 | |||
155 | page = virt_to_head_page(ptr); | ||
156 | |||
157 | /* Check slab allocator for flags and size. */ | ||
158 | if (PageSlab(page)) | ||
159 | return __check_heap_object(ptr, n, page); | ||
160 | |||
161 | /* | ||
162 | * Sometimes the kernel data regions are not marked Reserved (see | 147 | * Sometimes the kernel data regions are not marked Reserved (see |
163 | * check below). And sometimes [_sdata,_edata) does not cover | 148 | * check below). And sometimes [_sdata,_edata) does not cover |
164 | * rodata and/or bss, so check each range explicitly. | 149 | * rodata and/or bss, so check each range explicitly. |
@@ -186,7 +171,7 @@ static inline const char *check_heap_object(const void *ptr, unsigned long n, | |||
186 | ((unsigned long)end & (unsigned long)PAGE_MASK))) | 171 | ((unsigned long)end & (unsigned long)PAGE_MASK))) |
187 | return NULL; | 172 | return NULL; |
188 | 173 | ||
189 | /* Allow if start and end are inside the same compound page. */ | 174 | /* Allow if fully inside the same compound (__GFP_COMP) page. */ |
190 | endpage = virt_to_head_page(end); | 175 | endpage = virt_to_head_page(end); |
191 | if (likely(endpage == page)) | 176 | if (likely(endpage == page)) |
192 | return NULL; | 177 | return NULL; |
@@ -199,20 +184,44 @@ static inline const char *check_heap_object(const void *ptr, unsigned long n, | |||
199 | is_reserved = PageReserved(page); | 184 | is_reserved = PageReserved(page); |
200 | is_cma = is_migrate_cma_page(page); | 185 | is_cma = is_migrate_cma_page(page); |
201 | if (!is_reserved && !is_cma) | 186 | if (!is_reserved && !is_cma) |
202 | goto reject; | 187 | return "<spans multiple pages>"; |
203 | 188 | ||
204 | for (ptr += PAGE_SIZE; ptr <= end; ptr += PAGE_SIZE) { | 189 | for (ptr += PAGE_SIZE; ptr <= end; ptr += PAGE_SIZE) { |
205 | page = virt_to_head_page(ptr); | 190 | page = virt_to_head_page(ptr); |
206 | if (is_reserved && !PageReserved(page)) | 191 | if (is_reserved && !PageReserved(page)) |
207 | goto reject; | 192 | return "<spans Reserved and non-Reserved pages>"; |
208 | if (is_cma && !is_migrate_cma_page(page)) | 193 | if (is_cma && !is_migrate_cma_page(page)) |
209 | goto reject; | 194 | return "<spans CMA and non-CMA pages>"; |
210 | } | 195 | } |
196 | #endif | ||
211 | 197 | ||
212 | return NULL; | 198 | return NULL; |
199 | } | ||
200 | |||
201 | static inline const char *check_heap_object(const void *ptr, unsigned long n, | ||
202 | bool to_user) | ||
203 | { | ||
204 | struct page *page; | ||
205 | |||
206 | /* | ||
207 | * Some architectures (arm64) return true for virt_addr_valid() on | ||
208 | * vmalloced addresses. Work around this by checking for vmalloc | ||
209 | * first. | ||
210 | */ | ||
211 | if (is_vmalloc_addr(ptr)) | ||
212 | return NULL; | ||
213 | |||
214 | if (!virt_addr_valid(ptr)) | ||
215 | return NULL; | ||
216 | |||
217 | page = virt_to_head_page(ptr); | ||
218 | |||
219 | /* Check slab allocator for flags and size. */ | ||
220 | if (PageSlab(page)) | ||
221 | return __check_heap_object(ptr, n, page); | ||
213 | 222 | ||
214 | reject: | 223 | /* Verify object does not incorrectly span multiple pages. */ |
215 | return "<spans multiple pages>"; | 224 | return check_page_span(ptr, n, page, to_user); |
216 | } | 225 | } |
217 | 226 | ||
218 | /* | 227 | /* |
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 8e486203d133..abe11f085479 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -80,13 +80,10 @@ static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br, | |||
80 | 80 | ||
81 | BR_INPUT_SKB_CB(skb)->proxyarp_replied = false; | 81 | BR_INPUT_SKB_CB(skb)->proxyarp_replied = false; |
82 | 82 | ||
83 | if (dev->flags & IFF_NOARP) | 83 | if ((dev->flags & IFF_NOARP) || |
84 | !pskb_may_pull(skb, arp_hdr_len(dev))) | ||
84 | return; | 85 | return; |
85 | 86 | ||
86 | if (!pskb_may_pull(skb, arp_hdr_len(dev))) { | ||
87 | dev->stats.tx_dropped++; | ||
88 | return; | ||
89 | } | ||
90 | parp = arp_hdr(skb); | 87 | parp = arp_hdr(skb); |
91 | 88 | ||
92 | if (parp->ar_pro != htons(ETH_P_IP) || | 89 | if (parp->ar_pro != htons(ETH_P_IP) || |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index a5423a1eec05..c5fea9393946 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1138,7 +1138,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1138 | } else { | 1138 | } else { |
1139 | err = br_ip6_multicast_add_group(br, port, | 1139 | err = br_ip6_multicast_add_group(br, port, |
1140 | &grec->grec_mca, vid); | 1140 | &grec->grec_mca, vid); |
1141 | if (!err) | 1141 | if (err) |
1142 | break; | 1142 | break; |
1143 | } | 1143 | } |
1144 | } | 1144 | } |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index cceac5bb658f..0833c251aef7 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -368,6 +368,8 @@ ebt_check_match(struct ebt_entry_match *m, struct xt_mtchk_param *par, | |||
368 | 368 | ||
369 | match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); | 369 | match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); |
370 | if (IS_ERR(match) || match->family != NFPROTO_BRIDGE) { | 370 | if (IS_ERR(match) || match->family != NFPROTO_BRIDGE) { |
371 | if (!IS_ERR(match)) | ||
372 | module_put(match->me); | ||
371 | request_module("ebt_%s", m->u.name); | 373 | request_module("ebt_%s", m->u.name); |
372 | match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); | 374 | match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); |
373 | } | 375 | } |
diff --git a/net/bridge/netfilter/nft_meta_bridge.c b/net/bridge/netfilter/nft_meta_bridge.c index 4b901d9f2e7c..ad47a921b701 100644 --- a/net/bridge/netfilter/nft_meta_bridge.c +++ b/net/bridge/netfilter/nft_meta_bridge.c | |||
@@ -86,6 +86,7 @@ static const struct nft_expr_ops nft_meta_bridge_set_ops = { | |||
86 | .init = nft_meta_set_init, | 86 | .init = nft_meta_set_init, |
87 | .destroy = nft_meta_set_destroy, | 87 | .destroy = nft_meta_set_destroy, |
88 | .dump = nft_meta_set_dump, | 88 | .dump = nft_meta_set_dump, |
89 | .validate = nft_meta_set_validate, | ||
89 | }; | 90 | }; |
90 | 91 | ||
91 | static const struct nft_expr_ops * | 92 | static const struct nft_expr_ops * |
diff --git a/net/core/dev.c b/net/core/dev.c index dd6ce598de89..ea6312057a71 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -3975,6 +3975,22 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, | |||
3975 | } | 3975 | } |
3976 | 3976 | ||
3977 | /** | 3977 | /** |
3978 | * netdev_is_rx_handler_busy - check if receive handler is registered | ||
3979 | * @dev: device to check | ||
3980 | * | ||
3981 | * Check if a receive handler is already registered for a given device. | ||
3982 | * Return true if there one. | ||
3983 | * | ||
3984 | * The caller must hold the rtnl_mutex. | ||
3985 | */ | ||
3986 | bool netdev_is_rx_handler_busy(struct net_device *dev) | ||
3987 | { | ||
3988 | ASSERT_RTNL(); | ||
3989 | return dev && rtnl_dereference(dev->rx_handler); | ||
3990 | } | ||
3991 | EXPORT_SYMBOL_GPL(netdev_is_rx_handler_busy); | ||
3992 | |||
3993 | /** | ||
3978 | * netdev_rx_handler_register - register receive handler | 3994 | * netdev_rx_handler_register - register receive handler |
3979 | * @dev: device to register a handler for | 3995 | * @dev: device to register a handler for |
3980 | * @rx_handler: receive handler to register | 3996 | * @rx_handler: receive handler to register |
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 61ad43f61c5e..52742a02814f 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
@@ -680,11 +680,13 @@ EXPORT_SYMBOL_GPL(__skb_get_hash_symmetric); | |||
680 | void __skb_get_hash(struct sk_buff *skb) | 680 | void __skb_get_hash(struct sk_buff *skb) |
681 | { | 681 | { |
682 | struct flow_keys keys; | 682 | struct flow_keys keys; |
683 | u32 hash; | ||
683 | 684 | ||
684 | __flow_hash_secret_init(); | 685 | __flow_hash_secret_init(); |
685 | 686 | ||
686 | __skb_set_sw_hash(skb, ___skb_get_hash(skb, &keys, hashrnd), | 687 | hash = ___skb_get_hash(skb, &keys, hashrnd); |
687 | flow_keys_have_l4(&keys)); | 688 | |
689 | __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); | ||
688 | } | 690 | } |
689 | EXPORT_SYMBOL(__skb_get_hash); | 691 | EXPORT_SYMBOL(__skb_get_hash); |
690 | 692 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index 25dab8b60223..fd7b41edf1ce 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1362,7 +1362,6 @@ static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority, | |||
1362 | if (!try_module_get(prot->owner)) | 1362 | if (!try_module_get(prot->owner)) |
1363 | goto out_free_sec; | 1363 | goto out_free_sec; |
1364 | sk_tx_queue_clear(sk); | 1364 | sk_tx_queue_clear(sk); |
1365 | cgroup_sk_alloc(&sk->sk_cgrp_data); | ||
1366 | } | 1365 | } |
1367 | 1366 | ||
1368 | return sk; | 1367 | return sk; |
@@ -1422,6 +1421,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | |||
1422 | sock_net_set(sk, net); | 1421 | sock_net_set(sk, net); |
1423 | atomic_set(&sk->sk_wmem_alloc, 1); | 1422 | atomic_set(&sk->sk_wmem_alloc, 1); |
1424 | 1423 | ||
1424 | cgroup_sk_alloc(&sk->sk_cgrp_data); | ||
1425 | sock_update_classid(&sk->sk_cgrp_data); | 1425 | sock_update_classid(&sk->sk_cgrp_data); |
1426 | sock_update_netprioidx(&sk->sk_cgrp_data); | 1426 | sock_update_netprioidx(&sk->sk_cgrp_data); |
1427 | } | 1427 | } |
@@ -1566,6 +1566,9 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) | |||
1566 | newsk->sk_priority = 0; | 1566 | newsk->sk_priority = 0; |
1567 | newsk->sk_incoming_cpu = raw_smp_processor_id(); | 1567 | newsk->sk_incoming_cpu = raw_smp_processor_id(); |
1568 | atomic64_set(&newsk->sk_cookie, 0); | 1568 | atomic64_set(&newsk->sk_cookie, 0); |
1569 | |||
1570 | cgroup_sk_alloc(&newsk->sk_cgrp_data); | ||
1571 | |||
1569 | /* | 1572 | /* |
1570 | * Before updating sk_refcnt, we must commit prior changes to memory | 1573 | * Before updating sk_refcnt, we must commit prior changes to memory |
1571 | * (Documentation/RCU/rculist_nulls.txt for details) | 1574 | * (Documentation/RCU/rculist_nulls.txt for details) |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 415e117967c7..062a67ca9a21 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -2232,7 +2232,7 @@ static struct devinet_sysctl_table { | |||
2232 | }; | 2232 | }; |
2233 | 2233 | ||
2234 | static int __devinet_sysctl_register(struct net *net, char *dev_name, | 2234 | static int __devinet_sysctl_register(struct net *net, char *dev_name, |
2235 | struct ipv4_devconf *p) | 2235 | int ifindex, struct ipv4_devconf *p) |
2236 | { | 2236 | { |
2237 | int i; | 2237 | int i; |
2238 | struct devinet_sysctl_table *t; | 2238 | struct devinet_sysctl_table *t; |
@@ -2255,6 +2255,8 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name, | |||
2255 | goto free; | 2255 | goto free; |
2256 | 2256 | ||
2257 | p->sysctl = t; | 2257 | p->sysctl = t; |
2258 | |||
2259 | inet_netconf_notify_devconf(net, NETCONFA_ALL, ifindex, p); | ||
2258 | return 0; | 2260 | return 0; |
2259 | 2261 | ||
2260 | free: | 2262 | free: |
@@ -2286,7 +2288,7 @@ static int devinet_sysctl_register(struct in_device *idev) | |||
2286 | if (err) | 2288 | if (err) |
2287 | return err; | 2289 | return err; |
2288 | err = __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name, | 2290 | err = __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name, |
2289 | &idev->cnf); | 2291 | idev->dev->ifindex, &idev->cnf); |
2290 | if (err) | 2292 | if (err) |
2291 | neigh_sysctl_unregister(idev->arp_parms); | 2293 | neigh_sysctl_unregister(idev->arp_parms); |
2292 | return err; | 2294 | return err; |
@@ -2347,11 +2349,12 @@ static __net_init int devinet_init_net(struct net *net) | |||
2347 | } | 2349 | } |
2348 | 2350 | ||
2349 | #ifdef CONFIG_SYSCTL | 2351 | #ifdef CONFIG_SYSCTL |
2350 | err = __devinet_sysctl_register(net, "all", all); | 2352 | err = __devinet_sysctl_register(net, "all", NETCONFA_IFINDEX_ALL, all); |
2351 | if (err < 0) | 2353 | if (err < 0) |
2352 | goto err_reg_all; | 2354 | goto err_reg_all; |
2353 | 2355 | ||
2354 | err = __devinet_sysctl_register(net, "default", dflt); | 2356 | err = __devinet_sysctl_register(net, "default", |
2357 | NETCONFA_IFINDEX_DEFAULT, dflt); | ||
2355 | if (err < 0) | 2358 | if (err < 0) |
2356 | goto err_reg_dflt; | 2359 | goto err_reg_dflt; |
2357 | 2360 | ||
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index ef2ebeb89d0f..1b25daf8c7f1 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -509,6 +509,7 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt, | |||
509 | if (!dev) | 509 | if (!dev) |
510 | return -ENODEV; | 510 | return -ENODEV; |
511 | cfg->fc_oif = dev->ifindex; | 511 | cfg->fc_oif = dev->ifindex; |
512 | cfg->fc_table = l3mdev_fib_table(dev); | ||
512 | if (colon) { | 513 | if (colon) { |
513 | struct in_ifaddr *ifa; | 514 | struct in_ifaddr *ifa; |
514 | struct in_device *in_dev = __in_dev_get_rtnl(dev); | 515 | struct in_device *in_dev = __in_dev_get_rtnl(dev); |
@@ -1027,7 +1028,7 @@ no_promotions: | |||
1027 | * First of all, we scan fib_info list searching | 1028 | * First of all, we scan fib_info list searching |
1028 | * for stray nexthop entries, then ignite fib_flush. | 1029 | * for stray nexthop entries, then ignite fib_flush. |
1029 | */ | 1030 | */ |
1030 | if (fib_sync_down_addr(dev_net(dev), ifa->ifa_local)) | 1031 | if (fib_sync_down_addr(dev, ifa->ifa_local)) |
1031 | fib_flush(dev_net(dev)); | 1032 | fib_flush(dev_net(dev)); |
1032 | } | 1033 | } |
1033 | } | 1034 | } |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 539fa264e67d..e9f56225e53f 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1057,6 +1057,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg) | |||
1057 | fi->fib_priority = cfg->fc_priority; | 1057 | fi->fib_priority = cfg->fc_priority; |
1058 | fi->fib_prefsrc = cfg->fc_prefsrc; | 1058 | fi->fib_prefsrc = cfg->fc_prefsrc; |
1059 | fi->fib_type = cfg->fc_type; | 1059 | fi->fib_type = cfg->fc_type; |
1060 | fi->fib_tb_id = cfg->fc_table; | ||
1060 | 1061 | ||
1061 | fi->fib_nhs = nhs; | 1062 | fi->fib_nhs = nhs; |
1062 | change_nexthops(fi) { | 1063 | change_nexthops(fi) { |
@@ -1337,18 +1338,21 @@ nla_put_failure: | |||
1337 | * referring to it. | 1338 | * referring to it. |
1338 | * - device went down -> we must shutdown all nexthops going via it. | 1339 | * - device went down -> we must shutdown all nexthops going via it. |
1339 | */ | 1340 | */ |
1340 | int fib_sync_down_addr(struct net *net, __be32 local) | 1341 | int fib_sync_down_addr(struct net_device *dev, __be32 local) |
1341 | { | 1342 | { |
1342 | int ret = 0; | 1343 | int ret = 0; |
1343 | unsigned int hash = fib_laddr_hashfn(local); | 1344 | unsigned int hash = fib_laddr_hashfn(local); |
1344 | struct hlist_head *head = &fib_info_laddrhash[hash]; | 1345 | struct hlist_head *head = &fib_info_laddrhash[hash]; |
1346 | struct net *net = dev_net(dev); | ||
1347 | int tb_id = l3mdev_fib_table(dev); | ||
1345 | struct fib_info *fi; | 1348 | struct fib_info *fi; |
1346 | 1349 | ||
1347 | if (!fib_info_laddrhash || local == 0) | 1350 | if (!fib_info_laddrhash || local == 0) |
1348 | return 0; | 1351 | return 0; |
1349 | 1352 | ||
1350 | hlist_for_each_entry(fi, head, fib_lhash) { | 1353 | hlist_for_each_entry(fi, head, fib_lhash) { |
1351 | if (!net_eq(fi->fib_net, net)) | 1354 | if (!net_eq(fi->fib_net, net) || |
1355 | fi->fib_tb_id != tb_id) | ||
1352 | continue; | 1356 | continue; |
1353 | if (fi->fib_prefsrc == local) { | 1357 | if (fi->fib_prefsrc == local) { |
1354 | fi->fib_flags |= RTNH_F_DEAD; | 1358 | fi->fib_flags |= RTNH_F_DEAD; |
diff --git a/net/ipv4/netfilter/nft_reject_ipv4.c b/net/ipv4/netfilter/nft_reject_ipv4.c index c24f41c816b3..2c2553b9026c 100644 --- a/net/ipv4/netfilter/nft_reject_ipv4.c +++ b/net/ipv4/netfilter/nft_reject_ipv4.c | |||
@@ -46,6 +46,7 @@ static const struct nft_expr_ops nft_reject_ipv4_ops = { | |||
46 | .eval = nft_reject_ipv4_eval, | 46 | .eval = nft_reject_ipv4_eval, |
47 | .init = nft_reject_init, | 47 | .init = nft_reject_init, |
48 | .dump = nft_reject_dump, | 48 | .dump = nft_reject_dump, |
49 | .validate = nft_reject_validate, | ||
49 | }; | 50 | }; |
50 | 51 | ||
51 | static struct nft_expr_type nft_reject_ipv4_type __read_mostly = { | 52 | static struct nft_expr_type nft_reject_ipv4_type __read_mostly = { |
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 54d9f9b0120f..4e777a3243f9 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c | |||
@@ -150,6 +150,7 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb) | |||
150 | tp->segs_in = 0; | 150 | tp->segs_in = 0; |
151 | tcp_segs_in(tp, skb); | 151 | tcp_segs_in(tp, skb); |
152 | __skb_pull(skb, tcp_hdrlen(skb)); | 152 | __skb_pull(skb, tcp_hdrlen(skb)); |
153 | sk_forced_mem_schedule(sk, skb->truesize); | ||
153 | skb_set_owner_r(skb, sk); | 154 | skb_set_owner_r(skb, sk); |
154 | 155 | ||
155 | TCP_SKB_CB(skb)->seq++; | 156 | TCP_SKB_CB(skb)->seq++; |
@@ -226,6 +227,7 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk, | |||
226 | tcp_fastopen_add_skb(child, skb); | 227 | tcp_fastopen_add_skb(child, skb); |
227 | 228 | ||
228 | tcp_rsk(req)->rcv_nxt = tp->rcv_nxt; | 229 | tcp_rsk(req)->rcv_nxt = tp->rcv_nxt; |
230 | tp->rcv_wup = tp->rcv_nxt; | ||
229 | /* tcp_conn_request() is sending the SYNACK, | 231 | /* tcp_conn_request() is sending the SYNACK, |
230 | * and queues the child into listener accept queue. | 232 | * and queues the child into listener accept queue. |
231 | */ | 233 | */ |
diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c index 028eb046ea40..9c5fc973267f 100644 --- a/net/ipv4/tcp_yeah.c +++ b/net/ipv4/tcp_yeah.c | |||
@@ -76,7 +76,7 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked) | |||
76 | if (!tcp_is_cwnd_limited(sk)) | 76 | if (!tcp_is_cwnd_limited(sk)) |
77 | return; | 77 | return; |
78 | 78 | ||
79 | if (tp->snd_cwnd <= tp->snd_ssthresh) | 79 | if (tcp_in_slow_start(tp)) |
80 | tcp_slow_start(tp, acked); | 80 | tcp_slow_start(tp, acked); |
81 | 81 | ||
82 | else if (!yeah->doing_reno_now) { | 82 | else if (!yeah->doing_reno_now) { |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index b644a23c3db0..41f5b504a782 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -29,7 +29,7 @@ static struct dst_entry *__xfrm4_dst_lookup(struct net *net, struct flowi4 *fl4, | |||
29 | memset(fl4, 0, sizeof(*fl4)); | 29 | memset(fl4, 0, sizeof(*fl4)); |
30 | fl4->daddr = daddr->a4; | 30 | fl4->daddr = daddr->a4; |
31 | fl4->flowi4_tos = tos; | 31 | fl4->flowi4_tos = tos; |
32 | fl4->flowi4_oif = oif; | 32 | fl4->flowi4_oif = l3mdev_master_ifindex_by_index(net, oif); |
33 | if (saddr) | 33 | if (saddr) |
34 | fl4->saddr = saddr->a4; | 34 | fl4->saddr = saddr->a4; |
35 | 35 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f418d2eaeddd..2f1f5d439788 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -778,7 +778,14 @@ static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int newf) | |||
778 | } | 778 | } |
779 | 779 | ||
780 | if (p == &net->ipv6.devconf_all->forwarding) { | 780 | if (p == &net->ipv6.devconf_all->forwarding) { |
781 | int old_dflt = net->ipv6.devconf_dflt->forwarding; | ||
782 | |||
781 | net->ipv6.devconf_dflt->forwarding = newf; | 783 | net->ipv6.devconf_dflt->forwarding = newf; |
784 | if ((!newf) ^ (!old_dflt)) | ||
785 | inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, | ||
786 | NETCONFA_IFINDEX_DEFAULT, | ||
787 | net->ipv6.devconf_dflt); | ||
788 | |||
782 | addrconf_forward_change(net, newf); | 789 | addrconf_forward_change(net, newf); |
783 | if ((!newf) ^ (!old)) | 790 | if ((!newf) ^ (!old)) |
784 | inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, | 791 | inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, |
@@ -1941,6 +1948,7 @@ errdad: | |||
1941 | spin_unlock_bh(&ifp->lock); | 1948 | spin_unlock_bh(&ifp->lock); |
1942 | 1949 | ||
1943 | addrconf_mod_dad_work(ifp, 0); | 1950 | addrconf_mod_dad_work(ifp, 0); |
1951 | in6_ifa_put(ifp); | ||
1944 | } | 1952 | } |
1945 | 1953 | ||
1946 | /* Join to solicited addr multicast group. | 1954 | /* Join to solicited addr multicast group. |
@@ -3850,6 +3858,7 @@ static void addrconf_dad_work(struct work_struct *w) | |||
3850 | addrconf_dad_begin(ifp); | 3858 | addrconf_dad_begin(ifp); |
3851 | goto out; | 3859 | goto out; |
3852 | } else if (action == DAD_ABORT) { | 3860 | } else if (action == DAD_ABORT) { |
3861 | in6_ifa_hold(ifp); | ||
3853 | addrconf_dad_stop(ifp, 1); | 3862 | addrconf_dad_stop(ifp, 1); |
3854 | if (disable_ipv6) | 3863 | if (disable_ipv6) |
3855 | addrconf_ifdown(idev->dev, 0); | 3864 | addrconf_ifdown(idev->dev, 0); |
@@ -6025,7 +6034,7 @@ static const struct ctl_table addrconf_sysctl[] = { | |||
6025 | static int __addrconf_sysctl_register(struct net *net, char *dev_name, | 6034 | static int __addrconf_sysctl_register(struct net *net, char *dev_name, |
6026 | struct inet6_dev *idev, struct ipv6_devconf *p) | 6035 | struct inet6_dev *idev, struct ipv6_devconf *p) |
6027 | { | 6036 | { |
6028 | int i; | 6037 | int i, ifindex; |
6029 | struct ctl_table *table; | 6038 | struct ctl_table *table; |
6030 | char path[sizeof("net/ipv6/conf/") + IFNAMSIZ]; | 6039 | char path[sizeof("net/ipv6/conf/") + IFNAMSIZ]; |
6031 | 6040 | ||
@@ -6045,6 +6054,13 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name, | |||
6045 | if (!p->sysctl_header) | 6054 | if (!p->sysctl_header) |
6046 | goto free; | 6055 | goto free; |
6047 | 6056 | ||
6057 | if (!strcmp(dev_name, "all")) | ||
6058 | ifindex = NETCONFA_IFINDEX_ALL; | ||
6059 | else if (!strcmp(dev_name, "default")) | ||
6060 | ifindex = NETCONFA_IFINDEX_DEFAULT; | ||
6061 | else | ||
6062 | ifindex = idev->dev->ifindex; | ||
6063 | inet6_netconf_notify_devconf(net, NETCONFA_ALL, ifindex, p); | ||
6048 | return 0; | 6064 | return 0; |
6049 | 6065 | ||
6050 | free: | 6066 | free: |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 7b0481e3738f..888543debe4e 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1174,6 +1174,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1174 | encap_limit = t->parms.encap_limit; | 1174 | encap_limit = t->parms.encap_limit; |
1175 | 1175 | ||
1176 | memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); | 1176 | memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); |
1177 | fl6.flowi6_proto = IPPROTO_IPIP; | ||
1177 | 1178 | ||
1178 | dsfield = ipv4_get_dsfield(iph); | 1179 | dsfield = ipv4_get_dsfield(iph); |
1179 | 1180 | ||
@@ -1233,6 +1234,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1233 | encap_limit = t->parms.encap_limit; | 1234 | encap_limit = t->parms.encap_limit; |
1234 | 1235 | ||
1235 | memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); | 1236 | memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); |
1237 | fl6.flowi6_proto = IPPROTO_IPV6; | ||
1236 | 1238 | ||
1237 | dsfield = ipv6_get_dsfield(ipv6h); | 1239 | dsfield = ipv6_get_dsfield(ipv6h); |
1238 | if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS) | 1240 | if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS) |
diff --git a/net/ipv6/netfilter/nft_reject_ipv6.c b/net/ipv6/netfilter/nft_reject_ipv6.c index 533cd5719c59..92bda9908bb9 100644 --- a/net/ipv6/netfilter/nft_reject_ipv6.c +++ b/net/ipv6/netfilter/nft_reject_ipv6.c | |||
@@ -47,6 +47,7 @@ static const struct nft_expr_ops nft_reject_ipv6_ops = { | |||
47 | .eval = nft_reject_ipv6_eval, | 47 | .eval = nft_reject_ipv6_eval, |
48 | .init = nft_reject_init, | 48 | .init = nft_reject_init, |
49 | .dump = nft_reject_dump, | 49 | .dump = nft_reject_dump, |
50 | .validate = nft_reject_validate, | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | static struct nft_expr_type nft_reject_ipv6_type __read_mostly = { | 53 | static struct nft_expr_type nft_reject_ipv6_type __read_mostly = { |
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index 0900352c924c..0e983b694ee8 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c | |||
@@ -126,8 +126,10 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
126 | rt = (struct rt6_info *) dst; | 126 | rt = (struct rt6_info *) dst; |
127 | 127 | ||
128 | np = inet6_sk(sk); | 128 | np = inet6_sk(sk); |
129 | if (!np) | 129 | if (!np) { |
130 | return -EBADF; | 130 | err = -EBADF; |
131 | goto dst_err_out; | ||
132 | } | ||
131 | 133 | ||
132 | if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) | 134 | if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) |
133 | fl6.flowi6_oif = np->mcast_oif; | 135 | fl6.flowi6_oif = np->mcast_oif; |
@@ -163,6 +165,9 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
163 | } | 165 | } |
164 | release_sock(sk); | 166 | release_sock(sk); |
165 | 167 | ||
168 | dst_err_out: | ||
169 | dst_release(dst); | ||
170 | |||
166 | if (err) | 171 | if (err) |
167 | return err; | 172 | return err; |
168 | 173 | ||
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index 0eaab1fa6be5..00a2d40677d6 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c | |||
@@ -23,6 +23,7 @@ int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb) | |||
23 | 23 | ||
24 | int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) | 24 | int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) |
25 | { | 25 | { |
26 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL; | ||
26 | XFRM_SPI_SKB_CB(skb)->family = AF_INET6; | 27 | XFRM_SPI_SKB_CB(skb)->family = AF_INET6; |
27 | XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); | 28 | XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); |
28 | return xfrm_input(skb, nexthdr, spi, 0); | 29 | return xfrm_input(skb, nexthdr, spi, 0); |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 6cc97003e4a9..70a86adad875 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -36,7 +36,7 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, int oif, | |||
36 | int err; | 36 | int err; |
37 | 37 | ||
38 | memset(&fl6, 0, sizeof(fl6)); | 38 | memset(&fl6, 0, sizeof(fl6)); |
39 | fl6.flowi6_oif = oif; | 39 | fl6.flowi6_oif = l3mdev_master_ifindex_by_index(net, oif); |
40 | fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF; | 40 | fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF; |
41 | memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr)); | 41 | memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr)); |
42 | if (saddr) | 42 | if (saddr) |
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index cb39e05b166c..411693288648 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/socket.h> | 13 | #include <linux/socket.h> |
14 | #include <linux/uaccess.h> | 14 | #include <linux/uaccess.h> |
15 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
16 | #include <linux/syscalls.h> | ||
16 | #include <net/kcm.h> | 17 | #include <net/kcm.h> |
17 | #include <net/netns/generic.h> | 18 | #include <net/netns/generic.h> |
18 | #include <net/sock.h> | 19 | #include <net/sock.h> |
@@ -2029,7 +2030,7 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
2029 | if (copy_to_user((void __user *)arg, &info, | 2030 | if (copy_to_user((void __user *)arg, &info, |
2030 | sizeof(info))) { | 2031 | sizeof(info))) { |
2031 | err = -EFAULT; | 2032 | err = -EFAULT; |
2032 | sock_release(newsock); | 2033 | sys_close(info.fd); |
2033 | } | 2034 | } |
2034 | } | 2035 | } |
2035 | 2036 | ||
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 1e40dacaa137..a2ed3bda4ddc 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -1855,6 +1855,9 @@ static __net_exit void l2tp_exit_net(struct net *net) | |||
1855 | (void)l2tp_tunnel_delete(tunnel); | 1855 | (void)l2tp_tunnel_delete(tunnel); |
1856 | } | 1856 | } |
1857 | rcu_read_unlock_bh(); | 1857 | rcu_read_unlock_bh(); |
1858 | |||
1859 | flush_workqueue(l2tp_wq); | ||
1860 | rcu_barrier(); | ||
1858 | } | 1861 | } |
1859 | 1862 | ||
1860 | static struct pernet_operations l2tp_net_ops = { | 1863 | static struct pernet_operations l2tp_net_ops = { |
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index b5d28f14b9cf..afca7d103684 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c | |||
@@ -333,10 +333,11 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata, | |||
333 | if (!uc.center_freq1) | 333 | if (!uc.center_freq1) |
334 | return; | 334 | return; |
335 | 335 | ||
336 | /* proceed to downgrade the chandef until usable or the same */ | 336 | /* proceed to downgrade the chandef until usable or the same as AP BW */ |
337 | while (uc.width > max_width || | 337 | while (uc.width > max_width || |
338 | !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &uc, | 338 | (uc.width > sta->tdls_chandef.width && |
339 | sdata->wdev.iftype)) | 339 | !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &uc, |
340 | sdata->wdev.iftype))) | ||
340 | ieee80211_chandef_downgrade(&uc); | 341 | ieee80211_chandef_downgrade(&uc); |
341 | 342 | ||
342 | if (!cfg80211_chandef_identical(&uc, &sta->tdls_chandef)) { | 343 | if (!cfg80211_chandef_identical(&uc, &sta->tdls_chandef)) { |
diff --git a/net/netfilter/nf_tables_netdev.c b/net/netfilter/nf_tables_netdev.c index 5eefe4a355c6..75d696f11045 100644 --- a/net/netfilter/nf_tables_netdev.c +++ b/net/netfilter/nf_tables_netdev.c | |||
@@ -30,7 +30,6 @@ nft_netdev_set_pktinfo_ipv4(struct nft_pktinfo *pkt, | |||
30 | if (!iph) | 30 | if (!iph) |
31 | return; | 31 | return; |
32 | 32 | ||
33 | iph = ip_hdr(skb); | ||
34 | if (iph->ihl < 5 || iph->version != 4) | 33 | if (iph->ihl < 5 || iph->version != 4) |
35 | return; | 34 | return; |
36 | 35 | ||
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c index 70eb2f6a3b01..d44d89b56127 100644 --- a/net/netfilter/nfnetlink_acct.c +++ b/net/netfilter/nfnetlink_acct.c | |||
@@ -343,12 +343,12 @@ static int nfnl_acct_del(struct net *net, struct sock *nfnl, | |||
343 | struct sk_buff *skb, const struct nlmsghdr *nlh, | 343 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
344 | const struct nlattr * const tb[]) | 344 | const struct nlattr * const tb[]) |
345 | { | 345 | { |
346 | char *acct_name; | 346 | struct nf_acct *cur, *tmp; |
347 | struct nf_acct *cur; | ||
348 | int ret = -ENOENT; | 347 | int ret = -ENOENT; |
348 | char *acct_name; | ||
349 | 349 | ||
350 | if (!tb[NFACCT_NAME]) { | 350 | if (!tb[NFACCT_NAME]) { |
351 | list_for_each_entry(cur, &net->nfnl_acct_list, head) | 351 | list_for_each_entry_safe(cur, tmp, &net->nfnl_acct_list, head) |
352 | nfnl_acct_try_del(cur); | 352 | nfnl_acct_try_del(cur); |
353 | 353 | ||
354 | return 0; | 354 | return 0; |
diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c index 68216cdc7083..139e0867e56e 100644 --- a/net/netfilter/nfnetlink_cttimeout.c +++ b/net/netfilter/nfnetlink_cttimeout.c | |||
@@ -98,31 +98,28 @@ static int cttimeout_new_timeout(struct net *net, struct sock *ctnl, | |||
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | 100 | ||
101 | l4proto = nf_ct_l4proto_find_get(l3num, l4num); | ||
102 | |||
103 | /* This protocol is not supportted, skip. */ | ||
104 | if (l4proto->l4proto != l4num) { | ||
105 | ret = -EOPNOTSUPP; | ||
106 | goto err_proto_put; | ||
107 | } | ||
108 | |||
109 | if (matching) { | 101 | if (matching) { |
110 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { | 102 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { |
111 | /* You cannot replace one timeout policy by another of | 103 | /* You cannot replace one timeout policy by another of |
112 | * different kind, sorry. | 104 | * different kind, sorry. |
113 | */ | 105 | */ |
114 | if (matching->l3num != l3num || | 106 | if (matching->l3num != l3num || |
115 | matching->l4proto->l4proto != l4num) { | 107 | matching->l4proto->l4proto != l4num) |
116 | ret = -EINVAL; | 108 | return -EINVAL; |
117 | goto err_proto_put; | 109 | |
118 | } | 110 | return ctnl_timeout_parse_policy(&matching->data, |
119 | 111 | matching->l4proto, net, | |
120 | ret = ctnl_timeout_parse_policy(&matching->data, | 112 | cda[CTA_TIMEOUT_DATA]); |
121 | l4proto, net, | ||
122 | cda[CTA_TIMEOUT_DATA]); | ||
123 | return ret; | ||
124 | } | 113 | } |
125 | ret = -EBUSY; | 114 | |
115 | return -EBUSY; | ||
116 | } | ||
117 | |||
118 | l4proto = nf_ct_l4proto_find_get(l3num, l4num); | ||
119 | |||
120 | /* This protocol is not supportted, skip. */ | ||
121 | if (l4proto->l4proto != l4num) { | ||
122 | ret = -EOPNOTSUPP; | ||
126 | goto err_proto_put; | 123 | goto err_proto_put; |
127 | } | 124 | } |
128 | 125 | ||
@@ -305,7 +302,16 @@ static void ctnl_untimeout(struct net *net, struct ctnl_timeout *timeout) | |||
305 | const struct hlist_nulls_node *nn; | 302 | const struct hlist_nulls_node *nn; |
306 | unsigned int last_hsize; | 303 | unsigned int last_hsize; |
307 | spinlock_t *lock; | 304 | spinlock_t *lock; |
308 | int i; | 305 | int i, cpu; |
306 | |||
307 | for_each_possible_cpu(cpu) { | ||
308 | struct ct_pcpu *pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); | ||
309 | |||
310 | spin_lock_bh(&pcpu->lock); | ||
311 | hlist_nulls_for_each_entry(h, nn, &pcpu->unconfirmed, hnnode) | ||
312 | untimeout(h, timeout); | ||
313 | spin_unlock_bh(&pcpu->lock); | ||
314 | } | ||
309 | 315 | ||
310 | local_bh_disable(); | 316 | local_bh_disable(); |
311 | restart: | 317 | restart: |
@@ -350,12 +356,13 @@ static int cttimeout_del_timeout(struct net *net, struct sock *ctnl, | |||
350 | const struct nlmsghdr *nlh, | 356 | const struct nlmsghdr *nlh, |
351 | const struct nlattr * const cda[]) | 357 | const struct nlattr * const cda[]) |
352 | { | 358 | { |
353 | struct ctnl_timeout *cur; | 359 | struct ctnl_timeout *cur, *tmp; |
354 | int ret = -ENOENT; | 360 | int ret = -ENOENT; |
355 | char *name; | 361 | char *name; |
356 | 362 | ||
357 | if (!cda[CTA_TIMEOUT_NAME]) { | 363 | if (!cda[CTA_TIMEOUT_NAME]) { |
358 | list_for_each_entry(cur, &net->nfct_timeout_list, head) | 364 | list_for_each_entry_safe(cur, tmp, &net->nfct_timeout_list, |
365 | head) | ||
359 | ctnl_timeout_try_del(net, cur); | 366 | ctnl_timeout_try_del(net, cur); |
360 | 367 | ||
361 | return 0; | 368 | return 0; |
diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c index 2863f3493038..8a6bc7630912 100644 --- a/net/netfilter/nft_meta.c +++ b/net/netfilter/nft_meta.c | |||
@@ -291,10 +291,16 @@ int nft_meta_get_init(const struct nft_ctx *ctx, | |||
291 | } | 291 | } |
292 | EXPORT_SYMBOL_GPL(nft_meta_get_init); | 292 | EXPORT_SYMBOL_GPL(nft_meta_get_init); |
293 | 293 | ||
294 | static int nft_meta_set_init_pkttype(const struct nft_ctx *ctx) | 294 | int nft_meta_set_validate(const struct nft_ctx *ctx, |
295 | const struct nft_expr *expr, | ||
296 | const struct nft_data **data) | ||
295 | { | 297 | { |
298 | struct nft_meta *priv = nft_expr_priv(expr); | ||
296 | unsigned int hooks; | 299 | unsigned int hooks; |
297 | 300 | ||
301 | if (priv->key != NFT_META_PKTTYPE) | ||
302 | return 0; | ||
303 | |||
298 | switch (ctx->afi->family) { | 304 | switch (ctx->afi->family) { |
299 | case NFPROTO_BRIDGE: | 305 | case NFPROTO_BRIDGE: |
300 | hooks = 1 << NF_BR_PRE_ROUTING; | 306 | hooks = 1 << NF_BR_PRE_ROUTING; |
@@ -308,6 +314,7 @@ static int nft_meta_set_init_pkttype(const struct nft_ctx *ctx) | |||
308 | 314 | ||
309 | return nft_chain_validate_hooks(ctx->chain, hooks); | 315 | return nft_chain_validate_hooks(ctx->chain, hooks); |
310 | } | 316 | } |
317 | EXPORT_SYMBOL_GPL(nft_meta_set_validate); | ||
311 | 318 | ||
312 | int nft_meta_set_init(const struct nft_ctx *ctx, | 319 | int nft_meta_set_init(const struct nft_ctx *ctx, |
313 | const struct nft_expr *expr, | 320 | const struct nft_expr *expr, |
@@ -327,15 +334,16 @@ int nft_meta_set_init(const struct nft_ctx *ctx, | |||
327 | len = sizeof(u8); | 334 | len = sizeof(u8); |
328 | break; | 335 | break; |
329 | case NFT_META_PKTTYPE: | 336 | case NFT_META_PKTTYPE: |
330 | err = nft_meta_set_init_pkttype(ctx); | ||
331 | if (err) | ||
332 | return err; | ||
333 | len = sizeof(u8); | 337 | len = sizeof(u8); |
334 | break; | 338 | break; |
335 | default: | 339 | default: |
336 | return -EOPNOTSUPP; | 340 | return -EOPNOTSUPP; |
337 | } | 341 | } |
338 | 342 | ||
343 | err = nft_meta_set_validate(ctx, expr, NULL); | ||
344 | if (err < 0) | ||
345 | return err; | ||
346 | |||
339 | priv->sreg = nft_parse_register(tb[NFTA_META_SREG]); | 347 | priv->sreg = nft_parse_register(tb[NFTA_META_SREG]); |
340 | err = nft_validate_register_load(priv->sreg, len); | 348 | err = nft_validate_register_load(priv->sreg, len); |
341 | if (err < 0) | 349 | if (err < 0) |
@@ -407,6 +415,7 @@ static const struct nft_expr_ops nft_meta_set_ops = { | |||
407 | .init = nft_meta_set_init, | 415 | .init = nft_meta_set_init, |
408 | .destroy = nft_meta_set_destroy, | 416 | .destroy = nft_meta_set_destroy, |
409 | .dump = nft_meta_set_dump, | 417 | .dump = nft_meta_set_dump, |
418 | .validate = nft_meta_set_validate, | ||
410 | }; | 419 | }; |
411 | 420 | ||
412 | static const struct nft_expr_ops * | 421 | static const struct nft_expr_ops * |
diff --git a/net/netfilter/nft_reject.c b/net/netfilter/nft_reject.c index 0522fc9bfb0a..c64de3f7379d 100644 --- a/net/netfilter/nft_reject.c +++ b/net/netfilter/nft_reject.c | |||
@@ -26,11 +26,27 @@ const struct nla_policy nft_reject_policy[NFTA_REJECT_MAX + 1] = { | |||
26 | }; | 26 | }; |
27 | EXPORT_SYMBOL_GPL(nft_reject_policy); | 27 | EXPORT_SYMBOL_GPL(nft_reject_policy); |
28 | 28 | ||
29 | int nft_reject_validate(const struct nft_ctx *ctx, | ||
30 | const struct nft_expr *expr, | ||
31 | const struct nft_data **data) | ||
32 | { | ||
33 | return nft_chain_validate_hooks(ctx->chain, | ||
34 | (1 << NF_INET_LOCAL_IN) | | ||
35 | (1 << NF_INET_FORWARD) | | ||
36 | (1 << NF_INET_LOCAL_OUT)); | ||
37 | } | ||
38 | EXPORT_SYMBOL_GPL(nft_reject_validate); | ||
39 | |||
29 | int nft_reject_init(const struct nft_ctx *ctx, | 40 | int nft_reject_init(const struct nft_ctx *ctx, |
30 | const struct nft_expr *expr, | 41 | const struct nft_expr *expr, |
31 | const struct nlattr * const tb[]) | 42 | const struct nlattr * const tb[]) |
32 | { | 43 | { |
33 | struct nft_reject *priv = nft_expr_priv(expr); | 44 | struct nft_reject *priv = nft_expr_priv(expr); |
45 | int err; | ||
46 | |||
47 | err = nft_reject_validate(ctx, expr, NULL); | ||
48 | if (err < 0) | ||
49 | return err; | ||
34 | 50 | ||
35 | if (tb[NFTA_REJECT_TYPE] == NULL) | 51 | if (tb[NFTA_REJECT_TYPE] == NULL) |
36 | return -EINVAL; | 52 | return -EINVAL; |
diff --git a/net/netfilter/nft_reject_inet.c b/net/netfilter/nft_reject_inet.c index 759ca5248a3d..e79d9ca2ffee 100644 --- a/net/netfilter/nft_reject_inet.c +++ b/net/netfilter/nft_reject_inet.c | |||
@@ -66,7 +66,11 @@ static int nft_reject_inet_init(const struct nft_ctx *ctx, | |||
66 | const struct nlattr * const tb[]) | 66 | const struct nlattr * const tb[]) |
67 | { | 67 | { |
68 | struct nft_reject *priv = nft_expr_priv(expr); | 68 | struct nft_reject *priv = nft_expr_priv(expr); |
69 | int icmp_code; | 69 | int icmp_code, err; |
70 | |||
71 | err = nft_reject_validate(ctx, expr, NULL); | ||
72 | if (err < 0) | ||
73 | return err; | ||
70 | 74 | ||
71 | if (tb[NFTA_REJECT_TYPE] == NULL) | 75 | if (tb[NFTA_REJECT_TYPE] == NULL) |
72 | return -EINVAL; | 76 | return -EINVAL; |
@@ -124,6 +128,7 @@ static const struct nft_expr_ops nft_reject_inet_ops = { | |||
124 | .eval = nft_reject_inet_eval, | 128 | .eval = nft_reject_inet_eval, |
125 | .init = nft_reject_inet_init, | 129 | .init = nft_reject_inet_init, |
126 | .dump = nft_reject_inet_dump, | 130 | .dump = nft_reject_inet_dump, |
131 | .validate = nft_reject_validate, | ||
127 | }; | 132 | }; |
128 | 133 | ||
129 | static struct nft_expr_type nft_reject_inet_type __read_mostly = { | 134 | static struct nft_expr_type nft_reject_inet_type __read_mostly = { |
diff --git a/net/sctp/output.c b/net/sctp/output.c index 1f1682b9a6a8..31b7bc35895d 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
@@ -878,7 +878,7 @@ static sctp_xmit_t sctp_packet_will_fit(struct sctp_packet *packet, | |||
878 | struct sctp_chunk *chunk, | 878 | struct sctp_chunk *chunk, |
879 | u16 chunk_len) | 879 | u16 chunk_len) |
880 | { | 880 | { |
881 | size_t psize, pmtu; | 881 | size_t psize, pmtu, maxsize; |
882 | sctp_xmit_t retval = SCTP_XMIT_OK; | 882 | sctp_xmit_t retval = SCTP_XMIT_OK; |
883 | 883 | ||
884 | psize = packet->size; | 884 | psize = packet->size; |
@@ -906,6 +906,17 @@ static sctp_xmit_t sctp_packet_will_fit(struct sctp_packet *packet, | |||
906 | goto out; | 906 | goto out; |
907 | } | 907 | } |
908 | 908 | ||
909 | /* Similarly, if this chunk was built before a PMTU | ||
910 | * reduction, we have to fragment it at IP level now. So | ||
911 | * if the packet already contains something, we need to | ||
912 | * flush. | ||
913 | */ | ||
914 | maxsize = pmtu - packet->overhead; | ||
915 | if (packet->auth) | ||
916 | maxsize -= WORD_ROUND(packet->auth->skb->len); | ||
917 | if (chunk_len > maxsize) | ||
918 | retval = SCTP_XMIT_PMTU_FULL; | ||
919 | |||
909 | /* It is also okay to fragment if the chunk we are | 920 | /* It is also okay to fragment if the chunk we are |
910 | * adding is a control chunk, but only if current packet | 921 | * adding is a control chunk, but only if current packet |
911 | * is not a GSO one otherwise it causes fragmentation of | 922 | * is not a GSO one otherwise it causes fragmentation of |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 1d281816f2bf..d8582028b346 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -569,9 +569,10 @@ gss_svc_searchbyctx(struct cache_detail *cd, struct xdr_netobj *handle) | |||
569 | struct rsc *found; | 569 | struct rsc *found; |
570 | 570 | ||
571 | memset(&rsci, 0, sizeof(rsci)); | 571 | memset(&rsci, 0, sizeof(rsci)); |
572 | rsci.handle.data = handle->data; | 572 | if (dup_to_netobj(&rsci.handle, handle->data, handle->len)) |
573 | rsci.handle.len = handle->len; | 573 | return NULL; |
574 | found = rsc_lookup(cd, &rsci); | 574 | found = rsc_lookup(cd, &rsci); |
575 | rsc_free(&rsci); | ||
575 | if (!found) | 576 | if (!found) |
576 | return NULL; | 577 | return NULL; |
577 | if (cache_check(cd, &found->h, NULL)) | 578 | if (cache_check(cd, &found->h, NULL)) |
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 536d0be3f61b..799cce6cbe45 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
52 | #include <linux/prefetch.h> | 52 | #include <linux/prefetch.h> |
53 | #include <linux/sunrpc/addr.h> | 53 | #include <linux/sunrpc/addr.h> |
54 | #include <linux/sunrpc/svc_rdma.h> | ||
54 | #include <asm/bitops.h> | 55 | #include <asm/bitops.h> |
55 | #include <linux/module.h> /* try_module_get()/module_put() */ | 56 | #include <linux/module.h> /* try_module_get()/module_put() */ |
56 | 57 | ||
@@ -923,7 +924,7 @@ rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt) | |||
923 | } | 924 | } |
924 | 925 | ||
925 | INIT_LIST_HEAD(&buf->rb_recv_bufs); | 926 | INIT_LIST_HEAD(&buf->rb_recv_bufs); |
926 | for (i = 0; i < buf->rb_max_requests; i++) { | 927 | for (i = 0; i < buf->rb_max_requests + RPCRDMA_MAX_BC_REQUESTS; i++) { |
927 | struct rpcrdma_rep *rep; | 928 | struct rpcrdma_rep *rep; |
928 | 929 | ||
929 | rep = rpcrdma_create_rep(r_xprt); | 930 | rep = rpcrdma_create_rep(r_xprt); |
@@ -1018,6 +1019,7 @@ rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) | |||
1018 | rep = rpcrdma_buffer_get_rep_locked(buf); | 1019 | rep = rpcrdma_buffer_get_rep_locked(buf); |
1019 | rpcrdma_destroy_rep(ia, rep); | 1020 | rpcrdma_destroy_rep(ia, rep); |
1020 | } | 1021 | } |
1022 | buf->rb_send_count = 0; | ||
1021 | 1023 | ||
1022 | spin_lock(&buf->rb_reqslock); | 1024 | spin_lock(&buf->rb_reqslock); |
1023 | while (!list_empty(&buf->rb_allreqs)) { | 1025 | while (!list_empty(&buf->rb_allreqs)) { |
@@ -1032,6 +1034,7 @@ rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) | |||
1032 | spin_lock(&buf->rb_reqslock); | 1034 | spin_lock(&buf->rb_reqslock); |
1033 | } | 1035 | } |
1034 | spin_unlock(&buf->rb_reqslock); | 1036 | spin_unlock(&buf->rb_reqslock); |
1037 | buf->rb_recv_count = 0; | ||
1035 | 1038 | ||
1036 | rpcrdma_destroy_mrs(buf); | 1039 | rpcrdma_destroy_mrs(buf); |
1037 | } | 1040 | } |
@@ -1074,8 +1077,27 @@ rpcrdma_put_mw(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mw *mw) | |||
1074 | spin_unlock(&buf->rb_mwlock); | 1077 | spin_unlock(&buf->rb_mwlock); |
1075 | } | 1078 | } |
1076 | 1079 | ||
1080 | static struct rpcrdma_rep * | ||
1081 | rpcrdma_buffer_get_rep(struct rpcrdma_buffer *buffers) | ||
1082 | { | ||
1083 | /* If an RPC previously completed without a reply (say, a | ||
1084 | * credential problem or a soft timeout occurs) then hold off | ||
1085 | * on supplying more Receive buffers until the number of new | ||
1086 | * pending RPCs catches up to the number of posted Receives. | ||
1087 | */ | ||
1088 | if (unlikely(buffers->rb_send_count < buffers->rb_recv_count)) | ||
1089 | return NULL; | ||
1090 | |||
1091 | if (unlikely(list_empty(&buffers->rb_recv_bufs))) | ||
1092 | return NULL; | ||
1093 | buffers->rb_recv_count++; | ||
1094 | return rpcrdma_buffer_get_rep_locked(buffers); | ||
1095 | } | ||
1096 | |||
1077 | /* | 1097 | /* |
1078 | * Get a set of request/reply buffers. | 1098 | * Get a set of request/reply buffers. |
1099 | * | ||
1100 | * Reply buffer (if available) is attached to send buffer upon return. | ||
1079 | */ | 1101 | */ |
1080 | struct rpcrdma_req * | 1102 | struct rpcrdma_req * |
1081 | rpcrdma_buffer_get(struct rpcrdma_buffer *buffers) | 1103 | rpcrdma_buffer_get(struct rpcrdma_buffer *buffers) |
@@ -1085,21 +1107,15 @@ rpcrdma_buffer_get(struct rpcrdma_buffer *buffers) | |||
1085 | spin_lock(&buffers->rb_lock); | 1107 | spin_lock(&buffers->rb_lock); |
1086 | if (list_empty(&buffers->rb_send_bufs)) | 1108 | if (list_empty(&buffers->rb_send_bufs)) |
1087 | goto out_reqbuf; | 1109 | goto out_reqbuf; |
1110 | buffers->rb_send_count++; | ||
1088 | req = rpcrdma_buffer_get_req_locked(buffers); | 1111 | req = rpcrdma_buffer_get_req_locked(buffers); |
1089 | if (list_empty(&buffers->rb_recv_bufs)) | 1112 | req->rl_reply = rpcrdma_buffer_get_rep(buffers); |
1090 | goto out_repbuf; | ||
1091 | req->rl_reply = rpcrdma_buffer_get_rep_locked(buffers); | ||
1092 | spin_unlock(&buffers->rb_lock); | 1113 | spin_unlock(&buffers->rb_lock); |
1093 | return req; | 1114 | return req; |
1094 | 1115 | ||
1095 | out_reqbuf: | 1116 | out_reqbuf: |
1096 | spin_unlock(&buffers->rb_lock); | 1117 | spin_unlock(&buffers->rb_lock); |
1097 | pr_warn("rpcrdma: out of request buffers (%p)\n", buffers); | 1118 | pr_warn("RPC: %s: out of request buffers\n", __func__); |
1098 | return NULL; | ||
1099 | out_repbuf: | ||
1100 | list_add(&req->rl_free, &buffers->rb_send_bufs); | ||
1101 | spin_unlock(&buffers->rb_lock); | ||
1102 | pr_warn("rpcrdma: out of reply buffers (%p)\n", buffers); | ||
1103 | return NULL; | 1119 | return NULL; |
1104 | } | 1120 | } |
1105 | 1121 | ||
@@ -1117,9 +1133,12 @@ rpcrdma_buffer_put(struct rpcrdma_req *req) | |||
1117 | req->rl_reply = NULL; | 1133 | req->rl_reply = NULL; |
1118 | 1134 | ||
1119 | spin_lock(&buffers->rb_lock); | 1135 | spin_lock(&buffers->rb_lock); |
1136 | buffers->rb_send_count--; | ||
1120 | list_add_tail(&req->rl_free, &buffers->rb_send_bufs); | 1137 | list_add_tail(&req->rl_free, &buffers->rb_send_bufs); |
1121 | if (rep) | 1138 | if (rep) { |
1139 | buffers->rb_recv_count--; | ||
1122 | list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); | 1140 | list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); |
1141 | } | ||
1123 | spin_unlock(&buffers->rb_lock); | 1142 | spin_unlock(&buffers->rb_lock); |
1124 | } | 1143 | } |
1125 | 1144 | ||
@@ -1133,8 +1152,7 @@ rpcrdma_recv_buffer_get(struct rpcrdma_req *req) | |||
1133 | struct rpcrdma_buffer *buffers = req->rl_buffer; | 1152 | struct rpcrdma_buffer *buffers = req->rl_buffer; |
1134 | 1153 | ||
1135 | spin_lock(&buffers->rb_lock); | 1154 | spin_lock(&buffers->rb_lock); |
1136 | if (!list_empty(&buffers->rb_recv_bufs)) | 1155 | req->rl_reply = rpcrdma_buffer_get_rep(buffers); |
1137 | req->rl_reply = rpcrdma_buffer_get_rep_locked(buffers); | ||
1138 | spin_unlock(&buffers->rb_lock); | 1156 | spin_unlock(&buffers->rb_lock); |
1139 | } | 1157 | } |
1140 | 1158 | ||
@@ -1148,6 +1166,7 @@ rpcrdma_recv_buffer_put(struct rpcrdma_rep *rep) | |||
1148 | struct rpcrdma_buffer *buffers = &rep->rr_rxprt->rx_buf; | 1166 | struct rpcrdma_buffer *buffers = &rep->rr_rxprt->rx_buf; |
1149 | 1167 | ||
1150 | spin_lock(&buffers->rb_lock); | 1168 | spin_lock(&buffers->rb_lock); |
1169 | buffers->rb_recv_count--; | ||
1151 | list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); | 1170 | list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); |
1152 | spin_unlock(&buffers->rb_lock); | 1171 | spin_unlock(&buffers->rb_lock); |
1153 | } | 1172 | } |
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 670fad57153a..a71b0f5897d8 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h | |||
@@ -321,6 +321,7 @@ struct rpcrdma_buffer { | |||
321 | char *rb_pool; | 321 | char *rb_pool; |
322 | 322 | ||
323 | spinlock_t rb_lock; /* protect buf lists */ | 323 | spinlock_t rb_lock; /* protect buf lists */ |
324 | int rb_send_count, rb_recv_count; | ||
324 | struct list_head rb_send_bufs; | 325 | struct list_head rb_send_bufs; |
325 | struct list_head rb_recv_bufs; | 326 | struct list_head rb_recv_bufs; |
326 | u32 rb_max_requests; | 327 | u32 rb_max_requests; |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 8ede3bc52481..bf168838a029 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1074,7 +1074,7 @@ static void xs_udp_data_receive(struct sock_xprt *transport) | |||
1074 | skb = skb_recv_datagram(sk, 0, 1, &err); | 1074 | skb = skb_recv_datagram(sk, 0, 1, &err); |
1075 | if (skb != NULL) { | 1075 | if (skb != NULL) { |
1076 | xs_udp_data_read_skb(&transport->xprt, sk, skb); | 1076 | xs_udp_data_read_skb(&transport->xprt, sk, skb); |
1077 | skb_free_datagram(sk, skb); | 1077 | skb_free_datagram_locked(sk, skb); |
1078 | continue; | 1078 | continue; |
1079 | } | 1079 | } |
1080 | if (!test_and_clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) | 1080 | if (!test_and_clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) |
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 6b626a64b517..a04fe9be1c60 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -62,6 +62,8 @@ static void publ_to_item(struct distr_item *i, struct publication *p) | |||
62 | 62 | ||
63 | /** | 63 | /** |
64 | * named_prepare_buf - allocate & initialize a publication message | 64 | * named_prepare_buf - allocate & initialize a publication message |
65 | * | ||
66 | * The buffer returned is of size INT_H_SIZE + payload size | ||
65 | */ | 67 | */ |
66 | static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size, | 68 | static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size, |
67 | u32 dest) | 69 | u32 dest) |
@@ -141,9 +143,9 @@ static void named_distribute(struct net *net, struct sk_buff_head *list, | |||
141 | struct publication *publ; | 143 | struct publication *publ; |
142 | struct sk_buff *skb = NULL; | 144 | struct sk_buff *skb = NULL; |
143 | struct distr_item *item = NULL; | 145 | struct distr_item *item = NULL; |
144 | uint msg_dsz = (tipc_node_get_mtu(net, dnode, 0) / ITEM_SIZE) * | 146 | u32 msg_dsz = ((tipc_node_get_mtu(net, dnode, 0) - INT_H_SIZE) / |
145 | ITEM_SIZE; | 147 | ITEM_SIZE) * ITEM_SIZE; |
146 | uint msg_rem = msg_dsz; | 148 | u32 msg_rem = msg_dsz; |
147 | 149 | ||
148 | list_for_each_entry(publ, pls, local_list) { | 150 | list_for_each_entry(publ, pls, local_list) { |
149 | /* Prepare next buffer: */ | 151 | /* Prepare next buffer: */ |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index f1dffe84f0d5..8309687a56b0 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -661,11 +661,11 @@ static int unix_set_peek_off(struct sock *sk, int val) | |||
661 | { | 661 | { |
662 | struct unix_sock *u = unix_sk(sk); | 662 | struct unix_sock *u = unix_sk(sk); |
663 | 663 | ||
664 | if (mutex_lock_interruptible(&u->readlock)) | 664 | if (mutex_lock_interruptible(&u->iolock)) |
665 | return -EINTR; | 665 | return -EINTR; |
666 | 666 | ||
667 | sk->sk_peek_off = val; | 667 | sk->sk_peek_off = val; |
668 | mutex_unlock(&u->readlock); | 668 | mutex_unlock(&u->iolock); |
669 | 669 | ||
670 | return 0; | 670 | return 0; |
671 | } | 671 | } |
@@ -779,7 +779,8 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern) | |||
779 | spin_lock_init(&u->lock); | 779 | spin_lock_init(&u->lock); |
780 | atomic_long_set(&u->inflight, 0); | 780 | atomic_long_set(&u->inflight, 0); |
781 | INIT_LIST_HEAD(&u->link); | 781 | INIT_LIST_HEAD(&u->link); |
782 | mutex_init(&u->readlock); /* single task reading lock */ | 782 | mutex_init(&u->iolock); /* single task reading lock */ |
783 | mutex_init(&u->bindlock); /* single task binding lock */ | ||
783 | init_waitqueue_head(&u->peer_wait); | 784 | init_waitqueue_head(&u->peer_wait); |
784 | init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay); | 785 | init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay); |
785 | unix_insert_socket(unix_sockets_unbound(sk), sk); | 786 | unix_insert_socket(unix_sockets_unbound(sk), sk); |
@@ -848,7 +849,7 @@ static int unix_autobind(struct socket *sock) | |||
848 | int err; | 849 | int err; |
849 | unsigned int retries = 0; | 850 | unsigned int retries = 0; |
850 | 851 | ||
851 | err = mutex_lock_interruptible(&u->readlock); | 852 | err = mutex_lock_interruptible(&u->bindlock); |
852 | if (err) | 853 | if (err) |
853 | return err; | 854 | return err; |
854 | 855 | ||
@@ -895,7 +896,7 @@ retry: | |||
895 | spin_unlock(&unix_table_lock); | 896 | spin_unlock(&unix_table_lock); |
896 | err = 0; | 897 | err = 0; |
897 | 898 | ||
898 | out: mutex_unlock(&u->readlock); | 899 | out: mutex_unlock(&u->bindlock); |
899 | return err; | 900 | return err; |
900 | } | 901 | } |
901 | 902 | ||
@@ -954,20 +955,32 @@ fail: | |||
954 | return NULL; | 955 | return NULL; |
955 | } | 956 | } |
956 | 957 | ||
957 | static int unix_mknod(struct dentry *dentry, const struct path *path, umode_t mode, | 958 | static int unix_mknod(const char *sun_path, umode_t mode, struct path *res) |
958 | struct path *res) | ||
959 | { | 959 | { |
960 | int err; | 960 | struct dentry *dentry; |
961 | struct path path; | ||
962 | int err = 0; | ||
963 | /* | ||
964 | * Get the parent directory, calculate the hash for last | ||
965 | * component. | ||
966 | */ | ||
967 | dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0); | ||
968 | err = PTR_ERR(dentry); | ||
969 | if (IS_ERR(dentry)) | ||
970 | return err; | ||
961 | 971 | ||
962 | err = security_path_mknod(path, dentry, mode, 0); | 972 | /* |
973 | * All right, let's create it. | ||
974 | */ | ||
975 | err = security_path_mknod(&path, dentry, mode, 0); | ||
963 | if (!err) { | 976 | if (!err) { |
964 | err = vfs_mknod(d_inode(path->dentry), dentry, mode, 0); | 977 | err = vfs_mknod(d_inode(path.dentry), dentry, mode, 0); |
965 | if (!err) { | 978 | if (!err) { |
966 | res->mnt = mntget(path->mnt); | 979 | res->mnt = mntget(path.mnt); |
967 | res->dentry = dget(dentry); | 980 | res->dentry = dget(dentry); |
968 | } | 981 | } |
969 | } | 982 | } |
970 | 983 | done_path_create(&path, dentry); | |
971 | return err; | 984 | return err; |
972 | } | 985 | } |
973 | 986 | ||
@@ -978,12 +991,10 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
978 | struct unix_sock *u = unix_sk(sk); | 991 | struct unix_sock *u = unix_sk(sk); |
979 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; | 992 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
980 | char *sun_path = sunaddr->sun_path; | 993 | char *sun_path = sunaddr->sun_path; |
981 | int err, name_err; | 994 | int err; |
982 | unsigned int hash; | 995 | unsigned int hash; |
983 | struct unix_address *addr; | 996 | struct unix_address *addr; |
984 | struct hlist_head *list; | 997 | struct hlist_head *list; |
985 | struct path path; | ||
986 | struct dentry *dentry; | ||
987 | 998 | ||
988 | err = -EINVAL; | 999 | err = -EINVAL; |
989 | if (sunaddr->sun_family != AF_UNIX) | 1000 | if (sunaddr->sun_family != AF_UNIX) |
@@ -999,34 +1010,14 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
999 | goto out; | 1010 | goto out; |
1000 | addr_len = err; | 1011 | addr_len = err; |
1001 | 1012 | ||
1002 | name_err = 0; | 1013 | err = mutex_lock_interruptible(&u->bindlock); |
1003 | dentry = NULL; | ||
1004 | if (sun_path[0]) { | ||
1005 | /* Get the parent directory, calculate the hash for last | ||
1006 | * component. | ||
1007 | */ | ||
1008 | dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0); | ||
1009 | |||
1010 | if (IS_ERR(dentry)) { | ||
1011 | /* delay report until after 'already bound' check */ | ||
1012 | name_err = PTR_ERR(dentry); | ||
1013 | dentry = NULL; | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | err = mutex_lock_interruptible(&u->readlock); | ||
1018 | if (err) | 1014 | if (err) |
1019 | goto out_path; | 1015 | goto out; |
1020 | 1016 | ||
1021 | err = -EINVAL; | 1017 | err = -EINVAL; |
1022 | if (u->addr) | 1018 | if (u->addr) |
1023 | goto out_up; | 1019 | goto out_up; |
1024 | 1020 | ||
1025 | if (name_err) { | ||
1026 | err = name_err == -EEXIST ? -EADDRINUSE : name_err; | ||
1027 | goto out_up; | ||
1028 | } | ||
1029 | |||
1030 | err = -ENOMEM; | 1021 | err = -ENOMEM; |
1031 | addr = kmalloc(sizeof(*addr)+addr_len, GFP_KERNEL); | 1022 | addr = kmalloc(sizeof(*addr)+addr_len, GFP_KERNEL); |
1032 | if (!addr) | 1023 | if (!addr) |
@@ -1037,11 +1028,11 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1037 | addr->hash = hash ^ sk->sk_type; | 1028 | addr->hash = hash ^ sk->sk_type; |
1038 | atomic_set(&addr->refcnt, 1); | 1029 | atomic_set(&addr->refcnt, 1); |
1039 | 1030 | ||
1040 | if (dentry) { | 1031 | if (sun_path[0]) { |
1041 | struct path u_path; | 1032 | struct path path; |
1042 | umode_t mode = S_IFSOCK | | 1033 | umode_t mode = S_IFSOCK | |
1043 | (SOCK_INODE(sock)->i_mode & ~current_umask()); | 1034 | (SOCK_INODE(sock)->i_mode & ~current_umask()); |
1044 | err = unix_mknod(dentry, &path, mode, &u_path); | 1035 | err = unix_mknod(sun_path, mode, &path); |
1045 | if (err) { | 1036 | if (err) { |
1046 | if (err == -EEXIST) | 1037 | if (err == -EEXIST) |
1047 | err = -EADDRINUSE; | 1038 | err = -EADDRINUSE; |
@@ -1049,9 +1040,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1049 | goto out_up; | 1040 | goto out_up; |
1050 | } | 1041 | } |
1051 | addr->hash = UNIX_HASH_SIZE; | 1042 | addr->hash = UNIX_HASH_SIZE; |
1052 | hash = d_real_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1); | 1043 | hash = d_real_inode(path.dentry)->i_ino & (UNIX_HASH_SIZE - 1); |
1053 | spin_lock(&unix_table_lock); | 1044 | spin_lock(&unix_table_lock); |
1054 | u->path = u_path; | 1045 | u->path = path; |
1055 | list = &unix_socket_table[hash]; | 1046 | list = &unix_socket_table[hash]; |
1056 | } else { | 1047 | } else { |
1057 | spin_lock(&unix_table_lock); | 1048 | spin_lock(&unix_table_lock); |
@@ -1073,11 +1064,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1073 | out_unlock: | 1064 | out_unlock: |
1074 | spin_unlock(&unix_table_lock); | 1065 | spin_unlock(&unix_table_lock); |
1075 | out_up: | 1066 | out_up: |
1076 | mutex_unlock(&u->readlock); | 1067 | mutex_unlock(&u->bindlock); |
1077 | out_path: | ||
1078 | if (dentry) | ||
1079 | done_path_create(&path, dentry); | ||
1080 | |||
1081 | out: | 1068 | out: |
1082 | return err; | 1069 | return err; |
1083 | } | 1070 | } |
@@ -1969,17 +1956,17 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page, | |||
1969 | if (false) { | 1956 | if (false) { |
1970 | alloc_skb: | 1957 | alloc_skb: |
1971 | unix_state_unlock(other); | 1958 | unix_state_unlock(other); |
1972 | mutex_unlock(&unix_sk(other)->readlock); | 1959 | mutex_unlock(&unix_sk(other)->iolock); |
1973 | newskb = sock_alloc_send_pskb(sk, 0, 0, flags & MSG_DONTWAIT, | 1960 | newskb = sock_alloc_send_pskb(sk, 0, 0, flags & MSG_DONTWAIT, |
1974 | &err, 0); | 1961 | &err, 0); |
1975 | if (!newskb) | 1962 | if (!newskb) |
1976 | goto err; | 1963 | goto err; |
1977 | } | 1964 | } |
1978 | 1965 | ||
1979 | /* we must acquire readlock as we modify already present | 1966 | /* we must acquire iolock as we modify already present |
1980 | * skbs in the sk_receive_queue and mess with skb->len | 1967 | * skbs in the sk_receive_queue and mess with skb->len |
1981 | */ | 1968 | */ |
1982 | err = mutex_lock_interruptible(&unix_sk(other)->readlock); | 1969 | err = mutex_lock_interruptible(&unix_sk(other)->iolock); |
1983 | if (err) { | 1970 | if (err) { |
1984 | err = flags & MSG_DONTWAIT ? -EAGAIN : -ERESTARTSYS; | 1971 | err = flags & MSG_DONTWAIT ? -EAGAIN : -ERESTARTSYS; |
1985 | goto err; | 1972 | goto err; |
@@ -2046,7 +2033,7 @@ alloc_skb: | |||
2046 | } | 2033 | } |
2047 | 2034 | ||
2048 | unix_state_unlock(other); | 2035 | unix_state_unlock(other); |
2049 | mutex_unlock(&unix_sk(other)->readlock); | 2036 | mutex_unlock(&unix_sk(other)->iolock); |
2050 | 2037 | ||
2051 | other->sk_data_ready(other); | 2038 | other->sk_data_ready(other); |
2052 | scm_destroy(&scm); | 2039 | scm_destroy(&scm); |
@@ -2055,7 +2042,7 @@ alloc_skb: | |||
2055 | err_state_unlock: | 2042 | err_state_unlock: |
2056 | unix_state_unlock(other); | 2043 | unix_state_unlock(other); |
2057 | err_unlock: | 2044 | err_unlock: |
2058 | mutex_unlock(&unix_sk(other)->readlock); | 2045 | mutex_unlock(&unix_sk(other)->iolock); |
2059 | err: | 2046 | err: |
2060 | kfree_skb(newskb); | 2047 | kfree_skb(newskb); |
2061 | if (send_sigpipe && !(flags & MSG_NOSIGNAL)) | 2048 | if (send_sigpipe && !(flags & MSG_NOSIGNAL)) |
@@ -2123,7 +2110,7 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, | |||
2123 | timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); | 2110 | timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); |
2124 | 2111 | ||
2125 | do { | 2112 | do { |
2126 | mutex_lock(&u->readlock); | 2113 | mutex_lock(&u->iolock); |
2127 | 2114 | ||
2128 | skip = sk_peek_offset(sk, flags); | 2115 | skip = sk_peek_offset(sk, flags); |
2129 | skb = __skb_try_recv_datagram(sk, flags, &peeked, &skip, &err, | 2116 | skb = __skb_try_recv_datagram(sk, flags, &peeked, &skip, &err, |
@@ -2131,14 +2118,14 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, | |||
2131 | if (skb) | 2118 | if (skb) |
2132 | break; | 2119 | break; |
2133 | 2120 | ||
2134 | mutex_unlock(&u->readlock); | 2121 | mutex_unlock(&u->iolock); |
2135 | 2122 | ||
2136 | if (err != -EAGAIN) | 2123 | if (err != -EAGAIN) |
2137 | break; | 2124 | break; |
2138 | } while (timeo && | 2125 | } while (timeo && |
2139 | !__skb_wait_for_more_packets(sk, &err, &timeo, last)); | 2126 | !__skb_wait_for_more_packets(sk, &err, &timeo, last)); |
2140 | 2127 | ||
2141 | if (!skb) { /* implies readlock unlocked */ | 2128 | if (!skb) { /* implies iolock unlocked */ |
2142 | unix_state_lock(sk); | 2129 | unix_state_lock(sk); |
2143 | /* Signal EOF on disconnected non-blocking SEQPACKET socket. */ | 2130 | /* Signal EOF on disconnected non-blocking SEQPACKET socket. */ |
2144 | if (sk->sk_type == SOCK_SEQPACKET && err == -EAGAIN && | 2131 | if (sk->sk_type == SOCK_SEQPACKET && err == -EAGAIN && |
@@ -2203,7 +2190,7 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, | |||
2203 | 2190 | ||
2204 | out_free: | 2191 | out_free: |
2205 | skb_free_datagram(sk, skb); | 2192 | skb_free_datagram(sk, skb); |
2206 | mutex_unlock(&u->readlock); | 2193 | mutex_unlock(&u->iolock); |
2207 | out: | 2194 | out: |
2208 | return err; | 2195 | return err; |
2209 | } | 2196 | } |
@@ -2298,7 +2285,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state) | |||
2298 | /* Lock the socket to prevent queue disordering | 2285 | /* Lock the socket to prevent queue disordering |
2299 | * while sleeps in memcpy_tomsg | 2286 | * while sleeps in memcpy_tomsg |
2300 | */ | 2287 | */ |
2301 | mutex_lock(&u->readlock); | 2288 | mutex_lock(&u->iolock); |
2302 | 2289 | ||
2303 | if (flags & MSG_PEEK) | 2290 | if (flags & MSG_PEEK) |
2304 | skip = sk_peek_offset(sk, flags); | 2291 | skip = sk_peek_offset(sk, flags); |
@@ -2340,7 +2327,7 @@ again: | |||
2340 | break; | 2327 | break; |
2341 | } | 2328 | } |
2342 | 2329 | ||
2343 | mutex_unlock(&u->readlock); | 2330 | mutex_unlock(&u->iolock); |
2344 | 2331 | ||
2345 | timeo = unix_stream_data_wait(sk, timeo, last, | 2332 | timeo = unix_stream_data_wait(sk, timeo, last, |
2346 | last_len); | 2333 | last_len); |
@@ -2351,7 +2338,7 @@ again: | |||
2351 | goto out; | 2338 | goto out; |
2352 | } | 2339 | } |
2353 | 2340 | ||
2354 | mutex_lock(&u->readlock); | 2341 | mutex_lock(&u->iolock); |
2355 | goto redo; | 2342 | goto redo; |
2356 | unlock: | 2343 | unlock: |
2357 | unix_state_unlock(sk); | 2344 | unix_state_unlock(sk); |
@@ -2454,7 +2441,7 @@ unlock: | |||
2454 | } | 2441 | } |
2455 | } while (size); | 2442 | } while (size); |
2456 | 2443 | ||
2457 | mutex_unlock(&u->readlock); | 2444 | mutex_unlock(&u->iolock); |
2458 | if (state->msg) | 2445 | if (state->msg) |
2459 | scm_recv(sock, state->msg, &scm, flags); | 2446 | scm_recv(sock, state->msg, &scm, flags); |
2460 | else | 2447 | else |
@@ -2495,9 +2482,9 @@ static ssize_t skb_unix_socket_splice(struct sock *sk, | |||
2495 | int ret; | 2482 | int ret; |
2496 | struct unix_sock *u = unix_sk(sk); | 2483 | struct unix_sock *u = unix_sk(sk); |
2497 | 2484 | ||
2498 | mutex_unlock(&u->readlock); | 2485 | mutex_unlock(&u->iolock); |
2499 | ret = splice_to_pipe(pipe, spd); | 2486 | ret = splice_to_pipe(pipe, spd); |
2500 | mutex_lock(&u->readlock); | 2487 | mutex_lock(&u->iolock); |
2501 | 2488 | ||
2502 | return ret; | 2489 | return ret; |
2503 | } | 2490 | } |
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c index dbb2738e356a..6250b1cfcde5 100644 --- a/net/wireless/wext-core.c +++ b/net/wireless/wext-core.c | |||
@@ -958,29 +958,8 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, | |||
958 | return private(dev, iwr, cmd, info, handler); | 958 | return private(dev, iwr, cmd, info, handler); |
959 | } | 959 | } |
960 | /* Old driver API : call driver ioctl handler */ | 960 | /* Old driver API : call driver ioctl handler */ |
961 | if (dev->netdev_ops->ndo_do_ioctl) { | 961 | if (dev->netdev_ops->ndo_do_ioctl) |
962 | #ifdef CONFIG_COMPAT | 962 | return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); |
963 | if (info->flags & IW_REQUEST_FLAG_COMPAT) { | ||
964 | int ret = 0; | ||
965 | struct iwreq iwr_lcl; | ||
966 | struct compat_iw_point *iwp_compat = (void *) &iwr->u.data; | ||
967 | |||
968 | memcpy(&iwr_lcl, iwr, sizeof(struct iwreq)); | ||
969 | iwr_lcl.u.data.pointer = compat_ptr(iwp_compat->pointer); | ||
970 | iwr_lcl.u.data.length = iwp_compat->length; | ||
971 | iwr_lcl.u.data.flags = iwp_compat->flags; | ||
972 | |||
973 | ret = dev->netdev_ops->ndo_do_ioctl(dev, (void *) &iwr_lcl, cmd); | ||
974 | |||
975 | iwp_compat->pointer = ptr_to_compat(iwr_lcl.u.data.pointer); | ||
976 | iwp_compat->length = iwr_lcl.u.data.length; | ||
977 | iwp_compat->flags = iwr_lcl.u.data.flags; | ||
978 | |||
979 | return ret; | ||
980 | } else | ||
981 | #endif | ||
982 | return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); | ||
983 | } | ||
984 | return -EOPNOTSUPP; | 963 | return -EOPNOTSUPP; |
985 | } | 964 | } |
986 | 965 | ||
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 1c4ad477ce93..6e3f0254d8a1 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c | |||
@@ -207,15 +207,15 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
207 | family = XFRM_SPI_SKB_CB(skb)->family; | 207 | family = XFRM_SPI_SKB_CB(skb)->family; |
208 | 208 | ||
209 | /* if tunnel is present override skb->mark value with tunnel i_key */ | 209 | /* if tunnel is present override skb->mark value with tunnel i_key */ |
210 | if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) { | 210 | switch (family) { |
211 | switch (family) { | 211 | case AF_INET: |
212 | case AF_INET: | 212 | if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) |
213 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); | 213 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); |
214 | break; | 214 | break; |
215 | case AF_INET6: | 215 | case AF_INET6: |
216 | if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6) | ||
216 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); | 217 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); |
217 | break; | 218 | break; |
218 | } | ||
219 | } | 219 | } |
220 | 220 | ||
221 | /* Allocate new secpath or COW existing one. */ | 221 | /* Allocate new secpath or COW existing one. */ |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index b5e665b3cfb0..45f9cf97ea25 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -626,6 +626,10 @@ static void xfrm_hash_rebuild(struct work_struct *work) | |||
626 | 626 | ||
627 | /* re-insert all policies by order of creation */ | 627 | /* re-insert all policies by order of creation */ |
628 | list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) { | 628 | list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) { |
629 | if (xfrm_policy_id2dir(policy->index) >= XFRM_POLICY_MAX) { | ||
630 | /* skip socket policies */ | ||
631 | continue; | ||
632 | } | ||
629 | newpos = NULL; | 633 | newpos = NULL; |
630 | chain = policy_hash_bysel(net, &policy->selector, | 634 | chain = policy_hash_bysel(net, &policy->selector, |
631 | policy->family, | 635 | policy->family, |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index d516845e16e3..cb65d916a345 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -896,7 +896,8 @@ static int xfrm_dump_sa_done(struct netlink_callback *cb) | |||
896 | struct sock *sk = cb->skb->sk; | 896 | struct sock *sk = cb->skb->sk; |
897 | struct net *net = sock_net(sk); | 897 | struct net *net = sock_net(sk); |
898 | 898 | ||
899 | xfrm_state_walk_done(walk, net); | 899 | if (cb->args[0]) |
900 | xfrm_state_walk_done(walk, net); | ||
900 | return 0; | 901 | return 0; |
901 | } | 902 | } |
902 | 903 | ||
@@ -921,8 +922,6 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) | |||
921 | u8 proto = 0; | 922 | u8 proto = 0; |
922 | int err; | 923 | int err; |
923 | 924 | ||
924 | cb->args[0] = 1; | ||
925 | |||
926 | err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, | 925 | err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, |
927 | xfrma_policy); | 926 | xfrma_policy); |
928 | if (err < 0) | 927 | if (err < 0) |
@@ -939,6 +938,7 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) | |||
939 | proto = nla_get_u8(attrs[XFRMA_PROTO]); | 938 | proto = nla_get_u8(attrs[XFRMA_PROTO]); |
940 | 939 | ||
941 | xfrm_state_walk_init(walk, proto, filter); | 940 | xfrm_state_walk_init(walk, proto, filter); |
941 | cb->args[0] = 1; | ||
942 | } | 942 | } |
943 | 943 | ||
944 | (void) xfrm_state_walk(net, walk, dump_one_state, &info); | 944 | (void) xfrm_state_walk(net, walk, dump_one_state, &info); |
@@ -2051,9 +2051,6 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2051 | if (up->hard) { | 2051 | if (up->hard) { |
2052 | xfrm_policy_delete(xp, p->dir); | 2052 | xfrm_policy_delete(xp, p->dir); |
2053 | xfrm_audit_policy_delete(xp, 1, true); | 2053 | xfrm_audit_policy_delete(xp, 1, true); |
2054 | } else { | ||
2055 | // reset the timers here? | ||
2056 | WARN(1, "Don't know what to do with soft policy expire\n"); | ||
2057 | } | 2054 | } |
2058 | km_policy_expired(xp, p->dir, up->hard, nlh->nlmsg_pid); | 2055 | km_policy_expired(xp, p->dir, up->hard, nlh->nlmsg_pid); |
2059 | 2056 | ||
@@ -2117,7 +2114,7 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2117 | 2114 | ||
2118 | err = verify_newpolicy_info(&ua->policy); | 2115 | err = verify_newpolicy_info(&ua->policy); |
2119 | if (err) | 2116 | if (err) |
2120 | goto bad_policy; | 2117 | goto free_state; |
2121 | 2118 | ||
2122 | /* build an XP */ | 2119 | /* build an XP */ |
2123 | xp = xfrm_policy_construct(net, &ua->policy, attrs, &err); | 2120 | xp = xfrm_policy_construct(net, &ua->policy, attrs, &err); |
@@ -2149,8 +2146,6 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2149 | 2146 | ||
2150 | return 0; | 2147 | return 0; |
2151 | 2148 | ||
2152 | bad_policy: | ||
2153 | WARN(1, "BAD policy passed\n"); | ||
2154 | free_state: | 2149 | free_state: |
2155 | kfree(x); | 2150 | kfree(x); |
2156 | nomem: | 2151 | nomem: |
diff --git a/scripts/faddr2line b/scripts/faddr2line new file mode 100755 index 000000000000..450b33257339 --- /dev/null +++ b/scripts/faddr2line | |||
@@ -0,0 +1,177 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Translate stack dump function offsets. | ||
4 | # | ||
5 | # addr2line doesn't work with KASLR addresses. This works similarly to | ||
6 | # addr2line, but instead takes the 'func+0x123' format as input: | ||
7 | # | ||
8 | # $ ./scripts/faddr2line ~/k/vmlinux meminfo_proc_show+0x5/0x568 | ||
9 | # meminfo_proc_show+0x5/0x568: | ||
10 | # meminfo_proc_show at fs/proc/meminfo.c:27 | ||
11 | # | ||
12 | # If the address is part of an inlined function, the full inline call chain is | ||
13 | # printed: | ||
14 | # | ||
15 | # $ ./scripts/faddr2line ~/k/vmlinux native_write_msr+0x6/0x27 | ||
16 | # native_write_msr+0x6/0x27: | ||
17 | # arch_static_branch at arch/x86/include/asm/msr.h:121 | ||
18 | # (inlined by) static_key_false at include/linux/jump_label.h:125 | ||
19 | # (inlined by) native_write_msr at arch/x86/include/asm/msr.h:125 | ||
20 | # | ||
21 | # The function size after the '/' in the input is optional, but recommended. | ||
22 | # It's used to help disambiguate any duplicate symbol names, which can occur | ||
23 | # rarely. If the size is omitted for a duplicate symbol then it's possible for | ||
24 | # multiple code sites to be printed: | ||
25 | # | ||
26 | # $ ./scripts/faddr2line ~/k/vmlinux raw_ioctl+0x5 | ||
27 | # raw_ioctl+0x5/0x20: | ||
28 | # raw_ioctl at drivers/char/raw.c:122 | ||
29 | # | ||
30 | # raw_ioctl+0x5/0xb1: | ||
31 | # raw_ioctl at net/ipv4/raw.c:876 | ||
32 | # | ||
33 | # Multiple addresses can be specified on a single command line: | ||
34 | # | ||
35 | # $ ./scripts/faddr2line ~/k/vmlinux type_show+0x10/45 free_reserved_area+0x90 | ||
36 | # type_show+0x10/0x2d: | ||
37 | # type_show at drivers/video/backlight/backlight.c:213 | ||
38 | # | ||
39 | # free_reserved_area+0x90/0x123: | ||
40 | # free_reserved_area at mm/page_alloc.c:6429 (discriminator 2) | ||
41 | |||
42 | |||
43 | set -o errexit | ||
44 | set -o nounset | ||
45 | |||
46 | command -v awk >/dev/null 2>&1 || die "awk isn't installed" | ||
47 | command -v readelf >/dev/null 2>&1 || die "readelf isn't installed" | ||
48 | command -v addr2line >/dev/null 2>&1 || die "addr2line isn't installed" | ||
49 | |||
50 | usage() { | ||
51 | echo "usage: faddr2line <object file> <func+offset> <func+offset>..." >&2 | ||
52 | exit 1 | ||
53 | } | ||
54 | |||
55 | warn() { | ||
56 | echo "$1" >&2 | ||
57 | } | ||
58 | |||
59 | die() { | ||
60 | echo "ERROR: $1" >&2 | ||
61 | exit 1 | ||
62 | } | ||
63 | |||
64 | # Try to figure out the source directory prefix so we can remove it from the | ||
65 | # addr2line output. HACK ALERT: This assumes that start_kernel() is in | ||
66 | # kernel/init.c! This only works for vmlinux. Otherwise it falls back to | ||
67 | # printing the absolute path. | ||
68 | find_dir_prefix() { | ||
69 | local objfile=$1 | ||
70 | |||
71 | local start_kernel_addr=$(readelf -sW $objfile | awk '$8 == "start_kernel" {printf "0x%s", $2}') | ||
72 | [[ -z $start_kernel_addr ]] && return | ||
73 | |||
74 | local file_line=$(addr2line -e $objfile $start_kernel_addr) | ||
75 | [[ -z $file_line ]] && return | ||
76 | |||
77 | local prefix=${file_line%init/main.c:*} | ||
78 | if [[ -z $prefix ]] || [[ $prefix = $file_line ]]; then | ||
79 | return | ||
80 | fi | ||
81 | |||
82 | DIR_PREFIX=$prefix | ||
83 | return 0 | ||
84 | } | ||
85 | |||
86 | __faddr2line() { | ||
87 | local objfile=$1 | ||
88 | local func_addr=$2 | ||
89 | local dir_prefix=$3 | ||
90 | local print_warnings=$4 | ||
91 | |||
92 | local func=${func_addr%+*} | ||
93 | local offset=${func_addr#*+} | ||
94 | offset=${offset%/*} | ||
95 | local size= | ||
96 | [[ $func_addr =~ "/" ]] && size=${func_addr#*/} | ||
97 | |||
98 | if [[ -z $func ]] || [[ -z $offset ]] || [[ $func = $func_addr ]]; then | ||
99 | warn "bad func+offset $func_addr" | ||
100 | DONE=1 | ||
101 | return | ||
102 | fi | ||
103 | |||
104 | # Go through each of the object's symbols which match the func name. | ||
105 | # In rare cases there might be duplicates. | ||
106 | while read symbol; do | ||
107 | local fields=($symbol) | ||
108 | local sym_base=0x${fields[1]} | ||
109 | local sym_size=${fields[2]} | ||
110 | local sym_type=${fields[3]} | ||
111 | |||
112 | # calculate the address | ||
113 | local addr=$(($sym_base + $offset)) | ||
114 | if [[ -z $addr ]] || [[ $addr = 0 ]]; then | ||
115 | warn "bad address: $sym_base + $offset" | ||
116 | DONE=1 | ||
117 | return | ||
118 | fi | ||
119 | local hexaddr=0x$(printf %x $addr) | ||
120 | |||
121 | # weed out non-function symbols | ||
122 | if [[ $sym_type != "FUNC" ]]; then | ||
123 | [[ $print_warnings = 1 ]] && | ||
124 | echo "skipping $func address at $hexaddr due to non-function symbol" | ||
125 | continue | ||
126 | fi | ||
127 | |||
128 | # if the user provided a size, make sure it matches the symbol's size | ||
129 | if [[ -n $size ]] && [[ $size -ne $sym_size ]]; then | ||
130 | [[ $print_warnings = 1 ]] && | ||
131 | echo "skipping $func address at $hexaddr due to size mismatch ($size != $sym_size)" | ||
132 | continue; | ||
133 | fi | ||
134 | |||
135 | # make sure the provided offset is within the symbol's range | ||
136 | if [[ $offset -gt $sym_size ]]; then | ||
137 | [[ $print_warnings = 1 ]] && | ||
138 | echo "skipping $func address at $hexaddr due to size mismatch ($offset > $sym_size)" | ||
139 | continue | ||
140 | fi | ||
141 | |||
142 | # separate multiple entries with a blank line | ||
143 | [[ $FIRST = 0 ]] && echo | ||
144 | FIRST=0 | ||
145 | |||
146 | local hexsize=0x$(printf %x $sym_size) | ||
147 | echo "$func+$offset/$hexsize:" | ||
148 | addr2line -fpie $objfile $hexaddr | sed "s; $dir_prefix\(\./\)*; ;" | ||
149 | DONE=1 | ||
150 | |||
151 | done < <(readelf -sW $objfile | awk -v f=$func '$8 == f {print}') | ||
152 | } | ||
153 | |||
154 | [[ $# -lt 2 ]] && usage | ||
155 | |||
156 | objfile=$1 | ||
157 | [[ ! -f $objfile ]] && die "can't find objfile $objfile" | ||
158 | shift | ||
159 | |||
160 | DIR_PREFIX=supercalifragilisticexpialidocious | ||
161 | find_dir_prefix $objfile | ||
162 | |||
163 | FIRST=1 | ||
164 | while [[ $# -gt 0 ]]; do | ||
165 | func_addr=$1 | ||
166 | shift | ||
167 | |||
168 | # print any matches found | ||
169 | DONE=0 | ||
170 | __faddr2line $objfile $func_addr $DIR_PREFIX 0 | ||
171 | |||
172 | # if no match was found, print warnings | ||
173 | if [[ $DONE = 0 ]]; then | ||
174 | __faddr2line $objfile $func_addr $DIR_PREFIX 1 | ||
175 | warn "no match for $func_addr" | ||
176 | fi | ||
177 | done | ||
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index e1c09e2f9be7..8ea9fd2b6573 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
@@ -332,7 +332,9 @@ if grep -q '^CONFIG_STACK_VALIDATION=y' $KCONFIG_CONFIG ; then | |||
332 | (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles" | 332 | (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles" |
333 | fi | 333 | fi |
334 | (cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles" | 334 | (cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles" |
335 | (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles" | 335 | if grep -q '^CONFIG_GCC_PLUGINS=y' $KCONFIG_CONFIG ; then |
336 | (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles" | ||
337 | fi | ||
336 | destdir=$kernel_headers_dir/usr/src/linux-headers-$version | 338 | destdir=$kernel_headers_dir/usr/src/linux-headers-$version |
337 | mkdir -p "$destdir" | 339 | mkdir -p "$destdir" |
338 | (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -) | 340 | (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -) |
diff --git a/security/Kconfig b/security/Kconfig index da10d9b573a4..118f4549404e 100644 --- a/security/Kconfig +++ b/security/Kconfig | |||
@@ -147,6 +147,17 @@ config HARDENED_USERCOPY | |||
147 | or are part of the kernel text. This kills entire classes | 147 | or are part of the kernel text. This kills entire classes |
148 | of heap overflow exploits and similar kernel memory exposures. | 148 | of heap overflow exploits and similar kernel memory exposures. |
149 | 149 | ||
150 | config HARDENED_USERCOPY_PAGESPAN | ||
151 | bool "Refuse to copy allocations that span multiple pages" | ||
152 | depends on HARDENED_USERCOPY | ||
153 | depends on EXPERT | ||
154 | help | ||
155 | When a multi-page allocation is done without __GFP_COMP, | ||
156 | hardened usercopy will reject attempts to copy it. There are, | ||
157 | however, several cases of this in the kernel that have not all | ||
158 | been removed. This config is intended to be used only while | ||
159 | trying to find such users. | ||
160 | |||
150 | source security/selinux/Kconfig | 161 | source security/selinux/Kconfig |
151 | source security/smack/Kconfig | 162 | source security/smack/Kconfig |
152 | source security/tomoyo/Kconfig | 163 | source security/tomoyo/Kconfig |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 795437b10082..b450a27588c8 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -1633,11 +1633,13 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1633 | return -EBUSY; | 1633 | return -EBUSY; |
1634 | } | 1634 | } |
1635 | list_add_tail(&rmidi->list, &snd_rawmidi_devices); | 1635 | list_add_tail(&rmidi->list, &snd_rawmidi_devices); |
1636 | mutex_unlock(®ister_mutex); | ||
1636 | err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI, | 1637 | err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI, |
1637 | rmidi->card, rmidi->device, | 1638 | rmidi->card, rmidi->device, |
1638 | &snd_rawmidi_f_ops, rmidi, &rmidi->dev); | 1639 | &snd_rawmidi_f_ops, rmidi, &rmidi->dev); |
1639 | if (err < 0) { | 1640 | if (err < 0) { |
1640 | rmidi_err(rmidi, "unable to register\n"); | 1641 | rmidi_err(rmidi, "unable to register\n"); |
1642 | mutex_lock(®ister_mutex); | ||
1641 | list_del(&rmidi->list); | 1643 | list_del(&rmidi->list); |
1642 | mutex_unlock(®ister_mutex); | 1644 | mutex_unlock(®ister_mutex); |
1643 | return err; | 1645 | return err; |
@@ -1645,6 +1647,7 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1645 | if (rmidi->ops && rmidi->ops->dev_register && | 1647 | if (rmidi->ops && rmidi->ops->dev_register && |
1646 | (err = rmidi->ops->dev_register(rmidi)) < 0) { | 1648 | (err = rmidi->ops->dev_register(rmidi)) < 0) { |
1647 | snd_unregister_device(&rmidi->dev); | 1649 | snd_unregister_device(&rmidi->dev); |
1650 | mutex_lock(®ister_mutex); | ||
1648 | list_del(&rmidi->list); | 1651 | list_del(&rmidi->list); |
1649 | mutex_unlock(®ister_mutex); | 1652 | mutex_unlock(®ister_mutex); |
1650 | return err; | 1653 | return err; |
@@ -1677,7 +1680,6 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1677 | } | 1680 | } |
1678 | } | 1681 | } |
1679 | #endif /* CONFIG_SND_OSSEMUL */ | 1682 | #endif /* CONFIG_SND_OSSEMUL */ |
1680 | mutex_unlock(®ister_mutex); | ||
1681 | sprintf(name, "midi%d", rmidi->device); | 1683 | sprintf(name, "midi%d", rmidi->device); |
1682 | entry = snd_info_create_card_entry(rmidi->card, name, rmidi->card->proc_root); | 1684 | entry = snd_info_create_card_entry(rmidi->card, name, rmidi->card->proc_root); |
1683 | if (entry) { | 1685 | if (entry) { |
diff --git a/sound/core/timer.c b/sound/core/timer.c index 9a6157ea6881..fc144f43faa6 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -35,6 +35,9 @@ | |||
35 | #include <sound/initval.h> | 35 | #include <sound/initval.h> |
36 | #include <linux/kmod.h> | 36 | #include <linux/kmod.h> |
37 | 37 | ||
38 | /* internal flags */ | ||
39 | #define SNDRV_TIMER_IFLG_PAUSED 0x00010000 | ||
40 | |||
38 | #if IS_ENABLED(CONFIG_SND_HRTIMER) | 41 | #if IS_ENABLED(CONFIG_SND_HRTIMER) |
39 | #define DEFAULT_TIMER_LIMIT 4 | 42 | #define DEFAULT_TIMER_LIMIT 4 |
40 | #else | 43 | #else |
@@ -294,8 +297,21 @@ int snd_timer_open(struct snd_timer_instance **ti, | |||
294 | get_device(&timer->card->card_dev); | 297 | get_device(&timer->card->card_dev); |
295 | timeri->slave_class = tid->dev_sclass; | 298 | timeri->slave_class = tid->dev_sclass; |
296 | timeri->slave_id = slave_id; | 299 | timeri->slave_id = slave_id; |
297 | if (list_empty(&timer->open_list_head) && timer->hw.open) | 300 | |
298 | timer->hw.open(timer); | 301 | if (list_empty(&timer->open_list_head) && timer->hw.open) { |
302 | int err = timer->hw.open(timer); | ||
303 | if (err) { | ||
304 | kfree(timeri->owner); | ||
305 | kfree(timeri); | ||
306 | |||
307 | if (timer->card) | ||
308 | put_device(&timer->card->card_dev); | ||
309 | module_put(timer->module); | ||
310 | mutex_unlock(®ister_mutex); | ||
311 | return err; | ||
312 | } | ||
313 | } | ||
314 | |||
299 | list_add_tail(&timeri->open_list, &timer->open_list_head); | 315 | list_add_tail(&timeri->open_list, &timer->open_list_head); |
300 | snd_timer_check_master(timeri); | 316 | snd_timer_check_master(timeri); |
301 | mutex_unlock(®ister_mutex); | 317 | mutex_unlock(®ister_mutex); |
@@ -526,6 +542,10 @@ static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop) | |||
526 | } | 542 | } |
527 | } | 543 | } |
528 | timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); | 544 | timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); |
545 | if (stop) | ||
546 | timeri->flags &= ~SNDRV_TIMER_IFLG_PAUSED; | ||
547 | else | ||
548 | timeri->flags |= SNDRV_TIMER_IFLG_PAUSED; | ||
529 | snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : | 549 | snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : |
530 | SNDRV_TIMER_EVENT_CONTINUE); | 550 | SNDRV_TIMER_EVENT_CONTINUE); |
531 | unlock: | 551 | unlock: |
@@ -587,6 +607,10 @@ int snd_timer_stop(struct snd_timer_instance *timeri) | |||
587 | */ | 607 | */ |
588 | int snd_timer_continue(struct snd_timer_instance *timeri) | 608 | int snd_timer_continue(struct snd_timer_instance *timeri) |
589 | { | 609 | { |
610 | /* timer can continue only after pause */ | ||
611 | if (!(timeri->flags & SNDRV_TIMER_IFLG_PAUSED)) | ||
612 | return -EINVAL; | ||
613 | |||
590 | if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) | 614 | if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) |
591 | return snd_timer_start_slave(timeri, false); | 615 | return snd_timer_start_slave(timeri, false); |
592 | else | 616 | else |
@@ -813,6 +837,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, | |||
813 | timer->tmr_subdevice = tid->subdevice; | 837 | timer->tmr_subdevice = tid->subdevice; |
814 | if (id) | 838 | if (id) |
815 | strlcpy(timer->id, id, sizeof(timer->id)); | 839 | strlcpy(timer->id, id, sizeof(timer->id)); |
840 | timer->sticks = 1; | ||
816 | INIT_LIST_HEAD(&timer->device_list); | 841 | INIT_LIST_HEAD(&timer->device_list); |
817 | INIT_LIST_HEAD(&timer->open_list_head); | 842 | INIT_LIST_HEAD(&timer->open_list_head); |
818 | INIT_LIST_HEAD(&timer->active_list_head); | 843 | INIT_LIST_HEAD(&timer->active_list_head); |
@@ -1817,6 +1842,9 @@ static int snd_timer_user_continue(struct file *file) | |||
1817 | tu = file->private_data; | 1842 | tu = file->private_data; |
1818 | if (!tu->timeri) | 1843 | if (!tu->timeri) |
1819 | return -EBADFD; | 1844 | return -EBADFD; |
1845 | /* start timer instead of continue if it's not used before */ | ||
1846 | if (!(tu->timeri->flags & SNDRV_TIMER_IFLG_PAUSED)) | ||
1847 | return snd_timer_user_start(file); | ||
1820 | tu->timeri->lost = 0; | 1848 | tu->timeri->lost = 0; |
1821 | return (err = snd_timer_continue(tu->timeri)) < 0 ? err : 0; | 1849 | return (err = snd_timer_continue(tu->timeri)) < 0 ? err : 0; |
1822 | } | 1850 | } |
@@ -1958,6 +1986,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, | |||
1958 | tu->qused--; | 1986 | tu->qused--; |
1959 | spin_unlock_irq(&tu->qlock); | 1987 | spin_unlock_irq(&tu->qlock); |
1960 | 1988 | ||
1989 | mutex_lock(&tu->ioctl_lock); | ||
1961 | if (tu->tread) { | 1990 | if (tu->tread) { |
1962 | if (copy_to_user(buffer, &tu->tqueue[qhead], | 1991 | if (copy_to_user(buffer, &tu->tqueue[qhead], |
1963 | sizeof(struct snd_timer_tread))) | 1992 | sizeof(struct snd_timer_tread))) |
@@ -1967,6 +1996,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, | |||
1967 | sizeof(struct snd_timer_read))) | 1996 | sizeof(struct snd_timer_read))) |
1968 | err = -EFAULT; | 1997 | err = -EFAULT; |
1969 | } | 1998 | } |
1999 | mutex_unlock(&tu->ioctl_lock); | ||
1970 | 2000 | ||
1971 | spin_lock_irq(&tu->qlock); | 2001 | spin_lock_irq(&tu->qlock); |
1972 | if (err < 0) | 2002 | if (err < 0) |
diff --git a/sound/firewire/fireworks/fireworks.h b/sound/firewire/fireworks/fireworks.h index 03ed35237e2b..d73c12b8753d 100644 --- a/sound/firewire/fireworks/fireworks.h +++ b/sound/firewire/fireworks/fireworks.h | |||
@@ -108,7 +108,6 @@ struct snd_efw { | |||
108 | u8 *resp_buf; | 108 | u8 *resp_buf; |
109 | u8 *pull_ptr; | 109 | u8 *pull_ptr; |
110 | u8 *push_ptr; | 110 | u8 *push_ptr; |
111 | unsigned int resp_queues; | ||
112 | }; | 111 | }; |
113 | 112 | ||
114 | int snd_efw_transaction_cmd(struct fw_unit *unit, | 113 | int snd_efw_transaction_cmd(struct fw_unit *unit, |
diff --git a/sound/firewire/fireworks/fireworks_hwdep.c b/sound/firewire/fireworks/fireworks_hwdep.c index 33df8655fe81..2e1d9a23920c 100644 --- a/sound/firewire/fireworks/fireworks_hwdep.c +++ b/sound/firewire/fireworks/fireworks_hwdep.c | |||
@@ -25,6 +25,7 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained, | |||
25 | { | 25 | { |
26 | unsigned int length, till_end, type; | 26 | unsigned int length, till_end, type; |
27 | struct snd_efw_transaction *t; | 27 | struct snd_efw_transaction *t; |
28 | u8 *pull_ptr; | ||
28 | long count = 0; | 29 | long count = 0; |
29 | 30 | ||
30 | if (remained < sizeof(type) + sizeof(struct snd_efw_transaction)) | 31 | if (remained < sizeof(type) + sizeof(struct snd_efw_transaction)) |
@@ -38,8 +39,17 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained, | |||
38 | buf += sizeof(type); | 39 | buf += sizeof(type); |
39 | 40 | ||
40 | /* write into buffer as many responses as possible */ | 41 | /* write into buffer as many responses as possible */ |
41 | while (efw->resp_queues > 0) { | 42 | spin_lock_irq(&efw->lock); |
42 | t = (struct snd_efw_transaction *)(efw->pull_ptr); | 43 | |
44 | /* | ||
45 | * When another task reaches here during this task's access to user | ||
46 | * space, it picks up current position in buffer and can read the same | ||
47 | * series of responses. | ||
48 | */ | ||
49 | pull_ptr = efw->pull_ptr; | ||
50 | |||
51 | while (efw->push_ptr != pull_ptr) { | ||
52 | t = (struct snd_efw_transaction *)(pull_ptr); | ||
43 | length = be32_to_cpu(t->length) * sizeof(__be32); | 53 | length = be32_to_cpu(t->length) * sizeof(__be32); |
44 | 54 | ||
45 | /* confirm enough space for this response */ | 55 | /* confirm enough space for this response */ |
@@ -49,26 +59,39 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained, | |||
49 | /* copy from ring buffer to user buffer */ | 59 | /* copy from ring buffer to user buffer */ |
50 | while (length > 0) { | 60 | while (length > 0) { |
51 | till_end = snd_efw_resp_buf_size - | 61 | till_end = snd_efw_resp_buf_size - |
52 | (unsigned int)(efw->pull_ptr - efw->resp_buf); | 62 | (unsigned int)(pull_ptr - efw->resp_buf); |
53 | till_end = min_t(unsigned int, length, till_end); | 63 | till_end = min_t(unsigned int, length, till_end); |
54 | 64 | ||
55 | if (copy_to_user(buf, efw->pull_ptr, till_end)) | 65 | spin_unlock_irq(&efw->lock); |
66 | |||
67 | if (copy_to_user(buf, pull_ptr, till_end)) | ||
56 | return -EFAULT; | 68 | return -EFAULT; |
57 | 69 | ||
58 | efw->pull_ptr += till_end; | 70 | spin_lock_irq(&efw->lock); |
59 | if (efw->pull_ptr >= efw->resp_buf + | 71 | |
60 | snd_efw_resp_buf_size) | 72 | pull_ptr += till_end; |
61 | efw->pull_ptr -= snd_efw_resp_buf_size; | 73 | if (pull_ptr >= efw->resp_buf + snd_efw_resp_buf_size) |
74 | pull_ptr -= snd_efw_resp_buf_size; | ||
62 | 75 | ||
63 | length -= till_end; | 76 | length -= till_end; |
64 | buf += till_end; | 77 | buf += till_end; |
65 | count += till_end; | 78 | count += till_end; |
66 | remained -= till_end; | 79 | remained -= till_end; |
67 | } | 80 | } |
68 | |||
69 | efw->resp_queues--; | ||
70 | } | 81 | } |
71 | 82 | ||
83 | /* | ||
84 | * All of tasks can read from the buffer nearly simultaneously, but the | ||
85 | * last position for each task is different depending on the length of | ||
86 | * given buffer. Here, for simplicity, a position of buffer is set by | ||
87 | * the latest task. It's better for a listening application to allow one | ||
88 | * thread to read from the buffer. Unless, each task can read different | ||
89 | * sequence of responses depending on variation of buffer length. | ||
90 | */ | ||
91 | efw->pull_ptr = pull_ptr; | ||
92 | |||
93 | spin_unlock_irq(&efw->lock); | ||
94 | |||
72 | return count; | 95 | return count; |
73 | } | 96 | } |
74 | 97 | ||
@@ -76,14 +99,17 @@ static long | |||
76 | hwdep_read_locked(struct snd_efw *efw, char __user *buf, long count, | 99 | hwdep_read_locked(struct snd_efw *efw, char __user *buf, long count, |
77 | loff_t *offset) | 100 | loff_t *offset) |
78 | { | 101 | { |
79 | union snd_firewire_event event; | 102 | union snd_firewire_event event = { |
103 | .lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS, | ||
104 | }; | ||
80 | 105 | ||
81 | memset(&event, 0, sizeof(event)); | 106 | spin_lock_irq(&efw->lock); |
82 | 107 | ||
83 | event.lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS; | ||
84 | event.lock_status.status = (efw->dev_lock_count > 0); | 108 | event.lock_status.status = (efw->dev_lock_count > 0); |
85 | efw->dev_lock_changed = false; | 109 | efw->dev_lock_changed = false; |
86 | 110 | ||
111 | spin_unlock_irq(&efw->lock); | ||
112 | |||
87 | count = min_t(long, count, sizeof(event.lock_status)); | 113 | count = min_t(long, count, sizeof(event.lock_status)); |
88 | 114 | ||
89 | if (copy_to_user(buf, &event, count)) | 115 | if (copy_to_user(buf, &event, count)) |
@@ -98,10 +124,15 @@ hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, | |||
98 | { | 124 | { |
99 | struct snd_efw *efw = hwdep->private_data; | 125 | struct snd_efw *efw = hwdep->private_data; |
100 | DEFINE_WAIT(wait); | 126 | DEFINE_WAIT(wait); |
127 | bool dev_lock_changed; | ||
128 | bool queued; | ||
101 | 129 | ||
102 | spin_lock_irq(&efw->lock); | 130 | spin_lock_irq(&efw->lock); |
103 | 131 | ||
104 | while ((!efw->dev_lock_changed) && (efw->resp_queues == 0)) { | 132 | dev_lock_changed = efw->dev_lock_changed; |
133 | queued = efw->push_ptr != efw->pull_ptr; | ||
134 | |||
135 | while (!dev_lock_changed && !queued) { | ||
105 | prepare_to_wait(&efw->hwdep_wait, &wait, TASK_INTERRUPTIBLE); | 136 | prepare_to_wait(&efw->hwdep_wait, &wait, TASK_INTERRUPTIBLE); |
106 | spin_unlock_irq(&efw->lock); | 137 | spin_unlock_irq(&efw->lock); |
107 | schedule(); | 138 | schedule(); |
@@ -109,15 +140,17 @@ hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, | |||
109 | if (signal_pending(current)) | 140 | if (signal_pending(current)) |
110 | return -ERESTARTSYS; | 141 | return -ERESTARTSYS; |
111 | spin_lock_irq(&efw->lock); | 142 | spin_lock_irq(&efw->lock); |
143 | dev_lock_changed = efw->dev_lock_changed; | ||
144 | queued = efw->push_ptr != efw->pull_ptr; | ||
112 | } | 145 | } |
113 | 146 | ||
114 | if (efw->dev_lock_changed) | 147 | spin_unlock_irq(&efw->lock); |
148 | |||
149 | if (dev_lock_changed) | ||
115 | count = hwdep_read_locked(efw, buf, count, offset); | 150 | count = hwdep_read_locked(efw, buf, count, offset); |
116 | else if (efw->resp_queues > 0) | 151 | else if (queued) |
117 | count = hwdep_read_resp_buf(efw, buf, count, offset); | 152 | count = hwdep_read_resp_buf(efw, buf, count, offset); |
118 | 153 | ||
119 | spin_unlock_irq(&efw->lock); | ||
120 | |||
121 | return count; | 154 | return count; |
122 | } | 155 | } |
123 | 156 | ||
@@ -160,7 +193,7 @@ hwdep_poll(struct snd_hwdep *hwdep, struct file *file, poll_table *wait) | |||
160 | poll_wait(file, &efw->hwdep_wait, wait); | 193 | poll_wait(file, &efw->hwdep_wait, wait); |
161 | 194 | ||
162 | spin_lock_irq(&efw->lock); | 195 | spin_lock_irq(&efw->lock); |
163 | if (efw->dev_lock_changed || (efw->resp_queues > 0)) | 196 | if (efw->dev_lock_changed || efw->pull_ptr != efw->push_ptr) |
164 | events = POLLIN | POLLRDNORM; | 197 | events = POLLIN | POLLRDNORM; |
165 | else | 198 | else |
166 | events = 0; | 199 | events = 0; |
diff --git a/sound/firewire/fireworks/fireworks_proc.c b/sound/firewire/fireworks/fireworks_proc.c index 0639dcb13f7d..beb0a0ffee57 100644 --- a/sound/firewire/fireworks/fireworks_proc.c +++ b/sound/firewire/fireworks/fireworks_proc.c | |||
@@ -188,8 +188,8 @@ proc_read_queues_state(struct snd_info_entry *entry, | |||
188 | else | 188 | else |
189 | consumed = (unsigned int)(efw->push_ptr - efw->pull_ptr); | 189 | consumed = (unsigned int)(efw->push_ptr - efw->pull_ptr); |
190 | 190 | ||
191 | snd_iprintf(buffer, "%d %d/%d\n", | 191 | snd_iprintf(buffer, "%d/%d\n", |
192 | efw->resp_queues, consumed, snd_efw_resp_buf_size); | 192 | consumed, snd_efw_resp_buf_size); |
193 | } | 193 | } |
194 | 194 | ||
195 | static void | 195 | static void |
diff --git a/sound/firewire/fireworks/fireworks_transaction.c b/sound/firewire/fireworks/fireworks_transaction.c index f550808d1784..36a08ba51ec7 100644 --- a/sound/firewire/fireworks/fireworks_transaction.c +++ b/sound/firewire/fireworks/fireworks_transaction.c | |||
@@ -121,11 +121,11 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode) | |||
121 | size_t capacity, till_end; | 121 | size_t capacity, till_end; |
122 | struct snd_efw_transaction *t; | 122 | struct snd_efw_transaction *t; |
123 | 123 | ||
124 | spin_lock_irq(&efw->lock); | ||
125 | |||
126 | t = (struct snd_efw_transaction *)data; | 124 | t = (struct snd_efw_transaction *)data; |
127 | length = min_t(size_t, be32_to_cpu(t->length) * sizeof(u32), length); | 125 | length = min_t(size_t, be32_to_cpu(t->length) * sizeof(u32), length); |
128 | 126 | ||
127 | spin_lock_irq(&efw->lock); | ||
128 | |||
129 | if (efw->push_ptr < efw->pull_ptr) | 129 | if (efw->push_ptr < efw->pull_ptr) |
130 | capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr); | 130 | capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr); |
131 | else | 131 | else |
@@ -155,7 +155,6 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode) | |||
155 | } | 155 | } |
156 | 156 | ||
157 | /* for hwdep */ | 157 | /* for hwdep */ |
158 | efw->resp_queues++; | ||
159 | wake_up(&efw->hwdep_wait); | 158 | wake_up(&efw->hwdep_wait); |
160 | 159 | ||
161 | *rcode = RCODE_COMPLETE; | 160 | *rcode = RCODE_COMPLETE; |
diff --git a/sound/firewire/tascam/tascam-hwdep.c b/sound/firewire/tascam/tascam-hwdep.c index 131267c3a042..106406cbfaa3 100644 --- a/sound/firewire/tascam/tascam-hwdep.c +++ b/sound/firewire/tascam/tascam-hwdep.c | |||
@@ -16,31 +16,14 @@ | |||
16 | 16 | ||
17 | #include "tascam.h" | 17 | #include "tascam.h" |
18 | 18 | ||
19 | static long hwdep_read_locked(struct snd_tscm *tscm, char __user *buf, | ||
20 | long count) | ||
21 | { | ||
22 | union snd_firewire_event event; | ||
23 | |||
24 | memset(&event, 0, sizeof(event)); | ||
25 | |||
26 | event.lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS; | ||
27 | event.lock_status.status = (tscm->dev_lock_count > 0); | ||
28 | tscm->dev_lock_changed = false; | ||
29 | |||
30 | count = min_t(long, count, sizeof(event.lock_status)); | ||
31 | |||
32 | if (copy_to_user(buf, &event, count)) | ||
33 | return -EFAULT; | ||
34 | |||
35 | return count; | ||
36 | } | ||
37 | |||
38 | static long hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, | 19 | static long hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, |
39 | loff_t *offset) | 20 | loff_t *offset) |
40 | { | 21 | { |
41 | struct snd_tscm *tscm = hwdep->private_data; | 22 | struct snd_tscm *tscm = hwdep->private_data; |
42 | DEFINE_WAIT(wait); | 23 | DEFINE_WAIT(wait); |
43 | union snd_firewire_event event; | 24 | union snd_firewire_event event = { |
25 | .lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS, | ||
26 | }; | ||
44 | 27 | ||
45 | spin_lock_irq(&tscm->lock); | 28 | spin_lock_irq(&tscm->lock); |
46 | 29 | ||
@@ -54,10 +37,16 @@ static long hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, | |||
54 | spin_lock_irq(&tscm->lock); | 37 | spin_lock_irq(&tscm->lock); |
55 | } | 38 | } |
56 | 39 | ||
57 | memset(&event, 0, sizeof(event)); | 40 | event.lock_status.status = (tscm->dev_lock_count > 0); |
58 | count = hwdep_read_locked(tscm, buf, count); | 41 | tscm->dev_lock_changed = false; |
42 | |||
59 | spin_unlock_irq(&tscm->lock); | 43 | spin_unlock_irq(&tscm->lock); |
60 | 44 | ||
45 | count = min_t(long, count, sizeof(event.lock_status)); | ||
46 | |||
47 | if (copy_to_user(buf, &event, count)) | ||
48 | return -EFAULT; | ||
49 | |||
61 | return count; | 50 | return count; |
62 | } | 51 | } |
63 | 52 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7100f05e651a..575cefd8cc4a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4855,6 +4855,7 @@ enum { | |||
4855 | ALC221_FIXUP_HP_FRONT_MIC, | 4855 | ALC221_FIXUP_HP_FRONT_MIC, |
4856 | ALC292_FIXUP_TPT460, | 4856 | ALC292_FIXUP_TPT460, |
4857 | ALC298_FIXUP_SPK_VOLUME, | 4857 | ALC298_FIXUP_SPK_VOLUME, |
4858 | ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, | ||
4858 | }; | 4859 | }; |
4859 | 4860 | ||
4860 | static const struct hda_fixup alc269_fixups[] = { | 4861 | static const struct hda_fixup alc269_fixups[] = { |
@@ -5516,6 +5517,15 @@ static const struct hda_fixup alc269_fixups[] = { | |||
5516 | .chained = true, | 5517 | .chained = true, |
5517 | .chain_id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, | 5518 | .chain_id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, |
5518 | }, | 5519 | }, |
5520 | [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { | ||
5521 | .type = HDA_FIXUP_PINS, | ||
5522 | .v.pins = (const struct hda_pintbl[]) { | ||
5523 | { 0x1b, 0x90170151 }, | ||
5524 | { } | ||
5525 | }, | ||
5526 | .chained = true, | ||
5527 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | ||
5528 | }, | ||
5519 | }; | 5529 | }; |
5520 | 5530 | ||
5521 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 5531 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
@@ -5560,6 +5570,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
5560 | SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), | 5570 | SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
5561 | SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), | 5571 | SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
5562 | SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), | 5572 | SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
5573 | SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER), | ||
5563 | SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE), | 5574 | SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE), |
5564 | SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), | 5575 | SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), |
5565 | SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), | 5576 | SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), |
@@ -5895,6 +5906,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
5895 | {0x12, 0x90a60170}, | 5906 | {0x12, 0x90a60170}, |
5896 | {0x14, 0x90170120}, | 5907 | {0x14, 0x90170120}, |
5897 | {0x21, 0x02211030}), | 5908 | {0x21, 0x02211030}), |
5909 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5910 | {0x12, 0x90a60180}, | ||
5911 | {0x14, 0x90170120}, | ||
5912 | {0x21, 0x02211030}), | ||
5898 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5913 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
5899 | ALC256_STANDARD_PINS), | 5914 | ALC256_STANDARD_PINS), |
5900 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, | 5915 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 6cf1f3597455..152292e5ee2b 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1141,6 +1141,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) | |||
1141 | case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */ | 1141 | case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */ |
1142 | case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */ | 1142 | case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */ |
1143 | case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ | 1143 | case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ |
1144 | case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */ | ||
1144 | case USB_ID(0x1de7, 0x0013): /* Phoenix Audio MT202exe */ | 1145 | case USB_ID(0x1de7, 0x0013): /* Phoenix Audio MT202exe */ |
1145 | case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */ | 1146 | case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */ |
1146 | case USB_ID(0x1de7, 0x0114): /* Phoenix Audio MT202pcs */ | 1147 | case USB_ID(0x1de7, 0x0114): /* Phoenix Audio MT202pcs */ |
diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c index ae68bf0e2d51..f39c0e9c0d5c 100644 --- a/tools/iio/iio_generic_buffer.c +++ b/tools/iio/iio_generic_buffer.c | |||
@@ -456,7 +456,7 @@ int main(int argc, char **argv) | |||
456 | 456 | ||
457 | if (notrigger) { | 457 | if (notrigger) { |
458 | printf("trigger-less mode selected\n"); | 458 | printf("trigger-less mode selected\n"); |
459 | } if (trig_num >= 0) { | 459 | } else if (trig_num >= 0) { |
460 | char *trig_dev_name; | 460 | char *trig_dev_name; |
461 | ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num); | 461 | ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num); |
462 | if (ret < 0) { | 462 | if (ret < 0) { |
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index d9836c5eb694..11c8d9bc762e 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c | |||
@@ -3266,6 +3266,9 @@ int main(int argc, char *argv[]) | |||
3266 | } | 3266 | } |
3267 | } | 3267 | } |
3268 | 3268 | ||
3269 | /* If we exit via err(), this kills all the threads, restores tty. */ | ||
3270 | atexit(cleanup_devices); | ||
3271 | |||
3269 | /* We always have a console device, and it's always device 1. */ | 3272 | /* We always have a console device, and it's always device 1. */ |
3270 | setup_console(); | 3273 | setup_console(); |
3271 | 3274 | ||
@@ -3369,9 +3372,6 @@ int main(int argc, char *argv[]) | |||
3369 | /* Ensure that we terminate if a device-servicing child dies. */ | 3372 | /* Ensure that we terminate if a device-servicing child dies. */ |
3370 | signal(SIGCHLD, kill_launcher); | 3373 | signal(SIGCHLD, kill_launcher); |
3371 | 3374 | ||
3372 | /* If we exit via err(), this kills all the threads, restores tty. */ | ||
3373 | atexit(cleanup_devices); | ||
3374 | |||
3375 | /* If requested, chroot to a directory */ | 3375 | /* If requested, chroot to a directory */ |
3376 | if (chroot_path) { | 3376 | if (chroot_path) { |
3377 | if (chroot(chroot_path) != 0) | 3377 | if (chroot(chroot_path) != 0) |