Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'sched/urgent' into x86/mm, to pick up dependent fix

Andy will need the following scheduler fix for the PCID series:

252d2a4117bc: sched/core: Idle_task_exit() shouldn't use switch_mm_irqs_off()

So do a cross-merge.

Signed-off-by: Ingo Molnar <mingo@kernel.org>

+2722 -1568
+9
Documentation/admin-guide/kernel-parameters.txt
··· 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
+4
Documentation/devicetree/bindings/net/dsa/marvell.txt
··· 26 26 - interrupt-controller : Indicates the switch is itself an interrupt 27 27 controller. This is used for the PHY interrupts. 28 28 #interrupt-cells = <2> : Controller uses two cells, number and flag 29 + - eeprom-length : Set to the length of an EEPROM connected to the 30 + switch. Must be set if the switch can not detect 31 + the presence and/or size of a connected EEPROM, 32 + otherwise optional. 29 33 - mdio : Container of PHY and devices on the switches MDIO 30 34 bus. 31 35 - mdio? : Container of PHYs and devices on the external MDIO
+194
Documentation/networking/dpaa.txt
··· 1 + The QorIQ DPAA Ethernet Driver 2 + ============================== 3 + 4 + Authors: 5 + Madalin Bucur <madalin.bucur@nxp.com> 6 + Camelia Groza <camelia.groza@nxp.com> 7 + 8 + Contents 9 + ======== 10 + 11 + - DPAA Ethernet Overview 12 + - DPAA Ethernet Supported SoCs 13 + - Configuring DPAA Ethernet in your kernel 14 + - DPAA Ethernet Frame Processing 15 + - DPAA Ethernet Features 16 + - Debugging 17 + 18 + DPAA Ethernet Overview 19 + ====================== 20 + 21 + DPAA stands for Data Path Acceleration Architecture and it is a 22 + set of networking acceleration IPs that are available on several 23 + generations of SoCs, both on PowerPC and ARM64. 24 + 25 + The Freescale DPAA architecture consists of a series of hardware blocks 26 + that support Ethernet connectivity. The Ethernet driver depends upon the 27 + following drivers in the Linux kernel: 28 + 29 + - Peripheral Access Memory Unit (PAMU) (* needed only for PPC platforms) 30 + drivers/iommu/fsl_* 31 + - Frame Manager (FMan) 32 + drivers/net/ethernet/freescale/fman 33 + - Queue Manager (QMan), Buffer Manager (BMan) 34 + drivers/soc/fsl/qbman 35 + 36 + A simplified view of the dpaa_eth interfaces mapped to FMan MACs: 37 + 38 + dpaa_eth /eth0\ ... /ethN\ 39 + driver | | | | 40 + ------------- ---- ----------- ---- ------------- 41 + -Ports / Tx Rx \ ... / Tx Rx \ 42 + FMan | | | | 43 + -MACs | MAC0 | | MACN | 44 + / dtsec0 \ ... / dtsecN \ (or tgec) 45 + / \ / \(or memac) 46 + --------- -------------- --- -------------- --------- 47 + FMan, FMan Port, FMan SP, FMan MURAM drivers 48 + --------------------------------------------------------- 49 + FMan HW blocks: MURAM, MACs, Ports, SP 50 + --------------------------------------------------------- 51 + 52 + The dpaa_eth relation to the QMan, BMan and FMan: 53 + ________________________________ 54 + dpaa_eth / eth0 \ 55 + driver / \ 56 + --------- -^- -^- -^- --- --------- 57 + QMan driver / \ / \ / \ \ / | BMan | 58 + |Rx | |Rx | |Tx | |Tx | | driver | 59 + --------- |Dfl| |Err| |Cnf| |FQs| | | 60 + QMan HW |FQ | |FQ | |FQs| | | | | 61 + / \ / \ / \ \ / | | 62 + --------- --- --- --- -v- --------- 63 + | FMan QMI | | 64 + | FMan HW FMan BMI | BMan HW | 65 + ----------------------- -------- 66 + 67 + where the acronyms used above (and in the code) are: 68 + DPAA = Data Path Acceleration Architecture 69 + FMan = DPAA Frame Manager 70 + QMan = DPAA Queue Manager 71 + BMan = DPAA Buffers Manager 72 + QMI = QMan interface in FMan 73 + BMI = BMan interface in FMan 74 + FMan SP = FMan Storage Profiles 75 + MURAM = Multi-user RAM in FMan 76 + FQ = QMan Frame Queue 77 + Rx Dfl FQ = default reception FQ 78 + Rx Err FQ = Rx error frames FQ 79 + Tx Cnf FQ = Tx confirmation FQs 80 + Tx FQs = transmission frame queues 81 + dtsec = datapath three speed Ethernet controller (10/100/1000 Mbps) 82 + tgec = ten gigabit Ethernet controller (10 Gbps) 83 + memac = multirate Ethernet MAC (10/100/1000/10000) 84 + 85 + DPAA Ethernet Supported SoCs 86 + ============================ 87 + 88 + The DPAA drivers enable the Ethernet controllers present on the following SoCs: 89 + 90 + # PPC 91 + P1023 92 + P2041 93 + P3041 94 + P4080 95 + P5020 96 + P5040 97 + T1023 98 + T1024 99 + T1040 100 + T1042 101 + T2080 102 + T4240 103 + B4860 104 + 105 + # ARM 106 + LS1043A 107 + LS1046A 108 + 109 + Configuring DPAA Ethernet in your kernel 110 + ======================================== 111 + 112 + To enable the DPAA Ethernet driver, the following Kconfig options are required: 113 + 114 + # common for arch/arm64 and arch/powerpc platforms 115 + CONFIG_FSL_DPAA=y 116 + CONFIG_FSL_FMAN=y 117 + CONFIG_FSL_DPAA_ETH=y 118 + CONFIG_FSL_XGMAC_MDIO=y 119 + 120 + # for arch/powerpc only 121 + CONFIG_FSL_PAMU=y 122 + 123 + # common options needed for the PHYs used on the RDBs 124 + CONFIG_VITESSE_PHY=y 125 + CONFIG_REALTEK_PHY=y 126 + CONFIG_AQUANTIA_PHY=y 127 + 128 + DPAA Ethernet Frame Processing 129 + ============================== 130 + 131 + On Rx, buffers for the incoming frames are retrieved from one of the three 132 + existing buffers pools. The driver initializes and seeds these, each with 133 + buffers of different sizes: 1KB, 2KB and 4KB. 134 + 135 + On Tx, all transmitted frames are returned to the driver through Tx 136 + confirmation frame queues. The driver is then responsible for freeing the 137 + buffers. In order to do this properly, a backpointer is added to the buffer 138 + before transmission that points to the skb. When the buffer returns to the 139 + driver on a confirmation FQ, the skb can be correctly consumed. 140 + 141 + DPAA Ethernet Features 142 + ====================== 143 + 144 + Currently the DPAA Ethernet driver enables the basic features required for 145 + a Linux Ethernet driver. The support for advanced features will be added 146 + gradually. 147 + 148 + The driver has Rx and Tx checksum offloading for UDP and TCP. Currently the Rx 149 + checksum offload feature is enabled by default and cannot be controlled through 150 + ethtool. 151 + 152 + The driver has support for multiple prioritized Tx traffic classes. Priorities 153 + range from 0 (lowest) to 3 (highest). These are mapped to HW workqueues with 154 + strict priority levels. Each traffic class contains NR_CPU TX queues. By 155 + default, only one traffic class is enabled and the lowest priority Tx queues 156 + are used. Higher priority traffic classes can be enabled with the mqprio 157 + qdisc. For example, all four traffic classes are enabled on an interface with 158 + the following command. Furthermore, skb priority levels are mapped to traffic 159 + classes as follows: 160 + 161 + * priorities 0 to 3 - traffic class 0 (low priority) 162 + * priorities 4 to 7 - traffic class 1 (medium-low priority) 163 + * priorities 8 to 11 - traffic class 2 (medium-high priority) 164 + * priorities 12 to 15 - traffic class 3 (high priority) 165 + 166 + tc qdisc add dev <int> root handle 1: \ 167 + mqprio num_tc 4 map 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 hw 1 168 + 169 + Debugging 170 + ========= 171 + 172 + The following statistics are exported for each interface through ethtool: 173 + 174 + - interrupt count per CPU 175 + - Rx packets count per CPU 176 + - Tx packets count per CPU 177 + - Tx confirmed packets count per CPU 178 + - Tx S/G frames count per CPU 179 + - Tx error count per CPU 180 + - Rx error count per CPU 181 + - Rx error count per type 182 + - congestion related statistics: 183 + - congestion status 184 + - time spent in congestion 185 + - number of time the device entered congestion 186 + - dropped packets count per cause 187 + 188 + The driver also exports the following information in sysfs: 189 + 190 + - the FQ IDs for each FQ type 191 + /sys/devices/platform/dpaa-ethernet.0/net/<int>/fqids 192 + 193 + - the IDs of the buffer pools in use 194 + /sys/devices/platform/dpaa-ethernet.0/net/<int>/bpids
+13 -18
Documentation/networking/tcp.txt
··· 1 1 TCP protocol 2 2 ============ 3 3 4 - Last updated: 9 February 2008 4 + Last updated: 3 June 2017 5 5 6 6 Contents 7 7 ======== ··· 29 29 A congestion control mechanism can be registered through functions in 30 30 tcp_cong.c. The functions used by the congestion control mechanism are 31 31 registered via passing a tcp_congestion_ops struct to 32 - tcp_register_congestion_control. As a minimum name, ssthresh, 33 - cong_avoid must be valid. 32 + tcp_register_congestion_control. As a minimum, the congestion control 33 + mechanism must provide a valid name and must implement either ssthresh, 34 + cong_avoid and undo_cwnd hooks or the "omnipotent" cong_control hook. 34 35 35 36 Private data for a congestion control mechanism is stored in tp->ca_priv. 36 37 tcp_ca(tp) returns a pointer to this space. This is preallocated space - it 37 38 is important to check the size of your private data will fit this space, or 38 - alternatively space could be allocated elsewhere and a pointer to it could 39 + alternatively, space could be allocated elsewhere and a pointer to it could 39 40 be stored here. 40 41 41 42 There are three kinds of congestion control algorithms currently: The 42 43 simplest ones are derived from TCP reno (highspeed, scalable) and just 43 - provide an alternative the congestion window calculation. More complex 44 + provide an alternative congestion window calculation. More complex 44 45 ones like BIC try to look at other events to provide better 45 46 heuristics. There are also round trip time based algorithms like 46 47 Vegas and Westwood+. ··· 50 49 needs to maintain fairness and performance. Please review current 51 50 research and RFC's before developing new modules. 52 51 53 - The method that is used to determine which congestion control mechanism is 54 - determined by the setting of the sysctl net.ipv4.tcp_congestion_control. 55 - The default congestion control will be the last one registered (LIFO); 56 - so if you built everything as modules, the default will be reno. If you 57 - build with the defaults from Kconfig, then CUBIC will be builtin (not a 58 - module) and it will end up the default. 52 + The default congestion control mechanism is chosen based on the 53 + DEFAULT_TCP_CONG Kconfig parameter. If you really want a particular default 54 + value then you can set it using sysctl net.ipv4.tcp_congestion_control. The 55 + module will be autoloaded if needed and you will get the expected protocol. If 56 + you ask for an unknown congestion method, then the sysctl attempt will fail. 59 57 60 - If you really want a particular default value then you will need 61 - to set it with the sysctl. If you use a sysctl, the module will be autoloaded 62 - if needed and you will get the expected protocol. If you ask for an 63 - unknown congestion method, then the sysctl attempt will fail. 64 - 65 - If you remove a tcp congestion control module, then you will get the next 58 + If you remove a TCP congestion control module, then you will get the next 66 59 available one. Since reno cannot be built as a module, and cannot be 67 - deleted, it will always be available. 60 + removed, it will always be available. 68 61 69 62 How the new TCP output machine [nyi] works. 70 63 ===========================================
+13 -13
MAINTAINERS
··· 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 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> ··· 1723 1721 ARM/SAMSUNG EXYNOS ARM ARCHITECTURES 1724 1722 M: Kukjin Kim <kgene@kernel.org> 1725 1723 M: Krzysztof Kozlowski <krzk@kernel.org> 1726 - R: Javier Martinez Canillas <javier@osg.samsung.com> 1727 1724 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1728 1725 L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) 1729 1726 Q: https://patchwork.kernel.org/project/linux-samsung-soc/list/ ··· 1830 1829 ARM/STI ARCHITECTURE 1831 1830 M: Patrice Chotard <patrice.chotard@st.com> 1832 1831 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1833 - L: kernel@stlinux.com 1834 1832 W: http://www.stlinux.com 1835 1833 S: Maintained 1836 1834 F: arch/arm/mach-sti/ ··· 7707 7707 7708 7708 LIVE PATCHING 7709 7709 M: Josh Poimboeuf <jpoimboe@redhat.com> 7710 - M: Jessica Yu <jeyu@redhat.com> 7710 + M: Jessica Yu <jeyu@kernel.org> 7711 7711 M: Jiri Kosina <jikos@kernel.org> 7712 7712 M: Miroslav Benes <mbenes@suse.cz> 7713 7713 R: Petr Mladek <pmladek@suse.com> ··· 8508 8508 F: drivers/media/radio/radio-miropcm20* 8509 8509 8510 8510 MELLANOX MLX4 core VPI driver 8511 - M: Yishai Hadas <yishaih@mellanox.com> 8511 + M: Tariq Toukan <tariqt@mellanox.com> 8512 8512 L: netdev@vger.kernel.org 8513 8513 L: linux-rdma@vger.kernel.org 8514 8514 W: http://www.mellanox.com ··· 8516 8516 S: Supported 8517 8517 F: drivers/net/ethernet/mellanox/mlx4/ 8518 8518 F: include/linux/mlx4/ 8519 - F: include/uapi/rdma/mlx4-abi.h 8520 8519 8521 8520 MELLANOX MLX4 IB driver 8522 8521 M: Yishai Hadas <yishaih@mellanox.com> ··· 8525 8526 S: Supported 8526 8527 F: drivers/infiniband/hw/mlx4/ 8527 8528 F: include/linux/mlx4/ 8529 + F: include/uapi/rdma/mlx4-abi.h 8528 8530 8529 8531 MELLANOX MLX5 core VPI driver 8530 8532 M: Saeed Mahameed <saeedm@mellanox.com> ··· 8538 8538 S: Supported 8539 8539 F: drivers/net/ethernet/mellanox/mlx5/core/ 8540 8540 F: include/linux/mlx5/ 8541 - F: include/uapi/rdma/mlx5-abi.h 8542 8541 8543 8542 MELLANOX MLX5 IB driver 8544 8543 M: Matan Barak <matanb@mellanox.com> ··· 8548 8549 S: Supported 8549 8550 F: drivers/infiniband/hw/mlx5/ 8550 8551 F: include/linux/mlx5/ 8552 + F: include/uapi/rdma/mlx5-abi.h 8551 8553 8552 8554 MELEXIS MLX90614 DRIVER 8553 8555 M: Crt Mori <cmo@melexis.com> ··· 8588 8588 F: drivers/media/dvb-frontends/mn88473* 8589 8589 8590 8590 MODULE SUPPORT 8591 - M: Jessica Yu <jeyu@redhat.com> 8591 + M: Jessica Yu <jeyu@kernel.org> 8592 8592 M: Rusty Russell <rusty@rustcorp.com.au> 8593 8593 T: git git://git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git modules-next 8594 8594 S: Maintained ··· 11268 11268 11269 11269 STI CEC DRIVER 11270 11270 M: Benjamin Gaignard <benjamin.gaignard@linaro.org> 11271 - L: kernel@stlinux.com 11272 11271 S: Maintained 11273 11272 F: drivers/staging/media/st-cec/ 11274 11273 F: Documentation/devicetree/bindings/media/stih-cec.txt ··· 11777 11778 S: Supported 11778 11779 F: arch/arm/mach-davinci/ 11779 11780 F: drivers/i2c/busses/i2c-davinci.c 11781 + F: arch/arm/boot/dts/da850* 11780 11782 11781 11783 TI DAVINCI SERIES MEDIA DRIVER 11782 11784 M: "Lad, Prabhakar" <prabhakar.csengg@gmail.com> ··· 13861 13861 F: drivers/net/wireless/wl3501* 13862 13862 13863 13863 WOLFSON MICROELECTRONICS DRIVERS 13864 - L: patches@opensource.wolfsonmicro.com 13864 + L: patches@opensource.cirrus.com 13865 13865 T: git https://github.com/CirrusLogic/linux-drivers.git 13866 13866 W: https://github.com/CirrusLogic/linux-drivers/wiki 13867 13867 S: Supported
+1 -3
arch/arm/boot/compressed/efi-header.S
··· 17 17 @ there. 18 18 .inst 'M' | ('Z' << 8) | (0x1310 << 16) @ tstne r0, #0x4d000 19 19 #else 20 - mov r0, r0 20 + W(mov) r0, r0 21 21 #endif 22 22 .endm 23 23 24 24 .macro __EFI_HEADER 25 25 #ifdef CONFIG_EFI_STUB 26 - b __efi_start 27 - 28 26 .set start_offset, __efi_start - start 29 27 .org start + 0x3c 30 28 @
+10 -7
arch/arm/boot/compressed/head.S
··· 130 130 .rept 7 131 131 __nop 132 132 .endr 133 - ARM( mov r0, r0 ) 134 - ARM( b 1f ) 135 - THUMB( badr r12, 1f ) 136 - THUMB( bx r12 ) 133 + #ifndef CONFIG_THUMB2_KERNEL 134 + mov r0, r0 135 + #else 136 + AR_CLASS( sub pc, pc, #3 ) @ A/R: switch to Thumb2 mode 137 + M_CLASS( nop.w ) @ M: already in Thumb2 mode 138 + .thumb 139 + #endif 140 + W(b) 1f 137 141 138 142 .word _magic_sig @ Magic numbers to help the loader 139 143 .word _magic_start @ absolute load/run zImage address 140 144 .word _magic_end @ zImage end address 141 145 .word 0x04030201 @ endianness flag 142 146 143 - THUMB( .thumb ) 144 - 1: __EFI_HEADER 145 - 147 + __EFI_HEADER 148 + 1: 146 149 ARM_BE8( setend be ) @ go BE8 if compiled for BE8 147 150 AR_CLASS( mrs r9, cpsr ) 148 151 #ifdef CONFIG_ARM_VIRT_EXT
+5
arch/arm/boot/dts/bcm283x.dtsi
··· 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.
+6
arch/arm/boot/dts/imx6ul-14x14-evk.dts
··· 120 120 121 121 ethphy0: ethernet-phy@2 { 122 122 reg = <2>; 123 + micrel,led-mode = <1>; 124 + clocks = <&clks IMX6UL_CLK_ENET_REF>; 125 + clock-names = "rmii-ref"; 123 126 }; 124 127 125 128 ethphy1: ethernet-phy@1 { 126 129 reg = <1>; 130 + micrel,led-mode = <1>; 131 + clocks = <&clks IMX6UL_CLK_ENET2_REF>; 132 + clock-names = "rmii-ref"; 127 133 }; 128 134 }; 129 135 };
+2 -2
arch/arm/boot/dts/keystone-k2l-netcp.dtsi
··· 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>,
+8
arch/arm/boot/dts/keystone-k2l.dtsi
··· 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 -1
arch/arm/boot/dts/versatile-pb.dts
··· 1 - #include <versatile-ab.dts> 1 + #include "versatile-ab.dts" 2 2 3 3 / { 4 4 model = "ARM Versatile PB";
+3 -3
arch/arm/common/mcpm_entry.c
··· 235 235 return ret; 236 236 } 237 237 238 - typedef void (*phys_reset_t)(unsigned long); 238 + typedef typeof(cpu_reset) phys_reset_t; 239 239 240 240 void mcpm_cpu_power_down(void) 241 241 { ··· 300 300 * on the CPU. 301 301 */ 302 302 phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset); 303 - phys_reset(__pa_symbol(mcpm_entry_point)); 303 + phys_reset(__pa_symbol(mcpm_entry_point), false); 304 304 305 305 /* should never get here */ 306 306 BUG(); ··· 389 389 __mcpm_cpu_down(cpu, cluster); 390 390 391 391 phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset); 392 - phys_reset(__pa_symbol(mcpm_entry_point)); 392 + phys_reset(__pa_symbol(mcpm_entry_point), false); 393 393 BUG(); 394 394 } 395 395
+2 -1
arch/arm/include/asm/device.h
··· 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;
+1
arch/arm/include/asm/pgtable-nommu.h
··· 66 66 #define pgprot_noncached(prot) (prot) 67 67 #define pgprot_writecombine(prot) (prot) 68 68 #define pgprot_dmacoherent(prot) (prot) 69 + #define pgprot_device(prot) (prot) 69 70 70 71 71 72 /*
+1
arch/arm/mach-at91/Kconfig
··· 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
+6 -1
arch/arm/mach-davinci/pm.c
··· 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, ··· 162 161 163 162 suspend_set_ops(&davinci_pm_ops); 164 163 164 + return 0; 165 + 166 + no_sram_mem: 167 + iounmap(pm_config.ddrpsc_reg_base); 165 168 no_ddrpsc_mem: 166 169 iounmap(pm_config.ddrpll_reg_base); 167 170 no_ddrpll_mem:
+14 -15
arch/arm/mm/dma-mapping.c
··· 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 ··· 2331 2324 iommu_detach_device(mapping->domain, dev); 2332 2325 kref_put(&mapping->kref, release_iommu_mapping); 2333 2326 to_dma_iommu_mapping(dev) = NULL; 2327 + set_dma_ops(dev, NULL); 2334 2328 2335 2329 pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev)); 2336 - } 2337 - 2338 - /** 2339 - * arm_iommu_detach_device 2340 - * @dev: valid struct device pointer 2341 - * 2342 - * Detaches the provided device from a previously attached map. 2343 - * This voids the dma operations (dma_map_ops pointer) 2344 - */ 2345 - void arm_iommu_detach_device(struct device *dev) 2346 - { 2347 - __arm_iommu_detach_device(dev); 2348 - set_dma_ops(dev, NULL); 2349 2330 } 2350 2331 EXPORT_SYMBOL_GPL(arm_iommu_detach_device); 2351 2332 ··· 2374 2379 if (!mapping) 2375 2380 return; 2376 2381 2377 - __arm_iommu_detach_device(dev); 2382 + arm_iommu_detach_device(dev); 2378 2383 arm_iommu_release_mapping(mapping); 2379 2384 } 2380 2385 ··· 2425 2430 dev->dma_ops = xen_dma_ops; 2426 2431 } 2427 2432 #endif 2433 + dev->archdata.dma_ops_setup = true; 2428 2434 } 2429 2435 2430 2436 void arch_teardown_dma_ops(struct device *dev) 2431 2437 { 2438 + if (!dev->archdata.dma_ops_setup) 2439 + return; 2440 + 2432 2441 arm_teardown_iommu_dma_ops(dev); 2433 2442 }
+1 -2
arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi
··· 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>,
+1 -2
arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi
··· 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>,
+10
arch/arm64/configs/defconfig
··· 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 208 CONFIG_WL18XX=m 210 209 CONFIG_WLCORE_SDIO=m 211 210 CONFIG_INPUT_EVDEV=y 211 + CONFIG_KEYBOARD_ADC=m 212 + CONFIG_KEYBOARD_CROS_EC=y 212 213 CONFIG_KEYBOARD_GPIO=y 213 214 CONFIG_INPUT_MISC=y 214 215 CONFIG_INPUT_PM8941_PWRKEY=y ··· 266 263 CONFIG_SPI_ORION=y 267 264 CONFIG_SPI_PL022=y 268 265 CONFIG_SPI_QUP=y 266 + CONFIG_SPI_ROCKCHIP=y 269 267 CONFIG_SPI_S3C64XX=y 270 268 CONFIG_SPI_SPIDEV=m 271 269 CONFIG_SPMI=y ··· 296 292 CONFIG_CPU_THERMAL=y 297 293 CONFIG_THERMAL_EMULATION=y 298 294 CONFIG_EXYNOS_THERMAL=y 295 + CONFIG_ROCKCHIP_THERMAL=m 299 296 CONFIG_WATCHDOG=y 300 297 CONFIG_S3C2410_WATCHDOG=y 301 298 CONFIG_MESON_GXBB_WATCHDOG=m ··· 305 300 CONFIG_BCM2835_WDT=y 306 301 CONFIG_MFD_CROS_EC=y 307 302 CONFIG_MFD_CROS_EC_I2C=y 303 + CONFIG_MFD_CROS_EC_SPI=y 308 304 CONFIG_MFD_EXYNOS_LPASS=m 309 305 CONFIG_MFD_HI655X_PMIC=y 310 306 CONFIG_MFD_MAX77620=y 311 307 CONFIG_MFD_SPMI_PMIC=y 312 308 CONFIG_MFD_RK808=y 313 309 CONFIG_MFD_SEC_CORE=y 310 + CONFIG_REGULATOR_FAN53555=y 314 311 CONFIG_REGULATOR_FIXED_VOLTAGE=y 315 312 CONFIG_REGULATOR_GPIO=y 316 313 CONFIG_REGULATOR_HI655X=y ··· 480 473 CONFIG_EXTCON_USB_GPIO=y 481 474 CONFIG_IIO=y 482 475 CONFIG_EXYNOS_ADC=y 476 + CONFIG_ROCKCHIP_SARADC=m 483 477 CONFIG_PWM=y 484 478 CONFIG_PWM_BCM2835=m 479 + CONFIG_PWM_CROS_EC=m 485 480 CONFIG_PWM_MESON=m 486 481 CONFIG_PWM_ROCKCHIP=y 487 482 CONFIG_PWM_SAMSUNG=y ··· 493 484 CONFIG_PHY_SUN4I_USB=y 494 485 CONFIG_PHY_ROCKCHIP_INNO_USB2=y 495 486 CONFIG_PHY_ROCKCHIP_EMMC=y 487 + CONFIG_PHY_ROCKCHIP_PCIE=m 496 488 CONFIG_PHY_XGENE=y 497 489 CONFIG_PHY_TEGRA_XUSB=y 498 490 CONFIG_ARM_SCPI_PROTOCOL=y
-16
arch/powerpc/Kconfig
··· 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
+1 -1
arch/powerpc/include/asm/book3s/64/hash-4k.h
··· 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)
+1 -2
arch/powerpc/include/asm/cputable.h
··· 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__ ··· 462 463 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ 463 464 CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ 464 465 CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \ 465 - CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP | CPU_FTR_SUBCORE) 466 + CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP) 466 467 #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG) 467 468 #define CPU_FTRS_POWER8_DD1 (CPU_FTRS_POWER8 & ~CPU_FTR_DBELL) 468 469 #define CPU_FTRS_POWER9 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
+12 -13
arch/powerpc/include/asm/processor.h
··· 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 /* ··· 137 132 * space during mmap's. 138 133 */ 139 134 #define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4)) 140 - #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_128TB / 4)) 135 + #define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4)) 141 136 142 137 #define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \ 143 138 TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 ) ··· 148 143 * with 128TB and conditionally enable upto 512TB 149 144 */ 150 145 #ifdef CONFIG_PPC_BOOK3S_64 151 - #define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \ 152 - TASK_SIZE_USER32 : TASK_SIZE_128TB) 146 + #define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \ 147 + TASK_SIZE_USER32 : DEFAULT_MAP_WINDOW_USER64) 153 148 #else 154 149 #define DEFAULT_MAP_WINDOW TASK_SIZE 155 150 #endif 156 151 157 152 #ifdef __powerpc64__ 158 153 159 - #ifdef CONFIG_PPC_BOOK3S_64 160 - /* Limit stack to 128TB */ 161 - #define STACK_TOP_USER64 TASK_SIZE_128TB 162 - #else 163 - #define STACK_TOP_USER64 TASK_SIZE_USER64 164 - #endif 165 - 154 + #define STACK_TOP_USER64 DEFAULT_MAP_WINDOW_USER64 166 155 #define STACK_TOP_USER32 TASK_SIZE_USER32 167 156 168 157 #define STACK_TOP (is_32bit_task() ? \
+14
arch/powerpc/include/asm/topology.h
··· 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 60 + 61 + static inline int early_cpu_to_node(int cpu) { return 0; } 48 62 49 63 static inline void dump_numa_cpu_topology(void) {} 50 64
+48 -10
arch/powerpc/kernel/dt_cpu_ftrs.c
··· 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> ··· 643 642 {"processor-control-facility", feat_enable_dbell, CPU_FTR_DBELL}, 644 643 {"processor-control-facility-v3", feat_enable_dbell, CPU_FTR_DBELL}, 645 644 {"processor-utilization-of-resources-register", feat_enable_purr, 0}, 646 - {"subcore", feat_enable, CPU_FTR_SUBCORE}, 647 645 {"no-execute", feat_enable, 0}, 648 646 {"strong-access-ordering", feat_enable, CPU_FTR_SAO}, 649 647 {"cache-inhibited-large-page", feat_enable_large_ci, 0}, ··· 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 { ··· 719 707 } 720 708 } 721 709 722 - if (!known && CPU_FEATURE_ENABLE_UNKNOWN) { 710 + if (!known && enable_unknown) { 723 711 if (!feat_try_enable_unknown(f)) { 724 712 pr_info("not enabling: %s (unknown and unsupported by kernel)\n", 725 713 f->name); ··· 768 756 cur_cpu_spec->cpu_features, cur_cpu_spec->mmu_features); 769 757 } 770 758 759 + static int __init disabled_on_cmdline(void) 760 + { 761 + unsigned long root, chosen; 762 + const char *p; 763 + 764 + root = of_get_flat_dt_root(); 765 + chosen = of_get_flat_dt_subnode_by_name(root, "chosen"); 766 + if (chosen == -FDT_ERR_NOTFOUND) 767 + return false; 768 + 769 + p = of_get_flat_dt_prop(chosen, "bootargs", NULL); 770 + if (!p) 771 + return false; 772 + 773 + if (strstr(p, "dt_cpu_ftrs=off")) 774 + return true; 775 + 776 + return false; 777 + } 778 + 771 779 static int __init fdt_find_cpu_features(unsigned long node, const char *uname, 772 780 int depth, void *data) 773 781 { ··· 798 766 return 0; 799 767 } 800 768 801 - static bool __initdata using_dt_cpu_ftrs = false; 802 - 803 769 bool __init dt_cpu_ftrs_in_use(void) 804 770 { 805 771 return using_dt_cpu_ftrs; ··· 805 775 806 776 bool __init dt_cpu_ftrs_init(void *fdt) 807 777 { 778 + using_dt_cpu_ftrs = false; 779 + 808 780 /* Setup and verify the FDT, if it fails we just bail */ 809 781 if (!early_init_dt_verify(fdt)) 810 782 return false; 811 783 812 784 if (!of_scan_flat_dt(fdt_find_cpu_features, NULL)) 785 + return false; 786 + 787 + if (disabled_on_cmdline()) 813 788 return false; 814 789 815 790 cpufeatures_setup_cpu(); ··· 1062 1027 1063 1028 void __init dt_cpu_ftrs_scan(void) 1064 1029 { 1030 + if (!using_dt_cpu_ftrs) 1031 + return; 1032 + 1065 1033 of_scan_flat_dt(dt_cpu_ftrs_scan_callback, NULL); 1066 1034 }
+3
arch/powerpc/kernel/process.c
··· 1666 1666 #ifdef CONFIG_VSX 1667 1667 current->thread.used_vsr = 0; 1668 1668 #endif 1669 + current->thread.load_fp = 0; 1669 1670 memset(&current->thread.fp_state, 0, sizeof(current->thread.fp_state)); 1670 1671 current->thread.fp_save_area = NULL; 1671 1672 #ifdef CONFIG_ALTIVEC ··· 1675 1674 current->thread.vr_save_area = NULL; 1676 1675 current->thread.vrsave = 0; 1677 1676 current->thread.used_vr = 0; 1677 + current->thread.load_vec = 0; 1678 1678 #endif /* CONFIG_ALTIVEC */ 1679 1679 #ifdef CONFIG_SPE 1680 1680 memset(current->thread.evr, 0, sizeof(current->thread.evr)); ··· 1687 1685 current->thread.tm_tfhar = 0; 1688 1686 current->thread.tm_texasr = 0; 1689 1687 current->thread.tm_tfiar = 0; 1688 + current->thread.load_tm = 0; 1690 1689 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 1691 1690 } 1692 1691 EXPORT_SYMBOL(start_thread);
+1 -1
arch/powerpc/kernel/setup-common.c
··· 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
+2 -2
arch/powerpc/kernel/setup_64.c
··· 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 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;
+1 -1
arch/powerpc/mm/mmu_context_book3s64.c
··· 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
+2 -2
arch/powerpc/perf/power9-pmu.c
··· 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 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,
+11
arch/powerpc/platforms/Kconfig
··· 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
+2
arch/powerpc/platforms/cell/spufs/coredump.c
··· 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;
+7 -1
arch/powerpc/platforms/powernv/subcore.c
··· 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 /*
+2
arch/powerpc/platforms/pseries/hotplug-memory.c
··· 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 ··· 148 147 for (i = 0; i < num_lmbs; i++) { 149 148 lmbs[i].base_addr = cpu_to_be64(lmbs[i].base_addr); 150 149 lmbs[i].drc_index = cpu_to_be32(lmbs[i].drc_index); 150 + lmbs[i].aa_index = cpu_to_be32(lmbs[i].aa_index); 151 151 lmbs[i].flags = cpu_to_be32(lmbs[i].flags); 152 152 } 153 153
+2 -1
arch/powerpc/sysdev/simple_gpio.c
··· 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 }
+8 -4
arch/sparc/Kconfig
··· 192 192 int "Maximum number of CPUs" 193 193 depends on SMP 194 194 range 2 32 if SPARC32 195 - range 2 1024 if SPARC64 195 + range 2 4096 if SPARC64 196 196 default 32 if SPARC32 197 - default 64 if SPARC64 197 + default 4096 if SPARC64 198 198 199 199 source kernel/Kconfig.hz 200 200 ··· 295 295 depends on SPARC64 && SMP 296 296 297 297 config NODES_SHIFT 298 - int 299 - default "4" 298 + int "Maximum NUMA Nodes (as a power of 2)" 299 + range 4 5 if SPARC64 300 + default "5" 300 301 depends on NEED_MULTIPLE_NODES 302 + help 303 + Specify the maximum number of NUMA Nodes available on the target 304 + system. Increases memory reserved to accommodate various tables. 301 305 302 306 # Some NUMA nodes have memory ranges that span 303 307 # other nodes. Even though a pfn is valid and
+1 -1
arch/sparc/include/asm/mmu_64.h
··· 52 52 #define CTX_NR_MASK TAG_CONTEXT_BITS 53 53 #define CTX_HW_MASK (CTX_NR_MASK | CTX_PGSZ_MASK) 54 54 55 - #define CTX_FIRST_VERSION ((_AC(1,UL) << CTX_VERSION_SHIFT) + _AC(1,UL)) 55 + #define CTX_FIRST_VERSION BIT(CTX_VERSION_SHIFT) 56 56 #define CTX_VALID(__ctx) \ 57 57 (!(((__ctx.sparc64_ctx_val) ^ tlb_context_cache) & CTX_VERSION_MASK)) 58 58 #define CTX_HWBITS(__ctx) ((__ctx.sparc64_ctx_val) & CTX_HW_MASK)
+4 -28
arch/sparc/include/asm/mmu_context_64.h
··· 19 19 extern unsigned long tlb_context_cache; 20 20 extern unsigned long mmu_context_bmap[]; 21 21 22 + DECLARE_PER_CPU(struct mm_struct *, per_cpu_secondary_mm); 22 23 void get_new_mmu_context(struct mm_struct *mm); 23 - #ifdef CONFIG_SMP 24 - void smp_new_mmu_context_version(void); 25 - #else 26 - #define smp_new_mmu_context_version() do { } while (0) 27 - #endif 28 - 29 24 int init_new_context(struct task_struct *tsk, struct mm_struct *mm); 30 25 void destroy_context(struct mm_struct *mm); 31 26 ··· 71 76 static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk) 72 77 { 73 78 unsigned long ctx_valid, flags; 74 - int cpu; 79 + int cpu = smp_processor_id(); 75 80 81 + per_cpu(per_cpu_secondary_mm, cpu) = mm; 76 82 if (unlikely(mm == &init_mm)) 77 83 return; 78 84 ··· 119 123 * for the first time, we must flush that context out of the 120 124 * local TLB. 121 125 */ 122 - cpu = smp_processor_id(); 123 126 if (!ctx_valid || !cpumask_test_cpu(cpu, mm_cpumask(mm))) { 124 127 cpumask_set_cpu(cpu, mm_cpumask(mm)); 125 128 __flush_tlb_mm(CTX_HWBITS(mm->context), ··· 128 133 } 129 134 130 135 #define deactivate_mm(tsk,mm) do { } while (0) 131 - 132 - /* Activate a new MM instance for the current task. */ 133 - static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm) 134 - { 135 - unsigned long flags; 136 - int cpu; 137 - 138 - spin_lock_irqsave(&mm->context.lock, flags); 139 - if (!CTX_VALID(mm->context)) 140 - get_new_mmu_context(mm); 141 - cpu = smp_processor_id(); 142 - if (!cpumask_test_cpu(cpu, mm_cpumask(mm))) 143 - cpumask_set_cpu(cpu, mm_cpumask(mm)); 144 - 145 - load_secondary_context(mm); 146 - __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT); 147 - tsb_context_switch(mm); 148 - spin_unlock_irqrestore(&mm->context.lock, flags); 149 - } 150 - 136 + #define activate_mm(active_mm, mm) switch_mm(active_mm, mm, NULL) 151 137 #endif /* !(__ASSEMBLY__) */ 152 138 153 139 #endif /* !(__SPARC64_MMU_CONTEXT_H) */
-1
arch/sparc/include/asm/pil.h
··· 20 20 #define PIL_SMP_CALL_FUNC 1 21 21 #define PIL_SMP_RECEIVE_SIGNAL 2 22 22 #define PIL_SMP_CAPTURE 3 23 - #define PIL_SMP_CTX_NEW_VERSION 4 24 23 #define PIL_DEVICE_IRQ 5 25 24 #define PIL_SMP_CALL_FUNC_SNGL 6 26 25 #define PIL_DEFERRED_PCR_WORK 7
+1
arch/sparc/include/asm/vio.h
··· 327 327 int compat_len; 328 328 329 329 u64 dev_no; 330 + u64 id; 330 331 331 332 unsigned long channel_id; 332 333
+1 -1
arch/sparc/kernel/ds.c
··· 909 909 pbuf.req.handle = cp->handle; 910 910 pbuf.req.major = 1; 911 911 pbuf.req.minor = 0; 912 - strcpy(pbuf.req.svc_id, cp->service_id); 912 + strcpy(pbuf.id_buf, cp->service_id); 913 913 914 914 err = __ds_send(lp, &pbuf, msg_len); 915 915 if (err > 0)
+13 -4
arch/sparc/kernel/irq_64.c
··· 1034 1034 { 1035 1035 #ifdef CONFIG_SMP 1036 1036 unsigned long page; 1037 + void *mondo, *p; 1037 1038 1038 - BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > (PAGE_SIZE - 64)); 1039 + BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > PAGE_SIZE); 1040 + 1041 + /* Make sure mondo block is 64byte aligned */ 1042 + p = kzalloc(127, GFP_KERNEL); 1043 + if (!p) { 1044 + prom_printf("SUN4V: Error, cannot allocate mondo block.\n"); 1045 + prom_halt(); 1046 + } 1047 + mondo = (void *)(((unsigned long)p + 63) & ~0x3f); 1048 + tb->cpu_mondo_block_pa = __pa(mondo); 1039 1049 1040 1050 page = get_zeroed_page(GFP_KERNEL); 1041 1051 if (!page) { 1042 - prom_printf("SUN4V: Error, cannot allocate cpu mondo page.\n"); 1052 + prom_printf("SUN4V: Error, cannot allocate cpu list page.\n"); 1043 1053 prom_halt(); 1044 1054 } 1045 1055 1046 - tb->cpu_mondo_block_pa = __pa(page); 1047 - tb->cpu_list_pa = __pa(page + 64); 1056 + tb->cpu_list_pa = __pa(page); 1048 1057 #endif 1049 1058 } 1050 1059
-1
arch/sparc/kernel/kernel.h
··· 37 37 /* smp_64.c */ 38 38 void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs); 39 39 void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs); 40 - void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs); 41 40 void __irq_entry smp_penguin_jailcell(int irq, struct pt_regs *regs); 42 41 void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs); 43 42
-31
arch/sparc/kernel/smp_64.c
··· 964 964 preempt_enable(); 965 965 } 966 966 967 - void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs) 968 - { 969 - struct mm_struct *mm; 970 - unsigned long flags; 971 - 972 - clear_softint(1 << irq); 973 - 974 - /* See if we need to allocate a new TLB context because 975 - * the version of the one we are using is now out of date. 976 - */ 977 - mm = current->active_mm; 978 - if (unlikely(!mm || (mm == &init_mm))) 979 - return; 980 - 981 - spin_lock_irqsave(&mm->context.lock, flags); 982 - 983 - if (unlikely(!CTX_VALID(mm->context))) 984 - get_new_mmu_context(mm); 985 - 986 - spin_unlock_irqrestore(&mm->context.lock, flags); 987 - 988 - load_secondary_context(mm); 989 - __flush_tlb_mm(CTX_HWBITS(mm->context), 990 - SECONDARY_CONTEXT); 991 - } 992 - 993 - void smp_new_mmu_context_version(void) 994 - { 995 - smp_cross_call(&xcall_new_mmu_context_version, 0, 0, 0); 996 - } 997 - 998 967 #ifdef CONFIG_KGDB 999 968 void kgdb_roundup_cpus(unsigned long flags) 1000 969 {
+7 -4
arch/sparc/kernel/tsb.S
··· 455 455 .type copy_tsb,#function 456 456 copy_tsb: /* %o0=old_tsb_base, %o1=old_tsb_size 457 457 * %o2=new_tsb_base, %o3=new_tsb_size 458 + * %o4=page_size_shift 458 459 */ 459 460 sethi %uhi(TSB_PASS_BITS), %g7 460 461 srlx %o3, 4, %o3 461 - add %o0, %o1, %g1 /* end of old tsb */ 462 + add %o0, %o1, %o1 /* end of old tsb */ 462 463 sllx %g7, 32, %g7 463 464 sub %o3, 1, %o3 /* %o3 == new tsb hash mask */ 465 + 466 + mov %o4, %g1 /* page_size_shift */ 464 467 465 468 661: prefetcha [%o0] ASI_N, #one_read 466 469 .section .tsb_phys_patch, "ax" ··· 489 486 /* This can definitely be computed faster... */ 490 487 srlx %o0, 4, %o5 /* Build index */ 491 488 and %o5, 511, %o5 /* Mask index */ 492 - sllx %o5, PAGE_SHIFT, %o5 /* Put into vaddr position */ 489 + sllx %o5, %g1, %o5 /* Put into vaddr position */ 493 490 or %o4, %o5, %o4 /* Full VADDR. */ 494 - srlx %o4, PAGE_SHIFT, %o4 /* Shift down to create index */ 491 + srlx %o4, %g1, %o4 /* Shift down to create index */ 495 492 and %o4, %o3, %o4 /* Mask with new_tsb_nents-1 */ 496 493 sllx %o4, 4, %o4 /* Shift back up into tsb ent offset */ 497 494 TSB_STORE(%o2 + %o4, %g2) /* Store TAG */ ··· 499 496 TSB_STORE(%o2 + %o4, %g3) /* Store TTE */ 500 497 501 498 80: add %o0, 16, %o0 502 - cmp %o0, %g1 499 + cmp %o0, %o1 503 500 bne,pt %xcc, 90b 504 501 nop 505 502
+1 -1
arch/sparc/kernel/ttable_64.S
··· 50 50 tl0_irq1: TRAP_IRQ(smp_call_function_client, 1) 51 51 tl0_irq2: TRAP_IRQ(smp_receive_signal_client, 2) 52 52 tl0_irq3: TRAP_IRQ(smp_penguin_jailcell, 3) 53 - tl0_irq4: TRAP_IRQ(smp_new_mmu_context_version_client, 4) 53 + tl0_irq4: BTRAP(0x44) 54 54 #else 55 55 tl0_irq1: BTRAP(0x41) 56 56 tl0_irq2: BTRAP(0x42)
+64 -4
arch/sparc/kernel/vio.c
··· 302 302 if (!id) { 303 303 dev_set_name(&vdev->dev, "%s", bus_id_name); 304 304 vdev->dev_no = ~(u64)0; 305 + vdev->id = ~(u64)0; 305 306 } else if (!cfg_handle) { 306 307 dev_set_name(&vdev->dev, "%s-%llu", bus_id_name, *id); 307 308 vdev->dev_no = *id; 309 + vdev->id = ~(u64)0; 308 310 } else { 309 311 dev_set_name(&vdev->dev, "%s-%llu-%llu", bus_id_name, 310 312 *cfg_handle, *id); 311 313 vdev->dev_no = *cfg_handle; 314 + vdev->id = *id; 312 315 } 313 316 314 317 vdev->dev.parent = parent; ··· 354 351 (void) vio_create_one(hp, node, &root_vdev->dev); 355 352 } 356 353 354 + struct vio_md_node_query { 355 + const char *type; 356 + u64 dev_no; 357 + u64 id; 358 + }; 359 + 357 360 static int vio_md_node_match(struct device *dev, void *arg) 358 361 { 362 + struct vio_md_node_query *query = (struct vio_md_node_query *) arg; 359 363 struct vio_dev *vdev = to_vio_dev(dev); 360 364 361 - if (vdev->mp == (u64) arg) 362 - return 1; 365 + if (vdev->dev_no != query->dev_no) 366 + return 0; 367 + if (vdev->id != query->id) 368 + return 0; 369 + if (strcmp(vdev->type, query->type)) 370 + return 0; 363 371 364 - return 0; 372 + return 1; 365 373 } 366 374 367 375 static void vio_remove(struct mdesc_handle *hp, u64 node) 368 376 { 377 + const char *type; 378 + const u64 *id, *cfg_handle; 379 + u64 a; 380 + struct vio_md_node_query query; 369 381 struct device *dev; 370 382 371 - dev = device_find_child(&root_vdev->dev, (void *) node, 383 + type = mdesc_get_property(hp, node, "device-type", NULL); 384 + if (!type) { 385 + type = mdesc_get_property(hp, node, "name", NULL); 386 + if (!type) 387 + type = mdesc_node_name(hp, node); 388 + } 389 + 390 + query.type = type; 391 + 392 + id = mdesc_get_property(hp, node, "id", NULL); 393 + cfg_handle = NULL; 394 + mdesc_for_each_arc(a, hp, node, MDESC_ARC_TYPE_BACK) { 395 + u64 target; 396 + 397 + target = mdesc_arc_target(hp, a); 398 + cfg_handle = mdesc_get_property(hp, target, 399 + "cfg-handle", NULL); 400 + if (cfg_handle) 401 + break; 402 + } 403 + 404 + if (!id) { 405 + query.dev_no = ~(u64)0; 406 + query.id = ~(u64)0; 407 + } else if (!cfg_handle) { 408 + query.dev_no = *id; 409 + query.id = ~(u64)0; 410 + } else { 411 + query.dev_no = *cfg_handle; 412 + query.id = *id; 413 + } 414 + 415 + dev = device_find_child(&root_vdev->dev, &query, 372 416 vio_md_node_match); 373 417 if (dev) { 374 418 printk(KERN_INFO "VIO: Removing device %s\n", dev_name(dev)); 375 419 376 420 device_unregister(dev); 377 421 put_device(dev); 422 + } else { 423 + if (!id) 424 + printk(KERN_ERR "VIO: Removed unknown %s node.\n", 425 + type); 426 + else if (!cfg_handle) 427 + printk(KERN_ERR "VIO: Removed unknown %s node %llu.\n", 428 + type, *id); 429 + else 430 + printk(KERN_ERR "VIO: Removed unknown %s node %llu-%llu.\n", 431 + type, *cfg_handle, *id); 378 432 } 379 433 } 380 434
+1
arch/sparc/lib/Makefile
··· 15 15 lib-$(CONFIG_SPARC64) += atomic_64.o 16 16 lib-$(CONFIG_SPARC32) += lshrdi3.o ashldi3.o 17 17 lib-$(CONFIG_SPARC32) += muldi3.o bitext.o cmpdi2.o 18 + lib-$(CONFIG_SPARC64) += multi3.o 18 19 19 20 lib-$(CONFIG_SPARC64) += copy_page.o clear_page.o bzero.o 20 21 lib-$(CONFIG_SPARC64) += csum_copy.o csum_copy_from_user.o csum_copy_to_user.o
+35
arch/sparc/lib/multi3.S
··· 1 + #include <linux/linkage.h> 2 + #include <asm/export.h> 3 + 4 + .text 5 + .align 4 6 + ENTRY(__multi3) /* %o0 = u, %o1 = v */ 7 + mov %o1, %g1 8 + srl %o3, 0, %g4 9 + mulx %g4, %g1, %o1 10 + srlx %g1, 0x20, %g3 11 + mulx %g3, %g4, %g5 12 + sllx %g5, 0x20, %o5 13 + srl %g1, 0, %g4 14 + sub %o1, %o5, %o5 15 + srlx %o5, 0x20, %o5 16 + addcc %g5, %o5, %g5 17 + srlx %o3, 0x20, %o5 18 + mulx %g4, %o5, %g4 19 + mulx %g3, %o5, %o5 20 + sethi %hi(0x80000000), %g3 21 + addcc %g5, %g4, %g5 22 + srlx %g5, 0x20, %g5 23 + add %g3, %g3, %g3 24 + movcc %xcc, %g0, %g3 25 + addcc %o5, %g5, %o5 26 + sllx %g4, 0x20, %g4 27 + add %o1, %g4, %o1 28 + add %o5, %g3, %g2 29 + mulx %g1, %o2, %g1 30 + add %g1, %g2, %g1 31 + mulx %o0, %o3, %o0 32 + retl 33 + add %g1, %o0, %o0 34 + ENDPROC(__multi3) 35 + EXPORT_SYMBOL(__multi3)
+60 -29
arch/sparc/mm/init_64.c
··· 358 358 } 359 359 360 360 if ((hv_pgsz_mask & cpu_pgsz_mask) == 0U) { 361 - pr_warn("hugepagesz=%llu not supported by MMU.\n", 361 + hugetlb_bad_size(); 362 + pr_err("hugepagesz=%llu not supported by MMU.\n", 362 363 hugepage_size); 363 364 goto out; 364 365 } ··· 707 706 708 707 /* get_new_mmu_context() uses "cache + 1". */ 709 708 DEFINE_SPINLOCK(ctx_alloc_lock); 710 - unsigned long tlb_context_cache = CTX_FIRST_VERSION - 1; 709 + unsigned long tlb_context_cache = CTX_FIRST_VERSION; 711 710 #define MAX_CTX_NR (1UL << CTX_NR_BITS) 712 711 #define CTX_BMAP_SLOTS BITS_TO_LONGS(MAX_CTX_NR) 713 712 DECLARE_BITMAP(mmu_context_bmap, MAX_CTX_NR); 713 + DEFINE_PER_CPU(struct mm_struct *, per_cpu_secondary_mm) = {0}; 714 + 715 + static void mmu_context_wrap(void) 716 + { 717 + unsigned long old_ver = tlb_context_cache & CTX_VERSION_MASK; 718 + unsigned long new_ver, new_ctx, old_ctx; 719 + struct mm_struct *mm; 720 + int cpu; 721 + 722 + bitmap_zero(mmu_context_bmap, 1 << CTX_NR_BITS); 723 + 724 + /* Reserve kernel context */ 725 + set_bit(0, mmu_context_bmap); 726 + 727 + new_ver = (tlb_context_cache & CTX_VERSION_MASK) + CTX_FIRST_VERSION; 728 + if (unlikely(new_ver == 0)) 729 + new_ver = CTX_FIRST_VERSION; 730 + tlb_context_cache = new_ver; 731 + 732 + /* 733 + * Make sure that any new mm that are added into per_cpu_secondary_mm, 734 + * are going to go through get_new_mmu_context() path. 735 + */ 736 + mb(); 737 + 738 + /* 739 + * Updated versions to current on those CPUs that had valid secondary 740 + * contexts 741 + */ 742 + for_each_online_cpu(cpu) { 743 + /* 744 + * If a new mm is stored after we took this mm from the array, 745 + * it will go into get_new_mmu_context() path, because we 746 + * already bumped the version in tlb_context_cache. 747 + */ 748 + mm = per_cpu(per_cpu_secondary_mm, cpu); 749 + 750 + if (unlikely(!mm || mm == &init_mm)) 751 + continue; 752 + 753 + old_ctx = mm->context.sparc64_ctx_val; 754 + if (likely((old_ctx & CTX_VERSION_MASK) == old_ver)) { 755 + new_ctx = (old_ctx & ~CTX_VERSION_MASK) | new_ver; 756 + set_bit(new_ctx & CTX_NR_MASK, mmu_context_bmap); 757 + mm->context.sparc64_ctx_val = new_ctx; 758 + } 759 + } 760 + } 714 761 715 762 /* Caller does TLB context flushing on local CPU if necessary. 716 763 * The caller also ensures that CTX_VALID(mm->context) is false. ··· 774 725 { 775 726 unsigned long ctx, new_ctx; 776 727 unsigned long orig_pgsz_bits; 777 - int new_version; 778 728 779 729 spin_lock(&ctx_alloc_lock); 730 + retry: 731 + /* wrap might have happened, test again if our context became valid */ 732 + if (unlikely(CTX_VALID(mm->context))) 733 + goto out; 780 734 orig_pgsz_bits = (mm->context.sparc64_ctx_val & CTX_PGSZ_MASK); 781 735 ctx = (tlb_context_cache + 1) & CTX_NR_MASK; 782 736 new_ctx = find_next_zero_bit(mmu_context_bmap, 1 << CTX_NR_BITS, ctx); 783 - new_version = 0; 784 737 if (new_ctx >= (1 << CTX_NR_BITS)) { 785 738 new_ctx = find_next_zero_bit(mmu_context_bmap, ctx, 1); 786 739 if (new_ctx >= ctx) { 787 - int i; 788 - new_ctx = (tlb_context_cache & CTX_VERSION_MASK) + 789 - CTX_FIRST_VERSION; 790 - if (new_ctx == 1) 791 - new_ctx = CTX_FIRST_VERSION; 792 - 793 - /* Don't call memset, for 16 entries that's just 794 - * plain silly... 795 - */ 796 - mmu_context_bmap[0] = 3; 797 - mmu_context_bmap[1] = 0; 798 - mmu_context_bmap[2] = 0; 799 - mmu_context_bmap[3] = 0; 800 - for (i = 4; i < CTX_BMAP_SLOTS; i += 4) { 801 - mmu_context_bmap[i + 0] = 0; 802 - mmu_context_bmap[i + 1] = 0; 803 - mmu_context_bmap[i + 2] = 0; 804 - mmu_context_bmap[i + 3] = 0; 805 - } 806 - new_version = 1; 807 - goto out; 740 + mmu_context_wrap(); 741 + goto retry; 808 742 } 809 743 } 744 + if (mm->context.sparc64_ctx_val) 745 + cpumask_clear(mm_cpumask(mm)); 810 746 mmu_context_bmap[new_ctx>>6] |= (1UL << (new_ctx & 63)); 811 747 new_ctx |= (tlb_context_cache & CTX_VERSION_MASK); 812 - out: 813 748 tlb_context_cache = new_ctx; 814 749 mm->context.sparc64_ctx_val = new_ctx | orig_pgsz_bits; 750 + out: 815 751 spin_unlock(&ctx_alloc_lock); 816 - 817 - if (unlikely(new_version)) 818 - smp_new_mmu_context_version(); 819 752 } 820 753 821 754 static int numa_enabled = 1;
+5 -2
arch/sparc/mm/tsb.c
··· 496 496 extern void copy_tsb(unsigned long old_tsb_base, 497 497 unsigned long old_tsb_size, 498 498 unsigned long new_tsb_base, 499 - unsigned long new_tsb_size); 499 + unsigned long new_tsb_size, 500 + unsigned long page_size_shift); 500 501 unsigned long old_tsb_base = (unsigned long) old_tsb; 501 502 unsigned long new_tsb_base = (unsigned long) new_tsb; 502 503 ··· 505 504 old_tsb_base = __pa(old_tsb_base); 506 505 new_tsb_base = __pa(new_tsb_base); 507 506 } 508 - copy_tsb(old_tsb_base, old_size, new_tsb_base, new_size); 507 + copy_tsb(old_tsb_base, old_size, new_tsb_base, new_size, 508 + tsb_index == MM_TSB_BASE ? 509 + PAGE_SHIFT : REAL_HPAGE_SHIFT); 509 510 } 510 511 511 512 mm->context.tsb_block[tsb_index].tsb = new_tsb;
-5
arch/sparc/mm/ultra.S
··· 971 971 wr %g0, (1 << PIL_SMP_CAPTURE), %set_softint 972 972 retry 973 973 974 - .globl xcall_new_mmu_context_version 975 - xcall_new_mmu_context_version: 976 - wr %g0, (1 << PIL_SMP_CTX_NEW_VERSION), %set_softint 977 - retry 978 - 979 974 #ifdef CONFIG_KGDB 980 975 .globl xcall_kgdb_capture 981 976 xcall_kgdb_capture:
+1
arch/x86/kernel/cpu/cyrix.c
··· 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;
+3
arch/x86/kernel/cpu/microcode/intel.c
··· 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
+93 -23
block/bfq-cgroup.c
··· 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 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 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 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, ··· 330 312 if (bfqq) { 331 313 bfqq->ioprio = bfqq->new_ioprio; 332 314 bfqq->ioprio_class = bfqq->new_ioprio_class; 333 - bfqg_get(bfqg); 315 + /* 316 + * Make sure that bfqg and its associated blkg do not 317 + * disappear before entity. 318 + */ 319 + bfqg_and_blkg_get(bfqg); 334 320 } 335 321 entity->parent = bfqg->my_entity; /* NULL for root group */ 336 322 entity->sched_data = &bfqg->sched_data; ··· 421 399 return NULL; 422 400 } 423 401 402 + /* see comments in bfq_bic_update_cgroup for why refcounting */ 403 + bfqg_get(bfqg); 424 404 return &bfqg->pd; 425 405 } 426 406 ··· 450 426 struct bfq_group *bfqg = pd_to_bfqg(pd); 451 427 452 428 bfqg_stats_exit(&bfqg->stats); 453 - return kfree(bfqg); 429 + bfqg_put(bfqg); 454 430 } 455 431 456 432 void bfq_pd_reset_stats(struct blkg_policy_data *pd) ··· 520 496 * Move @bfqq to @bfqg, deactivating it from its old group and reactivating 521 497 * it on the new one. Avoid putting the entity on the old group idle tree. 522 498 * 523 - * Must be called under the queue lock; the cgroup owning @bfqg must 524 - * not disappear (by now this just means that we are called under 525 - * rcu_read_lock()). 499 + * Must be called under the scheduler lock, to make sure that the blkg 500 + * owning @bfqg does not disappear (see comments in 501 + * bfq_bic_update_cgroup on guaranteeing the consistency of blkg 502 + * objects). 526 503 */ 527 504 void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, 528 505 struct bfq_group *bfqg) ··· 544 519 bfq_deactivate_bfqq(bfqd, bfqq, false, false); 545 520 else if (entity->on_st) 546 521 bfq_put_idle_entity(bfq_entity_service_tree(entity), entity); 547 - bfqg_put(bfqq_group(bfqq)); 522 + bfqg_and_blkg_put(bfqq_group(bfqq)); 548 523 549 - /* 550 - * Here we use a reference to bfqg. We don't need a refcounter 551 - * as the cgroup reference will not be dropped, so that its 552 - * destroy() callback will not be invoked. 553 - */ 554 524 entity->parent = bfqg->my_entity; 555 525 entity->sched_data = &bfqg->sched_data; 556 - bfqg_get(bfqg); 526 + /* pin down bfqg and its associated blkg */ 527 + bfqg_and_blkg_get(bfqg); 557 528 558 529 if (bfq_bfqq_busy(bfqq)) { 559 530 bfq_pos_tree_add_move(bfqd, bfqq); ··· 566 545 * @bic: the bic to move. 567 546 * @blkcg: the blk-cgroup to move to. 568 547 * 569 - * Move bic to blkcg, assuming that bfqd->queue is locked; the caller 570 - * has to make sure that the reference to cgroup is valid across the call. 548 + * Move bic to blkcg, assuming that bfqd->lock is held; which makes 549 + * sure that the reference to cgroup is valid across the call (see 550 + * comments in bfq_bic_update_cgroup on this issue) 571 551 * 572 552 * NOTE: an alternative approach might have been to store the current 573 553 * cgroup in bfqq and getting a reference to it, reducing the lookup ··· 626 604 goto out; 627 605 628 606 bfqg = __bfq_bic_change_cgroup(bfqd, bic, bio_blkcg(bio)); 607 + /* 608 + * Update blkg_path for bfq_log_* functions. We cache this 609 + * path, and update it here, for the following 610 + * reasons. Operations on blkg objects in blk-cgroup are 611 + * protected with the request_queue lock, and not with the 612 + * lock that protects the instances of this scheduler 613 + * (bfqd->lock). This exposes BFQ to the following sort of 614 + * race. 615 + * 616 + * The blkg_lookup performed in bfq_get_queue, protected 617 + * through rcu, may happen to return the address of a copy of 618 + * the original blkg. If this is the case, then the 619 + * bfqg_and_blkg_get performed in bfq_get_queue, to pin down 620 + * the blkg, is useless: it does not prevent blk-cgroup code 621 + * from destroying both the original blkg and all objects 622 + * directly or indirectly referred by the copy of the 623 + * blkg. 624 + * 625 + * On the bright side, destroy operations on a blkg invoke, as 626 + * a first step, hooks of the scheduler associated with the 627 + * blkg. And these hooks are executed with bfqd->lock held for 628 + * BFQ. As a consequence, for any blkg associated with the 629 + * request queue this instance of the scheduler is attached 630 + * to, we are guaranteed that such a blkg is not destroyed, and 631 + * that all the pointers it contains are consistent, while we 632 + * are holding bfqd->lock. A blkg_lookup performed with 633 + * bfqd->lock held then returns a fully consistent blkg, which 634 + * remains consistent until this lock is held. 635 + * 636 + * Thanks to the last fact, and to the fact that: (1) bfqg has 637 + * been obtained through a blkg_lookup in the above 638 + * assignment, and (2) bfqd->lock is being held, here we can 639 + * safely use the policy data for the involved blkg (i.e., the 640 + * field bfqg->pd) to get to the blkg associated with bfqg, 641 + * and then we can safely use any field of blkg. After we 642 + * release bfqd->lock, even just getting blkg through this 643 + * bfqg may cause dangling references to be traversed, as 644 + * bfqg->pd may not exist any more. 645 + * 646 + * In view of the above facts, here we cache, in the bfqg, any 647 + * blkg data we may need for this bic, and for its associated 648 + * bfq_queue. As of now, we need to cache only the path of the 649 + * blkg, which is used in the bfq_log_* functions. 650 + * 651 + * Finally, note that bfqg itself needs to be protected from 652 + * destruction on the blkg_free of the original blkg (which 653 + * invokes bfq_pd_free). We use an additional private 654 + * refcounter for bfqg, to let it disappear only after no 655 + * bfq_queue refers to it any longer. 656 + */ 657 + blkg_path(bfqg_to_blkg(bfqg), bfqg->blkg_path, sizeof(bfqg->blkg_path)); 629 658 bic->blkcg_serial_nr = serial_nr; 630 659 out: 631 660 rcu_read_unlock(); ··· 713 640 * @bfqd: the device data structure with the root group. 714 641 * @bfqg: the group to move from. 715 642 * @st: the service tree with the entities. 716 - * 717 - * Needs queue_lock to be taken and reference to be valid over the call. 718 643 */ 719 644 static void bfq_reparent_active_entities(struct bfq_data *bfqd, 720 645 struct bfq_group *bfqg, ··· 763 692 /* 764 693 * The idle tree may still contain bfq_queues belonging 765 694 * to exited task because they never migrated to a different 766 - * cgroup from the one being destroyed now. No one else 767 - * can access them so it's safe to act without any lock. 695 + * cgroup from the one being destroyed now. 768 696 */ 769 697 bfq_flush_idle_tree(st); 770 698
+1 -1
block/bfq-iosched.c
··· 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
+11 -12
block/bfq-iosched.h
··· 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 ··· 844 838 struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg); 845 839 struct bfq_group *bfqq_group(struct bfq_queue *bfqq); 846 840 struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node); 847 - void bfqg_put(struct bfq_group *bfqg); 841 + void bfqg_and_blkg_put(struct bfq_group *bfqg); 848 842 849 843 #ifdef CONFIG_BFQ_GROUP_IOSCHED 850 844 extern struct cftype bfq_blkcg_legacy_files[]; ··· 916 910 struct bfq_group *bfqq_group(struct bfq_queue *bfqq); 917 911 918 912 #define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \ 919 - char __pbuf[128]; \ 920 - \ 921 - blkg_path(bfqg_to_blkg(bfqq_group(bfqq)), __pbuf, sizeof(__pbuf)); \ 922 - blk_add_trace_msg((bfqd)->queue, "bfq%d%c %s " fmt, (bfqq)->pid, \ 913 + blk_add_trace_msg((bfqd)->queue, "bfq%d%c %s " fmt, (bfqq)->pid,\ 923 914 bfq_bfqq_sync((bfqq)) ? 'S' : 'A', \ 924 - __pbuf, ##args); \ 915 + bfqq_group(bfqq)->blkg_path, ##args); \ 925 916 } while (0) 926 917 927 - #define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do { \ 928 - char __pbuf[128]; \ 929 - \ 930 - blkg_path(bfqg_to_blkg(bfqg), __pbuf, sizeof(__pbuf)); \ 931 - blk_add_trace_msg((bfqd)->queue, "%s " fmt, __pbuf, ##args); \ 932 - } while (0) 918 + #define bfq_log_bfqg(bfqd, bfqg, fmt, args...) \ 919 + blk_add_trace_msg((bfqd)->queue, "%s " fmt, (bfqg)->blkg_path, ##args) 933 920 934 921 #else /* CONFIG_BFQ_GROUP_IOSCHED */ 935 922
+3
block/bio-integrity.c
··· 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;
+17 -8
block/blk-mq.c
··· 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); ··· 1506 1500 1507 1501 __blk_mq_requeue_request(rq); 1508 1502 insert: 1509 - blk_mq_sched_insert_request(rq, false, true, false, may_sleep); 1503 + blk_mq_sched_insert_request(rq, false, run_queue, false, may_sleep); 1510 1504 } 1511 1505 1512 1506 static void blk_mq_try_issue_directly(struct blk_mq_hw_ctx *hctx, ··· 1514 1508 { 1515 1509 if (!(hctx->flags & BLK_MQ_F_BLOCKING)) { 1516 1510 rcu_read_lock(); 1517 - __blk_mq_try_issue_directly(rq, cookie, false); 1511 + __blk_mq_try_issue_directly(hctx, rq, cookie, false); 1518 1512 rcu_read_unlock(); 1519 1513 } else { 1520 1514 unsigned int srcu_idx; ··· 1522 1516 might_sleep(); 1523 1517 1524 1518 srcu_idx = srcu_read_lock(&hctx->queue_rq_srcu); 1525 - __blk_mq_try_issue_directly(rq, cookie, true); 1519 + __blk_mq_try_issue_directly(hctx, rq, cookie, true); 1526 1520 srcu_read_unlock(&hctx->queue_rq_srcu, srcu_idx); 1527 1521 } 1528 1522 } ··· 1625 1619 1626 1620 blk_mq_put_ctx(data.ctx); 1627 1621 1628 - if (same_queue_rq) 1622 + if (same_queue_rq) { 1623 + data.hctx = blk_mq_map_queue(q, 1624 + same_queue_rq->mq_ctx->cpu); 1629 1625 blk_mq_try_issue_directly(data.hctx, same_queue_rq, 1630 1626 &cookie); 1627 + } 1631 1628 } else if (q->nr_hw_queues > 1 && is_sync) { 1632 1629 blk_mq_put_ctx(data.ctx); 1633 1630 blk_mq_bio_to_request(rq, bio);
+18 -4
block/blk-throttle.c
··· 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 ··· 219 212 struct avg_latency_bucket avg_buckets[LATENCY_BUCKET_SIZE]; 220 213 struct latency_bucket __percpu *latency_buckets; 221 214 unsigned long last_calculate_time; 215 + unsigned long filtered_latency; 222 216 223 217 bool track_bio_latency; 224 218 }; ··· 706 698 static void throtl_schedule_pending_timer(struct throtl_service_queue *sq, 707 699 unsigned long expires) 708 700 { 709 - unsigned long max_expire = jiffies + 8 * sq_to_tg(sq)->td->throtl_slice; 701 + unsigned long max_expire = jiffies + 8 * sq_to_td(sq)->throtl_slice; 710 702 711 703 /* 712 704 * Since we are adjusting the throttle limit dynamically, the sleep ··· 2289 2281 throtl_track_latency(tg->td, blk_stat_size(&bio->bi_issue_stat), 2290 2282 bio_op(bio), lat); 2291 2283 2292 - if (tg->latency_target) { 2284 + if (tg->latency_target && lat >= tg->td->filtered_latency) { 2293 2285 int bucket; 2294 2286 unsigned int threshold; 2295 2287 ··· 2425 2417 void blk_throtl_register_queue(struct request_queue *q) 2426 2418 { 2427 2419 struct throtl_data *td; 2420 + int i; 2428 2421 2429 2422 td = q->td; 2430 2423 BUG_ON(!td); 2431 2424 2432 - if (blk_queue_nonrot(q)) 2425 + if (blk_queue_nonrot(q)) { 2433 2426 td->throtl_slice = DFL_THROTL_SLICE_SSD; 2434 - else 2427 + td->filtered_latency = LATENCY_FILTERED_SSD; 2428 + } else { 2435 2429 td->throtl_slice = DFL_THROTL_SLICE_HD; 2430 + td->filtered_latency = LATENCY_FILTERED_HD; 2431 + for (i = 0; i < LATENCY_BUCKET_SIZE; i++) 2432 + td->avg_buckets[i].latency = DFL_HD_BASELINE_LATENCY; 2433 + } 2436 2434 #ifndef CONFIG_BLK_DEV_THROTTLING_LOW 2437 2435 /* if no low limit, use previous default */ 2438 2436 td->throtl_slice = DFL_THROTL_SLICE_HD;
+1 -1
crypto/asymmetric_keys/public_key.c
··· 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 }
+2 -3
crypto/drbg.c
··· 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 }
+2 -4
crypto/gcm.c
··· 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)
+14 -8
drivers/acpi/arm64/iort.c
··· 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) ··· 727 735 u32 streamid = 0; 728 736 int err; 729 737 738 + /* 739 + * If we already translated the fwspec there 740 + * is nothing left to do, return the iommu_ops. 741 + */ 742 + ops = iort_fwspec_iommu_ops(dev->iommu_fwspec); 743 + if (ops) 744 + return ops; 745 + 730 746 if (dev_is_pci(dev)) { 731 747 struct pci_bus *bus = to_pci_dev(dev)->bus; 732 748 u32 rid; ··· 781 781 err = iort_add_device_replay(ops, dev); 782 782 if (err) 783 783 ops = ERR_PTR(err); 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 + } 784 790 785 791 return ops; 786 792 }
+1 -1
drivers/acpi/battery.c
··· 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 }
+2 -3
drivers/acpi/button.c
··· 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 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 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
+1 -2
drivers/acpi/device_pm.c
··· 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 ··· 399 400 mutex_lock(&acpi_pm_notifier_lock); 400 401 401 402 if (adev->wakeup.flags.notifier_present) { 402 - pm_wakeup_ws_event(adev->wakeup.ws, 0, true); 403 + __pm_wakeup_event(adev->wakeup.ws, 0); 403 404 if (adev->wakeup.context.work.func) 404 405 queue_pm_work(&adev->wakeup.context.work); 405 406 }
+2 -2
drivers/acpi/scan.c
··· 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 /*
-28
drivers/acpi/sleep.c
··· 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 - } 669 - 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 667 } 693 668 694 669 static void acpi_freeze_restore(void) ··· 671 696 acpi_disable_wakeup_devices(ACPI_STATE_S0); 672 697 if (acpi_sci_irq_valid()) 673 698 disable_irq_wake(acpi_sci_irq); 674 - 675 699 acpi_enable_all_runtime_gpes(); 676 700 } 677 701 ··· 682 708 static const struct platform_freeze_ops acpi_freeze_ops = { 683 709 .begin = acpi_freeze_begin, 684 710 .prepare = acpi_freeze_prepare, 685 - .wake = acpi_freeze_wake, 686 - .sync = acpi_freeze_sync, 687 711 .restore = acpi_freeze_restore, 688 712 .end = acpi_freeze_end, 689 713 };
+38
drivers/ata/ahci.c
··· 1364 1364 {} 1365 1365 #endif 1366 1366 1367 + /* 1368 + * On the Acer Aspire Switch Alpha 12, sometimes all SATA ports are detected 1369 + * as DUMMY, or detected but eventually get a "link down" and never get up 1370 + * again. When this happens, CAP.NP may hold a value of 0x00 or 0x01, and the 1371 + * port_map may hold a value of 0x00. 1372 + * 1373 + * Overriding CAP.NP to 0x02 and the port_map to 0x7 will reveal all 3 ports 1374 + * and can significantly reduce the occurrence of the problem. 1375 + * 1376 + * https://bugzilla.kernel.org/show_bug.cgi?id=189471 1377 + */ 1378 + static void acer_sa5_271_workaround(struct ahci_host_priv *hpriv, 1379 + struct pci_dev *pdev) 1380 + { 1381 + static const struct dmi_system_id sysids[] = { 1382 + { 1383 + .ident = "Acer Switch Alpha 12", 1384 + .matches = { 1385 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 1386 + DMI_MATCH(DMI_PRODUCT_NAME, "Switch SA5-271") 1387 + }, 1388 + }, 1389 + { } 1390 + }; 1391 + 1392 + if (dmi_check_system(sysids)) { 1393 + dev_info(&pdev->dev, "enabling Acer Switch Alpha 12 workaround\n"); 1394 + if ((hpriv->saved_cap & 0xC734FF00) == 0xC734FF00) { 1395 + hpriv->port_map = 0x7; 1396 + hpriv->cap = 0xC734FF02; 1397 + } 1398 + } 1399 + } 1400 + 1367 1401 #ifdef CONFIG_ARM64 1368 1402 /* 1369 1403 * Due to ERRATA#22536, ThunderX needs to handle HOST_IRQ_STAT differently. ··· 1669 1635 dev_info(&pdev->dev, 1670 1636 "online status unreliable, applying workaround\n"); 1671 1637 } 1638 + 1639 + 1640 + /* Acer SA5-271 workaround modifies private_data */ 1641 + acer_sa5_271_workaround(hpriv, pdev); 1672 1642 1673 1643 /* CAP.NP sometimes indicate the index of the last enabled 1674 1644 * port, at other times, that of the last possible port, so
+3 -2
drivers/ata/libahci_platform.c
··· 514 514 515 515 irq = platform_get_irq(pdev, 0); 516 516 if (irq <= 0) { 517 - dev_err(dev, "no irq\n"); 518 - return -EINVAL; 517 + if (irq != -EPROBE_DEFER) 518 + dev_err(dev, "no irq\n"); 519 + return irq; 519 520 } 520 521 521 522 hpriv->irq = irq;
+1 -1
drivers/ata/libata-core.c
··· 6800 6800 } 6801 6801 6802 6802 force_ent->port = simple_strtoul(id, &endp, 10); 6803 - if (p == endp || *endp != '\0') { 6803 + if (id == endp || *endp != '\0') { 6804 6804 *reason = "invalid port/link"; 6805 6805 return -EINVAL; 6806 6806 }
+8 -5
drivers/ata/sata_mv.c
··· 4067 4067 struct ata_host *host; 4068 4068 struct mv_host_priv *hpriv; 4069 4069 struct resource *res; 4070 - void __iomem *mmio; 4071 4070 int n_ports = 0, irq = 0; 4072 4071 int rc; 4073 4072 int port; ··· 4085 4086 * Get the register base first 4086 4087 */ 4087 4088 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 4088 - mmio = devm_ioremap_resource(&pdev->dev, res); 4089 - if (IS_ERR(mmio)) 4090 - return PTR_ERR(mmio); 4089 + if (res == NULL) 4090 + return -EINVAL; 4091 4091 4092 4092 /* allocate host */ 4093 4093 if (pdev->dev.of_node) { ··· 4130 4132 hpriv->board_idx = chip_soc; 4131 4133 4132 4134 host->iomap = NULL; 4133 - hpriv->base = mmio - SATAHC0_REG_BASE; 4135 + hpriv->base = devm_ioremap(&pdev->dev, res->start, 4136 + resource_size(res)); 4137 + if (!hpriv->base) 4138 + return -ENOMEM; 4139 + 4140 + hpriv->base -= SATAHC0_REG_BASE; 4134 4141 4135 4142 hpriv->clk = clk_get(&pdev->dev, NULL); 4136 4143 if (IS_ERR(hpriv->clk))
+12 -3
drivers/ata/sata_rcar.c
··· 890 890 dev_err(&pdev->dev, "failed to get access to sata clock\n"); 891 891 return PTR_ERR(priv->clk); 892 892 } 893 - clk_prepare_enable(priv->clk); 893 + 894 + ret = clk_prepare_enable(priv->clk); 895 + if (ret) 896 + return ret; 894 897 895 898 host = ata_host_alloc(&pdev->dev, 1); 896 899 if (!host) { ··· 973 970 struct ata_host *host = dev_get_drvdata(dev); 974 971 struct sata_rcar_priv *priv = host->private_data; 975 972 void __iomem *base = priv->base; 973 + int ret; 976 974 977 - clk_prepare_enable(priv->clk); 975 + ret = clk_prepare_enable(priv->clk); 976 + if (ret) 977 + return ret; 978 978 979 979 /* ack and mask */ 980 980 iowrite32(0, base + SATAINTSTAT_REG); ··· 994 988 { 995 989 struct ata_host *host = dev_get_drvdata(dev); 996 990 struct sata_rcar_priv *priv = host->private_data; 991 + int ret; 997 992 998 - clk_prepare_enable(priv->clk); 993 + ret = clk_prepare_enable(priv->clk); 994 + if (ret) 995 + return ret; 999 996 1000 997 sata_rcar_setup_port(host); 1001 998
+5
drivers/base/power/main.c
··· 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
+6 -12
drivers/base/power/wakeup.c
··· 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 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) 868 + void pm_wakeup_clear(void) 869 869 { 870 - atomic_dec(&pm_abort_suspend); 871 - } 872 - 873 - void pm_wakeup_clear(bool reset) 874 - { 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)
+3
drivers/block/loop.c
··· 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
+3 -2
drivers/cpufreq/intel_pstate.c
··· 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)
+25 -1
drivers/firmware/efi/efi-bgrt.c
··· 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; ··· 56 36 if (acpi_disabled) 57 37 return; 58 38 59 - if (!efi_enabled(EFI_BOOT)) 39 + if (!efi_enabled(EFI_MEMMAP)) 60 40 return; 61 41 62 42 if (table->length < sizeof(bgrt_tab)) { ··· 85 65 goto out; 86 66 } 87 67 68 + if (!efi_bgrt_addr_valid(bgrt->image_address)) { 69 + pr_notice("Ignoring BGRT: invalid image address\n"); 70 + goto out; 71 + } 88 72 image = early_memremap(bgrt->image_address, sizeof(bmp_header)); 89 73 if (!image) { 90 74 pr_notice("Ignoring BGRT: failed to map image header memory\n");
+11
drivers/gpu/drm/drm_atomic_helper.c
··· 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); ··· 552 550 553 551 for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) { 554 552 const struct drm_connector_helper_funcs *funcs = connector->helper_private; 553 + 554 + WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); 555 555 556 556 /* 557 557 * This only sets crtc->connectors_changed for routing changes, ··· 653 649 654 650 for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { 655 651 const struct drm_plane_helper_funcs *funcs; 652 + 653 + WARN_ON(!drm_modeset_is_locked(&plane->mutex)); 656 654 657 655 funcs = plane->helper_private; 658 656 ··· 2669 2663 2670 2664 drm_modeset_acquire_init(&ctx, 0); 2671 2665 while (1) { 2666 + err = drm_modeset_lock_all_ctx(dev, &ctx); 2667 + if (err) 2668 + goto out; 2669 + 2672 2670 err = drm_atomic_helper_commit_duplicated_state(state, &ctx); 2671 + out: 2673 2672 if (err != -EDEADLK) 2674 2673 break; 2675 2674
+6 -1
drivers/gpu/drm/drm_drv.c
··· 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
+1 -1
drivers/gpu/drm/hisilicon/kirin/dw_drm_dsi.c
··· 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
+9
drivers/gpu/drm/i915/i915_drv.c
··· 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)
+10
drivers/gpu/drm/i915/i915_drv.h
··· 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
+4
drivers/gpu/drm/i915/i915_gem.c
··· 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
+105 -1
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 2191 2191 gen8_set_pte(&gtt_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 { ··· 2880 2785 2881 2786 ggtt->base.insert_entries = gen8_ggtt_insert_entries; 2882 2787 2788 + /* Serialize GTT updates with aperture access on BXT if VT-d is on. */ 2789 + if (intel_ggtt_update_needs_vtd_wa(dev_priv)) { 2790 + ggtt->base.insert_entries = bxt_vtd_ggtt_insert_entries__BKL; 2791 + ggtt->base.insert_page = bxt_vtd_ggtt_insert_page__BKL; 2792 + if (ggtt->base.clear_range != nop_clear_range) 2793 + ggtt->base.clear_range = bxt_vtd_ggtt_clear_range__BKL; 2794 + } 2795 + 2883 2796 ggtt->invalidate = gen6_ggtt_invalidate; 2884 2797 2885 2798 return ggtt_probe_common(ggtt, size); ··· 3100 2997 3101 2998 void i915_ggtt_disable_guc(struct drm_i915_private *i915) 3102 2999 { 3103 - i915->ggtt.invalidate = gen6_ggtt_invalidate; 3000 + if (i915->ggtt.invalidate == guc_ggtt_invalidate) 3001 + i915->ggtt.invalidate = gen6_ggtt_invalidate; 3104 3002 } 3105 3003 3106 3004 void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
+1 -1
drivers/gpu/drm/i915/i915_gem_tiling.c
··· 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 }
+1 -2
drivers/gpu/drm/i915/i915_pci.c
··· 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 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, \
+9
drivers/gpu/drm/i915/intel_display.c
··· 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;
+17 -3
drivers/gpu/drm/i915/intel_engine_cs.c
··· 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 ··· 1100 1084 */ 1101 1085 bool intel_engine_is_idle(struct intel_engine_cs *engine) 1102 1086 { 1103 - struct drm_i915_private *dev_priv = engine->i915; 1104 - 1105 1087 /* Any inflight/incomplete requests? */ 1106 1088 if (!i915_seqno_passed(intel_engine_get_seqno(engine), 1107 1089 intel_engine_last_submit(engine))) ··· 1114 1100 return false; 1115 1101 1116 1102 /* Ring stopped? */ 1117 - if (INTEL_GEN(dev_priv) > 2 && !(I915_READ_MODE(engine) & MODE_IDLE)) 1103 + if (!ring_is_idle(engine)) 1118 1104 return false; 1119 1105 1120 1106 return true;
+7 -12
drivers/gpu/drm/i915/intel_fbc.c
··· 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, ··· 736 746 cache->crtc.hsw_bdw_pixel_rate = crtc_state->pixel_rate; 737 747 738 748 cache->plane.rotation = plane_state->base.rotation; 749 + /* 750 + * Src coordinates are already rotated by 270 degrees for 751 + * the 90/270 degree plane rotation cases (to match the 752 + * GTT mapping), hence no need to account for rotation here. 753 + */ 739 754 cache->plane.src_w = drm_rect_width(&plane_state->base.src) >> 16; 740 755 cache->plane.src_h = drm_rect_height(&plane_state->base.src) >> 16; 741 756 cache->plane.visible = plane_state->base.visible;
+9
drivers/gpu/drm/i915/intel_pm.c
··· 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; 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; 4341 4349 4342 4350 /* 4343 4351 * If this transaction isn't actually touching any CRTC's, don't ··· 4357 4349 */ 4358 4350 for_each_new_crtc_in_state(state, crtc, cstate, i) 4359 4351 changed = true; 4352 + 4360 4353 if (!changed) 4361 4354 return 0; 4362 4355
+3 -2
drivers/gpu/drm/i915/intel_psr.c
··· 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 }
+21
drivers/gpu/drm/i915/intel_sprite.c
··· 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; ··· 141 138 finish_wait(wq, &wait); 142 139 143 140 drm_crtc_vblank_put(&crtc->base); 141 + 142 + /* 143 + * On VLV/CHV DSI the scanline counter would appear to 144 + * increment approx. 1/3 of a scanline before start of vblank. 145 + * The registers still get latched at start of vblank however. 146 + * This means we must not write any registers on the first 147 + * line of vblank (since not the whole line is actually in 148 + * vblank). And unfortunately we can't use the interrupt to 149 + * wait here since it will fire too soon. We could use the 150 + * frame start interrupt instead since it will fire after the 151 + * critical scanline, but that would require more changes 152 + * in the interrupt code. So for now we'll just do the nasty 153 + * thing and poll for the bad scanline to pass us by. 154 + * 155 + * FIXME figure out if BXT+ DSI suffers from this as well 156 + */ 157 + while (need_vlv_dsi_wa && scanline == vblank_start) 158 + scanline = intel_get_crtc_scanline(crtc); 144 159 145 160 crtc->debug.scanline_start = scanline; 146 161 crtc->debug.start_vbl_time = ktime_get();
-2
drivers/gpu/drm/i915/intel_uc.h
··· 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.
+1 -1
drivers/gpu/drm/imx/imx-ldb.c
··· 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 */
+6 -9
drivers/gpu/drm/mediatek/mtk_dsi.c
··· 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> ··· 901 900 902 901 static void mtk_dsi_wait_for_idle(struct mtk_dsi *dsi) 903 902 { 904 - u32 timeout_ms = 500000; /* total 1s ~ 2s timeout */ 903 + int ret; 904 + u32 val; 905 905 906 - while (timeout_ms--) { 907 - if (!(readl(dsi->regs + DSI_INTSTA) & DSI_BUSY)) 908 - break; 909 - 910 - usleep_range(2, 4); 911 - } 912 - 913 - if (timeout_ms == 0) { 906 + ret = readl_poll_timeout(dsi->regs + DSI_INTSTA, val, !(val & DSI_BUSY), 907 + 4, 2000000); 908 + if (ret) { 914 909 DRM_WARN("polling dsi wait not busy timeout!\n"); 915 910 916 911 mtk_dsi_enable(dsi);
+1 -1
drivers/gpu/drm/mediatek/mtk_hdmi.c
··· 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;
+15 -5
drivers/gpu/drm/meson/meson_drv.c
··· 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 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 274 drm_dev_unref(drm); 277 275 278 276 return ret; 277 + } 278 + 279 + static int meson_drv_bind(struct device *dev) 280 + { 281 + return meson_drv_bind_master(dev, true); 279 282 } 280 283 281 284 static void meson_drv_unbind(struct device *dev) ··· 363 356 364 357 count += meson_probe_remote(pdev, &match, np, remote); 365 358 } 359 + 360 + if (count && !match) 361 + return meson_drv_bind_master(&pdev->dev, false); 366 362 367 363 /* If some endpoints were found, initialize the nodes */ 368 364 if (count) {
+1
drivers/gpu/drm/nouveau/include/nvkm/subdev/timer.h
··· 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 };
+17 -21
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 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 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 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 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 { ··· 741 733 struct drm_device *drm_dev = pci_get_drvdata(pdev); 742 734 int ret; 743 735 744 - if (nouveau_runtime_pm == 0) { 745 - pm_runtime_forbid(dev); 746 - return -EBUSY; 747 - } 748 - 749 - /* are we optimus enabled? */ 750 - if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { 751 - DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); 736 + if (!nouveau_pmops_runtime()) { 752 737 pm_runtime_forbid(dev); 753 738 return -EBUSY; 754 739 } ··· 766 765 struct nvif_device *device = &nouveau_drm(drm_dev)->client.device; 767 766 int ret; 768 767 769 - if (nouveau_runtime_pm == 0) 770 - return -EINVAL; 768 + if (!nouveau_pmops_runtime()) { 769 + pm_runtime_forbid(dev); 770 + return -EBUSY; 771 + } 771 772 772 773 pci_set_power_state(pdev, PCI_D0); 773 774 pci_restore_state(pdev); ··· 799 796 struct nouveau_drm *drm = nouveau_drm(drm_dev); 800 797 struct drm_crtc *crtc; 801 798 802 - if (nouveau_runtime_pm == 0) { 803 - pm_runtime_forbid(dev); 804 - return -EBUSY; 805 - } 806 - 807 - /* are we optimus enabled? */ 808 - if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) { 809 - DRM_DEBUG_DRIVER("failing to power off - not optimus\n"); 799 + if (!nouveau_pmops_runtime()) { 810 800 pm_runtime_forbid(dev); 811 801 return -EBUSY; 812 802 }
+1 -2
drivers/gpu/drm/nouveau/nouveau_drv.h
··· 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; ··· 193 195 194 196 int nouveau_pmops_suspend(struct device *); 195 197 int nouveau_pmops_resume(struct device *); 198 + bool nouveau_pmops_runtime(void); 196 199 197 200 #include <nvkm/core/tegra.h> 198 201
+2 -11
drivers/gpu/drm/nouveau/nouveau_vga.c
··· 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 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()) ··· 109 113 nouveau_vga_fini(struct nouveau_drm *drm) 110 114 { 111 115 struct drm_device *dev = drm->dev; 112 - bool runtime = false; 116 + bool runtime = nouveau_pmops_runtime(); 113 117 114 118 vga_client_register(dev->pdev, NULL, NULL, NULL); 115 119 116 120 if (pci_is_thunderbolt_attached(dev->pdev)) 117 121 return; 118 - 119 - if (nouveau_runtime_pm == 1) 120 - runtime = true; 121 - if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm())) 122 - runtime = true; 123 122 124 123 vga_switcheroo_unregister_client(dev->pdev); 125 124 if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
+2 -1
drivers/gpu/drm/nouveau/nv50_display.c
··· 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
+4 -3
drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c
··· 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. */ ··· 60 59 spin_unlock_irqrestore(&tmr->lock, flags); 61 60 62 61 /* Execute completed callbacks. */ 63 - list_for_each_entry_safe(alarm, atemp, &exec, head) { 64 - list_del_init(&alarm->head); 62 + list_for_each_entry_safe(alarm, atemp, &exec, exec) { 63 + list_del(&alarm->exec); 65 64 alarm->func(alarm); 66 65 } 67 66 }
-12
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
··· 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 ··· 256 258 257 259 s->output_mode = ROCKCHIP_OUT_MODE_AAAA; 258 260 s->output_type = DRM_MODE_CONNECTOR_eDP; 259 - if (dp->data->chip_type == RK3399_EDP) { 260 - /* 261 - * For RK3399, VOP Lit must code the out mode to RGB888, 262 - * VOP Big must code the out mode to RGB10. 263 - */ 264 - ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node, 265 - encoder); 266 - if (ret > 0) 267 - s->output_mode = ROCKCHIP_OUT_MODE_P888; 268 - } 269 261 270 262 return 0; 271 263 }
+2 -7
drivers/gpu/drm/rockchip/cdn-dp-core.c
··· 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) { ··· 624 625 625 626 DRM_DEV_DEBUG_KMS(dp->dev, "vop %s output to cdn-dp\n", 626 627 (ret) ? "LIT" : "BIG"); 627 - state = to_rockchip_crtc_state(encoder->crtc->state); 628 - if (ret) { 628 + if (ret) 629 629 val = DP_SEL_VOP_LIT | (DP_SEL_VOP_LIT << 16); 630 - state->output_mode = ROCKCHIP_OUT_MODE_P888; 631 - } else { 630 + else 632 631 val = DP_SEL_VOP_LIT << 16; 633 - state->output_mode = ROCKCHIP_OUT_MODE_AAAA; 634 - } 635 632 636 633 ret = cdn_dp_grf_write(dp, GRF_SOC_CON9, val); 637 634 if (ret)
+8
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
··· 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; ··· 968 967 DRM_DEV_ERROR(vop->dev, "unsupported connector_type [%d]\n", 969 968 s->output_type); 970 969 } 970 + 971 + /* 972 + * if vop is not support RGB10 output, need force RGB10 to RGB888. 973 + */ 974 + if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && 975 + !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10)) 976 + s->output_mode = ROCKCHIP_OUT_MODE_P888; 971 977 VOP_CTRL_SET(vop, out_mode, s->output_mode); 972 978 973 979 VOP_CTRL_SET(vop, htotal_pw, (htotal << 16) | hsync_len);
+3
drivers/gpu/drm/rockchip/rockchip_drm_vop.h
··· 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 */
+2
drivers/gpu/drm/rockchip/rockchip_vop_reg.c
··· 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, ··· 344 343 static const struct vop_data rk3399_vop_big = { 345 344 .init_table = rk3399_init_reg_table, 346 345 .table_size = ARRAY_SIZE(rk3399_init_reg_table), 346 + .feature = VOP_FEATURE_OUTPUT_RGB10, 347 347 .intr = &rk3399_vop_intr, 348 348 .ctrl = &rk3399_ctrl_data, 349 349 /*
+2 -2
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
··· 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)
+2
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
··· 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 }
+1 -114
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 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); ··· 367 469 } 368 470 369 471 return 0; 370 - } 371 - 372 - 373 - void 374 - vmw_du_cursor_plane_atomic_disable(struct drm_plane *plane, 375 - struct drm_plane_state *old_state) 376 - { 377 - struct drm_crtc *crtc = plane->state->crtc ?: old_state->crtc; 378 - struct vmw_private *dev_priv = vmw_priv(crtc->dev); 379 - 380 - drm_atomic_set_fb_for_plane(plane->state, NULL); 381 - vmw_cursor_update_position(dev_priv, false, 0, 0); 382 472 } 383 473 384 474 ··· 1384 1498 */ 1385 1499 if (vmw_kms_srf_ok(dev_priv, mode_cmd->width, mode_cmd->height) && 1386 1500 dmabuf && only_2d && 1501 + mode_cmd->width > 64 && /* Don't create a proxy for cursor */ 1387 1502 dev_priv->active_display_unit == vmw_du_screen_target) { 1388 1503 ret = vmw_create_dmabuf_proxy(dev_priv->dev, mode_cmd, 1389 1504 dmabuf, &surface);
-15
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
··· 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); ··· 335 339 /* Universal Plane Helpers */ 336 340 void vmw_du_primary_plane_destroy(struct drm_plane *plane); 337 341 void vmw_du_cursor_plane_destroy(struct drm_plane *plane); 338 - int vmw_du_cursor_plane_disable(struct drm_plane *plane); 339 - int vmw_du_cursor_plane_update(struct drm_plane *plane, 340 - struct drm_crtc *crtc, 341 - struct drm_framebuffer *fb, 342 - int crtc_x, int crtc_y, 343 - unsigned int crtc_w, 344 - unsigned int crtc_h, 345 - uint32_t src_x, uint32_t src_y, 346 - uint32_t src_w, uint32_t src_h); 347 342 348 343 /* Atomic Helpers */ 349 344 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane, ··· 343 356 struct drm_plane_state *state); 344 357 void vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, 345 358 struct drm_plane_state *old_state); 346 - void vmw_du_cursor_plane_atomic_disable(struct drm_plane *plane, 347 - struct drm_plane_state *old_state); 348 359 int vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane, 349 360 struct drm_plane_state *new_state); 350 361 void vmw_du_plane_cleanup_fb(struct drm_plane *plane,
+22 -5
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
··· 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 */ ··· 65 63 struct vmw_kms_dirty base; 66 64 SVGA3dTransferType transfer; 67 65 s32 left, right, top, bottom; 66 + s32 fb_left, fb_top; 68 67 u32 pitch; 69 68 union { 70 69 struct vmw_dma_buffer *buf; ··· 650 647 * 651 648 * @dirty: The closure structure. 652 649 * 653 - * This function calculates the bounding box for all the incoming clips 650 + * This function calculates the bounding box for all the incoming clips. 654 651 */ 655 652 static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty) 656 653 { ··· 659 656 660 657 dirty->num_hits = 1; 661 658 662 - /* Calculate bounding box */ 659 + /* Calculate destination bounding box */ 663 660 ddirty->left = min_t(s32, ddirty->left, dirty->unit_x1); 664 661 ddirty->top = min_t(s32, ddirty->top, dirty->unit_y1); 665 662 ddirty->right = max_t(s32, ddirty->right, dirty->unit_x2); 666 663 ddirty->bottom = max_t(s32, ddirty->bottom, dirty->unit_y2); 664 + 665 + /* 666 + * Calculate content bounding box. We only need the top-left 667 + * coordinate because width and height will be the same as the 668 + * destination bounding box above 669 + */ 670 + ddirty->fb_left = min_t(s32, ddirty->fb_left, dirty->fb_x); 671 + ddirty->fb_top = min_t(s32, ddirty->fb_top, dirty->fb_y); 667 672 } 668 673 669 674 ··· 708 697 /* Assume we are blitting from Host (display_srf) to Guest (dmabuf) */ 709 698 src_pitch = stdu->display_srf->base_size.width * stdu->cpp; 710 699 src = ttm_kmap_obj_virtual(&stdu->host_map, &not_used); 711 - src += dirty->unit_y1 * src_pitch + dirty->unit_x1 * stdu->cpp; 700 + src += ddirty->top * src_pitch + ddirty->left * stdu->cpp; 712 701 713 702 dst_pitch = ddirty->pitch; 714 703 dst = ttm_kmap_obj_virtual(&stdu->guest_map, &not_used); 715 - dst += dirty->fb_y * dst_pitch + dirty->fb_x * stdu->cpp; 704 + dst += ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp; 716 705 717 706 718 707 /* Figure out the real direction */ ··· 771 760 } 772 761 773 762 out_cleanup: 774 - ddirty->left = ddirty->top = S32_MAX; 763 + ddirty->left = ddirty->top = ddirty->fb_left = ddirty->fb_top = S32_MAX; 775 764 ddirty->right = ddirty->bottom = S32_MIN; 776 765 } 777 766 ··· 823 812 SVGA3D_READ_HOST_VRAM; 824 813 ddirty.left = ddirty.top = S32_MAX; 825 814 ddirty.right = ddirty.bottom = S32_MIN; 815 + ddirty.fb_left = ddirty.fb_top = S32_MAX; 826 816 ddirty.pitch = vfb->base.pitches[0]; 827 817 ddirty.buf = buf; 828 818 ddirty.base.fifo_commit = vmw_stdu_dmabuf_fifo_commit; ··· 1367 1355 DRM_ERROR("Failed to bind surface to STDU.\n"); 1368 1356 else 1369 1357 crtc->primary->fb = plane->state->fb; 1358 + 1359 + ret = vmw_stdu_update_st(dev_priv, stdu); 1360 + 1361 + if (ret) 1362 + DRM_ERROR("Failed to update STDU.\n"); 1370 1363 } 1371 1364 1372 1365
+15 -8
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
··· 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 + return -EINVAL; 1281 + 1282 + if (req->mip_levels > DRM_VMW_MAX_MIP_LEVELS) 1280 1283 return -EINVAL; 1281 1284 1282 1285 if (unlikely(vmw_user_surface_size == 0)) ··· 1317 1314 ret = vmw_user_dmabuf_lookup(tfile, req->buffer_handle, 1318 1315 &res->backup, 1319 1316 &user_srf->backup_base); 1320 - if (ret == 0 && res->backup->base.num_pages * PAGE_SIZE < 1321 - res->backup_size) { 1322 - DRM_ERROR("Surface backup buffer is too small.\n"); 1323 - vmw_dmabuf_unreference(&res->backup); 1324 - ret = -EINVAL; 1325 - goto out_unlock; 1317 + if (ret == 0) { 1318 + if (res->backup->base.num_pages * PAGE_SIZE < 1319 + res->backup_size) { 1320 + DRM_ERROR("Surface backup buffer is too small.\n"); 1321 + vmw_dmabuf_unreference(&res->backup); 1322 + ret = -EINVAL; 1323 + goto out_unlock; 1324 + } else { 1325 + backup_handle = req->buffer_handle; 1326 + } 1326 1327 } 1327 1328 } else if (req->drm_surface_flags & drm_vmw_surface_flag_create_buffer) 1328 1329 ret = vmw_user_dmabuf_alloc(dev_priv, tfile, ··· 1498 1491 dev_priv->stdu_max_height); 1499 1492 1500 1493 if (size.width > max_width || size.height > max_height) { 1501 - DRM_ERROR("%ux%u\n, exeeds max surface size %ux%u", 1494 + DRM_ERROR("%ux%u\n, exceeds max surface size %ux%u", 1502 1495 size.width, size.height, 1503 1496 max_width, max_height); 1504 1497 return -EINVAL;
+8 -7
drivers/gpu/ipu-v3/ipu-common.c
··· 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);
+5 -8
drivers/gpu/ipu-v3/ipu-pre.c
··· 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 ··· 147 149 148 150 void ipu_pre_put(struct ipu_pre *pre) 149 151 { 150 - u32 val; 151 - 152 - val = IPU_PRE_CTRL_SFTRST | IPU_PRE_CTRL_CLKGATE; 153 - writel(val, pre->regs + IPU_PRE_CTRL); 154 - 155 - clk_disable_unprepare(pre->clk_axi); 152 + writel(IPU_PRE_CTRL_SFTRST, pre->regs + IPU_PRE_CTRL); 156 153 157 154 pre->in_use = false; 158 155 } ··· 242 249 if (!pre->buffer_virt) 243 250 return -ENOMEM; 244 251 252 + clk_prepare_enable(pre->clk_axi); 253 + 245 254 pre->dev = dev; 246 255 platform_set_drvdata(pdev, pre); 247 256 mutex_lock(&ipu_pre_list_mutex); ··· 262 267 list_del(&pre->list); 263 268 available_pres--; 264 269 mutex_unlock(&ipu_pre_list_mutex); 270 + 271 + clk_disable_unprepare(pre->clk_axi); 265 272 266 273 if (pre->buffer_virt) 267 274 gen_pool_free(pre->iram, (unsigned long)pre->buffer_virt,
+16
drivers/input/mouse/elantech.c
··· 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 ··· 1527 1525 }, 1528 1526 }, 1529 1527 { 1528 + /* Fujitsu LIFEBOOK E546 does not work with crc_enabled == 0 */ 1529 + .matches = { 1530 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 1531 + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E546"), 1532 + }, 1533 + }, 1534 + { 1530 1535 /* Fujitsu LIFEBOOK E547 does not work with crc_enabled == 0 */ 1531 1536 .matches = { 1532 1537 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), ··· 1552 1543 .matches = { 1553 1544 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 1554 1545 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E556"), 1546 + }, 1547 + }, 1548 + { 1549 + /* Fujitsu LIFEBOOK E557 does not work with crc_enabled == 0 */ 1550 + .matches = { 1551 + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), 1552 + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E557"), 1555 1553 }, 1556 1554 }, 1557 1555 {
+1 -1
drivers/input/rmi4/rmi_f03.c
··· 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
+7
drivers/iommu/of_iommu.c
··· 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 ··· 235 234 236 235 if (err) 237 236 ops = ERR_PTR(err); 237 + } 238 + 239 + /* Ignore all other errors apart from EPROBE_DEFER */ 240 + if (IS_ERR(ops) && (PTR_ERR(ops) != -EPROBE_DEFER)) { 241 + dev_dbg(dev, "Adding to IOMMU failed: %ld\n", PTR_ERR(ops)); 242 + ops = NULL; 238 243 } 239 244 240 245 return ops;
+1 -1
drivers/isdn/i4l/isdn_ppp.c
··· 2364 2364 id); 2365 2365 return NULL; 2366 2366 } else { 2367 - rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_KERNEL); 2367 + rs = kzalloc(sizeof(struct ippp_ccp_reset_state), GFP_ATOMIC); 2368 2368 if (!rs) 2369 2369 return NULL; 2370 2370 rs->state = CCPResetIdle;
+1 -1
drivers/isdn/mISDN/stack.c
··· 75 75 if (sk->sk_state != MISDN_BOUND) 76 76 continue; 77 77 if (!cskb) 78 - cskb = skb_copy(skb, GFP_KERNEL); 78 + cskb = skb_copy(skb, GFP_ATOMIC); 79 79 if (!cskb) { 80 80 printk(KERN_WARNING "%s no skb\n", __func__); 81 81 break;
+12 -4
drivers/md/md.c
··· 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 /* ··· 5251 5239 blk_queue_make_request(mddev->queue, md_make_request); 5252 5240 blk_set_stacking_limits(&mddev->queue->limits); 5253 5241 5254 - if (percpu_ref_init(&mddev->writes_pending, no_op, 0, GFP_KERNEL) < 0) 5255 - goto abort; 5256 - /* We want to start with the refcount at zero */ 5257 - percpu_ref_put(&mddev->writes_pending); 5258 5242 disk = alloc_disk(1 << shift); 5259 5243 if (!disk) { 5260 5244 blk_cleanup_queue(mddev->queue);
+1
drivers/md/md.h
··· 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);
+2
drivers/md/raid1.c
··· 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(),
+3
drivers/md/raid10.c
··· 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))
+3
drivers/md/raid5.c
··· 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));
+6
drivers/media/Kconfig
··· 2 2 # Multimedia device configuration 3 3 # 4 4 5 + config CEC_CORE 6 + tristate 7 + 8 + config CEC_NOTIFIER 9 + bool 10 + 5 11 menuconfig MEDIA_SUPPORT 6 12 tristate "Multimedia support" 7 13 depends on HAS_IOMEM
+2 -2
drivers/media/Makefile
··· 4 4 5 5 media-objs := media-device.o media-devnode.o media-entity.o 6 6 7 - obj-$(CONFIG_CEC_CORE) += cec/ 8 - 9 7 # 10 8 # I2C drivers should come before other drivers, otherwise they'll fail 11 9 # when compiled as builtin drivers ··· 23 25 24 26 # There are both core and drivers at RC subtree - merge before drivers 25 27 obj-y += rc/ 28 + 29 + obj-$(CONFIG_CEC_CORE) += cec/ 26 30 27 31 # 28 32 # Finally, merge the drivers that require the core
-14
drivers/media/cec/Kconfig
··· 1 - config CEC_CORE 2 - tristate 3 - depends on MEDIA_CEC_SUPPORT 4 - default y 5 - 6 - config MEDIA_CEC_NOTIFIER 7 - bool 8 - 9 1 config MEDIA_CEC_RC 10 2 bool "HDMI CEC RC integration" 11 3 depends on CEC_CORE && RC_CORE 12 4 ---help--- 13 5 Pass on CEC remote control messages to the RC framework. 14 - 15 - config MEDIA_CEC_DEBUG 16 - bool "HDMI CEC debugfs interface" 17 - depends on CEC_CORE && DEBUG_FS 18 - ---help--- 19 - Turns on the DebugFS interface for CEC devices.
+1 -1
drivers/media/cec/Makefile
··· 1 1 cec-objs := cec-core.o cec-adap.o cec-api.o cec-edid.o 2 2 3 - ifeq ($(CONFIG_MEDIA_CEC_NOTIFIER),y) 3 + ifeq ($(CONFIG_CEC_NOTIFIER),y) 4 4 cec-objs += cec-notifier.o 5 5 endif 6 6
+1 -1
drivers/media/cec/cec-adap.c
··· 1864 1864 WARN_ON(call_op(adap, adap_monitor_all_enable, 0)); 1865 1865 } 1866 1866 1867 - #ifdef CONFIG_MEDIA_CEC_DEBUG 1867 + #ifdef CONFIG_DEBUG_FS 1868 1868 /* 1869 1869 * Log the current state of the CEC adapter. 1870 1870 * Very useful for debugging.
+4 -4
drivers/media/cec/cec-core.c
··· 187 187 put_device(&devnode->dev); 188 188 } 189 189 190 - #ifdef CONFIG_MEDIA_CEC_NOTIFIER 190 + #ifdef CONFIG_CEC_NOTIFIER 191 191 static void cec_cec_notify(struct cec_adapter *adap, u16 pa) 192 192 { 193 193 cec_s_phys_addr(adap, pa, false); ··· 323 323 } 324 324 325 325 dev_set_drvdata(&adap->devnode.dev, adap); 326 - #ifdef CONFIG_MEDIA_CEC_DEBUG 326 + #ifdef CONFIG_DEBUG_FS 327 327 if (!top_cec_dir) 328 328 return 0; 329 329 ··· 355 355 adap->rc = NULL; 356 356 #endif 357 357 debugfs_remove_recursive(adap->cec_dir); 358 - #ifdef CONFIG_MEDIA_CEC_NOTIFIER 358 + #ifdef CONFIG_CEC_NOTIFIER 359 359 if (adap->notifier) 360 360 cec_notifier_unregister(adap->notifier); 361 361 #endif ··· 395 395 return ret; 396 396 } 397 397 398 - #ifdef CONFIG_MEDIA_CEC_DEBUG 398 + #ifdef CONFIG_DEBUG_FS 399 399 top_cec_dir = debugfs_create_dir("cec", NULL); 400 400 if (IS_ERR_OR_NULL(top_cec_dir)) { 401 401 pr_warn("cec: Failed to create debugfs cec dir\n");
+6 -3
drivers/media/i2c/Kconfig
··· 220 220 221 221 config VIDEO_ADV7604_CEC 222 222 bool "Enable Analog Devices ADV7604 CEC support" 223 - depends on VIDEO_ADV7604 && CEC_CORE 223 + depends on VIDEO_ADV7604 224 + select CEC_CORE 224 225 ---help--- 225 226 When selected the adv7604 will support the optional 226 227 HDMI CEC feature. ··· 241 240 242 241 config VIDEO_ADV7842_CEC 243 242 bool "Enable Analog Devices ADV7842 CEC support" 244 - depends on VIDEO_ADV7842 && CEC_CORE 243 + depends on VIDEO_ADV7842 244 + select CEC_CORE 245 245 ---help--- 246 246 When selected the adv7842 will support the optional 247 247 HDMI CEC feature. ··· 480 478 481 479 config VIDEO_ADV7511_CEC 482 480 bool "Enable Analog Devices ADV7511 CEC support" 483 - depends on VIDEO_ADV7511 && CEC_CORE 481 + depends on VIDEO_ADV7511 482 + select CEC_CORE 484 483 ---help--- 485 484 When selected the adv7511 will support the optional 486 485 HDMI CEC feature.
+6 -4
drivers/media/platform/Kconfig
··· 501 501 502 502 config VIDEO_SAMSUNG_S5P_CEC 503 503 tristate "Samsung S5P CEC driver" 504 - depends on CEC_CORE && (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST) 505 - select MEDIA_CEC_NOTIFIER 504 + depends on PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST 505 + select CEC_CORE 506 + select CEC_NOTIFIER 506 507 ---help--- 507 508 This is a driver for Samsung S5P HDMI CEC interface. It uses the 508 509 generic CEC framework interface. ··· 512 511 513 512 config VIDEO_STI_HDMI_CEC 514 513 tristate "STMicroelectronics STiH4xx HDMI CEC driver" 515 - depends on CEC_CORE && (ARCH_STI || COMPILE_TEST) 516 - select MEDIA_CEC_NOTIFIER 514 + depends on ARCH_STI || COMPILE_TEST 515 + select CEC_CORE 516 + select CEC_NOTIFIER 517 517 ---help--- 518 518 This is a driver for STIH4xx HDMI CEC interface. It uses the 519 519 generic CEC framework interface.
+2 -1
drivers/media/platform/vivid/Kconfig
··· 26 26 27 27 config VIDEO_VIVID_CEC 28 28 bool "Enable CEC emulation support" 29 - depends on VIDEO_VIVID && CEC_CORE 29 + depends on VIDEO_VIVID 30 + select CEC_CORE 30 31 ---help--- 31 32 When selected the vivid module will emulate the optional 32 33 HDMI CEC feature.
+8 -5
drivers/media/rc/rc-ir-raw.c
··· 211 211 */ 212 212 void ir_raw_event_handle(struct rc_dev *dev) 213 213 { 214 - if (!dev->raw) 214 + if (!dev->raw || !dev->raw->thread) 215 215 return; 216 216 217 217 wake_up_process(dev->raw->thread); ··· 490 490 { 491 491 int rc; 492 492 struct ir_raw_handler *handler; 493 + struct task_struct *thread; 493 494 494 495 if (!dev) 495 496 return -EINVAL; ··· 508 507 * because the event is coming from userspace 509 508 */ 510 509 if (dev->driver_type != RC_DRIVER_IR_RAW_TX) { 511 - dev->raw->thread = kthread_run(ir_raw_event_thread, dev->raw, 512 - "rc%u", dev->minor); 510 + thread = kthread_run(ir_raw_event_thread, dev->raw, "rc%u", 511 + dev->minor); 513 512 514 - if (IS_ERR(dev->raw->thread)) { 515 - rc = PTR_ERR(dev->raw->thread); 513 + if (IS_ERR(thread)) { 514 + rc = PTR_ERR(thread); 516 515 goto out; 517 516 } 517 + 518 + dev->raw->thread = thread; 518 519 } 519 520 520 521 mutex_lock(&ir_raw_handler_lock);
+2 -1
drivers/media/usb/pulse8-cec/Kconfig
··· 1 1 config USB_PULSE8_CEC 2 2 tristate "Pulse Eight HDMI CEC" 3 - depends on USB_ACM && CEC_CORE 3 + depends on USB_ACM 4 + select CEC_CORE 4 5 select SERIO 5 6 select SERIO_SERPORT 6 7 ---help---
+2 -1
drivers/media/usb/rainshadow-cec/Kconfig
··· 1 1 config USB_RAINSHADOW_CEC 2 2 tristate "RainShadow Tech HDMI CEC" 3 - depends on USB_ACM && CEC_CORE 3 + depends on USB_ACM 4 + select CEC_CORE 4 5 select SERIO 5 6 select SERIO_SERPORT 6 7 ---help---
+1 -1
drivers/media/usb/rainshadow-cec/rainshadow-cec.c
··· 119 119 120 120 while (true) { 121 121 unsigned long flags; 122 - bool exit_loop; 122 + bool exit_loop = false; 123 123 char data; 124 124 125 125 spin_lock_irqsave(&rain->buf_lock, flags);
+1 -1
drivers/memory/atmel-ebi.c
··· 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;
+2 -5
drivers/misc/cxl/file.c
··· 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) {
+11 -3
drivers/misc/cxl/native.c
··· 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) ··· 1349 1346 1350 1347 void cxl_native_release_serr_irq(struct cxl_afu *afu) 1351 1348 { 1352 - if (afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq)) 1349 + if (afu->serr_virq == 0 || 1350 + afu->serr_virq != irq_find_mapping(NULL, afu->serr_hwirq)) 1353 1351 return; 1354 1352 1355 1353 cxl_p1n_write(afu, CXL_PSL_SERR_An, 0x0000000000000000); 1356 1354 cxl_unmap_irq(afu->serr_virq, afu); 1357 1355 cxl_ops->release_one_irq(afu->adapter, afu->serr_hwirq); 1358 1356 kfree(afu->err_irq_name); 1357 + afu->serr_virq = 0; 1359 1358 } 1360 1359 1361 1360 int cxl_native_register_psl_irq(struct cxl_afu *afu) ··· 1380 1375 1381 1376 void cxl_native_release_psl_irq(struct cxl_afu *afu) 1382 1377 { 1383 - if (afu->native->psl_virq != irq_find_mapping(NULL, afu->native->psl_hwirq)) 1378 + if (afu->native->psl_virq == 0 || 1379 + afu->native->psl_virq != 1380 + irq_find_mapping(NULL, afu->native->psl_hwirq)) 1384 1381 return; 1385 1382 1386 1383 cxl_unmap_irq(afu->native->psl_virq, afu); 1387 1384 cxl_ops->release_one_irq(afu->adapter, afu->native->psl_hwirq); 1388 1385 kfree(afu->psl_irq_name); 1386 + afu->native->psl_virq = 0; 1389 1387 } 1390 1388 1391 1389 static void recover_psl_err(struct cxl_afu *afu, u64 errstat)
+3 -3
drivers/net/dsa/mv88e6xxx/global2.h
··· 114 114 return -EOPNOTSUPP; 115 115 } 116 116 117 - int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, int src_dev, 118 - int src_port, u16 data) 117 + static inline int mv88e6xxx_g2_pvt_write(struct mv88e6xxx_chip *chip, 118 + int src_dev, int src_port, u16 data) 119 119 { 120 120 return -EOPNOTSUPP; 121 121 } 122 122 123 - int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip) 123 + static inline int mv88e6xxx_g2_misc_4_bit_port(struct mv88e6xxx_chip *chip) 124 124 { 125 125 return -EOPNOTSUPP; 126 126 }
+2 -3
drivers/net/ethernet/amd/xgbe/xgbe-desc.c
··· 324 324 struct xgbe_ring *ring, 325 325 struct xgbe_ring_data *rdata) 326 326 { 327 - int order, ret; 327 + int ret; 328 328 329 329 if (!ring->rx_hdr_pa.pages) { 330 330 ret = xgbe_alloc_pages(pdata, &ring->rx_hdr_pa, GFP_ATOMIC, 0); ··· 333 333 } 334 334 335 335 if (!ring->rx_buf_pa.pages) { 336 - order = max_t(int, PAGE_ALLOC_COSTLY_ORDER - 1, 0); 337 336 ret = xgbe_alloc_pages(pdata, &ring->rx_buf_pa, GFP_ATOMIC, 338 - order); 337 + PAGE_ALLOC_COSTLY_ORDER); 339 338 if (ret) 340 339 return ret; 341 340 }
+5 -2
drivers/net/ethernet/broadcom/bcmsysport.c
··· 2026 2026 priv->num_rx_desc_words = params->num_rx_desc_words; 2027 2027 2028 2028 priv->irq0 = platform_get_irq(pdev, 0); 2029 - if (!priv->is_lite) 2029 + if (!priv->is_lite) { 2030 2030 priv->irq1 = platform_get_irq(pdev, 1); 2031 - priv->wol_irq = platform_get_irq(pdev, 2); 2031 + priv->wol_irq = platform_get_irq(pdev, 2); 2032 + } else { 2033 + priv->wol_irq = platform_get_irq(pdev, 1); 2034 + } 2032 2035 if (priv->irq0 <= 0 || (priv->irq1 <= 0 && !priv->is_lite)) { 2033 2036 dev_err(&pdev->dev, "invalid interrupts\n"); 2034 2037 ret = -EINVAL;
+1 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
··· 1926 1926 } 1927 1927 1928 1928 /* select a non-FCoE queue */ 1929 - return fallback(dev, skb) % BNX2X_NUM_ETH_QUEUES(bp); 1929 + return fallback(dev, skb) % (BNX2X_NUM_ETH_QUEUES(bp) * bp->max_cos); 1930 1930 } 1931 1931 1932 1932 void bnx2x_set_num_queues(struct bnx2x *bp)
+17 -8
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
··· 2196 2196 if (err) 2197 2197 goto irq_err; 2198 2198 } 2199 + 2200 + mutex_lock(&uld_mutex); 2199 2201 enable_rx(adap); 2200 2202 t4_sge_start(adap); 2201 2203 t4_intr_enable(adap); 2202 2204 adap->flags |= FULL_INIT_DONE; 2205 + mutex_unlock(&uld_mutex); 2206 + 2203 2207 notify_ulds(adap, CXGB4_STATE_UP); 2204 2208 #if IS_ENABLED(CONFIG_IPV6) 2205 2209 update_clip(adap); ··· 2774 2770 void t4_fatal_err(struct adapter *adap) 2775 2771 { 2776 2772 int port; 2773 + 2774 + if (pci_channel_offline(adap->pdev)) 2775 + return; 2777 2776 2778 2777 /* Disable the SGE since ULDs are going to free resources that 2779 2778 * could be exposed to the adapter. RDMA MWs for example... ··· 3889 3882 spin_lock(&adap->stats_lock); 3890 3883 for_each_port(adap, i) { 3891 3884 struct net_device *dev = adap->port[i]; 3892 - 3893 - netif_device_detach(dev); 3894 - netif_carrier_off(dev); 3885 + if (dev) { 3886 + netif_device_detach(dev); 3887 + netif_carrier_off(dev); 3888 + } 3895 3889 } 3896 3890 spin_unlock(&adap->stats_lock); 3897 3891 disable_interrupts(adap); ··· 3971 3963 rtnl_lock(); 3972 3964 for_each_port(adap, i) { 3973 3965 struct net_device *dev = adap->port[i]; 3974 - 3975 - if (netif_running(dev)) { 3976 - link_start(dev); 3977 - cxgb_set_rxmode(dev); 3966 + if (dev) { 3967 + if (netif_running(dev)) { 3968 + link_start(dev); 3969 + cxgb_set_rxmode(dev); 3970 + } 3971 + netif_device_attach(dev); 3978 3972 } 3979 - netif_device_attach(dev); 3980 3973 } 3981 3974 rtnl_unlock(); 3982 3975 }
+7 -2
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
··· 4557 4557 */ 4558 4558 void t4_intr_disable(struct adapter *adapter) 4559 4559 { 4560 - u32 whoami = t4_read_reg(adapter, PL_WHOAMI_A); 4561 - u32 pf = CHELSIO_CHIP_VERSION(adapter->params.chip) <= CHELSIO_T5 ? 4560 + u32 whoami, pf; 4561 + 4562 + if (pci_channel_offline(adapter->pdev)) 4563 + return; 4564 + 4565 + whoami = t4_read_reg(adapter, PL_WHOAMI_A); 4566 + pf = CHELSIO_CHIP_VERSION(adapter->params.chip) <= CHELSIO_T5 ? 4562 4567 SOURCEPF_G(whoami) : T6_SOURCEPF_G(whoami); 4563 4568 4564 4569 t4_write_reg(adapter, MYPF_REG(PL_PF_INT_ENABLE_A), 0);
+3 -3
drivers/net/ethernet/chelsio/cxgb4/t4fw_version.h
··· 37 37 38 38 #define T4FW_VERSION_MAJOR 0x01 39 39 #define T4FW_VERSION_MINOR 0x10 40 - #define T4FW_VERSION_MICRO 0x2B 40 + #define T4FW_VERSION_MICRO 0x2D 41 41 #define T4FW_VERSION_BUILD 0x00 42 42 43 43 #define T4FW_MIN_VERSION_MAJOR 0x01 ··· 46 46 47 47 #define T5FW_VERSION_MAJOR 0x01 48 48 #define T5FW_VERSION_MINOR 0x10 49 - #define T5FW_VERSION_MICRO 0x2B 49 + #define T5FW_VERSION_MICRO 0x2D 50 50 #define T5FW_VERSION_BUILD 0x00 51 51 52 52 #define T5FW_MIN_VERSION_MAJOR 0x00 ··· 55 55 56 56 #define T6FW_VERSION_MAJOR 0x01 57 57 #define T6FW_VERSION_MINOR 0x10 58 - #define T6FW_VERSION_MICRO 0x2B 58 + #define T6FW_VERSION_MICRO 0x2D 59 59 #define T6FW_VERSION_BUILD 0x00 60 60 61 61 #define T6FW_MIN_VERSION_MAJOR 0x00
+2 -1
drivers/net/ethernet/ethoc.c
··· 739 739 if (ret) 740 740 return ret; 741 741 742 + napi_enable(&priv->napi); 743 + 742 744 ethoc_init_ring(priv, dev->mem_start); 743 745 ethoc_reset(priv); 744 746 ··· 756 754 priv->old_duplex = -1; 757 755 758 756 phy_start(dev->phydev); 759 - napi_enable(&priv->napi); 760 757 761 758 if (netif_msg_ifup(priv)) { 762 759 dev_info(&dev->dev, "I/O: %08lx Memory: %08lx-%08lx\n",
+8 -1
drivers/net/ethernet/freescale/fsl_pq_mdio.c
··· 381 381 { 382 382 const struct of_device_id *id = 383 383 of_match_device(fsl_pq_mdio_match, &pdev->dev); 384 - const struct fsl_pq_mdio_data *data = id->data; 384 + const struct fsl_pq_mdio_data *data; 385 385 struct device_node *np = pdev->dev.of_node; 386 386 struct resource res; 387 387 struct device_node *tbi; 388 388 struct fsl_pq_mdio_priv *priv; 389 389 struct mii_bus *new_bus; 390 390 int err; 391 + 392 + if (!id) { 393 + dev_err(&pdev->dev, "Failed to match device\n"); 394 + return -ENODEV; 395 + } 396 + 397 + data = id->data; 391 398 392 399 dev_dbg(&pdev->dev, "found %s compatible node\n", id->compatible); 393 400
+1 -1
drivers/net/ethernet/ibm/ibmvnic.c
··· 81 81 static const char ibmvnic_driver_name[] = "ibmvnic"; 82 82 static const char ibmvnic_driver_string[] = "IBM System i/p Virtual NIC Driver"; 83 83 84 - MODULE_AUTHOR("Santiago Leon <santi_leon@yahoo.com>"); 84 + MODULE_AUTHOR("Santiago Leon"); 85 85 MODULE_DESCRIPTION("IBM System i/p Virtual NIC Driver"); 86 86 MODULE_LICENSE("GPL"); 87 87 MODULE_VERSION(IBMVNIC_DRIVER_VERSION);
+18 -18
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 295 295 **/ 296 296 void i40e_service_event_schedule(struct i40e_pf *pf) 297 297 { 298 - if (!test_bit(__I40E_VSI_DOWN, pf->state) && 298 + if (!test_bit(__I40E_DOWN, pf->state) && 299 299 !test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state)) 300 300 queue_work(i40e_wq, &pf->service_task); 301 301 } ··· 3611 3611 * this is not a performance path and napi_schedule() 3612 3612 * can deal with rescheduling. 3613 3613 */ 3614 - if (!test_bit(__I40E_VSI_DOWN, pf->state)) 3614 + if (!test_bit(__I40E_DOWN, pf->state)) 3615 3615 napi_schedule_irqoff(&q_vector->napi); 3616 3616 } 3617 3617 ··· 3687 3687 enable_intr: 3688 3688 /* re-enable interrupt causes */ 3689 3689 wr32(hw, I40E_PFINT_ICR0_ENA, ena_mask); 3690 - if (!test_bit(__I40E_VSI_DOWN, pf->state)) { 3690 + if (!test_bit(__I40E_DOWN, pf->state)) { 3691 3691 i40e_service_event_schedule(pf); 3692 3692 i40e_irq_dynamic_enable_icr0(pf, false); 3693 3693 } ··· 6203 6203 { 6204 6204 6205 6205 /* if interface is down do nothing */ 6206 - if (test_bit(__I40E_VSI_DOWN, pf->state)) 6206 + if (test_bit(__I40E_DOWN, pf->state)) 6207 6207 return; 6208 6208 6209 6209 if (test_bit(__I40E_FD_FLUSH_REQUESTED, pf->state)) ··· 6344 6344 int i; 6345 6345 6346 6346 /* if interface is down do nothing */ 6347 - if (test_bit(__I40E_VSI_DOWN, pf->state) || 6347 + if (test_bit(__I40E_DOWN, pf->state) || 6348 6348 test_bit(__I40E_CONFIG_BUSY, pf->state)) 6349 6349 return; 6350 6350 ··· 6399 6399 reset_flags |= BIT(__I40E_GLOBAL_RESET_REQUESTED); 6400 6400 clear_bit(__I40E_GLOBAL_RESET_REQUESTED, pf->state); 6401 6401 } 6402 - if (test_bit(__I40E_VSI_DOWN_REQUESTED, pf->state)) { 6403 - reset_flags |= BIT(__I40E_VSI_DOWN_REQUESTED); 6404 - clear_bit(__I40E_VSI_DOWN_REQUESTED, pf->state); 6402 + if (test_bit(__I40E_DOWN_REQUESTED, pf->state)) { 6403 + reset_flags |= BIT(__I40E_DOWN_REQUESTED); 6404 + clear_bit(__I40E_DOWN_REQUESTED, pf->state); 6405 6405 } 6406 6406 6407 6407 /* If there's a recovery already waiting, it takes ··· 6415 6415 6416 6416 /* If we're already down or resetting, just bail */ 6417 6417 if (reset_flags && 6418 - !test_bit(__I40E_VSI_DOWN, pf->state) && 6418 + !test_bit(__I40E_DOWN, pf->state) && 6419 6419 !test_bit(__I40E_CONFIG_BUSY, pf->state)) { 6420 6420 rtnl_lock(); 6421 6421 i40e_do_reset(pf, reset_flags, true); ··· 7002 7002 u32 val; 7003 7003 int v; 7004 7004 7005 - if (test_bit(__I40E_VSI_DOWN, pf->state)) 7005 + if (test_bit(__I40E_DOWN, pf->state)) 7006 7006 goto clear_recovery; 7007 7007 dev_dbg(&pf->pdev->dev, "Rebuilding internal switch\n"); 7008 7008 ··· 9767 9767 return -ENODEV; 9768 9768 } 9769 9769 if (vsi == pf->vsi[pf->lan_vsi] && 9770 - !test_bit(__I40E_VSI_DOWN, pf->state)) { 9770 + !test_bit(__I40E_DOWN, pf->state)) { 9771 9771 dev_info(&pf->pdev->dev, "Can't remove PF VSI\n"); 9772 9772 return -ENODEV; 9773 9773 } ··· 11003 11003 } 11004 11004 pf->next_vsi = 0; 11005 11005 pf->pdev = pdev; 11006 - set_bit(__I40E_VSI_DOWN, pf->state); 11006 + set_bit(__I40E_DOWN, pf->state); 11007 11007 11008 11008 hw = &pf->hw; 11009 11009 hw->back = pf; ··· 11293 11293 * before setting up the misc vector or we get a race and the vector 11294 11294 * ends up disabled forever. 11295 11295 */ 11296 - clear_bit(__I40E_VSI_DOWN, pf->state); 11296 + clear_bit(__I40E_DOWN, pf->state); 11297 11297 11298 11298 /* In case of MSIX we are going to setup the misc vector right here 11299 11299 * to handle admin queue events etc. In case of legacy and MSI ··· 11448 11448 11449 11449 /* Unwind what we've done if something failed in the setup */ 11450 11450 err_vsis: 11451 - set_bit(__I40E_VSI_DOWN, pf->state); 11451 + set_bit(__I40E_DOWN, pf->state); 11452 11452 i40e_clear_interrupt_scheme(pf); 11453 11453 kfree(pf->vsi); 11454 11454 err_switch_setup: ··· 11500 11500 11501 11501 /* no more scheduling of any task */ 11502 11502 set_bit(__I40E_SUSPENDED, pf->state); 11503 - set_bit(__I40E_VSI_DOWN, pf->state); 11503 + set_bit(__I40E_DOWN, pf->state); 11504 11504 if (pf->service_timer.data) 11505 11505 del_timer_sync(&pf->service_timer); 11506 11506 if (pf->service_task.func) ··· 11740 11740 struct i40e_hw *hw = &pf->hw; 11741 11741 11742 11742 set_bit(__I40E_SUSPENDED, pf->state); 11743 - set_bit(__I40E_VSI_DOWN, pf->state); 11743 + set_bit(__I40E_DOWN, pf->state); 11744 11744 rtnl_lock(); 11745 11745 i40e_prep_for_reset(pf, true); 11746 11746 rtnl_unlock(); ··· 11789 11789 int retval = 0; 11790 11790 11791 11791 set_bit(__I40E_SUSPENDED, pf->state); 11792 - set_bit(__I40E_VSI_DOWN, pf->state); 11792 + set_bit(__I40E_DOWN, pf->state); 11793 11793 11794 11794 if (pf->wol_en && (pf->flags & I40E_FLAG_WOL_MC_MAGIC_PKT_WAKE)) 11795 11795 i40e_enable_mc_magic_wake(pf); ··· 11841 11841 11842 11842 /* handling the reset will rebuild the device state */ 11843 11843 if (test_and_clear_bit(__I40E_SUSPENDED, pf->state)) { 11844 - clear_bit(__I40E_VSI_DOWN, pf->state); 11844 + clear_bit(__I40E_DOWN, pf->state); 11845 11845 rtnl_lock(); 11846 11846 i40e_reset_and_rebuild(pf, false, true); 11847 11847 rtnl_unlock();
+2 -1
drivers/net/ethernet/intel/i40e/i40e_txrx.c
··· 1854 1854 #if (PAGE_SIZE < 8192) 1855 1855 unsigned int truesize = i40e_rx_pg_size(rx_ring) / 2; 1856 1856 #else 1857 - unsigned int truesize = SKB_DATA_ALIGN(size); 1857 + unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + 1858 + SKB_DATA_ALIGN(I40E_SKB_PAD + size); 1858 1859 #endif 1859 1860 struct sk_buff *skb; 1860 1861
+2 -1
drivers/net/ethernet/intel/i40evf/i40e_txrx.c
··· 1190 1190 #if (PAGE_SIZE < 8192) 1191 1191 unsigned int truesize = i40e_rx_pg_size(rx_ring) / 2; 1192 1192 #else 1193 - unsigned int truesize = SKB_DATA_ALIGN(size); 1193 + unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) + 1194 + SKB_DATA_ALIGN(I40E_SKB_PAD + size); 1194 1195 #endif 1195 1196 struct sk_buff *skb; 1196 1197
-5
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
··· 1562 1562 qpn = priv->drop_qp.qpn; 1563 1563 else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) { 1564 1564 qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1); 1565 - if (qpn < priv->rss_map.base_qpn || 1566 - qpn >= priv->rss_map.base_qpn + priv->rx_ring_num) { 1567 - en_warn(priv, "rxnfc: QP (0x%x) doesn't exist\n", qpn); 1568 - return -EINVAL; 1569 - } 1570 1565 } else { 1571 1566 if (cmd->fs.ring_cookie >= priv->rx_ring_num) { 1572 1567 en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n",
+11 -4
drivers/net/ethernet/mellanox/mlx4/mcg.c
··· 35 35 #include <linux/etherdevice.h> 36 36 37 37 #include <linux/mlx4/cmd.h> 38 + #include <linux/mlx4/qp.h> 38 39 #include <linux/export.h> 39 40 40 41 #include "mlx4.h" ··· 986 985 if (IS_ERR(mailbox)) 987 986 return PTR_ERR(mailbox); 988 987 988 + if (!mlx4_qp_lookup(dev, rule->qpn)) { 989 + mlx4_err_rule(dev, "QP doesn't exist\n", rule); 990 + ret = -EINVAL; 991 + goto out; 992 + } 993 + 989 994 trans_rule_ctrl_to_hw(rule, mailbox->buf); 990 995 991 996 size += sizeof(struct mlx4_net_trans_rule_hw_ctrl); 992 997 993 998 list_for_each_entry(cur, &rule->list, list) { 994 999 ret = parse_trans_rule(dev, cur, mailbox->buf + size); 995 - if (ret < 0) { 996 - mlx4_free_cmd_mailbox(dev, mailbox); 997 - return ret; 998 - } 1000 + if (ret < 0) 1001 + goto out; 1002 + 999 1003 size += ret; 1000 1004 } 1001 1005 ··· 1027 1021 } 1028 1022 } 1029 1023 1024 + out: 1030 1025 mlx4_free_cmd_mailbox(dev, mailbox); 1031 1026 1032 1027 return ret;
+19
drivers/net/ethernet/mellanox/mlx4/qp.c
··· 384 384 __mlx4_qp_free_icm(dev, qpn); 385 385 } 386 386 387 + struct mlx4_qp *mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn) 388 + { 389 + struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table; 390 + struct mlx4_qp *qp; 391 + 392 + spin_lock(&qp_table->lock); 393 + 394 + qp = __mlx4_qp_lookup(dev, qpn); 395 + 396 + spin_unlock(&qp_table->lock); 397 + return qp; 398 + } 399 + 387 400 int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, gfp_t gfp) 388 401 { 389 402 struct mlx4_priv *priv = mlx4_priv(dev); ··· 484 471 } 485 472 486 473 if (attr & MLX4_UPDATE_QP_QOS_VPORT) { 474 + if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_QOS_VPP)) { 475 + mlx4_warn(dev, "Granular QoS per VF is not enabled\n"); 476 + err = -EOPNOTSUPP; 477 + goto out; 478 + } 479 + 487 480 qp_mask |= 1ULL << MLX4_UPD_QP_MASK_QOS_VPP; 488 481 cmd->qp_context.qos_vport = params->qos_vport; 489 482 }
+11 -5
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
··· 5255 5255 mutex_unlock(&priv->mfunc.master.res_tracker.slave_list[slave].mutex); 5256 5256 } 5257 5257 5258 + static void update_qos_vpp(struct mlx4_update_qp_context *ctx, 5259 + struct mlx4_vf_immed_vlan_work *work) 5260 + { 5261 + ctx->qp_mask |= cpu_to_be64(1ULL << MLX4_UPD_QP_MASK_QOS_VPP); 5262 + ctx->qp_context.qos_vport = work->qos_vport; 5263 + } 5264 + 5258 5265 void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work) 5259 5266 { 5260 5267 struct mlx4_vf_immed_vlan_work *work = ··· 5376 5369 qp->sched_queue & 0xC7; 5377 5370 upd_context->qp_context.pri_path.sched_queue |= 5378 5371 ((work->qos & 0x7) << 3); 5379 - upd_context->qp_mask |= 5380 - cpu_to_be64(1ULL << 5381 - MLX4_UPD_QP_MASK_QOS_VPP); 5382 - upd_context->qp_context.qos_vport = 5383 - work->qos_vport; 5372 + 5373 + if (dev->caps.flags2 & 5374 + MLX4_DEV_CAP_FLAG2_QOS_VPP) 5375 + update_qos_vpp(upd_context, work); 5384 5376 } 5385 5377 5386 5378 err = mlx4_cmd(dev, mailbox->dma,
+2 -3
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 621 621 cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node), 622 622 priv->irq_info[i].mask); 623 623 624 - #ifdef CONFIG_SMP 625 - if (irq_set_affinity_hint(irq, priv->irq_info[i].mask)) 624 + if (IS_ENABLED(CONFIG_SMP) && 625 + irq_set_affinity_hint(irq, priv->irq_info[i].mask)) 626 626 mlx5_core_warn(mdev, "irq_set_affinity_hint failed, irq 0x%.4x", irq); 627 - #endif 628 627 629 628 return 0; 630 629 }
+2 -1
drivers/net/ethernet/qlogic/qed/qed_main.c
··· 1730 1730 qed_get_protocol_stats_iscsi(cdev, &stats->iscsi_stats); 1731 1731 break; 1732 1732 default: 1733 - DP_ERR(cdev, "Invalid protocol type = %d\n", type); 1733 + DP_VERBOSE(cdev, QED_MSG_SP, 1734 + "Invalid protocol type = %d\n", type); 1734 1735 return; 1735 1736 } 1736 1737 }
+24 -2
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
··· 1824 1824 u32 (*get_cap_size)(void *, int); 1825 1825 void (*set_sys_info)(void *, int, u32); 1826 1826 void (*store_cap_mask)(void *, u32); 1827 + bool (*encap_rx_offload) (struct qlcnic_adapter *adapter); 1828 + bool (*encap_tx_offload) (struct qlcnic_adapter *adapter); 1827 1829 }; 1828 1830 1829 1831 extern struct qlcnic_nic_template qlcnic_vf_ops; 1830 1832 1831 - static inline bool qlcnic_encap_tx_offload(struct qlcnic_adapter *adapter) 1833 + static inline bool qlcnic_83xx_encap_tx_offload(struct qlcnic_adapter *adapter) 1832 1834 { 1833 1835 return adapter->ahw->extra_capability[0] & 1834 1836 QLCNIC_83XX_FW_CAPAB_ENCAP_TX_OFFLOAD; 1835 1837 } 1836 1838 1837 - static inline bool qlcnic_encap_rx_offload(struct qlcnic_adapter *adapter) 1839 + static inline bool qlcnic_83xx_encap_rx_offload(struct qlcnic_adapter *adapter) 1838 1840 { 1839 1841 return adapter->ahw->extra_capability[0] & 1840 1842 QLCNIC_83XX_FW_CAPAB_ENCAP_RX_OFFLOAD; 1843 + } 1844 + 1845 + static inline bool qlcnic_82xx_encap_tx_offload(struct qlcnic_adapter *adapter) 1846 + { 1847 + return false; 1848 + } 1849 + 1850 + static inline bool qlcnic_82xx_encap_rx_offload(struct qlcnic_adapter *adapter) 1851 + { 1852 + return false; 1853 + } 1854 + 1855 + static inline bool qlcnic_encap_rx_offload(struct qlcnic_adapter *adapter) 1856 + { 1857 + return adapter->ahw->hw_ops->encap_rx_offload(adapter); 1858 + } 1859 + 1860 + static inline bool qlcnic_encap_tx_offload(struct qlcnic_adapter *adapter) 1861 + { 1862 + return adapter->ahw->hw_ops->encap_tx_offload(adapter); 1841 1863 } 1842 1864 1843 1865 static inline int qlcnic_start_firmware(struct qlcnic_adapter *adapter)
+2
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
··· 242 242 .get_cap_size = qlcnic_83xx_get_cap_size, 243 243 .set_sys_info = qlcnic_83xx_set_sys_info, 244 244 .store_cap_mask = qlcnic_83xx_store_cap_mask, 245 + .encap_rx_offload = qlcnic_83xx_encap_rx_offload, 246 + .encap_tx_offload = qlcnic_83xx_encap_tx_offload, 245 247 }; 246 248 247 249 static struct qlcnic_nic_template qlcnic_83xx_ops = {
+1 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c
··· 341 341 } 342 342 return -EIO; 343 343 } 344 - usleep_range(1000, 1500); 344 + udelay(1200); 345 345 } 346 346 347 347 if (id_reg)
+2
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 632 632 .get_cap_size = qlcnic_82xx_get_cap_size, 633 633 .set_sys_info = qlcnic_82xx_set_sys_info, 634 634 .store_cap_mask = qlcnic_82xx_store_cap_mask, 635 + .encap_rx_offload = qlcnic_82xx_encap_rx_offload, 636 + .encap_tx_offload = qlcnic_82xx_encap_tx_offload, 635 637 }; 636 638 637 639 static int qlcnic_check_multi_tx_capability(struct qlcnic_adapter *adapter)
+2
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
··· 77 77 .free_mac_list = qlcnic_sriov_vf_free_mac_list, 78 78 .enable_sds_intr = qlcnic_83xx_enable_sds_intr, 79 79 .disable_sds_intr = qlcnic_83xx_disable_sds_intr, 80 + .encap_rx_offload = qlcnic_83xx_encap_rx_offload, 81 + .encap_tx_offload = qlcnic_83xx_encap_tx_offload, 80 82 }; 81 83 82 84 static struct qlcnic_nic_template qlcnic_sriov_vf_ops = {
+1 -1
drivers/net/ethernet/qualcomm/emac/emac-mac.c
··· 931 931 emac_mac_config(adpt); 932 932 emac_mac_rx_descs_refill(adpt, &adpt->rx_q); 933 933 934 - adpt->phydev->irq = PHY_IGNORE_INTERRUPT; 934 + adpt->phydev->irq = PHY_POLL; 935 935 ret = phy_connect_direct(netdev, adpt->phydev, emac_adjust_link, 936 936 PHY_INTERFACE_MODE_SGMII); 937 937 if (ret) {
+4 -71
drivers/net/ethernet/qualcomm/emac/emac-phy.c
··· 13 13 /* Qualcomm Technologies, Inc. EMAC PHY Controller driver. 14 14 */ 15 15 16 - #include <linux/module.h> 17 - #include <linux/of.h> 18 - #include <linux/of_net.h> 19 16 #include <linux/of_mdio.h> 20 17 #include <linux/phy.h> 21 18 #include <linux/iopoll.h> 22 19 #include <linux/acpi.h> 23 20 #include "emac.h" 24 - #include "emac-mac.h" 25 21 26 22 /* EMAC base register offsets */ 27 23 #define EMAC_MDIO_CTRL 0x001414 ··· 48 52 49 53 #define MDIO_WAIT_TIMES 1000 50 54 51 - #define EMAC_LINK_SPEED_DEFAULT (\ 52 - EMAC_LINK_SPEED_10_HALF |\ 53 - EMAC_LINK_SPEED_10_FULL |\ 54 - EMAC_LINK_SPEED_100_HALF |\ 55 - EMAC_LINK_SPEED_100_FULL |\ 56 - EMAC_LINK_SPEED_1GB_FULL) 57 - 58 - /** 59 - * emac_phy_mdio_autopoll_disable() - disable mdio autopoll 60 - * @adpt: the emac adapter 61 - * 62 - * The autopoll feature takes over the MDIO bus. In order for 63 - * the PHY driver to be able to talk to the PHY over the MDIO 64 - * bus, we need to temporarily disable the autopoll feature. 65 - */ 66 - static int emac_phy_mdio_autopoll_disable(struct emac_adapter *adpt) 67 - { 68 - u32 val; 69 - 70 - /* disable autopoll */ 71 - emac_reg_update32(adpt->base + EMAC_MDIO_CTRL, MDIO_AP_EN, 0); 72 - 73 - /* wait for any mdio polling to complete */ 74 - if (!readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, val, 75 - !(val & MDIO_BUSY), 100, MDIO_WAIT_TIMES * 100)) 76 - return 0; 77 - 78 - /* failed to disable; ensure it is enabled before returning */ 79 - emac_reg_update32(adpt->base + EMAC_MDIO_CTRL, 0, MDIO_AP_EN); 80 - 81 - return -EBUSY; 82 - } 83 - 84 - /** 85 - * emac_phy_mdio_autopoll_disable() - disable mdio autopoll 86 - * @adpt: the emac adapter 87 - * 88 - * The EMAC has the ability to poll the external PHY on the MDIO 89 - * bus for link state changes. This eliminates the need for the 90 - * driver to poll the phy. If if the link state does change, 91 - * the EMAC issues an interrupt on behalf of the PHY. 92 - */ 93 - static void emac_phy_mdio_autopoll_enable(struct emac_adapter *adpt) 94 - { 95 - emac_reg_update32(adpt->base + EMAC_MDIO_CTRL, 0, MDIO_AP_EN); 96 - } 97 - 98 55 static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum) 99 56 { 100 57 struct emac_adapter *adpt = bus->priv; 101 58 u32 reg; 102 - int ret; 103 - 104 - ret = emac_phy_mdio_autopoll_disable(adpt); 105 - if (ret) 106 - return ret; 107 59 108 60 emac_reg_update32(adpt->base + EMAC_PHY_STS, PHY_ADDR_BMSK, 109 61 (addr << PHY_ADDR_SHFT)); ··· 66 122 if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg, 67 123 !(reg & (MDIO_START | MDIO_BUSY)), 68 124 100, MDIO_WAIT_TIMES * 100)) 69 - ret = -EIO; 70 - else 71 - ret = (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK; 125 + return -EIO; 72 126 73 - emac_phy_mdio_autopoll_enable(adpt); 74 - 75 - return ret; 127 + return (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK; 76 128 } 77 129 78 130 static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) 79 131 { 80 132 struct emac_adapter *adpt = bus->priv; 81 133 u32 reg; 82 - int ret; 83 - 84 - ret = emac_phy_mdio_autopoll_disable(adpt); 85 - if (ret) 86 - return ret; 87 134 88 135 emac_reg_update32(adpt->base + EMAC_PHY_STS, PHY_ADDR_BMSK, 89 136 (addr << PHY_ADDR_SHFT)); ··· 90 155 if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg, 91 156 !(reg & (MDIO_START | MDIO_BUSY)), 100, 92 157 MDIO_WAIT_TIMES * 100)) 93 - ret = -EIO; 158 + return -EIO; 94 159 95 - emac_phy_mdio_autopoll_enable(adpt); 96 - 97 - return ret; 160 + return 0; 98 161 } 99 162 100 163 /* Configure the MDIO bus and connect the external PHY */
+1 -21
drivers/net/ethernet/qualcomm/emac/emac.c
··· 50 50 #define DMAR_DLY_CNT_DEF 15 51 51 #define DMAW_DLY_CNT_DEF 4 52 52 53 - #define IMR_NORMAL_MASK (\ 54 - ISR_ERROR |\ 55 - ISR_GPHY_LINK |\ 56 - ISR_TX_PKT |\ 57 - GPHY_WAKEUP_INT) 58 - 59 - #define IMR_EXTENDED_MASK (\ 60 - SW_MAN_INT |\ 61 - ISR_OVER |\ 62 - ISR_ERROR |\ 63 - ISR_GPHY_LINK |\ 64 - ISR_TX_PKT |\ 65 - GPHY_WAKEUP_INT) 53 + #define IMR_NORMAL_MASK (ISR_ERROR | ISR_OVER | ISR_TX_PKT) 66 54 67 55 #define ISR_TX_PKT (\ 68 56 TX_PKT_INT |\ 69 57 TX_PKT_INT1 |\ 70 58 TX_PKT_INT2 |\ 71 59 TX_PKT_INT3) 72 - 73 - #define ISR_GPHY_LINK (\ 74 - GPHY_LINK_UP_INT |\ 75 - GPHY_LINK_DOWN_INT) 76 60 77 61 #define ISR_OVER (\ 78 62 RFD0_UR_INT |\ ··· 170 186 171 187 if (status & ISR_OVER) 172 188 net_warn_ratelimited("warning: TX/RX overflow\n"); 173 - 174 - /* link event */ 175 - if (status & ISR_GPHY_LINK) 176 - phy_mac_interrupt(adpt->phydev, !!(status & GPHY_LINK_UP_INT)); 177 189 178 190 exit: 179 191 /* enable the interrupt */
+12 -12
drivers/net/ethernet/renesas/ravb_main.c
··· 230 230 int ring_size; 231 231 int i; 232 232 233 - /* Free RX skb ringbuffer */ 234 - if (priv->rx_skb[q]) { 235 - for (i = 0; i < priv->num_rx_ring[q]; i++) 236 - dev_kfree_skb(priv->rx_skb[q][i]); 237 - } 238 - kfree(priv->rx_skb[q]); 239 - priv->rx_skb[q] = NULL; 240 - 241 - /* Free aligned TX buffers */ 242 - kfree(priv->tx_align[q]); 243 - priv->tx_align[q] = NULL; 244 - 245 233 if (priv->rx_ring[q]) { 246 234 for (i = 0; i < priv->num_rx_ring[q]; i++) { 247 235 struct ravb_ex_rx_desc *desc = &priv->rx_ring[q][i]; ··· 257 269 priv->tx_desc_dma[q]); 258 270 priv->tx_ring[q] = NULL; 259 271 } 272 + 273 + /* Free RX skb ringbuffer */ 274 + if (priv->rx_skb[q]) { 275 + for (i = 0; i < priv->num_rx_ring[q]; i++) 276 + dev_kfree_skb(priv->rx_skb[q][i]); 277 + } 278 + kfree(priv->rx_skb[q]); 279 + priv->rx_skb[q] = NULL; 280 + 281 + /* Free aligned TX buffers */ 282 + kfree(priv->tx_align[q]); 283 + priv->tx_align[q] = NULL; 260 284 261 285 /* Free TX skb ringbuffer. 262 286 * SKBs are freed by ravb_tx_free() call above.
+5 -1
drivers/net/ethernet/stmicro/stmmac/altr_tse_pcs.c
··· 37 37 #define TSE_PCS_CONTROL_AN_EN_MASK BIT(12) 38 38 #define TSE_PCS_CONTROL_REG 0x00 39 39 #define TSE_PCS_CONTROL_RESTART_AN_MASK BIT(9) 40 + #define TSE_PCS_CTRL_AUTONEG_SGMII 0x1140 40 41 #define TSE_PCS_IF_MODE_REG 0x28 41 42 #define TSE_PCS_LINK_TIMER_0_REG 0x24 42 43 #define TSE_PCS_LINK_TIMER_1_REG 0x26 ··· 66 65 #define TSE_PCS_SW_RESET_TIMEOUT 100 67 66 #define TSE_PCS_USE_SGMII_AN_MASK BIT(1) 68 67 #define TSE_PCS_USE_SGMII_ENA BIT(0) 68 + #define TSE_PCS_IF_USE_SGMII 0x03 69 69 70 70 #define SGMII_ADAPTER_CTRL_REG 0x00 71 71 #define SGMII_ADAPTER_DISABLE 0x0001 ··· 103 101 { 104 102 int ret = 0; 105 103 106 - writew(TSE_PCS_USE_SGMII_ENA, base + TSE_PCS_IF_MODE_REG); 104 + writew(TSE_PCS_IF_USE_SGMII, base + TSE_PCS_IF_MODE_REG); 105 + 106 + writew(TSE_PCS_CTRL_AUTONEG_SGMII, base + TSE_PCS_CONTROL_REG); 107 107 108 108 writew(TSE_PCS_SGMII_LINK_TIMER_0, base + TSE_PCS_LINK_TIMER_0_REG); 109 109 writew(TSE_PCS_SGMII_LINK_TIMER_1, base + TSE_PCS_LINK_TIMER_1_REG);
+4 -3
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 1208 1208 u32 rx_count = priv->plat->rx_queues_to_use; 1209 1209 unsigned int bfsize = 0; 1210 1210 int ret = -ENOMEM; 1211 - u32 queue; 1211 + int queue; 1212 1212 int i; 1213 1213 1214 1214 if (priv->hw->mode->set_16kib_bfsize) ··· 2724 2724 2725 2725 priv->hw->desc->prepare_tso_tx_desc(desc, 0, buff_size, 2726 2726 0, 1, 2727 - (last_segment) && (buff_size < TSO_MAX_BUFF_SIZE), 2727 + (last_segment) && (tmp_len <= TSO_MAX_BUFF_SIZE), 2728 2728 0, 0); 2729 2729 2730 2730 tmp_len -= TSO_MAX_BUFF_SIZE; ··· 2947 2947 int i, csum_insertion = 0, is_jumbo = 0; 2948 2948 u32 queue = skb_get_queue_mapping(skb); 2949 2949 int nfrags = skb_shinfo(skb)->nr_frags; 2950 - unsigned int entry, first_entry; 2950 + int entry; 2951 + unsigned int first_entry; 2951 2952 struct dma_desc *desc, *first; 2952 2953 struct stmmac_tx_queue *tx_q; 2953 2954 unsigned int enh_desc;
+1 -1
drivers/net/geneve.c
··· 1133 1133 1134 1134 /* make enough headroom for basic scenario */ 1135 1135 encap_len = GENEVE_BASE_HLEN + ETH_HLEN; 1136 - if (ip_tunnel_info_af(info) == AF_INET) { 1136 + if (!metadata && ip_tunnel_info_af(info) == AF_INET) { 1137 1137 encap_len += sizeof(struct iphdr); 1138 1138 dev->max_mtu -= sizeof(struct iphdr); 1139 1139 } else {
+2
drivers/net/hamradio/hdlcdrv.c
··· 576 576 case HDLCDRVCTL_CALIBRATE: 577 577 if(!capable(CAP_SYS_RAWIO)) 578 578 return -EPERM; 579 + if (s->par.bitrate <= 0) 580 + return -EINVAL; 579 581 if (bi.data.calibrate > INT_MAX / s->par.bitrate) 580 582 return -EINVAL; 581 583 s->hdlctx.calibrate = bi.data.calibrate * s->par.bitrate / 16;
-2
drivers/net/phy/marvell.c
··· 1127 1127 if (adv < 0) 1128 1128 return adv; 1129 1129 1130 - lpa &= adv; 1131 - 1132 1130 if (status & MII_M1011_PHY_STATUS_FULLDUPLEX) 1133 1131 phydev->duplex = DUPLEX_FULL; 1134 1132 else
+13
drivers/net/phy/mdio_bus.c
··· 658 658 return 0; 659 659 } 660 660 661 + static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env) 662 + { 663 + int rc; 664 + 665 + /* Some devices have extra OF data and an OF-style MODALIAS */ 666 + rc = of_device_uevent_modalias(dev, env); 667 + if (rc != -ENODEV) 668 + return rc; 669 + 670 + return 0; 671 + } 672 + 661 673 #ifdef CONFIG_PM 662 674 static int mdio_bus_suspend(struct device *dev) 663 675 { ··· 720 708 struct bus_type mdio_bus_type = { 721 709 .name = "mdio_bus", 722 710 .match = mdio_bus_match, 711 + .uevent = mdio_uevent, 723 712 .pm = MDIO_BUS_PM_OPS, 724 713 }; 725 714 EXPORT_SYMBOL(mdio_bus_type);
+28 -14
drivers/net/phy/micrel.c
··· 268 268 return ret; 269 269 } 270 270 271 + /* Some config bits need to be set again on resume, handle them here. */ 272 + static int kszphy_config_reset(struct phy_device *phydev) 273 + { 274 + struct kszphy_priv *priv = phydev->priv; 275 + int ret; 276 + 277 + if (priv->rmii_ref_clk_sel) { 278 + ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val); 279 + if (ret) { 280 + phydev_err(phydev, 281 + "failed to set rmii reference clock\n"); 282 + return ret; 283 + } 284 + } 285 + 286 + if (priv->led_mode >= 0) 287 + kszphy_setup_led(phydev, priv->type->led_mode_reg, priv->led_mode); 288 + 289 + return 0; 290 + } 291 + 271 292 static int kszphy_config_init(struct phy_device *phydev) 272 293 { 273 294 struct kszphy_priv *priv = phydev->priv; 274 295 const struct kszphy_type *type; 275 - int ret; 276 296 277 297 if (!priv) 278 298 return 0; ··· 305 285 if (type->has_nand_tree_disable) 306 286 kszphy_nand_tree_disable(phydev); 307 287 308 - if (priv->rmii_ref_clk_sel) { 309 - ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val); 310 - if (ret) { 311 - phydev_err(phydev, 312 - "failed to set rmii reference clock\n"); 313 - return ret; 314 - } 315 - } 316 - 317 - if (priv->led_mode >= 0) 318 - kszphy_setup_led(phydev, type->led_mode_reg, priv->led_mode); 319 - 320 - return 0; 288 + return kszphy_config_reset(phydev); 321 289 } 322 290 323 291 static int ksz8041_config_init(struct phy_device *phydev) ··· 708 700 709 701 static int kszphy_resume(struct phy_device *phydev) 710 702 { 703 + int ret; 704 + 711 705 genphy_resume(phydev); 706 + 707 + ret = kszphy_config_reset(phydev); 708 + if (ret) 709 + return ret; 712 710 713 711 /* Enable PHY Interrupts */ 714 712 if (phy_interrupt_is_valid(phydev)) {
+1 -1
drivers/net/phy/phy.c
··· 241 241 * phy_lookup_setting - lookup a PHY setting 242 242 * @speed: speed to match 243 243 * @duplex: duplex to match 244 - * @feature: allowed link modes 244 + * @features: allowed link modes 245 245 * @exact: an exact match is required 246 246 * 247 247 * Search the settings array for a setting that matches the speed and
+3 -2
drivers/net/virtio_net.c
··· 869 869 unsigned int len; 870 870 871 871 len = hdr_len + clamp_t(unsigned int, ewma_pkt_len_read(avg_pkt_len), 872 - rq->min_buf_len - hdr_len, PAGE_SIZE - hdr_len); 872 + rq->min_buf_len, PAGE_SIZE - hdr_len); 873 873 return ALIGN(len, L1_CACHE_BYTES); 874 874 } 875 875 ··· 2144 2144 unsigned int buf_len = hdr_len + ETH_HLEN + VLAN_HLEN + packet_len; 2145 2145 unsigned int min_buf_len = DIV_ROUND_UP(buf_len, rq_size); 2146 2146 2147 - return max(min_buf_len, hdr_len); 2147 + return max(max(min_buf_len, hdr_len) - hdr_len, 2148 + (unsigned int)GOOD_PACKET_LEN); 2148 2149 } 2149 2150 2150 2151 static int virtnet_find_vqs(struct virtnet_info *vi)
+30 -9
drivers/net/vxlan.c
··· 59 59 60 60 static int vxlan_sock_add(struct vxlan_dev *vxlan); 61 61 62 + static void vxlan_vs_del_dev(struct vxlan_dev *vxlan); 63 + 62 64 /* per-network namespace private data for this module */ 63 65 struct vxlan_net { 64 66 struct list_head vxlan_list; ··· 742 740 call_rcu(&f->rcu, vxlan_fdb_free); 743 741 } 744 742 743 + static void vxlan_dst_free(struct rcu_head *head) 744 + { 745 + struct vxlan_rdst *rd = container_of(head, struct vxlan_rdst, rcu); 746 + 747 + dst_cache_destroy(&rd->dst_cache); 748 + kfree(rd); 749 + } 750 + 751 + static void vxlan_fdb_dst_destroy(struct vxlan_dev *vxlan, struct vxlan_fdb *f, 752 + struct vxlan_rdst *rd) 753 + { 754 + list_del_rcu(&rd->list); 755 + vxlan_fdb_notify(vxlan, f, rd, RTM_DELNEIGH); 756 + call_rcu(&rd->rcu, vxlan_dst_free); 757 + } 758 + 745 759 static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan, 746 760 union vxlan_addr *ip, __be16 *port, __be32 *src_vni, 747 761 __be32 *vni, u32 *ifindex) ··· 882 864 * otherwise destroy the fdb entry 883 865 */ 884 866 if (rd && !list_is_singular(&f->remotes)) { 885 - list_del_rcu(&rd->list); 886 - vxlan_fdb_notify(vxlan, f, rd, RTM_DELNEIGH); 887 - kfree_rcu(rd, rcu); 867 + vxlan_fdb_dst_destroy(vxlan, f, rd); 888 868 goto out; 889 869 } 890 870 ··· 1082 1066 1083 1067 rcu_assign_pointer(vxlan->vn4_sock, NULL); 1084 1068 synchronize_net(); 1069 + 1070 + vxlan_vs_del_dev(vxlan); 1085 1071 1086 1072 if (__vxlan_sock_release_prep(sock4)) { 1087 1073 udp_tunnel_sock_release(sock4->sock); ··· 2360 2342 mod_timer(&vxlan->age_timer, next_timer); 2361 2343 } 2362 2344 2345 + static void vxlan_vs_del_dev(struct vxlan_dev *vxlan) 2346 + { 2347 + struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); 2348 + 2349 + spin_lock(&vn->sock_lock); 2350 + hlist_del_init_rcu(&vxlan->hlist); 2351 + spin_unlock(&vn->sock_lock); 2352 + } 2353 + 2363 2354 static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan) 2364 2355 { 2365 2356 struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); ··· 3313 3286 static void vxlan_dellink(struct net_device *dev, struct list_head *head) 3314 3287 { 3315 3288 struct vxlan_dev *vxlan = netdev_priv(dev); 3316 - struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); 3317 3289 3318 3290 vxlan_flush(vxlan, true); 3319 - 3320 - spin_lock(&vn->sock_lock); 3321 - if (!hlist_unhashed(&vxlan->hlist)) 3322 - hlist_del_rcu(&vxlan->hlist); 3323 - spin_unlock(&vn->sock_lock); 3324 3291 3325 3292 gro_cells_destroy(&vxlan->gro_cells); 3326 3293 list_del(&vxlan->next);
+2
drivers/net/wireless/ath/wcn36xx/main.c
··· 1271 1271 qcom_smem_state_put(wcn->tx_enable_state); 1272 1272 qcom_smem_state_put(wcn->tx_rings_empty_state); 1273 1273 1274 + rpmsg_destroy_ept(wcn->smd_channel); 1275 + 1274 1276 iounmap(wcn->dxe_base); 1275 1277 iounmap(wcn->ccu_base); 1276 1278
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
··· 3422 3422 /* otherwise, set txglomalign */ 3423 3423 value = sdiodev->settings->bus.sdio.sd_sgentry_align; 3424 3424 /* SDIO ADMA requires at least 32 bit alignment */ 3425 - value = max_t(u32, value, 4); 3425 + value = max_t(u32, value, ALIGNMENT); 3426 3426 err = brcmf_iovar_data_set(dev, "bus:txglomalign", &value, 3427 3427 sizeof(u32)); 3428 3428 }
+2 -2
drivers/net/wireless/intel/iwlwifi/iwl-7000.c
··· 79 79 /* Lowest firmware API version supported */ 80 80 #define IWL7260_UCODE_API_MIN 17 81 81 #define IWL7265_UCODE_API_MIN 17 82 - #define IWL7265D_UCODE_API_MIN 17 83 - #define IWL3168_UCODE_API_MIN 20 82 + #define IWL7265D_UCODE_API_MIN 22 83 + #define IWL3168_UCODE_API_MIN 22 84 84 85 85 /* NVM versions */ 86 86 #define IWL7260_NVM_VERSION 0x0a1d
+2 -2
drivers/net/wireless/intel/iwlwifi/iwl-8000.c
··· 74 74 #define IWL8265_UCODE_API_MAX 30 75 75 76 76 /* Lowest firmware API version supported */ 77 - #define IWL8000_UCODE_API_MIN 17 78 - #define IWL8265_UCODE_API_MIN 20 77 + #define IWL8000_UCODE_API_MIN 22 78 + #define IWL8265_UCODE_API_MIN 22 79 79 80 80 /* NVM versions */ 81 81 #define IWL8000_NVM_VERSION 0x0a1d
+1
drivers/net/wireless/intel/iwlwifi/iwl-prph.h
··· 370 370 #define MON_DMARB_RD_DATA_ADDR (0xa03c5c) 371 371 372 372 #define DBGC_IN_SAMPLE (0xa03c00) 373 + #define DBGC_OUT_CTRL (0xa03c0c) 373 374 374 375 /* enable the ID buf for read */ 375 376 #define WFPM_PS_CTL_CLR 0xA0300C
+5
drivers/net/wireless/intel/iwlwifi/mvm/fw-api-rs.h
··· 307 307 /* Bit 1-3: LQ command color. Used to match responses to LQ commands */ 308 308 #define LQ_FLAG_COLOR_POS 1 309 309 #define LQ_FLAG_COLOR_MSK (7 << LQ_FLAG_COLOR_POS) 310 + #define LQ_FLAG_COLOR_GET(_f) (((_f) & LQ_FLAG_COLOR_MSK) >>\ 311 + LQ_FLAG_COLOR_POS) 312 + #define LQ_FLAGS_COLOR_INC(_c) ((((_c) + 1) << LQ_FLAG_COLOR_POS) &\ 313 + LQ_FLAG_COLOR_MSK) 314 + #define LQ_FLAG_COLOR_SET(_f, _c) ((_c) | ((_f) & ~LQ_FLAG_COLOR_MSK)) 310 315 311 316 /* Bit 4-5: Tx RTS BW Signalling 312 317 * (0) No RTS BW signalling
+3
drivers/net/wireless/intel/iwlwifi/mvm/fw-api-tx.h
··· 519 519 * bit-7 invalid rate indication 520 520 */ 521 521 #define TX_RES_INIT_RATE_INDEX_MSK 0x0f 522 + #define TX_RES_RATE_TABLE_COLOR_POS 4 522 523 #define TX_RES_RATE_TABLE_COLOR_MSK 0x70 523 524 #define TX_RES_INV_RATE_INDEX_MSK 0x80 525 + #define TX_RES_RATE_TABLE_COL_GET(_f) (((_f) & TX_RES_RATE_TABLE_COLOR_MSK) >>\ 526 + TX_RES_RATE_TABLE_COLOR_POS) 524 527 525 528 #define IWL_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f) 526 529 #define IWL_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4)
+1 -11
drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
··· 1002 1002 return 0; 1003 1003 } 1004 1004 1005 - static inline void iwl_mvm_restart_early_start(struct iwl_mvm *mvm) 1006 - { 1007 - if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) 1008 - iwl_clear_bits_prph(mvm->trans, MON_BUFF_SAMPLE_CTL, 0x100); 1009 - else 1010 - iwl_write_prph(mvm->trans, DBGC_IN_SAMPLE, 1); 1011 - } 1012 - 1013 1005 int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm *mvm, u8 conf_id) 1014 1006 { 1015 1007 u8 *ptr; ··· 1015 1023 /* EARLY START - firmware's configuration is hard coded */ 1016 1024 if ((!mvm->fw->dbg_conf_tlv[conf_id] || 1017 1025 !mvm->fw->dbg_conf_tlv[conf_id]->num_of_hcmds) && 1018 - conf_id == FW_DBG_START_FROM_ALIVE) { 1019 - iwl_mvm_restart_early_start(mvm); 1026 + conf_id == FW_DBG_START_FROM_ALIVE) 1020 1027 return 0; 1021 - } 1022 1028 1023 1029 if (!mvm->fw->dbg_conf_tlv[conf_id]) 1024 1030 return -EINVAL;
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
··· 1040 1040 struct iwl_mac_beacon_cmd_v6 beacon_cmd_v6; 1041 1041 struct iwl_mac_beacon_cmd_v7 beacon_cmd; 1042 1042 } u = {}; 1043 - struct iwl_mac_beacon_cmd beacon_cmd; 1043 + struct iwl_mac_beacon_cmd beacon_cmd = {}; 1044 1044 struct ieee80211_tx_info *info; 1045 1045 u32 beacon_skb_len; 1046 1046 u32 rate, tx_flags;
+5 -1
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 1730 1730 */ 1731 1731 static inline u32 iwl_mvm_flushable_queues(struct iwl_mvm *mvm) 1732 1732 { 1733 + u32 cmd_queue = iwl_mvm_is_dqa_supported(mvm) ? IWL_MVM_DQA_CMD_QUEUE : 1734 + IWL_MVM_CMD_QUEUE; 1735 + 1733 1736 return ((BIT(mvm->cfg->base_params->num_of_queues) - 1) & 1734 - ~BIT(IWL_MVM_CMD_QUEUE)); 1737 + ~BIT(cmd_queue)); 1735 1738 } 1736 1739 1737 1740 static inline ··· 1756 1753 if (!iwl_mvm_has_new_tx_api(mvm)) 1757 1754 iwl_free_fw_paging(mvm); 1758 1755 mvm->ucode_loaded = false; 1756 + mvm->fw_dbg_conf = FW_DBG_INVALID; 1759 1757 iwl_trans_stop_device(mvm->trans); 1760 1758 } 1761 1759
+25 -9
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
··· 1149 1149 1150 1150 mutex_lock(&mvm->mutex); 1151 1151 1152 - /* stop recording */ 1153 1152 if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) { 1153 + /* stop recording */ 1154 1154 iwl_set_bits_prph(mvm->trans, MON_BUFF_SAMPLE_CTL, 0x100); 1155 + 1156 + iwl_mvm_fw_error_dump(mvm); 1157 + 1158 + /* start recording again if the firmware is not crashed */ 1159 + if (!test_bit(STATUS_FW_ERROR, &mvm->trans->status) && 1160 + mvm->fw->dbg_dest_tlv) 1161 + iwl_clear_bits_prph(mvm->trans, 1162 + MON_BUFF_SAMPLE_CTL, 0x100); 1155 1163 } else { 1164 + u32 in_sample = iwl_read_prph(mvm->trans, DBGC_IN_SAMPLE); 1165 + u32 out_ctrl = iwl_read_prph(mvm->trans, DBGC_OUT_CTRL); 1166 + 1167 + /* stop recording */ 1156 1168 iwl_write_prph(mvm->trans, DBGC_IN_SAMPLE, 0); 1157 - /* wait before we collect the data till the DBGC stop */ 1158 1169 udelay(100); 1170 + iwl_write_prph(mvm->trans, DBGC_OUT_CTRL, 0); 1171 + /* wait before we collect the data till the DBGC stop */ 1172 + udelay(500); 1173 + 1174 + iwl_mvm_fw_error_dump(mvm); 1175 + 1176 + /* start recording again if the firmware is not crashed */ 1177 + if (!test_bit(STATUS_FW_ERROR, &mvm->trans->status) && 1178 + mvm->fw->dbg_dest_tlv) { 1179 + iwl_write_prph(mvm->trans, DBGC_IN_SAMPLE, in_sample); 1180 + iwl_write_prph(mvm->trans, DBGC_OUT_CTRL, out_ctrl); 1181 + } 1159 1182 } 1160 - 1161 - iwl_mvm_fw_error_dump(mvm); 1162 - 1163 - /* start recording again if the firmware is not crashed */ 1164 - WARN_ON_ONCE((!test_bit(STATUS_FW_ERROR, &mvm->trans->status)) && 1165 - mvm->fw->dbg_dest_tlv && 1166 - iwl_mvm_start_fw_dbg_conf(mvm, mvm->fw_dbg_conf)); 1167 1183 1168 1184 mutex_unlock(&mvm->mutex); 1169 1185
+11 -35
drivers/net/wireless/intel/iwlwifi/mvm/rs.c
··· 2 2 * 3 3 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 4 4 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 5 - * Copyright(c) 2016 Intel Deutschland GmbH 5 + * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify it 8 8 * under the terms of version 2 of the GNU General Public License as ··· 1083 1083 rs_get_lower_rate_in_column(lq_sta, rate); 1084 1084 } 1085 1085 1086 - /* Check if both rates are identical 1087 - * allow_ant_mismatch enables matching a SISO rate on ANT_A or ANT_B 1088 - * with a rate indicating STBC/BFER and ANT_AB. 1089 - */ 1090 - static inline bool rs_rate_equal(struct rs_rate *a, 1091 - struct rs_rate *b, 1092 - bool allow_ant_mismatch) 1093 - 1094 - { 1095 - bool ant_match = (a->ant == b->ant) && (a->stbc == b->stbc) && 1096 - (a->bfer == b->bfer); 1097 - 1098 - if (allow_ant_mismatch) { 1099 - if (a->stbc || a->bfer) { 1100 - WARN_ONCE(a->ant != ANT_AB, "stbc %d bfer %d ant %d", 1101 - a->stbc, a->bfer, a->ant); 1102 - ant_match |= (b->ant == ANT_A || b->ant == ANT_B); 1103 - } else if (b->stbc || b->bfer) { 1104 - WARN_ONCE(b->ant != ANT_AB, "stbc %d bfer %d ant %d", 1105 - b->stbc, b->bfer, b->ant); 1106 - ant_match |= (a->ant == ANT_A || a->ant == ANT_B); 1107 - } 1108 - } 1109 - 1110 - return (a->type == b->type) && (a->bw == b->bw) && (a->sgi == b->sgi) && 1111 - (a->ldpc == b->ldpc) && (a->index == b->index) && ant_match; 1112 - } 1113 - 1114 1086 /* Check if both rates share the same column */ 1115 1087 static inline bool rs_rate_column_match(struct rs_rate *a, 1116 1088 struct rs_rate *b) ··· 1154 1182 u32 lq_hwrate; 1155 1183 struct rs_rate lq_rate, tx_resp_rate; 1156 1184 struct iwl_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; 1157 - u8 reduced_txp = (uintptr_t)info->status.status_driver_data[0]; 1185 + u32 tlc_info = (uintptr_t)info->status.status_driver_data[0]; 1186 + u8 reduced_txp = tlc_info & RS_DRV_DATA_TXP_MSK; 1187 + u8 lq_color = RS_DRV_DATA_LQ_COLOR_GET(tlc_info); 1158 1188 u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1]; 1159 1189 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 1160 1190 struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta; 1161 - bool allow_ant_mismatch = fw_has_api(&mvm->fw->ucode_capa, 1162 - IWL_UCODE_TLV_API_LQ_SS_PARAMS); 1163 1191 1164 1192 /* Treat uninitialized rate scaling data same as non-existing. */ 1165 1193 if (!lq_sta) { ··· 1234 1262 rs_rate_from_ucode_rate(lq_hwrate, info->band, &lq_rate); 1235 1263 1236 1264 /* Here we actually compare this rate to the latest LQ command */ 1237 - if (!rs_rate_equal(&tx_resp_rate, &lq_rate, allow_ant_mismatch)) { 1265 + if (lq_color != LQ_FLAG_COLOR_GET(table->flags)) { 1238 1266 IWL_DEBUG_RATE(mvm, 1239 - "initial tx resp rate 0x%x does not match 0x%x\n", 1240 - tx_resp_hwrate, lq_hwrate); 1267 + "tx resp color 0x%x does not match 0x%x\n", 1268 + lq_color, LQ_FLAG_COLOR_GET(table->flags)); 1241 1269 1242 1270 /* 1243 1271 * Since rates mis-match, the last LQ command may have failed. ··· 3298 3326 u8 valid_tx_ant = 0; 3299 3327 struct iwl_lq_cmd *lq_cmd = &lq_sta->lq; 3300 3328 bool toggle_ant = false; 3329 + u32 color; 3301 3330 3302 3331 memcpy(&rate, initial_rate, sizeof(rate)); 3303 3332 ··· 3353 3380 num_rates, num_retries, valid_tx_ant, 3354 3381 toggle_ant); 3355 3382 3383 + /* update the color of the LQ command (as a counter at bits 1-3) */ 3384 + color = LQ_FLAGS_COLOR_INC(LQ_FLAG_COLOR_GET(lq_cmd->flags)); 3385 + lq_cmd->flags = LQ_FLAG_COLOR_SET(lq_cmd->flags, color); 3356 3386 } 3357 3387 3358 3388 struct rs_bfer_active_iter_data {
+15
drivers/net/wireless/intel/iwlwifi/mvm/rs.h
··· 2 2 * 3 3 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 4 4 * Copyright(c) 2015 Intel Mobile Communications GmbH 5 + * Copyright(c) 2017 Intel Deutschland GmbH 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify it 7 8 * under the terms of version 2 of the GNU General Public License as ··· 357 356 struct iwl_mvm *drv; 358 357 } pers; 359 358 }; 359 + 360 + /* ieee80211_tx_info's status_driver_data[0] is packed with lq color and txp 361 + * Note, it's iwlmvm <-> mac80211 interface. 362 + * bits 0-7: reduced tx power 363 + * bits 8-10: LQ command's color 364 + */ 365 + #define RS_DRV_DATA_TXP_MSK 0xff 366 + #define RS_DRV_DATA_LQ_COLOR_POS 8 367 + #define RS_DRV_DATA_LQ_COLOR_MSK (7 << RS_DRV_DATA_LQ_COLOR_POS) 368 + #define RS_DRV_DATA_LQ_COLOR_GET(_f) (((_f) & RS_DRV_DATA_LQ_COLOR_MSK) >>\ 369 + RS_DRV_DATA_LQ_COLOR_POS) 370 + #define RS_DRV_DATA_PACK(_c, _p) ((void *)(uintptr_t)\ 371 + (((uintptr_t)_p) |\ 372 + ((_c) << RS_DRV_DATA_LQ_COLOR_POS))) 360 373 361 374 /* Initialize station's rate scaling information after adding station */ 362 375 void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
+17 -9
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 2120 2120 if (!iwl_mvm_is_dqa_supported(mvm)) 2121 2121 return 0; 2122 2122 2123 - if (WARN_ON(vif->type != NL80211_IFTYPE_AP)) 2123 + if (WARN_ON(vif->type != NL80211_IFTYPE_AP && 2124 + vif->type != NL80211_IFTYPE_ADHOC)) 2124 2125 return -ENOTSUPP; 2125 2126 2126 2127 /* ··· 2156 2155 mvmvif->cab_queue = queue; 2157 2156 } else if (!fw_has_api(&mvm->fw->ucode_capa, 2158 2157 IWL_UCODE_TLV_API_STA_TYPE)) { 2158 + /* 2159 + * In IBSS, ieee80211_check_queues() sets the cab_queue to be 2160 + * invalid, so make sure we use the queue we want. 2161 + * Note that this is done here as we want to avoid making DQA 2162 + * changes in mac80211 layer. 2163 + */ 2164 + if (vif->type == NL80211_IFTYPE_ADHOC) { 2165 + vif->cab_queue = IWL_MVM_DQA_GCAST_QUEUE; 2166 + mvmvif->cab_queue = vif->cab_queue; 2167 + } 2159 2168 iwl_mvm_enable_txq(mvm, vif->cab_queue, vif->cab_queue, 0, 2160 2169 &cfg, timeout); 2161 2170 } ··· 3332 3321 3333 3322 /* Get the station from the mvm local station table */ 3334 3323 mvm_sta = iwl_mvm_get_key_sta(mvm, vif, sta); 3335 - if (!mvm_sta) { 3336 - IWL_ERR(mvm, "Failed to find station\n"); 3337 - return -EINVAL; 3338 - } 3339 - sta_id = mvm_sta->sta_id; 3324 + if (mvm_sta) 3325 + sta_id = mvm_sta->sta_id; 3340 3326 3341 3327 IWL_DEBUG_WEP(mvm, "mvm remove dynamic key: idx=%d sta=%d\n", 3342 3328 keyconf->keyidx, sta_id); 3343 3329 3344 - if (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC || 3345 - keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || 3346 - keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256) 3330 + if (mvm_sta && (keyconf->cipher == WLAN_CIPHER_SUITE_AES_CMAC || 3331 + keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || 3332 + keyconf->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256)) 3347 3333 return iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, true); 3348 3334 3349 3335 if (!__test_and_clear_bit(keyconf->hw_key_idx, mvm->fw_key_table)) {
+2
drivers/net/wireless/intel/iwlwifi/mvm/sta.h
··· 313 313 * This is basically (last acked packet++). 314 314 * @rate_n_flags: Rate at which Tx was attempted. Holds the data between the 315 315 * Tx response (TX_CMD), and the block ack notification (COMPRESSED_BA). 316 + * @lq_color: the color of the LQ command as it appears in tx response. 316 317 * @amsdu_in_ampdu_allowed: true if A-MSDU in A-MPDU is allowed. 317 318 * @state: state of the BA agreement establishment / tear down. 318 319 * @txq_id: Tx queue used by the BA session / DQA ··· 332 331 u16 next_reclaimed; 333 332 /* The rest is Tx AGG related */ 334 333 u32 rate_n_flags; 334 + u8 lq_color; 335 335 bool amsdu_in_ampdu_allowed; 336 336 enum iwl_mvm_agg_state state; 337 337 u16 txq_id;
+5 -3
drivers/net/wireless/intel/iwlwifi/mvm/tt.c
··· 790 790 struct iwl_mvm *mvm = (struct iwl_mvm *)(cdev->devdata); 791 791 int ret; 792 792 793 - if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR)) 794 - return -EIO; 795 - 796 793 mutex_lock(&mvm->mutex); 794 + 795 + if (!mvm->ucode_loaded || !(mvm->cur_ucode == IWL_UCODE_REGULAR)) { 796 + ret = -EIO; 797 + goto unlock; 798 + } 797 799 798 800 if (new_state >= ARRAY_SIZE(iwl_mvm_cdev_budgets)) { 799 801 ret = -EINVAL;
+11 -1
drivers/net/wireless/intel/iwlwifi/mvm/tx.c
··· 1323 1323 struct iwl_mvm_sta *mvmsta; 1324 1324 struct sk_buff_head skbs; 1325 1325 u8 skb_freed = 0; 1326 + u8 lq_color; 1326 1327 u16 next_reclaimed, seq_ctl; 1327 1328 bool is_ndp = false; 1328 1329 ··· 1406 1405 info->status.tx_time = 1407 1406 le16_to_cpu(tx_resp->wireless_media_time); 1408 1407 BUILD_BUG_ON(ARRAY_SIZE(info->status.status_driver_data) < 1); 1408 + lq_color = TX_RES_RATE_TABLE_COL_GET(tx_resp->tlc_info); 1409 1409 info->status.status_driver_data[0] = 1410 - (void *)(uintptr_t)tx_resp->reduced_tpc; 1410 + RS_DRV_DATA_PACK(lq_color, tx_resp->reduced_tpc); 1411 1411 1412 1412 ieee80211_tx_status(mvm->hw, skb); 1413 1413 } ··· 1640 1638 le32_to_cpu(tx_resp->initial_rate); 1641 1639 mvmsta->tid_data[tid].tx_time = 1642 1640 le16_to_cpu(tx_resp->wireless_media_time); 1641 + mvmsta->tid_data[tid].lq_color = 1642 + (tx_resp->tlc_info & TX_RES_RATE_TABLE_COLOR_MSK) >> 1643 + TX_RES_RATE_TABLE_COLOR_POS; 1643 1644 } 1644 1645 1645 1646 rcu_read_unlock(); ··· 1712 1707 iwl_mvm_check_ratid_empty(mvm, sta, tid); 1713 1708 1714 1709 freed = 0; 1710 + 1711 + /* pack lq color from tid_data along the reduced txp */ 1712 + ba_info->status.status_driver_data[0] = 1713 + RS_DRV_DATA_PACK(tid_data->lq_color, 1714 + ba_info->status.status_driver_data[0]); 1715 1715 ba_info->status.status_driver_data[1] = (void *)(uintptr_t)rate; 1716 1716 1717 1717 skb_queue_walk(&reclaimed_skbs, skb) {
+4 -2
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 2803 2803 #ifdef CONFIG_PM_SLEEP 2804 2804 static int iwl_trans_pcie_suspend(struct iwl_trans *trans) 2805 2805 { 2806 - if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3) 2806 + if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3 && 2807 + (trans->system_pm_mode == IWL_PLAT_PM_MODE_D0I3)) 2807 2808 return iwl_pci_fw_enter_d0i3(trans); 2808 2809 2809 2810 return 0; ··· 2812 2811 2813 2812 static void iwl_trans_pcie_resume(struct iwl_trans *trans) 2814 2813 { 2815 - if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3) 2814 + if (trans->runtime_pm_mode == IWL_PLAT_PM_MODE_D0I3 && 2815 + (trans->system_pm_mode == IWL_PLAT_PM_MODE_D0I3)) 2816 2816 iwl_pci_fw_exit_d0i3(trans); 2817 2817 } 2818 2818 #endif /* CONFIG_PM_SLEEP */
+6 -3
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
··· 906 906 907 907 if (WARN_ON(iwl_rx_packet_payload_len(hcmd.resp_pkt) != sizeof(*rsp))) { 908 908 ret = -EINVAL; 909 - goto error; 909 + goto error_free_resp; 910 910 } 911 911 912 912 rsp = (void *)hcmd.resp_pkt->data; ··· 915 915 if (qid > ARRAY_SIZE(trans_pcie->txq)) { 916 916 WARN_ONCE(1, "queue index %d unsupported", qid); 917 917 ret = -EIO; 918 - goto error; 918 + goto error_free_resp; 919 919 } 920 920 921 921 if (test_and_set_bit(qid, trans_pcie->queue_used)) { 922 922 WARN_ONCE(1, "queue %d already used", qid); 923 923 ret = -EIO; 924 - goto error; 924 + goto error_free_resp; 925 925 } 926 926 927 927 txq->id = qid; ··· 934 934 (txq->write_ptr) | (qid << 16)); 935 935 IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d\n", qid); 936 936 937 + iwl_free_resp(&hcmd); 937 938 return qid; 938 939 940 + error_free_resp: 941 + iwl_free_resp(&hcmd); 939 942 error: 940 943 iwl_pcie_gen2_txq_free_memory(trans, txq); 941 944 return ret;
+14 -7
drivers/nvme/host/core.c
··· 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 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 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 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; 1415 + 1416 + total_latency_us = 1417 + exit_latency_us + 1418 + le32_to_cpu(ctrl->psd[state].entry_lat); 1416 1419 1417 1420 /* 1418 1421 * This state is good. Use it as the APST idle ··· 2441 2438 struct nvme_ns *ns; 2442 2439 2443 2440 mutex_lock(&ctrl->namespaces_mutex); 2441 + 2442 + /* Forcibly start all queues to avoid having stuck requests */ 2443 + blk_mq_start_hw_queues(ctrl->admin_q); 2444 + 2444 2445 list_for_each_entry(ns, &ctrl->namespaces, list) { 2445 2446 /* 2446 2447 * Revalidating a dead namespace sets capacity to 0. This will
+18 -2
drivers/nvme/host/fc.c
··· 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) ··· 1266 1265 struct nvme_command *sqe = &op->cmd_iu.sqe; 1267 1266 __le16 status = cpu_to_le16(NVME_SC_SUCCESS << 1); 1268 1267 union nvme_result result; 1269 - bool complete_rq; 1268 + bool complete_rq, terminate_assoc = true; 1270 1269 1271 1270 /* 1272 1271 * WARNING: ··· 1295 1294 * fabricate a CQE, the following fields will not be set as they 1296 1295 * are not referenced: 1297 1296 * cqe.sqid, cqe.sqhd, cqe.command_id 1297 + * 1298 + * Failure or error of an individual i/o, in a transport 1299 + * detected fashion unrelated to the nvme completion status, 1300 + * potentially cause the initiator and target sides to get out 1301 + * of sync on SQ head/tail (aka outstanding io count allowed). 1302 + * Per FC-NVME spec, failure of an individual command requires 1303 + * the connection to be terminated, which in turn requires the 1304 + * association to be terminated. 1298 1305 */ 1299 1306 1300 1307 fc_dma_sync_single_for_cpu(ctrl->lport->dev, op->fcp_req.rspdma, ··· 1368 1359 goto done; 1369 1360 } 1370 1361 1362 + terminate_assoc = false; 1363 + 1371 1364 done: 1372 1365 if (op->flags & FCOP_FLAGS_AEN) { 1373 1366 nvme_complete_async_event(&queue->ctrl->ctrl, status, &result); ··· 1377 1366 atomic_set(&op->state, FCPOP_STATE_IDLE); 1378 1367 op->flags = FCOP_FLAGS_AEN; /* clear other flags */ 1379 1368 nvme_fc_ctrl_put(ctrl); 1380 - return; 1369 + goto check_error; 1381 1370 } 1382 1371 1383 1372 complete_rq = __nvme_fc_fcpop_chk_teardowns(ctrl, op); ··· 1390 1379 nvme_end_request(rq, status, result); 1391 1380 } else 1392 1381 __nvme_fc_final_op_cleanup(rq); 1382 + 1383 + check_error: 1384 + if (terminate_assoc) 1385 + nvme_fc_error_recovery(ctrl, "transport detected io error"); 1393 1386 } 1394 1387 1395 1388 static int ··· 2806 2791 ctrl->ctrl.opts = NULL; 2807 2792 /* initiate nvme ctrl ref counting teardown */ 2808 2793 nvme_uninit_ctrl(&ctrl->ctrl); 2794 + nvme_put_ctrl(&ctrl->ctrl); 2809 2795 2810 2796 /* as we're past the point where we transition to the ref 2811 2797 * counting teardown path, if we return a bad pointer here,
+6 -7
drivers/nvme/host/pci.c
··· 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 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 /* ··· 1912 1912 */ 1913 1913 if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) 1914 1914 nvme_dev_disable(dev, false); 1915 - 1916 - if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) 1917 - goto out; 1918 1915 1919 1916 result = nvme_pci_enable(dev); 1920 1917 if (result) ··· 2006 2009 { 2007 2010 if (!dev->ctrl.admin_q || blk_queue_dying(dev->ctrl.admin_q)) 2008 2011 return -ENODEV; 2009 - if (work_busy(&dev->reset_work)) 2010 - return -ENODEV; 2012 + if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING)) 2013 + return -EBUSY; 2011 2014 if (!queue_work(nvme_workq, &dev->reset_work)) 2012 2015 return -EBUSY; 2013 2016 return 0; ··· 2133 2136 if (result) 2134 2137 goto release_pools; 2135 2138 2139 + nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_RESETTING); 2136 2140 dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev)); 2137 2141 2138 2142 queue_work(nvme_workq, &dev->reset_work); ··· 2177 2179 2178 2180 nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING); 2179 2181 2182 + cancel_work_sync(&dev->reset_work); 2180 2183 pci_set_drvdata(pdev, NULL); 2181 2184 2182 2185 if (!pci_device_is_present(pdev)) {
+29 -15
drivers/nvme/host/rdma.c
··· 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); ··· 780 782 ctrl->ctrl.opts->nr_reconnects = 0; 781 783 782 784 if (ctrl->queue_count > 1) { 783 - nvme_start_queues(&ctrl->ctrl); 784 785 nvme_queue_scan(&ctrl->ctrl); 785 786 nvme_queue_async_events(&ctrl->ctrl); 786 787 } ··· 788 791 789 792 return; 790 793 791 - stop_admin_q: 792 - blk_mq_stop_hw_queues(ctrl->ctrl.admin_q); 793 794 requeue: 794 795 dev_info(ctrl->ctrl.device, "Failed reconnect attempt %d\n", 795 796 ctrl->ctrl.opts->nr_reconnects); ··· 817 822 nvme_cancel_request, &ctrl->ctrl); 818 823 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, 819 824 nvme_cancel_request, &ctrl->ctrl); 825 + 826 + /* 827 + * queues are not a live anymore, so restart the queues to fail fast 828 + * new IO 829 + */ 830 + blk_mq_start_stopped_hw_queues(ctrl->ctrl.admin_q, true); 831 + nvme_start_queues(&ctrl->ctrl); 820 832 821 833 nvme_rdma_reconnect_or_remove(ctrl); 822 834 } ··· 1435 1433 /* 1436 1434 * We cannot accept any other command until the Connect command has completed. 1437 1435 */ 1438 - static inline bool nvme_rdma_queue_is_ready(struct nvme_rdma_queue *queue, 1436 + static inline int nvme_rdma_queue_is_ready(struct nvme_rdma_queue *queue, 1439 1437 struct request *rq) 1440 1438 { 1441 1439 if (unlikely(!test_bit(NVME_RDMA_Q_LIVE, &queue->flags))) { ··· 1443 1441 1444 1442 if (!blk_rq_is_passthrough(rq) || 1445 1443 cmd->common.opcode != nvme_fabrics_command || 1446 - cmd->fabrics.fctype != nvme_fabrics_type_connect) 1447 - return false; 1444 + cmd->fabrics.fctype != nvme_fabrics_type_connect) { 1445 + /* 1446 + * reconnecting state means transport disruption, which 1447 + * can take a long time and even might fail permanently, 1448 + * so we can't let incoming I/O be requeued forever. 1449 + * fail it fast to allow upper layers a chance to 1450 + * failover. 1451 + */ 1452 + if (queue->ctrl->ctrl.state == NVME_CTRL_RECONNECTING) 1453 + return -EIO; 1454 + else 1455 + return -EAGAIN; 1456 + } 1448 1457 } 1449 1458 1450 - return true; 1459 + return 0; 1451 1460 } 1452 1461 1453 1462 static int nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, ··· 1476 1463 1477 1464 WARN_ON_ONCE(rq->tag < 0); 1478 1465 1479 - if (!nvme_rdma_queue_is_ready(queue, rq)) 1480 - return BLK_MQ_RQ_QUEUE_BUSY; 1466 + ret = nvme_rdma_queue_is_ready(queue, rq); 1467 + if (unlikely(ret)) 1468 + goto err; 1481 1469 1482 1470 dev = queue->device->dev; 1483 1471 ib_dma_sync_single_for_cpu(dev, sqe->dma,
+2 -2
drivers/of/device.c
··· 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 ");
+2
drivers/reset/hisilicon/hi6220_reset.c
··· 155 155 } 156 156 157 157 postcore_initcall(hi6220_reset_init); 158 + 159 + MODULE_LICENSE("GPL v2");
-2
drivers/staging/media/atomisp/i2c/Makefile
··· 19 19 20 20 obj-$(CONFIG_VIDEO_LM3554) += lm3554.o 21 21 22 - ccflags-y += -Werror 23 -
-2
drivers/staging/media/atomisp/i2c/imx/Makefile
··· 4 4 5 5 ov8858_driver-objs := ../ov8858.o dw9718.o vcm.o 6 6 obj-$(CONFIG_VIDEO_OV8858) += ov8858_driver.o 7 - 8 - ccflags-y += -Werror
-2
drivers/staging/media/atomisp/i2c/ov5693/Makefile
··· 1 1 obj-$(CONFIG_VIDEO_OV5693) += ov5693.o 2 - 3 - ccflags-y += -Werror
+1 -1
drivers/staging/media/atomisp/pci/atomisp2/Makefile
··· 351 351 DEFINES += -DATOMISP_POSTFIX=\"css2400b0_v21\" -DISP2400B0 352 352 DEFINES += -DSYSTEM_hive_isp_css_2400_system -DISP2400 353 353 354 - ccflags-y += $(INCLUDES) $(DEFINES) -fno-common -Werror 354 + ccflags-y += $(INCLUDES) $(DEFINES) -fno-common 355 355
+2 -2
drivers/xen/privcmd.c
··· 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 }
+2 -2
fs/btrfs/ctree.h
··· 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 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,
+1 -1
fs/btrfs/dir-item.c
··· 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
+6 -4
fs/btrfs/disk-io.c
··· 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 } ··· 3537 3535 3538 3536 bio->bi_end_io = btrfs_end_empty_barrier; 3539 3537 bio->bi_bdev = device->bdev; 3540 - bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH; 3538 + bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH; 3541 3539 init_completion(&device->flush_wait); 3542 3540 bio->bi_private = &device->flush_wait; 3543 3541 device->flush_bio = bio;
+4 -3
fs/btrfs/extent-tree.c
··· 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 } ··· 4845 4844 spin_unlock(&delayed_rsv->lock); 4846 4845 4847 4846 commit: 4848 - trans = btrfs_join_transaction(fs_info->fs_root); 4847 + trans = btrfs_join_transaction(fs_info->extent_root); 4849 4848 if (IS_ERR(trans)) 4850 4849 return -ENOSPC; 4851 4850 ··· 4863 4862 struct btrfs_space_info *space_info, u64 num_bytes, 4864 4863 u64 orig_bytes, int state) 4865 4864 { 4866 - struct btrfs_root *root = fs_info->fs_root; 4865 + struct btrfs_root *root = fs_info->extent_root; 4867 4866 struct btrfs_trans_handle *trans; 4868 4867 int nr; 4869 4868 int ret = 0; ··· 5063 5062 int flush_state = FLUSH_DELAYED_ITEMS_NR; 5064 5063 5065 5064 spin_lock(&space_info->lock); 5066 - to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info->fs_root, 5065 + to_reclaim = btrfs_calc_reclaim_metadata_size(fs_info->extent_root, 5067 5066 space_info); 5068 5067 if (!to_reclaim) { 5069 5068 spin_unlock(&space_info->lock);
+123 -3
fs/btrfs/extent_io.c
··· 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 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 { ··· 4511 4394 struct extent_state *cached_state = NULL; 4512 4395 struct btrfs_path *path; 4513 4396 struct btrfs_root *root = BTRFS_I(inode)->root; 4397 + struct fiemap_cache cache = { 0 }; 4514 4398 int end = 0; 4515 4399 u64 em_start = 0; 4516 4400 u64 em_len = 0; ··· 4691 4573 flags |= FIEMAP_EXTENT_LAST; 4692 4574 end = 1; 4693 4575 } 4694 - ret = fiemap_fill_next_extent(fieinfo, em_start, disko, 4695 - em_len, flags); 4576 + ret = emit_fiemap_extent(fieinfo, &cache, em_start, disko, 4577 + em_len, flags); 4696 4578 if (ret) { 4697 4579 if (ret == 1) 4698 4580 ret = 0; ··· 4700 4582 } 4701 4583 } 4702 4584 out_free: 4585 + if (!ret) 4586 + ret = check_fiemap_cache(root->fs_info, fieinfo, &cache); 4703 4587 free_extent_map(em); 4704 4588 out: 4705 4589 btrfs_free_path(path);
+3 -3
fs/btrfs/inode.c
··· 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 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
+1
fs/stat.c
··· 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 {
+25 -1
fs/ufs/balloc.c
··· 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); ··· 185 184 ufs_error(sb, "ufs_free_blocks", "freeing free fragment"); 186 185 } 187 186 ubh_setblock(UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); 187 + inode_sub_bytes(inode, uspi->s_fpb << uspi->s_fshift); 188 188 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) 189 189 ufs_clusteracct (sb, ucpi, blkno, 1); 190 190 ··· 496 494 return 0; 497 495 } 498 496 497 + static bool try_add_frags(struct inode *inode, unsigned frags) 498 + { 499 + unsigned size = frags * i_blocksize(inode); 500 + spin_lock(&inode->i_lock); 501 + __inode_add_bytes(inode, size); 502 + if (unlikely((u32)inode->i_blocks != inode->i_blocks)) { 503 + __inode_sub_bytes(inode, size); 504 + spin_unlock(&inode->i_lock); 505 + return false; 506 + } 507 + spin_unlock(&inode->i_lock); 508 + return true; 509 + } 510 + 499 511 static u64 ufs_add_fragments(struct inode *inode, u64 fragment, 500 512 unsigned oldcount, unsigned newcount) 501 513 { ··· 546 530 for (i = oldcount; i < newcount; i++) 547 531 if (ubh_isclr (UCPI_UBH(ucpi), ucpi->c_freeoff, fragno + i)) 548 532 return 0; 533 + 534 + if (!try_add_frags(inode, count)) 535 + return 0; 549 536 /* 550 537 * Block can be extended 551 538 */ ··· 666 647 ubh_setbit (UCPI_UBH(ucpi), ucpi->c_freeoff, goal + i); 667 648 i = uspi->s_fpb - count; 668 649 650 + inode_sub_bytes(inode, i << uspi->s_fshift); 669 651 fs32_add(sb, &ucg->cg_cs.cs_nffree, i); 670 652 uspi->cs_total.cs_nffree += i; 671 653 fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, i); ··· 676 656 677 657 result = ufs_bitmap_search (sb, ucpi, goal, allocsize); 678 658 if (result == INVBLOCK) 659 + return 0; 660 + if (!try_add_frags(inode, count)) 679 661 return 0; 680 662 for (i = 0; i < count; i++) 681 663 ubh_clrbit (UCPI_UBH(ucpi), ucpi->c_freeoff, result + i); ··· 738 716 return INVBLOCK; 739 717 ucpi->c_rotor = result; 740 718 gotit: 719 + if (!try_add_frags(inode, uspi->s_fpb)) 720 + return 0; 741 721 blkno = ufs_fragstoblks(result); 742 722 ubh_clrblock (UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); 743 723 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD)
+12 -16
fs/ufs/inode.c
··· 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 ··· 285 284 goal += uspi->s_fpb; 286 285 } 287 286 tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment), 288 - goal, uspi->s_fpb, err, locked_page); 287 + goal, nfrags, err, locked_page); 289 288 290 289 if (!tmp) { 291 290 *err = -ENOSPC; ··· 403 402 404 403 if (!create) { 405 404 phys64 = ufs_frag_map(inode, offsets, depth); 406 - goto out; 405 + if (phys64) 406 + map_bh(bh_result, sb, phys64 + frag); 407 + return 0; 407 408 } 408 409 409 410 /* This code entered only while writing ....? */ ··· 844 841 truncate_inode_pages_final(&inode->i_data); 845 842 if (want_delete) { 846 843 inode->i_size = 0; 847 - if (inode->i_blocks) 844 + if (inode->i_blocks && 845 + (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 846 + S_ISLNK(inode->i_mode))) 848 847 ufs_truncate_blocks(inode); 848 + ufs_update_inode(inode, inode_needs_sync(inode)); 849 849 } 850 850 851 851 invalidate_inode_buffers(inode); ··· 1106 1100 return err; 1107 1101 } 1108 1102 1109 - static void __ufs_truncate_blocks(struct inode *inode) 1103 + static void ufs_truncate_blocks(struct inode *inode) 1110 1104 { 1111 1105 struct ufs_inode_info *ufsi = UFS_I(inode); 1112 1106 struct super_block *sb = inode->i_sb; ··· 1189 1183 1190 1184 truncate_setsize(inode, size); 1191 1185 1192 - __ufs_truncate_blocks(inode); 1186 + ufs_truncate_blocks(inode); 1193 1187 inode->i_mtime = inode->i_ctime = current_time(inode); 1194 1188 mark_inode_dirty(inode); 1195 1189 out: 1196 1190 UFSD("EXIT: err %d\n", err); 1197 1191 return err; 1198 - } 1199 - 1200 - static void ufs_truncate_blocks(struct inode *inode) 1201 - { 1202 - if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 1203 - S_ISLNK(inode->i_mode))) 1204 - return; 1205 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) 1206 - return; 1207 - __ufs_truncate_blocks(inode); 1208 1192 } 1209 1193 1210 1194 int ufs_setattr(struct dentry *dentry, struct iattr *attr)
+18
fs/ufs/super.c
··· 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; ··· 1228 1211 "fast symlink size (%u)\n", uspi->s_maxsymlinklen); 1229 1212 uspi->s_maxsymlinklen = maxsymlen; 1230 1213 } 1214 + sb->s_maxbytes = ufs_max_bytes(sb); 1231 1215 sb->s_max_links = UFS_LINK_MAX; 1232 1216 1233 1217 inode = ufs_iget(sb, UFS_ROOTINO);
+7 -3
fs/ufs/util.h
··· 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 }
+1
include/linux/cgroup-defs.h
··· 48 48 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */ 49 49 CSS_RELEASED = (1 << 2), /* refcnt reached zero, released */ 50 50 CSS_VISIBLE = (1 << 3), /* css is visible to userland */ 51 + CSS_DYING = (1 << 4), /* css is dying */ 51 52 }; 52 53 53 54 /* bits in struct cgroup flags field */
+20
include/linux/cgroup.h
··· 344 344 } 345 345 346 346 /** 347 + * css_is_dying - test whether the specified css is dying 348 + * @css: target css 349 + * 350 + * Test whether @css is in the process of offlining or already offline. In 351 + * most cases, ->css_online() and ->css_offline() callbacks should be 352 + * enough; however, the actual offline operations are RCU delayed and this 353 + * test returns %true also when @css is scheduled to be offlined. 354 + * 355 + * This is useful, for example, when the use case requires synchronous 356 + * behavior with respect to cgroup removal. cgroup removal schedules css 357 + * offlining but the css can seem alive while the operation is being 358 + * delayed. If the delay affects user visible semantics, this test can be 359 + * used to resolve the situation. 360 + */ 361 + static inline bool css_is_dying(struct cgroup_subsys_state *css) 362 + { 363 + return !(css->flags & CSS_NO_REF) && percpu_ref_is_dying(&css->refcnt); 364 + } 365 + 366 + /** 347 367 * css_put - put a css reference 348 368 * @css: target css 349 369 *
+7
include/linux/compiler-clang.h
··· 15 15 * with any version that can compile the kernel 16 16 */ 17 17 #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) 18 + 19 + /* 20 + * GCC does not warn about unused static inline functions for 21 + * -Wunused-function. This turns out to avoid the need for complex #ifdef 22 + * directives. Suppress the warning in clang as well. 23 + */ 24 + #define inline inline __attribute__((unused))
+1
include/linux/dma-iommu.h
··· 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 {
+1 -1
include/linux/elevator.h
··· 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
+1
include/linux/mlx4/qp.h
··· 470 470 u16 rate_val; 471 471 }; 472 472 473 + struct mlx4_qp *mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn); 473 474 int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, 474 475 enum mlx4_update_qp_attr attr, 475 476 struct mlx4_update_qp_params *params);
-2
include/linux/srcu.h
··· 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 }
+2 -5
include/linux/suspend.h
··· 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 }; ··· 428 430 429 431 extern bool pm_wakeup_pending(void); 430 432 extern void pm_system_wakeup(void); 431 - extern void pm_system_cancel_wakeup(void); 432 - extern void pm_wakeup_clear(bool reset); 433 + extern void pm_wakeup_clear(void); 433 434 extern void pm_system_irq_wakeup(unsigned int irq_number); 434 435 extern bool pm_get_wakeup_count(unsigned int *count, bool block); 435 436 extern bool pm_save_wakeup_count(unsigned int count); ··· 478 481 479 482 static inline bool pm_wakeup_pending(void) { return false; } 480 483 static inline void pm_system_wakeup(void) {} 481 - static inline void pm_wakeup_clear(bool reset) {} 484 + static inline void pm_wakeup_clear(void) {} 482 485 static inline void pm_system_irq_wakeup(unsigned int irq_number) {} 483 486 484 487 static inline void lock_system_sleep(void) {}
+1 -1
include/media/cec-notifier.h
··· 29 29 struct cec_adapter; 30 30 struct cec_notifier; 31 31 32 - #ifdef CONFIG_MEDIA_CEC_NOTIFIER 32 + #if IS_REACHABLE(CONFIG_CEC_CORE) && IS_ENABLED(CONFIG_CEC_NOTIFIER) 33 33 34 34 /** 35 35 * cec_notifier_get - find or create a new cec_notifier for the given device.
+2 -2
include/media/cec.h
··· 173 173 bool passthrough; 174 174 struct cec_log_addrs log_addrs; 175 175 176 - #ifdef CONFIG_MEDIA_CEC_NOTIFIER 176 + #ifdef CONFIG_CEC_NOTIFIER 177 177 struct cec_notifier *notifier; 178 178 #endif 179 179 ··· 300 300 */ 301 301 int cec_phys_addr_validate(u16 phys_addr, u16 *parent, u16 *port); 302 302 303 - #ifdef CONFIG_MEDIA_CEC_NOTIFIER 303 + #ifdef CONFIG_CEC_NOTIFIER 304 304 void cec_register_cec_notifier(struct cec_adapter *adap, 305 305 struct cec_notifier *notifier); 306 306 #endif
+1
include/net/ipv6.h
··· 1007 1007 */ 1008 1008 extern const struct proto_ops inet6_stream_ops; 1009 1009 extern const struct proto_ops inet6_dgram_ops; 1010 + extern const struct proto_ops inet6_sockraw_ops; 1010 1011 1011 1012 struct group_source_req; 1012 1013 struct group_filter;
+1 -1
include/net/tcp.h
··· 924 924 void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev); 925 925 /* call when ack arrives (optional) */ 926 926 void (*in_ack_event)(struct sock *sk, u32 flags); 927 - /* new value of cwnd after loss (optional) */ 927 + /* new value of cwnd after loss (required) */ 928 928 u32 (*undo_cwnd)(struct sock *sk); 929 929 /* hook for packet ack accounting (optional) */ 930 930 void (*pkts_acked)(struct sock *sk, const struct ack_sample *sample);
+5
kernel/cgroup/cgroup.c
··· 4265 4265 { 4266 4266 lockdep_assert_held(&cgroup_mutex); 4267 4267 4268 + if (css->flags & CSS_DYING) 4269 + return; 4270 + 4271 + css->flags |= CSS_DYING; 4272 + 4268 4273 /* 4269 4274 * This must happen before css is disassociated with its cgroup. 4270 4275 * See seq_css() for details.
+2 -2
kernel/cgroup/cpuset.c
··· 176 176 } cpuset_flagbits_t; 177 177 178 178 /* convenient tests for these bits */ 179 - static inline bool is_cpuset_online(const struct cpuset *cs) 179 + static inline bool is_cpuset_online(struct cpuset *cs) 180 180 { 181 - return test_bit(CS_ONLINE, &cs->flags); 181 + return test_bit(CS_ONLINE, &cs->flags) && !css_is_dying(&cs->css); 182 182 } 183 183 184 184 static inline int is_cpu_exclusive(const struct cpuset *cs)
+2 -2
kernel/cpu.c
··· 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 }
+21
kernel/events/core.c
··· 7316 7316 return __perf_event_account_interrupt(event, 1); 7317 7317 } 7318 7318 7319 + static bool sample_is_allowed(struct perf_event *event, struct pt_regs *regs) 7320 + { 7321 + /* 7322 + * Due to interrupt latency (AKA "skid"), we may enter the 7323 + * kernel before taking an overflow, even if the PMU is only 7324 + * counting user events. 7325 + * To avoid leaking information to userspace, we must always 7326 + * reject kernel samples when exclude_kernel is set. 7327 + */ 7328 + if (event->attr.exclude_kernel && !user_mode(regs)) 7329 + return false; 7330 + 7331 + return true; 7332 + } 7333 + 7319 7334 /* 7320 7335 * Generic event overflow handling, sampling. 7321 7336 */ ··· 7350 7335 return 0; 7351 7336 7352 7337 ret = __perf_event_account_interrupt(event, throttle); 7338 + 7339 + /* 7340 + * For security, drop the skid kernel samples if necessary. 7341 + */ 7342 + if (!sample_is_allowed(event, regs)) 7343 + return ret; 7353 7344 7354 7345 /* 7355 7346 * XXX event_limit might not quite work as expected on inherited
+1 -1
kernel/power/process.c
··· 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);
+4 -25
kernel/power/suspend.c
··· 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; ··· 98 100 out: 99 101 suspend_freeze_state = FREEZE_STATE_NONE; 100 102 spin_unlock_irq(&suspend_freeze_lock); 101 - 102 - trace_suspend_resume(TPS("machine_suspend"), PM_SUSPEND_FREEZE, false); 103 - } 104 - 105 - static void s2idle_loop(void) 106 - { 107 - do { 108 - freeze_enter(); 109 - 110 - if (freeze_ops && freeze_ops->wake) 111 - freeze_ops->wake(); 112 - 113 - dpm_resume_noirq(PMSG_RESUME); 114 - if (freeze_ops && freeze_ops->sync) 115 - freeze_ops->sync(); 116 - 117 - if (pm_wakeup_pending()) 118 - break; 119 - 120 - pm_wakeup_clear(false); 121 - } while (!dpm_suspend_noirq(PMSG_SUSPEND)); 122 103 } 123 104 124 105 void freeze_wake(void) ··· 371 394 * all the devices are suspended. 372 395 */ 373 396 if (state == PM_SUSPEND_FREEZE) { 374 - s2idle_loop(); 375 - goto Platform_early_resume; 397 + trace_suspend_resume(TPS("machine_suspend"), state, true); 398 + freeze_enter(); 399 + trace_suspend_resume(TPS("machine_suspend"), state, false); 400 + goto Platform_wake; 376 401 } 377 402 378 403 error = disable_nonboot_cpus();
+10 -36
kernel/printk/printk.c
··· 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; ··· 1905 1906 * See if this tty is not yet registered, and 1906 1907 * if we have a slot free. 1907 1908 */ 1908 - for (i = 0, c = console_cmdline; i < console_cmdline_cnt; i++, c++) { 1909 + for (i = 0, c = console_cmdline; 1910 + i < MAX_CMDLINECONSOLES && c->name[0]; 1911 + i++, c++) { 1909 1912 if (strcmp(c->name, name) == 0 && c->index == idx) { 1910 - if (brl_options) 1911 - return 0; 1912 - 1913 - /* 1914 - * Maintain an invariant that will help to find if 1915 - * the matching console is preferred, see 1916 - * register_console(): 1917 - * 1918 - * The last non-braille console is always 1919 - * the preferred one. 1920 - */ 1921 - if (i != console_cmdline_cnt - 1) 1922 - swap(console_cmdline[i], 1923 - console_cmdline[console_cmdline_cnt - 1]); 1924 - 1925 - preferred_console = console_cmdline_cnt - 1; 1926 - 1913 + if (!brl_options) 1914 + preferred_console = i; 1927 1915 return 0; 1928 1916 } 1929 1917 } ··· 1923 1937 braille_set_options(c, brl_options); 1924 1938 1925 1939 c->index = idx; 1926 - console_cmdline_cnt++; 1927 1940 return 0; 1928 1941 } 1929 1942 /* ··· 2462 2477 } 2463 2478 2464 2479 /* 2465 - * See if this console matches one we selected on the command line. 2466 - * 2467 - * There may be several entries in the console_cmdline array matching 2468 - * with the same console, one with newcon->match(), another by 2469 - * name/index: 2470 - * 2471 - * pl011,mmio,0x87e024000000,115200 -- added from SPCR 2472 - * ttyAMA0 -- added from command line 2473 - * 2474 - * Traverse the console_cmdline array in reverse order to be 2475 - * sure that if this console is preferred then it will be the first 2476 - * matching entry. We use the invariant that is maintained in 2477 - * __add_preferred_console(). 2480 + * See if this console matches one we selected on 2481 + * the command line. 2478 2482 */ 2479 - for (i = console_cmdline_cnt - 1; i >= 0; i--) { 2480 - c = console_cmdline + i; 2481 - 2483 + for (i = 0, c = console_cmdline; 2484 + i < MAX_CMDLINECONSOLES && c->name[0]; 2485 + i++, c++) { 2482 2486 if (!newcon->match || 2483 2487 newcon->match(newcon, c->name, c->index, c->options) != 0) { 2484 2488 /* default matching */
+2 -3
kernel/rcu/srcu.c
··· 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 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 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 {
+4 -3
kernel/rcu/srcutiny.c
··· 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 { ··· 113 112 114 113 /* 115 114 * Removes the count for the old reader from the appropriate element of 116 - * the srcu_struct. Must be called from process context. 115 + * the srcu_struct. 117 116 */ 118 117 void __srcu_read_unlock(struct srcu_struct *sp, int idx) 119 118 {
+2 -3
kernel/rcu/srcutree.c
··· 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 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 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 {
+1 -1
kernel/sched/core.c
··· 5605 5605 BUG_ON(cpu_online(smp_processor_id())); 5606 5606 5607 5607 if (mm != &init_mm) { 5608 - switch_mm_irqs_off(mm, &init_mm, current); 5608 + switch_mm(mm, &init_mm, current); 5609 5609 finish_arch_post_lock_switch(); 5610 5610 } 5611 5611 mmdrop(mm);
+1 -1
kernel/sched/fair.c
··· 3563 3563 trace_sched_stat_runtime_enabled()) { 3564 3564 printk_deferred_once("Scheduler tracepoints stat_sleep, stat_iowait, " 3565 3565 "stat_blocked and stat_runtime require the " 3566 - "kernel parameter schedstats=enabled or " 3566 + "kernel parameter schedstats=enable or " 3567 3567 "kernel.sched_schedstats=1\n"); 3568 3568 } 3569 3569 #endif
+1 -1
net/bridge/br_netlink.c
··· 595 595 err = 0; 596 596 switch (nla_type(attr)) { 597 597 case IFLA_BRIDGE_VLAN_TUNNEL_INFO: 598 - if (!(p->flags & BR_VLAN_TUNNEL)) 598 + if (!p || !(p->flags & BR_VLAN_TUNNEL)) 599 599 return -EINVAL; 600 600 err = br_parse_vlan_tunnel_info(attr, &tinfo_curr); 601 601 if (err)
+2 -1
net/bridge/br_stp_if.c
··· 179 179 br_debug(br, "using kernel STP\n"); 180 180 181 181 /* To start timers on any ports left in blocking */ 182 - mod_timer(&br->hello_timer, jiffies + br->hello_time); 182 + if (br->dev->flags & IFF_UP) 183 + mod_timer(&br->hello_timer, jiffies + br->hello_time); 183 184 br_port_state_selection(br); 184 185 } 185 186
+6 -2
net/core/devlink.c
··· 1680 1680 1681 1681 hdr = genlmsg_put(skb, info->snd_portid, info->snd_seq, 1682 1682 &devlink_nl_family, NLM_F_MULTI, cmd); 1683 - if (!hdr) 1683 + if (!hdr) { 1684 + nlmsg_free(skb); 1684 1685 return -EMSGSIZE; 1686 + } 1685 1687 1686 1688 if (devlink_nl_put_handle(skb, devlink)) 1687 1689 goto nla_put_failure; ··· 2100 2098 2101 2099 hdr = genlmsg_put(skb, info->snd_portid, info->snd_seq, 2102 2100 &devlink_nl_family, NLM_F_MULTI, cmd); 2103 - if (!hdr) 2101 + if (!hdr) { 2102 + nlmsg_free(skb); 2104 2103 return -EMSGSIZE; 2104 + } 2105 2105 2106 2106 if (devlink_nl_put_handle(skb, devlink)) 2107 2107 goto nla_put_failure;
+4 -1
net/core/skbuff.c
··· 3754 3754 3755 3755 spin_lock_irqsave(&q->lock, flags); 3756 3756 skb = __skb_dequeue(q); 3757 - if (skb && (skb_next = skb_peek(q))) 3757 + if (skb && (skb_next = skb_peek(q))) { 3758 3758 icmp_next = is_icmp_err_skb(skb_next); 3759 + if (icmp_next) 3760 + sk->sk_err = SKB_EXT_ERR(skb_next)->ee.ee_origin; 3761 + } 3759 3762 spin_unlock_irqrestore(&q->lock, flags); 3760 3763 3761 3764 if (is_icmp_err_skb(skb) && !icmp_next)
+47
net/dsa/dsa.c
··· 223 223 return 0; 224 224 } 225 225 226 + #ifdef CONFIG_PM_SLEEP 227 + int dsa_switch_suspend(struct dsa_switch *ds) 228 + { 229 + int i, ret = 0; 230 + 231 + /* Suspend slave network devices */ 232 + for (i = 0; i < ds->num_ports; i++) { 233 + if (!dsa_is_port_initialized(ds, i)) 234 + continue; 235 + 236 + ret = dsa_slave_suspend(ds->ports[i].netdev); 237 + if (ret) 238 + return ret; 239 + } 240 + 241 + if (ds->ops->suspend) 242 + ret = ds->ops->suspend(ds); 243 + 244 + return ret; 245 + } 246 + EXPORT_SYMBOL_GPL(dsa_switch_suspend); 247 + 248 + int dsa_switch_resume(struct dsa_switch *ds) 249 + { 250 + int i, ret = 0; 251 + 252 + if (ds->ops->resume) 253 + ret = ds->ops->resume(ds); 254 + 255 + if (ret) 256 + return ret; 257 + 258 + /* Resume slave network devices */ 259 + for (i = 0; i < ds->num_ports; i++) { 260 + if (!dsa_is_port_initialized(ds, i)) 261 + continue; 262 + 263 + ret = dsa_slave_resume(ds->ports[i].netdev); 264 + if (ret) 265 + return ret; 266 + } 267 + 268 + return 0; 269 + } 270 + EXPORT_SYMBOL_GPL(dsa_switch_resume); 271 + #endif 272 + 226 273 static struct packet_type dsa_pack_type __read_mostly = { 227 274 .type = cpu_to_be16(ETH_P_XDSA), 228 275 .func = dsa_switch_rcv,
+3 -1
net/dsa/dsa2.c
··· 484 484 dsa_ds_unapply(dst, ds); 485 485 } 486 486 487 - if (dst->cpu_switch) 487 + if (dst->cpu_switch) { 488 488 dsa_cpu_port_ethtool_restore(dst->cpu_switch); 489 + dst->cpu_switch = NULL; 490 + } 489 491 490 492 pr_info("DSA: tree %d unapplied\n", dst->tree); 491 493 dst->applied = false;
-47
net/dsa/legacy.c
··· 289 289 dsa_switch_unregister_notifier(ds); 290 290 } 291 291 292 - #ifdef CONFIG_PM_SLEEP 293 - int dsa_switch_suspend(struct dsa_switch *ds) 294 - { 295 - int i, ret = 0; 296 - 297 - /* Suspend slave network devices */ 298 - for (i = 0; i < ds->num_ports; i++) { 299 - if (!dsa_is_port_initialized(ds, i)) 300 - continue; 301 - 302 - ret = dsa_slave_suspend(ds->ports[i].netdev); 303 - if (ret) 304 - return ret; 305 - } 306 - 307 - if (ds->ops->suspend) 308 - ret = ds->ops->suspend(ds); 309 - 310 - return ret; 311 - } 312 - EXPORT_SYMBOL_GPL(dsa_switch_suspend); 313 - 314 - int dsa_switch_resume(struct dsa_switch *ds) 315 - { 316 - int i, ret = 0; 317 - 318 - if (ds->ops->resume) 319 - ret = ds->ops->resume(ds); 320 - 321 - if (ret) 322 - return ret; 323 - 324 - /* Resume slave network devices */ 325 - for (i = 0; i < ds->num_ports; i++) { 326 - if (!dsa_is_port_initialized(ds, i)) 327 - continue; 328 - 329 - ret = dsa_slave_resume(ds->ports[i].netdev); 330 - if (ret) 331 - return ret; 332 - } 333 - 334 - return 0; 335 - } 336 - EXPORT_SYMBOL_GPL(dsa_switch_resume); 337 - #endif 338 - 339 292 /* platform driver init and cleanup *****************************************/ 340 293 static int dev_is_class(struct device *dev, void *class) 341 294 {
+1 -1
net/ipv4/af_inet.c
··· 1043 1043 .type = SOCK_DGRAM, 1044 1044 .protocol = IPPROTO_ICMP, 1045 1045 .prot = &ping_prot, 1046 - .ops = &inet_dgram_ops, 1046 + .ops = &inet_sockraw_ops, 1047 1047 .flags = INET_PROTOSW_REUSE, 1048 1048 }, 1049 1049
+4 -2
net/ipv4/tcp.c
··· 2381 2381 return 0; 2382 2382 } 2383 2383 2384 - static int tcp_repair_options_est(struct tcp_sock *tp, 2384 + static int tcp_repair_options_est(struct sock *sk, 2385 2385 struct tcp_repair_opt __user *optbuf, unsigned int len) 2386 2386 { 2387 + struct tcp_sock *tp = tcp_sk(sk); 2387 2388 struct tcp_repair_opt opt; 2388 2389 2389 2390 while (len >= sizeof(opt)) { ··· 2397 2396 switch (opt.opt_code) { 2398 2397 case TCPOPT_MSS: 2399 2398 tp->rx_opt.mss_clamp = opt.opt_val; 2399 + tcp_mtup_init(sk); 2400 2400 break; 2401 2401 case TCPOPT_WINDOW: 2402 2402 { ··· 2557 2555 if (!tp->repair) 2558 2556 err = -EINVAL; 2559 2557 else if (sk->sk_state == TCP_ESTABLISHED) 2560 - err = tcp_repair_options_est(tp, 2558 + err = tcp_repair_options_est(sk, 2561 2559 (struct tcp_repair_opt __user *)optval, 2562 2560 optlen); 2563 2561 else
+1
net/ipv4/tcp_cong.c
··· 180 180 { 181 181 const struct inet_connection_sock *icsk = inet_csk(sk); 182 182 183 + tcp_sk(sk)->prior_ssthresh = 0; 183 184 if (icsk->icsk_ca_ops->init) 184 185 icsk->icsk_ca_ops->init(sk); 185 186 if (tcp_ca_needs_ecn(sk))
+5 -1
net/ipv6/calipso.c
··· 1319 1319 struct ipv6hdr *ip6_hdr; 1320 1320 struct ipv6_opt_hdr *hop; 1321 1321 unsigned char buf[CALIPSO_MAX_BUFFER]; 1322 - int len_delta, new_end, pad; 1322 + int len_delta, new_end, pad, payload; 1323 1323 unsigned int start, end; 1324 1324 1325 1325 ip6_hdr = ipv6_hdr(skb); ··· 1346 1346 if (ret_val < 0) 1347 1347 return ret_val; 1348 1348 1349 + ip6_hdr = ipv6_hdr(skb); /* Reset as skb_cow() may have moved it */ 1350 + 1349 1351 if (len_delta) { 1350 1352 if (len_delta > 0) 1351 1353 skb_push(skb, len_delta); ··· 1357 1355 sizeof(*ip6_hdr) + start); 1358 1356 skb_reset_network_header(skb); 1359 1357 ip6_hdr = ipv6_hdr(skb); 1358 + payload = ntohs(ip6_hdr->payload_len); 1359 + ip6_hdr->payload_len = htons(payload + len_delta); 1360 1360 } 1361 1361 1362 1362 hop = (struct ipv6_opt_hdr *)(ip6_hdr + 1);
+3 -1
net/ipv6/ip6_offload.c
··· 116 116 117 117 if (udpfrag) { 118 118 int err = ip6_find_1stfragopt(skb, &prevhdr); 119 - if (err < 0) 119 + if (err < 0) { 120 + kfree_skb_list(segs); 120 121 return ERR_PTR(err); 122 + } 121 123 fptr = (struct frag_hdr *)((u8 *)ipv6h + err); 122 124 fptr->frag_off = htons(offset); 123 125 if (skb->next)
+3
net/ipv6/ip6_tunnel.c
··· 1095 1095 1096 1096 if (!dst) { 1097 1097 route_lookup: 1098 + /* add dsfield to flowlabel for route lookup */ 1099 + fl6->flowlabel = ip6_make_flowinfo(dsfield, fl6->flowlabel); 1100 + 1098 1101 dst = ip6_route_output(net, NULL, fl6); 1099 1102 1100 1103 if (dst->error)
+1 -1
net/ipv6/ping.c
··· 192 192 .type = SOCK_DGRAM, 193 193 .protocol = IPPROTO_ICMPV6, 194 194 .prot = &pingv6_prot, 195 - .ops = &inet6_dgram_ops, 195 + .ops = &inet6_sockraw_ops, 196 196 .flags = INET_PROTOSW_REUSE, 197 197 }; 198 198
+1 -1
net/ipv6/raw.c
··· 1338 1338 #endif /* CONFIG_PROC_FS */ 1339 1339 1340 1340 /* Same as inet6_dgram_ops, sans udp_poll. */ 1341 - static const struct proto_ops inet6_sockraw_ops = { 1341 + const struct proto_ops inet6_sockraw_ops = { 1342 1342 .family = PF_INET6, 1343 1343 .owner = THIS_MODULE, 1344 1344 .release = inet6_release,
+2
net/ipv6/xfrm6_mode_ro.c
··· 47 47 iph = ipv6_hdr(skb); 48 48 49 49 hdr_len = x->type->hdr_offset(x, skb, &prevhdr); 50 + if (hdr_len < 0) 51 + return hdr_len; 50 52 skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); 51 53 skb_set_network_header(skb, -x->props.header_len); 52 54 skb->transport_header = skb->network_header + hdr_len;
+2
net/ipv6/xfrm6_mode_transport.c
··· 30 30 skb_set_inner_transport_header(skb, skb_transport_offset(skb)); 31 31 32 32 hdr_len = x->type->hdr_offset(x, skb, &prevhdr); 33 + if (hdr_len < 0) 34 + return hdr_len; 33 35 skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data); 34 36 skb_set_network_header(skb, -x->props.header_len); 35 37 skb->transport_header = skb->network_header + hdr_len;
+68 -92
net/mac80211/agg-tx.c
··· 7 7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 8 8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 9 9 * Copyright 2007-2010, Intel Corporation 10 - * Copyright(c) 2015 Intel Deutschland GmbH 10 + * Copyright(c) 2015-2017 Intel Deutschland GmbH 11 11 * 12 12 * This program is free software; you can redistribute it and/or modify 13 13 * it under the terms of the GNU General Public License version 2 as ··· 741 741 ieee80211_agg_start_txq(sta, tid, true); 742 742 } 743 743 744 - void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) 744 + void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid, 745 + struct tid_ampdu_tx *tid_tx) 746 + { 747 + struct ieee80211_sub_if_data *sdata = sta->sdata; 748 + struct ieee80211_local *local = sdata->local; 749 + 750 + if (WARN_ON(test_and_set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state))) 751 + return; 752 + 753 + if (test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) 754 + ieee80211_agg_tx_operational(local, sta, tid); 755 + } 756 + 757 + static struct tid_ampdu_tx * 758 + ieee80211_lookup_tid_tx(struct ieee80211_sub_if_data *sdata, 759 + const u8 *ra, u16 tid, struct sta_info **sta) 760 + { 761 + struct tid_ampdu_tx *tid_tx; 762 + 763 + if (tid >= IEEE80211_NUM_TIDS) { 764 + ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n", 765 + tid, IEEE80211_NUM_TIDS); 766 + return NULL; 767 + } 768 + 769 + *sta = sta_info_get_bss(sdata, ra); 770 + if (!*sta) { 771 + ht_dbg(sdata, "Could not find station: %pM\n", ra); 772 + return NULL; 773 + } 774 + 775 + tid_tx = rcu_dereference((*sta)->ampdu_mlme.tid_tx[tid]); 776 + 777 + if (WARN_ON(!tid_tx)) 778 + ht_dbg(sdata, "addBA was not requested!\n"); 779 + 780 + return tid_tx; 781 + } 782 + 783 + void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, 784 + const u8 *ra, u16 tid) 745 785 { 746 786 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 747 787 struct ieee80211_local *local = sdata->local; ··· 790 750 791 751 trace_api_start_tx_ba_cb(sdata, ra, tid); 792 752 793 - if (tid >= IEEE80211_NUM_TIDS) { 794 - ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n", 795 - tid, IEEE80211_NUM_TIDS); 796 - return; 797 - } 753 + rcu_read_lock(); 754 + tid_tx = ieee80211_lookup_tid_tx(sdata, ra, tid, &sta); 755 + if (!tid_tx) 756 + goto out; 798 757 799 - mutex_lock(&local->sta_mtx); 800 - sta = sta_info_get_bss(sdata, ra); 801 - if (!sta) { 802 - mutex_unlock(&local->sta_mtx); 803 - ht_dbg(sdata, "Could not find station: %pM\n", ra); 804 - return; 805 - } 806 - 807 - mutex_lock(&sta->ampdu_mlme.mtx); 808 - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 809 - 810 - if (WARN_ON(!tid_tx)) { 811 - ht_dbg(sdata, "addBA was not requested!\n"); 812 - goto unlock; 813 - } 814 - 815 - if (WARN_ON(test_and_set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state))) 816 - goto unlock; 817 - 818 - if (test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) 819 - ieee80211_agg_tx_operational(local, sta, tid); 820 - 821 - unlock: 822 - mutex_unlock(&sta->ampdu_mlme.mtx); 823 - mutex_unlock(&local->sta_mtx); 824 - } 825 - 826 - void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, 827 - const u8 *ra, u16 tid) 828 - { 829 - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 830 - struct ieee80211_local *local = sdata->local; 831 - struct ieee80211_ra_tid *ra_tid; 832 - struct sk_buff *skb = dev_alloc_skb(0); 833 - 834 - if (unlikely(!skb)) 835 - return; 836 - 837 - ra_tid = (struct ieee80211_ra_tid *) &skb->cb; 838 - memcpy(&ra_tid->ra, ra, ETH_ALEN); 839 - ra_tid->tid = tid; 840 - 841 - skb->pkt_type = IEEE80211_SDATA_QUEUE_AGG_START; 842 - skb_queue_tail(&sdata->skb_queue, skb); 843 - ieee80211_queue_work(&local->hw, &sdata->work); 758 + set_bit(HT_AGG_STATE_START_CB, &tid_tx->state); 759 + ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); 760 + out: 761 + rcu_read_unlock(); 844 762 } 845 763 EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe); 846 764 ··· 858 860 } 859 861 EXPORT_SYMBOL(ieee80211_stop_tx_ba_session); 860 862 861 - void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid) 863 + void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, 864 + struct tid_ampdu_tx *tid_tx) 862 865 { 863 - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 864 - struct ieee80211_local *local = sdata->local; 865 - struct sta_info *sta; 866 - struct tid_ampdu_tx *tid_tx; 866 + struct ieee80211_sub_if_data *sdata = sta->sdata; 867 867 bool send_delba = false; 868 868 869 - trace_api_stop_tx_ba_cb(sdata, ra, tid); 869 + ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n", 870 + sta->sta.addr, tid); 870 871 871 - if (tid >= IEEE80211_NUM_TIDS) { 872 - ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n", 873 - tid, IEEE80211_NUM_TIDS); 874 - return; 875 - } 876 - 877 - ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n", ra, tid); 878 - 879 - mutex_lock(&local->sta_mtx); 880 - 881 - sta = sta_info_get_bss(sdata, ra); 882 - if (!sta) { 883 - ht_dbg(sdata, "Could not find station: %pM\n", ra); 884 - goto unlock; 885 - } 886 - 887 - mutex_lock(&sta->ampdu_mlme.mtx); 888 872 spin_lock_bh(&sta->lock); 889 - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 890 873 891 - if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { 874 + if (!test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { 892 875 ht_dbg(sdata, 893 876 "unexpected callback to A-MPDU stop for %pM tid %d\n", 894 877 sta->sta.addr, tid); ··· 885 906 spin_unlock_bh(&sta->lock); 886 907 887 908 if (send_delba) 888 - ieee80211_send_delba(sdata, ra, tid, 909 + ieee80211_send_delba(sdata, sta->sta.addr, tid, 889 910 WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); 890 - 891 - mutex_unlock(&sta->ampdu_mlme.mtx); 892 - unlock: 893 - mutex_unlock(&local->sta_mtx); 894 911 } 895 912 896 913 void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, ··· 894 919 { 895 920 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 896 921 struct ieee80211_local *local = sdata->local; 897 - struct ieee80211_ra_tid *ra_tid; 898 - struct sk_buff *skb = dev_alloc_skb(0); 922 + struct sta_info *sta; 923 + struct tid_ampdu_tx *tid_tx; 899 924 900 - if (unlikely(!skb)) 901 - return; 925 + trace_api_stop_tx_ba_cb(sdata, ra, tid); 902 926 903 - ra_tid = (struct ieee80211_ra_tid *) &skb->cb; 904 - memcpy(&ra_tid->ra, ra, ETH_ALEN); 905 - ra_tid->tid = tid; 927 + rcu_read_lock(); 928 + tid_tx = ieee80211_lookup_tid_tx(sdata, ra, tid, &sta); 929 + if (!tid_tx) 930 + goto out; 906 931 907 - skb->pkt_type = IEEE80211_SDATA_QUEUE_AGG_STOP; 908 - skb_queue_tail(&sdata->skb_queue, skb); 909 - ieee80211_queue_work(&local->hw, &sdata->work); 932 + set_bit(HT_AGG_STATE_STOP_CB, &tid_tx->state); 933 + ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); 934 + out: 935 + rcu_read_unlock(); 910 936 } 911 937 EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe); 912 938
+12 -4
net/mac80211/ht.c
··· 7 7 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 8 8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 9 9 * Copyright 2007-2010, Intel Corporation 10 + * Copyright 2017 Intel Deutschland GmbH 10 11 * 11 12 * This program is free software; you can redistribute it and/or modify 12 13 * it under the terms of the GNU General Public License version 2 as ··· 290 289 { 291 290 int i; 292 291 293 - cancel_work_sync(&sta->ampdu_mlme.work); 294 - 295 292 for (i = 0; i < IEEE80211_NUM_TIDS; i++) { 296 293 __ieee80211_stop_tx_ba_session(sta, i, reason); 297 294 __ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT, ··· 297 298 reason != AGG_STOP_DESTROY_STA && 298 299 reason != AGG_STOP_PEER_REQUEST); 299 300 } 301 + 302 + /* stopping might queue the work again - so cancel only afterwards */ 303 + cancel_work_sync(&sta->ampdu_mlme.work); 300 304 } 301 305 302 306 void ieee80211_ba_session_work(struct work_struct *work) ··· 354 352 spin_unlock_bh(&sta->lock); 355 353 356 354 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 357 - if (tid_tx && test_and_clear_bit(HT_AGG_STATE_WANT_STOP, 358 - &tid_tx->state)) 355 + if (!tid_tx) 356 + continue; 357 + 358 + if (test_and_clear_bit(HT_AGG_STATE_START_CB, &tid_tx->state)) 359 + ieee80211_start_tx_ba_cb(sta, tid, tid_tx); 360 + if (test_and_clear_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state)) 359 361 ___ieee80211_stop_tx_ba_session(sta, tid, 360 362 AGG_STOP_LOCAL_REQUEST); 363 + if (test_and_clear_bit(HT_AGG_STATE_STOP_CB, &tid_tx->state)) 364 + ieee80211_stop_tx_ba_cb(sta, tid, tid_tx); 361 365 } 362 366 mutex_unlock(&sta->ampdu_mlme.mtx); 363 367 }
+4 -10
net/mac80211/ieee80211_i.h
··· 1036 1036 1037 1037 enum sdata_queue_type { 1038 1038 IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0, 1039 - IEEE80211_SDATA_QUEUE_AGG_START = 1, 1040 - IEEE80211_SDATA_QUEUE_AGG_STOP = 2, 1041 1039 IEEE80211_SDATA_QUEUE_RX_AGG_START = 3, 1042 1040 IEEE80211_SDATA_QUEUE_RX_AGG_STOP = 4, 1043 1041 }; ··· 1425 1427 return local->hw.wiphy->bands[band]; 1426 1428 } 1427 1429 1428 - /* this struct represents 802.11n's RA/TID combination */ 1429 - struct ieee80211_ra_tid { 1430 - u8 ra[ETH_ALEN]; 1431 - u16 tid; 1432 - }; 1433 - 1434 1430 /* this struct holds the value parsing from channel switch IE */ 1435 1431 struct ieee80211_csa_ie { 1436 1432 struct cfg80211_chan_def chandef; ··· 1786 1794 enum ieee80211_agg_stop_reason reason); 1787 1795 int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1788 1796 enum ieee80211_agg_stop_reason reason); 1789 - void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid); 1790 - void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); 1797 + void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid, 1798 + struct tid_ampdu_tx *tid_tx); 1799 + void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, 1800 + struct tid_ampdu_tx *tid_tx); 1791 1801 void ieee80211_ba_session_work(struct work_struct *work); 1792 1802 void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid); 1793 1803 void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
+1 -10
net/mac80211/iface.c
··· 1237 1237 struct ieee80211_local *local = sdata->local; 1238 1238 struct sk_buff *skb; 1239 1239 struct sta_info *sta; 1240 - struct ieee80211_ra_tid *ra_tid; 1241 1240 struct ieee80211_rx_agg *rx_agg; 1242 1241 1243 1242 if (!ieee80211_sdata_running(sdata)) ··· 1252 1253 while ((skb = skb_dequeue(&sdata->skb_queue))) { 1253 1254 struct ieee80211_mgmt *mgmt = (void *)skb->data; 1254 1255 1255 - if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_START) { 1256 - ra_tid = (void *)&skb->cb; 1257 - ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra, 1258 - ra_tid->tid); 1259 - } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_STOP) { 1260 - ra_tid = (void *)&skb->cb; 1261 - ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra, 1262 - ra_tid->tid); 1263 - } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) { 1256 + if (skb->pkt_type == IEEE80211_SDATA_QUEUE_RX_AGG_START) { 1264 1257 rx_agg = (void *)&skb->cb; 1265 1258 mutex_lock(&local->sta_mtx); 1266 1259 sta = sta_info_get_bss(sdata, rx_agg->addr);
+1 -1
net/mac80211/sta_info.c
··· 2155 2155 struct ieee80211_sta_rx_stats *cpurxs; 2156 2156 2157 2157 cpurxs = per_cpu_ptr(sta->pcpu_rx_stats, cpu); 2158 - sinfo->rx_packets += cpurxs->dropped; 2158 + sinfo->rx_dropped_misc += cpurxs->dropped; 2159 2159 } 2160 2160 } 2161 2161
+2
net/mac80211/sta_info.h
··· 116 116 #define HT_AGG_STATE_STOPPING 3 117 117 #define HT_AGG_STATE_WANT_START 4 118 118 #define HT_AGG_STATE_WANT_STOP 5 119 + #define HT_AGG_STATE_START_CB 6 120 + #define HT_AGG_STATE_STOP_CB 7 119 121 120 122 enum ieee80211_agg_stop_reason { 121 123 AGG_STOP_DECLINED,
+1 -1
net/mpls/af_mpls.c
··· 1418 1418 continue; 1419 1419 alive++; 1420 1420 nh_flags &= ~flags; 1421 - WRITE_ONCE(nh->nh_flags, flags); 1421 + WRITE_ONCE(nh->nh_flags, nh_flags); 1422 1422 } endfor_nexthops(rt); 1423 1423 1424 1424 WRITE_ONCE(rt->rt_nhn_alive, alive);
+6 -1
net/netfilter/nf_conntrack_netlink.c
··· 890 890 } 891 891 out: 892 892 local_bh_enable(); 893 - if (last) 893 + if (last) { 894 + /* nf ct hash resize happened, now clear the leftover. */ 895 + if ((struct nf_conn *)cb->args[1] == last) 896 + cb->args[1] = 0; 897 + 894 898 nf_ct_put(last); 899 + } 895 900 896 901 while (i) { 897 902 i--;
+6 -3
net/netfilter/nf_conntrack_proto_sctp.c
··· 512 512 u8 pf, unsigned int hooknum) 513 513 { 514 514 const struct sctphdr *sh; 515 - struct sctphdr _sctph; 516 515 const char *logmsg; 517 516 518 - sh = skb_header_pointer(skb, dataoff, sizeof(_sctph), &_sctph); 519 - if (!sh) { 517 + if (skb->len < dataoff + sizeof(struct sctphdr)) { 520 518 logmsg = "nf_ct_sctp: short packet "; 521 519 goto out_invalid; 522 520 } 523 521 if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING && 524 522 skb->ip_summed == CHECKSUM_NONE) { 523 + if (!skb_make_writable(skb, dataoff + sizeof(struct sctphdr))) { 524 + logmsg = "nf_ct_sctp: failed to read header "; 525 + goto out_invalid; 526 + } 527 + sh = (const struct sctphdr *)(skb->data + dataoff); 525 528 if (sh->checksum != sctp_compute_cksum(skb, dataoff)) { 526 529 logmsg = "nf_ct_sctp: bad CRC "; 527 530 goto out_invalid;
+1 -1
net/netfilter/nf_nat_core.c
··· 566 566 * Else, when the conntrack is destoyed, nf_nat_cleanup_conntrack() 567 567 * will delete entry from already-freed table. 568 568 */ 569 - ct->status &= ~IPS_NAT_DONE_MASK; 569 + clear_bit(IPS_SRC_NAT_DONE_BIT, &ct->status); 570 570 rhltable_remove(&nf_nat_bysource_table, &ct->nat_bysource, 571 571 nf_nat_bysource_params); 572 572
+11 -11
net/netfilter/nft_set_rbtree.c
··· 116 116 else if (d > 0) 117 117 p = &parent->rb_right; 118 118 else { 119 - if (nft_set_elem_active(&rbe->ext, genmask)) { 120 - if (nft_rbtree_interval_end(rbe) && 121 - !nft_rbtree_interval_end(new)) 122 - p = &parent->rb_left; 123 - else if (!nft_rbtree_interval_end(rbe) && 124 - nft_rbtree_interval_end(new)) 125 - p = &parent->rb_right; 126 - else { 127 - *ext = &rbe->ext; 128 - return -EEXIST; 129 - } 119 + if (nft_rbtree_interval_end(rbe) && 120 + !nft_rbtree_interval_end(new)) { 121 + p = &parent->rb_left; 122 + } else if (!nft_rbtree_interval_end(rbe) && 123 + nft_rbtree_interval_end(new)) { 124 + p = &parent->rb_right; 125 + } else if (nft_set_elem_active(&rbe->ext, genmask)) { 126 + *ext = &rbe->ext; 127 + return -EEXIST; 128 + } else { 129 + p = &parent->rb_left; 130 130 } 131 131 } 132 132 }
+3 -1
net/netlink/af_netlink.c
··· 62 62 #include <asm/cacheflush.h> 63 63 #include <linux/hash.h> 64 64 #include <linux/genetlink.h> 65 + #include <linux/net_namespace.h> 65 66 66 67 #include <net/net_namespace.h> 67 68 #include <net/sock.h> ··· 1416 1415 goto out; 1417 1416 } 1418 1417 NETLINK_CB(p->skb2).nsid = peernet2id(sock_net(sk), p->net); 1419 - NETLINK_CB(p->skb2).nsid_is_set = true; 1418 + if (NETLINK_CB(p->skb2).nsid != NETNSA_NSID_NOT_ASSIGNED) 1419 + NETLINK_CB(p->skb2).nsid_is_set = true; 1420 1420 val = netlink_broadcast_deliver(sk, p->skb2); 1421 1421 if (val < 0) { 1422 1422 netlink_overrun(sk);
+5 -2
sound/core/timer.c
··· 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); ··· 1960 1959 1961 1960 tu = file->private_data; 1962 1961 unit = tu->tread ? sizeof(struct snd_timer_tread) : sizeof(struct snd_timer_read); 1962 + mutex_lock(&tu->ioctl_lock); 1963 1963 spin_lock_irq(&tu->qlock); 1964 1964 while ((long)count - result >= unit) { 1965 1965 while (!tu->qused) { ··· 1976 1974 add_wait_queue(&tu->qchange_sleep, &wait); 1977 1975 1978 1976 spin_unlock_irq(&tu->qlock); 1977 + mutex_unlock(&tu->ioctl_lock); 1979 1978 schedule(); 1979 + mutex_lock(&tu->ioctl_lock); 1980 1980 spin_lock_irq(&tu->qlock); 1981 1981 1982 1982 remove_wait_queue(&tu->qchange_sleep, &wait); ··· 1998 1994 tu->qused--; 1999 1995 spin_unlock_irq(&tu->qlock); 2000 1996 2001 - mutex_lock(&tu->ioctl_lock); 2002 1997 if (tu->tread) { 2003 1998 if (copy_to_user(buffer, &tu->tqueue[qhead], 2004 1999 sizeof(struct snd_timer_tread))) ··· 2007 2004 sizeof(struct snd_timer_read))) 2008 2005 err = -EFAULT; 2009 2006 } 2010 - mutex_unlock(&tu->ioctl_lock); 2011 2007 2012 2008 spin_lock_irq(&tu->qlock); 2013 2009 if (err < 0) ··· 2016 2014 } 2017 2015 _error: 2018 2016 spin_unlock_irq(&tu->qlock); 2017 + mutex_unlock(&tu->ioctl_lock); 2019 2018 return result > 0 ? result : err; 2020 2019 } 2021 2020
+6 -5
sound/pci/hda/patch_realtek.c
··· 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), ··· 5866 5862 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), 5867 5863 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), 5868 5864 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), 5865 + SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC), 5869 5866 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), 5870 - SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 5871 5867 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), 5872 - SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), 5873 - SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), 5874 - SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), 5875 - SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE), 5868 + SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 5876 5869 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), 5877 5870 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), 5878 5871 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
+9
sound/soc/atmel/atmel-classd.c
··· 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); ··· 316 308 317 309 static struct snd_soc_codec_driver soc_codec_dev_classd = { 318 310 .probe = atmel_classd_codec_probe, 311 + .resume = atmel_classd_codec_resume, 319 312 .get_regmap = atmel_classd_codec_get_remap, 320 313 .component_driver = { 321 314 .controls = atmel_classd_snd_controls,
+1 -1
sound/soc/codecs/da7213.c
··· 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");
+7
sound/soc/codecs/rt286.c
··· 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 };
+1 -1
sound/soc/generic/simple-card.c
··· 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
+5
sound/soc/intel/skylake/skl-sst-ipc.c
··· 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; ··· 459 456 } 460 457 } 461 458 459 + spin_lock_irqsave(&ipc->dsp->spinlock, flags); 462 460 list_del(&msg->list); 463 461 sst_ipc_tx_msg_reply_complete(ipc, msg); 462 + spin_unlock_irqrestore(&ipc->dsp->spinlock, flags); 464 463 } 465 464 466 465 irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context)
+1 -1
sound/soc/intel/skylake/skl-topology.c
··· 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);
+88 -74
sound/soc/intel/skylake/skl.c
··· 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 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 ··· 568 566 .get_response = snd_hdac_bus_get_response, 569 567 }; 570 568 569 + static int skl_i915_init(struct hdac_bus *bus) 570 + { 571 + int err; 572 + 573 + /* 574 + * The HDMI codec is in GPU so we need to ensure that it is powered 575 + * up and ready for probe 576 + */ 577 + err = snd_hdac_i915_init(bus); 578 + if (err < 0) 579 + return err; 580 + 581 + err = snd_hdac_display_power(bus, true); 582 + if (err < 0) 583 + dev_err(bus->dev, "Cannot turn on display power on i915\n"); 584 + 585 + return err; 586 + } 587 + 588 + static void skl_probe_work(struct work_struct *work) 589 + { 590 + struct skl *skl = container_of(work, struct skl, probe_work); 591 + struct hdac_ext_bus *ebus = &skl->ebus; 592 + struct hdac_bus *bus = ebus_to_hbus(ebus); 593 + struct hdac_ext_link *hlink = NULL; 594 + int err; 595 + 596 + if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { 597 + err = skl_i915_init(bus); 598 + if (err < 0) 599 + return; 600 + } 601 + 602 + err = skl_init_chip(bus, true); 603 + if (err < 0) { 604 + dev_err(bus->dev, "Init chip failed with err: %d\n", err); 605 + goto out_err; 606 + } 607 + 608 + /* codec detection */ 609 + if (!bus->codec_mask) 610 + dev_info(bus->dev, "no hda codecs found!\n"); 611 + 612 + /* create codec instances */ 613 + err = skl_codec_create(ebus); 614 + if (err < 0) 615 + goto out_err; 616 + 617 + if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { 618 + err = snd_hdac_display_power(bus, false); 619 + if (err < 0) { 620 + dev_err(bus->dev, "Cannot turn off display power on i915\n"); 621 + return; 622 + } 623 + } 624 + 625 + /* register platform dai and controls */ 626 + err = skl_platform_register(bus->dev); 627 + if (err < 0) 628 + return; 629 + /* 630 + * we are done probing so decrement link counts 631 + */ 632 + list_for_each_entry(hlink, &ebus->hlink_list, list) 633 + snd_hdac_ext_bus_link_put(ebus, hlink); 634 + 635 + /* configure PM */ 636 + pm_runtime_put_noidle(bus->dev); 637 + pm_runtime_allow(bus->dev); 638 + skl->init_done = 1; 639 + 640 + return; 641 + 642 + out_err: 643 + if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) 644 + err = snd_hdac_display_power(bus, false); 645 + } 646 + 571 647 /* 572 648 * constructor 573 649 */ ··· 673 593 snd_hdac_ext_bus_init(ebus, &pci->dev, &bus_core_ops, io_ops); 674 594 ebus->bus.use_posbuf = 1; 675 595 skl->pci = pci; 596 + INIT_WORK(&skl->probe_work, skl_probe_work); 676 597 677 598 ebus->bus.bdl_pos_adj = 0; 678 599 679 600 *rskl = skl; 680 601 681 602 return 0; 682 - } 683 - 684 - static int skl_i915_init(struct hdac_bus *bus) 685 - { 686 - int err; 687 - 688 - /* 689 - * The HDMI codec is in GPU so we need to ensure that it is powered 690 - * up and ready for probe 691 - */ 692 - err = snd_hdac_i915_init(bus); 693 - if (err < 0) 694 - return err; 695 - 696 - err = snd_hdac_display_power(bus, true); 697 - if (err < 0) { 698 - dev_err(bus->dev, "Cannot turn on display power on i915\n"); 699 - return err; 700 - } 701 - 702 - return err; 703 603 } 704 604 705 605 static int skl_first_init(struct hdac_ext_bus *ebus) ··· 744 684 /* initialize chip */ 745 685 skl_init_pci(skl); 746 686 747 - if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { 748 - err = skl_i915_init(bus); 749 - if (err < 0) 750 - return err; 751 - } 752 - 753 - skl_init_chip(bus, true); 754 - 755 - /* codec detection */ 756 - if (!bus->codec_mask) { 757 - dev_info(bus->dev, "no hda codecs found!\n"); 758 - } 759 - 760 - return 0; 687 + return skl_init_chip(bus, true); 761 688 } 762 689 763 690 static int skl_probe(struct pci_dev *pci, ··· 753 706 struct skl *skl; 754 707 struct hdac_ext_bus *ebus = NULL; 755 708 struct hdac_bus *bus = NULL; 756 - struct hdac_ext_link *hlink = NULL; 757 709 int err; 758 710 759 711 /* we use ext core ops, so provide NULL for ops here */ ··· 775 729 776 730 if (skl->nhlt == NULL) { 777 731 err = -ENODEV; 778 - goto out_display_power_off; 732 + goto out_free; 779 733 } 780 734 781 735 err = skl_nhlt_create_sysfs(skl); ··· 806 760 if (bus->mlcap) 807 761 snd_hdac_ext_bus_get_ml_capabilities(ebus); 808 762 763 + snd_hdac_bus_stop_chip(bus); 764 + 809 765 /* create device for soc dmic */ 810 766 err = skl_dmic_device_register(skl); 811 767 if (err < 0) 812 768 goto out_dsp_free; 813 769 814 - /* register platform dai and controls */ 815 - err = skl_platform_register(bus->dev); 816 - if (err < 0) 817 - goto out_dmic_free; 818 - 819 - /* create codec instances */ 820 - err = skl_codec_create(ebus); 821 - if (err < 0) 822 - goto out_unregister; 823 - 824 - if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) { 825 - err = snd_hdac_display_power(bus, false); 826 - if (err < 0) { 827 - dev_err(bus->dev, "Cannot turn off display power on i915\n"); 828 - return err; 829 - } 830 - } 831 - 832 - /* 833 - * we are done probling so decrement link counts 834 - */ 835 - list_for_each_entry(hlink, &ebus->hlink_list, list) 836 - snd_hdac_ext_bus_link_put(ebus, hlink); 837 - 838 - /* configure PM */ 839 - pm_runtime_put_noidle(bus->dev); 840 - pm_runtime_allow(bus->dev); 770 + schedule_work(&skl->probe_work); 841 771 842 772 return 0; 843 773 844 - out_unregister: 845 - skl_platform_unregister(bus->dev); 846 - out_dmic_free: 847 - skl_dmic_device_unregister(skl); 848 774 out_dsp_free: 849 775 skl_free_dsp(skl); 850 776 out_mach_free: 851 777 skl_machine_device_unregister(skl); 852 778 out_nhlt_free: 853 779 skl_nhlt_free(skl->nhlt); 854 - out_display_power_off: 855 - if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) 856 - snd_hdac_display_power(bus, false); 857 780 out_free: 858 - skl->init_failed = 1; 859 781 skl_free(ebus); 860 782 861 783 return err; ··· 842 828 843 829 skl = ebus_to_skl(ebus); 844 830 845 - if (skl->init_failed) 831 + if (!skl->init_done) 846 832 return; 847 833 848 834 snd_hdac_ext_stop_streams(ebus);
+3 -1
sound/soc/intel/skylake/skl.h
··· 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 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)
+4 -2
sound/soc/sh/rcar/adg.c
··· 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 } ··· 523 522 rbgb = rbgx; 524 523 adg->rbgb_rate_for_48khz = rate / div; 525 524 ckr |= brg_table[i] << 16; 526 - if (req_48kHz_rate) 525 + if (req_48kHz_rate && 526 + (adg_mode_flags(adg) & AUDIO_OUT_48)) 527 527 parent_clk_name = __clk_get_name(clk); 528 528 } 529 529 }
+1
sound/soc/sh/rcar/cmd.c
··· 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);
+51
sound/soc/sh/rcar/core.c
··· 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 */
+1
sound/soc/sh/rcar/gen.c
··· 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),
+2
sound/soc/sh/rcar/rsnd.h
··· 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, ··· 205 204 u32 mask, u32 data); 206 205 u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io); 207 206 u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io); 207 + u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod); 208 208 209 209 /* 210 210 * R-Car DMA
+10 -2
sound/soc/sh/rcar/src.c
··· 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) ··· 272 270 break; 273 271 } 274 272 273 + /* BUSIF_MODE */ 274 + tmp = rsnd_get_busif_shift(io, mod); 275 + i_busif = ( is_play ? tmp : 0) | 1; 276 + o_busif = (!is_play ? tmp : 0) | 1; 277 + 275 278 rsnd_mod_write(mod, SRC_ROUTE_MODE0, route); 276 279 277 280 rsnd_mod_write(mod, SRC_SRCIR, 1); /* initialize */ ··· 288 281 rsnd_mod_write(mod, SRC_BSISR, bsisr); 289 282 rsnd_mod_write(mod, SRC_SRCIR, 0); /* cancel initialize */ 290 283 291 - rsnd_mod_write(mod, SRC_I_BUSIF_MODE, 1); 292 - rsnd_mod_write(mod, SRC_O_BUSIF_MODE, 1); 284 + rsnd_mod_write(mod, SRC_I_BUSIF_MODE, i_busif); 285 + rsnd_mod_write(mod, SRC_O_BUSIF_MODE, o_busif); 286 + 293 287 rsnd_mod_write(mod, SRC_BUSIF_DALIGN, rsnd_get_dalign(mod, io)); 294 288 295 289 rsnd_adg_set_src_timesel_gen2(mod, io, fin, fout);
+15 -3
sound/soc/sh/rcar/ssi.c
··· 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 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 ··· 564 557 * see rsnd_ssi_init() 565 558 */ 566 559 if (rsnd_io_is_play(io)) 567 - rsnd_mod_write(mod, SSITDR, *buf); 560 + rsnd_mod_write(mod, SSITDR, (*buf) << shift); 568 561 else 569 - *buf = rsnd_mod_read(mod, SSIRDR); 562 + *buf = (rsnd_mod_read(mod, SSIRDR) >> shift); 570 563 571 564 elapsed = rsnd_dai_pointer_update(io, sizeof(*buf)); 572 565 } ··· 716 709 struct rsnd_priv *priv) 717 710 { 718 711 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); 712 + struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io); 713 + 714 + /* Do nothing for SSI parent mod */ 715 + if (ssi_parent_mod == mod) 716 + return 0; 719 717 720 718 /* PIO will request IRQ again */ 721 719 free_irq(ssi->irq, mod);
+2 -1
sound/soc/sh/rcar/ssiu.c
··· 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 }
+3 -2
sound/soc/soc-core.c
··· 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); ··· 2303 2300 if (card->remove) 2304 2301 card->remove(card); 2305 2302 2306 - snd_card_free(card->snd_card); 2307 2303 return 0; 2308 - 2309 2304 } 2310 2305 2311 2306 /* removes a socdev */
+6 -2
tools/perf/Documentation/perf-probe.txt
··· 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
+1 -1
tools/perf/Documentation/perf-script-perl.txt
··· 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
+9 -14
tools/perf/Documentation/perf-script-python.txt
··· 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 " % \ ··· 319 321 process can be generalized to any tracepoint or set of tracepoints 320 322 you're interested in - basically find the tracepoint(s) you're 321 323 interested in by looking at the list of available events shown by 322 - 'perf list' and/or look in /sys/kernel/debug/tracing events for 324 + 'perf list' and/or look in /sys/kernel/debug/tracing/events/ for 323 325 detailed event and field info, record the corresponding trace data 324 326 using 'perf record', passing it the list of interesting events, 325 327 generate a skeleton script using 'perf script -g python' and modify the ··· 332 334 scripts listed by the 'perf script -l' command e.g.: 333 335 334 336 ---- 335 - root@tropicana:~# perf script -l 337 + # perf script -l 336 338 List of available trace scripts: 337 339 wakeup-latency system-wide min/max/avg wakeup latency 338 340 rw-by-file <comm> r/w activity for a program, by file ··· 381 383 382 384 ---- 383 385 # ls -al kernel-source/tools/perf/scripts/python 384 - 385 - root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python 386 386 total 32 387 387 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 . 388 388 drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 .. ··· 395 399 should show a new entry for your script: 396 400 397 401 ---- 398 - root@tropicana:~# perf script -l 402 + # perf script -l 399 403 List of available trace scripts: 400 404 wakeup-latency system-wide min/max/avg wakeup latency 401 405 rw-by-file <comm> r/w activity for a program, by file ··· 433 437 When perf script is invoked using a trace script, a user-defined 434 438 'handler function' is called for each event in the trace. If there's 435 439 no handler function defined for a given event type, the event is 436 - ignored (or passed to a 'trace_handled' function, see below) and the 440 + ignored (or passed to a 'trace_unhandled' function, see below) and the 437 441 next event is processed. 438 442 439 443 Most of the event's field values are passed as arguments to the ··· 528 532 gives scripts a chance to do setup tasks: 529 533 530 534 ---- 531 - def trace_begin: 535 + def trace_begin(): 532 536 pass 533 537 ---- 534 538 ··· 537 541 as display results: 538 542 539 543 ---- 540 - def trace_end: 544 + def trace_end(): 541 545 pass 542 546 ---- 543 547 ··· 546 550 of common arguments are passed into it: 547 551 548 552 ---- 549 - def trace_unhandled(event_name, context, common_cpu, common_secs, 550 - common_nsecs, common_pid, common_comm): 553 + def trace_unhandled(event_name, context, event_fields_dict): 551 554 pass 552 555 ---- 553 556
+1
tools/perf/arch/common.c
··· 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-",
+4 -1
tools/perf/builtin-stat.c
··· 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"); ··· 1591 1590 } 1592 1591 fprintf(output, "\n\n"); 1593 1592 1594 - if (print_free_counters_hint) 1593 + if (print_free_counters_hint && 1594 + sysctl__read_int("kernel/nmi_watchdog", &n) >= 0 && 1595 + n > 0) 1595 1596 fprintf(output, 1596 1597 "Some events weren't counted. Try disabling the NMI watchdog:\n" 1597 1598 " echo 0 > /proc/sys/kernel/nmi_watchdog\n"
+4
tools/perf/builtin-trace.c
··· 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 */ }, },
+14
tools/perf/tests/bp_signal.c
··· 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 + }
+7
tools/perf/tests/builtin-test.c
··· 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", ··· 402 400 403 401 if (!perf_test__matches(t, curr, argc, argv)) 404 402 continue; 403 + 404 + if (t->is_supported && !t->is_supported()) { 405 + pr_debug("%2d: %-*s: Disabled\n", i, width, t->desc); 406 + continue; 407 + } 405 408 406 409 pr_info("%2d: %-*s:", i, width, t->desc); 407 410
+19 -1
tools/perf/tests/code-reading.c
··· 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); ··· 291 289 state->done[state->done_cnt++] = al.map->start; 292 290 } 293 291 292 + objdump_name = al.map->dso->long_name; 293 + if (dso__needs_decompress(al.map->dso)) { 294 + if (dso__decompress_kmodule_path(al.map->dso, objdump_name, 295 + decomp_name, 296 + sizeof(decomp_name)) < 0) { 297 + pr_debug("decompression failed\n"); 298 + return -1; 299 + } 300 + 301 + objdump_name = decomp_name; 302 + } 303 + 294 304 /* Read the object code using objdump */ 295 305 objdump_addr = map__rip_2objdump(al.map, al.addr); 296 - ret = read_via_objdump(al.map->dso->long_name, objdump_addr, buf2, len); 306 + ret = read_via_objdump(objdump_name, objdump_addr, buf2, len); 307 + 308 + if (dso__needs_decompress(al.map->dso)) 309 + unlink(objdump_name); 310 + 297 311 if (ret > 0) { 298 312 /* 299 313 * The kernel maps are inaccurate - assume objdump is right in
+3
tools/perf/tests/tests.h
··· 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 98 const char *test__clang_subtest_get_desc(int subtest); 100 99 int test__clang_subtest_get_nr(void); 101 100 int test__unit_number__scnprint(int subtest); 101 + 102 + bool test__bp_signal_is_supported(void); 102 103 103 104 #if defined(__arm__) || defined(__aarch64__) 104 105 #ifdef HAVE_DWARF_UNWIND_SUPPORT
+43 -29
tools/perf/util/annotate.c
··· 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); ··· 267 257 static int jump__scnprintf(struct ins *ins, char *bf, size_t size, 268 258 struct ins_operands *ops) 269 259 { 260 + const char *c = strchr(ops->raw, ','); 261 + 270 262 if (!ops->target.addr || ops->target.offset < 0) 271 263 return ins__raw_scnprintf(ins, bf, size, ops); 272 264 273 - return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset); 265 + if (c != NULL) { 266 + const char *c2 = strchr(c + 1, ','); 267 + 268 + /* check for 3-op insn */ 269 + if (c2 != NULL) 270 + c = c2; 271 + c++; 272 + 273 + /* mirror arch objdump's space-after-comma style */ 274 + if (*c == ' ') 275 + c++; 276 + } 277 + 278 + return scnprintf(bf, size, "%-6.6s %.*s%" PRIx64, 279 + ins->name, c ? c - ops->raw : 0, ops->raw, 280 + ops->target.offset); 274 281 } 275 282 276 283 static struct ins_ops jump_ops = { ··· 1321 1294 char linkname[PATH_MAX]; 1322 1295 char *build_id_filename; 1323 1296 char *build_id_path = NULL; 1297 + char *pos; 1324 1298 1325 1299 if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && 1326 1300 !dso__is_kcore(dso)) ··· 1341 1313 if (!build_id_path) 1342 1314 return -1; 1343 1315 1344 - dirname(build_id_path); 1316 + /* 1317 + * old style build-id cache has name of XX/XXXXXXX.. while 1318 + * new style has XX/XXXXXXX../{elf,kallsyms,vdso}. 1319 + * extract the build-id part of dirname in the new style only. 1320 + */ 1321 + pos = strrchr(build_id_path, '/'); 1322 + if (pos && strlen(pos) < SBUILD_ID_SIZE - 2) 1323 + dirname(build_id_path); 1345 1324 1346 1325 if (dso__is_kcore(dso) || 1347 1326 readlink(build_id_path, linkname, sizeof(linkname)) < 0 || ··· 1431 1396 sizeof(symfs_filename)); 1432 1397 } 1433 1398 } else if (dso__needs_decompress(dso)) { 1434 - char tmp[PATH_MAX]; 1435 - struct kmod_path m; 1436 - int fd; 1437 - bool ret; 1399 + char tmp[KMOD_DECOMP_LEN]; 1438 1400 1439 - if (kmod_path__parse_ext(&m, symfs_filename)) 1440 - goto out; 1441 - 1442 - snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX"); 1443 - 1444 - fd = mkstemp(tmp); 1445 - if (fd < 0) { 1446 - free(m.ext); 1447 - goto out; 1448 - } 1449 - 1450 - ret = decompress_to_file(m.ext, symfs_filename, fd); 1451 - 1452 - if (ret) 1453 - pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename); 1454 - 1455 - free(m.ext); 1456 - close(fd); 1457 - 1458 - if (!ret) 1401 + if (dso__decompress_kmodule_path(dso, symfs_filename, 1402 + tmp, sizeof(tmp)) < 0) 1459 1403 goto out; 1460 1404 1461 1405 strcpy(symfs_filename, tmp); ··· 1443 1429 snprintf(command, sizeof(command), 1444 1430 "%s %s%s --start-address=0x%016" PRIx64 1445 1431 " --stop-address=0x%016" PRIx64 1446 - " -l -d %s %s -C %s 2>/dev/null|grep -v %s:|expand", 1432 + " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand", 1447 1433 objdump_path ? objdump_path : "objdump", 1448 1434 disassembler_style ? "-M " : "", 1449 1435 disassembler_style ? disassembler_style : "",
-45
tools/perf/util/build-id.c
··· 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) \
-1
tools/perf/util/build-id.h
··· 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,
+94 -6
tools/perf/util/dso.c
··· 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: ··· 393 335 return 0; 394 336 } 395 337 338 + void dso__set_module_info(struct dso *dso, struct kmod_path *m, 339 + struct machine *machine) 340 + { 341 + if (machine__is_host(machine)) 342 + dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; 343 + else 344 + dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE; 345 + 346 + /* _KMODULE_COMP should be next to _KMODULE */ 347 + if (m->kmod && m->comp) 348 + dso->symtab_type++; 349 + 350 + dso__set_short_name(dso, strdup(m->name), true); 351 + } 352 + 396 353 /* 397 354 * Global list of open DSOs and the counter. 398 355 */ ··· 454 381 455 382 static int __open_dso(struct dso *dso, struct machine *machine) 456 383 { 457 - int fd; 384 + int fd = -EINVAL; 458 385 char *root_dir = (char *)""; 459 386 char *name = malloc(PATH_MAX); 460 387 ··· 465 392 root_dir = machine->root_dir; 466 393 467 394 if (dso__read_binary_type_filename(dso, dso->binary_type, 468 - root_dir, name, PATH_MAX)) { 469 - free(name); 470 - return -EINVAL; 471 - } 395 + root_dir, name, PATH_MAX)) 396 + goto out; 472 397 473 398 if (!is_regular_file(name)) 474 - return -EINVAL; 399 + goto out; 400 + 401 + if (dso__needs_decompress(dso)) { 402 + char newpath[KMOD_DECOMP_LEN]; 403 + size_t len = sizeof(newpath); 404 + 405 + if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) { 406 + fd = -dso->load_errno; 407 + goto out; 408 + } 409 + 410 + strcpy(name, newpath); 411 + } 475 412 476 413 fd = do_open(name); 414 + 415 + if (dso__needs_decompress(dso)) 416 + unlink(name); 417 + 418 + out: 477 419 free(name); 478 420 return fd; 479 421 }
+9
tools/perf/util/dso.h
··· 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; ··· 264 258 #define kmod_path__parse(__m, __p) __kmod_path__parse(__m, __p, false, false) 265 259 #define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false) 266 260 #define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true) 261 + 262 + void dso__set_module_info(struct dso *dso, struct kmod_path *m, 263 + struct machine *machine); 267 264 268 265 /* 269 266 * The dso__data_* external interface provides following functions:
+10 -2
tools/perf/util/header.c
··· 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);
+1 -10
tools/perf/util/machine.c
··· 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
+1 -1
tools/perf/util/scripting-engines/trace-event-python.c
··· 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");
+3 -38
tools/perf/util/symbol-elf.c
··· 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; ··· 668 705 int fd; 669 706 670 707 if (dso__needs_decompress(dso)) { 671 - fd = decompress_kmodule(dso, name, type); 708 + fd = dso__decompress_kmodule_fd(dso, name); 672 709 if (fd < 0) 673 710 return -1; 711 + 712 + type = dso->symtab_type; 674 713 } else { 675 714 fd = open(name, O_RDONLY); 676 715 if (fd < 0) {
-4
tools/perf/util/symbol.c
··· 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
+9 -1
tools/perf/util/unwind-libdw.c
··· 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, ··· 232 224 233 225 err = dwfl_getthread_frames(ui->dwfl, thread->tid, frame_callback, ui); 234 226 235 - if (err && !ui->max_stack) 227 + if (err && ui->max_stack != max_stack) 236 228 err = 0; 237 229 238 230 /*