Linux 4.11-rc4 The i915 GVT team need the rc4 code to base some more code on.
Unified · Split
| @@ -45,7 +45,7 @@ The following clocks are available: · 44 unmodified lines | ||
| 45 | 45 | - 1 15 SATA |
| 46 | 46 | - 1 16 SATA USB |
| 47 | 47 | - 1 17 Main |
| 48 | − - 1 18 SD/MMC | |
| 48 | + - 1 18 SD/MMC/GOP | |
| 49 | 49 | - 1 21 Slow IO (SPI, NOR, BootROM, I2C, UART) |
| 50 | 50 | - 1 22 USB3H0 |
| 51 | 51 | - 1 23 USB3H1 |
| @@ -65,7 +65,7 @@ Required properties: · 13 unmodified lines | ||
| 65 | 65 | "cpm-audio", "cpm-communit", "cpm-nand", "cpm-ppv2", "cpm-sdio", |
| 66 | 66 | "cpm-mg-domain", "cpm-mg-core", "cpm-xor1", "cpm-xor0", "cpm-gop-dp", "none", |
| 67 | 67 | "cpm-pcie_x10", "cpm-pcie_x11", "cpm-pcie_x4", "cpm-pcie-xor", "cpm-sata", |
| 68 | − "cpm-sata-usb", "cpm-main", "cpm-sd-mmc", "none", "none", "cpm-slow-io", | |
| 68 | + "cpm-sata-usb", "cpm-main", "cpm-sd-mmc-gop", "none", "none", "cpm-slow-io", | |
| 69 | 69 | "cpm-usb3h0", "cpm-usb3h1", "cpm-usb3dev", "cpm-eip150", "cpm-eip197"; |
| 70 | 70 | |
| 71 | 71 | Example: |
| @@ -78,6 +78,6 @@ Example: · 6 unmodified lines | ||
| 78 | 78 | gate-clock-output-names = "cpm-audio", "cpm-communit", "cpm-nand", "cpm-ppv2", "cpm-sdio", |
| 79 | 79 | "cpm-mg-domain", "cpm-mg-core", "cpm-xor1", "cpm-xor0", "cpm-gop-dp", "none", |
| 80 | 80 | "cpm-pcie_x10", "cpm-pcie_x11", "cpm-pcie_x4", "cpm-pcie-xor", "cpm-sata", |
| 81 | − "cpm-sata-usb", "cpm-main", "cpm-sd-mmc", "none", "none", "cpm-slow-io", | |
| 81 | + "cpm-sata-usb", "cpm-main", "cpm-sd-mmc-gop", "none", "none", "cpm-slow-io", | |
| 82 | 82 | "cpm-usb3h0", "cpm-usb3h1", "cpm-usb3dev", "cpm-eip150", "cpm-eip197"; |
| 83 | 83 | }; |
| @@ -4,7 +4,6 @@ Required properties: · 3 unmodified lines | ||
| 4 | 4 | - compatible: value should be one of the following |
| 5 | 5 | "samsung,exynos3250-mipi-dsi" /* for Exynos3250/3472 SoCs */ |
| 6 | 6 | "samsung,exynos4210-mipi-dsi" /* for Exynos4 SoCs */ |
| 7 | − "samsung,exynos4415-mipi-dsi" /* for Exynos4415 SoC */ | |
| 8 | 7 | "samsung,exynos5410-mipi-dsi" /* for Exynos5410/5420/5440 SoCs */ |
| 9 | 8 | "samsung,exynos5422-mipi-dsi" /* for Exynos5422/5800 SoCs */ |
| 10 | 9 | "samsung,exynos5433-mipi-dsi" /* for Exynos5433 SoCs */ |
| @@ -11,7 +11,6 @@ Required properties: · 10 unmodified lines | ||
| 11 | 11 | "samsung,s5pv210-fimd"; /* for S5PV210 SoC */ |
| 12 | 12 | "samsung,exynos3250-fimd"; /* for Exynos3250/3472 SoCs */ |
| 13 | 13 | "samsung,exynos4210-fimd"; /* for Exynos4 SoCs */ |
| 14 | − "samsung,exynos4415-fimd"; /* for Exynos4415 SoC */ | |
| 15 | 14 | "samsung,exynos5250-fimd"; /* for Exynos5250 SoCs */ |
| 16 | 15 | "samsung,exynos5420-fimd"; /* for Exynos5420/5422/5800 SoCs */ |
| 17 | 16 | |
| @@ -13,7 +13,7 @@ Required Properties: · 12 unmodified lines | ||
| 13 | 13 | - "rockchip,rk2928-dw-mshc": for Rockchip RK2928 and following, |
| 14 | 14 | before RK3288 |
| 15 | 15 | - "rockchip,rk3288-dw-mshc": for Rockchip RK3288 |
| 16 | − - "rockchip,rk1108-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK1108 | |
| 16 | + - "rockchip,rv1108-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RV1108 | |
| 17 | 17 | - "rockchip,rk3036-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3036 |
| 18 | 18 | - "rockchip,rk3368-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3368 |
| 19 | 19 | - "rockchip,rk3399-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3399 |
| @@ -1,39 +0,0 @@ | ||
| 1 | −Broadcom USB3 phy binding for northstar plus SoC | |
| 2 | −The USB3 phy is internal to the SoC and is accessed using mdio interface. | |
| 3 | − | |
| 4 | −Required mdio bus properties: | |
| 5 | −- reg: Should be 0x0 for SoC internal USB3 phy | |
| 6 | −- #address-cells: must be 1 | |
| 7 | −- #size-cells: must be 0 | |
| 8 | − | |
| 9 | −Required USB3 PHY properties: | |
| 10 | −- compatible: should be "brcm,nsp-usb3-phy" | |
| 11 | −- reg: USB3 Phy address on SoC internal MDIO bus and it should be 0x10. | |
| 12 | −- usb3-ctrl-syscon: handler of syscon node defining physical address | |
| 13 | − of usb3 control register. | |
| 14 | −- #phy-cells: must be 0 | |
| 15 | − | |
| 16 | −Required usb3 control properties: | |
| 17 | −- compatible: should be "brcm,nsp-usb3-ctrl" | |
| 18 | −- reg: offset and length of the control registers | |
| 19 | − | |
| 20 | −Example: | |
| 21 | − | |
| 22 | − mdio@0 { | |
| 23 | − reg = <0x0>; | |
| 24 | − #address-cells = <1>; | |
| 25 | − #size-cells = <0>; | |
| 26 | − | |
| 27 | − usb3_phy: usb-phy@10 { | |
| 28 | − compatible = "brcm,nsp-usb3-phy"; | |
| 29 | − reg = <0x10>; | |
| 30 | − usb3-ctrl-syscon = <&usb3_ctrl>; | |
| 31 | − #phy-cells = <0>; | |
| 32 | − status = "disabled"; | |
| 33 | − }; | |
| 34 | − }; | |
| 35 | − | |
| 36 | − usb3_ctrl: syscon@104408 { | |
| 37 | − compatible = "brcm,nsp-usb3-ctrl", "syscon"; | |
| 38 | − reg = <0x104408 0x3fc>; | |
| 39 | − }; | |
| @@ -20,3 +20,8 @@ Index 1: The output gpio for enabling Vbus output from the device to the otg · 19 unmodified lines | ||
| 20 | 20 | Index 2: The output gpio for muxing of the data pins between the USB host and |
| 21 | 21 | the USB peripheral controller, write 1 to mux to the peripheral |
| 22 | 22 | controller |
| 23 | + | |
| 24 | +There is a mapping between indices and GPIO connection IDs as follows | |
| 25 | + id index 0 | |
| 26 | + vbus index 1 | |
| 27 | + mux index 2 | |
| @@ -18,8 +18,8 @@ because gcc versions 4.5 and 4.6 are compiled by a C compiler, · 17 unmodified lines | ||
| 18 | 18 | gcc-4.7 can be compiled by a C or a C++ compiler, |
| 19 | 19 | and versions 4.8+ can only be compiled by a C++ compiler. |
| 20 | 20 | |
| 21 | −Currently the GCC plugin infrastructure supports only the x86, arm and arm64 | |
| 22 | −architectures. | |
| 21 | +Currently the GCC plugin infrastructure supports only the x86, arm, arm64 and | |
| 22 | +powerpc architectures. | |
| 23 | 23 | |
| 24 | 24 | This infrastructure was ported from grsecurity [6] and PaX [7]. |
| 25 | 25 | |
| @@ -3216,7 +3216,6 @@ F: drivers/platform/chrome/ · 3215 unmodified lines | ||
| 3216 | 3216 | |
| 3217 | 3217 | CISCO VIC ETHERNET NIC DRIVER |
| 3218 | 3218 | M: Christian Benvenuti <benve@cisco.com> |
| 3219 | −M: Sujith Sankar <ssujith@cisco.com> | |
| 3220 | 3219 | M: Govindarajulu Varadarajan <_govind@gmx.com> |
| 3221 | 3220 | M: Neel Patel <neepatel@cisco.com> |
| 3222 | 3221 | S: Supported |
| @@ -7780,13 +7779,6 @@ F: include/net/mac80211.h · 4557 unmodified lines | ||
| 7780 | 7779 | F: net/mac80211/ |
| 7781 | 7780 | F: drivers/net/wireless/mac80211_hwsim.[ch] |
| 7782 | 7781 | |
| 7783 | −MACVLAN DRIVER | |
| 7784 | −M: Patrick McHardy <kaber@trash.net> | |
| 7785 | −L: netdev@vger.kernel.org | |
| 7786 | −S: Maintained | |
| 7787 | −F: drivers/net/macvlan.c | |
| 7788 | −F: include/linux/if_macvlan.h | |
| 7789 | − | |
| 7790 | 7782 | MAILBOX API |
| 7791 | 7783 | M: Jassi Brar <jassisinghbrar@gmail.com> |
| 7792 | 7784 | L: linux-kernel@vger.kernel.org |
| @@ -7859,6 +7851,8 @@ F: drivers/net/ethernet/marvell/mvneta.* · 66 unmodified lines | ||
| 7859 | 7851 | MARVELL MWIFIEX WIRELESS DRIVER |
| 7860 | 7852 | M: Amitkumar Karwar <akarwar@marvell.com> |
| 7861 | 7853 | M: Nishant Sarmukadam <nishants@marvell.com> |
| 7854 | +M: Ganapathi Bhat <gbhat@marvell.com> | |
| 7855 | +M: Xinming Hu <huxm@marvell.com> | |
| 7862 | 7856 | L: linux-wireless@vger.kernel.org |
| 7863 | 7857 | S: Maintained |
| 7864 | 7858 | F: drivers/net/wireless/marvell/mwifiex/ |
| @@ -13397,14 +13391,6 @@ W: https://linuxtv.org · 5532 unmodified lines | ||
| 13397 | 13391 | S: Maintained |
| 13398 | 13392 | F: drivers/media/platform/vivid/* |
| 13399 | 13393 | |
| 13400 | −VLAN (802.1Q) | |
| 13401 | −M: Patrick McHardy <kaber@trash.net> | |
| 13402 | −L: netdev@vger.kernel.org | |
| 13403 | −S: Maintained | |
| 13404 | −F: drivers/net/macvlan.c | |
| 13405 | −F: include/linux/if_*vlan.h | |
| 13406 | −F: net/8021q/ | |
| 13407 | − | |
| 13408 | 13394 | VLYNQ BUS |
| 13409 | 13395 | M: Florian Fainelli <f.fainelli@gmail.com> |
| 13410 | 13396 | L: openwrt-devel@lists.openwrt.org (subscribers-only) |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 4 |
| 2 | 2 | PATCHLEVEL = 11 |
| 3 | 3 | SUBLEVEL = 0 |
| 4 | −EXTRAVERSION = -rc3 | |
| 4 | +EXTRAVERSION = -rc4 | |
| 5 | 5 | NAME = Fearless Coyote |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -63,14 +63,14 @@ · 62 unmodified lines | ||
| 63 | 63 | label = "home"; |
| 64 | 64 | linux,code = <KEY_HOME>; |
| 65 | 65 | gpios = <&gpio3 7 GPIO_ACTIVE_HIGH>; |
| 66 | − gpio-key,wakeup; | |
| 66 | + wakeup-source; | |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | 69 | button@1 { |
| 70 | 70 | label = "menu"; |
| 71 | 71 | linux,code = <KEY_MENU>; |
| 72 | 72 | gpios = <&gpio3 8 GPIO_ACTIVE_HIGH>; |
| 73 | − gpio-key,wakeup; | |
| 73 | + wakeup-source; | |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | 76 | }; |
| @@ -315,6 +315,13 @@ · 314 unmodified lines | ||
| 315 | 315 | /* ID & VBUS GPIOs provided in board dts */ |
| 316 | 316 | }; |
| 317 | 317 | }; |
| 318 | + | |
| 319 | + tpic2810: tpic2810@60 { | |
| 320 | + compatible = "ti,tpic2810"; | |
| 321 | + reg = <0x60>; | |
| 322 | + gpio-controller; | |
| 323 | + #gpio-cells = <2>; | |
| 324 | + }; | |
| 318 | 325 | }; |
| 319 | 326 | |
| 320 | 327 | &mcspi3 { |
| @@ -330,13 +337,6 @@ · 9 unmodified lines | ||
| 330 | 337 | spi-max-frequency = <1000000>; |
| 331 | 338 | spi-cpol; |
| 332 | 339 | }; |
| 333 | − | |
| 334 | − tpic2810: tpic2810@60 { | |
| 335 | − compatible = "ti,tpic2810"; | |
| 336 | − reg = <0x60>; | |
| 337 | − gpio-controller; | |
| 338 | − #gpio-cells = <2>; | |
| 339 | − }; | |
| 340 | 340 | }; |
| 341 | 341 | |
| 342 | 342 | &uart3 { |
| @@ -66,14 +66,14 @@ · 65 unmodified lines | ||
| 66 | 66 | timer@20200 { |
| 67 | 67 | compatible = "arm,cortex-a9-global-timer"; |
| 68 | 68 | reg = <0x20200 0x100>; |
| 69 | − interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>; | |
| 69 | + interrupts = <GIC_PPI 11 IRQ_TYPE_EDGE_RISING>; | |
| 70 | 70 | clocks = <&periph_clk>; |
| 71 | 71 | }; |
| 72 | 72 | |
| 73 | 73 | local-timer@20600 { |
| 74 | 74 | compatible = "arm,cortex-a9-twd-timer"; |
| 75 | 75 | reg = <0x20600 0x100>; |
| 76 | − interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>; | |
| 76 | + interrupts = <GIC_PPI 13 IRQ_TYPE_EDGE_RISING>; | |
| 77 | 77 | clocks = <&periph_clk>; |
| 78 | 78 | }; |
| 79 | 79 | |
| @@ -48,15 +48,14 @@ · 47 unmodified lines | ||
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | memory { |
| 51 | − reg = <0x00000000 0x10000000>; | |
| 51 | + reg = <0x80000000 0x10000000>; | |
| 52 | 52 | }; |
| 53 | 53 | }; |
| 54 | 54 | |
| 55 | 55 | &uart0 { |
| 56 | − clock-frequency = <62499840>; | |
| 56 | + status = "okay"; | |
| 57 | 57 | }; |
| 58 | 58 | |
| 59 | 59 | &uart1 { |
| 60 | − clock-frequency = <62499840>; | |
| 61 | 60 | status = "okay"; |
| 62 | 61 | }; |
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | gpio-restart { |
| 56 | 56 | compatible = "gpio-restart"; |
| 57 | 57 | gpios = <&gpioa 15 GPIO_ACTIVE_LOW>; |
| 58 | + open-source; | |
| 58 | 59 | priority = <200>; |
| 59 | 60 | }; |
| 60 | 61 | }; |
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | gpio-restart { |
| 56 | 56 | compatible = "gpio-restart"; |
| 57 | 57 | gpios = <&gpioa 15 GPIO_ACTIVE_LOW>; |
| 58 | + open-source; | |
| 58 | 59 | priority = <200>; |
| 59 | 60 | }; |
| 60 | 61 | }; |
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | gpio-restart { |
| 56 | 56 | compatible = "gpio-restart"; |
| 57 | 57 | gpios = <&gpioa 31 GPIO_ACTIVE_LOW>; |
| 58 | + open-source; | |
| 58 | 59 | priority = <200>; |
| 59 | 60 | }; |
| 60 | 61 | }; |
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | gpio-restart { |
| 56 | 56 | compatible = "gpio-restart"; |
| 57 | 57 | gpios = <&gpioa 15 GPIO_ACTIVE_LOW>; |
| 58 | + open-source; | |
| 58 | 59 | priority = <200>; |
| 59 | 60 | }; |
| 60 | 61 | }; |
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | gpio-restart { |
| 56 | 56 | compatible = "gpio-restart"; |
| 57 | 57 | gpios = <&gpioa 15 GPIO_ACTIVE_LOW>; |
| 58 | + open-source; | |
| 58 | 59 | priority = <200>; |
| 59 | 60 | }; |
| 60 | 61 | }; |
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | gpio-restart { |
| 56 | 56 | compatible = "gpio-restart"; |
| 57 | 57 | gpios = <&gpioa 15 GPIO_ACTIVE_LOW>; |
| 58 | + open-source; | |
| 58 | 59 | priority = <200>; |
| 59 | 60 | }; |
| 60 | 61 | }; |
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | gpio-restart { |
| 56 | 56 | compatible = "gpio-restart"; |
| 57 | 57 | gpios = <&gpioa 15 GPIO_ACTIVE_LOW>; |
| 58 | + open-source; | |
| 58 | 59 | priority = <200>; |
| 59 | 60 | }; |
| 60 | 61 | }; |
| @@ -121,11 +121,6 @@ · 120 unmodified lines | ||
| 121 | 121 | }; |
| 122 | 122 | }; |
| 123 | 123 | |
| 124 | −&cpu0 { | |
| 125 | − arm-supply = <&sw1a_reg>; | |
| 126 | − soc-supply = <&sw1c_reg>; | |
| 127 | −}; | |
| 128 | − | |
| 129 | 124 | &fec1 { |
| 130 | 125 | pinctrl-names = "default"; |
| 131 | 126 | pinctrl-0 = <&pinctrl_enet1>; |
| @@ -266,7 +266,7 @@ · 265 unmodified lines | ||
| 266 | 266 | }; |
| 267 | 267 | |
| 268 | 268 | usb1: ohci@00400000 { |
| 269 | − compatible = "atmel,sama5d2-ohci", "usb-ohci"; | |
| 269 | + compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | |
| 270 | 270 | reg = <0x00400000 0x100000>; |
| 271 | 271 | interrupts = <41 IRQ_TYPE_LEVEL_HIGH 2>; |
| 272 | 272 | clocks = <&uhphs_clk>, <&uhphs_clk>, <&uhpck>; |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <dt-bindings/mfd/dbx500-prcmu.h> |
| 15 | 15 | #include <dt-bindings/arm/ux500_pm_domains.h> |
| 16 | 16 | #include <dt-bindings/gpio/gpio.h> |
| 17 | +#include <dt-bindings/clock/ste-ab8500.h> | |
| 17 | 18 | #include "skeleton.dtsi" |
| 18 | 19 | |
| 19 | 20 | / { |
| @@ -603,6 +604,11 @@ · 583 unmodified lines | ||
| 603 | 604 | interrupt-controller; |
| 604 | 605 | #interrupt-cells = <2>; |
| 605 | 606 | |
| 607 | + ab8500_clock: clock-controller { | |
| 608 | + compatible = "stericsson,ab8500-clk"; | |
| 609 | + #clock-cells = <1>; | |
| 610 | + }; | |
| 611 | + | |
| 606 | 612 | ab8500_gpio: ab8500-gpio { |
| 607 | 613 | compatible = "stericsson,ab8500-gpio"; |
| 608 | 614 | gpio-controller; |
| @@ -686,6 +692,8 @@ · 77 unmodified lines | ||
| 686 | 692 | |
| 687 | 693 | ab8500-pwm { |
| 688 | 694 | compatible = "stericsson,ab8500-pwm"; |
| 695 | + clocks = <&ab8500_clock AB8500_SYSCLK_INT>; | |
| 696 | + clock-names = "intclk"; | |
| 689 | 697 | }; |
| 690 | 698 | |
| 691 | 699 | ab8500-debugfs { |
| @@ -700,6 +708,9 @@ · 8 unmodified lines | ||
| 700 | 708 | V-AMIC2-supply = <&ab8500_ldo_anamic2_reg>; |
| 701 | 709 | V-DMIC-supply = <&ab8500_ldo_dmic_reg>; |
| 702 | 710 | |
| 711 | + clocks = <&ab8500_clock AB8500_SYSCLK_AUDIO>; | |
| 712 | + clock-names = "audioclk"; | |
| 713 | + | |
| 703 | 714 | stericsson,earpeice-cmv = <950>; /* Units in mV. */ |
| 704 | 715 | }; |
| 705 | 716 | |
| @@ -1095,6 +1106,14 @@ · 389 unmodified lines | ||
| 1095 | 1106 | status = "disabled"; |
| 1096 | 1107 | }; |
| 1097 | 1108 | |
| 1109 | + sound { | |
| 1110 | + compatible = "stericsson,snd-soc-mop500"; | |
| 1111 | + stericsson,cpu-dai = <&msp1 &msp3>; | |
| 1112 | + stericsson,audio-codec = <&codec>; | |
| 1113 | + clocks = <&prcmu_clk PRCMU_SYSCLK>, <&ab8500_clock AB8500_SYSCLK_ULP>, <&ab8500_clock AB8500_SYSCLK_INT>; | |
| 1114 | + clock-names = "sysclk", "ulpclk", "intclk"; | |
| 1115 | + }; | |
| 1116 | + | |
| 1098 | 1117 | msp0: msp@80123000 { |
| 1099 | 1118 | compatible = "stericsson,ux500-msp-i2s"; |
| 1100 | 1119 | reg = <0x80123000 0x1000>; |
| @@ -186,15 +186,6 @@ · 185 unmodified lines | ||
| 186 | 186 | status = "okay"; |
| 187 | 187 | }; |
| 188 | 188 | |
| 189 | − sound { | |
| 190 | − compatible = "stericsson,snd-soc-mop500"; | |
| 191 | − | |
| 192 | − stericsson,cpu-dai = <&msp1 &msp3>; | |
| 193 | − stericsson,audio-codec = <&codec>; | |
| 194 | − clocks = <&prcmu_clk PRCMU_SYSCLK>; | |
| 195 | − clock-names = "sysclk"; | |
| 196 | − }; | |
| 197 | − | |
| 198 | 189 | msp0: msp@80123000 { |
| 199 | 190 | pinctrl-names = "default"; |
| 200 | 191 | pinctrl-0 = <&msp0_default_mode>; |
| @@ -159,15 +159,6 @@ · 158 unmodified lines | ||
| 159 | 159 | "", "", "", "", "", "", "", ""; |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | − sound { | |
| 163 | − compatible = "stericsson,snd-soc-mop500"; | |
| 164 | − | |
| 165 | − stericsson,cpu-dai = <&msp1 &msp3>; | |
| 166 | − stericsson,audio-codec = <&codec>; | |
| 167 | − clocks = <&prcmu_clk PRCMU_SYSCLK>; | |
| 168 | − clock-names = "sysclk"; | |
| 169 | − }; | |
| 170 | − | |
| 171 | 162 | msp0: msp@80123000 { |
| 172 | 163 | pinctrl-names = "default"; |
| 173 | 164 | pinctrl-0 = <&msp0_default_mode>; |
| @@ -167,7 +167,7 @@ · 166 unmodified lines | ||
| 167 | 167 | reg = <8>; |
| 168 | 168 | label = "cpu"; |
| 169 | 169 | ethernet = <&gmac>; |
| 170 | − phy-mode = "rgmii"; | |
| 170 | + phy-mode = "rgmii-txid"; | |
| 171 | 171 | fixed-link { |
| 172 | 172 | speed = <1000>; |
| 173 | 173 | full-duplex; |
| @@ -495,7 +495,7 @@ · 494 unmodified lines | ||
| 495 | 495 | resets = <&ccu RST_BUS_GPU>; |
| 496 | 496 | |
| 497 | 497 | assigned-clocks = <&ccu CLK_GPU>; |
| 498 | − assigned-clock-rates = <408000000>; | |
| 498 | + assigned-clock-rates = <384000000>; | |
| 499 | 499 | }; |
| 500 | 500 | |
| 501 | 501 | gic: interrupt-controller@01c81000 { |
| @@ -50,8 +50,6 @@ · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | backlight: backlight { |
| 52 | 52 | compatible = "pwm-backlight"; |
| 53 | − pinctrl-names = "default"; | |
| 54 | − pinctrl-0 = <&bl_en_pin>; | |
| 55 | 53 | pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>; |
| 56 | 54 | brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>; |
| 57 | 55 | default-brightness-level = <8>; |
| @@ -93,11 +91,6 @@ · 35 unmodified lines | ||
| 93 | 91 | }; |
| 94 | 92 | |
| 95 | 93 | &pio { |
| 96 | − bl_en_pin: bl_en_pin@0 { | |
| 97 | − pins = "PH6"; | |
| 98 | − function = "gpio_in"; | |
| 99 | − }; | |
| 100 | − | |
| 101 | 94 | mmc0_cd_pin: mmc0_cd_pin@0 { |
| 102 | 95 | pins = "PB4"; |
| 103 | 96 | function = "gpio_in"; |
| @@ -188,6 +188,7 @@ CONFIG_WL12XX=m · 187 unmodified lines | ||
| 188 | 188 | CONFIG_WL18XX=m |
| 189 | 189 | CONFIG_WLCORE_SPI=m |
| 190 | 190 | CONFIG_WLCORE_SDIO=m |
| 191 | +CONFIG_INPUT_MOUSEDEV=m | |
| 191 | 192 | CONFIG_INPUT_JOYDEV=m |
| 192 | 193 | CONFIG_INPUT_EVDEV=m |
| 193 | 194 | CONFIG_KEYBOARD_ATKBD=m |
| @@ -289,6 +289,22 @@ static void at91_ddr_standby(void) · 288 unmodified lines | ||
| 289 | 289 | at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | +static void sama5d3_ddr_standby(void) | |
| 293 | +{ | |
| 294 | + u32 lpr0; | |
| 295 | + u32 saved_lpr0; | |
| 296 | + | |
| 297 | + saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR); | |
| 298 | + lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB; | |
| 299 | + lpr0 |= AT91_DDRSDRC_LPCB_POWER_DOWN; | |
| 300 | + | |
| 301 | + at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0); | |
| 302 | + | |
| 303 | + cpu_do_idle(); | |
| 304 | + | |
| 305 | + at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); | |
| 306 | +} | |
| 307 | + | |
| 292 | 308 | /* We manage both DDRAM/SDRAM controllers, we need more than one value to |
| 293 | 309 | * remember. |
| 294 | 310 | */ |
| @@ -323,7 +339,7 @@ static const struct of_device_id const ramc_ids[] __initconst = { · 28 unmodified lines | ||
| 323 | 339 | { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby }, |
| 324 | 340 | { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby }, |
| 325 | 341 | { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby }, |
| 326 | − { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby }, | |
| 342 | + { .compatible = "atmel,sama5d3-ddramc", .data = sama5d3_ddr_standby }, | |
| 327 | 343 | { /*sentinel*/ } |
| 328 | 344 | }; |
| 329 | 345 | |
| @@ -241,6 +241,3 @@ obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o · 240 unmodified lines | ||
| 241 | 241 | |
| 242 | 242 | onenand-$(CONFIG_MTD_ONENAND_OMAP2) := gpmc-onenand.o |
| 243 | 243 | obj-y += $(onenand-m) $(onenand-y) |
| 244 | − | |
| 245 | −nand-$(CONFIG_MTD_NAND_OMAP2) := gpmc-nand.o | |
| 246 | −obj-y += $(nand-m) $(nand-y) | |
| @@ -1,154 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * gpmc-nand.c | |
| 3 | − * | |
| 4 | − * Copyright (C) 2009 Texas Instruments | |
| 5 | − * Vimal Singh <vimalsingh@ti.com> | |
| 6 | − * | |
| 7 | − * This program is free software; you can redistribute it and/or modify | |
| 8 | − * it under the terms of the GNU General Public License version 2 as | |
| 9 | − * published by the Free Software Foundation. | |
| 10 | − */ | |
| 11 | − | |
| 12 | −#include <linux/kernel.h> | |
| 13 | −#include <linux/platform_device.h> | |
| 14 | −#include <linux/io.h> | |
| 15 | −#include <linux/omap-gpmc.h> | |
| 16 | −#include <linux/mtd/nand.h> | |
| 17 | −#include <linux/platform_data/mtd-nand-omap2.h> | |
| 18 | − | |
| 19 | −#include <asm/mach/flash.h> | |
| 20 | − | |
| 21 | −#include "soc.h" | |
| 22 | − | |
| 23 | −/* minimum size for IO mapping */ | |
| 24 | −#define NAND_IO_SIZE 4 | |
| 25 | − | |
| 26 | −static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) | |
| 27 | −{ | |
| 28 | − /* platforms which support all ECC schemes */ | |
| 29 | − if (soc_is_am33xx() || soc_is_am43xx() || cpu_is_omap44xx() || | |
| 30 | − soc_is_omap54xx() || soc_is_dra7xx()) | |
| 31 | − return 1; | |
| 32 | − | |
| 33 | − if (ecc_opt == OMAP_ECC_BCH4_CODE_HW_DETECTION_SW || | |
| 34 | − ecc_opt == OMAP_ECC_BCH8_CODE_HW_DETECTION_SW) { | |
| 35 | − if (cpu_is_omap24xx()) | |
| 36 | − return 0; | |
| 37 | − else if (cpu_is_omap3630() && (GET_OMAP_REVISION() == 0)) | |
| 38 | − return 0; | |
| 39 | − else | |
| 40 | − return 1; | |
| 41 | − } | |
| 42 | − | |
| 43 | − /* OMAP3xxx do not have ELM engine, so cannot support ECC schemes | |
| 44 | − * which require H/W based ECC error detection */ | |
| 45 | − if ((cpu_is_omap34xx() || cpu_is_omap3630()) && | |
| 46 | − ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) || | |
| 47 | − (ecc_opt == OMAP_ECC_BCH8_CODE_HW))) | |
| 48 | − return 0; | |
| 49 | − | |
| 50 | − /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */ | |
| 51 | − if (ecc_opt == OMAP_ECC_HAM1_CODE_HW || | |
| 52 | − ecc_opt == OMAP_ECC_HAM1_CODE_SW) | |
| 53 | − return 1; | |
| 54 | − else | |
| 55 | − return 0; | |
| 56 | −} | |
| 57 | − | |
| 58 | −/* This function will go away once the device-tree convertion is complete */ | |
| 59 | −static void gpmc_set_legacy(struct omap_nand_platform_data *gpmc_nand_data, | |
| 60 | − struct gpmc_settings *s) | |
| 61 | −{ | |
| 62 | − /* Enable RD PIN Monitoring Reg */ | |
| 63 | − if (gpmc_nand_data->dev_ready) { | |
| 64 | − s->wait_on_read = true; | |
| 65 | − s->wait_on_write = true; | |
| 66 | − } | |
| 67 | − | |
| 68 | − if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) | |
| 69 | − s->device_width = GPMC_DEVWIDTH_16BIT; | |
| 70 | − else | |
| 71 | − s->device_width = GPMC_DEVWIDTH_8BIT; | |
| 72 | −} | |
| 73 | − | |
| 74 | −int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data, | |
| 75 | − struct gpmc_timings *gpmc_t) | |
| 76 | −{ | |
| 77 | − int err = 0; | |
| 78 | − struct gpmc_settings s; | |
| 79 | − struct platform_device *pdev; | |
| 80 | − struct resource gpmc_nand_res[] = { | |
| 81 | − { .flags = IORESOURCE_MEM, }, | |
| 82 | − { .flags = IORESOURCE_IRQ, }, | |
| 83 | − { .flags = IORESOURCE_IRQ, }, | |
| 84 | − }; | |
| 85 | − | |
| 86 | − BUG_ON(gpmc_nand_data->cs >= GPMC_CS_NUM); | |
| 87 | − | |
| 88 | − err = gpmc_cs_request(gpmc_nand_data->cs, NAND_IO_SIZE, | |
| 89 | − (unsigned long *)&gpmc_nand_res[0].start); | |
| 90 | − if (err < 0) { | |
| 91 | − pr_err("omap2-gpmc: Cannot request GPMC CS %d, error %d\n", | |
| 92 | − gpmc_nand_data->cs, err); | |
| 93 | − return err; | |
| 94 | − } | |
| 95 | − gpmc_nand_res[0].end = gpmc_nand_res[0].start + NAND_IO_SIZE - 1; | |
| 96 | − gpmc_nand_res[1].start = gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE); | |
| 97 | − gpmc_nand_res[2].start = gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT); | |
| 98 | − | |
| 99 | − memset(&s, 0, sizeof(struct gpmc_settings)); | |
| 100 | − gpmc_set_legacy(gpmc_nand_data, &s); | |
| 101 | − | |
| 102 | − s.device_nand = true; | |
| 103 | − | |
| 104 | − if (gpmc_t) { | |
| 105 | − err = gpmc_cs_set_timings(gpmc_nand_data->cs, gpmc_t, &s); | |
| 106 | − if (err < 0) { | |
| 107 | − pr_err("omap2-gpmc: Unable to set gpmc timings: %d\n", | |
| 108 | − err); | |
| 109 | − return err; | |
| 110 | − } | |
| 111 | − } | |
| 112 | − | |
| 113 | − err = gpmc_cs_program_settings(gpmc_nand_data->cs, &s); | |
| 114 | − if (err < 0) | |
| 115 | − goto out_free_cs; | |
| 116 | − | |
| 117 | − err = gpmc_configure(GPMC_CONFIG_WP, 0); | |
| 118 | − if (err < 0) | |
| 119 | − goto out_free_cs; | |
| 120 | − | |
| 121 | − if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt)) { | |
| 122 | − pr_err("omap2-nand: Unsupported NAND ECC scheme selected\n"); | |
| 123 | − err = -EINVAL; | |
| 124 | − goto out_free_cs; | |
| 125 | − } | |
| 126 | − | |
| 127 | − | |
| 128 | − pdev = platform_device_alloc("omap2-nand", gpmc_nand_data->cs); | |
| 129 | − if (pdev) { | |
| 130 | − err = platform_device_add_resources(pdev, gpmc_nand_res, | |
| 131 | − ARRAY_SIZE(gpmc_nand_res)); | |
| 132 | − if (!err) | |
| 133 | − pdev->dev.platform_data = gpmc_nand_data; | |
| 134 | − } else { | |
| 135 | − err = -ENOMEM; | |
| 136 | − } | |
| 137 | − if (err) | |
| 138 | − goto out_free_pdev; | |
| 139 | − | |
| 140 | − err = platform_device_add(pdev); | |
| 141 | − if (err) { | |
| 142 | − dev_err(&pdev->dev, "Unable to register NAND device\n"); | |
| 143 | − goto out_free_pdev; | |
| 144 | − } | |
| 145 | − | |
| 146 | − return 0; | |
| 147 | − | |
| 148 | −out_free_pdev: | |
| 149 | − platform_device_put(pdev); | |
| 150 | −out_free_cs: | |
| 151 | − gpmc_cs_free(gpmc_nand_data->cs); | |
| 152 | − | |
| 153 | − return err; | |
| 154 | −} | |
| @@ -367,7 +367,7 @@ static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) · 366 unmodified lines | ||
| 367 | 367 | return ret; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | −void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | |
| 370 | +int gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) | |
| 371 | 371 | { |
| 372 | 372 | int err; |
| 373 | 373 | struct device *dev = &gpmc_onenand_device.dev; |
| @@ -393,15 +393,17 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) · 19 unmodified lines | ||
| 393 | 393 | if (err < 0) { |
| 394 | 394 | dev_err(dev, "Cannot request GPMC CS %d, error %d\n", |
| 395 | 395 | gpmc_onenand_data->cs, err); |
| 396 | − return; | |
| 396 | + return err; | |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | gpmc_onenand_resource.end = gpmc_onenand_resource.start + |
| 400 | 400 | ONENAND_IO_SIZE - 1; |
| 401 | 401 | |
| 402 | − if (platform_device_register(&gpmc_onenand_device) < 0) { | |
| 402 | + err = platform_device_register(&gpmc_onenand_device); | |
| 403 | + if (err) { | |
| 403 | 404 | dev_err(dev, "Unable to register OneNAND device\n"); |
| 404 | 405 | gpmc_cs_free(gpmc_onenand_data->cs); |
| 405 | − return; | |
| 406 | 406 | } |
| 407 | + | |
| 408 | + return err; | |
| 407 | 409 | } |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | #include <linux/linkage.h> |
| 19 | 19 | #include <linux/init.h> |
| 20 | +#include <asm/assembler.h> | |
| 20 | 21 | |
| 21 | 22 | #include "omap44xx.h" |
| 22 | 23 | |
| @@ -66,7 +67,7 @@ wait_2: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0 · 43 unmodified lines | ||
| 66 | 67 | cmp r0, r4 |
| 67 | 68 | bne wait_2 |
| 68 | 69 | ldr r12, =API_HYP_ENTRY |
| 69 | − adr r0, hyp_boot | |
| 70 | + badr r0, hyp_boot | |
| 70 | 71 | smc #0 |
| 71 | 72 | hyp_boot: |
| 72 | 73 | b omap_secondary_startup |
| @@ -2112,11 +2112,20 @@ static struct omap_hwmod_ocp_if omap3_l4_core__i2c3 = { · 2111 unmodified lines | ||
| 2112 | 2112 | }; |
| 2113 | 2113 | |
| 2114 | 2114 | /* L4 CORE -> SR1 interface */ |
| 2115 | +static struct omap_hwmod_addr_space omap3_sr1_addr_space[] = { | |
| 2116 | + { | |
| 2117 | + .pa_start = OMAP34XX_SR1_BASE, | |
| 2118 | + .pa_end = OMAP34XX_SR1_BASE + SZ_1K - 1, | |
| 2119 | + .flags = ADDR_TYPE_RT, | |
| 2120 | + }, | |
| 2121 | + { }, | |
| 2122 | +}; | |
| 2115 | 2123 | |
| 2116 | 2124 | static struct omap_hwmod_ocp_if omap34xx_l4_core__sr1 = { |
| 2117 | 2125 | .master = &omap3xxx_l4_core_hwmod, |
| 2118 | 2126 | .slave = &omap34xx_sr1_hwmod, |
| 2119 | 2127 | .clk = "sr_l4_ick", |
| 2128 | + .addr = omap3_sr1_addr_space, | |
| 2120 | 2129 | .user = OCP_USER_MPU, |
| 2121 | 2130 | }; |
| 2122 | 2131 | |
| @@ -2124,15 +2133,25 @@ static struct omap_hwmod_ocp_if omap36xx_l4_core__sr1 = { · 1 unmodified line | ||
| 2124 | 2133 | .master = &omap3xxx_l4_core_hwmod, |
| 2125 | 2134 | .slave = &omap36xx_sr1_hwmod, |
| 2126 | 2135 | .clk = "sr_l4_ick", |
| 2136 | + .addr = omap3_sr1_addr_space, | |
| 2127 | 2137 | .user = OCP_USER_MPU, |
| 2128 | 2138 | }; |
| 2129 | 2139 | |
| 2130 | 2140 | /* L4 CORE -> SR1 interface */ |
| 2141 | +static struct omap_hwmod_addr_space omap3_sr2_addr_space[] = { | |
| 2142 | + { | |
| 2143 | + .pa_start = OMAP34XX_SR2_BASE, | |
| 2144 | + .pa_end = OMAP34XX_SR2_BASE + SZ_1K - 1, | |
| 2145 | + .flags = ADDR_TYPE_RT, | |
| 2146 | + }, | |
| 2147 | + { }, | |
| 2148 | +}; | |
| 2131 | 2149 | |
| 2132 | 2150 | static struct omap_hwmod_ocp_if omap34xx_l4_core__sr2 = { |
| 2133 | 2151 | .master = &omap3xxx_l4_core_hwmod, |
| 2134 | 2152 | .slave = &omap34xx_sr2_hwmod, |
| 2135 | 2153 | .clk = "sr_l4_ick", |
| 2154 | + .addr = omap3_sr2_addr_space, | |
| 2136 | 2155 | .user = OCP_USER_MPU, |
| 2137 | 2156 | }; |
| 2138 | 2157 | |
| @@ -2140,6 +2159,7 @@ static struct omap_hwmod_ocp_if omap36xx_l4_core__sr2 = { · 1 unmodified line | ||
| 2140 | 2159 | .master = &omap3xxx_l4_core_hwmod, |
| 2141 | 2160 | .slave = &omap36xx_sr2_hwmod, |
| 2142 | 2161 | .clk = "sr_l4_ick", |
| 2162 | + .addr = omap3_sr2_addr_space, | |
| 2143 | 2163 | .user = OCP_USER_MPU, |
| 2144 | 2164 | }; |
| 2145 | 2165 | |
| @@ -3111,16 +3131,20 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_hwmod_ocp_ifs[] __initdata = { · 965 unmodified lines | ||
| 3111 | 3131 | * Return: 0 if device named @dev_name is not likely to be accessible, |
| 3112 | 3132 | * or 1 if it is likely to be accessible. |
| 3113 | 3133 | */ |
| 3114 | −static int __init omap3xxx_hwmod_is_hs_ip_block_usable(struct device_node *bus, | |
| 3115 | − const char *dev_name) | |
| 3134 | +static bool __init omap3xxx_hwmod_is_hs_ip_block_usable(struct device_node *bus, | |
| 3135 | + const char *dev_name) | |
| 3116 | 3136 | { |
| 3137 | + struct device_node *node; | |
| 3138 | + bool available; | |
| 3139 | + | |
| 3117 | 3140 | if (!bus) |
| 3118 | − return (omap_type() == OMAP2_DEVICE_TYPE_GP) ? 1 : 0; | |
| 3141 | + return omap_type() == OMAP2_DEVICE_TYPE_GP; | |
| 3119 | 3142 | |
| 3120 | − if (of_device_is_available(of_find_node_by_name(bus, dev_name))) | |
| 3121 | − return 1; | |
| 3143 | + node = of_get_child_by_name(bus, dev_name); | |
| 3144 | + available = of_device_is_available(node); | |
| 3145 | + of_node_put(node); | |
| 3122 | 3146 | |
| 3123 | − return 0; | |
| 3147 | + return available; | |
| 3124 | 3148 | } |
| 3125 | 3149 | |
| 3126 | 3150 | int __init omap3xxx_hwmod_init(void) |
| @@ -3189,15 +3213,20 @@ int __init omap3xxx_hwmod_init(void) · 62 unmodified lines | ||
| 3189 | 3213 | |
| 3190 | 3214 | if (h_sham && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "sham")) { |
| 3191 | 3215 | r = omap_hwmod_register_links(h_sham); |
| 3192 | − if (r < 0) | |
| 3216 | + if (r < 0) { | |
| 3217 | + of_node_put(bus); | |
| 3193 | 3218 | return r; |
| 3219 | + } | |
| 3194 | 3220 | } |
| 3195 | 3221 | |
| 3196 | 3222 | if (h_aes && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "aes")) { |
| 3197 | 3223 | r = omap_hwmod_register_links(h_aes); |
| 3198 | − if (r < 0) | |
| 3224 | + if (r < 0) { | |
| 3225 | + of_node_put(bus); | |
| 3199 | 3226 | return r; |
| 3227 | + } | |
| 3200 | 3228 | } |
| 3229 | + of_node_put(bus); | |
| 3201 | 3230 | |
| 3202 | 3231 | /* |
| 3203 | 3232 | * Register hwmod links specific to certain ES levels of a |
| @@ -114,6 +114,7 @@ · 113 unmodified lines | ||
| 114 | 114 | pcie0: pcie@20020000 { |
| 115 | 115 | compatible = "brcm,iproc-pcie"; |
| 116 | 116 | reg = <0 0x20020000 0 0x1000>; |
| 117 | + dma-coherent; | |
| 117 | 118 | |
| 118 | 119 | #interrupt-cells = <1>; |
| 119 | 120 | interrupt-map-mask = <0 0 0 0>; |
| @@ -144,6 +145,7 @@ · 24 unmodified lines | ||
| 144 | 145 | pcie4: pcie@50020000 { |
| 145 | 146 | compatible = "brcm,iproc-pcie"; |
| 146 | 147 | reg = <0 0x50020000 0 0x1000>; |
| 148 | + dma-coherent; | |
| 147 | 149 | |
| 148 | 150 | #interrupt-cells = <1>; |
| 149 | 151 | interrupt-map-mask = <0 0 0 0>; |
| @@ -174,6 +176,7 @@ · 24 unmodified lines | ||
| 174 | 176 | pcie8: pcie@60c00000 { |
| 175 | 177 | compatible = "brcm,iproc-pcie-paxc"; |
| 176 | 178 | reg = <0 0x60c00000 0 0x1000>; |
| 179 | + dma-coherent; | |
| 177 | 180 | linux,pci-domain = <8>; |
| 178 | 181 | |
| 179 | 182 | bus-range = <0x0 0x1>; |
| @@ -203,6 +206,7 @@ · 23 unmodified lines | ||
| 203 | 206 | <0x61030000 0x100>; |
| 204 | 207 | reg-names = "amac_base", "idm_base", "nicpm_base"; |
| 205 | 208 | interrupts = <GIC_SPI 341 IRQ_TYPE_LEVEL_HIGH>; |
| 209 | + dma-coherent; | |
| 206 | 210 | phy-handle = <&gphy0>; |
| 207 | 211 | phy-mode = "rgmii"; |
| 208 | 212 | status = "disabled"; |
| @@ -213,6 +217,7 @@ · 4 unmodified lines | ||
| 213 | 217 | reg = <0x612c0000 0x445>; /* PDC FS0 regs */ |
| 214 | 218 | interrupts = <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>; |
| 215 | 219 | #mbox-cells = <1>; |
| 220 | + dma-coherent; | |
| 216 | 221 | brcm,rx-status-len = <32>; |
| 217 | 222 | brcm,use-bcm-hdr; |
| 218 | 223 | }; |
| @@ -222,6 +227,7 @@ · 3 unmodified lines | ||
| 222 | 227 | reg = <0x612e0000 0x445>; /* PDC FS1 regs */ |
| 223 | 228 | interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>; |
| 224 | 229 | #mbox-cells = <1>; |
| 230 | + dma-coherent; | |
| 225 | 231 | brcm,rx-status-len = <32>; |
| 226 | 232 | brcm,use-bcm-hdr; |
| 227 | 233 | }; |
| @@ -231,6 +237,7 @@ · 3 unmodified lines | ||
| 231 | 237 | reg = <0x61300000 0x445>; /* PDC FS2 regs */ |
| 232 | 238 | interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>; |
| 233 | 239 | #mbox-cells = <1>; |
| 240 | + dma-coherent; | |
| 234 | 241 | brcm,rx-status-len = <32>; |
| 235 | 242 | brcm,use-bcm-hdr; |
| 236 | 243 | }; |
| @@ -240,6 +247,7 @@ · 3 unmodified lines | ||
| 240 | 247 | reg = <0x61320000 0x445>; /* PDC FS3 regs */ |
| 241 | 248 | interrupts = <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>; |
| 242 | 249 | #mbox-cells = <1>; |
| 250 | + dma-coherent; | |
| 243 | 251 | brcm,rx-status-len = <32>; |
| 244 | 252 | brcm,use-bcm-hdr; |
| 245 | 253 | }; |
| @@ -644,6 +652,7 @@ · 398 unmodified lines | ||
| 644 | 652 | sata: ahci@663f2000 { |
| 645 | 653 | compatible = "brcm,iproc-ahci", "generic-ahci"; |
| 646 | 654 | reg = <0x663f2000 0x1000>; |
| 655 | + dma-coherent; | |
| 647 | 656 | reg-names = "ahci"; |
| 648 | 657 | interrupts = <GIC_SPI 438 IRQ_TYPE_LEVEL_HIGH>; |
| 649 | 658 | #address-cells = <1>; |
| @@ -667,6 +676,7 @@ · 17 unmodified lines | ||
| 667 | 676 | compatible = "brcm,sdhci-iproc-cygnus"; |
| 668 | 677 | reg = <0x66420000 0x100>; |
| 669 | 678 | interrupts = <GIC_SPI 421 IRQ_TYPE_LEVEL_HIGH>; |
| 679 | + dma-coherent; | |
| 670 | 680 | bus-width = <8>; |
| 671 | 681 | clocks = <&genpll_sw BCM_NS2_GENPLL_SW_SDIO_CLK>; |
| 672 | 682 | status = "disabled"; |
| @@ -676,6 +686,7 @@ · 3 unmodified lines | ||
| 676 | 686 | compatible = "brcm,sdhci-iproc-cygnus"; |
| 677 | 687 | reg = <0x66430000 0x100>; |
| 678 | 688 | interrupts = <GIC_SPI 422 IRQ_TYPE_LEVEL_HIGH>; |
| 689 | + dma-coherent; | |
| 679 | 690 | bus-width = <8>; |
| 680 | 691 | clocks = <&genpll_sw BCM_NS2_GENPLL_SW_SDIO_CLK>; |
| 681 | 692 | status = "disabled"; |
| @@ -44,7 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | #define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) |
| 45 | 45 | #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) |
| 46 | 46 | |
| 47 | −#define __NR_compat_syscalls 394 | |
| 47 | +#define __NR_compat_syscalls 398 | |
| 48 | 48 | #endif |
| 49 | 49 | |
| 50 | 50 | #define __ARCH_WANT_SYS_CLONE |
| @@ -809,6 +809,14 @@ __SYSCALL(__NR_copy_file_range, sys_copy_file_range) · 808 unmodified lines | ||
| 809 | 809 | __SYSCALL(__NR_preadv2, compat_sys_preadv2) |
| 810 | 810 | #define __NR_pwritev2 393 |
| 811 | 811 | __SYSCALL(__NR_pwritev2, compat_sys_pwritev2) |
| 812 | +#define __NR_pkey_mprotect 394 | |
| 813 | +__SYSCALL(__NR_pkey_mprotect, sys_pkey_mprotect) | |
| 814 | +#define __NR_pkey_alloc 395 | |
| 815 | +__SYSCALL(__NR_pkey_alloc, sys_pkey_alloc) | |
| 816 | +#define __NR_pkey_free 396 | |
| 817 | +__SYSCALL(__NR_pkey_free, sys_pkey_free) | |
| 818 | +#define __NR_statx 397 | |
| 819 | +__SYSCALL(__NR_statx, sys_statx) | |
| 812 | 820 | |
| 813 | 821 | /* |
| 814 | 822 | * Please add new compat syscalls above this comment and update |
| @@ -131,11 +131,15 @@ u64 __init kaslr_early_init(u64 dt_phys, u64 modulo_offset) · 130 unmodified lines | ||
| 131 | 131 | /* |
| 132 | 132 | * The kernel Image should not extend across a 1GB/32MB/512MB alignment |
| 133 | 133 | * boundary (for 4KB/16KB/64KB granule kernels, respectively). If this |
| 134 | − * happens, increase the KASLR offset by the size of the kernel image. | |
| 134 | + * happens, increase the KASLR offset by the size of the kernel image | |
| 135 | + * rounded up by SWAPPER_BLOCK_SIZE. | |
| 135 | 136 | */ |
| 136 | 137 | if ((((u64)_text + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT) != |
| 137 | − (((u64)_end + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT)) | |
| 138 | − offset = (offset + (u64)(_end - _text)) & mask; | |
| 138 | + (((u64)_end + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT)) { | |
| 139 | + u64 kimg_sz = _end - _text; | |
| 140 | + offset = (offset + round_up(kimg_sz, SWAPPER_BLOCK_SIZE)) | |
| 141 | + & mask; | |
| 142 | + } | |
| 139 | 143 | |
| 140 | 144 | if (IS_ENABLED(CONFIG_KASAN)) |
| 141 | 145 | /* |
| @@ -449,9 +449,23 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) · 448 unmodified lines | ||
| 449 | 449 | _GLOBAL(pnv_wakeup_tb_loss) |
| 450 | 450 | ld r1,PACAR1(r13) |
| 451 | 451 | /* |
| 452 | − * Before entering any idle state, the NVGPRs are saved in the stack | |
| 453 | − * and they are restored before switching to the process context. Hence | |
| 454 | − * until they are restored, they are free to be used. | |
| 452 | + * Before entering any idle state, the NVGPRs are saved in the stack. | |
| 453 | + * If there was a state loss, or PACA_NAPSTATELOST was set, then the | |
| 454 | + * NVGPRs are restored. If we are here, it is likely that state is lost, | |
| 455 | + * but not guaranteed -- neither ISA207 nor ISA300 tests to reach | |
| 456 | + * here are the same as the test to restore NVGPRS: | |
| 457 | + * PACA_THREAD_IDLE_STATE test for ISA207, PSSCR test for ISA300, | |
| 458 | + * and SRR1 test for restoring NVGPRs. | |
| 459 | + * | |
| 460 | + * We are about to clobber NVGPRs now, so set NAPSTATELOST to | |
| 461 | + * guarantee they will always be restored. This might be tightened | |
| 462 | + * with careful reading of specs (particularly for ISA300) but this | |
| 463 | + * is already a slow wakeup path and it's simpler to be safe. | |
| 464 | + */ | |
| 465 | + li r0,1 | |
| 466 | + stb r0,PACA_NAPSTATELOST(r13) | |
| 467 | + | |
| 468 | + /* | |
| 455 | 469 | * |
| 456 | 470 | * Save SRR1 and LR in NVGPRs as they might be clobbered in |
| 457 | 471 | * opal_call() (called in CHECK_HMI_INTERRUPT). SRR1 is required |
| @@ -397,8 +397,7 @@ static void early_check_vec5(void) · 396 unmodified lines | ||
| 397 | 397 | void __init mmu_early_init_devtree(void) |
| 398 | 398 | { |
| 399 | 399 | /* Disable radix mode based on kernel command line. */ |
| 400 | − /* We don't yet have the machinery to do radix as a guest. */ | |
| 401 | − if (disable_radix || !(mfmsr() & MSR_HV)) | |
| 400 | + if (disable_radix) | |
| 402 | 401 | cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX; |
| 403 | 402 | |
| 404 | 403 | /* |
| @@ -697,17 +697,8 @@ static void blk_mq_check_expired(struct blk_mq_hw_ctx *hctx, · 696 unmodified lines | ||
| 697 | 697 | { |
| 698 | 698 | struct blk_mq_timeout_data *data = priv; |
| 699 | 699 | |
| 700 | − if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags)) { | |
| 701 | − /* | |
| 702 | − * If a request wasn't started before the queue was | |
| 703 | − * marked dying, kill it here or it'll go unnoticed. | |
| 704 | − */ | |
| 705 | − if (unlikely(blk_queue_dying(rq->q))) { | |
| 706 | − rq->errors = -EIO; | |
| 707 | − blk_mq_end_request(rq, rq->errors); | |
| 708 | − } | |
| 700 | + if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags)) | |
| 709 | 701 | return; |
| 710 | − } | |
| 711 | 702 | |
| 712 | 703 | if (time_after_eq(jiffies, rq->deadline)) { |
| 713 | 704 | if (!blk_mark_rq_complete(rq)) |
| @@ -30,11 +30,11 @@ static void blk_stat_flush_batch(struct blk_rq_stat *stat) · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | static void blk_stat_sum(struct blk_rq_stat *dst, struct blk_rq_stat *src) |
| 32 | 32 | { |
| 33 | + blk_stat_flush_batch(src); | |
| 34 | + | |
| 33 | 35 | if (!src->nr_samples) |
| 34 | 36 | return; |
| 35 | 37 | |
| 36 | − blk_stat_flush_batch(src); | |
| 37 | − | |
| 38 | 38 | dst->min = min(dst->min, src->min); |
| 39 | 39 | dst->max = max(dst->max, src->max); |
| 40 | 40 | |
| @@ -30,7 +30,7 @@ static bool qdf2400_erratum_44_present(struct acpi_table_header *h) · 29 unmodified lines | ||
| 30 | 30 | return true; |
| 31 | 31 | |
| 32 | 32 | if (!memcmp(h->oem_table_id, "QDF2400 ", ACPI_OEM_TABLE_ID_SIZE) && |
| 33 | − h->oem_revision == 0) | |
| 33 | + h->oem_revision == 1) | |
| 34 | 34 | return true; |
| 35 | 35 | |
| 36 | 36 | return false; |
| @@ -218,6 +218,7 @@ static const struct of_device_id img_ascii_lcd_matches[] = { · 217 unmodified lines | ||
| 218 | 218 | { .compatible = "img,boston-lcd", .data = &boston_config }, |
| 219 | 219 | { .compatible = "mti,malta-lcd", .data = &malta_config }, |
| 220 | 220 | { .compatible = "mti,sead3-lcd", .data = &sead3_config }, |
| 221 | + { /* sentinel */ } | |
| 221 | 222 | }; |
| 222 | 223 | |
| 223 | 224 | /** |
| @@ -344,7 +344,8 @@ config BT_WILINK · 343 unmodified lines | ||
| 344 | 344 | |
| 345 | 345 | config BT_QCOMSMD |
| 346 | 346 | tristate "Qualcomm SMD based HCI support" |
| 347 | − depends on (QCOM_SMD && QCOM_WCNSS_CTRL) || COMPILE_TEST | |
| 347 | + depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n) | |
| 348 | + depends on QCOM_WCNSS_CTRL || (COMPILE_TEST && QCOM_WCNSS_CTRL=n) | |
| 348 | 349 | select BT_QCA |
| 349 | 350 | help |
| 350 | 351 | Qualcomm SMD based HCI driver. |
| @@ -55,6 +55,7 @@ MODULE_DEVICE_TABLE(pci, pci_tbl); · 54 unmodified lines | ||
| 55 | 55 | struct amd768_priv { |
| 56 | 56 | void __iomem *iobase; |
| 57 | 57 | struct pci_dev *pcidev; |
| 58 | + u32 pmbase; | |
| 58 | 59 | }; |
| 59 | 60 | |
| 60 | 61 | static int amd_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait) |
| @@ -148,33 +149,58 @@ found: · 87 unmodified lines | ||
| 148 | 149 | if (pmbase == 0) |
| 149 | 150 | return -EIO; |
| 150 | 151 | |
| 151 | − priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); | |
| 152 | + priv = kzalloc(sizeof(*priv), GFP_KERNEL); | |
| 152 | 153 | if (!priv) |
| 153 | 154 | return -ENOMEM; |
| 154 | 155 | |
| 155 | − if (!devm_request_region(&pdev->dev, pmbase + PMBASE_OFFSET, | |
| 156 | − PMBASE_SIZE, DRV_NAME)) { | |
| 156 | + if (!request_region(pmbase + PMBASE_OFFSET, PMBASE_SIZE, DRV_NAME)) { | |
| 157 | 157 | dev_err(&pdev->dev, DRV_NAME " region 0x%x already in use!\n", |
| 158 | 158 | pmbase + 0xF0); |
| 159 | − return -EBUSY; | |
| 159 | + err = -EBUSY; | |
| 160 | + goto out; | |
| 160 | 161 | } |
| 161 | 162 | |
| 162 | − priv->iobase = devm_ioport_map(&pdev->dev, pmbase + PMBASE_OFFSET, | |
| 163 | − PMBASE_SIZE); | |
| 163 | + priv->iobase = ioport_map(pmbase + PMBASE_OFFSET, PMBASE_SIZE); | |
| 164 | 164 | if (!priv->iobase) { |
| 165 | 165 | pr_err(DRV_NAME "Cannot map ioport\n"); |
| 166 | − return -ENOMEM; | |
| 166 | + err = -EINVAL; | |
| 167 | + goto err_iomap; | |
| 167 | 168 | } |
| 168 | 169 | |
| 169 | 170 | amd_rng.priv = (unsigned long)priv; |
| 171 | + priv->pmbase = pmbase; | |
| 170 | 172 | priv->pcidev = pdev; |
| 171 | 173 | |
| 172 | 174 | pr_info(DRV_NAME " detected\n"); |
| 173 | − return devm_hwrng_register(&pdev->dev, &amd_rng); | |
| 175 | + err = hwrng_register(&amd_rng); | |
| 176 | + if (err) { | |
| 177 | + pr_err(DRV_NAME " registering failed (%d)\n", err); | |
| 178 | + goto err_hwrng; | |
| 179 | + } | |
| 180 | + return 0; | |
| 181 | + | |
| 182 | +err_hwrng: | |
| 183 | + ioport_unmap(priv->iobase); | |
| 184 | +err_iomap: | |
| 185 | + release_region(pmbase + PMBASE_OFFSET, PMBASE_SIZE); | |
| 186 | +out: | |
| 187 | + kfree(priv); | |
| 188 | + return err; | |
| 174 | 189 | } |
| 175 | 190 | |
| 176 | 191 | static void __exit mod_exit(void) |
| 177 | 192 | { |
| 193 | + struct amd768_priv *priv; | |
| 194 | + | |
| 195 | + priv = (struct amd768_priv *)amd_rng.priv; | |
| 196 | + | |
| 197 | + hwrng_unregister(&amd_rng); | |
| 198 | + | |
| 199 | + ioport_unmap(priv->iobase); | |
| 200 | + | |
| 201 | + release_region(priv->pmbase + PMBASE_OFFSET, PMBASE_SIZE); | |
| 202 | + | |
| 203 | + kfree(priv); | |
| 178 | 204 | } |
| 179 | 205 | |
| 180 | 206 | module_init(mod_init); |
| @@ -31,6 +31,9 @@ · 30 unmodified lines | ||
| 31 | 31 | #include <linux/module.h> |
| 32 | 32 | #include <linux/pci.h> |
| 33 | 33 | |
| 34 | + | |
| 35 | +#define PFX KBUILD_MODNAME ": " | |
| 36 | + | |
| 34 | 37 | #define GEODE_RNG_DATA_REG 0x50 |
| 35 | 38 | #define GEODE_RNG_STATUS_REG 0x54 |
| 36 | 39 | |
| @@ -82,6 +85,7 @@ static struct hwrng geode_rng = { · 45 unmodified lines | ||
| 82 | 85 | |
| 83 | 86 | static int __init mod_init(void) |
| 84 | 87 | { |
| 88 | + int err = -ENODEV; | |
| 85 | 89 | struct pci_dev *pdev = NULL; |
| 86 | 90 | const struct pci_device_id *ent; |
| 87 | 91 | void __iomem *mem; |
| @@ -89,27 +93,43 @@ static int __init mod_init(void) · 1 unmodified line | ||
| 89 | 93 | |
| 90 | 94 | for_each_pci_dev(pdev) { |
| 91 | 95 | ent = pci_match_id(pci_tbl, pdev); |
| 92 | − if (ent) { | |
| 93 | − rng_base = pci_resource_start(pdev, 0); | |
| 94 | − if (rng_base == 0) | |
| 95 | − return -ENODEV; | |
| 96 | − | |
| 97 | − mem = devm_ioremap(&pdev->dev, rng_base, 0x58); | |
| 98 | − if (!mem) | |
| 99 | − return -ENOMEM; | |
| 100 | − geode_rng.priv = (unsigned long)mem; | |
| 101 | − | |
| 102 | − pr_info("AMD Geode RNG detected\n"); | |
| 103 | − return devm_hwrng_register(&pdev->dev, &geode_rng); | |
| 104 | − } | |
| 96 | + if (ent) | |
| 97 | + goto found; | |
| 105 | 98 | } |
| 106 | − | |
| 107 | 99 | /* Device not found. */ |
| 108 | − return -ENODEV; | |
| 100 | + goto out; | |
| 101 | + | |
| 102 | +found: | |
| 103 | + rng_base = pci_resource_start(pdev, 0); | |
| 104 | + if (rng_base == 0) | |
| 105 | + goto out; | |
| 106 | + err = -ENOMEM; | |
| 107 | + mem = ioremap(rng_base, 0x58); | |
| 108 | + if (!mem) | |
| 109 | + goto out; | |
| 110 | + geode_rng.priv = (unsigned long)mem; | |
| 111 | + | |
| 112 | + pr_info("AMD Geode RNG detected\n"); | |
| 113 | + err = hwrng_register(&geode_rng); | |
| 114 | + if (err) { | |
| 115 | + pr_err(PFX "RNG registering failed (%d)\n", | |
| 116 | + err); | |
| 117 | + goto err_unmap; | |
| 118 | + } | |
| 119 | +out: | |
| 120 | + return err; | |
| 121 | + | |
| 122 | +err_unmap: | |
| 123 | + iounmap(mem); | |
| 124 | + goto out; | |
| 109 | 125 | } |
| 110 | 126 | |
| 111 | 127 | static void __exit mod_exit(void) |
| 112 | 128 | { |
| 129 | + void __iomem *mem = (void __iomem *)geode_rng.priv; | |
| 130 | + | |
| 131 | + hwrng_unregister(&geode_rng); | |
| 132 | + iounmap(mem); | |
| 113 | 133 | } |
| 114 | 134 | |
| 115 | 135 | module_init(mod_init); |
| @@ -84,11 +84,14 @@ struct pp_struct { · 83 unmodified lines | ||
| 84 | 84 | struct ieee1284_info state; |
| 85 | 85 | struct ieee1284_info saved_state; |
| 86 | 86 | long default_inactivity; |
| 87 | + int index; | |
| 87 | 88 | }; |
| 88 | 89 | |
| 89 | 90 | /* should we use PARDEVICE_MAX here? */ |
| 90 | 91 | static struct device *devices[PARPORT_MAX]; |
| 91 | 92 | |
| 93 | +static DEFINE_IDA(ida_index); | |
| 94 | + | |
| 92 | 95 | /* pp_struct.flags bitfields */ |
| 93 | 96 | #define PP_CLAIMED (1<<0) |
| 94 | 97 | #define PP_EXCL (1<<1) |
| @@ -290,7 +293,7 @@ static int register_device(int minor, struct pp_struct *pp) · 195 unmodified lines | ||
| 290 | 293 | struct pardevice *pdev = NULL; |
| 291 | 294 | char *name; |
| 292 | 295 | struct pardev_cb ppdev_cb; |
| 293 | − int rc = 0; | |
| 296 | + int rc = 0, index; | |
| 294 | 297 | |
| 295 | 298 | name = kasprintf(GFP_KERNEL, CHRDEV "%x", minor); |
| 296 | 299 | if (name == NULL) |
| @@ -303,20 +306,23 @@ static int register_device(int minor, struct pp_struct *pp) · 6 unmodified lines | ||
| 303 | 306 | goto err; |
| 304 | 307 | } |
| 305 | 308 | |
| 309 | + index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL); | |
| 306 | 310 | memset(&ppdev_cb, 0, sizeof(ppdev_cb)); |
| 307 | 311 | ppdev_cb.irq_func = pp_irq; |
| 308 | 312 | ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0; |
| 309 | 313 | ppdev_cb.private = pp; |
| 310 | − pdev = parport_register_dev_model(port, name, &ppdev_cb, minor); | |
| 314 | + pdev = parport_register_dev_model(port, name, &ppdev_cb, index); | |
| 311 | 315 | parport_put_port(port); |
| 312 | 316 | |
| 313 | 317 | if (!pdev) { |
| 314 | 318 | pr_warn("%s: failed to register device!\n", name); |
| 315 | 319 | rc = -ENXIO; |
| 320 | + ida_simple_remove(&ida_index, index); | |
| 316 | 321 | goto err; |
| 317 | 322 | } |
| 318 | 323 | |
| 319 | 324 | pp->pdev = pdev; |
| 325 | + pp->index = index; | |
| 320 | 326 | dev_dbg(&pdev->dev, "registered pardevice\n"); |
| 321 | 327 | err: |
| 322 | 328 | kfree(name); |
| @@ -755,6 +761,7 @@ static int pp_release(struct inode *inode, struct file *file) · 432 unmodified lines | ||
| 755 | 761 | |
| 756 | 762 | if (pp->pdev) { |
| 757 | 763 | parport_unregister_device(pp->pdev); |
| 764 | + ida_simple_remove(&ida_index, pp->index); | |
| 758 | 765 | pp->pdev = NULL; |
| 759 | 766 | pr_debug(CHRDEV "%x: unregistered pardevice\n", minor); |
| 760 | 767 | } |
| @@ -2502,7 +2502,7 @@ struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id, · 2501 unmodified lines | ||
| 2502 | 2502 | |
| 2503 | 2503 | clk->core = hw->core; |
| 2504 | 2504 | clk->dev_id = dev_id; |
| 2505 | − clk->con_id = con_id; | |
| 2505 | + clk->con_id = kstrdup_const(con_id, GFP_KERNEL); | |
| 2506 | 2506 | clk->max_rate = ULONG_MAX; |
| 2507 | 2507 | |
| 2508 | 2508 | clk_prepare_lock(); |
| @@ -2518,6 +2518,7 @@ void __clk_free_clk(struct clk *clk) · 9 unmodified lines | ||
| 2518 | 2518 | hlist_del(&clk->clks_node); |
| 2519 | 2519 | clk_prepare_unlock(); |
| 2520 | 2520 | |
| 2521 | + kfree_const(clk->con_id); | |
| 2521 | 2522 | kfree(clk); |
| 2522 | 2523 | } |
| 2523 | 2524 | |
| @@ -127,7 +127,7 @@ PNAME(mux_ddrphy_p) = { "dpll_ddr", "gpll_ddr" }; · 126 unmodified lines | ||
| 127 | 127 | PNAME(mux_pll_src_3plls_p) = { "apll", "dpll", "gpll" }; |
| 128 | 128 | PNAME(mux_timer_p) = { "xin24m", "pclk_peri_src" }; |
| 129 | 129 | |
| 130 | −PNAME(mux_pll_src_apll_dpll_gpll_usb480m_p) = { "apll", "dpll", "gpll" "usb480m" }; | |
| 130 | +PNAME(mux_pll_src_apll_dpll_gpll_usb480m_p) = { "apll", "dpll", "gpll", "usb480m" }; | |
| 131 | 131 | |
| 132 | 132 | PNAME(mux_mmc_src_p) = { "apll", "dpll", "gpll", "xin24m" }; |
| 133 | 133 | PNAME(mux_i2s_pre_p) = { "i2s_src", "i2s_frac", "ext_i2s", "xin12m" }; |
| @@ -450,6 +450,13 @@ static void __init rk3036_clk_init(struct device_node *np) · 316 unmodified lines | ||
| 450 | 450 | return; |
| 451 | 451 | } |
| 452 | 452 | |
| 453 | + /* | |
| 454 | + * Make uart_pll_clk a child of the gpll, as all other sources are | |
| 455 | + * not that usable / stable. | |
| 456 | + */ | |
| 457 | + writel_relaxed(HIWORD_UPDATE(0x2, 0x3, 10), | |
| 458 | + reg_base + RK2928_CLKSEL_CON(13)); | |
| 459 | + | |
| 453 | 460 | ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS); |
| 454 | 461 | if (IS_ERR(ctx)) { |
| 455 | 462 | pr_err("%s: rockchip clk init failed\n", __func__); |
| @@ -80,6 +80,7 @@ config SUN6I_A31_CCU · 79 unmodified lines | ||
| 80 | 80 | select SUNXI_CCU_DIV |
| 81 | 81 | select SUNXI_CCU_NK |
| 82 | 82 | select SUNXI_CCU_NKM |
| 83 | + select SUNXI_CCU_NKMP | |
| 83 | 84 | select SUNXI_CCU_NM |
| 84 | 85 | select SUNXI_CCU_MP |
| 85 | 86 | select SUNXI_CCU_PHASE |
| @@ -566,7 +566,7 @@ static SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu", · 565 unmodified lines | ||
| 566 | 566 | 0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT); |
| 567 | 567 | |
| 568 | 568 | /* Fixed Factor clocks */ |
| 569 | −static CLK_FIXED_FACTOR(osc12M_clk, "osc12M", "osc24M", 1, 2, 0); | |
| 569 | +static CLK_FIXED_FACTOR(osc12M_clk, "osc12M", "osc24M", 2, 1, 0); | |
| 570 | 570 | |
| 571 | 571 | /* We hardcode the divider to 4 for now */ |
| 572 | 572 | static CLK_FIXED_FACTOR(pll_audio_clk, "pll-audio", |
| @@ -608,7 +608,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", lcd_ch1_parents, · 607 unmodified lines | ||
| 608 | 608 | 0x150, 0, 4, 24, 2, BIT(31), |
| 609 | 609 | CLK_SET_RATE_PARENT); |
| 610 | 610 | |
| 611 | −static SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", 0x150, BIT(31), 0); | |
| 611 | +static SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", 0x150, BIT(30), 0); | |
| 612 | 612 | |
| 613 | 613 | static SUNXI_CCU_GATE(ps_clk, "ps", "lcd1-ch1", 0x140, BIT(31), 0); |
| 614 | 614 | |
| @@ -85,6 +85,10 @@ static unsigned long ccu_mp_recalc_rate(struct clk_hw *hw, · 84 unmodified lines | ||
| 85 | 85 | unsigned int m, p; |
| 86 | 86 | u32 reg; |
| 87 | 87 | |
| 88 | + /* Adjust parent_rate according to pre-dividers */ | |
| 89 | + ccu_mux_helper_adjust_parent_for_prediv(&cmp->common, &cmp->mux, | |
| 90 | + -1, &parent_rate); | |
| 91 | + | |
| 88 | 92 | reg = readl(cmp->common.base + cmp->common.reg); |
| 89 | 93 | |
| 90 | 94 | m = reg >> cmp->m.shift; |
| @@ -117,6 +121,10 @@ static int ccu_mp_set_rate(struct clk_hw *hw, unsigned long rate, · 26 unmodified lines | ||
| 117 | 121 | unsigned int m, p; |
| 118 | 122 | u32 reg; |
| 119 | 123 | |
| 124 | + /* Adjust parent_rate according to pre-dividers */ | |
| 125 | + ccu_mux_helper_adjust_parent_for_prediv(&cmp->common, &cmp->mux, | |
| 126 | + -1, &parent_rate); | |
| 127 | + | |
| 120 | 128 | max_m = cmp->m.max ?: 1 << cmp->m.width; |
| 121 | 129 | max_p = cmp->p.max ?: 1 << ((1 << cmp->p.width) - 1); |
| 122 | 130 | |
| @@ -107,7 +107,7 @@ static unsigned long ccu_nkmp_recalc_rate(struct clk_hw *hw, · 106 unmodified lines | ||
| 107 | 107 | p = reg >> nkmp->p.shift; |
| 108 | 108 | p &= (1 << nkmp->p.width) - 1; |
| 109 | 109 | |
| 110 | − return parent_rate * n * k >> p / m; | |
| 110 | + return (parent_rate * n * k >> p) / m; | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | static long ccu_nkmp_round_rate(struct clk_hw *hw, unsigned long rate, |
| @@ -1184,6 +1184,9 @@ static int cpufreq_online(unsigned int cpu) · 1183 unmodified lines | ||
| 1184 | 1184 | for_each_cpu(j, policy->related_cpus) |
| 1185 | 1185 | per_cpu(cpufreq_cpu_data, j) = policy; |
| 1186 | 1186 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
| 1187 | + } else { | |
| 1188 | + policy->min = policy->user_policy.min; | |
| 1189 | + policy->max = policy->user_policy.max; | |
| 1187 | 1190 | } |
| 1188 | 1191 | |
| 1189 | 1192 | if (cpufreq_driver->get && !cpufreq_driver->setpolicy) { |
| @@ -364,9 +364,7 @@ static bool driver_registered __read_mostly; · 363 unmodified lines | ||
| 364 | 364 | static bool acpi_ppc; |
| 365 | 365 | #endif |
| 366 | 366 | |
| 367 | −static struct perf_limits performance_limits; | |
| 368 | −static struct perf_limits powersave_limits; | |
| 369 | −static struct perf_limits *limits; | |
| 367 | +static struct perf_limits global; | |
| 370 | 368 | |
| 371 | 369 | static void intel_pstate_init_limits(struct perf_limits *limits) |
| 372 | 370 | { |
| @@ -377,14 +375,6 @@ static void intel_pstate_init_limits(struct perf_limits *limits) · 4 unmodified lines | ||
| 377 | 375 | limits->max_sysfs_pct = 100; |
| 378 | 376 | } |
| 379 | 377 | |
| 380 | −static void intel_pstate_set_performance_limits(struct perf_limits *limits) | |
| 381 | −{ | |
| 382 | − intel_pstate_init_limits(limits); | |
| 383 | − limits->min_perf_pct = 100; | |
| 384 | − limits->min_perf = int_ext_tofp(1); | |
| 385 | − limits->min_sysfs_pct = 100; | |
| 386 | −} | |
| 387 | − | |
| 388 | 378 | static DEFINE_MUTEX(intel_pstate_driver_lock); |
| 389 | 379 | static DEFINE_MUTEX(intel_pstate_limits_lock); |
| 390 | 380 | |
| @@ -507,7 +497,7 @@ static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy) · 116 unmodified lines | ||
| 507 | 497 | * correct max turbo frequency based on the turbo state. |
| 508 | 498 | * Also need to convert to MHz as _PSS freq is in MHz. |
| 509 | 499 | */ |
| 510 | − if (!limits->turbo_disabled) | |
| 500 | + if (!global.turbo_disabled) | |
| 511 | 501 | cpu->acpi_perf_data.states[0].core_frequency = |
| 512 | 502 | policy->cpuinfo.max_freq / 1000; |
| 513 | 503 | cpu->valid_pss_table = true; |
| @@ -626,7 +616,7 @@ static inline void update_turbo_state(void) · 112 unmodified lines | ||
| 626 | 616 | |
| 627 | 617 | cpu = all_cpu_data[0]; |
| 628 | 618 | rdmsrl(MSR_IA32_MISC_ENABLE, misc_en); |
| 629 | − limits->turbo_disabled = | |
| 619 | + global.turbo_disabled = | |
| 630 | 620 | (misc_en & MSR_IA32_MISC_ENABLE_TURBO_DISABLE || |
| 631 | 621 | cpu->pstate.max_pstate == cpu->pstate.turbo_pstate); |
| 632 | 622 | } |
| @@ -851,7 +841,7 @@ static struct freq_attr *hwp_cpufreq_attrs[] = { · 218 unmodified lines | ||
| 851 | 841 | static void intel_pstate_hwp_set(struct cpufreq_policy *policy) |
| 852 | 842 | { |
| 853 | 843 | int min, hw_min, max, hw_max, cpu; |
| 854 | − struct perf_limits *perf_limits = limits; | |
| 844 | + struct perf_limits *perf_limits = &global; | |
| 855 | 845 | u64 value, cap; |
| 856 | 846 | |
| 857 | 847 | for_each_cpu(cpu, policy->cpus) { |
| @@ -863,19 +853,22 @@ static void intel_pstate_hwp_set(struct cpufreq_policy *policy) · 5 unmodified lines | ||
| 863 | 853 | |
| 864 | 854 | rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap); |
| 865 | 855 | hw_min = HWP_LOWEST_PERF(cap); |
| 866 | − if (limits->no_turbo) | |
| 856 | + if (global.no_turbo) | |
| 867 | 857 | hw_max = HWP_GUARANTEED_PERF(cap); |
| 868 | 858 | else |
| 869 | 859 | hw_max = HWP_HIGHEST_PERF(cap); |
| 870 | 860 | |
| 871 | − min = fp_ext_toint(hw_max * perf_limits->min_perf); | |
| 861 | + max = fp_ext_toint(hw_max * perf_limits->max_perf); | |
| 862 | + if (cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) | |
| 863 | + min = max; | |
| 864 | + else | |
| 865 | + min = fp_ext_toint(hw_max * perf_limits->min_perf); | |
| 872 | 866 | |
| 873 | 867 | rdmsrl_on_cpu(cpu, MSR_HWP_REQUEST, &value); |
| 874 | 868 | |
| 875 | 869 | value &= ~HWP_MIN_PERF(~0L); |
| 876 | 870 | value |= HWP_MIN_PERF(min); |
| 877 | 871 | |
| 878 | − max = fp_ext_toint(hw_max * perf_limits->max_perf); | |
| 879 | 872 | value &= ~HWP_MAX_PERF(~0L); |
| 880 | 873 | value |= HWP_MAX_PERF(max); |
| 881 | 874 | |
| @@ -968,20 +961,11 @@ static int intel_pstate_resume(struct cpufreq_policy *policy) · 86 unmodified lines | ||
| 968 | 961 | } |
| 969 | 962 | |
| 970 | 963 | static void intel_pstate_update_policies(void) |
| 971 | − __releases(&intel_pstate_limits_lock) | |
| 972 | − __acquires(&intel_pstate_limits_lock) | |
| 973 | 964 | { |
| 974 | − struct perf_limits *saved_limits = limits; | |
| 975 | 965 | int cpu; |
| 976 | 966 | |
| 977 | − mutex_unlock(&intel_pstate_limits_lock); | |
| 978 | − | |
| 979 | 967 | for_each_possible_cpu(cpu) |
| 980 | 968 | cpufreq_update_policy(cpu); |
| 981 | − | |
| 982 | − mutex_lock(&intel_pstate_limits_lock); | |
| 983 | − | |
| 984 | − limits = saved_limits; | |
| 985 | 969 | } |
| 986 | 970 | |
| 987 | 971 | /************************** debugfs begin ************************/ |
| @@ -1060,7 +1044,7 @@ static void intel_pstate_debug_hide_params(void) · 72 unmodified lines | ||
| 1060 | 1044 | static ssize_t show_##file_name \ |
| 1061 | 1045 | (struct kobject *kobj, struct attribute *attr, char *buf) \ |
| 1062 | 1046 | { \ |
| 1063 | − return sprintf(buf, "%u\n", limits->object); \ | |
| 1047 | + return sprintf(buf, "%u\n", global.object); \ | |
| 1064 | 1048 | } |
| 1065 | 1049 | |
| 1066 | 1050 | static ssize_t intel_pstate_show_status(char *buf); |
| @@ -1151,10 +1135,10 @@ static ssize_t show_no_turbo(struct kobject *kobj, · 84 unmodified lines | ||
| 1151 | 1135 | } |
| 1152 | 1136 | |
| 1153 | 1137 | update_turbo_state(); |
| 1154 | − if (limits->turbo_disabled) | |
| 1155 | − ret = sprintf(buf, "%u\n", limits->turbo_disabled); | |
| 1138 | + if (global.turbo_disabled) | |
| 1139 | + ret = sprintf(buf, "%u\n", global.turbo_disabled); | |
| 1156 | 1140 | else |
| 1157 | − ret = sprintf(buf, "%u\n", limits->no_turbo); | |
| 1141 | + ret = sprintf(buf, "%u\n", global.no_turbo); | |
| 1158 | 1142 | |
| 1159 | 1143 | mutex_unlock(&intel_pstate_driver_lock); |
| 1160 | 1144 | |
| @@ -1181,19 +1165,19 @@ static ssize_t store_no_turbo(struct kobject *a, struct attribute *b, · 20 unmodified lines | ||
| 1181 | 1165 | mutex_lock(&intel_pstate_limits_lock); |
| 1182 | 1166 | |
| 1183 | 1167 | update_turbo_state(); |
| 1184 | − if (limits->turbo_disabled) { | |
| 1168 | + if (global.turbo_disabled) { | |
| 1185 | 1169 | pr_warn("Turbo disabled by BIOS or unavailable on processor\n"); |
| 1186 | 1170 | mutex_unlock(&intel_pstate_limits_lock); |
| 1187 | 1171 | mutex_unlock(&intel_pstate_driver_lock); |
| 1188 | 1172 | return -EPERM; |
| 1189 | 1173 | } |
| 1190 | 1174 | |
| 1191 | − limits->no_turbo = clamp_t(int, input, 0, 1); | |
| 1192 | − | |
| 1193 | − intel_pstate_update_policies(); | |
| 1175 | + global.no_turbo = clamp_t(int, input, 0, 1); | |
| 1194 | 1176 | |
| 1195 | 1177 | mutex_unlock(&intel_pstate_limits_lock); |
| 1196 | 1178 | |
| 1179 | + intel_pstate_update_policies(); | |
| 1180 | + | |
| 1197 | 1181 | mutex_unlock(&intel_pstate_driver_lock); |
| 1198 | 1182 | |
| 1199 | 1183 | return count; |
| @@ -1218,19 +1202,16 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b, · 18 unmodified lines | ||
| 1218 | 1202 | |
| 1219 | 1203 | mutex_lock(&intel_pstate_limits_lock); |
| 1220 | 1204 | |
| 1221 | − limits->max_sysfs_pct = clamp_t(int, input, 0 , 100); | |
| 1222 | − limits->max_perf_pct = min(limits->max_policy_pct, | |
| 1223 | − limits->max_sysfs_pct); | |
| 1224 | − limits->max_perf_pct = max(limits->min_policy_pct, | |
| 1225 | − limits->max_perf_pct); | |
| 1226 | − limits->max_perf_pct = max(limits->min_perf_pct, | |
| 1227 | − limits->max_perf_pct); | |
| 1228 | − limits->max_perf = percent_ext_fp(limits->max_perf_pct); | |
| 1229 | − | |
| 1230 | − intel_pstate_update_policies(); | |
| 1205 | + global.max_sysfs_pct = clamp_t(int, input, 0 , 100); | |
| 1206 | + global.max_perf_pct = min(global.max_policy_pct, global.max_sysfs_pct); | |
| 1207 | + global.max_perf_pct = max(global.min_policy_pct, global.max_perf_pct); | |
| 1208 | + global.max_perf_pct = max(global.min_perf_pct, global.max_perf_pct); | |
| 1209 | + global.max_perf = percent_ext_fp(global.max_perf_pct); | |
| 1231 | 1210 | |
| 1232 | 1211 | mutex_unlock(&intel_pstate_limits_lock); |
| 1233 | 1212 | |
| 1213 | + intel_pstate_update_policies(); | |
| 1214 | + | |
| 1234 | 1215 | mutex_unlock(&intel_pstate_driver_lock); |
| 1235 | 1216 | |
| 1236 | 1217 | return count; |
| @@ -1255,19 +1236,16 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b, · 18 unmodified lines | ||
| 1255 | 1236 | |
| 1256 | 1237 | mutex_lock(&intel_pstate_limits_lock); |
| 1257 | 1238 | |
| 1258 | − limits->min_sysfs_pct = clamp_t(int, input, 0 , 100); | |
| 1259 | − limits->min_perf_pct = max(limits->min_policy_pct, | |
| 1260 | − limits->min_sysfs_pct); | |
| 1261 | − limits->min_perf_pct = min(limits->max_policy_pct, | |
| 1262 | − limits->min_perf_pct); | |
| 1263 | − limits->min_perf_pct = min(limits->max_perf_pct, | |
| 1264 | − limits->min_perf_pct); | |
| 1265 | − limits->min_perf = percent_ext_fp(limits->min_perf_pct); | |
| 1266 | − | |
| 1267 | − intel_pstate_update_policies(); | |
| 1239 | + global.min_sysfs_pct = clamp_t(int, input, 0 , 100); | |
| 1240 | + global.min_perf_pct = max(global.min_policy_pct, global.min_sysfs_pct); | |
| 1241 | + global.min_perf_pct = min(global.max_policy_pct, global.min_perf_pct); | |
| 1242 | + global.min_perf_pct = min(global.max_perf_pct, global.min_perf_pct); | |
| 1243 | + global.min_perf = percent_ext_fp(global.min_perf_pct); | |
| 1268 | 1244 | |
| 1269 | 1245 | mutex_unlock(&intel_pstate_limits_lock); |
| 1270 | 1246 | |
| 1247 | + intel_pstate_update_policies(); | |
| 1248 | + | |
| 1271 | 1249 | mutex_unlock(&intel_pstate_driver_lock); |
| 1272 | 1250 | |
| 1273 | 1251 | return count; |
| @@ -1387,7 +1365,7 @@ static u64 atom_get_val(struct cpudata *cpudata, int pstate) · 113 unmodified lines | ||
| 1387 | 1365 | u32 vid; |
| 1388 | 1366 | |
| 1389 | 1367 | val = (u64)pstate << 8; |
| 1390 | − if (limits->no_turbo && !limits->turbo_disabled) | |
| 1368 | + if (global.no_turbo && !global.turbo_disabled) | |
| 1391 | 1369 | val |= (u64)1 << 32; |
| 1392 | 1370 | |
| 1393 | 1371 | vid_fp = cpudata->vid.min + mul_fp( |
| @@ -1557,7 +1535,7 @@ static u64 core_get_val(struct cpudata *cpudata, int pstate) · 163 unmodified lines | ||
| 1557 | 1535 | u64 val; |
| 1558 | 1536 | |
| 1559 | 1537 | val = (u64)pstate << 8; |
| 1560 | − if (limits->no_turbo && !limits->turbo_disabled) | |
| 1538 | + if (global.no_turbo && !global.turbo_disabled) | |
| 1561 | 1539 | val |= (u64)1 << 32; |
| 1562 | 1540 | |
| 1563 | 1541 | return val; |
| @@ -1683,9 +1661,9 @@ static void intel_pstate_get_min_max(struct cpudata *cpu, int *min, int *max) · 119 unmodified lines | ||
| 1683 | 1661 | int max_perf = cpu->pstate.turbo_pstate; |
| 1684 | 1662 | int max_perf_adj; |
| 1685 | 1663 | int min_perf; |
| 1686 | − struct perf_limits *perf_limits = limits; | |
| 1664 | + struct perf_limits *perf_limits = &global; | |
| 1687 | 1665 | |
| 1688 | − if (limits->no_turbo || limits->turbo_disabled) | |
| 1666 | + if (global.no_turbo || global.turbo_disabled) | |
| 1689 | 1667 | max_perf = cpu->pstate.max_pstate; |
| 1690 | 1668 | |
| 1691 | 1669 | if (per_cpu_limits) |
| @@ -1820,7 +1798,7 @@ static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu) · 128 unmodified lines | ||
| 1820 | 1798 | |
| 1821 | 1799 | sample->busy_scaled = busy_frac * 100; |
| 1822 | 1800 | |
| 1823 | − target = limits->no_turbo || limits->turbo_disabled ? | |
| 1801 | + target = global.no_turbo || global.turbo_disabled ? | |
| 1824 | 1802 | cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; |
| 1825 | 1803 | target += target >> 2; |
| 1826 | 1804 | target = mul_fp(target, busy_frac); |
| @@ -2116,7 +2094,7 @@ static void intel_pstate_update_perf_limits(struct cpufreq_policy *policy, · 289 unmodified lines | ||
| 2116 | 2094 | static int intel_pstate_set_policy(struct cpufreq_policy *policy) |
| 2117 | 2095 | { |
| 2118 | 2096 | struct cpudata *cpu; |
| 2119 | − struct perf_limits *perf_limits = NULL; | |
| 2097 | + struct perf_limits *perf_limits = &global; | |
| 2120 | 2098 | |
| 2121 | 2099 | if (!policy->cpuinfo.max_freq) |
| 2122 | 2100 | return -ENODEV; |
| @@ -2139,21 +2117,6 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 16 unmodified lines | ||
| 2139 | 2117 | |
| 2140 | 2118 | mutex_lock(&intel_pstate_limits_lock); |
| 2141 | 2119 | |
| 2142 | − if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) { | |
| 2143 | − pr_debug("set performance\n"); | |
| 2144 | − if (!perf_limits) { | |
| 2145 | − limits = &performance_limits; | |
| 2146 | − perf_limits = limits; | |
| 2147 | − } | |
| 2148 | − } else { | |
| 2149 | − pr_debug("set powersave\n"); | |
| 2150 | − if (!perf_limits) { | |
| 2151 | − limits = &powersave_limits; | |
| 2152 | − perf_limits = limits; | |
| 2153 | − } | |
| 2154 | − | |
| 2155 | − } | |
| 2156 | − | |
| 2157 | 2120 | intel_pstate_update_perf_limits(policy, perf_limits); |
| 2158 | 2121 | |
| 2159 | 2122 | if (cpu->policy == CPUFREQ_POLICY_PERFORMANCE) { |
| @@ -2177,16 +2140,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy) · 17 unmodified lines | ||
| 2177 | 2140 | static int intel_pstate_verify_policy(struct cpufreq_policy *policy) |
| 2178 | 2141 | { |
| 2179 | 2142 | struct cpudata *cpu = all_cpu_data[policy->cpu]; |
| 2180 | − struct perf_limits *perf_limits; | |
| 2181 | − | |
| 2182 | − if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) | |
| 2183 | − perf_limits = &performance_limits; | |
| 2184 | − else | |
| 2185 | − perf_limits = &powersave_limits; | |
| 2186 | 2143 | |
| 2187 | 2144 | update_turbo_state(); |
| 2188 | − policy->cpuinfo.max_freq = perf_limits->turbo_disabled || | |
| 2189 | − perf_limits->no_turbo ? | |
| 2145 | + policy->cpuinfo.max_freq = global.turbo_disabled || global.no_turbo ? | |
| 2190 | 2146 | cpu->pstate.max_freq : |
| 2191 | 2147 | cpu->pstate.turbo_freq; |
| 2192 | 2148 | |
| @@ -2201,9 +2157,9 @@ static int intel_pstate_verify_policy(struct cpufreq_policy *policy) · 8 unmodified lines | ||
| 2201 | 2157 | unsigned int max_freq, min_freq; |
| 2202 | 2158 | |
| 2203 | 2159 | max_freq = policy->cpuinfo.max_freq * |
| 2204 | − perf_limits->max_sysfs_pct / 100; | |
| 2160 | + global.max_sysfs_pct / 100; | |
| 2205 | 2161 | min_freq = policy->cpuinfo.max_freq * |
| 2206 | − perf_limits->min_sysfs_pct / 100; | |
| 2162 | + global.min_sysfs_pct / 100; | |
| 2207 | 2163 | cpufreq_verify_within_limits(policy, min_freq, max_freq); |
| 2208 | 2164 | } |
| 2209 | 2165 | |
| @@ -2255,7 +2211,7 @@ static int __intel_pstate_cpu_init(struct cpufreq_policy *policy) · 45 unmodified lines | ||
| 2255 | 2211 | /* cpuinfo and default policy values */ |
| 2256 | 2212 | policy->cpuinfo.min_freq = cpu->pstate.min_pstate * cpu->pstate.scaling; |
| 2257 | 2213 | update_turbo_state(); |
| 2258 | − policy->cpuinfo.max_freq = limits->turbo_disabled ? | |
| 2214 | + policy->cpuinfo.max_freq = global.turbo_disabled ? | |
| 2259 | 2215 | cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; |
| 2260 | 2216 | policy->cpuinfo.max_freq *= cpu->pstate.scaling; |
| 2261 | 2217 | |
| @@ -2275,7 +2231,7 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) · 13 unmodified lines | ||
| 2275 | 2231 | return ret; |
| 2276 | 2232 | |
| 2277 | 2233 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
| 2278 | − if (limits->min_perf_pct == 100 && limits->max_perf_pct == 100) | |
| 2234 | + if (IS_ENABLED(CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE)) | |
| 2279 | 2235 | policy->policy = CPUFREQ_POLICY_PERFORMANCE; |
| 2280 | 2236 | else |
| 2281 | 2237 | policy->policy = CPUFREQ_POLICY_POWERSAVE; |
| @@ -2301,7 +2257,7 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy) · 19 unmodified lines | ||
| 2301 | 2257 | struct cpudata *cpu = all_cpu_data[policy->cpu]; |
| 2302 | 2258 | |
| 2303 | 2259 | update_turbo_state(); |
| 2304 | − policy->cpuinfo.max_freq = limits->turbo_disabled ? | |
| 2260 | + policy->cpuinfo.max_freq = global.no_turbo || global.turbo_disabled ? | |
| 2305 | 2261 | cpu->pstate.max_freq : cpu->pstate.turbo_freq; |
| 2306 | 2262 | |
| 2307 | 2263 | cpufreq_verify_within_cpu_limits(policy); |
| @@ -2309,26 +2265,6 @@ static int intel_cpufreq_verify_policy(struct cpufreq_policy *policy) · 1 unmodified line | ||
| 2309 | 2265 | return 0; |
| 2310 | 2266 | } |
| 2311 | 2267 | |
| 2312 | −static unsigned int intel_cpufreq_turbo_update(struct cpudata *cpu, | |
| 2313 | − struct cpufreq_policy *policy, | |
| 2314 | − unsigned int target_freq) | |
| 2315 | −{ | |
| 2316 | − unsigned int max_freq; | |
| 2317 | − | |
| 2318 | − update_turbo_state(); | |
| 2319 | − | |
| 2320 | − max_freq = limits->no_turbo || limits->turbo_disabled ? | |
| 2321 | − cpu->pstate.max_freq : cpu->pstate.turbo_freq; | |
| 2322 | − policy->cpuinfo.max_freq = max_freq; | |
| 2323 | − if (policy->max > max_freq) | |
| 2324 | − policy->max = max_freq; | |
| 2325 | − | |
| 2326 | − if (target_freq > max_freq) | |
| 2327 | − target_freq = max_freq; | |
| 2328 | − | |
| 2329 | − return target_freq; | |
| 2330 | −} | |
| 2331 | − | |
| 2332 | 2268 | static int intel_cpufreq_target(struct cpufreq_policy *policy, |
| 2333 | 2269 | unsigned int target_freq, |
| 2334 | 2270 | unsigned int relation) |
| @@ -2337,8 +2273,10 @@ static int intel_cpufreq_target(struct cpufreq_policy *policy, · 2 unmodified lines | ||
| 2337 | 2273 | struct cpufreq_freqs freqs; |
| 2338 | 2274 | int target_pstate; |
| 2339 | 2275 | |
| 2276 | + update_turbo_state(); | |
| 2277 | + | |
| 2340 | 2278 | freqs.old = policy->cur; |
| 2341 | − freqs.new = intel_cpufreq_turbo_update(cpu, policy, target_freq); | |
| 2279 | + freqs.new = target_freq; | |
| 2342 | 2280 | |
| 2343 | 2281 | cpufreq_freq_transition_begin(policy, &freqs); |
| 2344 | 2282 | switch (relation) { |
| @@ -2370,7 +2308,8 @@ static unsigned int intel_cpufreq_fast_switch(struct cpufreq_policy *policy, · 25 unmodified lines | ||
| 2370 | 2308 | struct cpudata *cpu = all_cpu_data[policy->cpu]; |
| 2371 | 2309 | int target_pstate; |
| 2372 | 2310 | |
| 2373 | − target_freq = intel_cpufreq_turbo_update(cpu, policy, target_freq); | |
| 2311 | + update_turbo_state(); | |
| 2312 | + | |
| 2374 | 2313 | target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling); |
| 2375 | 2314 | target_pstate = intel_pstate_prepare_request(cpu, target_pstate); |
| 2376 | 2315 | intel_pstate_update_pstate(cpu, target_pstate); |
| @@ -2425,13 +2364,7 @@ static int intel_pstate_register_driver(void) · 48 unmodified lines | ||
| 2425 | 2364 | { |
| 2426 | 2365 | int ret; |
| 2427 | 2366 | |
| 2428 | − intel_pstate_init_limits(&powersave_limits); | |
| 2429 | − intel_pstate_set_performance_limits(&performance_limits); | |
| 2430 | − if (IS_ENABLED(CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE) && | |
| 2431 | − intel_pstate_driver == &intel_pstate) | |
| 2432 | − limits = &performance_limits; | |
| 2433 | − else | |
| 2434 | − limits = &powersave_limits; | |
| 2367 | + intel_pstate_init_limits(&global); | |
| 2435 | 2368 | |
| 2436 | 2369 | ret = cpufreq_register_driver(intel_pstate_driver); |
| 2437 | 2370 | if (ret) { |
| @@ -615,6 +615,18 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev) · 614 unmodified lines | ||
| 615 | 615 | struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu); |
| 616 | 616 | int error; |
| 617 | 617 | |
| 618 | + /* | |
| 619 | + * Return if cpu_device is not setup for this CPU. | |
| 620 | + * | |
| 621 | + * This could happen if the arch did not set up cpu_device | |
| 622 | + * since this CPU is not in cpu_present mask and the | |
| 623 | + * driver did not send a correct CPU mask during registration. | |
| 624 | + * Without this check we would end up passing bogus | |
| 625 | + * value for &cpu_dev->kobj in kobject_init_and_add() | |
| 626 | + */ | |
| 627 | + if (!cpu_dev) | |
| 628 | + return -ENODEV; | |
| 629 | + | |
| 618 | 630 | kdev = kzalloc(sizeof(*kdev), GFP_KERNEL); |
| 619 | 631 | if (!kdev) |
| 620 | 632 | return -ENOMEM; |
| @@ -283,11 +283,14 @@ EXPORT_SYMBOL_GPL(ccp_version); · 282 unmodified lines | ||
| 283 | 283 | */ |
| 284 | 284 | int ccp_enqueue_cmd(struct ccp_cmd *cmd) |
| 285 | 285 | { |
| 286 | − struct ccp_device *ccp = ccp_get_device(); | |
| 286 | + struct ccp_device *ccp; | |
| 287 | 287 | unsigned long flags; |
| 288 | 288 | unsigned int i; |
| 289 | 289 | int ret; |
| 290 | 290 | |
| 291 | + /* Some commands might need to be sent to a specific device */ | |
| 292 | + ccp = cmd->ccp ? cmd->ccp : ccp_get_device(); | |
| 293 | + | |
| 291 | 294 | if (!ccp) |
| 292 | 295 | return -ENODEV; |
| 293 | 296 | |
| @@ -390,6 +390,7 @@ static struct ccp_dma_desc *ccp_create_desc(struct dma_chan *dma_chan, · 389 unmodified lines | ||
| 390 | 390 | goto err; |
| 391 | 391 | |
| 392 | 392 | ccp_cmd = &cmd->ccp_cmd; |
| 393 | + ccp_cmd->ccp = chan->ccp; | |
| 393 | 394 | ccp_pt = &ccp_cmd->u.passthru_nomap; |
| 394 | 395 | ccp_cmd->flags = CCP_CMD_MAY_BACKLOG; |
| 395 | 396 | ccp_cmd->flags |= CCP_CMD_PASSTHRU_NO_DMA_MAP; |
| @@ -44,7 +44,7 @@ config EXTCON_GPIO · 43 unmodified lines | ||
| 44 | 44 | |
| 45 | 45 | config EXTCON_INTEL_INT3496 |
| 46 | 46 | tristate "Intel INT3496 ACPI device extcon driver" |
| 47 | − depends on GPIOLIB && ACPI | |
| 47 | + depends on GPIOLIB && ACPI && (X86 || COMPILE_TEST) | |
| 48 | 48 | help |
| 49 | 49 | Say Y here to enable extcon support for USB OTG ports controlled by |
| 50 | 50 | an Intel INT3496 ACPI device. |
| @@ -45,6 +45,17 @@ static const unsigned int int3496_cable[] = { · 44 unmodified lines | ||
| 45 | 45 | EXTCON_NONE, |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | +static const struct acpi_gpio_params id_gpios = { INT3496_GPIO_USB_ID, 0, false }; | |
| 49 | +static const struct acpi_gpio_params vbus_gpios = { INT3496_GPIO_VBUS_EN, 0, false }; | |
| 50 | +static const struct acpi_gpio_params mux_gpios = { INT3496_GPIO_USB_MUX, 0, false }; | |
| 51 | + | |
| 52 | +static const struct acpi_gpio_mapping acpi_int3496_default_gpios[] = { | |
| 53 | + { "id-gpios", &id_gpios, 1 }, | |
| 54 | + { "vbus-gpios", &vbus_gpios, 1 }, | |
| 55 | + { "mux-gpios", &mux_gpios, 1 }, | |
| 56 | + { }, | |
| 57 | +}; | |
| 58 | + | |
| 48 | 59 | static void int3496_do_usb_id(struct work_struct *work) |
| 49 | 60 | { |
| 50 | 61 | struct int3496_data *data = |
| @@ -83,6 +94,13 @@ static int int3496_probe(struct platform_device *pdev) · 32 unmodified lines | ||
| 83 | 94 | struct int3496_data *data; |
| 84 | 95 | int ret; |
| 85 | 96 | |
| 97 | + ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), | |
| 98 | + acpi_int3496_default_gpios); | |
| 99 | + if (ret) { | |
| 100 | + dev_err(dev, "can't add GPIO ACPI mapping\n"); | |
| 101 | + return ret; | |
| 102 | + } | |
| 103 | + | |
| 86 | 104 | data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); |
| 87 | 105 | if (!data) |
| 88 | 106 | return -ENOMEM; |
| @@ -90,30 +108,27 @@ static int int3496_probe(struct platform_device *pdev) · 1 unmodified line | ||
| 90 | 108 | data->dev = dev; |
| 91 | 109 | INIT_DELAYED_WORK(&data->work, int3496_do_usb_id); |
| 92 | 110 | |
| 93 | − data->gpio_usb_id = devm_gpiod_get_index(dev, "id", | |
| 94 | − INT3496_GPIO_USB_ID, | |
| 95 | − GPIOD_IN); | |
| 111 | + data->gpio_usb_id = devm_gpiod_get(dev, "id", GPIOD_IN); | |
| 96 | 112 | if (IS_ERR(data->gpio_usb_id)) { |
| 97 | 113 | ret = PTR_ERR(data->gpio_usb_id); |
| 98 | 114 | dev_err(dev, "can't request USB ID GPIO: %d\n", ret); |
| 99 | 115 | return ret; |
| 116 | + } else if (gpiod_get_direction(data->gpio_usb_id) != GPIOF_DIR_IN) { | |
| 117 | + dev_warn(dev, FW_BUG "USB ID GPIO not in input mode, fixing\n"); | |
| 118 | + gpiod_direction_input(data->gpio_usb_id); | |
| 100 | 119 | } |
| 101 | 120 | |
| 102 | 121 | data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id); |
| 103 | − if (data->usb_id_irq <= 0) { | |
| 122 | + if (data->usb_id_irq < 0) { | |
| 104 | 123 | dev_err(dev, "can't get USB ID IRQ: %d\n", data->usb_id_irq); |
| 105 | − return -EINVAL; | |
| 124 | + return data->usb_id_irq; | |
| 106 | 125 | } |
| 107 | 126 | |
| 108 | − data->gpio_vbus_en = devm_gpiod_get_index(dev, "vbus en", | |
| 109 | − INT3496_GPIO_VBUS_EN, | |
| 110 | − GPIOD_ASIS); | |
| 127 | + data->gpio_vbus_en = devm_gpiod_get(dev, "vbus", GPIOD_ASIS); | |
| 111 | 128 | if (IS_ERR(data->gpio_vbus_en)) |
| 112 | 129 | dev_info(dev, "can't request VBUS EN GPIO\n"); |
| 113 | 130 | |
| 114 | − data->gpio_usb_mux = devm_gpiod_get_index(dev, "usb mux", | |
| 115 | − INT3496_GPIO_USB_MUX, | |
| 116 | − GPIOD_ASIS); | |
| 131 | + data->gpio_usb_mux = devm_gpiod_get(dev, "mux", GPIOD_ASIS); | |
| 117 | 132 | if (IS_ERR(data->gpio_usb_mux)) |
| 118 | 133 | dev_info(dev, "can't request USB MUX GPIO\n"); |
| 119 | 134 | |
| @@ -154,6 +169,8 @@ static int int3496_remove(struct platform_device *pdev) · 34 unmodified lines | ||
| 154 | 169 | devm_free_irq(&pdev->dev, data->usb_id_irq, data); |
| 155 | 170 | cancel_delayed_work_sync(&data->work); |
| 156 | 171 | |
| 172 | + acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev)); | |
| 173 | + | |
| 157 | 174 | return 0; |
| 158 | 175 | } |
| 159 | 176 | |
| @@ -96,7 +96,7 @@ static int altr_a10sr_gpio_probe(struct platform_device *pdev) · 95 unmodified lines | ||
| 96 | 96 | gpio->regmap = a10sr->regmap; |
| 97 | 97 | |
| 98 | 98 | gpio->gp = altr_a10sr_gc; |
| 99 | − | |
| 99 | + gpio->gp.parent = pdev->dev.parent; | |
| 100 | 100 | gpio->gp.of_node = pdev->dev.of_node; |
| 101 | 101 | |
| 102 | 102 | ret = devm_gpiochip_add_data(&pdev->dev, &gpio->gp, gpio); |
| @@ -90,21 +90,18 @@ static int altera_gpio_irq_set_type(struct irq_data *d, · 89 unmodified lines | ||
| 90 | 90 | |
| 91 | 91 | altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
| 92 | 92 | |
| 93 | − if (type == IRQ_TYPE_NONE) | |
| 93 | + if (type == IRQ_TYPE_NONE) { | |
| 94 | + irq_set_handler_locked(d, handle_bad_irq); | |
| 94 | 95 | return 0; |
| 95 | − if (type == IRQ_TYPE_LEVEL_HIGH && | |
| 96 | − altera_gc->interrupt_trigger == IRQ_TYPE_LEVEL_HIGH) | |
| 97 | − return 0; | |
| 98 | − if (type == IRQ_TYPE_EDGE_RISING && | |
| 99 | − altera_gc->interrupt_trigger == IRQ_TYPE_EDGE_RISING) | |
| 100 | − return 0; | |
| 101 | − if (type == IRQ_TYPE_EDGE_FALLING && | |
| 102 | − altera_gc->interrupt_trigger == IRQ_TYPE_EDGE_FALLING) | |
| 103 | − return 0; | |
| 104 | − if (type == IRQ_TYPE_EDGE_BOTH && | |
| 105 | − altera_gc->interrupt_trigger == IRQ_TYPE_EDGE_BOTH) | |
| 96 | + } | |
| 97 | + if (type == altera_gc->interrupt_trigger) { | |
| 98 | + if (type == IRQ_TYPE_LEVEL_HIGH) | |
| 99 | + irq_set_handler_locked(d, handle_level_irq); | |
| 100 | + else | |
| 101 | + irq_set_handler_locked(d, handle_simple_irq); | |
| 106 | 102 | return 0; |
| 107 | − | |
| 103 | + } | |
| 104 | + irq_set_handler_locked(d, handle_bad_irq); | |
| 108 | 105 | return -EINVAL; |
| 109 | 106 | } |
| 110 | 107 | |
| @@ -230,7 +227,6 @@ static void altera_gpio_irq_edge_handler(struct irq_desc *desc) · 119 unmodified lines | ||
| 230 | 227 | chained_irq_exit(chip, desc); |
| 231 | 228 | } |
| 232 | 229 | |
| 233 | − | |
| 234 | 230 | static void altera_gpio_irq_leveL_high_handler(struct irq_desc *desc) |
| 235 | 231 | { |
| 236 | 232 | struct altera_gpio_chip *altera_gc; |
| @@ -310,7 +306,7 @@ static int altera_gpio_probe(struct platform_device *pdev) · 73 unmodified lines | ||
| 310 | 306 | altera_gc->interrupt_trigger = reg; |
| 311 | 307 | |
| 312 | 308 | ret = gpiochip_irqchip_add(&altera_gc->mmchip.gc, &altera_irq_chip, 0, |
| 313 | − handle_simple_irq, IRQ_TYPE_NONE); | |
| 309 | + handle_bad_irq, IRQ_TYPE_NONE); | |
| 314 | 310 | |
| 315 | 311 | if (ret) { |
| 316 | 312 | dev_err(&pdev->dev, "could not add irqchip\n"); |
| @@ -270,8 +270,10 @@ mcp23s08_direction_output(struct gpio_chip *chip, unsigned offset, int value) · 269 unmodified lines | ||
| 270 | 270 | static irqreturn_t mcp23s08_irq(int irq, void *data) |
| 271 | 271 | { |
| 272 | 272 | struct mcp23s08 *mcp = data; |
| 273 | − int intcap, intf, i; | |
| 273 | + int intcap, intf, i, gpio, gpio_orig, intcap_mask; | |
| 274 | 274 | unsigned int child_irq; |
| 275 | + bool intf_set, intcap_changed, gpio_bit_changed, | |
| 276 | + defval_changed, gpio_set; | |
| 275 | 277 | |
| 276 | 278 | mutex_lock(&mcp->lock); |
| 277 | 279 | if (mcp_read(mcp, MCP_INTF, &intf) < 0) { |
| @@ -287,14 +289,67 @@ static irqreturn_t mcp23s08_irq(int irq, void *data) · 9 unmodified lines | ||
| 287 | 289 | } |
| 288 | 290 | |
| 289 | 291 | mcp->cache[MCP_INTCAP] = intcap; |
| 292 | + | |
| 293 | + /* This clears the interrupt(configurable on S18) */ | |
| 294 | + if (mcp_read(mcp, MCP_GPIO, &gpio) < 0) { | |
| 295 | + mutex_unlock(&mcp->lock); | |
| 296 | + return IRQ_HANDLED; | |
| 297 | + } | |
| 298 | + gpio_orig = mcp->cache[MCP_GPIO]; | |
| 299 | + mcp->cache[MCP_GPIO] = gpio; | |
| 290 | 300 | mutex_unlock(&mcp->lock); |
| 291 | 301 | |
| 302 | + if (mcp->cache[MCP_INTF] == 0) { | |
| 303 | + /* There is no interrupt pending */ | |
| 304 | + return IRQ_HANDLED; | |
| 305 | + } | |
| 306 | + | |
| 307 | + dev_dbg(mcp->chip.parent, | |
| 308 | + "intcap 0x%04X intf 0x%04X gpio_orig 0x%04X gpio 0x%04X\n", | |
| 309 | + intcap, intf, gpio_orig, gpio); | |
| 292 | 310 | |
| 293 | 311 | for (i = 0; i < mcp->chip.ngpio; i++) { |
| 294 | − if ((BIT(i) & mcp->cache[MCP_INTF]) && | |
| 295 | − ((BIT(i) & intcap & mcp->irq_rise) || | |
| 296 | − (mcp->irq_fall & ~intcap & BIT(i)) || | |
| 297 | − (BIT(i) & mcp->cache[MCP_INTCON]))) { | |
| 312 | + /* We must check all of the inputs on the chip, | |
| 313 | + * otherwise we may not notice a change on >=2 pins. | |
| 314 | + * | |
| 315 | + * On at least the mcp23s17, INTCAP is only updated | |
| 316 | + * one byte at a time(INTCAPA and INTCAPB are | |
| 317 | + * not written to at the same time - only on a per-bank | |
| 318 | + * basis). | |
| 319 | + * | |
| 320 | + * INTF only contains the single bit that caused the | |
| 321 | + * interrupt per-bank. On the mcp23s17, there is | |
| 322 | + * INTFA and INTFB. If two pins are changed on the A | |
| 323 | + * side at the same time, INTF will only have one bit | |
| 324 | + * set. If one pin on the A side and one pin on the B | |
| 325 | + * side are changed at the same time, INTF will have | |
| 326 | + * two bits set. Thus, INTF can't be the only check | |
| 327 | + * to see if the input has changed. | |
| 328 | + */ | |
| 329 | + | |
| 330 | + intf_set = BIT(i) & mcp->cache[MCP_INTF]; | |
| 331 | + if (i < 8 && intf_set) | |
| 332 | + intcap_mask = 0x00FF; | |
| 333 | + else if (i >= 8 && intf_set) | |
| 334 | + intcap_mask = 0xFF00; | |
| 335 | + else | |
| 336 | + intcap_mask = 0x00; | |
| 337 | + | |
| 338 | + intcap_changed = (intcap_mask & | |
| 339 | + (BIT(i) & mcp->cache[MCP_INTCAP])) != | |
| 340 | + (intcap_mask & (BIT(i) & gpio_orig)); | |
| 341 | + gpio_set = BIT(i) & mcp->cache[MCP_GPIO]; | |
| 342 | + gpio_bit_changed = (BIT(i) & gpio_orig) != | |
| 343 | + (BIT(i) & mcp->cache[MCP_GPIO]); | |
| 344 | + defval_changed = (BIT(i) & mcp->cache[MCP_INTCON]) && | |
| 345 | + ((BIT(i) & mcp->cache[MCP_GPIO]) != | |
| 346 | + (BIT(i) & mcp->cache[MCP_DEFVAL])); | |
| 347 | + | |
| 348 | + if (((gpio_bit_changed || intcap_changed) && | |
| 349 | + (BIT(i) & mcp->irq_rise) && gpio_set) || | |
| 350 | + ((gpio_bit_changed || intcap_changed) && | |
| 351 | + (BIT(i) & mcp->irq_fall) && !gpio_set) || | |
| 352 | + defval_changed) { | |
| 298 | 353 | child_irq = irq_find_mapping(mcp->chip.irqdomain, i); |
| 299 | 354 | handle_nested_irq(child_irq); |
| 300 | 355 | } |
| @@ -197,7 +197,7 @@ static ssize_t gpio_mockup_event_write(struct file *file, · 196 unmodified lines | ||
| 197 | 197 | struct seq_file *sfile; |
| 198 | 198 | struct gpio_desc *desc; |
| 199 | 199 | struct gpio_chip *gc; |
| 200 | − int status, val; | |
| 200 | + int val; | |
| 201 | 201 | char buf; |
| 202 | 202 | |
| 203 | 203 | sfile = file->private_data; |
| @@ -206,9 +206,8 @@ static ssize_t gpio_mockup_event_write(struct file *file, · 2 unmodified lines | ||
| 206 | 206 | chip = priv->chip; |
| 207 | 207 | gc = &chip->gc; |
| 208 | 208 | |
| 209 | − status = copy_from_user(&buf, usr_buf, 1); | |
| 210 | − if (status) | |
| 211 | − return status; | |
| 209 | + if (copy_from_user(&buf, usr_buf, 1)) | |
| 210 | + return -EFAULT; | |
| 212 | 211 | |
| 213 | 212 | if (buf == '0') |
| 214 | 213 | val = 0; |
| @@ -42,9 +42,7 @@ struct xgene_gpio { · 41 unmodified lines | ||
| 42 | 42 | struct gpio_chip chip; |
| 43 | 43 | void __iomem *base; |
| 44 | 44 | spinlock_t lock; |
| 45 | −#ifdef CONFIG_PM | |
| 46 | 45 | u32 set_dr_val[XGENE_MAX_GPIO_BANKS]; |
| 47 | −#endif | |
| 48 | 46 | }; |
| 49 | 47 | |
| 50 | 48 | static int xgene_gpio_get(struct gpio_chip *gc, unsigned int offset) |
| @@ -138,8 +136,7 @@ static int xgene_gpio_dir_out(struct gpio_chip *gc, · 87 unmodified lines | ||
| 138 | 136 | return 0; |
| 139 | 137 | } |
| 140 | 138 | |
| 141 | −#ifdef CONFIG_PM | |
| 142 | −static int xgene_gpio_suspend(struct device *dev) | |
| 139 | +static __maybe_unused int xgene_gpio_suspend(struct device *dev) | |
| 143 | 140 | { |
| 144 | 141 | struct xgene_gpio *gpio = dev_get_drvdata(dev); |
| 145 | 142 | unsigned long bank_offset; |
| @@ -152,7 +149,7 @@ static int xgene_gpio_suspend(struct device *dev) · 6 unmodified lines | ||
| 152 | 149 | return 0; |
| 153 | 150 | } |
| 154 | 151 | |
| 155 | −static int xgene_gpio_resume(struct device *dev) | |
| 152 | +static __maybe_unused int xgene_gpio_resume(struct device *dev) | |
| 156 | 153 | { |
| 157 | 154 | struct xgene_gpio *gpio = dev_get_drvdata(dev); |
| 158 | 155 | unsigned long bank_offset; |
| @@ -166,10 +163,6 @@ static int xgene_gpio_resume(struct device *dev) · 7 unmodified lines | ||
| 166 | 163 | } |
| 167 | 164 | |
| 168 | 165 | static SIMPLE_DEV_PM_OPS(xgene_gpio_pm, xgene_gpio_suspend, xgene_gpio_resume); |
| 169 | −#define XGENE_GPIO_PM_OPS (&xgene_gpio_pm) | |
| 170 | −#else | |
| 171 | −#define XGENE_GPIO_PM_OPS NULL | |
| 172 | −#endif | |
| 173 | 166 | |
| 174 | 167 | static int xgene_gpio_probe(struct platform_device *pdev) |
| 175 | 168 | { |
| @@ -241,7 +234,7 @@ static struct platform_driver xgene_gpio_driver = { · 65 unmodified lines | ||
| 241 | 234 | .name = "xgene-gpio", |
| 242 | 235 | .of_match_table = xgene_gpio_of_match, |
| 243 | 236 | .acpi_match_table = ACPI_PTR(xgene_gpio_acpi_match), |
| 244 | − .pm = XGENE_GPIO_PM_OPS, | |
| 237 | + .pm = &xgene_gpio_pm, | |
| 245 | 238 | }, |
| 246 | 239 | .probe = xgene_gpio_probe, |
| 247 | 240 | }; |
| @@ -475,7 +475,7 @@ static int amdgpu_wb_init(struct amdgpu_device *adev) · 474 unmodified lines | ||
| 475 | 475 | int r; |
| 476 | 476 | |
| 477 | 477 | if (adev->wb.wb_obj == NULL) { |
| 478 | − r = amdgpu_bo_create_kernel(adev, AMDGPU_MAX_WB * 4, | |
| 478 | + r = amdgpu_bo_create_kernel(adev, AMDGPU_MAX_WB * sizeof(uint32_t), | |
| 479 | 479 | PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT, |
| 480 | 480 | &adev->wb.wb_obj, &adev->wb.gpu_addr, |
| 481 | 481 | (void **)&adev->wb.wb); |
| @@ -488,7 +488,7 @@ static int amdgpu_wb_init(struct amdgpu_device *adev) · 6 unmodified lines | ||
| 488 | 488 | memset(&adev->wb.used, 0, sizeof(adev->wb.used)); |
| 489 | 489 | |
| 490 | 490 | /* clear wb memory */ |
| 491 | − memset((char *)adev->wb.wb, 0, AMDGPU_GPU_PAGE_SIZE); | |
| 491 | + memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t)); | |
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | return 0; |
| @@ -421,6 +421,7 @@ static const struct pci_device_id pciidlist[] = { · 420 unmodified lines | ||
| 421 | 421 | {0x1002, 0x6985, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 422 | 422 | {0x1002, 0x6986, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 423 | 423 | {0x1002, 0x6987, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 424 | + {0x1002, 0x6995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, | |
| 424 | 425 | {0x1002, 0x699F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 425 | 426 | |
| 426 | 427 | {0, 0, 0} |
| @@ -3465,9 +3465,13 @@ static void si_apply_state_adjust_rules(struct amdgpu_device *adev, · 3464 unmodified lines | ||
| 3465 | 3465 | max_sclk = 75000; |
| 3466 | 3466 | } |
| 3467 | 3467 | } else if (adev->asic_type == CHIP_OLAND) { |
| 3468 | − if ((adev->pdev->device == 0x6604) && | |
| 3469 | − (adev->pdev->subsystem_vendor == 0x1028) && | |
| 3470 | − (adev->pdev->subsystem_device == 0x066F)) { | |
| 3468 | + if ((adev->pdev->revision == 0xC7) || | |
| 3469 | + (adev->pdev->revision == 0x80) || | |
| 3470 | + (adev->pdev->revision == 0x81) || | |
| 3471 | + (adev->pdev->revision == 0x83) || | |
| 3472 | + (adev->pdev->revision == 0x87) || | |
| 3473 | + (adev->pdev->device == 0x6604) || | |
| 3474 | + (adev->pdev->device == 0x6605)) { | |
| 3471 | 3475 | max_sclk = 75000; |
| 3472 | 3476 | } |
| 3473 | 3477 | } |
| @@ -1332,9 +1332,9 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, · 1331 unmodified lines | ||
| 1332 | 1332 | * to KMS, hence fail if different settings are requested. |
| 1333 | 1333 | */ |
| 1334 | 1334 | if (var->bits_per_pixel != fb->format->cpp[0] * 8 || |
| 1335 | − var->xres != fb->width || var->yres != fb->height || | |
| 1336 | − var->xres_virtual != fb->width || var->yres_virtual != fb->height) { | |
| 1337 | − DRM_DEBUG("fb userspace requested width/height/bpp different than current fb " | |
| 1335 | + var->xres > fb->width || var->yres > fb->height || | |
| 1336 | + var->xres_virtual > fb->width || var->yres_virtual > fb->height) { | |
| 1337 | + DRM_DEBUG("fb requested width/height/bpp can't fit in current fb " | |
| 1338 | 1338 | "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n", |
| 1339 | 1339 | var->xres, var->yres, var->bits_per_pixel, |
| 1340 | 1340 | var->xres_virtual, var->yres_virtual, |
| @@ -68,6 +68,8 @@ struct decon_context { · 67 unmodified lines | ||
| 68 | 68 | unsigned long flags; |
| 69 | 69 | unsigned long out_type; |
| 70 | 70 | int first_win; |
| 71 | + spinlock_t vblank_lock; | |
| 72 | + u32 frame_id; | |
| 71 | 73 | }; |
| 72 | 74 | |
| 73 | 75 | static const uint32_t decon_formats[] = { |
| @@ -103,7 +105,7 @@ static int decon_enable_vblank(struct exynos_drm_crtc *crtc) · 29 unmodified lines | ||
| 103 | 105 | if (ctx->out_type & IFTYPE_I80) |
| 104 | 106 | val |= VIDINTCON0_FRAMEDONE; |
| 105 | 107 | else |
| 106 | − val |= VIDINTCON0_INTFRMEN; | |
| 108 | + val |= VIDINTCON0_INTFRMEN | VIDINTCON0_FRAMESEL_FP; | |
| 107 | 109 | |
| 108 | 110 | writel(val, ctx->addr + DECON_VIDINTCON0); |
| 109 | 111 | } |
| @@ -122,14 +124,56 @@ static void decon_disable_vblank(struct exynos_drm_crtc *crtc) · 12 unmodified lines | ||
| 122 | 124 | writel(0, ctx->addr + DECON_VIDINTCON0); |
| 123 | 125 | } |
| 124 | 126 | |
| 127 | +/* return number of starts/ends of frame transmissions since reset */ | |
| 128 | +static u32 decon_get_frame_count(struct decon_context *ctx, bool end) | |
| 129 | +{ | |
| 130 | + u32 frm, pfrm, status, cnt = 2; | |
| 131 | + | |
| 132 | + /* To get consistent result repeat read until frame id is stable. | |
| 133 | + * Usually the loop will be executed once, in rare cases when the loop | |
| 134 | + * is executed at frame change time 2nd pass will be needed. | |
| 135 | + */ | |
| 136 | + frm = readl(ctx->addr + DECON_CRFMID); | |
| 137 | + do { | |
| 138 | + status = readl(ctx->addr + DECON_VIDCON1); | |
| 139 | + pfrm = frm; | |
| 140 | + frm = readl(ctx->addr + DECON_CRFMID); | |
| 141 | + } while (frm != pfrm && --cnt); | |
| 142 | + | |
| 143 | + /* CRFMID is incremented on BPORCH in case of I80 and on VSYNC in case | |
| 144 | + * of RGB, it should be taken into account. | |
| 145 | + */ | |
| 146 | + if (!frm) | |
| 147 | + return 0; | |
| 148 | + | |
| 149 | + switch (status & (VIDCON1_VSTATUS_MASK | VIDCON1_I80_ACTIVE)) { | |
| 150 | + case VIDCON1_VSTATUS_VS: | |
| 151 | + if (!(ctx->out_type & IFTYPE_I80)) | |
| 152 | + --frm; | |
| 153 | + break; | |
| 154 | + case VIDCON1_VSTATUS_BP: | |
| 155 | + --frm; | |
| 156 | + break; | |
| 157 | + case VIDCON1_I80_ACTIVE: | |
| 158 | + case VIDCON1_VSTATUS_AC: | |
| 159 | + if (end) | |
| 160 | + --frm; | |
| 161 | + break; | |
| 162 | + default: | |
| 163 | + break; | |
| 164 | + } | |
| 165 | + | |
| 166 | + return frm; | |
| 167 | +} | |
| 168 | + | |
| 125 | 169 | static void decon_setup_trigger(struct decon_context *ctx) |
| 126 | 170 | { |
| 127 | 171 | if (!(ctx->out_type & (IFTYPE_I80 | I80_HW_TRG))) |
| 128 | 172 | return; |
| 129 | 173 | |
| 130 | 174 | if (!(ctx->out_type & I80_HW_TRG)) { |
| 131 | − writel(TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN | |
| 132 | − | TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN, | |
| 175 | + writel(TRIGCON_TRIGEN_PER_F | TRIGCON_TRIGEN_F | | |
| 176 | + TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN, | |
| 133 | 177 | ctx->addr + DECON_TRIGCON); |
| 134 | 178 | return; |
| 135 | 179 | } |
| @@ -365,11 +409,14 @@ static void decon_disable_plane(struct exynos_drm_crtc *crtc, · 229 unmodified lines | ||
| 365 | 409 | static void decon_atomic_flush(struct exynos_drm_crtc *crtc) |
| 366 | 410 | { |
| 367 | 411 | struct decon_context *ctx = crtc->ctx; |
| 412 | + unsigned long flags; | |
| 368 | 413 | int i; |
| 369 | 414 | |
| 370 | 415 | if (test_bit(BIT_SUSPENDED, &ctx->flags)) |
| 371 | 416 | return; |
| 372 | 417 | |
| 418 | + spin_lock_irqsave(&ctx->vblank_lock, flags); | |
| 419 | + | |
| 373 | 420 | for (i = ctx->first_win; i < WINDOWS_NR; i++) |
| 374 | 421 | decon_shadow_protect_win(ctx, i, false); |
| 375 | 422 | |
| @@ -378,11 +425,18 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc) · 2 unmodified lines | ||
| 378 | 425 | |
| 379 | 426 | if (ctx->out_type & IFTYPE_I80) |
| 380 | 427 | set_bit(BIT_WIN_UPDATED, &ctx->flags); |
| 428 | + | |
| 429 | + ctx->frame_id = decon_get_frame_count(ctx, true); | |
| 430 | + | |
| 431 | + exynos_crtc_handle_event(crtc); | |
| 432 | + | |
| 433 | + spin_unlock_irqrestore(&ctx->vblank_lock, flags); | |
| 381 | 434 | } |
| 382 | 435 | |
| 383 | 436 | static void decon_swreset(struct decon_context *ctx) |
| 384 | 437 | { |
| 385 | 438 | unsigned int tries; |
| 439 | + unsigned long flags; | |
| 386 | 440 | |
| 387 | 441 | writel(0, ctx->addr + DECON_VIDCON0); |
| 388 | 442 | for (tries = 2000; tries; --tries) { |
| @@ -400,6 +454,10 @@ static void decon_swreset(struct decon_context *ctx) · 11 unmodified lines | ||
| 400 | 454 | |
| 401 | 455 | WARN(tries == 0, "failed to software reset DECON\n"); |
| 402 | 456 | |
| 457 | + spin_lock_irqsave(&ctx->vblank_lock, flags); | |
| 458 | + ctx->frame_id = 0; | |
| 459 | + spin_unlock_irqrestore(&ctx->vblank_lock, flags); | |
| 460 | + | |
| 403 | 461 | if (!(ctx->out_type & IFTYPE_HDMI)) |
| 404 | 462 | return; |
| 405 | 463 | |
| @@ -578,6 +636,24 @@ static const struct component_ops decon_component_ops = { · 172 unmodified lines | ||
| 578 | 636 | .unbind = decon_unbind, |
| 579 | 637 | }; |
| 580 | 638 | |
| 639 | +static void decon_handle_vblank(struct decon_context *ctx) | |
| 640 | +{ | |
| 641 | + u32 frm; | |
| 642 | + | |
| 643 | + spin_lock(&ctx->vblank_lock); | |
| 644 | + | |
| 645 | + frm = decon_get_frame_count(ctx, true); | |
| 646 | + | |
| 647 | + if (frm != ctx->frame_id) { | |
| 648 | + /* handle only if incremented, take care of wrap-around */ | |
| 649 | + if ((s32)(frm - ctx->frame_id) > 0) | |
| 650 | + drm_crtc_handle_vblank(&ctx->crtc->base); | |
| 651 | + ctx->frame_id = frm; | |
| 652 | + } | |
| 653 | + | |
| 654 | + spin_unlock(&ctx->vblank_lock); | |
| 655 | +} | |
| 656 | + | |
| 581 | 657 | static irqreturn_t decon_irq_handler(int irq, void *dev_id) |
| 582 | 658 | { |
| 583 | 659 | struct decon_context *ctx = dev_id; |
| @@ -598,7 +674,7 @@ static irqreturn_t decon_irq_handler(int irq, void *dev_id) · 14 unmodified lines | ||
| 598 | 674 | (VIDOUT_INTERLACE_EN_F | VIDOUT_INTERLACE_FIELD_F)) |
| 599 | 675 | return IRQ_HANDLED; |
| 600 | 676 | } |
| 601 | − drm_crtc_handle_vblank(&ctx->crtc->base); | |
| 677 | + decon_handle_vblank(ctx); | |
| 602 | 678 | } |
| 603 | 679 | |
| 604 | 680 | out: |
| @@ -671,6 +747,7 @@ static int exynos5433_decon_probe(struct platform_device *pdev) · 66 unmodified lines | ||
| 671 | 747 | __set_bit(BIT_SUSPENDED, &ctx->flags); |
| 672 | 748 | ctx->dev = dev; |
| 673 | 749 | ctx->out_type = (unsigned long)of_device_get_match_data(dev); |
| 750 | + spin_lock_init(&ctx->vblank_lock); | |
| 674 | 751 | |
| 675 | 752 | if (ctx->out_type & IFTYPE_HDMI) { |
| 676 | 753 | ctx->first_win = 1; |
| @@ -678,7 +755,7 @@ static int exynos5433_decon_probe(struct platform_device *pdev) · 1 unmodified line | ||
| 678 | 755 | ctx->out_type |= IFTYPE_I80; |
| 679 | 756 | } |
| 680 | 757 | |
| 681 | − if (ctx->out_type | I80_HW_TRG) { | |
| 758 | + if (ctx->out_type & I80_HW_TRG) { | |
| 682 | 759 | ctx->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, |
| 683 | 760 | "samsung,disp-sysreg"); |
| 684 | 761 | if (IS_ERR(ctx->sysreg)) { |
| @@ -526,6 +526,7 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc) · 525 unmodified lines | ||
| 526 | 526 | |
| 527 | 527 | for (i = 0; i < WINDOWS_NR; i++) |
| 528 | 528 | decon_shadow_protect_win(ctx, i, false); |
| 529 | + exynos_crtc_handle_event(crtc); | |
| 529 | 530 | } |
| 530 | 531 | |
| 531 | 532 | static void decon_init(struct decon_context *ctx) |
| @@ -85,16 +85,28 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc, · 84 unmodified lines | ||
| 85 | 85 | struct drm_crtc_state *old_crtc_state) |
| 86 | 86 | { |
| 87 | 87 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
| 88 | − struct drm_pending_vblank_event *event; | |
| 89 | − unsigned long flags; | |
| 90 | 88 | |
| 91 | 89 | if (exynos_crtc->ops->atomic_flush) |
| 92 | 90 | exynos_crtc->ops->atomic_flush(exynos_crtc); |
| 91 | +} | |
| 92 | + | |
| 93 | +static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { | |
| 94 | + .enable = exynos_drm_crtc_enable, | |
| 95 | + .disable = exynos_drm_crtc_disable, | |
| 96 | + .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, | |
| 97 | + .atomic_check = exynos_crtc_atomic_check, | |
| 98 | + .atomic_begin = exynos_crtc_atomic_begin, | |
| 99 | + .atomic_flush = exynos_crtc_atomic_flush, | |
| 100 | +}; | |
| 101 | + | |
| 102 | +void exynos_crtc_handle_event(struct exynos_drm_crtc *exynos_crtc) | |
| 103 | +{ | |
| 104 | + struct drm_crtc *crtc = &exynos_crtc->base; | |
| 105 | + struct drm_pending_vblank_event *event = crtc->state->event; | |
| 106 | + unsigned long flags; | |
| 93 | 107 | |
| 94 | − event = crtc->state->event; | |
| 95 | 108 | if (event) { |
| 96 | 109 | crtc->state->event = NULL; |
| 97 | − | |
| 98 | 110 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
| 99 | 111 | if (drm_crtc_vblank_get(crtc) == 0) |
| 100 | 112 | drm_crtc_arm_vblank_event(crtc, event); |
| @@ -105,15 +117,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc, · 4 unmodified lines | ||
| 105 | 117 | |
| 106 | 118 | } |
| 107 | 119 | |
| 108 | −static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { | |
| 109 | − .enable = exynos_drm_crtc_enable, | |
| 110 | − .disable = exynos_drm_crtc_disable, | |
| 111 | − .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, | |
| 112 | − .atomic_check = exynos_crtc_atomic_check, | |
| 113 | − .atomic_begin = exynos_crtc_atomic_begin, | |
| 114 | − .atomic_flush = exynos_crtc_atomic_flush, | |
| 115 | −}; | |
| 116 | − | |
| 117 | 120 | static void exynos_drm_crtc_destroy(struct drm_crtc *crtc) |
| 118 | 121 | { |
| 119 | 122 | struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); |
| @@ -38,4 +38,6 @@ int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev, · 37 unmodified lines | ||
| 38 | 38 | */ |
| 39 | 39 | void exynos_drm_crtc_te_handler(struct drm_crtc *crtc); |
| 40 | 40 | |
| 41 | +void exynos_crtc_handle_event(struct exynos_drm_crtc *exynos_crtc); | |
| 42 | + | |
| 41 | 43 | #endif |
| @@ -86,7 +86,7 @@ · 85 unmodified lines | ||
| 86 | 86 | #define DSIM_SYNC_INFORM (1 << 27) |
| 87 | 87 | #define DSIM_EOT_DISABLE (1 << 28) |
| 88 | 88 | #define DSIM_MFLUSH_VS (1 << 29) |
| 89 | −/* This flag is valid only for exynos3250/3472/4415/5260/5430 */ | |
| 89 | +/* This flag is valid only for exynos3250/3472/5260/5430 */ | |
| 90 | 90 | #define DSIM_CLKLANE_STOP (1 << 30) |
| 91 | 91 | |
| 92 | 92 | /* DSIM_ESCMODE */ |
| @@ -473,17 +473,6 @@ static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = { · 380 unmodified lines | ||
| 473 | 473 | .reg_values = reg_values, |
| 474 | 474 | }; |
| 475 | 475 | |
| 476 | −static const struct exynos_dsi_driver_data exynos4415_dsi_driver_data = { | |
| 477 | − .reg_ofs = exynos_reg_ofs, | |
| 478 | − .plltmr_reg = 0x58, | |
| 479 | − .has_clklane_stop = 1, | |
| 480 | − .num_clks = 2, | |
| 481 | − .max_freq = 1000, | |
| 482 | − .wait_for_reset = 1, | |
| 483 | − .num_bits_resol = 11, | |
| 484 | − .reg_values = reg_values, | |
| 485 | −}; | |
| 486 | − | |
| 487 | 476 | static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = { |
| 488 | 477 | .reg_ofs = exynos_reg_ofs, |
| 489 | 478 | .plltmr_reg = 0x58, |
| @@ -521,8 +510,6 @@ static const struct of_device_id exynos_dsi_of_match[] = { · 31 unmodified lines | ||
| 521 | 510 | .data = &exynos3_dsi_driver_data }, |
| 522 | 511 | { .compatible = "samsung,exynos4210-mipi-dsi", |
| 523 | 512 | .data = &exynos4_dsi_driver_data }, |
| 524 | − { .compatible = "samsung,exynos4415-mipi-dsi", | |
| 525 | − .data = &exynos4415_dsi_driver_data }, | |
| 526 | 513 | { .compatible = "samsung,exynos5410-mipi-dsi", |
| 527 | 514 | .data = &exynos5_dsi_driver_data }, |
| 528 | 515 | { .compatible = "samsung,exynos5422-mipi-dsi", |
| @@ -979,7 +966,7 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi, · 450 unmodified lines | ||
| 979 | 966 | bool first = !xfer->tx_done; |
| 980 | 967 | u32 reg; |
| 981 | 968 | |
| 982 | − dev_dbg(dev, "< xfer %p: tx len %u, done %u, rx len %u, done %u\n", | |
| 969 | + dev_dbg(dev, "< xfer %pK: tx len %u, done %u, rx len %u, done %u\n", | |
| 983 | 970 | xfer, length, xfer->tx_done, xfer->rx_len, xfer->rx_done); |
| 984 | 971 | |
| 985 | 972 | if (length > DSI_TX_FIFO_SIZE) |
| @@ -1177,7 +1164,7 @@ static bool exynos_dsi_transfer_finish(struct exynos_dsi *dsi) · 191 unmodified lines | ||
| 1177 | 1164 | spin_unlock_irqrestore(&dsi->transfer_lock, flags); |
| 1178 | 1165 | |
| 1179 | 1166 | dev_dbg(dsi->dev, |
| 1180 | − "> xfer %p, tx_len %zu, tx_done %u, rx_len %u, rx_done %u\n", | |
| 1167 | + "> xfer %pK, tx_len %zu, tx_done %u, rx_len %u, rx_done %u\n", | |
| 1181 | 1168 | xfer, xfer->packet.payload_length, xfer->tx_done, xfer->rx_len, |
| 1182 | 1169 | xfer->rx_done); |
| 1183 | 1170 | |
| @@ -1348,9 +1335,12 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi) · 164 unmodified lines | ||
| 1348 | 1335 | int te_gpio_irq; |
| 1349 | 1336 | |
| 1350 | 1337 | dsi->te_gpio = of_get_named_gpio(dsi->panel_node, "te-gpios", 0); |
| 1338 | + if (dsi->te_gpio == -ENOENT) | |
| 1339 | + return 0; | |
| 1340 | + | |
| 1351 | 1341 | if (!gpio_is_valid(dsi->te_gpio)) { |
| 1352 | − dev_err(dsi->dev, "no te-gpios specified\n"); | |
| 1353 | 1342 | ret = dsi->te_gpio; |
| 1343 | + dev_err(dsi->dev, "cannot get te-gpios, %d\n", ret); | |
| 1354 | 1344 | goto out; |
| 1355 | 1345 | } |
| 1356 | 1346 | |
| @@ -1695,7 +1695,7 @@ static int fimc_probe(struct platform_device *pdev) · 1694 unmodified lines | ||
| 1695 | 1695 | goto err_put_clk; |
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | − DRM_DEBUG_KMS("id[%d]ippdrv[%p]\n", ctx->id, ippdrv); | |
| 1698 | + DRM_DEBUG_KMS("id[%d]ippdrv[%pK]\n", ctx->id, ippdrv); | |
| 1699 | 1699 | |
| 1700 | 1700 | spin_lock_init(&ctx->lock); |
| 1701 | 1701 | platform_set_drvdata(pdev, ctx); |
| @@ -71,10 +71,10 @@ · 70 unmodified lines | ||
| 71 | 71 | #define TRIGCON 0x1A4 |
| 72 | 72 | #define TRGMODE_ENABLE (1 << 0) |
| 73 | 73 | #define SWTRGCMD_ENABLE (1 << 1) |
| 74 | −/* Exynos3250, 3472, 4415, 5260 5410, 5420 and 5422 only supported. */ | |
| 74 | +/* Exynos3250, 3472, 5260 5410, 5420 and 5422 only supported. */ | |
| 75 | 75 | #define HWTRGEN_ENABLE (1 << 3) |
| 76 | 76 | #define HWTRGMASK_ENABLE (1 << 4) |
| 77 | −/* Exynos3250, 3472, 4415, 5260, 5420 and 5422 only supported. */ | |
| 77 | +/* Exynos3250, 3472, 5260, 5420 and 5422 only supported. */ | |
| 78 | 78 | #define HWTRIGEN_PER_ENABLE (1 << 31) |
| 79 | 79 | |
| 80 | 80 | /* display mode change control register except exynos4 */ |
| @@ -138,18 +138,6 @@ static struct fimd_driver_data exynos4_fimd_driver_data = { · 57 unmodified lines | ||
| 138 | 138 | .has_vtsel = 1, |
| 139 | 139 | }; |
| 140 | 140 | |
| 141 | −static struct fimd_driver_data exynos4415_fimd_driver_data = { | |
| 142 | − .timing_base = 0x20000, | |
| 143 | − .lcdblk_offset = 0x210, | |
| 144 | − .lcdblk_vt_shift = 10, | |
| 145 | − .lcdblk_bypass_shift = 1, | |
| 146 | − .trg_type = I80_HW_TRG, | |
| 147 | − .has_shadowcon = 1, | |
| 148 | − .has_vidoutcon = 1, | |
| 149 | − .has_vtsel = 1, | |
| 150 | − .has_trigger_per_te = 1, | |
| 151 | −}; | |
| 152 | − | |
| 153 | 141 | static struct fimd_driver_data exynos5_fimd_driver_data = { |
| 154 | 142 | .timing_base = 0x20000, |
| 155 | 143 | .lcdblk_offset = 0x214, |
| @@ -210,8 +198,6 @@ static const struct of_device_id fimd_driver_dt_match[] = { · 54 unmodified lines | ||
| 210 | 198 | .data = &exynos3_fimd_driver_data }, |
| 211 | 199 | { .compatible = "samsung,exynos4210-fimd", |
| 212 | 200 | .data = &exynos4_fimd_driver_data }, |
| 213 | − { .compatible = "samsung,exynos4415-fimd", | |
| 214 | − .data = &exynos4415_fimd_driver_data }, | |
| 215 | 201 | { .compatible = "samsung,exynos5250-fimd", |
| 216 | 202 | .data = &exynos5_fimd_driver_data }, |
| 217 | 203 | { .compatible = "samsung,exynos5420-fimd", |
| @@ -257,7 +243,7 @@ static int fimd_enable_vblank(struct exynos_drm_crtc *crtc) · 39 unmodified lines | ||
| 257 | 243 | val |= VIDINTCON0_INT_FRAME; |
| 258 | 244 | |
| 259 | 245 | val &= ~VIDINTCON0_FRAMESEL0_MASK; |
| 260 | − val |= VIDINTCON0_FRAMESEL0_VSYNC; | |
| 246 | + val |= VIDINTCON0_FRAMESEL0_FRONTPORCH; | |
| 261 | 247 | val &= ~VIDINTCON0_FRAMESEL1_MASK; |
| 262 | 248 | val |= VIDINTCON0_FRAMESEL1_NONE; |
| 263 | 249 | } |
| @@ -723,6 +709,8 @@ static void fimd_atomic_flush(struct exynos_drm_crtc *crtc) · 459 unmodified lines | ||
| 723 | 709 | |
| 724 | 710 | for (i = 0; i < WINDOWS_NR; i++) |
| 725 | 711 | fimd_shadow_protect_win(ctx, i, false); |
| 712 | + | |
| 713 | + exynos_crtc_handle_event(crtc); | |
| 726 | 714 | } |
| 727 | 715 | |
| 728 | 716 | static void fimd_update_plane(struct exynos_drm_crtc *crtc, |
| @@ -218,7 +218,7 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev, · 217 unmodified lines | ||
| 218 | 218 | return ERR_PTR(ret); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | − DRM_DEBUG_KMS("created file object = %p\n", obj->filp); | |
| 221 | + DRM_DEBUG_KMS("created file object = %pK\n", obj->filp); | |
| 222 | 222 | |
| 223 | 223 | return exynos_gem; |
| 224 | 224 | } |
| @@ -1723,7 +1723,7 @@ static int gsc_probe(struct platform_device *pdev) · 1722 unmodified lines | ||
| 1723 | 1723 | return ret; |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | − DRM_DEBUG_KMS("id[%d]ippdrv[%p]\n", ctx->id, ippdrv); | |
| 1726 | + DRM_DEBUG_KMS("id[%d]ippdrv[%pK]\n", ctx->id, ippdrv); | |
| 1727 | 1727 | |
| 1728 | 1728 | mutex_init(&ctx->lock); |
| 1729 | 1729 | platform_set_drvdata(pdev, ctx); |
| @@ -208,7 +208,7 @@ static struct exynos_drm_ippdrv *ipp_find_drv_by_handle(u32 prop_id) · 207 unmodified lines | ||
| 208 | 208 | * e.g PAUSE state, queue buf, command control. |
| 209 | 209 | */ |
| 210 | 210 | list_for_each_entry(ippdrv, &exynos_drm_ippdrv_list, drv_list) { |
| 211 | − DRM_DEBUG_KMS("count[%d]ippdrv[%p]\n", count++, ippdrv); | |
| 211 | + DRM_DEBUG_KMS("count[%d]ippdrv[%pK]\n", count++, ippdrv); | |
| 212 | 212 | |
| 213 | 213 | mutex_lock(&ippdrv->cmd_lock); |
| 214 | 214 | list_for_each_entry(c_node, &ippdrv->cmd_list, list) { |
| @@ -388,7 +388,7 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data, · 173 unmodified lines | ||
| 388 | 388 | } |
| 389 | 389 | property->prop_id = ret; |
| 390 | 390 | |
| 391 | − DRM_DEBUG_KMS("created prop_id[%d]cmd[%d]ippdrv[%p]\n", | |
| 391 | + DRM_DEBUG_KMS("created prop_id[%d]cmd[%d]ippdrv[%pK]\n", | |
| 392 | 392 | property->prop_id, property->cmd, ippdrv); |
| 393 | 393 | |
| 394 | 394 | /* stored property information and ippdrv in private data */ |
| @@ -518,7 +518,7 @@ static int ipp_put_mem_node(struct drm_device *drm_dev, · 123 unmodified lines | ||
| 518 | 518 | { |
| 519 | 519 | int i; |
| 520 | 520 | |
| 521 | − DRM_DEBUG_KMS("node[%p]\n", m_node); | |
| 521 | + DRM_DEBUG_KMS("node[%pK]\n", m_node); | |
| 522 | 522 | |
| 523 | 523 | if (!m_node) { |
| 524 | 524 | DRM_ERROR("invalid dequeue node.\n"); |
| @@ -562,7 +562,7 @@ static struct drm_exynos_ipp_mem_node · 37 unmodified lines | ||
| 562 | 562 | m_node->buf_id = qbuf->buf_id; |
| 563 | 563 | INIT_LIST_HEAD(&m_node->list); |
| 564 | 564 | |
| 565 | − DRM_DEBUG_KMS("m_node[%p]ops_id[%d]\n", m_node, qbuf->ops_id); | |
| 565 | + DRM_DEBUG_KMS("m_node[%pK]ops_id[%d]\n", m_node, qbuf->ops_id); | |
| 566 | 566 | DRM_DEBUG_KMS("prop_id[%d]buf_id[%d]\n", qbuf->prop_id, m_node->buf_id); |
| 567 | 567 | |
| 568 | 568 | for_each_ipp_planar(i) { |
| @@ -659,7 +659,7 @@ static void ipp_put_event(struct drm_exynos_ipp_cmd_node *c_node, · 90 unmodified lines | ||
| 659 | 659 | |
| 660 | 660 | mutex_lock(&c_node->event_lock); |
| 661 | 661 | list_for_each_entry_safe(e, te, &c_node->event_list, base.link) { |
| 662 | − DRM_DEBUG_KMS("count[%d]e[%p]\n", count++, e); | |
| 662 | + DRM_DEBUG_KMS("count[%d]e[%pK]\n", count++, e); | |
| 663 | 663 | |
| 664 | 664 | /* |
| 665 | 665 | * qbuf == NULL condition means all event deletion. |
| @@ -750,7 +750,7 @@ static struct drm_exynos_ipp_mem_node · 84 unmodified lines | ||
| 750 | 750 | |
| 751 | 751 | /* find memory node from memory list */ |
| 752 | 752 | list_for_each_entry(m_node, head, list) { |
| 753 | − DRM_DEBUG_KMS("count[%d]m_node[%p]\n", count++, m_node); | |
| 753 | + DRM_DEBUG_KMS("count[%d]m_node[%pK]\n", count++, m_node); | |
| 754 | 754 | |
| 755 | 755 | /* compare buffer id */ |
| 756 | 756 | if (m_node->buf_id == qbuf->buf_id) |
| @@ -767,7 +767,7 @@ static int ipp_set_mem_node(struct exynos_drm_ippdrv *ippdrv, · 10 unmodified lines | ||
| 767 | 767 | struct exynos_drm_ipp_ops *ops = NULL; |
| 768 | 768 | int ret = 0; |
| 769 | 769 | |
| 770 | − DRM_DEBUG_KMS("node[%p]\n", m_node); | |
| 770 | + DRM_DEBUG_KMS("node[%pK]\n", m_node); | |
| 771 | 771 | |
| 772 | 772 | if (!m_node) { |
| 773 | 773 | DRM_ERROR("invalid queue node.\n"); |
| @@ -1232,7 +1232,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv, · 458 unmodified lines | ||
| 1232 | 1232 | m_node = list_first_entry(head, |
| 1233 | 1233 | struct drm_exynos_ipp_mem_node, list); |
| 1234 | 1234 | |
| 1235 | − DRM_DEBUG_KMS("m_node[%p]\n", m_node); | |
| 1235 | + DRM_DEBUG_KMS("m_node[%pK]\n", m_node); | |
| 1236 | 1236 | |
| 1237 | 1237 | ret = ipp_set_mem_node(ippdrv, c_node, m_node); |
| 1238 | 1238 | if (ret) { |
| @@ -1601,7 +1601,7 @@ static int ipp_subdrv_probe(struct drm_device *drm_dev, struct device *dev) · 362 unmodified lines | ||
| 1601 | 1601 | } |
| 1602 | 1602 | ippdrv->prop_list.ipp_id = ret; |
| 1603 | 1603 | |
| 1604 | − DRM_DEBUG_KMS("count[%d]ippdrv[%p]ipp_id[%d]\n", | |
| 1604 | + DRM_DEBUG_KMS("count[%d]ippdrv[%pK]ipp_id[%d]\n", | |
| 1605 | 1605 | count++, ippdrv, ret); |
| 1606 | 1606 | |
| 1607 | 1607 | /* store parent device for node */ |
| @@ -1659,7 +1659,7 @@ static int ipp_subdrv_open(struct drm_device *drm_dev, struct device *dev, · 51 unmodified lines | ||
| 1659 | 1659 | |
| 1660 | 1660 | file_priv->ipp_dev = dev; |
| 1661 | 1661 | |
| 1662 | − DRM_DEBUG_KMS("done priv[%p]\n", dev); | |
| 1662 | + DRM_DEBUG_KMS("done priv[%pK]\n", dev); | |
| 1663 | 1663 | |
| 1664 | 1664 | return 0; |
| 1665 | 1665 | } |
| @@ -1676,7 +1676,7 @@ static void ipp_subdrv_close(struct drm_device *drm_dev, struct device *dev, · 10 unmodified lines | ||
| 1676 | 1676 | mutex_lock(&ippdrv->cmd_lock); |
| 1677 | 1677 | list_for_each_entry_safe(c_node, tc_node, |
| 1678 | 1678 | &ippdrv->cmd_list, list) { |
| 1679 | − DRM_DEBUG_KMS("count[%d]ippdrv[%p]\n", | |
| 1679 | + DRM_DEBUG_KMS("count[%d]ippdrv[%pK]\n", | |
| 1680 | 1680 | count++, ippdrv); |
| 1681 | 1681 | |
| 1682 | 1682 | if (c_node->filp == file) { |
| @@ -748,7 +748,7 @@ static int rotator_probe(struct platform_device *pdev) · 747 unmodified lines | ||
| 748 | 748 | goto err_ippdrv_register; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | − DRM_DEBUG_KMS("ippdrv[%p]\n", ippdrv); | |
| 751 | + DRM_DEBUG_KMS("ippdrv[%pK]\n", ippdrv); | |
| 752 | 752 | |
| 753 | 753 | platform_set_drvdata(pdev, rot); |
| 754 | 754 | |
| @@ -170,6 +170,7 @@ static const struct exynos_drm_crtc_ops vidi_crtc_ops = { · 169 unmodified lines | ||
| 170 | 170 | .enable_vblank = vidi_enable_vblank, |
| 171 | 171 | .disable_vblank = vidi_disable_vblank, |
| 172 | 172 | .update_plane = vidi_update_plane, |
| 173 | + .atomic_flush = exynos_crtc_handle_event, | |
| 173 | 174 | }; |
| 174 | 175 | |
| 175 | 176 | static void vidi_fake_vblank_timer(unsigned long arg) |
| @@ -1012,6 +1012,7 @@ static void mixer_atomic_flush(struct exynos_drm_crtc *crtc) · 1011 unmodified lines | ||
| 1012 | 1012 | return; |
| 1013 | 1013 | |
| 1014 | 1014 | mixer_vsync_set_update(mixer_ctx, true); |
| 1015 | + exynos_crtc_handle_event(crtc); | |
| 1015 | 1016 | } |
| 1016 | 1017 | |
| 1017 | 1018 | static void mixer_enable(struct exynos_drm_crtc *crtc) |
| @@ -242,7 +242,7 @@ static int alloc_resource(struct intel_vgpu *vgpu, · 241 unmodified lines | ||
| 242 | 242 | const char *item; |
| 243 | 243 | |
| 244 | 244 | if (!param->low_gm_sz || !param->high_gm_sz || !param->fence_sz) { |
| 245 | − gvt_err("Invalid vGPU creation params\n"); | |
| 245 | + gvt_vgpu_err("Invalid vGPU creation params\n"); | |
| 246 | 246 | return -EINVAL; |
| 247 | 247 | } |
| 248 | 248 | |
| @@ -285,9 +285,9 @@ static int alloc_resource(struct intel_vgpu *vgpu, · 36 unmodified lines | ||
| 285 | 285 | return 0; |
| 286 | 286 | |
| 287 | 287 | no_enough_resource: |
| 288 | − gvt_err("vgpu%d: fail to allocate resource %s\n", vgpu->id, item); | |
| 289 | − gvt_err("vgpu%d: request %luMB avail %luMB max %luMB taken %luMB\n", | |
| 290 | − vgpu->id, BYTES_TO_MB(request), BYTES_TO_MB(avail), | |
| 288 | + gvt_vgpu_err("fail to allocate resource %s\n", item); | |
| 289 | + gvt_vgpu_err("request %luMB avail %luMB max %luMB taken %luMB\n", | |
| 290 | + BYTES_TO_MB(request), BYTES_TO_MB(avail), | |
| 291 | 291 | BYTES_TO_MB(max), BYTES_TO_MB(taken)); |
| 292 | 292 | return -ENOSPC; |
| 293 | 293 | } |
| @@ -817,6 +817,25 @@ static bool is_shadowed_mmio(unsigned int offset) · 816 unmodified lines | ||
| 817 | 817 | return ret; |
| 818 | 818 | } |
| 819 | 819 | |
| 820 | +static inline bool is_force_nonpriv_mmio(unsigned int offset) | |
| 821 | +{ | |
| 822 | + return (offset >= 0x24d0 && offset < 0x2500); | |
| 823 | +} | |
| 824 | + | |
| 825 | +static int force_nonpriv_reg_handler(struct parser_exec_state *s, | |
| 826 | + unsigned int offset, unsigned int index) | |
| 827 | +{ | |
| 828 | + struct intel_gvt *gvt = s->vgpu->gvt; | |
| 829 | + unsigned int data = cmd_val(s, index + 1); | |
| 830 | + | |
| 831 | + if (!intel_gvt_in_force_nonpriv_whitelist(gvt, data)) { | |
| 832 | + gvt_err("Unexpected forcenonpriv 0x%x LRI write, value=0x%x\n", | |
| 833 | + offset, data); | |
| 834 | + return -EINVAL; | |
| 835 | + } | |
| 836 | + return 0; | |
| 837 | +} | |
| 838 | + | |
| 820 | 839 | static int cmd_reg_handler(struct parser_exec_state *s, |
| 821 | 840 | unsigned int offset, unsigned int index, char *cmd) |
| 822 | 841 | { |
| @@ -824,23 +843,26 @@ static int cmd_reg_handler(struct parser_exec_state *s, · 1 unmodified line | ||
| 824 | 843 | struct intel_gvt *gvt = vgpu->gvt; |
| 825 | 844 | |
| 826 | 845 | if (offset + 4 > gvt->device_info.mmio_size) { |
| 827 | − gvt_err("%s access to (%x) outside of MMIO range\n", | |
| 846 | + gvt_vgpu_err("%s access to (%x) outside of MMIO range\n", | |
| 828 | 847 | cmd, offset); |
| 829 | 848 | return -EINVAL; |
| 830 | 849 | } |
| 831 | 850 | |
| 832 | 851 | if (!intel_gvt_mmio_is_cmd_access(gvt, offset)) { |
| 833 | − gvt_err("vgpu%d: %s access to non-render register (%x)\n", | |
| 834 | − s->vgpu->id, cmd, offset); | |
| 852 | + gvt_vgpu_err("%s access to non-render register (%x)\n", | |
| 853 | + cmd, offset); | |
| 835 | 854 | return 0; |
| 836 | 855 | } |
| 837 | 856 | |
| 838 | 857 | if (is_shadowed_mmio(offset)) { |
| 839 | − gvt_err("vgpu%d: found access of shadowed MMIO %x\n", | |
| 840 | − s->vgpu->id, offset); | |
| 858 | + gvt_vgpu_err("found access of shadowed MMIO %x\n", offset); | |
| 841 | 859 | return 0; |
| 842 | 860 | } |
| 843 | 861 | |
| 862 | + if (is_force_nonpriv_mmio(offset) && | |
| 863 | + force_nonpriv_reg_handler(s, offset, index)) | |
| 864 | + return -EINVAL; | |
| 865 | + | |
| 844 | 866 | if (offset == i915_mmio_reg_offset(DERRMR) || |
| 845 | 867 | offset == i915_mmio_reg_offset(FORCEWAKE_MT)) { |
| 846 | 868 | /* Writing to HW VGT_PVINFO_PAGE offset will be discarded */ |
| @@ -1008,7 +1030,7 @@ static int cmd_handler_pipe_control(struct parser_exec_state *s) · 161 unmodified lines | ||
| 1008 | 1030 | ret = cmd_reg_handler(s, 0x2358, 1, "pipe_ctrl"); |
| 1009 | 1031 | else if (post_sync == 1) { |
| 1010 | 1032 | /* check ggtt*/ |
| 1011 | − if ((cmd_val(s, 2) & (1 << 2))) { | |
| 1033 | + if ((cmd_val(s, 1) & PIPE_CONTROL_GLOBAL_GTT_IVB)) { | |
| 1012 | 1034 | gma = cmd_val(s, 2) & GENMASK(31, 3); |
| 1013 | 1035 | if (gmadr_bytes == 8) |
| 1014 | 1036 | gma |= (cmd_gma_hi(s, 3)) << 32; |
| @@ -1129,6 +1151,7 @@ static int skl_decode_mi_display_flip(struct parser_exec_state *s, · 114 unmodified lines | ||
| 1129 | 1151 | struct mi_display_flip_command_info *info) |
| 1130 | 1152 | { |
| 1131 | 1153 | struct drm_i915_private *dev_priv = s->vgpu->gvt->dev_priv; |
| 1154 | + struct intel_vgpu *vgpu = s->vgpu; | |
| 1132 | 1155 | u32 dword0 = cmd_val(s, 0); |
| 1133 | 1156 | u32 dword1 = cmd_val(s, 1); |
| 1134 | 1157 | u32 dword2 = cmd_val(s, 2); |
| @@ -1167,7 +1190,7 @@ static int skl_decode_mi_display_flip(struct parser_exec_state *s, · 32 unmodified lines | ||
| 1167 | 1190 | break; |
| 1168 | 1191 | |
| 1169 | 1192 | default: |
| 1170 | − gvt_err("unknown plane code %d\n", plane); | |
| 1193 | + gvt_vgpu_err("unknown plane code %d\n", plane); | |
| 1171 | 1194 | return -EINVAL; |
| 1172 | 1195 | } |
| 1173 | 1196 | |
| @@ -1274,25 +1297,26 @@ static int update_plane_mmio_from_mi_display_flip( · 100 unmodified lines | ||
| 1274 | 1297 | static int cmd_handler_mi_display_flip(struct parser_exec_state *s) |
| 1275 | 1298 | { |
| 1276 | 1299 | struct mi_display_flip_command_info info; |
| 1300 | + struct intel_vgpu *vgpu = s->vgpu; | |
| 1277 | 1301 | int ret; |
| 1278 | 1302 | int i; |
| 1279 | 1303 | int len = cmd_length(s); |
| 1280 | 1304 | |
| 1281 | 1305 | ret = decode_mi_display_flip(s, &info); |
| 1282 | 1306 | if (ret) { |
| 1283 | − gvt_err("fail to decode MI display flip command\n"); | |
| 1307 | + gvt_vgpu_err("fail to decode MI display flip command\n"); | |
| 1284 | 1308 | return ret; |
| 1285 | 1309 | } |
| 1286 | 1310 | |
| 1287 | 1311 | ret = check_mi_display_flip(s, &info); |
| 1288 | 1312 | if (ret) { |
| 1289 | − gvt_err("invalid MI display flip command\n"); | |
| 1313 | + gvt_vgpu_err("invalid MI display flip command\n"); | |
| 1290 | 1314 | return ret; |
| 1291 | 1315 | } |
| 1292 | 1316 | |
| 1293 | 1317 | ret = update_plane_mmio_from_mi_display_flip(s, &info); |
| 1294 | 1318 | if (ret) { |
| 1295 | − gvt_err("fail to update plane mmio\n"); | |
| 1319 | + gvt_vgpu_err("fail to update plane mmio\n"); | |
| 1296 | 1320 | return ret; |
| 1297 | 1321 | } |
| 1298 | 1322 | |
| @@ -1350,7 +1374,8 @@ static inline int cmd_address_audit(struct parser_exec_state *s, · 51 unmodified lines | ||
| 1350 | 1374 | int ret; |
| 1351 | 1375 | |
| 1352 | 1376 | if (op_size > max_surface_size) { |
| 1353 | − gvt_err("command address audit fail name %s\n", s->info->name); | |
| 1377 | + gvt_vgpu_err("command address audit fail name %s\n", | |
| 1378 | + s->info->name); | |
| 1354 | 1379 | return -EINVAL; |
| 1355 | 1380 | } |
| 1356 | 1381 | |
| @@ -1367,7 +1392,7 @@ static inline int cmd_address_audit(struct parser_exec_state *s, · 10 unmodified lines | ||
| 1367 | 1392 | } |
| 1368 | 1393 | return 0; |
| 1369 | 1394 | err: |
| 1370 | − gvt_err("cmd_parser: Malicious %s detected, addr=0x%lx, len=%d!\n", | |
| 1395 | + gvt_vgpu_err("cmd_parser: Malicious %s detected, addr=0x%lx, len=%d!\n", | |
| 1371 | 1396 | s->info->name, guest_gma, op_size); |
| 1372 | 1397 | |
| 1373 | 1398 | pr_err("cmd dump: "); |
| @@ -1412,8 +1437,10 @@ static int cmd_handler_mi_store_data_imm(struct parser_exec_state *s) · 38 unmodified lines | ||
| 1412 | 1437 | |
| 1413 | 1438 | static inline int unexpected_cmd(struct parser_exec_state *s) |
| 1414 | 1439 | { |
| 1415 | − gvt_err("vgpu%d: Unexpected %s in command buffer!\n", | |
| 1416 | − s->vgpu->id, s->info->name); | |
| 1440 | + struct intel_vgpu *vgpu = s->vgpu; | |
| 1441 | + | |
| 1442 | + gvt_vgpu_err("Unexpected %s in command buffer!\n", s->info->name); | |
| 1443 | + | |
| 1417 | 1444 | return -EINVAL; |
| 1418 | 1445 | } |
| 1419 | 1446 | |
| @@ -1516,7 +1543,7 @@ static int copy_gma_to_hva(struct intel_vgpu *vgpu, struct intel_vgpu_mm *mm, · 96 unmodified lines | ||
| 1516 | 1543 | while (gma != end_gma) { |
| 1517 | 1544 | gpa = intel_vgpu_gma_to_gpa(mm, gma); |
| 1518 | 1545 | if (gpa == INTEL_GVT_INVALID_ADDR) { |
| 1519 | − gvt_err("invalid gma address: %lx\n", gma); | |
| 1546 | + gvt_vgpu_err("invalid gma address: %lx\n", gma); | |
| 1520 | 1547 | return -EFAULT; |
| 1521 | 1548 | } |
| 1522 | 1549 | |
| @@ -1557,6 +1584,7 @@ static uint32_t find_bb_size(struct parser_exec_state *s) · 34 unmodified lines | ||
| 1557 | 1584 | uint32_t bb_size = 0; |
| 1558 | 1585 | uint32_t cmd_len = 0; |
| 1559 | 1586 | bool met_bb_end = false; |
| 1587 | + struct intel_vgpu *vgpu = s->vgpu; | |
| 1560 | 1588 | u32 cmd; |
| 1561 | 1589 | |
| 1562 | 1590 | /* get the start gm address of the batch buffer */ |
| @@ -1565,7 +1593,7 @@ static uint32_t find_bb_size(struct parser_exec_state *s) · 2 unmodified lines | ||
| 1565 | 1593 | |
| 1566 | 1594 | info = get_cmd_info(s->vgpu->gvt, cmd, s->ring_id); |
| 1567 | 1595 | if (info == NULL) { |
| 1568 | − gvt_err("unknown cmd 0x%x, opcode=0x%x\n", | |
| 1596 | + gvt_vgpu_err("unknown cmd 0x%x, opcode=0x%x\n", | |
| 1569 | 1597 | cmd, get_opcode(cmd, s->ring_id)); |
| 1570 | 1598 | return -EINVAL; |
| 1571 | 1599 | } |
| @@ -1574,7 +1602,7 @@ static uint32_t find_bb_size(struct parser_exec_state *s) · 2 unmodified lines | ||
| 1574 | 1602 | gma, gma + 4, &cmd); |
| 1575 | 1603 | info = get_cmd_info(s->vgpu->gvt, cmd, s->ring_id); |
| 1576 | 1604 | if (info == NULL) { |
| 1577 | − gvt_err("unknown cmd 0x%x, opcode=0x%x\n", | |
| 1605 | + gvt_vgpu_err("unknown cmd 0x%x, opcode=0x%x\n", | |
| 1578 | 1606 | cmd, get_opcode(cmd, s->ring_id)); |
| 1579 | 1607 | return -EINVAL; |
| 1580 | 1608 | } |
| @@ -1599,6 +1627,7 @@ static uint32_t find_bb_size(struct parser_exec_state *s) · 18 unmodified lines | ||
| 1599 | 1627 | static int perform_bb_shadow(struct parser_exec_state *s) |
| 1600 | 1628 | { |
| 1601 | 1629 | struct intel_shadow_bb_entry *entry_obj; |
| 1630 | + struct intel_vgpu *vgpu = s->vgpu; | |
| 1602 | 1631 | unsigned long gma = 0; |
| 1603 | 1632 | uint32_t bb_size; |
| 1604 | 1633 | void *dst = NULL; |
| @@ -1633,7 +1662,7 @@ static int perform_bb_shadow(struct parser_exec_state *s) · 28 unmodified lines | ||
| 1633 | 1662 | |
| 1634 | 1663 | ret = i915_gem_object_set_to_cpu_domain(entry_obj->obj, false); |
| 1635 | 1664 | if (ret) { |
| 1636 | − gvt_err("failed to set shadow batch to CPU\n"); | |
| 1665 | + gvt_vgpu_err("failed to set shadow batch to CPU\n"); | |
| 1637 | 1666 | goto unmap_src; |
| 1638 | 1667 | } |
| 1639 | 1668 | |
| @@ -1644,8 +1673,8 @@ static int perform_bb_shadow(struct parser_exec_state *s) · 4 unmodified lines | ||
| 1644 | 1673 | ret = copy_gma_to_hva(s->vgpu, s->vgpu->gtt.ggtt_mm, |
| 1645 | 1674 | gma, gma + bb_size, |
| 1646 | 1675 | dst); |
| 1647 | − if (ret < 0) { | |
| 1648 | − gvt_err("fail to copy guest ring buffer\n"); | |
| 1676 | + if (ret) { | |
| 1677 | + gvt_vgpu_err("fail to copy guest ring buffer\n"); | |
| 1649 | 1678 | goto unmap_src; |
| 1650 | 1679 | } |
| 1651 | 1680 | |
| @@ -1676,15 +1705,16 @@ static int cmd_handler_mi_batch_buffer_start(struct parser_exec_state *s) · 24 unmodified lines | ||
| 1676 | 1705 | { |
| 1677 | 1706 | bool second_level; |
| 1678 | 1707 | int ret = 0; |
| 1708 | + struct intel_vgpu *vgpu = s->vgpu; | |
| 1679 | 1709 | |
| 1680 | 1710 | if (s->buf_type == BATCH_BUFFER_2ND_LEVEL) { |
| 1681 | − gvt_err("Found MI_BATCH_BUFFER_START in 2nd level BB\n"); | |
| 1711 | + gvt_vgpu_err("Found MI_BATCH_BUFFER_START in 2nd level BB\n"); | |
| 1682 | 1712 | return -EINVAL; |
| 1683 | 1713 | } |
| 1684 | 1714 | |
| 1685 | 1715 | second_level = BATCH_BUFFER_2ND_LEVEL_BIT(cmd_val(s, 0)) == 1; |
| 1686 | 1716 | if (second_level && (s->buf_type != BATCH_BUFFER_INSTRUCTION)) { |
| 1687 | − gvt_err("Jumping to 2nd level BB from RB is not allowed\n"); | |
| 1717 | + gvt_vgpu_err("Jumping to 2nd level BB from RB is not allowed\n"); | |
| 1688 | 1718 | return -EINVAL; |
| 1689 | 1719 | } |
| 1690 | 1720 | |
| @@ -1702,7 +1732,7 @@ static int cmd_handler_mi_batch_buffer_start(struct parser_exec_state *s) · 11 unmodified lines | ||
| 1702 | 1732 | if (batch_buffer_needs_scan(s)) { |
| 1703 | 1733 | ret = perform_bb_shadow(s); |
| 1704 | 1734 | if (ret < 0) |
| 1705 | − gvt_err("invalid shadow batch buffer\n"); | |
| 1735 | + gvt_vgpu_err("invalid shadow batch buffer\n"); | |
| 1706 | 1736 | } else { |
| 1707 | 1737 | /* emulate a batch buffer end to do return right */ |
| 1708 | 1738 | ret = cmd_handler_mi_batch_buffer_end(s); |
| @@ -2429,6 +2459,7 @@ static int cmd_parser_exec(struct parser_exec_state *s) · 720 unmodified lines | ||
| 2429 | 2459 | int ret = 0; |
| 2430 | 2460 | cycles_t t0, t1, t2; |
| 2431 | 2461 | struct parser_exec_state s_before_advance_custom; |
| 2462 | + struct intel_vgpu *vgpu = s->vgpu; | |
| 2432 | 2463 | |
| 2433 | 2464 | t0 = get_cycles(); |
| 2434 | 2465 | |
| @@ -2436,7 +2467,7 @@ static int cmd_parser_exec(struct parser_exec_state *s) · 1 unmodified line | ||
| 2436 | 2467 | |
| 2437 | 2468 | info = get_cmd_info(s->vgpu->gvt, cmd, s->ring_id); |
| 2438 | 2469 | if (info == NULL) { |
| 2439 | − gvt_err("unknown cmd 0x%x, opcode=0x%x\n", | |
| 2470 | + gvt_vgpu_err("unknown cmd 0x%x, opcode=0x%x\n", | |
| 2440 | 2471 | cmd, get_opcode(cmd, s->ring_id)); |
| 2441 | 2472 | return -EINVAL; |
| 2442 | 2473 | } |
| @@ -2452,7 +2483,7 @@ static int cmd_parser_exec(struct parser_exec_state *s) · 9 unmodified lines | ||
| 2452 | 2483 | if (info->handler) { |
| 2453 | 2484 | ret = info->handler(s); |
| 2454 | 2485 | if (ret < 0) { |
| 2455 | − gvt_err("%s handler error\n", info->name); | |
| 2486 | + gvt_vgpu_err("%s handler error\n", info->name); | |
| 2456 | 2487 | return ret; |
| 2457 | 2488 | } |
| 2458 | 2489 | } |
| @@ -2463,7 +2494,7 @@ static int cmd_parser_exec(struct parser_exec_state *s) · 4 unmodified lines | ||
| 2463 | 2494 | if (!(info->flag & F_IP_ADVANCE_CUSTOM)) { |
| 2464 | 2495 | ret = cmd_advance_default(s); |
| 2465 | 2496 | if (ret) { |
| 2466 | − gvt_err("%s IP advance error\n", info->name); | |
| 2497 | + gvt_vgpu_err("%s IP advance error\n", info->name); | |
| 2467 | 2498 | return ret; |
| 2468 | 2499 | } |
| 2469 | 2500 | } |
| @@ -2486,6 +2517,7 @@ static int command_scan(struct parser_exec_state *s, · 16 unmodified lines | ||
| 2486 | 2517 | |
| 2487 | 2518 | unsigned long gma_head, gma_tail, gma_bottom; |
| 2488 | 2519 | int ret = 0; |
| 2520 | + struct intel_vgpu *vgpu = s->vgpu; | |
| 2489 | 2521 | |
| 2490 | 2522 | gma_head = rb_start + rb_head; |
| 2491 | 2523 | gma_tail = rb_start + rb_tail; |
| @@ -2497,7 +2529,7 @@ static int command_scan(struct parser_exec_state *s, · 5 unmodified lines | ||
| 2497 | 2529 | if (s->buf_type == RING_BUFFER_INSTRUCTION) { |
| 2498 | 2530 | if (!(s->ip_gma >= rb_start) || |
| 2499 | 2531 | !(s->ip_gma < gma_bottom)) { |
| 2500 | − gvt_err("ip_gma %lx out of ring scope." | |
| 2532 | + gvt_vgpu_err("ip_gma %lx out of ring scope." | |
| 2501 | 2533 | "(base:0x%lx, bottom: 0x%lx)\n", |
| 2502 | 2534 | s->ip_gma, rb_start, |
| 2503 | 2535 | gma_bottom); |
| @@ -2505,7 +2537,7 @@ static int command_scan(struct parser_exec_state *s, · 1 unmodified line | ||
| 2505 | 2537 | return -EINVAL; |
| 2506 | 2538 | } |
| 2507 | 2539 | if (gma_out_of_range(s->ip_gma, gma_head, gma_tail)) { |
| 2508 | − gvt_err("ip_gma %lx out of range." | |
| 2540 | + gvt_vgpu_err("ip_gma %lx out of range." | |
| 2509 | 2541 | "base 0x%lx head 0x%lx tail 0x%lx\n", |
| 2510 | 2542 | s->ip_gma, rb_start, |
| 2511 | 2543 | rb_head, rb_tail); |
| @@ -2515,7 +2547,7 @@ static int command_scan(struct parser_exec_state *s, · 3 unmodified lines | ||
| 2515 | 2547 | } |
| 2516 | 2548 | ret = cmd_parser_exec(s); |
| 2517 | 2549 | if (ret) { |
| 2518 | − gvt_err("cmd parser error\n"); | |
| 2550 | + gvt_vgpu_err("cmd parser error\n"); | |
| 2519 | 2551 | parser_exec_state_dump(s); |
| 2520 | 2552 | break; |
| 2521 | 2553 | } |
| @@ -2634,8 +2666,8 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) · 112 unmodified lines | ||
| 2634 | 2666 | if (gma_head > gma_tail) { |
| 2635 | 2667 | ret = copy_gma_to_hva(vgpu, vgpu->gtt.ggtt_mm, |
| 2636 | 2668 | gma_head, gma_top, cs); |
| 2637 | − if (ret < 0) { | |
| 2638 | − gvt_err("fail to copy guest ring buffer\n"); | |
| 2669 | + if (ret) { | |
| 2670 | + gvt_vgpu_err("fail to copy guest ring buffer\n"); | |
| 2639 | 2671 | return ret; |
| 2640 | 2672 | } |
| 2641 | 2673 | cs += ret / sizeof(u32); |
| @@ -2644,8 +2676,8 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) · 2 unmodified lines | ||
| 2644 | 2676 | |
| 2645 | 2677 | /* copy head or start <-> tail */ |
| 2646 | 2678 | ret = copy_gma_to_hva(vgpu, vgpu->gtt.ggtt_mm, gma_head, gma_tail, cs); |
| 2647 | − if (ret < 0) { | |
| 2648 | − gvt_err("fail to copy guest ring buffer\n"); | |
| 2679 | + if (ret) { | |
| 2680 | + gvt_vgpu_err("fail to copy guest ring buffer\n"); | |
| 2649 | 2681 | return ret; |
| 2650 | 2682 | } |
| 2651 | 2683 | cs += ret / sizeof(u32); |
| @@ -2656,16 +2688,17 @@ static int shadow_workload_ring_buffer(struct intel_vgpu_workload *workload) · 4 unmodified lines | ||
| 2656 | 2688 | int intel_gvt_scan_and_shadow_workload(struct intel_vgpu_workload *workload) |
| 2657 | 2689 | { |
| 2658 | 2690 | int ret; |
| 2691 | + struct intel_vgpu *vgpu = workload->vgpu; | |
| 2659 | 2692 | |
| 2660 | 2693 | ret = shadow_workload_ring_buffer(workload); |
| 2661 | 2694 | if (ret) { |
| 2662 | − gvt_err("fail to shadow workload ring_buffer\n"); | |
| 2695 | + gvt_vgpu_err("fail to shadow workload ring_buffer\n"); | |
| 2663 | 2696 | return ret; |
| 2664 | 2697 | } |
| 2665 | 2698 | |
| 2666 | 2699 | ret = scan_workload(workload); |
| 2667 | 2700 | if (ret) { |
| 2668 | − gvt_err("scan workload error\n"); | |
| 2701 | + gvt_vgpu_err("scan workload error\n"); | |
| 2669 | 2702 | return ret; |
| 2670 | 2703 | } |
| 2671 | 2704 | return 0; |
| @@ -2675,6 +2708,7 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 3 unmodified lines | ||
| 2675 | 2708 | { |
| 2676 | 2709 | int ctx_size = wa_ctx->indirect_ctx.size; |
| 2677 | 2710 | unsigned long guest_gma = wa_ctx->indirect_ctx.guest_gma; |
| 2711 | + struct intel_vgpu *vgpu = wa_ctx->workload->vgpu; | |
| 2678 | 2712 | struct drm_i915_gem_object *obj; |
| 2679 | 2713 | int ret = 0; |
| 2680 | 2714 | void *map; |
| @@ -2688,14 +2722,14 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 7 unmodified lines | ||
| 2688 | 2722 | /* get the va of the shadow batch buffer */ |
| 2689 | 2723 | map = i915_gem_object_pin_map(obj, I915_MAP_WB); |
| 2690 | 2724 | if (IS_ERR(map)) { |
| 2691 | − gvt_err("failed to vmap shadow indirect ctx\n"); | |
| 2725 | + gvt_vgpu_err("failed to vmap shadow indirect ctx\n"); | |
| 2692 | 2726 | ret = PTR_ERR(map); |
| 2693 | 2727 | goto put_obj; |
| 2694 | 2728 | } |
| 2695 | 2729 | |
| 2696 | 2730 | ret = i915_gem_object_set_to_cpu_domain(obj, false); |
| 2697 | 2731 | if (ret) { |
| 2698 | − gvt_err("failed to set shadow indirect ctx to CPU\n"); | |
| 2732 | + gvt_vgpu_err("failed to set shadow indirect ctx to CPU\n"); | |
| 2699 | 2733 | goto unmap_src; |
| 2700 | 2734 | } |
| 2701 | 2735 | |
| @@ -2703,8 +2737,8 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 1 unmodified line | ||
| 2703 | 2737 | wa_ctx->workload->vgpu->gtt.ggtt_mm, |
| 2704 | 2738 | guest_gma, guest_gma + ctx_size, |
| 2705 | 2739 | map); |
| 2706 | − if (ret < 0) { | |
| 2707 | − gvt_err("fail to copy guest indirect ctx\n"); | |
| 2740 | + if (ret) { | |
| 2741 | + gvt_vgpu_err("fail to copy guest indirect ctx\n"); | |
| 2708 | 2742 | goto unmap_src; |
| 2709 | 2743 | } |
| 2710 | 2744 | |
| @@ -2738,13 +2772,14 @@ static int combine_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 27 unmodified lines | ||
| 2738 | 2772 | int intel_gvt_scan_and_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) |
| 2739 | 2773 | { |
| 2740 | 2774 | int ret; |
| 2775 | + struct intel_vgpu *vgpu = wa_ctx->workload->vgpu; | |
| 2741 | 2776 | |
| 2742 | 2777 | if (wa_ctx->indirect_ctx.size == 0) |
| 2743 | 2778 | return 0; |
| 2744 | 2779 | |
| 2745 | 2780 | ret = shadow_indirect_ctx(wa_ctx); |
| 2746 | 2781 | if (ret) { |
| 2747 | − gvt_err("fail to shadow indirect ctx\n"); | |
| 2782 | + gvt_vgpu_err("fail to shadow indirect ctx\n"); | |
| 2748 | 2783 | return ret; |
| 2749 | 2784 | } |
| 2750 | 2785 | |
| @@ -2752,7 +2787,7 @@ int intel_gvt_scan_and_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 1 unmodified line | ||
| 2752 | 2787 | |
| 2753 | 2788 | ret = scan_wa_ctx(wa_ctx); |
| 2754 | 2789 | if (ret) { |
| 2755 | − gvt_err("scan wa ctx error\n"); | |
| 2790 | + gvt_vgpu_err("scan wa ctx error\n"); | |
| 2756 | 2791 | return ret; |
| 2757 | 2792 | } |
| 2758 | 2793 | |
| @@ -27,6 +27,14 @@ · 26 unmodified lines | ||
| 27 | 27 | #define gvt_err(fmt, args...) \ |
| 28 | 28 | DRM_ERROR("gvt: "fmt, ##args) |
| 29 | 29 | |
| 30 | +#define gvt_vgpu_err(fmt, args...) \ | |
| 31 | +do { \ | |
| 32 | + if (IS_ERR_OR_NULL(vgpu)) \ | |
| 33 | + DRM_DEBUG_DRIVER("gvt: "fmt, ##args); \ | |
| 34 | + else \ | |
| 35 | + DRM_DEBUG_DRIVER("gvt: vgpu %d: "fmt, vgpu->id, ##args);\ | |
| 36 | +} while (0) | |
| 37 | + | |
| 30 | 38 | #define gvt_dbg_core(fmt, args...) \ |
| 31 | 39 | DRM_DEBUG_DRIVER("gvt: core: "fmt, ##args) |
| 32 | 40 | |
| @@ -52,16 +52,16 @@ static unsigned char edid_get_byte(struct intel_vgpu *vgpu) · 51 unmodified lines | ||
| 52 | 52 | unsigned char chr = 0; |
| 53 | 53 | |
| 54 | 54 | if (edid->state == I2C_NOT_SPECIFIED || !edid->slave_selected) { |
| 55 | − gvt_err("Driver tries to read EDID without proper sequence!\n"); | |
| 55 | + gvt_vgpu_err("Driver tries to read EDID without proper sequence!\n"); | |
| 56 | 56 | return 0; |
| 57 | 57 | } |
| 58 | 58 | if (edid->current_edid_read >= EDID_SIZE) { |
| 59 | − gvt_err("edid_get_byte() exceeds the size of EDID!\n"); | |
| 59 | + gvt_vgpu_err("edid_get_byte() exceeds the size of EDID!\n"); | |
| 60 | 60 | return 0; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if (!edid->edid_available) { |
| 64 | − gvt_err("Reading EDID but EDID is not available!\n"); | |
| 64 | + gvt_vgpu_err("Reading EDID but EDID is not available!\n"); | |
| 65 | 65 | return 0; |
| 66 | 66 | } |
| 67 | 67 | |
| @@ -72,7 +72,7 @@ static unsigned char edid_get_byte(struct intel_vgpu *vgpu) · 4 unmodified lines | ||
| 72 | 72 | chr = edid_data->edid_block[edid->current_edid_read]; |
| 73 | 73 | edid->current_edid_read++; |
| 74 | 74 | } else { |
| 75 | − gvt_err("No EDID available during the reading?\n"); | |
| 75 | + gvt_vgpu_err("No EDID available during the reading?\n"); | |
| 76 | 76 | } |
| 77 | 77 | return chr; |
| 78 | 78 | } |
| @@ -223,7 +223,7 @@ static int gmbus1_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 144 unmodified lines | ||
| 223 | 223 | vgpu_vreg(vgpu, PCH_GMBUS2) |= GMBUS_ACTIVE; |
| 224 | 224 | break; |
| 225 | 225 | default: |
| 226 | − gvt_err("Unknown/reserved GMBUS cycle detected!\n"); | |
| 226 | + gvt_vgpu_err("Unknown/reserved GMBUS cycle detected!\n"); | |
| 227 | 227 | break; |
| 228 | 228 | } |
| 229 | 229 | /* |
| @@ -292,8 +292,7 @@ static int gmbus3_mmio_read(struct intel_vgpu *vgpu, unsigned int offset, · 62 unmodified lines | ||
| 292 | 292 | */ |
| 293 | 293 | } else { |
| 294 | 294 | memcpy(p_data, &vgpu_vreg(vgpu, offset), bytes); |
| 295 | − gvt_err("vgpu%d: warning: gmbus3 read with nothing returned\n", | |
| 296 | − vgpu->id); | |
| 295 | + gvt_vgpu_err("warning: gmbus3 read with nothing returned\n"); | |
| 297 | 296 | } |
| 298 | 297 | return 0; |
| 299 | 298 | } |
| @@ -172,6 +172,7 @@ static int emulate_execlist_ctx_schedule_out( · 171 unmodified lines | ||
| 172 | 172 | struct intel_vgpu_execlist *execlist, |
| 173 | 173 | struct execlist_ctx_descriptor_format *ctx) |
| 174 | 174 | { |
| 175 | + struct intel_vgpu *vgpu = execlist->vgpu; | |
| 175 | 176 | struct intel_vgpu_execlist_slot *running = execlist->running_slot; |
| 176 | 177 | struct intel_vgpu_execlist_slot *pending = execlist->pending_slot; |
| 177 | 178 | struct execlist_ctx_descriptor_format *ctx0 = &running->ctx[0]; |
| @@ -183,7 +184,7 @@ static int emulate_execlist_ctx_schedule_out( · 5 unmodified lines | ||
| 183 | 184 | gvt_dbg_el("schedule out context id %x\n", ctx->context_id); |
| 184 | 185 | |
| 185 | 186 | if (WARN_ON(!same_context(ctx, execlist->running_context))) { |
| 186 | − gvt_err("schedule out context is not running context," | |
| 187 | + gvt_vgpu_err("schedule out context is not running context," | |
| 187 | 188 | "ctx id %x running ctx id %x\n", |
| 188 | 189 | ctx->context_id, |
| 189 | 190 | execlist->running_context->context_id); |
| @@ -254,7 +255,7 @@ static struct intel_vgpu_execlist_slot *get_next_execlist_slot( · 64 unmodified lines | ||
| 254 | 255 | status.udw = vgpu_vreg(vgpu, status_reg + 4); |
| 255 | 256 | |
| 256 | 257 | if (status.execlist_queue_full) { |
| 257 | − gvt_err("virtual execlist slots are full\n"); | |
| 258 | + gvt_vgpu_err("virtual execlist slots are full\n"); | |
| 258 | 259 | return NULL; |
| 259 | 260 | } |
| 260 | 261 | |
| @@ -270,11 +271,12 @@ static int emulate_execlist_schedule_in(struct intel_vgpu_execlist *execlist, · 9 unmodified lines | ||
| 270 | 271 | |
| 271 | 272 | struct execlist_ctx_descriptor_format *ctx0, *ctx1; |
| 272 | 273 | struct execlist_context_status_format status; |
| 274 | + struct intel_vgpu *vgpu = execlist->vgpu; | |
| 273 | 275 | |
| 274 | 276 | gvt_dbg_el("emulate schedule-in\n"); |
| 275 | 277 | |
| 276 | 278 | if (!slot) { |
| 277 | − gvt_err("no available execlist slot\n"); | |
| 279 | + gvt_vgpu_err("no available execlist slot\n"); | |
| 278 | 280 | return -EINVAL; |
| 279 | 281 | } |
| 280 | 282 | |
| @@ -375,7 +377,6 @@ static void prepare_shadow_batch_buffer(struct intel_vgpu_workload *workload) · 94 unmodified lines | ||
| 375 | 377 | |
| 376 | 378 | vma = i915_gem_object_ggtt_pin(entry_obj->obj, NULL, 0, 4, 0); |
| 377 | 379 | if (IS_ERR(vma)) { |
| 378 | − gvt_err("Cannot pin\n"); | |
| 379 | 380 | return; |
| 380 | 381 | } |
| 381 | 382 | |
| @@ -428,7 +429,6 @@ static void prepare_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 46 unmodified lines | ||
| 428 | 429 | vma = i915_gem_object_ggtt_pin(wa_ctx->indirect_ctx.obj, NULL, |
| 429 | 430 | 0, CACHELINE_BYTES, 0); |
| 430 | 431 | if (IS_ERR(vma)) { |
| 431 | − gvt_err("Cannot pin indirect ctx obj\n"); | |
| 432 | 432 | return; |
| 433 | 433 | } |
| 434 | 434 | |
| @@ -561,6 +561,7 @@ static int prepare_mm(struct intel_vgpu_workload *workload) · 126 unmodified lines | ||
| 561 | 561 | { |
| 562 | 562 | struct execlist_ctx_descriptor_format *desc = &workload->ctx_desc; |
| 563 | 563 | struct intel_vgpu_mm *mm; |
| 564 | + struct intel_vgpu *vgpu = workload->vgpu; | |
| 564 | 565 | int page_table_level; |
| 565 | 566 | u32 pdp[8]; |
| 566 | 567 | |
| @@ -569,7 +570,7 @@ static int prepare_mm(struct intel_vgpu_workload *workload) · 2 unmodified lines | ||
| 569 | 570 | } else if (desc->addressing_mode == 3) { /* legacy 64 bit */ |
| 570 | 571 | page_table_level = 4; |
| 571 | 572 | } else { |
| 572 | − gvt_err("Advanced Context mode(SVM) is not supported!\n"); | |
| 573 | + gvt_vgpu_err("Advanced Context mode(SVM) is not supported!\n"); | |
| 573 | 574 | return -EINVAL; |
| 574 | 575 | } |
| 575 | 576 | |
| @@ -583,7 +584,7 @@ static int prepare_mm(struct intel_vgpu_workload *workload) · 7 unmodified lines | ||
| 583 | 584 | mm = intel_vgpu_create_mm(workload->vgpu, INTEL_GVT_MM_PPGTT, |
| 584 | 585 | pdp, page_table_level, 0); |
| 585 | 586 | if (IS_ERR(mm)) { |
| 586 | − gvt_err("fail to create mm object.\n"); | |
| 587 | + gvt_vgpu_err("fail to create mm object.\n"); | |
| 587 | 588 | return PTR_ERR(mm); |
| 588 | 589 | } |
| 589 | 590 | } |
| @@ -609,7 +610,7 @@ static int submit_context(struct intel_vgpu *vgpu, int ring_id, · 19 unmodified lines | ||
| 609 | 610 | ring_context_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, |
| 610 | 611 | (u32)((desc->lrca + 1) << GTT_PAGE_SHIFT)); |
| 611 | 612 | if (ring_context_gpa == INTEL_GVT_INVALID_ADDR) { |
| 612 | − gvt_err("invalid guest context LRCA: %x\n", desc->lrca); | |
| 613 | + gvt_vgpu_err("invalid guest context LRCA: %x\n", desc->lrca); | |
| 613 | 614 | return -EINVAL; |
| 614 | 615 | } |
| 615 | 616 | |
| @@ -724,8 +725,7 @@ int intel_vgpu_submit_execlist(struct intel_vgpu *vgpu, int ring_id) · 108 unmodified lines | ||
| 724 | 725 | continue; |
| 725 | 726 | |
| 726 | 727 | if (!desc[i]->privilege_access) { |
| 727 | − gvt_err("vgpu%d: unexpected GGTT elsp submission\n", | |
| 728 | − vgpu->id); | |
| 728 | + gvt_vgpu_err("unexpected GGTT elsp submission\n"); | |
| 729 | 729 | return -EINVAL; |
| 730 | 730 | } |
| 731 | 731 | |
| @@ -735,15 +735,13 @@ int intel_vgpu_submit_execlist(struct intel_vgpu *vgpu, int ring_id) · 3 unmodified lines | ||
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | if (!valid_desc_bitmap) { |
| 738 | − gvt_err("vgpu%d: no valid desc in a elsp submission\n", | |
| 739 | − vgpu->id); | |
| 738 | + gvt_vgpu_err("no valid desc in a elsp submission\n"); | |
| 740 | 739 | return -EINVAL; |
| 741 | 740 | } |
| 742 | 741 | |
| 743 | 742 | if (!test_bit(0, (void *)&valid_desc_bitmap) && |
| 744 | 743 | test_bit(1, (void *)&valid_desc_bitmap)) { |
| 745 | − gvt_err("vgpu%d: weird elsp submission, desc 0 is not valid\n", | |
| 746 | − vgpu->id); | |
| 744 | + gvt_vgpu_err("weird elsp submission, desc 0 is not valid\n"); | |
| 747 | 745 | return -EINVAL; |
| 748 | 746 | } |
| 749 | 747 | |
| @@ -752,8 +750,7 @@ int intel_vgpu_submit_execlist(struct intel_vgpu *vgpu, int ring_id) · 2 unmodified lines | ||
| 752 | 750 | ret = submit_context(vgpu, ring_id, &valid_desc[i], |
| 753 | 751 | emulate_schedule_in); |
| 754 | 752 | if (ret) { |
| 755 | − gvt_err("vgpu%d: fail to schedule workload\n", | |
| 756 | − vgpu->id); | |
| 753 | + gvt_vgpu_err("fail to schedule workload\n"); | |
| 757 | 754 | return ret; |
| 758 | 755 | } |
| 759 | 756 | emulate_schedule_in = false; |
| @@ -49,8 +49,8 @@ bool intel_gvt_ggtt_validate_range(struct intel_vgpu *vgpu, u64 addr, u32 size) · 48 unmodified lines | ||
| 49 | 49 | { |
| 50 | 50 | if ((!vgpu_gmadr_is_valid(vgpu, addr)) || (size |
| 51 | 51 | && !vgpu_gmadr_is_valid(vgpu, addr + size - 1))) { |
| 52 | − gvt_err("vgpu%d: invalid range gmadr 0x%llx size 0x%x\n", | |
| 53 | − vgpu->id, addr, size); | |
| 52 | + gvt_vgpu_err("invalid range gmadr 0x%llx size 0x%x\n", | |
| 53 | + addr, size); | |
| 54 | 54 | return false; |
| 55 | 55 | } |
| 56 | 56 | return true; |
| @@ -430,7 +430,7 @@ static int gtt_entry_p2m(struct intel_vgpu *vgpu, struct intel_gvt_gtt_entry *p, · 373 unmodified lines | ||
| 430 | 430 | |
| 431 | 431 | mfn = intel_gvt_hypervisor_gfn_to_mfn(vgpu, gfn); |
| 432 | 432 | if (mfn == INTEL_GVT_INVALID_ADDR) { |
| 433 | − gvt_err("fail to translate gfn: 0x%lx\n", gfn); | |
| 433 | + gvt_vgpu_err("fail to translate gfn: 0x%lx\n", gfn); | |
| 434 | 434 | return -ENXIO; |
| 435 | 435 | } |
| 436 | 436 | |
| @@ -611,7 +611,7 @@ static inline int init_shadow_page(struct intel_vgpu *vgpu, · 174 unmodified lines | ||
| 611 | 611 | |
| 612 | 612 | daddr = dma_map_page(kdev, p->page, 0, 4096, PCI_DMA_BIDIRECTIONAL); |
| 613 | 613 | if (dma_mapping_error(kdev, daddr)) { |
| 614 | − gvt_err("fail to map dma addr\n"); | |
| 614 | + gvt_vgpu_err("fail to map dma addr\n"); | |
| 615 | 615 | return -EINVAL; |
| 616 | 616 | } |
| 617 | 617 | |
| @@ -735,7 +735,7 @@ retry: · 117 unmodified lines | ||
| 735 | 735 | if (reclaim_one_mm(vgpu->gvt)) |
| 736 | 736 | goto retry; |
| 737 | 737 | |
| 738 | − gvt_err("fail to allocate ppgtt shadow page\n"); | |
| 738 | + gvt_vgpu_err("fail to allocate ppgtt shadow page\n"); | |
| 739 | 739 | return ERR_PTR(-ENOMEM); |
| 740 | 740 | } |
| 741 | 741 | |
| @@ -750,14 +750,14 @@ retry: · 8 unmodified lines | ||
| 750 | 750 | */ |
| 751 | 751 | ret = init_shadow_page(vgpu, &spt->shadow_page, type); |
| 752 | 752 | if (ret) { |
| 753 | − gvt_err("fail to initialize shadow page for spt\n"); | |
| 753 | + gvt_vgpu_err("fail to initialize shadow page for spt\n"); | |
| 754 | 754 | goto err; |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | ret = intel_vgpu_init_guest_page(vgpu, &spt->guest_page, |
| 758 | 758 | gfn, ppgtt_write_protection_handler, NULL); |
| 759 | 759 | if (ret) { |
| 760 | − gvt_err("fail to initialize guest page for spt\n"); | |
| 760 | + gvt_vgpu_err("fail to initialize guest page for spt\n"); | |
| 761 | 761 | goto err; |
| 762 | 762 | } |
| 763 | 763 | |
| @@ -776,8 +776,7 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_find_shadow_page( · 12 unmodified lines | ||
| 776 | 776 | if (p) |
| 777 | 777 | return shadow_page_to_ppgtt_spt(p); |
| 778 | 778 | |
| 779 | − gvt_err("vgpu%d: fail to find ppgtt shadow page: 0x%lx\n", | |
| 780 | − vgpu->id, mfn); | |
| 779 | + gvt_vgpu_err("fail to find ppgtt shadow page: 0x%lx\n", mfn); | |
| 781 | 780 | return NULL; |
| 782 | 781 | } |
| 783 | 782 | |
| @@ -827,8 +826,8 @@ static int ppgtt_invalidate_shadow_page_by_shadow_entry(struct intel_vgpu *vgpu, · 43 unmodified lines | ||
| 827 | 826 | } |
| 828 | 827 | s = ppgtt_find_shadow_page(vgpu, ops->get_pfn(e)); |
| 829 | 828 | if (!s) { |
| 830 | − gvt_err("vgpu%d: fail to find shadow page: mfn: 0x%lx\n", | |
| 831 | − vgpu->id, ops->get_pfn(e)); | |
| 829 | + gvt_vgpu_err("fail to find shadow page: mfn: 0x%lx\n", | |
| 830 | + ops->get_pfn(e)); | |
| 832 | 831 | return -ENXIO; |
| 833 | 832 | } |
| 834 | 833 | return ppgtt_invalidate_shadow_page(s); |
| @@ -836,6 +835,7 @@ static int ppgtt_invalidate_shadow_page_by_shadow_entry(struct intel_vgpu *vgpu, · 1 unmodified line | ||
| 836 | 835 | |
| 837 | 836 | static int ppgtt_invalidate_shadow_page(struct intel_vgpu_ppgtt_spt *spt) |
| 838 | 837 | { |
| 838 | + struct intel_vgpu *vgpu = spt->vgpu; | |
| 839 | 839 | struct intel_gvt_gtt_entry e; |
| 840 | 840 | unsigned long index; |
| 841 | 841 | int ret; |
| @@ -854,7 +854,7 @@ static int ppgtt_invalidate_shadow_page(struct intel_vgpu_ppgtt_spt *spt) · 12 unmodified lines | ||
| 854 | 854 | |
| 855 | 855 | for_each_present_shadow_entry(spt, &e, index) { |
| 856 | 856 | if (!gtt_type_is_pt(get_next_pt_type(e.type))) { |
| 857 | − gvt_err("GVT doesn't support pse bit for now\n"); | |
| 857 | + gvt_vgpu_err("GVT doesn't support pse bit for now\n"); | |
| 858 | 858 | return -EINVAL; |
| 859 | 859 | } |
| 860 | 860 | ret = ppgtt_invalidate_shadow_page_by_shadow_entry( |
| @@ -868,8 +868,8 @@ release: · 7 unmodified lines | ||
| 868 | 868 | ppgtt_free_shadow_page(spt); |
| 869 | 869 | return 0; |
| 870 | 870 | fail: |
| 871 | − gvt_err("vgpu%d: fail: shadow page %p shadow entry 0x%llx type %d\n", | |
| 872 | − spt->vgpu->id, spt, e.val64, e.type); | |
| 871 | + gvt_vgpu_err("fail: shadow page %p shadow entry 0x%llx type %d\n", | |
| 872 | + spt, e.val64, e.type); | |
| 873 | 873 | return ret; |
| 874 | 874 | } |
| 875 | 875 | |
| @@ -914,8 +914,8 @@ static struct intel_vgpu_ppgtt_spt *ppgtt_populate_shadow_page_by_guest_entry( · 38 unmodified lines | ||
| 914 | 914 | } |
| 915 | 915 | return s; |
| 916 | 916 | fail: |
| 917 | − gvt_err("vgpu%d: fail: shadow page %p guest entry 0x%llx type %d\n", | |
| 918 | − vgpu->id, s, we->val64, we->type); | |
| 917 | + gvt_vgpu_err("fail: shadow page %p guest entry 0x%llx type %d\n", | |
| 918 | + s, we->val64, we->type); | |
| 919 | 919 | return ERR_PTR(ret); |
| 920 | 920 | } |
| 921 | 921 | |
| @@ -953,7 +953,7 @@ static int ppgtt_populate_shadow_page(struct intel_vgpu_ppgtt_spt *spt) · 31 unmodified lines | ||
| 953 | 953 | |
| 954 | 954 | for_each_present_guest_entry(spt, &ge, i) { |
| 955 | 955 | if (!gtt_type_is_pt(get_next_pt_type(ge.type))) { |
| 956 | − gvt_err("GVT doesn't support pse bit now\n"); | |
| 956 | + gvt_vgpu_err("GVT doesn't support pse bit now\n"); | |
| 957 | 957 | ret = -EINVAL; |
| 958 | 958 | goto fail; |
| 959 | 959 | } |
| @@ -969,8 +969,8 @@ static int ppgtt_populate_shadow_page(struct intel_vgpu_ppgtt_spt *spt) · 9 unmodified lines | ||
| 969 | 969 | } |
| 970 | 970 | return 0; |
| 971 | 971 | fail: |
| 972 | − gvt_err("vgpu%d: fail: shadow page %p guest entry 0x%llx type %d\n", | |
| 973 | − vgpu->id, spt, ge.val64, ge.type); | |
| 972 | + gvt_vgpu_err("fail: shadow page %p guest entry 0x%llx type %d\n", | |
| 973 | + spt, ge.val64, ge.type); | |
| 974 | 974 | return ret; |
| 975 | 975 | } |
| 976 | 976 | |
| @@ -999,7 +999,7 @@ static int ppgtt_handle_guest_entry_removal(struct intel_vgpu_guest_page *gpt, · 22 unmodified lines | ||
| 999 | 999 | struct intel_vgpu_ppgtt_spt *s = |
| 1000 | 1000 | ppgtt_find_shadow_page(vgpu, ops->get_pfn(&e)); |
| 1001 | 1001 | if (!s) { |
| 1002 | − gvt_err("fail to find guest page\n"); | |
| 1002 | + gvt_vgpu_err("fail to find guest page\n"); | |
| 1003 | 1003 | ret = -ENXIO; |
| 1004 | 1004 | goto fail; |
| 1005 | 1005 | } |
| @@ -1011,8 +1011,8 @@ static int ppgtt_handle_guest_entry_removal(struct intel_vgpu_guest_page *gpt, · 5 unmodified lines | ||
| 1011 | 1011 | ppgtt_set_shadow_entry(spt, &e, index); |
| 1012 | 1012 | return 0; |
| 1013 | 1013 | fail: |
| 1014 | − gvt_err("vgpu%d: fail: shadow page %p guest entry 0x%llx type %d\n", | |
| 1015 | − vgpu->id, spt, e.val64, e.type); | |
| 1014 | + gvt_vgpu_err("fail: shadow page %p guest entry 0x%llx type %d\n", | |
| 1015 | + spt, e.val64, e.type); | |
| 1016 | 1016 | return ret; |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| @@ -1046,8 +1046,8 @@ static int ppgtt_handle_guest_entry_add(struct intel_vgpu_guest_page *gpt, · 27 unmodified lines | ||
| 1046 | 1046 | } |
| 1047 | 1047 | return 0; |
| 1048 | 1048 | fail: |
| 1049 | − gvt_err("vgpu%d: fail: spt %p guest entry 0x%llx type %d\n", vgpu->id, | |
| 1050 | − spt, we->val64, we->type); | |
| 1049 | + gvt_vgpu_err("fail: spt %p guest entry 0x%llx type %d\n", | |
| 1050 | + spt, we->val64, we->type); | |
| 1051 | 1051 | return ret; |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| @@ -1250,8 +1250,8 @@ static int ppgtt_handle_guest_write_page_table( · 196 unmodified lines | ||
| 1250 | 1250 | } |
| 1251 | 1251 | return 0; |
| 1252 | 1252 | fail: |
| 1253 | − gvt_err("vgpu%d: fail: shadow page %p guest entry 0x%llx type %d.\n", | |
| 1254 | − vgpu->id, spt, we->val64, we->type); | |
| 1253 | + gvt_vgpu_err("fail: shadow page %p guest entry 0x%llx type %d.\n", | |
| 1254 | + spt, we->val64, we->type); | |
| 1255 | 1255 | return ret; |
| 1256 | 1256 | } |
| 1257 | 1257 | |
| @@ -1493,7 +1493,7 @@ static int shadow_mm(struct intel_vgpu_mm *mm) · 235 unmodified lines | ||
| 1493 | 1493 | |
| 1494 | 1494 | spt = ppgtt_populate_shadow_page_by_guest_entry(vgpu, &ge); |
| 1495 | 1495 | if (IS_ERR(spt)) { |
| 1496 | − gvt_err("fail to populate guest root pointer\n"); | |
| 1496 | + gvt_vgpu_err("fail to populate guest root pointer\n"); | |
| 1497 | 1497 | ret = PTR_ERR(spt); |
| 1498 | 1498 | goto fail; |
| 1499 | 1499 | } |
| @@ -1566,7 +1566,7 @@ struct intel_vgpu_mm *intel_vgpu_create_mm(struct intel_vgpu *vgpu, · 66 unmodified lines | ||
| 1566 | 1566 | |
| 1567 | 1567 | ret = gtt->mm_alloc_page_table(mm); |
| 1568 | 1568 | if (ret) { |
| 1569 | − gvt_err("fail to allocate page table for mm\n"); | |
| 1569 | + gvt_vgpu_err("fail to allocate page table for mm\n"); | |
| 1570 | 1570 | goto fail; |
| 1571 | 1571 | } |
| 1572 | 1572 | |
| @@ -1584,7 +1584,7 @@ struct intel_vgpu_mm *intel_vgpu_create_mm(struct intel_vgpu *vgpu, · 11 unmodified lines | ||
| 1584 | 1584 | } |
| 1585 | 1585 | return mm; |
| 1586 | 1586 | fail: |
| 1587 | − gvt_err("fail to create mm\n"); | |
| 1587 | + gvt_vgpu_err("fail to create mm\n"); | |
| 1588 | 1588 | if (mm) |
| 1589 | 1589 | intel_gvt_mm_unreference(mm); |
| 1590 | 1590 | return ERR_PTR(ret); |
| @@ -1760,7 +1760,7 @@ unsigned long intel_vgpu_gma_to_gpa(struct intel_vgpu_mm *mm, unsigned long gma) · 169 unmodified lines | ||
| 1760 | 1760 | mm->page_table_level, gma, gpa); |
| 1761 | 1761 | return gpa; |
| 1762 | 1762 | err: |
| 1763 | − gvt_err("invalid mm type: %d gma %lx\n", mm->type, gma); | |
| 1763 | + gvt_vgpu_err("invalid mm type: %d gma %lx\n", mm->type, gma); | |
| 1764 | 1764 | return INTEL_GVT_INVALID_ADDR; |
| 1765 | 1765 | } |
| 1766 | 1766 | |
| @@ -1836,8 +1836,7 @@ static int emulate_gtt_mmio_write(struct intel_vgpu *vgpu, unsigned int off, · 69 unmodified lines | ||
| 1836 | 1836 | if (ops->test_present(&e)) { |
| 1837 | 1837 | ret = gtt_entry_p2m(vgpu, &e, &m); |
| 1838 | 1838 | if (ret) { |
| 1839 | − gvt_err("vgpu%d: fail to translate guest gtt entry\n", | |
| 1840 | − vgpu->id); | |
| 1839 | + gvt_vgpu_err("fail to translate guest gtt entry\n"); | |
| 1841 | 1840 | return ret; |
| 1842 | 1841 | } |
| 1843 | 1842 | } else { |
| @@ -1893,14 +1892,14 @@ static int alloc_scratch_pages(struct intel_vgpu *vgpu, · 49 unmodified lines | ||
| 1893 | 1892 | |
| 1894 | 1893 | scratch_pt = (void *)get_zeroed_page(GFP_KERNEL); |
| 1895 | 1894 | if (!scratch_pt) { |
| 1896 | − gvt_err("fail to allocate scratch page\n"); | |
| 1895 | + gvt_vgpu_err("fail to allocate scratch page\n"); | |
| 1897 | 1896 | return -ENOMEM; |
| 1898 | 1897 | } |
| 1899 | 1898 | |
| 1900 | 1899 | daddr = dma_map_page(dev, virt_to_page(scratch_pt), 0, |
| 1901 | 1900 | 4096, PCI_DMA_BIDIRECTIONAL); |
| 1902 | 1901 | if (dma_mapping_error(dev, daddr)) { |
| 1903 | − gvt_err("fail to dmamap scratch_pt\n"); | |
| 1902 | + gvt_vgpu_err("fail to dmamap scratch_pt\n"); | |
| 1904 | 1903 | __free_page(virt_to_page(scratch_pt)); |
| 1905 | 1904 | return -ENOMEM; |
| 1906 | 1905 | } |
| @@ -2003,7 +2002,7 @@ int intel_vgpu_init_gtt(struct intel_vgpu *vgpu) · 96 unmodified lines | ||
| 2003 | 2002 | ggtt_mm = intel_vgpu_create_mm(vgpu, INTEL_GVT_MM_GGTT, |
| 2004 | 2003 | NULL, 1, 0); |
| 2005 | 2004 | if (IS_ERR(ggtt_mm)) { |
| 2006 | − gvt_err("fail to create mm for ggtt.\n"); | |
| 2005 | + gvt_vgpu_err("fail to create mm for ggtt.\n"); | |
| 2007 | 2006 | return PTR_ERR(ggtt_mm); |
| 2008 | 2007 | } |
| 2009 | 2008 | |
| @@ -2076,7 +2075,6 @@ static int setup_spt_oos(struct intel_gvt *gvt) · 66 unmodified lines | ||
| 2076 | 2075 | for (i = 0; i < preallocated_oos_pages; i++) { |
| 2077 | 2076 | oos_page = kzalloc(sizeof(*oos_page), GFP_KERNEL); |
| 2078 | 2077 | if (!oos_page) { |
| 2079 | − gvt_err("fail to pre-allocate oos page\n"); | |
| 2080 | 2078 | ret = -ENOMEM; |
| 2081 | 2079 | goto fail; |
| 2082 | 2080 | } |
| @@ -2166,7 +2164,7 @@ int intel_vgpu_g2v_create_ppgtt_mm(struct intel_vgpu *vgpu, · 83 unmodified lines | ||
| 2166 | 2164 | mm = intel_vgpu_create_mm(vgpu, INTEL_GVT_MM_PPGTT, |
| 2167 | 2165 | pdp, page_table_level, 0); |
| 2168 | 2166 | if (IS_ERR(mm)) { |
| 2169 | − gvt_err("fail to create mm\n"); | |
| 2167 | + gvt_vgpu_err("fail to create mm\n"); | |
| 2170 | 2168 | return PTR_ERR(mm); |
| 2171 | 2169 | } |
| 2172 | 2170 | } |
| @@ -2196,7 +2194,7 @@ int intel_vgpu_g2v_destroy_ppgtt_mm(struct intel_vgpu *vgpu, · 23 unmodified lines | ||
| 2196 | 2194 | |
| 2197 | 2195 | mm = intel_vgpu_find_ppgtt_mm(vgpu, page_table_level, pdp); |
| 2198 | 2196 | if (!mm) { |
| 2199 | − gvt_err("fail to find ppgtt instance.\n"); | |
| 2197 | + gvt_vgpu_err("fail to find ppgtt instance.\n"); | |
| 2200 | 2198 | return -EINVAL; |
| 2201 | 2199 | } |
| 2202 | 2200 | intel_gvt_mm_unreference(mm); |
| @@ -181,11 +181,9 @@ static int sanitize_fence_mmio_access(struct intel_vgpu *vgpu, · 180 unmodified lines | ||
| 181 | 181 | GVT_FAILSAFE_UNSUPPORTED_GUEST); |
| 182 | 182 | |
| 183 | 183 | if (!vgpu->mmio.disable_warn_untrack) { |
| 184 | − gvt_err("vgpu%d: found oob fence register access\n", | |
| 185 | − vgpu->id); | |
| 186 | − gvt_err("vgpu%d: total fence %d, access fence %d\n", | |
| 187 | − vgpu->id, vgpu_fence_sz(vgpu), | |
| 188 | − fence_num); | |
| 184 | + gvt_vgpu_err("found oob fence register access\n"); | |
| 185 | + gvt_vgpu_err("total fence %d, access fence %d\n", | |
| 186 | + vgpu_fence_sz(vgpu), fence_num); | |
| 189 | 187 | } |
| 190 | 188 | memset(p_data, 0, bytes); |
| 191 | 189 | return -EINVAL; |
| @@ -249,7 +247,7 @@ static int mul_force_wake_write(struct intel_vgpu *vgpu, · 57 unmodified lines | ||
| 249 | 247 | break; |
| 250 | 248 | default: |
| 251 | 249 | /*should not hit here*/ |
| 252 | − gvt_err("invalid forcewake offset 0x%x\n", offset); | |
| 250 | + gvt_vgpu_err("invalid forcewake offset 0x%x\n", offset); | |
| 253 | 251 | return -EINVAL; |
| 254 | 252 | } |
| 255 | 253 | } else { |
| @@ -530,7 +528,7 @@ static int check_fdi_rx_train_status(struct intel_vgpu *vgpu, · 274 unmodified lines | ||
| 530 | 528 | fdi_tx_train_bits = FDI_LINK_TRAIN_PATTERN_2; |
| 531 | 529 | fdi_iir_check_bits = FDI_RX_SYMBOL_LOCK; |
| 532 | 530 | } else { |
| 533 | − gvt_err("Invalid train pattern %d\n", train_pattern); | |
| 531 | + gvt_vgpu_err("Invalid train pattern %d\n", train_pattern); | |
| 534 | 532 | return -EINVAL; |
| 535 | 533 | } |
| 536 | 534 | |
| @@ -588,7 +586,7 @@ static int update_fdi_rx_iir_status(struct intel_vgpu *vgpu, · 51 unmodified lines | ||
| 588 | 586 | else if (FDI_RX_IMR_TO_PIPE(offset) != INVALID_INDEX) |
| 589 | 587 | index = FDI_RX_IMR_TO_PIPE(offset); |
| 590 | 588 | else { |
| 591 | − gvt_err("Unsupport registers %x\n", offset); | |
| 589 | + gvt_vgpu_err("Unsupport registers %x\n", offset); | |
| 592 | 590 | return -EINVAL; |
| 593 | 591 | } |
| 594 | 592 | |
| @@ -818,7 +816,7 @@ static int dp_aux_ch_ctl_mmio_write(struct intel_vgpu *vgpu, · 223 unmodified lines | ||
| 818 | 816 | u32 data; |
| 819 | 817 | |
| 820 | 818 | if (!dpy_is_valid_port(port_index)) { |
| 821 | − gvt_err("GVT(%d): Unsupported DP port access!\n", vgpu->id); | |
| 819 | + gvt_vgpu_err("Unsupported DP port access!\n"); | |
| 822 | 820 | return 0; |
| 823 | 821 | } |
| 824 | 822 | |
| @@ -1016,8 +1014,7 @@ static void write_virtual_sbi_register(struct intel_vgpu *vgpu, · 191 unmodified lines | ||
| 1016 | 1014 | |
| 1017 | 1015 | if (i == num) { |
| 1018 | 1016 | if (num == SBI_REG_MAX) { |
| 1019 | − gvt_err("vgpu%d: SBI caching meets maximum limits\n", | |
| 1020 | − vgpu->id); | |
| 1017 | + gvt_vgpu_err("SBI caching meets maximum limits\n"); | |
| 1021 | 1018 | return; |
| 1022 | 1019 | } |
| 1023 | 1020 | display->sbi.number++; |
| @@ -1097,7 +1094,7 @@ static int pvinfo_mmio_read(struct intel_vgpu *vgpu, unsigned int offset, · 73 unmodified lines | ||
| 1097 | 1094 | break; |
| 1098 | 1095 | } |
| 1099 | 1096 | if (invalid_read) |
| 1100 | − gvt_err("invalid pvinfo read: [%x:%x] = %x\n", | |
| 1097 | + gvt_vgpu_err("invalid pvinfo read: [%x:%x] = %x\n", | |
| 1101 | 1098 | offset, bytes, *(u32 *)p_data); |
| 1102 | 1099 | vgpu->pv_notified = true; |
| 1103 | 1100 | return 0; |
| @@ -1125,7 +1122,7 @@ static int handle_g2v_notification(struct intel_vgpu *vgpu, int notification) · 21 unmodified lines | ||
| 1125 | 1122 | case 1: /* Remove this in guest driver. */ |
| 1126 | 1123 | break; |
| 1127 | 1124 | default: |
| 1128 | − gvt_err("Invalid PV notification %d\n", notification); | |
| 1125 | + gvt_vgpu_err("Invalid PV notification %d\n", notification); | |
| 1129 | 1126 | } |
| 1130 | 1127 | return ret; |
| 1131 | 1128 | } |
| @@ -1181,7 +1178,7 @@ static int pvinfo_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 49 unmodified lines | ||
| 1181 | 1178 | enter_failsafe_mode(vgpu, GVT_FAILSAFE_INSUFFICIENT_RESOURCE); |
| 1182 | 1179 | break; |
| 1183 | 1180 | default: |
| 1184 | − gvt_err("invalid pvinfo write offset %x bytes %x data %x\n", | |
| 1181 | + gvt_vgpu_err("invalid pvinfo write offset %x bytes %x data %x\n", | |
| 1185 | 1182 | offset, bytes, data); |
| 1186 | 1183 | break; |
| 1187 | 1184 | } |
| @@ -1415,7 +1412,8 @@ static int elsp_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 227 unmodified lines | ||
| 1415 | 1412 | if (execlist->elsp_dwords.index == 3) { |
| 1416 | 1413 | ret = intel_vgpu_submit_execlist(vgpu, ring_id); |
| 1417 | 1414 | if(ret) |
| 1418 | − gvt_err("fail submit workload on ring %d\n", ring_id); | |
| 1415 | + gvt_vgpu_err("fail submit workload on ring %d\n", | |
| 1416 | + ring_id); | |
| 1419 | 1417 | } |
| 1420 | 1418 | |
| 1421 | 1419 | ++execlist->elsp_dwords.index; |
| @@ -2988,3 +2986,20 @@ int intel_vgpu_default_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, · 1566 unmodified lines | ||
| 2988 | 2986 | write_vreg(vgpu, offset, p_data, bytes); |
| 2989 | 2987 | return 0; |
| 2990 | 2988 | } |
| 2989 | + | |
| 2990 | +/** | |
| 2991 | + * intel_gvt_in_force_nonpriv_whitelist - if a mmio is in whitelist to be | |
| 2992 | + * force-nopriv register | |
| 2993 | + * | |
| 2994 | + * @gvt: a GVT device | |
| 2995 | + * @offset: register offset | |
| 2996 | + * | |
| 2997 | + * Returns: | |
| 2998 | + * True if the register is in force-nonpriv whitelist; | |
| 2999 | + * False if outside; | |
| 3000 | + */ | |
| 3001 | +bool intel_gvt_in_force_nonpriv_whitelist(struct intel_gvt *gvt, | |
| 3002 | + unsigned int offset) | |
| 3003 | +{ | |
| 3004 | + return in_whitelist(offset); | |
| 3005 | +} | |
| @@ -426,7 +426,7 @@ static void kvmgt_protect_table_del(struct kvmgt_guest_info *info, · 425 unmodified lines | ||
| 426 | 426 | |
| 427 | 427 | static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) |
| 428 | 428 | { |
| 429 | − struct intel_vgpu *vgpu; | |
| 429 | + struct intel_vgpu *vgpu = NULL; | |
| 430 | 430 | struct intel_vgpu_type *type; |
| 431 | 431 | struct device *pdev; |
| 432 | 432 | void *gvt; |
| @@ -437,7 +437,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) · 4 unmodified lines | ||
| 437 | 437 | |
| 438 | 438 | type = intel_gvt_find_vgpu_type(gvt, kobject_name(kobj)); |
| 439 | 439 | if (!type) { |
| 440 | − gvt_err("failed to find type %s to create\n", | |
| 440 | + gvt_vgpu_err("failed to find type %s to create\n", | |
| 441 | 441 | kobject_name(kobj)); |
| 442 | 442 | ret = -EINVAL; |
| 443 | 443 | goto out; |
| @@ -446,7 +446,7 @@ static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) · 2 unmodified lines | ||
| 446 | 446 | vgpu = intel_gvt_ops->vgpu_create(gvt, type); |
| 447 | 447 | if (IS_ERR_OR_NULL(vgpu)) { |
| 448 | 448 | ret = vgpu == NULL ? -EFAULT : PTR_ERR(vgpu); |
| 449 | − gvt_err("failed to create intel vgpu: %d\n", ret); | |
| 449 | + gvt_vgpu_err("failed to create intel vgpu: %d\n", ret); | |
| 450 | 450 | goto out; |
| 451 | 451 | } |
| 452 | 452 | |
| @@ -526,7 +526,8 @@ static int intel_vgpu_open(struct mdev_device *mdev) · 73 unmodified lines | ||
| 526 | 526 | ret = vfio_register_notifier(mdev_dev(mdev), VFIO_IOMMU_NOTIFY, &events, |
| 527 | 527 | &vgpu->vdev.iommu_notifier); |
| 528 | 528 | if (ret != 0) { |
| 529 | − gvt_err("vfio_register_notifier for iommu failed: %d\n", ret); | |
| 529 | + gvt_vgpu_err("vfio_register_notifier for iommu failed: %d\n", | |
| 530 | + ret); | |
| 530 | 531 | goto out; |
| 531 | 532 | } |
| 532 | 533 | |
| @@ -534,7 +535,8 @@ static int intel_vgpu_open(struct mdev_device *mdev) · 1 unmodified line | ||
| 534 | 535 | ret = vfio_register_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY, &events, |
| 535 | 536 | &vgpu->vdev.group_notifier); |
| 536 | 537 | if (ret != 0) { |
| 537 | − gvt_err("vfio_register_notifier for group failed: %d\n", ret); | |
| 538 | + gvt_vgpu_err("vfio_register_notifier for group failed: %d\n", | |
| 539 | + ret); | |
| 538 | 540 | goto undo_iommu; |
| 539 | 541 | } |
| 540 | 542 | |
| @@ -635,7 +637,7 @@ static ssize_t intel_vgpu_rw(struct mdev_device *mdev, char *buf, · 94 unmodified lines | ||
| 635 | 637 | |
| 636 | 638 | |
| 637 | 639 | if (index >= VFIO_PCI_NUM_REGIONS) { |
| 638 | − gvt_err("invalid index: %u\n", index); | |
| 640 | + gvt_vgpu_err("invalid index: %u\n", index); | |
| 639 | 641 | return -EINVAL; |
| 640 | 642 | } |
| 641 | 643 | |
| @@ -669,7 +671,7 @@ static ssize_t intel_vgpu_rw(struct mdev_device *mdev, char *buf, · 27 unmodified lines | ||
| 669 | 671 | case VFIO_PCI_VGA_REGION_INDEX: |
| 670 | 672 | case VFIO_PCI_ROM_REGION_INDEX: |
| 671 | 673 | default: |
| 672 | − gvt_err("unsupported region: %u\n", index); | |
| 674 | + gvt_vgpu_err("unsupported region: %u\n", index); | |
| 673 | 675 | } |
| 674 | 676 | |
| 675 | 677 | return ret == 0 ? count : ret; |
| @@ -861,7 +863,7 @@ static int intel_vgpu_set_msi_trigger(struct intel_vgpu *vgpu, · 185 unmodified lines | ||
| 861 | 863 | |
| 862 | 864 | trigger = eventfd_ctx_fdget(fd); |
| 863 | 865 | if (IS_ERR(trigger)) { |
| 864 | − gvt_err("eventfd_ctx_fdget failed\n"); | |
| 866 | + gvt_vgpu_err("eventfd_ctx_fdget failed\n"); | |
| 865 | 867 | return PTR_ERR(trigger); |
| 866 | 868 | } |
| 867 | 869 | vgpu->vdev.msi_trigger = trigger; |
| @@ -1120,7 +1122,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd, · 252 unmodified lines | ||
| 1120 | 1122 | ret = vfio_set_irqs_validate_and_prepare(&hdr, max, |
| 1121 | 1123 | VFIO_PCI_NUM_IRQS, &data_size); |
| 1122 | 1124 | if (ret) { |
| 1123 | − gvt_err("intel:vfio_set_irqs_validate_and_prepare failed\n"); | |
| 1125 | + gvt_vgpu_err("intel:vfio_set_irqs_validate_and_prepare failed\n"); | |
| 1124 | 1126 | return -EINVAL; |
| 1125 | 1127 | } |
| 1126 | 1128 | if (data_size) { |
| @@ -1310,7 +1312,7 @@ static int kvmgt_guest_init(struct mdev_device *mdev) · 183 unmodified lines | ||
| 1310 | 1312 | |
| 1311 | 1313 | kvm = vgpu->vdev.kvm; |
| 1312 | 1314 | if (!kvm || kvm->mm != current->mm) { |
| 1313 | − gvt_err("KVM is required to use Intel vGPU\n"); | |
| 1315 | + gvt_vgpu_err("KVM is required to use Intel vGPU\n"); | |
| 1314 | 1316 | return -ESRCH; |
| 1315 | 1317 | } |
| 1316 | 1318 | |
| @@ -1337,8 +1339,10 @@ static int kvmgt_guest_init(struct mdev_device *mdev) · 20 unmodified lines | ||
| 1337 | 1339 | |
| 1338 | 1340 | static bool kvmgt_guest_exit(struct kvmgt_guest_info *info) |
| 1339 | 1341 | { |
| 1342 | + struct intel_vgpu *vgpu = info->vgpu; | |
| 1343 | + | |
| 1340 | 1344 | if (!info) { |
| 1341 | − gvt_err("kvmgt_guest_info invalid\n"); | |
| 1345 | + gvt_vgpu_err("kvmgt_guest_info invalid\n"); | |
| 1342 | 1346 | return false; |
| 1343 | 1347 | } |
| 1344 | 1348 | |
| @@ -1383,12 +1387,14 @@ static unsigned long kvmgt_gfn_to_pfn(unsigned long handle, unsigned long gfn) · 38 unmodified lines | ||
| 1383 | 1387 | unsigned long iova, pfn; |
| 1384 | 1388 | struct kvmgt_guest_info *info; |
| 1385 | 1389 | struct device *dev; |
| 1390 | + struct intel_vgpu *vgpu; | |
| 1386 | 1391 | int rc; |
| 1387 | 1392 | |
| 1388 | 1393 | if (!handle_valid(handle)) |
| 1389 | 1394 | return INTEL_GVT_INVALID_ADDR; |
| 1390 | 1395 | |
| 1391 | 1396 | info = (struct kvmgt_guest_info *)handle; |
| 1397 | + vgpu = info->vgpu; | |
| 1392 | 1398 | iova = gvt_cache_find(info->vgpu, gfn); |
| 1393 | 1399 | if (iova != INTEL_GVT_INVALID_ADDR) |
| 1394 | 1400 | return iova; |
| @@ -1397,13 +1403,14 @@ static unsigned long kvmgt_gfn_to_pfn(unsigned long handle, unsigned long gfn) · 2 unmodified lines | ||
| 1397 | 1403 | dev = mdev_dev(info->vgpu->vdev.mdev); |
| 1398 | 1404 | rc = vfio_pin_pages(dev, &gfn, 1, IOMMU_READ | IOMMU_WRITE, &pfn); |
| 1399 | 1405 | if (rc != 1) { |
| 1400 | − gvt_err("vfio_pin_pages failed for gfn 0x%lx: %d\n", gfn, rc); | |
| 1406 | + gvt_vgpu_err("vfio_pin_pages failed for gfn 0x%lx: %d\n", | |
| 1407 | + gfn, rc); | |
| 1401 | 1408 | return INTEL_GVT_INVALID_ADDR; |
| 1402 | 1409 | } |
| 1403 | 1410 | /* transfer to host iova for GFX to use DMA */ |
| 1404 | 1411 | rc = gvt_dma_map_iova(info->vgpu, pfn, &iova); |
| 1405 | 1412 | if (rc) { |
| 1406 | − gvt_err("gvt_dma_map_iova failed for gfn: 0x%lx\n", gfn); | |
| 1413 | + gvt_vgpu_err("gvt_dma_map_iova failed for gfn: 0x%lx\n", gfn); | |
| 1407 | 1414 | vfio_unpin_pages(dev, &gfn, 1); |
| 1408 | 1415 | return INTEL_GVT_INVALID_ADDR; |
| 1409 | 1416 | } |
| @@ -1417,7 +1424,7 @@ static int kvmgt_rw_gpa(unsigned long handle, unsigned long gpa, · 7 unmodified lines | ||
| 1417 | 1424 | { |
| 1418 | 1425 | struct kvmgt_guest_info *info; |
| 1419 | 1426 | struct kvm *kvm; |
| 1420 | − int ret; | |
| 1427 | + int idx, ret; | |
| 1421 | 1428 | bool kthread = current->mm == NULL; |
| 1422 | 1429 | |
| 1423 | 1430 | if (!handle_valid(handle)) |
| @@ -1429,8 +1436,10 @@ static int kvmgt_rw_gpa(unsigned long handle, unsigned long gpa, · 5 unmodified lines | ||
| 1429 | 1436 | if (kthread) |
| 1430 | 1437 | use_mm(kvm->mm); |
| 1431 | 1438 | |
| 1439 | + idx = srcu_read_lock(&kvm->srcu); | |
| 1432 | 1440 | ret = write ? kvm_write_guest(kvm, gpa, buf, len) : |
| 1433 | 1441 | kvm_read_guest(kvm, gpa, buf, len); |
| 1442 | + srcu_read_unlock(&kvm->srcu, idx); | |
| 1434 | 1443 | |
| 1435 | 1444 | if (kthread) |
| 1436 | 1445 | unuse_mm(kvm->mm); |
| @@ -142,10 +142,10 @@ int intel_vgpu_emulate_mmio_read(struct intel_vgpu *vgpu, uint64_t pa, · 141 unmodified lines | ||
| 142 | 142 | ret = intel_gvt_hypervisor_read_gpa(vgpu, pa, |
| 143 | 143 | p_data, bytes); |
| 144 | 144 | if (ret) { |
| 145 | − gvt_err("vgpu%d: guest page read error %d, " | |
| 145 | + gvt_vgpu_err("guest page read error %d, " | |
| 146 | 146 | "gfn 0x%lx, pa 0x%llx, var 0x%x, len %d\n", |
| 147 | − vgpu->id, ret, | |
| 148 | − gp->gfn, pa, *(u32 *)p_data, bytes); | |
| 147 | + ret, gp->gfn, pa, *(u32 *)p_data, | |
| 148 | + bytes); | |
| 149 | 149 | } |
| 150 | 150 | mutex_unlock(&gvt->lock); |
| 151 | 151 | return ret; |
| @@ -200,14 +200,13 @@ int intel_vgpu_emulate_mmio_read(struct intel_vgpu *vgpu, uint64_t pa, · 48 unmodified lines | ||
| 200 | 200 | ret = intel_vgpu_default_mmio_read(vgpu, offset, p_data, bytes); |
| 201 | 201 | |
| 202 | 202 | if (!vgpu->mmio.disable_warn_untrack) { |
| 203 | − gvt_err("vgpu%d: read untracked MMIO %x(%dB) val %x\n", | |
| 204 | − vgpu->id, offset, bytes, *(u32 *)p_data); | |
| 203 | + gvt_vgpu_err("read untracked MMIO %x(%dB) val %x\n", | |
| 204 | + offset, bytes, *(u32 *)p_data); | |
| 205 | 205 | |
| 206 | 206 | if (offset == 0x206c) { |
| 207 | − gvt_err("------------------------------------------\n"); | |
| 208 | − gvt_err("vgpu%d: likely triggers a gfx reset\n", | |
| 209 | − vgpu->id); | |
| 210 | − gvt_err("------------------------------------------\n"); | |
| 207 | + gvt_vgpu_err("------------------------------------------\n"); | |
| 208 | + gvt_vgpu_err("likely triggers a gfx reset\n"); | |
| 209 | + gvt_vgpu_err("------------------------------------------\n"); | |
| 211 | 210 | vgpu->mmio.disable_warn_untrack = true; |
| 212 | 211 | } |
| 213 | 212 | } |
| @@ -220,8 +219,8 @@ int intel_vgpu_emulate_mmio_read(struct intel_vgpu *vgpu, uint64_t pa, · 6 unmodified lines | ||
| 220 | 219 | mutex_unlock(&gvt->lock); |
| 221 | 220 | return 0; |
| 222 | 221 | err: |
| 223 | − gvt_err("vgpu%d: fail to emulate MMIO read %08x len %d\n", | |
| 224 | − vgpu->id, offset, bytes); | |
| 222 | + gvt_vgpu_err("fail to emulate MMIO read %08x len %d\n", | |
| 223 | + offset, bytes); | |
| 225 | 224 | mutex_unlock(&gvt->lock); |
| 226 | 225 | return ret; |
| 227 | 226 | } |
| @@ -259,10 +258,11 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu *vgpu, uint64_t pa, · 31 unmodified lines | ||
| 259 | 258 | if (gp) { |
| 260 | 259 | ret = gp->handler(gp, pa, p_data, bytes); |
| 261 | 260 | if (ret) { |
| 262 | − gvt_err("vgpu%d: guest page write error %d, " | |
| 263 | − "gfn 0x%lx, pa 0x%llx, var 0x%x, len %d\n", | |
| 264 | − vgpu->id, ret, | |
| 265 | − gp->gfn, pa, *(u32 *)p_data, bytes); | |
| 261 | + gvt_err("guest page write error %d, " | |
| 262 | + "gfn 0x%lx, pa 0x%llx, " | |
| 263 | + "var 0x%x, len %d\n", | |
| 264 | + ret, gp->gfn, pa, | |
| 265 | + *(u32 *)p_data, bytes); | |
| 266 | 266 | } |
| 267 | 267 | mutex_unlock(&gvt->lock); |
| 268 | 268 | return ret; |
| @@ -329,8 +329,8 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu *vgpu, uint64_t pa, · 60 unmodified lines | ||
| 329 | 329 | |
| 330 | 330 | /* all register bits are RO. */ |
| 331 | 331 | if (ro_mask == ~(u64)0) { |
| 332 | − gvt_err("vgpu%d: try to write RO reg %x\n", | |
| 333 | − vgpu->id, offset); | |
| 332 | + gvt_vgpu_err("try to write RO reg %x\n", | |
| 333 | + offset); | |
| 334 | 334 | ret = 0; |
| 335 | 335 | goto out; |
| 336 | 336 | } |
| @@ -360,8 +360,8 @@ out: · 23 unmodified lines | ||
| 360 | 360 | mutex_unlock(&gvt->lock); |
| 361 | 361 | return 0; |
| 362 | 362 | err: |
| 363 | − gvt_err("vgpu%d: fail to emulate MMIO write %08x len %d\n", | |
| 364 | − vgpu->id, offset, bytes); | |
| 363 | + gvt_vgpu_err("fail to emulate MMIO write %08x len %d\n", offset, | |
| 364 | + bytes); | |
| 365 | 365 | mutex_unlock(&gvt->lock); |
| 366 | 366 | return ret; |
| 367 | 367 | } |
| @@ -107,4 +107,7 @@ int intel_vgpu_default_mmio_read(struct intel_vgpu *vgpu, unsigned int offset, · 106 unmodified lines | ||
| 107 | 107 | void *p_data, unsigned int bytes); |
| 108 | 108 | int intel_vgpu_default_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, |
| 109 | 109 | void *p_data, unsigned int bytes); |
| 110 | + | |
| 111 | +bool intel_gvt_in_force_nonpriv_whitelist(struct intel_gvt *gvt, | |
| 112 | + unsigned int offset); | |
| 110 | 113 | #endif |
| @@ -67,14 +67,15 @@ static int map_vgpu_opregion(struct intel_vgpu *vgpu, bool map) · 66 unmodified lines | ||
| 67 | 67 | mfn = intel_gvt_hypervisor_virt_to_mfn(vgpu_opregion(vgpu)->va |
| 68 | 68 | + i * PAGE_SIZE); |
| 69 | 69 | if (mfn == INTEL_GVT_INVALID_ADDR) { |
| 70 | − gvt_err("fail to get MFN from VA\n"); | |
| 70 | + gvt_vgpu_err("fail to get MFN from VA\n"); | |
| 71 | 71 | return -EINVAL; |
| 72 | 72 | } |
| 73 | 73 | ret = intel_gvt_hypervisor_map_gfn_to_mfn(vgpu, |
| 74 | 74 | vgpu_opregion(vgpu)->gfn[i], |
| 75 | 75 | mfn, 1, map); |
| 76 | 76 | if (ret) { |
| 77 | − gvt_err("fail to map GFN to MFN, errno: %d\n", ret); | |
| 77 | + gvt_vgpu_err("fail to map GFN to MFN, errno: %d\n", | |
| 78 | + ret); | |
| 78 | 79 | return ret; |
| 79 | 80 | } |
| 80 | 81 | } |
| @@ -287,7 +288,7 @@ int intel_vgpu_emulate_opregion_request(struct intel_vgpu *vgpu, u32 swsci) · 206 unmodified lines | ||
| 287 | 288 | parm = vgpu_opregion(vgpu)->va + INTEL_GVT_OPREGION_PARM; |
| 288 | 289 | |
| 289 | 290 | if (!(swsci & SWSCI_SCI_SELECT)) { |
| 290 | − gvt_err("vgpu%d: requesting SMI service\n", vgpu->id); | |
| 291 | + gvt_vgpu_err("requesting SMI service\n"); | |
| 291 | 292 | return 0; |
| 292 | 293 | } |
| 293 | 294 | /* ignore non 0->1 trasitions */ |
| @@ -300,9 +301,8 @@ int intel_vgpu_emulate_opregion_request(struct intel_vgpu *vgpu, u32 swsci) · 6 unmodified lines | ||
| 300 | 301 | func = GVT_OPREGION_FUNC(*scic); |
| 301 | 302 | subfunc = GVT_OPREGION_SUBFUNC(*scic); |
| 302 | 303 | if (!querying_capabilities(*scic)) { |
| 303 | − gvt_err("vgpu%d: requesting runtime service: func \"%s\"," | |
| 304 | + gvt_vgpu_err("requesting runtime service: func \"%s\"," | |
| 304 | 305 | " subfunc \"%s\"\n", |
| 305 | − vgpu->id, | |
| 306 | 306 | opregion_func_name(func), |
| 307 | 307 | opregion_subfunc_name(subfunc)); |
| 308 | 308 | /* |
| @@ -167,7 +167,7 @@ static void handle_tlb_pending_event(struct intel_vgpu *vgpu, int ring_id) · 166 unmodified lines | ||
| 167 | 167 | I915_WRITE_FW(reg, 0x1); |
| 168 | 168 | |
| 169 | 169 | if (wait_for_atomic((I915_READ_FW(reg) == 0), 50)) |
| 170 | − gvt_err("timeout in invalidate ring (%d) tlb\n", ring_id); | |
| 170 | + gvt_vgpu_err("timeout in invalidate ring (%d) tlb\n", ring_id); | |
| 171 | 171 | else |
| 172 | 172 | vgpu_vreg(vgpu, regs[ring_id]) = 0; |
| 173 | 173 | |
| @@ -101,7 +101,7 @@ struct tbs_sched_data { · 100 unmodified lines | ||
| 101 | 101 | struct list_head runq_head; |
| 102 | 102 | }; |
| 103 | 103 | |
| 104 | −#define GVT_DEFAULT_TIME_SLICE (1 * HZ / 1000) | |
| 104 | +#define GVT_DEFAULT_TIME_SLICE (msecs_to_jiffies(1)) | |
| 105 | 105 | |
| 106 | 106 | static void tbs_sched_func(struct work_struct *work) |
| 107 | 107 | { |
| @@ -223,7 +223,7 @@ static void tbs_sched_start_schedule(struct intel_vgpu *vgpu) · 115 unmodified lines | ||
| 223 | 223 | return; |
| 224 | 224 | |
| 225 | 225 | list_add_tail(&vgpu_data->list, &sched_data->runq_head); |
| 226 | − schedule_delayed_work(&sched_data->work, sched_data->period); | |
| 226 | + schedule_delayed_work(&sched_data->work, 0); | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | static void tbs_sched_stop_schedule(struct intel_vgpu *vgpu) |
| @@ -84,7 +84,7 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload) · 83 unmodified lines | ||
| 84 | 84 | (u32)((workload->ctx_desc.lrca + i) << |
| 85 | 85 | GTT_PAGE_SHIFT)); |
| 86 | 86 | if (context_gpa == INTEL_GVT_INVALID_ADDR) { |
| 87 | − gvt_err("Invalid guest context descriptor\n"); | |
| 87 | + gvt_vgpu_err("Invalid guest context descriptor\n"); | |
| 88 | 88 | return -EINVAL; |
| 89 | 89 | } |
| 90 | 90 | |
| @@ -173,7 +173,9 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) · 82 unmodified lines | ||
| 173 | 173 | int ring_id = workload->ring_id; |
| 174 | 174 | struct i915_gem_context *shadow_ctx = workload->vgpu->shadow_ctx; |
| 175 | 175 | struct drm_i915_private *dev_priv = workload->vgpu->gvt->dev_priv; |
| 176 | + struct intel_engine_cs *engine = dev_priv->engine[ring_id]; | |
| 176 | 177 | struct drm_i915_gem_request *rq; |
| 178 | + struct intel_vgpu *vgpu = workload->vgpu; | |
| 177 | 179 | int ret; |
| 178 | 180 | |
| 179 | 181 | gvt_dbg_sched("ring id %d prepare to dispatch workload %p\n", |
| @@ -185,9 +187,24 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) · 5 unmodified lines | ||
| 185 | 187 | |
| 186 | 188 | mutex_lock(&dev_priv->drm.struct_mutex); |
| 187 | 189 | |
| 190 | + /* pin shadow context by gvt even the shadow context will be pinned | |
| 191 | + * when i915 alloc request. That is because gvt will update the guest | |
| 192 | + * context from shadow context when workload is completed, and at that | |
| 193 | + * moment, i915 may already unpined the shadow context to make the | |
| 194 | + * shadow_ctx pages invalid. So gvt need to pin itself. After update | |
| 195 | + * the guest context, gvt can unpin the shadow_ctx safely. | |
| 196 | + */ | |
| 197 | + ret = engine->context_pin(engine, shadow_ctx); | |
| 198 | + if (ret) { | |
| 199 | + gvt_vgpu_err("fail to pin shadow context\n"); | |
| 200 | + workload->status = ret; | |
| 201 | + mutex_unlock(&dev_priv->drm.struct_mutex); | |
| 202 | + return ret; | |
| 203 | + } | |
| 204 | + | |
| 188 | 205 | rq = i915_gem_request_alloc(dev_priv->engine[ring_id], shadow_ctx); |
| 189 | 206 | if (IS_ERR(rq)) { |
| 190 | − gvt_err("fail to allocate gem request\n"); | |
| 207 | + gvt_vgpu_err("fail to allocate gem request\n"); | |
| 191 | 208 | ret = PTR_ERR(rq); |
| 192 | 209 | goto out; |
| 193 | 210 | } |
| @@ -200,9 +217,12 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) · 6 unmodified lines | ||
| 200 | 217 | if (ret) |
| 201 | 218 | goto out; |
| 202 | 219 | |
| 203 | − ret = intel_gvt_scan_and_shadow_wa_ctx(&workload->wa_ctx); | |
| 204 | − if (ret) | |
| 205 | − goto out; | |
| 220 | + if ((workload->ring_id == RCS) && | |
| 221 | + (workload->wa_ctx.indirect_ctx.size != 0)) { | |
| 222 | + ret = intel_gvt_scan_and_shadow_wa_ctx(&workload->wa_ctx); | |
| 223 | + if (ret) | |
| 224 | + goto out; | |
| 225 | + } | |
| 206 | 226 | |
| 207 | 227 | ret = populate_shadow_context(workload); |
| 208 | 228 | if (ret) |
| @@ -225,6 +245,9 @@ out: · 16 unmodified lines | ||
| 225 | 245 | |
| 226 | 246 | if (!IS_ERR_OR_NULL(rq)) |
| 227 | 247 | i915_add_request(rq); |
| 248 | + else | |
| 249 | + engine->context_unpin(engine, shadow_ctx); | |
| 250 | + | |
| 228 | 251 | mutex_unlock(&dev_priv->drm.struct_mutex); |
| 229 | 252 | return ret; |
| 230 | 253 | } |
| @@ -320,7 +343,7 @@ static void update_guest_context(struct intel_vgpu_workload *workload) · 89 unmodified lines | ||
| 320 | 343 | (u32)((workload->ctx_desc.lrca + i) << |
| 321 | 344 | GTT_PAGE_SHIFT)); |
| 322 | 345 | if (context_gpa == INTEL_GVT_INVALID_ADDR) { |
| 323 | − gvt_err("invalid guest context descriptor\n"); | |
| 346 | + gvt_vgpu_err("invalid guest context descriptor\n"); | |
| 324 | 347 | return; |
| 325 | 348 | } |
| 326 | 349 | |
| @@ -374,6 +397,10 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) · 47 unmodified lines | ||
| 374 | 397 | * For the workload w/o request, directly complete the workload. |
| 375 | 398 | */ |
| 376 | 399 | if (workload->req) { |
| 400 | + struct drm_i915_private *dev_priv = | |
| 401 | + workload->vgpu->gvt->dev_priv; | |
| 402 | + struct intel_engine_cs *engine = | |
| 403 | + dev_priv->engine[workload->ring_id]; | |
| 377 | 404 | wait_event(workload->shadow_ctx_status_wq, |
| 378 | 405 | !atomic_read(&workload->shadow_ctx_active)); |
| 379 | 406 | |
| @@ -386,6 +413,10 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) · 6 unmodified lines | ||
| 386 | 413 | INTEL_GVT_EVENT_MAX) |
| 387 | 414 | intel_vgpu_trigger_virtual_event(vgpu, event); |
| 388 | 415 | } |
| 416 | + mutex_lock(&dev_priv->drm.struct_mutex); | |
| 417 | + /* unpin shadow ctx as the shadow_ctx update is done */ | |
| 418 | + engine->context_unpin(engine, workload->vgpu->shadow_ctx); | |
| 419 | + mutex_unlock(&dev_priv->drm.struct_mutex); | |
| 389 | 420 | } |
| 390 | 421 | |
| 391 | 422 | gvt_dbg_sched("ring id %d complete workload %p status %d\n", |
| @@ -415,6 +446,7 @@ static int workload_thread(void *priv) · 23 unmodified lines | ||
| 415 | 446 | int ring_id = p->ring_id; |
| 416 | 447 | struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; |
| 417 | 448 | struct intel_vgpu_workload *workload = NULL; |
| 449 | + struct intel_vgpu *vgpu = NULL; | |
| 418 | 450 | int ret; |
| 419 | 451 | bool need_force_wake = IS_SKYLAKE(gvt->dev_priv); |
| 420 | 452 | DEFINE_WAIT_FUNC(wait, woken_wake_function); |
| @@ -457,25 +489,14 @@ static int workload_thread(void *priv) · 36 unmodified lines | ||
| 457 | 489 | mutex_unlock(&gvt->lock); |
| 458 | 490 | |
| 459 | 491 | if (ret) { |
| 460 | − gvt_err("fail to dispatch workload, skip\n"); | |
| 492 | + vgpu = workload->vgpu; | |
| 493 | + gvt_vgpu_err("fail to dispatch workload, skip\n"); | |
| 461 | 494 | goto complete; |
| 462 | 495 | } |
| 463 | 496 | |
| 464 | 497 | gvt_dbg_sched("ring id %d wait workload %p\n", |
| 465 | 498 | workload->ring_id, workload); |
| 466 | −retry: | |
| 467 | − i915_wait_request(workload->req, | |
| 468 | − 0, MAX_SCHEDULE_TIMEOUT); | |
| 469 | − /* I915 has replay mechanism and a request will be replayed | |
| 470 | − * if there is i915 reset. So the seqno will be updated anyway. | |
| 471 | − * If the seqno is not updated yet after waiting, which means | |
| 472 | − * the replay may still be in progress and we can wait again. | |
| 473 | − */ | |
| 474 | − if (!i915_gem_request_completed(workload->req)) { | |
| 475 | − gvt_dbg_sched("workload %p not completed, wait again\n", | |
| 476 | − workload); | |
| 477 | − goto retry; | |
| 478 | − } | |
| 499 | + i915_wait_request(workload->req, 0, MAX_SCHEDULE_TIMEOUT); | |
| 479 | 500 | |
| 480 | 501 | complete: |
| 481 | 502 | gvt_dbg_sched("will complete workload %p, status: %d\n", |
| @@ -1104,6 +1104,7 @@ static u32 vlv_wa_c0_ei(struct drm_i915_private *dev_priv, u32 pm_iir) · 1103 unmodified lines | ||
| 1104 | 1104 | u32 render, media; |
| 1105 | 1105 | |
| 1106 | 1106 | time = ktime_us_delta(now.ktime, prev->ktime); |
| 1107 | + | |
| 1107 | 1108 | time *= dev_priv->czclk_freq; |
| 1108 | 1109 | |
| 1109 | 1110 | /* Workload can be split between render + media, |
| @@ -77,6 +77,11 @@ int intel_gvt_init(struct drm_i915_private *dev_priv) · 76 unmodified lines | ||
| 77 | 77 | goto bail; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | + if (!i915.enable_execlists) { | |
| 81 | + DRM_INFO("GPU guest virtualisation [GVT-g] disabled due to disabled execlist submission [i915.enable_execlists module parameter]\n"); | |
| 82 | + goto bail; | |
| 83 | + } | |
| 84 | + | |
| 80 | 85 | /* |
| 81 | 86 | * We're not in host or fail to find a MPT module, disable GVT-g |
| 82 | 87 | */ |
| @@ -2985,9 +2985,13 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, · 2984 unmodified lines | ||
| 2985 | 2985 | max_sclk = 75000; |
| 2986 | 2986 | } |
| 2987 | 2987 | } else if (rdev->family == CHIP_OLAND) { |
| 2988 | − if ((rdev->pdev->device == 0x6604) && | |
| 2989 | − (rdev->pdev->subsystem_vendor == 0x1028) && | |
| 2990 | − (rdev->pdev->subsystem_device == 0x066F)) { | |
| 2988 | + if ((rdev->pdev->revision == 0xC7) || | |
| 2989 | + (rdev->pdev->revision == 0x80) || | |
| 2990 | + (rdev->pdev->revision == 0x81) || | |
| 2991 | + (rdev->pdev->revision == 0x83) || | |
| 2992 | + (rdev->pdev->revision == 0x87) || | |
| 2993 | + (rdev->pdev->device == 0x6604) || | |
| 2994 | + (rdev->pdev->device == 0x6605)) { | |
| 2991 | 2995 | max_sclk = 75000; |
| 2992 | 2996 | } |
| 2993 | 2997 | } |
| @@ -175,11 +175,11 @@ config HID_CHERRY · 174 unmodified lines | ||
| 175 | 175 | Support for Cherry Cymotion keyboard. |
| 176 | 176 | |
| 177 | 177 | config HID_CHICONY |
| 178 | − tristate "Chicony Tactical pad" | |
| 178 | + tristate "Chicony devices" | |
| 179 | 179 | depends on HID |
| 180 | 180 | default !EXPERT |
| 181 | 181 | ---help--- |
| 182 | − Support for Chicony Tactical pad. | |
| 182 | + Support for Chicony Tactical pad and special keys on Chicony keyboards. | |
| 183 | 183 | |
| 184 | 184 | config HID_CORSAIR |
| 185 | 185 | tristate "Corsair devices" |
| @@ -190,6 +190,7 @@ config HID_CORSAIR · 4 unmodified lines | ||
| 190 | 190 | |
| 191 | 191 | Supported devices: |
| 192 | 192 | - Vengeance K90 |
| 193 | + - Scimitar PRO RGB | |
| 193 | 194 | |
| 194 | 195 | config HID_PRODIKEYS |
| 195 | 196 | tristate "Prodikeys PC-MIDI Keyboard support" |
| @@ -86,6 +86,7 @@ static const struct hid_device_id ch_devices[] = { · 85 unmodified lines | ||
| 86 | 86 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
| 87 | 87 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, |
| 88 | 88 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, |
| 89 | + { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) }, | |
| 89 | 90 | { } |
| 90 | 91 | }; |
| 91 | 92 | MODULE_DEVICE_TABLE(hid, ch_devices); |
| @@ -1870,6 +1870,7 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1869 unmodified lines | ||
| 1870 | 1870 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, |
| 1871 | 1871 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, |
| 1872 | 1872 | { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) }, |
| 1873 | + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) }, | |
| 1873 | 1874 | { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, |
| 1874 | 1875 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, |
| 1875 | 1876 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, |
| @@ -1910,6 +1911,7 @@ static const struct hid_device_id hid_have_special_driver[] = { · 34 unmodified lines | ||
| 1910 | 1911 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, |
| 1911 | 1912 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) }, |
| 1912 | 1913 | { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) }, |
| 1914 | + { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) }, | |
| 1913 | 1915 | { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, |
| 1914 | 1916 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, |
| 1915 | 1917 | { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, |
| @@ -3,8 +3,10 @@ · 2 unmodified lines | ||
| 3 | 3 | * |
| 4 | 4 | * Supported devices: |
| 5 | 5 | * - Vengeance K90 Keyboard |
| 6 | + * - Scimitar PRO RGB Gaming Mouse | |
| 6 | 7 | * |
| 7 | 8 | * Copyright (c) 2015 Clement Vuchener |
| 9 | + * Copyright (c) 2017 Oscar Campos | |
| 8 | 10 | */ |
| 9 | 11 | |
| 10 | 12 | /* |
| @@ -670,10 +672,51 @@ static int corsair_input_mapping(struct hid_device *dev, · 659 unmodified lines | ||
| 670 | 672 | return 0; |
| 671 | 673 | } |
| 672 | 674 | |
| 675 | +/* | |
| 676 | + * The report descriptor of Corsair Scimitar RGB Pro gaming mouse is | |
| 677 | + * non parseable as they define two consecutive Logical Minimum for | |
| 678 | + * the Usage Page (Consumer) in rdescs bytes 75 and 77 being 77 0x16 | |
| 679 | + * that should be obviousy 0x26 for Logical Magimum of 16 bits. This | |
| 680 | + * prevents poper parsing of the report descriptor due Logical | |
| 681 | + * Minimum being larger than Logical Maximum. | |
| 682 | + * | |
| 683 | + * This driver fixes the report descriptor for: | |
| 684 | + * - USB ID b1c:1b3e, sold as Scimitar RGB Pro Gaming mouse | |
| 685 | + */ | |
| 686 | + | |
| 687 | +static __u8 *corsair_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |
| 688 | + unsigned int *rsize) | |
| 689 | +{ | |
| 690 | + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | |
| 691 | + | |
| 692 | + if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { | |
| 693 | + /* | |
| 694 | + * Corsair Scimitar RGB Pro report descriptor is broken and | |
| 695 | + * defines two different Logical Minimum for the Consumer | |
| 696 | + * Application. The byte 77 should be a 0x26 defining a 16 | |
| 697 | + * bits integer for the Logical Maximum but it is a 0x16 | |
| 698 | + * instead (Logical Minimum) | |
| 699 | + */ | |
| 700 | + switch (hdev->product) { | |
| 701 | + case USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB: | |
| 702 | + if (*rsize >= 172 && rdesc[75] == 0x15 && rdesc[77] == 0x16 | |
| 703 | + && rdesc[78] == 0xff && rdesc[79] == 0x0f) { | |
| 704 | + hid_info(hdev, "Fixing up report descriptor\n"); | |
| 705 | + rdesc[77] = 0x26; | |
| 706 | + } | |
| 707 | + break; | |
| 708 | + } | |
| 709 | + | |
| 710 | + } | |
| 711 | + return rdesc; | |
| 712 | +} | |
| 713 | + | |
| 673 | 714 | static const struct hid_device_id corsair_devices[] = { |
| 674 | 715 | { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90), |
| 675 | 716 | .driver_data = CORSAIR_USE_K90_MACRO | |
| 676 | 717 | CORSAIR_USE_K90_BACKLIGHT }, |
| 718 | + { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, | |
| 719 | + USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) }, | |
| 677 | 720 | {} |
| 678 | 721 | }; |
| 679 | 722 | |
| @@ -686,10 +729,14 @@ static struct hid_driver corsair_driver = { · 6 unmodified lines | ||
| 686 | 729 | .event = corsair_event, |
| 687 | 730 | .remove = corsair_remove, |
| 688 | 731 | .input_mapping = corsair_input_mapping, |
| 732 | + .report_fixup = corsair_mouse_report_fixup, | |
| 689 | 733 | }; |
| 690 | 734 | |
| 691 | 735 | module_hid_driver(corsair_driver); |
| 692 | 736 | |
| 693 | 737 | MODULE_LICENSE("GPL"); |
| 738 | +/* Original K90 driver author */ | |
| 694 | 739 | MODULE_AUTHOR("Clement Vuchener"); |
| 740 | +/* Scimitar PRO RGB driver author */ | |
| 741 | +MODULE_AUTHOR("Oscar Campos"); | |
| 695 | 742 | MODULE_DESCRIPTION("HID driver for Corsair devices"); |
| @@ -278,6 +278,9 @@ · 277 unmodified lines | ||
| 278 | 278 | #define USB_DEVICE_ID_CORSAIR_K70RGB 0x1b13 |
| 279 | 279 | #define USB_DEVICE_ID_CORSAIR_STRAFE 0x1b15 |
| 280 | 280 | #define USB_DEVICE_ID_CORSAIR_K65RGB 0x1b17 |
| 281 | +#define USB_DEVICE_ID_CORSAIR_K70RGB_RAPIDFIRE 0x1b38 | |
| 282 | +#define USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE 0x1b39 | |
| 283 | +#define USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB 0x1b3e | |
| 281 | 284 | |
| 282 | 285 | #define USB_VENDOR_ID_CREATIVELABS 0x041e |
| 283 | 286 | #define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51 0x322c |
| @@ -557,6 +560,7 @@ · 273 unmodified lines | ||
| 557 | 560 | |
| 558 | 561 | #define USB_VENDOR_ID_JESS 0x0c45 |
| 559 | 562 | #define USB_DEVICE_ID_JESS_YUREX 0x1010 |
| 563 | +#define USB_DEVICE_ID_JESS_ZEN_AIO_KBD 0x5112 | |
| 560 | 564 | |
| 561 | 565 | #define USB_VENDOR_ID_JESS2 0x0f30 |
| 562 | 566 | #define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111 |
| @@ -2632,6 +2632,8 @@ err_stop: · 2631 unmodified lines | ||
| 2632 | 2632 | sony_leds_remove(sc); |
| 2633 | 2633 | if (sc->quirks & SONY_BATTERY_SUPPORT) |
| 2634 | 2634 | sony_battery_remove(sc); |
| 2635 | + if (sc->touchpad) | |
| 2636 | + sony_unregister_touchpad(sc); | |
| 2635 | 2637 | sony_cancel_work_sync(sc); |
| 2636 | 2638 | kfree(sc->output_report_dmabuf); |
| 2637 | 2639 | sony_remove_dev_list(sc); |
| @@ -80,6 +80,9 @@ static const struct hid_blacklist { · 79 unmodified lines | ||
| 80 | 80 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB, HID_QUIRK_NO_INIT_REPORTS }, |
| 81 | 81 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB, HID_QUIRK_NO_INIT_REPORTS }, |
| 82 | 82 | { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_STRAFE, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, |
| 83 | + { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB_RAPIDFIRE, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, | |
| 84 | + { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB_RAPIDFIRE, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, | |
| 85 | + { USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL }, | |
| 83 | 86 | { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET }, |
| 84 | 87 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
| 85 | 88 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, |
| @@ -2579,7 +2579,9 @@ static void wacom_remove(struct hid_device *hdev) · 2578 unmodified lines | ||
| 2579 | 2579 | |
| 2580 | 2580 | /* make sure we don't trigger the LEDs */ |
| 2581 | 2581 | wacom_led_groups_release(wacom); |
| 2582 | − wacom_release_resources(wacom); | |
| 2582 | + | |
| 2583 | + if (wacom->wacom_wac.features.type != REMOTE) | |
| 2584 | + wacom_release_resources(wacom); | |
| 2583 | 2585 | |
| 2584 | 2586 | hid_set_drvdata(hdev, NULL); |
| 2585 | 2587 | } |
| @@ -1959,8 +1959,10 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, · 1958 unmodified lines | ||
| 1959 | 1959 | input_set_capability(input, EV_KEY, BTN_TOOL_BRUSH); |
| 1960 | 1960 | input_set_capability(input, EV_KEY, BTN_TOOL_PENCIL); |
| 1961 | 1961 | input_set_capability(input, EV_KEY, BTN_TOOL_AIRBRUSH); |
| 1962 | − input_set_capability(input, EV_KEY, BTN_TOOL_MOUSE); | |
| 1963 | − input_set_capability(input, EV_KEY, BTN_TOOL_LENS); | |
| 1962 | + if (!(features->device_type & WACOM_DEVICETYPE_DIRECT)) { | |
| 1963 | + input_set_capability(input, EV_KEY, BTN_TOOL_MOUSE); | |
| 1964 | + input_set_capability(input, EV_KEY, BTN_TOOL_LENS); | |
| 1965 | + } | |
| 1964 | 1966 | break; |
| 1965 | 1967 | case WACOM_HID_WD_FINGERWHEEL: |
| 1966 | 1968 | wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); |
| @@ -4197,10 +4199,10 @@ static const struct wacom_features wacom_features_0x343 = · 2230 unmodified lines | ||
| 4197 | 4199 | WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
| 4198 | 4200 | static const struct wacom_features wacom_features_0x360 = |
| 4199 | 4201 | { "Wacom Intuos Pro M", 44800, 29600, 8191, 63, |
| 4200 | − INTUOSP2_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 9, .touch_max = 10 }; | |
| 4202 | + INTUOSP2_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 10 }; | |
| 4201 | 4203 | static const struct wacom_features wacom_features_0x361 = |
| 4202 | 4204 | { "Wacom Intuos Pro L", 62200, 43200, 8191, 63, |
| 4203 | − INTUOSP2_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 9, .touch_max = 10 }; | |
| 4205 | + INTUOSP2_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 10 }; | |
| 4204 | 4206 | |
| 4205 | 4207 | static const struct wacom_features wacom_features_HID_ANY_ID = |
| 4206 | 4208 | { "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID }; |
| @@ -502,12 +502,15 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) · 501 unmodified lines | ||
| 502 | 502 | |
| 503 | 503 | wait_for_completion(&info->waitevent); |
| 504 | 504 | |
| 505 | − if (channel->rescind) { | |
| 506 | − ret = -ENODEV; | |
| 507 | − goto post_msg_err; | |
| 508 | − } | |
| 509 | − | |
| 510 | 505 | post_msg_err: |
| 506 | + /* | |
| 507 | + * If the channel has been rescinded; | |
| 508 | + * we will be awakened by the rescind | |
| 509 | + * handler; set the error code to zero so we don't leak memory. | |
| 510 | + */ | |
| 511 | + if (channel->rescind) | |
| 512 | + ret = 0; | |
| 513 | + | |
| 511 | 514 | spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags); |
| 512 | 515 | list_del(&info->msglistentry); |
| 513 | 516 | spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); |
| @@ -530,15 +533,13 @@ static int vmbus_close_internal(struct vmbus_channel *channel) · 16 unmodified lines | ||
| 530 | 533 | int ret; |
| 531 | 534 | |
| 532 | 535 | /* |
| 533 | − * vmbus_on_event(), running in the tasklet, can race | |
| 536 | + * vmbus_on_event(), running in the per-channel tasklet, can race | |
| 534 | 537 | * with vmbus_close_internal() in the case of SMP guest, e.g., when |
| 535 | 538 | * the former is accessing channel->inbound.ring_buffer, the latter |
| 536 | − * could be freeing the ring_buffer pages. | |
| 537 | − * | |
| 538 | − * To resolve the race, we can serialize them by disabling the | |
| 539 | − * tasklet when the latter is running here. | |
| 539 | + * could be freeing the ring_buffer pages, so here we must stop it | |
| 540 | + * first. | |
| 540 | 541 | */ |
| 541 | − hv_event_tasklet_disable(channel); | |
| 542 | + tasklet_disable(&channel->callback_event); | |
| 542 | 543 | |
| 543 | 544 | /* |
| 544 | 545 | * In case a device driver's probe() fails (e.g., |
| @@ -605,8 +606,6 @@ static int vmbus_close_internal(struct vmbus_channel *channel) · 60 unmodified lines | ||
| 605 | 606 | get_order(channel->ringbuffer_pagecount * PAGE_SIZE)); |
| 606 | 607 | |
| 607 | 608 | out: |
| 608 | − hv_event_tasklet_enable(channel); | |
| 609 | − | |
| 610 | 609 | return ret; |
| 611 | 610 | } |
| 612 | 611 | |
| @@ -350,7 +350,8 @@ static struct vmbus_channel *alloc_channel(void) · 349 unmodified lines | ||
| 350 | 350 | static void free_channel(struct vmbus_channel *channel) |
| 351 | 351 | { |
| 352 | 352 | tasklet_kill(&channel->callback_event); |
| 353 | − kfree(channel); | |
| 353 | + | |
| 354 | + kfree_rcu(channel, rcu); | |
| 354 | 355 | } |
| 355 | 356 | |
| 356 | 357 | static void percpu_channel_enq(void *arg) |
| @@ -359,14 +360,14 @@ static void percpu_channel_enq(void *arg) · 2 unmodified lines | ||
| 359 | 360 | struct hv_per_cpu_context *hv_cpu |
| 360 | 361 | = this_cpu_ptr(hv_context.cpu_context); |
| 361 | 362 | |
| 362 | − list_add_tail(&channel->percpu_list, &hv_cpu->chan_list); | |
| 363 | + list_add_tail_rcu(&channel->percpu_list, &hv_cpu->chan_list); | |
| 363 | 364 | } |
| 364 | 365 | |
| 365 | 366 | static void percpu_channel_deq(void *arg) |
| 366 | 367 | { |
| 367 | 368 | struct vmbus_channel *channel = arg; |
| 368 | 369 | |
| 369 | − list_del(&channel->percpu_list); | |
| 370 | + list_del_rcu(&channel->percpu_list); | |
| 370 | 371 | } |
| 371 | 372 | |
| 372 | 373 | |
| @@ -381,19 +382,6 @@ static void vmbus_release_relid(u32 relid) · 8 unmodified lines | ||
| 381 | 382 | true); |
| 382 | 383 | } |
| 383 | 384 | |
| 384 | −void hv_event_tasklet_disable(struct vmbus_channel *channel) | |
| 385 | −{ | |
| 386 | − tasklet_disable(&channel->callback_event); | |
| 387 | −} | |
| 388 | − | |
| 389 | −void hv_event_tasklet_enable(struct vmbus_channel *channel) | |
| 390 | −{ | |
| 391 | − tasklet_enable(&channel->callback_event); | |
| 392 | − | |
| 393 | − /* In case there is any pending event */ | |
| 394 | − tasklet_schedule(&channel->callback_event); | |
| 395 | −} | |
| 396 | − | |
| 397 | 385 | void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid) |
| 398 | 386 | { |
| 399 | 387 | unsigned long flags; |
| @@ -402,7 +390,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid) · 2 unmodified lines | ||
| 402 | 390 | BUG_ON(!channel->rescind); |
| 403 | 391 | BUG_ON(!mutex_is_locked(&vmbus_connection.channel_mutex)); |
| 404 | 392 | |
| 405 | − hv_event_tasklet_disable(channel); | |
| 406 | 393 | if (channel->target_cpu != get_cpu()) { |
| 407 | 394 | put_cpu(); |
| 408 | 395 | smp_call_function_single(channel->target_cpu, |
| @@ -411,7 +398,6 @@ void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid) · 2 unmodified lines | ||
| 411 | 398 | percpu_channel_deq(channel); |
| 412 | 399 | put_cpu(); |
| 413 | 400 | } |
| 414 | − hv_event_tasklet_enable(channel); | |
| 415 | 401 | |
| 416 | 402 | if (channel->primary_channel == NULL) { |
| 417 | 403 | list_del(&channel->listentry); |
| @@ -505,7 +491,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) · 87 unmodified lines | ||
| 505 | 491 | |
| 506 | 492 | init_vp_index(newchannel, dev_type); |
| 507 | 493 | |
| 508 | − hv_event_tasklet_disable(newchannel); | |
| 509 | 494 | if (newchannel->target_cpu != get_cpu()) { |
| 510 | 495 | put_cpu(); |
| 511 | 496 | smp_call_function_single(newchannel->target_cpu, |
| @@ -515,7 +500,6 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel) · 3 unmodified lines | ||
| 515 | 500 | percpu_channel_enq(newchannel); |
| 516 | 501 | put_cpu(); |
| 517 | 502 | } |
| 518 | − hv_event_tasklet_enable(newchannel); | |
| 519 | 503 | |
| 520 | 504 | /* |
| 521 | 505 | * This state is used to indicate a successful open |
| @@ -565,7 +549,6 @@ err_deq_chan: · 43 unmodified lines | ||
| 565 | 549 | list_del(&newchannel->listentry); |
| 566 | 550 | mutex_unlock(&vmbus_connection.channel_mutex); |
| 567 | 551 | |
| 568 | − hv_event_tasklet_disable(newchannel); | |
| 569 | 552 | if (newchannel->target_cpu != get_cpu()) { |
| 570 | 553 | put_cpu(); |
| 571 | 554 | smp_call_function_single(newchannel->target_cpu, |
| @@ -574,7 +557,6 @@ err_deq_chan: · 2 unmodified lines | ||
| 574 | 557 | percpu_channel_deq(newchannel); |
| 575 | 558 | put_cpu(); |
| 576 | 559 | } |
| 577 | − hv_event_tasklet_enable(newchannel); | |
| 578 | 560 | |
| 579 | 561 | vmbus_release_relid(newchannel->offermsg.child_relid); |
| 580 | 562 | |
| @@ -814,6 +796,7 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) · 233 unmodified lines | ||
| 814 | 796 | /* Allocate the channel object and save this offer. */ |
| 815 | 797 | newchannel = alloc_channel(); |
| 816 | 798 | if (!newchannel) { |
| 799 | + vmbus_release_relid(offer->child_relid); | |
| 817 | 800 | pr_err("Unable to allocate channel object\n"); |
| 818 | 801 | return; |
| 819 | 802 | } |
| @@ -71,7 +71,6 @@ static DECLARE_WORK(fcopy_send_work, fcopy_send_data); · 70 unmodified lines | ||
| 71 | 71 | static const char fcopy_devname[] = "vmbus/hv_fcopy"; |
| 72 | 72 | static u8 *recv_buffer; |
| 73 | 73 | static struct hvutil_transport *hvt; |
| 74 | −static struct completion release_event; | |
| 75 | 74 | /* |
| 76 | 75 | * This state maintains the version number registered by the daemon. |
| 77 | 76 | */ |
| @@ -331,7 +330,6 @@ static void fcopy_on_reset(void) · 253 unmodified lines | ||
| 331 | 330 | |
| 332 | 331 | if (cancel_delayed_work_sync(&fcopy_timeout_work)) |
| 333 | 332 | fcopy_respond_to_host(HV_E_FAIL); |
| 334 | − complete(&release_event); | |
| 335 | 333 | } |
| 336 | 334 | |
| 337 | 335 | int hv_fcopy_init(struct hv_util_service *srv) |
| @@ -339,7 +337,6 @@ int hv_fcopy_init(struct hv_util_service *srv) · 1 unmodified line | ||
| 339 | 337 | recv_buffer = srv->recv_buffer; |
| 340 | 338 | fcopy_transaction.recv_channel = srv->channel; |
| 341 | 339 | |
| 342 | − init_completion(&release_event); | |
| 343 | 340 | /* |
| 344 | 341 | * When this driver loads, the user level daemon that |
| 345 | 342 | * processes the host requests may not yet be running. |
| @@ -361,5 +358,4 @@ void hv_fcopy_deinit(void) · 15 unmodified lines | ||
| 361 | 358 | fcopy_transaction.state = HVUTIL_DEVICE_DYING; |
| 362 | 359 | cancel_delayed_work_sync(&fcopy_timeout_work); |
| 363 | 360 | hvutil_transport_destroy(hvt); |
| 364 | − wait_for_completion(&release_event); | |
| 365 | 361 | } |
| @@ -101,7 +101,6 @@ static DECLARE_WORK(kvp_sendkey_work, kvp_send_key); · 100 unmodified lines | ||
| 101 | 101 | static const char kvp_devname[] = "vmbus/hv_kvp"; |
| 102 | 102 | static u8 *recv_buffer; |
| 103 | 103 | static struct hvutil_transport *hvt; |
| 104 | −static struct completion release_event; | |
| 105 | 104 | /* |
| 106 | 105 | * Register the kernel component with the user-level daemon. |
| 107 | 106 | * As part of this registration, pass the LIC version number. |
| @@ -714,7 +713,6 @@ static void kvp_on_reset(void) · 606 unmodified lines | ||
| 714 | 713 | if (cancel_delayed_work_sync(&kvp_timeout_work)) |
| 715 | 714 | kvp_respond_to_host(NULL, HV_E_FAIL); |
| 716 | 715 | kvp_transaction.state = HVUTIL_DEVICE_INIT; |
| 717 | − complete(&release_event); | |
| 718 | 716 | } |
| 719 | 717 | |
| 720 | 718 | int |
| @@ -723,7 +721,6 @@ hv_kvp_init(struct hv_util_service *srv) · 2 unmodified lines | ||
| 723 | 721 | recv_buffer = srv->recv_buffer; |
| 724 | 722 | kvp_transaction.recv_channel = srv->channel; |
| 725 | 723 | |
| 726 | − init_completion(&release_event); | |
| 727 | 724 | /* |
| 728 | 725 | * When this driver loads, the user level daemon that |
| 729 | 726 | * processes the host requests may not yet be running. |
| @@ -747,5 +744,4 @@ void hv_kvp_deinit(void) · 17 unmodified lines | ||
| 747 | 744 | cancel_delayed_work_sync(&kvp_timeout_work); |
| 748 | 745 | cancel_work_sync(&kvp_sendkey_work); |
| 749 | 746 | hvutil_transport_destroy(hvt); |
| 750 | − wait_for_completion(&release_event); | |
| 751 | 747 | } |
| @@ -79,7 +79,6 @@ static int dm_reg_value; · 78 unmodified lines | ||
| 79 | 79 | static const char vss_devname[] = "vmbus/hv_vss"; |
| 80 | 80 | static __u8 *recv_buffer; |
| 81 | 81 | static struct hvutil_transport *hvt; |
| 82 | −static struct completion release_event; | |
| 83 | 82 | |
| 84 | 83 | static void vss_timeout_func(struct work_struct *dummy); |
| 85 | 84 | static void vss_handle_request(struct work_struct *dummy); |
| @@ -361,13 +360,11 @@ static void vss_on_reset(void) · 275 unmodified lines | ||
| 361 | 360 | if (cancel_delayed_work_sync(&vss_timeout_work)) |
| 362 | 361 | vss_respond_to_host(HV_E_FAIL); |
| 363 | 362 | vss_transaction.state = HVUTIL_DEVICE_INIT; |
| 364 | − complete(&release_event); | |
| 365 | 363 | } |
| 366 | 364 | |
| 367 | 365 | int |
| 368 | 366 | hv_vss_init(struct hv_util_service *srv) |
| 369 | 367 | { |
| 370 | − init_completion(&release_event); | |
| 371 | 368 | if (vmbus_proto_version < VERSION_WIN8_1) { |
| 372 | 369 | pr_warn("Integration service 'Backup (volume snapshot)'" |
| 373 | 370 | " not supported on this host version.\n"); |
| @@ -400,5 +397,4 @@ void hv_vss_deinit(void) · 26 unmodified lines | ||
| 400 | 397 | cancel_delayed_work_sync(&vss_timeout_work); |
| 401 | 398 | cancel_work_sync(&vss_handle_request_work); |
| 402 | 399 | hvutil_transport_destroy(hvt); |
| 403 | − wait_for_completion(&release_event); | |
| 404 | 400 | } |
| @@ -590,6 +590,8 @@ static int hv_timesync_init(struct hv_util_service *srv) · 589 unmodified lines | ||
| 590 | 590 | if (!hyperv_cs) |
| 591 | 591 | return -ENODEV; |
| 592 | 592 | |
| 593 | + spin_lock_init(&host_ts.lock); | |
| 594 | + | |
| 593 | 595 | INIT_WORK(&wrk.work, hv_set_host_time); |
| 594 | 596 | |
| 595 | 597 | /* |
| @@ -182,10 +182,11 @@ static int hvt_op_release(struct inode *inode, struct file *file) · 181 unmodified lines | ||
| 182 | 182 | * connects back. |
| 183 | 183 | */ |
| 184 | 184 | hvt_reset(hvt); |
| 185 | − mutex_unlock(&hvt->lock); | |
| 186 | 185 | |
| 187 | 186 | if (mode_old == HVUTIL_TRANSPORT_DESTROY) |
| 188 | − hvt_transport_free(hvt); | |
| 187 | + complete(&hvt->release); | |
| 188 | + | |
| 189 | + mutex_unlock(&hvt->lock); | |
| 189 | 190 | |
| 190 | 191 | return 0; |
| 191 | 192 | } |
| @@ -304,6 +305,7 @@ struct hvutil_transport *hvutil_transport_init(const char *name, · 112 unmodified lines | ||
| 304 | 305 | |
| 305 | 306 | init_waitqueue_head(&hvt->outmsg_q); |
| 306 | 307 | mutex_init(&hvt->lock); |
| 308 | + init_completion(&hvt->release); | |
| 307 | 309 | |
| 308 | 310 | spin_lock(&hvt_list_lock); |
| 309 | 311 | list_add(&hvt->list, &hvt_list); |
| @@ -351,6 +353,8 @@ void hvutil_transport_destroy(struct hvutil_transport *hvt) · 41 unmodified lines | ||
| 351 | 353 | if (hvt->cn_id.idx > 0 && hvt->cn_id.val > 0) |
| 352 | 354 | cn_del_callback(&hvt->cn_id); |
| 353 | 355 | |
| 354 | − if (mode_old != HVUTIL_TRANSPORT_CHARDEV) | |
| 355 | − hvt_transport_free(hvt); | |
| 356 | + if (mode_old == HVUTIL_TRANSPORT_CHARDEV) | |
| 357 | + wait_for_completion(&hvt->release); | |
| 358 | + | |
| 359 | + hvt_transport_free(hvt); | |
| 356 | 360 | } |
| @@ -41,6 +41,7 @@ struct hvutil_transport { · 40 unmodified lines | ||
| 41 | 41 | int outmsg_len; /* its length */ |
| 42 | 42 | wait_queue_head_t outmsg_q; /* poll/read wait queue */ |
| 43 | 43 | struct mutex lock; /* protects struct members */ |
| 44 | + struct completion release; /* synchronize with fd release */ | |
| 44 | 45 | }; |
| 45 | 46 | |
| 46 | 47 | struct hvutil_transport *hvutil_transport_init(const char *name, |
| @@ -939,8 +939,10 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu) · 938 unmodified lines | ||
| 939 | 939 | if (relid == 0) |
| 940 | 940 | continue; |
| 941 | 941 | |
| 942 | + rcu_read_lock(); | |
| 943 | + | |
| 942 | 944 | /* Find channel based on relid */ |
| 943 | − list_for_each_entry(channel, &hv_cpu->chan_list, percpu_list) { | |
| 945 | + list_for_each_entry_rcu(channel, &hv_cpu->chan_list, percpu_list) { | |
| 944 | 946 | if (channel->offermsg.child_relid != relid) |
| 945 | 947 | continue; |
| 946 | 948 | |
| @@ -956,6 +958,8 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu) · 9 unmodified lines | ||
| 956 | 958 | tasklet_schedule(&channel->callback_event); |
| 957 | 959 | } |
| 958 | 960 | } |
| 961 | + | |
| 962 | + rcu_read_unlock(); | |
| 959 | 963 | } |
| 960 | 964 | } |
| 961 | 965 | |
| @@ -646,6 +646,9 @@ static int atk_read_value(struct atk_sensor_data *sensor, u64 *value) · 645 unmodified lines | ||
| 646 | 646 | else |
| 647 | 647 | err = atk_read_value_new(sensor, value); |
| 648 | 648 | |
| 649 | + if (err) | |
| 650 | + return err; | |
| 651 | + | |
| 649 | 652 | sensor->is_valid = true; |
| 650 | 653 | sensor->last_updated = jiffies; |
| 651 | 654 | sensor->cached_value = *value; |
| @@ -3198,7 +3198,7 @@ static int __init sm_it87_init(void) · 3197 unmodified lines | ||
| 3198 | 3198 | { |
| 3199 | 3199 | int sioaddr[2] = { REG_2E, REG_4E }; |
| 3200 | 3200 | struct it87_sio_data sio_data; |
| 3201 | − unsigned short isa_address; | |
| 3201 | + unsigned short isa_address[2]; | |
| 3202 | 3202 | bool found = false; |
| 3203 | 3203 | int i, err; |
| 3204 | 3204 | |
| @@ -3208,15 +3208,29 @@ static int __init sm_it87_init(void) · 3 unmodified lines | ||
| 3208 | 3208 | |
| 3209 | 3209 | for (i = 0; i < ARRAY_SIZE(sioaddr); i++) { |
| 3210 | 3210 | memset(&sio_data, 0, sizeof(struct it87_sio_data)); |
| 3211 | − isa_address = 0; | |
| 3212 | − err = it87_find(sioaddr[i], &isa_address, &sio_data); | |
| 3213 | − if (err || isa_address == 0) | |
| 3211 | + isa_address[i] = 0; | |
| 3212 | + err = it87_find(sioaddr[i], &isa_address[i], &sio_data); | |
| 3213 | + if (err || isa_address[i] == 0) | |
| 3214 | 3214 | continue; |
| 3215 | + /* | |
| 3216 | + * Don't register second chip if its ISA address matches | |
| 3217 | + * the first chip's ISA address. | |
| 3218 | + */ | |
| 3219 | + if (i && isa_address[i] == isa_address[0]) | |
| 3220 | + break; | |
| 3215 | 3221 | |
| 3216 | − err = it87_device_add(i, isa_address, &sio_data); | |
| 3222 | + err = it87_device_add(i, isa_address[i], &sio_data); | |
| 3217 | 3223 | if (err) |
| 3218 | 3224 | goto exit_dev_unregister; |
| 3225 | + | |
| 3219 | 3226 | found = true; |
| 3227 | + | |
| 3228 | + /* | |
| 3229 | + * IT8705F may respond on both SIO addresses. | |
| 3230 | + * Stop probing after finding one. | |
| 3231 | + */ | |
| 3232 | + if (sio_data.type == it87) | |
| 3233 | + break; | |
| 3220 | 3234 | } |
| 3221 | 3235 | |
| 3222 | 3236 | if (!found) { |
| @@ -311,7 +311,7 @@ static int max31790_write_pwm(struct device *dev, u32 attr, int channel, · 310 unmodified lines | ||
| 311 | 311 | data->pwm[channel] = val << 8; |
| 312 | 312 | err = i2c_smbus_write_word_swapped(client, |
| 313 | 313 | MAX31790_REG_PWMOUT(channel), |
| 314 | − val); | |
| 314 | + data->pwm[channel]); | |
| 315 | 315 | break; |
| 316 | 316 | case hwmon_pwm_enable: |
| 317 | 317 | fan_config = data->fan_config[channel]; |
| @@ -221,8 +221,10 @@ static int intel_th_output_activate(struct intel_th_device *thdev) · 220 unmodified lines | ||
| 221 | 221 | else |
| 222 | 222 | intel_th_trace_enable(thdev); |
| 223 | 223 | |
| 224 | − if (ret) | |
| 224 | + if (ret) { | |
| 225 | 225 | pm_runtime_put(&thdev->dev); |
| 226 | + module_put(thdrv->driver.owner); | |
| 227 | + } | |
| 226 | 228 | |
| 227 | 229 | return ret; |
| 228 | 230 | } |
| @@ -85,6 +85,16 @@ static const struct pci_device_id intel_th_pci_id_table[] = { · 84 unmodified lines | ||
| 85 | 85 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa2a6), |
| 86 | 86 | .driver_data = (kernel_ulong_t)0, |
| 87 | 87 | }, |
| 88 | + { | |
| 89 | + /* Denverton */ | |
| 90 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x19e1), | |
| 91 | + .driver_data = (kernel_ulong_t)0, | |
| 92 | + }, | |
| 93 | + { | |
| 94 | + /* Gemini Lake */ | |
| 95 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e), | |
| 96 | + .driver_data = (kernel_ulong_t)0, | |
| 97 | + }, | |
| 88 | 98 | { 0 }, |
| 89 | 99 | }; |
| 90 | 100 | |
| @@ -169,7 +169,9 @@ static irqreturn_t tiadc_irq_h(int irq, void *private) · 168 unmodified lines | ||
| 169 | 169 | { |
| 170 | 170 | struct iio_dev *indio_dev = private; |
| 171 | 171 | struct tiadc_device *adc_dev = iio_priv(indio_dev); |
| 172 | − unsigned int status, config; | |
| 172 | + unsigned int status, config, adc_fsm; | |
| 173 | + unsigned short count = 0; | |
| 174 | + | |
| 173 | 175 | status = tiadc_readl(adc_dev, REG_IRQSTATUS); |
| 174 | 176 | |
| 175 | 177 | /* |
| @@ -183,6 +185,15 @@ static irqreturn_t tiadc_irq_h(int irq, void *private) · 7 unmodified lines | ||
| 183 | 185 | tiadc_writel(adc_dev, REG_CTRL, config); |
| 184 | 186 | tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN |
| 185 | 187 | | IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES); |
| 188 | + | |
| 189 | + /* wait for idle state. | |
| 190 | + * ADC needs to finish the current conversion | |
| 191 | + * before disabling the module | |
| 192 | + */ | |
| 193 | + do { | |
| 194 | + adc_fsm = tiadc_readl(adc_dev, REG_ADCFSM); | |
| 195 | + } while (adc_fsm != 0x10 && count++ < 100); | |
| 196 | + | |
| 186 | 197 | tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB)); |
| 187 | 198 | return IRQ_HANDLED; |
| 188 | 199 | } else if (status & IRQENB_FIFO1THRES) { |
| @@ -51,8 +51,6 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) · 50 unmodified lines | ||
| 51 | 51 | st->report_state.report_id, |
| 52 | 52 | st->report_state.index, |
| 53 | 53 | HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM); |
| 54 | − | |
| 55 | − poll_value = hid_sensor_read_poll_value(st); | |
| 56 | 54 | } else { |
| 57 | 55 | int val; |
| 58 | 56 | |
| @@ -89,7 +87,9 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) · 30 unmodified lines | ||
| 89 | 87 | sensor_hub_get_feature(st->hsdev, st->power_state.report_id, |
| 90 | 88 | st->power_state.index, |
| 91 | 89 | sizeof(state_val), &state_val); |
| 92 | − if (state && poll_value) | |
| 90 | + if (state) | |
| 91 | + poll_value = hid_sensor_read_poll_value(st); | |
| 92 | + if (poll_value > 0) | |
| 93 | 93 | msleep_interruptible(poll_value * 2); |
| 94 | 94 | |
| 95 | 95 | return 0; |
| @@ -193,8 +193,8 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor, u16 watermark) · 192 unmodified lines | ||
| 193 | 193 | if (err < 0) |
| 194 | 194 | goto out; |
| 195 | 195 | |
| 196 | − fifo_watermark = ((data & ~ST_LSM6DSX_FIFO_TH_MASK) << 8) | | |
| 197 | − (fifo_watermark & ST_LSM6DSX_FIFO_TH_MASK); | |
| 196 | + fifo_watermark = ((data << 8) & ~ST_LSM6DSX_FIFO_TH_MASK) | | |
| 197 | + (fifo_watermark & ST_LSM6DSX_FIFO_TH_MASK); | |
| 198 | 198 | |
| 199 | 199 | wdata = cpu_to_le16(fifo_watermark); |
| 200 | 200 | err = hw->tf->write(hw->dev, ST_LSM6DSX_REG_FIFO_THL_ADDR, |
| @@ -763,7 +763,7 @@ power_off: · 762 unmodified lines | ||
| 763 | 763 | return ret; |
| 764 | 764 | } |
| 765 | 765 | |
| 766 | −static int __exit ak8974_remove(struct i2c_client *i2c) | |
| 766 | +static int ak8974_remove(struct i2c_client *i2c) | |
| 767 | 767 | { |
| 768 | 768 | struct iio_dev *indio_dev = i2c_get_clientdata(i2c); |
| 769 | 769 | struct ak8974 *ak8974 = iio_priv(indio_dev); |
| @@ -845,7 +845,7 @@ static struct i2c_driver ak8974_driver = { · 75 unmodified lines | ||
| 845 | 845 | .of_match_table = of_match_ptr(ak8974_of_match), |
| 846 | 846 | }, |
| 847 | 847 | .probe = ak8974_probe, |
| 848 | − .remove = __exit_p(ak8974_remove), | |
| 848 | + .remove = ak8974_remove, | |
| 849 | 849 | .id_table = ak8974_id, |
| 850 | 850 | }; |
| 851 | 851 | module_i2c_driver(ak8974_driver); |
| @@ -29,7 +29,13 @@ static int __ib_process_cq(struct ib_cq *cq, int budget) · 28 unmodified lines | ||
| 29 | 29 | { |
| 30 | 30 | int i, n, completed = 0; |
| 31 | 31 | |
| 32 | − while ((n = ib_poll_cq(cq, IB_POLL_BATCH, cq->wc)) > 0) { | |
| 32 | + /* | |
| 33 | + * budget might be (-1) if the caller does not | |
| 34 | + * want to bound this call, thus we need unsigned | |
| 35 | + * minimum here. | |
| 36 | + */ | |
| 37 | + while ((n = ib_poll_cq(cq, min_t(u32, IB_POLL_BATCH, | |
| 38 | + budget - completed), cq->wc)) > 0) { | |
| 33 | 39 | for (i = 0; i < n; i++) { |
| 34 | 40 | struct ib_wc *wc = &cq->wc[i]; |
| 35 | 41 | |
| @@ -196,7 +202,7 @@ void ib_free_cq(struct ib_cq *cq) · 160 unmodified lines | ||
| 196 | 202 | irq_poll_disable(&cq->iop); |
| 197 | 203 | break; |
| 198 | 204 | case IB_POLL_WORKQUEUE: |
| 199 | − flush_work(&cq->work); | |
| 205 | + cancel_work_sync(&cq->work); | |
| 200 | 206 | break; |
| 201 | 207 | default: |
| 202 | 208 | WARN_ON_ONCE(1); |
| @@ -336,12 +336,26 @@ int ib_register_device(struct ib_device *device, · 335 unmodified lines | ||
| 336 | 336 | struct device *parent = device->dev.parent; |
| 337 | 337 | |
| 338 | 338 | WARN_ON_ONCE(!parent); |
| 339 | − if (!device->dev.dma_ops) | |
| 340 | − device->dev.dma_ops = parent->dma_ops; | |
| 341 | − if (!device->dev.dma_mask) | |
| 342 | − device->dev.dma_mask = parent->dma_mask; | |
| 343 | − if (!device->dev.coherent_dma_mask) | |
| 344 | − device->dev.coherent_dma_mask = parent->coherent_dma_mask; | |
| 339 | + WARN_ON_ONCE(device->dma_device); | |
| 340 | + if (device->dev.dma_ops) { | |
| 341 | + /* | |
| 342 | + * The caller provided custom DMA operations. Copy the | |
| 343 | + * DMA-related fields that are used by e.g. dma_alloc_coherent() | |
| 344 | + * into device->dev. | |
| 345 | + */ | |
| 346 | + device->dma_device = &device->dev; | |
| 347 | + if (!device->dev.dma_mask) | |
| 348 | + device->dev.dma_mask = parent->dma_mask; | |
| 349 | + if (!device->dev.coherent_dma_mask) | |
| 350 | + device->dev.coherent_dma_mask = | |
| 351 | + parent->coherent_dma_mask; | |
| 352 | + } else { | |
| 353 | + /* | |
| 354 | + * The caller did not provide custom DMA operations. Use the | |
| 355 | + * DMA mapping operations of the parent device. | |
| 356 | + */ | |
| 357 | + device->dma_device = parent; | |
| 358 | + } | |
| 345 | 359 | |
| 346 | 360 | mutex_lock(&device_mutex); |
| 347 | 361 | |
| @@ -1015,8 +1029,7 @@ static int __init ib_core_init(void) · 667 unmodified lines | ||
| 1015 | 1029 | return -ENOMEM; |
| 1016 | 1030 | |
| 1017 | 1031 | ib_comp_wq = alloc_workqueue("ib-comp-wq", |
| 1018 | − WQ_UNBOUND | WQ_HIGHPRI | WQ_MEM_RECLAIM, | |
| 1019 | − WQ_UNBOUND_MAX_ACTIVE); | |
| 1032 | + WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_SYSFS, 0); | |
| 1020 | 1033 | if (!ib_comp_wq) { |
| 1021 | 1034 | ret = -ENOMEM; |
| 1022 | 1035 | goto err; |
| @@ -160,6 +160,9 @@ int i40iw_inetaddr_event(struct notifier_block *notifier, · 159 unmodified lines | ||
| 160 | 160 | return NOTIFY_DONE; |
| 161 | 161 | |
| 162 | 162 | iwdev = &hdl->device; |
| 163 | + if (iwdev->init_state < INET_NOTIFIER) | |
| 164 | + return NOTIFY_DONE; | |
| 165 | + | |
| 163 | 166 | netdev = iwdev->ldev->netdev; |
| 164 | 167 | upper_dev = netdev_master_upper_dev_get(netdev); |
| 165 | 168 | if (netdev != event_netdev) |
| @@ -214,6 +217,9 @@ int i40iw_inet6addr_event(struct notifier_block *notifier, · 48 unmodified lines | ||
| 214 | 217 | return NOTIFY_DONE; |
| 215 | 218 | |
| 216 | 219 | iwdev = &hdl->device; |
| 220 | + if (iwdev->init_state < INET_NOTIFIER) | |
| 221 | + return NOTIFY_DONE; | |
| 222 | + | |
| 217 | 223 | netdev = iwdev->ldev->netdev; |
| 218 | 224 | if (netdev != event_netdev) |
| 219 | 225 | return NOTIFY_DONE; |
| @@ -260,6 +266,8 @@ int i40iw_net_event(struct notifier_block *notifier, unsigned long event, void * · 40 unmodified lines | ||
| 260 | 266 | if (!iwhdl) |
| 261 | 267 | return NOTIFY_DONE; |
| 262 | 268 | iwdev = &iwhdl->device; |
| 269 | + if (iwdev->init_state < INET_NOTIFIER) | |
| 270 | + return NOTIFY_DONE; | |
| 263 | 271 | p = (__be32 *)neigh->primary_key; |
| 264 | 272 | i40iw_copy_ip_ntohl(local_ipaddr, p); |
| 265 | 273 | if (neigh->nud_state & NUD_VALID) { |
| @@ -372,7 +372,7 @@ static int _ocrdma_pd_mgr_put_bitmap(struct ocrdma_dev *dev, u16 pd_id, · 371 unmodified lines | ||
| 372 | 372 | return 0; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | −static u8 ocrdma_put_pd_num(struct ocrdma_dev *dev, u16 pd_id, | |
| 375 | +static int ocrdma_put_pd_num(struct ocrdma_dev *dev, u16 pd_id, | |
| 376 | 376 | bool dpp_pool) |
| 377 | 377 | { |
| 378 | 378 | int status; |
| @@ -7068,7 +7068,7 @@ static void qib_7322_txchk_change(struct qib_devdata *dd, u32 start, · 7067 unmodified lines | ||
| 7068 | 7068 | unsigned long flags; |
| 7069 | 7069 | |
| 7070 | 7070 | while (wait) { |
| 7071 | − unsigned long shadow; | |
| 7071 | + unsigned long shadow = 0; | |
| 7072 | 7072 | int cstart, previ = -1; |
| 7073 | 7073 | |
| 7074 | 7074 | /* |
| @@ -69,6 +69,9 @@ · 68 unmodified lines | ||
| 69 | 69 | */ |
| 70 | 70 | #define PCI_DEVICE_ID_VMWARE_PVRDMA 0x0820 |
| 71 | 71 | |
| 72 | +#define PVRDMA_NUM_RING_PAGES 4 | |
| 73 | +#define PVRDMA_QP_NUM_HEADER_PAGES 1 | |
| 74 | + | |
| 72 | 75 | struct pvrdma_dev; |
| 73 | 76 | |
| 74 | 77 | struct pvrdma_page_dir { |
| @@ -132,7 +132,7 @@ enum pvrdma_pci_resource { · 131 unmodified lines | ||
| 132 | 132 | |
| 133 | 133 | enum pvrdma_device_ctl { |
| 134 | 134 | PVRDMA_DEVICE_CTL_ACTIVATE, /* Activate device. */ |
| 135 | − PVRDMA_DEVICE_CTL_QUIESCE, /* Quiesce device. */ | |
| 135 | + PVRDMA_DEVICE_CTL_UNQUIESCE, /* Unquiesce device. */ | |
| 136 | 136 | PVRDMA_DEVICE_CTL_RESET, /* Reset device. */ |
| 137 | 137 | }; |
| 138 | 138 | |
| @@ -56,7 +56,7 @@ · 55 unmodified lines | ||
| 56 | 56 | #include "pvrdma.h" |
| 57 | 57 | |
| 58 | 58 | #define DRV_NAME "vmw_pvrdma" |
| 59 | −#define DRV_VERSION "1.0.0.0-k" | |
| 59 | +#define DRV_VERSION "1.0.1.0-k" | |
| 60 | 60 | |
| 61 | 61 | static DEFINE_MUTEX(pvrdma_device_list_lock); |
| 62 | 62 | static LIST_HEAD(pvrdma_device_list); |
| @@ -660,7 +660,16 @@ static void pvrdma_netdevice_event_handle(struct pvrdma_dev *dev, · 597 unmodified lines | ||
| 660 | 660 | pvrdma_dispatch_event(dev, 1, IB_EVENT_PORT_ERR); |
| 661 | 661 | break; |
| 662 | 662 | case NETDEV_UP: |
| 663 | − pvrdma_dispatch_event(dev, 1, IB_EVENT_PORT_ACTIVE); | |
| 663 | + pvrdma_write_reg(dev, PVRDMA_REG_CTL, | |
| 664 | + PVRDMA_DEVICE_CTL_UNQUIESCE); | |
| 665 | + | |
| 666 | + mb(); | |
| 667 | + | |
| 668 | + if (pvrdma_read_reg(dev, PVRDMA_REG_ERR)) | |
| 669 | + dev_err(&dev->pdev->dev, | |
| 670 | + "failed to activate device during link up\n"); | |
| 671 | + else | |
| 672 | + pvrdma_dispatch_event(dev, 1, IB_EVENT_PORT_ACTIVE); | |
| 664 | 673 | break; |
| 665 | 674 | default: |
| 666 | 675 | dev_dbg(&dev->pdev->dev, "ignore netdevice event %ld on %s\n", |
| @@ -858,7 +867,7 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, · 191 unmodified lines | ||
| 858 | 867 | dev->dsr->resp_slot_dma = (u64)slot_dma; |
| 859 | 868 | |
| 860 | 869 | /* Async event ring */ |
| 861 | − dev->dsr->async_ring_pages.num_pages = 4; | |
| 870 | + dev->dsr->async_ring_pages.num_pages = PVRDMA_NUM_RING_PAGES; | |
| 862 | 871 | ret = pvrdma_page_dir_init(dev, &dev->async_pdir, |
| 863 | 872 | dev->dsr->async_ring_pages.num_pages, true); |
| 864 | 873 | if (ret) |
| @@ -867,7 +876,7 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, · 2 unmodified lines | ||
| 867 | 876 | dev->dsr->async_ring_pages.pdir_dma = dev->async_pdir.dir_dma; |
| 868 | 877 | |
| 869 | 878 | /* CQ notification ring */ |
| 870 | − dev->dsr->cq_ring_pages.num_pages = 4; | |
| 879 | + dev->dsr->cq_ring_pages.num_pages = PVRDMA_NUM_RING_PAGES; | |
| 871 | 880 | ret = pvrdma_page_dir_init(dev, &dev->cq_pdir, |
| 872 | 881 | dev->dsr->cq_ring_pages.num_pages, true); |
| 873 | 882 | if (ret) |
| @@ -170,8 +170,9 @@ static int pvrdma_set_sq_size(struct pvrdma_dev *dev, struct ib_qp_cap *req_cap, · 169 unmodified lines | ||
| 170 | 170 | sizeof(struct pvrdma_sge) * |
| 171 | 171 | qp->sq.max_sg); |
| 172 | 172 | /* Note: one extra page for the header. */ |
| 173 | − qp->npages_send = 1 + (qp->sq.wqe_cnt * qp->sq.wqe_size + | |
| 174 | − PAGE_SIZE - 1) / PAGE_SIZE; | |
| 173 | + qp->npages_send = PVRDMA_QP_NUM_HEADER_PAGES + | |
| 174 | + (qp->sq.wqe_cnt * qp->sq.wqe_size + PAGE_SIZE - 1) / | |
| 175 | + PAGE_SIZE; | |
| 175 | 176 | |
| 176 | 177 | return 0; |
| 177 | 178 | } |
| @@ -288,7 +289,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd, · 110 unmodified lines | ||
| 288 | 289 | qp->npages = qp->npages_send + qp->npages_recv; |
| 289 | 290 | |
| 290 | 291 | /* Skip header page. */ |
| 291 | − qp->sq.offset = PAGE_SIZE; | |
| 292 | + qp->sq.offset = PVRDMA_QP_NUM_HEADER_PAGES * PAGE_SIZE; | |
| 292 | 293 | |
| 293 | 294 | /* Recv queue pages are after send pages. */ |
| 294 | 295 | qp->rq.offset = qp->npages_send * PAGE_SIZE; |
| @@ -341,7 +342,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd, · 46 unmodified lines | ||
| 341 | 342 | cmd->qp_type = ib_qp_type_to_pvrdma(init_attr->qp_type); |
| 342 | 343 | cmd->access_flags = IB_ACCESS_LOCAL_WRITE; |
| 343 | 344 | cmd->total_chunks = qp->npages; |
| 344 | − cmd->send_chunks = qp->npages_send - 1; | |
| 345 | + cmd->send_chunks = qp->npages_send - PVRDMA_QP_NUM_HEADER_PAGES; | |
| 345 | 346 | cmd->pdir_dma = qp->pdir.dir_dma; |
| 346 | 347 | |
| 347 | 348 | dev_dbg(&dev->pdev->dev, "create queuepair with %d, %d, %d, %d\n", |
| @@ -554,13 +555,13 @@ out: · 206 unmodified lines | ||
| 554 | 555 | return ret; |
| 555 | 556 | } |
| 556 | 557 | |
| 557 | −static inline void *get_sq_wqe(struct pvrdma_qp *qp, int n) | |
| 558 | +static inline void *get_sq_wqe(struct pvrdma_qp *qp, unsigned int n) | |
| 558 | 559 | { |
| 559 | 560 | return pvrdma_page_dir_get_ptr(&qp->pdir, |
| 560 | 561 | qp->sq.offset + n * qp->sq.wqe_size); |
| 561 | 562 | } |
| 562 | 563 | |
| 563 | −static inline void *get_rq_wqe(struct pvrdma_qp *qp, int n) | |
| 564 | +static inline void *get_rq_wqe(struct pvrdma_qp *qp, unsigned int n) | |
| 564 | 565 | { |
| 565 | 566 | return pvrdma_page_dir_get_ptr(&qp->pdir, |
| 566 | 567 | qp->rq.offset + n * qp->rq.wqe_size); |
| @@ -598,9 +599,7 @@ int pvrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 31 unmodified lines | ||
| 598 | 599 | unsigned long flags; |
| 599 | 600 | struct pvrdma_sq_wqe_hdr *wqe_hdr; |
| 600 | 601 | struct pvrdma_sge *sge; |
| 601 | − int i, index; | |
| 602 | − int nreq; | |
| 603 | − int ret; | |
| 602 | + int i, ret; | |
| 604 | 603 | |
| 605 | 604 | /* |
| 606 | 605 | * In states lower than RTS, we can fail immediately. In other states, |
| @@ -613,9 +612,8 @@ int pvrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 6 unmodified lines | ||
| 613 | 612 | |
| 614 | 613 | spin_lock_irqsave(&qp->sq.lock, flags); |
| 615 | 614 | |
| 616 | − index = pvrdma_idx(&qp->sq.ring->prod_tail, qp->sq.wqe_cnt); | |
| 617 | − for (nreq = 0; wr; nreq++, wr = wr->next) { | |
| 618 | − unsigned int tail; | |
| 615 | + while (wr) { | |
| 616 | + unsigned int tail = 0; | |
| 619 | 617 | |
| 620 | 618 | if (unlikely(!pvrdma_idx_ring_has_space( |
| 621 | 619 | qp->sq.ring, qp->sq.wqe_cnt, &tail))) { |
| @@ -680,7 +678,7 @@ int pvrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 58 unmodified lines | ||
| 680 | 678 | } |
| 681 | 679 | } |
| 682 | 680 | |
| 683 | − wqe_hdr = (struct pvrdma_sq_wqe_hdr *)get_sq_wqe(qp, index); | |
| 681 | + wqe_hdr = (struct pvrdma_sq_wqe_hdr *)get_sq_wqe(qp, tail); | |
| 684 | 682 | memset(wqe_hdr, 0, sizeof(*wqe_hdr)); |
| 685 | 683 | wqe_hdr->wr_id = wr->wr_id; |
| 686 | 684 | wqe_hdr->num_sge = wr->num_sge; |
| @@ -771,12 +769,11 @@ int pvrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · 84 unmodified lines | ||
| 771 | 769 | /* Make sure wqe is written before index update */ |
| 772 | 770 | smp_wmb(); |
| 773 | 771 | |
| 774 | − index++; | |
| 775 | − if (unlikely(index >= qp->sq.wqe_cnt)) | |
| 776 | − index = 0; | |
| 777 | 772 | /* Update shared sq ring */ |
| 778 | 773 | pvrdma_idx_ring_inc(&qp->sq.ring->prod_tail, |
| 779 | 774 | qp->sq.wqe_cnt); |
| 775 | + | |
| 776 | + wr = wr->next; | |
| 780 | 777 | } |
| 781 | 778 | |
| 782 | 779 | ret = 0; |
| @@ -806,7 +803,6 @@ int pvrdma_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 23 unmodified lines | ||
| 806 | 803 | struct pvrdma_qp *qp = to_vqp(ibqp); |
| 807 | 804 | struct pvrdma_rq_wqe_hdr *wqe_hdr; |
| 808 | 805 | struct pvrdma_sge *sge; |
| 809 | − int index, nreq; | |
| 810 | 806 | int ret = 0; |
| 811 | 807 | int i; |
| 812 | 808 | |
| @@ -821,9 +817,8 @@ int pvrdma_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 8 unmodified lines | ||
| 821 | 817 | |
| 822 | 818 | spin_lock_irqsave(&qp->rq.lock, flags); |
| 823 | 819 | |
| 824 | − index = pvrdma_idx(&qp->rq.ring->prod_tail, qp->rq.wqe_cnt); | |
| 825 | − for (nreq = 0; wr; nreq++, wr = wr->next) { | |
| 826 | − unsigned int tail; | |
| 820 | + while (wr) { | |
| 821 | + unsigned int tail = 0; | |
| 827 | 822 | |
| 828 | 823 | if (unlikely(wr->num_sge > qp->rq.max_sg || |
| 829 | 824 | wr->num_sge < 0)) { |
| @@ -843,7 +838,7 @@ int pvrdma_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 13 unmodified lines | ||
| 843 | 838 | goto out; |
| 844 | 839 | } |
| 845 | 840 | |
| 846 | − wqe_hdr = (struct pvrdma_rq_wqe_hdr *)get_rq_wqe(qp, index); | |
| 841 | + wqe_hdr = (struct pvrdma_rq_wqe_hdr *)get_rq_wqe(qp, tail); | |
| 847 | 842 | wqe_hdr->wr_id = wr->wr_id; |
| 848 | 843 | wqe_hdr->num_sge = wr->num_sge; |
| 849 | 844 | wqe_hdr->total_len = 0; |
| @@ -859,12 +854,11 @@ int pvrdma_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr, · 9 unmodified lines | ||
| 859 | 854 | /* Make sure wqe is written before index update */ |
| 860 | 855 | smp_wmb(); |
| 861 | 856 | |
| 862 | − index++; | |
| 863 | − if (unlikely(index >= qp->rq.wqe_cnt)) | |
| 864 | − index = 0; | |
| 865 | 857 | /* Update shared rq ring */ |
| 866 | 858 | pvrdma_idx_ring_inc(&qp->rq.ring->prod_tail, |
| 867 | 859 | qp->rq.wqe_cnt); |
| 860 | + | |
| 861 | + wr = wr->next; | |
| 868 | 862 | } |
| 869 | 863 | |
| 870 | 864 | spin_unlock_irqrestore(&qp->rq.lock, flags); |
| @@ -170,9 +170,9 @@ struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, · 169 unmodified lines | ||
| 170 | 170 | |
| 171 | 171 | spin_lock_irq(&rdi->mmap_offset_lock); |
| 172 | 172 | if (rdi->mmap_offset == 0) |
| 173 | − rdi->mmap_offset = PAGE_SIZE; | |
| 173 | + rdi->mmap_offset = ALIGN(PAGE_SIZE, SHMLBA); | |
| 174 | 174 | ip->offset = rdi->mmap_offset; |
| 175 | − rdi->mmap_offset += size; | |
| 175 | + rdi->mmap_offset += ALIGN(size, SHMLBA); | |
| 176 | 176 | spin_unlock_irq(&rdi->mmap_offset_lock); |
| 177 | 177 | |
| 178 | 178 | INIT_LIST_HEAD(&ip->pending_mmaps); |
| @@ -22,4 +22,4 @@ config RDMA_RXE · 21 unmodified lines | ||
| 22 | 22 | To configure and work with soft-RoCE driver please use the |
| 23 | 23 | following wiki page under "configure Soft-RoCE (RXE)" section: |
| 24 | 24 | |
| 25 | − https://github.com/SoftRoCE/rxe-dev/wiki/rxe-dev:-Home | |
| 25 | + https://github.com/linux-rdma/rdma-core/blob/master/Documentation/rxe.md | |
| @@ -156,10 +156,10 @@ struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *rxe, · 155 unmodified lines | ||
| 156 | 156 | spin_lock_bh(&rxe->mmap_offset_lock); |
| 157 | 157 | |
| 158 | 158 | if (rxe->mmap_offset == 0) |
| 159 | − rxe->mmap_offset = PAGE_SIZE; | |
| 159 | + rxe->mmap_offset = ALIGN(PAGE_SIZE, SHMLBA); | |
| 160 | 160 | |
| 161 | 161 | ip->info.offset = rxe->mmap_offset; |
| 162 | − rxe->mmap_offset += size; | |
| 162 | + rxe->mmap_offset += ALIGN(size, SHMLBA); | |
| 163 | 163 | |
| 164 | 164 | spin_unlock_bh(&rxe->mmap_offset_lock); |
| 165 | 165 | |
| @@ -729,11 +729,11 @@ next_wqe: · 728 unmodified lines | ||
| 729 | 729 | ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb); |
| 730 | 730 | if (ret) { |
| 731 | 731 | qp->need_req_skb = 1; |
| 732 | − kfree_skb(skb); | |
| 733 | 732 | |
| 734 | 733 | rollback_state(wqe, qp, &rollback_wqe, rollback_psn); |
| 735 | 734 | |
| 736 | 735 | if (ret == -EAGAIN) { |
| 736 | + kfree_skb(skb); | |
| 737 | 737 | rxe_run_task(&qp->req.task, 1); |
| 738 | 738 | goto exit; |
| 739 | 739 | } |
| @@ -813,18 +813,17 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt) · 812 unmodified lines | ||
| 813 | 813 | WARN_ON_ONCE(1); |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | − /* We successfully processed this new request. */ | |
| 817 | − qp->resp.msn++; | |
| 818 | − | |
| 819 | 816 | /* next expected psn, read handles this separately */ |
| 820 | 817 | qp->resp.psn = (pkt->psn + 1) & BTH_PSN_MASK; |
| 821 | 818 | |
| 822 | 819 | qp->resp.opcode = pkt->opcode; |
| 823 | 820 | qp->resp.status = IB_WC_SUCCESS; |
| 824 | 821 | |
| 825 | − if (pkt->mask & RXE_COMP_MASK) | |
| 822 | + if (pkt->mask & RXE_COMP_MASK) { | |
| 823 | + /* We successfully processed this new request. */ | |
| 824 | + qp->resp.msn++; | |
| 826 | 825 | return RESPST_COMPLETE; |
| 827 | − else if (qp_type(qp) == IB_QPT_RC) | |
| 826 | + } else if (qp_type(qp) == IB_QPT_RC) | |
| 828 | 827 | return RESPST_ACKNOWLEDGE; |
| 829 | 828 | else |
| 830 | 829 | return RESPST_CLEANUP; |
| @@ -430,6 +430,7 @@ struct iser_fr_desc { · 429 unmodified lines | ||
| 430 | 430 | struct list_head list; |
| 431 | 431 | struct iser_reg_resources rsc; |
| 432 | 432 | struct iser_pi_context *pi_ctx; |
| 433 | + struct list_head all_list; | |
| 433 | 434 | }; |
| 434 | 435 | |
| 435 | 436 | /** |
| @@ -443,6 +444,7 @@ struct iser_fr_pool { · 7 unmodified lines | ||
| 443 | 444 | struct list_head list; |
| 444 | 445 | spinlock_t lock; |
| 445 | 446 | int size; |
| 447 | + struct list_head all_list; | |
| 446 | 448 | }; |
| 447 | 449 | |
| 448 | 450 | /** |
| @@ -362,6 +362,7 @@ int iser_alloc_fastreg_pool(struct ib_conn *ib_conn, · 361 unmodified lines | ||
| 362 | 362 | int i, ret; |
| 363 | 363 | |
| 364 | 364 | INIT_LIST_HEAD(&fr_pool->list); |
| 365 | + INIT_LIST_HEAD(&fr_pool->all_list); | |
| 365 | 366 | spin_lock_init(&fr_pool->lock); |
| 366 | 367 | fr_pool->size = 0; |
| 367 | 368 | for (i = 0; i < cmds_max; i++) { |
| @@ -373,6 +374,7 @@ int iser_alloc_fastreg_pool(struct ib_conn *ib_conn, · 5 unmodified lines | ||
| 373 | 374 | } |
| 374 | 375 | |
| 375 | 376 | list_add_tail(&desc->list, &fr_pool->list); |
| 377 | + list_add_tail(&desc->all_list, &fr_pool->all_list); | |
| 376 | 378 | fr_pool->size++; |
| 377 | 379 | } |
| 378 | 380 | |
| @@ -392,13 +394,13 @@ void iser_free_fastreg_pool(struct ib_conn *ib_conn) · 13 unmodified lines | ||
| 392 | 394 | struct iser_fr_desc *desc, *tmp; |
| 393 | 395 | int i = 0; |
| 394 | 396 | |
| 395 | − if (list_empty(&fr_pool->list)) | |
| 397 | + if (list_empty(&fr_pool->all_list)) | |
| 396 | 398 | return; |
| 397 | 399 | |
| 398 | 400 | iser_info("freeing conn %p fr pool\n", ib_conn); |
| 399 | 401 | |
| 400 | − list_for_each_entry_safe(desc, tmp, &fr_pool->list, list) { | |
| 401 | − list_del(&desc->list); | |
| 402 | + list_for_each_entry_safe(desc, tmp, &fr_pool->all_list, all_list) { | |
| 403 | + list_del(&desc->all_list); | |
| 402 | 404 | iser_free_reg_res(&desc->rsc); |
| 403 | 405 | if (desc->pi_ctx) |
| 404 | 406 | iser_free_pi_ctx(desc->pi_ctx); |
| @@ -141,6 +141,9 @@ static int iforce_usb_probe(struct usb_interface *intf, · 140 unmodified lines | ||
| 141 | 141 | |
| 142 | 142 | interface = intf->cur_altsetting; |
| 143 | 143 | |
| 144 | + if (interface->desc.bNumEndpoints < 2) | |
| 145 | + return -ENODEV; | |
| 146 | + | |
| 144 | 147 | epirq = &interface->endpoint[0].desc; |
| 145 | 148 | epout = &interface->endpoint[1].desc; |
| 146 | 149 | |
| @@ -700,6 +700,10 @@ static int cm109_usb_probe(struct usb_interface *intf, · 699 unmodified lines | ||
| 700 | 700 | int error = -ENOMEM; |
| 701 | 701 | |
| 702 | 702 | interface = intf->cur_altsetting; |
| 703 | + | |
| 704 | + if (interface->desc.bNumEndpoints < 1) | |
| 705 | + return -ENODEV; | |
| 706 | + | |
| 703 | 707 | endpoint = &interface->endpoint[0].desc; |
| 704 | 708 | |
| 705 | 709 | if (!usb_endpoint_is_int_in(endpoint)) |
| @@ -1667,6 +1667,10 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc · 1666 unmodified lines | ||
| 1667 | 1667 | return -EINVAL; |
| 1668 | 1668 | |
| 1669 | 1669 | alt = pcu->ctrl_intf->cur_altsetting; |
| 1670 | + | |
| 1671 | + if (alt->desc.bNumEndpoints < 1) | |
| 1672 | + return -ENODEV; | |
| 1673 | + | |
| 1670 | 1674 | pcu->ep_ctrl = &alt->endpoint[0].desc; |
| 1671 | 1675 | pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl); |
| 1672 | 1676 | |
| @@ -875,6 +875,10 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) · 874 unmodified lines | ||
| 875 | 875 | int ret, pipe, i; |
| 876 | 876 | |
| 877 | 877 | interface = intf->cur_altsetting; |
| 878 | + | |
| 879 | + if (interface->desc.bNumEndpoints < 1) | |
| 880 | + return -ENODEV; | |
| 881 | + | |
| 878 | 882 | endpoint = &interface->endpoint[0].desc; |
| 879 | 883 | if (!usb_endpoint_is_int_in(endpoint)) |
| 880 | 884 | return -ENODEV; |
| @@ -1282,10 +1282,8 @@ static int alps_decode_ss4_v2(struct alps_fields *f, · 1281 unmodified lines | ||
| 1282 | 1282 | /* handle buttons */ |
| 1283 | 1283 | if (pkt_id == SS4_PACKET_ID_STICK) { |
| 1284 | 1284 | f->ts_left = !!(SS4_BTN_V2(p) & 0x01); |
| 1285 | − if (!(priv->flags & ALPS_BUTTONPAD)) { | |
| 1286 | − f->ts_right = !!(SS4_BTN_V2(p) & 0x02); | |
| 1287 | − f->ts_middle = !!(SS4_BTN_V2(p) & 0x04); | |
| 1288 | − } | |
| 1285 | + f->ts_right = !!(SS4_BTN_V2(p) & 0x02); | |
| 1286 | + f->ts_middle = !!(SS4_BTN_V2(p) & 0x04); | |
| 1289 | 1287 | } else { |
| 1290 | 1288 | f->left = !!(SS4_BTN_V2(p) & 0x01); |
| 1291 | 1289 | if (!(priv->flags & ALPS_BUTTONPAD)) { |
| @@ -2462,14 +2460,34 @@ static int alps_update_device_area_ss4_v2(unsigned char otp[][4], · 1170 unmodified lines | ||
| 2462 | 2460 | int num_y_electrode; |
| 2463 | 2461 | int x_pitch, y_pitch, x_phys, y_phys; |
| 2464 | 2462 | |
| 2465 | − num_x_electrode = SS4_NUMSENSOR_XOFFSET + (otp[1][0] & 0x0F); | |
| 2466 | − num_y_electrode = SS4_NUMSENSOR_YOFFSET + ((otp[1][0] >> 4) & 0x0F); | |
| 2463 | + if (IS_SS4PLUS_DEV(priv->dev_id)) { | |
| 2464 | + num_x_electrode = | |
| 2465 | + SS4PLUS_NUMSENSOR_XOFFSET + (otp[0][2] & 0x0F); | |
| 2466 | + num_y_electrode = | |
| 2467 | + SS4PLUS_NUMSENSOR_YOFFSET + ((otp[0][2] >> 4) & 0x0F); | |
| 2468 | + | |
| 2469 | + priv->x_max = | |
| 2470 | + (num_x_electrode - 1) * SS4PLUS_COUNT_PER_ELECTRODE; | |
| 2471 | + priv->y_max = | |
| 2472 | + (num_y_electrode - 1) * SS4PLUS_COUNT_PER_ELECTRODE; | |
| 2467 | 2473 | |
| 2468 | − priv->x_max = (num_x_electrode - 1) * SS4_COUNT_PER_ELECTRODE; | |
| 2469 | − priv->y_max = (num_y_electrode - 1) * SS4_COUNT_PER_ELECTRODE; | |
| 2474 | + x_pitch = (otp[0][1] & 0x0F) + SS4PLUS_MIN_PITCH_MM; | |
| 2475 | + y_pitch = ((otp[0][1] >> 4) & 0x0F) + SS4PLUS_MIN_PITCH_MM; | |
| 2470 | 2476 | |
| 2471 | − x_pitch = ((otp[1][2] >> 2) & 0x07) + SS4_MIN_PITCH_MM; | |
| 2472 | − y_pitch = ((otp[1][2] >> 5) & 0x07) + SS4_MIN_PITCH_MM; | |
| 2477 | + } else { | |
| 2478 | + num_x_electrode = | |
| 2479 | + SS4_NUMSENSOR_XOFFSET + (otp[1][0] & 0x0F); | |
| 2480 | + num_y_electrode = | |
| 2481 | + SS4_NUMSENSOR_YOFFSET + ((otp[1][0] >> 4) & 0x0F); | |
| 2482 | + | |
| 2483 | + priv->x_max = | |
| 2484 | + (num_x_electrode - 1) * SS4_COUNT_PER_ELECTRODE; | |
| 2485 | + priv->y_max = | |
| 2486 | + (num_y_electrode - 1) * SS4_COUNT_PER_ELECTRODE; | |
| 2487 | + | |
| 2488 | + x_pitch = ((otp[1][2] >> 2) & 0x07) + SS4_MIN_PITCH_MM; | |
| 2489 | + y_pitch = ((otp[1][2] >> 5) & 0x07) + SS4_MIN_PITCH_MM; | |
| 2490 | + } | |
| 2473 | 2491 | |
| 2474 | 2492 | x_phys = x_pitch * (num_x_electrode - 1); /* In 0.1 mm units */ |
| 2475 | 2493 | y_phys = y_pitch * (num_y_electrode - 1); /* In 0.1 mm units */ |
| @@ -2485,7 +2503,10 @@ static int alps_update_btn_info_ss4_v2(unsigned char otp[][4], · 9 unmodified lines | ||
| 2485 | 2503 | { |
| 2486 | 2504 | unsigned char is_btnless; |
| 2487 | 2505 | |
| 2488 | − is_btnless = (otp[1][1] >> 3) & 0x01; | |
| 2506 | + if (IS_SS4PLUS_DEV(priv->dev_id)) | |
| 2507 | + is_btnless = (otp[1][0] >> 1) & 0x01; | |
| 2508 | + else | |
| 2509 | + is_btnless = (otp[1][1] >> 3) & 0x01; | |
| 2489 | 2510 | |
| 2490 | 2511 | if (is_btnless) |
| 2491 | 2512 | priv->flags |= ALPS_BUTTONPAD; |
| @@ -2493,6 +2514,21 @@ static int alps_update_btn_info_ss4_v2(unsigned char otp[][4], · 1 unmodified line | ||
| 2493 | 2514 | return 0; |
| 2494 | 2515 | } |
| 2495 | 2516 | |
| 2517 | +static int alps_update_dual_info_ss4_v2(unsigned char otp[][4], | |
| 2518 | + struct alps_data *priv) | |
| 2519 | +{ | |
| 2520 | + bool is_dual = false; | |
| 2521 | + | |
| 2522 | + if (IS_SS4PLUS_DEV(priv->dev_id)) | |
| 2523 | + is_dual = (otp[0][0] >> 4) & 0x01; | |
| 2524 | + | |
| 2525 | + if (is_dual) | |
| 2526 | + priv->flags |= ALPS_DUALPOINT | | |
| 2527 | + ALPS_DUALPOINT_WITH_PRESSURE; | |
| 2528 | + | |
| 2529 | + return 0; | |
| 2530 | +} | |
| 2531 | + | |
| 2496 | 2532 | static int alps_set_defaults_ss4_v2(struct psmouse *psmouse, |
| 2497 | 2533 | struct alps_data *priv) |
| 2498 | 2534 | { |
| @@ -2508,6 +2544,8 @@ static int alps_set_defaults_ss4_v2(struct psmouse *psmouse, · 9 unmodified lines | ||
| 2508 | 2544 | |
| 2509 | 2545 | alps_update_btn_info_ss4_v2(otp, priv); |
| 2510 | 2546 | |
| 2547 | + alps_update_dual_info_ss4_v2(otp, priv); | |
| 2548 | + | |
| 2511 | 2549 | return 0; |
| 2512 | 2550 | } |
| 2513 | 2551 | |
| @@ -2753,10 +2791,6 @@ static int alps_set_protocol(struct psmouse *psmouse, · 239 unmodified lines | ||
| 2753 | 2791 | if (alps_set_defaults_ss4_v2(psmouse, priv)) |
| 2754 | 2792 | return -EIO; |
| 2755 | 2793 | |
| 2756 | − if (priv->fw_ver[1] == 0x1) | |
| 2757 | − priv->flags |= ALPS_DUALPOINT | | |
| 2758 | − ALPS_DUALPOINT_WITH_PRESSURE; | |
| 2759 | − | |
| 2760 | 2794 | break; |
| 2761 | 2795 | } |
| 2762 | 2796 | |
| @@ -2827,10 +2861,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) · 64 unmodified lines | ||
| 2827 | 2861 | ec[2] >= 0x90 && ec[2] <= 0x9d) { |
| 2828 | 2862 | protocol = &alps_v3_protocol_data; |
| 2829 | 2863 | } else if (e7[0] == 0x73 && e7[1] == 0x03 && |
| 2830 | − e7[2] == 0x14 && ec[1] == 0x02) { | |
| 2831 | − protocol = &alps_v8_protocol_data; | |
| 2832 | − } else if (e7[0] == 0x73 && e7[1] == 0x03 && | |
| 2833 | − e7[2] == 0x28 && ec[1] == 0x01) { | |
| 2864 | + (e7[2] == 0x14 || e7[2] == 0x28)) { | |
| 2834 | 2865 | protocol = &alps_v8_protocol_data; |
| 2835 | 2866 | } else { |
| 2836 | 2867 | psmouse_dbg(psmouse, |
| @@ -2840,7 +2871,8 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) · 3 unmodified lines | ||
| 2840 | 2871 | } |
| 2841 | 2872 | |
| 2842 | 2873 | if (priv) { |
| 2843 | − /* Save the Firmware version */ | |
| 2874 | + /* Save Device ID and Firmware version */ | |
| 2875 | + memcpy(priv->dev_id, e7, 3); | |
| 2844 | 2876 | memcpy(priv->fw_ver, ec, 3); |
| 2845 | 2877 | error = alps_set_protocol(psmouse, priv, protocol); |
| 2846 | 2878 | if (error) |
| @@ -54,6 +54,16 @@ enum SS4_PACKET_ID { · 53 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | #define SS4_MASK_NORMAL_BUTTONS 0x07 |
| 56 | 56 | |
| 57 | +#define SS4PLUS_COUNT_PER_ELECTRODE 128 | |
| 58 | +#define SS4PLUS_NUMSENSOR_XOFFSET 16 | |
| 59 | +#define SS4PLUS_NUMSENSOR_YOFFSET 5 | |
| 60 | +#define SS4PLUS_MIN_PITCH_MM 37 | |
| 61 | + | |
| 62 | +#define IS_SS4PLUS_DEV(_b) (((_b[0]) == 0x73) && \ | |
| 63 | + ((_b[1]) == 0x03) && \ | |
| 64 | + ((_b[2]) == 0x28) \ | |
| 65 | + ) | |
| 66 | + | |
| 57 | 67 | #define SS4_IS_IDLE_V2(_b) (((_b[0]) == 0x18) && \ |
| 58 | 68 | ((_b[1]) == 0x10) && \ |
| 59 | 69 | ((_b[2]) == 0x00) && \ |
| @@ -283,6 +293,7 @@ struct alps_data { · 223 unmodified lines | ||
| 283 | 293 | int addr_command; |
| 284 | 294 | u16 proto_version; |
| 285 | 295 | u8 byte0, mask0; |
| 296 | + u8 dev_id[3]; | |
| 286 | 297 | u8 fw_ver[3]; |
| 287 | 298 | int flags; |
| 288 | 299 | int x_max; |
| @@ -218,17 +218,19 @@ static int elan_query_product(struct elan_tp_data *data) · 217 unmodified lines | ||
| 218 | 218 | |
| 219 | 219 | static int elan_check_ASUS_special_fw(struct elan_tp_data *data) |
| 220 | 220 | { |
| 221 | − if (data->ic_type != 0x0E) | |
| 222 | − return false; | |
| 223 | − | |
| 224 | − switch (data->product_id) { | |
| 225 | − case 0x05 ... 0x07: | |
| 226 | − case 0x09: | |
| 227 | − case 0x13: | |
| 221 | + if (data->ic_type == 0x0E) { | |
| 222 | + switch (data->product_id) { | |
| 223 | + case 0x05 ... 0x07: | |
| 224 | + case 0x09: | |
| 225 | + case 0x13: | |
| 226 | + return true; | |
| 227 | + } | |
| 228 | + } else if (data->ic_type == 0x08 && data->product_id == 0x26) { | |
| 229 | + /* ASUS EeeBook X205TA */ | |
| 228 | 230 | return true; |
| 229 | − default: | |
| 230 | − return false; | |
| 231 | 231 | } |
| 232 | + | |
| 233 | + return false; | |
| 232 | 234 | } |
| 233 | 235 | |
| 234 | 236 | static int __elan_initialize(struct elan_tp_data *data) |
| @@ -170,6 +170,10 @@ static int rmi_f30_config(struct rmi_function *fn) · 169 unmodified lines | ||
| 170 | 170 | rmi_get_platform_data(fn->rmi_dev); |
| 171 | 171 | int error; |
| 172 | 172 | |
| 173 | + /* can happen if f30_data.disable is set */ | |
| 174 | + if (!f30) | |
| 175 | + return 0; | |
| 176 | + | |
| 173 | 177 | if (pdata->f30_data.trackstick_buttons) { |
| 174 | 178 | /* Try [re-]establish link to F03. */ |
| 175 | 179 | f30->f03 = rmi_find_function(fn->rmi_dev, 0x03); |
| @@ -119,6 +119,13 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { · 118 unmodified lines | ||
| 119 | 119 | DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"), |
| 120 | 120 | }, |
| 121 | 121 | }, |
| 122 | + { | |
| 123 | + /* Dell Embedded Box PC 3000 */ | |
| 124 | + .matches = { | |
| 125 | + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | |
| 126 | + DMI_MATCH(DMI_PRODUCT_NAME, "Embedded Box PC 3000"), | |
| 127 | + }, | |
| 128 | + }, | |
| 122 | 129 | { |
| 123 | 130 | /* OQO Model 01 */ |
| 124 | 131 | .matches = { |
| @@ -513,6 +520,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { · 388 unmodified lines | ||
| 513 | 520 | DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"), |
| 514 | 521 | }, |
| 515 | 522 | }, |
| 523 | + { | |
| 524 | + /* TUXEDO BU1406 */ | |
| 525 | + .matches = { | |
| 526 | + DMI_MATCH(DMI_SYS_VENDOR, "Notebook"), | |
| 527 | + DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"), | |
| 528 | + }, | |
| 529 | + }, | |
| 516 | 530 | { } |
| 517 | 531 | }; |
| 518 | 532 | |
| @@ -340,6 +340,9 @@ static int hanwang_probe(struct usb_interface *intf, const struct usb_device_id · 339 unmodified lines | ||
| 340 | 340 | int error; |
| 341 | 341 | int i; |
| 342 | 342 | |
| 343 | + if (intf->cur_altsetting->desc.bNumEndpoints < 1) | |
| 344 | + return -ENODEV; | |
| 345 | + | |
| 343 | 346 | hanwang = kzalloc(sizeof(struct hanwang), GFP_KERNEL); |
| 344 | 347 | input_dev = input_allocate_device(); |
| 345 | 348 | if (!hanwang || !input_dev) { |
| @@ -122,6 +122,9 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i · 121 unmodified lines | ||
| 122 | 122 | struct input_dev *input_dev; |
| 123 | 123 | int error = -ENOMEM; |
| 124 | 124 | |
| 125 | + if (intf->cur_altsetting->desc.bNumEndpoints < 1) | |
| 126 | + return -ENODEV; | |
| 127 | + | |
| 125 | 128 | kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL); |
| 126 | 129 | input_dev = input_allocate_device(); |
| 127 | 130 | if (!kbtab || !input_dev) |
| @@ -527,6 +527,9 @@ static int sur40_probe(struct usb_interface *interface, · 526 unmodified lines | ||
| 527 | 527 | if (iface_desc->desc.bInterfaceClass != 0xFF) |
| 528 | 528 | return -ENODEV; |
| 529 | 529 | |
| 530 | + if (iface_desc->desc.bNumEndpoints < 5) | |
| 531 | + return -ENODEV; | |
| 532 | + | |
| 530 | 533 | /* Use endpoint #4 (0x86). */ |
| 531 | 534 | endpoint = &iface_desc->endpoint[4].desc; |
| 532 | 535 | if (endpoint->bEndpointAddress != TOUCH_ENDPOINT) |
| @@ -3202,7 +3202,7 @@ static void amd_iommu_get_resv_regions(struct device *dev, · 3201 unmodified lines | ||
| 3202 | 3202 | |
| 3203 | 3203 | region = iommu_alloc_resv_region(MSI_RANGE_START, |
| 3204 | 3204 | MSI_RANGE_END - MSI_RANGE_START + 1, |
| 3205 | − 0, IOMMU_RESV_RESERVED); | |
| 3205 | + 0, IOMMU_RESV_MSI); | |
| 3206 | 3206 | if (!region) |
| 3207 | 3207 | return; |
| 3208 | 3208 | list_add_tail(®ion->list, head); |
| @@ -1888,7 +1888,7 @@ static void arm_smmu_get_resv_regions(struct device *dev, · 1887 unmodified lines | ||
| 1888 | 1888 | int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; |
| 1889 | 1889 | |
| 1890 | 1890 | region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, |
| 1891 | − prot, IOMMU_RESV_MSI); | |
| 1891 | + prot, IOMMU_RESV_SW_MSI); | |
| 1892 | 1892 | if (!region) |
| 1893 | 1893 | return; |
| 1894 | 1894 | |
| @@ -1608,7 +1608,7 @@ static void arm_smmu_get_resv_regions(struct device *dev, · 1607 unmodified lines | ||
| 1608 | 1608 | int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; |
| 1609 | 1609 | |
| 1610 | 1610 | region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, |
| 1611 | − prot, IOMMU_RESV_MSI); | |
| 1611 | + prot, IOMMU_RESV_SW_MSI); | |
| 1612 | 1612 | if (!region) |
| 1613 | 1613 | return; |
| 1614 | 1614 | |
| @@ -512,7 +512,13 @@ static void sysmmu_tlb_invalidate_flpdcache(struct sysmmu_drvdata *data, · 511 unmodified lines | ||
| 512 | 512 | spin_lock_irqsave(&data->lock, flags); |
| 513 | 513 | if (data->active && data->version >= MAKE_MMU_VER(3, 3)) { |
| 514 | 514 | clk_enable(data->clk_master); |
| 515 | − __sysmmu_tlb_invalidate_entry(data, iova, 1); | |
| 515 | + if (sysmmu_block(data)) { | |
| 516 | + if (data->version >= MAKE_MMU_VER(5, 0)) | |
| 517 | + __sysmmu_tlb_invalidate(data); | |
| 518 | + else | |
| 519 | + __sysmmu_tlb_invalidate_entry(data, iova, 1); | |
| 520 | + sysmmu_unblock(data); | |
| 521 | + } | |
| 516 | 522 | clk_disable(data->clk_master); |
| 517 | 523 | } |
| 518 | 524 | spin_unlock_irqrestore(&data->lock, flags); |
| @@ -916,7 +916,7 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf · 915 unmodified lines | ||
| 916 | 916 | * which we used for the IOMMU lookup. Strictly speaking |
| 917 | 917 | * we could do this for all PCI devices; we only need to |
| 918 | 918 | * get the BDF# from the scope table for ACPI matches. */ |
| 919 | − if (pdev->is_virtfn) | |
| 919 | + if (pdev && pdev->is_virtfn) | |
| 920 | 920 | goto got_pdev; |
| 921 | 921 | |
| 922 | 922 | *bus = drhd->devices[i].bus; |
| @@ -5249,7 +5249,7 @@ static void intel_iommu_get_resv_regions(struct device *device, · 4326 unmodified lines | ||
| 5249 | 5249 | |
| 5250 | 5250 | reg = iommu_alloc_resv_region(IOAPIC_RANGE_START, |
| 5251 | 5251 | IOAPIC_RANGE_END - IOAPIC_RANGE_START + 1, |
| 5252 | − 0, IOMMU_RESV_RESERVED); | |
| 5252 | + 0, IOMMU_RESV_MSI); | |
| 5253 | 5253 | if (!reg) |
| 5254 | 5254 | return; |
| 5255 | 5255 | list_add_tail(®->list, head); |
| @@ -422,8 +422,12 @@ static int __arm_v7s_map(struct arm_v7s_io_pgtable *data, unsigned long iova, · 421 unmodified lines | ||
| 422 | 422 | pte |= ARM_V7S_ATTR_NS_TABLE; |
| 423 | 423 | |
| 424 | 424 | __arm_v7s_set_pte(ptep, pte, 1, cfg); |
| 425 | − } else { | |
| 425 | + } else if (ARM_V7S_PTE_IS_TABLE(pte, lvl)) { | |
| 426 | 426 | cptep = iopte_deref(pte, lvl); |
| 427 | + } else { | |
| 428 | + /* We require an unmap first */ | |
| 429 | + WARN_ON(!selftest_running); | |
| 430 | + return -EEXIST; | |
| 427 | 431 | } |
| 428 | 432 | |
| 429 | 433 | /* Rinse, repeat */ |
| @@ -335,8 +335,12 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova, · 334 unmodified lines | ||
| 335 | 335 | if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS) |
| 336 | 336 | pte |= ARM_LPAE_PTE_NSTABLE; |
| 337 | 337 | __arm_lpae_set_pte(ptep, pte, cfg); |
| 338 | − } else { | |
| 338 | + } else if (!iopte_leaf(pte, lvl)) { | |
| 339 | 339 | cptep = iopte_deref(pte, data); |
| 340 | + } else { | |
| 341 | + /* We require an unmap first */ | |
| 342 | + WARN_ON(!selftest_running); | |
| 343 | + return -EEXIST; | |
| 340 | 344 | } |
| 341 | 345 | |
| 342 | 346 | /* Rinse, repeat */ |
| @@ -72,6 +72,7 @@ static const char * const iommu_group_resv_type_string[] = { · 71 unmodified lines | ||
| 72 | 72 | [IOMMU_RESV_DIRECT] = "direct", |
| 73 | 73 | [IOMMU_RESV_RESERVED] = "reserved", |
| 74 | 74 | [IOMMU_RESV_MSI] = "msi", |
| 75 | + [IOMMU_RESV_SW_MSI] = "msi", | |
| 75 | 76 | }; |
| 76 | 77 | |
| 77 | 78 | #define IOMMU_GROUP_ATTR(_name, _mode, _show, _store) \ |
| @@ -1743,8 +1744,8 @@ void iommu_put_resv_regions(struct device *dev, struct list_head *list) · 1665 unmodified lines | ||
| 1743 | 1744 | } |
| 1744 | 1745 | |
| 1745 | 1746 | struct iommu_resv_region *iommu_alloc_resv_region(phys_addr_t start, |
| 1746 | − size_t length, | |
| 1747 | − int prot, int type) | |
| 1747 | + size_t length, int prot, | |
| 1748 | + enum iommu_resv_type type) | |
| 1748 | 1749 | { |
| 1749 | 1750 | struct iommu_resv_region *region; |
| 1750 | 1751 | |
| @@ -321,7 +321,7 @@ static const struct of_device_id vdoa_dt_ids[] = { · 320 unmodified lines | ||
| 321 | 321 | }; |
| 322 | 322 | MODULE_DEVICE_TABLE(of, vdoa_dt_ids); |
| 323 | 323 | |
| 324 | −static const struct platform_driver vdoa_driver = { | |
| 324 | +static struct platform_driver vdoa_driver = { | |
| 325 | 325 | .probe = vdoa_probe, |
| 326 | 326 | .remove = vdoa_remove, |
| 327 | 327 | .driver = { |
| @@ -861,9 +861,7 @@ int gsc_prepare_addr(struct gsc_ctx *ctx, struct vb2_buffer *vb, · 860 unmodified lines | ||
| 861 | 861 | |
| 862 | 862 | if ((frame->fmt->pixelformat == V4L2_PIX_FMT_VYUY) || |
| 863 | 863 | (frame->fmt->pixelformat == V4L2_PIX_FMT_YVYU) || |
| 864 | − (frame->fmt->pixelformat == V4L2_PIX_FMT_NV61) || | |
| 865 | 864 | (frame->fmt->pixelformat == V4L2_PIX_FMT_YVU420) || |
| 866 | − (frame->fmt->pixelformat == V4L2_PIX_FMT_NV21) || | |
| 867 | 865 | (frame->fmt->pixelformat == V4L2_PIX_FMT_YVU420M)) |
| 868 | 866 | swap(addr->cb, addr->cr); |
| 869 | 867 | |
| @@ -632,8 +632,8 @@ static int bdisp_open(struct file *file) · 631 unmodified lines | ||
| 632 | 632 | |
| 633 | 633 | error_ctrls: |
| 634 | 634 | bdisp_ctrls_delete(ctx); |
| 635 | −error_fh: | |
| 636 | 635 | v4l2_fh_del(&ctx->fh); |
| 636 | +error_fh: | |
| 637 | 637 | v4l2_fh_exit(&ctx->fh); |
| 638 | 638 | bdisp_hw_free_nodes(ctx); |
| 639 | 639 | mem_ctx: |
| @@ -36,16 +36,18 @@ static int usb_cypress_writemem(struct usb_device *udev,u16 addr,u8 *data, u8 le · 35 unmodified lines | ||
| 36 | 36 | int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type) |
| 37 | 37 | { |
| 38 | 38 | struct hexline *hx; |
| 39 | − u8 reset; | |
| 40 | − int ret,pos=0; | |
| 39 | + u8 *buf; | |
| 40 | + int ret, pos = 0; | |
| 41 | + u16 cpu_cs_register = cypress[type].cpu_cs_register; | |
| 41 | 42 | |
| 42 | − hx = kmalloc(sizeof(*hx), GFP_KERNEL); | |
| 43 | − if (!hx) | |
| 43 | + buf = kmalloc(sizeof(*hx), GFP_KERNEL); | |
| 44 | + if (!buf) | |
| 44 | 45 | return -ENOMEM; |
| 46 | + hx = (struct hexline *)buf; | |
| 45 | 47 | |
| 46 | 48 | /* stop the CPU */ |
| 47 | − reset = 1; | |
| 48 | − if ((ret = usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1)) != 1) | |
| 49 | + buf[0] = 1; | |
| 50 | + if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1) | |
| 49 | 51 | err("could not stop the USB controller CPU."); |
| 50 | 52 | |
| 51 | 53 | while ((ret = dvb_usb_get_hexline(fw, hx, &pos)) > 0) { |
| @@ -61,21 +63,21 @@ int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw · 9 unmodified lines | ||
| 61 | 63 | } |
| 62 | 64 | if (ret < 0) { |
| 63 | 65 | err("firmware download failed at %d with %d",pos,ret); |
| 64 | − kfree(hx); | |
| 66 | + kfree(buf); | |
| 65 | 67 | return ret; |
| 66 | 68 | } |
| 67 | 69 | |
| 68 | 70 | if (ret == 0) { |
| 69 | 71 | /* restart the CPU */ |
| 70 | − reset = 0; | |
| 71 | − if (ret || usb_cypress_writemem(udev,cypress[type].cpu_cs_register,&reset,1) != 1) { | |
| 72 | + buf[0] = 0; | |
| 73 | + if (usb_cypress_writemem(udev, cpu_cs_register, buf, 1) != 1) { | |
| 72 | 74 | err("could not restart the USB controller CPU."); |
| 73 | 75 | ret = -EINVAL; |
| 74 | 76 | } |
| 75 | 77 | } else |
| 76 | 78 | ret = -EIO; |
| 77 | 79 | |
| 78 | − kfree(hx); | |
| 80 | + kfree(buf); | |
| 79 | 81 | |
| 80 | 82 | return ret; |
| 81 | 83 | } |
| @@ -1947,9 +1947,7 @@ static int gpmc_probe_onenand_child(struct platform_device *pdev, · 1946 unmodified lines | ||
| 1947 | 1947 | if (!of_property_read_u32(child, "dma-channel", &val)) |
| 1948 | 1948 | gpmc_onenand_data->dma_channel = val; |
| 1949 | 1949 | |
| 1950 | − gpmc_onenand_init(gpmc_onenand_data); | |
| 1951 | − | |
| 1952 | − return 0; | |
| 1950 | + return gpmc_onenand_init(gpmc_onenand_data); | |
| 1953 | 1951 | } |
| 1954 | 1952 | #else |
| 1955 | 1953 | static int gpmc_probe_onenand_child(struct platform_device *pdev, |
| @@ -1792,15 +1792,14 @@ static pci_ers_result_t cxl_pci_error_detected(struct pci_dev *pdev, · 1791 unmodified lines | ||
| 1792 | 1792 | |
| 1793 | 1793 | /* If we're permanently dead, give up. */ |
| 1794 | 1794 | if (state == pci_channel_io_perm_failure) { |
| 1795 | − /* Tell the AFU drivers; but we don't care what they | |
| 1796 | − * say, we're going away. | |
| 1797 | − */ | |
| 1798 | 1795 | for (i = 0; i < adapter->slices; i++) { |
| 1799 | 1796 | afu = adapter->afu[i]; |
| 1800 | − /* Only participate in EEH if we are on a virtual PHB */ | |
| 1801 | − if (afu->phb == NULL) | |
| 1802 | − return PCI_ERS_RESULT_NONE; | |
| 1803 | − cxl_vphb_error_detected(afu, state); | |
| 1797 | + /* | |
| 1798 | + * Tell the AFU drivers; but we don't care what they | |
| 1799 | + * say, we're going away. | |
| 1800 | + */ | |
| 1801 | + if (afu->phb != NULL) | |
| 1802 | + cxl_vphb_error_detected(afu, state); | |
| 1804 | 1803 | } |
| 1805 | 1804 | return PCI_ERS_RESULT_DISCONNECT; |
| 1806 | 1805 | } |
| @@ -112,11 +112,9 @@ struct mkhi_msg { · 111 unmodified lines | ||
| 112 | 112 | |
| 113 | 113 | static int mei_osver(struct mei_cl_device *cldev) |
| 114 | 114 | { |
| 115 | − int ret; | |
| 116 | 115 | const size_t size = sizeof(struct mkhi_msg_hdr) + |
| 117 | 116 | sizeof(struct mkhi_fwcaps) + |
| 118 | 117 | sizeof(struct mei_os_ver); |
| 119 | − size_t length = 8; | |
| 120 | 118 | char buf[size]; |
| 121 | 119 | struct mkhi_msg *req; |
| 122 | 120 | struct mkhi_fwcaps *fwcaps; |
| @@ -137,15 +135,7 @@ static int mei_osver(struct mei_cl_device *cldev) · 14 unmodified lines | ||
| 137 | 135 | os_ver = (struct mei_os_ver *)fwcaps->data; |
| 138 | 136 | os_ver->os_type = OSTYPE_LINUX; |
| 139 | 137 | |
| 140 | − ret = __mei_cl_send(cldev->cl, buf, size, mode); | |
| 141 | − if (ret < 0) | |
| 142 | − return ret; | |
| 143 | − | |
| 144 | − ret = __mei_cl_recv(cldev->cl, buf, length, 0); | |
| 145 | − if (ret < 0) | |
| 146 | − return ret; | |
| 147 | − | |
| 148 | − return 0; | |
| 138 | + return __mei_cl_send(cldev->cl, buf, size, mode); | |
| 149 | 139 | } |
| 150 | 140 | |
| 151 | 141 | static void mei_mkhi_fix(struct mei_cl_device *cldev) |
| @@ -160,7 +150,7 @@ static void mei_mkhi_fix(struct mei_cl_device *cldev) · 8 unmodified lines | ||
| 160 | 150 | return; |
| 161 | 151 | |
| 162 | 152 | ret = mei_osver(cldev); |
| 163 | − if (ret) | |
| 153 | + if (ret < 0) | |
| 164 | 154 | dev_err(&cldev->dev, "OS version command failed %d\n", ret); |
| 165 | 155 | |
| 166 | 156 | mei_cldev_disable(cldev); |
| @@ -124,8 +124,6 @@ int mei_reset(struct mei_device *dev) · 123 unmodified lines | ||
| 124 | 124 | |
| 125 | 125 | mei_clear_interrupts(dev); |
| 126 | 126 | |
| 127 | − mei_synchronize_irq(dev); | |
| 128 | − | |
| 129 | 127 | /* we're already in reset, cancel the init timer |
| 130 | 128 | * if the reset was called due the hbm protocol error |
| 131 | 129 | * we need to call it before hw start |
| @@ -304,6 +302,9 @@ static void mei_reset_work(struct work_struct *work) · 172 unmodified lines | ||
| 304 | 302 | container_of(work, struct mei_device, reset_work); |
| 305 | 303 | int ret; |
| 306 | 304 | |
| 305 | + mei_clear_interrupts(dev); | |
| 306 | + mei_synchronize_irq(dev); | |
| 307 | + | |
| 307 | 308 | mutex_lock(&dev->device_lock); |
| 308 | 309 | |
| 309 | 310 | ret = mei_reset(dev); |
| @@ -328,6 +329,9 @@ void mei_stop(struct mei_device *dev) · 18 unmodified lines | ||
| 328 | 329 | |
| 329 | 330 | mei_cancel_work(dev); |
| 330 | 331 | |
| 332 | + mei_clear_interrupts(dev); | |
| 333 | + mei_synchronize_irq(dev); | |
| 334 | + | |
| 331 | 335 | mutex_lock(&dev->device_lock); |
| 332 | 336 | |
| 333 | 337 | dev->dev_state = MEI_DEV_POWER_DOWN; |
| @@ -566,10 +566,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, · 565 unmodified lines | ||
| 566 | 566 | */ |
| 567 | 567 | error = pci_alloc_irq_vectors(pdev, VMCI_MAX_INTRS, VMCI_MAX_INTRS, |
| 568 | 568 | PCI_IRQ_MSIX); |
| 569 | − if (error) { | |
| 569 | + if (error < 0) { | |
| 570 | 570 | error = pci_alloc_irq_vectors(pdev, 1, 1, |
| 571 | 571 | PCI_IRQ_MSIX | PCI_IRQ_MSI | PCI_IRQ_LEGACY); |
| 572 | − if (error) | |
| 572 | + if (error < 0) | |
| 573 | 573 | goto err_remove_bitmap; |
| 574 | 574 | } else { |
| 575 | 575 | vmci_dev->exclusive_vectors = true; |
| @@ -1560,11 +1560,8 @@ static bool mmc_blk_rw_cmd_err(struct mmc_blk_data *md, struct mmc_card *card, · 1559 unmodified lines | ||
| 1560 | 1560 | struct mmc_blk_request *brq, struct request *req, |
| 1561 | 1561 | bool old_req_pending) |
| 1562 | 1562 | { |
| 1563 | − struct mmc_queue_req *mq_rq; | |
| 1564 | 1563 | bool req_pending; |
| 1565 | 1564 | |
| 1566 | − mq_rq = container_of(brq, struct mmc_queue_req, brq); | |
| 1567 | − | |
| 1568 | 1565 | /* |
| 1569 | 1566 | * If this is an SD card and we're writing, we can first |
| 1570 | 1567 | * mark the known good sectors as ok. |
| @@ -1701,7 +1698,8 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req) · 130 unmodified lines | ||
| 1701 | 1698 | case MMC_BLK_CMD_ERR: |
| 1702 | 1699 | req_pending = mmc_blk_rw_cmd_err(md, card, brq, old_req, req_pending); |
| 1703 | 1700 | if (mmc_blk_reset(md, card->host, type)) { |
| 1704 | − mmc_blk_rw_cmd_abort(card, old_req); | |
| 1701 | + if (req_pending) | |
| 1702 | + mmc_blk_rw_cmd_abort(card, old_req); | |
| 1705 | 1703 | mmc_blk_rw_try_restart(mq, new_req); |
| 1706 | 1704 | return; |
| 1707 | 1705 | } |
| @@ -1817,6 +1815,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) · 109 unmodified lines | ||
| 1817 | 1815 | mmc_blk_issue_flush(mq, req); |
| 1818 | 1816 | } else { |
| 1819 | 1817 | mmc_blk_issue_rw_rq(mq, req); |
| 1818 | + card->host->context_info.is_waiting_last_req = false; | |
| 1820 | 1819 | } |
| 1821 | 1820 | |
| 1822 | 1821 | out: |
| @@ -1730,7 +1730,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, · 1729 unmodified lines | ||
| 1730 | 1730 | err = mmc_select_hs400(card); |
| 1731 | 1731 | if (err) |
| 1732 | 1732 | goto free_card; |
| 1733 | − } else { | |
| 1733 | + } else if (!mmc_card_hs400es(card)) { | |
| 1734 | 1734 | /* Select the desired bus width optionally */ |
| 1735 | 1735 | err = mmc_select_bus_width(card); |
| 1736 | 1736 | if (err > 0 && mmc_card_hs(card)) { |
| @@ -580,7 +580,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) · 579 unmodified lines | ||
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | sdr_set_field(host->base + MSDC_CFG, MSDC_CFG_CKMOD | MSDC_CFG_CKDIV, |
| 583 | − (mode << 8) | (div % 0xff)); | |
| 583 | + (mode << 8) | div); | |
| 584 | 584 | sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_CKPDN); |
| 585 | 585 | while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB)) |
| 586 | 586 | cpu_relax(); |
| @@ -1559,7 +1559,7 @@ static int msdc_drv_probe(struct platform_device *pdev) · 972 unmodified lines | ||
| 1559 | 1559 | host->src_clk_freq = clk_get_rate(host->src_clk); |
| 1560 | 1560 | /* Set host parameters to mmc */ |
| 1561 | 1561 | mmc->ops = &mt_msdc_ops; |
| 1562 | − mmc->f_min = host->src_clk_freq / (4 * 255); | |
| 1562 | + mmc->f_min = DIV_ROUND_UP(host->src_clk_freq, 4 * 255); | |
| 1563 | 1563 | |
| 1564 | 1564 | mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23; |
| 1565 | 1565 | /* MMC core transfer sizes tunable parameters */ |
| @@ -28,13 +28,9 @@ · 27 unmodified lines | ||
| 28 | 28 | #include "sdhci-pltfm.h" |
| 29 | 29 | #include <linux/of.h> |
| 30 | 30 | |
| 31 | −#define SDHCI_ARASAN_CLK_CTRL_OFFSET 0x2c | |
| 32 | 31 | #define SDHCI_ARASAN_VENDOR_REGISTER 0x78 |
| 33 | 32 | |
| 34 | 33 | #define VENDOR_ENHANCED_STROBE BIT(0) |
| 35 | −#define CLK_CTRL_TIMEOUT_SHIFT 16 | |
| 36 | −#define CLK_CTRL_TIMEOUT_MASK (0xf << CLK_CTRL_TIMEOUT_SHIFT) | |
| 37 | −#define CLK_CTRL_TIMEOUT_MIN_EXP 13 | |
| 38 | 34 | |
| 39 | 35 | #define PHY_CLK_TOO_SLOW_HZ 400000 |
| 40 | 36 | |
| @@ -163,15 +159,15 @@ static int sdhci_arasan_syscon_write(struct sdhci_host *host, · 122 unmodified lines | ||
| 163 | 159 | |
| 164 | 160 | static unsigned int sdhci_arasan_get_timeout_clock(struct sdhci_host *host) |
| 165 | 161 | { |
| 166 | − u32 div; | |
| 167 | 162 | unsigned long freq; |
| 168 | 163 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
| 169 | 164 | |
| 170 | − div = readl(host->ioaddr + SDHCI_ARASAN_CLK_CTRL_OFFSET); | |
| 171 | − div = (div & CLK_CTRL_TIMEOUT_MASK) >> CLK_CTRL_TIMEOUT_SHIFT; | |
| 165 | + /* SDHCI timeout clock is in kHz */ | |
| 166 | + freq = DIV_ROUND_UP(clk_get_rate(pltfm_host->clk), 1000); | |
| 172 | 167 | |
| 173 | − freq = clk_get_rate(pltfm_host->clk); | |
| 174 | − freq /= 1 << (CLK_CTRL_TIMEOUT_MIN_EXP + div); | |
| 168 | + /* or in MHz */ | |
| 169 | + if (host->caps & SDHCI_TIMEOUT_CLK_UNIT) | |
| 170 | + freq = DIV_ROUND_UP(freq, 1000); | |
| 175 | 171 | |
| 176 | 172 | return freq; |
| 177 | 173 | } |
| @@ -85,11 +85,30 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock) · 84 unmodified lines | ||
| 85 | 85 | sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | +/* | |
| 89 | + * In this specific implementation of the SDHCI controller, the power register | |
| 90 | + * needs to have a valid voltage set even when the power supply is managed by | |
| 91 | + * an external regulator. | |
| 92 | + */ | |
| 93 | +static void sdhci_at91_set_power(struct sdhci_host *host, unsigned char mode, | |
| 94 | + unsigned short vdd) | |
| 95 | +{ | |
| 96 | + if (!IS_ERR(host->mmc->supply.vmmc)) { | |
| 97 | + struct mmc_host *mmc = host->mmc; | |
| 98 | + | |
| 99 | + spin_unlock_irq(&host->lock); | |
| 100 | + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); | |
| 101 | + spin_lock_irq(&host->lock); | |
| 102 | + } | |
| 103 | + sdhci_set_power_noreg(host, mode, vdd); | |
| 104 | +} | |
| 105 | + | |
| 88 | 106 | static const struct sdhci_ops sdhci_at91_sama5d2_ops = { |
| 89 | 107 | .set_clock = sdhci_at91_set_clock, |
| 90 | 108 | .set_bus_width = sdhci_set_bus_width, |
| 91 | 109 | .reset = sdhci_reset, |
| 92 | 110 | .set_uhs_signaling = sdhci_set_uhs_signaling, |
| 111 | + .set_power = sdhci_at91_set_power, | |
| 93 | 112 | }; |
| 94 | 113 | |
| 95 | 114 | static const struct sdhci_pltfm_data soc_data_sama5d2 = { |
| @@ -451,6 +451,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, · 450 unmodified lines | ||
| 451 | 451 | if (mode == MMC_POWER_OFF) |
| 452 | 452 | return; |
| 453 | 453 | |
| 454 | + spin_unlock_irq(&host->lock); | |
| 455 | + | |
| 454 | 456 | /* |
| 455 | 457 | * Bus power might not enable after D3 -> D0 transition due to the |
| 456 | 458 | * present state not yet having propagated. Retry for up to 2ms. |
| @@ -463,6 +465,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode, · 6 unmodified lines | ||
| 463 | 465 | reg |= SDHCI_POWER_ON; |
| 464 | 466 | sdhci_writeb(host, reg, SDHCI_POWER_CONTROL); |
| 465 | 467 | } |
| 468 | + | |
| 469 | + spin_lock_irq(&host->lock); | |
| 466 | 470 | } |
| 467 | 471 | |
| 468 | 472 | static const struct sdhci_ops sdhci_intel_byt_ops = { |
| @@ -1362,7 +1362,9 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk) · 1361 unmodified lines | ||
| 1362 | 1362 | return; |
| 1363 | 1363 | } |
| 1364 | 1364 | timeout--; |
| 1365 | − mdelay(1); | |
| 1365 | + spin_unlock_irq(&host->lock); | |
| 1366 | + usleep_range(900, 1100); | |
| 1367 | + spin_lock_irq(&host->lock); | |
| 1366 | 1368 | } |
| 1367 | 1369 | |
| 1368 | 1370 | clk |= SDHCI_CLOCK_CARD_EN; |
| @@ -426,6 +426,9 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id · 425 unmodified lines | ||
| 426 | 426 | struct ushc_data *ushc; |
| 427 | 427 | int ret; |
| 428 | 428 | |
| 429 | + if (intf->cur_altsetting->desc.bNumEndpoints < 1) | |
| 430 | + return -ENODEV; | |
| 431 | + | |
| 429 | 432 | mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev); |
| 430 | 433 | if (mmc == NULL) |
| 431 | 434 | return -ENOMEM; |
| @@ -984,29 +984,29 @@ · 983 unmodified lines | ||
| 984 | 984 | #define XP_ECC_CNT1_DESC_DED_WIDTH 8 |
| 985 | 985 | #define XP_ECC_CNT1_DESC_SEC_INDEX 0 |
| 986 | 986 | #define XP_ECC_CNT1_DESC_SEC_WIDTH 8 |
| 987 | −#define XP_ECC_IER_DESC_DED_INDEX 0 | |
| 987 | +#define XP_ECC_IER_DESC_DED_INDEX 5 | |
| 988 | 988 | #define XP_ECC_IER_DESC_DED_WIDTH 1 |
| 989 | −#define XP_ECC_IER_DESC_SEC_INDEX 1 | |
| 989 | +#define XP_ECC_IER_DESC_SEC_INDEX 4 | |
| 990 | 990 | #define XP_ECC_IER_DESC_SEC_WIDTH 1 |
| 991 | −#define XP_ECC_IER_RX_DED_INDEX 2 | |
| 991 | +#define XP_ECC_IER_RX_DED_INDEX 3 | |
| 992 | 992 | #define XP_ECC_IER_RX_DED_WIDTH 1 |
| 993 | −#define XP_ECC_IER_RX_SEC_INDEX 3 | |
| 993 | +#define XP_ECC_IER_RX_SEC_INDEX 2 | |
| 994 | 994 | #define XP_ECC_IER_RX_SEC_WIDTH 1 |
| 995 | −#define XP_ECC_IER_TX_DED_INDEX 4 | |
| 995 | +#define XP_ECC_IER_TX_DED_INDEX 1 | |
| 996 | 996 | #define XP_ECC_IER_TX_DED_WIDTH 1 |
| 997 | −#define XP_ECC_IER_TX_SEC_INDEX 5 | |
| 997 | +#define XP_ECC_IER_TX_SEC_INDEX 0 | |
| 998 | 998 | #define XP_ECC_IER_TX_SEC_WIDTH 1 |
| 999 | −#define XP_ECC_ISR_DESC_DED_INDEX 0 | |
| 999 | +#define XP_ECC_ISR_DESC_DED_INDEX 5 | |
| 1000 | 1000 | #define XP_ECC_ISR_DESC_DED_WIDTH 1 |
| 1001 | −#define XP_ECC_ISR_DESC_SEC_INDEX 1 | |
| 1001 | +#define XP_ECC_ISR_DESC_SEC_INDEX 4 | |
| 1002 | 1002 | #define XP_ECC_ISR_DESC_SEC_WIDTH 1 |
| 1003 | −#define XP_ECC_ISR_RX_DED_INDEX 2 | |
| 1003 | +#define XP_ECC_ISR_RX_DED_INDEX 3 | |
| 1004 | 1004 | #define XP_ECC_ISR_RX_DED_WIDTH 1 |
| 1005 | −#define XP_ECC_ISR_RX_SEC_INDEX 3 | |
| 1005 | +#define XP_ECC_ISR_RX_SEC_INDEX 2 | |
| 1006 | 1006 | #define XP_ECC_ISR_RX_SEC_WIDTH 1 |
| 1007 | −#define XP_ECC_ISR_TX_DED_INDEX 4 | |
| 1007 | +#define XP_ECC_ISR_TX_DED_INDEX 1 | |
| 1008 | 1008 | #define XP_ECC_ISR_TX_DED_WIDTH 1 |
| 1009 | −#define XP_ECC_ISR_TX_SEC_INDEX 5 | |
| 1009 | +#define XP_ECC_ISR_TX_SEC_INDEX 0 | |
| 1010 | 1010 | #define XP_ECC_ISR_TX_SEC_WIDTH 1 |
| 1011 | 1011 | #define XP_I2C_MUTEX_BUSY_INDEX 31 |
| 1012 | 1012 | #define XP_I2C_MUTEX_BUSY_WIDTH 1 |
| @@ -1148,8 +1148,8 @@ · 135 unmodified lines | ||
| 1148 | 1148 | #define RX_PACKET_ATTRIBUTES_CSUM_DONE_WIDTH 1 |
| 1149 | 1149 | #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX 1 |
| 1150 | 1150 | #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH 1 |
| 1151 | −#define RX_PACKET_ATTRIBUTES_INCOMPLETE_INDEX 2 | |
| 1152 | −#define RX_PACKET_ATTRIBUTES_INCOMPLETE_WIDTH 1 | |
| 1151 | +#define RX_PACKET_ATTRIBUTES_LAST_INDEX 2 | |
| 1152 | +#define RX_PACKET_ATTRIBUTES_LAST_WIDTH 1 | |
| 1153 | 1153 | #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_INDEX 3 |
| 1154 | 1154 | #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_WIDTH 1 |
| 1155 | 1155 | #define RX_PACKET_ATTRIBUTES_CONTEXT_INDEX 4 |
| @@ -1158,6 +1158,8 @@ · 2 unmodified lines | ||
| 1158 | 1158 | #define RX_PACKET_ATTRIBUTES_RX_TSTAMP_WIDTH 1 |
| 1159 | 1159 | #define RX_PACKET_ATTRIBUTES_RSS_HASH_INDEX 6 |
| 1160 | 1160 | #define RX_PACKET_ATTRIBUTES_RSS_HASH_WIDTH 1 |
| 1161 | +#define RX_PACKET_ATTRIBUTES_FIRST_INDEX 7 | |
| 1162 | +#define RX_PACKET_ATTRIBUTES_FIRST_WIDTH 1 | |
| 1161 | 1163 | |
| 1162 | 1164 | #define RX_NORMAL_DESC0_OVT_INDEX 0 |
| 1163 | 1165 | #define RX_NORMAL_DESC0_OVT_WIDTH 16 |
| @@ -1896,10 +1896,15 @@ static int xgbe_dev_read(struct xgbe_channel *channel) · 1895 unmodified lines | ||
| 1896 | 1896 | |
| 1897 | 1897 | /* Get the header length */ |
| 1898 | 1898 | if (XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, FD)) { |
| 1899 | + XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, | |
| 1900 | + FIRST, 1); | |
| 1899 | 1901 | rdata->rx.hdr_len = XGMAC_GET_BITS_LE(rdesc->desc2, |
| 1900 | 1902 | RX_NORMAL_DESC2, HL); |
| 1901 | 1903 | if (rdata->rx.hdr_len) |
| 1902 | 1904 | pdata->ext_stats.rx_split_header_packets++; |
| 1905 | + } else { | |
| 1906 | + XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, | |
| 1907 | + FIRST, 0); | |
| 1903 | 1908 | } |
| 1904 | 1909 | |
| 1905 | 1910 | /* Get the RSS hash */ |
| @@ -1922,19 +1927,16 @@ static int xgbe_dev_read(struct xgbe_channel *channel) · 16 unmodified lines | ||
| 1922 | 1927 | } |
| 1923 | 1928 | } |
| 1924 | 1929 | |
| 1925 | − /* Get the packet length */ | |
| 1926 | − rdata->rx.len = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, PL); | |
| 1927 | − | |
| 1928 | − if (!XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, LD)) { | |
| 1929 | − /* Not all the data has been transferred for this packet */ | |
| 1930 | − XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, | |
| 1931 | − INCOMPLETE, 1); | |
| 1930 | + /* Not all the data has been transferred for this packet */ | |
| 1931 | + if (!XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, LD)) | |
| 1932 | 1932 | return 0; |
| 1933 | − } | |
| 1934 | 1933 | |
| 1935 | 1934 | /* This is the last of the data for this packet */ |
| 1936 | 1935 | XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, |
| 1937 | − INCOMPLETE, 0); | |
| 1936 | + LAST, 1); | |
| 1937 | + | |
| 1938 | + /* Get the packet length */ | |
| 1939 | + rdata->rx.len = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, PL); | |
| 1938 | 1940 | |
| 1939 | 1941 | /* Set checksum done indicator as appropriate */ |
| 1940 | 1942 | if (netdev->features & NETIF_F_RXCSUM) |
| @@ -1971,13 +1971,12 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata, · 1970 unmodified lines | ||
| 1971 | 1971 | { |
| 1972 | 1972 | struct sk_buff *skb; |
| 1973 | 1973 | u8 *packet; |
| 1974 | − unsigned int copy_len; | |
| 1975 | 1974 | |
| 1976 | 1975 | skb = napi_alloc_skb(napi, rdata->rx.hdr.dma_len); |
| 1977 | 1976 | if (!skb) |
| 1978 | 1977 | return NULL; |
| 1979 | 1978 | |
| 1980 | − /* Start with the header buffer which may contain just the header | |
| 1979 | + /* Pull in the header buffer which may contain just the header | |
| 1981 | 1980 | * or the header plus data |
| 1982 | 1981 | */ |
| 1983 | 1982 | dma_sync_single_range_for_cpu(pdata->dev, rdata->rx.hdr.dma_base, |
| @@ -1986,30 +1985,49 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata, · 2 unmodified lines | ||
| 1986 | 1985 | |
| 1987 | 1986 | packet = page_address(rdata->rx.hdr.pa.pages) + |
| 1988 | 1987 | rdata->rx.hdr.pa.pages_offset; |
| 1989 | − copy_len = (rdata->rx.hdr_len) ? rdata->rx.hdr_len : len; | |
| 1990 | − copy_len = min(rdata->rx.hdr.dma_len, copy_len); | |
| 1991 | − skb_copy_to_linear_data(skb, packet, copy_len); | |
| 1992 | − skb_put(skb, copy_len); | |
| 1993 | − | |
| 1994 | − len -= copy_len; | |
| 1995 | − if (len) { | |
| 1996 | − /* Add the remaining data as a frag */ | |
| 1997 | − dma_sync_single_range_for_cpu(pdata->dev, | |
| 1998 | − rdata->rx.buf.dma_base, | |
| 1999 | − rdata->rx.buf.dma_off, | |
| 2000 | − rdata->rx.buf.dma_len, | |
| 2001 | − DMA_FROM_DEVICE); | |
| 2002 | − | |
| 2003 | − skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | |
| 2004 | − rdata->rx.buf.pa.pages, | |
| 2005 | − rdata->rx.buf.pa.pages_offset, | |
| 2006 | − len, rdata->rx.buf.dma_len); | |
| 2007 | − rdata->rx.buf.pa.pages = NULL; | |
| 2008 | − } | |
| 1988 | + skb_copy_to_linear_data(skb, packet, len); | |
| 1989 | + skb_put(skb, len); | |
| 2009 | 1990 | |
| 2010 | 1991 | return skb; |
| 2011 | 1992 | } |
| 2012 | 1993 | |
| 1994 | +static unsigned int xgbe_rx_buf1_len(struct xgbe_ring_data *rdata, | |
| 1995 | + struct xgbe_packet_data *packet) | |
| 1996 | +{ | |
| 1997 | + /* Always zero if not the first descriptor */ | |
| 1998 | + if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, FIRST)) | |
| 1999 | + return 0; | |
| 2000 | + | |
| 2001 | + /* First descriptor with split header, return header length */ | |
| 2002 | + if (rdata->rx.hdr_len) | |
| 2003 | + return rdata->rx.hdr_len; | |
| 2004 | + | |
| 2005 | + /* First descriptor but not the last descriptor and no split header, | |
| 2006 | + * so the full buffer was used | |
| 2007 | + */ | |
| 2008 | + if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST)) | |
| 2009 | + return rdata->rx.hdr.dma_len; | |
| 2010 | + | |
| 2011 | + /* First descriptor and last descriptor and no split header, so | |
| 2012 | + * calculate how much of the buffer was used | |
| 2013 | + */ | |
| 2014 | + return min_t(unsigned int, rdata->rx.hdr.dma_len, rdata->rx.len); | |
| 2015 | +} | |
| 2016 | + | |
| 2017 | +static unsigned int xgbe_rx_buf2_len(struct xgbe_ring_data *rdata, | |
| 2018 | + struct xgbe_packet_data *packet, | |
| 2019 | + unsigned int len) | |
| 2020 | +{ | |
| 2021 | + /* Always the full buffer if not the last descriptor */ | |
| 2022 | + if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST)) | |
| 2023 | + return rdata->rx.buf.dma_len; | |
| 2024 | + | |
| 2025 | + /* Last descriptor so calculate how much of the buffer was used | |
| 2026 | + * for the last bit of data | |
| 2027 | + */ | |
| 2028 | + return rdata->rx.len - len; | |
| 2029 | +} | |
| 2030 | + | |
| 2013 | 2031 | static int xgbe_tx_poll(struct xgbe_channel *channel) |
| 2014 | 2032 | { |
| 2015 | 2033 | struct xgbe_prv_data *pdata = channel->pdata; |
| @@ -2092,8 +2110,8 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) · 76 unmodified lines | ||
| 2092 | 2110 | struct napi_struct *napi; |
| 2093 | 2111 | struct sk_buff *skb; |
| 2094 | 2112 | struct skb_shared_hwtstamps *hwtstamps; |
| 2095 | − unsigned int incomplete, error, context_next, context; | |
| 2096 | − unsigned int len, rdesc_len, max_len; | |
| 2113 | + unsigned int last, error, context_next, context; | |
| 2114 | + unsigned int len, buf1_len, buf2_len, max_len; | |
| 2097 | 2115 | unsigned int received = 0; |
| 2098 | 2116 | int packet_count = 0; |
| 2099 | 2117 | |
| @@ -2103,7 +2121,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) · 3 unmodified lines | ||
| 2103 | 2121 | if (!ring) |
| 2104 | 2122 | return 0; |
| 2105 | 2123 | |
| 2106 | − incomplete = 0; | |
| 2124 | + last = 0; | |
| 2107 | 2125 | context_next = 0; |
| 2108 | 2126 | |
| 2109 | 2127 | napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi; |
| @@ -2137,9 +2155,8 @@ read_again: · 27 unmodified lines | ||
| 2137 | 2155 | received++; |
| 2138 | 2156 | ring->cur++; |
| 2139 | 2157 | |
| 2140 | − incomplete = XGMAC_GET_BITS(packet->attributes, | |
| 2141 | − RX_PACKET_ATTRIBUTES, | |
| 2142 | − INCOMPLETE); | |
| 2158 | + last = XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, | |
| 2159 | + LAST); | |
| 2143 | 2160 | context_next = XGMAC_GET_BITS(packet->attributes, |
| 2144 | 2161 | RX_PACKET_ATTRIBUTES, |
| 2145 | 2162 | CONTEXT_NEXT); |
| @@ -2148,7 +2165,7 @@ read_again: · 2 unmodified lines | ||
| 2148 | 2165 | CONTEXT); |
| 2149 | 2166 | |
| 2150 | 2167 | /* Earlier error, just drain the remaining data */ |
| 2151 | − if ((incomplete || context_next) && error) | |
| 2168 | + if ((!last || context_next) && error) | |
| 2152 | 2169 | goto read_again; |
| 2153 | 2170 | |
| 2154 | 2171 | if (error || packet->errors) { |
| @@ -2160,16 +2177,22 @@ read_again: · 5 unmodified lines | ||
| 2160 | 2177 | } |
| 2161 | 2178 | |
| 2162 | 2179 | if (!context) { |
| 2163 | − /* Length is cumulative, get this descriptor's length */ | |
| 2164 | − rdesc_len = rdata->rx.len - len; | |
| 2165 | − len += rdesc_len; | |
| 2180 | + /* Get the data length in the descriptor buffers */ | |
| 2181 | + buf1_len = xgbe_rx_buf1_len(rdata, packet); | |
| 2182 | + len += buf1_len; | |
| 2183 | + buf2_len = xgbe_rx_buf2_len(rdata, packet, len); | |
| 2184 | + len += buf2_len; | |
| 2166 | 2185 | |
| 2167 | − if (rdesc_len && !skb) { | |
| 2186 | + if (!skb) { | |
| 2168 | 2187 | skb = xgbe_create_skb(pdata, napi, rdata, |
| 2169 | − rdesc_len); | |
| 2170 | − if (!skb) | |
| 2188 | + buf1_len); | |
| 2189 | + if (!skb) { | |
| 2171 | 2190 | error = 1; |
| 2172 | − } else if (rdesc_len) { | |
| 2191 | + goto skip_data; | |
| 2192 | + } | |
| 2193 | + } | |
| 2194 | + | |
| 2195 | + if (buf2_len) { | |
| 2173 | 2196 | dma_sync_single_range_for_cpu(pdata->dev, |
| 2174 | 2197 | rdata->rx.buf.dma_base, |
| 2175 | 2198 | rdata->rx.buf.dma_off, |
| @@ -2179,13 +2202,14 @@ read_again: · 3 unmodified lines | ||
| 2179 | 2202 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
| 2180 | 2203 | rdata->rx.buf.pa.pages, |
| 2181 | 2204 | rdata->rx.buf.pa.pages_offset, |
| 2182 | − rdesc_len, | |
| 2205 | + buf2_len, | |
| 2183 | 2206 | rdata->rx.buf.dma_len); |
| 2184 | 2207 | rdata->rx.buf.pa.pages = NULL; |
| 2185 | 2208 | } |
| 2186 | 2209 | } |
| 2187 | 2210 | |
| 2188 | − if (incomplete || context_next) | |
| 2211 | +skip_data: | |
| 2212 | + if (!last || context_next) | |
| 2189 | 2213 | goto read_again; |
| 2190 | 2214 | |
| 2191 | 2215 | if (!skb) |
| @@ -2243,7 +2267,7 @@ next_packet: · 51 unmodified lines | ||
| 2243 | 2267 | } |
| 2244 | 2268 | |
| 2245 | 2269 | /* Check if we need to save state before leaving */ |
| 2246 | − if (received && (incomplete || context_next)) { | |
| 2270 | + if (received && (!last || context_next)) { | |
| 2247 | 2271 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); |
| 2248 | 2272 | rdata->state_saved = 1; |
| 2249 | 2273 | rdata->state.skb = skb; |
| @@ -98,6 +98,7 @@ static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu) · 97 unmodified lines | ||
| 98 | 98 | |
| 99 | 99 | if (err < 0) |
| 100 | 100 | goto err_exit; |
| 101 | + ndev->mtu = new_mtu; | |
| 101 | 102 | |
| 102 | 103 | if (netif_running(ndev)) { |
| 103 | 104 | aq_ndev_close(ndev); |
| @@ -137,6 +137,7 @@ static struct aq_hw_caps_s hw_atl_a0_hw_caps_ = { · 136 unmodified lines | ||
| 137 | 137 | .tx_rings = HW_ATL_A0_TX_RINGS, |
| 138 | 138 | .rx_rings = HW_ATL_A0_RX_RINGS, |
| 139 | 139 | .hw_features = NETIF_F_HW_CSUM | |
| 140 | + NETIF_F_RXCSUM | | |
| 140 | 141 | NETIF_F_RXHASH | |
| 141 | 142 | NETIF_F_SG | |
| 142 | 143 | NETIF_F_TSO, |
| @@ -188,6 +188,7 @@ static struct aq_hw_caps_s hw_atl_b0_hw_caps_ = { · 187 unmodified lines | ||
| 188 | 188 | .tx_rings = HW_ATL_B0_TX_RINGS, |
| 189 | 189 | .rx_rings = HW_ATL_B0_RX_RINGS, |
| 190 | 190 | .hw_features = NETIF_F_HW_CSUM | |
| 191 | + NETIF_F_RXCSUM | | |
| 191 | 192 | NETIF_F_RXHASH | |
| 192 | 193 | NETIF_F_SG | |
| 193 | 194 | NETIF_F_TSO | |
| @@ -3481,7 +3481,8 @@ static int bcmgenet_suspend(struct device *d) · 3480 unmodified lines | ||
| 3481 | 3481 | |
| 3482 | 3482 | bcmgenet_netif_stop(dev); |
| 3483 | 3483 | |
| 3484 | − phy_suspend(priv->phydev); | |
| 3484 | + if (!device_may_wakeup(d)) | |
| 3485 | + phy_suspend(priv->phydev); | |
| 3485 | 3486 | |
| 3486 | 3487 | netif_device_detach(dev); |
| 3487 | 3488 | |
| @@ -3578,7 +3579,8 @@ static int bcmgenet_resume(struct device *d) · 90 unmodified lines | ||
| 3578 | 3579 | |
| 3579 | 3580 | netif_device_attach(dev); |
| 3580 | 3581 | |
| 3581 | − phy_resume(priv->phydev); | |
| 3582 | + if (!device_may_wakeup(d)) | |
| 3583 | + phy_resume(priv->phydev); | |
| 3582 | 3584 | |
| 3583 | 3585 | if (priv->eee.eee_enabled) |
| 3584 | 3586 | bcmgenet_eee_enable_set(dev, true); |
| @@ -220,20 +220,6 @@ void bcmgenet_phy_power_set(struct net_device *dev, bool enable) · 219 unmodified lines | ||
| 220 | 220 | udelay(60); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | −static void bcmgenet_internal_phy_setup(struct net_device *dev) | |
| 224 | −{ | |
| 225 | − struct bcmgenet_priv *priv = netdev_priv(dev); | |
| 226 | − u32 reg; | |
| 227 | − | |
| 228 | − /* Power up PHY */ | |
| 229 | − bcmgenet_phy_power_set(dev, true); | |
| 230 | − /* enable APD */ | |
| 231 | − reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); | |
| 232 | − reg |= EXT_PWR_DN_EN_LD; | |
| 233 | − bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); | |
| 234 | − bcmgenet_mii_reset(dev); | |
| 235 | −} | |
| 236 | − | |
| 237 | 223 | static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv) |
| 238 | 224 | { |
| 239 | 225 | u32 reg; |
| @@ -281,7 +267,6 @@ int bcmgenet_mii_config(struct net_device *dev) · 41 unmodified lines | ||
| 281 | 267 | |
| 282 | 268 | if (priv->internal_phy) { |
| 283 | 269 | phy_name = "internal PHY"; |
| 284 | − bcmgenet_internal_phy_setup(dev); | |
| 285 | 270 | } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) { |
| 286 | 271 | phy_name = "MoCA"; |
| 287 | 272 | bcmgenet_moca_phy_setup(priv); |
| @@ -325,7 +325,7 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, · 324 unmodified lines | ||
| 325 | 325 | return PTR_ERR(kern_buf); |
| 326 | 326 | |
| 327 | 327 | rc = sscanf(kern_buf, "%x:%x", &addr, &len); |
| 328 | − if (rc < 2) { | |
| 328 | + if (rc < 2 || len > UINT_MAX >> 2) { | |
| 329 | 329 | netdev_warn(bnad->netdev, "failed to read user buffer\n"); |
| 330 | 330 | kfree(kern_buf); |
| 331 | 331 | return -EINVAL; |
| @@ -1257,6 +1257,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter) · 1256 unmodified lines | ||
| 1257 | 1257 | release_sub_crq_queue(adapter, |
| 1258 | 1258 | adapter->tx_scrq[i]); |
| 1259 | 1259 | } |
| 1260 | + kfree(adapter->tx_scrq); | |
| 1260 | 1261 | adapter->tx_scrq = NULL; |
| 1261 | 1262 | } |
| 1262 | 1263 | |
| @@ -1269,6 +1270,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter) · 6 unmodified lines | ||
| 1269 | 1270 | release_sub_crq_queue(adapter, |
| 1270 | 1271 | adapter->rx_scrq[i]); |
| 1271 | 1272 | } |
| 1273 | + kfree(adapter->rx_scrq); | |
| 1272 | 1274 | adapter->rx_scrq = NULL; |
| 1273 | 1275 | } |
| 1274 | 1276 | } |
| @@ -2305,6 +2305,17 @@ static int sync_toggles(struct mlx4_dev *dev) · 2304 unmodified lines | ||
| 2305 | 2305 | rd_toggle = swab32(readl(&priv->mfunc.comm->slave_read)); |
| 2306 | 2306 | if (wr_toggle == 0xffffffff || rd_toggle == 0xffffffff) { |
| 2307 | 2307 | /* PCI might be offline */ |
| 2308 | + | |
| 2309 | + /* If device removal has been requested, | |
| 2310 | + * do not continue retrying. | |
| 2311 | + */ | |
| 2312 | + if (dev->persist->interface_state & | |
| 2313 | + MLX4_INTERFACE_STATE_NOWAIT) { | |
| 2314 | + mlx4_warn(dev, | |
| 2315 | + "communication channel is offline\n"); | |
| 2316 | + return -EIO; | |
| 2317 | + } | |
| 2318 | + | |
| 2308 | 2319 | msleep(100); |
| 2309 | 2320 | wr_toggle = swab32(readl(&priv->mfunc.comm-> |
| 2310 | 2321 | slave_write)); |
| @@ -1940,6 +1940,14 @@ static int mlx4_comm_check_offline(struct mlx4_dev *dev) · 1939 unmodified lines | ||
| 1940 | 1940 | (u32)(1 << COMM_CHAN_OFFLINE_OFFSET)); |
| 1941 | 1941 | if (!offline_bit) |
| 1942 | 1942 | return 0; |
| 1943 | + | |
| 1944 | + /* If device removal has been requested, | |
| 1945 | + * do not continue retrying. | |
| 1946 | + */ | |
| 1947 | + if (dev->persist->interface_state & | |
| 1948 | + MLX4_INTERFACE_STATE_NOWAIT) | |
| 1949 | + break; | |
| 1950 | + | |
| 1943 | 1951 | /* There are cases as part of AER/Reset flow that PF needs |
| 1944 | 1952 | * around 100 msec to load. We therefore sleep for 100 msec |
| 1945 | 1953 | * to allow other tasks to make use of that CPU during this |
| @@ -3955,6 +3963,9 @@ static void mlx4_remove_one(struct pci_dev *pdev) · 2009 unmodified lines | ||
| 3955 | 3963 | struct devlink *devlink = priv_to_devlink(priv); |
| 3956 | 3964 | int active_vfs = 0; |
| 3957 | 3965 | |
| 3966 | + if (mlx4_is_slave(dev)) | |
| 3967 | + persist->interface_state |= MLX4_INTERFACE_STATE_NOWAIT; | |
| 3968 | + | |
| 3958 | 3969 | mutex_lock(&persist->interface_state_mutex); |
| 3959 | 3970 | persist->interface_state |= MLX4_INTERFACE_STATE_DELETION; |
| 3960 | 3971 | mutex_unlock(&persist->interface_state_mutex); |
| @@ -361,6 +361,8 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op, · 360 unmodified lines | ||
| 361 | 361 | case MLX5_CMD_OP_QUERY_VPORT_COUNTER: |
| 362 | 362 | case MLX5_CMD_OP_ALLOC_Q_COUNTER: |
| 363 | 363 | case MLX5_CMD_OP_QUERY_Q_COUNTER: |
| 364 | + case MLX5_CMD_OP_SET_RATE_LIMIT: | |
| 365 | + case MLX5_CMD_OP_QUERY_RATE_LIMIT: | |
| 364 | 366 | case MLX5_CMD_OP_ALLOC_PD: |
| 365 | 367 | case MLX5_CMD_OP_ALLOC_UAR: |
| 366 | 368 | case MLX5_CMD_OP_CONFIG_INT_MODERATION: |
| @@ -497,6 +499,8 @@ const char *mlx5_command_str(int command) · 130 unmodified lines | ||
| 497 | 499 | MLX5_COMMAND_STR_CASE(ALLOC_Q_COUNTER); |
| 498 | 500 | MLX5_COMMAND_STR_CASE(DEALLOC_Q_COUNTER); |
| 499 | 501 | MLX5_COMMAND_STR_CASE(QUERY_Q_COUNTER); |
| 502 | + MLX5_COMMAND_STR_CASE(SET_RATE_LIMIT); | |
| 503 | + MLX5_COMMAND_STR_CASE(QUERY_RATE_LIMIT); | |
| 500 | 504 | MLX5_COMMAND_STR_CASE(ALLOC_PD); |
| 501 | 505 | MLX5_COMMAND_STR_CASE(DEALLOC_PD); |
| 502 | 506 | MLX5_COMMAND_STR_CASE(ALLOC_UAR); |
| @@ -928,10 +928,6 @@ void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, struct mlx5e_priv *priv); · 927 unmodified lines | ||
| 928 | 928 | int mlx5e_attach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev); |
| 929 | 929 | void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev); |
| 930 | 930 | u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout); |
| 931 | −void mlx5e_add_vxlan_port(struct net_device *netdev, | |
| 932 | − struct udp_tunnel_info *ti); | |
| 933 | −void mlx5e_del_vxlan_port(struct net_device *netdev, | |
| 934 | − struct udp_tunnel_info *ti); | |
| 935 | 931 | |
| 936 | 932 | int mlx5e_get_offload_stats(int attr_id, const struct net_device *dev, |
| 937 | 933 | void *sp); |
| @@ -3100,8 +3100,8 @@ static int mlx5e_get_vf_stats(struct net_device *dev, · 3099 unmodified lines | ||
| 3100 | 3100 | vf_stats); |
| 3101 | 3101 | } |
| 3102 | 3102 | |
| 3103 | −void mlx5e_add_vxlan_port(struct net_device *netdev, | |
| 3104 | − struct udp_tunnel_info *ti) | |
| 3103 | +static void mlx5e_add_vxlan_port(struct net_device *netdev, | |
| 3104 | + struct udp_tunnel_info *ti) | |
| 3105 | 3105 | { |
| 3106 | 3106 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| 3107 | 3107 | |
| @@ -3114,8 +3114,8 @@ void mlx5e_add_vxlan_port(struct net_device *netdev, · 6 unmodified lines | ||
| 3114 | 3114 | mlx5e_vxlan_queue_work(priv, ti->sa_family, be16_to_cpu(ti->port), 1); |
| 3115 | 3115 | } |
| 3116 | 3116 | |
| 3117 | −void mlx5e_del_vxlan_port(struct net_device *netdev, | |
| 3118 | − struct udp_tunnel_info *ti) | |
| 3117 | +static void mlx5e_del_vxlan_port(struct net_device *netdev, | |
| 3118 | + struct udp_tunnel_info *ti) | |
| 3119 | 3119 | { |
| 3120 | 3120 | struct mlx5e_priv *priv = netdev_priv(netdev); |
| 3121 | 3121 | |
| @@ -393,8 +393,6 @@ static const struct net_device_ops mlx5e_netdev_ops_rep = { · 392 unmodified lines | ||
| 393 | 393 | .ndo_get_phys_port_name = mlx5e_rep_get_phys_port_name, |
| 394 | 394 | .ndo_setup_tc = mlx5e_rep_ndo_setup_tc, |
| 395 | 395 | .ndo_get_stats64 = mlx5e_rep_get_stats, |
| 396 | − .ndo_udp_tunnel_add = mlx5e_add_vxlan_port, | |
| 397 | − .ndo_udp_tunnel_del = mlx5e_del_vxlan_port, | |
| 398 | 396 | .ndo_has_offload_stats = mlx5e_has_offload_stats, |
| 399 | 397 | .ndo_get_offload_stats = mlx5e_get_offload_stats, |
| 400 | 398 | }; |
| @@ -601,6 +601,10 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe, · 600 unmodified lines | ||
| 601 | 601 | if (lro_num_seg > 1) { |
| 602 | 602 | mlx5e_lro_update_hdr(skb, cqe, cqe_bcnt); |
| 603 | 603 | skb_shinfo(skb)->gso_size = DIV_ROUND_UP(cqe_bcnt, lro_num_seg); |
| 604 | + /* Subtract one since we already counted this as one | |
| 605 | + * "regular" packet in mlx5e_complete_rx_cqe() | |
| 606 | + */ | |
| 607 | + rq->stats.packets += lro_num_seg - 1; | |
| 604 | 608 | rq->stats.lro_packets++; |
| 605 | 609 | rq->stats.lro_bytes += cqe_bcnt; |
| 606 | 610 | } |
| @@ -133,6 +133,23 @@ err_create_ft: · 132 unmodified lines | ||
| 133 | 133 | return rule; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | +static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv, | |
| 137 | + struct mlx5e_tc_flow *flow) | |
| 138 | +{ | |
| 139 | + struct mlx5_fc *counter = NULL; | |
| 140 | + | |
| 141 | + if (!IS_ERR(flow->rule)) { | |
| 142 | + counter = mlx5_flow_rule_counter(flow->rule); | |
| 143 | + mlx5_del_flow_rules(flow->rule); | |
| 144 | + mlx5_fc_destroy(priv->mdev, counter); | |
| 145 | + } | |
| 146 | + | |
| 147 | + if (!mlx5e_tc_num_filters(priv) && (priv->fs.tc.t)) { | |
| 148 | + mlx5_destroy_flow_table(priv->fs.tc.t); | |
| 149 | + priv->fs.tc.t = NULL; | |
| 150 | + } | |
| 151 | +} | |
| 152 | + | |
| 136 | 153 | static struct mlx5_flow_handle * |
| 137 | 154 | mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, |
| 138 | 155 | struct mlx5_flow_spec *spec, |
| @@ -149,7 +166,24 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 10 unmodified lines | ||
| 149 | 166 | } |
| 150 | 167 | |
| 151 | 168 | static void mlx5e_detach_encap(struct mlx5e_priv *priv, |
| 152 | − struct mlx5e_tc_flow *flow) { | |
| 169 | + struct mlx5e_tc_flow *flow); | |
| 170 | + | |
| 171 | +static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, | |
| 172 | + struct mlx5e_tc_flow *flow) | |
| 173 | +{ | |
| 174 | + struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; | |
| 175 | + | |
| 176 | + mlx5_eswitch_del_offloaded_rule(esw, flow->rule, flow->attr); | |
| 177 | + | |
| 178 | + mlx5_eswitch_del_vlan_action(esw, flow->attr); | |
| 179 | + | |
| 180 | + if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) | |
| 181 | + mlx5e_detach_encap(priv, flow); | |
| 182 | +} | |
| 183 | + | |
| 184 | +static void mlx5e_detach_encap(struct mlx5e_priv *priv, | |
| 185 | + struct mlx5e_tc_flow *flow) | |
| 186 | +{ | |
| 153 | 187 | struct list_head *next = flow->encap.next; |
| 154 | 188 | |
| 155 | 189 | list_del(&flow->encap); |
| @@ -173,25 +207,10 @@ static void mlx5e_detach_encap(struct mlx5e_priv *priv, · 17 unmodified lines | ||
| 173 | 207 | static void mlx5e_tc_del_flow(struct mlx5e_priv *priv, |
| 174 | 208 | struct mlx5e_tc_flow *flow) |
| 175 | 209 | { |
| 176 | − struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; | |
| 177 | − struct mlx5_fc *counter = NULL; | |
| 178 | − | |
| 179 | − if (!IS_ERR(flow->rule)) { | |
| 180 | − counter = mlx5_flow_rule_counter(flow->rule); | |
| 181 | − mlx5_del_flow_rules(flow->rule); | |
| 182 | − mlx5_fc_destroy(priv->mdev, counter); | |
| 183 | − } | |
| 184 | − | |
| 185 | − if (flow->flags & MLX5E_TC_FLOW_ESWITCH) { | |
| 186 | − mlx5_eswitch_del_vlan_action(esw, flow->attr); | |
| 187 | − if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) | |
| 188 | − mlx5e_detach_encap(priv, flow); | |
| 189 | − } | |
| 190 | − | |
| 191 | − if (!mlx5e_tc_num_filters(priv) && (priv->fs.tc.t)) { | |
| 192 | − mlx5_destroy_flow_table(priv->fs.tc.t); | |
| 193 | − priv->fs.tc.t = NULL; | |
| 194 | − } | |
| 210 | + if (flow->flags & MLX5E_TC_FLOW_ESWITCH) | |
| 211 | + mlx5e_tc_del_fdb_flow(priv, flow); | |
| 212 | + else | |
| 213 | + mlx5e_tc_del_nic_flow(priv, flow); | |
| 195 | 214 | } |
| 196 | 215 | |
| 197 | 216 | static void parse_vxlan_attr(struct mlx5_flow_spec *spec, |
| @@ -248,12 +267,15 @@ static int parse_tunnel_attr(struct mlx5e_priv *priv, · 50 unmodified lines | ||
| 248 | 267 | skb_flow_dissector_target(f->dissector, |
| 249 | 268 | FLOW_DISSECTOR_KEY_ENC_PORTS, |
| 250 | 269 | f->mask); |
| 270 | + struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; | |
| 271 | + struct net_device *up_dev = mlx5_eswitch_get_uplink_netdev(esw); | |
| 272 | + struct mlx5e_priv *up_priv = netdev_priv(up_dev); | |
| 251 | 273 | |
| 252 | 274 | /* Full udp dst port must be given */ |
| 253 | 275 | if (memchr_inv(&mask->dst, 0xff, sizeof(mask->dst))) |
| 254 | 276 | goto vxlan_match_offload_err; |
| 255 | 277 | |
| 256 | − if (mlx5e_vxlan_lookup_port(priv, be16_to_cpu(key->dst)) && | |
| 278 | + if (mlx5e_vxlan_lookup_port(up_priv, be16_to_cpu(key->dst)) && | |
| 257 | 279 | MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap)) |
| 258 | 280 | parse_vxlan_attr(spec, f); |
| 259 | 281 | else { |
| @@ -976,6 +998,8 @@ static int mlx5e_attach_encap(struct mlx5e_priv *priv, · 716 unmodified lines | ||
| 976 | 998 | struct mlx5_esw_flow_attr *attr) |
| 977 | 999 | { |
| 978 | 1000 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; |
| 1001 | + struct net_device *up_dev = mlx5_eswitch_get_uplink_netdev(esw); | |
| 1002 | + struct mlx5e_priv *up_priv = netdev_priv(up_dev); | |
| 979 | 1003 | unsigned short family = ip_tunnel_info_af(tun_info); |
| 980 | 1004 | struct ip_tunnel_key *key = &tun_info->key; |
| 981 | 1005 | struct mlx5_encap_entry *e; |
| @@ -996,7 +1020,7 @@ vxlan_encap_offload_err: · 14 unmodified lines | ||
| 996 | 1020 | return -EOPNOTSUPP; |
| 997 | 1021 | } |
| 998 | 1022 | |
| 999 | − if (mlx5e_vxlan_lookup_port(priv, be16_to_cpu(key->tp_dst)) && | |
| 1023 | + if (mlx5e_vxlan_lookup_port(up_priv, be16_to_cpu(key->tp_dst)) && | |
| 1000 | 1024 | MLX5_CAP_ESW(priv->mdev, vxlan_encap_decap)) { |
| 1001 | 1025 | tunnel_type = MLX5_HEADER_TYPE_VXLAN; |
| 1002 | 1026 | } else { |
| @@ -1112,14 +1136,16 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, · 109 unmodified lines | ||
| 1112 | 1136 | } |
| 1113 | 1137 | |
| 1114 | 1138 | if (is_tcf_vlan(a)) { |
| 1115 | − if (tcf_vlan_action(a) == VLAN_F_POP) { | |
| 1139 | + if (tcf_vlan_action(a) == TCA_VLAN_ACT_POP) { | |
| 1116 | 1140 | attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP; |
| 1117 | − } else if (tcf_vlan_action(a) == VLAN_F_PUSH) { | |
| 1141 | + } else if (tcf_vlan_action(a) == TCA_VLAN_ACT_PUSH) { | |
| 1118 | 1142 | if (tcf_vlan_push_proto(a) != htons(ETH_P_8021Q)) |
| 1119 | 1143 | return -EOPNOTSUPP; |
| 1120 | 1144 | |
| 1121 | 1145 | attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH; |
| 1122 | 1146 | attr->vlan = tcf_vlan_push_vid(a); |
| 1147 | + } else { /* action is TCA_VLAN_ACT_MODIFY */ | |
| 1148 | + return -EOPNOTSUPP; | |
| 1123 | 1149 | } |
| 1124 | 1150 | continue; |
| 1125 | 1151 | } |
| @@ -274,15 +274,18 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) · 273 unmodified lines | ||
| 274 | 274 | sq->stats.tso_bytes += skb->len - ihs; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | + sq->stats.packets += skb_shinfo(skb)->gso_segs; | |
| 277 | 278 | num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs; |
| 278 | 279 | } else { |
| 279 | 280 | bf = sq->bf_budget && |
| 280 | 281 | !skb->xmit_more && |
| 281 | 282 | !skb_shinfo(skb)->nr_frags; |
| 282 | 283 | ihs = mlx5e_get_inline_hdr_size(sq, skb, bf); |
| 284 | + sq->stats.packets++; | |
| 283 | 285 | num_bytes = max_t(unsigned int, skb->len, ETH_ZLEN); |
| 284 | 286 | } |
| 285 | 287 | |
| 288 | + sq->stats.bytes += num_bytes; | |
| 286 | 289 | wi->num_bytes = num_bytes; |
| 287 | 290 | |
| 288 | 291 | ds_cnt = sizeof(*wqe) / MLX5_SEND_WQE_DS; |
| @@ -381,8 +384,6 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) · 92 unmodified lines | ||
| 381 | 384 | if (bf) |
| 382 | 385 | sq->bf_budget--; |
| 383 | 386 | |
| 384 | − sq->stats.packets++; | |
| 385 | − sq->stats.bytes += num_bytes; | |
| 386 | 387 | return NETDEV_TX_OK; |
| 387 | 388 | |
| 388 | 389 | dma_unmap_wqe_err: |
| @@ -209,6 +209,7 @@ struct mlx5_esw_offload { · 208 unmodified lines | ||
| 209 | 209 | struct mlx5_eswitch_rep *vport_reps; |
| 210 | 210 | DECLARE_HASHTABLE(encap_tbl, 8); |
| 211 | 211 | u8 inline_mode; |
| 212 | + u64 num_flows; | |
| 212 | 213 | }; |
| 213 | 214 | |
| 214 | 215 | struct mlx5_eswitch { |
| @@ -271,6 +272,11 @@ struct mlx5_flow_handle * · 56 unmodified lines | ||
| 271 | 272 | mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, |
| 272 | 273 | struct mlx5_flow_spec *spec, |
| 273 | 274 | struct mlx5_esw_flow_attr *attr); |
| 275 | +void | |
| 276 | +mlx5_eswitch_del_offloaded_rule(struct mlx5_eswitch *esw, | |
| 277 | + struct mlx5_flow_handle *rule, | |
| 278 | + struct mlx5_esw_flow_attr *attr); | |
| 279 | + | |
| 274 | 280 | struct mlx5_flow_handle * |
| 275 | 281 | mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport, u32 tirn); |
| 276 | 282 | |
| @@ -93,10 +93,27 @@ mlx5_eswitch_add_offloaded_rule(struct mlx5_eswitch *esw, · 92 unmodified lines | ||
| 93 | 93 | spec, &flow_act, dest, i); |
| 94 | 94 | if (IS_ERR(rule)) |
| 95 | 95 | mlx5_fc_destroy(esw->dev, counter); |
| 96 | + else | |
| 97 | + esw->offloads.num_flows++; | |
| 96 | 98 | |
| 97 | 99 | return rule; |
| 98 | 100 | } |
| 99 | 101 | |
| 102 | +void | |
| 103 | +mlx5_eswitch_del_offloaded_rule(struct mlx5_eswitch *esw, | |
| 104 | + struct mlx5_flow_handle *rule, | |
| 105 | + struct mlx5_esw_flow_attr *attr) | |
| 106 | +{ | |
| 107 | + struct mlx5_fc *counter = NULL; | |
| 108 | + | |
| 109 | + if (!IS_ERR(rule)) { | |
| 110 | + counter = mlx5_flow_rule_counter(rule); | |
| 111 | + mlx5_del_flow_rules(rule); | |
| 112 | + mlx5_fc_destroy(esw->dev, counter); | |
| 113 | + esw->offloads.num_flows--; | |
| 114 | + } | |
| 115 | +} | |
| 116 | + | |
| 100 | 117 | static int esw_set_global_vlan_pop(struct mlx5_eswitch *esw, u8 val) |
| 101 | 118 | { |
| 102 | 119 | struct mlx5_eswitch_rep *rep; |
| @@ -908,6 +925,11 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode) · 805 unmodified lines | ||
| 908 | 925 | MLX5_CAP_INLINE_MODE_VPORT_CONTEXT) |
| 909 | 926 | return -EOPNOTSUPP; |
| 910 | 927 | |
| 928 | + if (esw->offloads.num_flows > 0) { | |
| 929 | + esw_warn(dev, "Can't set inline mode when flows are configured\n"); | |
| 930 | + return -EOPNOTSUPP; | |
| 931 | + } | |
| 932 | + | |
| 911 | 933 | err = esw_inline_mode_from_devlink(mode, &mlx5_mode); |
| 912 | 934 | if (err) |
| 913 | 935 | goto out; |
| @@ -87,7 +87,7 @@ static struct mlx5_profile profile[] = { · 86 unmodified lines | ||
| 87 | 87 | [2] = { |
| 88 | 88 | .mask = MLX5_PROF_MASK_QP_SIZE | |
| 89 | 89 | MLX5_PROF_MASK_MR_CACHE, |
| 90 | − .log_max_qp = 17, | |
| 90 | + .log_max_qp = 18, | |
| 91 | 91 | .mr_cache[0] = { |
| 92 | 92 | .size = 500, |
| 93 | 93 | .limit = 250 |
| @@ -2404,7 +2404,7 @@ static void efx_udp_tunnel_del(struct net_device *dev, struct udp_tunnel_info *t · 2403 unmodified lines | ||
| 2404 | 2404 | tnl.type = (u16)efx_tunnel_type; |
| 2405 | 2405 | tnl.port = ti->port; |
| 2406 | 2406 | |
| 2407 | − if (efx->type->udp_tnl_add_port) | |
| 2407 | + if (efx->type->udp_tnl_del_port) | |
| 2408 | 2408 | (void)efx->type->udp_tnl_del_port(efx, tnl); |
| 2409 | 2409 | } |
| 2410 | 2410 | |
| @@ -74,15 +74,21 @@ config TI_CPSW · 73 unmodified lines | ||
| 74 | 74 | will be called cpsw. |
| 75 | 75 | |
| 76 | 76 | config TI_CPTS |
| 77 | − tristate "TI Common Platform Time Sync (CPTS) Support" | |
| 77 | + bool "TI Common Platform Time Sync (CPTS) Support" | |
| 78 | 78 | depends on TI_CPSW || TI_KEYSTONE_NETCP |
| 79 | − imply PTP_1588_CLOCK | |
| 79 | + depends on PTP_1588_CLOCK | |
| 80 | 80 | ---help--- |
| 81 | 81 | This driver supports the Common Platform Time Sync unit of |
| 82 | 82 | the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem. |
| 83 | 83 | The unit can time stamp PTP UDP/IPv4 and Layer 2 packets, and the |
| 84 | 84 | driver offers a PTP Hardware Clock. |
| 85 | 85 | |
| 86 | +config TI_CPTS_MOD | |
| 87 | + tristate | |
| 88 | + depends on TI_CPTS | |
| 89 | + default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y | |
| 90 | + default m | |
| 91 | + | |
| 86 | 92 | config TI_KEYSTONE_NETCP |
| 87 | 93 | tristate "TI Keystone NETCP Core Support" |
| 88 | 94 | select TI_CPSW_ALE |
| @@ -12,7 +12,7 @@ obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o · 11 unmodified lines | ||
| 12 | 12 | obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o |
| 13 | 13 | obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o |
| 14 | 14 | obj-$(CONFIG_TI_CPSW_ALE) += cpsw_ale.o |
| 15 | −obj-$(CONFIG_TI_CPTS) += cpts.o | |
| 15 | +obj-$(CONFIG_TI_CPTS_MOD) += cpts.o | |
| 16 | 16 | obj-$(CONFIG_TI_CPSW) += ti_cpsw.o |
| 17 | 17 | ti_cpsw-y := cpsw.o |
| 18 | 18 | |
| @@ -45,6 +45,8 @@ MODULE_DESCRIPTION("FUJITSU Extended Socket Network Device Driver"); · 44 unmodified lines | ||
| 45 | 45 | MODULE_LICENSE("GPL"); |
| 46 | 46 | MODULE_VERSION(DRV_VERSION); |
| 47 | 47 | |
| 48 | +#define ACPI_MOTHERBOARD_RESOURCE_HID "PNP0C02" | |
| 49 | + | |
| 48 | 50 | static int fjes_request_irq(struct fjes_adapter *); |
| 49 | 51 | static void fjes_free_irq(struct fjes_adapter *); |
| 50 | 52 | |
| @@ -78,7 +80,7 @@ static void fjes_rx_irq(struct fjes_adapter *, int); · 27 unmodified lines | ||
| 78 | 80 | static int fjes_poll(struct napi_struct *, int); |
| 79 | 81 | |
| 80 | 82 | static const struct acpi_device_id fjes_acpi_ids[] = { |
| 81 | − {"PNP0C02", 0}, | |
| 83 | + {ACPI_MOTHERBOARD_RESOURCE_HID, 0}, | |
| 82 | 84 | {"", 0}, |
| 83 | 85 | }; |
| 84 | 86 | MODULE_DEVICE_TABLE(acpi, fjes_acpi_ids); |
| @@ -115,18 +117,17 @@ static struct resource fjes_resource[] = { · 30 unmodified lines | ||
| 115 | 117 | }, |
| 116 | 118 | }; |
| 117 | 119 | |
| 118 | −static int fjes_acpi_add(struct acpi_device *device) | |
| 120 | +static bool is_extended_socket_device(struct acpi_device *device) | |
| 119 | 121 | { |
| 120 | 122 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL}; |
| 121 | 123 | char str_buf[sizeof(FJES_ACPI_SYMBOL) + 1]; |
| 122 | − struct platform_device *plat_dev; | |
| 123 | 124 | union acpi_object *str; |
| 124 | 125 | acpi_status status; |
| 125 | 126 | int result; |
| 126 | 127 | |
| 127 | 128 | status = acpi_evaluate_object(device->handle, "_STR", NULL, &buffer); |
| 128 | 129 | if (ACPI_FAILURE(status)) |
| 129 | − return -ENODEV; | |
| 130 | + return false; | |
| 130 | 131 | |
| 131 | 132 | str = buffer.pointer; |
| 132 | 133 | result = utf16s_to_utf8s((wchar_t *)str->string.pointer, |
| @@ -136,10 +137,42 @@ static int fjes_acpi_add(struct acpi_device *device) · 3 unmodified lines | ||
| 136 | 137 | |
| 137 | 138 | if (strncmp(FJES_ACPI_SYMBOL, str_buf, strlen(FJES_ACPI_SYMBOL)) != 0) { |
| 138 | 139 | kfree(buffer.pointer); |
| 139 | − return -ENODEV; | |
| 140 | + return false; | |
| 140 | 141 | } |
| 141 | 142 | kfree(buffer.pointer); |
| 142 | 143 | |
| 144 | + return true; | |
| 145 | +} | |
| 146 | + | |
| 147 | +static int acpi_check_extended_socket_status(struct acpi_device *device) | |
| 148 | +{ | |
| 149 | + unsigned long long sta; | |
| 150 | + acpi_status status; | |
| 151 | + | |
| 152 | + status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta); | |
| 153 | + if (ACPI_FAILURE(status)) | |
| 154 | + return -ENODEV; | |
| 155 | + | |
| 156 | + if (!((sta & ACPI_STA_DEVICE_PRESENT) && | |
| 157 | + (sta & ACPI_STA_DEVICE_ENABLED) && | |
| 158 | + (sta & ACPI_STA_DEVICE_UI) && | |
| 159 | + (sta & ACPI_STA_DEVICE_FUNCTIONING))) | |
| 160 | + return -ENODEV; | |
| 161 | + | |
| 162 | + return 0; | |
| 163 | +} | |
| 164 | + | |
| 165 | +static int fjes_acpi_add(struct acpi_device *device) | |
| 166 | +{ | |
| 167 | + struct platform_device *plat_dev; | |
| 168 | + acpi_status status; | |
| 169 | + | |
| 170 | + if (!is_extended_socket_device(device)) | |
| 171 | + return -ENODEV; | |
| 172 | + | |
| 173 | + if (acpi_check_extended_socket_status(device)) | |
| 174 | + return -ENODEV; | |
| 175 | + | |
| 143 | 176 | status = acpi_walk_resources(device->handle, METHOD_NAME__CRS, |
| 144 | 177 | fjes_get_acpi_resource, fjes_resource); |
| 145 | 178 | if (ACPI_FAILURE(status)) |
| @@ -1316,7 +1349,7 @@ static void fjes_netdev_setup(struct net_device *netdev) · 1170 unmodified lines | ||
| 1316 | 1349 | netdev->min_mtu = fjes_support_mtu[0]; |
| 1317 | 1350 | netdev->max_mtu = fjes_support_mtu[3]; |
| 1318 | 1351 | netdev->flags |= IFF_BROADCAST; |
| 1319 | − netdev->features |= NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_CTAG_FILTER; | |
| 1352 | + netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; | |
| 1320 | 1353 | } |
| 1321 | 1354 | |
| 1322 | 1355 | static void fjes_irq_watch_task(struct work_struct *work) |
| @@ -1473,11 +1506,44 @@ static void fjes_watch_unshare_task(struct work_struct *work) · 150 unmodified lines | ||
| 1473 | 1506 | } |
| 1474 | 1507 | } |
| 1475 | 1508 | |
| 1509 | +static acpi_status | |
| 1510 | +acpi_find_extended_socket_device(acpi_handle obj_handle, u32 level, | |
| 1511 | + void *context, void **return_value) | |
| 1512 | +{ | |
| 1513 | + struct acpi_device *device; | |
| 1514 | + bool *found = context; | |
| 1515 | + int result; | |
| 1516 | + | |
| 1517 | + result = acpi_bus_get_device(obj_handle, &device); | |
| 1518 | + if (result) | |
| 1519 | + return AE_OK; | |
| 1520 | + | |
| 1521 | + if (strcmp(acpi_device_hid(device), ACPI_MOTHERBOARD_RESOURCE_HID)) | |
| 1522 | + return AE_OK; | |
| 1523 | + | |
| 1524 | + if (!is_extended_socket_device(device)) | |
| 1525 | + return AE_OK; | |
| 1526 | + | |
| 1527 | + if (acpi_check_extended_socket_status(device)) | |
| 1528 | + return AE_OK; | |
| 1529 | + | |
| 1530 | + *found = true; | |
| 1531 | + return AE_CTRL_TERMINATE; | |
| 1532 | +} | |
| 1533 | + | |
| 1476 | 1534 | /* fjes_init_module - Driver Registration Routine */ |
| 1477 | 1535 | static int __init fjes_init_module(void) |
| 1478 | 1536 | { |
| 1537 | + bool found = false; | |
| 1479 | 1538 | int result; |
| 1480 | 1539 | |
| 1540 | + acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, | |
| 1541 | + acpi_find_extended_socket_device, NULL, &found, | |
| 1542 | + NULL); | |
| 1543 | + | |
| 1544 | + if (!found) | |
| 1545 | + return -ENODEV; | |
| 1546 | + | |
| 1481 | 1547 | pr_info("%s - version %s - %s\n", |
| 1482 | 1548 | fjes_driver_string, fjes_driver_version, fjes_copyright); |
| 1483 | 1549 | |
| @@ -1231,8 +1231,11 @@ void netvsc_channel_cb(void *context) · 1230 unmodified lines | ||
| 1231 | 1231 | return; |
| 1232 | 1232 | |
| 1233 | 1233 | net_device = net_device_to_netvsc_device(ndev); |
| 1234 | − if (unlikely(net_device->destroy) && | |
| 1235 | − netvsc_channel_idle(net_device, q_idx)) | |
| 1234 | + if (unlikely(!net_device)) | |
| 1235 | + return; | |
| 1236 | + | |
| 1237 | + if (unlikely(net_device->destroy && | |
| 1238 | + netvsc_channel_idle(net_device, q_idx))) | |
| 1236 | 1239 | return; |
| 1237 | 1240 | |
| 1238 | 1241 | /* commit_rd_index() -> hv_signal_on_read() needs this. */ |
| @@ -1931,6 +1931,8 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) · 1930 unmodified lines | ||
| 1931 | 1931 | return -EINVAL; |
| 1932 | 1932 | |
| 1933 | 1933 | tun->set_features = features; |
| 1934 | + tun->dev->wanted_features &= ~TUN_USER_FEATURES; | |
| 1935 | + tun->dev->wanted_features |= features; | |
| 1934 | 1936 | netdev_update_features(tun->dev); |
| 1935 | 1937 | |
| 1936 | 1938 | return 0; |
| @@ -580,6 +580,10 @@ static const struct usb_device_id products[] = { · 579 unmodified lines | ||
| 580 | 580 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x69), |
| 581 | 581 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 582 | 582 | }, |
| 583 | + { /* Motorola Mapphone devices with MDM6600 */ | |
| 584 | + USB_VENDOR_AND_INTERFACE_INFO(0x22b8, USB_CLASS_VENDOR_SPEC, 0xfb, 0xff), | |
| 585 | + .driver_info = (unsigned long)&qmi_wwan_info, | |
| 586 | + }, | |
| 583 | 587 | |
| 584 | 588 | /* 2. Combined interface devices matching on class+protocol */ |
| 585 | 589 | { /* Huawei E367 and possibly others in "Windows mode" */ |
| @@ -925,6 +929,8 @@ static const struct usb_device_id products[] = { · 339 unmodified lines | ||
| 925 | 929 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 926 | 930 | {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 927 | 931 | {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ |
| 932 | + {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */ | |
| 933 | + {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */ | |
| 928 | 934 | {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ |
| 929 | 935 | {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ |
| 930 | 936 | {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */ |
| @@ -32,7 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | #define NETNEXT_VERSION "08" |
| 33 | 33 | |
| 34 | 34 | /* Information for net */ |
| 35 | −#define NET_VERSION "8" | |
| 35 | +#define NET_VERSION "9" | |
| 36 | 36 | |
| 37 | 37 | #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION |
| 38 | 38 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" |
| @@ -501,6 +501,8 @@ enum rtl_register_content { · 462 unmodified lines | ||
| 501 | 501 | #define RTL8153_RMS RTL8153_MAX_PACKET |
| 502 | 502 | #define RTL8152_TX_TIMEOUT (5 * HZ) |
| 503 | 503 | #define RTL8152_NAPI_WEIGHT 64 |
| 504 | +#define rx_reserved_size(x) ((x) + VLAN_ETH_HLEN + CRC_SIZE + \ | |
| 505 | + sizeof(struct rx_desc) + RX_ALIGN) | |
| 504 | 506 | |
| 505 | 507 | /* rtl8152 flags */ |
| 506 | 508 | enum rtl8152_flags { |
| @@ -1362,6 +1364,7 @@ static int alloc_all_mem(struct r8152 *tp) · 855 unmodified lines | ||
| 1362 | 1364 | spin_lock_init(&tp->rx_lock); |
| 1363 | 1365 | spin_lock_init(&tp->tx_lock); |
| 1364 | 1366 | INIT_LIST_HEAD(&tp->tx_free); |
| 1367 | + INIT_LIST_HEAD(&tp->rx_done); | |
| 1365 | 1368 | skb_queue_head_init(&tp->tx_queue); |
| 1366 | 1369 | skb_queue_head_init(&tp->rx_queue); |
| 1367 | 1370 | |
| @@ -2252,8 +2255,7 @@ static void r8153_set_rx_early_timeout(struct r8152 *tp) · 884 unmodified lines | ||
| 2252 | 2255 | |
| 2253 | 2256 | static void r8153_set_rx_early_size(struct r8152 *tp) |
| 2254 | 2257 | { |
| 2255 | − u32 mtu = tp->netdev->mtu; | |
| 2256 | − u32 ocp_data = (agg_buf_sz - mtu - VLAN_ETH_HLEN - VLAN_HLEN) / 8; | |
| 2258 | + u32 ocp_data = (agg_buf_sz - rx_reserved_size(tp->netdev->mtu)) / 4; | |
| 2257 | 2259 | |
| 2258 | 2260 | ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data); |
| 2259 | 2261 | } |
| @@ -2898,7 +2900,8 @@ static void r8153_first_init(struct r8152 *tp) · 638 unmodified lines | ||
| 2898 | 2900 | |
| 2899 | 2901 | rtl_rx_vlan_en(tp, tp->netdev->features & NETIF_F_HW_VLAN_CTAG_RX); |
| 2900 | 2902 | |
| 2901 | − ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS); | |
| 2903 | + ocp_data = tp->netdev->mtu + VLAN_ETH_HLEN + CRC_SIZE; | |
| 2904 | + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, ocp_data); | |
| 2902 | 2905 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_MTPS, MTPS_JUMBO); |
| 2903 | 2906 | |
| 2904 | 2907 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0); |
| @@ -2950,7 +2953,8 @@ static void r8153_enter_oob(struct r8152 *tp) · 45 unmodified lines | ||
| 2950 | 2953 | usleep_range(1000, 2000); |
| 2951 | 2954 | } |
| 2952 | 2955 | |
| 2953 | − ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS); | |
| 2956 | + ocp_data = tp->netdev->mtu + VLAN_ETH_HLEN + CRC_SIZE; | |
| 2957 | + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, ocp_data); | |
| 2954 | 2958 | |
| 2955 | 2959 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_TEREDO_CFG); |
| 2956 | 2960 | ocp_data &= ~TEREDO_WAKE_MASK; |
| @@ -4200,8 +4204,14 @@ static int rtl8152_change_mtu(struct net_device *dev, int new_mtu) · 1243 unmodified lines | ||
| 4200 | 4204 | |
| 4201 | 4205 | dev->mtu = new_mtu; |
| 4202 | 4206 | |
| 4203 | − if (netif_running(dev) && netif_carrier_ok(dev)) | |
| 4204 | − r8153_set_rx_early_size(tp); | |
| 4207 | + if (netif_running(dev)) { | |
| 4208 | + u32 rms = new_mtu + VLAN_ETH_HLEN + CRC_SIZE; | |
| 4209 | + | |
| 4210 | + ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, rms); | |
| 4211 | + | |
| 4212 | + if (netif_carrier_ok(dev)) | |
| 4213 | + r8153_set_rx_early_size(tp); | |
| 4214 | + } | |
| 4205 | 4215 | |
| 4206 | 4216 | mutex_unlock(&tp->control); |
| 4207 | 4217 | |
| @@ -462,8 +462,10 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf) · 461 unmodified lines | ||
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | if (rt6_local) { |
| 465 | − if (rt6_local->rt6i_idev) | |
| 465 | + if (rt6_local->rt6i_idev) { | |
| 466 | 466 | in6_dev_put(rt6_local->rt6i_idev); |
| 467 | + rt6_local->rt6i_idev = NULL; | |
| 468 | + } | |
| 467 | 469 | |
| 468 | 470 | dst = &rt6_local->dst; |
| 469 | 471 | dev_put(dst->dev); |
| @@ -51,7 +51,7 @@ const struct ath10k_hw_regs qca6174_regs = { · 50 unmodified lines | ||
| 51 | 51 | .rtc_soc_base_address = 0x00000800, |
| 52 | 52 | .rtc_wmac_base_address = 0x00001000, |
| 53 | 53 | .soc_core_base_address = 0x0003a000, |
| 54 | − .wlan_mac_base_address = 0x00020000, | |
| 54 | + .wlan_mac_base_address = 0x00010000, | |
| 55 | 55 | .ce_wrapper_base_address = 0x00034000, |
| 56 | 56 | .ce0_base_address = 0x00034400, |
| 57 | 57 | .ce1_base_address = 0x00034800, |
| @@ -2319,7 +2319,7 @@ iwl_mvm_mac_release_buffered_frames(struct ieee80211_hw *hw, · 2318 unmodified lines | ||
| 2319 | 2319 | { |
| 2320 | 2320 | struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); |
| 2321 | 2321 | |
| 2322 | − /* Called when we need to transmit (a) frame(s) from agg queue */ | |
| 2322 | + /* Called when we need to transmit (a) frame(s) from agg or dqa queue */ | |
| 2323 | 2323 | |
| 2324 | 2324 | iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames, |
| 2325 | 2325 | tids, more_data, true); |
| @@ -2338,7 +2338,8 @@ static void __iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, · 12 unmodified lines | ||
| 2338 | 2338 | for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) { |
| 2339 | 2339 | struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; |
| 2340 | 2340 | |
| 2341 | − if (tid_data->state != IWL_AGG_ON && | |
| 2341 | + if (!iwl_mvm_is_dqa_supported(mvm) && | |
| 2342 | + tid_data->state != IWL_AGG_ON && | |
| 2342 | 2343 | tid_data->state != IWL_EMPTYING_HW_QUEUE_DELBA) |
| 2343 | 2344 | continue; |
| 2344 | 2345 | |
| @@ -3135,7 +3135,7 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, · 3134 unmodified lines | ||
| 3135 | 3135 | struct ieee80211_sta *sta, |
| 3136 | 3136 | enum ieee80211_frame_release_type reason, |
| 3137 | 3137 | u16 cnt, u16 tids, bool more_data, |
| 3138 | − bool agg) | |
| 3138 | + bool single_sta_queue) | |
| 3139 | 3139 | { |
| 3140 | 3140 | struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); |
| 3141 | 3141 | struct iwl_mvm_add_sta_cmd cmd = { |
| @@ -3155,14 +3155,14 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, · 13 unmodified lines | ||
| 3155 | 3155 | for_each_set_bit(tid, &_tids, IWL_MAX_TID_COUNT) |
| 3156 | 3156 | cmd.awake_acs |= BIT(tid_to_ucode_ac[tid]); |
| 3157 | 3157 | |
| 3158 | − /* If we're releasing frames from aggregation queues then check if the | |
| 3159 | − * all queues combined that we're releasing frames from have | |
| 3158 | + /* If we're releasing frames from aggregation or dqa queues then check | |
| 3159 | + * if all the queues that we're releasing frames from, combined, have: | |
| 3160 | 3160 | * - more frames than the service period, in which case more_data |
| 3161 | 3161 | * needs to be set |
| 3162 | 3162 | * - fewer than 'cnt' frames, in which case we need to adjust the |
| 3163 | 3163 | * firmware command (but do that unconditionally) |
| 3164 | 3164 | */ |
| 3165 | − if (agg) { | |
| 3165 | + if (single_sta_queue) { | |
| 3166 | 3166 | int remaining = cnt; |
| 3167 | 3167 | int sleep_tx_count; |
| 3168 | 3168 | |
| @@ -3172,7 +3172,8 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, · 3 unmodified lines | ||
| 3172 | 3172 | u16 n_queued; |
| 3173 | 3173 | |
| 3174 | 3174 | tid_data = &mvmsta->tid_data[tid]; |
| 3175 | − if (WARN(tid_data->state != IWL_AGG_ON && | |
| 3175 | + if (WARN(!iwl_mvm_is_dqa_supported(mvm) && | |
| 3176 | + tid_data->state != IWL_AGG_ON && | |
| 3176 | 3177 | tid_data->state != IWL_EMPTYING_HW_QUEUE_DELBA, |
| 3177 | 3178 | "TID %d state is %d\n", |
| 3178 | 3179 | tid, tid_data->state)) { |
| @@ -547,7 +547,7 @@ void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, · 546 unmodified lines | ||
| 547 | 547 | struct ieee80211_sta *sta, |
| 548 | 548 | enum ieee80211_frame_release_type reason, |
| 549 | 549 | u16 cnt, u16 tids, bool more_data, |
| 550 | − bool agg); | |
| 550 | + bool single_sta_queue); | |
| 551 | 551 | int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, |
| 552 | 552 | bool drain); |
| 553 | 553 | void iwl_mvm_sta_modify_disable_tx(struct iwl_mvm *mvm, |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | * |
| 8 | 8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
| 9 | 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 10 | − * Copyright(c) 2016 Intel Deutschland GmbH | |
| 10 | + * Copyright(c) 2016 - 2017 Intel Deutschland GmbH | |
| 11 | 11 | * |
| 12 | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | 13 | * it under the terms of version 2 of the GNU General Public License as |
| @@ -34,6 +34,7 @@ · 20 unmodified lines | ||
| 34 | 34 | * |
| 35 | 35 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
| 36 | 36 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 37 | + * Copyright(c) 2016 - 2017 Intel Deutschland GmbH | |
| 37 | 38 | * All rights reserved. |
| 38 | 39 | * |
| 39 | 40 | * Redistribution and use in source and binary forms, with or without |
| @@ -628,8 +629,10 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) · 588 unmodified lines | ||
| 628 | 629 | * values. |
| 629 | 630 | * Note that we don't need to make sure it isn't agg'd, since we're |
| 630 | 631 | * TXing non-sta |
| 632 | + * For DQA mode - we shouldn't increase it though | |
| 631 | 633 | */ |
| 632 | − atomic_inc(&mvm->pending_frames[sta_id]); | |
| 634 | + if (!iwl_mvm_is_dqa_supported(mvm)) | |
| 635 | + atomic_inc(&mvm->pending_frames[sta_id]); | |
| 633 | 636 | |
| 634 | 637 | return 0; |
| 635 | 638 | } |
| @@ -1005,11 +1008,8 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb, · 369 unmodified lines | ||
| 1005 | 1008 | |
| 1006 | 1009 | spin_unlock(&mvmsta->lock); |
| 1007 | 1010 | |
| 1008 | − /* Increase pending frames count if this isn't AMPDU */ | |
| 1009 | − if ((iwl_mvm_is_dqa_supported(mvm) && | |
| 1010 | − mvmsta->tid_data[tx_cmd->tid_tspec].state != IWL_AGG_ON && | |
| 1011 | − mvmsta->tid_data[tx_cmd->tid_tspec].state != IWL_AGG_STARTING) || | |
| 1012 | − (!iwl_mvm_is_dqa_supported(mvm) && !is_ampdu)) | |
| 1011 | + /* Increase pending frames count if this isn't AMPDU or DQA queue */ | |
| 1012 | + if (!iwl_mvm_is_dqa_supported(mvm) && !is_ampdu) | |
| 1013 | 1013 | atomic_inc(&mvm->pending_frames[mvmsta->sta_id]); |
| 1014 | 1014 | |
| 1015 | 1015 | return 0; |
| @@ -1079,12 +1079,13 @@ static void iwl_mvm_check_ratid_empty(struct iwl_mvm *mvm, · 63 unmodified lines | ||
| 1079 | 1079 | lockdep_assert_held(&mvmsta->lock); |
| 1080 | 1080 | |
| 1081 | 1081 | if ((tid_data->state == IWL_AGG_ON || |
| 1082 | − tid_data->state == IWL_EMPTYING_HW_QUEUE_DELBA) && | |
| 1082 | + tid_data->state == IWL_EMPTYING_HW_QUEUE_DELBA || | |
| 1083 | + iwl_mvm_is_dqa_supported(mvm)) && | |
| 1083 | 1084 | iwl_mvm_tid_queued(tid_data) == 0) { |
| 1084 | 1085 | /* |
| 1085 | − * Now that this aggregation queue is empty tell mac80211 so it | |
| 1086 | − * knows we no longer have frames buffered for the station on | |
| 1087 | − * this TID (for the TIM bitmap calculation.) | |
| 1086 | + * Now that this aggregation or DQA queue is empty tell | |
| 1087 | + * mac80211 so it knows we no longer have frames buffered for | |
| 1088 | + * the station on this TID (for the TIM bitmap calculation.) | |
| 1088 | 1089 | */ |
| 1089 | 1090 | ieee80211_sta_set_buffered(sta, tid, false); |
| 1090 | 1091 | } |
| @@ -1257,7 +1258,6 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 166 unmodified lines | ||
| 1257 | 1258 | u8 skb_freed = 0; |
| 1258 | 1259 | u16 next_reclaimed, seq_ctl; |
| 1259 | 1260 | bool is_ndp = false; |
| 1260 | − bool txq_agg = false; /* Is this TXQ aggregated */ | |
| 1261 | 1261 | |
| 1262 | 1262 | __skb_queue_head_init(&skbs); |
| 1263 | 1263 | |
| @@ -1283,6 +1283,10 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 19 unmodified lines | ||
| 1283 | 1283 | info->flags |= IEEE80211_TX_STAT_ACK; |
| 1284 | 1284 | break; |
| 1285 | 1285 | case TX_STATUS_FAIL_DEST_PS: |
| 1286 | + /* In DQA, the FW should have stopped the queue and not | |
| 1287 | + * return this status | |
| 1288 | + */ | |
| 1289 | + WARN_ON(iwl_mvm_is_dqa_supported(mvm)); | |
| 1286 | 1290 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; |
| 1287 | 1291 | break; |
| 1288 | 1292 | default: |
| @@ -1387,15 +1391,6 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 98 unmodified lines | ||
| 1387 | 1391 | bool send_eosp_ndp = false; |
| 1388 | 1392 | |
| 1389 | 1393 | spin_lock_bh(&mvmsta->lock); |
| 1390 | − if (iwl_mvm_is_dqa_supported(mvm)) { | |
| 1391 | − enum iwl_mvm_agg_state state; | |
| 1392 | − | |
| 1393 | − state = mvmsta->tid_data[tid].state; | |
| 1394 | − txq_agg = (state == IWL_AGG_ON || | |
| 1395 | − state == IWL_EMPTYING_HW_QUEUE_DELBA); | |
| 1396 | − } else { | |
| 1397 | − txq_agg = txq_id >= mvm->first_agg_queue; | |
| 1398 | − } | |
| 1399 | 1394 | |
| 1400 | 1395 | if (!is_ndp) { |
| 1401 | 1396 | tid_data->next_reclaimed = next_reclaimed; |
| @@ -1452,11 +1447,11 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 50 unmodified lines | ||
| 1452 | 1447 | * If the txq is not an AMPDU queue, there is no chance we freed |
| 1453 | 1448 | * several skbs. Check that out... |
| 1454 | 1449 | */ |
| 1455 | − if (txq_agg) | |
| 1450 | + if (iwl_mvm_is_dqa_supported(mvm) || txq_id >= mvm->first_agg_queue) | |
| 1456 | 1451 | goto out; |
| 1457 | 1452 | |
| 1458 | 1453 | /* We can't free more than one frame at once on a shared queue */ |
| 1459 | − WARN_ON(!iwl_mvm_is_dqa_supported(mvm) && (skb_freed > 1)); | |
| 1454 | + WARN_ON(skb_freed > 1); | |
| 1460 | 1455 | |
| 1461 | 1456 | /* If we have still frames for this STA nothing to do here */ |
| 1462 | 1457 | if (!atomic_sub_and_test(skb_freed, &mvm->pending_frames[sta_id])) |
| @@ -57,8 +57,8 @@ MODULE_PARM_DESC(mfg_mode, "manufacturing mode enable:1, disable:0"); · 56 unmodified lines | ||
| 57 | 57 | * In case of any errors during inittialization, this function also ensures |
| 58 | 58 | * proper cleanup before exiting. |
| 59 | 59 | */ |
| 60 | −static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, | |
| 61 | − void **padapter) | |
| 60 | +static int mwifiex_register(void *card, struct device *dev, | |
| 61 | + struct mwifiex_if_ops *if_ops, void **padapter) | |
| 62 | 62 | { |
| 63 | 63 | struct mwifiex_adapter *adapter; |
| 64 | 64 | int i; |
| @@ -68,6 +68,7 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, · 3 unmodified lines | ||
| 68 | 68 | return -ENOMEM; |
| 69 | 69 | |
| 70 | 70 | *padapter = adapter; |
| 71 | + adapter->dev = dev; | |
| 71 | 72 | adapter->card = card; |
| 72 | 73 | |
| 73 | 74 | /* Save interface specific operations in adapter */ |
| @@ -1568,12 +1569,11 @@ mwifiex_add_card(void *card, struct completion *fw_done, · 1494 unmodified lines | ||
| 1568 | 1569 | { |
| 1569 | 1570 | struct mwifiex_adapter *adapter; |
| 1570 | 1571 | |
| 1571 | − if (mwifiex_register(card, if_ops, (void **)&adapter)) { | |
| 1572 | + if (mwifiex_register(card, dev, if_ops, (void **)&adapter)) { | |
| 1572 | 1573 | pr_err("%s: software init failed\n", __func__); |
| 1573 | 1574 | goto err_init_sw; |
| 1574 | 1575 | } |
| 1575 | 1576 | |
| 1576 | − adapter->dev = dev; | |
| 1577 | 1577 | mwifiex_probe_of(adapter); |
| 1578 | 1578 | |
| 1579 | 1579 | adapter->iface_type = iface_type; |
| @@ -1718,6 +1718,9 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter) · 138 unmodified lines | ||
| 1718 | 1718 | wiphy_unregister(adapter->wiphy); |
| 1719 | 1719 | wiphy_free(adapter->wiphy); |
| 1720 | 1720 | |
| 1721 | + if (adapter->irq_wakeup >= 0) | |
| 1722 | + device_init_wakeup(adapter->dev, false); | |
| 1723 | + | |
| 1721 | 1724 | /* Unregister device */ |
| 1722 | 1725 | mwifiex_dbg(adapter, INFO, |
| 1723 | 1726 | "info: unregister device\n"); |
| @@ -2739,6 +2739,21 @@ static void mwifiex_pcie_device_dump(struct mwifiex_adapter *adapter) · 2738 unmodified lines | ||
| 2739 | 2739 | schedule_work(&card->work); |
| 2740 | 2740 | } |
| 2741 | 2741 | |
| 2742 | +static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter) | |
| 2743 | +{ | |
| 2744 | + struct pcie_service_card *card = adapter->card; | |
| 2745 | + const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; | |
| 2746 | + | |
| 2747 | + if (reg->sleep_cookie) | |
| 2748 | + mwifiex_pcie_delete_sleep_cookie_buf(adapter); | |
| 2749 | + | |
| 2750 | + mwifiex_pcie_delete_cmdrsp_buf(adapter); | |
| 2751 | + mwifiex_pcie_delete_evtbd_ring(adapter); | |
| 2752 | + mwifiex_pcie_delete_rxbd_ring(adapter); | |
| 2753 | + mwifiex_pcie_delete_txbd_ring(adapter); | |
| 2754 | + card->cmdrsp_buf = NULL; | |
| 2755 | +} | |
| 2756 | + | |
| 2742 | 2757 | /* |
| 2743 | 2758 | * This function initializes the PCI-E host memory space, WCB rings, etc. |
| 2744 | 2759 | * |
| @@ -2850,13 +2865,6 @@ err_enable_dev: · 105 unmodified lines | ||
| 2850 | 2865 | |
| 2851 | 2866 | /* |
| 2852 | 2867 | * This function cleans up the allocated card buffers. |
| 2853 | − * | |
| 2854 | − * The following are freed by this function - | |
| 2855 | − * - TXBD ring buffers | |
| 2856 | − * - RXBD ring buffers | |
| 2857 | − * - Event BD ring buffers | |
| 2858 | − * - Command response ring buffer | |
| 2859 | − * - Sleep cookie buffer | |
| 2860 | 2868 | */ |
| 2861 | 2869 | static void mwifiex_cleanup_pcie(struct mwifiex_adapter *adapter) |
| 2862 | 2870 | { |
| @@ -2875,6 +2883,8 @@ static void mwifiex_cleanup_pcie(struct mwifiex_adapter *adapter) · 12 unmodified lines | ||
| 2875 | 2883 | "Failed to write driver not-ready signature\n"); |
| 2876 | 2884 | } |
| 2877 | 2885 | |
| 2886 | + mwifiex_pcie_free_buffers(adapter); | |
| 2887 | + | |
| 2878 | 2888 | if (pdev) { |
| 2879 | 2889 | pci_iounmap(pdev, card->pci_mmap); |
| 2880 | 2890 | pci_iounmap(pdev, card->pci_mmap1); |
| @@ -3126,10 +3136,7 @@ err_cre_txbd: · 245 unmodified lines | ||
| 3126 | 3136 | pci_iounmap(pdev, card->pci_mmap1); |
| 3127 | 3137 | } |
| 3128 | 3138 | |
| 3129 | −/* This function cleans up the PCI-E host memory space. | |
| 3130 | − * Some code is extracted from mwifiex_unregister_dev() | |
| 3131 | − * | |
| 3132 | − */ | |
| 3139 | +/* This function cleans up the PCI-E host memory space. */ | |
| 3133 | 3140 | static void mwifiex_pcie_down_dev(struct mwifiex_adapter *adapter) |
| 3134 | 3141 | { |
| 3135 | 3142 | struct pcie_service_card *card = adapter->card; |
| @@ -3140,14 +3147,7 @@ static void mwifiex_pcie_down_dev(struct mwifiex_adapter *adapter) · 4 unmodified lines | ||
| 3140 | 3147 | |
| 3141 | 3148 | adapter->seq_num = 0; |
| 3142 | 3149 | |
| 3143 | − if (reg->sleep_cookie) | |
| 3144 | − mwifiex_pcie_delete_sleep_cookie_buf(adapter); | |
| 3145 | − | |
| 3146 | − mwifiex_pcie_delete_cmdrsp_buf(adapter); | |
| 3147 | − mwifiex_pcie_delete_evtbd_ring(adapter); | |
| 3148 | − mwifiex_pcie_delete_rxbd_ring(adapter); | |
| 3149 | − mwifiex_pcie_delete_txbd_ring(adapter); | |
| 3150 | − card->cmdrsp_buf = NULL; | |
| 3150 | + mwifiex_pcie_free_buffers(adapter); | |
| 3151 | 3151 | } |
| 3152 | 3152 | |
| 3153 | 3153 | static struct mwifiex_if_ops pcie_ops = { |
| @@ -343,8 +343,6 @@ static int __nvme_rdma_init_request(struct nvme_rdma_ctrl *ctrl, · 342 unmodified lines | ||
| 343 | 343 | struct ib_device *ibdev = dev->dev; |
| 344 | 344 | int ret; |
| 345 | 345 | |
| 346 | − BUG_ON(queue_idx >= ctrl->queue_count); | |
| 347 | − | |
| 348 | 346 | ret = nvme_rdma_alloc_qe(ibdev, &req->sqe, sizeof(struct nvme_command), |
| 349 | 347 | DMA_TO_DEVICE); |
| 350 | 348 | if (ret) |
| @@ -652,8 +650,22 @@ out_free_queues: · 301 unmodified lines | ||
| 652 | 650 | |
| 653 | 651 | static int nvme_rdma_init_io_queues(struct nvme_rdma_ctrl *ctrl) |
| 654 | 652 | { |
| 653 | + struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; | |
| 654 | + unsigned int nr_io_queues; | |
| 655 | 655 | int i, ret; |
| 656 | 656 | |
| 657 | + nr_io_queues = min(opts->nr_io_queues, num_online_cpus()); | |
| 658 | + ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); | |
| 659 | + if (ret) | |
| 660 | + return ret; | |
| 661 | + | |
| 662 | + ctrl->queue_count = nr_io_queues + 1; | |
| 663 | + if (ctrl->queue_count < 2) | |
| 664 | + return 0; | |
| 665 | + | |
| 666 | + dev_info(ctrl->ctrl.device, | |
| 667 | + "creating %d I/O queues.\n", nr_io_queues); | |
| 668 | + | |
| 657 | 669 | for (i = 1; i < ctrl->queue_count; i++) { |
| 658 | 670 | ret = nvme_rdma_init_queue(ctrl, i, |
| 659 | 671 | ctrl->ctrl.opts->queue_size); |
| @@ -1791,20 +1803,8 @@ static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = { · 1131 unmodified lines | ||
| 1791 | 1803 | |
| 1792 | 1804 | static int nvme_rdma_create_io_queues(struct nvme_rdma_ctrl *ctrl) |
| 1793 | 1805 | { |
| 1794 | − struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; | |
| 1795 | 1806 | int ret; |
| 1796 | 1807 | |
| 1797 | − ret = nvme_set_queue_count(&ctrl->ctrl, &opts->nr_io_queues); | |
| 1798 | − if (ret) | |
| 1799 | − return ret; | |
| 1800 | − | |
| 1801 | − ctrl->queue_count = opts->nr_io_queues + 1; | |
| 1802 | − if (ctrl->queue_count < 2) | |
| 1803 | − return 0; | |
| 1804 | − | |
| 1805 | − dev_info(ctrl->ctrl.device, | |
| 1806 | − "creating %d I/O queues.\n", opts->nr_io_queues); | |
| 1807 | − | |
| 1808 | 1808 | ret = nvme_rdma_init_io_queues(ctrl); |
| 1809 | 1809 | if (ret) |
| 1810 | 1810 | return ret; |
| @@ -425,6 +425,13 @@ void nvmet_sq_setup(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, · 424 unmodified lines | ||
| 425 | 425 | ctrl->sqs[qid] = sq; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | +static void nvmet_confirm_sq(struct percpu_ref *ref) | |
| 429 | +{ | |
| 430 | + struct nvmet_sq *sq = container_of(ref, struct nvmet_sq, ref); | |
| 431 | + | |
| 432 | + complete(&sq->confirm_done); | |
| 433 | +} | |
| 434 | + | |
| 428 | 435 | void nvmet_sq_destroy(struct nvmet_sq *sq) |
| 429 | 436 | { |
| 430 | 437 | /* |
| @@ -433,7 +440,8 @@ void nvmet_sq_destroy(struct nvmet_sq *sq) · 2 unmodified lines | ||
| 433 | 440 | */ |
| 434 | 441 | if (sq->ctrl && sq->ctrl->sqs && sq->ctrl->sqs[0] == sq) |
| 435 | 442 | nvmet_async_events_free(sq->ctrl); |
| 436 | − percpu_ref_kill(&sq->ref); | |
| 443 | + percpu_ref_kill_and_confirm(&sq->ref, nvmet_confirm_sq); | |
| 444 | + wait_for_completion(&sq->confirm_done); | |
| 437 | 445 | wait_for_completion(&sq->free_done); |
| 438 | 446 | percpu_ref_exit(&sq->ref); |
| 439 | 447 | |
| @@ -461,6 +469,7 @@ int nvmet_sq_init(struct nvmet_sq *sq) · 21 unmodified lines | ||
| 461 | 469 | return ret; |
| 462 | 470 | } |
| 463 | 471 | init_completion(&sq->free_done); |
| 472 | + init_completion(&sq->confirm_done); | |
| 464 | 473 | |
| 465 | 474 | return 0; |
| 466 | 475 | } |
| @@ -223,8 +223,6 @@ static void nvme_loop_submit_async_event(struct nvme_ctrl *arg, int aer_idx) · 222 unmodified lines | ||
| 223 | 223 | static int nvme_loop_init_iod(struct nvme_loop_ctrl *ctrl, |
| 224 | 224 | struct nvme_loop_iod *iod, unsigned int queue_idx) |
| 225 | 225 | { |
| 226 | − BUG_ON(queue_idx >= ctrl->queue_count); | |
| 227 | − | |
| 228 | 226 | iod->req.cmd = &iod->cmd; |
| 229 | 227 | iod->req.rsp = &iod->rsp; |
| 230 | 228 | iod->queue = &ctrl->queues[queue_idx]; |
| @@ -288,9 +286,9 @@ static struct blk_mq_ops nvme_loop_admin_mq_ops = { · 57 unmodified lines | ||
| 288 | 286 | |
| 289 | 287 | static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl) |
| 290 | 288 | { |
| 289 | + nvmet_sq_destroy(&ctrl->queues[0].nvme_sq); | |
| 291 | 290 | blk_cleanup_queue(ctrl->ctrl.admin_q); |
| 292 | 291 | blk_mq_free_tag_set(&ctrl->admin_tag_set); |
| 293 | − nvmet_sq_destroy(&ctrl->queues[0].nvme_sq); | |
| 294 | 292 | } |
| 295 | 293 | |
| 296 | 294 | static void nvme_loop_free_ctrl(struct nvme_ctrl *nctrl) |
| @@ -314,6 +312,43 @@ free_ctrl: · 17 unmodified lines | ||
| 314 | 312 | kfree(ctrl); |
| 315 | 313 | } |
| 316 | 314 | |
| 315 | +static void nvme_loop_destroy_io_queues(struct nvme_loop_ctrl *ctrl) | |
| 316 | +{ | |
| 317 | + int i; | |
| 318 | + | |
| 319 | + for (i = 1; i < ctrl->queue_count; i++) | |
| 320 | + nvmet_sq_destroy(&ctrl->queues[i].nvme_sq); | |
| 321 | +} | |
| 322 | + | |
| 323 | +static int nvme_loop_init_io_queues(struct nvme_loop_ctrl *ctrl) | |
| 324 | +{ | |
| 325 | + struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; | |
| 326 | + unsigned int nr_io_queues; | |
| 327 | + int ret, i; | |
| 328 | + | |
| 329 | + nr_io_queues = min(opts->nr_io_queues, num_online_cpus()); | |
| 330 | + ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); | |
| 331 | + if (ret || !nr_io_queues) | |
| 332 | + return ret; | |
| 333 | + | |
| 334 | + dev_info(ctrl->ctrl.device, "creating %d I/O queues.\n", nr_io_queues); | |
| 335 | + | |
| 336 | + for (i = 1; i <= nr_io_queues; i++) { | |
| 337 | + ctrl->queues[i].ctrl = ctrl; | |
| 338 | + ret = nvmet_sq_init(&ctrl->queues[i].nvme_sq); | |
| 339 | + if (ret) | |
| 340 | + goto out_destroy_queues; | |
| 341 | + | |
| 342 | + ctrl->queue_count++; | |
| 343 | + } | |
| 344 | + | |
| 345 | + return 0; | |
| 346 | + | |
| 347 | +out_destroy_queues: | |
| 348 | + nvme_loop_destroy_io_queues(ctrl); | |
| 349 | + return ret; | |
| 350 | +} | |
| 351 | + | |
| 317 | 352 | static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl) |
| 318 | 353 | { |
| 319 | 354 | int error; |
| @@ -385,17 +420,13 @@ out_free_sq: · 65 unmodified lines | ||
| 385 | 420 | |
| 386 | 421 | static void nvme_loop_shutdown_ctrl(struct nvme_loop_ctrl *ctrl) |
| 387 | 422 | { |
| 388 | − int i; | |
| 389 | − | |
| 390 | 423 | nvme_stop_keep_alive(&ctrl->ctrl); |
| 391 | 424 | |
| 392 | 425 | if (ctrl->queue_count > 1) { |
| 393 | 426 | nvme_stop_queues(&ctrl->ctrl); |
| 394 | 427 | blk_mq_tagset_busy_iter(&ctrl->tag_set, |
| 395 | 428 | nvme_cancel_request, &ctrl->ctrl); |
| 396 | − | |
| 397 | − for (i = 1; i < ctrl->queue_count; i++) | |
| 398 | − nvmet_sq_destroy(&ctrl->queues[i].nvme_sq); | |
| 429 | + nvme_loop_destroy_io_queues(ctrl); | |
| 399 | 430 | } |
| 400 | 431 | |
| 401 | 432 | if (ctrl->ctrl.state == NVME_CTRL_LIVE) |
| @@ -467,19 +498,14 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work) · 65 unmodified lines | ||
| 467 | 498 | if (ret) |
| 468 | 499 | goto out_disable; |
| 469 | 500 | |
| 470 | − for (i = 1; i <= ctrl->ctrl.opts->nr_io_queues; i++) { | |
| 471 | − ctrl->queues[i].ctrl = ctrl; | |
| 472 | − ret = nvmet_sq_init(&ctrl->queues[i].nvme_sq); | |
| 473 | − if (ret) | |
| 474 | − goto out_free_queues; | |
| 475 | − | |
| 476 | − ctrl->queue_count++; | |
| 477 | − } | |
| 501 | + ret = nvme_loop_init_io_queues(ctrl); | |
| 502 | + if (ret) | |
| 503 | + goto out_destroy_admin; | |
| 478 | 504 | |
| 479 | − for (i = 1; i <= ctrl->ctrl.opts->nr_io_queues; i++) { | |
| 505 | + for (i = 1; i < ctrl->queue_count; i++) { | |
| 480 | 506 | ret = nvmf_connect_io_queue(&ctrl->ctrl, i); |
| 481 | 507 | if (ret) |
| 482 | − goto out_free_queues; | |
| 508 | + goto out_destroy_io; | |
| 483 | 509 | } |
| 484 | 510 | |
| 485 | 511 | changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); |
| @@ -492,9 +518,9 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work) · 6 unmodified lines | ||
| 492 | 518 | |
| 493 | 519 | return; |
| 494 | 520 | |
| 495 | −out_free_queues: | |
| 496 | − for (i = 1; i < ctrl->queue_count; i++) | |
| 497 | − nvmet_sq_destroy(&ctrl->queues[i].nvme_sq); | |
| 521 | +out_destroy_io: | |
| 522 | + nvme_loop_destroy_io_queues(ctrl); | |
| 523 | +out_destroy_admin: | |
| 498 | 524 | nvme_loop_destroy_admin_queue(ctrl); |
| 499 | 525 | out_disable: |
| 500 | 526 | dev_warn(ctrl->ctrl.device, "Removing after reset failure\n"); |
| @@ -533,25 +559,12 @@ static const struct nvme_ctrl_ops nvme_loop_ctrl_ops = { · 32 unmodified lines | ||
| 533 | 559 | |
| 534 | 560 | static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl) |
| 535 | 561 | { |
| 536 | − struct nvmf_ctrl_options *opts = ctrl->ctrl.opts; | |
| 537 | 562 | int ret, i; |
| 538 | 563 | |
| 539 | − ret = nvme_set_queue_count(&ctrl->ctrl, &opts->nr_io_queues); | |
| 540 | − if (ret || !opts->nr_io_queues) | |
| 564 | + ret = nvme_loop_init_io_queues(ctrl); | |
| 565 | + if (ret) | |
| 541 | 566 | return ret; |
| 542 | 567 | |
| 543 | − dev_info(ctrl->ctrl.device, "creating %d I/O queues.\n", | |
| 544 | − opts->nr_io_queues); | |
| 545 | − | |
| 546 | − for (i = 1; i <= opts->nr_io_queues; i++) { | |
| 547 | − ctrl->queues[i].ctrl = ctrl; | |
| 548 | − ret = nvmet_sq_init(&ctrl->queues[i].nvme_sq); | |
| 549 | − if (ret) | |
| 550 | − goto out_destroy_queues; | |
| 551 | − | |
| 552 | − ctrl->queue_count++; | |
| 553 | − } | |
| 554 | − | |
| 555 | 568 | memset(&ctrl->tag_set, 0, sizeof(ctrl->tag_set)); |
| 556 | 569 | ctrl->tag_set.ops = &nvme_loop_mq_ops; |
| 557 | 570 | ctrl->tag_set.queue_depth = ctrl->ctrl.opts->queue_size; |
| @@ -575,7 +588,7 @@ static int nvme_loop_create_io_queues(struct nvme_loop_ctrl *ctrl) · 17 unmodified lines | ||
| 575 | 588 | goto out_free_tagset; |
| 576 | 589 | } |
| 577 | 590 | |
| 578 | − for (i = 1; i <= opts->nr_io_queues; i++) { | |
| 591 | + for (i = 1; i < ctrl->queue_count; i++) { | |
| 579 | 592 | ret = nvmf_connect_io_queue(&ctrl->ctrl, i); |
| 580 | 593 | if (ret) |
| 581 | 594 | goto out_cleanup_connect_q; |
| @@ -588,8 +601,7 @@ out_cleanup_connect_q: · 6 unmodified lines | ||
| 588 | 601 | out_free_tagset: |
| 589 | 602 | blk_mq_free_tag_set(&ctrl->tag_set); |
| 590 | 603 | out_destroy_queues: |
| 591 | − for (i = 1; i < ctrl->queue_count; i++) | |
| 592 | − nvmet_sq_destroy(&ctrl->queues[i].nvme_sq); | |
| 604 | + nvme_loop_destroy_io_queues(ctrl); | |
| 593 | 605 | return ret; |
| 594 | 606 | } |
| 595 | 607 | |
| @@ -73,6 +73,7 @@ struct nvmet_sq { · 72 unmodified lines | ||
| 73 | 73 | u16 qid; |
| 74 | 74 | u16 size; |
| 75 | 75 | struct completion free_done; |
| 76 | + struct completion confirm_done; | |
| 76 | 77 | }; |
| 77 | 78 | |
| 78 | 79 | /** |
| @@ -703,11 +703,6 @@ static void nvmet_rdma_handle_command(struct nvmet_rdma_queue *queue, · 702 unmodified lines | ||
| 703 | 703 | { |
| 704 | 704 | u16 status; |
| 705 | 705 | |
| 706 | − cmd->queue = queue; | |
| 707 | − cmd->n_rdma = 0; | |
| 708 | − cmd->req.port = queue->port; | |
| 709 | − | |
| 710 | − | |
| 711 | 706 | ib_dma_sync_single_for_cpu(queue->dev->device, |
| 712 | 707 | cmd->cmd->sge[0].addr, cmd->cmd->sge[0].length, |
| 713 | 708 | DMA_FROM_DEVICE); |
| @@ -760,9 +755,12 @@ static void nvmet_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 46 unmodified lines | ||
| 760 | 755 | |
| 761 | 756 | cmd->queue = queue; |
| 762 | 757 | rsp = nvmet_rdma_get_rsp(queue); |
| 758 | + rsp->queue = queue; | |
| 763 | 759 | rsp->cmd = cmd; |
| 764 | 760 | rsp->flags = 0; |
| 765 | 761 | rsp->req.cmd = cmd->nvme_cmd; |
| 762 | + rsp->req.port = queue->port; | |
| 763 | + rsp->n_rdma = 0; | |
| 766 | 764 | |
| 767 | 765 | if (unlikely(queue->state != NVMET_RDMA_Q_LIVE)) { |
| 768 | 766 | unsigned long flags; |
| @@ -939,8 +939,10 @@ parport_register_dev_model(struct parport *port, const char *name, · 938 unmodified lines | ||
| 939 | 939 | * pardevice fields. -arca |
| 940 | 940 | */ |
| 941 | 941 | port->ops->init_state(par_dev, par_dev->state); |
| 942 | − port->proc_device = par_dev; | |
| 943 | − parport_device_proc_register(par_dev); | |
| 942 | + if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) { | |
| 943 | + port->proc_device = par_dev; | |
| 944 | + parport_device_proc_register(par_dev); | |
| 945 | + } | |
| 944 | 946 | |
| 945 | 947 | return par_dev; |
| 946 | 948 | |
| @@ -449,6 +449,7 @@ config PHY_QCOM_UFS · 448 unmodified lines | ||
| 449 | 449 | config PHY_QCOM_USB_HS |
| 450 | 450 | tristate "Qualcomm USB HS PHY module" |
| 451 | 451 | depends on USB_ULPI_BUS |
| 452 | + depends on EXTCON || !EXTCON # if EXTCON=m, this cannot be built-in | |
| 452 | 453 | select GENERIC_PHY |
| 453 | 454 | help |
| 454 | 455 | Support for the USB high-speed ULPI compliant phy on Qualcomm |
| @@ -510,12 +511,4 @@ config PHY_MESON8B_USB2 · 55 unmodified lines | ||
| 510 | 511 | and GXBB SoCs. |
| 511 | 512 | If unsure, say N. |
| 512 | 513 | |
| 513 | −config PHY_NSP_USB3 | |
| 514 | − tristate "Broadcom NorthStar plus USB3 PHY driver" | |
| 515 | − depends on OF && (ARCH_BCM_NSP || COMPILE_TEST) | |
| 516 | − select GENERIC_PHY | |
| 517 | − default ARCH_BCM_NSP | |
| 518 | − help | |
| 519 | − Enable this to support the Broadcom Northstar plus USB3 PHY. | |
| 520 | − If unsure, say N. | |
| 521 | 514 | endmenu |
| @@ -62,4 +62,3 @@ obj-$(CONFIG_PHY_CYGNUS_PCIE) += phy-bcm-cygnus-pcie.o · 61 unmodified lines | ||
| 62 | 62 | obj-$(CONFIG_ARCH_TEGRA) += tegra/ |
| 63 | 63 | obj-$(CONFIG_PHY_NS2_PCIE) += phy-bcm-ns2-pcie.o |
| 64 | 64 | obj-$(CONFIG_PHY_MESON8B_USB2) += phy-meson8b-usb2.o |
| 65 | −obj-$(CONFIG_PHY_NSP_USB3) += phy-bcm-nsp-usb3.o | |
| @@ -1,177 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (C) 2016 Broadcom | |
| 3 | − * | |
| 4 | − * This program is free software; you can redistribute it and/or | |
| 5 | − * modify it under the terms of the GNU General Public License as | |
| 6 | − * published by the Free Software Foundation version 2. | |
| 7 | − * | |
| 8 | − * This program is distributed "as is" WITHOUT ANY WARRANTY of any | |
| 9 | − * kind, whether express or implied; without even the implied warranty | |
| 10 | − * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 11 | − * GNU General Public License for more details. | |
| 12 | − */ | |
| 13 | − | |
| 14 | −#include <linux/delay.h> | |
| 15 | −#include <linux/io.h> | |
| 16 | −#include <linux/kernel.h> | |
| 17 | −#include <linux/mfd/syscon.h> | |
| 18 | −#include <linux/mdio.h> | |
| 19 | −#include <linux/module.h> | |
| 20 | −#include <linux/of.h> | |
| 21 | −#include <linux/of_address.h> | |
| 22 | −#include <linux/phy/phy.h> | |
| 23 | −#include <linux/regmap.h> | |
| 24 | − | |
| 25 | −#define NSP_USB3_RST_CTRL_OFFSET 0x3f8 | |
| 26 | − | |
| 27 | −/* mdio reg access */ | |
| 28 | −#define NSP_USB3_PHY_BASE_ADDR_REG 0x1f | |
| 29 | − | |
| 30 | −#define NSP_USB3_PHY_PLL30_BLOCK 0x8000 | |
| 31 | −#define NSP_USB3_PLL_CONTROL 0x01 | |
| 32 | −#define NSP_USB3_PLLA_CONTROL0 0x0a | |
| 33 | −#define NSP_USB3_PLLA_CONTROL1 0x0b | |
| 34 | − | |
| 35 | −#define NSP_USB3_PHY_TX_PMD_BLOCK 0x8040 | |
| 36 | −#define NSP_USB3_TX_PMD_CONTROL1 0x01 | |
| 37 | − | |
| 38 | −#define NSP_USB3_PHY_PIPE_BLOCK 0x8060 | |
| 39 | −#define NSP_USB3_LFPS_CMP 0x02 | |
| 40 | −#define NSP_USB3_LFPS_DEGLITCH 0x03 | |
| 41 | − | |
| 42 | −struct nsp_usb3_phy { | |
| 43 | − struct regmap *usb3_ctrl; | |
| 44 | − struct phy *phy; | |
| 45 | − struct mdio_device *mdiodev; | |
| 46 | −}; | |
| 47 | − | |
| 48 | −static int nsp_usb3_phy_init(struct phy *phy) | |
| 49 | −{ | |
| 50 | − struct nsp_usb3_phy *iphy = phy_get_drvdata(phy); | |
| 51 | − struct mii_bus *bus = iphy->mdiodev->bus; | |
| 52 | − int addr = iphy->mdiodev->addr; | |
| 53 | − u32 data; | |
| 54 | − int rc; | |
| 55 | − | |
| 56 | − rc = regmap_read(iphy->usb3_ctrl, 0, &data); | |
| 57 | − if (rc) | |
| 58 | − return rc; | |
| 59 | − data |= 1; | |
| 60 | − rc = regmap_write(iphy->usb3_ctrl, 0, data); | |
| 61 | − if (rc) | |
| 62 | − return rc; | |
| 63 | − | |
| 64 | − rc = regmap_write(iphy->usb3_ctrl, NSP_USB3_RST_CTRL_OFFSET, 1); | |
| 65 | − if (rc) | |
| 66 | − return rc; | |
| 67 | − | |
| 68 | − rc = mdiobus_write(bus, addr, NSP_USB3_PHY_BASE_ADDR_REG, | |
| 69 | − NSP_USB3_PHY_PLL30_BLOCK); | |
| 70 | − if (rc) | |
| 71 | − return rc; | |
| 72 | − | |
| 73 | − rc = mdiobus_write(bus, addr, NSP_USB3_PLL_CONTROL, 0x1000); | |
| 74 | − if (rc) | |
| 75 | − return rc; | |
| 76 | − | |
| 77 | − rc = mdiobus_write(bus, addr, NSP_USB3_PLLA_CONTROL0, 0x6400); | |
| 78 | − if (rc) | |
| 79 | − return rc; | |
| 80 | − | |
| 81 | − rc = mdiobus_write(bus, addr, NSP_USB3_PLLA_CONTROL1, 0xc000); | |
| 82 | − if (rc) | |
| 83 | − return rc; | |
| 84 | − | |
| 85 | − rc = mdiobus_write(bus, addr, NSP_USB3_PLLA_CONTROL1, 0x8000); | |
| 86 | − if (rc) | |
| 87 | − return rc; | |
| 88 | − | |
| 89 | − rc = regmap_write(iphy->usb3_ctrl, NSP_USB3_RST_CTRL_OFFSET, 0); | |
| 90 | − if (rc) | |
| 91 | − return rc; | |
| 92 | − | |
| 93 | − rc = mdiobus_write(bus, addr, NSP_USB3_PLL_CONTROL, 0x9000); | |
| 94 | − if (rc) | |
| 95 | − return rc; | |
| 96 | − | |
| 97 | − rc = mdiobus_write(bus, addr, NSP_USB3_PHY_BASE_ADDR_REG, | |
| 98 | − NSP_USB3_PHY_PIPE_BLOCK); | |
| 99 | − if (rc) | |
| 100 | − return rc; | |
| 101 | − | |
| 102 | − rc = mdiobus_write(bus, addr, NSP_USB3_LFPS_CMP, 0xf30d); | |
| 103 | − if (rc) | |
| 104 | − return rc; | |
| 105 | − | |
| 106 | − rc = mdiobus_write(bus, addr, NSP_USB3_LFPS_DEGLITCH, 0x6302); | |
| 107 | − if (rc) | |
| 108 | − return rc; | |
| 109 | − | |
| 110 | − rc = mdiobus_write(bus, addr, NSP_USB3_PHY_BASE_ADDR_REG, | |
| 111 | − NSP_USB3_PHY_TX_PMD_BLOCK); | |
| 112 | − if (rc) | |
| 113 | − return rc; | |
| 114 | − | |
| 115 | − rc = mdiobus_write(bus, addr, NSP_USB3_TX_PMD_CONTROL1, 0x1003); | |
| 116 | − | |
| 117 | − return rc; | |
| 118 | −} | |
| 119 | − | |
| 120 | −static struct phy_ops nsp_usb3_phy_ops = { | |
| 121 | − .init = nsp_usb3_phy_init, | |
| 122 | − .owner = THIS_MODULE, | |
| 123 | −}; | |
| 124 | − | |
| 125 | −static int nsp_usb3_phy_probe(struct mdio_device *mdiodev) | |
| 126 | −{ | |
| 127 | − struct device *dev = &mdiodev->dev; | |
| 128 | − struct phy_provider *provider; | |
| 129 | − struct nsp_usb3_phy *iphy; | |
| 130 | − | |
| 131 | − iphy = devm_kzalloc(dev, sizeof(*iphy), GFP_KERNEL); | |
| 132 | − if (!iphy) | |
| 133 | − return -ENOMEM; | |
| 134 | − iphy->mdiodev = mdiodev; | |
| 135 | − | |
| 136 | − iphy->usb3_ctrl = syscon_regmap_lookup_by_phandle(dev->of_node, | |
| 137 | − "usb3-ctrl-syscon"); | |
| 138 | − if (IS_ERR(iphy->usb3_ctrl)) | |
| 139 | − return PTR_ERR(iphy->usb3_ctrl); | |
| 140 | − | |
| 141 | − iphy->phy = devm_phy_create(dev, dev->of_node, &nsp_usb3_phy_ops); | |
| 142 | − if (IS_ERR(iphy->phy)) { | |
| 143 | − dev_err(dev, "failed to create PHY\n"); | |
| 144 | − return PTR_ERR(iphy->phy); | |
| 145 | − } | |
| 146 | − | |
| 147 | − phy_set_drvdata(iphy->phy, iphy); | |
| 148 | − | |
| 149 | − provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); | |
| 150 | − if (IS_ERR(provider)) { | |
| 151 | − dev_err(dev, "could not register PHY provider\n"); | |
| 152 | − return PTR_ERR(provider); | |
| 153 | − } | |
| 154 | − | |
| 155 | − return 0; | |
| 156 | −} | |
| 157 | − | |
| 158 | −static const struct of_device_id nsp_usb3_phy_of_match[] = { | |
| 159 | − {.compatible = "brcm,nsp-usb3-phy",}, | |
| 160 | − { /* sentinel */ } | |
| 161 | −}; | |
| 162 | − | |
| 163 | −static struct mdio_driver nsp_usb3_phy_driver = { | |
| 164 | − .mdiodrv = { | |
| 165 | − .driver = { | |
| 166 | − .name = "nsp-usb3-phy", | |
| 167 | − .of_match_table = nsp_usb3_phy_of_match, | |
| 168 | − }, | |
| 169 | − }, | |
| 170 | − .probe = nsp_usb3_phy_probe, | |
| 171 | −}; | |
| 172 | − | |
| 173 | −mdio_module_driver(nsp_usb3_phy_driver); | |
| 174 | − | |
| 175 | −MODULE_DESCRIPTION("Broadcom NSP USB3 PHY driver"); | |
| 176 | −MODULE_LICENSE("GPL v2"); | |
| 177 | −MODULE_AUTHOR("Yendapally Reddy Dhananjaya Reddy <yendapally.reddy@broadcom.com"); | |
| @@ -254,8 +254,8 @@ static int exynos_pcie_phy_probe(struct platform_device *pdev) · 253 unmodified lines | ||
| 254 | 254 | |
| 255 | 255 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
| 256 | 256 | exynos_phy->blk_base = devm_ioremap_resource(dev, res); |
| 257 | − if (IS_ERR(exynos_phy->phy_base)) | |
| 258 | − return PTR_ERR(exynos_phy->phy_base); | |
| 257 | + if (IS_ERR(exynos_phy->blk_base)) | |
| 258 | + return PTR_ERR(exynos_phy->blk_base); | |
| 259 | 259 | |
| 260 | 260 | exynos_phy->drv_data = drv_data; |
| 261 | 261 | |
| @@ -76,7 +76,7 @@ config QCOM_ADSP_PIL · 75 unmodified lines | ||
| 76 | 76 | depends on OF && ARCH_QCOM |
| 77 | 77 | depends on REMOTEPROC |
| 78 | 78 | depends on QCOM_SMEM |
| 79 | − depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n) | |
| 79 | + depends on RPMSG_QCOM_SMD || QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n && RPMSG_QCOM_SMD=n) | |
| 80 | 80 | select MFD_SYSCON |
| 81 | 81 | select QCOM_MDT_LOADER |
| 82 | 82 | select QCOM_RPROC_COMMON |
| @@ -93,7 +93,7 @@ config QCOM_Q6V5_PIL · 10 unmodified lines | ||
| 93 | 93 | depends on OF && ARCH_QCOM |
| 94 | 94 | depends on QCOM_SMEM |
| 95 | 95 | depends on REMOTEPROC |
| 96 | − depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n) | |
| 96 | + depends on RPMSG_QCOM_SMD || QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n && RPMSG_QCOM_SMD=n) | |
| 97 | 97 | select MFD_SYSCON |
| 98 | 98 | select QCOM_RPROC_COMMON |
| 99 | 99 | select QCOM_SCM |
| @@ -104,7 +104,7 @@ config QCOM_Q6V5_PIL · 4 unmodified lines | ||
| 104 | 104 | config QCOM_WCNSS_PIL |
| 105 | 105 | tristate "Qualcomm WCNSS Peripheral Image Loader" |
| 106 | 106 | depends on OF && ARCH_QCOM |
| 107 | − depends on QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n) | |
| 107 | + depends on RPMSG_QCOM_SMD || QCOM_SMD || (COMPILE_TEST && QCOM_SMD=n && RPMSG_QCOM_SMD=n) | |
| 108 | 108 | depends on QCOM_SMEM |
| 109 | 109 | depends on REMOTEPROC |
| 110 | 110 | select QCOM_MDT_LOADER |
| @@ -1253,20 +1253,6 @@ config SCSI_LPFC_DEBUG_FS · 1252 unmodified lines | ||
| 1253 | 1253 | This makes debugging information from the lpfc driver |
| 1254 | 1254 | available via the debugfs filesystem. |
| 1255 | 1255 | |
| 1256 | −config LPFC_NVME_INITIATOR | |
| 1257 | − bool "Emulex LightPulse Fibre Channel NVME Initiator Support" | |
| 1258 | − depends on SCSI_LPFC && NVME_FC | |
| 1259 | − ---help--- | |
| 1260 | − This enables NVME Initiator support in the Emulex lpfc driver. | |
| 1261 | − | |
| 1262 | −config LPFC_NVME_TARGET | |
| 1263 | − bool "Emulex LightPulse Fibre Channel NVME Initiator Support" | |
| 1264 | − depends on SCSI_LPFC && NVME_TARGET_FC | |
| 1265 | − ---help--- | |
| 1266 | − This enables NVME Target support in the Emulex lpfc driver. | |
| 1267 | − Target enablement must still be enabled on a per adapter | |
| 1268 | − basis by module parameters. | |
| 1269 | − | |
| 1270 | 1256 | config SCSI_SIM710 |
| 1271 | 1257 | tristate "Simple 53c710 SCSI support (Compaq, NCR machines)" |
| 1272 | 1258 | depends on (EISA || MCA) && SCSI |
| @@ -2956,7 +2956,7 @@ static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr, · 2955 unmodified lines | ||
| 2956 | 2956 | /* fill_cmd can't fail here, no data buffer to map. */ |
| 2957 | 2957 | (void) fill_cmd(c, reset_type, h, NULL, 0, 0, |
| 2958 | 2958 | scsi3addr, TYPE_MSG); |
| 2959 | − rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, DEFAULT_TIMEOUT); | |
| 2959 | + rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); | |
| 2960 | 2960 | if (rc) { |
| 2961 | 2961 | dev_warn(&h->pdev->dev, "Failed to send reset command\n"); |
| 2962 | 2962 | goto out; |
| @@ -3714,7 +3714,7 @@ exit_failed: · 751 unmodified lines | ||
| 3714 | 3714 | * # (integer code indicating one of several NOT READY states |
| 3715 | 3715 | * describing why a volume is to be kept offline) |
| 3716 | 3716 | */ |
| 3717 | −static int hpsa_volume_offline(struct ctlr_info *h, | |
| 3717 | +static unsigned char hpsa_volume_offline(struct ctlr_info *h, | |
| 3718 | 3718 | unsigned char scsi3addr[]) |
| 3719 | 3719 | { |
| 3720 | 3720 | struct CommandList *c; |
| @@ -3735,7 +3735,7 @@ static int hpsa_volume_offline(struct ctlr_info *h, · 14 unmodified lines | ||
| 3735 | 3735 | DEFAULT_TIMEOUT); |
| 3736 | 3736 | if (rc) { |
| 3737 | 3737 | cmd_free(h, c); |
| 3738 | − return 0; | |
| 3738 | + return HPSA_VPD_LV_STATUS_UNSUPPORTED; | |
| 3739 | 3739 | } |
| 3740 | 3740 | sense = c->err_info->SenseInfo; |
| 3741 | 3741 | if (c->err_info->SenseLen > sizeof(c->err_info->SenseInfo)) |
| @@ -3746,19 +3746,13 @@ static int hpsa_volume_offline(struct ctlr_info *h, · 4 unmodified lines | ||
| 3746 | 3746 | cmd_status = c->err_info->CommandStatus; |
| 3747 | 3747 | scsi_status = c->err_info->ScsiStatus; |
| 3748 | 3748 | cmd_free(h, c); |
| 3749 | − /* Is the volume 'not ready'? */ | |
| 3750 | − if (cmd_status != CMD_TARGET_STATUS || | |
| 3751 | − scsi_status != SAM_STAT_CHECK_CONDITION || | |
| 3752 | − sense_key != NOT_READY || | |
| 3753 | − asc != ASC_LUN_NOT_READY) { | |
| 3754 | − return 0; | |
| 3755 | − } | |
| 3756 | 3749 | |
| 3757 | 3750 | /* Determine the reason for not ready state */ |
| 3758 | 3751 | ldstat = hpsa_get_volume_status(h, scsi3addr); |
| 3759 | 3752 | |
| 3760 | 3753 | /* Keep volume offline in certain cases: */ |
| 3761 | 3754 | switch (ldstat) { |
| 3755 | + case HPSA_LV_FAILED: | |
| 3762 | 3756 | case HPSA_LV_UNDERGOING_ERASE: |
| 3763 | 3757 | case HPSA_LV_NOT_AVAILABLE: |
| 3764 | 3758 | case HPSA_LV_UNDERGOING_RPI: |
| @@ -3780,7 +3774,7 @@ static int hpsa_volume_offline(struct ctlr_info *h, · 15 unmodified lines | ||
| 3780 | 3774 | default: |
| 3781 | 3775 | break; |
| 3782 | 3776 | } |
| 3783 | − return 0; | |
| 3777 | + return HPSA_LV_OK; | |
| 3784 | 3778 | } |
| 3785 | 3779 | |
| 3786 | 3780 | /* |
| @@ -3853,10 +3847,10 @@ static int hpsa_update_device_info(struct ctlr_info *h, · 66 unmodified lines | ||
| 3853 | 3847 | /* Do an inquiry to the device to see what it is. */ |
| 3854 | 3848 | if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff, |
| 3855 | 3849 | (unsigned char) OBDR_TAPE_INQ_SIZE) != 0) { |
| 3856 | − /* Inquiry failed (msg printed already) */ | |
| 3857 | 3850 | dev_err(&h->pdev->dev, |
| 3858 | − "hpsa_update_device_info: inquiry failed\n"); | |
| 3859 | − rc = -EIO; | |
| 3851 | + "%s: inquiry failed, device will be skipped.\n", | |
| 3852 | + __func__); | |
| 3853 | + rc = HPSA_INQUIRY_FAILED; | |
| 3860 | 3854 | goto bail_out; |
| 3861 | 3855 | } |
| 3862 | 3856 | |
| @@ -3885,15 +3879,19 @@ static int hpsa_update_device_info(struct ctlr_info *h, · 22 unmodified lines | ||
| 3885 | 3879 | if ((this_device->devtype == TYPE_DISK || |
| 3886 | 3880 | this_device->devtype == TYPE_ZBC) && |
| 3887 | 3881 | is_logical_dev_addr_mode(scsi3addr)) { |
| 3888 | − int volume_offline; | |
| 3882 | + unsigned char volume_offline; | |
| 3889 | 3883 | |
| 3890 | 3884 | hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level); |
| 3891 | 3885 | if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC) |
| 3892 | 3886 | hpsa_get_ioaccel_status(h, scsi3addr, this_device); |
| 3893 | 3887 | volume_offline = hpsa_volume_offline(h, scsi3addr); |
| 3894 | − if (volume_offline < 0 || volume_offline > 0xff) | |
| 3895 | − volume_offline = HPSA_VPD_LV_STATUS_UNSUPPORTED; | |
| 3896 | − this_device->volume_offline = volume_offline & 0xff; | |
| 3888 | + if (volume_offline == HPSA_LV_FAILED) { | |
| 3889 | + rc = HPSA_LV_FAILED; | |
| 3890 | + dev_err(&h->pdev->dev, | |
| 3891 | + "%s: LV failed, device will be skipped.\n", | |
| 3892 | + __func__); | |
| 3893 | + goto bail_out; | |
| 3894 | + } | |
| 3897 | 3895 | } else { |
| 3898 | 3896 | this_device->raid_level = RAID_UNKNOWN; |
| 3899 | 3897 | this_device->offload_config = 0; |
| @@ -4379,8 +4377,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h) · 479 unmodified lines | ||
| 4379 | 4377 | goto out; |
| 4380 | 4378 | } |
| 4381 | 4379 | if (rc) { |
| 4382 | − dev_warn(&h->pdev->dev, | |
| 4383 | − "Inquiry failed, skipping device.\n"); | |
| 4380 | + h->drv_req_rescan = 1; | |
| 4384 | 4381 | continue; |
| 4385 | 4382 | } |
| 4386 | 4383 | |
| @@ -5558,7 +5555,7 @@ static void hpsa_scan_complete(struct ctlr_info *h) · 1171 unmodified lines | ||
| 5558 | 5555 | |
| 5559 | 5556 | spin_lock_irqsave(&h->scan_lock, flags); |
| 5560 | 5557 | h->scan_finished = 1; |
| 5561 | − wake_up_all(&h->scan_wait_queue); | |
| 5558 | + wake_up(&h->scan_wait_queue); | |
| 5562 | 5559 | spin_unlock_irqrestore(&h->scan_lock, flags); |
| 5563 | 5560 | } |
| 5564 | 5561 | |
| @@ -5576,11 +5573,23 @@ static void hpsa_scan_start(struct Scsi_Host *sh) · 11 unmodified lines | ||
| 5576 | 5573 | if (unlikely(lockup_detected(h))) |
| 5577 | 5574 | return hpsa_scan_complete(h); |
| 5578 | 5575 | |
| 5576 | + /* | |
| 5577 | + * If a scan is already waiting to run, no need to add another | |
| 5578 | + */ | |
| 5579 | + spin_lock_irqsave(&h->scan_lock, flags); | |
| 5580 | + if (h->scan_waiting) { | |
| 5581 | + spin_unlock_irqrestore(&h->scan_lock, flags); | |
| 5582 | + return; | |
| 5583 | + } | |
| 5584 | + | |
| 5585 | + spin_unlock_irqrestore(&h->scan_lock, flags); | |
| 5586 | + | |
| 5579 | 5587 | /* wait until any scan already in progress is finished. */ |
| 5580 | 5588 | while (1) { |
| 5581 | 5589 | spin_lock_irqsave(&h->scan_lock, flags); |
| 5582 | 5590 | if (h->scan_finished) |
| 5583 | 5591 | break; |
| 5592 | + h->scan_waiting = 1; | |
| 5584 | 5593 | spin_unlock_irqrestore(&h->scan_lock, flags); |
| 5585 | 5594 | wait_event(h->scan_wait_queue, h->scan_finished); |
| 5586 | 5595 | /* Note: We don't need to worry about a race between this |
| @@ -5590,6 +5599,7 @@ static void hpsa_scan_start(struct Scsi_Host *sh) · 3 unmodified lines | ||
| 5590 | 5599 | */ |
| 5591 | 5600 | } |
| 5592 | 5601 | h->scan_finished = 0; /* mark scan as in progress */ |
| 5602 | + h->scan_waiting = 0; | |
| 5593 | 5603 | spin_unlock_irqrestore(&h->scan_lock, flags); |
| 5594 | 5604 | |
| 5595 | 5605 | if (unlikely(lockup_detected(h))) |
| @@ -8792,6 +8802,7 @@ reinit_after_soft_reset: · 3196 unmodified lines | ||
| 8792 | 8802 | init_waitqueue_head(&h->event_sync_wait_queue); |
| 8793 | 8803 | mutex_init(&h->reset_mutex); |
| 8794 | 8804 | h->scan_finished = 1; /* no scan currently in progress */ |
| 8805 | + h->scan_waiting = 0; | |
| 8795 | 8806 | |
| 8796 | 8807 | pci_set_drvdata(pdev, h); |
| 8797 | 8808 | h->ndevices = 0; |
| @@ -201,6 +201,7 @@ struct ctlr_info { · 200 unmodified lines | ||
| 201 | 201 | dma_addr_t errinfo_pool_dhandle; |
| 202 | 202 | unsigned long *cmd_pool_bits; |
| 203 | 203 | int scan_finished; |
| 204 | + u8 scan_waiting : 1; | |
| 204 | 205 | spinlock_t scan_lock; |
| 205 | 206 | wait_queue_head_t scan_wait_queue; |
| 206 | 207 | |
| @@ -156,6 +156,7 @@ · 155 unmodified lines | ||
| 156 | 156 | #define CFGTBL_BusType_Fibre2G 0x00000200l |
| 157 | 157 | |
| 158 | 158 | /* VPD Inquiry types */ |
| 159 | +#define HPSA_INQUIRY_FAILED 0x02 | |
| 159 | 160 | #define HPSA_VPD_SUPPORTED_PAGES 0x00 |
| 160 | 161 | #define HPSA_VPD_LV_DEVICE_ID 0x83 |
| 161 | 162 | #define HPSA_VPD_LV_DEVICE_GEOMETRY 0xC1 |
| @@ -166,6 +167,7 @@ · 4 unmodified lines | ||
| 166 | 167 | /* Logical volume states */ |
| 167 | 168 | #define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff |
| 168 | 169 | #define HPSA_LV_OK 0x0 |
| 170 | +#define HPSA_LV_FAILED 0x01 | |
| 169 | 171 | #define HPSA_LV_NOT_AVAILABLE 0x0b |
| 170 | 172 | #define HPSA_LV_UNDERGOING_ERASE 0x0F |
| 171 | 173 | #define HPSA_LV_UNDERGOING_RPI 0x12 |
| @@ -3315,9 +3315,9 @@ LPFC_ATTR_R(nvmet_mrq_post, LPFC_DEF_MRQ_POST, · 3314 unmodified lines | ||
| 3315 | 3315 | * lpfc_enable_fc4_type: Defines what FC4 types are supported. |
| 3316 | 3316 | * Supported Values: 1 - register just FCP |
| 3317 | 3317 | * 3 - register both FCP and NVME |
| 3318 | − * Supported values are [1,3]. Default value is 3 | |
| 3318 | + * Supported values are [1,3]. Default value is 1 | |
| 3319 | 3319 | */ |
| 3320 | −LPFC_ATTR_R(enable_fc4_type, LPFC_ENABLE_BOTH, | |
| 3320 | +LPFC_ATTR_R(enable_fc4_type, LPFC_ENABLE_FCP, | |
| 3321 | 3321 | LPFC_ENABLE_FCP, LPFC_ENABLE_BOTH, |
| 3322 | 3322 | "Define fc4 type to register with fabric."); |
| 3323 | 3323 | |
| @@ -5891,10 +5891,17 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) · 5890 unmodified lines | ||
| 5891 | 5891 | /* Check to see if it matches any module parameter */ |
| 5892 | 5892 | for (i = 0; i < lpfc_enable_nvmet_cnt; i++) { |
| 5893 | 5893 | if (wwn == lpfc_enable_nvmet[i]) { |
| 5894 | +#if (IS_ENABLED(CONFIG_NVME_TARGET_FC)) | |
| 5894 | 5895 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
| 5895 | 5896 | "6017 NVME Target %016llx\n", |
| 5896 | 5897 | wwn); |
| 5897 | 5898 | phba->nvmet_support = 1; /* a match */ |
| 5899 | +#else | |
| 5900 | + lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | |
| 5901 | + "6021 Can't enable NVME Target." | |
| 5902 | + " NVME_TARGET_FC infrastructure" | |
| 5903 | + " is not in kernel\n"); | |
| 5904 | +#endif | |
| 5898 | 5905 | } |
| 5899 | 5906 | } |
| 5900 | 5907 | } |
| @@ -2149,7 +2149,7 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 2148 unmodified lines | ||
| 2149 | 2149 | /* localport is allocated from the stack, but the registration |
| 2150 | 2150 | * call allocates heap memory as well as the private area. |
| 2151 | 2151 | */ |
| 2152 | −#ifdef CONFIG_LPFC_NVME_INITIATOR | |
| 2152 | +#if (IS_ENABLED(CONFIG_NVME_FC)) | |
| 2153 | 2153 | ret = nvme_fc_register_localport(&nfcp_info, &lpfc_nvme_template, |
| 2154 | 2154 | &vport->phba->pcidev->dev, &localport); |
| 2155 | 2155 | #else |
| @@ -2190,7 +2190,7 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 34 unmodified lines | ||
| 2190 | 2190 | void |
| 2191 | 2191 | lpfc_nvme_destroy_localport(struct lpfc_vport *vport) |
| 2192 | 2192 | { |
| 2193 | −#ifdef CONFIG_LPFC_NVME_INITIATOR | |
| 2193 | +#if (IS_ENABLED(CONFIG_NVME_FC)) | |
| 2194 | 2194 | struct nvme_fc_local_port *localport; |
| 2195 | 2195 | struct lpfc_nvme_lport *lport; |
| 2196 | 2196 | struct lpfc_nvme_rport *rport = NULL, *rport_next = NULL; |
| @@ -2274,7 +2274,7 @@ lpfc_nvme_update_localport(struct lpfc_vport *vport) · 77 unmodified lines | ||
| 2274 | 2274 | int |
| 2275 | 2275 | lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
| 2276 | 2276 | { |
| 2277 | −#ifdef CONFIG_LPFC_NVME_INITIATOR | |
| 2277 | +#if (IS_ENABLED(CONFIG_NVME_FC)) | |
| 2278 | 2278 | int ret = 0; |
| 2279 | 2279 | struct nvme_fc_local_port *localport; |
| 2280 | 2280 | struct lpfc_nvme_lport *lport; |
| @@ -2403,7 +2403,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 122 unmodified lines | ||
| 2403 | 2403 | void |
| 2404 | 2404 | lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) |
| 2405 | 2405 | { |
| 2406 | −#ifdef CONFIG_LPFC_NVME_INITIATOR | |
| 2406 | +#if (IS_ENABLED(CONFIG_NVME_FC)) | |
| 2407 | 2407 | int ret; |
| 2408 | 2408 | struct nvme_fc_local_port *localport; |
| 2409 | 2409 | struct lpfc_nvme_lport *lport; |
| @@ -671,7 +671,7 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba) · 670 unmodified lines | ||
| 671 | 671 | lpfc_tgttemplate.target_features = NVMET_FCTGTFEAT_READDATA_RSP | |
| 672 | 672 | NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED; |
| 673 | 673 | |
| 674 | −#ifdef CONFIG_LPFC_NVME_TARGET | |
| 674 | +#if (IS_ENABLED(CONFIG_NVME_TARGET_FC)) | |
| 675 | 675 | error = nvmet_fc_register_targetport(&pinfo, &lpfc_tgttemplate, |
| 676 | 676 | &phba->pcidev->dev, |
| 677 | 677 | &phba->targetport); |
| @@ -756,7 +756,7 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba, · 78 unmodified lines | ||
| 756 | 756 | void |
| 757 | 757 | lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba) |
| 758 | 758 | { |
| 759 | −#ifdef CONFIG_LPFC_NVME_TARGET | |
| 759 | +#if (IS_ENABLED(CONFIG_NVME_TARGET_FC)) | |
| 760 | 760 | struct lpfc_nvmet_tgtport *tgtp; |
| 761 | 761 | |
| 762 | 762 | if (phba->nvmet_support == 0) |
| @@ -788,7 +788,7 @@ static void · 25 unmodified lines | ||
| 788 | 788 | lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, |
| 789 | 789 | struct hbq_dmabuf *nvmebuf) |
| 790 | 790 | { |
| 791 | −#ifdef CONFIG_LPFC_NVME_TARGET | |
| 791 | +#if (IS_ENABLED(CONFIG_NVME_TARGET_FC)) | |
| 792 | 792 | struct lpfc_nvmet_tgtport *tgtp; |
| 793 | 793 | struct fc_frame_header *fc_hdr; |
| 794 | 794 | struct lpfc_nvmet_rcv_ctx *ctxp; |
| @@ -891,7 +891,7 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba, · 96 unmodified lines | ||
| 891 | 891 | struct rqb_dmabuf *nvmebuf, |
| 892 | 892 | uint64_t isr_timestamp) |
| 893 | 893 | { |
| 894 | −#ifdef CONFIG_LPFC_NVME_TARGET | |
| 894 | +#if (IS_ENABLED(CONFIG_NVME_TARGET_FC)) | |
| 895 | 895 | struct lpfc_nvmet_rcv_ctx *ctxp; |
| 896 | 896 | struct lpfc_nvmet_tgtport *tgtp; |
| 897 | 897 | struct fc_frame_header *fc_hdr; |
| @@ -35,8 +35,8 @@ · 34 unmodified lines | ||
| 35 | 35 | /* |
| 36 | 36 | * MegaRAID SAS Driver meta data |
| 37 | 37 | */ |
| 38 | −#define MEGASAS_VERSION "07.701.16.00-rc1" | |
| 39 | −#define MEGASAS_RELDATE "February 2, 2017" | |
| 38 | +#define MEGASAS_VERSION "07.701.17.00-rc1" | |
| 39 | +#define MEGASAS_RELDATE "March 2, 2017" | |
| 40 | 40 | |
| 41 | 41 | /* |
| 42 | 42 | * Device IDs |
| @@ -1963,6 +1963,9 @@ scan_target: · 1962 unmodified lines | ||
| 1963 | 1963 | if (!mr_device_priv_data) |
| 1964 | 1964 | return -ENOMEM; |
| 1965 | 1965 | sdev->hostdata = mr_device_priv_data; |
| 1966 | + | |
| 1967 | + atomic_set(&mr_device_priv_data->r1_ldio_hint, | |
| 1968 | + instance->r1_ldio_hint_default); | |
| 1966 | 1969 | return 0; |
| 1967 | 1970 | } |
| 1968 | 1971 | |
| @@ -5034,10 +5037,12 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) · 3065 unmodified lines | ||
| 5034 | 5037 | &instance->irq_context[j]); |
| 5035 | 5038 | /* Retry irq register for IO_APIC*/ |
| 5036 | 5039 | instance->msix_vectors = 0; |
| 5037 | − if (is_probe) | |
| 5040 | + if (is_probe) { | |
| 5041 | + pci_free_irq_vectors(instance->pdev); | |
| 5038 | 5042 | return megasas_setup_irqs_ioapic(instance); |
| 5039 | − else | |
| 5043 | + } else { | |
| 5040 | 5044 | return -1; |
| 5045 | + } | |
| 5041 | 5046 | } |
| 5042 | 5047 | } |
| 5043 | 5048 | return 0; |
| @@ -5277,9 +5282,11 @@ static int megasas_init_fw(struct megasas_instance *instance) · 233 unmodified lines | ||
| 5277 | 5282 | MPI2_REPLY_POST_HOST_INDEX_OFFSET); |
| 5278 | 5283 | } |
| 5279 | 5284 | |
| 5280 | − i = pci_alloc_irq_vectors(instance->pdev, 1, 1, PCI_IRQ_LEGACY); | |
| 5281 | − if (i < 0) | |
| 5282 | − goto fail_setup_irqs; | |
| 5285 | + if (!instance->msix_vectors) { | |
| 5286 | + i = pci_alloc_irq_vectors(instance->pdev, 1, 1, PCI_IRQ_LEGACY); | |
| 5287 | + if (i < 0) | |
| 5288 | + goto fail_setup_irqs; | |
| 5289 | + } | |
| 5283 | 5290 | |
| 5284 | 5291 | dev_info(&instance->pdev->dev, |
| 5285 | 5292 | "firmware supports msix\t: (%d)", fw_msix_count); |
| @@ -2159,7 +2159,7 @@ megasas_set_raidflag_cpu_affinity(union RAID_CONTEXT_UNION *praid_context, · 2158 unmodified lines | ||
| 2159 | 2159 | cpu_sel = MR_RAID_CTX_CPUSEL_1; |
| 2160 | 2160 | |
| 2161 | 2161 | if (is_stream_detected(rctx_g35) && |
| 2162 | − (raid->level == 5) && | |
| 2162 | + ((raid->level == 5) || (raid->level == 6)) && | |
| 2163 | 2163 | (raid->writeMode == MR_RL_WRITE_THROUGH_MODE) && |
| 2164 | 2164 | (cpu_sel == MR_RAID_CTX_CPUSEL_FCFS)) |
| 2165 | 2165 | cpu_sel = MR_RAID_CTX_CPUSEL_0; |
| @@ -2338,7 +2338,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, · 172 unmodified lines | ||
| 2338 | 2338 | fp_possible = false; |
| 2339 | 2339 | atomic_dec(&instance->fw_outstanding); |
| 2340 | 2340 | } else if ((scsi_buff_len > MR_LARGE_IO_MIN_SIZE) || |
| 2341 | − atomic_dec_if_positive(&mrdev_priv->r1_ldio_hint)) { | |
| 2341 | + (atomic_dec_if_positive(&mrdev_priv->r1_ldio_hint) > 0)) { | |
| 2342 | 2342 | fp_possible = false; |
| 2343 | 2343 | atomic_dec(&instance->fw_outstanding); |
| 2344 | 2344 | if (scsi_buff_len > MR_LARGE_IO_MIN_SIZE) |
| @@ -7642,7 +7642,7 @@ static inline ssize_t ufshcd_pm_lvl_store(struct device *dev, · 7641 unmodified lines | ||
| 7642 | 7642 | if (kstrtoul(buf, 0, &value)) |
| 7643 | 7643 | return -EINVAL; |
| 7644 | 7644 | |
| 7645 | − if ((value < UFS_PM_LVL_0) || (value >= UFS_PM_LVL_MAX)) | |
| 7645 | + if (value >= UFS_PM_LVL_MAX) | |
| 7646 | 7646 | return -EINVAL; |
| 7647 | 7647 | |
| 7648 | 7648 | spin_lock_irqsave(hba->host->host_lock, flags); |
| @@ -257,7 +257,7 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, · 256 unmodified lines | ||
| 257 | 257 | { |
| 258 | 258 | unsigned int baud = tty_termios_baud_rate(termios); |
| 259 | 259 | struct dw8250_data *d = p->private_data; |
| 260 | − unsigned int rate; | |
| 260 | + long rate; | |
| 261 | 261 | int ret; |
| 262 | 262 | |
| 263 | 263 | if (IS_ERR(d->clk) || !old) |
| @@ -265,7 +265,12 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, · 1 unmodified line | ||
| 265 | 265 | |
| 266 | 266 | clk_disable_unprepare(d->clk); |
| 267 | 267 | rate = clk_round_rate(d->clk, baud * 16); |
| 268 | − ret = clk_set_rate(d->clk, rate); | |
| 268 | + if (rate < 0) | |
| 269 | + ret = rate; | |
| 270 | + else if (rate == 0) | |
| 271 | + ret = -ENOENT; | |
| 272 | + else | |
| 273 | + ret = clk_set_rate(d->clk, rate); | |
| 269 | 274 | clk_prepare_enable(d->clk); |
| 270 | 275 | |
| 271 | 276 | if (!ret) |
| @@ -2373,7 +2373,7 @@ static int __init pl011_console_match(struct console *co, char *name, int idx, · 2372 unmodified lines | ||
| 2373 | 2373 | if (strcmp(name, "qdf2400_e44") == 0) { |
| 2374 | 2374 | pr_info_once("UART: Working around QDF2400 SoC erratum 44"); |
| 2375 | 2375 | qdf2400_e44_present = true; |
| 2376 | − } else if (strcmp(name, "pl011") != 0 || strcmp(name, "ttyAMA") != 0) { | |
| 2376 | + } else if (strcmp(name, "pl011") != 0) { | |
| 2377 | 2377 | return -ENODEV; |
| 2378 | 2378 | } |
| 2379 | 2379 | |
| @@ -575,12 +575,13 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios, · 574 unmodified lines | ||
| 575 | 575 | pinctrl_select_state(ascport->pinctrl, |
| 576 | 576 | ascport->states[NO_HW_FLOWCTRL]); |
| 577 | 577 | |
| 578 | − gpiod = devm_get_gpiod_from_child(port->dev, "rts", | |
| 579 | − &np->fwnode); | |
| 580 | − if (!IS_ERR(gpiod)) { | |
| 581 | − gpiod_direction_output(gpiod, 0); | |
| 578 | + gpiod = devm_fwnode_get_gpiod_from_child(port->dev, | |
| 579 | + "rts", | |
| 580 | + &np->fwnode, | |
| 581 | + GPIOD_OUT_LOW, | |
| 582 | + np->name); | |
| 583 | + if (!IS_ERR(gpiod)) | |
| 582 | 584 | ascport->rts = gpiod; |
| 583 | − } | |
| 584 | 585 | } |
| 585 | 586 | } |
| 586 | 587 | |
| @@ -271,10 +271,13 @@ const struct file_operations tty_ldiscs_proc_fops = { · 270 unmodified lines | ||
| 271 | 271 | |
| 272 | 272 | struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *tty) |
| 273 | 273 | { |
| 274 | + struct tty_ldisc *ld; | |
| 275 | + | |
| 274 | 276 | ldsem_down_read(&tty->ldisc_sem, MAX_SCHEDULE_TIMEOUT); |
| 275 | − if (!tty->ldisc) | |
| 277 | + ld = tty->ldisc; | |
| 278 | + if (!ld) | |
| 276 | 279 | ldsem_up_read(&tty->ldisc_sem); |
| 277 | − return tty->ldisc; | |
| 280 | + return ld; | |
| 278 | 281 | } |
| 279 | 282 | EXPORT_SYMBOL_GPL(tty_ldisc_ref_wait); |
| 280 | 283 | |
| @@ -488,41 +491,6 @@ static void tty_ldisc_close(struct tty_struct *tty, struct tty_ldisc *ld) · 207 unmodified lines | ||
| 488 | 491 | tty_ldisc_debug(tty, "%p: closed\n", ld); |
| 489 | 492 | } |
| 490 | 493 | |
| 491 | −/** | |
| 492 | − * tty_ldisc_restore - helper for tty ldisc change | |
| 493 | − * @tty: tty to recover | |
| 494 | − * @old: previous ldisc | |
| 495 | − * | |
| 496 | − * Restore the previous line discipline or N_TTY when a line discipline | |
| 497 | − * change fails due to an open error | |
| 498 | − */ | |
| 499 | − | |
| 500 | −static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) | |
| 501 | −{ | |
| 502 | − struct tty_ldisc *new_ldisc; | |
| 503 | − int r; | |
| 504 | − | |
| 505 | − /* There is an outstanding reference here so this is safe */ | |
| 506 | − old = tty_ldisc_get(tty, old->ops->num); | |
| 507 | − WARN_ON(IS_ERR(old)); | |
| 508 | − tty->ldisc = old; | |
| 509 | − tty_set_termios_ldisc(tty, old->ops->num); | |
| 510 | − if (tty_ldisc_open(tty, old) < 0) { | |
| 511 | − tty_ldisc_put(old); | |
| 512 | − /* This driver is always present */ | |
| 513 | − new_ldisc = tty_ldisc_get(tty, N_TTY); | |
| 514 | − if (IS_ERR(new_ldisc)) | |
| 515 | − panic("n_tty: get"); | |
| 516 | − tty->ldisc = new_ldisc; | |
| 517 | − tty_set_termios_ldisc(tty, N_TTY); | |
| 518 | − r = tty_ldisc_open(tty, new_ldisc); | |
| 519 | − if (r < 0) | |
| 520 | − panic("Couldn't open N_TTY ldisc for " | |
| 521 | − "%s --- error %d.", | |
| 522 | − tty_name(tty), r); | |
| 523 | − } | |
| 524 | −} | |
| 525 | − | |
| 526 | 494 | /** |
| 527 | 495 | * tty_set_ldisc - set line discipline |
| 528 | 496 | * @tty: the terminal to set |
| @@ -536,12 +504,7 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) · 7 unmodified lines | ||
| 536 | 504 | |
| 537 | 505 | int tty_set_ldisc(struct tty_struct *tty, int disc) |
| 538 | 506 | { |
| 539 | − int retval; | |
| 540 | − struct tty_ldisc *old_ldisc, *new_ldisc; | |
| 541 | − | |
| 542 | − new_ldisc = tty_ldisc_get(tty, disc); | |
| 543 | − if (IS_ERR(new_ldisc)) | |
| 544 | − return PTR_ERR(new_ldisc); | |
| 507 | + int retval, old_disc; | |
| 545 | 508 | |
| 546 | 509 | tty_lock(tty); |
| 547 | 510 | retval = tty_ldisc_lock(tty, 5 * HZ); |
| @@ -554,7 +517,8 @@ int tty_set_ldisc(struct tty_struct *tty, int disc) · 6 unmodified lines | ||
| 554 | 517 | } |
| 555 | 518 | |
| 556 | 519 | /* Check the no-op case */ |
| 557 | − if (tty->ldisc->ops->num == disc) | |
| 520 | + old_disc = tty->ldisc->ops->num; | |
| 521 | + if (old_disc == disc) | |
| 558 | 522 | goto out; |
| 559 | 523 | |
| 560 | 524 | if (test_bit(TTY_HUPPED, &tty->flags)) { |
| @@ -563,34 +527,25 @@ int tty_set_ldisc(struct tty_struct *tty, int disc) · 2 unmodified lines | ||
| 563 | 527 | goto out; |
| 564 | 528 | } |
| 565 | 529 | |
| 566 | − old_ldisc = tty->ldisc; | |
| 567 | − | |
| 568 | − /* Shutdown the old discipline. */ | |
| 569 | − tty_ldisc_close(tty, old_ldisc); | |
| 570 | − | |
| 571 | − /* Now set up the new line discipline. */ | |
| 572 | − tty->ldisc = new_ldisc; | |
| 573 | − tty_set_termios_ldisc(tty, disc); | |
| 574 | − | |
| 575 | − retval = tty_ldisc_open(tty, new_ldisc); | |
| 530 | + retval = tty_ldisc_reinit(tty, disc); | |
| 576 | 531 | if (retval < 0) { |
| 577 | 532 | /* Back to the old one or N_TTY if we can't */ |
| 578 | − tty_ldisc_put(new_ldisc); | |
| 579 | − tty_ldisc_restore(tty, old_ldisc); | |
| 533 | + if (tty_ldisc_reinit(tty, old_disc) < 0) { | |
| 534 | + pr_err("tty: TIOCSETD failed, reinitializing N_TTY\n"); | |
| 535 | + if (tty_ldisc_reinit(tty, N_TTY) < 0) { | |
| 536 | + /* At this point we have tty->ldisc == NULL. */ | |
| 537 | + pr_err("tty: reinitializing N_TTY failed\n"); | |
| 538 | + } | |
| 539 | + } | |
| 580 | 540 | } |
| 581 | 541 | |
| 582 | − if (tty->ldisc->ops->num != old_ldisc->ops->num && tty->ops->set_ldisc) { | |
| 542 | + if (tty->ldisc && tty->ldisc->ops->num != old_disc && | |
| 543 | + tty->ops->set_ldisc) { | |
| 583 | 544 | down_read(&tty->termios_rwsem); |
| 584 | 545 | tty->ops->set_ldisc(tty); |
| 585 | 546 | up_read(&tty->termios_rwsem); |
| 586 | 547 | } |
| 587 | 548 | |
| 588 | − /* At this point we hold a reference to the new ldisc and a | |
| 589 | − reference to the old ldisc, or we hold two references to | |
| 590 | − the old ldisc (if it was restored as part of error cleanup | |
| 591 | − above). In either case, releasing a single reference from | |
| 592 | − the old ldisc is correct. */ | |
| 593 | − new_ldisc = old_ldisc; | |
| 594 | 549 | out: |
| 595 | 550 | tty_ldisc_unlock(tty); |
| 596 | 551 | |
| @@ -598,7 +553,6 @@ out: · 1 unmodified line | ||
| 598 | 553 | already running */ |
| 599 | 554 | tty_buffer_restart_work(tty->port); |
| 600 | 555 | err: |
| 601 | − tty_ldisc_put(new_ldisc); /* drop the extra reference */ | |
| 602 | 556 | tty_unlock(tty); |
| 603 | 557 | return retval; |
| 604 | 558 | } |
| @@ -659,10 +613,8 @@ int tty_ldisc_reinit(struct tty_struct *tty, int disc) · 54 unmodified lines | ||
| 659 | 613 | int retval; |
| 660 | 614 | |
| 661 | 615 | ld = tty_ldisc_get(tty, disc); |
| 662 | − if (IS_ERR(ld)) { | |
| 663 | − BUG_ON(disc == N_TTY); | |
| 616 | + if (IS_ERR(ld)) | |
| 664 | 617 | return PTR_ERR(ld); |
| 665 | − } | |
| 666 | 618 | |
| 667 | 619 | if (tty->ldisc) { |
| 668 | 620 | tty_ldisc_close(tty, tty->ldisc); |
| @@ -674,10 +626,8 @@ int tty_ldisc_reinit(struct tty_struct *tty, int disc) · 5 unmodified lines | ||
| 674 | 626 | tty_set_termios_ldisc(tty, disc); |
| 675 | 627 | retval = tty_ldisc_open(tty, tty->ldisc); |
| 676 | 628 | if (retval) { |
| 677 | − if (!WARN_ON(disc == N_TTY)) { | |
| 678 | − tty_ldisc_put(tty->ldisc); | |
| 679 | − tty->ldisc = NULL; | |
| 680 | − } | |
| 629 | + tty_ldisc_put(tty->ldisc); | |
| 630 | + tty->ldisc = NULL; | |
| 681 | 631 | } |
| 682 | 632 | return retval; |
| 683 | 633 | } |
| @@ -1381,7 +1381,7 @@ static int usbtmc_probe(struct usb_interface *intf, · 1380 unmodified lines | ||
| 1381 | 1381 | |
| 1382 | 1382 | dev_dbg(&intf->dev, "%s called\n", __func__); |
| 1383 | 1383 | |
| 1384 | − data = kmalloc(sizeof(*data), GFP_KERNEL); | |
| 1384 | + data = kzalloc(sizeof(*data), GFP_KERNEL); | |
| 1385 | 1385 | if (!data) |
| 1386 | 1386 | return -ENOMEM; |
| 1387 | 1387 | |
| @@ -1444,6 +1444,13 @@ static int usbtmc_probe(struct usb_interface *intf, · 56 unmodified lines | ||
| 1444 | 1444 | break; |
| 1445 | 1445 | } |
| 1446 | 1446 | } |
| 1447 | + | |
| 1448 | + if (!data->bulk_out || !data->bulk_in) { | |
| 1449 | + dev_err(&intf->dev, "bulk endpoints not found\n"); | |
| 1450 | + retcode = -ENODEV; | |
| 1451 | + goto err_put; | |
| 1452 | + } | |
| 1453 | + | |
| 1447 | 1454 | /* Find int endpoint */ |
| 1448 | 1455 | for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) { |
| 1449 | 1456 | endpoint = &iface_desc->endpoint[n].desc; |
| @@ -1469,8 +1476,10 @@ static int usbtmc_probe(struct usb_interface *intf, · 19 unmodified lines | ||
| 1469 | 1476 | if (data->iin_ep_present) { |
| 1470 | 1477 | /* allocate int urb */ |
| 1471 | 1478 | data->iin_urb = usb_alloc_urb(0, GFP_KERNEL); |
| 1472 | − if (!data->iin_urb) | |
| 1479 | + if (!data->iin_urb) { | |
| 1480 | + retcode = -ENOMEM; | |
| 1473 | 1481 | goto error_register; |
| 1482 | + } | |
| 1474 | 1483 | |
| 1475 | 1484 | /* Protect interrupt in endpoint data until iin_urb is freed */ |
| 1476 | 1485 | kref_get(&data->kref); |
| @@ -1478,8 +1487,10 @@ static int usbtmc_probe(struct usb_interface *intf, · 1 unmodified line | ||
| 1478 | 1487 | /* allocate buffer for interrupt in */ |
| 1479 | 1488 | data->iin_buffer = kmalloc(data->iin_wMaxPacketSize, |
| 1480 | 1489 | GFP_KERNEL); |
| 1481 | − if (!data->iin_buffer) | |
| 1490 | + if (!data->iin_buffer) { | |
| 1491 | + retcode = -ENOMEM; | |
| 1482 | 1492 | goto error_register; |
| 1493 | + } | |
| 1483 | 1494 | |
| 1484 | 1495 | /* fill interrupt urb */ |
| 1485 | 1496 | usb_fill_int_urb(data->iin_urb, data->usb_dev, |
| @@ -1512,6 +1523,7 @@ error_register: · 26 unmodified lines | ||
| 1512 | 1523 | sysfs_remove_group(&intf->dev.kobj, &capability_attr_grp); |
| 1513 | 1524 | sysfs_remove_group(&intf->dev.kobj, &data_attr_grp); |
| 1514 | 1525 | usbtmc_free_int(data); |
| 1526 | +err_put: | |
| 1515 | 1527 | kref_put(&data->kref, usbtmc_delete); |
| 1516 | 1528 | return retcode; |
| 1517 | 1529 | } |
| @@ -280,6 +280,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, · 279 unmodified lines | ||
| 280 | 280 | |
| 281 | 281 | /* |
| 282 | 282 | * Adjust bInterval for quirked devices. |
| 283 | + */ | |
| 284 | + /* | |
| 285 | + * This quirk fixes bIntervals reported in ms. | |
| 286 | + */ | |
| 287 | + if (to_usb_device(ddev)->quirks & | |
| 288 | + USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL) { | |
| 289 | + n = clamp(fls(d->bInterval) + 3, i, j); | |
| 290 | + i = j = n; | |
| 291 | + } | |
| 292 | + /* | |
| 283 | 293 | * This quirk fixes bIntervals reported in |
| 284 | 294 | * linear microframes. |
| 285 | 295 | */ |
| @@ -4275,7 +4275,7 @@ static void hub_set_initial_usb2_lpm_policy(struct usb_device *udev) · 4274 unmodified lines | ||
| 4275 | 4275 | struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent); |
| 4276 | 4276 | int connect_type = USB_PORT_CONNECT_TYPE_UNKNOWN; |
| 4277 | 4277 | |
| 4278 | − if (!udev->usb2_hw_lpm_capable) | |
| 4278 | + if (!udev->usb2_hw_lpm_capable || !udev->bos) | |
| 4279 | 4279 | return; |
| 4280 | 4280 | |
| 4281 | 4281 | if (hub) |
| @@ -170,6 +170,14 @@ static const struct usb_device_id usb_quirk_list[] = { · 169 unmodified lines | ||
| 170 | 170 | /* M-Systems Flash Disk Pioneers */ |
| 171 | 171 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, |
| 172 | 172 | |
| 173 | + /* Baum Vario Ultra */ | |
| 174 | + { USB_DEVICE(0x0904, 0x6101), .driver_info = | |
| 175 | + USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL }, | |
| 176 | + { USB_DEVICE(0x0904, 0x6102), .driver_info = | |
| 177 | + USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL }, | |
| 178 | + { USB_DEVICE(0x0904, 0x6103), .driver_info = | |
| 179 | + USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL }, | |
| 180 | + | |
| 173 | 181 | /* Keytouch QWERTY Panel keyboard */ |
| 174 | 182 | { USB_DEVICE(0x0926, 0x3333), .driver_info = |
| 175 | 183 | USB_QUIRK_CONFIG_INTF_STRINGS }, |
| @@ -171,6 +171,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, · 170 unmodified lines | ||
| 171 | 171 | int status) |
| 172 | 172 | { |
| 173 | 173 | struct dwc3 *dwc = dep->dwc; |
| 174 | + unsigned int unmap_after_complete = false; | |
| 174 | 175 | |
| 175 | 176 | req->started = false; |
| 176 | 177 | list_del(&req->list); |
| @@ -180,11 +181,19 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, · 3 unmodified lines | ||
| 180 | 181 | if (req->request.status == -EINPROGRESS) |
| 181 | 182 | req->request.status = status; |
| 182 | 183 | |
| 183 | − if (dwc->ep0_bounced && dep->number <= 1) | |
| 184 | + /* | |
| 185 | + * NOTICE we don't want to unmap before calling ->complete() if we're | |
| 186 | + * dealing with a bounced ep0 request. If we unmap it here, we would end | |
| 187 | + * up overwritting the contents of req->buf and this could confuse the | |
| 188 | + * gadget driver. | |
| 189 | + */ | |
| 190 | + if (dwc->ep0_bounced && dep->number <= 1) { | |
| 184 | 191 | dwc->ep0_bounced = false; |
| 185 | − | |
| 186 | − usb_gadget_unmap_request_by_dev(dwc->sysdev, | |
| 187 | − &req->request, req->direction); | |
| 192 | + unmap_after_complete = true; | |
| 193 | + } else { | |
| 194 | + usb_gadget_unmap_request_by_dev(dwc->sysdev, | |
| 195 | + &req->request, req->direction); | |
| 196 | + } | |
| 188 | 197 | |
| 189 | 198 | trace_dwc3_gadget_giveback(req); |
| 190 | 199 | |
| @@ -192,6 +201,10 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, · 1 unmodified line | ||
| 192 | 201 | usb_gadget_giveback_request(&dep->endpoint, &req->request); |
| 193 | 202 | spin_lock(&dwc->lock); |
| 194 | 203 | |
| 204 | + if (unmap_after_complete) | |
| 205 | + usb_gadget_unmap_request_by_dev(dwc->sysdev, | |
| 206 | + &req->request, req->direction); | |
| 207 | + | |
| 195 | 208 | if (dep->number > 1) |
| 196 | 209 | pm_runtime_put(dwc->dev); |
| 197 | 210 | } |
| @@ -535,13 +535,15 @@ static int acm_notify_serial_state(struct f_acm *acm) · 534 unmodified lines | ||
| 535 | 535 | { |
| 536 | 536 | struct usb_composite_dev *cdev = acm->port.func.config->cdev; |
| 537 | 537 | int status; |
| 538 | + __le16 serial_state; | |
| 538 | 539 | |
| 539 | 540 | spin_lock(&acm->lock); |
| 540 | 541 | if (acm->notify_req) { |
| 541 | 542 | dev_dbg(&cdev->gadget->dev, "acm ttyGS%d serial state %04x\n", |
| 542 | 543 | acm->port_num, acm->serial_state); |
| 544 | + serial_state = cpu_to_le16(acm->serial_state); | |
| 543 | 545 | status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE, |
| 544 | − 0, &acm->serial_state, sizeof(acm->serial_state)); | |
| 546 | + 0, &serial_state, sizeof(acm->serial_state)); | |
| 545 | 547 | } else { |
| 546 | 548 | acm->pending = true; |
| 547 | 549 | status = 0; |
| @@ -367,7 +367,7 @@ try_again: · 366 unmodified lines | ||
| 367 | 367 | count = min_t(unsigned, count, hidg->report_length); |
| 368 | 368 | |
| 369 | 369 | spin_unlock_irqrestore(&hidg->write_spinlock, flags); |
| 370 | − status = copy_from_user(hidg->req->buf, buffer, count); | |
| 370 | + status = copy_from_user(req->buf, buffer, count); | |
| 371 | 371 | |
| 372 | 372 | if (status != 0) { |
| 373 | 373 | ERROR(hidg->func.config->cdev, |
| @@ -378,9 +378,9 @@ try_again: · 4 unmodified lines | ||
| 378 | 378 | |
| 379 | 379 | spin_lock_irqsave(&hidg->write_spinlock, flags); |
| 380 | 380 | |
| 381 | − /* we our function has been disabled by host */ | |
| 381 | + /* when our function has been disabled by host */ | |
| 382 | 382 | if (!hidg->req) { |
| 383 | − free_ep_req(hidg->in_ep, hidg->req); | |
| 383 | + free_ep_req(hidg->in_ep, req); | |
| 384 | 384 | /* |
| 385 | 385 | * TODO |
| 386 | 386 | * Should we fail with error here? |
| @@ -394,7 +394,7 @@ try_again: · 7 unmodified lines | ||
| 394 | 394 | req->complete = f_hidg_req_complete; |
| 395 | 395 | req->context = hidg; |
| 396 | 396 | |
| 397 | − status = usb_ep_queue(hidg->in_ep, hidg->req, GFP_ATOMIC); | |
| 397 | + status = usb_ep_queue(hidg->in_ep, req, GFP_ATOMIC); | |
| 398 | 398 | if (status < 0) { |
| 399 | 399 | ERROR(hidg->func.config->cdev, |
| 400 | 400 | "usb_ep_queue error on int endpoint %zd\n", status); |
| @@ -594,6 +594,14 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) · 593 unmodified lines | ||
| 594 | 594 | opts->streaming_maxpacket = clamp(opts->streaming_maxpacket, 1U, 3072U); |
| 595 | 595 | opts->streaming_maxburst = min(opts->streaming_maxburst, 15U); |
| 596 | 596 | |
| 597 | + /* For SS, wMaxPacketSize has to be 1024 if bMaxBurst is not 0 */ | |
| 598 | + if (opts->streaming_maxburst && | |
| 599 | + (opts->streaming_maxpacket % 1024) != 0) { | |
| 600 | + opts->streaming_maxpacket = roundup(opts->streaming_maxpacket, 1024); | |
| 601 | + INFO(cdev, "overriding streaming_maxpacket to %d\n", | |
| 602 | + opts->streaming_maxpacket); | |
| 603 | + } | |
| 604 | + | |
| 597 | 605 | /* Fill in the FS/HS/SS Video Streaming specific descriptors from the |
| 598 | 606 | * module parameters. |
| 599 | 607 | * |
| @@ -625,7 +633,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) · 25 unmodified lines | ||
| 625 | 633 | uvc_ss_streaming_comp.bMaxBurst = opts->streaming_maxburst; |
| 626 | 634 | uvc_ss_streaming_comp.wBytesPerInterval = |
| 627 | 635 | cpu_to_le16(max_packet_size * max_packet_mult * |
| 628 | − opts->streaming_maxburst); | |
| 636 | + (opts->streaming_maxburst + 1)); | |
| 629 | 637 | |
| 630 | 638 | /* Allocate endpoints. */ |
| 631 | 639 | ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep); |
| @@ -1523,7 +1523,6 @@ static void pch_udc_free_dma_chain(struct pch_udc_dev *dev, · 1522 unmodified lines | ||
| 1523 | 1523 | td = phys_to_virt(addr); |
| 1524 | 1524 | addr2 = (dma_addr_t)td->next; |
| 1525 | 1525 | pci_pool_free(dev->data_requests, td, addr); |
| 1526 | − td->next = 0x00; | |
| 1527 | 1526 | addr = addr2; |
| 1528 | 1527 | } |
| 1529 | 1528 | req->chain_len = 1; |
| @@ -347,6 +347,9 @@ static int idmouse_probe(struct usb_interface *interface, · 346 unmodified lines | ||
| 347 | 347 | if (iface_desc->desc.bInterfaceClass != 0x0A) |
| 348 | 348 | return -ENODEV; |
| 349 | 349 | |
| 350 | + if (iface_desc->desc.bNumEndpoints < 1) | |
| 351 | + return -ENODEV; | |
| 352 | + | |
| 350 | 353 | /* allocate memory for our device state and initialize it */ |
| 351 | 354 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
| 352 | 355 | if (dev == NULL) |
| @@ -366,6 +366,10 @@ static int lvs_rh_probe(struct usb_interface *intf, · 365 unmodified lines | ||
| 366 | 366 | |
| 367 | 367 | hdev = interface_to_usbdev(intf); |
| 368 | 368 | desc = intf->cur_altsetting; |
| 369 | + | |
| 370 | + if (desc->desc.bNumEndpoints < 1) | |
| 371 | + return -ENODEV; | |
| 372 | + | |
| 369 | 373 | endpoint = &desc->endpoint[0].desc; |
| 370 | 374 | |
| 371 | 375 | /* valid only for SS root hub */ |
| @@ -709,6 +709,11 @@ static int uss720_probe(struct usb_interface *intf, · 708 unmodified lines | ||
| 709 | 709 | |
| 710 | 710 | interface = intf->cur_altsetting; |
| 711 | 711 | |
| 712 | + if (interface->desc.bNumEndpoints < 3) { | |
| 713 | + usb_put_dev(usbdev); | |
| 714 | + return -ENODEV; | |
| 715 | + } | |
| 716 | + | |
| 712 | 717 | /* |
| 713 | 718 | * Allocate parport interface |
| 714 | 719 | */ |
| @@ -2490,8 +2490,8 @@ static int musb_remove(struct platform_device *pdev) · 2489 unmodified lines | ||
| 2490 | 2490 | musb_host_cleanup(musb); |
| 2491 | 2491 | musb_gadget_cleanup(musb); |
| 2492 | 2492 | |
| 2493 | − spin_lock_irqsave(&musb->lock, flags); | |
| 2494 | 2493 | musb_platform_disable(musb); |
| 2494 | + spin_lock_irqsave(&musb->lock, flags); | |
| 2495 | 2495 | musb_disable_interrupts(musb); |
| 2496 | 2496 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
| 2497 | 2497 | spin_unlock_irqrestore(&musb->lock, flags); |
| @@ -238,8 +238,27 @@ static void cppi41_dma_callback(void *private_data, · 237 unmodified lines | ||
| 238 | 238 | transferred < cppi41_channel->packet_sz) |
| 239 | 239 | cppi41_channel->prog_len = 0; |
| 240 | 240 | |
| 241 | − if (cppi41_channel->is_tx) | |
| 242 | − empty = musb_is_tx_fifo_empty(hw_ep); | |
| 241 | + if (cppi41_channel->is_tx) { | |
| 242 | + u8 type; | |
| 243 | + | |
| 244 | + if (is_host_active(musb)) | |
| 245 | + type = hw_ep->out_qh->type; | |
| 246 | + else | |
| 247 | + type = hw_ep->ep_in.type; | |
| 248 | + | |
| 249 | + if (type == USB_ENDPOINT_XFER_ISOC) | |
| 250 | + /* | |
| 251 | + * Don't use the early-TX-interrupt workaround below | |
| 252 | + * for Isoch transfter. Since Isoch are periodic | |
| 253 | + * transfer, by the time the next transfer is | |
| 254 | + * scheduled, the current one should be done already. | |
| 255 | + * | |
| 256 | + * This avoids audio playback underrun issue. | |
| 257 | + */ | |
| 258 | + empty = true; | |
| 259 | + else | |
| 260 | + empty = musb_is_tx_fifo_empty(hw_ep); | |
| 261 | + } | |
| 243 | 262 | |
| 244 | 263 | if (!cppi41_channel->is_tx || empty) { |
| 245 | 264 | cppi41_trans_done(cppi41_channel); |
| @@ -933,7 +933,7 @@ static int dsps_probe(struct platform_device *pdev) · 932 unmodified lines | ||
| 933 | 933 | if (usb_get_dr_mode(&pdev->dev) == USB_DR_MODE_PERIPHERAL) { |
| 934 | 934 | ret = dsps_setup_optional_vbus_irq(pdev, glue); |
| 935 | 935 | if (ret) |
| 936 | − return ret; | |
| 936 | + goto err_iounmap; | |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | platform_set_drvdata(pdev, glue); |
| @@ -946,6 +946,8 @@ static int dsps_probe(struct platform_device *pdev) · 6 unmodified lines | ||
| 946 | 946 | |
| 947 | 947 | err: |
| 948 | 948 | pm_runtime_disable(&pdev->dev); |
| 949 | +err_iounmap: | |
| 950 | + iounmap(glue->usbss_base); | |
| 949 | 951 | return ret; |
| 950 | 952 | } |
| 951 | 953 | |
| @@ -956,6 +958,7 @@ static int dsps_remove(struct platform_device *pdev) · 4 unmodified lines | ||
| 956 | 958 | platform_device_unregister(glue->musb); |
| 957 | 959 | |
| 958 | 960 | pm_runtime_disable(&pdev->dev); |
| 961 | + iounmap(glue->usbss_base); | |
| 959 | 962 | |
| 960 | 963 | return 0; |
| 961 | 964 | } |
| @@ -233,6 +233,14 @@ static void option_instat_callback(struct urb *urb); · 232 unmodified lines | ||
| 233 | 233 | #define BANDRICH_PRODUCT_1012 0x1012 |
| 234 | 234 | |
| 235 | 235 | #define QUALCOMM_VENDOR_ID 0x05C6 |
| 236 | +/* These Quectel products use Qualcomm's vendor ID */ | |
| 237 | +#define QUECTEL_PRODUCT_UC20 0x9003 | |
| 238 | +#define QUECTEL_PRODUCT_UC15 0x9090 | |
| 239 | + | |
| 240 | +#define QUECTEL_VENDOR_ID 0x2c7c | |
| 241 | +/* These Quectel products use Quectel's vendor ID */ | |
| 242 | +#define QUECTEL_PRODUCT_EC21 0x0121 | |
| 243 | +#define QUECTEL_PRODUCT_EC25 0x0125 | |
| 236 | 244 | |
| 237 | 245 | #define CMOTECH_VENDOR_ID 0x16d8 |
| 238 | 246 | #define CMOTECH_PRODUCT_6001 0x6001 |
| @@ -1161,7 +1169,14 @@ static const struct usb_device_id option_ids[] = { · 922 unmodified lines | ||
| 1161 | 1169 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
| 1162 | 1170 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ |
| 1163 | 1171 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
| 1164 | − { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003), /* Quectel UC20 */ | |
| 1172 | + /* Quectel products using Qualcomm vendor ID */ | |
| 1173 | + { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, | |
| 1174 | + { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20), | |
| 1175 | + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | |
| 1176 | + /* Quectel products using Quectel vendor ID */ | |
| 1177 | + { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21), | |
| 1178 | + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | |
| 1179 | + { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25), | |
| 1165 | 1180 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
| 1166 | 1181 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, |
| 1167 | 1182 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, |
| @@ -169,6 +169,8 @@ static const struct usb_device_id id_table[] = { · 168 unmodified lines | ||
| 169 | 169 | {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 170 | 170 | {DEVICE_SWI(0x413c, 0x81b1)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 171 | 171 | {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ |
| 172 | + {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */ | |
| 173 | + {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */ | |
| 172 | 174 | |
| 173 | 175 | /* Huawei devices */ |
| 174 | 176 | {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */ |
| @@ -39,6 +39,9 @@ int wa_create(struct wahc *wa, struct usb_interface *iface, · 38 unmodified lines | ||
| 39 | 39 | int result; |
| 40 | 40 | struct device *dev = &iface->dev; |
| 41 | 41 | |
| 42 | + if (iface->cur_altsetting->desc.bNumEndpoints < 3) | |
| 43 | + return -ENODEV; | |
| 44 | + | |
| 42 | 45 | result = wa_rpipes_create(wa); |
| 43 | 46 | if (result < 0) |
| 44 | 47 | goto error_rpipes_create; |
| @@ -823,6 +823,9 @@ static int hwarc_probe(struct usb_interface *iface, · 822 unmodified lines | ||
| 823 | 823 | struct hwarc *hwarc; |
| 824 | 824 | struct device *dev = &iface->dev; |
| 825 | 825 | |
| 826 | + if (iface->cur_altsetting->desc.bNumEndpoints < 1) | |
| 827 | + return -ENODEV; | |
| 828 | + | |
| 826 | 829 | result = -ENOMEM; |
| 827 | 830 | uwb_rc = uwb_rc_alloc(); |
| 828 | 831 | if (uwb_rc == NULL) { |
| @@ -362,6 +362,9 @@ int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id) · 361 unmodified lines | ||
| 362 | 362 | result); |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | + if (iface->cur_altsetting->desc.bNumEndpoints < 1) | |
| 366 | + return -ENODEV; | |
| 367 | + | |
| 365 | 368 | result = -ENOMEM; |
| 366 | 369 | i1480_usb = kzalloc(sizeof(*i1480_usb), GFP_KERNEL); |
| 367 | 370 | if (i1480_usb == NULL) { |
| @@ -403,6 +403,7 @@ static void vfio_group_release(struct kref *kref) · 402 unmodified lines | ||
| 403 | 403 | struct iommu_group *iommu_group = group->iommu_group; |
| 404 | 404 | |
| 405 | 405 | WARN_ON(!list_empty(&group->device_list)); |
| 406 | + WARN_ON(group->notifier.head); | |
| 406 | 407 | |
| 407 | 408 | list_for_each_entry_safe(unbound, tmp, |
| 408 | 409 | &group->unbound_list, unbound_next) { |
| @@ -1573,6 +1574,10 @@ static int vfio_group_fops_open(struct inode *inode, struct file *filep) · 1164 unmodified lines | ||
| 1573 | 1574 | return -EBUSY; |
| 1574 | 1575 | } |
| 1575 | 1576 | |
| 1577 | + /* Warn if previous user didn't cleanup and re-init to drop them */ | |
| 1578 | + if (WARN_ON(group->notifier.head)) | |
| 1579 | + BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier); | |
| 1580 | + | |
| 1576 | 1581 | filep->private_data = group; |
| 1577 | 1582 | |
| 1578 | 1583 | return 0; |
| @@ -1584,9 +1589,6 @@ static int vfio_group_fops_release(struct inode *inode, struct file *filep) · 5 unmodified lines | ||
| 1584 | 1589 | |
| 1585 | 1590 | filep->private_data = NULL; |
| 1586 | 1591 | |
| 1587 | − /* Any user didn't unregister? */ | |
| 1588 | − WARN_ON(group->notifier.head); | |
| 1589 | − | |
| 1590 | 1592 | vfio_group_try_dissolve_container(group); |
| 1591 | 1593 | |
| 1592 | 1594 | atomic_dec(&group->opened); |
| @@ -1182,8 +1182,7 @@ static struct vfio_group *find_iommu_group(struct vfio_domain *domain, · 1181 unmodified lines | ||
| 1182 | 1182 | return NULL; |
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | −static bool vfio_iommu_has_resv_msi(struct iommu_group *group, | |
| 1186 | − phys_addr_t *base) | |
| 1185 | +static bool vfio_iommu_has_sw_msi(struct iommu_group *group, phys_addr_t *base) | |
| 1187 | 1186 | { |
| 1188 | 1187 | struct list_head group_resv_regions; |
| 1189 | 1188 | struct iommu_resv_region *region, *next; |
| @@ -1192,7 +1191,7 @@ static bool vfio_iommu_has_resv_msi(struct iommu_group *group, · 2 unmodified lines | ||
| 1192 | 1191 | INIT_LIST_HEAD(&group_resv_regions); |
| 1193 | 1192 | iommu_get_group_resv_regions(group, &group_resv_regions); |
| 1194 | 1193 | list_for_each_entry(region, &group_resv_regions, list) { |
| 1195 | − if (region->type & IOMMU_RESV_MSI) { | |
| 1194 | + if (region->type == IOMMU_RESV_SW_MSI) { | |
| 1196 | 1195 | *base = region->start; |
| 1197 | 1196 | ret = true; |
| 1198 | 1197 | goto out; |
| @@ -1283,7 +1282,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, · 84 unmodified lines | ||
| 1283 | 1282 | if (ret) |
| 1284 | 1283 | goto out_domain; |
| 1285 | 1284 | |
| 1286 | − resv_msi = vfio_iommu_has_resv_msi(iommu_group, &resv_msi_base); | |
| 1285 | + resv_msi = vfio_iommu_has_sw_msi(iommu_group, &resv_msi_base); | |
| 1287 | 1286 | |
| 1288 | 1287 | INIT_LIST_HEAD(&domain->group_list); |
| 1289 | 1288 | list_add(&group->next, &domain->group_list); |
| @@ -223,6 +223,46 @@ vhost_transport_send_pkt(struct virtio_vsock_pkt *pkt) · 222 unmodified lines | ||
| 223 | 223 | return len; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | +static int | |
| 227 | +vhost_transport_cancel_pkt(struct vsock_sock *vsk) | |
| 228 | +{ | |
| 229 | + struct vhost_vsock *vsock; | |
| 230 | + struct virtio_vsock_pkt *pkt, *n; | |
| 231 | + int cnt = 0; | |
| 232 | + LIST_HEAD(freeme); | |
| 233 | + | |
| 234 | + /* Find the vhost_vsock according to guest context id */ | |
| 235 | + vsock = vhost_vsock_get(vsk->remote_addr.svm_cid); | |
| 236 | + if (!vsock) | |
| 237 | + return -ENODEV; | |
| 238 | + | |
| 239 | + spin_lock_bh(&vsock->send_pkt_list_lock); | |
| 240 | + list_for_each_entry_safe(pkt, n, &vsock->send_pkt_list, list) { | |
| 241 | + if (pkt->vsk != vsk) | |
| 242 | + continue; | |
| 243 | + list_move(&pkt->list, &freeme); | |
| 244 | + } | |
| 245 | + spin_unlock_bh(&vsock->send_pkt_list_lock); | |
| 246 | + | |
| 247 | + list_for_each_entry_safe(pkt, n, &freeme, list) { | |
| 248 | + if (pkt->reply) | |
| 249 | + cnt++; | |
| 250 | + list_del(&pkt->list); | |
| 251 | + virtio_transport_free_pkt(pkt); | |
| 252 | + } | |
| 253 | + | |
| 254 | + if (cnt) { | |
| 255 | + struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX]; | |
| 256 | + int new_cnt; | |
| 257 | + | |
| 258 | + new_cnt = atomic_sub_return(cnt, &vsock->queued_replies); | |
| 259 | + if (new_cnt + cnt >= tx_vq->num && new_cnt < tx_vq->num) | |
| 260 | + vhost_poll_queue(&tx_vq->poll); | |
| 261 | + } | |
| 262 | + | |
| 263 | + return 0; | |
| 264 | +} | |
| 265 | + | |
| 226 | 266 | static struct virtio_vsock_pkt * |
| 227 | 267 | vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq, |
| 228 | 268 | unsigned int out, unsigned int in) |
| @@ -675,6 +715,7 @@ static struct virtio_transport vhost_transport = { · 446 unmodified lines | ||
| 675 | 715 | .release = virtio_transport_release, |
| 676 | 716 | .connect = virtio_transport_connect, |
| 677 | 717 | .shutdown = virtio_transport_shutdown, |
| 718 | + .cancel_pkt = vhost_transport_cancel_pkt, | |
| 678 | 719 | |
| 679 | 720 | .dgram_enqueue = virtio_transport_dgram_enqueue, |
| 680 | 721 | .dgram_dequeue = virtio_transport_dgram_dequeue, |
| @@ -27,10 +27,10 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <linux/init.h> |
| 28 | 28 | #include <linux/module.h> |
| 29 | 29 | #include <linux/types.h> |
| 30 | +#include <linux/syscore_ops.h> | |
| 30 | 31 | #include <linux/acpi.h> |
| 31 | 32 | #include <acpi/processor.h> |
| 32 | 33 | #include <xen/xen.h> |
| 33 | −#include <xen/xen-ops.h> | |
| 34 | 34 | #include <xen/interface/platform.h> |
| 35 | 35 | #include <asm/xen/hypercall.h> |
| 36 | 36 | |
| @@ -408,7 +408,7 @@ static int check_acpi_ids(struct acpi_processor *pr_backup) · 371 unmodified lines | ||
| 408 | 408 | acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
| 409 | 409 | ACPI_UINT32_MAX, |
| 410 | 410 | read_acpi_id, NULL, NULL, NULL); |
| 411 | − acpi_get_devices("ACPI0007", read_acpi_id, NULL, NULL); | |
| 411 | + acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, read_acpi_id, NULL, NULL); | |
| 412 | 412 | |
| 413 | 413 | upload: |
| 414 | 414 | if (!bitmap_equal(acpi_id_present, acpi_ids_done, nr_acpi_bits)) { |
| @@ -466,15 +466,33 @@ static int xen_upload_processor_pm_data(void) · 51 unmodified lines | ||
| 466 | 466 | return rc; |
| 467 | 467 | } |
| 468 | 468 | |
| 469 | −static int xen_acpi_processor_resume(struct notifier_block *nb, | |
| 470 | − unsigned long action, void *data) | |
| 469 | +static void xen_acpi_processor_resume_worker(struct work_struct *dummy) | |
| 471 | 470 | { |
| 471 | + int rc; | |
| 472 | + | |
| 472 | 473 | bitmap_zero(acpi_ids_done, nr_acpi_bits); |
| 473 | − return xen_upload_processor_pm_data(); | |
| 474 | + | |
| 475 | + rc = xen_upload_processor_pm_data(); | |
| 476 | + if (rc != 0) | |
| 477 | + pr_info("ACPI data upload failed, error = %d\n", rc); | |
| 478 | +} | |
| 479 | + | |
| 480 | +static void xen_acpi_processor_resume(void) | |
| 481 | +{ | |
| 482 | + static DECLARE_WORK(wq, xen_acpi_processor_resume_worker); | |
| 483 | + | |
| 484 | + /* | |
| 485 | + * xen_upload_processor_pm_data() calls non-atomic code. | |
| 486 | + * However, the context for xen_acpi_processor_resume is syscore | |
| 487 | + * with only the boot CPU online and in an atomic context. | |
| 488 | + * | |
| 489 | + * So defer the upload for some point safer. | |
| 490 | + */ | |
| 491 | + schedule_work(&wq); | |
| 474 | 492 | } |
| 475 | 493 | |
| 476 | −struct notifier_block xen_acpi_processor_resume_nb = { | |
| 477 | − .notifier_call = xen_acpi_processor_resume, | |
| 494 | +static struct syscore_ops xap_syscore_ops = { | |
| 495 | + .resume = xen_acpi_processor_resume, | |
| 478 | 496 | }; |
| 479 | 497 | |
| 480 | 498 | static int __init xen_acpi_processor_init(void) |
| @@ -527,7 +545,7 @@ static int __init xen_acpi_processor_init(void) · 46 unmodified lines | ||
| 527 | 545 | if (rc) |
| 528 | 546 | goto err_unregister; |
| 529 | 547 | |
| 530 | − xen_resume_notifier_register(&xen_acpi_processor_resume_nb); | |
| 548 | + register_syscore_ops(&xap_syscore_ops); | |
| 531 | 549 | |
| 532 | 550 | return 0; |
| 533 | 551 | err_unregister: |
| @@ -544,7 +562,7 @@ static void __exit xen_acpi_processor_exit(void) · 10 unmodified lines | ||
| 544 | 562 | { |
| 545 | 563 | int i; |
| 546 | 564 | |
| 547 | − xen_resume_notifier_unregister(&xen_acpi_processor_resume_nb); | |
| 565 | + unregister_syscore_ops(&xap_syscore_ops); | |
| 548 | 566 | kfree(acpi_ids_done); |
| 549 | 567 | kfree(acpi_id_present); |
| 550 | 568 | kfree(acpi_id_cst_present); |
| @@ -1714,7 +1714,8 @@ static int __process_pages_contig(struct address_space *mapping, · 1713 unmodified lines | ||
| 1714 | 1714 | * can we find nothing at @index. |
| 1715 | 1715 | */ |
| 1716 | 1716 | ASSERT(page_ops & PAGE_LOCK); |
| 1717 | − return ret; | |
| 1717 | + err = -EAGAIN; | |
| 1718 | + goto out; | |
| 1718 | 1719 | } |
| 1719 | 1720 | |
| 1720 | 1721 | for (i = 0; i < ret; i++) { |
| @@ -6709,6 +6709,20 @@ static noinline int uncompress_inline(struct btrfs_path *path, · 6708 unmodified lines | ||
| 6709 | 6709 | max_size = min_t(unsigned long, PAGE_SIZE, max_size); |
| 6710 | 6710 | ret = btrfs_decompress(compress_type, tmp, page, |
| 6711 | 6711 | extent_offset, inline_size, max_size); |
| 6712 | + | |
| 6713 | + /* | |
| 6714 | + * decompression code contains a memset to fill in any space between the end | |
| 6715 | + * of the uncompressed data and the end of max_size in case the decompressed | |
| 6716 | + * data ends up shorter than ram_bytes. That doesn't cover the hole between | |
| 6717 | + * the end of an inline extent and the beginning of the next block, so we | |
| 6718 | + * cover that region here. | |
| 6719 | + */ | |
| 6720 | + | |
| 6721 | + if (max_size + pg_offset < PAGE_SIZE) { | |
| 6722 | + char *map = kmap(page); | |
| 6723 | + memset(map + pg_offset + max_size, 0, PAGE_SIZE - max_size - pg_offset); | |
| 6724 | + kunmap(page); | |
| 6725 | + } | |
| 6712 | 6726 | kfree(tmp); |
| 6713 | 6727 | return ret; |
| 6714 | 6728 | } |
| @@ -327,7 +327,6 @@ EXPORT_SYMBOL(fscrypt_decrypt_page); · 326 unmodified lines | ||
| 327 | 327 | static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags) |
| 328 | 328 | { |
| 329 | 329 | struct dentry *dir; |
| 330 | − struct fscrypt_info *ci; | |
| 331 | 330 | int dir_has_key, cached_with_key; |
| 332 | 331 | |
| 333 | 332 | if (flags & LOOKUP_RCU) |
| @@ -339,18 +338,11 @@ static int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags) · 5 unmodified lines | ||
| 339 | 338 | return 0; |
| 340 | 339 | } |
| 341 | 340 | |
| 342 | − ci = d_inode(dir)->i_crypt_info; | |
| 343 | − if (ci && ci->ci_keyring_key && | |
| 344 | − (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) | | |
| 345 | − (1 << KEY_FLAG_REVOKED) | | |
| 346 | − (1 << KEY_FLAG_DEAD)))) | |
| 347 | − ci = NULL; | |
| 348 | − | |
| 349 | 341 | /* this should eventually be an flag in d_flags */ |
| 350 | 342 | spin_lock(&dentry->d_lock); |
| 351 | 343 | cached_with_key = dentry->d_flags & DCACHE_ENCRYPTED_WITH_KEY; |
| 352 | 344 | spin_unlock(&dentry->d_lock); |
| 353 | − dir_has_key = (ci != NULL); | |
| 345 | + dir_has_key = (d_inode(dir)->i_crypt_info != NULL); | |
| 354 | 346 | dput(dir); |
| 355 | 347 | |
| 356 | 348 | /* |
| @@ -350,7 +350,7 @@ int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname, · 349 unmodified lines | ||
| 350 | 350 | fname->disk_name.len = iname->len; |
| 351 | 351 | return 0; |
| 352 | 352 | } |
| 353 | − ret = fscrypt_get_crypt_info(dir); | |
| 353 | + ret = fscrypt_get_encryption_info(dir); | |
| 354 | 354 | if (ret && ret != -EOPNOTSUPP) |
| 355 | 355 | return ret; |
| 356 | 356 | |
| @@ -67,7 +67,6 @@ struct fscrypt_info { · 66 unmodified lines | ||
| 67 | 67 | u8 ci_filename_mode; |
| 68 | 68 | u8 ci_flags; |
| 69 | 69 | struct crypto_skcipher *ci_ctfm; |
| 70 | − struct key *ci_keyring_key; | |
| 71 | 70 | u8 ci_master_key[FS_KEY_DESCRIPTOR_SIZE]; |
| 72 | 71 | }; |
| 73 | 72 | |
| @@ -101,7 +100,4 @@ extern int fscrypt_do_page_crypto(const struct inode *inode, · 27 unmodified lines | ||
| 101 | 100 | extern struct page *fscrypt_alloc_bounce_page(struct fscrypt_ctx *ctx, |
| 102 | 101 | gfp_t gfp_flags); |
| 103 | 102 | |
| 104 | −/* keyinfo.c */ | |
| 105 | −extern int fscrypt_get_crypt_info(struct inode *); | |
| 106 | − | |
| 107 | 103 | #endif /* _FSCRYPT_PRIVATE_H */ |
| @@ -95,6 +95,7 @@ static int validate_user_key(struct fscrypt_info *crypt_info, · 94 unmodified lines | ||
| 95 | 95 | kfree(description); |
| 96 | 96 | if (IS_ERR(keyring_key)) |
| 97 | 97 | return PTR_ERR(keyring_key); |
| 98 | + down_read(&keyring_key->sem); | |
| 98 | 99 | |
| 99 | 100 | if (keyring_key->type != &key_type_logon) { |
| 100 | 101 | printk_once(KERN_WARNING |
| @@ -102,11 +103,9 @@ static int validate_user_key(struct fscrypt_info *crypt_info, · 1 unmodified line | ||
| 102 | 103 | res = -ENOKEY; |
| 103 | 104 | goto out; |
| 104 | 105 | } |
| 105 | − down_read(&keyring_key->sem); | |
| 106 | 106 | ukp = user_key_payload_locked(keyring_key); |
| 107 | 107 | if (ukp->datalen != sizeof(struct fscrypt_key)) { |
| 108 | 108 | res = -EINVAL; |
| 109 | − up_read(&keyring_key->sem); | |
| 110 | 109 | goto out; |
| 111 | 110 | } |
| 112 | 111 | master_key = (struct fscrypt_key *)ukp->data; |
| @@ -117,17 +116,11 @@ static int validate_user_key(struct fscrypt_info *crypt_info, · 4 unmodified lines | ||
| 117 | 116 | "%s: key size incorrect: %d\n", |
| 118 | 117 | __func__, master_key->size); |
| 119 | 118 | res = -ENOKEY; |
| 120 | − up_read(&keyring_key->sem); | |
| 121 | 119 | goto out; |
| 122 | 120 | } |
| 123 | 121 | res = derive_key_aes(ctx->nonce, master_key->raw, raw_key); |
| 124 | − up_read(&keyring_key->sem); | |
| 125 | − if (res) | |
| 126 | − goto out; | |
| 127 | − | |
| 128 | − crypt_info->ci_keyring_key = keyring_key; | |
| 129 | − return 0; | |
| 130 | 122 | out: |
| 123 | + up_read(&keyring_key->sem); | |
| 131 | 124 | key_put(keyring_key); |
| 132 | 125 | return res; |
| 133 | 126 | } |
| @@ -169,12 +162,11 @@ static void put_crypt_info(struct fscrypt_info *ci) · 35 unmodified lines | ||
| 169 | 162 | if (!ci) |
| 170 | 163 | return; |
| 171 | 164 | |
| 172 | − key_put(ci->ci_keyring_key); | |
| 173 | 165 | crypto_free_skcipher(ci->ci_ctfm); |
| 174 | 166 | kmem_cache_free(fscrypt_info_cachep, ci); |
| 175 | 167 | } |
| 176 | 168 | |
| 177 | −int fscrypt_get_crypt_info(struct inode *inode) | |
| 169 | +int fscrypt_get_encryption_info(struct inode *inode) | |
| 178 | 170 | { |
| 179 | 171 | struct fscrypt_info *crypt_info; |
| 180 | 172 | struct fscrypt_context ctx; |
| @@ -184,21 +176,15 @@ int fscrypt_get_crypt_info(struct inode *inode) · 3 unmodified lines | ||
| 184 | 176 | u8 *raw_key = NULL; |
| 185 | 177 | int res; |
| 186 | 178 | |
| 179 | + if (inode->i_crypt_info) | |
| 180 | + return 0; | |
| 181 | + | |
| 187 | 182 | res = fscrypt_initialize(inode->i_sb->s_cop->flags); |
| 188 | 183 | if (res) |
| 189 | 184 | return res; |
| 190 | 185 | |
| 191 | 186 | if (!inode->i_sb->s_cop->get_context) |
| 192 | 187 | return -EOPNOTSUPP; |
| 193 | −retry: | |
| 194 | − crypt_info = ACCESS_ONCE(inode->i_crypt_info); | |
| 195 | − if (crypt_info) { | |
| 196 | − if (!crypt_info->ci_keyring_key || | |
| 197 | − key_validate(crypt_info->ci_keyring_key) == 0) | |
| 198 | − return 0; | |
| 199 | − fscrypt_put_encryption_info(inode, crypt_info); | |
| 200 | − goto retry; | |
| 201 | − } | |
| 202 | 188 | |
| 203 | 189 | res = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx)); |
| 204 | 190 | if (res < 0) { |
| @@ -229,7 +215,6 @@ retry: · 24 unmodified lines | ||
| 229 | 215 | crypt_info->ci_data_mode = ctx.contents_encryption_mode; |
| 230 | 216 | crypt_info->ci_filename_mode = ctx.filenames_encryption_mode; |
| 231 | 217 | crypt_info->ci_ctfm = NULL; |
| 232 | − crypt_info->ci_keyring_key = NULL; | |
| 233 | 218 | memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor, |
| 234 | 219 | sizeof(crypt_info->ci_master_key)); |
| 235 | 220 | |
| @@ -273,14 +258,8 @@ retry: · 37 unmodified lines | ||
| 273 | 258 | if (res) |
| 274 | 259 | goto out; |
| 275 | 260 | |
| 276 | − kzfree(raw_key); | |
| 277 | − raw_key = NULL; | |
| 278 | − if (cmpxchg(&inode->i_crypt_info, NULL, crypt_info) != NULL) { | |
| 279 | − put_crypt_info(crypt_info); | |
| 280 | − goto retry; | |
| 281 | − } | |
| 282 | − return 0; | |
| 283 | − | |
| 261 | + if (cmpxchg(&inode->i_crypt_info, NULL, crypt_info) == NULL) | |
| 262 | + crypt_info = NULL; | |
| 284 | 263 | out: |
| 285 | 264 | if (res == -ENOKEY) |
| 286 | 265 | res = 0; |
| @@ -288,6 +267,7 @@ out: · 1 unmodified line | ||
| 288 | 267 | kzfree(raw_key); |
| 289 | 268 | return res; |
| 290 | 269 | } |
| 270 | +EXPORT_SYMBOL(fscrypt_get_encryption_info); | |
| 291 | 271 | |
| 292 | 272 | void fscrypt_put_encryption_info(struct inode *inode, struct fscrypt_info *ci) |
| 293 | 273 | { |
| @@ -305,17 +285,3 @@ void fscrypt_put_encryption_info(struct inode *inode, struct fscrypt_info *ci) · 11 unmodified lines | ||
| 305 | 285 | put_crypt_info(ci); |
| 306 | 286 | } |
| 307 | 287 | EXPORT_SYMBOL(fscrypt_put_encryption_info); |
| 308 | − | |
| 309 | −int fscrypt_get_encryption_info(struct inode *inode) | |
| 310 | −{ | |
| 311 | − struct fscrypt_info *ci = inode->i_crypt_info; | |
| 312 | − | |
| 313 | − if (!ci || | |
| 314 | − (ci->ci_keyring_key && | |
| 315 | − (ci->ci_keyring_key->flags & ((1 << KEY_FLAG_INVALIDATED) | | |
| 316 | − (1 << KEY_FLAG_REVOKED) | | |
| 317 | − (1 << KEY_FLAG_DEAD))))) | |
| 318 | − return fscrypt_get_crypt_info(inode); | |
| 319 | − return 0; | |
| 320 | −} | |
| 321 | −EXPORT_SYMBOL(fscrypt_get_encryption_info); | |
| @@ -33,17 +33,10 @@ static int create_encryption_context_from_policy(struct inode *inode, · 32 unmodified lines | ||
| 33 | 33 | const struct fscrypt_policy *policy) |
| 34 | 34 | { |
| 35 | 35 | struct fscrypt_context ctx; |
| 36 | − int res; | |
| 37 | 36 | |
| 38 | 37 | if (!inode->i_sb->s_cop->set_context) |
| 39 | 38 | return -EOPNOTSUPP; |
| 40 | 39 | |
| 41 | − if (inode->i_sb->s_cop->prepare_context) { | |
| 42 | − res = inode->i_sb->s_cop->prepare_context(inode); | |
| 43 | − if (res) | |
| 44 | − return res; | |
| 45 | − } | |
| 46 | − | |
| 47 | 40 | ctx.format = FS_ENCRYPTION_CONTEXT_FORMAT_V1; |
| 48 | 41 | memcpy(ctx.master_key_descriptor, policy->master_key_descriptor, |
| 49 | 42 | FS_KEY_DESCRIPTOR_SIZE); |
| @@ -1169,10 +1169,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle, · 1168 unmodified lines | ||
| 1169 | 1169 | set_buffer_uptodate(dir_block); |
| 1170 | 1170 | err = ext4_handle_dirty_dirent_node(handle, inode, dir_block); |
| 1171 | 1171 | if (err) |
| 1172 | − goto out; | |
| 1172 | + return err; | |
| 1173 | 1173 | set_buffer_verified(dir_block); |
| 1174 | −out: | |
| 1175 | − return err; | |
| 1174 | + return ext4_mark_inode_dirty(handle, inode); | |
| 1176 | 1175 | } |
| 1177 | 1176 | |
| 1178 | 1177 | static int ext4_convert_inline_data_nolock(handle_t *handle, |
| @@ -5400,7 +5400,7 @@ int ext4_getattr(const struct path *path, struct kstat *stat, · 5399 unmodified lines | ||
| 5400 | 5400 | * If there is inline data in the inode, the inode will normally not |
| 5401 | 5401 | * have data blocks allocated (it may have an external xattr block). |
| 5402 | 5402 | * Report at least one sector for such files, so tools like tar, rsync, |
| 5403 | − * others doen't incorrectly think the file is completely sparse. | |
| 5403 | + * others don't incorrectly think the file is completely sparse. | |
| 5404 | 5404 | */ |
| 5405 | 5405 | if (unlikely(ext4_has_inline_data(inode))) |
| 5406 | 5406 | stat->blocks += (stat->size + 511) >> 9; |
| @@ -511,7 +511,7 @@ mext_check_arguments(struct inode *orig_inode, · 510 unmodified lines | ||
| 511 | 511 | if ((orig_start & ~(PAGE_MASK >> orig_inode->i_blkbits)) != |
| 512 | 512 | (donor_start & ~(PAGE_MASK >> orig_inode->i_blkbits))) { |
| 513 | 513 | ext4_debug("ext4 move extent: orig and donor's start " |
| 514 | − "offset are not alligned [ino:orig %lu, donor %lu]\n", | |
| 514 | + "offsets are not aligned [ino:orig %lu, donor %lu]\n", | |
| 515 | 515 | orig_inode->i_ino, donor_inode->i_ino); |
| 516 | 516 | return -EINVAL; |
| 517 | 517 | } |
| @@ -1120,17 +1120,16 @@ static int ext4_get_context(struct inode *inode, void *ctx, size_t len) · 1119 unmodified lines | ||
| 1120 | 1120 | EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, ctx, len); |
| 1121 | 1121 | } |
| 1122 | 1122 | |
| 1123 | −static int ext4_prepare_context(struct inode *inode) | |
| 1124 | −{ | |
| 1125 | − return ext4_convert_inline_data(inode); | |
| 1126 | −} | |
| 1127 | − | |
| 1128 | 1123 | static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, |
| 1129 | 1124 | void *fs_data) |
| 1130 | 1125 | { |
| 1131 | 1126 | handle_t *handle = fs_data; |
| 1132 | 1127 | int res, res2, retries = 0; |
| 1133 | 1128 | |
| 1129 | + res = ext4_convert_inline_data(inode); | |
| 1130 | + if (res) | |
| 1131 | + return res; | |
| 1132 | + | |
| 1134 | 1133 | /* |
| 1135 | 1134 | * If a journal handle was specified, then the encryption context is |
| 1136 | 1135 | * being set on a new inode via inheritance and is part of a larger |
| @@ -1196,7 +1195,6 @@ static unsigned ext4_max_namelen(struct inode *inode) · 59 unmodified lines | ||
| 1196 | 1195 | static const struct fscrypt_operations ext4_cryptops = { |
| 1197 | 1196 | .key_prefix = "ext4:", |
| 1198 | 1197 | .get_context = ext4_get_context, |
| 1199 | − .prepare_context = ext4_prepare_context, | |
| 1200 | 1198 | .set_context = ext4_set_context, |
| 1201 | 1199 | .dummy_context = ext4_dummy_context, |
| 1202 | 1200 | .is_encrypted = ext4_encrypted_inode, |
| @@ -131,31 +131,26 @@ static __le32 ext4_xattr_block_csum(struct inode *inode, · 130 unmodified lines | ||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | static int ext4_xattr_block_csum_verify(struct inode *inode, |
| 134 | − sector_t block_nr, | |
| 135 | − struct ext4_xattr_header *hdr) | |
| 134 | + struct buffer_head *bh) | |
| 136 | 135 | { |
| 137 | − if (ext4_has_metadata_csum(inode->i_sb) && | |
| 138 | − (hdr->h_checksum != ext4_xattr_block_csum(inode, block_nr, hdr))) | |
| 139 | − return 0; | |
| 140 | − return 1; | |
| 141 | −} | |
| 142 | − | |
| 143 | −static void ext4_xattr_block_csum_set(struct inode *inode, | |
| 144 | − sector_t block_nr, | |
| 145 | − struct ext4_xattr_header *hdr) | |
| 146 | −{ | |
| 147 | − if (!ext4_has_metadata_csum(inode->i_sb)) | |
| 148 | − return; | |
| 136 | + struct ext4_xattr_header *hdr = BHDR(bh); | |
| 137 | + int ret = 1; | |
| 149 | 138 | |
| 150 | − hdr->h_checksum = ext4_xattr_block_csum(inode, block_nr, hdr); | |
| 139 | + if (ext4_has_metadata_csum(inode->i_sb)) { | |
| 140 | + lock_buffer(bh); | |
| 141 | + ret = (hdr->h_checksum == ext4_xattr_block_csum(inode, | |
| 142 | + bh->b_blocknr, hdr)); | |
| 143 | + unlock_buffer(bh); | |
| 144 | + } | |
| 145 | + return ret; | |
| 151 | 146 | } |
| 152 | 147 | |
| 153 | −static inline int ext4_handle_dirty_xattr_block(handle_t *handle, | |
| 154 | − struct inode *inode, | |
| 155 | − struct buffer_head *bh) | |
| 148 | +static void ext4_xattr_block_csum_set(struct inode *inode, | |
| 149 | + struct buffer_head *bh) | |
| 156 | 150 | { |
| 157 | − ext4_xattr_block_csum_set(inode, bh->b_blocknr, BHDR(bh)); | |
| 158 | − return ext4_handle_dirty_metadata(handle, inode, bh); | |
| 151 | + if (ext4_has_metadata_csum(inode->i_sb)) | |
| 152 | + BHDR(bh)->h_checksum = ext4_xattr_block_csum(inode, | |
| 153 | + bh->b_blocknr, BHDR(bh)); | |
| 159 | 154 | } |
| 160 | 155 | |
| 161 | 156 | static inline const struct xattr_handler * |
| @@ -233,7 +228,7 @@ ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh) · 71 unmodified lines | ||
| 233 | 228 | if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || |
| 234 | 229 | BHDR(bh)->h_blocks != cpu_to_le32(1)) |
| 235 | 230 | return -EFSCORRUPTED; |
| 236 | − if (!ext4_xattr_block_csum_verify(inode, bh->b_blocknr, BHDR(bh))) | |
| 231 | + if (!ext4_xattr_block_csum_verify(inode, bh)) | |
| 237 | 232 | return -EFSBADCRC; |
| 238 | 233 | error = ext4_xattr_check_names(BFIRST(bh), bh->b_data + bh->b_size, |
| 239 | 234 | bh->b_data); |
| @@ -618,23 +613,22 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode, · 378 unmodified lines | ||
| 618 | 613 | } |
| 619 | 614 | } |
| 620 | 615 | |
| 616 | + ext4_xattr_block_csum_set(inode, bh); | |
| 621 | 617 | /* |
| 622 | 618 | * Beware of this ugliness: Releasing of xattr block references |
| 623 | 619 | * from different inodes can race and so we have to protect |
| 624 | 620 | * from a race where someone else frees the block (and releases |
| 625 | 621 | * its journal_head) before we are done dirtying the buffer. In |
| 626 | 622 | * nojournal mode this race is harmless and we actually cannot |
| 627 | − * call ext4_handle_dirty_xattr_block() with locked buffer as | |
| 623 | + * call ext4_handle_dirty_metadata() with locked buffer as | |
| 628 | 624 | * that function can call sync_dirty_buffer() so for that case |
| 629 | 625 | * we handle the dirtying after unlocking the buffer. |
| 630 | 626 | */ |
| 631 | 627 | if (ext4_handle_valid(handle)) |
| 632 | − error = ext4_handle_dirty_xattr_block(handle, inode, | |
| 633 | − bh); | |
| 628 | + error = ext4_handle_dirty_metadata(handle, inode, bh); | |
| 634 | 629 | unlock_buffer(bh); |
| 635 | 630 | if (!ext4_handle_valid(handle)) |
| 636 | − error = ext4_handle_dirty_xattr_block(handle, inode, | |
| 637 | − bh); | |
| 631 | + error = ext4_handle_dirty_metadata(handle, inode, bh); | |
| 638 | 632 | if (IS_SYNC(inode)) |
| 639 | 633 | ext4_handle_sync(handle); |
| 640 | 634 | dquot_free_block(inode, EXT4_C2B(EXT4_SB(inode->i_sb), 1)); |
| @@ -863,13 +857,14 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, · 222 unmodified lines | ||
| 863 | 857 | ext4_xattr_cache_insert(ext4_mb_cache, |
| 864 | 858 | bs->bh); |
| 865 | 859 | } |
| 860 | + ext4_xattr_block_csum_set(inode, bs->bh); | |
| 866 | 861 | unlock_buffer(bs->bh); |
| 867 | 862 | if (error == -EFSCORRUPTED) |
| 868 | 863 | goto bad_block; |
| 869 | 864 | if (!error) |
| 870 | − error = ext4_handle_dirty_xattr_block(handle, | |
| 871 | − inode, | |
| 872 | − bs->bh); | |
| 865 | + error = ext4_handle_dirty_metadata(handle, | |
| 866 | + inode, | |
| 867 | + bs->bh); | |
| 873 | 868 | if (error) |
| 874 | 869 | goto cleanup; |
| 875 | 870 | goto inserted; |
| @@ -967,10 +962,11 @@ inserted: · 91 unmodified lines | ||
| 967 | 962 | ce->e_reusable = 0; |
| 968 | 963 | ea_bdebug(new_bh, "reusing; refcount now=%d", |
| 969 | 964 | ref); |
| 965 | + ext4_xattr_block_csum_set(inode, new_bh); | |
| 970 | 966 | unlock_buffer(new_bh); |
| 971 | − error = ext4_handle_dirty_xattr_block(handle, | |
| 972 | − inode, | |
| 973 | − new_bh); | |
| 967 | + error = ext4_handle_dirty_metadata(handle, | |
| 968 | + inode, | |
| 969 | + new_bh); | |
| 974 | 970 | if (error) |
| 975 | 971 | goto cleanup_dquot; |
| 976 | 972 | } |
| @@ -1020,11 +1016,12 @@ getblk_failed: · 43 unmodified lines | ||
| 1020 | 1016 | goto getblk_failed; |
| 1021 | 1017 | } |
| 1022 | 1018 | memcpy(new_bh->b_data, s->base, new_bh->b_size); |
| 1019 | + ext4_xattr_block_csum_set(inode, new_bh); | |
| 1023 | 1020 | set_buffer_uptodate(new_bh); |
| 1024 | 1021 | unlock_buffer(new_bh); |
| 1025 | 1022 | ext4_xattr_cache_insert(ext4_mb_cache, new_bh); |
| 1026 | − error = ext4_handle_dirty_xattr_block(handle, | |
| 1027 | − inode, new_bh); | |
| 1023 | + error = ext4_handle_dirty_metadata(handle, inode, | |
| 1024 | + new_bh); | |
| 1028 | 1025 | if (error) |
| 1029 | 1026 | goto cleanup; |
| 1030 | 1027 | } |
| @@ -196,6 +196,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi) · 195 unmodified lines | ||
| 196 | 196 | si->base_mem += (NM_I(sbi)->nat_bits_blocks << F2FS_BLKSIZE_BITS); |
| 197 | 197 | si->base_mem += NM_I(sbi)->nat_blocks * NAT_ENTRY_BITMAP_SIZE; |
| 198 | 198 | si->base_mem += NM_I(sbi)->nat_blocks / 8; |
| 199 | + si->base_mem += NM_I(sbi)->nat_blocks * sizeof(unsigned short); | |
| 199 | 200 | |
| 200 | 201 | get_cache: |
| 201 | 202 | si->cache_mem = 0; |
| @@ -750,7 +750,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, · 749 unmodified lines | ||
| 750 | 750 | dentry_blk = page_address(page); |
| 751 | 751 | bit_pos = dentry - dentry_blk->dentry; |
| 752 | 752 | for (i = 0; i < slots; i++) |
| 753 | − clear_bit_le(bit_pos + i, &dentry_blk->dentry_bitmap); | |
| 753 | + __clear_bit_le(bit_pos + i, &dentry_blk->dentry_bitmap); | |
| 754 | 754 | |
| 755 | 755 | /* Let's check and deallocate this dentry page */ |
| 756 | 756 | bit_pos = find_next_bit_le(&dentry_blk->dentry_bitmap, |
| @@ -561,6 +561,8 @@ struct f2fs_nm_info { · 560 unmodified lines | ||
| 561 | 561 | struct mutex build_lock; /* lock for build free nids */ |
| 562 | 562 | unsigned char (*free_nid_bitmap)[NAT_ENTRY_BITMAP_SIZE]; |
| 563 | 563 | unsigned char *nat_block_bitmap; |
| 564 | + unsigned short *free_nid_count; /* free nid count of NAT block */ | |
| 565 | + spinlock_t free_nid_lock; /* protect updating of nid count */ | |
| 564 | 566 | |
| 565 | 567 | /* for checkpoint */ |
| 566 | 568 | char *nat_bitmap; /* NAT bitmap pointer */ |
| @@ -338,9 +338,6 @@ static void set_node_addr(struct f2fs_sb_info *sbi, struct node_info *ni, · 337 unmodified lines | ||
| 338 | 338 | set_nat_flag(e, IS_CHECKPOINTED, false); |
| 339 | 339 | __set_nat_cache_dirty(nm_i, e); |
| 340 | 340 | |
| 341 | − if (enabled_nat_bits(sbi, NULL) && new_blkaddr == NEW_ADDR) | |
| 342 | − clear_bit_le(NAT_BLOCK_OFFSET(ni->nid), nm_i->empty_nat_bits); | |
| 343 | − | |
| 344 | 341 | /* update fsync_mark if its inode nat entry is still alive */ |
| 345 | 342 | if (ni->nid != ni->ino) |
| 346 | 343 | e = __lookup_nat_cache(nm_i, ni->ino); |
| @@ -1823,7 +1820,8 @@ static void remove_free_nid(struct f2fs_sb_info *sbi, nid_t nid) · 1476 unmodified lines | ||
| 1823 | 1820 | kmem_cache_free(free_nid_slab, i); |
| 1824 | 1821 | } |
| 1825 | 1822 | |
| 1826 | −void update_free_nid_bitmap(struct f2fs_sb_info *sbi, nid_t nid, bool set) | |
| 1823 | +static void update_free_nid_bitmap(struct f2fs_sb_info *sbi, nid_t nid, | |
| 1824 | + bool set, bool build, bool locked) | |
| 1827 | 1825 | { |
| 1828 | 1826 | struct f2fs_nm_info *nm_i = NM_I(sbi); |
| 1829 | 1827 | unsigned int nat_ofs = NAT_BLOCK_OFFSET(nid); |
| @@ -1833,9 +1831,18 @@ void update_free_nid_bitmap(struct f2fs_sb_info *sbi, nid_t nid, bool set) · 3 unmodified lines | ||
| 1833 | 1831 | return; |
| 1834 | 1832 | |
| 1835 | 1833 | if (set) |
| 1836 | − set_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]); | |
| 1834 | + __set_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]); | |
| 1837 | 1835 | else |
| 1838 | − clear_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]); | |
| 1836 | + __clear_bit_le(nid_ofs, nm_i->free_nid_bitmap[nat_ofs]); | |
| 1837 | + | |
| 1838 | + if (!locked) | |
| 1839 | + spin_lock(&nm_i->free_nid_lock); | |
| 1840 | + if (set) | |
| 1841 | + nm_i->free_nid_count[nat_ofs]++; | |
| 1842 | + else if (!build) | |
| 1843 | + nm_i->free_nid_count[nat_ofs]--; | |
| 1844 | + if (!locked) | |
| 1845 | + spin_unlock(&nm_i->free_nid_lock); | |
| 1839 | 1846 | } |
| 1840 | 1847 | |
| 1841 | 1848 | static void scan_nat_page(struct f2fs_sb_info *sbi, |
| @@ -1847,7 +1854,10 @@ static void scan_nat_page(struct f2fs_sb_info *sbi, · 5 unmodified lines | ||
| 1847 | 1854 | unsigned int nat_ofs = NAT_BLOCK_OFFSET(start_nid); |
| 1848 | 1855 | int i; |
| 1849 | 1856 | |
| 1850 | − set_bit_le(nat_ofs, nm_i->nat_block_bitmap); | |
| 1857 | + if (test_bit_le(nat_ofs, nm_i->nat_block_bitmap)) | |
| 1858 | + return; | |
| 1859 | + | |
| 1860 | + __set_bit_le(nat_ofs, nm_i->nat_block_bitmap); | |
| 1851 | 1861 | |
| 1852 | 1862 | i = start_nid % NAT_ENTRY_PER_BLOCK; |
| 1853 | 1863 | |
| @@ -1861,7 +1871,7 @@ static void scan_nat_page(struct f2fs_sb_info *sbi, · 7 unmodified lines | ||
| 1861 | 1871 | f2fs_bug_on(sbi, blk_addr == NEW_ADDR); |
| 1862 | 1872 | if (blk_addr == NULL_ADDR) |
| 1863 | 1873 | freed = add_free_nid(sbi, start_nid, true); |
| 1864 | − update_free_nid_bitmap(sbi, start_nid, freed); | |
| 1874 | + update_free_nid_bitmap(sbi, start_nid, freed, true, false); | |
| 1865 | 1875 | } |
| 1866 | 1876 | } |
| 1867 | 1877 | |
| @@ -1877,6 +1887,8 @@ static void scan_free_nid_bits(struct f2fs_sb_info *sbi) · 9 unmodified lines | ||
| 1877 | 1887 | for (i = 0; i < nm_i->nat_blocks; i++) { |
| 1878 | 1888 | if (!test_bit_le(i, nm_i->nat_block_bitmap)) |
| 1879 | 1889 | continue; |
| 1890 | + if (!nm_i->free_nid_count[i]) | |
| 1891 | + continue; | |
| 1880 | 1892 | for (idx = 0; idx < NAT_ENTRY_PER_BLOCK; idx++) { |
| 1881 | 1893 | nid_t nid; |
| 1882 | 1894 | |
| @@ -1907,58 +1919,6 @@ out: · 24 unmodified lines | ||
| 1907 | 1919 | up_read(&nm_i->nat_tree_lock); |
| 1908 | 1920 | } |
| 1909 | 1921 | |
| 1910 | −static int scan_nat_bits(struct f2fs_sb_info *sbi) | |
| 1911 | −{ | |
| 1912 | − struct f2fs_nm_info *nm_i = NM_I(sbi); | |
| 1913 | − struct page *page; | |
| 1914 | − unsigned int i = 0; | |
| 1915 | − nid_t nid; | |
| 1916 | − | |
| 1917 | − if (!enabled_nat_bits(sbi, NULL)) | |
| 1918 | − return -EAGAIN; | |
| 1919 | − | |
| 1920 | − down_read(&nm_i->nat_tree_lock); | |
| 1921 | −check_empty: | |
| 1922 | − i = find_next_bit_le(nm_i->empty_nat_bits, nm_i->nat_blocks, i); | |
| 1923 | − if (i >= nm_i->nat_blocks) { | |
| 1924 | − i = 0; | |
| 1925 | − goto check_partial; | |
| 1926 | − } | |
| 1927 | − | |
| 1928 | − for (nid = i * NAT_ENTRY_PER_BLOCK; nid < (i + 1) * NAT_ENTRY_PER_BLOCK; | |
| 1929 | − nid++) { | |
| 1930 | − if (unlikely(nid >= nm_i->max_nid)) | |
| 1931 | − break; | |
| 1932 | − add_free_nid(sbi, nid, true); | |
| 1933 | − } | |
| 1934 | − | |
| 1935 | − if (nm_i->nid_cnt[FREE_NID_LIST] >= MAX_FREE_NIDS) | |
| 1936 | − goto out; | |
| 1937 | − i++; | |
| 1938 | − goto check_empty; | |
| 1939 | − | |
| 1940 | −check_partial: | |
| 1941 | − i = find_next_zero_bit_le(nm_i->full_nat_bits, nm_i->nat_blocks, i); | |
| 1942 | − if (i >= nm_i->nat_blocks) { | |
| 1943 | − disable_nat_bits(sbi, true); | |
| 1944 | − up_read(&nm_i->nat_tree_lock); | |
| 1945 | − return -EINVAL; | |
| 1946 | − } | |
| 1947 | − | |
| 1948 | − nid = i * NAT_ENTRY_PER_BLOCK; | |
| 1949 | − page = get_current_nat_page(sbi, nid); | |
| 1950 | − scan_nat_page(sbi, page, nid); | |
| 1951 | − f2fs_put_page(page, 1); | |
| 1952 | − | |
| 1953 | − if (nm_i->nid_cnt[FREE_NID_LIST] < MAX_FREE_NIDS) { | |
| 1954 | − i++; | |
| 1955 | − goto check_partial; | |
| 1956 | − } | |
| 1957 | −out: | |
| 1958 | − up_read(&nm_i->nat_tree_lock); | |
| 1959 | − return 0; | |
| 1960 | −} | |
| 1961 | − | |
| 1962 | 1922 | static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount) |
| 1963 | 1923 | { |
| 1964 | 1924 | struct f2fs_nm_info *nm_i = NM_I(sbi); |
| @@ -1980,21 +1940,6 @@ static void __build_free_nids(struct f2fs_sb_info *sbi, bool sync, bool mount) · 15 unmodified lines | ||
| 1980 | 1940 | |
| 1981 | 1941 | if (nm_i->nid_cnt[FREE_NID_LIST]) |
| 1982 | 1942 | return; |
| 1983 | − | |
| 1984 | − /* try to find free nids with nat_bits */ | |
| 1985 | − if (!scan_nat_bits(sbi) && nm_i->nid_cnt[FREE_NID_LIST]) | |
| 1986 | − return; | |
| 1987 | − } | |
| 1988 | − | |
| 1989 | − /* find next valid candidate */ | |
| 1990 | − if (enabled_nat_bits(sbi, NULL)) { | |
| 1991 | − int idx = find_next_zero_bit_le(nm_i->full_nat_bits, | |
| 1992 | − nm_i->nat_blocks, 0); | |
| 1993 | − | |
| 1994 | − if (idx >= nm_i->nat_blocks) | |
| 1995 | − set_sbi_flag(sbi, SBI_NEED_FSCK); | |
| 1996 | − else | |
| 1997 | − nid = idx * NAT_ENTRY_PER_BLOCK; | |
| 1998 | 1943 | } |
| 1999 | 1944 | |
| 2000 | 1945 | /* readahead nat pages to be scanned */ |
| @@ -2081,7 +2026,7 @@ retry: · 80 unmodified lines | ||
| 2081 | 2026 | __insert_nid_to_list(sbi, i, ALLOC_NID_LIST, false); |
| 2082 | 2027 | nm_i->available_nids--; |
| 2083 | 2028 | |
| 2084 | − update_free_nid_bitmap(sbi, *nid, false); | |
| 2029 | + update_free_nid_bitmap(sbi, *nid, false, false, false); | |
| 2085 | 2030 | |
| 2086 | 2031 | spin_unlock(&nm_i->nid_list_lock); |
| 2087 | 2032 | return true; |
| @@ -2137,7 +2082,7 @@ void alloc_nid_failed(struct f2fs_sb_info *sbi, nid_t nid) · 49 unmodified lines | ||
| 2137 | 2082 | |
| 2138 | 2083 | nm_i->available_nids++; |
| 2139 | 2084 | |
| 2140 | − update_free_nid_bitmap(sbi, nid, true); | |
| 2085 | + update_free_nid_bitmap(sbi, nid, true, false, false); | |
| 2141 | 2086 | |
| 2142 | 2087 | spin_unlock(&nm_i->nid_list_lock); |
| 2143 | 2088 | |
| @@ -2383,7 +2328,7 @@ add_out: · 239 unmodified lines | ||
| 2383 | 2328 | list_add_tail(&nes->set_list, head); |
| 2384 | 2329 | } |
| 2385 | 2330 | |
| 2386 | −void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid, | |
| 2331 | +static void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid, | |
| 2387 | 2332 | struct page *page) |
| 2388 | 2333 | { |
| 2389 | 2334 | struct f2fs_nm_info *nm_i = NM_I(sbi); |
| @@ -2402,16 +2347,16 @@ void __update_nat_bits(struct f2fs_sb_info *sbi, nid_t start_nid, · 12 unmodified lines | ||
| 2402 | 2347 | valid++; |
| 2403 | 2348 | } |
| 2404 | 2349 | if (valid == 0) { |
| 2405 | − set_bit_le(nat_index, nm_i->empty_nat_bits); | |
| 2406 | − clear_bit_le(nat_index, nm_i->full_nat_bits); | |
| 2350 | + __set_bit_le(nat_index, nm_i->empty_nat_bits); | |
| 2351 | + __clear_bit_le(nat_index, nm_i->full_nat_bits); | |
| 2407 | 2352 | return; |
| 2408 | 2353 | } |
| 2409 | 2354 | |
| 2410 | − clear_bit_le(nat_index, nm_i->empty_nat_bits); | |
| 2355 | + __clear_bit_le(nat_index, nm_i->empty_nat_bits); | |
| 2411 | 2356 | if (valid == NAT_ENTRY_PER_BLOCK) |
| 2412 | − set_bit_le(nat_index, nm_i->full_nat_bits); | |
| 2357 | + __set_bit_le(nat_index, nm_i->full_nat_bits); | |
| 2413 | 2358 | else |
| 2414 | − clear_bit_le(nat_index, nm_i->full_nat_bits); | |
| 2359 | + __clear_bit_le(nat_index, nm_i->full_nat_bits); | |
| 2415 | 2360 | } |
| 2416 | 2361 | |
| 2417 | 2362 | static void __flush_nat_entry_set(struct f2fs_sb_info *sbi, |
| @@ -2467,11 +2412,11 @@ static void __flush_nat_entry_set(struct f2fs_sb_info *sbi, · 49 unmodified lines | ||
| 2467 | 2412 | add_free_nid(sbi, nid, false); |
| 2468 | 2413 | spin_lock(&NM_I(sbi)->nid_list_lock); |
| 2469 | 2414 | NM_I(sbi)->available_nids++; |
| 2470 | − update_free_nid_bitmap(sbi, nid, true); | |
| 2415 | + update_free_nid_bitmap(sbi, nid, true, false, false); | |
| 2471 | 2416 | spin_unlock(&NM_I(sbi)->nid_list_lock); |
| 2472 | 2417 | } else { |
| 2473 | 2418 | spin_lock(&NM_I(sbi)->nid_list_lock); |
| 2474 | − update_free_nid_bitmap(sbi, nid, false); | |
| 2419 | + update_free_nid_bitmap(sbi, nid, false, false, false); | |
| 2475 | 2420 | spin_unlock(&NM_I(sbi)->nid_list_lock); |
| 2476 | 2421 | } |
| 2477 | 2422 | } |
| @@ -2577,6 +2522,40 @@ static int __get_nat_bitmaps(struct f2fs_sb_info *sbi) · 99 unmodified lines | ||
| 2577 | 2522 | return 0; |
| 2578 | 2523 | } |
| 2579 | 2524 | |
| 2525 | +inline void load_free_nid_bitmap(struct f2fs_sb_info *sbi) | |
| 2526 | +{ | |
| 2527 | + struct f2fs_nm_info *nm_i = NM_I(sbi); | |
| 2528 | + unsigned int i = 0; | |
| 2529 | + nid_t nid, last_nid; | |
| 2530 | + | |
| 2531 | + if (!enabled_nat_bits(sbi, NULL)) | |
| 2532 | + return; | |
| 2533 | + | |
| 2534 | + for (i = 0; i < nm_i->nat_blocks; i++) { | |
| 2535 | + i = find_next_bit_le(nm_i->empty_nat_bits, nm_i->nat_blocks, i); | |
| 2536 | + if (i >= nm_i->nat_blocks) | |
| 2537 | + break; | |
| 2538 | + | |
| 2539 | + __set_bit_le(i, nm_i->nat_block_bitmap); | |
| 2540 | + | |
| 2541 | + nid = i * NAT_ENTRY_PER_BLOCK; | |
| 2542 | + last_nid = (i + 1) * NAT_ENTRY_PER_BLOCK; | |
| 2543 | + | |
| 2544 | + spin_lock(&nm_i->free_nid_lock); | |
| 2545 | + for (; nid < last_nid; nid++) | |
| 2546 | + update_free_nid_bitmap(sbi, nid, true, true, true); | |
| 2547 | + spin_unlock(&nm_i->free_nid_lock); | |
| 2548 | + } | |
| 2549 | + | |
| 2550 | + for (i = 0; i < nm_i->nat_blocks; i++) { | |
| 2551 | + i = find_next_bit_le(nm_i->full_nat_bits, nm_i->nat_blocks, i); | |
| 2552 | + if (i >= nm_i->nat_blocks) | |
| 2553 | + break; | |
| 2554 | + | |
| 2555 | + __set_bit_le(i, nm_i->nat_block_bitmap); | |
| 2556 | + } | |
| 2557 | +} | |
| 2558 | + | |
| 2580 | 2559 | static int init_node_manager(struct f2fs_sb_info *sbi) |
| 2581 | 2560 | { |
| 2582 | 2561 | struct f2fs_super_block *sb_raw = F2FS_RAW_SUPER(sbi); |
| @@ -2638,7 +2617,7 @@ static int init_node_manager(struct f2fs_sb_info *sbi) · 55 unmodified lines | ||
| 2638 | 2617 | return 0; |
| 2639 | 2618 | } |
| 2640 | 2619 | |
| 2641 | −int init_free_nid_cache(struct f2fs_sb_info *sbi) | |
| 2620 | +static int init_free_nid_cache(struct f2fs_sb_info *sbi) | |
| 2642 | 2621 | { |
| 2643 | 2622 | struct f2fs_nm_info *nm_i = NM_I(sbi); |
| 2644 | 2623 | |
| @@ -2651,6 +2630,14 @@ int init_free_nid_cache(struct f2fs_sb_info *sbi) · 6 unmodified lines | ||
| 2651 | 2630 | GFP_KERNEL); |
| 2652 | 2631 | if (!nm_i->nat_block_bitmap) |
| 2653 | 2632 | return -ENOMEM; |
| 2633 | + | |
| 2634 | + nm_i->free_nid_count = f2fs_kvzalloc(nm_i->nat_blocks * | |
| 2635 | + sizeof(unsigned short), GFP_KERNEL); | |
| 2636 | + if (!nm_i->free_nid_count) | |
| 2637 | + return -ENOMEM; | |
| 2638 | + | |
| 2639 | + spin_lock_init(&nm_i->free_nid_lock); | |
| 2640 | + | |
| 2654 | 2641 | return 0; |
| 2655 | 2642 | } |
| 2656 | 2643 | |
| @@ -2670,6 +2657,9 @@ int build_node_manager(struct f2fs_sb_info *sbi) · 13 unmodified lines | ||
| 2670 | 2657 | if (err) |
| 2671 | 2658 | return err; |
| 2672 | 2659 | |
| 2660 | + /* load free nid status from nat_bits table */ | |
| 2661 | + load_free_nid_bitmap(sbi); | |
| 2662 | + | |
| 2673 | 2663 | build_free_nids(sbi, true, true); |
| 2674 | 2664 | return 0; |
| 2675 | 2665 | } |
| @@ -2730,6 +2720,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi) · 54 unmodified lines | ||
| 2730 | 2720 | |
| 2731 | 2721 | kvfree(nm_i->nat_block_bitmap); |
| 2732 | 2722 | kvfree(nm_i->free_nid_bitmap); |
| 2723 | + kvfree(nm_i->free_nid_count); | |
| 2733 | 2724 | |
| 2734 | 2725 | kfree(nm_i->nat_bitmap); |
| 2735 | 2726 | kfree(nm_i->nat_bits); |
| @@ -1163,6 +1163,12 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del) · 1162 unmodified lines | ||
| 1163 | 1163 | if (f2fs_discard_en(sbi) && |
| 1164 | 1164 | !f2fs_test_and_set_bit(offset, se->discard_map)) |
| 1165 | 1165 | sbi->discard_blks--; |
| 1166 | + | |
| 1167 | + /* don't overwrite by SSR to keep node chain */ | |
| 1168 | + if (se->type == CURSEG_WARM_NODE) { | |
| 1169 | + if (!f2fs_test_and_set_bit(offset, se->ckpt_valid_map)) | |
| 1170 | + se->ckpt_valid_blocks++; | |
| 1171 | + } | |
| 1166 | 1172 | } else { |
| 1167 | 1173 | if (!f2fs_test_and_clear_bit(offset, se->cur_valid_map)) { |
| 1168 | 1174 | #ifdef CONFIG_F2FS_CHECK_FS |
| @@ -1125,10 +1125,8 @@ static journal_t *journal_init_common(struct block_device *bdev, · 1124 unmodified lines | ||
| 1125 | 1125 | |
| 1126 | 1126 | /* Set up a default-sized revoke table for the new mount. */ |
| 1127 | 1127 | err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH); |
| 1128 | − if (err) { | |
| 1129 | − kfree(journal); | |
| 1130 | − return NULL; | |
| 1131 | − } | |
| 1128 | + if (err) | |
| 1129 | + goto err_cleanup; | |
| 1132 | 1130 | |
| 1133 | 1131 | spin_lock_init(&journal->j_history_lock); |
| 1134 | 1132 | |
| @@ -1145,23 +1143,25 @@ static journal_t *journal_init_common(struct block_device *bdev, · 10 unmodified lines | ||
| 1145 | 1143 | journal->j_wbufsize = n; |
| 1146 | 1144 | journal->j_wbuf = kmalloc_array(n, sizeof(struct buffer_head *), |
| 1147 | 1145 | GFP_KERNEL); |
| 1148 | − if (!journal->j_wbuf) { | |
| 1149 | − kfree(journal); | |
| 1150 | − return NULL; | |
| 1151 | − } | |
| 1146 | + if (!journal->j_wbuf) | |
| 1147 | + goto err_cleanup; | |
| 1152 | 1148 | |
| 1153 | 1149 | bh = getblk_unmovable(journal->j_dev, start, journal->j_blocksize); |
| 1154 | 1150 | if (!bh) { |
| 1155 | 1151 | pr_err("%s: Cannot get buffer for journal superblock\n", |
| 1156 | 1152 | __func__); |
| 1157 | − kfree(journal->j_wbuf); | |
| 1158 | − kfree(journal); | |
| 1159 | − return NULL; | |
| 1153 | + goto err_cleanup; | |
| 1160 | 1154 | } |
| 1161 | 1155 | journal->j_sb_buffer = bh; |
| 1162 | 1156 | journal->j_superblock = (journal_superblock_t *)bh->b_data; |
| 1163 | 1157 | |
| 1164 | 1158 | return journal; |
| 1159 | + | |
| 1160 | +err_cleanup: | |
| 1161 | + kfree(journal->j_wbuf); | |
| 1162 | + jbd2_journal_destroy_revoke(journal); | |
| 1163 | + kfree(journal); | |
| 1164 | + return NULL; | |
| 1165 | 1165 | } |
| 1166 | 1166 | |
| 1167 | 1167 | /* jbd2_journal_init_dev and jbd2_journal_init_inode: |
| @@ -280,6 +280,7 @@ int jbd2_journal_init_revoke(journal_t *journal, int hash_size) · 279 unmodified lines | ||
| 280 | 280 | |
| 281 | 281 | fail1: |
| 282 | 282 | jbd2_journal_destroy_revoke_table(journal->j_revoke_table[0]); |
| 283 | + journal->j_revoke_table[0] = NULL; | |
| 283 | 284 | fail0: |
| 284 | 285 | return -ENOMEM; |
| 285 | 286 | } |
| @@ -809,7 +809,8 @@ void kernfs_drain_open_files(struct kernfs_node *kn) · 808 unmodified lines | ||
| 809 | 809 | if (kn->flags & KERNFS_HAS_MMAP) |
| 810 | 810 | unmap_mapping_range(inode->i_mapping, 0, 0, 1); |
| 811 | 811 | |
| 812 | − kernfs_release_file(kn, of); | |
| 812 | + if (kn->flags & KERNFS_HAS_RELEASE) | |
| 813 | + kernfs_release_file(kn, of); | |
| 813 | 814 | } |
| 814 | 815 | |
| 815 | 816 | mutex_unlock(&kernfs_open_file_mutex); |
| @@ -556,7 +556,7 @@ enum ccp_engine { · 555 unmodified lines | ||
| 556 | 556 | * struct ccp_cmd - CCP operation request |
| 557 | 557 | * @entry: list element (ccp driver use only) |
| 558 | 558 | * @work: work element used for callbacks (ccp driver use only) |
| 559 | − * @ccp: CCP device to be run on (ccp driver use only) | |
| 559 | + * @ccp: CCP device to be run on | |
| 560 | 560 | * @ret: operation return code (ccp driver use only) |
| 561 | 561 | * @flags: cmd processing flags |
| 562 | 562 | * @engine: CCP operation to perform |
| @@ -20,6 +20,8 @@ struct sock_exterr_skb { · 19 unmodified lines | ||
| 20 | 20 | struct sock_extended_err ee; |
| 21 | 21 | u16 addr_offset; |
| 22 | 22 | __be16 port; |
| 23 | + u8 opt_stats:1, | |
| 24 | + unused:7; | |
| 23 | 25 | }; |
| 24 | 26 | |
| 25 | 27 | #endif |
| @@ -87,7 +87,6 @@ struct fscrypt_operations { · 86 unmodified lines | ||
| 87 | 87 | unsigned int flags; |
| 88 | 88 | const char *key_prefix; |
| 89 | 89 | int (*get_context)(struct inode *, void *, size_t); |
| 90 | − int (*prepare_context)(struct inode *); | |
| 91 | 90 | int (*set_context)(struct inode *, const void *, size_t, void *); |
| 92 | 91 | int (*dummy_context)(struct inode *); |
| 93 | 92 | bool (*is_encrypted)(struct inode *); |
| @@ -143,15 +143,6 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, · 142 unmodified lines | ||
| 143 | 143 | struct fwnode_handle *child, |
| 144 | 144 | enum gpiod_flags flags, |
| 145 | 145 | const char *label); |
| 146 | −/* FIXME: delete this helper when users are switched over */ | |
| 147 | −static inline struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, | |
| 148 | − const char *con_id, struct fwnode_handle *child) | |
| 149 | −{ | |
| 150 | − return devm_fwnode_get_index_gpiod_from_child(dev, con_id, | |
| 151 | − 0, child, | |
| 152 | − GPIOD_ASIS, | |
| 153 | − "?"); | |
| 154 | −} | |
| 155 | 146 | |
| 156 | 147 | #else /* CONFIG_GPIOLIB */ |
| 157 | 148 | |
| @@ -444,13 +435,6 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, · 286 unmodified lines | ||
| 444 | 435 | return ERR_PTR(-ENOSYS); |
| 445 | 436 | } |
| 446 | 437 | |
| 447 | −/* FIXME: delete this when all users are switched over */ | |
| 448 | −static inline struct gpio_desc *devm_get_gpiod_from_child(struct device *dev, | |
| 449 | − const char *con_id, struct fwnode_handle *child) | |
| 450 | −{ | |
| 451 | − return ERR_PTR(-ENOSYS); | |
| 452 | −} | |
| 453 | − | |
| 454 | 438 | #endif /* CONFIG_GPIOLIB */ |
| 455 | 439 | |
| 456 | 440 | static inline |
| @@ -88,6 +88,7 @@ enum hwmon_temp_attributes { · 87 unmodified lines | ||
| 88 | 88 | #define HWMON_T_CRIT_HYST BIT(hwmon_temp_crit_hyst) |
| 89 | 89 | #define HWMON_T_EMERGENCY BIT(hwmon_temp_emergency) |
| 90 | 90 | #define HWMON_T_EMERGENCY_HYST BIT(hwmon_temp_emergency_hyst) |
| 91 | +#define HWMON_T_ALARM BIT(hwmon_temp_alarm) | |
| 91 | 92 | #define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm) |
| 92 | 93 | #define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm) |
| 93 | 94 | #define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm) |
| @@ -845,6 +845,13 @@ struct vmbus_channel { · 844 unmodified lines | ||
| 845 | 845 | * link up channels based on their CPU affinity. |
| 846 | 846 | */ |
| 847 | 847 | struct list_head percpu_list; |
| 848 | + | |
| 849 | + /* | |
| 850 | + * Defer freeing channel until after all cpu's have | |
| 851 | + * gone through grace period. | |
| 852 | + */ | |
| 853 | + struct rcu_head rcu; | |
| 854 | + | |
| 848 | 855 | /* |
| 849 | 856 | * For performance critical channels (storage, networking |
| 850 | 857 | * etc,), Hyper-V has a mechanism to enhance the throughput |
| @@ -1430,9 +1437,6 @@ extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, u8 *buf, · 579 unmodified lines | ||
| 1430 | 1437 | const int *srv_version, int srv_vercnt, |
| 1431 | 1438 | int *nego_fw_version, int *nego_srv_version); |
| 1432 | 1439 | |
| 1433 | −void hv_event_tasklet_disable(struct vmbus_channel *channel); | |
| 1434 | −void hv_event_tasklet_enable(struct vmbus_channel *channel); | |
| 1435 | − | |
| 1436 | 1440 | void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid); |
| 1437 | 1441 | |
| 1438 | 1442 | void vmbus_setevent(struct vmbus_channel *channel); |
| @@ -62,7 +62,7 @@ void iio_swd_group_init_type_name(struct iio_sw_device *d, · 61 unmodified lines | ||
| 62 | 62 | const char *name, |
| 63 | 63 | struct config_item_type *type) |
| 64 | 64 | { |
| 65 | −#ifdef CONFIG_CONFIGFS_FS | |
| 65 | +#if IS_ENABLED(CONFIG_CONFIGFS_FS) | |
| 66 | 66 | config_group_init_type_name(&d->group, name, type); |
| 67 | 67 | #endif |
| 68 | 68 | } |
| @@ -125,9 +125,16 @@ enum iommu_attr { · 124 unmodified lines | ||
| 125 | 125 | }; |
| 126 | 126 | |
| 127 | 127 | /* These are the possible reserved region types */ |
| 128 | −#define IOMMU_RESV_DIRECT (1 << 0) | |
| 129 | −#define IOMMU_RESV_RESERVED (1 << 1) | |
| 130 | −#define IOMMU_RESV_MSI (1 << 2) | |
| 128 | +enum iommu_resv_type { | |
| 129 | + /* Memory regions which must be mapped 1:1 at all times */ | |
| 130 | + IOMMU_RESV_DIRECT, | |
| 131 | + /* Arbitrary "never map this or give it to a device" address ranges */ | |
| 132 | + IOMMU_RESV_RESERVED, | |
| 133 | + /* Hardware MSI region (untranslated) */ | |
| 134 | + IOMMU_RESV_MSI, | |
| 135 | + /* Software-managed MSI translation window */ | |
| 136 | + IOMMU_RESV_SW_MSI, | |
| 137 | +}; | |
| 131 | 138 | |
| 132 | 139 | /** |
| 133 | 140 | * struct iommu_resv_region - descriptor for a reserved memory region |
| @@ -142,7 +149,7 @@ struct iommu_resv_region { · 8 unmodified lines | ||
| 142 | 149 | phys_addr_t start; |
| 143 | 150 | size_t length; |
| 144 | 151 | int prot; |
| 145 | − int type; | |
| 152 | + enum iommu_resv_type type; | |
| 146 | 153 | }; |
| 147 | 154 | |
| 148 | 155 | #ifdef CONFIG_IOMMU_API |
| @@ -288,7 +295,8 @@ extern void iommu_get_resv_regions(struct device *dev, struct list_head *list); · 139 unmodified lines | ||
| 288 | 295 | extern void iommu_put_resv_regions(struct device *dev, struct list_head *list); |
| 289 | 296 | extern int iommu_request_dm_for_dev(struct device *dev); |
| 290 | 297 | extern struct iommu_resv_region * |
| 291 | −iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot, int type); | |
| 298 | +iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot, | |
| 299 | + enum iommu_resv_type type); | |
| 292 | 300 | extern int iommu_get_group_resv_regions(struct iommu_group *group, |
| 293 | 301 | struct list_head *head); |
| 294 | 302 | |
| @@ -476,6 +476,7 @@ enum { · 475 unmodified lines | ||
| 476 | 476 | enum { |
| 477 | 477 | MLX4_INTERFACE_STATE_UP = 1 << 0, |
| 478 | 478 | MLX4_INTERFACE_STATE_DELETION = 1 << 1, |
| 479 | + MLX4_INTERFACE_STATE_NOWAIT = 1 << 2, | |
| 479 | 480 | }; |
| 480 | 481 | |
| 481 | 482 | #define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \ |
| @@ -76,22 +76,12 @@ struct gpmc_timings; · 75 unmodified lines | ||
| 76 | 76 | struct omap_nand_platform_data; |
| 77 | 77 | struct omap_onenand_platform_data; |
| 78 | 78 | |
| 79 | −#if IS_ENABLED(CONFIG_MTD_NAND_OMAP2) | |
| 80 | −extern int gpmc_nand_init(struct omap_nand_platform_data *d, | |
| 81 | − struct gpmc_timings *gpmc_t); | |
| 82 | −#else | |
| 83 | −static inline int gpmc_nand_init(struct omap_nand_platform_data *d, | |
| 84 | − struct gpmc_timings *gpmc_t) | |
| 85 | −{ | |
| 86 | − return 0; | |
| 87 | −} | |
| 88 | −#endif | |
| 89 | − | |
| 90 | 79 | #if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2) |
| 91 | −extern void gpmc_onenand_init(struct omap_onenand_platform_data *d); | |
| 80 | +extern int gpmc_onenand_init(struct omap_onenand_platform_data *d); | |
| 92 | 81 | #else |
| 93 | 82 | #define board_onenand_data NULL |
| 94 | −static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d) | |
| 83 | +static inline int gpmc_onenand_init(struct omap_onenand_platform_data *d) | |
| 95 | 84 | { |
| 85 | + return 0; | |
| 96 | 86 | } |
| 97 | 87 | #endif |
| @@ -31,31 +31,26 @@ static inline int device_reset_optional(struct device *dev) · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | static inline int reset_control_reset(struct reset_control *rstc) |
| 33 | 33 | { |
| 34 | − WARN_ON(1); | |
| 35 | 34 | return 0; |
| 36 | 35 | } |
| 37 | 36 | |
| 38 | 37 | static inline int reset_control_assert(struct reset_control *rstc) |
| 39 | 38 | { |
| 40 | − WARN_ON(1); | |
| 41 | 39 | return 0; |
| 42 | 40 | } |
| 43 | 41 | |
| 44 | 42 | static inline int reset_control_deassert(struct reset_control *rstc) |
| 45 | 43 | { |
| 46 | − WARN_ON(1); | |
| 47 | 44 | return 0; |
| 48 | 45 | } |
| 49 | 46 | |
| 50 | 47 | static inline int reset_control_status(struct reset_control *rstc) |
| 51 | 48 | { |
| 52 | − WARN_ON(1); | |
| 53 | 49 | return 0; |
| 54 | 50 | } |
| 55 | 51 | |
| 56 | 52 | static inline void reset_control_put(struct reset_control *rstc) |
| 57 | 53 | { |
| 58 | − WARN_ON(1); | |
| 59 | 54 | } |
| 60 | 55 | |
| 61 | 56 | static inline int __must_check device_reset(struct device *dev) |
| @@ -74,14 +69,14 @@ static inline struct reset_control *__of_reset_control_get( · 12 unmodified lines | ||
| 74 | 69 | const char *id, int index, bool shared, |
| 75 | 70 | bool optional) |
| 76 | 71 | { |
| 77 | − return ERR_PTR(-ENOTSUPP); | |
| 72 | + return optional ? NULL : ERR_PTR(-ENOTSUPP); | |
| 78 | 73 | } |
| 79 | 74 | |
| 80 | 75 | static inline struct reset_control *__devm_reset_control_get( |
| 81 | 76 | struct device *dev, const char *id, |
| 82 | 77 | int index, bool shared, bool optional) |
| 83 | 78 | { |
| 84 | − return ERR_PTR(-ENOTSUPP); | |
| 79 | + return optional ? NULL : ERR_PTR(-ENOTSUPP); | |
| 85 | 80 | } |
| 86 | 81 | |
| 87 | 82 | #endif /* CONFIG_RESET_CONTROLLER */ |
| @@ -50,4 +50,10 @@ · 49 unmodified lines | ||
| 50 | 50 | /* device can't handle Link Power Management */ |
| 51 | 51 | #define USB_QUIRK_NO_LPM BIT(10) |
| 52 | 52 | |
| 53 | +/* | |
| 54 | + * Device reports its bInterval as linear frames instead of the | |
| 55 | + * USB 2.0 calculation. | |
| 56 | + */ | |
| 57 | +#define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL BIT(11) | |
| 58 | + | |
| 53 | 59 | #endif /* __LINUX_USB_QUIRKS_H */ |
| @@ -48,6 +48,8 @@ struct virtio_vsock_pkt { · 47 unmodified lines | ||
| 48 | 48 | struct virtio_vsock_hdr hdr; |
| 49 | 49 | struct work_struct work; |
| 50 | 50 | struct list_head list; |
| 51 | + /* socket refcnt not held, only use for cancellation */ | |
| 52 | + struct vsock_sock *vsk; | |
| 51 | 53 | void *buf; |
| 52 | 54 | u32 len; |
| 53 | 55 | u32 off; |
| @@ -56,6 +58,7 @@ struct virtio_vsock_pkt { · 2 unmodified lines | ||
| 56 | 58 | |
| 57 | 59 | struct virtio_vsock_pkt_info { |
| 58 | 60 | u32 remote_cid, remote_port; |
| 61 | + struct vsock_sock *vsk; | |
| 59 | 62 | struct msghdr *msg; |
| 60 | 63 | u32 pkt_len; |
| 61 | 64 | u16 type; |
| @@ -100,6 +100,9 @@ struct vsock_transport { · 99 unmodified lines | ||
| 100 | 100 | void (*destruct)(struct vsock_sock *); |
| 101 | 101 | void (*release)(struct vsock_sock *); |
| 102 | 102 | |
| 103 | + /* Cancel all pending packets sent on vsock. */ | |
| 104 | + int (*cancel_pkt)(struct vsock_sock *vsk); | |
| 105 | + | |
| 103 | 106 | /* Connections. */ |
| 104 | 107 | int (*connect)(struct vsock_sock *); |
| 105 | 108 | |
| @@ -244,7 +244,7 @@ extern s32 (*nf_ct_nat_offset)(const struct nf_conn *ct, · 243 unmodified lines | ||
| 244 | 244 | u32 seq); |
| 245 | 245 | |
| 246 | 246 | /* Fake conntrack entry for untracked connections */ |
| 247 | −DECLARE_PER_CPU(struct nf_conn, nf_conntrack_untracked); | |
| 247 | +DECLARE_PER_CPU_ALIGNED(struct nf_conn, nf_conntrack_untracked); | |
| 248 | 248 | static inline struct nf_conn *nf_ct_untracked_get(void) |
| 249 | 249 | { |
| 250 | 250 | return raw_cpu_ptr(&nf_conntrack_untracked); |
| @@ -103,6 +103,35 @@ struct nft_regs { · 102 unmodified lines | ||
| 103 | 103 | }; |
| 104 | 104 | }; |
| 105 | 105 | |
| 106 | +/* Store/load an u16 or u8 integer to/from the u32 data register. | |
| 107 | + * | |
| 108 | + * Note, when using concatenations, register allocation happens at 32-bit | |
| 109 | + * level. So for store instruction, pad the rest part with zero to avoid | |
| 110 | + * garbage values. | |
| 111 | + */ | |
| 112 | + | |
| 113 | +static inline void nft_reg_store16(u32 *dreg, u16 val) | |
| 114 | +{ | |
| 115 | + *dreg = 0; | |
| 116 | + *(u16 *)dreg = val; | |
| 117 | +} | |
| 118 | + | |
| 119 | +static inline void nft_reg_store8(u32 *dreg, u8 val) | |
| 120 | +{ | |
| 121 | + *dreg = 0; | |
| 122 | + *(u8 *)dreg = val; | |
| 123 | +} | |
| 124 | + | |
| 125 | +static inline u16 nft_reg_load16(u32 *sreg) | |
| 126 | +{ | |
| 127 | + return *(u16 *)sreg; | |
| 128 | +} | |
| 129 | + | |
| 130 | +static inline u8 nft_reg_load8(u32 *sreg) | |
| 131 | +{ | |
| 132 | + return *(u8 *)sreg; | |
| 133 | +} | |
| 134 | + | |
| 106 | 135 | static inline void nft_data_copy(u32 *dst, const struct nft_data *src, |
| 107 | 136 | unsigned int len) |
| 108 | 137 | { |
| @@ -203,7 +232,6 @@ struct nft_set_elem { · 94 unmodified lines | ||
| 203 | 232 | struct nft_set; |
| 204 | 233 | struct nft_set_iter { |
| 205 | 234 | u8 genmask; |
| 206 | − bool flush; | |
| 207 | 235 | unsigned int count; |
| 208 | 236 | unsigned int skip; |
| 209 | 237 | int err; |
| @@ -9,12 +9,13 @@ nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt, · 8 unmodified lines | ||
| 9 | 9 | struct sk_buff *skb, |
| 10 | 10 | const struct nf_hook_state *state) |
| 11 | 11 | { |
| 12 | + unsigned int flags = IP6_FH_F_AUTH; | |
| 12 | 13 | int protohdr, thoff = 0; |
| 13 | 14 | unsigned short frag_off; |
| 14 | 15 | |
| 15 | 16 | nft_set_pktinfo(pkt, skb, state); |
| 16 | 17 | |
| 17 | − protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL); | |
| 18 | + protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, &flags); | |
| 18 | 19 | if (protohdr < 0) { |
| 19 | 20 | nft_set_pktinfo_proto_unspec(pkt, skb); |
| 20 | 21 | return; |
| @@ -32,6 +33,7 @@ __nft_set_pktinfo_ipv6_validate(struct nft_pktinfo *pkt, · 11 unmodified lines | ||
| 32 | 33 | const struct nf_hook_state *state) |
| 33 | 34 | { |
| 34 | 35 | #if IS_ENABLED(CONFIG_IPV6) |
| 36 | + unsigned int flags = IP6_FH_F_AUTH; | |
| 35 | 37 | struct ipv6hdr *ip6h, _ip6h; |
| 36 | 38 | unsigned int thoff = 0; |
| 37 | 39 | unsigned short frag_off; |
| @@ -50,7 +52,7 @@ __nft_set_pktinfo_ipv6_validate(struct nft_pktinfo *pkt, · 12 unmodified lines | ||
| 50 | 52 | if (pkt_len + sizeof(*ip6h) > skb->len) |
| 51 | 53 | return -1; |
| 52 | 54 | |
| 53 | − protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL); | |
| 55 | + protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, &flags); | |
| 54 | 56 | if (protohdr < 0) |
| 55 | 57 | return -1; |
| 56 | 58 | |
| @@ -83,6 +83,7 @@ struct sctp_bind_addr; · 82 unmodified lines | ||
| 83 | 83 | struct sctp_ulpq; |
| 84 | 84 | struct sctp_ep_common; |
| 85 | 85 | struct crypto_shash; |
| 86 | +struct sctp_stream; | |
| 86 | 87 | |
| 87 | 88 | |
| 88 | 89 | #include <net/sctp/tsnmap.h> |
| @@ -753,6 +754,8 @@ struct sctp_transport { · 664 unmodified lines | ||
| 753 | 754 | /* Is the Path MTU update pending on this tranport */ |
| 754 | 755 | pmtu_pending:1, |
| 755 | 756 | |
| 757 | + dst_pending_confirm:1, /* need to confirm neighbour */ | |
| 758 | + | |
| 756 | 759 | /* Has this transport moved the ctsn since we last sacked */ |
| 757 | 760 | sack_generation:1; |
| 758 | 761 | u32 dst_cookie; |
| @@ -806,8 +809,6 @@ struct sctp_transport { · 47 unmodified lines | ||
| 806 | 809 | |
| 807 | 810 | __u32 burst_limited; /* Holds old cwnd when max.burst is applied */ |
| 808 | 811 | |
| 809 | − __u32 dst_pending_confirm; /* need to confirm neighbour */ | |
| 810 | − | |
| 811 | 812 | /* Destination */ |
| 812 | 813 | struct dst_entry *dst; |
| 813 | 814 | /* Source address. */ |
| @@ -1863,6 +1863,9 @@ struct ib_port_immutable { · 1862 unmodified lines | ||
| 1863 | 1863 | }; |
| 1864 | 1864 | |
| 1865 | 1865 | struct ib_device { |
| 1866 | + /* Do not access @dma_device directly from ULP nor from HW drivers. */ | |
| 1867 | + struct device *dma_device; | |
| 1868 | + | |
| 1866 | 1869 | char name[IB_DEVICE_NAME_MAX]; |
| 1867 | 1870 | |
| 1868 | 1871 | struct list_head event_handler_list; |
| @@ -3007,7 +3010,7 @@ static inline int ib_req_ncomp_notif(struct ib_cq *cq, int wc_cnt) · 1138 unmodified lines | ||
| 3007 | 3010 | */ |
| 3008 | 3011 | static inline int ib_dma_mapping_error(struct ib_device *dev, u64 dma_addr) |
| 3009 | 3012 | { |
| 3010 | − return dma_mapping_error(&dev->dev, dma_addr); | |
| 3013 | + return dma_mapping_error(dev->dma_device, dma_addr); | |
| 3011 | 3014 | } |
| 3012 | 3015 | |
| 3013 | 3016 | /** |
| @@ -3021,7 +3024,7 @@ static inline u64 ib_dma_map_single(struct ib_device *dev, · 7 unmodified lines | ||
| 3021 | 3024 | void *cpu_addr, size_t size, |
| 3022 | 3025 | enum dma_data_direction direction) |
| 3023 | 3026 | { |
| 3024 | − return dma_map_single(&dev->dev, cpu_addr, size, direction); | |
| 3027 | + return dma_map_single(dev->dma_device, cpu_addr, size, direction); | |
| 3025 | 3028 | } |
| 3026 | 3029 | |
| 3027 | 3030 | /** |
| @@ -3035,7 +3038,7 @@ static inline void ib_dma_unmap_single(struct ib_device *dev, · 7 unmodified lines | ||
| 3035 | 3038 | u64 addr, size_t size, |
| 3036 | 3039 | enum dma_data_direction direction) |
| 3037 | 3040 | { |
| 3038 | − dma_unmap_single(&dev->dev, addr, size, direction); | |
| 3041 | + dma_unmap_single(dev->dma_device, addr, size, direction); | |
| 3039 | 3042 | } |
| 3040 | 3043 | |
| 3041 | 3044 | /** |
| @@ -3052,7 +3055,7 @@ static inline u64 ib_dma_map_page(struct ib_device *dev, · 10 unmodified lines | ||
| 3052 | 3055 | size_t size, |
| 3053 | 3056 | enum dma_data_direction direction) |
| 3054 | 3057 | { |
| 3055 | − return dma_map_page(&dev->dev, page, offset, size, direction); | |
| 3058 | + return dma_map_page(dev->dma_device, page, offset, size, direction); | |
| 3056 | 3059 | } |
| 3057 | 3060 | |
| 3058 | 3061 | /** |
| @@ -3066,7 +3069,7 @@ static inline void ib_dma_unmap_page(struct ib_device *dev, · 7 unmodified lines | ||
| 3066 | 3069 | u64 addr, size_t size, |
| 3067 | 3070 | enum dma_data_direction direction) |
| 3068 | 3071 | { |
| 3069 | − dma_unmap_page(&dev->dev, addr, size, direction); | |
| 3072 | + dma_unmap_page(dev->dma_device, addr, size, direction); | |
| 3070 | 3073 | } |
| 3071 | 3074 | |
| 3072 | 3075 | /** |
| @@ -3080,7 +3083,7 @@ static inline int ib_dma_map_sg(struct ib_device *dev, · 7 unmodified lines | ||
| 3080 | 3083 | struct scatterlist *sg, int nents, |
| 3081 | 3084 | enum dma_data_direction direction) |
| 3082 | 3085 | { |
| 3083 | − return dma_map_sg(&dev->dev, sg, nents, direction); | |
| 3086 | + return dma_map_sg(dev->dma_device, sg, nents, direction); | |
| 3084 | 3087 | } |
| 3085 | 3088 | |
| 3086 | 3089 | /** |
| @@ -3094,7 +3097,7 @@ static inline void ib_dma_unmap_sg(struct ib_device *dev, · 7 unmodified lines | ||
| 3094 | 3097 | struct scatterlist *sg, int nents, |
| 3095 | 3098 | enum dma_data_direction direction) |
| 3096 | 3099 | { |
| 3097 | − dma_unmap_sg(&dev->dev, sg, nents, direction); | |
| 3100 | + dma_unmap_sg(dev->dma_device, sg, nents, direction); | |
| 3098 | 3101 | } |
| 3099 | 3102 | |
| 3100 | 3103 | static inline int ib_dma_map_sg_attrs(struct ib_device *dev, |
| @@ -3102,7 +3105,8 @@ static inline int ib_dma_map_sg_attrs(struct ib_device *dev, · 1 unmodified line | ||
| 3102 | 3105 | enum dma_data_direction direction, |
| 3103 | 3106 | unsigned long dma_attrs) |
| 3104 | 3107 | { |
| 3105 | − return dma_map_sg_attrs(&dev->dev, sg, nents, direction, dma_attrs); | |
| 3108 | + return dma_map_sg_attrs(dev->dma_device, sg, nents, direction, | |
| 3109 | + dma_attrs); | |
| 3106 | 3110 | } |
| 3107 | 3111 | |
| 3108 | 3112 | static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev, |
| @@ -3110,7 +3114,7 @@ static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev, · 1 unmodified line | ||
| 3110 | 3114 | enum dma_data_direction direction, |
| 3111 | 3115 | unsigned long dma_attrs) |
| 3112 | 3116 | { |
| 3113 | − dma_unmap_sg_attrs(&dev->dev, sg, nents, direction, dma_attrs); | |
| 3117 | + dma_unmap_sg_attrs(dev->dma_device, sg, nents, direction, dma_attrs); | |
| 3114 | 3118 | } |
| 3115 | 3119 | /** |
| 3116 | 3120 | * ib_sg_dma_address - Return the DMA address from a scatter/gather entry |
| @@ -3152,7 +3156,7 @@ static inline void ib_dma_sync_single_for_cpu(struct ib_device *dev, · 35 unmodified lines | ||
| 3152 | 3156 | size_t size, |
| 3153 | 3157 | enum dma_data_direction dir) |
| 3154 | 3158 | { |
| 3155 | − dma_sync_single_for_cpu(&dev->dev, addr, size, dir); | |
| 3159 | + dma_sync_single_for_cpu(dev->dma_device, addr, size, dir); | |
| 3156 | 3160 | } |
| 3157 | 3161 | |
| 3158 | 3162 | /** |
| @@ -3167,7 +3171,7 @@ static inline void ib_dma_sync_single_for_device(struct ib_device *dev, · 8 unmodified lines | ||
| 3167 | 3171 | size_t size, |
| 3168 | 3172 | enum dma_data_direction dir) |
| 3169 | 3173 | { |
| 3170 | − dma_sync_single_for_device(&dev->dev, addr, size, dir); | |
| 3174 | + dma_sync_single_for_device(dev->dma_device, addr, size, dir); | |
| 3171 | 3175 | } |
| 3172 | 3176 | |
| 3173 | 3177 | /** |
| @@ -3182,7 +3186,7 @@ static inline void *ib_dma_alloc_coherent(struct ib_device *dev, · 8 unmodified lines | ||
| 3182 | 3186 | dma_addr_t *dma_handle, |
| 3183 | 3187 | gfp_t flag) |
| 3184 | 3188 | { |
| 3185 | − return dma_alloc_coherent(&dev->dev, size, dma_handle, flag); | |
| 3189 | + return dma_alloc_coherent(dev->dma_device, size, dma_handle, flag); | |
| 3186 | 3190 | } |
| 3187 | 3191 | |
| 3188 | 3192 | /** |
| @@ -3196,7 +3200,7 @@ static inline void ib_dma_free_coherent(struct ib_device *dev, · 7 unmodified lines | ||
| 3196 | 3200 | size_t size, void *cpu_addr, |
| 3197 | 3201 | dma_addr_t dma_handle) |
| 3198 | 3202 | { |
| 3199 | − dma_free_coherent(&dev->dev, size, cpu_addr, dma_handle); | |
| 3203 | + dma_free_coherent(dev->dma_device, size, cpu_addr, dma_handle); | |
| 3200 | 3204 | } |
| 3201 | 3205 | |
| 3202 | 3206 | /** |
| @@ -730,9 +730,11 @@ __SYSCALL(__NR_pkey_mprotect, sys_pkey_mprotect) · 729 unmodified lines | ||
| 730 | 730 | __SYSCALL(__NR_pkey_alloc, sys_pkey_alloc) |
| 731 | 731 | #define __NR_pkey_free 290 |
| 732 | 732 | __SYSCALL(__NR_pkey_free, sys_pkey_free) |
| 733 | +#define __NR_statx 291 | |
| 734 | +__SYSCALL(__NR_statx, sys_statx) | |
| 733 | 735 | |
| 734 | 736 | #undef __NR_syscalls |
| 735 | −#define __NR_syscalls 291 | |
| 737 | +#define __NR_syscalls 292 | |
| 736 | 738 | |
| 737 | 739 | /* |
| 738 | 740 | * All syscalls below here should go away really, |
| @@ -713,33 +713,6 @@ enum btrfs_err_code { · 712 unmodified lines | ||
| 713 | 713 | BTRFS_ERROR_DEV_ONLY_WRITABLE, |
| 714 | 714 | BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS |
| 715 | 715 | }; |
| 716 | −/* An error code to error string mapping for the kernel | |
| 717 | −* error codes | |
| 718 | −*/ | |
| 719 | −static inline char *btrfs_err_str(enum btrfs_err_code err_code) | |
| 720 | −{ | |
| 721 | − switch (err_code) { | |
| 722 | − case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET: | |
| 723 | − return "unable to go below two devices on raid1"; | |
| 724 | − case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET: | |
| 725 | − return "unable to go below four devices on raid10"; | |
| 726 | − case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET: | |
| 727 | − return "unable to go below two devices on raid5"; | |
| 728 | − case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET: | |
| 729 | − return "unable to go below three devices on raid6"; | |
| 730 | − case BTRFS_ERROR_DEV_TGT_REPLACE: | |
| 731 | − return "unable to remove the dev_replace target dev"; | |
| 732 | − case BTRFS_ERROR_DEV_MISSING_NOT_FOUND: | |
| 733 | − return "no missing devices found to remove"; | |
| 734 | − case BTRFS_ERROR_DEV_ONLY_WRITABLE: | |
| 735 | − return "unable to remove the only writeable device"; | |
| 736 | − case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS: | |
| 737 | − return "add/delete/balance/replace/resize operation "\ | |
| 738 | − "in progress"; | |
| 739 | − default: | |
| 740 | − return NULL; | |
| 741 | − } | |
| 742 | −} | |
| 743 | 716 | |
| 744 | 717 | #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \ |
| 745 | 718 | struct btrfs_ioctl_vol_args) |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #define MLX5_ABI_USER_H |
| 35 | 35 | |
| 36 | 36 | #include <linux/types.h> |
| 37 | +#include <linux/if_ether.h> /* For ETH_ALEN. */ | |
| 37 | 38 | |
| 38 | 39 | enum { |
| 39 | 40 | MLX5_QP_FLAG_SIGNATURE = 1 << 0, |
| @@ -66,7 +67,7 @@ struct mlx5_ib_alloc_ucontext_req { · 26 unmodified lines | ||
| 66 | 67 | }; |
| 67 | 68 | |
| 68 | 69 | enum mlx5_lib_caps { |
| 69 | − MLX5_LIB_CAP_4K_UAR = (u64)1 << 0, | |
| 70 | + MLX5_LIB_CAP_4K_UAR = (__u64)1 << 0, | |
| 70 | 71 | }; |
| 71 | 72 | |
| 72 | 73 | struct mlx5_ib_alloc_ucontext_req_v2 { |
| @@ -46,6 +46,7 @@ · 45 unmodified lines | ||
| 46 | 46 | #define DECON_FRAMEFIFO_STATUS 0x0524 |
| 47 | 47 | #define DECON_CMU 0x1404 |
| 48 | 48 | #define DECON_UPDATE 0x1410 |
| 49 | +#define DECON_CRFMID 0x1414 | |
| 49 | 50 | #define DECON_UPDATE_SCHEME 0x1438 |
| 50 | 51 | #define DECON_VIDCON1 0x2000 |
| 51 | 52 | #define DECON_VIDCON2 0x2004 |
| @@ -126,6 +127,10 @@ · 74 unmodified lines | ||
| 126 | 127 | |
| 127 | 128 | /* VIDINTCON0 */ |
| 128 | 129 | #define VIDINTCON0_FRAMEDONE (1 << 17) |
| 130 | +#define VIDINTCON0_FRAMESEL_BP (0 << 15) | |
| 131 | +#define VIDINTCON0_FRAMESEL_VS (1 << 15) | |
| 132 | +#define VIDINTCON0_FRAMESEL_AC (2 << 15) | |
| 133 | +#define VIDINTCON0_FRAMESEL_FP (3 << 15) | |
| 129 | 134 | #define VIDINTCON0_INTFRMEN (1 << 12) |
| 130 | 135 | #define VIDINTCON0_INTEN (1 << 0) |
| 131 | 136 | |
| @@ -142,6 +147,13 @@ · 10 unmodified lines | ||
| 142 | 147 | #define STANDALONE_UPDATE_F (1 << 0) |
| 143 | 148 | |
| 144 | 149 | /* DECON_VIDCON1 */ |
| 150 | +#define VIDCON1_LINECNT_MASK (0x0fff << 16) | |
| 151 | +#define VIDCON1_I80_ACTIVE (1 << 15) | |
| 152 | +#define VIDCON1_VSTATUS_MASK (0x3 << 13) | |
| 153 | +#define VIDCON1_VSTATUS_VS (0 << 13) | |
| 154 | +#define VIDCON1_VSTATUS_BP (1 << 13) | |
| 155 | +#define VIDCON1_VSTATUS_AC (2 << 13) | |
| 156 | +#define VIDCON1_VSTATUS_FP (3 << 13) | |
| 145 | 157 | #define VIDCON1_VCLK_MASK (0x3 << 9) |
| 146 | 158 | #define VIDCON1_VCLK_RUN_VDEN_DISABLE (0x3 << 9) |
| 147 | 159 | #define VIDCON1_VCLK_HOLD (0x0 << 9) |
| @@ -54,6 +54,10 @@ · 53 unmodified lines | ||
| 54 | 54 | #include <linux/kthread.h> |
| 55 | 55 | #include <linux/kernel.h> |
| 56 | 56 | #include <linux/syscalls.h> |
| 57 | +#include <linux/spinlock.h> | |
| 58 | +#include <linux/rcupdate.h> | |
| 59 | +#include <linux/mutex.h> | |
| 60 | +#include <linux/gfp.h> | |
| 57 | 61 | |
| 58 | 62 | #include <linux/audit.h> |
| 59 | 63 | |
| @@ -90,13 +94,34 @@ static u32 audit_default; · 30 unmodified lines | ||
| 90 | 94 | /* If auditing cannot proceed, audit_failure selects what happens. */ |
| 91 | 95 | static u32 audit_failure = AUDIT_FAIL_PRINTK; |
| 92 | 96 | |
| 93 | −/* | |
| 94 | − * If audit records are to be written to the netlink socket, audit_pid | |
| 95 | − * contains the pid of the auditd process and audit_nlk_portid contains | |
| 96 | − * the portid to use to send netlink messages to that process. | |
| 97 | +/* private audit network namespace index */ | |
| 98 | +static unsigned int audit_net_id; | |
| 99 | + | |
| 100 | +/** | |
| 101 | + * struct audit_net - audit private network namespace data | |
| 102 | + * @sk: communication socket | |
| 103 | + */ | |
| 104 | +struct audit_net { | |
| 105 | + struct sock *sk; | |
| 106 | +}; | |
| 107 | + | |
| 108 | +/** | |
| 109 | + * struct auditd_connection - kernel/auditd connection state | |
| 110 | + * @pid: auditd PID | |
| 111 | + * @portid: netlink portid | |
| 112 | + * @net: the associated network namespace | |
| 113 | + * @lock: spinlock to protect write access | |
| 114 | + * | |
| 115 | + * Description: | |
| 116 | + * This struct is RCU protected; you must either hold the RCU lock for reading | |
| 117 | + * or the included spinlock for writing. | |
| 97 | 118 | */ |
| 98 | −int audit_pid; | |
| 99 | −static __u32 audit_nlk_portid; | |
| 119 | +static struct auditd_connection { | |
| 120 | + int pid; | |
| 121 | + u32 portid; | |
| 122 | + struct net *net; | |
| 123 | + spinlock_t lock; | |
| 124 | +} auditd_conn; | |
| 100 | 125 | |
| 101 | 126 | /* If audit_rate_limit is non-zero, limit the rate of sending audit records |
| 102 | 127 | * to that number per second. This prevents DoS attacks, but results in |
| @@ -123,10 +148,6 @@ u32 audit_sig_sid = 0; · 20 unmodified lines | ||
| 123 | 148 | */ |
| 124 | 149 | static atomic_t audit_lost = ATOMIC_INIT(0); |
| 125 | 150 | |
| 126 | −/* The netlink socket. */ | |
| 127 | −static struct sock *audit_sock; | |
| 128 | −static unsigned int audit_net_id; | |
| 129 | − | |
| 130 | 151 | /* Hash for inode-based rules */ |
| 131 | 152 | struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS]; |
| 132 | 153 | |
| @@ -139,6 +160,7 @@ static LIST_HEAD(audit_freelist); · 6 unmodified lines | ||
| 139 | 160 | |
| 140 | 161 | /* queue msgs to send via kauditd_task */ |
| 141 | 162 | static struct sk_buff_head audit_queue; |
| 163 | +static void kauditd_hold_skb(struct sk_buff *skb); | |
| 142 | 164 | /* queue msgs due to temporary unicast send problems */ |
| 143 | 165 | static struct sk_buff_head audit_retry_queue; |
| 144 | 166 | /* queue msgs waiting for new auditd connection */ |
| @@ -192,6 +214,43 @@ struct audit_reply { · 47 unmodified lines | ||
| 192 | 214 | struct sk_buff *skb; |
| 193 | 215 | }; |
| 194 | 216 | |
| 217 | +/** | |
| 218 | + * auditd_test_task - Check to see if a given task is an audit daemon | |
| 219 | + * @task: the task to check | |
| 220 | + * | |
| 221 | + * Description: | |
| 222 | + * Return 1 if the task is a registered audit daemon, 0 otherwise. | |
| 223 | + */ | |
| 224 | +int auditd_test_task(const struct task_struct *task) | |
| 225 | +{ | |
| 226 | + int rc; | |
| 227 | + | |
| 228 | + rcu_read_lock(); | |
| 229 | + rc = (auditd_conn.pid && task->tgid == auditd_conn.pid ? 1 : 0); | |
| 230 | + rcu_read_unlock(); | |
| 231 | + | |
| 232 | + return rc; | |
| 233 | +} | |
| 234 | + | |
| 235 | +/** | |
| 236 | + * audit_get_sk - Return the audit socket for the given network namespace | |
| 237 | + * @net: the destination network namespace | |
| 238 | + * | |
| 239 | + * Description: | |
| 240 | + * Returns the sock pointer if valid, NULL otherwise. The caller must ensure | |
| 241 | + * that a reference is held for the network namespace while the sock is in use. | |
| 242 | + */ | |
| 243 | +static struct sock *audit_get_sk(const struct net *net) | |
| 244 | +{ | |
| 245 | + struct audit_net *aunet; | |
| 246 | + | |
| 247 | + if (!net) | |
| 248 | + return NULL; | |
| 249 | + | |
| 250 | + aunet = net_generic(net, audit_net_id); | |
| 251 | + return aunet->sk; | |
| 252 | +} | |
| 253 | + | |
| 195 | 254 | static void audit_set_portid(struct audit_buffer *ab, __u32 portid) |
| 196 | 255 | { |
| 197 | 256 | if (ab) { |
| @@ -210,9 +269,7 @@ void audit_panic(const char *message) · 12 unmodified lines | ||
| 210 | 269 | pr_err("%s\n", message); |
| 211 | 270 | break; |
| 212 | 271 | case AUDIT_FAIL_PANIC: |
| 213 | − /* test audit_pid since printk is always losey, why bother? */ | |
| 214 | − if (audit_pid) | |
| 215 | − panic("audit: %s\n", message); | |
| 272 | + panic("audit: %s\n", message); | |
| 216 | 273 | break; |
| 217 | 274 | } |
| 218 | 275 | } |
| @@ -370,21 +427,87 @@ static int audit_set_failure(u32 state) · 151 unmodified lines | ||
| 370 | 427 | return audit_do_config_change("audit_failure", &audit_failure, state); |
| 371 | 428 | } |
| 372 | 429 | |
| 373 | −/* | |
| 374 | − * For one reason or another this nlh isn't getting delivered to the userspace | |
| 375 | − * audit daemon, just send it to printk. | |
| 430 | +/** | |
| 431 | + * auditd_set - Set/Reset the auditd connection state | |
| 432 | + * @pid: auditd PID | |
| 433 | + * @portid: auditd netlink portid | |
| 434 | + * @net: auditd network namespace pointer | |
| 435 | + * | |
| 436 | + * Description: | |
| 437 | + * This function will obtain and drop network namespace references as | |
| 438 | + * necessary. | |
| 439 | + */ | |
| 440 | +static void auditd_set(int pid, u32 portid, struct net *net) | |
| 441 | +{ | |
| 442 | + unsigned long flags; | |
| 443 | + | |
| 444 | + spin_lock_irqsave(&auditd_conn.lock, flags); | |
| 445 | + auditd_conn.pid = pid; | |
| 446 | + auditd_conn.portid = portid; | |
| 447 | + if (auditd_conn.net) | |
| 448 | + put_net(auditd_conn.net); | |
| 449 | + if (net) | |
| 450 | + auditd_conn.net = get_net(net); | |
| 451 | + else | |
| 452 | + auditd_conn.net = NULL; | |
| 453 | + spin_unlock_irqrestore(&auditd_conn.lock, flags); | |
| 454 | +} | |
| 455 | + | |
| 456 | +/** | |
| 457 | + * auditd_reset - Disconnect the auditd connection | |
| 458 | + * | |
| 459 | + * Description: | |
| 460 | + * Break the auditd/kauditd connection and move all the queued records into the | |
| 461 | + * hold queue in case auditd reconnects. | |
| 462 | + */ | |
| 463 | +static void auditd_reset(void) | |
| 464 | +{ | |
| 465 | + struct sk_buff *skb; | |
| 466 | + | |
| 467 | + /* if it isn't already broken, break the connection */ | |
| 468 | + rcu_read_lock(); | |
| 469 | + if (auditd_conn.pid) | |
| 470 | + auditd_set(0, 0, NULL); | |
| 471 | + rcu_read_unlock(); | |
| 472 | + | |
| 473 | + /* flush all of the main and retry queues to the hold queue */ | |
| 474 | + while ((skb = skb_dequeue(&audit_retry_queue))) | |
| 475 | + kauditd_hold_skb(skb); | |
| 476 | + while ((skb = skb_dequeue(&audit_queue))) | |
| 477 | + kauditd_hold_skb(skb); | |
| 478 | +} | |
| 479 | + | |
| 480 | +/** | |
| 481 | + * kauditd_print_skb - Print the audit record to the ring buffer | |
| 482 | + * @skb: audit record | |
| 483 | + * | |
| 484 | + * Whatever the reason, this packet may not make it to the auditd connection | |
| 485 | + * so write it via printk so the information isn't completely lost. | |
| 376 | 486 | */ |
| 377 | 487 | static void kauditd_printk_skb(struct sk_buff *skb) |
| 378 | 488 | { |
| 379 | 489 | struct nlmsghdr *nlh = nlmsg_hdr(skb); |
| 380 | 490 | char *data = nlmsg_data(nlh); |
| 381 | 491 | |
| 382 | − if (nlh->nlmsg_type != AUDIT_EOE) { | |
| 383 | − if (printk_ratelimit()) | |
| 384 | − pr_notice("type=%d %s\n", nlh->nlmsg_type, data); | |
| 385 | − else | |
| 386 | − audit_log_lost("printk limit exceeded"); | |
| 387 | − } | |
| 492 | + if (nlh->nlmsg_type != AUDIT_EOE && printk_ratelimit()) | |
| 493 | + pr_notice("type=%d %s\n", nlh->nlmsg_type, data); | |
| 494 | +} | |
| 495 | + | |
| 496 | +/** | |
| 497 | + * kauditd_rehold_skb - Handle a audit record send failure in the hold queue | |
| 498 | + * @skb: audit record | |
| 499 | + * | |
| 500 | + * Description: | |
| 501 | + * This should only be used by the kauditd_thread when it fails to flush the | |
| 502 | + * hold queue. | |
| 503 | + */ | |
| 504 | +static void kauditd_rehold_skb(struct sk_buff *skb) | |
| 505 | +{ | |
| 506 | + /* put the record back in the queue at the same place */ | |
| 507 | + skb_queue_head(&audit_hold_queue, skb); | |
| 508 | + | |
| 509 | + /* fail the auditd connection */ | |
| 510 | + auditd_reset(); | |
| 388 | 511 | } |
| 389 | 512 | |
| 390 | 513 | /** |
| @@ -421,6 +544,9 @@ static void kauditd_hold_skb(struct sk_buff *skb) · 30 unmodified lines | ||
| 421 | 544 | /* we have no other options - drop the message */ |
| 422 | 545 | audit_log_lost("kauditd hold queue overflow"); |
| 423 | 546 | kfree_skb(skb); |
| 547 | + | |
| 548 | + /* fail the auditd connection */ | |
| 549 | + auditd_reset(); | |
| 424 | 550 | } |
| 425 | 551 | |
| 426 | 552 | /** |
| @@ -441,51 +567,122 @@ static void kauditd_retry_skb(struct sk_buff *skb) · 14 unmodified lines | ||
| 441 | 567 | } |
| 442 | 568 | |
| 443 | 569 | /** |
| 444 | − * auditd_reset - Disconnect the auditd connection | |
| 570 | + * auditd_send_unicast_skb - Send a record via unicast to auditd | |
| 571 | + * @skb: audit record | |
| 445 | 572 | * |
| 446 | 573 | * Description: |
| 447 | − * Break the auditd/kauditd connection and move all the records in the retry | |
| 448 | − * queue into the hold queue in case auditd reconnects. The audit_cmd_mutex | |
| 449 | − * must be held when calling this function. | |
| 574 | + * Send a skb to the audit daemon, returns positive/zero values on success and | |
| 575 | + * negative values on failure; in all cases the skb will be consumed by this | |
| 576 | + * function. If the send results in -ECONNREFUSED the connection with auditd | |
| 577 | + * will be reset. This function may sleep so callers should not hold any locks | |
| 578 | + * where this would cause a problem. | |
| 450 | 579 | */ |
| 451 | −static void auditd_reset(void) | |
| 580 | +static int auditd_send_unicast_skb(struct sk_buff *skb) | |
| 452 | 581 | { |
| 453 | − struct sk_buff *skb; | |
| 454 | − | |
| 455 | − /* break the connection */ | |
| 456 | − if (audit_sock) { | |
| 457 | − sock_put(audit_sock); | |
| 458 | − audit_sock = NULL; | |
| 582 | + int rc; | |
| 583 | + u32 portid; | |
| 584 | + struct net *net; | |
| 585 | + struct sock *sk; | |
| 586 | + | |
| 587 | + /* NOTE: we can't call netlink_unicast while in the RCU section so | |
| 588 | + * take a reference to the network namespace and grab local | |
| 589 | + * copies of the namespace, the sock, and the portid; the | |
| 590 | + * namespace and sock aren't going to go away while we hold a | |
| 591 | + * reference and if the portid does become invalid after the RCU | |
| 592 | + * section netlink_unicast() should safely return an error */ | |
| 593 | + | |
| 594 | + rcu_read_lock(); | |
| 595 | + if (!auditd_conn.pid) { | |
| 596 | + rcu_read_unlock(); | |
| 597 | + rc = -ECONNREFUSED; | |
| 598 | + goto err; | |
| 459 | 599 | } |
| 460 | − audit_pid = 0; | |
| 461 | − audit_nlk_portid = 0; | |
| 600 | + net = auditd_conn.net; | |
| 601 | + get_net(net); | |
| 602 | + sk = audit_get_sk(net); | |
| 603 | + portid = auditd_conn.portid; | |
| 604 | + rcu_read_unlock(); | |
| 462 | 605 | |
| 463 | − /* flush all of the retry queue to the hold queue */ | |
| 464 | − while ((skb = skb_dequeue(&audit_retry_queue))) | |
| 465 | − kauditd_hold_skb(skb); | |
| 606 | + rc = netlink_unicast(sk, skb, portid, 0); | |
| 607 | + put_net(net); | |
| 608 | + if (rc < 0) | |
| 609 | + goto err; | |
| 610 | + | |
| 611 | + return rc; | |
| 612 | + | |
| 613 | +err: | |
| 614 | + if (rc == -ECONNREFUSED) | |
| 615 | + auditd_reset(); | |
| 616 | + return rc; | |
| 466 | 617 | } |
| 467 | 618 | |
| 468 | 619 | /** |
| 469 | − * kauditd_send_unicast_skb - Send a record via unicast to auditd | |
| 470 | − * @skb: audit record | |
| 620 | + * kauditd_send_queue - Helper for kauditd_thread to flush skb queues | |
| 621 | + * @sk: the sending sock | |
| 622 | + * @portid: the netlink destination | |
| 623 | + * @queue: the skb queue to process | |
| 624 | + * @retry_limit: limit on number of netlink unicast failures | |
| 625 | + * @skb_hook: per-skb hook for additional processing | |
| 626 | + * @err_hook: hook called if the skb fails the netlink unicast send | |
| 627 | + * | |
| 628 | + * Description: | |
| 629 | + * Run through the given queue and attempt to send the audit records to auditd, | |
| 630 | + * returns zero on success, negative values on failure. It is up to the caller | |
| 631 | + * to ensure that the @sk is valid for the duration of this function. | |
| 632 | + * | |
| 471 | 633 | */ |
| 472 | −static int kauditd_send_unicast_skb(struct sk_buff *skb) | |
| 634 | +static int kauditd_send_queue(struct sock *sk, u32 portid, | |
| 635 | + struct sk_buff_head *queue, | |
| 636 | + unsigned int retry_limit, | |
| 637 | + void (*skb_hook)(struct sk_buff *skb), | |
| 638 | + void (*err_hook)(struct sk_buff *skb)) | |
| 473 | 639 | { |
| 474 | − int rc; | |
| 640 | + int rc = 0; | |
| 641 | + struct sk_buff *skb; | |
| 642 | + static unsigned int failed = 0; | |
| 475 | 643 | |
| 476 | − /* if we know nothing is connected, don't even try the netlink call */ | |
| 477 | − if (!audit_pid) | |
| 478 | − return -ECONNREFUSED; | |
| 644 | + /* NOTE: kauditd_thread takes care of all our locking, we just use | |
| 645 | + * the netlink info passed to us (e.g. sk and portid) */ | |
| 646 | + | |
| 647 | + while ((skb = skb_dequeue(queue))) { | |
| 648 | + /* call the skb_hook for each skb we touch */ | |
| 649 | + if (skb_hook) | |
| 650 | + (*skb_hook)(skb); | |
| 651 | + | |
| 652 | + /* can we send to anyone via unicast? */ | |
| 653 | + if (!sk) { | |
| 654 | + if (err_hook) | |
| 655 | + (*err_hook)(skb); | |
| 656 | + continue; | |
| 657 | + } | |
| 479 | 658 | |
| 480 | − /* get an extra skb reference in case we fail to send */ | |
| 481 | − skb_get(skb); | |
| 482 | − rc = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0); | |
| 483 | − if (rc >= 0) { | |
| 484 | − consume_skb(skb); | |
| 485 | − rc = 0; | |
| 659 | + /* grab an extra skb reference in case of error */ | |
| 660 | + skb_get(skb); | |
| 661 | + rc = netlink_unicast(sk, skb, portid, 0); | |
| 662 | + if (rc < 0) { | |
| 663 | + /* fatal failure for our queue flush attempt? */ | |
| 664 | + if (++failed >= retry_limit || | |
| 665 | + rc == -ECONNREFUSED || rc == -EPERM) { | |
| 666 | + /* yes - error processing for the queue */ | |
| 667 | + sk = NULL; | |
| 668 | + if (err_hook) | |
| 669 | + (*err_hook)(skb); | |
| 670 | + if (!skb_hook) | |
| 671 | + goto out; | |
| 672 | + /* keep processing with the skb_hook */ | |
| 673 | + continue; | |
| 674 | + } else | |
| 675 | + /* no - requeue to preserve ordering */ | |
| 676 | + skb_queue_head(queue, skb); | |
| 677 | + } else { | |
| 678 | + /* it worked - drop the extra reference and continue */ | |
| 679 | + consume_skb(skb); | |
| 680 | + failed = 0; | |
| 681 | + } | |
| 486 | 682 | } |
| 487 | 683 | |
| 488 | − return rc; | |
| 684 | +out: | |
| 685 | + return (rc >= 0 ? 0 : rc); | |
| 489 | 686 | } |
| 490 | 687 | |
| 491 | 688 | /* |
| @@ -493,16 +690,19 @@ static int kauditd_send_unicast_skb(struct sk_buff *skb) · 1 unmodified line | ||
| 493 | 690 | * @skb: audit record |
| 494 | 691 | * |
| 495 | 692 | * Description: |
| 496 | − * This function doesn't consume an skb as might be expected since it has to | |
| 497 | − * copy it anyways. | |
| 693 | + * Write a multicast message to anyone listening in the initial network | |
| 694 | + * namespace. This function doesn't consume an skb as might be expected since | |
| 695 | + * it has to copy it anyways. | |
| 498 | 696 | */ |
| 499 | 697 | static void kauditd_send_multicast_skb(struct sk_buff *skb) |
| 500 | 698 | { |
| 501 | 699 | struct sk_buff *copy; |
| 502 | − struct audit_net *aunet = net_generic(&init_net, audit_net_id); | |
| 503 | − struct sock *sock = aunet->nlsk; | |
| 700 | + struct sock *sock = audit_get_sk(&init_net); | |
| 504 | 701 | struct nlmsghdr *nlh; |
| 505 | 702 | |
| 703 | + /* NOTE: we are not taking an additional reference for init_net since | |
| 704 | + * we don't have to worry about it going away */ | |
| 705 | + | |
| 506 | 706 | if (!netlink_has_listeners(sock, AUDIT_NLGRP_READLOG)) |
| 507 | 707 | return; |
| 508 | 708 | |
| @@ -526,149 +726,75 @@ static void kauditd_send_multicast_skb(struct sk_buff *skb) · 17 unmodified lines | ||
| 526 | 726 | } |
| 527 | 727 | |
| 528 | 728 | /** |
| 529 | − * kauditd_wake_condition - Return true when it is time to wake kauditd_thread | |
| 530 | − * | |
| 531 | − * Description: | |
| 532 | − * This function is for use by the wait_event_freezable() call in | |
| 533 | − * kauditd_thread(). | |
| 729 | + * kauditd_thread - Worker thread to send audit records to userspace | |
| 730 | + * @dummy: unused | |
| 534 | 731 | */ |
| 535 | −static int kauditd_wake_condition(void) | |
| 536 | −{ | |
| 537 | − static int pid_last = 0; | |
| 538 | − int rc; | |
| 539 | − int pid = audit_pid; | |
| 540 | − | |
| 541 | − /* wake on new messages or a change in the connected auditd */ | |
| 542 | − rc = skb_queue_len(&audit_queue) || (pid && pid != pid_last); | |
| 543 | − if (rc) | |
| 544 | − pid_last = pid; | |
| 545 | − | |
| 546 | − return rc; | |
| 547 | −} | |
| 548 | − | |
| 549 | 732 | static int kauditd_thread(void *dummy) |
| 550 | 733 | { |
| 551 | 734 | int rc; |
| 552 | − int auditd = 0; | |
| 553 | − int reschedule = 0; | |
| 554 | − struct sk_buff *skb; | |
| 555 | − struct nlmsghdr *nlh; | |
| 735 | + u32 portid = 0; | |
| 736 | + struct net *net = NULL; | |
| 737 | + struct sock *sk = NULL; | |
| 556 | 738 | |
| 557 | 739 | #define UNICAST_RETRIES 5 |
| 558 | −#define AUDITD_BAD(x,y) \ | |
| 559 | − ((x) == -ECONNREFUSED || (x) == -EPERM || ++(y) >= UNICAST_RETRIES) | |
| 560 | − | |
| 561 | − /* NOTE: we do invalidate the auditd connection flag on any sending | |
| 562 | − * errors, but we only "restore" the connection flag at specific places | |
| 563 | − * in the loop in order to help ensure proper ordering of audit | |
| 564 | − * records */ | |
| 565 | 740 | |
| 566 | 741 | set_freezable(); |
| 567 | 742 | while (!kthread_should_stop()) { |
| 568 | − /* NOTE: possible area for future improvement is to look at | |
| 569 | − * the hold and retry queues, since only this thread | |
| 570 | − * has access to these queues we might be able to do | |
| 571 | − * our own queuing and skip some/all of the locking */ | |
| 572 | − | |
| 573 | − /* NOTE: it might be a fun experiment to split the hold and | |
| 574 | − * retry queue handling to another thread, but the | |
| 575 | − * synchronization issues and other overhead might kill | |
| 576 | − * any performance gains */ | |
| 743 | + /* NOTE: see the lock comments in auditd_send_unicast_skb() */ | |
| 744 | + rcu_read_lock(); | |
| 745 | + if (!auditd_conn.pid) { | |
| 746 | + rcu_read_unlock(); | |
| 747 | + goto main_queue; | |
| 748 | + } | |
| 749 | + net = auditd_conn.net; | |
| 750 | + get_net(net); | |
| 751 | + sk = audit_get_sk(net); | |
| 752 | + portid = auditd_conn.portid; | |
| 753 | + rcu_read_unlock(); | |
| 577 | 754 | |
| 578 | 755 | /* attempt to flush the hold queue */ |
| 579 | − while (auditd && (skb = skb_dequeue(&audit_hold_queue))) { | |
| 580 | − rc = kauditd_send_unicast_skb(skb); | |
| 581 | − if (rc) { | |
| 582 | − /* requeue to the same spot */ | |
| 583 | − skb_queue_head(&audit_hold_queue, skb); | |
| 584 | − | |
| 585 | − auditd = 0; | |
| 586 | − if (AUDITD_BAD(rc, reschedule)) { | |
| 587 | − mutex_lock(&audit_cmd_mutex); | |
| 588 | − auditd_reset(); | |
| 589 | − mutex_unlock(&audit_cmd_mutex); | |
| 590 | − reschedule = 0; | |
| 591 | − } | |
| 592 | − } else | |
| 593 | − /* we were able to send successfully */ | |
| 594 | − reschedule = 0; | |
| 756 | + rc = kauditd_send_queue(sk, portid, | |
| 757 | + &audit_hold_queue, UNICAST_RETRIES, | |
| 758 | + NULL, kauditd_rehold_skb); | |
| 759 | + if (rc < 0) { | |
| 760 | + sk = NULL; | |
| 761 | + goto main_queue; | |
| 595 | 762 | } |
| 596 | 763 | |
| 597 | 764 | /* attempt to flush the retry queue */ |
| 598 | − while (auditd && (skb = skb_dequeue(&audit_retry_queue))) { | |
| 599 | − rc = kauditd_send_unicast_skb(skb); | |
| 600 | − if (rc) { | |
| 601 | − auditd = 0; | |
| 602 | − if (AUDITD_BAD(rc, reschedule)) { | |
| 603 | − kauditd_hold_skb(skb); | |
| 604 | − mutex_lock(&audit_cmd_mutex); | |
| 605 | − auditd_reset(); | |
| 606 | − mutex_unlock(&audit_cmd_mutex); | |
| 607 | − reschedule = 0; | |
| 608 | − } else | |
| 609 | − /* temporary problem (we hope), queue | |
| 610 | − * to the same spot and retry */ | |
| 611 | − skb_queue_head(&audit_retry_queue, skb); | |
| 612 | − } else | |
| 613 | − /* we were able to send successfully */ | |
| 614 | − reschedule = 0; | |
| 765 | + rc = kauditd_send_queue(sk, portid, | |
| 766 | + &audit_retry_queue, UNICAST_RETRIES, | |
| 767 | + NULL, kauditd_hold_skb); | |
| 768 | + if (rc < 0) { | |
| 769 | + sk = NULL; | |
| 770 | + goto main_queue; | |
| 615 | 771 | } |
| 616 | 772 | |
| 617 | − /* standard queue processing, try to be as quick as possible */ | |
| 618 | −quick_loop: | |
| 619 | − skb = skb_dequeue(&audit_queue); | |
| 620 | − if (skb) { | |
| 621 | − /* setup the netlink header, see the comments in | |
| 622 | − * kauditd_send_multicast_skb() for length quirks */ | |
| 623 | − nlh = nlmsg_hdr(skb); | |
| 624 | − nlh->nlmsg_len = skb->len - NLMSG_HDRLEN; | |
| 625 | − | |
| 626 | − /* attempt to send to any multicast listeners */ | |
| 627 | − kauditd_send_multicast_skb(skb); | |
| 628 | − | |
| 629 | − /* attempt to send to auditd, queue on failure */ | |
| 630 | − if (auditd) { | |
| 631 | − rc = kauditd_send_unicast_skb(skb); | |
| 632 | − if (rc) { | |
| 633 | − auditd = 0; | |
| 634 | − if (AUDITD_BAD(rc, reschedule)) { | |
| 635 | − mutex_lock(&audit_cmd_mutex); | |
| 636 | − auditd_reset(); | |
| 637 | − mutex_unlock(&audit_cmd_mutex); | |
| 638 | − reschedule = 0; | |
| 639 | − } | |
| 640 | − | |
| 641 | − /* move to the retry queue */ | |
| 642 | − kauditd_retry_skb(skb); | |
| 643 | − } else | |
| 644 | − /* everything is working so go fast! */ | |
| 645 | − goto quick_loop; | |
| 646 | − } else if (reschedule) | |
| 647 | − /* we are currently having problems, move to | |
| 648 | − * the retry queue */ | |
| 649 | − kauditd_retry_skb(skb); | |
| 650 | − else | |
| 651 | − /* dump the message via printk and hold it */ | |
| 652 | − kauditd_hold_skb(skb); | |
| 653 | − } else { | |
| 654 | − /* we have flushed the backlog so wake everyone */ | |
| 655 | − wake_up(&audit_backlog_wait); | |
| 656 | − | |
| 657 | − /* if everything is okay with auditd (if present), go | |
| 658 | − * to sleep until there is something new in the queue | |
| 659 | − * or we have a change in the connected auditd; | |
| 660 | − * otherwise simply reschedule to give things a chance | |
| 661 | − * to recover */ | |
| 662 | − if (reschedule) { | |
| 663 | − set_current_state(TASK_INTERRUPTIBLE); | |
| 664 | − schedule(); | |
| 665 | − } else | |
| 666 | − wait_event_freezable(kauditd_wait, | |
| 667 | − kauditd_wake_condition()); | |
| 668 | − | |
| 669 | − /* update the auditd connection status */ | |
| 670 | − auditd = (audit_pid ? 1 : 0); | |
| 773 | +main_queue: | |
| 774 | + /* process the main queue - do the multicast send and attempt | |
| 775 | + * unicast, dump failed record sends to the retry queue; if | |
| 776 | + * sk == NULL due to previous failures we will just do the | |
| 777 | + * multicast send and move the record to the retry queue */ | |
| 778 | + kauditd_send_queue(sk, portid, &audit_queue, 1, | |
| 779 | + kauditd_send_multicast_skb, | |
| 780 | + kauditd_retry_skb); | |
| 781 | + | |
| 782 | + /* drop our netns reference, no auditd sends past this line */ | |
| 783 | + if (net) { | |
| 784 | + put_net(net); | |
| 785 | + net = NULL; | |
| 671 | 786 | } |
| 787 | + sk = NULL; | |
| 788 | + | |
| 789 | + /* we have processed all the queues so wake everyone */ | |
| 790 | + wake_up(&audit_backlog_wait); | |
| 791 | + | |
| 792 | + /* NOTE: we want to wake up if there is anything on the queue, | |
| 793 | + * regardless of if an auditd is connected, as we need to | |
| 794 | + * do the multicast send and rotate records from the | |
| 795 | + * main queue to the retry/hold queues */ | |
| 796 | + wait_event_freezable(kauditd_wait, | |
| 797 | + (skb_queue_len(&audit_queue) ? 1 : 0)); | |
| 672 | 798 | } |
| 673 | 799 | |
| 674 | 800 | return 0; |
| @@ -678,17 +804,16 @@ int audit_send_list(void *_dest) · 3 unmodified lines | ||
| 678 | 804 | { |
| 679 | 805 | struct audit_netlink_list *dest = _dest; |
| 680 | 806 | struct sk_buff *skb; |
| 681 | − struct net *net = dest->net; | |
| 682 | − struct audit_net *aunet = net_generic(net, audit_net_id); | |
| 807 | + struct sock *sk = audit_get_sk(dest->net); | |
| 683 | 808 | |
| 684 | 809 | /* wait for parent to finish and send an ACK */ |
| 685 | 810 | mutex_lock(&audit_cmd_mutex); |
| 686 | 811 | mutex_unlock(&audit_cmd_mutex); |
| 687 | 812 | |
| 688 | 813 | while ((skb = __skb_dequeue(&dest->q)) != NULL) |
| 689 | − netlink_unicast(aunet->nlsk, skb, dest->portid, 0); | |
| 814 | + netlink_unicast(sk, skb, dest->portid, 0); | |
| 690 | 815 | |
| 691 | − put_net(net); | |
| 816 | + put_net(dest->net); | |
| 692 | 817 | kfree(dest); |
| 693 | 818 | |
| 694 | 819 | return 0; |
| @@ -722,16 +847,15 @@ out_kfree_skb: · 27 unmodified lines | ||
| 722 | 847 | static int audit_send_reply_thread(void *arg) |
| 723 | 848 | { |
| 724 | 849 | struct audit_reply *reply = (struct audit_reply *)arg; |
| 725 | − struct net *net = reply->net; | |
| 726 | − struct audit_net *aunet = net_generic(net, audit_net_id); | |
| 850 | + struct sock *sk = audit_get_sk(reply->net); | |
| 727 | 851 | |
| 728 | 852 | mutex_lock(&audit_cmd_mutex); |
| 729 | 853 | mutex_unlock(&audit_cmd_mutex); |
| 730 | 854 | |
| 731 | 855 | /* Ignore failure. It'll only happen if the sender goes away, |
| 732 | 856 | because our timeout is set to infinite. */ |
| 733 | − netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0); | |
| 734 | − put_net(net); | |
| 857 | + netlink_unicast(sk, reply->skb, reply->portid, 0); | |
| 858 | + put_net(reply->net); | |
| 735 | 859 | kfree(reply); |
| 736 | 860 | return 0; |
| 737 | 861 | } |
| @@ -949,12 +1073,12 @@ static int audit_set_feature(struct sk_buff *skb) · 211 unmodified lines | ||
| 949 | 1073 | |
| 950 | 1074 | static int audit_replace(pid_t pid) |
| 951 | 1075 | { |
| 952 | − struct sk_buff *skb = audit_make_reply(0, 0, AUDIT_REPLACE, 0, 0, | |
| 953 | − &pid, sizeof(pid)); | |
| 1076 | + struct sk_buff *skb; | |
| 954 | 1077 | |
| 1078 | + skb = audit_make_reply(0, 0, AUDIT_REPLACE, 0, 0, &pid, sizeof(pid)); | |
| 955 | 1079 | if (!skb) |
| 956 | 1080 | return -ENOMEM; |
| 957 | − return netlink_unicast(audit_sock, skb, audit_nlk_portid, 0); | |
| 1081 | + return auditd_send_unicast_skb(skb); | |
| 958 | 1082 | } |
| 959 | 1083 | |
| 960 | 1084 | static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
| @@ -981,7 +1105,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 20 unmodified lines | ||
| 981 | 1105 | memset(&s, 0, sizeof(s)); |
| 982 | 1106 | s.enabled = audit_enabled; |
| 983 | 1107 | s.failure = audit_failure; |
| 984 | − s.pid = audit_pid; | |
| 1108 | + rcu_read_lock(); | |
| 1109 | + s.pid = auditd_conn.pid; | |
| 1110 | + rcu_read_unlock(); | |
| 985 | 1111 | s.rate_limit = audit_rate_limit; |
| 986 | 1112 | s.backlog_limit = audit_backlog_limit; |
| 987 | 1113 | s.lost = atomic_read(&audit_lost); |
| @@ -1014,30 +1140,44 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 26 unmodified lines | ||
| 1014 | 1140 | * from the initial pid namespace, but something |
| 1015 | 1141 | * to keep in mind if this changes */ |
| 1016 | 1142 | int new_pid = s.pid; |
| 1143 | + pid_t auditd_pid; | |
| 1017 | 1144 | pid_t requesting_pid = task_tgid_vnr(current); |
| 1018 | 1145 | |
| 1019 | − if ((!new_pid) && (requesting_pid != audit_pid)) { | |
| 1020 | − audit_log_config_change("audit_pid", new_pid, audit_pid, 0); | |
| 1146 | + /* test the auditd connection */ | |
| 1147 | + audit_replace(requesting_pid); | |
| 1148 | + | |
| 1149 | + rcu_read_lock(); | |
| 1150 | + auditd_pid = auditd_conn.pid; | |
| 1151 | + /* only the current auditd can unregister itself */ | |
| 1152 | + if ((!new_pid) && (requesting_pid != auditd_pid)) { | |
| 1153 | + rcu_read_unlock(); | |
| 1154 | + audit_log_config_change("audit_pid", new_pid, | |
| 1155 | + auditd_pid, 0); | |
| 1021 | 1156 | return -EACCES; |
| 1022 | 1157 | } |
| 1023 | − if (audit_pid && new_pid && | |
| 1024 | − audit_replace(requesting_pid) != -ECONNREFUSED) { | |
| 1025 | − audit_log_config_change("audit_pid", new_pid, audit_pid, 0); | |
| 1158 | + /* replacing a healthy auditd is not allowed */ | |
| 1159 | + if (auditd_pid && new_pid) { | |
| 1160 | + rcu_read_unlock(); | |
| 1161 | + audit_log_config_change("audit_pid", new_pid, | |
| 1162 | + auditd_pid, 0); | |
| 1026 | 1163 | return -EEXIST; |
| 1027 | 1164 | } |
| 1165 | + rcu_read_unlock(); | |
| 1166 | + | |
| 1028 | 1167 | if (audit_enabled != AUDIT_OFF) |
| 1029 | − audit_log_config_change("audit_pid", new_pid, audit_pid, 1); | |
| 1168 | + audit_log_config_change("audit_pid", new_pid, | |
| 1169 | + auditd_pid, 1); | |
| 1170 | + | |
| 1030 | 1171 | if (new_pid) { |
| 1031 | − if (audit_sock) | |
| 1032 | − sock_put(audit_sock); | |
| 1033 | − audit_pid = new_pid; | |
| 1034 | − audit_nlk_portid = NETLINK_CB(skb).portid; | |
| 1035 | − sock_hold(skb->sk); | |
| 1036 | − audit_sock = skb->sk; | |
| 1037 | − } else { | |
| 1172 | + /* register a new auditd connection */ | |
| 1173 | + auditd_set(new_pid, | |
| 1174 | + NETLINK_CB(skb).portid, | |
| 1175 | + sock_net(NETLINK_CB(skb).sk)); | |
| 1176 | + /* try to process any backlog */ | |
| 1177 | + wake_up_interruptible(&kauditd_wait); | |
| 1178 | + } else | |
| 1179 | + /* unregister the auditd connection */ | |
| 1038 | 1180 | auditd_reset(); |
| 1039 | − } | |
| 1040 | − wake_up_interruptible(&kauditd_wait); | |
| 1041 | 1181 | } |
| 1042 | 1182 | if (s.mask & AUDIT_STATUS_RATE_LIMIT) { |
| 1043 | 1183 | err = audit_set_rate_limit(s.rate_limit); |
| @@ -1090,7 +1230,6 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 46 unmodified lines | ||
| 1090 | 1230 | if (err) |
| 1091 | 1231 | break; |
| 1092 | 1232 | } |
| 1093 | − mutex_unlock(&audit_cmd_mutex); | |
| 1094 | 1233 | audit_log_common_recv_msg(&ab, msg_type); |
| 1095 | 1234 | if (msg_type != AUDIT_USER_TTY) |
| 1096 | 1235 | audit_log_format(ab, " msg='%.*s'", |
| @@ -1108,7 +1247,6 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) · 11 unmodified lines | ||
| 1108 | 1247 | } |
| 1109 | 1248 | audit_set_portid(ab, NETLINK_CB(skb).portid); |
| 1110 | 1249 | audit_log_end(ab); |
| 1111 | − mutex_lock(&audit_cmd_mutex); | |
| 1112 | 1250 | } |
| 1113 | 1251 | break; |
| 1114 | 1252 | case AUDIT_ADD_RULE: |
| @@ -1298,26 +1436,26 @@ static int __net_init audit_net_init(struct net *net) · 183 unmodified lines | ||
| 1298 | 1436 | |
| 1299 | 1437 | struct audit_net *aunet = net_generic(net, audit_net_id); |
| 1300 | 1438 | |
| 1301 | − aunet->nlsk = netlink_kernel_create(net, NETLINK_AUDIT, &cfg); | |
| 1302 | − if (aunet->nlsk == NULL) { | |
| 1439 | + aunet->sk = netlink_kernel_create(net, NETLINK_AUDIT, &cfg); | |
| 1440 | + if (aunet->sk == NULL) { | |
| 1303 | 1441 | audit_panic("cannot initialize netlink socket in namespace"); |
| 1304 | 1442 | return -ENOMEM; |
| 1305 | 1443 | } |
| 1306 | − aunet->nlsk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT; | |
| 1444 | + aunet->sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT; | |
| 1445 | + | |
| 1307 | 1446 | return 0; |
| 1308 | 1447 | } |
| 1309 | 1448 | |
| 1310 | 1449 | static void __net_exit audit_net_exit(struct net *net) |
| 1311 | 1450 | { |
| 1312 | 1451 | struct audit_net *aunet = net_generic(net, audit_net_id); |
| 1313 | − struct sock *sock = aunet->nlsk; | |
| 1314 | − mutex_lock(&audit_cmd_mutex); | |
| 1315 | − if (sock == audit_sock) | |
| 1452 | + | |
| 1453 | + rcu_read_lock(); | |
| 1454 | + if (net == auditd_conn.net) | |
| 1316 | 1455 | auditd_reset(); |
| 1317 | − mutex_unlock(&audit_cmd_mutex); | |
| 1456 | + rcu_read_unlock(); | |
| 1318 | 1457 | |
| 1319 | − netlink_kernel_release(sock); | |
| 1320 | − aunet->nlsk = NULL; | |
| 1458 | + netlink_kernel_release(aunet->sk); | |
| 1321 | 1459 | } |
| 1322 | 1460 | |
| 1323 | 1461 | static struct pernet_operations audit_net_ops __net_initdata = { |
| @@ -1335,20 +1473,24 @@ static int __init audit_init(void) · 11 unmodified lines | ||
| 1335 | 1473 | if (audit_initialized == AUDIT_DISABLED) |
| 1336 | 1474 | return 0; |
| 1337 | 1475 | |
| 1338 | − pr_info("initializing netlink subsys (%s)\n", | |
| 1339 | − audit_default ? "enabled" : "disabled"); | |
| 1340 | − register_pernet_subsys(&audit_net_ops); | |
| 1476 | + memset(&auditd_conn, 0, sizeof(auditd_conn)); | |
| 1477 | + spin_lock_init(&auditd_conn.lock); | |
| 1341 | 1478 | |
| 1342 | 1479 | skb_queue_head_init(&audit_queue); |
| 1343 | 1480 | skb_queue_head_init(&audit_retry_queue); |
| 1344 | 1481 | skb_queue_head_init(&audit_hold_queue); |
| 1345 | − audit_initialized = AUDIT_INITIALIZED; | |
| 1346 | − audit_enabled = audit_default; | |
| 1347 | − audit_ever_enabled |= !!audit_default; | |
| 1348 | 1482 | |
| 1349 | 1483 | for (i = 0; i < AUDIT_INODE_BUCKETS; i++) |
| 1350 | 1484 | INIT_LIST_HEAD(&audit_inode_hash[i]); |
| 1351 | 1485 | |
| 1486 | + pr_info("initializing netlink subsys (%s)\n", | |
| 1487 | + audit_default ? "enabled" : "disabled"); | |
| 1488 | + register_pernet_subsys(&audit_net_ops); | |
| 1489 | + | |
| 1490 | + audit_initialized = AUDIT_INITIALIZED; | |
| 1491 | + audit_enabled = audit_default; | |
| 1492 | + audit_ever_enabled |= !!audit_default; | |
| 1493 | + | |
| 1352 | 1494 | kauditd_task = kthread_run(kauditd_thread, NULL, "kauditd"); |
| 1353 | 1495 | if (IS_ERR(kauditd_task)) { |
| 1354 | 1496 | int err = PTR_ERR(kauditd_task); |
| @@ -1519,20 +1661,16 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, · 164 unmodified lines | ||
| 1519 | 1661 | if (unlikely(!audit_filter(type, AUDIT_FILTER_TYPE))) |
| 1520 | 1662 | return NULL; |
| 1521 | 1663 | |
| 1522 | − /* don't ever fail/sleep on these two conditions: | |
| 1664 | + /* NOTE: don't ever fail/sleep on these two conditions: | |
| 1523 | 1665 | * 1. auditd generated record - since we need auditd to drain the |
| 1524 | 1666 | * queue; also, when we are checking for auditd, compare PIDs using |
| 1525 | 1667 | * task_tgid_vnr() since auditd_pid is set in audit_receive_msg() |
| 1526 | 1668 | * using a PID anchored in the caller's namespace |
| 1527 | − * 2. audit command message - record types 1000 through 1099 inclusive | |
| 1528 | − * are command messages/records used to manage the kernel subsystem | |
| 1529 | − * and the audit userspace, blocking on these messages could cause | |
| 1530 | − * problems under load so don't do it (note: not all of these | |
| 1531 | − * command types are valid as record types, but it is quicker to | |
| 1532 | − * just check two ints than a series of ints in a if/switch stmt) */ | |
| 1533 | − if (!((audit_pid && audit_pid == task_tgid_vnr(current)) || | |
| 1534 | − (type >= 1000 && type <= 1099))) { | |
| 1535 | − long sleep_time = audit_backlog_wait_time; | |
| 1669 | + * 2. generator holding the audit_cmd_mutex - we don't want to block | |
| 1670 | + * while holding the mutex */ | |
| 1671 | + if (!(auditd_test_task(current) || | |
| 1672 | + (current == __mutex_owner(&audit_cmd_mutex)))) { | |
| 1673 | + long stime = audit_backlog_wait_time; | |
| 1536 | 1674 | |
| 1537 | 1675 | while (audit_backlog_limit && |
| 1538 | 1676 | (skb_queue_len(&audit_queue) > audit_backlog_limit)) { |
| @@ -1541,14 +1679,13 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, · 2 unmodified lines | ||
| 1541 | 1679 | |
| 1542 | 1680 | /* sleep if we are allowed and we haven't exhausted our |
| 1543 | 1681 | * backlog wait limit */ |
| 1544 | − if ((gfp_mask & __GFP_DIRECT_RECLAIM) && | |
| 1545 | − (sleep_time > 0)) { | |
| 1682 | + if (gfpflags_allow_blocking(gfp_mask) && (stime > 0)) { | |
| 1546 | 1683 | DECLARE_WAITQUEUE(wait, current); |
| 1547 | 1684 | |
| 1548 | 1685 | add_wait_queue_exclusive(&audit_backlog_wait, |
| 1549 | 1686 | &wait); |
| 1550 | 1687 | set_current_state(TASK_UNINTERRUPTIBLE); |
| 1551 | − sleep_time = schedule_timeout(sleep_time); | |
| 1688 | + stime = schedule_timeout(stime); | |
| 1552 | 1689 | remove_wait_queue(&audit_backlog_wait, &wait); |
| 1553 | 1690 | } else { |
| 1554 | 1691 | if (audit_rate_check() && printk_ratelimit()) |
| @@ -2127,15 +2264,27 @@ out: · 572 unmodified lines | ||
| 2127 | 2264 | */ |
| 2128 | 2265 | void audit_log_end(struct audit_buffer *ab) |
| 2129 | 2266 | { |
| 2267 | + struct sk_buff *skb; | |
| 2268 | + struct nlmsghdr *nlh; | |
| 2269 | + | |
| 2130 | 2270 | if (!ab) |
| 2131 | 2271 | return; |
| 2132 | − if (!audit_rate_check()) { | |
| 2133 | − audit_log_lost("rate limit exceeded"); | |
| 2134 | − } else { | |
| 2135 | − skb_queue_tail(&audit_queue, ab->skb); | |
| 2136 | − wake_up_interruptible(&kauditd_wait); | |
| 2272 | + | |
| 2273 | + if (audit_rate_check()) { | |
| 2274 | + skb = ab->skb; | |
| 2137 | 2275 | ab->skb = NULL; |
| 2138 | − } | |
| 2276 | + | |
| 2277 | + /* setup the netlink header, see the comments in | |
| 2278 | + * kauditd_send_multicast_skb() for length quirks */ | |
| 2279 | + nlh = nlmsg_hdr(skb); | |
| 2280 | + nlh->nlmsg_len = skb->len - NLMSG_HDRLEN; | |
| 2281 | + | |
| 2282 | + /* queue the netlink packet and poke the kauditd thread */ | |
| 2283 | + skb_queue_tail(&audit_queue, skb); | |
| 2284 | + wake_up_interruptible(&kauditd_wait); | |
| 2285 | + } else | |
| 2286 | + audit_log_lost("rate limit exceeded"); | |
| 2287 | + | |
| 2139 | 2288 | audit_buffer_free(ab); |
| 2140 | 2289 | } |
| 2141 | 2290 | |
| @@ -218,7 +218,7 @@ extern void audit_log_name(struct audit_context *context, · 217 unmodified lines | ||
| 218 | 218 | struct audit_names *n, const struct path *path, |
| 219 | 219 | int record_num, int *call_panic); |
| 220 | 220 | |
| 221 | −extern int audit_pid; | |
| 221 | +extern int auditd_test_task(const struct task_struct *task); | |
| 222 | 222 | |
| 223 | 223 | #define AUDIT_INODE_BUCKETS 32 |
| 224 | 224 | extern struct list_head audit_inode_hash[AUDIT_INODE_BUCKETS]; |
| @@ -250,10 +250,6 @@ struct audit_netlink_list { · 25 unmodified lines | ||
| 250 | 250 | |
| 251 | 251 | int audit_send_list(void *); |
| 252 | 252 | |
| 253 | −struct audit_net { | |
| 254 | − struct sock *nlsk; | |
| 255 | −}; | |
| 256 | − | |
| 257 | 253 | extern int selinux_audit_rule_update(void); |
| 258 | 254 | |
| 259 | 255 | extern struct mutex audit_filter_mutex; |
| @@ -340,8 +336,7 @@ extern int audit_filter(int msgtype, unsigned int listtype); · 80 unmodified lines | ||
| 340 | 336 | extern int __audit_signal_info(int sig, struct task_struct *t); |
| 341 | 337 | static inline int audit_signal_info(int sig, struct task_struct *t) |
| 342 | 338 | { |
| 343 | − if (unlikely((audit_pid && t->tgid == audit_pid) || | |
| 344 | − (audit_signals && !audit_dummy_context()))) | |
| 339 | + if (auditd_test_task(t) || (audit_signals && !audit_dummy_context())) | |
| 345 | 340 | return __audit_signal_info(sig, t); |
| 346 | 341 | return 0; |
| 347 | 342 | } |
| @@ -762,7 +762,7 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk, · 761 unmodified lines | ||
| 762 | 762 | struct audit_entry *e; |
| 763 | 763 | enum audit_state state; |
| 764 | 764 | |
| 765 | − if (audit_pid && tsk->tgid == audit_pid) | |
| 765 | + if (auditd_test_task(tsk)) | |
| 766 | 766 | return AUDIT_DISABLED; |
| 767 | 767 | |
| 768 | 768 | rcu_read_lock(); |
| @@ -816,7 +816,7 @@ void audit_filter_inodes(struct task_struct *tsk, struct audit_context *ctx) · 47 unmodified lines | ||
| 816 | 816 | { |
| 817 | 817 | struct audit_names *n; |
| 818 | 818 | |
| 819 | − if (audit_pid && tsk->tgid == audit_pid) | |
| 819 | + if (auditd_test_task(tsk)) | |
| 820 | 820 | return; |
| 821 | 821 | |
| 822 | 822 | rcu_read_lock(); |
| @@ -2256,7 +2256,7 @@ int __audit_signal_info(int sig, struct task_struct *t) · 1433 unmodified lines | ||
| 2256 | 2256 | struct audit_context *ctx = tsk->audit_context; |
| 2257 | 2257 | kuid_t uid = current_uid(), t_uid = task_uid(t); |
| 2258 | 2258 | |
| 2259 | − if (audit_pid && t->tgid == audit_pid) { | |
| 2259 | + if (auditd_test_task(t)) { | |
| 2260 | 2260 | if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1 || sig == SIGUSR2) { |
| 2261 | 2261 | audit_sig_pid = task_tgid_nr(tsk); |
| 2262 | 2262 | if (uid_valid(tsk->loginuid)) |
| @@ -30,18 +30,12 @@ struct bpf_htab { · 29 unmodified lines | ||
| 30 | 30 | struct pcpu_freelist freelist; |
| 31 | 31 | struct bpf_lru lru; |
| 32 | 32 | }; |
| 33 | − void __percpu *extra_elems; | |
| 33 | + struct htab_elem *__percpu *extra_elems; | |
| 34 | 34 | atomic_t count; /* number of elements in this hashtable */ |
| 35 | 35 | u32 n_buckets; /* number of hash buckets */ |
| 36 | 36 | u32 elem_size; /* size of each element in bytes */ |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | −enum extra_elem_state { | |
| 40 | − HTAB_NOT_AN_EXTRA_ELEM = 0, | |
| 41 | − HTAB_EXTRA_ELEM_FREE, | |
| 42 | − HTAB_EXTRA_ELEM_USED | |
| 43 | −}; | |
| 44 | − | |
| 45 | 39 | /* each htab element is struct htab_elem + key + value */ |
| 46 | 40 | struct htab_elem { |
| 47 | 41 | union { |
| @@ -56,7 +50,6 @@ struct htab_elem { · 8 unmodified lines | ||
| 56 | 50 | }; |
| 57 | 51 | union { |
| 58 | 52 | struct rcu_head rcu; |
| 59 | − enum extra_elem_state state; | |
| 60 | 53 | struct bpf_lru_node lru_node; |
| 61 | 54 | }; |
| 62 | 55 | u32 hash; |
| @@ -77,6 +70,11 @@ static bool htab_is_percpu(const struct bpf_htab *htab) · 14 unmodified lines | ||
| 77 | 70 | htab->map.map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH; |
| 78 | 71 | } |
| 79 | 72 | |
| 73 | +static bool htab_is_prealloc(const struct bpf_htab *htab) | |
| 74 | +{ | |
| 75 | + return !(htab->map.map_flags & BPF_F_NO_PREALLOC); | |
| 76 | +} | |
| 77 | + | |
| 80 | 78 | static inline void htab_elem_set_ptr(struct htab_elem *l, u32 key_size, |
| 81 | 79 | void __percpu *pptr) |
| 82 | 80 | { |
| @@ -128,17 +126,20 @@ static struct htab_elem *prealloc_lru_pop(struct bpf_htab *htab, void *key, · 45 unmodified lines | ||
| 128 | 126 | |
| 129 | 127 | static int prealloc_init(struct bpf_htab *htab) |
| 130 | 128 | { |
| 129 | + u32 num_entries = htab->map.max_entries; | |
| 131 | 130 | int err = -ENOMEM, i; |
| 132 | 131 | |
| 133 | − htab->elems = bpf_map_area_alloc(htab->elem_size * | |
| 134 | − htab->map.max_entries); | |
| 132 | + if (!htab_is_percpu(htab) && !htab_is_lru(htab)) | |
| 133 | + num_entries += num_possible_cpus(); | |
| 134 | + | |
| 135 | + htab->elems = bpf_map_area_alloc(htab->elem_size * num_entries); | |
| 135 | 136 | if (!htab->elems) |
| 136 | 137 | return -ENOMEM; |
| 137 | 138 | |
| 138 | 139 | if (!htab_is_percpu(htab)) |
| 139 | 140 | goto skip_percpu_elems; |
| 140 | 141 | |
| 141 | − for (i = 0; i < htab->map.max_entries; i++) { | |
| 142 | + for (i = 0; i < num_entries; i++) { | |
| 142 | 143 | u32 size = round_up(htab->map.value_size, 8); |
| 143 | 144 | void __percpu *pptr; |
| 144 | 145 | |
| @@ -166,11 +167,11 @@ skip_percpu_elems: · 21 unmodified lines | ||
| 166 | 167 | if (htab_is_lru(htab)) |
| 167 | 168 | bpf_lru_populate(&htab->lru, htab->elems, |
| 168 | 169 | offsetof(struct htab_elem, lru_node), |
| 169 | − htab->elem_size, htab->map.max_entries); | |
| 170 | + htab->elem_size, num_entries); | |
| 170 | 171 | else |
| 171 | 172 | pcpu_freelist_populate(&htab->freelist, |
| 172 | 173 | htab->elems + offsetof(struct htab_elem, fnode), |
| 173 | − htab->elem_size, htab->map.max_entries); | |
| 174 | + htab->elem_size, num_entries); | |
| 174 | 175 | |
| 175 | 176 | return 0; |
| 176 | 177 | |
| @@ -191,16 +192,22 @@ static void prealloc_destroy(struct bpf_htab *htab) · 14 unmodified lines | ||
| 191 | 192 | |
| 192 | 193 | static int alloc_extra_elems(struct bpf_htab *htab) |
| 193 | 194 | { |
| 194 | − void __percpu *pptr; | |
| 195 | + struct htab_elem *__percpu *pptr, *l_new; | |
| 196 | + struct pcpu_freelist_node *l; | |
| 195 | 197 | int cpu; |
| 196 | 198 | |
| 197 | − pptr = __alloc_percpu_gfp(htab->elem_size, 8, GFP_USER | __GFP_NOWARN); | |
| 199 | + pptr = __alloc_percpu_gfp(sizeof(struct htab_elem *), 8, | |
| 200 | + GFP_USER | __GFP_NOWARN); | |
| 198 | 201 | if (!pptr) |
| 199 | 202 | return -ENOMEM; |
| 200 | 203 | |
| 201 | 204 | for_each_possible_cpu(cpu) { |
| 202 | − ((struct htab_elem *)per_cpu_ptr(pptr, cpu))->state = | |
| 203 | − HTAB_EXTRA_ELEM_FREE; | |
| 205 | + l = pcpu_freelist_pop(&htab->freelist); | |
| 206 | + /* pop will succeed, since prealloc_init() | |
| 207 | + * preallocated extra num_possible_cpus elements | |
| 208 | + */ | |
| 209 | + l_new = container_of(l, struct htab_elem, fnode); | |
| 210 | + *per_cpu_ptr(pptr, cpu) = l_new; | |
| 204 | 211 | } |
| 205 | 212 | htab->extra_elems = pptr; |
| 206 | 213 | return 0; |
| @@ -342,25 +349,25 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) · 135 unmodified lines | ||
| 342 | 349 | raw_spin_lock_init(&htab->buckets[i].lock); |
| 343 | 350 | } |
| 344 | 351 | |
| 345 | − if (!percpu && !lru) { | |
| 346 | − /* lru itself can remove the least used element, so | |
| 347 | − * there is no need for an extra elem during map_update. | |
| 348 | − */ | |
| 349 | − err = alloc_extra_elems(htab); | |
| 350 | − if (err) | |
| 351 | − goto free_buckets; | |
| 352 | − } | |
| 353 | − | |
| 354 | 352 | if (prealloc) { |
| 355 | 353 | err = prealloc_init(htab); |
| 356 | 354 | if (err) |
| 357 | − goto free_extra_elems; | |
| 355 | + goto free_buckets; | |
| 356 | + | |
| 357 | + if (!percpu && !lru) { | |
| 358 | + /* lru itself can remove the least used element, so | |
| 359 | + * there is no need for an extra elem during map_update. | |
| 360 | + */ | |
| 361 | + err = alloc_extra_elems(htab); | |
| 362 | + if (err) | |
| 363 | + goto free_prealloc; | |
| 364 | + } | |
| 358 | 365 | } |
| 359 | 366 | |
| 360 | 367 | return &htab->map; |
| 361 | 368 | |
| 362 | −free_extra_elems: | |
| 363 | − free_percpu(htab->extra_elems); | |
| 369 | +free_prealloc: | |
| 370 | + prealloc_destroy(htab); | |
| 364 | 371 | free_buckets: |
| 365 | 372 | bpf_map_area_free(htab->buckets); |
| 366 | 373 | free_htab: |
| @@ -575,12 +582,7 @@ static void htab_elem_free_rcu(struct rcu_head *head) · 208 unmodified lines | ||
| 575 | 582 | |
| 576 | 583 | static void free_htab_elem(struct bpf_htab *htab, struct htab_elem *l) |
| 577 | 584 | { |
| 578 | − if (l->state == HTAB_EXTRA_ELEM_USED) { | |
| 579 | − l->state = HTAB_EXTRA_ELEM_FREE; | |
| 580 | − return; | |
| 581 | − } | |
| 582 | − | |
| 583 | − if (!(htab->map.map_flags & BPF_F_NO_PREALLOC)) { | |
| 585 | + if (htab_is_prealloc(htab)) { | |
| 584 | 586 | pcpu_freelist_push(&htab->freelist, &l->fnode); |
| 585 | 587 | } else { |
| 586 | 588 | atomic_dec(&htab->count); |
| @@ -610,47 +612,43 @@ static void pcpu_copy_value(struct bpf_htab *htab, void __percpu *pptr, · 23 unmodified lines | ||
| 610 | 612 | static struct htab_elem *alloc_htab_elem(struct bpf_htab *htab, void *key, |
| 611 | 613 | void *value, u32 key_size, u32 hash, |
| 612 | 614 | bool percpu, bool onallcpus, |
| 613 | − bool old_elem_exists) | |
| 615 | + struct htab_elem *old_elem) | |
| 614 | 616 | { |
| 615 | 617 | u32 size = htab->map.value_size; |
| 616 | − bool prealloc = !(htab->map.map_flags & BPF_F_NO_PREALLOC); | |
| 617 | − struct htab_elem *l_new; | |
| 618 | + bool prealloc = htab_is_prealloc(htab); | |
| 619 | + struct htab_elem *l_new, **pl_new; | |
| 618 | 620 | void __percpu *pptr; |
| 619 | − int err = 0; | |
| 620 | 621 | |
| 621 | 622 | if (prealloc) { |
| 622 | − struct pcpu_freelist_node *l; | |
| 623 | + if (old_elem) { | |
| 624 | + /* if we're updating the existing element, | |
| 625 | + * use per-cpu extra elems to avoid freelist_pop/push | |
| 626 | + */ | |
| 627 | + pl_new = this_cpu_ptr(htab->extra_elems); | |
| 628 | + l_new = *pl_new; | |
| 629 | + *pl_new = old_elem; | |
| 630 | + } else { | |
| 631 | + struct pcpu_freelist_node *l; | |
| 623 | 632 | |
| 624 | − l = pcpu_freelist_pop(&htab->freelist); | |
| 625 | − if (!l) | |
| 626 | − err = -E2BIG; | |
| 627 | − else | |
| 633 | + l = pcpu_freelist_pop(&htab->freelist); | |
| 634 | + if (!l) | |
| 635 | + return ERR_PTR(-E2BIG); | |
| 628 | 636 | l_new = container_of(l, struct htab_elem, fnode); |
| 629 | − } else { | |
| 630 | − if (atomic_inc_return(&htab->count) > htab->map.max_entries) { | |
| 631 | − atomic_dec(&htab->count); | |
| 632 | − err = -E2BIG; | |
| 633 | − } else { | |
| 634 | − l_new = kmalloc(htab->elem_size, | |
| 635 | − GFP_ATOMIC | __GFP_NOWARN); | |
| 636 | − if (!l_new) | |
| 637 | − return ERR_PTR(-ENOMEM); | |
| 638 | 637 | } |
| 639 | − } | |
| 640 | − | |
| 641 | − if (err) { | |
| 642 | − if (!old_elem_exists) | |
| 643 | − return ERR_PTR(err); | |
| 644 | − | |
| 645 | − /* if we're updating the existing element and the hash table | |
| 646 | − * is full, use per-cpu extra elems | |
| 647 | − */ | |
| 648 | − l_new = this_cpu_ptr(htab->extra_elems); | |
| 649 | − if (l_new->state != HTAB_EXTRA_ELEM_FREE) | |
| 650 | − return ERR_PTR(-E2BIG); | |
| 651 | − l_new->state = HTAB_EXTRA_ELEM_USED; | |
| 652 | 638 | } else { |
| 653 | − l_new->state = HTAB_NOT_AN_EXTRA_ELEM; | |
| 639 | + if (atomic_inc_return(&htab->count) > htab->map.max_entries) | |
| 640 | + if (!old_elem) { | |
| 641 | + /* when map is full and update() is replacing | |
| 642 | + * old element, it's ok to allocate, since | |
| 643 | + * old element will be freed immediately. | |
| 644 | + * Otherwise return an error | |
| 645 | + */ | |
| 646 | + atomic_dec(&htab->count); | |
| 647 | + return ERR_PTR(-E2BIG); | |
| 648 | + } | |
| 649 | + l_new = kmalloc(htab->elem_size, GFP_ATOMIC | __GFP_NOWARN); | |
| 650 | + if (!l_new) | |
| 651 | + return ERR_PTR(-ENOMEM); | |
| 654 | 652 | } |
| 655 | 653 | |
| 656 | 654 | memcpy(l_new->key, key, key_size); |
| @@ -731,7 +729,7 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, · 74 unmodified lines | ||
| 731 | 729 | goto err; |
| 732 | 730 | |
| 733 | 731 | l_new = alloc_htab_elem(htab, key, value, key_size, hash, false, false, |
| 734 | − !!l_old); | |
| 732 | + l_old); | |
| 735 | 733 | if (IS_ERR(l_new)) { |
| 736 | 734 | /* all pre-allocated elements are in use or memory exhausted */ |
| 737 | 735 | ret = PTR_ERR(l_new); |
| @@ -744,7 +742,8 @@ static int htab_map_update_elem(struct bpf_map *map, void *key, void *value, · 6 unmodified lines | ||
| 744 | 742 | hlist_nulls_add_head_rcu(&l_new->hash_node, head); |
| 745 | 743 | if (l_old) { |
| 746 | 744 | hlist_nulls_del_rcu(&l_old->hash_node); |
| 747 | − free_htab_elem(htab, l_old); | |
| 745 | + if (!htab_is_prealloc(htab)) | |
| 746 | + free_htab_elem(htab, l_old); | |
| 748 | 747 | } |
| 749 | 748 | ret = 0; |
| 750 | 749 | err: |
| @@ -856,7 +855,7 @@ static int __htab_percpu_map_update_elem(struct bpf_map *map, void *key, · 105 unmodified lines | ||
| 856 | 855 | value, onallcpus); |
| 857 | 856 | } else { |
| 858 | 857 | l_new = alloc_htab_elem(htab, key, value, key_size, |
| 859 | − hash, true, onallcpus, false); | |
| 858 | + hash, true, onallcpus, NULL); | |
| 860 | 859 | if (IS_ERR(l_new)) { |
| 861 | 860 | ret = PTR_ERR(l_new); |
| 862 | 861 | goto err; |
| @@ -1024,8 +1023,7 @@ static void delete_all_elements(struct bpf_htab *htab) · 161 unmodified lines | ||
| 1024 | 1023 | |
| 1025 | 1024 | hlist_nulls_for_each_entry_safe(l, n, head, hash_node) { |
| 1026 | 1025 | hlist_nulls_del_rcu(&l->hash_node); |
| 1027 | − if (l->state != HTAB_EXTRA_ELEM_USED) | |
| 1028 | − htab_elem_free(htab, l); | |
| 1026 | + htab_elem_free(htab, l); | |
| 1029 | 1027 | } |
| 1030 | 1028 | } |
| 1031 | 1029 | } |
| @@ -1045,7 +1043,7 @@ static void htab_map_free(struct bpf_map *map) · 13 unmodified lines | ||
| 1045 | 1043 | * not have executed. Wait for them. |
| 1046 | 1044 | */ |
| 1047 | 1045 | rcu_barrier(); |
| 1048 | − if (htab->map.map_flags & BPF_F_NO_PREALLOC) | |
| 1046 | + if (!htab_is_prealloc(htab)) | |
| 1049 | 1047 | delete_all_elements(htab); |
| 1050 | 1048 | else |
| 1051 | 1049 | prealloc_destroy(htab); |
| @@ -584,20 +584,14 @@ static int sugov_start(struct cpufreq_policy *policy) · 583 unmodified lines | ||
| 584 | 584 | for_each_cpu(cpu, policy->cpus) { |
| 585 | 585 | struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu); |
| 586 | 586 | |
| 587 | + memset(sg_cpu, 0, sizeof(*sg_cpu)); | |
| 587 | 588 | sg_cpu->sg_policy = sg_policy; |
| 588 | − if (policy_is_shared(policy)) { | |
| 589 | − sg_cpu->util = 0; | |
| 590 | − sg_cpu->max = 0; | |
| 591 | − sg_cpu->flags = SCHED_CPUFREQ_RT; | |
| 592 | − sg_cpu->last_update = 0; | |
| 593 | − sg_cpu->iowait_boost = 0; | |
| 594 | − sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq; | |
| 595 | − cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util, | |
| 596 | − sugov_update_shared); | |
| 597 | − } else { | |
| 598 | − cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util, | |
| 599 | − sugov_update_single); | |
| 600 | − } | |
| 589 | + sg_cpu->flags = SCHED_CPUFREQ_RT; | |
| 590 | + sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq; | |
| 591 | + cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util, | |
| 592 | + policy_is_shared(policy) ? | |
| 593 | + sugov_update_shared : | |
| 594 | + sugov_update_single); | |
| 601 | 595 | } |
| 602 | 596 | return 0; |
| 603 | 597 | } |
| @@ -267,8 +267,6 @@ int free_swap_slot(swp_entry_t entry) · 266 unmodified lines | ||
| 267 | 267 | { |
| 268 | 268 | struct swap_slots_cache *cache; |
| 269 | 269 | |
| 270 | − WARN_ON_ONCE(!swap_slot_cache_initialized); | |
| 271 | − | |
| 272 | 270 | cache = &get_cpu_var(swp_slots); |
| 273 | 271 | if (use_swap_slot_cache && cache->slots_ret) { |
| 274 | 272 | spin_lock_irq(&cache->free_lock); |
| @@ -2477,6 +2477,16 @@ static void batadv_iv_iface_activate(struct batadv_hard_iface *hard_iface) · 2476 unmodified lines | ||
| 2477 | 2477 | batadv_iv_ogm_schedule(hard_iface); |
| 2478 | 2478 | } |
| 2479 | 2479 | |
| 2480 | +/** | |
| 2481 | + * batadv_iv_init_sel_class - initialize GW selection class | |
| 2482 | + * @bat_priv: the bat priv with all the soft interface information | |
| 2483 | + */ | |
| 2484 | +static void batadv_iv_init_sel_class(struct batadv_priv *bat_priv) | |
| 2485 | +{ | |
| 2486 | + /* set default TQ difference threshold to 20 */ | |
| 2487 | + atomic_set(&bat_priv->gw.sel_class, 20); | |
| 2488 | +} | |
| 2489 | + | |
| 2480 | 2490 | static struct batadv_gw_node * |
| 2481 | 2491 | batadv_iv_gw_get_best_gw_node(struct batadv_priv *bat_priv) |
| 2482 | 2492 | { |
| @@ -2823,6 +2833,7 @@ static struct batadv_algo_ops batadv_batman_iv __read_mostly = { · 340 unmodified lines | ||
| 2823 | 2833 | .del_if = batadv_iv_ogm_orig_del_if, |
| 2824 | 2834 | }, |
| 2825 | 2835 | .gw = { |
| 2836 | + .init_sel_class = batadv_iv_init_sel_class, | |
| 2826 | 2837 | .get_best_gw_node = batadv_iv_gw_get_best_gw_node, |
| 2827 | 2838 | .is_eligible = batadv_iv_gw_is_eligible, |
| 2828 | 2839 | #ifdef CONFIG_BATMAN_ADV_DEBUGFS |
| @@ -668,6 +668,16 @@ err_ifinfo1: · 667 unmodified lines | ||
| 668 | 668 | return ret; |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | +/** | |
| 672 | + * batadv_v_init_sel_class - initialize GW selection class | |
| 673 | + * @bat_priv: the bat priv with all the soft interface information | |
| 674 | + */ | |
| 675 | +static void batadv_v_init_sel_class(struct batadv_priv *bat_priv) | |
| 676 | +{ | |
| 677 | + /* set default throughput difference threshold to 5Mbps */ | |
| 678 | + atomic_set(&bat_priv->gw.sel_class, 50); | |
| 679 | +} | |
| 680 | + | |
| 671 | 681 | static ssize_t batadv_v_store_sel_class(struct batadv_priv *bat_priv, |
| 672 | 682 | char *buff, size_t count) |
| 673 | 683 | { |
| @@ -1052,6 +1062,7 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = { · 378 unmodified lines | ||
| 1052 | 1062 | .dump = batadv_v_orig_dump, |
| 1053 | 1063 | }, |
| 1054 | 1064 | .gw = { |
| 1065 | + .init_sel_class = batadv_v_init_sel_class, | |
| 1055 | 1066 | .store_sel_class = batadv_v_store_sel_class, |
| 1056 | 1067 | .show_sel_class = batadv_v_show_sel_class, |
| 1057 | 1068 | .get_best_gw_node = batadv_v_gw_get_best_gw_node, |
| @@ -1092,9 +1103,6 @@ int batadv_v_mesh_init(struct batadv_priv *bat_priv) · 34 unmodified lines | ||
| 1092 | 1103 | if (ret < 0) |
| 1093 | 1104 | return ret; |
| 1094 | 1105 | |
| 1095 | − /* set default throughput difference threshold to 5Mbps */ | |
| 1096 | − atomic_set(&bat_priv->gw.sel_class, 50); | |
| 1097 | − | |
| 1098 | 1106 | return 0; |
| 1099 | 1107 | } |
| 1100 | 1108 | |
| @@ -404,7 +404,7 @@ out: · 403 unmodified lines | ||
| 404 | 404 | * batadv_frag_create - create a fragment from skb |
| 405 | 405 | * @skb: skb to create fragment from |
| 406 | 406 | * @frag_head: header to use in new fragment |
| 407 | − * @mtu: size of new fragment | |
| 407 | + * @fragment_size: size of new fragment | |
| 408 | 408 | * |
| 409 | 409 | * Split the passed skb into two fragments: A new one with size matching the |
| 410 | 410 | * passed mtu and the old one with the rest. The new skb contains data from the |
| @@ -414,11 +414,11 @@ out: · 3 unmodified lines | ||
| 414 | 414 | */ |
| 415 | 415 | static struct sk_buff *batadv_frag_create(struct sk_buff *skb, |
| 416 | 416 | struct batadv_frag_packet *frag_head, |
| 417 | − unsigned int mtu) | |
| 417 | + unsigned int fragment_size) | |
| 418 | 418 | { |
| 419 | 419 | struct sk_buff *skb_fragment; |
| 420 | 420 | unsigned int header_size = sizeof(*frag_head); |
| 421 | − unsigned int fragment_size = mtu - header_size; | |
| 421 | + unsigned int mtu = fragment_size + header_size; | |
| 422 | 422 | |
| 423 | 423 | skb_fragment = netdev_alloc_skb(NULL, mtu + ETH_HLEN); |
| 424 | 424 | if (!skb_fragment) |
| @@ -456,7 +456,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, · 31 unmodified lines | ||
| 456 | 456 | struct sk_buff *skb_fragment; |
| 457 | 457 | unsigned int mtu = neigh_node->if_incoming->net_dev->mtu; |
| 458 | 458 | unsigned int header_size = sizeof(frag_header); |
| 459 | − unsigned int max_fragment_size, max_packet_size; | |
| 459 | + unsigned int max_fragment_size, num_fragments; | |
| 460 | 460 | int ret; |
| 461 | 461 | |
| 462 | 462 | /* To avoid merge and refragmentation at next-hops we never send |
| @@ -464,10 +464,15 @@ int batadv_frag_send_packet(struct sk_buff *skb, · 1 unmodified line | ||
| 464 | 464 | */ |
| 465 | 465 | mtu = min_t(unsigned int, mtu, BATADV_FRAG_MAX_FRAG_SIZE); |
| 466 | 466 | max_fragment_size = mtu - header_size; |
| 467 | − max_packet_size = max_fragment_size * BATADV_FRAG_MAX_FRAGMENTS; | |
| 467 | + | |
| 468 | + if (skb->len == 0 || max_fragment_size == 0) | |
| 469 | + return -EINVAL; | |
| 470 | + | |
| 471 | + num_fragments = (skb->len - 1) / max_fragment_size + 1; | |
| 472 | + max_fragment_size = (skb->len - 1) / num_fragments + 1; | |
| 468 | 473 | |
| 469 | 474 | /* Don't even try to fragment, if we need more than 16 fragments */ |
| 470 | − if (skb->len > max_packet_size) { | |
| 475 | + if (num_fragments > BATADV_FRAG_MAX_FRAGMENTS) { | |
| 471 | 476 | ret = -EAGAIN; |
| 472 | 477 | goto free_skb; |
| 473 | 478 | } |
| @@ -507,7 +512,8 @@ int batadv_frag_send_packet(struct sk_buff *skb, · 33 unmodified lines | ||
| 507 | 512 | goto put_primary_if; |
| 508 | 513 | } |
| 509 | 514 | |
| 510 | − skb_fragment = batadv_frag_create(skb, &frag_header, mtu); | |
| 515 | + skb_fragment = batadv_frag_create(skb, &frag_header, | |
| 516 | + max_fragment_size); | |
| 511 | 517 | if (!skb_fragment) { |
| 512 | 518 | ret = -ENOMEM; |
| 513 | 519 | goto put_primary_if; |
| @@ -253,6 +253,11 @@ static void batadv_gw_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv, · 252 unmodified lines | ||
| 253 | 253 | */ |
| 254 | 254 | void batadv_gw_init(struct batadv_priv *bat_priv) |
| 255 | 255 | { |
| 256 | + if (bat_priv->algo_ops->gw.init_sel_class) | |
| 257 | + bat_priv->algo_ops->gw.init_sel_class(bat_priv); | |
| 258 | + else | |
| 259 | + atomic_set(&bat_priv->gw.sel_class, 1); | |
| 260 | + | |
| 256 | 261 | batadv_tvlv_handler_register(bat_priv, batadv_gw_tvlv_ogm_handler_v1, |
| 257 | 262 | NULL, BATADV_TVLV_GW, 1, |
| 258 | 263 | BATADV_TVLV_HANDLER_OGM_CIFNOTFND); |
| @@ -819,7 +819,6 @@ static int batadv_softif_init_late(struct net_device *dev) · 818 unmodified lines | ||
| 819 | 819 | atomic_set(&bat_priv->mcast.num_want_all_ipv6, 0); |
| 820 | 820 | #endif |
| 821 | 821 | atomic_set(&bat_priv->gw.mode, BATADV_GW_MODE_OFF); |
| 822 | − atomic_set(&bat_priv->gw.sel_class, 20); | |
| 823 | 822 | atomic_set(&bat_priv->gw.bandwidth_down, 100); |
| 824 | 823 | atomic_set(&bat_priv->gw.bandwidth_up, 20); |
| 825 | 824 | atomic_set(&bat_priv->orig_interval, 1000); |
| @@ -1489,6 +1489,7 @@ struct batadv_algo_orig_ops { · 1488 unmodified lines | ||
| 1489 | 1489 | |
| 1490 | 1490 | /** |
| 1491 | 1491 | * struct batadv_algo_gw_ops - mesh algorithm callbacks (GW specific) |
| 1492 | + * @init_sel_class: initialize GW selection class (optional) | |
| 1492 | 1493 | * @store_sel_class: parse and stores a new GW selection class (optional) |
| 1493 | 1494 | * @show_sel_class: prints the current GW selection class (optional) |
| 1494 | 1495 | * @get_best_gw_node: select the best GW from the list of available nodes |
| @@ -1499,6 +1500,7 @@ struct batadv_algo_orig_ops { · 4 unmodified lines | ||
| 1499 | 1500 | * @dump: dump gateways to a netlink socket (optional) |
| 1500 | 1501 | */ |
| 1501 | 1502 | struct batadv_algo_gw_ops { |
| 1503 | + void (*init_sel_class)(struct batadv_priv *bat_priv); | |
| 1502 | 1504 | ssize_t (*store_sel_class)(struct batadv_priv *bat_priv, char *buff, |
| 1503 | 1505 | size_t count); |
| 1504 | 1506 | ssize_t (*show_sel_class)(struct batadv_priv *bat_priv, char *buff); |
| @@ -106,7 +106,7 @@ static struct net_bridge_fdb_entry *br_fdb_find(struct net_bridge *br, · 105 unmodified lines | ||
| 106 | 106 | struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)]; |
| 107 | 107 | struct net_bridge_fdb_entry *fdb; |
| 108 | 108 | |
| 109 | − WARN_ON_ONCE(!br_hash_lock_held(br)); | |
| 109 | + lockdep_assert_held_once(&br->hash_lock); | |
| 110 | 110 | |
| 111 | 111 | rcu_read_lock(); |
| 112 | 112 | fdb = fdb_find_rcu(head, addr, vid); |
| @@ -706,18 +706,20 @@ static unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) · 705 unmodified lines | ||
| 706 | 706 | |
| 707 | 707 | static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff *skb) |
| 708 | 708 | { |
| 709 | − struct nf_bridge_info *nf_bridge; | |
| 710 | − unsigned int mtu_reserved; | |
| 709 | + struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb); | |
| 710 | + unsigned int mtu, mtu_reserved; | |
| 711 | 711 | |
| 712 | 712 | mtu_reserved = nf_bridge_mtu_reduction(skb); |
| 713 | + mtu = skb->dev->mtu; | |
| 714 | + | |
| 715 | + if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu) | |
| 716 | + mtu = nf_bridge->frag_max_size; | |
| 713 | 717 | |
| 714 | − if (skb_is_gso(skb) || skb->len + mtu_reserved <= skb->dev->mtu) { | |
| 718 | + if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) { | |
| 715 | 719 | nf_bridge_info_free(skb); |
| 716 | 720 | return br_dev_queue_push_xmit(net, sk, skb); |
| 717 | 721 | } |
| 718 | 722 | |
| 719 | − nf_bridge = nf_bridge_info_get(skb); | |
| 720 | − | |
| 721 | 723 | /* This is wrong! We should preserve the original fragment |
| 722 | 724 | * boundaries by preserving frag_list rather than refragmenting. |
| 723 | 725 | */ |
| @@ -531,15 +531,6 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p, · 530 unmodified lines | ||
| 531 | 531 | int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p, |
| 532 | 532 | const unsigned char *addr, u16 vid); |
| 533 | 533 | |
| 534 | −static inline bool br_hash_lock_held(struct net_bridge *br) | |
| 535 | −{ | |
| 536 | −#ifdef CONFIG_LOCKDEP | |
| 537 | − return lockdep_is_held(&br->hash_lock); | |
| 538 | −#else | |
| 539 | − return true; | |
| 540 | −#endif | |
| 541 | −} | |
| 542 | − | |
| 543 | 534 | /* br_forward.c */ |
| 544 | 535 | enum br_pkt_type { |
| 545 | 536 | BR_PKT_UNICAST, |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/kthread.h> |
| 8 | 8 | #include <linux/net.h> |
| 9 | 9 | #include <linux/nsproxy.h> |
| 10 | +#include <linux/sched/mm.h> | |
| 10 | 11 | #include <linux/slab.h> |
| 11 | 12 | #include <linux/socket.h> |
| 12 | 13 | #include <linux/string.h> |
| @@ -469,11 +470,16 @@ static int ceph_tcp_connect(struct ceph_connection *con) · 456 unmodified lines | ||
| 469 | 470 | { |
| 470 | 471 | struct sockaddr_storage *paddr = &con->peer_addr.in_addr; |
| 471 | 472 | struct socket *sock; |
| 473 | + unsigned int noio_flag; | |
| 472 | 474 | int ret; |
| 473 | 475 | |
| 474 | 476 | BUG_ON(con->sock); |
| 477 | + | |
| 478 | + /* sock_create_kern() allocates with GFP_KERNEL */ | |
| 479 | + noio_flag = memalloc_noio_save(); | |
| 475 | 480 | ret = sock_create_kern(read_pnet(&con->msgr->net), paddr->ss_family, |
| 476 | 481 | SOCK_STREAM, IPPROTO_TCP, &sock); |
| 482 | + memalloc_noio_restore(noio_flag); | |
| 477 | 483 | if (ret) |
| 478 | 484 | return ret; |
| 479 | 485 | sock->sk->sk_allocation = GFP_NOFS; |
| @@ -71,27 +71,17 @@ static int update_classid_sock(const void *v, struct file *file, unsigned n) · 70 unmodified lines | ||
| 71 | 71 | return 0; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | −static void update_classid(struct cgroup_subsys_state *css, void *v) | |
| 74 | +static void cgrp_attach(struct cgroup_taskset *tset) | |
| 75 | 75 | { |
| 76 | − struct css_task_iter it; | |
| 76 | + struct cgroup_subsys_state *css; | |
| 77 | 77 | struct task_struct *p; |
| 78 | 78 | |
| 79 | − css_task_iter_start(css, &it); | |
| 80 | − while ((p = css_task_iter_next(&it))) { | |
| 79 | + cgroup_taskset_for_each(p, css, tset) { | |
| 81 | 80 | task_lock(p); |
| 82 | − iterate_fd(p->files, 0, update_classid_sock, v); | |
| 81 | + iterate_fd(p->files, 0, update_classid_sock, | |
| 82 | + (void *)(unsigned long)css_cls_state(css)->classid); | |
| 83 | 83 | task_unlock(p); |
| 84 | 84 | } |
| 85 | − css_task_iter_end(&it); | |
| 86 | −} | |
| 87 | − | |
| 88 | −static void cgrp_attach(struct cgroup_taskset *tset) | |
| 89 | −{ | |
| 90 | − struct cgroup_subsys_state *css; | |
| 91 | − | |
| 92 | − cgroup_taskset_first(tset, &css); | |
| 93 | − update_classid(css, | |
| 94 | − (void *)(unsigned long)css_cls_state(css)->classid); | |
| 95 | 85 | } |
| 96 | 86 | |
| 97 | 87 | static u64 read_classid(struct cgroup_subsys_state *css, struct cftype *cft) |
| @@ -103,12 +93,22 @@ static int write_classid(struct cgroup_subsys_state *css, struct cftype *cft, · 5 unmodified lines | ||
| 103 | 93 | u64 value) |
| 104 | 94 | { |
| 105 | 95 | struct cgroup_cls_state *cs = css_cls_state(css); |
| 96 | + struct css_task_iter it; | |
| 97 | + struct task_struct *p; | |
| 106 | 98 | |
| 107 | 99 | cgroup_sk_alloc_disable(); |
| 108 | 100 | |
| 109 | 101 | cs->classid = (u32)value; |
| 110 | 102 | |
| 111 | − update_classid(css, (void *)(unsigned long)cs->classid); | |
| 103 | + css_task_iter_start(css, &it); | |
| 104 | + while ((p = css_task_iter_next(&it))) { | |
| 105 | + task_lock(p); | |
| 106 | + iterate_fd(p->files, 0, update_classid_sock, | |
| 107 | + (void *)(unsigned long)cs->classid); | |
| 108 | + task_unlock(p); | |
| 109 | + } | |
| 110 | + css_task_iter_end(&it); | |
| 111 | + | |
| 112 | 112 | return 0; |
| 113 | 113 | } |
| 114 | 114 | |
| @@ -3694,6 +3694,15 @@ static void sock_rmem_free(struct sk_buff *skb) · 3693 unmodified lines | ||
| 3694 | 3694 | atomic_sub(skb->truesize, &sk->sk_rmem_alloc); |
| 3695 | 3695 | } |
| 3696 | 3696 | |
| 3697 | +static void skb_set_err_queue(struct sk_buff *skb) | |
| 3698 | +{ | |
| 3699 | + /* pkt_type of skbs received on local sockets is never PACKET_OUTGOING. | |
| 3700 | + * So, it is safe to (mis)use it to mark skbs on the error queue. | |
| 3701 | + */ | |
| 3702 | + skb->pkt_type = PACKET_OUTGOING; | |
| 3703 | + BUILD_BUG_ON(PACKET_OUTGOING == 0); | |
| 3704 | +} | |
| 3705 | + | |
| 3697 | 3706 | /* |
| 3698 | 3707 | * Note: We dont mem charge error packets (no sk_forward_alloc changes) |
| 3699 | 3708 | */ |
| @@ -3707,6 +3716,7 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) · 7 unmodified lines | ||
| 3707 | 3716 | skb->sk = sk; |
| 3708 | 3717 | skb->destructor = sock_rmem_free; |
| 3709 | 3718 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); |
| 3719 | + skb_set_err_queue(skb); | |
| 3710 | 3720 | |
| 3711 | 3721 | /* before exiting rcu section, make sure dst is refcounted */ |
| 3712 | 3722 | skb_dst_force(skb); |
| @@ -3783,16 +3793,20 @@ EXPORT_SYMBOL(skb_clone_sk); · 70 unmodified lines | ||
| 3783 | 3793 | |
| 3784 | 3794 | static void __skb_complete_tx_timestamp(struct sk_buff *skb, |
| 3785 | 3795 | struct sock *sk, |
| 3786 | − int tstype) | |
| 3796 | + int tstype, | |
| 3797 | + bool opt_stats) | |
| 3787 | 3798 | { |
| 3788 | 3799 | struct sock_exterr_skb *serr; |
| 3789 | 3800 | int err; |
| 3790 | 3801 | |
| 3802 | + BUILD_BUG_ON(sizeof(struct sock_exterr_skb) > sizeof(skb->cb)); | |
| 3803 | + | |
| 3791 | 3804 | serr = SKB_EXT_ERR(skb); |
| 3792 | 3805 | memset(serr, 0, sizeof(*serr)); |
| 3793 | 3806 | serr->ee.ee_errno = ENOMSG; |
| 3794 | 3807 | serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING; |
| 3795 | 3808 | serr->ee.ee_info = tstype; |
| 3809 | + serr->opt_stats = opt_stats; | |
| 3796 | 3810 | if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) { |
| 3797 | 3811 | serr->ee.ee_data = skb_shinfo(skb)->tskey; |
| 3798 | 3812 | if (sk->sk_protocol == IPPROTO_TCP && |
| @@ -3833,7 +3847,7 @@ void skb_complete_tx_timestamp(struct sk_buff *skb, · 34 unmodified lines | ||
| 3833 | 3847 | */ |
| 3834 | 3848 | if (likely(atomic_inc_not_zero(&sk->sk_refcnt))) { |
| 3835 | 3849 | *skb_hwtstamps(skb) = *hwtstamps; |
| 3836 | − __skb_complete_tx_timestamp(skb, sk, SCM_TSTAMP_SND); | |
| 3850 | + __skb_complete_tx_timestamp(skb, sk, SCM_TSTAMP_SND, false); | |
| 3837 | 3851 | sock_put(sk); |
| 3838 | 3852 | } |
| 3839 | 3853 | } |
| @@ -3844,7 +3858,7 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, · 4 unmodified lines | ||
| 3844 | 3858 | struct sock *sk, int tstype) |
| 3845 | 3859 | { |
| 3846 | 3860 | struct sk_buff *skb; |
| 3847 | − bool tsonly; | |
| 3861 | + bool tsonly, opt_stats = false; | |
| 3848 | 3862 | |
| 3849 | 3863 | if (!sk) |
| 3850 | 3864 | return; |
| @@ -3857,9 +3871,10 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, · 6 unmodified lines | ||
| 3857 | 3871 | #ifdef CONFIG_INET |
| 3858 | 3872 | if ((sk->sk_tsflags & SOF_TIMESTAMPING_OPT_STATS) && |
| 3859 | 3873 | sk->sk_protocol == IPPROTO_TCP && |
| 3860 | − sk->sk_type == SOCK_STREAM) | |
| 3874 | + sk->sk_type == SOCK_STREAM) { | |
| 3861 | 3875 | skb = tcp_get_timestamping_opt_stats(sk); |
| 3862 | − else | |
| 3876 | + opt_stats = true; | |
| 3877 | + } else | |
| 3863 | 3878 | #endif |
| 3864 | 3879 | skb = alloc_skb(0, GFP_ATOMIC); |
| 3865 | 3880 | } else { |
| @@ -3878,7 +3893,7 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, · 12 unmodified lines | ||
| 3878 | 3893 | else |
| 3879 | 3894 | skb->tstamp = ktime_get_real(); |
| 3880 | 3895 | |
| 3881 | − __skb_complete_tx_timestamp(skb, sk, tstype); | |
| 3896 | + __skb_complete_tx_timestamp(skb, sk, tstype, opt_stats); | |
| 3882 | 3897 | } |
| 3883 | 3898 | EXPORT_SYMBOL_GPL(__skb_tstamp_tx); |
| 3884 | 3899 | |
| @@ -1442,6 +1442,11 @@ static void __sk_destruct(struct rcu_head *head) · 1441 unmodified lines | ||
| 1442 | 1442 | pr_debug("%s: optmem leakage (%d bytes) detected\n", |
| 1443 | 1443 | __func__, atomic_read(&sk->sk_omem_alloc)); |
| 1444 | 1444 | |
| 1445 | + if (sk->sk_frag.page) { | |
| 1446 | + put_page(sk->sk_frag.page); | |
| 1447 | + sk->sk_frag.page = NULL; | |
| 1448 | + } | |
| 1449 | + | |
| 1445 | 1450 | if (sk->sk_peer_cred) |
| 1446 | 1451 | put_cred(sk->sk_peer_cred); |
| 1447 | 1452 | put_pid(sk->sk_peer_pid); |
| @@ -1539,6 +1544,12 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) · 91 unmodified lines | ||
| 1539 | 1544 | is_charged = sk_filter_charge(newsk, filter); |
| 1540 | 1545 | |
| 1541 | 1546 | if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) { |
| 1547 | + /* We need to make sure that we don't uncharge the new | |
| 1548 | + * socket if we couldn't charge it in the first place | |
| 1549 | + * as otherwise we uncharge the parent's filter. | |
| 1550 | + */ | |
| 1551 | + if (!is_charged) | |
| 1552 | + RCU_INIT_POINTER(newsk->sk_filter, NULL); | |
| 1542 | 1553 | sk_free_unlock_clone(newsk); |
| 1543 | 1554 | newsk = NULL; |
| 1544 | 1555 | goto out; |
| @@ -2787,11 +2798,6 @@ void sk_common_release(struct sock *sk) · 1242 unmodified lines | ||
| 2787 | 2798 | |
| 2788 | 2799 | sk_refcnt_debug_release(sk); |
| 2789 | 2800 | |
| 2790 | − if (sk->sk_frag.page) { | |
| 2791 | − put_page(sk->sk_frag.page); | |
| 2792 | − sk->sk_frag.page = NULL; | |
| 2793 | − } | |
| 2794 | − | |
| 2795 | 2801 | sock_put(sk); |
| 2796 | 2802 | } |
| 2797 | 2803 | EXPORT_SYMBOL(sk_common_release); |
| @@ -1083,7 +1083,8 @@ static void nl_fib_input(struct sk_buff *skb) · 1082 unmodified lines | ||
| 1083 | 1083 | |
| 1084 | 1084 | net = sock_net(skb->sk); |
| 1085 | 1085 | nlh = nlmsg_hdr(skb); |
| 1086 | − if (skb->len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len || | |
| 1086 | + if (skb->len < nlmsg_total_size(sizeof(*frn)) || | |
| 1087 | + skb->len < nlh->nlmsg_len || | |
| 1087 | 1088 | nlmsg_len(nlh) < sizeof(*frn)) |
| 1088 | 1089 | return; |
| 1089 | 1090 | |
| @@ -198,6 +198,7 @@ static void ip_expire(unsigned long arg) · 197 unmodified lines | ||
| 198 | 198 | qp = container_of((struct inet_frag_queue *) arg, struct ipq, q); |
| 199 | 199 | net = container_of(qp->q.net, struct net, ipv4.frags); |
| 200 | 200 | |
| 201 | + rcu_read_lock(); | |
| 201 | 202 | spin_lock(&qp->q.lock); |
| 202 | 203 | |
| 203 | 204 | if (qp->q.flags & INET_FRAG_COMPLETE) |
| @@ -207,7 +208,7 @@ static void ip_expire(unsigned long arg) · 3 unmodified lines | ||
| 207 | 208 | __IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS); |
| 208 | 209 | |
| 209 | 210 | if (!inet_frag_evicting(&qp->q)) { |
| 210 | − struct sk_buff *head = qp->q.fragments; | |
| 211 | + struct sk_buff *clone, *head = qp->q.fragments; | |
| 211 | 212 | const struct iphdr *iph; |
| 212 | 213 | int err; |
| 213 | 214 | |
| @@ -216,32 +217,40 @@ static void ip_expire(unsigned long arg) · 2 unmodified lines | ||
| 216 | 217 | if (!(qp->q.flags & INET_FRAG_FIRST_IN) || !qp->q.fragments) |
| 217 | 218 | goto out; |
| 218 | 219 | |
| 219 | − rcu_read_lock(); | |
| 220 | 220 | head->dev = dev_get_by_index_rcu(net, qp->iif); |
| 221 | 221 | if (!head->dev) |
| 222 | − goto out_rcu_unlock; | |
| 222 | + goto out; | |
| 223 | + | |
| 223 | 224 | |
| 224 | 225 | /* skb has no dst, perform route lookup again */ |
| 225 | 226 | iph = ip_hdr(head); |
| 226 | 227 | err = ip_route_input_noref(head, iph->daddr, iph->saddr, |
| 227 | 228 | iph->tos, head->dev); |
| 228 | 229 | if (err) |
| 229 | − goto out_rcu_unlock; | |
| 230 | + goto out; | |
| 230 | 231 | |
| 231 | 232 | /* Only an end host needs to send an ICMP |
| 232 | 233 | * "Fragment Reassembly Timeout" message, per RFC792. |
| 233 | 234 | */ |
| 234 | 235 | if (frag_expire_skip_icmp(qp->user) && |
| 235 | 236 | (skb_rtable(head)->rt_type != RTN_LOCAL)) |
| 236 | − goto out_rcu_unlock; | |
| 237 | + goto out; | |
| 238 | + | |
| 239 | + clone = skb_clone(head, GFP_ATOMIC); | |
| 237 | 240 | |
| 238 | 241 | /* Send an ICMP "Fragment Reassembly Timeout" message. */ |
| 239 | − icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0); | |
| 240 | −out_rcu_unlock: | |
| 241 | − rcu_read_unlock(); | |
| 242 | + if (clone) { | |
| 243 | + spin_unlock(&qp->q.lock); | |
| 244 | + icmp_send(clone, ICMP_TIME_EXCEEDED, | |
| 245 | + ICMP_EXC_FRAGTIME, 0); | |
| 246 | + consume_skb(clone); | |
| 247 | + goto out_rcu_unlock; | |
| 248 | + } | |
| 242 | 249 | } |
| 243 | 250 | out: |
| 244 | 251 | spin_unlock(&qp->q.lock); |
| 252 | +out_rcu_unlock: | |
| 253 | + rcu_read_unlock(); | |
| 245 | 254 | ipq_put(qp); |
| 246 | 255 | } |
| 247 | 256 | |
| @@ -165,6 +165,10 @@ static unsigned int ipv4_conntrack_local(void *priv, · 164 unmodified lines | ||
| 165 | 165 | if (skb->len < sizeof(struct iphdr) || |
| 166 | 166 | ip_hdrlen(skb) < sizeof(struct iphdr)) |
| 167 | 167 | return NF_ACCEPT; |
| 168 | + | |
| 169 | + if (ip_is_fragment(ip_hdr(skb))) /* IP_NODEFRAG setsockopt set */ | |
| 170 | + return NF_ACCEPT; | |
| 171 | + | |
| 168 | 172 | return nf_conntrack_in(state->net, PF_INET, state->hook, skb); |
| 169 | 173 | } |
| 170 | 174 | |
| @@ -255,11 +255,6 @@ nf_nat_ipv4_fn(void *priv, struct sk_buff *skb, · 254 unmodified lines | ||
| 255 | 255 | /* maniptype == SRC for postrouting. */ |
| 256 | 256 | enum nf_nat_manip_type maniptype = HOOK2MANIP(state->hook); |
| 257 | 257 | |
| 258 | − /* We never see fragments: conntrack defrags on pre-routing | |
| 259 | − * and local-out, and nf_nat_out protects post-routing. | |
| 260 | − */ | |
| 261 | − NF_CT_ASSERT(!ip_is_fragment(ip_hdr(skb))); | |
| 262 | − | |
| 263 | 258 | ct = nf_ct_get(skb, &ctinfo); |
| 264 | 259 | /* Can't track? It's not due to stress, or conntrack would |
| 265 | 260 | * have dropped it. Hence it's the user's responsibilty to |
| @@ -26,10 +26,10 @@ static void nft_masq_ipv4_eval(const struct nft_expr *expr, · 25 unmodified lines | ||
| 26 | 26 | memset(&range, 0, sizeof(range)); |
| 27 | 27 | range.flags = priv->flags; |
| 28 | 28 | if (priv->sreg_proto_min) { |
| 29 | − range.min_proto.all = | |
| 30 | − *(__be16 *)®s->data[priv->sreg_proto_min]; | |
| 31 | − range.max_proto.all = | |
| 32 | − *(__be16 *)®s->data[priv->sreg_proto_max]; | |
| 29 | + range.min_proto.all = (__force __be16)nft_reg_load16( | |
| 30 | + ®s->data[priv->sreg_proto_min]); | |
| 31 | + range.max_proto.all = (__force __be16)nft_reg_load16( | |
| 32 | + ®s->data[priv->sreg_proto_max]); | |
| 33 | 33 | } |
| 34 | 34 | regs->verdict.code = nf_nat_masquerade_ipv4(pkt->skb, nft_hook(pkt), |
| 35 | 35 | &range, nft_out(pkt)); |
| @@ -26,10 +26,10 @@ static void nft_redir_ipv4_eval(const struct nft_expr *expr, · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | memset(&mr, 0, sizeof(mr)); |
| 28 | 28 | if (priv->sreg_proto_min) { |
| 29 | − mr.range[0].min.all = | |
| 30 | − *(__be16 *)®s->data[priv->sreg_proto_min]; | |
| 31 | − mr.range[0].max.all = | |
| 32 | − *(__be16 *)®s->data[priv->sreg_proto_max]; | |
| 29 | + mr.range[0].min.all = (__force __be16)nft_reg_load16( | |
| 30 | + ®s->data[priv->sreg_proto_min]); | |
| 31 | + mr.range[0].max.all = (__force __be16)nft_reg_load16( | |
| 32 | + ®s->data[priv->sreg_proto_max]); | |
| 33 | 33 | mr.range[0].flags |= NF_NAT_RANGE_PROTO_SPECIFIED; |
| 34 | 34 | } |
| 35 | 35 | |
| @@ -2770,7 +2770,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 2769 unmodified lines | ||
| 2770 | 2770 | { |
| 2771 | 2771 | const struct tcp_sock *tp = tcp_sk(sk); /* iff sk_type == SOCK_STREAM */ |
| 2772 | 2772 | const struct inet_connection_sock *icsk = inet_csk(sk); |
| 2773 | − u32 now = tcp_time_stamp, intv; | |
| 2773 | + u32 now, intv; | |
| 2774 | 2774 | u64 rate64; |
| 2775 | 2775 | bool slow; |
| 2776 | 2776 | u32 rate; |
| @@ -2839,6 +2839,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 62 unmodified lines | ||
| 2839 | 2839 | info->tcpi_retrans = tp->retrans_out; |
| 2840 | 2840 | info->tcpi_fackets = tp->fackets_out; |
| 2841 | 2841 | |
| 2842 | + now = tcp_time_stamp; | |
| 2842 | 2843 | info->tcpi_last_data_sent = jiffies_to_msecs(now - tp->lsndtime); |
| 2843 | 2844 | info->tcpi_last_data_recv = jiffies_to_msecs(now - icsk->icsk_ack.lrcvtime); |
| 2844 | 2845 | info->tcpi_last_ack_recv = jiffies_to_msecs(now - tp->rcv_tstamp); |
| @@ -5541,6 +5541,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb) · 5540 unmodified lines | ||
| 5541 | 5541 | struct inet_connection_sock *icsk = inet_csk(sk); |
| 5542 | 5542 | |
| 5543 | 5543 | tcp_set_state(sk, TCP_ESTABLISHED); |
| 5544 | + icsk->icsk_ack.lrcvtime = tcp_time_stamp; | |
| 5544 | 5545 | |
| 5545 | 5546 | if (skb) { |
| 5546 | 5547 | icsk->icsk_af_ops->sk_rx_dst_set(sk, skb); |
| @@ -5759,7 +5760,6 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, · 212 unmodified lines | ||
| 5759 | 5760 | * to stand against the temptation 8) --ANK |
| 5760 | 5761 | */ |
| 5761 | 5762 | inet_csk_schedule_ack(sk); |
| 5762 | − icsk->icsk_ack.lrcvtime = tcp_time_stamp; | |
| 5763 | 5763 | tcp_enter_quickack_mode(sk); |
| 5764 | 5764 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, |
| 5765 | 5765 | TCP_DELACK_MAX, TCP_RTO_MAX); |
| @@ -460,6 +460,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 459 unmodified lines | ||
| 460 | 460 | newtp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT); |
| 461 | 461 | minmax_reset(&newtp->rtt_min, tcp_time_stamp, ~0U); |
| 462 | 462 | newicsk->icsk_rto = TCP_TIMEOUT_INIT; |
| 463 | + newicsk->icsk_ack.lrcvtime = tcp_time_stamp; | |
| 463 | 464 | |
| 464 | 465 | newtp->packets_out = 0; |
| 465 | 466 | newtp->retrans_out = 0; |
| @@ -27,10 +27,10 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr, · 26 unmodified lines | ||
| 27 | 27 | memset(&range, 0, sizeof(range)); |
| 28 | 28 | range.flags = priv->flags; |
| 29 | 29 | if (priv->sreg_proto_min) { |
| 30 | − range.min_proto.all = | |
| 31 | − *(__be16 *)®s->data[priv->sreg_proto_min]; | |
| 32 | − range.max_proto.all = | |
| 33 | − *(__be16 *)®s->data[priv->sreg_proto_max]; | |
| 30 | + range.min_proto.all = (__force __be16)nft_reg_load16( | |
| 31 | + ®s->data[priv->sreg_proto_min]); | |
| 32 | + range.max_proto.all = (__force __be16)nft_reg_load16( | |
| 33 | + ®s->data[priv->sreg_proto_max]); | |
| 34 | 34 | } |
| 35 | 35 | regs->verdict.code = nf_nat_masquerade_ipv6(pkt->skb, &range, |
| 36 | 36 | nft_out(pkt)); |
| @@ -26,10 +26,10 @@ static void nft_redir_ipv6_eval(const struct nft_expr *expr, · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | memset(&range, 0, sizeof(range)); |
| 28 | 28 | if (priv->sreg_proto_min) { |
| 29 | − range.min_proto.all = | |
| 30 | − *(__be16 *)®s->data[priv->sreg_proto_min], | |
| 31 | − range.max_proto.all = | |
| 32 | − *(__be16 *)®s->data[priv->sreg_proto_max], | |
| 29 | + range.min_proto.all = (__force __be16)nft_reg_load16( | |
| 30 | + ®s->data[priv->sreg_proto_min]); | |
| 31 | + range.max_proto.all = (__force __be16)nft_reg_load16( | |
| 32 | + ®s->data[priv->sreg_proto_max]); | |
| 33 | 33 | range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; |
| 34 | 34 | } |
| 35 | 35 | |
| @@ -3423,6 +3423,8 @@ static int rt6_fill_node(struct net *net, · 3422 unmodified lines | ||
| 3423 | 3423 | } |
| 3424 | 3424 | else if (rt->rt6i_flags & RTF_LOCAL) |
| 3425 | 3425 | rtm->rtm_type = RTN_LOCAL; |
| 3426 | + else if (rt->rt6i_flags & RTF_ANYCAST) | |
| 3427 | + rtm->rtm_type = RTN_ANYCAST; | |
| 3426 | 3428 | else if (rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK)) |
| 3427 | 3429 | rtm->rtm_type = RTN_LOCAL; |
| 3428 | 3430 | else |
| @@ -1035,6 +1035,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 1034 unmodified lines | ||
| 1035 | 1035 | ipc6.hlimit = -1; |
| 1036 | 1036 | ipc6.tclass = -1; |
| 1037 | 1037 | ipc6.dontfrag = -1; |
| 1038 | + sockc.tsflags = sk->sk_tsflags; | |
| 1038 | 1039 | |
| 1039 | 1040 | /* destination address check */ |
| 1040 | 1041 | if (sin6) { |
| @@ -1159,7 +1160,6 @@ do_udp_sendmsg: · 118 unmodified lines | ||
| 1159 | 1160 | |
| 1160 | 1161 | fl6.flowi6_mark = sk->sk_mark; |
| 1161 | 1162 | fl6.flowi6_uid = sk->sk_uid; |
| 1162 | − sockc.tsflags = sk->sk_tsflags; | |
| 1163 | 1163 | |
| 1164 | 1164 | if (msg->msg_controllen) { |
| 1165 | 1165 | opt = &opt_space; |
| @@ -1269,6 +1269,8 @@ static void mpls_ifdown(struct net_device *dev, int event) · 1268 unmodified lines | ||
| 1269 | 1269 | { |
| 1270 | 1270 | struct mpls_route __rcu **platform_label; |
| 1271 | 1271 | struct net *net = dev_net(dev); |
| 1272 | + unsigned int nh_flags = RTNH_F_DEAD | RTNH_F_LINKDOWN; | |
| 1273 | + unsigned int alive; | |
| 1272 | 1274 | unsigned index; |
| 1273 | 1275 | |
| 1274 | 1276 | platform_label = rtnl_dereference(net->mpls.platform_label); |
| @@ -1278,9 +1280,11 @@ static void mpls_ifdown(struct net_device *dev, int event) · 3 unmodified lines | ||
| 1278 | 1280 | if (!rt) |
| 1279 | 1281 | continue; |
| 1280 | 1282 | |
| 1283 | + alive = 0; | |
| 1281 | 1284 | change_nexthops(rt) { |
| 1282 | 1285 | if (rtnl_dereference(nh->nh_dev) != dev) |
| 1283 | − continue; | |
| 1286 | + goto next; | |
| 1287 | + | |
| 1284 | 1288 | switch (event) { |
| 1285 | 1289 | case NETDEV_DOWN: |
| 1286 | 1290 | case NETDEV_UNREGISTER: |
| @@ -1288,13 +1292,16 @@ static void mpls_ifdown(struct net_device *dev, int event) · 1 unmodified line | ||
| 1288 | 1292 | /* fall through */ |
| 1289 | 1293 | case NETDEV_CHANGE: |
| 1290 | 1294 | nh->nh_flags |= RTNH_F_LINKDOWN; |
| 1291 | − if (event != NETDEV_UNREGISTER) | |
| 1292 | − ACCESS_ONCE(rt->rt_nhn_alive) = rt->rt_nhn_alive - 1; | |
| 1293 | 1295 | break; |
| 1294 | 1296 | } |
| 1295 | 1297 | if (event == NETDEV_UNREGISTER) |
| 1296 | 1298 | RCU_INIT_POINTER(nh->nh_dev, NULL); |
| 1299 | +next: | |
| 1300 | + if (!(nh->nh_flags & nh_flags)) | |
| 1301 | + alive++; | |
| 1297 | 1302 | } endfor_nexthops(rt); |
| 1303 | + | |
| 1304 | + WRITE_ONCE(rt->rt_nhn_alive, alive); | |
| 1298 | 1305 | } |
| 1299 | 1306 | } |
| 1300 | 1307 | |
| @@ -181,7 +181,11 @@ EXPORT_SYMBOL_GPL(nf_conntrack_htable_size); · 180 unmodified lines | ||
| 181 | 181 | unsigned int nf_conntrack_max __read_mostly; |
| 182 | 182 | seqcount_t nf_conntrack_generation __read_mostly; |
| 183 | 183 | |
| 184 | −DEFINE_PER_CPU(struct nf_conn, nf_conntrack_untracked); | |
| 184 | +/* nf_conn must be 8 bytes aligned, as the 3 LSB bits are used | |
| 185 | + * for the nfctinfo. We cheat by (ab)using the PER CPU cache line | |
| 186 | + * alignment to enforce this. | |
| 187 | + */ | |
| 188 | +DEFINE_PER_CPU_ALIGNED(struct nf_conn, nf_conntrack_untracked); | |
| 185 | 189 | EXPORT_PER_CPU_SYMBOL(nf_conntrack_untracked); |
| 186 | 190 | |
| 187 | 191 | static unsigned int nf_conntrack_hash_rnd __read_mostly; |
| @@ -33,8 +33,16 @@ sctp_manip_pkt(struct sk_buff *skb, · 32 unmodified lines | ||
| 33 | 33 | enum nf_nat_manip_type maniptype) |
| 34 | 34 | { |
| 35 | 35 | sctp_sctphdr_t *hdr; |
| 36 | + int hdrsize = 8; | |
| 36 | 37 | |
| 37 | − if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) | |
| 38 | + /* This could be an inner header returned in imcp packet; in such | |
| 39 | + * cases we cannot update the checksum field since it is outside | |
| 40 | + * of the 8 bytes of transport layer headers we are guaranteed. | |
| 41 | + */ | |
| 42 | + if (skb->len >= hdroff + sizeof(*hdr)) | |
| 43 | + hdrsize = sizeof(*hdr); | |
| 44 | + | |
| 45 | + if (!skb_make_writable(skb, hdroff + hdrsize)) | |
| 38 | 46 | return false; |
| 39 | 47 | |
| 40 | 48 | hdr = (struct sctphdr *)(skb->data + hdroff); |
| @@ -47,6 +55,9 @@ sctp_manip_pkt(struct sk_buff *skb, · 6 unmodified lines | ||
| 47 | 55 | hdr->dest = tuple->dst.u.sctp.port; |
| 48 | 56 | } |
| 49 | 57 | |
| 58 | + if (hdrsize < sizeof(*hdr)) | |
| 59 | + return true; | |
| 60 | + | |
| 50 | 61 | if (skb->ip_summed != CHECKSUM_PARTIAL) { |
| 51 | 62 | hdr->checksum = sctp_compute_cksum(skb, hdroff); |
| 52 | 63 | skb->ip_summed = CHECKSUM_NONE; |
| @@ -3145,7 +3145,6 @@ int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set, · 3144 unmodified lines | ||
| 3145 | 3145 | iter.count = 0; |
| 3146 | 3146 | iter.err = 0; |
| 3147 | 3147 | iter.fn = nf_tables_bind_check_setelem; |
| 3148 | − iter.flush = false; | |
| 3149 | 3148 | |
| 3150 | 3149 | set->ops->walk(ctx, set, &iter); |
| 3151 | 3150 | if (iter.err < 0) |
| @@ -3399,7 +3398,6 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) · 247 unmodified lines | ||
| 3399 | 3398 | args.iter.count = 0; |
| 3400 | 3399 | args.iter.err = 0; |
| 3401 | 3400 | args.iter.fn = nf_tables_dump_setelem; |
| 3402 | − args.iter.flush = false; | |
| 3403 | 3401 | set->ops->walk(&ctx, set, &args.iter); |
| 3404 | 3402 | |
| 3405 | 3403 | nla_nest_end(skb, nest); |
| @@ -3963,7 +3961,6 @@ static int nf_tables_delsetelem(struct net *net, struct sock *nlsk, · 557 unmodified lines | ||
| 3963 | 3961 | struct nft_set_iter iter = { |
| 3964 | 3962 | .genmask = genmask, |
| 3965 | 3963 | .fn = nft_flush_set, |
| 3966 | − .flush = true, | |
| 3967 | 3964 | }; |
| 3968 | 3965 | set->ops->walk(&ctx, set, &iter); |
| 3969 | 3966 | |
| @@ -5114,7 +5111,6 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx, · 1144 unmodified lines | ||
| 5114 | 5111 | iter.count = 0; |
| 5115 | 5112 | iter.err = 0; |
| 5116 | 5113 | iter.fn = nf_tables_loop_check_setelem; |
| 5117 | − iter.flush = false; | |
| 5118 | 5114 | |
| 5119 | 5115 | set->ops->walk(ctx, set, &iter); |
| 5120 | 5116 | if (iter.err < 0) |
| @@ -83,7 +83,7 @@ static void nft_ct_get_eval(const struct nft_expr *expr, · 82 unmodified lines | ||
| 83 | 83 | |
| 84 | 84 | switch (priv->key) { |
| 85 | 85 | case NFT_CT_DIRECTION: |
| 86 | − *dest = CTINFO2DIR(ctinfo); | |
| 86 | + nft_reg_store8(dest, CTINFO2DIR(ctinfo)); | |
| 87 | 87 | return; |
| 88 | 88 | case NFT_CT_STATUS: |
| 89 | 89 | *dest = ct->status; |
| @@ -151,20 +151,22 @@ static void nft_ct_get_eval(const struct nft_expr *expr, · 61 unmodified lines | ||
| 151 | 151 | return; |
| 152 | 152 | } |
| 153 | 153 | case NFT_CT_L3PROTOCOL: |
| 154 | − *dest = nf_ct_l3num(ct); | |
| 154 | + nft_reg_store8(dest, nf_ct_l3num(ct)); | |
| 155 | 155 | return; |
| 156 | 156 | case NFT_CT_PROTOCOL: |
| 157 | − *dest = nf_ct_protonum(ct); | |
| 157 | + nft_reg_store8(dest, nf_ct_protonum(ct)); | |
| 158 | 158 | return; |
| 159 | 159 | #ifdef CONFIG_NF_CONNTRACK_ZONES |
| 160 | 160 | case NFT_CT_ZONE: { |
| 161 | 161 | const struct nf_conntrack_zone *zone = nf_ct_zone(ct); |
| 162 | + u16 zoneid; | |
| 162 | 163 | |
| 163 | 164 | if (priv->dir < IP_CT_DIR_MAX) |
| 164 | − *dest = nf_ct_zone_id(zone, priv->dir); | |
| 165 | + zoneid = nf_ct_zone_id(zone, priv->dir); | |
| 165 | 166 | else |
| 166 | − *dest = zone->id; | |
| 167 | + zoneid = zone->id; | |
| 167 | 168 | |
| 169 | + nft_reg_store16(dest, zoneid); | |
| 168 | 170 | return; |
| 169 | 171 | } |
| 170 | 172 | #endif |
| @@ -183,10 +185,10 @@ static void nft_ct_get_eval(const struct nft_expr *expr, · 12 unmodified lines | ||
| 183 | 185 | nf_ct_l3num(ct) == NFPROTO_IPV4 ? 4 : 16); |
| 184 | 186 | return; |
| 185 | 187 | case NFT_CT_PROTO_SRC: |
| 186 | − *dest = (__force __u16)tuple->src.u.all; | |
| 188 | + nft_reg_store16(dest, (__force u16)tuple->src.u.all); | |
| 187 | 189 | return; |
| 188 | 190 | case NFT_CT_PROTO_DST: |
| 189 | − *dest = (__force __u16)tuple->dst.u.all; | |
| 191 | + nft_reg_store16(dest, (__force u16)tuple->dst.u.all); | |
| 190 | 192 | return; |
| 191 | 193 | default: |
| 192 | 194 | break; |
| @@ -205,7 +207,7 @@ static void nft_ct_set_zone_eval(const struct nft_expr *expr, · 12 unmodified lines | ||
| 205 | 207 | const struct nft_ct *priv = nft_expr_priv(expr); |
| 206 | 208 | struct sk_buff *skb = pkt->skb; |
| 207 | 209 | enum ip_conntrack_info ctinfo; |
| 208 | − u16 value = regs->data[priv->sreg]; | |
| 210 | + u16 value = nft_reg_load16(®s->data[priv->sreg]); | |
| 209 | 211 | struct nf_conn *ct; |
| 210 | 212 | |
| 211 | 213 | ct = nf_ct_get(skb, &ctinfo); |
| @@ -542,7 +544,8 @@ static int nft_ct_set_init(const struct nft_ctx *ctx, · 330 unmodified lines | ||
| 542 | 544 | case IP_CT_DIR_REPLY: |
| 543 | 545 | break; |
| 544 | 546 | default: |
| 545 | − return -EINVAL; | |
| 547 | + err = -EINVAL; | |
| 548 | + goto err1; | |
| 546 | 549 | } |
| 547 | 550 | } |
| 548 | 551 | |
| @@ -45,16 +45,15 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 44 unmodified lines | ||
| 45 | 45 | *dest = skb->len; |
| 46 | 46 | break; |
| 47 | 47 | case NFT_META_PROTOCOL: |
| 48 | − *dest = 0; | |
| 49 | − *(__be16 *)dest = skb->protocol; | |
| 48 | + nft_reg_store16(dest, (__force u16)skb->protocol); | |
| 50 | 49 | break; |
| 51 | 50 | case NFT_META_NFPROTO: |
| 52 | − *dest = nft_pf(pkt); | |
| 51 | + nft_reg_store8(dest, nft_pf(pkt)); | |
| 53 | 52 | break; |
| 54 | 53 | case NFT_META_L4PROTO: |
| 55 | 54 | if (!pkt->tprot_set) |
| 56 | 55 | goto err; |
| 57 | − *dest = pkt->tprot; | |
| 56 | + nft_reg_store8(dest, pkt->tprot); | |
| 58 | 57 | break; |
| 59 | 58 | case NFT_META_PRIORITY: |
| 60 | 59 | *dest = skb->priority; |
| @@ -85,14 +84,12 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 24 unmodified lines | ||
| 85 | 84 | case NFT_META_IIFTYPE: |
| 86 | 85 | if (in == NULL) |
| 87 | 86 | goto err; |
| 88 | − *dest = 0; | |
| 89 | − *(u16 *)dest = in->type; | |
| 87 | + nft_reg_store16(dest, in->type); | |
| 90 | 88 | break; |
| 91 | 89 | case NFT_META_OIFTYPE: |
| 92 | 90 | if (out == NULL) |
| 93 | 91 | goto err; |
| 94 | − *dest = 0; | |
| 95 | − *(u16 *)dest = out->type; | |
| 92 | + nft_reg_store16(dest, out->type); | |
| 96 | 93 | break; |
| 97 | 94 | case NFT_META_SKUID: |
| 98 | 95 | sk = skb_to_full_sk(skb); |
| @@ -142,19 +139,19 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 43 unmodified lines | ||
| 142 | 139 | #endif |
| 143 | 140 | case NFT_META_PKTTYPE: |
| 144 | 141 | if (skb->pkt_type != PACKET_LOOPBACK) { |
| 145 | − *dest = skb->pkt_type; | |
| 142 | + nft_reg_store8(dest, skb->pkt_type); | |
| 146 | 143 | break; |
| 147 | 144 | } |
| 148 | 145 | |
| 149 | 146 | switch (nft_pf(pkt)) { |
| 150 | 147 | case NFPROTO_IPV4: |
| 151 | 148 | if (ipv4_is_multicast(ip_hdr(skb)->daddr)) |
| 152 | − *dest = PACKET_MULTICAST; | |
| 149 | + nft_reg_store8(dest, PACKET_MULTICAST); | |
| 153 | 150 | else |
| 154 | − *dest = PACKET_BROADCAST; | |
| 151 | + nft_reg_store8(dest, PACKET_BROADCAST); | |
| 155 | 152 | break; |
| 156 | 153 | case NFPROTO_IPV6: |
| 157 | − *dest = PACKET_MULTICAST; | |
| 154 | + nft_reg_store8(dest, PACKET_MULTICAST); | |
| 158 | 155 | break; |
| 159 | 156 | case NFPROTO_NETDEV: |
| 160 | 157 | switch (skb->protocol) { |
| @@ -168,14 +165,14 @@ void nft_meta_get_eval(const struct nft_expr *expr, · 7 unmodified lines | ||
| 168 | 165 | goto err; |
| 169 | 166 | |
| 170 | 167 | if (ipv4_is_multicast(iph->daddr)) |
| 171 | − *dest = PACKET_MULTICAST; | |
| 168 | + nft_reg_store8(dest, PACKET_MULTICAST); | |
| 172 | 169 | else |
| 173 | − *dest = PACKET_BROADCAST; | |
| 170 | + nft_reg_store8(dest, PACKET_BROADCAST); | |
| 174 | 171 | |
| 175 | 172 | break; |
| 176 | 173 | } |
| 177 | 174 | case htons(ETH_P_IPV6): |
| 178 | − *dest = PACKET_MULTICAST; | |
| 175 | + nft_reg_store8(dest, PACKET_MULTICAST); | |
| 179 | 176 | break; |
| 180 | 177 | default: |
| 181 | 178 | WARN_ON_ONCE(1); |
| @@ -230,7 +227,9 @@ void nft_meta_set_eval(const struct nft_expr *expr, · 48 unmodified lines | ||
| 230 | 227 | { |
| 231 | 228 | const struct nft_meta *meta = nft_expr_priv(expr); |
| 232 | 229 | struct sk_buff *skb = pkt->skb; |
| 233 | − u32 value = regs->data[meta->sreg]; | |
| 230 | + u32 *sreg = ®s->data[meta->sreg]; | |
| 231 | + u32 value = *sreg; | |
| 232 | + u8 pkt_type; | |
| 234 | 233 | |
| 235 | 234 | switch (meta->key) { |
| 236 | 235 | case NFT_META_MARK: |
| @@ -240,9 +239,12 @@ void nft_meta_set_eval(const struct nft_expr *expr, · 3 unmodified lines | ||
| 240 | 239 | skb->priority = value; |
| 241 | 240 | break; |
| 242 | 241 | case NFT_META_PKTTYPE: |
| 243 | − if (skb->pkt_type != value && | |
| 244 | − skb_pkt_type_ok(value) && skb_pkt_type_ok(skb->pkt_type)) | |
| 245 | − skb->pkt_type = value; | |
| 242 | + pkt_type = nft_reg_load8(sreg); | |
| 243 | + | |
| 244 | + if (skb->pkt_type != pkt_type && | |
| 245 | + skb_pkt_type_ok(pkt_type) && | |
| 246 | + skb_pkt_type_ok(skb->pkt_type)) | |
| 247 | + skb->pkt_type = pkt_type; | |
| 246 | 248 | break; |
| 247 | 249 | case NFT_META_NFTRACE: |
| 248 | 250 | skb->nf_trace = !!value; |
| @@ -65,10 +65,10 @@ static void nft_nat_eval(const struct nft_expr *expr, · 64 unmodified lines | ||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | if (priv->sreg_proto_min) { |
| 68 | − range.min_proto.all = | |
| 69 | − *(__be16 *)®s->data[priv->sreg_proto_min]; | |
| 70 | − range.max_proto.all = | |
| 71 | − *(__be16 *)®s->data[priv->sreg_proto_max]; | |
| 68 | + range.min_proto.all = (__force __be16)nft_reg_load16( | |
| 69 | + ®s->data[priv->sreg_proto_min]); | |
| 70 | + range.max_proto.all = (__force __be16)nft_reg_load16( | |
| 71 | + ®s->data[priv->sreg_proto_max]); | |
| 72 | 72 | range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; |
| 73 | 73 | } |
| 74 | 74 | |
| @@ -15,6 +15,11 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/netfilter/nf_tables.h> |
| 16 | 16 | #include <net/netfilter/nf_tables.h> |
| 17 | 17 | |
| 18 | +struct nft_bitmap_elem { | |
| 19 | + struct list_head head; | |
| 20 | + struct nft_set_ext ext; | |
| 21 | +}; | |
| 22 | + | |
| 18 | 23 | /* This bitmap uses two bits to represent one element. These two bits determine |
| 19 | 24 | * the element state in the current and the future generation. |
| 20 | 25 | * |
| @@ -41,13 +46,22 @@ · 20 unmodified lines | ||
| 41 | 46 | * restore its previous state. |
| 42 | 47 | */ |
| 43 | 48 | struct nft_bitmap { |
| 44 | − u16 bitmap_size; | |
| 45 | − u8 bitmap[]; | |
| 49 | + struct list_head list; | |
| 50 | + u16 bitmap_size; | |
| 51 | + u8 bitmap[]; | |
| 46 | 52 | }; |
| 47 | 53 | |
| 48 | −static inline void nft_bitmap_location(u32 key, u32 *idx, u32 *off) | |
| 54 | +static inline void nft_bitmap_location(const struct nft_set *set, | |
| 55 | + const void *key, | |
| 56 | + u32 *idx, u32 *off) | |
| 49 | 57 | { |
| 50 | − u32 k = (key << 1); | |
| 58 | + u32 k; | |
| 59 | + | |
| 60 | + if (set->klen == 2) | |
| 61 | + k = *(u16 *)key; | |
| 62 | + else | |
| 63 | + k = *(u8 *)key; | |
| 64 | + k <<= 1; | |
| 51 | 65 | |
| 52 | 66 | *idx = k / BITS_PER_BYTE; |
| 53 | 67 | *off = k % BITS_PER_BYTE; |
| @@ -69,26 +83,48 @@ static bool nft_bitmap_lookup(const struct net *net, const struct nft_set *set, · 15 unmodified lines | ||
| 69 | 83 | u8 genmask = nft_genmask_cur(net); |
| 70 | 84 | u32 idx, off; |
| 71 | 85 | |
| 72 | − nft_bitmap_location(*key, &idx, &off); | |
| 86 | + nft_bitmap_location(set, key, &idx, &off); | |
| 73 | 87 | |
| 74 | 88 | return nft_bitmap_active(priv->bitmap, idx, off, genmask); |
| 75 | 89 | } |
| 76 | 90 | |
| 91 | +static struct nft_bitmap_elem * | |
| 92 | +nft_bitmap_elem_find(const struct nft_set *set, struct nft_bitmap_elem *this, | |
| 93 | + u8 genmask) | |
| 94 | +{ | |
| 95 | + const struct nft_bitmap *priv = nft_set_priv(set); | |
| 96 | + struct nft_bitmap_elem *be; | |
| 97 | + | |
| 98 | + list_for_each_entry_rcu(be, &priv->list, head) { | |
| 99 | + if (memcmp(nft_set_ext_key(&be->ext), | |
| 100 | + nft_set_ext_key(&this->ext), set->klen) || | |
| 101 | + !nft_set_elem_active(&be->ext, genmask)) | |
| 102 | + continue; | |
| 103 | + | |
| 104 | + return be; | |
| 105 | + } | |
| 106 | + return NULL; | |
| 107 | +} | |
| 108 | + | |
| 77 | 109 | static int nft_bitmap_insert(const struct net *net, const struct nft_set *set, |
| 78 | 110 | const struct nft_set_elem *elem, |
| 79 | − struct nft_set_ext **_ext) | |
| 111 | + struct nft_set_ext **ext) | |
| 80 | 112 | { |
| 81 | 113 | struct nft_bitmap *priv = nft_set_priv(set); |
| 82 | − struct nft_set_ext *ext = elem->priv; | |
| 114 | + struct nft_bitmap_elem *new = elem->priv, *be; | |
| 83 | 115 | u8 genmask = nft_genmask_next(net); |
| 84 | 116 | u32 idx, off; |
| 85 | 117 | |
| 86 | − nft_bitmap_location(nft_set_ext_key(ext)->data[0], &idx, &off); | |
| 87 | − if (nft_bitmap_active(priv->bitmap, idx, off, genmask)) | |
| 118 | + be = nft_bitmap_elem_find(set, new, genmask); | |
| 119 | + if (be) { | |
| 120 | + *ext = &be->ext; | |
| 88 | 121 | return -EEXIST; |
| 122 | + } | |
| 89 | 123 | |
| 124 | + nft_bitmap_location(set, nft_set_ext_key(&new->ext), &idx, &off); | |
| 90 | 125 | /* Enter 01 state. */ |
| 91 | 126 | priv->bitmap[idx] |= (genmask << off); |
| 127 | + list_add_tail_rcu(&new->head, &priv->list); | |
| 92 | 128 | |
| 93 | 129 | return 0; |
| 94 | 130 | } |
| @@ -98,13 +134,14 @@ static void nft_bitmap_remove(const struct net *net, · 3 unmodified lines | ||
| 98 | 134 | const struct nft_set_elem *elem) |
| 99 | 135 | { |
| 100 | 136 | struct nft_bitmap *priv = nft_set_priv(set); |
| 101 | − struct nft_set_ext *ext = elem->priv; | |
| 137 | + struct nft_bitmap_elem *be = elem->priv; | |
| 102 | 138 | u8 genmask = nft_genmask_next(net); |
| 103 | 139 | u32 idx, off; |
| 104 | 140 | |
| 105 | − nft_bitmap_location(nft_set_ext_key(ext)->data[0], &idx, &off); | |
| 141 | + nft_bitmap_location(set, nft_set_ext_key(&be->ext), &idx, &off); | |
| 106 | 142 | /* Enter 00 state. */ |
| 107 | 143 | priv->bitmap[idx] &= ~(genmask << off); |
| 144 | + list_del_rcu(&be->head); | |
| 108 | 145 | } |
| 109 | 146 | |
| 110 | 147 | static void nft_bitmap_activate(const struct net *net, |
| @@ -112,74 +149,52 @@ static void nft_bitmap_activate(const struct net *net, · 1 unmodified line | ||
| 112 | 149 | const struct nft_set_elem *elem) |
| 113 | 150 | { |
| 114 | 151 | struct nft_bitmap *priv = nft_set_priv(set); |
| 115 | − struct nft_set_ext *ext = elem->priv; | |
| 152 | + struct nft_bitmap_elem *be = elem->priv; | |
| 116 | 153 | u8 genmask = nft_genmask_next(net); |
| 117 | 154 | u32 idx, off; |
| 118 | 155 | |
| 119 | − nft_bitmap_location(nft_set_ext_key(ext)->data[0], &idx, &off); | |
| 156 | + nft_bitmap_location(set, nft_set_ext_key(&be->ext), &idx, &off); | |
| 120 | 157 | /* Enter 11 state. */ |
| 121 | 158 | priv->bitmap[idx] |= (genmask << off); |
| 159 | + nft_set_elem_change_active(net, set, &be->ext); | |
| 122 | 160 | } |
| 123 | 161 | |
| 124 | 162 | static bool nft_bitmap_flush(const struct net *net, |
| 125 | − const struct nft_set *set, void *ext) | |
| 163 | + const struct nft_set *set, void *_be) | |
| 126 | 164 | { |
| 127 | 165 | struct nft_bitmap *priv = nft_set_priv(set); |
| 128 | 166 | u8 genmask = nft_genmask_next(net); |
| 167 | + struct nft_bitmap_elem *be = _be; | |
| 129 | 168 | u32 idx, off; |
| 130 | 169 | |
| 131 | − nft_bitmap_location(nft_set_ext_key(ext)->data[0], &idx, &off); | |
| 170 | + nft_bitmap_location(set, nft_set_ext_key(&be->ext), &idx, &off); | |
| 132 | 171 | /* Enter 10 state, similar to deactivation. */ |
| 133 | 172 | priv->bitmap[idx] &= ~(genmask << off); |
| 173 | + nft_set_elem_change_active(net, set, &be->ext); | |
| 134 | 174 | |
| 135 | 175 | return true; |
| 136 | 176 | } |
| 137 | 177 | |
| 138 | −static struct nft_set_ext *nft_bitmap_ext_alloc(const struct nft_set *set, | |
| 139 | − const struct nft_set_elem *elem) | |
| 140 | −{ | |
| 141 | − struct nft_set_ext_tmpl tmpl; | |
| 142 | − struct nft_set_ext *ext; | |
| 143 | − | |
| 144 | − nft_set_ext_prepare(&tmpl); | |
| 145 | − nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); | |
| 146 | − | |
| 147 | − ext = kzalloc(tmpl.len, GFP_KERNEL); | |
| 148 | − if (!ext) | |
| 149 | − return NULL; | |
| 150 | − | |
| 151 | − nft_set_ext_init(ext, &tmpl); | |
| 152 | − memcpy(nft_set_ext_key(ext), elem->key.val.data, set->klen); | |
| 153 | − | |
| 154 | − return ext; | |
| 155 | −} | |
| 156 | − | |
| 157 | 178 | static void *nft_bitmap_deactivate(const struct net *net, |
| 158 | 179 | const struct nft_set *set, |
| 159 | 180 | const struct nft_set_elem *elem) |
| 160 | 181 | { |
| 161 | 182 | struct nft_bitmap *priv = nft_set_priv(set); |
| 183 | + struct nft_bitmap_elem *this = elem->priv, *be; | |
| 162 | 184 | u8 genmask = nft_genmask_next(net); |
| 163 | − struct nft_set_ext *ext; | |
| 164 | − u32 idx, off, key = 0; | |
| 165 | − | |
| 166 | − memcpy(&key, elem->key.val.data, set->klen); | |
| 167 | − nft_bitmap_location(key, &idx, &off); | |
| 185 | + u32 idx, off; | |
| 168 | 186 | |
| 169 | − if (!nft_bitmap_active(priv->bitmap, idx, off, genmask)) | |
| 170 | − return NULL; | |
| 187 | + nft_bitmap_location(set, elem->key.val.data, &idx, &off); | |
| 171 | 188 | |
| 172 | − /* We have no real set extension since this is a bitmap, allocate this | |
| 173 | − * dummy object that is released from the commit/abort path. | |
| 174 | − */ | |
| 175 | − ext = nft_bitmap_ext_alloc(set, elem); | |
| 176 | − if (!ext) | |
| 189 | + be = nft_bitmap_elem_find(set, this, genmask); | |
| 190 | + if (!be) | |
| 177 | 191 | return NULL; |
| 178 | 192 | |
| 179 | 193 | /* Enter 10 state. */ |
| 180 | 194 | priv->bitmap[idx] &= ~(genmask << off); |
| 195 | + nft_set_elem_change_active(net, set, &be->ext); | |
| 181 | 196 | |
| 182 | − return ext; | |
| 197 | + return be; | |
| 183 | 198 | } |
| 184 | 199 | |
| 185 | 200 | static void nft_bitmap_walk(const struct nft_ctx *ctx, |
| @@ -187,47 +202,23 @@ static void nft_bitmap_walk(const struct nft_ctx *ctx, · 1 unmodified line | ||
| 187 | 202 | struct nft_set_iter *iter) |
| 188 | 203 | { |
| 189 | 204 | const struct nft_bitmap *priv = nft_set_priv(set); |
| 190 | − struct nft_set_ext_tmpl tmpl; | |
| 205 | + struct nft_bitmap_elem *be; | |
| 191 | 206 | struct nft_set_elem elem; |
| 192 | − struct nft_set_ext *ext; | |
| 193 | − int idx, off; | |
| 194 | − u16 key; | |
| 195 | − | |
| 196 | − nft_set_ext_prepare(&tmpl); | |
| 197 | − nft_set_ext_add_length(&tmpl, NFT_SET_EXT_KEY, set->klen); | |
| 198 | − | |
| 199 | − for (idx = 0; idx < priv->bitmap_size; idx++) { | |
| 200 | − for (off = 0; off < BITS_PER_BYTE; off += 2) { | |
| 201 | − if (iter->count < iter->skip) | |
| 202 | − goto cont; | |
| 203 | − | |
| 204 | − if (!nft_bitmap_active(priv->bitmap, idx, off, | |
| 205 | − iter->genmask)) | |
| 206 | − goto cont; | |
| 207 | − | |
| 208 | − ext = kzalloc(tmpl.len, GFP_KERNEL); | |
| 209 | − if (!ext) { | |
| 210 | − iter->err = -ENOMEM; | |
| 211 | − return; | |
| 212 | − } | |
| 213 | − nft_set_ext_init(ext, &tmpl); | |
| 214 | − key = ((idx * BITS_PER_BYTE) + off) >> 1; | |
| 215 | − memcpy(nft_set_ext_key(ext), &key, set->klen); | |
| 216 | − | |
| 217 | − elem.priv = ext; | |
| 218 | − iter->err = iter->fn(ctx, set, iter, &elem); | |
| 219 | − | |
| 220 | − /* On set flush, this dummy extension object is released | |
| 221 | − * from the commit/abort path. | |
| 222 | − */ | |
| 223 | − if (!iter->flush) | |
| 224 | − kfree(ext); | |
| 225 | − | |
| 226 | − if (iter->err < 0) | |
| 227 | − return; | |
| 207 | + | |
| 208 | + list_for_each_entry_rcu(be, &priv->list, head) { | |
| 209 | + if (iter->count < iter->skip) | |
| 210 | + goto cont; | |
| 211 | + if (!nft_set_elem_active(&be->ext, iter->genmask)) | |
| 212 | + goto cont; | |
| 213 | + | |
| 214 | + elem.priv = be; | |
| 215 | + | |
| 216 | + iter->err = iter->fn(ctx, set, iter, &elem); | |
| 217 | + | |
| 218 | + if (iter->err < 0) | |
| 219 | + return; | |
| 228 | 220 | cont: |
| 229 | − iter->count++; | |
| 230 | − } | |
| 221 | + iter->count++; | |
| 231 | 222 | } |
| 232 | 223 | } |
| 233 | 224 | |
| @@ -258,6 +249,7 @@ static int nft_bitmap_init(const struct nft_set *set, · 24 unmodified lines | ||
| 258 | 249 | { |
| 259 | 250 | struct nft_bitmap *priv = nft_set_priv(set); |
| 260 | 251 | |
| 252 | + INIT_LIST_HEAD(&priv->list); | |
| 261 | 253 | priv->bitmap_size = nft_bitmap_size(set->klen); |
| 262 | 254 | |
| 263 | 255 | return 0; |
| @@ -283,6 +275,7 @@ static bool nft_bitmap_estimate(const struct nft_set_desc *desc, u32 features, · 19 unmodified lines | ||
| 283 | 275 | |
| 284 | 276 | static struct nft_set_ops nft_bitmap_ops __read_mostly = { |
| 285 | 277 | .privsize = nft_bitmap_privsize, |
| 278 | + .elemsize = offsetof(struct nft_bitmap_elem, ext), | |
| 286 | 279 | .estimate = nft_bitmap_estimate, |
| 287 | 280 | .init = nft_bitmap_init, |
| 288 | 281 | .destroy = nft_bitmap_destroy, |
| @@ -96,6 +96,44 @@ EXPORT_SYMBOL_GPL(nl_table); · 95 unmodified lines | ||
| 96 | 96 | |
| 97 | 97 | static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait); |
| 98 | 98 | |
| 99 | +static struct lock_class_key nlk_cb_mutex_keys[MAX_LINKS]; | |
| 100 | + | |
| 101 | +static const char *const nlk_cb_mutex_key_strings[MAX_LINKS + 1] = { | |
| 102 | + "nlk_cb_mutex-ROUTE", | |
| 103 | + "nlk_cb_mutex-1", | |
| 104 | + "nlk_cb_mutex-USERSOCK", | |
| 105 | + "nlk_cb_mutex-FIREWALL", | |
| 106 | + "nlk_cb_mutex-SOCK_DIAG", | |
| 107 | + "nlk_cb_mutex-NFLOG", | |
| 108 | + "nlk_cb_mutex-XFRM", | |
| 109 | + "nlk_cb_mutex-SELINUX", | |
| 110 | + "nlk_cb_mutex-ISCSI", | |
| 111 | + "nlk_cb_mutex-AUDIT", | |
| 112 | + "nlk_cb_mutex-FIB_LOOKUP", | |
| 113 | + "nlk_cb_mutex-CONNECTOR", | |
| 114 | + "nlk_cb_mutex-NETFILTER", | |
| 115 | + "nlk_cb_mutex-IP6_FW", | |
| 116 | + "nlk_cb_mutex-DNRTMSG", | |
| 117 | + "nlk_cb_mutex-KOBJECT_UEVENT", | |
| 118 | + "nlk_cb_mutex-GENERIC", | |
| 119 | + "nlk_cb_mutex-17", | |
| 120 | + "nlk_cb_mutex-SCSITRANSPORT", | |
| 121 | + "nlk_cb_mutex-ECRYPTFS", | |
| 122 | + "nlk_cb_mutex-RDMA", | |
| 123 | + "nlk_cb_mutex-CRYPTO", | |
| 124 | + "nlk_cb_mutex-SMC", | |
| 125 | + "nlk_cb_mutex-23", | |
| 126 | + "nlk_cb_mutex-24", | |
| 127 | + "nlk_cb_mutex-25", | |
| 128 | + "nlk_cb_mutex-26", | |
| 129 | + "nlk_cb_mutex-27", | |
| 130 | + "nlk_cb_mutex-28", | |
| 131 | + "nlk_cb_mutex-29", | |
| 132 | + "nlk_cb_mutex-30", | |
| 133 | + "nlk_cb_mutex-31", | |
| 134 | + "nlk_cb_mutex-MAX_LINKS" | |
| 135 | +}; | |
| 136 | + | |
| 99 | 137 | static int netlink_dump(struct sock *sk); |
| 100 | 138 | static void netlink_skb_destructor(struct sk_buff *skb); |
| 101 | 139 | |
| @@ -585,6 +623,9 @@ static int __netlink_create(struct net *net, struct socket *sock, · 483 unmodified lines | ||
| 585 | 623 | } else { |
| 586 | 624 | nlk->cb_mutex = &nlk->cb_def_mutex; |
| 587 | 625 | mutex_init(nlk->cb_mutex); |
| 626 | + lockdep_set_class_and_name(nlk->cb_mutex, | |
| 627 | + nlk_cb_mutex_keys + protocol, | |
| 628 | + nlk_cb_mutex_key_strings[protocol]); | |
| 588 | 629 | } |
| 589 | 630 | init_waitqueue_head(&nlk->wait); |
| 590 | 631 | |
| @@ -783,8 +783,10 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) · 782 unmodified lines | ||
| 783 | 783 | |
| 784 | 784 | if (ctrl_fill_info(rt, NETLINK_CB(cb->skb).portid, |
| 785 | 785 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
| 786 | − skb, CTRL_CMD_NEWFAMILY) < 0) | |
| 786 | + skb, CTRL_CMD_NEWFAMILY) < 0) { | |
| 787 | + n--; | |
| 787 | 788 | break; |
| 789 | + } | |
| 788 | 790 | } |
| 789 | 791 | |
| 790 | 792 | cb->args[0] = n; |
| @@ -604,7 +604,7 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, · 603 unmodified lines | ||
| 604 | 604 | ipv4 = true; |
| 605 | 605 | break; |
| 606 | 606 | case OVS_TUNNEL_KEY_ATTR_IPV6_SRC: |
| 607 | − SW_FLOW_KEY_PUT(match, tun_key.u.ipv6.dst, | |
| 607 | + SW_FLOW_KEY_PUT(match, tun_key.u.ipv6.src, | |
| 608 | 608 | nla_get_in6_addr(a), is_mask); |
| 609 | 609 | ipv6 = true; |
| 610 | 610 | break; |
| @@ -665,6 +665,8 @@ static int ip_tun_from_nlattr(const struct nlattr *attr, · 54 unmodified lines | ||
| 665 | 665 | tun_flags |= TUNNEL_VXLAN_OPT; |
| 666 | 666 | opts_type = type; |
| 667 | 667 | break; |
| 668 | + case OVS_TUNNEL_KEY_ATTR_PAD: | |
| 669 | + break; | |
| 668 | 670 | default: |
| 669 | 671 | OVS_NLERR(log, "Unknown IP tunnel attribute %d", |
| 670 | 672 | type); |
| @@ -275,6 +275,10 @@ static int rxrpc_process_event(struct rxrpc_connection *conn, · 274 unmodified lines | ||
| 275 | 275 | rxrpc_conn_retransmit_call(conn, skb); |
| 276 | 276 | return 0; |
| 277 | 277 | |
| 278 | + case RXRPC_PACKET_TYPE_BUSY: | |
| 279 | + /* Just ignore BUSY packets for now. */ | |
| 280 | + return 0; | |
| 281 | + | |
| 278 | 282 | case RXRPC_PACKET_TYPE_ABORT: |
| 279 | 283 | if (skb_copy_bits(skb, sizeof(struct rxrpc_wire_header), |
| 280 | 284 | &wtmp, sizeof(wtmp)) < 0) |
| @@ -201,9 +201,13 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 200 unmodified lines | ||
| 201 | 201 | pr_debug("%s(skb %p,sch %p,[qdisc %p])\n", __func__, skb, sch, p); |
| 202 | 202 | |
| 203 | 203 | if (p->set_tc_index) { |
| 204 | + int wlen = skb_network_offset(skb); | |
| 205 | + | |
| 204 | 206 | switch (tc_skb_protocol(skb)) { |
| 205 | 207 | case htons(ETH_P_IP): |
| 206 | − if (skb_cow_head(skb, sizeof(struct iphdr))) | |
| 208 | + wlen += sizeof(struct iphdr); | |
| 209 | + if (!pskb_may_pull(skb, wlen) || | |
| 210 | + skb_try_make_writable(skb, wlen)) | |
| 207 | 211 | goto drop; |
| 208 | 212 | |
| 209 | 213 | skb->tc_index = ipv4_get_dsfield(ip_hdr(skb)) |
| @@ -211,7 +215,9 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 1 unmodified line | ||
| 211 | 215 | break; |
| 212 | 216 | |
| 213 | 217 | case htons(ETH_P_IPV6): |
| 214 | − if (skb_cow_head(skb, sizeof(struct ipv6hdr))) | |
| 218 | + wlen += sizeof(struct ipv6hdr); | |
| 219 | + if (!pskb_may_pull(skb, wlen) || | |
| 220 | + skb_try_make_writable(skb, wlen)) | |
| 215 | 221 | goto drop; |
| 216 | 222 | |
| 217 | 223 | skb->tc_index = ipv6_get_dsfield(ipv6_hdr(skb)) |
| @@ -71,9 +71,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a · 70 unmodified lines | ||
| 71 | 71 | { |
| 72 | 72 | struct net *net = sock_net(sk); |
| 73 | 73 | struct sctp_sock *sp; |
| 74 | − int i; | |
| 75 | 74 | sctp_paramhdr_t *p; |
| 76 | − int err; | |
| 75 | + int i; | |
| 77 | 76 | |
| 78 | 77 | /* Retrieve the SCTP per socket area. */ |
| 79 | 78 | sp = sctp_sk((struct sock *)sk); |
| @@ -264,8 +263,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a · 184 unmodified lines | ||
| 264 | 263 | |
| 265 | 264 | /* AUTH related initializations */ |
| 266 | 265 | INIT_LIST_HEAD(&asoc->endpoint_shared_keys); |
| 267 | − err = sctp_auth_asoc_copy_shkeys(ep, asoc, gfp); | |
| 268 | − if (err) | |
| 266 | + if (sctp_auth_asoc_copy_shkeys(ep, asoc, gfp)) | |
| 269 | 267 | goto fail_init; |
| 270 | 268 | |
| 271 | 269 | asoc->active_key_id = ep->active_key_id; |
| @@ -546,7 +546,6 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) · 545 unmodified lines | ||
| 546 | 546 | struct sctp_association *asoc = tp->asoc; |
| 547 | 547 | struct sctp_chunk *chunk, *tmp; |
| 548 | 548 | int pkt_count, gso = 0; |
| 549 | − int confirm; | |
| 550 | 549 | struct dst_entry *dst; |
| 551 | 550 | struct sk_buff *head; |
| 552 | 551 | struct sctphdr *sh; |
| @@ -625,13 +624,13 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp) · 72 unmodified lines | ||
| 625 | 624 | asoc->peer.last_sent_to = tp; |
| 626 | 625 | } |
| 627 | 626 | head->ignore_df = packet->ipfragok; |
| 628 | − confirm = tp->dst_pending_confirm; | |
| 629 | − if (confirm) | |
| 627 | + if (tp->dst_pending_confirm) | |
| 630 | 628 | skb_set_dst_pending_confirm(head, 1); |
| 631 | 629 | /* neighbour should be confirmed on successful transmission or |
| 632 | 630 | * positive error |
| 633 | 631 | */ |
| 634 | − if (tp->af_specific->sctp_xmit(head, tp) >= 0 && confirm) | |
| 632 | + if (tp->af_specific->sctp_xmit(head, tp) >= 0 && | |
| 633 | + tp->dst_pending_confirm) | |
| 635 | 634 | tp->dst_pending_confirm = 0; |
| 636 | 635 | |
| 637 | 636 | out: |
| @@ -382,17 +382,18 @@ static int sctp_prsctp_prune_sent(struct sctp_association *asoc, · 381 unmodified lines | ||
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | static int sctp_prsctp_prune_unsent(struct sctp_association *asoc, |
| 385 | − struct sctp_sndrcvinfo *sinfo, | |
| 386 | − struct list_head *queue, int msg_len) | |
| 385 | + struct sctp_sndrcvinfo *sinfo, int msg_len) | |
| 387 | 386 | { |
| 387 | + struct sctp_outq *q = &asoc->outqueue; | |
| 388 | 388 | struct sctp_chunk *chk, *temp; |
| 389 | 389 | |
| 390 | − list_for_each_entry_safe(chk, temp, queue, list) { | |
| 390 | + list_for_each_entry_safe(chk, temp, &q->out_chunk_list, list) { | |
| 391 | 391 | if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) || |
| 392 | 392 | chk->sinfo.sinfo_timetolive <= sinfo->sinfo_timetolive) |
| 393 | 393 | continue; |
| 394 | 394 | |
| 395 | 395 | list_del_init(&chk->list); |
| 396 | + q->out_qlen -= chk->skb->len; | |
| 396 | 397 | asoc->sent_cnt_removable--; |
| 397 | 398 | asoc->abandoned_unsent[SCTP_PR_INDEX(PRIO)]++; |
| 398 | 399 | |
| @@ -431,9 +432,7 @@ void sctp_prsctp_prune(struct sctp_association *asoc, · 32 unmodified lines | ||
| 431 | 432 | return; |
| 432 | 433 | } |
| 433 | 434 | |
| 434 | − sctp_prsctp_prune_unsent(asoc, sinfo, | |
| 435 | − &asoc->outqueue.out_chunk_list, | |
| 436 | − msg_len); | |
| 435 | + sctp_prsctp_prune_unsent(asoc, sinfo, msg_len); | |
| 437 | 436 | } |
| 438 | 437 | |
| 439 | 438 | /* Mark all the eligible packets on a transport for retransmission. */ |
| @@ -652,6 +652,16 @@ int kernel_sendmsg(struct socket *sock, struct msghdr *msg, · 651 unmodified lines | ||
| 652 | 652 | } |
| 653 | 653 | EXPORT_SYMBOL(kernel_sendmsg); |
| 654 | 654 | |
| 655 | +static bool skb_is_err_queue(const struct sk_buff *skb) | |
| 656 | +{ | |
| 657 | + /* pkt_type of skbs enqueued on the error queue are set to | |
| 658 | + * PACKET_OUTGOING in skb_set_err_queue(). This is only safe to do | |
| 659 | + * in recvmsg, since skbs received on a local socket will never | |
| 660 | + * have a pkt_type of PACKET_OUTGOING. | |
| 661 | + */ | |
| 662 | + return skb->pkt_type == PACKET_OUTGOING; | |
| 663 | +} | |
| 664 | + | |
| 655 | 665 | /* |
| 656 | 666 | * called from sock_recv_timestamp() if sock_flag(sk, SOCK_RCVTSTAMP) |
| 657 | 667 | */ |
| @@ -695,7 +705,8 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, · 37 unmodified lines | ||
| 695 | 705 | put_cmsg(msg, SOL_SOCKET, |
| 696 | 706 | SCM_TIMESTAMPING, sizeof(tss), &tss); |
| 697 | 707 | |
| 698 | − if (skb->len && (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_STATS)) | |
| 708 | + if (skb_is_err_queue(skb) && skb->len && | |
| 709 | + SKB_EXT_ERR(skb)->opt_stats) | |
| 699 | 710 | put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPING_OPT_STATS, |
| 700 | 711 | skb->len, skb->data); |
| 701 | 712 | } |
| @@ -141,6 +141,11 @@ void tipc_subscrp_report_overlap(struct tipc_subscription *sub, u32 found_lower, · 140 unmodified lines | ||
| 141 | 141 | static void tipc_subscrp_timeout(unsigned long data) |
| 142 | 142 | { |
| 143 | 143 | struct tipc_subscription *sub = (struct tipc_subscription *)data; |
| 144 | + struct tipc_subscriber *subscriber = sub->subscriber; | |
| 145 | + | |
| 146 | + spin_lock_bh(&subscriber->lock); | |
| 147 | + tipc_nametbl_unsubscribe(sub); | |
| 148 | + spin_unlock_bh(&subscriber->lock); | |
| 144 | 149 | |
| 145 | 150 | /* Notify subscriber of timeout */ |
| 146 | 151 | tipc_subscrp_send_event(sub, sub->evt.s.seq.lower, sub->evt.s.seq.upper, |
| @@ -173,7 +178,6 @@ static void tipc_subscrp_kref_release(struct kref *kref) · 26 unmodified lines | ||
| 173 | 178 | struct tipc_subscriber *subscriber = sub->subscriber; |
| 174 | 179 | |
| 175 | 180 | spin_lock_bh(&subscriber->lock); |
| 176 | − tipc_nametbl_unsubscribe(sub); | |
| 177 | 181 | list_del(&sub->subscrp_list); |
| 178 | 182 | atomic_dec(&tn->subscription_count); |
| 179 | 183 | spin_unlock_bh(&subscriber->lock); |
| @@ -205,6 +209,7 @@ static void tipc_subscrb_subscrp_delete(struct tipc_subscriber *subscriber, · 25 unmodified lines | ||
| 205 | 209 | if (s && memcmp(s, &sub->evt.s, sizeof(struct tipc_subscr))) |
| 206 | 210 | continue; |
| 207 | 211 | |
| 212 | + tipc_nametbl_unsubscribe(sub); | |
| 208 | 213 | tipc_subscrp_get(sub); |
| 209 | 214 | spin_unlock_bh(&subscriber->lock); |
| 210 | 215 | tipc_subscrp_delete(sub); |
| @@ -146,6 +146,7 @@ void unix_notinflight(struct user_struct *user, struct file *fp) · 145 unmodified lines | ||
| 146 | 146 | if (s) { |
| 147 | 147 | struct unix_sock *u = unix_sk(s); |
| 148 | 148 | |
| 149 | + BUG_ON(!atomic_long_read(&u->inflight)); | |
| 149 | 150 | BUG_ON(list_empty(&u->link)); |
| 150 | 151 | |
| 151 | 152 | if (atomic_long_dec_and_test(&u->inflight)) |
| @@ -341,6 +342,14 @@ void unix_gc(void) · 189 unmodified lines | ||
| 341 | 342 | } |
| 342 | 343 | list_del(&cursor); |
| 343 | 344 | |
| 345 | + /* Now gc_candidates contains only garbage. Restore original | |
| 346 | + * inflight counters for these as well, and remove the skbuffs | |
| 347 | + * which are creating the cycle(s). | |
| 348 | + */ | |
| 349 | + skb_queue_head_init(&hitlist); | |
| 350 | + list_for_each_entry(u, &gc_candidates, link) | |
| 351 | + scan_children(&u->sk, inc_inflight, &hitlist); | |
| 352 | + | |
| 344 | 353 | /* not_cycle_list contains those sockets which do not make up a |
| 345 | 354 | * cycle. Restore these to the inflight list. |
| 346 | 355 | */ |
| @@ -350,14 +359,6 @@ void unix_gc(void) · 3 unmodified lines | ||
| 350 | 359 | list_move_tail(&u->link, &gc_inflight_list); |
| 351 | 360 | } |
| 352 | 361 | |
| 353 | − /* Now gc_candidates contains only garbage. Restore original | |
| 354 | − * inflight counters for these as well, and remove the skbuffs | |
| 355 | − * which are creating the cycle(s). | |
| 356 | − */ | |
| 357 | − skb_queue_head_init(&hitlist); | |
| 358 | − list_for_each_entry(u, &gc_candidates, link) | |
| 359 | − scan_children(&u->sk, inc_inflight, &hitlist); | |
| 360 | − | |
| 361 | 362 | spin_unlock(&unix_gc_lock); |
| 362 | 363 | |
| 363 | 364 | /* Here we are. Hitlist is filled. Die. */ |
| @@ -1102,10 +1102,19 @@ static const struct proto_ops vsock_dgram_ops = { · 1101 unmodified lines | ||
| 1102 | 1102 | .sendpage = sock_no_sendpage, |
| 1103 | 1103 | }; |
| 1104 | 1104 | |
| 1105 | +static int vsock_transport_cancel_pkt(struct vsock_sock *vsk) | |
| 1106 | +{ | |
| 1107 | + if (!transport->cancel_pkt) | |
| 1108 | + return -EOPNOTSUPP; | |
| 1109 | + | |
| 1110 | + return transport->cancel_pkt(vsk); | |
| 1111 | +} | |
| 1112 | + | |
| 1105 | 1113 | static void vsock_connect_timeout(struct work_struct *work) |
| 1106 | 1114 | { |
| 1107 | 1115 | struct sock *sk; |
| 1108 | 1116 | struct vsock_sock *vsk; |
| 1117 | + int cancel = 0; | |
| 1109 | 1118 | |
| 1110 | 1119 | vsk = container_of(work, struct vsock_sock, dwork.work); |
| 1111 | 1120 | sk = sk_vsock(vsk); |
| @@ -1116,8 +1125,11 @@ static void vsock_connect_timeout(struct work_struct *work) · 4 unmodified lines | ||
| 1116 | 1125 | sk->sk_state = SS_UNCONNECTED; |
| 1117 | 1126 | sk->sk_err = ETIMEDOUT; |
| 1118 | 1127 | sk->sk_error_report(sk); |
| 1128 | + cancel = 1; | |
| 1119 | 1129 | } |
| 1120 | 1130 | release_sock(sk); |
| 1131 | + if (cancel) | |
| 1132 | + vsock_transport_cancel_pkt(vsk); | |
| 1121 | 1133 | |
| 1122 | 1134 | sock_put(sk); |
| 1123 | 1135 | } |
| @@ -1224,11 +1236,13 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr, · 100 unmodified lines | ||
| 1224 | 1236 | err = sock_intr_errno(timeout); |
| 1225 | 1237 | sk->sk_state = SS_UNCONNECTED; |
| 1226 | 1238 | sock->state = SS_UNCONNECTED; |
| 1239 | + vsock_transport_cancel_pkt(vsk); | |
| 1227 | 1240 | goto out_wait; |
| 1228 | 1241 | } else if (timeout == 0) { |
| 1229 | 1242 | err = -ETIMEDOUT; |
| 1230 | 1243 | sk->sk_state = SS_UNCONNECTED; |
| 1231 | 1244 | sock->state = SS_UNCONNECTED; |
| 1245 | + vsock_transport_cancel_pkt(vsk); | |
| 1232 | 1246 | goto out_wait; |
| 1233 | 1247 | } |
| 1234 | 1248 | |
| @@ -213,6 +213,47 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt) · 212 unmodified lines | ||
| 213 | 213 | return len; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | +static int | |
| 217 | +virtio_transport_cancel_pkt(struct vsock_sock *vsk) | |
| 218 | +{ | |
| 219 | + struct virtio_vsock *vsock; | |
| 220 | + struct virtio_vsock_pkt *pkt, *n; | |
| 221 | + int cnt = 0; | |
| 222 | + LIST_HEAD(freeme); | |
| 223 | + | |
| 224 | + vsock = virtio_vsock_get(); | |
| 225 | + if (!vsock) { | |
| 226 | + return -ENODEV; | |
| 227 | + } | |
| 228 | + | |
| 229 | + spin_lock_bh(&vsock->send_pkt_list_lock); | |
| 230 | + list_for_each_entry_safe(pkt, n, &vsock->send_pkt_list, list) { | |
| 231 | + if (pkt->vsk != vsk) | |
| 232 | + continue; | |
| 233 | + list_move(&pkt->list, &freeme); | |
| 234 | + } | |
| 235 | + spin_unlock_bh(&vsock->send_pkt_list_lock); | |
| 236 | + | |
| 237 | + list_for_each_entry_safe(pkt, n, &freeme, list) { | |
| 238 | + if (pkt->reply) | |
| 239 | + cnt++; | |
| 240 | + list_del(&pkt->list); | |
| 241 | + virtio_transport_free_pkt(pkt); | |
| 242 | + } | |
| 243 | + | |
| 244 | + if (cnt) { | |
| 245 | + struct virtqueue *rx_vq = vsock->vqs[VSOCK_VQ_RX]; | |
| 246 | + int new_cnt; | |
| 247 | + | |
| 248 | + new_cnt = atomic_sub_return(cnt, &vsock->queued_replies); | |
| 249 | + if (new_cnt + cnt >= virtqueue_get_vring_size(rx_vq) && | |
| 250 | + new_cnt < virtqueue_get_vring_size(rx_vq)) | |
| 251 | + queue_work(virtio_vsock_workqueue, &vsock->rx_work); | |
| 252 | + } | |
| 253 | + | |
| 254 | + return 0; | |
| 255 | +} | |
| 256 | + | |
| 216 | 257 | static void virtio_vsock_rx_fill(struct virtio_vsock *vsock) |
| 217 | 258 | { |
| 218 | 259 | int buf_len = VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE; |
| @@ -462,6 +503,7 @@ static struct virtio_transport virtio_transport = { · 243 unmodified lines | ||
| 462 | 503 | .release = virtio_transport_release, |
| 463 | 504 | .connect = virtio_transport_connect, |
| 464 | 505 | .shutdown = virtio_transport_shutdown, |
| 506 | + .cancel_pkt = virtio_transport_cancel_pkt, | |
| 465 | 507 | |
| 466 | 508 | .dgram_bind = virtio_transport_dgram_bind, |
| 467 | 509 | .dgram_dequeue = virtio_transport_dgram_dequeue, |
| @@ -58,6 +58,7 @@ virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info, · 57 unmodified lines | ||
| 58 | 58 | pkt->len = len; |
| 59 | 59 | pkt->hdr.len = cpu_to_le32(len); |
| 60 | 60 | pkt->reply = info->reply; |
| 61 | + pkt->vsk = info->vsk; | |
| 61 | 62 | |
| 62 | 63 | if (info->msg && len > 0) { |
| 63 | 64 | pkt->buf = kmalloc(len, GFP_KERNEL); |
| @@ -180,6 +181,7 @@ static int virtio_transport_send_credit_update(struct vsock_sock *vsk, · 116 unmodified lines | ||
| 180 | 181 | struct virtio_vsock_pkt_info info = { |
| 181 | 182 | .op = VIRTIO_VSOCK_OP_CREDIT_UPDATE, |
| 182 | 183 | .type = type, |
| 184 | + .vsk = vsk, | |
| 183 | 185 | }; |
| 184 | 186 | |
| 185 | 187 | return virtio_transport_send_pkt_info(vsk, &info); |
| @@ -519,6 +521,7 @@ int virtio_transport_connect(struct vsock_sock *vsk) · 333 unmodified lines | ||
| 519 | 521 | struct virtio_vsock_pkt_info info = { |
| 520 | 522 | .op = VIRTIO_VSOCK_OP_REQUEST, |
| 521 | 523 | .type = VIRTIO_VSOCK_TYPE_STREAM, |
| 524 | + .vsk = vsk, | |
| 522 | 525 | }; |
| 523 | 526 | |
| 524 | 527 | return virtio_transport_send_pkt_info(vsk, &info); |
| @@ -534,6 +537,7 @@ int virtio_transport_shutdown(struct vsock_sock *vsk, int mode) · 9 unmodified lines | ||
| 534 | 537 | VIRTIO_VSOCK_SHUTDOWN_RCV : 0) | |
| 535 | 538 | (mode & SEND_SHUTDOWN ? |
| 536 | 539 | VIRTIO_VSOCK_SHUTDOWN_SEND : 0), |
| 540 | + .vsk = vsk, | |
| 537 | 541 | }; |
| 538 | 542 | |
| 539 | 543 | return virtio_transport_send_pkt_info(vsk, &info); |
| @@ -560,6 +564,7 @@ virtio_transport_stream_enqueue(struct vsock_sock *vsk, · 20 unmodified lines | ||
| 560 | 564 | .type = VIRTIO_VSOCK_TYPE_STREAM, |
| 561 | 565 | .msg = msg, |
| 562 | 566 | .pkt_len = len, |
| 567 | + .vsk = vsk, | |
| 563 | 568 | }; |
| 564 | 569 | |
| 565 | 570 | return virtio_transport_send_pkt_info(vsk, &info); |
| @@ -581,6 +586,7 @@ static int virtio_transport_reset(struct vsock_sock *vsk, · 15 unmodified lines | ||
| 581 | 586 | .op = VIRTIO_VSOCK_OP_RST, |
| 582 | 587 | .type = VIRTIO_VSOCK_TYPE_STREAM, |
| 583 | 588 | .reply = !!pkt, |
| 589 | + .vsk = vsk, | |
| 584 | 590 | }; |
| 585 | 591 | |
| 586 | 592 | /* Send RST only if the original pkt is not a RST pkt */ |
| @@ -826,6 +832,7 @@ virtio_transport_send_response(struct vsock_sock *vsk, · 239 unmodified lines | ||
| 826 | 832 | .remote_cid = le64_to_cpu(pkt->hdr.src_cid), |
| 827 | 833 | .remote_port = le32_to_cpu(pkt->hdr.src_port), |
| 828 | 834 | .reply = true, |
| 835 | + .vsk = vsk, | |
| 829 | 836 | }; |
| 830 | 837 | |
| 831 | 838 | return virtio_transport_send_pkt_info(vsk, &info); |
| @@ -545,22 +545,18 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, · 544 unmodified lines | ||
| 545 | 545 | { |
| 546 | 546 | int err; |
| 547 | 547 | |
| 548 | − rtnl_lock(); | |
| 549 | − | |
| 550 | 548 | if (!cb->args[0]) { |
| 551 | 549 | err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, |
| 552 | 550 | genl_family_attrbuf(&nl80211_fam), |
| 553 | 551 | nl80211_fam.maxattr, nl80211_policy); |
| 554 | 552 | if (err) |
| 555 | − goto out_unlock; | |
| 553 | + return err; | |
| 556 | 554 | |
| 557 | 555 | *wdev = __cfg80211_wdev_from_attrs( |
| 558 | 556 | sock_net(skb->sk), |
| 559 | 557 | genl_family_attrbuf(&nl80211_fam)); |
| 560 | − if (IS_ERR(*wdev)) { | |
| 561 | − err = PTR_ERR(*wdev); | |
| 562 | − goto out_unlock; | |
| 563 | − } | |
| 558 | + if (IS_ERR(*wdev)) | |
| 559 | + return PTR_ERR(*wdev); | |
| 564 | 560 | *rdev = wiphy_to_rdev((*wdev)->wiphy); |
| 565 | 561 | /* 0 is the first index - add 1 to parse only once */ |
| 566 | 562 | cb->args[0] = (*rdev)->wiphy_idx + 1; |
| @@ -570,10 +566,8 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, · 3 unmodified lines | ||
| 570 | 566 | struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1); |
| 571 | 567 | struct wireless_dev *tmp; |
| 572 | 568 | |
| 573 | − if (!wiphy) { | |
| 574 | − err = -ENODEV; | |
| 575 | − goto out_unlock; | |
| 576 | − } | |
| 569 | + if (!wiphy) | |
| 570 | + return -ENODEV; | |
| 577 | 571 | *rdev = wiphy_to_rdev(wiphy); |
| 578 | 572 | *wdev = NULL; |
| 579 | 573 | |
| @@ -584,21 +578,11 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, · 4 unmodified lines | ||
| 584 | 578 | } |
| 585 | 579 | } |
| 586 | 580 | |
| 587 | − if (!*wdev) { | |
| 588 | − err = -ENODEV; | |
| 589 | − goto out_unlock; | |
| 590 | − } | |
| 581 | + if (!*wdev) | |
| 582 | + return -ENODEV; | |
| 591 | 583 | } |
| 592 | 584 | |
| 593 | 585 | return 0; |
| 594 | − out_unlock: | |
| 595 | − rtnl_unlock(); | |
| 596 | − return err; | |
| 597 | −} | |
| 598 | − | |
| 599 | −static void nl80211_finish_wdev_dump(struct cfg80211_registered_device *rdev) | |
| 600 | −{ | |
| 601 | − rtnl_unlock(); | |
| 602 | 586 | } |
| 603 | 587 | |
| 604 | 588 | /* IE validation */ |
| @@ -2608,17 +2592,17 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback * · 2003 unmodified lines | ||
| 2608 | 2592 | int filter_wiphy = -1; |
| 2609 | 2593 | struct cfg80211_registered_device *rdev; |
| 2610 | 2594 | struct wireless_dev *wdev; |
| 2595 | + int ret; | |
| 2611 | 2596 | |
| 2612 | 2597 | rtnl_lock(); |
| 2613 | 2598 | if (!cb->args[2]) { |
| 2614 | 2599 | struct nl80211_dump_wiphy_state state = { |
| 2615 | 2600 | .filter_wiphy = -1, |
| 2616 | 2601 | }; |
| 2617 | − int ret; | |
| 2618 | 2602 | |
| 2619 | 2603 | ret = nl80211_dump_wiphy_parse(skb, cb, &state); |
| 2620 | 2604 | if (ret) |
| 2621 | − return ret; | |
| 2605 | + goto out_unlock; | |
| 2622 | 2606 | |
| 2623 | 2607 | filter_wiphy = state.filter_wiphy; |
| 2624 | 2608 | |
| @@ -2663,12 +2647,14 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback * · 38 unmodified lines | ||
| 2663 | 2647 | wp_idx++; |
| 2664 | 2648 | } |
| 2665 | 2649 | out: |
| 2666 | − rtnl_unlock(); | |
| 2667 | − | |
| 2668 | 2650 | cb->args[0] = wp_idx; |
| 2669 | 2651 | cb->args[1] = if_idx; |
| 2670 | 2652 | |
| 2671 | − return skb->len; | |
| 2653 | + ret = skb->len; | |
| 2654 | + out_unlock: | |
| 2655 | + rtnl_unlock(); | |
| 2656 | + | |
| 2657 | + return ret; | |
| 2672 | 2658 | } |
| 2673 | 2659 | |
| 2674 | 2660 | static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) |
| @@ -4452,9 +4438,10 @@ static int nl80211_dump_station(struct sk_buff *skb, · 1777 unmodified lines | ||
| 4452 | 4438 | int sta_idx = cb->args[2]; |
| 4453 | 4439 | int err; |
| 4454 | 4440 | |
| 4441 | + rtnl_lock(); | |
| 4455 | 4442 | err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev); |
| 4456 | 4443 | if (err) |
| 4457 | − return err; | |
| 4444 | + goto out_err; | |
| 4458 | 4445 | |
| 4459 | 4446 | if (!wdev->netdev) { |
| 4460 | 4447 | err = -EINVAL; |
| @@ -4489,7 +4476,7 @@ static int nl80211_dump_station(struct sk_buff *skb, · 28 unmodified lines | ||
| 4489 | 4476 | cb->args[2] = sta_idx; |
| 4490 | 4477 | err = skb->len; |
| 4491 | 4478 | out_err: |
| 4492 | − nl80211_finish_wdev_dump(rdev); | |
| 4479 | + rtnl_unlock(); | |
| 4493 | 4480 | |
| 4494 | 4481 | return err; |
| 4495 | 4482 | } |
| @@ -5275,9 +5262,10 @@ static int nl80211_dump_mpath(struct sk_buff *skb, · 779 unmodified lines | ||
| 5275 | 5262 | int path_idx = cb->args[2]; |
| 5276 | 5263 | int err; |
| 5277 | 5264 | |
| 5265 | + rtnl_lock(); | |
| 5278 | 5266 | err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev); |
| 5279 | 5267 | if (err) |
| 5280 | − return err; | |
| 5268 | + goto out_err; | |
| 5281 | 5269 | |
| 5282 | 5270 | if (!rdev->ops->dump_mpath) { |
| 5283 | 5271 | err = -EOPNOTSUPP; |
| @@ -5310,7 +5298,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb, · 26 unmodified lines | ||
| 5310 | 5298 | cb->args[2] = path_idx; |
| 5311 | 5299 | err = skb->len; |
| 5312 | 5300 | out_err: |
| 5313 | − nl80211_finish_wdev_dump(rdev); | |
| 5301 | + rtnl_unlock(); | |
| 5314 | 5302 | return err; |
| 5315 | 5303 | } |
| 5316 | 5304 | |
| @@ -5470,9 +5458,10 @@ static int nl80211_dump_mpp(struct sk_buff *skb, · 153 unmodified lines | ||
| 5470 | 5458 | int path_idx = cb->args[2]; |
| 5471 | 5459 | int err; |
| 5472 | 5460 | |
| 5461 | + rtnl_lock(); | |
| 5473 | 5462 | err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev); |
| 5474 | 5463 | if (err) |
| 5475 | − return err; | |
| 5464 | + goto out_err; | |
| 5476 | 5465 | |
| 5477 | 5466 | if (!rdev->ops->dump_mpp) { |
| 5478 | 5467 | err = -EOPNOTSUPP; |
| @@ -5505,7 +5494,7 @@ static int nl80211_dump_mpp(struct sk_buff *skb, · 26 unmodified lines | ||
| 5505 | 5494 | cb->args[2] = path_idx; |
| 5506 | 5495 | err = skb->len; |
| 5507 | 5496 | out_err: |
| 5508 | − nl80211_finish_wdev_dump(rdev); | |
| 5497 | + rtnl_unlock(); | |
| 5509 | 5498 | return err; |
| 5510 | 5499 | } |
| 5511 | 5500 | |
| @@ -7674,9 +7663,12 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb) · 2162 unmodified lines | ||
| 7674 | 7663 | int start = cb->args[2], idx = 0; |
| 7675 | 7664 | int err; |
| 7676 | 7665 | |
| 7666 | + rtnl_lock(); | |
| 7677 | 7667 | err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev); |
| 7678 | − if (err) | |
| 7668 | + if (err) { | |
| 7669 | + rtnl_unlock(); | |
| 7679 | 7670 | return err; |
| 7671 | + } | |
| 7680 | 7672 | |
| 7681 | 7673 | wdev_lock(wdev); |
| 7682 | 7674 | spin_lock_bh(&rdev->bss_lock); |
| @@ -7699,7 +7691,7 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb) · 16 unmodified lines | ||
| 7699 | 7691 | wdev_unlock(wdev); |
| 7700 | 7692 | |
| 7701 | 7693 | cb->args[2] = idx; |
| 7702 | − nl80211_finish_wdev_dump(rdev); | |
| 7694 | + rtnl_unlock(); | |
| 7703 | 7695 | |
| 7704 | 7696 | return skb->len; |
| 7705 | 7697 | } |
| @@ -7784,9 +7776,10 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb) · 78 unmodified lines | ||
| 7784 | 7776 | int res; |
| 7785 | 7777 | bool radio_stats; |
| 7786 | 7778 | |
| 7779 | + rtnl_lock(); | |
| 7787 | 7780 | res = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev); |
| 7788 | 7781 | if (res) |
| 7789 | − return res; | |
| 7782 | + goto out_err; | |
| 7790 | 7783 | |
| 7791 | 7784 | /* prepare_wdev_dump parsed the attributes */ |
| 7792 | 7785 | radio_stats = attrbuf[NL80211_ATTR_SURVEY_RADIO_STATS]; |
| @@ -7827,7 +7820,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb) · 34 unmodified lines | ||
| 7827 | 7820 | cb->args[2] = survey_idx; |
| 7828 | 7821 | res = skb->len; |
| 7829 | 7822 | out_err: |
| 7830 | − nl80211_finish_wdev_dump(rdev); | |
| 7823 | + rtnl_unlock(); | |
| 7831 | 7824 | return res; |
| 7832 | 7825 | } |
| 7833 | 7826 | |
| @@ -11508,17 +11501,13 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb, · 3674 unmodified lines | ||
| 11508 | 11501 | void *data = NULL; |
| 11509 | 11502 | unsigned int data_len = 0; |
| 11510 | 11503 | |
| 11511 | − rtnl_lock(); | |
| 11512 | − | |
| 11513 | 11504 | if (cb->args[0]) { |
| 11514 | 11505 | /* subtract the 1 again here */ |
| 11515 | 11506 | struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1); |
| 11516 | 11507 | struct wireless_dev *tmp; |
| 11517 | 11508 | |
| 11518 | − if (!wiphy) { | |
| 11519 | − err = -ENODEV; | |
| 11520 | − goto out_unlock; | |
| 11521 | − } | |
| 11509 | + if (!wiphy) | |
| 11510 | + return -ENODEV; | |
| 11522 | 11511 | *rdev = wiphy_to_rdev(wiphy); |
| 11523 | 11512 | *wdev = NULL; |
| 11524 | 11513 | |
| @@ -11538,23 +11527,19 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb, · 13 unmodified lines | ||
| 11538 | 11527 | err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, |
| 11539 | 11528 | attrbuf, nl80211_fam.maxattr, nl80211_policy); |
| 11540 | 11529 | if (err) |
| 11541 | − goto out_unlock; | |
| 11530 | + return err; | |
| 11542 | 11531 | |
| 11543 | 11532 | if (!attrbuf[NL80211_ATTR_VENDOR_ID] || |
| 11544 | − !attrbuf[NL80211_ATTR_VENDOR_SUBCMD]) { | |
| 11545 | − err = -EINVAL; | |
| 11546 | − goto out_unlock; | |
| 11547 | − } | |
| 11533 | + !attrbuf[NL80211_ATTR_VENDOR_SUBCMD]) | |
| 11534 | + return -EINVAL; | |
| 11548 | 11535 | |
| 11549 | 11536 | *wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk), attrbuf); |
| 11550 | 11537 | if (IS_ERR(*wdev)) |
| 11551 | 11538 | *wdev = NULL; |
| 11552 | 11539 | |
| 11553 | 11540 | *rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk), attrbuf); |
| 11554 | − if (IS_ERR(*rdev)) { | |
| 11555 | − err = PTR_ERR(*rdev); | |
| 11556 | − goto out_unlock; | |
| 11557 | − } | |
| 11541 | + if (IS_ERR(*rdev)) | |
| 11542 | + return PTR_ERR(*rdev); | |
| 11558 | 11543 | |
| 11559 | 11544 | vid = nla_get_u32(attrbuf[NL80211_ATTR_VENDOR_ID]); |
| 11560 | 11545 | subcmd = nla_get_u32(attrbuf[NL80211_ATTR_VENDOR_SUBCMD]); |
| @@ -11567,19 +11552,15 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb, · 6 unmodified lines | ||
| 11567 | 11552 | if (vcmd->info.vendor_id != vid || vcmd->info.subcmd != subcmd) |
| 11568 | 11553 | continue; |
| 11569 | 11554 | |
| 11570 | − if (!vcmd->dumpit) { | |
| 11571 | − err = -EOPNOTSUPP; | |
| 11572 | − goto out_unlock; | |
| 11573 | − } | |
| 11555 | + if (!vcmd->dumpit) | |
| 11556 | + return -EOPNOTSUPP; | |
| 11574 | 11557 | |
| 11575 | 11558 | vcmd_idx = i; |
| 11576 | 11559 | break; |
| 11577 | 11560 | } |
| 11578 | 11561 | |
| 11579 | − if (vcmd_idx < 0) { | |
| 11580 | − err = -EOPNOTSUPP; | |
| 11581 | − goto out_unlock; | |
| 11582 | − } | |
| 11562 | + if (vcmd_idx < 0) | |
| 11563 | + return -EOPNOTSUPP; | |
| 11583 | 11564 | |
| 11584 | 11565 | if (attrbuf[NL80211_ATTR_VENDOR_DATA]) { |
| 11585 | 11566 | data = nla_data(attrbuf[NL80211_ATTR_VENDOR_DATA]); |
| @@ -11596,9 +11577,6 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb, · 10 unmodified lines | ||
| 11596 | 11577 | |
| 11597 | 11578 | /* keep rtnl locked in successful case */ |
| 11598 | 11579 | return 0; |
| 11599 | − out_unlock: | |
| 11600 | − rtnl_unlock(); | |
| 11601 | − return err; | |
| 11602 | 11580 | } |
| 11603 | 11581 | |
| 11604 | 11582 | static int nl80211_vendor_cmd_dump(struct sk_buff *skb, |
| @@ -11613,9 +11591,10 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb, · 8 unmodified lines | ||
| 11613 | 11591 | int err; |
| 11614 | 11592 | struct nlattr *vendor_data; |
| 11615 | 11593 | |
| 11594 | + rtnl_lock(); | |
| 11616 | 11595 | err = nl80211_prepare_vendor_dump(skb, cb, &rdev, &wdev); |
| 11617 | 11596 | if (err) |
| 11618 | − return err; | |
| 11597 | + goto out; | |
| 11619 | 11598 | |
| 11620 | 11599 | vcmd_idx = cb->args[2]; |
| 11621 | 11600 | data = (void *)cb->args[3]; |
| @@ -11624,15 +11603,21 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb, · 2 unmodified lines | ||
| 11624 | 11603 | |
| 11625 | 11604 | if (vcmd->flags & (WIPHY_VENDOR_CMD_NEED_WDEV | |
| 11626 | 11605 | WIPHY_VENDOR_CMD_NEED_NETDEV)) { |
| 11627 | − if (!wdev) | |
| 11628 | − return -EINVAL; | |
| 11606 | + if (!wdev) { | |
| 11607 | + err = -EINVAL; | |
| 11608 | + goto out; | |
| 11609 | + } | |
| 11629 | 11610 | if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_NETDEV && |
| 11630 | − !wdev->netdev) | |
| 11631 | − return -EINVAL; | |
| 11611 | + !wdev->netdev) { | |
| 11612 | + err = -EINVAL; | |
| 11613 | + goto out; | |
| 11614 | + } | |
| 11632 | 11615 | |
| 11633 | 11616 | if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) { |
| 11634 | − if (!wdev_running(wdev)) | |
| 11635 | − return -ENETDOWN; | |
| 11617 | + if (!wdev_running(wdev)) { | |
| 11618 | + err = -ENETDOWN; | |
| 11619 | + goto out; | |
| 11620 | + } | |
| 11636 | 11621 | } |
| 11637 | 11622 | } |
| 11638 | 11623 | |
| @@ -1832,6 +1832,7 @@ static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client, · 1831 unmodified lines | ||
| 1832 | 1832 | info->output_pool != client->pool->size)) { |
| 1833 | 1833 | if (snd_seq_write_pool_allocated(client)) { |
| 1834 | 1834 | /* remove all existing cells */ |
| 1835 | + snd_seq_pool_mark_closing(client->pool); | |
| 1835 | 1836 | snd_seq_queue_client_leave_cells(client->number); |
| 1836 | 1837 | snd_seq_pool_done(client->pool); |
| 1837 | 1838 | } |
| @@ -72,6 +72,9 @@ void snd_seq_fifo_delete(struct snd_seq_fifo **fifo) · 71 unmodified lines | ||
| 72 | 72 | return; |
| 73 | 73 | *fifo = NULL; |
| 74 | 74 | |
| 75 | + if (f->pool) | |
| 76 | + snd_seq_pool_mark_closing(f->pool); | |
| 77 | + | |
| 75 | 78 | snd_seq_fifo_clear(f); |
| 76 | 79 | |
| 77 | 80 | /* wake up clients if any */ |
| @@ -415,6 +415,18 @@ int snd_seq_pool_init(struct snd_seq_pool *pool) · 414 unmodified lines | ||
| 415 | 415 | return 0; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | +/* refuse the further insertion to the pool */ | |
| 419 | +void snd_seq_pool_mark_closing(struct snd_seq_pool *pool) | |
| 420 | +{ | |
| 421 | + unsigned long flags; | |
| 422 | + | |
| 423 | + if (snd_BUG_ON(!pool)) | |
| 424 | + return; | |
| 425 | + spin_lock_irqsave(&pool->lock, flags); | |
| 426 | + pool->closing = 1; | |
| 427 | + spin_unlock_irqrestore(&pool->lock, flags); | |
| 428 | +} | |
| 429 | + | |
| 418 | 430 | /* remove events */ |
| 419 | 431 | int snd_seq_pool_done(struct snd_seq_pool *pool) |
| 420 | 432 | { |
| @@ -425,10 +437,6 @@ int snd_seq_pool_done(struct snd_seq_pool *pool) · 4 unmodified lines | ||
| 425 | 437 | return -EINVAL; |
| 426 | 438 | |
| 427 | 439 | /* wait for closing all threads */ |
| 428 | − spin_lock_irqsave(&pool->lock, flags); | |
| 429 | − pool->closing = 1; | |
| 430 | − spin_unlock_irqrestore(&pool->lock, flags); | |
| 431 | − | |
| 432 | 440 | if (waitqueue_active(&pool->output_sleep)) |
| 433 | 441 | wake_up(&pool->output_sleep); |
| 434 | 442 | |
| @@ -485,6 +493,7 @@ int snd_seq_pool_delete(struct snd_seq_pool **ppool) · 50 unmodified lines | ||
| 485 | 493 | *ppool = NULL; |
| 486 | 494 | if (pool == NULL) |
| 487 | 495 | return 0; |
| 496 | + snd_seq_pool_mark_closing(pool); | |
| 488 | 497 | snd_seq_pool_done(pool); |
| 489 | 498 | kfree(pool); |
| 490 | 499 | return 0; |
| @@ -84,6 +84,7 @@ static inline int snd_seq_total_cells(struct snd_seq_pool *pool) · 83 unmodified lines | ||
| 84 | 84 | int snd_seq_pool_init(struct snd_seq_pool *pool); |
| 85 | 85 | |
| 86 | 86 | /* done pool - free events */ |
| 87 | +void snd_seq_pool_mark_closing(struct snd_seq_pool *pool); | |
| 87 | 88 | int snd_seq_pool_done(struct snd_seq_pool *pool); |
| 88 | 89 | |
| 89 | 90 | /* create pool */ |
| @@ -1905,7 +1905,7 @@ static int hw_card_start(struct hw *hw) · 1904 unmodified lines | ||
| 1905 | 1905 | return err; |
| 1906 | 1906 | |
| 1907 | 1907 | /* Set DMA transfer mask */ |
| 1908 | − if (dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) { | |
| 1908 | + if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) { | |
| 1909 | 1909 | dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits)); |
| 1910 | 1910 | } else { |
| 1911 | 1911 | dma_set_mask(&pci->dev, DMA_BIT_MASK(32)); |
| @@ -261,6 +261,7 @@ enum { · 260 unmodified lines | ||
| 261 | 261 | CXT_FIXUP_HP_530, |
| 262 | 262 | CXT_FIXUP_CAP_MIX_AMP_5047, |
| 263 | 263 | CXT_FIXUP_MUTE_LED_EAPD, |
| 264 | + CXT_FIXUP_HP_DOCK, | |
| 264 | 265 | CXT_FIXUP_HP_SPECTRE, |
| 265 | 266 | CXT_FIXUP_HP_GATE_MIC, |
| 266 | 267 | }; |
| @@ -778,6 +779,14 @@ static const struct hda_fixup cxt_fixups[] = { · 511 unmodified lines | ||
| 778 | 779 | .type = HDA_FIXUP_FUNC, |
| 779 | 780 | .v.func = cxt_fixup_mute_led_eapd, |
| 780 | 781 | }, |
| 782 | + [CXT_FIXUP_HP_DOCK] = { | |
| 783 | + .type = HDA_FIXUP_PINS, | |
| 784 | + .v.pins = (const struct hda_pintbl[]) { | |
| 785 | + { 0x16, 0x21011020 }, /* line-out */ | |
| 786 | + { 0x18, 0x2181103f }, /* line-in */ | |
| 787 | + { } | |
| 788 | + } | |
| 789 | + }, | |
| 781 | 790 | [CXT_FIXUP_HP_SPECTRE] = { |
| 782 | 791 | .type = HDA_FIXUP_PINS, |
| 783 | 792 | .v.pins = (const struct hda_pintbl[]) { |
| @@ -839,6 +848,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { · 55 unmodified lines | ||
| 839 | 848 | SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC), |
| 840 | 849 | SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC), |
| 841 | 850 | SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC), |
| 851 | + SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK), | |
| 842 | 852 | SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), |
| 843 | 853 | SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), |
| 844 | 854 | SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), |
| @@ -871,6 +881,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = { · 26 unmodified lines | ||
| 871 | 881 | { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, |
| 872 | 882 | { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, |
| 873 | 883 | { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" }, |
| 884 | + { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" }, | |
| 874 | 885 | {} |
| 875 | 886 | }; |
| 876 | 887 | |
| @@ -4847,6 +4847,7 @@ enum { · 4846 unmodified lines | ||
| 4847 | 4847 | ALC286_FIXUP_HP_GPIO_LED, |
| 4848 | 4848 | ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, |
| 4849 | 4849 | ALC280_FIXUP_HP_DOCK_PINS, |
| 4850 | + ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, | |
| 4850 | 4851 | ALC280_FIXUP_HP_9480M, |
| 4851 | 4852 | ALC288_FIXUP_DELL_HEADSET_MODE, |
| 4852 | 4853 | ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, |
| @@ -5388,6 +5389,16 @@ static const struct hda_fixup alc269_fixups[] = { · 535 unmodified lines | ||
| 5388 | 5389 | .chained = true, |
| 5389 | 5390 | .chain_id = ALC280_FIXUP_HP_GPIO4 |
| 5390 | 5391 | }, |
| 5392 | + [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = { | |
| 5393 | + .type = HDA_FIXUP_PINS, | |
| 5394 | + .v.pins = (const struct hda_pintbl[]) { | |
| 5395 | + { 0x1b, 0x21011020 }, /* line-out */ | |
| 5396 | + { 0x18, 0x2181103f }, /* line-in */ | |
| 5397 | + { }, | |
| 5398 | + }, | |
| 5399 | + .chained = true, | |
| 5400 | + .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED | |
| 5401 | + }, | |
| 5391 | 5402 | [ALC280_FIXUP_HP_9480M] = { |
| 5392 | 5403 | .type = HDA_FIXUP_FUNC, |
| 5393 | 5404 | .v.func = alc280_fixup_hp_9480m, |
| @@ -5647,7 +5658,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 253 unmodified lines | ||
| 5647 | 5658 | SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
| 5648 | 5659 | SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
| 5649 | 5660 | SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
| 5650 | − SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
| 5661 | + SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED), | |
| 5651 | 5662 | SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
| 5652 | 5663 | SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
| 5653 | 5664 | SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
| @@ -5816,6 +5827,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { · 162 unmodified lines | ||
| 5816 | 5827 | {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"}, |
| 5817 | 5828 | {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"}, |
| 5818 | 5829 | {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, |
| 5830 | + {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"}, | |
| 5819 | 5831 | {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, |
| 5820 | 5832 | {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"}, |
| 5821 | 5833 | {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"}, |
| @@ -6090,6 +6102,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 268 unmodified lines | ||
| 6090 | 6102 | ALC295_STANDARD_PINS, |
| 6091 | 6103 | {0x17, 0x21014040}, |
| 6092 | 6104 | {0x18, 0x21a19050}), |
| 6105 | + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | |
| 6106 | + ALC295_STANDARD_PINS), | |
| 6093 | 6107 | SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 6094 | 6108 | ALC298_STANDARD_PINS, |
| 6095 | 6109 | {0x17, 0x90170110}), |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | menuconfig SND_X86 |
| 2 | − tristate "X86 sound devices" | |
| 2 | + bool "X86 sound devices" | |
| 3 | 3 | depends on X86 |
| 4 | + default y | |
| 4 | 5 | ---help--- |
| 5 | 6 | X86 sound devices that don't fall under SoC or PCI categories |
| 6 | 7 | |
| @@ -1,22 +1,23 @@ | ||
| 1 | 1 | LIBDIR := ../../../lib |
| 2 | −BPFOBJ := $(LIBDIR)/bpf/bpf.o | |
| 2 | +BPFDIR := $(LIBDIR)/bpf | |
| 3 | 3 | |
| 4 | −CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I$(LIBDIR) $(BPFOBJ) | |
| 4 | +CFLAGS += -Wall -O2 -I../../../include/uapi -I$(LIBDIR) | |
| 5 | +LDLIBS += -lcap | |
| 5 | 6 | |
| 6 | 7 | TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map |
| 7 | 8 | |
| 8 | 9 | TEST_PROGS := test_kmod.sh |
| 9 | 10 | |
| 10 | −all: $(TEST_GEN_PROGS) | |
| 11 | +include ../lib.mk | |
| 12 | + | |
| 13 | +BPFOBJ := $(OUTPUT)/bpf.o | |
| 14 | + | |
| 15 | +$(TEST_GEN_PROGS): $(BPFOBJ) | |
| 11 | 16 | |
| 12 | −.PHONY: all clean force | |
| 17 | +.PHONY: force | |
| 13 | 18 | |
| 14 | 19 | # force a rebuild of BPFOBJ when its dependencies are updated |
| 15 | 20 | force: |
| 16 | 21 | |
| 17 | 22 | $(BPFOBJ): force |
| 18 | − $(MAKE) -C $(dir $(BPFOBJ)) | |
| 19 | − | |
| 20 | −$(test_objs): $(BPFOBJ) | |
| 21 | − | |
| 22 | −include ../lib.mk | |
| 23 | + $(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/ | |
| @@ -80,8 +80,9 @@ static void test_hashmap(int task, void *data) · 79 unmodified lines | ||
| 80 | 80 | assert(bpf_map_update_elem(fd, &key, &value, BPF_EXIST) == 0); |
| 81 | 81 | key = 2; |
| 82 | 82 | assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0); |
| 83 | − key = 1; | |
| 84 | − assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0); | |
| 83 | + key = 3; | |
| 84 | + assert(bpf_map_update_elem(fd, &key, &value, BPF_NOEXIST) == -1 && | |
| 85 | + errno == E2BIG); | |
| 85 | 86 | |
| 86 | 87 | /* Check that key = 0 doesn't exist. */ |
| 87 | 88 | key = 0; |
| @@ -110,6 +111,24 @@ static void test_hashmap(int task, void *data) · 22 unmodified lines | ||
| 110 | 111 | close(fd); |
| 111 | 112 | } |
| 112 | 113 | |
| 114 | +static void test_hashmap_sizes(int task, void *data) | |
| 115 | +{ | |
| 116 | + int fd, i, j; | |
| 117 | + | |
| 118 | + for (i = 1; i <= 512; i <<= 1) | |
| 119 | + for (j = 1; j <= 1 << 18; j <<= 1) { | |
| 120 | + fd = bpf_create_map(BPF_MAP_TYPE_HASH, i, j, | |
| 121 | + 2, map_flags); | |
| 122 | + if (fd < 0) { | |
| 123 | + printf("Failed to create hashmap key=%d value=%d '%s'\n", | |
| 124 | + i, j, strerror(errno)); | |
| 125 | + exit(1); | |
| 126 | + } | |
| 127 | + close(fd); | |
| 128 | + usleep(10); /* give kernel time to destroy */ | |
| 129 | + } | |
| 130 | +} | |
| 131 | + | |
| 113 | 132 | static void test_hashmap_percpu(int task, void *data) |
| 114 | 133 | { |
| 115 | 134 | unsigned int nr_cpus = bpf_num_possible_cpus(); |
| @@ -317,7 +336,10 @@ static void test_arraymap_percpu(int task, void *data) · 201 unmodified lines | ||
| 317 | 336 | static void test_arraymap_percpu_many_keys(void) |
| 318 | 337 | { |
| 319 | 338 | unsigned int nr_cpus = bpf_num_possible_cpus(); |
| 320 | − unsigned int nr_keys = 20000; | |
| 339 | + /* nr_keys is not too large otherwise the test stresses percpu | |
| 340 | + * allocator more than anything else | |
| 341 | + */ | |
| 342 | + unsigned int nr_keys = 2000; | |
| 321 | 343 | long values[nr_cpus]; |
| 322 | 344 | int key, fd, i; |
| 323 | 345 | |
| @@ -419,6 +441,7 @@ static void test_map_stress(void) · 95 unmodified lines | ||
| 419 | 441 | { |
| 420 | 442 | run_parallel(100, test_hashmap, NULL); |
| 421 | 443 | run_parallel(100, test_hashmap_percpu, NULL); |
| 444 | + run_parallel(100, test_hashmap_sizes, NULL); | |
| 422 | 445 | |
| 423 | 446 | run_parallel(100, test_arraymap, NULL); |
| 424 | 447 | run_parallel(100, test_arraymap_percpu, NULL); |