The conflicts were two cases of overlapping changes in batman-adv and the qed driver.
Unified · Split
| @@ -866,6 +866,15 @@ · 865 unmodified lines | ||
| 866 | 866 | |
| 867 | 867 | dscc4.setup= [NET] |
| 868 | 868 | |
| 869 | + dt_cpu_ftrs= [PPC] | |
| 870 | + Format: {"off" | "known"} | |
| 871 | + Control how the dt_cpu_ftrs device-tree binding is | |
| 872 | + used for CPU feature discovery and setup (if it | |
| 873 | + exists). | |
| 874 | + off: Do not use it, fall back to legacy cpu table. | |
| 875 | + known: Do not pass through unknown features to guests | |
| 876 | + or userspace, only those that the kernel is aware of. | |
| 877 | + | |
| 869 | 878 | dump_apple_properties [X86] |
| 870 | 879 | Dump name and content of EFI device properties on |
| 871 | 880 | x86 Macs. Useful for driver authors to determine |
| @@ -10,6 +10,7 @@ Required properties: · 9 unmodified lines | ||
| 10 | 10 | - "rockchip,rk3288-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3288 Soc; |
| 11 | 11 | - "lantiq,arx100-usb": The DWC2 USB controller instance in Lantiq ARX SoCs; |
| 12 | 12 | - "lantiq,xrx200-usb": The DWC2 USB controller instance in Lantiq XRX SoCs; |
| 13 | + - "amlogic,meson8-usb": The DWC2 USB controller instance in Amlogic Meson8 SoCs; | |
| 13 | 14 | - "amlogic,meson8b-usb": The DWC2 USB controller instance in Amlogic Meson8b SoCs; |
| 14 | 15 | - "amlogic,meson-gxbb-usb": The DWC2 USB controller instance in Amlogic S905 SoCs; |
| 15 | 16 | - "amcc,dwc-otg": The DWC2 USB controller instance in AMCC Canyonlands 460EX SoCs; |
| @@ -122,7 +122,7 @@ associated flow of the packet. The hash is either provided by hardware · 121 unmodified lines | ||
| 122 | 122 | or will be computed in the stack. Capable hardware can pass the hash in |
| 123 | 123 | the receive descriptor for the packet; this would usually be the same |
| 124 | 124 | hash used for RSS (e.g. computed Toeplitz hash). The hash is saved in |
| 125 | −skb->rx_hash and can be used elsewhere in the stack as a hash of the | |
| 125 | +skb->hash and can be used elsewhere in the stack as a hash of the | |
| 126 | 126 | packet’s flow. |
| 127 | 127 | |
| 128 | 128 | Each receive hardware queue has an associated list of CPUs to which |
| @@ -1172,7 +1172,7 @@ N: clps711x · 1171 unmodified lines | ||
| 1172 | 1172 | |
| 1173 | 1173 | ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE |
| 1174 | 1174 | M: Hartley Sweeten <hsweeten@visionengravers.com> |
| 1175 | −M: Ryan Mallon <rmallon@gmail.com> | |
| 1175 | +M: Alexander Sverdlin <alexander.sverdlin@gmail.com> | |
| 1176 | 1176 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1177 | 1177 | S: Maintained |
| 1178 | 1178 | F: arch/arm/mach-ep93xx/ |
| @@ -1489,13 +1489,15 @@ M: Gregory Clement <gregory.clement@free-electrons.com> · 310 unmodified lines | ||
| 1489 | 1489 | M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> |
| 1490 | 1490 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1491 | 1491 | S: Maintained |
| 1492 | −F: arch/arm/mach-mvebu/ | |
| 1493 | −F: drivers/rtc/rtc-armada38x.c | |
| 1494 | 1492 | F: arch/arm/boot/dts/armada* |
| 1495 | 1493 | F: arch/arm/boot/dts/kirkwood* |
| 1494 | +F: arch/arm/configs/mvebu_*_defconfig | |
| 1495 | +F: arch/arm/mach-mvebu/ | |
| 1496 | 1496 | F: arch/arm64/boot/dts/marvell/armada* |
| 1497 | 1497 | F: drivers/cpufreq/mvebu-cpufreq.c |
| 1498 | −F: arch/arm/configs/mvebu_*_defconfig | |
| 1498 | +F: drivers/irqchip/irq-armada-370-xp.c | |
| 1499 | +F: drivers/irqchip/irq-mvebu-* | |
| 1500 | +F: drivers/rtc/rtc-armada38x.c | |
| 1499 | 1501 | |
| 1500 | 1502 | ARM/Marvell Berlin SoC support |
| 1501 | 1503 | M: Jisheng Zhang <jszhang@marvell.com> |
| @@ -1721,7 +1723,6 @@ N: rockchip · 219 unmodified lines | ||
| 1721 | 1723 | ARM/SAMSUNG EXYNOS ARM ARCHITECTURES |
| 1722 | 1724 | M: Kukjin Kim <kgene@kernel.org> |
| 1723 | 1725 | M: Krzysztof Kozlowski <krzk@kernel.org> |
| 1724 | −R: Javier Martinez Canillas <javier@osg.samsung.com> | |
| 1725 | 1726 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1726 | 1727 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
| 1727 | 1728 | Q: https://patchwork.kernel.org/project/linux-samsung-soc/list/ |
| @@ -1829,7 +1830,6 @@ F: drivers/edac/altera_edac. · 101 unmodified lines | ||
| 1829 | 1830 | ARM/STI ARCHITECTURE |
| 1830 | 1831 | M: Patrice Chotard <patrice.chotard@st.com> |
| 1831 | 1832 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1832 | −L: kernel@stlinux.com | |
| 1833 | 1833 | W: http://www.stlinux.com |
| 1834 | 1834 | S: Maintained |
| 1835 | 1835 | F: arch/arm/mach-sti/ |
| @@ -5622,7 +5622,7 @@ F: scripts/get_maintainer.pl · 3786 unmodified lines | ||
| 5622 | 5622 | |
| 5623 | 5623 | GENWQE (IBM Generic Workqueue Card) |
| 5624 | 5624 | M: Frank Haverkamp <haver@linux.vnet.ibm.com> |
| 5625 | −M: Gabriel Krisman Bertazi <krisman@linux.vnet.ibm.com> | |
| 5625 | +M: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> | |
| 5626 | 5626 | S: Supported |
| 5627 | 5627 | F: drivers/misc/genwqe/ |
| 5628 | 5628 | |
| @@ -5667,7 +5667,6 @@ F: tools/testing/selftests/gpio/ · 38 unmodified lines | ||
| 5667 | 5667 | |
| 5668 | 5668 | GPIO SUBSYSTEM |
| 5669 | 5669 | M: Linus Walleij <linus.walleij@linaro.org> |
| 5670 | −M: Alexandre Courbot <gnurou@gmail.com> | |
| 5671 | 5670 | L: linux-gpio@vger.kernel.org |
| 5672 | 5671 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git |
| 5673 | 5672 | S: Maintained |
| @@ -7708,7 +7707,7 @@ F: drivers/platform/x86/hp_accel.c · 2034 unmodified lines | ||
| 7708 | 7707 | |
| 7709 | 7708 | LIVE PATCHING |
| 7710 | 7709 | M: Josh Poimboeuf <jpoimboe@redhat.com> |
| 7711 | −M: Jessica Yu <jeyu@redhat.com> | |
| 7710 | +M: Jessica Yu <jeyu@kernel.org> | |
| 7712 | 7711 | M: Jiri Kosina <jikos@kernel.org> |
| 7713 | 7712 | M: Miroslav Benes <mbenes@suse.cz> |
| 7714 | 7713 | R: Petr Mladek <pmladek@suse.com> |
| @@ -8623,7 +8622,7 @@ S: Maintained · 908 unmodified lines | ||
| 8623 | 8622 | F: drivers/media/dvb-frontends/mn88473* |
| 8624 | 8623 | |
| 8625 | 8624 | MODULE SUPPORT |
| 8626 | −M: Jessica Yu <jeyu@redhat.com> | |
| 8625 | +M: Jessica Yu <jeyu@kernel.org> | |
| 8627 | 8626 | M: Rusty Russell <rusty@rustcorp.com.au> |
| 8628 | 8627 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next |
| 8629 | 8628 | S: Maintained |
| @@ -11311,7 +11310,6 @@ F: drivers/media/rc/serial_ir.c · 2681 unmodified lines | ||
| 11311 | 11310 | |
| 11312 | 11311 | STI CEC DRIVER |
| 11313 | 11312 | M: Benjamin Gaignard <benjamin.gaignard@linaro.org> |
| 11314 | −L: kernel@stlinux.com | |
| 11315 | 11313 | S: Maintained |
| 11316 | 11314 | F: drivers/staging/media/st-cec/ |
| 11317 | 11315 | F: Documentation/devicetree/bindings/media/stih-cec.txt |
| @@ -11821,6 +11819,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci.git · 503 unmodified lines | ||
| 11821 | 11819 | S: Supported |
| 11822 | 11820 | F: arch/arm/mach-davinci/ |
| 11823 | 11821 | F: drivers/i2c/busses/i2c-davinci.c |
| 11822 | +F: arch/arm/boot/dts/da850* | |
| 11824 | 11823 | |
| 11825 | 11824 | TI DAVINCI SERIES MEDIA DRIVER |
| 11826 | 11825 | M: "Lad, Prabhakar" <prabhakar.csengg@gmail.com> |
| @@ -13904,7 +13903,7 @@ S: Odd fixes · 2077 unmodified lines | ||
| 13904 | 13903 | F: drivers/net/wireless/wl3501* |
| 13905 | 13904 | |
| 13906 | 13905 | WOLFSON MICROELECTRONICS DRIVERS |
| 13907 | −L: patches@opensource.wolfsonmicro.com | |
| 13906 | +L: patches@opensource.cirrus.com | |
| 13908 | 13907 | T: git https://github.com/CirrusLogic/linux-drivers.git |
| 13909 | 13908 | W: https://github.com/CirrusLogic/linux-drivers/wiki |
| 13910 | 13909 | S: Supported |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 4 |
| 2 | 2 | PATCHLEVEL = 12 |
| 3 | 3 | SUBLEVEL = 0 |
| 4 | −EXTRAVERSION = -rc4 | |
| 4 | +EXTRAVERSION = -rc5 | |
| 5 | 5 | NAME = Fearless Coyote |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -3,6 +3,11 @@ · 2 unmodified lines | ||
| 3 | 3 | #include <dt-bindings/clock/bcm2835-aux.h> |
| 4 | 4 | #include <dt-bindings/gpio/gpio.h> |
| 5 | 5 | |
| 6 | +/* firmware-provided startup stubs live here, where the secondary CPUs are | |
| 7 | + * spinning. | |
| 8 | + */ | |
| 9 | +/memreserve/ 0x00000000 0x00001000; | |
| 10 | + | |
| 6 | 11 | /* This include file covers the common peripherals and configuration between |
| 7 | 12 | * bcm2835 and bcm2836 implementations, leaving the CPU configuration to |
| 8 | 13 | * bcm2835.dtsi and bcm2836.dtsi. |
| @@ -137,8 +137,8 @@ netcp: netcp@26000000 { · 136 unmodified lines | ||
| 137 | 137 | /* NetCP address range */ |
| 138 | 138 | ranges = <0 0x26000000 0x1000000>; |
| 139 | 139 | |
| 140 | − clocks = <&clkpa>, <&clkcpgmac>, <&chipclk12>, <&clkosr>; | |
| 141 | − clock-names = "pa_clk", "ethss_clk", "cpts", "osr_clk"; | |
| 140 | + clocks = <&clkpa>, <&clkcpgmac>, <&chipclk12>; | |
| 141 | + clock-names = "pa_clk", "ethss_clk", "cpts"; | |
| 142 | 142 | dma-coherent; |
| 143 | 143 | |
| 144 | 144 | ti,navigator-dmas = <&dma_gbe 0>, |
| @@ -232,6 +232,14 @@ · 231 unmodified lines | ||
| 232 | 232 | }; |
| 233 | 233 | }; |
| 234 | 234 | |
| 235 | + osr: sram@70000000 { | |
| 236 | + compatible = "mmio-sram"; | |
| 237 | + reg = <0x70000000 0x10000>; | |
| 238 | + #address-cells = <1>; | |
| 239 | + #size-cells = <1>; | |
| 240 | + clocks = <&clkosr>; | |
| 241 | + }; | |
| 242 | + | |
| 235 | 243 | dspgpio0: keystone_dsp_gpio@02620240 { |
| 236 | 244 | compatible = "ti,keystone-dsp-gpio"; |
| 237 | 245 | gpio-controller; |
| @@ -1,4 +1,4 @@ | ||
| 1 | −#include <versatile-ab.dts> | |
| 1 | +#include "versatile-ab.dts" | |
| 2 | 2 | |
| 3 | 3 | / { |
| 4 | 4 | model = "ARM Versatile PB"; |
| @@ -19,7 +19,8 @@ struct dev_archdata { · 18 unmodified lines | ||
| 19 | 19 | #ifdef CONFIG_XEN |
| 20 | 20 | const struct dma_map_ops *dev_dma_ops; |
| 21 | 21 | #endif |
| 22 | − bool dma_coherent; | |
| 22 | + unsigned int dma_coherent:1; | |
| 23 | + unsigned int dma_ops_setup:1; | |
| 23 | 24 | }; |
| 24 | 25 | |
| 25 | 26 | struct omap_device; |
| @@ -104,7 +104,6 @@ __do_hyp_init: · 103 unmodified lines | ||
| 104 | 104 | @ - Write permission implies XN: disabled |
| 105 | 105 | @ - Instruction cache: enabled |
| 106 | 106 | @ - Data/Unified cache: enabled |
| 107 | − @ - Memory alignment checks: enabled | |
| 108 | 107 | @ - MMU: enabled (this code must be run from an identity mapping) |
| 109 | 108 | mrc p15, 4, r0, c1, c0, 0 @ HSCR |
| 110 | 109 | ldr r2, =HSCTLR_MASK |
| @@ -112,8 +111,8 @@ __do_hyp_init: · 1 unmodified line | ||
| 112 | 111 | mrc p15, 0, r1, c1, c0, 0 @ SCTLR |
| 113 | 112 | ldr r2, =(HSCTLR_EE | HSCTLR_FI | HSCTLR_I | HSCTLR_C) |
| 114 | 113 | and r1, r1, r2 |
| 115 | − ARM( ldr r2, =(HSCTLR_M | HSCTLR_A) ) | |
| 116 | − THUMB( ldr r2, =(HSCTLR_M | HSCTLR_A | HSCTLR_TE) ) | |
| 114 | + ARM( ldr r2, =(HSCTLR_M) ) | |
| 115 | + THUMB( ldr r2, =(HSCTLR_M | HSCTLR_TE) ) | |
| 117 | 116 | orr r1, r1, r2 |
| 118 | 117 | orr r0, r0, r1 |
| 119 | 118 | mcr p15, 4, r0, c1, c0, 0 @ HSCR |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | menuconfig ARCH_AT91 |
| 2 | 2 | bool "Atmel SoCs" |
| 3 | 3 | depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V7 |
| 4 | + select ARM_CPU_SUSPEND if PM | |
| 4 | 5 | select COMMON_CLK_AT91 |
| 5 | 6 | select GPIOLIB |
| 6 | 7 | select PINCTRL |
| @@ -153,7 +153,8 @@ int __init davinci_pm_init(void) · 152 unmodified lines | ||
| 153 | 153 | davinci_sram_suspend = sram_alloc(davinci_cpu_suspend_sz, NULL); |
| 154 | 154 | if (!davinci_sram_suspend) { |
| 155 | 155 | pr_err("PM: cannot allocate SRAM memory\n"); |
| 156 | − return -ENOMEM; | |
| 156 | + ret = -ENOMEM; | |
| 157 | + goto no_sram_mem; | |
| 157 | 158 | } |
| 158 | 159 | |
| 159 | 160 | davinci_sram_push(davinci_sram_suspend, davinci_cpu_suspend, |
| @@ -161,6 +162,10 @@ int __init davinci_pm_init(void) · 1 unmodified line | ||
| 161 | 162 | |
| 162 | 163 | suspend_set_ops(&davinci_pm_ops); |
| 163 | 164 | |
| 165 | + return 0; | |
| 166 | + | |
| 167 | +no_sram_mem: | |
| 168 | + iounmap(pm_config.ddrpsc_reg_base); | |
| 164 | 169 | no_ddrpsc_mem: |
| 165 | 170 | iounmap(pm_config.ddrpll_reg_base); |
| 166 | 171 | no_ddrpll_mem: |
| @@ -2311,7 +2311,14 @@ int arm_iommu_attach_device(struct device *dev, · 2310 unmodified lines | ||
| 2311 | 2311 | } |
| 2312 | 2312 | EXPORT_SYMBOL_GPL(arm_iommu_attach_device); |
| 2313 | 2313 | |
| 2314 | −static void __arm_iommu_detach_device(struct device *dev) | |
| 2314 | +/** | |
| 2315 | + * arm_iommu_detach_device | |
| 2316 | + * @dev: valid struct device pointer | |
| 2317 | + * | |
| 2318 | + * Detaches the provided device from a previously attached map. | |
| 2319 | + * This voids the dma operations (dma_map_ops pointer) | |
| 2320 | + */ | |
| 2321 | +void arm_iommu_detach_device(struct device *dev) | |
| 2315 | 2322 | { |
| 2316 | 2323 | struct dma_iommu_mapping *mapping; |
| 2317 | 2324 | |
| @@ -2324,22 +2331,10 @@ static void __arm_iommu_detach_device(struct device *dev) · 6 unmodified lines | ||
| 2324 | 2331 | iommu_detach_device(mapping->domain, dev); |
| 2325 | 2332 | kref_put(&mapping->kref, release_iommu_mapping); |
| 2326 | 2333 | to_dma_iommu_mapping(dev) = NULL; |
| 2334 | + set_dma_ops(dev, NULL); | |
| 2327 | 2335 | |
| 2328 | 2336 | pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev)); |
| 2329 | 2337 | } |
| 2330 | − | |
| 2331 | −/** | |
| 2332 | − * arm_iommu_detach_device | |
| 2333 | − * @dev: valid struct device pointer | |
| 2334 | − * | |
| 2335 | − * Detaches the provided device from a previously attached map. | |
| 2336 | − * This voids the dma operations (dma_map_ops pointer) | |
| 2337 | − */ | |
| 2338 | −void arm_iommu_detach_device(struct device *dev) | |
| 2339 | −{ | |
| 2340 | − __arm_iommu_detach_device(dev); | |
| 2341 | − set_dma_ops(dev, NULL); | |
| 2342 | −} | |
| 2343 | 2338 | EXPORT_SYMBOL_GPL(arm_iommu_detach_device); |
| 2344 | 2339 | |
| 2345 | 2340 | static const struct dma_map_ops *arm_get_iommu_dma_map_ops(bool coherent) |
| @@ -2379,7 +2374,7 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) · 33 unmodified lines | ||
| 2379 | 2374 | if (!mapping) |
| 2380 | 2375 | return; |
| 2381 | 2376 | |
| 2382 | − __arm_iommu_detach_device(dev); | |
| 2377 | + arm_iommu_detach_device(dev); | |
| 2383 | 2378 | arm_iommu_release_mapping(mapping); |
| 2384 | 2379 | } |
| 2385 | 2380 | |
| @@ -2430,9 +2425,13 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · 44 unmodified lines | ||
| 2430 | 2425 | dev->dma_ops = xen_dma_ops; |
| 2431 | 2426 | } |
| 2432 | 2427 | #endif |
| 2428 | + dev->archdata.dma_ops_setup = true; | |
| 2433 | 2429 | } |
| 2434 | 2430 | |
| 2435 | 2431 | void arch_teardown_dma_ops(struct device *dev) |
| 2436 | 2432 | { |
| 2433 | + if (!dev->archdata.dma_ops_setup) | |
| 2434 | + return; | |
| 2435 | + | |
| 2437 | 2436 | arm_teardown_iommu_dma_ops(dev); |
| 2438 | 2437 | } |
| @@ -1084,10 +1084,6 @@ config SYSVIPC_COMPAT · 1083 unmodified lines | ||
| 1084 | 1084 | def_bool y |
| 1085 | 1085 | depends on COMPAT && SYSVIPC |
| 1086 | 1086 | |
| 1087 | −config KEYS_COMPAT | |
| 1088 | − def_bool y | |
| 1089 | − depends on COMPAT && KEYS | |
| 1090 | − | |
| 1091 | 1087 | endmenu |
| 1092 | 1088 | |
| 1093 | 1089 | menu "Power management options" |
| @@ -231,8 +231,7 @@ · 230 unmodified lines | ||
| 231 | 231 | cpm_crypto: crypto@800000 { |
| 232 | 232 | compatible = "inside-secure,safexcel-eip197"; |
| 233 | 233 | reg = <0x800000 0x200000>; |
| 234 | − interrupts = <GIC_SPI 34 (IRQ_TYPE_EDGE_RISING | |
| 235 | − | IRQ_TYPE_LEVEL_HIGH)>, | |
| 234 | + interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, | |
| 236 | 235 | <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>, |
| 237 | 236 | <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>, |
| 238 | 237 | <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>, |
| @@ -221,8 +221,7 @@ · 220 unmodified lines | ||
| 221 | 221 | cps_crypto: crypto@800000 { |
| 222 | 222 | compatible = "inside-secure,safexcel-eip197"; |
| 223 | 223 | reg = <0x800000 0x200000>; |
| 224 | − interrupts = <GIC_SPI 34 (IRQ_TYPE_EDGE_RISING | |
| 225 | − | IRQ_TYPE_LEVEL_HIGH)>, | |
| 224 | + interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>, | |
| 226 | 225 | <GIC_SPI 278 IRQ_TYPE_LEVEL_HIGH>, |
| 227 | 226 | <GIC_SPI 279 IRQ_TYPE_LEVEL_HIGH>, |
| 228 | 227 | <GIC_SPI 280 IRQ_TYPE_LEVEL_HIGH>, |
| @@ -68,6 +68,7 @@ CONFIG_PCIE_QCOM=y · 67 unmodified lines | ||
| 68 | 68 | CONFIG_PCIE_ARMADA_8K=y |
| 69 | 69 | CONFIG_PCI_AARDVARK=y |
| 70 | 70 | CONFIG_PCIE_RCAR=y |
| 71 | +CONFIG_PCIE_ROCKCHIP=m | |
| 71 | 72 | CONFIG_PCI_HOST_GENERIC=y |
| 72 | 73 | CONFIG_PCI_XGENE=y |
| 73 | 74 | CONFIG_ARM64_VA_BITS_48=y |
| @@ -209,6 +210,8 @@ CONFIG_BRCMFMAC=m · 135 unmodified lines | ||
| 209 | 210 | CONFIG_WL18XX=m |
| 210 | 211 | CONFIG_WLCORE_SDIO=m |
| 211 | 212 | CONFIG_INPUT_EVDEV=y |
| 213 | +CONFIG_KEYBOARD_ADC=m | |
| 214 | +CONFIG_KEYBOARD_CROS_EC=y | |
| 212 | 215 | CONFIG_KEYBOARD_GPIO=y |
| 213 | 216 | CONFIG_INPUT_MISC=y |
| 214 | 217 | CONFIG_INPUT_PM8941_PWRKEY=y |
| @@ -264,6 +267,7 @@ CONFIG_SPI_MESON_SPIFC=m · 49 unmodified lines | ||
| 264 | 267 | CONFIG_SPI_ORION=y |
| 265 | 268 | CONFIG_SPI_PL022=y |
| 266 | 269 | CONFIG_SPI_QUP=y |
| 270 | +CONFIG_SPI_ROCKCHIP=y | |
| 267 | 271 | CONFIG_SPI_S3C64XX=y |
| 268 | 272 | CONFIG_SPI_SPIDEV=m |
| 269 | 273 | CONFIG_SPMI=y |
| @@ -293,6 +297,7 @@ CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y · 23 unmodified lines | ||
| 293 | 297 | CONFIG_CPU_THERMAL=y |
| 294 | 298 | CONFIG_THERMAL_EMULATION=y |
| 295 | 299 | CONFIG_EXYNOS_THERMAL=y |
| 300 | +CONFIG_ROCKCHIP_THERMAL=m | |
| 296 | 301 | CONFIG_WATCHDOG=y |
| 297 | 302 | CONFIG_S3C2410_WATCHDOG=y |
| 298 | 303 | CONFIG_MESON_GXBB_WATCHDOG=m |
| @@ -301,12 +306,14 @@ CONFIG_RENESAS_WDT=y · 2 unmodified lines | ||
| 301 | 306 | CONFIG_BCM2835_WDT=y |
| 302 | 307 | CONFIG_MFD_CROS_EC=y |
| 303 | 308 | CONFIG_MFD_CROS_EC_I2C=y |
| 309 | +CONFIG_MFD_CROS_EC_SPI=y | |
| 304 | 310 | CONFIG_MFD_EXYNOS_LPASS=m |
| 305 | 311 | CONFIG_MFD_HI655X_PMIC=y |
| 306 | 312 | CONFIG_MFD_MAX77620=y |
| 307 | 313 | CONFIG_MFD_SPMI_PMIC=y |
| 308 | 314 | CONFIG_MFD_RK808=y |
| 309 | 315 | CONFIG_MFD_SEC_CORE=y |
| 316 | +CONFIG_REGULATOR_FAN53555=y | |
| 310 | 317 | CONFIG_REGULATOR_FIXED_VOLTAGE=y |
| 311 | 318 | CONFIG_REGULATOR_GPIO=y |
| 312 | 319 | CONFIG_REGULATOR_HI655X=y |
| @@ -474,8 +481,10 @@ CONFIG_ARCH_TEGRA_186_SOC=y · 161 unmodified lines | ||
| 474 | 481 | CONFIG_EXTCON_USB_GPIO=y |
| 475 | 482 | CONFIG_IIO=y |
| 476 | 483 | CONFIG_EXYNOS_ADC=y |
| 484 | +CONFIG_ROCKCHIP_SARADC=m | |
| 477 | 485 | CONFIG_PWM=y |
| 478 | 486 | CONFIG_PWM_BCM2835=m |
| 487 | +CONFIG_PWM_CROS_EC=m | |
| 479 | 488 | CONFIG_PWM_MESON=m |
| 480 | 489 | CONFIG_PWM_ROCKCHIP=y |
| 481 | 490 | CONFIG_PWM_SAMSUNG=y |
| @@ -485,6 +494,7 @@ CONFIG_PHY_HI6220_USB=y · 3 unmodified lines | ||
| 485 | 494 | CONFIG_PHY_SUN4I_USB=y |
| 486 | 495 | CONFIG_PHY_ROCKCHIP_INNO_USB2=y |
| 487 | 496 | CONFIG_PHY_ROCKCHIP_EMMC=y |
| 497 | +CONFIG_PHY_ROCKCHIP_PCIE=m | |
| 488 | 498 | CONFIG_PHY_XGENE=y |
| 489 | 499 | CONFIG_PHY_TEGRA_XUSB=y |
| 490 | 500 | CONFIG_ARM_SCPI_PROTOCOL=y |
| @@ -286,6 +286,10 @@ · 285 unmodified lines | ||
| 286 | 286 | #define SCTLR_ELx_A (1 << 1) |
| 287 | 287 | #define SCTLR_ELx_M 1 |
| 288 | 288 | |
| 289 | +#define SCTLR_EL2_RES1 ((1 << 4) | (1 << 5) | (1 << 11) | (1 << 16) | \ | |
| 290 | + (1 << 16) | (1 << 18) | (1 << 22) | (1 << 23) | \ | |
| 291 | + (1 << 28) | (1 << 29)) | |
| 292 | + | |
| 289 | 293 | #define SCTLR_ELx_FLAGS (SCTLR_ELx_M | SCTLR_ELx_A | SCTLR_ELx_C | \ |
| 290 | 294 | SCTLR_ELx_SA | SCTLR_ELx_I) |
| 291 | 295 | |
| @@ -106,10 +106,13 @@ __do_hyp_init: · 105 unmodified lines | ||
| 106 | 106 | tlbi alle2 |
| 107 | 107 | dsb sy |
| 108 | 108 | |
| 109 | − mrs x4, sctlr_el2 | |
| 110 | − and x4, x4, #SCTLR_ELx_EE // preserve endianness of EL2 | |
| 111 | − ldr x5, =SCTLR_ELx_FLAGS | |
| 112 | − orr x4, x4, x5 | |
| 109 | + /* | |
| 110 | + * Preserve all the RES1 bits while setting the default flags, | |
| 111 | + * as well as the EE bit on BE. Drop the A flag since the compiler | |
| 112 | + * is allowed to generate unaligned accesses. | |
| 113 | + */ | |
| 114 | + ldr x4, =(SCTLR_EL2_RES1 | (SCTLR_ELx_FLAGS & ~SCTLR_ELx_A)) | |
| 115 | +CPU_BE( orr x4, x4, #SCTLR_ELx_EE) | |
| 113 | 116 | msr sctlr_el2, x4 |
| 114 | 117 | isb |
| 115 | 118 | |
| @@ -65,8 +65,8 @@ static bool access_gic_ctlr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 64 unmodified lines | ||
| 65 | 65 | * Here set VMCR.CTLR in ICC_CTLR_EL1 layout. |
| 66 | 66 | * The vgic_set_vmcr() will convert to ICH_VMCR layout. |
| 67 | 67 | */ |
| 68 | − vmcr.ctlr = val & ICC_CTLR_EL1_CBPR_MASK; | |
| 69 | − vmcr.ctlr |= val & ICC_CTLR_EL1_EOImode_MASK; | |
| 68 | + vmcr.cbpr = (val & ICC_CTLR_EL1_CBPR_MASK) >> ICC_CTLR_EL1_CBPR_SHIFT; | |
| 69 | + vmcr.eoim = (val & ICC_CTLR_EL1_EOImode_MASK) >> ICC_CTLR_EL1_EOImode_SHIFT; | |
| 70 | 70 | vgic_set_vmcr(vcpu, &vmcr); |
| 71 | 71 | } else { |
| 72 | 72 | val = 0; |
| @@ -83,8 +83,8 @@ static bool access_gic_ctlr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 10 unmodified lines | ||
| 83 | 83 | * The VMCR.CTLR value is in ICC_CTLR_EL1 layout. |
| 84 | 84 | * Extract it directly using ICC_CTLR_EL1 reg definitions. |
| 85 | 85 | */ |
| 86 | − val |= vmcr.ctlr & ICC_CTLR_EL1_CBPR_MASK; | |
| 87 | − val |= vmcr.ctlr & ICC_CTLR_EL1_EOImode_MASK; | |
| 86 | + val |= (vmcr.cbpr << ICC_CTLR_EL1_CBPR_SHIFT) & ICC_CTLR_EL1_CBPR_MASK; | |
| 87 | + val |= (vmcr.eoim << ICC_CTLR_EL1_EOImode_SHIFT) & ICC_CTLR_EL1_EOImode_MASK; | |
| 88 | 88 | |
| 89 | 89 | p->regval = val; |
| 90 | 90 | } |
| @@ -135,7 +135,7 @@ static bool access_gic_bpr1(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 44 unmodified lines | ||
| 135 | 135 | p->regval = 0; |
| 136 | 136 | |
| 137 | 137 | vgic_get_vmcr(vcpu, &vmcr); |
| 138 | − if (!((vmcr.ctlr & ICH_VMCR_CBPR_MASK) >> ICH_VMCR_CBPR_SHIFT)) { | |
| 138 | + if (!vmcr.cbpr) { | |
| 139 | 139 | if (p->is_write) { |
| 140 | 140 | vmcr.abpr = (p->regval & ICC_BPR1_EL1_MASK) >> |
| 141 | 141 | ICC_BPR1_EL1_SHIFT; |
| @@ -36,6 +36,7 @@ int bpf_jit_enable __read_mostly; · 35 unmodified lines | ||
| 36 | 36 | #define TMP_REG_1 (MAX_BPF_JIT_REG + 0) |
| 37 | 37 | #define TMP_REG_2 (MAX_BPF_JIT_REG + 1) |
| 38 | 38 | #define TCALL_CNT (MAX_BPF_JIT_REG + 2) |
| 39 | +#define TMP_REG_3 (MAX_BPF_JIT_REG + 3) | |
| 39 | 40 | |
| 40 | 41 | /* Map BPF registers to A64 registers */ |
| 41 | 42 | static const int bpf2a64[] = { |
| @@ -57,6 +58,7 @@ static const int bpf2a64[] = { · 15 unmodified lines | ||
| 57 | 58 | /* temporary registers for internal BPF JIT */ |
| 58 | 59 | [TMP_REG_1] = A64_R(10), |
| 59 | 60 | [TMP_REG_2] = A64_R(11), |
| 61 | + [TMP_REG_3] = A64_R(12), | |
| 60 | 62 | /* tail_call_cnt */ |
| 61 | 63 | [TCALL_CNT] = A64_R(26), |
| 62 | 64 | /* temporary register for blinding constants */ |
| @@ -319,6 +321,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) · 256 unmodified lines | ||
| 319 | 321 | const u8 src = bpf2a64[insn->src_reg]; |
| 320 | 322 | const u8 tmp = bpf2a64[TMP_REG_1]; |
| 321 | 323 | const u8 tmp2 = bpf2a64[TMP_REG_2]; |
| 324 | + const u8 tmp3 = bpf2a64[TMP_REG_3]; | |
| 322 | 325 | const s16 off = insn->off; |
| 323 | 326 | const s32 imm = insn->imm; |
| 324 | 327 | const int i = insn - ctx->prog->insnsi; |
| @@ -689,10 +692,10 @@ emit_cond_jmp: · 364 unmodified lines | ||
| 689 | 692 | emit(A64_PRFM(tmp, PST, L1, STRM), ctx); |
| 690 | 693 | emit(A64_LDXR(isdw, tmp2, tmp), ctx); |
| 691 | 694 | emit(A64_ADD(isdw, tmp2, tmp2, src), ctx); |
| 692 | − emit(A64_STXR(isdw, tmp2, tmp, tmp2), ctx); | |
| 695 | + emit(A64_STXR(isdw, tmp2, tmp, tmp3), ctx); | |
| 693 | 696 | jmp_offset = -3; |
| 694 | 697 | check_imm19(jmp_offset); |
| 695 | − emit(A64_CBNZ(0, tmp2, jmp_offset), ctx); | |
| 698 | + emit(A64_CBNZ(0, tmp3, jmp_offset), ctx); | |
| 696 | 699 | break; |
| 697 | 700 | |
| 698 | 701 | /* R0 = ntohx(*(size *)(((struct sk_buff *)R6)->data + imm)) */ |
| @@ -37,15 +37,14 @@ __kernel_size_t __clear_user_hexagon(void __user *dest, unsigned long count) · 36 unmodified lines | ||
| 37 | 37 | long uncleared; |
| 38 | 38 | |
| 39 | 39 | while (count > PAGE_SIZE) { |
| 40 | − uncleared = __copy_to_user_hexagon(dest, &empty_zero_page, | |
| 41 | − PAGE_SIZE); | |
| 40 | + uncleared = raw_copy_to_user(dest, &empty_zero_page, PAGE_SIZE); | |
| 42 | 41 | if (uncleared) |
| 43 | 42 | return count - (PAGE_SIZE - uncleared); |
| 44 | 43 | count -= PAGE_SIZE; |
| 45 | 44 | dest += PAGE_SIZE; |
| 46 | 45 | } |
| 47 | 46 | if (count) |
| 48 | − count = __copy_to_user_hexagon(dest, &empty_zero_page, count); | |
| 47 | + count = raw_copy_to_user(dest, &empty_zero_page, count); | |
| 49 | 48 | |
| 50 | 49 | return count; |
| 51 | 50 | } |
| @@ -380,22 +380,6 @@ source "arch/powerpc/platforms/Kconfig" · 379 unmodified lines | ||
| 380 | 380 | |
| 381 | 381 | menu "Kernel options" |
| 382 | 382 | |
| 383 | −config PPC_DT_CPU_FTRS | |
| 384 | − bool "Device-tree based CPU feature discovery & setup" | |
| 385 | − depends on PPC_BOOK3S_64 | |
| 386 | − default n | |
| 387 | − help | |
| 388 | − This enables code to use a new device tree binding for describing CPU | |
| 389 | − compatibility and features. Saying Y here will attempt to use the new | |
| 390 | − binding if the firmware provides it. Currently only the skiboot | |
| 391 | − firmware provides this binding. | |
| 392 | − If you're not sure say Y. | |
| 393 | − | |
| 394 | −config PPC_CPUFEATURES_ENABLE_UNKNOWN | |
| 395 | − bool "cpufeatures pass through unknown features to guest/userspace" | |
| 396 | − depends on PPC_DT_CPU_FTRS | |
| 397 | − default y | |
| 398 | − | |
| 399 | 383 | config HIGHMEM |
| 400 | 384 | bool "High memory support" |
| 401 | 385 | depends on PPC32 |
| @@ -1215,11 +1199,6 @@ source "arch/powerpc/Kconfig.debug" · 813 unmodified lines | ||
| 1215 | 1199 | |
| 1216 | 1200 | source "security/Kconfig" |
| 1217 | 1201 | |
| 1218 | −config KEYS_COMPAT | |
| 1219 | − bool | |
| 1220 | − depends on COMPAT && KEYS | |
| 1221 | − default y | |
| 1222 | − | |
| 1223 | 1202 | source "crypto/Kconfig" |
| 1224 | 1203 | |
| 1225 | 1204 | config PPC_LIB_RHEAP |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #define H_PTE_INDEX_SIZE 9 |
| 9 | 9 | #define H_PMD_INDEX_SIZE 7 |
| 10 | 10 | #define H_PUD_INDEX_SIZE 9 |
| 11 | −#define H_PGD_INDEX_SIZE 12 | |
| 11 | +#define H_PGD_INDEX_SIZE 9 | |
| 12 | 12 | |
| 13 | 13 | #ifndef __ASSEMBLY__ |
| 14 | 14 | #define H_PTE_TABLE_SIZE (sizeof(pte_t) << H_PTE_INDEX_SIZE) |
| @@ -214,7 +214,6 @@ enum { · 213 unmodified lines | ||
| 214 | 214 | #define CPU_FTR_DAWR LONG_ASM_CONST(0x0400000000000000) |
| 215 | 215 | #define CPU_FTR_DABRX LONG_ASM_CONST(0x0800000000000000) |
| 216 | 216 | #define CPU_FTR_PMAO_BUG LONG_ASM_CONST(0x1000000000000000) |
| 217 | −#define CPU_FTR_SUBCORE LONG_ASM_CONST(0x2000000000000000) | |
| 218 | 217 | #define CPU_FTR_POWER9_DD1 LONG_ASM_CONST(0x4000000000000000) |
| 219 | 218 | |
| 220 | 219 | #ifndef __ASSEMBLY__ |
| @@ -463,7 +462,7 @@ enum { · 242 unmodified lines | ||
| 463 | 462 | CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ |
| 464 | 463 | CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ |
| 465 | 464 | CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \ |
| 466 | − CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP | CPU_FTR_SUBCORE) | |
| 465 | + CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP) | |
| 467 | 466 | #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG) |
| 468 | 467 | #define CPU_FTRS_POWER8_DD1 (CPU_FTRS_POWER8 & ~CPU_FTR_DBELL) |
| 469 | 468 | #define CPU_FTRS_POWER9 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
| @@ -110,13 +110,18 @@ void release_thread(struct task_struct *); · 109 unmodified lines | ||
| 110 | 110 | #define TASK_SIZE_128TB (0x0000800000000000UL) |
| 111 | 111 | #define TASK_SIZE_512TB (0x0002000000000000UL) |
| 112 | 112 | |
| 113 | −#ifdef CONFIG_PPC_BOOK3S_64 | |
| 113 | +/* | |
| 114 | + * For now 512TB is only supported with book3s and 64K linux page size. | |
| 115 | + */ | |
| 116 | +#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_64K_PAGES) | |
| 114 | 117 | /* |
| 115 | 118 | * Max value currently used: |
| 116 | 119 | */ |
| 117 | −#define TASK_SIZE_USER64 TASK_SIZE_512TB | |
| 120 | +#define TASK_SIZE_USER64 TASK_SIZE_512TB | |
| 121 | +#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_128TB | |
| 118 | 122 | #else |
| 119 | −#define TASK_SIZE_USER64 TASK_SIZE_64TB | |
| 123 | +#define TASK_SIZE_USER64 TASK_SIZE_64TB | |
| 124 | +#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_64TB | |
| 120 | 125 | #endif |
| 121 | 126 | |
| 122 | 127 | /* |
| @@ -132,7 +137,7 @@ void release_thread(struct task_struct *); · 9 unmodified lines | ||
| 132 | 137 | * space during mmap's. |
| 133 | 138 | */ |
| 134 | 139 | #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) |
| 135 | −#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_128TB / 4)) | |
| 140 | +#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4)) | |
| 136 | 141 | |
| 137 | 142 | #define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \ |
| 138 | 143 | TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 ) |
| @@ -143,21 +148,15 @@ void release_thread(struct task_struct *); · 4 unmodified lines | ||
| 143 | 148 | * with 128TB and conditionally enable upto 512TB |
| 144 | 149 | */ |
| 145 | 150 | #ifdef CONFIG_PPC_BOOK3S_64 |
| 146 | −#define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \ | |
| 147 | − TASK_SIZE_USER32 : TASK_SIZE_128TB) | |
| 151 | +#define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \ | |
| 152 | + TASK_SIZE_USER32 : DEFAULT_MAP_WINDOW_USER64) | |
| 148 | 153 | #else |
| 149 | 154 | #define DEFAULT_MAP_WINDOW TASK_SIZE |
| 150 | 155 | #endif |
| 151 | 156 | |
| 152 | 157 | #ifdef __powerpc64__ |
| 153 | 158 | |
| 154 | −#ifdef CONFIG_PPC_BOOK3S_64 | |
| 155 | −/* Limit stack to 128TB */ | |
| 156 | −#define STACK_TOP_USER64 TASK_SIZE_128TB | |
| 157 | −#else | |
| 158 | −#define STACK_TOP_USER64 TASK_SIZE_USER64 | |
| 159 | −#endif | |
| 160 | − | |
| 159 | +#define STACK_TOP_USER64 DEFAULT_MAP_WINDOW_USER64 | |
| 161 | 160 | #define STACK_TOP_USER32 TASK_SIZE_USER32 |
| 162 | 161 | |
| 163 | 162 | #define STACK_TOP (is_32bit_task() ? \ |
| @@ -44,8 +44,22 @@ extern void __init dump_numa_cpu_topology(void); · 43 unmodified lines | ||
| 44 | 44 | extern int sysfs_add_device_to_node(struct device *dev, int nid); |
| 45 | 45 | extern void sysfs_remove_device_from_node(struct device *dev, int nid); |
| 46 | 46 | |
| 47 | +static inline int early_cpu_to_node(int cpu) | |
| 48 | +{ | |
| 49 | + int nid; | |
| 50 | + | |
| 51 | + nid = numa_cpu_lookup_table[cpu]; | |
| 52 | + | |
| 53 | + /* | |
| 54 | + * Fall back to node 0 if nid is unset (it should be, except bugs). | |
| 55 | + * This allows callers to safely do NODE_DATA(early_cpu_to_node(cpu)). | |
| 56 | + */ | |
| 57 | + return (nid < 0) ? 0 : nid; | |
| 58 | +} | |
| 47 | 59 | #else |
| 48 | 60 | |
| 61 | +static inline int early_cpu_to_node(int cpu) { return 0; } | |
| 62 | + | |
| 49 | 63 | static inline void dump_numa_cpu_topology(void) {} |
| 50 | 64 | |
| 51 | 65 | static inline int sysfs_add_device_to_node(struct device *dev, int nid) |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | #include <linux/export.h> |
| 9 | 9 | #include <linux/init.h> |
| 10 | 10 | #include <linux/jump_label.h> |
| 11 | +#include <linux/libfdt.h> | |
| 11 | 12 | #include <linux/memblock.h> |
| 12 | 13 | #include <linux/printk.h> |
| 13 | 14 | #include <linux/sched.h> |
| @@ -642,7 +643,6 @@ static struct dt_cpu_feature_match __initdata · 628 unmodified lines | ||
| 642 | 643 | {"processor-control-facility", feat_enable_dbell, CPU_FTR_DBELL}, |
| 643 | 644 | {"processor-control-facility-v3", feat_enable_dbell, CPU_FTR_DBELL}, |
| 644 | 645 | {"processor-utilization-of-resources-register", feat_enable_purr, 0}, |
| 645 | − {"subcore", feat_enable, CPU_FTR_SUBCORE}, | |
| 646 | 646 | {"no-execute", feat_enable, 0}, |
| 647 | 647 | {"strong-access-ordering", feat_enable, CPU_FTR_SAO}, |
| 648 | 648 | {"cache-inhibited-large-page", feat_enable_large_ci, 0}, |
| @@ -671,12 +671,24 @@ static struct dt_cpu_feature_match __initdata · 22 unmodified lines | ||
| 671 | 671 | {"wait-v3", feat_enable, 0}, |
| 672 | 672 | }; |
| 673 | 673 | |
| 674 | −/* XXX: how to configure this? Default + boot time? */ | |
| 675 | −#ifdef CONFIG_PPC_CPUFEATURES_ENABLE_UNKNOWN | |
| 676 | −#define CPU_FEATURE_ENABLE_UNKNOWN 1 | |
| 677 | −#else | |
| 678 | −#define CPU_FEATURE_ENABLE_UNKNOWN 0 | |
| 679 | −#endif | |
| 674 | +static bool __initdata using_dt_cpu_ftrs; | |
| 675 | +static bool __initdata enable_unknown = true; | |
| 676 | + | |
| 677 | +static int __init dt_cpu_ftrs_parse(char *str) | |
| 678 | +{ | |
| 679 | + if (!str) | |
| 680 | + return 0; | |
| 681 | + | |
| 682 | + if (!strcmp(str, "off")) | |
| 683 | + using_dt_cpu_ftrs = false; | |
| 684 | + else if (!strcmp(str, "known")) | |
| 685 | + enable_unknown = false; | |
| 686 | + else | |
| 687 | + return 1; | |
| 688 | + | |
| 689 | + return 0; | |
| 690 | +} | |
| 691 | +early_param("dt_cpu_ftrs", dt_cpu_ftrs_parse); | |
| 680 | 692 | |
| 681 | 693 | static void __init cpufeatures_setup_start(u32 isa) |
| 682 | 694 | { |
| @@ -707,7 +719,7 @@ static bool __init cpufeatures_process_feature(struct dt_cpu_feature *f) · 24 unmodified lines | ||
| 707 | 719 | } |
| 708 | 720 | } |
| 709 | 721 | |
| 710 | − if (!known && CPU_FEATURE_ENABLE_UNKNOWN) { | |
| 722 | + if (!known && enable_unknown) { | |
| 711 | 723 | if (!feat_try_enable_unknown(f)) { |
| 712 | 724 | pr_info("not enabling: %s (unknown and unsupported by kernel)\n", |
| 713 | 725 | f->name); |
| @@ -756,6 +768,26 @@ static void __init cpufeatures_setup_finished(void) · 42 unmodified lines | ||
| 756 | 768 | cur_cpu_spec->cpu_features, cur_cpu_spec->mmu_features); |
| 757 | 769 | } |
| 758 | 770 | |
| 771 | +static int __init disabled_on_cmdline(void) | |
| 772 | +{ | |
| 773 | + unsigned long root, chosen; | |
| 774 | + const char *p; | |
| 775 | + | |
| 776 | + root = of_get_flat_dt_root(); | |
| 777 | + chosen = of_get_flat_dt_subnode_by_name(root, "chosen"); | |
| 778 | + if (chosen == -FDT_ERR_NOTFOUND) | |
| 779 | + return false; | |
| 780 | + | |
| 781 | + p = of_get_flat_dt_prop(chosen, "bootargs", NULL); | |
| 782 | + if (!p) | |
| 783 | + return false; | |
| 784 | + | |
| 785 | + if (strstr(p, "dt_cpu_ftrs=off")) | |
| 786 | + return true; | |
| 787 | + | |
| 788 | + return false; | |
| 789 | +} | |
| 790 | + | |
| 759 | 791 | static int __init fdt_find_cpu_features(unsigned long node, const char *uname, |
| 760 | 792 | int depth, void *data) |
| 761 | 793 | { |
| @@ -766,8 +798,6 @@ static int __init fdt_find_cpu_features(unsigned long node, const char *uname, · 4 unmodified lines | ||
| 766 | 798 | return 0; |
| 767 | 799 | } |
| 768 | 800 | |
| 769 | −static bool __initdata using_dt_cpu_ftrs = false; | |
| 770 | − | |
| 771 | 801 | bool __init dt_cpu_ftrs_in_use(void) |
| 772 | 802 | { |
| 773 | 803 | return using_dt_cpu_ftrs; |
| @@ -775,6 +805,8 @@ bool __init dt_cpu_ftrs_in_use(void) · 1 unmodified line | ||
| 775 | 805 | |
| 776 | 806 | bool __init dt_cpu_ftrs_init(void *fdt) |
| 777 | 807 | { |
| 808 | + using_dt_cpu_ftrs = false; | |
| 809 | + | |
| 778 | 810 | /* Setup and verify the FDT, if it fails we just bail */ |
| 779 | 811 | if (!early_init_dt_verify(fdt)) |
| 780 | 812 | return false; |
| @@ -782,6 +814,9 @@ bool __init dt_cpu_ftrs_init(void *fdt) · 1 unmodified line | ||
| 782 | 814 | if (!of_scan_flat_dt(fdt_find_cpu_features, NULL)) |
| 783 | 815 | return false; |
| 784 | 816 | |
| 817 | + if (disabled_on_cmdline()) | |
| 818 | + return false; | |
| 819 | + | |
| 785 | 820 | cpufeatures_setup_cpu(); |
| 786 | 821 | |
| 787 | 822 | using_dt_cpu_ftrs = true; |
| @@ -1027,5 +1062,8 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char · 239 unmodified lines | ||
| 1027 | 1062 | |
| 1028 | 1063 | void __init dt_cpu_ftrs_scan(void) |
| 1029 | 1064 | { |
| 1065 | + if (!using_dt_cpu_ftrs) | |
| 1066 | + return; | |
| 1067 | + | |
| 1030 | 1068 | of_scan_flat_dt(dt_cpu_ftrs_scan_callback, NULL); |
| 1031 | 1069 | } |
| @@ -1666,6 +1666,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) · 1665 unmodified lines | ||
| 1666 | 1666 | #ifdef CONFIG_VSX |
| 1667 | 1667 | current->thread.used_vsr = 0; |
| 1668 | 1668 | #endif |
| 1669 | + current->thread.load_fp = 0; | |
| 1669 | 1670 | memset(¤t->thread.fp_state, 0, sizeof(current->thread.fp_state)); |
| 1670 | 1671 | current->thread.fp_save_area = NULL; |
| 1671 | 1672 | #ifdef CONFIG_ALTIVEC |
| @@ -1674,6 +1675,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) · 2 unmodified lines | ||
| 1674 | 1675 | current->thread.vr_save_area = NULL; |
| 1675 | 1676 | current->thread.vrsave = 0; |
| 1676 | 1677 | current->thread.used_vr = 0; |
| 1678 | + current->thread.load_vec = 0; | |
| 1677 | 1679 | #endif /* CONFIG_ALTIVEC */ |
| 1678 | 1680 | #ifdef CONFIG_SPE |
| 1679 | 1681 | memset(current->thread.evr, 0, sizeof(current->thread.evr)); |
| @@ -1685,6 +1687,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) · 5 unmodified lines | ||
| 1685 | 1687 | current->thread.tm_tfhar = 0; |
| 1686 | 1688 | current->thread.tm_texasr = 0; |
| 1687 | 1689 | current->thread.tm_tfiar = 0; |
| 1690 | + current->thread.load_tm = 0; | |
| 1688 | 1691 | #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ |
| 1689 | 1692 | } |
| 1690 | 1693 | EXPORT_SYMBOL(start_thread); |
| @@ -928,7 +928,7 @@ void __init setup_arch(char **cmdline_p) · 927 unmodified lines | ||
| 928 | 928 | |
| 929 | 929 | #ifdef CONFIG_PPC_MM_SLICES |
| 930 | 930 | #ifdef CONFIG_PPC64 |
| 931 | − init_mm.context.addr_limit = TASK_SIZE_128TB; | |
| 931 | + init_mm.context.addr_limit = DEFAULT_MAP_WINDOW_USER64; | |
| 932 | 932 | #else |
| 933 | 933 | #error "context.addr_limit not initialized." |
| 934 | 934 | #endif |
| @@ -661,7 +661,7 @@ void __init emergency_stack_init(void) · 660 unmodified lines | ||
| 661 | 661 | |
| 662 | 662 | static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align) |
| 663 | 663 | { |
| 664 | − return __alloc_bootmem_node(NODE_DATA(cpu_to_node(cpu)), size, align, | |
| 664 | + return __alloc_bootmem_node(NODE_DATA(early_cpu_to_node(cpu)), size, align, | |
| 665 | 665 | __pa(MAX_DMA_ADDRESS)); |
| 666 | 666 | } |
| 667 | 667 | |
| @@ -672,7 +672,7 @@ static void __init pcpu_fc_free(void *ptr, size_t size) · 4 unmodified lines | ||
| 672 | 672 | |
| 673 | 673 | static int pcpu_cpu_distance(unsigned int from, unsigned int to) |
| 674 | 674 | { |
| 675 | − if (cpu_to_node(from) == cpu_to_node(to)) | |
| 675 | + if (early_cpu_to_node(from) == early_cpu_to_node(to)) | |
| 676 | 676 | return LOCAL_DISTANCE; |
| 677 | 677 | else |
| 678 | 678 | return REMOTE_DISTANCE; |
| @@ -99,7 +99,7 @@ static int hash__init_new_context(struct mm_struct *mm) · 98 unmodified lines | ||
| 99 | 99 | * mm->context.addr_limit. Default to max task size so that we copy the |
| 100 | 100 | * default values to paca which will help us to handle slb miss early. |
| 101 | 101 | */ |
| 102 | − mm->context.addr_limit = TASK_SIZE_128TB; | |
| 102 | + mm->context.addr_limit = DEFAULT_MAP_WINDOW_USER64; | |
| 103 | 103 | |
| 104 | 104 | /* |
| 105 | 105 | * The old code would re-promote on fork, we don't do that when using |
| @@ -402,7 +402,7 @@ static struct power_pmu power9_isa207_pmu = { · 401 unmodified lines | ||
| 402 | 402 | .name = "POWER9", |
| 403 | 403 | .n_counter = MAX_PMU_COUNTERS, |
| 404 | 404 | .add_fields = ISA207_ADD_FIELDS, |
| 405 | − .test_adder = ISA207_TEST_ADDER, | |
| 405 | + .test_adder = P9_DD1_TEST_ADDER, | |
| 406 | 406 | .compute_mmcr = isa207_compute_mmcr, |
| 407 | 407 | .config_bhrb = power9_config_bhrb, |
| 408 | 408 | .bhrb_filter_map = power9_bhrb_filter_map, |
| @@ -421,7 +421,7 @@ static struct power_pmu power9_pmu = { · 12 unmodified lines | ||
| 421 | 421 | .name = "POWER9", |
| 422 | 422 | .n_counter = MAX_PMU_COUNTERS, |
| 423 | 423 | .add_fields = ISA207_ADD_FIELDS, |
| 424 | − .test_adder = P9_DD1_TEST_ADDER, | |
| 424 | + .test_adder = ISA207_TEST_ADDER, | |
| 425 | 425 | .compute_mmcr = isa207_compute_mmcr, |
| 426 | 426 | .config_bhrb = power9_config_bhrb, |
| 427 | 427 | .bhrb_filter_map = power9_bhrb_filter_map, |
| @@ -59,6 +59,17 @@ config PPC_OF_BOOT_TRAMPOLINE · 58 unmodified lines | ||
| 59 | 59 | |
| 60 | 60 | In case of doubt, say Y |
| 61 | 61 | |
| 62 | +config PPC_DT_CPU_FTRS | |
| 63 | + bool "Device-tree based CPU feature discovery & setup" | |
| 64 | + depends on PPC_BOOK3S_64 | |
| 65 | + default y | |
| 66 | + help | |
| 67 | + This enables code to use a new device tree binding for describing CPU | |
| 68 | + compatibility and features. Saying Y here will attempt to use the new | |
| 69 | + binding if the firmware provides it. Currently only the skiboot | |
| 70 | + firmware provides this binding. | |
| 71 | + If you're not sure say Y. | |
| 72 | + | |
| 62 | 73 | config UDBG_RTAS_CONSOLE |
| 63 | 74 | bool "RTAS based debug console" |
| 64 | 75 | depends on PPC_RTAS |
| @@ -175,6 +175,8 @@ static int spufs_arch_write_note(struct spu_context *ctx, int i, · 174 unmodified lines | ||
| 175 | 175 | skip = roundup(cprm->pos - total + sz, 4) - cprm->pos; |
| 176 | 176 | if (!dump_skip(cprm, skip)) |
| 177 | 177 | goto Eio; |
| 178 | + | |
| 179 | + rc = 0; | |
| 178 | 180 | out: |
| 179 | 181 | free_page((unsigned long)buf); |
| 180 | 182 | return rc; |
| @@ -407,7 +407,13 @@ static DEVICE_ATTR(subcores_per_core, 0644, · 406 unmodified lines | ||
| 407 | 407 | |
| 408 | 408 | static int subcore_init(void) |
| 409 | 409 | { |
| 410 | − if (!cpu_has_feature(CPU_FTR_SUBCORE)) | |
| 410 | + unsigned pvr_ver; | |
| 411 | + | |
| 412 | + pvr_ver = PVR_VER(mfspr(SPRN_PVR)); | |
| 413 | + | |
| 414 | + if (pvr_ver != PVR_POWER8 && | |
| 415 | + pvr_ver != PVR_POWER8E && | |
| 416 | + pvr_ver != PVR_POWER8NVL) | |
| 411 | 417 | return 0; |
| 412 | 418 | |
| 413 | 419 | /* |
| @@ -124,6 +124,7 @@ static struct property *dlpar_clone_drconf_property(struct device_node *dn) · 123 unmodified lines | ||
| 124 | 124 | for (i = 0; i < num_lmbs; i++) { |
| 125 | 125 | lmbs[i].base_addr = be64_to_cpu(lmbs[i].base_addr); |
| 126 | 126 | lmbs[i].drc_index = be32_to_cpu(lmbs[i].drc_index); |
| 127 | + lmbs[i].aa_index = be32_to_cpu(lmbs[i].aa_index); | |
| 127 | 128 | lmbs[i].flags = be32_to_cpu(lmbs[i].flags); |
| 128 | 129 | } |
| 129 | 130 | |
| @@ -147,6 +148,7 @@ static void dlpar_update_drconf_property(struct device_node *dn, · 17 unmodified lines | ||
| 147 | 148 | for (i = 0; i < num_lmbs; i++) { |
| 148 | 149 | lmbs[i].base_addr = cpu_to_be64(lmbs[i].base_addr); |
| 149 | 150 | lmbs[i].drc_index = cpu_to_be32(lmbs[i].drc_index); |
| 151 | + lmbs[i].aa_index = cpu_to_be32(lmbs[i].aa_index); | |
| 150 | 152 | lmbs[i].flags = cpu_to_be32(lmbs[i].flags); |
| 151 | 153 | } |
| 152 | 154 | |
| @@ -75,7 +75,8 @@ static int u8_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) · 74 unmodified lines | ||
| 75 | 75 | |
| 76 | 76 | static void u8_gpio_save_regs(struct of_mm_gpio_chip *mm_gc) |
| 77 | 77 | { |
| 78 | − struct u8_gpio_chip *u8_gc = gpiochip_get_data(&mm_gc->gc); | |
| 78 | + struct u8_gpio_chip *u8_gc = | |
| 79 | + container_of(mm_gc, struct u8_gpio_chip, mm_gc); | |
| 79 | 80 | |
| 80 | 81 | u8_gc->data = in_8(mm_gc->regs); |
| 81 | 82 | } |
| @@ -363,9 +363,6 @@ config COMPAT · 362 unmodified lines | ||
| 363 | 363 | config SYSVIPC_COMPAT |
| 364 | 364 | def_bool y if COMPAT && SYSVIPC |
| 365 | 365 | |
| 366 | −config KEYS_COMPAT | |
| 367 | − def_bool y if COMPAT && KEYS | |
| 368 | − | |
| 369 | 366 | config SMP |
| 370 | 367 | def_bool y |
| 371 | 368 | prompt "Symmetric multi-processing support" |
| @@ -30,6 +30,7 @@ CONFIG_USER_NS=y · 29 unmodified lines | ||
| 30 | 30 | CONFIG_SCHED_AUTOGROUP=y |
| 31 | 31 | CONFIG_BLK_DEV_INITRD=y |
| 32 | 32 | CONFIG_EXPERT=y |
| 33 | +# CONFIG_SYSFS_SYSCALL is not set | |
| 33 | 34 | CONFIG_BPF_SYSCALL=y |
| 34 | 35 | CONFIG_USERFAULTFD=y |
| 35 | 36 | # CONFIG_COMPAT_BRK is not set |
| @@ -44,7 +45,10 @@ CONFIG_MODULE_UNLOAD=y · 8 unmodified lines | ||
| 44 | 45 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 45 | 46 | CONFIG_MODVERSIONS=y |
| 46 | 47 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 48 | +CONFIG_BLK_DEV_INTEGRITY=y | |
| 47 | 49 | CONFIG_BLK_DEV_THROTTLING=y |
| 50 | +CONFIG_BLK_WBT=y | |
| 51 | +CONFIG_BLK_WBT_SQ=y | |
| 48 | 52 | CONFIG_PARTITION_ADVANCED=y |
| 49 | 53 | CONFIG_IBM_PARTITION=y |
| 50 | 54 | CONFIG_BSD_DISKLABEL=y |
| @@ -90,6 +94,8 @@ CONFIG_UNIX=y · 39 unmodified lines | ||
| 90 | 94 | CONFIG_UNIX_DIAG=m |
| 91 | 95 | CONFIG_XFRM_USER=m |
| 92 | 96 | CONFIG_NET_KEY=m |
| 97 | +CONFIG_SMC=m | |
| 98 | +CONFIG_SMC_DIAG=m | |
| 93 | 99 | CONFIG_INET=y |
| 94 | 100 | CONFIG_IP_MULTICAST=y |
| 95 | 101 | CONFIG_IP_ADVANCED_ROUTER=y |
| @@ -359,6 +365,7 @@ CONFIG_NET_ACT_SIMP=m · 263 unmodified lines | ||
| 359 | 365 | CONFIG_NET_ACT_SKBEDIT=m |
| 360 | 366 | CONFIG_NET_ACT_CSUM=m |
| 361 | 367 | CONFIG_DNS_RESOLVER=y |
| 368 | +CONFIG_NETLINK_DIAG=m | |
| 362 | 369 | CONFIG_CGROUP_NET_PRIO=y |
| 363 | 370 | CONFIG_BPF_JIT=y |
| 364 | 371 | CONFIG_NET_PKTGEN=m |
| @@ -367,16 +374,19 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines | ||
| 367 | 374 | CONFIG_DMA_CMA=y |
| 368 | 375 | CONFIG_CMA_SIZE_MBYTES=0 |
| 369 | 376 | CONFIG_CONNECTOR=y |
| 377 | +CONFIG_ZRAM=m | |
| 370 | 378 | CONFIG_BLK_DEV_LOOP=m |
| 371 | 379 | CONFIG_BLK_DEV_CRYPTOLOOP=m |
| 380 | +CONFIG_BLK_DEV_DRBD=m | |
| 372 | 381 | CONFIG_BLK_DEV_NBD=m |
| 373 | 382 | CONFIG_BLK_DEV_OSD=m |
| 374 | 383 | CONFIG_BLK_DEV_RAM=y |
| 375 | 384 | CONFIG_BLK_DEV_RAM_SIZE=32768 |
| 376 | −CONFIG_CDROM_PKTCDVD=m | |
| 377 | −CONFIG_ATA_OVER_ETH=m | |
| 385 | +CONFIG_BLK_DEV_RAM_DAX=y | |
| 378 | 386 | CONFIG_VIRTIO_BLK=y |
| 387 | +CONFIG_BLK_DEV_RBD=m | |
| 379 | 388 | CONFIG_ENCLOSURE_SERVICES=m |
| 389 | +CONFIG_GENWQE=m | |
| 380 | 390 | CONFIG_RAID_ATTRS=m |
| 381 | 391 | CONFIG_SCSI=y |
| 382 | 392 | CONFIG_BLK_DEV_SD=y |
| @@ -442,6 +452,8 @@ CONFIG_NLMON=m · 59 unmodified lines | ||
| 442 | 452 | # CONFIG_NET_VENDOR_INTEL is not set |
| 443 | 453 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 444 | 454 | CONFIG_MLX4_EN=m |
| 455 | +CONFIG_MLX5_CORE=m | |
| 456 | +CONFIG_MLX5_CORE_EN=y | |
| 445 | 457 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 446 | 458 | CONFIG_PPP=m |
| 447 | 459 | CONFIG_PPP_BSDCOMP=m |
| @@ -452,7 +464,6 @@ CONFIG_PPTP=m · 4 unmodified lines | ||
| 452 | 464 | CONFIG_PPPOL2TP=m |
| 453 | 465 | CONFIG_PPP_ASYNC=m |
| 454 | 466 | CONFIG_PPP_SYNC_TTY=m |
| 455 | −# CONFIG_INPUT_MOUSEDEV_PSAUX is not set | |
| 456 | 467 | # CONFIG_INPUT_KEYBOARD is not set |
| 457 | 468 | # CONFIG_INPUT_MOUSE is not set |
| 458 | 469 | # CONFIG_SERIO is not set |
| @@ -471,6 +482,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines | ||
| 471 | 482 | CONFIG_INFINIBAND=m |
| 472 | 483 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 473 | 484 | CONFIG_MLX4_INFINIBAND=m |
| 485 | +CONFIG_MLX5_INFINIBAND=m | |
| 474 | 486 | CONFIG_VIRTIO_BALLOON=m |
| 475 | 487 | CONFIG_EXT4_FS=y |
| 476 | 488 | CONFIG_EXT4_FS_POSIX_ACL=y |
| @@ -487,12 +499,18 @@ CONFIG_XFS_POSIX_ACL=y · 10 unmodified lines | ||
| 487 | 499 | CONFIG_XFS_RT=y |
| 488 | 500 | CONFIG_XFS_DEBUG=y |
| 489 | 501 | CONFIG_GFS2_FS=m |
| 502 | +CONFIG_GFS2_FS_LOCKING_DLM=y | |
| 490 | 503 | CONFIG_OCFS2_FS=m |
| 491 | 504 | CONFIG_BTRFS_FS=y |
| 492 | 505 | CONFIG_BTRFS_FS_POSIX_ACL=y |
| 506 | +CONFIG_BTRFS_DEBUG=y | |
| 493 | 507 | CONFIG_NILFS2_FS=m |
| 508 | +CONFIG_FS_DAX=y | |
| 509 | +CONFIG_EXPORTFS_BLOCK_OPS=y | |
| 494 | 510 | CONFIG_FANOTIFY=y |
| 511 | +CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y | |
| 495 | 512 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| 513 | +CONFIG_QUOTA_DEBUG=y | |
| 496 | 514 | CONFIG_QFMT_V1=m |
| 497 | 515 | CONFIG_QFMT_V2=m |
| 498 | 516 | CONFIG_AUTOFS4_FS=m |
| @@ -558,6 +576,7 @@ CONFIG_HEADERS_CHECK=y · 59 unmodified lines | ||
| 558 | 576 | CONFIG_DEBUG_SECTION_MISMATCH=y |
| 559 | 577 | CONFIG_MAGIC_SYSRQ=y |
| 560 | 578 | CONFIG_DEBUG_PAGEALLOC=y |
| 579 | +CONFIG_DEBUG_RODATA_TEST=y | |
| 561 | 580 | CONFIG_DEBUG_OBJECTS=y |
| 562 | 581 | CONFIG_DEBUG_OBJECTS_SELFTEST=y |
| 563 | 582 | CONFIG_DEBUG_OBJECTS_FREE=y |
| @@ -580,7 +599,6 @@ CONFIG_DETECT_HUNG_TASK=y · 16 unmodified lines | ||
| 580 | 599 | CONFIG_WQ_WATCHDOG=y |
| 581 | 600 | CONFIG_PANIC_ON_OOPS=y |
| 582 | 601 | CONFIG_DEBUG_TIMEKEEPING=y |
| 583 | −CONFIG_TIMER_STATS=y | |
| 584 | 602 | CONFIG_DEBUG_RT_MUTEXES=y |
| 585 | 603 | CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y |
| 586 | 604 | CONFIG_PROVE_LOCKING=y |
| @@ -595,6 +613,7 @@ CONFIG_RCU_TORTURE_TEST=m · 8 unmodified lines | ||
| 595 | 613 | CONFIG_RCU_CPU_STALL_TIMEOUT=300 |
| 596 | 614 | CONFIG_NOTIFIER_ERROR_INJECTION=m |
| 597 | 615 | CONFIG_PM_NOTIFIER_ERROR_INJECT=m |
| 616 | +CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m | |
| 598 | 617 | CONFIG_FAULT_INJECTION=y |
| 599 | 618 | CONFIG_FAILSLAB=y |
| 600 | 619 | CONFIG_FAIL_PAGE_ALLOC=y |
| @@ -616,13 +635,12 @@ CONFIG_HIST_TRIGGERS=y · 15 unmodified lines | ||
| 616 | 635 | CONFIG_TRACE_ENUM_MAP_FILE=y |
| 617 | 636 | CONFIG_LKDTM=m |
| 618 | 637 | CONFIG_TEST_LIST_SORT=y |
| 638 | +CONFIG_TEST_SORT=y | |
| 619 | 639 | CONFIG_KPROBES_SANITY_TEST=y |
| 620 | 640 | CONFIG_RBTREE_TEST=y |
| 621 | 641 | CONFIG_INTERVAL_TREE_TEST=m |
| 622 | 642 | CONFIG_PERCPU_TEST=m |
| 623 | 643 | CONFIG_ATOMIC64_SELFTEST=y |
| 624 | −CONFIG_TEST_STRING_HELPERS=y | |
| 625 | −CONFIG_TEST_KSTRTOX=y | |
| 626 | 644 | CONFIG_DMA_API_DEBUG=y |
| 627 | 645 | CONFIG_TEST_BPF=m |
| 628 | 646 | CONFIG_BUG_ON_DATA_CORRUPTION=y |
| @@ -630,6 +648,7 @@ CONFIG_S390_PTDUMP=y · 1 unmodified line | ||
| 630 | 648 | CONFIG_ENCRYPTED_KEYS=m |
| 631 | 649 | CONFIG_SECURITY=y |
| 632 | 650 | CONFIG_SECURITY_NETWORK=y |
| 651 | +CONFIG_HARDENED_USERCOPY=y | |
| 633 | 652 | CONFIG_SECURITY_SELINUX=y |
| 634 | 653 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 635 | 654 | CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0 |
| @@ -640,7 +659,9 @@ CONFIG_CRYPTO_RSA=m · 4 unmodified lines | ||
| 640 | 659 | CONFIG_CRYPTO_DH=m |
| 641 | 660 | CONFIG_CRYPTO_ECDH=m |
| 642 | 661 | CONFIG_CRYPTO_USER=m |
| 662 | +CONFIG_CRYPTO_PCRYPT=m | |
| 643 | 663 | CONFIG_CRYPTO_CRYPTD=m |
| 664 | +CONFIG_CRYPTO_MCRYPTD=m | |
| 644 | 665 | CONFIG_CRYPTO_TEST=m |
| 645 | 666 | CONFIG_CRYPTO_CCM=m |
| 646 | 667 | CONFIG_CRYPTO_GCM=m |
| @@ -648,6 +669,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 1 unmodified line | ||
| 648 | 669 | CONFIG_CRYPTO_LRW=m |
| 649 | 670 | CONFIG_CRYPTO_PCBC=m |
| 650 | 671 | CONFIG_CRYPTO_KEYWRAP=m |
| 672 | +CONFIG_CRYPTO_CMAC=m | |
| 651 | 673 | CONFIG_CRYPTO_XCBC=m |
| 652 | 674 | CONFIG_CRYPTO_VMAC=m |
| 653 | 675 | CONFIG_CRYPTO_CRC32=m |
| @@ -657,8 +679,10 @@ CONFIG_CRYPTO_RMD160=m · 3 unmodified lines | ||
| 657 | 679 | CONFIG_CRYPTO_RMD256=m |
| 658 | 680 | CONFIG_CRYPTO_RMD320=m |
| 659 | 681 | CONFIG_CRYPTO_SHA512=m |
| 682 | +CONFIG_CRYPTO_SHA3=m | |
| 660 | 683 | CONFIG_CRYPTO_TGR192=m |
| 661 | 684 | CONFIG_CRYPTO_WP512=m |
| 685 | +CONFIG_CRYPTO_AES_TI=m | |
| 662 | 686 | CONFIG_CRYPTO_ANUBIS=m |
| 663 | 687 | CONFIG_CRYPTO_BLOWFISH=m |
| 664 | 688 | CONFIG_CRYPTO_CAMELLIA=m |
| @@ -674,6 +698,7 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines | ||
| 674 | 698 | CONFIG_CRYPTO_842=m |
| 675 | 699 | CONFIG_CRYPTO_LZ4=m |
| 676 | 700 | CONFIG_CRYPTO_LZ4HC=m |
| 701 | +CONFIG_CRYPTO_ANSI_CPRNG=m | |
| 677 | 702 | CONFIG_CRYPTO_USER_API_HASH=m |
| 678 | 703 | CONFIG_CRYPTO_USER_API_SKCIPHER=m |
| 679 | 704 | CONFIG_CRYPTO_USER_API_RNG=m |
| @@ -685,6 +710,7 @@ CONFIG_CRYPTO_SHA256_S390=m · 5 unmodified lines | ||
| 685 | 710 | CONFIG_CRYPTO_SHA512_S390=m |
| 686 | 711 | CONFIG_CRYPTO_DES_S390=m |
| 687 | 712 | CONFIG_CRYPTO_AES_S390=m |
| 713 | +CONFIG_CRYPTO_PAES_S390=m | |
| 688 | 714 | CONFIG_CRYPTO_GHASH_S390=m |
| 689 | 715 | CONFIG_CRYPTO_CRC32_S390=y |
| 690 | 716 | CONFIG_ASYMMETRIC_KEY_TYPE=y |
| @@ -692,6 +718,7 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m · 1 unmodified line | ||
| 692 | 718 | CONFIG_X509_CERTIFICATE_PARSER=m |
| 693 | 719 | CONFIG_CRC7=m |
| 694 | 720 | CONFIG_CRC8=m |
| 721 | +CONFIG_RANDOM32_SELFTEST=y | |
| 695 | 722 | CONFIG_CORDIC=m |
| 696 | 723 | CONFIG_CMM=m |
| 697 | 724 | CONFIG_APPLDATA_BASE=y |
| @@ -31,6 +31,7 @@ CONFIG_USER_NS=y · 30 unmodified lines | ||
| 31 | 31 | CONFIG_SCHED_AUTOGROUP=y |
| 32 | 32 | CONFIG_BLK_DEV_INITRD=y |
| 33 | 33 | CONFIG_EXPERT=y |
| 34 | +# CONFIG_SYSFS_SYSCALL is not set | |
| 34 | 35 | CONFIG_BPF_SYSCALL=y |
| 35 | 36 | CONFIG_USERFAULTFD=y |
| 36 | 37 | # CONFIG_COMPAT_BRK is not set |
| @@ -46,7 +47,10 @@ CONFIG_MODULE_UNLOAD=y · 9 unmodified lines | ||
| 46 | 47 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 47 | 48 | CONFIG_MODVERSIONS=y |
| 48 | 49 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 50 | +CONFIG_BLK_DEV_INTEGRITY=y | |
| 49 | 51 | CONFIG_BLK_DEV_THROTTLING=y |
| 52 | +CONFIG_BLK_WBT=y | |
| 53 | +CONFIG_BLK_WBT_SQ=y | |
| 50 | 54 | CONFIG_PARTITION_ADVANCED=y |
| 51 | 55 | CONFIG_IBM_PARTITION=y |
| 52 | 56 | CONFIG_BSD_DISKLABEL=y |
| @@ -88,6 +92,8 @@ CONFIG_UNIX=y · 35 unmodified lines | ||
| 88 | 92 | CONFIG_UNIX_DIAG=m |
| 89 | 93 | CONFIG_XFRM_USER=m |
| 90 | 94 | CONFIG_NET_KEY=m |
| 95 | +CONFIG_SMC=m | |
| 96 | +CONFIG_SMC_DIAG=m | |
| 91 | 97 | CONFIG_INET=y |
| 92 | 98 | CONFIG_IP_MULTICAST=y |
| 93 | 99 | CONFIG_IP_ADVANCED_ROUTER=y |
| @@ -356,6 +362,7 @@ CONFIG_NET_ACT_SIMP=m · 262 unmodified lines | ||
| 356 | 362 | CONFIG_NET_ACT_SKBEDIT=m |
| 357 | 363 | CONFIG_NET_ACT_CSUM=m |
| 358 | 364 | CONFIG_DNS_RESOLVER=y |
| 365 | +CONFIG_NETLINK_DIAG=m | |
| 359 | 366 | CONFIG_CGROUP_NET_PRIO=y |
| 360 | 367 | CONFIG_BPF_JIT=y |
| 361 | 368 | CONFIG_NET_PKTGEN=m |
| @@ -364,16 +371,18 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines | ||
| 364 | 371 | CONFIG_DMA_CMA=y |
| 365 | 372 | CONFIG_CMA_SIZE_MBYTES=0 |
| 366 | 373 | CONFIG_CONNECTOR=y |
| 374 | +CONFIG_ZRAM=m | |
| 367 | 375 | CONFIG_BLK_DEV_LOOP=m |
| 368 | 376 | CONFIG_BLK_DEV_CRYPTOLOOP=m |
| 377 | +CONFIG_BLK_DEV_DRBD=m | |
| 369 | 378 | CONFIG_BLK_DEV_NBD=m |
| 370 | 379 | CONFIG_BLK_DEV_OSD=m |
| 371 | 380 | CONFIG_BLK_DEV_RAM=y |
| 372 | 381 | CONFIG_BLK_DEV_RAM_SIZE=32768 |
| 373 | −CONFIG_CDROM_PKTCDVD=m | |
| 374 | −CONFIG_ATA_OVER_ETH=m | |
| 382 | +CONFIG_BLK_DEV_RAM_DAX=y | |
| 375 | 383 | CONFIG_VIRTIO_BLK=y |
| 376 | 384 | CONFIG_ENCLOSURE_SERVICES=m |
| 385 | +CONFIG_GENWQE=m | |
| 377 | 386 | CONFIG_RAID_ATTRS=m |
| 378 | 387 | CONFIG_SCSI=y |
| 379 | 388 | CONFIG_BLK_DEV_SD=y |
| @@ -439,6 +448,8 @@ CONFIG_NLMON=m · 59 unmodified lines | ||
| 439 | 448 | # CONFIG_NET_VENDOR_INTEL is not set |
| 440 | 449 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 441 | 450 | CONFIG_MLX4_EN=m |
| 451 | +CONFIG_MLX5_CORE=m | |
| 452 | +CONFIG_MLX5_CORE_EN=y | |
| 442 | 453 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 443 | 454 | CONFIG_PPP=m |
| 444 | 455 | CONFIG_PPP_BSDCOMP=m |
| @@ -449,7 +460,6 @@ CONFIG_PPTP=m · 4 unmodified lines | ||
| 449 | 460 | CONFIG_PPPOL2TP=m |
| 450 | 461 | CONFIG_PPP_ASYNC=m |
| 451 | 462 | CONFIG_PPP_SYNC_TTY=m |
| 452 | −# CONFIG_INPUT_MOUSEDEV_PSAUX is not set | |
| 453 | 463 | # CONFIG_INPUT_KEYBOARD is not set |
| 454 | 464 | # CONFIG_INPUT_MOUSE is not set |
| 455 | 465 | # CONFIG_SERIO is not set |
| @@ -468,6 +478,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines | ||
| 468 | 478 | CONFIG_INFINIBAND=m |
| 469 | 479 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 470 | 480 | CONFIG_MLX4_INFINIBAND=m |
| 481 | +CONFIG_MLX5_INFINIBAND=m | |
| 471 | 482 | CONFIG_VIRTIO_BALLOON=m |
| 472 | 483 | CONFIG_EXT4_FS=y |
| 473 | 484 | CONFIG_EXT4_FS_POSIX_ACL=y |
| @@ -483,11 +494,15 @@ CONFIG_XFS_QUOTA=y · 9 unmodified lines | ||
| 483 | 494 | CONFIG_XFS_POSIX_ACL=y |
| 484 | 495 | CONFIG_XFS_RT=y |
| 485 | 496 | CONFIG_GFS2_FS=m |
| 497 | +CONFIG_GFS2_FS_LOCKING_DLM=y | |
| 486 | 498 | CONFIG_OCFS2_FS=m |
| 487 | 499 | CONFIG_BTRFS_FS=y |
| 488 | 500 | CONFIG_BTRFS_FS_POSIX_ACL=y |
| 489 | 501 | CONFIG_NILFS2_FS=m |
| 502 | +CONFIG_FS_DAX=y | |
| 503 | +CONFIG_EXPORTFS_BLOCK_OPS=y | |
| 490 | 504 | CONFIG_FANOTIFY=y |
| 505 | +CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y | |
| 491 | 506 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| 492 | 507 | CONFIG_QFMT_V1=m |
| 493 | 508 | CONFIG_QFMT_V2=m |
| @@ -553,7 +568,6 @@ CONFIG_UNUSED_SYMBOLS=y · 59 unmodified lines | ||
| 553 | 568 | CONFIG_MAGIC_SYSRQ=y |
| 554 | 569 | CONFIG_DEBUG_MEMORY_INIT=y |
| 555 | 570 | CONFIG_PANIC_ON_OOPS=y |
| 556 | −CONFIG_TIMER_STATS=y | |
| 557 | 571 | CONFIG_RCU_TORTURE_TEST=m |
| 558 | 572 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 559 | 573 | CONFIG_LATENCYTOP=y |
| @@ -576,6 +590,7 @@ CONFIG_BIG_KEYS=y · 16 unmodified lines | ||
| 576 | 590 | CONFIG_ENCRYPTED_KEYS=m |
| 577 | 591 | CONFIG_SECURITY=y |
| 578 | 592 | CONFIG_SECURITY_NETWORK=y |
| 593 | +CONFIG_HARDENED_USERCOPY=y | |
| 579 | 594 | CONFIG_SECURITY_SELINUX=y |
| 580 | 595 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 581 | 596 | CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0 |
| @@ -599,6 +614,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 17 unmodified lines | ||
| 599 | 614 | CONFIG_CRYPTO_LRW=m |
| 600 | 615 | CONFIG_CRYPTO_PCBC=m |
| 601 | 616 | CONFIG_CRYPTO_KEYWRAP=m |
| 617 | +CONFIG_CRYPTO_CMAC=m | |
| 602 | 618 | CONFIG_CRYPTO_XCBC=m |
| 603 | 619 | CONFIG_CRYPTO_VMAC=m |
| 604 | 620 | CONFIG_CRYPTO_CRC32=m |
| @@ -611,6 +627,7 @@ CONFIG_CRYPTO_SHA512=m · 6 unmodified lines | ||
| 611 | 627 | CONFIG_CRYPTO_SHA3=m |
| 612 | 628 | CONFIG_CRYPTO_TGR192=m |
| 613 | 629 | CONFIG_CRYPTO_WP512=m |
| 630 | +CONFIG_CRYPTO_AES_TI=m | |
| 614 | 631 | CONFIG_CRYPTO_ANUBIS=m |
| 615 | 632 | CONFIG_CRYPTO_BLOWFISH=m |
| 616 | 633 | CONFIG_CRYPTO_CAMELLIA=m |
| @@ -626,16 +643,19 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines | ||
| 626 | 643 | CONFIG_CRYPTO_842=m |
| 627 | 644 | CONFIG_CRYPTO_LZ4=m |
| 628 | 645 | CONFIG_CRYPTO_LZ4HC=m |
| 646 | +CONFIG_CRYPTO_ANSI_CPRNG=m | |
| 629 | 647 | CONFIG_CRYPTO_USER_API_HASH=m |
| 630 | 648 | CONFIG_CRYPTO_USER_API_SKCIPHER=m |
| 631 | 649 | CONFIG_CRYPTO_USER_API_RNG=m |
| 632 | 650 | CONFIG_CRYPTO_USER_API_AEAD=m |
| 633 | 651 | CONFIG_ZCRYPT=m |
| 652 | +CONFIG_PKEY=m | |
| 634 | 653 | CONFIG_CRYPTO_SHA1_S390=m |
| 635 | 654 | CONFIG_CRYPTO_SHA256_S390=m |
| 636 | 655 | CONFIG_CRYPTO_SHA512_S390=m |
| 637 | 656 | CONFIG_CRYPTO_DES_S390=m |
| 638 | 657 | CONFIG_CRYPTO_AES_S390=m |
| 658 | +CONFIG_CRYPTO_PAES_S390=m | |
| 639 | 659 | CONFIG_CRYPTO_GHASH_S390=m |
| 640 | 660 | CONFIG_CRYPTO_CRC32_S390=y |
| 641 | 661 | CONFIG_CRC7=m |
| @@ -31,6 +31,7 @@ CONFIG_USER_NS=y · 30 unmodified lines | ||
| 31 | 31 | CONFIG_SCHED_AUTOGROUP=y |
| 32 | 32 | CONFIG_BLK_DEV_INITRD=y |
| 33 | 33 | CONFIG_EXPERT=y |
| 34 | +# CONFIG_SYSFS_SYSCALL is not set | |
| 34 | 35 | CONFIG_BPF_SYSCALL=y |
| 35 | 36 | CONFIG_USERFAULTFD=y |
| 36 | 37 | # CONFIG_COMPAT_BRK is not set |
| @@ -44,7 +45,10 @@ CONFIG_MODULE_UNLOAD=y · 7 unmodified lines | ||
| 44 | 45 | CONFIG_MODULE_FORCE_UNLOAD=y |
| 45 | 46 | CONFIG_MODVERSIONS=y |
| 46 | 47 | CONFIG_MODULE_SRCVERSION_ALL=y |
| 48 | +CONFIG_BLK_DEV_INTEGRITY=y | |
| 47 | 49 | CONFIG_BLK_DEV_THROTTLING=y |
| 50 | +CONFIG_BLK_WBT=y | |
| 51 | +CONFIG_BLK_WBT_SQ=y | |
| 48 | 52 | CONFIG_PARTITION_ADVANCED=y |
| 49 | 53 | CONFIG_IBM_PARTITION=y |
| 50 | 54 | CONFIG_BSD_DISKLABEL=y |
| @@ -86,6 +90,8 @@ CONFIG_UNIX=y · 35 unmodified lines | ||
| 86 | 90 | CONFIG_UNIX_DIAG=m |
| 87 | 91 | CONFIG_XFRM_USER=m |
| 88 | 92 | CONFIG_NET_KEY=m |
| 93 | +CONFIG_SMC=m | |
| 94 | +CONFIG_SMC_DIAG=m | |
| 89 | 95 | CONFIG_INET=y |
| 90 | 96 | CONFIG_IP_MULTICAST=y |
| 91 | 97 | CONFIG_IP_ADVANCED_ROUTER=y |
| @@ -354,6 +360,7 @@ CONFIG_NET_ACT_SIMP=m · 262 unmodified lines | ||
| 354 | 360 | CONFIG_NET_ACT_SKBEDIT=m |
| 355 | 361 | CONFIG_NET_ACT_CSUM=m |
| 356 | 362 | CONFIG_DNS_RESOLVER=y |
| 363 | +CONFIG_NETLINK_DIAG=m | |
| 357 | 364 | CONFIG_CGROUP_NET_PRIO=y |
| 358 | 365 | CONFIG_BPF_JIT=y |
| 359 | 366 | CONFIG_NET_PKTGEN=m |
| @@ -362,16 +369,18 @@ CONFIG_DEVTMPFS=y · 2 unmodified lines | ||
| 362 | 369 | CONFIG_DMA_CMA=y |
| 363 | 370 | CONFIG_CMA_SIZE_MBYTES=0 |
| 364 | 371 | CONFIG_CONNECTOR=y |
| 372 | +CONFIG_ZRAM=m | |
| 365 | 373 | CONFIG_BLK_DEV_LOOP=m |
| 366 | 374 | CONFIG_BLK_DEV_CRYPTOLOOP=m |
| 375 | +CONFIG_BLK_DEV_DRBD=m | |
| 367 | 376 | CONFIG_BLK_DEV_NBD=m |
| 368 | 377 | CONFIG_BLK_DEV_OSD=m |
| 369 | 378 | CONFIG_BLK_DEV_RAM=y |
| 370 | 379 | CONFIG_BLK_DEV_RAM_SIZE=32768 |
| 371 | −CONFIG_CDROM_PKTCDVD=m | |
| 372 | −CONFIG_ATA_OVER_ETH=m | |
| 380 | +CONFIG_BLK_DEV_RAM_DAX=y | |
| 373 | 381 | CONFIG_VIRTIO_BLK=y |
| 374 | 382 | CONFIG_ENCLOSURE_SERVICES=m |
| 383 | +CONFIG_GENWQE=m | |
| 375 | 384 | CONFIG_RAID_ATTRS=m |
| 376 | 385 | CONFIG_SCSI=y |
| 377 | 386 | CONFIG_BLK_DEV_SD=y |
| @@ -437,6 +446,8 @@ CONFIG_NLMON=m · 59 unmodified lines | ||
| 437 | 446 | # CONFIG_NET_VENDOR_INTEL is not set |
| 438 | 447 | # CONFIG_NET_VENDOR_MARVELL is not set |
| 439 | 448 | CONFIG_MLX4_EN=m |
| 449 | +CONFIG_MLX5_CORE=m | |
| 450 | +CONFIG_MLX5_CORE_EN=y | |
| 440 | 451 | # CONFIG_NET_VENDOR_NATSEMI is not set |
| 441 | 452 | CONFIG_PPP=m |
| 442 | 453 | CONFIG_PPP_BSDCOMP=m |
| @@ -447,7 +458,6 @@ CONFIG_PPTP=m · 4 unmodified lines | ||
| 447 | 458 | CONFIG_PPPOL2TP=m |
| 448 | 459 | CONFIG_PPP_ASYNC=m |
| 449 | 460 | CONFIG_PPP_SYNC_TTY=m |
| 450 | −# CONFIG_INPUT_MOUSEDEV_PSAUX is not set | |
| 451 | 461 | # CONFIG_INPUT_KEYBOARD is not set |
| 452 | 462 | # CONFIG_INPUT_MOUSE is not set |
| 453 | 463 | # CONFIG_SERIO is not set |
| @@ -466,6 +476,7 @@ CONFIG_DIAG288_WATCHDOG=m · 12 unmodified lines | ||
| 466 | 476 | CONFIG_INFINIBAND=m |
| 467 | 477 | CONFIG_INFINIBAND_USER_ACCESS=m |
| 468 | 478 | CONFIG_MLX4_INFINIBAND=m |
| 479 | +CONFIG_MLX5_INFINIBAND=m | |
| 469 | 480 | CONFIG_VIRTIO_BALLOON=m |
| 470 | 481 | CONFIG_EXT4_FS=y |
| 471 | 482 | CONFIG_EXT4_FS_POSIX_ACL=y |
| @@ -481,11 +492,15 @@ CONFIG_XFS_QUOTA=y · 9 unmodified lines | ||
| 481 | 492 | CONFIG_XFS_POSIX_ACL=y |
| 482 | 493 | CONFIG_XFS_RT=y |
| 483 | 494 | CONFIG_GFS2_FS=m |
| 495 | +CONFIG_GFS2_FS_LOCKING_DLM=y | |
| 484 | 496 | CONFIG_OCFS2_FS=m |
| 485 | 497 | CONFIG_BTRFS_FS=y |
| 486 | 498 | CONFIG_BTRFS_FS_POSIX_ACL=y |
| 487 | 499 | CONFIG_NILFS2_FS=m |
| 500 | +CONFIG_FS_DAX=y | |
| 501 | +CONFIG_EXPORTFS_BLOCK_OPS=y | |
| 488 | 502 | CONFIG_FANOTIFY=y |
| 503 | +CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y | |
| 489 | 504 | CONFIG_QUOTA_NETLINK_INTERFACE=y |
| 490 | 505 | CONFIG_QFMT_V1=m |
| 491 | 506 | CONFIG_QFMT_V2=m |
| @@ -551,7 +566,6 @@ CONFIG_UNUSED_SYMBOLS=y · 59 unmodified lines | ||
| 551 | 566 | CONFIG_MAGIC_SYSRQ=y |
| 552 | 567 | CONFIG_DEBUG_MEMORY_INIT=y |
| 553 | 568 | CONFIG_PANIC_ON_OOPS=y |
| 554 | −CONFIG_TIMER_STATS=y | |
| 555 | 569 | CONFIG_RCU_TORTURE_TEST=m |
| 556 | 570 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 557 | 571 | CONFIG_LATENCYTOP=y |
| @@ -574,6 +588,7 @@ CONFIG_BIG_KEYS=y · 16 unmodified lines | ||
| 574 | 588 | CONFIG_ENCRYPTED_KEYS=m |
| 575 | 589 | CONFIG_SECURITY=y |
| 576 | 590 | CONFIG_SECURITY_NETWORK=y |
| 591 | +CONFIG_HARDENED_USERCOPY=y | |
| 577 | 592 | CONFIG_SECURITY_SELINUX=y |
| 578 | 593 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 579 | 594 | CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=0 |
| @@ -597,6 +612,7 @@ CONFIG_CRYPTO_CHACHA20POLY1305=m · 17 unmodified lines | ||
| 597 | 612 | CONFIG_CRYPTO_LRW=m |
| 598 | 613 | CONFIG_CRYPTO_PCBC=m |
| 599 | 614 | CONFIG_CRYPTO_KEYWRAP=m |
| 615 | +CONFIG_CRYPTO_CMAC=m | |
| 600 | 616 | CONFIG_CRYPTO_XCBC=m |
| 601 | 617 | CONFIG_CRYPTO_VMAC=m |
| 602 | 618 | CONFIG_CRYPTO_CRC32=m |
| @@ -609,6 +625,7 @@ CONFIG_CRYPTO_SHA512=m · 6 unmodified lines | ||
| 609 | 625 | CONFIG_CRYPTO_SHA3=m |
| 610 | 626 | CONFIG_CRYPTO_TGR192=m |
| 611 | 627 | CONFIG_CRYPTO_WP512=m |
| 628 | +CONFIG_CRYPTO_AES_TI=m | |
| 612 | 629 | CONFIG_CRYPTO_ANUBIS=m |
| 613 | 630 | CONFIG_CRYPTO_BLOWFISH=m |
| 614 | 631 | CONFIG_CRYPTO_CAMELLIA=m |
| @@ -624,6 +641,7 @@ CONFIG_CRYPTO_TWOFISH=m · 9 unmodified lines | ||
| 624 | 641 | CONFIG_CRYPTO_842=m |
| 625 | 642 | CONFIG_CRYPTO_LZ4=m |
| 626 | 643 | CONFIG_CRYPTO_LZ4HC=m |
| 644 | +CONFIG_CRYPTO_ANSI_CPRNG=m | |
| 627 | 645 | CONFIG_CRYPTO_USER_API_HASH=m |
| 628 | 646 | CONFIG_CRYPTO_USER_API_SKCIPHER=m |
| 629 | 647 | CONFIG_CRYPTO_USER_API_RNG=m |
| @@ -635,6 +653,7 @@ CONFIG_CRYPTO_SHA256_S390=m · 5 unmodified lines | ||
| 635 | 653 | CONFIG_CRYPTO_SHA512_S390=m |
| 636 | 654 | CONFIG_CRYPTO_DES_S390=m |
| 637 | 655 | CONFIG_CRYPTO_AES_S390=m |
| 656 | +CONFIG_CRYPTO_PAES_S390=m | |
| 638 | 657 | CONFIG_CRYPTO_GHASH_S390=m |
| 639 | 658 | CONFIG_CRYPTO_CRC32_S390=y |
| 640 | 659 | CONFIG_CRC7=m |
| @@ -12,8 +12,10 @@ CONFIG_TUNE_ZEC12=y · 11 unmodified lines | ||
| 12 | 12 | CONFIG_NR_CPUS=2 |
| 13 | 13 | # CONFIG_HOTPLUG_CPU is not set |
| 14 | 14 | CONFIG_HZ_100=y |
| 15 | +# CONFIG_ARCH_RANDOM is not set | |
| 15 | 16 | # CONFIG_COMPACTION is not set |
| 16 | 17 | # CONFIG_MIGRATION is not set |
| 18 | +# CONFIG_BOUNCE is not set | |
| 17 | 19 | # CONFIG_CHECK_STACK is not set |
| 18 | 20 | # CONFIG_CHSC_SCH is not set |
| 19 | 21 | # CONFIG_SCM_BUS is not set |
| @@ -36,11 +38,11 @@ CONFIG_SCSI_CONSTANTS=y · 16 unmodified lines | ||
| 36 | 38 | CONFIG_SCSI_LOGGING=y |
| 37 | 39 | CONFIG_SCSI_FC_ATTRS=y |
| 38 | 40 | CONFIG_ZFCP=y |
| 39 | −# CONFIG_INPUT_MOUSEDEV_PSAUX is not set | |
| 40 | 41 | # CONFIG_INPUT_KEYBOARD is not set |
| 41 | 42 | # CONFIG_INPUT_MOUSE is not set |
| 42 | 43 | # CONFIG_SERIO is not set |
| 43 | 44 | # CONFIG_HVC_IUCV is not set |
| 45 | +# CONFIG_HW_RANDOM_S390 is not set | |
| 44 | 46 | CONFIG_RAW_DRIVER=y |
| 45 | 47 | # CONFIG_SCLP_ASYNC is not set |
| 46 | 48 | # CONFIG_HMC_DRV is not set |
| @@ -54,9 +56,9 @@ CONFIG_RAW_DRIVER=y · 7 unmodified lines | ||
| 54 | 56 | # CONFIG_INOTIFY_USER is not set |
| 55 | 57 | CONFIG_CONFIGFS_FS=y |
| 56 | 58 | # CONFIG_MISC_FILESYSTEMS is not set |
| 59 | +# CONFIG_NETWORK_FILESYSTEMS is not set | |
| 57 | 60 | CONFIG_PRINTK_TIME=y |
| 58 | 61 | CONFIG_DEBUG_INFO=y |
| 59 | −CONFIG_DEBUG_FS=y | |
| 60 | 62 | CONFIG_DEBUG_KERNEL=y |
| 61 | 63 | CONFIG_PANIC_ON_OOPS=y |
| 62 | 64 | # CONFIG_SCHED_DEBUG is not set |
| @@ -28,6 +28,7 @@ CONFIG_NAMESPACES=y · 27 unmodified lines | ||
| 28 | 28 | CONFIG_USER_NS=y |
| 29 | 29 | CONFIG_BLK_DEV_INITRD=y |
| 30 | 30 | CONFIG_EXPERT=y |
| 31 | +# CONFIG_SYSFS_SYSCALL is not set | |
| 31 | 32 | CONFIG_BPF_SYSCALL=y |
| 32 | 33 | CONFIG_USERFAULTFD=y |
| 33 | 34 | # CONFIG_COMPAT_BRK is not set |
| @@ -108,7 +109,6 @@ CONFIG_ZFCP=y · 74 unmodified lines | ||
| 108 | 109 | CONFIG_SCSI_VIRTIO=y |
| 109 | 110 | CONFIG_MD=y |
| 110 | 111 | CONFIG_MD_LINEAR=m |
| 111 | −CONFIG_MD_RAID0=m | |
| 112 | 112 | CONFIG_MD_MULTIPATH=m |
| 113 | 113 | CONFIG_BLK_DEV_DM=y |
| 114 | 114 | CONFIG_DM_CRYPT=m |
| @@ -131,6 +131,7 @@ CONFIG_TUN=m · 16 unmodified lines | ||
| 131 | 131 | CONFIG_VIRTIO_NET=y |
| 132 | 132 | # CONFIG_NET_VENDOR_ALACRITECH is not set |
| 133 | 133 | # CONFIG_NET_VENDOR_SOLARFLARE is not set |
| 134 | +# CONFIG_NET_VENDOR_SYNOPSYS is not set | |
| 134 | 135 | # CONFIG_INPUT is not set |
| 135 | 136 | # CONFIG_SERIO is not set |
| 136 | 137 | CONFIG_DEVKMEM=y |
| @@ -162,7 +163,6 @@ CONFIG_MAGIC_SYSRQ=y · 25 unmodified lines | ||
| 162 | 163 | CONFIG_DEBUG_PAGEALLOC=y |
| 163 | 164 | CONFIG_DETECT_HUNG_TASK=y |
| 164 | 165 | CONFIG_PANIC_ON_OOPS=y |
| 165 | −CONFIG_TIMER_STATS=y | |
| 166 | 166 | CONFIG_DEBUG_RT_MUTEXES=y |
| 167 | 167 | CONFIG_PROVE_LOCKING=y |
| 168 | 168 | CONFIG_LOCK_STAT=y |
| @@ -172,14 +172,12 @@ CONFIG_DEBUG_LIST=y · 3 unmodified lines | ||
| 172 | 172 | CONFIG_DEBUG_SG=y |
| 173 | 173 | CONFIG_DEBUG_NOTIFIERS=y |
| 174 | 174 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 175 | −CONFIG_RCU_TRACE=y | |
| 176 | 175 | CONFIG_LATENCYTOP=y |
| 177 | 176 | CONFIG_SCHED_TRACER=y |
| 178 | 177 | CONFIG_FTRACE_SYSCALLS=y |
| 179 | 178 | CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y |
| 180 | 179 | CONFIG_STACK_TRACER=y |
| 181 | 180 | CONFIG_BLK_DEV_IO_TRACE=y |
| 182 | −CONFIG_UPROBE_EVENTS=y | |
| 183 | 181 | CONFIG_FUNCTION_PROFILER=y |
| 184 | 182 | CONFIG_TRACE_ENUM_MAP_FILE=y |
| 185 | 183 | CONFIG_KPROBES_SANITY_TEST=y |
| @@ -190,7 +188,6 @@ CONFIG_CRYPTO_CCM=m · 4 unmodified lines | ||
| 190 | 188 | CONFIG_CRYPTO_GCM=m |
| 191 | 189 | CONFIG_CRYPTO_CBC=y |
| 192 | 190 | CONFIG_CRYPTO_CTS=m |
| 193 | −CONFIG_CRYPTO_ECB=m | |
| 194 | 191 | CONFIG_CRYPTO_LRW=m |
| 195 | 192 | CONFIG_CRYPTO_PCBC=m |
| 196 | 193 | CONFIG_CRYPTO_XTS=m |
| @@ -230,6 +227,7 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m · 33 unmodified lines | ||
| 230 | 227 | CONFIG_CRYPTO_USER_API_RNG=m |
| 231 | 228 | CONFIG_ZCRYPT=m |
| 232 | 229 | CONFIG_PKEY=m |
| 230 | +CONFIG_CRYPTO_PAES_S390=m | |
| 233 | 231 | CONFIG_CRYPTO_SHA1_S390=m |
| 234 | 232 | CONFIG_CRYPTO_SHA256_S390=m |
| 235 | 233 | CONFIG_CRYPTO_SHA512_S390=m |
| @@ -541,7 +541,6 @@ struct kvm_s390_float_interrupt { · 540 unmodified lines | ||
| 541 | 541 | struct mutex ais_lock; |
| 542 | 542 | u8 simm; |
| 543 | 543 | u8 nimm; |
| 544 | − int ais_enabled; | |
| 545 | 544 | }; |
| 546 | 545 | |
| 547 | 546 | struct kvm_hw_wp_info_arch { |
| @@ -231,12 +231,17 @@ ENTRY(sie64a) · 230 unmodified lines | ||
| 231 | 231 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce |
| 232 | 232 | .Lsie_done: |
| 233 | 233 | # some program checks are suppressing. C code (e.g. do_protection_exception) |
| 234 | −# will rewind the PSW by the ILC, which is 4 bytes in case of SIE. Other | |
| 235 | −# instructions between sie64a and .Lsie_done should not cause program | |
| 236 | −# interrupts. So lets use a nop (47 00 00 00) as a landing pad. | |
| 234 | +# will rewind the PSW by the ILC, which is often 4 bytes in case of SIE. There | |
| 235 | +# are some corner cases (e.g. runtime instrumentation) where ILC is unpredictable. | |
| 236 | +# Other instructions between sie64a and .Lsie_done should not cause program | |
| 237 | +# interrupts. So lets use 3 nops as a landing pad for all possible rewinds. | |
| 237 | 238 | # See also .Lcleanup_sie |
| 238 | −.Lrewind_pad: | |
| 239 | − nop 0 | |
| 239 | +.Lrewind_pad6: | |
| 240 | + nopr 7 | |
| 241 | +.Lrewind_pad4: | |
| 242 | + nopr 7 | |
| 243 | +.Lrewind_pad2: | |
| 244 | + nopr 7 | |
| 240 | 245 | .globl sie_exit |
| 241 | 246 | sie_exit: |
| 242 | 247 | lg %r14,__SF_EMPTY+8(%r15) # load guest register save area |
| @@ -249,7 +254,9 @@ sie_exit: · 6 unmodified lines | ||
| 249 | 254 | stg %r14,__SF_EMPTY+16(%r15) # set exit reason code |
| 250 | 255 | j sie_exit |
| 251 | 256 | |
| 252 | − EX_TABLE(.Lrewind_pad,.Lsie_fault) | |
| 257 | + EX_TABLE(.Lrewind_pad6,.Lsie_fault) | |
| 258 | + EX_TABLE(.Lrewind_pad4,.Lsie_fault) | |
| 259 | + EX_TABLE(.Lrewind_pad2,.Lsie_fault) | |
| 253 | 260 | EX_TABLE(sie_exit,.Lsie_fault) |
| 254 | 261 | EXPORT_SYMBOL(sie64a) |
| 255 | 262 | EXPORT_SYMBOL(sie_exit) |
| @@ -2160,7 +2160,7 @@ static int modify_ais_mode(struct kvm *kvm, struct kvm_device_attr *attr) · 2159 unmodified lines | ||
| 2160 | 2160 | struct kvm_s390_ais_req req; |
| 2161 | 2161 | int ret = 0; |
| 2162 | 2162 | |
| 2163 | − if (!fi->ais_enabled) | |
| 2163 | + if (!test_kvm_facility(kvm, 72)) | |
| 2164 | 2164 | return -ENOTSUPP; |
| 2165 | 2165 | |
| 2166 | 2166 | if (copy_from_user(&req, (void __user *)attr->addr, sizeof(req))) |
| @@ -2204,7 +2204,7 @@ static int kvm_s390_inject_airq(struct kvm *kvm, · 37 unmodified lines | ||
| 2204 | 2204 | }; |
| 2205 | 2205 | int ret = 0; |
| 2206 | 2206 | |
| 2207 | − if (!fi->ais_enabled || !adapter->suppressible) | |
| 2207 | + if (!test_kvm_facility(kvm, 72) || !adapter->suppressible) | |
| 2208 | 2208 | return kvm_s390_inject_vm(kvm, &s390int); |
| 2209 | 2209 | |
| 2210 | 2210 | mutex_lock(&fi->ais_lock); |
| @@ -558,7 +558,6 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) · 557 unmodified lines | ||
| 558 | 558 | } else { |
| 559 | 559 | set_kvm_facility(kvm->arch.model.fac_mask, 72); |
| 560 | 560 | set_kvm_facility(kvm->arch.model.fac_list, 72); |
| 561 | − kvm->arch.float_int.ais_enabled = 1; | |
| 562 | 561 | r = 0; |
| 563 | 562 | } |
| 564 | 563 | mutex_unlock(&kvm->lock); |
| @@ -1533,7 +1532,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 968 unmodified lines | ||
| 1533 | 1532 | mutex_init(&kvm->arch.float_int.ais_lock); |
| 1534 | 1533 | kvm->arch.float_int.simm = 0; |
| 1535 | 1534 | kvm->arch.float_int.nimm = 0; |
| 1536 | − kvm->arch.float_int.ais_enabled = 0; | |
| 1537 | 1535 | spin_lock_init(&kvm->arch.float_int.lock); |
| 1538 | 1536 | for (i = 0; i < FIRQ_LIST_COUNT; i++) |
| 1539 | 1537 | INIT_LIST_HEAD(&kvm->arch.float_int.lists[i]); |
| @@ -577,9 +577,6 @@ config SYSVIPC_COMPAT · 576 unmodified lines | ||
| 577 | 577 | depends on COMPAT && SYSVIPC |
| 578 | 578 | default y |
| 579 | 579 | |
| 580 | −config KEYS_COMPAT | |
| 581 | − def_bool y if COMPAT && KEYS | |
| 582 | − | |
| 583 | 580 | endmenu |
| 584 | 581 | |
| 585 | 582 | source "net/Kconfig" |
| @@ -2776,10 +2776,6 @@ config COMPAT_FOR_U64_ALIGNMENT · 2775 unmodified lines | ||
| 2776 | 2776 | config SYSVIPC_COMPAT |
| 2777 | 2777 | def_bool y |
| 2778 | 2778 | depends on SYSVIPC |
| 2779 | − | |
| 2780 | −config KEYS_COMPAT | |
| 2781 | − def_bool y | |
| 2782 | − depends on KEYS | |
| 2783 | 2779 | endif |
| 2784 | 2780 | |
| 2785 | 2781 | endmenu |
| @@ -255,6 +255,7 @@ static void init_cyrix(struct cpuinfo_x86 *c) · 254 unmodified lines | ||
| 255 | 255 | break; |
| 256 | 256 | |
| 257 | 257 | case 4: /* MediaGX/GXm or Geode GXM/GXLV/GX1 */ |
| 258 | + case 11: /* GX1 with inverted Device ID */ | |
| 258 | 259 | #ifdef CONFIG_PCI |
| 259 | 260 | { |
| 260 | 261 | u32 vendor, device; |
| @@ -619,6 +619,9 @@ int __init save_microcode_in_initrd_intel(void) · 618 unmodified lines | ||
| 619 | 619 | |
| 620 | 620 | show_saved_mc(); |
| 621 | 621 | |
| 622 | + /* initrd is going away, clear patch ptr. */ | |
| 623 | + intel_ucode_patch = NULL; | |
| 624 | + | |
| 622 | 625 | return 0; |
| 623 | 626 | } |
| 624 | 627 | |
| @@ -161,8 +161,8 @@ void kvm_async_pf_task_wait(u32 token) · 160 unmodified lines | ||
| 161 | 161 | */ |
| 162 | 162 | rcu_irq_exit(); |
| 163 | 163 | native_safe_halt(); |
| 164 | − rcu_irq_enter(); | |
| 165 | 164 | local_irq_disable(); |
| 165 | + rcu_irq_enter(); | |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | if (!n.halted) |
| @@ -780,18 +780,20 @@ out: · 779 unmodified lines | ||
| 780 | 780 | static int move_to_next_stateful_cpuid_entry(struct kvm_vcpu *vcpu, int i) |
| 781 | 781 | { |
| 782 | 782 | struct kvm_cpuid_entry2 *e = &vcpu->arch.cpuid_entries[i]; |
| 783 | − int j, nent = vcpu->arch.cpuid_nent; | |
| 783 | + struct kvm_cpuid_entry2 *ej; | |
| 784 | + int j = i; | |
| 785 | + int nent = vcpu->arch.cpuid_nent; | |
| 784 | 786 | |
| 785 | 787 | e->flags &= ~KVM_CPUID_FLAG_STATE_READ_NEXT; |
| 786 | 788 | /* when no next entry is found, the current entry[i] is reselected */ |
| 787 | − for (j = i + 1; ; j = (j + 1) % nent) { | |
| 788 | − struct kvm_cpuid_entry2 *ej = &vcpu->arch.cpuid_entries[j]; | |
| 789 | − if (ej->function == e->function) { | |
| 790 | − ej->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT; | |
| 791 | − return j; | |
| 792 | − } | |
| 793 | − } | |
| 794 | − return 0; /* silence gcc, even though control never reaches here */ | |
| 789 | + do { | |
| 790 | + j = (j + 1) % nent; | |
| 791 | + ej = &vcpu->arch.cpuid_entries[j]; | |
| 792 | + } while (ej->function != e->function); | |
| 793 | + | |
| 794 | + ej->flags |= KVM_CPUID_FLAG_STATE_READ_NEXT; | |
| 795 | + | |
| 796 | + return j; | |
| 795 | 797 | } |
| 796 | 798 | |
| 797 | 799 | /* find an entry with matching function, matching index (if needed), and that |
| @@ -3698,12 +3698,15 @@ static int kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn) · 3697 unmodified lines | ||
| 3698 | 3698 | return kvm_setup_async_pf(vcpu, gva, kvm_vcpu_gfn_to_hva(vcpu, gfn), &arch); |
| 3699 | 3699 | } |
| 3700 | 3700 | |
| 3701 | −static bool can_do_async_pf(struct kvm_vcpu *vcpu) | |
| 3701 | +bool kvm_can_do_async_pf(struct kvm_vcpu *vcpu) | |
| 3702 | 3702 | { |
| 3703 | 3703 | if (unlikely(!lapic_in_kernel(vcpu) || |
| 3704 | 3704 | kvm_event_needs_reinjection(vcpu))) |
| 3705 | 3705 | return false; |
| 3706 | 3706 | |
| 3707 | + if (is_guest_mode(vcpu)) | |
| 3708 | + return false; | |
| 3709 | + | |
| 3707 | 3710 | return kvm_x86_ops->interrupt_allowed(vcpu); |
| 3708 | 3711 | } |
| 3709 | 3712 | |
| @@ -3719,7 +3722,7 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn, · 9 unmodified lines | ||
| 3719 | 3722 | if (!async) |
| 3720 | 3723 | return false; /* *pfn has correct page already */ |
| 3721 | 3724 | |
| 3722 | − if (!prefault && can_do_async_pf(vcpu)) { | |
| 3725 | + if (!prefault && kvm_can_do_async_pf(vcpu)) { | |
| 3723 | 3726 | trace_kvm_try_async_get_page(gva, gfn); |
| 3724 | 3727 | if (kvm_find_async_pf_gfn(vcpu, gfn)) { |
| 3725 | 3728 | trace_kvm_async_pf_doublefault(gva, gfn); |
| @@ -76,6 +76,7 @@ int handle_mmio_page_fault(struct kvm_vcpu *vcpu, u64 addr, bool direct); · 75 unmodified lines | ||
| 76 | 76 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu); |
| 77 | 77 | void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly, |
| 78 | 78 | bool accessed_dirty); |
| 79 | +bool kvm_can_do_async_pf(struct kvm_vcpu *vcpu); | |
| 79 | 80 | |
| 80 | 81 | static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) |
| 81 | 82 | { |
| @@ -2425,7 +2425,7 @@ static int nested_vmx_check_exception(struct kvm_vcpu *vcpu, unsigned nr) · 2424 unmodified lines | ||
| 2425 | 2425 | if (!(vmcs12->exception_bitmap & (1u << nr))) |
| 2426 | 2426 | return 0; |
| 2427 | 2427 | |
| 2428 | − nested_vmx_vmexit(vcpu, to_vmx(vcpu)->exit_reason, | |
| 2428 | + nested_vmx_vmexit(vcpu, EXIT_REASON_EXCEPTION_NMI, | |
| 2429 | 2429 | vmcs_read32(VM_EXIT_INTR_INFO), |
| 2430 | 2430 | vmcs_readl(EXIT_QUALIFICATION)); |
| 2431 | 2431 | return 1; |
| @@ -8607,8 +8607,7 @@ bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu) · 8606 unmodified lines | ||
| 8607 | 8607 | if (!(vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED)) |
| 8608 | 8608 | return true; |
| 8609 | 8609 | else |
| 8610 | − return !kvm_event_needs_reinjection(vcpu) && | |
| 8611 | − kvm_x86_ops->interrupt_allowed(vcpu); | |
| 8610 | + return kvm_can_do_async_pf(vcpu); | |
| 8612 | 8611 | } |
| 8613 | 8612 | |
| 8614 | 8613 | void kvm_arch_start_assignment(struct kvm *kvm) |
| @@ -29,7 +29,8 @@ static inline void variant_irq_disable(unsigned int irq) { } · 28 unmodified lines | ||
| 29 | 29 | # define PLATFORM_NR_IRQS 0 |
| 30 | 30 | #endif |
| 31 | 31 | #define XTENSA_NR_IRQS XCHAL_NUM_INTERRUPTS |
| 32 | −#define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS) | |
| 32 | +#define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS + 1) | |
| 33 | +#define XTENSA_PIC_LINUX_IRQ(hwirq) ((hwirq) + 1) | |
| 33 | 34 | |
| 34 | 35 | #if VARIANT_NR_IRQS == 0 |
| 35 | 36 | static inline void variant_init_irq(void) { } |
| @@ -34,11 +34,6 @@ asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs) · 33 unmodified lines | ||
| 34 | 34 | { |
| 35 | 35 | int irq = irq_find_mapping(NULL, hwirq); |
| 36 | 36 | |
| 37 | − if (hwirq >= NR_IRQS) { | |
| 38 | − printk(KERN_EMERG "%s: cannot handle IRQ %d\n", | |
| 39 | − __func__, hwirq); | |
| 40 | − } | |
| 41 | − | |
| 42 | 37 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
| 43 | 38 | /* Debugging check for stack overflow: is there less than 1KB free? */ |
| 44 | 39 | { |
| @@ -593,8 +593,7 @@ c_show(struct seq_file *f, void *slot) · 592 unmodified lines | ||
| 593 | 593 | (ccount_freq/10000) % 100, |
| 594 | 594 | loops_per_jiffy/(500000/HZ), |
| 595 | 595 | (loops_per_jiffy/(5000/HZ)) % 100); |
| 596 | − | |
| 597 | − seq_printf(f,"flags\t\t: " | |
| 596 | + seq_puts(f, "flags\t\t: " | |
| 598 | 597 | #if XCHAL_HAVE_NMI |
| 599 | 598 | "nmi " |
| 600 | 599 | #endif |
| @@ -118,7 +118,7 @@ SECTIONS · 117 unmodified lines | ||
| 118 | 118 | SECTION_VECTOR (.KernelExceptionVector.text, KERNEL_VECTOR_VADDR) |
| 119 | 119 | SECTION_VECTOR (.UserExceptionVector.literal, USER_VECTOR_VADDR - 4) |
| 120 | 120 | SECTION_VECTOR (.UserExceptionVector.text, USER_VECTOR_VADDR) |
| 121 | − SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 48) | |
| 121 | + SECTION_VECTOR (.DoubleExceptionVector.literal, DOUBLEEXC_VECTOR_VADDR - 20) | |
| 122 | 122 | SECTION_VECTOR (.DoubleExceptionVector.text, DOUBLEEXC_VECTOR_VADDR) |
| 123 | 123 | #endif |
| 124 | 124 | |
| @@ -306,13 +306,13 @@ SECTIONS · 181 unmodified lines | ||
| 306 | 306 | .UserExceptionVector.literal) |
| 307 | 307 | SECTION_VECTOR (_DoubleExceptionVector_literal, |
| 308 | 308 | .DoubleExceptionVector.literal, |
| 309 | − DOUBLEEXC_VECTOR_VADDR - 48, | |
| 309 | + DOUBLEEXC_VECTOR_VADDR - 20, | |
| 310 | 310 | SIZEOF(.UserExceptionVector.text), |
| 311 | 311 | .UserExceptionVector.text) |
| 312 | 312 | SECTION_VECTOR (_DoubleExceptionVector_text, |
| 313 | 313 | .DoubleExceptionVector.text, |
| 314 | 314 | DOUBLEEXC_VECTOR_VADDR, |
| 315 | − 48, | |
| 315 | + 20, | |
| 316 | 316 | .DoubleExceptionVector.literal) |
| 317 | 317 | |
| 318 | 318 | . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; |
| @@ -317,8 +317,7 @@ static int __init simdisk_init(void) · 316 unmodified lines | ||
| 317 | 317 | if (simdisk_count > MAX_SIMDISK_COUNT) |
| 318 | 318 | simdisk_count = MAX_SIMDISK_COUNT; |
| 319 | 319 | |
| 320 | − sddev = kmalloc(simdisk_count * sizeof(struct simdisk), | |
| 321 | − GFP_KERNEL); | |
| 320 | + sddev = kmalloc_array(simdisk_count, sizeof(*sddev), GFP_KERNEL); | |
| 322 | 321 | if (sddev == NULL) |
| 323 | 322 | goto out_unregister; |
| 324 | 323 | |
| @@ -24,16 +24,18 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | /* Interrupt configuration. */ |
| 26 | 26 | |
| 27 | −#define PLATFORM_NR_IRQS 10 | |
| 27 | +#define PLATFORM_NR_IRQS 0 | |
| 28 | 28 | |
| 29 | 29 | /* Default assignment of LX60 devices to external interrupts. */ |
| 30 | 30 | |
| 31 | 31 | #ifdef CONFIG_XTENSA_MX |
| 32 | 32 | #define DUART16552_INTNUM XCHAL_EXTINT3_NUM |
| 33 | 33 | #define OETH_IRQ XCHAL_EXTINT4_NUM |
| 34 | +#define C67X00_IRQ XCHAL_EXTINT8_NUM | |
| 34 | 35 | #else |
| 35 | 36 | #define DUART16552_INTNUM XCHAL_EXTINT0_NUM |
| 36 | 37 | #define OETH_IRQ XCHAL_EXTINT1_NUM |
| 38 | +#define C67X00_IRQ XCHAL_EXTINT5_NUM | |
| 37 | 39 | #endif |
| 38 | 40 | |
| 39 | 41 | /* |
| @@ -63,5 +65,5 @@ · 23 unmodified lines | ||
| 63 | 65 | |
| 64 | 66 | #define C67X00_PADDR (XCHAL_KIO_PADDR + 0x0D0D0000) |
| 65 | 67 | #define C67X00_SIZE 0x10 |
| 66 | −#define C67X00_IRQ 5 | |
| 68 | + | |
| 67 | 69 | #endif /* __XTENSA_XTAVNET_HARDWARE_H */ |
| @@ -175,8 +175,8 @@ static struct resource ethoc_res[] = { · 174 unmodified lines | ||
| 175 | 175 | .flags = IORESOURCE_MEM, |
| 176 | 176 | }, |
| 177 | 177 | [2] = { /* IRQ number */ |
| 178 | − .start = OETH_IRQ, | |
| 179 | − .end = OETH_IRQ, | |
| 178 | + .start = XTENSA_PIC_LINUX_IRQ(OETH_IRQ), | |
| 179 | + .end = XTENSA_PIC_LINUX_IRQ(OETH_IRQ), | |
| 180 | 180 | .flags = IORESOURCE_IRQ, |
| 181 | 181 | }, |
| 182 | 182 | }; |
| @@ -213,8 +213,8 @@ static struct resource c67x00_res[] = { · 30 unmodified lines | ||
| 213 | 213 | .flags = IORESOURCE_MEM, |
| 214 | 214 | }, |
| 215 | 215 | [1] = { /* IRQ number */ |
| 216 | − .start = C67X00_IRQ, | |
| 217 | − .end = C67X00_IRQ, | |
| 216 | + .start = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ), | |
| 217 | + .end = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ), | |
| 218 | 218 | .flags = IORESOURCE_IRQ, |
| 219 | 219 | }, |
| 220 | 220 | }; |
| @@ -247,7 +247,7 @@ static struct resource serial_resource = { · 26 unmodified lines | ||
| 247 | 247 | static struct plat_serial8250_port serial_platform_data[] = { |
| 248 | 248 | [0] = { |
| 249 | 249 | .mapbase = DUART16552_PADDR, |
| 250 | − .irq = DUART16552_INTNUM, | |
| 250 | + .irq = XTENSA_PIC_LINUX_IRQ(DUART16552_INTNUM), | |
| 251 | 251 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | |
| 252 | 252 | UPF_IOREMAP, |
| 253 | 253 | .iotype = XCHAL_HAVE_BE ? UPIO_MEM32BE : UPIO_MEM32, |
| @@ -52,7 +52,7 @@ BFQG_FLAG_FNS(idling) · 51 unmodified lines | ||
| 52 | 52 | BFQG_FLAG_FNS(empty) |
| 53 | 53 | #undef BFQG_FLAG_FNS |
| 54 | 54 | |
| 55 | −/* This should be called with the queue_lock held. */ | |
| 55 | +/* This should be called with the scheduler lock held. */ | |
| 56 | 56 | static void bfqg_stats_update_group_wait_time(struct bfqg_stats *stats) |
| 57 | 57 | { |
| 58 | 58 | unsigned long long now; |
| @@ -67,7 +67,7 @@ static void bfqg_stats_update_group_wait_time(struct bfqg_stats *stats) · 8 unmodified lines | ||
| 67 | 67 | bfqg_stats_clear_waiting(stats); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | −/* This should be called with the queue_lock held. */ | |
| 70 | +/* This should be called with the scheduler lock held. */ | |
| 71 | 71 | static void bfqg_stats_set_start_group_wait_time(struct bfq_group *bfqg, |
| 72 | 72 | struct bfq_group *curr_bfqg) |
| 73 | 73 | { |
| @@ -81,7 +81,7 @@ static void bfqg_stats_set_start_group_wait_time(struct bfq_group *bfqg, · 7 unmodified lines | ||
| 81 | 81 | bfqg_stats_mark_waiting(stats); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | −/* This should be called with the queue_lock held. */ | |
| 84 | +/* This should be called with the scheduler lock held. */ | |
| 85 | 85 | static void bfqg_stats_end_empty_time(struct bfqg_stats *stats) |
| 86 | 86 | { |
| 87 | 87 | unsigned long long now; |
| @@ -203,12 +203,30 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq) · 115 unmodified lines | ||
| 203 | 203 | |
| 204 | 204 | static void bfqg_get(struct bfq_group *bfqg) |
| 205 | 205 | { |
| 206 | − return blkg_get(bfqg_to_blkg(bfqg)); | |
| 206 | + bfqg->ref++; | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | void bfqg_put(struct bfq_group *bfqg) |
| 210 | 210 | { |
| 211 | − return blkg_put(bfqg_to_blkg(bfqg)); | |
| 211 | + bfqg->ref--; | |
| 212 | + | |
| 213 | + if (bfqg->ref == 0) | |
| 214 | + kfree(bfqg); | |
| 215 | +} | |
| 216 | + | |
| 217 | +static void bfqg_and_blkg_get(struct bfq_group *bfqg) | |
| 218 | +{ | |
| 219 | + /* see comments in bfq_bic_update_cgroup for why refcounting bfqg */ | |
| 220 | + bfqg_get(bfqg); | |
| 221 | + | |
| 222 | + blkg_get(bfqg_to_blkg(bfqg)); | |
| 223 | +} | |
| 224 | + | |
| 225 | +void bfqg_and_blkg_put(struct bfq_group *bfqg) | |
| 226 | +{ | |
| 227 | + bfqg_put(bfqg); | |
| 228 | + | |
| 229 | + blkg_put(bfqg_to_blkg(bfqg)); | |
| 212 | 230 | } |
| 213 | 231 | |
| 214 | 232 | void bfqg_stats_update_io_add(struct bfq_group *bfqg, struct bfq_queue *bfqq, |
| @@ -312,7 +330,11 @@ void bfq_init_entity(struct bfq_entity *entity, struct bfq_group *bfqg) · 97 unmodified lines | ||
| 312 | 330 | if (bfqq) { |
| 313 | 331 | bfqq->ioprio = bfqq->new_ioprio; |
| 314 | 332 | bfqq->ioprio_class = bfqq->new_ioprio_class; |
| 315 | − bfqg_get(bfqg); | |
| 333 | + /* | |
| 334 | + * Make sure that bfqg and its associated blkg do not | |
| 335 | + * disappear before entity. | |
| 336 | + */ | |
| 337 | + bfqg_and_blkg_get(bfqg); | |
| 316 | 338 | } |
| 317 | 339 | entity->parent = bfqg->my_entity; /* NULL for root group */ |
| 318 | 340 | entity->sched_data = &bfqg->sched_data; |
| @@ -399,6 +421,8 @@ struct blkg_policy_data *bfq_pd_alloc(gfp_t gfp, int node) · 80 unmodified lines | ||
| 399 | 421 | return NULL; |
| 400 | 422 | } |
| 401 | 423 | |
| 424 | + /* see comments in bfq_bic_update_cgroup for why refcounting */ | |
| 425 | + bfqg_get(bfqg); | |
| 402 | 426 | return &bfqg->pd; |
| 403 | 427 | } |
| 404 | 428 | |
| @@ -426,7 +450,7 @@ void bfq_pd_free(struct blkg_policy_data *pd) · 21 unmodified lines | ||
| 426 | 450 | struct bfq_group *bfqg = pd_to_bfqg(pd); |
| 427 | 451 | |
| 428 | 452 | bfqg_stats_exit(&bfqg->stats); |
| 429 | − return kfree(bfqg); | |
| 453 | + bfqg_put(bfqg); | |
| 430 | 454 | } |
| 431 | 455 | |
| 432 | 456 | void bfq_pd_reset_stats(struct blkg_policy_data *pd) |
| @@ -496,9 +520,10 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, · 63 unmodified lines | ||
| 496 | 520 | * Move @bfqq to @bfqg, deactivating it from its old group and reactivating |
| 497 | 521 | * it on the new one. Avoid putting the entity on the old group idle tree. |
| 498 | 522 | * |
| 499 | − * Must be called under the queue lock; the cgroup owning @bfqg must | |
| 500 | − * not disappear (by now this just means that we are called under | |
| 501 | − * rcu_read_lock()). | |
| 523 | + * Must be called under the scheduler lock, to make sure that the blkg | |
| 524 | + * owning @bfqg does not disappear (see comments in | |
| 525 | + * bfq_bic_update_cgroup on guaranteeing the consistency of blkg | |
| 526 | + * objects). | |
| 502 | 527 | */ |
| 503 | 528 | void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, |
| 504 | 529 | struct bfq_group *bfqg) |
| @@ -519,16 +544,12 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, · 14 unmodified lines | ||
| 519 | 544 | bfq_deactivate_bfqq(bfqd, bfqq, false, false); |
| 520 | 545 | else if (entity->on_st) |
| 521 | 546 | bfq_put_idle_entity(bfq_entity_service_tree(entity), entity); |
| 522 | − bfqg_put(bfqq_group(bfqq)); | |
| 547 | + bfqg_and_blkg_put(bfqq_group(bfqq)); | |
| 523 | 548 | |
| 524 | − /* | |
| 525 | − * Here we use a reference to bfqg. We don't need a refcounter | |
| 526 | − * as the cgroup reference will not be dropped, so that its | |
| 527 | − * destroy() callback will not be invoked. | |
| 528 | − */ | |
| 529 | 549 | entity->parent = bfqg->my_entity; |
| 530 | 550 | entity->sched_data = &bfqg->sched_data; |
| 531 | − bfqg_get(bfqg); | |
| 551 | + /* pin down bfqg and its associated blkg */ | |
| 552 | + bfqg_and_blkg_get(bfqg); | |
| 532 | 553 | |
| 533 | 554 | if (bfq_bfqq_busy(bfqq)) { |
| 534 | 555 | bfq_pos_tree_add_move(bfqd, bfqq); |
| @@ -545,8 +566,9 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, · 10 unmodified lines | ||
| 545 | 566 | * @bic: the bic to move. |
| 546 | 567 | * @blkcg: the blk-cgroup to move to. |
| 547 | 568 | * |
| 548 | − * Move bic to blkcg, assuming that bfqd->queue is locked; the caller | |
| 549 | − * has to make sure that the reference to cgroup is valid across the call. | |
| 569 | + * Move bic to blkcg, assuming that bfqd->lock is held; which makes | |
| 570 | + * sure that the reference to cgroup is valid across the call (see | |
| 571 | + * comments in bfq_bic_update_cgroup on this issue) | |
| 550 | 572 | * |
| 551 | 573 | * NOTE: an alternative approach might have been to store the current |
| 552 | 574 | * cgroup in bfqq and getting a reference to it, reducing the lookup |
| @@ -604,6 +626,57 @@ void bfq_bic_update_cgroup(struct bfq_io_cq *bic, struct bio *bio) · 51 unmodified lines | ||
| 604 | 626 | goto out; |
| 605 | 627 | |
| 606 | 628 | bfqg = __bfq_bic_change_cgroup(bfqd, bic, bio_blkcg(bio)); |
| 629 | + /* | |
| 630 | + * Update blkg_path for bfq_log_* functions. We cache this | |
| 631 | + * path, and update it here, for the following | |
| 632 | + * reasons. Operations on blkg objects in blk-cgroup are | |
| 633 | + * protected with the request_queue lock, and not with the | |
| 634 | + * lock that protects the instances of this scheduler | |
| 635 | + * (bfqd->lock). This exposes BFQ to the following sort of | |
| 636 | + * race. | |
| 637 | + * | |
| 638 | + * The blkg_lookup performed in bfq_get_queue, protected | |
| 639 | + * through rcu, may happen to return the address of a copy of | |
| 640 | + * the original blkg. If this is the case, then the | |
| 641 | + * bfqg_and_blkg_get performed in bfq_get_queue, to pin down | |
| 642 | + * the blkg, is useless: it does not prevent blk-cgroup code | |
| 643 | + * from destroying both the original blkg and all objects | |
| 644 | + * directly or indirectly referred by the copy of the | |
| 645 | + * blkg. | |
| 646 | + * | |
| 647 | + * On the bright side, destroy operations on a blkg invoke, as | |
| 648 | + * a first step, hooks of the scheduler associated with the | |
| 649 | + * blkg. And these hooks are executed with bfqd->lock held for | |
| 650 | + * BFQ. As a consequence, for any blkg associated with the | |
| 651 | + * request queue this instance of the scheduler is attached | |
| 652 | + * to, we are guaranteed that such a blkg is not destroyed, and | |
| 653 | + * that all the pointers it contains are consistent, while we | |
| 654 | + * are holding bfqd->lock. A blkg_lookup performed with | |
| 655 | + * bfqd->lock held then returns a fully consistent blkg, which | |
| 656 | + * remains consistent until this lock is held. | |
| 657 | + * | |
| 658 | + * Thanks to the last fact, and to the fact that: (1) bfqg has | |
| 659 | + * been obtained through a blkg_lookup in the above | |
| 660 | + * assignment, and (2) bfqd->lock is being held, here we can | |
| 661 | + * safely use the policy data for the involved blkg (i.e., the | |
| 662 | + * field bfqg->pd) to get to the blkg associated with bfqg, | |
| 663 | + * and then we can safely use any field of blkg. After we | |
| 664 | + * release bfqd->lock, even just getting blkg through this | |
| 665 | + * bfqg may cause dangling references to be traversed, as | |
| 666 | + * bfqg->pd may not exist any more. | |
| 667 | + * | |
| 668 | + * In view of the above facts, here we cache, in the bfqg, any | |
| 669 | + * blkg data we may need for this bic, and for its associated | |
| 670 | + * bfq_queue. As of now, we need to cache only the path of the | |
| 671 | + * blkg, which is used in the bfq_log_* functions. | |
| 672 | + * | |
| 673 | + * Finally, note that bfqg itself needs to be protected from | |
| 674 | + * destruction on the blkg_free of the original blkg (which | |
| 675 | + * invokes bfq_pd_free). We use an additional private | |
| 676 | + * refcounter for bfqg, to let it disappear only after no | |
| 677 | + * bfq_queue refers to it any longer. | |
| 678 | + */ | |
| 679 | + blkg_path(bfqg_to_blkg(bfqg), bfqg->blkg_path, sizeof(bfqg->blkg_path)); | |
| 607 | 680 | bic->blkcg_serial_nr = serial_nr; |
| 608 | 681 | out: |
| 609 | 682 | rcu_read_unlock(); |
| @@ -640,8 +713,6 @@ static void bfq_reparent_leaf_entity(struct bfq_data *bfqd, · 30 unmodified lines | ||
| 640 | 713 | * @bfqd: the device data structure with the root group. |
| 641 | 714 | * @bfqg: the group to move from. |
| 642 | 715 | * @st: the service tree with the entities. |
| 643 | − * | |
| 644 | − * Needs queue_lock to be taken and reference to be valid over the call. | |
| 645 | 716 | */ |
| 646 | 717 | static void bfq_reparent_active_entities(struct bfq_data *bfqd, |
| 647 | 718 | struct bfq_group *bfqg, |
| @@ -692,8 +763,7 @@ void bfq_pd_offline(struct blkg_policy_data *pd) · 44 unmodified lines | ||
| 692 | 763 | /* |
| 693 | 764 | * The idle tree may still contain bfq_queues belonging |
| 694 | 765 | * to exited task because they never migrated to a different |
| 695 | − * cgroup from the one being destroyed now. No one else | |
| 696 | − * can access them so it's safe to act without any lock. | |
| 766 | + * cgroup from the one being destroyed now. | |
| 697 | 767 | */ |
| 698 | 768 | bfq_flush_idle_tree(st); |
| 699 | 769 | |
| @@ -3665,7 +3665,7 @@ void bfq_put_queue(struct bfq_queue *bfqq) · 3664 unmodified lines | ||
| 3665 | 3665 | |
| 3666 | 3666 | kmem_cache_free(bfq_pool, bfqq); |
| 3667 | 3667 | #ifdef CONFIG_BFQ_GROUP_IOSCHED |
| 3668 | − bfqg_put(bfqg); | |
| 3668 | + bfqg_and_blkg_put(bfqg); | |
| 3669 | 3669 | #endif |
| 3670 | 3670 | } |
| 3671 | 3671 | |
| @@ -759,6 +759,12 @@ struct bfq_group { · 758 unmodified lines | ||
| 759 | 759 | /* must be the first member */ |
| 760 | 760 | struct blkg_policy_data pd; |
| 761 | 761 | |
| 762 | + /* cached path for this blkg (see comments in bfq_bic_update_cgroup) */ | |
| 763 | + char blkg_path[128]; | |
| 764 | + | |
| 765 | + /* reference counter (see comments in bfq_bic_update_cgroup) */ | |
| 766 | + int ref; | |
| 767 | + | |
| 762 | 768 | struct bfq_entity entity; |
| 763 | 769 | struct bfq_sched_data sched_data; |
| 764 | 770 | |
| @@ -838,7 +844,7 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, · 73 unmodified lines | ||
| 838 | 844 | struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg); |
| 839 | 845 | struct bfq_group *bfqq_group(struct bfq_queue *bfqq); |
| 840 | 846 | struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node); |
| 841 | −void bfqg_put(struct bfq_group *bfqg); | |
| 847 | +void bfqg_and_blkg_put(struct bfq_group *bfqg); | |
| 842 | 848 | |
| 843 | 849 | #ifdef CONFIG_BFQ_GROUP_IOSCHED |
| 844 | 850 | extern struct cftype bfq_blkcg_legacy_files[]; |
| @@ -910,20 +916,13 @@ void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq); · 65 unmodified lines | ||
| 910 | 916 | struct bfq_group *bfqq_group(struct bfq_queue *bfqq); |
| 911 | 917 | |
| 912 | 918 | #define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \ |
| 913 | − char __pbuf[128]; \ | |
| 914 | − \ | |
| 915 | − blkg_path(bfqg_to_blkg(bfqq_group(bfqq)), __pbuf, sizeof(__pbuf)); \ | |
| 916 | − blk_add_trace_msg((bfqd)->queue, "bfq%d%c %s " fmt, (bfqq)->pid, \ | |
| 919 | + blk_add_trace_msg((bfqd)->queue, "bfq%d%c %s " fmt, (bfqq)->pid,\ | |
| 917 | 920 | bfq_bfqq_sync((bfqq)) ? 'S' : 'A', \ |
| 918 | − __pbuf, ##args); \ | |
| 921 | + bfqq_group(bfqq)->blkg_path, ##args); \ | |
| 919 | 922 | } while (0) |
| 920 | 923 | |
| 921 | −#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do { \ | |
| 922 | − char __pbuf[128]; \ | |
| 923 | − \ | |
| 924 | − blkg_path(bfqg_to_blkg(bfqg), __pbuf, sizeof(__pbuf)); \ | |
| 925 | − blk_add_trace_msg((bfqd)->queue, "%s " fmt, __pbuf, ##args); \ | |
| 926 | −} while (0) | |
| 924 | +#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) \ | |
| 925 | + blk_add_trace_msg((bfqd)->queue, "%s " fmt, (bfqg)->blkg_path, ##args) | |
| 927 | 926 | |
| 928 | 927 | #else /* CONFIG_BFQ_GROUP_IOSCHED */ |
| 929 | 928 | |
| @@ -175,6 +175,9 @@ bool bio_integrity_enabled(struct bio *bio) · 174 unmodified lines | ||
| 175 | 175 | if (bio_op(bio) != REQ_OP_READ && bio_op(bio) != REQ_OP_WRITE) |
| 176 | 176 | return false; |
| 177 | 177 | |
| 178 | + if (!bio_sectors(bio)) | |
| 179 | + return false; | |
| 180 | + | |
| 178 | 181 | /* Already protected? */ |
| 179 | 182 | if (bio_integrity(bio)) |
| 180 | 183 | return false; |
| @@ -1461,22 +1461,28 @@ static blk_qc_t request_to_qc_t(struct blk_mq_hw_ctx *hctx, struct request *rq) · 1460 unmodified lines | ||
| 1461 | 1461 | return blk_tag_to_qc_t(rq->internal_tag, hctx->queue_num, true); |
| 1462 | 1462 | } |
| 1463 | 1463 | |
| 1464 | −static void __blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie, | |
| 1465 | − bool may_sleep) | |
| 1464 | +static void __blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, | |
| 1465 | + struct request *rq, | |
| 1466 | + blk_qc_t *cookie, bool may_sleep) | |
| 1466 | 1467 | { |
| 1467 | 1468 | struct request_queue *q = rq->q; |
| 1468 | 1469 | struct blk_mq_queue_data bd = { |
| 1469 | 1470 | .rq = rq, |
| 1470 | 1471 | .last = true, |
| 1471 | 1472 | }; |
| 1472 | − struct blk_mq_hw_ctx *hctx; | |
| 1473 | 1473 | blk_qc_t new_cookie; |
| 1474 | 1474 | int ret; |
| 1475 | + bool run_queue = true; | |
| 1476 | + | |
| 1477 | + if (blk_mq_hctx_stopped(hctx)) { | |
| 1478 | + run_queue = false; | |
| 1479 | + goto insert; | |
| 1480 | + } | |
| 1475 | 1481 | |
| 1476 | 1482 | if (q->elevator) |
| 1477 | 1483 | goto insert; |
| 1478 | 1484 | |
| 1479 | − if (!blk_mq_get_driver_tag(rq, &hctx, false)) | |
| 1485 | + if (!blk_mq_get_driver_tag(rq, NULL, false)) | |
| 1480 | 1486 | goto insert; |
| 1481 | 1487 | |
| 1482 | 1488 | new_cookie = request_to_qc_t(hctx, rq); |
| @@ -1500,7 +1506,7 @@ static void __blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie, · 17 unmodified lines | ||
| 1500 | 1506 | |
| 1501 | 1507 | __blk_mq_requeue_request(rq); |
| 1502 | 1508 | insert: |
| 1503 | − blk_mq_sched_insert_request(rq, false, true, false, may_sleep); | |
| 1509 | + blk_mq_sched_insert_request(rq, false, run_queue, false, may_sleep); | |
| 1504 | 1510 | } |
| 1505 | 1511 | |
| 1506 | 1512 | static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, |
| @@ -1508,7 +1514,7 @@ static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, · 1 unmodified line | ||
| 1508 | 1514 | { |
| 1509 | 1515 | if (!(hctx->flags & BLK_MQ_F_BLOCKING)) { |
| 1510 | 1516 | rcu_read_lock(); |
| 1511 | − __blk_mq_try_issue_directly(rq, cookie, false); | |
| 1517 | + __blk_mq_try_issue_directly(hctx, rq, cookie, false); | |
| 1512 | 1518 | rcu_read_unlock(); |
| 1513 | 1519 | } else { |
| 1514 | 1520 | unsigned int srcu_idx; |
| @@ -1516,7 +1522,7 @@ static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, · 1 unmodified line | ||
| 1516 | 1522 | might_sleep(); |
| 1517 | 1523 | |
| 1518 | 1524 | srcu_idx = srcu_read_lock(&hctx->queue_rq_srcu); |
| 1519 | − __blk_mq_try_issue_directly(rq, cookie, true); | |
| 1525 | + __blk_mq_try_issue_directly(hctx, rq, cookie, true); | |
| 1520 | 1526 | srcu_read_unlock(&hctx->queue_rq_srcu, srcu_idx); |
| 1521 | 1527 | } |
| 1522 | 1528 | } |
| @@ -1619,9 +1625,12 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 96 unmodified lines | ||
| 1619 | 1625 | |
| 1620 | 1626 | blk_mq_put_ctx(data.ctx); |
| 1621 | 1627 | |
| 1622 | − if (same_queue_rq) | |
| 1628 | + if (same_queue_rq) { | |
| 1629 | + data.hctx = blk_mq_map_queue(q, | |
| 1630 | + same_queue_rq->mq_ctx->cpu); | |
| 1623 | 1631 | blk_mq_try_issue_directly(data.hctx, same_queue_rq, |
| 1624 | 1632 | &cookie); |
| 1633 | + } | |
| 1625 | 1634 | } else if (q->nr_hw_queues > 1 && is_sync) { |
| 1626 | 1635 | blk_mq_put_ctx(data.ctx); |
| 1627 | 1636 | blk_mq_bio_to_request(rq, bio); |
| @@ -27,6 +27,13 @@ static int throtl_quantum = 32; · 26 unmodified lines | ||
| 27 | 27 | #define MIN_THROTL_IOPS (10) |
| 28 | 28 | #define DFL_LATENCY_TARGET (-1L) |
| 29 | 29 | #define DFL_IDLE_THRESHOLD (0) |
| 30 | +#define DFL_HD_BASELINE_LATENCY (4000L) /* 4ms */ | |
| 31 | +#define LATENCY_FILTERED_SSD (0) | |
| 32 | +/* | |
| 33 | + * For HD, very small latency comes from sequential IO. Such IO is helpless to | |
| 34 | + * help determine if its IO is impacted by others, hence we ignore the IO | |
| 35 | + */ | |
| 36 | +#define LATENCY_FILTERED_HD (1000L) /* 1ms */ | |
| 30 | 37 | |
| 31 | 38 | #define SKIP_LATENCY (((u64)1) << BLK_STAT_RES_SHIFT) |
| 32 | 39 | |
| @@ -212,6 +219,7 @@ struct throtl_data · 179 unmodified lines | ||
| 212 | 219 | struct avg_latency_bucket avg_buckets[LATENCY_BUCKET_SIZE]; |
| 213 | 220 | struct latency_bucket __percpu *latency_buckets; |
| 214 | 221 | unsigned long last_calculate_time; |
| 222 | + unsigned long filtered_latency; | |
| 215 | 223 | |
| 216 | 224 | bool track_bio_latency; |
| 217 | 225 | }; |
| @@ -698,7 +706,7 @@ static void throtl_dequeue_tg(struct throtl_grp *tg) · 480 unmodified lines | ||
| 698 | 706 | static void throtl_schedule_pending_timer(struct throtl_service_queue *sq, |
| 699 | 707 | unsigned long expires) |
| 700 | 708 | { |
| 701 | − unsigned long max_expire = jiffies + 8 * sq_to_tg(sq)->td->throtl_slice; | |
| 709 | + unsigned long max_expire = jiffies + 8 * sq_to_td(sq)->throtl_slice; | |
| 702 | 710 | |
| 703 | 711 | /* |
| 704 | 712 | * Since we are adjusting the throttle limit dynamically, the sleep |
| @@ -2281,7 +2289,7 @@ void blk_throtl_bio_endio(struct bio *bio) · 1576 unmodified lines | ||
| 2281 | 2289 | throtl_track_latency(tg->td, blk_stat_size(&bio->bi_issue_stat), |
| 2282 | 2290 | bio_op(bio), lat); |
| 2283 | 2291 | |
| 2284 | − if (tg->latency_target) { | |
| 2292 | + if (tg->latency_target && lat >= tg->td->filtered_latency) { | |
| 2285 | 2293 | int bucket; |
| 2286 | 2294 | unsigned int threshold; |
| 2287 | 2295 | |
| @@ -2417,14 +2425,20 @@ void blk_throtl_exit(struct request_queue *q) · 129 unmodified lines | ||
| 2417 | 2425 | void blk_throtl_register_queue(struct request_queue *q) |
| 2418 | 2426 | { |
| 2419 | 2427 | struct throtl_data *td; |
| 2428 | + int i; | |
| 2420 | 2429 | |
| 2421 | 2430 | td = q->td; |
| 2422 | 2431 | BUG_ON(!td); |
| 2423 | 2432 | |
| 2424 | − if (blk_queue_nonrot(q)) | |
| 2433 | + if (blk_queue_nonrot(q)) { | |
| 2425 | 2434 | td->throtl_slice = DFL_THROTL_SLICE_SSD; |
| 2426 | − else | |
| 2435 | + td->filtered_latency = LATENCY_FILTERED_SSD; | |
| 2436 | + } else { | |
| 2427 | 2437 | td->throtl_slice = DFL_THROTL_SLICE_HD; |
| 2438 | + td->filtered_latency = LATENCY_FILTERED_HD; | |
| 2439 | + for (i = 0; i < LATENCY_BUCKET_SIZE; i++) | |
| 2440 | + td->avg_buckets[i].latency = DFL_HD_BASELINE_LATENCY; | |
| 2441 | + } | |
| 2428 | 2442 | #ifndef CONFIG_BLK_DEV_THROTTLING_LOW |
| 2429 | 2443 | /* if no low limit, use previous default */ |
| 2430 | 2444 | td->throtl_slice = DFL_THROTL_SLICE_HD; |
| @@ -141,7 +141,7 @@ int public_key_verify_signature(const struct public_key *pkey, · 140 unmodified lines | ||
| 141 | 141 | * signature and returns that to us. |
| 142 | 142 | */ |
| 143 | 143 | ret = crypto_akcipher_verify(req); |
| 144 | − if (ret == -EINPROGRESS) { | |
| 144 | + if ((ret == -EINPROGRESS) || (ret == -EBUSY)) { | |
| 145 | 145 | wait_for_completion(&compl.completion); |
| 146 | 146 | ret = compl.err; |
| 147 | 147 | } |
| @@ -381,7 +381,7 @@ static int pefile_digest_pe(const void *pebuf, unsigned int pelen, · 380 unmodified lines | ||
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | error: |
| 384 | − kfree(desc); | |
| 384 | + kzfree(desc); | |
| 385 | 385 | error_no_desc: |
| 386 | 386 | crypto_free_shash(tfm); |
| 387 | 387 | kleave(" = %d", ret); |
| @@ -450,6 +450,6 @@ int verify_pefile_signature(const void *pebuf, unsigned pelen, · 62 unmodified lines | ||
| 450 | 450 | ret = pefile_digest_pe(pebuf, pelen, &ctx); |
| 451 | 451 | |
| 452 | 452 | error: |
| 453 | − kfree(ctx.digest); | |
| 453 | + kzfree(ctx.digest); | |
| 454 | 454 | return ret; |
| 455 | 455 | } |
| @@ -102,6 +102,7 @@ struct x509_certificate *x509_cert_parse(const void *data, size_t datalen) · 101 unmodified lines | ||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | + ret = -ENOMEM; | |
| 105 | 106 | cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL); |
| 106 | 107 | if (!cert->pub->key) |
| 107 | 108 | goto error_decode; |
| @@ -1767,9 +1767,8 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg, · 1766 unmodified lines | ||
| 1767 | 1767 | break; |
| 1768 | 1768 | case -EINPROGRESS: |
| 1769 | 1769 | case -EBUSY: |
| 1770 | − ret = wait_for_completion_interruptible( | |
| 1771 | − &drbg->ctr_completion); | |
| 1772 | − if (!ret && !drbg->ctr_async_err) { | |
| 1770 | + wait_for_completion(&drbg->ctr_completion); | |
| 1771 | + if (!drbg->ctr_async_err) { | |
| 1773 | 1772 | reinit_completion(&drbg->ctr_completion); |
| 1774 | 1773 | break; |
| 1775 | 1774 | } |
| @@ -152,10 +152,8 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key, · 151 unmodified lines | ||
| 152 | 152 | |
| 153 | 153 | err = crypto_skcipher_encrypt(&data->req); |
| 154 | 154 | if (err == -EINPROGRESS || err == -EBUSY) { |
| 155 | − err = wait_for_completion_interruptible( | |
| 156 | − &data->result.completion); | |
| 157 | − if (!err) | |
| 158 | − err = data->result.err; | |
| 155 | + wait_for_completion(&data->result.completion); | |
| 156 | + err = data->result.err; | |
| 159 | 157 | } |
| 160 | 158 | |
| 161 | 159 | if (err) |
| @@ -416,9 +416,18 @@ acpi_tb_get_table(struct acpi_table_desc *table_desc, · 415 unmodified lines | ||
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | − table_desc->validation_count++; | |
| 420 | − if (table_desc->validation_count == 0) { | |
| 421 | − table_desc->validation_count--; | |
| 419 | + if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) { | |
| 420 | + table_desc->validation_count++; | |
| 421 | + | |
| 422 | + /* | |
| 423 | + * Detect validation_count overflows to ensure that the warning | |
| 424 | + * message will only be printed once. | |
| 425 | + */ | |
| 426 | + if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) { | |
| 427 | + ACPI_WARNING((AE_INFO, | |
| 428 | + "Table %p, Validation count overflows\n", | |
| 429 | + table_desc)); | |
| 430 | + } | |
| 422 | 431 | } |
| 423 | 432 | |
| 424 | 433 | *out_table = table_desc->pointer; |
| @@ -445,13 +454,20 @@ void acpi_tb_put_table(struct acpi_table_desc *table_desc) · 20 unmodified lines | ||
| 445 | 454 | |
| 446 | 455 | ACPI_FUNCTION_TRACE(acpi_tb_put_table); |
| 447 | 456 | |
| 448 | − if (table_desc->validation_count == 0) { | |
| 449 | − ACPI_WARNING((AE_INFO, | |
| 450 | − "Table %p, Validation count is zero before decrement\n", | |
| 451 | − table_desc)); | |
| 452 | − return_VOID; | |
| 457 | + if (table_desc->validation_count < ACPI_MAX_TABLE_VALIDATIONS) { | |
| 458 | + table_desc->validation_count--; | |
| 459 | + | |
| 460 | + /* | |
| 461 | + * Detect validation_count underflows to ensure that the warning | |
| 462 | + * message will only be printed once. | |
| 463 | + */ | |
| 464 | + if (table_desc->validation_count >= ACPI_MAX_TABLE_VALIDATIONS) { | |
| 465 | + ACPI_WARNING((AE_INFO, | |
| 466 | + "Table %p, Validation count underflows\n", | |
| 467 | + table_desc)); | |
| 468 | + return_VOID; | |
| 469 | + } | |
| 453 | 470 | } |
| 454 | − table_desc->validation_count--; | |
| 455 | 471 | |
| 456 | 472 | if (table_desc->validation_count == 0) { |
| 457 | 473 | |
| @@ -474,15 +474,6 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, · 473 unmodified lines | ||
| 474 | 474 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | − /* | |
| 478 | − * The end_tag opcode must be followed by a zero byte. | |
| 479 | − * Although this byte is technically defined to be a checksum, | |
| 480 | − * in practice, all ASL compilers set this byte to zero. | |
| 481 | − */ | |
| 482 | − if (*(aml + 1) != 0) { | |
| 483 | − return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | |
| 484 | − } | |
| 485 | − | |
| 486 | 477 | /* Return the pointer to the end_tag if requested */ |
| 487 | 478 | |
| 488 | 479 | if (!user_function) { |
| @@ -666,14 +666,6 @@ static const struct iommu_ops *iort_iommu_xlate(struct device *dev, · 665 unmodified lines | ||
| 666 | 666 | int ret = -ENODEV; |
| 667 | 667 | struct fwnode_handle *iort_fwnode; |
| 668 | 668 | |
| 669 | − /* | |
| 670 | − * If we already translated the fwspec there | |
| 671 | − * is nothing left to do, return the iommu_ops. | |
| 672 | − */ | |
| 673 | − ops = iort_fwspec_iommu_ops(dev->iommu_fwspec); | |
| 674 | − if (ops) | |
| 675 | − return ops; | |
| 676 | − | |
| 677 | 669 | if (node) { |
| 678 | 670 | iort_fwnode = iort_get_fwnode(node); |
| 679 | 671 | if (!iort_fwnode) |
| @@ -735,6 +727,14 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) · 55 unmodified lines | ||
| 735 | 727 | u32 streamid = 0; |
| 736 | 728 | int err; |
| 737 | 729 | |
| 730 | + /* | |
| 731 | + * If we already translated the fwspec there | |
| 732 | + * is nothing left to do, return the iommu_ops. | |
| 733 | + */ | |
| 734 | + ops = iort_fwspec_iommu_ops(dev->iommu_fwspec); | |
| 735 | + if (ops) | |
| 736 | + return ops; | |
| 737 | + | |
| 738 | 738 | if (dev_is_pci(dev)) { |
| 739 | 739 | struct pci_bus *bus = to_pci_dev(dev)->bus; |
| 740 | 740 | u32 rid; |
| @@ -782,6 +782,12 @@ const struct iommu_ops *iort_iommu_configure(struct device *dev) · 41 unmodified lines | ||
| 782 | 782 | if (err) |
| 783 | 783 | ops = ERR_PTR(err); |
| 784 | 784 | |
| 785 | + /* Ignore all other errors apart from EPROBE_DEFER */ | |
| 786 | + if (IS_ERR(ops) && (PTR_ERR(ops) != -EPROBE_DEFER)) { | |
| 787 | + dev_dbg(dev, "Adding to IOMMU failed: %ld\n", PTR_ERR(ops)); | |
| 788 | + ops = NULL; | |
| 789 | + } | |
| 790 | + | |
| 785 | 791 | return ops; |
| 786 | 792 | } |
| 787 | 793 | |
| @@ -782,7 +782,7 @@ static int acpi_battery_update(struct acpi_battery *battery, bool resume) · 781 unmodified lines | ||
| 782 | 782 | if ((battery->state & ACPI_BATTERY_STATE_CRITICAL) || |
| 783 | 783 | (test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags) && |
| 784 | 784 | (battery->capacity_now <= battery->alarm))) |
| 785 | − pm_wakeup_hard_event(&battery->device->dev); | |
| 785 | + pm_wakeup_event(&battery->device->dev, 0); | |
| 786 | 786 | |
| 787 | 787 | return result; |
| 788 | 788 | } |
| @@ -217,7 +217,7 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) · 216 unmodified lines | ||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | if (state) |
| 220 | − pm_wakeup_hard_event(&device->dev); | |
| 220 | + pm_wakeup_event(&device->dev, 0); | |
| 221 | 221 | |
| 222 | 222 | ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device); |
| 223 | 223 | if (ret == NOTIFY_DONE) |
| @@ -402,7 +402,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) · 178 unmodified lines | ||
| 402 | 402 | } else { |
| 403 | 403 | int keycode; |
| 404 | 404 | |
| 405 | − pm_wakeup_hard_event(&device->dev); | |
| 405 | + pm_wakeup_event(&device->dev, 0); | |
| 406 | 406 | if (button->suspended) |
| 407 | 407 | break; |
| 408 | 408 | |
| @@ -534,7 +534,6 @@ static int acpi_button_add(struct acpi_device *device) · 125 unmodified lines | ||
| 534 | 534 | lid_device = device; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | − device_init_wakeup(&device->dev, true); | |
| 538 | 537 | printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device)); |
| 539 | 538 | return 0; |
| 540 | 539 | |
| @@ -24,7 +24,6 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/pm_qos.h> |
| 25 | 25 | #include <linux/pm_domain.h> |
| 26 | 26 | #include <linux/pm_runtime.h> |
| 27 | −#include <linux/suspend.h> | |
| 28 | 27 | |
| 29 | 28 | #include "internal.h" |
| 30 | 29 | |
| @@ -400,7 +399,7 @@ static void acpi_pm_notify_handler(acpi_handle handle, u32 val, void *not_used) · 369 unmodified lines | ||
| 400 | 399 | mutex_lock(&acpi_pm_notifier_lock); |
| 401 | 400 | |
| 402 | 401 | if (adev->wakeup.flags.notifier_present) { |
| 403 | − pm_wakeup_ws_event(adev->wakeup.ws, 0, true); | |
| 402 | + __pm_wakeup_event(adev->wakeup.ws, 0); | |
| 404 | 403 | if (adev->wakeup.context.work.func) |
| 405 | 404 | queue_pm_work(&adev->wakeup.context.work); |
| 406 | 405 | } |
| @@ -1371,8 +1371,8 @@ int acpi_dma_configure(struct device *dev, enum dev_dma_attr attr) · 1370 unmodified lines | ||
| 1371 | 1371 | iort_set_dma_mask(dev); |
| 1372 | 1372 | |
| 1373 | 1373 | iommu = iort_iommu_configure(dev); |
| 1374 | − if (IS_ERR(iommu)) | |
| 1375 | − return PTR_ERR(iommu); | |
| 1374 | + if (IS_ERR(iommu) && PTR_ERR(iommu) == -EPROBE_DEFER) | |
| 1375 | + return -EPROBE_DEFER; | |
| 1376 | 1376 | |
| 1377 | 1377 | size = max(dev->coherent_dma_mask, dev->coherent_dma_mask + 1); |
| 1378 | 1378 | /* |
| @@ -663,40 +663,14 @@ static int acpi_freeze_prepare(void) · 662 unmodified lines | ||
| 663 | 663 | acpi_os_wait_events_complete(); |
| 664 | 664 | if (acpi_sci_irq_valid()) |
| 665 | 665 | enable_irq_wake(acpi_sci_irq); |
| 666 | − | |
| 667 | 666 | return 0; |
| 668 | 667 | } |
| 669 | 668 | |
| 670 | −static void acpi_freeze_wake(void) | |
| 671 | −{ | |
| 672 | − /* | |
| 673 | − * If IRQD_WAKEUP_ARMED is not set for the SCI at this point, it means | |
| 674 | − * that the SCI has triggered while suspended, so cancel the wakeup in | |
| 675 | − * case it has not been a wakeup event (the GPEs will be checked later). | |
| 676 | − */ | |
| 677 | − if (acpi_sci_irq_valid() && | |
| 678 | − !irqd_is_wakeup_armed(irq_get_irq_data(acpi_sci_irq))) | |
| 679 | − pm_system_cancel_wakeup(); | |
| 680 | −} | |
| 681 | − | |
| 682 | −static void acpi_freeze_sync(void) | |
| 683 | −{ | |
| 684 | − /* | |
| 685 | − * Process all pending events in case there are any wakeup ones. | |
| 686 | − * | |
| 687 | − * The EC driver uses the system workqueue, so that one needs to be | |
| 688 | − * flushed too. | |
| 689 | − */ | |
| 690 | − acpi_os_wait_events_complete(); | |
| 691 | − flush_scheduled_work(); | |
| 692 | −} | |
| 693 | − | |
| 694 | 669 | static void acpi_freeze_restore(void) |
| 695 | 670 | { |
| 696 | 671 | acpi_disable_wakeup_devices(ACPI_STATE_S0); |
| 697 | 672 | if (acpi_sci_irq_valid()) |
| 698 | 673 | disable_irq_wake(acpi_sci_irq); |
| 699 | − | |
| 700 | 674 | acpi_enable_all_runtime_gpes(); |
| 701 | 675 | } |
| 702 | 676 | |
| @@ -708,8 +682,6 @@ static void acpi_freeze_end(void) · 5 unmodified lines | ||
| 708 | 682 | static const struct platform_freeze_ops acpi_freeze_ops = { |
| 709 | 683 | .begin = acpi_freeze_begin, |
| 710 | 684 | .prepare = acpi_freeze_prepare, |
| 711 | − .wake = acpi_freeze_wake, | |
| 712 | − .sync = acpi_freeze_sync, | |
| 713 | 685 | .restore = acpi_freeze_restore, |
| 714 | 686 | .end = acpi_freeze_end, |
| 715 | 687 | }; |
| @@ -1091,6 +1091,11 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a · 1090 unmodified lines | ||
| 1091 | 1091 | if (async_error) |
| 1092 | 1092 | goto Complete; |
| 1093 | 1093 | |
| 1094 | + if (pm_wakeup_pending()) { | |
| 1095 | + async_error = -EBUSY; | |
| 1096 | + goto Complete; | |
| 1097 | + } | |
| 1098 | + | |
| 1094 | 1099 | if (dev->power.syscore || dev->power.direct_complete) |
| 1095 | 1100 | goto Complete; |
| 1096 | 1101 | |
| @@ -28,8 +28,8 @@ bool events_check_enabled __read_mostly; · 27 unmodified lines | ||
| 28 | 28 | /* First wakeup IRQ seen by the kernel in the last cycle. */ |
| 29 | 29 | unsigned int pm_wakeup_irq __read_mostly; |
| 30 | 30 | |
| 31 | −/* If greater than 0 and the system is suspending, terminate the suspend. */ | |
| 32 | −static atomic_t pm_abort_suspend __read_mostly; | |
| 31 | +/* If set and the system is suspending, terminate the suspend. */ | |
| 32 | +static bool pm_abort_suspend __read_mostly; | |
| 33 | 33 | |
| 34 | 34 | /* |
| 35 | 35 | * Combined counters of registered wakeup events and wakeup events in progress. |
| @@ -855,26 +855,20 @@ bool pm_wakeup_pending(void) · 819 unmodified lines | ||
| 855 | 855 | pm_print_active_wakeup_sources(); |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | − return ret || atomic_read(&pm_abort_suspend) > 0; | |
| 858 | + return ret || pm_abort_suspend; | |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | void pm_system_wakeup(void) |
| 862 | 862 | { |
| 863 | − atomic_inc(&pm_abort_suspend); | |
| 863 | + pm_abort_suspend = true; | |
| 864 | 864 | freeze_wake(); |
| 865 | 865 | } |
| 866 | 866 | EXPORT_SYMBOL_GPL(pm_system_wakeup); |
| 867 | 867 | |
| 868 | −void pm_system_cancel_wakeup(void) | |
| 869 | −{ | |
| 870 | − atomic_dec(&pm_abort_suspend); | |
| 871 | −} | |
| 872 | − | |
| 873 | −void pm_wakeup_clear(bool reset) | |
| 868 | +void pm_wakeup_clear(void) | |
| 874 | 869 | { |
| 870 | + pm_abort_suspend = false; | |
| 875 | 871 | pm_wakeup_irq = 0; |
| 876 | − if (reset) | |
| 877 | − atomic_set(&pm_abort_suspend, 0); | |
| 878 | 872 | } |
| 879 | 873 | |
| 880 | 874 | void pm_system_irq_wakeup(unsigned int irq_number) |
| @@ -608,6 +608,9 @@ static int loop_switch(struct loop_device *lo, struct file *file) · 607 unmodified lines | ||
| 608 | 608 | */ |
| 609 | 609 | static int loop_flush(struct loop_device *lo) |
| 610 | 610 | { |
| 611 | + /* loop not yet configured, no running thread, nothing to flush */ | |
| 612 | + if (lo->lo_state != Lo_bound) | |
| 613 | + return 0; | |
| 611 | 614 | return loop_switch(lo, NULL); |
| 612 | 615 | } |
| 613 | 616 | |
| @@ -343,7 +343,7 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma) · 342 unmodified lines | ||
| 343 | 343 | phys_addr_t offset = (phys_addr_t)vma->vm_pgoff << PAGE_SHIFT; |
| 344 | 344 | |
| 345 | 345 | /* It's illegal to wrap around the end of the physical address space. */ |
| 346 | − if (offset + (phys_addr_t)size < offset) | |
| 346 | + if (offset + (phys_addr_t)size - 1 < offset) | |
| 347 | 347 | return -EINVAL; |
| 348 | 348 | |
| 349 | 349 | if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size)) |
| @@ -1,6 +1,9 @@ | ||
| 1 | 1 | /* |
| 2 | 2 | * random.c -- A strong random number generator |
| 3 | 3 | * |
| 4 | + * Copyright (C) 2017 Jason A. Donenfeld <Jason@zx2c4.com>. All | |
| 5 | + * Rights Reserved. | |
| 6 | + * | |
| 4 | 7 | * Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005 |
| 5 | 8 | * |
| 6 | 9 | * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All |
| @@ -762,6 +765,8 @@ static DECLARE_WAIT_QUEUE_HEAD(crng_init_wait); · 755 unmodified lines | ||
| 762 | 765 | static struct crng_state **crng_node_pool __read_mostly; |
| 763 | 766 | #endif |
| 764 | 767 | |
| 768 | +static void invalidate_batched_entropy(void); | |
| 769 | + | |
| 765 | 770 | static void crng_initialize(struct crng_state *crng) |
| 766 | 771 | { |
| 767 | 772 | int i; |
| @@ -799,6 +804,7 @@ static int crng_fast_load(const char *cp, size_t len) · 31 unmodified lines | ||
| 799 | 804 | cp++; crng_init_cnt++; len--; |
| 800 | 805 | } |
| 801 | 806 | if (crng_init_cnt >= CRNG_INIT_CNT_THRESH) { |
| 807 | + invalidate_batched_entropy(); | |
| 802 | 808 | crng_init = 1; |
| 803 | 809 | wake_up_interruptible(&crng_init_wait); |
| 804 | 810 | pr_notice("random: fast init done\n"); |
| @@ -836,6 +842,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r) · 31 unmodified lines | ||
| 836 | 842 | memzero_explicit(&buf, sizeof(buf)); |
| 837 | 843 | crng->init_time = jiffies; |
| 838 | 844 | if (crng == &primary_crng && crng_init < 2) { |
| 845 | + invalidate_batched_entropy(); | |
| 839 | 846 | crng_init = 2; |
| 840 | 847 | process_random_ready_list(); |
| 841 | 848 | wake_up_interruptible(&crng_init_wait); |
| @@ -1097,15 +1104,15 @@ static void add_interrupt_bench(cycles_t start) · 255 unmodified lines | ||
| 1097 | 1104 | static __u32 get_reg(struct fast_pool *f, struct pt_regs *regs) |
| 1098 | 1105 | { |
| 1099 | 1106 | __u32 *ptr = (__u32 *) regs; |
| 1100 | − unsigned long flags; | |
| 1107 | + unsigned int idx; | |
| 1101 | 1108 | |
| 1102 | 1109 | if (regs == NULL) |
| 1103 | 1110 | return 0; |
| 1104 | − local_irq_save(flags); | |
| 1105 | − if (f->reg_idx >= sizeof(struct pt_regs) / sizeof(__u32)) | |
| 1106 | − f->reg_idx = 0; | |
| 1107 | − ptr += f->reg_idx++; | |
| 1108 | − local_irq_restore(flags); | |
| 1111 | + idx = READ_ONCE(f->reg_idx); | |
| 1112 | + if (idx >= sizeof(struct pt_regs) / sizeof(__u32)) | |
| 1113 | + idx = 0; | |
| 1114 | + ptr += idx++; | |
| 1115 | + WRITE_ONCE(f->reg_idx, idx); | |
| 1109 | 1116 | return *ptr; |
| 1110 | 1117 | } |
| 1111 | 1118 | |
| @@ -2023,6 +2030,7 @@ struct batched_entropy { · 911 unmodified lines | ||
| 2023 | 2030 | }; |
| 2024 | 2031 | unsigned int position; |
| 2025 | 2032 | }; |
| 2033 | +static rwlock_t batched_entropy_reset_lock = __RW_LOCK_UNLOCKED(batched_entropy_reset_lock); | |
| 2026 | 2034 | |
| 2027 | 2035 | /* |
| 2028 | 2036 | * Get a random word for internal kernel use only. The quality of the random |
| @@ -2033,6 +2041,8 @@ static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64); · 4 unmodified lines | ||
| 2033 | 2041 | u64 get_random_u64(void) |
| 2034 | 2042 | { |
| 2035 | 2043 | u64 ret; |
| 2044 | + bool use_lock = crng_init < 2; | |
| 2045 | + unsigned long flags; | |
| 2036 | 2046 | struct batched_entropy *batch; |
| 2037 | 2047 | |
| 2038 | 2048 | #if BITS_PER_LONG == 64 |
| @@ -2045,11 +2055,15 @@ u64 get_random_u64(void) · 6 unmodified lines | ||
| 2045 | 2055 | #endif |
| 2046 | 2056 | |
| 2047 | 2057 | batch = &get_cpu_var(batched_entropy_u64); |
| 2058 | + if (use_lock) | |
| 2059 | + read_lock_irqsave(&batched_entropy_reset_lock, flags); | |
| 2048 | 2060 | if (batch->position % ARRAY_SIZE(batch->entropy_u64) == 0) { |
| 2049 | 2061 | extract_crng((u8 *)batch->entropy_u64); |
| 2050 | 2062 | batch->position = 0; |
| 2051 | 2063 | } |
| 2052 | 2064 | ret = batch->entropy_u64[batch->position++]; |
| 2065 | + if (use_lock) | |
| 2066 | + read_unlock_irqrestore(&batched_entropy_reset_lock, flags); | |
| 2053 | 2067 | put_cpu_var(batched_entropy_u64); |
| 2054 | 2068 | return ret; |
| 2055 | 2069 | } |
| @@ -2059,22 +2073,45 @@ static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32); · 3 unmodified lines | ||
| 2059 | 2073 | u32 get_random_u32(void) |
| 2060 | 2074 | { |
| 2061 | 2075 | u32 ret; |
| 2076 | + bool use_lock = crng_init < 2; | |
| 2077 | + unsigned long flags; | |
| 2062 | 2078 | struct batched_entropy *batch; |
| 2063 | 2079 | |
| 2064 | 2080 | if (arch_get_random_int(&ret)) |
| 2065 | 2081 | return ret; |
| 2066 | 2082 | |
| 2067 | 2083 | batch = &get_cpu_var(batched_entropy_u32); |
| 2084 | + if (use_lock) | |
| 2085 | + read_lock_irqsave(&batched_entropy_reset_lock, flags); | |
| 2068 | 2086 | if (batch->position % ARRAY_SIZE(batch->entropy_u32) == 0) { |
| 2069 | 2087 | extract_crng((u8 *)batch->entropy_u32); |
| 2070 | 2088 | batch->position = 0; |
| 2071 | 2089 | } |
| 2072 | 2090 | ret = batch->entropy_u32[batch->position++]; |
| 2091 | + if (use_lock) | |
| 2092 | + read_unlock_irqrestore(&batched_entropy_reset_lock, flags); | |
| 2073 | 2093 | put_cpu_var(batched_entropy_u32); |
| 2074 | 2094 | return ret; |
| 2075 | 2095 | } |
| 2076 | 2096 | EXPORT_SYMBOL(get_random_u32); |
| 2077 | 2097 | |
| 2098 | +/* It's important to invalidate all potential batched entropy that might | |
| 2099 | + * be stored before the crng is initialized, which we can do lazily by | |
| 2100 | + * simply resetting the counter to zero so that it's re-extracted on the | |
| 2101 | + * next usage. */ | |
| 2102 | +static void invalidate_batched_entropy(void) | |
| 2103 | +{ | |
| 2104 | + int cpu; | |
| 2105 | + unsigned long flags; | |
| 2106 | + | |
| 2107 | + write_lock_irqsave(&batched_entropy_reset_lock, flags); | |
| 2108 | + for_each_possible_cpu (cpu) { | |
| 2109 | + per_cpu_ptr(&batched_entropy_u32, cpu)->position = 0; | |
| 2110 | + per_cpu_ptr(&batched_entropy_u64, cpu)->position = 0; | |
| 2111 | + } | |
| 2112 | + write_unlock_irqrestore(&batched_entropy_reset_lock, flags); | |
| 2113 | +} | |
| 2114 | + | |
| 2078 | 2115 | /** |
| 2079 | 2116 | * randomize_page - Generate a random, page aligned address |
| 2080 | 2117 | * @start: The smallest acceptable address the caller will take. |
| @@ -185,8 +185,8 @@ static ssize_t store_down_threshold(struct gov_attr_set *attr_set, · 184 unmodified lines | ||
| 185 | 185 | int ret; |
| 186 | 186 | ret = sscanf(buf, "%u", &input); |
| 187 | 187 | |
| 188 | − /* cannot be lower than 11 otherwise freq will not fall */ | |
| 189 | − if (ret != 1 || input < 11 || input > 100 || | |
| 188 | + /* cannot be lower than 1 otherwise freq will not fall */ | |
| 189 | + if (ret != 1 || input < 1 || input > 100 || | |
| 190 | 190 | input >= dbs_data->up_threshold) |
| 191 | 191 | return -EINVAL; |
| 192 | 192 | |
| @@ -571,9 +571,10 @@ static inline void update_turbo_state(void) · 570 unmodified lines | ||
| 571 | 571 | static int min_perf_pct_min(void) |
| 572 | 572 | { |
| 573 | 573 | struct cpudata *cpu = all_cpu_data[0]; |
| 574 | + int turbo_pstate = cpu->pstate.turbo_pstate; | |
| 574 | 575 | |
| 575 | − return DIV_ROUND_UP(cpu->pstate.min_pstate * 100, | |
| 576 | − cpu->pstate.turbo_pstate); | |
| 576 | + return turbo_pstate ? | |
| 577 | + DIV_ROUND_UP(cpu->pstate.min_pstate * 100, turbo_pstate) : 0; | |
| 577 | 578 | } |
| 578 | 579 | |
| 579 | 580 | static s16 intel_pstate_get_epb(struct cpudata *cpu_data) |
| @@ -180,8 +180,10 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, · 179 unmodified lines | ||
| 180 | 180 | if (!state_node) |
| 181 | 181 | break; |
| 182 | 182 | |
| 183 | − if (!of_device_is_available(state_node)) | |
| 183 | + if (!of_device_is_available(state_node)) { | |
| 184 | + of_node_put(state_node); | |
| 184 | 185 | continue; |
| 186 | + } | |
| 185 | 187 | |
| 186 | 188 | if (!idle_state_valid(state_node, i, cpumask)) { |
| 187 | 189 | pr_warn("%s idle state not valid, bailing out\n", |
| @@ -210,9 +210,12 @@ EXPORT_SYMBOL_GPL(kill_dax); · 209 unmodified lines | ||
| 210 | 210 | static struct inode *dax_alloc_inode(struct super_block *sb) |
| 211 | 211 | { |
| 212 | 212 | struct dax_device *dax_dev; |
| 213 | + struct inode *inode; | |
| 213 | 214 | |
| 214 | 215 | dax_dev = kmem_cache_alloc(dax_cache, GFP_KERNEL); |
| 215 | − return &dax_dev->inode; | |
| 216 | + inode = &dax_dev->inode; | |
| 217 | + inode->i_rdev = 0; | |
| 218 | + return inode; | |
| 216 | 219 | } |
| 217 | 220 | |
| 218 | 221 | static struct dax_device *to_dax_dev(struct inode *inode) |
| @@ -227,7 +230,8 @@ static void dax_i_callback(struct rcu_head *head) · 8 unmodified lines | ||
| 227 | 230 | |
| 228 | 231 | kfree(dax_dev->host); |
| 229 | 232 | dax_dev->host = NULL; |
| 230 | − ida_simple_remove(&dax_minor_ida, MINOR(inode->i_rdev)); | |
| 233 | + if (inode->i_rdev) | |
| 234 | + ida_simple_remove(&dax_minor_ida, MINOR(inode->i_rdev)); | |
| 231 | 235 | kmem_cache_free(dax_cache, dax_dev); |
| 232 | 236 | } |
| 233 | 237 | |
| @@ -423,6 +427,7 @@ static void init_once(void *_dax_dev) · 189 unmodified lines | ||
| 423 | 427 | struct dax_device *dax_dev = _dax_dev; |
| 424 | 428 | struct inode *inode = &dax_dev->inode; |
| 425 | 429 | |
| 430 | + memset(dax_dev, 0, sizeof(*dax_dev)); | |
| 426 | 431 | inode_init_once(inode); |
| 427 | 432 | } |
| 428 | 433 | |
| @@ -267,7 +267,11 @@ static int exynos_nocp_probe(struct platform_device *pdev) · 266 unmodified lines | ||
| 267 | 267 | } |
| 268 | 268 | platform_set_drvdata(pdev, nocp); |
| 269 | 269 | |
| 270 | − clk_prepare_enable(nocp->clk); | |
| 270 | + ret = clk_prepare_enable(nocp->clk); | |
| 271 | + if (ret) { | |
| 272 | + dev_err(&pdev->dev, "failed to prepare ppmu clock\n"); | |
| 273 | + return ret; | |
| 274 | + } | |
| 271 | 275 | |
| 272 | 276 | pr_info("exynos-nocp: new NoC Probe device registered: %s\n", |
| 273 | 277 | dev_name(dev)); |
| @@ -44,7 +44,7 @@ struct exynos_ppmu { · 43 unmodified lines | ||
| 44 | 44 | { "ppmu-event2-"#name, PPMU_PMNCNT2 }, \ |
| 45 | 45 | { "ppmu-event3-"#name, PPMU_PMNCNT3 } |
| 46 | 46 | |
| 47 | −struct __exynos_ppmu_events { | |
| 47 | +static struct __exynos_ppmu_events { | |
| 48 | 48 | char *name; |
| 49 | 49 | int id; |
| 50 | 50 | } ppmu_events[] = { |
| @@ -648,7 +648,11 @@ static int exynos_ppmu_probe(struct platform_device *pdev) · 597 unmodified lines | ||
| 648 | 648 | dev_name(&pdev->dev), desc[i].name); |
| 649 | 649 | } |
| 650 | 650 | |
| 651 | − clk_prepare_enable(info->ppmu.clk); | |
| 651 | + ret = clk_prepare_enable(info->ppmu.clk); | |
| 652 | + if (ret) { | |
| 653 | + dev_err(&pdev->dev, "failed to prepare ppmu clock\n"); | |
| 654 | + return ret; | |
| 655 | + } | |
| 652 | 656 | |
| 653 | 657 | return 0; |
| 654 | 658 | } |
| @@ -27,6 +27,26 @@ struct bmp_header { · 26 unmodified lines | ||
| 27 | 27 | u32 size; |
| 28 | 28 | } __packed; |
| 29 | 29 | |
| 30 | +static bool efi_bgrt_addr_valid(u64 addr) | |
| 31 | +{ | |
| 32 | + efi_memory_desc_t *md; | |
| 33 | + | |
| 34 | + for_each_efi_memory_desc(md) { | |
| 35 | + u64 size; | |
| 36 | + u64 end; | |
| 37 | + | |
| 38 | + if (md->type != EFI_BOOT_SERVICES_DATA) | |
| 39 | + continue; | |
| 40 | + | |
| 41 | + size = md->num_pages << EFI_PAGE_SHIFT; | |
| 42 | + end = md->phys_addr + size; | |
| 43 | + if (addr >= md->phys_addr && addr < end) | |
| 44 | + return true; | |
| 45 | + } | |
| 46 | + | |
| 47 | + return false; | |
| 48 | +} | |
| 49 | + | |
| 30 | 50 | void __init efi_bgrt_init(struct acpi_table_header *table) |
| 31 | 51 | { |
| 32 | 52 | void *image; |
| @@ -36,7 +56,7 @@ void __init efi_bgrt_init(struct acpi_table_header *table) · 3 unmodified lines | ||
| 36 | 56 | if (acpi_disabled) |
| 37 | 57 | return; |
| 38 | 58 | |
| 39 | − if (!efi_enabled(EFI_BOOT)) | |
| 59 | + if (!efi_enabled(EFI_MEMMAP)) | |
| 40 | 60 | return; |
| 41 | 61 | |
| 42 | 62 | if (table->length < sizeof(bgrt_tab)) { |
| @@ -65,6 +85,10 @@ void __init efi_bgrt_init(struct acpi_table_header *table) · 22 unmodified lines | ||
| 65 | 85 | goto out; |
| 66 | 86 | } |
| 67 | 87 | |
| 88 | + if (!efi_bgrt_addr_valid(bgrt->image_address)) { | |
| 89 | + pr_notice("Ignoring BGRT: invalid image address\n"); | |
| 90 | + goto out; | |
| 91 | + } | |
| 68 | 92 | image = early_memremap(bgrt->image_address, sizeof(bmp_header)); |
| 69 | 93 | if (!image) { |
| 70 | 94 | pr_notice("Ignoring BGRT: failed to map image header memory\n"); |
| @@ -136,12 +136,12 @@ static int vpd_section_attrib_add(const u8 *key, s32 key_len, · 135 unmodified lines | ||
| 136 | 136 | info->value = value; |
| 137 | 137 | |
| 138 | 138 | INIT_LIST_HEAD(&info->list); |
| 139 | − list_add_tail(&info->list, &sec->attribs); | |
| 140 | 139 | |
| 141 | 140 | ret = sysfs_create_bin_file(sec->kobj, &info->bin_attr); |
| 142 | 141 | if (ret) |
| 143 | 142 | goto free_info_key; |
| 144 | 143 | |
| 144 | + list_add_tail(&info->list, &sec->attribs); | |
| 145 | 145 | return 0; |
| 146 | 146 | |
| 147 | 147 | free_info_key: |
| @@ -158,8 +158,8 @@ static void vpd_section_attrib_destroy(struct vpd_section *sec) · 10 unmodified lines | ||
| 158 | 158 | struct vpd_attrib_info *temp; |
| 159 | 159 | |
| 160 | 160 | list_for_each_entry_safe(info, temp, &sec->attribs, list) { |
| 161 | − kfree(info->key); | |
| 162 | 161 | sysfs_remove_bin_file(sec->kobj, &info->bin_attr); |
| 162 | + kfree(info->key); | |
| 163 | 163 | kfree(info); |
| 164 | 164 | } |
| 165 | 165 | } |
| @@ -244,7 +244,7 @@ static int vpd_section_destroy(struct vpd_section *sec) · 78 unmodified lines | ||
| 244 | 244 | { |
| 245 | 245 | if (sec->enabled) { |
| 246 | 246 | vpd_section_attrib_destroy(sec); |
| 247 | − kobject_del(sec->kobj); | |
| 247 | + kobject_put(sec->kobj); | |
| 248 | 248 | sysfs_remove_bin_file(vpd_kobj, &sec->bin_attr); |
| 249 | 249 | kfree(sec->raw_name); |
| 250 | 250 | iounmap(sec->baseaddr); |
| @@ -331,7 +331,7 @@ static void __exit vpd_platform_exit(void) · 80 unmodified lines | ||
| 331 | 331 | { |
| 332 | 332 | vpd_section_destroy(&ro_vpd); |
| 333 | 333 | vpd_section_destroy(&rw_vpd); |
| 334 | − kobject_del(vpd_kobj); | |
| 334 | + kobject_put(vpd_kobj); | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | module_init(vpd_platform_init); |
| @@ -646,6 +646,9 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset, · 645 unmodified lines | ||
| 646 | 646 | int rc; |
| 647 | 647 | int i; |
| 648 | 648 | |
| 649 | + if (!gpio->clk) | |
| 650 | + return -EINVAL; | |
| 651 | + | |
| 649 | 652 | rc = usecs_to_cycles(gpio, usecs, &requested_cycles); |
| 650 | 653 | if (rc < 0) { |
| 651 | 654 | dev_warn(chip->parent, "Failed to convert %luus to cycles at %luHz: %d\n", |
| @@ -90,8 +90,18 @@ static inline int to_reg(int gpio, enum ctrl_register reg_type) · 89 unmodified lines | ||
| 90 | 90 | { |
| 91 | 91 | int reg; |
| 92 | 92 | |
| 93 | − if (gpio == 94) | |
| 94 | − return GPIOPANELCTL; | |
| 93 | + if (gpio >= CRYSTALCOVE_GPIO_NUM) { | |
| 94 | + /* | |
| 95 | + * Virtual GPIO called from ACPI, for now we only support | |
| 96 | + * the panel ctl. | |
| 97 | + */ | |
| 98 | + switch (gpio) { | |
| 99 | + case 0x5e: | |
| 100 | + return GPIOPANELCTL; | |
| 101 | + default: | |
| 102 | + return -EOPNOTSUPP; | |
| 103 | + } | |
| 104 | + } | |
| 95 | 105 | |
| 96 | 106 | if (reg_type == CTRL_IN) { |
| 97 | 107 | if (gpio < 8) |
| @@ -130,36 +140,36 @@ static void crystalcove_update_irq_ctrl(struct crystalcove_gpio *cg, int gpio) · 32 unmodified lines | ||
| 130 | 140 | static int crystalcove_gpio_dir_in(struct gpio_chip *chip, unsigned gpio) |
| 131 | 141 | { |
| 132 | 142 | struct crystalcove_gpio *cg = gpiochip_get_data(chip); |
| 143 | + int reg = to_reg(gpio, CTRL_OUT); | |
| 133 | 144 | |
| 134 | − if (gpio > CRYSTALCOVE_VGPIO_NUM) | |
| 145 | + if (reg < 0) | |
| 135 | 146 | return 0; |
| 136 | 147 | |
| 137 | − return regmap_write(cg->regmap, to_reg(gpio, CTRL_OUT), | |
| 138 | − CTLO_INPUT_SET); | |
| 148 | + return regmap_write(cg->regmap, reg, CTLO_INPUT_SET); | |
| 139 | 149 | } |
| 140 | 150 | |
| 141 | 151 | static int crystalcove_gpio_dir_out(struct gpio_chip *chip, unsigned gpio, |
| 142 | 152 | int value) |
| 143 | 153 | { |
| 144 | 154 | struct crystalcove_gpio *cg = gpiochip_get_data(chip); |
| 155 | + int reg = to_reg(gpio, CTRL_OUT); | |
| 145 | 156 | |
| 146 | − if (gpio > CRYSTALCOVE_VGPIO_NUM) | |
| 157 | + if (reg < 0) | |
| 147 | 158 | return 0; |
| 148 | 159 | |
| 149 | − return regmap_write(cg->regmap, to_reg(gpio, CTRL_OUT), | |
| 150 | − CTLO_OUTPUT_SET | value); | |
| 160 | + return regmap_write(cg->regmap, reg, CTLO_OUTPUT_SET | value); | |
| 151 | 161 | } |
| 152 | 162 | |
| 153 | 163 | static int crystalcove_gpio_get(struct gpio_chip *chip, unsigned gpio) |
| 154 | 164 | { |
| 155 | 165 | struct crystalcove_gpio *cg = gpiochip_get_data(chip); |
| 156 | − int ret; | |
| 157 | 166 | unsigned int val; |
| 167 | + int ret, reg = to_reg(gpio, CTRL_IN); | |
| 158 | 168 | |
| 159 | − if (gpio > CRYSTALCOVE_VGPIO_NUM) | |
| 169 | + if (reg < 0) | |
| 160 | 170 | return 0; |
| 161 | 171 | |
| 162 | − ret = regmap_read(cg->regmap, to_reg(gpio, CTRL_IN), &val); | |
| 172 | + ret = regmap_read(cg->regmap, reg, &val); | |
| 163 | 173 | if (ret) |
| 164 | 174 | return ret; |
| 165 | 175 | |
| @@ -170,14 +180,15 @@ static void crystalcove_gpio_set(struct gpio_chip *chip, · 4 unmodified lines | ||
| 170 | 180 | unsigned gpio, int value) |
| 171 | 181 | { |
| 172 | 182 | struct crystalcove_gpio *cg = gpiochip_get_data(chip); |
| 183 | + int reg = to_reg(gpio, CTRL_OUT); | |
| 173 | 184 | |
| 174 | − if (gpio > CRYSTALCOVE_VGPIO_NUM) | |
| 185 | + if (reg < 0) | |
| 175 | 186 | return; |
| 176 | 187 | |
| 177 | 188 | if (value) |
| 178 | − regmap_update_bits(cg->regmap, to_reg(gpio, CTRL_OUT), 1, 1); | |
| 189 | + regmap_update_bits(cg->regmap, reg, 1, 1); | |
| 179 | 190 | else |
| 180 | − regmap_update_bits(cg->regmap, to_reg(gpio, CTRL_OUT), 1, 0); | |
| 191 | + regmap_update_bits(cg->regmap, reg, 1, 0); | |
| 181 | 192 | } |
| 182 | 193 | |
| 183 | 194 | static int crystalcove_irq_type(struct irq_data *data, unsigned type) |
| @@ -185,6 +196,9 @@ static int crystalcove_irq_type(struct irq_data *data, unsigned type) · 1 unmodified line | ||
| 185 | 196 | struct crystalcove_gpio *cg = |
| 186 | 197 | gpiochip_get_data(irq_data_get_irq_chip_data(data)); |
| 187 | 198 | |
| 199 | + if (data->hwirq >= CRYSTALCOVE_GPIO_NUM) | |
| 200 | + return 0; | |
| 201 | + | |
| 188 | 202 | switch (type) { |
| 189 | 203 | case IRQ_TYPE_NONE: |
| 190 | 204 | cg->intcnt_value = CTLI_INTCNT_DIS; |
| @@ -235,8 +249,10 @@ static void crystalcove_irq_unmask(struct irq_data *data) · 44 unmodified lines | ||
| 235 | 249 | struct crystalcove_gpio *cg = |
| 236 | 250 | gpiochip_get_data(irq_data_get_irq_chip_data(data)); |
| 237 | 251 | |
| 238 | − cg->set_irq_mask = false; | |
| 239 | − cg->update |= UPDATE_IRQ_MASK; | |
| 252 | + if (data->hwirq < CRYSTALCOVE_GPIO_NUM) { | |
| 253 | + cg->set_irq_mask = false; | |
| 254 | + cg->update |= UPDATE_IRQ_MASK; | |
| 255 | + } | |
| 240 | 256 | } |
| 241 | 257 | |
| 242 | 258 | static void crystalcove_irq_mask(struct irq_data *data) |
| @@ -244,8 +260,10 @@ static void crystalcove_irq_mask(struct irq_data *data) · 1 unmodified line | ||
| 244 | 260 | struct crystalcove_gpio *cg = |
| 245 | 261 | gpiochip_get_data(irq_data_get_irq_chip_data(data)); |
| 246 | 262 | |
| 247 | − cg->set_irq_mask = true; | |
| 248 | − cg->update |= UPDATE_IRQ_MASK; | |
| 263 | + if (data->hwirq < CRYSTALCOVE_GPIO_NUM) { | |
| 264 | + cg->set_irq_mask = true; | |
| 265 | + cg->update |= UPDATE_IRQ_MASK; | |
| 266 | + } | |
| 249 | 267 | } |
| 250 | 268 | |
| 251 | 269 | static struct irq_chip crystalcove_irqchip = { |
| @@ -747,7 +747,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev, · 746 unmodified lines | ||
| 747 | 747 | set = U32_MAX; |
| 748 | 748 | else |
| 749 | 749 | return -EINVAL; |
| 750 | − writel_relaxed(0, mvebu_gpioreg_blink_counter_select(mvchip)); | |
| 750 | + writel_relaxed(set, mvebu_gpioreg_blink_counter_select(mvchip)); | |
| 751 | 751 | |
| 752 | 752 | mvpwm = devm_kzalloc(dev, sizeof(struct mvebu_pwm), GFP_KERNEL); |
| 753 | 753 | if (!mvpwm) |
| @@ -768,6 +768,13 @@ static int mvebu_pwm_probe(struct platform_device *pdev, · 14 unmodified lines | ||
| 768 | 768 | mvpwm->chip.dev = dev; |
| 769 | 769 | mvpwm->chip.ops = &mvebu_pwm_ops; |
| 770 | 770 | mvpwm->chip.npwm = mvchip->chip.ngpio; |
| 771 | + /* | |
| 772 | + * There may already be some PWM allocated, so we can't force | |
| 773 | + * mvpwm->chip.base to a fixed point like mvchip->chip.base. | |
| 774 | + * So, we let pwmchip_add() do the numbering and take the next free | |
| 775 | + * region. | |
| 776 | + */ | |
| 777 | + mvpwm->chip.base = -1; | |
| 771 | 778 | |
| 772 | 779 | spin_lock_init(&mvpwm->lock); |
| 773 | 780 | |
| @@ -508,6 +508,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, · 507 unmodified lines | ||
| 508 | 508 | bool has_connectors = |
| 509 | 509 | !!new_crtc_state->connector_mask; |
| 510 | 510 | |
| 511 | + WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); | |
| 512 | + | |
| 511 | 513 | if (!drm_mode_equal(&old_crtc_state->mode, &new_crtc_state->mode)) { |
| 512 | 514 | DRM_DEBUG_ATOMIC("[CRTC:%d:%s] mode changed\n", |
| 513 | 515 | crtc->base.id, crtc->name); |
| @@ -551,6 +553,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, · 37 unmodified lines | ||
| 551 | 553 | for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) { |
| 552 | 554 | const struct drm_connector_helper_funcs *funcs = connector->helper_private; |
| 553 | 555 | |
| 556 | + WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); | |
| 557 | + | |
| 554 | 558 | /* |
| 555 | 559 | * This only sets crtc->connectors_changed for routing changes, |
| 556 | 560 | * drivers must set crtc->connectors_changed themselves when |
| @@ -650,6 +654,8 @@ drm_atomic_helper_check_planes(struct drm_device *dev, · 93 unmodified lines | ||
| 650 | 654 | for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { |
| 651 | 655 | const struct drm_plane_helper_funcs *funcs; |
| 652 | 656 | |
| 657 | + WARN_ON(!drm_modeset_is_locked(&plane->mutex)); | |
| 658 | + | |
| 653 | 659 | funcs = plane->helper_private; |
| 654 | 660 | |
| 655 | 661 | drm_atomic_helper_plane_changed(state, old_plane_state, new_plane_state, plane); |
| @@ -2663,7 +2669,12 @@ int drm_atomic_helper_resume(struct drm_device *dev, · 2007 unmodified lines | ||
| 2663 | 2669 | |
| 2664 | 2670 | drm_modeset_acquire_init(&ctx, 0); |
| 2665 | 2671 | while (1) { |
| 2672 | + err = drm_modeset_lock_all_ctx(dev, &ctx); | |
| 2673 | + if (err) | |
| 2674 | + goto out; | |
| 2675 | + | |
| 2666 | 2676 | err = drm_atomic_helper_commit_duplicated_state(state, &ctx); |
| 2677 | +out: | |
| 2667 | 2678 | if (err != -EDEADLK) |
| 2668 | 2679 | break; |
| 2669 | 2680 | |
| @@ -358,7 +358,12 @@ EXPORT_SYMBOL(drm_put_dev); · 357 unmodified lines | ||
| 358 | 358 | void drm_unplug_dev(struct drm_device *dev) |
| 359 | 359 | { |
| 360 | 360 | /* for a USB device */ |
| 361 | − drm_dev_unregister(dev); | |
| 361 | + if (drm_core_check_feature(dev, DRIVER_MODESET)) | |
| 362 | + drm_modeset_unregister_all(dev); | |
| 363 | + | |
| 364 | + drm_minor_unregister(dev, DRM_MINOR_PRIMARY); | |
| 365 | + drm_minor_unregister(dev, DRM_MINOR_RENDER); | |
| 366 | + drm_minor_unregister(dev, DRM_MINOR_CONTROL); | |
| 362 | 367 | |
| 363 | 368 | mutex_lock(&drm_global_mutex); |
| 364 | 369 | |
| @@ -760,7 +760,7 @@ static int dsi_parse_dt(struct platform_device *pdev, struct dw_dsi *dsi) · 759 unmodified lines | ||
| 760 | 760 | * Get the endpoint node. In our case, dsi has one output port1 |
| 761 | 761 | * to which the external HDMI bridge is connected. |
| 762 | 762 | */ |
| 763 | − ret = drm_of_find_panel_or_bridge(np, 0, 0, NULL, &dsi->bridge); | |
| 763 | + ret = drm_of_find_panel_or_bridge(np, 1, 0, NULL, &dsi->bridge); | |
| 764 | 764 | if (ret) |
| 765 | 765 | return ret; |
| 766 | 766 | |
| @@ -1235,6 +1235,15 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) · 1234 unmodified lines | ||
| 1235 | 1235 | goto out_fini; |
| 1236 | 1236 | |
| 1237 | 1237 | pci_set_drvdata(pdev, &dev_priv->drm); |
| 1238 | + /* | |
| 1239 | + * Disable the system suspend direct complete optimization, which can | |
| 1240 | + * leave the device suspended skipping the driver's suspend handlers | |
| 1241 | + * if the device was already runtime suspended. This is needed due to | |
| 1242 | + * the difference in our runtime and system suspend sequence and | |
| 1243 | + * becaue the HDA driver may require us to enable the audio power | |
| 1244 | + * domain during system suspend. | |
| 1245 | + */ | |
| 1246 | + pdev->dev_flags |= PCI_DEV_FLAGS_NEEDS_RESUME; | |
| 1238 | 1247 | |
| 1239 | 1248 | ret = i915_driver_init_early(dev_priv, ent); |
| 1240 | 1249 | if (ret < 0) |
| @@ -2991,6 +2991,16 @@ static inline bool intel_scanout_needs_vtd_wa(struct drm_i915_private *dev_priv) · 2990 unmodified lines | ||
| 2991 | 2991 | return false; |
| 2992 | 2992 | } |
| 2993 | 2993 | |
| 2994 | +static inline bool | |
| 2995 | +intel_ggtt_update_needs_vtd_wa(struct drm_i915_private *dev_priv) | |
| 2996 | +{ | |
| 2997 | +#ifdef CONFIG_INTEL_IOMMU | |
| 2998 | + if (IS_BROXTON(dev_priv) && intel_iommu_gfx_mapped) | |
| 2999 | + return true; | |
| 3000 | +#endif | |
| 3001 | + return false; | |
| 3002 | +} | |
| 3003 | + | |
| 2994 | 3004 | int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, |
| 2995 | 3005 | int enable_ppgtt); |
| 2996 | 3006 | |
| @@ -3298,6 +3298,10 @@ int i915_gem_wait_for_idle(struct drm_i915_private *i915, unsigned int flags) · 3297 unmodified lines | ||
| 3298 | 3298 | { |
| 3299 | 3299 | int ret; |
| 3300 | 3300 | |
| 3301 | + /* If the device is asleep, we have no requests outstanding */ | |
| 3302 | + if (!READ_ONCE(i915->gt.awake)) | |
| 3303 | + return 0; | |
| 3304 | + | |
| 3301 | 3305 | if (flags & I915_WAIT_LOCKED) { |
| 3302 | 3306 | struct i915_gem_timeline *tl; |
| 3303 | 3307 | |
| @@ -2191,6 +2191,101 @@ static void gen8_ggtt_clear_range(struct i915_address_space *vm, · 2190 unmodified lines | ||
| 2191 | 2191 | gen8_set_pte(>t_base[i], scratch_pte); |
| 2192 | 2192 | } |
| 2193 | 2193 | |
| 2194 | +static void bxt_vtd_ggtt_wa(struct i915_address_space *vm) | |
| 2195 | +{ | |
| 2196 | + struct drm_i915_private *dev_priv = vm->i915; | |
| 2197 | + | |
| 2198 | + /* | |
| 2199 | + * Make sure the internal GAM fifo has been cleared of all GTT | |
| 2200 | + * writes before exiting stop_machine(). This guarantees that | |
| 2201 | + * any aperture accesses waiting to start in another process | |
| 2202 | + * cannot back up behind the GTT writes causing a hang. | |
| 2203 | + * The register can be any arbitrary GAM register. | |
| 2204 | + */ | |
| 2205 | + POSTING_READ(GFX_FLSH_CNTL_GEN6); | |
| 2206 | +} | |
| 2207 | + | |
| 2208 | +struct insert_page { | |
| 2209 | + struct i915_address_space *vm; | |
| 2210 | + dma_addr_t addr; | |
| 2211 | + u64 offset; | |
| 2212 | + enum i915_cache_level level; | |
| 2213 | +}; | |
| 2214 | + | |
| 2215 | +static int bxt_vtd_ggtt_insert_page__cb(void *_arg) | |
| 2216 | +{ | |
| 2217 | + struct insert_page *arg = _arg; | |
| 2218 | + | |
| 2219 | + gen8_ggtt_insert_page(arg->vm, arg->addr, arg->offset, arg->level, 0); | |
| 2220 | + bxt_vtd_ggtt_wa(arg->vm); | |
| 2221 | + | |
| 2222 | + return 0; | |
| 2223 | +} | |
| 2224 | + | |
| 2225 | +static void bxt_vtd_ggtt_insert_page__BKL(struct i915_address_space *vm, | |
| 2226 | + dma_addr_t addr, | |
| 2227 | + u64 offset, | |
| 2228 | + enum i915_cache_level level, | |
| 2229 | + u32 unused) | |
| 2230 | +{ | |
| 2231 | + struct insert_page arg = { vm, addr, offset, level }; | |
| 2232 | + | |
| 2233 | + stop_machine(bxt_vtd_ggtt_insert_page__cb, &arg, NULL); | |
| 2234 | +} | |
| 2235 | + | |
| 2236 | +struct insert_entries { | |
| 2237 | + struct i915_address_space *vm; | |
| 2238 | + struct sg_table *st; | |
| 2239 | + u64 start; | |
| 2240 | + enum i915_cache_level level; | |
| 2241 | +}; | |
| 2242 | + | |
| 2243 | +static int bxt_vtd_ggtt_insert_entries__cb(void *_arg) | |
| 2244 | +{ | |
| 2245 | + struct insert_entries *arg = _arg; | |
| 2246 | + | |
| 2247 | + gen8_ggtt_insert_entries(arg->vm, arg->st, arg->start, arg->level, 0); | |
| 2248 | + bxt_vtd_ggtt_wa(arg->vm); | |
| 2249 | + | |
| 2250 | + return 0; | |
| 2251 | +} | |
| 2252 | + | |
| 2253 | +static void bxt_vtd_ggtt_insert_entries__BKL(struct i915_address_space *vm, | |
| 2254 | + struct sg_table *st, | |
| 2255 | + u64 start, | |
| 2256 | + enum i915_cache_level level, | |
| 2257 | + u32 unused) | |
| 2258 | +{ | |
| 2259 | + struct insert_entries arg = { vm, st, start, level }; | |
| 2260 | + | |
| 2261 | + stop_machine(bxt_vtd_ggtt_insert_entries__cb, &arg, NULL); | |
| 2262 | +} | |
| 2263 | + | |
| 2264 | +struct clear_range { | |
| 2265 | + struct i915_address_space *vm; | |
| 2266 | + u64 start; | |
| 2267 | + u64 length; | |
| 2268 | +}; | |
| 2269 | + | |
| 2270 | +static int bxt_vtd_ggtt_clear_range__cb(void *_arg) | |
| 2271 | +{ | |
| 2272 | + struct clear_range *arg = _arg; | |
| 2273 | + | |
| 2274 | + gen8_ggtt_clear_range(arg->vm, arg->start, arg->length); | |
| 2275 | + bxt_vtd_ggtt_wa(arg->vm); | |
| 2276 | + | |
| 2277 | + return 0; | |
| 2278 | +} | |
| 2279 | + | |
| 2280 | +static void bxt_vtd_ggtt_clear_range__BKL(struct i915_address_space *vm, | |
| 2281 | + u64 start, | |
| 2282 | + u64 length) | |
| 2283 | +{ | |
| 2284 | + struct clear_range arg = { vm, start, length }; | |
| 2285 | + | |
| 2286 | + stop_machine(bxt_vtd_ggtt_clear_range__cb, &arg, NULL); | |
| 2287 | +} | |
| 2288 | + | |
| 2194 | 2289 | static void gen6_ggtt_clear_range(struct i915_address_space *vm, |
| 2195 | 2290 | u64 start, u64 length) |
| 2196 | 2291 | { |
| @@ -2785,6 +2880,14 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt) · 588 unmodified lines | ||
| 2785 | 2880 | |
| 2786 | 2881 | ggtt->base.insert_entries = gen8_ggtt_insert_entries; |
| 2787 | 2882 | |
| 2883 | + /* Serialize GTT updates with aperture access on BXT if VT-d is on. */ | |
| 2884 | + if (intel_ggtt_update_needs_vtd_wa(dev_priv)) { | |
| 2885 | + ggtt->base.insert_entries = bxt_vtd_ggtt_insert_entries__BKL; | |
| 2886 | + ggtt->base.insert_page = bxt_vtd_ggtt_insert_page__BKL; | |
| 2887 | + if (ggtt->base.clear_range != nop_clear_range) | |
| 2888 | + ggtt->base.clear_range = bxt_vtd_ggtt_clear_range__BKL; | |
| 2889 | + } | |
| 2890 | + | |
| 2788 | 2891 | ggtt->invalidate = gen6_ggtt_invalidate; |
| 2789 | 2892 | |
| 2790 | 2893 | return ggtt_probe_common(ggtt, size); |
| @@ -2997,7 +3100,8 @@ void i915_ggtt_enable_guc(struct drm_i915_private *i915) · 206 unmodified lines | ||
| 2997 | 3100 | |
| 2998 | 3101 | void i915_ggtt_disable_guc(struct drm_i915_private *i915) |
| 2999 | 3102 | { |
| 3000 | − i915->ggtt.invalidate = gen6_ggtt_invalidate; | |
| 3103 | + if (i915->ggtt.invalidate == guc_ggtt_invalidate) | |
| 3104 | + i915->ggtt.invalidate = gen6_ggtt_invalidate; | |
| 3001 | 3105 | } |
| 3002 | 3106 | |
| 3003 | 3107 | void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv) |
| @@ -278,7 +278,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj, · 277 unmodified lines | ||
| 278 | 278 | obj->mm.quirked = false; |
| 279 | 279 | } |
| 280 | 280 | if (!i915_gem_object_is_tiled(obj)) { |
| 281 | − GEM_BUG_ON(!obj->mm.quirked); | |
| 281 | + GEM_BUG_ON(obj->mm.quirked); | |
| 282 | 282 | __i915_gem_object_pin_pages(obj); |
| 283 | 283 | obj->mm.quirked = true; |
| 284 | 284 | } |
| @@ -208,7 +208,7 @@ static const struct intel_device_info intel_ironlake_d_info = { · 207 unmodified lines | ||
| 208 | 208 | static const struct intel_device_info intel_ironlake_m_info = { |
| 209 | 209 | GEN5_FEATURES, |
| 210 | 210 | .platform = INTEL_IRONLAKE, |
| 211 | − .is_mobile = 1, | |
| 211 | + .is_mobile = 1, .has_fbc = 1, | |
| 212 | 212 | }; |
| 213 | 213 | |
| 214 | 214 | #define GEN6_FEATURES \ |
| @@ -390,7 +390,6 @@ static const struct intel_device_info intel_skylake_gt3_info = { · 175 unmodified lines | ||
| 390 | 390 | .has_hw_contexts = 1, \ |
| 391 | 391 | .has_logical_ring_contexts = 1, \ |
| 392 | 392 | .has_guc = 1, \ |
| 393 | − .has_decoupled_mmio = 1, \ | |
| 394 | 393 | .has_aliasing_ppgtt = 1, \ |
| 395 | 394 | .has_full_ppgtt = 1, \ |
| 396 | 395 | .has_full_48bit_ppgtt = 1, \ |
| @@ -12203,6 +12203,15 @@ static void update_scanline_offset(struct intel_crtc *crtc) · 12202 unmodified lines | ||
| 12203 | 12203 | * type. For DP ports it behaves like most other platforms, but on HDMI |
| 12204 | 12204 | * there's an extra 1 line difference. So we need to add two instead of |
| 12205 | 12205 | * one to the value. |
| 12206 | + * | |
| 12207 | + * On VLV/CHV DSI the scanline counter would appear to increment | |
| 12208 | + * approx. 1/3 of a scanline before start of vblank. Unfortunately | |
| 12209 | + * that means we can't tell whether we're in vblank or not while | |
| 12210 | + * we're on that particular line. We must still set scanline_offset | |
| 12211 | + * to 1 so that the vblank timestamps come out correct when we query | |
| 12212 | + * the scanline counter from within the vblank interrupt handler. | |
| 12213 | + * However if queried just before the start of vblank we'll get an | |
| 12214 | + * answer that's slightly in the future. | |
| 12206 | 12215 | */ |
| 12207 | 12216 | if (IS_GEN2(dev_priv)) { |
| 12208 | 12217 | const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode; |
| @@ -1075,6 +1075,22 @@ int intel_ring_workarounds_emit(struct drm_i915_gem_request *req) · 1074 unmodified lines | ||
| 1075 | 1075 | return 0; |
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | +static bool ring_is_idle(struct intel_engine_cs *engine) | |
| 1079 | +{ | |
| 1080 | + struct drm_i915_private *dev_priv = engine->i915; | |
| 1081 | + bool idle = true; | |
| 1082 | + | |
| 1083 | + intel_runtime_pm_get(dev_priv); | |
| 1084 | + | |
| 1085 | + /* No bit for gen2, so assume the CS parser is idle */ | |
| 1086 | + if (INTEL_GEN(dev_priv) > 2 && !(I915_READ_MODE(engine) & MODE_IDLE)) | |
| 1087 | + idle = false; | |
| 1088 | + | |
| 1089 | + intel_runtime_pm_put(dev_priv); | |
| 1090 | + | |
| 1091 | + return idle; | |
| 1092 | +} | |
| 1093 | + | |
| 1078 | 1094 | /** |
| 1079 | 1095 | * intel_engine_is_idle() - Report if the engine has finished process all work |
| 1080 | 1096 | * @engine: the intel_engine_cs |
| @@ -1084,8 +1100,6 @@ int intel_ring_workarounds_emit(struct drm_i915_gem_request *req) · 3 unmodified lines | ||
| 1084 | 1100 | */ |
| 1085 | 1101 | bool intel_engine_is_idle(struct intel_engine_cs *engine) |
| 1086 | 1102 | { |
| 1087 | − struct drm_i915_private *dev_priv = engine->i915; | |
| 1088 | − | |
| 1089 | 1103 | /* Any inflight/incomplete requests? */ |
| 1090 | 1104 | if (!i915_seqno_passed(intel_engine_get_seqno(engine), |
| 1091 | 1105 | intel_engine_last_submit(engine))) |
| @@ -1100,7 +1114,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine) · 8 unmodified lines | ||
| 1100 | 1114 | return false; |
| 1101 | 1115 | |
| 1102 | 1116 | /* Ring stopped? */ |
| 1103 | − if (INTEL_GEN(dev_priv) > 2 && !(I915_READ_MODE(engine) & MODE_IDLE)) | |
| 1117 | + if (!ring_is_idle(engine)) | |
| 1104 | 1118 | return false; |
| 1105 | 1119 | |
| 1106 | 1120 | return true; |
| @@ -82,20 +82,10 @@ static unsigned int get_crtc_fence_y_offset(struct intel_crtc *crtc) · 81 unmodified lines | ||
| 82 | 82 | static void intel_fbc_get_plane_source_size(struct intel_fbc_state_cache *cache, |
| 83 | 83 | int *width, int *height) |
| 84 | 84 | { |
| 85 | − int w, h; | |
| 86 | − | |
| 87 | − if (drm_rotation_90_or_270(cache->plane.rotation)) { | |
| 88 | − w = cache->plane.src_h; | |
| 89 | − h = cache->plane.src_w; | |
| 90 | − } else { | |
| 91 | − w = cache->plane.src_w; | |
| 92 | − h = cache->plane.src_h; | |
| 93 | − } | |
| 94 | − | |
| 95 | 85 | if (width) |
| 96 | − *width = w; | |
| 86 | + *width = cache->plane.src_w; | |
| 97 | 87 | if (height) |
| 98 | − *height = h; | |
| 88 | + *height = cache->plane.src_h; | |
| 99 | 89 | } |
| 100 | 90 | |
| 101 | 91 | static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv, |
| @@ -746,6 +736,11 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, · 644 unmodified lines | ||
| 746 | 736 | cache->crtc.hsw_bdw_pixel_rate = crtc_state->pixel_rate; |
| 747 | 737 | |
| 748 | 738 | cache->plane.rotation = plane_state->base.rotation; |
| 739 | + /* | |
| 740 | + * Src coordinates are already rotated by 270 degrees for | |
| 741 | + * the 90/270 degree plane rotation cases (to match the | |
| 742 | + * GTT mapping), hence no need to account for rotation here. | |
| 743 | + */ | |
| 749 | 744 | cache->plane.src_w = drm_rect_width(&plane_state->base.src) >> 16; |
| 750 | 745 | cache->plane.src_h = drm_rect_height(&plane_state->base.src) >> 16; |
| 751 | 746 | cache->plane.visible = plane_state->base.visible; |
| @@ -4335,10 +4335,18 @@ skl_compute_wm(struct drm_atomic_state *state) · 4334 unmodified lines | ||
| 4335 | 4335 | struct drm_crtc_state *cstate; |
| 4336 | 4336 | struct intel_atomic_state *intel_state = to_intel_atomic_state(state); |
| 4337 | 4337 | struct skl_wm_values *results = &intel_state->wm_results; |
| 4338 | + struct drm_device *dev = state->dev; | |
| 4338 | 4339 | struct skl_pipe_wm *pipe_wm; |
| 4339 | 4340 | bool changed = false; |
| 4340 | 4341 | int ret, i; |
| 4341 | 4342 | |
| 4343 | + /* | |
| 4344 | + * When we distrust bios wm we always need to recompute to set the | |
| 4345 | + * expected DDB allocations for each CRTC. | |
| 4346 | + */ | |
| 4347 | + if (to_i915(dev)->wm.distrust_bios_wm) | |
| 4348 | + changed = true; | |
| 4349 | + | |
| 4342 | 4350 | /* |
| 4343 | 4351 | * If this transaction isn't actually touching any CRTC's, don't |
| 4344 | 4352 | * bother with watermark calculation. Note that if we pass this |
| @@ -4349,6 +4357,7 @@ skl_compute_wm(struct drm_atomic_state *state) · 4 unmodified lines | ||
| 4349 | 4357 | */ |
| 4350 | 4358 | for_each_new_crtc_in_state(state, crtc, cstate, i) |
| 4351 | 4359 | changed = true; |
| 4360 | + | |
| 4352 | 4361 | if (!changed) |
| 4353 | 4362 | return 0; |
| 4354 | 4363 | |
| @@ -435,8 +435,9 @@ static bool intel_psr_match_conditions(struct intel_dp *intel_dp) · 434 unmodified lines | ||
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | /* PSR2 is restricted to work with panel resolutions upto 3200x2000 */ |
| 438 | − if (intel_crtc->config->pipe_src_w > 3200 || | |
| 439 | − intel_crtc->config->pipe_src_h > 2000) { | |
| 438 | + if (dev_priv->psr.psr2_support && | |
| 439 | + (intel_crtc->config->pipe_src_w > 3200 || | |
| 440 | + intel_crtc->config->pipe_src_h > 2000)) { | |
| 440 | 441 | dev_priv->psr.psr2_support = false; |
| 441 | 442 | return false; |
| 442 | 443 | } |
| @@ -83,10 +83,13 @@ int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, · 82 unmodified lines | ||
| 83 | 83 | */ |
| 84 | 84 | void intel_pipe_update_start(struct intel_crtc *crtc) |
| 85 | 85 | { |
| 86 | + struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | |
| 86 | 87 | const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode; |
| 87 | 88 | long timeout = msecs_to_jiffies_timeout(1); |
| 88 | 89 | int scanline, min, max, vblank_start; |
| 89 | 90 | wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base); |
| 91 | + bool need_vlv_dsi_wa = (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && | |
| 92 | + intel_crtc_has_type(crtc->config, INTEL_OUTPUT_DSI); | |
| 90 | 93 | DEFINE_WAIT(wait); |
| 91 | 94 | |
| 92 | 95 | vblank_start = adjusted_mode->crtc_vblank_start; |
| @@ -139,6 +142,24 @@ void intel_pipe_update_start(struct intel_crtc *crtc) · 46 unmodified lines | ||
| 139 | 142 | |
| 140 | 143 | drm_crtc_vblank_put(&crtc->base); |
| 141 | 144 | |
| 145 | + /* | |
| 146 | + * On VLV/CHV DSI the scanline counter would appear to | |
| 147 | + * increment approx. 1/3 of a scanline before start of vblank. | |
| 148 | + * The registers still get latched at start of vblank however. | |
| 149 | + * This means we must not write any registers on the first | |
| 150 | + * line of vblank (since not the whole line is actually in | |
| 151 | + * vblank). And unfortunately we can't use the interrupt to | |
| 152 | + * wait here since it will fire too soon. We could use the | |
| 153 | + * frame start interrupt instead since it will fire after the | |
| 154 | + * critical scanline, but that would require more changes | |
| 155 | + * in the interrupt code. So for now we'll just do the nasty | |
| 156 | + * thing and poll for the bad scanline to pass us by. | |
| 157 | + * | |
| 158 | + * FIXME figure out if BXT+ DSI suffers from this as well | |
| 159 | + */ | |
| 160 | + while (need_vlv_dsi_wa && scanline == vblank_start) | |
| 161 | + scanline = intel_get_crtc_scanline(crtc); | |
| 162 | + | |
| 142 | 163 | crtc->debug.scanline_start = scanline; |
| 143 | 164 | crtc->debug.start_vbl_time = ktime_get(); |
| 144 | 165 | crtc->debug.start_vbl_count = intel_crtc_get_vblank_counter(crtc); |
| @@ -59,8 +59,6 @@ struct drm_i915_gem_request; · 58 unmodified lines | ||
| 59 | 59 | * available in the work queue (note, the queue is shared, |
| 60 | 60 | * not per-engine). It is OK for this to be nonzero, but |
| 61 | 61 | * it should not be huge! |
| 62 | − * q_fail: failed to enqueue a work item. This should never happen, | |
| 63 | − * because we check for space beforehand. | |
| 64 | 62 | * b_fail: failed to ring the doorbell. This should never happen, unless |
| 65 | 63 | * somehow the hardware misbehaves, or maybe if the GuC firmware |
| 66 | 64 | * crashes? We probably need to reset the GPU to recover. |
| @@ -673,7 +673,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) · 672 unmodified lines | ||
| 673 | 673 | ret = drm_of_find_panel_or_bridge(child, |
| 674 | 674 | imx_ldb->lvds_mux ? 4 : 2, 0, |
| 675 | 675 | &channel->panel, &channel->bridge); |
| 676 | − if (ret) | |
| 676 | + if (ret && ret != -ENODEV) | |
| 677 | 677 | return ret; |
| 678 | 678 | |
| 679 | 679 | /* panel ddc only if there is no bridge */ |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <drm/drm_of.h> |
| 20 | 20 | #include <linux/clk.h> |
| 21 | 21 | #include <linux/component.h> |
| 22 | +#include <linux/iopoll.h> | |
| 22 | 23 | #include <linux/irq.h> |
| 23 | 24 | #include <linux/of.h> |
| 24 | 25 | #include <linux/of_platform.h> |
| @@ -900,16 +901,12 @@ static int mtk_dsi_host_detach(struct mipi_dsi_host *host, · 875 unmodified lines | ||
| 900 | 901 | |
| 901 | 902 | static void mtk_dsi_wait_for_idle(struct mtk_dsi *dsi) |
| 902 | 903 | { |
| 903 | − u32 timeout_ms = 500000; /* total 1s ~ 2s timeout */ | |
| 904 | − | |
| 905 | − while (timeout_ms--) { | |
| 906 | − if (!(readl(dsi->regs + DSI_INTSTA) & DSI_BUSY)) | |
| 907 | − break; | |
| 908 | − | |
| 909 | − usleep_range(2, 4); | |
| 910 | − } | |
| 904 | + int ret; | |
| 905 | + u32 val; | |
| 911 | 906 | |
| 912 | − if (timeout_ms == 0) { | |
| 907 | + ret = readl_poll_timeout(dsi->regs + DSI_INTSTA, val, !(val & DSI_BUSY), | |
| 908 | + 4, 2000000); | |
| 909 | + if (ret) { | |
| 913 | 910 | DRM_WARN("polling dsi wait not busy timeout!\n"); |
| 914 | 911 | |
| 915 | 912 | mtk_dsi_enable(dsi); |
| @@ -1062,7 +1062,7 @@ static int mtk_hdmi_setup_vendor_specific_infoframe(struct mtk_hdmi *hdmi, · 1061 unmodified lines | ||
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | err = hdmi_vendor_infoframe_pack(&frame, buffer, sizeof(buffer)); |
| 1065 | − if (err) { | |
| 1065 | + if (err < 0) { | |
| 1066 | 1066 | dev_err(hdmi->dev, "Failed to pack vendor infoframe: %zd\n", |
| 1067 | 1067 | err); |
| 1068 | 1068 | return err; |
| @@ -152,7 +152,7 @@ static struct regmap_config meson_regmap_config = { · 151 unmodified lines | ||
| 152 | 152 | .max_register = 0x1000, |
| 153 | 153 | }; |
| 154 | 154 | |
| 155 | −static int meson_drv_bind(struct device *dev) | |
| 155 | +static int meson_drv_bind_master(struct device *dev, bool has_components) | |
| 156 | 156 | { |
| 157 | 157 | struct platform_device *pdev = to_platform_device(dev); |
| 158 | 158 | struct meson_drm *priv; |
| @@ -233,10 +233,12 @@ static int meson_drv_bind(struct device *dev) · 74 unmodified lines | ||
| 233 | 233 | if (ret) |
| 234 | 234 | goto free_drm; |
| 235 | 235 | |
| 236 | − ret = component_bind_all(drm->dev, drm); | |
| 237 | − if (ret) { | |
| 238 | − dev_err(drm->dev, "Couldn't bind all components\n"); | |
| 239 | − goto free_drm; | |
| 236 | + if (has_components) { | |
| 237 | + ret = component_bind_all(drm->dev, drm); | |
| 238 | + if (ret) { | |
| 239 | + dev_err(drm->dev, "Couldn't bind all components\n"); | |
| 240 | + goto free_drm; | |
| 241 | + } | |
| 240 | 242 | } |
| 241 | 243 | |
| 242 | 244 | ret = meson_plane_create(priv); |
| @@ -276,6 +278,11 @@ free_drm: · 33 unmodified lines | ||
| 276 | 278 | return ret; |
| 277 | 279 | } |
| 278 | 280 | |
| 281 | +static int meson_drv_bind(struct device *dev) | |
| 282 | +{ | |
| 283 | + return meson_drv_bind_master(dev, true); | |
| 284 | +} | |
| 285 | + | |
| 279 | 286 | static void meson_drv_unbind(struct device *dev) |
| 280 | 287 | { |
| 281 | 288 | struct drm_device *drm = dev_get_drvdata(dev); |
| @@ -357,6 +364,9 @@ static int meson_drv_probe(struct platform_device *pdev) · 75 unmodified lines | ||
| 357 | 364 | count += meson_probe_remote(pdev, &match, np, remote); |
| 358 | 365 | } |
| 359 | 366 | |
| 367 | + if (count && !match) | |
| 368 | + return meson_drv_bind_master(&pdev->dev, false); | |
| 369 | + | |
| 360 | 370 | /* If some endpoints were found, initialize the nodes */ |
| 361 | 371 | if (count) { |
| 362 | 372 | dev_info(&pdev->dev, "Queued %d outputs on vpu\n", count); |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | struct nvkm_alarm { |
| 6 | 6 | struct list_head head; |
| 7 | + struct list_head exec; | |
| 7 | 8 | u64 timestamp; |
| 8 | 9 | void (*func)(struct nvkm_alarm *); |
| 9 | 10 | }; |
| @@ -80,7 +80,7 @@ int nouveau_modeset = -1; · 79 unmodified lines | ||
| 80 | 80 | module_param_named(modeset, nouveau_modeset, int, 0400); |
| 81 | 81 | |
| 82 | 82 | MODULE_PARM_DESC(runpm, "disable (0), force enable (1), optimus only default (-1)"); |
| 83 | −int nouveau_runtime_pm = -1; | |
| 83 | +static int nouveau_runtime_pm = -1; | |
| 84 | 84 | module_param_named(runpm, nouveau_runtime_pm, int, 0400); |
| 85 | 85 | |
| 86 | 86 | static struct drm_driver driver_stub; |
| @@ -495,7 +495,7 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) · 408 unmodified lines | ||
| 495 | 495 | nouveau_fbcon_init(dev); |
| 496 | 496 | nouveau_led_init(dev); |
| 497 | 497 | |
| 498 | − if (nouveau_runtime_pm != 0) { | |
| 498 | + if (nouveau_pmops_runtime()) { | |
| 499 | 499 | pm_runtime_use_autosuspend(dev->dev); |
| 500 | 500 | pm_runtime_set_autosuspend_delay(dev->dev, 5000); |
| 501 | 501 | pm_runtime_set_active(dev->dev); |
| @@ -527,7 +527,7 @@ nouveau_drm_unload(struct drm_device *dev) · 25 unmodified lines | ||
| 527 | 527 | { |
| 528 | 528 | struct nouveau_drm *drm = nouveau_drm(dev); |
| 529 | 529 | |
| 530 | − if (nouveau_runtime_pm != 0) { | |
| 530 | + if (nouveau_pmops_runtime()) { | |
| 531 | 531 | pm_runtime_get_sync(dev->dev); |
| 532 | 532 | pm_runtime_forbid(dev->dev); |
| 533 | 533 | } |
| @@ -726,6 +726,14 @@ nouveau_pmops_thaw(struct device *dev) · 192 unmodified lines | ||
| 726 | 726 | return nouveau_do_resume(drm_dev, false); |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | +bool | |
| 730 | +nouveau_pmops_runtime() | |
| 731 | +{ | |
| 732 | + if (nouveau_runtime_pm == -1) | |
| 733 | + return nouveau_is_optimus() || nouveau_is_v1_dsm(); | |
| 734 | + return nouveau_runtime_pm == 1; | |
| 735 | +} | |
| 736 | + | |
| 729 | 737 | static int |
| 730 | 738 | nouveau_pmops_runtime_suspend(struct device *dev) |
| 731 | 739 | { |
| @@ -733,14 +741,7 @@ nouveau_pmops_runtime_suspend(struct device *dev) · 1 unmodified line | ||
| 733 | 741 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
| 734 | 742 | int ret; |
| 735 | 743 | |
| 736 | − if (nouveau_runtime_pm == 0) { | |
| 737 | − pm_runtime_forbid(dev); | |
| 738 | − return -EBUSY; | |
| 739 | − } | |
| 740 | − | |
| 741 | − /* are we optimus enabled? */ | |
| 742 | − if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { | |
| 743 | − DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); | |
| 744 | + if (!nouveau_pmops_runtime()) { | |
| 744 | 745 | pm_runtime_forbid(dev); |
| 745 | 746 | return -EBUSY; |
| 746 | 747 | } |
| @@ -765,8 +766,10 @@ nouveau_pmops_runtime_resume(struct device *dev) · 18 unmodified lines | ||
| 765 | 766 | struct nvif_device *device = &nouveau_drm(drm_dev)->client.device; |
| 766 | 767 | int ret; |
| 767 | 768 | |
| 768 | − if (nouveau_runtime_pm == 0) | |
| 769 | − return -EINVAL; | |
| 769 | + if (!nouveau_pmops_runtime()) { | |
| 770 | + pm_runtime_forbid(dev); | |
| 771 | + return -EBUSY; | |
| 772 | + } | |
| 770 | 773 | |
| 771 | 774 | pci_set_power_state(pdev, PCI_D0); |
| 772 | 775 | pci_restore_state(pdev); |
| @@ -796,14 +799,7 @@ nouveau_pmops_runtime_idle(struct device *dev) · 23 unmodified lines | ||
| 796 | 799 | struct nouveau_drm *drm = nouveau_drm(drm_dev); |
| 797 | 800 | struct drm_crtc *crtc; |
| 798 | 801 | |
| 799 | − if (nouveau_runtime_pm == 0) { | |
| 800 | − pm_runtime_forbid(dev); | |
| 801 | − return -EBUSY; | |
| 802 | − } | |
| 803 | − | |
| 804 | − /* are we optimus enabled? */ | |
| 805 | − if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { | |
| 806 | − DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); | |
| 802 | + if (!nouveau_pmops_runtime()) { | |
| 807 | 803 | pm_runtime_forbid(dev); |
| 808 | 804 | return -EBUSY; |
| 809 | 805 | } |
| @@ -108,8 +108,6 @@ nouveau_cli(struct drm_file *fpriv) · 107 unmodified lines | ||
| 108 | 108 | #include <nvif/object.h> |
| 109 | 109 | #include <nvif/device.h> |
| 110 | 110 | |
| 111 | −extern int nouveau_runtime_pm; | |
| 112 | − | |
| 113 | 111 | struct nouveau_drm { |
| 114 | 112 | struct nouveau_cli client; |
| 115 | 113 | struct drm_device *dev; |
| @@ -195,6 +193,7 @@ nouveau_drm(struct drm_device *dev) · 79 unmodified lines | ||
| 195 | 193 | |
| 196 | 194 | int nouveau_pmops_suspend(struct device *); |
| 197 | 195 | int nouveau_pmops_resume(struct device *); |
| 196 | +bool nouveau_pmops_runtime(void); | |
| 198 | 197 | |
| 199 | 198 | #include <nvkm/core/tegra.h> |
| 200 | 199 | |
| @@ -87,7 +87,7 @@ void · 86 unmodified lines | ||
| 87 | 87 | nouveau_vga_init(struct nouveau_drm *drm) |
| 88 | 88 | { |
| 89 | 89 | struct drm_device *dev = drm->dev; |
| 90 | − bool runtime = false; | |
| 90 | + bool runtime = nouveau_pmops_runtime(); | |
| 91 | 91 | |
| 92 | 92 | /* only relevant for PCI devices */ |
| 93 | 93 | if (!dev->pdev) |
| @@ -99,10 +99,6 @@ nouveau_vga_init(struct nouveau_drm *drm) · 5 unmodified lines | ||
| 99 | 99 | if (pci_is_thunderbolt_attached(dev->pdev)) |
| 100 | 100 | return; |
| 101 | 101 | |
| 102 | − if (nouveau_runtime_pm == 1) | |
| 103 | − runtime = true; | |
| 104 | − if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm())) | |
| 105 | − runtime = true; | |
| 106 | 102 | vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops, runtime); |
| 107 | 103 | |
| 108 | 104 | if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus()) |
| @@ -113,18 +109,13 @@ void · 4 unmodified lines | ||
| 113 | 109 | nouveau_vga_fini(struct nouveau_drm *drm) |
| 114 | 110 | { |
| 115 | 111 | struct drm_device *dev = drm->dev; |
| 116 | − bool runtime = false; | |
| 112 | + bool runtime = nouveau_pmops_runtime(); | |
| 117 | 113 | |
| 118 | 114 | vga_client_register(dev->pdev, NULL, NULL, NULL); |
| 119 | 115 | |
| 120 | 116 | if (pci_is_thunderbolt_attached(dev->pdev)) |
| 121 | 117 | return; |
| 122 | 118 | |
| 123 | − if (nouveau_runtime_pm == 1) | |
| 124 | − runtime = true; | |
| 125 | − if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm())) | |
| 126 | − runtime = true; | |
| 127 | − | |
| 128 | 119 | vga_switcheroo_unregister_client(dev->pdev); |
| 129 | 120 | if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus()) |
| 130 | 121 | vga_switcheroo_fini_domain_pm_ops(drm->dev->dev); |
| @@ -2107,7 +2107,8 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) · 2106 unmodified lines | ||
| 2107 | 2107 | asyc->set.dither = true; |
| 2108 | 2108 | } |
| 2109 | 2109 | } else { |
| 2110 | − asyc->set.mask = ~0; | |
| 2110 | + if (asyc) | |
| 2111 | + asyc->set.mask = ~0; | |
| 2111 | 2112 | asyh->set.mask = ~0; |
| 2112 | 2113 | } |
| 2113 | 2114 | |
| @@ -50,7 +50,8 @@ nvkm_timer_alarm_trigger(struct nvkm_timer *tmr) · 49 unmodified lines | ||
| 50 | 50 | /* Move to completed list. We'll drop the lock before |
| 51 | 51 | * executing the callback so it can reschedule itself. |
| 52 | 52 | */ |
| 53 | − list_move_tail(&alarm->head, &exec); | |
| 53 | + list_del_init(&alarm->head); | |
| 54 | + list_add(&alarm->exec, &exec); | |
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | /* Shut down interrupt if no more pending alarms. */ |
| @@ -59,8 +60,8 @@ nvkm_timer_alarm_trigger(struct nvkm_timer *tmr) · 2 unmodified lines | ||
| 59 | 60 | spin_unlock_irqrestore(&tmr->lock, flags); |
| 60 | 61 | |
| 61 | 62 | /* Execute completed callbacks. */ |
| 62 | − list_for_each_entry_safe(alarm, atemp, &exec, head) { | |
| 63 | − list_del_init(&alarm->head); | |
| 63 | + list_for_each_entry_safe(alarm, atemp, &exec, exec) { | |
| 64 | + list_del(&alarm->exec); | |
| 64 | 65 | alarm->func(alarm); |
| 65 | 66 | } |
| 66 | 67 | } |
| @@ -245,8 +245,6 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder, · 244 unmodified lines | ||
| 245 | 245 | struct drm_connector_state *conn_state) |
| 246 | 246 | { |
| 247 | 247 | struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state); |
| 248 | − struct rockchip_dp_device *dp = to_dp(encoder); | |
| 249 | − int ret; | |
| 250 | 248 | |
| 251 | 249 | /* |
| 252 | 250 | * The hardware IC designed that VOP must output the RGB10 video |
| @@ -258,16 +256,6 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder, · 5 unmodified lines | ||
| 258 | 256 | |
| 259 | 257 | s->output_mode = ROCKCHIP_OUT_MODE_AAAA; |
| 260 | 258 | s->output_type = DRM_MODE_CONNECTOR_eDP; |
| 261 | − if (dp->data->chip_type == RK3399_EDP) { | |
| 262 | − /* | |
| 263 | − * For RK3399, VOP Lit must code the out mode to RGB888, | |
| 264 | − * VOP Big must code the out mode to RGB10. | |
| 265 | − */ | |
| 266 | − ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node, | |
| 267 | − encoder); | |
| 268 | − if (ret > 0) | |
| 269 | − s->output_mode = ROCKCHIP_OUT_MODE_P888; | |
| 270 | − } | |
| 271 | 259 | |
| 272 | 260 | return 0; |
| 273 | 261 | } |
| @@ -615,7 +615,6 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) · 614 unmodified lines | ||
| 615 | 615 | { |
| 616 | 616 | struct cdn_dp_device *dp = encoder_to_dp(encoder); |
| 617 | 617 | int ret, val; |
| 618 | − struct rockchip_crtc_state *state; | |
| 619 | 618 | |
| 620 | 619 | ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node, encoder); |
| 621 | 620 | if (ret < 0) { |
| @@ -625,14 +624,10 @@ static void cdn_dp_encoder_enable(struct drm_encoder *encoder) · 3 unmodified lines | ||
| 625 | 624 | |
| 626 | 625 | DRM_DEV_DEBUG_KMS(dp->dev, "vop %s output to cdn-dp\n", |
| 627 | 626 | (ret) ? "LIT" : "BIG"); |
| 628 | − state = to_rockchip_crtc_state(encoder->crtc->state); | |
| 629 | − if (ret) { | |
| 627 | + if (ret) | |
| 630 | 628 | val = DP_SEL_VOP_LIT | (DP_SEL_VOP_LIT << 16); |
| 631 | − state->output_mode = ROCKCHIP_OUT_MODE_P888; | |
| 632 | − } else { | |
| 629 | + else | |
| 633 | 630 | val = DP_SEL_VOP_LIT << 16; |
| 634 | − state->output_mode = ROCKCHIP_OUT_MODE_AAAA; | |
| 635 | − } | |
| 636 | 631 | |
| 637 | 632 | ret = cdn_dp_grf_write(dp, GRF_SOC_CON9, val); |
| 638 | 633 | if (ret) |
| @@ -875,6 +875,7 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, · 874 unmodified lines | ||
| 875 | 875 | static void vop_crtc_enable(struct drm_crtc *crtc) |
| 876 | 876 | { |
| 877 | 877 | struct vop *vop = to_vop(crtc); |
| 878 | + const struct vop_data *vop_data = vop->data; | |
| 878 | 879 | struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc->state); |
| 879 | 880 | struct drm_display_mode *adjusted_mode = &crtc->state->adjusted_mode; |
| 880 | 881 | u16 hsync_len = adjusted_mode->hsync_end - adjusted_mode->hsync_start; |
| @@ -967,6 +968,13 @@ static void vop_crtc_enable(struct drm_crtc *crtc) · 86 unmodified lines | ||
| 967 | 968 | DRM_DEV_ERROR(vop->dev, "unsupported connector_type [%d]\n", |
| 968 | 969 | s->output_type); |
| 969 | 970 | } |
| 971 | + | |
| 972 | + /* | |
| 973 | + * if vop is not support RGB10 output, need force RGB10 to RGB888. | |
| 974 | + */ | |
| 975 | + if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && | |
| 976 | + !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10)) | |
| 977 | + s->output_mode = ROCKCHIP_OUT_MODE_P888; | |
| 970 | 978 | VOP_CTRL_SET(vop, out_mode, s->output_mode); |
| 971 | 979 | |
| 972 | 980 | VOP_CTRL_SET(vop, htotal_pw, (htotal << 16) | hsync_len); |
| @@ -142,6 +142,9 @@ struct vop_data { · 141 unmodified lines | ||
| 142 | 142 | const struct vop_intr *intr; |
| 143 | 143 | const struct vop_win_data *win; |
| 144 | 144 | unsigned int win_size; |
| 145 | + | |
| 146 | +#define VOP_FEATURE_OUTPUT_RGB10 BIT(0) | |
| 147 | + u64 feature; | |
| 145 | 148 | }; |
| 146 | 149 | |
| 147 | 150 | /* interrupt define */ |
| @@ -275,6 +275,7 @@ static const struct vop_intr rk3288_vop_intr = { · 274 unmodified lines | ||
| 275 | 275 | static const struct vop_data rk3288_vop = { |
| 276 | 276 | .init_table = rk3288_init_reg_table, |
| 277 | 277 | .table_size = ARRAY_SIZE(rk3288_init_reg_table), |
| 278 | + .feature = VOP_FEATURE_OUTPUT_RGB10, | |
| 278 | 279 | .intr = &rk3288_vop_intr, |
| 279 | 280 | .ctrl = &rk3288_ctrl_data, |
| 280 | 281 | .win = rk3288_vop_win_data, |
| @@ -343,6 +344,7 @@ static const struct vop_reg_data rk3399_init_reg_table[] = { · 62 unmodified lines | ||
| 343 | 344 | static const struct vop_data rk3399_vop_big = { |
| 344 | 345 | .init_table = rk3399_init_reg_table, |
| 345 | 346 | .table_size = ARRAY_SIZE(rk3399_init_reg_table), |
| 347 | + .feature = VOP_FEATURE_OUTPUT_RGB10, | |
| 346 | 348 | .intr = &rk3399_vop_intr, |
| 347 | 349 | .ctrl = &rk3399_ctrl_data, |
| 348 | 350 | /* |
| @@ -41,9 +41,9 @@ · 40 unmodified lines | ||
| 41 | 41 | #include <drm/ttm/ttm_module.h> |
| 42 | 42 | #include "vmwgfx_fence.h" |
| 43 | 43 | |
| 44 | −#define VMWGFX_DRIVER_DATE "20170221" | |
| 44 | +#define VMWGFX_DRIVER_DATE "20170607" | |
| 45 | 45 | #define VMWGFX_DRIVER_MAJOR 2 |
| 46 | −#define VMWGFX_DRIVER_MINOR 12 | |
| 46 | +#define VMWGFX_DRIVER_MINOR 13 | |
| 47 | 47 | #define VMWGFX_DRIVER_PATCHLEVEL 0 |
| 48 | 48 | #define VMWGFX_FILE_PAGE_OFFSET 0x00100000 |
| 49 | 49 | #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) |
| @@ -368,6 +368,8 @@ static void *vmw_local_fifo_reserve(struct vmw_private *dev_priv, · 367 unmodified lines | ||
| 368 | 368 | return fifo_state->static_buffer; |
| 369 | 369 | else { |
| 370 | 370 | fifo_state->dynamic_buffer = vmalloc(bytes); |
| 371 | + if (!fifo_state->dynamic_buffer) | |
| 372 | + goto out_err; | |
| 371 | 373 | return fifo_state->dynamic_buffer; |
| 372 | 374 | } |
| 373 | 375 | } |
| @@ -274,108 +274,6 @@ void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv) · 273 unmodified lines | ||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | |
| 277 | − | |
| 278 | −/** | |
| 279 | − * vmw_du_cursor_plane_update() - Update cursor image and location | |
| 280 | − * | |
| 281 | − * @plane: plane object to update | |
| 282 | − * @crtc: owning CRTC of @plane | |
| 283 | − * @fb: framebuffer to flip onto plane | |
| 284 | − * @crtc_x: x offset of plane on crtc | |
| 285 | − * @crtc_y: y offset of plane on crtc | |
| 286 | − * @crtc_w: width of plane rectangle on crtc | |
| 287 | − * @crtc_h: height of plane rectangle on crtc | |
| 288 | − * @src_x: Not used | |
| 289 | − * @src_y: Not used | |
| 290 | − * @src_w: Not used | |
| 291 | − * @src_h: Not used | |
| 292 | − * | |
| 293 | − * | |
| 294 | − * RETURNS: | |
| 295 | − * Zero on success, error code on failure | |
| 296 | − */ | |
| 297 | −int vmw_du_cursor_plane_update(struct drm_plane *plane, | |
| 298 | − struct drm_crtc *crtc, | |
| 299 | − struct drm_framebuffer *fb, | |
| 300 | − int crtc_x, int crtc_y, | |
| 301 | − unsigned int crtc_w, | |
| 302 | − unsigned int crtc_h, | |
| 303 | − uint32_t src_x, uint32_t src_y, | |
| 304 | − uint32_t src_w, uint32_t src_h) | |
| 305 | −{ | |
| 306 | − struct vmw_private *dev_priv = vmw_priv(crtc->dev); | |
| 307 | − struct vmw_display_unit *du = vmw_crtc_to_du(crtc); | |
| 308 | − struct vmw_surface *surface = NULL; | |
| 309 | − struct vmw_dma_buffer *dmabuf = NULL; | |
| 310 | − s32 hotspot_x, hotspot_y; | |
| 311 | − int ret; | |
| 312 | − | |
| 313 | − hotspot_x = du->hotspot_x + fb->hot_x; | |
| 314 | − hotspot_y = du->hotspot_y + fb->hot_y; | |
| 315 | − | |
| 316 | − /* A lot of the code assumes this */ | |
| 317 | − if (crtc_w != 64 || crtc_h != 64) { | |
| 318 | − ret = -EINVAL; | |
| 319 | − goto out; | |
| 320 | − } | |
| 321 | − | |
| 322 | − if (vmw_framebuffer_to_vfb(fb)->dmabuf) | |
| 323 | − dmabuf = vmw_framebuffer_to_vfbd(fb)->buffer; | |
| 324 | − else | |
| 325 | − surface = vmw_framebuffer_to_vfbs(fb)->surface; | |
| 326 | − | |
| 327 | − if (surface && !surface->snooper.image) { | |
| 328 | − DRM_ERROR("surface not suitable for cursor\n"); | |
| 329 | − ret = -EINVAL; | |
| 330 | − goto out; | |
| 331 | − } | |
| 332 | − | |
| 333 | − /* setup new image */ | |
| 334 | − ret = 0; | |
| 335 | − if (surface) { | |
| 336 | − /* vmw_user_surface_lookup takes one reference */ | |
| 337 | − du->cursor_surface = surface; | |
| 338 | − | |
| 339 | − du->cursor_age = du->cursor_surface->snooper.age; | |
| 340 | − | |
| 341 | − ret = vmw_cursor_update_image(dev_priv, surface->snooper.image, | |
| 342 | − 64, 64, hotspot_x, hotspot_y); | |
| 343 | − } else if (dmabuf) { | |
| 344 | − /* vmw_user_surface_lookup takes one reference */ | |
| 345 | − du->cursor_dmabuf = dmabuf; | |
| 346 | − | |
| 347 | − ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, crtc_w, crtc_h, | |
| 348 | − hotspot_x, hotspot_y); | |
| 349 | − } else { | |
| 350 | − vmw_cursor_update_position(dev_priv, false, 0, 0); | |
| 351 | − goto out; | |
| 352 | − } | |
| 353 | − | |
| 354 | − if (!ret) { | |
| 355 | − du->cursor_x = crtc_x + du->set_gui_x; | |
| 356 | − du->cursor_y = crtc_y + du->set_gui_y; | |
| 357 | − | |
| 358 | − vmw_cursor_update_position(dev_priv, true, | |
| 359 | − du->cursor_x + hotspot_x, | |
| 360 | − du->cursor_y + hotspot_y); | |
| 361 | − } | |
| 362 | − | |
| 363 | −out: | |
| 364 | − return ret; | |
| 365 | −} | |
| 366 | − | |
| 367 | − | |
| 368 | −int vmw_du_cursor_plane_disable(struct drm_plane *plane) | |
| 369 | −{ | |
| 370 | − if (plane->fb) { | |
| 371 | − drm_framebuffer_unreference(plane->fb); | |
| 372 | − plane->fb = NULL; | |
| 373 | − } | |
| 374 | − | |
| 375 | − return -EINVAL; | |
| 376 | −} | |
| 377 | − | |
| 378 | − | |
| 379 | 277 | void vmw_du_cursor_plane_destroy(struct drm_plane *plane) |
| 380 | 278 | { |
| 381 | 279 | vmw_cursor_update_position(plane->dev->dev_private, false, 0, 0); |
| @@ -472,18 +370,6 @@ vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane, · 90 unmodified lines | ||
| 472 | 370 | } |
| 473 | 371 | |
| 474 | 372 | |
| 475 | −void | |
| 476 | −vmw_du_cursor_plane_atomic_disable(struct drm_plane *plane, | |
| 477 | − struct drm_plane_state *old_state) | |
| 478 | −{ | |
| 479 | − struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc; | |
| 480 | − struct vmw_private *dev_priv = vmw_priv(crtc->dev); | |
| 481 | − | |
| 482 | − drm_atomic_set_fb_for_plane(plane->state, NULL); | |
| 483 | − vmw_cursor_update_position(dev_priv, false, 0, 0); | |
| 484 | −} | |
| 485 | − | |
| 486 | − | |
| 487 | 373 | void |
| 488 | 374 | vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, |
| 489 | 375 | struct drm_plane_state *old_state) |
| @@ -1498,6 +1384,7 @@ vmw_kms_new_framebuffer(struct vmw_private *dev_priv, · 1008 unmodified lines | ||
| 1498 | 1384 | */ |
| 1499 | 1385 | if (vmw_kms_srf_ok(dev_priv, mode_cmd->width, mode_cmd->height) && |
| 1500 | 1386 | dmabuf && only_2d && |
| 1387 | + mode_cmd->width > 64 && /* Don't create a proxy for cursor */ | |
| 1501 | 1388 | dev_priv->active_display_unit == vmw_du_screen_target) { |
| 1502 | 1389 | ret = vmw_create_dmabuf_proxy(dev_priv->dev, mode_cmd, |
| 1503 | 1390 | dmabuf, &surface); |
| @@ -256,10 +256,6 @@ int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, · 255 unmodified lines | ||
| 256 | 256 | u16 *r, u16 *g, u16 *b, |
| 257 | 257 | uint32_t size, |
| 258 | 258 | struct drm_modeset_acquire_ctx *ctx); |
| 259 | −int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv, | |
| 260 | − uint32_t handle, uint32_t width, uint32_t height, | |
| 261 | − int32_t hot_x, int32_t hot_y); | |
| 262 | −int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); | |
| 263 | 259 | int vmw_du_connector_set_property(struct drm_connector *connector, |
| 264 | 260 | struct drm_property *property, |
| 265 | 261 | uint64_t val); |
| @@ -339,15 +335,6 @@ void vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv, · 73 unmodified lines | ||
| 339 | 335 | /* Universal Plane Helpers */ |
| 340 | 336 | void vmw_du_primary_plane_destroy(struct drm_plane *plane); |
| 341 | 337 | void vmw_du_cursor_plane_destroy(struct drm_plane *plane); |
| 342 | −int vmw_du_cursor_plane_disable(struct drm_plane *plane); | |
| 343 | −int vmw_du_cursor_plane_update(struct drm_plane *plane, | |
| 344 | − struct drm_crtc *crtc, | |
| 345 | − struct drm_framebuffer *fb, | |
| 346 | − int crtc_x, int crtc_y, | |
| 347 | − unsigned int crtc_w, | |
| 348 | − unsigned int crtc_h, | |
| 349 | − uint32_t src_x, uint32_t src_y, | |
| 350 | − uint32_t src_w, uint32_t src_h); | |
| 351 | 338 | |
| 352 | 339 | /* Atomic Helpers */ |
| 353 | 340 | int vmw_du_primary_plane_atomic_check(struct drm_plane *plane, |
| @@ -356,8 +343,6 @@ int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane, · 2 unmodified lines | ||
| 356 | 343 | struct drm_plane_state *state); |
| 357 | 344 | void vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, |
| 358 | 345 | struct drm_plane_state *old_state); |
| 359 | −void vmw_du_cursor_plane_atomic_disable(struct drm_plane *plane, | |
| 360 | − struct drm_plane_state *old_state); | |
| 361 | 346 | int vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane, |
| 362 | 347 | struct drm_plane_state *new_state); |
| 363 | 348 | void vmw_du_plane_cleanup_fb(struct drm_plane *plane, |
| @@ -56,6 +56,8 @@ enum stdu_content_type { · 55 unmodified lines | ||
| 56 | 56 | * @right: Right side of bounding box. |
| 57 | 57 | * @top: Top side of bounding box. |
| 58 | 58 | * @bottom: Bottom side of bounding box. |
| 59 | + * @fb_left: Left side of the framebuffer/content bounding box | |
| 60 | + * @fb_top: Top of the framebuffer/content bounding box | |
| 59 | 61 | * @buf: DMA buffer when DMA-ing between buffer and screen targets. |
| 60 | 62 | * @sid: Surface ID when copying between surface and screen targets. |
| 61 | 63 | */ |
| @@ -63,6 +65,7 @@ struct vmw_stdu_dirty { · 1 unmodified line | ||
| 63 | 65 | struct vmw_kms_dirty base; |
| 64 | 66 | SVGA3dTransferType transfer; |
| 65 | 67 | s32 left, right, top, bottom; |
| 68 | + s32 fb_left, fb_top; | |
| 66 | 69 | u32 pitch; |
| 67 | 70 | union { |
| 68 | 71 | struct vmw_dma_buffer *buf; |
| @@ -647,7 +650,7 @@ static void vmw_stdu_dmabuf_fifo_commit(struct vmw_kms_dirty *dirty) · 578 unmodified lines | ||
| 647 | 650 | * |
| 648 | 651 | * @dirty: The closure structure. |
| 649 | 652 | * |
| 650 | − * This function calculates the bounding box for all the incoming clips | |
| 653 | + * This function calculates the bounding box for all the incoming clips. | |
| 651 | 654 | */ |
| 652 | 655 | static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty) |
| 653 | 656 | { |
| @@ -656,11 +659,19 @@ static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty) · 2 unmodified lines | ||
| 656 | 659 | |
| 657 | 660 | dirty->num_hits = 1; |
| 658 | 661 | |
| 659 | − /* Calculate bounding box */ | |
| 662 | + /* Calculate destination bounding box */ | |
| 660 | 663 | ddirty->left = min_t(s32, ddirty->left, dirty->unit_x1); |
| 661 | 664 | ddirty->top = min_t(s32, ddirty->top, dirty->unit_y1); |
| 662 | 665 | ddirty->right = max_t(s32, ddirty->right, dirty->unit_x2); |
| 663 | 666 | ddirty->bottom = max_t(s32, ddirty->bottom, dirty->unit_y2); |
| 667 | + | |
| 668 | + /* | |
| 669 | + * Calculate content bounding box. We only need the top-left | |
| 670 | + * coordinate because width and height will be the same as the | |
| 671 | + * destination bounding box above | |
| 672 | + */ | |
| 673 | + ddirty->fb_left = min_t(s32, ddirty->fb_left, dirty->fb_x); | |
| 674 | + ddirty->fb_top = min_t(s32, ddirty->fb_top, dirty->fb_y); | |
| 664 | 675 | } |
| 665 | 676 | |
| 666 | 677 | |
| @@ -697,11 +708,11 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) · 30 unmodified lines | ||
| 697 | 708 | /* Assume we are blitting from Host (display_srf) to Guest (dmabuf) */ |
| 698 | 709 | src_pitch = stdu->display_srf->base_size.width * stdu->cpp; |
| 699 | 710 | src = ttm_kmap_obj_virtual(&stdu->host_map, ¬_used); |
| 700 | − src += dirty->unit_y1 * src_pitch + dirty->unit_x1 * stdu->cpp; | |
| 711 | + src += ddirty->top * src_pitch + ddirty->left * stdu->cpp; | |
| 701 | 712 | |
| 702 | 713 | dst_pitch = ddirty->pitch; |
| 703 | 714 | dst = ttm_kmap_obj_virtual(&stdu->guest_map, ¬_used); |
| 704 | − dst += dirty->fb_y * dst_pitch + dirty->fb_x * stdu->cpp; | |
| 715 | + dst += ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp; | |
| 705 | 716 | |
| 706 | 717 | |
| 707 | 718 | /* Figure out the real direction */ |
| @@ -760,7 +771,7 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) · 52 unmodified lines | ||
| 760 | 771 | } |
| 761 | 772 | |
| 762 | 773 | out_cleanup: |
| 763 | − ddirty->left = ddirty->top = S32_MAX; | |
| 774 | + ddirty->left = ddirty->top = ddirty->fb_left = ddirty->fb_top = S32_MAX; | |
| 764 | 775 | ddirty->right = ddirty->bottom = S32_MIN; |
| 765 | 776 | } |
| 766 | 777 | |
| @@ -812,6 +823,7 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, · 45 unmodified lines | ||
| 812 | 823 | SVGA3D_READ_HOST_VRAM; |
| 813 | 824 | ddirty.left = ddirty.top = S32_MAX; |
| 814 | 825 | ddirty.right = ddirty.bottom = S32_MIN; |
| 826 | + ddirty.fb_left = ddirty.fb_top = S32_MAX; | |
| 815 | 827 | ddirty.pitch = vfb->base.pitches[0]; |
| 816 | 828 | ddirty.buf = buf; |
| 817 | 829 | ddirty.base.fifo_commit = vmw_stdu_dmabuf_fifo_commit; |
| @@ -1355,6 +1367,11 @@ vmw_stdu_primary_plane_atomic_update(struct drm_plane *plane, · 537 unmodified lines | ||
| 1355 | 1367 | DRM_ERROR("Failed to bind surface to STDU.\n"); |
| 1356 | 1368 | else |
| 1357 | 1369 | crtc->primary->fb = plane->state->fb; |
| 1370 | + | |
| 1371 | + ret = vmw_stdu_update_st(dev_priv, stdu); | |
| 1372 | + | |
| 1373 | + if (ret) | |
| 1374 | + DRM_ERROR("Failed to update STDU.\n"); | |
| 1358 | 1375 | } |
| 1359 | 1376 | |
| 1360 | 1377 | |
| @@ -1274,11 +1274,14 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, · 1273 unmodified lines | ||
| 1274 | 1274 | struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; |
| 1275 | 1275 | int ret; |
| 1276 | 1276 | uint32_t size; |
| 1277 | − uint32_t backup_handle; | |
| 1277 | + uint32_t backup_handle = 0; | |
| 1278 | 1278 | |
| 1279 | 1279 | if (req->multisample_count != 0) |
| 1280 | 1280 | return -EINVAL; |
| 1281 | 1281 | |
| 1282 | + if (req->mip_levels > DRM_VMW_MAX_MIP_LEVELS) | |
| 1283 | + return -EINVAL; | |
| 1284 | + | |
| 1282 | 1285 | if (unlikely(vmw_user_surface_size == 0)) |
| 1283 | 1286 | vmw_user_surface_size = ttm_round_pot(sizeof(*user_srf)) + |
| 1284 | 1287 | 128; |
| @@ -1314,12 +1317,16 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, · 29 unmodified lines | ||
| 1314 | 1317 | ret = vmw_user_dmabuf_lookup(tfile, req->buffer_handle, |
| 1315 | 1318 | &res->backup, |
| 1316 | 1319 | &user_srf->backup_base); |
| 1317 | − if (ret == 0 && res->backup->base.num_pages * PAGE_SIZE < | |
| 1318 | − res->backup_size) { | |
| 1319 | − DRM_ERROR("Surface backup buffer is too small.\n"); | |
| 1320 | − vmw_dmabuf_unreference(&res->backup); | |
| 1321 | − ret = -EINVAL; | |
| 1322 | − goto out_unlock; | |
| 1320 | + if (ret == 0) { | |
| 1321 | + if (res->backup->base.num_pages * PAGE_SIZE < | |
| 1322 | + res->backup_size) { | |
| 1323 | + DRM_ERROR("Surface backup buffer is too small.\n"); | |
| 1324 | + vmw_dmabuf_unreference(&res->backup); | |
| 1325 | + ret = -EINVAL; | |
| 1326 | + goto out_unlock; | |
| 1327 | + } else { | |
| 1328 | + backup_handle = req->buffer_handle; | |
| 1329 | + } | |
| 1323 | 1330 | } |
| 1324 | 1331 | } else if (req->drm_surface_flags & drm_vmw_surface_flag_create_buffer) |
| 1325 | 1332 | ret = vmw_user_dmabuf_alloc(dev_priv, tfile, |
| @@ -1491,7 +1498,7 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, · 165 unmodified lines | ||
| 1491 | 1498 | dev_priv->stdu_max_height); |
| 1492 | 1499 | |
| 1493 | 1500 | if (size.width > max_width || size.height > max_height) { |
| 1494 | − DRM_ERROR("%ux%u\n, exeeds max surface size %ux%u", | |
| 1501 | + DRM_ERROR("%ux%u\n, exceeds max surface size %ux%u", | |
| 1495 | 1502 | size.width, size.height, |
| 1496 | 1503 | max_width, max_height); |
| 1497 | 1504 | return -EINVAL; |
| @@ -725,15 +725,16 @@ void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi) · 724 unmodified lines | ||
| 725 | 725 | spin_lock_irqsave(&ipu->lock, flags); |
| 726 | 726 | |
| 727 | 727 | val = ipu_cm_read(ipu, IPU_CONF); |
| 728 | − if (vdi) { | |
| 728 | + if (vdi) | |
| 729 | 729 | val |= IPU_CONF_IC_INPUT; |
| 730 | − } else { | |
| 730 | + else | |
| 731 | 731 | val &= ~IPU_CONF_IC_INPUT; |
| 732 | − if (csi_id == 1) | |
| 733 | − val |= IPU_CONF_CSI_SEL; | |
| 734 | − else | |
| 735 | − val &= ~IPU_CONF_CSI_SEL; | |
| 736 | − } | |
| 732 | + | |
| 733 | + if (csi_id == 1) | |
| 734 | + val |= IPU_CONF_CSI_SEL; | |
| 735 | + else | |
| 736 | + val &= ~IPU_CONF_CSI_SEL; | |
| 737 | + | |
| 737 | 738 | ipu_cm_write(ipu, val, IPU_CONF); |
| 738 | 739 | |
| 739 | 740 | spin_unlock_irqrestore(&ipu->lock, flags); |
| @@ -131,8 +131,6 @@ int ipu_pre_get(struct ipu_pre *pre) · 130 unmodified lines | ||
| 131 | 131 | if (pre->in_use) |
| 132 | 132 | return -EBUSY; |
| 133 | 133 | |
| 134 | − clk_prepare_enable(pre->clk_axi); | |
| 135 | − | |
| 136 | 134 | /* first get the engine out of reset and remove clock gating */ |
| 137 | 135 | writel(0, pre->regs + IPU_PRE_CTRL); |
| 138 | 136 | |
| @@ -149,12 +147,7 @@ int ipu_pre_get(struct ipu_pre *pre) · 10 unmodified lines | ||
| 149 | 147 | |
| 150 | 148 | void ipu_pre_put(struct ipu_pre *pre) |
| 151 | 149 | { |
| 152 | − u32 val; | |
| 153 | − | |
| 154 | − val = IPU_PRE_CTRL_SFTRST | IPU_PRE_CTRL_CLKGATE; | |
| 155 | − writel(val, pre->regs + IPU_PRE_CTRL); | |
| 156 | − | |
| 157 | − clk_disable_unprepare(pre->clk_axi); | |
| 150 | + writel(IPU_PRE_CTRL_SFTRST, pre->regs + IPU_PRE_CTRL); | |
| 158 | 151 | |
| 159 | 152 | pre->in_use = false; |
| 160 | 153 | } |
| @@ -249,6 +242,8 @@ static int ipu_pre_probe(struct platform_device *pdev) · 88 unmodified lines | ||
| 249 | 242 | if (!pre->buffer_virt) |
| 250 | 243 | return -ENOMEM; |
| 251 | 244 | |
| 245 | + clk_prepare_enable(pre->clk_axi); | |
| 246 | + | |
| 252 | 247 | pre->dev = dev; |
| 253 | 248 | platform_set_drvdata(pdev, pre); |
| 254 | 249 | mutex_lock(&ipu_pre_list_mutex); |
| @@ -268,6 +263,8 @@ static int ipu_pre_remove(struct platform_device *pdev) · 13 unmodified lines | ||
| 268 | 263 | available_pres--; |
| 269 | 264 | mutex_unlock(&ipu_pre_list_mutex); |
| 270 | 265 | |
| 266 | + clk_disable_unprepare(pre->clk_axi); | |
| 267 | + | |
| 271 | 268 | if (pre->buffer_virt) |
| 272 | 269 | gen_pool_free(pre->iram, (unsigned long)pre->buffer_virt, |
| 273 | 270 | IPU_PRE_MAX_WIDTH * IPU_PRE_NUM_SCANLINES * 4); |
| @@ -826,11 +826,35 @@ static int hid_scan_report(struct hid_device *hid) · 825 unmodified lines | ||
| 826 | 826 | * hid-rmi should take care of them, |
| 827 | 827 | * not hid-generic |
| 828 | 828 | */ |
| 829 | − if (IS_ENABLED(CONFIG_HID_RMI)) | |
| 830 | − hid->group = HID_GROUP_RMI; | |
| 829 | + hid->group = HID_GROUP_RMI; | |
| 831 | 830 | break; |
| 832 | 831 | } |
| 833 | 832 | |
| 833 | + /* fall back to generic driver in case specific driver doesn't exist */ | |
| 834 | + switch (hid->group) { | |
| 835 | + case HID_GROUP_MULTITOUCH_WIN_8: | |
| 836 | + /* fall-through */ | |
| 837 | + case HID_GROUP_MULTITOUCH: | |
| 838 | + if (!IS_ENABLED(CONFIG_HID_MULTITOUCH)) | |
| 839 | + hid->group = HID_GROUP_GENERIC; | |
| 840 | + break; | |
| 841 | + case HID_GROUP_SENSOR_HUB: | |
| 842 | + if (!IS_ENABLED(CONFIG_HID_SENSOR_HUB)) | |
| 843 | + hid->group = HID_GROUP_GENERIC; | |
| 844 | + break; | |
| 845 | + case HID_GROUP_RMI: | |
| 846 | + if (!IS_ENABLED(CONFIG_HID_RMI)) | |
| 847 | + hid->group = HID_GROUP_GENERIC; | |
| 848 | + break; | |
| 849 | + case HID_GROUP_WACOM: | |
| 850 | + if (!IS_ENABLED(CONFIG_HID_WACOM)) | |
| 851 | + hid->group = HID_GROUP_GENERIC; | |
| 852 | + break; | |
| 853 | + case HID_GROUP_LOGITECH_DJ_DEVICE: | |
| 854 | + if (!IS_ENABLED(CONFIG_HID_LOGITECH_DJ)) | |
| 855 | + hid->group = HID_GROUP_GENERIC; | |
| 856 | + break; | |
| 857 | + } | |
| 834 | 858 | vfree(parser); |
| 835 | 859 | return 0; |
| 836 | 860 | } |
| @@ -1763,15 +1787,23 @@ EXPORT_SYMBOL_GPL(hid_disconnect); · 926 unmodified lines | ||
| 1763 | 1787 | * used as a driver. See hid_scan_report(). |
| 1764 | 1788 | */ |
| 1765 | 1789 | static const struct hid_device_id hid_have_special_driver[] = { |
| 1790 | +#if IS_ENABLED(CONFIG_HID_A4TECH) | |
| 1766 | 1791 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, |
| 1767 | 1792 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, |
| 1768 | 1793 | { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, |
| 1794 | +#endif | |
| 1795 | +#if IS_ENABLED(CONFIG_HID_ACCUTOUCH) | |
| 1796 | + { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) }, | |
| 1797 | +#endif | |
| 1798 | +#if IS_ENABLED(CONFIG_HID_ACRUX) | |
| 1769 | 1799 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, |
| 1770 | 1800 | { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0xf705) }, |
| 1801 | +#endif | |
| 1802 | +#if IS_ENABLED(CONFIG_HID_ALPS) | |
| 1771 | 1803 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) }, |
| 1804 | +#endif | |
| 1805 | +#if IS_ENABLED(CONFIG_HID_APPLE) | |
| 1772 | 1806 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, |
| 1773 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, | |
| 1774 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, | |
| 1775 | 1807 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, |
| 1776 | 1808 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, |
| 1777 | 1809 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, |
| @@ -1792,11 +1824,6 @@ static const struct hid_device_id hid_have_special_driver[] = { · 14 unmodified lines | ||
| 1792 | 1824 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI) }, |
| 1793 | 1825 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO) }, |
| 1794 | 1826 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS) }, |
| 1795 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, | |
| 1796 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, | |
| 1797 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, | |
| 1798 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | |
| 1799 | − { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, | |
| 1800 | 1827 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI) }, |
| 1801 | 1828 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO) }, |
| 1802 | 1829 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS) }, |
| @@ -1851,62 +1878,100 @@ static const struct hid_device_id hid_have_special_driver[] = { · 48 unmodified lines | ||
| 1851 | 1878 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_ANSI) }, |
| 1852 | 1879 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
| 1853 | 1880 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
| 1881 | +#endif | |
| 1882 | +#if IS_ENABLED(CONFIG_HID_APPLEIR) | |
| 1883 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) }, | |
| 1884 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL2) }, | |
| 1885 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL3) }, | |
| 1886 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, | |
| 1887 | + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL5) }, | |
| 1888 | +#endif | |
| 1889 | +#if IS_ENABLED(CONFIG_HID_ASUS) | |
| 1854 | 1890 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD) }, |
| 1855 | 1891 | { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD) }, |
| 1856 | 1892 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, |
| 1857 | 1893 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2) }, |
| 1858 | 1894 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD) }, |
| 1895 | +#endif | |
| 1896 | +#if IS_ENABLED(CONFIG_HID_AUREAL) | |
| 1859 | 1897 | { HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) }, |
| 1898 | +#endif | |
| 1899 | +#if IS_ENABLED(CONFIG_HID_BELKIN) | |
| 1860 | 1900 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, |
| 1901 | + { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | |
| 1902 | +#endif | |
| 1903 | +#if IS_ENABLED(CONFIG_HID_BETOP_FF) | |
| 1861 | 1904 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) }, |
| 1862 | 1905 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) }, |
| 1863 | 1906 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) }, |
| 1864 | 1907 | { HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) }, |
| 1865 | − { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, | |
| 1866 | − { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, | |
| 1908 | +#endif | |
| 1909 | +#if IS_ENABLED(CONFIG_HID_CHERRY) | |
| 1867 | 1910 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, |
| 1868 | 1911 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, |
| 1912 | +#endif | |
| 1913 | +#if IS_ENABLED(CONFIG_HID_CHICONY) | |
| 1869 | 1914 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
| 1870 | − { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, | |
| 1871 | 1915 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
| 1872 | 1916 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, |
| 1873 | 1917 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, |
| 1918 | + { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) }, | |
| 1919 | +#endif | |
| 1920 | +#if IS_ENABLED(CONFIG_HID_CMEDIA) | |
| 1921 | + { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM6533) }, | |
| 1922 | +#endif | |
| 1923 | +#if IS_ENABLED(CONFIG_HID_CORSAIR) | |
| 1874 | 1924 | { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) }, |
| 1875 | 1925 | { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) }, |
| 1876 | − { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, | |
| 1926 | +#endif | |
| 1927 | +#if IS_ENABLED(CONFIG_HID_CP2112) | |
| 1877 | 1928 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, |
| 1929 | +#endif | |
| 1930 | +#if IS_ENABLED(CONFIG_HID_CYPRESS) | |
| 1878 | 1931 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, |
| 1879 | 1932 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, |
| 1880 | 1933 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_3) }, |
| 1881 | 1934 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_4) }, |
| 1882 | 1935 | { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, |
| 1883 | − { HID_USB_DEVICE(USB_VENDOR_ID_DELCOM, USB_DEVICE_ID_DELCOM_VISUAL_IND) }, | |
| 1936 | +#endif | |
| 1937 | +#if IS_ENABLED(CONFIG_HID_DRAGONRISE) | |
| 1884 | 1938 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) }, |
| 1885 | 1939 | { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) }, |
| 1886 | −#if IS_ENABLED(CONFIG_HID_MAYFLASH) | |
| 1887 | − { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) }, | |
| 1888 | − { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) }, | |
| 1889 | − { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) }, | |
| 1890 | − { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) }, | |
| 1891 | 1940 | #endif |
| 1892 | − { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_WN) }, | |
| 1893 | − { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_FA) }, | |
| 1941 | +#if IS_ENABLED(CONFIG_HID_ELECOM) | |
| 1894 | 1942 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, |
| 1895 | 1943 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRED) }, |
| 1896 | 1944 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_DEFT_WIRELESS) }, |
| 1945 | +#endif | |
| 1946 | +#if IS_ENABLED(CONFIG_HID_ELO) | |
| 1897 | 1947 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0009) }, |
| 1898 | 1948 | { HID_USB_DEVICE(USB_VENDOR_ID_ELO, 0x0030) }, |
| 1899 | − { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) }, | |
| 1949 | +#endif | |
| 1950 | +#if IS_ENABLED(CONFIG_HID_EMS_FF) | |
| 1900 | 1951 | { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) }, |
| 1952 | +#endif | |
| 1953 | +#if IS_ENABLED(CONFIG_HID_EZKEY) | |
| 1901 | 1954 | { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, |
| 1902 | − { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, | |
| 1903 | − { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, | |
| 1955 | +#endif | |
| 1956 | +#if IS_ENABLED(CONFIG_HID_GEMBIRD) | |
| 1904 | 1957 | { HID_USB_DEVICE(USB_VENDOR_ID_GEMBIRD, USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2) }, |
| 1905 | − { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, | |
| 1958 | +#endif | |
| 1959 | +#if IS_ENABLED(CONFIG_HID_GFRM) | |
| 1960 | + { HID_BLUETOOTH_DEVICE(0x58, 0x2000) }, | |
| 1961 | + { HID_BLUETOOTH_DEVICE(0x471, 0x2210) }, | |
| 1962 | +#endif | |
| 1963 | +#if IS_ENABLED(CONFIG_HID_GREENASIA) | |
| 1906 | 1964 | { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, |
| 1965 | +#endif | |
| 1966 | +#if IS_ENABLED(CONFIG_HID_GT683R) | |
| 1967 | + { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, | |
| 1968 | +#endif | |
| 1969 | +#if IS_ENABLED(CONFIG_HID_GYRATION) | |
| 1907 | 1970 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, |
| 1908 | 1971 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, |
| 1909 | 1972 | { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, |
| 1973 | +#endif | |
| 1974 | +#if IS_ENABLED(CONFIG_HID_HOLTEK) | |
| 1910 | 1975 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, |
| 1911 | 1976 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, |
| 1912 | 1977 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) }, |
| @@ -1915,12 +1980,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 2 unmodified lines | ||
| 1915 | 1980 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A072) }, |
| 1916 | 1981 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, |
| 1917 | 1982 | { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) }, |
| 1918 | − { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) }, | |
| 1919 | − { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) }, | |
| 1920 | − { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, | |
| 1983 | +#endif | |
| 1984 | +#if IS_ENABLED(CONFIG_HID_ICADE) | |
| 1921 | 1985 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, |
| 1986 | +#endif | |
| 1987 | +#if IS_ENABLED(CONFIG_HID_KENSINGTON) | |
| 1922 | 1988 | { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, |
| 1989 | +#endif | |
| 1990 | +#if IS_ENABLED(CONFIG_HID_KEYTOUCH) | |
| 1923 | 1991 | { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) }, |
| 1992 | +#endif | |
| 1993 | +#if IS_ENABLED(CONFIG_HID_KYE) | |
| 1924 | 1994 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, |
| 1925 | 1995 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_MANTICORE) }, |
| 1926 | 1996 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, |
| @@ -1930,21 +2000,29 @@ static const struct hid_device_id hid_have_special_driver[] = { · 3 unmodified lines | ||
| 1930 | 2000 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2) }, |
| 1931 | 2001 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
| 1932 | 2002 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912) }, |
| 1933 | − { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | |
| 2003 | +#endif | |
| 2004 | +#if IS_ENABLED(CONFIG_HID_LCPOWER) | |
| 1934 | 2005 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, |
| 2006 | +#endif | |
| 2007 | +#if IS_ENABLED(CONFIG_HID_LED) | |
| 2008 | + { HID_USB_DEVICE(USB_VENDOR_ID_DELCOM, USB_DEVICE_ID_DELCOM_VISUAL_IND) }, | |
| 2009 | + { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_WN) }, | |
| 2010 | + { HID_USB_DEVICE(USB_VENDOR_ID_DREAM_CHEEKY, USB_DEVICE_ID_DREAM_CHEEKY_FA) }, | |
| 2011 | + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_LUXAFOR) }, | |
| 2012 | + { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) }, | |
| 2013 | + { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) }, | |
| 2014 | +#endif | |
| 1935 | 2015 | #if IS_ENABLED(CONFIG_HID_LENOVO) |
| 1936 | 2016 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, |
| 1937 | 2017 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, |
| 1938 | 2018 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, |
| 1939 | 2019 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, |
| 1940 | 2020 | #endif |
| 1941 | − { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MELFAS_MT) }, | |
| 2021 | +#if IS_ENABLED(CONFIG_HID_LOGITECH) | |
| 1942 | 2022 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, |
| 1943 | 2023 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER) }, |
| 1944 | 2024 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, |
| 1945 | 2025 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, |
| 1946 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, | |
| 1947 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) }, | |
| 1948 | 2026 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, |
| 1949 | 2027 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, |
| 1950 | 2028 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, |
| @@ -1957,7 +2035,6 @@ static const struct hid_device_id hid_have_special_driver[] = { · 6 unmodified lines | ||
| 1957 | 2035 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, |
| 1958 | 2036 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, |
| 1959 | 2037 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL) }, |
| 1960 | − { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) }, | |
| 1961 | 2038 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, |
| 1962 | 2039 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ) }, |
| 1963 | 2040 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO) }, |
| @@ -1969,17 +2046,30 @@ static const struct hid_device_id hid_have_special_driver[] = { · 5 unmodified lines | ||
| 1969 | 2046 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DFGT_WHEEL) }, |
| 1970 | 2047 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, |
| 1971 | 2048 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G27_WHEEL) }, |
| 1972 | −#if IS_ENABLED(CONFIG_HID_LOGITECH_DJ) | |
| 1973 | − { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, | |
| 1974 | − { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, | |
| 1975 | −#endif | |
| 1976 | 2049 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, |
| 1977 | 2050 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, |
| 1978 | 2051 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, |
| 1979 | 2052 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, |
| 1980 | − { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, | |
| 1981 | − { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, | |
| 1982 | − { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_LUXAFOR) }, | |
| 2053 | +#endif | |
| 2054 | +#if IS_ENABLED(CONFIG_HID_LOGITECH_HIDPP) | |
| 2055 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) }, | |
| 2056 | + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G920_WHEEL) }, | |
| 2057 | +#endif | |
| 2058 | +#if IS_ENABLED(CONFIG_HID_LOGITECH_DJ) | |
| 2059 | + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER) }, | |
| 2060 | + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2) }, | |
| 2061 | +#endif | |
| 2062 | +#if IS_ENABLED(CONFIG_HID_MAGICMOUSE) | |
| 2063 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, | |
| 2064 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, | |
| 2065 | +#endif | |
| 2066 | +#if IS_ENABLED(CONFIG_HID_MAYFLASH) | |
| 2067 | + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3) }, | |
| 2068 | + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) }, | |
| 2069 | + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) }, | |
| 2070 | + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) }, | |
| 2071 | +#endif | |
| 2072 | +#if IS_ENABLED(CONFIG_HID_MICROSOFT) | |
| 1983 | 2073 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, |
| 1984 | 2074 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_KEYBOARD) }, |
| 1985 | 2075 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, |
| @@ -1995,9 +2085,22 @@ static const struct hid_device_id hid_have_special_driver[] = { · 9 unmodified lines | ||
| 1995 | 2085 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_600) }, |
| 1996 | 2086 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1) }, |
| 1997 | 2087 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) }, |
| 2088 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, | |
| 2089 | +#endif | |
| 2090 | +#if IS_ENABLED(CONFIG_HID_MONTEREY) | |
| 1998 | 2091 | { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, |
| 1999 | − { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) }, | |
| 2092 | +#endif | |
| 2093 | +#if IS_ENABLED(CONFIG_HID_MULTITOUCH) | |
| 2094 | + { HID_USB_DEVICE(USB_VENDOR_ID_LG, USB_DEVICE_ID_LG_MELFAS_MT) }, | |
| 2095 | +#endif | |
| 2096 | +#if IS_ENABLED(CONFIG_HID_WIIMOTE) | |
| 2097 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, | |
| 2098 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) }, | |
| 2099 | +#endif | |
| 2100 | +#if IS_ENABLED(CONFIG_HID_NTI) | |
| 2000 | 2101 | { HID_USB_DEVICE(USB_VENDOR_ID_NTI, USB_DEVICE_ID_USB_SUN) }, |
| 2102 | +#endif | |
| 2103 | +#if IS_ENABLED(CONFIG_HID_NTRIG) | |
| 2001 | 2104 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, |
| 2002 | 2105 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) }, |
| 2003 | 2106 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) }, |
| @@ -2017,13 +2120,41 @@ static const struct hid_device_id hid_have_special_driver[] = { · 13 unmodified lines | ||
| 2017 | 2120 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_16) }, |
| 2018 | 2121 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_17) }, |
| 2019 | 2122 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_18) }, |
| 2123 | +#endif | |
| 2124 | +#if IS_ENABLED(CONFIG_HID_ORTEK) | |
| 2020 | 2125 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, |
| 2021 | 2126 | { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, |
| 2127 | + { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, | |
| 2128 | +#endif | |
| 2129 | +#if IS_ENABLED(CONFIG_HID_PANTHERLORD) | |
| 2130 | + { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, | |
| 2131 | + { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, | |
| 2132 | + { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, | |
| 2133 | + { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, | |
| 2134 | +#endif | |
| 2135 | +#if IS_ENABLED(CONFIG_HID_PENMOUNT) | |
| 2022 | 2136 | { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, |
| 2137 | +#endif | |
| 2138 | +#if IS_ENABLED(CONFIG_HID_PETALYNX) | |
| 2023 | 2139 | { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, |
| 2140 | +#endif | |
| 2141 | +#if IS_ENABLED(CONFIG_HID_PICOLCD) | |
| 2142 | + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) }, | |
| 2143 | + { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) }, | |
| 2144 | +#endif | |
| 2145 | +#if IS_ENABLED(CONFIG_HID_PLANTRONICS) | |
| 2024 | 2146 | { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, |
| 2147 | +#endif | |
| 2148 | +#if IS_ENABLED(CONFIG_HID_PRIMAX) | |
| 2025 | 2149 | { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, |
| 2026 | − { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) }, | |
| 2150 | +#endif | |
| 2151 | +#if IS_ENABLED(CONFIG_HID_PRODIKEYS) | |
| 2152 | + { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, | |
| 2153 | +#endif | |
| 2154 | +#if IS_ENABLED(CONFIG_HID_RMI) | |
| 2155 | + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) }, | |
| 2156 | + { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) }, | |
| 2157 | +#endif | |
| 2027 | 2158 | #if IS_ENABLED(CONFIG_HID_ROCCAT) |
| 2028 | 2159 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, |
| 2029 | 2160 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, |
| @@ -2051,9 +2182,21 @@ static const struct hid_device_id hid_have_special_driver[] = { · 21 unmodified lines | ||
| 2051 | 2182 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT5) }, |
| 2052 | 2183 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, |
| 2053 | 2184 | #endif |
| 2185 | +#if IS_ENABLED(CONFIG_HID_SAMSUNG) | |
| 2054 | 2186 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
| 2055 | 2187 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, |
| 2056 | − { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, | |
| 2188 | +#endif | |
| 2189 | +#if IS_ENABLED(CONFIG_HID_SMARTJOYPLUS) | |
| 2190 | + { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) }, | |
| 2191 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, | |
| 2192 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) }, | |
| 2193 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, | |
| 2194 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, | |
| 2195 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, | |
| 2196 | + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, | |
| 2197 | +#endif | |
| 2198 | +#if IS_ENABLED(CONFIG_HID_SONY) | |
| 2199 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, | |
| 2057 | 2200 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) }, |
| 2058 | 2201 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) }, |
| 2059 | 2202 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) }, |
| @@ -2072,9 +2215,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 12 unmodified lines | ||
| 2072 | 2215 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, |
| 2073 | 2216 | { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) }, |
| 2074 | 2217 | { HID_USB_DEVICE(USB_VENDOR_ID_SINO_LITE, USB_DEVICE_ID_SINO_LITE_CONTROLLER) }, |
| 2218 | +#endif | |
| 2219 | +#if IS_ENABLED(CONFIG_HID_SPEEDLINK) | |
| 2220 | + { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, | |
| 2221 | +#endif | |
| 2222 | +#if IS_ENABLED(CONFIG_HID_STEELSERIES) | |
| 2075 | 2223 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) }, |
| 2224 | +#endif | |
| 2225 | +#if IS_ENABLED(CONFIG_HID_SUNPLUS) | |
| 2076 | 2226 | { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, |
| 2077 | − { HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) }, | |
| 2227 | +#endif | |
| 2228 | +#if IS_ENABLED(CONFIG_HID_THRUSTMASTER) | |
| 2078 | 2229 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, |
| 2079 | 2230 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, |
| 2080 | 2231 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) }, |
| @@ -2083,12 +2234,25 @@ static const struct hid_device_id hid_have_special_driver[] = { · 2 unmodified lines | ||
| 2083 | 2234 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb653) }, |
| 2084 | 2235 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) }, |
| 2085 | 2236 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, |
| 2237 | +#endif | |
| 2238 | +#if IS_ENABLED(CONFIG_HID_TIVO) | |
| 2086 | 2239 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
| 2087 | 2240 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
| 2088 | 2241 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, |
| 2242 | +#endif | |
| 2243 | +#if IS_ENABLED(CONFIG_HID_TOPSEED) | |
| 2244 | + { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, | |
| 2245 | + { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, | |
| 2246 | + { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, | |
| 2089 | 2247 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
| 2090 | 2248 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, |
| 2249 | +#endif | |
| 2250 | +#if IS_ENABLED(CONFIG_HID_TWINHAN) | |
| 2091 | 2251 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, |
| 2252 | +#endif | |
| 2253 | +#if IS_ENABLED(CONFIG_HID_UCLOGIC) | |
| 2254 | + { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) }, | |
| 2255 | + { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_HUION_TABLET) }, | |
| 2092 | 2256 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, |
| 2093 | 2257 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, |
| 2094 | 2258 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, |
| @@ -2096,20 +2260,17 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1 unmodified line | ||
| 2096 | 2260 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP1062) }, |
| 2097 | 2261 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_WIRELESS_TABLET_TWHL850) }, |
| 2098 | 2262 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) }, |
| 2099 | − { HID_USB_DEVICE(USB_VENDOR_ID_THQ, USB_DEVICE_ID_THQ_PS3_UDRAW) }, | |
| 2100 | 2263 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_YIYNOVA_TABLET) }, |
| 2101 | 2264 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UGEE_TABLET_81) }, |
| 2102 | 2265 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UGEE_TABLET_45) }, |
| 2103 | 2266 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_DRAWIMAGE_G3) }, |
| 2104 | − { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610) }, | |
| 2105 | 2267 | { HID_USB_DEVICE(USB_VENDOR_ID_UGEE, USB_DEVICE_ID_UGEE_TABLET_EX07S) }, |
| 2106 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, | |
| 2107 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SUPER_JOY_BOX_3) }, | |
| 2108 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD) }, | |
| 2109 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, | |
| 2110 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, | |
| 2111 | − { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, | |
| 2112 | − { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) }, | |
| 2268 | + { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_GP0610) }, | |
| 2269 | +#endif | |
| 2270 | +#if IS_ENABLED(CONFIG_HID_UDRAW_PS3) | |
| 2271 | + { HID_USB_DEVICE(USB_VENDOR_ID_THQ, USB_DEVICE_ID_THQ_PS3_UDRAW) }, | |
| 2272 | +#endif | |
| 2273 | +#if IS_ENABLED(CONFIG_HID_WALTOP) | |
| 2113 | 2274 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, |
| 2114 | 2275 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, |
| 2115 | 2276 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) }, |
| @@ -2117,19 +2278,18 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1 unmodified line | ||
| 2117 | 2278 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, |
| 2118 | 2279 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, |
| 2119 | 2280 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) }, |
| 2120 | − { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) }, | |
| 2281 | +#endif | |
| 2282 | +#if IS_ENABLED(CONFIG_HID_XINMO) | |
| 2121 | 2283 | { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE) }, |
| 2122 | 2284 | { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_THT_2P_ARCADE) }, |
| 2285 | +#endif | |
| 2286 | +#if IS_ENABLED(CONFIG_HID_ZEROPLUS) | |
| 2123 | 2287 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, |
| 2124 | 2288 | { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, |
| 2289 | +#endif | |
| 2290 | +#if IS_ENABLED(CONFIG_HID_ZYDACRON) | |
| 2125 | 2291 | { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) }, |
| 2126 | − | |
| 2127 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, | |
| 2128 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) }, | |
| 2129 | − { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) }, | |
| 2130 | − { HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) }, | |
| 2131 | − { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM6533) }, | |
| 2132 | − { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_X1_COVER) }, | |
| 2292 | +#endif | |
| 2133 | 2293 | { } |
| 2134 | 2294 | }; |
| 2135 | 2295 | |
| @@ -1066,7 +1066,7 @@ static void ssip_pn_setup(struct net_device *dev) · 1065 unmodified lines | ||
| 1066 | 1066 | dev->addr_len = 1; |
| 1067 | 1067 | dev->tx_queue_len = SSIP_TXQUEUE_LEN; |
| 1068 | 1068 | |
| 1069 | − dev->destructor = free_netdev; | |
| 1069 | + dev->needs_free_netdev = true; | |
| 1070 | 1070 | dev->header_ops = &phonet_header_ops; |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| @@ -143,7 +143,7 @@ static void iproc_adc_reg_dump(struct iio_dev *indio_dev) · 142 unmodified lines | ||
| 143 | 143 | iproc_adc_dbg_reg(dev, adc_priv, IPROC_SOFT_BYPASS_DATA); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | −static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data) | |
| 146 | +static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data) | |
| 147 | 147 | { |
| 148 | 148 | u32 channel_intr_status; |
| 149 | 149 | u32 intr_status; |
| @@ -167,7 +167,7 @@ static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data) · 17 unmodified lines | ||
| 167 | 167 | return IRQ_NONE; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | −static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data) | |
| 170 | +static irqreturn_t iproc_adc_interrupt_handler(int irq, void *data) | |
| 171 | 171 | { |
| 172 | 172 | irqreturn_t retval = IRQ_NONE; |
| 173 | 173 | struct iproc_adc_priv *adc_priv; |
| @@ -181,7 +181,7 @@ static irqreturn_t iproc_adc_interrupt_thread(int irq, void *data) · 7 unmodified lines | ||
| 181 | 181 | adc_priv = iio_priv(indio_dev); |
| 182 | 182 | |
| 183 | 183 | regmap_read(adc_priv->regmap, IPROC_INTERRUPT_STATUS, &intr_status); |
| 184 | − dev_dbg(&indio_dev->dev, "iproc_adc_interrupt_thread(),INTRPT_STS:%x\n", | |
| 184 | + dev_dbg(&indio_dev->dev, "iproc_adc_interrupt_handler(),INTRPT_STS:%x\n", | |
| 185 | 185 | intr_status); |
| 186 | 186 | |
| 187 | 187 | intr_channels = (intr_status & IPROC_ADC_INTR_MASK) >> IPROC_ADC_INTR; |
| @@ -566,8 +566,8 @@ static int iproc_adc_probe(struct platform_device *pdev) · 378 unmodified lines | ||
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | ret = devm_request_threaded_irq(&pdev->dev, adc_priv->irqno, |
| 569 | − iproc_adc_interrupt_thread, | |
| 570 | 569 | iproc_adc_interrupt_handler, |
| 570 | + iproc_adc_interrupt_thread, | |
| 571 | 571 | IRQF_SHARED, "iproc-adc", indio_dev); |
| 572 | 572 | if (ret) { |
| 573 | 573 | dev_err(&pdev->dev, "request_irq error %d\n", ret); |
| @@ -438,10 +438,10 @@ static ssize_t max9611_shunt_resistor_show(struct device *dev, · 437 unmodified lines | ||
| 438 | 438 | struct max9611_dev *max9611 = iio_priv(dev_to_iio_dev(dev)); |
| 439 | 439 | unsigned int i, r; |
| 440 | 440 | |
| 441 | − i = max9611->shunt_resistor_uohm / 1000; | |
| 442 | − r = max9611->shunt_resistor_uohm % 1000; | |
| 441 | + i = max9611->shunt_resistor_uohm / 1000000; | |
| 442 | + r = max9611->shunt_resistor_uohm % 1000000; | |
| 443 | 443 | |
| 444 | − return sprintf(buf, "%u.%03u\n", i, r); | |
| 444 | + return sprintf(buf, "%u.%06u\n", i, r); | |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | static IIO_DEVICE_ATTR(in_power_shunt_resistor, 0444, |
| @@ -536,8 +536,8 @@ static int max9611_probe(struct i2c_client *client, · 88 unmodified lines | ||
| 536 | 536 | int ret; |
| 537 | 537 | |
| 538 | 538 | indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*max9611)); |
| 539 | − if (IS_ERR(indio_dev)) | |
| 540 | − return PTR_ERR(indio_dev); | |
| 539 | + if (!indio_dev) | |
| 540 | + return -ENOMEM; | |
| 541 | 541 | |
| 542 | 542 | i2c_set_clientdata(client, indio_dev); |
| 543 | 543 | |
| @@ -105,6 +105,8 @@ struct sun4i_gpadc_iio { · 104 unmodified lines | ||
| 105 | 105 | bool no_irq; |
| 106 | 106 | /* prevents concurrent reads of temperature and ADC */ |
| 107 | 107 | struct mutex mutex; |
| 108 | + struct thermal_zone_device *tzd; | |
| 109 | + struct device *sensor_device; | |
| 108 | 110 | }; |
| 109 | 111 | |
| 110 | 112 | #define SUN4I_GPADC_ADC_CHANNEL(_channel, _name) { \ |
| @@ -502,7 +504,6 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, · 391 unmodified lines | ||
| 502 | 504 | { |
| 503 | 505 | struct sun4i_gpadc_iio *info = iio_priv(indio_dev); |
| 504 | 506 | const struct of_device_id *of_dev; |
| 505 | − struct thermal_zone_device *tzd; | |
| 506 | 507 | struct resource *mem; |
| 507 | 508 | void __iomem *base; |
| 508 | 509 | int ret; |
| @@ -532,13 +533,14 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev, · 23 unmodified lines | ||
| 532 | 533 | if (!IS_ENABLED(CONFIG_THERMAL_OF)) |
| 533 | 534 | return 0; |
| 534 | 535 | |
| 535 | − tzd = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, info, | |
| 536 | − &sun4i_ts_tz_ops); | |
| 537 | − if (IS_ERR(tzd)) | |
| 536 | + info->sensor_device = &pdev->dev; | |
| 537 | + info->tzd = thermal_zone_of_sensor_register(info->sensor_device, 0, | |
| 538 | + info, &sun4i_ts_tz_ops); | |
| 539 | + if (IS_ERR(info->tzd)) | |
| 538 | 540 | dev_err(&pdev->dev, "could not register thermal sensor: %ld\n", |
| 539 | − PTR_ERR(tzd)); | |
| 541 | + PTR_ERR(info->tzd)); | |
| 540 | 542 | |
| 541 | − return PTR_ERR_OR_ZERO(tzd); | |
| 543 | + return PTR_ERR_OR_ZERO(info->tzd); | |
| 542 | 544 | } |
| 543 | 545 | |
| 544 | 546 | static int sun4i_gpadc_probe_mfd(struct platform_device *pdev, |
| @@ -584,15 +586,15 @@ static int sun4i_gpadc_probe_mfd(struct platform_device *pdev, · 39 unmodified lines | ||
| 584 | 586 | * of_node, and the device from this driver as third argument to |
| 585 | 587 | * return the temperature. |
| 586 | 588 | */ |
| 587 | − struct thermal_zone_device *tzd; | |
| 588 | − tzd = devm_thermal_zone_of_sensor_register(pdev->dev.parent, 0, | |
| 589 | − info, | |
| 590 | − &sun4i_ts_tz_ops); | |
| 591 | − if (IS_ERR(tzd)) { | |
| 589 | + info->sensor_device = pdev->dev.parent; | |
| 590 | + info->tzd = thermal_zone_of_sensor_register(info->sensor_device, | |
| 591 | + 0, info, | |
| 592 | + &sun4i_ts_tz_ops); | |
| 593 | + if (IS_ERR(info->tzd)) { | |
| 592 | 594 | dev_err(&pdev->dev, |
| 593 | 595 | "could not register thermal sensor: %ld\n", |
| 594 | − PTR_ERR(tzd)); | |
| 595 | − return PTR_ERR(tzd); | |
| 596 | + PTR_ERR(info->tzd)); | |
| 597 | + return PTR_ERR(info->tzd); | |
| 596 | 598 | } |
| 597 | 599 | } else { |
| 598 | 600 | indio_dev->num_channels = |
| @@ -688,7 +690,13 @@ static int sun4i_gpadc_remove(struct platform_device *pdev) · 89 unmodified lines | ||
| 688 | 690 | |
| 689 | 691 | pm_runtime_put(&pdev->dev); |
| 690 | 692 | pm_runtime_disable(&pdev->dev); |
| 691 | − if (!info->no_irq && IS_ENABLED(CONFIG_THERMAL_OF)) | |
| 693 | + | |
| 694 | + if (!IS_ENABLED(CONFIG_THERMAL_OF)) | |
| 695 | + return 0; | |
| 696 | + | |
| 697 | + thermal_zone_of_sensor_unregister(info->sensor_device, info->tzd); | |
| 698 | + | |
| 699 | + if (!info->no_irq) | |
| 692 | 700 | iio_map_array_unregister(indio_dev); |
| 693 | 701 | |
| 694 | 702 | return 0; |
| @@ -700,6 +708,7 @@ static const struct platform_device_id sun4i_gpadc_id[] = { · 5 unmodified lines | ||
| 700 | 708 | { "sun6i-a31-gpadc-iio", (kernel_ulong_t)&sun6i_gpadc_data }, |
| 701 | 709 | { /* sentinel */ }, |
| 702 | 710 | }; |
| 711 | +MODULE_DEVICE_TABLE(platform, sun4i_gpadc_id); | |
| 703 | 712 | |
| 704 | 713 | static struct platform_driver sun4i_gpadc_driver = { |
| 705 | 714 | .driver = { |
| @@ -711,6 +720,7 @@ static struct platform_driver sun4i_gpadc_driver = { · 5 unmodified lines | ||
| 711 | 720 | .probe = sun4i_gpadc_probe, |
| 712 | 721 | .remove = sun4i_gpadc_remove, |
| 713 | 722 | }; |
| 723 | +MODULE_DEVICE_TABLE(of, sun4i_gpadc_of_id); | |
| 714 | 724 | |
| 715 | 725 | module_platform_driver(sun4i_gpadc_driver); |
| 716 | 726 | |
| @@ -614,7 +614,7 @@ static int tiadc_probe(struct platform_device *pdev) · 613 unmodified lines | ||
| 614 | 614 | return -EINVAL; |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | − indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*indio_dev)); | |
| 617 | + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev)); | |
| 618 | 618 | if (indio_dev == NULL) { |
| 619 | 619 | dev_err(&pdev->dev, "failed to allocate iio device\n"); |
| 620 | 620 | return -ENOMEM; |
| @@ -451,7 +451,8 @@ static ssize_t iio_trigger_write_current(struct device *dev, · 450 unmodified lines | ||
| 451 | 451 | return len; |
| 452 | 452 | |
| 453 | 453 | out_trigger_put: |
| 454 | − iio_trigger_put(trig); | |
| 454 | + if (trig) | |
| 455 | + iio_trigger_put(trig); | |
| 455 | 456 | return ret; |
| 456 | 457 | } |
| 457 | 458 | |
| @@ -74,9 +74,9 @@ static const int int_time_mapping[] = {100000, 50000, 200000, 400000}; · 73 unmodified lines | ||
| 74 | 74 | static const struct reg_field reg_field_it = |
| 75 | 75 | REG_FIELD(LTR501_ALS_MEAS_RATE, 3, 4); |
| 76 | 76 | static const struct reg_field reg_field_als_intr = |
| 77 | − REG_FIELD(LTR501_INTR, 0, 0); | |
| 78 | −static const struct reg_field reg_field_ps_intr = | |
| 79 | 77 | REG_FIELD(LTR501_INTR, 1, 1); |
| 78 | +static const struct reg_field reg_field_ps_intr = | |
| 79 | + REG_FIELD(LTR501_INTR, 0, 0); | |
| 80 | 80 | static const struct reg_field reg_field_als_rate = |
| 81 | 81 | REG_FIELD(LTR501_ALS_MEAS_RATE, 0, 2); |
| 82 | 82 | static const struct reg_field reg_field_ps_rate = |
| @@ -40,9 +40,9 @@ · 39 unmodified lines | ||
| 40 | 40 | #define AS3935_AFE_PWR_BIT BIT(0) |
| 41 | 41 | |
| 42 | 42 | #define AS3935_INT 0x03 |
| 43 | −#define AS3935_INT_MASK 0x07 | |
| 43 | +#define AS3935_INT_MASK 0x0f | |
| 44 | 44 | #define AS3935_EVENT_INT BIT(3) |
| 45 | −#define AS3935_NOISE_INT BIT(1) | |
| 45 | +#define AS3935_NOISE_INT BIT(0) | |
| 46 | 46 | |
| 47 | 47 | #define AS3935_DATA 0x07 |
| 48 | 48 | #define AS3935_DATA_MASK 0x3F |
| @@ -215,7 +215,7 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private) · 166 unmodified lines | ||
| 215 | 215 | |
| 216 | 216 | st->buffer[0] = val & AS3935_DATA_MASK; |
| 217 | 217 | iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer, |
| 218 | − pf->timestamp); | |
| 218 | + iio_get_time_ns(indio_dev)); | |
| 219 | 219 | err_read: |
| 220 | 220 | iio_trigger_notify_done(indio_dev->trig); |
| 221 | 221 | |
| @@ -244,7 +244,7 @@ static void as3935_event_work(struct work_struct *work) · 22 unmodified lines | ||
| 244 | 244 | |
| 245 | 245 | switch (val) { |
| 246 | 246 | case AS3935_EVENT_INT: |
| 247 | − iio_trigger_poll(st->trig); | |
| 247 | + iio_trigger_poll_chained(st->trig); | |
| 248 | 248 | break; |
| 249 | 249 | case AS3935_NOISE_INT: |
| 250 | 250 | dev_warn(&st->spi->dev, "noise level is too high\n"); |
| @@ -269,8 +269,6 @@ static irqreturn_t as3935_interrupt_handler(int irq, void *private) · 18 unmodified lines | ||
| 269 | 269 | |
| 270 | 270 | static void calibrate_as3935(struct as3935_state *st) |
| 271 | 271 | { |
| 272 | − mutex_lock(&st->lock); | |
| 273 | − | |
| 274 | 272 | /* mask disturber interrupt bit */ |
| 275 | 273 | as3935_write(st, AS3935_INT, BIT(5)); |
| 276 | 274 | |
| @@ -280,8 +278,6 @@ static void calibrate_as3935(struct as3935_state *st) · 3 unmodified lines | ||
| 280 | 278 | |
| 281 | 279 | mdelay(2); |
| 282 | 280 | as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV)); |
| 283 | − | |
| 284 | − mutex_unlock(&st->lock); | |
| 285 | 281 | } |
| 286 | 282 | |
| 287 | 283 | #ifdef CONFIG_PM_SLEEP |
| @@ -318,6 +314,8 @@ static int as3935_resume(struct device *dev) · 30 unmodified lines | ||
| 318 | 314 | val &= ~AS3935_AFE_PWR_BIT; |
| 319 | 315 | ret = as3935_write(st, AS3935_AFE_GAIN, val); |
| 320 | 316 | |
| 317 | + calibrate_as3935(st); | |
| 318 | + | |
| 321 | 319 | err_resume: |
| 322 | 320 | mutex_unlock(&st->lock); |
| 323 | 321 | |
| @@ -68,6 +68,7 @@ · 67 unmodified lines | ||
| 68 | 68 | static inline u32 rxe_crc32(struct rxe_dev *rxe, |
| 69 | 69 | u32 crc, void *next, size_t len) |
| 70 | 70 | { |
| 71 | + u32 retval; | |
| 71 | 72 | int err; |
| 72 | 73 | |
| 73 | 74 | SHASH_DESC_ON_STACK(shash, rxe->tfm); |
| @@ -81,7 +82,9 @@ static inline u32 rxe_crc32(struct rxe_dev *rxe, · 7 unmodified lines | ||
| 81 | 82 | return crc32_le(crc, next, len); |
| 82 | 83 | } |
| 83 | 84 | |
| 84 | − return *(u32 *)shash_desc_ctx(shash); | |
| 85 | + retval = *(u32 *)shash_desc_ctx(shash); | |
| 86 | + barrier_data(shash_desc_ctx(shash)); | |
| 87 | + return retval; | |
| 85 | 88 | } |
| 86 | 89 | |
| 87 | 90 | int rxe_set_mtu(struct rxe_dev *rxe, unsigned int dev_mtu); |
| @@ -1118,8 +1118,10 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, · 1117 unmodified lines | ||
| 1118 | 1118 | * Asus UX32VD 0x361f02 00, 15, 0e clickpad |
| 1119 | 1119 | * Avatar AVIU-145A2 0x361f00 ? clickpad |
| 1120 | 1120 | * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons |
| 1121 | + * Fujitsu LIFEBOOK E546 0x470f00 50, 12, 09 2 hw buttons | |
| 1121 | 1122 | * Fujitsu LIFEBOOK E547 0x470f00 50, 12, 09 2 hw buttons |
| 1122 | 1123 | * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons |
| 1124 | + * Fujitsu LIFEBOOK E557 0x570f01 40, 14, 0c 2 hw buttons | |
| 1123 | 1125 | * Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons |
| 1124 | 1126 | * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**) |
| 1125 | 1127 | * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons |
| @@ -1524,6 +1526,13 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { · 398 unmodified lines | ||
| 1524 | 1526 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"), |
| 1525 | 1527 | }, |
| 1526 | 1528 | }, |
| 1529 | + { | |
| 1530 | + /* Fujitsu LIFEBOOK E546 does not work with crc_enabled == 0 */ | |
| 1531 | + .matches = { | |
| 1532 | + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | |
| 1533 | + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E546"), | |
| 1534 | + }, | |
| 1535 | + }, | |
| 1527 | 1536 | { |
| 1528 | 1537 | /* Fujitsu LIFEBOOK E547 does not work with crc_enabled == 0 */ |
| 1529 | 1538 | .matches = { |
| @@ -1545,6 +1554,13 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { · 15 unmodified lines | ||
| 1545 | 1554 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E556"), |
| 1546 | 1555 | }, |
| 1547 | 1556 | }, |
| 1557 | + { | |
| 1558 | + /* Fujitsu LIFEBOOK E557 does not work with crc_enabled == 0 */ | |
| 1559 | + .matches = { | |
| 1560 | + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | |
| 1561 | + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E557"), | |
| 1562 | + }, | |
| 1563 | + }, | |
| 1548 | 1564 | { |
| 1549 | 1565 | /* Fujitsu LIFEBOOK U745 does not work with crc_enabled == 0 */ |
| 1550 | 1566 | .matches = { |
| @@ -146,7 +146,7 @@ static int rmi_f03_register_pt(struct f03_data *f03) · 145 unmodified lines | ||
| 146 | 146 | if (!serio) |
| 147 | 147 | return -ENOMEM; |
| 148 | 148 | |
| 149 | − serio->id.type = SERIO_8042; | |
| 149 | + serio->id.type = SERIO_PS_PSTHRU; | |
| 150 | 150 | serio->write = rmi_f03_pt_write; |
| 151 | 151 | serio->port_data = f03; |
| 152 | 152 | |
| @@ -118,6 +118,7 @@ static const struct iommu_ops · 117 unmodified lines | ||
| 118 | 118 | |
| 119 | 119 | ops = iommu_ops_from_fwnode(fwnode); |
| 120 | 120 | if ((ops && !ops->of_xlate) || |
| 121 | + !of_device_is_available(iommu_spec->np) || | |
| 121 | 122 | (!ops && !of_iommu_driver_present(iommu_spec->np))) |
| 122 | 123 | return NULL; |
| 123 | 124 | |
| @@ -236,6 +237,12 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, · 112 unmodified lines | ||
| 236 | 237 | ops = ERR_PTR(err); |
| 237 | 238 | } |
| 238 | 239 | |
| 240 | + /* Ignore all other errors apart from EPROBE_DEFER */ | |
| 241 | + if (IS_ERR(ops) && (PTR_ERR(ops) != -EPROBE_DEFER)) { | |
| 242 | + dev_dbg(dev, "Adding to IOMMU failed: %ld\n", PTR_ERR(ops)); | |
| 243 | + ops = NULL; | |
| 244 | + } | |
| 245 | + | |
| 239 | 246 | return ops; |
| 240 | 247 | } |
| 241 | 248 | |
| @@ -142,7 +142,7 @@ static struct irq_chip xtensa_mx_irq_chip = { · 141 unmodified lines | ||
| 142 | 142 | int __init xtensa_mx_init_legacy(struct device_node *interrupt_parent) |
| 143 | 143 | { |
| 144 | 144 | struct irq_domain *root_domain = |
| 145 | − irq_domain_add_legacy(NULL, NR_IRQS, 0, 0, | |
| 145 | + irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0, | |
| 146 | 146 | &xtensa_mx_irq_domain_ops, |
| 147 | 147 | &xtensa_mx_irq_chip); |
| 148 | 148 | irq_set_default_host(root_domain); |
| @@ -89,7 +89,7 @@ static struct irq_chip xtensa_irq_chip = { · 88 unmodified lines | ||
| 89 | 89 | int __init xtensa_pic_init_legacy(struct device_node *interrupt_parent) |
| 90 | 90 | { |
| 91 | 91 | struct irq_domain *root_domain = |
| 92 | − irq_domain_add_legacy(NULL, NR_IRQS, 0, 0, | |
| 92 | + irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0, | |
| 93 | 93 | &xtensa_irq_domain_ops, &xtensa_irq_chip); |
| 94 | 94 | irq_set_default_host(root_domain); |
| 95 | 95 | return 0; |
| @@ -5174,6 +5174,18 @@ static void mddev_delayed_delete(struct work_struct *ws) · 5173 unmodified lines | ||
| 5174 | 5174 | |
| 5175 | 5175 | static void no_op(struct percpu_ref *r) {} |
| 5176 | 5176 | |
| 5177 | +int mddev_init_writes_pending(struct mddev *mddev) | |
| 5178 | +{ | |
| 5179 | + if (mddev->writes_pending.percpu_count_ptr) | |
| 5180 | + return 0; | |
| 5181 | + if (percpu_ref_init(&mddev->writes_pending, no_op, 0, GFP_KERNEL) < 0) | |
| 5182 | + return -ENOMEM; | |
| 5183 | + /* We want to start with the refcount at zero */ | |
| 5184 | + percpu_ref_put(&mddev->writes_pending); | |
| 5185 | + return 0; | |
| 5186 | +} | |
| 5187 | +EXPORT_SYMBOL_GPL(mddev_init_writes_pending); | |
| 5188 | + | |
| 5177 | 5189 | static int md_alloc(dev_t dev, char *name) |
| 5178 | 5190 | { |
| 5179 | 5191 | /* |
| @@ -5239,10 +5251,6 @@ static int md_alloc(dev_t dev, char *name) · 59 unmodified lines | ||
| 5239 | 5251 | blk_queue_make_request(mddev->queue, md_make_request); |
| 5240 | 5252 | blk_set_stacking_limits(&mddev->queue->limits); |
| 5241 | 5253 | |
| 5242 | − if (percpu_ref_init(&mddev->writes_pending, no_op, 0, GFP_KERNEL) < 0) | |
| 5243 | − goto abort; | |
| 5244 | − /* We want to start with the refcount at zero */ | |
| 5245 | − percpu_ref_put(&mddev->writes_pending); | |
| 5246 | 5254 | disk = alloc_disk(1 << shift); |
| 5247 | 5255 | if (!disk) { |
| 5248 | 5256 | blk_cleanup_queue(mddev->queue); |
| @@ -648,6 +648,7 @@ extern void md_unregister_thread(struct md_thread **threadp); · 647 unmodified lines | ||
| 648 | 648 | extern void md_wakeup_thread(struct md_thread *thread); |
| 649 | 649 | extern void md_check_recovery(struct mddev *mddev); |
| 650 | 650 | extern void md_reap_sync_thread(struct mddev *mddev); |
| 651 | +extern int mddev_init_writes_pending(struct mddev *mddev); | |
| 651 | 652 | extern void md_write_start(struct mddev *mddev, struct bio *bi); |
| 652 | 653 | extern void md_write_inc(struct mddev *mddev, struct bio *bi); |
| 653 | 654 | extern void md_write_end(struct mddev *mddev); |
| @@ -3063,6 +3063,8 @@ static int raid1_run(struct mddev *mddev) · 3062 unmodified lines | ||
| 3063 | 3063 | mdname(mddev)); |
| 3064 | 3064 | return -EIO; |
| 3065 | 3065 | } |
| 3066 | + if (mddev_init_writes_pending(mddev) < 0) | |
| 3067 | + return -ENOMEM; | |
| 3066 | 3068 | /* |
| 3067 | 3069 | * copy the already verified devices into our private RAID1 |
| 3068 | 3070 | * bookkeeping area. [whatever we allocate in run(), |
| @@ -3611,6 +3611,9 @@ static int raid10_run(struct mddev *mddev) · 3610 unmodified lines | ||
| 3611 | 3611 | int first = 1; |
| 3612 | 3612 | bool discard_supported = false; |
| 3613 | 3613 | |
| 3614 | + if (mddev_init_writes_pending(mddev) < 0) | |
| 3615 | + return -ENOMEM; | |
| 3616 | + | |
| 3614 | 3617 | if (mddev->private == NULL) { |
| 3615 | 3618 | conf = setup_conf(mddev); |
| 3616 | 3619 | if (IS_ERR(conf)) |
| @@ -7118,6 +7118,9 @@ static int raid5_run(struct mddev *mddev) · 7117 unmodified lines | ||
| 7118 | 7118 | long long min_offset_diff = 0; |
| 7119 | 7119 | int first = 1; |
| 7120 | 7120 | |
| 7121 | + if (mddev_init_writes_pending(mddev) < 0) | |
| 7122 | + return -ENOMEM; | |
| 7123 | + | |
| 7121 | 7124 | if (mddev->recovery_cp != MaxSector) |
| 7122 | 7125 | pr_notice("md/raid:%s: not clean -- starting background reconstruction\n", |
| 7123 | 7126 | mdname(mddev)); |
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | config MEDIA_CEC_RC |
| 2 | 2 | bool "HDMI CEC RC integration" |
| 3 | 3 | depends on CEC_CORE && RC_CORE |
| 4 | + depends on CEC_CORE=m || RC_CORE=y | |
| 4 | 5 | ---help--- |
| 5 | 6 | Pass on CEC remote control messages to the RC framework. |
| @@ -271,16 +271,10 @@ static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh, · 270 unmodified lines | ||
| 271 | 271 | bool block, struct cec_msg __user *parg) |
| 272 | 272 | { |
| 273 | 273 | struct cec_msg msg = {}; |
| 274 | − long err = 0; | |
| 274 | + long err; | |
| 275 | 275 | |
| 276 | 276 | if (copy_from_user(&msg, parg, sizeof(msg))) |
| 277 | 277 | return -EFAULT; |
| 278 | − mutex_lock(&adap->lock); | |
| 279 | − if (!adap->is_configured && fh->mode_follower < CEC_MODE_MONITOR) | |
| 280 | − err = -ENONET; | |
| 281 | − mutex_unlock(&adap->lock); | |
| 282 | − if (err) | |
| 283 | − return err; | |
| 284 | 278 | |
| 285 | 279 | err = cec_receive_msg(fh, &msg, block); |
| 286 | 280 | if (err) |
| @@ -223,7 +223,7 @@ static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val) · 222 unmodified lines | ||
| 223 | 223 | static void i2c_wr8_and_or(struct v4l2_subdev *sd, u16 reg, |
| 224 | 224 | u8 mask, u8 val) |
| 225 | 225 | { |
| 226 | − i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2); | |
| 226 | + i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 1) & mask) | val, 1); | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | static u16 i2c_rd16(struct v4l2_subdev *sd, u16 reg) |
| @@ -183,9 +183,15 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) · 182 unmodified lines | ||
| 183 | 183 | static unsigned long delt; |
| 184 | 184 | unsigned long deltintr; |
| 185 | 185 | unsigned long flags; |
| 186 | + int counter = 0; | |
| 186 | 187 | int iir, lsr; |
| 187 | 188 | |
| 188 | 189 | while ((iir = inb(io + UART_IIR) & UART_IIR_ID)) { |
| 190 | + if (++counter > 256) { | |
| 191 | + dev_err(&sir_ir_dev->dev, "Trapped in interrupt"); | |
| 192 | + break; | |
| 193 | + } | |
| 194 | + | |
| 189 | 195 | switch (iir & UART_IIR_ID) { /* FIXME toto treba preriedit */ |
| 190 | 196 | case UART_IIR_MSI: |
| 191 | 197 | (void)inb(io + UART_MSR); |
| @@ -336,6 +336,7 @@ static int rain_connect(struct serio *serio, struct serio_driver *drv) · 335 unmodified lines | ||
| 336 | 336 | serio_set_drvdata(serio, rain); |
| 337 | 337 | INIT_WORK(&rain->work, rain_irq_work_handler); |
| 338 | 338 | mutex_init(&rain->write_lock); |
| 339 | + spin_lock_init(&rain->buf_lock); | |
| 339 | 340 | |
| 340 | 341 | err = serio_open(serio, drv); |
| 341 | 342 | if (err) |
| @@ -868,7 +868,7 @@ EXPORT_SYMBOL_GPL(vb2_core_create_bufs); · 867 unmodified lines | ||
| 868 | 868 | |
| 869 | 869 | void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no) |
| 870 | 870 | { |
| 871 | − if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv) | |
| 871 | + if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv) | |
| 872 | 872 | return NULL; |
| 873 | 873 | |
| 874 | 874 | return call_ptr_memop(vb, vaddr, vb->planes[plane_no].mem_priv); |
| @@ -581,7 +581,7 @@ static int atmel_ebi_probe(struct platform_device *pdev) · 580 unmodified lines | ||
| 581 | 581 | return of_platform_populate(np, NULL, NULL, dev); |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | −static int atmel_ebi_resume(struct device *dev) | |
| 584 | +static __maybe_unused int atmel_ebi_resume(struct device *dev) | |
| 585 | 585 | { |
| 586 | 586 | struct atmel_ebi *ebi = dev_get_drvdata(dev); |
| 587 | 587 | struct atmel_ebi_dev *ebid; |
| @@ -159,11 +159,8 @@ static long afu_ioctl_start_work(struct cxl_context *ctx, · 158 unmodified lines | ||
| 159 | 159 | |
| 160 | 160 | /* Do this outside the status_mutex to avoid a circular dependency with |
| 161 | 161 | * the locking in cxl_mmap_fault() */ |
| 162 | − if (copy_from_user(&work, uwork, | |
| 163 | − sizeof(struct cxl_ioctl_start_work))) { | |
| 164 | − rc = -EFAULT; | |
| 165 | − goto out; | |
| 166 | − } | |
| 162 | + if (copy_from_user(&work, uwork, sizeof(work))) | |
| 163 | + return -EFAULT; | |
| 167 | 164 | |
| 168 | 165 | mutex_lock(&ctx->status_mutex); |
| 169 | 166 | if (ctx->status != OPENED) { |
| @@ -1302,13 +1302,16 @@ int cxl_native_register_psl_err_irq(struct cxl *adapter) · 1301 unmodified lines | ||
| 1302 | 1302 | |
| 1303 | 1303 | void cxl_native_release_psl_err_irq(struct cxl *adapter) |
| 1304 | 1304 | { |
| 1305 | − if (adapter->native->err_virq != irq_find_mapping(NULL, adapter->native->err_hwirq)) | |
| 1305 | + if (adapter->native->err_virq == 0 || | |
| 1306 | + adapter->native->err_virq != | |
| 1307 | + irq_find_mapping(NULL, adapter->native->err_hwirq)) | |
| 1306 | 1308 | return; |
| 1307 | 1309 | |
| 1308 | 1310 | cxl_p1_write(adapter, CXL_PSL_ErrIVTE, 0x0000000000000000); |
| 1309 | 1311 | cxl_unmap_irq(adapter->native->err_virq, adapter); |
| 1310 | 1312 | cxl_ops->release_one_irq(adapter, adapter->native->err_hwirq); |
| 1311 | 1313 | kfree(adapter->irq_name); |
| 1314 | + adapter->native->err_virq = 0; | |
| 1312 | 1315 | } |
| 1313 | 1316 | |
| 1314 | 1317 | int cxl_native_register_serr_irq(struct cxl_afu *afu) |
| @@ -1346,13 +1349,15 @@ int cxl_native_register_serr_irq(struct cxl_afu *afu) · 31 unmodified lines | ||
| 1346 | 1349 | |
| 1347 | 1350 | void cxl_native_release_serr_irq(struct cxl_afu *afu) |
| 1348 | 1351 | { |
| 1349 | − if (afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq)) | |
| 1352 | + if (afu->serr_virq == 0 || | |
| 1353 | + afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq)) | |
| 1350 | 1354 | return; |
| 1351 | 1355 | |
| 1352 | 1356 | cxl_p1n_write(afu, CXL_PSL_SERR_An, 0x0000000000000000); |
| 1353 | 1357 | cxl_unmap_irq(afu->serr_virq, afu); |
| 1354 | 1358 | cxl_ops->release_one_irq(afu->adapter, afu->serr_hwirq); |
| 1355 | 1359 | kfree(afu->err_irq_name); |
| 1360 | + afu->serr_virq = 0; | |
| 1356 | 1361 | } |
| 1357 | 1362 | |
| 1358 | 1363 | int cxl_native_register_psl_irq(struct cxl_afu *afu) |
| @@ -1375,12 +1380,15 @@ int cxl_native_register_psl_irq(struct cxl_afu *afu) · 16 unmodified lines | ||
| 1375 | 1380 | |
| 1376 | 1381 | void cxl_native_release_psl_irq(struct cxl_afu *afu) |
| 1377 | 1382 | { |
| 1378 | − if (afu->native->psl_virq != irq_find_mapping(NULL, afu->native->psl_hwirq)) | |
| 1383 | + if (afu->native->psl_virq == 0 || | |
| 1384 | + afu->native->psl_virq != | |
| 1385 | + irq_find_mapping(NULL, afu->native->psl_hwirq)) | |
| 1379 | 1386 | return; |
| 1380 | 1387 | |
| 1381 | 1388 | cxl_unmap_irq(afu->native->psl_virq, afu); |
| 1382 | 1389 | cxl_ops->release_one_irq(afu->adapter, afu->native->psl_hwirq); |
| 1383 | 1390 | kfree(afu->psl_irq_name); |
| 1391 | + afu->native->psl_virq = 0; | |
| 1384 | 1392 | } |
| 1385 | 1393 | |
| 1386 | 1394 | static void recover_psl_err(struct cxl_afu *afu, u64 errstat) |
| @@ -763,8 +763,10 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a, · 762 unmodified lines | ||
| 763 | 763 | { |
| 764 | 764 | struct mei_cl_device *cldev = to_mei_cl_device(dev); |
| 765 | 765 | const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); |
| 766 | + u8 version = mei_me_cl_ver(cldev->me_cl); | |
| 766 | 767 | |
| 767 | − return scnprintf(buf, PAGE_SIZE, "mei:%s:%pUl:", cldev->name, uuid); | |
| 768 | + return scnprintf(buf, PAGE_SIZE, "mei:%s:%pUl:%02X:", | |
| 769 | + cldev->name, uuid, version); | |
| 768 | 770 | } |
| 769 | 771 | static DEVICE_ATTR_RO(modalias); |
| 770 | 772 | |
| @@ -90,10 +90,13 @@ enum ad_link_speed_type { · 89 unmodified lines | ||
| 90 | 90 | AD_LINK_SPEED_100MBPS, |
| 91 | 91 | AD_LINK_SPEED_1000MBPS, |
| 92 | 92 | AD_LINK_SPEED_2500MBPS, |
| 93 | + AD_LINK_SPEED_5000MBPS, | |
| 93 | 94 | AD_LINK_SPEED_10000MBPS, |
| 95 | + AD_LINK_SPEED_14000MBPS, | |
| 94 | 96 | AD_LINK_SPEED_20000MBPS, |
| 95 | 97 | AD_LINK_SPEED_25000MBPS, |
| 96 | 98 | AD_LINK_SPEED_40000MBPS, |
| 99 | + AD_LINK_SPEED_50000MBPS, | |
| 97 | 100 | AD_LINK_SPEED_56000MBPS, |
| 98 | 101 | AD_LINK_SPEED_100000MBPS, |
| 99 | 102 | }; |
| @@ -259,10 +262,13 @@ static inline int __check_agg_selection_timer(struct port *port) · 159 unmodified lines | ||
| 259 | 262 | * %AD_LINK_SPEED_100MBPS, |
| 260 | 263 | * %AD_LINK_SPEED_1000MBPS, |
| 261 | 264 | * %AD_LINK_SPEED_2500MBPS, |
| 265 | + * %AD_LINK_SPEED_5000MBPS, | |
| 262 | 266 | * %AD_LINK_SPEED_10000MBPS |
| 267 | + * %AD_LINK_SPEED_14000MBPS, | |
| 263 | 268 | * %AD_LINK_SPEED_20000MBPS |
| 264 | 269 | * %AD_LINK_SPEED_25000MBPS |
| 265 | 270 | * %AD_LINK_SPEED_40000MBPS |
| 271 | + * %AD_LINK_SPEED_50000MBPS | |
| 266 | 272 | * %AD_LINK_SPEED_56000MBPS |
| 267 | 273 | * %AD_LINK_SPEED_100000MBPS |
| 268 | 274 | */ |
| @@ -296,10 +302,18 @@ static u16 __get_link_speed(struct port *port) · 27 unmodified lines | ||
| 296 | 302 | speed = AD_LINK_SPEED_2500MBPS; |
| 297 | 303 | break; |
| 298 | 304 | |
| 305 | + case SPEED_5000: | |
| 306 | + speed = AD_LINK_SPEED_5000MBPS; | |
| 307 | + break; | |
| 308 | + | |
| 299 | 309 | case SPEED_10000: |
| 300 | 310 | speed = AD_LINK_SPEED_10000MBPS; |
| 301 | 311 | break; |
| 302 | 312 | |
| 313 | + case SPEED_14000: | |
| 314 | + speed = AD_LINK_SPEED_14000MBPS; | |
| 315 | + break; | |
| 316 | + | |
| 303 | 317 | case SPEED_20000: |
| 304 | 318 | speed = AD_LINK_SPEED_20000MBPS; |
| 305 | 319 | break; |
| @@ -312,6 +326,10 @@ static u16 __get_link_speed(struct port *port) · 6 unmodified lines | ||
| 312 | 326 | speed = AD_LINK_SPEED_40000MBPS; |
| 313 | 327 | break; |
| 314 | 328 | |
| 329 | + case SPEED_50000: | |
| 330 | + speed = AD_LINK_SPEED_50000MBPS; | |
| 331 | + break; | |
| 332 | + | |
| 315 | 333 | case SPEED_56000: |
| 316 | 334 | speed = AD_LINK_SPEED_56000MBPS; |
| 317 | 335 | break; |
| @@ -712,9 +730,15 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 394 unmodified lines | ||
| 712 | 730 | case AD_LINK_SPEED_2500MBPS: |
| 713 | 731 | bandwidth = nports * 2500; |
| 714 | 732 | break; |
| 733 | + case AD_LINK_SPEED_5000MBPS: | |
| 734 | + bandwidth = nports * 5000; | |
| 735 | + break; | |
| 715 | 736 | case AD_LINK_SPEED_10000MBPS: |
| 716 | 737 | bandwidth = nports * 10000; |
| 717 | 738 | break; |
| 739 | + case AD_LINK_SPEED_14000MBPS: | |
| 740 | + bandwidth = nports * 14000; | |
| 741 | + break; | |
| 718 | 742 | case AD_LINK_SPEED_20000MBPS: |
| 719 | 743 | bandwidth = nports * 20000; |
| 720 | 744 | break; |
| @@ -724,6 +748,9 @@ static u32 __get_agg_bandwidth(struct aggregator *aggregator) · 3 unmodified lines | ||
| 724 | 748 | case AD_LINK_SPEED_40000MBPS: |
| 725 | 749 | bandwidth = nports * 40000; |
| 726 | 750 | break; |
| 751 | + case AD_LINK_SPEED_50000MBPS: | |
| 752 | + bandwidth = nports * 50000; | |
| 753 | + break; | |
| 727 | 754 | case AD_LINK_SPEED_56000MBPS: |
| 728 | 755 | bandwidth = nports * 56000; |
| 729 | 756 | break; |
| @@ -4187,7 +4187,6 @@ static void bond_destructor(struct net_device *bond_dev) · 4186 unmodified lines | ||
| 4187 | 4187 | struct bonding *bond = netdev_priv(bond_dev); |
| 4188 | 4188 | if (bond->wq) |
| 4189 | 4189 | destroy_workqueue(bond->wq); |
| 4190 | − free_netdev(bond_dev); | |
| 4191 | 4190 | } |
| 4192 | 4191 | |
| 4193 | 4192 | void bond_setup(struct net_device *bond_dev) |
| @@ -4207,7 +4206,8 @@ void bond_setup(struct net_device *bond_dev) · 13 unmodified lines | ||
| 4207 | 4206 | bond_dev->netdev_ops = &bond_netdev_ops; |
| 4208 | 4207 | bond_dev->ethtool_ops = &bond_ethtool_ops; |
| 4209 | 4208 | |
| 4210 | − bond_dev->destructor = bond_destructor; | |
| 4209 | + bond_dev->needs_free_netdev = true; | |
| 4210 | + bond_dev->priv_destructor = bond_destructor; | |
| 4211 | 4211 | |
| 4212 | 4212 | SET_NETDEV_DEVTYPE(bond_dev, &bond_type); |
| 4213 | 4213 | |
| @@ -4731,7 +4731,7 @@ int bond_create(struct net *net, const char *name) · 517 unmodified lines | ||
| 4731 | 4731 | |
| 4732 | 4732 | rtnl_unlock(); |
| 4733 | 4733 | if (res < 0) |
| 4734 | − bond_destructor(bond_dev); | |
| 4734 | + free_netdev(bond_dev); | |
| 4735 | 4735 | return res; |
| 4736 | 4736 | } |
| 4737 | 4737 | |
| @@ -1121,7 +1121,7 @@ static void cfhsi_setup(struct net_device *dev) · 1120 unmodified lines | ||
| 1121 | 1121 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; |
| 1122 | 1122 | dev->mtu = CFHSI_MAX_CAIF_FRAME_SZ; |
| 1123 | 1123 | dev->priv_flags |= IFF_NO_QUEUE; |
| 1124 | − dev->destructor = free_netdev; | |
| 1124 | + dev->needs_free_netdev = true; | |
| 1125 | 1125 | dev->netdev_ops = &cfhsi_netdevops; |
| 1126 | 1126 | for (i = 0; i < CFHSI_PRIO_LAST; ++i) |
| 1127 | 1127 | skb_queue_head_init(&cfhsi->qhead[i]); |
| @@ -428,7 +428,7 @@ static void caifdev_setup(struct net_device *dev) · 427 unmodified lines | ||
| 428 | 428 | dev->flags = IFF_POINTOPOINT | IFF_NOARP; |
| 429 | 429 | dev->mtu = CAIF_MAX_MTU; |
| 430 | 430 | dev->priv_flags |= IFF_NO_QUEUE; |
| 431 | − dev->destructor = free_netdev; | |
| 431 | + dev->needs_free_netdev = true; | |
| 432 | 432 | skb_queue_head_init(&serdev->head); |
| 433 | 433 | serdev->common.link_select = CAIF_LINK_LOW_LATENCY; |
| 434 | 434 | serdev->common.use_frag = true; |
| @@ -712,7 +712,7 @@ static void cfspi_setup(struct net_device *dev) · 711 unmodified lines | ||
| 712 | 712 | dev->flags = IFF_NOARP | IFF_POINTOPOINT; |
| 713 | 713 | dev->priv_flags |= IFF_NO_QUEUE; |
| 714 | 714 | dev->mtu = SPI_MAX_PAYLOAD_SIZE; |
| 715 | − dev->destructor = free_netdev; | |
| 715 | + dev->needs_free_netdev = true; | |
| 716 | 716 | skb_queue_head_init(&cfspi->qhead); |
| 717 | 717 | skb_queue_head_init(&cfspi->chead); |
| 718 | 718 | cfspi->cfdev.link_select = CAIF_LINK_HIGH_BANDW; |
| @@ -617,7 +617,7 @@ static void cfv_netdev_setup(struct net_device *netdev) · 616 unmodified lines | ||
| 617 | 617 | netdev->tx_queue_len = 100; |
| 618 | 618 | netdev->flags = IFF_POINTOPOINT | IFF_NOARP; |
| 619 | 619 | netdev->mtu = CFV_DEF_MTU_SIZE; |
| 620 | − netdev->destructor = free_netdev; | |
| 620 | + netdev->needs_free_netdev = true; | |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /* Create debugfs counters for the device */ |
| @@ -391,6 +391,9 @@ void can_change_state(struct net_device *dev, struct can_frame *cf, · 390 unmodified lines | ||
| 391 | 391 | can_update_state_error_stats(dev, new_state); |
| 392 | 392 | priv->state = new_state; |
| 393 | 393 | |
| 394 | + if (!cf) | |
| 395 | + return; | |
| 396 | + | |
| 394 | 397 | if (unlikely(new_state == CAN_STATE_BUS_OFF)) { |
| 395 | 398 | cf->can_id |= CAN_ERR_BUSOFF; |
| 396 | 399 | return; |
| @@ -489,7 +489,7 @@ int peak_canfd_handle_msgs_list(struct peak_canfd_priv *priv, · 488 unmodified lines | ||
| 489 | 489 | struct pucan_rx_msg *msg_list, int msg_count) |
| 490 | 490 | { |
| 491 | 491 | void *msg_ptr = msg_list; |
| 492 | − int i, msg_size; | |
| 492 | + int i, msg_size = 0; | |
| 493 | 493 | |
| 494 | 494 | for (i = 0; i < msg_count; i++) { |
| 495 | 495 | msg_size = peak_canfd_handle_msg(priv, msg_ptr); |
| @@ -417,7 +417,7 @@ static int slc_open(struct net_device *dev) · 416 unmodified lines | ||
| 417 | 417 | static void slc_free_netdev(struct net_device *dev) |
| 418 | 418 | { |
| 419 | 419 | int i = dev->base_addr; |
| 420 | − free_netdev(dev); | |
| 420 | + | |
| 421 | 421 | slcan_devs[i] = NULL; |
| 422 | 422 | } |
| 423 | 423 | |
| @@ -436,7 +436,8 @@ static const struct net_device_ops slc_netdev_ops = { · 12 unmodified lines | ||
| 436 | 436 | static void slc_setup(struct net_device *dev) |
| 437 | 437 | { |
| 438 | 438 | dev->netdev_ops = &slc_netdev_ops; |
| 439 | − dev->destructor = slc_free_netdev; | |
| 439 | + dev->needs_free_netdev = true; | |
| 440 | + dev->priv_destructor = slc_free_netdev; | |
| 440 | 441 | |
| 441 | 442 | dev->hard_header_len = 0; |
| 442 | 443 | dev->addr_len = 0; |
| @@ -761,8 +762,6 @@ static void __exit slcan_exit(void) · 318 unmodified lines | ||
| 761 | 762 | if (sl->tty) { |
| 762 | 763 | printk(KERN_ERR "%s: tty discipline still running\n", |
| 763 | 764 | dev->name); |
| 764 | − /* Intentionally leak the control block. */ | |
| 765 | − dev->destructor = NULL; | |
| 766 | 765 | } |
| 767 | 766 | |
| 768 | 767 | unregister_netdev(dev); |
| @@ -265,6 +265,8 @@ static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev) · 264 unmodified lines | ||
| 265 | 265 | sizeof(*dm), |
| 266 | 266 | 1000); |
| 267 | 267 | |
| 268 | + kfree(dm); | |
| 269 | + | |
| 268 | 270 | return rc; |
| 269 | 271 | } |
| 270 | 272 | |
| @@ -908,8 +908,6 @@ static int peak_usb_probe(struct usb_interface *intf, · 907 unmodified lines | ||
| 908 | 908 | const struct peak_usb_adapter *peak_usb_adapter = NULL; |
| 909 | 909 | int i, err = -ENOMEM; |
| 910 | 910 | |
| 911 | − usb_dev = interface_to_usbdev(intf); | |
| 912 | − | |
| 913 | 911 | /* get corresponding PCAN-USB adapter */ |
| 914 | 912 | for (i = 0; i < ARRAY_SIZE(peak_usb_adapters_list); i++) |
| 915 | 913 | if (peak_usb_adapters_list[i]->device_id == usb_id_product) { |
| @@ -920,7 +918,7 @@ static int peak_usb_probe(struct usb_interface *intf, · 4 unmodified lines | ||
| 920 | 918 | if (!peak_usb_adapter) { |
| 921 | 919 | /* should never come except device_id bad usage in this file */ |
| 922 | 920 | pr_err("%s: didn't find device id. 0x%x in devices list\n", |
| 923 | − PCAN_USB_DRIVER_NAME, usb_dev->descriptor.idProduct); | |
| 921 | + PCAN_USB_DRIVER_NAME, usb_id_product); | |
| 924 | 922 | return -ENODEV; |
| 925 | 923 | } |
| 926 | 924 | |
| @@ -152,7 +152,7 @@ static const struct net_device_ops vcan_netdev_ops = { · 151 unmodified lines | ||
| 152 | 152 | static void vcan_setup(struct net_device *dev) |
| 153 | 153 | { |
| 154 | 154 | dev->type = ARPHRD_CAN; |
| 155 | − dev->mtu = CAN_MTU; | |
| 155 | + dev->mtu = CANFD_MTU; | |
| 156 | 156 | dev->hard_header_len = 0; |
| 157 | 157 | dev->addr_len = 0; |
| 158 | 158 | dev->tx_queue_len = 0; |
| @@ -163,7 +163,7 @@ static void vcan_setup(struct net_device *dev) · 4 unmodified lines | ||
| 163 | 163 | dev->flags |= IFF_ECHO; |
| 164 | 164 | |
| 165 | 165 | dev->netdev_ops = &vcan_netdev_ops; |
| 166 | − dev->destructor = free_netdev; | |
| 166 | + dev->needs_free_netdev = true; | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | static struct rtnl_link_ops vcan_link_ops __read_mostly = { |
| @@ -150,13 +150,13 @@ static const struct net_device_ops vxcan_netdev_ops = { · 149 unmodified lines | ||
| 150 | 150 | static void vxcan_setup(struct net_device *dev) |
| 151 | 151 | { |
| 152 | 152 | dev->type = ARPHRD_CAN; |
| 153 | − dev->mtu = CAN_MTU; | |
| 153 | + dev->mtu = CANFD_MTU; | |
| 154 | 154 | dev->hard_header_len = 0; |
| 155 | 155 | dev->addr_len = 0; |
| 156 | 156 | dev->tx_queue_len = 0; |
| 157 | 157 | dev->flags = (IFF_NOARP|IFF_ECHO); |
| 158 | 158 | dev->netdev_ops = &vxcan_netdev_ops; |
| 159 | − dev->destructor = free_netdev; | |
| 159 | + dev->needs_free_netdev = true; | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /* forward declaration for rtnl_create_link() */ |
| @@ -328,7 +328,6 @@ static void dummy_free_netdev(struct net_device *dev) · 327 unmodified lines | ||
| 328 | 328 | struct dummy_priv *priv = netdev_priv(dev); |
| 329 | 329 | |
| 330 | 330 | kfree(priv->vfinfo); |
| 331 | − free_netdev(dev); | |
| 332 | 331 | } |
| 333 | 332 | |
| 334 | 333 | static void dummy_setup(struct net_device *dev) |
| @@ -338,7 +337,8 @@ static void dummy_setup(struct net_device *dev) · 3 unmodified lines | ||
| 338 | 337 | /* Initialize the device structure. */ |
| 339 | 338 | dev->netdev_ops = &dummy_netdev_ops; |
| 340 | 339 | dev->ethtool_ops = &dummy_ethtool_ops; |
| 341 | − dev->destructor = dummy_free_netdev; | |
| 340 | + dev->needs_free_netdev = true; | |
| 341 | + dev->priv_destructor = dummy_free_netdev; | |
| 342 | 342 | |
| 343 | 343 | /* Fill in device structure with ethernet-generic values. */ |
| 344 | 344 | dev->flags |= IFF_NOARP; |
| @@ -61,6 +61,8 @@ · 60 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | #define ENA_MMIO_READ_TIMEOUT 0xFFFFFFFF |
| 63 | 63 | |
| 64 | +#define ENA_REGS_ADMIN_INTR_MASK 1 | |
| 65 | + | |
| 64 | 66 | /*****************************************************************************/ |
| 65 | 67 | /*****************************************************************************/ |
| 66 | 68 | /*****************************************************************************/ |
| @@ -232,11 +234,9 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd(struct ena_com_admin_queu · 165 unmodified lines | ||
| 232 | 234 | tail_masked = admin_queue->sq.tail & queue_size_mask; |
| 233 | 235 | |
| 234 | 236 | /* In case of queue FULL */ |
| 235 | − cnt = admin_queue->sq.tail - admin_queue->sq.head; | |
| 237 | + cnt = atomic_read(&admin_queue->outstanding_cmds); | |
| 236 | 238 | if (cnt >= admin_queue->q_depth) { |
| 237 | − pr_debug("admin queue is FULL (tail %d head %d depth: %d)\n", | |
| 238 | − admin_queue->sq.tail, admin_queue->sq.head, | |
| 239 | − admin_queue->q_depth); | |
| 239 | + pr_debug("admin queue is full.\n"); | |
| 240 | 240 | admin_queue->stats.out_of_space++; |
| 241 | 241 | return ERR_PTR(-ENOSPC); |
| 242 | 242 | } |
| @@ -508,15 +508,20 @@ static int ena_com_comp_status_to_errno(u8 comp_status) · 265 unmodified lines | ||
| 508 | 508 | static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_ctx, |
| 509 | 509 | struct ena_com_admin_queue *admin_queue) |
| 510 | 510 | { |
| 511 | − unsigned long flags; | |
| 512 | − u32 start_time; | |
| 511 | + unsigned long flags, timeout; | |
| 513 | 512 | int ret; |
| 514 | 513 | |
| 515 | − start_time = ((u32)jiffies_to_usecs(jiffies)); | |
| 514 | + timeout = jiffies + ADMIN_CMD_TIMEOUT_US; | |
| 515 | + | |
| 516 | + while (1) { | |
| 517 | + spin_lock_irqsave(&admin_queue->q_lock, flags); | |
| 518 | + ena_com_handle_admin_completion(admin_queue); | |
| 519 | + spin_unlock_irqrestore(&admin_queue->q_lock, flags); | |
| 520 | + | |
| 521 | + if (comp_ctx->status != ENA_CMD_SUBMITTED) | |
| 522 | + break; | |
| 516 | 523 | |
| 517 | − while (comp_ctx->status == ENA_CMD_SUBMITTED) { | |
| 518 | − if ((((u32)jiffies_to_usecs(jiffies)) - start_time) > | |
| 519 | − ADMIN_CMD_TIMEOUT_US) { | |
| 524 | + if (time_is_before_jiffies(timeout)) { | |
| 520 | 525 | pr_err("Wait for completion (polling) timeout\n"); |
| 521 | 526 | /* ENA didn't have any completion */ |
| 522 | 527 | spin_lock_irqsave(&admin_queue->q_lock, flags); |
| @@ -528,10 +533,6 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c · 5 unmodified lines | ||
| 528 | 533 | goto err; |
| 529 | 534 | } |
| 530 | 535 | |
| 531 | − spin_lock_irqsave(&admin_queue->q_lock, flags); | |
| 532 | − ena_com_handle_admin_completion(admin_queue); | |
| 533 | − spin_unlock_irqrestore(&admin_queue->q_lock, flags); | |
| 534 | − | |
| 535 | 536 | msleep(100); |
| 536 | 537 | } |
| 537 | 538 | |
| @@ -1455,6 +1456,12 @@ void ena_com_admin_destroy(struct ena_com_dev *ena_dev) · 917 unmodified lines | ||
| 1455 | 1456 | |
| 1456 | 1457 | void ena_com_set_admin_polling_mode(struct ena_com_dev *ena_dev, bool polling) |
| 1457 | 1458 | { |
| 1459 | + u32 mask_value = 0; | |
| 1460 | + | |
| 1461 | + if (polling) | |
| 1462 | + mask_value = ENA_REGS_ADMIN_INTR_MASK; | |
| 1463 | + | |
| 1464 | + writel(mask_value, ena_dev->reg_bar + ENA_REGS_INTR_MASK_OFF); | |
| 1458 | 1465 | ena_dev->admin_queue.polling = polling; |
| 1459 | 1466 | } |
| 1460 | 1467 | |
| @@ -80,7 +80,6 @@ static const struct ena_stats ena_stats_tx_strings[] = { · 79 unmodified lines | ||
| 80 | 80 | ENA_STAT_TX_ENTRY(tx_poll), |
| 81 | 81 | ENA_STAT_TX_ENTRY(doorbells), |
| 82 | 82 | ENA_STAT_TX_ENTRY(prepare_ctx_err), |
| 83 | − ENA_STAT_TX_ENTRY(missing_tx_comp), | |
| 84 | 83 | ENA_STAT_TX_ENTRY(bad_req_id), |
| 85 | 84 | }; |
| 86 | 85 | |
| @@ -94,6 +93,7 @@ static const struct ena_stats ena_stats_rx_strings[] = { · 7 unmodified lines | ||
| 94 | 93 | ENA_STAT_RX_ENTRY(dma_mapping_err), |
| 95 | 94 | ENA_STAT_RX_ENTRY(bad_desc_num), |
| 96 | 95 | ENA_STAT_RX_ENTRY(rx_copybreak_pkt), |
| 96 | + ENA_STAT_RX_ENTRY(empty_rx_ring), | |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | 99 | static const struct ena_stats ena_stats_ena_com_strings[] = { |
| @@ -190,6 +190,7 @@ static void ena_init_io_rings(struct ena_adapter *adapter) · 189 unmodified lines | ||
| 190 | 190 | rxr->sgl_size = adapter->max_rx_sgl_size; |
| 191 | 191 | rxr->smoothed_interval = |
| 192 | 192 | ena_com_get_nonadaptive_moderation_interval_rx(ena_dev); |
| 193 | + rxr->empty_rx_queue = 0; | |
| 193 | 194 | } |
| 194 | 195 | } |
| 195 | 196 | |
| @@ -1078,6 +1079,26 @@ inline void ena_adjust_intr_moderation(struct ena_ring *rx_ring, · 882 unmodified lines | ||
| 1078 | 1079 | rx_ring->per_napi_bytes = 0; |
| 1079 | 1080 | } |
| 1080 | 1081 | |
| 1082 | +static inline void ena_unmask_interrupt(struct ena_ring *tx_ring, | |
| 1083 | + struct ena_ring *rx_ring) | |
| 1084 | +{ | |
| 1085 | + struct ena_eth_io_intr_reg intr_reg; | |
| 1086 | + | |
| 1087 | + /* Update intr register: rx intr delay, | |
| 1088 | + * tx intr delay and interrupt unmask | |
| 1089 | + */ | |
| 1090 | + ena_com_update_intr_reg(&intr_reg, | |
| 1091 | + rx_ring->smoothed_interval, | |
| 1092 | + tx_ring->smoothed_interval, | |
| 1093 | + true); | |
| 1094 | + | |
| 1095 | + /* It is a shared MSI-X. | |
| 1096 | + * Tx and Rx CQ have pointer to it. | |
| 1097 | + * So we use one of them to reach the intr reg | |
| 1098 | + */ | |
| 1099 | + ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg); | |
| 1100 | +} | |
| 1101 | + | |
| 1081 | 1102 | static inline void ena_update_ring_numa_node(struct ena_ring *tx_ring, |
| 1082 | 1103 | struct ena_ring *rx_ring) |
| 1083 | 1104 | { |
| @@ -1108,7 +1129,6 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 24 unmodified lines | ||
| 1108 | 1129 | { |
| 1109 | 1130 | struct ena_napi *ena_napi = container_of(napi, struct ena_napi, napi); |
| 1110 | 1131 | struct ena_ring *tx_ring, *rx_ring; |
| 1111 | − struct ena_eth_io_intr_reg intr_reg; | |
| 1112 | 1132 | |
| 1113 | 1133 | u32 tx_work_done; |
| 1114 | 1134 | u32 rx_work_done; |
| @@ -1149,22 +1169,9 @@ static int ena_io_poll(struct napi_struct *napi, int budget) · 34 unmodified lines | ||
| 1149 | 1169 | if (ena_com_get_adaptive_moderation_enabled(rx_ring->ena_dev)) |
| 1150 | 1170 | ena_adjust_intr_moderation(rx_ring, tx_ring); |
| 1151 | 1171 | |
| 1152 | − /* Update intr register: rx intr delay, | |
| 1153 | − * tx intr delay and interrupt unmask | |
| 1154 | − */ | |
| 1155 | − ena_com_update_intr_reg(&intr_reg, | |
| 1156 | − rx_ring->smoothed_interval, | |
| 1157 | − tx_ring->smoothed_interval, | |
| 1158 | − true); | |
| 1159 | − | |
| 1160 | − /* It is a shared MSI-X. | |
| 1161 | − * Tx and Rx CQ have pointer to it. | |
| 1162 | − * So we use one of them to reach the intr reg | |
| 1163 | − */ | |
| 1164 | − ena_com_unmask_intr(rx_ring->ena_com_io_cq, &intr_reg); | |
| 1172 | + ena_unmask_interrupt(tx_ring, rx_ring); | |
| 1165 | 1173 | } |
| 1166 | 1174 | |
| 1167 | − | |
| 1168 | 1175 | ena_update_ring_numa_node(tx_ring, rx_ring); |
| 1169 | 1176 | |
| 1170 | 1177 | ret = rx_work_done; |
| @@ -1485,6 +1492,11 @@ static int ena_up_complete(struct ena_adapter *adapter) · 314 unmodified lines | ||
| 1485 | 1492 | |
| 1486 | 1493 | ena_napi_enable_all(adapter); |
| 1487 | 1494 | |
| 1495 | + /* Enable completion queues interrupt */ | |
| 1496 | + for (i = 0; i < adapter->num_queues; i++) | |
| 1497 | + ena_unmask_interrupt(&adapter->tx_ring[i], | |
| 1498 | + &adapter->rx_ring[i]); | |
| 1499 | + | |
| 1488 | 1500 | /* schedule napi in case we had pending packets |
| 1489 | 1501 | * from the last time we disable napi |
| 1490 | 1502 | */ |
| @@ -1532,6 +1544,7 @@ static int ena_create_io_tx_queue(struct ena_adapter *adapter, int qid) · 41 unmodified lines | ||
| 1532 | 1544 | "Failed to get TX queue handlers. TX queue num %d rc: %d\n", |
| 1533 | 1545 | qid, rc); |
| 1534 | 1546 | ena_com_destroy_io_queue(ena_dev, ena_qid); |
| 1547 | + return rc; | |
| 1535 | 1548 | } |
| 1536 | 1549 | |
| 1537 | 1550 | ena_com_update_numa_node(tx_ring->ena_com_io_cq, ctx.numa_node); |
| @@ -1596,6 +1609,7 @@ static int ena_create_io_rx_queue(struct ena_adapter *adapter, int qid) · 58 unmodified lines | ||
| 1596 | 1609 | "Failed to get RX queue handlers. RX queue num %d rc: %d\n", |
| 1597 | 1610 | qid, rc); |
| 1598 | 1611 | ena_com_destroy_io_queue(ena_dev, ena_qid); |
| 1612 | + return rc; | |
| 1599 | 1613 | } |
| 1600 | 1614 | |
| 1601 | 1615 | ena_com_update_numa_node(rx_ring->ena_com_io_cq, ctx.numa_node); |
| @@ -1981,6 +1995,7 @@ static netdev_tx_t ena_start_xmit(struct sk_buff *skb, struct net_device *dev) · 379 unmodified lines | ||
| 1981 | 1995 | |
| 1982 | 1996 | tx_info->tx_descs = nb_hw_desc; |
| 1983 | 1997 | tx_info->last_jiffies = jiffies; |
| 1998 | + tx_info->print_once = 0; | |
| 1984 | 1999 | |
| 1985 | 2000 | tx_ring->next_to_use = ENA_TX_RING_IDX_NEXT(next_to_use, |
| 1986 | 2001 | tx_ring->ring_size); |
| @@ -2550,13 +2565,44 @@ err: · 563 unmodified lines | ||
| 2550 | 2565 | "Reset attempt failed. Can not reset the device\n"); |
| 2551 | 2566 | } |
| 2552 | 2567 | |
| 2553 | −static void check_for_missing_tx_completions(struct ena_adapter *adapter) | |
| 2568 | +static int check_missing_comp_in_queue(struct ena_adapter *adapter, | |
| 2569 | + struct ena_ring *tx_ring) | |
| 2554 | 2570 | { |
| 2555 | 2571 | struct ena_tx_buffer *tx_buf; |
| 2556 | 2572 | unsigned long last_jiffies; |
| 2573 | + u32 missed_tx = 0; | |
| 2574 | + int i; | |
| 2575 | + | |
| 2576 | + for (i = 0; i < tx_ring->ring_size; i++) { | |
| 2577 | + tx_buf = &tx_ring->tx_buffer_info[i]; | |
| 2578 | + last_jiffies = tx_buf->last_jiffies; | |
| 2579 | + if (unlikely(last_jiffies && | |
| 2580 | + time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) { | |
| 2581 | + if (!tx_buf->print_once) | |
| 2582 | + netif_notice(adapter, tx_err, adapter->netdev, | |
| 2583 | + "Found a Tx that wasn't completed on time, qid %d, index %d.\n", | |
| 2584 | + tx_ring->qid, i); | |
| 2585 | + | |
| 2586 | + tx_buf->print_once = 1; | |
| 2587 | + missed_tx++; | |
| 2588 | + | |
| 2589 | + if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) { | |
| 2590 | + netif_err(adapter, tx_err, adapter->netdev, | |
| 2591 | + "The number of lost tx completions is above the threshold (%d > %d). Reset the device\n", | |
| 2592 | + missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS); | |
| 2593 | + set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags); | |
| 2594 | + return -EIO; | |
| 2595 | + } | |
| 2596 | + } | |
| 2597 | + } | |
| 2598 | + | |
| 2599 | + return 0; | |
| 2600 | +} | |
| 2601 | + | |
| 2602 | +static void check_for_missing_tx_completions(struct ena_adapter *adapter) | |
| 2603 | +{ | |
| 2557 | 2604 | struct ena_ring *tx_ring; |
| 2558 | − int i, j, budget; | |
| 2559 | − u32 missed_tx; | |
| 2605 | + int i, budget, rc; | |
| 2560 | 2606 | |
| 2561 | 2607 | /* Make sure the driver doesn't turn the device in other process */ |
| 2562 | 2608 | smp_rmb(); |
| @@ -2572,31 +2618,9 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 9 unmodified lines | ||
| 2572 | 2618 | for (i = adapter->last_monitored_tx_qid; i < adapter->num_queues; i++) { |
| 2573 | 2619 | tx_ring = &adapter->tx_ring[i]; |
| 2574 | 2620 | |
| 2575 | − for (j = 0; j < tx_ring->ring_size; j++) { | |
| 2576 | − tx_buf = &tx_ring->tx_buffer_info[j]; | |
| 2577 | − last_jiffies = tx_buf->last_jiffies; | |
| 2578 | − if (unlikely(last_jiffies && time_is_before_jiffies(last_jiffies + TX_TIMEOUT))) { | |
| 2579 | − netif_notice(adapter, tx_err, adapter->netdev, | |
| 2580 | − "Found a Tx that wasn't completed on time, qid %d, index %d.\n", | |
| 2581 | − tx_ring->qid, j); | |
| 2582 | − | |
| 2583 | − u64_stats_update_begin(&tx_ring->syncp); | |
| 2584 | − missed_tx = tx_ring->tx_stats.missing_tx_comp++; | |
| 2585 | − u64_stats_update_end(&tx_ring->syncp); | |
| 2586 | − | |
| 2587 | − /* Clear last jiffies so the lost buffer won't | |
| 2588 | − * be counted twice. | |
| 2589 | − */ | |
| 2590 | − tx_buf->last_jiffies = 0; | |
| 2591 | − | |
| 2592 | − if (unlikely(missed_tx > MAX_NUM_OF_TIMEOUTED_PACKETS)) { | |
| 2593 | − netif_err(adapter, tx_err, adapter->netdev, | |
| 2594 | − "The number of lost tx completion is above the threshold (%d > %d). Reset the device\n", | |
| 2595 | − missed_tx, MAX_NUM_OF_TIMEOUTED_PACKETS); | |
| 2596 | − set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags); | |
| 2597 | − } | |
| 2598 | − } | |
| 2599 | − } | |
| 2621 | + rc = check_missing_comp_in_queue(adapter, tx_ring); | |
| 2622 | + if (unlikely(rc)) | |
| 2623 | + return; | |
| 2600 | 2624 | |
| 2601 | 2625 | budget--; |
| 2602 | 2626 | if (!budget) |
| @@ -2606,6 +2630,58 @@ static void check_for_missing_tx_completions(struct ena_adapter *adapter) · 3 unmodified lines | ||
| 2606 | 2630 | adapter->last_monitored_tx_qid = i % adapter->num_queues; |
| 2607 | 2631 | } |
| 2608 | 2632 | |
| 2633 | +/* trigger napi schedule after 2 consecutive detections */ | |
| 2634 | +#define EMPTY_RX_REFILL 2 | |
| 2635 | +/* For the rare case where the device runs out of Rx descriptors and the | |
| 2636 | + * napi handler failed to refill new Rx descriptors (due to a lack of memory | |
| 2637 | + * for example). | |
| 2638 | + * This case will lead to a deadlock: | |
| 2639 | + * The device won't send interrupts since all the new Rx packets will be dropped | |
| 2640 | + * The napi handler won't allocate new Rx descriptors so the device will be | |
| 2641 | + * able to send new packets. | |
| 2642 | + * | |
| 2643 | + * This scenario can happen when the kernel's vm.min_free_kbytes is too small. | |
| 2644 | + * It is recommended to have at least 512MB, with a minimum of 128MB for | |
| 2645 | + * constrained environment). | |
| 2646 | + * | |
| 2647 | + * When such a situation is detected - Reschedule napi | |
| 2648 | + */ | |
| 2649 | +static void check_for_empty_rx_ring(struct ena_adapter *adapter) | |
| 2650 | +{ | |
| 2651 | + struct ena_ring *rx_ring; | |
| 2652 | + int i, refill_required; | |
| 2653 | + | |
| 2654 | + if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags)) | |
| 2655 | + return; | |
| 2656 | + | |
| 2657 | + if (test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags)) | |
| 2658 | + return; | |
| 2659 | + | |
| 2660 | + for (i = 0; i < adapter->num_queues; i++) { | |
| 2661 | + rx_ring = &adapter->rx_ring[i]; | |
| 2662 | + | |
| 2663 | + refill_required = | |
| 2664 | + ena_com_sq_empty_space(rx_ring->ena_com_io_sq); | |
| 2665 | + if (unlikely(refill_required == (rx_ring->ring_size - 1))) { | |
| 2666 | + rx_ring->empty_rx_queue++; | |
| 2667 | + | |
| 2668 | + if (rx_ring->empty_rx_queue >= EMPTY_RX_REFILL) { | |
| 2669 | + u64_stats_update_begin(&rx_ring->syncp); | |
| 2670 | + rx_ring->rx_stats.empty_rx_ring++; | |
| 2671 | + u64_stats_update_end(&rx_ring->syncp); | |
| 2672 | + | |
| 2673 | + netif_err(adapter, drv, adapter->netdev, | |
| 2674 | + "trigger refill for ring %d\n", i); | |
| 2675 | + | |
| 2676 | + napi_schedule(rx_ring->napi); | |
| 2677 | + rx_ring->empty_rx_queue = 0; | |
| 2678 | + } | |
| 2679 | + } else { | |
| 2680 | + rx_ring->empty_rx_queue = 0; | |
| 2681 | + } | |
| 2682 | + } | |
| 2683 | +} | |
| 2684 | + | |
| 2609 | 2685 | /* Check for keep alive expiration */ |
| 2610 | 2686 | static void check_for_missing_keep_alive(struct ena_adapter *adapter) |
| 2611 | 2687 | { |
| @@ -2660,6 +2736,8 @@ static void ena_timer_service(unsigned long data) · 48 unmodified lines | ||
| 2660 | 2736 | |
| 2661 | 2737 | check_for_missing_tx_completions(adapter); |
| 2662 | 2738 | |
| 2739 | + check_for_empty_rx_ring(adapter); | |
| 2740 | + | |
| 2663 | 2741 | if (debug_area) |
| 2664 | 2742 | ena_dump_stats_to_buf(adapter, debug_area); |
| 2665 | 2743 | |
| @@ -2840,6 +2918,11 @@ static void ena_release_bars(struct ena_com_dev *ena_dev, struct pci_dev *pdev) · 174 unmodified lines | ||
| 2840 | 2918 | { |
| 2841 | 2919 | int release_bars; |
| 2842 | 2920 | |
| 2921 | + if (ena_dev->mem_bar) | |
| 2922 | + devm_iounmap(&pdev->dev, ena_dev->mem_bar); | |
| 2923 | + | |
| 2924 | + devm_iounmap(&pdev->dev, ena_dev->reg_bar); | |
| 2925 | + | |
| 2843 | 2926 | release_bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK; |
| 2844 | 2927 | pci_release_selected_regions(pdev, release_bars); |
| 2845 | 2928 | } |
| @@ -2927,8 +3010,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 81 unmodified lines | ||
| 2927 | 3010 | goto err_free_ena_dev; |
| 2928 | 3011 | } |
| 2929 | 3012 | |
| 2930 | − ena_dev->reg_bar = ioremap(pci_resource_start(pdev, ENA_REG_BAR), | |
| 2931 | − pci_resource_len(pdev, ENA_REG_BAR)); | |
| 3013 | + ena_dev->reg_bar = devm_ioremap(&pdev->dev, | |
| 3014 | + pci_resource_start(pdev, ENA_REG_BAR), | |
| 3015 | + pci_resource_len(pdev, ENA_REG_BAR)); | |
| 2932 | 3016 | if (!ena_dev->reg_bar) { |
| 2933 | 3017 | dev_err(&pdev->dev, "failed to remap regs bar\n"); |
| 2934 | 3018 | rc = -EFAULT; |
| @@ -2948,8 +3032,9 @@ static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 13 unmodified lines | ||
| 2948 | 3032 | ena_set_push_mode(pdev, ena_dev, &get_feat_ctx); |
| 2949 | 3033 | |
| 2950 | 3034 | if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) { |
| 2951 | − ena_dev->mem_bar = ioremap_wc(pci_resource_start(pdev, ENA_MEM_BAR), | |
| 2952 | − pci_resource_len(pdev, ENA_MEM_BAR)); | |
| 3035 | + ena_dev->mem_bar = devm_ioremap_wc(&pdev->dev, | |
| 3036 | + pci_resource_start(pdev, ENA_MEM_BAR), | |
| 3037 | + pci_resource_len(pdev, ENA_MEM_BAR)); | |
| 2953 | 3038 | if (!ena_dev->mem_bar) { |
| 2954 | 3039 | rc = -EFAULT; |
| 2955 | 3040 | goto err_device_destroy; |
| @@ -45,7 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | |
| 46 | 46 | #define DRV_MODULE_VER_MAJOR 1 |
| 47 | 47 | #define DRV_MODULE_VER_MINOR 1 |
| 48 | −#define DRV_MODULE_VER_SUBMINOR 2 | |
| 48 | +#define DRV_MODULE_VER_SUBMINOR 7 | |
| 49 | 49 | |
| 50 | 50 | #define DRV_MODULE_NAME "ena" |
| 51 | 51 | #ifndef DRV_MODULE_VERSION |
| @@ -146,7 +146,18 @@ struct ena_tx_buffer { · 94 unmodified lines | ||
| 146 | 146 | u32 tx_descs; |
| 147 | 147 | /* num of buffers used by this skb */ |
| 148 | 148 | u32 num_of_bufs; |
| 149 | − /* Save the last jiffies to detect missing tx packets */ | |
| 149 | + | |
| 150 | + /* Used for detect missing tx packets to limit the number of prints */ | |
| 151 | + u32 print_once; | |
| 152 | + /* Save the last jiffies to detect missing tx packets | |
| 153 | + * | |
| 154 | + * sets to non zero value on ena_start_xmit and set to zero on | |
| 155 | + * napi and timer_Service_routine. | |
| 156 | + * | |
| 157 | + * while this value is not protected by lock, | |
| 158 | + * a given packet is not expected to be handled by ena_start_xmit | |
| 159 | + * and by napi/timer_service at the same time. | |
| 160 | + */ | |
| 150 | 161 | unsigned long last_jiffies; |
| 151 | 162 | struct ena_com_buf bufs[ENA_PKT_MAX_BUFS]; |
| 152 | 163 | } ____cacheline_aligned; |
| @@ -170,7 +181,6 @@ struct ena_stats_tx { · 17 unmodified lines | ||
| 170 | 181 | u64 napi_comp; |
| 171 | 182 | u64 tx_poll; |
| 172 | 183 | u64 doorbells; |
| 173 | − u64 missing_tx_comp; | |
| 174 | 184 | u64 bad_req_id; |
| 175 | 185 | }; |
| 176 | 186 | |
| @@ -184,6 +194,7 @@ struct ena_stats_rx { · 7 unmodified lines | ||
| 184 | 194 | u64 dma_mapping_err; |
| 185 | 195 | u64 bad_desc_num; |
| 186 | 196 | u64 rx_copybreak_pkt; |
| 197 | + u64 empty_rx_ring; | |
| 187 | 198 | }; |
| 188 | 199 | |
| 189 | 200 | struct ena_ring { |
| @@ -231,6 +242,7 @@ struct ena_ring { · 41 unmodified lines | ||
| 231 | 242 | struct ena_stats_tx tx_stats; |
| 232 | 243 | struct ena_stats_rx rx_stats; |
| 233 | 244 | }; |
| 245 | + int empty_rx_queue; | |
| 234 | 246 | } ____cacheline_aligned; |
| 235 | 247 | |
| 236 | 248 | struct ena_stats_dev { |
| @@ -193,9 +193,6 @@ int hw_atl_utils_hw_get_regs(struct aq_hw_s *self, · 192 unmodified lines | ||
| 193 | 193 | struct aq_hw_caps_s *aq_hw_caps, |
| 194 | 194 | u32 *regs_buff); |
| 195 | 195 | |
| 196 | −int hw_atl_utils_hw_get_settings(struct aq_hw_s *self, | |
| 197 | − struct ethtool_cmd *cmd); | |
| 198 | − | |
| 199 | 196 | int hw_atl_utils_hw_set_power(struct aq_hw_s *self, |
| 200 | 197 | unsigned int power_state); |
| 201 | 198 | |
| @@ -3883,15 +3883,26 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) · 3882 unmodified lines | ||
| 3883 | 3883 | /* when transmitting in a vf, start bd must hold the ethertype |
| 3884 | 3884 | * for fw to enforce it |
| 3885 | 3885 | */ |
| 3886 | + u16 vlan_tci = 0; | |
| 3886 | 3887 | #ifndef BNX2X_STOP_ON_ERROR |
| 3887 | − if (IS_VF(bp)) | |
| 3888 | + if (IS_VF(bp)) { | |
| 3888 | 3889 | #endif |
| 3889 | − tx_start_bd->vlan_or_ethertype = | |
| 3890 | − cpu_to_le16(ntohs(eth->h_proto)); | |
| 3890 | + /* Still need to consider inband vlan for enforced */ | |
| 3891 | + if (__vlan_get_tag(skb, &vlan_tci)) { | |
| 3892 | + tx_start_bd->vlan_or_ethertype = | |
| 3893 | + cpu_to_le16(ntohs(eth->h_proto)); | |
| 3894 | + } else { | |
| 3895 | + tx_start_bd->bd_flags.as_bitfield |= | |
| 3896 | + (X_ETH_INBAND_VLAN << | |
| 3897 | + ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT); | |
| 3898 | + tx_start_bd->vlan_or_ethertype = | |
| 3899 | + cpu_to_le16(vlan_tci); | |
| 3900 | + } | |
| 3891 | 3901 | #ifndef BNX2X_STOP_ON_ERROR |
| 3892 | − else | |
| 3902 | + } else { | |
| 3893 | 3903 | /* used by FW for packet accounting */ |
| 3894 | 3904 | tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod); |
| 3905 | + } | |
| 3895 | 3906 | #endif |
| 3896 | 3907 | } |
| 3897 | 3908 | |
| @@ -901,6 +901,8 @@ static void bnx2x_vf_flr(struct bnx2x *bp, struct bnx2x_virtf *vf) · 900 unmodified lines | ||
| 901 | 901 | /* release VF resources */ |
| 902 | 902 | bnx2x_vf_free_resc(bp, vf); |
| 903 | 903 | |
| 904 | + vf->malicious = false; | |
| 905 | + | |
| 904 | 906 | /* re-open the mailbox */ |
| 905 | 907 | bnx2x_vf_enable_mbx(bp, vf->abs_vfid); |
| 906 | 908 | return; |
| @@ -1822,9 +1824,11 @@ get_vf: · 915 unmodified lines | ||
| 1822 | 1824 | vf->abs_vfid, qidx); |
| 1823 | 1825 | bnx2x_vf_handle_rss_update_eqe(bp, vf); |
| 1824 | 1826 | case EVENT_RING_OPCODE_VF_FLR: |
| 1825 | − case EVENT_RING_OPCODE_MALICIOUS_VF: | |
| 1826 | 1827 | /* Do nothing for now */ |
| 1827 | 1828 | return 0; |
| 1829 | + case EVENT_RING_OPCODE_MALICIOUS_VF: | |
| 1830 | + vf->malicious = true; | |
| 1831 | + return 0; | |
| 1828 | 1832 | } |
| 1829 | 1833 | |
| 1830 | 1834 | return 0; |
| @@ -1905,6 +1909,13 @@ void bnx2x_iov_adjust_stats_req(struct bnx2x *bp) · 74 unmodified lines | ||
| 1905 | 1909 | continue; |
| 1906 | 1910 | } |
| 1907 | 1911 | |
| 1912 | + if (vf->malicious) { | |
| 1913 | + DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS), | |
| 1914 | + "vf %d malicious so no stats for it\n", | |
| 1915 | + vf->abs_vfid); | |
| 1916 | + continue; | |
| 1917 | + } | |
| 1918 | + | |
| 1908 | 1919 | DP_AND((BNX2X_MSG_IOV | BNX2X_MSG_STATS), |
| 1909 | 1920 | "add addresses for vf %d\n", vf->abs_vfid); |
| 1910 | 1921 | for_each_vfq(vf, j) { |
| @@ -3042,7 +3053,7 @@ void bnx2x_vf_pci_dealloc(struct bnx2x *bp) · 1131 unmodified lines | ||
| 3042 | 3053 | { |
| 3043 | 3054 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, |
| 3044 | 3055 | sizeof(struct bnx2x_vf_mbx_msg)); |
| 3045 | − BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping, | |
| 3056 | + BNX2X_PCI_FREE(bp->pf2vf_bulletin, bp->pf2vf_bulletin_mapping, | |
| 3046 | 3057 | sizeof(union pf_vf_bulletin)); |
| 3047 | 3058 | } |
| 3048 | 3059 | |
| @@ -141,6 +141,7 @@ struct bnx2x_virtf { · 140 unmodified lines | ||
| 141 | 141 | #define VF_RESET 3 /* VF FLR'd, pending cleanup */ |
| 142 | 142 | |
| 143 | 143 | bool flr_clnup_stage; /* true during flr cleanup */ |
| 144 | + bool malicious; /* true if FW indicated so, until FLR */ | |
| 144 | 145 | |
| 145 | 146 | /* dma */ |
| 146 | 147 | dma_addr_t fw_stat_map; |
| @@ -4668,7 +4668,7 @@ static void dummy_setup(struct net_device *dev) · 4667 unmodified lines | ||
| 4668 | 4668 | /* Initialize the device structure. */ |
| 4669 | 4669 | dev->netdev_ops = &cxgb4_mgmt_netdev_ops; |
| 4670 | 4670 | dev->ethtool_ops = &cxgb4_mgmt_ethtool_ops; |
| 4671 | − dev->destructor = free_netdev; | |
| 4671 | + dev->needs_free_netdev = true; | |
| 4672 | 4672 | } |
| 4673 | 4673 | |
| 4674 | 4674 | static int config_mgmt_dev(struct pci_dev *pdev) |
| @@ -343,6 +343,7 @@ static int emac_reset(struct emac_instance *dev) · 342 unmodified lines | ||
| 343 | 343 | { |
| 344 | 344 | struct emac_regs __iomem *p = dev->emacp; |
| 345 | 345 | int n = 20; |
| 346 | + bool __maybe_unused try_internal_clock = false; | |
| 346 | 347 | |
| 347 | 348 | DBG(dev, "reset" NL); |
| 348 | 349 | |
| @@ -355,6 +356,7 @@ static int emac_reset(struct emac_instance *dev) · 6 unmodified lines | ||
| 355 | 356 | } |
| 356 | 357 | |
| 357 | 358 | #ifdef CONFIG_PPC_DCR_NATIVE |
| 359 | +do_retry: | |
| 358 | 360 | /* |
| 359 | 361 | * PPC460EX/GT Embedded Processor Advanced User's Manual |
| 360 | 362 | * section 28.10.1 Mode Register 0 (EMACx_MR0) states: |
| @@ -362,10 +364,19 @@ static int emac_reset(struct emac_instance *dev) · 1 unmodified line | ||
| 362 | 364 | * of the EMAC. If none is present, select the internal clock |
| 363 | 365 | * (SDR0_ETH_CFG[EMACx_PHY_CLK] = 1). |
| 364 | 366 | * After a soft reset, select the external clock. |
| 367 | + * | |
| 368 | + * The AR8035-A PHY Meraki MR24 does not provide a TX Clk if the | |
| 369 | + * ethernet cable is not attached. This causes the reset to timeout | |
| 370 | + * and the PHY detection code in emac_init_phy() is unable to | |
| 371 | + * communicate and detect the AR8035-A PHY. As a result, the emac | |
| 372 | + * driver bails out early and the user has no ethernet. | |
| 373 | + * In order to stay compatible with existing configurations, the | |
| 374 | + * driver will temporarily switch to the internal clock, after | |
| 375 | + * the first reset fails. | |
| 365 | 376 | */ |
| 366 | 377 | if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) { |
| 367 | − if (dev->phy_address == 0xffffffff && | |
| 368 | − dev->phy_map == 0xffffffff) { | |
| 378 | + if (try_internal_clock || (dev->phy_address == 0xffffffff && | |
| 379 | + dev->phy_map == 0xffffffff)) { | |
| 369 | 380 | /* No PHY: select internal loop clock before reset */ |
| 370 | 381 | dcri_clrset(SDR0, SDR0_ETH_CFG, |
| 371 | 382 | 0, SDR0_ETH_CFG_ECS << dev->cell_index); |
| @@ -383,8 +394,15 @@ static int emac_reset(struct emac_instance *dev) · 11 unmodified lines | ||
| 383 | 394 | |
| 384 | 395 | #ifdef CONFIG_PPC_DCR_NATIVE |
| 385 | 396 | if (emac_has_feature(dev, EMAC_FTR_460EX_PHY_CLK_FIX)) { |
| 386 | − if (dev->phy_address == 0xffffffff && | |
| 387 | − dev->phy_map == 0xffffffff) { | |
| 397 | + if (!n && !try_internal_clock) { | |
| 398 | + /* first attempt has timed out. */ | |
| 399 | + n = 20; | |
| 400 | + try_internal_clock = true; | |
| 401 | + goto do_retry; | |
| 402 | + } | |
| 403 | + | |
| 404 | + if (try_internal_clock || (dev->phy_address == 0xffffffff && | |
| 405 | + dev->phy_map == 0xffffffff)) { | |
| 388 | 406 | /* No PHY: restore external clock source after reset */ |
| 389 | 407 | dcri_clrset(SDR0, SDR0_ETH_CFG, |
| 390 | 408 | SDR0_ETH_CFG_ECS << dev->cell_index, 0); |
| @@ -2460,20 +2478,24 @@ static int emac_mii_bus_reset(struct mii_bus *bus) · 2069 unmodified lines | ||
| 2460 | 2478 | return emac_reset(dev); |
| 2461 | 2479 | } |
| 2462 | 2480 | |
| 2481 | +static int emac_mdio_phy_start_aneg(struct mii_phy *phy, | |
| 2482 | + struct phy_device *phy_dev) | |
| 2483 | +{ | |
| 2484 | + phy_dev->autoneg = phy->autoneg; | |
| 2485 | + phy_dev->speed = phy->speed; | |
| 2486 | + phy_dev->duplex = phy->duplex; | |
| 2487 | + phy_dev->advertising = phy->advertising; | |
| 2488 | + return phy_start_aneg(phy_dev); | |
| 2489 | +} | |
| 2490 | + | |
| 2463 | 2491 | static int emac_mdio_setup_aneg(struct mii_phy *phy, u32 advertise) |
| 2464 | 2492 | { |
| 2465 | 2493 | struct net_device *ndev = phy->dev; |
| 2466 | 2494 | struct emac_instance *dev = netdev_priv(ndev); |
| 2467 | 2495 | |
| 2468 | − dev->phy.autoneg = AUTONEG_ENABLE; | |
| 2469 | − dev->phy.speed = SPEED_1000; | |
| 2470 | − dev->phy.duplex = DUPLEX_FULL; | |
| 2471 | − dev->phy.advertising = advertise; | |
| 2472 | 2496 | phy->autoneg = AUTONEG_ENABLE; |
| 2473 | − phy->speed = dev->phy.speed; | |
| 2474 | − phy->duplex = dev->phy.duplex; | |
| 2475 | 2497 | phy->advertising = advertise; |
| 2476 | − return phy_start_aneg(dev->phy_dev); | |
| 2498 | + return emac_mdio_phy_start_aneg(phy, dev->phy_dev); | |
| 2477 | 2499 | } |
| 2478 | 2500 | |
| 2479 | 2501 | static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd) |
| @@ -2481,13 +2503,10 @@ static int emac_mdio_setup_forced(struct mii_phy *phy, int speed, int fd) · 1 unmodified line | ||
| 2481 | 2503 | struct net_device *ndev = phy->dev; |
| 2482 | 2504 | struct emac_instance *dev = netdev_priv(ndev); |
| 2483 | 2505 | |
| 2484 | − dev->phy.autoneg = AUTONEG_DISABLE; | |
| 2485 | − dev->phy.speed = speed; | |
| 2486 | − dev->phy.duplex = fd; | |
| 2487 | 2506 | phy->autoneg = AUTONEG_DISABLE; |
| 2488 | 2507 | phy->speed = speed; |
| 2489 | 2508 | phy->duplex = fd; |
| 2490 | − return phy_start_aneg(dev->phy_dev); | |
| 2509 | + return emac_mdio_phy_start_aneg(phy, dev->phy_dev); | |
| 2491 | 2510 | } |
| 2492 | 2511 | |
| 2493 | 2512 | static int emac_mdio_poll_link(struct mii_phy *phy) |
| @@ -2509,16 +2528,17 @@ static int emac_mdio_read_link(struct mii_phy *phy) · 15 unmodified lines | ||
| 2509 | 2528 | { |
| 2510 | 2529 | struct net_device *ndev = phy->dev; |
| 2511 | 2530 | struct emac_instance *dev = netdev_priv(ndev); |
| 2531 | + struct phy_device *phy_dev = dev->phy_dev; | |
| 2512 | 2532 | int res; |
| 2513 | 2533 | |
| 2514 | − res = phy_read_status(dev->phy_dev); | |
| 2534 | + res = phy_read_status(phy_dev); | |
| 2515 | 2535 | if (res) |
| 2516 | 2536 | return res; |
| 2517 | 2537 | |
| 2518 | − dev->phy.speed = phy->speed; | |
| 2519 | − dev->phy.duplex = phy->duplex; | |
| 2520 | − dev->phy.pause = phy->pause; | |
| 2521 | − dev->phy.asym_pause = phy->asym_pause; | |
| 2538 | + phy->speed = phy_dev->speed; | |
| 2539 | + phy->duplex = phy_dev->duplex; | |
| 2540 | + phy->pause = phy_dev->pause; | |
| 2541 | + phy->asym_pause = phy_dev->asym_pause; | |
| 2522 | 2542 | return 0; |
| 2523 | 2543 | } |
| 2524 | 2544 | |
| @@ -2528,13 +2548,6 @@ static int emac_mdio_init_phy(struct mii_phy *phy) · 3 unmodified lines | ||
| 2528 | 2548 | struct emac_instance *dev = netdev_priv(ndev); |
| 2529 | 2549 | |
| 2530 | 2550 | phy_start(dev->phy_dev); |
| 2531 | − dev->phy.autoneg = phy->autoneg; | |
| 2532 | − dev->phy.speed = phy->speed; | |
| 2533 | − dev->phy.duplex = phy->duplex; | |
| 2534 | − dev->phy.advertising = phy->advertising; | |
| 2535 | − dev->phy.pause = phy->pause; | |
| 2536 | − dev->phy.asym_pause = phy->asym_pause; | |
| 2537 | − | |
| 2538 | 2551 | return phy_init_hw(dev->phy_dev); |
| 2539 | 2552 | } |
| 2540 | 2553 | |
| @@ -1588,6 +1588,11 @@ static void ibmvnic_netpoll_controller(struct net_device *dev) · 1587 unmodified lines | ||
| 1588 | 1588 | } |
| 1589 | 1589 | #endif |
| 1590 | 1590 | |
| 1591 | +static int ibmvnic_change_mtu(struct net_device *netdev, int new_mtu) | |
| 1592 | +{ | |
| 1593 | + return -EOPNOTSUPP; | |
| 1594 | +} | |
| 1595 | + | |
| 1591 | 1596 | static const struct net_device_ops ibmvnic_netdev_ops = { |
| 1592 | 1597 | .ndo_open = ibmvnic_open, |
| 1593 | 1598 | .ndo_stop = ibmvnic_close, |
| @@ -1599,6 +1604,7 @@ static const struct net_device_ops ibmvnic_netdev_ops = { · 5 unmodified lines | ||
| 1599 | 1604 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 1600 | 1605 | .ndo_poll_controller = ibmvnic_netpoll_controller, |
| 1601 | 1606 | #endif |
| 1607 | + .ndo_change_mtu = ibmvnic_change_mtu, | |
| 1602 | 1608 | }; |
| 1603 | 1609 | |
| 1604 | 1610 | /* ethtool functions */ |
| @@ -399,6 +399,7 @@ struct i40e_pf { · 398 unmodified lines | ||
| 399 | 399 | #define I40E_FLAG_RX_CSUM_ENABLED BIT_ULL(1) |
| 400 | 400 | #define I40E_FLAG_MSI_ENABLED BIT_ULL(2) |
| 401 | 401 | #define I40E_FLAG_MSIX_ENABLED BIT_ULL(3) |
| 402 | +#define I40E_FLAG_HW_ATR_EVICT_ENABLED BIT_ULL(4) | |
| 402 | 403 | #define I40E_FLAG_RSS_ENABLED BIT_ULL(6) |
| 403 | 404 | #define I40E_FLAG_VMDQ_ENABLED BIT_ULL(7) |
| 404 | 405 | #define I40E_FLAG_IWARP_ENABLED BIT_ULL(10) |
| @@ -225,7 +225,7 @@ static const struct i40e_priv_flags i40e_gstrings_priv_flags[] = { · 224 unmodified lines | ||
| 225 | 225 | I40E_PRIV_FLAG("LinkPolling", I40E_FLAG_LINK_POLLING_ENABLED, 0), |
| 226 | 226 | I40E_PRIV_FLAG("flow-director-atr", I40E_FLAG_FD_ATR_ENABLED, 0), |
| 227 | 227 | I40E_PRIV_FLAG("veb-stats", I40E_FLAG_VEB_STATS_ENABLED, 0), |
| 228 | − I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_CAPABLE, 0), | |
| 228 | + I40E_PRIV_FLAG("hw-atr-eviction", I40E_FLAG_HW_ATR_EVICT_ENABLED, 0), | |
| 229 | 229 | I40E_PRIV_FLAG("legacy-rx", I40E_FLAG_LEGACY_RX, 0), |
| 230 | 230 | }; |
| 231 | 231 | |
| @@ -4093,7 +4093,7 @@ flags_complete: · 3861 unmodified lines | ||
| 4093 | 4093 | |
| 4094 | 4094 | /* Only allow ATR evict on hardware that is capable of handling it */ |
| 4095 | 4095 | if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) |
| 4096 | − pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_CAPABLE; | |
| 4096 | + pf->flags &= ~I40E_FLAG_HW_ATR_EVICT_ENABLED; | |
| 4097 | 4097 | |
| 4098 | 4098 | if (changed_flags & I40E_FLAG_TRUE_PROMISC_SUPPORT) { |
| 4099 | 4099 | u16 sw_flags = 0, valid_flags = 0; |
| @@ -8823,11 +8823,12 @@ static int i40e_sw_init(struct i40e_pf *pf) · 8822 unmodified lines | ||
| 8823 | 8823 | (pf->hw.aq.api_min_ver > 4))) { |
| 8824 | 8824 | /* Supported in FW API version higher than 1.4 */ |
| 8825 | 8825 | pf->flags |= I40E_FLAG_GENEVE_OFFLOAD_CAPABLE; |
| 8826 | − pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE; | |
| 8827 | − } else { | |
| 8828 | − pf->flags = I40E_FLAG_HW_ATR_EVICT_CAPABLE; | |
| 8829 | 8826 | } |
| 8830 | 8827 | |
| 8828 | + /* Enable HW ATR eviction if possible */ | |
| 8829 | + if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) | |
| 8830 | + pf->flags |= I40E_FLAG_HW_ATR_EVICT_ENABLED; | |
| 8831 | + | |
| 8831 | 8832 | pf->eeprom_version = 0xDEAD; |
| 8832 | 8833 | pf->lan_veb = I40E_NO_VEB; |
| 8833 | 8834 | pf->lan_vsi = I40E_NO_VSI; |
| @@ -2341,7 +2341,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 2340 unmodified lines | ||
| 2341 | 2341 | /* Due to lack of space, no more new filters can be programmed */ |
| 2342 | 2342 | if (th->syn && (pf->flags & I40E_FLAG_FD_ATR_AUTO_DISABLED)) |
| 2343 | 2343 | return; |
| 2344 | − if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) { | |
| 2344 | + if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED) { | |
| 2345 | 2345 | /* HW ATR eviction will take care of removing filters on FIN |
| 2346 | 2346 | * and RST packets. |
| 2347 | 2347 | */ |
| @@ -2403,7 +2403,7 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb, · 55 unmodified lines | ||
| 2403 | 2403 | I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) & |
| 2404 | 2404 | I40E_TXD_FLTR_QW1_CNTINDEX_MASK; |
| 2405 | 2405 | |
| 2406 | − if (pf->flags & I40E_FLAG_HW_ATR_EVICT_CAPABLE) | |
| 2406 | + if (pf->flags & I40E_FLAG_HW_ATR_EVICT_ENABLED) | |
| 2407 | 2407 | dtype_cmd |= I40E_TXD_FLTR_QW1_ATR_MASK; |
| 2408 | 2408 | |
| 2409 | 2409 | fdir_desc->qindex_flex_ptype_vsi = cpu_to_le32(flex_ptype); |
| @@ -2876,10 +2876,12 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, · 2875 unmodified lines | ||
| 2876 | 2876 | VLAN_VID_MASK)); |
| 2877 | 2877 | } |
| 2878 | 2878 | |
| 2879 | + spin_unlock_bh(&vsi->mac_filter_hash_lock); | |
| 2879 | 2880 | if (vlan_id || qos) |
| 2880 | 2881 | ret = i40e_vsi_add_pvid(vsi, vlanprio); |
| 2881 | 2882 | else |
| 2882 | 2883 | i40e_vsi_remove_pvid(vsi); |
| 2884 | + spin_lock_bh(&vsi->mac_filter_hash_lock); | |
| 2883 | 2885 | |
| 2884 | 2886 | if (vlan_id) { |
| 2885 | 2887 | dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", |
| @@ -3725,7 +3725,7 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 3724 unmodified lines | ||
| 3725 | 3725 | dma_addr_t *dma_addr, |
| 3726 | 3726 | phys_addr_t *phys_addr) |
| 3727 | 3727 | { |
| 3728 | − int cpu = smp_processor_id(); | |
| 3728 | + int cpu = get_cpu(); | |
| 3729 | 3729 | |
| 3730 | 3730 | *dma_addr = mvpp2_percpu_read(priv, cpu, |
| 3731 | 3731 | MVPP2_BM_PHY_ALLOC_REG(bm_pool->id)); |
| @@ -3746,6 +3746,8 @@ static void mvpp2_bm_bufs_get_addrs(struct device *dev, struct mvpp2 *priv, · 14 unmodified lines | ||
| 3746 | 3746 | if (sizeof(phys_addr_t) == 8) |
| 3747 | 3747 | *phys_addr |= (u64)phys_addr_highbits << 32; |
| 3748 | 3748 | } |
| 3749 | + | |
| 3750 | + put_cpu(); | |
| 3749 | 3751 | } |
| 3750 | 3752 | |
| 3751 | 3753 | /* Free all buffers from the pool */ |
| @@ -3926,18 +3928,12 @@ static inline u32 mvpp2_bm_cookie_pool_set(u32 cookie, int pool) · 174 unmodified lines | ||
| 3926 | 3928 | return bm; |
| 3927 | 3929 | } |
| 3928 | 3930 | |
| 3929 | −/* Get pool number from a BM cookie */ | |
| 3930 | −static inline int mvpp2_bm_cookie_pool_get(unsigned long cookie) | |
| 3931 | −{ | |
| 3932 | − return (cookie >> MVPP2_BM_COOKIE_POOL_OFFS) & 0xFF; | |
| 3933 | −} | |
| 3934 | − | |
| 3935 | 3931 | /* Release buffer to BM */ |
| 3936 | 3932 | static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool, |
| 3937 | 3933 | dma_addr_t buf_dma_addr, |
| 3938 | 3934 | phys_addr_t buf_phys_addr) |
| 3939 | 3935 | { |
| 3940 | − int cpu = smp_processor_id(); | |
| 3936 | + int cpu = get_cpu(); | |
| 3941 | 3937 | |
| 3942 | 3938 | if (port->priv->hw_version == MVPP22) { |
| 3943 | 3939 | u32 val = 0; |
| @@ -3964,15 +3960,15 @@ static inline void mvpp2_bm_pool_put(struct mvpp2_port *port, int pool, · 20 unmodified lines | ||
| 3964 | 3960 | MVPP2_BM_VIRT_RLS_REG, buf_phys_addr); |
| 3965 | 3961 | mvpp2_percpu_write(port->priv, cpu, |
| 3966 | 3962 | MVPP2_BM_PHY_RLS_REG(pool), buf_dma_addr); |
| 3963 | + | |
| 3964 | + put_cpu(); | |
| 3967 | 3965 | } |
| 3968 | 3966 | |
| 3969 | 3967 | /* Refill BM pool */ |
| 3970 | −static void mvpp2_pool_refill(struct mvpp2_port *port, u32 bm, | |
| 3968 | +static void mvpp2_pool_refill(struct mvpp2_port *port, int pool, | |
| 3971 | 3969 | dma_addr_t dma_addr, |
| 3972 | 3970 | phys_addr_t phys_addr) |
| 3973 | 3971 | { |
| 3974 | − int pool = mvpp2_bm_cookie_pool_get(bm); | |
| 3975 | − | |
| 3976 | 3972 | mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr); |
| 3977 | 3973 | } |
| 3978 | 3974 | |
| @@ -4192,8 +4188,6 @@ static void mvpp22_port_mii_set(struct mvpp2_port *port) · 213 unmodified lines | ||
| 4192 | 4188 | { |
| 4193 | 4189 | u32 val; |
| 4194 | 4190 | |
| 4195 | − return; | |
| 4196 | − | |
| 4197 | 4191 | /* Only GOP port 0 has an XLG MAC */ |
| 4198 | 4192 | if (port->gop_id == 0) { |
| 4199 | 4193 | val = readl(port->base + MVPP22_XLG_CTRL3_REG); |
| @@ -4548,21 +4542,6 @@ static void mvpp2_rxq_offset_set(struct mvpp2_port *port, · 348 unmodified lines | ||
| 4548 | 4542 | mvpp2_write(port->priv, MVPP2_RXQ_CONFIG_REG(prxq), val); |
| 4549 | 4543 | } |
| 4550 | 4544 | |
| 4551 | −/* Obtain BM cookie information from descriptor */ | |
| 4552 | −static u32 mvpp2_bm_cookie_build(struct mvpp2_port *port, | |
| 4553 | − struct mvpp2_rx_desc *rx_desc) | |
| 4554 | −{ | |
| 4555 | − int cpu = smp_processor_id(); | |
| 4556 | − int pool; | |
| 4557 | − | |
| 4558 | − pool = (mvpp2_rxdesc_status_get(port, rx_desc) & | |
| 4559 | − MVPP2_RXD_BM_POOL_ID_MASK) >> | |
| 4560 | − MVPP2_RXD_BM_POOL_ID_OFFS; | |
| 4561 | − | |
| 4562 | − return ((pool & 0xFF) << MVPP2_BM_COOKIE_POOL_OFFS) | | |
| 4563 | − ((cpu & 0xFF) << MVPP2_BM_COOKIE_CPU_OFFS); | |
| 4564 | −} | |
| 4565 | − | |
| 4566 | 4545 | /* Tx descriptors helper methods */ |
| 4567 | 4546 | |
| 4568 | 4547 | /* Get pointer to next Tx descriptor to be processed (send) by HW */ |
| @@ -4790,7 +4769,7 @@ static void mvpp2_txp_max_tx_size_set(struct mvpp2_port *port) · 221 unmodified lines | ||
| 4790 | 4769 | static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port, |
| 4791 | 4770 | struct mvpp2_rx_queue *rxq) |
| 4792 | 4771 | { |
| 4793 | − int cpu = smp_processor_id(); | |
| 4772 | + int cpu = get_cpu(); | |
| 4794 | 4773 | |
| 4795 | 4774 | if (rxq->pkts_coal > MVPP2_OCCUPIED_THRESH_MASK) |
| 4796 | 4775 | rxq->pkts_coal = MVPP2_OCCUPIED_THRESH_MASK; |
| @@ -4798,6 +4777,8 @@ static void mvpp2_rx_pkts_coal_set(struct mvpp2_port *port, · 1 unmodified line | ||
| 4798 | 4777 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id); |
| 4799 | 4778 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_THRESH_REG, |
| 4800 | 4779 | rxq->pkts_coal); |
| 4780 | + | |
| 4781 | + put_cpu(); | |
| 4801 | 4782 | } |
| 4802 | 4783 | |
| 4803 | 4784 | static u32 mvpp2_usec_to_cycles(u32 usec, unsigned long clk_hz) |
| @@ -4978,7 +4959,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 174 unmodified lines | ||
| 4978 | 4959 | mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0); |
| 4979 | 4960 | |
| 4980 | 4961 | /* Set Rx descriptors queue starting address - indirect access */ |
| 4981 | − cpu = smp_processor_id(); | |
| 4962 | + cpu = get_cpu(); | |
| 4982 | 4963 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id); |
| 4983 | 4964 | if (port->priv->hw_version == MVPP21) |
| 4984 | 4965 | rxq_dma = rxq->descs_dma; |
| @@ -4987,6 +4968,7 @@ static int mvpp2_rxq_init(struct mvpp2_port *port, · 2 unmodified lines | ||
| 4987 | 4968 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, rxq_dma); |
| 4988 | 4969 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, rxq->size); |
| 4989 | 4970 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_INDEX_REG, 0); |
| 4971 | + put_cpu(); | |
| 4990 | 4972 | |
| 4991 | 4973 | /* Set Offset */ |
| 4992 | 4974 | mvpp2_rxq_offset_set(port, rxq->id, NET_SKB_PAD); |
| @@ -5013,9 +4995,13 @@ static void mvpp2_rxq_drop_pkts(struct mvpp2_port *port, · 20 unmodified lines | ||
| 5013 | 4995 | |
| 5014 | 4996 | for (i = 0; i < rx_received; i++) { |
| 5015 | 4997 | struct mvpp2_rx_desc *rx_desc = mvpp2_rxq_next_desc_get(rxq); |
| 5016 | − u32 bm = mvpp2_bm_cookie_build(port, rx_desc); | |
| 4998 | + u32 status = mvpp2_rxdesc_status_get(port, rx_desc); | |
| 4999 | + int pool; | |
| 5000 | + | |
| 5001 | + pool = (status & MVPP2_RXD_BM_POOL_ID_MASK) >> | |
| 5002 | + MVPP2_RXD_BM_POOL_ID_OFFS; | |
| 5017 | 5003 | |
| 5018 | − mvpp2_pool_refill(port, bm, | |
| 5004 | + mvpp2_pool_refill(port, pool, | |
| 5019 | 5005 | mvpp2_rxdesc_dma_addr_get(port, rx_desc), |
| 5020 | 5006 | mvpp2_rxdesc_cookie_get(port, rx_desc)); |
| 5021 | 5007 | } |
| @@ -5045,10 +5031,11 @@ static void mvpp2_rxq_deinit(struct mvpp2_port *port, · 23 unmodified lines | ||
| 5045 | 5031 | * free descriptor number |
| 5046 | 5032 | */ |
| 5047 | 5033 | mvpp2_write(port->priv, MVPP2_RXQ_STATUS_REG(rxq->id), 0); |
| 5048 | − cpu = smp_processor_id(); | |
| 5034 | + cpu = get_cpu(); | |
| 5049 | 5035 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_NUM_REG, rxq->id); |
| 5050 | 5036 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_ADDR_REG, 0); |
| 5051 | 5037 | mvpp2_percpu_write(port->priv, cpu, MVPP2_RXQ_DESC_SIZE_REG, 0); |
| 5038 | + put_cpu(); | |
| 5052 | 5039 | } |
| 5053 | 5040 | |
| 5054 | 5041 | /* Create and initialize a Tx queue */ |
| @@ -5071,7 +5058,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 16 unmodified lines | ||
| 5071 | 5058 | txq->last_desc = txq->size - 1; |
| 5072 | 5059 | |
| 5073 | 5060 | /* Set Tx descriptors queue starting address - indirect access */ |
| 5074 | − cpu = smp_processor_id(); | |
| 5061 | + cpu = get_cpu(); | |
| 5075 | 5062 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id); |
| 5076 | 5063 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG, |
| 5077 | 5064 | txq->descs_dma); |
| @@ -5096,6 +5083,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, · 18 unmodified lines | ||
| 5096 | 5083 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG, |
| 5097 | 5084 | MVPP2_PREF_BUF_PTR(desc) | MVPP2_PREF_BUF_SIZE_16 | |
| 5098 | 5085 | MVPP2_PREF_BUF_THRESH(desc_per_txq / 2)); |
| 5086 | + put_cpu(); | |
| 5099 | 5087 | |
| 5100 | 5088 | /* WRR / EJP configuration - indirect access */ |
| 5101 | 5089 | tx_port_num = mvpp2_egress_port(port); |
| @@ -5166,10 +5154,11 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, · 64 unmodified lines | ||
| 5166 | 5154 | mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->id), 0); |
| 5167 | 5155 | |
| 5168 | 5156 | /* Set Tx descriptors queue starting address and size */ |
| 5169 | − cpu = smp_processor_id(); | |
| 5157 | + cpu = get_cpu(); | |
| 5170 | 5158 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id); |
| 5171 | 5159 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_ADDR_REG, 0); |
| 5172 | 5160 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_DESC_SIZE_REG, 0); |
| 5161 | + put_cpu(); | |
| 5173 | 5162 | } |
| 5174 | 5163 | |
| 5175 | 5164 | /* Cleanup Tx ports */ |
| @@ -5179,7 +5168,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 3 unmodified lines | ||
| 5179 | 5168 | int delay, pending, cpu; |
| 5180 | 5169 | u32 val; |
| 5181 | 5170 | |
| 5182 | − cpu = smp_processor_id(); | |
| 5171 | + cpu = get_cpu(); | |
| 5183 | 5172 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_NUM_REG, txq->id); |
| 5184 | 5173 | val = mvpp2_percpu_read(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG); |
| 5185 | 5174 | val |= MVPP2_TXQ_DRAIN_EN_MASK; |
| @@ -5206,6 +5195,7 @@ static void mvpp2_txq_clean(struct mvpp2_port *port, struct mvpp2_tx_queue *txq) · 20 unmodified lines | ||
| 5206 | 5195 | |
| 5207 | 5196 | val &= ~MVPP2_TXQ_DRAIN_EN_MASK; |
| 5208 | 5197 | mvpp2_percpu_write(port->priv, cpu, MVPP2_TXQ_PREF_BUF_REG, val); |
| 5198 | + put_cpu(); | |
| 5209 | 5199 | |
| 5210 | 5200 | for_each_present_cpu(cpu) { |
| 5211 | 5201 | txq_pcpu = per_cpu_ptr(txq->pcpu, cpu); |
| @@ -5453,7 +5443,7 @@ static void mvpp2_rx_csum(struct mvpp2_port *port, u32 status, · 241 unmodified lines | ||
| 5453 | 5443 | |
| 5454 | 5444 | /* Reuse skb if possible, or allocate a new skb and add it to BM pool */ |
| 5455 | 5445 | static int mvpp2_rx_refill(struct mvpp2_port *port, |
| 5456 | − struct mvpp2_bm_pool *bm_pool, u32 bm) | |
| 5446 | + struct mvpp2_bm_pool *bm_pool, int pool) | |
| 5457 | 5447 | { |
| 5458 | 5448 | dma_addr_t dma_addr; |
| 5459 | 5449 | phys_addr_t phys_addr; |
| @@ -5465,7 +5455,7 @@ static int mvpp2_rx_refill(struct mvpp2_port *port, · 5 unmodified lines | ||
| 5465 | 5455 | if (!buf) |
| 5466 | 5456 | return -ENOMEM; |
| 5467 | 5457 | |
| 5468 | − mvpp2_pool_refill(port, bm, dma_addr, phys_addr); | |
| 5458 | + mvpp2_pool_refill(port, pool, dma_addr, phys_addr); | |
| 5469 | 5459 | |
| 5470 | 5460 | return 0; |
| 5471 | 5461 | } |
| @@ -5523,7 +5513,7 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 51 unmodified lines | ||
| 5523 | 5513 | unsigned int frag_size; |
| 5524 | 5514 | dma_addr_t dma_addr; |
| 5525 | 5515 | phys_addr_t phys_addr; |
| 5526 | − u32 bm, rx_status; | |
| 5516 | + u32 rx_status; | |
| 5527 | 5517 | int pool, rx_bytes, err; |
| 5528 | 5518 | void *data; |
| 5529 | 5519 | |
| @@ -5535,8 +5525,8 @@ static int mvpp2_rx(struct mvpp2_port *port, int rx_todo, · 5 unmodified lines | ||
| 5535 | 5525 | phys_addr = mvpp2_rxdesc_cookie_get(port, rx_desc); |
| 5536 | 5526 | data = (void *)phys_to_virt(phys_addr); |
| 5537 | 5527 | |
| 5538 | − bm = mvpp2_bm_cookie_build(port, rx_desc); | |
| 5539 | − pool = mvpp2_bm_cookie_pool_get(bm); | |
| 5528 | + pool = (rx_status & MVPP2_RXD_BM_POOL_ID_MASK) >> | |
| 5529 | + MVPP2_RXD_BM_POOL_ID_OFFS; | |
| 5540 | 5530 | bm_pool = &port->priv->bm_pools[pool]; |
| 5541 | 5531 | |
| 5542 | 5532 | /* In case of an error, release the requested buffer pointer |
| @@ -5549,7 +5539,7 @@ err_drop_frame: · 6 unmodified lines | ||
| 5549 | 5539 | dev->stats.rx_errors++; |
| 5550 | 5540 | mvpp2_rx_error(port, rx_desc); |
| 5551 | 5541 | /* Return the buffer to the pool */ |
| 5552 | − mvpp2_pool_refill(port, bm, dma_addr, phys_addr); | |
| 5542 | + mvpp2_pool_refill(port, pool, dma_addr, phys_addr); | |
| 5553 | 5543 | continue; |
| 5554 | 5544 | } |
| 5555 | 5545 | |
| @@ -5564,7 +5554,7 @@ err_drop_frame: · 8 unmodified lines | ||
| 5564 | 5554 | goto err_drop_frame; |
| 5565 | 5555 | } |
| 5566 | 5556 | |
| 5567 | − err = mvpp2_rx_refill(port, bm_pool, bm); | |
| 5557 | + err = mvpp2_rx_refill(port, bm_pool, pool); | |
| 5568 | 5558 | if (err) { |
| 5569 | 5559 | netdev_err(port->dev, "failed to refill BM pools\n"); |
| 5570 | 5560 | goto err_drop_frame; |
| @@ -458,13 +458,15 @@ struct mlx5e_mpw_info { · 457 unmodified lines | ||
| 458 | 458 | |
| 459 | 459 | struct mlx5e_rx_am_stats { |
| 460 | 460 | int ppms; /* packets per msec */ |
| 461 | + int bpms; /* bytes per msec */ | |
| 461 | 462 | int epms; /* events per msec */ |
| 462 | 463 | }; |
| 463 | 464 | |
| 464 | 465 | struct mlx5e_rx_am_sample { |
| 465 | − ktime_t time; | |
| 466 | − unsigned int pkt_ctr; | |
| 467 | − u16 event_ctr; | |
| 466 | + ktime_t time; | |
| 467 | + u32 pkt_ctr; | |
| 468 | + u32 byte_ctr; | |
| 469 | + u16 event_ctr; | |
| 468 | 470 | }; |
| 469 | 471 | |
| 470 | 472 | struct mlx5e_rx_am { /* Adaptive Moderation */ |
| @@ -183,28 +183,27 @@ static void mlx5e_am_exit_parking(struct mlx5e_rx_am *am) · 182 unmodified lines | ||
| 183 | 183 | mlx5e_am_step(am); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | +#define IS_SIGNIFICANT_DIFF(val, ref) \ | |
| 187 | + (((100 * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */ | |
| 188 | + | |
| 186 | 189 | static int mlx5e_am_stats_compare(struct mlx5e_rx_am_stats *curr, |
| 187 | 190 | struct mlx5e_rx_am_stats *prev) |
| 188 | 191 | { |
| 189 | − int diff; | |
| 190 | − | |
| 191 | − if (!prev->ppms) | |
| 192 | − return curr->ppms ? MLX5E_AM_STATS_BETTER : | |
| 192 | + if (!prev->bpms) | |
| 193 | + return curr->bpms ? MLX5E_AM_STATS_BETTER : | |
| 193 | 194 | MLX5E_AM_STATS_SAME; |
| 194 | 195 | |
| 195 | − diff = curr->ppms - prev->ppms; | |
| 196 | − if (((100 * abs(diff)) / prev->ppms) > 10) /* more than 10% diff */ | |
| 197 | − return (diff > 0) ? MLX5E_AM_STATS_BETTER : | |
| 198 | − MLX5E_AM_STATS_WORSE; | |
| 196 | + if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms)) | |
| 197 | + return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER : | |
| 198 | + MLX5E_AM_STATS_WORSE; | |
| 199 | 199 | |
| 200 | − if (!prev->epms) | |
| 201 | − return curr->epms ? MLX5E_AM_STATS_WORSE : | |
| 202 | − MLX5E_AM_STATS_SAME; | |
| 200 | + if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms)) | |
| 201 | + return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER : | |
| 202 | + MLX5E_AM_STATS_WORSE; | |
| 203 | 203 | |
| 204 | − diff = curr->epms - prev->epms; | |
| 205 | − if (((100 * abs(diff)) / prev->epms) > 10) /* more than 10% diff */ | |
| 206 | − return (diff < 0) ? MLX5E_AM_STATS_BETTER : | |
| 207 | − MLX5E_AM_STATS_WORSE; | |
| 204 | + if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms)) | |
| 205 | + return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER : | |
| 206 | + MLX5E_AM_STATS_WORSE; | |
| 208 | 207 | |
| 209 | 208 | return MLX5E_AM_STATS_SAME; |
| 210 | 209 | } |
| @@ -266,10 +265,13 @@ static void mlx5e_am_sample(struct mlx5e_rq *rq, · 55 unmodified lines | ||
| 266 | 265 | { |
| 267 | 266 | s->time = ktime_get(); |
| 268 | 267 | s->pkt_ctr = rq->stats.packets; |
| 268 | + s->byte_ctr = rq->stats.bytes; | |
| 269 | 269 | s->event_ctr = rq->cq.event_ctr; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | #define MLX5E_AM_NEVENTS 64 |
| 273 | +#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) | |
| 274 | +#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1)) | |
| 273 | 275 | |
| 274 | 276 | static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start, |
| 275 | 277 | struct mlx5e_rx_am_sample *end, |
| @@ -277,13 +279,17 @@ static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start, · 1 unmodified line | ||
| 277 | 279 | { |
| 278 | 280 | /* u32 holds up to 71 minutes, should be enough */ |
| 279 | 281 | u32 delta_us = ktime_us_delta(end->time, start->time); |
| 280 | − unsigned int npkts = end->pkt_ctr - start->pkt_ctr; | |
| 282 | + u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr); | |
| 283 | + u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr, | |
| 284 | + start->byte_ctr); | |
| 281 | 285 | |
| 282 | 286 | if (!delta_us) |
| 283 | 287 | return; |
| 284 | 288 | |
| 285 | − curr_stats->ppms = (npkts * USEC_PER_MSEC) / delta_us; | |
| 286 | − curr_stats->epms = (MLX5E_AM_NEVENTS * USEC_PER_MSEC) / delta_us; | |
| 289 | + curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us); | |
| 290 | + curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us); | |
| 291 | + curr_stats->epms = DIV_ROUND_UP(MLX5E_AM_NEVENTS * USEC_PER_MSEC, | |
| 292 | + delta_us); | |
| 287 | 293 | } |
| 288 | 294 | |
| 289 | 295 | void mlx5e_rx_am_work(struct work_struct *work) |
| @@ -308,7 +314,8 @@ void mlx5e_rx_am(struct mlx5e_rq *rq) · 18 unmodified lines | ||
| 308 | 314 | |
| 309 | 315 | switch (am->state) { |
| 310 | 316 | case MLX5E_AM_MEASURE_IN_PROGRESS: |
| 311 | − nevents = rq->cq.event_ctr - am->start_sample.event_ctr; | |
| 317 | + nevents = BIT_GAP(BITS_PER_TYPE(u16), rq->cq.event_ctr, | |
| 318 | + am->start_sample.event_ctr); | |
| 312 | 319 | if (nevents < MLX5E_AM_NEVENTS) |
| 313 | 320 | break; |
| 314 | 321 | mlx5e_am_sample(rq, &end_sample); |
| @@ -417,20 +417,13 @@ struct mlx5e_stats { · 416 unmodified lines | ||
| 417 | 417 | }; |
| 418 | 418 | |
| 419 | 419 | static const struct counter_desc mlx5e_pme_status_desc[] = { |
| 420 | − { "module_plug", 0 }, | |
| 421 | 420 | { "module_unplug", 8 }, |
| 422 | 421 | }; |
| 423 | 422 | |
| 424 | 423 | static const struct counter_desc mlx5e_pme_error_desc[] = { |
| 425 | − { "module_pwr_budget_exd", 0 }, /* power budget exceed */ | |
| 426 | − { "module_long_range", 8 }, /* long range for non MLNX cable */ | |
| 427 | − { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */ | |
| 428 | − { "module_no_eeprom", 24 }, /* no eeprom/retry time out */ | |
| 429 | − { "module_enforce_part", 32 }, /* enforce part number list */ | |
| 430 | − { "module_unknown_id", 40 }, /* unknown identifier */ | |
| 431 | − { "module_high_temp", 48 }, /* high temperature */ | |
| 424 | + { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */ | |
| 425 | + { "module_high_temp", 48 }, /* high temperature */ | |
| 432 | 426 | { "module_bad_shorted", 56 }, /* bad or shorted cable/module */ |
| 433 | − { "module_unknown_status", 64 }, | |
| 434 | 427 | }; |
| 435 | 428 | |
| 436 | 429 | #endif /* __MLX5_EN_STATS_H__ */ |
| @@ -860,7 +860,7 @@ struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace · 859 unmodified lines | ||
| 860 | 860 | ft_attr.level = level; |
| 861 | 861 | ft_attr.prio = prio; |
| 862 | 862 | |
| 863 | − return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, 0); | |
| 863 | + return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, vport); | |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | struct mlx5_flow_table* |
| @@ -290,10 +290,8 @@ static void poll_health(unsigned long data) · 289 unmodified lines | ||
| 290 | 290 | struct mlx5_core_health *health = &dev->priv.health; |
| 291 | 291 | u32 count; |
| 292 | 292 | |
| 293 | − if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { | |
| 294 | − mod_timer(&health->timer, get_next_poll_jiffies()); | |
| 295 | − return; | |
| 296 | − } | |
| 293 | + if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) | |
| 294 | + goto out; | |
| 297 | 295 | |
| 298 | 296 | count = ioread32be(health->health_counter); |
| 299 | 297 | if (count == health->prev) |
| @@ -305,8 +303,6 @@ static void poll_health(unsigned long data) · 5 unmodified lines | ||
| 305 | 303 | if (health->miss_counter == MAX_MISSES) { |
| 306 | 304 | dev_err(&dev->pdev->dev, "device's health compromised - reached miss count\n"); |
| 307 | 305 | print_health_info(dev); |
| 308 | − } else { | |
| 309 | − mod_timer(&health->timer, get_next_poll_jiffies()); | |
| 310 | 306 | } |
| 311 | 307 | |
| 312 | 308 | if (in_fatal(dev) && !health->sick) { |
| @@ -314,6 +310,9 @@ static void poll_health(unsigned long data) · 1 unmodified line | ||
| 314 | 310 | print_health_info(dev); |
| 315 | 311 | mlx5_trigger_health_work(dev); |
| 316 | 312 | } |
| 313 | + | |
| 314 | +out: | |
| 315 | + mod_timer(&health->timer, get_next_poll_jiffies()); | |
| 317 | 316 | } |
| 318 | 317 | |
| 319 | 318 | void mlx5_start_health_poll(struct mlx5_core_dev *dev) |
| @@ -538,8 +538,10 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) · 537 unmodified lines | ||
| 538 | 538 | /* disable cmdif checksum */ |
| 539 | 539 | MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0); |
| 540 | 540 | |
| 541 | − /* If the HCA supports 4K UARs use it */ | |
| 542 | − if (MLX5_CAP_GEN_MAX(dev, uar_4k)) | |
| 541 | + /* Enable 4K UAR only when HCA supports it and page size is bigger | |
| 542 | + * than 4K. | |
| 543 | + */ | |
| 544 | + if (MLX5_CAP_GEN_MAX(dev, uar_4k) && PAGE_SIZE > 4096) | |
| 543 | 545 | MLX5_SET(cmd_hca_cap, set_hca_cap, uar_4k, 1); |
| 544 | 546 | |
| 545 | 547 | MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12); |
| @@ -214,13 +214,13 @@ static int dwmac4_wrback_get_tx_timestamp_status(struct dma_desc *p) · 213 unmodified lines | ||
| 214 | 214 | { |
| 215 | 215 | /* Context type from W/B descriptor must be zero */ |
| 216 | 216 | if (le32_to_cpu(p->des3) & TDES3_CONTEXT_TYPE) |
| 217 | − return -EINVAL; | |
| 217 | + return 0; | |
| 218 | 218 | |
| 219 | 219 | /* Tx Timestamp Status is 1 so des0 and des1'll have valid values */ |
| 220 | 220 | if (le32_to_cpu(p->des3) & TDES3_TIMESTAMP_STATUS) |
| 221 | − return 0; | |
| 221 | + return 1; | |
| 222 | 222 | |
| 223 | − return 1; | |
| 223 | + return 0; | |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | static inline u64 dwmac4_get_timestamp(void *desc, u32 ats) |
| @@ -282,7 +282,10 @@ static int dwmac4_wrback_get_rx_timestamp_status(void *desc, u32 ats) · 55 unmodified lines | ||
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | exit: |
| 285 | − return ret; | |
| 285 | + if (likely(ret == 0)) | |
| 286 | + return 1; | |
| 287 | + | |
| 288 | + return 0; | |
| 286 | 289 | } |
| 287 | 290 | |
| 288 | 291 | static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic, |
| @@ -445,14 +445,14 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv, · 444 unmodified lines | ||
| 445 | 445 | return; |
| 446 | 446 | |
| 447 | 447 | /* check tx tstamp status */ |
| 448 | − if (!priv->hw->desc->get_tx_timestamp_status(p)) { | |
| 448 | + if (priv->hw->desc->get_tx_timestamp_status(p)) { | |
| 449 | 449 | /* get the valid tstamp */ |
| 450 | 450 | ns = priv->hw->desc->get_timestamp(p, priv->adv_ts); |
| 451 | 451 | |
| 452 | 452 | memset(&shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps)); |
| 453 | 453 | shhwtstamp.hwtstamp = ns_to_ktime(ns); |
| 454 | 454 | |
| 455 | − netdev_info(priv->dev, "get valid TX hw timestamp %llu\n", ns); | |
| 455 | + netdev_dbg(priv->dev, "get valid TX hw timestamp %llu\n", ns); | |
| 456 | 456 | /* pass tstamp to stack */ |
| 457 | 457 | skb_tstamp_tx(skb, &shhwtstamp); |
| 458 | 458 | } |
| @@ -479,19 +479,19 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, · 20 unmodified lines | ||
| 479 | 479 | return; |
| 480 | 480 | |
| 481 | 481 | /* Check if timestamp is available */ |
| 482 | − if (!priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) { | |
| 482 | + if (priv->hw->desc->get_rx_timestamp_status(p, priv->adv_ts)) { | |
| 483 | 483 | /* For GMAC4, the valid timestamp is from CTX next desc. */ |
| 484 | 484 | if (priv->plat->has_gmac4) |
| 485 | 485 | ns = priv->hw->desc->get_timestamp(np, priv->adv_ts); |
| 486 | 486 | else |
| 487 | 487 | ns = priv->hw->desc->get_timestamp(p, priv->adv_ts); |
| 488 | 488 | |
| 489 | − netdev_info(priv->dev, "get valid RX hw timestamp %llu\n", ns); | |
| 489 | + netdev_dbg(priv->dev, "get valid RX hw timestamp %llu\n", ns); | |
| 490 | 490 | shhwtstamp = skb_hwtstamps(skb); |
| 491 | 491 | memset(shhwtstamp, 0, sizeof(struct skb_shared_hwtstamps)); |
| 492 | 492 | shhwtstamp->hwtstamp = ns_to_ktime(ns); |
| 493 | 493 | } else { |
| 494 | − netdev_err(priv->dev, "cannot get RX hw timestamp\n"); | |
| 494 | + netdev_dbg(priv->dev, "cannot get RX hw timestamp\n"); | |
| 495 | 495 | } |
| 496 | 496 | } |
| 497 | 497 | |
| @@ -557,7 +557,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 59 unmodified lines | ||
| 557 | 557 | /* PTP v1, UDP, any kind of event packet */ |
| 558 | 558 | config.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; |
| 559 | 559 | /* take time stamp for all event messages */ |
| 560 | − snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 560 | + if (priv->plat->has_gmac4) | |
| 561 | + snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1; | |
| 562 | + else | |
| 563 | + snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 561 | 564 | |
| 562 | 565 | ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; |
| 563 | 566 | ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; |
| @@ -589,7 +592,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 25 unmodified lines | ||
| 589 | 592 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; |
| 590 | 593 | ptp_v2 = PTP_TCR_TSVER2ENA; |
| 591 | 594 | /* take time stamp for all event messages */ |
| 592 | − snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 595 | + if (priv->plat->has_gmac4) | |
| 596 | + snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1; | |
| 597 | + else | |
| 598 | + snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 593 | 599 | |
| 594 | 600 | ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; |
| 595 | 601 | ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; |
| @@ -623,7 +629,10 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) · 27 unmodified lines | ||
| 623 | 629 | config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; |
| 624 | 630 | ptp_v2 = PTP_TCR_TSVER2ENA; |
| 625 | 631 | /* take time stamp for all event messages */ |
| 626 | − snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 632 | + if (priv->plat->has_gmac4) | |
| 633 | + snap_type_sel = PTP_GMAC4_TCR_SNAPTYPSEL_1; | |
| 634 | + else | |
| 635 | + snap_type_sel = PTP_TCR_SNAPTYPSEL_1; | |
| 627 | 636 | |
| 628 | 637 | ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; |
| 629 | 638 | ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; |
| @@ -59,7 +59,8 @@ · 58 unmodified lines | ||
| 59 | 59 | /* Enable Snapshot for Messages Relevant to Master */ |
| 60 | 60 | #define PTP_TCR_TSMSTRENA BIT(15) |
| 61 | 61 | /* Select PTP packets for Taking Snapshots */ |
| 62 | −#define PTP_TCR_SNAPTYPSEL_1 GENMASK(17, 16) | |
| 62 | +#define PTP_TCR_SNAPTYPSEL_1 BIT(16) | |
| 63 | +#define PTP_GMAC4_TCR_SNAPTYPSEL_1 GENMASK(17, 16) | |
| 63 | 64 | /* Enable MAC address for PTP Frame Filtering */ |
| 64 | 65 | #define PTP_TCR_TSENMACADDR BIT(18) |
| 65 | 66 | |
| @@ -1019,7 +1019,7 @@ static void geneve_setup(struct net_device *dev) · 1018 unmodified lines | ||
| 1019 | 1019 | |
| 1020 | 1020 | dev->netdev_ops = &geneve_netdev_ops; |
| 1021 | 1021 | dev->ethtool_ops = &geneve_ethtool_ops; |
| 1022 | − dev->destructor = free_netdev; | |
| 1022 | + dev->needs_free_netdev = true; | |
| 1023 | 1023 | |
| 1024 | 1024 | SET_NETDEV_DEVTYPE(dev, &geneve_type); |
| 1025 | 1025 | |
| @@ -611,7 +611,7 @@ static const struct net_device_ops gtp_netdev_ops = { · 610 unmodified lines | ||
| 611 | 611 | static void gtp_link_setup(struct net_device *dev) |
| 612 | 612 | { |
| 613 | 613 | dev->netdev_ops = >p_netdev_ops; |
| 614 | − dev->destructor = free_netdev; | |
| 614 | + dev->needs_free_netdev = true; | |
| 615 | 615 | |
| 616 | 616 | dev->hard_header_len = 0; |
| 617 | 617 | dev->addr_len = 0; |
| @@ -311,7 +311,7 @@ static void sp_setup(struct net_device *dev) · 310 unmodified lines | ||
| 311 | 311 | { |
| 312 | 312 | /* Finish setting up the DEVICE info. */ |
| 313 | 313 | dev->netdev_ops = &sp_netdev_ops; |
| 314 | − dev->destructor = free_netdev; | |
| 314 | + dev->needs_free_netdev = true; | |
| 315 | 315 | dev->mtu = SIXP_MTU; |
| 316 | 316 | dev->hard_header_len = AX25_MAX_HEADER_LEN; |
| 317 | 317 | dev->header_ops = &ax25_header_ops; |
| @@ -476,7 +476,7 @@ static const struct net_device_ops bpq_netdev_ops = { · 475 unmodified lines | ||
| 476 | 476 | static void bpq_setup(struct net_device *dev) |
| 477 | 477 | { |
| 478 | 478 | dev->netdev_ops = &bpq_netdev_ops; |
| 479 | − dev->destructor = free_netdev; | |
| 479 | + dev->needs_free_netdev = true; | |
| 480 | 480 | |
| 481 | 481 | memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN); |
| 482 | 482 | memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); |
| @@ -171,6 +171,8 @@ struct rndis_device { · 170 unmodified lines | ||
| 171 | 171 | spinlock_t request_lock; |
| 172 | 172 | struct list_head req_list; |
| 173 | 173 | |
| 174 | + struct work_struct mcast_work; | |
| 175 | + | |
| 174 | 176 | u8 hw_mac_adr[ETH_ALEN]; |
| 175 | 177 | u8 rss_key[NETVSC_HASH_KEYLEN]; |
| 176 | 178 | u16 ind_table[ITAB_NUM]; |
| @@ -201,6 +203,7 @@ int rndis_filter_open(struct netvsc_device *nvdev); · 24 unmodified lines | ||
| 201 | 203 | int rndis_filter_close(struct netvsc_device *nvdev); |
| 202 | 204 | int rndis_filter_device_add(struct hv_device *dev, |
| 203 | 205 | struct netvsc_device_info *info); |
| 206 | +void rndis_filter_update(struct netvsc_device *nvdev); | |
| 204 | 207 | void rndis_filter_device_remove(struct hv_device *dev, |
| 205 | 208 | struct netvsc_device *nvdev); |
| 206 | 209 | int rndis_filter_set_rss_param(struct rndis_device *rdev, |
| @@ -211,7 +214,6 @@ int rndis_filter_receive(struct net_device *ndev, · 4 unmodified lines | ||
| 211 | 214 | struct vmbus_channel *channel, |
| 212 | 215 | void *data, u32 buflen); |
| 213 | 216 | |
| 214 | −int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter); | |
| 215 | 217 | int rndis_filter_set_device_mac(struct net_device *ndev, char *mac); |
| 216 | 218 | |
| 217 | 219 | void netvsc_switch_datapath(struct net_device *nv_dev, bool vf); |
| @@ -696,7 +698,6 @@ struct net_device_context { · 478 unmodified lines | ||
| 696 | 698 | /* list protection */ |
| 697 | 699 | spinlock_t lock; |
| 698 | 700 | |
| 699 | − struct work_struct work; | |
| 700 | 701 | u32 msg_enable; /* debug level */ |
| 701 | 702 | |
| 702 | 703 | u32 tx_checksum_mask; |
| @@ -58,37 +58,12 @@ static int debug = -1; · 57 unmodified lines | ||
| 58 | 58 | module_param(debug, int, S_IRUGO); |
| 59 | 59 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
| 60 | 60 | |
| 61 | −static void do_set_multicast(struct work_struct *w) | |
| 62 | −{ | |
| 63 | − struct net_device_context *ndevctx = | |
| 64 | − container_of(w, struct net_device_context, work); | |
| 65 | − struct hv_device *device_obj = ndevctx->device_ctx; | |
| 66 | − struct net_device *ndev = hv_get_drvdata(device_obj); | |
| 67 | − struct netvsc_device *nvdev = rcu_dereference(ndevctx->nvdev); | |
| 68 | − struct rndis_device *rdev; | |
| 69 | − | |
| 70 | − if (!nvdev) | |
| 71 | − return; | |
| 72 | − | |
| 73 | − rdev = nvdev->extension; | |
| 74 | − if (rdev == NULL) | |
| 75 | − return; | |
| 76 | − | |
| 77 | − if (ndev->flags & IFF_PROMISC) | |
| 78 | − rndis_filter_set_packet_filter(rdev, | |
| 79 | − NDIS_PACKET_TYPE_PROMISCUOUS); | |
| 80 | − else | |
| 81 | − rndis_filter_set_packet_filter(rdev, | |
| 82 | − NDIS_PACKET_TYPE_BROADCAST | | |
| 83 | − NDIS_PACKET_TYPE_ALL_MULTICAST | | |
| 84 | − NDIS_PACKET_TYPE_DIRECTED); | |
| 85 | −} | |
| 86 | − | |
| 87 | 61 | static void netvsc_set_multicast_list(struct net_device *net) |
| 88 | 62 | { |
| 89 | 63 | struct net_device_context *net_device_ctx = netdev_priv(net); |
| 64 | + struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev); | |
| 90 | 65 | |
| 91 | − schedule_work(&net_device_ctx->work); | |
| 66 | + rndis_filter_update(nvdev); | |
| 92 | 67 | } |
| 93 | 68 | |
| 94 | 69 | static int netvsc_open(struct net_device *net) |
| @@ -125,8 +100,6 @@ static int netvsc_close(struct net_device *net) · 30 unmodified lines | ||
| 125 | 100 | |
| 126 | 101 | netif_tx_disable(net); |
| 127 | 102 | |
| 128 | − /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */ | |
| 129 | − cancel_work_sync(&net_device_ctx->work); | |
| 130 | 103 | ret = rndis_filter_close(nvdev); |
| 131 | 104 | if (ret != 0) { |
| 132 | 105 | netdev_err(net, "unable to close device (ret %d).\n", ret); |
| @@ -1003,7 +976,7 @@ static const struct { · 870 unmodified lines | ||
| 1003 | 976 | static int netvsc_get_sset_count(struct net_device *dev, int string_set) |
| 1004 | 977 | { |
| 1005 | 978 | struct net_device_context *ndc = netdev_priv(dev); |
| 1006 | − struct netvsc_device *nvdev = rcu_dereference(ndc->nvdev); | |
| 979 | + struct netvsc_device *nvdev = rtnl_dereference(ndc->nvdev); | |
| 1007 | 980 | |
| 1008 | 981 | if (!nvdev) |
| 1009 | 982 | return -ENODEV; |
| @@ -1133,11 +1106,22 @@ netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, · 123 unmodified lines | ||
| 1133 | 1106 | } |
| 1134 | 1107 | |
| 1135 | 1108 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 1136 | −static void netvsc_poll_controller(struct net_device *net) | |
| 1109 | +static void netvsc_poll_controller(struct net_device *dev) | |
| 1137 | 1110 | { |
| 1138 | − /* As netvsc_start_xmit() works synchronous we don't have to | |
| 1139 | − * trigger anything here. | |
| 1140 | − */ | |
| 1111 | + struct net_device_context *ndc = netdev_priv(dev); | |
| 1112 | + struct netvsc_device *ndev; | |
| 1113 | + int i; | |
| 1114 | + | |
| 1115 | + rcu_read_lock(); | |
| 1116 | + ndev = rcu_dereference(ndc->nvdev); | |
| 1117 | + if (ndev) { | |
| 1118 | + for (i = 0; i < ndev->num_chn; i++) { | |
| 1119 | + struct netvsc_channel *nvchan = &ndev->chan_table[i]; | |
| 1120 | + | |
| 1121 | + napi_schedule(&nvchan->napi); | |
| 1122 | + } | |
| 1123 | + } | |
| 1124 | + rcu_read_unlock(); | |
| 1141 | 1125 | } |
| 1142 | 1126 | #endif |
| 1143 | 1127 | |
| @@ -1527,7 +1511,6 @@ static int netvsc_probe(struct hv_device *dev, · 383 unmodified lines | ||
| 1527 | 1511 | hv_set_drvdata(dev, net); |
| 1528 | 1512 | |
| 1529 | 1513 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_link_change); |
| 1530 | − INIT_WORK(&net_device_ctx->work, do_set_multicast); | |
| 1531 | 1514 | |
| 1532 | 1515 | spin_lock_init(&net_device_ctx->lock); |
| 1533 | 1516 | INIT_LIST_HEAD(&net_device_ctx->reconfig_events); |
| @@ -1597,7 +1580,6 @@ static int netvsc_remove(struct hv_device *dev) · 63 unmodified lines | ||
| 1597 | 1580 | netif_device_detach(net); |
| 1598 | 1581 | |
| 1599 | 1582 | cancel_delayed_work_sync(&ndev_ctx->dwork); |
| 1600 | − cancel_work_sync(&ndev_ctx->work); | |
| 1601 | 1583 | |
| 1602 | 1584 | /* |
| 1603 | 1585 | * Call to the vsc driver to let it know that the device is being |
| @@ -31,6 +31,7 @@ · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | #include "hyperv_net.h" |
| 33 | 33 | |
| 34 | +static void rndis_set_multicast(struct work_struct *w); | |
| 34 | 35 | |
| 35 | 36 | #define RNDIS_EXT_LEN PAGE_SIZE |
| 36 | 37 | struct rndis_request { |
| @@ -76,6 +77,7 @@ static struct rndis_device *get_rndis_device(void) · 39 unmodified lines | ||
| 76 | 77 | spin_lock_init(&device->request_lock); |
| 77 | 78 | |
| 78 | 79 | INIT_LIST_HEAD(&device->req_list); |
| 80 | + INIT_WORK(&device->mcast_work, rndis_set_multicast); | |
| 79 | 81 | |
| 80 | 82 | device->state = RNDIS_DEV_UNINITIALIZED; |
| 81 | 83 | |
| @@ -815,7 +817,8 @@ static int rndis_filter_query_link_speed(struct rndis_device *dev) · 733 unmodified lines | ||
| 815 | 817 | return ret; |
| 816 | 818 | } |
| 817 | 819 | |
| 818 | −int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter) | |
| 820 | +static int rndis_filter_set_packet_filter(struct rndis_device *dev, | |
| 821 | + u32 new_filter) | |
| 819 | 822 | { |
| 820 | 823 | struct rndis_request *request; |
| 821 | 824 | struct rndis_set_request *set; |
| @@ -846,6 +849,28 @@ int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter) · 24 unmodified lines | ||
| 846 | 849 | return ret; |
| 847 | 850 | } |
| 848 | 851 | |
| 852 | +static void rndis_set_multicast(struct work_struct *w) | |
| 853 | +{ | |
| 854 | + struct rndis_device *rdev | |
| 855 | + = container_of(w, struct rndis_device, mcast_work); | |
| 856 | + | |
| 857 | + if (rdev->ndev->flags & IFF_PROMISC) | |
| 858 | + rndis_filter_set_packet_filter(rdev, | |
| 859 | + NDIS_PACKET_TYPE_PROMISCUOUS); | |
| 860 | + else | |
| 861 | + rndis_filter_set_packet_filter(rdev, | |
| 862 | + NDIS_PACKET_TYPE_BROADCAST | | |
| 863 | + NDIS_PACKET_TYPE_ALL_MULTICAST | | |
| 864 | + NDIS_PACKET_TYPE_DIRECTED); | |
| 865 | +} | |
| 866 | + | |
| 867 | +void rndis_filter_update(struct netvsc_device *nvdev) | |
| 868 | +{ | |
| 869 | + struct rndis_device *rdev = nvdev->extension; | |
| 870 | + | |
| 871 | + schedule_work(&rdev->mcast_work); | |
| 872 | +} | |
| 873 | + | |
| 849 | 874 | static int rndis_filter_init_device(struct rndis_device *dev) |
| 850 | 875 | { |
| 851 | 876 | struct rndis_request *request; |
| @@ -973,6 +998,9 @@ static int rndis_filter_close_device(struct rndis_device *dev) · 121 unmodified lines | ||
| 973 | 998 | if (dev->state != RNDIS_DEV_DATAINITIALIZED) |
| 974 | 999 | return 0; |
| 975 | 1000 | |
| 1001 | + /* Make sure rndis_set_multicast doesn't re-enable filter! */ | |
| 1002 | + cancel_work_sync(&dev->mcast_work); | |
| 1003 | + | |
| 976 | 1004 | ret = rndis_filter_set_packet_filter(dev, 0); |
| 977 | 1005 | if (ret == -ENODEV) |
| 978 | 1006 | ret = 0; |
| @@ -207,7 +207,6 @@ static void ifb_dev_free(struct net_device *dev) · 206 unmodified lines | ||
| 207 | 207 | __skb_queue_purge(&txp->tq); |
| 208 | 208 | } |
| 209 | 209 | kfree(dp->tx_private); |
| 210 | − free_netdev(dev); | |
| 211 | 210 | } |
| 212 | 211 | |
| 213 | 212 | static void ifb_setup(struct net_device *dev) |
| @@ -230,7 +229,8 @@ static void ifb_setup(struct net_device *dev) · 16 unmodified lines | ||
| 230 | 229 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| 231 | 230 | netif_keep_dst(dev); |
| 232 | 231 | eth_hw_addr_random(dev); |
| 233 | − dev->destructor = ifb_dev_free; | |
| 232 | + dev->needs_free_netdev = true; | |
| 233 | + dev->priv_destructor = ifb_dev_free; | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) |
| @@ -632,7 +632,7 @@ void ipvlan_link_setup(struct net_device *dev) · 631 unmodified lines | ||
| 632 | 632 | dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); |
| 633 | 633 | dev->priv_flags |= IFF_UNICAST_FLT | IFF_NO_QUEUE; |
| 634 | 634 | dev->netdev_ops = &ipvlan_netdev_ops; |
| 635 | − dev->destructor = free_netdev; | |
| 635 | + dev->needs_free_netdev = true; | |
| 636 | 636 | dev->header_ops = &ipvlan_header_ops; |
| 637 | 637 | dev->ethtool_ops = &ipvlan_ethtool_ops; |
| 638 | 638 | } |
| @@ -159,7 +159,6 @@ static void loopback_dev_free(struct net_device *dev) · 158 unmodified lines | ||
| 159 | 159 | { |
| 160 | 160 | dev_net(dev)->loopback_dev = NULL; |
| 161 | 161 | free_percpu(dev->lstats); |
| 162 | − free_netdev(dev); | |
| 163 | 162 | } |
| 164 | 163 | |
| 165 | 164 | static const struct net_device_ops loopback_ops = { |
| @@ -196,7 +195,8 @@ static void loopback_setup(struct net_device *dev) · 30 unmodified lines | ||
| 196 | 195 | dev->ethtool_ops = &loopback_ethtool_ops; |
| 197 | 196 | dev->header_ops = ð_header_ops; |
| 198 | 197 | dev->netdev_ops = &loopback_ops; |
| 199 | − dev->destructor = loopback_dev_free; | |
| 198 | + dev->needs_free_netdev = true; | |
| 199 | + dev->priv_destructor = loopback_dev_free; | |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /* Setup and register the loopback device. */ |
| @@ -2996,7 +2996,6 @@ static void macsec_free_netdev(struct net_device *dev) · 2995 unmodified lines | ||
| 2996 | 2996 | free_percpu(macsec->secy.tx_sc.stats); |
| 2997 | 2997 | |
| 2998 | 2998 | dev_put(real_dev); |
| 2999 | − free_netdev(dev); | |
| 3000 | 2999 | } |
| 3001 | 3000 | |
| 3002 | 3001 | static void macsec_setup(struct net_device *dev) |
| @@ -3006,7 +3005,8 @@ static void macsec_setup(struct net_device *dev) · 3 unmodified lines | ||
| 3006 | 3005 | dev->max_mtu = ETH_MAX_MTU; |
| 3007 | 3006 | dev->priv_flags |= IFF_NO_QUEUE; |
| 3008 | 3007 | dev->netdev_ops = &macsec_netdev_ops; |
| 3009 | − dev->destructor = macsec_free_netdev; | |
| 3008 | + dev->needs_free_netdev = true; | |
| 3009 | + dev->priv_destructor = macsec_free_netdev; | |
| 3010 | 3010 | SET_NETDEV_DEVTYPE(dev, &macsec_type); |
| 3011 | 3011 | |
| 3012 | 3012 | eth_zero_addr(dev->broadcast); |
| @@ -1090,7 +1090,7 @@ void macvlan_common_setup(struct net_device *dev) · 1089 unmodified lines | ||
| 1090 | 1090 | netif_keep_dst(dev); |
| 1091 | 1091 | dev->priv_flags |= IFF_UNICAST_FLT; |
| 1092 | 1092 | dev->netdev_ops = &macvlan_netdev_ops; |
| 1093 | − dev->destructor = free_netdev; | |
| 1093 | + dev->needs_free_netdev = true; | |
| 1094 | 1094 | dev->header_ops = &macvlan_hard_header_ops; |
| 1095 | 1095 | dev->ethtool_ops = &macvlan_ethtool_ops; |
| 1096 | 1096 | } |
| @@ -358,7 +358,7 @@ static ssize_t enabled_store(struct config_item *item, · 357 unmodified lines | ||
| 358 | 358 | if (err) |
| 359 | 359 | goto out_unlock; |
| 360 | 360 | |
| 361 | − pr_info("netconsole: network logging started\n"); | |
| 361 | + pr_info("network logging started\n"); | |
| 362 | 362 | } else { /* false */ |
| 363 | 363 | /* We need to disable the netconsole before cleaning it up |
| 364 | 364 | * otherwise we might end up in write_msg() with |
| @@ -113,7 +113,7 @@ static void nlmon_setup(struct net_device *dev) · 112 unmodified lines | ||
| 113 | 113 | |
| 114 | 114 | dev->netdev_ops = &nlmon_ops; |
| 115 | 115 | dev->ethtool_ops = &nlmon_ethtool_ops; |
| 116 | − dev->destructor = free_netdev; | |
| 116 | + dev->needs_free_netdev = true; | |
| 117 | 117 | |
| 118 | 118 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | |
| 119 | 119 | NETIF_F_HIGHDMA | NETIF_F_LLTX; |
| @@ -127,6 +127,7 @@ config MDIO_THUNDER · 126 unmodified lines | ||
| 127 | 127 | tristate "ThunderX SOCs MDIO buses" |
| 128 | 128 | depends on 64BIT |
| 129 | 129 | depends on PCI |
| 130 | + depends on !(MDIO_DEVICE=y && PHYLIB=m) | |
| 130 | 131 | select MDIO_CAVIUM |
| 131 | 132 | help |
| 132 | 133 | This driver supports the MDIO interfaces found on Cavium |
| @@ -54,6 +54,8 @@ static const char *phy_speed_to_str(int speed) · 53 unmodified lines | ||
| 54 | 54 | return "5Gbps"; |
| 55 | 55 | case SPEED_10000: |
| 56 | 56 | return "10Gbps"; |
| 57 | + case SPEED_14000: | |
| 58 | + return "14Gbps"; | |
| 57 | 59 | case SPEED_20000: |
| 58 | 60 | return "20Gbps"; |
| 59 | 61 | case SPEED_25000: |
| @@ -629,7 +629,7 @@ static void sl_uninit(struct net_device *dev) · 628 unmodified lines | ||
| 629 | 629 | static void sl_free_netdev(struct net_device *dev) |
| 630 | 630 | { |
| 631 | 631 | int i = dev->base_addr; |
| 632 | − free_netdev(dev); | |
| 632 | + | |
| 633 | 633 | slip_devs[i] = NULL; |
| 634 | 634 | } |
| 635 | 635 | |
| @@ -651,7 +651,8 @@ static const struct net_device_ops sl_netdev_ops = { · 15 unmodified lines | ||
| 651 | 651 | static void sl_setup(struct net_device *dev) |
| 652 | 652 | { |
| 653 | 653 | dev->netdev_ops = &sl_netdev_ops; |
| 654 | − dev->destructor = sl_free_netdev; | |
| 654 | + dev->needs_free_netdev = true; | |
| 655 | + dev->priv_destructor = sl_free_netdev; | |
| 655 | 656 | |
| 656 | 657 | dev->hard_header_len = 0; |
| 657 | 658 | dev->addr_len = 0; |
| @@ -1369,8 +1370,6 @@ static void __exit slip_exit(void) · 711 unmodified lines | ||
| 1369 | 1370 | if (sl->tty) { |
| 1370 | 1371 | printk(KERN_ERR "%s: tty discipline still running\n", |
| 1371 | 1372 | dev->name); |
| 1372 | − /* Intentionally leak the control block. */ | |
| 1373 | − dev->destructor = NULL; | |
| 1374 | 1373 | } |
| 1375 | 1374 | |
| 1376 | 1375 | unregister_netdev(dev); |
| @@ -1643,7 +1643,6 @@ static void team_destructor(struct net_device *dev) · 1642 unmodified lines | ||
| 1643 | 1643 | struct team *team = netdev_priv(dev); |
| 1644 | 1644 | |
| 1645 | 1645 | free_percpu(team->pcpu_stats); |
| 1646 | − free_netdev(dev); | |
| 1647 | 1646 | } |
| 1648 | 1647 | |
| 1649 | 1648 | static int team_open(struct net_device *dev) |
| @@ -2073,7 +2072,8 @@ static void team_setup(struct net_device *dev) · 423 unmodified lines | ||
| 2073 | 2072 | |
| 2074 | 2073 | dev->netdev_ops = &team_netdev_ops; |
| 2075 | 2074 | dev->ethtool_ops = &team_ethtool_ops; |
| 2076 | − dev->destructor = team_destructor; | |
| 2075 | + dev->needs_free_netdev = true; | |
| 2076 | + dev->priv_destructor = team_destructor; | |
| 2077 | 2077 | dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); |
| 2078 | 2078 | dev->priv_flags |= IFF_NO_QUEUE; |
| 2079 | 2079 | dev->priv_flags |= IFF_TEAM; |
| @@ -1561,7 +1561,6 @@ static void tun_free_netdev(struct net_device *dev) · 1560 unmodified lines | ||
| 1561 | 1561 | free_percpu(tun->pcpu_stats); |
| 1562 | 1562 | tun_flow_uninit(tun); |
| 1563 | 1563 | security_tun_dev_free_security(tun->security); |
| 1564 | − free_netdev(dev); | |
| 1565 | 1564 | } |
| 1566 | 1565 | |
| 1567 | 1566 | static void tun_setup(struct net_device *dev) |
| @@ -1572,7 +1571,8 @@ static void tun_setup(struct net_device *dev) · 4 unmodified lines | ||
| 1572 | 1571 | tun->group = INVALID_GID; |
| 1573 | 1572 | |
| 1574 | 1573 | dev->ethtool_ops = &tun_ethtool_ops; |
| 1575 | − dev->destructor = tun_free_netdev; | |
| 1574 | + dev->needs_free_netdev = true; | |
| 1575 | + dev->priv_destructor = tun_free_netdev; | |
| 1576 | 1576 | /* We prefer our own queue length */ |
| 1577 | 1577 | dev->tx_queue_len = TUN_READQ_SIZE; |
| 1578 | 1578 | } |
| @@ -298,7 +298,7 @@ static void usbpn_setup(struct net_device *dev) · 297 unmodified lines | ||
| 298 | 298 | dev->addr_len = 1; |
| 299 | 299 | dev->tx_queue_len = 3; |
| 300 | 300 | |
| 301 | − dev->destructor = free_netdev; | |
| 301 | + dev->needs_free_netdev = true; | |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /* |
| @@ -123,7 +123,7 @@ static void qmimux_setup(struct net_device *dev) · 122 unmodified lines | ||
| 123 | 123 | dev->addr_len = 0; |
| 124 | 124 | dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; |
| 125 | 125 | dev->netdev_ops = &qmimux_netdev_ops; |
| 126 | − dev->destructor = free_netdev; | |
| 126 | + dev->needs_free_netdev = true; | |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | static struct net_device *qmimux_find_dev(struct usbnet *dev, u8 mux_id) |
| @@ -1192,6 +1192,8 @@ static const struct usb_device_id products[] = { · 1062 unmodified lines | ||
| 1192 | 1192 | {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */ |
| 1193 | 1193 | {QMI_FIXED_INTF(0x1199, 0x9057, 8)}, |
| 1194 | 1194 | {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */ |
| 1195 | + {QMI_FIXED_INTF(0x1199, 0x9063, 8)}, /* Sierra Wireless EM7305 */ | |
| 1196 | + {QMI_FIXED_INTF(0x1199, 0x9063, 10)}, /* Sierra Wireless EM7305 */ | |
| 1195 | 1197 | {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */ |
| 1196 | 1198 | {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */ |
| 1197 | 1199 | {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */ |
| @@ -1206,6 +1208,8 @@ static const struct usb_device_id products[] = { · 8 unmodified lines | ||
| 1206 | 1208 | {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ |
| 1207 | 1209 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
| 1208 | 1210 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1201, 2)}, /* Telit LE920, LE920A4 */ |
| 1211 | + {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */ | |
| 1212 | + {QMI_FIXED_INTF(0x1c9e, 0x9803, 4)}, /* Telewell TW-3G HSPA+ */ | |
| 1209 | 1213 | {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */ |
| 1210 | 1214 | {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */ |
| 1211 | 1215 | {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */ |
| @@ -4454,6 +4454,8 @@ static u8 rtl_get_version(struct usb_interface *intf) · 4453 unmodified lines | ||
| 4454 | 4454 | break; |
| 4455 | 4455 | } |
| 4456 | 4456 | |
| 4457 | + dev_dbg(&intf->dev, "Detected version 0x%04x\n", version); | |
| 4458 | + | |
| 4457 | 4459 | return version; |
| 4458 | 4460 | } |
| 4459 | 4461 | |
| @@ -222,7 +222,6 @@ static int veth_dev_init(struct net_device *dev) · 221 unmodified lines | ||
| 222 | 222 | static void veth_dev_free(struct net_device *dev) |
| 223 | 223 | { |
| 224 | 224 | free_percpu(dev->vstats); |
| 225 | − free_netdev(dev); | |
| 226 | 225 | } |
| 227 | 226 | |
| 228 | 227 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| @@ -317,7 +316,8 @@ static void veth_setup(struct net_device *dev) · 88 unmodified lines | ||
| 317 | 316 | NETIF_F_HW_VLAN_STAG_TX | |
| 318 | 317 | NETIF_F_HW_VLAN_CTAG_RX | |
| 319 | 318 | NETIF_F_HW_VLAN_STAG_RX); |
| 320 | − dev->destructor = veth_dev_free; | |
| 319 | + dev->needs_free_netdev = true; | |
| 320 | + dev->priv_destructor = veth_dev_free; | |
| 321 | 321 | dev->max_mtu = ETH_MAX_MTU; |
| 322 | 322 | |
| 323 | 323 | dev->hw_features = VETH_FEATURES; |
| @@ -36,12 +36,14 @@ · 35 unmodified lines | ||
| 36 | 36 | #include <net/addrconf.h> |
| 37 | 37 | #include <net/l3mdev.h> |
| 38 | 38 | #include <net/fib_rules.h> |
| 39 | +#include <net/netns/generic.h> | |
| 39 | 40 | |
| 40 | 41 | #define DRV_NAME "vrf" |
| 41 | 42 | #define DRV_VERSION "1.0" |
| 42 | 43 | |
| 43 | 44 | #define FIB_RULE_PREF 1000 /* default preference for FIB rules */ |
| 44 | −static bool add_fib_rules = true; | |
| 45 | + | |
| 46 | +static unsigned int vrf_net_id; | |
| 45 | 47 | |
| 46 | 48 | struct net_vrf { |
| 47 | 49 | struct rtable __rcu *rth; |
| @@ -1348,7 +1350,7 @@ static void vrf_setup(struct net_device *dev) · 1300 unmodified lines | ||
| 1348 | 1350 | dev->netdev_ops = &vrf_netdev_ops; |
| 1349 | 1351 | dev->l3mdev_ops = &vrf_l3mdev_ops; |
| 1350 | 1352 | dev->ethtool_ops = &vrf_ethtool_ops; |
| 1351 | − dev->destructor = free_netdev; | |
| 1353 | + dev->needs_free_netdev = true; | |
| 1352 | 1354 | |
| 1353 | 1355 | /* Fill in device structure with ethernet-generic values. */ |
| 1354 | 1356 | eth_hw_addr_random(dev); |
| @@ -1394,6 +1396,8 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 39 unmodified lines | ||
| 1394 | 1396 | struct nlattr *tb[], struct nlattr *data[]) |
| 1395 | 1397 | { |
| 1396 | 1398 | struct net_vrf *vrf = netdev_priv(dev); |
| 1399 | + bool *add_fib_rules; | |
| 1400 | + struct net *net; | |
| 1397 | 1401 | int err; |
| 1398 | 1402 | |
| 1399 | 1403 | if (!data || !data[IFLA_VRF_TABLE]) |
| @@ -1409,13 +1413,15 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, · 9 unmodified lines | ||
| 1409 | 1413 | if (err) |
| 1410 | 1414 | goto out; |
| 1411 | 1415 | |
| 1412 | − if (add_fib_rules) { | |
| 1416 | + net = dev_net(dev); | |
| 1417 | + add_fib_rules = net_generic(net, vrf_net_id); | |
| 1418 | + if (*add_fib_rules) { | |
| 1413 | 1419 | err = vrf_add_fib_rules(dev); |
| 1414 | 1420 | if (err) { |
| 1415 | 1421 | unregister_netdevice(dev); |
| 1416 | 1422 | goto out; |
| 1417 | 1423 | } |
| 1418 | − add_fib_rules = false; | |
| 1424 | + *add_fib_rules = false; | |
| 1419 | 1425 | } |
| 1420 | 1426 | |
| 1421 | 1427 | out: |
| @@ -1498,16 +1504,38 @@ static struct notifier_block vrf_notifier_block __read_mostly = { · 76 unmodified lines | ||
| 1498 | 1504 | .notifier_call = vrf_device_event, |
| 1499 | 1505 | }; |
| 1500 | 1506 | |
| 1507 | +/* Initialize per network namespace state */ | |
| 1508 | +static int __net_init vrf_netns_init(struct net *net) | |
| 1509 | +{ | |
| 1510 | + bool *add_fib_rules = net_generic(net, vrf_net_id); | |
| 1511 | + | |
| 1512 | + *add_fib_rules = true; | |
| 1513 | + | |
| 1514 | + return 0; | |
| 1515 | +} | |
| 1516 | + | |
| 1517 | +static struct pernet_operations vrf_net_ops __net_initdata = { | |
| 1518 | + .init = vrf_netns_init, | |
| 1519 | + .id = &vrf_net_id, | |
| 1520 | + .size = sizeof(bool), | |
| 1521 | +}; | |
| 1522 | + | |
| 1501 | 1523 | static int __init vrf_init_module(void) |
| 1502 | 1524 | { |
| 1503 | 1525 | int rc; |
| 1504 | 1526 | |
| 1505 | 1527 | register_netdevice_notifier(&vrf_notifier_block); |
| 1506 | 1528 | |
| 1507 | − rc = rtnl_link_register(&vrf_link_ops); | |
| 1529 | + rc = register_pernet_subsys(&vrf_net_ops); | |
| 1508 | 1530 | if (rc < 0) |
| 1509 | 1531 | goto error; |
| 1510 | 1532 | |
| 1533 | + rc = rtnl_link_register(&vrf_link_ops); | |
| 1534 | + if (rc < 0) { | |
| 1535 | + unregister_pernet_subsys(&vrf_net_ops); | |
| 1536 | + goto error; | |
| 1537 | + } | |
| 1538 | + | |
| 1511 | 1539 | return 0; |
| 1512 | 1540 | |
| 1513 | 1541 | error: |
| @@ -135,7 +135,7 @@ static void vsockmon_setup(struct net_device *dev) · 134 unmodified lines | ||
| 135 | 135 | |
| 136 | 136 | dev->netdev_ops = &vsockmon_ops; |
| 137 | 137 | dev->ethtool_ops = &vsockmon_ethtool_ops; |
| 138 | − dev->destructor = free_netdev; | |
| 138 | + dev->needs_free_netdev = true; | |
| 139 | 139 | |
| 140 | 140 | dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | |
| 141 | 141 | NETIF_F_HIGHDMA | NETIF_F_LLTX; |
| @@ -2611,7 +2611,7 @@ static void vxlan_setup(struct net_device *dev) · 2610 unmodified lines | ||
| 2611 | 2611 | eth_hw_addr_random(dev); |
| 2612 | 2612 | ether_setup(dev); |
| 2613 | 2613 | |
| 2614 | − dev->destructor = free_netdev; | |
| 2614 | + dev->needs_free_netdev = true; | |
| 2615 | 2615 | SET_NETDEV_DEVTYPE(dev, &vxlan_type); |
| 2616 | 2616 | |
| 2617 | 2617 | dev->features |= NETIF_F_LLTX; |
| @@ -475,7 +475,7 @@ static void dlci_setup(struct net_device *dev) · 474 unmodified lines | ||
| 475 | 475 | dev->flags = 0; |
| 476 | 476 | dev->header_ops = &dlci_header_ops; |
| 477 | 477 | dev->netdev_ops = &dlci_netdev_ops; |
| 478 | − dev->destructor = free_netdev; | |
| 478 | + dev->needs_free_netdev = true; | |
| 479 | 479 | |
| 480 | 480 | dlp->receive = dlci_receive; |
| 481 | 481 | |
| @@ -1106,7 +1106,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) · 1105 unmodified lines | ||
| 1106 | 1106 | return -EIO; |
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | − dev->destructor = free_netdev; | |
| 1109 | + dev->needs_free_netdev = true; | |
| 1110 | 1110 | *get_dev_p(pvc, type) = dev; |
| 1111 | 1111 | if (!used) { |
| 1112 | 1112 | state(hdlc)->dce_changed = 1; |
| @@ -306,7 +306,7 @@ static const struct net_device_ops lapbeth_netdev_ops = { · 305 unmodified lines | ||
| 306 | 306 | static void lapbeth_setup(struct net_device *dev) |
| 307 | 307 | { |
| 308 | 308 | dev->netdev_ops = &lapbeth_netdev_ops; |
| 309 | − dev->destructor = free_netdev; | |
| 309 | + dev->needs_free_netdev = true; | |
| 310 | 310 | dev->type = ARPHRD_X25; |
| 311 | 311 | dev->hard_header_len = 3; |
| 312 | 312 | dev->mtu = 1000; |
| @@ -1287,7 +1287,7 @@ void init_netdev(struct net_device *dev) · 1286 unmodified lines | ||
| 1287 | 1287 | struct ath6kl *ar = ath6kl_priv(dev); |
| 1288 | 1288 | |
| 1289 | 1289 | dev->netdev_ops = &ath6kl_netdev_ops; |
| 1290 | − dev->destructor = free_netdev; | |
| 1290 | + dev->needs_free_netdev = true; | |
| 1291 | 1291 | dev->watchdog_timeo = ATH6KL_TX_TIMEOUT; |
| 1292 | 1292 | |
| 1293 | 1293 | dev->needed_headroom = ETH_HLEN; |
| @@ -5222,7 +5222,6 @@ void brcmf_cfg80211_free_netdev(struct net_device *ndev) · 5221 unmodified lines | ||
| 5222 | 5222 | |
| 5223 | 5223 | if (vif) |
| 5224 | 5224 | brcmf_free_vif(vif); |
| 5225 | − free_netdev(ndev); | |
| 5226 | 5225 | } |
| 5227 | 5226 | |
| 5228 | 5227 | static bool brcmf_is_linkup(const struct brcmf_event_msg *e) |
| @@ -624,7 +624,8 @@ struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, · 623 unmodified lines | ||
| 624 | 624 | if (!ndev) |
| 625 | 625 | return ERR_PTR(-ENOMEM); |
| 626 | 626 | |
| 627 | − ndev->destructor = brcmf_cfg80211_free_netdev; | |
| 627 | + ndev->needs_free_netdev = true; | |
| 628 | + ndev->priv_destructor = brcmf_cfg80211_free_netdev; | |
| 628 | 629 | ifp = netdev_priv(ndev); |
| 629 | 630 | ifp->ndev = ndev; |
| 630 | 631 | /* store mapping ifidx to bsscfgidx */ |
| @@ -73,7 +73,7 @@ struct net_device * hostap_add_interface(struct local_info *local, · 72 unmodified lines | ||
| 73 | 73 | dev->mem_end = mdev->mem_end; |
| 74 | 74 | |
| 75 | 75 | hostap_setup_dev(dev, local, type); |
| 76 | − dev->destructor = free_netdev; | |
| 76 | + dev->needs_free_netdev = true; | |
| 77 | 77 | |
| 78 | 78 | sprintf(dev->name, "%s%s", prefix, name); |
| 79 | 79 | if (!rtnl_locked) |
| @@ -2861,7 +2861,7 @@ static const struct net_device_ops hwsim_netdev_ops = { · 2860 unmodified lines | ||
| 2861 | 2861 | static void hwsim_mon_setup(struct net_device *dev) |
| 2862 | 2862 | { |
| 2863 | 2863 | dev->netdev_ops = &hwsim_netdev_ops; |
| 2864 | − dev->destructor = free_netdev; | |
| 2864 | + dev->needs_free_netdev = true; | |
| 2865 | 2865 | ether_setup(dev); |
| 2866 | 2866 | dev->priv_flags |= IFF_NO_QUEUE; |
| 2867 | 2867 | dev->type = ARPHRD_IEEE80211_RADIOTAP; |
| @@ -1284,7 +1284,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, · 1283 unmodified lines | ||
| 1284 | 1284 | struct net_device *dev) |
| 1285 | 1285 | { |
| 1286 | 1286 | dev->netdev_ops = &mwifiex_netdev_ops; |
| 1287 | − dev->destructor = free_netdev; | |
| 1287 | + dev->needs_free_netdev = true; | |
| 1288 | 1288 | /* Initialize private structure */ |
| 1289 | 1289 | priv->current_key_index = 0; |
| 1290 | 1290 | priv->media_connected = false; |
| @@ -316,7 +316,7 @@ int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *vif, · 315 unmodified lines | ||
| 316 | 316 | vif->netdev = dev; |
| 317 | 317 | |
| 318 | 318 | dev->netdev_ops = &qtnf_netdev_ops; |
| 319 | − dev->destructor = free_netdev; | |
| 319 | + dev->needs_free_netdev = true; | |
| 320 | 320 | dev_net_set(dev, wiphy_net(wiphy)); |
| 321 | 321 | dev->ieee80211_ptr = &vif->wdev; |
| 322 | 322 | dev->ieee80211_ptr->iftype = iftype; |
| @@ -56,7 +56,7 @@ MODULE_PARM_DESC(max_retries, "max number of retries a command may have"); · 55 unmodified lines | ||
| 56 | 56 | static int nvme_char_major; |
| 57 | 57 | module_param(nvme_char_major, int, 0); |
| 58 | 58 | |
| 59 | −static unsigned long default_ps_max_latency_us = 25000; | |
| 59 | +static unsigned long default_ps_max_latency_us = 100000; | |
| 60 | 60 | module_param(default_ps_max_latency_us, ulong, 0644); |
| 61 | 61 | MODULE_PARM_DESC(default_ps_max_latency_us, |
| 62 | 62 | "max power saving latency for new devices; use PM QOS to change per device"); |
| @@ -1342,7 +1342,7 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl) · 1279 unmodified lines | ||
| 1342 | 1342 | * transitioning between power states. Therefore, when running |
| 1343 | 1343 | * in any given state, we will enter the next lower-power |
| 1344 | 1344 | * non-operational state after waiting 50 * (enlat + exlat) |
| 1345 | − * microseconds, as long as that state's total latency is under | |
| 1345 | + * microseconds, as long as that state's exit latency is under | |
| 1346 | 1346 | * the requested maximum latency. |
| 1347 | 1347 | * |
| 1348 | 1348 | * We will not autonomously enter any non-operational state for |
| @@ -1387,7 +1387,7 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl) · 38 unmodified lines | ||
| 1387 | 1387 | * lowest-power state, not the number of states. |
| 1388 | 1388 | */ |
| 1389 | 1389 | for (state = (int)ctrl->npss; state >= 0; state--) { |
| 1390 | − u64 total_latency_us, transition_ms; | |
| 1390 | + u64 total_latency_us, exit_latency_us, transition_ms; | |
| 1391 | 1391 | |
| 1392 | 1392 | if (target) |
| 1393 | 1393 | table->entries[state] = target; |
| @@ -1408,12 +1408,15 @@ static void nvme_configure_apst(struct nvme_ctrl *ctrl) · 14 unmodified lines | ||
| 1408 | 1408 | NVME_PS_FLAGS_NON_OP_STATE)) |
| 1409 | 1409 | continue; |
| 1410 | 1410 | |
| 1411 | − total_latency_us = | |
| 1412 | − (u64)le32_to_cpu(ctrl->psd[state].entry_lat) + | |
| 1413 | − + le32_to_cpu(ctrl->psd[state].exit_lat); | |
| 1414 | − if (total_latency_us > ctrl->ps_max_latency_us) | |
| 1411 | + exit_latency_us = | |
| 1412 | + (u64)le32_to_cpu(ctrl->psd[state].exit_lat); | |
| 1413 | + if (exit_latency_us > ctrl->ps_max_latency_us) | |
| 1415 | 1414 | continue; |
| 1416 | 1415 | |
| 1416 | + total_latency_us = | |
| 1417 | + exit_latency_us + | |
| 1418 | + le32_to_cpu(ctrl->psd[state].entry_lat); | |
| 1419 | + | |
| 1417 | 1420 | /* |
| 1418 | 1421 | * This state is good. Use it as the APST idle |
| 1419 | 1422 | * target for higher power states. |
| @@ -2438,6 +2441,10 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl) · 1018 unmodified lines | ||
| 2438 | 2441 | struct nvme_ns *ns; |
| 2439 | 2442 | |
| 2440 | 2443 | mutex_lock(&ctrl->namespaces_mutex); |
| 2444 | + | |
| 2445 | + /* Forcibly start all queues to avoid having stuck requests */ | |
| 2446 | + blk_mq_start_hw_queues(ctrl->admin_q); | |
| 2447 | + | |
| 2441 | 2448 | list_for_each_entry(ns, &ctrl->namespaces, list) { |
| 2442 | 2449 | /* |
| 2443 | 2450 | * Revalidating a dead namespace sets capacity to 0. This will |
| @@ -1139,6 +1139,7 @@ nvme_fc_xmt_disconnect_assoc(struct nvme_fc_ctrl *ctrl) · 1138 unmodified lines | ||
| 1139 | 1139 | /* *********************** NVME Ctrl Routines **************************** */ |
| 1140 | 1140 | |
| 1141 | 1141 | static void __nvme_fc_final_op_cleanup(struct request *rq); |
| 1142 | +static void nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg); | |
| 1142 | 1143 | |
| 1143 | 1144 | static int |
| 1144 | 1145 | nvme_fc_reinit_request(void *data, struct request *rq) |
| @@ -1265,7 +1266,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · 120 unmodified lines | ||
| 1265 | 1266 | struct nvme_command *sqe = &op->cmd_iu.sqe; |
| 1266 | 1267 | __le16 status = cpu_to_le16(NVME_SC_SUCCESS << 1); |
| 1267 | 1268 | union nvme_result result; |
| 1268 | − bool complete_rq; | |
| 1269 | + bool complete_rq, terminate_assoc = true; | |
| 1269 | 1270 | |
| 1270 | 1271 | /* |
| 1271 | 1272 | * WARNING: |
| @@ -1294,6 +1295,14 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · 22 unmodified lines | ||
| 1294 | 1295 | * fabricate a CQE, the following fields will not be set as they |
| 1295 | 1296 | * are not referenced: |
| 1296 | 1297 | * cqe.sqid, cqe.sqhd, cqe.command_id |
| 1298 | + * | |
| 1299 | + * Failure or error of an individual i/o, in a transport | |
| 1300 | + * detected fashion unrelated to the nvme completion status, | |
| 1301 | + * potentially cause the initiator and target sides to get out | |
| 1302 | + * of sync on SQ head/tail (aka outstanding io count allowed). | |
| 1303 | + * Per FC-NVME spec, failure of an individual command requires | |
| 1304 | + * the connection to be terminated, which in turn requires the | |
| 1305 | + * association to be terminated. | |
| 1297 | 1306 | */ |
| 1298 | 1307 | |
| 1299 | 1308 | fc_dma_sync_single_for_cpu(ctrl->lport->dev, op->fcp_req.rspdma, |
| @@ -1359,6 +1368,8 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · 59 unmodified lines | ||
| 1359 | 1368 | goto done; |
| 1360 | 1369 | } |
| 1361 | 1370 | |
| 1371 | + terminate_assoc = false; | |
| 1372 | + | |
| 1362 | 1373 | done: |
| 1363 | 1374 | if (op->flags & FCOP_FLAGS_AEN) { |
| 1364 | 1375 | nvme_complete_async_event(&queue->ctrl->ctrl, status, &result); |
| @@ -1366,7 +1377,7 @@ done: · 1 unmodified line | ||
| 1366 | 1377 | atomic_set(&op->state, FCPOP_STATE_IDLE); |
| 1367 | 1378 | op->flags = FCOP_FLAGS_AEN; /* clear other flags */ |
| 1368 | 1379 | nvme_fc_ctrl_put(ctrl); |
| 1369 | − return; | |
| 1380 | + goto check_error; | |
| 1370 | 1381 | } |
| 1371 | 1382 | |
| 1372 | 1383 | complete_rq = __nvme_fc_fcpop_chk_teardowns(ctrl, op); |
| @@ -1379,6 +1390,10 @@ done: · 6 unmodified lines | ||
| 1379 | 1390 | nvme_end_request(rq, status, result); |
| 1380 | 1391 | } else |
| 1381 | 1392 | __nvme_fc_final_op_cleanup(rq); |
| 1393 | + | |
| 1394 | +check_error: | |
| 1395 | + if (terminate_assoc) | |
| 1396 | + nvme_fc_error_recovery(ctrl, "transport detected io error"); | |
| 1382 | 1397 | } |
| 1383 | 1398 | |
| 1384 | 1399 | static int |
| @@ -2791,6 +2806,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, · 1406 unmodified lines | ||
| 2791 | 2806 | ctrl->ctrl.opts = NULL; |
| 2792 | 2807 | /* initiate nvme ctrl ref counting teardown */ |
| 2793 | 2808 | nvme_uninit_ctrl(&ctrl->ctrl); |
| 2809 | + nvme_put_ctrl(&ctrl->ctrl); | |
| 2794 | 2810 | |
| 2795 | 2811 | /* as we're past the point where we transition to the ref |
| 2796 | 2812 | * counting teardown path, if we return a bad pointer here, |
| @@ -1367,7 +1367,7 @@ static bool nvme_should_reset(struct nvme_dev *dev, u32 csts) · 1366 unmodified lines | ||
| 1367 | 1367 | bool nssro = dev->subsystem && (csts & NVME_CSTS_NSSRO); |
| 1368 | 1368 | |
| 1369 | 1369 | /* If there is a reset ongoing, we shouldn't reset again. */ |
| 1370 | − if (work_busy(&dev->reset_work)) | |
| 1370 | + if (dev->ctrl.state == NVME_CTRL_RESETTING) | |
| 1371 | 1371 | return false; |
| 1372 | 1372 | |
| 1373 | 1373 | /* We shouldn't reset unless the controller is on fatal error state |
| @@ -1903,7 +1903,7 @@ static void nvme_reset_work(struct work_struct *work) · 529 unmodified lines | ||
| 1903 | 1903 | bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL); |
| 1904 | 1904 | int result = -ENODEV; |
| 1905 | 1905 | |
| 1906 | − if (WARN_ON(dev->ctrl.state == NVME_CTRL_RESETTING)) | |
| 1906 | + if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) | |
| 1907 | 1907 | goto out; |
| 1908 | 1908 | |
| 1909 | 1909 | /* |
| @@ -1913,9 +1913,6 @@ static void nvme_reset_work(struct work_struct *work) · 3 unmodified lines | ||
| 1913 | 1913 | if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) |
| 1914 | 1914 | nvme_dev_disable(dev, false); |
| 1915 | 1915 | |
| 1916 | − if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) | |
| 1917 | − goto out; | |
| 1918 | − | |
| 1919 | 1916 | result = nvme_pci_enable(dev); |
| 1920 | 1917 | if (result) |
| 1921 | 1918 | goto out; |
| @@ -2009,8 +2006,8 @@ static int nvme_reset(struct nvme_dev *dev) · 87 unmodified lines | ||
| 2009 | 2006 | { |
| 2010 | 2007 | if (!dev->ctrl.admin_q || blk_queue_dying(dev->ctrl.admin_q)) |
| 2011 | 2008 | return -ENODEV; |
| 2012 | − if (work_busy(&dev->reset_work)) | |
| 2013 | − return -ENODEV; | |
| 2009 | + if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) | |
| 2010 | + return -EBUSY; | |
| 2014 | 2011 | if (!queue_work(nvme_workq, &dev->reset_work)) |
| 2015 | 2012 | return -EBUSY; |
| 2016 | 2013 | return 0; |
| @@ -2136,6 +2133,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 119 unmodified lines | ||
| 2136 | 2133 | if (result) |
| 2137 | 2134 | goto release_pools; |
| 2138 | 2135 | |
| 2136 | + nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING); | |
| 2139 | 2137 | dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev)); |
| 2140 | 2138 | |
| 2141 | 2139 | queue_work(nvme_workq, &dev->reset_work); |
| @@ -2179,6 +2177,7 @@ static void nvme_remove(struct pci_dev *pdev) · 37 unmodified lines | ||
| 2179 | 2177 | |
| 2180 | 2178 | nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING); |
| 2181 | 2179 | |
| 2180 | + cancel_work_sync(&dev->reset_work); | |
| 2182 | 2181 | pci_set_drvdata(pdev, NULL); |
| 2183 | 2182 | |
| 2184 | 2183 | if (!pci_device_is_present(pdev)) { |
| @@ -753,28 +753,26 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work) · 752 unmodified lines | ||
| 753 | 753 | if (ret) |
| 754 | 754 | goto requeue; |
| 755 | 755 | |
| 756 | − blk_mq_start_stopped_hw_queues(ctrl->ctrl.admin_q, true); | |
| 757 | − | |
| 758 | 756 | ret = nvmf_connect_admin_queue(&ctrl->ctrl); |
| 759 | 757 | if (ret) |
| 760 | − goto stop_admin_q; | |
| 758 | + goto requeue; | |
| 761 | 759 | |
| 762 | 760 | set_bit(NVME_RDMA_Q_LIVE, &ctrl->queues[0].flags); |
| 763 | 761 | |
| 764 | 762 | ret = nvme_enable_ctrl(&ctrl->ctrl, ctrl->cap); |
| 765 | 763 | if (ret) |
| 766 | − goto stop_admin_q; | |
| 764 | + goto requeue; | |
| 767 | 765 | |
| 768 | 766 | nvme_start_keep_alive(&ctrl->ctrl); |
| 769 | 767 | |
| 770 | 768 | if (ctrl->queue_count > 1) { |
| 771 | 769 | ret = nvme_rdma_init_io_queues(ctrl); |
| 772 | 770 | if (ret) |
| 773 | − goto stop_admin_q; | |
| 771 | + goto requeue; | |
| 774 | 772 | |
| 775 | 773 | ret = nvme_rdma_connect_io_queues(ctrl); |
| 776 | 774 | if (ret) |
| 777 | − goto stop_admin_q; | |
| 775 | + goto requeue; | |
| 778 | 776 | } |
| 779 | 777 | |
| 780 | 778 | changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); |
| @@ -782,7 +780,6 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work) · 1 unmodified line | ||
| 782 | 780 | ctrl->ctrl.opts->nr_reconnects = 0; |
| 783 | 781 | |
| 784 | 782 | if (ctrl->queue_count > 1) { |
| 785 | − nvme_start_queues(&ctrl->ctrl); | |
| 786 | 783 | nvme_queue_scan(&ctrl->ctrl); |
| 787 | 784 | nvme_queue_async_events(&ctrl->ctrl); |
| 788 | 785 | } |
| @@ -791,8 +788,6 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work) · 2 unmodified lines | ||
| 791 | 788 | |
| 792 | 789 | return; |
| 793 | 790 | |
| 794 | −stop_admin_q: | |
| 795 | − blk_mq_stop_hw_queues(ctrl->ctrl.admin_q); | |
| 796 | 791 | requeue: |
| 797 | 792 | dev_info(ctrl->ctrl.device, "Failed reconnect attempt %d\n", |
| 798 | 793 | ctrl->ctrl.opts->nr_reconnects); |
| @@ -823,6 +818,13 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work) · 24 unmodified lines | ||
| 823 | 818 | blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, |
| 824 | 819 | nvme_cancel_request, &ctrl->ctrl); |
| 825 | 820 | |
| 821 | + /* | |
| 822 | + * queues are not a live anymore, so restart the queues to fail fast | |
| 823 | + * new IO | |
| 824 | + */ | |
| 825 | + blk_mq_start_stopped_hw_queues(ctrl->ctrl.admin_q, true); | |
| 826 | + nvme_start_queues(&ctrl->ctrl); | |
| 827 | + | |
| 826 | 828 | nvme_rdma_reconnect_or_remove(ctrl); |
| 827 | 829 | } |
| 828 | 830 | |
| @@ -1433,7 +1435,7 @@ nvme_rdma_timeout(struct request *rq, bool reserved) · 604 unmodified lines | ||
| 1433 | 1435 | /* |
| 1434 | 1436 | * We cannot accept any other command until the Connect command has completed. |
| 1435 | 1437 | */ |
| 1436 | −static inline bool nvme_rdma_queue_is_ready(struct nvme_rdma_queue *queue, | |
| 1438 | +static inline int nvme_rdma_queue_is_ready(struct nvme_rdma_queue *queue, | |
| 1437 | 1439 | struct request *rq) |
| 1438 | 1440 | { |
| 1439 | 1441 | if (unlikely(!test_bit(NVME_RDMA_Q_LIVE, &queue->flags))) { |
| @@ -1441,11 +1443,22 @@ static inline bool nvme_rdma_queue_is_ready(struct nvme_rdma_queue *queue, · 1 unmodified line | ||
| 1441 | 1443 | |
| 1442 | 1444 | if (!blk_rq_is_passthrough(rq) || |
| 1443 | 1445 | cmd->common.opcode != nvme_fabrics_command || |
| 1444 | − cmd->fabrics.fctype != nvme_fabrics_type_connect) | |
| 1445 | − return false; | |
| 1446 | + cmd->fabrics.fctype != nvme_fabrics_type_connect) { | |
| 1447 | + /* | |
| 1448 | + * reconnecting state means transport disruption, which | |
| 1449 | + * can take a long time and even might fail permanently, | |
| 1450 | + * so we can't let incoming I/O be requeued forever. | |
| 1451 | + * fail it fast to allow upper layers a chance to | |
| 1452 | + * failover. | |
| 1453 | + */ | |
| 1454 | + if (queue->ctrl->ctrl.state == NVME_CTRL_RECONNECTING) | |
| 1455 | + return -EIO; | |
| 1456 | + else | |
| 1457 | + return -EAGAIN; | |
| 1458 | + } | |
| 1446 | 1459 | } |
| 1447 | 1460 | |
| 1448 | − return true; | |
| 1461 | + return 0; | |
| 1449 | 1462 | } |
| 1450 | 1463 | |
| 1451 | 1464 | static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, |
| @@ -1463,8 +1476,9 @@ static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, · 11 unmodified lines | ||
| 1463 | 1476 | |
| 1464 | 1477 | WARN_ON_ONCE(rq->tag < 0); |
| 1465 | 1478 | |
| 1466 | − if (!nvme_rdma_queue_is_ready(queue, rq)) | |
| 1467 | − return BLK_MQ_RQ_QUEUE_BUSY; | |
| 1479 | + ret = nvme_rdma_queue_is_ready(queue, rq); | |
| 1480 | + if (unlikely(ret)) | |
| 1481 | + goto err; | |
| 1468 | 1482 | |
| 1469 | 1483 | dev = queue->device->dev; |
| 1470 | 1484 | ib_dma_sync_single_for_cpu(dev, sqe->dma, |
| @@ -144,8 +144,8 @@ int of_dma_configure(struct device *dev, struct device_node *np) · 143 unmodified lines | ||
| 144 | 144 | coherent ? " " : " not "); |
| 145 | 145 | |
| 146 | 146 | iommu = of_iommu_configure(dev, np); |
| 147 | − if (IS_ERR(iommu)) | |
| 148 | − return PTR_ERR(iommu); | |
| 147 | + if (IS_ERR(iommu) && PTR_ERR(iommu) == -EPROBE_DEFER) | |
| 148 | + return -EPROBE_DEFER; | |
| 149 | 149 | |
| 150 | 150 | dev_dbg(dev, "device is%sbehind an iommu\n", |
| 151 | 151 | iommu ? " " : " not "); |
| @@ -844,7 +844,7 @@ static int qcom_qmp_phy_vreg_init(struct device *dev) · 843 unmodified lines | ||
| 844 | 844 | int num = qmp->cfg->num_vregs; |
| 845 | 845 | int i; |
| 846 | 846 | |
| 847 | − qmp->vregs = devm_kcalloc(dev, num, sizeof(qmp->vregs), GFP_KERNEL); | |
| 847 | + qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); | |
| 848 | 848 | if (!qmp->vregs) |
| 849 | 849 | return -ENOMEM; |
| 850 | 850 | |
| @@ -983,16 +983,16 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id) · 132 unmodified lines | ||
| 983 | 983 | * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2. |
| 984 | 984 | */ |
| 985 | 985 | qphy->tx = of_iomap(np, 0); |
| 986 | − if (IS_ERR(qphy->tx)) | |
| 987 | − return PTR_ERR(qphy->tx); | |
| 986 | + if (!qphy->tx) | |
| 987 | + return -ENOMEM; | |
| 988 | 988 | |
| 989 | 989 | qphy->rx = of_iomap(np, 1); |
| 990 | − if (IS_ERR(qphy->rx)) | |
| 991 | − return PTR_ERR(qphy->rx); | |
| 990 | + if (!qphy->rx) | |
| 991 | + return -ENOMEM; | |
| 992 | 992 | |
| 993 | 993 | qphy->pcs = of_iomap(np, 2); |
| 994 | − if (IS_ERR(qphy->pcs)) | |
| 995 | − return PTR_ERR(qphy->pcs); | |
| 994 | + if (!qphy->pcs) | |
| 995 | + return -ENOMEM; | |
| 996 | 996 | |
| 997 | 997 | /* |
| 998 | 998 | * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3 |
| @@ -704,7 +704,7 @@ static int get_free_pipe_id_locked(struct goldfish_pipe_dev *dev) · 703 unmodified lines | ||
| 704 | 704 | /* Reallocate the array */ |
| 705 | 705 | u32 new_capacity = 2 * dev->pipes_capacity; |
| 706 | 706 | struct goldfish_pipe **pipes = |
| 707 | − kcalloc(new_capacity, sizeof(*pipes), GFP_KERNEL); | |
| 707 | + kcalloc(new_capacity, sizeof(*pipes), GFP_ATOMIC); | |
| 708 | 708 | if (!pipes) |
| 709 | 709 | return -ENOMEM; |
| 710 | 710 | memcpy(pipes, dev->pipes, sizeof(*pipes) * dev->pipes_capacity); |
| @@ -155,3 +155,5 @@ static int __init hi6220_reset_init(void) · 154 unmodified lines | ||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | postcore_initcall(hi6220_reset_init); |
| 158 | + | |
| 159 | +MODULE_LICENSE("GPL v2"); | |
| @@ -70,14 +70,14 @@ static ssize_t name_show(struct kobject *kobj, struct device *dev, char *buf) · 69 unmodified lines | ||
| 70 | 70 | { |
| 71 | 71 | return sprintf(buf, "I/O subchannel (Non-QDIO)\n"); |
| 72 | 72 | } |
| 73 | −MDEV_TYPE_ATTR_RO(name); | |
| 73 | +static MDEV_TYPE_ATTR_RO(name); | |
| 74 | 74 | |
| 75 | 75 | static ssize_t device_api_show(struct kobject *kobj, struct device *dev, |
| 76 | 76 | char *buf) |
| 77 | 77 | { |
| 78 | 78 | return sprintf(buf, "%s\n", VFIO_DEVICE_API_CCW_STRING); |
| 79 | 79 | } |
| 80 | −MDEV_TYPE_ATTR_RO(device_api); | |
| 80 | +static MDEV_TYPE_ATTR_RO(device_api); | |
| 81 | 81 | |
| 82 | 82 | static ssize_t available_instances_show(struct kobject *kobj, |
| 83 | 83 | struct device *dev, char *buf) |
| @@ -86,7 +86,7 @@ static ssize_t available_instances_show(struct kobject *kobj, · 2 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | return sprintf(buf, "%d\n", atomic_read(&private->avail)); |
| 88 | 88 | } |
| 89 | −MDEV_TYPE_ATTR_RO(available_instances); | |
| 89 | +static MDEV_TYPE_ATTR_RO(available_instances); | |
| 90 | 90 | |
| 91 | 91 | static struct attribute *mdev_types_attrs[] = { |
| 92 | 92 | &mdev_type_attr_name.attr, |
| @@ -100,7 +100,7 @@ static struct attribute_group mdev_type_group = { · 7 unmodified lines | ||
| 100 | 100 | .attrs = mdev_types_attrs, |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | −struct attribute_group *mdev_type_groups[] = { | |
| 103 | +static struct attribute_group *mdev_type_groups[] = { | |
| 104 | 104 | &mdev_type_group, |
| 105 | 105 | NULL, |
| 106 | 106 | }; |
| @@ -152,7 +152,7 @@ static int vfio_ccw_mdev_open(struct mdev_device *mdev) · 45 unmodified lines | ||
| 152 | 152 | &events, &private->nb); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | −void vfio_ccw_mdev_release(struct mdev_device *mdev) | |
| 155 | +static void vfio_ccw_mdev_release(struct mdev_device *mdev) | |
| 156 | 156 | { |
| 157 | 157 | struct vfio_ccw_private *private = |
| 158 | 158 | dev_get_drvdata(mdev_parent_dev(mdev)); |
| @@ -233,7 +233,7 @@ static int vfio_ccw_mdev_get_region_info(struct vfio_region_info *info, · 74 unmodified lines | ||
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | −int vfio_ccw_mdev_get_irq_info(struct vfio_irq_info *info) | |
| 236 | +static int vfio_ccw_mdev_get_irq_info(struct vfio_irq_info *info) | |
| 237 | 237 | { |
| 238 | 238 | if (info->index != VFIO_CCW_IO_IRQ_INDEX) |
| 239 | 239 | return -EINVAL; |
| @@ -668,10 +668,28 @@ static int ap_device_probe(struct device *dev) · 667 unmodified lines | ||
| 668 | 668 | struct ap_driver *ap_drv = to_ap_drv(dev->driver); |
| 669 | 669 | int rc; |
| 670 | 670 | |
| 671 | + /* Add queue/card to list of active queues/cards */ | |
| 672 | + spin_lock_bh(&ap_list_lock); | |
| 673 | + if (is_card_dev(dev)) | |
| 674 | + list_add(&to_ap_card(dev)->list, &ap_card_list); | |
| 675 | + else | |
| 676 | + list_add(&to_ap_queue(dev)->list, | |
| 677 | + &to_ap_queue(dev)->card->queues); | |
| 678 | + spin_unlock_bh(&ap_list_lock); | |
| 679 | + | |
| 671 | 680 | ap_dev->drv = ap_drv; |
| 672 | 681 | rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; |
| 673 | − if (rc) | |
| 682 | + | |
| 683 | + if (rc) { | |
| 684 | + spin_lock_bh(&ap_list_lock); | |
| 685 | + if (is_card_dev(dev)) | |
| 686 | + list_del_init(&to_ap_card(dev)->list); | |
| 687 | + else | |
| 688 | + list_del_init(&to_ap_queue(dev)->list); | |
| 689 | + spin_unlock_bh(&ap_list_lock); | |
| 674 | 690 | ap_dev->drv = NULL; |
| 691 | + } | |
| 692 | + | |
| 675 | 693 | return rc; |
| 676 | 694 | } |
| 677 | 695 | |
| @@ -680,14 +698,17 @@ static int ap_device_remove(struct device *dev) · 2 unmodified lines | ||
| 680 | 698 | struct ap_device *ap_dev = to_ap_dev(dev); |
| 681 | 699 | struct ap_driver *ap_drv = ap_dev->drv; |
| 682 | 700 | |
| 701 | + if (ap_drv->remove) | |
| 702 | + ap_drv->remove(ap_dev); | |
| 703 | + | |
| 704 | + /* Remove queue/card from list of active queues/cards */ | |
| 683 | 705 | spin_lock_bh(&ap_list_lock); |
| 684 | 706 | if (is_card_dev(dev)) |
| 685 | 707 | list_del_init(&to_ap_card(dev)->list); |
| 686 | 708 | else |
| 687 | 709 | list_del_init(&to_ap_queue(dev)->list); |
| 688 | 710 | spin_unlock_bh(&ap_list_lock); |
| 689 | − if (ap_drv->remove) | |
| 690 | − ap_drv->remove(ap_dev); | |
| 711 | + | |
| 691 | 712 | return 0; |
| 692 | 713 | } |
| 693 | 714 | |
| @@ -1056,10 +1077,6 @@ static void ap_scan_bus(struct work_struct *unused) · 362 unmodified lines | ||
| 1056 | 1077 | } |
| 1057 | 1078 | /* get it and thus adjust reference counter */ |
| 1058 | 1079 | get_device(&ac->ap_dev.device); |
| 1059 | − /* Add card device to card list */ | |
| 1060 | − spin_lock_bh(&ap_list_lock); | |
| 1061 | − list_add(&ac->list, &ap_card_list); | |
| 1062 | − spin_unlock_bh(&ap_list_lock); | |
| 1063 | 1080 | } |
| 1064 | 1081 | /* now create the new queue device */ |
| 1065 | 1082 | aq = ap_queue_create(qid, type); |
| @@ -1070,10 +1087,6 @@ static void ap_scan_bus(struct work_struct *unused) · 4 unmodified lines | ||
| 1070 | 1087 | aq->ap_dev.device.parent = &ac->ap_dev.device; |
| 1071 | 1088 | dev_set_name(&aq->ap_dev.device, |
| 1072 | 1089 | "%02x.%04x", id, dom); |
| 1073 | − /* Add queue device to card queue list */ | |
| 1074 | − spin_lock_bh(&ap_list_lock); | |
| 1075 | − list_add(&aq->list, &ac->queues); | |
| 1076 | − spin_unlock_bh(&ap_list_lock); | |
| 1077 | 1090 | /* Start with a device reset */ |
| 1078 | 1091 | spin_lock_bh(&aq->lock); |
| 1079 | 1092 | ap_wait(ap_sm_event(aq, AP_EVENT_POLL)); |
| @@ -1081,9 +1094,6 @@ static void ap_scan_bus(struct work_struct *unused) · 1 unmodified line | ||
| 1081 | 1094 | /* Register device */ |
| 1082 | 1095 | rc = device_register(&aq->ap_dev.device); |
| 1083 | 1096 | if (rc) { |
| 1084 | − spin_lock_bh(&ap_list_lock); | |
| 1085 | − list_del_init(&aq->list); | |
| 1086 | − spin_unlock_bh(&ap_list_lock); | |
| 1087 | 1097 | put_device(&aq->ap_dev.device); |
| 1088 | 1098 | continue; |
| 1089 | 1099 | } |
| @@ -160,7 +160,14 @@ static struct device_type ap_card_type = { · 159 unmodified lines | ||
| 160 | 160 | |
| 161 | 161 | static void ap_card_device_release(struct device *dev) |
| 162 | 162 | { |
| 163 | − kfree(to_ap_card(dev)); | |
| 163 | + struct ap_card *ac = to_ap_card(dev); | |
| 164 | + | |
| 165 | + if (!list_empty(&ac->list)) { | |
| 166 | + spin_lock_bh(&ap_list_lock); | |
| 167 | + list_del_init(&ac->list); | |
| 168 | + spin_unlock_bh(&ap_list_lock); | |
| 169 | + } | |
| 170 | + kfree(ac); | |
| 164 | 171 | } |
| 165 | 172 | |
| 166 | 173 | struct ap_card *ap_card_create(int id, int queue_depth, int device_type, |
| @@ -584,7 +584,14 @@ static struct device_type ap_queue_type = { · 583 unmodified lines | ||
| 584 | 584 | |
| 585 | 585 | static void ap_queue_device_release(struct device *dev) |
| 586 | 586 | { |
| 587 | − kfree(to_ap_queue(dev)); | |
| 587 | + struct ap_queue *aq = to_ap_queue(dev); | |
| 588 | + | |
| 589 | + if (!list_empty(&aq->list)) { | |
| 590 | + spin_lock_bh(&ap_list_lock); | |
| 591 | + list_del_init(&aq->list); | |
| 592 | + spin_unlock_bh(&ap_list_lock); | |
| 593 | + } | |
| 594 | + kfree(aq); | |
| 588 | 595 | } |
| 589 | 596 | |
| 590 | 597 | struct ap_queue *ap_queue_create(ap_qid_t qid, int device_type) |
| @@ -1954,7 +1954,6 @@ static void netiucv_free_netdevice(struct net_device *dev) · 1953 unmodified lines | ||
| 1954 | 1954 | privptr->conn = NULL; privptr->fsm = NULL; |
| 1955 | 1955 | /* privptr gets freed by free_netdev() */ |
| 1956 | 1956 | } |
| 1957 | − free_netdev(dev); | |
| 1958 | 1957 | } |
| 1959 | 1958 | |
| 1960 | 1959 | /** |
| @@ -1972,7 +1971,8 @@ static void netiucv_setup_netdevice(struct net_device *dev) · 11 unmodified lines | ||
| 1972 | 1971 | dev->mtu = NETIUCV_MTU_DEFAULT; |
| 1973 | 1972 | dev->min_mtu = 576; |
| 1974 | 1973 | dev->max_mtu = NETIUCV_MTU_MAX; |
| 1975 | − dev->destructor = netiucv_free_netdevice; | |
| 1974 | + dev->needs_free_netdev = true; | |
| 1975 | + dev->priv_destructor = netiucv_free_netdevice; | |
| 1976 | 1976 | dev->hard_header_len = NETIUCV_HDRLEN; |
| 1977 | 1977 | dev->addr_len = 0; |
| 1978 | 1978 | dev->type = ARPHRD_SLIP; |
| @@ -191,6 +191,7 @@ struct bnx2fc_hba { · 190 unmodified lines | ||
| 191 | 191 | struct bnx2fc_cmd_mgr *cmd_mgr; |
| 192 | 192 | spinlock_t hba_lock; |
| 193 | 193 | struct mutex hba_mutex; |
| 194 | + struct mutex hba_stats_mutex; | |
| 194 | 195 | unsigned long adapter_state; |
| 195 | 196 | #define ADAPTER_STATE_UP 0 |
| 196 | 197 | #define ADAPTER_STATE_GOING_DOWN 1 |
| @@ -663,15 +663,17 @@ static struct fc_host_statistics *bnx2fc_get_host_stats(struct Scsi_Host *shost) · 662 unmodified lines | ||
| 663 | 663 | if (!fw_stats) |
| 664 | 664 | return NULL; |
| 665 | 665 | |
| 666 | + mutex_lock(&hba->hba_stats_mutex); | |
| 667 | + | |
| 666 | 668 | bnx2fc_stats = fc_get_host_stats(shost); |
| 667 | 669 | |
| 668 | 670 | init_completion(&hba->stat_req_done); |
| 669 | 671 | if (bnx2fc_send_stat_req(hba)) |
| 670 | − return bnx2fc_stats; | |
| 672 | + goto unlock_stats_mutex; | |
| 671 | 673 | rc = wait_for_completion_timeout(&hba->stat_req_done, (2 * HZ)); |
| 672 | 674 | if (!rc) { |
| 673 | 675 | BNX2FC_HBA_DBG(lport, "FW stat req timed out\n"); |
| 674 | − return bnx2fc_stats; | |
| 676 | + goto unlock_stats_mutex; | |
| 675 | 677 | } |
| 676 | 678 | BNX2FC_STATS(hba, rx_stat2, fc_crc_cnt); |
| 677 | 679 | bnx2fc_stats->invalid_crc_count += hba->bfw_stats.fc_crc_cnt; |
| @@ -693,6 +695,9 @@ static struct fc_host_statistics *bnx2fc_get_host_stats(struct Scsi_Host *shost) · 15 unmodified lines | ||
| 693 | 695 | |
| 694 | 696 | memcpy(&hba->prev_stats, hba->stats_buffer, |
| 695 | 697 | sizeof(struct fcoe_statistics_params)); |
| 698 | + | |
| 699 | +unlock_stats_mutex: | |
| 700 | + mutex_unlock(&hba->hba_stats_mutex); | |
| 696 | 701 | return bnx2fc_stats; |
| 697 | 702 | } |
| 698 | 703 | |
| @@ -1340,6 +1345,7 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic) · 641 unmodified lines | ||
| 1340 | 1345 | } |
| 1341 | 1346 | spin_lock_init(&hba->hba_lock); |
| 1342 | 1347 | mutex_init(&hba->hba_mutex); |
| 1348 | + mutex_init(&hba->hba_stats_mutex); | |
| 1343 | 1349 | |
| 1344 | 1350 | hba->cnic = cnic; |
| 1345 | 1351 | |
| @@ -1597,7 +1597,6 @@ static void release_offload_resources(struct cxgbi_sock *csk) · 1596 unmodified lines | ||
| 1597 | 1597 | cxgbi_sock_put(csk); |
| 1598 | 1598 | } |
| 1599 | 1599 | csk->dst = NULL; |
| 1600 | − csk->cdev = NULL; | |
| 1601 | 1600 | } |
| 1602 | 1601 | |
| 1603 | 1602 | static int init_act_open(struct cxgbi_sock *csk) |
| @@ -867,7 +867,8 @@ static void need_active_close(struct cxgbi_sock *csk) · 866 unmodified lines | ||
| 867 | 867 | log_debug(1 << CXGBI_DBG_SOCK, "csk 0x%p,%u,0x%lx,%u.\n", |
| 868 | 868 | csk, (csk)->state, (csk)->flags, (csk)->tid); |
| 869 | 869 | spin_lock_bh(&csk->lock); |
| 870 | − dst_confirm(csk->dst); | |
| 870 | + if (csk->dst) | |
| 871 | + dst_confirm(csk->dst); | |
| 871 | 872 | data_lost = skb_queue_len(&csk->receive_queue); |
| 872 | 873 | __skb_queue_purge(&csk->receive_queue); |
| 873 | 874 | |
| @@ -882,7 +883,8 @@ static void need_active_close(struct cxgbi_sock *csk) · 8 unmodified lines | ||
| 882 | 883 | } |
| 883 | 884 | |
| 884 | 885 | if (close_req) { |
| 885 | − if (data_lost) | |
| 886 | + if (!cxgbi_sock_flag(csk, CTPF_LOGOUT_RSP_RCVD) || | |
| 887 | + data_lost) | |
| 886 | 888 | csk->cdev->csk_send_abort_req(csk); |
| 887 | 889 | else |
| 888 | 890 | csk->cdev->csk_send_close_req(csk); |
| @@ -1186,9 +1188,10 @@ static int cxgbi_sock_send_pdus(struct cxgbi_sock *csk, struct sk_buff *skb) · 297 unmodified lines | ||
| 1186 | 1188 | cxgbi_ulp_extra_len(cxgbi_skcb_ulp_mode(skb)); |
| 1187 | 1189 | skb = next; |
| 1188 | 1190 | } |
| 1189 | −done: | |
| 1191 | + | |
| 1190 | 1192 | if (likely(skb_queue_len(&csk->write_queue))) |
| 1191 | 1193 | cdev->csk_push_tx_frames(csk, 1); |
| 1194 | +done: | |
| 1192 | 1195 | spin_unlock_bh(&csk->lock); |
| 1193 | 1196 | return copied; |
| 1194 | 1197 | |
| @@ -1568,9 +1571,12 @@ static inline int read_pdu_skb(struct iscsi_conn *conn, · 373 unmodified lines | ||
| 1568 | 1571 | } |
| 1569 | 1572 | } |
| 1570 | 1573 | |
| 1571 | −static int skb_read_pdu_bhs(struct iscsi_conn *conn, struct sk_buff *skb) | |
| 1574 | +static int | |
| 1575 | +skb_read_pdu_bhs(struct cxgbi_sock *csk, struct iscsi_conn *conn, | |
| 1576 | + struct sk_buff *skb) | |
| 1572 | 1577 | { |
| 1573 | 1578 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; |
| 1579 | + int err; | |
| 1574 | 1580 | |
| 1575 | 1581 | log_debug(1 << CXGBI_DBG_PDU_RX, |
| 1576 | 1582 | "conn 0x%p, skb 0x%p, len %u, flag 0x%lx.\n", |
| @@ -1608,7 +1614,16 @@ static int skb_read_pdu_bhs(struct iscsi_conn *conn, struct sk_buff *skb) · 31 unmodified lines | ||
| 1608 | 1614 | } |
| 1609 | 1615 | } |
| 1610 | 1616 | |
| 1611 | − return read_pdu_skb(conn, skb, 0, 0); | |
| 1617 | + err = read_pdu_skb(conn, skb, 0, 0); | |
| 1618 | + if (likely(err >= 0)) { | |
| 1619 | + struct iscsi_hdr *hdr = (struct iscsi_hdr *)skb->data; | |
| 1620 | + u8 opcode = hdr->opcode & ISCSI_OPCODE_MASK; | |
| 1621 | + | |
| 1622 | + if (unlikely(opcode == ISCSI_OP_LOGOUT_RSP)) | |
| 1623 | + cxgbi_sock_set_flag(csk, CTPF_LOGOUT_RSP_RCVD); | |
| 1624 | + } | |
| 1625 | + | |
| 1626 | + return err; | |
| 1612 | 1627 | } |
| 1613 | 1628 | |
| 1614 | 1629 | static int skb_read_pdu_data(struct iscsi_conn *conn, struct sk_buff *lskb, |
| @@ -1713,7 +1728,7 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) · 98 unmodified lines | ||
| 1713 | 1728 | cxgbi_skcb_rx_pdulen(skb)); |
| 1714 | 1729 | |
| 1715 | 1730 | if (cxgbi_skcb_test_flag(skb, SKCBF_RX_COALESCED)) { |
| 1716 | − err = skb_read_pdu_bhs(conn, skb); | |
| 1731 | + err = skb_read_pdu_bhs(csk, conn, skb); | |
| 1717 | 1732 | if (err < 0) { |
| 1718 | 1733 | pr_err("coalesced bhs, csk 0x%p, skb 0x%p,%u, " |
| 1719 | 1734 | "f 0x%lx, plen %u.\n", |
| @@ -1731,7 +1746,7 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk) · 11 unmodified lines | ||
| 1731 | 1746 | cxgbi_skcb_flags(skb), |
| 1732 | 1747 | cxgbi_skcb_rx_pdulen(skb)); |
| 1733 | 1748 | } else { |
| 1734 | − err = skb_read_pdu_bhs(conn, skb); | |
| 1749 | + err = skb_read_pdu_bhs(csk, conn, skb); | |
| 1735 | 1750 | if (err < 0) { |
| 1736 | 1751 | pr_err("bhs, csk 0x%p, skb 0x%p,%u, " |
| 1737 | 1752 | "f 0x%lx, plen %u.\n", |
| @@ -187,6 +187,7 @@ enum cxgbi_sock_flags { · 186 unmodified lines | ||
| 187 | 187 | CTPF_HAS_ATID, /* reserved atid */ |
| 188 | 188 | CTPF_HAS_TID, /* reserved hw tid */ |
| 189 | 189 | CTPF_OFFLOAD_DOWN, /* offload function off */ |
| 190 | + CTPF_LOGOUT_RSP_RCVD, /* received logout response */ | |
| 190 | 191 | }; |
| 191 | 192 | |
| 192 | 193 | struct cxgbi_skb_rx_cb { |
| @@ -127,7 +127,7 @@ int lpfc_disc_state_machine(struct lpfc_vport *, struct lpfc_nodelist *, void *, · 126 unmodified lines | ||
| 127 | 127 | void lpfc_do_scr_ns_plogi(struct lpfc_hba *, struct lpfc_vport *); |
| 128 | 128 | int lpfc_check_sparm(struct lpfc_vport *, struct lpfc_nodelist *, |
| 129 | 129 | struct serv_parm *, uint32_t, int); |
| 130 | −int lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist *); | |
| 130 | +void lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist *); | |
| 131 | 131 | void lpfc_more_plogi(struct lpfc_vport *); |
| 132 | 132 | void lpfc_more_adisc(struct lpfc_vport *); |
| 133 | 133 | void lpfc_end_rscn(struct lpfc_vport *); |
| @@ -978,9 +978,10 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 977 unmodified lines | ||
| 978 | 978 | ndlp, did, ndlp->nlp_fc4_type, |
| 979 | 979 | FC_TYPE_FCP, FC_TYPE_NVME); |
| 980 | 980 | ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; |
| 981 | + | |
| 982 | + lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE); | |
| 983 | + lpfc_issue_els_prli(vport, ndlp, 0); | |
| 981 | 984 | } |
| 982 | − lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE); | |
| 983 | − lpfc_issue_els_prli(vport, ndlp, 0); | |
| 984 | 985 | } else |
| 985 | 986 | lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY, |
| 986 | 987 | "3065 GFT_ID failed x%08x\n", irsp->ulpStatus); |
| @@ -206,7 +206,7 @@ lpfc_check_elscmpl_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 205 unmodified lines | ||
| 206 | 206 | * associated with a LPFC_NODELIST entry. This |
| 207 | 207 | * routine effectively results in a "software abort". |
| 208 | 208 | */ |
| 209 | −int | |
| 209 | +void | |
| 210 | 210 | lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) |
| 211 | 211 | { |
| 212 | 212 | LIST_HEAD(abort_list); |
| @@ -215,6 +215,10 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) · 2 unmodified lines | ||
| 215 | 215 | |
| 216 | 216 | pring = lpfc_phba_elsring(phba); |
| 217 | 217 | |
| 218 | + /* In case of error recovery path, we might have a NULL pring here */ | |
| 219 | + if (!pring) | |
| 220 | + return; | |
| 221 | + | |
| 218 | 222 | /* Abort outstanding I/O on NPort <nlp_DID> */ |
| 219 | 223 | lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY, |
| 220 | 224 | "2819 Abort outstanding I/O on NPort x%x " |
| @@ -273,7 +277,6 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) · 52 unmodified lines | ||
| 273 | 277 | IOSTAT_LOCAL_REJECT, IOERR_SLI_ABORTED); |
| 274 | 278 | |
| 275 | 279 | lpfc_cancel_retry_delay_tmo(phba->pport, ndlp); |
| 276 | − return 0; | |
| 277 | 280 | } |
| 278 | 281 | |
| 279 | 282 | static int |
| @@ -799,8 +799,8 @@ lpfc_nvmet_xmt_fcp_release(struct nvmet_fc_target_port *tgtport, · 798 unmodified lines | ||
| 799 | 799 | } |
| 800 | 800 | spin_unlock_irqrestore(&ctxp->ctxlock, flags); |
| 801 | 801 | |
| 802 | − lpfc_nvmeio_data(phba, "NVMET FCP FREE: xri x%x ste %d\n", ctxp->oxid, | |
| 803 | − ctxp->state, 0); | |
| 802 | + lpfc_nvmeio_data(phba, "NVMET FCP FREE: xri x%x ste %d abt %d\n", ctxp->oxid, | |
| 803 | + ctxp->state, aborting); | |
| 804 | 804 | |
| 805 | 805 | atomic_inc(&lpfc_nvmep->xmt_fcp_release); |
| 806 | 806 | |
| @@ -730,6 +730,8 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) · 729 unmodified lines | ||
| 730 | 730 | return -EIO; |
| 731 | 731 | } |
| 732 | 732 | |
| 733 | + memset(&elreq, 0, sizeof(elreq)); | |
| 734 | + | |
| 733 | 735 | elreq.req_sg_cnt = dma_map_sg(&ha->pdev->dev, |
| 734 | 736 | bsg_job->request_payload.sg_list, bsg_job->request_payload.sg_cnt, |
| 735 | 737 | DMA_TO_DEVICE); |
| @@ -795,10 +797,9 @@ qla2x00_process_loopback(struct bsg_job *bsg_job) · 59 unmodified lines | ||
| 795 | 797 | |
| 796 | 798 | if (atomic_read(&vha->loop_state) == LOOP_READY && |
| 797 | 799 | (ha->current_topology == ISP_CFG_F || |
| 798 | − ((IS_QLA81XX(ha) || IS_QLA8031(ha) || IS_QLA8044(ha)) && | |
| 799 | − le32_to_cpu(*(uint32_t *)req_data) == ELS_OPCODE_BYTE | |
| 800 | − && req_data_len == MAX_ELS_FRAME_PAYLOAD)) && | |
| 801 | − elreq.options == EXTERNAL_LOOPBACK) { | |
| 800 | + (le32_to_cpu(*(uint32_t *)req_data) == ELS_OPCODE_BYTE && | |
| 801 | + req_data_len == MAX_ELS_FRAME_PAYLOAD)) && | |
| 802 | + elreq.options == EXTERNAL_LOOPBACK) { | |
| 802 | 803 | type = "FC_BSG_HST_VENDOR_ECHO_DIAG"; |
| 803 | 804 | ql_dbg(ql_dbg_user, vha, 0x701e, |
| 804 | 805 | "BSG request type: %s.\n", type); |
| @@ -1131,7 +1131,7 @@ qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) · 1130 unmodified lines | ||
| 1131 | 1131 | |
| 1132 | 1132 | /* Mailbox registers. */ |
| 1133 | 1133 | mbx_reg = ®->mailbox0; |
| 1134 | − for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, dmp_reg++) | |
| 1134 | + for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, mbx_reg++) | |
| 1135 | 1135 | fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg)); |
| 1136 | 1136 | |
| 1137 | 1137 | /* Transfer sequence registers. */ |
| @@ -2090,7 +2090,7 @@ qla83xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) · 952 unmodified lines | ||
| 2090 | 2090 | |
| 2091 | 2091 | /* Mailbox registers. */ |
| 2092 | 2092 | mbx_reg = ®->mailbox0; |
| 2093 | − for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, dmp_reg++) | |
| 2093 | + for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++, mbx_reg++) | |
| 2094 | 2094 | fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg)); |
| 2095 | 2095 | |
| 2096 | 2096 | /* Transfer sequence registers. */ |
| @@ -3425,6 +3425,7 @@ struct qla_hw_data { · 3424 unmodified lines | ||
| 3425 | 3425 | uint8_t max_req_queues; |
| 3426 | 3426 | uint8_t max_rsp_queues; |
| 3427 | 3427 | uint8_t max_qpairs; |
| 3428 | + uint8_t num_qpairs; | |
| 3428 | 3429 | struct qla_qpair *base_qpair; |
| 3429 | 3430 | struct qla_npiv_entry *npiv_info; |
| 3430 | 3431 | uint16_t nvram_npiv_size; |
| @@ -7543,12 +7543,13 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos, int v · 7542 unmodified lines | ||
| 7543 | 7543 | /* Assign available que pair id */ |
| 7544 | 7544 | mutex_lock(&ha->mq_lock); |
| 7545 | 7545 | qpair_id = find_first_zero_bit(ha->qpair_qid_map, ha->max_qpairs); |
| 7546 | − if (qpair_id >= ha->max_qpairs) { | |
| 7546 | + if (ha->num_qpairs >= ha->max_qpairs) { | |
| 7547 | 7547 | mutex_unlock(&ha->mq_lock); |
| 7548 | 7548 | ql_log(ql_log_warn, vha, 0x0183, |
| 7549 | 7549 | "No resources to create additional q pair.\n"); |
| 7550 | 7550 | goto fail_qid_map; |
| 7551 | 7551 | } |
| 7552 | + ha->num_qpairs++; | |
| 7552 | 7553 | set_bit(qpair_id, ha->qpair_qid_map); |
| 7553 | 7554 | ha->queue_pair_map[qpair_id] = qpair; |
| 7554 | 7555 | qpair->id = qpair_id; |
| @@ -7635,6 +7636,7 @@ fail_rsp: · 80 unmodified lines | ||
| 7635 | 7636 | fail_msix: |
| 7636 | 7637 | ha->queue_pair_map[qpair_id] = NULL; |
| 7637 | 7638 | clear_bit(qpair_id, ha->qpair_qid_map); |
| 7639 | + ha->num_qpairs--; | |
| 7638 | 7640 | mutex_unlock(&ha->mq_lock); |
| 7639 | 7641 | fail_qid_map: |
| 7640 | 7642 | kfree(qpair); |
| @@ -7660,6 +7662,7 @@ int qla2xxx_delete_qpair(struct scsi_qla_host *vha, struct qla_qpair *qpair) · 19 unmodified lines | ||
| 7660 | 7662 | mutex_lock(&ha->mq_lock); |
| 7661 | 7663 | ha->queue_pair_map[qpair->id] = NULL; |
| 7662 | 7664 | clear_bit(qpair->id, ha->qpair_qid_map); |
| 7665 | + ha->num_qpairs--; | |
| 7663 | 7666 | list_del(&qpair->qp_list_elem); |
| 7664 | 7667 | if (list_empty(&vha->qp_list)) |
| 7665 | 7668 | vha->flags.qpairs_available = 0; |
| @@ -129,28 +129,16 @@ qla2x00_clear_loop_id(fc_port_t *fcport) { · 128 unmodified lines | ||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | static inline void |
| 132 | −qla2x00_clean_dsd_pool(struct qla_hw_data *ha, srb_t *sp, | |
| 133 | − struct qla_tgt_cmd *tc) | |
| 132 | +qla2x00_clean_dsd_pool(struct qla_hw_data *ha, struct crc_context *ctx) | |
| 134 | 133 | { |
| 135 | − struct dsd_dma *dsd_ptr, *tdsd_ptr; | |
| 136 | − struct crc_context *ctx; | |
| 137 | − | |
| 138 | − if (sp) | |
| 139 | − ctx = (struct crc_context *)GET_CMD_CTX_SP(sp); | |
| 140 | − else if (tc) | |
| 141 | − ctx = (struct crc_context *)tc->ctx; | |
| 142 | − else { | |
| 143 | − BUG(); | |
| 144 | − return; | |
| 145 | − } | |
| 134 | + struct dsd_dma *dsd, *tdsd; | |
| 146 | 135 | |
| 147 | 136 | /* clean up allocated prev pool */ |
| 148 | − list_for_each_entry_safe(dsd_ptr, tdsd_ptr, | |
| 149 | − &ctx->dsd_list, list) { | |
| 150 | − dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr, | |
| 151 | − dsd_ptr->dsd_list_dma); | |
| 152 | − list_del(&dsd_ptr->list); | |
| 153 | − kfree(dsd_ptr); | |
| 137 | + list_for_each_entry_safe(dsd, tdsd, &ctx->dsd_list, list) { | |
| 138 | + dma_pool_free(ha->dl_dma_pool, dsd->dsd_addr, | |
| 139 | + dsd->dsd_list_dma); | |
| 140 | + list_del(&dsd->list); | |
| 141 | + kfree(dsd); | |
| 154 | 142 | } |
| 155 | 143 | INIT_LIST_HEAD(&ctx->dsd_list); |
| 156 | 144 | } |
| @@ -3282,7 +3282,7 @@ msix_register_fail: · 3281 unmodified lines | ||
| 3282 | 3282 | } |
| 3283 | 3283 | |
| 3284 | 3284 | /* Enable MSI-X vector for response queue update for queue 0 */ |
| 3285 | − if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) { | |
| 3285 | + if (IS_QLA25XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha)) { | |
| 3286 | 3286 | if (ha->msixbase && ha->mqiobase && |
| 3287 | 3287 | (ha->max_rsp_queues > 1 || ha->max_req_queues > 1 || |
| 3288 | 3288 | ql2xmqsupport)) |
| @@ -3676,15 +3676,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, · 3675 unmodified lines | ||
| 3676 | 3676 | qlt_update_host_map(vha, id); |
| 3677 | 3677 | } |
| 3678 | 3678 | |
| 3679 | − fc_host_port_name(vha->host) = | |
| 3680 | − wwn_to_u64(vha->port_name); | |
| 3681 | − | |
| 3682 | − if (qla_ini_mode_enabled(vha)) | |
| 3683 | − ql_dbg(ql_dbg_mbx, vha, 0x1018, | |
| 3684 | − "FA-WWN portname %016llx (%x)\n", | |
| 3685 | − fc_host_port_name(vha->host), | |
| 3686 | − rptid_entry->vp_status); | |
| 3687 | − | |
| 3688 | 3679 | set_bit(REGISTER_FC4_NEEDED, &vha->dpc_flags); |
| 3689 | 3680 | set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags); |
| 3690 | 3681 | } else { |
| @@ -4821,9 +4812,9 @@ qla2x00_echo_test(scsi_qla_host_t *vha, struct msg_echo_lb *mreq, · 1130 unmodified lines | ||
| 4821 | 4812 | |
| 4822 | 4813 | memset(mcp->mb, 0 , sizeof(mcp->mb)); |
| 4823 | 4814 | mcp->mb[0] = MBC_DIAGNOSTIC_ECHO; |
| 4824 | − mcp->mb[1] = mreq->options | BIT_6; /* BIT_6 specifies 64bit address */ | |
| 4815 | + /* BIT_6 specifies 64bit address */ | |
| 4816 | + mcp->mb[1] = mreq->options | BIT_15 | BIT_6; | |
| 4825 | 4817 | if (IS_CNA_CAPABLE(ha)) { |
| 4826 | − mcp->mb[1] |= BIT_15; | |
| 4827 | 4818 | mcp->mb[2] = vha->fcoe_fcf_idx; |
| 4828 | 4819 | } |
| 4829 | 4820 | mcp->mb[16] = LSW(mreq->rcv_dma); |
| @@ -630,29 +630,34 @@ qla2x00_sp_free_dma(void *ptr) · 629 unmodified lines | ||
| 630 | 630 | sp->flags &= ~SRB_CRC_PROT_DMA_VALID; |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | + if (!ctx) | |
| 634 | + goto end; | |
| 635 | + | |
| 633 | 636 | if (sp->flags & SRB_CRC_CTX_DSD_VALID) { |
| 634 | 637 | /* List assured to be having elements */ |
| 635 | − qla2x00_clean_dsd_pool(ha, sp, NULL); | |
| 638 | + qla2x00_clean_dsd_pool(ha, ctx); | |
| 636 | 639 | sp->flags &= ~SRB_CRC_CTX_DSD_VALID; |
| 637 | 640 | } |
| 638 | 641 | |
| 639 | 642 | if (sp->flags & SRB_CRC_CTX_DMA_VALID) { |
| 640 | − dma_pool_free(ha->dl_dma_pool, ctx, | |
| 641 | − ((struct crc_context *)ctx)->crc_ctx_dma); | |
| 643 | + struct crc_context *ctx0 = ctx; | |
| 644 | + | |
| 645 | + dma_pool_free(ha->dl_dma_pool, ctx0, ctx0->crc_ctx_dma); | |
| 642 | 646 | sp->flags &= ~SRB_CRC_CTX_DMA_VALID; |
| 643 | 647 | } |
| 644 | 648 | |
| 645 | 649 | if (sp->flags & SRB_FCP_CMND_DMA_VALID) { |
| 646 | − struct ct6_dsd *ctx1 = (struct ct6_dsd *)ctx; | |
| 650 | + struct ct6_dsd *ctx1 = ctx; | |
| 647 | 651 | |
| 648 | 652 | dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, |
| 649 | − ctx1->fcp_cmnd_dma); | |
| 653 | + ctx1->fcp_cmnd_dma); | |
| 650 | 654 | list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); |
| 651 | 655 | ha->gbl_dsd_inuse -= ctx1->dsd_use_cnt; |
| 652 | 656 | ha->gbl_dsd_avail += ctx1->dsd_use_cnt; |
| 653 | 657 | mempool_free(ctx1, ha->ctx_mempool); |
| 654 | 658 | } |
| 655 | 659 | |
| 660 | +end: | |
| 656 | 661 | CMD_SP(cmd) = NULL; |
| 657 | 662 | qla2x00_rel_sp(sp); |
| 658 | 663 | } |
| @@ -699,21 +704,24 @@ qla2xxx_qpair_sp_free_dma(void *ptr) · 40 unmodified lines | ||
| 699 | 704 | sp->flags &= ~SRB_CRC_PROT_DMA_VALID; |
| 700 | 705 | } |
| 701 | 706 | |
| 707 | + if (!ctx) | |
| 708 | + goto end; | |
| 709 | + | |
| 702 | 710 | if (sp->flags & SRB_CRC_CTX_DSD_VALID) { |
| 703 | 711 | /* List assured to be having elements */ |
| 704 | − qla2x00_clean_dsd_pool(ha, sp, NULL); | |
| 712 | + qla2x00_clean_dsd_pool(ha, ctx); | |
| 705 | 713 | sp->flags &= ~SRB_CRC_CTX_DSD_VALID; |
| 706 | 714 | } |
| 707 | 715 | |
| 708 | 716 | if (sp->flags & SRB_CRC_CTX_DMA_VALID) { |
| 709 | − dma_pool_free(ha->dl_dma_pool, ctx, | |
| 710 | − ((struct crc_context *)ctx)->crc_ctx_dma); | |
| 717 | + struct crc_context *ctx0 = ctx; | |
| 718 | + | |
| 719 | + dma_pool_free(ha->dl_dma_pool, ctx, ctx0->crc_ctx_dma); | |
| 711 | 720 | sp->flags &= ~SRB_CRC_CTX_DMA_VALID; |
| 712 | 721 | } |
| 713 | 722 | |
| 714 | 723 | if (sp->flags & SRB_FCP_CMND_DMA_VALID) { |
| 715 | − struct ct6_dsd *ctx1 = (struct ct6_dsd *)ctx; | |
| 716 | − | |
| 724 | + struct ct6_dsd *ctx1 = ctx; | |
| 717 | 725 | dma_pool_free(ha->fcp_cmnd_dma_pool, ctx1->fcp_cmnd, |
| 718 | 726 | ctx1->fcp_cmnd_dma); |
| 719 | 727 | list_splice(&ctx1->dsd_list, &ha->gbl_dsd_list); |
| @@ -721,7 +729,7 @@ qla2xxx_qpair_sp_free_dma(void *ptr) · 1 unmodified line | ||
| 721 | 729 | ha->gbl_dsd_avail += ctx1->dsd_use_cnt; |
| 722 | 730 | mempool_free(ctx1, ha->ctx_mempool); |
| 723 | 731 | } |
| 724 | − | |
| 732 | +end: | |
| 725 | 733 | CMD_SP(cmd) = NULL; |
| 726 | 734 | qla2xxx_rel_qpair_sp(sp->qpair, sp); |
| 727 | 735 | } |
| @@ -1632,7 +1640,7 @@ qla2x00_loop_reset(scsi_qla_host_t *vha) · 904 unmodified lines | ||
| 1632 | 1640 | void |
| 1633 | 1641 | qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) |
| 1634 | 1642 | { |
| 1635 | − int que, cnt; | |
| 1643 | + int que, cnt, status; | |
| 1636 | 1644 | unsigned long flags; |
| 1637 | 1645 | srb_t *sp; |
| 1638 | 1646 | struct qla_hw_data *ha = vha->hw; |
| @@ -1662,8 +1670,12 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) · 23 unmodified lines | ||
| 1662 | 1670 | */ |
| 1663 | 1671 | sp_get(sp); |
| 1664 | 1672 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 1665 | − qla2xxx_eh_abort(GET_CMD_SP(sp)); | |
| 1673 | + status = qla2xxx_eh_abort(GET_CMD_SP(sp)); | |
| 1666 | 1674 | spin_lock_irqsave(&ha->hardware_lock, flags); |
| 1675 | + /* Get rid of extra reference if immediate exit | |
| 1676 | + * from ql2xxx_eh_abort */ | |
| 1677 | + if (status == FAILED && (qla2x00_isp_reg_stat(ha))) | |
| 1678 | + atomic_dec(&sp->ref_count); | |
| 1667 | 1679 | } |
| 1668 | 1680 | req->outstanding_cmds[cnt] = NULL; |
| 1669 | 1681 | sp->done(sp, res); |
| @@ -2623,10 +2635,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 953 unmodified lines | ||
| 2623 | 2635 | |
| 2624 | 2636 | if (mem_only) { |
| 2625 | 2637 | if (pci_enable_device_mem(pdev)) |
| 2626 | − goto probe_out; | |
| 2638 | + return ret; | |
| 2627 | 2639 | } else { |
| 2628 | 2640 | if (pci_enable_device(pdev)) |
| 2629 | − goto probe_out; | |
| 2641 | + return ret; | |
| 2630 | 2642 | } |
| 2631 | 2643 | |
| 2632 | 2644 | /* This may fail but that's ok */ |
| @@ -2636,7 +2648,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 3 unmodified lines | ||
| 2636 | 2648 | if (!ha) { |
| 2637 | 2649 | ql_log_pci(ql_log_fatal, pdev, 0x0009, |
| 2638 | 2650 | "Unable to allocate memory for ha.\n"); |
| 2639 | − goto probe_out; | |
| 2651 | + goto disable_device; | |
| 2640 | 2652 | } |
| 2641 | 2653 | ql_dbg_pci(ql_dbg_init, pdev, 0x000a, |
| 2642 | 2654 | "Memory allocated for ha=%p.\n", ha); |
| @@ -3254,7 +3266,7 @@ iospace_config_failed: · 611 unmodified lines | ||
| 3254 | 3266 | pci_release_selected_regions(ha->pdev, ha->bars); |
| 3255 | 3267 | kfree(ha); |
| 3256 | 3268 | |
| 3257 | −probe_out: | |
| 3269 | +disable_device: | |
| 3258 | 3270 | pci_disable_device(pdev); |
| 3259 | 3271 | return ret; |
| 3260 | 3272 | } |
| @@ -2245,11 +2245,13 @@ static void qlt_unmap_sg(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd) · 2244 unmodified lines | ||
| 2245 | 2245 | pci_unmap_sg(ha->pdev, cmd->prot_sg, cmd->prot_sg_cnt, |
| 2246 | 2246 | cmd->dma_data_direction); |
| 2247 | 2247 | |
| 2248 | + if (!cmd->ctx) | |
| 2249 | + return; | |
| 2250 | + | |
| 2248 | 2251 | if (cmd->ctx_dsd_alloced) |
| 2249 | − qla2x00_clean_dsd_pool(ha, NULL, cmd); | |
| 2252 | + qla2x00_clean_dsd_pool(ha, cmd->ctx); | |
| 2250 | 2253 | |
| 2251 | − if (cmd->ctx) | |
| 2252 | − dma_pool_free(ha->dl_dma_pool, cmd->ctx, cmd->ctx->crc_ctx_dma); | |
| 2254 | + dma_pool_free(ha->dl_dma_pool, cmd->ctx, cmd->ctx->crc_ctx_dma); | |
| 2253 | 2255 | } |
| 2254 | 2256 | |
| 2255 | 2257 | static int qlt_check_reserve_free_req(struct scsi_qla_host *vha, |
| @@ -371,7 +371,7 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host *vha, · 370 unmodified lines | ||
| 371 | 371 | goto done; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | − if (end <= start || start == 0 || end == 0) { | |
| 374 | + if (end < start || start == 0 || end == 0) { | |
| 375 | 375 | ql_dbg(ql_dbg_misc, vha, 0xd023, |
| 376 | 376 | "%s: unusable range (start=%x end=%x)\n", __func__, |
| 377 | 377 | ent->t262.end_addr, ent->t262.start_addr); |
| @@ -1404,7 +1404,7 @@ static int resp_inquiry(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) · 1403 unmodified lines | ||
| 1404 | 1404 | arr[4] = SDEBUG_LONG_INQ_SZ - 5; |
| 1405 | 1405 | arr[5] = (int)have_dif_prot; /* PROTECT bit */ |
| 1406 | 1406 | if (sdebug_vpd_use_hostno == 0) |
| 1407 | − arr[5] = 0x10; /* claim: implicit TGPS */ | |
| 1407 | + arr[5] |= 0x10; /* claim: implicit TPGS */ | |
| 1408 | 1408 | arr[6] = 0x10; /* claim: MultiP */ |
| 1409 | 1409 | /* arr[6] |= 0x40; ... claim: EncServ (enclosure services) */ |
| 1410 | 1410 | arr[7] = 0xa; /* claim: LINKED + CMDQUE */ |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | config CRYPTO_DEV_CCREE |
| 2 | 2 | tristate "Support for ARM TrustZone CryptoCell C7XX family of Crypto accelerators" |
| 3 | − depends on CRYPTO_HW && OF && HAS_DMA | |
| 3 | + depends on CRYPTO && CRYPTO_HW && OF && HAS_DMA | |
| 4 | 4 | default n |
| 5 | 5 | select CRYPTO_HASH |
| 6 | 6 | select CRYPTO_BLKCIPHER |
| @@ -216,7 +216,8 @@ void ssi_buffer_mgr_copy_scatterlist_portion( · 215 unmodified lines | ||
| 216 | 216 | uint32_t nents, lbytes; |
| 217 | 217 | |
| 218 | 218 | nents = ssi_buffer_mgr_get_sgl_nents(sg, end, &lbytes, NULL); |
| 219 | − sg_copy_buffer(sg, nents, (void *)dest, (end - to_skip), 0, (direct == SSI_SG_TO_BUF)); | |
| 219 | + sg_copy_buffer(sg, nents, (void *)dest, (end - to_skip + 1), to_skip, | |
| 220 | + (direct == SSI_SG_TO_BUF)); | |
| 220 | 221 | } |
| 221 | 222 | |
| 222 | 223 | static inline int ssi_buffer_mgr_render_buff_to_mlli( |
| @@ -293,18 +293,10 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, · 292 unmodified lines | ||
| 293 | 293 | size_t lmmk_size; |
| 294 | 294 | size_t lum_size; |
| 295 | 295 | int rc; |
| 296 | − mm_segment_t seg; | |
| 297 | 296 | |
| 298 | 297 | if (!lsm) |
| 299 | 298 | return -ENODATA; |
| 300 | 299 | |
| 301 | − /* | |
| 302 | − * "Switch to kernel segment" to allow copying from kernel space by | |
| 303 | − * copy_{to,from}_user(). | |
| 304 | − */ | |
| 305 | − seg = get_fs(); | |
| 306 | − set_fs(KERNEL_DS); | |
| 307 | − | |
| 308 | 300 | if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) { |
| 309 | 301 | CERROR("bad LSM MAGIC: 0x%08X != 0x%08X nor 0x%08X\n", |
| 310 | 302 | lsm->lsm_magic, LOV_MAGIC_V1, LOV_MAGIC_V3); |
| @@ -406,6 +398,5 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, · 95 unmodified lines | ||
| 406 | 398 | out_free: |
| 407 | 399 | kvfree(lmmk); |
| 408 | 400 | out: |
| 409 | − set_fs(seg); | |
| 410 | 401 | return rc; |
| 411 | 402 | } |
| @@ -152,7 +152,7 @@ static const struct net_device_ops mon_netdev_ops = { · 151 unmodified lines | ||
| 152 | 152 | static void mon_setup(struct net_device *dev) |
| 153 | 153 | { |
| 154 | 154 | dev->netdev_ops = &mon_netdev_ops; |
| 155 | − dev->destructor = free_netdev; | |
| 155 | + dev->needs_free_netdev = true; | |
| 156 | 156 | ether_setup(dev); |
| 157 | 157 | dev->priv_flags |= IFF_NO_QUEUE; |
| 158 | 158 | dev->type = ARPHRD_IEEE80211; |
| @@ -2667,7 +2667,8 @@ static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, st · 2666 unmodified lines | ||
| 2667 | 2667 | mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP; |
| 2668 | 2668 | strncpy(mon_ndev->name, name, IFNAMSIZ); |
| 2669 | 2669 | mon_ndev->name[IFNAMSIZ - 1] = 0; |
| 2670 | − mon_ndev->destructor = rtw_ndev_destructor; | |
| 2670 | + mon_ndev->needs_free_netdev = true; | |
| 2671 | + mon_ndev->priv_destructor = rtw_ndev_destructor; | |
| 2671 | 2672 | |
| 2672 | 2673 | mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops; |
| 2673 | 2674 | |
| @@ -1207,8 +1207,6 @@ void rtw_ndev_destructor(struct net_device *ndev) · 1206 unmodified lines | ||
| 1207 | 1207 | |
| 1208 | 1208 | if (ndev->ieee80211_ptr) |
| 1209 | 1209 | kfree((u8 *)ndev->ieee80211_ptr); |
| 1210 | − | |
| 1211 | − free_netdev(ndev); | |
| 1212 | 1210 | } |
| 1213 | 1211 | |
| 1214 | 1212 | void rtw_dev_unload(struct adapter *padapter) |
| @@ -843,7 +843,10 @@ static ssize_t ci_role_show(struct device *dev, struct device_attribute *attr, · 842 unmodified lines | ||
| 843 | 843 | { |
| 844 | 844 | struct ci_hdrc *ci = dev_get_drvdata(dev); |
| 845 | 845 | |
| 846 | − return sprintf(buf, "%s\n", ci_role(ci)->name); | |
| 846 | + if (ci->role != CI_ROLE_END) | |
| 847 | + return sprintf(buf, "%s\n", ci_role(ci)->name); | |
| 848 | + | |
| 849 | + return 0; | |
| 847 | 850 | } |
| 848 | 851 | |
| 849 | 852 | static ssize_t ci_role_store(struct device *dev, |
| @@ -294,7 +294,8 @@ static int ci_role_show(struct seq_file *s, void *data) · 293 unmodified lines | ||
| 294 | 294 | { |
| 295 | 295 | struct ci_hdrc *ci = s->private; |
| 296 | 296 | |
| 297 | − seq_printf(s, "%s\n", ci_role(ci)->name); | |
| 297 | + if (ci->role != CI_ROLE_END) | |
| 298 | + seq_printf(s, "%s\n", ci_role(ci)->name); | |
| 298 | 299 | |
| 299 | 300 | return 0; |
| 300 | 301 | } |
| @@ -1993,6 +1993,7 @@ static void udc_id_switch_for_host(struct ci_hdrc *ci) · 1992 unmodified lines | ||
| 1993 | 1993 | int ci_hdrc_gadget_init(struct ci_hdrc *ci) |
| 1994 | 1994 | { |
| 1995 | 1995 | struct ci_role_driver *rdrv; |
| 1996 | + int ret; | |
| 1996 | 1997 | |
| 1997 | 1998 | if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC)) |
| 1998 | 1999 | return -ENXIO; |
| @@ -2005,7 +2006,10 @@ int ci_hdrc_gadget_init(struct ci_hdrc *ci) · 6 unmodified lines | ||
| 2005 | 2006 | rdrv->stop = udc_id_switch_for_host; |
| 2006 | 2007 | rdrv->irq = udc_irq; |
| 2007 | 2008 | rdrv->name = "gadget"; |
| 2008 | − ci->roles[CI_ROLE_GADGET] = rdrv; | |
| 2009 | 2009 | |
| 2010 | − return udc_start(ci); | |
| 2010 | + ret = udc_start(ci); | |
| 2011 | + if (!ret) | |
| 2012 | + ci->roles[CI_ROLE_GADGET] = rdrv; | |
| 2013 | + | |
| 2014 | + return ret; | |
| 2011 | 2015 | } |
| @@ -108,6 +108,8 @@ struct imx_usbmisc { · 107 unmodified lines | ||
| 108 | 108 | const struct usbmisc_ops *ops; |
| 109 | 109 | }; |
| 110 | 110 | |
| 111 | +static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data); | |
| 112 | + | |
| 111 | 113 | static int usbmisc_imx25_init(struct imx_usbmisc_data *data) |
| 112 | 114 | { |
| 113 | 115 | struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); |
| @@ -242,10 +244,15 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data) · 128 unmodified lines | ||
| 242 | 244 | val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN |
| 243 | 245 | | MX53_USB_UHx_CTRL_ULPI_INT_EN; |
| 244 | 246 | writel(val, reg); |
| 245 | − /* Disable internal 60Mhz clock */ | |
| 246 | − reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET; | |
| 247 | − val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF; | |
| 248 | − writel(val, reg); | |
| 247 | + if (is_imx53_usbmisc(data)) { | |
| 248 | + /* Disable internal 60Mhz clock */ | |
| 249 | + reg = usbmisc->base + | |
| 250 | + MX53_USB_CLKONOFF_CTRL_OFFSET; | |
| 251 | + val = readl(reg) | | |
| 252 | + MX53_USB_CLKONOFF_CTRL_H2_INT60CKOFF; | |
| 253 | + writel(val, reg); | |
| 254 | + } | |
| 255 | + | |
| 249 | 256 | } |
| 250 | 257 | if (data->disable_oc) { |
| 251 | 258 | reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET; |
| @@ -267,10 +274,15 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data *data) · 15 unmodified lines | ||
| 267 | 274 | val = readl(reg) | MX53_USB_UHx_CTRL_WAKE_UP_EN |
| 268 | 275 | | MX53_USB_UHx_CTRL_ULPI_INT_EN; |
| 269 | 276 | writel(val, reg); |
| 270 | − /* Disable internal 60Mhz clock */ | |
| 271 | − reg = usbmisc->base + MX53_USB_CLKONOFF_CTRL_OFFSET; | |
| 272 | − val = readl(reg) | MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF; | |
| 273 | − writel(val, reg); | |
| 277 | + | |
| 278 | + if (is_imx53_usbmisc(data)) { | |
| 279 | + /* Disable internal 60Mhz clock */ | |
| 280 | + reg = usbmisc->base + | |
| 281 | + MX53_USB_CLKONOFF_CTRL_OFFSET; | |
| 282 | + val = readl(reg) | | |
| 283 | + MX53_USB_CLKONOFF_CTRL_H3_INT60CKOFF; | |
| 284 | + writel(val, reg); | |
| 285 | + } | |
| 274 | 286 | } |
| 275 | 287 | if (data->disable_oc) { |
| 276 | 288 | reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET; |
| @@ -456,6 +468,10 @@ static const struct usbmisc_ops imx27_usbmisc_ops = { · 179 unmodified lines | ||
| 456 | 468 | .init = usbmisc_imx27_init, |
| 457 | 469 | }; |
| 458 | 470 | |
| 471 | +static const struct usbmisc_ops imx51_usbmisc_ops = { | |
| 472 | + .init = usbmisc_imx53_init, | |
| 473 | +}; | |
| 474 | + | |
| 459 | 475 | static const struct usbmisc_ops imx53_usbmisc_ops = { |
| 460 | 476 | .init = usbmisc_imx53_init, |
| 461 | 477 | }; |
| @@ -479,6 +495,13 @@ static const struct usbmisc_ops imx7d_usbmisc_ops = { · 17 unmodified lines | ||
| 479 | 495 | .set_wakeup = usbmisc_imx7d_set_wakeup, |
| 480 | 496 | }; |
| 481 | 497 | |
| 498 | +static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data) | |
| 499 | +{ | |
| 500 | + struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev); | |
| 501 | + | |
| 502 | + return usbmisc->ops == &imx53_usbmisc_ops; | |
| 503 | +} | |
| 504 | + | |
| 482 | 505 | int imx_usbmisc_init(struct imx_usbmisc_data *data) |
| 483 | 506 | { |
| 484 | 507 | struct imx_usbmisc *usbmisc; |
| @@ -536,7 +559,7 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = { · 51 unmodified lines | ||
| 536 | 559 | }, |
| 537 | 560 | { |
| 538 | 561 | .compatible = "fsl,imx51-usbmisc", |
| 539 | − .data = &imx53_usbmisc_ops, | |
| 562 | + .data = &imx51_usbmisc_ops, | |
| 540 | 563 | }, |
| 541 | 564 | { |
| 542 | 565 | .compatible = "fsl,imx53-usbmisc", |
| @@ -144,6 +144,8 @@ const struct of_device_id dwc2_of_match_table[] = { · 143 unmodified lines | ||
| 144 | 144 | { .compatible = "lantiq,xrx200-usb", .data = dwc2_set_ltq_params }, |
| 145 | 145 | { .compatible = "snps,dwc2" }, |
| 146 | 146 | { .compatible = "samsung,s3c6400-hsotg" }, |
| 147 | + { .compatible = "amlogic,meson8-usb", | |
| 148 | + .data = dwc2_set_amlogic_params }, | |
| 147 | 149 | { .compatible = "amlogic,meson8b-usb", |
| 148 | 150 | .data = dwc2_set_amlogic_params }, |
| 149 | 151 | { .compatible = "amlogic,meson-gxbb-usb", |
| @@ -396,7 +396,11 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep) · 395 unmodified lines | ||
| 396 | 396 | /* Caller must hold fsg->lock */ |
| 397 | 397 | static void wakeup_thread(struct fsg_common *common) |
| 398 | 398 | { |
| 399 | − smp_wmb(); /* ensure the write of bh->state is complete */ | |
| 399 | + /* | |
| 400 | + * Ensure the reading of thread_wakeup_needed | |
| 401 | + * and the writing of bh->state are completed | |
| 402 | + */ | |
| 403 | + smp_mb(); | |
| 400 | 404 | /* Tell the main thread that something has happened */ |
| 401 | 405 | common->thread_wakeup_needed = 1; |
| 402 | 406 | if (common->thread_task) |
| @@ -627,7 +631,12 @@ static int sleep_thread(struct fsg_common *common, bool can_freeze) · 224 unmodified lines | ||
| 627 | 631 | } |
| 628 | 632 | __set_current_state(TASK_RUNNING); |
| 629 | 633 | common->thread_wakeup_needed = 0; |
| 630 | − smp_rmb(); /* ensure the latest bh->state is visible */ | |
| 634 | + | |
| 635 | + /* | |
| 636 | + * Ensure the writing of thread_wakeup_needed | |
| 637 | + * and the reading of bh->state are completed | |
| 638 | + */ | |
| 639 | + smp_mb(); | |
| 631 | 640 | return rc; |
| 632 | 641 | } |
| 633 | 642 | |
| @@ -281,7 +281,7 @@ static void pn_net_setup(struct net_device *dev) · 280 unmodified lines | ||
| 281 | 281 | dev->tx_queue_len = 1; |
| 282 | 282 | |
| 283 | 283 | dev->netdev_ops = &pn_netdev_ops; |
| 284 | − dev->destructor = free_netdev; | |
| 284 | + dev->needs_free_netdev = true; | |
| 285 | 285 | dev->header_ops = &phonet_header_ops; |
| 286 | 286 | } |
| 287 | 287 | |
| @@ -623,7 +623,6 @@ static void renesas_usb3_stop_controller(struct renesas_usb3 *usb3) · 622 unmodified lines | ||
| 623 | 623 | { |
| 624 | 624 | usb3_disconnect(usb3); |
| 625 | 625 | usb3_write(usb3, 0, USB3_P0_INT_ENA); |
| 626 | − usb3_write(usb3, 0, USB3_PN_INT_ENA); | |
| 627 | 626 | usb3_write(usb3, 0, USB3_USB_OTG_INT_ENA); |
| 628 | 627 | usb3_write(usb3, 0, USB3_USB_INT_ENA_1); |
| 629 | 628 | usb3_write(usb3, 0, USB3_USB_INT_ENA_2); |
| @@ -1475,7 +1474,13 @@ static void usb3_request_done_pipen(struct renesas_usb3 *usb3, · 845 unmodified lines | ||
| 1475 | 1474 | struct renesas_usb3_request *usb3_req, |
| 1476 | 1475 | int status) |
| 1477 | 1476 | { |
| 1478 | − usb3_pn_stop(usb3); | |
| 1477 | + unsigned long flags; | |
| 1478 | + | |
| 1479 | + spin_lock_irqsave(&usb3->lock, flags); | |
| 1480 | + if (usb3_pn_change(usb3, usb3_ep->num)) | |
| 1481 | + usb3_pn_stop(usb3); | |
| 1482 | + spin_unlock_irqrestore(&usb3->lock, flags); | |
| 1483 | + | |
| 1479 | 1484 | usb3_disable_pipe_irq(usb3, usb3_ep->num); |
| 1480 | 1485 | usb3_request_done(usb3_ep, usb3_req, status); |
| 1481 | 1486 | |
| @@ -1504,30 +1509,46 @@ static void usb3_irq_epc_pipen_bfrdy(struct renesas_usb3 *usb3, int num) · 22 unmodified lines | ||
| 1504 | 1509 | { |
| 1505 | 1510 | struct renesas_usb3_ep *usb3_ep = usb3_get_ep(usb3, num); |
| 1506 | 1511 | struct renesas_usb3_request *usb3_req = usb3_get_request(usb3_ep); |
| 1512 | + bool done = false; | |
| 1507 | 1513 | |
| 1508 | 1514 | if (!usb3_req) |
| 1509 | 1515 | return; |
| 1510 | 1516 | |
| 1517 | + spin_lock(&usb3->lock); | |
| 1518 | + if (usb3_pn_change(usb3, num)) | |
| 1519 | + goto out; | |
| 1520 | + | |
| 1511 | 1521 | if (usb3_ep->dir_in) { |
| 1512 | 1522 | /* Do not stop the IN pipe here to detect LSTTR interrupt */ |
| 1513 | 1523 | if (!usb3_write_pipe(usb3_ep, usb3_req, USB3_PN_WRITE)) |
| 1514 | 1524 | usb3_clear_bit(usb3, PN_INT_BFRDY, USB3_PN_INT_ENA); |
| 1515 | 1525 | } else { |
| 1516 | 1526 | if (!usb3_read_pipe(usb3_ep, usb3_req, USB3_PN_READ)) |
| 1517 | − usb3_request_done_pipen(usb3, usb3_ep, usb3_req, 0); | |
| 1527 | + done = true; | |
| 1518 | 1528 | } |
| 1529 | + | |
| 1530 | +out: | |
| 1531 | + /* need to unlock because usb3_request_done_pipen() locks it */ | |
| 1532 | + spin_unlock(&usb3->lock); | |
| 1533 | + | |
| 1534 | + if (done) | |
| 1535 | + usb3_request_done_pipen(usb3, usb3_ep, usb3_req, 0); | |
| 1519 | 1536 | } |
| 1520 | 1537 | |
| 1521 | 1538 | static void usb3_irq_epc_pipen(struct renesas_usb3 *usb3, int num) |
| 1522 | 1539 | { |
| 1523 | 1540 | u32 pn_int_sta; |
| 1524 | 1541 | |
| 1525 | − if (usb3_pn_change(usb3, num) < 0) | |
| 1542 | + spin_lock(&usb3->lock); | |
| 1543 | + if (usb3_pn_change(usb3, num) < 0) { | |
| 1544 | + spin_unlock(&usb3->lock); | |
| 1526 | 1545 | return; |
| 1546 | + } | |
| 1527 | 1547 | |
| 1528 | 1548 | pn_int_sta = usb3_read(usb3, USB3_PN_INT_STA); |
| 1529 | 1549 | pn_int_sta &= usb3_read(usb3, USB3_PN_INT_ENA); |
| 1530 | 1550 | usb3_write(usb3, pn_int_sta, USB3_PN_INT_STA); |
| 1551 | + spin_unlock(&usb3->lock); | |
| 1531 | 1552 | if (pn_int_sta & PN_INT_LSTTR) |
| 1532 | 1553 | usb3_irq_epc_pipen_lsttr(usb3, num); |
| 1533 | 1554 | if (pn_int_sta & PN_INT_BFRDY) |
| @@ -1660,6 +1681,7 @@ static int usb3_disable_pipe_n(struct renesas_usb3_ep *usb3_ep) · 126 unmodified lines | ||
| 1660 | 1681 | |
| 1661 | 1682 | spin_lock_irqsave(&usb3->lock, flags); |
| 1662 | 1683 | if (!usb3_pn_change(usb3, usb3_ep->num)) { |
| 1684 | + usb3_write(usb3, 0, USB3_PN_INT_ENA); | |
| 1663 | 1685 | usb3_write(usb3, 0, USB3_PN_RAMMAP); |
| 1664 | 1686 | usb3_clear_bit(usb3, PN_CON_EN, USB3_PN_CON); |
| 1665 | 1687 | } |
| @@ -1799,6 +1821,9 @@ static int renesas_usb3_start(struct usb_gadget *gadget, · 133 unmodified lines | ||
| 1799 | 1821 | /* hook up the driver */ |
| 1800 | 1822 | usb3->driver = driver; |
| 1801 | 1823 | |
| 1824 | + pm_runtime_enable(usb3_to_dev(usb3)); | |
| 1825 | + pm_runtime_get_sync(usb3_to_dev(usb3)); | |
| 1826 | + | |
| 1802 | 1827 | renesas_usb3_init_controller(usb3); |
| 1803 | 1828 | |
| 1804 | 1829 | return 0; |
| @@ -1807,14 +1832,14 @@ static int renesas_usb3_start(struct usb_gadget *gadget, · 2 unmodified lines | ||
| 1807 | 1832 | static int renesas_usb3_stop(struct usb_gadget *gadget) |
| 1808 | 1833 | { |
| 1809 | 1834 | struct renesas_usb3 *usb3 = gadget_to_renesas_usb3(gadget); |
| 1810 | − unsigned long flags; | |
| 1811 | 1835 | |
| 1812 | − spin_lock_irqsave(&usb3->lock, flags); | |
| 1813 | 1836 | usb3->softconnect = false; |
| 1814 | 1837 | usb3->gadget.speed = USB_SPEED_UNKNOWN; |
| 1815 | 1838 | usb3->driver = NULL; |
| 1816 | 1839 | renesas_usb3_stop_controller(usb3); |
| 1817 | − spin_unlock_irqrestore(&usb3->lock, flags); | |
| 1840 | + | |
| 1841 | + pm_runtime_put(usb3_to_dev(usb3)); | |
| 1842 | + pm_runtime_disable(usb3_to_dev(usb3)); | |
| 1818 | 1843 | |
| 1819 | 1844 | return 0; |
| 1820 | 1845 | } |
| @@ -1891,9 +1916,6 @@ static int renesas_usb3_remove(struct platform_device *pdev) · 70 unmodified lines | ||
| 1891 | 1916 | |
| 1892 | 1917 | device_remove_file(&pdev->dev, &dev_attr_role); |
| 1893 | 1918 | |
| 1894 | − pm_runtime_put(&pdev->dev); | |
| 1895 | − pm_runtime_disable(&pdev->dev); | |
| 1896 | − | |
| 1897 | 1919 | usb_del_gadget_udc(&usb3->gadget); |
| 1898 | 1920 | |
| 1899 | 1921 | __renesas_usb3_ep_free_request(usb3->ep0_req); |
| @@ -2099,9 +2121,6 @@ static int renesas_usb3_probe(struct platform_device *pdev) · 199 unmodified lines | ||
| 2099 | 2121 | |
| 2100 | 2122 | usb3->workaround_for_vbus = priv->workaround_for_vbus; |
| 2101 | 2123 | |
| 2102 | − pm_runtime_enable(&pdev->dev); | |
| 2103 | − pm_runtime_get_sync(&pdev->dev); | |
| 2104 | − | |
| 2105 | 2124 | dev_info(&pdev->dev, "probed\n"); |
| 2106 | 2125 | |
| 2107 | 2126 | return 0; |
| @@ -245,6 +245,11 @@ static int dsps_check_status(struct musb *musb, void *unused) · 244 unmodified lines | ||
| 245 | 245 | dsps_mod_timer_optional(glue); |
| 246 | 246 | break; |
| 247 | 247 | case OTG_STATE_A_WAIT_BCON: |
| 248 | + /* keep VBUS on for host-only mode */ | |
| 249 | + if (musb->port_mode == MUSB_PORT_MODE_HOST) { | |
| 250 | + dsps_mod_timer_optional(glue); | |
| 251 | + break; | |
| 252 | + } | |
| 248 | 253 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
| 249 | 254 | skip_session = 1; |
| 250 | 255 | /* fall */ |
| @@ -362,8 +362,8 @@ static int mmap_batch_fn(void *data, int nr, void *state) · 361 unmodified lines | ||
| 362 | 362 | st->global_error = 1; |
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | − st->va += PAGE_SIZE * nr; | |
| 366 | − st->index += nr; | |
| 365 | + st->va += XEN_PAGE_SIZE * nr; | |
| 366 | + st->index += nr / XEN_PFN_PER_PAGE; | |
| 367 | 367 | |
| 368 | 368 | return 0; |
| 369 | 369 | } |
| @@ -2563,7 +2563,7 @@ u64 btrfs_csum_bytes_to_leaves(struct btrfs_fs_info *fs_info, u64 csum_bytes); · 2562 unmodified lines | ||
| 2563 | 2563 | static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_fs_info *fs_info, |
| 2564 | 2564 | unsigned num_items) |
| 2565 | 2565 | { |
| 2566 | − return fs_info->nodesize * BTRFS_MAX_LEVEL * 2 * num_items; | |
| 2566 | + return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * 2 * num_items; | |
| 2567 | 2567 | } |
| 2568 | 2568 | |
| 2569 | 2569 | /* |
| @@ -2573,7 +2573,7 @@ static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_fs_info *fs_info, · 3 unmodified lines | ||
| 2573 | 2573 | static inline u64 btrfs_calc_trunc_metadata_size(struct btrfs_fs_info *fs_info, |
| 2574 | 2574 | unsigned num_items) |
| 2575 | 2575 | { |
| 2576 | − return fs_info->nodesize * BTRFS_MAX_LEVEL * num_items; | |
| 2576 | + return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * num_items; | |
| 2577 | 2577 | } |
| 2578 | 2578 | |
| 2579 | 2579 | int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans, |
| @@ -468,7 +468,7 @@ int verify_dir_item(struct btrfs_fs_info *fs_info, · 467 unmodified lines | ||
| 468 | 468 | |
| 469 | 469 | if (btrfs_dir_name_len(leaf, dir_item) > namelen) { |
| 470 | 470 | btrfs_crit(fs_info, "invalid dir item name len: %u", |
| 471 | − (unsigned)btrfs_dir_data_len(leaf, dir_item)); | |
| 471 | + (unsigned)btrfs_dir_name_len(leaf, dir_item)); | |
| 472 | 472 | return 1; |
| 473 | 473 | } |
| 474 | 474 | |
| @@ -3467,10 +3467,12 @@ static int write_dev_supers(struct btrfs_device *device, · 3466 unmodified lines | ||
| 3467 | 3467 | * we fua the first super. The others we allow |
| 3468 | 3468 | * to go down lazy. |
| 3469 | 3469 | */ |
| 3470 | − if (i == 0) | |
| 3471 | − ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_FUA, bh); | |
| 3472 | − else | |
| 3470 | + if (i == 0) { | |
| 3471 | + ret = btrfsic_submit_bh(REQ_OP_WRITE, | |
| 3472 | + REQ_SYNC | REQ_FUA, bh); | |
| 3473 | + } else { | |
| 3473 | 3474 | ret = btrfsic_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh); |
| 3475 | + } | |
| 3474 | 3476 | if (ret) |
| 3475 | 3477 | errors++; |
| 3476 | 3478 | } |
| @@ -3535,7 +3537,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait) · 58 unmodified lines | ||
| 3535 | 3537 | |
| 3536 | 3538 | bio->bi_end_io = btrfs_end_empty_barrier; |
| 3537 | 3539 | bio->bi_bdev = device->bdev; |
| 3538 | − bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH; | |
| 3540 | + bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH; | |
| 3539 | 3541 | init_completion(&device->flush_wait); |
| 3540 | 3542 | bio->bi_private = &device->flush_wait; |
| 3541 | 3543 | device->flush_bio = bio; |
| @@ -3993,6 +3993,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, · 3992 unmodified lines | ||
| 3993 | 3993 | info->space_info_kobj, "%s", |
| 3994 | 3994 | alloc_name(found->flags)); |
| 3995 | 3995 | if (ret) { |
| 3996 | + percpu_counter_destroy(&found->total_bytes_pinned); | |
| 3996 | 3997 | kfree(found); |
| 3997 | 3998 | return ret; |
| 3998 | 3999 | } |
| @@ -4844,7 +4845,7 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info, · 845 unmodified lines | ||
| 4844 | 4845 | spin_unlock(&delayed_rsv->lock); |
| 4845 | 4846 | |
| 4846 | 4847 | commit: |
| 4847 | − trans = btrfs_join_transaction(fs_info->fs_root); | |
| 4848 | + trans = btrfs_join_transaction(fs_info->extent_root); | |
| 4848 | 4849 | if (IS_ERR(trans)) |
| 4849 | 4850 | return -ENOSPC; |
| 4850 | 4851 | |
| @@ -4862,7 +4863,7 @@ static int flush_space(struct btrfs_fs_info *fs_info, · 11 unmodified lines | ||
| 4862 | 4863 | struct btrfs_space_info *space_info, u64 num_bytes, |
| 4863 | 4864 | u64 orig_bytes, int state) |
| 4864 | 4865 | { |
| 4865 | − struct btrfs_root *root = fs_info->fs_root; | |
| 4866 | + struct btrfs_root *root = fs_info->extent_root; | |
| 4866 | 4867 | struct btrfs_trans_handle *trans; |
| 4867 | 4868 | int nr; |
| 4868 | 4869 | int ret = 0; |
| @@ -5062,7 +5063,7 @@ static void priority_reclaim_metadata_space(struct btrfs_fs_info *fs_info, · 193 unmodified lines | ||
| 5062 | 5063 | int flush_state = FLUSH_DELAYED_ITEMS_NR; |
| 5063 | 5064 | |
| 5064 | 5065 | spin_lock(&space_info->lock); |
| 5065 | − to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info->fs_root, | |
| 5066 | + to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info->extent_root, | |
| 5066 | 5067 | space_info); |
| 5067 | 5068 | if (!to_reclaim) { |
| 5068 | 5069 | spin_unlock(&space_info->lock); |
| @@ -2458,7 +2458,7 @@ void end_extent_writepage(struct page *page, int err, u64 start, u64 end) · 2457 unmodified lines | ||
| 2458 | 2458 | if (!uptodate) { |
| 2459 | 2459 | ClearPageUptodate(page); |
| 2460 | 2460 | SetPageError(page); |
| 2461 | − ret = ret < 0 ? ret : -EIO; | |
| 2461 | + ret = err < 0 ? err : -EIO; | |
| 2462 | 2462 | mapping_set_error(page->mapping, ret); |
| 2463 | 2463 | } |
| 2464 | 2464 | } |
| @@ -4377,6 +4377,123 @@ static struct extent_map *get_extent_skip_holes(struct inode *inode, · 1912 unmodified lines | ||
| 4377 | 4377 | return NULL; |
| 4378 | 4378 | } |
| 4379 | 4379 | |
| 4380 | +/* | |
| 4381 | + * To cache previous fiemap extent | |
| 4382 | + * | |
| 4383 | + * Will be used for merging fiemap extent | |
| 4384 | + */ | |
| 4385 | +struct fiemap_cache { | |
| 4386 | + u64 offset; | |
| 4387 | + u64 phys; | |
| 4388 | + u64 len; | |
| 4389 | + u32 flags; | |
| 4390 | + bool cached; | |
| 4391 | +}; | |
| 4392 | + | |
| 4393 | +/* | |
| 4394 | + * Helper to submit fiemap extent. | |
| 4395 | + * | |
| 4396 | + * Will try to merge current fiemap extent specified by @offset, @phys, | |
| 4397 | + * @len and @flags with cached one. | |
| 4398 | + * And only when we fails to merge, cached one will be submitted as | |
| 4399 | + * fiemap extent. | |
| 4400 | + * | |
| 4401 | + * Return value is the same as fiemap_fill_next_extent(). | |
| 4402 | + */ | |
| 4403 | +static int emit_fiemap_extent(struct fiemap_extent_info *fieinfo, | |
| 4404 | + struct fiemap_cache *cache, | |
| 4405 | + u64 offset, u64 phys, u64 len, u32 flags) | |
| 4406 | +{ | |
| 4407 | + int ret = 0; | |
| 4408 | + | |
| 4409 | + if (!cache->cached) | |
| 4410 | + goto assign; | |
| 4411 | + | |
| 4412 | + /* | |
| 4413 | + * Sanity check, extent_fiemap() should have ensured that new | |
| 4414 | + * fiemap extent won't overlap with cahced one. | |
| 4415 | + * Not recoverable. | |
| 4416 | + * | |
| 4417 | + * NOTE: Physical address can overlap, due to compression | |
| 4418 | + */ | |
| 4419 | + if (cache->offset + cache->len > offset) { | |
| 4420 | + WARN_ON(1); | |
| 4421 | + return -EINVAL; | |
| 4422 | + } | |
| 4423 | + | |
| 4424 | + /* | |
| 4425 | + * Only merges fiemap extents if | |
| 4426 | + * 1) Their logical addresses are continuous | |
| 4427 | + * | |
| 4428 | + * 2) Their physical addresses are continuous | |
| 4429 | + * So truly compressed (physical size smaller than logical size) | |
| 4430 | + * extents won't get merged with each other | |
| 4431 | + * | |
| 4432 | + * 3) Share same flags except FIEMAP_EXTENT_LAST | |
| 4433 | + * So regular extent won't get merged with prealloc extent | |
| 4434 | + */ | |
| 4435 | + if (cache->offset + cache->len == offset && | |
| 4436 | + cache->phys + cache->len == phys && | |
| 4437 | + (cache->flags & ~FIEMAP_EXTENT_LAST) == | |
| 4438 | + (flags & ~FIEMAP_EXTENT_LAST)) { | |
| 4439 | + cache->len += len; | |
| 4440 | + cache->flags |= flags; | |
| 4441 | + goto try_submit_last; | |
| 4442 | + } | |
| 4443 | + | |
| 4444 | + /* Not mergeable, need to submit cached one */ | |
| 4445 | + ret = fiemap_fill_next_extent(fieinfo, cache->offset, cache->phys, | |
| 4446 | + cache->len, cache->flags); | |
| 4447 | + cache->cached = false; | |
| 4448 | + if (ret) | |
| 4449 | + return ret; | |
| 4450 | +assign: | |
| 4451 | + cache->cached = true; | |
| 4452 | + cache->offset = offset; | |
| 4453 | + cache->phys = phys; | |
| 4454 | + cache->len = len; | |
| 4455 | + cache->flags = flags; | |
| 4456 | +try_submit_last: | |
| 4457 | + if (cache->flags & FIEMAP_EXTENT_LAST) { | |
| 4458 | + ret = fiemap_fill_next_extent(fieinfo, cache->offset, | |
| 4459 | + cache->phys, cache->len, cache->flags); | |
| 4460 | + cache->cached = false; | |
| 4461 | + } | |
| 4462 | + return ret; | |
| 4463 | +} | |
| 4464 | + | |
| 4465 | +/* | |
| 4466 | + * Sanity check for fiemap cache | |
| 4467 | + * | |
| 4468 | + * All fiemap cache should be submitted by emit_fiemap_extent() | |
| 4469 | + * Iteration should be terminated either by last fiemap extent or | |
| 4470 | + * fieinfo->fi_extents_max. | |
| 4471 | + * So no cached fiemap should exist. | |
| 4472 | + */ | |
| 4473 | +static int check_fiemap_cache(struct btrfs_fs_info *fs_info, | |
| 4474 | + struct fiemap_extent_info *fieinfo, | |
| 4475 | + struct fiemap_cache *cache) | |
| 4476 | +{ | |
| 4477 | + int ret; | |
| 4478 | + | |
| 4479 | + if (!cache->cached) | |
| 4480 | + return 0; | |
| 4481 | + | |
| 4482 | + /* Small and recoverbale problem, only to info developer */ | |
| 4483 | +#ifdef CONFIG_BTRFS_DEBUG | |
| 4484 | + WARN_ON(1); | |
| 4485 | +#endif | |
| 4486 | + btrfs_warn(fs_info, | |
| 4487 | + "unhandled fiemap cache detected: offset=%llu phys=%llu len=%llu flags=0x%x", | |
| 4488 | + cache->offset, cache->phys, cache->len, cache->flags); | |
| 4489 | + ret = fiemap_fill_next_extent(fieinfo, cache->offset, cache->phys, | |
| 4490 | + cache->len, cache->flags); | |
| 4491 | + cache->cached = false; | |
| 4492 | + if (ret > 0) | |
| 4493 | + ret = 0; | |
| 4494 | + return ret; | |
| 4495 | +} | |
| 4496 | + | |
| 4380 | 4497 | int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
| 4381 | 4498 | __u64 start, __u64 len, get_extent_t *get_extent) |
| 4382 | 4499 | { |
| @@ -4394,6 +4511,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 11 unmodified lines | ||
| 4394 | 4511 | struct extent_state *cached_state = NULL; |
| 4395 | 4512 | struct btrfs_path *path; |
| 4396 | 4513 | struct btrfs_root *root = BTRFS_I(inode)->root; |
| 4514 | + struct fiemap_cache cache = { 0 }; | |
| 4397 | 4515 | int end = 0; |
| 4398 | 4516 | u64 em_start = 0; |
| 4399 | 4517 | u64 em_len = 0; |
| @@ -4573,8 +4691,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 173 unmodified lines | ||
| 4573 | 4691 | flags |= FIEMAP_EXTENT_LAST; |
| 4574 | 4692 | end = 1; |
| 4575 | 4693 | } |
| 4576 | − ret = fiemap_fill_next_extent(fieinfo, em_start, disko, | |
| 4577 | − em_len, flags); | |
| 4694 | + ret = emit_fiemap_extent(fieinfo, &cache, em_start, disko, | |
| 4695 | + em_len, flags); | |
| 4578 | 4696 | if (ret) { |
| 4579 | 4697 | if (ret == 1) |
| 4580 | 4698 | ret = 0; |
| @@ -4582,6 +4700,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, · 1 unmodified line | ||
| 4582 | 4700 | } |
| 4583 | 4701 | } |
| 4584 | 4702 | out_free: |
| 4703 | + if (!ret) | |
| 4704 | + ret = check_fiemap_cache(root->fs_info, fieinfo, &cache); | |
| 4585 | 4705 | free_extent_map(em); |
| 4586 | 4706 | out: |
| 4587 | 4707 | btrfs_free_path(path); |
| @@ -38,6 +38,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length) · 37 unmodified lines | ||
| 38 | 38 | { |
| 39 | 39 | SHASH_DESC_ON_STACK(shash, tfm); |
| 40 | 40 | u32 *ctx = (u32 *)shash_desc_ctx(shash); |
| 41 | + u32 retval; | |
| 41 | 42 | int err; |
| 42 | 43 | |
| 43 | 44 | shash->tfm = tfm; |
| @@ -47,5 +48,7 @@ u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length) · 3 unmodified lines | ||
| 47 | 48 | err = crypto_shash_update(shash, address, length); |
| 48 | 49 | BUG_ON(err); |
| 49 | 50 | |
| 50 | − return *ctx; | |
| 51 | + retval = *ctx; | |
| 52 | + barrier_data(ctx); | |
| 53 | + return retval; | |
| 51 | 54 | } |
| @@ -2952,7 +2952,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) · 2951 unmodified lines | ||
| 2952 | 2952 | |
| 2953 | 2953 | ret = test_range_bit(io_tree, ordered_extent->file_offset, |
| 2954 | 2954 | ordered_extent->file_offset + ordered_extent->len - 1, |
| 2955 | − EXTENT_DEFRAG, 1, cached_state); | |
| 2955 | + EXTENT_DEFRAG, 0, cached_state); | |
| 2956 | 2956 | if (ret) { |
| 2957 | 2957 | u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item); |
| 2958 | 2958 | if (0 && last_snapshot >= BTRFS_I(inode)->generation) |
| @@ -7483,8 +7483,8 @@ bool btrfs_page_exists_in_range(struct inode *inode, loff_t start, loff_t end) · 4524 unmodified lines | ||
| 7483 | 7483 | int found = false; |
| 7484 | 7484 | void **pagep = NULL; |
| 7485 | 7485 | struct page *page = NULL; |
| 7486 | − int start_idx; | |
| 7487 | − int end_idx; | |
| 7486 | + unsigned long start_idx; | |
| 7487 | + unsigned long end_idx; | |
| 7488 | 7488 | |
| 7489 | 7489 | start_idx = start >> PAGE_SHIFT; |
| 7490 | 7490 | |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de> |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | +#include <linux/quotaops.h> | |
| 7 | 8 | #include "ext4_jbd2.h" |
| 8 | 9 | #include "ext4.h" |
| 9 | 10 | #include "xattr.h" |
| @@ -232,6 +233,9 @@ ext4_set_acl(struct inode *inode, struct posix_acl *acl, int type) · 222 unmodified lines | ||
| 232 | 233 | handle_t *handle; |
| 233 | 234 | int error, retries = 0; |
| 234 | 235 | |
| 236 | + error = dquot_initialize(inode); | |
| 237 | + if (error) | |
| 238 | + return error; | |
| 235 | 239 | retry: |
| 236 | 240 | handle = ext4_journal_start(inode, EXT4_HT_XATTR, |
| 237 | 241 | ext4_jbd2_credits_xattr(inode)); |
| @@ -2523,7 +2523,6 @@ extern int ext4_search_dir(struct buffer_head *bh, · 2522 unmodified lines | ||
| 2523 | 2523 | int buf_size, |
| 2524 | 2524 | struct inode *dir, |
| 2525 | 2525 | struct ext4_filename *fname, |
| 2526 | − const struct qstr *d_name, | |
| 2527 | 2526 | unsigned int offset, |
| 2528 | 2527 | struct ext4_dir_entry_2 **res_dir); |
| 2529 | 2528 | extern int ext4_generic_delete_entry(handle_t *handle, |
| @@ -3007,7 +3006,6 @@ extern int htree_inlinedir_to_tree(struct file *dir_file, · 477 unmodified lines | ||
| 3007 | 3006 | int *has_inline_data); |
| 3008 | 3007 | extern struct buffer_head *ext4_find_inline_entry(struct inode *dir, |
| 3009 | 3008 | struct ext4_filename *fname, |
| 3010 | − const struct qstr *d_name, | |
| 3011 | 3009 | struct ext4_dir_entry_2 **res_dir, |
| 3012 | 3010 | int *has_inline_data); |
| 3013 | 3011 | extern int ext4_delete_inline_entry(handle_t *handle, |
| @@ -3413,13 +3413,13 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, · 3412 unmodified lines | ||
| 3413 | 3413 | struct ext4_sb_info *sbi; |
| 3414 | 3414 | struct ext4_extent_header *eh; |
| 3415 | 3415 | struct ext4_map_blocks split_map; |
| 3416 | − struct ext4_extent zero_ex; | |
| 3416 | + struct ext4_extent zero_ex1, zero_ex2; | |
| 3417 | 3417 | struct ext4_extent *ex, *abut_ex; |
| 3418 | 3418 | ext4_lblk_t ee_block, eof_block; |
| 3419 | 3419 | unsigned int ee_len, depth, map_len = map->m_len; |
| 3420 | 3420 | int allocated = 0, max_zeroout = 0; |
| 3421 | 3421 | int err = 0; |
| 3422 | − int split_flag = 0; | |
| 3422 | + int split_flag = EXT4_EXT_DATA_VALID2; | |
| 3423 | 3423 | |
| 3424 | 3424 | ext_debug("ext4_ext_convert_to_initialized: inode %lu, logical" |
| 3425 | 3425 | "block %llu, max_blocks %u\n", inode->i_ino, |
| @@ -3436,7 +3436,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, · 10 unmodified lines | ||
| 3436 | 3436 | ex = path[depth].p_ext; |
| 3437 | 3437 | ee_block = le32_to_cpu(ex->ee_block); |
| 3438 | 3438 | ee_len = ext4_ext_get_actual_len(ex); |
| 3439 | − zero_ex.ee_len = 0; | |
| 3439 | + zero_ex1.ee_len = 0; | |
| 3440 | + zero_ex2.ee_len = 0; | |
| 3440 | 3441 | |
| 3441 | 3442 | trace_ext4_ext_convert_to_initialized_enter(inode, map, ex); |
| 3442 | 3443 | |
| @@ -3576,62 +3577,52 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, · 133 unmodified lines | ||
| 3576 | 3577 | if (ext4_encrypted_inode(inode)) |
| 3577 | 3578 | max_zeroout = 0; |
| 3578 | 3579 | |
| 3579 | − /* If extent is less than s_max_zeroout_kb, zeroout directly */ | |
| 3580 | − if (max_zeroout && (ee_len <= max_zeroout)) { | |
| 3581 | − err = ext4_ext_zeroout(inode, ex); | |
| 3582 | − if (err) | |
| 3583 | − goto out; | |
| 3584 | − zero_ex.ee_block = ex->ee_block; | |
| 3585 | − zero_ex.ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)); | |
| 3586 | − ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex)); | |
| 3587 | − | |
| 3588 | − err = ext4_ext_get_access(handle, inode, path + depth); | |
| 3589 | − if (err) | |
| 3590 | − goto out; | |
| 3591 | − ext4_ext_mark_initialized(ex); | |
| 3592 | − ext4_ext_try_to_merge(handle, inode, path, ex); | |
| 3593 | − err = ext4_ext_dirty(handle, inode, path + path->p_depth); | |
| 3594 | − goto out; | |
| 3595 | − } | |
| 3596 | − | |
| 3597 | 3580 | /* |
| 3598 | − * four cases: | |
| 3581 | + * five cases: | |
| 3599 | 3582 | * 1. split the extent into three extents. |
| 3600 | − * 2. split the extent into two extents, zeroout the first half. | |
| 3601 | − * 3. split the extent into two extents, zeroout the second half. | |
| 3583 | + * 2. split the extent into two extents, zeroout the head of the first | |
| 3584 | + * extent. | |
| 3585 | + * 3. split the extent into two extents, zeroout the tail of the second | |
| 3586 | + * extent. | |
| 3602 | 3587 | * 4. split the extent into two extents with out zeroout. |
| 3588 | + * 5. no splitting needed, just possibly zeroout the head and / or the | |
| 3589 | + * tail of the extent. | |
| 3603 | 3590 | */ |
| 3604 | 3591 | split_map.m_lblk = map->m_lblk; |
| 3605 | 3592 | split_map.m_len = map->m_len; |
| 3606 | 3593 | |
| 3607 | − if (max_zeroout && (allocated > map->m_len)) { | |
| 3594 | + if (max_zeroout && (allocated > split_map.m_len)) { | |
| 3608 | 3595 | if (allocated <= max_zeroout) { |
| 3609 | − /* case 3 */ | |
| 3610 | − zero_ex.ee_block = | |
| 3611 | − cpu_to_le32(map->m_lblk); | |
| 3612 | − zero_ex.ee_len = cpu_to_le16(allocated); | |
| 3613 | − ext4_ext_store_pblock(&zero_ex, | |
| 3614 | − ext4_ext_pblock(ex) + map->m_lblk - ee_block); | |
| 3615 | − err = ext4_ext_zeroout(inode, &zero_ex); | |
| 3596 | + /* case 3 or 5 */ | |
| 3597 | + zero_ex1.ee_block = | |
| 3598 | + cpu_to_le32(split_map.m_lblk + | |
| 3599 | + split_map.m_len); | |
| 3600 | + zero_ex1.ee_len = | |
| 3601 | + cpu_to_le16(allocated - split_map.m_len); | |
| 3602 | + ext4_ext_store_pblock(&zero_ex1, | |
| 3603 | + ext4_ext_pblock(ex) + split_map.m_lblk + | |
| 3604 | + split_map.m_len - ee_block); | |
| 3605 | + err = ext4_ext_zeroout(inode, &zero_ex1); | |
| 3616 | 3606 | if (err) |
| 3617 | 3607 | goto out; |
| 3618 | − split_map.m_lblk = map->m_lblk; | |
| 3619 | 3608 | split_map.m_len = allocated; |
| 3620 | − } else if (map->m_lblk - ee_block + map->m_len < max_zeroout) { | |
| 3621 | − /* case 2 */ | |
| 3622 | − if (map->m_lblk != ee_block) { | |
| 3623 | − zero_ex.ee_block = ex->ee_block; | |
| 3624 | − zero_ex.ee_len = cpu_to_le16(map->m_lblk - | |
| 3609 | + } | |
| 3610 | + if (split_map.m_lblk - ee_block + split_map.m_len < | |
| 3611 | + max_zeroout) { | |
| 3612 | + /* case 2 or 5 */ | |
| 3613 | + if (split_map.m_lblk != ee_block) { | |
| 3614 | + zero_ex2.ee_block = ex->ee_block; | |
| 3615 | + zero_ex2.ee_len = cpu_to_le16(split_map.m_lblk - | |
| 3625 | 3616 | ee_block); |
| 3626 | − ext4_ext_store_pblock(&zero_ex, | |
| 3617 | + ext4_ext_store_pblock(&zero_ex2, | |
| 3627 | 3618 | ext4_ext_pblock(ex)); |
| 3628 | − err = ext4_ext_zeroout(inode, &zero_ex); | |
| 3619 | + err = ext4_ext_zeroout(inode, &zero_ex2); | |
| 3629 | 3620 | if (err) |
| 3630 | 3621 | goto out; |
| 3631 | 3622 | } |
| 3632 | 3623 | |
| 3624 | + split_map.m_len += split_map.m_lblk - ee_block; | |
| 3633 | 3625 | split_map.m_lblk = ee_block; |
| 3634 | − split_map.m_len = map->m_lblk - ee_block + map->m_len; | |
| 3635 | 3626 | allocated = map->m_len; |
| 3636 | 3627 | } |
| 3637 | 3628 | } |
| @@ -3642,8 +3633,11 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, · 4 unmodified lines | ||
| 3642 | 3633 | err = 0; |
| 3643 | 3634 | out: |
| 3644 | 3635 | /* If we have gotten a failure, don't zero out status tree */ |
| 3645 | − if (!err) | |
| 3646 | − err = ext4_zeroout_es(inode, &zero_ex); | |
| 3636 | + if (!err) { | |
| 3637 | + err = ext4_zeroout_es(inode, &zero_ex1); | |
| 3638 | + if (!err) | |
| 3639 | + err = ext4_zeroout_es(inode, &zero_ex2); | |
| 3640 | + } | |
| 3647 | 3641 | return err ? err : allocated; |
| 3648 | 3642 | } |
| 3649 | 3643 | |
| @@ -4883,6 +4877,8 @@ static long ext4_zero_range(struct file *file, loff_t offset, · 1233 unmodified lines | ||
| 4883 | 4877 | |
| 4884 | 4878 | /* Zero out partial block at the edges of the range */ |
| 4885 | 4879 | ret = ext4_zero_partial_blocks(handle, inode, offset, len); |
| 4880 | + if (ret >= 0) | |
| 4881 | + ext4_update_inode_fsync_trans(handle, inode, 1); | |
| 4886 | 4882 | |
| 4887 | 4883 | if (file->f_flags & O_SYNC) |
| 4888 | 4884 | ext4_handle_sync(handle); |
| @@ -5569,6 +5565,7 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) · 680 unmodified lines | ||
| 5569 | 5565 | ext4_handle_sync(handle); |
| 5570 | 5566 | inode->i_mtime = inode->i_ctime = current_time(inode); |
| 5571 | 5567 | ext4_mark_inode_dirty(handle, inode); |
| 5568 | + ext4_update_inode_fsync_trans(handle, inode, 1); | |
| 5572 | 5569 | |
| 5573 | 5570 | out_stop: |
| 5574 | 5571 | ext4_journal_stop(handle); |
| @@ -5742,6 +5739,8 @@ int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len) · 167 unmodified lines | ||
| 5742 | 5739 | up_write(&EXT4_I(inode)->i_data_sem); |
| 5743 | 5740 | if (IS_SYNC(inode)) |
| 5744 | 5741 | ext4_handle_sync(handle); |
| 5742 | + if (ret >= 0) | |
| 5743 | + ext4_update_inode_fsync_trans(handle, inode, 1); | |
| 5745 | 5744 | |
| 5746 | 5745 | out_stop: |
| 5747 | 5746 | ext4_journal_stop(handle); |
| @@ -474,57 +474,37 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, · 473 unmodified lines | ||
| 474 | 474 | endoff = (loff_t)end_blk << blkbits; |
| 475 | 475 | |
| 476 | 476 | index = startoff >> PAGE_SHIFT; |
| 477 | − end = endoff >> PAGE_SHIFT; | |
| 477 | + end = (endoff - 1) >> PAGE_SHIFT; | |
| 478 | 478 | |
| 479 | 479 | pagevec_init(&pvec, 0); |
| 480 | 480 | do { |
| 481 | 481 | int i, num; |
| 482 | 482 | unsigned long nr_pages; |
| 483 | 483 | |
| 484 | − num = min_t(pgoff_t, end - index, PAGEVEC_SIZE); | |
| 484 | + num = min_t(pgoff_t, end - index, PAGEVEC_SIZE - 1) + 1; | |
| 485 | 485 | nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index, |
| 486 | 486 | (pgoff_t)num); |
| 487 | − if (nr_pages == 0) { | |
| 488 | − if (whence == SEEK_DATA) | |
| 489 | − break; | |
| 490 | − | |
| 491 | − BUG_ON(whence != SEEK_HOLE); | |
| 492 | − /* | |
| 493 | − * If this is the first time to go into the loop and | |
| 494 | − * offset is not beyond the end offset, it will be a | |
| 495 | − * hole at this offset | |
| 496 | − */ | |
| 497 | − if (lastoff == startoff || lastoff < endoff) | |
| 498 | − found = 1; | |
| 499 | − break; | |
| 500 | − } | |
| 501 | − | |
| 502 | − /* | |
| 503 | − * If this is the first time to go into the loop and | |
| 504 | − * offset is smaller than the first page offset, it will be a | |
| 505 | − * hole at this offset. | |
| 506 | − */ | |
| 507 | − if (lastoff == startoff && whence == SEEK_HOLE && | |
| 508 | − lastoff < page_offset(pvec.pages[0])) { | |
| 509 | − found = 1; | |
| 487 | + if (nr_pages == 0) | |
| 510 | 488 | break; |
| 511 | − } | |
| 512 | 489 | |
| 513 | 490 | for (i = 0; i < nr_pages; i++) { |
| 514 | 491 | struct page *page = pvec.pages[i]; |
| 515 | 492 | struct buffer_head *bh, *head; |
| 516 | 493 | |
| 517 | 494 | /* |
| 518 | − * If the current offset is not beyond the end of given | |
| 519 | − * range, it will be a hole. | |
| 495 | + * If current offset is smaller than the page offset, | |
| 496 | + * there is a hole at this offset. | |
| 520 | 497 | */ |
| 521 | − if (lastoff < endoff && whence == SEEK_HOLE && | |
| 522 | − page->index > end) { | |
| 498 | + if (whence == SEEK_HOLE && lastoff < endoff && | |
| 499 | + lastoff < page_offset(pvec.pages[i])) { | |
| 523 | 500 | found = 1; |
| 524 | 501 | *offset = lastoff; |
| 525 | 502 | goto out; |
| 526 | 503 | } |
| 527 | 504 | |
| 505 | + if (page->index > end) | |
| 506 | + goto out; | |
| 507 | + | |
| 528 | 508 | lock_page(page); |
| 529 | 509 | |
| 530 | 510 | if (unlikely(page->mapping != inode->i_mapping)) { |
| @@ -564,20 +544,18 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, · 33 unmodified lines | ||
| 564 | 544 | unlock_page(page); |
| 565 | 545 | } |
| 566 | 546 | |
| 567 | − /* | |
| 568 | − * The no. of pages is less than our desired, that would be a | |
| 569 | − * hole in there. | |
| 570 | − */ | |
| 571 | − if (nr_pages < num && whence == SEEK_HOLE) { | |
| 572 | − found = 1; | |
| 573 | − *offset = lastoff; | |
| 547 | + /* The no. of pages is less than our desired, we are done. */ | |
| 548 | + if (nr_pages < num) | |
| 574 | 549 | break; |
| 575 | − } | |
| 576 | 550 | |
| 577 | 551 | index = pvec.pages[i - 1]->index + 1; |
| 578 | 552 | pagevec_release(&pvec); |
| 579 | 553 | } while (index <= end); |
| 580 | 554 | |
| 555 | + if (whence == SEEK_HOLE && lastoff < endoff) { | |
| 556 | + found = 1; | |
| 557 | + *offset = lastoff; | |
| 558 | + } | |
| 581 | 559 | out: |
| 582 | 560 | pagevec_release(&pvec); |
| 583 | 561 | return found; |
| @@ -1627,7 +1627,6 @@ out: · 1626 unmodified lines | ||
| 1627 | 1627 | |
| 1628 | 1628 | struct buffer_head *ext4_find_inline_entry(struct inode *dir, |
| 1629 | 1629 | struct ext4_filename *fname, |
| 1630 | − const struct qstr *d_name, | |
| 1631 | 1630 | struct ext4_dir_entry_2 **res_dir, |
| 1632 | 1631 | int *has_inline_data) |
| 1633 | 1632 | { |
| @@ -1649,7 +1648,7 @@ struct buffer_head *ext4_find_inline_entry(struct inode *dir, · 15 unmodified lines | ||
| 1649 | 1648 | EXT4_INLINE_DOTDOT_SIZE; |
| 1650 | 1649 | inline_size = EXT4_MIN_INLINE_DATA_SIZE - EXT4_INLINE_DOTDOT_SIZE; |
| 1651 | 1650 | ret = ext4_search_dir(iloc.bh, inline_start, inline_size, |
| 1652 | − dir, fname, d_name, 0, res_dir); | |
| 1651 | + dir, fname, 0, res_dir); | |
| 1653 | 1652 | if (ret == 1) |
| 1654 | 1653 | goto out_find; |
| 1655 | 1654 | if (ret < 0) |
| @@ -1662,7 +1661,7 @@ struct buffer_head *ext4_find_inline_entry(struct inode *dir, · 6 unmodified lines | ||
| 1662 | 1661 | inline_size = ext4_get_inline_size(dir) - EXT4_MIN_INLINE_DATA_SIZE; |
| 1663 | 1662 | |
| 1664 | 1663 | ret = ext4_search_dir(iloc.bh, inline_start, inline_size, |
| 1665 | − dir, fname, d_name, 0, res_dir); | |
| 1664 | + dir, fname, 0, res_dir); | |
| 1666 | 1665 | if (ret == 1) |
| 1667 | 1666 | goto out_find; |
| 1668 | 1667 | |
| @@ -2124,15 +2124,29 @@ static int ext4_writepage(struct page *page, · 2123 unmodified lines | ||
| 2124 | 2124 | static int mpage_submit_page(struct mpage_da_data *mpd, struct page *page) |
| 2125 | 2125 | { |
| 2126 | 2126 | int len; |
| 2127 | − loff_t size = i_size_read(mpd->inode); | |
| 2127 | + loff_t size; | |
| 2128 | 2128 | int err; |
| 2129 | 2129 | |
| 2130 | 2130 | BUG_ON(page->index != mpd->first_page); |
| 2131 | + clear_page_dirty_for_io(page); | |
| 2132 | + /* | |
| 2133 | + * We have to be very careful here! Nothing protects writeback path | |
| 2134 | + * against i_size changes and the page can be writeably mapped into | |
| 2135 | + * page tables. So an application can be growing i_size and writing | |
| 2136 | + * data through mmap while writeback runs. clear_page_dirty_for_io() | |
| 2137 | + * write-protects our page in page tables and the page cannot get | |
| 2138 | + * written to again until we release page lock. So only after | |
| 2139 | + * clear_page_dirty_for_io() we are safe to sample i_size for | |
| 2140 | + * ext4_bio_write_page() to zero-out tail of the written page. We rely | |
| 2141 | + * on the barrier provided by TestClearPageDirty in | |
| 2142 | + * clear_page_dirty_for_io() to make sure i_size is really sampled only | |
| 2143 | + * after page tables are updated. | |
| 2144 | + */ | |
| 2145 | + size = i_size_read(mpd->inode); | |
| 2131 | 2146 | if (page->index == size >> PAGE_SHIFT) |
| 2132 | 2147 | len = size & ~PAGE_MASK; |
| 2133 | 2148 | else |
| 2134 | 2149 | len = PAGE_SIZE; |
| 2135 | − clear_page_dirty_for_io(page); | |
| 2136 | 2150 | err = ext4_bio_write_page(&mpd->io_submit, page, len, mpd->wbc, false); |
| 2137 | 2151 | if (!err) |
| 2138 | 2152 | mpd->wbc->nr_to_write--; |
| @@ -3629,9 +3643,6 @@ static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter) · 1490 unmodified lines | ||
| 3629 | 3643 | get_block_func = ext4_dio_get_block_unwritten_async; |
| 3630 | 3644 | dio_flags = DIO_LOCKING; |
| 3631 | 3645 | } |
| 3632 | −#ifdef CONFIG_EXT4_FS_ENCRYPTION | |
| 3633 | − BUG_ON(ext4_encrypted_inode(inode) && S_ISREG(inode->i_mode)); | |
| 3634 | −#endif | |
| 3635 | 3646 | ret = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter, |
| 3636 | 3647 | get_block_func, ext4_end_io_dio, NULL, |
| 3637 | 3648 | dio_flags); |
| @@ -3713,7 +3724,7 @@ static ssize_t ext4_direct_IO_read(struct kiocb *iocb, struct iov_iter *iter) · 75 unmodified lines | ||
| 3713 | 3724 | */ |
| 3714 | 3725 | inode_lock_shared(inode); |
| 3715 | 3726 | ret = filemap_write_and_wait_range(mapping, iocb->ki_pos, |
| 3716 | − iocb->ki_pos + count); | |
| 3727 | + iocb->ki_pos + count - 1); | |
| 3717 | 3728 | if (ret) |
| 3718 | 3729 | goto out_unlock; |
| 3719 | 3730 | ret = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, |
| @@ -4207,6 +4218,8 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) · 487 unmodified lines | ||
| 4207 | 4218 | |
| 4208 | 4219 | inode->i_mtime = inode->i_ctime = current_time(inode); |
| 4209 | 4220 | ext4_mark_inode_dirty(handle, inode); |
| 4221 | + if (ret >= 0) | |
| 4222 | + ext4_update_inode_fsync_trans(handle, inode, 1); | |
| 4210 | 4223 | out_stop: |
| 4211 | 4224 | ext4_journal_stop(handle); |
| 4212 | 4225 | out_dio: |
| @@ -5637,8 +5650,9 @@ static int ext4_expand_extra_isize(struct inode *inode, · 1424 unmodified lines | ||
| 5637 | 5650 | /* No extended attributes present */ |
| 5638 | 5651 | if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR) || |
| 5639 | 5652 | header->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC)) { |
| 5640 | − memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE, 0, | |
| 5641 | − new_extra_isize); | |
| 5653 | + memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE + | |
| 5654 | + EXT4_I(inode)->i_extra_isize, 0, | |
| 5655 | + new_extra_isize - EXT4_I(inode)->i_extra_isize); | |
| 5642 | 5656 | EXT4_I(inode)->i_extra_isize = new_extra_isize; |
| 5643 | 5657 | return 0; |
| 5644 | 5658 | } |
| @@ -3887,7 +3887,8 @@ ext4_mb_discard_group_preallocations(struct super_block *sb, · 3886 unmodified lines | ||
| 3887 | 3887 | |
| 3888 | 3888 | err = ext4_mb_load_buddy(sb, group, &e4b); |
| 3889 | 3889 | if (err) { |
| 3890 | − ext4_error(sb, "Error loading buddy information for %u", group); | |
| 3890 | + ext4_warning(sb, "Error %d loading buddy information for %u", | |
| 3891 | + err, group); | |
| 3891 | 3892 | put_bh(bitmap_bh); |
| 3892 | 3893 | return 0; |
| 3893 | 3894 | } |
| @@ -4044,10 +4045,11 @@ repeat: · 150 unmodified lines | ||
| 4044 | 4045 | BUG_ON(pa->pa_type != MB_INODE_PA); |
| 4045 | 4046 | group = ext4_get_group_number(sb, pa->pa_pstart); |
| 4046 | 4047 | |
| 4047 | − err = ext4_mb_load_buddy(sb, group, &e4b); | |
| 4048 | + err = ext4_mb_load_buddy_gfp(sb, group, &e4b, | |
| 4049 | + GFP_NOFS|__GFP_NOFAIL); | |
| 4048 | 4050 | if (err) { |
| 4049 | − ext4_error(sb, "Error loading buddy information for %u", | |
| 4050 | − group); | |
| 4051 | + ext4_error(sb, "Error %d loading buddy information for %u", | |
| 4052 | + err, group); | |
| 4051 | 4053 | continue; |
| 4052 | 4054 | } |
| 4053 | 4055 | |
| @@ -4303,11 +4305,14 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb, · 249 unmodified lines | ||
| 4303 | 4305 | spin_unlock(&lg->lg_prealloc_lock); |
| 4304 | 4306 | |
| 4305 | 4307 | list_for_each_entry_safe(pa, tmp, &discard_list, u.pa_tmp_list) { |
| 4308 | + int err; | |
| 4306 | 4309 | |
| 4307 | 4310 | group = ext4_get_group_number(sb, pa->pa_pstart); |
| 4308 | − if (ext4_mb_load_buddy(sb, group, &e4b)) { | |
| 4309 | − ext4_error(sb, "Error loading buddy information for %u", | |
| 4310 | − group); | |
| 4311 | + err = ext4_mb_load_buddy_gfp(sb, group, &e4b, | |
| 4312 | + GFP_NOFS|__GFP_NOFAIL); | |
| 4313 | + if (err) { | |
| 4314 | + ext4_error(sb, "Error %d loading buddy information for %u", | |
| 4315 | + err, group); | |
| 4311 | 4316 | continue; |
| 4312 | 4317 | } |
| 4313 | 4318 | ext4_lock_group(sb, group); |
| @@ -5127,8 +5132,8 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group, · 813 unmodified lines | ||
| 5127 | 5132 | |
| 5128 | 5133 | ret = ext4_mb_load_buddy(sb, group, &e4b); |
| 5129 | 5134 | if (ret) { |
| 5130 | − ext4_error(sb, "Error in loading buddy " | |
| 5131 | − "information for %u", group); | |
| 5135 | + ext4_warning(sb, "Error %d loading buddy information for %u", | |
| 5136 | + ret, group); | |
| 5132 | 5137 | return ret; |
| 5133 | 5138 | } |
| 5134 | 5139 | bitmap = e4b.bd_bitmap; |
| @@ -1155,12 +1155,11 @@ errout: · 1154 unmodified lines | ||
| 1155 | 1155 | static inline int search_dirblock(struct buffer_head *bh, |
| 1156 | 1156 | struct inode *dir, |
| 1157 | 1157 | struct ext4_filename *fname, |
| 1158 | − const struct qstr *d_name, | |
| 1159 | 1158 | unsigned int offset, |
| 1160 | 1159 | struct ext4_dir_entry_2 **res_dir) |
| 1161 | 1160 | { |
| 1162 | 1161 | return ext4_search_dir(bh, bh->b_data, dir->i_sb->s_blocksize, dir, |
| 1163 | − fname, d_name, offset, res_dir); | |
| 1162 | + fname, offset, res_dir); | |
| 1164 | 1163 | } |
| 1165 | 1164 | |
| 1166 | 1165 | /* |
| @@ -1262,7 +1261,6 @@ static inline bool ext4_match(const struct ext4_filename *fname, · 95 unmodified lines | ||
| 1262 | 1261 | */ |
| 1263 | 1262 | int ext4_search_dir(struct buffer_head *bh, char *search_buf, int buf_size, |
| 1264 | 1263 | struct inode *dir, struct ext4_filename *fname, |
| 1265 | − const struct qstr *d_name, | |
| 1266 | 1264 | unsigned int offset, struct ext4_dir_entry_2 **res_dir) |
| 1267 | 1265 | { |
| 1268 | 1266 | struct ext4_dir_entry_2 * de; |
| @@ -1355,7 +1353,7 @@ static struct buffer_head * ext4_find_entry (struct inode *dir, · 86 unmodified lines | ||
| 1355 | 1353 | |
| 1356 | 1354 | if (ext4_has_inline_data(dir)) { |
| 1357 | 1355 | int has_inline_data = 1; |
| 1358 | − ret = ext4_find_inline_entry(dir, &fname, d_name, res_dir, | |
| 1356 | + ret = ext4_find_inline_entry(dir, &fname, res_dir, | |
| 1359 | 1357 | &has_inline_data); |
| 1360 | 1358 | if (has_inline_data) { |
| 1361 | 1359 | if (inlined) |
| @@ -1447,7 +1445,7 @@ restart: · 85 unmodified lines | ||
| 1447 | 1445 | goto next; |
| 1448 | 1446 | } |
| 1449 | 1447 | set_buffer_verified(bh); |
| 1450 | − i = search_dirblock(bh, dir, &fname, d_name, | |
| 1448 | + i = search_dirblock(bh, dir, &fname, | |
| 1451 | 1449 | block << EXT4_BLOCK_SIZE_BITS(sb), res_dir); |
| 1452 | 1450 | if (i == 1) { |
| 1453 | 1451 | EXT4_I(dir)->i_dir_start_lookup = block; |
| @@ -1488,7 +1486,6 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, · 34 unmodified lines | ||
| 1488 | 1486 | { |
| 1489 | 1487 | struct super_block * sb = dir->i_sb; |
| 1490 | 1488 | struct dx_frame frames[2], *frame; |
| 1491 | − const struct qstr *d_name = fname->usr_fname; | |
| 1492 | 1489 | struct buffer_head *bh; |
| 1493 | 1490 | ext4_lblk_t block; |
| 1494 | 1491 | int retval; |
| @@ -1505,7 +1502,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, · 10 unmodified lines | ||
| 1505 | 1502 | if (IS_ERR(bh)) |
| 1506 | 1503 | goto errout; |
| 1507 | 1504 | |
| 1508 | − retval = search_dirblock(bh, dir, fname, d_name, | |
| 1505 | + retval = search_dirblock(bh, dir, fname, | |
| 1509 | 1506 | block << EXT4_BLOCK_SIZE_BITS(sb), |
| 1510 | 1507 | res_dir); |
| 1511 | 1508 | if (retval == 1) |
| @@ -1530,7 +1527,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir, · 18 unmodified lines | ||
| 1530 | 1527 | |
| 1531 | 1528 | bh = NULL; |
| 1532 | 1529 | errout: |
| 1533 | − dxtrace(printk(KERN_DEBUG "%s not found\n", d_name->name)); | |
| 1530 | + dxtrace(printk(KERN_DEBUG "%s not found\n", fname->usr_fname->name)); | |
| 1534 | 1531 | success: |
| 1535 | 1532 | dx_release(frames); |
| 1536 | 1533 | return bh; |
| @@ -848,14 +848,9 @@ static inline void ext4_quota_off_umount(struct super_block *sb) · 847 unmodified lines | ||
| 848 | 848 | { |
| 849 | 849 | int type; |
| 850 | 850 | |
| 851 | − if (ext4_has_feature_quota(sb)) { | |
| 852 | − dquot_disable(sb, -1, | |
| 853 | − DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); | |
| 854 | − } else { | |
| 855 | − /* Use our quota_off function to clear inode flags etc. */ | |
| 856 | − for (type = 0; type < EXT4_MAXQUOTAS; type++) | |
| 857 | − ext4_quota_off(sb, type); | |
| 858 | − } | |
| 851 | + /* Use our quota_off function to clear inode flags etc. */ | |
| 852 | + for (type = 0; type < EXT4_MAXQUOTAS; type++) | |
| 853 | + ext4_quota_off(sb, type); | |
| 859 | 854 | } |
| 860 | 855 | #else |
| 861 | 856 | static inline void ext4_quota_off_umount(struct super_block *sb) |
| @@ -1179,6 +1174,9 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, · 317 unmodified lines | ||
| 1179 | 1174 | return res; |
| 1180 | 1175 | } |
| 1181 | 1176 | |
| 1177 | + res = dquot_initialize(inode); | |
| 1178 | + if (res) | |
| 1179 | + return res; | |
| 1182 | 1180 | retry: |
| 1183 | 1181 | handle = ext4_journal_start(inode, EXT4_HT_MISC, |
| 1184 | 1182 | ext4_jbd2_credits_xattr(inode)); |
| @@ -5485,7 +5483,7 @@ static int ext4_quota_off(struct super_block *sb, int type) · 4300 unmodified lines | ||
| 5485 | 5483 | goto out; |
| 5486 | 5484 | |
| 5487 | 5485 | err = dquot_quota_off(sb, type); |
| 5488 | − if (err) | |
| 5486 | + if (err || ext4_has_feature_quota(sb)) | |
| 5489 | 5487 | goto out_put; |
| 5490 | 5488 | |
| 5491 | 5489 | inode_lock(inode); |
| @@ -5505,6 +5503,7 @@ static int ext4_quota_off(struct super_block *sb, int type) · 13 unmodified lines | ||
| 5505 | 5503 | out_unlock: |
| 5506 | 5504 | inode_unlock(inode); |
| 5507 | 5505 | out_put: |
| 5506 | + lockdep_set_quota_inode(inode, I_DATA_SEM_NORMAL); | |
| 5508 | 5507 | iput(inode); |
| 5509 | 5508 | return err; |
| 5510 | 5509 | out: |
| @@ -888,6 +888,8 @@ inserted: · 887 unmodified lines | ||
| 888 | 888 | else { |
| 889 | 889 | u32 ref; |
| 890 | 890 | |
| 891 | + WARN_ON_ONCE(dquot_initialize_needed(inode)); | |
| 892 | + | |
| 891 | 893 | /* The old block is released after updating |
| 892 | 894 | the inode. */ |
| 893 | 895 | error = dquot_alloc_block(inode, |
| @@ -954,6 +956,8 @@ inserted: · 60 unmodified lines | ||
| 954 | 956 | /* We need to allocate a new block */ |
| 955 | 957 | ext4_fsblk_t goal, block; |
| 956 | 958 | |
| 959 | + WARN_ON_ONCE(dquot_initialize_needed(inode)); | |
| 960 | + | |
| 957 | 961 | goal = ext4_group_first_block_no(sb, |
| 958 | 962 | EXT4_I(inode)->i_block_group); |
| 959 | 963 | |
| @@ -1166,6 +1170,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, · 206 unmodified lines | ||
| 1166 | 1170 | return -EINVAL; |
| 1167 | 1171 | if (strlen(name) > 255) |
| 1168 | 1172 | return -ERANGE; |
| 1173 | + | |
| 1169 | 1174 | ext4_write_lock_xattr(inode, &no_expand); |
| 1170 | 1175 | |
| 1171 | 1176 | error = ext4_reserve_inode_write(handle, inode, &is.iloc); |
| @@ -1267,6 +1272,9 @@ ext4_xattr_set(struct inode *inode, int name_index, const char *name, · 95 unmodified lines | ||
| 1267 | 1272 | int error, retries = 0; |
| 1268 | 1273 | int credits = ext4_jbd2_credits_xattr(inode); |
| 1269 | 1274 | |
| 1275 | + error = dquot_initialize(inode); | |
| 1276 | + if (error) | |
| 1277 | + return error; | |
| 1270 | 1278 | retry: |
| 1271 | 1279 | handle = ext4_journal_start(inode, EXT4_HT_XATTR, credits); |
| 1272 | 1280 | if (IS_ERR(handle)) { |
| @@ -1078,6 +1078,7 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, · 1077 unmodified lines | ||
| 1078 | 1078 | { |
| 1079 | 1079 | SHASH_DESC_ON_STACK(shash, sbi->s_chksum_driver); |
| 1080 | 1080 | u32 *ctx = (u32 *)shash_desc_ctx(shash); |
| 1081 | + u32 retval; | |
| 1081 | 1082 | int err; |
| 1082 | 1083 | |
| 1083 | 1084 | shash->tfm = sbi->s_chksum_driver; |
| @@ -1087,7 +1088,9 @@ static inline u32 f2fs_crc32(struct f2fs_sb_info *sbi, const void *address, · 3 unmodified lines | ||
| 1087 | 1088 | err = crypto_shash_update(shash, address, length); |
| 1088 | 1089 | BUG_ON(err); |
| 1089 | 1090 | |
| 1090 | − return *ctx; | |
| 1091 | + retval = *ctx; | |
| 1092 | + barrier_data(ctx); | |
| 1093 | + return retval; | |
| 1091 | 1094 | } |
| 1092 | 1095 | |
| 1093 | 1096 | static inline bool f2fs_crc_valid(struct f2fs_sb_info *sbi, __u32 blk_crc, |
| @@ -680,6 +680,12 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask) · 679 unmodified lines | ||
| 680 | 680 | |
| 681 | 681 | rwsem_release(&journal->j_trans_commit_map, 1, _THIS_IP_); |
| 682 | 682 | handle->h_buffer_credits = nblocks; |
| 683 | + /* | |
| 684 | + * Restore the original nofs context because the journal restart | |
| 685 | + * is basically the same thing as journal stop and start. | |
| 686 | + * start_this_handle will start a new nofs context. | |
| 687 | + */ | |
| 688 | + memalloc_nofs_restore(handle->saved_alloc_context); | |
| 683 | 689 | ret = start_this_handle(journal, handle, gfp_mask); |
| 684 | 690 | return ret; |
| 685 | 691 | } |
| @@ -1512,6 +1512,22 @@ int dquot_initialize(struct inode *inode) · 1511 unmodified lines | ||
| 1512 | 1512 | } |
| 1513 | 1513 | EXPORT_SYMBOL(dquot_initialize); |
| 1514 | 1514 | |
| 1515 | +bool dquot_initialize_needed(struct inode *inode) | |
| 1516 | +{ | |
| 1517 | + struct dquot **dquots; | |
| 1518 | + int i; | |
| 1519 | + | |
| 1520 | + if (!dquot_active(inode)) | |
| 1521 | + return false; | |
| 1522 | + | |
| 1523 | + dquots = i_dquot(inode); | |
| 1524 | + for (i = 0; i < MAXQUOTAS; i++) | |
| 1525 | + if (!dquots[i] && sb_has_quota_active(inode->i_sb, i)) | |
| 1526 | + return true; | |
| 1527 | + return false; | |
| 1528 | +} | |
| 1529 | +EXPORT_SYMBOL(dquot_initialize_needed); | |
| 1530 | + | |
| 1515 | 1531 | /* |
| 1516 | 1532 | * Release all quotas referenced by inode. |
| 1517 | 1533 | * |
| @@ -672,6 +672,7 @@ void __inode_add_bytes(struct inode *inode, loff_t bytes) · 671 unmodified lines | ||
| 672 | 672 | inode->i_bytes -= 512; |
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | +EXPORT_SYMBOL(__inode_add_bytes); | |
| 675 | 676 | |
| 676 | 677 | void inode_add_bytes(struct inode *inode, loff_t bytes) |
| 677 | 678 | { |
| @@ -82,7 +82,8 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) · 81 unmodified lines | ||
| 82 | 82 | ufs_error (sb, "ufs_free_fragments", |
| 83 | 83 | "bit already cleared for fragment %u", i); |
| 84 | 84 | } |
| 85 | − | |
| 85 | + | |
| 86 | + inode_sub_bytes(inode, count << uspi->s_fshift); | |
| 86 | 87 | fs32_add(sb, &ucg->cg_cs.cs_nffree, count); |
| 87 | 88 | uspi->cs_total.cs_nffree += count; |
| 88 | 89 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); |
| @@ -184,6 +185,7 @@ do_more: · 95 unmodified lines | ||
| 184 | 185 | ufs_error(sb, "ufs_free_blocks", "freeing free fragment"); |
| 185 | 186 | } |
| 186 | 187 | ubh_setblock(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); |
| 188 | + inode_sub_bytes(inode, uspi->s_fpb << uspi->s_fshift); | |
| 187 | 189 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) |
| 188 | 190 | ufs_clusteracct (sb, ucpi, blkno, 1); |
| 189 | 191 | |
| @@ -494,6 +496,20 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, · 304 unmodified lines | ||
| 494 | 496 | return 0; |
| 495 | 497 | } |
| 496 | 498 | |
| 499 | +static bool try_add_frags(struct inode *inode, unsigned frags) | |
| 500 | +{ | |
| 501 | + unsigned size = frags * i_blocksize(inode); | |
| 502 | + spin_lock(&inode->i_lock); | |
| 503 | + __inode_add_bytes(inode, size); | |
| 504 | + if (unlikely((u32)inode->i_blocks != inode->i_blocks)) { | |
| 505 | + __inode_sub_bytes(inode, size); | |
| 506 | + spin_unlock(&inode->i_lock); | |
| 507 | + return false; | |
| 508 | + } | |
| 509 | + spin_unlock(&inode->i_lock); | |
| 510 | + return true; | |
| 511 | +} | |
| 512 | + | |
| 497 | 513 | static u64 ufs_add_fragments(struct inode *inode, u64 fragment, |
| 498 | 514 | unsigned oldcount, unsigned newcount) |
| 499 | 515 | { |
| @@ -530,6 +546,9 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment, · 30 unmodified lines | ||
| 530 | 546 | for (i = oldcount; i < newcount; i++) |
| 531 | 547 | if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_freeoff, fragno + i)) |
| 532 | 548 | return 0; |
| 549 | + | |
| 550 | + if (!try_add_frags(inode, count)) | |
| 551 | + return 0; | |
| 533 | 552 | /* |
| 534 | 553 | * Block can be extended |
| 535 | 554 | */ |
| @@ -647,6 +666,7 @@ cg_found: · 111 unmodified lines | ||
| 647 | 666 | ubh_setbit (UCPI_UBH(ucpi), ucpi->c_freeoff, goal + i); |
| 648 | 667 | i = uspi->s_fpb - count; |
| 649 | 668 | |
| 669 | + inode_sub_bytes(inode, i << uspi->s_fshift); | |
| 650 | 670 | fs32_add(sb, &ucg->cg_cs.cs_nffree, i); |
| 651 | 671 | uspi->cs_total.cs_nffree += i; |
| 652 | 672 | fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, i); |
| @@ -657,6 +677,8 @@ cg_found: · 4 unmodified lines | ||
| 657 | 677 | result = ufs_bitmap_search (sb, ucpi, goal, allocsize); |
| 658 | 678 | if (result == INVBLOCK) |
| 659 | 679 | return 0; |
| 680 | + if (!try_add_frags(inode, count)) | |
| 681 | + return 0; | |
| 660 | 682 | for (i = 0; i < count; i++) |
| 661 | 683 | ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, result + i); |
| 662 | 684 | |
| @@ -716,6 +738,8 @@ norot: · 53 unmodified lines | ||
| 716 | 738 | return INVBLOCK; |
| 717 | 739 | ucpi->c_rotor = result; |
| 718 | 740 | gotit: |
| 741 | + if (!try_add_frags(inode, uspi->s_fpb)) | |
| 742 | + return 0; | |
| 719 | 743 | blkno = ufs_fragstoblks(result); |
| 720 | 744 | ubh_clrblock (UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); |
| 721 | 745 | if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) |
| @@ -235,7 +235,8 @@ ufs_extend_tail(struct inode *inode, u64 writes_to, · 234 unmodified lines | ||
| 235 | 235 | |
| 236 | 236 | p = ufs_get_direct_data_ptr(uspi, ufsi, block); |
| 237 | 237 | tmp = ufs_new_fragments(inode, p, lastfrag, ufs_data_ptr_to_cpu(sb, p), |
| 238 | − new_size, err, locked_page); | |
| 238 | + new_size - (lastfrag & uspi->s_fpbmask), err, | |
| 239 | + locked_page); | |
| 239 | 240 | return tmp != 0; |
| 240 | 241 | } |
| 241 | 242 | |
| @@ -284,7 +285,7 @@ ufs_inode_getfrag(struct inode *inode, unsigned index, · 42 unmodified lines | ||
| 284 | 285 | goal += uspi->s_fpb; |
| 285 | 286 | } |
| 286 | 287 | tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment), |
| 287 | − goal, uspi->s_fpb, err, locked_page); | |
| 288 | + goal, nfrags, err, locked_page); | |
| 288 | 289 | |
| 289 | 290 | if (!tmp) { |
| 290 | 291 | *err = -ENOSPC; |
| @@ -402,7 +403,9 @@ static int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buff · 111 unmodified lines | ||
| 402 | 403 | |
| 403 | 404 | if (!create) { |
| 404 | 405 | phys64 = ufs_frag_map(inode, offsets, depth); |
| 405 | − goto out; | |
| 406 | + if (phys64) | |
| 407 | + map_bh(bh_result, sb, phys64 + frag); | |
| 408 | + return 0; | |
| 406 | 409 | } |
| 407 | 410 | |
| 408 | 411 | /* This code entered only while writing ....? */ |
| @@ -841,8 +844,11 @@ void ufs_evict_inode(struct inode * inode) · 432 unmodified lines | ||
| 841 | 844 | truncate_inode_pages_final(&inode->i_data); |
| 842 | 845 | if (want_delete) { |
| 843 | 846 | inode->i_size = 0; |
| 844 | − if (inode->i_blocks) | |
| 847 | + if (inode->i_blocks && | |
| 848 | + (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | |
| 849 | + S_ISLNK(inode->i_mode))) | |
| 845 | 850 | ufs_truncate_blocks(inode); |
| 851 | + ufs_update_inode(inode, inode_needs_sync(inode)); | |
| 846 | 852 | } |
| 847 | 853 | |
| 848 | 854 | invalidate_inode_buffers(inode); |
| @@ -1100,7 +1106,7 @@ out: · 251 unmodified lines | ||
| 1100 | 1106 | return err; |
| 1101 | 1107 | } |
| 1102 | 1108 | |
| 1103 | −static void __ufs_truncate_blocks(struct inode *inode) | |
| 1109 | +static void ufs_truncate_blocks(struct inode *inode) | |
| 1104 | 1110 | { |
| 1105 | 1111 | struct ufs_inode_info *ufsi = UFS_I(inode); |
| 1106 | 1112 | struct super_block *sb = inode->i_sb; |
| @@ -1183,7 +1189,7 @@ static int ufs_truncate(struct inode *inode, loff_t size) · 76 unmodified lines | ||
| 1183 | 1189 | |
| 1184 | 1190 | truncate_setsize(inode, size); |
| 1185 | 1191 | |
| 1186 | − __ufs_truncate_blocks(inode); | |
| 1192 | + ufs_truncate_blocks(inode); | |
| 1187 | 1193 | inode->i_mtime = inode->i_ctime = current_time(inode); |
| 1188 | 1194 | mark_inode_dirty(inode); |
| 1189 | 1195 | out: |
| @@ -1191,16 +1197,6 @@ out: · 1 unmodified line | ||
| 1191 | 1197 | return err; |
| 1192 | 1198 | } |
| 1193 | 1199 | |
| 1194 | −static void ufs_truncate_blocks(struct inode *inode) | |
| 1195 | −{ | |
| 1196 | − if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | |
| 1197 | − S_ISLNK(inode->i_mode))) | |
| 1198 | − return; | |
| 1199 | − if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | |
| 1200 | − return; | |
| 1201 | − __ufs_truncate_blocks(inode); | |
| 1202 | −} | |
| 1203 | − | |
| 1204 | 1200 | int ufs_setattr(struct dentry *dentry, struct iattr *attr) |
| 1205 | 1201 | { |
| 1206 | 1202 | struct inode *inode = d_inode(dentry); |
| @@ -746,6 +746,23 @@ static void ufs_put_super(struct super_block *sb) · 745 unmodified lines | ||
| 746 | 746 | return; |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | +static u64 ufs_max_bytes(struct super_block *sb) | |
| 750 | +{ | |
| 751 | + struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; | |
| 752 | + int bits = uspi->s_apbshift; | |
| 753 | + u64 res; | |
| 754 | + | |
| 755 | + if (bits > 21) | |
| 756 | + res = ~0ULL; | |
| 757 | + else | |
| 758 | + res = UFS_NDADDR + (1LL << bits) + (1LL << (2*bits)) + | |
| 759 | + (1LL << (3*bits)); | |
| 760 | + | |
| 761 | + if (res >= (MAX_LFS_FILESIZE >> uspi->s_bshift)) | |
| 762 | + return MAX_LFS_FILESIZE; | |
| 763 | + return res << uspi->s_bshift; | |
| 764 | +} | |
| 765 | + | |
| 749 | 766 | static int ufs_fill_super(struct super_block *sb, void *data, int silent) |
| 750 | 767 | { |
| 751 | 768 | struct ufs_sb_info * sbi; |
| @@ -1211,6 +1228,7 @@ magic_found: · 459 unmodified lines | ||
| 1211 | 1228 | "fast symlink size (%u)\n", uspi->s_maxsymlinklen); |
| 1212 | 1229 | uspi->s_maxsymlinklen = maxsymlen; |
| 1213 | 1230 | } |
| 1231 | + sb->s_maxbytes = ufs_max_bytes(sb); | |
| 1214 | 1232 | sb->s_max_links = UFS_LINK_MAX; |
| 1215 | 1233 | |
| 1216 | 1234 | inode = ufs_iget(sb, UFS_ROOTINO); |
| @@ -473,15 +473,19 @@ static inline unsigned _ubh_find_last_zero_bit_( · 472 unmodified lines | ||
| 473 | 473 | static inline int _ubh_isblockset_(struct ufs_sb_private_info * uspi, |
| 474 | 474 | struct ufs_buffer_head * ubh, unsigned begin, unsigned block) |
| 475 | 475 | { |
| 476 | + u8 mask; | |
| 476 | 477 | switch (uspi->s_fpb) { |
| 477 | 478 | case 8: |
| 478 | 479 | return (*ubh_get_addr (ubh, begin + block) == 0xff); |
| 479 | 480 | case 4: |
| 480 | − return (*ubh_get_addr (ubh, begin + (block >> 1)) == (0x0f << ((block & 0x01) << 2))); | |
| 481 | + mask = 0x0f << ((block & 0x01) << 2); | |
| 482 | + return (*ubh_get_addr (ubh, begin + (block >> 1)) & mask) == mask; | |
| 481 | 483 | case 2: |
| 482 | − return (*ubh_get_addr (ubh, begin + (block >> 2)) == (0x03 << ((block & 0x03) << 1))); | |
| 484 | + mask = 0x03 << ((block & 0x03) << 1); | |
| 485 | + return (*ubh_get_addr (ubh, begin + (block >> 2)) & mask) == mask; | |
| 483 | 486 | case 1: |
| 484 | − return (*ubh_get_addr (ubh, begin + (block >> 3)) == (0x01 << (block & 0x07))); | |
| 487 | + mask = 0x01 << (block & 0x07); | |
| 488 | + return (*ubh_get_addr (ubh, begin + (block >> 3)) & mask) == mask; | |
| 485 | 489 | } |
| 486 | 490 | return 0; |
| 487 | 491 | } |
| @@ -374,6 +374,20 @@ struct acpi_table_desc { · 373 unmodified lines | ||
| 374 | 374 | u16 validation_count; |
| 375 | 375 | }; |
| 376 | 376 | |
| 377 | +/* | |
| 378 | + * Maximum value of the validation_count field in struct acpi_table_desc. | |
| 379 | + * When reached, validation_count cannot be changed any more and the table will | |
| 380 | + * be permanently regarded as validated. | |
| 381 | + * | |
| 382 | + * This is to prevent situations in which unbalanced table get/put operations | |
| 383 | + * may cause premature table unmapping in the OS to happen. | |
| 384 | + * | |
| 385 | + * The maximum validation count can be defined to any value, but should be | |
| 386 | + * greater than the maximum number of OS early stage mapping slots to avoid | |
| 387 | + * leaking early stage table mappings to the late stage. | |
| 388 | + */ | |
| 389 | +#define ACPI_MAX_TABLE_VALIDATIONS ACPI_UINT16_MAX | |
| 390 | + | |
| 377 | 391 | /* Masks for Flags field above */ |
| 378 | 392 | |
| 379 | 393 | #define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */ |
| @@ -21,4 +21,5 @@ · 20 unmodified lines | ||
| 21 | 21 | * -Wunused-function. This turns out to avoid the need for complex #ifdef |
| 22 | 22 | * directives. Suppress the warning in clang as well. |
| 23 | 23 | */ |
| 24 | −#define inline inline __attribute__((unused)) | |
| 24 | +#undef inline | |
| 25 | +#define inline inline __attribute__((unused)) notrace | |
| @@ -78,6 +78,7 @@ void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); · 77 unmodified lines | ||
| 78 | 78 | |
| 79 | 79 | struct iommu_domain; |
| 80 | 80 | struct msi_msg; |
| 81 | +struct device; | |
| 81 | 82 | |
| 82 | 83 | static inline int iommu_dma_init(void) |
| 83 | 84 | { |
| @@ -153,7 +153,7 @@ struct elevator_type · 152 unmodified lines | ||
| 153 | 153 | #endif |
| 154 | 154 | |
| 155 | 155 | /* managed by elevator core */ |
| 156 | − char icq_cache_name[ELV_NAME_MAX + 5]; /* elvname + "_io_cq" */ | |
| 156 | + char icq_cache_name[ELV_NAME_MAX + 6]; /* elvname + "_io_cq" */ | |
| 157 | 157 | struct list_head list; |
| 158 | 158 | }; |
| 159 | 159 | |
| @@ -417,6 +417,10 @@ · 416 unmodified lines | ||
| 417 | 417 | #define ICH_HCR_EN (1 << 0) |
| 418 | 418 | #define ICH_HCR_UIE (1 << 1) |
| 419 | 419 | |
| 420 | +#define ICH_VMCR_ACK_CTL_SHIFT 2 | |
| 421 | +#define ICH_VMCR_ACK_CTL_MASK (1 << ICH_VMCR_ACK_CTL_SHIFT) | |
| 422 | +#define ICH_VMCR_FIQ_EN_SHIFT 3 | |
| 423 | +#define ICH_VMCR_FIQ_EN_MASK (1 << ICH_VMCR_FIQ_EN_SHIFT) | |
| 420 | 424 | #define ICH_VMCR_CBPR_SHIFT 4 |
| 421 | 425 | #define ICH_VMCR_CBPR_MASK (1 << ICH_VMCR_CBPR_SHIFT) |
| 422 | 426 | #define ICH_VMCR_EOIM_SHIFT 9 |
| @@ -25,7 +25,18 @@ · 24 unmodified lines | ||
| 25 | 25 | #define GICC_ENABLE 0x1 |
| 26 | 26 | #define GICC_INT_PRI_THRESHOLD 0xf0 |
| 27 | 27 | |
| 28 | −#define GIC_CPU_CTRL_EOImodeNS (1 << 9) | |
| 28 | +#define GIC_CPU_CTRL_EnableGrp0_SHIFT 0 | |
| 29 | +#define GIC_CPU_CTRL_EnableGrp0 (1 << GIC_CPU_CTRL_EnableGrp0_SHIFT) | |
| 30 | +#define GIC_CPU_CTRL_EnableGrp1_SHIFT 1 | |
| 31 | +#define GIC_CPU_CTRL_EnableGrp1 (1 << GIC_CPU_CTRL_EnableGrp1_SHIFT) | |
| 32 | +#define GIC_CPU_CTRL_AckCtl_SHIFT 2 | |
| 33 | +#define GIC_CPU_CTRL_AckCtl (1 << GIC_CPU_CTRL_AckCtl_SHIFT) | |
| 34 | +#define GIC_CPU_CTRL_FIQEn_SHIFT 3 | |
| 35 | +#define GIC_CPU_CTRL_FIQEn (1 << GIC_CPU_CTRL_FIQEn_SHIFT) | |
| 36 | +#define GIC_CPU_CTRL_CBPR_SHIFT 4 | |
| 37 | +#define GIC_CPU_CTRL_CBPR (1 << GIC_CPU_CTRL_CBPR_SHIFT) | |
| 38 | +#define GIC_CPU_CTRL_EOImodeNS_SHIFT 9 | |
| 39 | +#define GIC_CPU_CTRL_EOImodeNS (1 << GIC_CPU_CTRL_EOImodeNS_SHIFT) | |
| 29 | 40 | |
| 30 | 41 | #define GICC_IAR_INT_ID_MASK 0x3ff |
| 31 | 42 | #define GICC_INT_SPURIOUS 1023 |
| @@ -84,8 +95,19 @@ · 52 unmodified lines | ||
| 84 | 95 | #define GICH_LR_EOI (1 << 19) |
| 85 | 96 | #define GICH_LR_HW (1 << 31) |
| 86 | 97 | |
| 87 | −#define GICH_VMCR_CTRL_SHIFT 0 | |
| 88 | −#define GICH_VMCR_CTRL_MASK (0x21f << GICH_VMCR_CTRL_SHIFT) | |
| 98 | +#define GICH_VMCR_ENABLE_GRP0_SHIFT 0 | |
| 99 | +#define GICH_VMCR_ENABLE_GRP0_MASK (1 << GICH_VMCR_ENABLE_GRP0_SHIFT) | |
| 100 | +#define GICH_VMCR_ENABLE_GRP1_SHIFT 1 | |
| 101 | +#define GICH_VMCR_ENABLE_GRP1_MASK (1 << GICH_VMCR_ENABLE_GRP1_SHIFT) | |
| 102 | +#define GICH_VMCR_ACK_CTL_SHIFT 2 | |
| 103 | +#define GICH_VMCR_ACK_CTL_MASK (1 << GICH_VMCR_ACK_CTL_SHIFT) | |
| 104 | +#define GICH_VMCR_FIQ_EN_SHIFT 3 | |
| 105 | +#define GICH_VMCR_FIQ_EN_MASK (1 << GICH_VMCR_FIQ_EN_SHIFT) | |
| 106 | +#define GICH_VMCR_CBPR_SHIFT 4 | |
| 107 | +#define GICH_VMCR_CBPR_MASK (1 << GICH_VMCR_CBPR_SHIFT) | |
| 108 | +#define GICH_VMCR_EOI_MODE_SHIFT 9 | |
| 109 | +#define GICH_VMCR_EOI_MODE_MASK (1 << GICH_VMCR_EOI_MODE_SHIFT) | |
| 110 | + | |
| 89 | 111 | #define GICH_VMCR_PRIMASK_SHIFT 27 |
| 90 | 112 | #define GICH_VMCR_PRIMASK_MASK (0x1f << GICH_VMCR_PRIMASK_SHIFT) |
| 91 | 113 | #define GICH_VMCR_BINPOINT_SHIFT 21 |
| @@ -173,7 +173,6 @@ struct key { · 172 unmodified lines | ||
| 173 | 173 | #ifdef KEY_DEBUGGING |
| 174 | 174 | unsigned magic; |
| 175 | 175 | #define KEY_DEBUG_MAGIC 0x18273645u |
| 176 | −#define KEY_DEBUG_MAGIC_X 0xf8e9dacbu | |
| 177 | 176 | #endif |
| 178 | 177 | |
| 179 | 178 | unsigned long flags; /* status flags (change with bitops) */ |
| @@ -914,8 +914,7 @@ struct xfrmdev_ops { · 913 unmodified lines | ||
| 914 | 914 | * |
| 915 | 915 | * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu); |
| 916 | 916 | * Called when a user wants to change the Maximum Transfer Unit |
| 917 | − * of a device. If not defined, any request to change MTU will | |
| 918 | − * will return an error. | |
| 917 | + * of a device. | |
| 919 | 918 | * |
| 920 | 919 | * void (*ndo_tx_timeout)(struct net_device *dev); |
| 921 | 920 | * Callback used when the transmitter has not made any progress |
| @@ -1596,8 +1595,8 @@ enum netdev_priv_flags { · 674 unmodified lines | ||
| 1596 | 1595 | * @rtnl_link_state: This enum represents the phases of creating |
| 1597 | 1596 | * a new link |
| 1598 | 1597 | * |
| 1599 | − * @destructor: Called from unregister, | |
| 1600 | − * can be used to call free_netdev | |
| 1598 | + * @needs_free_netdev: Should unregister perform free_netdev? | |
| 1599 | + * @priv_destructor: Called from unregister | |
| 1601 | 1600 | * @npinfo: XXX: need comments on this one |
| 1602 | 1601 | * @nd_net: Network namespace this network device is inside |
| 1603 | 1602 | * |
| @@ -1858,7 +1857,8 @@ struct net_device { · 254 unmodified lines | ||
| 1858 | 1857 | RTNL_LINK_INITIALIZING, |
| 1859 | 1858 | } rtnl_link_state:16; |
| 1860 | 1859 | |
| 1861 | − void (*destructor)(struct net_device *dev); | |
| 1860 | + bool needs_free_netdev; | |
| 1861 | + void (*priv_destructor)(struct net_device *dev); | |
| 1862 | 1862 | |
| 1863 | 1863 | #ifdef CONFIG_NETPOLL |
| 1864 | 1864 | struct netpoll_info __rcu *npinfo; |
| @@ -4264,6 +4264,11 @@ static inline const char *netdev_name(const struct net_device *dev) · 2399 unmodified lines | ||
| 4264 | 4264 | return dev->name; |
| 4265 | 4265 | } |
| 4266 | 4266 | |
| 4267 | +static inline bool netdev_unregistering(const struct net_device *dev) | |
| 4268 | +{ | |
| 4269 | + return dev->reg_state == NETREG_UNREGISTERING; | |
| 4270 | +} | |
| 4271 | + | |
| 4267 | 4272 | static inline const char *netdev_reg_state(const struct net_device *dev) |
| 4268 | 4273 | { |
| 4269 | 4274 | switch (dev->reg_state) { |
| @@ -44,6 +44,7 @@ void inode_sub_rsv_space(struct inode *inode, qsize_t number); · 43 unmodified lines | ||
| 44 | 44 | void inode_reclaim_rsv_space(struct inode *inode, qsize_t number); |
| 45 | 45 | |
| 46 | 46 | int dquot_initialize(struct inode *inode); |
| 47 | +bool dquot_initialize_needed(struct inode *inode); | |
| 47 | 48 | void dquot_drop(struct inode *inode); |
| 48 | 49 | struct dquot *dqget(struct super_block *sb, struct kqid qid); |
| 49 | 50 | static inline struct dquot *dqgrab(struct dquot *dquot) |
| @@ -207,6 +208,11 @@ static inline int dquot_initialize(struct inode *inode) · 157 unmodified lines | ||
| 207 | 208 | return 0; |
| 208 | 209 | } |
| 209 | 210 | |
| 211 | +static inline bool dquot_initialize_needed(struct inode *inode) | |
| 212 | +{ | |
| 213 | + return false; | |
| 214 | +} | |
| 215 | + | |
| 210 | 216 | static inline void dquot_drop(struct inode *inode) |
| 211 | 217 | { |
| 212 | 218 | } |
| @@ -172,9 +172,7 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) · 171 unmodified lines | ||
| 172 | 172 | { |
| 173 | 173 | int retval; |
| 174 | 174 | |
| 175 | − preempt_disable(); | |
| 176 | 175 | retval = __srcu_read_lock(sp); |
| 177 | − preempt_enable(); | |
| 178 | 176 | rcu_lock_acquire(&(sp)->dep_map); |
| 179 | 177 | return retval; |
| 180 | 178 | } |
| @@ -189,8 +189,6 @@ struct platform_suspend_ops { · 188 unmodified lines | ||
| 189 | 189 | struct platform_freeze_ops { |
| 190 | 190 | int (*begin)(void); |
| 191 | 191 | int (*prepare)(void); |
| 192 | − void (*wake)(void); | |
| 193 | − void (*sync)(void); | |
| 194 | 192 | void (*restore)(void); |
| 195 | 193 | void (*end)(void); |
| 196 | 194 | }; |
| @@ -430,8 +428,7 @@ extern unsigned int pm_wakeup_irq; · 233 unmodified lines | ||
| 430 | 428 | |
| 431 | 429 | extern bool pm_wakeup_pending(void); |
| 432 | 430 | extern void pm_system_wakeup(void); |
| 433 | −extern void pm_system_cancel_wakeup(void); | |
| 434 | −extern void pm_wakeup_clear(bool reset); | |
| 431 | +extern void pm_wakeup_clear(void); | |
| 435 | 432 | extern void pm_system_irq_wakeup(unsigned int irq_number); |
| 436 | 433 | extern bool pm_get_wakeup_count(unsigned int *count, bool block); |
| 437 | 434 | extern bool pm_save_wakeup_count(unsigned int count); |
| @@ -481,7 +478,7 @@ static inline int unregister_pm_notifier(struct notifier_block *nb) · 43 unmodified lines | ||
| 481 | 478 | |
| 482 | 479 | static inline bool pm_wakeup_pending(void) { return false; } |
| 483 | 480 | static inline void pm_system_wakeup(void) {} |
| 484 | −static inline void pm_wakeup_clear(bool reset) {} | |
| 481 | +static inline void pm_wakeup_clear(void) {} | |
| 485 | 482 | static inline void pm_system_irq_wakeup(unsigned int irq_number) {} |
| 486 | 483 | |
| 487 | 484 | static inline void lock_system_sleep(void) {} |
| @@ -106,6 +106,16 @@ static inline void cec_notifier_set_phys_addr_from_edid(struct cec_notifier *n, · 105 unmodified lines | ||
| 106 | 106 | { |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | +static inline void cec_notifier_register(struct cec_notifier *n, | |
| 110 | + struct cec_adapter *adap, | |
| 111 | + void (*callback)(struct cec_adapter *adap, u16 pa)) | |
| 112 | +{ | |
| 113 | +} | |
| 114 | + | |
| 115 | +static inline void cec_notifier_unregister(struct cec_notifier *n) | |
| 116 | +{ | |
| 117 | +} | |
| 118 | + | |
| 109 | 119 | #endif |
| 110 | 120 | |
| 111 | 121 | #endif |
| @@ -206,7 +206,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap) · 205 unmodified lines | ||
| 206 | 206 | #define cec_phys_addr_exp(pa) \ |
| 207 | 207 | ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf |
| 208 | 208 | |
| 209 | −#if IS_ENABLED(CONFIG_CEC_CORE) | |
| 209 | +#if IS_REACHABLE(CONFIG_CEC_CORE) | |
| 210 | 210 | struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, |
| 211 | 211 | void *priv, const char *name, u32 caps, u8 available_las); |
| 212 | 212 | int cec_register_adapter(struct cec_adapter *adap, struct device *parent); |
| @@ -1486,8 +1486,10 @@ enum ethtool_link_mode_bit_indices { · 1485 unmodified lines | ||
| 1486 | 1486 | * it was forced up into this mode or autonegotiated. |
| 1487 | 1487 | */ |
| 1488 | 1488 | |
| 1489 | −/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. */ | |
| 1490 | −/* Update drivers/net/phy/phy.c:phy_speed_to_str() when adding new values */ | |
| 1489 | +/* The forced speed, in units of 1Mb. All values 0 to INT_MAX are legal. | |
| 1490 | + * Update drivers/net/phy/phy.c:phy_speed_to_str() and | |
| 1491 | + * drivers/net/bonding/bond_3ad.c:__get_link_speed() when adding new values. | |
| 1492 | + */ | |
| 1491 | 1493 | #define SPEED_10 10 |
| 1492 | 1494 | #define SPEED_100 100 |
| 1493 | 1495 | #define SPEED_1000 1000 |
| @@ -70,8 +70,8 @@ struct keyctl_dh_params { · 69 unmodified lines | ||
| 70 | 70 | }; |
| 71 | 71 | |
| 72 | 72 | struct keyctl_kdf_params { |
| 73 | − char *hashname; | |
| 74 | − char *otherinfo; | |
| 73 | + char __user *hashname; | |
| 74 | + char __user *otherinfo; | |
| 75 | 75 | __u32 otherinfolen; |
| 76 | 76 | __u32 __spare[8]; |
| 77 | 77 | }; |
| @@ -343,6 +343,7 @@ enum ovs_key_attr { · 342 unmodified lines | ||
| 343 | 343 | #define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) |
| 344 | 344 | |
| 345 | 345 | enum ovs_tunnel_key_attr { |
| 346 | + /* OVS_TUNNEL_KEY_ATTR_NONE, standard nl API requires this attribute! */ | |
| 346 | 347 | OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ |
| 347 | 348 | OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ |
| 348 | 349 | OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ |
| @@ -1658,13 +1658,13 @@ static ssize_t write_cpuhp_target(struct device *dev, · 1657 unmodified lines | ||
| 1658 | 1658 | ret = !sp->name || sp->cant_stop ? -EINVAL : 0; |
| 1659 | 1659 | mutex_unlock(&cpuhp_state_mutex); |
| 1660 | 1660 | if (ret) |
| 1661 | − return ret; | |
| 1661 | + goto out; | |
| 1662 | 1662 | |
| 1663 | 1663 | if (st->state < target) |
| 1664 | 1664 | ret = do_cpu_up(dev->id, target); |
| 1665 | 1665 | else |
| 1666 | 1666 | ret = do_cpu_down(dev->id, target); |
| 1667 | − | |
| 1667 | +out: | |
| 1668 | 1668 | unlock_device_hotplug(); |
| 1669 | 1669 | return ret ? ret : count; |
| 1670 | 1670 | } |
| @@ -7329,6 +7329,21 @@ int perf_event_account_interrupt(struct perf_event *event) · 7328 unmodified lines | ||
| 7329 | 7329 | return __perf_event_account_interrupt(event, 1); |
| 7330 | 7330 | } |
| 7331 | 7331 | |
| 7332 | +static bool sample_is_allowed(struct perf_event *event, struct pt_regs *regs) | |
| 7333 | +{ | |
| 7334 | + /* | |
| 7335 | + * Due to interrupt latency (AKA "skid"), we may enter the | |
| 7336 | + * kernel before taking an overflow, even if the PMU is only | |
| 7337 | + * counting user events. | |
| 7338 | + * To avoid leaking information to userspace, we must always | |
| 7339 | + * reject kernel samples when exclude_kernel is set. | |
| 7340 | + */ | |
| 7341 | + if (event->attr.exclude_kernel && !user_mode(regs)) | |
| 7342 | + return false; | |
| 7343 | + | |
| 7344 | + return true; | |
| 7345 | +} | |
| 7346 | + | |
| 7332 | 7347 | /* |
| 7333 | 7348 | * Generic event overflow handling, sampling. |
| 7334 | 7349 | */ |
| @@ -7349,6 +7364,12 @@ static int __perf_event_overflow(struct perf_event *event, · 14 unmodified lines | ||
| 7349 | 7364 | |
| 7350 | 7365 | ret = __perf_event_account_interrupt(event, throttle); |
| 7351 | 7366 | |
| 7367 | + /* | |
| 7368 | + * For security, drop the skid kernel samples if necessary. | |
| 7369 | + */ | |
| 7370 | + if (!sample_is_allowed(event, regs)) | |
| 7371 | + return ret; | |
| 7372 | + | |
| 7352 | 7373 | /* |
| 7353 | 7374 | * XXX event_limit might not quite work as expected on inherited |
| 7354 | 7375 | * events |
| @@ -132,7 +132,7 @@ int freeze_processes(void) · 131 unmodified lines | ||
| 132 | 132 | if (!pm_freezing) |
| 133 | 133 | atomic_inc(&system_freezing_cnt); |
| 134 | 134 | |
| 135 | − pm_wakeup_clear(true); | |
| 135 | + pm_wakeup_clear(); | |
| 136 | 136 | pr_info("Freezing user space processes ... "); |
| 137 | 137 | pm_freezing = true; |
| 138 | 138 | error = try_to_freeze_tasks(true); |
| @@ -72,8 +72,6 @@ static void freeze_begin(void) · 71 unmodified lines | ||
| 72 | 72 | |
| 73 | 73 | static void freeze_enter(void) |
| 74 | 74 | { |
| 75 | − trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_FREEZE, true); | |
| 76 | − | |
| 77 | 75 | spin_lock_irq(&suspend_freeze_lock); |
| 78 | 76 | if (pm_wakeup_pending()) |
| 79 | 77 | goto out; |
| @@ -100,27 +98,6 @@ static void freeze_enter(void) · 20 unmodified lines | ||
| 100 | 98 | out: |
| 101 | 99 | suspend_freeze_state = FREEZE_STATE_NONE; |
| 102 | 100 | spin_unlock_irq(&suspend_freeze_lock); |
| 103 | − | |
| 104 | − trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_FREEZE, false); | |
| 105 | −} | |
| 106 | − | |
| 107 | −static void s2idle_loop(void) | |
| 108 | −{ | |
| 109 | − do { | |
| 110 | − freeze_enter(); | |
| 111 | − | |
| 112 | − if (freeze_ops && freeze_ops->wake) | |
| 113 | − freeze_ops->wake(); | |
| 114 | − | |
| 115 | − dpm_resume_noirq(PMSG_RESUME); | |
| 116 | − if (freeze_ops && freeze_ops->sync) | |
| 117 | − freeze_ops->sync(); | |
| 118 | − | |
| 119 | − if (pm_wakeup_pending()) | |
| 120 | − break; | |
| 121 | − | |
| 122 | − pm_wakeup_clear(false); | |
| 123 | − } while (!dpm_suspend_noirq(PMSG_SUSPEND)); | |
| 124 | 101 | } |
| 125 | 102 | |
| 126 | 103 | void freeze_wake(void) |
| @@ -394,8 +371,10 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) · 267 unmodified lines | ||
| 394 | 371 | * all the devices are suspended. |
| 395 | 372 | */ |
| 396 | 373 | if (state == PM_SUSPEND_FREEZE) { |
| 397 | − s2idle_loop(); | |
| 398 | − goto Platform_early_resume; | |
| 374 | + trace_suspend_resume(TPS("machine_suspend"), state, true); | |
| 375 | + freeze_enter(); | |
| 376 | + trace_suspend_resume(TPS("machine_suspend"), state, false); | |
| 377 | + goto Platform_wake; | |
| 399 | 378 | } |
| 400 | 379 | |
| 401 | 380 | error = disable_nonboot_cpus(); |
| @@ -269,7 +269,6 @@ static struct console *exclusive_console; · 268 unmodified lines | ||
| 269 | 269 | #define MAX_CMDLINECONSOLES 8 |
| 270 | 270 | |
| 271 | 271 | static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; |
| 272 | −static int console_cmdline_cnt; | |
| 273 | 272 | |
| 274 | 273 | static int preferred_console = -1; |
| 275 | 274 | int console_set_on_cmdline; |
| @@ -1906,25 +1905,12 @@ static int __add_preferred_console(char *name, int idx, char *options, · 1630 unmodified lines | ||
| 1906 | 1905 | * See if this tty is not yet registered, and |
| 1907 | 1906 | * if we have a slot free. |
| 1908 | 1907 | */ |
| 1909 | − for (i = 0, c = console_cmdline; i < console_cmdline_cnt; i++, c++) { | |
| 1908 | + for (i = 0, c = console_cmdline; | |
| 1909 | + i < MAX_CMDLINECONSOLES && c->name[0]; | |
| 1910 | + i++, c++) { | |
| 1910 | 1911 | if (strcmp(c->name, name) == 0 && c->index == idx) { |
| 1911 | − if (brl_options) | |
| 1912 | − return 0; | |
| 1913 | − | |
| 1914 | − /* | |
| 1915 | − * Maintain an invariant that will help to find if | |
| 1916 | − * the matching console is preferred, see | |
| 1917 | − * register_console(): | |
| 1918 | − * | |
| 1919 | − * The last non-braille console is always | |
| 1920 | − * the preferred one. | |
| 1921 | − */ | |
| 1922 | − if (i != console_cmdline_cnt - 1) | |
| 1923 | − swap(console_cmdline[i], | |
| 1924 | − console_cmdline[console_cmdline_cnt - 1]); | |
| 1925 | − | |
| 1926 | − preferred_console = console_cmdline_cnt - 1; | |
| 1927 | − | |
| 1912 | + if (!brl_options) | |
| 1913 | + preferred_console = i; | |
| 1928 | 1914 | return 0; |
| 1929 | 1915 | } |
| 1930 | 1916 | } |
| @@ -1937,7 +1923,6 @@ static int __add_preferred_console(char *name, int idx, char *options, · 6 unmodified lines | ||
| 1937 | 1923 | braille_set_options(c, brl_options); |
| 1938 | 1924 | |
| 1939 | 1925 | c->index = idx; |
| 1940 | − console_cmdline_cnt++; | |
| 1941 | 1926 | return 0; |
| 1942 | 1927 | } |
| 1943 | 1928 | /* |
| @@ -2477,23 +2462,12 @@ void register_console(struct console *newcon) · 533 unmodified lines | ||
| 2477 | 2462 | } |
| 2478 | 2463 | |
| 2479 | 2464 | /* |
| 2480 | − * See if this console matches one we selected on the command line. | |
| 2481 | − * | |
| 2482 | − * There may be several entries in the console_cmdline array matching | |
| 2483 | − * with the same console, one with newcon->match(), another by | |
| 2484 | − * name/index: | |
| 2485 | − * | |
| 2486 | − * pl011,mmio,0x87e024000000,115200 -- added from SPCR | |
| 2487 | − * ttyAMA0 -- added from command line | |
| 2488 | − * | |
| 2489 | − * Traverse the console_cmdline array in reverse order to be | |
| 2490 | − * sure that if this console is preferred then it will be the first | |
| 2491 | − * matching entry. We use the invariant that is maintained in | |
| 2492 | − * __add_preferred_console(). | |
| 2465 | + * See if this console matches one we selected on | |
| 2466 | + * the command line. | |
| 2493 | 2467 | */ |
| 2494 | − for (i = console_cmdline_cnt - 1; i >= 0; i--) { | |
| 2495 | − c = console_cmdline + i; | |
| 2496 | − | |
| 2468 | + for (i = 0, c = console_cmdline; | |
| 2469 | + i < MAX_CMDLINECONSOLES && c->name[0]; | |
| 2470 | + i++, c++) { | |
| 2497 | 2471 | if (!newcon->match || |
| 2498 | 2472 | newcon->match(newcon, c->name, c->index, c->options) != 0) { |
| 2499 | 2473 | /* default matching */ |
| @@ -263,7 +263,7 @@ EXPORT_SYMBOL_GPL(cleanup_srcu_struct); · 262 unmodified lines | ||
| 263 | 263 | |
| 264 | 264 | /* |
| 265 | 265 | * Counts the new reader in the appropriate per-CPU element of the |
| 266 | − * srcu_struct. Must be called from process context. | |
| 266 | + * srcu_struct. | |
| 267 | 267 | * Returns an index that must be passed to the matching srcu_read_unlock(). |
| 268 | 268 | */ |
| 269 | 269 | int __srcu_read_lock(struct srcu_struct *sp) |
| @@ -271,7 +271,7 @@ int __srcu_read_lock(struct srcu_struct *sp) · 1 unmodified line | ||
| 271 | 271 | int idx; |
| 272 | 272 | |
| 273 | 273 | idx = READ_ONCE(sp->completed) & 0x1; |
| 274 | − __this_cpu_inc(sp->per_cpu_ref->lock_count[idx]); | |
| 274 | + this_cpu_inc(sp->per_cpu_ref->lock_count[idx]); | |
| 275 | 275 | smp_mb(); /* B */ /* Avoid leaking the critical section. */ |
| 276 | 276 | return idx; |
| 277 | 277 | } |
| @@ -281,7 +281,6 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); · 3 unmodified lines | ||
| 281 | 281 | * Removes the count for the old reader from the appropriate per-CPU |
| 282 | 282 | * element of the srcu_struct. Note that this may well be a different |
| 283 | 283 | * CPU than that which was incremented by the corresponding srcu_read_lock(). |
| 284 | − * Must be called from process context. | |
| 285 | 284 | */ |
| 286 | 285 | void __srcu_read_unlock(struct srcu_struct *sp, int idx) |
| 287 | 286 | { |
| @@ -97,8 +97,9 @@ EXPORT_SYMBOL_GPL(cleanup_srcu_struct); · 96 unmodified lines | ||
| 97 | 97 | |
| 98 | 98 | /* |
| 99 | 99 | * Counts the new reader in the appropriate per-CPU element of the |
| 100 | − * srcu_struct. Must be called from process context. | |
| 101 | − * Returns an index that must be passed to the matching srcu_read_unlock(). | |
| 100 | + * srcu_struct. Can be invoked from irq/bh handlers, but the matching | |
| 101 | + * __srcu_read_unlock() must be in the same handler instance. Returns an | |
| 102 | + * index that must be passed to the matching srcu_read_unlock(). | |
| 102 | 103 | */ |
| 103 | 104 | int __srcu_read_lock(struct srcu_struct *sp) |
| 104 | 105 | { |
| @@ -112,7 +113,7 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); · 7 unmodified lines | ||
| 112 | 113 | |
| 113 | 114 | /* |
| 114 | 115 | * Removes the count for the old reader from the appropriate element of |
| 115 | − * the srcu_struct. Must be called from process context. | |
| 116 | + * the srcu_struct. | |
| 116 | 117 | */ |
| 117 | 118 | void __srcu_read_unlock(struct srcu_struct *sp, int idx) |
| 118 | 119 | { |
| @@ -357,7 +357,7 @@ EXPORT_SYMBOL_GPL(cleanup_srcu_struct); · 356 unmodified lines | ||
| 357 | 357 | |
| 358 | 358 | /* |
| 359 | 359 | * Counts the new reader in the appropriate per-CPU element of the |
| 360 | − * srcu_struct. Must be called from process context. | |
| 360 | + * srcu_struct. | |
| 361 | 361 | * Returns an index that must be passed to the matching srcu_read_unlock(). |
| 362 | 362 | */ |
| 363 | 363 | int __srcu_read_lock(struct srcu_struct *sp) |
| @@ -365,7 +365,7 @@ int __srcu_read_lock(struct srcu_struct *sp) · 1 unmodified line | ||
| 365 | 365 | int idx; |
| 366 | 366 | |
| 367 | 367 | idx = READ_ONCE(sp->srcu_idx) & 0x1; |
| 368 | − __this_cpu_inc(sp->sda->srcu_lock_count[idx]); | |
| 368 | + this_cpu_inc(sp->sda->srcu_lock_count[idx]); | |
| 369 | 369 | smp_mb(); /* B */ /* Avoid leaking the critical section. */ |
| 370 | 370 | return idx; |
| 371 | 371 | } |
| @@ -375,7 +375,6 @@ EXPORT_SYMBOL_GPL(__srcu_read_lock); · 3 unmodified lines | ||
| 375 | 375 | * Removes the count for the old reader from the appropriate per-CPU |
| 376 | 376 | * element of the srcu_struct. Note that this may well be a different |
| 377 | 377 | * CPU than that which was incremented by the corresponding srcu_read_lock(). |
| 378 | − * Must be called from process context. | |
| 379 | 378 | */ |
| 380 | 379 | void __srcu_read_unlock(struct srcu_struct *sp, int idx) |
| 381 | 380 | { |
| @@ -101,9 +101,6 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, · 100 unmodified lines | ||
| 101 | 101 | if (sg_policy->next_freq == next_freq) |
| 102 | 102 | return; |
| 103 | 103 | |
| 104 | − if (sg_policy->next_freq > next_freq) | |
| 105 | − next_freq = (sg_policy->next_freq + next_freq) >> 1; | |
| 106 | − | |
| 107 | 104 | sg_policy->next_freq = next_freq; |
| 108 | 105 | sg_policy->last_freq_update_time = time; |
| 109 | 106 | |
| @@ -43,7 +43,7 @@ static struct crypto_shash *tfm; · 42 unmodified lines | ||
| 43 | 43 | u32 crc32c(u32 crc, const void *address, unsigned int length) |
| 44 | 44 | { |
| 45 | 45 | SHASH_DESC_ON_STACK(shash, tfm); |
| 46 | − u32 *ctx = (u32 *)shash_desc_ctx(shash); | |
| 46 | + u32 ret, *ctx = (u32 *)shash_desc_ctx(shash); | |
| 47 | 47 | int err; |
| 48 | 48 | |
| 49 | 49 | shash->tfm = tfm; |
| @@ -53,7 +53,9 @@ u32 crc32c(u32 crc, const void *address, unsigned int length) · 3 unmodified lines | ||
| 53 | 53 | err = crypto_shash_update(shash, address, length); |
| 54 | 54 | BUG_ON(err); |
| 55 | 55 | |
| 56 | − return *ctx; | |
| 56 | + ret = *ctx; | |
| 57 | + barrier_data(ctx); | |
| 58 | + return ret; | |
| 57 | 59 | } |
| 58 | 60 | |
| 59 | 61 | EXPORT_SYMBOL(crc32c); |
| @@ -807,7 +807,6 @@ static void vlan_dev_free(struct net_device *dev) · 806 unmodified lines | ||
| 807 | 807 | |
| 808 | 808 | free_percpu(vlan->vlan_pcpu_stats); |
| 809 | 809 | vlan->vlan_pcpu_stats = NULL; |
| 810 | − free_netdev(dev); | |
| 811 | 810 | } |
| 812 | 811 | |
| 813 | 812 | void vlan_setup(struct net_device *dev) |
| @@ -820,7 +819,8 @@ void vlan_setup(struct net_device *dev) · 6 unmodified lines | ||
| 820 | 819 | netif_keep_dst(dev); |
| 821 | 820 | |
| 822 | 821 | dev->netdev_ops = &vlan_netdev_ops; |
| 823 | − dev->destructor = vlan_dev_free; | |
| 822 | + dev->needs_free_netdev = true; | |
| 823 | + dev->priv_destructor = vlan_dev_free; | |
| 824 | 824 | dev->ethtool_ops = &vlan_ethtool_ops; |
| 825 | 825 | |
| 826 | 826 | dev->min_mtu = 0; |
| @@ -1064,8 +1064,9 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, · 1063 unmodified lines | ||
| 1064 | 1064 | |
| 1065 | 1065 | skb_new->protocol = eth_type_trans(skb_new, soft_iface); |
| 1066 | 1066 | |
| 1067 | − soft_iface->stats.rx_packets++; | |
| 1068 | − soft_iface->stats.rx_bytes += skb->len + ETH_HLEN + hdr_size; | |
| 1067 | + batadv_inc_counter(bat_priv, BATADV_CNT_RX); | |
| 1068 | + batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES, | |
| 1069 | + skb->len + ETH_HLEN + hdr_size); | |
| 1069 | 1070 | |
| 1070 | 1071 | netif_rx(skb_new); |
| 1071 | 1072 | batadv_dbg(BATADV_DBG_DAT, bat_priv, "ARP request replied locally\n"); |
| @@ -987,7 +987,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb, · 986 unmodified lines | ||
| 987 | 987 | batadv_dbg(BATADV_DBG_BLA, bat_priv, |
| 988 | 988 | "%s(): Dropped unicast pkt received from another backbone gw %pM.\n", |
| 989 | 989 | __func__, orig_addr_gw); |
| 990 | − return NET_RX_DROP; | |
| 990 | + goto free_skb; | |
| 991 | 991 | } |
| 992 | 992 | } |
| 993 | 993 | |
| @@ -1034,8 +1034,6 @@ static void batadv_softif_free(struct net_device *dev) · 1033 unmodified lines | ||
| 1034 | 1034 | * netdev and its private data (bat_priv) |
| 1035 | 1035 | */ |
| 1036 | 1036 | rcu_barrier(); |
| 1037 | − | |
| 1038 | − free_netdev(dev); | |
| 1039 | 1037 | } |
| 1040 | 1038 | |
| 1041 | 1039 | /** |
| @@ -1047,7 +1045,8 @@ static void batadv_softif_init_early(struct net_device *dev) · 5 unmodified lines | ||
| 1047 | 1045 | ether_setup(dev); |
| 1048 | 1046 | |
| 1049 | 1047 | dev->netdev_ops = &batadv_netdev_ops; |
| 1050 | − dev->destructor = batadv_softif_free; | |
| 1048 | + dev->needs_free_netdev = true; | |
| 1049 | + dev->priv_destructor = batadv_softif_free; | |
| 1051 | 1050 | dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_NETNS_LOCAL; |
| 1052 | 1051 | dev->priv_flags |= IFF_NO_QUEUE; |
| 1053 | 1052 | |
| @@ -598,7 +598,7 @@ static void netdev_setup(struct net_device *dev) · 597 unmodified lines | ||
| 598 | 598 | |
| 599 | 599 | dev->netdev_ops = &netdev_ops; |
| 600 | 600 | dev->header_ops = &header_ops; |
| 601 | − dev->destructor = free_netdev; | |
| 601 | + dev->needs_free_netdev = true; | |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | static struct device_type bt_type = { |
| @@ -379,7 +379,7 @@ void br_dev_setup(struct net_device *dev) · 378 unmodified lines | ||
| 379 | 379 | ether_setup(dev); |
| 380 | 380 | |
| 381 | 381 | dev->netdev_ops = &br_netdev_ops; |
| 382 | − dev->destructor = free_netdev; | |
| 382 | + dev->needs_free_netdev = true; | |
| 383 | 383 | dev->ethtool_ops = &br_ethtool_ops; |
| 384 | 384 | SET_NETDEV_DEVTYPE(dev, &br_type); |
| 385 | 385 | dev->priv_flags = IFF_EBRIDGE | IFF_NO_QUEUE; |
| @@ -754,6 +754,10 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr, · 753 unmodified lines | ||
| 754 | 754 | |
| 755 | 755 | lock_sock(sk); |
| 756 | 756 | |
| 757 | + err = -EINVAL; | |
| 758 | + if (addr_len < offsetofend(struct sockaddr, sa_family)) | |
| 759 | + goto out; | |
| 760 | + | |
| 757 | 761 | err = -EAFNOSUPPORT; |
| 758 | 762 | if (uaddr->sa_family != AF_CAIF) |
| 759 | 763 | goto out; |
| @@ -81,11 +81,7 @@ static struct cfpkt *cfpkt_create_pfx(u16 len, u16 pfx) · 80 unmodified lines | ||
| 81 | 81 | { |
| 82 | 82 | struct sk_buff *skb; |
| 83 | 83 | |
| 84 | − if (likely(in_interrupt())) | |
| 85 | − skb = alloc_skb(len + pfx, GFP_ATOMIC); | |
| 86 | − else | |
| 87 | − skb = alloc_skb(len + pfx, GFP_KERNEL); | |
| 88 | − | |
| 84 | + skb = alloc_skb(len + pfx, GFP_ATOMIC); | |
| 89 | 85 | if (unlikely(skb == NULL)) |
| 90 | 86 | return NULL; |
| 91 | 87 | |
| @@ -392,14 +392,14 @@ static void chnl_net_destructor(struct net_device *dev) · 391 unmodified lines | ||
| 392 | 392 | { |
| 393 | 393 | struct chnl_net *priv = netdev_priv(dev); |
| 394 | 394 | caif_free_client(&priv->chnl); |
| 395 | − free_netdev(dev); | |
| 396 | 395 | } |
| 397 | 396 | |
| 398 | 397 | static void ipcaif_net_setup(struct net_device *dev) |
| 399 | 398 | { |
| 400 | 399 | struct chnl_net *priv; |
| 401 | 400 | dev->netdev_ops = &netdev_ops; |
| 402 | − dev->destructor = chnl_net_destructor; | |
| 401 | + dev->needs_free_netdev = true; | |
| 402 | + dev->priv_destructor = chnl_net_destructor; | |
| 403 | 403 | dev->flags |= IFF_NOARP; |
| 404 | 404 | dev->flags |= IFF_POINTOPOINT; |
| 405 | 405 | dev->mtu = GPRS_PDP_MTU; |
| @@ -872,8 +872,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg, · 871 unmodified lines | ||
| 872 | 872 | |
| 873 | 873 | static int can_pernet_init(struct net *net) |
| 874 | 874 | { |
| 875 | − net->can.can_rcvlists_lock = | |
| 876 | − __SPIN_LOCK_UNLOCKED(net->can.can_rcvlists_lock); | |
| 875 | + spin_lock_init(&net->can.can_rcvlists_lock); | |
| 877 | 876 | net->can.can_rx_alldev_list = |
| 878 | 877 | kzalloc(sizeof(struct dev_rcv_lists), GFP_KERNEL); |
| 879 | 878 | |
| @@ -1281,8 +1281,9 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len) · 1280 unmodified lines | ||
| 1281 | 1281 | if (!new_ifalias) |
| 1282 | 1282 | return -ENOMEM; |
| 1283 | 1283 | dev->ifalias = new_ifalias; |
| 1284 | + memcpy(dev->ifalias, alias, len); | |
| 1285 | + dev->ifalias[len] = 0; | |
| 1284 | 1286 | |
| 1285 | − strlcpy(dev->ifalias, alias, len+1); | |
| 1286 | 1287 | return len; |
| 1287 | 1288 | } |
| 1288 | 1289 | |
| @@ -5026,6 +5027,19 @@ __sum16 __skb_gro_checksum_complete(struct sk_buff *skb) · 3737 unmodified lines | ||
| 5026 | 5027 | } |
| 5027 | 5028 | EXPORT_SYMBOL(__skb_gro_checksum_complete); |
| 5028 | 5029 | |
| 5030 | +static void net_rps_send_ipi(struct softnet_data *remsd) | |
| 5031 | +{ | |
| 5032 | +#ifdef CONFIG_RPS | |
| 5033 | + while (remsd) { | |
| 5034 | + struct softnet_data *next = remsd->rps_ipi_next; | |
| 5035 | + | |
| 5036 | + if (cpu_online(remsd->cpu)) | |
| 5037 | + smp_call_function_single_async(remsd->cpu, &remsd->csd); | |
| 5038 | + remsd = next; | |
| 5039 | + } | |
| 5040 | +#endif | |
| 5041 | +} | |
| 5042 | + | |
| 5029 | 5043 | /* |
| 5030 | 5044 | * net_rps_action_and_irq_enable sends any pending IPI's for rps. |
| 5031 | 5045 | * Note: called with local irq disabled, but exits with local irq enabled. |
| @@ -5041,14 +5055,7 @@ static void net_rps_action_and_irq_enable(struct softnet_data *sd) · 9 unmodified lines | ||
| 5041 | 5055 | local_irq_enable(); |
| 5042 | 5056 | |
| 5043 | 5057 | /* Send pending IPI's to kick RPS processing on remote cpus. */ |
| 5044 | − while (remsd) { | |
| 5045 | − struct softnet_data *next = remsd->rps_ipi_next; | |
| 5046 | − | |
| 5047 | − if (cpu_online(remsd->cpu)) | |
| 5048 | − smp_call_function_single_async(remsd->cpu, | |
| 5049 | − &remsd->csd); | |
| 5050 | − remsd = next; | |
| 5051 | − } | |
| 5058 | + net_rps_send_ipi(remsd); | |
| 5052 | 5059 | } else |
| 5053 | 5060 | #endif |
| 5054 | 5061 | local_irq_enable(); |
| @@ -7579,6 +7586,8 @@ out: · 2524 unmodified lines | ||
| 7579 | 7586 | err_uninit: |
| 7580 | 7587 | if (dev->netdev_ops->ndo_uninit) |
| 7581 | 7588 | dev->netdev_ops->ndo_uninit(dev); |
| 7589 | + if (dev->priv_destructor) | |
| 7590 | + dev->priv_destructor(dev); | |
| 7582 | 7591 | goto out; |
| 7583 | 7592 | } |
| 7584 | 7593 | EXPORT_SYMBOL(register_netdevice); |
| @@ -7786,8 +7795,10 @@ void netdev_run_todo(void) · 201 unmodified lines | ||
| 7786 | 7795 | WARN_ON(rcu_access_pointer(dev->ip6_ptr)); |
| 7787 | 7796 | WARN_ON(dev->dn_ptr); |
| 7788 | 7797 | |
| 7789 | − if (dev->destructor) | |
| 7790 | − dev->destructor(dev); | |
| 7798 | + if (dev->priv_destructor) | |
| 7799 | + dev->priv_destructor(dev); | |
| 7800 | + if (dev->needs_free_netdev) | |
| 7801 | + free_netdev(dev); | |
| 7791 | 7802 | |
| 7792 | 7803 | /* Report a network device has been unregistered */ |
| 7793 | 7804 | rtnl_lock(); |
| @@ -8270,7 +8281,7 @@ static int dev_cpu_dead(unsigned int oldcpu) · 476 unmodified lines | ||
| 8270 | 8281 | struct sk_buff **list_skb; |
| 8271 | 8282 | struct sk_buff *skb; |
| 8272 | 8283 | unsigned int cpu; |
| 8273 | − struct softnet_data *sd, *oldsd; | |
| 8284 | + struct softnet_data *sd, *oldsd, *remsd = NULL; | |
| 8274 | 8285 | |
| 8275 | 8286 | local_irq_disable(); |
| 8276 | 8287 | cpu = smp_processor_id(); |
| @@ -8311,6 +8322,13 @@ static int dev_cpu_dead(unsigned int oldcpu) · 34 unmodified lines | ||
| 8311 | 8322 | raise_softirq_irqoff(NET_TX_SOFTIRQ); |
| 8312 | 8323 | local_irq_enable(); |
| 8313 | 8324 | |
| 8325 | +#ifdef CONFIG_RPS | |
| 8326 | + remsd = oldsd->rps_ipi_list; | |
| 8327 | + oldsd->rps_ipi_list = NULL; | |
| 8328 | +#endif | |
| 8329 | + /* send out pending IPI's on offline CPU */ | |
| 8330 | + net_rps_send_ipi(remsd); | |
| 8331 | + | |
| 8314 | 8332 | /* Process offline CPU's input_pkt_queue */ |
| 8315 | 8333 | while ((skb = __skb_dequeue(&oldsd->process_queue))) { |
| 8316 | 8334 | netif_rx_ni(skb); |
| @@ -469,6 +469,20 @@ static int dst_dev_event(struct notifier_block *this, unsigned long event, · 468 unmodified lines | ||
| 469 | 469 | spin_lock_bh(&dst_garbage.lock); |
| 470 | 470 | dst = dst_garbage.list; |
| 471 | 471 | dst_garbage.list = NULL; |
| 472 | + /* The code in dst_ifdown places a hold on the loopback device. | |
| 473 | + * If the gc entry processing is set to expire after a lengthy | |
| 474 | + * interval, this hold can cause netdev_wait_allrefs() to hang | |
| 475 | + * out and wait for a long time -- until the the loopback | |
| 476 | + * interface is released. If we're really unlucky, it'll emit | |
| 477 | + * pr_emerg messages to console too. Reset the interval here, | |
| 478 | + * so dst cleanups occur in a more timely fashion. | |
| 479 | + */ | |
| 480 | + if (dst_garbage.timer_inc > DST_GC_INC) { | |
| 481 | + dst_garbage.timer_inc = DST_GC_INC; | |
| 482 | + dst_garbage.timer_expires = DST_GC_MIN; | |
| 483 | + mod_delayed_work(system_wq, &dst_gc_work, | |
| 484 | + dst_garbage.timer_expires); | |
| 485 | + } | |
| 472 | 486 | spin_unlock_bh(&dst_garbage.lock); |
| 473 | 487 | |
| 474 | 488 | if (last) |
| @@ -1125,6 +1125,8 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 1124 unmodified lines | ||
| 1125 | 1125 | struct ifla_vf_mac vf_mac; |
| 1126 | 1126 | struct ifla_vf_info ivi; |
| 1127 | 1127 | |
| 1128 | + memset(&ivi, 0, sizeof(ivi)); | |
| 1129 | + | |
| 1128 | 1130 | /* Not all SR-IOV capable drivers support the |
| 1129 | 1131 | * spoofcheck and "RSS query enable" query. Preset to |
| 1130 | 1132 | * -1 so the user space tool can detect that the driver |
| @@ -1133,7 +1135,6 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb, · 2 unmodified lines | ||
| 1133 | 1135 | ivi.spoofchk = -1; |
| 1134 | 1136 | ivi.rss_query_en = -1; |
| 1135 | 1137 | ivi.trusted = -1; |
| 1136 | − memset(ivi.mac, 0, sizeof(ivi.mac)); | |
| 1137 | 1138 | /* The default value for VF link state is "auto" |
| 1138 | 1139 | * IFLA_VF_LINK_STATE_AUTO which equals zero |
| 1139 | 1140 | */ |
| @@ -102,7 +102,9 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb) · 101 unmodified lines | ||
| 102 | 102 | { |
| 103 | 103 | struct nlmsghdr *nlh = nlmsg_hdr(skb); |
| 104 | 104 | |
| 105 | − if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) | |
| 105 | + if (skb->len < sizeof(*nlh) || | |
| 106 | + nlh->nlmsg_len < sizeof(*nlh) || | |
| 107 | + skb->len < nlh->nlmsg_len) | |
| 106 | 108 | return; |
| 107 | 109 | |
| 108 | 110 | if (!netlink_capable(skb, CAP_NET_ADMIN)) |
| @@ -378,7 +378,6 @@ static void hsr_dev_destroy(struct net_device *hsr_dev) · 377 unmodified lines | ||
| 378 | 378 | del_timer_sync(&hsr->announce_timer); |
| 379 | 379 | |
| 380 | 380 | synchronize_rcu(); |
| 381 | − free_netdev(hsr_dev); | |
| 382 | 381 | } |
| 383 | 382 | |
| 384 | 383 | static const struct net_device_ops hsr_device_ops = { |
| @@ -404,7 +403,8 @@ void hsr_dev_setup(struct net_device *dev) · 19 unmodified lines | ||
| 404 | 403 | SET_NETDEV_DEVTYPE(dev, &hsr_type); |
| 405 | 404 | dev->priv_flags |= IFF_NO_QUEUE; |
| 406 | 405 | |
| 407 | − dev->destructor = hsr_dev_destroy; | |
| 406 | + dev->needs_free_netdev = true; | |
| 407 | + dev->priv_destructor = hsr_dev_destroy; | |
| 408 | 408 | |
| 409 | 409 | dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | |
| 410 | 410 | NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | |
| @@ -324,8 +324,7 @@ static int hsr_fill_frame_info(struct hsr_frame_info *frame, · 323 unmodified lines | ||
| 324 | 324 | unsigned long irqflags; |
| 325 | 325 | |
| 326 | 326 | frame->is_supervision = is_supervision_frame(port->hsr, skb); |
| 327 | − frame->node_src = hsr_get_node(&port->hsr->node_db, skb, | |
| 328 | − frame->is_supervision); | |
| 327 | + frame->node_src = hsr_get_node(port, skb, frame->is_supervision); | |
| 329 | 328 | if (frame->node_src == NULL) |
| 330 | 329 | return -1; /* Unknown node and !is_supervision, or no mem */ |
| 331 | 330 | |
| @@ -158,9 +158,10 @@ struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], · 157 unmodified lines | ||
| 158 | 158 | |
| 159 | 159 | /* Get the hsr_node from which 'skb' was sent. |
| 160 | 160 | */ |
| 161 | −struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, | |
| 161 | +struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, | |
| 162 | 162 | bool is_sup) |
| 163 | 163 | { |
| 164 | + struct list_head *node_db = &port->hsr->node_db; | |
| 164 | 165 | struct hsr_node *node; |
| 165 | 166 | struct ethhdr *ethhdr; |
| 166 | 167 | u16 seq_out; |
| @@ -186,7 +187,11 @@ struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, · 19 unmodified lines | ||
| 186 | 187 | */ |
| 187 | 188 | seq_out = hsr_get_skb_sequence_nr(skb) - 1; |
| 188 | 189 | } else { |
| 189 | − WARN_ONCE(1, "%s: Non-HSR frame\n", __func__); | |
| 190 | + /* this is called also for frames from master port and | |
| 191 | + * so warn only for non master ports | |
| 192 | + */ | |
| 193 | + if (port->type != HSR_PT_MASTER) | |
| 194 | + WARN_ONCE(1, "%s: Non-HSR frame\n", __func__); | |
| 190 | 195 | seq_out = HSR_SEQNR_START; |
| 191 | 196 | } |
| 192 | 197 | |
| @@ -18,7 +18,7 @@ struct hsr_node; · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], |
| 20 | 20 | u16 seq_out); |
| 21 | −struct hsr_node *hsr_get_node(struct list_head *node_db, struct sk_buff *skb, | |
| 21 | +struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb, | |
| 22 | 22 | bool is_sup); |
| 23 | 23 | void hsr_handle_sup_frame(struct sk_buff *skb, struct hsr_node *node_curr, |
| 24 | 24 | struct hsr_port *port); |
| @@ -107,7 +107,7 @@ static void lowpan_setup(struct net_device *ldev) · 106 unmodified lines | ||
| 107 | 107 | |
| 108 | 108 | ldev->netdev_ops = &lowpan_netdev_ops; |
| 109 | 109 | ldev->header_ops = &lowpan_header_ops; |
| 110 | − ldev->destructor = free_netdev; | |
| 110 | + ldev->needs_free_netdev = true; | |
| 111 | 111 | ldev->features |= NETIF_F_NETNS_LOCAL; |
| 112 | 112 | } |
| 113 | 113 | |
| @@ -657,8 +657,12 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) · 656 unmodified lines | ||
| 657 | 657 | /* Needed by both icmp_global_allow and icmp_xmit_lock */ |
| 658 | 658 | local_bh_disable(); |
| 659 | 659 | |
| 660 | − /* Check global sysctl_icmp_msgs_per_sec ratelimit */ | |
| 661 | − if (!icmpv4_global_allow(net, type, code)) | |
| 660 | + /* Check global sysctl_icmp_msgs_per_sec ratelimit, unless | |
| 661 | + * incoming dev is loopback. If outgoing dev change to not be | |
| 662 | + * loopback, then peer ratelimit still work (in icmpv4_xrlim_allow) | |
| 663 | + */ | |
| 664 | + if (!(skb_in->dev && (skb_in->dev->flags&IFF_LOOPBACK)) && | |
| 665 | + !icmpv4_global_allow(net, type, code)) | |
| 662 | 666 | goto out_bh_enable; |
| 663 | 667 | |
| 664 | 668 | sk = icmp_xmit_lock(net); |
| @@ -2071,21 +2071,26 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, · 2070 unmodified lines | ||
| 2071 | 2071 | |
| 2072 | 2072 | static void ip_mc_clear_src(struct ip_mc_list *pmc) |
| 2073 | 2073 | { |
| 2074 | − struct ip_sf_list *psf, *nextpsf; | |
| 2074 | + struct ip_sf_list *psf, *nextpsf, *tomb, *sources; | |
| 2075 | 2075 | |
| 2076 | − for (psf = pmc->tomb; psf; psf = nextpsf) { | |
| 2076 | + spin_lock_bh(&pmc->lock); | |
| 2077 | + tomb = pmc->tomb; | |
| 2078 | + pmc->tomb = NULL; | |
| 2079 | + sources = pmc->sources; | |
| 2080 | + pmc->sources = NULL; | |
| 2081 | + pmc->sfmode = MCAST_EXCLUDE; | |
| 2082 | + pmc->sfcount[MCAST_INCLUDE] = 0; | |
| 2083 | + pmc->sfcount[MCAST_EXCLUDE] = 1; | |
| 2084 | + spin_unlock_bh(&pmc->lock); | |
| 2085 | + | |
| 2086 | + for (psf = tomb; psf; psf = nextpsf) { | |
| 2077 | 2087 | nextpsf = psf->sf_next; |
| 2078 | 2088 | kfree(psf); |
| 2079 | 2089 | } |
| 2080 | − pmc->tomb = NULL; | |
| 2081 | − for (psf = pmc->sources; psf; psf = nextpsf) { | |
| 2090 | + for (psf = sources; psf; psf = nextpsf) { | |
| 2082 | 2091 | nextpsf = psf->sf_next; |
| 2083 | 2092 | kfree(psf); |
| 2084 | 2093 | } |
| 2085 | − pmc->sources = NULL; | |
| 2086 | − pmc->sfmode = MCAST_EXCLUDE; | |
| 2087 | − pmc->sfcount[MCAST_INCLUDE] = 0; | |
| 2088 | − pmc->sfcount[MCAST_EXCLUDE] = 1; | |
| 2089 | 2094 | } |
| 2090 | 2095 | |
| 2091 | 2096 | /* Join a multicast group |
| @@ -967,7 +967,6 @@ static void ip_tunnel_dev_free(struct net_device *dev) · 966 unmodified lines | ||
| 967 | 967 | gro_cells_destroy(&tunnel->gro_cells); |
| 968 | 968 | dst_cache_destroy(&tunnel->dst_cache); |
| 969 | 969 | free_percpu(dev->tstats); |
| 970 | − free_netdev(dev); | |
| 971 | 970 | } |
| 972 | 971 | |
| 973 | 972 | void ip_tunnel_dellink(struct net_device *dev, struct list_head *head) |
| @@ -1155,7 +1154,8 @@ int ip_tunnel_init(struct net_device *dev) · 181 unmodified lines | ||
| 1155 | 1154 | struct iphdr *iph = &tunnel->parms.iph; |
| 1156 | 1155 | int err; |
| 1157 | 1156 | |
| 1158 | − dev->destructor = ip_tunnel_dev_free; | |
| 1157 | + dev->needs_free_netdev = true; | |
| 1158 | + dev->priv_destructor = ip_tunnel_dev_free; | |
| 1159 | 1159 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
| 1160 | 1160 | if (!dev->tstats) |
| 1161 | 1161 | return -ENOMEM; |
| @@ -101,8 +101,8 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id); · 100 unmodified lines | ||
| 101 | 101 | static void ipmr_free_table(struct mr_table *mrt); |
| 102 | 102 | |
| 103 | 103 | static void ip_mr_forward(struct net *net, struct mr_table *mrt, |
| 104 | − struct sk_buff *skb, struct mfc_cache *cache, | |
| 105 | − int local); | |
| 104 | + struct net_device *dev, struct sk_buff *skb, | |
| 105 | + struct mfc_cache *cache, int local); | |
| 106 | 106 | static int ipmr_cache_report(struct mr_table *mrt, |
| 107 | 107 | struct sk_buff *pkt, vifi_t vifi, int assert); |
| 108 | 108 | static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, |
| @@ -501,7 +501,7 @@ static void reg_vif_setup(struct net_device *dev) · 392 unmodified lines | ||
| 501 | 501 | dev->mtu = ETH_DATA_LEN - sizeof(struct iphdr) - 8; |
| 502 | 502 | dev->flags = IFF_NOARP; |
| 503 | 503 | dev->netdev_ops = ®_vif_netdev_ops; |
| 504 | − dev->destructor = free_netdev; | |
| 504 | + dev->needs_free_netdev = true; | |
| 505 | 505 | dev->features |= NETIF_F_NETNS_LOCAL; |
| 506 | 506 | } |
| 507 | 507 | |
| @@ -988,7 +988,7 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt, · 480 unmodified lines | ||
| 988 | 988 | |
| 989 | 989 | rtnl_unicast(skb, net, NETLINK_CB(skb).portid); |
| 990 | 990 | } else { |
| 991 | − ip_mr_forward(net, mrt, skb, c, 0); | |
| 991 | + ip_mr_forward(net, mrt, skb->dev, skb, c, 0); | |
| 992 | 992 | } |
| 993 | 993 | } |
| 994 | 994 | } |
| @@ -1073,7 +1073,7 @@ static int ipmr_cache_report(struct mr_table *mrt, · 78 unmodified lines | ||
| 1073 | 1073 | |
| 1074 | 1074 | /* Queue a packet for resolution. It gets locked cache entry! */ |
| 1075 | 1075 | static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, |
| 1076 | − struct sk_buff *skb) | |
| 1076 | + struct sk_buff *skb, struct net_device *dev) | |
| 1077 | 1077 | { |
| 1078 | 1078 | const struct iphdr *iph = ip_hdr(skb); |
| 1079 | 1079 | struct mfc_cache *c; |
| @@ -1130,6 +1130,10 @@ static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi, · 50 unmodified lines | ||
| 1130 | 1130 | kfree_skb(skb); |
| 1131 | 1131 | err = -ENOBUFS; |
| 1132 | 1132 | } else { |
| 1133 | + if (dev) { | |
| 1134 | + skb->dev = dev; | |
| 1135 | + skb->skb_iif = dev->ifindex; | |
| 1136 | + } | |
| 1133 | 1137 | skb_queue_tail(&c->mfc_un.unres.unresolved, skb); |
| 1134 | 1138 | err = 0; |
| 1135 | 1139 | } |
| @@ -1828,10 +1832,10 @@ static int ipmr_find_vif(struct mr_table *mrt, struct net_device *dev) · 692 unmodified lines | ||
| 1828 | 1832 | |
| 1829 | 1833 | /* "local" means that we should preserve one skb (for local delivery) */ |
| 1830 | 1834 | static void ip_mr_forward(struct net *net, struct mr_table *mrt, |
| 1831 | − struct sk_buff *skb, struct mfc_cache *cache, | |
| 1832 | − int local) | |
| 1835 | + struct net_device *dev, struct sk_buff *skb, | |
| 1836 | + struct mfc_cache *cache, int local) | |
| 1833 | 1837 | { |
| 1834 | − int true_vifi = ipmr_find_vif(mrt, skb->dev); | |
| 1838 | + int true_vifi = ipmr_find_vif(mrt, dev); | |
| 1835 | 1839 | int psend = -1; |
| 1836 | 1840 | int vif, ct; |
| 1837 | 1841 | |
| @@ -1853,13 +1857,7 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, · 15 unmodified lines | ||
| 1853 | 1857 | } |
| 1854 | 1858 | |
| 1855 | 1859 | /* Wrong interface: drop packet and (maybe) send PIM assert. */ |
| 1856 | − if (mrt->vif_table[vif].dev != skb->dev) { | |
| 1857 | − struct net_device *mdev; | |
| 1858 | − | |
| 1859 | − mdev = l3mdev_master_dev_rcu(mrt->vif_table[vif].dev); | |
| 1860 | − if (mdev == skb->dev) | |
| 1861 | − goto forward; | |
| 1862 | − | |
| 1860 | + if (mrt->vif_table[vif].dev != dev) { | |
| 1863 | 1861 | if (rt_is_output_route(skb_rtable(skb))) { |
| 1864 | 1862 | /* It is our own packet, looped back. |
| 1865 | 1863 | * Very complicated situation... |
| @@ -2053,7 +2051,7 @@ int ip_mr_input(struct sk_buff *skb) · 187 unmodified lines | ||
| 2053 | 2051 | read_lock(&mrt_lock); |
| 2054 | 2052 | vif = ipmr_find_vif(mrt, dev); |
| 2055 | 2053 | if (vif >= 0) { |
| 2056 | − int err2 = ipmr_cache_unresolved(mrt, vif, skb); | |
| 2054 | + int err2 = ipmr_cache_unresolved(mrt, vif, skb, dev); | |
| 2057 | 2055 | read_unlock(&mrt_lock); |
| 2058 | 2056 | |
| 2059 | 2057 | return err2; |
| @@ -2064,7 +2062,7 @@ int ip_mr_input(struct sk_buff *skb) · 4 unmodified lines | ||
| 2064 | 2062 | } |
| 2065 | 2063 | |
| 2066 | 2064 | read_lock(&mrt_lock); |
| 2067 | − ip_mr_forward(net, mrt, skb, cache, local); | |
| 2065 | + ip_mr_forward(net, mrt, dev, skb, cache, local); | |
| 2068 | 2066 | read_unlock(&mrt_lock); |
| 2069 | 2067 | |
| 2070 | 2068 | if (local) |
| @@ -2238,7 +2236,7 @@ int ipmr_get_route(struct net *net, struct sk_buff *skb, · 167 unmodified lines | ||
| 2238 | 2236 | iph->saddr = saddr; |
| 2239 | 2237 | iph->daddr = daddr; |
| 2240 | 2238 | iph->version = 0; |
| 2241 | − err = ipmr_cache_unresolved(mrt, vif, skb2); | |
| 2239 | + err = ipmr_cache_unresolved(mrt, vif, skb2, dev); | |
| 2242 | 2240 | read_unlock(&mrt_lock); |
| 2243 | 2241 | rcu_read_unlock(); |
| 2244 | 2242 | return err; |
| @@ -491,7 +491,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, · 490 unmodified lines | ||
| 491 | 491 | local_bh_disable(); |
| 492 | 492 | |
| 493 | 493 | /* Check global sysctl_icmp_msgs_per_sec ratelimit */ |
| 494 | − if (!icmpv6_global_allow(type)) | |
| 494 | + if (!(skb->dev->flags&IFF_LOOPBACK) && !icmpv6_global_allow(type)) | |
| 495 | 495 | goto out_bh_enable; |
| 496 | 496 | |
| 497 | 497 | mip6_addr_swap(skb); |
| @@ -62,6 +62,7 @@ static inline u32 ila_locator_hash(struct ila_locator loc) · 61 unmodified lines | ||
| 62 | 62 | { |
| 63 | 63 | u32 *v = (u32 *)loc.v32; |
| 64 | 64 | |
| 65 | + __ila_hash_secret_init(); | |
| 65 | 66 | return jhash_2words(v[0], v[1], hashrnd); |
| 66 | 67 | } |
| 67 | 68 | |
| @@ -991,13 +991,13 @@ static void ip6gre_dev_free(struct net_device *dev) · 990 unmodified lines | ||
| 991 | 991 | |
| 992 | 992 | dst_cache_destroy(&t->dst_cache); |
| 993 | 993 | free_percpu(dev->tstats); |
| 994 | − free_netdev(dev); | |
| 995 | 994 | } |
| 996 | 995 | |
| 997 | 996 | static void ip6gre_tunnel_setup(struct net_device *dev) |
| 998 | 997 | { |
| 999 | 998 | dev->netdev_ops = &ip6gre_netdev_ops; |
| 1000 | − dev->destructor = ip6gre_dev_free; | |
| 999 | + dev->needs_free_netdev = true; | |
| 1000 | + dev->priv_destructor = ip6gre_dev_free; | |
| 1001 | 1001 | |
| 1002 | 1002 | dev->type = ARPHRD_IP6GRE; |
| 1003 | 1003 | |
| @@ -1148,7 +1148,7 @@ static int __net_init ip6gre_init_net(struct net *net) · 144 unmodified lines | ||
| 1148 | 1148 | return 0; |
| 1149 | 1149 | |
| 1150 | 1150 | err_reg_dev: |
| 1151 | − ip6gre_dev_free(ign->fb_tunnel_dev); | |
| 1151 | + free_netdev(ign->fb_tunnel_dev); | |
| 1152 | 1152 | err_alloc_dev: |
| 1153 | 1153 | return err; |
| 1154 | 1154 | } |
| @@ -1300,7 +1300,8 @@ static void ip6gre_tap_setup(struct net_device *dev) · 145 unmodified lines | ||
| 1300 | 1300 | ether_setup(dev); |
| 1301 | 1301 | |
| 1302 | 1302 | dev->netdev_ops = &ip6gre_tap_netdev_ops; |
| 1303 | − dev->destructor = ip6gre_dev_free; | |
| 1303 | + dev->needs_free_netdev = true; | |
| 1304 | + dev->priv_destructor = ip6gre_dev_free; | |
| 1304 | 1305 | |
| 1305 | 1306 | dev->features |= NETIF_F_NETNS_LOCAL; |
| 1306 | 1307 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| @@ -254,7 +254,6 @@ static void ip6_dev_free(struct net_device *dev) · 253 unmodified lines | ||
| 254 | 254 | gro_cells_destroy(&t->gro_cells); |
| 255 | 255 | dst_cache_destroy(&t->dst_cache); |
| 256 | 256 | free_percpu(dev->tstats); |
| 257 | − free_netdev(dev); | |
| 258 | 257 | } |
| 259 | 258 | |
| 260 | 259 | static int ip6_tnl_create2(struct net_device *dev) |
| @@ -322,7 +321,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) · 61 unmodified lines | ||
| 322 | 321 | return t; |
| 323 | 322 | |
| 324 | 323 | failed_free: |
| 325 | − ip6_dev_free(dev); | |
| 324 | + free_netdev(dev); | |
| 326 | 325 | failed: |
| 327 | 326 | return ERR_PTR(err); |
| 328 | 327 | } |
| @@ -1777,7 +1776,8 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { · 1448 unmodified lines | ||
| 1777 | 1776 | static void ip6_tnl_dev_setup(struct net_device *dev) |
| 1778 | 1777 | { |
| 1779 | 1778 | dev->netdev_ops = &ip6_tnl_netdev_ops; |
| 1780 | − dev->destructor = ip6_dev_free; | |
| 1779 | + dev->needs_free_netdev = true; | |
| 1780 | + dev->priv_destructor = ip6_dev_free; | |
| 1781 | 1781 | |
| 1782 | 1782 | dev->type = ARPHRD_TUNNEL6; |
| 1783 | 1783 | dev->flags |= IFF_NOARP; |
| @@ -2224,7 +2224,7 @@ static int __net_init ip6_tnl_init_net(struct net *net) · 440 unmodified lines | ||
| 2224 | 2224 | return 0; |
| 2225 | 2225 | |
| 2226 | 2226 | err_register: |
| 2227 | − ip6_dev_free(ip6n->fb_tnl_dev); | |
| 2227 | + free_netdev(ip6n->fb_tnl_dev); | |
| 2228 | 2228 | err_alloc_dev: |
| 2229 | 2229 | return err; |
| 2230 | 2230 | } |
| @@ -180,7 +180,6 @@ vti6_tnl_unlink(struct vti6_net *ip6n, struct ip6_tnl *t) · 179 unmodified lines | ||
| 180 | 180 | static void vti6_dev_free(struct net_device *dev) |
| 181 | 181 | { |
| 182 | 182 | free_percpu(dev->tstats); |
| 183 | − free_netdev(dev); | |
| 184 | 183 | } |
| 185 | 184 | |
| 186 | 185 | static int vti6_tnl_create2(struct net_device *dev) |
| @@ -235,7 +234,7 @@ static struct ip6_tnl *vti6_tnl_create(struct net *net, struct __ip6_tnl_parm *p · 48 unmodified lines | ||
| 235 | 234 | return t; |
| 236 | 235 | |
| 237 | 236 | failed_free: |
| 238 | − vti6_dev_free(dev); | |
| 237 | + free_netdev(dev); | |
| 239 | 238 | failed: |
| 240 | 239 | return NULL; |
| 241 | 240 | } |
| @@ -842,7 +841,8 @@ static const struct net_device_ops vti6_netdev_ops = { · 600 unmodified lines | ||
| 842 | 841 | static void vti6_dev_setup(struct net_device *dev) |
| 843 | 842 | { |
| 844 | 843 | dev->netdev_ops = &vti6_netdev_ops; |
| 845 | − dev->destructor = vti6_dev_free; | |
| 844 | + dev->needs_free_netdev = true; | |
| 845 | + dev->priv_destructor = vti6_dev_free; | |
| 846 | 846 | |
| 847 | 847 | dev->type = ARPHRD_TUNNEL6; |
| 848 | 848 | dev->hard_header_len = LL_MAX_HEADER + sizeof(struct ipv6hdr); |
| @@ -1100,7 +1100,7 @@ static int __net_init vti6_init_net(struct net *net) · 251 unmodified lines | ||
| 1100 | 1100 | return 0; |
| 1101 | 1101 | |
| 1102 | 1102 | err_register: |
| 1103 | − vti6_dev_free(ip6n->fb_tnl_dev); | |
| 1103 | + free_netdev(ip6n->fb_tnl_dev); | |
| 1104 | 1104 | err_alloc_dev: |
| 1105 | 1105 | return err; |
| 1106 | 1106 | } |
| @@ -733,7 +733,7 @@ static void reg_vif_setup(struct net_device *dev) · 732 unmodified lines | ||
| 733 | 733 | dev->mtu = 1500 - sizeof(struct ipv6hdr) - 8; |
| 734 | 734 | dev->flags = IFF_NOARP; |
| 735 | 735 | dev->netdev_ops = ®_vif_netdev_ops; |
| 736 | − dev->destructor = free_netdev; | |
| 736 | + dev->needs_free_netdev = true; | |
| 737 | 737 | dev->features |= NETIF_F_NETNS_LOCAL; |
| 738 | 738 | } |
| 739 | 739 | |
| @@ -219,7 +219,7 @@ static void snmp6_seq_show_item64(struct seq_file *seq, void __percpu *mib, · 218 unmodified lines | ||
| 219 | 219 | u64 buff64[SNMP_MIB_MAX]; |
| 220 | 220 | int i; |
| 221 | 221 | |
| 222 | − memset(buff64, 0, sizeof(unsigned long) * SNMP_MIB_MAX); | |
| 222 | + memset(buff64, 0, sizeof(u64) * SNMP_MIB_MAX); | |
| 223 | 223 | |
| 224 | 224 | snmp_get_cpu_field64_batch(buff64, itemlist, mib, syncpoff); |
| 225 | 225 | for (i = 0; itemlist[i].name; i++) |
| @@ -2832,6 +2832,7 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg) · 2831 unmodified lines | ||
| 2832 | 2832 | if ((rt->dst.dev == dev || !dev) && |
| 2833 | 2833 | rt != adn->net->ipv6.ip6_null_entry && |
| 2834 | 2834 | (rt->rt6i_nsiblings == 0 || |
| 2835 | + (dev && netdev_unregistering(dev)) || | |
| 2835 | 2836 | !rt->rt6i_idev->cnf.ignore_routes_with_linkdown)) |
| 2836 | 2837 | return -1; |
| 2837 | 2838 | |
| @@ -265,7 +265,7 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, · 264 unmodified lines | ||
| 265 | 265 | return nt; |
| 266 | 266 | |
| 267 | 267 | failed_free: |
| 268 | − ipip6_dev_free(dev); | |
| 268 | + free_netdev(dev); | |
| 269 | 269 | failed: |
| 270 | 270 | return NULL; |
| 271 | 271 | } |
| @@ -1336,7 +1336,6 @@ static void ipip6_dev_free(struct net_device *dev) · 1064 unmodified lines | ||
| 1336 | 1336 | |
| 1337 | 1337 | dst_cache_destroy(&tunnel->dst_cache); |
| 1338 | 1338 | free_percpu(dev->tstats); |
| 1339 | − free_netdev(dev); | |
| 1340 | 1339 | } |
| 1341 | 1340 | |
| 1342 | 1341 | #define SIT_FEATURES (NETIF_F_SG | \ |
| @@ -1351,7 +1350,8 @@ static void ipip6_tunnel_setup(struct net_device *dev) · 8 unmodified lines | ||
| 1351 | 1350 | int t_hlen = tunnel->hlen + sizeof(struct iphdr); |
| 1352 | 1351 | |
| 1353 | 1352 | dev->netdev_ops = &ipip6_netdev_ops; |
| 1354 | − dev->destructor = ipip6_dev_free; | |
| 1353 | + dev->needs_free_netdev = true; | |
| 1354 | + dev->priv_destructor = ipip6_dev_free; | |
| 1355 | 1355 | |
| 1356 | 1356 | dev->type = ARPHRD_SIT; |
| 1357 | 1357 | dev->hard_header_len = LL_MAX_HEADER + t_hlen; |
| @@ -65,7 +65,7 @@ static void irlan_eth_setup(struct net_device *dev) · 64 unmodified lines | ||
| 65 | 65 | ether_setup(dev); |
| 66 | 66 | |
| 67 | 67 | dev->netdev_ops = &irlan_eth_netdev_ops; |
| 68 | − dev->destructor = free_netdev; | |
| 68 | + dev->needs_free_netdev = true; | |
| 69 | 69 | dev->min_mtu = 0; |
| 70 | 70 | dev->max_mtu = ETH_MAX_MTU; |
| 71 | 71 | |
| @@ -114,12 +114,13 @@ static void l2tp_eth_get_stats64(struct net_device *dev, · 113 unmodified lines | ||
| 114 | 114 | { |
| 115 | 115 | struct l2tp_eth *priv = netdev_priv(dev); |
| 116 | 116 | |
| 117 | − stats->tx_bytes = atomic_long_read(&priv->tx_bytes); | |
| 118 | − stats->tx_packets = atomic_long_read(&priv->tx_packets); | |
| 119 | − stats->tx_dropped = atomic_long_read(&priv->tx_dropped); | |
| 120 | − stats->rx_bytes = atomic_long_read(&priv->rx_bytes); | |
| 121 | − stats->rx_packets = atomic_long_read(&priv->rx_packets); | |
| 122 | − stats->rx_errors = atomic_long_read(&priv->rx_errors); | |
| 117 | + stats->tx_bytes = (unsigned long) atomic_long_read(&priv->tx_bytes); | |
| 118 | + stats->tx_packets = (unsigned long) atomic_long_read(&priv->tx_packets); | |
| 119 | + stats->tx_dropped = (unsigned long) atomic_long_read(&priv->tx_dropped); | |
| 120 | + stats->rx_bytes = (unsigned long) atomic_long_read(&priv->rx_bytes); | |
| 121 | + stats->rx_packets = (unsigned long) atomic_long_read(&priv->rx_packets); | |
| 122 | + stats->rx_errors = (unsigned long) atomic_long_read(&priv->rx_errors); | |
| 123 | + | |
| 123 | 124 | } |
| 124 | 125 | |
| 125 | 126 | static const struct net_device_ops l2tp_eth_netdev_ops = { |
| @@ -141,7 +142,7 @@ static void l2tp_eth_dev_setup(struct net_device *dev) · 15 unmodified lines | ||
| 141 | 142 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| 142 | 143 | dev->features |= NETIF_F_LLTX; |
| 143 | 144 | dev->netdev_ops = &l2tp_eth_netdev_ops; |
| 144 | − dev->destructor = free_netdev; | |
| 145 | + dev->needs_free_netdev = true; | |
| 145 | 146 | } |
| 146 | 147 | |
| 147 | 148 | static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb, int data_len) |
| @@ -902,6 +902,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, · 901 unmodified lines | ||
| 902 | 902 | default: |
| 903 | 903 | return -EINVAL; |
| 904 | 904 | } |
| 905 | + sdata->u.ap.req_smps = sdata->smps_mode; | |
| 906 | + | |
| 905 | 907 | sdata->needed_rx_chains = sdata->local->rx_chains; |
| 906 | 908 | |
| 907 | 909 | sdata->vif.bss_conf.beacon_int = params->beacon_interval; |
| @@ -1523,7 +1523,7 @@ ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) · 1522 unmodified lines | ||
| 1523 | 1523 | return true; |
| 1524 | 1524 | /* can't handle non-legacy preamble yet */ |
| 1525 | 1525 | if (status->flag & RX_FLAG_MACTIME_PLCP_START && |
| 1526 | − status->encoding != RX_ENC_LEGACY) | |
| 1526 | + status->encoding == RX_ENC_LEGACY) | |
| 1527 | 1527 | return true; |
| 1528 | 1528 | return false; |
| 1529 | 1529 | } |
| @@ -1213,7 +1213,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = { · 1212 unmodified lines | ||
| 1213 | 1213 | static void ieee80211_if_free(struct net_device *dev) |
| 1214 | 1214 | { |
| 1215 | 1215 | free_percpu(dev->tstats); |
| 1216 | − free_netdev(dev); | |
| 1217 | 1216 | } |
| 1218 | 1217 | |
| 1219 | 1218 | static void ieee80211_if_setup(struct net_device *dev) |
| @@ -1221,7 +1220,8 @@ static void ieee80211_if_setup(struct net_device *dev) · 1 unmodified line | ||
| 1221 | 1220 | ether_setup(dev); |
| 1222 | 1221 | dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| 1223 | 1222 | dev->netdev_ops = &ieee80211_dataif_ops; |
| 1224 | − dev->destructor = ieee80211_if_free; | |
| 1223 | + dev->needs_free_netdev = true; | |
| 1224 | + dev->priv_destructor = ieee80211_if_free; | |
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | 1227 | static void ieee80211_if_setup_no_queue(struct net_device *dev) |
| @@ -1795,6 +1795,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 567 unmodified lines | ||
| 1795 | 1795 | ret = dev_alloc_name(ndev, ndev->name); |
| 1796 | 1796 | if (ret < 0) { |
| 1797 | 1797 | ieee80211_if_free(ndev); |
| 1798 | + free_netdev(ndev); | |
| 1798 | 1799 | return ret; |
| 1799 | 1800 | } |
| 1800 | 1801 | |
| @@ -1884,7 +1885,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, · 83 unmodified lines | ||
| 1884 | 1885 | |
| 1885 | 1886 | ret = register_netdevice(ndev); |
| 1886 | 1887 | if (ret) { |
| 1887 | − ieee80211_if_free(ndev); | |
| 1888 | + free_netdev(ndev); | |
| 1888 | 1889 | return ret; |
| 1889 | 1890 | } |
| 1890 | 1891 | } |
| @@ -601,7 +601,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 600 unmodified lines | ||
| 601 | 601 | struct ieee80211_supported_band *sband; |
| 602 | 602 | struct ieee80211_chanctx_conf *chanctx_conf; |
| 603 | 603 | struct ieee80211_channel *chan; |
| 604 | − u32 rate_flags, rates = 0; | |
| 604 | + u32 rates = 0; | |
| 605 | 605 | |
| 606 | 606 | sdata_assert_lock(sdata); |
| 607 | 607 | |
| @@ -612,7 +612,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 4 unmodified lines | ||
| 612 | 612 | return; |
| 613 | 613 | } |
| 614 | 614 | chan = chanctx_conf->def.chan; |
| 615 | − rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def); | |
| 616 | 615 | rcu_read_unlock(); |
| 617 | 616 | sband = local->hw.wiphy->bands[chan->band]; |
| 618 | 617 | shift = ieee80211_vif_get_shift(&sdata->vif); |
| @@ -636,9 +635,6 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 17 unmodified lines | ||
| 636 | 635 | */ |
| 637 | 636 | rates_len = 0; |
| 638 | 637 | for (i = 0; i < sband->n_bitrates; i++) { |
| 639 | − if ((rate_flags & sband->bitrates[i].flags) | |
| 640 | − != rate_flags) | |
| 641 | − continue; | |
| 642 | 638 | rates |= BIT(i); |
| 643 | 639 | rates_len++; |
| 644 | 640 | } |
| @@ -2817,7 +2813,7 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 2172 unmodified lines | ||
| 2817 | 2813 | u32 *rates, u32 *basic_rates, |
| 2818 | 2814 | bool *have_higher_than_11mbit, |
| 2819 | 2815 | int *min_rate, int *min_rate_index, |
| 2820 | − int shift, u32 rate_flags) | |
| 2816 | + int shift) | |
| 2821 | 2817 | { |
| 2822 | 2818 | int i, j; |
| 2823 | 2819 | |
| @@ -2845,8 +2841,6 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband, · 21 unmodified lines | ||
| 2845 | 2841 | int brate; |
| 2846 | 2842 | |
| 2847 | 2843 | br = &sband->bitrates[j]; |
| 2848 | − if ((rate_flags & br->flags) != rate_flags) | |
| 2849 | − continue; | |
| 2850 | 2844 | |
| 2851 | 2845 | brate = DIV_ROUND_UP(br->bitrate, (1 << shift) * 5); |
| 2852 | 2846 | if (brate == rate) { |
| @@ -4397,40 +4391,32 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 1544 unmodified lines | ||
| 4397 | 4391 | return -ENOMEM; |
| 4398 | 4392 | } |
| 4399 | 4393 | |
| 4400 | − if (new_sta || override) { | |
| 4401 | − err = ieee80211_prep_channel(sdata, cbss); | |
| 4402 | − if (err) { | |
| 4403 | − if (new_sta) | |
| 4404 | − sta_info_free(local, new_sta); | |
| 4405 | − return -EINVAL; | |
| 4406 | − } | |
| 4407 | − } | |
| 4408 | − | |
| 4394 | + /* | |
| 4395 | + * Set up the information for the new channel before setting the | |
| 4396 | + * new channel. We can't - completely race-free - change the basic | |
| 4397 | + * rates bitmap and the channel (sband) that it refers to, but if | |
| 4398 | + * we set it up before we at least avoid calling into the driver's | |
| 4399 | + * bss_info_changed() method with invalid information (since we do | |
| 4400 | + * call that from changing the channel - only for IDLE and perhaps | |
| 4401 | + * some others, but ...). | |
| 4402 | + * | |
| 4403 | + * So to avoid that, just set up all the new information before the | |
| 4404 | + * channel, but tell the driver to apply it only afterwards, since | |
| 4405 | + * it might need the new channel for that. | |
| 4406 | + */ | |
| 4409 | 4407 | if (new_sta) { |
| 4410 | 4408 | u32 rates = 0, basic_rates = 0; |
| 4411 | 4409 | bool have_higher_than_11mbit; |
| 4412 | 4410 | int min_rate = INT_MAX, min_rate_index = -1; |
| 4413 | − struct ieee80211_chanctx_conf *chanctx_conf; | |
| 4414 | 4411 | const struct cfg80211_bss_ies *ies; |
| 4415 | 4412 | int shift = ieee80211_vif_get_shift(&sdata->vif); |
| 4416 | − u32 rate_flags; | |
| 4417 | − | |
| 4418 | − rcu_read_lock(); | |
| 4419 | − chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | |
| 4420 | − if (WARN_ON(!chanctx_conf)) { | |
| 4421 | − rcu_read_unlock(); | |
| 4422 | − sta_info_free(local, new_sta); | |
| 4423 | − return -EINVAL; | |
| 4424 | − } | |
| 4425 | − rate_flags = ieee80211_chandef_rate_flags(&chanctx_conf->def); | |
| 4426 | − rcu_read_unlock(); | |
| 4427 | 4413 | |
| 4428 | 4414 | ieee80211_get_rates(sband, bss->supp_rates, |
| 4429 | 4415 | bss->supp_rates_len, |
| 4430 | 4416 | &rates, &basic_rates, |
| 4431 | 4417 | &have_higher_than_11mbit, |
| 4432 | 4418 | &min_rate, &min_rate_index, |
| 4433 | − shift, rate_flags); | |
| 4419 | + shift); | |
| 4434 | 4420 | |
| 4435 | 4421 | /* |
| 4436 | 4422 | * This used to be a workaround for basic rates missing |
| @@ -4488,8 +4474,22 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, · 51 unmodified lines | ||
| 4488 | 4474 | sdata->vif.bss_conf.sync_dtim_count = 0; |
| 4489 | 4475 | } |
| 4490 | 4476 | rcu_read_unlock(); |
| 4477 | + } | |
| 4491 | 4478 | |
| 4492 | − /* tell driver about BSSID, basic rates and timing */ | |
| 4479 | + if (new_sta || override) { | |
| 4480 | + err = ieee80211_prep_channel(sdata, cbss); | |
| 4481 | + if (err) { | |
| 4482 | + if (new_sta) | |
| 4483 | + sta_info_free(local, new_sta); | |
| 4484 | + return -EINVAL; | |
| 4485 | + } | |
| 4486 | + } | |
| 4487 | + | |
| 4488 | + if (new_sta) { | |
| 4489 | + /* | |
| 4490 | + * tell driver about BSSID, basic rates and timing | |
| 4491 | + * this was set up above, before setting the channel | |
| 4492 | + */ | |
| 4493 | 4493 | ieee80211_bss_info_change_notify(sdata, |
| 4494 | 4494 | BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES | |
| 4495 | 4495 | BSS_CHANGED_BEACON_INT); |
| @@ -1611,12 +1611,16 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) · 1610 unmodified lines | ||
| 1611 | 1611 | */ |
| 1612 | 1612 | if (!ieee80211_hw_check(&sta->local->hw, AP_LINK_PS) && |
| 1613 | 1613 | !ieee80211_has_morefrags(hdr->frame_control) && |
| 1614 | + !ieee80211_is_back_req(hdr->frame_control) && | |
| 1614 | 1615 | !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && |
| 1615 | 1616 | (rx->sdata->vif.type == NL80211_IFTYPE_AP || |
| 1616 | 1617 | rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && |
| 1617 | − /* PM bit is only checked in frames where it isn't reserved, | |
| 1618 | + /* | |
| 1619 | + * PM bit is only checked in frames where it isn't reserved, | |
| 1618 | 1620 | * in AP mode it's reserved in non-bufferable management frames |
| 1619 | 1621 | * (cf. IEEE 802.11-2012 8.2.4.1.7 Power Management field) |
| 1622 | + * BAR frames should be ignored as specified in | |
| 1623 | + * IEEE 802.11-2012 10.2.1.2. | |
| 1620 | 1624 | */ |
| 1621 | 1625 | (!ieee80211_is_mgmt(hdr->frame_control) || |
| 1622 | 1626 | ieee80211_is_bufferable_mmpdu(hdr->frame_control))) { |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <asm/unaligned.h> |
| 18 | 18 | #include <net/mac80211.h> |
| 19 | 19 | #include <crypto/aes.h> |
| 20 | +#include <crypto/algapi.h> | |
| 20 | 21 | |
| 21 | 22 | #include "ieee80211_i.h" |
| 22 | 23 | #include "michael.h" |
| @@ -153,7 +154,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) · 130 unmodified lines | ||
| 153 | 154 | data_len = skb->len - hdrlen - MICHAEL_MIC_LEN; |
| 154 | 155 | key = &rx->key->conf.key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY]; |
| 155 | 156 | michael_mic(key, hdr, data, data_len, mic); |
| 156 | − if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0) | |
| 157 | + if (crypto_memneq(mic, data + data_len, MICHAEL_MIC_LEN)) | |
| 157 | 158 | goto mic_fail; |
| 158 | 159 | |
| 159 | 160 | /* remove Michael MIC from payload */ |
| @@ -1048,7 +1049,7 @@ ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) · 888 unmodified lines | ||
| 1048 | 1049 | bip_aad(skb, aad); |
| 1049 | 1050 | ieee80211_aes_cmac(key->u.aes_cmac.tfm, aad, |
| 1050 | 1051 | skb->data + 24, skb->len - 24, mic); |
| 1051 | − if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { | |
| 1052 | + if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { | |
| 1052 | 1053 | key->u.aes_cmac.icverrors++; |
| 1053 | 1054 | return RX_DROP_UNUSABLE; |
| 1054 | 1055 | } |
| @@ -1098,7 +1099,7 @@ ieee80211_crypto_aes_cmac_256_decrypt(struct ieee80211_rx_data *rx) · 43 unmodified lines | ||
| 1098 | 1099 | bip_aad(skb, aad); |
| 1099 | 1100 | ieee80211_aes_cmac_256(key->u.aes_cmac.tfm, aad, |
| 1100 | 1101 | skb->data + 24, skb->len - 24, mic); |
| 1101 | − if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { | |
| 1102 | + if (crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { | |
| 1102 | 1103 | key->u.aes_cmac.icverrors++; |
| 1103 | 1104 | return RX_DROP_UNUSABLE; |
| 1104 | 1105 | } |
| @@ -1202,7 +1203,7 @@ ieee80211_crypto_aes_gmac_decrypt(struct ieee80211_rx_data *rx) · 97 unmodified lines | ||
| 1202 | 1203 | if (ieee80211_aes_gmac(key->u.aes_gmac.tfm, aad, nonce, |
| 1203 | 1204 | skb->data + 24, skb->len - 24, |
| 1204 | 1205 | mic) < 0 || |
| 1205 | − memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { | |
| 1206 | + crypto_memneq(mic, mmie->mic, sizeof(mmie->mic))) { | |
| 1206 | 1207 | key->u.aes_gmac.icverrors++; |
| 1207 | 1208 | return RX_DROP_UNUSABLE; |
| 1208 | 1209 | } |
| @@ -526,8 +526,6 @@ static void mac802154_wpan_free(struct net_device *dev) · 525 unmodified lines | ||
| 526 | 526 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
| 527 | 527 | |
| 528 | 528 | mac802154_llsec_destroy(&sdata->sec); |
| 529 | − | |
| 530 | − free_netdev(dev); | |
| 531 | 529 | } |
| 532 | 530 | |
| 533 | 531 | static void ieee802154_if_setup(struct net_device *dev) |
| @@ -593,7 +591,8 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 59 unmodified lines | ||
| 593 | 591 | sdata->dev->dev_addr); |
| 594 | 592 | |
| 595 | 593 | sdata->dev->header_ops = &mac802154_header_ops; |
| 596 | − sdata->dev->destructor = mac802154_wpan_free; | |
| 594 | + sdata->dev->needs_free_netdev = true; | |
| 595 | + sdata->dev->priv_destructor = mac802154_wpan_free; | |
| 597 | 596 | sdata->dev->netdev_ops = &mac802154_wpan_ops; |
| 598 | 597 | sdata->dev->ml_priv = &mac802154_mlme_wpan; |
| 599 | 598 | wpan_dev->promiscuous_mode = false; |
| @@ -608,7 +607,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, · 8 unmodified lines | ||
| 608 | 607 | |
| 609 | 608 | break; |
| 610 | 609 | case NL802154_IFTYPE_MONITOR: |
| 611 | − sdata->dev->destructor = free_netdev; | |
| 610 | + sdata->dev->needs_free_netdev = true; | |
| 612 | 611 | sdata->dev->netdev_ops = &mac802154_monitor_ops; |
| 613 | 612 | wpan_dev->promiscuous_mode = true; |
| 614 | 613 | break; |
| @@ -94,7 +94,6 @@ static void internal_dev_destructor(struct net_device *dev) · 93 unmodified lines | ||
| 94 | 94 | struct vport *vport = ovs_internal_dev_get_vport(dev); |
| 95 | 95 | |
| 96 | 96 | ovs_vport_free(vport); |
| 97 | − free_netdev(dev); | |
| 98 | 97 | } |
| 99 | 98 | |
| 100 | 99 | static void |
| @@ -156,7 +155,8 @@ static void do_setup(struct net_device *netdev) · 55 unmodified lines | ||
| 156 | 155 | netdev->priv_flags &= ~IFF_TX_SKB_SHARING; |
| 157 | 156 | netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH | |
| 158 | 157 | IFF_PHONY_HEADROOM | IFF_NO_QUEUE; |
| 159 | − netdev->destructor = internal_dev_destructor; | |
| 158 | + netdev->needs_free_netdev = true; | |
| 159 | + netdev->priv_destructor = internal_dev_destructor; | |
| 160 | 160 | netdev->ethtool_ops = &internal_dev_ethtool_ops; |
| 161 | 161 | netdev->rtnl_link_ops = &internal_dev_link_ops; |
| 162 | 162 | |
| @@ -236,7 +236,7 @@ static void gprs_setup(struct net_device *dev) · 235 unmodified lines | ||
| 236 | 236 | dev->tx_queue_len = 10; |
| 237 | 237 | |
| 238 | 238 | dev->netdev_ops = &gprs_netdev_ops; |
| 239 | − dev->destructor = free_netdev; | |
| 239 | + dev->needs_free_netdev = true; | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /* |
| @@ -94,8 +94,10 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla, · 93 unmodified lines | ||
| 94 | 94 | k++; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | − if (n) | |
| 97 | + if (n) { | |
| 98 | + err = -EINVAL; | |
| 98 | 99 | goto err_out; |
| 100 | + } | |
| 99 | 101 | |
| 100 | 102 | return keys_ex; |
| 101 | 103 | |
| @@ -132,21 +132,21 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 131 unmodified lines | ||
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | − spin_lock_bh(&police->tcf_lock); | |
| 136 | 135 | if (est) { |
| 137 | 136 | err = gen_replace_estimator(&police->tcf_bstats, NULL, |
| 138 | 137 | &police->tcf_rate_est, |
| 139 | 138 | &police->tcf_lock, |
| 140 | 139 | NULL, est); |
| 141 | 140 | if (err) |
| 142 | − goto failure_unlock; | |
| 141 | + goto failure; | |
| 143 | 142 | } else if (tb[TCA_POLICE_AVRATE] && |
| 144 | 143 | (ret == ACT_P_CREATED || |
| 145 | 144 | !gen_estimator_active(&police->tcf_rate_est))) { |
| 146 | 145 | err = -EINVAL; |
| 147 | − goto failure_unlock; | |
| 146 | + goto failure; | |
| 148 | 147 | } |
| 149 | 148 | |
| 149 | + spin_lock_bh(&police->tcf_lock); | |
| 150 | 150 | /* No failure allowed after this point */ |
| 151 | 151 | police->tcfp_mtu = parm->mtu; |
| 152 | 152 | if (police->tcfp_mtu == 0) { |
| @@ -192,8 +192,6 @@ static int tcf_act_police_init(struct net *net, struct nlattr *nla, · 39 unmodified lines | ||
| 192 | 192 | |
| 193 | 193 | return ret; |
| 194 | 194 | |
| 195 | −failure_unlock: | |
| 196 | − spin_unlock_bh(&police->tcf_lock); | |
| 197 | 195 | failure: |
| 198 | 196 | qdisc_put_rtab(P_tab); |
| 199 | 197 | qdisc_put_rtab(R_tab); |
| @@ -4622,13 +4622,13 @@ int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), · 4621 unmodified lines | ||
| 4622 | 4622 | |
| 4623 | 4623 | for (head = sctp_ep_hashtable; hash < sctp_ep_hashsize; |
| 4624 | 4624 | hash++, head++) { |
| 4625 | − read_lock(&head->lock); | |
| 4625 | + read_lock_bh(&head->lock); | |
| 4626 | 4626 | sctp_for_each_hentry(epb, &head->chain) { |
| 4627 | 4627 | err = cb(sctp_ep(epb), p); |
| 4628 | 4628 | if (err) |
| 4629 | 4629 | break; |
| 4630 | 4630 | } |
| 4631 | − read_unlock(&head->lock); | |
| 4631 | + read_unlock_bh(&head->lock); | |
| 4632 | 4632 | } |
| 4633 | 4633 | |
| 4634 | 4634 | return err; |
| @@ -508,7 +508,7 @@ bool tipc_msg_reverse(u32 own_node, struct sk_buff **skb, int err) · 507 unmodified lines | ||
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | if (skb_cloned(_skb) && |
| 511 | − pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_KERNEL)) | |
| 511 | + pskb_expand_head(_skb, BUF_HEADROOM, BUF_TAILROOM, GFP_ATOMIC)) | |
| 512 | 512 | goto exit; |
| 513 | 513 | |
| 514 | 514 | /* Now reverse the concerned fields */ |
| @@ -999,7 +999,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) · 998 unmodified lines | ||
| 999 | 999 | struct path path = { }; |
| 1000 | 1000 | |
| 1001 | 1001 | err = -EINVAL; |
| 1002 | − if (sunaddr->sun_family != AF_UNIX) | |
| 1002 | + if (addr_len < offsetofend(struct sockaddr_un, sun_family) || | |
| 1003 | + sunaddr->sun_family != AF_UNIX) | |
| 1003 | 1004 | goto out; |
| 1004 | 1005 | |
| 1005 | 1006 | if (addr_len == sizeof(short)) { |
| @@ -1110,6 +1111,10 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, · 104 unmodified lines | ||
| 1110 | 1111 | unsigned int hash; |
| 1111 | 1112 | int err; |
| 1112 | 1113 | |
| 1114 | + err = -EINVAL; | |
| 1115 | + if (alen < offsetofend(struct sockaddr, sa_family)) | |
| 1116 | + goto out; | |
| 1117 | + | |
| 1113 | 1118 | if (addr->sa_family != AF_UNSPEC) { |
| 1114 | 1119 | err = unix_mkname(sunaddr, alen, &hash); |
| 1115 | 1120 | if (err < 0) |
| @@ -20,6 +20,10 @@ config KEYS · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | If you are unsure as to whether this is required, answer N. |
| 22 | 22 | |
| 23 | +config KEYS_COMPAT | |
| 24 | + def_bool y | |
| 25 | + depends on COMPAT && KEYS | |
| 26 | + | |
| 23 | 27 | config PERSISTENT_KEYRINGS |
| 24 | 28 | bool "Enable register of persistent per-UID keyrings" |
| 25 | 29 | depends on KEYS |
| @@ -89,9 +93,9 @@ config ENCRYPTED_KEYS · 63 unmodified lines | ||
| 89 | 93 | config KEY_DH_OPERATIONS |
| 90 | 94 | bool "Diffie-Hellman operations on retained keys" |
| 91 | 95 | depends on KEYS |
| 92 | − select MPILIB | |
| 93 | 96 | select CRYPTO |
| 94 | 97 | select CRYPTO_HASH |
| 98 | + select CRYPTO_DH | |
| 95 | 99 | help |
| 96 | 100 | This option provides support for calculating Diffie-Hellman |
| 97 | 101 | public keys and shared secrets using values stored as keys |
| @@ -8,34 +8,17 @@ · 7 unmodified lines | ||
| 8 | 8 | * 2 of the License, or (at your option) any later version. |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | −#include <linux/mpi.h> | |
| 12 | 11 | #include <linux/slab.h> |
| 13 | 12 | #include <linux/uaccess.h> |
| 13 | +#include <linux/scatterlist.h> | |
| 14 | 14 | #include <linux/crypto.h> |
| 15 | 15 | #include <crypto/hash.h> |
| 16 | +#include <crypto/kpp.h> | |
| 17 | +#include <crypto/dh.h> | |
| 16 | 18 | #include <keys/user-type.h> |
| 17 | 19 | #include "internal.h" |
| 18 | 20 | |
| 19 | −/* | |
| 20 | − * Public key or shared secret generation function [RFC2631 sec 2.1.1] | |
| 21 | − * | |
| 22 | − * ya = g^xa mod p; | |
| 23 | − * or | |
| 24 | − * ZZ = yb^xa mod p; | |
| 25 | − * | |
| 26 | − * where xa is the local private key, ya is the local public key, g is | |
| 27 | − * the generator, p is the prime, yb is the remote public key, and ZZ | |
| 28 | − * is the shared secret. | |
| 29 | − * | |
| 30 | − * Both are the same calculation, so g or yb are the "base" and ya or | |
| 31 | − * ZZ are the "result". | |
| 32 | − */ | |
| 33 | −static int do_dh(MPI result, MPI base, MPI xa, MPI p) | |
| 34 | −{ | |
| 35 | − return mpi_powm(result, base, xa, p); | |
| 36 | −} | |
| 37 | − | |
| 38 | −static ssize_t mpi_from_key(key_serial_t keyid, size_t maxlen, MPI *mpi) | |
| 21 | +static ssize_t dh_data_from_key(key_serial_t keyid, void **data) | |
| 39 | 22 | { |
| 40 | 23 | struct key *key; |
| 41 | 24 | key_ref_t key_ref; |
| @@ -56,19 +39,17 @@ static ssize_t mpi_from_key(key_serial_t keyid, size_t maxlen, MPI *mpi) · 14 unmodified lines | ||
| 56 | 39 | status = key_validate(key); |
| 57 | 40 | if (status == 0) { |
| 58 | 41 | const struct user_key_payload *payload; |
| 42 | + uint8_t *duplicate; | |
| 59 | 43 | |
| 60 | 44 | payload = user_key_payload_locked(key); |
| 61 | 45 | |
| 62 | − if (maxlen == 0) { | |
| 63 | − *mpi = NULL; | |
| 46 | + duplicate = kmemdup(payload->data, payload->datalen, | |
| 47 | + GFP_KERNEL); | |
| 48 | + if (duplicate) { | |
| 49 | + *data = duplicate; | |
| 64 | 50 | ret = payload->datalen; |
| 65 | − } else if (payload->datalen <= maxlen) { | |
| 66 | − *mpi = mpi_read_raw_data(payload->data, | |
| 67 | − payload->datalen); | |
| 68 | − if (*mpi) | |
| 69 | − ret = payload->datalen; | |
| 70 | 51 | } else { |
| 71 | − ret = -EINVAL; | |
| 52 | + ret = -ENOMEM; | |
| 72 | 53 | } |
| 73 | 54 | } |
| 74 | 55 | up_read(&key->sem); |
| @@ -79,6 +60,29 @@ error: · 4 unmodified lines | ||
| 79 | 60 | return ret; |
| 80 | 61 | } |
| 81 | 62 | |
| 63 | +static void dh_free_data(struct dh *dh) | |
| 64 | +{ | |
| 65 | + kzfree(dh->key); | |
| 66 | + kzfree(dh->p); | |
| 67 | + kzfree(dh->g); | |
| 68 | +} | |
| 69 | + | |
| 70 | +struct dh_completion { | |
| 71 | + struct completion completion; | |
| 72 | + int err; | |
| 73 | +}; | |
| 74 | + | |
| 75 | +static void dh_crypto_done(struct crypto_async_request *req, int err) | |
| 76 | +{ | |
| 77 | + struct dh_completion *compl = req->data; | |
| 78 | + | |
| 79 | + if (err == -EINPROGRESS) | |
| 80 | + return; | |
| 81 | + | |
| 82 | + compl->err = err; | |
| 83 | + complete(&compl->completion); | |
| 84 | +} | |
| 85 | + | |
| 82 | 86 | struct kdf_sdesc { |
| 83 | 87 | struct shash_desc shash; |
| 84 | 88 | char ctx[]; |
| @@ -89,6 +93,7 @@ static int kdf_alloc(struct kdf_sdesc **sdesc_ret, char *hashname) · 4 unmodified lines | ||
| 89 | 93 | struct crypto_shash *tfm; |
| 90 | 94 | struct kdf_sdesc *sdesc; |
| 91 | 95 | int size; |
| 96 | + int err; | |
| 92 | 97 | |
| 93 | 98 | /* allocate synchronous hash */ |
| 94 | 99 | tfm = crypto_alloc_shash(hashname, 0, 0); |
| @@ -97,16 +102,25 @@ static int kdf_alloc(struct kdf_sdesc **sdesc_ret, char *hashname) · 2 unmodified lines | ||
| 97 | 102 | return PTR_ERR(tfm); |
| 98 | 103 | } |
| 99 | 104 | |
| 105 | + err = -EINVAL; | |
| 106 | + if (crypto_shash_digestsize(tfm) == 0) | |
| 107 | + goto out_free_tfm; | |
| 108 | + | |
| 109 | + err = -ENOMEM; | |
| 100 | 110 | size = sizeof(struct shash_desc) + crypto_shash_descsize(tfm); |
| 101 | 111 | sdesc = kmalloc(size, GFP_KERNEL); |
| 102 | 112 | if (!sdesc) |
| 103 | − return -ENOMEM; | |
| 113 | + goto out_free_tfm; | |
| 104 | 114 | sdesc->shash.tfm = tfm; |
| 105 | 115 | sdesc->shash.flags = 0x0; |
| 106 | 116 | |
| 107 | 117 | *sdesc_ret = sdesc; |
| 108 | 118 | |
| 109 | 119 | return 0; |
| 120 | + | |
| 121 | +out_free_tfm: | |
| 122 | + crypto_free_shash(tfm); | |
| 123 | + return err; | |
| 110 | 124 | } |
| 111 | 125 | |
| 112 | 126 | static void kdf_dealloc(struct kdf_sdesc *sdesc) |
| @@ -120,14 +134,6 @@ static void kdf_dealloc(struct kdf_sdesc *sdesc) · 7 unmodified lines | ||
| 120 | 134 | kzfree(sdesc); |
| 121 | 135 | } |
| 122 | 136 | |
| 123 | −/* convert 32 bit integer into its string representation */ | |
| 124 | −static inline void crypto_kw_cpu_to_be32(u32 val, u8 *buf) | |
| 125 | −{ | |
| 126 | − __be32 *a = (__be32 *)buf; | |
| 127 | − | |
| 128 | − *a = cpu_to_be32(val); | |
| 129 | −} | |
| 130 | − | |
| 131 | 137 | /* |
| 132 | 138 | * Implementation of the KDF in counter mode according to SP800-108 section 5.1 |
| 133 | 139 | * as well as SP800-56A section 5.8.1 (Single-step KDF). |
| @@ -138,25 +144,39 @@ static inline void crypto_kw_cpu_to_be32(u32 val, u8 *buf) · 4 unmodified lines | ||
| 138 | 144 | * 5.8.1.2). |
| 139 | 145 | */ |
| 140 | 146 | static int kdf_ctr(struct kdf_sdesc *sdesc, const u8 *src, unsigned int slen, |
| 141 | − u8 *dst, unsigned int dlen) | |
| 147 | + u8 *dst, unsigned int dlen, unsigned int zlen) | |
| 142 | 148 | { |
| 143 | 149 | struct shash_desc *desc = &sdesc->shash; |
| 144 | 150 | unsigned int h = crypto_shash_digestsize(desc->tfm); |
| 145 | 151 | int err = 0; |
| 146 | 152 | u8 *dst_orig = dst; |
| 147 | − u32 i = 1; | |
| 148 | − u8 iteration[sizeof(u32)]; | |
| 153 | + __be32 counter = cpu_to_be32(1); | |
| 149 | 154 | |
| 150 | 155 | while (dlen) { |
| 151 | 156 | err = crypto_shash_init(desc); |
| 152 | 157 | if (err) |
| 153 | 158 | goto err; |
| 154 | 159 | |
| 155 | − crypto_kw_cpu_to_be32(i, iteration); | |
| 156 | − err = crypto_shash_update(desc, iteration, sizeof(u32)); | |
| 160 | + err = crypto_shash_update(desc, (u8 *)&counter, sizeof(__be32)); | |
| 157 | 161 | if (err) |
| 158 | 162 | goto err; |
| 159 | 163 | |
| 164 | + if (zlen && h) { | |
| 165 | + u8 tmpbuffer[h]; | |
| 166 | + size_t chunk = min_t(size_t, zlen, h); | |
| 167 | + memset(tmpbuffer, 0, chunk); | |
| 168 | + | |
| 169 | + do { | |
| 170 | + err = crypto_shash_update(desc, tmpbuffer, | |
| 171 | + chunk); | |
| 172 | + if (err) | |
| 173 | + goto err; | |
| 174 | + | |
| 175 | + zlen -= chunk; | |
| 176 | + chunk = min_t(size_t, zlen, h); | |
| 177 | + } while (zlen); | |
| 178 | + } | |
| 179 | + | |
| 160 | 180 | if (src && slen) { |
| 161 | 181 | err = crypto_shash_update(desc, src, slen); |
| 162 | 182 | if (err) |
| @@ -179,7 +199,7 @@ static int kdf_ctr(struct kdf_sdesc *sdesc, const u8 *src, unsigned int slen, · 16 unmodified lines | ||
| 179 | 199 | |
| 180 | 200 | dlen -= h; |
| 181 | 201 | dst += h; |
| 182 | − i++; | |
| 202 | + counter = cpu_to_be32(be32_to_cpu(counter) + 1); | |
| 183 | 203 | } |
| 184 | 204 | } |
| 185 | 205 | |
| @@ -192,7 +212,7 @@ err: · 6 unmodified lines | ||
| 192 | 212 | |
| 193 | 213 | static int keyctl_dh_compute_kdf(struct kdf_sdesc *sdesc, |
| 194 | 214 | char __user *buffer, size_t buflen, |
| 195 | − uint8_t *kbuf, size_t kbuflen) | |
| 215 | + uint8_t *kbuf, size_t kbuflen, size_t lzero) | |
| 196 | 216 | { |
| 197 | 217 | uint8_t *outbuf = NULL; |
| 198 | 218 | int ret; |
| @@ -203,7 +223,7 @@ static int keyctl_dh_compute_kdf(struct kdf_sdesc *sdesc, · 4 unmodified lines | ||
| 203 | 223 | goto err; |
| 204 | 224 | } |
| 205 | 225 | |
| 206 | − ret = kdf_ctr(sdesc, kbuf, kbuflen, outbuf, buflen); | |
| 226 | + ret = kdf_ctr(sdesc, kbuf, kbuflen, outbuf, buflen, lzero); | |
| 207 | 227 | if (ret) |
| 208 | 228 | goto err; |
| 209 | 229 | |
| @@ -221,21 +241,26 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params, · 11 unmodified lines | ||
| 221 | 241 | struct keyctl_kdf_params *kdfcopy) |
| 222 | 242 | { |
| 223 | 243 | long ret; |
| 224 | − MPI base, private, prime, result; | |
| 225 | − unsigned nbytes; | |
| 244 | + ssize_t dlen; | |
| 245 | + int secretlen; | |
| 246 | + int outlen; | |
| 226 | 247 | struct keyctl_dh_params pcopy; |
| 227 | − uint8_t *kbuf; | |
| 228 | − ssize_t keylen; | |
| 229 | − size_t resultlen; | |
| 248 | + struct dh dh_inputs; | |
| 249 | + struct scatterlist outsg; | |
| 250 | + struct dh_completion compl; | |
| 251 | + struct crypto_kpp *tfm; | |
| 252 | + struct kpp_request *req; | |
| 253 | + uint8_t *secret; | |
| 254 | + uint8_t *outbuf; | |
| 230 | 255 | struct kdf_sdesc *sdesc = NULL; |
| 231 | 256 | |
| 232 | 257 | if (!params || (!buffer && buflen)) { |
| 233 | 258 | ret = -EINVAL; |
| 234 | − goto out; | |
| 259 | + goto out1; | |
| 235 | 260 | } |
| 236 | 261 | if (copy_from_user(&pcopy, params, sizeof(pcopy)) != 0) { |
| 237 | 262 | ret = -EFAULT; |
| 238 | − goto out; | |
| 263 | + goto out1; | |
| 239 | 264 | } |
| 240 | 265 | |
| 241 | 266 | if (kdfcopy) { |
| @@ -244,104 +269,147 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params, · 2 unmodified lines | ||
| 244 | 269 | if (buflen > KEYCTL_KDF_MAX_OUTPUT_LEN || |
| 245 | 270 | kdfcopy->otherinfolen > KEYCTL_KDF_MAX_OI_LEN) { |
| 246 | 271 | ret = -EMSGSIZE; |
| 247 | − goto out; | |
| 272 | + goto out1; | |
| 248 | 273 | } |
| 249 | 274 | |
| 250 | 275 | /* get KDF name string */ |
| 251 | 276 | hashname = strndup_user(kdfcopy->hashname, CRYPTO_MAX_ALG_NAME); |
| 252 | 277 | if (IS_ERR(hashname)) { |
| 253 | 278 | ret = PTR_ERR(hashname); |
| 254 | − goto out; | |
| 279 | + goto out1; | |
| 255 | 280 | } |
| 256 | 281 | |
| 257 | 282 | /* allocate KDF from the kernel crypto API */ |
| 258 | 283 | ret = kdf_alloc(&sdesc, hashname); |
| 259 | 284 | kfree(hashname); |
| 260 | 285 | if (ret) |
| 261 | − goto out; | |
| 286 | + goto out1; | |
| 262 | 287 | } |
| 263 | 288 | |
| 264 | − /* | |
| 265 | − * If the caller requests postprocessing with a KDF, allow an | |
| 266 | − * arbitrary output buffer size since the KDF ensures proper truncation. | |
| 267 | − */ | |
| 268 | − keylen = mpi_from_key(pcopy.prime, kdfcopy ? SIZE_MAX : buflen, &prime); | |
| 269 | − if (keylen < 0 || !prime) { | |
| 270 | − /* buflen == 0 may be used to query the required buffer size, | |
| 271 | − * which is the prime key length. | |
| 272 | − */ | |
| 273 | − ret = keylen; | |
| 274 | − goto out; | |
| 289 | + memset(&dh_inputs, 0, sizeof(dh_inputs)); | |
| 290 | + | |
| 291 | + dlen = dh_data_from_key(pcopy.prime, &dh_inputs.p); | |
| 292 | + if (dlen < 0) { | |
| 293 | + ret = dlen; | |
| 294 | + goto out1; | |
| 295 | + } | |
| 296 | + dh_inputs.p_size = dlen; | |
| 297 | + | |
| 298 | + dlen = dh_data_from_key(pcopy.base, &dh_inputs.g); | |
| 299 | + if (dlen < 0) { | |
| 300 | + ret = dlen; | |
| 301 | + goto out2; | |
| 275 | 302 | } |
| 303 | + dh_inputs.g_size = dlen; | |
| 276 | 304 | |
| 277 | − /* The result is never longer than the prime */ | |
| 278 | − resultlen = keylen; | |
| 305 | + dlen = dh_data_from_key(pcopy.private, &dh_inputs.key); | |
| 306 | + if (dlen < 0) { | |
| 307 | + ret = dlen; | |
| 308 | + goto out2; | |
| 309 | + } | |
| 310 | + dh_inputs.key_size = dlen; | |
| 279 | 311 | |
| 280 | − keylen = mpi_from_key(pcopy.base, SIZE_MAX, &base); | |
| 281 | − if (keylen < 0 || !base) { | |
| 282 | − ret = keylen; | |
| 283 | − goto error1; | |
| 312 | + secretlen = crypto_dh_key_len(&dh_inputs); | |
| 313 | + secret = kmalloc(secretlen, GFP_KERNEL); | |
| 314 | + if (!secret) { | |
| 315 | + ret = -ENOMEM; | |
| 316 | + goto out2; | |
| 284 | 317 | } |
| 318 | + ret = crypto_dh_encode_key(secret, secretlen, &dh_inputs); | |
| 319 | + if (ret) | |
| 320 | + goto out3; | |
| 285 | 321 | |
| 286 | − keylen = mpi_from_key(pcopy.private, SIZE_MAX, &private); | |
| 287 | − if (keylen < 0 || !private) { | |
| 288 | − ret = keylen; | |
| 289 | − goto error2; | |
| 322 | + tfm = crypto_alloc_kpp("dh", CRYPTO_ALG_TYPE_KPP, 0); | |
| 323 | + if (IS_ERR(tfm)) { | |
| 324 | + ret = PTR_ERR(tfm); | |
| 325 | + goto out3; | |
| 326 | + } | |
| 327 | + | |
| 328 | + ret = crypto_kpp_set_secret(tfm, secret, secretlen); | |
| 329 | + if (ret) | |
| 330 | + goto out4; | |
| 331 | + | |
| 332 | + outlen = crypto_kpp_maxsize(tfm); | |
| 333 | + | |
| 334 | + if (!kdfcopy) { | |
| 335 | + /* | |
| 336 | + * When not using a KDF, buflen 0 is used to read the | |
| 337 | + * required buffer length | |
| 338 | + */ | |
| 339 | + if (buflen == 0) { | |
| 340 | + ret = outlen; | |
| 341 | + goto out4; | |
| 342 | + } else if (outlen > buflen) { | |
| 343 | + ret = -EOVERFLOW; | |
| 344 | + goto out4; | |
| 345 | + } | |
| 290 | 346 | } |
| 291 | 347 | |
| 292 | − result = mpi_alloc(0); | |
| 293 | − if (!result) { | |
| 348 | + outbuf = kzalloc(kdfcopy ? (outlen + kdfcopy->otherinfolen) : outlen, | |
| 349 | + GFP_KERNEL); | |
| 350 | + if (!outbuf) { | |
| 294 | 351 | ret = -ENOMEM; |
| 295 | − goto error3; | |
| 352 | + goto out4; | |
| 296 | 353 | } |
| 297 | 354 | |
| 298 | − /* allocate space for DH shared secret and SP800-56A otherinfo */ | |
| 299 | − kbuf = kmalloc(kdfcopy ? (resultlen + kdfcopy->otherinfolen) : resultlen, | |
| 300 | − GFP_KERNEL); | |
| 301 | − if (!kbuf) { | |
| 355 | + sg_init_one(&outsg, outbuf, outlen); | |
| 356 | + | |
| 357 | + req = kpp_request_alloc(tfm, GFP_KERNEL); | |
| 358 | + if (!req) { | |
| 302 | 359 | ret = -ENOMEM; |
| 303 | − goto error4; | |
| 360 | + goto out5; | |
| 304 | 361 | } |
| 305 | 362 | |
| 363 | + kpp_request_set_input(req, NULL, 0); | |
| 364 | + kpp_request_set_output(req, &outsg, outlen); | |
| 365 | + init_completion(&compl.completion); | |
| 366 | + kpp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG | | |
| 367 | + CRYPTO_TFM_REQ_MAY_SLEEP, | |
| 368 | + dh_crypto_done, &compl); | |
| 369 | + | |
| 306 | 370 | /* |
| 307 | − * Concatenate SP800-56A otherinfo past DH shared secret -- the | |
| 308 | − * input to the KDF is (DH shared secret || otherinfo) | |
| 371 | + * For DH, generate_public_key and generate_shared_secret are | |
| 372 | + * the same calculation | |
| 309 | 373 | */ |
| 310 | − if (kdfcopy && kdfcopy->otherinfo && | |
| 311 | − copy_from_user(kbuf + resultlen, kdfcopy->otherinfo, | |
| 312 | − kdfcopy->otherinfolen) != 0) { | |
| 313 | − ret = -EFAULT; | |
| 314 | − goto error5; | |
| 374 | + ret = crypto_kpp_generate_public_key(req); | |
| 375 | + if (ret == -EINPROGRESS) { | |
| 376 | + wait_for_completion(&compl.completion); | |
| 377 | + ret = compl.err; | |
| 378 | + if (ret) | |
| 379 | + goto out6; | |
| 315 | 380 | } |
| 316 | 381 | |
| 317 | − ret = do_dh(result, base, private, prime); | |
| 318 | − if (ret) | |
| 319 | − goto error5; | |
| 320 | − | |
| 321 | − ret = mpi_read_buffer(result, kbuf, resultlen, &nbytes, NULL); | |
| 322 | − if (ret != 0) | |
| 323 | − goto error5; | |
| 324 | − | |
| 325 | 382 | if (kdfcopy) { |
| 326 | − ret = keyctl_dh_compute_kdf(sdesc, buffer, buflen, kbuf, | |
| 327 | − resultlen + kdfcopy->otherinfolen); | |
| 328 | − } else { | |
| 329 | − ret = nbytes; | |
| 330 | − if (copy_to_user(buffer, kbuf, nbytes) != 0) | |
| 383 | + /* | |
| 384 | + * Concatenate SP800-56A otherinfo past DH shared secret -- the | |
| 385 | + * input to the KDF is (DH shared secret || otherinfo) | |
| 386 | + */ | |
| 387 | + if (copy_from_user(outbuf + req->dst_len, kdfcopy->otherinfo, | |
| 388 | + kdfcopy->otherinfolen) != 0) { | |
| 331 | 389 | ret = -EFAULT; |
| 390 | + goto out6; | |
| 391 | + } | |
| 392 | + | |
| 393 | + ret = keyctl_dh_compute_kdf(sdesc, buffer, buflen, outbuf, | |
| 394 | + req->dst_len + kdfcopy->otherinfolen, | |
| 395 | + outlen - req->dst_len); | |
| 396 | + } else if (copy_to_user(buffer, outbuf, req->dst_len) == 0) { | |
| 397 | + ret = req->dst_len; | |
| 398 | + } else { | |
| 399 | + ret = -EFAULT; | |
| 332 | 400 | } |
| 333 | 401 | |
| 334 | −error5: | |
| 335 | − kzfree(kbuf); | |
| 336 | −error4: | |
| 337 | − mpi_free(result); | |
| 338 | −error3: | |
| 339 | − mpi_free(private); | |
| 340 | −error2: | |
| 341 | − mpi_free(base); | |
| 342 | −error1: | |
| 343 | − mpi_free(prime); | |
| 344 | −out: | |
| 402 | +out6: | |
| 403 | + kpp_request_free(req); | |
| 404 | +out5: | |
| 405 | + kzfree(outbuf); | |
| 406 | +out4: | |
| 407 | + crypto_free_kpp(tfm); | |
| 408 | +out3: | |
| 409 | + kzfree(secret); | |
| 410 | +out2: | |
| 411 | + dh_free_data(&dh_inputs); | |
| 412 | +out1: | |
| 345 | 413 | kdf_dealloc(sdesc); |
| 346 | 414 | return ret; |
| 347 | 415 | } |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #include <linux/scatterlist.h> |
| 31 | 31 | #include <linux/ctype.h> |
| 32 | 32 | #include <crypto/aes.h> |
| 33 | +#include <crypto/algapi.h> | |
| 33 | 34 | #include <crypto/hash.h> |
| 34 | 35 | #include <crypto/sha.h> |
| 35 | 36 | #include <crypto/skcipher.h> |
| @@ -54,13 +55,7 @@ static int blksize; · 18 unmodified lines | ||
| 54 | 55 | #define MAX_DATA_SIZE 4096 |
| 55 | 56 | #define MIN_DATA_SIZE 20 |
| 56 | 57 | |
| 57 | −struct sdesc { | |
| 58 | − struct shash_desc shash; | |
| 59 | − char ctx[]; | |
| 60 | −}; | |
| 61 | − | |
| 62 | −static struct crypto_shash *hashalg; | |
| 63 | −static struct crypto_shash *hmacalg; | |
| 58 | +static struct crypto_shash *hash_tfm; | |
| 64 | 59 | |
| 65 | 60 | enum { |
| 66 | 61 | Opt_err = -1, Opt_new, Opt_load, Opt_update |
| @@ -141,23 +136,22 @@ static int valid_ecryptfs_desc(const char *ecryptfs_desc) · 74 unmodified lines | ||
| 141 | 136 | */ |
| 142 | 137 | static int valid_master_desc(const char *new_desc, const char *orig_desc) |
| 143 | 138 | { |
| 144 | − if (!memcmp(new_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN)) { | |
| 145 | − if (strlen(new_desc) == KEY_TRUSTED_PREFIX_LEN) | |
| 146 | − goto out; | |
| 147 | − if (orig_desc) | |
| 148 | − if (memcmp(new_desc, orig_desc, KEY_TRUSTED_PREFIX_LEN)) | |
| 149 | − goto out; | |
| 150 | − } else if (!memcmp(new_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN)) { | |
| 151 | − if (strlen(new_desc) == KEY_USER_PREFIX_LEN) | |
| 152 | − goto out; | |
| 153 | − if (orig_desc) | |
| 154 | − if (memcmp(new_desc, orig_desc, KEY_USER_PREFIX_LEN)) | |
| 155 | − goto out; | |
| 156 | − } else | |
| 157 | − goto out; | |
| 139 | + int prefix_len; | |
| 140 | + | |
| 141 | + if (!strncmp(new_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN)) | |
| 142 | + prefix_len = KEY_TRUSTED_PREFIX_LEN; | |
| 143 | + else if (!strncmp(new_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN)) | |
| 144 | + prefix_len = KEY_USER_PREFIX_LEN; | |
| 145 | + else | |
| 146 | + return -EINVAL; | |
| 147 | + | |
| 148 | + if (!new_desc[prefix_len]) | |
| 149 | + return -EINVAL; | |
| 150 | + | |
| 151 | + if (orig_desc && strncmp(new_desc, orig_desc, prefix_len)) | |
| 152 | + return -EINVAL; | |
| 153 | + | |
| 158 | 154 | return 0; |
| 159 | −out: | |
| 160 | − return -EINVAL; | |
| 161 | 155 | } |
| 162 | 156 | |
| 163 | 157 | /* |
| @@ -321,53 +315,38 @@ error: · 157 unmodified lines | ||
| 321 | 315 | return ukey; |
| 322 | 316 | } |
| 323 | 317 | |
| 324 | −static struct sdesc *alloc_sdesc(struct crypto_shash *alg) | |
| 325 | −{ | |
| 326 | − struct sdesc *sdesc; | |
| 327 | − int size; | |
| 328 | − | |
| 329 | − size = sizeof(struct shash_desc) + crypto_shash_descsize(alg); | |
| 330 | − sdesc = kmalloc(size, GFP_KERNEL); | |
| 331 | − if (!sdesc) | |
| 332 | − return ERR_PTR(-ENOMEM); | |
| 333 | − sdesc->shash.tfm = alg; | |
| 334 | − sdesc->shash.flags = 0x0; | |
| 335 | − return sdesc; | |
| 336 | −} | |
| 337 | − | |
| 338 | −static int calc_hmac(u8 *digest, const u8 *key, unsigned int keylen, | |
| 318 | +static int calc_hash(struct crypto_shash *tfm, u8 *digest, | |
| 339 | 319 | const u8 *buf, unsigned int buflen) |
| 340 | 320 | { |
| 341 | − struct sdesc *sdesc; | |
| 342 | − int ret; | |
| 321 | + SHASH_DESC_ON_STACK(desc, tfm); | |
| 322 | + int err; | |
| 343 | 323 | |
| 344 | − sdesc = alloc_sdesc(hmacalg); | |
| 345 | − if (IS_ERR(sdesc)) { | |
| 346 | − pr_info("encrypted_key: can't alloc %s\n", hmac_alg); | |
| 347 | − return PTR_ERR(sdesc); | |
| 348 | − } | |
| 324 | + desc->tfm = tfm; | |
| 325 | + desc->flags = 0; | |
| 349 | 326 | |
| 350 | − ret = crypto_shash_setkey(hmacalg, key, keylen); | |
| 351 | − if (!ret) | |
| 352 | − ret = crypto_shash_digest(&sdesc->shash, buf, buflen, digest); | |
| 353 | − kfree(sdesc); | |
| 354 | − return ret; | |
| 327 | + err = crypto_shash_digest(desc, buf, buflen, digest); | |
| 328 | + shash_desc_zero(desc); | |
| 329 | + return err; | |
| 355 | 330 | } |
| 356 | 331 | |
| 357 | −static int calc_hash(u8 *digest, const u8 *buf, unsigned int buflen) | |
| 332 | +static int calc_hmac(u8 *digest, const u8 *key, unsigned int keylen, | |
| 333 | + const u8 *buf, unsigned int buflen) | |
| 358 | 334 | { |
| 359 | − struct sdesc *sdesc; | |
| 360 | − int ret; | |
| 335 | + struct crypto_shash *tfm; | |
| 336 | + int err; | |
| 361 | 337 | |
| 362 | − sdesc = alloc_sdesc(hashalg); | |
| 363 | − if (IS_ERR(sdesc)) { | |
| 364 | − pr_info("encrypted_key: can't alloc %s\n", hash_alg); | |
| 365 | − return PTR_ERR(sdesc); | |
| 338 | + tfm = crypto_alloc_shash(hmac_alg, 0, CRYPTO_ALG_ASYNC); | |
| 339 | + if (IS_ERR(tfm)) { | |
| 340 | + pr_err("encrypted_key: can't alloc %s transform: %ld\n", | |
| 341 | + hmac_alg, PTR_ERR(tfm)); | |
| 342 | + return PTR_ERR(tfm); | |
| 366 | 343 | } |
| 367 | 344 | |
| 368 | − ret = crypto_shash_digest(&sdesc->shash, buf, buflen, digest); | |
| 369 | − kfree(sdesc); | |
| 370 | − return ret; | |
| 345 | + err = crypto_shash_setkey(tfm, key, keylen); | |
| 346 | + if (!err) | |
| 347 | + err = calc_hash(tfm, digest, buf, buflen); | |
| 348 | + crypto_free_shash(tfm); | |
| 349 | + return err; | |
| 371 | 350 | } |
| 372 | 351 | |
| 373 | 352 | enum derived_key_type { ENC_KEY, AUTH_KEY }; |
| @@ -385,10 +364,9 @@ static int get_derived_key(u8 *derived_key, enum derived_key_type key_type, · 11 unmodified lines | ||
| 385 | 364 | derived_buf_len = HASH_SIZE; |
| 386 | 365 | |
| 387 | 366 | derived_buf = kzalloc(derived_buf_len, GFP_KERNEL); |
| 388 | − if (!derived_buf) { | |
| 389 | − pr_err("encrypted_key: out of memory\n"); | |
| 367 | + if (!derived_buf) | |
| 390 | 368 | return -ENOMEM; |
| 391 | − } | |
| 369 | + | |
| 392 | 370 | if (key_type) |
| 393 | 371 | strcpy(derived_buf, "AUTH_KEY"); |
| 394 | 372 | else |
| @@ -396,8 +374,8 @@ static int get_derived_key(u8 *derived_key, enum derived_key_type key_type, · 1 unmodified line | ||
| 396 | 374 | |
| 397 | 375 | memcpy(derived_buf + strlen(derived_buf) + 1, master_key, |
| 398 | 376 | master_keylen); |
| 399 | − ret = calc_hash(derived_key, derived_buf, derived_buf_len); | |
| 400 | − kfree(derived_buf); | |
| 377 | + ret = calc_hash(hash_tfm, derived_key, derived_buf, derived_buf_len); | |
| 378 | + kzfree(derived_buf); | |
| 401 | 379 | return ret; |
| 402 | 380 | } |
| 403 | 381 | |
| @@ -480,12 +458,9 @@ static int derived_key_encrypt(struct encrypted_key_payload *epayload, · 76 unmodified lines | ||
| 480 | 458 | struct skcipher_request *req; |
| 481 | 459 | unsigned int encrypted_datalen; |
| 482 | 460 | u8 iv[AES_BLOCK_SIZE]; |
| 483 | − unsigned int padlen; | |
| 484 | − char pad[16]; | |
| 485 | 461 | int ret; |
| 486 | 462 | |
| 487 | 463 | encrypted_datalen = roundup(epayload->decrypted_datalen, blksize); |
| 488 | − padlen = encrypted_datalen - epayload->decrypted_datalen; | |
| 489 | 464 | |
| 490 | 465 | req = init_skcipher_req(derived_key, derived_keylen); |
| 491 | 466 | ret = PTR_ERR(req); |
| @@ -493,11 +468,10 @@ static int derived_key_encrypt(struct encrypted_key_payload *epayload, · 1 unmodified line | ||
| 493 | 468 | goto out; |
| 494 | 469 | dump_decrypted_data(epayload); |
| 495 | 470 | |
| 496 | − memset(pad, 0, sizeof pad); | |
| 497 | 471 | sg_init_table(sg_in, 2); |
| 498 | 472 | sg_set_buf(&sg_in[0], epayload->decrypted_data, |
| 499 | 473 | epayload->decrypted_datalen); |
| 500 | − sg_set_buf(&sg_in[1], pad, padlen); | |
| 474 | + sg_set_page(&sg_in[1], ZERO_PAGE(0), AES_BLOCK_SIZE, 0); | |
| 501 | 475 | |
| 502 | 476 | sg_init_table(sg_out, 1); |
| 503 | 477 | sg_set_buf(sg_out, epayload->encrypted_data, encrypted_datalen); |
| @@ -533,6 +507,7 @@ static int datablob_hmac_append(struct encrypted_key_payload *epayload, · 29 unmodified lines | ||
| 533 | 507 | if (!ret) |
| 534 | 508 | dump_hmac(NULL, digest, HASH_SIZE); |
| 535 | 509 | out: |
| 510 | + memzero_explicit(derived_key, sizeof(derived_key)); | |
| 536 | 511 | return ret; |
| 537 | 512 | } |
| 538 | 513 | |
| @@ -561,8 +536,8 @@ static int datablob_hmac_verify(struct encrypted_key_payload *epayload, · 22 unmodified lines | ||
| 561 | 536 | ret = calc_hmac(digest, derived_key, sizeof derived_key, p, len); |
| 562 | 537 | if (ret < 0) |
| 563 | 538 | goto out; |
| 564 | − ret = memcmp(digest, epayload->format + epayload->datablob_len, | |
| 565 | − sizeof digest); | |
| 539 | + ret = crypto_memneq(digest, epayload->format + epayload->datablob_len, | |
| 540 | + sizeof(digest)); | |
| 566 | 541 | if (ret) { |
| 567 | 542 | ret = -EINVAL; |
| 568 | 543 | dump_hmac("datablob", |
| @@ -571,6 +546,7 @@ static int datablob_hmac_verify(struct encrypted_key_payload *epayload, · 2 unmodified lines | ||
| 571 | 546 | dump_hmac("calc", digest, HASH_SIZE); |
| 572 | 547 | } |
| 573 | 548 | out: |
| 549 | + memzero_explicit(derived_key, sizeof(derived_key)); | |
| 574 | 550 | return ret; |
| 575 | 551 | } |
| 576 | 552 | |
| @@ -584,9 +560,14 @@ static int derived_key_decrypt(struct encrypted_key_payload *epayload, · 7 unmodified lines | ||
| 584 | 560 | struct skcipher_request *req; |
| 585 | 561 | unsigned int encrypted_datalen; |
| 586 | 562 | u8 iv[AES_BLOCK_SIZE]; |
| 587 | − char pad[16]; | |
| 563 | + u8 *pad; | |
| 588 | 564 | int ret; |
| 589 | 565 | |
| 566 | + /* Throwaway buffer to hold the unused zero padding at the end */ | |
| 567 | + pad = kmalloc(AES_BLOCK_SIZE, GFP_KERNEL); | |
| 568 | + if (!pad) | |
| 569 | + return -ENOMEM; | |
| 570 | + | |
| 590 | 571 | encrypted_datalen = roundup(epayload->decrypted_datalen, blksize); |
| 591 | 572 | req = init_skcipher_req(derived_key, derived_keylen); |
| 592 | 573 | ret = PTR_ERR(req); |
| @@ -594,13 +575,12 @@ static int derived_key_decrypt(struct encrypted_key_payload *epayload, · 1 unmodified line | ||
| 594 | 575 | goto out; |
| 595 | 576 | dump_encrypted_data(epayload, encrypted_datalen); |
| 596 | 577 | |
| 597 | − memset(pad, 0, sizeof pad); | |
| 598 | 578 | sg_init_table(sg_in, 1); |
| 599 | 579 | sg_init_table(sg_out, 2); |
| 600 | 580 | sg_set_buf(sg_in, epayload->encrypted_data, encrypted_datalen); |
| 601 | 581 | sg_set_buf(&sg_out[0], epayload->decrypted_data, |
| 602 | 582 | epayload->decrypted_datalen); |
| 603 | − sg_set_buf(&sg_out[1], pad, sizeof pad); | |
| 583 | + sg_set_buf(&sg_out[1], pad, AES_BLOCK_SIZE); | |
| 604 | 584 | |
| 605 | 585 | memcpy(iv, epayload->iv, sizeof(iv)); |
| 606 | 586 | skcipher_request_set_crypt(req, sg_in, sg_out, encrypted_datalen, iv); |
| @@ -612,6 +592,7 @@ static int derived_key_decrypt(struct encrypted_key_payload *epayload, · 5 unmodified lines | ||
| 612 | 592 | goto out; |
| 613 | 593 | dump_decrypted_data(epayload); |
| 614 | 594 | out: |
| 595 | + kfree(pad); | |
| 615 | 596 | return ret; |
| 616 | 597 | } |
| 617 | 598 | |
| @@ -722,6 +703,7 @@ static int encrypted_key_decrypt(struct encrypted_key_payload *epayload, · 104 unmodified lines | ||
| 722 | 703 | out: |
| 723 | 704 | up_read(&mkey->sem); |
| 724 | 705 | key_put(mkey); |
| 706 | + memzero_explicit(derived_key, sizeof(derived_key)); | |
| 725 | 707 | return ret; |
| 726 | 708 | } |
| 727 | 709 | |
| @@ -828,13 +810,13 @@ static int encrypted_instantiate(struct key *key, · 100 unmodified lines | ||
| 828 | 810 | ret = encrypted_init(epayload, key->description, format, master_desc, |
| 829 | 811 | decrypted_datalen, hex_encoded_iv); |
| 830 | 812 | if (ret < 0) { |
| 831 | − kfree(epayload); | |
| 813 | + kzfree(epayload); | |
| 832 | 814 | goto out; |
| 833 | 815 | } |
| 834 | 816 | |
| 835 | 817 | rcu_assign_keypointer(key, epayload); |
| 836 | 818 | out: |
| 837 | − kfree(datablob); | |
| 819 | + kzfree(datablob); | |
| 838 | 820 | return ret; |
| 839 | 821 | } |
| 840 | 822 | |
| @@ -843,8 +825,7 @@ static void encrypted_rcu_free(struct rcu_head *rcu) · 2 unmodified lines | ||
| 843 | 825 | struct encrypted_key_payload *epayload; |
| 844 | 826 | |
| 845 | 827 | epayload = container_of(rcu, struct encrypted_key_payload, rcu); |
| 846 | − memset(epayload->decrypted_data, 0, epayload->decrypted_datalen); | |
| 847 | − kfree(epayload); | |
| 828 | + kzfree(epayload); | |
| 848 | 829 | } |
| 849 | 830 | |
| 850 | 831 | /* |
| @@ -902,7 +883,7 @@ static int encrypted_update(struct key *key, struct key_preparsed_payload *prep) · 51 unmodified lines | ||
| 902 | 883 | rcu_assign_keypointer(key, new_epayload); |
| 903 | 884 | call_rcu(&epayload->rcu, encrypted_rcu_free); |
| 904 | 885 | out: |
| 905 | − kfree(buf); | |
| 886 | + kzfree(buf); | |
| 906 | 887 | return ret; |
| 907 | 888 | } |
| 908 | 889 | |
| @@ -960,33 +941,26 @@ static long encrypted_read(const struct key *key, char __user *buffer, · 51 unmodified lines | ||
| 960 | 941 | |
| 961 | 942 | up_read(&mkey->sem); |
| 962 | 943 | key_put(mkey); |
| 944 | + memzero_explicit(derived_key, sizeof(derived_key)); | |
| 963 | 945 | |
| 964 | 946 | if (copy_to_user(buffer, ascii_buf, asciiblob_len) != 0) |
| 965 | 947 | ret = -EFAULT; |
| 966 | − kfree(ascii_buf); | |
| 948 | + kzfree(ascii_buf); | |
| 967 | 949 | |
| 968 | 950 | return asciiblob_len; |
| 969 | 951 | out: |
| 970 | 952 | up_read(&mkey->sem); |
| 971 | 953 | key_put(mkey); |
| 954 | + memzero_explicit(derived_key, sizeof(derived_key)); | |
| 972 | 955 | return ret; |
| 973 | 956 | } |
| 974 | 957 | |
| 975 | 958 | /* |
| 976 | − * encrypted_destroy - before freeing the key, clear the decrypted data | |
| 977 | − * | |
| 978 | − * Before freeing the key, clear the memory containing the decrypted | |
| 979 | − * key data. | |
| 959 | + * encrypted_destroy - clear and free the key's payload | |
| 980 | 960 | */ |
| 981 | 961 | static void encrypted_destroy(struct key *key) |
| 982 | 962 | { |
| 983 | − struct encrypted_key_payload *epayload = key->payload.data[0]; | |
| 984 | − | |
| 985 | − if (!epayload) | |
| 986 | − return; | |
| 987 | − | |
| 988 | − memzero_explicit(epayload->decrypted_data, epayload->decrypted_datalen); | |
| 989 | − kfree(key->payload.data[0]); | |
| 963 | + kzfree(key->payload.data[0]); | |
| 990 | 964 | } |
| 991 | 965 | |
| 992 | 966 | struct key_type key_type_encrypted = { |
| @@ -999,47 +973,17 @@ struct key_type key_type_encrypted = { · 6 unmodified lines | ||
| 999 | 973 | }; |
| 1000 | 974 | EXPORT_SYMBOL_GPL(key_type_encrypted); |
| 1001 | 975 | |
| 1002 | −static void encrypted_shash_release(void) | |
| 1003 | −{ | |
| 1004 | − if (hashalg) | |
| 1005 | − crypto_free_shash(hashalg); | |
| 1006 | − if (hmacalg) | |
| 1007 | − crypto_free_shash(hmacalg); | |
| 1008 | −} | |
| 1009 | − | |
| 1010 | −static int __init encrypted_shash_alloc(void) | |
| 976 | +static int __init init_encrypted(void) | |
| 1011 | 977 | { |
| 1012 | 978 | int ret; |
| 1013 | 979 | |
| 1014 | − hmacalg = crypto_alloc_shash(hmac_alg, 0, CRYPTO_ALG_ASYNC); | |
| 1015 | − if (IS_ERR(hmacalg)) { | |
| 1016 | − pr_info("encrypted_key: could not allocate crypto %s\n", | |
| 1017 | − hmac_alg); | |
| 1018 | − return PTR_ERR(hmacalg); | |
| 1019 | − } | |
| 1020 | − | |
| 1021 | − hashalg = crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC); | |
| 1022 | − if (IS_ERR(hashalg)) { | |
| 1023 | − pr_info("encrypted_key: could not allocate crypto %s\n", | |
| 1024 | − hash_alg); | |
| 1025 | − ret = PTR_ERR(hashalg); | |
| 1026 | − goto hashalg_fail; | |
| 980 | + hash_tfm = crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC); | |
| 981 | + if (IS_ERR(hash_tfm)) { | |
| 982 | + pr_err("encrypted_key: can't allocate %s transform: %ld\n", | |
| 983 | + hash_alg, PTR_ERR(hash_tfm)); | |
| 984 | + return PTR_ERR(hash_tfm); | |
| 1027 | 985 | } |
| 1028 | 986 | |
| 1029 | − return 0; | |
| 1030 | − | |
| 1031 | −hashalg_fail: | |
| 1032 | − crypto_free_shash(hmacalg); | |
| 1033 | − return ret; | |
| 1034 | −} | |
| 1035 | − | |
| 1036 | −static int __init init_encrypted(void) | |
| 1037 | −{ | |
| 1038 | − int ret; | |
| 1039 | − | |
| 1040 | − ret = encrypted_shash_alloc(); | |
| 1041 | − if (ret < 0) | |
| 1042 | − return ret; | |
| 1043 | 987 | ret = aes_get_sizes(); |
| 1044 | 988 | if (ret < 0) |
| 1045 | 989 | goto out; |
| @@ -1048,14 +992,14 @@ static int __init init_encrypted(void) · 2 unmodified lines | ||
| 1048 | 992 | goto out; |
| 1049 | 993 | return 0; |
| 1050 | 994 | out: |
| 1051 | − encrypted_shash_release(); | |
| 995 | + crypto_free_shash(hash_tfm); | |
| 1052 | 996 | return ret; |
| 1053 | 997 | |
| 1054 | 998 | } |
| 1055 | 999 | |
| 1056 | 1000 | static void __exit cleanup_encrypted(void) |
| 1057 | 1001 | { |
| 1058 | − encrypted_shash_release(); | |
| 1002 | + crypto_free_shash(hash_tfm); | |
| 1059 | 1003 | unregister_key_type(&key_type_encrypted); |
| 1060 | 1004 | } |
| 1061 | 1005 | |
| @@ -158,9 +158,7 @@ static noinline void key_gc_unused_keys(struct list_head *keys) · 157 unmodified lines | ||
| 158 | 158 | |
| 159 | 159 | kfree(key->description); |
| 160 | 160 | |
| 161 | −#ifdef KEY_DEBUGGING | |
| 162 | − key->magic = KEY_DEBUG_MAGIC_X; | |
| 163 | −#endif | |
| 161 | + memzero_explicit(key, sizeof(*key)); | |
| 164 | 162 | kmem_cache_free(key_jar, key); |
| 165 | 163 | } |
| 166 | 164 | } |
| @@ -660,14 +660,11 @@ not_found: · 659 unmodified lines | ||
| 660 | 660 | goto error; |
| 661 | 661 | |
| 662 | 662 | found: |
| 663 | − /* pretend it doesn't exist if it is awaiting deletion */ | |
| 664 | − if (refcount_read(&key->usage) == 0) | |
| 665 | − goto not_found; | |
| 666 | − | |
| 667 | − /* this races with key_put(), but that doesn't matter since key_put() | |
| 668 | − * doesn't actually change the key | |
| 663 | + /* A key is allowed to be looked up only if someone still owns a | |
| 664 | + * reference to it - otherwise it's awaiting the gc. | |
| 669 | 665 | */ |
| 670 | − __key_get(key); | |
| 666 | + if (!refcount_inc_not_zero(&key->usage)) | |
| 667 | + goto not_found; | |
| 671 | 668 | |
| 672 | 669 | error: |
| 673 | 670 | spin_unlock(&key_serial_lock); |
| @@ -966,12 +963,11 @@ int key_update(key_ref_t key_ref, const void *payload, size_t plen) · 292 unmodified lines | ||
| 966 | 963 | /* the key must be writable */ |
| 967 | 964 | ret = key_permission(key_ref, KEY_NEED_WRITE); |
| 968 | 965 | if (ret < 0) |
| 969 | − goto error; | |
| 966 | + return ret; | |
| 970 | 967 | |
| 971 | 968 | /* attempt to update it if supported */ |
| 972 | − ret = -EOPNOTSUPP; | |
| 973 | 969 | if (!key->type->update) |
| 974 | − goto error; | |
| 970 | + return -EOPNOTSUPP; | |
| 975 | 971 | |
| 976 | 972 | memset(&prep, 0, sizeof(prep)); |
| 977 | 973 | prep.data = payload; |
| @@ -99,7 +99,7 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, · 98 unmodified lines | ||
| 99 | 99 | /* pull the payload in if one was supplied */ |
| 100 | 100 | payload = NULL; |
| 101 | 101 | |
| 102 | − if (_payload) { | |
| 102 | + if (plen) { | |
| 103 | 103 | ret = -ENOMEM; |
| 104 | 104 | payload = kvmalloc(plen, GFP_KERNEL); |
| 105 | 105 | if (!payload) |
| @@ -132,7 +132,10 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, · 26 unmodified lines | ||
| 132 | 132 | |
| 133 | 133 | key_ref_put(keyring_ref); |
| 134 | 134 | error3: |
| 135 | − kvfree(payload); | |
| 135 | + if (payload) { | |
| 136 | + memzero_explicit(payload, plen); | |
| 137 | + kvfree(payload); | |
| 138 | + } | |
| 136 | 139 | error2: |
| 137 | 140 | kfree(description); |
| 138 | 141 | error: |
| @@ -324,7 +327,7 @@ long keyctl_update_key(key_serial_t id, · 185 unmodified lines | ||
| 324 | 327 | |
| 325 | 328 | /* pull the payload in if one was supplied */ |
| 326 | 329 | payload = NULL; |
| 327 | − if (_payload) { | |
| 330 | + if (plen) { | |
| 328 | 331 | ret = -ENOMEM; |
| 329 | 332 | payload = kmalloc(plen, GFP_KERNEL); |
| 330 | 333 | if (!payload) |
| @@ -347,7 +350,7 @@ long keyctl_update_key(key_serial_t id, · 16 unmodified lines | ||
| 347 | 350 | |
| 348 | 351 | key_ref_put(key_ref); |
| 349 | 352 | error2: |
| 350 | − kfree(payload); | |
| 353 | + kzfree(payload); | |
| 351 | 354 | error: |
| 352 | 355 | return ret; |
| 353 | 356 | } |
| @@ -1093,7 +1096,10 @@ long keyctl_instantiate_key_common(key_serial_t id, · 739 unmodified lines | ||
| 1093 | 1096 | keyctl_change_reqkey_auth(NULL); |
| 1094 | 1097 | |
| 1095 | 1098 | error2: |
| 1096 | − kvfree(payload); | |
| 1099 | + if (payload) { | |
| 1100 | + memzero_explicit(payload, plen); | |
| 1101 | + kvfree(payload); | |
| 1102 | + } | |
| 1097 | 1103 | error: |
| 1098 | 1104 | return ret; |
| 1099 | 1105 | } |
| @@ -706,7 +706,7 @@ descend_to_keyring: · 705 unmodified lines | ||
| 706 | 706 | * Non-keyrings avoid the leftmost branch of the root entirely (root |
| 707 | 707 | * slots 1-15). |
| 708 | 708 | */ |
| 709 | − ptr = ACCESS_ONCE(keyring->keys.root); | |
| 709 | + ptr = READ_ONCE(keyring->keys.root); | |
| 710 | 710 | if (!ptr) |
| 711 | 711 | goto not_this_keyring; |
| 712 | 712 | |
| @@ -720,7 +720,7 @@ descend_to_keyring: · 7 unmodified lines | ||
| 720 | 720 | if ((shortcut->index_key[0] & ASSOC_ARRAY_FAN_MASK) != 0) |
| 721 | 721 | goto not_this_keyring; |
| 722 | 722 | |
| 723 | − ptr = ACCESS_ONCE(shortcut->next_node); | |
| 723 | + ptr = READ_ONCE(shortcut->next_node); | |
| 724 | 724 | node = assoc_array_ptr_to_node(ptr); |
| 725 | 725 | goto begin_node; |
| 726 | 726 | } |
| @@ -740,7 +740,7 @@ descend_to_node: · 13 unmodified lines | ||
| 740 | 740 | if (assoc_array_ptr_is_shortcut(ptr)) { |
| 741 | 741 | shortcut = assoc_array_ptr_to_shortcut(ptr); |
| 742 | 742 | smp_read_barrier_depends(); |
| 743 | − ptr = ACCESS_ONCE(shortcut->next_node); | |
| 743 | + ptr = READ_ONCE(shortcut->next_node); | |
| 744 | 744 | BUG_ON(!assoc_array_ptr_is_node(ptr)); |
| 745 | 745 | } |
| 746 | 746 | node = assoc_array_ptr_to_node(ptr); |
| @@ -752,7 +752,7 @@ begin_node: · 5 unmodified lines | ||
| 752 | 752 | ascend_to_node: |
| 753 | 753 | /* Go through the slots in a node */ |
| 754 | 754 | for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { |
| 755 | − ptr = ACCESS_ONCE(node->slots[slot]); | |
| 755 | + ptr = READ_ONCE(node->slots[slot]); | |
| 756 | 756 | |
| 757 | 757 | if (assoc_array_ptr_is_meta(ptr) && node->back_pointer) |
| 758 | 758 | goto descend_to_node; |
| @@ -790,13 +790,13 @@ ascend_to_node: · 31 unmodified lines | ||
| 790 | 790 | /* We've dealt with all the slots in the current node, so now we need |
| 791 | 791 | * to ascend to the parent and continue processing there. |
| 792 | 792 | */ |
| 793 | − ptr = ACCESS_ONCE(node->back_pointer); | |
| 793 | + ptr = READ_ONCE(node->back_pointer); | |
| 794 | 794 | slot = node->parent_slot; |
| 795 | 795 | |
| 796 | 796 | if (ptr && assoc_array_ptr_is_shortcut(ptr)) { |
| 797 | 797 | shortcut = assoc_array_ptr_to_shortcut(ptr); |
| 798 | 798 | smp_read_barrier_depends(); |
| 799 | − ptr = ACCESS_ONCE(shortcut->back_pointer); | |
| 799 | + ptr = READ_ONCE(shortcut->back_pointer); | |
| 800 | 800 | slot = shortcut->parent_slot; |
| 801 | 801 | } |
| 802 | 802 | if (!ptr) |
| @@ -809,15 +809,14 @@ long join_session_keyring(const char *name) · 808 unmodified lines | ||
| 809 | 809 | ret = PTR_ERR(keyring); |
| 810 | 810 | goto error2; |
| 811 | 811 | } else if (keyring == new->session_keyring) { |
| 812 | − key_put(keyring); | |
| 813 | 812 | ret = 0; |
| 814 | − goto error2; | |
| 813 | + goto error3; | |
| 815 | 814 | } |
| 816 | 815 | |
| 817 | 816 | /* we've got a keyring - now to install it */ |
| 818 | 817 | ret = install_session_keyring_to_cred(new, keyring); |
| 819 | 818 | if (ret < 0) |
| 820 | − goto error2; | |
| 819 | + goto error3; | |
| 821 | 820 | |
| 822 | 821 | commit_creds(new); |
| 823 | 822 | mutex_unlock(&key_session_mutex); |
| @@ -827,6 +826,8 @@ long join_session_keyring(const char *name) · 3 unmodified lines | ||
| 827 | 826 | okay: |
| 828 | 827 | return ret; |
| 829 | 828 | |
| 829 | +error3: | |
| 830 | + key_put(keyring); | |
| 830 | 831 | error2: |
| 831 | 832 | mutex_unlock(&key_session_mutex); |
| 832 | 833 | error: |
| @@ -70,7 +70,7 @@ static int TSS_sha1(const unsigned char *data, unsigned int datalen, · 69 unmodified lines | ||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | ret = crypto_shash_digest(&sdesc->shash, data, datalen, digest); |
| 73 | − kfree(sdesc); | |
| 73 | + kzfree(sdesc); | |
| 74 | 74 | return ret; |
| 75 | 75 | } |
| 76 | 76 | |
| @@ -114,7 +114,7 @@ static int TSS_rawhmac(unsigned char *digest, const unsigned char *key, · 37 unmodified lines | ||
| 114 | 114 | if (!ret) |
| 115 | 115 | ret = crypto_shash_final(&sdesc->shash, digest); |
| 116 | 116 | out: |
| 117 | − kfree(sdesc); | |
| 117 | + kzfree(sdesc); | |
| 118 | 118 | return ret; |
| 119 | 119 | } |
| 120 | 120 | |
| @@ -165,7 +165,7 @@ static int TSS_authhmac(unsigned char *digest, const unsigned char *key, · 44 unmodified lines | ||
| 165 | 165 | paramdigest, TPM_NONCE_SIZE, h1, |
| 166 | 166 | TPM_NONCE_SIZE, h2, 1, &c, 0, 0); |
| 167 | 167 | out: |
| 168 | − kfree(sdesc); | |
| 168 | + kzfree(sdesc); | |
| 169 | 169 | return ret; |
| 170 | 170 | } |
| 171 | 171 | |
| @@ -246,7 +246,7 @@ static int TSS_checkhmac1(unsigned char *buffer, · 74 unmodified lines | ||
| 246 | 246 | if (memcmp(testhmac, authdata, SHA1_DIGEST_SIZE)) |
| 247 | 247 | ret = -EINVAL; |
| 248 | 248 | out: |
| 249 | − kfree(sdesc); | |
| 249 | + kzfree(sdesc); | |
| 250 | 250 | return ret; |
| 251 | 251 | } |
| 252 | 252 | |
| @@ -347,7 +347,7 @@ static int TSS_checkhmac2(unsigned char *buffer, · 94 unmodified lines | ||
| 347 | 347 | if (memcmp(testhmac2, authdata2, SHA1_DIGEST_SIZE)) |
| 348 | 348 | ret = -EINVAL; |
| 349 | 349 | out: |
| 350 | − kfree(sdesc); | |
| 350 | + kzfree(sdesc); | |
| 351 | 351 | return ret; |
| 352 | 352 | } |
| 353 | 353 | |
| @@ -564,7 +564,7 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype, · 210 unmodified lines | ||
| 564 | 564 | *bloblen = storedsize; |
| 565 | 565 | } |
| 566 | 566 | out: |
| 567 | − kfree(td); | |
| 567 | + kzfree(td); | |
| 568 | 568 | return ret; |
| 569 | 569 | } |
| 570 | 570 | |
| @@ -678,7 +678,7 @@ static int key_seal(struct trusted_key_payload *p, · 107 unmodified lines | ||
| 678 | 678 | if (ret < 0) |
| 679 | 679 | pr_info("trusted_key: srkseal failed (%d)\n", ret); |
| 680 | 680 | |
| 681 | − kfree(tb); | |
| 681 | + kzfree(tb); | |
| 682 | 682 | return ret; |
| 683 | 683 | } |
| 684 | 684 | |
| @@ -703,7 +703,7 @@ static int key_unseal(struct trusted_key_payload *p, · 18 unmodified lines | ||
| 703 | 703 | /* pull migratable flag out of sealed key */ |
| 704 | 704 | p->migratable = p->key[--p->key_len]; |
| 705 | 705 | |
| 706 | − kfree(tb); | |
| 706 | + kzfree(tb); | |
| 707 | 707 | return ret; |
| 708 | 708 | } |
| 709 | 709 | |
| @@ -1037,12 +1037,12 @@ static int trusted_instantiate(struct key *key, · 327 unmodified lines | ||
| 1037 | 1037 | if (!ret && options->pcrlock) |
| 1038 | 1038 | ret = pcrlock(options->pcrlock); |
| 1039 | 1039 | out: |
| 1040 | − kfree(datablob); | |
| 1041 | − kfree(options); | |
| 1040 | + kzfree(datablob); | |
| 1041 | + kzfree(options); | |
| 1042 | 1042 | if (!ret) |
| 1043 | 1043 | rcu_assign_keypointer(key, payload); |
| 1044 | 1044 | else |
| 1045 | − kfree(payload); | |
| 1045 | + kzfree(payload); | |
| 1046 | 1046 | return ret; |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| @@ -1051,8 +1051,7 @@ static void trusted_rcu_free(struct rcu_head *rcu) · 2 unmodified lines | ||
| 1051 | 1051 | struct trusted_key_payload *p; |
| 1052 | 1052 | |
| 1053 | 1053 | p = container_of(rcu, struct trusted_key_payload, rcu); |
| 1054 | − memset(p->key, 0, p->key_len); | |
| 1055 | − kfree(p); | |
| 1054 | + kzfree(p); | |
| 1056 | 1055 | } |
| 1057 | 1056 | |
| 1058 | 1057 | /* |
| @@ -1094,13 +1093,13 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep) · 35 unmodified lines | ||
| 1094 | 1093 | ret = datablob_parse(datablob, new_p, new_o); |
| 1095 | 1094 | if (ret != Opt_update) { |
| 1096 | 1095 | ret = -EINVAL; |
| 1097 | − kfree(new_p); | |
| 1096 | + kzfree(new_p); | |
| 1098 | 1097 | goto out; |
| 1099 | 1098 | } |
| 1100 | 1099 | |
| 1101 | 1100 | if (!new_o->keyhandle) { |
| 1102 | 1101 | ret = -EINVAL; |
| 1103 | − kfree(new_p); | |
| 1102 | + kzfree(new_p); | |
| 1104 | 1103 | goto out; |
| 1105 | 1104 | } |
| 1106 | 1105 | |
| @@ -1114,22 +1113,22 @@ static int trusted_update(struct key *key, struct key_preparsed_payload *prep) · 7 unmodified lines | ||
| 1114 | 1113 | ret = key_seal(new_p, new_o); |
| 1115 | 1114 | if (ret < 0) { |
| 1116 | 1115 | pr_info("trusted_key: key_seal failed (%d)\n", ret); |
| 1117 | − kfree(new_p); | |
| 1116 | + kzfree(new_p); | |
| 1118 | 1117 | goto out; |
| 1119 | 1118 | } |
| 1120 | 1119 | if (new_o->pcrlock) { |
| 1121 | 1120 | ret = pcrlock(new_o->pcrlock); |
| 1122 | 1121 | if (ret < 0) { |
| 1123 | 1122 | pr_info("trusted_key: pcrlock failed (%d)\n", ret); |
| 1124 | − kfree(new_p); | |
| 1123 | + kzfree(new_p); | |
| 1125 | 1124 | goto out; |
| 1126 | 1125 | } |
| 1127 | 1126 | } |
| 1128 | 1127 | rcu_assign_keypointer(key, new_p); |
| 1129 | 1128 | call_rcu(&p->rcu, trusted_rcu_free); |
| 1130 | 1129 | out: |
| 1131 | − kfree(datablob); | |
| 1132 | − kfree(new_o); | |
| 1130 | + kzfree(datablob); | |
| 1131 | + kzfree(new_o); | |
| 1133 | 1132 | return ret; |
| 1134 | 1133 | } |
| 1135 | 1134 | |
| @@ -1158,24 +1157,19 @@ static long trusted_read(const struct key *key, char __user *buffer, · 22 unmodified lines | ||
| 1158 | 1157 | for (i = 0; i < p->blob_len; i++) |
| 1159 | 1158 | bufp = hex_byte_pack(bufp, p->blob[i]); |
| 1160 | 1159 | if ((copy_to_user(buffer, ascii_buf, 2 * p->blob_len)) != 0) { |
| 1161 | − kfree(ascii_buf); | |
| 1160 | + kzfree(ascii_buf); | |
| 1162 | 1161 | return -EFAULT; |
| 1163 | 1162 | } |
| 1164 | − kfree(ascii_buf); | |
| 1163 | + kzfree(ascii_buf); | |
| 1165 | 1164 | return 2 * p->blob_len; |
| 1166 | 1165 | } |
| 1167 | 1166 | |
| 1168 | 1167 | /* |
| 1169 | − * trusted_destroy - before freeing the key, clear the decrypted data | |
| 1168 | + * trusted_destroy - clear and free the key's payload | |
| 1170 | 1169 | */ |
| 1171 | 1170 | static void trusted_destroy(struct key *key) |
| 1172 | 1171 | { |
| 1173 | − struct trusted_key_payload *p = key->payload.data[0]; | |
| 1174 | − | |
| 1175 | − if (!p) | |
| 1176 | − return; | |
| 1177 | − memset(p->key, 0, p->key_len); | |
| 1178 | − kfree(key->payload.data[0]); | |
| 1172 | + kzfree(key->payload.data[0]); | |
| 1179 | 1173 | } |
| 1180 | 1174 | |
| 1181 | 1175 | struct key_type key_type_trusted = { |
| @@ -86,10 +86,18 @@ EXPORT_SYMBOL_GPL(user_preparse); · 85 unmodified lines | ||
| 86 | 86 | */ |
| 87 | 87 | void user_free_preparse(struct key_preparsed_payload *prep) |
| 88 | 88 | { |
| 89 | − kfree(prep->payload.data[0]); | |
| 89 | + kzfree(prep->payload.data[0]); | |
| 90 | 90 | } |
| 91 | 91 | EXPORT_SYMBOL_GPL(user_free_preparse); |
| 92 | 92 | |
| 93 | +static void user_free_payload_rcu(struct rcu_head *head) | |
| 94 | +{ | |
| 95 | + struct user_key_payload *payload; | |
| 96 | + | |
| 97 | + payload = container_of(head, struct user_key_payload, rcu); | |
| 98 | + kzfree(payload); | |
| 99 | +} | |
| 100 | + | |
| 93 | 101 | /* |
| 94 | 102 | * update a user defined key |
| 95 | 103 | * - the key's semaphore is write-locked |
| @@ -112,7 +120,7 @@ int user_update(struct key *key, struct key_preparsed_payload *prep) · 16 unmodified lines | ||
| 112 | 120 | prep->payload.data[0] = NULL; |
| 113 | 121 | |
| 114 | 122 | if (zap) |
| 115 | − kfree_rcu(zap, rcu); | |
| 123 | + call_rcu(&zap->rcu, user_free_payload_rcu); | |
| 116 | 124 | return ret; |
| 117 | 125 | } |
| 118 | 126 | EXPORT_SYMBOL_GPL(user_update); |
| @@ -130,7 +138,7 @@ void user_revoke(struct key *key) · 11 unmodified lines | ||
| 130 | 138 | |
| 131 | 139 | if (upayload) { |
| 132 | 140 | rcu_assign_keypointer(key, NULL); |
| 133 | − kfree_rcu(upayload, rcu); | |
| 141 | + call_rcu(&upayload->rcu, user_free_payload_rcu); | |
| 134 | 142 | } |
| 135 | 143 | } |
| 136 | 144 | |
| @@ -143,7 +151,7 @@ void user_destroy(struct key *key) · 6 unmodified lines | ||
| 143 | 151 | { |
| 144 | 152 | struct user_key_payload *upayload = key->payload.data[0]; |
| 145 | 153 | |
| 146 | − kfree(upayload); | |
| 154 | + kzfree(upayload); | |
| 147 | 155 | } |
| 148 | 156 | |
| 149 | 157 | EXPORT_SYMBOL_GPL(user_destroy); |
| @@ -1618,6 +1618,7 @@ static int snd_timer_user_tselect(struct file *file, · 1617 unmodified lines | ||
| 1618 | 1618 | if (err < 0) |
| 1619 | 1619 | goto __err; |
| 1620 | 1620 | |
| 1621 | + tu->qhead = tu->qtail = tu->qused = 0; | |
| 1621 | 1622 | kfree(tu->queue); |
| 1622 | 1623 | tu->queue = NULL; |
| 1623 | 1624 | kfree(tu->tqueue); |
| @@ -1959,6 +1960,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 335 unmodified lines | ||
| 1959 | 1960 | |
| 1960 | 1961 | tu = file->private_data; |
| 1961 | 1962 | unit = tu->tread ? sizeof(struct snd_timer_tread) : sizeof(struct snd_timer_read); |
| 1963 | + mutex_lock(&tu->ioctl_lock); | |
| 1962 | 1964 | spin_lock_irq(&tu->qlock); |
| 1963 | 1965 | while ((long)count - result >= unit) { |
| 1964 | 1966 | while (!tu->qused) { |
| @@ -1974,7 +1976,9 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 9 unmodified lines | ||
| 1974 | 1976 | add_wait_queue(&tu->qchange_sleep, &wait); |
| 1975 | 1977 | |
| 1976 | 1978 | spin_unlock_irq(&tu->qlock); |
| 1979 | + mutex_unlock(&tu->ioctl_lock); | |
| 1977 | 1980 | schedule(); |
| 1981 | + mutex_lock(&tu->ioctl_lock); | |
| 1978 | 1982 | spin_lock_irq(&tu->qlock); |
| 1979 | 1983 | |
| 1980 | 1984 | remove_wait_queue(&tu->qchange_sleep, &wait); |
| @@ -1994,7 +1998,6 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 13 unmodified lines | ||
| 1994 | 1998 | tu->qused--; |
| 1995 | 1999 | spin_unlock_irq(&tu->qlock); |
| 1996 | 2000 | |
| 1997 | − mutex_lock(&tu->ioctl_lock); | |
| 1998 | 2001 | if (tu->tread) { |
| 1999 | 2002 | if (copy_to_user(buffer, &tu->tqueue[qhead], |
| 2000 | 2003 | sizeof(struct snd_timer_tread))) |
| @@ -2004,7 +2007,6 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 3 unmodified lines | ||
| 2004 | 2007 | sizeof(struct snd_timer_read))) |
| 2005 | 2008 | err = -EFAULT; |
| 2006 | 2009 | } |
| 2007 | − mutex_unlock(&tu->ioctl_lock); | |
| 2008 | 2010 | |
| 2009 | 2011 | spin_lock_irq(&tu->qlock); |
| 2010 | 2012 | if (err < 0) |
| @@ -2014,6 +2016,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, · 3 unmodified lines | ||
| 2014 | 2016 | } |
| 2015 | 2017 | _error: |
| 2016 | 2018 | spin_unlock_irq(&tu->qlock); |
| 2019 | + mutex_unlock(&tu->ioctl_lock); | |
| 2017 | 2020 | return result > 0 ? result : err; |
| 2018 | 2021 | } |
| 2019 | 2022 | |
| @@ -5854,7 +5854,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 5853 unmodified lines | ||
| 5854 | 5854 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), |
| 5855 | 5855 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 5856 | 5856 | SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), |
| 5857 | + SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), | |
| 5857 | 5858 | SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 5859 | + SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), | |
| 5860 | + SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), | |
| 5861 | + SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), | |
| 5858 | 5862 | SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), |
| 5859 | 5863 | SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC), |
| 5860 | 5864 | SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), |
| @@ -5862,13 +5866,10 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 1 unmodified line | ||
| 5862 | 5866 | SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), |
| 5863 | 5867 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
| 5864 | 5868 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
| 5869 | + SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC), | |
| 5865 | 5870 | SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), |
| 5866 | − SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | |
| 5867 | 5871 | SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), |
| 5868 | − SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), | |
| 5869 | − SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), | |
| 5870 | − SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), | |
| 5871 | − SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), | |
| 5872 | + SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | |
| 5872 | 5873 | SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), |
| 5873 | 5874 | SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), |
| 5874 | 5875 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), |
| @@ -301,6 +301,14 @@ static int atmel_classd_codec_probe(struct snd_soc_codec *codec) · 300 unmodified lines | ||
| 301 | 301 | return 0; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | +static int atmel_classd_codec_resume(struct snd_soc_codec *codec) | |
| 305 | +{ | |
| 306 | + struct snd_soc_card *card = snd_soc_codec_get_drvdata(codec); | |
| 307 | + struct atmel_classd *dd = snd_soc_card_get_drvdata(card); | |
| 308 | + | |
| 309 | + return regcache_sync(dd->regmap); | |
| 310 | +} | |
| 311 | + | |
| 304 | 312 | static struct regmap *atmel_classd_codec_get_remap(struct device *dev) |
| 305 | 313 | { |
| 306 | 314 | return dev_get_regmap(dev, NULL); |
| @@ -308,6 +316,7 @@ static struct regmap *atmel_classd_codec_get_remap(struct device *dev) · 1 unmodified line | ||
| 308 | 316 | |
| 309 | 317 | static struct snd_soc_codec_driver soc_codec_dev_classd = { |
| 310 | 318 | .probe = atmel_classd_codec_probe, |
| 319 | + .resume = atmel_classd_codec_resume, | |
| 311 | 320 | .get_regmap = atmel_classd_codec_get_remap, |
| 312 | 321 | .component_driver = { |
| 313 | 322 | .controls = atmel_classd_snd_controls, |
| @@ -772,7 +772,7 @@ static int da7213_dai_event(struct snd_soc_dapm_widget *w, · 771 unmodified lines | ||
| 772 | 772 | ++i; |
| 773 | 773 | msleep(50); |
| 774 | 774 | } |
| 775 | − } while ((i < DA7213_SRM_CHECK_RETRIES) & (!srm_lock)); | |
| 775 | + } while ((i < DA7213_SRM_CHECK_RETRIES) && (!srm_lock)); | |
| 776 | 776 | |
| 777 | 777 | if (!srm_lock) |
| 778 | 778 | dev_warn(codec->dev, "SRM failed to lock\n"); |
| @@ -1108,6 +1108,13 @@ static const struct dmi_system_id force_combo_jack_table[] = { · 1107 unmodified lines | ||
| 1108 | 1108 | DMI_MATCH(DMI_PRODUCT_NAME, "Kabylake Client platform") |
| 1109 | 1109 | } |
| 1110 | 1110 | }, |
| 1111 | + { | |
| 1112 | + .ident = "Thinkpad Helix 2nd", | |
| 1113 | + .matches = { | |
| 1114 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
| 1115 | + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix 2nd") | |
| 1116 | + } | |
| 1117 | + }, | |
| 1111 | 1118 | |
| 1112 | 1119 | { } |
| 1113 | 1120 | }; |
| @@ -202,7 +202,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) · 201 unmodified lines | ||
| 202 | 202 | if (ret < 0) |
| 203 | 203 | return ret; |
| 204 | 204 | |
| 205 | − ret = asoc_simple_card_init_mic(rtd->card, &priv->hp_jack, PREFIX); | |
| 205 | + ret = asoc_simple_card_init_mic(rtd->card, &priv->mic_jack, PREFIX); | |
| 206 | 206 | if (ret < 0) |
| 207 | 207 | return ret; |
| 208 | 208 | |
| @@ -413,8 +413,11 @@ static void skl_ipc_process_reply(struct sst_generic_ipc *ipc, · 412 unmodified lines | ||
| 413 | 413 | u32 reply = header.primary & IPC_GLB_REPLY_STATUS_MASK; |
| 414 | 414 | u64 *ipc_header = (u64 *)(&header); |
| 415 | 415 | struct skl_sst *skl = container_of(ipc, struct skl_sst, ipc); |
| 416 | + unsigned long flags; | |
| 416 | 417 | |
| 418 | + spin_lock_irqsave(&ipc->dsp->spinlock, flags); | |
| 417 | 419 | msg = skl_ipc_reply_get_msg(ipc, *ipc_header); |
| 420 | + spin_unlock_irqrestore(&ipc->dsp->spinlock, flags); | |
| 418 | 421 | if (msg == NULL) { |
| 419 | 422 | dev_dbg(ipc->dev, "ipc: rx list is empty\n"); |
| 420 | 423 | return; |
| @@ -456,8 +459,10 @@ static void skl_ipc_process_reply(struct sst_generic_ipc *ipc, · 35 unmodified lines | ||
| 456 | 459 | } |
| 457 | 460 | } |
| 458 | 461 | |
| 462 | + spin_lock_irqsave(&ipc->dsp->spinlock, flags); | |
| 459 | 463 | list_del(&msg->list); |
| 460 | 464 | sst_ipc_tx_msg_reply_complete(ipc, msg); |
| 465 | + spin_unlock_irqrestore(&ipc->dsp->spinlock, flags); | |
| 461 | 466 | } |
| 462 | 467 | |
| 463 | 468 | irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context) |
| @@ -2502,7 +2502,7 @@ static int skl_tplg_get_manifest_tkn(struct device *dev, · 2501 unmodified lines | ||
| 2502 | 2502 | |
| 2503 | 2503 | if (ret < 0) |
| 2504 | 2504 | return ret; |
| 2505 | − tkn_count += ret; | |
| 2505 | + tkn_count = ret; | |
| 2506 | 2506 | |
| 2507 | 2507 | tuple_size += tkn_count * |
| 2508 | 2508 | sizeof(struct snd_soc_tplg_vendor_string_elem); |
| @@ -410,7 +410,7 @@ static int skl_free(struct hdac_ext_bus *ebus) · 409 unmodified lines | ||
| 410 | 410 | struct skl *skl = ebus_to_skl(ebus); |
| 411 | 411 | struct hdac_bus *bus = ebus_to_hbus(ebus); |
| 412 | 412 | |
| 413 | − skl->init_failed = 1; /* to be sure */ | |
| 413 | + skl->init_done = 0; /* to be sure */ | |
| 414 | 414 | |
| 415 | 415 | snd_hdac_ext_stop_streams(ebus); |
| 416 | 416 | |
| @@ -428,8 +428,10 @@ static int skl_free(struct hdac_ext_bus *ebus) · 11 unmodified lines | ||
| 428 | 428 | |
| 429 | 429 | snd_hdac_ext_bus_exit(ebus); |
| 430 | 430 | |
| 431 | + cancel_work_sync(&skl->probe_work); | |
| 431 | 432 | if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) |
| 432 | 433 | snd_hdac_i915_exit(&ebus->bus); |
| 434 | + | |
| 433 | 435 | return 0; |
| 434 | 436 | } |
| 435 | 437 | |
| @@ -566,6 +568,84 @@ static const struct hdac_bus_ops bus_core_ops = { · 130 unmodified lines | ||
| 566 | 568 | .get_response = snd_hdac_bus_get_response, |
| 567 | 569 | }; |
| 568 | 570 | |
| 571 | +static int skl_i915_init(struct hdac_bus *bus) | |
| 572 | +{ | |
| 573 | + int err; | |
| 574 | + | |
| 575 | + /* | |
| 576 | + * The HDMI codec is in GPU so we need to ensure that it is powered | |
| 577 | + * up and ready for probe | |
| 578 | + */ | |
| 579 | + err = snd_hdac_i915_init(bus); | |
| 580 | + if (err < 0) | |
| 581 | + return err; | |
| 582 | + | |
| 583 | + err = snd_hdac_display_power(bus, true); | |
| 584 | + if (err < 0) | |
| 585 | + dev_err(bus->dev, "Cannot turn on display power on i915\n"); | |
| 586 | + | |
| 587 | + return err; | |
| 588 | +} | |
| 589 | + | |
| 590 | +static void skl_probe_work(struct work_struct *work) | |
| 591 | +{ | |
| 592 | + struct skl *skl = container_of(work, struct skl, probe_work); | |
| 593 | + struct hdac_ext_bus *ebus = &skl->ebus; | |
| 594 | + struct hdac_bus *bus = ebus_to_hbus(ebus); | |
| 595 | + struct hdac_ext_link *hlink = NULL; | |
| 596 | + int err; | |
| 597 | + | |
| 598 | + if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { | |
| 599 | + err = skl_i915_init(bus); | |
| 600 | + if (err < 0) | |
| 601 | + return; | |
| 602 | + } | |
| 603 | + | |
| 604 | + err = skl_init_chip(bus, true); | |
| 605 | + if (err < 0) { | |
| 606 | + dev_err(bus->dev, "Init chip failed with err: %d\n", err); | |
| 607 | + goto out_err; | |
| 608 | + } | |
| 609 | + | |
| 610 | + /* codec detection */ | |
| 611 | + if (!bus->codec_mask) | |
| 612 | + dev_info(bus->dev, "no hda codecs found!\n"); | |
| 613 | + | |
| 614 | + /* create codec instances */ | |
| 615 | + err = skl_codec_create(ebus); | |
| 616 | + if (err < 0) | |
| 617 | + goto out_err; | |
| 618 | + | |
| 619 | + if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { | |
| 620 | + err = snd_hdac_display_power(bus, false); | |
| 621 | + if (err < 0) { | |
| 622 | + dev_err(bus->dev, "Cannot turn off display power on i915\n"); | |
| 623 | + return; | |
| 624 | + } | |
| 625 | + } | |
| 626 | + | |
| 627 | + /* register platform dai and controls */ | |
| 628 | + err = skl_platform_register(bus->dev); | |
| 629 | + if (err < 0) | |
| 630 | + return; | |
| 631 | + /* | |
| 632 | + * we are done probing so decrement link counts | |
| 633 | + */ | |
| 634 | + list_for_each_entry(hlink, &ebus->hlink_list, list) | |
| 635 | + snd_hdac_ext_bus_link_put(ebus, hlink); | |
| 636 | + | |
| 637 | + /* configure PM */ | |
| 638 | + pm_runtime_put_noidle(bus->dev); | |
| 639 | + pm_runtime_allow(bus->dev); | |
| 640 | + skl->init_done = 1; | |
| 641 | + | |
| 642 | + return; | |
| 643 | + | |
| 644 | +out_err: | |
| 645 | + if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) | |
| 646 | + err = snd_hdac_display_power(bus, false); | |
| 647 | +} | |
| 648 | + | |
| 569 | 649 | /* |
| 570 | 650 | * constructor |
| 571 | 651 | */ |
| @@ -593,6 +673,7 @@ static int skl_create(struct pci_dev *pci, · 21 unmodified lines | ||
| 593 | 673 | snd_hdac_ext_bus_init(ebus, &pci->dev, &bus_core_ops, io_ops); |
| 594 | 674 | ebus->bus.use_posbuf = 1; |
| 595 | 675 | skl->pci = pci; |
| 676 | + INIT_WORK(&skl->probe_work, skl_probe_work); | |
| 596 | 677 | |
| 597 | 678 | ebus->bus.bdl_pos_adj = 0; |
| 598 | 679 | |
| @@ -601,27 +682,6 @@ static int skl_create(struct pci_dev *pci, · 2 unmodified lines | ||
| 601 | 682 | return 0; |
| 602 | 683 | } |
| 603 | 684 | |
| 604 | −static int skl_i915_init(struct hdac_bus *bus) | |
| 605 | −{ | |
| 606 | − int err; | |
| 607 | − | |
| 608 | − /* | |
| 609 | − * The HDMI codec is in GPU so we need to ensure that it is powered | |
| 610 | − * up and ready for probe | |
| 611 | − */ | |
| 612 | − err = snd_hdac_i915_init(bus); | |
| 613 | − if (err < 0) | |
| 614 | − return err; | |
| 615 | − | |
| 616 | − err = snd_hdac_display_power(bus, true); | |
| 617 | − if (err < 0) { | |
| 618 | − dev_err(bus->dev, "Cannot turn on display power on i915\n"); | |
| 619 | − return err; | |
| 620 | − } | |
| 621 | − | |
| 622 | − return err; | |
| 623 | −} | |
| 624 | − | |
| 625 | 685 | static int skl_first_init(struct hdac_ext_bus *ebus) |
| 626 | 686 | { |
| 627 | 687 | struct skl *skl = ebus_to_skl(ebus); |
| @@ -684,20 +744,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus) · 56 unmodified lines | ||
| 684 | 744 | /* initialize chip */ |
| 685 | 745 | skl_init_pci(skl); |
| 686 | 746 | |
| 687 | − if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { | |
| 688 | − err = skl_i915_init(bus); | |
| 689 | − if (err < 0) | |
| 690 | − return err; | |
| 691 | − } | |
| 692 | − | |
| 693 | − skl_init_chip(bus, true); | |
| 694 | − | |
| 695 | − /* codec detection */ | |
| 696 | − if (!bus->codec_mask) { | |
| 697 | − dev_info(bus->dev, "no hda codecs found!\n"); | |
| 698 | − } | |
| 699 | − | |
| 700 | − return 0; | |
| 747 | + return skl_init_chip(bus, true); | |
| 701 | 748 | } |
| 702 | 749 | |
| 703 | 750 | static int skl_probe(struct pci_dev *pci, |
| @@ -706,7 +753,6 @@ static int skl_probe(struct pci_dev *pci, · 2 unmodified lines | ||
| 706 | 753 | struct skl *skl; |
| 707 | 754 | struct hdac_ext_bus *ebus = NULL; |
| 708 | 755 | struct hdac_bus *bus = NULL; |
| 709 | − struct hdac_ext_link *hlink = NULL; | |
| 710 | 756 | int err; |
| 711 | 757 | |
| 712 | 758 | /* we use ext core ops, so provide NULL for ops here */ |
| @@ -729,7 +775,7 @@ static int skl_probe(struct pci_dev *pci, · 16 unmodified lines | ||
| 729 | 775 | |
| 730 | 776 | if (skl->nhlt == NULL) { |
| 731 | 777 | err = -ENODEV; |
| 732 | − goto out_display_power_off; | |
| 778 | + goto out_free; | |
| 733 | 779 | } |
| 734 | 780 | |
| 735 | 781 | err = skl_nhlt_create_sysfs(skl); |
| @@ -760,56 +806,24 @@ static int skl_probe(struct pci_dev *pci, · 24 unmodified lines | ||
| 760 | 806 | if (bus->mlcap) |
| 761 | 807 | snd_hdac_ext_bus_get_ml_capabilities(ebus); |
| 762 | 808 | |
| 809 | + snd_hdac_bus_stop_chip(bus); | |
| 810 | + | |
| 763 | 811 | /* create device for soc dmic */ |
| 764 | 812 | err = skl_dmic_device_register(skl); |
| 765 | 813 | if (err < 0) |
| 766 | 814 | goto out_dsp_free; |
| 767 | 815 | |
| 768 | − /* register platform dai and controls */ | |
| 769 | − err = skl_platform_register(bus->dev); | |
| 770 | − if (err < 0) | |
| 771 | − goto out_dmic_free; | |
| 772 | − | |
| 773 | − /* create codec instances */ | |
| 774 | − err = skl_codec_create(ebus); | |
| 775 | − if (err < 0) | |
| 776 | − goto out_unregister; | |
| 777 | − | |
| 778 | − if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { | |
| 779 | − err = snd_hdac_display_power(bus, false); | |
| 780 | − if (err < 0) { | |
| 781 | − dev_err(bus->dev, "Cannot turn off display power on i915\n"); | |
| 782 | − return err; | |
| 783 | − } | |
| 784 | − } | |
| 785 | − | |
| 786 | − /* | |
| 787 | − * we are done probling so decrement link counts | |
| 788 | − */ | |
| 789 | − list_for_each_entry(hlink, &ebus->hlink_list, list) | |
| 790 | − snd_hdac_ext_bus_link_put(ebus, hlink); | |
| 791 | − | |
| 792 | − /* configure PM */ | |
| 793 | − pm_runtime_put_noidle(bus->dev); | |
| 794 | − pm_runtime_allow(bus->dev); | |
| 816 | + schedule_work(&skl->probe_work); | |
| 795 | 817 | |
| 796 | 818 | return 0; |
| 797 | 819 | |
| 798 | −out_unregister: | |
| 799 | − skl_platform_unregister(bus->dev); | |
| 800 | −out_dmic_free: | |
| 801 | − skl_dmic_device_unregister(skl); | |
| 802 | 820 | out_dsp_free: |
| 803 | 821 | skl_free_dsp(skl); |
| 804 | 822 | out_mach_free: |
| 805 | 823 | skl_machine_device_unregister(skl); |
| 806 | 824 | out_nhlt_free: |
| 807 | 825 | skl_nhlt_free(skl->nhlt); |
| 808 | −out_display_power_off: | |
| 809 | − if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) | |
| 810 | − snd_hdac_display_power(bus, false); | |
| 811 | 826 | out_free: |
| 812 | − skl->init_failed = 1; | |
| 813 | 827 | skl_free(ebus); |
| 814 | 828 | |
| 815 | 829 | return err; |
| @@ -828,7 +842,7 @@ static void skl_shutdown(struct pci_dev *pci) · 12 unmodified lines | ||
| 828 | 842 | |
| 829 | 843 | skl = ebus_to_skl(ebus); |
| 830 | 844 | |
| 831 | − if (skl->init_failed) | |
| 845 | + if (!skl->init_done) | |
| 832 | 846 | return; |
| 833 | 847 | |
| 834 | 848 | snd_hdac_ext_stop_streams(ebus); |
| @@ -46,7 +46,7 @@ struct skl { · 45 unmodified lines | ||
| 46 | 46 | struct hdac_ext_bus ebus; |
| 47 | 47 | struct pci_dev *pci; |
| 48 | 48 | |
| 49 | − unsigned int init_failed:1; /* delayed init failed */ | |
| 49 | + unsigned int init_done:1; /* delayed init status */ | |
| 50 | 50 | struct platform_device *dmic_dev; |
| 51 | 51 | struct platform_device *i2s_dev; |
| 52 | 52 | struct snd_soc_platform *platform; |
| @@ -64,6 +64,8 @@ struct skl { · 11 unmodified lines | ||
| 64 | 64 | const struct firmware *tplg; |
| 65 | 65 | |
| 66 | 66 | int supend_active; |
| 67 | + | |
| 68 | + struct work_struct probe_work; | |
| 67 | 69 | }; |
| 68 | 70 | |
| 69 | 71 | #define skl_to_ebus(s) (&(s)->ebus) |
| @@ -507,7 +507,8 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv, · 506 unmodified lines | ||
| 507 | 507 | rbga = rbgx; |
| 508 | 508 | adg->rbga_rate_for_441khz = rate / div; |
| 509 | 509 | ckr |= brg_table[i] << 20; |
| 510 | − if (req_441kHz_rate) | |
| 510 | + if (req_441kHz_rate && | |
| 511 | + !(adg_mode_flags(adg) & AUDIO_OUT_48)) | |
| 511 | 512 | parent_clk_name = __clk_get_name(clk); |
| 512 | 513 | } |
| 513 | 514 | } |
| @@ -522,7 +523,8 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv, · 8 unmodified lines | ||
| 522 | 523 | rbgb = rbgx; |
| 523 | 524 | adg->rbgb_rate_for_48khz = rate / div; |
| 524 | 525 | ckr |= brg_table[i] << 16; |
| 525 | − if (req_48kHz_rate) | |
| 526 | + if (req_48kHz_rate && | |
| 527 | + (adg_mode_flags(adg) & AUDIO_OUT_48)) | |
| 526 | 528 | parent_clk_name = __clk_get_name(clk); |
| 527 | 529 | } |
| 528 | 530 | } |
| @@ -89,6 +89,7 @@ static int rsnd_cmd_init(struct rsnd_mod *mod, · 88 unmodified lines | ||
| 89 | 89 | dev_dbg(dev, "ctu/mix path = 0x%08x", data); |
| 90 | 90 | |
| 91 | 91 | rsnd_mod_write(mod, CMD_ROUTE_SLCT, data); |
| 92 | + rsnd_mod_write(mod, CMD_BUSIF_MODE, rsnd_get_busif_shift(io, mod) | 1); | |
| 92 | 93 | rsnd_mod_write(mod, CMD_BUSIF_DALIGN, rsnd_get_dalign(mod, io)); |
| 93 | 94 | |
| 94 | 95 | rsnd_adg_set_cmd_timsel_gen2(mod, io); |
| @@ -343,6 +343,57 @@ u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io) · 342 unmodified lines | ||
| 343 | 343 | return 0x76543210; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | +u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod) | |
| 347 | +{ | |
| 348 | + enum rsnd_mod_type playback_mods[] = { | |
| 349 | + RSND_MOD_SRC, | |
| 350 | + RSND_MOD_CMD, | |
| 351 | + RSND_MOD_SSIU, | |
| 352 | + }; | |
| 353 | + enum rsnd_mod_type capture_mods[] = { | |
| 354 | + RSND_MOD_CMD, | |
| 355 | + RSND_MOD_SRC, | |
| 356 | + RSND_MOD_SSIU, | |
| 357 | + }; | |
| 358 | + struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); | |
| 359 | + struct rsnd_mod *tmod = NULL; | |
| 360 | + enum rsnd_mod_type *mods = | |
| 361 | + rsnd_io_is_play(io) ? | |
| 362 | + playback_mods : capture_mods; | |
| 363 | + int i; | |
| 364 | + | |
| 365 | + /* | |
| 366 | + * This is needed for 24bit data | |
| 367 | + * We need to shift 8bit | |
| 368 | + * | |
| 369 | + * Linux 24bit data is located as 0x00****** | |
| 370 | + * HW 24bit data is located as 0x******00 | |
| 371 | + * | |
| 372 | + */ | |
| 373 | + switch (runtime->sample_bits) { | |
| 374 | + case 16: | |
| 375 | + return 0; | |
| 376 | + case 32: | |
| 377 | + break; | |
| 378 | + } | |
| 379 | + | |
| 380 | + for (i = 0; i < ARRAY_SIZE(playback_mods); i++) { | |
| 381 | + tmod = rsnd_io_to_mod(io, mods[i]); | |
| 382 | + if (tmod) | |
| 383 | + break; | |
| 384 | + } | |
| 385 | + | |
| 386 | + if (tmod != mod) | |
| 387 | + return 0; | |
| 388 | + | |
| 389 | + if (rsnd_io_is_play(io)) | |
| 390 | + return (0 << 20) | /* shift to Left */ | |
| 391 | + (8 << 16); /* 8bit */ | |
| 392 | + else | |
| 393 | + return (1 << 20) | /* shift to Right */ | |
| 394 | + (8 << 16); /* 8bit */ | |
| 395 | +} | |
| 396 | + | |
| 346 | 397 | /* |
| 347 | 398 | * rsnd_dai functions |
| 348 | 399 | */ |
| @@ -236,6 +236,7 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv) · 235 unmodified lines | ||
| 236 | 236 | RSND_GEN_M_REG(SRC_ROUTE_MODE0, 0xc, 0x20), |
| 237 | 237 | RSND_GEN_M_REG(SRC_CTRL, 0x10, 0x20), |
| 238 | 238 | RSND_GEN_M_REG(SRC_INT_ENABLE0, 0x18, 0x20), |
| 239 | + RSND_GEN_M_REG(CMD_BUSIF_MODE, 0x184, 0x20), | |
| 239 | 240 | RSND_GEN_M_REG(CMD_BUSIF_DALIGN,0x188, 0x20), |
| 240 | 241 | RSND_GEN_M_REG(CMD_ROUTE_SLCT, 0x18c, 0x20), |
| 241 | 242 | RSND_GEN_M_REG(CMD_CTRL, 0x190, 0x20), |
| @@ -73,6 +73,7 @@ enum rsnd_reg { · 72 unmodified lines | ||
| 73 | 73 | RSND_REG_SCU_SYS_INT_EN0, |
| 74 | 74 | RSND_REG_SCU_SYS_INT_EN1, |
| 75 | 75 | RSND_REG_CMD_CTRL, |
| 76 | + RSND_REG_CMD_BUSIF_MODE, | |
| 76 | 77 | RSND_REG_CMD_BUSIF_DALIGN, |
| 77 | 78 | RSND_REG_CMD_ROUTE_SLCT, |
| 78 | 79 | RSND_REG_CMDOUT_TIMSEL, |
| @@ -204,6 +205,7 @@ void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg, · 125 unmodified lines | ||
| 204 | 205 | u32 mask, u32 data); |
| 205 | 206 | u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io); |
| 206 | 207 | u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io); |
| 208 | +u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod); | |
| 207 | 209 | |
| 208 | 210 | /* |
| 209 | 211 | * R-Car DMA |
| @@ -190,11 +190,13 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, · 189 unmodified lines | ||
| 190 | 190 | struct rsnd_priv *priv = rsnd_mod_to_priv(mod); |
| 191 | 191 | struct device *dev = rsnd_priv_to_dev(priv); |
| 192 | 192 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
| 193 | + int is_play = rsnd_io_is_play(io); | |
| 193 | 194 | int use_src = 0; |
| 194 | 195 | u32 fin, fout; |
| 195 | 196 | u32 ifscr, fsrate, adinr; |
| 196 | 197 | u32 cr, route; |
| 197 | 198 | u32 bsdsr, bsisr; |
| 199 | + u32 i_busif, o_busif, tmp; | |
| 198 | 200 | uint ratio; |
| 199 | 201 | |
| 200 | 202 | if (!runtime) |
| @@ -270,6 +272,11 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, · 69 unmodified lines | ||
| 270 | 272 | break; |
| 271 | 273 | } |
| 272 | 274 | |
| 275 | + /* BUSIF_MODE */ | |
| 276 | + tmp = rsnd_get_busif_shift(io, mod); | |
| 277 | + i_busif = ( is_play ? tmp : 0) | 1; | |
| 278 | + o_busif = (!is_play ? tmp : 0) | 1; | |
| 279 | + | |
| 273 | 280 | rsnd_mod_write(mod, SRC_ROUTE_MODE0, route); |
| 274 | 281 | |
| 275 | 282 | rsnd_mod_write(mod, SRC_SRCIR, 1); /* initialize */ |
| @@ -281,8 +288,9 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, · 5 unmodified lines | ||
| 281 | 288 | rsnd_mod_write(mod, SRC_BSISR, bsisr); |
| 282 | 289 | rsnd_mod_write(mod, SRC_SRCIR, 0); /* cancel initialize */ |
| 283 | 290 | |
| 284 | − rsnd_mod_write(mod, SRC_I_BUSIF_MODE, 1); | |
| 285 | − rsnd_mod_write(mod, SRC_O_BUSIF_MODE, 1); | |
| 291 | + rsnd_mod_write(mod, SRC_I_BUSIF_MODE, i_busif); | |
| 292 | + rsnd_mod_write(mod, SRC_O_BUSIF_MODE, o_busif); | |
| 293 | + | |
| 286 | 294 | rsnd_mod_write(mod, SRC_BUSIF_DALIGN, rsnd_get_dalign(mod, io)); |
| 287 | 295 | |
| 288 | 296 | rsnd_adg_set_src_timesel_gen2(mod, io, fin, fout); |
| @@ -302,7 +302,7 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, · 301 unmodified lines | ||
| 302 | 302 | * always use 32bit system word. |
| 303 | 303 | * see also rsnd_ssi_master_clk_enable() |
| 304 | 304 | */ |
| 305 | − cr_own = FORCE | SWL_32 | PDTA; | |
| 305 | + cr_own = FORCE | SWL_32; | |
| 306 | 306 | |
| 307 | 307 | if (rdai->bit_clk_inv) |
| 308 | 308 | cr_own |= SCKP; |
| @@ -550,6 +550,13 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, · 241 unmodified lines | ||
| 550 | 550 | struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); |
| 551 | 551 | u32 *buf = (u32 *)(runtime->dma_area + |
| 552 | 552 | rsnd_dai_pointer_offset(io, 0)); |
| 553 | + int shift = 0; | |
| 554 | + | |
| 555 | + switch (runtime->sample_bits) { | |
| 556 | + case 32: | |
| 557 | + shift = 8; | |
| 558 | + break; | |
| 559 | + } | |
| 553 | 560 | |
| 554 | 561 | /* |
| 555 | 562 | * 8/16/32 data can be assesse to TDR/RDR register |
| @@ -557,9 +564,9 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, · 1 unmodified line | ||
| 557 | 564 | * see rsnd_ssi_init() |
| 558 | 565 | */ |
| 559 | 566 | if (rsnd_io_is_play(io)) |
| 560 | − rsnd_mod_write(mod, SSITDR, *buf); | |
| 567 | + rsnd_mod_write(mod, SSITDR, (*buf) << shift); | |
| 561 | 568 | else |
| 562 | − *buf = rsnd_mod_read(mod, SSIRDR); | |
| 569 | + *buf = (rsnd_mod_read(mod, SSIRDR) >> shift); | |
| 563 | 570 | |
| 564 | 571 | elapsed = rsnd_dai_pointer_update(io, sizeof(*buf)); |
| 565 | 572 | } |
| @@ -709,6 +716,11 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod, · 143 unmodified lines | ||
| 709 | 716 | struct rsnd_priv *priv) |
| 710 | 717 | { |
| 711 | 718 | struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); |
| 719 | + struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io); | |
| 720 | + | |
| 721 | + /* Do nothing for SSI parent mod */ | |
| 722 | + if (ssi_parent_mod == mod) | |
| 723 | + return 0; | |
| 712 | 724 | |
| 713 | 725 | /* PIO will request IRQ again */ |
| 714 | 726 | free_irq(ssi->irq, mod); |
| @@ -144,7 +144,8 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, · 143 unmodified lines | ||
| 144 | 144 | (rsnd_io_is_play(io) ? |
| 145 | 145 | rsnd_runtime_channel_after_ctu(io) : |
| 146 | 146 | rsnd_runtime_channel_original(io))); |
| 147 | − rsnd_mod_write(mod, SSI_BUSIF_MODE, 1); | |
| 147 | + rsnd_mod_write(mod, SSI_BUSIF_MODE, | |
| 148 | + rsnd_get_busif_shift(io, mod) | 1); | |
| 148 | 149 | rsnd_mod_write(mod, SSI_BUSIF_DALIGN, |
| 149 | 150 | rsnd_get_dalign(mod, io)); |
| 150 | 151 | } |
| @@ -2286,6 +2286,9 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card) · 2285 unmodified lines | ||
| 2286 | 2286 | list_for_each_entry(rtd, &card->rtd_list, list) |
| 2287 | 2287 | flush_delayed_work(&rtd->delayed_work); |
| 2288 | 2288 | |
| 2289 | + /* free the ALSA card at first; this syncs with pending operations */ | |
| 2290 | + snd_card_free(card->snd_card); | |
| 2291 | + | |
| 2289 | 2292 | /* remove and free each DAI */ |
| 2290 | 2293 | soc_remove_dai_links(card); |
| 2291 | 2294 | soc_remove_pcm_runtimes(card); |
| @@ -2300,9 +2303,7 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card) · 8 unmodified lines | ||
| 2300 | 2303 | if (card->remove) |
| 2301 | 2304 | card->remove(card); |
| 2302 | 2305 | |
| 2303 | − snd_card_free(card->snd_card); | |
| 2304 | 2306 | return 0; |
| 2305 | − | |
| 2306 | 2307 | } |
| 2307 | 2308 | |
| 2308 | 2309 | /* removes a socdev */ |
| @@ -240,9 +240,13 @@ Add a probe on schedule() function 12th line with recording cpu local variable: · 239 unmodified lines | ||
| 240 | 240 | or |
| 241 | 241 | ./perf probe --add='schedule:12 cpu' |
| 242 | 242 | |
| 243 | − this will add one or more probes which has the name start with "schedule". | |
| 243 | +Add one or more probes which has the name start with "schedule". | |
| 244 | 244 | |
| 245 | − Add probes on lines in schedule() function which calls update_rq_clock(). | |
| 245 | + ./perf probe schedule* | |
| 246 | + or | |
| 247 | + ./perf probe --add='schedule*' | |
| 248 | + | |
| 249 | +Add probes on lines in schedule() function which calls update_rq_clock(). | |
| 246 | 250 | |
| 247 | 251 | ./perf probe 'schedule;update_rq_clock*' |
| 248 | 252 | or |
| @@ -39,7 +39,7 @@ EVENT HANDLERS · 38 unmodified lines | ||
| 39 | 39 | When perf script is invoked using a trace script, a user-defined |
| 40 | 40 | 'handler function' is called for each event in the trace. If there's |
| 41 | 41 | no handler function defined for a given event type, the event is |
| 42 | −ignored (or passed to a 'trace_handled' function, see below) and the | |
| 42 | +ignored (or passed to a 'trace_unhandled' function, see below) and the | |
| 43 | 43 | next event is processed. |
| 44 | 44 | |
| 45 | 45 | Most of the event's field values are passed as arguments to the |
| @@ -149,10 +149,8 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu, · 148 unmodified lines | ||
| 149 | 149 | print "id=%d, args=%s\n" % \ |
| 150 | 150 | (id, args), |
| 151 | 151 | |
| 152 | −def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs, | |
| 153 | − common_pid, common_comm): | |
| 154 | − print_header(event_name, common_cpu, common_secs, common_nsecs, | |
| 155 | − common_pid, common_comm) | |
| 152 | +def trace_unhandled(event_name, context, event_fields_dict): | |
| 153 | + print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())]) | |
| 156 | 154 | |
| 157 | 155 | def print_header(event_name, cpu, secs, nsecs, pid, comm): |
| 158 | 156 | print "%-20s %5u %05u.%09u %8u %-20s " % \ |
| @@ -321,7 +319,7 @@ So those are the essential steps in writing and running a script. The · 162 unmodified lines | ||
| 321 | 319 | process can be generalized to any tracepoint or set of tracepoints |
| 322 | 320 | you're interested in - basically find the tracepoint(s) you're |
| 323 | 321 | interested in by looking at the list of available events shown by |
| 324 | −'perf list' and/or look in /sys/kernel/debug/tracing events for | |
| 322 | +'perf list' and/or look in /sys/kernel/debug/tracing/events/ for | |
| 325 | 323 | detailed event and field info, record the corresponding trace data |
| 326 | 324 | using 'perf record', passing it the list of interesting events, |
| 327 | 325 | generate a skeleton script using 'perf script -g python' and modify the |
| @@ -334,7 +332,7 @@ right place, you can have your script listed alongside the other · 6 unmodified lines | ||
| 334 | 332 | scripts listed by the 'perf script -l' command e.g.: |
| 335 | 333 | |
| 336 | 334 | ---- |
| 337 | −root@tropicana:~# perf script -l | |
| 335 | +# perf script -l | |
| 338 | 336 | List of available trace scripts: |
| 339 | 337 | wakeup-latency system-wide min/max/avg wakeup latency |
| 340 | 338 | rw-by-file <comm> r/w activity for a program, by file |
| @@ -383,8 +381,6 @@ source tree: · 42 unmodified lines | ||
| 383 | 381 | |
| 384 | 382 | ---- |
| 385 | 383 | # ls -al kernel-source/tools/perf/scripts/python |
| 386 | − | |
| 387 | −root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python | |
| 388 | 384 | total 32 |
| 389 | 385 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 . |
| 390 | 386 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 .. |
| @@ -399,7 +395,7 @@ otherwise your script won't show up at run-time), 'perf script -l' · 8 unmodified lines | ||
| 399 | 395 | should show a new entry for your script: |
| 400 | 396 | |
| 401 | 397 | ---- |
| 402 | −root@tropicana:~# perf script -l | |
| 398 | +# perf script -l | |
| 403 | 399 | List of available trace scripts: |
| 404 | 400 | wakeup-latency system-wide min/max/avg wakeup latency |
| 405 | 401 | rw-by-file <comm> r/w activity for a program, by file |
| @@ -437,7 +433,7 @@ EVENT HANDLERS · 31 unmodified lines | ||
| 437 | 433 | When perf script is invoked using a trace script, a user-defined |
| 438 | 434 | 'handler function' is called for each event in the trace. If there's |
| 439 | 435 | no handler function defined for a given event type, the event is |
| 440 | −ignored (or passed to a 'trace_handled' function, see below) and the | |
| 436 | +ignored (or passed to a 'trace_unhandled' function, see below) and the | |
| 441 | 437 | next event is processed. |
| 442 | 438 | |
| 443 | 439 | Most of the event's field values are passed as arguments to the |
| @@ -532,7 +528,7 @@ can implement a set of optional functions: · 88 unmodified lines | ||
| 532 | 528 | gives scripts a chance to do setup tasks: |
| 533 | 529 | |
| 534 | 530 | ---- |
| 535 | −def trace_begin: | |
| 531 | +def trace_begin(): | |
| 536 | 532 | pass |
| 537 | 533 | ---- |
| 538 | 534 | |
| @@ -541,7 +537,7 @@ def trace_begin: · 2 unmodified lines | ||
| 541 | 537 | as display results: |
| 542 | 538 | |
| 543 | 539 | ---- |
| 544 | −def trace_end: | |
| 540 | +def trace_end(): | |
| 545 | 541 | pass |
| 546 | 542 | ---- |
| 547 | 543 | |
| @@ -550,8 +546,7 @@ def trace_end: · 2 unmodified lines | ||
| 550 | 546 | of common arguments are passed into it: |
| 551 | 547 | |
| 552 | 548 | ---- |
| 553 | −def trace_unhandled(event_name, context, common_cpu, common_secs, | |
| 554 | − common_nsecs, common_pid, common_comm): | |
| 549 | +def trace_unhandled(event_name, context, event_fields_dict): | |
| 555 | 550 | pass |
| 556 | 551 | ---- |
| 557 | 552 | |
| @@ -26,6 +26,7 @@ const char *const arm64_triplets[] = { · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | const char *const powerpc_triplets[] = { |
| 28 | 28 | "powerpc-unknown-linux-gnu-", |
| 29 | + "powerpc-linux-gnu-", | |
| 29 | 30 | "powerpc64-unknown-linux-gnu-", |
| 30 | 31 | "powerpc64-linux-gnu-", |
| 31 | 32 | "powerpc64le-linux-gnu-", |
| @@ -1578,6 +1578,7 @@ static void print_header(int argc, const char **argv) · 1577 unmodified lines | ||
| 1578 | 1578 | static void print_footer(void) |
| 1579 | 1579 | { |
| 1580 | 1580 | FILE *output = stat_config.output; |
| 1581 | + int n; | |
| 1581 | 1582 | |
| 1582 | 1583 | if (!null_run) |
| 1583 | 1584 | fprintf(output, "\n"); |
| @@ -1590,7 +1591,9 @@ static void print_footer(void) · 6 unmodified lines | ||
| 1590 | 1591 | } |
| 1591 | 1592 | fprintf(output, "\n\n"); |
| 1592 | 1593 | |
| 1593 | − if (print_free_counters_hint) | |
| 1594 | + if (print_free_counters_hint && | |
| 1595 | + sysctl__read_int("kernel/nmi_watchdog", &n) >= 0 && | |
| 1596 | + n > 0) | |
| 1594 | 1597 | fprintf(output, |
| 1595 | 1598 | "Some events weren't counted. Try disabling the NMI watchdog:\n" |
| 1596 | 1599 | " echo 0 > /proc/sys/kernel/nmi_watchdog\n" |
| @@ -681,6 +681,10 @@ static struct syscall_fmt { · 680 unmodified lines | ||
| 681 | 681 | { .name = "mlockall", .errmsg = true, |
| 682 | 682 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, }, |
| 683 | 683 | { .name = "mmap", .hexret = true, |
| 684 | +/* The standard mmap maps to old_mmap on s390x */ | |
| 685 | +#if defined(__s390x__) | |
| 686 | + .alias = "old_mmap", | |
| 687 | +#endif | |
| 684 | 688 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ |
| 685 | 689 | [2] = SCA_MMAP_PROT, /* prot */ |
| 686 | 690 | [3] = SCA_MMAP_FLAGS, /* flags */ }, }, |
| @@ -288,3 +288,17 @@ int test__bp_signal(int subtest __maybe_unused) · 287 unmodified lines | ||
| 288 | 288 | return count1 == 1 && overflows == 3 && count2 == 3 && overflows_2 == 3 && count3 == 2 ? |
| 289 | 289 | TEST_OK : TEST_FAIL; |
| 290 | 290 | } |
| 291 | + | |
| 292 | +bool test__bp_signal_is_supported(void) | |
| 293 | +{ | |
| 294 | +/* | |
| 295 | + * The powerpc so far does not have support to even create | |
| 296 | + * instruction breakpoint using the perf event interface. | |
| 297 | + * Once it's there we can release this. | |
| 298 | + */ | |
| 299 | +#ifdef __powerpc__ | |
| 300 | + return false; | |
| 301 | +#else | |
| 302 | + return true; | |
| 303 | +#endif | |
| 304 | +} | |
| @@ -97,10 +97,12 @@ static struct test generic_tests[] = { · 96 unmodified lines | ||
| 97 | 97 | { |
| 98 | 98 | .desc = "Breakpoint overflow signal handler", |
| 99 | 99 | .func = test__bp_signal, |
| 100 | + .is_supported = test__bp_signal_is_supported, | |
| 100 | 101 | }, |
| 101 | 102 | { |
| 102 | 103 | .desc = "Breakpoint overflow sampling", |
| 103 | 104 | .func = test__bp_signal_overflow, |
| 105 | + .is_supported = test__bp_signal_is_supported, | |
| 104 | 106 | }, |
| 105 | 107 | { |
| 106 | 108 | .desc = "Number of exit events of a simple workload", |
| @@ -401,6 +403,11 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) · 294 unmodified lines | ||
| 401 | 403 | if (!perf_test__matches(t, curr, argc, argv)) |
| 402 | 404 | continue; |
| 403 | 405 | |
| 406 | + if (t->is_supported && !t->is_supported()) { | |
| 407 | + pr_debug("%2d: %-*s: Disabled\n", i, width, t->desc); | |
| 408 | + continue; | |
| 409 | + } | |
| 410 | + | |
| 404 | 411 | pr_info("%2d: %-*s:", i, width, t->desc); |
| 405 | 412 | |
| 406 | 413 | if (intlist__find(skiplist, i)) { |
| @@ -229,6 +229,8 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, · 228 unmodified lines | ||
| 229 | 229 | unsigned char buf2[BUFSZ]; |
| 230 | 230 | size_t ret_len; |
| 231 | 231 | u64 objdump_addr; |
| 232 | + const char *objdump_name; | |
| 233 | + char decomp_name[KMOD_DECOMP_LEN]; | |
| 232 | 234 | int ret; |
| 233 | 235 | |
| 234 | 236 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); |
| @@ -289,9 +291,25 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, · 54 unmodified lines | ||
| 289 | 291 | state->done[state->done_cnt++] = al.map->start; |
| 290 | 292 | } |
| 291 | 293 | |
| 294 | + objdump_name = al.map->dso->long_name; | |
| 295 | + if (dso__needs_decompress(al.map->dso)) { | |
| 296 | + if (dso__decompress_kmodule_path(al.map->dso, objdump_name, | |
| 297 | + decomp_name, | |
| 298 | + sizeof(decomp_name)) < 0) { | |
| 299 | + pr_debug("decompression failed\n"); | |
| 300 | + return -1; | |
| 301 | + } | |
| 302 | + | |
| 303 | + objdump_name = decomp_name; | |
| 304 | + } | |
| 305 | + | |
| 292 | 306 | /* Read the object code using objdump */ |
| 293 | 307 | objdump_addr = map__rip_2objdump(al.map, al.addr); |
| 294 | − ret = read_via_objdump(al.map->dso->long_name, objdump_addr, buf2, len); | |
| 308 | + ret = read_via_objdump(objdump_name, objdump_addr, buf2, len); | |
| 309 | + | |
| 310 | + if (dso__needs_decompress(al.map->dso)) | |
| 311 | + unlink(objdump_name); | |
| 312 | + | |
| 295 | 313 | if (ret > 0) { |
| 296 | 314 | /* |
| 297 | 315 | * The kernel maps are inaccurate - assume objdump is right in |
| @@ -34,6 +34,7 @@ struct test { · 33 unmodified lines | ||
| 34 | 34 | int (*get_nr)(void); |
| 35 | 35 | const char *(*get_desc)(int subtest); |
| 36 | 36 | } subtest; |
| 37 | + bool (*is_supported)(void); | |
| 37 | 38 | }; |
| 38 | 39 | |
| 39 | 40 | /* Tests */ |
| @@ -99,6 +100,8 @@ const char *test__clang_subtest_get_desc(int subtest); · 59 unmodified lines | ||
| 99 | 100 | int test__clang_subtest_get_nr(void); |
| 100 | 101 | int test__unit_number__scnprint(int subtest); |
| 101 | 102 | |
| 103 | +bool test__bp_signal_is_supported(void); | |
| 104 | + | |
| 102 | 105 | #if defined(__arm__) || defined(__aarch64__) |
| 103 | 106 | #ifdef HAVE_DWARF_UNWIND_SUPPORT |
| 104 | 107 | struct thread; |
| @@ -239,10 +239,20 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op · 238 unmodified lines | ||
| 239 | 239 | const char *s = strchr(ops->raw, '+'); |
| 240 | 240 | const char *c = strchr(ops->raw, ','); |
| 241 | 241 | |
| 242 | − if (c++ != NULL) | |
| 242 | + /* | |
| 243 | + * skip over possible up to 2 operands to get to address, e.g.: | |
| 244 | + * tbnz w0, #26, ffff0000083cd190 <security_file_permission+0xd0> | |
| 245 | + */ | |
| 246 | + if (c++ != NULL) { | |
| 243 | 247 | ops->target.addr = strtoull(c, NULL, 16); |
| 244 | − else | |
| 248 | + if (!ops->target.addr) { | |
| 249 | + c = strchr(c, ','); | |
| 250 | + if (c++ != NULL) | |
| 251 | + ops->target.addr = strtoull(c, NULL, 16); | |
| 252 | + } | |
| 253 | + } else { | |
| 245 | 254 | ops->target.addr = strtoull(ops->raw, NULL, 16); |
| 255 | + } | |
| 246 | 256 | |
| 247 | 257 | if (s++ != NULL) { |
| 248 | 258 | ops->target.offset = strtoull(s, NULL, 16); |
| @@ -257,10 +267,27 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op · 8 unmodified lines | ||
| 257 | 267 | static int jump__scnprintf(struct ins *ins, char *bf, size_t size, |
| 258 | 268 | struct ins_operands *ops) |
| 259 | 269 | { |
| 270 | + const char *c = strchr(ops->raw, ','); | |
| 271 | + | |
| 260 | 272 | if (!ops->target.addr || ops->target.offset < 0) |
| 261 | 273 | return ins__raw_scnprintf(ins, bf, size, ops); |
| 262 | 274 | |
| 263 | − return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset); | |
| 275 | + if (c != NULL) { | |
| 276 | + const char *c2 = strchr(c + 1, ','); | |
| 277 | + | |
| 278 | + /* check for 3-op insn */ | |
| 279 | + if (c2 != NULL) | |
| 280 | + c = c2; | |
| 281 | + c++; | |
| 282 | + | |
| 283 | + /* mirror arch objdump's space-after-comma style */ | |
| 284 | + if (*c == ' ') | |
| 285 | + c++; | |
| 286 | + } | |
| 287 | + | |
| 288 | + return scnprintf(bf, size, "%-6.6s %.*s%" PRIx64, | |
| 289 | + ins->name, c ? c - ops->raw : 0, ops->raw, | |
| 290 | + ops->target.offset); | |
| 264 | 291 | } |
| 265 | 292 | |
| 266 | 293 | static struct ins_ops jump_ops = { |
| @@ -1294,6 +1321,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil · 1027 unmodified lines | ||
| 1294 | 1321 | char linkname[PATH_MAX]; |
| 1295 | 1322 | char *build_id_filename; |
| 1296 | 1323 | char *build_id_path = NULL; |
| 1324 | + char *pos; | |
| 1297 | 1325 | |
| 1298 | 1326 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && |
| 1299 | 1327 | !dso__is_kcore(dso)) |
| @@ -1313,7 +1341,14 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil · 13 unmodified lines | ||
| 1313 | 1341 | if (!build_id_path) |
| 1314 | 1342 | return -1; |
| 1315 | 1343 | |
| 1316 | − dirname(build_id_path); | |
| 1344 | + /* | |
| 1345 | + * old style build-id cache has name of XX/XXXXXXX.. while | |
| 1346 | + * new style has XX/XXXXXXX../{elf,kallsyms,vdso}. | |
| 1347 | + * extract the build-id part of dirname in the new style only. | |
| 1348 | + */ | |
| 1349 | + pos = strrchr(build_id_path, '/'); | |
| 1350 | + if (pos && strlen(pos) < SBUILD_ID_SIZE - 2) | |
| 1351 | + dirname(build_id_path); | |
| 1317 | 1352 | |
| 1318 | 1353 | if (dso__is_kcore(dso) || |
| 1319 | 1354 | readlink(build_id_path, linkname, sizeof(linkname)) < 0 || |
| @@ -1396,31 +1431,10 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na · 76 unmodified lines | ||
| 1396 | 1431 | sizeof(symfs_filename)); |
| 1397 | 1432 | } |
| 1398 | 1433 | } else if (dso__needs_decompress(dso)) { |
| 1399 | − char tmp[PATH_MAX]; | |
| 1400 | − struct kmod_path m; | |
| 1401 | − int fd; | |
| 1402 | − bool ret; | |
| 1403 | − | |
| 1404 | − if (kmod_path__parse_ext(&m, symfs_filename)) | |
| 1405 | − goto out; | |
| 1406 | − | |
| 1407 | − snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX"); | |
| 1408 | − | |
| 1409 | − fd = mkstemp(tmp); | |
| 1410 | − if (fd < 0) { | |
| 1411 | − free(m.ext); | |
| 1412 | − goto out; | |
| 1413 | − } | |
| 1414 | − | |
| 1415 | − ret = decompress_to_file(m.ext, symfs_filename, fd); | |
| 1416 | − | |
| 1417 | − if (ret) | |
| 1418 | − pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename); | |
| 1419 | − | |
| 1420 | − free(m.ext); | |
| 1421 | − close(fd); | |
| 1434 | + char tmp[KMOD_DECOMP_LEN]; | |
| 1422 | 1435 | |
| 1423 | − if (!ret) | |
| 1436 | + if (dso__decompress_kmodule_path(dso, symfs_filename, | |
| 1437 | + tmp, sizeof(tmp)) < 0) | |
| 1424 | 1438 | goto out; |
| 1425 | 1439 | |
| 1426 | 1440 | strcpy(symfs_filename, tmp); |
| @@ -1429,7 +1443,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na · 2 unmodified lines | ||
| 1429 | 1443 | snprintf(command, sizeof(command), |
| 1430 | 1444 | "%s %s%s --start-address=0x%016" PRIx64 |
| 1431 | 1445 | " --stop-address=0x%016" PRIx64 |
| 1432 | − " -l -d %s %s -C %s 2>/dev/null|grep -v %s:|expand", | |
| 1446 | + " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand", | |
| 1433 | 1447 | objdump_path ? objdump_path : "objdump", |
| 1434 | 1448 | disassembler_style ? "-M " : "", |
| 1435 | 1449 | disassembler_style ? disassembler_style : "", |
| @@ -278,51 +278,6 @@ char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size) · 277 unmodified lines | ||
| 278 | 278 | return bf; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | −bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size) | |
| 282 | −{ | |
| 283 | − char *id_name = NULL, *ch; | |
| 284 | − struct stat sb; | |
| 285 | − char sbuild_id[SBUILD_ID_SIZE]; | |
| 286 | − | |
| 287 | − if (!dso->has_build_id) | |
| 288 | − goto err; | |
| 289 | − | |
| 290 | − build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); | |
| 291 | − id_name = build_id_cache__linkname(sbuild_id, NULL, 0); | |
| 292 | − if (!id_name) | |
| 293 | − goto err; | |
| 294 | − if (access(id_name, F_OK)) | |
| 295 | − goto err; | |
| 296 | − if (lstat(id_name, &sb) == -1) | |
| 297 | − goto err; | |
| 298 | − if ((size_t)sb.st_size > size - 1) | |
| 299 | − goto err; | |
| 300 | − if (readlink(id_name, bf, size - 1) < 0) | |
| 301 | − goto err; | |
| 302 | − | |
| 303 | − bf[sb.st_size] = '\0'; | |
| 304 | − | |
| 305 | − /* | |
| 306 | − * link should be: | |
| 307 | − * ../../lib/modules/4.4.0-rc4/kernel/net/ipv4/netfilter/nf_nat_ipv4.ko/a09fe3eb3147dafa4e3b31dbd6257e4d696bdc92 | |
| 308 | − */ | |
| 309 | − ch = strrchr(bf, '/'); | |
| 310 | − if (!ch) | |
| 311 | − goto err; | |
| 312 | − if (ch - 3 < bf) | |
| 313 | − goto err; | |
| 314 | − | |
| 315 | − free(id_name); | |
| 316 | − return strncmp(".ko", ch - 3, 3) == 0; | |
| 317 | −err: | |
| 318 | − pr_err("Invalid build id: %s\n", id_name ? : | |
| 319 | − dso->long_name ? : | |
| 320 | − dso->short_name ? : | |
| 321 | − "[unknown]"); | |
| 322 | − free(id_name); | |
| 323 | − return false; | |
| 324 | −} | |
| 325 | − | |
| 326 | 281 | #define dsos__for_each_with_build_id(pos, head) \ |
| 327 | 282 | list_for_each_entry(pos, head, node) \ |
| 328 | 283 | if (!pos->has_build_id) \ |
| @@ -17,7 +17,6 @@ char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf, · 16 unmodified lines | ||
| 17 | 17 | size_t size); |
| 18 | 18 | |
| 19 | 19 | char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size); |
| 20 | −bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size); | |
| 21 | 20 | |
| 22 | 21 | int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, |
| 23 | 22 | struct perf_sample *sample, struct perf_evsel *evsel, |
| @@ -248,6 +248,64 @@ bool dso__needs_decompress(struct dso *dso) · 247 unmodified lines | ||
| 248 | 248 | dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | +static int decompress_kmodule(struct dso *dso, const char *name, char *tmpbuf) | |
| 252 | +{ | |
| 253 | + int fd = -1; | |
| 254 | + struct kmod_path m; | |
| 255 | + | |
| 256 | + if (!dso__needs_decompress(dso)) | |
| 257 | + return -1; | |
| 258 | + | |
| 259 | + if (kmod_path__parse_ext(&m, dso->long_name)) | |
| 260 | + return -1; | |
| 261 | + | |
| 262 | + if (!m.comp) | |
| 263 | + goto out; | |
| 264 | + | |
| 265 | + fd = mkstemp(tmpbuf); | |
| 266 | + if (fd < 0) { | |
| 267 | + dso->load_errno = errno; | |
| 268 | + goto out; | |
| 269 | + } | |
| 270 | + | |
| 271 | + if (!decompress_to_file(m.ext, name, fd)) { | |
| 272 | + dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; | |
| 273 | + close(fd); | |
| 274 | + fd = -1; | |
| 275 | + } | |
| 276 | + | |
| 277 | +out: | |
| 278 | + free(m.ext); | |
| 279 | + return fd; | |
| 280 | +} | |
| 281 | + | |
| 282 | +int dso__decompress_kmodule_fd(struct dso *dso, const char *name) | |
| 283 | +{ | |
| 284 | + char tmpbuf[] = KMOD_DECOMP_NAME; | |
| 285 | + int fd; | |
| 286 | + | |
| 287 | + fd = decompress_kmodule(dso, name, tmpbuf); | |
| 288 | + unlink(tmpbuf); | |
| 289 | + return fd; | |
| 290 | +} | |
| 291 | + | |
| 292 | +int dso__decompress_kmodule_path(struct dso *dso, const char *name, | |
| 293 | + char *pathname, size_t len) | |
| 294 | +{ | |
| 295 | + char tmpbuf[] = KMOD_DECOMP_NAME; | |
| 296 | + int fd; | |
| 297 | + | |
| 298 | + fd = decompress_kmodule(dso, name, tmpbuf); | |
| 299 | + if (fd < 0) { | |
| 300 | + unlink(tmpbuf); | |
| 301 | + return -1; | |
| 302 | + } | |
| 303 | + | |
| 304 | + strncpy(pathname, tmpbuf, len); | |
| 305 | + close(fd); | |
| 306 | + return 0; | |
| 307 | +} | |
| 308 | + | |
| 251 | 309 | /* |
| 252 | 310 | * Parses kernel module specified in @path and updates |
| 253 | 311 | * @m argument like: |
| @@ -335,6 +393,21 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, · 81 unmodified lines | ||
| 335 | 393 | return 0; |
| 336 | 394 | } |
| 337 | 395 | |
| 396 | +void dso__set_module_info(struct dso *dso, struct kmod_path *m, | |
| 397 | + struct machine *machine) | |
| 398 | +{ | |
| 399 | + if (machine__is_host(machine)) | |
| 400 | + dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; | |
| 401 | + else | |
| 402 | + dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE; | |
| 403 | + | |
| 404 | + /* _KMODULE_COMP should be next to _KMODULE */ | |
| 405 | + if (m->kmod && m->comp) | |
| 406 | + dso->symtab_type++; | |
| 407 | + | |
| 408 | + dso__set_short_name(dso, strdup(m->name), true); | |
| 409 | +} | |
| 410 | + | |
| 338 | 411 | /* |
| 339 | 412 | * Global list of open DSOs and the counter. |
| 340 | 413 | */ |
| @@ -381,7 +454,7 @@ static int do_open(char *name) · 40 unmodified lines | ||
| 381 | 454 | |
| 382 | 455 | static int __open_dso(struct dso *dso, struct machine *machine) |
| 383 | 456 | { |
| 384 | − int fd; | |
| 457 | + int fd = -EINVAL; | |
| 385 | 458 | char *root_dir = (char *)""; |
| 386 | 459 | char *name = malloc(PATH_MAX); |
| 387 | 460 | |
| @@ -392,15 +465,30 @@ static int __open_dso(struct dso *dso, struct machine *machine) · 4 unmodified lines | ||
| 392 | 465 | root_dir = machine->root_dir; |
| 393 | 466 | |
| 394 | 467 | if (dso__read_binary_type_filename(dso, dso->binary_type, |
| 395 | − root_dir, name, PATH_MAX)) { | |
| 396 | − free(name); | |
| 397 | − return -EINVAL; | |
| 398 | − } | |
| 468 | + root_dir, name, PATH_MAX)) | |
| 469 | + goto out; | |
| 399 | 470 | |
| 400 | 471 | if (!is_regular_file(name)) |
| 401 | − return -EINVAL; | |
| 472 | + goto out; | |
| 473 | + | |
| 474 | + if (dso__needs_decompress(dso)) { | |
| 475 | + char newpath[KMOD_DECOMP_LEN]; | |
| 476 | + size_t len = sizeof(newpath); | |
| 477 | + | |
| 478 | + if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) { | |
| 479 | + fd = -dso->load_errno; | |
| 480 | + goto out; | |
| 481 | + } | |
| 482 | + | |
| 483 | + strcpy(name, newpath); | |
| 484 | + } | |
| 402 | 485 | |
| 403 | 486 | fd = do_open(name); |
| 487 | + | |
| 488 | + if (dso__needs_decompress(dso)) | |
| 489 | + unlink(name); | |
| 490 | + | |
| 491 | +out: | |
| 404 | 492 | free(name); |
| 405 | 493 | return fd; |
| 406 | 494 | } |
| @@ -244,6 +244,12 @@ bool is_supported_compression(const char *ext); · 243 unmodified lines | ||
| 244 | 244 | bool is_kernel_module(const char *pathname, int cpumode); |
| 245 | 245 | bool decompress_to_file(const char *ext, const char *filename, int output_fd); |
| 246 | 246 | bool dso__needs_decompress(struct dso *dso); |
| 247 | +int dso__decompress_kmodule_fd(struct dso *dso, const char *name); | |
| 248 | +int dso__decompress_kmodule_path(struct dso *dso, const char *name, | |
| 249 | + char *pathname, size_t len); | |
| 250 | + | |
| 251 | +#define KMOD_DECOMP_NAME "/tmp/perf-kmod-XXXXXX" | |
| 252 | +#define KMOD_DECOMP_LEN sizeof(KMOD_DECOMP_NAME) | |
| 247 | 253 | |
| 248 | 254 | struct kmod_path { |
| 249 | 255 | char *name; |
| @@ -259,6 +265,9 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, · 9 unmodified lines | ||
| 259 | 265 | #define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false) |
| 260 | 266 | #define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true) |
| 261 | 267 | |
| 268 | +void dso__set_module_info(struct dso *dso, struct kmod_path *m, | |
| 269 | + struct machine *machine); | |
| 270 | + | |
| 262 | 271 | /* |
| 263 | 272 | * The dso__data_* external interface provides following functions: |
| 264 | 273 | * dso__data_get_fd |
| @@ -1469,8 +1469,16 @@ static int __event_process_build_id(struct build_id_event *bev, · 1468 unmodified lines | ||
| 1469 | 1469 | |
| 1470 | 1470 | dso__set_build_id(dso, &bev->build_id); |
| 1471 | 1471 | |
| 1472 | − if (!is_kernel_module(filename, cpumode)) | |
| 1473 | − dso->kernel = dso_type; | |
| 1472 | + if (dso_type != DSO_TYPE_USER) { | |
| 1473 | + struct kmod_path m = { .name = NULL, }; | |
| 1474 | + | |
| 1475 | + if (!kmod_path__parse_name(&m, filename) && m.kmod) | |
| 1476 | + dso__set_module_info(dso, &m, machine); | |
| 1477 | + else | |
| 1478 | + dso->kernel = dso_type; | |
| 1479 | + | |
| 1480 | + free(m.name); | |
| 1481 | + } | |
| 1474 | 1482 | |
| 1475 | 1483 | build_id__sprintf(dso->build_id, sizeof(dso->build_id), |
| 1476 | 1484 | sbuild_id); |
| @@ -572,16 +572,7 @@ static struct dso *machine__findnew_module_dso(struct machine *machine, · 571 unmodified lines | ||
| 572 | 572 | if (dso == NULL) |
| 573 | 573 | goto out_unlock; |
| 574 | 574 | |
| 575 | − if (machine__is_host(machine)) | |
| 576 | − dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; | |
| 577 | − else | |
| 578 | − dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE; | |
| 579 | − | |
| 580 | − /* _KMODULE_COMP should be next to _KMODULE */ | |
| 581 | − if (m->kmod && m->comp) | |
| 582 | − dso->symtab_type++; | |
| 583 | − | |
| 584 | − dso__set_short_name(dso, strdup(m->name), true); | |
| 575 | + dso__set_module_info(dso, m, machine); | |
| 585 | 576 | dso__set_long_name(dso, strdup(filename), true); |
| 586 | 577 | } |
| 587 | 578 | |
| @@ -1219,7 +1219,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile) · 1218 unmodified lines | ||
| 1219 | 1219 | fprintf(ofp, "# be retrieved using Python functions of the form " |
| 1220 | 1220 | "common_*(context).\n"); |
| 1221 | 1221 | |
| 1222 | − fprintf(ofp, "# See the perf-trace-python Documentation for the list " | |
| 1222 | + fprintf(ofp, "# See the perf-script-python Documentation for the list " | |
| 1223 | 1223 | "of available functions.\n\n"); |
| 1224 | 1224 | |
| 1225 | 1225 | fprintf(ofp, "import os\n"); |
| @@ -637,43 +637,6 @@ static int dso__swap_init(struct dso *dso, unsigned char eidata) · 636 unmodified lines | ||
| 637 | 637 | return 0; |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | −static int decompress_kmodule(struct dso *dso, const char *name, | |
| 641 | − enum dso_binary_type type) | |
| 642 | −{ | |
| 643 | − int fd = -1; | |
| 644 | − char tmpbuf[] = "/tmp/perf-kmod-XXXXXX"; | |
| 645 | − struct kmod_path m; | |
| 646 | − | |
| 647 | − if (type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP && | |
| 648 | − type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP && | |
| 649 | − type != DSO_BINARY_TYPE__BUILD_ID_CACHE) | |
| 650 | − return -1; | |
| 651 | − | |
| 652 | − if (type == DSO_BINARY_TYPE__BUILD_ID_CACHE) | |
| 653 | − name = dso->long_name; | |
| 654 | − | |
| 655 | − if (kmod_path__parse_ext(&m, name) || !m.comp) | |
| 656 | − return -1; | |
| 657 | − | |
| 658 | − fd = mkstemp(tmpbuf); | |
| 659 | − if (fd < 0) { | |
| 660 | − dso->load_errno = errno; | |
| 661 | − goto out; | |
| 662 | − } | |
| 663 | − | |
| 664 | − if (!decompress_to_file(m.ext, name, fd)) { | |
| 665 | − dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; | |
| 666 | − close(fd); | |
| 667 | − fd = -1; | |
| 668 | − } | |
| 669 | − | |
| 670 | − unlink(tmpbuf); | |
| 671 | − | |
| 672 | −out: | |
| 673 | − free(m.ext); | |
| 674 | − return fd; | |
| 675 | −} | |
| 676 | − | |
| 677 | 640 | bool symsrc__possibly_runtime(struct symsrc *ss) |
| 678 | 641 | { |
| 679 | 642 | return ss->dynsym || ss->opdsec; |
| @@ -705,9 +668,11 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, · 25 unmodified lines | ||
| 705 | 668 | int fd; |
| 706 | 669 | |
| 707 | 670 | if (dso__needs_decompress(dso)) { |
| 708 | − fd = decompress_kmodule(dso, name, type); | |
| 671 | + fd = dso__decompress_kmodule_fd(dso, name); | |
| 709 | 672 | if (fd < 0) |
| 710 | 673 | return -1; |
| 674 | + | |
| 675 | + type = dso->symtab_type; | |
| 711 | 676 | } else { |
| 712 | 677 | fd = open(name, O_RDONLY); |
| 713 | 678 | if (fd < 0) { |
| @@ -1562,10 +1562,6 @@ int dso__load(struct dso *dso, struct map *map) · 1561 unmodified lines | ||
| 1562 | 1562 | if (!runtime_ss && syms_ss) |
| 1563 | 1563 | runtime_ss = syms_ss; |
| 1564 | 1564 | |
| 1565 | − if (syms_ss && syms_ss->type == DSO_BINARY_TYPE__BUILD_ID_CACHE) | |
| 1566 | − if (dso__build_id_is_kmod(dso, name, PATH_MAX)) | |
| 1567 | − kmod = true; | |
| 1568 | − | |
| 1569 | 1565 | if (syms_ss) |
| 1570 | 1566 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); |
| 1571 | 1567 | else |
| @@ -39,6 +39,14 @@ static int __report_module(struct addr_location *al, u64 ip, · 38 unmodified lines | ||
| 39 | 39 | return 0; |
| 40 | 40 | |
| 41 | 41 | mod = dwfl_addrmodule(ui->dwfl, ip); |
| 42 | + if (mod) { | |
| 43 | + Dwarf_Addr s; | |
| 44 | + | |
| 45 | + dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL); | |
| 46 | + if (s != al->map->start) | |
| 47 | + mod = 0; | |
| 48 | + } | |
| 49 | + | |
| 42 | 50 | if (!mod) |
| 43 | 51 | mod = dwfl_report_elf(ui->dwfl, dso->short_name, |
| 44 | 52 | dso->long_name, -1, al->map->start, |
| @@ -224,7 +232,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, · 179 unmodified lines | ||
| 224 | 232 | |
| 225 | 233 | err = dwfl_getthread_frames(ui->dwfl, thread->tid, frame_callback, ui); |
| 226 | 234 | |
| 227 | − if (err && !ui->max_stack) | |
| 235 | + if (err && ui->max_stack != max_stack) | |
| 228 | 236 | err = 0; |
| 229 | 237 | |
| 230 | 238 | /* |
| @@ -1,23 +1,42 @@ | ||
| 1 | 1 | #ifndef __BPF_ENDIAN__ |
| 2 | 2 | #define __BPF_ENDIAN__ |
| 3 | 3 | |
| 4 | −#include <asm/byteorder.h> | |
| 4 | +#include <linux/swab.h> | |
| 5 | 5 | |
| 6 | −#if __BYTE_ORDER == __LITTLE_ENDIAN | |
| 7 | −# define __bpf_ntohs(x) __builtin_bswap16(x) | |
| 8 | −# define __bpf_htons(x) __builtin_bswap16(x) | |
| 9 | −#elif __BYTE_ORDER == __BIG_ENDIAN | |
| 10 | −# define __bpf_ntohs(x) (x) | |
| 11 | −# define __bpf_htons(x) (x) | |
| 6 | +/* LLVM's BPF target selects the endianness of the CPU | |
| 7 | + * it compiles on, or the user specifies (bpfel/bpfeb), | |
| 8 | + * respectively. The used __BYTE_ORDER__ is defined by | |
| 9 | + * the compiler, we cannot rely on __BYTE_ORDER from | |
| 10 | + * libc headers, since it doesn't reflect the actual | |
| 11 | + * requested byte order. | |
| 12 | + * | |
| 13 | + * Note, LLVM's BPF target has different __builtin_bswapX() | |
| 14 | + * semantics. It does map to BPF_ALU | BPF_END | BPF_TO_BE | |
| 15 | + * in bpfel and bpfeb case, which means below, that we map | |
| 16 | + * to cpu_to_be16(). We could use it unconditionally in BPF | |
| 17 | + * case, but better not rely on it, so that this header here | |
| 18 | + * can be used from application and BPF program side, which | |
| 19 | + * use different targets. | |
| 20 | + */ | |
| 21 | +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | |
| 22 | +# define __bpf_ntohs(x) __builtin_bswap16(x) | |
| 23 | +# define __bpf_htons(x) __builtin_bswap16(x) | |
| 24 | +# define __bpf_constant_ntohs(x) ___constant_swab16(x) | |
| 25 | +# define __bpf_constant_htons(x) ___constant_swab16(x) | |
| 26 | +#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | |
| 27 | +# define __bpf_ntohs(x) (x) | |
| 28 | +# define __bpf_htons(x) (x) | |
| 29 | +# define __bpf_constant_ntohs(x) (x) | |
| 30 | +# define __bpf_constant_htons(x) (x) | |
| 12 | 31 | #else |
| 13 | −# error "Fix your __BYTE_ORDER?!" | |
| 32 | +# error "Fix your compiler's __BYTE_ORDER__?!" | |
| 14 | 33 | #endif |
| 15 | 34 | |
| 16 | 35 | #define bpf_htons(x) \ |
| 17 | 36 | (__builtin_constant_p(x) ? \ |
| 18 | − __constant_htons(x) : __bpf_htons(x)) | |
| 37 | + __bpf_constant_htons(x) : __bpf_htons(x)) | |
| 19 | 38 | #define bpf_ntohs(x) \ |
| 20 | 39 | (__builtin_constant_p(x) ? \ |
| 21 | − __constant_ntohs(x) : __bpf_ntohs(x)) | |
| 40 | + __bpf_constant_ntohs(x) : __bpf_ntohs(x)) | |
| 22 | 41 | |
| 23 | −#endif | |
| 42 | +#endif /* __BPF_ENDIAN__ */ | |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <asm/kvm_hyp.h> |
| 23 | 23 | |
| 24 | 24 | #define vtr_to_max_lr_idx(v) ((v) & 0xf) |
| 25 | −#define vtr_to_nr_pre_bits(v) (((u32)(v) >> 26) + 1) | |
| 25 | +#define vtr_to_nr_pre_bits(v) ((((u32)(v) >> 26) & 7) + 1) | |
| 26 | 26 | |
| 27 | 27 | static u64 __hyp_text __gic_v3_get_lr(unsigned int lr) |
| 28 | 28 | { |
| @@ -879,6 +879,9 @@ static pmd_t *stage2_get_pmd(struct kvm *kvm, struct kvm_mmu_memory_cache *cache · 878 unmodified lines | ||
| 879 | 879 | pmd_t *pmd; |
| 880 | 880 | |
| 881 | 881 | pud = stage2_get_pud(kvm, cache, addr); |
| 882 | + if (!pud) | |
| 883 | + return NULL; | |
| 884 | + | |
| 882 | 885 | if (stage2_pud_none(*pud)) { |
| 883 | 886 | if (!cache) |
| 884 | 887 | return NULL; |
| @@ -226,7 +226,13 @@ static unsigned long vgic_mmio_read_vcpuif(struct kvm_vcpu *vcpu, · 225 unmodified lines | ||
| 226 | 226 | |
| 227 | 227 | switch (addr & 0xff) { |
| 228 | 228 | case GIC_CPU_CTRL: |
| 229 | − val = vmcr.ctlr; | |
| 229 | + val = vmcr.grpen0 << GIC_CPU_CTRL_EnableGrp0_SHIFT; | |
| 230 | + val |= vmcr.grpen1 << GIC_CPU_CTRL_EnableGrp1_SHIFT; | |
| 231 | + val |= vmcr.ackctl << GIC_CPU_CTRL_AckCtl_SHIFT; | |
| 232 | + val |= vmcr.fiqen << GIC_CPU_CTRL_FIQEn_SHIFT; | |
| 233 | + val |= vmcr.cbpr << GIC_CPU_CTRL_CBPR_SHIFT; | |
| 234 | + val |= vmcr.eoim << GIC_CPU_CTRL_EOImodeNS_SHIFT; | |
| 235 | + | |
| 230 | 236 | break; |
| 231 | 237 | case GIC_CPU_PRIMASK: |
| 232 | 238 | /* |
| @@ -267,7 +273,13 @@ static void vgic_mmio_write_vcpuif(struct kvm_vcpu *vcpu, · 34 unmodified lines | ||
| 267 | 273 | |
| 268 | 274 | switch (addr & 0xff) { |
| 269 | 275 | case GIC_CPU_CTRL: |
| 270 | − vmcr.ctlr = val; | |
| 276 | + vmcr.grpen0 = !!(val & GIC_CPU_CTRL_EnableGrp0); | |
| 277 | + vmcr.grpen1 = !!(val & GIC_CPU_CTRL_EnableGrp1); | |
| 278 | + vmcr.ackctl = !!(val & GIC_CPU_CTRL_AckCtl); | |
| 279 | + vmcr.fiqen = !!(val & GIC_CPU_CTRL_FIQEn); | |
| 280 | + vmcr.cbpr = !!(val & GIC_CPU_CTRL_CBPR); | |
| 281 | + vmcr.eoim = !!(val & GIC_CPU_CTRL_EOImodeNS); | |
| 282 | + | |
| 271 | 283 | break; |
| 272 | 284 | case GIC_CPU_PRIMASK: |
| 273 | 285 | /* |
| @@ -177,7 +177,18 @@ void vgic_v2_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp) · 176 unmodified lines | ||
| 177 | 177 | struct vgic_v2_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v2; |
| 178 | 178 | u32 vmcr; |
| 179 | 179 | |
| 180 | − vmcr = (vmcrp->ctlr << GICH_VMCR_CTRL_SHIFT) & GICH_VMCR_CTRL_MASK; | |
| 180 | + vmcr = (vmcrp->grpen0 << GICH_VMCR_ENABLE_GRP0_SHIFT) & | |
| 181 | + GICH_VMCR_ENABLE_GRP0_MASK; | |
| 182 | + vmcr |= (vmcrp->grpen1 << GICH_VMCR_ENABLE_GRP1_SHIFT) & | |
| 183 | + GICH_VMCR_ENABLE_GRP1_MASK; | |
| 184 | + vmcr |= (vmcrp->ackctl << GICH_VMCR_ACK_CTL_SHIFT) & | |
| 185 | + GICH_VMCR_ACK_CTL_MASK; | |
| 186 | + vmcr |= (vmcrp->fiqen << GICH_VMCR_FIQ_EN_SHIFT) & | |
| 187 | + GICH_VMCR_FIQ_EN_MASK; | |
| 188 | + vmcr |= (vmcrp->cbpr << GICH_VMCR_CBPR_SHIFT) & | |
| 189 | + GICH_VMCR_CBPR_MASK; | |
| 190 | + vmcr |= (vmcrp->eoim << GICH_VMCR_EOI_MODE_SHIFT) & | |
| 191 | + GICH_VMCR_EOI_MODE_MASK; | |
| 181 | 192 | vmcr |= (vmcrp->abpr << GICH_VMCR_ALIAS_BINPOINT_SHIFT) & |
| 182 | 193 | GICH_VMCR_ALIAS_BINPOINT_MASK; |
| 183 | 194 | vmcr |= (vmcrp->bpr << GICH_VMCR_BINPOINT_SHIFT) & |
| @@ -195,8 +206,19 @@ void vgic_v2_get_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp) · 11 unmodified lines | ||
| 195 | 206 | |
| 196 | 207 | vmcr = cpu_if->vgic_vmcr; |
| 197 | 208 | |
| 198 | − vmcrp->ctlr = (vmcr & GICH_VMCR_CTRL_MASK) >> | |
| 199 | − GICH_VMCR_CTRL_SHIFT; | |
| 209 | + vmcrp->grpen0 = (vmcr & GICH_VMCR_ENABLE_GRP0_MASK) >> | |
| 210 | + GICH_VMCR_ENABLE_GRP0_SHIFT; | |
| 211 | + vmcrp->grpen1 = (vmcr & GICH_VMCR_ENABLE_GRP1_MASK) >> | |
| 212 | + GICH_VMCR_ENABLE_GRP1_SHIFT; | |
| 213 | + vmcrp->ackctl = (vmcr & GICH_VMCR_ACK_CTL_MASK) >> | |
| 214 | + GICH_VMCR_ACK_CTL_SHIFT; | |
| 215 | + vmcrp->fiqen = (vmcr & GICH_VMCR_FIQ_EN_MASK) >> | |
| 216 | + GICH_VMCR_FIQ_EN_SHIFT; | |
| 217 | + vmcrp->cbpr = (vmcr & GICH_VMCR_CBPR_MASK) >> | |
| 218 | + GICH_VMCR_CBPR_SHIFT; | |
| 219 | + vmcrp->eoim = (vmcr & GICH_VMCR_EOI_MODE_MASK) >> | |
| 220 | + GICH_VMCR_EOI_MODE_SHIFT; | |
| 221 | + | |
| 200 | 222 | vmcrp->abpr = (vmcr & GICH_VMCR_ALIAS_BINPOINT_MASK) >> |
| 201 | 223 | GICH_VMCR_ALIAS_BINPOINT_SHIFT; |
| 202 | 224 | vmcrp->bpr = (vmcr & GICH_VMCR_BINPOINT_MASK) >> |
| @@ -159,15 +159,24 @@ void vgic_v3_clear_lr(struct kvm_vcpu *vcpu, int lr) · 158 unmodified lines | ||
| 159 | 159 | void vgic_v3_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp) |
| 160 | 160 | { |
| 161 | 161 | struct vgic_v3_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v3; |
| 162 | + u32 model = vcpu->kvm->arch.vgic.vgic_model; | |
| 162 | 163 | u32 vmcr; |
| 163 | 164 | |
| 164 | − /* | |
| 165 | − * Ignore the FIQen bit, because GIC emulation always implies | |
| 166 | − * SRE=1 which means the vFIQEn bit is also RES1. | |
| 167 | − */ | |
| 168 | − vmcr = ((vmcrp->ctlr >> ICC_CTLR_EL1_EOImode_SHIFT) << | |
| 169 | − ICH_VMCR_EOIM_SHIFT) & ICH_VMCR_EOIM_MASK; | |
| 170 | − vmcr |= (vmcrp->ctlr << ICH_VMCR_CBPR_SHIFT) & ICH_VMCR_CBPR_MASK; | |
| 165 | + if (model == KVM_DEV_TYPE_ARM_VGIC_V2) { | |
| 166 | + vmcr = (vmcrp->ackctl << ICH_VMCR_ACK_CTL_SHIFT) & | |
| 167 | + ICH_VMCR_ACK_CTL_MASK; | |
| 168 | + vmcr |= (vmcrp->fiqen << ICH_VMCR_FIQ_EN_SHIFT) & | |
| 169 | + ICH_VMCR_FIQ_EN_MASK; | |
| 170 | + } else { | |
| 171 | + /* | |
| 172 | + * When emulating GICv3 on GICv3 with SRE=1 on the | |
| 173 | + * VFIQEn bit is RES1 and the VAckCtl bit is RES0. | |
| 174 | + */ | |
| 175 | + vmcr = ICH_VMCR_FIQ_EN_MASK; | |
| 176 | + } | |
| 177 | + | |
| 178 | + vmcr |= (vmcrp->cbpr << ICH_VMCR_CBPR_SHIFT) & ICH_VMCR_CBPR_MASK; | |
| 179 | + vmcr |= (vmcrp->eoim << ICH_VMCR_EOIM_SHIFT) & ICH_VMCR_EOIM_MASK; | |
| 171 | 180 | vmcr |= (vmcrp->abpr << ICH_VMCR_BPR1_SHIFT) & ICH_VMCR_BPR1_MASK; |
| 172 | 181 | vmcr |= (vmcrp->bpr << ICH_VMCR_BPR0_SHIFT) & ICH_VMCR_BPR0_MASK; |
| 173 | 182 | vmcr |= (vmcrp->pmr << ICH_VMCR_PMR_SHIFT) & ICH_VMCR_PMR_MASK; |
| @@ -180,17 +189,27 @@ void vgic_v3_set_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp) · 6 unmodified lines | ||
| 180 | 189 | void vgic_v3_get_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp) |
| 181 | 190 | { |
| 182 | 191 | struct vgic_v3_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v3; |
| 192 | + u32 model = vcpu->kvm->arch.vgic.vgic_model; | |
| 183 | 193 | u32 vmcr; |
| 184 | 194 | |
| 185 | 195 | vmcr = cpu_if->vgic_vmcr; |
| 186 | 196 | |
| 187 | − /* | |
| 188 | − * Ignore the FIQen bit, because GIC emulation always implies | |
| 189 | − * SRE=1 which means the vFIQEn bit is also RES1. | |
| 190 | − */ | |
| 191 | − vmcrp->ctlr = ((vmcr >> ICH_VMCR_EOIM_SHIFT) << | |
| 192 | − ICC_CTLR_EL1_EOImode_SHIFT) & ICC_CTLR_EL1_EOImode_MASK; | |
| 193 | − vmcrp->ctlr |= (vmcr & ICH_VMCR_CBPR_MASK) >> ICH_VMCR_CBPR_SHIFT; | |
| 197 | + if (model == KVM_DEV_TYPE_ARM_VGIC_V2) { | |
| 198 | + vmcrp->ackctl = (vmcr & ICH_VMCR_ACK_CTL_MASK) >> | |
| 199 | + ICH_VMCR_ACK_CTL_SHIFT; | |
| 200 | + vmcrp->fiqen = (vmcr & ICH_VMCR_FIQ_EN_MASK) >> | |
| 201 | + ICH_VMCR_FIQ_EN_SHIFT; | |
| 202 | + } else { | |
| 203 | + /* | |
| 204 | + * When emulating GICv3 on GICv3 with SRE=1 on the | |
| 205 | + * VFIQEn bit is RES1 and the VAckCtl bit is RES0. | |
| 206 | + */ | |
| 207 | + vmcrp->fiqen = 1; | |
| 208 | + vmcrp->ackctl = 0; | |
| 209 | + } | |
| 210 | + | |
| 211 | + vmcrp->cbpr = (vmcr & ICH_VMCR_CBPR_MASK) >> ICH_VMCR_CBPR_SHIFT; | |
| 212 | + vmcrp->eoim = (vmcr & ICH_VMCR_EOIM_MASK) >> ICH_VMCR_EOIM_SHIFT; | |
| 194 | 213 | vmcrp->abpr = (vmcr & ICH_VMCR_BPR1_MASK) >> ICH_VMCR_BPR1_SHIFT; |
| 195 | 214 | vmcrp->bpr = (vmcr & ICH_VMCR_BPR0_MASK) >> ICH_VMCR_BPR0_SHIFT; |
| 196 | 215 | vmcrp->pmr = (vmcr & ICH_VMCR_PMR_MASK) >> ICH_VMCR_PMR_SHIFT; |
| @@ -111,14 +111,18 @@ static inline bool irq_is_pending(struct vgic_irq *irq) · 110 unmodified lines | ||
| 111 | 111 | * registers regardless of the hardware backed GIC used. |
| 112 | 112 | */ |
| 113 | 113 | struct vgic_vmcr { |
| 114 | − u32 ctlr; | |
| 114 | + u32 grpen0; | |
| 115 | + u32 grpen1; | |
| 116 | + | |
| 117 | + u32 ackctl; | |
| 118 | + u32 fiqen; | |
| 119 | + u32 cbpr; | |
| 120 | + u32 eoim; | |
| 121 | + | |
| 115 | 122 | u32 abpr; |
| 116 | 123 | u32 bpr; |
| 117 | 124 | u32 pmr; /* Priority mask field in the GICC_PMR and |
| 118 | 125 | * ICC_PMR_EL1 priority field format */ |
| 119 | − /* Below member variable are valid only for GICv3 */ | |
| 120 | − u32 grpen0; | |
| 121 | − u32 grpen1; | |
| 122 | 126 | }; |
| 123 | 127 | |
| 124 | 128 | struct vgic_reg_attr { |