Unified · Split
| @@ -196,7 +196,8 @@ Oleksij Rempel <linux@rempel-privat.de> <o.rempel@pengutronix.de> · 195 unmodified lines | |||
| 196 | Oleksij Rempel <linux@rempel-privat.de> <ore@pengutronix.de> | 196 | Oleksij Rempel <linux@rempel-privat.de> <ore@pengutronix.de> |
| 197 | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 197 | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> |
| 198 | Patrick Mochel <mochel@digitalimplant.org> | 198 | Patrick Mochel <mochel@digitalimplant.org> |
| 199 | Paul Burton <paul.burton@mips.com> <paul.burton@imgtec.com> | 199 | Paul Burton <paulburton@kernel.org> <paul.burton@imgtec.com> |
| 200 | Paul Burton <paulburton@kernel.org> <paul.burton@mips.com> | ||
| 200 | Peter A Jonsson <pj@ludd.ltu.se> | 201 | Peter A Jonsson <pj@ludd.ltu.se> |
| 201 | Peter Oruba <peter@oruba.de> | 202 | Peter Oruba <peter@oruba.de> |
| 202 | Peter Oruba <peter.oruba@amd.com> | 203 | Peter Oruba <peter.oruba@amd.com> |
| @@ -229,6 +230,7 @@ Shuah Khan <shuah@kernel.org> <shuahkhan@gmail.com> · 26 unmodified lines | |||
| 229 | Shuah Khan <shuah@kernel.org> <shuah.khan@hp.com> | 230 | Shuah Khan <shuah@kernel.org> <shuah.khan@hp.com> |
| 230 | Shuah Khan <shuah@kernel.org> <shuahkh@osg.samsung.com> | 231 | Shuah Khan <shuah@kernel.org> <shuahkh@osg.samsung.com> |
| 231 | Shuah Khan <shuah@kernel.org> <shuah.kh@samsung.com> | 232 | Shuah Khan <shuah@kernel.org> <shuah.kh@samsung.com> |
| 233 | Simon Arlott <simon@octiron.net> <simon@fire.lp0.eu> | ||
| 232 | Simon Kelley <simon@thekelleys.org.uk> | 234 | Simon Kelley <simon@thekelleys.org.uk> |
| 233 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> | 235 | Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> |
| 234 | Stephen Hemminger <shemminger@osdl.org> | 236 | Stephen Hemminger <shemminger@osdl.org> |
| @@ -107,6 +107,8 @@ stable kernels. · 106 unmodified lines | |||
| 107 | +----------------+-----------------+-----------------+-----------------------------+ | 107 | +----------------+-----------------+-----------------+-----------------------------+ |
| 108 | | Cavium | ThunderX2 SMMUv3| #126 | N/A | | 108 | | Cavium | ThunderX2 SMMUv3| #126 | N/A | |
| 109 | +----------------+-----------------+-----------------+-----------------------------+ | 109 | +----------------+-----------------+-----------------+-----------------------------+ |
| 110 | | Cavium | ThunderX2 Core | #219 | CAVIUM_TX2_ERRATUM_219 | | ||
| 111 | +----------------+-----------------+-----------------+-----------------------------+ | ||
| 110 | +----------------+-----------------+-----------------+-----------------------------+ | 112 | +----------------+-----------------+-----------------+-----------------------------+ |
| 111 | | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | | 113 | | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | |
| 112 | +----------------+-----------------+-----------------+-----------------------------+ | 114 | +----------------+-----------------+-----------------+-----------------------------+ |
| @@ -41,6 +41,9 @@ smaller binary while the latter is 1.1 - 2 times faster. · 40 unmodified lines | |||
| 41 | Both KASAN modes work with both SLUB and SLAB memory allocators. | 41 | Both KASAN modes work with both SLUB and SLAB memory allocators. |
| 42 | For better bug detection and nicer reporting, enable CONFIG_STACKTRACE. | 42 | For better bug detection and nicer reporting, enable CONFIG_STACKTRACE. |
| 43 | 43 | ||
| 44 | To augment reports with last allocation and freeing stack of the physical page, | ||
| 45 | it is recommended to enable also CONFIG_PAGE_OWNER and boot with page_owner=on. | ||
| 46 | |||
| 44 | To disable instrumentation for specific files or directories, add a line | 47 | To disable instrumentation for specific files or directories, add a line |
| 45 | similar to the following to the respective kernel Makefile: | 48 | similar to the following to the respective kernel Makefile: |
| 46 | 49 | ||
| @@ -496,12 +496,12 @@ properties: · 495 unmodified lines | |||
| 496 | 496 | ||
| 497 | - description: Theobroma Systems RK3368-uQ7 with Haikou baseboard | 497 | - description: Theobroma Systems RK3368-uQ7 with Haikou baseboard |
| 498 | items: | 498 | items: |
| 499 | - const: tsd,rk3368-uq7-haikou | 499 | - const: tsd,rk3368-lion-haikou |
| 500 | - const: rockchip,rk3368 | 500 | - const: rockchip,rk3368 |
| 501 | 501 | ||
| 502 | - description: Theobroma Systems RK3399-Q7 with Haikou baseboard | 502 | - description: Theobroma Systems RK3399-Q7 with Haikou baseboard |
| 503 | items: | 503 | items: |
| 504 | - const: tsd,rk3399-q7-haikou | 504 | - const: tsd,rk3399-puma-haikou |
| 505 | - const: rockchip,rk3399 | 505 | - const: rockchip,rk3399 |
| 506 | 506 | ||
| 507 | - description: Tronsmart Orion R68 Meta | 507 | - description: Tronsmart Orion R68 Meta |
| @@ -1,8 +1,11 @@ | |||
| 1 | * Advanced Interrupt Controller (AIC) | 1 | * Advanced Interrupt Controller (AIC) |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: Should be "atmel,<chip>-aic" | 4 | - compatible: Should be: |
| 5 | <chip> can be "at91rm9200", "sama5d2", "sama5d3" or "sama5d4" | 5 | - "atmel,<chip>-aic" where <chip> can be "at91rm9200", "sama5d2", |
| 6 | "sama5d3" or "sama5d4" | ||
| 7 | - "microchip,<chip>-aic" where <chip> can be "sam9x60" | ||
| 8 | |||
| 6 | - interrupt-controller: Identifies the node as an interrupt controller. | 9 | - interrupt-controller: Identifies the node as an interrupt controller. |
| 7 | - #interrupt-cells: The number of cells to define the interrupts. It should be 3. | 10 | - #interrupt-cells: The number of cells to define the interrupts. It should be 3. |
| 8 | The first cell is the IRQ number (aka "Peripheral IDentifier" on datasheet). | 11 | The first cell is the IRQ number (aka "Peripheral IDentifier" on datasheet). |
| @@ -1,7 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) |
| 2 | %YAML 1.2 | 2 | %YAML 1.2 |
| 3 | --- | 3 | --- |
| 4 | $id: http://devicetree.org/schemas/arm/allwinner,sun4i-a10-csi.yaml# | 4 | $id: http://devicetree.org/schemas/media/allwinner,sun4i-a10-csi.yaml# |
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# |
| 6 | 6 | ||
| 7 | title: Allwinner A10 CMOS Sensor Interface (CSI) Device Tree Bindings | 7 | title: Allwinner A10 CMOS Sensor Interface (CSI) Device Tree Bindings |
| @@ -27,14 +27,12 @@ properties: · 19 unmodified lines | |||
| 27 | clocks: | 27 | clocks: |
| 28 | items: | 28 | items: |
| 29 | - description: The CSI interface clock | 29 | - description: The CSI interface clock |
| 30 | - description: The CSI module clock | ||
| 31 | - description: The CSI ISP clock | 30 | - description: The CSI ISP clock |
| 32 | - description: The CSI DRAM clock | 31 | - description: The CSI DRAM clock |
| 33 | 32 | ||
| 34 | clock-names: | 33 | clock-names: |
| 35 | items: | 34 | items: |
| 36 | - const: bus | 35 | - const: bus |
| 37 | - const: mod | ||
| 38 | - const: isp | 36 | - const: isp |
| 39 | - const: ram | 37 | - const: ram |
| 40 | 38 | ||
| @@ -89,9 +87,8 @@ examples: · 48 unmodified lines | |||
| 89 | compatible = "allwinner,sun7i-a20-csi0"; | 87 | compatible = "allwinner,sun7i-a20-csi0"; |
| 90 | reg = <0x01c09000 0x1000>; | 88 | reg = <0x01c09000 0x1000>; |
| 91 | interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; | 89 | interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; |
| 92 | clocks = <&ccu CLK_AHB_CSI0>, <&ccu CLK_CSI0>, | 90 | clocks = <&ccu CLK_AHB_CSI0>, <&ccu CLK_CSI_SCLK>, <&ccu CLK_DRAM_CSI0>; |
| 93 | <&ccu CLK_CSI_SCLK>, <&ccu CLK_DRAM_CSI0>; | 91 | clock-names = "bus", "isp", "ram"; |
| 94 | clock-names = "bus", "mod", "isp", "ram"; | ||
| 95 | resets = <&ccu RST_CSI0>; | 92 | resets = <&ccu RST_CSI0>; |
| 96 | 93 | ||
| 97 | port { | 94 | port { |
| @@ -33,13 +33,13 @@ patternProperties: · 32 unmodified lines | |||
| 33 | allOf: | 33 | allOf: |
| 34 | - $ref: "/schemas/types.yaml#/definitions/string" | 34 | - $ref: "/schemas/types.yaml#/definitions/string" |
| 35 | - enum: [ ADC0, ADC1, ADC10, ADC11, ADC12, ADC13, ADC14, ADC15, | 35 | - enum: [ ADC0, ADC1, ADC10, ADC11, ADC12, ADC13, ADC14, ADC15, |
| 36 | ADC2, ADC3, ADC4, ADC5, ADC6, ADC7, ADC8, ADC9, BMCINT, ESPI, | 36 | ADC2, ADC3, ADC4, ADC5, ADC6, ADC7, ADC8, ADC9, BMCINT, EMMC, |
| 37 | ESPIALT, FSI1, FSI2, FWSPIABR, FWSPID, FWSPIWP, GPIT0, GPIT1, | 37 | ESPI, ESPIALT, FSI1, FSI2, FWSPIABR, FWSPID, FWSPIWP, GPIT0, |
| 38 | GPIT2, GPIT3, GPIT4, GPIT5, GPIT6, GPIT7, GPIU0, GPIU1, GPIU2, | 38 | GPIT1, GPIT2, GPIT3, GPIT4, GPIT5, GPIT6, GPIT7, GPIU0, GPIU1, |
| 39 | GPIU3, GPIU4, GPIU5, GPIU6, GPIU7, I2C1, I2C10, I2C11, I2C12, | 39 | GPIU2, GPIU3, GPIU4, GPIU5, GPIU6, GPIU7, I2C1, I2C10, I2C11, |
| 40 | I2C13, I2C14, I2C15, I2C16, I2C2, I2C3, I2C4, I2C5, I2C6, I2C7, | 40 | I2C12, I2C13, I2C14, I2C15, I2C16, I2C2, I2C3, I2C4, I2C5, I2C6, |
| 41 | I2C8, I2C9, I3C3, I3C4, I3C5, I3C6, JTAGM, LHPD, LHSIRQ, LPC, | 41 | I2C7, I2C8, I2C9, I3C3, I3C4, I3C5, I3C6, JTAGM, LHPD, LHSIRQ, |
| 42 | LPCHC, LPCPD, LPCPME, LPCSMI, LSIRQ, MACLINK1, MACLINK2, | 42 | LPC, LPCHC, LPCPD, LPCPME, LPCSMI, LSIRQ, MACLINK1, MACLINK2, |
| 43 | MACLINK3, MACLINK4, MDIO1, MDIO2, MDIO3, MDIO4, NCTS1, NCTS2, | 43 | MACLINK3, MACLINK4, MDIO1, MDIO2, MDIO3, MDIO4, NCTS1, NCTS2, |
| 44 | NCTS3, NCTS4, NDCD1, NDCD2, NDCD3, NDCD4, NDSR1, NDSR2, NDSR3, | 44 | NCTS3, NCTS4, NDCD1, NDCD2, NDCD3, NDCD4, NDSR1, NDSR2, NDSR3, |
| 45 | NDSR4, NDTR1, NDTR2, NDTR3, NDTR4, NRI1, NRI2, NRI3, NRI4, NRTS1, | 45 | NDSR4, NDTR1, NDTR2, NDTR3, NDTR4, NRI1, NRI2, NRI3, NRI4, NRTS1, |
| @@ -48,47 +48,45 @@ patternProperties: · 2 unmodified lines | |||
| 48 | PWM8, PWM9, RGMII1, RGMII2, RGMII3, RGMII4, RMII1, RMII2, RMII3, | 48 | PWM8, PWM9, RGMII1, RGMII2, RGMII3, RGMII4, RMII1, RMII2, RMII3, |
| 49 | RMII4, RXD1, RXD2, RXD3, RXD4, SALT1, SALT10, SALT11, SALT12, | 49 | RMII4, RXD1, RXD2, RXD3, RXD4, SALT1, SALT10, SALT11, SALT12, |
| 50 | SALT13, SALT14, SALT15, SALT16, SALT2, SALT3, SALT4, SALT5, | 50 | SALT13, SALT14, SALT15, SALT16, SALT2, SALT3, SALT4, SALT5, |
| 51 | SALT6, SALT7, SALT8, SALT9, SD1, SD2, SD3, SD3DAT4, SD3DAT5, | 51 | SALT6, SALT7, SALT8, SALT9, SD1, SD2, SGPM1, SGPS1, SIOONCTRL, |
| 52 | SD3DAT6, SD3DAT7, SGPM1, SGPS1, SIOONCTRL, SIOPBI, SIOPBO, | 52 | SIOPBI, SIOPBO, SIOPWREQ, SIOPWRGD, SIOS3, SIOS5, SIOSCI, SPI1, |
| 53 | SIOPWREQ, SIOPWRGD, SIOS3, SIOS5, SIOSCI, SPI1, SPI1ABR, SPI1CS1, | 53 | SPI1ABR, SPI1CS1, SPI1WP, SPI2, SPI2CS1, SPI2CS2, TACH0, TACH1, |
| 54 | SPI1WP, SPI2, SPI2CS1, SPI2CS2, TACH0, TACH1, TACH10, TACH11, | 54 | TACH10, TACH11, TACH12, TACH13, TACH14, TACH15, TACH2, TACH3, |
| 55 | TACH12, TACH13, TACH14, TACH15, TACH2, TACH3, TACH4, TACH5, | 55 | TACH4, TACH5, TACH6, TACH7, TACH8, TACH9, THRU0, THRU1, THRU2, |
| 56 | TACH6, TACH7, TACH8, TACH9, THRU0, THRU1, THRU2, THRU3, TXD1, | 56 | THRU3, TXD1, TXD2, TXD3, TXD4, UART10, UART11, UART12, UART13, |
| 57 | TXD2, TXD3, TXD4, UART10, UART11, UART12, UART13, UART6, UART7, | 57 | UART6, UART7, UART8, UART9, VB, VGAHS, VGAVS, WDTRST1, WDTRST2, |
| 58 | UART8, UART9, VB, VGAHS, VGAVS, WDTRST1, WDTRST2, WDTRST3, | 58 | WDTRST3, WDTRST4, ] |
| 59 | WDTRST4, ] | ||
| 60 | groups: | 59 | groups: |
| 61 | allOf: | 60 | allOf: |
| 62 | - $ref: "/schemas/types.yaml#/definitions/string" | 61 | - $ref: "/schemas/types.yaml#/definitions/string" |
| 63 | - enum: [ ADC0, ADC1, ADC10, ADC11, ADC12, ADC13, ADC14, ADC15, | 62 | - enum: [ ADC0, ADC1, ADC10, ADC11, ADC12, ADC13, ADC14, ADC15, |
| 64 | ADC2, ADC3, ADC4, ADC5, ADC6, ADC7, ADC8, ADC9, BMCINT, ESPI, | 63 | ADC2, ADC3, ADC4, ADC5, ADC6, ADC7, ADC8, ADC9, BMCINT, EMMCG1, |
| 65 | ESPIALT, FSI1, FSI2, FWSPIABR, FWSPID, FWQSPID, FWSPIWP, GPIT0, | 64 | EMMCG4, EMMCG8, ESPI, ESPIALT, FSI1, FSI2, FWSPIABR, FWSPID, |
| 66 | GPIT1, GPIT2, GPIT3, GPIT4, GPIT5, GPIT6, GPIT7, GPIU0, GPIU1, | 65 | FWQSPID, FWSPIWP, GPIT0, GPIT1, GPIT2, GPIT3, GPIT4, GPIT5, |
| 67 | GPIU2, GPIU3, GPIU4, GPIU5, GPIU6, GPIU7, HVI3C3, HVI3C4, I2C1, | 66 | GPIT6, GPIT7, GPIU0, GPIU1, GPIU2, GPIU3, GPIU4, GPIU5, GPIU6, |
| 68 | I2C10, I2C11, I2C12, I2C13, I2C14, I2C15, I2C16, I2C2, I2C3, | 67 | GPIU7, HVI3C3, HVI3C4, I2C1, I2C10, I2C11, I2C12, I2C13, I2C14, |
| 69 | I2C4, I2C5, I2C6, I2C7, I2C8, I2C9, I3C3, I3C4, I3C5, I3C6, | 68 | I2C15, I2C16, I2C2, I2C3, I2C4, I2C5, I2C6, I2C7, I2C8, I2C9, |
| 70 | JTAGM, LHPD, LHSIRQ, LPC, LPCHC, LPCPD, LPCPME, LPCSMI, LSIRQ, | 69 | I3C3, I3C4, I3C5, I3C6, JTAGM, LHPD, LHSIRQ, LPC, LPCHC, LPCPD, |
| 71 | MACLINK1, MACLINK2, MACLINK3, MACLINK4, MDIO1, MDIO2, MDIO3, | 70 | LPCPME, LPCSMI, LSIRQ, MACLINK1, MACLINK2, MACLINK3, MACLINK4, |
| 72 | MDIO4, NCTS1, NCTS2, NCTS3, NCTS4, NDCD1, NDCD2, NDCD3, NDCD4, | 71 | MDIO1, MDIO2, MDIO3, MDIO4, NCTS1, NCTS2, NCTS3, NCTS4, NDCD1, |
| 73 | NDSR1, NDSR2, NDSR3, NDSR4, NDTR1, NDTR2, NDTR3, NDTR4, NRI1, | 72 | NDCD2, NDCD3, NDCD4, NDSR1, NDSR2, NDSR3, NDSR4, NDTR1, NDTR2, |
| 74 | NRI2, NRI3, NRI4, NRTS1, NRTS2, NRTS3, NRTS4, OSCCLK, PEWAKE, | 73 | NDTR3, NDTR4, NRI1, NRI2, NRI3, NRI4, NRTS1, NRTS2, NRTS3, NRTS4, |
| 75 | PWM0, PWM1, PWM10G0, PWM10G1, PWM11G0, PWM11G1, PWM12G0, PWM12G1, | 74 | OSCCLK, PEWAKE, PWM0, PWM1, PWM10G0, PWM10G1, PWM11G0, PWM11G1, |
| 76 | PWM13G0, PWM13G1, PWM14G0, PWM14G1, PWM15G0, PWM15G1, PWM2, PWM3, | 75 | PWM12G0, PWM12G1, PWM13G0, PWM13G1, PWM14G0, PWM14G1, PWM15G0, |
| 77 | PWM4, PWM5, PWM6, PWM7, PWM8G0, PWM8G1, PWM9G0, PWM9G1, QSPI1, | 76 | PWM15G1, PWM2, PWM3, PWM4, PWM5, PWM6, PWM7, PWM8G0, PWM8G1, |
| 78 | QSPI2, RGMII1, RGMII2, RGMII3, RGMII4, RMII1, RMII2, RMII3, | 77 | PWM9G0, PWM9G1, QSPI1, QSPI2, RGMII1, RGMII2, RGMII3, RGMII4, |
| 79 | RMII4, RXD1, RXD2, RXD3, RXD4, SALT1, SALT10G0, SALT10G1, | 78 | RMII1, RMII2, RMII3, RMII4, RXD1, RXD2, RXD3, RXD4, SALT1, |
| 80 | SALT11G0, SALT11G1, SALT12G0, SALT12G1, SALT13G0, SALT13G1, | 79 | SALT10G0, SALT10G1, SALT11G0, SALT11G1, SALT12G0, SALT12G1, |
| 81 | SALT14G0, SALT14G1, SALT15G0, SALT15G1, SALT16G0, SALT16G1, | 80 | SALT13G0, SALT13G1, SALT14G0, SALT14G1, SALT15G0, SALT15G1, |
| 82 | SALT2, SALT3, SALT4, SALT5, SALT6, SALT7, SALT8, SALT9G0, | 81 | SALT16G0, SALT16G1, SALT2, SALT3, SALT4, SALT5, SALT6, SALT7, |
| 83 | SALT9G1, SD1, SD2, SD3, SD3DAT4, SD3DAT5, SD3DAT6, SD3DAT7, | 82 | SALT8, SALT9G0, SALT9G1, SD1, SD2, SD3, SGPM1, SGPS1, SIOONCTRL, |
| 84 | SGPM1, SGPS1, SIOONCTRL, SIOPBI, SIOPBO, SIOPWREQ, SIOPWRGD, | 83 | SIOPBI, SIOPBO, SIOPWREQ, SIOPWRGD, SIOS3, SIOS5, SIOSCI, SPI1, |
| 85 | SIOS3, SIOS5, SIOSCI, SPI1, SPI1ABR, SPI1CS1, SPI1WP, SPI2, | 84 | SPI1ABR, SPI1CS1, SPI1WP, SPI2, SPI2CS1, SPI2CS2, TACH0, TACH1, |
| 86 | SPI2CS1, SPI2CS2, TACH0, TACH1, TACH10, TACH11, TACH12, TACH13, | 85 | TACH10, TACH11, TACH12, TACH13, TACH14, TACH15, TACH2, TACH3, |
| 87 | TACH14, TACH15, TACH2, TACH3, TACH4, TACH5, TACH6, TACH7, TACH8, | 86 | TACH4, TACH5, TACH6, TACH7, TACH8, TACH9, THRU0, THRU1, THRU2, |
| 88 | TACH9, THRU0, THRU1, THRU2, THRU3, TXD1, TXD2, TXD3, TXD4, | 87 | THRU3, TXD1, TXD2, TXD3, TXD4, UART10, UART11, UART12G0, |
| 89 | UART10, UART11, UART12G0, UART12G1, UART13G0, UART13G1, UART6, | 88 | UART12G1, UART13G0, UART13G1, UART6, UART7, UART8, UART9, VB, |
| 90 | UART7, UART8, UART9, VB, VGAHS, VGAVS, WDTRST1, WDTRST2, WDTRST3, | 89 | VGAHS, VGAVS, WDTRST1, WDTRST2, WDTRST3, WDTRST4, ] |
| 91 | WDTRST4, ] | ||
| 92 | 90 | ||
| 93 | required: | 91 | required: |
| 94 | - compatible | 92 | - compatible |
| @@ -30,8 +30,8 @@ if: · 29 unmodified lines | |||
| 30 | properties: | 30 | properties: |
| 31 | compatible: | 31 | compatible: |
| 32 | enum: | 32 | enum: |
| 33 | - const: regulator-fixed | 33 | - regulator-fixed |
| 34 | - const: regulator-fixed-clock | 34 | - regulator-fixed-clock |
| 35 | 35 | ||
| 36 | regulator-name: true | 36 | regulator-name: true |
| 37 | 37 | ||
| @@ -24,15 +24,17 @@ description: | · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | properties: | 25 | properties: |
| 26 | compatible: | 26 | compatible: |
| 27 | items: | 27 | oneOf: |
| 28 | - enum: | 28 | - items: |
| 29 | - sifive,rocket0 | 29 | - enum: |
| 30 | - sifive,e5 | 30 | - sifive,rocket0 |
| 31 | - sifive,e51 | 31 | - sifive,e5 |
| 32 | - sifive,u54-mc | 32 | - sifive,e51 |
| 33 | - sifive,u54 | 33 | - sifive,u54-mc |
| 34 | - sifive,u5 | 34 | - sifive,u54 |
| 35 | - const: riscv | 35 | - sifive,u5 |
| 36 | - const: riscv | ||
| 37 | - const: riscv # Simulator only | ||
| 36 | description: | 38 | description: |
| 37 | Identifies that the hart uses the RISC-V instruction set | 39 | Identifies that the hart uses the RISC-V instruction set |
| 38 | and identifies the type of the hart. | 40 | and identifies the type of the hart. |
| @@ -66,12 +68,8 @@ properties: · 27 unmodified lines | |||
| 66 | insensitive, letters in the riscv,isa string must be all | 68 | insensitive, letters in the riscv,isa string must be all |
| 67 | lowercase to simplify parsing. | 69 | lowercase to simplify parsing. |
| 68 | 70 | ||
| 69 | timebase-frequency: | 71 | # RISC-V requires 'timebase-frequency' in /cpus, so disallow it here |
| 70 | type: integer | 72 | timebase-frequency: false |
| 71 | minimum: 1 | ||
| 72 | description: | ||
| 73 | Specifies the clock frequency of the system timer in Hz. | ||
| 74 | This value is common to all harts on a single system image. | ||
| 75 | 73 | ||
| 76 | interrupt-controller: | 74 | interrupt-controller: |
| 77 | type: object | 75 | type: object |
| @@ -93,7 +91,6 @@ properties: · 15 unmodified lines | |||
| 93 | 91 | ||
| 94 | required: | 92 | required: |
| 95 | - riscv,isa | 93 | - riscv,isa |
| 96 | - timebase-frequency | ||
| 97 | - interrupt-controller | 94 | - interrupt-controller |
| 98 | 95 | ||
| 99 | examples: | 96 | examples: |
| @@ -36,8 +36,10 @@ Support · 35 unmodified lines | |||
| 36 | ======= | 36 | ======= |
| 37 | For general Linux networking support, please use the netdev mailing | 37 | For general Linux networking support, please use the netdev mailing |
| 38 | list, which is monitored by Pensando personnel:: | 38 | list, which is monitored by Pensando personnel:: |
| 39 | |||
| 39 | netdev@vger.kernel.org | 40 | netdev@vger.kernel.org |
| 40 | 41 | ||
| 41 | For more specific support needs, please use the Pensando driver support | 42 | For more specific support needs, please use the Pensando driver support |
| 42 | email:: | 43 | email:: |
| 43 | drivers@pensando.io | 44 | |
| 45 | drivers@pensando.io | ||
| @@ -92,16 +92,16 @@ under some conditions. · 91 unmodified lines | |||
| 92 | Part III: Registering a Network Device to DIM | 92 | Part III: Registering a Network Device to DIM |
| 93 | ============================================== | 93 | ============================================== |
| 94 | 94 | ||
| 95 | Net DIM API exposes the main function net_dim(struct net_dim *dim, | 95 | Net DIM API exposes the main function net_dim(struct dim *dim, |
| 96 | struct net_dim_sample end_sample). This function is the entry point to the Net | 96 | struct dim_sample end_sample). This function is the entry point to the Net |
| 97 | DIM algorithm and has to be called every time the driver would like to check if | 97 | DIM algorithm and has to be called every time the driver would like to check if |
| 98 | it should change interrupt moderation parameters. The driver should provide two | 98 | it should change interrupt moderation parameters. The driver should provide two |
| 99 | data structures: struct net_dim and struct net_dim_sample. Struct net_dim | 99 | data structures: struct dim and struct dim_sample. Struct dim |
| 100 | describes the state of DIM for a specific object (RX queue, TX queue, | 100 | describes the state of DIM for a specific object (RX queue, TX queue, |
| 101 | other queues, etc.). This includes the current selected profile, previous data | 101 | other queues, etc.). This includes the current selected profile, previous data |
| 102 | samples, the callback function provided by the driver and more. | 102 | samples, the callback function provided by the driver and more. |
| 103 | Struct net_dim_sample describes a data sample, which will be compared to the | 103 | Struct dim_sample describes a data sample, which will be compared to the |
| 104 | data sample stored in struct net_dim in order to decide on the algorithm's next | 104 | data sample stored in struct dim in order to decide on the algorithm's next |
| 105 | step. The sample should include bytes, packets and interrupts, measured by | 105 | step. The sample should include bytes, packets and interrupts, measured by |
| 106 | the driver. | 106 | the driver. |
| 107 | 107 | ||
| @@ -110,9 +110,9 @@ main net_dim() function. The recommended method is to call net_dim() on each · 2 unmodified lines | |||
| 110 | interrupt. Since Net DIM has a built-in moderation and it might decide to skip | 110 | interrupt. Since Net DIM has a built-in moderation and it might decide to skip |
| 111 | iterations under certain conditions, there is no need to moderate the net_dim() | 111 | iterations under certain conditions, there is no need to moderate the net_dim() |
| 112 | calls as well. As mentioned above, the driver needs to provide an object of type | 112 | calls as well. As mentioned above, the driver needs to provide an object of type |
| 113 | struct net_dim to the net_dim() function call. It is advised for each entity | 113 | struct dim to the net_dim() function call. It is advised for each entity |
| 114 | using Net DIM to hold a struct net_dim as part of its data structure and use it | 114 | using Net DIM to hold a struct dim as part of its data structure and use it |
| 115 | as the main Net DIM API object. The struct net_dim_sample should hold the latest | 115 | as the main Net DIM API object. The struct dim_sample should hold the latest |
| 116 | bytes, packets and interrupts count. No need to perform any calculations, just | 116 | bytes, packets and interrupts count. No need to perform any calculations, just |
| 117 | include the raw data. | 117 | include the raw data. |
| 118 | 118 | ||
| @@ -132,19 +132,19 @@ usage is not complete but it should make the outline of the usage clear. · 13 unmodified lines | |||
| 132 | 132 | ||
| 133 | my_driver.c: | 133 | my_driver.c: |
| 134 | 134 | ||
| 135 | #include <linux/net_dim.h> | 135 | #include <linux/dim.h> |
| 136 | 136 | ||
| 137 | /* Callback for net DIM to schedule on a decision to change moderation */ | 137 | /* Callback for net DIM to schedule on a decision to change moderation */ |
| 138 | void my_driver_do_dim_work(struct work_struct *work) | 138 | void my_driver_do_dim_work(struct work_struct *work) |
| 139 | { | 139 | { |
| 140 | /* Get struct net_dim from struct work_struct */ | 140 | /* Get struct dim from struct work_struct */ |
| 141 | struct net_dim *dim = container_of(work, struct net_dim, | 141 | struct dim *dim = container_of(work, struct dim, |
| 142 | work); | 142 | work); |
| 143 | /* Do interrupt moderation related stuff */ | 143 | /* Do interrupt moderation related stuff */ |
| 144 | ... | 144 | ... |
| 145 | 145 | ||
| 146 | /* Signal net DIM work is done and it should move to next iteration */ | 146 | /* Signal net DIM work is done and it should move to next iteration */ |
| 147 | dim->state = NET_DIM_START_MEASURE; | 147 | dim->state = DIM_START_MEASURE; |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | /* My driver's interrupt handler */ | 150 | /* My driver's interrupt handler */ |
| @@ -152,13 +152,13 @@ int my_driver_handle_interrupt(struct my_driver_entity *my_entity, ...) · 1 unmodified line | |||
| 152 | { | 152 | { |
| 153 | ... | 153 | ... |
| 154 | /* A struct to hold current measured data */ | 154 | /* A struct to hold current measured data */ |
| 155 | struct net_dim_sample dim_sample; | 155 | struct dim_sample dim_sample; |
| 156 | ... | 156 | ... |
| 157 | /* Initiate data sample struct with current data */ | 157 | /* Initiate data sample struct with current data */ |
| 158 | net_dim_sample(my_entity->events, | 158 | dim_update_sample(my_entity->events, |
| 159 | my_entity->packets, | 159 | my_entity->packets, |
| 160 | my_entity->bytes, | 160 | my_entity->bytes, |
| 161 | &dim_sample); | 161 | &dim_sample); |
| 162 | /* Call net DIM */ | 162 | /* Call net DIM */ |
| 163 | net_dim(&my_entity->dim, dim_sample); | 163 | net_dim(&my_entity->dim, dim_sample); |
| 164 | ... | 164 | ... |
| @@ -2323,11 +2323,13 @@ F: drivers/edac/altera_edac. · 2322 unmodified lines | |||
| 2323 | 2323 | ||
| 2324 | ARM/SPREADTRUM SoC SUPPORT | 2324 | ARM/SPREADTRUM SoC SUPPORT |
| 2325 | M: Orson Zhai <orsonzhai@gmail.com> | 2325 | M: Orson Zhai <orsonzhai@gmail.com> |
| 2326 | M: Baolin Wang <baolin.wang@linaro.org> | 2326 | M: Baolin Wang <baolin.wang7@gmail.com> |
| 2327 | M: Chunyan Zhang <zhang.lyra@gmail.com> | 2327 | M: Chunyan Zhang <zhang.lyra@gmail.com> |
| 2328 | S: Maintained | 2328 | S: Maintained |
| 2329 | F: arch/arm64/boot/dts/sprd | 2329 | F: arch/arm64/boot/dts/sprd |
| 2330 | N: sprd | 2330 | N: sprd |
| 2331 | N: sc27xx | ||
| 2332 | N: sc2731 | ||
| 2331 | 2333 | ||
| 2332 | ARM/STI ARCHITECTURE | 2334 | ARM/STI ARCHITECTURE |
| 2333 | M: Patrice Chotard <patrice.chotard@st.com> | 2335 | M: Patrice Chotard <patrice.chotard@st.com> |
| @@ -3096,7 +3098,7 @@ S: Supported · 762 unmodified lines | |||
| 3096 | F: arch/arm64/net/ | 3098 | F: arch/arm64/net/ |
| 3097 | 3099 | ||
| 3098 | BPF JIT for MIPS (32-BIT AND 64-BIT) | 3100 | BPF JIT for MIPS (32-BIT AND 64-BIT) |
| 3099 | M: Paul Burton <paul.burton@mips.com> | 3101 | M: Paul Burton <paulburton@kernel.org> |
| 3100 | L: netdev@vger.kernel.org | 3102 | L: netdev@vger.kernel.org |
| 3101 | L: bpf@vger.kernel.org | 3103 | L: bpf@vger.kernel.org |
| 3102 | S: Maintained | 3104 | S: Maintained |
| @@ -3183,7 +3185,7 @@ N: bcm216* · 80 unmodified lines | |||
| 3183 | N: kona | 3185 | N: kona |
| 3184 | F: arch/arm/mach-bcm/ | 3186 | F: arch/arm/mach-bcm/ |
| 3185 | 3187 | ||
| 3186 | BROADCOM BCM2835 ARM ARCHITECTURE | 3188 | BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE |
| 3187 | M: Eric Anholt <eric@anholt.net> | 3189 | M: Eric Anholt <eric@anholt.net> |
| 3188 | M: Stefan Wahren <wahrenst@gmx.net> | 3190 | M: Stefan Wahren <wahrenst@gmx.net> |
| 3189 | L: bcm-kernel-feedback-list@broadcom.com | 3191 | L: bcm-kernel-feedback-list@broadcom.com |
| @@ -3191,6 +3193,7 @@ L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers) · 1 unmodified line | |||
| 3191 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 3193 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 3192 | T: git git://github.com/anholt/linux | 3194 | T: git git://github.com/anholt/linux |
| 3193 | S: Maintained | 3195 | S: Maintained |
| 3196 | N: bcm2711 | ||
| 3194 | N: bcm2835 | 3197 | N: bcm2835 |
| 3195 | F: drivers/staging/vc04_services | 3198 | F: drivers/staging/vc04_services |
| 3196 | 3199 | ||
| @@ -3237,8 +3240,6 @@ S: Maintained · 40 unmodified lines | |||
| 3237 | F: drivers/usb/gadget/udc/bcm63xx_udc.* | 3240 | F: drivers/usb/gadget/udc/bcm63xx_udc.* |
| 3238 | 3241 | ||
| 3239 | BROADCOM BCM7XXX ARM ARCHITECTURE | 3242 | BROADCOM BCM7XXX ARM ARCHITECTURE |
| 3240 | M: Brian Norris <computersforpeace@gmail.com> | ||
| 3241 | M: Gregory Fong <gregory.0xf0@gmail.com> | ||
| 3242 | M: Florian Fainelli <f.fainelli@gmail.com> | 3243 | M: Florian Fainelli <f.fainelli@gmail.com> |
| 3243 | M: bcm-kernel-feedback-list@broadcom.com | 3244 | M: bcm-kernel-feedback-list@broadcom.com |
| 3244 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 3245 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| @@ -8001,7 +8002,7 @@ S: Maintained · 4756 unmodified lines | |||
| 8001 | F: drivers/usb/atm/ueagle-atm.c | 8002 | F: drivers/usb/atm/ueagle-atm.c |
| 8002 | 8003 | ||
| 8003 | IMGTEC ASCII LCD DRIVER | 8004 | IMGTEC ASCII LCD DRIVER |
| 8004 | M: Paul Burton <paul.burton@mips.com> | 8005 | M: Paul Burton <paulburton@kernel.org> |
| 8005 | S: Maintained | 8006 | S: Maintained |
| 8006 | F: Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt | 8007 | F: Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt |
| 8007 | F: drivers/auxdisplay/img-ascii-lcd.c | 8008 | F: drivers/auxdisplay/img-ascii-lcd.c |
| @@ -9122,7 +9123,7 @@ F: drivers/auxdisplay/ks0108.c · 1114 unmodified lines | |||
| 9122 | F: include/linux/ks0108.h | 9123 | F: include/linux/ks0108.h |
| 9123 | 9124 | ||
| 9124 | L3MDEV | 9125 | L3MDEV |
| 9125 | M: David Ahern <dsa@cumulusnetworks.com> | 9126 | M: David Ahern <dsahern@kernel.org> |
| 9126 | L: netdev@vger.kernel.org | 9127 | L: netdev@vger.kernel.org |
| 9127 | S: Maintained | 9128 | S: Maintained |
| 9128 | F: net/l3mdev | 9129 | F: net/l3mdev |
| @@ -10255,7 +10256,7 @@ MEDIATEK ETHERNET DRIVER · 1126 unmodified lines | |||
| 10255 | M: Felix Fietkau <nbd@openwrt.org> | 10256 | M: Felix Fietkau <nbd@openwrt.org> |
| 10256 | M: John Crispin <john@phrozen.org> | 10257 | M: John Crispin <john@phrozen.org> |
| 10257 | M: Sean Wang <sean.wang@mediatek.com> | 10258 | M: Sean Wang <sean.wang@mediatek.com> |
| 10258 | M: Nelson Chang <nelson.chang@mediatek.com> | 10259 | M: Mark Lee <Mark-MC.Lee@mediatek.com> |
| 10259 | L: netdev@vger.kernel.org | 10260 | L: netdev@vger.kernel.org |
| 10260 | S: Maintained | 10261 | S: Maintained |
| 10261 | F: drivers/net/ethernet/mediatek/ | 10262 | F: drivers/net/ethernet/mediatek/ |
| @@ -10828,7 +10829,7 @@ F: drivers/usb/image/microtek.* · 566 unmodified lines | |||
| 10828 | 10829 | ||
| 10829 | MIPS | 10830 | MIPS |
| 10830 | M: Ralf Baechle <ralf@linux-mips.org> | 10831 | M: Ralf Baechle <ralf@linux-mips.org> |
| 10831 | M: Paul Burton <paul.burton@mips.com> | 10832 | M: Paul Burton <paulburton@kernel.org> |
| 10832 | M: James Hogan <jhogan@kernel.org> | 10833 | M: James Hogan <jhogan@kernel.org> |
| 10833 | L: linux-mips@vger.kernel.org | 10834 | L: linux-mips@vger.kernel.org |
| 10834 | W: http://www.linux-mips.org/ | 10835 | W: http://www.linux-mips.org/ |
| @@ -10842,7 +10843,7 @@ F: arch/mips/ · 7 unmodified lines | |||
| 10842 | F: drivers/platform/mips/ | 10843 | F: drivers/platform/mips/ |
| 10843 | 10844 | ||
| 10844 | MIPS BOSTON DEVELOPMENT BOARD | 10845 | MIPS BOSTON DEVELOPMENT BOARD |
| 10845 | M: Paul Burton <paul.burton@mips.com> | 10846 | M: Paul Burton <paulburton@kernel.org> |
| 10846 | L: linux-mips@vger.kernel.org | 10847 | L: linux-mips@vger.kernel.org |
| 10847 | S: Maintained | 10848 | S: Maintained |
| 10848 | F: Documentation/devicetree/bindings/clock/img,boston-clock.txt | 10849 | F: Documentation/devicetree/bindings/clock/img,boston-clock.txt |
| @@ -10852,7 +10853,7 @@ F: drivers/clk/imgtec/clk-boston.c · 3 unmodified lines | |||
| 10852 | F: include/dt-bindings/clock/boston-clock.h | 10853 | F: include/dt-bindings/clock/boston-clock.h |
| 10853 | 10854 | ||
| 10854 | MIPS GENERIC PLATFORM | 10855 | MIPS GENERIC PLATFORM |
| 10855 | M: Paul Burton <paul.burton@mips.com> | 10856 | M: Paul Burton <paulburton@kernel.org> |
| 10856 | L: linux-mips@vger.kernel.org | 10857 | L: linux-mips@vger.kernel.org |
| 10857 | S: Supported | 10858 | S: Supported |
| 10858 | F: Documentation/devicetree/bindings/power/mti,mips-cpc.txt | 10859 | F: Documentation/devicetree/bindings/power/mti,mips-cpc.txt |
| @@ -12312,12 +12313,15 @@ F: arch/parisc/ · 1453 unmodified lines | |||
| 12312 | F: Documentation/parisc/ | 12313 | F: Documentation/parisc/ |
| 12313 | F: drivers/parisc/ | 12314 | F: drivers/parisc/ |
| 12314 | F: drivers/char/agp/parisc-agp.c | 12315 | F: drivers/char/agp/parisc-agp.c |
| 12316 | F: drivers/input/misc/hp_sdc_rtc.c | ||
| 12315 | F: drivers/input/serio/gscps2.c | 12317 | F: drivers/input/serio/gscps2.c |
| 12318 | F: drivers/input/serio/hp_sdc* | ||
| 12316 | F: drivers/parport/parport_gsc.* | 12319 | F: drivers/parport/parport_gsc.* |
| 12317 | F: drivers/tty/serial/8250/8250_gsc.c | 12320 | F: drivers/tty/serial/8250/8250_gsc.c |
| 12318 | F: drivers/video/fbdev/sti* | 12321 | F: drivers/video/fbdev/sti* |
| 12319 | F: drivers/video/console/sti* | 12322 | F: drivers/video/console/sti* |
| 12320 | F: drivers/video/logo/logo_parisc* | 12323 | F: drivers/video/logo/logo_parisc* |
| 12324 | F: include/linux/hp_sdc.h | ||
| 12321 | 12325 | ||
| 12322 | PARMAN | 12326 | PARMAN |
| 12323 | M: Jiri Pirko <jiri@mellanox.com> | 12327 | M: Jiri Pirko <jiri@mellanox.com> |
| @@ -13368,7 +13372,7 @@ S: Maintained · 1044 unmodified lines | |||
| 13368 | F: drivers/scsi/qla1280.[ch] | 13372 | F: drivers/scsi/qla1280.[ch] |
| 13369 | 13373 | ||
| 13370 | QLOGIC QLA2XXX FC-SCSI DRIVER | 13374 | QLOGIC QLA2XXX FC-SCSI DRIVER |
| 13371 | M: qla2xxx-upstream@qlogic.com | 13375 | M: hmadhani@marvell.com |
| 13372 | L: linux-scsi@vger.kernel.org | 13376 | L: linux-scsi@vger.kernel.org |
| 13373 | S: Supported | 13377 | S: Supported |
| 13374 | F: Documentation/scsi/LICENSE.qla2xxx | 13378 | F: Documentation/scsi/LICENSE.qla2xxx |
| @@ -17437,7 +17441,7 @@ F: include/linux/regulator/ · 4062 unmodified lines | |||
| 17437 | K: regulator_get_optional | 17441 | K: regulator_get_optional |
| 17438 | 17442 | ||
| 17439 | VRF | 17443 | VRF |
| 17440 | M: David Ahern <dsa@cumulusnetworks.com> | 17444 | M: David Ahern <dsahern@kernel.org> |
| 17441 | M: Shrijeet Mukherjee <shrijeet@gmail.com> | 17445 | M: Shrijeet Mukherjee <shrijeet@gmail.com> |
| 17442 | L: netdev@vger.kernel.org | 17446 | L: netdev@vger.kernel.org |
| 17443 | S: Maintained | 17447 | S: Maintained |
| @@ -2,8 +2,8 @@ · 1 unmodified line | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 4 | 3 | PATCHLEVEL = 4 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc3 | 5 | EXTRAVERSION = -rc5 |
| 6 | NAME = Nesting Opossum | 6 | NAME = Kleptomaniac Octopus |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| 9 | # To see a list of typical targets execute "make help" | 9 | # To see a list of typical targets execute "make help" |
| @@ -1037,7 +1037,7 @@ export KBUILD_VMLINUX_OBJS := $(head-y) $(init-y) $(core-y) $(libs-y2) \ · 1027 unmodified lines | |||
| 1037 | export KBUILD_VMLINUX_LIBS := $(libs-y1) | 1037 | export KBUILD_VMLINUX_LIBS := $(libs-y1) |
| 1038 | export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds | 1038 | export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds |
| 1039 | export LDFLAGS_vmlinux | 1039 | export LDFLAGS_vmlinux |
| 1040 | # used by scripts/package/Makefile | 1040 | # used by scripts/Makefile.package |
| 1041 | export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools) | 1041 | export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools) |
| 1042 | 1042 | ||
| 1043 | vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) | 1043 | vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) |
| @@ -111,13 +111,13 @@ · 110 unmodified lines | |||
| 111 | reg = <0x70>; | 111 | reg = <0x70>; |
| 112 | #address-cells = <1>; | 112 | #address-cells = <1>; |
| 113 | #size-cells = <0>; | 113 | #size-cells = <0>; |
| 114 | i2c-mux-idle-disconnect; | ||
| 114 | 115 | ||
| 115 | i2c@0 { | 116 | i2c@0 { |
| 116 | /* FMC A */ | 117 | /* FMC A */ |
| 117 | #address-cells = <1>; | 118 | #address-cells = <1>; |
| 118 | #size-cells = <0>; | 119 | #size-cells = <0>; |
| 119 | reg = <0>; | 120 | reg = <0>; |
| 120 | i2c-mux-idle-disconnect; | ||
| 121 | }; | 121 | }; |
| 122 | 122 | ||
| 123 | i2c@1 { | 123 | i2c@1 { |
| @@ -125,7 +125,6 @@ · 1 unmodified line | |||
| 125 | #address-cells = <1>; | 125 | #address-cells = <1>; |
| 126 | #size-cells = <0>; | 126 | #size-cells = <0>; |
| 127 | reg = <1>; | 127 | reg = <1>; |
| 128 | i2c-mux-idle-disconnect; | ||
| 129 | }; | 128 | }; |
| 130 | 129 | ||
| 131 | i2c@2 { | 130 | i2c@2 { |
| @@ -133,7 +132,6 @@ · 1 unmodified line | |||
| 133 | #address-cells = <1>; | 132 | #address-cells = <1>; |
| 134 | #size-cells = <0>; | 133 | #size-cells = <0>; |
| 135 | reg = <2>; | 134 | reg = <2>; |
| 136 | i2c-mux-idle-disconnect; | ||
| 137 | }; | 135 | }; |
| 138 | 136 | ||
| 139 | i2c@3 { | 137 | i2c@3 { |
| @@ -141,7 +139,6 @@ · 1 unmodified line | |||
| 141 | #address-cells = <1>; | 139 | #address-cells = <1>; |
| 142 | #size-cells = <0>; | 140 | #size-cells = <0>; |
| 143 | reg = <3>; | 141 | reg = <3>; |
| 144 | i2c-mux-idle-disconnect; | ||
| 145 | }; | 142 | }; |
| 146 | 143 | ||
| 147 | i2c@4 { | 144 | i2c@4 { |
| @@ -149,14 +146,12 @@ · 1 unmodified line | |||
| 149 | #address-cells = <1>; | 146 | #address-cells = <1>; |
| 150 | #size-cells = <0>; | 147 | #size-cells = <0>; |
| 151 | reg = <4>; | 148 | reg = <4>; |
| 152 | i2c-mux-idle-disconnect; | ||
| 153 | }; | 149 | }; |
| 154 | 150 | ||
| 155 | i2c@5 { | 151 | i2c@5 { |
| 156 | #address-cells = <1>; | 152 | #address-cells = <1>; |
| 157 | #size-cells = <0>; | 153 | #size-cells = <0>; |
| 158 | reg = <5>; | 154 | reg = <5>; |
| 159 | i2c-mux-idle-disconnect; | ||
| 160 | 155 | ||
| 161 | ina230@40 { compatible = "ti,ina230"; reg = <0x40>; shunt-resistor = <5000>; }; | 156 | ina230@40 { compatible = "ti,ina230"; reg = <0x40>; shunt-resistor = <5000>; }; |
| 162 | ina230@41 { compatible = "ti,ina230"; reg = <0x41>; shunt-resistor = <5000>; }; | 157 | ina230@41 { compatible = "ti,ina230"; reg = <0x41>; shunt-resistor = <5000>; }; |
| @@ -182,14 +177,12 @@ · 19 unmodified lines | |||
| 182 | #address-cells = <1>; | 177 | #address-cells = <1>; |
| 183 | #size-cells = <0>; | 178 | #size-cells = <0>; |
| 184 | reg = <6>; | 179 | reg = <6>; |
| 185 | i2c-mux-idle-disconnect; | ||
| 186 | }; | 180 | }; |
| 187 | 181 | ||
| 188 | i2c@7 { | 182 | i2c@7 { |
| 189 | #address-cells = <1>; | 183 | #address-cells = <1>; |
| 190 | #size-cells = <0>; | 184 | #size-cells = <0>; |
| 191 | reg = <7>; | 185 | reg = <7>; |
| 192 | i2c-mux-idle-disconnect; | ||
| 193 | 186 | ||
| 194 | u41: pca9575@20 { | 187 | u41: pca9575@20 { |
| 195 | compatible = "nxp,pca9575"; | 188 | compatible = "nxp,pca9575"; |
| @@ -113,6 +113,7 @@ · 112 unmodified lines | |||
| 113 | #address-cells = <1>; | 113 | #address-cells = <1>; |
| 114 | #size-cells = <0>; | 114 | #size-cells = <0>; |
| 115 | pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>; | 115 | pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>; |
| 116 | bus-width = <4>; | ||
| 116 | mmc-pwrseq = <&wifi_pwrseq>; | 117 | mmc-pwrseq = <&wifi_pwrseq>; |
| 117 | non-removable; | 118 | non-removable; |
| 118 | status = "okay"; | 119 | status = "okay"; |
| @@ -9,6 +9,14 @@ · 8 unmodified lines | |||
| 9 | reg = <0 0x40000000>; | 9 | reg = <0 0x40000000>; |
| 10 | }; | 10 | }; |
| 11 | 11 | ||
| 12 | leds { | ||
| 13 | /* | ||
| 14 | * Since there is no upstream GPIO driver yet, | ||
| 15 | * remove the incomplete node. | ||
| 16 | */ | ||
| 17 | /delete-node/ act; | ||
| 18 | }; | ||
| 19 | |||
| 12 | reg_3v3: fixed-regulator { | 20 | reg_3v3: fixed-regulator { |
| 13 | compatible = "regulator-fixed"; | 21 | compatible = "regulator-fixed"; |
| 14 | regulator-name = "3V3"; | 22 | regulator-name = "3V3"; |
| @@ -207,6 +207,10 @@ · 206 unmodified lines | |||
| 207 | vin-supply = <&sw1c_reg>; | 207 | vin-supply = <&sw1c_reg>; |
| 208 | }; | 208 | }; |
| 209 | 209 | ||
| 210 | &snvs_poweroff { | ||
| 211 | status = "okay"; | ||
| 212 | }; | ||
| 213 | |||
| 210 | &iomuxc { | 214 | &iomuxc { |
| 211 | pinctrl-names = "default"; | 215 | pinctrl-names = "default"; |
| 212 | pinctrl-0 = <&pinctrl_hog>; | 216 | pinctrl-0 = <&pinctrl_hog>; |
| @@ -448,7 +448,7 @@ · 447 unmodified lines | |||
| 448 | compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; | 448 | compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; |
| 449 | reg = <0x302d0000 0x10000>; | 449 | reg = <0x302d0000 0x10000>; |
| 450 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; | 450 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; |
| 451 | clocks = <&clks IMX7D_CLK_DUMMY>, | 451 | clocks = <&clks IMX7D_GPT1_ROOT_CLK>, |
| 452 | <&clks IMX7D_GPT1_ROOT_CLK>; | 452 | <&clks IMX7D_GPT1_ROOT_CLK>; |
| 453 | clock-names = "ipg", "per"; | 453 | clock-names = "ipg", "per"; |
| 454 | }; | 454 | }; |
| @@ -457,7 +457,7 @@ · 2 unmodified lines | |||
| 457 | compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; | 457 | compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; |
| 458 | reg = <0x302e0000 0x10000>; | 458 | reg = <0x302e0000 0x10000>; |
| 459 | interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; | 459 | interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; |
| 460 | clocks = <&clks IMX7D_CLK_DUMMY>, | 460 | clocks = <&clks IMX7D_GPT2_ROOT_CLK>, |
| 461 | <&clks IMX7D_GPT2_ROOT_CLK>; | 461 | <&clks IMX7D_GPT2_ROOT_CLK>; |
| 462 | clock-names = "ipg", "per"; | 462 | clock-names = "ipg", "per"; |
| 463 | status = "disabled"; | 463 | status = "disabled"; |
| @@ -467,7 +467,7 @@ · 3 unmodified lines | |||
| 467 | compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; | 467 | compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; |
| 468 | reg = <0x302f0000 0x10000>; | 468 | reg = <0x302f0000 0x10000>; |
| 469 | interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; | 469 | interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; |
| 470 | clocks = <&clks IMX7D_CLK_DUMMY>, | 470 | clocks = <&clks IMX7D_GPT3_ROOT_CLK>, |
| 471 | <&clks IMX7D_GPT3_ROOT_CLK>; | 471 | <&clks IMX7D_GPT3_ROOT_CLK>; |
| 472 | clock-names = "ipg", "per"; | 472 | clock-names = "ipg", "per"; |
| 473 | status = "disabled"; | 473 | status = "disabled"; |
| @@ -477,7 +477,7 @@ · 3 unmodified lines | |||
| 477 | compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; | 477 | compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; |
| 478 | reg = <0x30300000 0x10000>; | 478 | reg = <0x30300000 0x10000>; |
| 479 | interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; | 479 | interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; |
| 480 | clocks = <&clks IMX7D_CLK_DUMMY>, | 480 | clocks = <&clks IMX7D_GPT4_ROOT_CLK>, |
| 481 | <&clks IMX7D_GPT4_ROOT_CLK>; | 481 | <&clks IMX7D_GPT4_ROOT_CLK>; |
| 482 | clock-names = "ipg", "per"; | 482 | clock-names = "ipg", "per"; |
| 483 | status = "disabled"; | 483 | status = "disabled"; |
| @@ -192,3 +192,7 @@ · 191 unmodified lines | |||
| 192 | &twl_gpio { | 192 | &twl_gpio { |
| 193 | ti,use-leds; | 193 | ti,use-leds; |
| 194 | }; | 194 | }; |
| 195 | |||
| 196 | &twl_keypad { | ||
| 197 | status = "disabled"; | ||
| 198 | }; | ||
| @@ -66,9 +66,21 @@ · 65 unmodified lines | |||
| 66 | pinctrl-1 = <&ephy_leds_pins>; | 66 | pinctrl-1 = <&ephy_leds_pins>; |
| 67 | status = "okay"; | 67 | status = "okay"; |
| 68 | 68 | ||
| 69 | gmac0: mac@0 { | ||
| 70 | compatible = "mediatek,eth-mac"; | ||
| 71 | reg = <0>; | ||
| 72 | phy-mode = "2500base-x"; | ||
| 73 | fixed-link { | ||
| 74 | speed = <2500>; | ||
| 75 | full-duplex; | ||
| 76 | pause; | ||
| 77 | }; | ||
| 78 | }; | ||
| 79 | |||
| 69 | gmac1: mac@1 { | 80 | gmac1: mac@1 { |
| 70 | compatible = "mediatek,eth-mac"; | 81 | compatible = "mediatek,eth-mac"; |
| 71 | reg = <1>; | 82 | reg = <1>; |
| 83 | phy-mode = "gmii"; | ||
| 72 | phy-handle = <&phy0>; | 84 | phy-handle = <&phy0>; |
| 73 | }; | 85 | }; |
| 74 | 86 | ||
| @@ -78,7 +90,6 @@ · 3 unmodified lines | |||
| 78 | 90 | ||
| 79 | phy0: ethernet-phy@0 { | 91 | phy0: ethernet-phy@0 { |
| 80 | reg = <0>; | 92 | reg = <0>; |
| 81 | phy-mode = "gmii"; | ||
| 82 | }; | 93 | }; |
| 83 | }; | 94 | }; |
| 84 | }; | 95 | }; |
| @@ -468,14 +468,12 @@ · 467 unmodified lines | |||
| 468 | compatible = "mediatek,mt7629-sgmiisys", "syscon"; | 468 | compatible = "mediatek,mt7629-sgmiisys", "syscon"; |
| 469 | reg = <0x1b128000 0x3000>; | 469 | reg = <0x1b128000 0x3000>; |
| 470 | #clock-cells = <1>; | 470 | #clock-cells = <1>; |
| 471 | mediatek,physpeed = "2500"; | ||
| 472 | }; | 471 | }; |
| 473 | 472 | ||
| 474 | sgmiisys1: syscon@1b130000 { | 473 | sgmiisys1: syscon@1b130000 { |
| 475 | compatible = "mediatek,mt7629-sgmiisys", "syscon"; | 474 | compatible = "mediatek,mt7629-sgmiisys", "syscon"; |
| 476 | reg = <0x1b130000 0x3000>; | 475 | reg = <0x1b130000 0x3000>; |
| 477 | #clock-cells = <1>; | 476 | #clock-cells = <1>; |
| 478 | mediatek,physpeed = "2500"; | ||
| 479 | }; | 477 | }; |
| 480 | }; | 478 | }; |
| 481 | }; | 479 | }; |
| @@ -369,7 +369,7 @@ · 368 unmodified lines | |||
| 369 | compatible = "ti,wl1285", "ti,wl1283"; | 369 | compatible = "ti,wl1285", "ti,wl1283"; |
| 370 | reg = <2>; | 370 | reg = <2>; |
| 371 | /* gpio_100 with gpmc_wait2 pad as wakeirq */ | 371 | /* gpio_100 with gpmc_wait2 pad as wakeirq */ |
| 372 | interrupts-extended = <&gpio4 4 IRQ_TYPE_EDGE_RISING>, | 372 | interrupts-extended = <&gpio4 4 IRQ_TYPE_LEVEL_HIGH>, |
| 373 | <&omap4_pmx_core 0x4e>; | 373 | <&omap4_pmx_core 0x4e>; |
| 374 | interrupt-names = "irq", "wakeup"; | 374 | interrupt-names = "irq", "wakeup"; |
| 375 | ref-clock-frequency = <26000000>; | 375 | ref-clock-frequency = <26000000>; |
| @@ -474,7 +474,7 @@ · 473 unmodified lines | |||
| 474 | compatible = "ti,wl1271"; | 474 | compatible = "ti,wl1271"; |
| 475 | reg = <2>; | 475 | reg = <2>; |
| 476 | /* gpio_53 with gpmc_ncs3 pad as wakeup */ | 476 | /* gpio_53 with gpmc_ncs3 pad as wakeup */ |
| 477 | interrupts-extended = <&gpio2 21 IRQ_TYPE_EDGE_RISING>, | 477 | interrupts-extended = <&gpio2 21 IRQ_TYPE_LEVEL_HIGH>, |
| 478 | <&omap4_pmx_core 0x3a>; | 478 | <&omap4_pmx_core 0x3a>; |
| 479 | interrupt-names = "irq", "wakeup"; | 479 | interrupt-names = "irq", "wakeup"; |
| 480 | ref-clock-frequency = <38400000>; | 480 | ref-clock-frequency = <38400000>; |
| @@ -512,7 +512,7 @@ · 511 unmodified lines | |||
| 512 | compatible = "ti,wl1281"; | 512 | compatible = "ti,wl1281"; |
| 513 | reg = <2>; | 513 | reg = <2>; |
| 514 | interrupt-parent = <&gpio1>; | 514 | interrupt-parent = <&gpio1>; |
| 515 | interrupts = <21 IRQ_TYPE_EDGE_RISING>; /* gpio 53 */ | 515 | interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; /* gpio 53 */ |
| 516 | ref-clock-frequency = <26000000>; | 516 | ref-clock-frequency = <26000000>; |
| 517 | tcxo-clock-frequency = <26000000>; | 517 | tcxo-clock-frequency = <26000000>; |
| 518 | }; | 518 | }; |
| @@ -69,7 +69,7 @@ · 68 unmodified lines | |||
| 69 | compatible = "ti,wl1271"; | 69 | compatible = "ti,wl1271"; |
| 70 | reg = <2>; | 70 | reg = <2>; |
| 71 | interrupt-parent = <&gpio2>; | 71 | interrupt-parent = <&gpio2>; |
| 72 | interrupts = <9 IRQ_TYPE_EDGE_RISING>; /* gpio 41 */ | 72 | interrupts = <9 IRQ_TYPE_LEVEL_HIGH>; /* gpio 41 */ |
| 73 | ref-clock-frequency = <38400000>; | 73 | ref-clock-frequency = <38400000>; |
| 74 | }; | 74 | }; |
| 75 | }; | 75 | }; |
| @@ -362,7 +362,7 @@ · 361 unmodified lines | |||
| 362 | pinctrl-names = "default"; | 362 | pinctrl-names = "default"; |
| 363 | pinctrl-0 = <&wlcore_irq_pin>; | 363 | pinctrl-0 = <&wlcore_irq_pin>; |
| 364 | interrupt-parent = <&gpio1>; | 364 | interrupt-parent = <&gpio1>; |
| 365 | interrupts = <14 IRQ_TYPE_EDGE_RISING>; /* gpio 14 */ | 365 | interrupts = <14 IRQ_TYPE_LEVEL_HIGH>; /* gpio 14 */ |
| 366 | ref-clock-frequency = <26000000>; | 366 | ref-clock-frequency = <26000000>; |
| 367 | }; | 367 | }; |
| 368 | }; | 368 | }; |
| @@ -1146,7 +1146,7 @@ · 1145 unmodified lines | |||
| 1146 | }; | 1146 | }; |
| 1147 | }; | 1147 | }; |
| 1148 | 1148 | ||
| 1149 | gpu_cm: clock-controller@1500 { | 1149 | gpu_cm: gpu_cm@1500 { |
| 1150 | compatible = "ti,omap4-cm"; | 1150 | compatible = "ti,omap4-cm"; |
| 1151 | reg = <0x1500 0x100>; | 1151 | reg = <0x1500 0x100>; |
| 1152 | #address-cells = <1>; | 1152 | #address-cells = <1>; |
| @@ -609,13 +609,13 @@ · 608 unmodified lines | |||
| 609 | <STM32_PINMUX('F', 6, AF9)>; /* QSPI_BK1_IO3 */ | 609 | <STM32_PINMUX('F', 6, AF9)>; /* QSPI_BK1_IO3 */ |
| 610 | bias-disable; | 610 | bias-disable; |
| 611 | drive-push-pull; | 611 | drive-push-pull; |
| 612 | slew-rate = <3>; | 612 | slew-rate = <1>; |
| 613 | }; | 613 | }; |
| 614 | pins2 { | 614 | pins2 { |
| 615 | pinmux = <STM32_PINMUX('B', 6, AF10)>; /* QSPI_BK1_NCS */ | 615 | pinmux = <STM32_PINMUX('B', 6, AF10)>; /* QSPI_BK1_NCS */ |
| 616 | bias-pull-up; | 616 | bias-pull-up; |
| 617 | drive-push-pull; | 617 | drive-push-pull; |
| 618 | slew-rate = <3>; | 618 | slew-rate = <1>; |
| 619 | }; | 619 | }; |
| 620 | }; | 620 | }; |
| 621 | 621 | ||
| @@ -637,13 +637,13 @@ · 15 unmodified lines | |||
| 637 | <STM32_PINMUX('G', 7, AF11)>; /* QSPI_BK2_IO3 */ | 637 | <STM32_PINMUX('G', 7, AF11)>; /* QSPI_BK2_IO3 */ |
| 638 | bias-disable; | 638 | bias-disable; |
| 639 | drive-push-pull; | 639 | drive-push-pull; |
| 640 | slew-rate = <3>; | 640 | slew-rate = <1>; |
| 641 | }; | 641 | }; |
| 642 | pins2 { | 642 | pins2 { |
| 643 | pinmux = <STM32_PINMUX('C', 0, AF10)>; /* QSPI_BK2_NCS */ | 643 | pinmux = <STM32_PINMUX('C', 0, AF10)>; /* QSPI_BK2_NCS */ |
| 644 | bias-pull-up; | 644 | bias-pull-up; |
| 645 | drive-push-pull; | 645 | drive-push-pull; |
| 646 | slew-rate = <3>; | 646 | slew-rate = <1>; |
| 647 | }; | 647 | }; |
| 648 | }; | 648 | }; |
| 649 | 649 | ||
| @@ -380,9 +380,8 @@ · 379 unmodified lines | |||
| 380 | compatible = "allwinner,sun7i-a20-csi0"; | 380 | compatible = "allwinner,sun7i-a20-csi0"; |
| 381 | reg = <0x01c09000 0x1000>; | 381 | reg = <0x01c09000 0x1000>; |
| 382 | interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; | 382 | interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>; |
| 383 | clocks = <&ccu CLK_AHB_CSI0>, <&ccu CLK_CSI0>, | 383 | clocks = <&ccu CLK_AHB_CSI0>, <&ccu CLK_CSI_SCLK>, <&ccu CLK_DRAM_CSI0>; |
| 384 | <&ccu CLK_CSI_SCLK>, <&ccu CLK_DRAM_CSI0>; | 384 | clock-names = "bus", "isp", "ram"; |
| 385 | clock-names = "bus", "mod", "isp", "ram"; | ||
| 386 | resets = <&ccu RST_CSI0>; | 385 | resets = <&ccu RST_CSI0>; |
| 387 | status = "disabled"; | 386 | status = "disabled"; |
| 388 | }; | 387 | }; |
| @@ -602,6 +602,7 @@ · 601 unmodified lines | |||
| 602 | #address-cells = <1>; | 602 | #address-cells = <1>; |
| 603 | #size-cells = <0>; | 603 | #size-cells = <0>; |
| 604 | reg = <0x70>; | 604 | reg = <0x70>; |
| 605 | i2c-mux-idle-disconnect; | ||
| 605 | 606 | ||
| 606 | sff0_i2c: i2c@1 { | 607 | sff0_i2c: i2c@1 { |
| 607 | #address-cells = <1>; | 608 | #address-cells = <1>; |
| @@ -640,6 +641,7 @@ · 32 unmodified lines | |||
| 640 | reg = <0x71>; | 641 | reg = <0x71>; |
| 641 | #address-cells = <1>; | 642 | #address-cells = <1>; |
| 642 | #size-cells = <0>; | 643 | #size-cells = <0>; |
| 644 | i2c-mux-idle-disconnect; | ||
| 643 | 645 | ||
| 644 | sff5_i2c: i2c@1 { | 646 | sff5_i2c: i2c@1 { |
| 645 | #address-cells = <1>; | 647 | #address-cells = <1>; |
| @@ -167,6 +167,7 @@ CONFIG_FB=y · 166 unmodified lines | |||
| 167 | CONFIG_FIRMWARE_EDID=y | 167 | CONFIG_FIRMWARE_EDID=y |
| 168 | CONFIG_FB_DA8XX=y | 168 | CONFIG_FB_DA8XX=y |
| 169 | CONFIG_BACKLIGHT_PWM=m | 169 | CONFIG_BACKLIGHT_PWM=m |
| 170 | CONFIG_BACKLIGHT_GPIO=m | ||
| 170 | CONFIG_FRAMEBUFFER_CONSOLE=y | 171 | CONFIG_FRAMEBUFFER_CONSOLE=y |
| 171 | CONFIG_LOGO=y | 172 | CONFIG_LOGO=y |
| 172 | CONFIG_SOUND=m | 173 | CONFIG_SOUND=m |
| @@ -276,6 +276,7 @@ CONFIG_VIDEO_OV5640=m · 275 unmodified lines | |||
| 276 | CONFIG_VIDEO_OV5645=m | 276 | CONFIG_VIDEO_OV5645=m |
| 277 | CONFIG_IMX_IPUV3_CORE=y | 277 | CONFIG_IMX_IPUV3_CORE=y |
| 278 | CONFIG_DRM=y | 278 | CONFIG_DRM=y |
| 279 | CONFIG_DRM_MSM=y | ||
| 279 | CONFIG_DRM_PANEL_LVDS=y | 280 | CONFIG_DRM_PANEL_LVDS=y |
| 280 | CONFIG_DRM_PANEL_SIMPLE=y | 281 | CONFIG_DRM_PANEL_SIMPLE=y |
| 281 | CONFIG_DRM_PANEL_SEIKO_43WVF1G=y | 282 | CONFIG_DRM_PANEL_SEIKO_43WVF1G=y |
| @@ -356,15 +356,15 @@ CONFIG_DRM_OMAP_CONNECTOR_HDMI=m · 355 unmodified lines | |||
| 356 | CONFIG_DRM_OMAP_CONNECTOR_ANALOG_TV=m | 356 | CONFIG_DRM_OMAP_CONNECTOR_ANALOG_TV=m |
| 357 | CONFIG_DRM_OMAP_PANEL_DPI=m | 357 | CONFIG_DRM_OMAP_PANEL_DPI=m |
| 358 | CONFIG_DRM_OMAP_PANEL_DSI_CM=m | 358 | CONFIG_DRM_OMAP_PANEL_DSI_CM=m |
| 359 | CONFIG_DRM_OMAP_PANEL_SONY_ACX565AKM=m | ||
| 360 | CONFIG_DRM_OMAP_PANEL_LGPHILIPS_LB035Q02=m | ||
| 361 | CONFIG_DRM_OMAP_PANEL_SHARP_LS037V7DW01=m | ||
| 362 | CONFIG_DRM_OMAP_PANEL_TPO_TD028TTEC1=m | ||
| 363 | CONFIG_DRM_OMAP_PANEL_TPO_TD043MTEA1=m | ||
| 364 | CONFIG_DRM_OMAP_PANEL_NEC_NL8048HL11=m | ||
| 365 | CONFIG_DRM_TILCDC=m | 359 | CONFIG_DRM_TILCDC=m |
| 366 | CONFIG_DRM_PANEL_SIMPLE=m | 360 | CONFIG_DRM_PANEL_SIMPLE=m |
| 367 | CONFIG_DRM_TI_TFP410=m | 361 | CONFIG_DRM_TI_TFP410=m |
| 362 | CONFIG_DRM_PANEL_LG_LB035Q02=m | ||
| 363 | CONFIG_DRM_PANEL_NEC_NL8048HL11=m | ||
| 364 | CONFIG_DRM_PANEL_SHARP_LS037V7DW01=m | ||
| 365 | CONFIG_DRM_PANEL_SONY_ACX565AKM=m | ||
| 366 | CONFIG_DRM_PANEL_TPO_TD028TTEC1=m | ||
| 367 | CONFIG_DRM_PANEL_TPO_TD043MTEA1=m | ||
| 368 | CONFIG_FB=y | 368 | CONFIG_FB=y |
| 369 | CONFIG_FIRMWARE_EDID=y | 369 | CONFIG_FIRMWARE_EDID=y |
| 370 | CONFIG_FB_MODE_HELPERS=y | 370 | CONFIG_FB_MODE_HELPERS=y |
| @@ -82,7 +82,7 @@ · 81 unmodified lines | |||
| 82 | #ifndef __ASSEMBLY__ | 82 | #ifndef __ASSEMBLY__ |
| 83 | 83 | ||
| 84 | #ifdef CONFIG_CPU_CP15_MMU | 84 | #ifdef CONFIG_CPU_CP15_MMU |
| 85 | static inline unsigned int get_domain(void) | 85 | static __always_inline unsigned int get_domain(void) |
| 86 | { | 86 | { |
| 87 | unsigned int domain; | 87 | unsigned int domain; |
| 88 | 88 | ||
| @@ -94,7 +94,7 @@ static inline unsigned int get_domain(void) · 5 unmodified lines | |||
| 94 | return domain; | 94 | return domain; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | static inline void set_domain(unsigned val) | 97 | static __always_inline void set_domain(unsigned int val) |
| 98 | { | 98 | { |
| 99 | asm volatile( | 99 | asm volatile( |
| 100 | "mcr p15, 0, %0, c3, c0 @ set domain" | 100 | "mcr p15, 0, %0, c3, c0 @ set domain" |
| @@ -102,12 +102,12 @@ static inline void set_domain(unsigned val) · 1 unmodified line | |||
| 102 | isb(); | 102 | isb(); |
| 103 | } | 103 | } |
| 104 | #else | 104 | #else |
| 105 | static inline unsigned int get_domain(void) | 105 | static __always_inline unsigned int get_domain(void) |
| 106 | { | 106 | { |
| 107 | return 0; | 107 | return 0; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | static inline void set_domain(unsigned val) | 110 | static __always_inline void set_domain(unsigned int val) |
| 111 | { | 111 | { |
| 112 | } | 112 | } |
| 113 | #endif | 113 | #endif |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | * perform such accesses (eg, via list poison values) which could then | 22 | * perform such accesses (eg, via list poison values) which could then |
| 23 | * be exploited for priviledge escalation. | 23 | * be exploited for priviledge escalation. |
| 24 | */ | 24 | */ |
| 25 | static inline unsigned int uaccess_save_and_enable(void) | 25 | static __always_inline unsigned int uaccess_save_and_enable(void) |
| 26 | { | 26 | { |
| 27 | #ifdef CONFIG_CPU_SW_DOMAIN_PAN | 27 | #ifdef CONFIG_CPU_SW_DOMAIN_PAN |
| 28 | unsigned int old_domain = get_domain(); | 28 | unsigned int old_domain = get_domain(); |
| @@ -37,7 +37,7 @@ static inline unsigned int uaccess_save_and_enable(void) · 8 unmodified lines | |||
| 37 | #endif | 37 | #endif |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | static inline void uaccess_restore(unsigned int flags) | 40 | static __always_inline void uaccess_restore(unsigned int flags) |
| 41 | { | 41 | { |
| 42 | #ifdef CONFIG_CPU_SW_DOMAIN_PAN | 42 | #ifdef CONFIG_CPU_SW_DOMAIN_PAN |
| 43 | /* Restore the user access mask */ | 43 | /* Restore the user access mask */ |
| @@ -68,7 +68,7 @@ ENDPROC(__vet_atags) · 67 unmodified lines | |||
| 68 | * The following fragment of code is executed with the MMU on in MMU mode, | 68 | * The following fragment of code is executed with the MMU on in MMU mode, |
| 69 | * and uses absolute addresses; this is not position independent. | 69 | * and uses absolute addresses; this is not position independent. |
| 70 | * | 70 | * |
| 71 | * r0 = cp#15 control register | 71 | * r0 = cp#15 control register (exc_ret for M-class) |
| 72 | * r1 = machine ID | 72 | * r1 = machine ID |
| 73 | * r2 = atags/dtb pointer | 73 | * r2 = atags/dtb pointer |
| 74 | * r9 = processor ID | 74 | * r9 = processor ID |
| @@ -137,7 +137,8 @@ __mmap_switched_data: · 62 unmodified lines | |||
| 137 | #ifdef CONFIG_CPU_CP15 | 137 | #ifdef CONFIG_CPU_CP15 |
| 138 | .long cr_alignment @ r3 | 138 | .long cr_alignment @ r3 |
| 139 | #else | 139 | #else |
| 140 | .long 0 @ r3 | 140 | M_CLASS(.long exc_ret) @ r3 |
| 141 | AR_CLASS(.long 0) @ r3 | ||
| 141 | #endif | 142 | #endif |
| 142 | .size __mmap_switched_data, . - __mmap_switched_data | 143 | .size __mmap_switched_data, . - __mmap_switched_data |
| 143 | 144 | ||
| @@ -201,6 +201,8 @@ M_CLASS(streq r3, [r12, #PMSAv8_MAIR1]) · 200 unmodified lines | |||
| 201 | bic r0, r0, #V7M_SCB_CCR_IC | 201 | bic r0, r0, #V7M_SCB_CCR_IC |
| 202 | #endif | 202 | #endif |
| 203 | str r0, [r12, V7M_SCB_CCR] | 203 | str r0, [r12, V7M_SCB_CCR] |
| 204 | /* Pass exc_ret to __mmap_switched */ | ||
| 205 | mov r0, r10 | ||
| 204 | #endif /* CONFIG_CPU_CP15 elif CONFIG_CPU_V7M */ | 206 | #endif /* CONFIG_CPU_CP15 elif CONFIG_CPU_V7M */ |
| 205 | ret lr | 207 | ret lr |
| 206 | ENDPROC(__after_proc_init) | 208 | ENDPROC(__after_proc_init) |
| @@ -462,8 +462,8 @@ static s8 dm365_queue_priority_mapping[][2] = { · 461 unmodified lines | |||
| 462 | }; | 462 | }; |
| 463 | 463 | ||
| 464 | static const struct dma_slave_map dm365_edma_map[] = { | 464 | static const struct dma_slave_map dm365_edma_map[] = { |
| 465 | { "davinci-mcbsp.0", "tx", EDMA_FILTER_PARAM(0, 2) }, | 465 | { "davinci-mcbsp", "tx", EDMA_FILTER_PARAM(0, 2) }, |
| 466 | { "davinci-mcbsp.0", "rx", EDMA_FILTER_PARAM(0, 3) }, | 466 | { "davinci-mcbsp", "rx", EDMA_FILTER_PARAM(0, 3) }, |
| 467 | { "davinci_voicecodec", "tx", EDMA_FILTER_PARAM(0, 2) }, | 467 | { "davinci_voicecodec", "tx", EDMA_FILTER_PARAM(0, 2) }, |
| 468 | { "davinci_voicecodec", "rx", EDMA_FILTER_PARAM(0, 3) }, | 468 | { "davinci_voicecodec", "rx", EDMA_FILTER_PARAM(0, 3) }, |
| 469 | { "spi_davinci.2", "tx", EDMA_FILTER_PARAM(0, 10) }, | 469 | { "spi_davinci.2", "tx", EDMA_FILTER_PARAM(0, 10) }, |
| @@ -89,6 +89,13 @@ static struct iommu_platform_data omap3_iommu_pdata = { · 88 unmodified lines | |||
| 89 | .reset_name = "mmu", | 89 | .reset_name = "mmu", |
| 90 | .assert_reset = omap_device_assert_hardreset, | 90 | .assert_reset = omap_device_assert_hardreset, |
| 91 | .deassert_reset = omap_device_deassert_hardreset, | 91 | .deassert_reset = omap_device_deassert_hardreset, |
| 92 | .device_enable = omap_device_enable, | ||
| 93 | .device_idle = omap_device_idle, | ||
| 94 | }; | ||
| 95 | |||
| 96 | static struct iommu_platform_data omap3_iommu_isp_pdata = { | ||
| 97 | .device_enable = omap_device_enable, | ||
| 98 | .device_idle = omap_device_idle, | ||
| 92 | }; | 99 | }; |
| 93 | 100 | ||
| 94 | static int omap3_sbc_t3730_twl_callback(struct device *dev, | 101 | static int omap3_sbc_t3730_twl_callback(struct device *dev, |
| @@ -424,6 +431,8 @@ static struct iommu_platform_data omap4_iommu_pdata = { · 329 unmodified lines | |||
| 424 | .reset_name = "mmu_cache", | 431 | .reset_name = "mmu_cache", |
| 425 | .assert_reset = omap_device_assert_hardreset, | 432 | .assert_reset = omap_device_assert_hardreset, |
| 426 | .deassert_reset = omap_device_deassert_hardreset, | 433 | .deassert_reset = omap_device_deassert_hardreset, |
| 434 | .device_enable = omap_device_enable, | ||
| 435 | .device_idle = omap_device_idle, | ||
| 427 | }; | 436 | }; |
| 428 | #endif | 437 | #endif |
| 429 | 438 | ||
| @@ -617,6 +626,8 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = { · 187 unmodified lines | |||
| 617 | #ifdef CONFIG_ARCH_OMAP3 | 626 | #ifdef CONFIG_ARCH_OMAP3 |
| 618 | OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu", | 627 | OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu", |
| 619 | &omap3_iommu_pdata), | 628 | &omap3_iommu_pdata), |
| 629 | OF_DEV_AUXDATA("ti,omap2-iommu", 0x480bd400, "480bd400.mmu", | ||
| 630 | &omap3_iommu_isp_pdata), | ||
| 620 | OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000, | 631 | OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000, |
| 621 | "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]), | 632 | "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]), |
| 622 | OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000, | 633 | OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000, |
| @@ -324,7 +324,7 @@ union offset_union { · 323 unmodified lines | |||
| 324 | __put32_unaligned_check("strbt", val, addr) | 324 | __put32_unaligned_check("strbt", val, addr) |
| 325 | 325 | ||
| 326 | static void | 326 | static void |
| 327 | do_alignment_finish_ldst(unsigned long addr, unsigned long instr, struct pt_regs *regs, union offset_union offset) | 327 | do_alignment_finish_ldst(unsigned long addr, u32 instr, struct pt_regs *regs, union offset_union offset) |
| 328 | { | 328 | { |
| 329 | if (!LDST_U_BIT(instr)) | 329 | if (!LDST_U_BIT(instr)) |
| 330 | offset.un = -offset.un; | 330 | offset.un = -offset.un; |
| @@ -337,7 +337,7 @@ do_alignment_finish_ldst(unsigned long addr, unsigned long instr, struct pt_regs · 6 unmodified lines | |||
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | static int | 339 | static int |
| 340 | do_alignment_ldrhstrh(unsigned long addr, unsigned long instr, struct pt_regs *regs) | 340 | do_alignment_ldrhstrh(unsigned long addr, u32 instr, struct pt_regs *regs) |
| 341 | { | 341 | { |
| 342 | unsigned int rd = RD_BITS(instr); | 342 | unsigned int rd = RD_BITS(instr); |
| 343 | 343 | ||
| @@ -386,8 +386,7 @@ do_alignment_ldrhstrh(unsigned long addr, unsigned long instr, struct pt_regs *r · 42 unmodified lines | |||
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | static int | 388 | static int |
| 389 | do_alignment_ldrdstrd(unsigned long addr, unsigned long instr, | 389 | do_alignment_ldrdstrd(unsigned long addr, u32 instr, struct pt_regs *regs) |
| 390 | struct pt_regs *regs) | ||
| 391 | { | 390 | { |
| 392 | unsigned int rd = RD_BITS(instr); | 391 | unsigned int rd = RD_BITS(instr); |
| 393 | unsigned int rd2; | 392 | unsigned int rd2; |
| @@ -449,7 +448,7 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr, · 55 unmodified lines | |||
| 449 | } | 448 | } |
| 450 | 449 | ||
| 451 | static int | 450 | static int |
| 452 | do_alignment_ldrstr(unsigned long addr, unsigned long instr, struct pt_regs *regs) | 451 | do_alignment_ldrstr(unsigned long addr, u32 instr, struct pt_regs *regs) |
| 453 | { | 452 | { |
| 454 | unsigned int rd = RD_BITS(instr); | 453 | unsigned int rd = RD_BITS(instr); |
| 455 | 454 | ||
| @@ -498,7 +497,7 @@ do_alignment_ldrstr(unsigned long addr, unsigned long instr, struct pt_regs *reg · 42 unmodified lines | |||
| 498 | * PU = 10 A B | 497 | * PU = 10 A B |
| 499 | */ | 498 | */ |
| 500 | static int | 499 | static int |
| 501 | do_alignment_ldmstm(unsigned long addr, unsigned long instr, struct pt_regs *regs) | 500 | do_alignment_ldmstm(unsigned long addr, u32 instr, struct pt_regs *regs) |
| 502 | { | 501 | { |
| 503 | unsigned int rd, rn, correction, nr_regs, regbits; | 502 | unsigned int rd, rn, correction, nr_regs, regbits; |
| 504 | unsigned long eaddr, newaddr; | 503 | unsigned long eaddr, newaddr; |
| @@ -539,7 +538,7 @@ do_alignment_ldmstm(unsigned long addr, unsigned long instr, struct pt_regs *reg · 34 unmodified lines | |||
| 539 | * processor for us. | 538 | * processor for us. |
| 540 | */ | 539 | */ |
| 541 | if (addr != eaddr) { | 540 | if (addr != eaddr) { |
| 542 | pr_err("LDMSTM: PC = %08lx, instr = %08lx, " | 541 | pr_err("LDMSTM: PC = %08lx, instr = %08x, " |
| 543 | "addr = %08lx, eaddr = %08lx\n", | 542 | "addr = %08lx, eaddr = %08lx\n", |
| 544 | instruction_pointer(regs), instr, addr, eaddr); | 543 | instruction_pointer(regs), instr, addr, eaddr); |
| 545 | show_regs(regs); | 544 | show_regs(regs); |
| @@ -716,10 +715,10 @@ thumb2arm(u16 tinstr) · 170 unmodified lines | |||
| 716 | * 2. Register name Rt from ARMv7 is same as Rd from ARMv6 (Rd is Rt) | 715 | * 2. Register name Rt from ARMv7 is same as Rd from ARMv6 (Rd is Rt) |
| 717 | */ | 716 | */ |
| 718 | static void * | 717 | static void * |
| 719 | do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs, | 718 | do_alignment_t32_to_handler(u32 *pinstr, struct pt_regs *regs, |
| 720 | union offset_union *poffset) | 719 | union offset_union *poffset) |
| 721 | { | 720 | { |
| 722 | unsigned long instr = *pinstr; | 721 | u32 instr = *pinstr; |
| 723 | u16 tinst1 = (instr >> 16) & 0xffff; | 722 | u16 tinst1 = (instr >> 16) & 0xffff; |
| 724 | u16 tinst2 = instr & 0xffff; | 723 | u16 tinst2 = instr & 0xffff; |
| 725 | 724 | ||
| @@ -767,17 +766,48 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs, · 41 unmodified lines | |||
| 767 | return NULL; | 766 | return NULL; |
| 768 | } | 767 | } |
| 769 | 768 | ||
| 769 | static int alignment_get_arm(struct pt_regs *regs, u32 *ip, u32 *inst) | ||
| 770 | { | ||
| 771 | u32 instr = 0; | ||
| 772 | int fault; | ||
| 773 | |||
| 774 | if (user_mode(regs)) | ||
| 775 | fault = get_user(instr, ip); | ||
| 776 | else | ||
| 777 | fault = probe_kernel_address(ip, instr); | ||
| 778 | |||
| 779 | *inst = __mem_to_opcode_arm(instr); | ||
| 780 | |||
| 781 | return fault; | ||
| 782 | } | ||
| 783 | |||
| 784 | static int alignment_get_thumb(struct pt_regs *regs, u16 *ip, u16 *inst) | ||
| 785 | { | ||
| 786 | u16 instr = 0; | ||
| 787 | int fault; | ||
| 788 | |||
| 789 | if (user_mode(regs)) | ||
| 790 | fault = get_user(instr, ip); | ||
| 791 | else | ||
| 792 | fault = probe_kernel_address(ip, instr); | ||
| 793 | |||
| 794 | *inst = __mem_to_opcode_thumb16(instr); | ||
| 795 | |||
| 796 | return fault; | ||
| 797 | } | ||
| 798 | |||
| 770 | static int | 799 | static int |
| 771 | do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | 800 | do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) |
| 772 | { | 801 | { |
| 773 | union offset_union uninitialized_var(offset); | 802 | union offset_union uninitialized_var(offset); |
| 774 | unsigned long instr = 0, instrptr; | 803 | unsigned long instrptr; |
| 775 | int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs); | 804 | int (*handler)(unsigned long addr, u32 instr, struct pt_regs *regs); |
| 776 | unsigned int type; | 805 | unsigned int type; |
| 777 | unsigned int fault; | 806 | u32 instr = 0; |
| 778 | u16 tinstr = 0; | 807 | u16 tinstr = 0; |
| 779 | int isize = 4; | 808 | int isize = 4; |
| 780 | int thumb2_32b = 0; | 809 | int thumb2_32b = 0; |
| 810 | int fault; | ||
| 781 | 811 | ||
| 782 | if (interrupts_enabled(regs)) | 812 | if (interrupts_enabled(regs)) |
| 783 | local_irq_enable(); | 813 | local_irq_enable(); |
| @@ -786,15 +816,14 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 2 unmodified lines | |||
| 786 | 816 | ||
| 787 | if (thumb_mode(regs)) { | 817 | if (thumb_mode(regs)) { |
| 788 | u16 *ptr = (u16 *)(instrptr & ~1); | 818 | u16 *ptr = (u16 *)(instrptr & ~1); |
| 789 | fault = probe_kernel_address(ptr, tinstr); | 819 | |
| 790 | tinstr = __mem_to_opcode_thumb16(tinstr); | 820 | fault = alignment_get_thumb(regs, ptr, &tinstr); |
| 791 | if (!fault) { | 821 | if (!fault) { |
| 792 | if (cpu_architecture() >= CPU_ARCH_ARMv7 && | 822 | if (cpu_architecture() >= CPU_ARCH_ARMv7 && |
| 793 | IS_T32(tinstr)) { | 823 | IS_T32(tinstr)) { |
| 794 | /* Thumb-2 32-bit */ | 824 | /* Thumb-2 32-bit */ |
| 795 | u16 tinst2 = 0; | 825 | u16 tinst2; |
| 796 | fault = probe_kernel_address(ptr + 1, tinst2); | 826 | fault = alignment_get_thumb(regs, ptr + 1, &tinst2); |
| 797 | tinst2 = __mem_to_opcode_thumb16(tinst2); | ||
| 798 | instr = __opcode_thumb32_compose(tinstr, tinst2); | 827 | instr = __opcode_thumb32_compose(tinstr, tinst2); |
| 799 | thumb2_32b = 1; | 828 | thumb2_32b = 1; |
| 800 | } else { | 829 | } else { |
| @@ -803,8 +832,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 2 unmodified lines | |||
| 803 | } | 832 | } |
| 804 | } | 833 | } |
| 805 | } else { | 834 | } else { |
| 806 | fault = probe_kernel_address((void *)instrptr, instr); | 835 | fault = alignment_get_arm(regs, (void *)instrptr, &instr); |
| 807 | instr = __mem_to_opcode_arm(instr); | ||
| 808 | } | 836 | } |
| 809 | 837 | ||
| 810 | if (fault) { | 838 | if (fault) { |
| @@ -926,7 +954,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 115 unmodified lines | |||
| 926 | * Oops, we didn't handle the instruction. | 954 | * Oops, we didn't handle the instruction. |
| 927 | */ | 955 | */ |
| 928 | pr_err("Alignment trap: not handling instruction " | 956 | pr_err("Alignment trap: not handling instruction " |
| 929 | "%0*lx at [<%08lx>]\n", | 957 | "%0*x at [<%08lx>]\n", |
| 930 | isize << 1, | 958 | isize << 1, |
| 931 | isize == 2 ? tinstr : instr, instrptr); | 959 | isize == 2 ? tinstr : instr, instrptr); |
| 932 | ai_skipped += 1; | 960 | ai_skipped += 1; |
| @@ -936,7 +964,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 3 unmodified lines | |||
| 936 | ai_user += 1; | 964 | ai_user += 1; |
| 937 | 965 | ||
| 938 | if (ai_usermode & UM_WARN) | 966 | if (ai_usermode & UM_WARN) |
| 939 | printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx " | 967 | printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*x " |
| 940 | "Address=0x%08lx FSR 0x%03x\n", current->comm, | 968 | "Address=0x%08lx FSR 0x%03x\n", current->comm, |
| 941 | task_pid_nr(current), instrptr, | 969 | task_pid_nr(current), instrptr, |
| 942 | isize << 1, | 970 | isize << 1, |
| @@ -132,13 +132,11 @@ __v7m_setup_cont: · 131 unmodified lines | |||
| 132 | dsb | 132 | dsb |
| 133 | mov r6, lr @ save LR | 133 | mov r6, lr @ save LR |
| 134 | ldr sp, =init_thread_union + THREAD_START_SP | 134 | ldr sp, =init_thread_union + THREAD_START_SP |
| 135 | stmia sp, {r0-r3, r12} | ||
| 136 | cpsie i | 135 | cpsie i |
| 137 | svc #0 | 136 | svc #0 |
| 138 | 1: cpsid i | 137 | 1: cpsid i |
| 139 | ldr r0, =exc_ret | 138 | /* Calculate exc_ret */ |
| 140 | orr lr, lr, #EXC_RET_THREADMODE_PROCESSSTACK | 139 | orr r10, lr, #EXC_RET_THREADMODE_PROCESSSTACK |
| 141 | str lr, [r0] | ||
| 142 | ldmia sp, {r0-r3, r12} | 140 | ldmia sp, {r0-r3, r12} |
| 143 | str r5, [r12, #11 * 4] @ restore the original SVC vector entry | 141 | str r5, [r12, #11 * 4] @ restore the original SVC vector entry |
| 144 | mov lr, r6 @ restore LR | 142 | mov lr, r6 @ restore LR |
| @@ -616,6 +616,23 @@ config CAVIUM_ERRATUM_30115 · 615 unmodified lines | |||
| 616 | 616 | ||
| 617 | If unsure, say Y. | 617 | If unsure, say Y. |
| 618 | 618 | ||
| 619 | config CAVIUM_TX2_ERRATUM_219 | ||
| 620 | bool "Cavium ThunderX2 erratum 219: PRFM between TTBR change and ISB fails" | ||
| 621 | default y | ||
| 622 | help | ||
| 623 | On Cavium ThunderX2, a load, store or prefetch instruction between a | ||
| 624 | TTBR update and the corresponding context synchronizing operation can | ||
| 625 | cause a spurious Data Abort to be delivered to any hardware thread in | ||
| 626 | the CPU core. | ||
| 627 | |||
| 628 | Work around the issue by avoiding the problematic code sequence and | ||
| 629 | trapping KVM guest TTBRx_EL1 writes to EL2 when SMT is enabled. The | ||
| 630 | trap handler performs the corresponding register access, skips the | ||
| 631 | instruction and ensures context synchronization by virtue of the | ||
| 632 | exception return. | ||
| 633 | |||
| 634 | If unsure, say Y. | ||
| 635 | |||
| 619 | config QCOM_FALKOR_ERRATUM_1003 | 636 | config QCOM_FALKOR_ERRATUM_1003 |
| 620 | bool "Falkor E1003: Incorrect translation due to ASID change" | 637 | bool "Falkor E1003: Incorrect translation due to ASID change" |
| 621 | default y | 638 | default y |
| @@ -63,3 +63,12 @@ · 62 unmodified lines | |||
| 63 | reg = <1>; | 63 | reg = <1>; |
| 64 | }; | 64 | }; |
| 65 | }; | 65 | }; |
| 66 | |||
| 67 | ®_dc1sw { | ||
| 68 | /* | ||
| 69 | * Ethernet PHY needs 30ms to properly power up and some more | ||
| 70 | * to initialize. 100ms should be plenty of time to finish | ||
| 71 | * whole process. | ||
| 72 | */ | ||
| 73 | regulator-enable-ramp-delay = <100000>; | ||
| 74 | }; | ||
| @@ -159,6 +159,12 @@ · 158 unmodified lines | |||
| 159 | }; | 159 | }; |
| 160 | 160 | ||
| 161 | ®_dc1sw { | 161 | ®_dc1sw { |
| 162 | /* | ||
| 163 | * Ethernet PHY needs 30ms to properly power up and some more | ||
| 164 | * to initialize. 100ms should be plenty of time to finish | ||
| 165 | * whole process. | ||
| 166 | */ | ||
| 167 | regulator-enable-ramp-delay = <100000>; | ||
| 162 | regulator-name = "vcc-phy"; | 168 | regulator-name = "vcc-phy"; |
| 163 | }; | 169 | }; |
| 164 | 170 | ||
| @@ -142,15 +142,6 @@ · 141 unmodified lines | |||
| 142 | clock-output-names = "ext-osc32k"; | 142 | clock-output-names = "ext-osc32k"; |
| 143 | }; | 143 | }; |
| 144 | 144 | ||
| 145 | pmu { | ||
| 146 | compatible = "arm,cortex-a53-pmu"; | ||
| 147 | interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>, | ||
| 148 | <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>, | ||
| 149 | <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>, | ||
| 150 | <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>; | ||
| 151 | interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>; | ||
| 152 | }; | ||
| 153 | |||
| 154 | psci { | 145 | psci { |
| 155 | compatible = "arm,psci-0.2"; | 146 | compatible = "arm,psci-0.2"; |
| 156 | method = "smc"; | 147 | method = "smc"; |
| @@ -42,13 +42,14 @@ · 41 unmodified lines | |||
| 42 | 42 | ||
| 43 | pinmux: pinmux@14029c { | 43 | pinmux: pinmux@14029c { |
| 44 | compatible = "pinctrl-single"; | 44 | compatible = "pinctrl-single"; |
| 45 | reg = <0x0014029c 0x250>; | 45 | reg = <0x0014029c 0x26c>; |
| 46 | #address-cells = <1>; | 46 | #address-cells = <1>; |
| 47 | #size-cells = <1>; | 47 | #size-cells = <1>; |
| 48 | pinctrl-single,register-width = <32>; | 48 | pinctrl-single,register-width = <32>; |
| 49 | pinctrl-single,function-mask = <0xf>; | 49 | pinctrl-single,function-mask = <0xf>; |
| 50 | pinctrl-single,gpio-range = < | 50 | pinctrl-single,gpio-range = < |
| 51 | &range 0 154 MODE_GPIO | 51 | &range 0 91 MODE_GPIO |
| 52 | &range 95 60 MODE_GPIO | ||
| 52 | >; | 53 | >; |
| 53 | range: gpio-range { | 54 | range: gpio-range { |
| 54 | #pinctrl-single,gpio-range-cells = <3>; | 55 | #pinctrl-single,gpio-range-cells = <3>; |
| @@ -464,8 +464,7 @@ · 463 unmodified lines | |||
| 464 | <&pinmux 108 16 27>, | 464 | <&pinmux 108 16 27>, |
| 465 | <&pinmux 135 77 6>, | 465 | <&pinmux 135 77 6>, |
| 466 | <&pinmux 141 67 4>, | 466 | <&pinmux 141 67 4>, |
| 467 | <&pinmux 145 149 6>, | 467 | <&pinmux 145 149 6>; |
| 468 | <&pinmux 151 91 4>; | ||
| 469 | }; | 468 | }; |
| 470 | 469 | ||
| 471 | i2c1: i2c@e0000 { | 470 | i2c1: i2c@e0000 { |
| @@ -33,7 +33,7 @@ · 32 unmodified lines | |||
| 33 | i-cache-line-size = <64>; | 33 | i-cache-line-size = <64>; |
| 34 | i-cache-sets = <192>; | 34 | i-cache-sets = <192>; |
| 35 | next-level-cache = <&cluster0_l2>; | 35 | next-level-cache = <&cluster0_l2>; |
| 36 | cpu-idle-states = <&cpu_pw20>; | 36 | cpu-idle-states = <&cpu_pw15>; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | cpu@1 { | 39 | cpu@1 { |
| @@ -49,7 +49,7 @@ · 9 unmodified lines | |||
| 49 | i-cache-line-size = <64>; | 49 | i-cache-line-size = <64>; |
| 50 | i-cache-sets = <192>; | 50 | i-cache-sets = <192>; |
| 51 | next-level-cache = <&cluster0_l2>; | 51 | next-level-cache = <&cluster0_l2>; |
| 52 | cpu-idle-states = <&cpu_pw20>; | 52 | cpu-idle-states = <&cpu_pw15>; |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | cpu@100 { | 55 | cpu@100 { |
| @@ -65,7 +65,7 @@ · 9 unmodified lines | |||
| 65 | i-cache-line-size = <64>; | 65 | i-cache-line-size = <64>; |
| 66 | i-cache-sets = <192>; | 66 | i-cache-sets = <192>; |
| 67 | next-level-cache = <&cluster1_l2>; | 67 | next-level-cache = <&cluster1_l2>; |
| 68 | cpu-idle-states = <&cpu_pw20>; | 68 | cpu-idle-states = <&cpu_pw15>; |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | cpu@101 { | 71 | cpu@101 { |
| @@ -81,7 +81,7 @@ · 9 unmodified lines | |||
| 81 | i-cache-line-size = <64>; | 81 | i-cache-line-size = <64>; |
| 82 | i-cache-sets = <192>; | 82 | i-cache-sets = <192>; |
| 83 | next-level-cache = <&cluster1_l2>; | 83 | next-level-cache = <&cluster1_l2>; |
| 84 | cpu-idle-states = <&cpu_pw20>; | 84 | cpu-idle-states = <&cpu_pw15>; |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | cpu@200 { | 87 | cpu@200 { |
| @@ -97,7 +97,7 @@ · 9 unmodified lines | |||
| 97 | i-cache-line-size = <64>; | 97 | i-cache-line-size = <64>; |
| 98 | i-cache-sets = <192>; | 98 | i-cache-sets = <192>; |
| 99 | next-level-cache = <&cluster2_l2>; | 99 | next-level-cache = <&cluster2_l2>; |
| 100 | cpu-idle-states = <&cpu_pw20>; | 100 | cpu-idle-states = <&cpu_pw15>; |
| 101 | }; | 101 | }; |
| 102 | 102 | ||
| 103 | cpu@201 { | 103 | cpu@201 { |
| @@ -113,7 +113,7 @@ · 9 unmodified lines | |||
| 113 | i-cache-line-size = <64>; | 113 | i-cache-line-size = <64>; |
| 114 | i-cache-sets = <192>; | 114 | i-cache-sets = <192>; |
| 115 | next-level-cache = <&cluster2_l2>; | 115 | next-level-cache = <&cluster2_l2>; |
| 116 | cpu-idle-states = <&cpu_pw20>; | 116 | cpu-idle-states = <&cpu_pw15>; |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | cpu@300 { | 119 | cpu@300 { |
| @@ -129,7 +129,7 @@ · 9 unmodified lines | |||
| 129 | i-cache-line-size = <64>; | 129 | i-cache-line-size = <64>; |
| 130 | i-cache-sets = <192>; | 130 | i-cache-sets = <192>; |
| 131 | next-level-cache = <&cluster3_l2>; | 131 | next-level-cache = <&cluster3_l2>; |
| 132 | cpu-idle-states = <&cpu_pw20>; | 132 | cpu-idle-states = <&cpu_pw15>; |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | cpu@301 { | 135 | cpu@301 { |
| @@ -145,7 +145,7 @@ · 9 unmodified lines | |||
| 145 | i-cache-line-size = <64>; | 145 | i-cache-line-size = <64>; |
| 146 | i-cache-sets = <192>; | 146 | i-cache-sets = <192>; |
| 147 | next-level-cache = <&cluster3_l2>; | 147 | next-level-cache = <&cluster3_l2>; |
| 148 | cpu-idle-states = <&cpu_pw20>; | 148 | cpu-idle-states = <&cpu_pw15>; |
| 149 | }; | 149 | }; |
| 150 | 150 | ||
| 151 | cpu@400 { | 151 | cpu@400 { |
| @@ -161,7 +161,7 @@ · 9 unmodified lines | |||
| 161 | i-cache-line-size = <64>; | 161 | i-cache-line-size = <64>; |
| 162 | i-cache-sets = <192>; | 162 | i-cache-sets = <192>; |
| 163 | next-level-cache = <&cluster4_l2>; | 163 | next-level-cache = <&cluster4_l2>; |
| 164 | cpu-idle-states = <&cpu_pw20>; | 164 | cpu-idle-states = <&cpu_pw15>; |
| 165 | }; | 165 | }; |
| 166 | 166 | ||
| 167 | cpu@401 { | 167 | cpu@401 { |
| @@ -177,7 +177,7 @@ · 9 unmodified lines | |||
| 177 | i-cache-line-size = <64>; | 177 | i-cache-line-size = <64>; |
| 178 | i-cache-sets = <192>; | 178 | i-cache-sets = <192>; |
| 179 | next-level-cache = <&cluster4_l2>; | 179 | next-level-cache = <&cluster4_l2>; |
| 180 | cpu-idle-states = <&cpu_pw20>; | 180 | cpu-idle-states = <&cpu_pw15>; |
| 181 | }; | 181 | }; |
| 182 | 182 | ||
| 183 | cpu@500 { | 183 | cpu@500 { |
| @@ -193,7 +193,7 @@ · 9 unmodified lines | |||
| 193 | i-cache-line-size = <64>; | 193 | i-cache-line-size = <64>; |
| 194 | i-cache-sets = <192>; | 194 | i-cache-sets = <192>; |
| 195 | next-level-cache = <&cluster5_l2>; | 195 | next-level-cache = <&cluster5_l2>; |
| 196 | cpu-idle-states = <&cpu_pw20>; | 196 | cpu-idle-states = <&cpu_pw15>; |
| 197 | }; | 197 | }; |
| 198 | 198 | ||
| 199 | cpu@501 { | 199 | cpu@501 { |
| @@ -209,7 +209,7 @@ · 9 unmodified lines | |||
| 209 | i-cache-line-size = <64>; | 209 | i-cache-line-size = <64>; |
| 210 | i-cache-sets = <192>; | 210 | i-cache-sets = <192>; |
| 211 | next-level-cache = <&cluster5_l2>; | 211 | next-level-cache = <&cluster5_l2>; |
| 212 | cpu-idle-states = <&cpu_pw20>; | 212 | cpu-idle-states = <&cpu_pw15>; |
| 213 | }; | 213 | }; |
| 214 | 214 | ||
| 215 | cpu@600 { | 215 | cpu@600 { |
| @@ -225,7 +225,7 @@ · 9 unmodified lines | |||
| 225 | i-cache-line-size = <64>; | 225 | i-cache-line-size = <64>; |
| 226 | i-cache-sets = <192>; | 226 | i-cache-sets = <192>; |
| 227 | next-level-cache = <&cluster6_l2>; | 227 | next-level-cache = <&cluster6_l2>; |
| 228 | cpu-idle-states = <&cpu_pw20>; | 228 | cpu-idle-states = <&cpu_pw15>; |
| 229 | }; | 229 | }; |
| 230 | 230 | ||
| 231 | cpu@601 { | 231 | cpu@601 { |
| @@ -241,7 +241,7 @@ · 9 unmodified lines | |||
| 241 | i-cache-line-size = <64>; | 241 | i-cache-line-size = <64>; |
| 242 | i-cache-sets = <192>; | 242 | i-cache-sets = <192>; |
| 243 | next-level-cache = <&cluster6_l2>; | 243 | next-level-cache = <&cluster6_l2>; |
| 244 | cpu-idle-states = <&cpu_pw20>; | 244 | cpu-idle-states = <&cpu_pw15>; |
| 245 | }; | 245 | }; |
| 246 | 246 | ||
| 247 | cpu@700 { | 247 | cpu@700 { |
| @@ -257,7 +257,7 @@ · 9 unmodified lines | |||
| 257 | i-cache-line-size = <64>; | 257 | i-cache-line-size = <64>; |
| 258 | i-cache-sets = <192>; | 258 | i-cache-sets = <192>; |
| 259 | next-level-cache = <&cluster7_l2>; | 259 | next-level-cache = <&cluster7_l2>; |
| 260 | cpu-idle-states = <&cpu_pw20>; | 260 | cpu-idle-states = <&cpu_pw15>; |
| 261 | }; | 261 | }; |
| 262 | 262 | ||
| 263 | cpu@701 { | 263 | cpu@701 { |
| @@ -273,7 +273,7 @@ · 9 unmodified lines | |||
| 273 | i-cache-line-size = <64>; | 273 | i-cache-line-size = <64>; |
| 274 | i-cache-sets = <192>; | 274 | i-cache-sets = <192>; |
| 275 | next-level-cache = <&cluster7_l2>; | 275 | next-level-cache = <&cluster7_l2>; |
| 276 | cpu-idle-states = <&cpu_pw20>; | 276 | cpu-idle-states = <&cpu_pw15>; |
| 277 | }; | 277 | }; |
| 278 | 278 | ||
| 279 | cluster0_l2: l2-cache0 { | 279 | cluster0_l2: l2-cache0 { |
| @@ -340,9 +340,9 @@ · 60 unmodified lines | |||
| 340 | cache-level = <2>; | 340 | cache-level = <2>; |
| 341 | }; | 341 | }; |
| 342 | 342 | ||
| 343 | cpu_pw20: cpu-pw20 { | 343 | cpu_pw15: cpu-pw15 { |
| 344 | compatible = "arm,idle-state"; | 344 | compatible = "arm,idle-state"; |
| 345 | idle-state-name = "PW20"; | 345 | idle-state-name = "PW15"; |
| 346 | arm,psci-suspend-param = <0x0>; | 346 | arm,psci-suspend-param = <0x0>; |
| 347 | entry-latency-us = <2000>; | 347 | entry-latency-us = <2000>; |
| 348 | exit-latency-us = <2000>; | 348 | exit-latency-us = <2000>; |
| @@ -694,7 +694,7 @@ · 693 unmodified lines | |||
| 694 | compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc"; | 694 | compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc"; |
| 695 | reg = <0x30b40000 0x10000>; | 695 | reg = <0x30b40000 0x10000>; |
| 696 | interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; | 696 | interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; |
| 697 | clocks = <&clk IMX8MM_CLK_DUMMY>, | 697 | clocks = <&clk IMX8MM_CLK_IPG_ROOT>, |
| 698 | <&clk IMX8MM_CLK_NAND_USDHC_BUS>, | 698 | <&clk IMX8MM_CLK_NAND_USDHC_BUS>, |
| 699 | <&clk IMX8MM_CLK_USDHC1_ROOT>; | 699 | <&clk IMX8MM_CLK_USDHC1_ROOT>; |
| 700 | clock-names = "ipg", "ahb", "per"; | 700 | clock-names = "ipg", "ahb", "per"; |
| @@ -710,7 +710,7 @@ · 9 unmodified lines | |||
| 710 | compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc"; | 710 | compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc"; |
| 711 | reg = <0x30b50000 0x10000>; | 711 | reg = <0x30b50000 0x10000>; |
| 712 | interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; | 712 | interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; |
| 713 | clocks = <&clk IMX8MM_CLK_DUMMY>, | 713 | clocks = <&clk IMX8MM_CLK_IPG_ROOT>, |
| 714 | <&clk IMX8MM_CLK_NAND_USDHC_BUS>, | 714 | <&clk IMX8MM_CLK_NAND_USDHC_BUS>, |
| 715 | <&clk IMX8MM_CLK_USDHC2_ROOT>; | 715 | <&clk IMX8MM_CLK_USDHC2_ROOT>; |
| 716 | clock-names = "ipg", "ahb", "per"; | 716 | clock-names = "ipg", "ahb", "per"; |
| @@ -724,7 +724,7 @@ · 7 unmodified lines | |||
| 724 | compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc"; | 724 | compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc"; |
| 725 | reg = <0x30b60000 0x10000>; | 725 | reg = <0x30b60000 0x10000>; |
| 726 | interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; | 726 | interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; |
| 727 | clocks = <&clk IMX8MM_CLK_DUMMY>, | 727 | clocks = <&clk IMX8MM_CLK_IPG_ROOT>, |
| 728 | <&clk IMX8MM_CLK_NAND_USDHC_BUS>, | 728 | <&clk IMX8MM_CLK_NAND_USDHC_BUS>, |
| 729 | <&clk IMX8MM_CLK_USDHC3_ROOT>; | 729 | <&clk IMX8MM_CLK_USDHC3_ROOT>; |
| 730 | clock-names = "ipg", "ahb", "per"; | 730 | clock-names = "ipg", "ahb", "per"; |
| @@ -569,7 +569,7 @@ · 568 unmodified lines | |||
| 569 | compatible = "fsl,imx8mn-usdhc", "fsl,imx7d-usdhc"; | 569 | compatible = "fsl,imx8mn-usdhc", "fsl,imx7d-usdhc"; |
| 570 | reg = <0x30b40000 0x10000>; | 570 | reg = <0x30b40000 0x10000>; |
| 571 | interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; | 571 | interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; |
| 572 | clocks = <&clk IMX8MN_CLK_DUMMY>, | 572 | clocks = <&clk IMX8MN_CLK_IPG_ROOT>, |
| 573 | <&clk IMX8MN_CLK_NAND_USDHC_BUS>, | 573 | <&clk IMX8MN_CLK_NAND_USDHC_BUS>, |
| 574 | <&clk IMX8MN_CLK_USDHC1_ROOT>; | 574 | <&clk IMX8MN_CLK_USDHC1_ROOT>; |
| 575 | clock-names = "ipg", "ahb", "per"; | 575 | clock-names = "ipg", "ahb", "per"; |
| @@ -585,7 +585,7 @@ · 9 unmodified lines | |||
| 585 | compatible = "fsl,imx8mn-usdhc", "fsl,imx7d-usdhc"; | 585 | compatible = "fsl,imx8mn-usdhc", "fsl,imx7d-usdhc"; |
| 586 | reg = <0x30b50000 0x10000>; | 586 | reg = <0x30b50000 0x10000>; |
| 587 | interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; | 587 | interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; |
| 588 | clocks = <&clk IMX8MN_CLK_DUMMY>, | 588 | clocks = <&clk IMX8MN_CLK_IPG_ROOT>, |
| 589 | <&clk IMX8MN_CLK_NAND_USDHC_BUS>, | 589 | <&clk IMX8MN_CLK_NAND_USDHC_BUS>, |
| 590 | <&clk IMX8MN_CLK_USDHC2_ROOT>; | 590 | <&clk IMX8MN_CLK_USDHC2_ROOT>; |
| 591 | clock-names = "ipg", "ahb", "per"; | 591 | clock-names = "ipg", "ahb", "per"; |
| @@ -599,7 +599,7 @@ · 7 unmodified lines | |||
| 599 | compatible = "fsl,imx8mn-usdhc", "fsl,imx7d-usdhc"; | 599 | compatible = "fsl,imx8mn-usdhc", "fsl,imx7d-usdhc"; |
| 600 | reg = <0x30b60000 0x10000>; | 600 | reg = <0x30b60000 0x10000>; |
| 601 | interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; | 601 | interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>; |
| 602 | clocks = <&clk IMX8MN_CLK_DUMMY>, | 602 | clocks = <&clk IMX8MN_CLK_IPG_ROOT>, |
| 603 | <&clk IMX8MN_CLK_NAND_USDHC_BUS>, | 603 | <&clk IMX8MN_CLK_NAND_USDHC_BUS>, |
| 604 | <&clk IMX8MN_CLK_USDHC3_ROOT>; | 604 | <&clk IMX8MN_CLK_USDHC3_ROOT>; |
| 605 | clock-names = "ipg", "ahb", "per"; | 605 | clock-names = "ipg", "ahb", "per"; |
| @@ -89,8 +89,8 @@ · 88 unmodified lines | |||
| 89 | regulator-min-microvolt = <900000>; | 89 | regulator-min-microvolt = <900000>; |
| 90 | regulator-max-microvolt = <1000000>; | 90 | regulator-max-microvolt = <1000000>; |
| 91 | gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; | 91 | gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>; |
| 92 | states = <1000000 0x0 | 92 | states = <1000000 0x1 |
| 93 | 900000 0x1>; | 93 | 900000 0x0>; |
| 94 | regulator-always-on; | 94 | regulator-always-on; |
| 95 | }; | 95 | }; |
| 96 | }; | 96 | }; |
| @@ -850,7 +850,7 @@ · 849 unmodified lines | |||
| 850 | "fsl,imx7d-usdhc"; | 850 | "fsl,imx7d-usdhc"; |
| 851 | reg = <0x30b40000 0x10000>; | 851 | reg = <0x30b40000 0x10000>; |
| 852 | interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; | 852 | interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>; |
| 853 | clocks = <&clk IMX8MQ_CLK_DUMMY>, | 853 | clocks = <&clk IMX8MQ_CLK_IPG_ROOT>, |
| 854 | <&clk IMX8MQ_CLK_NAND_USDHC_BUS>, | 854 | <&clk IMX8MQ_CLK_NAND_USDHC_BUS>, |
| 855 | <&clk IMX8MQ_CLK_USDHC1_ROOT>; | 855 | <&clk IMX8MQ_CLK_USDHC1_ROOT>; |
| 856 | clock-names = "ipg", "ahb", "per"; | 856 | clock-names = "ipg", "ahb", "per"; |
| @@ -867,7 +867,7 @@ · 10 unmodified lines | |||
| 867 | "fsl,imx7d-usdhc"; | 867 | "fsl,imx7d-usdhc"; |
| 868 | reg = <0x30b50000 0x10000>; | 868 | reg = <0x30b50000 0x10000>; |
| 869 | interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; | 869 | interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; |
| 870 | clocks = <&clk IMX8MQ_CLK_DUMMY>, | 870 | clocks = <&clk IMX8MQ_CLK_IPG_ROOT>, |
| 871 | <&clk IMX8MQ_CLK_NAND_USDHC_BUS>, | 871 | <&clk IMX8MQ_CLK_NAND_USDHC_BUS>, |
| 872 | <&clk IMX8MQ_CLK_USDHC2_ROOT>; | 872 | <&clk IMX8MQ_CLK_USDHC2_ROOT>; |
| 873 | clock-names = "ipg", "ahb", "per"; | 873 | clock-names = "ipg", "ahb", "per"; |
| @@ -60,11 +60,6 @@ · 59 unmodified lines | |||
| 60 | gpio = <&gpiosb 0 GPIO_ACTIVE_HIGH>; | 60 | gpio = <&gpiosb 0 GPIO_ACTIVE_HIGH>; |
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | usb3_phy: usb3-phy { | ||
| 64 | compatible = "usb-nop-xceiv"; | ||
| 65 | vcc-supply = <&exp_usb3_vbus>; | ||
| 66 | }; | ||
| 67 | |||
| 68 | vsdc_reg: vsdc-reg { | 63 | vsdc_reg: vsdc-reg { |
| 69 | compatible = "regulator-gpio"; | 64 | compatible = "regulator-gpio"; |
| 70 | regulator-name = "vsdc"; | 65 | regulator-name = "vsdc"; |
| @@ -255,10 +250,16 @@ · 184 unmodified lines | |||
| 255 | status = "okay"; | 250 | status = "okay"; |
| 256 | }; | 251 | }; |
| 257 | 252 | ||
| 253 | &comphy2 { | ||
| 254 | connector { | ||
| 255 | compatible = "usb-a-connector"; | ||
| 256 | phy-supply = <&exp_usb3_vbus>; | ||
| 257 | }; | ||
| 258 | }; | ||
| 259 | |||
| 258 | &usb3 { | 260 | &usb3 { |
| 259 | status = "okay"; | 261 | status = "okay"; |
| 260 | phys = <&comphy2 0>; | 262 | phys = <&comphy2 0>; |
| 261 | usb-phy = <&usb3_phy>; | ||
| 262 | }; | 263 | }; |
| 263 | 264 | ||
| 264 | &mdio { | 265 | &mdio { |
| @@ -44,7 +44,7 @@ · 43 unmodified lines | |||
| 44 | power-supply = <&pp3300_disp>; | 44 | power-supply = <&pp3300_disp>; |
| 45 | 45 | ||
| 46 | panel-timing { | 46 | panel-timing { |
| 47 | clock-frequency = <266604720>; | 47 | clock-frequency = <266666667>; |
| 48 | hactive = <2400>; | 48 | hactive = <2400>; |
| 49 | hfront-porch = <48>; | 49 | hfront-porch = <48>; |
| 50 | hback-porch = <84>; | 50 | hback-porch = <84>; |
| @@ -644,7 +644,7 @@ · 643 unmodified lines | |||
| 644 | status = "okay"; | 644 | status = "okay"; |
| 645 | 645 | ||
| 646 | u2phy0_host: host-port { | 646 | u2phy0_host: host-port { |
| 647 | phy-supply = <&vcc5v0_host>; | 647 | phy-supply = <&vcc5v0_typec>; |
| 648 | status = "okay"; | 648 | status = "okay"; |
| 649 | }; | 649 | }; |
| 650 | 650 | ||
| @@ -712,7 +712,7 @@ · 61 unmodified lines | |||
| 712 | 712 | ||
| 713 | &usbdrd_dwc3_0 { | 713 | &usbdrd_dwc3_0 { |
| 714 | status = "okay"; | 714 | status = "okay"; |
| 715 | dr_mode = "otg"; | 715 | dr_mode = "host"; |
| 716 | }; | 716 | }; |
| 717 | 717 | ||
| 718 | &usbdrd3_1 { | 718 | &usbdrd3_1 { |
| @@ -173,7 +173,7 @@ · 172 unmodified lines | |||
| 173 | regulator-always-on; | 173 | regulator-always-on; |
| 174 | regulator-boot-on; | 174 | regulator-boot-on; |
| 175 | regulator-min-microvolt = <800000>; | 175 | regulator-min-microvolt = <800000>; |
| 176 | regulator-max-microvolt = <1400000>; | 176 | regulator-max-microvolt = <1700000>; |
| 177 | vin-supply = <&vcc5v0_sys>; | 177 | vin-supply = <&vcc5v0_sys>; |
| 178 | }; | 178 | }; |
| 179 | }; | 179 | }; |
| @@ -247,8 +247,8 @@ · 67 unmodified lines | |||
| 247 | rk808: pmic@1b { | 247 | rk808: pmic@1b { |
| 248 | compatible = "rockchip,rk808"; | 248 | compatible = "rockchip,rk808"; |
| 249 | reg = <0x1b>; | 249 | reg = <0x1b>; |
| 250 | interrupt-parent = <&gpio1>; | 250 | interrupt-parent = <&gpio3>; |
| 251 | interrupts = <21 IRQ_TYPE_LEVEL_LOW>; | 251 | interrupts = <10 IRQ_TYPE_LEVEL_LOW>; |
| 252 | #clock-cells = <1>; | 252 | #clock-cells = <1>; |
| 253 | clock-output-names = "xin32k", "rk808-clkout2"; | 253 | clock-output-names = "xin32k", "rk808-clkout2"; |
| 254 | pinctrl-names = "default"; | 254 | pinctrl-names = "default"; |
| @@ -574,7 +574,7 @@ · 319 unmodified lines | |||
| 574 | 574 | ||
| 575 | pmic { | 575 | pmic { |
| 576 | pmic_int_l: pmic-int-l { | 576 | pmic_int_l: pmic-int-l { |
| 577 | rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; | 577 | rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; |
| 578 | }; | 578 | }; |
| 579 | 579 | ||
| 580 | vsel1_gpio: vsel1-gpio { | 580 | vsel1_gpio: vsel1-gpio { |
| @@ -624,7 +624,6 @@ · 43 unmodified lines | |||
| 624 | 624 | ||
| 625 | &sdmmc { | 625 | &sdmmc { |
| 626 | bus-width = <4>; | 626 | bus-width = <4>; |
| 627 | cap-mmc-highspeed; | ||
| 628 | cap-sd-highspeed; | 627 | cap-sd-highspeed; |
| 629 | cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; | 628 | cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; |
| 630 | disable-wp; | 629 | disable-wp; |
| @@ -636,8 +635,7 @@ · 5 unmodified lines | |||
| 636 | 635 | ||
| 637 | &sdhci { | 636 | &sdhci { |
| 638 | bus-width = <8>; | 637 | bus-width = <8>; |
| 639 | mmc-hs400-1_8v; | 638 | mmc-hs200-1_8v; |
| 640 | mmc-hs400-enhanced-strobe; | ||
| 641 | non-removable; | 639 | non-removable; |
| 642 | status = "okay"; | 640 | status = "okay"; |
| 643 | }; | 641 | }; |
| @@ -78,10 +78,9 @@ alternative_else_nop_endif · 77 unmodified lines | |||
| 78 | /* | 78 | /* |
| 79 | * Remove the address tag from a virtual address, if present. | 79 | * Remove the address tag from a virtual address, if present. |
| 80 | */ | 80 | */ |
| 81 | .macro clear_address_tag, dst, addr | 81 | .macro untagged_addr, dst, addr |
| 82 | tst \addr, #(1 << 55) | 82 | sbfx \dst, \addr, #0, #56 |
| 83 | bic \dst, \addr, #(0xff << 56) | 83 | and \dst, \dst, \addr |
| 84 | csel \dst, \dst, \addr, eq | ||
| 85 | .endm | 84 | .endm |
| 86 | 85 | ||
| 87 | #endif | 86 | #endif |
| @@ -52,7 +52,9 @@ · 51 unmodified lines | |||
| 52 | #define ARM64_HAS_IRQ_PRIO_MASKING 42 | 52 | #define ARM64_HAS_IRQ_PRIO_MASKING 42 |
| 53 | #define ARM64_HAS_DCPODP 43 | 53 | #define ARM64_HAS_DCPODP 43 |
| 54 | #define ARM64_WORKAROUND_1463225 44 | 54 | #define ARM64_WORKAROUND_1463225 44 |
| 55 | #define ARM64_WORKAROUND_CAVIUM_TX2_219_TVM 45 | ||
| 56 | #define ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM 46 | ||
| 55 | 57 | ||
| 56 | #define ARM64_NCAPS 45 | 58 | #define ARM64_NCAPS 47 |
| 57 | 59 | ||
| 58 | #endif /* __ASM_CPUCAPS_H */ | 60 | #endif /* __ASM_CPUCAPS_H */ |
| @@ -215,12 +215,18 @@ static inline unsigned long kaslr_offset(void) · 214 unmodified lines | |||
| 215 | * up with a tagged userland pointer. Clear the tag to get a sane pointer to | 215 | * up with a tagged userland pointer. Clear the tag to get a sane pointer to |
| 216 | * pass on to access_ok(), for instance. | 216 | * pass on to access_ok(), for instance. |
| 217 | */ | 217 | */ |
| 218 | #define untagged_addr(addr) \ | 218 | #define __untagged_addr(addr) \ |
| 219 | ((__force __typeof__(addr))sign_extend64((__force u64)(addr), 55)) | 219 | ((__force __typeof__(addr))sign_extend64((__force u64)(addr), 55)) |
| 220 | 220 | ||
| 221 | #define untagged_addr(addr) ({ \ | ||
| 222 | u64 __addr = (__force u64)addr; \ | ||
| 223 | __addr &= __untagged_addr(__addr); \ | ||
| 224 | (__force __typeof__(addr))__addr; \ | ||
| 225 | }) | ||
| 226 | |||
| 221 | #ifdef CONFIG_KASAN_SW_TAGS | 227 | #ifdef CONFIG_KASAN_SW_TAGS |
| 222 | #define __tag_shifted(tag) ((u64)(tag) << 56) | 228 | #define __tag_shifted(tag) ((u64)(tag) << 56) |
| 223 | #define __tag_reset(addr) untagged_addr(addr) | 229 | #define __tag_reset(addr) __untagged_addr(addr) |
| 224 | #define __tag_get(addr) (__u8)((u64)(addr) >> 56) | 230 | #define __tag_get(addr) (__u8)((u64)(addr) >> 56) |
| 225 | #else | 231 | #else |
| 226 | #define __tag_shifted(tag) 0UL | 232 | #define __tag_shifted(tag) 0UL |
| @@ -876,9 +876,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, · 875 unmodified lines | |||
| 876 | 876 | ||
| 877 | #define update_mmu_cache_pmd(vma, address, pmd) do { } while (0) | 877 | #define update_mmu_cache_pmd(vma, address, pmd) do { } while (0) |
| 878 | 878 | ||
| 879 | #define kc_vaddr_to_offset(v) ((v) & ~PAGE_END) | ||
| 880 | #define kc_offset_to_vaddr(o) ((o) | PAGE_END) | ||
| 881 | |||
| 882 | #ifdef CONFIG_ARM64_PA_BITS_52 | 879 | #ifdef CONFIG_ARM64_PA_BITS_52 |
| 883 | #define phys_to_ttbr(addr) (((addr) | ((addr) >> 46)) & TTBR_BADDR_MASK_52) | 880 | #define phys_to_ttbr(addr) (((addr) | ((addr) >> 46)) & TTBR_BADDR_MASK_52) |
| 884 | #else | 881 | #else |
| @@ -212,7 +212,7 @@ · 211 unmodified lines | |||
| 212 | #define SYS_FAR_EL1 sys_reg(3, 0, 6, 0, 0) | 212 | #define SYS_FAR_EL1 sys_reg(3, 0, 6, 0, 0) |
| 213 | #define SYS_PAR_EL1 sys_reg(3, 0, 7, 4, 0) | 213 | #define SYS_PAR_EL1 sys_reg(3, 0, 7, 4, 0) |
| 214 | 214 | ||
| 215 | #define SYS_PAR_EL1_F BIT(1) | 215 | #define SYS_PAR_EL1_F BIT(0) |
| 216 | #define SYS_PAR_EL1_FST GENMASK(6, 1) | 216 | #define SYS_PAR_EL1_FST GENMASK(6, 1) |
| 217 | 217 | ||
| 218 | /*** Statistical Profiling Extension ***/ | 218 | /*** Statistical Profiling Extension ***/ |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <asm/cpu.h> | 12 | #include <asm/cpu.h> |
| 13 | #include <asm/cputype.h> | 13 | #include <asm/cputype.h> |
| 14 | #include <asm/cpufeature.h> | 14 | #include <asm/cpufeature.h> |
| 15 | #include <asm/smp_plat.h> | ||
| 15 | 16 | ||
| 16 | static bool __maybe_unused | 17 | static bool __maybe_unused |
| 17 | is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope) | 18 | is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope) |
| @@ -623,6 +624,30 @@ check_branch_predictor(const struct arm64_cpu_capabilities *entry, int scope) · 605 unmodified lines | |||
| 623 | return (need_wa > 0); | 624 | return (need_wa > 0); |
| 624 | } | 625 | } |
| 625 | 626 | ||
| 627 | static const __maybe_unused struct midr_range tx2_family_cpus[] = { | ||
| 628 | MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN), | ||
| 629 | MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2), | ||
| 630 | {}, | ||
| 631 | }; | ||
| 632 | |||
| 633 | static bool __maybe_unused | ||
| 634 | needs_tx2_tvm_workaround(const struct arm64_cpu_capabilities *entry, | ||
| 635 | int scope) | ||
| 636 | { | ||
| 637 | int i; | ||
| 638 | |||
| 639 | if (!is_affected_midr_range_list(entry, scope) || | ||
| 640 | !is_hyp_mode_available()) | ||
| 641 | return false; | ||
| 642 | |||
| 643 | for_each_possible_cpu(i) { | ||
| 644 | if (MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0) != 0) | ||
| 645 | return true; | ||
| 646 | } | ||
| 647 | |||
| 648 | return false; | ||
| 649 | } | ||
| 650 | |||
| 626 | #ifdef CONFIG_HARDEN_EL2_VECTORS | 651 | #ifdef CONFIG_HARDEN_EL2_VECTORS |
| 627 | 652 | ||
| 628 | static const struct midr_range arm64_harden_el2_vectors[] = { | 653 | static const struct midr_range arm64_harden_el2_vectors[] = { |
| @@ -851,6 +876,19 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 222 unmodified lines | |||
| 851 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, | 876 | .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
| 852 | .matches = has_cortex_a76_erratum_1463225, | 877 | .matches = has_cortex_a76_erratum_1463225, |
| 853 | }, | 878 | }, |
| 879 | #endif | ||
| 880 | #ifdef CONFIG_CAVIUM_TX2_ERRATUM_219 | ||
| 881 | { | ||
| 882 | .desc = "Cavium ThunderX2 erratum 219 (KVM guest sysreg trapping)", | ||
| 883 | .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_TVM, | ||
| 884 | ERRATA_MIDR_RANGE_LIST(tx2_family_cpus), | ||
| 885 | .matches = needs_tx2_tvm_workaround, | ||
| 886 | }, | ||
| 887 | { | ||
| 888 | .desc = "Cavium ThunderX2 erratum 219 (PRFM removal)", | ||
| 889 | .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM, | ||
| 890 | ERRATA_MIDR_RANGE_LIST(tx2_family_cpus), | ||
| 891 | }, | ||
| 854 | #endif | 892 | #endif |
| 855 | { | 893 | { |
| 856 | } | 894 | } |
| @@ -176,11 +176,16 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr1[] = { · 175 unmodified lines | |||
| 176 | }; | 176 | }; |
| 177 | 177 | ||
| 178 | static const struct arm64_ftr_bits ftr_id_aa64zfr0[] = { | 178 | static const struct arm64_ftr_bits ftr_id_aa64zfr0[] = { |
| 179 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SM4_SHIFT, 4, 0), | 179 | ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE), |
| 180 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SHA3_SHIFT, 4, 0), | 180 | FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SM4_SHIFT, 4, 0), |
| 181 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_BITPERM_SHIFT, 4, 0), | 181 | ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE), |
| 182 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_AES_SHIFT, 4, 0), | 182 | FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SHA3_SHIFT, 4, 0), |
| 183 | ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SVEVER_SHIFT, 4, 0), | 183 | ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE), |
| 184 | FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_BITPERM_SHIFT, 4, 0), | ||
| 185 | ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE), | ||
| 186 | FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_AES_SHIFT, 4, 0), | ||
| 187 | ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE), | ||
| 188 | FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SVEVER_SHIFT, 4, 0), | ||
| 184 | ARM64_FTR_END, | 189 | ARM64_FTR_END, |
| 185 | }; | 190 | }; |
| 186 | 191 | ||
| @@ -604,7 +604,7 @@ el1_da: · 603 unmodified lines | |||
| 604 | */ | 604 | */ |
| 605 | mrs x3, far_el1 | 605 | mrs x3, far_el1 |
| 606 | inherit_daif pstate=x23, tmp=x2 | 606 | inherit_daif pstate=x23, tmp=x2 |
| 607 | clear_address_tag x0, x3 | 607 | untagged_addr x0, x3 |
| 608 | mov x2, sp // struct pt_regs | 608 | mov x2, sp // struct pt_regs |
| 609 | bl do_mem_abort | 609 | bl do_mem_abort |
| 610 | 610 | ||
| @@ -680,7 +680,7 @@ alternative_if ARM64_HAS_IRQ_PRIO_MASKING · 69 unmodified lines | |||
| 680 | orr x24, x24, x0 | 680 | orr x24, x24, x0 |
| 681 | alternative_else_nop_endif | 681 | alternative_else_nop_endif |
| 682 | cbnz x24, 1f // preempt count != 0 || NMI return path | 682 | cbnz x24, 1f // preempt count != 0 || NMI return path |
| 683 | bl preempt_schedule_irq // irq en/disable is done inside | 683 | bl arm64_preempt_schedule_irq // irq en/disable is done inside |
| 684 | 1: | 684 | 1: |
| 685 | #endif | 685 | #endif |
| 686 | 686 | ||
| @@ -808,7 +808,7 @@ el0_da: · 121 unmodified lines | |||
| 808 | mrs x26, far_el1 | 808 | mrs x26, far_el1 |
| 809 | ct_user_exit_irqoff | 809 | ct_user_exit_irqoff |
| 810 | enable_daif | 810 | enable_daif |
| 811 | clear_address_tag x0, x26 | 811 | untagged_addr x0, x26 |
| 812 | mov x1, x25 | 812 | mov x1, x25 |
| 813 | mov x2, sp | 813 | mov x2, sp |
| 814 | bl do_mem_abort | 814 | bl do_mem_abort |
| @@ -1071,7 +1071,9 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003 · 256 unmodified lines | |||
| 1071 | #else | 1071 | #else |
| 1072 | ldr x30, =vectors | 1072 | ldr x30, =vectors |
| 1073 | #endif | 1073 | #endif |
| 1074 | alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM | ||
| 1074 | prfm plil1strm, [x30, #(1b - tramp_vectors)] | 1075 | prfm plil1strm, [x30, #(1b - tramp_vectors)] |
| 1076 | alternative_else_nop_endif | ||
| 1075 | msr vbar_el1, x30 | 1077 | msr vbar_el1, x30 |
| 1076 | add x30, x30, #(1b - tramp_vectors) | 1078 | add x30, x30, #(1b - tramp_vectors) |
| 1077 | isb | 1079 | isb |
| @@ -201,6 +201,7 @@ static int create_safe_exec_page(void *src_start, size_t length, · 200 unmodified lines | |||
| 201 | gfp_t mask) | 201 | gfp_t mask) |
| 202 | { | 202 | { |
| 203 | int rc = 0; | 203 | int rc = 0; |
| 204 | pgd_t *trans_pgd; | ||
| 204 | pgd_t *pgdp; | 205 | pgd_t *pgdp; |
| 205 | pud_t *pudp; | 206 | pud_t *pudp; |
| 206 | pmd_t *pmdp; | 207 | pmd_t *pmdp; |
| @@ -215,7 +216,13 @@ static int create_safe_exec_page(void *src_start, size_t length, · 8 unmodified lines | |||
| 215 | memcpy((void *)dst, src_start, length); | 216 | memcpy((void *)dst, src_start, length); |
| 216 | __flush_icache_range(dst, dst + length); | 217 | __flush_icache_range(dst, dst + length); |
| 217 | 218 | ||
| 218 | pgdp = pgd_offset_raw(allocator(mask), dst_addr); | 219 | trans_pgd = allocator(mask); |
| 220 | if (!trans_pgd) { | ||
| 221 | rc = -ENOMEM; | ||
| 222 | goto out; | ||
| 223 | } | ||
| 224 | |||
| 225 | pgdp = pgd_offset_raw(trans_pgd, dst_addr); | ||
| 219 | if (pgd_none(READ_ONCE(*pgdp))) { | 226 | if (pgd_none(READ_ONCE(*pgdp))) { |
| 220 | pudp = allocator(mask); | 227 | pudp = allocator(mask); |
| 221 | if (!pudp) { | 228 | if (!pudp) { |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | #include <linux/sched/task.h> | 17 | #include <linux/sched/task.h> |
| 18 | #include <linux/sched/task_stack.h> | 18 | #include <linux/sched/task_stack.h> |
| 19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| 20 | #include <linux/lockdep.h> | ||
| 20 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
| 21 | #include <linux/stddef.h> | 22 | #include <linux/stddef.h> |
| 22 | #include <linux/sysctl.h> | 23 | #include <linux/sysctl.h> |
| @@ -44,6 +45,7 @@ · 21 unmodified lines | |||
| 44 | #include <asm/alternative.h> | 45 | #include <asm/alternative.h> |
| 45 | #include <asm/arch_gicv3.h> | 46 | #include <asm/arch_gicv3.h> |
| 46 | #include <asm/compat.h> | 47 | #include <asm/compat.h> |
| 48 | #include <asm/cpufeature.h> | ||
| 47 | #include <asm/cacheflush.h> | 49 | #include <asm/cacheflush.h> |
| 48 | #include <asm/exec.h> | 50 | #include <asm/exec.h> |
| 49 | #include <asm/fpsimd.h> | 51 | #include <asm/fpsimd.h> |
| @@ -631,3 +633,19 @@ static int __init tagged_addr_init(void) · 581 unmodified lines | |||
| 631 | 633 | ||
| 632 | core_initcall(tagged_addr_init); | 634 | core_initcall(tagged_addr_init); |
| 633 | #endif /* CONFIG_ARM64_TAGGED_ADDR_ABI */ | 635 | #endif /* CONFIG_ARM64_TAGGED_ADDR_ABI */ |
| 636 | |||
| 637 | asmlinkage void __sched arm64_preempt_schedule_irq(void) | ||
| 638 | { | ||
| 639 | lockdep_assert_irqs_disabled(); | ||
| 640 | |||
| 641 | /* | ||
| 642 | * Preempting a task from an IRQ means we leave copies of PSTATE | ||
| 643 | * on the stack. cpufeature's enable calls may modify PSTATE, but | ||
| 644 | * resuming one of these preempted tasks would undo those changes. | ||
| 645 | * | ||
| 646 | * Only allow a task to be preempted once cpufeatures have been | ||
| 647 | * enabled. | ||
| 648 | */ | ||
| 649 | if (static_branch_likely(&arm64_const_caps_ready)) | ||
| 650 | preempt_schedule_irq(); | ||
| 651 | } | ||
| @@ -124,6 +124,9 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu) · 123 unmodified lines | |||
| 124 | { | 124 | { |
| 125 | u64 hcr = vcpu->arch.hcr_el2; | 125 | u64 hcr = vcpu->arch.hcr_el2; |
| 126 | 126 | ||
| 127 | if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM)) | ||
| 128 | hcr |= HCR_TVM; | ||
| 129 | |||
| 127 | write_sysreg(hcr, hcr_el2); | 130 | write_sysreg(hcr, hcr_el2); |
| 128 | 131 | ||
| 129 | if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN) && (hcr & HCR_VSE)) | 132 | if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN) && (hcr & HCR_VSE)) |
| @@ -174,8 +177,10 @@ static void __hyp_text __deactivate_traps(struct kvm_vcpu *vcpu) · 44 unmodified lines | |||
| 174 | * the crucial bit is "On taking a vSError interrupt, | 177 | * the crucial bit is "On taking a vSError interrupt, |
| 175 | * HCR_EL2.VSE is cleared to 0." | 178 | * HCR_EL2.VSE is cleared to 0." |
| 176 | */ | 179 | */ |
| 177 | if (vcpu->arch.hcr_el2 & HCR_VSE) | 180 | if (vcpu->arch.hcr_el2 & HCR_VSE) { |
| 178 | vcpu->arch.hcr_el2 = read_sysreg(hcr_el2); | 181 | vcpu->arch.hcr_el2 &= ~HCR_VSE; |
| 182 | vcpu->arch.hcr_el2 |= read_sysreg(hcr_el2) & HCR_VSE; | ||
| 183 | } | ||
| 179 | 184 | ||
| 180 | if (has_vhe()) | 185 | if (has_vhe()) |
| 181 | deactivate_traps_vhe(); | 186 | deactivate_traps_vhe(); |
| @@ -380,6 +385,61 @@ static bool __hyp_text __hyp_handle_fpsimd(struct kvm_vcpu *vcpu) · 198 unmodified lines | |||
| 380 | return true; | 385 | return true; |
| 381 | } | 386 | } |
| 382 | 387 | ||
| 388 | static bool __hyp_text handle_tx2_tvm(struct kvm_vcpu *vcpu) | ||
| 389 | { | ||
| 390 | u32 sysreg = esr_sys64_to_sysreg(kvm_vcpu_get_hsr(vcpu)); | ||
| 391 | int rt = kvm_vcpu_sys_get_rt(vcpu); | ||
| 392 | u64 val = vcpu_get_reg(vcpu, rt); | ||
| 393 | |||
| 394 | /* | ||
| 395 | * The normal sysreg handling code expects to see the traps, | ||
| 396 | * let's not do anything here. | ||
| 397 | */ | ||
| 398 | if (vcpu->arch.hcr_el2 & HCR_TVM) | ||
| 399 | return false; | ||
| 400 | |||
| 401 | switch (sysreg) { | ||
| 402 | case SYS_SCTLR_EL1: | ||
| 403 | write_sysreg_el1(val, SYS_SCTLR); | ||
| 404 | break; | ||
| 405 | case SYS_TTBR0_EL1: | ||
| 406 | write_sysreg_el1(val, SYS_TTBR0); | ||
| 407 | break; | ||
| 408 | case SYS_TTBR1_EL1: | ||
| 409 | write_sysreg_el1(val, SYS_TTBR1); | ||
| 410 | break; | ||
| 411 | case SYS_TCR_EL1: | ||
| 412 | write_sysreg_el1(val, SYS_TCR); | ||
| 413 | break; | ||
| 414 | case SYS_ESR_EL1: | ||
| 415 | write_sysreg_el1(val, SYS_ESR); | ||
| 416 | break; | ||
| 417 | case SYS_FAR_EL1: | ||
| 418 | write_sysreg_el1(val, SYS_FAR); | ||
| 419 | break; | ||
| 420 | case SYS_AFSR0_EL1: | ||
| 421 | write_sysreg_el1(val, SYS_AFSR0); | ||
| 422 | break; | ||
| 423 | case SYS_AFSR1_EL1: | ||
| 424 | write_sysreg_el1(val, SYS_AFSR1); | ||
| 425 | break; | ||
| 426 | case SYS_MAIR_EL1: | ||
| 427 | write_sysreg_el1(val, SYS_MAIR); | ||
| 428 | break; | ||
| 429 | case SYS_AMAIR_EL1: | ||
| 430 | write_sysreg_el1(val, SYS_AMAIR); | ||
| 431 | break; | ||
| 432 | case SYS_CONTEXTIDR_EL1: | ||
| 433 | write_sysreg_el1(val, SYS_CONTEXTIDR); | ||
| 434 | break; | ||
| 435 | default: | ||
| 436 | return false; | ||
| 437 | } | ||
| 438 | |||
| 439 | __kvm_skip_instr(vcpu); | ||
| 440 | return true; | ||
| 441 | } | ||
| 442 | |||
| 383 | /* | 443 | /* |
| 384 | * Return true when we were able to fixup the guest exit and should return to | 444 | * Return true when we were able to fixup the guest exit and should return to |
| 385 | * the guest, false when we should restore the host state and return to the | 445 | * the guest, false when we should restore the host state and return to the |
| @@ -399,6 +459,11 @@ static bool __hyp_text fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 13 unmodified lines | |||
| 399 | if (*exit_code != ARM_EXCEPTION_TRAP) | 459 | if (*exit_code != ARM_EXCEPTION_TRAP) |
| 400 | goto exit; | 460 | goto exit; |
| 401 | 461 | ||
| 462 | if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM) && | ||
| 463 | kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_SYS64 && | ||
| 464 | handle_tx2_tvm(vcpu)) | ||
| 465 | return true; | ||
| 466 | |||
| 402 | /* | 467 | /* |
| 403 | * We trap the first access to the FP/SIMD to save the host context | 468 | * We trap the first access to the FP/SIMD to save the host context |
| 404 | * and restore the guest context lazily. | 469 | * and restore the guest context lazily. |
| @@ -632,6 +632,8 @@ static void reset_pmcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) · 631 unmodified lines | |||
| 632 | */ | 632 | */ |
| 633 | val = ((pmcr & ~ARMV8_PMU_PMCR_MASK) | 633 | val = ((pmcr & ~ARMV8_PMU_PMCR_MASK) |
| 634 | | (ARMV8_PMU_PMCR_MASK & 0xdecafbad)) & (~ARMV8_PMU_PMCR_E); | 634 | | (ARMV8_PMU_PMCR_MASK & 0xdecafbad)) & (~ARMV8_PMU_PMCR_E); |
| 635 | if (!system_supports_32bit_el0()) | ||
| 636 | val |= ARMV8_PMU_PMCR_LC; | ||
| 635 | __vcpu_sys_reg(vcpu, r->reg) = val; | 637 | __vcpu_sys_reg(vcpu, r->reg) = val; |
| 636 | } | 638 | } |
| 637 | 639 | ||
| @@ -682,6 +684,8 @@ static bool access_pmcr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 44 unmodified lines | |||
| 682 | val = __vcpu_sys_reg(vcpu, PMCR_EL0); | 684 | val = __vcpu_sys_reg(vcpu, PMCR_EL0); |
| 683 | val &= ~ARMV8_PMU_PMCR_MASK; | 685 | val &= ~ARMV8_PMU_PMCR_MASK; |
| 684 | val |= p->regval & ARMV8_PMU_PMCR_MASK; | 686 | val |= p->regval & ARMV8_PMU_PMCR_MASK; |
| 687 | if (!system_supports_32bit_el0()) | ||
| 688 | val |= ARMV8_PMU_PMCR_LC; | ||
| 685 | __vcpu_sys_reg(vcpu, PMCR_EL0) = val; | 689 | __vcpu_sys_reg(vcpu, PMCR_EL0) = val; |
| 686 | kvm_pmu_handle_pmcr(vcpu, val); | 690 | kvm_pmu_handle_pmcr(vcpu, val); |
| 687 | kvm_vcpu_pmu_restore_guest(vcpu); | 691 | kvm_vcpu_pmu_restore_guest(vcpu); |
| @@ -268,8 +268,12 @@ static bool __kprobes is_spurious_el1_translation_fault(unsigned long addr, · 267 unmodified lines | |||
| 268 | par = read_sysreg(par_el1); | 268 | par = read_sysreg(par_el1); |
| 269 | local_irq_restore(flags); | 269 | local_irq_restore(flags); |
| 270 | 270 | ||
| 271 | /* | ||
| 272 | * If we now have a valid translation, treat the translation fault as | ||
| 273 | * spurious. | ||
| 274 | */ | ||
| 271 | if (!(par & SYS_PAR_EL1_F)) | 275 | if (!(par & SYS_PAR_EL1_F)) |
| 272 | return false; | 276 | return true; |
| 273 | 277 | ||
| 274 | /* | 278 | /* |
| 275 | * If we got a different type of fault from the AT instruction, | 279 | * If we got a different type of fault from the AT instruction, |
| @@ -84,7 +84,7 @@ void __init prom_init(void) · 83 unmodified lines | |||
| 84 | * Here we will start up CPU1 in the background and ask it to | 84 | * Here we will start up CPU1 in the background and ask it to |
| 85 | * reconfigure itself then go back to sleep. | 85 | * reconfigure itself then go back to sleep. |
| 86 | */ | 86 | */ |
| 87 | memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20); | 87 | memcpy((void *)0xa0000200, bmips_smp_movevec, 0x20); |
| 88 | __sync(); | 88 | __sync(); |
| 89 | set_c0_cause(C_SW0); | 89 | set_c0_cause(C_SW0); |
| 90 | cpumask_set_cpu(1, &bmips_booted_mask); | 90 | cpumask_set_cpu(1, &bmips_booted_mask); |
| @@ -75,11 +75,11 @@ static inline int register_bmips_smp_ops(void) · 74 unmodified lines | |||
| 75 | #endif | 75 | #endif |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | extern char bmips_reset_nmi_vec; | 78 | extern char bmips_reset_nmi_vec[]; |
| 79 | extern char bmips_reset_nmi_vec_end; | 79 | extern char bmips_reset_nmi_vec_end[]; |
| 80 | extern char bmips_smp_movevec; | 80 | extern char bmips_smp_movevec[]; |
| 81 | extern char bmips_smp_int_vec; | 81 | extern char bmips_smp_int_vec[]; |
| 82 | extern char bmips_smp_int_vec_end; | 82 | extern char bmips_smp_int_vec_end[]; |
| 83 | 83 | ||
| 84 | extern int bmips_smp_enabled; | 84 | extern int bmips_smp_enabled; |
| 85 | extern int bmips_cpu_offset; | 85 | extern int bmips_cpu_offset; |
| @@ -24,6 +24,8 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | #define VDSO_HAS_CLOCK_GETRES 1 | 25 | #define VDSO_HAS_CLOCK_GETRES 1 |
| 26 | 26 | ||
| 27 | #define __VDSO_USE_SYSCALL ULLONG_MAX | ||
| 28 | |||
| 27 | #ifdef CONFIG_MIPS_CLOCK_VSYSCALL | 29 | #ifdef CONFIG_MIPS_CLOCK_VSYSCALL |
| 28 | 30 | ||
| 29 | static __always_inline long gettimeofday_fallback( | 31 | static __always_inline long gettimeofday_fallback( |
| @@ -205,7 +207,7 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) · 175 unmodified lines | |||
| 205 | break; | 207 | break; |
| 206 | #endif | 208 | #endif |
| 207 | default: | 209 | default: |
| 208 | cycle_now = 0; | 210 | cycle_now = __VDSO_USE_SYSCALL; |
| 209 | break; | 211 | break; |
| 210 | } | 212 | } |
| 211 | 213 | ||
| @@ -464,10 +464,10 @@ static void bmips_wr_vec(unsigned long dst, char *start, char *end) · 463 unmodified lines | |||
| 464 | 464 | ||
| 465 | static inline void bmips_nmi_handler_setup(void) | 465 | static inline void bmips_nmi_handler_setup(void) |
| 466 | { | 466 | { |
| 467 | bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec, | 467 | bmips_wr_vec(BMIPS_NMI_RESET_VEC, bmips_reset_nmi_vec, |
| 468 | &bmips_reset_nmi_vec_end); | 468 | bmips_reset_nmi_vec_end); |
| 469 | bmips_wr_vec(BMIPS_WARM_RESTART_VEC, &bmips_smp_int_vec, | 469 | bmips_wr_vec(BMIPS_WARM_RESTART_VEC, bmips_smp_int_vec, |
| 470 | &bmips_smp_int_vec_end); | 470 | bmips_smp_int_vec_end); |
| 471 | } | 471 | } |
| 472 | 472 | ||
| 473 | struct reset_vec_info { | 473 | struct reset_vec_info { |
| @@ -653,6 +653,13 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r, · 652 unmodified lines | |||
| 653 | int restore_scratch) | 653 | int restore_scratch) |
| 654 | { | 654 | { |
| 655 | if (restore_scratch) { | 655 | if (restore_scratch) { |
| 656 | /* | ||
| 657 | * Ensure the MFC0 below observes the value written to the | ||
| 658 | * KScratch register by the prior MTC0. | ||
| 659 | */ | ||
| 660 | if (scratch_reg >= 0) | ||
| 661 | uasm_i_ehb(p); | ||
| 662 | |||
| 656 | /* Reset default page size */ | 663 | /* Reset default page size */ |
| 657 | if (PM_DEFAULT_MASK >> 16) { | 664 | if (PM_DEFAULT_MASK >> 16) { |
| 658 | uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16); | 665 | uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16); |
| @@ -667,12 +674,10 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r, · 8 unmodified lines | |||
| 667 | uasm_i_mtc0(p, 0, C0_PAGEMASK); | 674 | uasm_i_mtc0(p, 0, C0_PAGEMASK); |
| 668 | uasm_il_b(p, r, lid); | 675 | uasm_il_b(p, r, lid); |
| 669 | } | 676 | } |
| 670 | if (scratch_reg >= 0) { | 677 | if (scratch_reg >= 0) |
| 671 | uasm_i_ehb(p); | ||
| 672 | UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); | 678 | UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); |
| 673 | } else { | 679 | else |
| 674 | UASM_i_LW(p, 1, scratchpad_offset(0), 0); | 680 | UASM_i_LW(p, 1, scratchpad_offset(0), 0); |
| 675 | } | ||
| 676 | } else { | 681 | } else { |
| 677 | /* Reset default page size */ | 682 | /* Reset default page size */ |
| 678 | if (PM_DEFAULT_MASK >> 16) { | 683 | if (PM_DEFAULT_MASK >> 16) { |
| @@ -921,6 +926,10 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, · 242 unmodified lines | |||
| 921 | } | 926 | } |
| 922 | if (mode != not_refill && check_for_high_segbits) { | 927 | if (mode != not_refill && check_for_high_segbits) { |
| 923 | uasm_l_large_segbits_fault(l, *p); | 928 | uasm_l_large_segbits_fault(l, *p); |
| 929 | |||
| 930 | if (mode == refill_scratch && scratch_reg >= 0) | ||
| 931 | uasm_i_ehb(p); | ||
| 932 | |||
| 924 | /* | 933 | /* |
| 925 | * We get here if we are an xsseg address, or if we are | 934 | * We get here if we are an xsseg address, or if we are |
| 926 | * an xuseg address above (PGDIR_SHIFT+PGDIR_BITS) boundary. | 935 | * an xuseg address above (PGDIR_SHIFT+PGDIR_BITS) boundary. |
| @@ -939,12 +948,10 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, · 12 unmodified lines | |||
| 939 | uasm_i_jr(p, ptr); | 948 | uasm_i_jr(p, ptr); |
| 940 | 949 | ||
| 941 | if (mode == refill_scratch) { | 950 | if (mode == refill_scratch) { |
| 942 | if (scratch_reg >= 0) { | 951 | if (scratch_reg >= 0) |
| 943 | uasm_i_ehb(p); | ||
| 944 | UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); | 952 | UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg); |
| 945 | } else { | 953 | else |
| 946 | UASM_i_LW(p, 1, scratchpad_offset(0), 0); | 954 | UASM_i_LW(p, 1, scratchpad_offset(0), 0); |
| 947 | } | ||
| 948 | } else { | 955 | } else { |
| 949 | uasm_i_nop(p); | 956 | uasm_i_nop(p); |
| 950 | } | 957 | } |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | #define ARCH_DMA_MINALIGN L1_CACHE_BYTES | 23 | #define ARCH_DMA_MINALIGN L1_CACHE_BYTES |
| 24 | 24 | ||
| 25 | #define __read_mostly __attribute__((__section__(".data..read_mostly"))) | 25 | #define __read_mostly __section(.data..read_mostly) |
| 26 | 26 | ||
| 27 | void parisc_cache_init(void); /* initializes cache-flushing */ | 27 | void parisc_cache_init(void); /* initializes cache-flushing */ |
| 28 | void disable_sr_hashing_asm(int); /* low level support for above */ | 28 | void disable_sr_hashing_asm(int); /* low level support for above */ |
| @@ -52,7 +52,7 @@ · 51 unmodified lines | |||
| 52 | }) | 52 | }) |
| 53 | 53 | ||
| 54 | #ifdef CONFIG_SMP | 54 | #ifdef CONFIG_SMP |
| 55 | # define __lock_aligned __attribute__((__section__(".data..lock_aligned"))) | 55 | # define __lock_aligned __section(.data..lock_aligned) |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | #endif /* __PARISC_LDCW_H */ | 58 | #endif /* __PARISC_LDCW_H */ |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * arch/parisc/mm/ioremap.c | 3 | * arch/parisc/mm/ioremap.c |
| 4 | * | 4 | * |
| 5 | * (C) Copyright 1995 1996 Linus Torvalds | 5 | * (C) Copyright 1995 1996 Linus Torvalds |
| 6 | * (C) Copyright 2001-2006 Helge Deller <deller@gmx.de> | 6 | * (C) Copyright 2001-2019 Helge Deller <deller@gmx.de> |
| 7 | * (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org> | 7 | * (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org> |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| @@ -84,7 +84,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l · 74 unmodified lines | |||
| 84 | addr = (void __iomem *) area->addr; | 84 | addr = (void __iomem *) area->addr; |
| 85 | if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, | 85 | if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, |
| 86 | phys_addr, pgprot)) { | 86 | phys_addr, pgprot)) { |
| 87 | vfree(addr); | 87 | vunmap(addr); |
| 88 | return NULL; | 88 | return NULL; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| @@ -92,9 +92,11 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l · 1 unmodified line | |||
| 92 | } | 92 | } |
| 93 | EXPORT_SYMBOL(__ioremap); | 93 | EXPORT_SYMBOL(__ioremap); |
| 94 | 94 | ||
| 95 | void iounmap(const volatile void __iomem *addr) | 95 | void iounmap(const volatile void __iomem *io_addr) |
| 96 | { | 96 | { |
| 97 | if (addr > high_memory) | 97 | unsigned long addr = (unsigned long)io_addr & PAGE_MASK; |
| 98 | return vfree((void *) (PAGE_MASK & (unsigned long __force) addr)); | 98 | |
| 99 | if (is_vmalloc_addr((void *)addr)) | ||
| 100 | vunmap((void *)addr); | ||
| 99 | } | 101 | } |
| 100 | EXPORT_SYMBOL(iounmap); | 102 | EXPORT_SYMBOL(iounmap); |
| @@ -1217,6 +1217,7 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev, · 1216 unmodified lines | |||
| 1217 | struct kvmppc_xive *xive = dev->private; | 1217 | struct kvmppc_xive *xive = dev->private; |
| 1218 | struct kvmppc_xive_vcpu *xc; | 1218 | struct kvmppc_xive_vcpu *xc; |
| 1219 | int i, r = -EBUSY; | 1219 | int i, r = -EBUSY; |
| 1220 | u32 vp_id; | ||
| 1220 | 1221 | ||
| 1221 | pr_devel("connect_vcpu(cpu=%d)\n", cpu); | 1222 | pr_devel("connect_vcpu(cpu=%d)\n", cpu); |
| 1222 | 1223 | ||
| @@ -1228,25 +1229,32 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev, · 5 unmodified lines | |||
| 1228 | return -EPERM; | 1229 | return -EPERM; |
| 1229 | if (vcpu->arch.irq_type != KVMPPC_IRQ_DEFAULT) | 1230 | if (vcpu->arch.irq_type != KVMPPC_IRQ_DEFAULT) |
| 1230 | return -EBUSY; | 1231 | return -EBUSY; |
| 1231 | if (kvmppc_xive_find_server(vcpu->kvm, cpu)) { | ||
| 1232 | pr_devel("Duplicate !\n"); | ||
| 1233 | return -EEXIST; | ||
| 1234 | } | ||
| 1235 | if (cpu >= (KVM_MAX_VCPUS * vcpu->kvm->arch.emul_smt_mode)) { | 1232 | if (cpu >= (KVM_MAX_VCPUS * vcpu->kvm->arch.emul_smt_mode)) { |
| 1236 | pr_devel("Out of bounds !\n"); | 1233 | pr_devel("Out of bounds !\n"); |
| 1237 | return -EINVAL; | 1234 | return -EINVAL; |
| 1238 | } | 1235 | } |
| 1239 | xc = kzalloc(sizeof(*xc), GFP_KERNEL); | ||
| 1240 | if (!xc) | ||
| 1241 | return -ENOMEM; | ||
| 1242 | 1236 | ||
| 1243 | /* We need to synchronize with queue provisioning */ | 1237 | /* We need to synchronize with queue provisioning */ |
| 1244 | mutex_lock(&xive->lock); | 1238 | mutex_lock(&xive->lock); |
| 1239 | |||
| 1240 | vp_id = kvmppc_xive_vp(xive, cpu); | ||
| 1241 | if (kvmppc_xive_vp_in_use(xive->kvm, vp_id)) { | ||
| 1242 | pr_devel("Duplicate !\n"); | ||
| 1243 | r = -EEXIST; | ||
| 1244 | goto bail; | ||
| 1245 | } | ||
| 1246 | |||
| 1247 | xc = kzalloc(sizeof(*xc), GFP_KERNEL); | ||
| 1248 | if (!xc) { | ||
| 1249 | r = -ENOMEM; | ||
| 1250 | goto bail; | ||
| 1251 | } | ||
| 1252 | |||
| 1245 | vcpu->arch.xive_vcpu = xc; | 1253 | vcpu->arch.xive_vcpu = xc; |
| 1246 | xc->xive = xive; | 1254 | xc->xive = xive; |
| 1247 | xc->vcpu = vcpu; | 1255 | xc->vcpu = vcpu; |
| 1248 | xc->server_num = cpu; | 1256 | xc->server_num = cpu; |
| 1249 | xc->vp_id = kvmppc_xive_vp(xive, cpu); | 1257 | xc->vp_id = vp_id; |
| 1250 | xc->mfrr = 0xff; | 1258 | xc->mfrr = 0xff; |
| 1251 | xc->valid = true; | 1259 | xc->valid = true; |
| 1252 | 1260 | ||
| @@ -220,6 +220,18 @@ static inline u32 kvmppc_xive_vp(struct kvmppc_xive *xive, u32 server) · 219 unmodified lines | |||
| 220 | return xive->vp_base + kvmppc_pack_vcpu_id(xive->kvm, server); | 220 | return xive->vp_base + kvmppc_pack_vcpu_id(xive->kvm, server); |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | static inline bool kvmppc_xive_vp_in_use(struct kvm *kvm, u32 vp_id) | ||
| 224 | { | ||
| 225 | struct kvm_vcpu *vcpu = NULL; | ||
| 226 | int i; | ||
| 227 | |||
| 228 | kvm_for_each_vcpu(i, vcpu, kvm) { | ||
| 229 | if (vcpu->arch.xive_vcpu && vp_id == vcpu->arch.xive_vcpu->vp_id) | ||
| 230 | return true; | ||
| 231 | } | ||
| 232 | return false; | ||
| 233 | } | ||
| 234 | |||
| 223 | /* | 235 | /* |
| 224 | * Mapping between guest priorities and host priorities | 236 | * Mapping between guest priorities and host priorities |
| 225 | * is as follow. | 237 | * is as follow. |
| @@ -106,6 +106,7 @@ int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, · 105 unmodified lines | |||
| 106 | struct kvmppc_xive *xive = dev->private; | 106 | struct kvmppc_xive *xive = dev->private; |
| 107 | struct kvmppc_xive_vcpu *xc = NULL; | 107 | struct kvmppc_xive_vcpu *xc = NULL; |
| 108 | int rc; | 108 | int rc; |
| 109 | u32 vp_id; | ||
| 109 | 110 | ||
| 110 | pr_devel("native_connect_vcpu(server=%d)\n", server_num); | 111 | pr_devel("native_connect_vcpu(server=%d)\n", server_num); |
| 111 | 112 | ||
| @@ -124,7 +125,8 @@ int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, · 12 unmodified lines | |||
| 124 | 125 | ||
| 125 | mutex_lock(&xive->lock); | 126 | mutex_lock(&xive->lock); |
| 126 | 127 | ||
| 127 | if (kvmppc_xive_find_server(vcpu->kvm, server_num)) { | 128 | vp_id = kvmppc_xive_vp(xive, server_num); |
| 129 | if (kvmppc_xive_vp_in_use(xive->kvm, vp_id)) { | ||
| 128 | pr_devel("Duplicate !\n"); | 130 | pr_devel("Duplicate !\n"); |
| 129 | rc = -EEXIST; | 131 | rc = -EEXIST; |
| 130 | goto bail; | 132 | goto bail; |
| @@ -141,7 +143,7 @@ int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, · 10 unmodified lines | |||
| 141 | xc->vcpu = vcpu; | 143 | xc->vcpu = vcpu; |
| 142 | xc->server_num = server_num; | 144 | xc->server_num = server_num; |
| 143 | 145 | ||
| 144 | xc->vp_id = kvmppc_xive_vp(xive, server_num); | 146 | xc->vp_id = vp_id; |
| 145 | xc->valid = true; | 147 | xc->valid = true; |
| 146 | vcpu->arch.irq_type = KVMPPC_IRQ_XIVE; | 148 | vcpu->arch.irq_type = KVMPPC_IRQ_XIVE; |
| 147 | 149 | ||
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | compatible = "sifive,hifive-unleashed-a00", "sifive,fu540-c000"; | 13 | compatible = "sifive,hifive-unleashed-a00", "sifive,fu540-c000"; |
| 14 | 14 | ||
| 15 | chosen { | 15 | chosen { |
| 16 | stdout-path = "serial0"; | ||
| 16 | }; | 17 | }; |
| 17 | 18 | ||
| 18 | cpus { | 19 | cpus { |
| @@ -12,7 +12,6 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | #include <asm/asm.h> | 13 | #include <asm/asm.h> |
| 14 | 14 | ||
| 15 | #ifdef CONFIG_GENERIC_BUG | ||
| 16 | #define __INSN_LENGTH_MASK _UL(0x3) | 15 | #define __INSN_LENGTH_MASK _UL(0x3) |
| 17 | #define __INSN_LENGTH_32 _UL(0x3) | 16 | #define __INSN_LENGTH_32 _UL(0x3) |
| 18 | #define __COMPRESSED_INSN_MASK _UL(0xffff) | 17 | #define __COMPRESSED_INSN_MASK _UL(0xffff) |
| @@ -20,7 +19,6 @@ · 1 unmodified line | |||
| 20 | #define __BUG_INSN_32 _UL(0x00100073) /* ebreak */ | 19 | #define __BUG_INSN_32 _UL(0x00100073) /* ebreak */ |
| 21 | #define __BUG_INSN_16 _UL(0x9002) /* c.ebreak */ | 20 | #define __BUG_INSN_16 _UL(0x9002) /* c.ebreak */ |
| 22 | 21 | ||
| 23 | #ifndef __ASSEMBLY__ | ||
| 24 | typedef u32 bug_insn_t; | 22 | typedef u32 bug_insn_t; |
| 25 | 23 | ||
| 26 | #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS | 24 | #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS |
| @@ -43,6 +41,7 @@ typedef u32 bug_insn_t; · 16 unmodified lines | |||
| 43 | RISCV_SHORT " %2" | 41 | RISCV_SHORT " %2" |
| 44 | #endif | 42 | #endif |
| 45 | 43 | ||
| 44 | #ifdef CONFIG_GENERIC_BUG | ||
| 46 | #define __BUG_FLAGS(flags) \ | 45 | #define __BUG_FLAGS(flags) \ |
| 47 | do { \ | 46 | do { \ |
| 48 | __asm__ __volatile__ ( \ | 47 | __asm__ __volatile__ ( \ |
| @@ -58,14 +57,10 @@ do { \ · 9 unmodified lines | |||
| 58 | "i" (flags), \ | 57 | "i" (flags), \ |
| 59 | "i" (sizeof(struct bug_entry))); \ | 58 | "i" (sizeof(struct bug_entry))); \ |
| 60 | } while (0) | 59 | } while (0) |
| 61 | |||
| 62 | #endif /* !__ASSEMBLY__ */ | ||
| 63 | #else /* CONFIG_GENERIC_BUG */ | 60 | #else /* CONFIG_GENERIC_BUG */ |
| 64 | #ifndef __ASSEMBLY__ | ||
| 65 | #define __BUG_FLAGS(flags) do { \ | 61 | #define __BUG_FLAGS(flags) do { \ |
| 66 | __asm__ __volatile__ ("ebreak\n"); \ | 62 | __asm__ __volatile__ ("ebreak\n"); \ |
| 67 | } while (0) | 63 | } while (0) |
| 68 | #endif /* !__ASSEMBLY__ */ | ||
| 69 | #endif /* CONFIG_GENERIC_BUG */ | 64 | #endif /* CONFIG_GENERIC_BUG */ |
| 70 | 65 | ||
| 71 | #define BUG() do { \ | 66 | #define BUG() do { \ |
| @@ -79,15 +74,10 @@ do { \ · 7 unmodified lines | |||
| 79 | 74 | ||
| 80 | #include <asm-generic/bug.h> | 75 | #include <asm-generic/bug.h> |
| 81 | 76 | ||
| 82 | #ifndef __ASSEMBLY__ | ||
| 83 | |||
| 84 | struct pt_regs; | 77 | struct pt_regs; |
| 85 | struct task_struct; | 78 | struct task_struct; |
| 86 | 79 | ||
| 87 | extern void die(struct pt_regs *regs, const char *str); | 80 | void die(struct pt_regs *regs, const char *str); |
| 88 | extern void do_trap(struct pt_regs *regs, int signo, int code, | 81 | void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr); |
| 89 | unsigned long addr); | ||
| 90 | |||
| 91 | #endif /* !__ASSEMBLY__ */ | ||
| 92 | 82 | ||
| 93 | #endif /* _ASM_RISCV_BUG_H */ | 83 | #endif /* _ASM_RISCV_BUG_H */ |
| @@ -87,14 +87,6 @@ extern pgd_t swapper_pg_dir[]; · 86 unmodified lines | |||
| 87 | #define VMALLOC_END (PAGE_OFFSET - 1) | 87 | #define VMALLOC_END (PAGE_OFFSET - 1) |
| 88 | #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE) | 88 | #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE) |
| 89 | 89 | ||
| 90 | #define FIXADDR_TOP VMALLOC_START | ||
| 91 | #ifdef CONFIG_64BIT | ||
| 92 | #define FIXADDR_SIZE PMD_SIZE | ||
| 93 | #else | ||
| 94 | #define FIXADDR_SIZE PGDIR_SIZE | ||
| 95 | #endif | ||
| 96 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | ||
| 97 | |||
| 98 | /* | 90 | /* |
| 99 | * Roughly size the vmemmap space to be large enough to fit enough | 91 | * Roughly size the vmemmap space to be large enough to fit enough |
| 100 | * struct pages to map half the virtual address space. Then | 92 | * struct pages to map half the virtual address space. Then |
| @@ -108,6 +100,14 @@ extern pgd_t swapper_pg_dir[]; · 7 unmodified lines | |||
| 108 | 100 | ||
| 109 | #define vmemmap ((struct page *)VMEMMAP_START) | 101 | #define vmemmap ((struct page *)VMEMMAP_START) |
| 110 | 102 | ||
| 103 | #define FIXADDR_TOP (VMEMMAP_START) | ||
| 104 | #ifdef CONFIG_64BIT | ||
| 105 | #define FIXADDR_SIZE PMD_SIZE | ||
| 106 | #else | ||
| 107 | #define FIXADDR_SIZE PGDIR_SIZE | ||
| 108 | #endif | ||
| 109 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | ||
| 110 | |||
| 111 | /* | 111 | /* |
| 112 | * ZERO_PAGE is a global shared page that is always zero, | 112 | * ZERO_PAGE is a global shared page that is always zero, |
| 113 | * used for zero-mapped memory areas, etc. | 113 | * used for zero-mapped memory areas, etc. |
| @@ -184,10 +184,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) · 70 unmodified lines | |||
| 184 | return __pte((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot)); | 184 | return __pte((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot)); |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | static inline pte_t mk_pte(struct page *page, pgprot_t prot) | 187 | #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot) |
| 188 | { | ||
| 189 | return pfn_pte(page_to_pfn(page), prot); | ||
| 190 | } | ||
| 191 | 188 | ||
| 192 | #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) | 189 | #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
| 193 | 190 | ||
| @@ -428,9 +425,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, · 234 unmodified lines | |||
| 428 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | 425 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) |
| 429 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) | 426 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
| 430 | 427 | ||
| 431 | #ifdef CONFIG_FLATMEM | ||
| 432 | #define kern_addr_valid(addr) (1) /* FIXME */ | 428 | #define kern_addr_valid(addr) (1) /* FIXME */ |
| 433 | #endif | ||
| 434 | 429 | ||
| 435 | extern void *dtb_early_va; | 430 | extern void *dtb_early_va; |
| 436 | extern void setup_bootmem(void); | 431 | extern void setup_bootmem(void); |
| @@ -10,10 +10,6 @@ · 9 unmodified lines | |||
| 10 | #include <linux/mm_types.h> | 10 | #include <linux/mm_types.h> |
| 11 | #include <asm/smp.h> | 11 | #include <asm/smp.h> |
| 12 | 12 | ||
| 13 | /* | ||
| 14 | * Flush entire local TLB. 'sfence.vma' implicitly fences with the instruction | ||
| 15 | * cache as well, so a 'fence.i' is not necessary. | ||
| 16 | */ | ||
| 17 | static inline void local_flush_tlb_all(void) | 13 | static inline void local_flush_tlb_all(void) |
| 18 | { | 14 | { |
| 19 | __asm__ __volatile__ ("sfence.vma" : : : "memory"); | 15 | __asm__ __volatile__ ("sfence.vma" : : : "memory"); |
| @@ -111,7 +111,6 @@ DO_ERROR_INFO(do_trap_ecall_s, · 110 unmodified lines | |||
| 111 | DO_ERROR_INFO(do_trap_ecall_m, | 111 | DO_ERROR_INFO(do_trap_ecall_m, |
| 112 | SIGILL, ILL_ILLTRP, "environment call from M-mode"); | 112 | SIGILL, ILL_ILLTRP, "environment call from M-mode"); |
| 113 | 113 | ||
| 114 | #ifdef CONFIG_GENERIC_BUG | ||
| 115 | static inline unsigned long get_break_insn_length(unsigned long pc) | 114 | static inline unsigned long get_break_insn_length(unsigned long pc) |
| 116 | { | 115 | { |
| 117 | bug_insn_t insn; | 116 | bug_insn_t insn; |
| @@ -120,28 +119,15 @@ static inline unsigned long get_break_insn_length(unsigned long pc) · 2 unmodified lines | |||
| 120 | return 0; | 119 | return 0; |
| 121 | return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL); | 120 | return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL); |
| 122 | } | 121 | } |
| 123 | #endif /* CONFIG_GENERIC_BUG */ | ||
| 124 | 122 | ||
| 125 | asmlinkage void do_trap_break(struct pt_regs *regs) | 123 | asmlinkage void do_trap_break(struct pt_regs *regs) |
| 126 | { | 124 | { |
| 127 | if (!user_mode(regs)) { | 125 | if (user_mode(regs)) |
| 128 | enum bug_trap_type type; | 126 | force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc); |
| 129 | 127 | else if (report_bug(regs->sepc, regs) == BUG_TRAP_TYPE_WARN) | |
| 130 | type = report_bug(regs->sepc, regs); | 128 | regs->sepc += get_break_insn_length(regs->sepc); |
| 131 | switch (type) { | 129 | else |
| 132 | #ifdef CONFIG_GENERIC_BUG | 130 | die(regs, "Kernel BUG"); |
| 133 | case BUG_TRAP_TYPE_WARN: | ||
| 134 | regs->sepc += get_break_insn_length(regs->sepc); | ||
| 135 | return; | ||
| 136 | case BUG_TRAP_TYPE_BUG: | ||
| 137 | #endif /* CONFIG_GENERIC_BUG */ | ||
| 138 | default: | ||
| 139 | die(regs, "Kernel BUG"); | ||
| 140 | } | ||
| 141 | } else { | ||
| 142 | force_sig_fault(SIGTRAP, TRAP_BRKPT, | ||
| 143 | (void __user *)(regs->sepc)); | ||
| 144 | } | ||
| 145 | } | 131 | } |
| 146 | 132 | ||
| 147 | #ifdef CONFIG_GENERIC_BUG | 133 | #ifdef CONFIG_GENERIC_BUG |
| @@ -458,7 +458,7 @@ void __init paging_init(void) · 457 unmodified lines | |||
| 458 | zone_sizes_init(); | 458 | zone_sizes_init(); |
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | #ifdef CONFIG_SPARSEMEM | 461 | #ifdef CONFIG_SPARSEMEM_VMEMMAP |
| 462 | int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, | 462 | int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, |
| 463 | struct vmem_altmap *altmap) | 463 | struct vmem_altmap *altmap) |
| 464 | { | 464 | { |
| @@ -101,10 +101,18 @@ static void handle_relocs(unsigned long offset) · 100 unmodified lines | |||
| 101 | dynsym = (Elf64_Sym *) vmlinux.dynsym_start; | 101 | dynsym = (Elf64_Sym *) vmlinux.dynsym_start; |
| 102 | for (rela = rela_start; rela < rela_end; rela++) { | 102 | for (rela = rela_start; rela < rela_end; rela++) { |
| 103 | loc = rela->r_offset + offset; | 103 | loc = rela->r_offset + offset; |
| 104 | val = rela->r_addend + offset; | 104 | val = rela->r_addend; |
| 105 | r_sym = ELF64_R_SYM(rela->r_info); | 105 | r_sym = ELF64_R_SYM(rela->r_info); |
| 106 | if (r_sym) | 106 | if (r_sym) { |
| 107 | val += dynsym[r_sym].st_value; | 107 | if (dynsym[r_sym].st_shndx != SHN_UNDEF) |
| 108 | val += dynsym[r_sym].st_value + offset; | ||
| 109 | } else { | ||
| 110 | /* | ||
| 111 | * 0 == undefined symbol table index (STN_UNDEF), | ||
| 112 | * used for R_390_RELATIVE, only add KASLR offset | ||
| 113 | */ | ||
| 114 | val += offset; | ||
| 115 | } | ||
| 108 | r_type = ELF64_R_TYPE(rela->r_info); | 116 | r_type = ELF64_R_TYPE(rela->r_info); |
| 109 | rc = arch_kexec_do_relocs(r_type, (void *) loc, val, 0); | 117 | rc = arch_kexec_do_relocs(r_type, (void *) loc, val, 0); |
| 110 | if (rc) | 118 | if (rc) |
| @@ -27,6 +27,7 @@ int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val, · 26 unmodified lines | |||
| 27 | *(u32 *)loc = val; | 27 | *(u32 *)loc = val; |
| 28 | break; | 28 | break; |
| 29 | case R_390_64: /* Direct 64 bit. */ | 29 | case R_390_64: /* Direct 64 bit. */ |
| 30 | case R_390_GLOB_DAT: | ||
| 30 | *(u64 *)loc = val; | 31 | *(u64 *)loc = val; |
| 31 | break; | 32 | break; |
| 32 | case R_390_PC16: /* PC relative 16 bit. */ | 33 | case R_390_PC16: /* PC relative 16 bit. */ |
| @@ -29,7 +29,6 @@ config SPARC · 28 unmodified lines | |||
| 29 | select RTC_DRV_M48T59 | 29 | select RTC_DRV_M48T59 |
| 30 | select RTC_SYSTOHC | 30 | select RTC_SYSTOHC |
| 31 | select HAVE_ARCH_JUMP_LABEL if SPARC64 | 31 | select HAVE_ARCH_JUMP_LABEL if SPARC64 |
| 32 | select HAVE_FAST_GUP if SPARC64 | ||
| 33 | select GENERIC_IRQ_SHOW | 32 | select GENERIC_IRQ_SHOW |
| 34 | select ARCH_WANT_IPC_PARSE_VERSION | 33 | select ARCH_WANT_IPC_PARSE_VERSION |
| 35 | select GENERIC_PCI_IOMAP | 34 | select GENERIC_PCI_IOMAP |
| @@ -20,30 +20,6 @@ · 19 unmodified lines | |||
| 20 | */ | 20 | */ |
| 21 | struct mem_vector immovable_mem[MAX_NUMNODES*2]; | 21 | struct mem_vector immovable_mem[MAX_NUMNODES*2]; |
| 22 | 22 | ||
| 23 | /* | ||
| 24 | * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex | ||
| 25 | * digits, and '\0' for termination. | ||
| 26 | */ | ||
| 27 | #define MAX_ADDR_LEN 19 | ||
| 28 | |||
| 29 | static acpi_physical_address get_cmdline_acpi_rsdp(void) | ||
| 30 | { | ||
| 31 | acpi_physical_address addr = 0; | ||
| 32 | |||
| 33 | #ifdef CONFIG_KEXEC | ||
| 34 | char val[MAX_ADDR_LEN] = { }; | ||
| 35 | int ret; | ||
| 36 | |||
| 37 | ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN); | ||
| 38 | if (ret < 0) | ||
| 39 | return 0; | ||
| 40 | |||
| 41 | if (kstrtoull(val, 16, &addr)) | ||
| 42 | return 0; | ||
| 43 | #endif | ||
| 44 | return addr; | ||
| 45 | } | ||
| 46 | |||
| 47 | /* | 23 | /* |
| 48 | * Search EFI system tables for RSDP. If both ACPI_20_TABLE_GUID and | 24 | * Search EFI system tables for RSDP. If both ACPI_20_TABLE_GUID and |
| 49 | * ACPI_TABLE_GUID are found, take the former, which has more features. | 25 | * ACPI_TABLE_GUID are found, take the former, which has more features. |
| @@ -298,6 +274,30 @@ acpi_physical_address get_rsdp_addr(void) · 248 unmodified lines | |||
| 298 | } | 274 | } |
| 299 | 275 | ||
| 300 | #if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE) | 276 | #if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE) |
| 277 | /* | ||
| 278 | * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex | ||
| 279 | * digits, and '\0' for termination. | ||
| 280 | */ | ||
| 281 | #define MAX_ADDR_LEN 19 | ||
| 282 | |||
| 283 | static acpi_physical_address get_cmdline_acpi_rsdp(void) | ||
| 284 | { | ||
| 285 | acpi_physical_address addr = 0; | ||
| 286 | |||
| 287 | #ifdef CONFIG_KEXEC | ||
| 288 | char val[MAX_ADDR_LEN] = { }; | ||
| 289 | int ret; | ||
| 290 | |||
| 291 | ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN); | ||
| 292 | if (ret < 0) | ||
| 293 | return 0; | ||
| 294 | |||
| 295 | if (kstrtoull(val, 16, &addr)) | ||
| 296 | return 0; | ||
| 297 | #endif | ||
| 298 | return addr; | ||
| 299 | } | ||
| 300 | |||
| 301 | /* Compute SRAT address from RSDP. */ | 301 | /* Compute SRAT address from RSDP. */ |
| 302 | static unsigned long get_acpi_srat_table(void) | 302 | static unsigned long get_acpi_srat_table(void) |
| 303 | { | 303 | { |
| @@ -345,6 +345,7 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap, · 344 unmodified lines | |||
| 345 | { | 345 | { |
| 346 | const unsigned long kernel_total_size = VO__end - VO__text; | 346 | const unsigned long kernel_total_size = VO__end - VO__text; |
| 347 | unsigned long virt_addr = LOAD_PHYSICAL_ADDR; | 347 | unsigned long virt_addr = LOAD_PHYSICAL_ADDR; |
| 348 | unsigned long needed_size; | ||
| 348 | 349 | ||
| 349 | /* Retain x86 boot parameters pointer passed from startup_32/64. */ | 350 | /* Retain x86 boot parameters pointer passed from startup_32/64. */ |
| 350 | boot_params = rmode; | 351 | boot_params = rmode; |
| @@ -379,26 +380,38 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap, · 28 unmodified lines | |||
| 379 | free_mem_ptr = heap; /* Heap */ | 380 | free_mem_ptr = heap; /* Heap */ |
| 380 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; | 381 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; |
| 381 | 382 | ||
| 383 | /* | ||
| 384 | * The memory hole needed for the kernel is the larger of either | ||
| 385 | * the entire decompressed kernel plus relocation table, or the | ||
| 386 | * entire decompressed kernel plus .bss and .brk sections. | ||
| 387 | * | ||
| 388 | * On X86_64, the memory is mapped with PMD pages. Round the | ||
| 389 | * size up so that the full extent of PMD pages mapped is | ||
| 390 | * included in the check against the valid memory table | ||
| 391 | * entries. This ensures the full mapped area is usable RAM | ||
| 392 | * and doesn't include any reserved areas. | ||
| 393 | */ | ||
| 394 | needed_size = max(output_len, kernel_total_size); | ||
| 395 | #ifdef CONFIG_X86_64 | ||
| 396 | needed_size = ALIGN(needed_size, MIN_KERNEL_ALIGN); | ||
| 397 | #endif | ||
| 398 | |||
| 382 | /* Report initial kernel position details. */ | 399 | /* Report initial kernel position details. */ |
| 383 | debug_putaddr(input_data); | 400 | debug_putaddr(input_data); |
| 384 | debug_putaddr(input_len); | 401 | debug_putaddr(input_len); |
| 385 | debug_putaddr(output); | 402 | debug_putaddr(output); |
| 386 | debug_putaddr(output_len); | 403 | debug_putaddr(output_len); |
| 387 | debug_putaddr(kernel_total_size); | 404 | debug_putaddr(kernel_total_size); |
| 405 | debug_putaddr(needed_size); | ||
| 388 | 406 | ||
| 389 | #ifdef CONFIG_X86_64 | 407 | #ifdef CONFIG_X86_64 |
| 390 | /* Report address of 32-bit trampoline */ | 408 | /* Report address of 32-bit trampoline */ |
| 391 | debug_putaddr(trampoline_32bit); | 409 | debug_putaddr(trampoline_32bit); |
| 392 | #endif | 410 | #endif |
| 393 | 411 | ||
| 394 | /* | ||
| 395 | * The memory hole needed for the kernel is the larger of either | ||
| 396 | * the entire decompressed kernel plus relocation table, or the | ||
| 397 | * entire decompressed kernel plus .bss and .brk sections. | ||
| 398 | */ | ||
| 399 | choose_random_location((unsigned long)input_data, input_len, | 412 | choose_random_location((unsigned long)input_data, input_len, |
| 400 | (unsigned long *)&output, | 413 | (unsigned long *)&output, |
| 401 | max(output_len, kernel_total_size), | 414 | needed_size, |
| 402 | &virt_addr); | 415 | &virt_addr); |
| 403 | 416 | ||
| 404 | /* Validate memory location choices. */ | 417 | /* Validate memory location choices. */ |
| @@ -377,7 +377,8 @@ static inline void perf_ibs_disable_event(struct perf_ibs *perf_ibs, · 376 unmodified lines | |||
| 377 | struct hw_perf_event *hwc, u64 config) | 377 | struct hw_perf_event *hwc, u64 config) |
| 378 | { | 378 | { |
| 379 | config &= ~perf_ibs->cnt_mask; | 379 | config &= ~perf_ibs->cnt_mask; |
| 380 | wrmsrl(hwc->config_base, config); | 380 | if (boot_cpu_data.x86 == 0x10) |
| 381 | wrmsrl(hwc->config_base, config); | ||
| 381 | config &= ~perf_ibs->enable_mask; | 382 | config &= ~perf_ibs->enable_mask; |
| 382 | wrmsrl(hwc->config_base, config); | 383 | wrmsrl(hwc->config_base, config); |
| 383 | } | 384 | } |
| @@ -553,7 +554,8 @@ static struct perf_ibs perf_ibs_op = { · 169 unmodified lines | |||
| 553 | }, | 554 | }, |
| 554 | .msr = MSR_AMD64_IBSOPCTL, | 555 | .msr = MSR_AMD64_IBSOPCTL, |
| 555 | .config_mask = IBS_OP_CONFIG_MASK, | 556 | .config_mask = IBS_OP_CONFIG_MASK, |
| 556 | .cnt_mask = IBS_OP_MAX_CNT, | 557 | .cnt_mask = IBS_OP_MAX_CNT | IBS_OP_CUR_CNT | |
| 558 | IBS_OP_CUR_CNT_RAND, | ||
| 557 | .enable_mask = IBS_OP_ENABLE, | 559 | .enable_mask = IBS_OP_ENABLE, |
| 558 | .valid_mask = IBS_OP_VAL, | 560 | .valid_mask = IBS_OP_VAL, |
| 559 | .max_period = IBS_OP_MAX_CNT << 4, | 561 | .max_period = IBS_OP_MAX_CNT << 4, |
| @@ -614,7 +616,7 @@ fail: · 54 unmodified lines | |||
| 614 | if (event->attr.sample_type & PERF_SAMPLE_RAW) | 616 | if (event->attr.sample_type & PERF_SAMPLE_RAW) |
| 615 | offset_max = perf_ibs->offset_max; | 617 | offset_max = perf_ibs->offset_max; |
| 616 | else if (check_rip) | 618 | else if (check_rip) |
| 617 | offset_max = 2; | 619 | offset_max = 3; |
| 618 | else | 620 | else |
| 619 | offset_max = 1; | 621 | offset_max = 1; |
| 620 | do { | 622 | do { |
| @@ -502,10 +502,8 @@ void uncore_pmu_event_start(struct perf_event *event, int flags) · 501 unmodified lines | |||
| 502 | local64_set(&event->hw.prev_count, uncore_read_counter(box, event)); | 502 | local64_set(&event->hw.prev_count, uncore_read_counter(box, event)); |
| 503 | uncore_enable_event(box, event); | 503 | uncore_enable_event(box, event); |
| 504 | 504 | ||
| 505 | if (box->n_active == 1) { | 505 | if (box->n_active == 1) |
| 506 | uncore_enable_box(box); | ||
| 507 | uncore_pmu_start_hrtimer(box); | 506 | uncore_pmu_start_hrtimer(box); |
| 508 | } | ||
| 509 | } | 507 | } |
| 510 | 508 | ||
| 511 | void uncore_pmu_event_stop(struct perf_event *event, int flags) | 509 | void uncore_pmu_event_stop(struct perf_event *event, int flags) |
| @@ -529,10 +527,8 @@ void uncore_pmu_event_stop(struct perf_event *event, int flags) · 17 unmodified lines | |||
| 529 | WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED); | 527 | WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED); |
| 530 | hwc->state |= PERF_HES_STOPPED; | 528 | hwc->state |= PERF_HES_STOPPED; |
| 531 | 529 | ||
| 532 | if (box->n_active == 0) { | 530 | if (box->n_active == 0) |
| 533 | uncore_disable_box(box); | ||
| 534 | uncore_pmu_cancel_hrtimer(box); | 531 | uncore_pmu_cancel_hrtimer(box); |
| 535 | } | ||
| 536 | } | 532 | } |
| 537 | 533 | ||
| 538 | if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) { | 534 | if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) { |
| @@ -778,6 +774,40 @@ static int uncore_pmu_event_init(struct perf_event *event) · 239 unmodified lines | |||
| 778 | return ret; | 774 | return ret; |
| 779 | } | 775 | } |
| 780 | 776 | ||
| 777 | static void uncore_pmu_enable(struct pmu *pmu) | ||
| 778 | { | ||
| 779 | struct intel_uncore_pmu *uncore_pmu; | ||
| 780 | struct intel_uncore_box *box; | ||
| 781 | |||
| 782 | uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu); | ||
| 783 | if (!uncore_pmu) | ||
| 784 | return; | ||
| 785 | |||
| 786 | box = uncore_pmu_to_box(uncore_pmu, smp_processor_id()); | ||
| 787 | if (!box) | ||
| 788 | return; | ||
| 789 | |||
| 790 | if (uncore_pmu->type->ops->enable_box) | ||
| 791 | uncore_pmu->type->ops->enable_box(box); | ||
| 792 | } | ||
| 793 | |||
| 794 | static void uncore_pmu_disable(struct pmu *pmu) | ||
| 795 | { | ||
| 796 | struct intel_uncore_pmu *uncore_pmu; | ||
| 797 | struct intel_uncore_box *box; | ||
| 798 | |||
| 799 | uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu); | ||
| 800 | if (!uncore_pmu) | ||
| 801 | return; | ||
| 802 | |||
| 803 | box = uncore_pmu_to_box(uncore_pmu, smp_processor_id()); | ||
| 804 | if (!box) | ||
| 805 | return; | ||
| 806 | |||
| 807 | if (uncore_pmu->type->ops->disable_box) | ||
| 808 | uncore_pmu->type->ops->disable_box(box); | ||
| 809 | } | ||
| 810 | |||
| 781 | static ssize_t uncore_get_attr_cpumask(struct device *dev, | 811 | static ssize_t uncore_get_attr_cpumask(struct device *dev, |
| 782 | struct device_attribute *attr, char *buf) | 812 | struct device_attribute *attr, char *buf) |
| 783 | { | 813 | { |
| @@ -803,6 +833,8 @@ static int uncore_pmu_register(struct intel_uncore_pmu *pmu) · 19 unmodified lines | |||
| 803 | pmu->pmu = (struct pmu) { | 833 | pmu->pmu = (struct pmu) { |
| 804 | .attr_groups = pmu->type->attr_groups, | 834 | .attr_groups = pmu->type->attr_groups, |
| 805 | .task_ctx_nr = perf_invalid_context, | 835 | .task_ctx_nr = perf_invalid_context, |
| 836 | .pmu_enable = uncore_pmu_enable, | ||
| 837 | .pmu_disable = uncore_pmu_disable, | ||
| 806 | .event_init = uncore_pmu_event_init, | 838 | .event_init = uncore_pmu_event_init, |
| 807 | .add = uncore_pmu_event_add, | 839 | .add = uncore_pmu_event_add, |
| 808 | .del = uncore_pmu_event_del, | 840 | .del = uncore_pmu_event_del, |
| @@ -441,18 +441,6 @@ static inline int uncore_freerunning_hw_config(struct intel_uncore_box *box, · 440 unmodified lines | |||
| 441 | return -EINVAL; | 441 | return -EINVAL; |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | static inline void uncore_disable_box(struct intel_uncore_box *box) | ||
| 445 | { | ||
| 446 | if (box->pmu->type->ops->disable_box) | ||
| 447 | box->pmu->type->ops->disable_box(box); | ||
| 448 | } | ||
| 449 | |||
| 450 | static inline void uncore_enable_box(struct intel_uncore_box *box) | ||
| 451 | { | ||
| 452 | if (box->pmu->type->ops->enable_box) | ||
| 453 | box->pmu->type->ops->enable_box(box); | ||
| 454 | } | ||
| 455 | |||
| 456 | static inline void uncore_disable_event(struct intel_uncore_box *box, | 444 | static inline void uncore_disable_event(struct intel_uncore_box *box, |
| 457 | struct perf_event *event) | 445 | struct perf_event *event) |
| 458 | { | 446 | { |
| @@ -260,11 +260,21 @@ void __init hv_apic_init(void) · 259 unmodified lines | |||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | if (ms_hyperv.hints & HV_X64_APIC_ACCESS_RECOMMENDED) { | 262 | if (ms_hyperv.hints & HV_X64_APIC_ACCESS_RECOMMENDED) { |
| 263 | pr_info("Hyper-V: Using MSR based APIC access\n"); | 263 | pr_info("Hyper-V: Using enlightened APIC (%s mode)", |
| 264 | x2apic_enabled() ? "x2apic" : "xapic"); | ||
| 265 | /* | ||
| 266 | * With x2apic, architectural x2apic MSRs are equivalent to the | ||
| 267 | * respective synthetic MSRs, so there's no need to override | ||
| 268 | * the apic accessors. The only exception is | ||
| 269 | * hv_apic_eoi_write, because it benefits from lazy EOI when | ||
| 270 | * available, but it works for both xapic and x2apic modes. | ||
| 271 | */ | ||
| 264 | apic_set_eoi_write(hv_apic_eoi_write); | 272 | apic_set_eoi_write(hv_apic_eoi_write); |
| 265 | apic->read = hv_apic_read; | 273 | if (!x2apic_enabled()) { |
| 266 | apic->write = hv_apic_write; | 274 | apic->read = hv_apic_read; |
| 267 | apic->icr_write = hv_apic_icr_write; | 275 | apic->write = hv_apic_write; |
| 268 | apic->icr_read = hv_apic_icr_read; | 276 | apic->icr_write = hv_apic_icr_write; |
| 277 | apic->icr_read = hv_apic_icr_read; | ||
| 278 | } | ||
| 269 | } | 279 | } |
| 270 | } | 280 | } |
| @@ -1189,7 +1189,7 @@ struct kvm_x86_ops { · 1188 unmodified lines | |||
| 1189 | int (*set_nested_state)(struct kvm_vcpu *vcpu, | 1189 | int (*set_nested_state)(struct kvm_vcpu *vcpu, |
| 1190 | struct kvm_nested_state __user *user_kvm_nested_state, | 1190 | struct kvm_nested_state __user *user_kvm_nested_state, |
| 1191 | struct kvm_nested_state *kvm_state); | 1191 | struct kvm_nested_state *kvm_state); |
| 1192 | void (*get_vmcs12_pages)(struct kvm_vcpu *vcpu); | 1192 | bool (*get_vmcs12_pages)(struct kvm_vcpu *vcpu); |
| 1193 | 1193 | ||
| 1194 | int (*smi_allowed)(struct kvm_vcpu *vcpu); | 1194 | int (*smi_allowed)(struct kvm_vcpu *vcpu); |
| 1195 | int (*pre_enter_smm)(struct kvm_vcpu *vcpu, char *smstate); | 1195 | int (*pre_enter_smm)(struct kvm_vcpu *vcpu, char *smstate); |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | 4 | ||
| 5 | #include <asm/cpufeatures.h> | 5 | #include <asm/cpufeatures.h> |
| 6 | #include <asm/alternative.h> | 6 | #include <asm/alternative.h> |
| 7 | #include <linux/stringify.h> | ||
| 7 | 8 | ||
| 8 | /* | 9 | /* |
| 9 | * The hypercall definitions differ in the low word of the %edx argument | 10 | * The hypercall definitions differ in the low word of the %edx argument |
| @@ -20,8 +21,8 @@ · 10 unmodified lines | |||
| 20 | */ | 21 | */ |
| 21 | 22 | ||
| 22 | /* Old port-based version */ | 23 | /* Old port-based version */ |
| 23 | #define VMWARE_HYPERVISOR_PORT "0x5658" | 24 | #define VMWARE_HYPERVISOR_PORT 0x5658 |
| 24 | #define VMWARE_HYPERVISOR_PORT_HB "0x5659" | 25 | #define VMWARE_HYPERVISOR_PORT_HB 0x5659 |
| 25 | 26 | ||
| 26 | /* Current vmcall / vmmcall version */ | 27 | /* Current vmcall / vmmcall version */ |
| 27 | #define VMWARE_HYPERVISOR_HB BIT(0) | 28 | #define VMWARE_HYPERVISOR_HB BIT(0) |
| @@ -29,7 +30,8 @@ · 1 unmodified line | |||
| 29 | 30 | ||
| 30 | /* The low bandwidth call. The low word of edx is presumed clear. */ | 31 | /* The low bandwidth call. The low word of edx is presumed clear. */ |
| 31 | #define VMWARE_HYPERCALL \ | 32 | #define VMWARE_HYPERCALL \ |
| 32 | ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT ", %%dx; inl (%%dx)", \ | 33 | ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT) ", %%dx; " \ |
| 34 | "inl (%%dx), %%eax", \ | ||
| 33 | "vmcall", X86_FEATURE_VMCALL, \ | 35 | "vmcall", X86_FEATURE_VMCALL, \ |
| 34 | "vmmcall", X86_FEATURE_VMW_VMMCALL) | 36 | "vmmcall", X86_FEATURE_VMW_VMMCALL) |
| 35 | 37 | ||
| @@ -38,7 +40,8 @@ · 2 unmodified lines | |||
| 38 | * HB and OUT bits set. | 40 | * HB and OUT bits set. |
| 39 | */ | 41 | */ |
| 40 | #define VMWARE_HYPERCALL_HB_OUT \ | 42 | #define VMWARE_HYPERCALL_HB_OUT \ |
| 41 | ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT_HB ", %%dx; rep outsb", \ | 43 | ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \ |
| 44 | "rep outsb", \ | ||
| 42 | "vmcall", X86_FEATURE_VMCALL, \ | 45 | "vmcall", X86_FEATURE_VMCALL, \ |
| 43 | "vmmcall", X86_FEATURE_VMW_VMMCALL) | 46 | "vmmcall", X86_FEATURE_VMW_VMMCALL) |
| 44 | 47 | ||
| @@ -47,7 +50,8 @@ · 2 unmodified lines | |||
| 47 | * HB bit set. | 50 | * HB bit set. |
| 48 | */ | 51 | */ |
| 49 | #define VMWARE_HYPERCALL_HB_IN \ | 52 | #define VMWARE_HYPERCALL_HB_IN \ |
| 50 | ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT_HB ", %%dx; rep insb", \ | 53 | ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \ |
| 54 | "rep insb", \ | ||
| 51 | "vmcall", X86_FEATURE_VMCALL, \ | 55 | "vmcall", X86_FEATURE_VMCALL, \ |
| 52 | "vmmcall", X86_FEATURE_VMW_VMMCALL) | 56 | "vmmcall", X86_FEATURE_VMW_VMMCALL) |
| 53 | #endif | 57 | #endif |
| @@ -156,7 +156,8 @@ static int x2apic_dead_cpu(unsigned int dead_cpu) · 155 unmodified lines | |||
| 156 | { | 156 | { |
| 157 | struct cluster_mask *cmsk = per_cpu(cluster_masks, dead_cpu); | 157 | struct cluster_mask *cmsk = per_cpu(cluster_masks, dead_cpu); |
| 158 | 158 | ||
| 159 | cpumask_clear_cpu(dead_cpu, &cmsk->mask); | 159 | if (cmsk) |
| 160 | cpumask_clear_cpu(dead_cpu, &cmsk->mask); | ||
| 160 | free_cpumask_var(per_cpu(ipi_mask, dead_cpu)); | 161 | free_cpumask_var(per_cpu(ipi_mask, dead_cpu)); |
| 161 | return 0; | 162 | return 0; |
| 162 | } | 163 | } |
| @@ -216,6 +216,10 @@ static void __init ms_hyperv_init_platform(void) · 215 unmodified lines | |||
| 216 | int hv_host_info_ecx; | 216 | int hv_host_info_ecx; |
| 217 | int hv_host_info_edx; | 217 | int hv_host_info_edx; |
| 218 | 218 | ||
| 219 | #ifdef CONFIG_PARAVIRT | ||
| 220 | pv_info.name = "Hyper-V"; | ||
| 221 | #endif | ||
| 222 | |||
| 219 | /* | 223 | /* |
| 220 | * Extract the features and hints | 224 | * Extract the features and hints |
| 221 | */ | 225 | */ |
| @@ -222,13 +222,31 @@ unsigned long __head __startup_64(unsigned long physaddr, · 221 unmodified lines | |||
| 222 | * we might write invalid pmds, when the kernel is relocated | 222 | * we might write invalid pmds, when the kernel is relocated |
| 223 | * cleanup_highmap() fixes this up along with the mappings | 223 | * cleanup_highmap() fixes this up along with the mappings |
| 224 | * beyond _end. | 224 | * beyond _end. |
| 225 | * | ||
| 226 | * Only the region occupied by the kernel image has so far | ||
| 227 | * been checked against the table of usable memory regions | ||
| 228 | * provided by the firmware, so invalidate pages outside that | ||
| 229 | * region. A page table entry that maps to a reserved area of | ||
| 230 | * memory would allow processor speculation into that area, | ||
| 231 | * and on some hardware (particularly the UV platform) even | ||
| 232 | * speculative access to some reserved areas is caught as an | ||
| 233 | * error, causing the BIOS to halt the system. | ||
| 225 | */ | 234 | */ |
| 226 | 235 | ||
| 227 | pmd = fixup_pointer(level2_kernel_pgt, physaddr); | 236 | pmd = fixup_pointer(level2_kernel_pgt, physaddr); |
| 228 | for (i = 0; i < PTRS_PER_PMD; i++) { | 237 | |
| 238 | /* invalidate pages before the kernel image */ | ||
| 239 | for (i = 0; i < pmd_index((unsigned long)_text); i++) | ||
| 240 | pmd[i] &= ~_PAGE_PRESENT; | ||
| 241 | |||
| 242 | /* fixup pages that are part of the kernel image */ | ||
| 243 | for (; i <= pmd_index((unsigned long)_end); i++) | ||
| 229 | if (pmd[i] & _PAGE_PRESENT) | 244 | if (pmd[i] & _PAGE_PRESENT) |
| 230 | pmd[i] += load_delta; | 245 | pmd[i] += load_delta; |
| 231 | } | 246 | |
| 247 | /* invalidate pages after the kernel image */ | ||
| 248 | for (; i < PTRS_PER_PMD; i++) | ||
| 249 | pmd[i] &= ~_PAGE_PRESENT; | ||
| 232 | 250 | ||
| 233 | /* | 251 | /* |
| 234 | * Fixup phys_base - remove the memory encryption mask to obtain | 252 | * Fixup phys_base - remove the memory encryption mask to obtain |
| @@ -363,7 +363,7 @@ static inline void do_cpuid_7_mask(struct kvm_cpuid_entry2 *entry, int index) · 362 unmodified lines | |||
| 363 | 363 | ||
| 364 | /* cpuid 7.0.ecx*/ | 364 | /* cpuid 7.0.ecx*/ |
| 365 | const u32 kvm_cpuid_7_0_ecx_x86_features = | 365 | const u32 kvm_cpuid_7_0_ecx_x86_features = |
| 366 | F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ | | 366 | F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ | F(RDPID) | |
| 367 | F(AVX512_VPOPCNTDQ) | F(UMIP) | F(AVX512_VBMI2) | F(GFNI) | | 367 | F(AVX512_VPOPCNTDQ) | F(UMIP) | F(AVX512_VBMI2) | F(GFNI) | |
| 368 | F(VAES) | F(VPCLMULQDQ) | F(AVX512_VNNI) | F(AVX512_BITALG) | | 368 | F(VAES) | F(VPCLMULQDQ) | F(AVX512_VNNI) | F(AVX512_BITALG) | |
| 369 | F(CLDEMOTE) | F(MOVDIRI) | F(MOVDIR64B) | 0 /*WAITPKG*/; | 369 | F(CLDEMOTE) | F(MOVDIRI) | F(MOVDIR64B) | 0 /*WAITPKG*/; |
| @@ -111,11 +111,6 @@ static inline int apic_enabled(struct kvm_lapic *apic) · 110 unmodified lines | |||
| 111 | (LVT_MASK | APIC_MODE_MASK | APIC_INPUT_POLARITY | \ | 111 | (LVT_MASK | APIC_MODE_MASK | APIC_INPUT_POLARITY | \ |
| 112 | APIC_LVT_REMOTE_IRR | APIC_LVT_LEVEL_TRIGGER) | 112 | APIC_LVT_REMOTE_IRR | APIC_LVT_LEVEL_TRIGGER) |
| 113 | 113 | ||
| 114 | static inline u8 kvm_xapic_id(struct kvm_lapic *apic) | ||
| 115 | { | ||
| 116 | return kvm_lapic_get_reg(apic, APIC_ID) >> 24; | ||
| 117 | } | ||
| 118 | |||
| 119 | static inline u32 kvm_x2apic_id(struct kvm_lapic *apic) | 114 | static inline u32 kvm_x2apic_id(struct kvm_lapic *apic) |
| 120 | { | 115 | { |
| 121 | return apic->vcpu->vcpu_id; | 116 | return apic->vcpu->vcpu_id; |
| @@ -242,4 +242,9 @@ static inline enum lapic_mode kvm_apic_mode(u64 apic_base) · 241 unmodified lines | |||
| 242 | return apic_base & (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE); | 242 | return apic_base & (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE); |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | static inline u8 kvm_xapic_id(struct kvm_lapic *apic) | ||
| 246 | { | ||
| 247 | return kvm_lapic_get_reg(apic, APIC_ID) >> 24; | ||
| 248 | } | ||
| 249 | |||
| 245 | #endif | 250 | #endif |
| @@ -4591,6 +4591,7 @@ static int avic_handle_ldr_update(struct kvm_vcpu *vcpu) · 4590 unmodified lines | |||
| 4591 | int ret = 0; | 4591 | int ret = 0; |
| 4592 | struct vcpu_svm *svm = to_svm(vcpu); | 4592 | struct vcpu_svm *svm = to_svm(vcpu); |
| 4593 | u32 ldr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_LDR); | 4593 | u32 ldr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_LDR); |
| 4594 | u32 id = kvm_xapic_id(vcpu->arch.apic); | ||
| 4594 | 4595 | ||
| 4595 | if (ldr == svm->ldr_reg) | 4596 | if (ldr == svm->ldr_reg) |
| 4596 | return 0; | 4597 | return 0; |
| @@ -4598,7 +4599,7 @@ static int avic_handle_ldr_update(struct kvm_vcpu *vcpu) · 1 unmodified line | |||
| 4598 | avic_invalidate_logical_id_entry(vcpu); | 4599 | avic_invalidate_logical_id_entry(vcpu); |
| 4599 | 4600 | ||
| 4600 | if (ldr) | 4601 | if (ldr) |
| 4601 | ret = avic_ldr_write(vcpu, vcpu->vcpu_id, ldr); | 4602 | ret = avic_ldr_write(vcpu, id, ldr); |
| 4602 | 4603 | ||
| 4603 | if (!ret) | 4604 | if (!ret) |
| 4604 | svm->ldr_reg = ldr; | 4605 | svm->ldr_reg = ldr; |
| @@ -4610,8 +4611,7 @@ static int avic_handle_apic_id_update(struct kvm_vcpu *vcpu) · 5 unmodified lines | |||
| 4610 | { | 4611 | { |
| 4611 | u64 *old, *new; | 4612 | u64 *old, *new; |
| 4612 | struct vcpu_svm *svm = to_svm(vcpu); | 4613 | struct vcpu_svm *svm = to_svm(vcpu); |
| 4613 | u32 apic_id_reg = kvm_lapic_get_reg(vcpu->arch.apic, APIC_ID); | 4614 | u32 id = kvm_xapic_id(vcpu->arch.apic); |
| 4614 | u32 id = (apic_id_reg >> 24) & 0xff; | ||
| 4615 | 4615 | ||
| 4616 | if (vcpu->vcpu_id == id) | 4616 | if (vcpu->vcpu_id == id) |
| 4617 | return 0; | 4617 | return 0; |
| @@ -2917,7 +2917,7 @@ static int nested_vmx_check_vmentry_hw(struct kvm_vcpu *vcpu) · 2916 unmodified lines | |||
| 2917 | static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu, | 2917 | static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu, |
| 2918 | struct vmcs12 *vmcs12); | 2918 | struct vmcs12 *vmcs12); |
| 2919 | 2919 | ||
| 2920 | static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) | 2920 | static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) |
| 2921 | { | 2921 | { |
| 2922 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); | 2922 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); |
| 2923 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 2923 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| @@ -2937,19 +2937,18 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) · 13 unmodified lines | |||
| 2937 | vmx->nested.apic_access_page = NULL; | 2937 | vmx->nested.apic_access_page = NULL; |
| 2938 | } | 2938 | } |
| 2939 | page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->apic_access_addr); | 2939 | page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->apic_access_addr); |
| 2940 | /* | ||
| 2941 | * If translation failed, no matter: This feature asks | ||
| 2942 | * to exit when accessing the given address, and if it | ||
| 2943 | * can never be accessed, this feature won't do | ||
| 2944 | * anything anyway. | ||
| 2945 | */ | ||
| 2946 | if (!is_error_page(page)) { | 2940 | if (!is_error_page(page)) { |
| 2947 | vmx->nested.apic_access_page = page; | 2941 | vmx->nested.apic_access_page = page; |
| 2948 | hpa = page_to_phys(vmx->nested.apic_access_page); | 2942 | hpa = page_to_phys(vmx->nested.apic_access_page); |
| 2949 | vmcs_write64(APIC_ACCESS_ADDR, hpa); | 2943 | vmcs_write64(APIC_ACCESS_ADDR, hpa); |
| 2950 | } else { | 2944 | } else { |
| 2951 | secondary_exec_controls_clearbit(vmx, | 2945 | pr_debug_ratelimited("%s: no backing 'struct page' for APIC-access address in vmcs12\n", |
| 2952 | SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES); | 2946 | __func__); |
| 2947 | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | ||
| 2948 | vcpu->run->internal.suberror = | ||
| 2949 | KVM_INTERNAL_ERROR_EMULATION; | ||
| 2950 | vcpu->run->internal.ndata = 0; | ||
| 2951 | return false; | ||
| 2953 | } | 2952 | } |
| 2954 | } | 2953 | } |
| 2955 | 2954 | ||
| @@ -2994,6 +2993,7 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) · 38 unmodified lines | |||
| 2994 | exec_controls_setbit(vmx, CPU_BASED_USE_MSR_BITMAPS); | 2993 | exec_controls_setbit(vmx, CPU_BASED_USE_MSR_BITMAPS); |
| 2995 | else | 2994 | else |
| 2996 | exec_controls_clearbit(vmx, CPU_BASED_USE_MSR_BITMAPS); | 2995 | exec_controls_clearbit(vmx, CPU_BASED_USE_MSR_BITMAPS); |
| 2996 | return true; | ||
| 2997 | } | 2997 | } |
| 2998 | 2998 | ||
| 2999 | /* | 2999 | /* |
| @@ -3032,13 +3032,15 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu, · 32 unmodified lines | |||
| 3032 | /* | 3032 | /* |
| 3033 | * If from_vmentry is false, this is being called from state restore (either RSM | 3033 | * If from_vmentry is false, this is being called from state restore (either RSM |
| 3034 | * or KVM_SET_NESTED_STATE). Otherwise it's called from vmlaunch/vmresume. | 3034 | * or KVM_SET_NESTED_STATE). Otherwise it's called from vmlaunch/vmresume. |
| 3035 | + * | 3035 | * |
| 3036 | + * Returns: | 3036 | * Returns: |
| 3037 | + * 0 - success, i.e. proceed with actual VMEnter | 3037 | * NVMX_ENTRY_SUCCESS: Entered VMX non-root mode |
| 3038 | + * 1 - consistency check VMExit | 3038 | * NVMX_ENTRY_VMFAIL: Consistency check VMFail |
| 3039 | + * -1 - consistency check VMFail | 3039 | * NVMX_ENTRY_VMEXIT: Consistency check VMExit |
| 3040 | * NVMX_ENTRY_KVM_INTERNAL_ERROR: KVM internal error | ||
| 3040 | */ | 3041 | */ |
| 3041 | int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry) | 3042 | enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, |
| 3043 | bool from_vmentry) | ||
| 3042 | { | 3044 | { |
| 3043 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 3045 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| 3044 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); | 3046 | struct vmcs12 *vmcs12 = get_vmcs12(vcpu); |
| @@ -3081,11 +3083,12 @@ int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry) · 36 unmodified lines | |||
| 3081 | prepare_vmcs02_early(vmx, vmcs12); | 3083 | prepare_vmcs02_early(vmx, vmcs12); |
| 3082 | 3084 | ||
| 3083 | if (from_vmentry) { | 3085 | if (from_vmentry) { |
| 3084 | nested_get_vmcs12_pages(vcpu); | 3086 | if (unlikely(!nested_get_vmcs12_pages(vcpu))) |
| 3087 | return NVMX_VMENTRY_KVM_INTERNAL_ERROR; | ||
| 3085 | 3088 | ||
| 3086 | if (nested_vmx_check_vmentry_hw(vcpu)) { | 3089 | if (nested_vmx_check_vmentry_hw(vcpu)) { |
| 3087 | vmx_switch_vmcs(vcpu, &vmx->vmcs01); | 3090 | vmx_switch_vmcs(vcpu, &vmx->vmcs01); |
| 3088 | return -1; | 3091 | return NVMX_VMENTRY_VMFAIL; |
| 3089 | } | 3092 | } |
| 3090 | 3093 | ||
| 3091 | if (nested_vmx_check_guest_state(vcpu, vmcs12, &exit_qual)) | 3094 | if (nested_vmx_check_guest_state(vcpu, vmcs12, &exit_qual)) |
| @@ -3149,7 +3152,7 @@ int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry) · 57 unmodified lines | |||
| 3149 | * returned as far as L1 is concerned. It will only return (and set | 3152 | * returned as far as L1 is concerned. It will only return (and set |
| 3150 | * the success flag) when L2 exits (see nested_vmx_vmexit()). | 3153 | * the success flag) when L2 exits (see nested_vmx_vmexit()). |
| 3151 | */ | 3154 | */ |
| 3152 | return 0; | 3155 | return NVMX_VMENTRY_SUCCESS; |
| 3153 | 3156 | ||
| 3154 | /* | 3157 | /* |
| 3155 | * A failed consistency check that leads to a VMExit during L1's | 3158 | * A failed consistency check that leads to a VMExit during L1's |
| @@ -3165,14 +3168,14 @@ vmentry_fail_vmexit: · 9 unmodified lines | |||
| 3165 | vmx_switch_vmcs(vcpu, &vmx->vmcs01); | 3168 | vmx_switch_vmcs(vcpu, &vmx->vmcs01); |
| 3166 | 3169 | ||
| 3167 | if (!from_vmentry) | 3170 | if (!from_vmentry) |
| 3168 | return 1; | 3171 | return NVMX_VMENTRY_VMEXIT; |
| 3169 | 3172 | ||
| 3170 | load_vmcs12_host_state(vcpu, vmcs12); | 3173 | load_vmcs12_host_state(vcpu, vmcs12); |
| 3171 | vmcs12->vm_exit_reason = exit_reason | VMX_EXIT_REASONS_FAILED_VMENTRY; | 3174 | vmcs12->vm_exit_reason = exit_reason | VMX_EXIT_REASONS_FAILED_VMENTRY; |
| 3172 | vmcs12->exit_qualification = exit_qual; | 3175 | vmcs12->exit_qualification = exit_qual; |
| 3173 | if (enable_shadow_vmcs || vmx->nested.hv_evmcs) | 3176 | if (enable_shadow_vmcs || vmx->nested.hv_evmcs) |
| 3174 | vmx->nested.need_vmcs12_to_shadow_sync = true; | 3177 | vmx->nested.need_vmcs12_to_shadow_sync = true; |
| 3175 | return 1; | 3178 | return NVMX_VMENTRY_VMEXIT; |
| 3176 | } | 3179 | } |
| 3177 | 3180 | ||
| 3178 | /* | 3181 | /* |
| @@ -3182,9 +3185,9 @@ vmentry_fail_vmexit: · 3 unmodified lines | |||
| 3182 | static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) | 3185 | static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) |
| 3183 | { | 3186 | { |
| 3184 | struct vmcs12 *vmcs12; | 3187 | struct vmcs12 *vmcs12; |
| 3188 | enum nvmx_vmentry_status status; | ||
| 3185 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 3189 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| 3186 | u32 interrupt_shadow = vmx_get_interrupt_shadow(vcpu); | 3190 | u32 interrupt_shadow = vmx_get_interrupt_shadow(vcpu); |
| 3187 | int ret; | ||
| 3188 | 3191 | ||
| 3189 | if (!nested_vmx_check_permission(vcpu)) | 3192 | if (!nested_vmx_check_permission(vcpu)) |
| 3190 | return 1; | 3193 | return 1; |
| @@ -3244,13 +3247,9 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) · 53 unmodified lines | |||
| 3244 | * the nested entry. | 3247 | * the nested entry. |
| 3245 | */ | 3248 | */ |
| 3246 | vmx->nested.nested_run_pending = 1; | 3249 | vmx->nested.nested_run_pending = 1; |
| 3247 | ret = nested_vmx_enter_non_root_mode(vcpu, true); | 3250 | status = nested_vmx_enter_non_root_mode(vcpu, true); |
| 3248 | vmx->nested.nested_run_pending = !ret; | 3251 | if (unlikely(status != NVMX_VMENTRY_SUCCESS)) |
| 3249 | if (ret > 0) | 3252 | goto vmentry_failed; |
| 3250 | return 1; | ||
| 3251 | else if (ret) | ||
| 3252 | return nested_vmx_failValid(vcpu, | ||
| 3253 | VMXERR_ENTRY_INVALID_CONTROL_FIELD); | ||
| 3254 | 3253 | ||
| 3255 | /* Hide L1D cache contents from the nested guest. */ | 3254 | /* Hide L1D cache contents from the nested guest. */ |
| 3256 | vmx->vcpu.arch.l1tf_flush_l1d = true; | 3255 | vmx->vcpu.arch.l1tf_flush_l1d = true; |
| @@ -3281,6 +3280,15 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) · 24 unmodified lines | |||
| 3281 | return kvm_vcpu_halt(vcpu); | 3280 | return kvm_vcpu_halt(vcpu); |
| 3282 | } | 3281 | } |
| 3283 | return 1; | 3282 | return 1; |
| 3283 | |||
| 3284 | vmentry_failed: | ||
| 3285 | vmx->nested.nested_run_pending = 0; | ||
| 3286 | if (status == NVMX_VMENTRY_KVM_INTERNAL_ERROR) | ||
| 3287 | return 0; | ||
| 3288 | if (status == NVMX_VMENTRY_VMEXIT) | ||
| 3289 | return 1; | ||
| 3290 | WARN_ON_ONCE(status != NVMX_VMENTRY_VMFAIL); | ||
| 3291 | return nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD); | ||
| 3284 | } | 3292 | } |
| 3285 | 3293 | ||
| 3286 | /* | 3294 | /* |
| @@ -6,6 +6,16 @@ · 5 unmodified lines | |||
| 6 | #include "vmcs12.h" | 6 | #include "vmcs12.h" |
| 7 | #include "vmx.h" | 7 | #include "vmx.h" |
| 8 | 8 | ||
| 9 | /* | ||
| 10 | * Status returned by nested_vmx_enter_non_root_mode(): | ||
| 11 | */ | ||
| 12 | enum nvmx_vmentry_status { | ||
| 13 | NVMX_VMENTRY_SUCCESS, /* Entered VMX non-root mode */ | ||
| 14 | NVMX_VMENTRY_VMFAIL, /* Consistency check VMFail */ | ||
| 15 | NVMX_VMENTRY_VMEXIT, /* Consistency check VMExit */ | ||
| 16 | NVMX_VMENTRY_KVM_INTERNAL_ERROR,/* KVM internal error */ | ||
| 17 | }; | ||
| 18 | |||
| 9 | void vmx_leave_nested(struct kvm_vcpu *vcpu); | 19 | void vmx_leave_nested(struct kvm_vcpu *vcpu); |
| 10 | void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps, | 20 | void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps, |
| 11 | bool apicv); | 21 | bool apicv); |
| @@ -13,7 +23,8 @@ void nested_vmx_hardware_unsetup(void); · 1 unmodified line | |||
| 13 | __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *)); | 23 | __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *)); |
| 14 | void nested_vmx_vcpu_setup(void); | 24 | void nested_vmx_vcpu_setup(void); |
| 15 | void nested_vmx_free_vcpu(struct kvm_vcpu *vcpu); | 25 | void nested_vmx_free_vcpu(struct kvm_vcpu *vcpu); |
| 16 | int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry); | 26 | enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, |
| 27 | bool from_vmentry); | ||
| 17 | bool nested_vmx_exit_reflected(struct kvm_vcpu *vcpu, u32 exit_reason); | 28 | bool nested_vmx_exit_reflected(struct kvm_vcpu *vcpu, u32 exit_reason); |
| 18 | void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason, | 29 | void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason, |
| 19 | u32 exit_intr_info, unsigned long exit_qualification); | 30 | u32 exit_intr_info, unsigned long exit_qualification); |
| @@ -5543,14 +5543,6 @@ static int handle_encls(struct kvm_vcpu *vcpu) · 5542 unmodified lines | |||
| 5543 | return 1; | 5543 | return 1; |
| 5544 | } | 5544 | } |
| 5545 | 5545 | ||
| 5546 | static int handle_unexpected_vmexit(struct kvm_vcpu *vcpu) | ||
| 5547 | { | ||
| 5548 | kvm_skip_emulated_instruction(vcpu); | ||
| 5549 | WARN_ONCE(1, "Unexpected VM-Exit Reason = 0x%x", | ||
| 5550 | vmcs_read32(VM_EXIT_REASON)); | ||
| 5551 | return 1; | ||
| 5552 | } | ||
| 5553 | |||
| 5554 | /* | 5546 | /* |
| 5555 | * The exit handlers return 1 if the exit was handled fully and guest execution | 5547 | * The exit handlers return 1 if the exit was handled fully and guest execution |
| 5556 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs | 5548 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs |
| @@ -5602,15 +5594,11 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { · 45 unmodified lines | |||
| 5602 | [EXIT_REASON_INVVPID] = handle_vmx_instruction, | 5594 | [EXIT_REASON_INVVPID] = handle_vmx_instruction, |
| 5603 | [EXIT_REASON_RDRAND] = handle_invalid_op, | 5595 | [EXIT_REASON_RDRAND] = handle_invalid_op, |
| 5604 | [EXIT_REASON_RDSEED] = handle_invalid_op, | 5596 | [EXIT_REASON_RDSEED] = handle_invalid_op, |
| 5605 | [EXIT_REASON_XSAVES] = handle_unexpected_vmexit, | ||
| 5606 | [EXIT_REASON_XRSTORS] = handle_unexpected_vmexit, | ||
| 5607 | [EXIT_REASON_PML_FULL] = handle_pml_full, | 5597 | [EXIT_REASON_PML_FULL] = handle_pml_full, |
| 5608 | [EXIT_REASON_INVPCID] = handle_invpcid, | 5598 | [EXIT_REASON_INVPCID] = handle_invpcid, |
| 5609 | [EXIT_REASON_VMFUNC] = handle_vmx_instruction, | 5599 | [EXIT_REASON_VMFUNC] = handle_vmx_instruction, |
| 5610 | [EXIT_REASON_PREEMPTION_TIMER] = handle_preemption_timer, | 5600 | [EXIT_REASON_PREEMPTION_TIMER] = handle_preemption_timer, |
| 5611 | [EXIT_REASON_ENCLS] = handle_encls, | 5601 | [EXIT_REASON_ENCLS] = handle_encls, |
| 5612 | [EXIT_REASON_UMWAIT] = handle_unexpected_vmexit, | ||
| 5613 | [EXIT_REASON_TPAUSE] = handle_unexpected_vmexit, | ||
| 5614 | }; | 5602 | }; |
| 5615 | 5603 | ||
| 5616 | static const int kvm_vmx_max_exit_handlers = | 5604 | static const int kvm_vmx_max_exit_handlers = |
| @@ -360,8 +360,7 @@ EXPORT_SYMBOL_GPL(kvm_set_apic_base); · 359 unmodified lines | |||
| 360 | asmlinkage __visible void kvm_spurious_fault(void) | 360 | asmlinkage __visible void kvm_spurious_fault(void) |
| 361 | { | 361 | { |
| 362 | /* Fault while not rebooting. We want the trace. */ | 362 | /* Fault while not rebooting. We want the trace. */ |
| 363 | if (!kvm_rebooting) | 363 | BUG_ON(!kvm_rebooting); |
| 364 | BUG(); | ||
| 365 | } | 364 | } |
| 366 | EXPORT_SYMBOL_GPL(kvm_spurious_fault); | 365 | EXPORT_SYMBOL_GPL(kvm_spurious_fault); |
| 367 | 366 | ||
| @@ -2537,6 +2536,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) · 2169 unmodified lines | |||
| 2537 | static void kvmclock_reset(struct kvm_vcpu *vcpu) | 2536 | static void kvmclock_reset(struct kvm_vcpu *vcpu) |
| 2538 | { | 2537 | { |
| 2539 | vcpu->arch.pv_time_enabled = false; | 2538 | vcpu->arch.pv_time_enabled = false; |
| 2539 | vcpu->arch.time = 0; | ||
| 2540 | } | 2540 | } |
| 2541 | 2541 | ||
| 2542 | static void kvm_vcpu_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa) | 2542 | static void kvm_vcpu_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa) |
| @@ -2702,8 +2702,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 159 unmodified lines | |||
| 2702 | case MSR_KVM_SYSTEM_TIME: { | 2702 | case MSR_KVM_SYSTEM_TIME: { |
| 2703 | struct kvm_arch *ka = &vcpu->kvm->arch; | 2703 | struct kvm_arch *ka = &vcpu->kvm->arch; |
| 2704 | 2704 | ||
| 2705 | kvmclock_reset(vcpu); | ||
| 2706 | |||
| 2707 | if (vcpu->vcpu_id == 0 && !msr_info->host_initiated) { | 2705 | if (vcpu->vcpu_id == 0 && !msr_info->host_initiated) { |
| 2708 | bool tmp = (msr == MSR_KVM_SYSTEM_TIME); | 2706 | bool tmp = (msr == MSR_KVM_SYSTEM_TIME); |
| 2709 | 2707 | ||
| @@ -2717,14 +2715,13 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 7 unmodified lines | |||
| 2717 | kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu); | 2715 | kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu); |
| 2718 | 2716 | ||
| 2719 | /* we verify if the enable bit is set... */ | 2717 | /* we verify if the enable bit is set... */ |
| 2718 | vcpu->arch.pv_time_enabled = false; | ||
| 2720 | if (!(data & 1)) | 2719 | if (!(data & 1)) |
| 2721 | break; | 2720 | break; |
| 2722 | 2721 | ||
| 2723 | if (kvm_gfn_to_hva_cache_init(vcpu->kvm, | 2722 | if (!kvm_gfn_to_hva_cache_init(vcpu->kvm, |
| 2724 | &vcpu->arch.pv_time, data & ~1ULL, | 2723 | &vcpu->arch.pv_time, data & ~1ULL, |
| 2725 | sizeof(struct pvclock_vcpu_time_info))) | 2724 | sizeof(struct pvclock_vcpu_time_info))) |
| 2726 | vcpu->arch.pv_time_enabled = false; | ||
| 2727 | else | ||
| 2728 | vcpu->arch.pv_time_enabled = true; | 2725 | vcpu->arch.pv_time_enabled = true; |
| 2729 | 2726 | ||
| 2730 | break; | 2727 | break; |
| @@ -7941,8 +7938,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 5210 unmodified lines | |||
| 7941 | bool req_immediate_exit = false; | 7938 | bool req_immediate_exit = false; |
| 7942 | 7939 | ||
| 7943 | if (kvm_request_pending(vcpu)) { | 7940 | if (kvm_request_pending(vcpu)) { |
| 7944 | if (kvm_check_request(KVM_REQ_GET_VMCS12_PAGES, vcpu)) | 7941 | if (kvm_check_request(KVM_REQ_GET_VMCS12_PAGES, vcpu)) { |
| 7945 | kvm_x86_ops->get_vmcs12_pages(vcpu); | 7942 | if (unlikely(!kvm_x86_ops->get_vmcs12_pages(vcpu))) { |
| 7943 | r = 0; | ||
| 7944 | goto out; | ||
| 7945 | } | ||
| 7946 | } | ||
| 7946 | if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu)) | 7947 | if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu)) |
| 7947 | kvm_mmu_unload(vcpu); | 7948 | kvm_mmu_unload(vcpu); |
| 7948 | if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu)) | 7949 | if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu)) |
| @@ -117,6 +117,14 @@ static void __init xen_banner(void) · 116 unmodified lines | |||
| 117 | printk(KERN_INFO "Xen version: %d.%d%s%s\n", | 117 | printk(KERN_INFO "Xen version: %d.%d%s%s\n", |
| 118 | version >> 16, version & 0xffff, extra.extraversion, | 118 | version >> 16, version & 0xffff, extra.extraversion, |
| 119 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); | 119 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); |
| 120 | |||
| 121 | #ifdef CONFIG_X86_32 | ||
| 122 | pr_warn("WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!\n" | ||
| 123 | "Support for running as 32-bit PV-guest under Xen will soon be removed\n" | ||
| 124 | "from the Linux kernel!\n" | ||
| 125 | "Please use either a 64-bit kernel or switch to HVM or PVH mode!\n" | ||
| 126 | "WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!\n"); | ||
| 127 | #endif | ||
| 120 | } | 128 | } |
| 121 | 129 | ||
| 122 | static void __init xen_pv_init_platform(void) | 130 | static void __init xen_pv_init_platform(void) |
| @@ -56,7 +56,7 @@ · 55 unmodified lines | |||
| 56 | reg = <0xf0100000 0x03f00000>; | 56 | reg = <0xf0100000 0x03f00000>; |
| 57 | 57 | ||
| 58 | // BUS_ADDRESS(3) CPU_PHYSICAL(1) SIZE(2) | 58 | // BUS_ADDRESS(3) CPU_PHYSICAL(1) SIZE(2) |
| 59 | ranges = <0x01000000 0x0 0xf0000000 0xf0000000 0x0 0x00010000>, | 59 | ranges = <0x01000000 0x0 0x00000000 0xf0000000 0x0 0x00010000>, |
| 60 | <0x02000000 0x0 0xf4000000 0xf4000000 0x0 0x08000000>; | 60 | <0x02000000 0x0 0xf4000000 0xf4000000 0x0 0x08000000>; |
| 61 | 61 | ||
| 62 | // PCI_DEVICE(3) INT#(1) CONTROLLER(PHANDLE) CONTROLLER_DATA(2) | 62 | // PCI_DEVICE(3) INT#(1) CONTROLLER(PHANDLE) CONTROLLER_DATA(2) |
| @@ -148,7 +148,7 @@ static inline void change_bit(unsigned int bit, volatile unsigned long *p) · 147 unmodified lines | |||
| 148 | " getex %0\n" | 148 | " getex %0\n" |
| 149 | " beqz %0, 1b\n" | 149 | " beqz %0, 1b\n" |
| 150 | : "=&a" (tmp) | 150 | : "=&a" (tmp) |
| 151 | : "a" (~mask), "a" (p) | 151 | : "a" (mask), "a" (p) |
| 152 | : "memory"); | 152 | : "memory"); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| @@ -100,7 +100,7 @@ do { \ · 99 unmodified lines | |||
| 100 | case 4: __put_user_asm(x, ptr, retval, 4, "s32i", __cb); break; \ | 100 | case 4: __put_user_asm(x, ptr, retval, 4, "s32i", __cb); break; \ |
| 101 | case 8: { \ | 101 | case 8: { \ |
| 102 | __typeof__(*ptr) __v64 = x; \ | 102 | __typeof__(*ptr) __v64 = x; \ |
| 103 | retval = __copy_to_user(ptr, &__v64, 8); \ | 103 | retval = __copy_to_user(ptr, &__v64, 8) ? -EFAULT : 0; \ |
| 104 | break; \ | 104 | break; \ |
| 105 | } \ | 105 | } \ |
| 106 | default: __put_user_bad(); \ | 106 | default: __put_user_bad(); \ |
| @@ -132,14 +132,14 @@ do { \ · 25 unmodified lines | |||
| 132 | #define __check_align_1 "" | 132 | #define __check_align_1 "" |
| 133 | 133 | ||
| 134 | #define __check_align_2 \ | 134 | #define __check_align_2 \ |
| 135 | " _bbci.l %3, 0, 1f \n" \ | 135 | " _bbci.l %[addr], 0, 1f \n" \ |
| 136 | " movi %0, %4 \n" \ | 136 | " movi %[err], %[efault] \n" \ |
| 137 | " _j 2f \n" | 137 | " _j 2f \n" |
| 138 | 138 | ||
| 139 | #define __check_align_4 \ | 139 | #define __check_align_4 \ |
| 140 | " _bbsi.l %3, 0, 0f \n" \ | 140 | " _bbsi.l %[addr], 0, 0f \n" \ |
| 141 | " _bbci.l %3, 1, 1f \n" \ | 141 | " _bbci.l %[addr], 1, 1f \n" \ |
| 142 | "0: movi %0, %4 \n" \ | 142 | "0: movi %[err], %[efault] \n" \ |
| 143 | " _j 2f \n" | 143 | " _j 2f \n" |
| 144 | 144 | ||
| 145 | 145 | ||
| @@ -151,40 +151,40 @@ do { \ · 5 unmodified lines | |||
| 151 | * WARNING: If you modify this macro at all, verify that the | 151 | * WARNING: If you modify this macro at all, verify that the |
| 152 | * __check_align_* macros still work. | 152 | * __check_align_* macros still work. |
| 153 | */ | 153 | */ |
| 154 | #define __put_user_asm(x, addr, err, align, insn, cb) \ | 154 | #define __put_user_asm(x_, addr_, err_, align, insn, cb)\ |
| 155 | __asm__ __volatile__( \ | 155 | __asm__ __volatile__( \ |
| 156 | __check_align_##align \ | 156 | __check_align_##align \ |
| 157 | "1: "insn" %2, %3, 0 \n" \ | 157 | "1: "insn" %[x], %[addr], 0 \n" \ |
| 158 | "2: \n" \ | 158 | "2: \n" \ |
| 159 | " .section .fixup,\"ax\" \n" \ | 159 | " .section .fixup,\"ax\" \n" \ |
| 160 | " .align 4 \n" \ | 160 | " .align 4 \n" \ |
| 161 | " .literal_position \n" \ | 161 | " .literal_position \n" \ |
| 162 | "5: \n" \ | 162 | "5: \n" \ |
| 163 | " movi %1, 2b \n" \ | 163 | " movi %[tmp], 2b \n" \ |
| 164 | " movi %0, %4 \n" \ | 164 | " movi %[err], %[efault] \n" \ |
| 165 | " jx %1 \n" \ | 165 | " jx %[tmp] \n" \ |
| 166 | " .previous \n" \ | 166 | " .previous \n" \ |
| 167 | " .section __ex_table,\"a\" \n" \ | 167 | " .section __ex_table,\"a\" \n" \ |
| 168 | " .long 1b, 5b \n" \ | 168 | " .long 1b, 5b \n" \ |
| 169 | " .previous" \ | 169 | " .previous" \ |
| 170 | :"=r" (err), "=r" (cb) \ | 170 | :[err] "+r"(err_), [tmp] "=r"(cb) \ |
| 171 | :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err)) | 171 | :[x] "r"(x_), [addr] "r"(addr_), [efault] "i"(-EFAULT)) |
| 172 | 172 | ||
| 173 | #define __get_user_nocheck(x, ptr, size) \ | 173 | #define __get_user_nocheck(x, ptr, size) \ |
| 174 | ({ \ | 174 | ({ \ |
| 175 | long __gu_err, __gu_val; \ | 175 | long __gu_err; \ |
| 176 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ | 176 | __get_user_size((x), (ptr), (size), __gu_err); \ |
| 177 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ | ||
| 178 | __gu_err; \ | 177 | __gu_err; \ |
| 179 | }) | 178 | }) |
| 180 | 179 | ||
| 181 | #define __get_user_check(x, ptr, size) \ | 180 | #define __get_user_check(x, ptr, size) \ |
| 182 | ({ \ | 181 | ({ \ |
| 183 | long __gu_err = -EFAULT, __gu_val = 0; \ | 182 | long __gu_err = -EFAULT; \ |
| 184 | const __typeof__(*(ptr)) *__gu_addr = (ptr); \ | 183 | const __typeof__(*(ptr)) *__gu_addr = (ptr); \ |
| 185 | if (access_ok(__gu_addr, size)) \ | 184 | if (access_ok(__gu_addr, size)) \ |
| 186 | __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ | 185 | __get_user_size((x), __gu_addr, (size), __gu_err); \ |
| 187 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ | 186 | else \ |
| 187 | (x) = 0; \ | ||
| 188 | __gu_err; \ | 188 | __gu_err; \ |
| 189 | }) | 189 | }) |
| 190 | 190 | ||
| @@ -198,8 +198,17 @@ do { \ · 7 unmodified lines | |||
| 198 | case 1: __get_user_asm(x, ptr, retval, 1, "l8ui", __cb); break;\ | 198 | case 1: __get_user_asm(x, ptr, retval, 1, "l8ui", __cb); break;\ |
| 199 | case 2: __get_user_asm(x, ptr, retval, 2, "l16ui", __cb); break;\ | 199 | case 2: __get_user_asm(x, ptr, retval, 2, "l16ui", __cb); break;\ |
| 200 | case 4: __get_user_asm(x, ptr, retval, 4, "l32i", __cb); break;\ | 200 | case 4: __get_user_asm(x, ptr, retval, 4, "l32i", __cb); break;\ |
| 201 | case 8: retval = __copy_from_user(&x, ptr, 8); break; \ | 201 | case 8: { \ |
| 202 | default: (x) = __get_user_bad(); \ | 202 | u64 __x; \ |
| 203 | if (unlikely(__copy_from_user(&__x, ptr, 8))) { \ | ||
| 204 | retval = -EFAULT; \ | ||
| 205 | (x) = 0; \ | ||
| 206 | } else { \ | ||
| 207 | (x) = *(__force __typeof__((ptr)))&__x; \ | ||
| 208 | } \ | ||
| 209 | break; \ | ||
| 210 | } \ | ||
| 211 | default: (x) = 0; __get_user_bad(); \ | ||
| 203 | } \ | 212 | } \ |
| 204 | } while (0) | 213 | } while (0) |
| 205 | 214 | ||
| @@ -208,25 +217,28 @@ do { \ · 2 unmodified lines | |||
| 208 | * WARNING: If you modify this macro at all, verify that the | 217 | * WARNING: If you modify this macro at all, verify that the |
| 209 | * __check_align_* macros still work. | 218 | * __check_align_* macros still work. |
| 210 | */ | 219 | */ |
| 211 | #define __get_user_asm(x, addr, err, align, insn, cb) \ | 220 | #define __get_user_asm(x_, addr_, err_, align, insn, cb) \ |
| 212 | __asm__ __volatile__( \ | 221 | do { \ |
| 213 | __check_align_##align \ | 222 | u32 __x = 0; \ |
| 214 | "1: "insn" %2, %3, 0 \n" \ | 223 | __asm__ __volatile__( \ |
| 215 | "2: \n" \ | 224 | __check_align_##align \ |
| 216 | " .section .fixup,\"ax\" \n" \ | 225 | "1: "insn" %[x], %[addr], 0 \n" \ |
| 217 | " .align 4 \n" \ | 226 | "2: \n" \ |
| 218 | " .literal_position \n" \ | 227 | " .section .fixup,\"ax\" \n" \ |
| 219 | "5: \n" \ | 228 | " .align 4 \n" \ |
| 220 | " movi %1, 2b \n" \ | 229 | " .literal_position \n" \ |
| 221 | " movi %2, 0 \n" \ | 230 | "5: \n" \ |
| 222 | " movi %0, %4 \n" \ | 231 | " movi %[tmp], 2b \n" \ |
| 223 | " jx %1 \n" \ | 232 | " movi %[err], %[efault] \n" \ |
| 224 | " .previous \n" \ | 233 | " jx %[tmp] \n" \ |
| 225 | " .section __ex_table,\"a\" \n" \ | 234 | " .previous \n" \ |
| 226 | " .long 1b, 5b \n" \ | 235 | " .section __ex_table,\"a\" \n" \ |
| 227 | " .previous" \ | 236 | " .long 1b, 5b \n" \ |
| 228 | :"=r" (err), "=r" (cb), "=r" (x) \ | 237 | " .previous" \ |
| 229 | :"r" (addr), "i" (-EFAULT), "0" (err)) | 238 | :[err] "+r"(err_), [tmp] "=r"(cb), [x] "+r"(__x) \ |
| 239 | :[addr] "r"(addr_), [efault] "i"(-EFAULT)); \ | ||
| 240 | (x_) = (__force __typeof__(*(addr_)))__x; \ | ||
| 241 | } while (0) | ||
| 230 | 242 | ||
| 231 | 243 | ||
| 232 | /* | 244 | /* |
| @@ -119,13 +119,6 @@ EXPORT_SYMBOL(__invalidate_icache_range); · 118 unmodified lines | |||
| 119 | // FIXME EXPORT_SYMBOL(screen_info); | 119 | // FIXME EXPORT_SYMBOL(screen_info); |
| 120 | #endif | 120 | #endif |
| 121 | 121 | ||
| 122 | EXPORT_SYMBOL(outsb); | ||
| 123 | EXPORT_SYMBOL(outsw); | ||
| 124 | EXPORT_SYMBOL(outsl); | ||
| 125 | EXPORT_SYMBOL(insb); | ||
| 126 | EXPORT_SYMBOL(insw); | ||
| 127 | EXPORT_SYMBOL(insl); | ||
| 128 | |||
| 129 | extern long common_exception_return; | 122 | extern long common_exception_return; |
| 130 | EXPORT_SYMBOL(common_exception_return); | 123 | EXPORT_SYMBOL(common_exception_return); |
| 131 | 124 | ||
| @@ -1362,7 +1362,7 @@ int blkcg_activate_policy(struct request_queue *q, · 1361 unmodified lines | |||
| 1362 | const struct blkcg_policy *pol) | 1362 | const struct blkcg_policy *pol) |
| 1363 | { | 1363 | { |
| 1364 | struct blkg_policy_data *pd_prealloc = NULL; | 1364 | struct blkg_policy_data *pd_prealloc = NULL; |
| 1365 | struct blkcg_gq *blkg; | 1365 | struct blkcg_gq *blkg, *pinned_blkg = NULL; |
| 1366 | int ret; | 1366 | int ret; |
| 1367 | 1367 | ||
| 1368 | if (blkcg_policy_enabled(q, pol)) | 1368 | if (blkcg_policy_enabled(q, pol)) |
| @@ -1370,49 +1370,82 @@ int blkcg_activate_policy(struct request_queue *q, · 1 unmodified line | |||
| 1370 | 1370 | ||
| 1371 | if (queue_is_mq(q)) | 1371 | if (queue_is_mq(q)) |
| 1372 | blk_mq_freeze_queue(q); | 1372 | blk_mq_freeze_queue(q); |
| 1373 | pd_prealloc: | 1373 | retry: |
| 1374 | if (!pd_prealloc) { | ||
| 1375 | pd_prealloc = pol->pd_alloc_fn(GFP_KERNEL, q, &blkcg_root); | ||
| 1376 | if (!pd_prealloc) { | ||
| 1377 | ret = -ENOMEM; | ||
| 1378 | goto out_bypass_end; | ||
| 1379 | } | ||
| 1380 | } | ||
| 1381 | |||
| 1382 | spin_lock_irq(&q->queue_lock); | 1374 | spin_lock_irq(&q->queue_lock); |
| 1383 | 1375 | ||
| 1384 | /* blkg_list is pushed at the head, reverse walk to init parents first */ | 1376 | /* blkg_list is pushed at the head, reverse walk to allocate parents first */ |
| 1385 | list_for_each_entry_reverse(blkg, &q->blkg_list, q_node) { | 1377 | list_for_each_entry_reverse(blkg, &q->blkg_list, q_node) { |
| 1386 | struct blkg_policy_data *pd; | 1378 | struct blkg_policy_data *pd; |
| 1387 | 1379 | ||
| 1388 | if (blkg->pd[pol->plid]) | 1380 | if (blkg->pd[pol->plid]) |
| 1389 | continue; | 1381 | continue; |
| 1390 | 1382 | ||
| 1391 | pd = pol->pd_alloc_fn(GFP_NOWAIT | __GFP_NOWARN, q, &blkcg_root); | 1383 | /* If prealloc matches, use it; otherwise try GFP_NOWAIT */ |
| 1392 | if (!pd) | 1384 | if (blkg == pinned_blkg) { |
| 1393 | swap(pd, pd_prealloc); | 1385 | pd = pd_prealloc; |
| 1386 | pd_prealloc = NULL; | ||
| 1387 | } else { | ||
| 1388 | pd = pol->pd_alloc_fn(GFP_NOWAIT | __GFP_NOWARN, q, | ||
| 1389 | blkg->blkcg); | ||
| 1390 | } | ||
| 1391 | |||
| 1394 | if (!pd) { | 1392 | if (!pd) { |
| 1393 | /* | ||
| 1394 | * GFP_NOWAIT failed. Free the existing one and | ||
| 1395 | * prealloc for @blkg w/ GFP_KERNEL. | ||
| 1396 | */ | ||
| 1397 | if (pinned_blkg) | ||
| 1398 | blkg_put(pinned_blkg); | ||
| 1399 | blkg_get(blkg); | ||
| 1400 | pinned_blkg = blkg; | ||
| 1401 | |||
| 1395 | spin_unlock_irq(&q->queue_lock); | 1402 | spin_unlock_irq(&q->queue_lock); |
| 1396 | goto pd_prealloc; | 1403 | |
| 1404 | if (pd_prealloc) | ||
| 1405 | pol->pd_free_fn(pd_prealloc); | ||
| 1406 | pd_prealloc = pol->pd_alloc_fn(GFP_KERNEL, q, | ||
| 1407 | blkg->blkcg); | ||
| 1408 | if (pd_prealloc) | ||
| 1409 | goto retry; | ||
| 1410 | else | ||
| 1411 | goto enomem; | ||
| 1397 | } | 1412 | } |
| 1398 | 1413 | ||
| 1399 | blkg->pd[pol->plid] = pd; | 1414 | blkg->pd[pol->plid] = pd; |
| 1400 | pd->blkg = blkg; | 1415 | pd->blkg = blkg; |
| 1401 | pd->plid = pol->plid; | 1416 | pd->plid = pol->plid; |
| 1402 | if (pol->pd_init_fn) | ||
| 1403 | pol->pd_init_fn(pd); | ||
| 1404 | } | 1417 | } |
| 1405 | 1418 | ||
| 1419 | /* all allocated, init in the same order */ | ||
| 1420 | if (pol->pd_init_fn) | ||
| 1421 | list_for_each_entry_reverse(blkg, &q->blkg_list, q_node) | ||
| 1422 | pol->pd_init_fn(blkg->pd[pol->plid]); | ||
| 1423 | |||
| 1406 | __set_bit(pol->plid, q->blkcg_pols); | 1424 | __set_bit(pol->plid, q->blkcg_pols); |
| 1407 | ret = 0; | 1425 | ret = 0; |
| 1408 | 1426 | ||
| 1409 | spin_unlock_irq(&q->queue_lock); | 1427 | spin_unlock_irq(&q->queue_lock); |
| 1410 | out_bypass_end: | 1428 | out: |
| 1411 | if (queue_is_mq(q)) | 1429 | if (queue_is_mq(q)) |
| 1412 | blk_mq_unfreeze_queue(q); | 1430 | blk_mq_unfreeze_queue(q); |
| 1431 | if (pinned_blkg) | ||
| 1432 | blkg_put(pinned_blkg); | ||
| 1413 | if (pd_prealloc) | 1433 | if (pd_prealloc) |
| 1414 | pol->pd_free_fn(pd_prealloc); | 1434 | pol->pd_free_fn(pd_prealloc); |
| 1415 | return ret; | 1435 | return ret; |
| 1436 | |||
| 1437 | enomem: | ||
| 1438 | /* alloc failed, nothing's initialized yet, free everything */ | ||
| 1439 | spin_lock_irq(&q->queue_lock); | ||
| 1440 | list_for_each_entry(blkg, &q->blkg_list, q_node) { | ||
| 1441 | if (blkg->pd[pol->plid]) { | ||
| 1442 | pol->pd_free_fn(blkg->pd[pol->plid]); | ||
| 1443 | blkg->pd[pol->plid] = NULL; | ||
| 1444 | } | ||
| 1445 | } | ||
| 1446 | spin_unlock_irq(&q->queue_lock); | ||
| 1447 | ret = -ENOMEM; | ||
| 1448 | goto out; | ||
| 1416 | } | 1449 | } |
| 1417 | EXPORT_SYMBOL_GPL(blkcg_activate_policy); | 1450 | EXPORT_SYMBOL_GPL(blkcg_activate_policy); |
| 1418 | 1451 | ||
| @@ -108,16 +108,13 @@ static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos) · 107 unmodified lines | |||
| 108 | 108 | ||
| 109 | static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) | 109 | static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) |
| 110 | { | 110 | { |
| 111 | struct rq_qos *cur, *prev = NULL; | 111 | struct rq_qos **cur; |
| 112 | for (cur = q->rq_qos; cur; cur = cur->next) { | 112 | |
| 113 | if (cur == rqos) { | 113 | for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) { |
| 114 | if (prev) | 114 | if (*cur == rqos) { |
| 115 | prev->next = rqos->next; | 115 | *cur = rqos->next; |
| 116 | else | ||
| 117 | q->rq_qos = cur; | ||
| 118 | break; | 116 | break; |
| 119 | } | 117 | } |
| 120 | prev = cur; | ||
| 121 | } | 118 | } |
| 122 | 119 | ||
| 123 | blk_mq_debugfs_unregister_rqos(rqos); | 120 | blk_mq_debugfs_unregister_rqos(rqos); |
| @@ -616,7 +616,8 @@ out: · 615 unmodified lines | |||
| 616 | 616 | ||
| 617 | static inline bool elv_support_iosched(struct request_queue *q) | 617 | static inline bool elv_support_iosched(struct request_queue *q) |
| 618 | { | 618 | { |
| 619 | if (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED)) | 619 | if (!q->mq_ops || |
| 620 | (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED))) | ||
| 620 | return false; | 621 | return false; |
| 621 | return true; | 622 | return true; |
| 622 | } | 623 | } |
| @@ -905,8 +905,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr) · 904 unmodified lines | |||
| 905 | pcc_data[pcc_ss_id]->refcount--; | 905 | pcc_data[pcc_ss_id]->refcount--; |
| 906 | if (!pcc_data[pcc_ss_id]->refcount) { | 906 | if (!pcc_data[pcc_ss_id]->refcount) { |
| 907 | pcc_mbox_free_channel(pcc_data[pcc_ss_id]->pcc_channel); | 907 | pcc_mbox_free_channel(pcc_data[pcc_ss_id]->pcc_channel); |
| 908 | pcc_data[pcc_ss_id]->pcc_channel_acquired = 0; | ||
| 909 | kfree(pcc_data[pcc_ss_id]); | 908 | kfree(pcc_data[pcc_ss_id]); |
| 909 | pcc_data[pcc_ss_id] = NULL; | ||
| 910 | } | 910 | } |
| 911 | } | 911 | } |
| 912 | } | 912 | } |
| @@ -403,7 +403,7 @@ static int __init hmat_parse_proximity_domain(union acpi_subtable_headers *heade · 402 unmodified lines | |||
| 403 | pr_info("HMAT: Memory Flags:%04x Processor Domain:%d Memory Domain:%d\n", | 403 | pr_info("HMAT: Memory Flags:%04x Processor Domain:%d Memory Domain:%d\n", |
| 404 | p->flags, p->processor_PD, p->memory_PD); | 404 | p->flags, p->processor_PD, p->memory_PD); |
| 405 | 405 | ||
| 406 | if (p->flags & ACPI_HMAT_MEMORY_PD_VALID) { | 406 | if (p->flags & ACPI_HMAT_MEMORY_PD_VALID && hmat_revision == 1) { |
| 407 | target = find_mem_target(p->memory_PD); | 407 | target = find_mem_target(p->memory_PD); |
| 408 | if (!target) { | 408 | if (!target) { |
| 409 | pr_debug("HMAT: Memory Domain missing from SRAT\n"); | 409 | pr_debug("HMAT: Memory Domain missing from SRAT\n"); |
| @@ -1322,7 +1322,7 @@ static ssize_t scrub_show(struct device *dev, · 1321 unmodified lines | |||
| 1322 | nfit_device_lock(dev); | 1322 | nfit_device_lock(dev); |
| 1323 | nd_desc = dev_get_drvdata(dev); | 1323 | nd_desc = dev_get_drvdata(dev); |
| 1324 | if (!nd_desc) { | 1324 | if (!nd_desc) { |
| 1325 | device_unlock(dev); | 1325 | nfit_device_unlock(dev); |
| 1326 | return rc; | 1326 | return rc; |
| 1327 | } | 1327 | } |
| 1328 | acpi_desc = to_acpi_desc(nd_desc); | 1328 | acpi_desc = to_acpi_desc(nd_desc); |
| @@ -290,14 +290,13 @@ static int acpi_processor_notifier(struct notifier_block *nb, · 289 unmodified lines | |||
| 290 | unsigned long event, void *data) | 290 | unsigned long event, void *data) |
| 291 | { | 291 | { |
| 292 | struct cpufreq_policy *policy = data; | 292 | struct cpufreq_policy *policy = data; |
| 293 | int cpu = policy->cpu; | ||
| 294 | 293 | ||
| 295 | if (event == CPUFREQ_CREATE_POLICY) { | 294 | if (event == CPUFREQ_CREATE_POLICY) { |
| 296 | acpi_thermal_cpufreq_init(cpu); | 295 | acpi_thermal_cpufreq_init(policy); |
| 297 | acpi_processor_ppc_init(cpu); | 296 | acpi_processor_ppc_init(policy); |
| 298 | } else if (event == CPUFREQ_REMOVE_POLICY) { | 297 | } else if (event == CPUFREQ_REMOVE_POLICY) { |
| 299 | acpi_processor_ppc_exit(cpu); | 298 | acpi_processor_ppc_exit(policy); |
| 300 | acpi_thermal_cpufreq_exit(cpu); | 299 | acpi_thermal_cpufreq_exit(policy); |
| 301 | } | 300 | } |
| 302 | 301 | ||
| 303 | return 0; | 302 | return 0; |
| @@ -81,10 +81,10 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) · 80 unmodified lines | |||
| 81 | pr->performance_platform_limit = (int)ppc; | 81 | pr->performance_platform_limit = (int)ppc; |
| 82 | 82 | ||
| 83 | if (ppc >= pr->performance->state_count || | 83 | if (ppc >= pr->performance->state_count || |
| 84 | unlikely(!dev_pm_qos_request_active(&pr->perflib_req))) | 84 | unlikely(!freq_qos_request_active(&pr->perflib_req))) |
| 85 | return 0; | 85 | return 0; |
| 86 | 86 | ||
| 87 | ret = dev_pm_qos_update_request(&pr->perflib_req, | 87 | ret = freq_qos_update_request(&pr->perflib_req, |
| 88 | pr->performance->states[ppc].core_frequency * 1000); | 88 | pr->performance->states[ppc].core_frequency * 1000); |
| 89 | if (ret < 0) { | 89 | if (ret < 0) { |
| 90 | pr_warn("Failed to update perflib freq constraint: CPU%d (%d)\n", | 90 | pr_warn("Failed to update perflib freq constraint: CPU%d (%d)\n", |
| @@ -157,26 +157,28 @@ void acpi_processor_ignore_ppc_init(void) · 66 unmodified lines | |||
| 157 | ignore_ppc = 0; | 157 | ignore_ppc = 0; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | void acpi_processor_ppc_init(int cpu) | 160 | void acpi_processor_ppc_init(struct cpufreq_policy *policy) |
| 161 | { | 161 | { |
| 162 | int cpu = policy->cpu; | ||
| 162 | struct acpi_processor *pr = per_cpu(processors, cpu); | 163 | struct acpi_processor *pr = per_cpu(processors, cpu); |
| 163 | int ret; | 164 | int ret; |
| 164 | 165 | ||
| 165 | ret = dev_pm_qos_add_request(get_cpu_device(cpu), | 166 | if (!pr) |
| 166 | &pr->perflib_req, DEV_PM_QOS_MAX_FREQUENCY, | 167 | return; |
| 167 | INT_MAX); | 168 | |
| 168 | if (ret < 0) { | 169 | ret = freq_qos_add_request(&policy->constraints, &pr->perflib_req, |
| 170 | FREQ_QOS_MAX, INT_MAX); | ||
| 171 | if (ret < 0) | ||
| 169 | pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu, | 172 | pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu, |
| 170 | ret); | 173 | ret); |
| 171 | return; | ||
| 172 | } | ||
| 173 | } | 174 | } |
| 174 | 175 | ||
| 175 | void acpi_processor_ppc_exit(int cpu) | 176 | void acpi_processor_ppc_exit(struct cpufreq_policy *policy) |
| 176 | { | 177 | { |
| 177 | struct acpi_processor *pr = per_cpu(processors, cpu); | 178 | struct acpi_processor *pr = per_cpu(processors, policy->cpu); |
| 178 | 179 | ||
| 179 | dev_pm_qos_remove_request(&pr->perflib_req); | 180 | if (pr) |
| 181 | freq_qos_remove_request(&pr->perflib_req); | ||
| 180 | } | 182 | } |
| 181 | 183 | ||
| 182 | static int acpi_processor_get_performance_control(struct acpi_processor *pr) | 184 | static int acpi_processor_get_performance_control(struct acpi_processor *pr) |
| @@ -105,7 +105,7 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) · 104 unmodified lines | |||
| 105 | 105 | ||
| 106 | pr = per_cpu(processors, i); | 106 | pr = per_cpu(processors, i); |
| 107 | 107 | ||
| 108 | if (unlikely(!dev_pm_qos_request_active(&pr->thermal_req))) | 108 | if (unlikely(!freq_qos_request_active(&pr->thermal_req))) |
| 109 | continue; | 109 | continue; |
| 110 | 110 | ||
| 111 | policy = cpufreq_cpu_get(i); | 111 | policy = cpufreq_cpu_get(i); |
| @@ -116,7 +116,7 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) · 4 unmodified lines | |||
| 116 | 116 | ||
| 117 | cpufreq_cpu_put(policy); | 117 | cpufreq_cpu_put(policy); |
| 118 | 118 | ||
| 119 | ret = dev_pm_qos_update_request(&pr->thermal_req, max_freq); | 119 | ret = freq_qos_update_request(&pr->thermal_req, max_freq); |
| 120 | if (ret < 0) { | 120 | if (ret < 0) { |
| 121 | pr_warn("Failed to update thermal freq constraint: CPU%d (%d)\n", | 121 | pr_warn("Failed to update thermal freq constraint: CPU%d (%d)\n", |
| 122 | pr->id, ret); | 122 | pr->id, ret); |
| @@ -125,26 +125,28 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) · 2 unmodified lines | |||
| 125 | return 0; | 125 | return 0; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | void acpi_thermal_cpufreq_init(int cpu) | 128 | void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy) |
| 129 | { | 129 | { |
| 130 | int cpu = policy->cpu; | ||
| 130 | struct acpi_processor *pr = per_cpu(processors, cpu); | 131 | struct acpi_processor *pr = per_cpu(processors, cpu); |
| 131 | int ret; | 132 | int ret; |
| 132 | 133 | ||
| 133 | ret = dev_pm_qos_add_request(get_cpu_device(cpu), | 134 | if (!pr) |
| 134 | &pr->thermal_req, DEV_PM_QOS_MAX_FREQUENCY, | 135 | return; |
| 135 | INT_MAX); | 136 | |
| 136 | if (ret < 0) { | 137 | ret = freq_qos_add_request(&policy->constraints, &pr->thermal_req, |
| 138 | FREQ_QOS_MAX, INT_MAX); | ||
| 139 | if (ret < 0) | ||
| 137 | pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu, | 140 | pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu, |
| 138 | ret); | 141 | ret); |
| 139 | return; | ||
| 140 | } | ||
| 141 | } | 142 | } |
| 142 | 143 | ||
| 143 | void acpi_thermal_cpufreq_exit(int cpu) | 144 | void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy) |
| 144 | { | 145 | { |
| 145 | struct acpi_processor *pr = per_cpu(processors, cpu); | 146 | struct acpi_processor *pr = per_cpu(processors, policy->cpu); |
| 146 | 147 | ||
| 147 | dev_pm_qos_remove_request(&pr->thermal_req); | 148 | if (pr) |
| 149 | freq_qos_remove_request(&pr->thermal_req); | ||
| 148 | } | 150 | } |
| 149 | #else /* ! CONFIG_CPU_FREQ */ | 151 | #else /* ! CONFIG_CPU_FREQ */ |
| 150 | static int cpufreq_get_max_state(unsigned int cpu) | 152 | static int cpufreq_get_max_state(unsigned int cpu) |
| @@ -361,19 +361,6 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { · 360 unmodified lines | |||
| 361 | DMI_MATCH(DMI_PRODUCT_NAME, "80E3"), | 361 | DMI_MATCH(DMI_PRODUCT_NAME, "80E3"), |
| 362 | }, | 362 | }, |
| 363 | }, | 363 | }, |
| 364 | /* | ||
| 365 | * https://bugzilla.kernel.org/show_bug.cgi?id=196907 | ||
| 366 | * Some Dell XPS13 9360 cannot do suspend-to-idle using the Low Power | ||
| 367 | * S0 Idle firmware interface. | ||
| 368 | */ | ||
| 369 | { | ||
| 370 | .callback = init_default_s3, | ||
| 371 | .ident = "Dell XPS13 9360", | ||
| 372 | .matches = { | ||
| 373 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
| 374 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9360"), | ||
| 375 | }, | ||
| 376 | }, | ||
| 377 | /* | 364 | /* |
| 378 | * ThinkPad X1 Tablet(2016) cannot do suspend-to-idle using | 365 | * ThinkPad X1 Tablet(2016) cannot do suspend-to-idle using |
| 379 | * the Low Power S0 Idle firmware interface (see | 366 | * the Low Power S0 Idle firmware interface (see |
| @@ -409,9 +409,11 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent) · 408 unmodified lines | |||
| 409 | */ | 409 | */ |
| 410 | rstc = of_reset_control_array_get_optional_shared(dev->dev.of_node); | 410 | rstc = of_reset_control_array_get_optional_shared(dev->dev.of_node); |
| 411 | if (IS_ERR(rstc)) { | 411 | if (IS_ERR(rstc)) { |
| 412 | if (PTR_ERR(rstc) != -EPROBE_DEFER) | 412 | ret = PTR_ERR(rstc); |
| 413 | dev_err(&dev->dev, "Can't get amba reset!\n"); | 413 | if (ret != -EPROBE_DEFER) |
| 414 | return PTR_ERR(rstc); | 414 | dev_err(&dev->dev, "can't get reset: %d\n", |
| 415 | ret); | ||
| 416 | goto err_reset; | ||
| 415 | } | 417 | } |
| 416 | reset_control_deassert(rstc); | 418 | reset_control_deassert(rstc); |
| 417 | reset_control_put(rstc); | 419 | reset_control_put(rstc); |
| @@ -472,6 +474,12 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent) · 54 unmodified lines | |||
| 472 | release_resource(&dev->res); | 474 | release_resource(&dev->res); |
| 473 | err_out: | 475 | err_out: |
| 474 | return ret; | 476 | return ret; |
| 477 | |||
| 478 | err_reset: | ||
| 479 | amba_put_disable_pclk(dev); | ||
| 480 | iounmap(tmp); | ||
| 481 | dev_pm_domain_detach(&dev->dev, true); | ||
| 482 | goto err_release; | ||
| 475 | } | 483 | } |
| 476 | 484 | ||
| 477 | /* | 485 | /* |
| @@ -97,10 +97,6 @@ DEFINE_SHOW_ATTRIBUTE(proc); · 96 unmodified lines | |||
| 97 | #define SZ_1K 0x400 | 97 | #define SZ_1K 0x400 |
| 98 | #endif | 98 | #endif |
| 99 | 99 | ||
| 100 | #ifndef SZ_4M | ||
| 101 | #define SZ_4M 0x400000 | ||
| 102 | #endif | ||
| 103 | |||
| 104 | #define FORBIDDEN_MMAP_FLAGS (VM_WRITE) | 100 | #define FORBIDDEN_MMAP_FLAGS (VM_WRITE) |
| 105 | 101 | ||
| 106 | enum { | 102 | enum { |
| @@ -5177,9 +5173,6 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) · 5070 unmodified lines | |||
| 5177 | if (proc->tsk != current->group_leader) | 5173 | if (proc->tsk != current->group_leader) |
| 5178 | return -EINVAL; | 5174 | return -EINVAL; |
| 5179 | 5175 | ||
| 5180 | if ((vma->vm_end - vma->vm_start) > SZ_4M) | ||
| 5181 | vma->vm_end = vma->vm_start + SZ_4M; | ||
| 5182 | |||
| 5183 | binder_debug(BINDER_DEBUG_OPEN_CLOSE, | 5176 | binder_debug(BINDER_DEBUG_OPEN_CLOSE, |
| 5184 | "%s: %d %lx-%lx (%ld K) vma %lx pagep %lx\n", | 5177 | "%s: %d %lx-%lx (%ld K) vma %lx pagep %lx\n", |
| 5185 | __func__, proc->pid, vma->vm_start, vma->vm_end, | 5178 | __func__, proc->pid, vma->vm_start, vma->vm_end, |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | #include <asm/cacheflush.h> | 22 | #include <asm/cacheflush.h> |
| 23 | #include <linux/uaccess.h> | 23 | #include <linux/uaccess.h> |
| 24 | #include <linux/highmem.h> | 24 | #include <linux/highmem.h> |
| 25 | #include <linux/sizes.h> | ||
| 25 | #include "binder_alloc.h" | 26 | #include "binder_alloc.h" |
| 26 | #include "binder_trace.h" | 27 | #include "binder_trace.h" |
| 27 | 28 | ||
| @@ -689,7 +690,9 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, · 661 unmodified lines | |||
| 689 | alloc->buffer = (void __user *)vma->vm_start; | 690 | alloc->buffer = (void __user *)vma->vm_start; |
| 690 | mutex_unlock(&binder_alloc_mmap_lock); | 691 | mutex_unlock(&binder_alloc_mmap_lock); |
| 691 | 692 | ||
| 692 | alloc->pages = kcalloc((vma->vm_end - vma->vm_start) / PAGE_SIZE, | 693 | alloc->buffer_size = min_t(unsigned long, vma->vm_end - vma->vm_start, |
| 694 | SZ_4M); | ||
| 695 | alloc->pages = kcalloc(alloc->buffer_size / PAGE_SIZE, | ||
| 693 | sizeof(alloc->pages[0]), | 696 | sizeof(alloc->pages[0]), |
| 694 | GFP_KERNEL); | 697 | GFP_KERNEL); |
| 695 | if (alloc->pages == NULL) { | 698 | if (alloc->pages == NULL) { |
| @@ -697,7 +700,6 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, · 1 unmodified line | |||
| 697 | failure_string = "alloc page array"; | 700 | failure_string = "alloc page array"; |
| 698 | goto err_alloc_pages_failed; | 701 | goto err_alloc_pages_failed; |
| 699 | } | 702 | } |
| 700 | alloc->buffer_size = vma->vm_end - vma->vm_start; | ||
| 701 | 703 | ||
| 702 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); | 704 | buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); |
| 703 | if (!buffer) { | 705 | if (!buffer) { |
| @@ -1600,7 +1600,9 @@ static void ahci_intel_pcs_quirk(struct pci_dev *pdev, struct ahci_host_priv *hp · 1599 unmodified lines | |||
| 1600 | */ | 1600 | */ |
| 1601 | if (!id || id->vendor != PCI_VENDOR_ID_INTEL) | 1601 | if (!id || id->vendor != PCI_VENDOR_ID_INTEL) |
| 1602 | return; | 1602 | return; |
| 1603 | if (((enum board_ids) id->driver_data) < board_ahci_pcs7) | 1603 | |
| 1604 | /* Skip applying the quirk on Denverton and beyond */ | ||
| 1605 | if (((enum board_ids) id->driver_data) >= board_ahci_pcs7) | ||
| 1604 | return; | 1606 | return; |
| 1605 | 1607 | ||
| 1606 | /* | 1608 | /* |
| @@ -153,17 +153,13 @@ int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv) · 152 unmodified lines | |||
| 153 | { | 153 | { |
| 154 | int rc, i; | 154 | int rc, i; |
| 155 | 155 | ||
| 156 | if (hpriv->ahci_regulator) { | 156 | rc = regulator_enable(hpriv->ahci_regulator); |
| 157 | rc = regulator_enable(hpriv->ahci_regulator); | 157 | if (rc) |
| 158 | if (rc) | 158 | return rc; |
| 159 | return rc; | ||
| 160 | } | ||
| 161 | 159 | ||
| 162 | if (hpriv->phy_regulator) { | 160 | rc = regulator_enable(hpriv->phy_regulator); |
| 163 | rc = regulator_enable(hpriv->phy_regulator); | 161 | if (rc) |
| 164 | if (rc) | 162 | goto disable_ahci_pwrs; |
| 165 | goto disable_ahci_pwrs; | ||
| 166 | } | ||
| 167 | 163 | ||
| 168 | for (i = 0; i < hpriv->nports; i++) { | 164 | for (i = 0; i < hpriv->nports; i++) { |
| 169 | if (!hpriv->target_pwrs[i]) | 165 | if (!hpriv->target_pwrs[i]) |
| @@ -181,11 +177,9 @@ disable_target_pwrs: · 11 unmodified lines | |||
| 181 | if (hpriv->target_pwrs[i]) | 177 | if (hpriv->target_pwrs[i]) |
| 182 | regulator_disable(hpriv->target_pwrs[i]); | 178 | regulator_disable(hpriv->target_pwrs[i]); |
| 183 | 179 | ||
| 184 | if (hpriv->phy_regulator) | 180 | regulator_disable(hpriv->phy_regulator); |
| 185 | regulator_disable(hpriv->phy_regulator); | ||
| 186 | disable_ahci_pwrs: | 181 | disable_ahci_pwrs: |
| 187 | if (hpriv->ahci_regulator) | 182 | regulator_disable(hpriv->ahci_regulator); |
| 188 | regulator_disable(hpriv->ahci_regulator); | ||
| 189 | return rc; | 183 | return rc; |
| 190 | } | 184 | } |
| 191 | EXPORT_SYMBOL_GPL(ahci_platform_enable_regulators); | 185 | EXPORT_SYMBOL_GPL(ahci_platform_enable_regulators); |
| @@ -207,10 +201,8 @@ void ahci_platform_disable_regulators(struct ahci_host_priv *hpriv) · 15 unmodified lines | |||
| 207 | regulator_disable(hpriv->target_pwrs[i]); | 201 | regulator_disable(hpriv->target_pwrs[i]); |
| 208 | } | 202 | } |
| 209 | 203 | ||
| 210 | if (hpriv->ahci_regulator) | 204 | regulator_disable(hpriv->ahci_regulator); |
| 211 | regulator_disable(hpriv->ahci_regulator); | 205 | regulator_disable(hpriv->phy_regulator); |
| 212 | if (hpriv->phy_regulator) | ||
| 213 | regulator_disable(hpriv->phy_regulator); | ||
| 214 | } | 206 | } |
| 215 | EXPORT_SYMBOL_GPL(ahci_platform_disable_regulators); | 207 | EXPORT_SYMBOL_GPL(ahci_platform_disable_regulators); |
| 216 | /** | 208 | /** |
| @@ -359,7 +351,7 @@ static int ahci_platform_get_regulator(struct ahci_host_priv *hpriv, u32 port, · 142 unmodified lines | |||
| 359 | struct regulator *target_pwr; | 351 | struct regulator *target_pwr; |
| 360 | int rc = 0; | 352 | int rc = 0; |
| 361 | 353 | ||
| 362 | target_pwr = regulator_get_optional(dev, "target"); | 354 | target_pwr = regulator_get(dev, "target"); |
| 363 | 355 | ||
| 364 | if (!IS_ERR(target_pwr)) | 356 | if (!IS_ERR(target_pwr)) |
| 365 | hpriv->target_pwrs[port] = target_pwr; | 357 | hpriv->target_pwrs[port] = target_pwr; |
| @@ -436,16 +428,14 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, · 70 unmodified lines | |||
| 436 | hpriv->clks[i] = clk; | 428 | hpriv->clks[i] = clk; |
| 437 | } | 429 | } |
| 438 | 430 | ||
| 439 | hpriv->ahci_regulator = devm_regulator_get_optional(dev, "ahci"); | 431 | hpriv->ahci_regulator = devm_regulator_get(dev, "ahci"); |
| 440 | if (IS_ERR(hpriv->ahci_regulator)) { | 432 | if (IS_ERR(hpriv->ahci_regulator)) { |
| 441 | rc = PTR_ERR(hpriv->ahci_regulator); | 433 | rc = PTR_ERR(hpriv->ahci_regulator); |
| 442 | if (rc == -EPROBE_DEFER) | 434 | if (rc != 0) |
| 443 | goto err_out; | 435 | goto err_out; |
| 444 | rc = 0; | ||
| 445 | hpriv->ahci_regulator = NULL; | ||
| 446 | } | 436 | } |
| 447 | 437 | ||
| 448 | hpriv->phy_regulator = devm_regulator_get_optional(dev, "phy"); | 438 | hpriv->phy_regulator = devm_regulator_get(dev, "phy"); |
| 449 | if (IS_ERR(hpriv->phy_regulator)) { | 439 | if (IS_ERR(hpriv->phy_regulator)) { |
| 450 | rc = PTR_ERR(hpriv->phy_regulator); | 440 | rc = PTR_ERR(hpriv->phy_regulator); |
| 451 | if (rc == -EPROBE_DEFER) | 441 | if (rc == -EPROBE_DEFER) |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/acpi.h> | 11 | #include <linux/acpi.h> |
| 12 | #include <linux/cpufreq.h> | ||
| 12 | #include <linux/device.h> | 13 | #include <linux/device.h> |
| 13 | #include <linux/err.h> | 14 | #include <linux/err.h> |
| 14 | #include <linux/fwnode.h> | 15 | #include <linux/fwnode.h> |
| @@ -3179,6 +3180,8 @@ void device_shutdown(void) · 3164 unmodified lines | |||
| 3179 | wait_for_device_probe(); | 3180 | wait_for_device_probe(); |
| 3180 | device_block_probing(); | 3181 | device_block_probing(); |
| 3181 | 3182 | ||
| 3183 | cpufreq_suspend(); | ||
| 3184 | |||
| 3182 | spin_lock(&devices_kset->list_lock); | 3185 | spin_lock(&devices_kset->list_lock); |
| 3183 | /* | 3186 | /* |
| 3184 | * Walk the devices list backward, shutting down each in turn. | 3187 | * Walk the devices list backward, shutting down each in turn. |
| @@ -540,6 +540,9 @@ static ssize_t soft_offline_page_store(struct device *dev, · 539 unmodified lines | |||
| 540 | pfn >>= PAGE_SHIFT; | 540 | pfn >>= PAGE_SHIFT; |
| 541 | if (!pfn_valid(pfn)) | 541 | if (!pfn_valid(pfn)) |
| 542 | return -ENXIO; | 542 | return -ENXIO; |
| 543 | /* Only online pages can be soft-offlined (esp., not ZONE_DEVICE). */ | ||
| 544 | if (!pfn_to_online_page(pfn)) | ||
| 545 | return -EIO; | ||
| 543 | ret = soft_offline_page(pfn_to_page(pfn), 0); | 546 | ret = soft_offline_page(pfn_to_page(pfn), 0); |
| 544 | return ret == 0 ? count : ret; | 547 | return ret == 0 ? count : ret; |
| 545 | } | 548 | } |
| @@ -115,20 +115,10 @@ s32 dev_pm_qos_read_value(struct device *dev, enum dev_pm_qos_req_type type) · 114 unmodified lines | |||
| 115 | 115 | ||
| 116 | spin_lock_irqsave(&dev->power.lock, flags); | 116 | spin_lock_irqsave(&dev->power.lock, flags); |
| 117 | 117 | ||
| 118 | switch (type) { | 118 | if (type == DEV_PM_QOS_RESUME_LATENCY) { |
| 119 | case DEV_PM_QOS_RESUME_LATENCY: | ||
| 120 | ret = IS_ERR_OR_NULL(qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT | 119 | ret = IS_ERR_OR_NULL(qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT |
| 121 | : pm_qos_read_value(&qos->resume_latency); | 120 | : pm_qos_read_value(&qos->resume_latency); |
| 122 | break; | 121 | } else { |
| 123 | case DEV_PM_QOS_MIN_FREQUENCY: | ||
| 124 | ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE | ||
| 125 | : pm_qos_read_value(&qos->min_frequency); | ||
| 126 | break; | ||
| 127 | case DEV_PM_QOS_MAX_FREQUENCY: | ||
| 128 | ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE | ||
| 129 | : pm_qos_read_value(&qos->max_frequency); | ||
| 130 | break; | ||
| 131 | default: | ||
| 132 | WARN_ON(1); | 122 | WARN_ON(1); |
| 133 | ret = 0; | 123 | ret = 0; |
| 134 | } | 124 | } |
| @@ -169,14 +159,6 @@ static int apply_constraint(struct dev_pm_qos_request *req, · 34 unmodified lines | |||
| 169 | req->dev->power.set_latency_tolerance(req->dev, value); | 159 | req->dev->power.set_latency_tolerance(req->dev, value); |
| 170 | } | 160 | } |
| 171 | break; | 161 | break; |
| 172 | case DEV_PM_QOS_MIN_FREQUENCY: | ||
| 173 | ret = pm_qos_update_target(&qos->min_frequency, | ||
| 174 | &req->data.pnode, action, value); | ||
| 175 | break; | ||
| 176 | case DEV_PM_QOS_MAX_FREQUENCY: | ||
| 177 | ret = pm_qos_update_target(&qos->max_frequency, | ||
| 178 | &req->data.pnode, action, value); | ||
| 179 | break; | ||
| 180 | case DEV_PM_QOS_FLAGS: | 162 | case DEV_PM_QOS_FLAGS: |
| 181 | ret = pm_qos_update_flags(&qos->flags, &req->data.flr, | 163 | ret = pm_qos_update_flags(&qos->flags, &req->data.flr, |
| 182 | action, value); | 164 | action, value); |
| @@ -227,24 +209,6 @@ static int dev_pm_qos_constraints_allocate(struct device *dev) · 44 unmodified lines | |||
| 227 | c->no_constraint_value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT; | 209 | c->no_constraint_value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT; |
| 228 | c->type = PM_QOS_MIN; | 210 | c->type = PM_QOS_MIN; |
| 229 | 211 | ||
| 230 | c = &qos->min_frequency; | ||
| 231 | plist_head_init(&c->list); | ||
| 232 | c->target_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE; | ||
| 233 | c->default_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE; | ||
| 234 | c->no_constraint_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE; | ||
| 235 | c->type = PM_QOS_MAX; | ||
| 236 | c->notifiers = ++n; | ||
| 237 | BLOCKING_INIT_NOTIFIER_HEAD(n); | ||
| 238 | |||
| 239 | c = &qos->max_frequency; | ||
| 240 | plist_head_init(&c->list); | ||
| 241 | c->target_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE; | ||
| 242 | c->default_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE; | ||
| 243 | c->no_constraint_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE; | ||
| 244 | c->type = PM_QOS_MIN; | ||
| 245 | c->notifiers = ++n; | ||
| 246 | BLOCKING_INIT_NOTIFIER_HEAD(n); | ||
| 247 | |||
| 248 | INIT_LIST_HEAD(&qos->flags.list); | 212 | INIT_LIST_HEAD(&qos->flags.list); |
| 249 | 213 | ||
| 250 | spin_lock_irq(&dev->power.lock); | 214 | spin_lock_irq(&dev->power.lock); |
| @@ -305,18 +269,6 @@ void dev_pm_qos_constraints_destroy(struct device *dev) · 54 unmodified lines | |||
| 305 | memset(req, 0, sizeof(*req)); | 269 | memset(req, 0, sizeof(*req)); |
| 306 | } | 270 | } |
| 307 | 271 | ||
| 308 | c = &qos->min_frequency; | ||
| 309 | plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) { | ||
| 310 | apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE); | ||
| 311 | memset(req, 0, sizeof(*req)); | ||
| 312 | } | ||
| 313 | |||
| 314 | c = &qos->max_frequency; | ||
| 315 | plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) { | ||
| 316 | apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE); | ||
| 317 | memset(req, 0, sizeof(*req)); | ||
| 318 | } | ||
| 319 | |||
| 320 | f = &qos->flags; | 272 | f = &qos->flags; |
| 321 | list_for_each_entry_safe(req, tmp, &f->list, data.flr.node) { | 273 | list_for_each_entry_safe(req, tmp, &f->list, data.flr.node) { |
| 322 | apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); | 274 | apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); |
| @@ -428,8 +380,6 @@ static int __dev_pm_qos_update_request(struct dev_pm_qos_request *req, · 105 unmodified lines | |||
| 428 | switch(req->type) { | 380 | switch(req->type) { |
| 429 | case DEV_PM_QOS_RESUME_LATENCY: | 381 | case DEV_PM_QOS_RESUME_LATENCY: |
| 430 | case DEV_PM_QOS_LATENCY_TOLERANCE: | 382 | case DEV_PM_QOS_LATENCY_TOLERANCE: |
| 431 | case DEV_PM_QOS_MIN_FREQUENCY: | ||
| 432 | case DEV_PM_QOS_MAX_FREQUENCY: | ||
| 433 | curr_value = req->data.pnode.prio; | 383 | curr_value = req->data.pnode.prio; |
| 434 | break; | 384 | break; |
| 435 | case DEV_PM_QOS_FLAGS: | 385 | case DEV_PM_QOS_FLAGS: |
| @@ -557,14 +507,6 @@ int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier, · 121 unmodified lines | |||
| 557 | ret = blocking_notifier_chain_register(dev->power.qos->resume_latency.notifiers, | 507 | ret = blocking_notifier_chain_register(dev->power.qos->resume_latency.notifiers, |
| 558 | notifier); | 508 | notifier); |
| 559 | break; | 509 | break; |
| 560 | case DEV_PM_QOS_MIN_FREQUENCY: | ||
| 561 | ret = blocking_notifier_chain_register(dev->power.qos->min_frequency.notifiers, | ||
| 562 | notifier); | ||
| 563 | break; | ||
| 564 | case DEV_PM_QOS_MAX_FREQUENCY: | ||
| 565 | ret = blocking_notifier_chain_register(dev->power.qos->max_frequency.notifiers, | ||
| 566 | notifier); | ||
| 567 | break; | ||
| 568 | default: | 510 | default: |
| 569 | WARN_ON(1); | 511 | WARN_ON(1); |
| 570 | ret = -EINVAL; | 512 | ret = -EINVAL; |
| @@ -604,14 +546,6 @@ int dev_pm_qos_remove_notifier(struct device *dev, · 33 unmodified lines | |||
| 604 | ret = blocking_notifier_chain_unregister(dev->power.qos->resume_latency.notifiers, | 546 | ret = blocking_notifier_chain_unregister(dev->power.qos->resume_latency.notifiers, |
| 605 | notifier); | 547 | notifier); |
| 606 | break; | 548 | break; |
| 607 | case DEV_PM_QOS_MIN_FREQUENCY: | ||
| 608 | ret = blocking_notifier_chain_unregister(dev->power.qos->min_frequency.notifiers, | ||
| 609 | notifier); | ||
| 610 | break; | ||
| 611 | case DEV_PM_QOS_MAX_FREQUENCY: | ||
| 612 | ret = blocking_notifier_chain_unregister(dev->power.qos->max_frequency.notifiers, | ||
| 613 | notifier); | ||
| 614 | break; | ||
| 615 | default: | 549 | default: |
| 616 | WARN_ON(1); | 550 | WARN_ON(1); |
| 617 | ret = -EINVAL; | 551 | ret = -EINVAL; |
| @@ -385,17 +385,16 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req, · 384 unmodified lines | |||
| 385 | struct nbd_device *nbd = cmd->nbd; | 385 | struct nbd_device *nbd = cmd->nbd; |
| 386 | struct nbd_config *config; | 386 | struct nbd_config *config; |
| 387 | 387 | ||
| 388 | if (!mutex_trylock(&cmd->lock)) | ||
| 389 | return BLK_EH_RESET_TIMER; | ||
| 390 | |||
| 388 | if (!refcount_inc_not_zero(&nbd->config_refs)) { | 391 | if (!refcount_inc_not_zero(&nbd->config_refs)) { |
| 389 | cmd->status = BLK_STS_TIMEOUT; | 392 | cmd->status = BLK_STS_TIMEOUT; |
| 393 | mutex_unlock(&cmd->lock); | ||
| 390 | goto done; | 394 | goto done; |
| 391 | } | 395 | } |
| 392 | config = nbd->config; | 396 | config = nbd->config; |
| 393 | 397 | ||
| 394 | if (!mutex_trylock(&cmd->lock)) { | ||
| 395 | nbd_config_put(nbd); | ||
| 396 | return BLK_EH_RESET_TIMER; | ||
| 397 | } | ||
| 398 | |||
| 399 | if (config->num_connections > 1) { | 398 | if (config->num_connections > 1) { |
| 400 | dev_err_ratelimited(nbd_to_dev(nbd), | 399 | dev_err_ratelimited(nbd_to_dev(nbd), |
| 401 | "Connection timed out, retrying (%d/%d alive)\n", | 400 | "Connection timed out, retrying (%d/%d alive)\n", |
| @@ -711,6 +710,12 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index) · 309 unmodified lines | |||
| 711 | ret = -ENOENT; | 710 | ret = -ENOENT; |
| 712 | goto out; | 711 | goto out; |
| 713 | } | 712 | } |
| 713 | if (cmd->status != BLK_STS_OK) { | ||
| 714 | dev_err(disk_to_dev(nbd->disk), "Command already handled %p\n", | ||
| 715 | req); | ||
| 716 | ret = -ENOENT; | ||
| 717 | goto out; | ||
| 718 | } | ||
| 714 | if (test_bit(NBD_CMD_REQUEUED, &cmd->flags)) { | 719 | if (test_bit(NBD_CMD_REQUEUED, &cmd->flags)) { |
| 715 | dev_err(disk_to_dev(nbd->disk), "Raced with timeout on req %p\n", | 720 | dev_err(disk_to_dev(nbd->disk), "Raced with timeout on req %p\n", |
| 716 | req); | 721 | req); |
| @@ -792,7 +797,10 @@ static bool nbd_clear_req(struct request *req, void *data, bool reserved) · 75 unmodified lines | |||
| 792 | { | 797 | { |
| 793 | struct nbd_cmd *cmd = blk_mq_rq_to_pdu(req); | 798 | struct nbd_cmd *cmd = blk_mq_rq_to_pdu(req); |
| 794 | 799 | ||
| 800 | mutex_lock(&cmd->lock); | ||
| 795 | cmd->status = BLK_STS_IOERR; | 801 | cmd->status = BLK_STS_IOERR; |
| 802 | mutex_unlock(&cmd->lock); | ||
| 803 | |||
| 796 | blk_mq_complete_request(req); | 804 | blk_mq_complete_request(req); |
| 797 | return true; | 805 | return true; |
| 798 | } | 806 | } |
| @@ -972,6 +980,25 @@ static blk_status_t nbd_queue_rq(struct blk_mq_hw_ctx *hctx, · 173 unmodified lines | |||
| 972 | return ret; | 980 | return ret; |
| 973 | } | 981 | } |
| 974 | 982 | ||
| 983 | static struct socket *nbd_get_socket(struct nbd_device *nbd, unsigned long fd, | ||
| 984 | int *err) | ||
| 985 | { | ||
| 986 | struct socket *sock; | ||
| 987 | |||
| 988 | *err = 0; | ||
| 989 | sock = sockfd_lookup(fd, err); | ||
| 990 | if (!sock) | ||
| 991 | return NULL; | ||
| 992 | |||
| 993 | if (sock->ops->shutdown == sock_no_shutdown) { | ||
| 994 | dev_err(disk_to_dev(nbd->disk), "Unsupported socket: shutdown callout must be supported.\n"); | ||
| 995 | *err = -EINVAL; | ||
| 996 | return NULL; | ||
| 997 | } | ||
| 998 | |||
| 999 | return sock; | ||
| 1000 | } | ||
| 1001 | |||
| 975 | static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, | 1002 | static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, |
| 976 | bool netlink) | 1003 | bool netlink) |
| 977 | { | 1004 | { |
| @@ -981,7 +1008,7 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, · 3 unmodified lines | |||
| 981 | struct nbd_sock *nsock; | 1008 | struct nbd_sock *nsock; |
| 982 | int err; | 1009 | int err; |
| 983 | 1010 | ||
| 984 | sock = sockfd_lookup(arg, &err); | 1011 | sock = nbd_get_socket(nbd, arg, &err); |
| 985 | if (!sock) | 1012 | if (!sock) |
| 986 | return err; | 1013 | return err; |
| 987 | 1014 | ||
| @@ -1033,7 +1060,7 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg) · 45 unmodified lines | |||
| 1033 | int i; | 1060 | int i; |
| 1034 | int err; | 1061 | int err; |
| 1035 | 1062 | ||
| 1036 | sock = sockfd_lookup(arg, &err); | 1063 | sock = nbd_get_socket(nbd, arg, &err); |
| 1037 | if (!sock) | 1064 | if (!sock) |
| 1038 | return err; | 1065 | return err; |
| 1039 | 1066 | ||
| @@ -6639,10 +6639,13 @@ static int rbd_add_acquire_lock(struct rbd_device *rbd_dev) · 6638 unmodified lines | |||
| 6639 | queue_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork, 0); | 6639 | queue_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork, 0); |
| 6640 | ret = wait_for_completion_killable_timeout(&rbd_dev->acquire_wait, | 6640 | ret = wait_for_completion_killable_timeout(&rbd_dev->acquire_wait, |
| 6641 | ceph_timeout_jiffies(rbd_dev->opts->lock_timeout)); | 6641 | ceph_timeout_jiffies(rbd_dev->opts->lock_timeout)); |
| 6642 | if (ret > 0) | 6642 | if (ret > 0) { |
| 6643 | ret = rbd_dev->acquire_err; | 6643 | ret = rbd_dev->acquire_err; |
| 6644 | else if (!ret) | 6644 | } else { |
| 6645 | ret = -ETIMEDOUT; | 6645 | cancel_delayed_work_sync(&rbd_dev->lock_dwork); |
| 6646 | if (!ret) | ||
| 6647 | ret = -ETIMEDOUT; | ||
| 6648 | } | ||
| 6646 | 6649 | ||
| 6647 | if (ret) { | 6650 | if (ret) { |
| 6648 | rbd_warn(rbd_dev, "failed to acquire exclusive lock: %ld", ret); | 6651 | rbd_warn(rbd_dev, "failed to acquire exclusive lock: %ld", ret); |
| @@ -413,13 +413,14 @@ static void reset_bdev(struct zram *zram) · 412 unmodified lines | |||
| 413 | static ssize_t backing_dev_show(struct device *dev, | 413 | static ssize_t backing_dev_show(struct device *dev, |
| 414 | struct device_attribute *attr, char *buf) | 414 | struct device_attribute *attr, char *buf) |
| 415 | { | 415 | { |
| 416 | struct file *file; | ||
| 416 | struct zram *zram = dev_to_zram(dev); | 417 | struct zram *zram = dev_to_zram(dev); |
| 417 | struct file *file = zram->backing_dev; | ||
| 418 | char *p; | 418 | char *p; |
| 419 | ssize_t ret; | 419 | ssize_t ret; |
| 420 | 420 | ||
| 421 | down_read(&zram->init_lock); | 421 | down_read(&zram->init_lock); |
| 422 | if (!zram->backing_dev) { | 422 | file = zram->backing_dev; |
| 423 | if (!file) { | ||
| 423 | memcpy(buf, "none\n", 5); | 424 | memcpy(buf, "none\n", 5); |
| 424 | up_read(&zram->init_lock); | 425 | up_read(&zram->init_lock); |
| 425 | return 5; | 426 | return 5; |
| @@ -74,6 +74,7 @@ static const char * const clock_names[SYSC_MAX_CLOCKS] = { · 73 unmodified lines | |||
| 74 | * @clk_disable_quirk: module specific clock disable quirk | 74 | * @clk_disable_quirk: module specific clock disable quirk |
| 75 | * @reset_done_quirk: module specific reset done quirk | 75 | * @reset_done_quirk: module specific reset done quirk |
| 76 | * @module_enable_quirk: module specific enable quirk | 76 | * @module_enable_quirk: module specific enable quirk |
| 77 | * @module_disable_quirk: module specific disable quirk | ||
| 77 | */ | 78 | */ |
| 78 | struct sysc { | 79 | struct sysc { |
| 79 | struct device *dev; | 80 | struct device *dev; |
| @@ -100,6 +101,7 @@ struct sysc { · 20 unmodified lines | |||
| 100 | void (*clk_disable_quirk)(struct sysc *sysc); | 101 | void (*clk_disable_quirk)(struct sysc *sysc); |
| 101 | void (*reset_done_quirk)(struct sysc *sysc); | 102 | void (*reset_done_quirk)(struct sysc *sysc); |
| 102 | void (*module_enable_quirk)(struct sysc *sysc); | 103 | void (*module_enable_quirk)(struct sysc *sysc); |
| 104 | void (*module_disable_quirk)(struct sysc *sysc); | ||
| 103 | }; | 105 | }; |
| 104 | 106 | ||
| 105 | static void sysc_parse_dts_quirks(struct sysc *ddata, struct device_node *np, | 107 | static void sysc_parse_dts_quirks(struct sysc *ddata, struct device_node *np, |
| @@ -959,6 +961,9 @@ static int sysc_disable_module(struct device *dev) · 853 unmodified lines | |||
| 959 | if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV) | 961 | if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV) |
| 960 | return 0; | 962 | return 0; |
| 961 | 963 | ||
| 964 | if (ddata->module_disable_quirk) | ||
| 965 | ddata->module_disable_quirk(ddata); | ||
| 966 | |||
| 962 | regbits = ddata->cap->regbits; | 967 | regbits = ddata->cap->regbits; |
| 963 | reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]); | 968 | reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]); |
| 964 | 969 | ||
| @@ -1248,6 +1253,9 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 283 unmodified lines | |||
| 1248 | SYSC_MODULE_QUIRK_SGX), | 1253 | SYSC_MODULE_QUIRK_SGX), |
| 1249 | SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0, | 1254 | SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0, |
| 1250 | SYSC_MODULE_QUIRK_WDT), | 1255 | SYSC_MODULE_QUIRK_WDT), |
| 1256 | /* Watchdog on am3 and am4 */ | ||
| 1257 | SYSC_QUIRK("wdt", 0x44e35000, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0, | ||
| 1258 | SYSC_MODULE_QUIRK_WDT | SYSC_QUIRK_SWSUP_SIDLE), | ||
| 1251 | 1259 | ||
| 1252 | #ifdef DEBUG | 1260 | #ifdef DEBUG |
| 1253 | SYSC_QUIRK("adc", 0, 0, 0x10, -1, 0x47300001, 0xffffffff, 0), | 1261 | SYSC_QUIRK("adc", 0, 0, 0x10, -1, 0x47300001, 0xffffffff, 0), |
| @@ -1440,14 +1448,14 @@ static void sysc_reset_done_quirk_wdt(struct sysc *ddata) · 186 unmodified lines | |||
| 1440 | !(val & 0x10), 100, | 1448 | !(val & 0x10), 100, |
| 1441 | MAX_MODULE_SOFTRESET_WAIT); | 1449 | MAX_MODULE_SOFTRESET_WAIT); |
| 1442 | if (error) | 1450 | if (error) |
| 1443 | dev_warn(ddata->dev, "wdt disable spr failed\n"); | 1451 | dev_warn(ddata->dev, "wdt disable step1 failed\n"); |
| 1444 | 1452 | ||
| 1445 | sysc_write(ddata, wps, 0x5555); | 1453 | sysc_write(ddata, spr, 0x5555); |
| 1446 | error = readl_poll_timeout(ddata->module_va + wps, val, | 1454 | error = readl_poll_timeout(ddata->module_va + wps, val, |
| 1447 | !(val & 0x10), 100, | 1455 | !(val & 0x10), 100, |
| 1448 | MAX_MODULE_SOFTRESET_WAIT); | 1456 | MAX_MODULE_SOFTRESET_WAIT); |
| 1449 | if (error) | 1457 | if (error) |
| 1450 | dev_warn(ddata->dev, "wdt disable wps failed\n"); | 1458 | dev_warn(ddata->dev, "wdt disable step2 failed\n"); |
| 1451 | } | 1459 | } |
| 1452 | 1460 | ||
| 1453 | static void sysc_init_module_quirks(struct sysc *ddata) | 1461 | static void sysc_init_module_quirks(struct sysc *ddata) |
| @@ -1471,8 +1479,10 @@ static void sysc_init_module_quirks(struct sysc *ddata) · 17 unmodified lines | |||
| 1471 | if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_SGX) | 1479 | if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_SGX) |
| 1472 | ddata->module_enable_quirk = sysc_module_enable_quirk_sgx; | 1480 | ddata->module_enable_quirk = sysc_module_enable_quirk_sgx; |
| 1473 | 1481 | ||
| 1474 | if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_WDT) | 1482 | if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_WDT) { |
| 1475 | ddata->reset_done_quirk = sysc_reset_done_quirk_wdt; | 1483 | ddata->reset_done_quirk = sysc_reset_done_quirk_wdt; |
| 1484 | ddata->module_disable_quirk = sysc_reset_done_quirk_wdt; | ||
| 1485 | } | ||
| 1476 | } | 1486 | } |
| 1477 | 1487 | ||
| 1478 | static int sysc_clockdomain_init(struct sysc *ddata) | 1488 | static int sysc_clockdomain_init(struct sysc *ddata) |
| @@ -720,7 +720,7 @@ static ssize_t store_##file_name \ · 719 unmodified lines | |||
| 720 | if (ret != 1) \ | 720 | if (ret != 1) \ |
| 721 | return -EINVAL; \ | 721 | return -EINVAL; \ |
| 722 | \ | 722 | \ |
| 723 | ret = dev_pm_qos_update_request(policy->object##_freq_req, val);\ | 723 | ret = freq_qos_update_request(policy->object##_freq_req, val);\ |
| 724 | return ret >= 0 ? count : ret; \ | 724 | return ret >= 0 ? count : ret; \ |
| 725 | } | 725 | } |
| 726 | 726 | ||
| @@ -1202,19 +1202,21 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) · 475 unmodified lines | |||
| 1202 | goto err_free_real_cpus; | 1202 | goto err_free_real_cpus; |
| 1203 | } | 1203 | } |
| 1204 | 1204 | ||
| 1205 | freq_constraints_init(&policy->constraints); | ||
| 1206 | |||
| 1205 | policy->nb_min.notifier_call = cpufreq_notifier_min; | 1207 | policy->nb_min.notifier_call = cpufreq_notifier_min; |
| 1206 | policy->nb_max.notifier_call = cpufreq_notifier_max; | 1208 | policy->nb_max.notifier_call = cpufreq_notifier_max; |
| 1207 | 1209 | ||
| 1208 | ret = dev_pm_qos_add_notifier(dev, &policy->nb_min, | 1210 | ret = freq_qos_add_notifier(&policy->constraints, FREQ_QOS_MIN, |
| 1209 | DEV_PM_QOS_MIN_FREQUENCY); | 1211 | &policy->nb_min); |
| 1210 | if (ret) { | 1212 | if (ret) { |
| 1211 | dev_err(dev, "Failed to register MIN QoS notifier: %d (%*pbl)\n", | 1213 | dev_err(dev, "Failed to register MIN QoS notifier: %d (%*pbl)\n", |
| 1212 | ret, cpumask_pr_args(policy->cpus)); | 1214 | ret, cpumask_pr_args(policy->cpus)); |
| 1213 | goto err_kobj_remove; | 1215 | goto err_kobj_remove; |
| 1214 | } | 1216 | } |
| 1215 | 1217 | ||
| 1216 | ret = dev_pm_qos_add_notifier(dev, &policy->nb_max, | 1218 | ret = freq_qos_add_notifier(&policy->constraints, FREQ_QOS_MAX, |
| 1217 | DEV_PM_QOS_MAX_FREQUENCY); | 1219 | &policy->nb_max); |
| 1218 | if (ret) { | 1220 | if (ret) { |
| 1219 | dev_err(dev, "Failed to register MAX QoS notifier: %d (%*pbl)\n", | 1221 | dev_err(dev, "Failed to register MAX QoS notifier: %d (%*pbl)\n", |
| 1220 | ret, cpumask_pr_args(policy->cpus)); | 1222 | ret, cpumask_pr_args(policy->cpus)); |
| @@ -1232,8 +1234,8 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) · 11 unmodified lines | |||
| 1232 | return policy; | 1234 | return policy; |
| 1233 | 1235 | ||
| 1234 | err_min_qos_notifier: | 1236 | err_min_qos_notifier: |
| 1235 | dev_pm_qos_remove_notifier(dev, &policy->nb_min, | 1237 | freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MIN, |
| 1236 | DEV_PM_QOS_MIN_FREQUENCY); | 1238 | &policy->nb_min); |
| 1237 | err_kobj_remove: | 1239 | err_kobj_remove: |
| 1238 | cpufreq_policy_put_kobj(policy); | 1240 | cpufreq_policy_put_kobj(policy); |
| 1239 | err_free_real_cpus: | 1241 | err_free_real_cpus: |
| @@ -1250,7 +1252,6 @@ err_free_policy: · 10 unmodified lines | |||
| 1250 | 1252 | ||
| 1251 | static void cpufreq_policy_free(struct cpufreq_policy *policy) | 1253 | static void cpufreq_policy_free(struct cpufreq_policy *policy) |
| 1252 | { | 1254 | { |
| 1253 | struct device *dev = get_cpu_device(policy->cpu); | ||
| 1254 | unsigned long flags; | 1255 | unsigned long flags; |
| 1255 | int cpu; | 1256 | int cpu; |
| 1256 | 1257 | ||
| @@ -1262,10 +1263,13 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) · 5 unmodified lines | |||
| 1262 | per_cpu(cpufreq_cpu_data, cpu) = NULL; | 1263 | per_cpu(cpufreq_cpu_data, cpu) = NULL; |
| 1263 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1264 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
| 1264 | 1265 | ||
| 1265 | dev_pm_qos_remove_notifier(dev, &policy->nb_max, | 1266 | freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MAX, |
| 1266 | DEV_PM_QOS_MAX_FREQUENCY); | 1267 | &policy->nb_max); |
| 1267 | dev_pm_qos_remove_notifier(dev, &policy->nb_min, | 1268 | freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MIN, |
| 1268 | DEV_PM_QOS_MIN_FREQUENCY); | 1269 | &policy->nb_min); |
| 1270 | |||
| 1271 | /* Cancel any pending policy->update work before freeing the policy. */ | ||
| 1272 | cancel_work_sync(&policy->update); | ||
| 1269 | 1273 | ||
| 1270 | if (policy->max_freq_req) { | 1274 | if (policy->max_freq_req) { |
| 1271 | /* | 1275 | /* |
| @@ -1274,10 +1278,10 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) · 2 unmodified lines | |||
| 1274 | */ | 1278 | */ |
| 1275 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, | 1279 | blocking_notifier_call_chain(&cpufreq_policy_notifier_list, |
| 1276 | CPUFREQ_REMOVE_POLICY, policy); | 1280 | CPUFREQ_REMOVE_POLICY, policy); |
| 1277 | dev_pm_qos_remove_request(policy->max_freq_req); | 1281 | freq_qos_remove_request(policy->max_freq_req); |
| 1278 | } | 1282 | } |
| 1279 | 1283 | ||
| 1280 | dev_pm_qos_remove_request(policy->min_freq_req); | 1284 | freq_qos_remove_request(policy->min_freq_req); |
| 1281 | kfree(policy->min_freq_req); | 1285 | kfree(policy->min_freq_req); |
| 1282 | 1286 | ||
| 1283 | cpufreq_policy_put_kobj(policy); | 1287 | cpufreq_policy_put_kobj(policy); |
| @@ -1357,8 +1361,6 @@ static int cpufreq_online(unsigned int cpu) · 73 unmodified lines | |||
| 1357 | cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); | 1361 | cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); |
| 1358 | 1362 | ||
| 1359 | if (new_policy) { | 1363 | if (new_policy) { |
| 1360 | struct device *dev = get_cpu_device(cpu); | ||
| 1361 | |||
| 1362 | for_each_cpu(j, policy->related_cpus) { | 1364 | for_each_cpu(j, policy->related_cpus) { |
| 1363 | per_cpu(cpufreq_cpu_data, j) = policy; | 1365 | per_cpu(cpufreq_cpu_data, j) = policy; |
| 1364 | add_cpu_dev_symlink(policy, j); | 1366 | add_cpu_dev_symlink(policy, j); |
| @@ -1369,36 +1371,31 @@ static int cpufreq_online(unsigned int cpu) · 4 unmodified lines | |||
| 1369 | if (!policy->min_freq_req) | 1371 | if (!policy->min_freq_req) |
| 1370 | goto out_destroy_policy; | 1372 | goto out_destroy_policy; |
| 1371 | 1373 | ||
| 1372 | ret = dev_pm_qos_add_request(dev, policy->min_freq_req, | 1374 | ret = freq_qos_add_request(&policy->constraints, |
| 1373 | DEV_PM_QOS_MIN_FREQUENCY, | 1375 | policy->min_freq_req, FREQ_QOS_MIN, |
| 1374 | policy->min); | 1376 | policy->min); |
| 1375 | if (ret < 0) { | 1377 | if (ret < 0) { |
| 1376 | /* | 1378 | /* |
| 1377 | * So we don't call dev_pm_qos_remove_request() for an | 1379 | * So we don't call freq_qos_remove_request() for an |
| 1378 | * uninitialized request. | 1380 | * uninitialized request. |
| 1379 | */ | 1381 | */ |
| 1380 | kfree(policy->min_freq_req); | 1382 | kfree(policy->min_freq_req); |
| 1381 | policy->min_freq_req = NULL; | 1383 | policy->min_freq_req = NULL; |
| 1382 | |||
| 1383 | dev_err(dev, "Failed to add min-freq constraint (%d)\n", | ||
| 1384 | ret); | ||
| 1385 | goto out_destroy_policy; | 1384 | goto out_destroy_policy; |
| 1386 | } | 1385 | } |
| 1387 | 1386 | ||
| 1388 | /* | 1387 | /* |
| 1389 | * This must be initialized right here to avoid calling | 1388 | * This must be initialized right here to avoid calling |
| 1390 | * dev_pm_qos_remove_request() on uninitialized request in case | 1389 | * freq_qos_remove_request() on uninitialized request in case |
| 1391 | * of errors. | 1390 | * of errors. |
| 1392 | */ | 1391 | */ |
| 1393 | policy->max_freq_req = policy->min_freq_req + 1; | 1392 | policy->max_freq_req = policy->min_freq_req + 1; |
| 1394 | 1393 | ||
| 1395 | ret = dev_pm_qos_add_request(dev, policy->max_freq_req, | 1394 | ret = freq_qos_add_request(&policy->constraints, |
| 1396 | DEV_PM_QOS_MAX_FREQUENCY, | 1395 | policy->max_freq_req, FREQ_QOS_MAX, |
| 1397 | policy->max); | 1396 | policy->max); |
| 1398 | if (ret < 0) { | 1397 | if (ret < 0) { |
| 1399 | policy->max_freq_req = NULL; | 1398 | policy->max_freq_req = NULL; |
| 1400 | dev_err(dev, "Failed to add max-freq constraint (%d)\n", | ||
| 1401 | ret); | ||
| 1402 | goto out_destroy_policy; | 1399 | goto out_destroy_policy; |
| 1403 | } | 1400 | } |
| 1404 | 1401 | ||
| @@ -2374,7 +2371,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, · 969 unmodified lines | |||
| 2374 | struct cpufreq_policy *new_policy) | 2371 | struct cpufreq_policy *new_policy) |
| 2375 | { | 2372 | { |
| 2376 | struct cpufreq_governor *old_gov; | 2373 | struct cpufreq_governor *old_gov; |
| 2377 | struct device *cpu_dev = get_cpu_device(policy->cpu); | ||
| 2378 | int ret; | 2374 | int ret; |
| 2379 | 2375 | ||
| 2380 | pr_debug("setting new policy for CPU %u: %u - %u kHz\n", | 2376 | pr_debug("setting new policy for CPU %u: %u - %u kHz\n", |
| @@ -2386,8 +2382,8 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, · 5 unmodified lines | |||
| 2386 | * PM QoS framework collects all the requests from users and provide us | 2382 | * PM QoS framework collects all the requests from users and provide us |
| 2387 | * the final aggregated value here. | 2383 | * the final aggregated value here. |
| 2388 | */ | 2384 | */ |
| 2389 | new_policy->min = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MIN_FREQUENCY); | 2385 | new_policy->min = freq_qos_read_value(&policy->constraints, FREQ_QOS_MIN); |
| 2390 | new_policy->max = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MAX_FREQUENCY); | 2386 | new_policy->max = freq_qos_read_value(&policy->constraints, FREQ_QOS_MAX); |
| 2391 | 2387 | ||
| 2392 | /* verify the cpu speed can be set within this limit */ | 2388 | /* verify the cpu speed can be set within this limit */ |
| 2393 | ret = cpufreq_driver->verify(new_policy); | 2389 | ret = cpufreq_driver->verify(new_policy); |
| @@ -2518,7 +2514,7 @@ static int cpufreq_boost_set_sw(int state) · 124 unmodified lines | |||
| 2518 | break; | 2514 | break; |
| 2519 | } | 2515 | } |
| 2520 | 2516 | ||
| 2521 | ret = dev_pm_qos_update_request(policy->max_freq_req, policy->max); | 2517 | ret = freq_qos_update_request(policy->max_freq_req, policy->max); |
| 2522 | if (ret < 0) | 2518 | if (ret < 0) |
| 2523 | break; | 2519 | break; |
| 2524 | } | 2520 | } |
| @@ -2737,14 +2733,6 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) · 212 unmodified lines | |||
| 2737 | } | 2733 | } |
| 2738 | EXPORT_SYMBOL_GPL(cpufreq_unregister_driver); | 2734 | EXPORT_SYMBOL_GPL(cpufreq_unregister_driver); |
| 2739 | 2735 | ||
| 2740 | /* | ||
| 2741 | * Stop cpufreq at shutdown to make sure it isn't holding any locks | ||
| 2742 | * or mutexes when secondary CPUs are halted. | ||
| 2743 | */ | ||
| 2744 | static struct syscore_ops cpufreq_syscore_ops = { | ||
| 2745 | .shutdown = cpufreq_suspend, | ||
| 2746 | }; | ||
| 2747 | |||
| 2748 | struct kobject *cpufreq_global_kobject; | 2736 | struct kobject *cpufreq_global_kobject; |
| 2749 | EXPORT_SYMBOL(cpufreq_global_kobject); | 2737 | EXPORT_SYMBOL(cpufreq_global_kobject); |
| 2750 | 2738 | ||
| @@ -2756,8 +2744,6 @@ static int __init cpufreq_core_init(void) · 5 unmodified lines | |||
| 2756 | cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj); | 2744 | cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj); |
| 2757 | BUG_ON(!cpufreq_global_kobject); | 2745 | BUG_ON(!cpufreq_global_kobject); |
| 2758 | 2746 | ||
| 2759 | register_syscore_ops(&cpufreq_syscore_ops); | ||
| 2760 | |||
| 2761 | return 0; | 2747 | return 0; |
| 2762 | } | 2748 | } |
| 2763 | module_param(off, int, 0444); | 2749 | module_param(off, int, 0444); |
| @@ -1088,10 +1088,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, · 1087 unmodified lines | |||
| 1088 | 1088 | ||
| 1089 | static struct cpufreq_driver intel_pstate; | 1089 | static struct cpufreq_driver intel_pstate; |
| 1090 | 1090 | ||
| 1091 | static void update_qos_request(enum dev_pm_qos_req_type type) | 1091 | static void update_qos_request(enum freq_qos_req_type type) |
| 1092 | { | 1092 | { |
| 1093 | int max_state, turbo_max, freq, i, perf_pct; | 1093 | int max_state, turbo_max, freq, i, perf_pct; |
| 1094 | struct dev_pm_qos_request *req; | 1094 | struct freq_qos_request *req; |
| 1095 | struct cpufreq_policy *policy; | 1095 | struct cpufreq_policy *policy; |
| 1096 | 1096 | ||
| 1097 | for_each_possible_cpu(i) { | 1097 | for_each_possible_cpu(i) { |
| @@ -1112,7 +1112,7 @@ static void update_qos_request(enum dev_pm_qos_req_type type) · 14 unmodified lines | |||
| 1112 | else | 1112 | else |
| 1113 | turbo_max = cpu->pstate.turbo_pstate; | 1113 | turbo_max = cpu->pstate.turbo_pstate; |
| 1114 | 1114 | ||
| 1115 | if (type == DEV_PM_QOS_MIN_FREQUENCY) { | 1115 | if (type == FREQ_QOS_MIN) { |
| 1116 | perf_pct = global.min_perf_pct; | 1116 | perf_pct = global.min_perf_pct; |
| 1117 | } else { | 1117 | } else { |
| 1118 | req++; | 1118 | req++; |
| @@ -1122,7 +1122,7 @@ static void update_qos_request(enum dev_pm_qos_req_type type) · 3 unmodified lines | |||
| 1122 | freq = DIV_ROUND_UP(turbo_max * perf_pct, 100); | 1122 | freq = DIV_ROUND_UP(turbo_max * perf_pct, 100); |
| 1123 | freq *= cpu->pstate.scaling; | 1123 | freq *= cpu->pstate.scaling; |
| 1124 | 1124 | ||
| 1125 | if (dev_pm_qos_update_request(req, freq) < 0) | 1125 | if (freq_qos_update_request(req, freq) < 0) |
| 1126 | pr_warn("Failed to update freq constraint: CPU%d\n", i); | 1126 | pr_warn("Failed to update freq constraint: CPU%d\n", i); |
| 1127 | } | 1127 | } |
| 1128 | } | 1128 | } |
| @@ -1153,7 +1153,7 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct kobj_attribute *b, · 24 unmodified lines | |||
| 1153 | if (intel_pstate_driver == &intel_pstate) | 1153 | if (intel_pstate_driver == &intel_pstate) |
| 1154 | intel_pstate_update_policies(); | 1154 | intel_pstate_update_policies(); |
| 1155 | else | 1155 | else |
| 1156 | update_qos_request(DEV_PM_QOS_MAX_FREQUENCY); | 1156 | update_qos_request(FREQ_QOS_MAX); |
| 1157 | 1157 | ||
| 1158 | mutex_unlock(&intel_pstate_driver_lock); | 1158 | mutex_unlock(&intel_pstate_driver_lock); |
| 1159 | 1159 | ||
| @@ -1187,7 +1187,7 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct kobj_attribute *b, · 27 unmodified lines | |||
| 1187 | if (intel_pstate_driver == &intel_pstate) | 1187 | if (intel_pstate_driver == &intel_pstate) |
| 1188 | intel_pstate_update_policies(); | 1188 | intel_pstate_update_policies(); |
| 1189 | else | 1189 | else |
| 1190 | update_qos_request(DEV_PM_QOS_MIN_FREQUENCY); | 1190 | update_qos_request(FREQ_QOS_MIN); |
| 1191 | 1191 | ||
| 1192 | mutex_unlock(&intel_pstate_driver_lock); | 1192 | mutex_unlock(&intel_pstate_driver_lock); |
| 1193 | 1193 | ||
| @@ -2381,7 +2381,7 @@ static unsigned int intel_cpufreq_fast_switch(struct cpufreq_policy *policy, · 1187 unmodified lines | |||
| 2381 | static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy) | 2381 | static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy) |
| 2382 | { | 2382 | { |
| 2383 | int max_state, turbo_max, min_freq, max_freq, ret; | 2383 | int max_state, turbo_max, min_freq, max_freq, ret; |
| 2384 | struct dev_pm_qos_request *req; | 2384 | struct freq_qos_request *req; |
| 2385 | struct cpudata *cpu; | 2385 | struct cpudata *cpu; |
| 2386 | struct device *dev; | 2386 | struct device *dev; |
| 2387 | 2387 | ||
| @@ -2416,15 +2416,15 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy) · 28 unmodified lines | |||
| 2416 | max_freq = DIV_ROUND_UP(turbo_max * global.max_perf_pct, 100); | 2416 | max_freq = DIV_ROUND_UP(turbo_max * global.max_perf_pct, 100); |
| 2417 | max_freq *= cpu->pstate.scaling; | 2417 | max_freq *= cpu->pstate.scaling; |
| 2418 | 2418 | ||
| 2419 | ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_MIN_FREQUENCY, | 2419 | ret = freq_qos_add_request(&policy->constraints, req, FREQ_QOS_MIN, |
| 2420 | min_freq); | 2420 | min_freq); |
| 2421 | if (ret < 0) { | 2421 | if (ret < 0) { |
| 2422 | dev_err(dev, "Failed to add min-freq constraint (%d)\n", ret); | 2422 | dev_err(dev, "Failed to add min-freq constraint (%d)\n", ret); |
| 2423 | goto free_req; | 2423 | goto free_req; |
| 2424 | } | 2424 | } |
| 2425 | 2425 | ||
| 2426 | ret = dev_pm_qos_add_request(dev, req + 1, DEV_PM_QOS_MAX_FREQUENCY, | 2426 | ret = freq_qos_add_request(&policy->constraints, req + 1, FREQ_QOS_MAX, |
| 2427 | max_freq); | 2427 | max_freq); |
| 2428 | if (ret < 0) { | 2428 | if (ret < 0) { |
| 2429 | dev_err(dev, "Failed to add max-freq constraint (%d)\n", ret); | 2429 | dev_err(dev, "Failed to add max-freq constraint (%d)\n", ret); |
| 2430 | goto remove_min_req; | 2430 | goto remove_min_req; |
| @@ -2435,7 +2435,7 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy) · 4 unmodified lines | |||
| 2435 | return 0; | 2435 | return 0; |
| 2436 | 2436 | ||
| 2437 | remove_min_req: | 2437 | remove_min_req: |
| 2438 | dev_pm_qos_remove_request(req); | 2438 | freq_qos_remove_request(req); |
| 2439 | free_req: | 2439 | free_req: |
| 2440 | kfree(req); | 2440 | kfree(req); |
| 2441 | pstate_exit: | 2441 | pstate_exit: |
| @@ -2446,12 +2446,12 @@ pstate_exit: · 4 unmodified lines | |||
| 2446 | 2446 | ||
| 2447 | static int intel_cpufreq_cpu_exit(struct cpufreq_policy *policy) | 2447 | static int intel_cpufreq_cpu_exit(struct cpufreq_policy *policy) |
| 2448 | { | 2448 | { |
| 2449 | struct dev_pm_qos_request *req; | 2449 | struct freq_qos_request *req; |
| 2450 | 2450 | ||
| 2451 | req = policy->driver_data; | 2451 | req = policy->driver_data; |
| 2452 | 2452 | ||
| 2453 | dev_pm_qos_remove_request(req + 1); | 2453 | freq_qos_remove_request(req + 1); |
| 2454 | dev_pm_qos_remove_request(req); | 2454 | freq_qos_remove_request(req); |
| 2455 | kfree(req); | 2455 | kfree(req); |
| 2456 | 2456 | ||
| 2457 | return intel_pstate_cpu_exit(policy); | 2457 | return intel_pstate_cpu_exit(policy); |
| @@ -65,7 +65,7 @@ EXPORT_SYMBOL_GPL(cbe_cpufreq_set_pmode_pmi); · 64 unmodified lines | |||
| 65 | static void cbe_cpufreq_handle_pmi(pmi_message_t pmi_msg) | 65 | static void cbe_cpufreq_handle_pmi(pmi_message_t pmi_msg) |
| 66 | { | 66 | { |
| 67 | struct cpufreq_policy *policy; | 67 | struct cpufreq_policy *policy; |
| 68 | struct dev_pm_qos_request *req; | 68 | struct freq_qos_request *req; |
| 69 | u8 node, slow_mode; | 69 | u8 node, slow_mode; |
| 70 | int cpu, ret; | 70 | int cpu, ret; |
| 71 | 71 | ||
| @@ -86,7 +86,7 @@ static void cbe_cpufreq_handle_pmi(pmi_message_t pmi_msg) · 14 unmodified lines | |||
| 86 | 86 | ||
| 87 | req = policy->driver_data; | 87 | req = policy->driver_data; |
| 88 | 88 | ||
| 89 | ret = dev_pm_qos_update_request(req, | 89 | ret = freq_qos_update_request(req, |
| 90 | policy->freq_table[slow_mode].frequency); | 90 | policy->freq_table[slow_mode].frequency); |
| 91 | if (ret < 0) | 91 | if (ret < 0) |
| 92 | pr_warn("Failed to update freq constraint: %d\n", ret); | 92 | pr_warn("Failed to update freq constraint: %d\n", ret); |
| @@ -103,7 +103,7 @@ static struct pmi_handler cbe_pmi_handler = { · 10 unmodified lines | |||
| 103 | 103 | ||
| 104 | void cbe_cpufreq_pmi_policy_init(struct cpufreq_policy *policy) | 104 | void cbe_cpufreq_pmi_policy_init(struct cpufreq_policy *policy) |
| 105 | { | 105 | { |
| 106 | struct dev_pm_qos_request *req; | 106 | struct freq_qos_request *req; |
| 107 | int ret; | 107 | int ret; |
| 108 | 108 | ||
| 109 | if (!cbe_cpufreq_has_pmi) | 109 | if (!cbe_cpufreq_has_pmi) |
| @@ -113,9 +113,8 @@ void cbe_cpufreq_pmi_policy_init(struct cpufreq_policy *policy) · 3 unmodified lines | |||
| 113 | if (!req) | 113 | if (!req) |
| 114 | return; | 114 | return; |
| 115 | 115 | ||
| 116 | ret = dev_pm_qos_add_request(get_cpu_device(policy->cpu), req, | 116 | ret = freq_qos_add_request(&policy->constraints, req, FREQ_QOS_MAX, |
| 117 | DEV_PM_QOS_MAX_FREQUENCY, | 117 | policy->freq_table[0].frequency); |
| 118 | policy->freq_table[0].frequency); | ||
| 119 | if (ret < 0) { | 118 | if (ret < 0) { |
| 120 | pr_err("Failed to add freq constraint (%d)\n", ret); | 119 | pr_err("Failed to add freq constraint (%d)\n", ret); |
| 121 | kfree(req); | 120 | kfree(req); |
| @@ -128,10 +127,10 @@ EXPORT_SYMBOL_GPL(cbe_cpufreq_pmi_policy_init); · 6 unmodified lines | |||
| 128 | 127 | ||
| 129 | void cbe_cpufreq_pmi_policy_exit(struct cpufreq_policy *policy) | 128 | void cbe_cpufreq_pmi_policy_exit(struct cpufreq_policy *policy) |
| 130 | { | 129 | { |
| 131 | struct dev_pm_qos_request *req = policy->driver_data; | 130 | struct freq_qos_request *req = policy->driver_data; |
| 132 | 131 | ||
| 133 | if (cbe_cpufreq_has_pmi) { | 132 | if (cbe_cpufreq_has_pmi) { |
| 134 | dev_pm_qos_remove_request(req); | 133 | freq_qos_remove_request(req); |
| 135 | kfree(req); | 134 | kfree(req); |
| 136 | } | 135 | } |
| 137 | } | 136 | } |
| @@ -95,6 +95,10 @@ static int __init haltpoll_init(void) · 94 unmodified lines | |||
| 95 | int ret; | 95 | int ret; |
| 96 | struct cpuidle_driver *drv = &haltpoll_driver; | 96 | struct cpuidle_driver *drv = &haltpoll_driver; |
| 97 | 97 | ||
| 98 | /* Do not load haltpoll if idle= is passed */ | ||
| 99 | if (boot_option_idle_override != IDLE_NO_OVERRIDE) | ||
| 100 | return -ENODEV; | ||
| 101 | |||
| 98 | cpuidle_poll_state_init(drv); | 102 | cpuidle_poll_state_init(drv); |
| 99 | 103 | ||
| 100 | if (!kvm_para_available() || | 104 | if (!kvm_para_available() || |
| @@ -471,7 +471,7 @@ unlock: · 470 unmodified lines | |||
| 471 | if (pfence_excl) | 471 | if (pfence_excl) |
| 472 | *pfence_excl = fence_excl; | 472 | *pfence_excl = fence_excl; |
| 473 | else if (fence_excl) | 473 | else if (fence_excl) |
| 474 | shared[++shared_count] = fence_excl; | 474 | shared[shared_count++] = fence_excl; |
| 475 | 475 | ||
| 476 | if (!shared_count) { | 476 | if (!shared_count) { |
| 477 | kfree(shared); | 477 | kfree(shared); |
| @@ -553,7 +553,11 @@ void ghes_edac_unregister(struct ghes *ghes) · 552 unmodified lines | |||
| 553 | if (!ghes_pvt) | 553 | if (!ghes_pvt) |
| 554 | return; | 554 | return; |
| 555 | 555 | ||
| 556 | if (atomic_dec_return(&ghes_init)) | ||
| 557 | return; | ||
| 558 | |||
| 556 | mci = ghes_pvt->mci; | 559 | mci = ghes_pvt->mci; |
| 560 | ghes_pvt = NULL; | ||
| 557 | edac_mc_del_mc(mci->pdev); | 561 | edac_mc_del_mc(mci->pdev); |
| 558 | edac_mc_free(mci); | 562 | edac_mc_free(mci); |
| 559 | } | 563 | } |
| @@ -408,7 +408,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v) · 407 unmodified lines | |||
| 408 | bytes = ~0ull; | 408 | bytes = ~0ull; |
| 409 | else if (size & 0x8000) | 409 | else if (size & 0x8000) |
| 410 | bytes = (u64)(size & 0x7fff) << 10; | 410 | bytes = (u64)(size & 0x7fff) << 10; |
| 411 | else if (size != 0x7fff) | 411 | else if (size != 0x7fff || dm->length < 0x20) |
| 412 | bytes = (u64)size << 20; | 412 | bytes = (u64)size << 20; |
| 413 | else | 413 | else |
| 414 | bytes = (u64)get_unaligned((u32 *)&d[0x1C]) << 20; | 414 | bytes = (u64)get_unaligned((u32 *)&d[0x1C]) << 20; |
| @@ -293,8 +293,9 @@ static void intel_mid_irq_handler(struct irq_desc *desc) · 292 unmodified lines | |||
| 293 | chip->irq_eoi(data); | 293 | chip->irq_eoi(data); |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | static void intel_mid_irq_init_hw(struct intel_mid_gpio *priv) | 296 | static int intel_mid_irq_init_hw(struct gpio_chip *chip) |
| 297 | { | 297 | { |
| 298 | struct intel_mid_gpio *priv = gpiochip_get_data(chip); | ||
| 298 | void __iomem *reg; | 299 | void __iomem *reg; |
| 299 | unsigned base; | 300 | unsigned base; |
| 300 | 301 | ||
| @@ -309,6 +310,8 @@ static void intel_mid_irq_init_hw(struct intel_mid_gpio *priv) · 8 unmodified lines | |||
| 309 | reg = gpio_reg(&priv->chip, base, GEDR); | 310 | reg = gpio_reg(&priv->chip, base, GEDR); |
| 310 | writel(~0, reg); | 311 | writel(~0, reg); |
| 311 | } | 312 | } |
| 313 | |||
| 314 | return 0; | ||
| 312 | } | 315 | } |
| 313 | 316 | ||
| 314 | static int __maybe_unused intel_gpio_runtime_idle(struct device *dev) | 317 | static int __maybe_unused intel_gpio_runtime_idle(struct device *dev) |
| @@ -372,6 +375,7 @@ static int intel_gpio_probe(struct pci_dev *pdev, · 57 unmodified lines | |||
| 372 | 375 | ||
| 373 | girq = &priv->chip.irq; | 376 | girq = &priv->chip.irq; |
| 374 | girq->chip = &intel_mid_irqchip; | 377 | girq->chip = &intel_mid_irqchip; |
| 378 | girq->init_hw = intel_mid_irq_init_hw; | ||
| 375 | girq->parent_handler = intel_mid_irq_handler; | 379 | girq->parent_handler = intel_mid_irq_handler; |
| 376 | girq->num_parents = 1; | 380 | girq->num_parents = 1; |
| 377 | girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents, | 381 | girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents, |
| @@ -384,9 +388,8 @@ static int intel_gpio_probe(struct pci_dev *pdev, · 6 unmodified lines | |||
| 384 | girq->default_type = IRQ_TYPE_NONE; | 388 | girq->default_type = IRQ_TYPE_NONE; |
| 385 | girq->handler = handle_simple_irq; | 389 | girq->handler = handle_simple_irq; |
| 386 | 390 | ||
| 387 | intel_mid_irq_init_hw(priv); | ||
| 388 | |||
| 389 | pci_set_drvdata(pdev, priv); | 391 | pci_set_drvdata(pdev, priv); |
| 392 | |||
| 390 | retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv); | 393 | retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv); |
| 391 | if (retval) { | 394 | if (retval) { |
| 392 | dev_err(&pdev->dev, "gpiochip_add error %d\n", retval); | 395 | dev_err(&pdev->dev, "gpiochip_add error %d\n", retval); |
| @@ -294,8 +294,9 @@ static struct irq_chip lp_irqchip = { · 293 unmodified lines | |||
| 294 | .flags = IRQCHIP_SKIP_SET_WAKE, | 294 | .flags = IRQCHIP_SKIP_SET_WAKE, |
| 295 | }; | 295 | }; |
| 296 | 296 | ||
| 297 | static void lp_gpio_irq_init_hw(struct lp_gpio *lg) | 297 | static int lp_gpio_irq_init_hw(struct gpio_chip *chip) |
| 298 | { | 298 | { |
| 299 | struct lp_gpio *lg = gpiochip_get_data(chip); | ||
| 299 | unsigned long reg; | 300 | unsigned long reg; |
| 300 | unsigned base; | 301 | unsigned base; |
| 301 | 302 | ||
| @@ -307,6 +308,8 @@ static void lp_gpio_irq_init_hw(struct lp_gpio *lg) · 5 unmodified lines | |||
| 307 | reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT); | 308 | reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT); |
| 308 | outl(0xffffffff, reg); | 309 | outl(0xffffffff, reg); |
| 309 | } | 310 | } |
| 311 | |||
| 312 | return 0; | ||
| 310 | } | 313 | } |
| 311 | 314 | ||
| 312 | static int lp_gpio_probe(struct platform_device *pdev) | 315 | static int lp_gpio_probe(struct platform_device *pdev) |
| @@ -364,6 +367,7 @@ static int lp_gpio_probe(struct platform_device *pdev) · 51 unmodified lines | |||
| 364 | 367 | ||
| 365 | girq = &gc->irq; | 368 | girq = &gc->irq; |
| 366 | girq->chip = &lp_irqchip; | 369 | girq->chip = &lp_irqchip; |
| 370 | girq->init_hw = lp_gpio_irq_init_hw; | ||
| 367 | girq->parent_handler = lp_gpio_irq_handler; | 371 | girq->parent_handler = lp_gpio_irq_handler; |
| 368 | girq->num_parents = 1; | 372 | girq->num_parents = 1; |
| 369 | girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents, | 373 | girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents, |
| @@ -373,9 +377,7 @@ static int lp_gpio_probe(struct platform_device *pdev) · 3 unmodified lines | |||
| 373 | return -ENOMEM; | 377 | return -ENOMEM; |
| 374 | girq->parents[0] = (unsigned)irq_rc->start; | 378 | girq->parents[0] = (unsigned)irq_rc->start; |
| 375 | girq->default_type = IRQ_TYPE_NONE; | 379 | girq->default_type = IRQ_TYPE_NONE; |
| 376 | girq->handler = handle_simple_irq; | 380 | girq->handler = handle_bad_irq; |
| 377 | |||
| 378 | lp_gpio_irq_init_hw(lg); | ||
| 379 | } | 381 | } |
| 380 | 382 | ||
| 381 | ret = devm_gpiochip_add_data(dev, gc, lg); | 383 | ret = devm_gpiochip_add_data(dev, gc, lg); |
| @@ -362,8 +362,9 @@ static void mrfld_irq_handler(struct irq_desc *desc) · 361 unmodified lines | |||
| 362 | chained_irq_exit(irqchip, desc); | 362 | chained_irq_exit(irqchip, desc); |
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | static void mrfld_irq_init_hw(struct mrfld_gpio *priv) | 365 | static int mrfld_irq_init_hw(struct gpio_chip *chip) |
| 366 | { | 366 | { |
| 367 | struct mrfld_gpio *priv = gpiochip_get_data(chip); | ||
| 367 | void __iomem *reg; | 368 | void __iomem *reg; |
| 368 | unsigned int base; | 369 | unsigned int base; |
| 369 | 370 | ||
| @@ -375,6 +376,8 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv) · 5 unmodified lines | |||
| 375 | reg = gpio_reg(&priv->chip, base, GFER); | 376 | reg = gpio_reg(&priv->chip, base, GFER); |
| 376 | writel(0, reg); | 377 | writel(0, reg); |
| 377 | } | 378 | } |
| 379 | |||
| 380 | return 0; | ||
| 378 | } | 381 | } |
| 379 | 382 | ||
| 380 | static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv) | 383 | static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv) |
| @@ -447,6 +450,7 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id · 66 unmodified lines | |||
| 447 | 450 | ||
| 448 | girq = &priv->chip.irq; | 451 | girq = &priv->chip.irq; |
| 449 | girq->chip = &mrfld_irqchip; | 452 | girq->chip = &mrfld_irqchip; |
| 453 | girq->init_hw = mrfld_irq_init_hw; | ||
| 450 | girq->parent_handler = mrfld_irq_handler; | 454 | girq->parent_handler = mrfld_irq_handler; |
| 451 | girq->num_parents = 1; | 455 | girq->num_parents = 1; |
| 452 | girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents, | 456 | girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents, |
| @@ -455,11 +459,10 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id · 2 unmodified lines | |||
| 455 | if (!girq->parents) | 459 | if (!girq->parents) |
| 456 | return -ENOMEM; | 460 | return -ENOMEM; |
| 457 | girq->parents[0] = pdev->irq; | 461 | girq->parents[0] = pdev->irq; |
| 462 | girq->first = irq_base; | ||
| 458 | girq->default_type = IRQ_TYPE_NONE; | 463 | girq->default_type = IRQ_TYPE_NONE; |
| 459 | girq->handler = handle_bad_irq; | 464 | girq->handler = handle_bad_irq; |
| 460 | 465 | ||
| 461 | mrfld_irq_init_hw(priv); | ||
| 462 | |||
| 463 | pci_set_drvdata(pdev, priv); | 466 | pci_set_drvdata(pdev, priv); |
| 464 | retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv); | 467 | retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv); |
| 465 | if (retval) { | 468 | if (retval) { |
| @@ -86,6 +86,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip, · 85 unmodified lines | |||
| 86 | struct lock_class_key *lock_key, | 86 | struct lock_class_key *lock_key, |
| 87 | struct lock_class_key *request_key); | 87 | struct lock_class_key *request_key); |
| 88 | static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip); | 88 | static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip); |
| 89 | static int gpiochip_irqchip_init_hw(struct gpio_chip *gpiochip); | ||
| 89 | static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip); | 90 | static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip); |
| 90 | static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip); | 91 | static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip); |
| 91 | 92 | ||
| @@ -1406,6 +1407,10 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 1314 unmodified lines | |||
| 1406 | 1407 | ||
| 1407 | machine_gpiochip_add(chip); | 1408 | machine_gpiochip_add(chip); |
| 1408 | 1409 | ||
| 1410 | ret = gpiochip_irqchip_init_hw(chip); | ||
| 1411 | if (ret) | ||
| 1412 | goto err_remove_acpi_chip; | ||
| 1413 | |||
| 1409 | ret = gpiochip_irqchip_init_valid_mask(chip); | 1414 | ret = gpiochip_irqchip_init_valid_mask(chip); |
| 1410 | if (ret) | 1415 | if (ret) |
| 1411 | goto err_remove_acpi_chip; | 1416 | goto err_remove_acpi_chip; |
| @@ -1622,6 +1627,16 @@ static struct gpio_chip *find_chip_by_name(const char *name) · 210 unmodified lines | |||
| 1622 | * The following is irqchip helper code for gpiochips. | 1627 | * The following is irqchip helper code for gpiochips. |
| 1623 | */ | 1628 | */ |
| 1624 | 1629 | ||
| 1630 | static int gpiochip_irqchip_init_hw(struct gpio_chip *gc) | ||
| 1631 | { | ||
| 1632 | struct gpio_irq_chip *girq = &gc->irq; | ||
| 1633 | |||
| 1634 | if (!girq->init_hw) | ||
| 1635 | return 0; | ||
| 1636 | |||
| 1637 | return girq->init_hw(gc); | ||
| 1638 | } | ||
| 1639 | |||
| 1625 | static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gc) | 1640 | static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gc) |
| 1626 | { | 1641 | { |
| 1627 | struct gpio_irq_chip *girq = &gc->irq; | 1642 | struct gpio_irq_chip *girq = &gc->irq; |
| @@ -2446,8 +2461,13 @@ static inline int gpiochip_add_irqchip(struct gpio_chip *gpiochip, · 818 unmodified lines | |||
| 2446 | { | 2461 | { |
| 2447 | return 0; | 2462 | return 0; |
| 2448 | } | 2463 | } |
| 2449 | |||
| 2450 | static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) {} | 2464 | static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) {} |
| 2465 | |||
| 2466 | static inline int gpiochip_irqchip_init_hw(struct gpio_chip *gpiochip) | ||
| 2467 | { | ||
| 2468 | return 0; | ||
| 2469 | } | ||
| 2470 | |||
| 2451 | static inline int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip) | 2471 | static inline int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip) |
| 2452 | { | 2472 | { |
| 2453 | return 0; | 2473 | return 0; |
| @@ -140,7 +140,12 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, · 139 unmodified lines | |||
| 140 | return 0; | 140 | return 0; |
| 141 | 141 | ||
| 142 | error_free: | 142 | error_free: |
| 143 | while (i--) { | 143 | for (i = 0; i < last_entry; ++i) { |
| 144 | struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo); | ||
| 145 | |||
| 146 | amdgpu_bo_unref(&bo); | ||
| 147 | } | ||
| 148 | for (i = first_userptr; i < num_entries; ++i) { | ||
| 144 | struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo); | 149 | struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo); |
| 145 | 150 | ||
| 146 | amdgpu_bo_unref(&bo); | 151 | amdgpu_bo_unref(&bo); |
| @@ -536,7 +536,6 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p, · 535 unmodified lines | |||
| 536 | 536 | ||
| 537 | list_for_each_entry(lobj, validated, tv.head) { | 537 | list_for_each_entry(lobj, validated, tv.head) { |
| 538 | struct amdgpu_bo *bo = ttm_to_amdgpu_bo(lobj->tv.bo); | 538 | struct amdgpu_bo *bo = ttm_to_amdgpu_bo(lobj->tv.bo); |
| 539 | bool binding_userptr = false; | ||
| 540 | struct mm_struct *usermm; | 539 | struct mm_struct *usermm; |
| 541 | 540 | ||
| 542 | usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm); | 541 | usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm); |
| @@ -553,7 +552,6 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p, · 10 unmodified lines | |||
| 553 | 552 | ||
| 554 | amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, | 553 | amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm, |
| 555 | lobj->user_pages); | 554 | lobj->user_pages); |
| 556 | binding_userptr = true; | ||
| 557 | } | 555 | } |
| 558 | 556 | ||
| 559 | if (p->evictable == lobj) | 557 | if (p->evictable == lobj) |
| @@ -563,10 +561,8 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p, · 3 unmodified lines | |||
| 563 | if (r) | 561 | if (r) |
| 564 | return r; | 562 | return r; |
| 565 | 563 | ||
| 566 | if (binding_userptr) { | 564 | kvfree(lobj->user_pages); |
| 567 | kvfree(lobj->user_pages); | 565 | lobj->user_pages = NULL; |
| 568 | lobj->user_pages = NULL; | ||
| 569 | } | ||
| 570 | } | 566 | } |
| 571 | return 0; | 567 | return 0; |
| 572 | } | 568 | } |
| @@ -1048,6 +1048,41 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, · 1047 unmodified lines | |||
| 1048 | return -ENODEV; | 1048 | return -ENODEV; |
| 1049 | } | 1049 | } |
| 1050 | 1050 | ||
| 1051 | #ifdef CONFIG_DRM_AMDGPU_SI | ||
| 1052 | if (!amdgpu_si_support) { | ||
| 1053 | switch (flags & AMD_ASIC_MASK) { | ||
| 1054 | case CHIP_TAHITI: | ||
| 1055 | case CHIP_PITCAIRN: | ||
| 1056 | case CHIP_VERDE: | ||
| 1057 | case CHIP_OLAND: | ||
| 1058 | case CHIP_HAINAN: | ||
| 1059 | dev_info(&pdev->dev, | ||
| 1060 | "SI support provided by radeon.\n"); | ||
| 1061 | dev_info(&pdev->dev, | ||
| 1062 | "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n" | ||
| 1063 | ); | ||
| 1064 | return -ENODEV; | ||
| 1065 | } | ||
| 1066 | } | ||
| 1067 | #endif | ||
| 1068 | #ifdef CONFIG_DRM_AMDGPU_CIK | ||
| 1069 | if (!amdgpu_cik_support) { | ||
| 1070 | switch (flags & AMD_ASIC_MASK) { | ||
| 1071 | case CHIP_KAVERI: | ||
| 1072 | case CHIP_BONAIRE: | ||
| 1073 | case CHIP_HAWAII: | ||
| 1074 | case CHIP_KABINI: | ||
| 1075 | case CHIP_MULLINS: | ||
| 1076 | dev_info(&pdev->dev, | ||
| 1077 | "CIK support provided by radeon.\n"); | ||
| 1078 | dev_info(&pdev->dev, | ||
| 1079 | "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n" | ||
| 1080 | ); | ||
| 1081 | return -ENODEV; | ||
| 1082 | } | ||
| 1083 | } | ||
| 1084 | #endif | ||
| 1085 | |||
| 1051 | /* Get rid of things like offb */ | 1086 | /* Get rid of things like offb */ |
| 1052 | ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "amdgpudrmfb"); | 1087 | ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "amdgpudrmfb"); |
| 1053 | if (ret) | 1088 | if (ret) |
| @@ -144,41 +144,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags) · 143 unmodified lines | |||
| 144 | struct amdgpu_device *adev; | 144 | struct amdgpu_device *adev; |
| 145 | int r, acpi_status; | 145 | int r, acpi_status; |
| 146 | 146 | ||
| 147 | #ifdef CONFIG_DRM_AMDGPU_SI | ||
| 148 | if (!amdgpu_si_support) { | ||
| 149 | switch (flags & AMD_ASIC_MASK) { | ||
| 150 | case CHIP_TAHITI: | ||
| 151 | case CHIP_PITCAIRN: | ||
| 152 | case CHIP_VERDE: | ||
| 153 | case CHIP_OLAND: | ||
| 154 | case CHIP_HAINAN: | ||
| 155 | dev_info(dev->dev, | ||
| 156 | "SI support provided by radeon.\n"); | ||
| 157 | dev_info(dev->dev, | ||
| 158 | "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n" | ||
| 159 | ); | ||
| 160 | return -ENODEV; | ||
| 161 | } | ||
| 162 | } | ||
| 163 | #endif | ||
| 164 | #ifdef CONFIG_DRM_AMDGPU_CIK | ||
| 165 | if (!amdgpu_cik_support) { | ||
| 166 | switch (flags & AMD_ASIC_MASK) { | ||
| 167 | case CHIP_KAVERI: | ||
| 168 | case CHIP_BONAIRE: | ||
| 169 | case CHIP_HAWAII: | ||
| 170 | case CHIP_KABINI: | ||
| 171 | case CHIP_MULLINS: | ||
| 172 | dev_info(dev->dev, | ||
| 173 | "CIK support provided by radeon.\n"); | ||
| 174 | dev_info(dev->dev, | ||
| 175 | "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n" | ||
| 176 | ); | ||
| 177 | return -ENODEV; | ||
| 178 | } | ||
| 179 | } | ||
| 180 | #endif | ||
| 181 | |||
| 182 | adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL); | 147 | adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL); |
| 183 | if (adev == NULL) { | 148 | if (adev == NULL) { |
| 184 | return -ENOMEM; | 149 | return -ENOMEM; |
| @@ -453,7 +453,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, · 452 unmodified lines | |||
| 453 | .interruptible = (bp->type != ttm_bo_type_kernel), | 453 | .interruptible = (bp->type != ttm_bo_type_kernel), |
| 454 | .no_wait_gpu = false, | 454 | .no_wait_gpu = false, |
| 455 | .resv = bp->resv, | 455 | .resv = bp->resv, |
| 456 | .flags = TTM_OPT_FLAG_ALLOW_RES_EVICT | 456 | .flags = bp->type != ttm_bo_type_kernel ? |
| 457 | TTM_OPT_FLAG_ALLOW_RES_EVICT : 0 | ||
| 457 | }; | 458 | }; |
| 458 | struct amdgpu_bo *bo; | 459 | struct amdgpu_bo *bo; |
| 459 | unsigned long page_align, size = bp->size; | 460 | unsigned long page_align, size = bp->size; |
| @@ -429,13 +429,14 @@ void amdgpu_vce_free_handles(struct amdgpu_device *adev, struct drm_file *filp) · 428 unmodified lines | |||
| 429 | * Open up a stream for HW test | 429 | * Open up a stream for HW test |
| 430 | */ | 430 | */ |
| 431 | int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | 431 | int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 432 | struct amdgpu_bo *bo, | ||
| 432 | struct dma_fence **fence) | 433 | struct dma_fence **fence) |
| 433 | { | 434 | { |
| 434 | const unsigned ib_size_dw = 1024; | 435 | const unsigned ib_size_dw = 1024; |
| 435 | struct amdgpu_job *job; | 436 | struct amdgpu_job *job; |
| 436 | struct amdgpu_ib *ib; | 437 | struct amdgpu_ib *ib; |
| 437 | struct dma_fence *f = NULL; | 438 | struct dma_fence *f = NULL; |
| 438 | uint64_t dummy; | 439 | uint64_t addr; |
| 439 | int i, r; | 440 | int i, r; |
| 440 | 441 | ||
| 441 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); | 442 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); |
| @@ -444,7 +445,7 @@ int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, · 2 unmodified lines | |||
| 444 | 445 | ||
| 445 | ib = &job->ibs[0]; | 446 | ib = &job->ibs[0]; |
| 446 | 447 | ||
| 447 | dummy = ib->gpu_addr + 1024; | 448 | addr = amdgpu_bo_gpu_offset(bo); |
| 448 | 449 | ||
| 449 | /* stitch together an VCE create msg */ | 450 | /* stitch together an VCE create msg */ |
| 450 | ib->length_dw = 0; | 451 | ib->length_dw = 0; |
| @@ -476,8 +477,8 @@ int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, · 25 unmodified lines | |||
| 476 | 477 | ||
| 477 | ib->ptr[ib->length_dw++] = 0x00000014; /* len */ | 478 | ib->ptr[ib->length_dw++] = 0x00000014; /* len */ |
| 478 | ib->ptr[ib->length_dw++] = 0x05000005; /* feedback buffer */ | 479 | ib->ptr[ib->length_dw++] = 0x05000005; /* feedback buffer */ |
| 479 | ib->ptr[ib->length_dw++] = upper_32_bits(dummy); | 480 | ib->ptr[ib->length_dw++] = upper_32_bits(addr); |
| 480 | ib->ptr[ib->length_dw++] = dummy; | 481 | ib->ptr[ib->length_dw++] = addr; |
| 481 | ib->ptr[ib->length_dw++] = 0x00000001; | 482 | ib->ptr[ib->length_dw++] = 0x00000001; |
| 482 | 483 | ||
| 483 | for (i = ib->length_dw; i < ib_size_dw; ++i) | 484 | for (i = ib->length_dw; i < ib_size_dw; ++i) |
| @@ -1110,13 +1111,20 @@ int amdgpu_vce_ring_test_ring(struct amdgpu_ring *ring) · 626 unmodified lines | |||
| 1110 | int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout) | 1111 | int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout) |
| 1111 | { | 1112 | { |
| 1112 | struct dma_fence *fence = NULL; | 1113 | struct dma_fence *fence = NULL; |
| 1114 | struct amdgpu_bo *bo = NULL; | ||
| 1113 | long r; | 1115 | long r; |
| 1114 | 1116 | ||
| 1115 | /* skip vce ring1/2 ib test for now, since it's not reliable */ | 1117 | /* skip vce ring1/2 ib test for now, since it's not reliable */ |
| 1116 | if (ring != &ring->adev->vce.ring[0]) | 1118 | if (ring != &ring->adev->vce.ring[0]) |
| 1117 | return 0; | 1119 | return 0; |
| 1118 | 1120 | ||
| 1119 | r = amdgpu_vce_get_create_msg(ring, 1, NULL); | 1121 | r = amdgpu_bo_create_reserved(ring->adev, 512, PAGE_SIZE, |
| 1122 | AMDGPU_GEM_DOMAIN_VRAM, | ||
| 1123 | &bo, NULL, NULL); | ||
| 1124 | if (r) | ||
| 1125 | return r; | ||
| 1126 | |||
| 1127 | r = amdgpu_vce_get_create_msg(ring, 1, bo, NULL); | ||
| 1120 | if (r) | 1128 | if (r) |
| 1121 | goto error; | 1129 | goto error; |
| 1122 | 1130 | ||
| @@ -1132,5 +1140,7 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 9 unmodified lines | |||
| 1132 | 1140 | ||
| 1133 | error: | 1141 | error: |
| 1134 | dma_fence_put(fence); | 1142 | dma_fence_put(fence); |
| 1143 | amdgpu_bo_unreserve(bo); | ||
| 1144 | amdgpu_bo_unref(&bo); | ||
| 1135 | return r; | 1145 | return r; |
| 1136 | } | 1146 | } |
| @@ -59,6 +59,7 @@ int amdgpu_vce_entity_init(struct amdgpu_device *adev); · 58 unmodified lines | |||
| 59 | int amdgpu_vce_suspend(struct amdgpu_device *adev); | 59 | int amdgpu_vce_suspend(struct amdgpu_device *adev); |
| 60 | int amdgpu_vce_resume(struct amdgpu_device *adev); | 60 | int amdgpu_vce_resume(struct amdgpu_device *adev); |
| 61 | int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | 61 | int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 62 | struct amdgpu_bo *bo, | ||
| 62 | struct dma_fence **fence); | 63 | struct dma_fence **fence); |
| 63 | int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, | 64 | int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 64 | bool direct, struct dma_fence **fence); | 65 | bool direct, struct dma_fence **fence); |
| @@ -569,13 +569,14 @@ int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring) · 568 unmodified lines | |||
| 569 | } | 569 | } |
| 570 | 570 | ||
| 571 | static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | 571 | static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 572 | struct dma_fence **fence) | 572 | struct amdgpu_bo *bo, |
| 573 | struct dma_fence **fence) | ||
| 573 | { | 574 | { |
| 574 | const unsigned ib_size_dw = 16; | 575 | const unsigned ib_size_dw = 16; |
| 575 | struct amdgpu_job *job; | 576 | struct amdgpu_job *job; |
| 576 | struct amdgpu_ib *ib; | 577 | struct amdgpu_ib *ib; |
| 577 | struct dma_fence *f = NULL; | 578 | struct dma_fence *f = NULL; |
| 578 | uint64_t dummy; | 579 | uint64_t addr; |
| 579 | int i, r; | 580 | int i, r; |
| 580 | 581 | ||
| 581 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); | 582 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); |
| @@ -583,14 +584,14 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand · 1 unmodified line | |||
| 583 | return r; | 584 | return r; |
| 584 | 585 | ||
| 585 | ib = &job->ibs[0]; | 586 | ib = &job->ibs[0]; |
| 586 | dummy = ib->gpu_addr + 1024; | 587 | addr = amdgpu_bo_gpu_offset(bo); |
| 587 | 588 | ||
| 588 | ib->length_dw = 0; | 589 | ib->length_dw = 0; |
| 589 | ib->ptr[ib->length_dw++] = 0x00000018; | 590 | ib->ptr[ib->length_dw++] = 0x00000018; |
| 590 | ib->ptr[ib->length_dw++] = 0x00000001; /* session info */ | 591 | ib->ptr[ib->length_dw++] = 0x00000001; /* session info */ |
| 591 | ib->ptr[ib->length_dw++] = handle; | 592 | ib->ptr[ib->length_dw++] = handle; |
| 592 | ib->ptr[ib->length_dw++] = upper_32_bits(dummy); | 593 | ib->ptr[ib->length_dw++] = upper_32_bits(addr); |
| 593 | ib->ptr[ib->length_dw++] = dummy; | 594 | ib->ptr[ib->length_dw++] = addr; |
| 594 | ib->ptr[ib->length_dw++] = 0x0000000b; | 595 | ib->ptr[ib->length_dw++] = 0x0000000b; |
| 595 | 596 | ||
| 596 | ib->ptr[ib->length_dw++] = 0x00000014; | 597 | ib->ptr[ib->length_dw++] = 0x00000014; |
| @@ -621,13 +622,14 @@ err: · 24 unmodified lines | |||
| 621 | } | 622 | } |
| 622 | 623 | ||
| 623 | static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, | 624 | static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 624 | struct dma_fence **fence) | 625 | struct amdgpu_bo *bo, |
| 626 | struct dma_fence **fence) | ||
| 625 | { | 627 | { |
| 626 | const unsigned ib_size_dw = 16; | 628 | const unsigned ib_size_dw = 16; |
| 627 | struct amdgpu_job *job; | 629 | struct amdgpu_job *job; |
| 628 | struct amdgpu_ib *ib; | 630 | struct amdgpu_ib *ib; |
| 629 | struct dma_fence *f = NULL; | 631 | struct dma_fence *f = NULL; |
| 630 | uint64_t dummy; | 632 | uint64_t addr; |
| 631 | int i, r; | 633 | int i, r; |
| 632 | 634 | ||
| 633 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); | 635 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); |
| @@ -635,14 +637,14 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han · 1 unmodified line | |||
| 635 | return r; | 637 | return r; |
| 636 | 638 | ||
| 637 | ib = &job->ibs[0]; | 639 | ib = &job->ibs[0]; |
| 638 | dummy = ib->gpu_addr + 1024; | 640 | addr = amdgpu_bo_gpu_offset(bo); |
| 639 | 641 | ||
| 640 | ib->length_dw = 0; | 642 | ib->length_dw = 0; |
| 641 | ib->ptr[ib->length_dw++] = 0x00000018; | 643 | ib->ptr[ib->length_dw++] = 0x00000018; |
| 642 | ib->ptr[ib->length_dw++] = 0x00000001; | 644 | ib->ptr[ib->length_dw++] = 0x00000001; |
| 643 | ib->ptr[ib->length_dw++] = handle; | 645 | ib->ptr[ib->length_dw++] = handle; |
| 644 | ib->ptr[ib->length_dw++] = upper_32_bits(dummy); | 646 | ib->ptr[ib->length_dw++] = upper_32_bits(addr); |
| 645 | ib->ptr[ib->length_dw++] = dummy; | 647 | ib->ptr[ib->length_dw++] = addr; |
| 646 | ib->ptr[ib->length_dw++] = 0x0000000b; | 648 | ib->ptr[ib->length_dw++] = 0x0000000b; |
| 647 | 649 | ||
| 648 | ib->ptr[ib->length_dw++] = 0x00000014; | 650 | ib->ptr[ib->length_dw++] = 0x00000014; |
| @@ -675,13 +677,20 @@ err: · 26 unmodified lines | |||
| 675 | int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) | 677 | int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) |
| 676 | { | 678 | { |
| 677 | struct dma_fence *fence = NULL; | 679 | struct dma_fence *fence = NULL; |
| 680 | struct amdgpu_bo *bo = NULL; | ||
| 678 | long r; | 681 | long r; |
| 679 | 682 | ||
| 680 | r = amdgpu_vcn_enc_get_create_msg(ring, 1, NULL); | 683 | r = amdgpu_bo_create_reserved(ring->adev, 128 * 1024, PAGE_SIZE, |
| 684 | AMDGPU_GEM_DOMAIN_VRAM, | ||
| 685 | &bo, NULL, NULL); | ||
| 686 | if (r) | ||
| 687 | return r; | ||
| 688 | |||
| 689 | r = amdgpu_vcn_enc_get_create_msg(ring, 1, bo, NULL); | ||
| 681 | if (r) | 690 | if (r) |
| 682 | goto error; | 691 | goto error; |
| 683 | 692 | ||
| 684 | r = amdgpu_vcn_enc_get_destroy_msg(ring, 1, &fence); | 693 | r = amdgpu_vcn_enc_get_destroy_msg(ring, 1, bo, &fence); |
| 685 | if (r) | 694 | if (r) |
| 686 | goto error; | 695 | goto error; |
| 687 | 696 | ||
| @@ -693,6 +702,8 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 5 unmodified lines | |||
| 693 | 702 | ||
| 694 | error: | 703 | error: |
| 695 | dma_fence_put(fence); | 704 | dma_fence_put(fence); |
| 705 | amdgpu_bo_unreserve(bo); | ||
| 706 | amdgpu_bo_unref(&bo); | ||
| 696 | return r; | 707 | return r; |
| 697 | } | 708 | } |
| 698 | 709 | ||
| @@ -1129,7 +1129,7 @@ static void sdma_v5_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring) · 1128 unmodified lines | |||
| 1129 | amdgpu_ring_write(ring, addr & 0xfffffffc); | 1129 | amdgpu_ring_write(ring, addr & 0xfffffffc); |
| 1130 | amdgpu_ring_write(ring, upper_32_bits(addr) & 0xffffffff); | 1130 | amdgpu_ring_write(ring, upper_32_bits(addr) & 0xffffffff); |
| 1131 | amdgpu_ring_write(ring, seq); /* reference */ | 1131 | amdgpu_ring_write(ring, seq); /* reference */ |
| 1132 | amdgpu_ring_write(ring, 0xfffffff); /* mask */ | 1132 | amdgpu_ring_write(ring, 0xffffffff); /* mask */ |
| 1133 | amdgpu_ring_write(ring, SDMA_PKT_POLL_REGMEM_DW5_RETRY_COUNT(0xfff) | | 1133 | amdgpu_ring_write(ring, SDMA_PKT_POLL_REGMEM_DW5_RETRY_COUNT(0xfff) | |
| 1134 | SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(4)); /* retry count, poll interval */ | 1134 | SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(4)); /* retry count, poll interval */ |
| 1135 | } | 1135 | } |
| @@ -206,13 +206,14 @@ static int uvd_v6_0_enc_ring_test_ring(struct amdgpu_ring *ring) · 205 unmodified lines | |||
| 206 | * Open up a stream for HW test | 206 | * Open up a stream for HW test |
| 207 | */ | 207 | */ |
| 208 | static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | 208 | static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 209 | struct amdgpu_bo *bo, | ||
| 209 | struct dma_fence **fence) | 210 | struct dma_fence **fence) |
| 210 | { | 211 | { |
| 211 | const unsigned ib_size_dw = 16; | 212 | const unsigned ib_size_dw = 16; |
| 212 | struct amdgpu_job *job; | 213 | struct amdgpu_job *job; |
| 213 | struct amdgpu_ib *ib; | 214 | struct amdgpu_ib *ib; |
| 214 | struct dma_fence *f = NULL; | 215 | struct dma_fence *f = NULL; |
| 215 | uint64_t dummy; | 216 | uint64_t addr; |
| 216 | int i, r; | 217 | int i, r; |
| 217 | 218 | ||
| 218 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); | 219 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); |
| @@ -220,15 +221,15 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle · 1 unmodified line | |||
| 220 | return r; | 221 | return r; |
| 221 | 222 | ||
| 222 | ib = &job->ibs[0]; | 223 | ib = &job->ibs[0]; |
| 223 | dummy = ib->gpu_addr + 1024; | 224 | addr = amdgpu_bo_gpu_offset(bo); |
| 224 | 225 | ||
| 225 | ib->length_dw = 0; | 226 | ib->length_dw = 0; |
| 226 | ib->ptr[ib->length_dw++] = 0x00000018; | 227 | ib->ptr[ib->length_dw++] = 0x00000018; |
| 227 | ib->ptr[ib->length_dw++] = 0x00000001; /* session info */ | 228 | ib->ptr[ib->length_dw++] = 0x00000001; /* session info */ |
| 228 | ib->ptr[ib->length_dw++] = handle; | 229 | ib->ptr[ib->length_dw++] = handle; |
| 229 | ib->ptr[ib->length_dw++] = 0x00010000; | 230 | ib->ptr[ib->length_dw++] = 0x00010000; |
| 230 | ib->ptr[ib->length_dw++] = upper_32_bits(dummy); | 231 | ib->ptr[ib->length_dw++] = upper_32_bits(addr); |
| 231 | ib->ptr[ib->length_dw++] = dummy; | 232 | ib->ptr[ib->length_dw++] = addr; |
| 232 | 233 | ||
| 233 | ib->ptr[ib->length_dw++] = 0x00000014; | 234 | ib->ptr[ib->length_dw++] = 0x00000014; |
| 234 | ib->ptr[ib->length_dw++] = 0x00000002; /* task info */ | 235 | ib->ptr[ib->length_dw++] = 0x00000002; /* task info */ |
| @@ -268,13 +269,14 @@ err: · 33 unmodified lines | |||
| 268 | */ | 269 | */ |
| 269 | static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring, | 270 | static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring, |
| 270 | uint32_t handle, | 271 | uint32_t handle, |
| 272 | struct amdgpu_bo *bo, | ||
| 271 | struct dma_fence **fence) | 273 | struct dma_fence **fence) |
| 272 | { | 274 | { |
| 273 | const unsigned ib_size_dw = 16; | 275 | const unsigned ib_size_dw = 16; |
| 274 | struct amdgpu_job *job; | 276 | struct amdgpu_job *job; |
| 275 | struct amdgpu_ib *ib; | 277 | struct amdgpu_ib *ib; |
| 276 | struct dma_fence *f = NULL; | 278 | struct dma_fence *f = NULL; |
| 277 | uint64_t dummy; | 279 | uint64_t addr; |
| 278 | int i, r; | 280 | int i, r; |
| 279 | 281 | ||
| 280 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); | 282 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); |
| @@ -282,15 +284,15 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring, · 1 unmodified line | |||
| 282 | return r; | 284 | return r; |
| 283 | 285 | ||
| 284 | ib = &job->ibs[0]; | 286 | ib = &job->ibs[0]; |
| 285 | dummy = ib->gpu_addr + 1024; | 287 | addr = amdgpu_bo_gpu_offset(bo); |
| 286 | 288 | ||
| 287 | ib->length_dw = 0; | 289 | ib->length_dw = 0; |
| 288 | ib->ptr[ib->length_dw++] = 0x00000018; | 290 | ib->ptr[ib->length_dw++] = 0x00000018; |
| 289 | ib->ptr[ib->length_dw++] = 0x00000001; /* session info */ | 291 | ib->ptr[ib->length_dw++] = 0x00000001; /* session info */ |
| 290 | ib->ptr[ib->length_dw++] = handle; | 292 | ib->ptr[ib->length_dw++] = handle; |
| 291 | ib->ptr[ib->length_dw++] = 0x00010000; | 293 | ib->ptr[ib->length_dw++] = 0x00010000; |
| 292 | ib->ptr[ib->length_dw++] = upper_32_bits(dummy); | 294 | ib->ptr[ib->length_dw++] = upper_32_bits(addr); |
| 293 | ib->ptr[ib->length_dw++] = dummy; | 295 | ib->ptr[ib->length_dw++] = addr; |
| 294 | 296 | ||
| 295 | ib->ptr[ib->length_dw++] = 0x00000014; | 297 | ib->ptr[ib->length_dw++] = 0x00000014; |
| 296 | ib->ptr[ib->length_dw++] = 0x00000002; /* task info */ | 298 | ib->ptr[ib->length_dw++] = 0x00000002; /* task info */ |
| @@ -327,13 +329,20 @@ err: · 30 unmodified lines | |||
| 327 | static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) | 329 | static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) |
| 328 | { | 330 | { |
| 329 | struct dma_fence *fence = NULL; | 331 | struct dma_fence *fence = NULL; |
| 332 | struct amdgpu_bo *bo = NULL; | ||
| 330 | long r; | 333 | long r; |
| 331 | 334 | ||
| 332 | r = uvd_v6_0_enc_get_create_msg(ring, 1, NULL); | 335 | r = amdgpu_bo_create_reserved(ring->adev, 128 * 1024, PAGE_SIZE, |
| 336 | AMDGPU_GEM_DOMAIN_VRAM, | ||
| 337 | &bo, NULL, NULL); | ||
| 338 | if (r) | ||
| 339 | return r; | ||
| 340 | |||
| 341 | r = uvd_v6_0_enc_get_create_msg(ring, 1, bo, NULL); | ||
| 333 | if (r) | 342 | if (r) |
| 334 | goto error; | 343 | goto error; |
| 335 | 344 | ||
| 336 | r = uvd_v6_0_enc_get_destroy_msg(ring, 1, &fence); | 345 | r = uvd_v6_0_enc_get_destroy_msg(ring, 1, bo, &fence); |
| 337 | if (r) | 346 | if (r) |
| 338 | goto error; | 347 | goto error; |
| 339 | 348 | ||
| @@ -345,6 +354,8 @@ static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 5 unmodified lines | |||
| 345 | 354 | ||
| 346 | error: | 355 | error: |
| 347 | dma_fence_put(fence); | 356 | dma_fence_put(fence); |
| 357 | amdgpu_bo_unreserve(bo); | ||
| 358 | amdgpu_bo_unref(&bo); | ||
| 348 | return r; | 359 | return r; |
| 349 | } | 360 | } |
| 350 | 361 | ||
| @@ -214,13 +214,14 @@ static int uvd_v7_0_enc_ring_test_ring(struct amdgpu_ring *ring) · 213 unmodified lines | |||
| 214 | * Open up a stream for HW test | 214 | * Open up a stream for HW test |
| 215 | */ | 215 | */ |
| 216 | static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | 216 | static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 217 | struct amdgpu_bo *bo, | ||
| 217 | struct dma_fence **fence) | 218 | struct dma_fence **fence) |
| 218 | { | 219 | { |
| 219 | const unsigned ib_size_dw = 16; | 220 | const unsigned ib_size_dw = 16; |
| 220 | struct amdgpu_job *job; | 221 | struct amdgpu_job *job; |
| 221 | struct amdgpu_ib *ib; | 222 | struct amdgpu_ib *ib; |
| 222 | struct dma_fence *f = NULL; | 223 | struct dma_fence *f = NULL; |
| 223 | uint64_t dummy; | 224 | uint64_t addr; |
| 224 | int i, r; | 225 | int i, r; |
| 225 | 226 | ||
| 226 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); | 227 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); |
| @@ -228,15 +229,15 @@ static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle · 1 unmodified line | |||
| 228 | return r; | 229 | return r; |
| 229 | 230 | ||
| 230 | ib = &job->ibs[0]; | 231 | ib = &job->ibs[0]; |
| 231 | dummy = ib->gpu_addr + 1024; | 232 | addr = amdgpu_bo_gpu_offset(bo); |
| 232 | 233 | ||
| 233 | ib->length_dw = 0; | 234 | ib->length_dw = 0; |
| 234 | ib->ptr[ib->length_dw++] = 0x00000018; | 235 | ib->ptr[ib->length_dw++] = 0x00000018; |
| 235 | ib->ptr[ib->length_dw++] = 0x00000001; /* session info */ | 236 | ib->ptr[ib->length_dw++] = 0x00000001; /* session info */ |
| 236 | ib->ptr[ib->length_dw++] = handle; | 237 | ib->ptr[ib->length_dw++] = handle; |
| 237 | ib->ptr[ib->length_dw++] = 0x00000000; | 238 | ib->ptr[ib->length_dw++] = 0x00000000; |
| 238 | ib->ptr[ib->length_dw++] = upper_32_bits(dummy); | 239 | ib->ptr[ib->length_dw++] = upper_32_bits(addr); |
| 239 | ib->ptr[ib->length_dw++] = dummy; | 240 | ib->ptr[ib->length_dw++] = addr; |
| 240 | 241 | ||
| 241 | ib->ptr[ib->length_dw++] = 0x00000014; | 242 | ib->ptr[ib->length_dw++] = 0x00000014; |
| 242 | ib->ptr[ib->length_dw++] = 0x00000002; /* task info */ | 243 | ib->ptr[ib->length_dw++] = 0x00000002; /* task info */ |
| @@ -275,13 +276,14 @@ err: · 32 unmodified lines | |||
| 275 | * Close up a stream for HW test or if userspace failed to do so | 276 | * Close up a stream for HW test or if userspace failed to do so |
| 276 | */ | 277 | */ |
| 277 | static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, | 278 | static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, |
| 278 | struct dma_fence **fence) | 279 | struct amdgpu_bo *bo, |
| 280 | struct dma_fence **fence) | ||
| 279 | { | 281 | { |
| 280 | const unsigned ib_size_dw = 16; | 282 | const unsigned ib_size_dw = 16; |
| 281 | struct amdgpu_job *job; | 283 | struct amdgpu_job *job; |
| 282 | struct amdgpu_ib *ib; | 284 | struct amdgpu_ib *ib; |
| 283 | struct dma_fence *f = NULL; | 285 | struct dma_fence *f = NULL; |
| 284 | uint64_t dummy; | 286 | uint64_t addr; |
| 285 | int i, r; | 287 | int i, r; |
| 286 | 288 | ||
| 287 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); | 289 | r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job); |
| @@ -289,15 +291,15 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handl · 1 unmodified line | |||
| 289 | return r; | 291 | return r; |
| 290 | 292 | ||
| 291 | ib = &job->ibs[0]; | 293 | ib = &job->ibs[0]; |
| 292 | dummy = ib->gpu_addr + 1024; | 294 | addr = amdgpu_bo_gpu_offset(bo); |
| 293 | 295 | ||
| 294 | ib->length_dw = 0; | 296 | ib->length_dw = 0; |
| 295 | ib->ptr[ib->length_dw++] = 0x00000018; | 297 | ib->ptr[ib->length_dw++] = 0x00000018; |
| 296 | ib->ptr[ib->length_dw++] = 0x00000001; | 298 | ib->ptr[ib->length_dw++] = 0x00000001; |
| 297 | ib->ptr[ib->length_dw++] = handle; | 299 | ib->ptr[ib->length_dw++] = handle; |
| 298 | ib->ptr[ib->length_dw++] = 0x00000000; | 300 | ib->ptr[ib->length_dw++] = 0x00000000; |
| 299 | ib->ptr[ib->length_dw++] = upper_32_bits(dummy); | 301 | ib->ptr[ib->length_dw++] = upper_32_bits(addr); |
| 300 | ib->ptr[ib->length_dw++] = dummy; | 302 | ib->ptr[ib->length_dw++] = addr; |
| 301 | 303 | ||
| 302 | ib->ptr[ib->length_dw++] = 0x00000014; | 304 | ib->ptr[ib->length_dw++] = 0x00000014; |
| 303 | ib->ptr[ib->length_dw++] = 0x00000002; | 305 | ib->ptr[ib->length_dw++] = 0x00000002; |
| @@ -334,13 +336,20 @@ err: · 30 unmodified lines | |||
| 334 | static int uvd_v7_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) | 336 | static int uvd_v7_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) |
| 335 | { | 337 | { |
| 336 | struct dma_fence *fence = NULL; | 338 | struct dma_fence *fence = NULL; |
| 339 | struct amdgpu_bo *bo = NULL; | ||
| 337 | long r; | 340 | long r; |
| 338 | 341 | ||
| 339 | r = uvd_v7_0_enc_get_create_msg(ring, 1, NULL); | 342 | r = amdgpu_bo_create_reserved(ring->adev, 128 * 1024, PAGE_SIZE, |
| 343 | AMDGPU_GEM_DOMAIN_VRAM, | ||
| 344 | &bo, NULL, NULL); | ||
| 345 | if (r) | ||
| 346 | return r; | ||
| 347 | |||
| 348 | r = uvd_v7_0_enc_get_create_msg(ring, 1, bo, NULL); | ||
| 340 | if (r) | 349 | if (r) |
| 341 | goto error; | 350 | goto error; |
| 342 | 351 | ||
| 343 | r = uvd_v7_0_enc_get_destroy_msg(ring, 1, &fence); | 352 | r = uvd_v7_0_enc_get_destroy_msg(ring, 1, bo, &fence); |
| 344 | if (r) | 353 | if (r) |
| 345 | goto error; | 354 | goto error; |
| 346 | 355 | ||
| @@ -352,6 +361,8 @@ static int uvd_v7_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 5 unmodified lines | |||
| 352 | 361 | ||
| 353 | error: | 362 | error: |
| 354 | dma_fence_put(fence); | 363 | dma_fence_put(fence); |
| 364 | amdgpu_bo_unreserve(bo); | ||
| 365 | amdgpu_bo_unref(&bo); | ||
| 355 | return r; | 366 | return r; |
| 356 | } | 367 | } |
| 357 | 368 | ||
| @@ -655,7 +655,7 @@ static int polaris10_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, · 654 unmodified lines | |||
| 655 | count = SMU_MAX_SMIO_LEVELS; | 655 | count = SMU_MAX_SMIO_LEVELS; |
| 656 | for (level = 0; level < count; level++) { | 656 | for (level = 0; level < count; level++) { |
| 657 | table->SmioTable2.Pattern[level].Voltage = | 657 | table->SmioTable2.Pattern[level].Voltage = |
| 658 | PP_HOST_TO_SMC_US(data->mvdd_voltage_table.entries[count].value * VOLTAGE_SCALE); | 658 | PP_HOST_TO_SMC_US(data->mvdd_voltage_table.entries[level].value * VOLTAGE_SCALE); |
| 659 | /* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level.*/ | 659 | /* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level.*/ |
| 660 | table->SmioTable2.Pattern[level].Smio = | 660 | table->SmioTable2.Pattern[level].Smio = |
| 661 | (uint8_t) level; | 661 | (uint8_t) level; |
| @@ -456,7 +456,7 @@ static int vegam_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, · 455 unmodified lines | |||
| 456 | count = SMU_MAX_SMIO_LEVELS; | 456 | count = SMU_MAX_SMIO_LEVELS; |
| 457 | for (level = 0; level < count; level++) { | 457 | for (level = 0; level < count; level++) { |
| 458 | table->SmioTable2.Pattern[level].Voltage = PP_HOST_TO_SMC_US( | 458 | table->SmioTable2.Pattern[level].Voltage = PP_HOST_TO_SMC_US( |
| 459 | data->mvdd_voltage_table.entries[count].value * VOLTAGE_SCALE); | 459 | data->mvdd_voltage_table.entries[level].value * VOLTAGE_SCALE); |
| 460 | /* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level.*/ | 460 | /* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level.*/ |
| 461 | table->SmioTable2.Pattern[level].Smio = | 461 | table->SmioTable2.Pattern[level].Smio = |
| 462 | (uint8_t) level; | 462 | (uint8_t) level; |
| @@ -82,7 +82,8 @@ static void komeda_kms_commit_tail(struct drm_atomic_state *old_state) · 81 unmodified lines | |||
| 82 | 82 | ||
| 83 | drm_atomic_helper_commit_modeset_disables(dev, old_state); | 83 | drm_atomic_helper_commit_modeset_disables(dev, old_state); |
| 84 | 84 | ||
| 85 | drm_atomic_helper_commit_planes(dev, old_state, 0); | 85 | drm_atomic_helper_commit_planes(dev, old_state, |
| 86 | DRM_PLANE_COMMIT_ACTIVE_ONLY); | ||
| 86 | 87 | ||
| 87 | drm_atomic_helper_commit_modeset_enables(dev, old_state); | 88 | drm_atomic_helper_commit_modeset_enables(dev, old_state); |
| 88 | 89 | ||
| @@ -564,8 +564,8 @@ komeda_splitter_validate(struct komeda_splitter *splitter, · 563 unmodified lines | |||
| 564 | } | 564 | } |
| 565 | 565 | ||
| 566 | if (!in_range(&splitter->vsize, dflow->in_h)) { | 566 | if (!in_range(&splitter->vsize, dflow->in_h)) { |
| 567 | DRM_DEBUG_ATOMIC("split in_in: %d exceed the acceptable range.\n", | 567 | DRM_DEBUG_ATOMIC("split in_h: %d exceeds the acceptable range.\n", |
| 568 | dflow->in_w); | 568 | dflow->in_h); |
| 569 | return -EINVAL; | 569 | return -EINVAL; |
| 570 | } | 570 | } |
| 571 | 571 | ||
| @@ -159,6 +159,9 @@ static const struct edid_quirk { · 158 unmodified lines | |||
| 159 | /* Medion MD 30217 PG */ | 159 | /* Medion MD 30217 PG */ |
| 160 | { "MED", 0x7b8, EDID_QUIRK_PREFER_LARGE_75 }, | 160 | { "MED", 0x7b8, EDID_QUIRK_PREFER_LARGE_75 }, |
| 161 | 161 | ||
| 162 | /* Lenovo G50 */ | ||
| 163 | { "SDC", 18514, EDID_QUIRK_FORCE_6BPC }, | ||
| 164 | |||
| 162 | /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */ | 165 | /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */ |
| 163 | { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC }, | 166 | { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC }, |
| 164 | 167 | ||
| @@ -1270,7 +1270,7 @@ static void sanitize_ddc_pin(struct drm_i915_private *dev_priv, · 1269 unmodified lines | |||
| 1270 | DRM_DEBUG_KMS("port %c trying to use the same DDC pin (0x%x) as port %c, " | 1270 | DRM_DEBUG_KMS("port %c trying to use the same DDC pin (0x%x) as port %c, " |
| 1271 | "disabling port %c DVI/HDMI support\n", | 1271 | "disabling port %c DVI/HDMI support\n", |
| 1272 | port_name(port), info->alternate_ddc_pin, | 1272 | port_name(port), info->alternate_ddc_pin, |
| 1273 | port_name(p), port_name(port)); | 1273 | port_name(p), port_name(p)); |
| 1274 | 1274 | ||
| 1275 | /* | 1275 | /* |
| 1276 | * If we have multiple ports supposedly sharing the | 1276 | * If we have multiple ports supposedly sharing the |
| @@ -1278,9 +1278,14 @@ static void sanitize_ddc_pin(struct drm_i915_private *dev_priv, · 1 unmodified line | |||
| 1278 | * port. Otherwise they share the same ddc bin and | 1278 | * port. Otherwise they share the same ddc bin and |
| 1279 | * system couldn't communicate with them separately. | 1279 | * system couldn't communicate with them separately. |
| 1280 | * | 1280 | * |
| 1281 | * Give child device order the priority, first come first | 1281 | * Give inverse child device order the priority, |
| 1282 | * served. | 1282 | * last one wins. Yes, there are real machines |
| 1283 | * (eg. Asrock B250M-HDV) where VBT has both | ||
| 1284 | * port A and port E with the same AUX ch and | ||
| 1285 | * we must pick port E :( | ||
| 1283 | */ | 1286 | */ |
| 1287 | info = &dev_priv->vbt.ddi_port_info[p]; | ||
| 1288 | |||
| 1284 | info->supports_dvi = false; | 1289 | info->supports_dvi = false; |
| 1285 | info->supports_hdmi = false; | 1290 | info->supports_hdmi = false; |
| 1286 | info->alternate_ddc_pin = 0; | 1291 | info->alternate_ddc_pin = 0; |
| @@ -1316,7 +1321,7 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv, · 29 unmodified lines | |||
| 1316 | DRM_DEBUG_KMS("port %c trying to use the same AUX CH (0x%x) as port %c, " | 1321 | DRM_DEBUG_KMS("port %c trying to use the same AUX CH (0x%x) as port %c, " |
| 1317 | "disabling port %c DP support\n", | 1322 | "disabling port %c DP support\n", |
| 1318 | port_name(port), info->alternate_aux_channel, | 1323 | port_name(port), info->alternate_aux_channel, |
| 1319 | port_name(p), port_name(port)); | 1324 | port_name(p), port_name(p)); |
| 1320 | 1325 | ||
| 1321 | /* | 1326 | /* |
| 1322 | * If we have multiple ports supposedlt sharing the | 1327 | * If we have multiple ports supposedlt sharing the |
| @@ -1324,9 +1329,14 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv, · 1 unmodified line | |||
| 1324 | * port. Otherwise they share the same aux channel | 1329 | * port. Otherwise they share the same aux channel |
| 1325 | * and system couldn't communicate with them separately. | 1330 | * and system couldn't communicate with them separately. |
| 1326 | * | 1331 | * |
| 1327 | * Give child device order the priority, first come first | 1332 | * Give inverse child device order the priority, |
| 1328 | * served. | 1333 | * last one wins. Yes, there are real machines |
| 1334 | * (eg. Asrock B250M-HDV) where VBT has both | ||
| 1335 | * port A and port E with the same AUX ch and | ||
| 1336 | * we must pick port E :( | ||
| 1329 | */ | 1337 | */ |
| 1338 | info = &dev_priv->vbt.ddi_port_info[p]; | ||
| 1339 | |||
| 1330 | info->supports_dp = false; | 1340 | info->supports_dp = false; |
| 1331 | info->alternate_aux_channel = 0; | 1341 | info->alternate_aux_channel = 0; |
| 1332 | } | 1342 | } |
| @@ -364,6 +364,7 @@ err: · 363 unmodified lines | |||
| 364 | return VM_FAULT_OOM; | 364 | return VM_FAULT_OOM; |
| 365 | case -ENOSPC: | 365 | case -ENOSPC: |
| 366 | case -EFAULT: | 366 | case -EFAULT: |
| 367 | case -ENODEV: /* bad object, how did you get here! */ | ||
| 367 | return VM_FAULT_SIGBUS; | 368 | return VM_FAULT_SIGBUS; |
| 368 | default: | 369 | default: |
| 369 | WARN_ONCE(ret, "unhandled error in %s: %i\n", __func__, ret); | 370 | WARN_ONCE(ret, "unhandled error in %s: %i\n", __func__, ret); |
| @@ -475,10 +476,16 @@ i915_gem_mmap_gtt(struct drm_file *file, · 105 unmodified lines | |||
| 475 | if (!obj) | 476 | if (!obj) |
| 476 | return -ENOENT; | 477 | return -ENOENT; |
| 477 | 478 | ||
| 479 | if (i915_gem_object_never_bind_ggtt(obj)) { | ||
| 480 | ret = -ENODEV; | ||
| 481 | goto out; | ||
| 482 | } | ||
| 483 | |||
| 478 | ret = create_mmap_offset(obj); | 484 | ret = create_mmap_offset(obj); |
| 479 | if (ret == 0) | 485 | if (ret == 0) |
| 480 | *offset = drm_vma_node_offset_addr(&obj->base.vma_node); | 486 | *offset = drm_vma_node_offset_addr(&obj->base.vma_node); |
| 481 | 487 | ||
| 488 | out: | ||
| 482 | i915_gem_object_put(obj); | 489 | i915_gem_object_put(obj); |
| 483 | return ret; | 490 | return ret; |
| 484 | } | 491 | } |
| @@ -152,6 +152,12 @@ i915_gem_object_is_proxy(const struct drm_i915_gem_object *obj) · 151 unmodified lines | |||
| 152 | return obj->ops->flags & I915_GEM_OBJECT_IS_PROXY; | 152 | return obj->ops->flags & I915_GEM_OBJECT_IS_PROXY; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | static inline bool | ||
| 156 | i915_gem_object_never_bind_ggtt(const struct drm_i915_gem_object *obj) | ||
| 157 | { | ||
| 158 | return obj->ops->flags & I915_GEM_OBJECT_NO_GGTT; | ||
| 159 | } | ||
| 160 | |||
| 155 | static inline bool | 161 | static inline bool |
| 156 | i915_gem_object_needs_async_cancel(const struct drm_i915_gem_object *obj) | 162 | i915_gem_object_needs_async_cancel(const struct drm_i915_gem_object *obj) |
| 157 | { | 163 | { |
| @@ -32,7 +32,8 @@ struct drm_i915_gem_object_ops { · 31 unmodified lines | |||
| 32 | #define I915_GEM_OBJECT_HAS_STRUCT_PAGE BIT(0) | 32 | #define I915_GEM_OBJECT_HAS_STRUCT_PAGE BIT(0) |
| 33 | #define I915_GEM_OBJECT_IS_SHRINKABLE BIT(1) | 33 | #define I915_GEM_OBJECT_IS_SHRINKABLE BIT(1) |
| 34 | #define I915_GEM_OBJECT_IS_PROXY BIT(2) | 34 | #define I915_GEM_OBJECT_IS_PROXY BIT(2) |
| 35 | #define I915_GEM_OBJECT_ASYNC_CANCEL BIT(3) | 35 | #define I915_GEM_OBJECT_NO_GGTT BIT(3) |
| 36 | #define I915_GEM_OBJECT_ASYNC_CANCEL BIT(4) | ||
| 36 | 37 | ||
| 37 | /* Interface between the GEM object and its backing storage. | 38 | /* Interface between the GEM object and its backing storage. |
| 38 | * get_pages() is called once prior to the use of the associated set | 39 | * get_pages() is called once prior to the use of the associated set |
| @@ -702,6 +702,7 @@ i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) · 701 unmodified lines | |||
| 702 | static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = { | 702 | static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = { |
| 703 | .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE | | 703 | .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE | |
| 704 | I915_GEM_OBJECT_IS_SHRINKABLE | | 704 | I915_GEM_OBJECT_IS_SHRINKABLE | |
| 705 | I915_GEM_OBJECT_NO_GGTT | | ||
| 705 | I915_GEM_OBJECT_ASYNC_CANCEL, | 706 | I915_GEM_OBJECT_ASYNC_CANCEL, |
| 706 | .get_pages = i915_gem_userptr_get_pages, | 707 | .get_pages = i915_gem_userptr_get_pages, |
| 707 | .put_pages = i915_gem_userptr_put_pages, | 708 | .put_pages = i915_gem_userptr_put_pages, |
| @@ -234,6 +234,13 @@ static void execlists_init_reg_state(u32 *reg_state, · 233 unmodified lines | |||
| 234 | struct intel_engine_cs *engine, | 234 | struct intel_engine_cs *engine, |
| 235 | struct intel_ring *ring); | 235 | struct intel_ring *ring); |
| 236 | 236 | ||
| 237 | static void mark_eio(struct i915_request *rq) | ||
| 238 | { | ||
| 239 | if (!i915_request_signaled(rq)) | ||
| 240 | dma_fence_set_error(&rq->fence, -EIO); | ||
| 241 | i915_request_mark_complete(rq); | ||
| 242 | } | ||
| 243 | |||
| 237 | static inline u32 intel_hws_preempt_address(struct intel_engine_cs *engine) | 244 | static inline u32 intel_hws_preempt_address(struct intel_engine_cs *engine) |
| 238 | { | 245 | { |
| 239 | return (i915_ggtt_offset(engine->status_page.vma) + | 246 | return (i915_ggtt_offset(engine->status_page.vma) + |
| @@ -1236,6 +1243,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 996 unmodified lines | |||
| 1236 | submit = true; | 1243 | submit = true; |
| 1237 | last = rq; | 1244 | last = rq; |
| 1238 | } | 1245 | } |
| 1246 | i915_request_put(rq); | ||
| 1239 | 1247 | ||
| 1240 | /* | 1248 | /* |
| 1241 | * Hmm, we have a bunch of virtual engine requests, | 1249 | * Hmm, we have a bunch of virtual engine requests, |
| @@ -2574,12 +2582,8 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) · 1332 unmodified lines | |||
| 2574 | __execlists_reset(engine, true); | 2582 | __execlists_reset(engine, true); |
| 2575 | 2583 | ||
| 2576 | /* Mark all executing requests as skipped. */ | 2584 | /* Mark all executing requests as skipped. */ |
| 2577 | list_for_each_entry(rq, &engine->active.requests, sched.link) { | 2585 | list_for_each_entry(rq, &engine->active.requests, sched.link) |
| 2578 | if (!i915_request_signaled(rq)) | 2586 | mark_eio(rq); |
| 2579 | dma_fence_set_error(&rq->fence, -EIO); | ||
| 2580 | |||
| 2581 | i915_request_mark_complete(rq); | ||
| 2582 | } | ||
| 2583 | 2587 | ||
| 2584 | /* Flush the queued requests to the timeline list (for retiring). */ | 2588 | /* Flush the queued requests to the timeline list (for retiring). */ |
| 2585 | while ((rb = rb_first_cached(&execlists->queue))) { | 2589 | while ((rb = rb_first_cached(&execlists->queue))) { |
| @@ -2587,9 +2591,8 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) · 1 unmodified line | |||
| 2587 | int i; | 2591 | int i; |
| 2588 | 2592 | ||
| 2589 | priolist_for_each_request_consume(rq, rn, p, i) { | 2593 | priolist_for_each_request_consume(rq, rn, p, i) { |
| 2594 | mark_eio(rq); | ||
| 2590 | __i915_request_submit(rq); | 2595 | __i915_request_submit(rq); |
| 2591 | dma_fence_set_error(&rq->fence, -EIO); | ||
| 2592 | i915_request_mark_complete(rq); | ||
| 2593 | } | 2596 | } |
| 2594 | 2597 | ||
| 2595 | rb_erase_cached(&p->node, &execlists->queue); | 2598 | rb_erase_cached(&p->node, &execlists->queue); |
| @@ -2605,13 +2608,15 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) · 9 unmodified lines | |||
| 2605 | RB_CLEAR_NODE(rb); | 2608 | RB_CLEAR_NODE(rb); |
| 2606 | 2609 | ||
| 2607 | spin_lock(&ve->base.active.lock); | 2610 | spin_lock(&ve->base.active.lock); |
| 2608 | if (ve->request) { | 2611 | rq = fetch_and_zero(&ve->request); |
| 2609 | ve->request->engine = engine; | 2612 | if (rq) { |
| 2610 | __i915_request_submit(ve->request); | 2613 | mark_eio(rq); |
| 2611 | dma_fence_set_error(&ve->request->fence, -EIO); | 2614 | |
| 2612 | i915_request_mark_complete(ve->request); | 2615 | rq->engine = engine; |
| 2616 | __i915_request_submit(rq); | ||
| 2617 | i915_request_put(rq); | ||
| 2618 | |||
| 2613 | ve->base.execlists.queue_priority_hint = INT_MIN; | 2619 | ve->base.execlists.queue_priority_hint = INT_MIN; |
| 2614 | ve->request = NULL; | ||
| 2615 | } | 2620 | } |
| 2616 | spin_unlock(&ve->base.active.lock); | 2621 | spin_unlock(&ve->base.active.lock); |
| 2617 | } | 2622 | } |
| @@ -3615,6 +3620,8 @@ submit_engine: · 997 unmodified lines | |||
| 3615 | static void virtual_submit_request(struct i915_request *rq) | 3620 | static void virtual_submit_request(struct i915_request *rq) |
| 3616 | { | 3621 | { |
| 3617 | struct virtual_engine *ve = to_virtual_engine(rq->engine); | 3622 | struct virtual_engine *ve = to_virtual_engine(rq->engine); |
| 3623 | struct i915_request *old; | ||
| 3624 | unsigned long flags; | ||
| 3618 | 3625 | ||
| 3619 | GEM_TRACE("%s: rq=%llx:%lld\n", | 3626 | GEM_TRACE("%s: rq=%llx:%lld\n", |
| 3620 | ve->base.name, | 3627 | ve->base.name, |
| @@ -3623,15 +3630,31 @@ static void virtual_submit_request(struct i915_request *rq) · 2 unmodified lines | |||
| 3623 | 3630 | ||
| 3624 | GEM_BUG_ON(ve->base.submit_request != virtual_submit_request); | 3631 | GEM_BUG_ON(ve->base.submit_request != virtual_submit_request); |
| 3625 | 3632 | ||
| 3626 | GEM_BUG_ON(ve->request); | 3633 | spin_lock_irqsave(&ve->base.active.lock, flags); |
| 3627 | GEM_BUG_ON(!list_empty(virtual_queue(ve))); | 3634 | |
| 3635 | old = ve->request; | ||
| 3636 | if (old) { /* background completion event from preempt-to-busy */ | ||
| 3637 | GEM_BUG_ON(!i915_request_completed(old)); | ||
| 3638 | __i915_request_submit(old); | ||
| 3639 | i915_request_put(old); | ||
| 3640 | } | ||
| 3628 | 3641 | ||
| 3629 | ve->base.execlists.queue_priority_hint = rq_prio(rq); | 3642 | if (i915_request_completed(rq)) { |
| 3630 | WRITE_ONCE(ve->request, rq); | 3643 | __i915_request_submit(rq); |
| 3631 | 3644 | ||
| 3632 | list_move_tail(&rq->sched.link, virtual_queue(ve)); | 3645 | ve->base.execlists.queue_priority_hint = INT_MIN; |
| 3646 | ve->request = NULL; | ||
| 3647 | } else { | ||
| 3648 | ve->base.execlists.queue_priority_hint = rq_prio(rq); | ||
| 3649 | ve->request = i915_request_get(rq); | ||
| 3650 | |||
| 3651 | GEM_BUG_ON(!list_empty(virtual_queue(ve))); | ||
| 3652 | list_move_tail(&rq->sched.link, virtual_queue(ve)); | ||
| 3653 | |||
| 3654 | tasklet_schedule(&ve->base.execlists.tasklet); | ||
| 3655 | } | ||
| 3633 | 3656 | ||
| 3634 | tasklet_schedule(&ve->base.execlists.tasklet); | 3657 | spin_unlock_irqrestore(&ve->base.active.lock, flags); |
| 3635 | } | 3658 | } |
| 3636 | 3659 | ||
| 3637 | static struct ve_bond * | 3660 | static struct ve_bond * |
| @@ -969,6 +969,9 @@ i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj, · 968 unmodified lines | |||
| 969 | 969 | ||
| 970 | lockdep_assert_held(&obj->base.dev->struct_mutex); | 970 | lockdep_assert_held(&obj->base.dev->struct_mutex); |
| 971 | 971 | ||
| 972 | if (i915_gem_object_never_bind_ggtt(obj)) | ||
| 973 | return ERR_PTR(-ENODEV); | ||
| 974 | |||
| 972 | if (flags & PIN_MAPPABLE && | 975 | if (flags & PIN_MAPPABLE && |
| 973 | (!view || view->type == I915_GGTT_VIEW_NORMAL)) { | 976 | (!view || view->type == I915_GGTT_VIEW_NORMAL)) { |
| 974 | /* If the required space is larger than the available | 977 | /* If the required space is larger than the available |
| @@ -26,6 +26,8 @@ · 25 unmodified lines | |||
| 26 | #include "dsi_cfg.h" | 26 | #include "dsi_cfg.h" |
| 27 | #include "msm_kms.h" | 27 | #include "msm_kms.h" |
| 28 | 28 | ||
| 29 | #define DSI_RESET_TOGGLE_DELAY_MS 20 | ||
| 30 | |||
| 29 | static int dsi_get_version(const void __iomem *base, u32 *major, u32 *minor) | 31 | static int dsi_get_version(const void __iomem *base, u32 *major, u32 *minor) |
| 30 | { | 32 | { |
| 31 | u32 ver; | 33 | u32 ver; |
| @@ -986,7 +988,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host) · 954 unmodified lines | |||
| 986 | wmb(); /* clocks need to be enabled before reset */ | 988 | wmb(); /* clocks need to be enabled before reset */ |
| 987 | 989 | ||
| 988 | dsi_write(msm_host, REG_DSI_RESET, 1); | 990 | dsi_write(msm_host, REG_DSI_RESET, 1); |
| 989 | wmb(); /* make sure reset happen */ | 991 | msleep(DSI_RESET_TOGGLE_DELAY_MS); /* make sure reset happen */ |
| 990 | dsi_write(msm_host, REG_DSI_RESET, 0); | 992 | dsi_write(msm_host, REG_DSI_RESET, 0); |
| 991 | } | 993 | } |
| 992 | 994 | ||
| @@ -1396,7 +1398,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host) · 403 unmodified lines | |||
| 1396 | 1398 | ||
| 1397 | /* dsi controller can only be reset while clocks are running */ | 1399 | /* dsi controller can only be reset while clocks are running */ |
| 1398 | dsi_write(msm_host, REG_DSI_RESET, 1); | 1400 | dsi_write(msm_host, REG_DSI_RESET, 1); |
| 1399 | wmb(); /* make sure reset happen */ | 1401 | msleep(DSI_RESET_TOGGLE_DELAY_MS); /* make sure reset happen */ |
| 1400 | dsi_write(msm_host, REG_DSI_RESET, 0); | 1402 | dsi_write(msm_host, REG_DSI_RESET, 0); |
| 1401 | wmb(); /* controller out of reset */ | 1403 | wmb(); /* controller out of reset */ |
| 1402 | dsi_write(msm_host, REG_DSI_CTRL, data0); | 1404 | dsi_write(msm_host, REG_DSI_CTRL, data0); |
| @@ -208,6 +208,9 @@ static void panfrost_gpu_init_features(struct panfrost_device *pfdev) · 207 unmodified lines | |||
| 208 | pfdev->features.mem_features = gpu_read(pfdev, GPU_MEM_FEATURES); | 208 | pfdev->features.mem_features = gpu_read(pfdev, GPU_MEM_FEATURES); |
| 209 | pfdev->features.mmu_features = gpu_read(pfdev, GPU_MMU_FEATURES); | 209 | pfdev->features.mmu_features = gpu_read(pfdev, GPU_MMU_FEATURES); |
| 210 | pfdev->features.thread_features = gpu_read(pfdev, GPU_THREAD_FEATURES); | 210 | pfdev->features.thread_features = gpu_read(pfdev, GPU_THREAD_FEATURES); |
| 211 | pfdev->features.max_threads = gpu_read(pfdev, GPU_THREAD_MAX_THREADS); | ||
| 212 | pfdev->features.thread_max_workgroup_sz = gpu_read(pfdev, GPU_THREAD_MAX_WORKGROUP_SIZE); | ||
| 213 | pfdev->features.thread_max_barrier_sz = gpu_read(pfdev, GPU_THREAD_MAX_BARRIER_SIZE); | ||
| 211 | pfdev->features.coherency_features = gpu_read(pfdev, GPU_COHERENCY_FEATURES); | 214 | pfdev->features.coherency_features = gpu_read(pfdev, GPU_COHERENCY_FEATURES); |
| 212 | for (i = 0; i < 4; i++) | 215 | for (i = 0; i < 4; i++) |
| 213 | pfdev->features.texture_features[i] = gpu_read(pfdev, GPU_TEXTURE_FEATURES(i)); | 216 | pfdev->features.texture_features[i] = gpu_read(pfdev, GPU_TEXTURE_FEATURES(i)); |
| @@ -381,13 +381,19 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) · 380 unmodified lines | |||
| 381 | job_read(pfdev, JS_TAIL_LO(js)), | 381 | job_read(pfdev, JS_TAIL_LO(js)), |
| 382 | sched_job); | 382 | sched_job); |
| 383 | 383 | ||
| 384 | mutex_lock(&pfdev->reset_lock); | 384 | if (!mutex_trylock(&pfdev->reset_lock)) |
| 385 | return; | ||
| 385 | 386 | ||
| 386 | for (i = 0; i < NUM_JOB_SLOTS; i++) | 387 | for (i = 0; i < NUM_JOB_SLOTS; i++) { |
| 387 | drm_sched_stop(&pfdev->js->queue[i].sched, sched_job); | 388 | struct drm_gpu_scheduler *sched = &pfdev->js->queue[i].sched; |
| 389 | |||
| 390 | drm_sched_stop(sched, sched_job); | ||
| 391 | if (js != i) | ||
| 392 | /* Ensure any timeouts on other slots have finished */ | ||
| 393 | cancel_delayed_work_sync(&sched->work_tdr); | ||
| 394 | } | ||
| 388 | 395 | ||
| 389 | if (sched_job) | 396 | drm_sched_increase_karma(sched_job); |
| 390 | drm_sched_increase_karma(sched_job); | ||
| 391 | 397 | ||
| 392 | spin_lock_irqsave(&pfdev->js->job_lock, flags); | 398 | spin_lock_irqsave(&pfdev->js->job_lock, flags); |
| 393 | for (i = 0; i < NUM_JOB_SLOTS; i++) { | 399 | for (i = 0; i < NUM_JOB_SLOTS; i++) { |
| @@ -379,19 +379,11 @@ radeon_pci_remove(struct pci_dev *pdev) · 378 unmodified lines | |||
| 379 | static void | 379 | static void |
| 380 | radeon_pci_shutdown(struct pci_dev *pdev) | 380 | radeon_pci_shutdown(struct pci_dev *pdev) |
| 381 | { | 381 | { |
| 382 | struct drm_device *ddev = pci_get_drvdata(pdev); | ||
| 383 | |||
| 384 | /* if we are running in a VM, make sure the device | 382 | /* if we are running in a VM, make sure the device |
| 385 | * torn down properly on reboot/shutdown | 383 | * torn down properly on reboot/shutdown |
| 386 | */ | 384 | */ |
| 387 | if (radeon_device_is_virtual()) | 385 | if (radeon_device_is_virtual()) |
| 388 | radeon_pci_remove(pdev); | 386 | radeon_pci_remove(pdev); |
| 389 | |||
| 390 | /* Some adapters need to be suspended before a | ||
| 391 | * shutdown occurs in order to prevent an error | ||
| 392 | * during kexec. | ||
| 393 | */ | ||
| 394 | radeon_suspend_kms(ddev, true, true, false); | ||
| 395 | } | 387 | } |
| 396 | 388 | ||
| 397 | static int radeon_pmops_suspend(struct device *dev) | 389 | static int radeon_pmops_suspend(struct device *dev) |
| @@ -63,7 +63,6 @@ config TINYDRM_REPAPER · 62 unmodified lines | |||
| 63 | depends on DRM && SPI | 63 | depends on DRM && SPI |
| 64 | select DRM_KMS_HELPER | 64 | select DRM_KMS_HELPER |
| 65 | select DRM_KMS_CMA_HELPER | 65 | select DRM_KMS_CMA_HELPER |
| 66 | depends on THERMAL || !THERMAL | ||
| 67 | help | 66 | help |
| 68 | DRM driver for the following Pervasive Displays panels: | 67 | DRM driver for the following Pervasive Displays panels: |
| 69 | 1.44" TFT EPD Panel (E1144CS021) | 68 | 1.44" TFT EPD Panel (E1144CS021) |
| @@ -185,8 +185,9 @@ static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo, · 184 unmodified lines | |||
| 185 | list_add_tail(&bo->lru, &man->lru[bo->priority]); | 185 | list_add_tail(&bo->lru, &man->lru[bo->priority]); |
| 186 | kref_get(&bo->list_kref); | 186 | kref_get(&bo->list_kref); |
| 187 | 187 | ||
| 188 | if (bo->ttm && !(bo->ttm->page_flags & | 188 | if (!(man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm && |
| 189 | (TTM_PAGE_FLAG_SG | TTM_PAGE_FLAG_SWAPPED))) { | 189 | !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG | |
| 190 | TTM_PAGE_FLAG_SWAPPED))) { | ||
| 190 | list_add_tail(&bo->swap, &bdev->glob->swap_lru[bo->priority]); | 191 | list_add_tail(&bo->swap, &bdev->glob->swap_lru[bo->priority]); |
| 191 | kref_get(&bo->list_kref); | 192 | kref_get(&bo->list_kref); |
| 192 | } | 193 | } |
| @@ -878,11 +879,11 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev, · 685 unmodified lines | |||
| 878 | 879 | ||
| 879 | if (!bo) { | 880 | if (!bo) { |
| 880 | if (busy_bo) | 881 | if (busy_bo) |
| 881 | ttm_bo_get(busy_bo); | 882 | kref_get(&busy_bo->list_kref); |
| 882 | spin_unlock(&glob->lru_lock); | 883 | spin_unlock(&glob->lru_lock); |
| 883 | ret = ttm_mem_evict_wait_busy(busy_bo, ctx, ticket); | 884 | ret = ttm_mem_evict_wait_busy(busy_bo, ctx, ticket); |
| 884 | if (busy_bo) | 885 | if (busy_bo) |
| 885 | ttm_bo_put(busy_bo); | 886 | kref_put(&busy_bo->list_kref, ttm_bo_release_list); |
| 886 | return ret; | 887 | return ret; |
| 887 | } | 888 | } |
| 888 | 889 | ||
| @@ -278,15 +278,13 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) · 277 unmodified lines | |||
| 278 | else | 278 | else |
| 279 | ret = vmf_insert_pfn(&cvma, address, pfn); | 279 | ret = vmf_insert_pfn(&cvma, address, pfn); |
| 280 | 280 | ||
| 281 | /* | 281 | /* Never error on prefaulted PTEs */ |
| 282 | * Somebody beat us to this PTE or prefaulting to | 282 | if (unlikely((ret & VM_FAULT_ERROR))) { |
| 283 | * an already populated PTE, or prefaulting error. | 283 | if (i == 0) |
| 284 | */ | 284 | goto out_io_unlock; |
| 285 | 285 | else | |
| 286 | if (unlikely((ret == VM_FAULT_NOPAGE && i > 0))) | 286 | break; |
| 287 | break; | 287 | } |
| 288 | else if (unlikely(ret & VM_FAULT_ERROR)) | ||
| 289 | goto out_io_unlock; | ||
| 290 | 288 | ||
| 291 | address += PAGE_SIZE; | 289 | address += PAGE_SIZE; |
| 292 | if (unlikely(++page_offset >= page_last)) | 290 | if (unlikely(++page_offset >= page_last)) |
| @@ -108,6 +108,12 @@ · 107 unmodified lines | |||
| 108 | #define ASPEED_I2CD_S_TX_CMD BIT(2) | 108 | #define ASPEED_I2CD_S_TX_CMD BIT(2) |
| 109 | #define ASPEED_I2CD_M_TX_CMD BIT(1) | 109 | #define ASPEED_I2CD_M_TX_CMD BIT(1) |
| 110 | #define ASPEED_I2CD_M_START_CMD BIT(0) | 110 | #define ASPEED_I2CD_M_START_CMD BIT(0) |
| 111 | #define ASPEED_I2CD_MASTER_CMDS_MASK \ | ||
| 112 | (ASPEED_I2CD_M_STOP_CMD | \ | ||
| 113 | ASPEED_I2CD_M_S_RX_CMD_LAST | \ | ||
| 114 | ASPEED_I2CD_M_RX_CMD | \ | ||
| 115 | ASPEED_I2CD_M_TX_CMD | \ | ||
| 116 | ASPEED_I2CD_M_START_CMD) | ||
| 111 | 117 | ||
| 112 | /* 0x18 : I2CD Slave Device Address Register */ | 118 | /* 0x18 : I2CD Slave Device Address Register */ |
| 113 | #define ASPEED_I2CD_DEV_ADDR_MASK GENMASK(6, 0) | 119 | #define ASPEED_I2CD_DEV_ADDR_MASK GENMASK(6, 0) |
| @@ -336,18 +342,19 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) · 222 unmodified lines | |||
| 336 | struct i2c_msg *msg = &bus->msgs[bus->msgs_index]; | 342 | struct i2c_msg *msg = &bus->msgs[bus->msgs_index]; |
| 337 | u8 slave_addr = i2c_8bit_addr_from_msg(msg); | 343 | u8 slave_addr = i2c_8bit_addr_from_msg(msg); |
| 338 | 344 | ||
| 339 | bus->master_state = ASPEED_I2C_MASTER_START; | ||
| 340 | |||
| 341 | #if IS_ENABLED(CONFIG_I2C_SLAVE) | 345 | #if IS_ENABLED(CONFIG_I2C_SLAVE) |
| 342 | /* | 346 | /* |
| 343 | * If it's requested in the middle of a slave session, set the master | 347 | * If it's requested in the middle of a slave session, set the master |
| 344 | * state to 'pending' then H/W will continue handling this master | 348 | * state to 'pending' then H/W will continue handling this master |
| 345 | * command when the bus comes back to the idle state. | 349 | * command when the bus comes back to the idle state. |
| 346 | */ | 350 | */ |
| 347 | if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) | 351 | if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) { |
| 348 | bus->master_state = ASPEED_I2C_MASTER_PENDING; | 352 | bus->master_state = ASPEED_I2C_MASTER_PENDING; |
| 353 | return; | ||
| 354 | } | ||
| 349 | #endif /* CONFIG_I2C_SLAVE */ | 355 | #endif /* CONFIG_I2C_SLAVE */ |
| 350 | 356 | ||
| 357 | bus->master_state = ASPEED_I2C_MASTER_START; | ||
| 351 | bus->buf_index = 0; | 358 | bus->buf_index = 0; |
| 352 | 359 | ||
| 353 | if (msg->flags & I2C_M_RD) { | 360 | if (msg->flags & I2C_M_RD) { |
| @@ -422,20 +429,6 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) · 68 unmodified lines | |||
| 422 | } | 429 | } |
| 423 | } | 430 | } |
| 424 | 431 | ||
| 425 | #if IS_ENABLED(CONFIG_I2C_SLAVE) | ||
| 426 | /* | ||
| 427 | * A pending master command will be started by H/W when the bus comes | ||
| 428 | * back to idle state after completing a slave operation so change the | ||
| 429 | * master state from 'pending' to 'start' at here if slave is inactive. | ||
| 430 | */ | ||
| 431 | if (bus->master_state == ASPEED_I2C_MASTER_PENDING) { | ||
| 432 | if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) | ||
| 433 | goto out_no_complete; | ||
| 434 | |||
| 435 | bus->master_state = ASPEED_I2C_MASTER_START; | ||
| 436 | } | ||
| 437 | #endif /* CONFIG_I2C_SLAVE */ | ||
| 438 | |||
| 439 | /* Master is not currently active, irq was for someone else. */ | 432 | /* Master is not currently active, irq was for someone else. */ |
| 440 | if (bus->master_state == ASPEED_I2C_MASTER_INACTIVE || | 433 | if (bus->master_state == ASPEED_I2C_MASTER_INACTIVE || |
| 441 | bus->master_state == ASPEED_I2C_MASTER_PENDING) | 434 | bus->master_state == ASPEED_I2C_MASTER_PENDING) |
| @@ -462,11 +455,15 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) · 20 unmodified lines | |||
| 462 | #if IS_ENABLED(CONFIG_I2C_SLAVE) | 455 | #if IS_ENABLED(CONFIG_I2C_SLAVE) |
| 463 | /* | 456 | /* |
| 464 | * If a peer master starts a xfer immediately after it queues a | 457 | * If a peer master starts a xfer immediately after it queues a |
| 465 | * master command, change its state to 'pending' then H/W will | 458 | * master command, clear the queued master command and change |
| 466 | * continue the queued master xfer just after completing the | 459 | * its state to 'pending'. To simplify handling of pending |
| 467 | * slave mode session. | 460 | * cases, it uses S/W solution instead of H/W command queue |
| 461 | * handling. | ||
| 468 | */ | 462 | */ |
| 469 | if (unlikely(irq_status & ASPEED_I2CD_INTR_SLAVE_MATCH)) { | 463 | if (unlikely(irq_status & ASPEED_I2CD_INTR_SLAVE_MATCH)) { |
| 464 | writel(readl(bus->base + ASPEED_I2C_CMD_REG) & | ||
| 465 | ~ASPEED_I2CD_MASTER_CMDS_MASK, | ||
| 466 | bus->base + ASPEED_I2C_CMD_REG); | ||
| 470 | bus->master_state = ASPEED_I2C_MASTER_PENDING; | 467 | bus->master_state = ASPEED_I2C_MASTER_PENDING; |
| 471 | dev_dbg(bus->dev, | 468 | dev_dbg(bus->dev, |
| 472 | "master goes pending due to a slave start\n"); | 469 | "master goes pending due to a slave start\n"); |
| @@ -629,6 +626,14 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) · 156 unmodified lines | |||
| 629 | irq_handled |= aspeed_i2c_master_irq(bus, | 626 | irq_handled |= aspeed_i2c_master_irq(bus, |
| 630 | irq_remaining); | 627 | irq_remaining); |
| 631 | } | 628 | } |
| 629 | |||
| 630 | /* | ||
| 631 | * Start a pending master command at here if a slave operation is | ||
| 632 | * completed. | ||
| 633 | */ | ||
| 634 | if (bus->master_state == ASPEED_I2C_MASTER_PENDING && | ||
| 635 | bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE) | ||
| 636 | aspeed_i2c_do_start(bus); | ||
| 632 | #else | 637 | #else |
| 633 | irq_handled = aspeed_i2c_master_irq(bus, irq_remaining); | 638 | irq_handled = aspeed_i2c_master_irq(bus, irq_remaining); |
| 634 | #endif /* CONFIG_I2C_SLAVE */ | 639 | #endif /* CONFIG_I2C_SLAVE */ |
| @@ -691,6 +696,15 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap, · 56 unmodified lines | |||
| 691 | ASPEED_I2CD_BUS_BUSY_STS)) | 696 | ASPEED_I2CD_BUS_BUSY_STS)) |
| 692 | aspeed_i2c_recover_bus(bus); | 697 | aspeed_i2c_recover_bus(bus); |
| 693 | 698 | ||
| 699 | /* | ||
| 700 | * If timed out and the state is still pending, drop the pending | ||
| 701 | * master command. | ||
| 702 | */ | ||
| 703 | spin_lock_irqsave(&bus->lock, flags); | ||
| 704 | if (bus->master_state == ASPEED_I2C_MASTER_PENDING) | ||
| 705 | bus->master_state = ASPEED_I2C_MASTER_INACTIVE; | ||
| 706 | spin_unlock_irqrestore(&bus->lock, flags); | ||
| 707 | |||
| 694 | return -ETIMEDOUT; | 708 | return -ETIMEDOUT; |
| 695 | } | 709 | } |
| 696 | 710 | ||
| @@ -875,7 +875,7 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id) · 874 unmodified lines | |||
| 875 | 875 | ||
| 876 | static u32 mtk_i2c_functionality(struct i2c_adapter *adap) | 876 | static u32 mtk_i2c_functionality(struct i2c_adapter *adap) |
| 877 | { | 877 | { |
| 878 | if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN) | 878 | if (i2c_check_quirks(adap, I2C_AQ_NO_ZERO_LEN)) |
| 879 | return I2C_FUNC_I2C | | 879 | return I2C_FUNC_I2C | |
| 880 | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK); | 880 | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK); |
| 881 | else | 881 | else |
| @@ -305,7 +305,7 @@ struct stm32f7_i2c_dev { · 304 unmodified lines | |||
| 305 | struct regmap *regmap; | 305 | struct regmap *regmap; |
| 306 | }; | 306 | }; |
| 307 | 307 | ||
| 308 | /** | 308 | /* |
| 309 | * All these values are coming from I2C Specification, Version 6.0, 4th of | 309 | * All these values are coming from I2C Specification, Version 6.0, 4th of |
| 310 | * April 2014. | 310 | * April 2014. |
| 311 | * | 311 | * |
| @@ -1192,6 +1192,8 @@ static void stm32f7_i2c_slave_start(struct stm32f7_i2c_dev *i2c_dev) · 880 unmodified lines | |||
| 1192 | STM32F7_I2C_CR1_TXIE; | 1192 | STM32F7_I2C_CR1_TXIE; |
| 1193 | stm32f7_i2c_set_bits(base + STM32F7_I2C_CR1, mask); | 1193 | stm32f7_i2c_set_bits(base + STM32F7_I2C_CR1, mask); |
| 1194 | 1194 | ||
| 1195 | /* Write 1st data byte */ | ||
| 1196 | writel_relaxed(value, base + STM32F7_I2C_TXDR); | ||
| 1195 | } else { | 1197 | } else { |
| 1196 | /* Notify i2c slave that new write transfer is starting */ | 1198 | /* Notify i2c slave that new write transfer is starting */ |
| 1197 | i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value); | 1199 | i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value); |
| @@ -1501,7 +1503,7 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data) · 303 unmodified lines | |||
| 1501 | void __iomem *base = i2c_dev->base; | 1503 | void __iomem *base = i2c_dev->base; |
| 1502 | struct device *dev = i2c_dev->dev; | 1504 | struct device *dev = i2c_dev->dev; |
| 1503 | struct stm32_i2c_dma *dma = i2c_dev->dma; | 1505 | struct stm32_i2c_dma *dma = i2c_dev->dma; |
| 1504 | u32 mask, status; | 1506 | u32 status; |
| 1505 | 1507 | ||
| 1506 | status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR); | 1508 | status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR); |
| 1507 | 1509 | ||
| @@ -1526,12 +1528,15 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data) · 18 unmodified lines | |||
| 1526 | f7_msg->result = -EINVAL; | 1528 | f7_msg->result = -EINVAL; |
| 1527 | } | 1529 | } |
| 1528 | 1530 | ||
| 1529 | /* Disable interrupts */ | 1531 | if (!i2c_dev->slave_running) { |
| 1530 | if (stm32f7_i2c_is_slave_registered(i2c_dev)) | 1532 | u32 mask; |
| 1531 | mask = STM32F7_I2C_XFER_IRQ_MASK; | 1533 | /* Disable interrupts */ |
| 1532 | else | 1534 | if (stm32f7_i2c_is_slave_registered(i2c_dev)) |
| 1533 | mask = STM32F7_I2C_ALL_IRQ_MASK; | 1535 | mask = STM32F7_I2C_XFER_IRQ_MASK; |
| 1534 | stm32f7_i2c_disable_irq(i2c_dev, mask); | 1536 | else |
| 1537 | mask = STM32F7_I2C_ALL_IRQ_MASK; | ||
| 1538 | stm32f7_i2c_disable_irq(i2c_dev, mask); | ||
| 1539 | } | ||
| 1535 | 1540 | ||
| 1536 | /* Disable dma */ | 1541 | /* Disable dma */ |
| 1537 | if (i2c_dev->use_dma) { | 1542 | if (i2c_dev->use_dma) { |
| @@ -232,10 +232,7 @@ static int da9063_onkey_probe(struct platform_device *pdev) · 231 unmodified lines | |||
| 232 | onkey->input->phys = onkey->phys; | 232 | onkey->input->phys = onkey->phys; |
| 233 | onkey->input->dev.parent = &pdev->dev; | 233 | onkey->input->dev.parent = &pdev->dev; |
| 234 | 234 | ||
| 235 | if (onkey->key_power) | 235 | input_set_capability(onkey->input, EV_KEY, KEY_POWER); |
| 236 | input_set_capability(onkey->input, EV_KEY, KEY_POWER); | ||
| 237 | |||
| 238 | input_set_capability(onkey->input, EV_KEY, KEY_SLEEP); | ||
| 239 | 236 | ||
| 240 | INIT_DELAYED_WORK(&onkey->work, da9063_poll_on); | 237 | INIT_DELAYED_WORK(&onkey->work, da9063_poll_on); |
| 241 | 238 | ||
| @@ -92,11 +92,18 @@ soc_button_device_create(struct platform_device *pdev, · 91 unmodified lines | |||
| 92 | continue; | 92 | continue; |
| 93 | 93 | ||
| 94 | gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index); | 94 | gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index); |
| 95 | if (gpio < 0 && gpio != -ENOENT) { | 95 | if (!gpio_is_valid(gpio)) { |
| 96 | error = gpio; | 96 | /* |
| 97 | goto err_free_mem; | 97 | * Skip GPIO if not present. Note we deliberately |
| 98 | } else if (!gpio_is_valid(gpio)) { | 98 | * ignore -EPROBE_DEFER errors here. On some devices |
| 99 | /* Skip GPIO if not present */ | 99 | * Intel is using so called virtual GPIOs which are not |
| 100 | * GPIOs at all but some way for AML code to check some | ||
| 101 | * random status bits without need a custom opregion. | ||
| 102 | * In some cases the resources table we parse points to | ||
| 103 | * such a virtual GPIO, since these are not real GPIOs | ||
| 104 | * we do not have a driver for these so they will never | ||
| 105 | * show up, therefore we ignore -EPROBE_DEFER. | ||
| 106 | */ | ||
| 100 | continue; | 107 | continue; |
| 101 | } | 108 | } |
| 102 | 109 | ||
| @@ -1827,31 +1827,6 @@ static int elantech_create_smbus(struct psmouse *psmouse, · 1826 unmodified lines | |||
| 1827 | leave_breadcrumbs); | 1827 | leave_breadcrumbs); |
| 1828 | } | 1828 | } |
| 1829 | 1829 | ||
| 1830 | static bool elantech_use_host_notify(struct psmouse *psmouse, | ||
| 1831 | struct elantech_device_info *info) | ||
| 1832 | { | ||
| 1833 | if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) | ||
| 1834 | return true; | ||
| 1835 | |||
| 1836 | switch (info->bus) { | ||
| 1837 | case ETP_BUS_PS2_ONLY: | ||
| 1838 | /* expected case */ | ||
| 1839 | break; | ||
| 1840 | case ETP_BUS_SMB_HST_NTFY_ONLY: | ||
| 1841 | case ETP_BUS_PS2_SMB_HST_NTFY: | ||
| 1842 | /* SMbus implementation is stable since 2018 */ | ||
| 1843 | if (dmi_get_bios_year() >= 2018) | ||
| 1844 | return true; | ||
| 1845 | /* fall through */ | ||
| 1846 | default: | ||
| 1847 | psmouse_dbg(psmouse, | ||
| 1848 | "Ignoring SMBus bus provider %d\n", info->bus); | ||
| 1849 | break; | ||
| 1850 | } | ||
| 1851 | |||
| 1852 | return false; | ||
| 1853 | } | ||
| 1854 | |||
| 1855 | /** | 1830 | /** |
| 1856 | * elantech_setup_smbus - called once the PS/2 devices are enumerated | 1831 | * elantech_setup_smbus - called once the PS/2 devices are enumerated |
| 1857 | * and decides to instantiate a SMBus InterTouch device. | 1832 | * and decides to instantiate a SMBus InterTouch device. |
| @@ -1871,7 +1846,7 @@ static int elantech_setup_smbus(struct psmouse *psmouse, · 13 unmodified lines | |||
| 1871 | * i2c_blacklist_pnp_ids. | 1846 | * i2c_blacklist_pnp_ids. |
| 1872 | * Old ICs are up to the user to decide. | 1847 | * Old ICs are up to the user to decide. |
| 1873 | */ | 1848 | */ |
| 1874 | if (!elantech_use_host_notify(psmouse, info) || | 1849 | if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) || |
| 1875 | psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids)) | 1850 | psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids)) |
| 1876 | return -ENXIO; | 1851 | return -ENXIO; |
| 1877 | } | 1852 | } |
| @@ -1891,6 +1866,34 @@ static int elantech_setup_smbus(struct psmouse *psmouse, · 13 unmodified lines | |||
| 1891 | return 0; | 1866 | return 0; |
| 1892 | } | 1867 | } |
| 1893 | 1868 | ||
| 1869 | static bool elantech_use_host_notify(struct psmouse *psmouse, | ||
| 1870 | struct elantech_device_info *info) | ||
| 1871 | { | ||
| 1872 | if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version)) | ||
| 1873 | return true; | ||
| 1874 | |||
| 1875 | switch (info->bus) { | ||
| 1876 | case ETP_BUS_PS2_ONLY: | ||
| 1877 | /* expected case */ | ||
| 1878 | break; | ||
| 1879 | case ETP_BUS_SMB_ALERT_ONLY: | ||
| 1880 | /* fall-through */ | ||
| 1881 | case ETP_BUS_PS2_SMB_ALERT: | ||
| 1882 | psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n"); | ||
| 1883 | break; | ||
| 1884 | case ETP_BUS_SMB_HST_NTFY_ONLY: | ||
| 1885 | /* fall-through */ | ||
| 1886 | case ETP_BUS_PS2_SMB_HST_NTFY: | ||
| 1887 | return true; | ||
| 1888 | default: | ||
| 1889 | psmouse_dbg(psmouse, | ||
| 1890 | "Ignoring SMBus bus provider %d.\n", | ||
| 1891 | info->bus); | ||
| 1892 | } | ||
| 1893 | |||
| 1894 | return false; | ||
| 1895 | } | ||
| 1896 | |||
| 1894 | int elantech_init_smbus(struct psmouse *psmouse) | 1897 | int elantech_init_smbus(struct psmouse *psmouse) |
| 1895 | { | 1898 | { |
| 1896 | struct elantech_device_info info; | 1899 | struct elantech_device_info info; |
| @@ -146,7 +146,7 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) · 145 unmodified lines | |||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | mutex_lock(&data->irq_mutex); | 148 | mutex_lock(&data->irq_mutex); |
| 149 | bitmap_and(data->irq_status, data->irq_status, data->current_irq_mask, | 149 | bitmap_and(data->irq_status, data->irq_status, data->fn_irq_bits, |
| 150 | data->irq_count); | 150 | data->irq_count); |
| 151 | /* | 151 | /* |
| 152 | * At this point, irq_status has all bits that are set in the | 152 | * At this point, irq_status has all bits that are set in the |
| @@ -385,6 +385,8 @@ static int rmi_driver_set_irq_bits(struct rmi_device *rmi_dev, · 232 unmodified lines | |||
| 385 | bitmap_copy(data->current_irq_mask, data->new_irq_mask, | 385 | bitmap_copy(data->current_irq_mask, data->new_irq_mask, |
| 386 | data->num_of_irq_regs); | 386 | data->num_of_irq_regs); |
| 387 | 387 | ||
| 388 | bitmap_or(data->fn_irq_bits, data->fn_irq_bits, mask, data->irq_count); | ||
| 389 | |||
| 388 | error_unlock: | 390 | error_unlock: |
| 389 | mutex_unlock(&data->irq_mutex); | 391 | mutex_unlock(&data->irq_mutex); |
| 390 | return error; | 392 | return error; |
| @@ -398,6 +400,8 @@ static int rmi_driver_clear_irq_bits(struct rmi_device *rmi_dev, · 7 unmodified lines | |||
| 398 | struct device *dev = &rmi_dev->dev; | 400 | struct device *dev = &rmi_dev->dev; |
| 399 | 401 | ||
| 400 | mutex_lock(&data->irq_mutex); | 402 | mutex_lock(&data->irq_mutex); |
| 403 | bitmap_andnot(data->fn_irq_bits, | ||
| 404 | data->fn_irq_bits, mask, data->irq_count); | ||
| 401 | bitmap_andnot(data->new_irq_mask, | 405 | bitmap_andnot(data->new_irq_mask, |
| 402 | data->current_irq_mask, mask, data->irq_count); | 406 | data->current_irq_mask, mask, data->irq_count); |
| 403 | 407 | ||
| @@ -53,6 +53,7 @@ struct goodix_ts_data { · 52 unmodified lines | |||
| 53 | const char *cfg_name; | 53 | const char *cfg_name; |
| 54 | struct completion firmware_loading_complete; | 54 | struct completion firmware_loading_complete; |
| 55 | unsigned long irq_flags; | 55 | unsigned long irq_flags; |
| 56 | unsigned int contact_size; | ||
| 56 | }; | 57 | }; |
| 57 | 58 | ||
| 58 | #define GOODIX_GPIO_INT_NAME "irq" | 59 | #define GOODIX_GPIO_INT_NAME "irq" |
| @@ -62,6 +63,7 @@ struct goodix_ts_data { · 3 unmodified lines | |||
| 62 | #define GOODIX_MAX_WIDTH 4096 | 63 | #define GOODIX_MAX_WIDTH 4096 |
| 63 | #define GOODIX_INT_TRIGGER 1 | 64 | #define GOODIX_INT_TRIGGER 1 |
| 64 | #define GOODIX_CONTACT_SIZE 8 | 65 | #define GOODIX_CONTACT_SIZE 8 |
| 66 | #define GOODIX_MAX_CONTACT_SIZE 9 | ||
| 65 | #define GOODIX_MAX_CONTACTS 10 | 67 | #define GOODIX_MAX_CONTACTS 10 |
| 66 | 68 | ||
| 67 | #define GOODIX_CONFIG_MAX_LENGTH 240 | 69 | #define GOODIX_CONFIG_MAX_LENGTH 240 |
| @@ -144,6 +146,19 @@ static const struct dmi_system_id rotated_screen[] = { · 76 unmodified lines | |||
| 144 | {} | 146 | {} |
| 145 | }; | 147 | }; |
| 146 | 148 | ||
| 149 | static const struct dmi_system_id nine_bytes_report[] = { | ||
| 150 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
| 151 | { | ||
| 152 | .ident = "Lenovo YogaBook", | ||
| 153 | /* YB1-X91L/F and YB1-X90L/F */ | ||
| 154 | .matches = { | ||
| 155 | DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9") | ||
| 156 | } | ||
| 157 | }, | ||
| 158 | #endif | ||
| 159 | {} | ||
| 160 | }; | ||
| 161 | |||
| 147 | /** | 162 | /** |
| 148 | * goodix_i2c_read - read data from a register of the i2c slave device. | 163 | * goodix_i2c_read - read data from a register of the i2c slave device. |
| 149 | * | 164 | * |
| @@ -249,7 +264,7 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) · 99 unmodified lines | |||
| 249 | max_timeout = jiffies + msecs_to_jiffies(GOODIX_BUFFER_STATUS_TIMEOUT); | 264 | max_timeout = jiffies + msecs_to_jiffies(GOODIX_BUFFER_STATUS_TIMEOUT); |
| 250 | do { | 265 | do { |
| 251 | error = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR, | 266 | error = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR, |
| 252 | data, GOODIX_CONTACT_SIZE + 1); | 267 | data, ts->contact_size + 1); |
| 253 | if (error) { | 268 | if (error) { |
| 254 | dev_err(&ts->client->dev, "I2C transfer error: %d\n", | 269 | dev_err(&ts->client->dev, "I2C transfer error: %d\n", |
| 255 | error); | 270 | error); |
| @@ -262,12 +277,12 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) · 6 unmodified lines | |||
| 262 | return -EPROTO; | 277 | return -EPROTO; |
| 263 | 278 | ||
| 264 | if (touch_num > 1) { | 279 | if (touch_num > 1) { |
| 265 | data += 1 + GOODIX_CONTACT_SIZE; | 280 | data += 1 + ts->contact_size; |
| 266 | error = goodix_i2c_read(ts->client, | 281 | error = goodix_i2c_read(ts->client, |
| 267 | GOODIX_READ_COOR_ADDR + | 282 | GOODIX_READ_COOR_ADDR + |
| 268 | 1 + GOODIX_CONTACT_SIZE, | 283 | 1 + ts->contact_size, |
| 269 | data, | 284 | data, |
| 270 | GOODIX_CONTACT_SIZE * | 285 | ts->contact_size * |
| 271 | (touch_num - 1)); | 286 | (touch_num - 1)); |
| 272 | if (error) | 287 | if (error) |
| 273 | return error; | 288 | return error; |
| @@ -286,7 +301,7 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) · 12 unmodified lines | |||
| 286 | return 0; | 301 | return 0; |
| 287 | } | 302 | } |
| 288 | 303 | ||
| 289 | static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) | 304 | static void goodix_ts_report_touch_8b(struct goodix_ts_data *ts, u8 *coor_data) |
| 290 | { | 305 | { |
| 291 | int id = coor_data[0] & 0x0F; | 306 | int id = coor_data[0] & 0x0F; |
| 292 | int input_x = get_unaligned_le16(&coor_data[1]); | 307 | int input_x = get_unaligned_le16(&coor_data[1]); |
| @@ -301,6 +316,21 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) · 8 unmodified lines | |||
| 301 | input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w); | 316 | input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w); |
| 302 | } | 317 | } |
| 303 | 318 | ||
| 319 | static void goodix_ts_report_touch_9b(struct goodix_ts_data *ts, u8 *coor_data) | ||
| 320 | { | ||
| 321 | int id = coor_data[1] & 0x0F; | ||
| 322 | int input_x = get_unaligned_le16(&coor_data[3]); | ||
| 323 | int input_y = get_unaligned_le16(&coor_data[5]); | ||
| 324 | int input_w = get_unaligned_le16(&coor_data[7]); | ||
| 325 | |||
| 326 | input_mt_slot(ts->input_dev, id); | ||
| 327 | input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); | ||
| 328 | touchscreen_report_pos(ts->input_dev, &ts->prop, | ||
| 329 | input_x, input_y, true); | ||
| 330 | input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w); | ||
| 331 | input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w); | ||
| 332 | } | ||
| 333 | |||
| 304 | /** | 334 | /** |
| 305 | * goodix_process_events - Process incoming events | 335 | * goodix_process_events - Process incoming events |
| 306 | * | 336 | * |
| @@ -311,7 +341,7 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) · 4 unmodified lines | |||
| 311 | */ | 341 | */ |
| 312 | static void goodix_process_events(struct goodix_ts_data *ts) | 342 | static void goodix_process_events(struct goodix_ts_data *ts) |
| 313 | { | 343 | { |
| 314 | u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS]; | 344 | u8 point_data[1 + GOODIX_MAX_CONTACT_SIZE * GOODIX_MAX_CONTACTS]; |
| 315 | int touch_num; | 345 | int touch_num; |
| 316 | int i; | 346 | int i; |
| 317 | 347 | ||
| @@ -326,8 +356,12 @@ static void goodix_process_events(struct goodix_ts_data *ts) · 8 unmodified lines | |||
| 326 | input_report_key(ts->input_dev, KEY_LEFTMETA, point_data[0] & BIT(4)); | 356 | input_report_key(ts->input_dev, KEY_LEFTMETA, point_data[0] & BIT(4)); |
| 327 | 357 | ||
| 328 | for (i = 0; i < touch_num; i++) | 358 | for (i = 0; i < touch_num; i++) |
| 329 | goodix_ts_report_touch(ts, | 359 | if (ts->contact_size == 9) |
| 330 | &point_data[1 + GOODIX_CONTACT_SIZE * i]); | 360 | goodix_ts_report_touch_9b(ts, |
| 361 | &point_data[1 + ts->contact_size * i]); | ||
| 362 | else | ||
| 363 | goodix_ts_report_touch_8b(ts, | ||
| 364 | &point_data[1 + ts->contact_size * i]); | ||
| 331 | 365 | ||
| 332 | input_mt_sync_frame(ts->input_dev); | 366 | input_mt_sync_frame(ts->input_dev); |
| 333 | input_sync(ts->input_dev); | 367 | input_sync(ts->input_dev); |
| @@ -730,6 +764,13 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) · 396 unmodified lines | |||
| 730 | "Applying '180 degrees rotated screen' quirk\n"); | 764 | "Applying '180 degrees rotated screen' quirk\n"); |
| 731 | } | 765 | } |
| 732 | 766 | ||
| 767 | if (dmi_check_system(nine_bytes_report)) { | ||
| 768 | ts->contact_size = 9; | ||
| 769 | |||
| 770 | dev_dbg(&ts->client->dev, | ||
| 771 | "Non-standard 9-bytes report format quirk\n"); | ||
| 772 | } | ||
| 773 | |||
| 733 | error = input_mt_init_slots(ts->input_dev, ts->max_touch_num, | 774 | error = input_mt_init_slots(ts->input_dev, ts->max_touch_num, |
| 734 | INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); | 775 | INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); |
| 735 | if (error) { | 776 | if (error) { |
| @@ -810,6 +851,7 @@ static int goodix_ts_probe(struct i2c_client *client, · 74 unmodified lines | |||
| 810 | ts->client = client; | 851 | ts->client = client; |
| 811 | i2c_set_clientdata(client, ts); | 852 | i2c_set_clientdata(client, ts); |
| 812 | init_completion(&ts->firmware_loading_complete); | 853 | init_completion(&ts->firmware_loading_complete); |
| 854 | ts->contact_size = GOODIX_CONTACT_SIZE; | ||
| 813 | 855 | ||
| 814 | error = goodix_get_gpio_config(ts); | 856 | error = goodix_get_gpio_config(ts); |
| 815 | if (error) | 857 | if (error) |
| @@ -81,8 +81,10 @@ static int st1232_ts_read_data(struct st1232_ts_data *ts) · 80 unmodified lines | |||
| 81 | for (i = 0, y = 0; i < ts->chip_info->max_fingers; i++, y += 3) { | 81 | for (i = 0, y = 0; i < ts->chip_info->max_fingers; i++, y += 3) { |
| 82 | finger[i].is_valid = buf[i + y] >> 7; | 82 | finger[i].is_valid = buf[i + y] >> 7; |
| 83 | if (finger[i].is_valid) { | 83 | if (finger[i].is_valid) { |
| 84 | finger[i].x = ((buf[i + y] & 0x0070) << 4) | buf[i + 1]; | 84 | finger[i].x = ((buf[i + y] & 0x0070) << 4) | |
| 85 | finger[i].y = ((buf[i + y] & 0x0007) << 8) | buf[i + 2]; | 85 | buf[i + y + 1]; |
| 86 | finger[i].y = ((buf[i + y] & 0x0007) << 8) | | ||
| 87 | buf[i + y + 2]; | ||
| 86 | 88 | ||
| 87 | /* st1232 includes a z-axis / touch strength */ | 89 | /* st1232 includes a z-axis / touch strength */ |
| 88 | if (ts->chip_info->have_z) | 90 | if (ts->chip_info->have_z) |
| @@ -583,7 +583,8 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) · 582 unmodified lines | |||
| 583 | retry: | 583 | retry: |
| 584 | type = (event[1] >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK; | 584 | type = (event[1] >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK; |
| 585 | devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK; | 585 | devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK; |
| 586 | pasid = PPR_PASID(*(u64 *)&event[0]); | 586 | pasid = (event[0] & EVENT_DOMID_MASK_HI) | |
| 587 | (event[1] & EVENT_DOMID_MASK_LO); | ||
| 587 | flags = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK; | 588 | flags = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK; |
| 588 | address = (u64)(((u64)event[3]) << 32) | event[2]; | 589 | address = (u64)(((u64)event[3]) << 32) | event[2]; |
| 589 | 590 | ||
| @@ -616,7 +617,7 @@ retry: · 26 unmodified lines | |||
| 616 | address, flags); | 617 | address, flags); |
| 617 | break; | 618 | break; |
| 618 | case EVENT_TYPE_PAGE_TAB_ERR: | 619 | case EVENT_TYPE_PAGE_TAB_ERR: |
| 619 | dev_err(dev, "Event logged [PAGE_TAB_HARDWARE_ERROR device=%02x:%02x.%x domain=0x%04x address=0x%llx flags=0x%04x]\n", | 620 | dev_err(dev, "Event logged [PAGE_TAB_HARDWARE_ERROR device=%02x:%02x.%x pasid=0x%04x address=0x%llx flags=0x%04x]\n", |
| 620 | PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), | 621 | PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid), |
| 621 | pasid, address, flags); | 622 | pasid, address, flags); |
| 622 | break; | 623 | break; |
| @@ -1463,6 +1464,7 @@ static void free_pagetable(struct protection_domain *domain) · 840 unmodified lines | |||
| 1463 | * to 64 bits. | 1464 | * to 64 bits. |
| 1464 | */ | 1465 | */ |
| 1465 | static bool increase_address_space(struct protection_domain *domain, | 1466 | static bool increase_address_space(struct protection_domain *domain, |
| 1467 | unsigned long address, | ||
| 1466 | gfp_t gfp) | 1468 | gfp_t gfp) |
| 1467 | { | 1469 | { |
| 1468 | unsigned long flags; | 1470 | unsigned long flags; |
| @@ -1471,8 +1473,8 @@ static bool increase_address_space(struct protection_domain *domain, · 2 unmodified lines | |||
| 1471 | 1473 | ||
| 1472 | spin_lock_irqsave(&domain->lock, flags); | 1474 | spin_lock_irqsave(&domain->lock, flags); |
| 1473 | 1475 | ||
| 1474 | if (WARN_ON_ONCE(domain->mode == PAGE_MODE_6_LEVEL)) | 1476 | if (address <= PM_LEVEL_SIZE(domain->mode) || |
| 1475 | /* address space already 64 bit large */ | 1477 | WARN_ON_ONCE(domain->mode == PAGE_MODE_6_LEVEL)) |
| 1476 | goto out; | 1478 | goto out; |
| 1477 | 1479 | ||
| 1478 | pte = (void *)get_zeroed_page(gfp); | 1480 | pte = (void *)get_zeroed_page(gfp); |
| @@ -1505,7 +1507,7 @@ static u64 *alloc_pte(struct protection_domain *domain, · 26 unmodified lines | |||
| 1505 | BUG_ON(!is_power_of_2(page_size)); | 1507 | BUG_ON(!is_power_of_2(page_size)); |
| 1506 | 1508 | ||
| 1507 | while (address > PM_LEVEL_SIZE(domain->mode)) | 1509 | while (address > PM_LEVEL_SIZE(domain->mode)) |
| 1508 | *updated = increase_address_space(domain, gfp) || *updated; | 1510 | *updated = increase_address_space(domain, address, gfp) || *updated; |
| 1509 | 1511 | ||
| 1510 | level = domain->mode - 1; | 1512 | level = domain->mode - 1; |
| 1511 | pte = &domain->pt_root[PM_LEVEL_INDEX(level, address)]; | 1513 | pte = &domain->pt_root[PM_LEVEL_INDEX(level, address)]; |
| @@ -130,8 +130,8 @@ · 129 unmodified lines | |||
| 130 | #define EVENT_TYPE_INV_PPR_REQ 0x9 | 130 | #define EVENT_TYPE_INV_PPR_REQ 0x9 |
| 131 | #define EVENT_DEVID_MASK 0xffff | 131 | #define EVENT_DEVID_MASK 0xffff |
| 132 | #define EVENT_DEVID_SHIFT 0 | 132 | #define EVENT_DEVID_SHIFT 0 |
| 133 | #define EVENT_DOMID_MASK 0xffff | 133 | #define EVENT_DOMID_MASK_LO 0xffff |
| 134 | #define EVENT_DOMID_SHIFT 0 | 134 | #define EVENT_DOMID_MASK_HI 0xf0000 |
| 135 | #define EVENT_FLAGS_MASK 0xfff | 135 | #define EVENT_FLAGS_MASK 0xfff |
| 136 | #define EVENT_FLAGS_SHIFT 0x10 | 136 | #define EVENT_FLAGS_SHIFT 0x10 |
| 137 | 137 | ||
| @@ -812,6 +812,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, · 811 unmodified lines | |||
| 812 | return 0; | 812 | return 0; |
| 813 | 813 | ||
| 814 | out_clear_smmu: | 814 | out_clear_smmu: |
| 815 | __arm_smmu_free_bitmap(smmu->context_map, cfg->cbndx); | ||
| 815 | smmu_domain->smmu = NULL; | 816 | smmu_domain->smmu = NULL; |
| 816 | out_unlock: | 817 | out_unlock: |
| 817 | mutex_unlock(&smmu_domain->init_mutex); | 818 | mutex_unlock(&smmu_domain->init_mutex); |
| @@ -3471,7 +3471,7 @@ static bool iommu_need_mapping(struct device *dev) · 3470 unmodified lines | |||
| 3471 | if (dev->coherent_dma_mask && dev->coherent_dma_mask < dma_mask) | 3471 | if (dev->coherent_dma_mask && dev->coherent_dma_mask < dma_mask) |
| 3472 | dma_mask = dev->coherent_dma_mask; | 3472 | dma_mask = dev->coherent_dma_mask; |
| 3473 | 3473 | ||
| 3474 | if (dma_mask >= dma_get_required_mask(dev)) | 3474 | if (dma_mask >= dma_direct_get_required_mask(dev)) |
| 3475 | return false; | 3475 | return false; |
| 3476 | 3476 | ||
| 3477 | /* | 3477 | /* |
| @@ -3775,6 +3775,13 @@ static int intel_map_sg(struct device *dev, struct scatterlist *sglist, int nele · 297 unmodified lines | |||
| 3775 | return nelems; | 3775 | return nelems; |
| 3776 | } | 3776 | } |
| 3777 | 3777 | ||
| 3778 | static u64 intel_get_required_mask(struct device *dev) | ||
| 3779 | { | ||
| 3780 | if (!iommu_need_mapping(dev)) | ||
| 3781 | return dma_direct_get_required_mask(dev); | ||
| 3782 | return DMA_BIT_MASK(32); | ||
| 3783 | } | ||
| 3784 | |||
| 3778 | static const struct dma_map_ops intel_dma_ops = { | 3785 | static const struct dma_map_ops intel_dma_ops = { |
| 3779 | .alloc = intel_alloc_coherent, | 3786 | .alloc = intel_alloc_coherent, |
| 3780 | .free = intel_free_coherent, | 3787 | .free = intel_free_coherent, |
| @@ -3787,6 +3794,7 @@ static const struct dma_map_ops intel_dma_ops = { · 6 unmodified lines | |||
| 3787 | .dma_supported = dma_direct_supported, | 3794 | .dma_supported = dma_direct_supported, |
| 3788 | .mmap = dma_common_mmap, | 3795 | .mmap = dma_common_mmap, |
| 3789 | .get_sgtable = dma_common_get_sgtable, | 3796 | .get_sgtable = dma_common_get_sgtable, |
| 3797 | .get_required_mask = intel_get_required_mask, | ||
| 3790 | }; | 3798 | }; |
| 3791 | 3799 | ||
| 3792 | static void | 3800 | static void |
| @@ -166,6 +166,9 @@ · 165 unmodified lines | |||
| 166 | #define ARM_MALI_LPAE_TTBR_READ_INNER BIT(2) | 166 | #define ARM_MALI_LPAE_TTBR_READ_INNER BIT(2) |
| 167 | #define ARM_MALI_LPAE_TTBR_SHARE_OUTER BIT(4) | 167 | #define ARM_MALI_LPAE_TTBR_SHARE_OUTER BIT(4) |
| 168 | 168 | ||
| 169 | #define ARM_MALI_LPAE_MEMATTR_IMP_DEF 0x88ULL | ||
| 170 | #define ARM_MALI_LPAE_MEMATTR_WRITE_ALLOC 0x8DULL | ||
| 171 | |||
| 169 | /* IOPTE accessors */ | 172 | /* IOPTE accessors */ |
| 170 | #define iopte_deref(pte,d) __va(iopte_to_paddr(pte, d)) | 173 | #define iopte_deref(pte,d) __va(iopte_to_paddr(pte, d)) |
| 171 | 174 | ||
| @@ -1015,27 +1018,56 @@ arm_32_lpae_alloc_pgtable_s2(struct io_pgtable_cfg *cfg, void *cookie) · 843 unmodified lines | |||
| 1015 | static struct io_pgtable * | 1018 | static struct io_pgtable * |
| 1016 | arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) | 1019 | arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie) |
| 1017 | { | 1020 | { |
| 1018 | struct io_pgtable *iop; | 1021 | struct arm_lpae_io_pgtable *data; |
| 1019 | 1022 | ||
| 1020 | if (cfg->ias != 48 || cfg->oas > 40) | 1023 | /* No quirks for Mali (hopefully) */ |
| 1024 | if (cfg->quirks) | ||
| 1025 | return NULL; | ||
| 1026 | |||
| 1027 | if (cfg->ias > 48 || cfg->oas > 40) | ||
| 1021 | return NULL; | 1028 | return NULL; |
| 1022 | 1029 | ||
| 1023 | cfg->pgsize_bitmap &= (SZ_4K | SZ_2M | SZ_1G); | 1030 | cfg->pgsize_bitmap &= (SZ_4K | SZ_2M | SZ_1G); |
| 1024 | iop = arm_64_lpae_alloc_pgtable_s1(cfg, cookie); | ||
| 1025 | if (iop) { | ||
| 1026 | u64 mair, ttbr; | ||
| 1027 | 1031 | ||
| 1028 | /* Copy values as union fields overlap */ | 1032 | data = arm_lpae_alloc_pgtable(cfg); |
| 1029 | mair = cfg->arm_lpae_s1_cfg.mair[0]; | 1033 | if (!data) |
| 1030 | ttbr = cfg->arm_lpae_s1_cfg.ttbr[0]; | 1034 | return NULL; |
| 1031 | 1035 | ||
| 1032 | cfg->arm_mali_lpae_cfg.memattr = mair; | 1036 | /* Mali seems to need a full 4-level table regardless of IAS */ |
| 1033 | cfg->arm_mali_lpae_cfg.transtab = ttbr | | 1037 | if (data->levels < ARM_LPAE_MAX_LEVELS) { |
| 1034 | ARM_MALI_LPAE_TTBR_READ_INNER | | 1038 | data->levels = ARM_LPAE_MAX_LEVELS; |
| 1035 | ARM_MALI_LPAE_TTBR_ADRMODE_TABLE; | 1039 | data->pgd_size = sizeof(arm_lpae_iopte); |
| 1036 | } | 1040 | } |
| 1041 | /* | ||
| 1042 | * MEMATTR: Mali has no actual notion of a non-cacheable type, so the | ||
| 1043 | * best we can do is mimic the out-of-tree driver and hope that the | ||
| 1044 | * "implementation-defined caching policy" is good enough. Similarly, | ||
| 1045 | * we'll use it for the sake of a valid attribute for our 'device' | ||
| 1046 | * index, although callers should never request that in practice. | ||
| 1047 | */ | ||
| 1048 | cfg->arm_mali_lpae_cfg.memattr = | ||
| 1049 | (ARM_MALI_LPAE_MEMATTR_IMP_DEF | ||
| 1050 | << ARM_LPAE_MAIR_ATTR_SHIFT(ARM_LPAE_MAIR_ATTR_IDX_NC)) | | ||
| 1051 | (ARM_MALI_LPAE_MEMATTR_WRITE_ALLOC | ||
| 1052 | << ARM_LPAE_MAIR_ATTR_SHIFT(ARM_LPAE_MAIR_ATTR_IDX_CACHE)) | | ||
| 1053 | (ARM_MALI_LPAE_MEMATTR_IMP_DEF | ||
| 1054 | << ARM_LPAE_MAIR_ATTR_SHIFT(ARM_LPAE_MAIR_ATTR_IDX_DEV)); | ||
| 1037 | 1055 | ||
| 1038 | return iop; | 1056 | data->pgd = __arm_lpae_alloc_pages(data->pgd_size, GFP_KERNEL, cfg); |
| 1057 | if (!data->pgd) | ||
| 1058 | goto out_free_data; | ||
| 1059 | |||
| 1060 | /* Ensure the empty pgd is visible before TRANSTAB can be written */ | ||
| 1061 | wmb(); | ||
| 1062 | |||
| 1063 | cfg->arm_mali_lpae_cfg.transtab = virt_to_phys(data->pgd) | | ||
| 1064 | ARM_MALI_LPAE_TTBR_READ_INNER | | ||
| 1065 | ARM_MALI_LPAE_TTBR_ADRMODE_TABLE; | ||
| 1066 | return &data->iop; | ||
| 1067 | |||
| 1068 | out_free_data: | ||
| 1069 | kfree(data); | ||
| 1070 | return NULL; | ||
| 1039 | } | 1071 | } |
| 1040 | 1072 | ||
| 1041 | struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s1_init_fns = { | 1073 | struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s1_init_fns = { |
| @@ -1086,8 +1086,6 @@ static int ipmmu_probe(struct platform_device *pdev) · 1085 unmodified lines | |||
| 1086 | 1086 | ||
| 1087 | mmu->num_ctx = min(IPMMU_CTX_MAX, mmu->features->number_of_contexts); | 1087 | mmu->num_ctx = min(IPMMU_CTX_MAX, mmu->features->number_of_contexts); |
| 1088 | 1088 | ||
| 1089 | irq = platform_get_irq(pdev, 0); | ||
| 1090 | |||
| 1091 | /* | 1089 | /* |
| 1092 | * Determine if this IPMMU instance is a root device by checking for | 1090 | * Determine if this IPMMU instance is a root device by checking for |
| 1093 | * the lack of has_cache_leaf_nodes flag or renesas,ipmmu-main property. | 1091 | * the lack of has_cache_leaf_nodes flag or renesas,ipmmu-main property. |
| @@ -1106,6 +1104,7 @@ static int ipmmu_probe(struct platform_device *pdev) · 12 unmodified lines | |||
| 1106 | 1104 | ||
| 1107 | /* Root devices have mandatory IRQs */ | 1105 | /* Root devices have mandatory IRQs */ |
| 1108 | if (ipmmu_is_root(mmu)) { | 1106 | if (ipmmu_is_root(mmu)) { |
| 1107 | irq = platform_get_irq(pdev, 0); | ||
| 1109 | if (irq < 0) { | 1108 | if (irq < 0) { |
| 1110 | dev_err(&pdev->dev, "no IRQ found\n"); | 1109 | dev_err(&pdev->dev, "no IRQ found\n"); |
| 1111 | return irq; | 1110 | return irq; |
| @@ -100,6 +100,7 @@ struct rk_iommu { · 99 unmodified lines | |||
| 100 | struct device *dev; | 100 | struct device *dev; |
| 101 | void __iomem **bases; | 101 | void __iomem **bases; |
| 102 | int num_mmu; | 102 | int num_mmu; |
| 103 | int num_irq; | ||
| 103 | struct clk_bulk_data *clocks; | 104 | struct clk_bulk_data *clocks; |
| 104 | int num_clocks; | 105 | int num_clocks; |
| 105 | bool reset_disabled; | 106 | bool reset_disabled; |
| @@ -1136,7 +1137,7 @@ static int rk_iommu_probe(struct platform_device *pdev) · 1030 unmodified lines | |||
| 1136 | struct rk_iommu *iommu; | 1137 | struct rk_iommu *iommu; |
| 1137 | struct resource *res; | 1138 | struct resource *res; |
| 1138 | int num_res = pdev->num_resources; | 1139 | int num_res = pdev->num_resources; |
| 1139 | int err, i, irq; | 1140 | int err, i; |
| 1140 | 1141 | ||
| 1141 | iommu = devm_kzalloc(dev, sizeof(*iommu), GFP_KERNEL); | 1142 | iommu = devm_kzalloc(dev, sizeof(*iommu), GFP_KERNEL); |
| 1142 | if (!iommu) | 1143 | if (!iommu) |
| @@ -1163,6 +1164,10 @@ static int rk_iommu_probe(struct platform_device *pdev) · 20 unmodified lines | |||
| 1163 | if (iommu->num_mmu == 0) | 1164 | if (iommu->num_mmu == 0) |
| 1164 | return PTR_ERR(iommu->bases[0]); | 1165 | return PTR_ERR(iommu->bases[0]); |
| 1165 | 1166 | ||
| 1167 | iommu->num_irq = platform_irq_count(pdev); | ||
| 1168 | if (iommu->num_irq < 0) | ||
| 1169 | return iommu->num_irq; | ||
| 1170 | |||
| 1166 | iommu->reset_disabled = device_property_read_bool(dev, | 1171 | iommu->reset_disabled = device_property_read_bool(dev, |
| 1167 | "rockchip,disable-mmu-reset"); | 1172 | "rockchip,disable-mmu-reset"); |
| 1168 | 1173 | ||
| @@ -1219,8 +1224,9 @@ static int rk_iommu_probe(struct platform_device *pdev) · 50 unmodified lines | |||
| 1219 | 1224 | ||
| 1220 | pm_runtime_enable(dev); | 1225 | pm_runtime_enable(dev); |
| 1221 | 1226 | ||
| 1222 | i = 0; | 1227 | for (i = 0; i < iommu->num_irq; i++) { |
| 1223 | while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) { | 1228 | int irq = platform_get_irq(pdev, i); |
| 1229 | |||
| 1224 | if (irq < 0) | 1230 | if (irq < 0) |
| 1225 | return irq; | 1231 | return irq; |
| 1226 | 1232 | ||
| @@ -1245,10 +1251,13 @@ err_unprepare_clocks: · 18 unmodified lines | |||
| 1245 | static void rk_iommu_shutdown(struct platform_device *pdev) | 1251 | static void rk_iommu_shutdown(struct platform_device *pdev) |
| 1246 | { | 1252 | { |
| 1247 | struct rk_iommu *iommu = platform_get_drvdata(pdev); | 1253 | struct rk_iommu *iommu = platform_get_drvdata(pdev); |
| 1248 | int i = 0, irq; | 1254 | int i; |
| 1255 | |||
| 1256 | for (i = 0; i < iommu->num_irq; i++) { | ||
| 1257 | int irq = platform_get_irq(pdev, i); | ||
| 1249 | 1258 | ||
| 1250 | while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) | ||
| 1251 | devm_free_irq(iommu->dev, irq, iommu); | 1259 | devm_free_irq(iommu->dev, irq, iommu); |
| 1260 | } | ||
| 1252 | 1261 | ||
| 1253 | pm_runtime_force_suspend(&pdev->dev); | 1262 | pm_runtime_force_suspend(&pdev->dev); |
| 1254 | } | 1263 | } |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | /* FIC Registers */ | 16 | /* FIC Registers */ |
| 17 | #define AL_FIC_CAUSE 0x00 | 17 | #define AL_FIC_CAUSE 0x00 |
| 18 | #define AL_FIC_SET_CAUSE 0x08 | ||
| 18 | #define AL_FIC_MASK 0x10 | 19 | #define AL_FIC_MASK 0x10 |
| 19 | #define AL_FIC_CONTROL 0x28 | 20 | #define AL_FIC_CONTROL 0x28 |
| 20 | 21 | ||
| @@ -126,6 +127,16 @@ static void al_fic_irq_handler(struct irq_desc *desc) · 105 unmodified lines | |||
| 126 | chained_irq_exit(irqchip, desc); | 127 | chained_irq_exit(irqchip, desc); |
| 127 | } | 128 | } |
| 128 | 129 | ||
| 130 | static int al_fic_irq_retrigger(struct irq_data *data) | ||
| 131 | { | ||
| 132 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); | ||
| 133 | struct al_fic *fic = gc->private; | ||
| 134 | |||
| 135 | writel_relaxed(BIT(data->hwirq), fic->base + AL_FIC_SET_CAUSE); | ||
| 136 | |||
| 137 | return 1; | ||
| 138 | } | ||
| 139 | |||
| 129 | static int al_fic_register(struct device_node *node, | 140 | static int al_fic_register(struct device_node *node, |
| 130 | struct al_fic *fic) | 141 | struct al_fic *fic) |
| 131 | { | 142 | { |
| @@ -159,6 +170,7 @@ static int al_fic_register(struct device_node *node, · 27 unmodified lines | |||
| 159 | gc->chip_types->chip.irq_unmask = irq_gc_mask_clr_bit; | 170 | gc->chip_types->chip.irq_unmask = irq_gc_mask_clr_bit; |
| 160 | gc->chip_types->chip.irq_ack = irq_gc_ack_clr_bit; | 171 | gc->chip_types->chip.irq_ack = irq_gc_ack_clr_bit; |
| 161 | gc->chip_types->chip.irq_set_type = al_fic_irq_set_type; | 172 | gc->chip_types->chip.irq_set_type = al_fic_irq_set_type; |
| 173 | gc->chip_types->chip.irq_retrigger = al_fic_irq_retrigger; | ||
| 162 | gc->chip_types->chip.flags = IRQCHIP_SKIP_SET_WAKE; | 174 | gc->chip_types->chip.flags = IRQCHIP_SKIP_SET_WAKE; |
| 163 | gc->private = fic; | 175 | gc->private = fic; |
| 164 | 176 | ||
| @@ -313,6 +313,7 @@ static void __init sama5d3_aic_irq_fixup(void) · 312 unmodified lines | |||
| 313 | static const struct of_device_id aic5_irq_fixups[] __initconst = { | 313 | static const struct of_device_id aic5_irq_fixups[] __initconst = { |
| 314 | { .compatible = "atmel,sama5d3", .data = sama5d3_aic_irq_fixup }, | 314 | { .compatible = "atmel,sama5d3", .data = sama5d3_aic_irq_fixup }, |
| 315 | { .compatible = "atmel,sama5d4", .data = sama5d3_aic_irq_fixup }, | 315 | { .compatible = "atmel,sama5d4", .data = sama5d3_aic_irq_fixup }, |
| 316 | { .compatible = "microchip,sam9x60", .data = sama5d3_aic_irq_fixup }, | ||
| 316 | { /* sentinel */ }, | 317 | { /* sentinel */ }, |
| 317 | }; | 318 | }; |
| 318 | 319 | ||
| @@ -390,3 +391,12 @@ static int __init sama5d4_aic5_of_init(struct device_node *node, · 71 unmodified lines | |||
| 390 | return aic5_of_init(node, parent, NR_SAMA5D4_IRQS); | 391 | return aic5_of_init(node, parent, NR_SAMA5D4_IRQS); |
| 391 | } | 392 | } |
| 392 | IRQCHIP_DECLARE(sama5d4_aic5, "atmel,sama5d4-aic", sama5d4_aic5_of_init); | 393 | IRQCHIP_DECLARE(sama5d4_aic5, "atmel,sama5d4-aic", sama5d4_aic5_of_init); |
| 394 | |||
| 395 | #define NR_SAM9X60_IRQS 50 | ||
| 396 | |||
| 397 | static int __init sam9x60_aic5_of_init(struct device_node *node, | ||
| 398 | struct device_node *parent) | ||
| 399 | { | ||
| 400 | return aic5_of_init(node, parent, NR_SAM9X60_IRQS); | ||
| 401 | } | ||
| 402 | IRQCHIP_DECLARE(sam9x60_aic5, "microchip,sam9x60-aic", sam9x60_aic5_of_init); | ||
| @@ -175,6 +175,22 @@ static DEFINE_IDA(its_vpeid_ida); · 174 unmodified lines | |||
| 175 | #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base) | 175 | #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base) |
| 176 | #define gic_data_rdist_vlpi_base() (gic_data_rdist_rd_base() + SZ_128K) | 176 | #define gic_data_rdist_vlpi_base() (gic_data_rdist_rd_base() + SZ_128K) |
| 177 | 177 | ||
| 178 | static u16 get_its_list(struct its_vm *vm) | ||
| 179 | { | ||
| 180 | struct its_node *its; | ||
| 181 | unsigned long its_list = 0; | ||
| 182 | |||
| 183 | list_for_each_entry(its, &its_nodes, entry) { | ||
| 184 | if (!its->is_v4) | ||
| 185 | continue; | ||
| 186 | |||
| 187 | if (vm->vlpi_count[its->list_nr]) | ||
| 188 | __set_bit(its->list_nr, &its_list); | ||
| 189 | } | ||
| 190 | |||
| 191 | return (u16)its_list; | ||
| 192 | } | ||
| 193 | |||
| 178 | static struct its_collection *dev_event_to_col(struct its_device *its_dev, | 194 | static struct its_collection *dev_event_to_col(struct its_device *its_dev, |
| 179 | u32 event) | 195 | u32 event) |
| 180 | { | 196 | { |
| @@ -976,17 +992,15 @@ static void its_send_vmapp(struct its_node *its, · 795 unmodified lines | |||
| 976 | 992 | ||
| 977 | static void its_send_vmovp(struct its_vpe *vpe) | 993 | static void its_send_vmovp(struct its_vpe *vpe) |
| 978 | { | 994 | { |
| 979 | struct its_cmd_desc desc; | 995 | struct its_cmd_desc desc = {}; |
| 980 | struct its_node *its; | 996 | struct its_node *its; |
| 981 | unsigned long flags; | 997 | unsigned long flags; |
| 982 | int col_id = vpe->col_idx; | 998 | int col_id = vpe->col_idx; |
| 983 | 999 | ||
| 984 | desc.its_vmovp_cmd.vpe = vpe; | 1000 | desc.its_vmovp_cmd.vpe = vpe; |
| 985 | desc.its_vmovp_cmd.its_list = (u16)its_list_map; | ||
| 986 | 1001 | ||
| 987 | if (!its_list_map) { | 1002 | if (!its_list_map) { |
| 988 | its = list_first_entry(&its_nodes, struct its_node, entry); | 1003 | its = list_first_entry(&its_nodes, struct its_node, entry); |
| 989 | desc.its_vmovp_cmd.seq_num = 0; | ||
| 990 | desc.its_vmovp_cmd.col = &its->collections[col_id]; | 1004 | desc.its_vmovp_cmd.col = &its->collections[col_id]; |
| 991 | its_send_single_vcommand(its, its_build_vmovp_cmd, &desc); | 1005 | its_send_single_vcommand(its, its_build_vmovp_cmd, &desc); |
| 992 | return; | 1006 | return; |
| @@ -1003,6 +1017,7 @@ static void its_send_vmovp(struct its_vpe *vpe) · 10 unmodified lines | |||
| 1003 | raw_spin_lock_irqsave(&vmovp_lock, flags); | 1017 | raw_spin_lock_irqsave(&vmovp_lock, flags); |
| 1004 | 1018 | ||
| 1005 | desc.its_vmovp_cmd.seq_num = vmovp_seq_num++; | 1019 | desc.its_vmovp_cmd.seq_num = vmovp_seq_num++; |
| 1020 | desc.its_vmovp_cmd.its_list = get_its_list(vpe->its_vm); | ||
| 1006 | 1021 | ||
| 1007 | /* Emit VMOVPs */ | 1022 | /* Emit VMOVPs */ |
| 1008 | list_for_each_entry(its, &its_nodes, entry) { | 1023 | list_for_each_entry(its, &its_nodes, entry) { |
| @@ -59,7 +59,7 @@ static struct gic_chip_data gic_data __read_mostly; · 58 unmodified lines | |||
| 59 | static DEFINE_STATIC_KEY_TRUE(supports_deactivate_key); | 59 | static DEFINE_STATIC_KEY_TRUE(supports_deactivate_key); |
| 60 | 60 | ||
| 61 | #define GIC_ID_NR (1U << GICD_TYPER_ID_BITS(gic_data.rdists.gicd_typer)) | 61 | #define GIC_ID_NR (1U << GICD_TYPER_ID_BITS(gic_data.rdists.gicd_typer)) |
| 62 | #define GIC_LINE_NR max(GICD_TYPER_SPIS(gic_data.rdists.gicd_typer), 1020U) | 62 | #define GIC_LINE_NR min(GICD_TYPER_SPIS(gic_data.rdists.gicd_typer), 1020U) |
| 63 | #define GIC_ESPI_NR GICD_TYPER_ESPIS(gic_data.rdists.gicd_typer) | 63 | #define GIC_ESPI_NR GICD_TYPER_ESPIS(gic_data.rdists.gicd_typer) |
| 64 | 64 | ||
| 65 | /* | 65 | /* |
| @@ -97,7 +97,7 @@ static inline void plic_irq_toggle(const struct cpumask *mask, · 96 unmodified lines | |||
| 97 | } | 97 | } |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | static void plic_irq_enable(struct irq_data *d) | 100 | static void plic_irq_unmask(struct irq_data *d) |
| 101 | { | 101 | { |
| 102 | unsigned int cpu = cpumask_any_and(irq_data_get_affinity_mask(d), | 102 | unsigned int cpu = cpumask_any_and(irq_data_get_affinity_mask(d), |
| 103 | cpu_online_mask); | 103 | cpu_online_mask); |
| @@ -106,7 +106,7 @@ static void plic_irq_enable(struct irq_data *d) · 2 unmodified lines | |||
| 106 | plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1); | 106 | plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | static void plic_irq_disable(struct irq_data *d) | 109 | static void plic_irq_mask(struct irq_data *d) |
| 110 | { | 110 | { |
| 111 | plic_irq_toggle(cpu_possible_mask, d->hwirq, 0); | 111 | plic_irq_toggle(cpu_possible_mask, d->hwirq, 0); |
| 112 | } | 112 | } |
| @@ -125,10 +125,8 @@ static int plic_set_affinity(struct irq_data *d, · 12 unmodified lines | |||
| 125 | if (cpu >= nr_cpu_ids) | 125 | if (cpu >= nr_cpu_ids) |
| 126 | return -EINVAL; | 126 | return -EINVAL; |
| 127 | 127 | ||
| 128 | if (!irqd_irq_disabled(d)) { | 128 | plic_irq_toggle(cpu_possible_mask, d->hwirq, 0); |
| 129 | plic_irq_toggle(cpu_possible_mask, d->hwirq, 0); | 129 | plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1); |
| 130 | plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1); | ||
| 131 | } | ||
| 132 | 130 | ||
| 133 | irq_data_update_effective_affinity(d, cpumask_of(cpu)); | 131 | irq_data_update_effective_affinity(d, cpumask_of(cpu)); |
| 134 | 132 | ||
| @@ -136,14 +134,18 @@ static int plic_set_affinity(struct irq_data *d, · 1 unmodified line | |||
| 136 | } | 134 | } |
| 137 | #endif | 135 | #endif |
| 138 | 136 | ||
| 137 | static void plic_irq_eoi(struct irq_data *d) | ||
| 138 | { | ||
| 139 | struct plic_handler *handler = this_cpu_ptr(&plic_handlers); | ||
| 140 | |||
| 141 | writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM); | ||
| 142 | } | ||
| 143 | |||
| 139 | static struct irq_chip plic_chip = { | 144 | static struct irq_chip plic_chip = { |
| 140 | .name = "SiFive PLIC", | 145 | .name = "SiFive PLIC", |
| 141 | /* | 146 | .irq_mask = plic_irq_mask, |
| 142 | * There is no need to mask/unmask PLIC interrupts. They are "masked" | 147 | .irq_unmask = plic_irq_unmask, |
| 143 | * by reading claim and "unmasked" when writing it back. | 148 | .irq_eoi = plic_irq_eoi, |
| 144 | */ | ||
| 145 | .irq_enable = plic_irq_enable, | ||
| 146 | .irq_disable = plic_irq_disable, | ||
| 147 | #ifdef CONFIG_SMP | 149 | #ifdef CONFIG_SMP |
| 148 | .irq_set_affinity = plic_set_affinity, | 150 | .irq_set_affinity = plic_set_affinity, |
| 149 | #endif | 151 | #endif |
| @@ -152,7 +154,7 @@ static struct irq_chip plic_chip = { · 2 unmodified lines | |||
| 152 | static int plic_irqdomain_map(struct irq_domain *d, unsigned int irq, | 154 | static int plic_irqdomain_map(struct irq_domain *d, unsigned int irq, |
| 153 | irq_hw_number_t hwirq) | 155 | irq_hw_number_t hwirq) |
| 154 | { | 156 | { |
| 155 | irq_set_chip_and_handler(irq, &plic_chip, handle_simple_irq); | 157 | irq_set_chip_and_handler(irq, &plic_chip, handle_fasteoi_irq); |
| 156 | irq_set_chip_data(irq, NULL); | 158 | irq_set_chip_data(irq, NULL); |
| 157 | irq_set_noprobe(irq); | 159 | irq_set_noprobe(irq); |
| 158 | return 0; | 160 | return 0; |
| @@ -188,7 +190,6 @@ static void plic_handle_irq(struct pt_regs *regs) · 29 unmodified lines | |||
| 188 | hwirq); | 190 | hwirq); |
| 189 | else | 191 | else |
| 190 | generic_handle_irq(irq); | 192 | generic_handle_irq(irq); |
| 191 | writel(hwirq, claim); | ||
| 192 | } | 193 | } |
| 193 | csr_set(sie, SIE_SEIE); | 194 | csr_set(sie, SIE_SEIE); |
| 194 | } | 195 | } |
| @@ -251,8 +252,8 @@ static int __init plic_init(struct device_node *node, · 56 unmodified lines | |||
| 251 | continue; | 252 | continue; |
| 252 | } | 253 | } |
| 253 | 254 | ||
| 254 | /* skip context holes */ | 255 | /* skip contexts other than supervisor external interrupt */ |
| 255 | if (parent.args[0] == -1) | 256 | if (parent.args[0] != IRQ_S_EXT) |
| 256 | continue; | 257 | continue; |
| 257 | 258 | ||
| 258 | hartid = plic_find_hart_id(parent.np); | 259 | hartid = plic_find_hart_id(parent.np); |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | static int clamped; | 19 | static int clamped; |
| 20 | static struct wf_control *clamp_control; | 20 | static struct wf_control *clamp_control; |
| 21 | static struct dev_pm_qos_request qos_req; | 21 | static struct freq_qos_request qos_req; |
| 22 | static unsigned int min_freq, max_freq; | 22 | static unsigned int min_freq, max_freq; |
| 23 | 23 | ||
| 24 | static int clamp_set(struct wf_control *ct, s32 value) | 24 | static int clamp_set(struct wf_control *ct, s32 value) |
| @@ -35,7 +35,7 @@ static int clamp_set(struct wf_control *ct, s32 value) · 10 unmodified lines | |||
| 35 | } | 35 | } |
| 36 | clamped = value; | 36 | clamped = value; |
| 37 | 37 | ||
| 38 | return dev_pm_qos_update_request(&qos_req, freq); | 38 | return freq_qos_update_request(&qos_req, freq); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | static int clamp_get(struct wf_control *ct, s32 *value) | 41 | static int clamp_get(struct wf_control *ct, s32 *value) |
| @@ -77,38 +77,44 @@ static int __init wf_cpufreq_clamp_init(void) · 35 unmodified lines | |||
| 77 | 77 | ||
| 78 | min_freq = policy->cpuinfo.min_freq; | 78 | min_freq = policy->cpuinfo.min_freq; |
| 79 | max_freq = policy->cpuinfo.max_freq; | 79 | max_freq = policy->cpuinfo.max_freq; |
| 80 | |||
| 81 | ret = freq_qos_add_request(&policy->constraints, &qos_req, FREQ_QOS_MAX, | ||
| 82 | max_freq); | ||
| 83 | |||
| 80 | cpufreq_cpu_put(policy); | 84 | cpufreq_cpu_put(policy); |
| 81 | 85 | ||
| 86 | if (ret < 0) { | ||
| 87 | pr_err("%s: Failed to add freq constraint (%d)\n", __func__, | ||
| 88 | ret); | ||
| 89 | return ret; | ||
| 90 | } | ||
| 91 | |||
| 82 | dev = get_cpu_device(0); | 92 | dev = get_cpu_device(0); |
| 83 | if (unlikely(!dev)) { | 93 | if (unlikely(!dev)) { |
| 84 | pr_warn("%s: No cpu device for cpu0\n", __func__); | 94 | pr_warn("%s: No cpu device for cpu0\n", __func__); |
| 85 | return -ENODEV; | 95 | ret = -ENODEV; |
| 96 | goto fail; | ||
| 86 | } | 97 | } |
| 87 | 98 | ||
| 88 | clamp = kmalloc(sizeof(struct wf_control), GFP_KERNEL); | 99 | clamp = kmalloc(sizeof(struct wf_control), GFP_KERNEL); |
| 89 | if (clamp == NULL) | 100 | if (clamp == NULL) { |
| 90 | return -ENOMEM; | 101 | ret = -ENOMEM; |
| 91 | 102 | goto fail; | |
| 92 | ret = dev_pm_qos_add_request(dev, &qos_req, DEV_PM_QOS_MAX_FREQUENCY, | ||
| 93 | max_freq); | ||
| 94 | if (ret < 0) { | ||
| 95 | pr_err("%s: Failed to add freq constraint (%d)\n", __func__, | ||
| 96 | ret); | ||
| 97 | goto free; | ||
| 98 | } | 103 | } |
| 99 | 104 | ||
| 100 | clamp->ops = &clamp_ops; | 105 | clamp->ops = &clamp_ops; |
| 101 | clamp->name = "cpufreq-clamp"; | 106 | clamp->name = "cpufreq-clamp"; |
| 102 | ret = wf_register_control(clamp); | 107 | ret = wf_register_control(clamp); |
| 103 | if (ret) | 108 | if (ret) |
| 104 | goto fail; | 109 | goto free; |
| 110 | |||
| 105 | clamp_control = clamp; | 111 | clamp_control = clamp; |
| 106 | return 0; | 112 | return 0; |
| 107 | fail: | ||
| 108 | dev_pm_qos_remove_request(&qos_req); | ||
| 109 | 113 | ||
| 110 | free: | 114 | free: |
| 111 | kfree(clamp); | 115 | kfree(clamp); |
| 116 | fail: | ||
| 117 | freq_qos_remove_request(&qos_req); | ||
| 112 | return ret; | 118 | return ret; |
| 113 | } | 119 | } |
| 114 | 120 | ||
| @@ -116,7 +122,7 @@ static void __exit wf_cpufreq_clamp_exit(void) · 1 unmodified line | |||
| 116 | { | 122 | { |
| 117 | if (clamp_control) { | 123 | if (clamp_control) { |
| 118 | wf_unregister_control(clamp_control); | 124 | wf_unregister_control(clamp_control); |
| 119 | dev_pm_qos_remove_request(&qos_req); | 125 | freq_qos_remove_request(&qos_req); |
| 120 | } | 126 | } |
| 121 | } | 127 | } |
| 122 | 128 | ||
| @@ -542,7 +542,7 @@ static void wake_migration_worker(struct cache *cache) · 541 unmodified lines | |||
| 542 | 542 | ||
| 543 | static struct dm_bio_prison_cell_v2 *alloc_prison_cell(struct cache *cache) | 543 | static struct dm_bio_prison_cell_v2 *alloc_prison_cell(struct cache *cache) |
| 544 | { | 544 | { |
| 545 | return dm_bio_prison_alloc_cell_v2(cache->prison, GFP_NOWAIT); | 545 | return dm_bio_prison_alloc_cell_v2(cache->prison, GFP_NOIO); |
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | static void free_prison_cell(struct cache *cache, struct dm_bio_prison_cell_v2 *cell) | 548 | static void free_prison_cell(struct cache *cache, struct dm_bio_prison_cell_v2 *cell) |
| @@ -554,9 +554,7 @@ static struct dm_cache_migration *alloc_migration(struct cache *cache) · 5 unmodified lines | |||
| 554 | { | 554 | { |
| 555 | struct dm_cache_migration *mg; | 555 | struct dm_cache_migration *mg; |
| 556 | 556 | ||
| 557 | mg = mempool_alloc(&cache->migration_pool, GFP_NOWAIT); | 557 | mg = mempool_alloc(&cache->migration_pool, GFP_NOIO); |
| 558 | if (!mg) | ||
| 559 | return NULL; | ||
| 560 | 558 | ||
| 561 | memset(mg, 0, sizeof(*mg)); | 559 | memset(mg, 0, sizeof(*mg)); |
| 562 | 560 | ||
| @@ -664,10 +662,6 @@ static bool bio_detain_shared(struct cache *cache, dm_oblock_t oblock, struct bi · 101 unmodified lines | |||
| 664 | struct dm_bio_prison_cell_v2 *cell_prealloc, *cell; | 662 | struct dm_bio_prison_cell_v2 *cell_prealloc, *cell; |
| 665 | 663 | ||
| 666 | cell_prealloc = alloc_prison_cell(cache); /* FIXME: allow wait if calling from worker */ | 664 | cell_prealloc = alloc_prison_cell(cache); /* FIXME: allow wait if calling from worker */ |
| 667 | if (!cell_prealloc) { | ||
| 668 | defer_bio(cache, bio); | ||
| 669 | return false; | ||
| 670 | } | ||
| 671 | 665 | ||
| 672 | build_key(oblock, end, &key); | 666 | build_key(oblock, end, &key); |
| 673 | r = dm_cell_get_v2(cache->prison, &key, lock_level(bio), bio, cell_prealloc, &cell); | 667 | r = dm_cell_get_v2(cache->prison, &key, lock_level(bio), bio, cell_prealloc, &cell); |
| @@ -1493,11 +1487,6 @@ static int mg_lock_writes(struct dm_cache_migration *mg) · 819 unmodified lines | |||
| 1493 | struct dm_bio_prison_cell_v2 *prealloc; | 1487 | struct dm_bio_prison_cell_v2 *prealloc; |
| 1494 | 1488 | ||
| 1495 | prealloc = alloc_prison_cell(cache); | 1489 | prealloc = alloc_prison_cell(cache); |
| 1496 | if (!prealloc) { | ||
| 1497 | DMERR_LIMIT("%s: alloc_prison_cell failed", cache_device_name(cache)); | ||
| 1498 | mg_complete(mg, false); | ||
| 1499 | return -ENOMEM; | ||
| 1500 | } | ||
| 1501 | 1490 | ||
| 1502 | /* | 1491 | /* |
| 1503 | * Prevent writes to the block, but allow reads to continue. | 1492 | * Prevent writes to the block, but allow reads to continue. |
| @@ -1535,11 +1524,6 @@ static int mg_start(struct cache *cache, struct policy_work *op, struct bio *bio · 31 unmodified lines | |||
| 1535 | } | 1524 | } |
| 1536 | 1525 | ||
| 1537 | mg = alloc_migration(cache); | 1526 | mg = alloc_migration(cache); |
| 1538 | if (!mg) { | ||
| 1539 | policy_complete_background_work(cache->policy, op, false); | ||
| 1540 | background_work_end(cache); | ||
| 1541 | return -ENOMEM; | ||
| 1542 | } | ||
| 1543 | 1527 | ||
| 1544 | mg->op = op; | 1528 | mg->op = op; |
| 1545 | mg->overwrite_bio = bio; | 1529 | mg->overwrite_bio = bio; |
| @@ -1628,10 +1612,6 @@ static int invalidate_lock(struct dm_cache_migration *mg) · 82 unmodified lines | |||
| 1628 | struct dm_bio_prison_cell_v2 *prealloc; | 1612 | struct dm_bio_prison_cell_v2 *prealloc; |
| 1629 | 1613 | ||
| 1630 | prealloc = alloc_prison_cell(cache); | 1614 | prealloc = alloc_prison_cell(cache); |
| 1631 | if (!prealloc) { | ||
| 1632 | invalidate_complete(mg, false); | ||
| 1633 | return -ENOMEM; | ||
| 1634 | } | ||
| 1635 | 1615 | ||
| 1636 | build_key(mg->invalidate_oblock, oblock_succ(mg->invalidate_oblock), &key); | 1616 | build_key(mg->invalidate_oblock, oblock_succ(mg->invalidate_oblock), &key); |
| 1637 | r = dm_cell_lock_v2(cache->prison, &key, | 1617 | r = dm_cell_lock_v2(cache->prison, &key, |
| @@ -1669,10 +1649,6 @@ static int invalidate_start(struct cache *cache, dm_cblock_t cblock, · 31 unmodified lines | |||
| 1669 | return -EPERM; | 1649 | return -EPERM; |
| 1670 | 1650 | ||
| 1671 | mg = alloc_migration(cache); | 1651 | mg = alloc_migration(cache); |
| 1672 | if (!mg) { | ||
| 1673 | background_work_end(cache); | ||
| 1674 | return -ENOMEM; | ||
| 1675 | } | ||
| 1676 | 1652 | ||
| 1677 | mg->overwrite_bio = bio; | 1653 | mg->overwrite_bio = bio; |
| 1678 | mg->invalidate_cblock = cblock; | 1654 | mg->invalidate_cblock = cblock; |
| @@ -591,8 +591,8 @@ static struct hash_table_bucket *get_hash_table_bucket(struct clone *clone, · 590 unmodified lines | |||
| 591 | * | 591 | * |
| 592 | * NOTE: Must be called with the bucket lock held | 592 | * NOTE: Must be called with the bucket lock held |
| 593 | */ | 593 | */ |
| 594 | struct dm_clone_region_hydration *__hash_find(struct hash_table_bucket *bucket, | 594 | static struct dm_clone_region_hydration *__hash_find(struct hash_table_bucket *bucket, |
| 595 | unsigned long region_nr) | 595 | unsigned long region_nr) |
| 596 | { | 596 | { |
| 597 | struct dm_clone_region_hydration *hd; | 597 | struct dm_clone_region_hydration *hd; |
| 598 | 598 | ||
| @@ -18,7 +18,6 @@ · 17 unmodified lines | |||
| 18 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
| 19 | #include <linux/log2.h> | 19 | #include <linux/log2.h> |
| 20 | #include <linux/dm-kcopyd.h> | 20 | #include <linux/dm-kcopyd.h> |
| 21 | #include <linux/semaphore.h> | ||
| 22 | 21 | ||
| 23 | #include "dm.h" | 22 | #include "dm.h" |
| 24 | 23 | ||
| @@ -107,8 +106,8 @@ struct dm_snapshot { · 82 unmodified lines | |||
| 107 | /* The on disk metadata handler */ | 106 | /* The on disk metadata handler */ |
| 108 | struct dm_exception_store *store; | 107 | struct dm_exception_store *store; |
| 109 | 108 | ||
| 110 | /* Maximum number of in-flight COW jobs. */ | 109 | unsigned in_progress; |
| 111 | struct semaphore cow_count; | 110 | struct wait_queue_head in_progress_wait; |
| 112 | 111 | ||
| 113 | struct dm_kcopyd_client *kcopyd_client; | 112 | struct dm_kcopyd_client *kcopyd_client; |
| 114 | 113 | ||
| @@ -162,8 +161,8 @@ struct dm_snapshot { · 47 unmodified lines | |||
| 162 | */ | 161 | */ |
| 163 | #define DEFAULT_COW_THRESHOLD 2048 | 162 | #define DEFAULT_COW_THRESHOLD 2048 |
| 164 | 163 | ||
| 165 | static int cow_threshold = DEFAULT_COW_THRESHOLD; | 164 | static unsigned cow_threshold = DEFAULT_COW_THRESHOLD; |
| 166 | module_param_named(snapshot_cow_threshold, cow_threshold, int, 0644); | 165 | module_param_named(snapshot_cow_threshold, cow_threshold, uint, 0644); |
| 167 | MODULE_PARM_DESC(snapshot_cow_threshold, "Maximum number of chunks being copied on write"); | 166 | MODULE_PARM_DESC(snapshot_cow_threshold, "Maximum number of chunks being copied on write"); |
| 168 | 167 | ||
| 169 | DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle, | 168 | DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle, |
| @@ -1327,7 +1326,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 1157 unmodified lines | |||
| 1327 | goto bad_hash_tables; | 1326 | goto bad_hash_tables; |
| 1328 | } | 1327 | } |
| 1329 | 1328 | ||
| 1330 | sema_init(&s->cow_count, (cow_threshold > 0) ? cow_threshold : INT_MAX); | 1329 | init_waitqueue_head(&s->in_progress_wait); |
| 1331 | 1330 | ||
| 1332 | s->kcopyd_client = dm_kcopyd_client_create(&dm_kcopyd_throttle); | 1331 | s->kcopyd_client = dm_kcopyd_client_create(&dm_kcopyd_throttle); |
| 1333 | if (IS_ERR(s->kcopyd_client)) { | 1332 | if (IS_ERR(s->kcopyd_client)) { |
| @@ -1509,9 +1508,56 @@ static void snapshot_dtr(struct dm_target *ti) · 175 unmodified lines | |||
| 1509 | 1508 | ||
| 1510 | dm_put_device(ti, s->origin); | 1509 | dm_put_device(ti, s->origin); |
| 1511 | 1510 | ||
| 1511 | WARN_ON(s->in_progress); | ||
| 1512 | |||
| 1512 | kfree(s); | 1513 | kfree(s); |
| 1513 | } | 1514 | } |
| 1514 | 1515 | ||
| 1516 | static void account_start_copy(struct dm_snapshot *s) | ||
| 1517 | { | ||
| 1518 | spin_lock(&s->in_progress_wait.lock); | ||
| 1519 | s->in_progress++; | ||
| 1520 | spin_unlock(&s->in_progress_wait.lock); | ||
| 1521 | } | ||
| 1522 | |||
| 1523 | static void account_end_copy(struct dm_snapshot *s) | ||
| 1524 | { | ||
| 1525 | spin_lock(&s->in_progress_wait.lock); | ||
| 1526 | BUG_ON(!s->in_progress); | ||
| 1527 | s->in_progress--; | ||
| 1528 | if (likely(s->in_progress <= cow_threshold) && | ||
| 1529 | unlikely(waitqueue_active(&s->in_progress_wait))) | ||
| 1530 | wake_up_locked(&s->in_progress_wait); | ||
| 1531 | spin_unlock(&s->in_progress_wait.lock); | ||
| 1532 | } | ||
| 1533 | |||
| 1534 | static bool wait_for_in_progress(struct dm_snapshot *s, bool unlock_origins) | ||
| 1535 | { | ||
| 1536 | if (unlikely(s->in_progress > cow_threshold)) { | ||
| 1537 | spin_lock(&s->in_progress_wait.lock); | ||
| 1538 | if (likely(s->in_progress > cow_threshold)) { | ||
| 1539 | /* | ||
| 1540 | * NOTE: this throttle doesn't account for whether | ||
| 1541 | * the caller is servicing an IO that will trigger a COW | ||
| 1542 | * so excess throttling may result for chunks not required | ||
| 1543 | * to be COW'd. But if cow_threshold was reached, extra | ||
| 1544 | * throttling is unlikely to negatively impact performance. | ||
| 1545 | */ | ||
| 1546 | DECLARE_WAITQUEUE(wait, current); | ||
| 1547 | __add_wait_queue(&s->in_progress_wait, &wait); | ||
| 1548 | __set_current_state(TASK_UNINTERRUPTIBLE); | ||
| 1549 | spin_unlock(&s->in_progress_wait.lock); | ||
| 1550 | if (unlock_origins) | ||
| 1551 | up_read(&_origins_lock); | ||
| 1552 | io_schedule(); | ||
| 1553 | remove_wait_queue(&s->in_progress_wait, &wait); | ||
| 1554 | return false; | ||
| 1555 | } | ||
| 1556 | spin_unlock(&s->in_progress_wait.lock); | ||
| 1557 | } | ||
| 1558 | return true; | ||
| 1559 | } | ||
| 1560 | |||
| 1515 | /* | 1561 | /* |
| 1516 | * Flush a list of buffers. | 1562 | * Flush a list of buffers. |
| 1517 | */ | 1563 | */ |
| @@ -1527,7 +1573,7 @@ static void flush_bios(struct bio *bio) · 9 unmodified lines | |||
| 1527 | } | 1573 | } |
| 1528 | } | 1574 | } |
| 1529 | 1575 | ||
| 1530 | static int do_origin(struct dm_dev *origin, struct bio *bio); | 1576 | static int do_origin(struct dm_dev *origin, struct bio *bio, bool limit); |
| 1531 | 1577 | ||
| 1532 | /* | 1578 | /* |
| 1533 | * Flush a list of buffers. | 1579 | * Flush a list of buffers. |
| @@ -1540,7 +1586,7 @@ static void retry_origin_bios(struct dm_snapshot *s, struct bio *bio) · 6 unmodified lines | |||
| 1540 | while (bio) { | 1586 | while (bio) { |
| 1541 | n = bio->bi_next; | 1587 | n = bio->bi_next; |
| 1542 | bio->bi_next = NULL; | 1588 | bio->bi_next = NULL; |
| 1543 | r = do_origin(s->origin, bio); | 1589 | r = do_origin(s->origin, bio, false); |
| 1544 | if (r == DM_MAPIO_REMAPPED) | 1590 | if (r == DM_MAPIO_REMAPPED) |
| 1545 | generic_make_request(bio); | 1591 | generic_make_request(bio); |
| 1546 | bio = n; | 1592 | bio = n; |
| @@ -1732,7 +1778,7 @@ static void copy_callback(int read_err, unsigned long write_err, void *context) · 185 unmodified lines | |||
| 1732 | rb_link_node(&pe->out_of_order_node, parent, p); | 1778 | rb_link_node(&pe->out_of_order_node, parent, p); |
| 1733 | rb_insert_color(&pe->out_of_order_node, &s->out_of_order_tree); | 1779 | rb_insert_color(&pe->out_of_order_node, &s->out_of_order_tree); |
| 1734 | } | 1780 | } |
| 1735 | up(&s->cow_count); | 1781 | account_end_copy(s); |
| 1736 | } | 1782 | } |
| 1737 | 1783 | ||
| 1738 | /* | 1784 | /* |
| @@ -1756,7 +1802,7 @@ static void start_copy(struct dm_snap_pending_exception *pe) · 17 unmodified lines | |||
| 1756 | dest.count = src.count; | 1802 | dest.count = src.count; |
| 1757 | 1803 | ||
| 1758 | /* Hand over to kcopyd */ | 1804 | /* Hand over to kcopyd */ |
| 1759 | down(&s->cow_count); | 1805 | account_start_copy(s); |
| 1760 | dm_kcopyd_copy(s->kcopyd_client, &src, 1, &dest, 0, copy_callback, pe); | 1806 | dm_kcopyd_copy(s->kcopyd_client, &src, 1, &dest, 0, copy_callback, pe); |
| 1761 | } | 1807 | } |
| 1762 | 1808 | ||
| @@ -1776,7 +1822,7 @@ static void start_full_bio(struct dm_snap_pending_exception *pe, · 13 unmodified lines | |||
| 1776 | pe->full_bio = bio; | 1822 | pe->full_bio = bio; |
| 1777 | pe->full_bio_end_io = bio->bi_end_io; | 1823 | pe->full_bio_end_io = bio->bi_end_io; |
| 1778 | 1824 | ||
| 1779 | down(&s->cow_count); | 1825 | account_start_copy(s); |
| 1780 | callback_data = dm_kcopyd_prepare_callback(s->kcopyd_client, | 1826 | callback_data = dm_kcopyd_prepare_callback(s->kcopyd_client, |
| 1781 | copy_callback, pe); | 1827 | copy_callback, pe); |
| 1782 | 1828 | ||
| @@ -1866,7 +1912,7 @@ static void zero_callback(int read_err, unsigned long write_err, void *context) · 83 unmodified lines | |||
| 1866 | struct bio *bio = context; | 1912 | struct bio *bio = context; |
| 1867 | struct dm_snapshot *s = bio->bi_private; | 1913 | struct dm_snapshot *s = bio->bi_private; |
| 1868 | 1914 | ||
| 1869 | up(&s->cow_count); | 1915 | account_end_copy(s); |
| 1870 | bio->bi_status = write_err ? BLK_STS_IOERR : 0; | 1916 | bio->bi_status = write_err ? BLK_STS_IOERR : 0; |
| 1871 | bio_endio(bio); | 1917 | bio_endio(bio); |
| 1872 | } | 1918 | } |
| @@ -1880,7 +1926,7 @@ static void zero_exception(struct dm_snapshot *s, struct dm_exception *e, · 7 unmodified lines | |||
| 1880 | dest.sector = bio->bi_iter.bi_sector; | 1926 | dest.sector = bio->bi_iter.bi_sector; |
| 1881 | dest.count = s->store->chunk_size; | 1927 | dest.count = s->store->chunk_size; |
| 1882 | 1928 | ||
| 1883 | down(&s->cow_count); | 1929 | account_start_copy(s); |
| 1884 | WARN_ON_ONCE(bio->bi_private); | 1930 | WARN_ON_ONCE(bio->bi_private); |
| 1885 | bio->bi_private = s; | 1931 | bio->bi_private = s; |
| 1886 | dm_kcopyd_zero(s->kcopyd_client, 1, &dest, 0, zero_callback, bio); | 1932 | dm_kcopyd_zero(s->kcopyd_client, 1, &dest, 0, zero_callback, bio); |
| @@ -1916,6 +1962,11 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio) · 29 unmodified lines | |||
| 1916 | if (!s->valid) | 1962 | if (!s->valid) |
| 1917 | return DM_MAPIO_KILL; | 1963 | return DM_MAPIO_KILL; |
| 1918 | 1964 | ||
| 1965 | if (bio_data_dir(bio) == WRITE) { | ||
| 1966 | while (unlikely(!wait_for_in_progress(s, false))) | ||
| 1967 | ; /* wait_for_in_progress() has slept */ | ||
| 1968 | } | ||
| 1969 | |||
| 1919 | down_read(&s->lock); | 1970 | down_read(&s->lock); |
| 1920 | dm_exception_table_lock(&lock); | 1971 | dm_exception_table_lock(&lock); |
| 1921 | 1972 | ||
| @@ -2112,7 +2163,7 @@ redirect_to_origin: · 190 unmodified lines | |||
| 2112 | 2163 | ||
| 2113 | if (bio_data_dir(bio) == WRITE) { | 2164 | if (bio_data_dir(bio) == WRITE) { |
| 2114 | up_write(&s->lock); | 2165 | up_write(&s->lock); |
| 2115 | return do_origin(s->origin, bio); | 2166 | return do_origin(s->origin, bio, false); |
| 2116 | } | 2167 | } |
| 2117 | 2168 | ||
| 2118 | out_unlock: | 2169 | out_unlock: |
| @@ -2487,15 +2538,24 @@ next_snapshot: · 368 unmodified lines | |||
| 2487 | /* | 2538 | /* |
| 2488 | * Called on a write from the origin driver. | 2539 | * Called on a write from the origin driver. |
| 2489 | */ | 2540 | */ |
| 2490 | static int do_origin(struct dm_dev *origin, struct bio *bio) | 2541 | static int do_origin(struct dm_dev *origin, struct bio *bio, bool limit) |
| 2491 | { | 2542 | { |
| 2492 | struct origin *o; | 2543 | struct origin *o; |
| 2493 | int r = DM_MAPIO_REMAPPED; | 2544 | int r = DM_MAPIO_REMAPPED; |
| 2494 | 2545 | ||
| 2546 | again: | ||
| 2495 | down_read(&_origins_lock); | 2547 | down_read(&_origins_lock); |
| 2496 | o = __lookup_origin(origin->bdev); | 2548 | o = __lookup_origin(origin->bdev); |
| 2497 | if (o) | 2549 | if (o) { |
| 2550 | if (limit) { | ||
| 2551 | struct dm_snapshot *s; | ||
| 2552 | list_for_each_entry(s, &o->snapshots, list) | ||
| 2553 | if (unlikely(!wait_for_in_progress(s, true))) | ||
| 2554 | goto again; | ||
| 2555 | } | ||
| 2556 | |||
| 2498 | r = __origin_write(&o->snapshots, bio->bi_iter.bi_sector, bio); | 2557 | r = __origin_write(&o->snapshots, bio->bi_iter.bi_sector, bio); |
| 2558 | } | ||
| 2499 | up_read(&_origins_lock); | 2559 | up_read(&_origins_lock); |
| 2500 | 2560 | ||
| 2501 | return r; | 2561 | return r; |
| @@ -2608,7 +2668,7 @@ static int origin_map(struct dm_target *ti, struct bio *bio) · 106 unmodified lines | |||
| 2608 | dm_accept_partial_bio(bio, available_sectors); | 2668 | dm_accept_partial_bio(bio, available_sectors); |
| 2609 | 2669 | ||
| 2610 | /* Only tell snapshots if this is a write */ | 2670 | /* Only tell snapshots if this is a write */ |
| 2611 | return do_origin(o->dev, bio); | 2671 | return do_origin(o->dev, bio, true); |
| 2612 | } | 2672 | } |
| 2613 | 2673 | ||
| 2614 | /* | 2674 | /* |
| @@ -154,7 +154,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) · 153 unmodified lines | |||
| 154 | } else { | 154 | } else { |
| 155 | pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n", | 155 | pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n", |
| 156 | mdname(mddev)); | 156 | mdname(mddev)); |
| 157 | pr_err("md/raid0: please set raid.default_layout to 1 or 2\n"); | 157 | pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n"); |
| 158 | err = -ENOTSUPP; | 158 | err = -ENOTSUPP; |
| 159 | goto abort; | 159 | goto abort; |
| 160 | } | 160 | } |
| @@ -941,7 +941,7 @@ static int jmb38x_ms_probe(struct pci_dev *pdev, · 940 unmodified lines | |||
| 941 | if (!cnt) { | 941 | if (!cnt) { |
| 942 | rc = -ENODEV; | 942 | rc = -ENODEV; |
| 943 | pci_dev_busy = 1; | 943 | pci_dev_busy = 1; |
| 944 | goto err_out; | 944 | goto err_out_int; |
| 945 | } | 945 | } |
| 946 | 946 | ||
| 947 | jm = kzalloc(sizeof(struct jmb38x_ms) | 947 | jm = kzalloc(sizeof(struct jmb38x_ms) |
| @@ -129,11 +129,27 @@ static int mt6397_irq_resume(struct device *dev) · 128 unmodified lines | |||
| 129 | static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_irq_suspend, | 129 | static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_irq_suspend, |
| 130 | mt6397_irq_resume); | 130 | mt6397_irq_resume); |
| 131 | 131 | ||
| 132 | struct chip_data { | ||
| 133 | u32 cid_addr; | ||
| 134 | u32 cid_shift; | ||
| 135 | }; | ||
| 136 | |||
| 137 | static const struct chip_data mt6323_core = { | ||
| 138 | .cid_addr = MT6323_CID, | ||
| 139 | .cid_shift = 0, | ||
| 140 | }; | ||
| 141 | |||
| 142 | static const struct chip_data mt6397_core = { | ||
| 143 | .cid_addr = MT6397_CID, | ||
| 144 | .cid_shift = 0, | ||
| 145 | }; | ||
| 146 | |||
| 132 | static int mt6397_probe(struct platform_device *pdev) | 147 | static int mt6397_probe(struct platform_device *pdev) |
| 133 | { | 148 | { |
| 134 | int ret; | 149 | int ret; |
| 135 | unsigned int id; | 150 | unsigned int id; |
| 136 | struct mt6397_chip *pmic; | 151 | struct mt6397_chip *pmic; |
| 152 | const struct chip_data *pmic_core; | ||
| 137 | 153 | ||
| 138 | pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); | 154 | pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); |
| 139 | if (!pmic) | 155 | if (!pmic) |
| @@ -149,28 +165,30 @@ static int mt6397_probe(struct platform_device *pdev) · 9 unmodified lines | |||
| 149 | if (!pmic->regmap) | 165 | if (!pmic->regmap) |
| 150 | return -ENODEV; | 166 | return -ENODEV; |
| 151 | 167 | ||
| 152 | platform_set_drvdata(pdev, pmic); | 168 | pmic_core = of_device_get_match_data(&pdev->dev); |
| 169 | if (!pmic_core) | ||
| 170 | return -ENODEV; | ||
| 153 | 171 | ||
| 154 | ret = regmap_read(pmic->regmap, MT6397_CID, &id); | 172 | ret = regmap_read(pmic->regmap, pmic_core->cid_addr, &id); |
| 155 | if (ret) { | 173 | if (ret) { |
| 156 | dev_err(pmic->dev, "Failed to read chip id: %d\n", ret); | 174 | dev_err(&pdev->dev, "Failed to read chip id: %d\n", ret); |
| 157 | return ret; | 175 | return ret; |
| 158 | } | 176 | } |
| 159 | 177 | ||
| 178 | pmic->chip_id = (id >> pmic_core->cid_shift) & 0xff; | ||
| 179 | |||
| 180 | platform_set_drvdata(pdev, pmic); | ||
| 181 | |||
| 160 | pmic->irq = platform_get_irq(pdev, 0); | 182 | pmic->irq = platform_get_irq(pdev, 0); |
| 161 | if (pmic->irq <= 0) | 183 | if (pmic->irq <= 0) |
| 162 | return pmic->irq; | 184 | return pmic->irq; |
| 163 | 185 | ||
| 164 | switch (id & 0xff) { | 186 | ret = mt6397_irq_init(pmic); |
| 165 | case MT6323_CHIP_ID: | 187 | if (ret) |
| 166 | pmic->int_con[0] = MT6323_INT_CON0; | 188 | return ret; |
| 167 | pmic->int_con[1] = MT6323_INT_CON1; | ||
| 168 | pmic->int_status[0] = MT6323_INT_STATUS0; | ||
| 169 | pmic->int_status[1] = MT6323_INT_STATUS1; | ||
| 170 | ret = mt6397_irq_init(pmic); | ||
| 171 | if (ret) | ||
| 172 | return ret; | ||
| 173 | 189 | ||
| 190 | switch (pmic->chip_id) { | ||
| 191 | case MT6323_CHIP_ID: | ||
| 174 | ret = devm_mfd_add_devices(&pdev->dev, -1, mt6323_devs, | 192 | ret = devm_mfd_add_devices(&pdev->dev, -1, mt6323_devs, |
| 175 | ARRAY_SIZE(mt6323_devs), NULL, | 193 | ARRAY_SIZE(mt6323_devs), NULL, |
| 176 | 0, pmic->irq_domain); | 194 | 0, pmic->irq_domain); |
| @@ -178,21 +196,13 @@ static int mt6397_probe(struct platform_device *pdev) · 1 unmodified line | |||
| 178 | 196 | ||
| 179 | case MT6391_CHIP_ID: | 197 | case MT6391_CHIP_ID: |
| 180 | case MT6397_CHIP_ID: | 198 | case MT6397_CHIP_ID: |
| 181 | pmic->int_con[0] = MT6397_INT_CON0; | ||
| 182 | pmic->int_con[1] = MT6397_INT_CON1; | ||
| 183 | pmic->int_status[0] = MT6397_INT_STATUS0; | ||
| 184 | pmic->int_status[1] = MT6397_INT_STATUS1; | ||
| 185 | ret = mt6397_irq_init(pmic); | ||
| 186 | if (ret) | ||
| 187 | return ret; | ||
| 188 | |||
| 189 | ret = devm_mfd_add_devices(&pdev->dev, -1, mt6397_devs, | 199 | ret = devm_mfd_add_devices(&pdev->dev, -1, mt6397_devs, |
| 190 | ARRAY_SIZE(mt6397_devs), NULL, | 200 | ARRAY_SIZE(mt6397_devs), NULL, |
| 191 | 0, pmic->irq_domain); | 201 | 0, pmic->irq_domain); |
| 192 | break; | 202 | break; |
| 193 | 203 | ||
| 194 | default: | 204 | default: |
| 195 | dev_err(&pdev->dev, "unsupported chip: %d\n", id); | 205 | dev_err(&pdev->dev, "unsupported chip: %d\n", pmic->chip_id); |
| 196 | return -ENODEV; | 206 | return -ENODEV; |
| 197 | } | 207 | } |
| 198 | 208 | ||
| @@ -205,9 +215,15 @@ static int mt6397_probe(struct platform_device *pdev) · 6 unmodified lines | |||
| 205 | } | 215 | } |
| 206 | 216 | ||
| 207 | static const struct of_device_id mt6397_of_match[] = { | 217 | static const struct of_device_id mt6397_of_match[] = { |
| 208 | { .compatible = "mediatek,mt6397" }, | 218 | { |
| 209 | { .compatible = "mediatek,mt6323" }, | 219 | .compatible = "mediatek,mt6323", |
| 210 | { } | 220 | .data = &mt6323_core, |
| 221 | }, { | ||
| 222 | .compatible = "mediatek,mt6397", | ||
| 223 | .data = &mt6397_core, | ||
| 224 | }, { | ||
| 225 | /* sentinel */ | ||
| 226 | } | ||
| 211 | }; | 227 | }; |
| 212 | MODULE_DEVICE_TABLE(of, mt6397_of_match); | 228 | MODULE_DEVICE_TABLE(of, mt6397_of_match); |
| 213 | 229 | ||
| @@ -611,7 +611,8 @@ static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq) · 610 unmodified lines | |||
| 611 | cq_host->slot[tag].flags = 0; | 611 | cq_host->slot[tag].flags = 0; |
| 612 | 612 | ||
| 613 | cq_host->qcnt += 1; | 613 | cq_host->qcnt += 1; |
| 614 | 614 | /* Make sure descriptors are ready before ringing the doorbell */ | |
| 615 | wmb(); | ||
| 615 | cqhci_writel(cq_host, 1 << tag, CQHCI_TDBR); | 616 | cqhci_writel(cq_host, 1 << tag, CQHCI_TDBR); |
| 616 | if (!(cqhci_readl(cq_host, CQHCI_TDBR) & (1 << tag))) | 617 | if (!(cqhci_readl(cq_host, CQHCI_TDBR) & (1 << tag))) |
| 617 | pr_debug("%s: cqhci: doorbell not set for tag %d\n", | 618 | pr_debug("%s: cqhci: doorbell not set for tag %d\n", |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/dma-mapping.h> | 18 | #include <linux/dma-mapping.h> |
| 19 | #include <linux/dmaengine.h> | 19 | #include <linux/dmaengine.h> |
| 20 | #include <linux/dma/mxs-dma.h> | ||
| 20 | #include <linux/highmem.h> | 21 | #include <linux/highmem.h> |
| 21 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
| 22 | #include <linux/err.h> | 23 | #include <linux/err.h> |
| @@ -266,7 +267,7 @@ static void mxs_mmc_bc(struct mxs_mmc_host *host) · 243 unmodified lines | |||
| 266 | ssp->ssp_pio_words[2] = cmd1; | 267 | ssp->ssp_pio_words[2] = cmd1; |
| 267 | ssp->dma_dir = DMA_NONE; | 268 | ssp->dma_dir = DMA_NONE; |
| 268 | ssp->slave_dirn = DMA_TRANS_NONE; | 269 | ssp->slave_dirn = DMA_TRANS_NONE; |
| 269 | desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK); | 270 | desc = mxs_mmc_prep_dma(host, MXS_DMA_CTRL_WAIT4END); |
| 270 | if (!desc) | 271 | if (!desc) |
| 271 | goto out; | 272 | goto out; |
| 272 | 273 | ||
| @@ -311,7 +312,7 @@ static void mxs_mmc_ac(struct mxs_mmc_host *host) · 38 unmodified lines | |||
| 311 | ssp->ssp_pio_words[2] = cmd1; | 312 | ssp->ssp_pio_words[2] = cmd1; |
| 312 | ssp->dma_dir = DMA_NONE; | 313 | ssp->dma_dir = DMA_NONE; |
| 313 | ssp->slave_dirn = DMA_TRANS_NONE; | 314 | ssp->slave_dirn = DMA_TRANS_NONE; |
| 314 | desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK); | 315 | desc = mxs_mmc_prep_dma(host, MXS_DMA_CTRL_WAIT4END); |
| 315 | if (!desc) | 316 | if (!desc) |
| 316 | goto out; | 317 | goto out; |
| 317 | 318 | ||
| @@ -441,7 +442,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) · 123 unmodified lines | |||
| 441 | host->data = data; | 442 | host->data = data; |
| 442 | ssp->dma_dir = dma_data_dir; | 443 | ssp->dma_dir = dma_data_dir; |
| 443 | ssp->slave_dirn = slave_dirn; | 444 | ssp->slave_dirn = slave_dirn; |
| 444 | desc = mxs_mmc_prep_dma(host, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 445 | desc = mxs_mmc_prep_dma(host, DMA_PREP_INTERRUPT | MXS_DMA_CTRL_WAIT4END); |
| 445 | if (!desc) | 446 | if (!desc) |
| 446 | goto out; | 447 | goto out; |
| 447 | 448 | ||
| @@ -646,8 +646,8 @@ int renesas_sdhi_probe(struct platform_device *pdev, · 645 unmodified lines | |||
| 646 | struct tmio_mmc_dma *dma_priv; | 646 | struct tmio_mmc_dma *dma_priv; |
| 647 | struct tmio_mmc_host *host; | 647 | struct tmio_mmc_host *host; |
| 648 | struct renesas_sdhi *priv; | 648 | struct renesas_sdhi *priv; |
| 649 | int num_irqs, irq, ret, i; | ||
| 649 | struct resource *res; | 650 | struct resource *res; |
| 650 | int irq, ret, i; | ||
| 651 | u16 ver; | 651 | u16 ver; |
| 652 | 652 | ||
| 653 | of_data = of_device_get_match_data(&pdev->dev); | 653 | of_data = of_device_get_match_data(&pdev->dev); |
| @@ -825,24 +825,31 @@ int renesas_sdhi_probe(struct platform_device *pdev, · 171 unmodified lines | |||
| 825 | host->hs400_complete = renesas_sdhi_hs400_complete; | 825 | host->hs400_complete = renesas_sdhi_hs400_complete; |
| 826 | } | 826 | } |
| 827 | 827 | ||
| 828 | i = 0; | 828 | num_irqs = platform_irq_count(pdev); |
| 829 | while (1) { | 829 | if (num_irqs < 0) { |
| 830 | ret = num_irqs; | ||
| 831 | goto eirq; | ||
| 832 | } | ||
| 833 | |||
| 834 | /* There must be at least one IRQ source */ | ||
| 835 | if (!num_irqs) { | ||
| 836 | ret = -ENXIO; | ||
| 837 | goto eirq; | ||
| 838 | } | ||
| 839 | |||
| 840 | for (i = 0; i < num_irqs; i++) { | ||
| 830 | irq = platform_get_irq(pdev, i); | 841 | irq = platform_get_irq(pdev, i); |
| 831 | if (irq < 0) | 842 | if (irq < 0) { |
| 832 | break; | 843 | ret = irq; |
| 833 | i++; | 844 | goto eirq; |
| 845 | } | ||
| 846 | |||
| 834 | ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0, | 847 | ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0, |
| 835 | dev_name(&pdev->dev), host); | 848 | dev_name(&pdev->dev), host); |
| 836 | if (ret) | 849 | if (ret) |
| 837 | goto eirq; | 850 | goto eirq; |
| 838 | } | 851 | } |
| 839 | 852 | ||
| 840 | /* There must be at least one IRQ source */ | ||
| 841 | if (!i) { | ||
| 842 | ret = irq; | ||
| 843 | goto eirq; | ||
| 844 | } | ||
| 845 | |||
| 846 | dev_info(&pdev->dev, "%s base at 0x%08lx max clock rate %u MHz\n", | 853 | dev_info(&pdev->dev, "%s base at 0x%08lx max clock rate %u MHz\n", |
| 847 | mmc_hostname(host->mmc), (unsigned long) | 854 | mmc_hostname(host->mmc), (unsigned long) |
| 848 | (platform_get_resource(pdev, IORESOURCE_MEM, 0)->start), | 855 | (platform_get_resource(pdev, IORESOURCE_MEM, 0)->start), |
| @@ -262,6 +262,7 @@ static const struct sdhci_iproc_data bcm2835_data = { · 261 unmodified lines | |||
| 262 | }; | 262 | }; |
| 263 | 263 | ||
| 264 | static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = { | 264 | static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = { |
| 265 | .quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, | ||
| 265 | .ops = &sdhci_iproc_32only_ops, | 266 | .ops = &sdhci_iproc_32only_ops, |
| 266 | }; | 267 | }; |
| 267 | 268 | ||
| @@ -372,7 +372,7 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) · 371 unmodified lines | |||
| 372 | * on temperature | 372 | * on temperature |
| 373 | */ | 373 | */ |
| 374 | if (temperature < -20000) | 374 | if (temperature < -20000) |
| 375 | phase_delay = min(max_window + 4 * max_len - 24, | 375 | phase_delay = min(max_window + 4 * (max_len - 1) - 24, |
| 376 | max_window + | 376 | max_window + |
| 377 | DIV_ROUND_UP(13 * max_len, 16) * 4); | 377 | DIV_ROUND_UP(13 * max_len, 16) * 4); |
| 378 | else if (temperature < 20000) | 378 | else if (temperature < 20000) |
| @@ -1393,11 +1393,9 @@ static int sh_mmcif_probe(struct platform_device *pdev) · 1392 unmodified lines | |||
| 1393 | const char *name; | 1393 | const char *name; |
| 1394 | 1394 | ||
| 1395 | irq[0] = platform_get_irq(pdev, 0); | 1395 | irq[0] = platform_get_irq(pdev, 0); |
| 1396 | irq[1] = platform_get_irq(pdev, 1); | 1396 | irq[1] = platform_get_irq_optional(pdev, 1); |
| 1397 | if (irq[0] < 0) { | 1397 | if (irq[0] < 0) |
| 1398 | dev_err(dev, "Get irq error\n"); | ||
| 1399 | return -ENXIO; | 1398 | return -ENXIO; |
| 1400 | } | ||
| 1401 | 1399 | ||
| 1402 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1400 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1403 | reg = devm_ioremap_resource(dev, res); | 1401 | reg = devm_ioremap_resource(dev, res); |
| @@ -4039,7 +4039,7 @@ out: · 4038 unmodified lines | |||
| 4039 | * this to-be-skipped slave to send a packet out. | 4039 | * this to-be-skipped slave to send a packet out. |
| 4040 | */ | 4040 | */ |
| 4041 | old_arr = rtnl_dereference(bond->slave_arr); | 4041 | old_arr = rtnl_dereference(bond->slave_arr); |
| 4042 | for (idx = 0; idx < old_arr->count; idx++) { | 4042 | for (idx = 0; old_arr != NULL && idx < old_arr->count; idx++) { |
| 4043 | if (skipslave == old_arr->arr[idx]) { | 4043 | if (skipslave == old_arr->arr[idx]) { |
| 4044 | old_arr->arr[idx] = | 4044 | old_arr->arr[idx] = |
| 4045 | old_arr->arr[old_arr->count-1]; | 4045 | old_arr->arr[old_arr->count-1]; |
| @@ -1845,7 +1845,6 @@ int b53_mirror_add(struct dsa_switch *ds, int port, · 1844 unmodified lines | |||
| 1845 | loc = B53_EG_MIR_CTL; | 1845 | loc = B53_EG_MIR_CTL; |
| 1846 | 1846 | ||
| 1847 | b53_read16(dev, B53_MGMT_PAGE, loc, ®); | 1847 | b53_read16(dev, B53_MGMT_PAGE, loc, ®); |
| 1848 | reg &= ~MIRROR_MASK; | ||
| 1849 | reg |= BIT(port); | 1848 | reg |= BIT(port); |
| 1850 | b53_write16(dev, B53_MGMT_PAGE, loc, reg); | 1849 | b53_write16(dev, B53_MGMT_PAGE, loc, reg); |
| 1851 | 1850 | ||
| @@ -1224,10 +1224,6 @@ static int ksz8795_switch_init(struct ksz_device *dev) · 1223 unmodified lines | |||
| 1224 | { | 1224 | { |
| 1225 | int i; | 1225 | int i; |
| 1226 | 1226 | ||
| 1227 | mutex_init(&dev->stats_mutex); | ||
| 1228 | mutex_init(&dev->alu_mutex); | ||
| 1229 | mutex_init(&dev->vlan_mutex); | ||
| 1230 | |||
| 1231 | dev->ds->ops = &ksz8795_switch_ops; | 1227 | dev->ds->ops = &ksz8795_switch_ops; |
| 1232 | 1228 | ||
| 1233 | for (i = 0; i < ARRAY_SIZE(ksz8795_switch_chips); i++) { | 1229 | for (i = 0; i < ARRAY_SIZE(ksz8795_switch_chips); i++) { |
| @@ -25,6 +25,7 @@ KSZ_REGMAP_TABLE(ksz8795, 16, SPI_ADDR_SHIFT, · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | static int ksz8795_spi_probe(struct spi_device *spi) | 26 | static int ksz8795_spi_probe(struct spi_device *spi) |
| 27 | { | 27 | { |
| 28 | struct regmap_config rc; | ||
| 28 | struct ksz_device *dev; | 29 | struct ksz_device *dev; |
| 29 | int i, ret; | 30 | int i, ret; |
| 30 | 31 | ||
| @@ -33,9 +34,9 @@ static int ksz8795_spi_probe(struct spi_device *spi) · 2 unmodified lines | |||
| 33 | return -ENOMEM; | 34 | return -ENOMEM; |
| 34 | 35 | ||
| 35 | for (i = 0; i < ARRAY_SIZE(ksz8795_regmap_config); i++) { | 36 | for (i = 0; i < ARRAY_SIZE(ksz8795_regmap_config); i++) { |
| 36 | dev->regmap[i] = devm_regmap_init_spi(spi, | 37 | rc = ksz8795_regmap_config[i]; |
| 37 | &ksz8795_regmap_config | 38 | rc.lock_arg = &dev->regmap_mutex; |
| 38 | [i]); | 39 | dev->regmap[i] = devm_regmap_init_spi(spi, &rc); |
| 39 | if (IS_ERR(dev->regmap[i])) { | 40 | if (IS_ERR(dev->regmap[i])) { |
| 40 | ret = PTR_ERR(dev->regmap[i]); | 41 | ret = PTR_ERR(dev->regmap[i]); |
| 41 | dev_err(&spi->dev, | 42 | dev_err(&spi->dev, |
| @@ -17,6 +17,7 @@ KSZ_REGMAP_TABLE(ksz9477, not_used, 16, 0, 0); · 16 unmodified lines | |||
| 17 | static int ksz9477_i2c_probe(struct i2c_client *i2c, | 17 | static int ksz9477_i2c_probe(struct i2c_client *i2c, |
| 18 | const struct i2c_device_id *i2c_id) | 18 | const struct i2c_device_id *i2c_id) |
| 19 | { | 19 | { |
| 20 | struct regmap_config rc; | ||
| 20 | struct ksz_device *dev; | 21 | struct ksz_device *dev; |
| 21 | int i, ret; | 22 | int i, ret; |
| 22 | 23 | ||
| @@ -25,8 +26,9 @@ static int ksz9477_i2c_probe(struct i2c_client *i2c, · 2 unmodified lines | |||
| 25 | return -ENOMEM; | 26 | return -ENOMEM; |
| 26 | 27 | ||
| 27 | for (i = 0; i < ARRAY_SIZE(ksz9477_regmap_config); i++) { | 28 | for (i = 0; i < ARRAY_SIZE(ksz9477_regmap_config); i++) { |
| 28 | dev->regmap[i] = devm_regmap_init_i2c(i2c, | 29 | rc = ksz9477_regmap_config[i]; |
| 29 | &ksz9477_regmap_config[i]); | 30 | rc.lock_arg = &dev->regmap_mutex; |
| 31 | dev->regmap[i] = devm_regmap_init_i2c(i2c, &rc); | ||
| 30 | if (IS_ERR(dev->regmap[i])) { | 32 | if (IS_ERR(dev->regmap[i])) { |
| 31 | ret = PTR_ERR(dev->regmap[i]); | 33 | ret = PTR_ERR(dev->regmap[i]); |
| 32 | dev_err(&i2c->dev, | 34 | dev_err(&i2c->dev, |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | * | 2 | /* |
| 3 | * Microchip KSZ9477 register definitions | 3 | * Microchip KSZ9477 register definitions |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2017-2018 Microchip Technology Inc. | 5 | * Copyright (C) 2017-2018 Microchip Technology Inc. |
| @@ -24,6 +24,7 @@ KSZ_REGMAP_TABLE(ksz9477, 32, SPI_ADDR_SHIFT, · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | static int ksz9477_spi_probe(struct spi_device *spi) | 25 | static int ksz9477_spi_probe(struct spi_device *spi) |
| 26 | { | 26 | { |
| 27 | struct regmap_config rc; | ||
| 27 | struct ksz_device *dev; | 28 | struct ksz_device *dev; |
| 28 | int i, ret; | 29 | int i, ret; |
| 29 | 30 | ||
| @@ -32,8 +33,9 @@ static int ksz9477_spi_probe(struct spi_device *spi) · 2 unmodified lines | |||
| 32 | return -ENOMEM; | 33 | return -ENOMEM; |
| 33 | 34 | ||
| 34 | for (i = 0; i < ARRAY_SIZE(ksz9477_regmap_config); i++) { | 35 | for (i = 0; i < ARRAY_SIZE(ksz9477_regmap_config); i++) { |
| 35 | dev->regmap[i] = devm_regmap_init_spi(spi, | 36 | rc = ksz9477_regmap_config[i]; |
| 36 | &ksz9477_regmap_config[i]); | 37 | rc.lock_arg = &dev->regmap_mutex; |
| 38 | dev->regmap[i] = devm_regmap_init_spi(spi, &rc); | ||
| 37 | if (IS_ERR(dev->regmap[i])) { | 39 | if (IS_ERR(dev->regmap[i])) { |
| 38 | ret = PTR_ERR(dev->regmap[i]); | 40 | ret = PTR_ERR(dev->regmap[i]); |
| 39 | dev_err(&spi->dev, | 41 | dev_err(&spi->dev, |
| @@ -436,7 +436,7 @@ int ksz_switch_register(struct ksz_device *dev, · 435 unmodified lines | |||
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | mutex_init(&dev->dev_mutex); | 438 | mutex_init(&dev->dev_mutex); |
| 439 | mutex_init(&dev->stats_mutex); | 439 | mutex_init(&dev->regmap_mutex); |
| 440 | mutex_init(&dev->alu_mutex); | 440 | mutex_init(&dev->alu_mutex); |
| 441 | mutex_init(&dev->vlan_mutex); | 441 | mutex_init(&dev->vlan_mutex); |
| 442 | 442 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | * Microchip switch driver common header | 2 | /* Microchip switch driver common header |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2017-2019 Microchip Technology Inc. | 4 | * Copyright (C) 2017-2019 Microchip Technology Inc. |
| 5 | */ | 5 | */ |
| @@ -47,7 +47,7 @@ struct ksz_device { · 41 unmodified lines | |||
| 47 | const char *name; | 47 | const char *name; |
| 48 | 48 | ||
| 49 | struct mutex dev_mutex; /* device access */ | 49 | struct mutex dev_mutex; /* device access */ |
| 50 | struct mutex stats_mutex; /* status access */ | 50 | struct mutex regmap_mutex; /* regmap access */ |
| 51 | struct mutex alu_mutex; /* ALU access */ | 51 | struct mutex alu_mutex; /* ALU access */ |
| 52 | struct mutex vlan_mutex; /* vlan access */ | 52 | struct mutex vlan_mutex; /* vlan access */ |
| 53 | const struct ksz_dev_ops *dev_ops; | 53 | const struct ksz_dev_ops *dev_ops; |
| @@ -290,6 +290,18 @@ static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset, · 236 unmodified lines | |||
| 290 | ksz_write32(dev, dev->dev_ops->get_port_addr(port, offset), data); | 290 | ksz_write32(dev, dev->dev_ops->get_port_addr(port, offset), data); |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | static inline void ksz_regmap_lock(void *__mtx) | ||
| 294 | { | ||
| 295 | struct mutex *mtx = __mtx; | ||
| 296 | mutex_lock(mtx); | ||
| 297 | } | ||
| 298 | |||
| 299 | static inline void ksz_regmap_unlock(void *__mtx) | ||
| 300 | { | ||
| 301 | struct mutex *mtx = __mtx; | ||
| 302 | mutex_unlock(mtx); | ||
| 303 | } | ||
| 304 | |||
| 293 | /* Regmap tables generation */ | 305 | /* Regmap tables generation */ |
| 294 | #define KSZ_SPI_OP_RD 3 | 306 | #define KSZ_SPI_OP_RD 3 |
| 295 | #define KSZ_SPI_OP_WR 2 | 307 | #define KSZ_SPI_OP_WR 2 |
| @@ -314,6 +326,8 @@ static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset, · 18 unmodified lines | |||
| 314 | .write_flag_mask = \ | 326 | .write_flag_mask = \ |
| 315 | KSZ_SPI_OP_FLAG_MASK(KSZ_SPI_OP_WR, swp, \ | 327 | KSZ_SPI_OP_FLAG_MASK(KSZ_SPI_OP_WR, swp, \ |
| 316 | regbits, regpad), \ | 328 | regbits, regpad), \ |
| 329 | .lock = ksz_regmap_lock, \ | ||
| 330 | .unlock = ksz_regmap_unlock, \ | ||
| 317 | .reg_format_endian = REGMAP_ENDIAN_BIG, \ | 331 | .reg_format_endian = REGMAP_ENDIAN_BIG, \ |
| 318 | .val_format_endian = REGMAP_ENDIAN_BIG \ | 332 | .val_format_endian = REGMAP_ENDIAN_BIG \ |
| 319 | } | 333 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | * Copyright (c) 2018, Sensor-Technik Wiedemann GmbH | 2 | /* Copyright (c) 2018, Sensor-Technik Wiedemann GmbH |
| 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> |
| 4 | */ | 4 | */ |
| 5 | #ifndef _SJA1105_H | 5 | #ifndef _SJA1105_H |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> | 2 | /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> |
| 3 | */ | 3 | */ |
| 4 | #ifndef _SJA1105_DYNAMIC_CONFIG_H | 4 | #ifndef _SJA1105_DYNAMIC_CONFIG_H |
| 5 | #define _SJA1105_DYNAMIC_CONFIG_H | 5 | #define _SJA1105_DYNAMIC_CONFIG_H |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> | 2 | /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> |
| 3 | */ | 3 | */ |
| 4 | #ifndef _SJA1105_PTP_H | 4 | #ifndef _SJA1105_PTP_H |
| 5 | #define _SJA1105_PTP_H | 5 | #define _SJA1105_PTP_H |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: BSD-3-Clause | 1 | /* SPDX-License-Identifier: BSD-3-Clause */ |
| 2 | * Copyright (c) 2016-2018, NXP Semiconductors | 2 | /* Copyright (c) 2016-2018, NXP Semiconductors |
| 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> | 3 | * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com> |
| 4 | */ | 4 | */ |
| 5 | #ifndef _SJA1105_STATIC_CONFIG_H | 5 | #ifndef _SJA1105_STATIC_CONFIG_H |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> | 2 | /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com> |
| 3 | */ | 3 | */ |
| 4 | #ifndef _SJA1105_TAS_H | 4 | #ifndef _SJA1105_TAS_H |
| 5 | #define _SJA1105_TAS_H | 5 | #define _SJA1105_TAS_H |
| @@ -194,9 +194,7 @@ static void aq_ndev_set_multicast_settings(struct net_device *ndev) · 193 unmodified lines | |||
| 194 | { | 194 | { |
| 195 | struct aq_nic_s *aq_nic = netdev_priv(ndev); | 195 | struct aq_nic_s *aq_nic = netdev_priv(ndev); |
| 196 | 196 | ||
| 197 | aq_nic_set_packet_filter(aq_nic, ndev->flags); | 197 | (void)aq_nic_set_multicast_list(aq_nic, ndev); |
| 198 | |||
| 199 | aq_nic_set_multicast_list(aq_nic, ndev); | ||
| 200 | } | 198 | } |
| 201 | 199 | ||
| 202 | static int aq_ndo_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, | 200 | static int aq_ndo_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, |
| @@ -631,9 +631,12 @@ err_exit: · 630 unmodified lines | |||
| 631 | 631 | ||
| 632 | int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev) | 632 | int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev) |
| 633 | { | 633 | { |
| 634 | unsigned int packet_filter = self->packet_filter; | 634 | const struct aq_hw_ops *hw_ops = self->aq_hw_ops; |
| 635 | struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg; | ||
| 636 | unsigned int packet_filter = ndev->flags; | ||
| 635 | struct netdev_hw_addr *ha = NULL; | 637 | struct netdev_hw_addr *ha = NULL; |
| 636 | unsigned int i = 0U; | 638 | unsigned int i = 0U; |
| 639 | int err = 0; | ||
| 637 | 640 | ||
| 638 | self->mc_list.count = 0; | 641 | self->mc_list.count = 0; |
| 639 | if (netdev_uc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) { | 642 | if (netdev_uc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) { |
| @@ -641,29 +644,28 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev) · 1 unmodified line | |||
| 641 | } else { | 644 | } else { |
| 642 | netdev_for_each_uc_addr(ha, ndev) { | 645 | netdev_for_each_uc_addr(ha, ndev) { |
| 643 | ether_addr_copy(self->mc_list.ar[i++], ha->addr); | 646 | ether_addr_copy(self->mc_list.ar[i++], ha->addr); |
| 644 | |||
| 645 | if (i >= AQ_HW_MULTICAST_ADDRESS_MAX) | ||
| 646 | break; | ||
| 647 | } | 647 | } |
| 648 | } | 648 | } |
| 649 | 649 | ||
| 650 | if (i + netdev_mc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) { | 650 | cfg->is_mc_list_enabled = !!(packet_filter & IFF_MULTICAST); |
| 651 | packet_filter |= IFF_ALLMULTI; | 651 | if (cfg->is_mc_list_enabled) { |
| 652 | } else { | 652 | if (i + netdev_mc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) { |
| 653 | netdev_for_each_mc_addr(ha, ndev) { | 653 | packet_filter |= IFF_ALLMULTI; |
| 654 | ether_addr_copy(self->mc_list.ar[i++], ha->addr); | 654 | } else { |
| 655 | 655 | netdev_for_each_mc_addr(ha, ndev) { | |
| 656 | if (i >= AQ_HW_MULTICAST_ADDRESS_MAX) | 656 | ether_addr_copy(self->mc_list.ar[i++], |
| 657 | break; | 657 | ha->addr); |
| 658 | } | ||
| 658 | } | 659 | } |
| 659 | } | 660 | } |
| 660 | 661 | ||
| 661 | if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) { | 662 | if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) { |
| 662 | packet_filter |= IFF_MULTICAST; | ||
| 663 | self->mc_list.count = i; | 663 | self->mc_list.count = i; |
| 664 | self->aq_hw_ops->hw_multicast_list_set(self->aq_hw, | 664 | err = hw_ops->hw_multicast_list_set(self->aq_hw, |
| 665 | self->mc_list.ar, | 665 | self->mc_list.ar, |
| 666 | self->mc_list.count); | 666 | self->mc_list.count); |
| 667 | if (err < 0) | ||
| 668 | return err; | ||
| 667 | } | 669 | } |
| 668 | return aq_nic_set_packet_filter(self, packet_filter); | 670 | return aq_nic_set_packet_filter(self, packet_filter); |
| 669 | } | 671 | } |
| @@ -313,6 +313,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self, · 312 unmodified lines | |||
| 313 | break; | 313 | break; |
| 314 | 314 | ||
| 315 | buff->is_error |= buff_->is_error; | 315 | buff->is_error |= buff_->is_error; |
| 316 | buff->is_cso_err |= buff_->is_cso_err; | ||
| 316 | 317 | ||
| 317 | } while (!buff_->is_eop); | 318 | } while (!buff_->is_eop); |
| 318 | 319 | ||
| @@ -320,7 +321,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self, · 1 unmodified line | |||
| 320 | err = 0; | 321 | err = 0; |
| 321 | goto err_exit; | 322 | goto err_exit; |
| 322 | } | 323 | } |
| 323 | if (buff->is_error) { | 324 | if (buff->is_error || buff->is_cso_err) { |
| 324 | buff_ = buff; | 325 | buff_ = buff; |
| 325 | do { | 326 | do { |
| 326 | next_ = buff_->next, | 327 | next_ = buff_->next, |
| @@ -818,14 +818,15 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, · 817 unmodified lines | |||
| 818 | cfg->is_vlan_force_promisc); | 818 | cfg->is_vlan_force_promisc); |
| 819 | 819 | ||
| 820 | hw_atl_rpfl2multicast_flr_en_set(self, | 820 | hw_atl_rpfl2multicast_flr_en_set(self, |
| 821 | IS_FILTER_ENABLED(IFF_ALLMULTI), 0); | 821 | IS_FILTER_ENABLED(IFF_ALLMULTI) && |
| 822 | IS_FILTER_ENABLED(IFF_MULTICAST), 0); | ||
| 822 | 823 | ||
| 823 | hw_atl_rpfl2_accept_all_mc_packets_set(self, | 824 | hw_atl_rpfl2_accept_all_mc_packets_set(self, |
| 824 | IS_FILTER_ENABLED(IFF_ALLMULTI)); | 825 | IS_FILTER_ENABLED(IFF_ALLMULTI) && |
| 826 | IS_FILTER_ENABLED(IFF_MULTICAST)); | ||
| 825 | 827 | ||
| 826 | hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST)); | 828 | hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST)); |
| 827 | 829 | ||
| 828 | cfg->is_mc_list_enabled = IS_FILTER_ENABLED(IFF_MULTICAST); | ||
| 829 | 830 | ||
| 830 | for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i) | 831 | for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i) |
| 831 | hw_atl_rpfl2_uc_flr_en_set(self, | 832 | hw_atl_rpfl2_uc_flr_en_set(self, |
| @@ -968,14 +969,26 @@ static int hw_atl_b0_hw_interrupt_moderation_set(struct aq_hw_s *self) · 136 unmodified lines | |||
| 968 | 969 | ||
| 969 | static int hw_atl_b0_hw_stop(struct aq_hw_s *self) | 970 | static int hw_atl_b0_hw_stop(struct aq_hw_s *self) |
| 970 | { | 971 | { |
| 972 | int err; | ||
| 973 | u32 val; | ||
| 974 | |||
| 971 | hw_atl_b0_hw_irq_disable(self, HW_ATL_B0_INT_MASK); | 975 | hw_atl_b0_hw_irq_disable(self, HW_ATL_B0_INT_MASK); |
| 972 | 976 | ||
| 973 | /* Invalidate Descriptor Cache to prevent writing to the cached | 977 | /* Invalidate Descriptor Cache to prevent writing to the cached |
| 974 | * descriptors and to the data pointer of those descriptors | 978 | * descriptors and to the data pointer of those descriptors |
| 975 | */ | 979 | */ |
| 976 | hw_atl_rdm_rx_dma_desc_cache_init_set(self, 1); | 980 | hw_atl_rdm_rx_dma_desc_cache_init_tgl(self); |
| 977 | 981 | ||
| 978 | return aq_hw_err_from_flags(self); | 982 | err = aq_hw_err_from_flags(self); |
| 983 | |||
| 984 | if (err) | ||
| 985 | goto err_exit; | ||
| 986 | |||
| 987 | readx_poll_timeout_atomic(hw_atl_rdm_rx_dma_desc_cache_init_done_get, | ||
| 988 | self, val, val == 1, 1000U, 10000U); | ||
| 989 | |||
| 990 | err_exit: | ||
| 991 | return err; | ||
| 979 | } | 992 | } |
| 980 | 993 | ||
| 981 | static int hw_atl_b0_hw_ring_tx_stop(struct aq_hw_s *self, | 994 | static int hw_atl_b0_hw_ring_tx_stop(struct aq_hw_s *self, |
| @@ -606,12 +606,25 @@ void hw_atl_rpb_rx_flow_ctl_mode_set(struct aq_hw_s *aq_hw, u32 rx_flow_ctl_mode · 605 unmodified lines | |||
| 606 | HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode); | 606 | HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode); |
| 607 | } | 607 | } |
| 608 | 608 | ||
| 609 | void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init) | 609 | void hw_atl_rdm_rx_dma_desc_cache_init_tgl(struct aq_hw_s *aq_hw) |
| 610 | { | 610 | { |
| 611 | u32 val; | ||
| 612 | |||
| 613 | val = aq_hw_read_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR, | ||
| 614 | HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK, | ||
| 615 | HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT); | ||
| 616 | |||
| 611 | aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR, | 617 | aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR, |
| 612 | HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK, | 618 | HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK, |
| 613 | HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT, | 619 | HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT, |
| 614 | init); | 620 | val ^ 1); |
| 621 | } | ||
| 622 | |||
| 623 | u32 hw_atl_rdm_rx_dma_desc_cache_init_done_get(struct aq_hw_s *aq_hw) | ||
| 624 | { | ||
| 625 | return aq_hw_read_reg_bit(aq_hw, RDM_RX_DMA_DESC_CACHE_INIT_DONE_ADR, | ||
| 626 | RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSK, | ||
| 627 | RDM_RX_DMA_DESC_CACHE_INIT_DONE_SHIFT); | ||
| 615 | } | 628 | } |
| 616 | 629 | ||
| 617 | void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, | 630 | void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, |
| @@ -313,8 +313,11 @@ void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, · 312 unmodified lines | |||
| 313 | u32 rx_pkt_buff_size_per_tc, | 313 | u32 rx_pkt_buff_size_per_tc, |
| 314 | u32 buffer); | 314 | u32 buffer); |
| 315 | 315 | ||
| 316 | /* set rdm rx dma descriptor cache init */ | 316 | /* toggle rdm rx dma descriptor cache init */ |
| 317 | void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init); | 317 | void hw_atl_rdm_rx_dma_desc_cache_init_tgl(struct aq_hw_s *aq_hw); |
| 318 | |||
| 319 | /* get rdm rx dma descriptor cache init done */ | ||
| 320 | u32 hw_atl_rdm_rx_dma_desc_cache_init_done_get(struct aq_hw_s *aq_hw); | ||
| 318 | 321 | ||
| 319 | /* set rx xoff enable (per tc) */ | 322 | /* set rx xoff enable (per tc) */ |
| 320 | void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc, | 323 | void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc, |
| @@ -318,6 +318,25 @@ · 317 unmodified lines | |||
| 318 | /* default value of bitfield rdm_desc_init_i */ | 318 | /* default value of bitfield rdm_desc_init_i */ |
| 319 | #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_DEFAULT 0x0 | 319 | #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_DEFAULT 0x0 |
| 320 | 320 | ||
| 321 | /* rdm_desc_init_done_i bitfield definitions | ||
| 322 | * preprocessor definitions for the bitfield rdm_desc_init_done_i. | ||
| 323 | * port="pif_rdm_desc_init_done_i" | ||
| 324 | */ | ||
| 325 | |||
| 326 | /* register address for bitfield rdm_desc_init_done_i */ | ||
| 327 | #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_ADR 0x00005a10 | ||
| 328 | /* bitmask for bitfield rdm_desc_init_done_i */ | ||
| 329 | #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSK 0x00000001U | ||
| 330 | /* inverted bitmask for bitfield rdm_desc_init_done_i */ | ||
| 331 | #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSKN 0xfffffffe | ||
| 332 | /* lower bit position of bitfield rdm_desc_init_done_i */ | ||
| 333 | #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_SHIFT 0U | ||
| 334 | /* width of bitfield rdm_desc_init_done_i */ | ||
| 335 | #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_WIDTH 1 | ||
| 336 | /* default value of bitfield rdm_desc_init_done_i */ | ||
| 337 | #define RDM_RX_DMA_DESC_CACHE_INIT_DONE_DEFAULT 0x0 | ||
| 338 | |||
| 339 | |||
| 321 | /* rx int_desc_wrb_en bitfield definitions | 340 | /* rx int_desc_wrb_en bitfield definitions |
| 322 | * preprocessor definitions for the bitfield "int_desc_wrb_en". | 341 | * preprocessor definitions for the bitfield "int_desc_wrb_en". |
| 323 | * port="pif_rdm_int_desc_wrb_en_i" | 342 | * port="pif_rdm_int_desc_wrb_en_i" |
| @@ -337,7 +337,7 @@ static int aq_fw2x_get_phy_temp(struct aq_hw_s *self, int *temp) · 336 unmodified lines | |||
| 337 | /* Convert PHY temperature from 1/256 degree Celsius | 337 | /* Convert PHY temperature from 1/256 degree Celsius |
| 338 | * to 1/1000 degree Celsius. | 338 | * to 1/1000 degree Celsius. |
| 339 | */ | 339 | */ |
| 340 | *temp = temp_res * 1000 / 256; | 340 | *temp = (temp_res & 0xFFFF) * 1000 / 256; |
| 341 | 341 | ||
| 342 | return 0; | 342 | return 0; |
| 343 | } | 343 | } |
| @@ -8,7 +8,6 @@ config NET_VENDOR_BROADCOM · 7 unmodified lines | |||
| 8 | default y | 8 | default y |
| 9 | depends on (SSB_POSSIBLE && HAS_DMA) || PCI || BCM63XX || \ | 9 | depends on (SSB_POSSIBLE && HAS_DMA) || PCI || BCM63XX || \ |
| 10 | SIBYTE_SB1xxx_SOC | 10 | SIBYTE_SB1xxx_SOC |
| 11 | select DIMLIB | ||
| 12 | ---help--- | 11 | ---help--- |
| 13 | If you have a network (Ethernet) chipset belonging to this class, | 12 | If you have a network (Ethernet) chipset belonging to this class, |
| 14 | say Y. | 13 | say Y. |
| @@ -69,6 +68,7 @@ config BCMGENET · 54 unmodified lines | |||
| 69 | select FIXED_PHY | 68 | select FIXED_PHY |
| 70 | select BCM7XXX_PHY | 69 | select BCM7XXX_PHY |
| 71 | select MDIO_BCM_UNIMAC | 70 | select MDIO_BCM_UNIMAC |
| 71 | select DIMLIB | ||
| 72 | help | 72 | help |
| 73 | This driver supports the built-in Ethernet MACs found in the | 73 | This driver supports the built-in Ethernet MACs found in the |
| 74 | Broadcom BCM7xxx Set Top Box family chipset. | 74 | Broadcom BCM7xxx Set Top Box family chipset. |
| @@ -188,6 +188,7 @@ config SYSTEMPORT · 113 unmodified lines | |||
| 188 | select MII | 188 | select MII |
| 189 | select PHYLIB | 189 | select PHYLIB |
| 190 | select FIXED_PHY | 190 | select FIXED_PHY |
| 191 | select DIMLIB | ||
| 191 | help | 192 | help |
| 192 | This driver supports the built-in Ethernet MACs found in the | 193 | This driver supports the built-in Ethernet MACs found in the |
| 193 | Broadcom BCM7xxx Set Top Box family chipset using an internal | 194 | Broadcom BCM7xxx Set Top Box family chipset using an internal |
| @@ -200,6 +201,7 @@ config BNXT · 6 unmodified lines | |||
| 200 | select LIBCRC32C | 201 | select LIBCRC32C |
| 201 | select NET_DEVLINK | 202 | select NET_DEVLINK |
| 202 | select PAGE_POOL | 203 | select PAGE_POOL |
| 204 | select DIMLIB | ||
| 203 | ---help--- | 205 | ---help--- |
| 204 | This driver supports Broadcom NetXtreme-C/E 10/25/40/50 gigabit | 206 | This driver supports Broadcom NetXtreme-C/E 10/25/40/50 gigabit |
| 205 | Ethernet cards. To compile this driver as a module, choose M here: | 207 | Ethernet cards. To compile this driver as a module, choose M here: |
| @@ -2018,6 +2018,8 @@ static void bcmgenet_link_intr_enable(struct bcmgenet_priv *priv) · 2017 unmodified lines | |||
| 2018 | */ | 2018 | */ |
| 2019 | if (priv->internal_phy) { | 2019 | if (priv->internal_phy) { |
| 2020 | int0_enable |= UMAC_IRQ_LINK_EVENT; | 2020 | int0_enable |= UMAC_IRQ_LINK_EVENT; |
| 2021 | if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv)) | ||
| 2022 | int0_enable |= UMAC_IRQ_PHY_DET_R; | ||
| 2021 | } else if (priv->ext_phy) { | 2023 | } else if (priv->ext_phy) { |
| 2022 | int0_enable |= UMAC_IRQ_LINK_EVENT; | 2024 | int0_enable |= UMAC_IRQ_LINK_EVENT; |
| 2023 | } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) { | 2025 | } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) { |
| @@ -2611,11 +2613,14 @@ static void bcmgenet_irq_task(struct work_struct *work) · 587 unmodified lines | |||
| 2611 | priv->irq0_stat = 0; | 2613 | priv->irq0_stat = 0; |
| 2612 | spin_unlock_irq(&priv->lock); | 2614 | spin_unlock_irq(&priv->lock); |
| 2613 | 2615 | ||
| 2616 | if (status & UMAC_IRQ_PHY_DET_R && | ||
| 2617 | priv->dev->phydev->autoneg != AUTONEG_ENABLE) | ||
| 2618 | phy_init_hw(priv->dev->phydev); | ||
| 2619 | |||
| 2614 | /* Link UP/DOWN event */ | 2620 | /* Link UP/DOWN event */ |
| 2615 | if (status & UMAC_IRQ_LINK_EVENT) { | 2621 | if (status & UMAC_IRQ_LINK_EVENT) |
| 2616 | priv->dev->phydev->link = !!(status & UMAC_IRQ_LINK_UP); | ||
| 2617 | phy_mac_interrupt(priv->dev->phydev); | 2622 | phy_mac_interrupt(priv->dev->phydev); |
| 2618 | } | 2623 | |
| 2619 | } | 2624 | } |
| 2620 | 2625 | ||
| 2621 | /* bcmgenet_isr1: handle Rx and Tx priority queues */ | 2626 | /* bcmgenet_isr1: handle Rx and Tx priority queues */ |
| @@ -2710,7 +2715,7 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) · 88 unmodified lines | |||
| 2710 | } | 2715 | } |
| 2711 | 2716 | ||
| 2712 | /* all other interested interrupts handled in bottom half */ | 2717 | /* all other interested interrupts handled in bottom half */ |
| 2713 | status &= UMAC_IRQ_LINK_EVENT; | 2718 | status &= (UMAC_IRQ_LINK_EVENT | UMAC_IRQ_PHY_DET_R); |
| 2714 | if (status) { | 2719 | if (status) { |
| 2715 | /* Save irq status for bottom-half processing. */ | 2720 | /* Save irq status for bottom-half processing. */ |
| 2716 | spin_lock_irqsave(&priv->lock, flags); | 2721 | spin_lock_irqsave(&priv->lock, flags); |
| @@ -2874,6 +2879,12 @@ static int bcmgenet_open(struct net_device *dev) · 157 unmodified lines | |||
| 2874 | if (priv->internal_phy) | 2879 | if (priv->internal_phy) |
| 2875 | bcmgenet_power_up(priv, GENET_POWER_PASSIVE); | 2880 | bcmgenet_power_up(priv, GENET_POWER_PASSIVE); |
| 2876 | 2881 | ||
| 2882 | ret = bcmgenet_mii_connect(dev); | ||
| 2883 | if (ret) { | ||
| 2884 | netdev_err(dev, "failed to connect to PHY\n"); | ||
| 2885 | goto err_clk_disable; | ||
| 2886 | } | ||
| 2887 | |||
| 2877 | /* take MAC out of reset */ | 2888 | /* take MAC out of reset */ |
| 2878 | bcmgenet_umac_reset(priv); | 2889 | bcmgenet_umac_reset(priv); |
| 2879 | 2890 | ||
| @@ -2883,6 +2894,12 @@ static int bcmgenet_open(struct net_device *dev) · 3 unmodified lines | |||
| 2883 | reg = bcmgenet_umac_readl(priv, UMAC_CMD); | 2894 | reg = bcmgenet_umac_readl(priv, UMAC_CMD); |
| 2884 | priv->crc_fwd_en = !!(reg & CMD_CRC_FWD); | 2895 | priv->crc_fwd_en = !!(reg & CMD_CRC_FWD); |
| 2885 | 2896 | ||
| 2897 | ret = bcmgenet_mii_config(dev, true); | ||
| 2898 | if (ret) { | ||
| 2899 | netdev_err(dev, "unsupported PHY\n"); | ||
| 2900 | goto err_disconnect_phy; | ||
| 2901 | } | ||
| 2902 | |||
| 2886 | bcmgenet_set_hw_addr(priv, dev->dev_addr); | 2903 | bcmgenet_set_hw_addr(priv, dev->dev_addr); |
| 2887 | 2904 | ||
| 2888 | if (priv->internal_phy) { | 2905 | if (priv->internal_phy) { |
| @@ -2898,7 +2915,7 @@ static int bcmgenet_open(struct net_device *dev) · 9 unmodified lines | |||
| 2898 | ret = bcmgenet_init_dma(priv); | 2915 | ret = bcmgenet_init_dma(priv); |
| 2899 | if (ret) { | 2916 | if (ret) { |
| 2900 | netdev_err(dev, "failed to initialize DMA\n"); | 2917 | netdev_err(dev, "failed to initialize DMA\n"); |
| 2901 | goto err_clk_disable; | 2918 | goto err_disconnect_phy; |
| 2902 | } | 2919 | } |
| 2903 | 2920 | ||
| 2904 | /* Always enable ring 16 - descriptor ring */ | 2921 | /* Always enable ring 16 - descriptor ring */ |
| @@ -2921,25 +2938,19 @@ static int bcmgenet_open(struct net_device *dev) · 16 unmodified lines | |||
| 2921 | goto err_irq0; | 2938 | goto err_irq0; |
| 2922 | } | 2939 | } |
| 2923 | 2940 | ||
| 2924 | ret = bcmgenet_mii_probe(dev); | ||
| 2925 | if (ret) { | ||
| 2926 | netdev_err(dev, "failed to connect to PHY\n"); | ||
| 2927 | goto err_irq1; | ||
| 2928 | } | ||
| 2929 | |||
| 2930 | bcmgenet_netif_start(dev); | 2941 | bcmgenet_netif_start(dev); |
| 2931 | 2942 | ||
| 2932 | netif_tx_start_all_queues(dev); | 2943 | netif_tx_start_all_queues(dev); |
| 2933 | 2944 | ||
| 2934 | return 0; | 2945 | return 0; |
| 2935 | 2946 | ||
| 2936 | err_irq1: | ||
| 2937 | free_irq(priv->irq1, priv); | ||
| 2938 | err_irq0: | 2947 | err_irq0: |
| 2939 | free_irq(priv->irq0, priv); | 2948 | free_irq(priv->irq0, priv); |
| 2940 | err_fini_dma: | 2949 | err_fini_dma: |
| 2941 | bcmgenet_dma_teardown(priv); | 2950 | bcmgenet_dma_teardown(priv); |
| 2942 | bcmgenet_fini_dma(priv); | 2951 | bcmgenet_fini_dma(priv); |
| 2952 | err_disconnect_phy: | ||
| 2953 | phy_disconnect(dev->phydev); | ||
| 2943 | err_clk_disable: | 2954 | err_clk_disable: |
| 2944 | if (priv->internal_phy) | 2955 | if (priv->internal_phy) |
| 2945 | bcmgenet_power_down(priv, GENET_POWER_PASSIVE); | 2956 | bcmgenet_power_down(priv, GENET_POWER_PASSIVE); |
| @@ -3620,6 +3631,8 @@ static int bcmgenet_resume(struct device *d) · 674 unmodified lines | |||
| 3620 | if (priv->internal_phy) | 3631 | if (priv->internal_phy) |
| 3621 | bcmgenet_power_up(priv, GENET_POWER_PASSIVE); | 3632 | bcmgenet_power_up(priv, GENET_POWER_PASSIVE); |
| 3622 | 3633 | ||
| 3634 | phy_init_hw(dev->phydev); | ||
| 3635 | |||
| 3623 | bcmgenet_umac_reset(priv); | 3636 | bcmgenet_umac_reset(priv); |
| 3624 | 3637 | ||
| 3625 | init_umac(priv); | 3638 | init_umac(priv); |
| @@ -3628,8 +3641,6 @@ static int bcmgenet_resume(struct device *d) · 2 unmodified lines | |||
| 3628 | if (priv->wolopts) | 3641 | if (priv->wolopts) |
| 3629 | clk_disable_unprepare(priv->clk_wol); | 3642 | clk_disable_unprepare(priv->clk_wol); |
| 3630 | 3643 | ||
| 3631 | phy_init_hw(dev->phydev); | ||
| 3632 | |||
| 3633 | /* Speed settings must be restored */ | 3644 | /* Speed settings must be restored */ |
| 3634 | bcmgenet_mii_config(priv->dev, false); | 3645 | bcmgenet_mii_config(priv->dev, false); |
| 3635 | 3646 | ||
| @@ -366,6 +366,7 @@ struct bcmgenet_mib_counters { · 365 unmodified lines | |||
| 366 | #define EXT_PWR_DOWN_PHY_EN (1 << 20) | 366 | #define EXT_PWR_DOWN_PHY_EN (1 << 20) |
| 367 | 367 | ||
| 368 | #define EXT_RGMII_OOB_CTRL 0x0C | 368 | #define EXT_RGMII_OOB_CTRL 0x0C |
| 369 | #define RGMII_MODE_EN_V123 (1 << 0) | ||
| 369 | #define RGMII_LINK (1 << 4) | 370 | #define RGMII_LINK (1 << 4) |
| 370 | #define OOB_DISABLE (1 << 5) | 371 | #define OOB_DISABLE (1 << 5) |
| 371 | #define RGMII_MODE_EN (1 << 6) | 372 | #define RGMII_MODE_EN (1 << 6) |
| @@ -719,8 +720,8 @@ GENET_IO_MACRO(rbuf, GENET_RBUF_OFF); · 347 unmodified lines | |||
| 719 | 720 | ||
| 720 | /* MDIO routines */ | 721 | /* MDIO routines */ |
| 721 | int bcmgenet_mii_init(struct net_device *dev); | 722 | int bcmgenet_mii_init(struct net_device *dev); |
| 723 | int bcmgenet_mii_connect(struct net_device *dev); | ||
| 722 | int bcmgenet_mii_config(struct net_device *dev, bool init); | 724 | int bcmgenet_mii_config(struct net_device *dev, bool init); |
| 723 | int bcmgenet_mii_probe(struct net_device *dev); | ||
| 724 | void bcmgenet_mii_exit(struct net_device *dev); | 725 | void bcmgenet_mii_exit(struct net_device *dev); |
| 725 | void bcmgenet_phy_power_set(struct net_device *dev, bool enable); | 726 | void bcmgenet_phy_power_set(struct net_device *dev, bool enable); |
| 726 | void bcmgenet_mii_setup(struct net_device *dev); | 727 | void bcmgenet_mii_setup(struct net_device *dev); |
| @@ -173,6 +173,46 @@ static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv) · 172 unmodified lines | |||
| 173 | bcmgenet_fixed_phy_link_update); | 173 | bcmgenet_fixed_phy_link_update); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | int bcmgenet_mii_connect(struct net_device *dev) | ||
| 177 | { | ||
| 178 | struct bcmgenet_priv *priv = netdev_priv(dev); | ||
| 179 | struct device_node *dn = priv->pdev->dev.of_node; | ||
| 180 | struct phy_device *phydev; | ||
| 181 | u32 phy_flags = 0; | ||
| 182 | int ret; | ||
| 183 | |||
| 184 | /* Communicate the integrated PHY revision */ | ||
| 185 | if (priv->internal_phy) | ||
| 186 | phy_flags = priv->gphy_rev; | ||
| 187 | |||
| 188 | /* Initialize link state variables that bcmgenet_mii_setup() uses */ | ||
| 189 | priv->old_link = -1; | ||
| 190 | priv->old_speed = -1; | ||
| 191 | priv->old_duplex = -1; | ||
| 192 | priv->old_pause = -1; | ||
| 193 | |||
| 194 | if (dn) { | ||
| 195 | phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, | ||
| 196 | phy_flags, priv->phy_interface); | ||
| 197 | if (!phydev) { | ||
| 198 | pr_err("could not attach to PHY\n"); | ||
| 199 | return -ENODEV; | ||
| 200 | } | ||
| 201 | } else { | ||
| 202 | phydev = dev->phydev; | ||
| 203 | phydev->dev_flags = phy_flags; | ||
| 204 | |||
| 205 | ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup, | ||
| 206 | priv->phy_interface); | ||
| 207 | if (ret) { | ||
| 208 | pr_err("could not attach to PHY\n"); | ||
| 209 | return -ENODEV; | ||
| 210 | } | ||
| 211 | } | ||
| 212 | |||
| 213 | return 0; | ||
| 214 | } | ||
| 215 | |||
| 176 | int bcmgenet_mii_config(struct net_device *dev, bool init) | 216 | int bcmgenet_mii_config(struct net_device *dev, bool init) |
| 177 | { | 217 | { |
| 178 | struct bcmgenet_priv *priv = netdev_priv(dev); | 218 | struct bcmgenet_priv *priv = netdev_priv(dev); |
| @@ -258,74 +298,29 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) · 79 unmodified lines | |||
| 258 | */ | 298 | */ |
| 259 | if (priv->ext_phy) { | 299 | if (priv->ext_phy) { |
| 260 | reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL); | 300 | reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL); |
| 261 | reg |= RGMII_MODE_EN | id_mode_dis; | 301 | reg |= id_mode_dis; |
| 302 | if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv)) | ||
| 303 | reg |= RGMII_MODE_EN_V123; | ||
| 304 | else | ||
| 305 | reg |= RGMII_MODE_EN; | ||
| 262 | bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL); | 306 | bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL); |
| 263 | } | 307 | } |
| 264 | 308 | ||
| 265 | if (init) | 309 | if (init) { |
| 266 | dev_info(kdev, "configuring instance for %s\n", phy_name); | 310 | linkmode_copy(phydev->advertising, phydev->supported); |
| 267 | |||
| 268 | return 0; | ||
| 269 | } | ||
| 270 | |||
| 271 | int bcmgenet_mii_probe(struct net_device *dev) | ||
| 272 | { | ||
| 273 | struct bcmgenet_priv *priv = netdev_priv(dev); | ||
| 274 | struct device_node *dn = priv->pdev->dev.of_node; | ||
| 275 | struct phy_device *phydev; | ||
| 276 | u32 phy_flags; | ||
| 277 | int ret; | ||
| 278 | |||
| 279 | /* Communicate the integrated PHY revision */ | ||
| 280 | phy_flags = priv->gphy_rev; | ||
| 281 | |||
| 282 | /* Initialize link state variables that bcmgenet_mii_setup() uses */ | ||
| 283 | priv->old_link = -1; | ||
| 284 | priv->old_speed = -1; | ||
| 285 | priv->old_duplex = -1; | ||
| 286 | priv->old_pause = -1; | ||
| 287 | |||
| 288 | if (dn) { | ||
| 289 | phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, | ||
| 290 | phy_flags, priv->phy_interface); | ||
| 291 | if (!phydev) { | ||
| 292 | pr_err("could not attach to PHY\n"); | ||
| 293 | return -ENODEV; | ||
| 294 | } | ||
| 295 | } else { | ||
| 296 | phydev = dev->phydev; | ||
| 297 | phydev->dev_flags = phy_flags; | ||
| 298 | 311 | ||
| 299 | ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup, | 312 | /* The internal PHY has its link interrupts routed to the |
| 300 | priv->phy_interface); | 313 | * Ethernet MAC ISRs. On GENETv5 there is a hardware issue |
| 301 | if (ret) { | 314 | * that prevents the signaling of link UP interrupts when |
| 302 | pr_err("could not attach to PHY\n"); | 315 | * the link operates at 10Mbps, so fallback to polling for |
| 303 | return -ENODEV; | 316 | * those versions of GENET. |
| 304 | } | 317 | */ |
| 305 | } | 318 | if (priv->internal_phy && !GENET_IS_V5(priv)) |
| 319 | phydev->irq = PHY_IGNORE_INTERRUPT; | ||
| 306 | 320 | ||
| 307 | /* Configure port multiplexer based on what the probed PHY device since | 321 | dev_info(kdev, "configuring instance for %s\n", phy_name); |
| 308 | * reading the 'max-speed' property determines the maximum supported | ||
| 309 | * PHY speed which is needed for bcmgenet_mii_config() to configure | ||
| 310 | * things appropriately. | ||
| 311 | */ | ||
| 312 | ret = bcmgenet_mii_config(dev, true); | ||
| 313 | if (ret) { | ||
| 314 | phy_disconnect(dev->phydev); | ||
| 315 | return ret; | ||
| 316 | } | 322 | } |
| 317 | 323 | ||
| 318 | linkmode_copy(phydev->advertising, phydev->supported); | ||
| 319 | |||
| 320 | /* The internal PHY has its link interrupts routed to the | ||
| 321 | * Ethernet MAC ISRs. On GENETv5 there is a hardware issue | ||
| 322 | * that prevents the signaling of link UP interrupts when | ||
| 323 | * the link operates at 10Mbps, so fallback to polling for | ||
| 324 | * those versions of GENET. | ||
| 325 | */ | ||
| 326 | if (priv->internal_phy && !GENET_IS_V5(priv)) | ||
| 327 | dev->phydev->irq = PHY_IGNORE_INTERRUPT; | ||
| 328 | |||
| 329 | return 0; | 324 | return 0; |
| 330 | } | 325 | } |
| 331 | 326 | ||
| @@ -3405,17 +3405,17 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk, · 3404 unmodified lines | |||
| 3405 | return err; | 3405 | return err; |
| 3406 | } | 3406 | } |
| 3407 | 3407 | ||
| 3408 | *tx_clk = devm_clk_get(&pdev->dev, "tx_clk"); | 3408 | *tx_clk = devm_clk_get_optional(&pdev->dev, "tx_clk"); |
| 3409 | if (IS_ERR(*tx_clk)) | 3409 | if (IS_ERR(*tx_clk)) |
| 3410 | *tx_clk = NULL; | 3410 | return PTR_ERR(*tx_clk); |
| 3411 | 3411 | ||
| 3412 | *rx_clk = devm_clk_get(&pdev->dev, "rx_clk"); | 3412 | *rx_clk = devm_clk_get_optional(&pdev->dev, "rx_clk"); |
| 3413 | if (IS_ERR(*rx_clk)) | 3413 | if (IS_ERR(*rx_clk)) |
| 3414 | *rx_clk = NULL; | 3414 | return PTR_ERR(*rx_clk); |
| 3415 | 3415 | ||
| 3416 | *tsu_clk = devm_clk_get(&pdev->dev, "tsu_clk"); | 3416 | *tsu_clk = devm_clk_get_optional(&pdev->dev, "tsu_clk"); |
| 3417 | if (IS_ERR(*tsu_clk)) | 3417 | if (IS_ERR(*tsu_clk)) |
| 3418 | *tsu_clk = NULL; | 3418 | return PTR_ERR(*tsu_clk); |
| 3419 | 3419 | ||
| 3420 | err = clk_prepare_enable(*pclk); | 3420 | err = clk_prepare_enable(*pclk); |
| 3421 | if (err) { | 3421 | if (err) { |
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* cavium_ptp.h - PTP 1588 clock on Cavium hardware | 2 | /* cavium_ptp.h - PTP 1588 clock on Cavium hardware |
| 3 | * Copyright (c) 2003-2015, 2017 Cavium, Inc. | 3 | * Copyright (c) 2003-2015, 2017 Cavium, Inc. |
| 4 | */ | 4 | */ |
| @@ -1235,6 +1235,8 @@ static void dpaa2_eth_set_rx_taildrop(struct dpaa2_eth_priv *priv, bool enable) · 1234 unmodified lines | |||
| 1235 | priv->rx_td_enabled = enable; | 1235 | priv->rx_td_enabled = enable; |
| 1236 | } | 1236 | } |
| 1237 | 1237 | ||
| 1238 | static void update_tx_fqids(struct dpaa2_eth_priv *priv); | ||
| 1239 | |||
| 1238 | static int link_state_update(struct dpaa2_eth_priv *priv) | 1240 | static int link_state_update(struct dpaa2_eth_priv *priv) |
| 1239 | { | 1241 | { |
| 1240 | struct dpni_link_state state = {0}; | 1242 | struct dpni_link_state state = {0}; |
| @@ -1261,6 +1263,7 @@ static int link_state_update(struct dpaa2_eth_priv *priv) · 20 unmodified lines | |||
| 1261 | goto out; | 1263 | goto out; |
| 1262 | 1264 | ||
| 1263 | if (state.up) { | 1265 | if (state.up) { |
| 1266 | update_tx_fqids(priv); | ||
| 1264 | netif_carrier_on(priv->net_dev); | 1267 | netif_carrier_on(priv->net_dev); |
| 1265 | netif_tx_start_all_queues(priv->net_dev); | 1268 | netif_tx_start_all_queues(priv->net_dev); |
| 1266 | } else { | 1269 | } else { |
| @@ -2533,6 +2536,47 @@ static int set_pause(struct dpaa2_eth_priv *priv) · 1266 unmodified lines | |||
| 2533 | return 0; | 2536 | return 0; |
| 2534 | } | 2537 | } |
| 2535 | 2538 | ||
| 2539 | static void update_tx_fqids(struct dpaa2_eth_priv *priv) | ||
| 2540 | { | ||
| 2541 | struct dpni_queue_id qid = {0}; | ||
| 2542 | struct dpaa2_eth_fq *fq; | ||
| 2543 | struct dpni_queue queue; | ||
| 2544 | int i, j, err; | ||
| 2545 | |||
| 2546 | /* We only use Tx FQIDs for FQID-based enqueue, so check | ||
| 2547 | * if DPNI version supports it before updating FQIDs | ||
| 2548 | */ | ||
| 2549 | if (dpaa2_eth_cmp_dpni_ver(priv, DPNI_ENQUEUE_FQID_VER_MAJOR, | ||
| 2550 | DPNI_ENQUEUE_FQID_VER_MINOR) < 0) | ||
| 2551 | return; | ||
| 2552 | |||
| 2553 | for (i = 0; i < priv->num_fqs; i++) { | ||
| 2554 | fq = &priv->fq[i]; | ||
| 2555 | if (fq->type != DPAA2_TX_CONF_FQ) | ||
| 2556 | continue; | ||
| 2557 | for (j = 0; j < dpaa2_eth_tc_count(priv); j++) { | ||
| 2558 | err = dpni_get_queue(priv->mc_io, 0, priv->mc_token, | ||
| 2559 | DPNI_QUEUE_TX, j, fq->flowid, | ||
| 2560 | &queue, &qid); | ||
| 2561 | if (err) | ||
| 2562 | goto out_err; | ||
| 2563 | |||
| 2564 | fq->tx_fqid[j] = qid.fqid; | ||
| 2565 | if (fq->tx_fqid[j] == 0) | ||
| 2566 | goto out_err; | ||
| 2567 | } | ||
| 2568 | } | ||
| 2569 | |||
| 2570 | priv->enqueue = dpaa2_eth_enqueue_fq; | ||
| 2571 | |||
| 2572 | return; | ||
| 2573 | |||
| 2574 | out_err: | ||
| 2575 | netdev_info(priv->net_dev, | ||
| 2576 | "Error reading Tx FQID, fallback to QDID-based enqueue\n"); | ||
| 2577 | priv->enqueue = dpaa2_eth_enqueue_qd; | ||
| 2578 | } | ||
| 2579 | |||
| 2536 | /* Configure the DPNI object this interface is associated with */ | 2580 | /* Configure the DPNI object this interface is associated with */ |
| 2537 | static int setup_dpni(struct fsl_mc_device *ls_dev) | 2581 | static int setup_dpni(struct fsl_mc_device *ls_dev) |
| 2538 | { | 2582 | { |
| @@ -3306,6 +3350,9 @@ static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg) · 767 unmodified lines | |||
| 3306 | if (status & DPNI_IRQ_EVENT_LINK_CHANGED) | 3350 | if (status & DPNI_IRQ_EVENT_LINK_CHANGED) |
| 3307 | link_state_update(netdev_priv(net_dev)); | 3351 | link_state_update(netdev_priv(net_dev)); |
| 3308 | 3352 | ||
| 3353 | if (status & DPNI_IRQ_EVENT_ENDPOINT_CHANGED) | ||
| 3354 | set_mac_addr(netdev_priv(net_dev)); | ||
| 3355 | |||
| 3309 | return IRQ_HANDLED; | 3356 | return IRQ_HANDLED; |
| 3310 | } | 3357 | } |
| 3311 | 3358 | ||
| @@ -3331,7 +3378,8 @@ static int setup_irqs(struct fsl_mc_device *ls_dev) · 19 unmodified lines | |||
| 3331 | } | 3378 | } |
| 3332 | 3379 | ||
| 3333 | err = dpni_set_irq_mask(ls_dev->mc_io, 0, ls_dev->mc_handle, | 3380 | err = dpni_set_irq_mask(ls_dev->mc_io, 0, ls_dev->mc_handle, |
| 3334 | DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED); | 3381 | DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED | |
| 3382 | DPNI_IRQ_EVENT_ENDPOINT_CHANGED); | ||
| 3335 | if (err < 0) { | 3383 | if (err < 0) { |
| 3336 | dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d\n", err); | 3384 | dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d\n", err); |
| 3337 | goto free_irq; | 3385 | goto free_irq; |
| @@ -133,9 +133,12 @@ int dpni_reset(struct fsl_mc_io *mc_io, · 132 unmodified lines | |||
| 133 | */ | 133 | */ |
| 134 | #define DPNI_IRQ_INDEX 0 | 134 | #define DPNI_IRQ_INDEX 0 |
| 135 | /** | 135 | /** |
| 136 | * IRQ event - indicates a change in link state | 136 | * IRQ events: |
| 137 | * indicates a change in link state | ||
| 138 | * indicates a change in endpoint | ||
| 137 | */ | 139 | */ |
| 138 | #define DPNI_IRQ_EVENT_LINK_CHANGED 0x00000001 | 140 | #define DPNI_IRQ_EVENT_LINK_CHANGED 0x00000001 |
| 141 | #define DPNI_IRQ_EVENT_ENDPOINT_CHANGED 0x00000002 | ||
| 139 | 142 | ||
| 140 | int dpni_set_irq_enable(struct fsl_mc_io *mc_io, | 143 | int dpni_set_irq_enable(struct fsl_mc_io *mc_io, |
| 141 | u32 cmd_flags, | 144 | u32 cmd_flags, |
| @@ -32,6 +32,8 @@ · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | #define HNAE3_MOD_VERSION "1.0" | 33 | #define HNAE3_MOD_VERSION "1.0" |
| 34 | 34 | ||
| 35 | #define HNAE3_MIN_VECTOR_NUM 2 /* first one for misc, another for IO */ | ||
| 36 | |||
| 35 | /* Device IDs */ | 37 | /* Device IDs */ |
| 36 | #define HNAE3_DEV_ID_GE 0xA220 | 38 | #define HNAE3_DEV_ID_GE 0xA220 |
| 37 | #define HNAE3_DEV_ID_25GE 0xA221 | 39 | #define HNAE3_DEV_ID_25GE 0xA221 |
| @@ -906,6 +906,9 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev) · 905 unmodified lines | |||
| 906 | hnae3_get_field(__le16_to_cpu(req->pf_intr_vector_number), | 906 | hnae3_get_field(__le16_to_cpu(req->pf_intr_vector_number), |
| 907 | HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S); | 907 | HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S); |
| 908 | 908 | ||
| 909 | /* nic's msix numbers is always equals to the roce's. */ | ||
| 910 | hdev->num_nic_msi = hdev->num_roce_msi; | ||
| 911 | |||
| 909 | /* PF should have NIC vectors and Roce vectors, | 912 | /* PF should have NIC vectors and Roce vectors, |
| 910 | * NIC vectors are queued before Roce vectors. | 913 | * NIC vectors are queued before Roce vectors. |
| 911 | */ | 914 | */ |
| @@ -915,6 +918,15 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev) · 3 unmodified lines | |||
| 915 | hdev->num_msi = | 918 | hdev->num_msi = |
| 916 | hnae3_get_field(__le16_to_cpu(req->pf_intr_vector_number), | 919 | hnae3_get_field(__le16_to_cpu(req->pf_intr_vector_number), |
| 917 | HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S); | 920 | HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S); |
| 921 | |||
| 922 | hdev->num_nic_msi = hdev->num_msi; | ||
| 923 | } | ||
| 924 | |||
| 925 | if (hdev->num_nic_msi < HNAE3_MIN_VECTOR_NUM) { | ||
| 926 | dev_err(&hdev->pdev->dev, | ||
| 927 | "Just %u msi resources, not enough for pf(min:2).\n", | ||
| 928 | hdev->num_nic_msi); | ||
| 929 | return -EINVAL; | ||
| 918 | } | 930 | } |
| 919 | 931 | ||
| 920 | return 0; | 932 | return 0; |
| @@ -1507,6 +1519,10 @@ static int hclge_assign_tqp(struct hclge_vport *vport, u16 num_tqps) · 586 unmodified lines | |||
| 1507 | kinfo->rss_size = min_t(u16, hdev->rss_size_max, | 1519 | kinfo->rss_size = min_t(u16, hdev->rss_size_max, |
| 1508 | vport->alloc_tqps / hdev->tm_info.num_tc); | 1520 | vport->alloc_tqps / hdev->tm_info.num_tc); |
| 1509 | 1521 | ||
| 1522 | /* ensure one to one mapping between irq and queue at default */ | ||
| 1523 | kinfo->rss_size = min_t(u16, kinfo->rss_size, | ||
| 1524 | (hdev->num_nic_msi - 1) / hdev->tm_info.num_tc); | ||
| 1525 | |||
| 1510 | return 0; | 1526 | return 0; |
| 1511 | } | 1527 | } |
| 1512 | 1528 | ||
| @@ -2285,7 +2301,8 @@ static int hclge_init_msi(struct hclge_dev *hdev) · 772 unmodified lines | |||
| 2285 | int vectors; | 2301 | int vectors; |
| 2286 | int i; | 2302 | int i; |
| 2287 | 2303 | ||
| 2288 | vectors = pci_alloc_irq_vectors(pdev, 1, hdev->num_msi, | 2304 | vectors = pci_alloc_irq_vectors(pdev, HNAE3_MIN_VECTOR_NUM, |
| 2305 | hdev->num_msi, | ||
| 2289 | PCI_IRQ_MSI | PCI_IRQ_MSIX); | 2306 | PCI_IRQ_MSI | PCI_IRQ_MSIX); |
| 2290 | if (vectors < 0) { | 2307 | if (vectors < 0) { |
| 2291 | dev_err(&pdev->dev, | 2308 | dev_err(&pdev->dev, |
| @@ -2300,6 +2317,7 @@ static int hclge_init_msi(struct hclge_dev *hdev) · 8 unmodified lines | |||
| 2300 | 2317 | ||
| 2301 | hdev->num_msi = vectors; | 2318 | hdev->num_msi = vectors; |
| 2302 | hdev->num_msi_left = vectors; | 2319 | hdev->num_msi_left = vectors; |
| 2320 | |||
| 2303 | hdev->base_msi_vector = pdev->irq; | 2321 | hdev->base_msi_vector = pdev->irq; |
| 2304 | hdev->roce_base_vector = hdev->base_msi_vector + | 2322 | hdev->roce_base_vector = hdev->base_msi_vector + |
| 2305 | hdev->roce_base_msix_offset; | 2323 | hdev->roce_base_msix_offset; |
| @@ -3903,6 +3921,7 @@ static int hclge_get_vector(struct hnae3_handle *handle, u16 vector_num, · 1597 unmodified lines | |||
| 3903 | int alloc = 0; | 3921 | int alloc = 0; |
| 3904 | int i, j; | 3922 | int i, j; |
| 3905 | 3923 | ||
| 3924 | vector_num = min_t(u16, hdev->num_nic_msi - 1, vector_num); | ||
| 3906 | vector_num = min(hdev->num_msi_left, vector_num); | 3925 | vector_num = min(hdev->num_msi_left, vector_num); |
| 3907 | 3926 | ||
| 3908 | for (j = 0; j < vector_num; j++) { | 3927 | for (j = 0; j < vector_num; j++) { |
| @@ -763,6 +763,7 @@ struct hclge_dev { · 762 unmodified lines | |||
| 763 | u32 base_msi_vector; | 763 | u32 base_msi_vector; |
| 764 | u16 *vector_status; | 764 | u16 *vector_status; |
| 765 | int *vector_irq; | 765 | int *vector_irq; |
| 766 | u16 num_nic_msi; /* Num of nic vectors for this PF */ | ||
| 766 | u16 num_roce_msi; /* Num of roce vectors for this PF */ | 767 | u16 num_roce_msi; /* Num of roce vectors for this PF */ |
| 767 | int roce_base_vector; | 768 | int roce_base_vector; |
| 768 | 769 | ||
| @@ -537,9 +537,16 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport) · 536 unmodified lines | |||
| 537 | kinfo->rss_size = kinfo->req_rss_size; | 537 | kinfo->rss_size = kinfo->req_rss_size; |
| 538 | } else if (kinfo->rss_size > max_rss_size || | 538 | } else if (kinfo->rss_size > max_rss_size || |
| 539 | (!kinfo->req_rss_size && kinfo->rss_size < max_rss_size)) { | 539 | (!kinfo->req_rss_size && kinfo->rss_size < max_rss_size)) { |
| 540 | /* if user not set rss, the rss_size should compare with the | ||
| 541 | * valid msi numbers to ensure one to one map between tqp and | ||
| 542 | * irq as default. | ||
| 543 | */ | ||
| 544 | if (!kinfo->req_rss_size) | ||
| 545 | max_rss_size = min_t(u16, max_rss_size, | ||
| 546 | (hdev->num_nic_msi - 1) / | ||
| 547 | kinfo->num_tc); | ||
| 548 | |||
| 540 | /* Set to the maximum specification value (max_rss_size). */ | 549 | /* Set to the maximum specification value (max_rss_size). */ |
| 541 | dev_info(&hdev->pdev->dev, "rss changes from %d to %d\n", | ||
| 542 | kinfo->rss_size, max_rss_size); | ||
| 543 | kinfo->rss_size = max_rss_size; | 550 | kinfo->rss_size = max_rss_size; |
| 544 | } | 551 | } |
| 545 | 552 | ||
| @@ -411,6 +411,13 @@ static int hclgevf_knic_setup(struct hclgevf_dev *hdev) · 410 unmodified lines | |||
| 411 | kinfo->tqp[i] = &hdev->htqp[i].q; | 411 | kinfo->tqp[i] = &hdev->htqp[i].q; |
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | /* after init the max rss_size and tqps, adjust the default tqp numbers | ||
| 415 | * and rss size with the actual vector numbers | ||
| 416 | */ | ||
| 417 | kinfo->num_tqps = min_t(u16, hdev->num_nic_msix - 1, kinfo->num_tqps); | ||
| 418 | kinfo->rss_size = min_t(u16, kinfo->num_tqps / kinfo->num_tc, | ||
| 419 | kinfo->rss_size); | ||
| 420 | |||
| 414 | return 0; | 421 | return 0; |
| 415 | } | 422 | } |
| 416 | 423 | ||
| @@ -502,6 +509,7 @@ static int hclgevf_get_vector(struct hnae3_handle *handle, u16 vector_num, · 85 unmodified lines | |||
| 502 | int alloc = 0; | 509 | int alloc = 0; |
| 503 | int i, j; | 510 | int i, j; |
| 504 | 511 | ||
| 512 | vector_num = min_t(u16, hdev->num_nic_msix - 1, vector_num); | ||
| 505 | vector_num = min(hdev->num_msi_left, vector_num); | 513 | vector_num = min(hdev->num_msi_left, vector_num); |
| 506 | 514 | ||
| 507 | for (j = 0; j < vector_num; j++) { | 515 | for (j = 0; j < vector_num; j++) { |
| @@ -2246,13 +2254,14 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev) · 1738 unmodified lines | |||
| 2246 | int vectors; | 2254 | int vectors; |
| 2247 | int i; | 2255 | int i; |
| 2248 | 2256 | ||
| 2249 | if (hnae3_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B)) | 2257 | if (hnae3_dev_roce_supported(hdev)) |
| 2250 | vectors = pci_alloc_irq_vectors(pdev, | 2258 | vectors = pci_alloc_irq_vectors(pdev, |
| 2251 | hdev->roce_base_msix_offset + 1, | 2259 | hdev->roce_base_msix_offset + 1, |
| 2252 | hdev->num_msi, | 2260 | hdev->num_msi, |
| 2253 | PCI_IRQ_MSIX); | 2261 | PCI_IRQ_MSIX); |
| 2254 | else | 2262 | else |
| 2255 | vectors = pci_alloc_irq_vectors(pdev, 1, hdev->num_msi, | 2263 | vectors = pci_alloc_irq_vectors(pdev, HNAE3_MIN_VECTOR_NUM, |
| 2264 | hdev->num_msi, | ||
| 2256 | PCI_IRQ_MSI | PCI_IRQ_MSIX); | 2265 | PCI_IRQ_MSI | PCI_IRQ_MSIX); |
| 2257 | 2266 | ||
| 2258 | if (vectors < 0) { | 2267 | if (vectors < 0) { |
| @@ -2268,6 +2277,7 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev) · 9 unmodified lines | |||
| 2268 | 2277 | ||
| 2269 | hdev->num_msi = vectors; | 2278 | hdev->num_msi = vectors; |
| 2270 | hdev->num_msi_left = vectors; | 2279 | hdev->num_msi_left = vectors; |
| 2280 | |||
| 2271 | hdev->base_msi_vector = pdev->irq; | 2281 | hdev->base_msi_vector = pdev->irq; |
| 2272 | hdev->roce_base_vector = pdev->irq + hdev->roce_base_msix_offset; | 2282 | hdev->roce_base_vector = pdev->irq + hdev->roce_base_msix_offset; |
| 2273 | 2283 | ||
| @@ -2533,7 +2543,7 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev) · 259 unmodified lines | |||
| 2533 | 2543 | ||
| 2534 | req = (struct hclgevf_query_res_cmd *)desc.data; | 2544 | req = (struct hclgevf_query_res_cmd *)desc.data; |
| 2535 | 2545 | ||
| 2536 | if (hnae3_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B)) { | 2546 | if (hnae3_dev_roce_supported(hdev)) { |
| 2537 | hdev->roce_base_msix_offset = | 2547 | hdev->roce_base_msix_offset = |
| 2538 | hnae3_get_field(__le16_to_cpu(req->msixcap_localid_ba_rocee), | 2548 | hnae3_get_field(__le16_to_cpu(req->msixcap_localid_ba_rocee), |
| 2539 | HCLGEVF_MSIX_OFT_ROCEE_M, | 2549 | HCLGEVF_MSIX_OFT_ROCEE_M, |
| @@ -2542,6 +2552,9 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev) · 2 unmodified lines | |||
| 2542 | hnae3_get_field(__le16_to_cpu(req->vf_intr_vector_number), | 2552 | hnae3_get_field(__le16_to_cpu(req->vf_intr_vector_number), |
| 2543 | HCLGEVF_VEC_NUM_M, HCLGEVF_VEC_NUM_S); | 2553 | HCLGEVF_VEC_NUM_M, HCLGEVF_VEC_NUM_S); |
| 2544 | 2554 | ||
| 2555 | /* nic's msix numbers is always equals to the roce's. */ | ||
| 2556 | hdev->num_nic_msix = hdev->num_roce_msix; | ||
| 2557 | |||
| 2545 | /* VF should have NIC vectors and Roce vectors, NIC vectors | 2558 | /* VF should have NIC vectors and Roce vectors, NIC vectors |
| 2546 | * are queued before Roce vectors. The offset is fixed to 64. | 2559 | * are queued before Roce vectors. The offset is fixed to 64. |
| 2547 | */ | 2560 | */ |
| @@ -2551,6 +2564,15 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev) · 3 unmodified lines | |||
| 2551 | hdev->num_msi = | 2564 | hdev->num_msi = |
| 2552 | hnae3_get_field(__le16_to_cpu(req->vf_intr_vector_number), | 2565 | hnae3_get_field(__le16_to_cpu(req->vf_intr_vector_number), |
| 2553 | HCLGEVF_VEC_NUM_M, HCLGEVF_VEC_NUM_S); | 2566 | HCLGEVF_VEC_NUM_M, HCLGEVF_VEC_NUM_S); |
| 2567 | |||
| 2568 | hdev->num_nic_msix = hdev->num_msi; | ||
| 2569 | } | ||
| 2570 | |||
| 2571 | if (hdev->num_nic_msix < HNAE3_MIN_VECTOR_NUM) { | ||
| 2572 | dev_err(&hdev->pdev->dev, | ||
| 2573 | "Just %u msi resources, not enough for vf(min:2).\n", | ||
| 2574 | hdev->num_nic_msix); | ||
| 2575 | return -EINVAL; | ||
| 2554 | } | 2576 | } |
| 2555 | 2577 | ||
| 2556 | return 0; | 2578 | return 0; |
| @@ -270,6 +270,7 @@ struct hclgevf_dev { · 269 unmodified lines | |||
| 270 | u16 num_msi; | 270 | u16 num_msi; |
| 271 | u16 num_msi_left; | 271 | u16 num_msi_left; |
| 272 | u16 num_msi_used; | 272 | u16 num_msi_used; |
| 273 | u16 num_nic_msix; /* Num of nic vectors for this VF */ | ||
| 273 | u16 num_roce_msix; /* Num of roce vectors for this VF */ | 274 | u16 num_roce_msix; /* Num of roce vectors for this VF */ |
| 274 | u16 roce_base_msix_offset; | 275 | u16 roce_base_msix_offset; |
| 275 | int roce_base_vector; | 276 | int roce_base_vector; |
| @@ -96,6 +96,8 @@ · 95 unmodified lines | |||
| 96 | 96 | ||
| 97 | #define OPT_SWAP_PORT 0x0001 /* Need to wordswp on the MPU port */ | 97 | #define OPT_SWAP_PORT 0x0001 /* Need to wordswp on the MPU port */ |
| 98 | 98 | ||
| 99 | #define LIB82596_DMA_ATTR DMA_ATTR_NON_CONSISTENT | ||
| 100 | |||
| 99 | #define DMA_WBACK(ndev, addr, len) \ | 101 | #define DMA_WBACK(ndev, addr, len) \ |
| 100 | do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0) | 102 | do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0) |
| 101 | 103 | ||
| @@ -200,7 +202,7 @@ static int __exit lan_remove_chip(struct parisc_device *pdev) · 98 unmodified lines | |||
| 200 | 202 | ||
| 201 | unregister_netdev (dev); | 203 | unregister_netdev (dev); |
| 202 | dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma, | 204 | dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma, |
| 203 | lp->dma_addr, DMA_ATTR_NON_CONSISTENT); | 205 | lp->dma_addr, LIB82596_DMA_ATTR); |
| 204 | free_netdev (dev); | 206 | free_netdev (dev); |
| 205 | return 0; | 207 | return 0; |
| 206 | } | 208 | } |
| @@ -1065,7 +1065,7 @@ static int i82596_probe(struct net_device *dev) · 1064 unmodified lines | |||
| 1065 | 1065 | ||
| 1066 | dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma), | 1066 | dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma), |
| 1067 | &lp->dma_addr, GFP_KERNEL, | 1067 | &lp->dma_addr, GFP_KERNEL, |
| 1068 | DMA_ATTR_NON_CONSISTENT); | 1068 | LIB82596_DMA_ATTR); |
| 1069 | if (!dma) { | 1069 | if (!dma) { |
| 1070 | printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__); | 1070 | printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__); |
| 1071 | return -ENOMEM; | 1071 | return -ENOMEM; |
| @@ -1087,7 +1087,7 @@ static int i82596_probe(struct net_device *dev) · 15 unmodified lines | |||
| 1087 | i = register_netdev(dev); | 1087 | i = register_netdev(dev); |
| 1088 | if (i) { | 1088 | if (i) { |
| 1089 | dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma), | 1089 | dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma), |
| 1090 | dma, lp->dma_addr, DMA_ATTR_NON_CONSISTENT); | 1090 | dma, lp->dma_addr, LIB82596_DMA_ATTR); |
| 1091 | return i; | 1091 | return i; |
| 1092 | } | 1092 | } |
| 1093 | 1093 | ||
| @@ -24,6 +24,8 @@ · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | static const char sni_82596_string[] = "snirm_82596"; | 25 | static const char sni_82596_string[] = "snirm_82596"; |
| 26 | 26 | ||
| 27 | #define LIB82596_DMA_ATTR 0 | ||
| 28 | |||
| 27 | #define DMA_WBACK(priv, addr, len) do { } while (0) | 29 | #define DMA_WBACK(priv, addr, len) do { } while (0) |
| 28 | #define DMA_INV(priv, addr, len) do { } while (0) | 30 | #define DMA_INV(priv, addr, len) do { } while (0) |
| 29 | #define DMA_WBACK_INV(priv, addr, len) do { } while (0) | 31 | #define DMA_WBACK_INV(priv, addr, len) do { } while (0) |
| @@ -152,7 +154,7 @@ static int sni_82596_driver_remove(struct platform_device *pdev) · 122 unmodified lines | |||
| 152 | 154 | ||
| 153 | unregister_netdev(dev); | 155 | unregister_netdev(dev); |
| 154 | dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma, | 156 | dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma, |
| 155 | lp->dma_addr, DMA_ATTR_NON_CONSISTENT); | 157 | lp->dma_addr, LIB82596_DMA_ATTR); |
| 156 | iounmap(lp->ca); | 158 | iounmap(lp->ca); |
| 157 | iounmap(lp->mpu_port); | 159 | iounmap(lp->mpu_port); |
| 158 | free_netdev (dev); | 160 | free_netdev (dev); |
| @@ -2878,12 +2878,10 @@ static int enable_scrq_irq(struct ibmvnic_adapter *adapter, · 2877 unmodified lines | |||
| 2878 | 2878 | ||
| 2879 | if (test_bit(0, &adapter->resetting) && | 2879 | if (test_bit(0, &adapter->resetting) && |
| 2880 | adapter->reset_reason == VNIC_RESET_MOBILITY) { | 2880 | adapter->reset_reason == VNIC_RESET_MOBILITY) { |
| 2881 | u64 val = (0xff000000) | scrq->hw_irq; | 2881 | struct irq_desc *desc = irq_to_desc(scrq->irq); |
| 2882 | struct irq_chip *chip = irq_desc_get_chip(desc); | ||
| 2882 | 2883 | ||
| 2883 | rc = plpar_hcall_norets(H_EOI, val); | 2884 | chip->irq_eoi(&desc->irq_data); |
| 2884 | if (rc) | ||
| 2885 | dev_err(dev, "H_EOI FAILED irq 0x%llx. rc=%ld\n", | ||
| 2886 | val, rc); | ||
| 2887 | } | 2885 | } |
| 2888 | 2886 | ||
| 2889 | rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address, | 2887 | rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address, |
| @@ -261,6 +261,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, · 260 unmodified lines | |||
| 261 | ge_mode = 0; | 261 | ge_mode = 0; |
| 262 | switch (state->interface) { | 262 | switch (state->interface) { |
| 263 | case PHY_INTERFACE_MODE_MII: | 263 | case PHY_INTERFACE_MODE_MII: |
| 264 | case PHY_INTERFACE_MODE_GMII: | ||
| 264 | ge_mode = 1; | 265 | ge_mode = 1; |
| 265 | break; | 266 | break; |
| 266 | case PHY_INTERFACE_MODE_REVMII: | 267 | case PHY_INTERFACE_MODE_REVMII: |
| @@ -788,12 +788,10 @@ again: · 787 unmodified lines | |||
| 788 | * it means that all the previous stes are the same, | 788 | * it means that all the previous stes are the same, |
| 789 | * if so, this rule is duplicated. | 789 | * if so, this rule is duplicated. |
| 790 | */ | 790 | */ |
| 791 | if (mlx5dr_ste_is_last_in_rule(nic_matcher, | 791 | if (!mlx5dr_ste_is_last_in_rule(nic_matcher, ste_location)) |
| 792 | matched_ste->ste_chain_location)) { | 792 | return matched_ste; |
| 793 | mlx5dr_info(dmn, "Duplicate rule inserted, aborting!!\n"); | 793 | |
| 794 | return NULL; | 794 | mlx5dr_dbg(dmn, "Duplicate rule inserted\n"); |
| 795 | } | ||
| 796 | return matched_ste; | ||
| 797 | } | 795 | } |
| 798 | 796 | ||
| 799 | if (!skip_rehash && dr_rule_need_enlarge_hash(cur_htbl, dmn, nic_dmn)) { | 797 | if (!skip_rehash && dr_rule_need_enlarge_hash(cur_htbl, dmn, nic_dmn)) { |
| @@ -99,6 +99,7 @@ static void mlxsw_sp_rx_drop_listener(struct sk_buff *skb, u8 local_port, · 98 unmodified lines | |||
| 99 | devlink = priv_to_devlink(mlxsw_sp->core); | 99 | devlink = priv_to_devlink(mlxsw_sp->core); |
| 100 | in_devlink_port = mlxsw_core_port_devlink_port_get(mlxsw_sp->core, | 100 | in_devlink_port = mlxsw_core_port_devlink_port_get(mlxsw_sp->core, |
| 101 | local_port); | 101 | local_port); |
| 102 | skb_push(skb, ETH_HLEN); | ||
| 102 | devlink_trap_report(devlink, skb, trap_ctx, in_devlink_port); | 103 | devlink_trap_report(devlink, skb, trap_ctx, in_devlink_port); |
| 103 | consume_skb(skb); | 104 | consume_skb(skb); |
| 104 | } | 105 | } |
| @@ -1356,9 +1356,6 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) · 1355 unmodified lines | |||
| 1356 | if (!is_valid_ether_addr(ndev->dev_addr)) | 1356 | if (!is_valid_ether_addr(ndev->dev_addr)) |
| 1357 | eth_hw_addr_random(ndev); | 1357 | eth_hw_addr_random(ndev); |
| 1358 | 1358 | ||
| 1359 | /* Reset the ethernet controller */ | ||
| 1360 | __lpc_eth_reset(pldat); | ||
| 1361 | |||
| 1362 | /* then shut everything down to save power */ | 1359 | /* then shut everything down to save power */ |
| 1363 | __lpc_eth_shutdown(pldat); | 1360 | __lpc_eth_shutdown(pldat); |
| 1364 | 1361 | ||
| @@ -182,6 +182,8 @@ struct ionic_lif { · 181 unmodified lines | |||
| 182 | 182 | ||
| 183 | #define lif_to_txqcq(lif, i) ((lif)->txqcqs[i].qcq) | 183 | #define lif_to_txqcq(lif, i) ((lif)->txqcqs[i].qcq) |
| 184 | #define lif_to_rxqcq(lif, i) ((lif)->rxqcqs[i].qcq) | 184 | #define lif_to_rxqcq(lif, i) ((lif)->rxqcqs[i].qcq) |
| 185 | #define lif_to_txstats(lif, i) ((lif)->txqcqs[i].stats->tx) | ||
| 186 | #define lif_to_rxstats(lif, i) ((lif)->rxqcqs[i].stats->rx) | ||
| 185 | #define lif_to_txq(lif, i) (&lif_to_txqcq((lif), i)->q) | 187 | #define lif_to_txq(lif, i) (&lif_to_txqcq((lif), i)->q) |
| 186 | #define lif_to_rxq(lif, i) (&lif_to_txqcq((lif), i)->q) | 188 | #define lif_to_rxq(lif, i) (&lif_to_txqcq((lif), i)->q) |
| 187 | 189 | ||
| @@ -117,7 +117,8 @@ static u64 ionic_sw_stats_get_count(struct ionic_lif *lif) · 116 unmodified lines | |||
| 117 | /* rx stats */ | 117 | /* rx stats */ |
| 118 | total += MAX_Q(lif) * IONIC_NUM_RX_STATS; | 118 | total += MAX_Q(lif) * IONIC_NUM_RX_STATS; |
| 119 | 119 | ||
| 120 | if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | 120 | if (test_bit(IONIC_LIF_UP, lif->state) && |
| 121 | test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | ||
| 121 | /* tx debug stats */ | 122 | /* tx debug stats */ |
| 122 | total += MAX_Q(lif) * (IONIC_NUM_DBG_CQ_STATS + | 123 | total += MAX_Q(lif) * (IONIC_NUM_DBG_CQ_STATS + |
| 123 | IONIC_NUM_TX_Q_STATS + | 124 | IONIC_NUM_TX_Q_STATS + |
| @@ -149,7 +150,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf) · 25 unmodified lines | |||
| 149 | *buf += ETH_GSTRING_LEN; | 150 | *buf += ETH_GSTRING_LEN; |
| 150 | } | 151 | } |
| 151 | 152 | ||
| 152 | if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | 153 | if (test_bit(IONIC_LIF_UP, lif->state) && |
| 154 | test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | ||
| 153 | for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) { | 155 | for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) { |
| 154 | snprintf(*buf, ETH_GSTRING_LEN, | 156 | snprintf(*buf, ETH_GSTRING_LEN, |
| 155 | "txq_%d_%s", | 157 | "txq_%d_%s", |
| @@ -187,7 +189,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf) · 31 unmodified lines | |||
| 187 | *buf += ETH_GSTRING_LEN; | 189 | *buf += ETH_GSTRING_LEN; |
| 188 | } | 190 | } |
| 189 | 191 | ||
| 190 | if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | 192 | if (test_bit(IONIC_LIF_UP, lif->state) && |
| 193 | test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | ||
| 191 | for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) { | 194 | for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) { |
| 192 | snprintf(*buf, ETH_GSTRING_LEN, | 195 | snprintf(*buf, ETH_GSTRING_LEN, |
| 193 | "rxq_%d_cq_%s", | 196 | "rxq_%d_cq_%s", |
| @@ -223,6 +226,8 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf) · 29 unmodified lines | |||
| 223 | { | 226 | { |
| 224 | struct ionic_lif_sw_stats lif_stats; | 227 | struct ionic_lif_sw_stats lif_stats; |
| 225 | struct ionic_qcq *txqcq, *rxqcq; | 228 | struct ionic_qcq *txqcq, *rxqcq; |
| 229 | struct ionic_tx_stats *txstats; | ||
| 230 | struct ionic_rx_stats *rxstats; | ||
| 226 | int i, q_num; | 231 | int i, q_num; |
| 227 | 232 | ||
| 228 | ionic_get_lif_stats(lif, &lif_stats); | 233 | ionic_get_lif_stats(lif, &lif_stats); |
| @@ -233,15 +238,17 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf) · 4 unmodified lines | |||
| 233 | } | 238 | } |
| 234 | 239 | ||
| 235 | for (q_num = 0; q_num < MAX_Q(lif); q_num++) { | 240 | for (q_num = 0; q_num < MAX_Q(lif); q_num++) { |
| 236 | txqcq = lif_to_txqcq(lif, q_num); | 241 | txstats = &lif_to_txstats(lif, q_num); |
| 237 | 242 | ||
| 238 | for (i = 0; i < IONIC_NUM_TX_STATS; i++) { | 243 | for (i = 0; i < IONIC_NUM_TX_STATS; i++) { |
| 239 | **buf = IONIC_READ_STAT64(&txqcq->stats->tx, | 244 | **buf = IONIC_READ_STAT64(txstats, |
| 240 | &ionic_tx_stats_desc[i]); | 245 | &ionic_tx_stats_desc[i]); |
| 241 | (*buf)++; | 246 | (*buf)++; |
| 242 | } | 247 | } |
| 243 | 248 | ||
| 244 | if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | 249 | if (test_bit(IONIC_LIF_UP, lif->state) && |
| 250 | test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | ||
| 251 | txqcq = lif_to_txqcq(lif, q_num); | ||
| 245 | for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) { | 252 | for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) { |
| 246 | **buf = IONIC_READ_STAT64(&txqcq->q, | 253 | **buf = IONIC_READ_STAT64(&txqcq->q, |
| 247 | &ionic_txq_stats_desc[i]); | 254 | &ionic_txq_stats_desc[i]); |
| @@ -258,22 +265,24 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf) · 10 unmodified lines | |||
| 258 | (*buf)++; | 265 | (*buf)++; |
| 259 | } | 266 | } |
| 260 | for (i = 0; i < IONIC_MAX_NUM_SG_CNTR; i++) { | 267 | for (i = 0; i < IONIC_MAX_NUM_SG_CNTR; i++) { |
| 261 | **buf = txqcq->stats->tx.sg_cntr[i]; | 268 | **buf = txstats->sg_cntr[i]; |
| 262 | (*buf)++; | 269 | (*buf)++; |
| 263 | } | 270 | } |
| 264 | } | 271 | } |
| 265 | } | 272 | } |
| 266 | 273 | ||
| 267 | for (q_num = 0; q_num < MAX_Q(lif); q_num++) { | 274 | for (q_num = 0; q_num < MAX_Q(lif); q_num++) { |
| 268 | rxqcq = lif_to_rxqcq(lif, q_num); | 275 | rxstats = &lif_to_rxstats(lif, q_num); |
| 269 | 276 | ||
| 270 | for (i = 0; i < IONIC_NUM_RX_STATS; i++) { | 277 | for (i = 0; i < IONIC_NUM_RX_STATS; i++) { |
| 271 | **buf = IONIC_READ_STAT64(&rxqcq->stats->rx, | 278 | **buf = IONIC_READ_STAT64(rxstats, |
| 272 | &ionic_rx_stats_desc[i]); | 279 | &ionic_rx_stats_desc[i]); |
| 273 | (*buf)++; | 280 | (*buf)++; |
| 274 | } | 281 | } |
| 275 | 282 | ||
| 276 | if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | 283 | if (test_bit(IONIC_LIF_UP, lif->state) && |
| 284 | test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) { | ||
| 285 | rxqcq = lif_to_rxqcq(lif, q_num); | ||
| 277 | for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) { | 286 | for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) { |
| 278 | **buf = IONIC_READ_STAT64(&rxqcq->cq, | 287 | **buf = IONIC_READ_STAT64(&rxqcq->cq, |
| 279 | &ionic_dbg_cq_stats_desc[i]); | 288 | &ionic_dbg_cq_stats_desc[i]); |
| @@ -4146,6 +4146,14 @@ static void rtl_hw_jumbo_disable(struct rtl8169_private *tp) · 4145 unmodified lines | |||
| 4146 | rtl_lock_config_regs(tp); | 4146 | rtl_lock_config_regs(tp); |
| 4147 | } | 4147 | } |
| 4148 | 4148 | ||
| 4149 | static void rtl_jumbo_config(struct rtl8169_private *tp, int mtu) | ||
| 4150 | { | ||
| 4151 | if (mtu > ETH_DATA_LEN) | ||
| 4152 | rtl_hw_jumbo_enable(tp); | ||
| 4153 | else | ||
| 4154 | rtl_hw_jumbo_disable(tp); | ||
| 4155 | } | ||
| 4156 | |||
| 4149 | DECLARE_RTL_COND(rtl_chipcmd_cond) | 4157 | DECLARE_RTL_COND(rtl_chipcmd_cond) |
| 4150 | { | 4158 | { |
| 4151 | return RTL_R8(tp, ChipCmd) & CmdReset; | 4159 | return RTL_R8(tp, ChipCmd) & CmdReset; |
| @@ -4442,11 +4450,6 @@ static void rtl8168g_set_pause_thresholds(struct rtl8169_private *tp, · 290 unmodified lines | |||
| 4442 | static void rtl_hw_start_8168bb(struct rtl8169_private *tp) | 4450 | static void rtl_hw_start_8168bb(struct rtl8169_private *tp) |
| 4443 | { | 4451 | { |
| 4444 | RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en); | 4452 | RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en); |
| 4445 | |||
| 4446 | if (tp->dev->mtu <= ETH_DATA_LEN) { | ||
| 4447 | rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B | | ||
| 4448 | PCI_EXP_DEVCTL_NOSNOOP_EN); | ||
| 4449 | } | ||
| 4450 | } | 4453 | } |
| 4451 | 4454 | ||
| 4452 | static void rtl_hw_start_8168bef(struct rtl8169_private *tp) | 4455 | static void rtl_hw_start_8168bef(struct rtl8169_private *tp) |
| @@ -4462,9 +4465,6 @@ static void __rtl_hw_start_8168cp(struct rtl8169_private *tp) · 9 unmodified lines | |||
| 4462 | 4465 | ||
| 4463 | RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en); | 4466 | RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en); |
| 4464 | 4467 | ||
| 4465 | if (tp->dev->mtu <= ETH_DATA_LEN) | ||
| 4466 | rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); | ||
| 4467 | |||
| 4468 | rtl_disable_clock_request(tp); | 4468 | rtl_disable_clock_request(tp); |
| 4469 | } | 4469 | } |
| 4470 | 4470 | ||
| @@ -4490,9 +4490,6 @@ static void rtl_hw_start_8168cp_2(struct rtl8169_private *tp) · 19 unmodified lines | |||
| 4490 | rtl_set_def_aspm_entry_latency(tp); | 4490 | rtl_set_def_aspm_entry_latency(tp); |
| 4491 | 4491 | ||
| 4492 | RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en); | 4492 | RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en); |
| 4493 | |||
| 4494 | if (tp->dev->mtu <= ETH_DATA_LEN) | ||
| 4495 | rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); | ||
| 4496 | } | 4493 | } |
| 4497 | 4494 | ||
| 4498 | static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp) | 4495 | static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp) |
| @@ -4503,9 +4500,6 @@ static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp) · 4 unmodified lines | |||
| 4503 | 4500 | ||
| 4504 | /* Magic. */ | 4501 | /* Magic. */ |
| 4505 | RTL_W8(tp, DBG_REG, 0x20); | 4502 | RTL_W8(tp, DBG_REG, 0x20); |
| 4506 | |||
| 4507 | if (tp->dev->mtu <= ETH_DATA_LEN) | ||
| 4508 | rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); | ||
| 4509 | } | 4503 | } |
| 4510 | 4504 | ||
| 4511 | static void rtl_hw_start_8168c_1(struct rtl8169_private *tp) | 4505 | static void rtl_hw_start_8168c_1(struct rtl8169_private *tp) |
| @@ -4611,9 +4605,6 @@ static void rtl_hw_start_8168e_1(struct rtl8169_private *tp) · 99 unmodified lines | |||
| 4611 | 4605 | ||
| 4612 | rtl_ephy_init(tp, e_info_8168e_1); | 4606 | rtl_ephy_init(tp, e_info_8168e_1); |
| 4613 | 4607 | ||
| 4614 | if (tp->dev->mtu <= ETH_DATA_LEN) | ||
| 4615 | rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); | ||
| 4616 | |||
| 4617 | rtl_disable_clock_request(tp); | 4608 | rtl_disable_clock_request(tp); |
| 4618 | 4609 | ||
| 4619 | /* Reset tx FIFO pointer */ | 4610 | /* Reset tx FIFO pointer */ |
| @@ -4636,9 +4627,6 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp) · 16 unmodified lines | |||
| 4636 | 4627 | ||
| 4637 | rtl_ephy_init(tp, e_info_8168e_2); | 4628 | rtl_ephy_init(tp, e_info_8168e_2); |
| 4638 | 4629 | ||
| 4639 | if (tp->dev->mtu <= ETH_DATA_LEN) | ||
| 4640 | rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B); | ||
| 4641 | |||
| 4642 | rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000); | 4630 | rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000); |
| 4643 | rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000); | 4631 | rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000); |
| 4644 | rtl_set_fifo_size(tp, 0x10, 0x10, 0x02, 0x06); | 4632 | rtl_set_fifo_size(tp, 0x10, 0x10, 0x02, 0x06); |
| @@ -5485,6 +5473,8 @@ static void rtl_hw_start(struct rtl8169_private *tp) · 840 unmodified lines | |||
| 5485 | rtl_set_rx_tx_desc_registers(tp); | 5473 | rtl_set_rx_tx_desc_registers(tp); |
| 5486 | rtl_lock_config_regs(tp); | 5474 | rtl_lock_config_regs(tp); |
| 5487 | 5475 | ||
| 5476 | rtl_jumbo_config(tp, tp->dev->mtu); | ||
| 5477 | |||
| 5488 | /* Initially a 10 us delay. Turned it into a PCI commit. - FR */ | 5478 | /* Initially a 10 us delay. Turned it into a PCI commit. - FR */ |
| 5489 | RTL_R16(tp, CPlusCmd); | 5479 | RTL_R16(tp, CPlusCmd); |
| 5490 | RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb); | 5480 | RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb); |
| @@ -5498,10 +5488,7 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu) · 7 unmodified lines | |||
| 5498 | { | 5488 | { |
| 5499 | struct rtl8169_private *tp = netdev_priv(dev); | 5489 | struct rtl8169_private *tp = netdev_priv(dev); |
| 5500 | 5490 | ||
| 5501 | if (new_mtu > ETH_DATA_LEN) | 5491 | rtl_jumbo_config(tp, new_mtu); |
| 5502 | rtl_hw_jumbo_enable(tp); | ||
| 5503 | else | ||
| 5504 | rtl_hw_jumbo_disable(tp); | ||
| 5505 | 5492 | ||
| 5506 | dev->mtu = new_mtu; | 5493 | dev->mtu = new_mtu; |
| 5507 | netdev_update_features(dev); | 5494 | netdev_update_features(dev); |
| @@ -651,7 +651,8 @@ static void sun8i_dwmac_set_filter(struct mac_device_info *hw, · 650 unmodified lines | |||
| 651 | } | 651 | } |
| 652 | } | 652 | } |
| 653 | } else { | 653 | } else { |
| 654 | netdev_info(dev, "Too many address, switching to promiscuous\n"); | 654 | if (!(readl(ioaddr + EMAC_RX_FRM_FLT) & EMAC_FRM_FLT_RXALL)) |
| 655 | netdev_info(dev, "Too many address, switching to promiscuous\n"); | ||
| 655 | v = EMAC_FRM_FLT_RXALL; | 656 | v = EMAC_FRM_FLT_RXALL; |
| 656 | } | 657 | } |
| 657 | 658 | ||
| @@ -448,7 +448,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 447 unmodified lines | |||
| 448 | value |= GMAC_PACKET_FILTER_HPF; | 448 | value |= GMAC_PACKET_FILTER_HPF; |
| 449 | 449 | ||
| 450 | /* Handle multiple unicast addresses */ | 450 | /* Handle multiple unicast addresses */ |
| 451 | if (netdev_uc_count(dev) > GMAC_MAX_PERFECT_ADDRESSES) { | 451 | if (netdev_uc_count(dev) > hw->unicast_filter_entries) { |
| 452 | /* Switch to promiscuous mode if more than 128 addrs | 452 | /* Switch to promiscuous mode if more than 128 addrs |
| 453 | * are required | 453 | * are required |
| 454 | */ | 454 | */ |
| @@ -515,6 +515,7 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, · 514 unmodified lines | |||
| 515 | 515 | ||
| 516 | if (!enable) { | 516 | if (!enable) { |
| 517 | val |= PPSCMDx(index, 0x5); | 517 | val |= PPSCMDx(index, 0x5); |
| 518 | val |= PPSEN0; | ||
| 518 | writel(val, ioaddr + MAC_PPS_CONTROL); | 519 | writel(val, ioaddr + MAC_PPS_CONTROL); |
| 519 | return 0; | 520 | return 0; |
| 520 | } | 521 | } |
| @@ -2610,7 +2610,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) · 2609 unmodified lines | |||
| 2610 | } | 2610 | } |
| 2611 | 2611 | ||
| 2612 | if (priv->hw->pcs) | 2612 | if (priv->hw->pcs) |
| 2613 | stmmac_pcs_ctrl_ane(priv, priv->hw, 1, priv->hw->ps, 0); | 2613 | stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, priv->hw->ps, 0); |
| 2614 | 2614 | ||
| 2615 | /* set TX and RX rings length */ | 2615 | /* set TX and RX rings length */ |
| 2616 | stmmac_set_rings_length(priv); | 2616 | stmmac_set_rings_length(priv); |
| @@ -4742,8 +4742,10 @@ int stmmac_suspend(struct device *dev) · 2125 unmodified lines | |||
| 4742 | stmmac_mac_set(priv, priv->ioaddr, false); | 4742 | stmmac_mac_set(priv, priv->ioaddr, false); |
| 4743 | pinctrl_pm_select_sleep_state(priv->device); | 4743 | pinctrl_pm_select_sleep_state(priv->device); |
| 4744 | /* Disable clock in case of PWM is off */ | 4744 | /* Disable clock in case of PWM is off */ |
| 4745 | clk_disable(priv->plat->pclk); | 4745 | if (priv->plat->clk_ptp_ref) |
| 4746 | clk_disable(priv->plat->stmmac_clk); | 4746 | clk_disable_unprepare(priv->plat->clk_ptp_ref); |
| 4747 | clk_disable_unprepare(priv->plat->pclk); | ||
| 4748 | clk_disable_unprepare(priv->plat->stmmac_clk); | ||
| 4747 | } | 4749 | } |
| 4748 | mutex_unlock(&priv->lock); | 4750 | mutex_unlock(&priv->lock); |
| 4749 | 4751 | ||
| @@ -4806,8 +4808,10 @@ int stmmac_resume(struct device *dev) · 56 unmodified lines | |||
| 4806 | } else { | 4808 | } else { |
| 4807 | pinctrl_pm_select_default_state(priv->device); | 4809 | pinctrl_pm_select_default_state(priv->device); |
| 4808 | /* enable the clk previously disabled */ | 4810 | /* enable the clk previously disabled */ |
| 4809 | clk_enable(priv->plat->stmmac_clk); | 4811 | clk_prepare_enable(priv->plat->stmmac_clk); |
| 4810 | clk_enable(priv->plat->pclk); | 4812 | clk_prepare_enable(priv->plat->pclk); |
| 4813 | if (priv->plat->clk_ptp_ref) | ||
| 4814 | clk_prepare_enable(priv->plat->clk_ptp_ref); | ||
| 4811 | /* reset the phy so that it's ready */ | 4815 | /* reset the phy so that it's ready */ |
| 4812 | if (priv->mii) | 4816 | if (priv->mii) |
| 4813 | stmmac_mdio_reset(priv->mii); | 4817 | stmmac_mdio_reset(priv->mii); |
| @@ -164,7 +164,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp, · 163 unmodified lines | |||
| 164 | /* structure describing a PTP hardware clock */ | 164 | /* structure describing a PTP hardware clock */ |
| 165 | static struct ptp_clock_info stmmac_ptp_clock_ops = { | 165 | static struct ptp_clock_info stmmac_ptp_clock_ops = { |
| 166 | .owner = THIS_MODULE, | 166 | .owner = THIS_MODULE, |
| 167 | .name = "stmmac_ptp_clock", | 167 | .name = "stmmac ptp", |
| 168 | .max_adj = 62500000, | 168 | .max_adj = 62500000, |
| 169 | .n_alarm = 0, | 169 | .n_alarm = 0, |
| 170 | .n_ext_ts = 0, | 170 | .n_ext_ts = 0, |
| @@ -487,8 +487,8 @@ static int stmmac_filter_check(struct stmmac_priv *priv) · 486 unmodified lines | |||
| 487 | 487 | ||
| 488 | static int stmmac_test_hfilt(struct stmmac_priv *priv) | 488 | static int stmmac_test_hfilt(struct stmmac_priv *priv) |
| 489 | { | 489 | { |
| 490 | unsigned char gd_addr[ETH_ALEN] = {0x01, 0x00, 0xcc, 0xcc, 0xdd, 0xdd}; | 490 | unsigned char gd_addr[ETH_ALEN] = {0x01, 0xee, 0xdd, 0xcc, 0xbb, 0xaa}; |
| 491 | unsigned char bd_addr[ETH_ALEN] = {0x09, 0x00, 0xaa, 0xaa, 0xbb, 0xbb}; | 491 | unsigned char bd_addr[ETH_ALEN] = {0x01, 0x01, 0x02, 0x03, 0x04, 0x05}; |
| 492 | struct stmmac_packet_attrs attr = { }; | 492 | struct stmmac_packet_attrs attr = { }; |
| 493 | int ret; | 493 | int ret; |
| 494 | 494 | ||
| @@ -496,6 +496,9 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv) · 1 unmodified line | |||
| 496 | if (ret) | 496 | if (ret) |
| 497 | return ret; | 497 | return ret; |
| 498 | 498 | ||
| 499 | if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins) | ||
| 500 | return -EOPNOTSUPP; | ||
| 501 | |||
| 499 | ret = dev_mc_add(priv->dev, gd_addr); | 502 | ret = dev_mc_add(priv->dev, gd_addr); |
| 500 | if (ret) | 503 | if (ret) |
| 501 | return ret; | 504 | return ret; |
| @@ -573,6 +576,8 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv) · 71 unmodified lines | |||
| 573 | 576 | ||
| 574 | if (stmmac_filter_check(priv)) | 577 | if (stmmac_filter_check(priv)) |
| 575 | return -EOPNOTSUPP; | 578 | return -EOPNOTSUPP; |
| 579 | if (!priv->hw->multicast_filter_bins) | ||
| 580 | return -EOPNOTSUPP; | ||
| 576 | 581 | ||
| 577 | /* Remove all MC addresses */ | 582 | /* Remove all MC addresses */ |
| 578 | __dev_mc_unsync(priv->dev, NULL); | 583 | __dev_mc_unsync(priv->dev, NULL); |
| @@ -611,6 +616,8 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv) · 32 unmodified lines | |||
| 611 | 616 | ||
| 612 | if (stmmac_filter_check(priv)) | 617 | if (stmmac_filter_check(priv)) |
| 613 | return -EOPNOTSUPP; | 618 | return -EOPNOTSUPP; |
| 619 | if (!priv->hw->multicast_filter_bins) | ||
| 620 | return -EOPNOTSUPP; | ||
| 614 | 621 | ||
| 615 | /* Remove all UC addresses */ | 622 | /* Remove all UC addresses */ |
| 616 | __dev_uc_unsync(priv->dev, NULL); | 623 | __dev_uc_unsync(priv->dev, NULL); |
| @@ -510,7 +510,7 @@ static struct stmmac_flow_entry *tc_find_flow(struct stmmac_priv *priv, · 509 unmodified lines | |||
| 510 | return NULL; | 510 | return NULL; |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | struct { | 513 | static struct { |
| 514 | int (*fn)(struct stmmac_priv *priv, struct flow_cls_offload *cls, | 514 | int (*fn)(struct stmmac_priv *priv, struct flow_cls_offload *cls, |
| 515 | struct stmmac_flow_entry *entry); | 515 | struct stmmac_flow_entry *entry); |
| 516 | } tc_flow_parsers[] = { | 516 | } tc_flow_parsers[] = { |
| @@ -722,7 +722,7 @@ static void cpdma_chan_set_descs(struct cpdma_ctlr *ctlr, · 721 unmodified lines | |||
| 722 | * cpdma_chan_split_pool - Splits ctrl pool between all channels. | 722 | * cpdma_chan_split_pool - Splits ctrl pool between all channels. |
| 723 | * Has to be called under ctlr lock | 723 | * Has to be called under ctlr lock |
| 724 | */ | 724 | */ |
| 725 | int cpdma_chan_split_pool(struct cpdma_ctlr *ctlr) | 725 | static int cpdma_chan_split_pool(struct cpdma_ctlr *ctlr) |
| 726 | { | 726 | { |
| 727 | int tx_per_ch_desc = 0, rx_per_ch_desc = 0; | 727 | int tx_per_ch_desc = 0, rx_per_ch_desc = 0; |
| 728 | int free_rx_num = 0, free_tx_num = 0; | 728 | int free_rx_num = 0, free_tx_num = 0; |
| @@ -241,8 +241,8 @@ static struct pernet_operations nsim_fib_net_ops = { · 240 unmodified lines | |||
| 241 | 241 | ||
| 242 | void nsim_fib_exit(void) | 242 | void nsim_fib_exit(void) |
| 243 | { | 243 | { |
| 244 | unregister_pernet_subsys(&nsim_fib_net_ops); | ||
| 245 | unregister_fib_notifier(&nsim_fib_nb); | 244 | unregister_fib_notifier(&nsim_fib_nb); |
| 245 | unregister_pernet_subsys(&nsim_fib_net_ops); | ||
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | int nsim_fib_init(void) | 248 | int nsim_fib_init(void) |
| @@ -258,6 +258,7 @@ int nsim_fib_init(void) · 9 unmodified lines | |||
| 258 | err = register_fib_notifier(&nsim_fib_nb, nsim_fib_dump_inconsistent); | 258 | err = register_fib_notifier(&nsim_fib_nb, nsim_fib_dump_inconsistent); |
| 259 | if (err < 0) { | 259 | if (err < 0) { |
| 260 | pr_err("Failed to register fib notifier\n"); | 260 | pr_err("Failed to register fib notifier\n"); |
| 261 | unregister_pernet_subsys(&nsim_fib_net_ops); | ||
| 261 | goto err_out; | 262 | goto err_out; |
| 262 | } | 263 | } |
| 263 | 264 | ||
| @@ -572,6 +572,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) · 571 unmodified lines | |||
| 572 | .name = _name, \ | 572 | .name = _name, \ |
| 573 | /* PHY_BASIC_FEATURES */ \ | 573 | /* PHY_BASIC_FEATURES */ \ |
| 574 | .flags = PHY_IS_INTERNAL, \ | 574 | .flags = PHY_IS_INTERNAL, \ |
| 575 | .soft_reset = genphy_soft_reset, \ | ||
| 575 | .config_init = bcm7xxx_config_init, \ | 576 | .config_init = bcm7xxx_config_init, \ |
| 576 | .suspend = bcm7xxx_suspend, \ | 577 | .suspend = bcm7xxx_suspend, \ |
| 577 | .resume = bcm7xxx_config_init, \ | 578 | .resume = bcm7xxx_config_init, \ |
| @@ -341,6 +341,35 @@ static int ksz8041_config_aneg(struct phy_device *phydev) · 340 unmodified lines | |||
| 341 | return genphy_config_aneg(phydev); | 341 | return genphy_config_aneg(phydev); |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev, | ||
| 345 | const u32 ksz_phy_id) | ||
| 346 | { | ||
| 347 | int ret; | ||
| 348 | |||
| 349 | if ((phydev->phy_id & MICREL_PHY_ID_MASK) != ksz_phy_id) | ||
| 350 | return 0; | ||
| 351 | |||
| 352 | ret = phy_read(phydev, MII_BMSR); | ||
| 353 | if (ret < 0) | ||
| 354 | return ret; | ||
| 355 | |||
| 356 | /* KSZ8051 PHY and KSZ8794/KSZ8795/KSZ8765 switch share the same | ||
| 357 | * exact PHY ID. However, they can be told apart by the extended | ||
| 358 | * capability registers presence. The KSZ8051 PHY has them while | ||
| 359 | * the switch does not. | ||
| 360 | */ | ||
| 361 | ret &= BMSR_ERCAP; | ||
| 362 | if (ksz_phy_id == PHY_ID_KSZ8051) | ||
| 363 | return ret; | ||
| 364 | else | ||
| 365 | return !ret; | ||
| 366 | } | ||
| 367 | |||
| 368 | static int ksz8051_match_phy_device(struct phy_device *phydev) | ||
| 369 | { | ||
| 370 | return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ8051); | ||
| 371 | } | ||
| 372 | |||
| 344 | static int ksz8081_config_init(struct phy_device *phydev) | 373 | static int ksz8081_config_init(struct phy_device *phydev) |
| 345 | { | 374 | { |
| 346 | /* KSZPHY_OMSO_FACTORY_TEST is set at de-assertion of the reset line | 375 | /* KSZPHY_OMSO_FACTORY_TEST is set at de-assertion of the reset line |
| @@ -364,6 +393,11 @@ static int ksz8061_config_init(struct phy_device *phydev) · 17 unmodified lines | |||
| 364 | return kszphy_config_init(phydev); | 393 | return kszphy_config_init(phydev); |
| 365 | } | 394 | } |
| 366 | 395 | ||
| 396 | static int ksz8795_match_phy_device(struct phy_device *phydev) | ||
| 397 | { | ||
| 398 | return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ87XX); | ||
| 399 | } | ||
| 400 | |||
| 367 | static int ksz9021_load_values_from_of(struct phy_device *phydev, | 401 | static int ksz9021_load_values_from_of(struct phy_device *phydev, |
| 368 | const struct device_node *of_node, | 402 | const struct device_node *of_node, |
| 369 | u16 reg, | 403 | u16 reg, |
| @@ -1017,8 +1051,6 @@ static struct phy_driver ksphy_driver[] = { · 647 unmodified lines | |||
| 1017 | .suspend = genphy_suspend, | 1051 | .suspend = genphy_suspend, |
| 1018 | .resume = genphy_resume, | 1052 | .resume = genphy_resume, |
| 1019 | }, { | 1053 | }, { |
| 1020 | .phy_id = PHY_ID_KSZ8051, | ||
| 1021 | .phy_id_mask = MICREL_PHY_ID_MASK, | ||
| 1022 | .name = "Micrel KSZ8051", | 1054 | .name = "Micrel KSZ8051", |
| 1023 | /* PHY_BASIC_FEATURES */ | 1055 | /* PHY_BASIC_FEATURES */ |
| 1024 | .driver_data = &ksz8051_type, | 1056 | .driver_data = &ksz8051_type, |
| @@ -1029,6 +1061,7 @@ static struct phy_driver ksphy_driver[] = { · 4 unmodified lines | |||
| 1029 | .get_sset_count = kszphy_get_sset_count, | 1061 | .get_sset_count = kszphy_get_sset_count, |
| 1030 | .get_strings = kszphy_get_strings, | 1062 | .get_strings = kszphy_get_strings, |
| 1031 | .get_stats = kszphy_get_stats, | 1063 | .get_stats = kszphy_get_stats, |
| 1064 | .match_phy_device = ksz8051_match_phy_device, | ||
| 1032 | .suspend = genphy_suspend, | 1065 | .suspend = genphy_suspend, |
| 1033 | .resume = genphy_resume, | 1066 | .resume = genphy_resume, |
| 1034 | }, { | 1067 | }, { |
| @@ -1141,13 +1174,12 @@ static struct phy_driver ksphy_driver[] = { · 106 unmodified lines | |||
| 1141 | .suspend = genphy_suspend, | 1174 | .suspend = genphy_suspend, |
| 1142 | .resume = genphy_resume, | 1175 | .resume = genphy_resume, |
| 1143 | }, { | 1176 | }, { |
| 1144 | .phy_id = PHY_ID_KSZ8795, | 1177 | .name = "Micrel KSZ87XX Switch", |
| 1145 | .phy_id_mask = MICREL_PHY_ID_MASK, | ||
| 1146 | .name = "Micrel KSZ8795", | ||
| 1147 | /* PHY_BASIC_FEATURES */ | 1178 | /* PHY_BASIC_FEATURES */ |
| 1148 | .config_init = kszphy_config_init, | 1179 | .config_init = kszphy_config_init, |
| 1149 | .config_aneg = ksz8873mll_config_aneg, | 1180 | .config_aneg = ksz8873mll_config_aneg, |
| 1150 | .read_status = ksz8873mll_read_status, | 1181 | .read_status = ksz8873mll_read_status, |
| 1182 | .match_phy_device = ksz8795_match_phy_device, | ||
| 1151 | .suspend = genphy_suspend, | 1183 | .suspend = genphy_suspend, |
| 1152 | .resume = genphy_resume, | 1184 | .resume = genphy_resume, |
| 1153 | }, { | 1185 | }, { |
| @@ -323,6 +323,8 @@ int genphy_c45_read_pma(struct phy_device *phydev) · 322 unmodified lines | |||
| 323 | { | 323 | { |
| 324 | int val; | 324 | int val; |
| 325 | 325 | ||
| 326 | linkmode_zero(phydev->lp_advertising); | ||
| 327 | |||
| 326 | val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1); | 328 | val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1); |
| 327 | if (val < 0) | 329 | if (val < 0) |
| 328 | return val; | 330 | return val; |
| @@ -572,9 +572,6 @@ int phy_start_aneg(struct phy_device *phydev) · 571 unmodified lines | |||
| 572 | if (AUTONEG_DISABLE == phydev->autoneg) | 572 | if (AUTONEG_DISABLE == phydev->autoneg) |
| 573 | phy_sanitize_settings(phydev); | 573 | phy_sanitize_settings(phydev); |
| 574 | 574 | ||
| 575 | /* Invalidate LP advertising flags */ | ||
| 576 | linkmode_zero(phydev->lp_advertising); | ||
| 577 | |||
| 578 | err = phy_config_aneg(phydev); | 575 | err = phy_config_aneg(phydev); |
| 579 | if (err < 0) | 576 | if (err < 0) |
| 580 | goto out_unlock; | 577 | goto out_unlock; |
| @@ -1787,7 +1787,14 @@ int genphy_read_lpa(struct phy_device *phydev) · 1786 unmodified lines | |||
| 1787 | { | 1787 | { |
| 1788 | int lpa, lpagb; | 1788 | int lpa, lpagb; |
| 1789 | 1789 | ||
| 1790 | if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { | 1790 | if (phydev->autoneg == AUTONEG_ENABLE) { |
| 1791 | if (!phydev->autoneg_complete) { | ||
| 1792 | mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, | ||
| 1793 | 0); | ||
| 1794 | mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, 0); | ||
| 1795 | return 0; | ||
| 1796 | } | ||
| 1797 | |||
| 1791 | if (phydev->is_gigabit_capable) { | 1798 | if (phydev->is_gigabit_capable) { |
| 1792 | lpagb = phy_read(phydev, MII_STAT1000); | 1799 | lpagb = phy_read(phydev, MII_STAT1000); |
| 1793 | if (lpagb < 0) | 1800 | if (lpagb < 0) |
| @@ -1815,6 +1822,8 @@ int genphy_read_lpa(struct phy_device *phydev) · 21 unmodified lines | |||
| 1815 | return lpa; | 1822 | return lpa; |
| 1816 | 1823 | ||
| 1817 | mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); | 1824 | mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); |
| 1825 | } else { | ||
| 1826 | linkmode_zero(phydev->lp_advertising); | ||
| 1818 | } | 1827 | } |
| 1819 | 1828 | ||
| 1820 | return 0; | 1829 | return 0; |
| @@ -576,7 +576,7 @@ static int phylink_register_sfp(struct phylink *pl, · 575 unmodified lines | |||
| 576 | 576 | ||
| 577 | /** | 577 | /** |
| 578 | * phylink_create() - create a phylink instance | 578 | * phylink_create() - create a phylink instance |
| 579 | * @ndev: a pointer to the &struct net_device | 579 | * @config: a pointer to the target &struct phylink_config |
| 580 | * @fwnode: a pointer to a &struct fwnode_handle describing the network | 580 | * @fwnode: a pointer to a &struct fwnode_handle describing the network |
| 581 | * interface | 581 | * interface |
| 582 | * @iface: the desired link mode defined by &typedef phy_interface_t | 582 | * @iface: the desired link mode defined by &typedef phy_interface_t |
| @@ -526,8 +526,8 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, · 525 unmodified lines | |||
| 526 | e = tun_flow_find(head, rxhash); | 526 | e = tun_flow_find(head, rxhash); |
| 527 | if (likely(e)) { | 527 | if (likely(e)) { |
| 528 | /* TODO: keep queueing to old queue until it's empty? */ | 528 | /* TODO: keep queueing to old queue until it's empty? */ |
| 529 | if (e->queue_index != queue_index) | 529 | if (READ_ONCE(e->queue_index) != queue_index) |
| 530 | e->queue_index = queue_index; | 530 | WRITE_ONCE(e->queue_index, queue_index); |
| 531 | if (e->updated != jiffies) | 531 | if (e->updated != jiffies) |
| 532 | e->updated = jiffies; | 532 | e->updated = jiffies; |
| 533 | sock_rps_record_flow_hash(e->rps_rxhash); | 533 | sock_rps_record_flow_hash(e->rps_rxhash); |
| @@ -186,7 +186,7 @@ struct hso_tiocmget { · 185 unmodified lines | |||
| 186 | int intr_completed; | 186 | int intr_completed; |
| 187 | struct usb_endpoint_descriptor *endp; | 187 | struct usb_endpoint_descriptor *endp; |
| 188 | struct urb *urb; | 188 | struct urb *urb; |
| 189 | struct hso_serial_state_notification serial_state_notification; | 189 | struct hso_serial_state_notification *serial_state_notification; |
| 190 | u16 prev_UART_state_bitmap; | 190 | u16 prev_UART_state_bitmap; |
| 191 | struct uart_icount icount; | 191 | struct uart_icount icount; |
| 192 | }; | 192 | }; |
| @@ -1432,7 +1432,7 @@ static int tiocmget_submit_urb(struct hso_serial *serial, · 1239 unmodified lines | |||
| 1432 | usb_rcvintpipe(usb, | 1432 | usb_rcvintpipe(usb, |
| 1433 | tiocmget->endp-> | 1433 | tiocmget->endp-> |
| 1434 | bEndpointAddress & 0x7F), | 1434 | bEndpointAddress & 0x7F), |
| 1435 | &tiocmget->serial_state_notification, | 1435 | tiocmget->serial_state_notification, |
| 1436 | sizeof(struct hso_serial_state_notification), | 1436 | sizeof(struct hso_serial_state_notification), |
| 1437 | tiocmget_intr_callback, serial, | 1437 | tiocmget_intr_callback, serial, |
| 1438 | tiocmget->endp->bInterval); | 1438 | tiocmget->endp->bInterval); |
| @@ -1479,7 +1479,7 @@ static void tiocmget_intr_callback(struct urb *urb) · 40 unmodified lines | |||
| 1479 | /* wIndex should be the USB interface number of the port to which the | 1479 | /* wIndex should be the USB interface number of the port to which the |
| 1480 | * notification applies, which should always be the Modem port. | 1480 | * notification applies, which should always be the Modem port. |
| 1481 | */ | 1481 | */ |
| 1482 | serial_state_notification = &tiocmget->serial_state_notification; | 1482 | serial_state_notification = tiocmget->serial_state_notification; |
| 1483 | if (serial_state_notification->bmRequestType != BM_REQUEST_TYPE || | 1483 | if (serial_state_notification->bmRequestType != BM_REQUEST_TYPE || |
| 1484 | serial_state_notification->bNotification != B_NOTIFICATION || | 1484 | serial_state_notification->bNotification != B_NOTIFICATION || |
| 1485 | le16_to_cpu(serial_state_notification->wValue) != W_VALUE || | 1485 | le16_to_cpu(serial_state_notification->wValue) != W_VALUE || |
| @@ -2565,6 +2565,8 @@ static void hso_free_tiomget(struct hso_serial *serial) · 1079 unmodified lines | |||
| 2565 | usb_free_urb(tiocmget->urb); | 2565 | usb_free_urb(tiocmget->urb); |
| 2566 | tiocmget->urb = NULL; | 2566 | tiocmget->urb = NULL; |
| 2567 | serial->tiocmget = NULL; | 2567 | serial->tiocmget = NULL; |
| 2568 | kfree(tiocmget->serial_state_notification); | ||
| 2569 | tiocmget->serial_state_notification = NULL; | ||
| 2568 | kfree(tiocmget); | 2570 | kfree(tiocmget); |
| 2569 | } | 2571 | } |
| 2570 | } | 2572 | } |
| @@ -2615,10 +2617,13 @@ static struct hso_device *hso_create_bulk_serial_device( · 44 unmodified lines | |||
| 2615 | num_urbs = 2; | 2617 | num_urbs = 2; |
| 2616 | serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget), | 2618 | serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget), |
| 2617 | GFP_KERNEL); | 2619 | GFP_KERNEL); |
| 2620 | serial->tiocmget->serial_state_notification | ||
| 2621 | = kzalloc(sizeof(struct hso_serial_state_notification), | ||
| 2622 | GFP_KERNEL); | ||
| 2618 | /* it isn't going to break our heart if serial->tiocmget | 2623 | /* it isn't going to break our heart if serial->tiocmget |
| 2619 | * allocation fails don't bother checking this. | 2624 | * allocation fails don't bother checking this. |
| 2620 | */ | 2625 | */ |
| 2621 | if (serial->tiocmget) { | 2626 | if (serial->tiocmget && serial->tiocmget->serial_state_notification) { |
| 2622 | tiocmget = serial->tiocmget; | 2627 | tiocmget = serial->tiocmget; |
| 2623 | tiocmget->endp = hso_get_ep(interface, | 2628 | tiocmget->endp = hso_get_ep(interface, |
| 2624 | USB_ENDPOINT_XFER_INT, | 2629 | USB_ENDPOINT_XFER_INT, |
| @@ -3782,10 +3782,14 @@ static int lan78xx_probe(struct usb_interface *intf, · 3781 unmodified lines | |||
| 3782 | /* driver requires remote-wakeup capability during autosuspend. */ | 3782 | /* driver requires remote-wakeup capability during autosuspend. */ |
| 3783 | intf->needs_remote_wakeup = 1; | 3783 | intf->needs_remote_wakeup = 1; |
| 3784 | 3784 | ||
| 3785 | ret = lan78xx_phy_init(dev); | ||
| 3786 | if (ret < 0) | ||
| 3787 | goto out4; | ||
| 3788 | |||
| 3785 | ret = register_netdev(netdev); | 3789 | ret = register_netdev(netdev); |
| 3786 | if (ret != 0) { | 3790 | if (ret != 0) { |
| 3787 | netif_err(dev, probe, netdev, "couldn't register the device\n"); | 3791 | netif_err(dev, probe, netdev, "couldn't register the device\n"); |
| 3788 | goto out4; | 3792 | goto out5; |
| 3789 | } | 3793 | } |
| 3790 | 3794 | ||
| 3791 | usb_set_intfdata(intf, dev); | 3795 | usb_set_intfdata(intf, dev); |
| @@ -3798,14 +3802,10 @@ static int lan78xx_probe(struct usb_interface *intf, · 6 unmodified lines | |||
| 3798 | pm_runtime_set_autosuspend_delay(&udev->dev, | 3802 | pm_runtime_set_autosuspend_delay(&udev->dev, |
| 3799 | DEFAULT_AUTOSUSPEND_DELAY); | 3803 | DEFAULT_AUTOSUSPEND_DELAY); |
| 3800 | 3804 | ||
| 3801 | ret = lan78xx_phy_init(dev); | ||
| 3802 | if (ret < 0) | ||
| 3803 | goto out5; | ||
| 3804 | |||
| 3805 | return 0; | 3805 | return 0; |
| 3806 | 3806 | ||
| 3807 | out5: | 3807 | out5: |
| 3808 | unregister_netdev(netdev); | 3808 | phy_disconnect(netdev->phydev); |
| 3809 | out4: | 3809 | out4: |
| 3810 | usb_free_urb(dev->urb_intr); | 3810 | usb_free_urb(dev->urb_intr); |
| 3811 | out3: | 3811 | out3: |
| @@ -1327,6 +1327,7 @@ static const struct usb_device_id products[] = { · 1326 unmodified lines | |||
| 1327 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ | 1327 | {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ |
| 1328 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ | 1328 | {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ |
| 1329 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ | 1329 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ |
| 1330 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */ | ||
| 1330 | {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ | 1331 | {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ |
| 1331 | {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ | 1332 | {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ |
| 1332 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ | 1333 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
| @@ -335,7 +335,7 @@ static void sr_set_multicast(struct net_device *net) · 334 unmodified lines | |||
| 335 | static int sr_mdio_read(struct net_device *net, int phy_id, int loc) | 335 | static int sr_mdio_read(struct net_device *net, int phy_id, int loc) |
| 336 | { | 336 | { |
| 337 | struct usbnet *dev = netdev_priv(net); | 337 | struct usbnet *dev = netdev_priv(net); |
| 338 | __le16 res; | 338 | __le16 res = 0; |
| 339 | 339 | ||
| 340 | mutex_lock(&dev->phy_mutex); | 340 | mutex_lock(&dev->phy_mutex); |
| 341 | sr_set_sw_mii(dev); | 341 | sr_set_sw_mii(dev); |
| @@ -2118,12 +2118,15 @@ static int ath10k_init_uart(struct ath10k *ar) · 2117 unmodified lines | |||
| 2118 | return ret; | 2118 | return ret; |
| 2119 | } | 2119 | } |
| 2120 | 2120 | ||
| 2121 | if (!uart_print && ar->hw_params.uart_pin_workaround) { | 2121 | if (!uart_print) { |
| 2122 | ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin, | 2122 | if (ar->hw_params.uart_pin_workaround) { |
| 2123 | ar->hw_params.uart_pin); | 2123 | ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin, |
| 2124 | if (ret) { | 2124 | ar->hw_params.uart_pin); |
| 2125 | ath10k_warn(ar, "failed to set UART TX pin: %d", ret); | 2125 | if (ret) { |
| 2126 | return ret; | 2126 | ath10k_warn(ar, "failed to set UART TX pin: %d", |
| 2127 | ret); | ||
| 2128 | return ret; | ||
| 2129 | } | ||
| 2127 | } | 2130 | } |
| 2128 | 2131 | ||
| 2129 | return 0; | 2132 | return 0; |
| @@ -162,12 +162,13 @@ int iwl_acpi_get_mcc(struct device *dev, char *mcc) · 161 unmodified lines | |||
| 162 | 162 | ||
| 163 | wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_WRDD_WIFI_DATA_SIZE, | 163 | wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_WRDD_WIFI_DATA_SIZE, |
| 164 | &tbl_rev); | 164 | &tbl_rev); |
| 165 | if (IS_ERR(wifi_pkg) || tbl_rev != 0) { | 165 | if (IS_ERR(wifi_pkg)) { |
| 166 | ret = PTR_ERR(wifi_pkg); | 166 | ret = PTR_ERR(wifi_pkg); |
| 167 | goto out_free; | 167 | goto out_free; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) { | 170 | if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || |
| 171 | tbl_rev != 0) { | ||
| 171 | ret = -EINVAL; | 172 | ret = -EINVAL; |
| 172 | goto out_free; | 173 | goto out_free; |
| 173 | } | 174 | } |
| @@ -224,12 +225,13 @@ int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk) · 50 unmodified lines | |||
| 224 | 225 | ||
| 225 | wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_ECKV_WIFI_DATA_SIZE, | 226 | wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_ECKV_WIFI_DATA_SIZE, |
| 226 | &tbl_rev); | 227 | &tbl_rev); |
| 227 | if (IS_ERR(wifi_pkg) || tbl_rev != 0) { | 228 | if (IS_ERR(wifi_pkg)) { |
| 228 | ret = PTR_ERR(wifi_pkg); | 229 | ret = PTR_ERR(wifi_pkg); |
| 229 | goto out_free; | 230 | goto out_free; |
| 230 | } | 231 | } |
| 231 | 232 | ||
| 232 | if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) { | 233 | if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || |
| 234 | tbl_rev != 0) { | ||
| 233 | ret = -EINVAL; | 235 | ret = -EINVAL; |
| 234 | goto out_free; | 236 | goto out_free; |
| 235 | } | 237 | } |
| @@ -646,6 +646,7 @@ static struct scatterlist *alloc_sgtable(int size) · 645 unmodified lines | |||
| 646 | if (new_page) | 646 | if (new_page) |
| 647 | __free_page(new_page); | 647 | __free_page(new_page); |
| 648 | } | 648 | } |
| 649 | kfree(table); | ||
| 649 | return NULL; | 650 | return NULL; |
| 650 | } | 651 | } |
| 651 | alloc_size = min_t(int, size, PAGE_SIZE); | 652 | alloc_size = min_t(int, size, PAGE_SIZE); |
| @@ -112,38 +112,38 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf); · 111 unmodified lines | |||
| 112 | */ | 112 | */ |
| 113 | static inline u32 iwl_umac_prph(struct iwl_trans *trans, u32 ofs) | 113 | static inline u32 iwl_umac_prph(struct iwl_trans *trans, u32 ofs) |
| 114 | { | 114 | { |
| 115 | return ofs + trans->cfg->trans.umac_prph_offset; | 115 | return ofs + trans->trans_cfg->umac_prph_offset; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | static inline u32 iwl_read_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs) | 118 | static inline u32 iwl_read_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs) |
| 119 | { | 119 | { |
| 120 | return iwl_read_prph_no_grab(trans, ofs + | 120 | return iwl_read_prph_no_grab(trans, ofs + |
| 121 | trans->cfg->trans.umac_prph_offset); | 121 | trans->trans_cfg->umac_prph_offset); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | static inline u32 iwl_read_umac_prph(struct iwl_trans *trans, u32 ofs) | 124 | static inline u32 iwl_read_umac_prph(struct iwl_trans *trans, u32 ofs) |
| 125 | { | 125 | { |
| 126 | return iwl_read_prph(trans, ofs + trans->cfg->trans.umac_prph_offset); | 126 | return iwl_read_prph(trans, ofs + trans->trans_cfg->umac_prph_offset); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | static inline void iwl_write_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs, | 129 | static inline void iwl_write_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs, |
| 130 | u32 val) | 130 | u32 val) |
| 131 | { | 131 | { |
| 132 | iwl_write_prph_no_grab(trans, ofs + trans->cfg->trans.umac_prph_offset, | 132 | iwl_write_prph_no_grab(trans, ofs + trans->trans_cfg->umac_prph_offset, |
| 133 | val); | 133 | val); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | static inline void iwl_write_umac_prph(struct iwl_trans *trans, u32 ofs, | 136 | static inline void iwl_write_umac_prph(struct iwl_trans *trans, u32 ofs, |
| 137 | u32 val) | 137 | u32 val) |
| 138 | { | 138 | { |
| 139 | iwl_write_prph(trans, ofs + trans->cfg->trans.umac_prph_offset, val); | 139 | iwl_write_prph(trans, ofs + trans->trans_cfg->umac_prph_offset, val); |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static inline int iwl_poll_umac_prph_bit(struct iwl_trans *trans, u32 addr, | 142 | static inline int iwl_poll_umac_prph_bit(struct iwl_trans *trans, u32 addr, |
| 143 | u32 bits, u32 mask, int timeout) | 143 | u32 bits, u32 mask, int timeout) |
| 144 | { | 144 | { |
| 145 | return iwl_poll_prph_bit(trans, addr + | 145 | return iwl_poll_prph_bit(trans, addr + |
| 146 | trans->cfg->trans.umac_prph_offset, | 146 | trans->trans_cfg->umac_prph_offset, |
| 147 | bits, mask, timeout); | 147 | bits, mask, timeout); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| @@ -420,6 +420,9 @@ static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) · 419 unmodified lines | |||
| 420 | }; | 420 | }; |
| 421 | int ret; | 421 | int ret; |
| 422 | 422 | ||
| 423 | if (mvm->trans->cfg->tx_with_siso_diversity) | ||
| 424 | init_cfg.init_flags |= cpu_to_le32(BIT(IWL_INIT_PHY)); | ||
| 425 | |||
| 423 | lockdep_assert_held(&mvm->mutex); | 426 | lockdep_assert_held(&mvm->mutex); |
| 424 | 427 | ||
| 425 | mvm->rfkill_safe_init_done = false; | 428 | mvm->rfkill_safe_init_done = false; |
| @@ -694,12 +697,13 @@ static int iwl_mvm_sar_get_wrds_table(struct iwl_mvm *mvm) · 268 unmodified lines | |||
| 694 | 697 | ||
| 695 | wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, | 698 | wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, |
| 696 | ACPI_WRDS_WIFI_DATA_SIZE, &tbl_rev); | 699 | ACPI_WRDS_WIFI_DATA_SIZE, &tbl_rev); |
| 697 | if (IS_ERR(wifi_pkg) || tbl_rev != 0) { | 700 | if (IS_ERR(wifi_pkg)) { |
| 698 | ret = PTR_ERR(wifi_pkg); | 701 | ret = PTR_ERR(wifi_pkg); |
| 699 | goto out_free; | 702 | goto out_free; |
| 700 | } | 703 | } |
| 701 | 704 | ||
| 702 | if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) { | 705 | if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER || |
| 706 | tbl_rev != 0) { | ||
| 703 | ret = -EINVAL; | 707 | ret = -EINVAL; |
| 704 | goto out_free; | 708 | goto out_free; |
| 705 | } | 709 | } |
| @@ -731,13 +735,14 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) · 25 unmodified lines | |||
| 731 | 735 | ||
| 732 | wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, | 736 | wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, |
| 733 | ACPI_EWRD_WIFI_DATA_SIZE, &tbl_rev); | 737 | ACPI_EWRD_WIFI_DATA_SIZE, &tbl_rev); |
| 734 | if (IS_ERR(wifi_pkg) || tbl_rev != 0) { | 738 | if (IS_ERR(wifi_pkg)) { |
| 735 | ret = PTR_ERR(wifi_pkg); | 739 | ret = PTR_ERR(wifi_pkg); |
| 736 | goto out_free; | 740 | goto out_free; |
| 737 | } | 741 | } |
| 738 | 742 | ||
| 739 | if ((wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) || | 743 | if ((wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) || |
| 740 | (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER)) { | 744 | (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER) || |
| 745 | tbl_rev != 0) { | ||
| 741 | ret = -EINVAL; | 746 | ret = -EINVAL; |
| 742 | goto out_free; | 747 | goto out_free; |
| 743 | } | 748 | } |
| @@ -791,11 +796,16 @@ static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm) · 47 unmodified lines | |||
| 791 | 796 | ||
| 792 | wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, | 797 | wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, |
| 793 | ACPI_WGDS_WIFI_DATA_SIZE, &tbl_rev); | 798 | ACPI_WGDS_WIFI_DATA_SIZE, &tbl_rev); |
| 794 | if (IS_ERR(wifi_pkg) || tbl_rev > 1) { | 799 | if (IS_ERR(wifi_pkg)) { |
| 795 | ret = PTR_ERR(wifi_pkg); | 800 | ret = PTR_ERR(wifi_pkg); |
| 796 | goto out_free; | 801 | goto out_free; |
| 797 | } | 802 | } |
| 798 | 803 | ||
| 804 | if (tbl_rev != 0) { | ||
| 805 | ret = -EINVAL; | ||
| 806 | goto out_free; | ||
| 807 | } | ||
| 808 | |||
| 799 | mvm->geo_rev = tbl_rev; | 809 | mvm->geo_rev = tbl_rev; |
| 800 | for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) { | 810 | for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) { |
| 801 | for (j = 0; j < ACPI_GEO_TABLE_SIZE; j++) { | 811 | for (j = 0; j < ACPI_GEO_TABLE_SIZE; j++) { |
| @@ -889,15 +899,17 @@ static bool iwl_mvm_sar_geo_support(struct iwl_mvm *mvm) · 87 unmodified lines | |||
| 889 | * firmware versions. Unfortunately, we don't have a TLV API | 899 | * firmware versions. Unfortunately, we don't have a TLV API |
| 890 | * flag to rely on, so rely on the major version which is in | 900 | * flag to rely on, so rely on the major version which is in |
| 891 | * the first byte of ucode_ver. This was implemented | 901 | * the first byte of ucode_ver. This was implemented |
| 892 | * initially on version 38 and then backported to29 and 17. | 902 | * initially on version 38 and then backported to 17. It was |
| 893 | * The intention was to have it in 36 as well, but not all | 903 | * also backported to 29, but only for 7265D devices. The |
| 894 | * 8000 family got this feature enabled. The 8000 family is | 904 | * intention was to have it in 36 as well, but not all 8000 |
| 895 | * the only one using version 36, so skip this version | 905 | * family got this feature enabled. The 8000 family is the |
| 896 | * entirely. | 906 | * only one using version 36, so skip this version entirely. |
| 897 | */ | 907 | */ |
| 898 | return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 || | 908 | return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 || |
| 899 | IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 || | 909 | IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17 || |
| 900 | IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17; | 910 | (IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 && |
| 911 | ((mvm->trans->hw_rev & CSR_HW_REV_TYPE_MSK) == | ||
| 912 | CSR_HW_REV_TYPE_7265D)); | ||
| 901 | } | 913 | } |
| 902 | 914 | ||
| 903 | int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) | 915 | int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm) |
| @@ -1020,11 +1032,16 @@ static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm) · 116 unmodified lines | |||
| 1020 | wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, | 1032 | wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data, |
| 1021 | ACPI_PPAG_WIFI_DATA_SIZE, &tbl_rev); | 1033 | ACPI_PPAG_WIFI_DATA_SIZE, &tbl_rev); |
| 1022 | 1034 | ||
| 1023 | if (IS_ERR(wifi_pkg) || tbl_rev != 0) { | 1035 | if (IS_ERR(wifi_pkg)) { |
| 1024 | ret = PTR_ERR(wifi_pkg); | 1036 | ret = PTR_ERR(wifi_pkg); |
| 1025 | goto out_free; | 1037 | goto out_free; |
| 1026 | } | 1038 | } |
| 1027 | 1039 | ||
| 1040 | if (tbl_rev != 0) { | ||
| 1041 | ret = -EINVAL; | ||
| 1042 | goto out_free; | ||
| 1043 | } | ||
| 1044 | |||
| 1028 | enabled = &wifi_pkg->package.elements[1]; | 1045 | enabled = &wifi_pkg->package.elements[1]; |
| 1029 | if (enabled->type != ACPI_TYPE_INTEGER || | 1046 | if (enabled->type != ACPI_TYPE_INTEGER || |
| 1030 | (enabled->integer.value != 0 && enabled->integer.value != 1)) { | 1047 | (enabled->integer.value != 0 && enabled->integer.value != 1)) { |
| @@ -4881,11 +4881,11 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, · 4880 unmodified lines | |||
| 4881 | if (!iwl_mvm_has_new_rx_api(mvm)) | 4881 | if (!iwl_mvm_has_new_rx_api(mvm)) |
| 4882 | return; | 4882 | return; |
| 4883 | 4883 | ||
| 4884 | notif->cookie = mvm->queue_sync_cookie; | 4884 | if (notif->sync) { |
| 4885 | 4885 | notif->cookie = mvm->queue_sync_cookie; | |
| 4886 | if (notif->sync) | ||
| 4887 | atomic_set(&mvm->queue_sync_counter, | 4886 | atomic_set(&mvm->queue_sync_counter, |
| 4888 | mvm->trans->num_rx_queues); | 4887 | mvm->trans->num_rx_queues); |
| 4888 | } | ||
| 4889 | 4889 | ||
| 4890 | ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif, | 4890 | ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif, |
| 4891 | size, !notif->sync); | 4891 | size, !notif->sync); |
| @@ -4905,7 +4905,8 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, · 13 unmodified lines | |||
| 4905 | 4905 | ||
| 4906 | out: | 4906 | out: |
| 4907 | atomic_set(&mvm->queue_sync_counter, 0); | 4907 | atomic_set(&mvm->queue_sync_counter, 0); |
| 4908 | mvm->queue_sync_cookie++; | 4908 | if (notif->sync) |
| 4909 | mvm->queue_sync_cookie++; | ||
| 4909 | } | 4910 | } |
| 4910 | 4911 | ||
| 4911 | static void iwl_mvm_sync_rx_queues(struct ieee80211_hw *hw) | 4912 | static void iwl_mvm_sync_rx_queues(struct ieee80211_hw *hw) |
| @@ -107,13 +107,9 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, · 106 unmodified lines | |||
| 107 | 107 | ||
| 108 | /* allocate ucode sections in dram and set addresses */ | 108 | /* allocate ucode sections in dram and set addresses */ |
| 109 | ret = iwl_pcie_init_fw_sec(trans, fw, &prph_scratch->dram); | 109 | ret = iwl_pcie_init_fw_sec(trans, fw, &prph_scratch->dram); |
| 110 | if (ret) { | 110 | if (ret) |
| 111 | dma_free_coherent(trans->dev, | 111 | goto err_free_prph_scratch; |
| 112 | sizeof(*prph_scratch), | 112 | |
| 113 | prph_scratch, | ||
| 114 | trans_pcie->prph_scratch_dma_addr); | ||
| 115 | return ret; | ||
| 116 | } | ||
| 117 | 113 | ||
| 118 | /* Allocate prph information | 114 | /* Allocate prph information |
| 119 | * currently we don't assign to the prph info anything, but it would get | 115 | * currently we don't assign to the prph info anything, but it would get |
| @@ -121,16 +117,20 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, · 1 unmodified line | |||
| 121 | prph_info = dma_alloc_coherent(trans->dev, sizeof(*prph_info), | 117 | prph_info = dma_alloc_coherent(trans->dev, sizeof(*prph_info), |
| 122 | &trans_pcie->prph_info_dma_addr, | 118 | &trans_pcie->prph_info_dma_addr, |
| 123 | GFP_KERNEL); | 119 | GFP_KERNEL); |
| 124 | if (!prph_info) | 120 | if (!prph_info) { |
| 125 | return -ENOMEM; | 121 | ret = -ENOMEM; |
| 122 | goto err_free_prph_scratch; | ||
| 123 | } | ||
| 126 | 124 | ||
| 127 | /* Allocate context info */ | 125 | /* Allocate context info */ |
| 128 | ctxt_info_gen3 = dma_alloc_coherent(trans->dev, | 126 | ctxt_info_gen3 = dma_alloc_coherent(trans->dev, |
| 129 | sizeof(*ctxt_info_gen3), | 127 | sizeof(*ctxt_info_gen3), |
| 130 | &trans_pcie->ctxt_info_dma_addr, | 128 | &trans_pcie->ctxt_info_dma_addr, |
| 131 | GFP_KERNEL); | 129 | GFP_KERNEL); |
| 132 | if (!ctxt_info_gen3) | 130 | if (!ctxt_info_gen3) { |
| 133 | return -ENOMEM; | 131 | ret = -ENOMEM; |
| 132 | goto err_free_prph_info; | ||
| 133 | } | ||
| 134 | 134 | ||
| 135 | ctxt_info_gen3->prph_info_base_addr = | 135 | ctxt_info_gen3->prph_info_base_addr = |
| 136 | cpu_to_le64(trans_pcie->prph_info_dma_addr); | 136 | cpu_to_le64(trans_pcie->prph_info_dma_addr); |
| @@ -186,6 +186,20 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, · 49 unmodified lines | |||
| 186 | iwl_set_bit(trans, CSR_GP_CNTRL, CSR_AUTO_FUNC_INIT); | 186 | iwl_set_bit(trans, CSR_GP_CNTRL, CSR_AUTO_FUNC_INIT); |
| 187 | 187 | ||
| 188 | return 0; | 188 | return 0; |
| 189 | |||
| 190 | err_free_prph_info: | ||
| 191 | dma_free_coherent(trans->dev, | ||
| 192 | sizeof(*prph_info), | ||
| 193 | prph_info, | ||
| 194 | trans_pcie->prph_info_dma_addr); | ||
| 195 | |||
| 196 | err_free_prph_scratch: | ||
| 197 | dma_free_coherent(trans->dev, | ||
| 198 | sizeof(*prph_scratch), | ||
| 199 | prph_scratch, | ||
| 200 | trans_pcie->prph_scratch_dma_addr); | ||
| 201 | return ret; | ||
| 202 | |||
| 189 | } | 203 | } |
| 190 | 204 | ||
| 191 | void iwl_pcie_ctxt_info_gen3_free(struct iwl_trans *trans) | 205 | void iwl_pcie_ctxt_info_gen3_free(struct iwl_trans *trans) |
| @@ -513,31 +513,33 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 512 unmodified lines | |||
| 513 | {IWL_PCI_DEVICE(0x24FD, 0x9074, iwl8265_2ac_cfg)}, | 513 | {IWL_PCI_DEVICE(0x24FD, 0x9074, iwl8265_2ac_cfg)}, |
| 514 | 514 | ||
| 515 | /* 9000 Series */ | 515 | /* 9000 Series */ |
| 516 | {IWL_PCI_DEVICE(0x02F0, 0x0030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, | 516 | {IWL_PCI_DEVICE(0x02F0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 517 | {IWL_PCI_DEVICE(0x02F0, 0x0034, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, | 517 | {IWL_PCI_DEVICE(0x02F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 518 | {IWL_PCI_DEVICE(0x02F0, 0x0038, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, | 518 | {IWL_PCI_DEVICE(0x02F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 519 | {IWL_PCI_DEVICE(0x02F0, 0x003C, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, | 519 | {IWL_PCI_DEVICE(0x02F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 520 | {IWL_PCI_DEVICE(0x02F0, 0x0060, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)}, | 520 | {IWL_PCI_DEVICE(0x02F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 521 | {IWL_PCI_DEVICE(0x02F0, 0x0064, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)}, | 521 | {IWL_PCI_DEVICE(0x02F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 522 | {IWL_PCI_DEVICE(0x02F0, 0x00A0, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, | 522 | {IWL_PCI_DEVICE(0x02F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 523 | {IWL_PCI_DEVICE(0x02F0, 0x00A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, | 523 | {IWL_PCI_DEVICE(0x02F0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 524 | {IWL_PCI_DEVICE(0x02F0, 0x0230, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, | 524 | {IWL_PCI_DEVICE(0x02F0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 525 | {IWL_PCI_DEVICE(0x02F0, 0x0234, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, | 525 | {IWL_PCI_DEVICE(0x02F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 526 | {IWL_PCI_DEVICE(0x02F0, 0x0238, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, | 526 | {IWL_PCI_DEVICE(0x02F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 527 | {IWL_PCI_DEVICE(0x02F0, 0x023C, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, | 527 | {IWL_PCI_DEVICE(0x02F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 528 | {IWL_PCI_DEVICE(0x02F0, 0x0260, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)}, | 528 | {IWL_PCI_DEVICE(0x02F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 529 | {IWL_PCI_DEVICE(0x02F0, 0x0264, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)}, | 529 | {IWL_PCI_DEVICE(0x02F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 530 | {IWL_PCI_DEVICE(0x02F0, 0x02A0, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, | 530 | {IWL_PCI_DEVICE(0x02F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 531 | {IWL_PCI_DEVICE(0x02F0, 0x02A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, | 531 | {IWL_PCI_DEVICE(0x02F0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 532 | {IWL_PCI_DEVICE(0x02F0, 0x1551, iwl9560_killer_s_2ac_cfg_quz_a0_jf_b0_soc)}, | 532 | {IWL_PCI_DEVICE(0x02F0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 533 | {IWL_PCI_DEVICE(0x02F0, 0x1552, iwl9560_killer_i_2ac_cfg_quz_a0_jf_b0_soc)}, | 533 | {IWL_PCI_DEVICE(0x02F0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, |
| 534 | {IWL_PCI_DEVICE(0x02F0, 0x2030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, | 534 | {IWL_PCI_DEVICE(0x02F0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, |
| 535 | {IWL_PCI_DEVICE(0x02F0, 0x2034, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, | 535 | {IWL_PCI_DEVICE(0x02F0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 536 | {IWL_PCI_DEVICE(0x02F0, 0x4030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, | 536 | {IWL_PCI_DEVICE(0x02F0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 537 | {IWL_PCI_DEVICE(0x02F0, 0x4034, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, | 537 | {IWL_PCI_DEVICE(0x02F0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 538 | {IWL_PCI_DEVICE(0x02F0, 0x40A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, | 538 | {IWL_PCI_DEVICE(0x02F0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 539 | {IWL_PCI_DEVICE(0x02F0, 0x4234, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, | 539 | {IWL_PCI_DEVICE(0x02F0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 540 | {IWL_PCI_DEVICE(0x02F0, 0x42A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)}, | 540 | {IWL_PCI_DEVICE(0x02F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 541 | {IWL_PCI_DEVICE(0x02F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, | ||
| 542 | |||
| 541 | {IWL_PCI_DEVICE(0x06F0, 0x0030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, | 543 | {IWL_PCI_DEVICE(0x06F0, 0x0030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, |
| 542 | {IWL_PCI_DEVICE(0x06F0, 0x0034, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, | 544 | {IWL_PCI_DEVICE(0x06F0, 0x0034, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)}, |
| 543 | {IWL_PCI_DEVICE(0x06F0, 0x0038, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, | 545 | {IWL_PCI_DEVICE(0x06F0, 0x0038, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)}, |
| @@ -643,34 +645,34 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 99 unmodified lines | |||
| 643 | {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_soc)}, | 645 | {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_soc)}, |
| 644 | {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_soc)}, | 646 | {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_soc)}, |
| 645 | {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_soc)}, | 647 | {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_soc)}, |
| 646 | {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_soc)}, | 648 | |
| 647 | {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_soc)}, | 649 | {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 648 | {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_soc)}, | 650 | {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 649 | {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_soc)}, | 651 | {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 650 | {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9460_2ac_cfg_soc)}, | 652 | {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 651 | {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_soc)}, | 653 | {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 652 | {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_soc)}, | 654 | {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 653 | {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_soc)}, | 655 | {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 654 | {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_soc)}, | 656 | {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 655 | {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_soc)}, | 657 | {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 656 | {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_soc)}, | 658 | {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 657 | {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_soc)}, | 659 | {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 658 | {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_soc)}, | 660 | {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 659 | {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)}, | 661 | {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 660 | {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)}, | 662 | {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 661 | {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)}, | 663 | {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 662 | {IWL_PCI_DEVICE(0x30DC, 0x1010, iwl9260_2ac_cfg)}, | 664 | {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 663 | {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_soc)}, | 665 | {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 664 | {IWL_PCI_DEVICE(0x30DC, 0x1210, iwl9260_2ac_cfg)}, | 666 | {IWL_PCI_DEVICE(0x30DC, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, |
| 665 | {IWL_PCI_DEVICE(0x30DC, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, | 667 | {IWL_PCI_DEVICE(0x30DC, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, |
| 666 | {IWL_PCI_DEVICE(0x30DC, 0x1552, iwl9560_killer_2ac_cfg_soc)}, | 668 | {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 667 | {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_soc)}, | 669 | {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 668 | {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_soc)}, | 670 | {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 669 | {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_soc)}, | 671 | {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 670 | {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_soc)}, | 672 | {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 671 | {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_soc)}, | 673 | {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 672 | {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_soc)}, | 674 | {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 673 | {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_soc)}, | 675 | |
| 674 | {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_160_cfg_shared_clk)}, | 676 | {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_160_cfg_shared_clk)}, |
| 675 | {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_shared_clk)}, | 677 | {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_shared_clk)}, |
| 676 | {IWL_PCI_DEVICE(0x31DC, 0x0038, iwl9560_2ac_160_cfg_shared_clk)}, | 678 | {IWL_PCI_DEVICE(0x31DC, 0x0038, iwl9560_2ac_160_cfg_shared_clk)}, |
| @@ -726,62 +728,60 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 49 unmodified lines | |||
| 726 | {IWL_PCI_DEVICE(0x34F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, | 728 | {IWL_PCI_DEVICE(0x34F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 727 | {IWL_PCI_DEVICE(0x34F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, | 729 | {IWL_PCI_DEVICE(0x34F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 728 | 730 | ||
| 729 | {IWL_PCI_DEVICE(0x3DF0, 0x0030, iwl9560_2ac_160_cfg_soc)}, | 731 | {IWL_PCI_DEVICE(0x3DF0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 730 | {IWL_PCI_DEVICE(0x3DF0, 0x0034, iwl9560_2ac_cfg_soc)}, | 732 | {IWL_PCI_DEVICE(0x3DF0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 731 | {IWL_PCI_DEVICE(0x3DF0, 0x0038, iwl9560_2ac_160_cfg_soc)}, | 733 | {IWL_PCI_DEVICE(0x3DF0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 732 | {IWL_PCI_DEVICE(0x3DF0, 0x003C, iwl9560_2ac_160_cfg_soc)}, | 734 | {IWL_PCI_DEVICE(0x3DF0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 733 | {IWL_PCI_DEVICE(0x3DF0, 0x0060, iwl9461_2ac_cfg_soc)}, | 735 | {IWL_PCI_DEVICE(0x3DF0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 734 | {IWL_PCI_DEVICE(0x3DF0, 0x0064, iwl9461_2ac_cfg_soc)}, | 736 | {IWL_PCI_DEVICE(0x3DF0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 735 | {IWL_PCI_DEVICE(0x3DF0, 0x00A0, iwl9462_2ac_cfg_soc)}, | 737 | {IWL_PCI_DEVICE(0x3DF0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 736 | {IWL_PCI_DEVICE(0x3DF0, 0x00A4, iwl9462_2ac_cfg_soc)}, | 738 | {IWL_PCI_DEVICE(0x3DF0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 737 | {IWL_PCI_DEVICE(0x3DF0, 0x0230, iwl9560_2ac_cfg_soc)}, | 739 | {IWL_PCI_DEVICE(0x3DF0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 738 | {IWL_PCI_DEVICE(0x3DF0, 0x0234, iwl9560_2ac_cfg_soc)}, | 740 | {IWL_PCI_DEVICE(0x3DF0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 739 | {IWL_PCI_DEVICE(0x3DF0, 0x0238, iwl9560_2ac_cfg_soc)}, | 741 | {IWL_PCI_DEVICE(0x3DF0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 740 | {IWL_PCI_DEVICE(0x3DF0, 0x023C, iwl9560_2ac_cfg_soc)}, | 742 | {IWL_PCI_DEVICE(0x3DF0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 741 | {IWL_PCI_DEVICE(0x3DF0, 0x0260, iwl9461_2ac_cfg_soc)}, | 743 | {IWL_PCI_DEVICE(0x3DF0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 742 | {IWL_PCI_DEVICE(0x3DF0, 0x0264, iwl9461_2ac_cfg_soc)}, | 744 | {IWL_PCI_DEVICE(0x3DF0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 743 | {IWL_PCI_DEVICE(0x3DF0, 0x02A0, iwl9462_2ac_cfg_soc)}, | 745 | {IWL_PCI_DEVICE(0x3DF0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 744 | {IWL_PCI_DEVICE(0x3DF0, 0x02A4, iwl9462_2ac_cfg_soc)}, | 746 | {IWL_PCI_DEVICE(0x3DF0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 745 | {IWL_PCI_DEVICE(0x3DF0, 0x1010, iwl9260_2ac_cfg)}, | 747 | {IWL_PCI_DEVICE(0x3DF0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 746 | {IWL_PCI_DEVICE(0x3DF0, 0x1030, iwl9560_2ac_cfg_soc)}, | 748 | {IWL_PCI_DEVICE(0x3DF0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, |
| 747 | {IWL_PCI_DEVICE(0x3DF0, 0x1210, iwl9260_2ac_cfg)}, | 749 | {IWL_PCI_DEVICE(0x3DF0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, |
| 748 | {IWL_PCI_DEVICE(0x3DF0, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, | 750 | {IWL_PCI_DEVICE(0x3DF0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 749 | {IWL_PCI_DEVICE(0x3DF0, 0x1552, iwl9560_killer_2ac_cfg_soc)}, | 751 | {IWL_PCI_DEVICE(0x3DF0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 750 | {IWL_PCI_DEVICE(0x3DF0, 0x2030, iwl9560_2ac_160_cfg_soc)}, | 752 | {IWL_PCI_DEVICE(0x3DF0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 751 | {IWL_PCI_DEVICE(0x3DF0, 0x2034, iwl9560_2ac_160_cfg_soc)}, | 753 | {IWL_PCI_DEVICE(0x3DF0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 752 | {IWL_PCI_DEVICE(0x3DF0, 0x4030, iwl9560_2ac_160_cfg_soc)}, | 754 | {IWL_PCI_DEVICE(0x3DF0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 753 | {IWL_PCI_DEVICE(0x3DF0, 0x4034, iwl9560_2ac_160_cfg_soc)}, | 755 | {IWL_PCI_DEVICE(0x3DF0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 754 | {IWL_PCI_DEVICE(0x3DF0, 0x40A4, iwl9462_2ac_cfg_soc)}, | 756 | {IWL_PCI_DEVICE(0x3DF0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 755 | {IWL_PCI_DEVICE(0x3DF0, 0x4234, iwl9560_2ac_cfg_soc)}, | 757 | |
| 756 | {IWL_PCI_DEVICE(0x3DF0, 0x42A4, iwl9462_2ac_cfg_soc)}, | 758 | {IWL_PCI_DEVICE(0x43F0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 757 | {IWL_PCI_DEVICE(0x43F0, 0x0030, iwl9560_2ac_160_cfg_soc)}, | 759 | {IWL_PCI_DEVICE(0x43F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 758 | {IWL_PCI_DEVICE(0x43F0, 0x0034, iwl9560_2ac_cfg_soc)}, | 760 | {IWL_PCI_DEVICE(0x43F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 759 | {IWL_PCI_DEVICE(0x43F0, 0x0038, iwl9560_2ac_160_cfg_soc)}, | 761 | {IWL_PCI_DEVICE(0x43F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 760 | {IWL_PCI_DEVICE(0x43F0, 0x003C, iwl9560_2ac_160_cfg_soc)}, | 762 | {IWL_PCI_DEVICE(0x43F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 761 | {IWL_PCI_DEVICE(0x43F0, 0x0060, iwl9461_2ac_cfg_soc)}, | 763 | {IWL_PCI_DEVICE(0x43F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 762 | {IWL_PCI_DEVICE(0x43F0, 0x0064, iwl9461_2ac_cfg_soc)}, | 764 | {IWL_PCI_DEVICE(0x43F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 763 | {IWL_PCI_DEVICE(0x43F0, 0x00A0, iwl9462_2ac_cfg_soc)}, | 765 | {IWL_PCI_DEVICE(0x43F0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 764 | {IWL_PCI_DEVICE(0x43F0, 0x00A4, iwl9462_2ac_cfg_soc)}, | 766 | {IWL_PCI_DEVICE(0x43F0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 765 | {IWL_PCI_DEVICE(0x43F0, 0x0230, iwl9560_2ac_cfg_soc)}, | 767 | {IWL_PCI_DEVICE(0x43F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 766 | {IWL_PCI_DEVICE(0x43F0, 0x0234, iwl9560_2ac_cfg_soc)}, | 768 | {IWL_PCI_DEVICE(0x43F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 767 | {IWL_PCI_DEVICE(0x43F0, 0x0238, iwl9560_2ac_cfg_soc)}, | 769 | {IWL_PCI_DEVICE(0x43F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 768 | {IWL_PCI_DEVICE(0x43F0, 0x023C, iwl9560_2ac_cfg_soc)}, | 770 | {IWL_PCI_DEVICE(0x43F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 769 | {IWL_PCI_DEVICE(0x43F0, 0x0260, iwl9461_2ac_cfg_soc)}, | 771 | {IWL_PCI_DEVICE(0x43F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 770 | {IWL_PCI_DEVICE(0x43F0, 0x0264, iwl9461_2ac_cfg_soc)}, | 772 | {IWL_PCI_DEVICE(0x43F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 771 | {IWL_PCI_DEVICE(0x43F0, 0x02A0, iwl9462_2ac_cfg_soc)}, | 773 | {IWL_PCI_DEVICE(0x43F0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 772 | {IWL_PCI_DEVICE(0x43F0, 0x02A4, iwl9462_2ac_cfg_soc)}, | 774 | {IWL_PCI_DEVICE(0x43F0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 773 | {IWL_PCI_DEVICE(0x43F0, 0x1010, iwl9260_2ac_cfg)}, | 775 | {IWL_PCI_DEVICE(0x43F0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, |
| 774 | {IWL_PCI_DEVICE(0x43F0, 0x1030, iwl9560_2ac_cfg_soc)}, | 776 | {IWL_PCI_DEVICE(0x43F0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, |
| 775 | {IWL_PCI_DEVICE(0x43F0, 0x1210, iwl9260_2ac_cfg)}, | 777 | {IWL_PCI_DEVICE(0x43F0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 776 | {IWL_PCI_DEVICE(0x43F0, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, | 778 | {IWL_PCI_DEVICE(0x43F0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 777 | {IWL_PCI_DEVICE(0x43F0, 0x1552, iwl9560_killer_2ac_cfg_soc)}, | 779 | {IWL_PCI_DEVICE(0x43F0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 778 | {IWL_PCI_DEVICE(0x43F0, 0x2030, iwl9560_2ac_160_cfg_soc)}, | 780 | {IWL_PCI_DEVICE(0x43F0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 779 | {IWL_PCI_DEVICE(0x43F0, 0x2034, iwl9560_2ac_160_cfg_soc)}, | 781 | {IWL_PCI_DEVICE(0x43F0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 780 | {IWL_PCI_DEVICE(0x43F0, 0x4030, iwl9560_2ac_160_cfg_soc)}, | 782 | {IWL_PCI_DEVICE(0x43F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 781 | {IWL_PCI_DEVICE(0x43F0, 0x4034, iwl9560_2ac_160_cfg_soc)}, | 783 | {IWL_PCI_DEVICE(0x43F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 782 | {IWL_PCI_DEVICE(0x43F0, 0x40A4, iwl9462_2ac_cfg_soc)}, | 784 | |
| 783 | {IWL_PCI_DEVICE(0x43F0, 0x4234, iwl9560_2ac_cfg_soc)}, | ||
| 784 | {IWL_PCI_DEVICE(0x43F0, 0x42A4, iwl9462_2ac_cfg_soc)}, | ||
| 785 | {IWL_PCI_DEVICE(0x9DF0, 0x0000, iwl9460_2ac_cfg_soc)}, | 785 | {IWL_PCI_DEVICE(0x9DF0, 0x0000, iwl9460_2ac_cfg_soc)}, |
| 786 | {IWL_PCI_DEVICE(0x9DF0, 0x0010, iwl9460_2ac_cfg_soc)}, | 786 | {IWL_PCI_DEVICE(0x9DF0, 0x0010, iwl9460_2ac_cfg_soc)}, |
| 787 | {IWL_PCI_DEVICE(0x9DF0, 0x0030, iwl9560_2ac_160_cfg_soc)}, | 787 | {IWL_PCI_DEVICE(0x9DF0, 0x0030, iwl9560_2ac_160_cfg_soc)}, |
| @@ -821,34 +821,34 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 33 unmodified lines | |||
| 821 | {IWL_PCI_DEVICE(0x9DF0, 0x40A4, iwl9462_2ac_cfg_soc)}, | 821 | {IWL_PCI_DEVICE(0x9DF0, 0x40A4, iwl9462_2ac_cfg_soc)}, |
| 822 | {IWL_PCI_DEVICE(0x9DF0, 0x4234, iwl9560_2ac_cfg_soc)}, | 822 | {IWL_PCI_DEVICE(0x9DF0, 0x4234, iwl9560_2ac_cfg_soc)}, |
| 823 | {IWL_PCI_DEVICE(0x9DF0, 0x42A4, iwl9462_2ac_cfg_soc)}, | 823 | {IWL_PCI_DEVICE(0x9DF0, 0x42A4, iwl9462_2ac_cfg_soc)}, |
| 824 | {IWL_PCI_DEVICE(0xA0F0, 0x0030, iwl9560_2ac_160_cfg_soc)}, | 824 | |
| 825 | {IWL_PCI_DEVICE(0xA0F0, 0x0034, iwl9560_2ac_cfg_soc)}, | 825 | {IWL_PCI_DEVICE(0xA0F0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 826 | {IWL_PCI_DEVICE(0xA0F0, 0x0038, iwl9560_2ac_160_cfg_soc)}, | 826 | {IWL_PCI_DEVICE(0xA0F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 827 | {IWL_PCI_DEVICE(0xA0F0, 0x003C, iwl9560_2ac_160_cfg_soc)}, | 827 | {IWL_PCI_DEVICE(0xA0F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 828 | {IWL_PCI_DEVICE(0xA0F0, 0x0060, iwl9461_2ac_cfg_soc)}, | 828 | {IWL_PCI_DEVICE(0xA0F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 829 | {IWL_PCI_DEVICE(0xA0F0, 0x0064, iwl9461_2ac_cfg_soc)}, | 829 | {IWL_PCI_DEVICE(0xA0F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 830 | {IWL_PCI_DEVICE(0xA0F0, 0x00A0, iwl9462_2ac_cfg_soc)}, | 830 | {IWL_PCI_DEVICE(0xA0F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 831 | {IWL_PCI_DEVICE(0xA0F0, 0x00A4, iwl9462_2ac_cfg_soc)}, | 831 | {IWL_PCI_DEVICE(0xA0F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 832 | {IWL_PCI_DEVICE(0xA0F0, 0x0230, iwl9560_2ac_cfg_soc)}, | 832 | {IWL_PCI_DEVICE(0xA0F0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 833 | {IWL_PCI_DEVICE(0xA0F0, 0x0234, iwl9560_2ac_cfg_soc)}, | 833 | {IWL_PCI_DEVICE(0xA0F0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 834 | {IWL_PCI_DEVICE(0xA0F0, 0x0238, iwl9560_2ac_cfg_soc)}, | 834 | {IWL_PCI_DEVICE(0xA0F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 835 | {IWL_PCI_DEVICE(0xA0F0, 0x023C, iwl9560_2ac_cfg_soc)}, | 835 | {IWL_PCI_DEVICE(0xA0F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 836 | {IWL_PCI_DEVICE(0xA0F0, 0x0260, iwl9461_2ac_cfg_soc)}, | 836 | {IWL_PCI_DEVICE(0xA0F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 837 | {IWL_PCI_DEVICE(0xA0F0, 0x0264, iwl9461_2ac_cfg_soc)}, | 837 | {IWL_PCI_DEVICE(0xA0F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 838 | {IWL_PCI_DEVICE(0xA0F0, 0x02A0, iwl9462_2ac_cfg_soc)}, | 838 | {IWL_PCI_DEVICE(0xA0F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)}, |
| 839 | {IWL_PCI_DEVICE(0xA0F0, 0x02A4, iwl9462_2ac_cfg_soc)}, | 839 | {IWL_PCI_DEVICE(0xA0F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 840 | {IWL_PCI_DEVICE(0xA0F0, 0x1010, iwl9260_2ac_cfg)}, | 840 | {IWL_PCI_DEVICE(0xA0F0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 841 | {IWL_PCI_DEVICE(0xA0F0, 0x1030, iwl9560_2ac_cfg_soc)}, | 841 | {IWL_PCI_DEVICE(0xA0F0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 842 | {IWL_PCI_DEVICE(0xA0F0, 0x1210, iwl9260_2ac_cfg)}, | 842 | {IWL_PCI_DEVICE(0xA0F0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)}, |
| 843 | {IWL_PCI_DEVICE(0xA0F0, 0x1551, iwl9560_killer_s_2ac_cfg_soc)}, | 843 | {IWL_PCI_DEVICE(0xA0F0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)}, |
| 844 | {IWL_PCI_DEVICE(0xA0F0, 0x1552, iwl9560_killer_2ac_cfg_soc)}, | 844 | {IWL_PCI_DEVICE(0xA0F0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 845 | {IWL_PCI_DEVICE(0xA0F0, 0x2030, iwl9560_2ac_160_cfg_soc)}, | 845 | {IWL_PCI_DEVICE(0xA0F0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 846 | {IWL_PCI_DEVICE(0xA0F0, 0x2034, iwl9560_2ac_160_cfg_soc)}, | 846 | {IWL_PCI_DEVICE(0xA0F0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 847 | {IWL_PCI_DEVICE(0xA0F0, 0x4030, iwl9560_2ac_160_cfg_soc)}, | 847 | {IWL_PCI_DEVICE(0xA0F0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)}, |
| 848 | {IWL_PCI_DEVICE(0xA0F0, 0x4034, iwl9560_2ac_160_cfg_soc)}, | 848 | {IWL_PCI_DEVICE(0xA0F0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 849 | {IWL_PCI_DEVICE(0xA0F0, 0x40A4, iwl9462_2ac_cfg_soc)}, | 849 | {IWL_PCI_DEVICE(0xA0F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)}, |
| 850 | {IWL_PCI_DEVICE(0xA0F0, 0x4234, iwl9560_2ac_cfg_soc)}, | 850 | {IWL_PCI_DEVICE(0xA0F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)}, |
| 851 | {IWL_PCI_DEVICE(0xA0F0, 0x42A4, iwl9462_2ac_cfg_soc)}, | 851 | |
| 852 | {IWL_PCI_DEVICE(0xA370, 0x0030, iwl9560_2ac_160_cfg_soc)}, | 852 | {IWL_PCI_DEVICE(0xA370, 0x0030, iwl9560_2ac_160_cfg_soc)}, |
| 853 | {IWL_PCI_DEVICE(0xA370, 0x0034, iwl9560_2ac_cfg_soc)}, | 853 | {IWL_PCI_DEVICE(0xA370, 0x0034, iwl9560_2ac_cfg_soc)}, |
| 854 | {IWL_PCI_DEVICE(0xA370, 0x0038, iwl9560_2ac_160_cfg_soc)}, | 854 | {IWL_PCI_DEVICE(0xA370, 0x0038, iwl9560_2ac_160_cfg_soc)}, |
| @@ -3272,11 +3272,17 @@ static struct iwl_trans_dump_data · 3271 unmodified lines | |||
| 3272 | ptr = cmdq->write_ptr; | 3272 | ptr = cmdq->write_ptr; |
| 3273 | for (i = 0; i < cmdq->n_window; i++) { | 3273 | for (i = 0; i < cmdq->n_window; i++) { |
| 3274 | u8 idx = iwl_pcie_get_cmd_index(cmdq, ptr); | 3274 | u8 idx = iwl_pcie_get_cmd_index(cmdq, ptr); |
| 3275 | u8 tfdidx; | ||
| 3275 | u32 caplen, cmdlen; | 3276 | u32 caplen, cmdlen; |
| 3276 | 3277 | ||
| 3278 | if (trans->trans_cfg->use_tfh) | ||
| 3279 | tfdidx = idx; | ||
| 3280 | else | ||
| 3281 | tfdidx = ptr; | ||
| 3282 | |||
| 3277 | cmdlen = iwl_trans_pcie_get_cmdlen(trans, | 3283 | cmdlen = iwl_trans_pcie_get_cmdlen(trans, |
| 3278 | cmdq->tfds + | 3284 | (u8 *)cmdq->tfds + |
| 3279 | tfd_size * ptr); | 3285 | tfd_size * tfdidx); |
| 3280 | caplen = min_t(u32, TFD_MAX_PAYLOAD_SIZE, cmdlen); | 3286 | caplen = min_t(u32, TFD_MAX_PAYLOAD_SIZE, cmdlen); |
| 3281 | 3287 | ||
| 3282 | if (cmdlen) { | 3288 | if (cmdlen) { |
| @@ -3450,6 +3456,15 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 167 unmodified lines | |||
| 3450 | spin_lock_init(&trans_pcie->reg_lock); | 3456 | spin_lock_init(&trans_pcie->reg_lock); |
| 3451 | mutex_init(&trans_pcie->mutex); | 3457 | mutex_init(&trans_pcie->mutex); |
| 3452 | init_waitqueue_head(&trans_pcie->ucode_write_waitq); | 3458 | init_waitqueue_head(&trans_pcie->ucode_write_waitq); |
| 3459 | |||
| 3460 | trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator", | ||
| 3461 | WQ_HIGHPRI | WQ_UNBOUND, 1); | ||
| 3462 | if (!trans_pcie->rba.alloc_wq) { | ||
| 3463 | ret = -ENOMEM; | ||
| 3464 | goto out_free_trans; | ||
| 3465 | } | ||
| 3466 | INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work); | ||
| 3467 | |||
| 3453 | trans_pcie->tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page); | 3468 | trans_pcie->tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page); |
| 3454 | if (!trans_pcie->tso_hdr_page) { | 3469 | if (!trans_pcie->tso_hdr_page) { |
| 3455 | ret = -ENOMEM; | 3470 | ret = -ENOMEM; |
| @@ -3584,10 +3599,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 128 unmodified lines | |||
| 3584 | trans_pcie->inta_mask = CSR_INI_SET_MASK; | 3599 | trans_pcie->inta_mask = CSR_INI_SET_MASK; |
| 3585 | } | 3600 | } |
| 3586 | 3601 | ||
| 3587 | trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator", | ||
| 3588 | WQ_HIGHPRI | WQ_UNBOUND, 1); | ||
| 3589 | INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work); | ||
| 3590 | |||
| 3591 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 3602 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
| 3592 | trans_pcie->fw_mon_data.state = IWL_FW_MON_DBGFS_STATE_CLOSED; | 3603 | trans_pcie->fw_mon_data.state = IWL_FW_MON_DBGFS_STATE_CLOSED; |
| 3593 | mutex_init(&trans_pcie->fw_mon_data.mutex); | 3604 | mutex_init(&trans_pcie->fw_mon_data.mutex); |
| @@ -3599,6 +3610,8 @@ out_free_ict: · 5 unmodified lines | |||
| 3599 | iwl_pcie_free_ict(trans); | 3610 | iwl_pcie_free_ict(trans); |
| 3600 | out_no_pci: | 3611 | out_no_pci: |
| 3601 | free_percpu(trans_pcie->tso_hdr_page); | 3612 | free_percpu(trans_pcie->tso_hdr_page); |
| 3613 | destroy_workqueue(trans_pcie->rba.alloc_wq); | ||
| 3614 | out_free_trans: | ||
| 3602 | iwl_trans_free(trans); | 3615 | iwl_trans_free(trans); |
| 3603 | return ERR_PTR(ret); | 3616 | return ERR_PTR(ret); |
| 3604 | } | 3617 | } |
| @@ -4026,7 +4026,7 @@ static int __init init_mac80211_hwsim(void) · 4025 unmodified lines | |||
| 4026 | err = dev_alloc_name(hwsim_mon, hwsim_mon->name); | 4026 | err = dev_alloc_name(hwsim_mon, hwsim_mon->name); |
| 4027 | if (err < 0) { | 4027 | if (err < 0) { |
| 4028 | rtnl_unlock(); | 4028 | rtnl_unlock(); |
| 4029 | goto out_free_radios; | 4029 | goto out_free_mon; |
| 4030 | } | 4030 | } |
| 4031 | 4031 | ||
| 4032 | err = register_netdevice(hwsim_mon); | 4032 | err = register_netdevice(hwsim_mon); |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | |||
| 23 | #include <linux/leds.h> | 23 | #include <linux/leds.h> |
| 24 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
| 25 | #include <linux/etherdevice.h> | 25 | #include <linux/etherdevice.h> |
| 26 | #include <linux/input-polldev.h> | ||
| 27 | #include <linux/kfifo.h> | 26 | #include <linux/kfifo.h> |
| 28 | #include <linux/hrtimer.h> | 27 | #include <linux/hrtimer.h> |
| 29 | #include <linux/average.h> | 28 | #include <linux/average.h> |
| @@ -555,7 +555,7 @@ static ssize_t rt2x00debug_write_restart_hw(struct file *file, · 554 unmodified lines | |||
| 555 | { | 555 | { |
| 556 | struct rt2x00debug_intf *intf = file->private_data; | 556 | struct rt2x00debug_intf *intf = file->private_data; |
| 557 | struct rt2x00_dev *rt2x00dev = intf->rt2x00dev; | 557 | struct rt2x00_dev *rt2x00dev = intf->rt2x00dev; |
| 558 | static unsigned long last_reset; | 558 | static unsigned long last_reset = INITIAL_JIFFIES; |
| 559 | 559 | ||
| 560 | if (!rt2x00_has_cap_restart_hw(rt2x00dev)) | 560 | if (!rt2x00_has_cap_restart_hw(rt2x00dev)) |
| 561 | return -EOPNOTSUPP; | 561 | return -EOPNOTSUPP; |
| @@ -719,7 +719,6 @@ err_unmap: · 718 unmodified lines | |||
| 719 | xenvif_unmap_frontend_data_rings(queue); | 719 | xenvif_unmap_frontend_data_rings(queue); |
| 720 | netif_napi_del(&queue->napi); | 720 | netif_napi_del(&queue->napi); |
| 721 | err: | 721 | err: |
| 722 | module_put(THIS_MODULE); | ||
| 723 | return err; | 722 | return err; |
| 724 | } | 723 | } |
| 725 | 724 | ||
| @@ -547,18 +547,25 @@ static int pn533_usb_probe(struct usb_interface *interface, · 546 unmodified lines | |||
| 547 | 547 | ||
| 548 | rc = pn533_finalize_setup(priv); | 548 | rc = pn533_finalize_setup(priv); |
| 549 | if (rc) | 549 | if (rc) |
| 550 | goto error; | 550 | goto err_deregister; |
| 551 | 551 | ||
| 552 | usb_set_intfdata(interface, phy); | 552 | usb_set_intfdata(interface, phy); |
| 553 | 553 | ||
| 554 | return 0; | 554 | return 0; |
| 555 | 555 | ||
| 556 | err_deregister: | ||
| 557 | pn533_unregister_device(phy->priv); | ||
| 556 | error: | 558 | error: |
| 559 | usb_kill_urb(phy->in_urb); | ||
| 560 | usb_kill_urb(phy->out_urb); | ||
| 561 | usb_kill_urb(phy->ack_urb); | ||
| 562 | |||
| 557 | usb_free_urb(phy->in_urb); | 563 | usb_free_urb(phy->in_urb); |
| 558 | usb_free_urb(phy->out_urb); | 564 | usb_free_urb(phy->out_urb); |
| 559 | usb_free_urb(phy->ack_urb); | 565 | usb_free_urb(phy->ack_urb); |
| 560 | usb_put_dev(phy->udev); | 566 | usb_put_dev(phy->udev); |
| 561 | kfree(in_buf); | 567 | kfree(in_buf); |
| 568 | kfree(phy->ack_buffer); | ||
| 562 | 569 | ||
| 563 | return rc; | 570 | return rc; |
| 564 | } | 571 | } |
| @@ -116,10 +116,26 @@ static void nvme_queue_scan(struct nvme_ctrl *ctrl) · 115 unmodified lines | |||
| 116 | /* | 116 | /* |
| 117 | * Only new queue scan work when admin and IO queues are both alive | 117 | * Only new queue scan work when admin and IO queues are both alive |
| 118 | */ | 118 | */ |
| 119 | if (ctrl->state == NVME_CTRL_LIVE) | 119 | if (ctrl->state == NVME_CTRL_LIVE && ctrl->tagset) |
| 120 | queue_work(nvme_wq, &ctrl->scan_work); | 120 | queue_work(nvme_wq, &ctrl->scan_work); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | /* | ||
| 124 | * Use this function to proceed with scheduling reset_work for a controller | ||
| 125 | * that had previously been set to the resetting state. This is intended for | ||
| 126 | * code paths that can't be interrupted by other reset attempts. A hot removal | ||
| 127 | * may prevent this from succeeding. | ||
| 128 | */ | ||
| 129 | int nvme_try_sched_reset(struct nvme_ctrl *ctrl) | ||
| 130 | { | ||
| 131 | if (ctrl->state != NVME_CTRL_RESETTING) | ||
| 132 | return -EBUSY; | ||
| 133 | if (!queue_work(nvme_reset_wq, &ctrl->reset_work)) | ||
| 134 | return -EBUSY; | ||
| 135 | return 0; | ||
| 136 | } | ||
| 137 | EXPORT_SYMBOL_GPL(nvme_try_sched_reset); | ||
| 138 | |||
| 123 | int nvme_reset_ctrl(struct nvme_ctrl *ctrl) | 139 | int nvme_reset_ctrl(struct nvme_ctrl *ctrl) |
| 124 | { | 140 | { |
| 125 | if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) | 141 | if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) |
| @@ -137,8 +153,7 @@ int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl) · 11 unmodified lines | |||
| 137 | ret = nvme_reset_ctrl(ctrl); | 153 | ret = nvme_reset_ctrl(ctrl); |
| 138 | if (!ret) { | 154 | if (!ret) { |
| 139 | flush_work(&ctrl->reset_work); | 155 | flush_work(&ctrl->reset_work); |
| 140 | if (ctrl->state != NVME_CTRL_LIVE && | 156 | if (ctrl->state != NVME_CTRL_LIVE) |
| 141 | ctrl->state != NVME_CTRL_ADMIN_ONLY) | ||
| 142 | ret = -ENETRESET; | 157 | ret = -ENETRESET; |
| 143 | } | 158 | } |
| 144 | 159 | ||
| @@ -315,15 +330,6 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 170 unmodified lines | |||
| 315 | 330 | ||
| 316 | old_state = ctrl->state; | 331 | old_state = ctrl->state; |
| 317 | switch (new_state) { | 332 | switch (new_state) { |
| 318 | case NVME_CTRL_ADMIN_ONLY: | ||
| 319 | switch (old_state) { | ||
| 320 | case NVME_CTRL_CONNECTING: | ||
| 321 | changed = true; | ||
| 322 | /* FALLTHRU */ | ||
| 323 | default: | ||
| 324 | break; | ||
| 325 | } | ||
| 326 | break; | ||
| 327 | case NVME_CTRL_LIVE: | 333 | case NVME_CTRL_LIVE: |
| 328 | switch (old_state) { | 334 | switch (old_state) { |
| 329 | case NVME_CTRL_NEW: | 335 | case NVME_CTRL_NEW: |
| @@ -339,7 +345,6 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 9 unmodified lines | |||
| 339 | switch (old_state) { | 345 | switch (old_state) { |
| 340 | case NVME_CTRL_NEW: | 346 | case NVME_CTRL_NEW: |
| 341 | case NVME_CTRL_LIVE: | 347 | case NVME_CTRL_LIVE: |
| 342 | case NVME_CTRL_ADMIN_ONLY: | ||
| 343 | changed = true; | 348 | changed = true; |
| 344 | /* FALLTHRU */ | 349 | /* FALLTHRU */ |
| 345 | default: | 350 | default: |
| @@ -359,7 +364,6 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 13 unmodified lines | |||
| 359 | case NVME_CTRL_DELETING: | 364 | case NVME_CTRL_DELETING: |
| 360 | switch (old_state) { | 365 | switch (old_state) { |
| 361 | case NVME_CTRL_LIVE: | 366 | case NVME_CTRL_LIVE: |
| 362 | case NVME_CTRL_ADMIN_ONLY: | ||
| 363 | case NVME_CTRL_RESETTING: | 367 | case NVME_CTRL_RESETTING: |
| 364 | case NVME_CTRL_CONNECTING: | 368 | case NVME_CTRL_CONNECTING: |
| 365 | changed = true; | 369 | changed = true; |
| @@ -381,8 +385,10 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 15 unmodified lines | |||
| 381 | break; | 385 | break; |
| 382 | } | 386 | } |
| 383 | 387 | ||
| 384 | if (changed) | 388 | if (changed) { |
| 385 | ctrl->state = new_state; | 389 | ctrl->state = new_state; |
| 390 | wake_up_all(&ctrl->state_wq); | ||
| 391 | } | ||
| 386 | 392 | ||
| 387 | spin_unlock_irqrestore(&ctrl->lock, flags); | 393 | spin_unlock_irqrestore(&ctrl->lock, flags); |
| 388 | if (changed && ctrl->state == NVME_CTRL_LIVE) | 394 | if (changed && ctrl->state == NVME_CTRL_LIVE) |
| @@ -391,6 +397,39 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 2 unmodified lines | |||
| 391 | } | 397 | } |
| 392 | EXPORT_SYMBOL_GPL(nvme_change_ctrl_state); | 398 | EXPORT_SYMBOL_GPL(nvme_change_ctrl_state); |
| 393 | 399 | ||
| 400 | /* | ||
| 401 | * Returns true for sink states that can't ever transition back to live. | ||
| 402 | */ | ||
| 403 | static bool nvme_state_terminal(struct nvme_ctrl *ctrl) | ||
| 404 | { | ||
| 405 | switch (ctrl->state) { | ||
| 406 | case NVME_CTRL_NEW: | ||
| 407 | case NVME_CTRL_LIVE: | ||
| 408 | case NVME_CTRL_RESETTING: | ||
| 409 | case NVME_CTRL_CONNECTING: | ||
| 410 | return false; | ||
| 411 | case NVME_CTRL_DELETING: | ||
| 412 | case NVME_CTRL_DEAD: | ||
| 413 | return true; | ||
| 414 | default: | ||
| 415 | WARN_ONCE(1, "Unhandled ctrl state:%d", ctrl->state); | ||
| 416 | return true; | ||
| 417 | } | ||
| 418 | } | ||
| 419 | |||
| 420 | /* | ||
| 421 | * Waits for the controller state to be resetting, or returns false if it is | ||
| 422 | * not possible to ever transition to that state. | ||
| 423 | */ | ||
| 424 | bool nvme_wait_reset(struct nvme_ctrl *ctrl) | ||
| 425 | { | ||
| 426 | wait_event(ctrl->state_wq, | ||
| 427 | nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING) || | ||
| 428 | nvme_state_terminal(ctrl)); | ||
| 429 | return ctrl->state == NVME_CTRL_RESETTING; | ||
| 430 | } | ||
| 431 | EXPORT_SYMBOL_GPL(nvme_wait_reset); | ||
| 432 | |||
| 394 | static void nvme_free_ns_head(struct kref *ref) | 433 | static void nvme_free_ns_head(struct kref *ref) |
| 395 | { | 434 | { |
| 396 | struct nvme_ns_head *head = | 435 | struct nvme_ns_head *head = |
| @@ -1306,8 +1345,6 @@ static void nvme_update_formats(struct nvme_ctrl *ctrl) · 909 unmodified lines | |||
| 1306 | if (ns->disk && nvme_revalidate_disk(ns->disk)) | 1345 | if (ns->disk && nvme_revalidate_disk(ns->disk)) |
| 1307 | nvme_set_queue_dying(ns); | 1346 | nvme_set_queue_dying(ns); |
| 1308 | up_read(&ctrl->namespaces_rwsem); | 1347 | up_read(&ctrl->namespaces_rwsem); |
| 1309 | |||
| 1310 | nvme_remove_invalid_namespaces(ctrl, NVME_NSID_ALL); | ||
| 1311 | } | 1348 | } |
| 1312 | 1349 | ||
| 1313 | static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) | 1350 | static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) |
| @@ -1323,6 +1360,7 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) · 9 unmodified lines | |||
| 1323 | nvme_unfreeze(ctrl); | 1360 | nvme_unfreeze(ctrl); |
| 1324 | nvme_mpath_unfreeze(ctrl->subsys); | 1361 | nvme_mpath_unfreeze(ctrl->subsys); |
| 1325 | mutex_unlock(&ctrl->subsys->lock); | 1362 | mutex_unlock(&ctrl->subsys->lock); |
| 1363 | nvme_remove_invalid_namespaces(ctrl, NVME_NSID_ALL); | ||
| 1326 | mutex_unlock(&ctrl->scan_lock); | 1364 | mutex_unlock(&ctrl->scan_lock); |
| 1327 | } | 1365 | } |
| 1328 | if (effects & NVME_CMD_EFFECTS_CCC) | 1366 | if (effects & NVME_CMD_EFFECTS_CCC) |
| @@ -2874,7 +2912,6 @@ static int nvme_dev_open(struct inode *inode, struct file *file) · 1545 unmodified lines | |||
| 2874 | 2912 | ||
| 2875 | switch (ctrl->state) { | 2913 | switch (ctrl->state) { |
| 2876 | case NVME_CTRL_LIVE: | 2914 | case NVME_CTRL_LIVE: |
| 2877 | case NVME_CTRL_ADMIN_ONLY: | ||
| 2878 | break; | 2915 | break; |
| 2879 | default: | 2916 | default: |
| 2880 | return -EWOULDBLOCK; | 2917 | return -EWOULDBLOCK; |
| @@ -3168,7 +3205,6 @@ static ssize_t nvme_sysfs_show_state(struct device *dev, · 287 unmodified lines | |||
| 3168 | static const char *const state_name[] = { | 3205 | static const char *const state_name[] = { |
| 3169 | [NVME_CTRL_NEW] = "new", | 3206 | [NVME_CTRL_NEW] = "new", |
| 3170 | [NVME_CTRL_LIVE] = "live", | 3207 | [NVME_CTRL_LIVE] = "live", |
| 3171 | [NVME_CTRL_ADMIN_ONLY] = "only-admin", | ||
| 3172 | [NVME_CTRL_RESETTING] = "resetting", | 3208 | [NVME_CTRL_RESETTING] = "resetting", |
| 3173 | [NVME_CTRL_CONNECTING] = "connecting", | 3209 | [NVME_CTRL_CONNECTING] = "connecting", |
| 3174 | [NVME_CTRL_DELETING] = "deleting", | 3210 | [NVME_CTRL_DELETING] = "deleting", |
| @@ -3679,11 +3715,10 @@ static void nvme_scan_work(struct work_struct *work) · 504 unmodified lines | |||
| 3679 | struct nvme_id_ctrl *id; | 3715 | struct nvme_id_ctrl *id; |
| 3680 | unsigned nn; | 3716 | unsigned nn; |
| 3681 | 3717 | ||
| 3682 | if (ctrl->state != NVME_CTRL_LIVE) | 3718 | /* No tagset on a live ctrl means IO queues could not created */ |
| 3719 | if (ctrl->state != NVME_CTRL_LIVE || !ctrl->tagset) | ||
| 3683 | return; | 3720 | return; |
| 3684 | 3721 | ||
| 3685 | WARN_ON_ONCE(!ctrl->tagset); | ||
| 3686 | |||
| 3687 | if (test_and_clear_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) { | 3722 | if (test_and_clear_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) { |
| 3688 | dev_info(ctrl->device, "rescanning namespaces.\n"); | 3723 | dev_info(ctrl->device, "rescanning namespaces.\n"); |
| 3689 | nvme_clear_changed_ns_log(ctrl); | 3724 | nvme_clear_changed_ns_log(ctrl); |
| @@ -3844,13 +3879,13 @@ static void nvme_fw_act_work(struct work_struct *work) · 154 unmodified lines | |||
| 3844 | if (time_after(jiffies, fw_act_timeout)) { | 3879 | if (time_after(jiffies, fw_act_timeout)) { |
| 3845 | dev_warn(ctrl->device, | 3880 | dev_warn(ctrl->device, |
| 3846 | "Fw activation timeout, reset controller\n"); | 3881 | "Fw activation timeout, reset controller\n"); |
| 3847 | nvme_reset_ctrl(ctrl); | 3882 | nvme_try_sched_reset(ctrl); |
| 3848 | break; | 3883 | return; |
| 3849 | } | 3884 | } |
| 3850 | msleep(100); | 3885 | msleep(100); |
| 3851 | } | 3886 | } |
| 3852 | 3887 | ||
| 3853 | if (ctrl->state != NVME_CTRL_LIVE) | 3888 | if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE)) |
| 3854 | return; | 3889 | return; |
| 3855 | 3890 | ||
| 3856 | nvme_start_queues(ctrl); | 3891 | nvme_start_queues(ctrl); |
| @@ -3870,7 +3905,13 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result) · 13 unmodified lines | |||
| 3870 | nvme_queue_scan(ctrl); | 3905 | nvme_queue_scan(ctrl); |
| 3871 | break; | 3906 | break; |
| 3872 | case NVME_AER_NOTICE_FW_ACT_STARTING: | 3907 | case NVME_AER_NOTICE_FW_ACT_STARTING: |
| 3873 | queue_work(nvme_wq, &ctrl->fw_act_work); | 3908 | /* |
| 3909 | * We are (ab)using the RESETTING state to prevent subsequent | ||
| 3910 | * recovery actions from interfering with the controller's | ||
| 3911 | * firmware activation. | ||
| 3912 | */ | ||
| 3913 | if (nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) | ||
| 3914 | queue_work(nvme_wq, &ctrl->fw_act_work); | ||
| 3874 | break; | 3915 | break; |
| 3875 | #ifdef CONFIG_NVME_MULTIPATH | 3916 | #ifdef CONFIG_NVME_MULTIPATH |
| 3876 | case NVME_AER_NOTICE_ANA: | 3917 | case NVME_AER_NOTICE_ANA: |
| @@ -3993,6 +4034,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, · 116 unmodified lines | |||
| 3993 | INIT_WORK(&ctrl->async_event_work, nvme_async_event_work); | 4034 | INIT_WORK(&ctrl->async_event_work, nvme_async_event_work); |
| 3994 | INIT_WORK(&ctrl->fw_act_work, nvme_fw_act_work); | 4035 | INIT_WORK(&ctrl->fw_act_work, nvme_fw_act_work); |
| 3995 | INIT_WORK(&ctrl->delete_work, nvme_delete_ctrl_work); | 4036 | INIT_WORK(&ctrl->delete_work, nvme_delete_ctrl_work); |
| 4037 | init_waitqueue_head(&ctrl->state_wq); | ||
| 3996 | 4038 | ||
| 3997 | INIT_DELAYED_WORK(&ctrl->ka_work, nvme_keep_alive_work); | 4039 | INIT_DELAYED_WORK(&ctrl->ka_work, nvme_keep_alive_work); |
| 3998 | memset(&ctrl->ka_cmd, 0, sizeof(ctrl->ka_cmd)); | 4040 | memset(&ctrl->ka_cmd, 0, sizeof(ctrl->ka_cmd)); |
| @@ -182,8 +182,7 @@ bool nvmf_ip_options_match(struct nvme_ctrl *ctrl, · 181 unmodified lines | |||
| 182 | static inline bool nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, | 182 | static inline bool nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, |
| 183 | bool queue_live) | 183 | bool queue_live) |
| 184 | { | 184 | { |
| 185 | if (likely(ctrl->state == NVME_CTRL_LIVE || | 185 | if (likely(ctrl->state == NVME_CTRL_LIVE)) |
| 186 | ctrl->state == NVME_CTRL_ADMIN_ONLY)) | ||
| 187 | return true; | 186 | return true; |
| 188 | return __nvmf_check_ready(ctrl, rq, queue_live); | 187 | return __nvmf_check_ready(ctrl, rq, queue_live); |
| 189 | } | 188 | } |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | #include <linux/sed-opal.h> | 15 | #include <linux/sed-opal.h> |
| 16 | #include <linux/fault-inject.h> | 16 | #include <linux/fault-inject.h> |
| 17 | #include <linux/rcupdate.h> | 17 | #include <linux/rcupdate.h> |
| 18 | #include <linux/wait.h> | ||
| 18 | 19 | ||
| 19 | #include <trace/events/block.h> | 20 | #include <trace/events/block.h> |
| 20 | 21 | ||
| @@ -161,7 +162,6 @@ static inline u16 nvme_req_qid(struct request *req) · 140 unmodified lines | |||
| 161 | enum nvme_ctrl_state { | 162 | enum nvme_ctrl_state { |
| 162 | NVME_CTRL_NEW, | 163 | NVME_CTRL_NEW, |
| 163 | NVME_CTRL_LIVE, | 164 | NVME_CTRL_LIVE, |
| 164 | NVME_CTRL_ADMIN_ONLY, /* Only admin queue live */ | ||
| 165 | NVME_CTRL_RESETTING, | 165 | NVME_CTRL_RESETTING, |
| 166 | NVME_CTRL_CONNECTING, | 166 | NVME_CTRL_CONNECTING, |
| 167 | NVME_CTRL_DELETING, | 167 | NVME_CTRL_DELETING, |
| @@ -199,6 +199,7 @@ struct nvme_ctrl { · 31 unmodified lines | |||
| 199 | struct cdev cdev; | 199 | struct cdev cdev; |
| 200 | struct work_struct reset_work; | 200 | struct work_struct reset_work; |
| 201 | struct work_struct delete_work; | 201 | struct work_struct delete_work; |
| 202 | wait_queue_head_t state_wq; | ||
| 202 | 203 | ||
| 203 | struct nvme_subsystem *subsys; | 204 | struct nvme_subsystem *subsys; |
| 204 | struct list_head subsys_entry; | 205 | struct list_head subsys_entry; |
| @@ -449,6 +450,7 @@ void nvme_complete_rq(struct request *req); · 244 unmodified lines | |||
| 449 | bool nvme_cancel_request(struct request *req, void *data, bool reserved); | 450 | bool nvme_cancel_request(struct request *req, void *data, bool reserved); |
| 450 | bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, | 451 | bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, |
| 451 | enum nvme_ctrl_state new_state); | 452 | enum nvme_ctrl_state new_state); |
| 453 | bool nvme_wait_reset(struct nvme_ctrl *ctrl); | ||
| 452 | int nvme_disable_ctrl(struct nvme_ctrl *ctrl); | 454 | int nvme_disable_ctrl(struct nvme_ctrl *ctrl); |
| 453 | int nvme_enable_ctrl(struct nvme_ctrl *ctrl); | 455 | int nvme_enable_ctrl(struct nvme_ctrl *ctrl); |
| 454 | int nvme_shutdown_ctrl(struct nvme_ctrl *ctrl); | 456 | int nvme_shutdown_ctrl(struct nvme_ctrl *ctrl); |
| @@ -499,6 +501,7 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count); · 44 unmodified lines | |||
| 499 | void nvme_stop_keep_alive(struct nvme_ctrl *ctrl); | 501 | void nvme_stop_keep_alive(struct nvme_ctrl *ctrl); |
| 500 | int nvme_reset_ctrl(struct nvme_ctrl *ctrl); | 502 | int nvme_reset_ctrl(struct nvme_ctrl *ctrl); |
| 501 | int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl); | 503 | int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl); |
| 504 | int nvme_try_sched_reset(struct nvme_ctrl *ctrl); | ||
| 502 | int nvme_delete_ctrl(struct nvme_ctrl *ctrl); | 505 | int nvme_delete_ctrl(struct nvme_ctrl *ctrl); |
| 503 | 506 | ||
| 504 | int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp, | 507 | int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp, |
| @@ -773,7 +773,8 @@ static blk_status_t nvme_setup_prp_simple(struct nvme_dev *dev, · 772 unmodified lines | |||
| 773 | struct bio_vec *bv) | 773 | struct bio_vec *bv) |
| 774 | { | 774 | { |
| 775 | struct nvme_iod *iod = blk_mq_rq_to_pdu(req); | 775 | struct nvme_iod *iod = blk_mq_rq_to_pdu(req); |
| 776 | unsigned int first_prp_len = dev->ctrl.page_size - bv->bv_offset; | 776 | unsigned int offset = bv->bv_offset & (dev->ctrl.page_size - 1); |
| 777 | unsigned int first_prp_len = dev->ctrl.page_size - offset; | ||
| 777 | 778 | ||
| 778 | iod->first_dma = dma_map_bvec(dev->dev, bv, rq_dma_dir(req), 0); | 779 | iod->first_dma = dma_map_bvec(dev->dev, bv, rq_dma_dir(req), 0); |
| 779 | if (dma_mapping_error(dev->dev, iod->first_dma)) | 780 | if (dma_mapping_error(dev->dev, iod->first_dma)) |
| @@ -2263,10 +2264,7 @@ static bool __nvme_disable_io_queues(struct nvme_dev *dev, u8 opcode) · 1483 unmodified lines | |||
| 2263 | return true; | 2264 | return true; |
| 2264 | } | 2265 | } |
| 2265 | 2266 | ||
| 2266 | /* | 2267 | static void nvme_dev_add(struct nvme_dev *dev) |
| 2267 | * return error value only when tagset allocation failed | ||
| 2268 | */ | ||
| 2269 | static int nvme_dev_add(struct nvme_dev *dev) | ||
| 2270 | { | 2268 | { |
| 2271 | int ret; | 2269 | int ret; |
| 2272 | 2270 | ||
| @@ -2296,7 +2294,7 @@ static int nvme_dev_add(struct nvme_dev *dev) · 23 unmodified lines | |||
| 2296 | if (ret) { | 2294 | if (ret) { |
| 2297 | dev_warn(dev->ctrl.device, | 2295 | dev_warn(dev->ctrl.device, |
| 2298 | "IO queues tagset allocation failed %d\n", ret); | 2296 | "IO queues tagset allocation failed %d\n", ret); |
| 2299 | return ret; | 2297 | return; |
| 2300 | } | 2298 | } |
| 2301 | dev->ctrl.tagset = &dev->tagset; | 2299 | dev->ctrl.tagset = &dev->tagset; |
| 2302 | } else { | 2300 | } else { |
| @@ -2307,7 +2305,6 @@ static int nvme_dev_add(struct nvme_dev *dev) · 4 unmodified lines | |||
| 2307 | } | 2305 | } |
| 2308 | 2306 | ||
| 2309 | nvme_dbbuf_set(dev); | 2307 | nvme_dbbuf_set(dev); |
| 2310 | return 0; | ||
| 2311 | } | 2308 | } |
| 2312 | 2309 | ||
| 2313 | static int nvme_pci_enable(struct nvme_dev *dev) | 2310 | static int nvme_pci_enable(struct nvme_dev *dev) |
| @@ -2467,6 +2464,14 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) · 153 unmodified lines | |||
| 2467 | mutex_unlock(&dev->shutdown_lock); | 2464 | mutex_unlock(&dev->shutdown_lock); |
| 2468 | } | 2465 | } |
| 2469 | 2466 | ||
| 2467 | static int nvme_disable_prepare_reset(struct nvme_dev *dev, bool shutdown) | ||
| 2468 | { | ||
| 2469 | if (!nvme_wait_reset(&dev->ctrl)) | ||
| 2470 | return -EBUSY; | ||
| 2471 | nvme_dev_disable(dev, shutdown); | ||
| 2472 | return 0; | ||
| 2473 | } | ||
| 2474 | |||
| 2470 | static int nvme_setup_prp_pools(struct nvme_dev *dev) | 2475 | static int nvme_setup_prp_pools(struct nvme_dev *dev) |
| 2471 | { | 2476 | { |
| 2472 | dev->prp_page_pool = dma_pool_create("prp list page", dev->dev, | 2477 | dev->prp_page_pool = dma_pool_create("prp list page", dev->dev, |
| @@ -2490,14 +2495,20 @@ static void nvme_release_prp_pools(struct nvme_dev *dev) · 17 unmodified lines | |||
| 2490 | dma_pool_destroy(dev->prp_small_pool); | 2495 | dma_pool_destroy(dev->prp_small_pool); |
| 2491 | } | 2496 | } |
| 2492 | 2497 | ||
| 2498 | static void nvme_free_tagset(struct nvme_dev *dev) | ||
| 2499 | { | ||
| 2500 | if (dev->tagset.tags) | ||
| 2501 | blk_mq_free_tag_set(&dev->tagset); | ||
| 2502 | dev->ctrl.tagset = NULL; | ||
| 2503 | } | ||
| 2504 | |||
| 2493 | static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl) | 2505 | static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl) |
| 2494 | { | 2506 | { |
| 2495 | struct nvme_dev *dev = to_nvme_dev(ctrl); | 2507 | struct nvme_dev *dev = to_nvme_dev(ctrl); |
| 2496 | 2508 | ||
| 2497 | nvme_dbbuf_dma_free(dev); | 2509 | nvme_dbbuf_dma_free(dev); |
| 2498 | put_device(dev->dev); | 2510 | put_device(dev->dev); |
| 2499 | if (dev->tagset.tags) | 2511 | nvme_free_tagset(dev); |
| 2500 | blk_mq_free_tag_set(&dev->tagset); | ||
| 2501 | if (dev->ctrl.admin_q) | 2512 | if (dev->ctrl.admin_q) |
| 2502 | blk_put_queue(dev->ctrl.admin_q); | 2513 | blk_put_queue(dev->ctrl.admin_q); |
| 2503 | kfree(dev->queues); | 2514 | kfree(dev->queues); |
| @@ -2508,6 +2519,11 @@ static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl) · 4 unmodified lines | |||
| 2508 | 2519 | ||
| 2509 | static void nvme_remove_dead_ctrl(struct nvme_dev *dev) | 2520 | static void nvme_remove_dead_ctrl(struct nvme_dev *dev) |
| 2510 | { | 2521 | { |
| 2522 | /* | ||
| 2523 | * Set state to deleting now to avoid blocking nvme_wait_reset(), which | ||
| 2524 | * may be holding this pci_dev's device lock. | ||
| 2525 | */ | ||
| 2526 | nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING); | ||
| 2511 | nvme_get_ctrl(&dev->ctrl); | 2527 | nvme_get_ctrl(&dev->ctrl); |
| 2512 | nvme_dev_disable(dev, false); | 2528 | nvme_dev_disable(dev, false); |
| 2513 | nvme_kill_queues(&dev->ctrl); | 2529 | nvme_kill_queues(&dev->ctrl); |
| @@ -2521,7 +2537,6 @@ static void nvme_reset_work(struct work_struct *work) · 7 unmodified lines | |||
| 2521 | container_of(work, struct nvme_dev, ctrl.reset_work); | 2537 | container_of(work, struct nvme_dev, ctrl.reset_work); |
| 2522 | bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL); | 2538 | bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL); |
| 2523 | int result; | 2539 | int result; |
| 2524 | enum nvme_ctrl_state new_state = NVME_CTRL_LIVE; | ||
| 2525 | 2540 | ||
| 2526 | if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) { | 2541 | if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) { |
| 2527 | result = -ENODEV; | 2542 | result = -ENODEV; |
| @@ -2615,13 +2630,11 @@ static void nvme_reset_work(struct work_struct *work) · 87 unmodified lines | |||
| 2615 | dev_warn(dev->ctrl.device, "IO queues not created\n"); | 2630 | dev_warn(dev->ctrl.device, "IO queues not created\n"); |
| 2616 | nvme_kill_queues(&dev->ctrl); | 2631 | nvme_kill_queues(&dev->ctrl); |
| 2617 | nvme_remove_namespaces(&dev->ctrl); | 2632 | nvme_remove_namespaces(&dev->ctrl); |
| 2618 | new_state = NVME_CTRL_ADMIN_ONLY; | 2633 | nvme_free_tagset(dev); |
| 2619 | } else { | 2634 | } else { |
| 2620 | nvme_start_queues(&dev->ctrl); | 2635 | nvme_start_queues(&dev->ctrl); |
| 2621 | nvme_wait_freeze(&dev->ctrl); | 2636 | nvme_wait_freeze(&dev->ctrl); |
| 2622 | /* hit this only when allocate tagset fails */ | 2637 | nvme_dev_add(dev); |
| 2623 | if (nvme_dev_add(dev)) | ||
| 2624 | new_state = NVME_CTRL_ADMIN_ONLY; | ||
| 2625 | nvme_unfreeze(&dev->ctrl); | 2638 | nvme_unfreeze(&dev->ctrl); |
| 2626 | } | 2639 | } |
| 2627 | 2640 | ||
| @@ -2629,9 +2642,9 @@ static void nvme_reset_work(struct work_struct *work) · 1 unmodified line | |||
| 2629 | * If only admin queue live, keep it to do further investigation or | 2642 | * If only admin queue live, keep it to do further investigation or |
| 2630 | * recovery. | 2643 | * recovery. |
| 2631 | */ | 2644 | */ |
| 2632 | if (!nvme_change_ctrl_state(&dev->ctrl, new_state)) { | 2645 | if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_LIVE)) { |
| 2633 | dev_warn(dev->ctrl.device, | 2646 | dev_warn(dev->ctrl.device, |
| 2634 | "failed to mark controller state %d\n", new_state); | 2647 | "failed to mark controller live state\n"); |
| 2635 | result = -ENODEV; | 2648 | result = -ENODEV; |
| 2636 | goto out; | 2649 | goto out; |
| 2637 | } | 2650 | } |
| @@ -2672,7 +2685,7 @@ static int nvme_pci_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val) · 34 unmodified lines | |||
| 2672 | 2685 | ||
| 2673 | static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val) | 2686 | static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val) |
| 2674 | { | 2687 | { |
| 2675 | *val = readq(to_nvme_dev(ctrl)->bar + off); | 2688 | *val = lo_hi_readq(to_nvme_dev(ctrl)->bar + off); |
| 2676 | return 0; | 2689 | return 0; |
| 2677 | } | 2690 | } |
| 2678 | 2691 | ||
| @@ -2836,19 +2849,28 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 157 unmodified lines | |||
| 2836 | static void nvme_reset_prepare(struct pci_dev *pdev) | 2849 | static void nvme_reset_prepare(struct pci_dev *pdev) |
| 2837 | { | 2850 | { |
| 2838 | struct nvme_dev *dev = pci_get_drvdata(pdev); | 2851 | struct nvme_dev *dev = pci_get_drvdata(pdev); |
| 2839 | nvme_dev_disable(dev, false); | 2852 | |
| 2853 | /* | ||
| 2854 | * We don't need to check the return value from waiting for the reset | ||
| 2855 | * state as pci_dev device lock is held, making it impossible to race | ||
| 2856 | * with ->remove(). | ||
| 2857 | */ | ||
| 2858 | nvme_disable_prepare_reset(dev, false); | ||
| 2859 | nvme_sync_queues(&dev->ctrl); | ||
| 2840 | } | 2860 | } |
| 2841 | 2861 | ||
| 2842 | static void nvme_reset_done(struct pci_dev *pdev) | 2862 | static void nvme_reset_done(struct pci_dev *pdev) |
| 2843 | { | 2863 | { |
| 2844 | struct nvme_dev *dev = pci_get_drvdata(pdev); | 2864 | struct nvme_dev *dev = pci_get_drvdata(pdev); |
| 2845 | nvme_reset_ctrl_sync(&dev->ctrl); | 2865 | |
| 2866 | if (!nvme_try_sched_reset(&dev->ctrl)) | ||
| 2867 | flush_work(&dev->ctrl.reset_work); | ||
| 2846 | } | 2868 | } |
| 2847 | 2869 | ||
| 2848 | static void nvme_shutdown(struct pci_dev *pdev) | 2870 | static void nvme_shutdown(struct pci_dev *pdev) |
| 2849 | { | 2871 | { |
| 2850 | struct nvme_dev *dev = pci_get_drvdata(pdev); | 2872 | struct nvme_dev *dev = pci_get_drvdata(pdev); |
| 2851 | nvme_dev_disable(dev, true); | 2873 | nvme_disable_prepare_reset(dev, true); |
| 2852 | } | 2874 | } |
| 2853 | 2875 | ||
| 2854 | /* | 2876 | /* |
| @@ -2901,7 +2923,7 @@ static int nvme_resume(struct device *dev) · 46 unmodified lines | |||
| 2901 | 2923 | ||
| 2902 | if (ndev->last_ps == U32_MAX || | 2924 | if (ndev->last_ps == U32_MAX || |
| 2903 | nvme_set_power_state(ctrl, ndev->last_ps) != 0) | 2925 | nvme_set_power_state(ctrl, ndev->last_ps) != 0) |
| 2904 | nvme_reset_ctrl(ctrl); | 2926 | return nvme_try_sched_reset(&ndev->ctrl); |
| 2905 | return 0; | 2927 | return 0; |
| 2906 | } | 2928 | } |
| 2907 | 2929 | ||
| @@ -2929,17 +2951,14 @@ static int nvme_suspend(struct device *dev) · 21 unmodified lines | |||
| 2929 | */ | 2951 | */ |
| 2930 | if (pm_suspend_via_firmware() || !ctrl->npss || | 2952 | if (pm_suspend_via_firmware() || !ctrl->npss || |
| 2931 | !pcie_aspm_enabled(pdev) || | 2953 | !pcie_aspm_enabled(pdev) || |
| 2932 | (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) { | 2954 | (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) |
| 2933 | nvme_dev_disable(ndev, true); | 2955 | return nvme_disable_prepare_reset(ndev, true); |
| 2934 | return 0; | ||
| 2935 | } | ||
| 2936 | 2956 | ||
| 2937 | nvme_start_freeze(ctrl); | 2957 | nvme_start_freeze(ctrl); |
| 2938 | nvme_wait_freeze(ctrl); | 2958 | nvme_wait_freeze(ctrl); |
| 2939 | nvme_sync_queues(ctrl); | 2959 | nvme_sync_queues(ctrl); |
| 2940 | 2960 | ||
| 2941 | if (ctrl->state != NVME_CTRL_LIVE && | 2961 | if (ctrl->state != NVME_CTRL_LIVE) |
| 2942 | ctrl->state != NVME_CTRL_ADMIN_ONLY) | ||
| 2943 | goto unfreeze; | 2962 | goto unfreeze; |
| 2944 | 2963 | ||
| 2945 | ret = nvme_get_power_state(ctrl, &ndev->last_ps); | 2964 | ret = nvme_get_power_state(ctrl, &ndev->last_ps); |
| @@ -2965,9 +2984,8 @@ static int nvme_suspend(struct device *dev) · 19 unmodified lines | |||
| 2965 | * Clearing npss forces a controller reset on resume. The | 2984 | * Clearing npss forces a controller reset on resume. The |
| 2966 | * correct value will be resdicovered then. | 2985 | * correct value will be resdicovered then. |
| 2967 | */ | 2986 | */ |
| 2968 | nvme_dev_disable(ndev, true); | 2987 | ret = nvme_disable_prepare_reset(ndev, true); |
| 2969 | ctrl->npss = 0; | 2988 | ctrl->npss = 0; |
| 2970 | ret = 0; | ||
| 2971 | } | 2989 | } |
| 2972 | unfreeze: | 2990 | unfreeze: |
| 2973 | nvme_unfreeze(ctrl); | 2991 | nvme_unfreeze(ctrl); |
| @@ -2977,9 +2995,7 @@ unfreeze: · 3 unmodified lines | |||
| 2977 | static int nvme_simple_suspend(struct device *dev) | 2995 | static int nvme_simple_suspend(struct device *dev) |
| 2978 | { | 2996 | { |
| 2979 | struct nvme_dev *ndev = pci_get_drvdata(to_pci_dev(dev)); | 2997 | struct nvme_dev *ndev = pci_get_drvdata(to_pci_dev(dev)); |
| 2980 | 2998 | return nvme_disable_prepare_reset(ndev, true); | |
| 2981 | nvme_dev_disable(ndev, true); | ||
| 2982 | return 0; | ||
| 2983 | } | 2999 | } |
| 2984 | 3000 | ||
| 2985 | static int nvme_simple_resume(struct device *dev) | 3001 | static int nvme_simple_resume(struct device *dev) |
| @@ -2987,8 +3003,7 @@ static int nvme_simple_resume(struct device *dev) · 1 unmodified line | |||
| 2987 | struct pci_dev *pdev = to_pci_dev(dev); | 3003 | struct pci_dev *pdev = to_pci_dev(dev); |
| 2988 | struct nvme_dev *ndev = pci_get_drvdata(pdev); | 3004 | struct nvme_dev *ndev = pci_get_drvdata(pdev); |
| 2989 | 3005 | ||
| 2990 | nvme_reset_ctrl(&ndev->ctrl); | 3006 | return nvme_try_sched_reset(&ndev->ctrl); |
| 2991 | return 0; | ||
| 2992 | } | 3007 | } |
| 2993 | 3008 | ||
| 2994 | static const struct dev_pm_ops nvme_dev_pm_ops = { | 3009 | static const struct dev_pm_ops nvme_dev_pm_ops = { |
| @@ -1701,6 +1701,14 @@ nvme_rdma_timeout(struct request *rq, bool reserved) · 1700 unmodified lines | |||
| 1701 | dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", | 1701 | dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", |
| 1702 | rq->tag, nvme_rdma_queue_idx(queue)); | 1702 | rq->tag, nvme_rdma_queue_idx(queue)); |
| 1703 | 1703 | ||
| 1704 | /* | ||
| 1705 | * Restart the timer if a controller reset is already scheduled. Any | ||
| 1706 | * timed out commands would be handled before entering the connecting | ||
| 1707 | * state. | ||
| 1708 | */ | ||
| 1709 | if (ctrl->ctrl.state == NVME_CTRL_RESETTING) | ||
| 1710 | return BLK_EH_RESET_TIMER; | ||
| 1711 | |||
| 1704 | if (ctrl->ctrl.state != NVME_CTRL_LIVE) { | 1712 | if (ctrl->ctrl.state != NVME_CTRL_LIVE) { |
| 1705 | /* | 1713 | /* |
| 1706 | * Teardown immediately if controller times out while starting | 1714 | * Teardown immediately if controller times out while starting |
| @@ -1386,7 +1386,9 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, · 1385 unmodified lines | |||
| 1386 | queue->sock->sk->sk_data_ready = nvme_tcp_data_ready; | 1386 | queue->sock->sk->sk_data_ready = nvme_tcp_data_ready; |
| 1387 | queue->sock->sk->sk_state_change = nvme_tcp_state_change; | 1387 | queue->sock->sk->sk_state_change = nvme_tcp_state_change; |
| 1388 | queue->sock->sk->sk_write_space = nvme_tcp_write_space; | 1388 | queue->sock->sk->sk_write_space = nvme_tcp_write_space; |
| 1389 | #ifdef CONFIG_NET_RX_BUSY_POLL | ||
| 1389 | queue->sock->sk->sk_ll_usec = 1; | 1390 | queue->sock->sk->sk_ll_usec = 1; |
| 1391 | #endif | ||
| 1390 | write_unlock_bh(&queue->sock->sk->sk_callback_lock); | 1392 | write_unlock_bh(&queue->sock->sk->sk_callback_lock); |
| 1391 | 1393 | ||
| 1392 | return 0; | 1394 | return 0; |
| @@ -2044,6 +2046,14 @@ nvme_tcp_timeout(struct request *rq, bool reserved) · 651 unmodified lines | |||
| 2044 | struct nvme_tcp_ctrl *ctrl = req->queue->ctrl; | 2046 | struct nvme_tcp_ctrl *ctrl = req->queue->ctrl; |
| 2045 | struct nvme_tcp_cmd_pdu *pdu = req->pdu; | 2047 | struct nvme_tcp_cmd_pdu *pdu = req->pdu; |
| 2046 | 2048 | ||
| 2049 | /* | ||
| 2050 | * Restart the timer if a controller reset is already scheduled. Any | ||
| 2051 | * timed out commands would be handled before entering the connecting | ||
| 2052 | * state. | ||
| 2053 | */ | ||
| 2054 | if (ctrl->ctrl.state == NVME_CTRL_RESETTING) | ||
| 2055 | return BLK_EH_RESET_TIMER; | ||
| 2056 | |||
| 2047 | dev_warn(ctrl->ctrl.device, | 2057 | dev_warn(ctrl->ctrl.device, |
| 2048 | "queue %d: timeout request %#x type %d\n", | 2058 | "queue %d: timeout request %#x type %d\n", |
| 2049 | nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type); | 2059 | nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type); |
| @@ -2126,6 +2136,7 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns, · 76 unmodified lines | |||
| 2126 | 2136 | ||
| 2127 | ret = nvme_tcp_map_data(queue, rq); | 2137 | ret = nvme_tcp_map_data(queue, rq); |
| 2128 | if (unlikely(ret)) { | 2138 | if (unlikely(ret)) { |
| 2139 | nvme_cleanup_cmd(rq); | ||
| 2129 | dev_err(queue->ctrl->ctrl.device, | 2140 | dev_err(queue->ctrl->ctrl.device, |
| 2130 | "Failed to map data (%d)\n", ret); | 2141 | "Failed to map data (%d)\n", ret); |
| 2131 | return ret; | 2142 | return ret; |
| @@ -157,8 +157,10 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, · 156 unmodified lines | |||
| 157 | iod->sg_table.sgl = iod->first_sgl; | 157 | iod->sg_table.sgl = iod->first_sgl; |
| 158 | if (sg_alloc_table_chained(&iod->sg_table, | 158 | if (sg_alloc_table_chained(&iod->sg_table, |
| 159 | blk_rq_nr_phys_segments(req), | 159 | blk_rq_nr_phys_segments(req), |
| 160 | iod->sg_table.sgl, SG_CHUNK_SIZE)) | 160 | iod->sg_table.sgl, SG_CHUNK_SIZE)) { |
| 161 | nvme_cleanup_cmd(req); | ||
| 161 | return BLK_STS_RESOURCE; | 162 | return BLK_STS_RESOURCE; |
| 163 | } | ||
| 162 | 164 | ||
| 163 | iod->req.sg = iod->sg_table.sgl; | 165 | iod->req.sg = iod->sg_table.sgl; |
| 164 | iod->req.sg_cnt = blk_rq_map_sg(req->q, req, iod->sg_table.sgl); | 166 | iod->req.sg_cnt = blk_rq_map_sg(req->q, req, iod->sg_table.sgl); |
| @@ -324,8 +324,10 @@ int of_reserved_mem_device_init_by_idx(struct device *dev, · 323 unmodified lines | |||
| 324 | if (!target) | 324 | if (!target) |
| 325 | return -ENODEV; | 325 | return -ENODEV; |
| 326 | 326 | ||
| 327 | if (!of_device_is_available(target)) | 327 | if (!of_device_is_available(target)) { |
| 328 | of_node_put(target); | ||
| 328 | return 0; | 329 | return 0; |
| 330 | } | ||
| 329 | 331 | ||
| 330 | rmem = __find_rmem(target); | 332 | rmem = __find_rmem(target); |
| 331 | of_node_put(target); | 333 | of_node_put(target); |
| @@ -1207,6 +1207,7 @@ static int __init unittest_data_add(void) · 1206 unmodified lines | |||
| 1207 | of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node); | 1207 | of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node); |
| 1208 | if (!unittest_data_node) { | 1208 | if (!unittest_data_node) { |
| 1209 | pr_warn("%s: No tree to attach; not running tests\n", __func__); | 1209 | pr_warn("%s: No tree to attach; not running tests\n", __func__); |
| 1210 | kfree(unittest_data); | ||
| 1210 | return -ENODATA; | 1211 | return -ENODATA; |
| 1211 | } | 1212 | } |
| 1212 | 1213 | ||
| @@ -1626,12 +1626,6 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, · 1625 unmodified lines | |||
| 1626 | goto free_regulators; | 1626 | goto free_regulators; |
| 1627 | } | 1627 | } |
| 1628 | 1628 | ||
| 1629 | ret = regulator_enable(reg); | ||
| 1630 | if (ret < 0) { | ||
| 1631 | regulator_put(reg); | ||
| 1632 | goto free_regulators; | ||
| 1633 | } | ||
| 1634 | |||
| 1635 | opp_table->regulators[i] = reg; | 1629 | opp_table->regulators[i] = reg; |
| 1636 | } | 1630 | } |
| 1637 | 1631 | ||
| @@ -1645,10 +1639,8 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, · 7 unmodified lines | |||
| 1645 | return opp_table; | 1639 | return opp_table; |
| 1646 | 1640 | ||
| 1647 | free_regulators: | 1641 | free_regulators: |
| 1648 | while (i--) { | 1642 | while (i != 0) |
| 1649 | regulator_disable(opp_table->regulators[i]); | 1643 | regulator_put(opp_table->regulators[--i]); |
| 1650 | regulator_put(opp_table->regulators[i]); | ||
| 1651 | } | ||
| 1652 | 1644 | ||
| 1653 | kfree(opp_table->regulators); | 1645 | kfree(opp_table->regulators); |
| 1654 | opp_table->regulators = NULL; | 1646 | opp_table->regulators = NULL; |
| @@ -1674,10 +1666,8 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) · 19 unmodified lines | |||
| 1674 | /* Make sure there are no concurrent readers while updating opp_table */ | 1666 | /* Make sure there are no concurrent readers while updating opp_table */ |
| 1675 | WARN_ON(!list_empty(&opp_table->opp_list)); | 1667 | WARN_ON(!list_empty(&opp_table->opp_list)); |
| 1676 | 1668 | ||
| 1677 | for (i = opp_table->regulator_count - 1; i >= 0; i--) { | 1669 | for (i = opp_table->regulator_count - 1; i >= 0; i--) |
| 1678 | regulator_disable(opp_table->regulators[i]); | ||
| 1679 | regulator_put(opp_table->regulators[i]); | 1670 | regulator_put(opp_table->regulators[i]); |
| 1680 | } | ||
| 1681 | 1671 | ||
| 1682 | _free_set_opp_data(opp_table); | 1672 | _free_set_opp_data(opp_table); |
| 1683 | 1673 | ||
| @@ -77,8 +77,6 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table, · 76 unmodified lines | |||
| 77 | { | 77 | { |
| 78 | struct dev_pm_opp *opp; | 78 | struct dev_pm_opp *opp; |
| 79 | 79 | ||
| 80 | lockdep_assert_held(&opp_table_lock); | ||
| 81 | |||
| 82 | mutex_lock(&opp_table->lock); | 80 | mutex_lock(&opp_table->lock); |
| 83 | 81 | ||
| 84 | list_for_each_entry(opp, &opp_table->opp_list, node) { | 82 | list_for_each_entry(opp, &opp_table->opp_list, node) { |
| @@ -665,6 +663,13 @@ static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table) · 580 unmodified lines | |||
| 665 | return 0; | 663 | return 0; |
| 666 | } | 664 | } |
| 667 | 665 | ||
| 666 | /* | ||
| 667 | * Re-initialize list_kref every time we add static OPPs to the OPP | ||
| 668 | * table as the reference count may be 0 after the last tie static OPPs | ||
| 669 | * were removed. | ||
| 670 | */ | ||
| 671 | kref_init(&opp_table->list_kref); | ||
| 672 | |||
| 668 | /* We have opp-table node now, iterate over it and add OPPs */ | 673 | /* We have opp-table node now, iterate over it and add OPPs */ |
| 669 | for_each_available_child_of_node(opp_table->np, np) { | 674 | for_each_available_child_of_node(opp_table->np, np) { |
| 670 | opp = _opp_add_static_v2(opp_table, dev, np); | 675 | opp = _opp_add_static_v2(opp_table, dev, np); |
| @@ -678,14 +678,6 @@ static int sba_dma_supported( struct device *dev, u64 mask) · 677 unmodified lines | |||
| 678 | return(0); | 678 | return(0); |
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | /* Documentation/DMA-API-HOWTO.txt tells drivers to try 64-bit | ||
| 682 | * first, then fall back to 32-bit if that fails. | ||
| 683 | * We are just "encouraging" 32-bit DMA masks here since we can | ||
| 684 | * never allow IOMMU bypass unless we add special support for ZX1. | ||
| 685 | */ | ||
| 686 | if (mask > ~0U) | ||
| 687 | return 0; | ||
| 688 | |||
| 689 | ioc = GET_IOC(dev); | 681 | ioc = GET_IOC(dev); |
| 690 | if (!ioc) | 682 | if (!ioc) |
| 691 | return 0; | 683 | return 0; |
| @@ -958,19 +958,6 @@ void pci_refresh_power_state(struct pci_dev *dev) · 957 unmodified lines | |||
| 958 | pci_update_current_state(dev, dev->current_state); | 958 | pci_update_current_state(dev, dev->current_state); |
| 959 | } | 959 | } |
| 960 | 960 | ||
| 961 | /** | ||
| 962 | * pci_power_up - Put the given device into D0 forcibly | ||
| 963 | * @dev: PCI device to power up | ||
| 964 | */ | ||
| 965 | void pci_power_up(struct pci_dev *dev) | ||
| 966 | { | ||
| 967 | if (platform_pci_power_manageable(dev)) | ||
| 968 | platform_pci_set_power_state(dev, PCI_D0); | ||
| 969 | |||
| 970 | pci_raw_set_power_state(dev, PCI_D0); | ||
| 971 | pci_update_current_state(dev, PCI_D0); | ||
| 972 | } | ||
| 973 | |||
| 974 | /** | 961 | /** |
| 975 | * pci_platform_power_transition - Use platform to change device power state | 962 | * pci_platform_power_transition - Use platform to change device power state |
| 976 | * @dev: PCI device to handle. | 963 | * @dev: PCI device to handle. |
| @@ -1153,6 +1140,17 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) · 176 unmodified lines | |||
| 1153 | } | 1140 | } |
| 1154 | EXPORT_SYMBOL(pci_set_power_state); | 1141 | EXPORT_SYMBOL(pci_set_power_state); |
| 1155 | 1142 | ||
| 1143 | /** | ||
| 1144 | * pci_power_up - Put the given device into D0 forcibly | ||
| 1145 | * @dev: PCI device to power up | ||
| 1146 | */ | ||
| 1147 | void pci_power_up(struct pci_dev *dev) | ||
| 1148 | { | ||
| 1149 | __pci_start_power_transition(dev, PCI_D0); | ||
| 1150 | pci_raw_set_power_state(dev, PCI_D0); | ||
| 1151 | pci_update_current_state(dev, PCI_D0); | ||
| 1152 | } | ||
| 1153 | |||
| 1156 | /** | 1154 | /** |
| 1157 | * pci_choose_state - Choose the power state of a PCI device | 1155 | * pci_choose_state - Choose the power state of a PCI device |
| 1158 | * @dev: PCI device to be suspended | 1156 | * @dev: PCI device to be suspended |
| @@ -87,7 +87,7 @@ FUNC_GROUP_DECL(MACLINK3, L23); · 86 unmodified lines | |||
| 87 | 87 | ||
| 88 | #define K25 7 | 88 | #define K25 7 |
| 89 | SIG_EXPR_LIST_DECL_SESG(K25, MACLINK4, MACLINK4, SIG_DESC_SET(SCU410, 7)); | 89 | SIG_EXPR_LIST_DECL_SESG(K25, MACLINK4, MACLINK4, SIG_DESC_SET(SCU410, 7)); |
| 90 | SIG_EXPR_LIST_DECL_SESG(K25, SDA14, SDA14, SIG_DESC_SET(SCU4B0, 7)); | 90 | SIG_EXPR_LIST_DECL_SESG(K25, SDA14, I2C14, SIG_DESC_SET(SCU4B0, 7)); |
| 91 | PIN_DECL_2(K25, GPIOA7, MACLINK4, SDA14); | 91 | PIN_DECL_2(K25, GPIOA7, MACLINK4, SDA14); |
| 92 | FUNC_GROUP_DECL(MACLINK4, K25); | 92 | FUNC_GROUP_DECL(MACLINK4, K25); |
| 93 | 93 | ||
| @@ -1262,13 +1262,13 @@ GROUP_DECL(SPI1, AB11, AC11, AA11); · 1168 unmodified lines | |||
| 1262 | #define AD11 206 | 1262 | #define AD11 206 |
| 1263 | SIG_EXPR_LIST_DECL_SEMG(AD11, SPI1DQ2, QSPI1, SPI1, SIG_DESC_SET(SCU438, 14)); | 1263 | SIG_EXPR_LIST_DECL_SEMG(AD11, SPI1DQ2, QSPI1, SPI1, SIG_DESC_SET(SCU438, 14)); |
| 1264 | SIG_EXPR_LIST_DECL_SEMG(AD11, TXD13, UART13G1, UART13, | 1264 | SIG_EXPR_LIST_DECL_SEMG(AD11, TXD13, UART13G1, UART13, |
| 1265 | SIG_DESC_SET(SCU438, 14)); | 1265 | SIG_DESC_CLEAR(SCU4B8, 2), SIG_DESC_SET(SCU4D8, 14)); |
| 1266 | PIN_DECL_2(AD11, GPIOZ6, SPI1DQ2, TXD13); | 1266 | PIN_DECL_2(AD11, GPIOZ6, SPI1DQ2, TXD13); |
| 1267 | 1267 | ||
| 1268 | #define AF10 207 | 1268 | #define AF10 207 |
| 1269 | SIG_EXPR_LIST_DECL_SEMG(AF10, SPI1DQ3, QSPI1, SPI1, SIG_DESC_SET(SCU438, 15)); | 1269 | SIG_EXPR_LIST_DECL_SEMG(AF10, SPI1DQ3, QSPI1, SPI1, SIG_DESC_SET(SCU438, 15)); |
| 1270 | SIG_EXPR_LIST_DECL_SEMG(AF10, RXD13, UART13G1, UART13, | 1270 | SIG_EXPR_LIST_DECL_SEMG(AF10, RXD13, UART13G1, UART13, |
| 1271 | SIG_DESC_SET(SCU438, 15)); | 1271 | SIG_DESC_CLEAR(SCU4B8, 3), SIG_DESC_SET(SCU4D8, 15)); |
| 1272 | PIN_DECL_2(AF10, GPIOZ7, SPI1DQ3, RXD13); | 1272 | PIN_DECL_2(AF10, GPIOZ7, SPI1DQ3, RXD13); |
| 1273 | 1273 | ||
| 1274 | GROUP_DECL(QSPI1, AB11, AC11, AA11, AD11, AF10); | 1274 | GROUP_DECL(QSPI1, AB11, AC11, AA11, AD11, AF10); |
| @@ -1440,91 +1440,85 @@ FUNC_GROUP_DECL(RGMII2, D4, C2, C1, D3, E4, F5, D2, E3, D1, F4, E2, E1); · 165 unmodified lines | |||
| 1440 | FUNC_GROUP_DECL(RMII2, D4, C2, C1, D3, D2, D1, F4, E2, E1); | 1440 | FUNC_GROUP_DECL(RMII2, D4, C2, C1, D3, D2, D1, F4, E2, E1); |
| 1441 | 1441 | ||
| 1442 | #define AB4 232 | 1442 | #define AB4 232 |
| 1443 | SIG_EXPR_LIST_DECL_SESG(AB4, SD3CLK, SD3, SIG_DESC_SET(SCU400, 24)); | 1443 | SIG_EXPR_LIST_DECL_SEMG(AB4, EMMCCLK, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 24)); |
| 1444 | PIN_DECL_1(AB4, GPIO18D0, SD3CLK); | 1444 | PIN_DECL_1(AB4, GPIO18D0, EMMCCLK); |
| 1445 | 1445 | ||
| 1446 | #define AA4 233 | 1446 | #define AA4 233 |
| 1447 | SIG_EXPR_LIST_DECL_SESG(AA4, SD3CMD, SD3, SIG_DESC_SET(SCU400, 25)); | 1447 | SIG_EXPR_LIST_DECL_SEMG(AA4, EMMCCMD, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 25)); |
| 1448 | PIN_DECL_1(AA4, GPIO18D1, SD3CMD); | 1448 | PIN_DECL_1(AA4, GPIO18D1, EMMCCMD); |
| 1449 | 1449 | ||
| 1450 | #define AC4 234 | 1450 | #define AC4 234 |
| 1451 | SIG_EXPR_LIST_DECL_SESG(AC4, SD3DAT0, SD3, SIG_DESC_SET(SCU400, 26)); | 1451 | SIG_EXPR_LIST_DECL_SEMG(AC4, EMMCDAT0, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 26)); |
| 1452 | PIN_DECL_1(AC4, GPIO18D2, SD3DAT0); | 1452 | PIN_DECL_1(AC4, GPIO18D2, EMMCDAT0); |
| 1453 | 1453 | ||
| 1454 | #define AA5 235 | 1454 | #define AA5 235 |
| 1455 | SIG_EXPR_LIST_DECL_SESG(AA5, SD3DAT1, SD3, SIG_DESC_SET(SCU400, 27)); | 1455 | SIG_EXPR_LIST_DECL_SEMG(AA5, EMMCDAT1, EMMCG4, EMMC, SIG_DESC_SET(SCU400, 27)); |
| 1456 | PIN_DECL_1(AA5, GPIO18D3, SD3DAT1); | 1456 | PIN_DECL_1(AA5, GPIO18D3, EMMCDAT1); |
| 1457 | 1457 | ||
| 1458 | #define Y5 236 | 1458 | #define Y5 236 |
| 1459 | SIG_EXPR_LIST_DECL_SESG(Y5, SD3DAT2, SD3, SIG_DESC_SET(SCU400, 28)); | 1459 | SIG_EXPR_LIST_DECL_SEMG(Y5, EMMCDAT2, EMMCG4, EMMC, SIG_DESC_SET(SCU400, 28)); |
| 1460 | PIN_DECL_1(Y5, GPIO18D4, SD3DAT2); | 1460 | PIN_DECL_1(Y5, GPIO18D4, EMMCDAT2); |
| 1461 | 1461 | ||
| 1462 | #define AB5 237 | 1462 | #define AB5 237 |
| 1463 | SIG_EXPR_LIST_DECL_SESG(AB5, SD3DAT3, SD3, SIG_DESC_SET(SCU400, 29)); | 1463 | SIG_EXPR_LIST_DECL_SEMG(AB5, EMMCDAT3, EMMCG4, EMMC, SIG_DESC_SET(SCU400, 29)); |
| 1464 | PIN_DECL_1(AB5, GPIO18D5, SD3DAT3); | 1464 | PIN_DECL_1(AB5, GPIO18D5, EMMCDAT3); |
| 1465 | 1465 | ||
| 1466 | #define AB6 238 | 1466 | #define AB6 238 |
| 1467 | SIG_EXPR_LIST_DECL_SESG(AB6, SD3CD, SD3, SIG_DESC_SET(SCU400, 30)); | 1467 | SIG_EXPR_LIST_DECL_SEMG(AB6, EMMCCD, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 30)); |
| 1468 | PIN_DECL_1(AB6, GPIO18D6, SD3CD); | 1468 | PIN_DECL_1(AB6, GPIO18D6, EMMCCD); |
| 1469 | 1469 | ||
| 1470 | #define AC5 239 | 1470 | #define AC5 239 |
| 1471 | SIG_EXPR_LIST_DECL_SESG(AC5, SD3WP, SD3, SIG_DESC_SET(SCU400, 31)); | 1471 | SIG_EXPR_LIST_DECL_SEMG(AC5, EMMCWP, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 31)); |
| 1472 | PIN_DECL_1(AC5, GPIO18D7, SD3WP); | 1472 | PIN_DECL_1(AC5, GPIO18D7, EMMCWP); |
| 1473 | 1473 | ||
| 1474 | FUNC_GROUP_DECL(SD3, AB4, AA4, AC4, AA5, Y5, AB5, AB6, AC5); | 1474 | GROUP_DECL(EMMCG1, AB4, AA4, AC4, AB6, AC5); |
| 1475 | GROUP_DECL(EMMCG4, AB4, AA4, AC4, AA5, Y5, AB5, AB6, AC5); | ||
| 1475 | 1476 | ||
| 1476 | #define Y1 240 | 1477 | #define Y1 240 |
| 1477 | SIG_EXPR_LIST_DECL_SEMG(Y1, FWSPIDCS, FWSPID, FWSPID, SIG_DESC_SET(SCU500, 3)); | 1478 | SIG_EXPR_LIST_DECL_SEMG(Y1, FWSPIDCS, FWSPID, FWSPID, SIG_DESC_SET(SCU500, 3)); |
| 1478 | SIG_EXPR_LIST_DECL_SESG(Y1, VBCS, VB, SIG_DESC_SET(SCU500, 5)); | 1479 | SIG_EXPR_LIST_DECL_SESG(Y1, VBCS, VB, SIG_DESC_SET(SCU500, 5)); |
| 1479 | SIG_EXPR_LIST_DECL_SESG(Y1, SD3DAT4, SD3DAT4, SIG_DESC_SET(SCU404, 0)); | 1480 | SIG_EXPR_LIST_DECL_SEMG(Y1, EMMCDAT4, EMMCG8, EMMC, SIG_DESC_SET(SCU404, 0)); |
| 1480 | PIN_DECL_3(Y1, GPIO18E0, FWSPIDCS, VBCS, SD3DAT4); | 1481 | PIN_DECL_3(Y1, GPIO18E0, FWSPIDCS, VBCS, EMMCDAT4); |
| 1481 | FUNC_GROUP_DECL(SD3DAT4, Y1); | ||
| 1482 | 1482 | ||
| 1483 | #define Y2 241 | 1483 | #define Y2 241 |
| 1484 | SIG_EXPR_LIST_DECL_SEMG(Y2, FWSPIDCK, FWSPID, FWSPID, SIG_DESC_SET(SCU500, 3)); | 1484 | SIG_EXPR_LIST_DECL_SEMG(Y2, FWSPIDCK, FWSPID, FWSPID, SIG_DESC_SET(SCU500, 3)); |
| 1485 | SIG_EXPR_LIST_DECL_SESG(Y2, VBCK, VB, SIG_DESC_SET(SCU500, 5)); | 1485 | SIG_EXPR_LIST_DECL_SESG(Y2, VBCK, VB, SIG_DESC_SET(SCU500, 5)); |
| 1486 | SIG_EXPR_LIST_DECL_SESG(Y2, SD3DAT5, SD3DAT5, SIG_DESC_SET(SCU404, 1)); | 1486 | SIG_EXPR_LIST_DECL_SEMG(Y2, EMMCDAT5, EMMCG8, EMMC, SIG_DESC_SET(SCU404, 1)); |
| 1487 | PIN_DECL_3(Y2, GPIO18E1, FWSPIDCK, VBCK, SD3DAT5); | 1487 | PIN_DECL_3(Y2, GPIO18E1, FWSPIDCK, VBCK, EMMCDAT5); |
| 1488 | FUNC_GROUP_DECL(SD3DAT5, Y2); | ||
| 1489 | 1488 | ||
| 1490 | #define Y3 242 | 1489 | #define Y3 242 |
| 1491 | SIG_EXPR_LIST_DECL_SEMG(Y3, FWSPIDMOSI, FWSPID, FWSPID, | 1490 | SIG_EXPR_LIST_DECL_SEMG(Y3, FWSPIDMOSI, FWSPID, FWSPID, |
| 1492 | SIG_DESC_SET(SCU500, 3)); | 1491 | SIG_DESC_SET(SCU500, 3)); |
| 1493 | SIG_EXPR_LIST_DECL_SESG(Y3, VBMOSI, VB, SIG_DESC_SET(SCU500, 5)); | 1492 | SIG_EXPR_LIST_DECL_SESG(Y3, VBMOSI, VB, SIG_DESC_SET(SCU500, 5)); |
| 1494 | SIG_EXPR_LIST_DECL_SESG(Y3, SD3DAT6, SD3DAT6, SIG_DESC_SET(SCU404, 2)); | 1493 | SIG_EXPR_LIST_DECL_SEMG(Y3, EMMCDAT6, EMMCG8, EMMC, SIG_DESC_SET(SCU404, 2)); |
| 1495 | PIN_DECL_3(Y3, GPIO18E2, FWSPIDMOSI, VBMOSI, SD3DAT6); | 1494 | PIN_DECL_3(Y3, GPIO18E2, FWSPIDMOSI, VBMOSI, EMMCDAT6); |
| 1496 | FUNC_GROUP_DECL(SD3DAT6, Y3); | ||
| 1497 | 1495 | ||
| 1498 | #define Y4 243 | 1496 | #define Y4 243 |
| 1499 | SIG_EXPR_LIST_DECL_SEMG(Y4, FWSPIDMISO, FWSPID, FWSPID, | 1497 | SIG_EXPR_LIST_DECL_SEMG(Y4, FWSPIDMISO, FWSPID, FWSPID, |
| 1500 | SIG_DESC_SET(SCU500, 3)); | 1498 | SIG_DESC_SET(SCU500, 3)); |
| 1501 | SIG_EXPR_LIST_DECL_SESG(Y4, VBMISO, VB, SIG_DESC_SET(SCU500, 5)); | 1499 | SIG_EXPR_LIST_DECL_SESG(Y4, VBMISO, VB, SIG_DESC_SET(SCU500, 5)); |
| 1502 | SIG_EXPR_LIST_DECL_SESG(Y4, SD3DAT7, SD3DAT7, SIG_DESC_SET(SCU404, 3)); | 1500 | SIG_EXPR_LIST_DECL_SEMG(Y4, EMMCDAT7, EMMCG8, EMMC, SIG_DESC_SET(SCU404, 3)); |
| 1503 | PIN_DECL_3(Y4, GPIO18E3, FWSPIDMISO, VBMISO, SD3DAT7); | 1501 | PIN_DECL_3(Y4, GPIO18E3, FWSPIDMISO, VBMISO, EMMCDAT7); |
| 1504 | FUNC_GROUP_DECL(SD3DAT7, Y4); | ||
| 1505 | 1502 | ||
| 1506 | GROUP_DECL(FWSPID, Y1, Y2, Y3, Y4); | 1503 | GROUP_DECL(FWSPID, Y1, Y2, Y3, Y4); |
| 1507 | GROUP_DECL(FWQSPID, Y1, Y2, Y3, Y4, AE12, AF12); | 1504 | GROUP_DECL(FWQSPID, Y1, Y2, Y3, Y4, AE12, AF12); |
| 1505 | GROUP_DECL(EMMCG8, AB4, AA4, AC4, AA5, Y5, AB5, AB6, AC5, Y1, Y2, Y3, Y4); | ||
| 1508 | FUNC_DECL_2(FWSPID, FWSPID, FWQSPID); | 1506 | FUNC_DECL_2(FWSPID, FWSPID, FWQSPID); |
| 1509 | FUNC_GROUP_DECL(VB, Y1, Y2, Y3, Y4); | 1507 | FUNC_GROUP_DECL(VB, Y1, Y2, Y3, Y4); |
| 1510 | 1508 | FUNC_DECL_3(EMMC, EMMCG1, EMMCG4, EMMCG8); | |
| 1511 | /* | 1509 | /* |
| 1512 | * FIXME: Confirm bits and priorities are the right way around for the | 1510 | * FIXME: Confirm bits and priorities are the right way around for the |
| 1513 | * following 4 pins | 1511 | * following 4 pins |
| 1514 | */ | 1512 | */ |
| 1515 | #define AF25 244 | 1513 | #define AF25 244 |
| 1516 | SIG_EXPR_LIST_DECL_SEMG(AF25, I3C3SCL, I3C3, I3C3, SIG_DESC_SET(SCU438, 20), | 1514 | SIG_EXPR_LIST_DECL_SEMG(AF25, I3C3SCL, I3C3, I3C3, SIG_DESC_SET(SCU438, 20)); |
| 1517 | SIG_DESC_SET(SCU4D8, 20)); | 1515 | SIG_EXPR_LIST_DECL_SESG(AF25, FSI1CLK, FSI1, SIG_DESC_SET(SCU4D8, 20)); |
| 1518 | SIG_EXPR_LIST_DECL_SESG(AF25, FSI1CLK, FSI1, SIG_DESC_CLEAR(SCU438, 20), | ||
| 1519 | SIG_DESC_SET(SCU4D8, 20)); | ||
| 1520 | PIN_DECL_(AF25, SIG_EXPR_LIST_PTR(AF25, I3C3SCL), | 1516 | PIN_DECL_(AF25, SIG_EXPR_LIST_PTR(AF25, I3C3SCL), |
| 1521 | SIG_EXPR_LIST_PTR(AF25, FSI1CLK)); | 1517 | SIG_EXPR_LIST_PTR(AF25, FSI1CLK)); |
| 1522 | 1518 | ||
| 1523 | #define AE26 245 | 1519 | #define AE26 245 |
| 1524 | SIG_EXPR_LIST_DECL_SEMG(AE26, I3C3SDA, I3C3, I3C3, SIG_DESC_SET(SCU438, 21), | 1520 | SIG_EXPR_LIST_DECL_SEMG(AE26, I3C3SDA, I3C3, I3C3, SIG_DESC_SET(SCU438, 21)); |
| 1525 | SIG_DESC_SET(SCU4D8, 21)); | 1521 | SIG_EXPR_LIST_DECL_SESG(AE26, FSI1DATA, FSI1, SIG_DESC_SET(SCU4D8, 21)); |
| 1526 | SIG_EXPR_LIST_DECL_SESG(AE26, FSI1DATA, FSI1, SIG_DESC_CLEAR(SCU438, 21), | ||
| 1527 | SIG_DESC_SET(SCU4D8, 21)); | ||
| 1528 | PIN_DECL_(AE26, SIG_EXPR_LIST_PTR(AE26, I3C3SDA), | 1522 | PIN_DECL_(AE26, SIG_EXPR_LIST_PTR(AE26, I3C3SDA), |
| 1529 | SIG_EXPR_LIST_PTR(AE26, FSI1DATA)); | 1523 | SIG_EXPR_LIST_PTR(AE26, FSI1DATA)); |
| 1530 | 1524 | ||
| @@ -1533,18 +1527,14 @@ FUNC_DECL_2(I3C3, HVI3C3, I3C3); · 2 unmodified lines | |||
| 1533 | FUNC_GROUP_DECL(FSI1, AF25, AE26); | 1527 | FUNC_GROUP_DECL(FSI1, AF25, AE26); |
| 1534 | 1528 | ||
| 1535 | #define AE25 246 | 1529 | #define AE25 246 |
| 1536 | SIG_EXPR_LIST_DECL_SEMG(AE25, I3C4SCL, I3C4, I3C4, SIG_DESC_SET(SCU438, 22), | 1530 | SIG_EXPR_LIST_DECL_SEMG(AE25, I3C4SCL, I3C4, I3C4, SIG_DESC_SET(SCU438, 22)); |
| 1537 | SIG_DESC_SET(SCU4D8, 22)); | 1531 | SIG_EXPR_LIST_DECL_SESG(AE25, FSI2CLK, FSI2, SIG_DESC_SET(SCU4D8, 22)); |
| 1538 | SIG_EXPR_LIST_DECL_SESG(AE25, FSI2CLK, FSI2, SIG_DESC_CLEAR(SCU438, 22), | ||
| 1539 | SIG_DESC_SET(SCU4D8, 22)); | ||
| 1540 | PIN_DECL_(AE25, SIG_EXPR_LIST_PTR(AE25, I3C4SCL), | 1532 | PIN_DECL_(AE25, SIG_EXPR_LIST_PTR(AE25, I3C4SCL), |
| 1541 | SIG_EXPR_LIST_PTR(AE25, FSI2CLK)); | 1533 | SIG_EXPR_LIST_PTR(AE25, FSI2CLK)); |
| 1542 | 1534 | ||
| 1543 | #define AF24 247 | 1535 | #define AF24 247 |
| 1544 | SIG_EXPR_LIST_DECL_SEMG(AF24, I3C4SDA, I3C4, I3C4, SIG_DESC_SET(SCU438, 23), | 1536 | SIG_EXPR_LIST_DECL_SEMG(AF24, I3C4SDA, I3C4, I3C4, SIG_DESC_SET(SCU438, 23)); |
| 1545 | SIG_DESC_SET(SCU4D8, 23)); | 1537 | SIG_EXPR_LIST_DECL_SESG(AF24, FSI2DATA, FSI2, SIG_DESC_SET(SCU4D8, 23)); |
| 1546 | SIG_EXPR_LIST_DECL_SESG(AF24, FSI2DATA, FSI2, SIG_DESC_CLEAR(SCU438, 23), | ||
| 1547 | SIG_DESC_SET(SCU4D8, 23)); | ||
| 1548 | PIN_DECL_(AF24, SIG_EXPR_LIST_PTR(AF24, I3C4SDA), | 1538 | PIN_DECL_(AF24, SIG_EXPR_LIST_PTR(AF24, I3C4SDA), |
| 1549 | SIG_EXPR_LIST_PTR(AF24, FSI2DATA)); | 1539 | SIG_EXPR_LIST_PTR(AF24, FSI2DATA)); |
| 1550 | 1540 | ||
| @@ -1574,6 +1564,8 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 23 unmodified lines | |||
| 1574 | ASPEED_PINCTRL_PIN(A3), | 1564 | ASPEED_PINCTRL_PIN(A3), |
| 1575 | ASPEED_PINCTRL_PIN(AA11), | 1565 | ASPEED_PINCTRL_PIN(AA11), |
| 1576 | ASPEED_PINCTRL_PIN(AA12), | 1566 | ASPEED_PINCTRL_PIN(AA12), |
| 1567 | ASPEED_PINCTRL_PIN(AA16), | ||
| 1568 | ASPEED_PINCTRL_PIN(AA17), | ||
| 1577 | ASPEED_PINCTRL_PIN(AA23), | 1569 | ASPEED_PINCTRL_PIN(AA23), |
| 1578 | ASPEED_PINCTRL_PIN(AA24), | 1570 | ASPEED_PINCTRL_PIN(AA24), |
| 1579 | ASPEED_PINCTRL_PIN(AA25), | 1571 | ASPEED_PINCTRL_PIN(AA25), |
| @@ -1585,6 +1577,8 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 5 unmodified lines | |||
| 1585 | ASPEED_PINCTRL_PIN(AB11), | 1577 | ASPEED_PINCTRL_PIN(AB11), |
| 1586 | ASPEED_PINCTRL_PIN(AB12), | 1578 | ASPEED_PINCTRL_PIN(AB12), |
| 1587 | ASPEED_PINCTRL_PIN(AB15), | 1579 | ASPEED_PINCTRL_PIN(AB15), |
| 1580 | ASPEED_PINCTRL_PIN(AB16), | ||
| 1581 | ASPEED_PINCTRL_PIN(AB17), | ||
| 1588 | ASPEED_PINCTRL_PIN(AB18), | 1582 | ASPEED_PINCTRL_PIN(AB18), |
| 1589 | ASPEED_PINCTRL_PIN(AB19), | 1583 | ASPEED_PINCTRL_PIN(AB19), |
| 1590 | ASPEED_PINCTRL_PIN(AB22), | 1584 | ASPEED_PINCTRL_PIN(AB22), |
| @@ -1602,6 +1596,7 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 11 unmodified lines | |||
| 1602 | ASPEED_PINCTRL_PIN(AC11), | 1596 | ASPEED_PINCTRL_PIN(AC11), |
| 1603 | ASPEED_PINCTRL_PIN(AC12), | 1597 | ASPEED_PINCTRL_PIN(AC12), |
| 1604 | ASPEED_PINCTRL_PIN(AC15), | 1598 | ASPEED_PINCTRL_PIN(AC15), |
| 1599 | ASPEED_PINCTRL_PIN(AC16), | ||
| 1605 | ASPEED_PINCTRL_PIN(AC17), | 1600 | ASPEED_PINCTRL_PIN(AC17), |
| 1606 | ASPEED_PINCTRL_PIN(AC18), | 1601 | ASPEED_PINCTRL_PIN(AC18), |
| 1607 | ASPEED_PINCTRL_PIN(AC19), | 1602 | ASPEED_PINCTRL_PIN(AC19), |
| @@ -1619,6 +1614,7 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 11 unmodified lines | |||
| 1619 | ASPEED_PINCTRL_PIN(AD12), | 1614 | ASPEED_PINCTRL_PIN(AD12), |
| 1620 | ASPEED_PINCTRL_PIN(AD14), | 1615 | ASPEED_PINCTRL_PIN(AD14), |
| 1621 | ASPEED_PINCTRL_PIN(AD15), | 1616 | ASPEED_PINCTRL_PIN(AD15), |
| 1617 | ASPEED_PINCTRL_PIN(AD16), | ||
| 1622 | ASPEED_PINCTRL_PIN(AD19), | 1618 | ASPEED_PINCTRL_PIN(AD19), |
| 1623 | ASPEED_PINCTRL_PIN(AD20), | 1619 | ASPEED_PINCTRL_PIN(AD20), |
| 1624 | ASPEED_PINCTRL_PIN(AD22), | 1620 | ASPEED_PINCTRL_PIN(AD22), |
| @@ -1634,8 +1630,11 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 9 unmodified lines | |||
| 1634 | ASPEED_PINCTRL_PIN(AE12), | 1630 | ASPEED_PINCTRL_PIN(AE12), |
| 1635 | ASPEED_PINCTRL_PIN(AE14), | 1631 | ASPEED_PINCTRL_PIN(AE14), |
| 1636 | ASPEED_PINCTRL_PIN(AE15), | 1632 | ASPEED_PINCTRL_PIN(AE15), |
| 1633 | ASPEED_PINCTRL_PIN(AE16), | ||
| 1637 | ASPEED_PINCTRL_PIN(AE18), | 1634 | ASPEED_PINCTRL_PIN(AE18), |
| 1638 | ASPEED_PINCTRL_PIN(AE19), | 1635 | ASPEED_PINCTRL_PIN(AE19), |
| 1636 | ASPEED_PINCTRL_PIN(AE25), | ||
| 1637 | ASPEED_PINCTRL_PIN(AE26), | ||
| 1639 | ASPEED_PINCTRL_PIN(AE7), | 1638 | ASPEED_PINCTRL_PIN(AE7), |
| 1640 | ASPEED_PINCTRL_PIN(AE8), | 1639 | ASPEED_PINCTRL_PIN(AE8), |
| 1641 | ASPEED_PINCTRL_PIN(AF10), | 1640 | ASPEED_PINCTRL_PIN(AF10), |
| @@ -1643,6 +1642,8 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 1 unmodified line | |||
| 1643 | ASPEED_PINCTRL_PIN(AF12), | 1642 | ASPEED_PINCTRL_PIN(AF12), |
| 1644 | ASPEED_PINCTRL_PIN(AF14), | 1643 | ASPEED_PINCTRL_PIN(AF14), |
| 1645 | ASPEED_PINCTRL_PIN(AF15), | 1644 | ASPEED_PINCTRL_PIN(AF15), |
| 1645 | ASPEED_PINCTRL_PIN(AF24), | ||
| 1646 | ASPEED_PINCTRL_PIN(AF25), | ||
| 1646 | ASPEED_PINCTRL_PIN(AF7), | 1647 | ASPEED_PINCTRL_PIN(AF7), |
| 1647 | ASPEED_PINCTRL_PIN(AF8), | 1648 | ASPEED_PINCTRL_PIN(AF8), |
| 1648 | ASPEED_PINCTRL_PIN(AF9), | 1649 | ASPEED_PINCTRL_PIN(AF9), |
| @@ -1792,17 +1793,6 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 143 unmodified lines | |||
| 1792 | ASPEED_PINCTRL_PIN(Y3), | 1793 | ASPEED_PINCTRL_PIN(Y3), |
| 1793 | ASPEED_PINCTRL_PIN(Y4), | 1794 | ASPEED_PINCTRL_PIN(Y4), |
| 1794 | ASPEED_PINCTRL_PIN(Y5), | 1795 | ASPEED_PINCTRL_PIN(Y5), |
| 1795 | ASPEED_PINCTRL_PIN(AB16), | ||
| 1796 | ASPEED_PINCTRL_PIN(AA17), | ||
| 1797 | ASPEED_PINCTRL_PIN(AB17), | ||
| 1798 | ASPEED_PINCTRL_PIN(AE16), | ||
| 1799 | ASPEED_PINCTRL_PIN(AC16), | ||
| 1800 | ASPEED_PINCTRL_PIN(AA16), | ||
| 1801 | ASPEED_PINCTRL_PIN(AD16), | ||
| 1802 | ASPEED_PINCTRL_PIN(AF25), | ||
| 1803 | ASPEED_PINCTRL_PIN(AE26), | ||
| 1804 | ASPEED_PINCTRL_PIN(AE25), | ||
| 1805 | ASPEED_PINCTRL_PIN(AF24), | ||
| 1806 | }; | 1796 | }; |
| 1807 | 1797 | ||
| 1808 | static const struct aspeed_pin_group aspeed_g6_groups[] = { | 1798 | static const struct aspeed_pin_group aspeed_g6_groups[] = { |
| @@ -1976,11 +1966,9 @@ static const struct aspeed_pin_group aspeed_g6_groups[] = { · 167 unmodified lines | |||
| 1976 | ASPEED_PINCTRL_GROUP(SALT9G1), | 1966 | ASPEED_PINCTRL_GROUP(SALT9G1), |
| 1977 | ASPEED_PINCTRL_GROUP(SD1), | 1967 | ASPEED_PINCTRL_GROUP(SD1), |
| 1978 | ASPEED_PINCTRL_GROUP(SD2), | 1968 | ASPEED_PINCTRL_GROUP(SD2), |
| 1979 | ASPEED_PINCTRL_GROUP(SD3), | 1969 | ASPEED_PINCTRL_GROUP(EMMCG1), |
| 1980 | ASPEED_PINCTRL_GROUP(SD3DAT4), | 1970 | ASPEED_PINCTRL_GROUP(EMMCG4), |
| 1981 | ASPEED_PINCTRL_GROUP(SD3DAT5), | 1971 | ASPEED_PINCTRL_GROUP(EMMCG8), |
| 1982 | ASPEED_PINCTRL_GROUP(SD3DAT6), | ||
| 1983 | ASPEED_PINCTRL_GROUP(SD3DAT7), | ||
| 1984 | ASPEED_PINCTRL_GROUP(SGPM1), | 1972 | ASPEED_PINCTRL_GROUP(SGPM1), |
| 1985 | ASPEED_PINCTRL_GROUP(SGPS1), | 1973 | ASPEED_PINCTRL_GROUP(SGPS1), |
| 1986 | ASPEED_PINCTRL_GROUP(SIOONCTRL), | 1974 | ASPEED_PINCTRL_GROUP(SIOONCTRL), |
| @@ -2059,6 +2047,7 @@ static const struct aspeed_pin_function aspeed_g6_functions[] = { · 72 unmodified lines | |||
| 2059 | ASPEED_PINCTRL_FUNC(ADC8), | 2047 | ASPEED_PINCTRL_FUNC(ADC8), |
| 2060 | ASPEED_PINCTRL_FUNC(ADC9), | 2048 | ASPEED_PINCTRL_FUNC(ADC9), |
| 2061 | ASPEED_PINCTRL_FUNC(BMCINT), | 2049 | ASPEED_PINCTRL_FUNC(BMCINT), |
| 2050 | ASPEED_PINCTRL_FUNC(EMMC), | ||
| 2062 | ASPEED_PINCTRL_FUNC(ESPI), | 2051 | ASPEED_PINCTRL_FUNC(ESPI), |
| 2063 | ASPEED_PINCTRL_FUNC(ESPIALT), | 2052 | ASPEED_PINCTRL_FUNC(ESPIALT), |
| 2064 | ASPEED_PINCTRL_FUNC(FSI1), | 2053 | ASPEED_PINCTRL_FUNC(FSI1), |
| @@ -2191,11 +2180,6 @@ static const struct aspeed_pin_function aspeed_g6_functions[] = { · 126 unmodified lines | |||
| 2191 | ASPEED_PINCTRL_FUNC(SALT9), | 2180 | ASPEED_PINCTRL_FUNC(SALT9), |
| 2192 | ASPEED_PINCTRL_FUNC(SD1), | 2181 | ASPEED_PINCTRL_FUNC(SD1), |
| 2193 | ASPEED_PINCTRL_FUNC(SD2), | 2182 | ASPEED_PINCTRL_FUNC(SD2), |
| 2194 | ASPEED_PINCTRL_FUNC(SD3), | ||
| 2195 | ASPEED_PINCTRL_FUNC(SD3DAT4), | ||
| 2196 | ASPEED_PINCTRL_FUNC(SD3DAT5), | ||
| 2197 | ASPEED_PINCTRL_FUNC(SD3DAT6), | ||
| 2198 | ASPEED_PINCTRL_FUNC(SD3DAT7), | ||
| 2199 | ASPEED_PINCTRL_FUNC(SGPM1), | 2183 | ASPEED_PINCTRL_FUNC(SGPM1), |
| 2200 | ASPEED_PINCTRL_FUNC(SGPS1), | 2184 | ASPEED_PINCTRL_FUNC(SGPS1), |
| 2201 | ASPEED_PINCTRL_FUNC(SIOONCTRL), | 2185 | ASPEED_PINCTRL_FUNC(SIOONCTRL), |
| @@ -508,7 +508,7 @@ struct aspeed_pin_desc { · 507 unmodified lines | |||
| 508 | * @idx: The bit index in the register | 508 | * @idx: The bit index in the register |
| 509 | */ | 509 | */ |
| 510 | #define SIG_DESC_SET(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 1) | 510 | #define SIG_DESC_SET(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 1) |
| 511 | #define SIG_DESC_CLEAR(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 0) | 511 | #define SIG_DESC_CLEAR(reg, idx) { ASPEED_IP_SCU, reg, BIT_MASK(idx), 0, 0 } |
| 512 | 512 | ||
| 513 | #define SIG_DESC_LIST_SYM(sig, group) sig_descs_ ## sig ## _ ## group | 513 | #define SIG_DESC_LIST_SYM(sig, group) sig_descs_ ## sig ## _ ## group |
| 514 | #define SIG_DESC_LIST_DECL(sig, group, ...) \ | 514 | #define SIG_DESC_LIST_DECL(sig, group, ...) \ |
| @@ -738,6 +738,7 @@ struct aspeed_pin_desc { · 223 unmodified lines | |||
| 738 | static const char *FUNC_SYM(func)[] = { __VA_ARGS__ } | 738 | static const char *FUNC_SYM(func)[] = { __VA_ARGS__ } |
| 739 | 739 | ||
| 740 | #define FUNC_DECL_2(func, one, two) FUNC_DECL_(func, #one, #two) | 740 | #define FUNC_DECL_2(func, one, two) FUNC_DECL_(func, #one, #two) |
| 741 | #define FUNC_DECL_3(func, one, two, three) FUNC_DECL_(func, #one, #two, #three) | ||
| 741 | 742 | ||
| 742 | #define FUNC_GROUP_DECL(func, ...) \ | 743 | #define FUNC_GROUP_DECL(func, ...) \ |
| 743 | GROUP_DECL(func, __VA_ARGS__); \ | 744 | GROUP_DECL(func, __VA_ARGS__); \ |
| @@ -1,14 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * Copyright (C) 2014-2017 Broadcom | 3 | * Copyright (C) 2014-2017 Broadcom |
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU General Public License as | ||
| 6 | * published by the Free Software Foundation version 2. | ||
| 7 | * | ||
| 8 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
| 9 | * kind, whether express or implied; without even the implied warranty | ||
| 10 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | */ | 4 | */ |
| 13 | 5 | ||
| 14 | /* | 6 | /* |
| @@ -853,7 +845,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) · 838 unmodified lines | |||
| 853 | 845 | ||
| 854 | /* optional GPIO interrupt support */ | 846 | /* optional GPIO interrupt support */ |
| 855 | irq = platform_get_irq(pdev, 0); | 847 | irq = platform_get_irq(pdev, 0); |
| 856 | if (irq) { | 848 | if (irq > 0) { |
| 857 | struct irq_chip *irqc; | 849 | struct irq_chip *irqc; |
| 858 | struct gpio_irq_chip *girq; | 850 | struct gpio_irq_chip *girq; |
| 859 | 851 | ||
| @@ -640,8 +640,8 @@ static int ns2_pinmux_enable(struct pinctrl_dev *pctrl_dev, · 639 unmodified lines | |||
| 640 | const struct ns2_pin_function *func; | 640 | const struct ns2_pin_function *func; |
| 641 | const struct ns2_pin_group *grp; | 641 | const struct ns2_pin_group *grp; |
| 642 | 642 | ||
| 643 | if (grp_select > pinctrl->num_groups || | 643 | if (grp_select >= pinctrl->num_groups || |
| 644 | func_select > pinctrl->num_functions) | 644 | func_select >= pinctrl->num_functions) |
| 645 | return -EINVAL; | 645 | return -EINVAL; |
| 646 | 646 | ||
| 647 | func = &pinctrl->functions[func_select]; | 647 | func = &pinctrl->functions[func_select]; |
| @@ -43,7 +43,7 @@ static const struct berlin_desc_group as370_soc_pinctrl_groups[] = { · 42 unmodified lines | |||
| 43 | BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO5 */ | 43 | BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO5 */ |
| 44 | BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO3 */ | 44 | BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO3 */ |
| 45 | BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM5 */ | 45 | BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM5 */ |
| 46 | BERLIN_PINCTRL_FUNCTION(0x3, "spififib"), /* SPDIFIB */ | 46 | BERLIN_PINCTRL_FUNCTION(0x3, "spdifib"), /* SPDIFIB */ |
| 47 | BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ | 47 | BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */ |
| 48 | BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG5 */ | 48 | BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG5 */ |
| 49 | BERLIN_PINCTRL_GROUP("I2S1_MCLK", 0x0, 0x3, 0x12, | 49 | BERLIN_PINCTRL_GROUP("I2S1_MCLK", 0x0, 0x3, 0x12, |
| @@ -1513,7 +1513,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1512 unmodified lines | |||
| 1513 | .matches = { | 1513 | .matches = { |
| 1514 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), | 1514 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), |
| 1515 | DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"), | 1515 | DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"), |
| 1516 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), | ||
| 1517 | }, | 1516 | }, |
| 1518 | }, | 1517 | }, |
| 1519 | { | 1518 | { |
| @@ -1521,7 +1520,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1 unmodified line | |||
| 1521 | .matches = { | 1520 | .matches = { |
| 1522 | DMI_MATCH(DMI_SYS_VENDOR, "HP"), | 1521 | DMI_MATCH(DMI_SYS_VENDOR, "HP"), |
| 1523 | DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"), | 1522 | DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"), |
| 1524 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), | ||
| 1525 | }, | 1523 | }, |
| 1526 | }, | 1524 | }, |
| 1527 | { | 1525 | { |
| @@ -1529,7 +1527,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1 unmodified line | |||
| 1529 | .matches = { | 1527 | .matches = { |
| 1530 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), | 1528 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), |
| 1531 | DMI_MATCH(DMI_PRODUCT_NAME, "Cyan"), | 1529 | DMI_MATCH(DMI_PRODUCT_NAME, "Cyan"), |
| 1532 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), | ||
| 1533 | }, | 1530 | }, |
| 1534 | }, | 1531 | }, |
| 1535 | { | 1532 | { |
| @@ -1537,7 +1534,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1 unmodified line | |||
| 1537 | .matches = { | 1534 | .matches = { |
| 1538 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), | 1535 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), |
| 1539 | DMI_MATCH(DMI_PRODUCT_NAME, "Celes"), | 1536 | DMI_MATCH(DMI_PRODUCT_NAME, "Celes"), |
| 1540 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), | ||
| 1541 | }, | 1537 | }, |
| 1542 | }, | 1538 | }, |
| 1543 | {} | 1539 | {} |
| @@ -96,6 +96,7 @@ struct intel_pinctrl_context { · 95 unmodified lines | |||
| 96 | * @pctldesc: Pin controller description | 96 | * @pctldesc: Pin controller description |
| 97 | * @pctldev: Pointer to the pin controller device | 97 | * @pctldev: Pointer to the pin controller device |
| 98 | * @chip: GPIO chip in this pin controller | 98 | * @chip: GPIO chip in this pin controller |
| 99 | * @irqchip: IRQ chip in this pin controller | ||
| 99 | * @soc: SoC/PCH specific pin configuration data | 100 | * @soc: SoC/PCH specific pin configuration data |
| 100 | * @communities: All communities in this pin controller | 101 | * @communities: All communities in this pin controller |
| 101 | * @ncommunities: Number of communities in this pin controller | 102 | * @ncommunities: Number of communities in this pin controller |
| @@ -108,6 +109,7 @@ struct intel_pinctrl { · 6 unmodified lines | |||
| 108 | struct pinctrl_desc pctldesc; | 109 | struct pinctrl_desc pctldesc; |
| 109 | struct pinctrl_dev *pctldev; | 110 | struct pinctrl_dev *pctldev; |
| 110 | struct gpio_chip chip; | 111 | struct gpio_chip chip; |
| 112 | struct irq_chip irqchip; | ||
| 111 | const struct intel_pinctrl_soc_data *soc; | 113 | const struct intel_pinctrl_soc_data *soc; |
| 112 | struct intel_community *communities; | 114 | struct intel_community *communities; |
| 113 | size_t ncommunities; | 115 | size_t ncommunities; |
| @@ -1139,16 +1141,6 @@ static irqreturn_t intel_gpio_irq(int irq, void *data) · 1025 unmodified lines | |||
| 1139 | return ret; | 1141 | return ret; |
| 1140 | } | 1142 | } |
| 1141 | 1143 | ||
| 1142 | static struct irq_chip intel_gpio_irqchip = { | ||
| 1143 | .name = "intel-gpio", | ||
| 1144 | .irq_ack = intel_gpio_irq_ack, | ||
| 1145 | .irq_mask = intel_gpio_irq_mask, | ||
| 1146 | .irq_unmask = intel_gpio_irq_unmask, | ||
| 1147 | .irq_set_type = intel_gpio_irq_type, | ||
| 1148 | .irq_set_wake = intel_gpio_irq_wake, | ||
| 1149 | .flags = IRQCHIP_MASK_ON_SUSPEND, | ||
| 1150 | }; | ||
| 1151 | |||
| 1152 | static int intel_gpio_add_pin_ranges(struct intel_pinctrl *pctrl, | 1144 | static int intel_gpio_add_pin_ranges(struct intel_pinctrl *pctrl, |
| 1153 | const struct intel_community *community) | 1145 | const struct intel_community *community) |
| 1154 | { | 1146 | { |
| @@ -1198,12 +1190,22 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) · 43 unmodified lines | |||
| 1198 | 1190 | ||
| 1199 | pctrl->chip = intel_gpio_chip; | 1191 | pctrl->chip = intel_gpio_chip; |
| 1200 | 1192 | ||
| 1193 | /* Setup GPIO chip */ | ||
| 1201 | pctrl->chip.ngpio = intel_gpio_ngpio(pctrl); | 1194 | pctrl->chip.ngpio = intel_gpio_ngpio(pctrl); |
| 1202 | pctrl->chip.label = dev_name(pctrl->dev); | 1195 | pctrl->chip.label = dev_name(pctrl->dev); |
| 1203 | pctrl->chip.parent = pctrl->dev; | 1196 | pctrl->chip.parent = pctrl->dev; |
| 1204 | pctrl->chip.base = -1; | 1197 | pctrl->chip.base = -1; |
| 1205 | pctrl->irq = irq; | 1198 | pctrl->irq = irq; |
| 1206 | 1199 | ||
| 1200 | /* Setup IRQ chip */ | ||
| 1201 | pctrl->irqchip.name = dev_name(pctrl->dev); | ||
| 1202 | pctrl->irqchip.irq_ack = intel_gpio_irq_ack; | ||
| 1203 | pctrl->irqchip.irq_mask = intel_gpio_irq_mask; | ||
| 1204 | pctrl->irqchip.irq_unmask = intel_gpio_irq_unmask; | ||
| 1205 | pctrl->irqchip.irq_set_type = intel_gpio_irq_type; | ||
| 1206 | pctrl->irqchip.irq_set_wake = intel_gpio_irq_wake; | ||
| 1207 | pctrl->irqchip.flags = IRQCHIP_MASK_ON_SUSPEND; | ||
| 1208 | |||
| 1207 | ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl); | 1209 | ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl); |
| 1208 | if (ret) { | 1210 | if (ret) { |
| 1209 | dev_err(pctrl->dev, "failed to register gpiochip\n"); | 1211 | dev_err(pctrl->dev, "failed to register gpiochip\n"); |
| @@ -1233,15 +1235,14 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) · 23 unmodified lines | |||
| 1233 | return ret; | 1235 | return ret; |
| 1234 | } | 1236 | } |
| 1235 | 1237 | ||
| 1236 | ret = gpiochip_irqchip_add(&pctrl->chip, &intel_gpio_irqchip, 0, | 1238 | ret = gpiochip_irqchip_add(&pctrl->chip, &pctrl->irqchip, 0, |
| 1237 | handle_bad_irq, IRQ_TYPE_NONE); | 1239 | handle_bad_irq, IRQ_TYPE_NONE); |
| 1238 | if (ret) { | 1240 | if (ret) { |
| 1239 | dev_err(pctrl->dev, "failed to add irqchip\n"); | 1241 | dev_err(pctrl->dev, "failed to add irqchip\n"); |
| 1240 | return ret; | 1242 | return ret; |
| 1241 | } | 1243 | } |
| 1242 | 1244 | ||
| 1243 | gpiochip_set_chained_irqchip(&pctrl->chip, &intel_gpio_irqchip, irq, | 1245 | gpiochip_set_chained_irqchip(&pctrl->chip, &pctrl->irqchip, irq, NULL); |
| 1244 | NULL); | ||
| 1245 | return 0; | 1246 | return 0; |
| 1246 | } | 1247 | } |
| 1247 | 1248 | ||
| @@ -183,10 +183,10 @@ static struct armada_37xx_pin_group armada_37xx_nb_groups[] = { · 182 unmodified lines | |||
| 183 | PIN_GRP_EXTRA("uart2", 9, 2, BIT(1) | BIT(13) | BIT(14) | BIT(19), | 183 | PIN_GRP_EXTRA("uart2", 9, 2, BIT(1) | BIT(13) | BIT(14) | BIT(19), |
| 184 | BIT(1) | BIT(13) | BIT(14), BIT(1) | BIT(19), | 184 | BIT(1) | BIT(13) | BIT(14), BIT(1) | BIT(19), |
| 185 | 18, 2, "gpio", "uart"), | 185 | 18, 2, "gpio", "uart"), |
| 186 | PIN_GRP_GPIO("led0_od", 11, 1, BIT(20), "led"), | 186 | PIN_GRP_GPIO_2("led0_od", 11, 1, BIT(20), BIT(20), 0, "led"), |
| 187 | PIN_GRP_GPIO("led1_od", 12, 1, BIT(21), "led"), | 187 | PIN_GRP_GPIO_2("led1_od", 12, 1, BIT(21), BIT(21), 0, "led"), |
| 188 | PIN_GRP_GPIO("led2_od", 13, 1, BIT(22), "led"), | 188 | PIN_GRP_GPIO_2("led2_od", 13, 1, BIT(22), BIT(22), 0, "led"), |
| 189 | PIN_GRP_GPIO("led3_od", 14, 1, BIT(23), "led"), | 189 | PIN_GRP_GPIO_2("led3_od", 14, 1, BIT(23), BIT(23), 0, "led"), |
| 190 | 190 | ||
| 191 | }; | 191 | }; |
| 192 | 192 | ||
| @@ -221,11 +221,11 @@ static const struct armada_37xx_pin_data armada_37xx_pin_sb = { · 28 unmodified lines | |||
| 221 | }; | 221 | }; |
| 222 | 222 | ||
| 223 | static inline void armada_37xx_update_reg(unsigned int *reg, | 223 | static inline void armada_37xx_update_reg(unsigned int *reg, |
| 224 | unsigned int offset) | 224 | unsigned int *offset) |
| 225 | { | 225 | { |
| 226 | /* We never have more than 2 registers */ | 226 | /* We never have more than 2 registers */ |
| 227 | if (offset >= GPIO_PER_REG) { | 227 | if (*offset >= GPIO_PER_REG) { |
| 228 | offset -= GPIO_PER_REG; | 228 | *offset -= GPIO_PER_REG; |
| 229 | *reg += sizeof(u32); | 229 | *reg += sizeof(u32); |
| 230 | } | 230 | } |
| 231 | } | 231 | } |
| @@ -376,7 +376,7 @@ static inline void armada_37xx_irq_update_reg(unsigned int *reg, · 144 unmodified lines | |||
| 376 | { | 376 | { |
| 377 | int offset = irqd_to_hwirq(d); | 377 | int offset = irqd_to_hwirq(d); |
| 378 | 378 | ||
| 379 | armada_37xx_update_reg(reg, offset); | 379 | armada_37xx_update_reg(reg, &offset); |
| 380 | } | 380 | } |
| 381 | 381 | ||
| 382 | static int armada_37xx_gpio_direction_input(struct gpio_chip *chip, | 382 | static int armada_37xx_gpio_direction_input(struct gpio_chip *chip, |
| @@ -386,7 +386,7 @@ static int armada_37xx_gpio_direction_input(struct gpio_chip *chip, · 3 unmodified lines | |||
| 386 | unsigned int reg = OUTPUT_EN; | 386 | unsigned int reg = OUTPUT_EN; |
| 387 | unsigned int mask; | 387 | unsigned int mask; |
| 388 | 388 | ||
| 389 | armada_37xx_update_reg(®, offset); | 389 | armada_37xx_update_reg(®, &offset); |
| 390 | mask = BIT(offset); | 390 | mask = BIT(offset); |
| 391 | 391 | ||
| 392 | return regmap_update_bits(info->regmap, reg, mask, 0); | 392 | return regmap_update_bits(info->regmap, reg, mask, 0); |
| @@ -399,7 +399,7 @@ static int armada_37xx_gpio_get_direction(struct gpio_chip *chip, · 6 unmodified lines | |||
| 399 | unsigned int reg = OUTPUT_EN; | 399 | unsigned int reg = OUTPUT_EN; |
| 400 | unsigned int val, mask; | 400 | unsigned int val, mask; |
| 401 | 401 | ||
| 402 | armada_37xx_update_reg(®, offset); | 402 | armada_37xx_update_reg(®, &offset); |
| 403 | mask = BIT(offset); | 403 | mask = BIT(offset); |
| 404 | regmap_read(info->regmap, reg, &val); | 404 | regmap_read(info->regmap, reg, &val); |
| 405 | 405 | ||
| @@ -413,7 +413,7 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, · 7 unmodified lines | |||
| 413 | unsigned int reg = OUTPUT_EN; | 413 | unsigned int reg = OUTPUT_EN; |
| 414 | unsigned int mask, val, ret; | 414 | unsigned int mask, val, ret; |
| 415 | 415 | ||
| 416 | armada_37xx_update_reg(®, offset); | 416 | armada_37xx_update_reg(®, &offset); |
| 417 | mask = BIT(offset); | 417 | mask = BIT(offset); |
| 418 | 418 | ||
| 419 | ret = regmap_update_bits(info->regmap, reg, mask, mask); | 419 | ret = regmap_update_bits(info->regmap, reg, mask, mask); |
| @@ -434,7 +434,7 @@ static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset) · 14 unmodified lines | |||
| 434 | unsigned int reg = INPUT_VAL; | 434 | unsigned int reg = INPUT_VAL; |
| 435 | unsigned int val, mask; | 435 | unsigned int val, mask; |
| 436 | 436 | ||
| 437 | armada_37xx_update_reg(®, offset); | 437 | armada_37xx_update_reg(®, &offset); |
| 438 | mask = BIT(offset); | 438 | mask = BIT(offset); |
| 439 | 439 | ||
| 440 | regmap_read(info->regmap, reg, &val); | 440 | regmap_read(info->regmap, reg, &val); |
| @@ -449,7 +449,7 @@ static void armada_37xx_gpio_set(struct gpio_chip *chip, unsigned int offset, · 8 unmodified lines | |||
| 449 | unsigned int reg = OUTPUT_VAL; | 449 | unsigned int reg = OUTPUT_VAL; |
| 450 | unsigned int mask, val; | 450 | unsigned int mask, val; |
| 451 | 451 | ||
| 452 | armada_37xx_update_reg(®, offset); | 452 | armada_37xx_update_reg(®, &offset); |
| 453 | mask = BIT(offset); | 453 | mask = BIT(offset); |
| 454 | val = value ? mask : 0; | 454 | val = value ? mask : 0; |
| 455 | 455 | ||
| @@ -705,7 +705,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev) · 704 unmodified lines | |||
| 705 | 705 | ||
| 706 | static int stmfx_pinctrl_remove(struct platform_device *pdev) | 706 | static int stmfx_pinctrl_remove(struct platform_device *pdev) |
| 707 | { | 707 | { |
| 708 | struct stmfx *stmfx = dev_get_platdata(&pdev->dev); | 708 | struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent); |
| 709 | 709 | ||
| 710 | return stmfx_function_disable(stmfx, | 710 | return stmfx_function_disable(stmfx, |
| 711 | STMFX_FUNC_GPIO | | 711 | STMFX_FUNC_GPIO | |
| @@ -420,12 +420,6 @@ failed_sensitivity: · 419 unmodified lines | |||
| 420 | 420 | ||
| 421 | static int cmpc_accel_remove_v4(struct acpi_device *acpi) | 421 | static int cmpc_accel_remove_v4(struct acpi_device *acpi) |
| 422 | { | 422 | { |
| 423 | struct input_dev *inputdev; | ||
| 424 | struct cmpc_accel *accel; | ||
| 425 | |||
| 426 | inputdev = dev_get_drvdata(&acpi->dev); | ||
| 427 | accel = dev_get_drvdata(&inputdev->dev); | ||
| 428 | |||
| 429 | device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr_v4); | 423 | device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr_v4); |
| 430 | device_remove_file(&acpi->dev, &cmpc_accel_g_select_attr_v4); | 424 | device_remove_file(&acpi->dev, &cmpc_accel_g_select_attr_v4); |
| 431 | return cmpc_remove_acpi_notify_device(acpi); | 425 | return cmpc_remove_acpi_notify_device(acpi); |
| @@ -656,12 +650,6 @@ failed_file: · 224 unmodified lines | |||
| 656 | 650 | ||
| 657 | static int cmpc_accel_remove(struct acpi_device *acpi) | 651 | static int cmpc_accel_remove(struct acpi_device *acpi) |
| 658 | { | 652 | { |
| 659 | struct input_dev *inputdev; | ||
| 660 | struct cmpc_accel *accel; | ||
| 661 | |||
| 662 | inputdev = dev_get_drvdata(&acpi->dev); | ||
| 663 | accel = dev_get_drvdata(&inputdev->dev); | ||
| 664 | |||
| 665 | device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr); | 653 | device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr); |
| 666 | return cmpc_remove_acpi_notify_device(acpi); | 654 | return cmpc_remove_acpi_notify_device(acpi); |
| 667 | } | 655 | } |
| @@ -108,6 +108,7 @@ static int i2c_multi_inst_probe(struct platform_device *pdev) · 107 unmodified lines | |||
| 108 | if (ret < 0) { | 108 | if (ret < 0) { |
| 109 | dev_dbg(dev, "Error requesting irq at index %d: %d\n", | 109 | dev_dbg(dev, "Error requesting irq at index %d: %d\n", |
| 110 | inst_data[i].irq_idx, ret); | 110 | inst_data[i].irq_idx, ret); |
| 111 | goto error; | ||
| 111 | } | 112 | } |
| 112 | board_info.irq = ret; | 113 | board_info.irq = ret; |
| 113 | break; | 114 | break; |
| @@ -293,9 +293,8 @@ static int intel_punit_ipc_probe(struct platform_device *pdev) · 292 unmodified lines | |||
| 293 | 293 | ||
| 294 | platform_set_drvdata(pdev, punit_ipcdev); | 294 | platform_set_drvdata(pdev, punit_ipcdev); |
| 295 | 295 | ||
| 296 | irq = platform_get_irq(pdev, 0); | 296 | irq = platform_get_irq_optional(pdev, 0); |
| 297 | if (irq < 0) { | 297 | if (irq < 0) { |
| 298 | punit_ipcdev->irq = 0; | ||
| 299 | dev_warn(&pdev->dev, "Invalid IRQ, using polling mode\n"); | 298 | dev_warn(&pdev->dev, "Invalid IRQ, using polling mode\n"); |
| 300 | } else { | 299 | } else { |
| 301 | ret = devm_request_irq(&pdev->dev, irq, intel_punit_ioc, | 300 | ret = devm_request_irq(&pdev->dev, irq, intel_punit_ioc, |
| @@ -97,8 +97,8 @@ config PTP_1588_CLOCK_PCH · 96 unmodified lines | |||
| 97 | help | 97 | help |
| 98 | This driver adds support for using the PCH EG20T as a PTP | 98 | This driver adds support for using the PCH EG20T as a PTP |
| 99 | clock. The hardware supports time stamping of PTP packets | 99 | clock. The hardware supports time stamping of PTP packets |
| 100 | when using the end-to-end delay (E2E) mechansim. The peer | 100 | when using the end-to-end delay (E2E) mechanism. The peer |
| 101 | delay mechansim (P2P) is not supported. | 101 | delay mechanism (P2P) is not supported. |
| 102 | 102 | ||
| 103 | This clock is only useful if your PTP programs are getting | 103 | This clock is only useful if your PTP programs are getting |
| 104 | hardware time stamps on the PTP Ethernet packets using the | 104 | hardware time stamps on the PTP Ethernet packets using the |
| @@ -5053,6 +5053,19 @@ regulator_register(const struct regulator_desc *regulator_desc, · 5052 unmodified lines | |||
| 5053 | 5053 | ||
| 5054 | init_data = regulator_of_get_init_data(dev, regulator_desc, config, | 5054 | init_data = regulator_of_get_init_data(dev, regulator_desc, config, |
| 5055 | &rdev->dev.of_node); | 5055 | &rdev->dev.of_node); |
| 5056 | |||
| 5057 | /* | ||
| 5058 | * Sometimes not all resources are probed already so we need to take | ||
| 5059 | * that into account. This happens most the time if the ena_gpiod comes | ||
| 5060 | * from a gpio extender or something else. | ||
| 5061 | */ | ||
| 5062 | if (PTR_ERR(init_data) == -EPROBE_DEFER) { | ||
| 5063 | kfree(config); | ||
| 5064 | kfree(rdev); | ||
| 5065 | ret = -EPROBE_DEFER; | ||
| 5066 | goto rinse; | ||
| 5067 | } | ||
| 5068 | |||
| 5056 | /* | 5069 | /* |
| 5057 | * We need to keep track of any GPIO descriptor coming from the | 5070 | * We need to keep track of any GPIO descriptor coming from the |
| 5058 | * device tree until we have handled it over to the core. If the | 5071 | * device tree until we have handled it over to the core. If the |
| @@ -136,7 +136,6 @@ static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode) · 135 unmodified lines | |||
| 136 | static unsigned da9062_buck_get_mode(struct regulator_dev *rdev) | 136 | static unsigned da9062_buck_get_mode(struct regulator_dev *rdev) |
| 137 | { | 137 | { |
| 138 | struct da9062_regulator *regl = rdev_get_drvdata(rdev); | 138 | struct da9062_regulator *regl = rdev_get_drvdata(rdev); |
| 139 | struct regmap_field *field; | ||
| 140 | unsigned int val, mode = 0; | 139 | unsigned int val, mode = 0; |
| 141 | int ret; | 140 | int ret; |
| 142 | 141 | ||
| @@ -158,18 +157,7 @@ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev) · 15 unmodified lines | |||
| 158 | return REGULATOR_MODE_NORMAL; | 157 | return REGULATOR_MODE_NORMAL; |
| 159 | } | 158 | } |
| 160 | 159 | ||
| 161 | /* Detect current regulator state */ | 160 | ret = regmap_field_read(regl->sleep, &val); |
| 162 | ret = regmap_field_read(regl->suspend, &val); | ||
| 163 | if (ret < 0) | ||
| 164 | return 0; | ||
| 165 | |||
| 166 | /* Read regulator mode from proper register, depending on state */ | ||
| 167 | if (val) | ||
| 168 | field = regl->suspend_sleep; | ||
| 169 | else | ||
| 170 | field = regl->sleep; | ||
| 171 | |||
| 172 | ret = regmap_field_read(field, &val); | ||
| 173 | if (ret < 0) | 161 | if (ret < 0) |
| 174 | return 0; | 162 | return 0; |
| 175 | 163 | ||
| @@ -208,21 +196,9 @@ static int da9062_ldo_set_mode(struct regulator_dev *rdev, unsigned mode) · 32 unmodified lines | |||
| 208 | static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev) | 196 | static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev) |
| 209 | { | 197 | { |
| 210 | struct da9062_regulator *regl = rdev_get_drvdata(rdev); | 198 | struct da9062_regulator *regl = rdev_get_drvdata(rdev); |
| 211 | struct regmap_field *field; | ||
| 212 | int ret, val; | 199 | int ret, val; |
| 213 | 200 | ||
| 214 | /* Detect current regulator state */ | 201 | ret = regmap_field_read(regl->sleep, &val); |
| 215 | ret = regmap_field_read(regl->suspend, &val); | ||
| 216 | if (ret < 0) | ||
| 217 | return 0; | ||
| 218 | |||
| 219 | /* Read regulator mode from proper register, depending on state */ | ||
| 220 | if (val) | ||
| 221 | field = regl->suspend_sleep; | ||
| 222 | else | ||
| 223 | field = regl->sleep; | ||
| 224 | |||
| 225 | ret = regmap_field_read(field, &val); | ||
| 226 | if (ret < 0) | 202 | if (ret < 0) |
| 227 | return 0; | 203 | return 0; |
| 228 | 204 | ||
| @@ -408,10 +384,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 179 unmodified lines | |||
| 408 | __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1, | 384 | __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1, |
| 409 | sizeof(unsigned int) * 8 - | 385 | sizeof(unsigned int) * 8 - |
| 410 | __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1), | 386 | __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1), |
| 411 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 387 | .suspend = REG_FIELD(DA9062AA_BUCK1_CONT, |
| 412 | __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1, | 388 | __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1, |
| 413 | sizeof(unsigned int) * 8 - | 389 | sizeof(unsigned int) * 8 - |
| 414 | __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1), | 390 | __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1), |
| 415 | }, | 391 | }, |
| 416 | { | 392 | { |
| 417 | .desc.id = DA9061_ID_BUCK2, | 393 | .desc.id = DA9061_ID_BUCK2, |
| @@ -444,10 +420,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 26 unmodified lines | |||
| 444 | __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1, | 420 | __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1, |
| 445 | sizeof(unsigned int) * 8 - | 421 | sizeof(unsigned int) * 8 - |
| 446 | __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1), | 422 | __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1), |
| 447 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 423 | .suspend = REG_FIELD(DA9062AA_BUCK3_CONT, |
| 448 | __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1, | 424 | __builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1, |
| 449 | sizeof(unsigned int) * 8 - | 425 | sizeof(unsigned int) * 8 - |
| 450 | __builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1), | 426 | __builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1), |
| 451 | }, | 427 | }, |
| 452 | { | 428 | { |
| 453 | .desc.id = DA9061_ID_BUCK3, | 429 | .desc.id = DA9061_ID_BUCK3, |
| @@ -480,10 +456,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 26 unmodified lines | |||
| 480 | __builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1, | 456 | __builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1, |
| 481 | sizeof(unsigned int) * 8 - | 457 | sizeof(unsigned int) * 8 - |
| 482 | __builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1), | 458 | __builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1), |
| 483 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 459 | .suspend = REG_FIELD(DA9062AA_BUCK4_CONT, |
| 484 | __builtin_ffs((int)DA9062AA_VBUCK4_SEL_MASK) - 1, | 460 | __builtin_ffs((int)DA9062AA_BUCK4_CONF_MASK) - 1, |
| 485 | sizeof(unsigned int) * 8 - | 461 | sizeof(unsigned int) * 8 - |
| 486 | __builtin_clz((DA9062AA_VBUCK4_SEL_MASK)) - 1), | 462 | __builtin_clz(DA9062AA_BUCK4_CONF_MASK) - 1), |
| 487 | }, | 463 | }, |
| 488 | { | 464 | { |
| 489 | .desc.id = DA9061_ID_LDO1, | 465 | .desc.id = DA9061_ID_LDO1, |
| @@ -509,10 +485,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 19 unmodified lines | |||
| 509 | sizeof(unsigned int) * 8 - | 485 | sizeof(unsigned int) * 8 - |
| 510 | __builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1), | 486 | __builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1), |
| 511 | .suspend_vsel_reg = DA9062AA_VLDO1_B, | 487 | .suspend_vsel_reg = DA9062AA_VLDO1_B, |
| 512 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 488 | .suspend = REG_FIELD(DA9062AA_LDO1_CONT, |
| 513 | __builtin_ffs((int)DA9062AA_VLDO1_SEL_MASK) - 1, | 489 | __builtin_ffs((int)DA9062AA_LDO1_CONF_MASK) - 1, |
| 514 | sizeof(unsigned int) * 8 - | 490 | sizeof(unsigned int) * 8 - |
| 515 | __builtin_clz((DA9062AA_VLDO1_SEL_MASK)) - 1), | 491 | __builtin_clz(DA9062AA_LDO1_CONF_MASK) - 1), |
| 516 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, | 492 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, |
| 517 | __builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1, | 493 | __builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1, |
| 518 | sizeof(unsigned int) * 8 - | 494 | sizeof(unsigned int) * 8 - |
| @@ -542,10 +518,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 23 unmodified lines | |||
| 542 | sizeof(unsigned int) * 8 - | 518 | sizeof(unsigned int) * 8 - |
| 543 | __builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1), | 519 | __builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1), |
| 544 | .suspend_vsel_reg = DA9062AA_VLDO2_B, | 520 | .suspend_vsel_reg = DA9062AA_VLDO2_B, |
| 545 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 521 | .suspend = REG_FIELD(DA9062AA_LDO2_CONT, |
| 546 | __builtin_ffs((int)DA9062AA_VLDO2_SEL_MASK) - 1, | 522 | __builtin_ffs((int)DA9062AA_LDO2_CONF_MASK) - 1, |
| 547 | sizeof(unsigned int) * 8 - | 523 | sizeof(unsigned int) * 8 - |
| 548 | __builtin_clz((DA9062AA_VLDO2_SEL_MASK)) - 1), | 524 | __builtin_clz(DA9062AA_LDO2_CONF_MASK) - 1), |
| 549 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, | 525 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, |
| 550 | __builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1, | 526 | __builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1, |
| 551 | sizeof(unsigned int) * 8 - | 527 | sizeof(unsigned int) * 8 - |
| @@ -575,10 +551,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 23 unmodified lines | |||
| 575 | sizeof(unsigned int) * 8 - | 551 | sizeof(unsigned int) * 8 - |
| 576 | __builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1), | 552 | __builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1), |
| 577 | .suspend_vsel_reg = DA9062AA_VLDO3_B, | 553 | .suspend_vsel_reg = DA9062AA_VLDO3_B, |
| 578 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 554 | .suspend = REG_FIELD(DA9062AA_LDO3_CONT, |
| 579 | __builtin_ffs((int)DA9062AA_VLDO3_SEL_MASK) - 1, | 555 | __builtin_ffs((int)DA9062AA_LDO3_CONF_MASK) - 1, |
| 580 | sizeof(unsigned int) * 8 - | 556 | sizeof(unsigned int) * 8 - |
| 581 | __builtin_clz((DA9062AA_VLDO3_SEL_MASK)) - 1), | 557 | __builtin_clz(DA9062AA_LDO3_CONF_MASK) - 1), |
| 582 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, | 558 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, |
| 583 | __builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1, | 559 | __builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1, |
| 584 | sizeof(unsigned int) * 8 - | 560 | sizeof(unsigned int) * 8 - |
| @@ -608,10 +584,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 23 unmodified lines | |||
| 608 | sizeof(unsigned int) * 8 - | 584 | sizeof(unsigned int) * 8 - |
| 609 | __builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1), | 585 | __builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1), |
| 610 | .suspend_vsel_reg = DA9062AA_VLDO4_B, | 586 | .suspend_vsel_reg = DA9062AA_VLDO4_B, |
| 611 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 587 | .suspend = REG_FIELD(DA9062AA_LDO4_CONT, |
| 612 | __builtin_ffs((int)DA9062AA_VLDO4_SEL_MASK) - 1, | 588 | __builtin_ffs((int)DA9062AA_LDO4_CONF_MASK) - 1, |
| 613 | sizeof(unsigned int) * 8 - | 589 | sizeof(unsigned int) * 8 - |
| 614 | __builtin_clz((DA9062AA_VLDO4_SEL_MASK)) - 1), | 590 | __builtin_clz(DA9062AA_LDO4_CONF_MASK) - 1), |
| 615 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, | 591 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, |
| 616 | __builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1, | 592 | __builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1, |
| 617 | sizeof(unsigned int) * 8 - | 593 | sizeof(unsigned int) * 8 - |
| @@ -652,10 +628,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 34 unmodified lines | |||
| 652 | __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1, | 628 | __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1, |
| 653 | sizeof(unsigned int) * 8 - | 629 | sizeof(unsigned int) * 8 - |
| 654 | __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1), | 630 | __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1), |
| 655 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 631 | .suspend = REG_FIELD(DA9062AA_BUCK1_CONT, |
| 656 | __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1, | 632 | __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1, |
| 657 | sizeof(unsigned int) * 8 - | 633 | sizeof(unsigned int) * 8 - |
| 658 | __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1), | 634 | __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1), |
| 659 | }, | 635 | }, |
| 660 | { | 636 | { |
| 661 | .desc.id = DA9062_ID_BUCK2, | 637 | .desc.id = DA9062_ID_BUCK2, |
| @@ -688,10 +664,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 26 unmodified lines | |||
| 688 | __builtin_ffs((int)DA9062AA_BUCK2_MODE_MASK) - 1, | 664 | __builtin_ffs((int)DA9062AA_BUCK2_MODE_MASK) - 1, |
| 689 | sizeof(unsigned int) * 8 - | 665 | sizeof(unsigned int) * 8 - |
| 690 | __builtin_clz((DA9062AA_BUCK2_MODE_MASK)) - 1), | 666 | __builtin_clz((DA9062AA_BUCK2_MODE_MASK)) - 1), |
| 691 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 667 | .suspend = REG_FIELD(DA9062AA_BUCK2_CONT, |
| 692 | __builtin_ffs((int)DA9062AA_VBUCK2_SEL_MASK) - 1, | 668 | __builtin_ffs((int)DA9062AA_BUCK2_CONF_MASK) - 1, |
| 693 | sizeof(unsigned int) * 8 - | 669 | sizeof(unsigned int) * 8 - |
| 694 | __builtin_clz((DA9062AA_VBUCK2_SEL_MASK)) - 1), | 670 | __builtin_clz(DA9062AA_BUCK2_CONF_MASK) - 1), |
| 695 | }, | 671 | }, |
| 696 | { | 672 | { |
| 697 | .desc.id = DA9062_ID_BUCK3, | 673 | .desc.id = DA9062_ID_BUCK3, |
| @@ -724,10 +700,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 26 unmodified lines | |||
| 724 | __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1, | 700 | __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1, |
| 725 | sizeof(unsigned int) * 8 - | 701 | sizeof(unsigned int) * 8 - |
| 726 | __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1), | 702 | __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1), |
| 727 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 703 | .suspend = REG_FIELD(DA9062AA_BUCK3_CONT, |
| 728 | __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1, | 704 | __builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1, |
| 729 | sizeof(unsigned int) * 8 - | 705 | sizeof(unsigned int) * 8 - |
| 730 | __builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1), | 706 | __builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1), |
| 731 | }, | 707 | }, |
| 732 | { | 708 | { |
| 733 | .desc.id = DA9062_ID_BUCK4, | 709 | .desc.id = DA9062_ID_BUCK4, |
| @@ -760,10 +736,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 26 unmodified lines | |||
| 760 | __builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1, | 736 | __builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1, |
| 761 | sizeof(unsigned int) * 8 - | 737 | sizeof(unsigned int) * 8 - |
| 762 | __builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1), | 738 | __builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1), |
| 763 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 739 | .suspend = REG_FIELD(DA9062AA_BUCK4_CONT, |
| 764 | __builtin_ffs((int)DA9062AA_VBUCK4_SEL_MASK) - 1, | 740 | __builtin_ffs((int)DA9062AA_BUCK4_CONF_MASK) - 1, |
| 765 | sizeof(unsigned int) * 8 - | 741 | sizeof(unsigned int) * 8 - |
| 766 | __builtin_clz((DA9062AA_VBUCK4_SEL_MASK)) - 1), | 742 | __builtin_clz(DA9062AA_BUCK4_CONF_MASK) - 1), |
| 767 | }, | 743 | }, |
| 768 | { | 744 | { |
| 769 | .desc.id = DA9062_ID_LDO1, | 745 | .desc.id = DA9062_ID_LDO1, |
| @@ -789,10 +765,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 19 unmodified lines | |||
| 789 | sizeof(unsigned int) * 8 - | 765 | sizeof(unsigned int) * 8 - |
| 790 | __builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1), | 766 | __builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1), |
| 791 | .suspend_vsel_reg = DA9062AA_VLDO1_B, | 767 | .suspend_vsel_reg = DA9062AA_VLDO1_B, |
| 792 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 768 | .suspend = REG_FIELD(DA9062AA_LDO1_CONT, |
| 793 | __builtin_ffs((int)DA9062AA_VLDO1_SEL_MASK) - 1, | 769 | __builtin_ffs((int)DA9062AA_LDO1_CONF_MASK) - 1, |
| 794 | sizeof(unsigned int) * 8 - | 770 | sizeof(unsigned int) * 8 - |
| 795 | __builtin_clz((DA9062AA_VLDO1_SEL_MASK)) - 1), | 771 | __builtin_clz(DA9062AA_LDO1_CONF_MASK) - 1), |
| 796 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, | 772 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, |
| 797 | __builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1, | 773 | __builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1, |
| 798 | sizeof(unsigned int) * 8 - | 774 | sizeof(unsigned int) * 8 - |
| @@ -822,10 +798,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 23 unmodified lines | |||
| 822 | sizeof(unsigned int) * 8 - | 798 | sizeof(unsigned int) * 8 - |
| 823 | __builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1), | 799 | __builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1), |
| 824 | .suspend_vsel_reg = DA9062AA_VLDO2_B, | 800 | .suspend_vsel_reg = DA9062AA_VLDO2_B, |
| 825 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 801 | .suspend = REG_FIELD(DA9062AA_LDO2_CONT, |
| 826 | __builtin_ffs((int)DA9062AA_VLDO2_SEL_MASK) - 1, | 802 | __builtin_ffs((int)DA9062AA_LDO2_CONF_MASK) - 1, |
| 827 | sizeof(unsigned int) * 8 - | 803 | sizeof(unsigned int) * 8 - |
| 828 | __builtin_clz((DA9062AA_VLDO2_SEL_MASK)) - 1), | 804 | __builtin_clz(DA9062AA_LDO2_CONF_MASK) - 1), |
| 829 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, | 805 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, |
| 830 | __builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1, | 806 | __builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1, |
| 831 | sizeof(unsigned int) * 8 - | 807 | sizeof(unsigned int) * 8 - |
| @@ -855,10 +831,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 23 unmodified lines | |||
| 855 | sizeof(unsigned int) * 8 - | 831 | sizeof(unsigned int) * 8 - |
| 856 | __builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1), | 832 | __builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1), |
| 857 | .suspend_vsel_reg = DA9062AA_VLDO3_B, | 833 | .suspend_vsel_reg = DA9062AA_VLDO3_B, |
| 858 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 834 | .suspend = REG_FIELD(DA9062AA_LDO3_CONT, |
| 859 | __builtin_ffs((int)DA9062AA_VLDO3_SEL_MASK) - 1, | 835 | __builtin_ffs((int)DA9062AA_LDO3_CONF_MASK) - 1, |
| 860 | sizeof(unsigned int) * 8 - | 836 | sizeof(unsigned int) * 8 - |
| 861 | __builtin_clz((DA9062AA_VLDO3_SEL_MASK)) - 1), | 837 | __builtin_clz(DA9062AA_LDO3_CONF_MASK) - 1), |
| 862 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, | 838 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, |
| 863 | __builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1, | 839 | __builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1, |
| 864 | sizeof(unsigned int) * 8 - | 840 | sizeof(unsigned int) * 8 - |
| @@ -888,10 +864,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 23 unmodified lines | |||
| 888 | sizeof(unsigned int) * 8 - | 864 | sizeof(unsigned int) * 8 - |
| 889 | __builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1), | 865 | __builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1), |
| 890 | .suspend_vsel_reg = DA9062AA_VLDO4_B, | 866 | .suspend_vsel_reg = DA9062AA_VLDO4_B, |
| 891 | .suspend = REG_FIELD(DA9062AA_DVC_1, | 867 | .suspend = REG_FIELD(DA9062AA_LDO4_CONT, |
| 892 | __builtin_ffs((int)DA9062AA_VLDO4_SEL_MASK) - 1, | 868 | __builtin_ffs((int)DA9062AA_LDO4_CONF_MASK) - 1, |
| 893 | sizeof(unsigned int) * 8 - | 869 | sizeof(unsigned int) * 8 - |
| 894 | __builtin_clz((DA9062AA_VLDO4_SEL_MASK)) - 1), | 870 | __builtin_clz(DA9062AA_LDO4_CONF_MASK) - 1), |
| 895 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, | 871 | .oc_event = REG_FIELD(DA9062AA_STATUS_D, |
| 896 | __builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1, | 872 | __builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1, |
| 897 | sizeof(unsigned int) * 8 - | 873 | sizeof(unsigned int) * 8 - |
| @@ -144,8 +144,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) · 143 unmodified lines | |||
| 144 | struct device *dev = &pdev->dev; | 144 | struct device *dev = &pdev->dev; |
| 145 | struct fixed_voltage_config *config; | 145 | struct fixed_voltage_config *config; |
| 146 | struct fixed_voltage_data *drvdata; | 146 | struct fixed_voltage_data *drvdata; |
| 147 | const struct fixed_dev_type *drvtype = | 147 | const struct fixed_dev_type *drvtype = of_device_get_match_data(dev); |
| 148 | of_match_device(dev->driver->of_match_table, dev)->data; | ||
| 149 | struct regulator_config cfg = { }; | 148 | struct regulator_config cfg = { }; |
| 150 | enum gpiod_flags gflags; | 149 | enum gpiod_flags gflags; |
| 151 | int ret; | 150 | int ret; |
| @@ -177,7 +176,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) · 25 unmodified lines | |||
| 177 | drvdata->desc.type = REGULATOR_VOLTAGE; | 176 | drvdata->desc.type = REGULATOR_VOLTAGE; |
| 178 | drvdata->desc.owner = THIS_MODULE; | 177 | drvdata->desc.owner = THIS_MODULE; |
| 179 | 178 | ||
| 180 | if (drvtype->has_enable_clock) { | 179 | if (drvtype && drvtype->has_enable_clock) { |
| 181 | drvdata->desc.ops = &fixed_voltage_clkenabled_ops; | 180 | drvdata->desc.ops = &fixed_voltage_clkenabled_ops; |
| 182 | 181 | ||
| 183 | drvdata->enable_clock = devm_clk_get(dev, NULL); | 182 | drvdata->enable_clock = devm_clk_get(dev, NULL); |
| @@ -210,6 +210,7 @@ static const struct regulator_desc lochnagar_regulators[] = { · 209 unmodified lines | |||
| 210 | 210 | ||
| 211 | .enable_time = 3000, | 211 | .enable_time = 3000, |
| 212 | .ramp_delay = 1000, | 212 | .ramp_delay = 1000, |
| 213 | .off_on_delay = 15000, | ||
| 213 | 214 | ||
| 214 | .owner = THIS_MODULE, | 215 | .owner = THIS_MODULE, |
| 215 | }, | 216 | }, |
| @@ -231,12 +231,12 @@ static int of_get_regulation_constraints(struct device *dev, · 230 unmodified lines | |||
| 231 | "regulator-off-in-suspend")) | 231 | "regulator-off-in-suspend")) |
| 232 | suspend_state->enabled = DISABLE_IN_SUSPEND; | 232 | suspend_state->enabled = DISABLE_IN_SUSPEND; |
| 233 | 233 | ||
| 234 | if (!of_property_read_u32(np, "regulator-suspend-min-microvolt", | 234 | if (!of_property_read_u32(suspend_np, |
| 235 | &pval)) | 235 | "regulator-suspend-min-microvolt", &pval)) |
| 236 | suspend_state->min_uV = pval; | 236 | suspend_state->min_uV = pval; |
| 237 | 237 | ||
| 238 | if (!of_property_read_u32(np, "regulator-suspend-max-microvolt", | 238 | if (!of_property_read_u32(suspend_np, |
| 239 | &pval)) | 239 | "regulator-suspend-max-microvolt", &pval)) |
| 240 | suspend_state->max_uV = pval; | 240 | suspend_state->max_uV = pval; |
| 241 | 241 | ||
| 242 | if (!of_property_read_u32(suspend_np, | 242 | if (!of_property_read_u32(suspend_np, |
| @@ -445,11 +445,20 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, · 202 unmodified lines | |||
| 445 | goto error; | 445 | goto error; |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | if (desc->of_parse_cb && desc->of_parse_cb(child, desc, config)) { | 448 | if (desc->of_parse_cb) { |
| 449 | dev_err(dev, | 449 | int ret; |
| 450 | "driver callback failed to parse DT for regulator %pOFn\n", | 450 | |
| 451 | child); | 451 | ret = desc->of_parse_cb(child, desc, config); |
| 452 | goto error; | 452 | if (ret) { |
| 453 | if (ret == -EPROBE_DEFER) { | ||
| 454 | of_node_put(child); | ||
| 455 | return ERR_PTR(-EPROBE_DEFER); | ||
| 456 | } | ||
| 457 | dev_err(dev, | ||
| 458 | "driver callback failed to parse DT for regulator %pOFn\n", | ||
| 459 | child); | ||
| 460 | goto error; | ||
| 461 | } | ||
| 453 | } | 462 | } |
| 454 | 463 | ||
| 455 | *node = child; | 464 | *node = child; |
| @@ -788,7 +788,13 @@ static int pfuze100_regulator_probe(struct i2c_client *client, · 787 unmodified lines | |||
| 788 | 788 | ||
| 789 | /* SW2~SW4 high bit check and modify the voltage value table */ | 789 | /* SW2~SW4 high bit check and modify the voltage value table */ |
| 790 | if (i >= sw_check_start && i <= sw_check_end) { | 790 | if (i >= sw_check_start && i <= sw_check_end) { |
| 791 | regmap_read(pfuze_chip->regmap, desc->vsel_reg, &val); | 791 | ret = regmap_read(pfuze_chip->regmap, |
| 792 | desc->vsel_reg, &val); | ||
| 793 | if (ret) { | ||
| 794 | dev_err(&client->dev, "Fails to read from the register.\n"); | ||
| 795 | return ret; | ||
| 796 | } | ||
| 797 | |||
| 792 | if (val & sw_hi) { | 798 | if (val & sw_hi) { |
| 793 | if (pfuze_chip->chip_id == PFUZE3000 || | 799 | if (pfuze_chip->chip_id == PFUZE3000 || |
| 794 | pfuze_chip->chip_id == PFUZE3001) { | 800 | pfuze_chip->chip_id == PFUZE3001) { |
| @@ -735,8 +735,8 @@ static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = { · 734 unmodified lines | |||
| 735 | static const struct rpmh_vreg_hw_data pmic5_bob = { | 735 | static const struct rpmh_vreg_hw_data pmic5_bob = { |
| 736 | .regulator_type = VRM, | 736 | .regulator_type = VRM, |
| 737 | .ops = &rpmh_regulator_vrm_bypass_ops, | 737 | .ops = &rpmh_regulator_vrm_bypass_ops, |
| 738 | .voltage_range = REGULATOR_LINEAR_RANGE(300000, 0, 135, 32000), | 738 | .voltage_range = REGULATOR_LINEAR_RANGE(3000000, 0, 31, 32000), |
| 739 | .n_voltages = 136, | 739 | .n_voltages = 32, |
| 740 | .pmic_mode_map = pmic_mode_map_pmic5_bob, | 740 | .pmic_mode_map = pmic_mode_map_pmic5_bob, |
| 741 | .of_map_mode = rpmh_regulator_pmic4_bob_of_map_mode, | 741 | .of_map_mode = rpmh_regulator_pmic4_bob_of_map_mode, |
| 742 | }; | 742 | }; |
| @@ -173,19 +173,14 @@ static int ti_abb_wait_txdone(struct device *dev, struct ti_abb *abb) · 172 unmodified lines | |||
| 173 | while (timeout++ <= abb->settling_time) { | 173 | while (timeout++ <= abb->settling_time) { |
| 174 | status = ti_abb_check_txdone(abb); | 174 | status = ti_abb_check_txdone(abb); |
| 175 | if (status) | 175 | if (status) |
| 176 | break; | 176 | return 0; |
| 177 | 177 | ||
| 178 | udelay(1); | 178 | udelay(1); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | if (timeout > abb->settling_time) { | 181 | dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n", |
| 182 | dev_warn_ratelimited(dev, | 182 | __func__, timeout, readl(abb->int_base)); |
| 183 | "%s:TRANXDONE timeout(%duS) int=0x%08x\n", | 183 | return -ETIMEDOUT; |
| 184 | __func__, timeout, readl(abb->int_base)); | ||
| 185 | return -ETIMEDOUT; | ||
| 186 | } | ||
| 187 | |||
| 188 | return 0; | ||
| 189 | } | 184 | } |
| 190 | 185 | ||
| 191 | /** | 186 | /** |
| @@ -205,19 +200,14 @@ static int ti_abb_clear_all_txdone(struct device *dev, const struct ti_abb *abb) · 13 unmodified lines | |||
| 205 | 200 | ||
| 206 | status = ti_abb_check_txdone(abb); | 201 | status = ti_abb_check_txdone(abb); |
| 207 | if (!status) | 202 | if (!status) |
| 208 | break; | 203 | return 0; |
| 209 | 204 | ||
| 210 | udelay(1); | 205 | udelay(1); |
| 211 | } | 206 | } |
| 212 | 207 | ||
| 213 | if (timeout > abb->settling_time) { | 208 | dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n", |
| 214 | dev_warn_ratelimited(dev, | 209 | __func__, timeout, readl(abb->int_base)); |
| 215 | "%s:TRANXDONE timeout(%duS) int=0x%08x\n", | 210 | return -ETIMEDOUT; |
| 216 | __func__, timeout, readl(abb->int_base)); | ||
| 217 | return -ETIMEDOUT; | ||
| 218 | } | ||
| 219 | |||
| 220 | return 0; | ||
| 221 | } | 211 | } |
| 222 | 212 | ||
| 223 | /** | 213 | /** |
| @@ -522,8 +522,7 @@ static int zcrypt_release(struct inode *inode, struct file *filp) · 521 unmodified lines | |||
| 522 | if (filp->f_inode->i_cdev == &zcrypt_cdev) { | 522 | if (filp->f_inode->i_cdev == &zcrypt_cdev) { |
| 523 | struct zcdn_device *zcdndev; | 523 | struct zcdn_device *zcdndev; |
| 524 | 524 | ||
| 525 | if (mutex_lock_interruptible(&ap_perms_mutex)) | 525 | mutex_lock(&ap_perms_mutex); |
| 526 | return -ERESTARTSYS; | ||
| 527 | zcdndev = find_zcdndev_by_devt(filp->f_inode->i_rdev); | 526 | zcdndev = find_zcdndev_by_devt(filp->f_inode->i_rdev); |
| 528 | mutex_unlock(&ap_perms_mutex); | 527 | mutex_unlock(&ap_perms_mutex); |
| 529 | if (zcdndev) { | 528 | if (zcdndev) { |
| @@ -2021,10 +2021,10 @@ static bool qeth_l2_vnicc_recover_char(struct qeth_card *card, u32 vnicc, · 2020 unmodified lines | |||
| 2021 | static void qeth_l2_vnicc_init(struct qeth_card *card) | 2021 | static void qeth_l2_vnicc_init(struct qeth_card *card) |
| 2022 | { | 2022 | { |
| 2023 | u32 *timeout = &card->options.vnicc.learning_timeout; | 2023 | u32 *timeout = &card->options.vnicc.learning_timeout; |
| 2024 | bool enable, error = false; | ||
| 2024 | unsigned int chars_len, i; | 2025 | unsigned int chars_len, i; |
| 2025 | unsigned long chars_tmp; | 2026 | unsigned long chars_tmp; |
| 2026 | u32 sup_cmds, vnicc; | 2027 | u32 sup_cmds, vnicc; |
| 2027 | bool enable, error; | ||
| 2028 | 2028 | ||
| 2029 | QETH_CARD_TEXT(card, 2, "vniccini"); | 2029 | QETH_CARD_TEXT(card, 2, "vniccini"); |
| 2030 | /* reset rx_bcast */ | 2030 | /* reset rx_bcast */ |
| @@ -2045,17 +2045,24 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) · 14 unmodified lines | |||
| 2045 | chars_len = sizeof(card->options.vnicc.sup_chars) * BITS_PER_BYTE; | 2045 | chars_len = sizeof(card->options.vnicc.sup_chars) * BITS_PER_BYTE; |
| 2046 | for_each_set_bit(i, &chars_tmp, chars_len) { | 2046 | for_each_set_bit(i, &chars_tmp, chars_len) { |
| 2047 | vnicc = BIT(i); | 2047 | vnicc = BIT(i); |
| 2048 | qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds); | 2048 | if (qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds)) { |
| 2049 | if (!(sup_cmds & IPA_VNICC_SET_TIMEOUT) || | 2049 | sup_cmds = 0; |
| 2050 | !(sup_cmds & IPA_VNICC_GET_TIMEOUT)) | 2050 | error = true; |
| 2051 | } | ||
| 2052 | if ((sup_cmds & IPA_VNICC_SET_TIMEOUT) && | ||
| 2053 | (sup_cmds & IPA_VNICC_GET_TIMEOUT)) | ||
| 2054 | card->options.vnicc.getset_timeout_sup |= vnicc; | ||
| 2055 | else | ||
| 2051 | card->options.vnicc.getset_timeout_sup &= ~vnicc; | 2056 | card->options.vnicc.getset_timeout_sup &= ~vnicc; |
| 2052 | if (!(sup_cmds & IPA_VNICC_ENABLE) || | 2057 | if ((sup_cmds & IPA_VNICC_ENABLE) && |
| 2053 | !(sup_cmds & IPA_VNICC_DISABLE)) | 2058 | (sup_cmds & IPA_VNICC_DISABLE)) |
| 2059 | card->options.vnicc.set_char_sup |= vnicc; | ||
| 2060 | else | ||
| 2054 | card->options.vnicc.set_char_sup &= ~vnicc; | 2061 | card->options.vnicc.set_char_sup &= ~vnicc; |
| 2055 | } | 2062 | } |
| 2056 | /* enforce assumed default values and recover settings, if changed */ | 2063 | /* enforce assumed default values and recover settings, if changed */ |
| 2057 | error = qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING, | 2064 | error |= qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING, |
| 2058 | timeout); | 2065 | timeout); |
| 2059 | chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT; | 2066 | chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT; |
| 2060 | chars_tmp |= QETH_VNICC_BRIDGE_INVISIBLE; | 2067 | chars_tmp |= QETH_VNICC_BRIDGE_INVISIBLE; |
| 2061 | chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE; | 2068 | chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE; |
| @@ -27,6 +27,11 @@ · 26 unmodified lines | |||
| 27 | 27 | ||
| 28 | struct kmem_cache *zfcp_fsf_qtcb_cache; | 28 | struct kmem_cache *zfcp_fsf_qtcb_cache; |
| 29 | 29 | ||
| 30 | static bool ber_stop = true; | ||
| 31 | module_param(ber_stop, bool, 0600); | ||
| 32 | MODULE_PARM_DESC(ber_stop, | ||
| 33 | "Shuts down FCP devices for FCP channels that report a bit-error count in excess of its threshold (default on)"); | ||
| 34 | |||
| 30 | static void zfcp_fsf_request_timeout_handler(struct timer_list *t) | 35 | static void zfcp_fsf_request_timeout_handler(struct timer_list *t) |
| 31 | { | 36 | { |
| 32 | struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer); | 37 | struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer); |
| @@ -236,10 +241,15 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) · 203 unmodified lines | |||
| 236 | case FSF_STATUS_READ_SENSE_DATA_AVAIL: | 241 | case FSF_STATUS_READ_SENSE_DATA_AVAIL: |
| 237 | break; | 242 | break; |
| 238 | case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: | 243 | case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: |
| 239 | dev_warn(&adapter->ccw_device->dev, | ||
| 240 | "The error threshold for checksum statistics " | ||
| 241 | "has been exceeded\n"); | ||
| 242 | zfcp_dbf_hba_bit_err("fssrh_3", req); | 244 | zfcp_dbf_hba_bit_err("fssrh_3", req); |
| 245 | if (ber_stop) { | ||
| 246 | dev_warn(&adapter->ccw_device->dev, | ||
| 247 | "All paths over this FCP device are disused because of excessive bit errors\n"); | ||
| 248 | zfcp_erp_adapter_shutdown(adapter, 0, "fssrh_b"); | ||
| 249 | } else { | ||
| 250 | dev_warn(&adapter->ccw_device->dev, | ||
| 251 | "The error threshold for checksum statistics has been exceeded\n"); | ||
| 252 | } | ||
| 243 | break; | 253 | break; |
| 244 | case FSF_STATUS_READ_LINK_DOWN: | 254 | case FSF_STATUS_READ_LINK_DOWN: |
| 245 | zfcp_fsf_status_read_link_down(req); | 255 | zfcp_fsf_status_read_link_down(req); |
| @@ -898,7 +898,7 @@ config SCSI_SNI_53C710 · 897 unmodified lines | |||
| 898 | 898 | ||
| 899 | config 53C700_LE_ON_BE | 899 | config 53C700_LE_ON_BE |
| 900 | bool | 900 | bool |
| 901 | depends on SCSI_LASI700 | 901 | depends on SCSI_LASI700 || SCSI_SNI_53C710 |
| 902 | default y | 902 | default y |
| 903 | 903 | ||
| 904 | config SCSI_STEX | 904 | config SCSI_STEX |
| @@ -579,7 +579,6 @@ ch_release(struct inode *inode, struct file *file) · 578 unmodified lines | |||
| 579 | scsi_changer *ch = file->private_data; | 579 | scsi_changer *ch = file->private_data; |
| 580 | 580 | ||
| 581 | scsi_device_put(ch->device); | 581 | scsi_device_put(ch->device); |
| 582 | ch->device = NULL; | ||
| 583 | file->private_data = NULL; | 582 | file->private_data = NULL; |
| 584 | kref_put(&ch->ref, ch_destroy); | 583 | kref_put(&ch->ref, ch_destroy); |
| 585 | return 0; | 584 | return 0; |
| @@ -512,6 +512,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 511 unmodified lines | |||
| 512 | unsigned int tpg_desc_tbl_off; | 512 | unsigned int tpg_desc_tbl_off; |
| 513 | unsigned char orig_transition_tmo; | 513 | unsigned char orig_transition_tmo; |
| 514 | unsigned long flags; | 514 | unsigned long flags; |
| 515 | bool transitioning_sense = false; | ||
| 515 | 516 | ||
| 516 | if (!pg->expiry) { | 517 | if (!pg->expiry) { |
| 517 | unsigned long transition_tmo = ALUA_FAILOVER_TIMEOUT * HZ; | 518 | unsigned long transition_tmo = ALUA_FAILOVER_TIMEOUT * HZ; |
| @@ -572,13 +573,19 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 54 unmodified lines | |||
| 572 | goto retry; | 573 | goto retry; |
| 573 | } | 574 | } |
| 574 | /* | 575 | /* |
| 575 | * Retry on ALUA state transition or if any | 576 | * If the array returns with 'ALUA state transition' |
| 576 | * UNIT ATTENTION occurred. | 577 | * sense code here it cannot return RTPG data during |
| 578 | * transition. So set the state to 'transitioning' directly. | ||
| 577 | */ | 579 | */ |
| 578 | if (sense_hdr.sense_key == NOT_READY && | 580 | if (sense_hdr.sense_key == NOT_READY && |
| 579 | sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a) | 581 | sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a) { |
| 580 | err = SCSI_DH_RETRY; | 582 | transitioning_sense = true; |
| 581 | else if (sense_hdr.sense_key == UNIT_ATTENTION) | 583 | goto skip_rtpg; |
| 584 | } | ||
| 585 | /* | ||
| 586 | * Retry on any other UNIT ATTENTION occurred. | ||
| 587 | */ | ||
| 588 | if (sense_hdr.sense_key == UNIT_ATTENTION) | ||
| 582 | err = SCSI_DH_RETRY; | 589 | err = SCSI_DH_RETRY; |
| 583 | if (err == SCSI_DH_RETRY && | 590 | if (err == SCSI_DH_RETRY && |
| 584 | pg->expiry != 0 && time_before(jiffies, pg->expiry)) { | 591 | pg->expiry != 0 && time_before(jiffies, pg->expiry)) { |
| @@ -666,7 +673,11 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 81 unmodified lines | |||
| 666 | off = 8 + (desc[7] * 4); | 673 | off = 8 + (desc[7] * 4); |
| 667 | } | 674 | } |
| 668 | 675 | ||
| 676 | skip_rtpg: | ||
| 669 | spin_lock_irqsave(&pg->lock, flags); | 677 | spin_lock_irqsave(&pg->lock, flags); |
| 678 | if (transitioning_sense) | ||
| 679 | pg->state = SCSI_ACCESS_STATE_TRANSITIONING; | ||
| 680 | |||
| 670 | sdev_printk(KERN_INFO, sdev, | 681 | sdev_printk(KERN_INFO, sdev, |
| 671 | "%s: port group %02x state %c %s supports %c%c%c%c%c%c%c\n", | 682 | "%s: port group %02x state %c %s supports %c%c%c%c%c%c%c\n", |
| 672 | ALUA_DH_NAME, pg->group_id, print_alua_state(pg->state), | 683 | ALUA_DH_NAME, pg->group_id, print_alua_state(pg->state), |
| @@ -5477,6 +5477,8 @@ static int hpsa_ciss_submit(struct ctlr_info *h, · 5476 unmodified lines | |||
| 5477 | return SCSI_MLQUEUE_HOST_BUSY; | 5477 | return SCSI_MLQUEUE_HOST_BUSY; |
| 5478 | } | 5478 | } |
| 5479 | 5479 | ||
| 5480 | c->device = dev; | ||
| 5481 | |||
| 5480 | enqueue_cmd_and_start_io(h, c); | 5482 | enqueue_cmd_and_start_io(h, c); |
| 5481 | /* the cmd'll come back via intr handler in complete_scsi_command() */ | 5483 | /* the cmd'll come back via intr handler in complete_scsi_command() */ |
| 5482 | return 0; | 5484 | return 0; |
| @@ -5548,6 +5550,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h, · 65 unmodified lines | |||
| 5548 | hpsa_cmd_init(h, c->cmdindex, c); | 5550 | hpsa_cmd_init(h, c->cmdindex, c); |
| 5549 | c->cmd_type = CMD_SCSI; | 5551 | c->cmd_type = CMD_SCSI; |
| 5550 | c->scsi_cmd = cmd; | 5552 | c->scsi_cmd = cmd; |
| 5553 | c->device = dev; | ||
| 5551 | rc = hpsa_scsi_ioaccel_raid_map(h, c); | 5554 | rc = hpsa_scsi_ioaccel_raid_map(h, c); |
| 5552 | if (rc < 0) /* scsi_dma_map failed. */ | 5555 | if (rc < 0) /* scsi_dma_map failed. */ |
| 5553 | rc = SCSI_MLQUEUE_HOST_BUSY; | 5556 | rc = SCSI_MLQUEUE_HOST_BUSY; |
| @@ -5555,6 +5558,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h, · 1 unmodified line | |||
| 5555 | hpsa_cmd_init(h, c->cmdindex, c); | 5558 | hpsa_cmd_init(h, c->cmdindex, c); |
| 5556 | c->cmd_type = CMD_SCSI; | 5559 | c->cmd_type = CMD_SCSI; |
| 5557 | c->scsi_cmd = cmd; | 5560 | c->scsi_cmd = cmd; |
| 5561 | c->device = dev; | ||
| 5558 | rc = hpsa_scsi_ioaccel_direct_map(h, c); | 5562 | rc = hpsa_scsi_ioaccel_direct_map(h, c); |
| 5559 | if (rc < 0) /* scsi_dma_map failed. */ | 5563 | if (rc < 0) /* scsi_dma_map failed. */ |
| 5560 | rc = SCSI_MLQUEUE_HOST_BUSY; | 5564 | rc = SCSI_MLQUEUE_HOST_BUSY; |
| @@ -9055,7 +9055,6 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba) · 9054 unmodified lines | |||
| 9055 | } | 9055 | } |
| 9056 | } | 9056 | } |
| 9057 | 9057 | ||
| 9058 | #if defined(BUILD_NVME) | ||
| 9059 | /* Clear NVME stats */ | 9058 | /* Clear NVME stats */ |
| 9060 | if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { | 9059 | if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) { |
| 9061 | for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { | 9060 | for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { |
| @@ -9063,7 +9062,6 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba) · 1 unmodified line | |||
| 9063 | sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); | 9062 | sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat)); |
| 9064 | } | 9063 | } |
| 9065 | } | 9064 | } |
| 9066 | #endif | ||
| 9067 | 9065 | ||
| 9068 | /* Clear SCSI stats */ | 9066 | /* Clear SCSI stats */ |
| 9069 | if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { | 9067 | if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) { |
| @@ -528,7 +528,6 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, · 527 unmodified lines | |||
| 528 | list_del_init(&psb->list); | 528 | list_del_init(&psb->list); |
| 529 | psb->exch_busy = 0; | 529 | psb->exch_busy = 0; |
| 530 | psb->status = IOSTAT_SUCCESS; | 530 | psb->status = IOSTAT_SUCCESS; |
| 531 | #ifdef BUILD_NVME | ||
| 532 | if (psb->cur_iocbq.iocb_flag == LPFC_IO_NVME) { | 531 | if (psb->cur_iocbq.iocb_flag == LPFC_IO_NVME) { |
| 533 | qp->abts_nvme_io_bufs--; | 532 | qp->abts_nvme_io_bufs--; |
| 534 | spin_unlock(&qp->abts_io_buf_list_lock); | 533 | spin_unlock(&qp->abts_io_buf_list_lock); |
| @@ -536,7 +535,6 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, · 1 unmodified line | |||
| 536 | lpfc_sli4_nvme_xri_aborted(phba, axri, psb); | 535 | lpfc_sli4_nvme_xri_aborted(phba, axri, psb); |
| 537 | return; | 536 | return; |
| 538 | } | 537 | } |
| 539 | #endif | ||
| 540 | qp->abts_scsi_io_bufs--; | 538 | qp->abts_scsi_io_bufs--; |
| 541 | spin_unlock(&qp->abts_io_buf_list_lock); | 539 | spin_unlock(&qp->abts_io_buf_list_lock); |
| 542 | 540 | ||
| @@ -2837,8 +2837,6 @@ qla2x00_status_cont_entry(struct rsp_que *rsp, sts_cont_entry_t *pkt) · 2836 unmodified lines | |||
| 2837 | if (sense_len == 0) { | 2837 | if (sense_len == 0) { |
| 2838 | rsp->status_srb = NULL; | 2838 | rsp->status_srb = NULL; |
| 2839 | sp->done(sp, cp->result); | 2839 | sp->done(sp, cp->result); |
| 2840 | } else { | ||
| 2841 | WARN_ON_ONCE(true); | ||
| 2842 | } | 2840 | } |
| 2843 | } | 2841 | } |
| 2844 | 2842 | ||
| @@ -3224,6 +3224,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 3223 unmodified lines | |||
| 3224 | req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); | 3224 | req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); |
| 3225 | 3225 | ||
| 3226 | ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0); | 3226 | ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0); |
| 3227 | if (unlikely(!ha->wq)) { | ||
| 3228 | ret = -ENOMEM; | ||
| 3229 | goto probe_failed; | ||
| 3230 | } | ||
| 3227 | 3231 | ||
| 3228 | if (ha->isp_ops->initialize_adapter(base_vha)) { | 3232 | if (ha->isp_ops->initialize_adapter(base_vha)) { |
| 3229 | ql_log(ql_log_fatal, base_vha, 0x00d6, | 3233 | ql_log(ql_log_fatal, base_vha, 0x00d6, |
| @@ -967,6 +967,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, · 966 unmodified lines | |||
| 967 | ses->data_direction = scmd->sc_data_direction; | 967 | ses->data_direction = scmd->sc_data_direction; |
| 968 | ses->sdb = scmd->sdb; | 968 | ses->sdb = scmd->sdb; |
| 969 | ses->result = scmd->result; | 969 | ses->result = scmd->result; |
| 970 | ses->resid_len = scmd->req.resid_len; | ||
| 970 | ses->underflow = scmd->underflow; | 971 | ses->underflow = scmd->underflow; |
| 971 | ses->prot_op = scmd->prot_op; | 972 | ses->prot_op = scmd->prot_op; |
| 972 | ses->eh_eflags = scmd->eh_eflags; | 973 | ses->eh_eflags = scmd->eh_eflags; |
| @@ -977,6 +978,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, · 4 unmodified lines | |||
| 977 | memset(scmd->cmnd, 0, BLK_MAX_CDB); | 978 | memset(scmd->cmnd, 0, BLK_MAX_CDB); |
| 978 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); | 979 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); |
| 979 | scmd->result = 0; | 980 | scmd->result = 0; |
| 981 | scmd->req.resid_len = 0; | ||
| 980 | 982 | ||
| 981 | if (sense_bytes) { | 983 | if (sense_bytes) { |
| 982 | scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE, | 984 | scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE, |
| @@ -1029,6 +1031,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) · 46 unmodified lines | |||
| 1029 | scmd->sc_data_direction = ses->data_direction; | 1031 | scmd->sc_data_direction = ses->data_direction; |
| 1030 | scmd->sdb = ses->sdb; | 1032 | scmd->sdb = ses->sdb; |
| 1031 | scmd->result = ses->result; | 1033 | scmd->result = ses->result; |
| 1034 | scmd->req.resid_len = ses->resid_len; | ||
| 1032 | scmd->underflow = ses->underflow; | 1035 | scmd->underflow = ses->underflow; |
| 1033 | scmd->prot_op = ses->prot_op; | 1036 | scmd->prot_op = ses->prot_op; |
| 1034 | scmd->eh_eflags = ses->eh_eflags; | 1037 | scmd->eh_eflags = ses->eh_eflags; |
| @@ -1834,6 +1834,7 @@ static const struct blk_mq_ops scsi_mq_ops_no_commit = { · 1833 unmodified lines | |||
| 1834 | .init_request = scsi_mq_init_request, | 1834 | .init_request = scsi_mq_init_request, |
| 1835 | .exit_request = scsi_mq_exit_request, | 1835 | .exit_request = scsi_mq_exit_request, |
| 1836 | .initialize_rq_fn = scsi_initialize_rq, | 1836 | .initialize_rq_fn = scsi_initialize_rq, |
| 1837 | .cleanup_rq = scsi_cleanup_rq, | ||
| 1837 | .busy = scsi_mq_lld_busy, | 1838 | .busy = scsi_mq_lld_busy, |
| 1838 | .map_queues = scsi_map_queues, | 1839 | .map_queues = scsi_map_queues, |
| 1839 | }; | 1840 | }; |
| @@ -1921,7 +1922,8 @@ struct scsi_device *scsi_device_from_queue(struct request_queue *q) · 81 unmodified lines | |||
| 1921 | { | 1922 | { |
| 1922 | struct scsi_device *sdev = NULL; | 1923 | struct scsi_device *sdev = NULL; |
| 1923 | 1924 | ||
| 1924 | if (q->mq_ops == &scsi_mq_ops) | 1925 | if (q->mq_ops == &scsi_mq_ops_no_commit || |
| 1926 | q->mq_ops == &scsi_mq_ops) | ||
| 1925 | sdev = q->queuedata; | 1927 | sdev = q->queuedata; |
| 1926 | if (!sdev || !get_device(&sdev->sdev_gendev)) | 1928 | if (!sdev || !get_device(&sdev->sdev_gendev)) |
| 1927 | sdev = NULL; | 1929 | sdev = NULL; |
| @@ -730,6 +730,14 @@ sdev_store_delete(struct device *dev, struct device_attribute *attr, · 729 unmodified lines | |||
| 730 | const char *buf, size_t count) | 730 | const char *buf, size_t count) |
| 731 | { | 731 | { |
| 732 | struct kernfs_node *kn; | 732 | struct kernfs_node *kn; |
| 733 | struct scsi_device *sdev = to_scsi_device(dev); | ||
| 734 | |||
| 735 | /* | ||
| 736 | * We need to try to get module, avoiding the module been removed | ||
| 737 | * during delete. | ||
| 738 | */ | ||
| 739 | if (scsi_device_get(sdev)) | ||
| 740 | return -ENODEV; | ||
| 733 | 741 | ||
| 734 | kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); | 742 | kn = sysfs_break_active_protection(&dev->kobj, &attr->attr); |
| 735 | WARN_ON_ONCE(!kn); | 743 | WARN_ON_ONCE(!kn); |
| @@ -744,9 +752,10 @@ sdev_store_delete(struct device *dev, struct device_attribute *attr, · 8 unmodified lines | |||
| 744 | * state into SDEV_DEL. | 752 | * state into SDEV_DEL. |
| 745 | */ | 753 | */ |
| 746 | device_remove_file(dev, attr); | 754 | device_remove_file(dev, attr); |
| 747 | scsi_remove_device(to_scsi_device(dev)); | 755 | scsi_remove_device(sdev); |
| 748 | if (kn) | 756 | if (kn) |
| 749 | sysfs_unbreak_active_protection(kn); | 757 | sysfs_unbreak_active_protection(kn); |
| 758 | scsi_device_put(sdev); | ||
| 750 | return count; | 759 | return count; |
| 751 | }; | 760 | }; |
| 752 | static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); | 761 | static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); |
| @@ -1654,7 +1654,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) · 1653 unmodified lines | |||
| 1654 | /* we need to evaluate the error return */ | 1654 | /* we need to evaluate the error return */ |
| 1655 | if (scsi_sense_valid(sshdr) && | 1655 | if (scsi_sense_valid(sshdr) && |
| 1656 | (sshdr->asc == 0x3a || /* medium not present */ | 1656 | (sshdr->asc == 0x3a || /* medium not present */ |
| 1657 | sshdr->asc == 0x20)) /* invalid command */ | 1657 | sshdr->asc == 0x20 || /* invalid command */ |
| 1658 | (sshdr->asc == 0x74 && sshdr->ascq == 0x71))) /* drive is password locked */ | ||
| 1658 | /* this is no error here */ | 1659 | /* this is no error here */ |
| 1659 | return 0; | 1660 | return 0; |
| 1660 | 1661 | ||
| @@ -66,10 +66,8 @@ static int snirm710_probe(struct platform_device *dev) · 65 unmodified lines | |||
| 66 | 66 | ||
| 67 | base = res->start; | 67 | base = res->start; |
| 68 | hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL); | 68 | hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL); |
| 69 | if (!hostdata) { | 69 | if (!hostdata) |
| 70 | dev_printk(KERN_ERR, dev, "Failed to allocate host data\n"); | ||
| 71 | return -ENOMEM; | 70 | return -ENOMEM; |
| 72 | } | ||
| 73 | 71 | ||
| 74 | hostdata->dev = &dev->dev; | 72 | hostdata->dev = &dev->dev; |
| 75 | dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); | 73 | dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); |
| @@ -46,7 +46,7 @@ static ssize_t soc_uid_show(struct device *dev, · 45 unmodified lines | |||
| 46 | hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID; | 46 | hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID; |
| 47 | hdr->size = 1; | 47 | hdr->size = 1; |
| 48 | 48 | ||
| 49 | ret = imx_scu_call_rpc(soc_ipc_handle, &msg, false); | 49 | ret = imx_scu_call_rpc(soc_ipc_handle, &msg, true); |
| 50 | if (ret) { | 50 | if (ret) { |
| 51 | pr_err("%s: get soc uid failed, ret %d\n", __func__, ret); | 51 | pr_err("%s: get soc uid failed, ret %d\n", __func__, ret); |
| 52 | return ret; | 52 | return ret; |
| @@ -469,10 +469,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev, · 468 unmodified lines | |||
| 469 | /* Set the encryption - we only support wep */ | 469 | /* Set the encryption - we only support wep */ |
| 470 | if (is_wep) { | 470 | if (is_wep) { |
| 471 | if (sme->key) { | 471 | if (sme->key) { |
| 472 | if (sme->key_idx >= NUM_WEPKEYS) { | 472 | if (sme->key_idx >= NUM_WEPKEYS) |
| 473 | err = -EINVAL; | 473 | return -EINVAL; |
| 474 | goto exit; | ||
| 475 | } | ||
| 476 | 474 | ||
| 477 | result = prism2_domibset_uint32(wlandev, | 475 | result = prism2_domibset_uint32(wlandev, |
| 478 | DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID, | 476 | DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID, |
| @@ -1074,27 +1074,6 @@ passthrough_parse_cdb(struct se_cmd *cmd, · 1073 unmodified lines | |||
| 1074 | struct se_device *dev = cmd->se_dev; | 1074 | struct se_device *dev = cmd->se_dev; |
| 1075 | unsigned int size; | 1075 | unsigned int size; |
| 1076 | 1076 | ||
| 1077 | /* | ||
| 1078 | * Clear a lun set in the cdb if the initiator talking to use spoke | ||
| 1079 | * and old standards version, as we can't assume the underlying device | ||
| 1080 | * won't choke up on it. | ||
| 1081 | */ | ||
| 1082 | switch (cdb[0]) { | ||
| 1083 | case READ_10: /* SBC - RDProtect */ | ||
| 1084 | case READ_12: /* SBC - RDProtect */ | ||
| 1085 | case READ_16: /* SBC - RDProtect */ | ||
| 1086 | case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */ | ||
| 1087 | case VERIFY: /* SBC - VRProtect */ | ||
| 1088 | case VERIFY_16: /* SBC - VRProtect */ | ||
| 1089 | case WRITE_VERIFY: /* SBC - VRProtect */ | ||
| 1090 | case WRITE_VERIFY_12: /* SBC - VRProtect */ | ||
| 1091 | case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ | ||
| 1092 | break; | ||
| 1093 | default: | ||
| 1094 | cdb[1] &= 0x1f; /* clear logical unit number */ | ||
| 1095 | break; | ||
| 1096 | } | ||
| 1097 | |||
| 1098 | /* | 1077 | /* |
| 1099 | * For REPORT LUNS we always need to emulate the response, for everything | 1078 | * For REPORT LUNS we always need to emulate the response, for everything |
| 1100 | * else, pass it up. | 1079 | * else, pass it up. |
| @@ -88,7 +88,7 @@ struct cpufreq_cooling_device { · 87 unmodified lines | |||
| 88 | struct cpufreq_policy *policy; | 88 | struct cpufreq_policy *policy; |
| 89 | struct list_head node; | 89 | struct list_head node; |
| 90 | struct time_in_idle *idle_time; | 90 | struct time_in_idle *idle_time; |
| 91 | struct dev_pm_qos_request qos_req; | 91 | struct freq_qos_request qos_req; |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| 94 | static DEFINE_IDA(cpufreq_ida); | 94 | static DEFINE_IDA(cpufreq_ida); |
| @@ -331,7 +331,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, · 236 unmodified lines | |||
| 331 | 331 | ||
| 332 | cpufreq_cdev->cpufreq_state = state; | 332 | cpufreq_cdev->cpufreq_state = state; |
| 333 | 333 | ||
| 334 | return dev_pm_qos_update_request(&cpufreq_cdev->qos_req, | 334 | return freq_qos_update_request(&cpufreq_cdev->qos_req, |
| 335 | cpufreq_cdev->freq_table[state].frequency); | 335 | cpufreq_cdev->freq_table[state].frequency); |
| 336 | } | 336 | } |
| 337 | 337 | ||
| @@ -615,9 +615,9 @@ __cpufreq_cooling_register(struct device_node *np, · 277 unmodified lines | |||
| 615 | cooling_ops = &cpufreq_cooling_ops; | 615 | cooling_ops = &cpufreq_cooling_ops; |
| 616 | } | 616 | } |
| 617 | 617 | ||
| 618 | ret = dev_pm_qos_add_request(dev, &cpufreq_cdev->qos_req, | 618 | ret = freq_qos_add_request(&policy->constraints, |
| 619 | DEV_PM_QOS_MAX_FREQUENCY, | 619 | &cpufreq_cdev->qos_req, FREQ_QOS_MAX, |
| 620 | cpufreq_cdev->freq_table[0].frequency); | 620 | cpufreq_cdev->freq_table[0].frequency); |
| 621 | if (ret < 0) { | 621 | if (ret < 0) { |
| 622 | pr_err("%s: Failed to add freq constraint (%d)\n", __func__, | 622 | pr_err("%s: Failed to add freq constraint (%d)\n", __func__, |
| 623 | ret); | 623 | ret); |
| @@ -637,7 +637,7 @@ __cpufreq_cooling_register(struct device_node *np, · 13 unmodified lines | |||
| 637 | return cdev; | 637 | return cdev; |
| 638 | 638 | ||
| 639 | remove_qos_req: | 639 | remove_qos_req: |
| 640 | dev_pm_qos_remove_request(&cpufreq_cdev->qos_req); | 640 | freq_qos_remove_request(&cpufreq_cdev->qos_req); |
| 641 | remove_ida: | 641 | remove_ida: |
| 642 | ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id); | 642 | ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id); |
| 643 | free_table: | 643 | free_table: |
| @@ -736,7 +736,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) · 92 unmodified lines | |||
| 736 | mutex_unlock(&cooling_list_lock); | 736 | mutex_unlock(&cooling_list_lock); |
| 737 | 737 | ||
| 738 | thermal_cooling_device_unregister(cdev); | 738 | thermal_cooling_device_unregister(cdev); |
| 739 | dev_pm_qos_remove_request(&cpufreq_cdev->qos_req); | 739 | freq_qos_remove_request(&cpufreq_cdev->qos_req); |
| 740 | ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id); | 740 | ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id); |
| 741 | kfree(cpufreq_cdev->idle_time); | 741 | kfree(cpufreq_cdev->idle_time); |
| 742 | kfree(cpufreq_cdev->freq_table); | 742 | kfree(cpufreq_cdev->freq_table); |
| @@ -72,8 +72,8 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, · 71 unmodified lines | |||
| 72 | { | 72 | { |
| 73 | struct serial_8250_men_mcb_data *data; | 73 | struct serial_8250_men_mcb_data *data; |
| 74 | struct resource *mem; | 74 | struct resource *mem; |
| 75 | unsigned int num_ports; | 75 | int num_ports; |
| 76 | unsigned int i; | 76 | int i; |
| 77 | void __iomem *membase; | 77 | void __iomem *membase; |
| 78 | 78 | ||
| 79 | mem = mcb_get_resource(mdev, IORESOURCE_MEM); | 79 | mem = mcb_get_resource(mdev, IORESOURCE_MEM); |
| @@ -88,7 +88,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, · 8 unmodified lines | |||
| 88 | dev_dbg(&mdev->dev, "found a 16z%03u with %u ports\n", | 88 | dev_dbg(&mdev->dev, "found a 16z%03u with %u ports\n", |
| 89 | mdev->id, num_ports); | 89 | mdev->id, num_ports); |
| 90 | 90 | ||
| 91 | if (num_ports == 0 || num_ports > 4) { | 91 | if (num_ports <= 0 || num_ports > 4) { |
| 92 | dev_err(&mdev->dev, "unexpected number of ports: %u\n", | 92 | dev_err(&mdev->dev, "unexpected number of ports: %u\n", |
| 93 | num_ports); | 93 | num_ports); |
| 94 | return -ENODEV; | 94 | return -ENODEV; |
| @@ -133,7 +133,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, · 38 unmodified lines | |||
| 133 | 133 | ||
| 134 | static void serial_8250_men_mcb_remove(struct mcb_device *mdev) | 134 | static void serial_8250_men_mcb_remove(struct mcb_device *mdev) |
| 135 | { | 135 | { |
| 136 | unsigned int num_ports, i; | 136 | int num_ports, i; |
| 137 | struct serial_8250_men_mcb_data *data = mcb_get_drvdata(mdev); | 137 | struct serial_8250_men_mcb_data *data = mcb_get_drvdata(mdev); |
| 138 | 138 | ||
| 139 | if (!data) | 139 | if (!data) |
| @@ -166,7 +166,6 @@ static int cdns3_core_init_role(struct cdns3 *cdns) · 165 unmodified lines | |||
| 166 | goto err; | 166 | goto err; |
| 167 | 167 | ||
| 168 | switch (cdns->dr_mode) { | 168 | switch (cdns->dr_mode) { |
| 169 | case USB_DR_MODE_UNKNOWN: | ||
| 170 | case USB_DR_MODE_OTG: | 169 | case USB_DR_MODE_OTG: |
| 171 | ret = cdns3_hw_role_switch(cdns); | 170 | ret = cdns3_hw_role_switch(cdns); |
| 172 | if (ret) | 171 | if (ret) |
| @@ -182,6 +181,9 @@ static int cdns3_core_init_role(struct cdns3 *cdns) · 9 unmodified lines | |||
| 182 | if (ret) | 181 | if (ret) |
| 183 | goto err; | 182 | goto err; |
| 184 | break; | 183 | break; |
| 184 | default: | ||
| 185 | ret = -EINVAL; | ||
| 186 | goto err; | ||
| 185 | } | 187 | } |
| 186 | 188 | ||
| 187 | return ret; | 189 | return ret; |
| @@ -1145,6 +1145,14 @@ static void cdns3_transfer_completed(struct cdns3_device *priv_dev, · 1144 unmodified lines | |||
| 1145 | request = cdns3_next_request(&priv_ep->pending_req_list); | 1145 | request = cdns3_next_request(&priv_ep->pending_req_list); |
| 1146 | priv_req = to_cdns3_request(request); | 1146 | priv_req = to_cdns3_request(request); |
| 1147 | 1147 | ||
| 1148 | trb = priv_ep->trb_pool + priv_ep->dequeue; | ||
| 1149 | |||
| 1150 | /* Request was dequeued and TRB was changed to TRB_LINK. */ | ||
| 1151 | if (TRB_FIELD_TO_TYPE(trb->control) == TRB_LINK) { | ||
| 1152 | trace_cdns3_complete_trb(priv_ep, trb); | ||
| 1153 | cdns3_move_deq_to_next_trb(priv_req); | ||
| 1154 | } | ||
| 1155 | |||
| 1148 | /* Re-select endpoint. It could be changed by other CPU during | 1156 | /* Re-select endpoint. It could be changed by other CPU during |
| 1149 | * handling usb_gadget_giveback_request. | 1157 | * handling usb_gadget_giveback_request. |
| 1150 | */ | 1158 | */ |
| @@ -2067,6 +2075,7 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, · 916 unmodified lines | |||
| 2067 | struct usb_request *req, *req_temp; | 2075 | struct usb_request *req, *req_temp; |
| 2068 | struct cdns3_request *priv_req; | 2076 | struct cdns3_request *priv_req; |
| 2069 | struct cdns3_trb *link_trb; | 2077 | struct cdns3_trb *link_trb; |
| 2078 | u8 req_on_hw_ring = 0; | ||
| 2070 | unsigned long flags; | 2079 | unsigned long flags; |
| 2071 | int ret = 0; | 2080 | int ret = 0; |
| 2072 | 2081 | ||
| @@ -2083,8 +2092,10 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, · 10 unmodified lines | |||
| 2083 | 2092 | ||
| 2084 | list_for_each_entry_safe(req, req_temp, &priv_ep->pending_req_list, | 2093 | list_for_each_entry_safe(req, req_temp, &priv_ep->pending_req_list, |
| 2085 | list) { | 2094 | list) { |
| 2086 | if (request == req) | 2095 | if (request == req) { |
| 2096 | req_on_hw_ring = 1; | ||
| 2087 | goto found; | 2097 | goto found; |
| 2098 | } | ||
| 2088 | } | 2099 | } |
| 2089 | 2100 | ||
| 2090 | list_for_each_entry_safe(req, req_temp, &priv_ep->deferred_req_list, | 2101 | list_for_each_entry_safe(req, req_temp, &priv_ep->deferred_req_list, |
| @@ -2096,27 +2107,21 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, · 5 unmodified lines | |||
| 2096 | goto not_found; | 2107 | goto not_found; |
| 2097 | 2108 | ||
| 2098 | found: | 2109 | found: |
| 2099 | |||
| 2100 | if (priv_ep->wa1_trb == priv_req->trb) | ||
| 2101 | cdns3_wa1_restore_cycle_bit(priv_ep); | ||
| 2102 | |||
| 2103 | link_trb = priv_req->trb; | 2110 | link_trb = priv_req->trb; |
| 2104 | cdns3_move_deq_to_next_trb(priv_req); | ||
| 2105 | cdns3_gadget_giveback(priv_ep, priv_req, -ECONNRESET); | ||
| 2106 | |||
| 2107 | /* Update ring */ | ||
| 2108 | request = cdns3_next_request(&priv_ep->deferred_req_list); | ||
| 2109 | if (request) { | ||
| 2110 | priv_req = to_cdns3_request(request); | ||
| 2111 | 2111 | ||
| 2112 | /* Update ring only if removed request is on pending_req_list list */ | ||
| 2113 | if (req_on_hw_ring) { | ||
| 2112 | link_trb->buffer = TRB_BUFFER(priv_ep->trb_pool_dma + | 2114 | link_trb->buffer = TRB_BUFFER(priv_ep->trb_pool_dma + |
| 2113 | (priv_req->start_trb * TRB_SIZE)); | 2115 | (priv_req->start_trb * TRB_SIZE)); |
| 2114 | link_trb->control = (link_trb->control & TRB_CYCLE) | | 2116 | link_trb->control = (link_trb->control & TRB_CYCLE) | |
| 2115 | TRB_TYPE(TRB_LINK) | TRB_CHAIN | TRB_TOGGLE; | 2117 | TRB_TYPE(TRB_LINK) | TRB_CHAIN; |
| 2116 | } else { | 2118 | |
| 2117 | priv_ep->flags |= EP_UPDATE_EP_TRBADDR; | 2119 | if (priv_ep->wa1_trb == priv_req->trb) |
| 2120 | cdns3_wa1_restore_cycle_bit(priv_ep); | ||
| 2118 | } | 2121 | } |
| 2119 | 2122 | ||
| 2123 | cdns3_gadget_giveback(priv_ep, priv_req, -ECONNRESET); | ||
| 2124 | |||
| 2120 | not_found: | 2125 | not_found: |
| 2121 | spin_unlock_irqrestore(&priv_dev->lock, flags); | 2126 | spin_unlock_irqrestore(&priv_dev->lock, flags); |
| 2122 | return ret; | 2127 | return ret; |
| @@ -445,6 +445,7 @@ static void usblp_cleanup(struct usblp *usblp) · 444 unmodified lines | |||
| 445 | kfree(usblp->readbuf); | 445 | kfree(usblp->readbuf); |
| 446 | kfree(usblp->device_id_string); | 446 | kfree(usblp->device_id_string); |
| 447 | kfree(usblp->statusbuf); | 447 | kfree(usblp->statusbuf); |
| 448 | usb_put_intf(usblp->intf); | ||
| 448 | kfree(usblp); | 449 | kfree(usblp); |
| 449 | } | 450 | } |
| 450 | 451 | ||
| @@ -1113,7 +1114,7 @@ static int usblp_probe(struct usb_interface *intf, · 662 unmodified lines | |||
| 1113 | init_waitqueue_head(&usblp->wwait); | 1114 | init_waitqueue_head(&usblp->wwait); |
| 1114 | init_usb_anchor(&usblp->urbs); | 1115 | init_usb_anchor(&usblp->urbs); |
| 1115 | usblp->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; | 1116 | usblp->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; |
| 1116 | usblp->intf = intf; | 1117 | usblp->intf = usb_get_intf(intf); |
| 1117 | 1118 | ||
| 1118 | /* Malloc device ID string buffer to the largest expected length, | 1119 | /* Malloc device ID string buffer to the largest expected length, |
| 1119 | * since we can re-query it on an ioctl and a dynamic string | 1120 | * since we can re-query it on an ioctl and a dynamic string |
| @@ -1198,6 +1199,7 @@ abort: · 78 unmodified lines | |||
| 1198 | kfree(usblp->readbuf); | 1199 | kfree(usblp->readbuf); |
| 1199 | kfree(usblp->statusbuf); | 1200 | kfree(usblp->statusbuf); |
| 1200 | kfree(usblp->device_id_string); | 1201 | kfree(usblp->device_id_string); |
| 1202 | usb_put_intf(usblp->intf); | ||
| 1201 | kfree(usblp); | 1203 | kfree(usblp); |
| 1202 | abort_ret: | 1204 | abort_ret: |
| 1203 | return retval; | 1205 | return retval; |
| @@ -1177,11 +1177,11 @@ static void udc_pop_fifo(struct lpc32xx_udc *udc, u8 *data, u32 bytes) · 1176 unmodified lines | |||
| 1177 | tmp = readl(USBD_RXDATA(udc->udp_baseaddr)); | 1177 | tmp = readl(USBD_RXDATA(udc->udp_baseaddr)); |
| 1178 | 1178 | ||
| 1179 | bl = bytes - n; | 1179 | bl = bytes - n; |
| 1180 | if (bl > 3) | 1180 | if (bl > 4) |
| 1181 | bl = 3; | 1181 | bl = 4; |
| 1182 | 1182 | ||
| 1183 | for (i = 0; i < bl; i++) | 1183 | for (i = 0; i < bl; i++) |
| 1184 | data[n + i] = (u8) ((tmp >> (n * 8)) & 0xFF); | 1184 | data[n + i] = (u8) ((tmp >> (i * 8)) & 0xFF); |
| 1185 | } | 1185 | } |
| 1186 | break; | 1186 | break; |
| 1187 | 1187 | ||
| @@ -380,10 +380,7 @@ static int ld_usb_release(struct inode *inode, struct file *file) · 379 unmodified lines | |||
| 380 | goto exit; | 380 | goto exit; |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | if (mutex_lock_interruptible(&dev->mutex)) { | 383 | mutex_lock(&dev->mutex); |
| 384 | retval = -ERESTARTSYS; | ||
| 385 | goto exit; | ||
| 386 | } | ||
| 387 | 384 | ||
| 388 | if (dev->open_count != 1) { | 385 | if (dev->open_count != 1) { |
| 389 | retval = -ENODEV; | 386 | retval = -ENODEV; |
| @@ -467,7 +464,7 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, · 77 unmodified lines | |||
| 467 | 464 | ||
| 468 | /* wait for data */ | 465 | /* wait for data */ |
| 469 | spin_lock_irq(&dev->rbsl); | 466 | spin_lock_irq(&dev->rbsl); |
| 470 | if (dev->ring_head == dev->ring_tail) { | 467 | while (dev->ring_head == dev->ring_tail) { |
| 471 | dev->interrupt_in_done = 0; | 468 | dev->interrupt_in_done = 0; |
| 472 | spin_unlock_irq(&dev->rbsl); | 469 | spin_unlock_irq(&dev->rbsl); |
| 473 | if (file->f_flags & O_NONBLOCK) { | 470 | if (file->f_flags & O_NONBLOCK) { |
| @@ -477,12 +474,17 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, · 3 unmodified lines | |||
| 477 | retval = wait_event_interruptible(dev->read_wait, dev->interrupt_in_done); | 474 | retval = wait_event_interruptible(dev->read_wait, dev->interrupt_in_done); |
| 478 | if (retval < 0) | 475 | if (retval < 0) |
| 479 | goto unlock_exit; | 476 | goto unlock_exit; |
| 480 | } else { | 477 | |
| 481 | spin_unlock_irq(&dev->rbsl); | 478 | spin_lock_irq(&dev->rbsl); |
| 482 | } | 479 | } |
| 480 | spin_unlock_irq(&dev->rbsl); | ||
| 483 | 481 | ||
| 484 | /* actual_buffer contains actual_length + interrupt_in_buffer */ | 482 | /* actual_buffer contains actual_length + interrupt_in_buffer */ |
| 485 | actual_buffer = (size_t *)(dev->ring_buffer + dev->ring_tail * (sizeof(size_t)+dev->interrupt_in_endpoint_size)); | 483 | actual_buffer = (size_t *)(dev->ring_buffer + dev->ring_tail * (sizeof(size_t)+dev->interrupt_in_endpoint_size)); |
| 484 | if (*actual_buffer > dev->interrupt_in_endpoint_size) { | ||
| 485 | retval = -EIO; | ||
| 486 | goto unlock_exit; | ||
| 487 | } | ||
| 486 | bytes_to_read = min(count, *actual_buffer); | 488 | bytes_to_read = min(count, *actual_buffer); |
| 487 | if (bytes_to_read < *actual_buffer) | 489 | if (bytes_to_read < *actual_buffer) |
| 488 | dev_warn(&dev->intf->dev, "Read buffer overflow, %zd bytes dropped\n", | 490 | dev_warn(&dev->intf->dev, "Read buffer overflow, %zd bytes dropped\n", |
| @@ -693,10 +695,9 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id * · 204 unmodified lines | |||
| 693 | dev_warn(&intf->dev, "Interrupt out endpoint not found (using control endpoint instead)\n"); | 695 | dev_warn(&intf->dev, "Interrupt out endpoint not found (using control endpoint instead)\n"); |
| 694 | 696 | ||
| 695 | dev->interrupt_in_endpoint_size = usb_endpoint_maxp(dev->interrupt_in_endpoint); | 697 | dev->interrupt_in_endpoint_size = usb_endpoint_maxp(dev->interrupt_in_endpoint); |
| 696 | dev->ring_buffer = | 698 | dev->ring_buffer = kcalloc(ring_buffer_size, |
| 697 | kmalloc_array(ring_buffer_size, | 699 | sizeof(size_t) + dev->interrupt_in_endpoint_size, |
| 698 | sizeof(size_t) + dev->interrupt_in_endpoint_size, | 700 | GFP_KERNEL); |
| 699 | GFP_KERNEL); | ||
| 700 | if (!dev->ring_buffer) | 701 | if (!dev->ring_buffer) |
| 701 | goto error; | 702 | goto error; |
| 702 | dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); | 703 | dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); |
| @@ -419,10 +419,7 @@ static int tower_release (struct inode *inode, struct file *file) · 418 unmodified lines | |||
| 419 | goto exit; | 419 | goto exit; |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | if (mutex_lock_interruptible(&dev->lock)) { | 422 | mutex_lock(&dev->lock); |
| 423 | retval = -ERESTARTSYS; | ||
| 424 | goto exit; | ||
| 425 | } | ||
| 426 | 423 | ||
| 427 | if (dev->open_count != 1) { | 424 | if (dev->open_count != 1) { |
| 428 | dev_dbg(&dev->udev->dev, "%s: device not opened exactly once\n", | 425 | dev_dbg(&dev->udev->dev, "%s: device not opened exactly once\n", |
| @@ -881,7 +878,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device · 452 unmodified lines | |||
| 881 | get_version_reply, | 878 | get_version_reply, |
| 882 | sizeof(*get_version_reply), | 879 | sizeof(*get_version_reply), |
| 883 | 1000); | 880 | 1000); |
| 884 | if (result < sizeof(*get_version_reply)) { | 881 | if (result != sizeof(*get_version_reply)) { |
| 885 | if (result >= 0) | 882 | if (result >= 0) |
| 886 | result = -EIO; | 883 | result = -EIO; |
| 887 | dev_err(idev, "get version request failed: %d\n", result); | 884 | dev_err(idev, "get version request failed: %d\n", result); |
| @@ -776,7 +776,6 @@ static void ti_close(struct usb_serial_port *port) · 775 unmodified lines | |||
| 776 | struct ti_port *tport; | 776 | struct ti_port *tport; |
| 777 | int port_number; | 777 | int port_number; |
| 778 | int status; | 778 | int status; |
| 779 | int do_unlock; | ||
| 780 | unsigned long flags; | 779 | unsigned long flags; |
| 781 | 780 | ||
| 782 | tdev = usb_get_serial_data(port->serial); | 781 | tdev = usb_get_serial_data(port->serial); |
| @@ -800,16 +799,13 @@ static void ti_close(struct usb_serial_port *port) · 17 unmodified lines | |||
| 800 | "%s - cannot send close port command, %d\n" | 799 | "%s - cannot send close port command, %d\n" |
| 801 | , __func__, status); | 800 | , __func__, status); |
| 802 | 801 | ||
| 803 | /* if mutex_lock is interrupted, continue anyway */ | 802 | mutex_lock(&tdev->td_open_close_lock); |
| 804 | do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock); | 803 | --tdev->td_open_port_count; |
| 805 | --tport->tp_tdev->td_open_port_count; | 804 | if (tdev->td_open_port_count == 0) { |
| 806 | if (tport->tp_tdev->td_open_port_count <= 0) { | ||
| 807 | /* last port is closed, shut down interrupt urb */ | 805 | /* last port is closed, shut down interrupt urb */ |
| 808 | usb_kill_urb(port->serial->port[0]->interrupt_in_urb); | 806 | usb_kill_urb(port->serial->port[0]->interrupt_in_urb); |
| 809 | tport->tp_tdev->td_open_port_count = 0; | ||
| 810 | } | 807 | } |
| 811 | if (do_unlock) | 808 | mutex_unlock(&tdev->td_open_close_lock); |
| 812 | mutex_unlock(&tdev->td_open_close_lock); | ||
| 813 | } | 809 | } |
| 814 | 810 | ||
| 815 | 811 | ||
| @@ -1658,7 +1658,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, · 1657 unmodified lines | |||
| 1658 | struct bus_type *bus = NULL; | 1658 | struct bus_type *bus = NULL; |
| 1659 | int ret; | 1659 | int ret; |
| 1660 | bool resv_msi, msi_remap; | 1660 | bool resv_msi, msi_remap; |
| 1661 | phys_addr_t resv_msi_base; | 1661 | phys_addr_t resv_msi_base = 0; |
| 1662 | struct iommu_domain_geometry geo; | 1662 | struct iommu_domain_geometry geo; |
| 1663 | LIST_HEAD(iova_copy); | 1663 | LIST_HEAD(iova_copy); |
| 1664 | LIST_HEAD(group_resv_regions); | 1664 | LIST_HEAD(group_resv_regions); |
| @@ -161,6 +161,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) · 160 unmodified lines | |||
| 161 | 161 | ||
| 162 | vhost_test_stop(n, &private); | 162 | vhost_test_stop(n, &private); |
| 163 | vhost_test_flush(n); | 163 | vhost_test_flush(n); |
| 164 | vhost_dev_stop(&n->dev); | ||
| 164 | vhost_dev_cleanup(&n->dev); | 165 | vhost_dev_cleanup(&n->dev); |
| 165 | /* We do an extra flush before freeing memory, | 166 | /* We do an extra flush before freeing memory, |
| 166 | * since jobs can re-queue themselves. */ | 167 | * since jobs can re-queue themselves. */ |
| @@ -237,6 +238,7 @@ static long vhost_test_reset_owner(struct vhost_test *n) · 70 unmodified lines | |||
| 237 | } | 238 | } |
| 238 | vhost_test_stop(n, &priv); | 239 | vhost_test_stop(n, &priv); |
| 239 | vhost_test_flush(n); | 240 | vhost_test_flush(n); |
| 241 | vhost_dev_stop(&n->dev); | ||
| 240 | vhost_dev_reset_owner(&n->dev, umem); | 242 | vhost_dev_reset_owner(&n->dev, umem); |
| 241 | done: | 243 | done: |
| 242 | mutex_unlock(&n->dev.mutex); | 244 | mutex_unlock(&n->dev.mutex); |
| @@ -775,7 +775,7 @@ static int pvcalls_back_poll(struct xenbus_device *dev, · 774 unmodified lines | |||
| 775 | mappass->reqcopy = *req; | 775 | mappass->reqcopy = *req; |
| 776 | icsk = inet_csk(mappass->sock->sk); | 776 | icsk = inet_csk(mappass->sock->sk); |
| 777 | queue = &icsk->icsk_accept_queue; | 777 | queue = &icsk->icsk_accept_queue; |
| 778 | data = queue->rskq_accept_head != NULL; | 778 | data = READ_ONCE(queue->rskq_accept_head) != NULL; |
| 779 | if (data) { | 779 | if (data) { |
| 780 | mappass->reqcopy.cmd = 0; | 780 | mappass->reqcopy.cmd = 0; |
| 781 | ret = 0; | 781 | ret = 0; |
| @@ -1761,6 +1761,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) · 1760 unmodified lines | |||
| 1761 | btrfs_err(info, | 1761 | btrfs_err(info, |
| 1762 | "bg %llu is a mixed block group but filesystem hasn't enabled mixed block groups", | 1762 | "bg %llu is a mixed block group but filesystem hasn't enabled mixed block groups", |
| 1763 | cache->key.objectid); | 1763 | cache->key.objectid); |
| 1764 | btrfs_put_block_group(cache); | ||
| 1764 | ret = -EINVAL; | 1765 | ret = -EINVAL; |
| 1765 | goto error; | 1766 | goto error; |
| 1766 | } | 1767 | } |
| @@ -734,8 +734,6 @@ struct btrfs_fs_info { · 733 unmodified lines | |||
| 734 | struct btrfs_workqueue *fixup_workers; | 734 | struct btrfs_workqueue *fixup_workers; |
| 735 | struct btrfs_workqueue *delayed_workers; | 735 | struct btrfs_workqueue *delayed_workers; |
| 736 | 736 | ||
| 737 | /* the extent workers do delayed refs on the extent allocation tree */ | ||
| 738 | struct btrfs_workqueue *extent_workers; | ||
| 739 | struct task_struct *transaction_kthread; | 737 | struct task_struct *transaction_kthread; |
| 740 | struct task_struct *cleaner_kthread; | 738 | struct task_struct *cleaner_kthread; |
| 741 | u32 thread_pool_size; | 739 | u32 thread_pool_size; |
| @@ -2489,8 +2487,7 @@ int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, · 1747 unmodified lines | |||
| 2489 | int nitems, bool use_global_rsv); | 2487 | int nitems, bool use_global_rsv); |
| 2490 | void btrfs_subvolume_release_metadata(struct btrfs_fs_info *fs_info, | 2488 | void btrfs_subvolume_release_metadata(struct btrfs_fs_info *fs_info, |
| 2491 | struct btrfs_block_rsv *rsv); | 2489 | struct btrfs_block_rsv *rsv); |
| 2492 | void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes, | 2490 | void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes); |
| 2493 | bool qgroup_free); | ||
| 2494 | 2491 | ||
| 2495 | int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes); | 2492 | int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes); |
| 2496 | u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo); | 2493 | u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo); |
| @@ -381,7 +381,6 @@ int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes) · 380 unmodified lines | |||
| 381 | out_qgroup: | 381 | out_qgroup: |
| 382 | btrfs_qgroup_free_meta_prealloc(root, qgroup_reserve); | 382 | btrfs_qgroup_free_meta_prealloc(root, qgroup_reserve); |
| 383 | out_fail: | 383 | out_fail: |
| 384 | btrfs_inode_rsv_release(inode, true); | ||
| 385 | if (delalloc_lock) | 384 | if (delalloc_lock) |
| 386 | mutex_unlock(&inode->delalloc_mutex); | 385 | mutex_unlock(&inode->delalloc_mutex); |
| 387 | return ret; | 386 | return ret; |
| @@ -418,7 +417,6 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes, · 30 unmodified lines | |||
| 418 | * btrfs_delalloc_release_extents - release our outstanding_extents | 417 | * btrfs_delalloc_release_extents - release our outstanding_extents |
| 419 | * @inode: the inode to balance the reservation for. | 418 | * @inode: the inode to balance the reservation for. |
| 420 | * @num_bytes: the number of bytes we originally reserved with | 419 | * @num_bytes: the number of bytes we originally reserved with |
| 421 | * @qgroup_free: do we need to free qgroup meta reservation or convert them. | ||
| 422 | * | 420 | * |
| 423 | * When we reserve space we increase outstanding_extents for the extents we may | 421 | * When we reserve space we increase outstanding_extents for the extents we may |
| 424 | * add. Once we've set the range as delalloc or created our ordered extents we | 422 | * add. Once we've set the range as delalloc or created our ordered extents we |
| @@ -426,8 +424,7 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes, · 1 unmodified line | |||
| 426 | * temporarily tracked outstanding_extents. This _must_ be used in conjunction | 424 | * temporarily tracked outstanding_extents. This _must_ be used in conjunction |
| 427 | * with btrfs_delalloc_reserve_metadata. | 425 | * with btrfs_delalloc_reserve_metadata. |
| 428 | */ | 426 | */ |
| 429 | void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes, | 427 | void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes) |
| 430 | bool qgroup_free) | ||
| 431 | { | 428 | { |
| 432 | struct btrfs_fs_info *fs_info = inode->root->fs_info; | 429 | struct btrfs_fs_info *fs_info = inode->root->fs_info; |
| 433 | unsigned num_extents; | 430 | unsigned num_extents; |
| @@ -441,7 +438,7 @@ void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes, · 7 unmodified lines | |||
| 441 | if (btrfs_is_testing(fs_info)) | 438 | if (btrfs_is_testing(fs_info)) |
| 442 | return; | 439 | return; |
| 443 | 440 | ||
| 444 | btrfs_inode_rsv_release(inode, qgroup_free); | 441 | btrfs_inode_rsv_release(inode, true); |
| 445 | } | 442 | } |
| 446 | 443 | ||
| 447 | /** | 444 | /** |
| @@ -2008,7 +2008,6 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) · 2007 unmodified lines | |||
| 2008 | btrfs_destroy_workqueue(fs_info->readahead_workers); | 2008 | btrfs_destroy_workqueue(fs_info->readahead_workers); |
| 2009 | btrfs_destroy_workqueue(fs_info->flush_workers); | 2009 | btrfs_destroy_workqueue(fs_info->flush_workers); |
| 2010 | btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers); | 2010 | btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers); |
| 2011 | btrfs_destroy_workqueue(fs_info->extent_workers); | ||
| 2012 | /* | 2011 | /* |
| 2013 | * Now that all other work queues are destroyed, we can safely destroy | 2012 | * Now that all other work queues are destroyed, we can safely destroy |
| 2014 | * the queues used for metadata I/O, since tasks from those other work | 2013 | * the queues used for metadata I/O, since tasks from those other work |
| @@ -2214,10 +2213,6 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info, · 199 unmodified lines | |||
| 2214 | max_active, 2); | 2213 | max_active, 2); |
| 2215 | fs_info->qgroup_rescan_workers = | 2214 | fs_info->qgroup_rescan_workers = |
| 2216 | btrfs_alloc_workqueue(fs_info, "qgroup-rescan", flags, 1, 0); | 2215 | btrfs_alloc_workqueue(fs_info, "qgroup-rescan", flags, 1, 0); |
| 2217 | fs_info->extent_workers = | ||
| 2218 | btrfs_alloc_workqueue(fs_info, "extent-refs", flags, | ||
| 2219 | min_t(u64, fs_devices->num_devices, | ||
| 2220 | max_active), 8); | ||
| 2221 | 2216 | ||
| 2222 | if (!(fs_info->workers && fs_info->delalloc_workers && | 2217 | if (!(fs_info->workers && fs_info->delalloc_workers && |
| 2223 | fs_info->submit_workers && fs_info->flush_workers && | 2218 | fs_info->submit_workers && fs_info->flush_workers && |
| @@ -2228,7 +2223,6 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info, · 4 unmodified lines | |||
| 2228 | fs_info->endio_freespace_worker && fs_info->rmw_workers && | 2223 | fs_info->endio_freespace_worker && fs_info->rmw_workers && |
| 2229 | fs_info->caching_workers && fs_info->readahead_workers && | 2224 | fs_info->caching_workers && fs_info->readahead_workers && |
| 2230 | fs_info->fixup_workers && fs_info->delayed_workers && | 2225 | fs_info->fixup_workers && fs_info->delayed_workers && |
| 2231 | fs_info->extent_workers && | ||
| 2232 | fs_info->qgroup_rescan_workers)) { | 2226 | fs_info->qgroup_rescan_workers)) { |
| 2233 | return -ENOMEM; | 2227 | return -ENOMEM; |
| 2234 | } | 2228 | } |
| @@ -1692,7 +1692,7 @@ again: · 1691 unmodified lines | |||
| 1692 | force_page_uptodate); | 1692 | force_page_uptodate); |
| 1693 | if (ret) { | 1693 | if (ret) { |
| 1694 | btrfs_delalloc_release_extents(BTRFS_I(inode), | 1694 | btrfs_delalloc_release_extents(BTRFS_I(inode), |
| 1695 | reserve_bytes, true); | 1695 | reserve_bytes); |
| 1696 | break; | 1696 | break; |
| 1697 | } | 1697 | } |
| 1698 | 1698 | ||
| @@ -1704,7 +1704,7 @@ again: · 5 unmodified lines | |||
| 1704 | if (extents_locked == -EAGAIN) | 1704 | if (extents_locked == -EAGAIN) |
| 1705 | goto again; | 1705 | goto again; |
| 1706 | btrfs_delalloc_release_extents(BTRFS_I(inode), | 1706 | btrfs_delalloc_release_extents(BTRFS_I(inode), |
| 1707 | reserve_bytes, true); | 1707 | reserve_bytes); |
| 1708 | ret = extents_locked; | 1708 | ret = extents_locked; |
| 1709 | break; | 1709 | break; |
| 1710 | } | 1710 | } |
| @@ -1772,8 +1772,7 @@ again: · 61 unmodified lines | |||
| 1772 | else | 1772 | else |
| 1773 | free_extent_state(cached_state); | 1773 | free_extent_state(cached_state); |
| 1774 | 1774 | ||
| 1775 | btrfs_delalloc_release_extents(BTRFS_I(inode), reserve_bytes, | 1775 | btrfs_delalloc_release_extents(BTRFS_I(inode), reserve_bytes); |
| 1776 | true); | ||
| 1777 | if (ret) { | 1776 | if (ret) { |
| 1778 | btrfs_drop_pages(pages, num_pages); | 1777 | btrfs_drop_pages(pages, num_pages); |
| 1779 | break; | 1778 | break; |
| @@ -2068,25 +2067,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 288 unmodified lines | |||
| 2068 | struct btrfs_trans_handle *trans; | 2067 | struct btrfs_trans_handle *trans; |
| 2069 | struct btrfs_log_ctx ctx; | 2068 | struct btrfs_log_ctx ctx; |
| 2070 | int ret = 0, err; | 2069 | int ret = 0, err; |
| 2071 | u64 len; | ||
| 2072 | 2070 | ||
| 2073 | /* | ||
| 2074 | * If the inode needs a full sync, make sure we use a full range to | ||
| 2075 | * avoid log tree corruption, due to hole detection racing with ordered | ||
| 2076 | * extent completion for adjacent ranges, and assertion failures during | ||
| 2077 | * hole detection. | ||
| 2078 | */ | ||
| 2079 | if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, | ||
| 2080 | &BTRFS_I(inode)->runtime_flags)) { | ||
| 2081 | start = 0; | ||
| 2082 | end = LLONG_MAX; | ||
| 2083 | } | ||
| 2084 | |||
| 2085 | /* | ||
| 2086 | * The range length can be represented by u64, we have to do the typecasts | ||
| 2087 | * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync() | ||
| 2088 | */ | ||
| 2089 | len = (u64)end - (u64)start + 1; | ||
| 2090 | trace_btrfs_sync_file(file, datasync); | 2071 | trace_btrfs_sync_file(file, datasync); |
| 2091 | 2072 | ||
| 2092 | btrfs_init_log_ctx(&ctx, inode); | 2073 | btrfs_init_log_ctx(&ctx, inode); |
| @@ -2112,6 +2093,19 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 19 unmodified lines | |||
| 2112 | 2093 | ||
| 2113 | atomic_inc(&root->log_batch); | 2094 | atomic_inc(&root->log_batch); |
| 2114 | 2095 | ||
| 2096 | /* | ||
| 2097 | * If the inode needs a full sync, make sure we use a full range to | ||
| 2098 | * avoid log tree corruption, due to hole detection racing with ordered | ||
| 2099 | * extent completion for adjacent ranges, and assertion failures during | ||
| 2100 | * hole detection. Do this while holding the inode lock, to avoid races | ||
| 2101 | * with other tasks. | ||
| 2102 | */ | ||
| 2103 | if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, | ||
| 2104 | &BTRFS_I(inode)->runtime_flags)) { | ||
| 2105 | start = 0; | ||
| 2106 | end = LLONG_MAX; | ||
| 2107 | } | ||
| 2108 | |||
| 2115 | /* | 2109 | /* |
| 2116 | * Before we acquired the inode's lock, someone may have dirtied more | 2110 | * Before we acquired the inode's lock, someone may have dirtied more |
| 2117 | * pages in the target range. We need to make sure that writeback for | 2111 | * pages in the target range. We need to make sure that writeback for |
| @@ -2139,8 +2133,11 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 21 unmodified lines | |||
| 2139 | /* | 2133 | /* |
| 2140 | * We have to do this here to avoid the priority inversion of waiting on | 2134 | * We have to do this here to avoid the priority inversion of waiting on |
| 2141 | * IO of a lower priority task while holding a transaction open. | 2135 | * IO of a lower priority task while holding a transaction open. |
| 2136 | * | ||
| 2137 | * Also, the range length can be represented by u64, we have to do the | ||
| 2138 | * typecasts to avoid signed overflow if it's [0, LLONG_MAX]. | ||
| 2142 | */ | 2139 | */ |
| 2143 | ret = btrfs_wait_ordered_range(inode, start, len); | 2140 | ret = btrfs_wait_ordered_range(inode, start, (u64)end - (u64)start + 1); |
| 2144 | if (ret) { | 2141 | if (ret) { |
| 2145 | up_write(&BTRFS_I(inode)->dio_sem); | 2142 | up_write(&BTRFS_I(inode)->dio_sem); |
| 2146 | inode_unlock(inode); | 2143 | inode_unlock(inode); |
| @@ -501,13 +501,13 @@ again: · 500 unmodified lines | |||
| 501 | ret = btrfs_prealloc_file_range_trans(inode, trans, 0, 0, prealloc, | 501 | ret = btrfs_prealloc_file_range_trans(inode, trans, 0, 0, prealloc, |
| 502 | prealloc, prealloc, &alloc_hint); | 502 | prealloc, prealloc, &alloc_hint); |
| 503 | if (ret) { | 503 | if (ret) { |
| 504 | btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc, true); | 504 | btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc); |
| 505 | btrfs_delalloc_release_metadata(BTRFS_I(inode), prealloc, true); | 505 | btrfs_delalloc_release_metadata(BTRFS_I(inode), prealloc, true); |
| 506 | goto out_put; | 506 | goto out_put; |
| 507 | } | 507 | } |
| 508 | 508 | ||
| 509 | ret = btrfs_write_out_ino_cache(root, trans, path, inode); | 509 | ret = btrfs_write_out_ino_cache(root, trans, path, inode); |
| 510 | btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc, false); | 510 | btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc); |
| 511 | out_put: | 511 | out_put: |
| 512 | iput(inode); | 512 | iput(inode); |
| 513 | out_release: | 513 | out_release: |
| @@ -2206,7 +2206,7 @@ again: · 2205 unmodified lines | |||
| 2206 | 2206 | ||
| 2207 | ClearPageChecked(page); | 2207 | ClearPageChecked(page); |
| 2208 | set_page_dirty(page); | 2208 | set_page_dirty(page); |
| 2209 | btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, false); | 2209 | btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE); |
| 2210 | out: | 2210 | out: |
| 2211 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start, page_end, | 2211 | unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start, page_end, |
| 2212 | &cached_state); | 2212 | &cached_state); |
| @@ -4951,7 +4951,7 @@ again: · 2738 unmodified lines | |||
| 4951 | if (!page) { | 4951 | if (!page) { |
| 4952 | btrfs_delalloc_release_space(inode, data_reserved, | 4952 | btrfs_delalloc_release_space(inode, data_reserved, |
| 4953 | block_start, blocksize, true); | 4953 | block_start, blocksize, true); |
| 4954 | btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize, true); | 4954 | btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize); |
| 4955 | ret = -ENOMEM; | 4955 | ret = -ENOMEM; |
| 4956 | goto out; | 4956 | goto out; |
| 4957 | } | 4957 | } |
| @@ -5018,7 +5018,7 @@ out_unlock: · 60 unmodified lines | |||
| 5018 | if (ret) | 5018 | if (ret) |
| 5019 | btrfs_delalloc_release_space(inode, data_reserved, block_start, | 5019 | btrfs_delalloc_release_space(inode, data_reserved, block_start, |
| 5020 | blocksize, true); | 5020 | blocksize, true); |
| 5021 | btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize, (ret != 0)); | 5021 | btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize); |
| 5022 | unlock_page(page); | 5022 | unlock_page(page); |
| 5023 | put_page(page); | 5023 | put_page(page); |
| 5024 | out: | 5024 | out: |
| @@ -8709,7 +8709,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) · 3684 unmodified lines | |||
| 8709 | } else if (ret >= 0 && (size_t)ret < count) | 8709 | } else if (ret >= 0 && (size_t)ret < count) |
| 8710 | btrfs_delalloc_release_space(inode, data_reserved, | 8710 | btrfs_delalloc_release_space(inode, data_reserved, |
| 8711 | offset, count - (size_t)ret, true); | 8711 | offset, count - (size_t)ret, true); |
| 8712 | btrfs_delalloc_release_extents(BTRFS_I(inode), count, false); | 8712 | btrfs_delalloc_release_extents(BTRFS_I(inode), count); |
| 8713 | } | 8713 | } |
| 8714 | out: | 8714 | out: |
| 8715 | if (wakeup) | 8715 | if (wakeup) |
| @@ -9059,7 +9059,7 @@ again: · 343 unmodified lines | |||
| 9059 | unlock_extent_cached(io_tree, page_start, page_end, &cached_state); | 9059 | unlock_extent_cached(io_tree, page_start, page_end, &cached_state); |
| 9060 | 9060 | ||
| 9061 | if (!ret2) { | 9061 | if (!ret2) { |
| 9062 | btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, true); | 9062 | btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE); |
| 9063 | sb_end_pagefault(inode->i_sb); | 9063 | sb_end_pagefault(inode->i_sb); |
| 9064 | extent_changeset_free(data_reserved); | 9064 | extent_changeset_free(data_reserved); |
| 9065 | return VM_FAULT_LOCKED; | 9065 | return VM_FAULT_LOCKED; |
| @@ -9068,7 +9068,7 @@ again: · 2 unmodified lines | |||
| 9068 | out_unlock: | 9068 | out_unlock: |
| 9069 | unlock_page(page); | 9069 | unlock_page(page); |
| 9070 | out: | 9070 | out: |
| 9071 | btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, (ret != 0)); | 9071 | btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE); |
| 9072 | btrfs_delalloc_release_space(inode, data_reserved, page_start, | 9072 | btrfs_delalloc_release_space(inode, data_reserved, page_start, |
| 9073 | reserved_space, (ret != 0)); | 9073 | reserved_space, (ret != 0)); |
| 9074 | out_noreserve: | 9074 | out_noreserve: |
| @@ -1360,8 +1360,7 @@ again: · 1359 unmodified lines | |||
| 1360 | unlock_page(pages[i]); | 1360 | unlock_page(pages[i]); |
| 1361 | put_page(pages[i]); | 1361 | put_page(pages[i]); |
| 1362 | } | 1362 | } |
| 1363 | btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT, | 1363 | btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT); |
| 1364 | false); | ||
| 1365 | extent_changeset_free(data_reserved); | 1364 | extent_changeset_free(data_reserved); |
| 1366 | return i_done; | 1365 | return i_done; |
| 1367 | out: | 1366 | out: |
| @@ -1372,8 +1371,7 @@ out: · 4 unmodified lines | |||
| 1372 | btrfs_delalloc_release_space(inode, data_reserved, | 1371 | btrfs_delalloc_release_space(inode, data_reserved, |
| 1373 | start_index << PAGE_SHIFT, | 1372 | start_index << PAGE_SHIFT, |
| 1374 | page_cnt << PAGE_SHIFT, true); | 1373 | page_cnt << PAGE_SHIFT, true); |
| 1375 | btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT, | 1374 | btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT); |
| 1376 | true); | ||
| 1377 | extent_changeset_free(data_reserved); | 1375 | extent_changeset_free(data_reserved); |
| 1378 | return ret; | 1376 | return ret; |
| 1379 | 1377 | ||
| @@ -3629,7 +3629,7 @@ int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, · 3628 unmodified lines | |||
| 3629 | return 0; | 3629 | return 0; |
| 3630 | 3630 | ||
| 3631 | BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); | 3631 | BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); |
| 3632 | trace_qgroup_meta_reserve(root, type, (s64)num_bytes); | 3632 | trace_qgroup_meta_reserve(root, (s64)num_bytes, type); |
| 3633 | ret = qgroup_reserve(root, num_bytes, enforce, type); | 3633 | ret = qgroup_reserve(root, num_bytes, enforce, type); |
| 3634 | if (ret < 0) | 3634 | if (ret < 0) |
| 3635 | return ret; | 3635 | return ret; |
| @@ -3676,7 +3676,7 @@ void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes, · 40 unmodified lines | |||
| 3676 | */ | 3676 | */ |
| 3677 | num_bytes = sub_root_meta_rsv(root, num_bytes, type); | 3677 | num_bytes = sub_root_meta_rsv(root, num_bytes, type); |
| 3678 | BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); | 3678 | BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize)); |
| 3679 | trace_qgroup_meta_reserve(root, type, -(s64)num_bytes); | 3679 | trace_qgroup_meta_reserve(root, -(s64)num_bytes, type); |
| 3680 | btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid, | 3680 | btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid, |
| 3681 | num_bytes, type); | 3681 | num_bytes, type); |
| 3682 | } | 3682 | } |
| @@ -3277,6 +3277,8 @@ static int relocate_file_extent_cluster(struct inode *inode, · 3276 unmodified lines | |||
| 3277 | if (!page) { | 3277 | if (!page) { |
| 3278 | btrfs_delalloc_release_metadata(BTRFS_I(inode), | 3278 | btrfs_delalloc_release_metadata(BTRFS_I(inode), |
| 3279 | PAGE_SIZE, true); | 3279 | PAGE_SIZE, true); |
| 3280 | btrfs_delalloc_release_extents(BTRFS_I(inode), | ||
| 3281 | PAGE_SIZE); | ||
| 3280 | ret = -ENOMEM; | 3282 | ret = -ENOMEM; |
| 3281 | goto out; | 3283 | goto out; |
| 3282 | } | 3284 | } |
| @@ -3297,7 +3299,7 @@ static int relocate_file_extent_cluster(struct inode *inode, · 14 unmodified lines | |||
| 3297 | btrfs_delalloc_release_metadata(BTRFS_I(inode), | 3299 | btrfs_delalloc_release_metadata(BTRFS_I(inode), |
| 3298 | PAGE_SIZE, true); | 3300 | PAGE_SIZE, true); |
| 3299 | btrfs_delalloc_release_extents(BTRFS_I(inode), | 3301 | btrfs_delalloc_release_extents(BTRFS_I(inode), |
| 3300 | PAGE_SIZE, true); | 3302 | PAGE_SIZE); |
| 3301 | ret = -EIO; | 3303 | ret = -EIO; |
| 3302 | goto out; | 3304 | goto out; |
| 3303 | } | 3305 | } |
| @@ -3326,7 +3328,7 @@ static int relocate_file_extent_cluster(struct inode *inode, · 22 unmodified lines | |||
| 3326 | btrfs_delalloc_release_metadata(BTRFS_I(inode), | 3328 | btrfs_delalloc_release_metadata(BTRFS_I(inode), |
| 3327 | PAGE_SIZE, true); | 3329 | PAGE_SIZE, true); |
| 3328 | btrfs_delalloc_release_extents(BTRFS_I(inode), | 3330 | btrfs_delalloc_release_extents(BTRFS_I(inode), |
| 3329 | PAGE_SIZE, true); | 3331 | PAGE_SIZE); |
| 3330 | 3332 | ||
| 3331 | clear_extent_bits(&BTRFS_I(inode)->io_tree, | 3333 | clear_extent_bits(&BTRFS_I(inode)->io_tree, |
| 3332 | page_start, page_end, | 3334 | page_start, page_end, |
| @@ -3342,8 +3344,7 @@ static int relocate_file_extent_cluster(struct inode *inode, · 9 unmodified lines | |||
| 3342 | put_page(page); | 3344 | put_page(page); |
| 3343 | 3345 | ||
| 3344 | index++; | 3346 | index++; |
| 3345 | btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, | 3347 | btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE); |
| 3346 | false); | ||
| 3347 | balance_dirty_pages_ratelimited(inode->i_mapping); | 3348 | balance_dirty_pages_ratelimited(inode->i_mapping); |
| 3348 | btrfs_throttle(fs_info); | 3349 | btrfs_throttle(fs_info); |
| 3349 | } | 3350 | } |
| @@ -384,8 +384,8 @@ static int parse_reply_info_readdir(void **p, void *end, · 383 unmodified lines | |||
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | done: | 386 | done: |
| 387 | if (*p != end) | 387 | /* Skip over any unrecognized fields */ |
| 388 | goto bad; | 388 | *p = end; |
| 389 | return 0; | 389 | return 0; |
| 390 | 390 | ||
| 391 | bad: | 391 | bad: |
| @@ -406,12 +406,10 @@ static int parse_reply_info_filelock(void **p, void *end, · 14 unmodified lines | |||
| 406 | goto bad; | 406 | goto bad; |
| 407 | 407 | ||
| 408 | info->filelock_reply = *p; | 408 | info->filelock_reply = *p; |
| 409 | *p += sizeof(*info->filelock_reply); | ||
| 410 | 409 | ||
| 411 | if (unlikely(*p != end)) | 410 | /* Skip over any unrecognized fields */ |
| 412 | goto bad; | 411 | *p = end; |
| 413 | return 0; | 412 | return 0; |
| 414 | |||
| 415 | bad: | 413 | bad: |
| 416 | return -EIO; | 414 | return -EIO; |
| 417 | } | 415 | } |
| @@ -425,18 +423,21 @@ static int parse_reply_info_create(void **p, void *end, · 7 unmodified lines | |||
| 425 | { | 423 | { |
| 426 | if (features == (u64)-1 || | 424 | if (features == (u64)-1 || |
| 427 | (features & CEPH_FEATURE_REPLY_CREATE_INODE)) { | 425 | (features & CEPH_FEATURE_REPLY_CREATE_INODE)) { |
| 426 | /* Malformed reply? */ | ||
| 428 | if (*p == end) { | 427 | if (*p == end) { |
| 429 | info->has_create_ino = false; | 428 | info->has_create_ino = false; |
| 430 | } else { | 429 | } else { |
| 431 | info->has_create_ino = true; | 430 | info->has_create_ino = true; |
| 432 | info->ino = ceph_decode_64(p); | 431 | ceph_decode_64_safe(p, end, info->ino, bad); |
| 433 | } | 432 | } |
| 433 | } else { | ||
| 434 | if (*p != end) | ||
| 435 | goto bad; | ||
| 434 | } | 436 | } |
| 435 | 437 | ||
| 436 | if (unlikely(*p != end)) | 438 | /* Skip over any unrecognized fields */ |
| 437 | goto bad; | 439 | *p = end; |
| 438 | return 0; | 440 | return 0; |
| 439 | |||
| 440 | bad: | 441 | bad: |
| 441 | return -EIO; | 442 | return -EIO; |
| 442 | } | 443 | } |
| @@ -169,7 +169,13 @@ cifs_read_super(struct super_block *sb) · 168 unmodified lines | |||
| 169 | else | 169 | else |
| 170 | sb->s_maxbytes = MAX_NON_LFS; | 170 | sb->s_maxbytes = MAX_NON_LFS; |
| 171 | 171 | ||
| 172 | /* Some very old servers like DOS and OS/2 used 2 second granularity */ | 172 | /* |
| 173 | * Some very old servers like DOS and OS/2 used 2 second granularity | ||
| 174 | * (while all current servers use 100ns granularity - see MS-DTYP) | ||
| 175 | * but 1 second is the maximum allowed granularity for the VFS | ||
| 176 | * so for old servers set time granularity to 1 second while for | ||
| 177 | * everything else (current servers) set it to 100ns. | ||
| 178 | */ | ||
| 173 | if ((tcon->ses->server->vals->protocol_id == SMB10_PROT_ID) && | 179 | if ((tcon->ses->server->vals->protocol_id == SMB10_PROT_ID) && |
| 174 | ((tcon->ses->capabilities & | 180 | ((tcon->ses->capabilities & |
| 175 | tcon->ses->server->vals->cap_nt_find) == 0) && | 181 | tcon->ses->server->vals->cap_nt_find) == 0) && |
| @@ -1391,6 +1391,11 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file); · 1390 unmodified lines | |||
| 1391 | struct cifsInodeInfo { | 1391 | struct cifsInodeInfo { |
| 1392 | bool can_cache_brlcks; | 1392 | bool can_cache_brlcks; |
| 1393 | struct list_head llist; /* locks helb by this inode */ | 1393 | struct list_head llist; /* locks helb by this inode */ |
| 1394 | /* | ||
| 1395 | * NOTE: Some code paths call down_read(lock_sem) twice, so | ||
| 1396 | * we must always use use cifs_down_write() instead of down_write() | ||
| 1397 | * for this semaphore to avoid deadlocks. | ||
| 1398 | */ | ||
| 1394 | struct rw_semaphore lock_sem; /* protect the fields above */ | 1399 | struct rw_semaphore lock_sem; /* protect the fields above */ |
| 1395 | /* BB add in lists for dirty pages i.e. write caching info for oplock */ | 1400 | /* BB add in lists for dirty pages i.e. write caching info for oplock */ |
| 1396 | struct list_head openFileList; | 1401 | struct list_head openFileList; |
| @@ -170,6 +170,7 @@ extern int cifs_unlock_range(struct cifsFileInfo *cfile, · 169 unmodified lines | |||
| 170 | struct file_lock *flock, const unsigned int xid); | 170 | struct file_lock *flock, const unsigned int xid); |
| 171 | extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile); | 171 | extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile); |
| 172 | 172 | ||
| 173 | extern void cifs_down_write(struct rw_semaphore *sem); | ||
| 173 | extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid, | 174 | extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid, |
| 174 | struct file *file, | 175 | struct file *file, |
| 175 | struct tcon_link *tlink, | 176 | struct tcon_link *tlink, |
| @@ -564,9 +564,11 @@ cifs_reconnect(struct TCP_Server_Info *server) · 563 unmodified lines | |||
| 564 | spin_lock(&GlobalMid_Lock); | 564 | spin_lock(&GlobalMid_Lock); |
| 565 | list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { | 565 | list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { |
| 566 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); | 566 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); |
| 567 | kref_get(&mid_entry->refcount); | ||
| 567 | if (mid_entry->mid_state == MID_REQUEST_SUBMITTED) | 568 | if (mid_entry->mid_state == MID_REQUEST_SUBMITTED) |
| 568 | mid_entry->mid_state = MID_RETRY_NEEDED; | 569 | mid_entry->mid_state = MID_RETRY_NEEDED; |
| 569 | list_move(&mid_entry->qhead, &retry_list); | 570 | list_move(&mid_entry->qhead, &retry_list); |
| 571 | mid_entry->mid_flags |= MID_DELETED; | ||
| 570 | } | 572 | } |
| 571 | spin_unlock(&GlobalMid_Lock); | 573 | spin_unlock(&GlobalMid_Lock); |
| 572 | mutex_unlock(&server->srv_mutex); | 574 | mutex_unlock(&server->srv_mutex); |
| @@ -576,6 +578,7 @@ cifs_reconnect(struct TCP_Server_Info *server) · 3 unmodified lines | |||
| 576 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); | 578 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); |
| 577 | list_del_init(&mid_entry->qhead); | 579 | list_del_init(&mid_entry->qhead); |
| 578 | mid_entry->callback(mid_entry); | 580 | mid_entry->callback(mid_entry); |
| 581 | cifs_mid_q_entry_release(mid_entry); | ||
| 579 | } | 582 | } |
| 580 | 583 | ||
| 581 | if (cifs_rdma_enabled(server)) { | 584 | if (cifs_rdma_enabled(server)) { |
| @@ -895,8 +898,10 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed) · 313 unmodified lines | |||
| 895 | if (mid->mid_flags & MID_DELETED) | 898 | if (mid->mid_flags & MID_DELETED) |
| 896 | printk_once(KERN_WARNING | 899 | printk_once(KERN_WARNING |
| 897 | "trying to dequeue a deleted mid\n"); | 900 | "trying to dequeue a deleted mid\n"); |
| 898 | else | 901 | else { |
| 899 | list_del_init(&mid->qhead); | 902 | list_del_init(&mid->qhead); |
| 903 | mid->mid_flags |= MID_DELETED; | ||
| 904 | } | ||
| 900 | spin_unlock(&GlobalMid_Lock); | 905 | spin_unlock(&GlobalMid_Lock); |
| 901 | } | 906 | } |
| 902 | 907 | ||
| @@ -966,8 +971,10 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) · 63 unmodified lines | |||
| 966 | list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { | 971 | list_for_each_safe(tmp, tmp2, &server->pending_mid_q) { |
| 967 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); | 972 | mid_entry = list_entry(tmp, struct mid_q_entry, qhead); |
| 968 | cifs_dbg(FYI, "Clearing mid 0x%llx\n", mid_entry->mid); | 973 | cifs_dbg(FYI, "Clearing mid 0x%llx\n", mid_entry->mid); |
| 974 | kref_get(&mid_entry->refcount); | ||
| 969 | mid_entry->mid_state = MID_SHUTDOWN; | 975 | mid_entry->mid_state = MID_SHUTDOWN; |
| 970 | list_move(&mid_entry->qhead, &dispose_list); | 976 | list_move(&mid_entry->qhead, &dispose_list); |
| 977 | mid_entry->mid_flags |= MID_DELETED; | ||
| 971 | } | 978 | } |
| 972 | spin_unlock(&GlobalMid_Lock); | 979 | spin_unlock(&GlobalMid_Lock); |
| 973 | 980 | ||
| @@ -977,6 +984,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) · 3 unmodified lines | |||
| 977 | cifs_dbg(FYI, "Callback mid 0x%llx\n", mid_entry->mid); | 984 | cifs_dbg(FYI, "Callback mid 0x%llx\n", mid_entry->mid); |
| 978 | list_del_init(&mid_entry->qhead); | 985 | list_del_init(&mid_entry->qhead); |
| 979 | mid_entry->callback(mid_entry); | 986 | mid_entry->callback(mid_entry); |
| 987 | cifs_mid_q_entry_release(mid_entry); | ||
| 980 | } | 988 | } |
| 981 | /* 1/8th of sec is more than enough time for them to exit */ | 989 | /* 1/8th of sec is more than enough time for them to exit */ |
| 982 | msleep(125); | 990 | msleep(125); |
| @@ -3882,8 +3890,12 @@ generic_ip_connect(struct TCP_Server_Info *server) · 2899 unmodified lines | |||
| 3882 | 3890 | ||
| 3883 | rc = socket->ops->connect(socket, saddr, slen, | 3891 | rc = socket->ops->connect(socket, saddr, slen, |
| 3884 | server->noblockcnt ? O_NONBLOCK : 0); | 3892 | server->noblockcnt ? O_NONBLOCK : 0); |
| 3885 | 3893 | /* | |
| 3886 | if (rc == -EINPROGRESS) | 3894 | * When mounting SMB root file systems, we do not want to block in |
| 3895 | * connect. Otherwise bail out and then let cifs_reconnect() perform | ||
| 3896 | * reconnect failover - if possible. | ||
| 3897 | */ | ||
| 3898 | if (server->noblockcnt && rc == -EINPROGRESS) | ||
| 3887 | rc = 0; | 3899 | rc = 0; |
| 3888 | if (rc < 0) { | 3900 | if (rc < 0) { |
| 3889 | cifs_dbg(FYI, "Error %d connecting to server\n", rc); | 3901 | cifs_dbg(FYI, "Error %d connecting to server\n", rc); |
| @@ -281,6 +281,13 @@ cifs_has_mand_locks(struct cifsInodeInfo *cinode) · 280 unmodified lines | |||
| 281 | return has_locks; | 281 | return has_locks; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | void | ||
| 285 | cifs_down_write(struct rw_semaphore *sem) | ||
| 286 | { | ||
| 287 | while (!down_write_trylock(sem)) | ||
| 288 | msleep(10); | ||
| 289 | } | ||
| 290 | |||
| 284 | struct cifsFileInfo * | 291 | struct cifsFileInfo * |
| 285 | cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, | 292 | cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, |
| 286 | struct tcon_link *tlink, __u32 oplock) | 293 | struct tcon_link *tlink, __u32 oplock) |
| @@ -306,7 +313,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, · 19 unmodified lines | |||
| 306 | INIT_LIST_HEAD(&fdlocks->locks); | 313 | INIT_LIST_HEAD(&fdlocks->locks); |
| 307 | fdlocks->cfile = cfile; | 314 | fdlocks->cfile = cfile; |
| 308 | cfile->llist = fdlocks; | 315 | cfile->llist = fdlocks; |
| 309 | down_write(&cinode->lock_sem); | 316 | cifs_down_write(&cinode->lock_sem); |
| 310 | list_add(&fdlocks->llist, &cinode->llist); | 317 | list_add(&fdlocks->llist, &cinode->llist); |
| 311 | up_write(&cinode->lock_sem); | 318 | up_write(&cinode->lock_sem); |
| 312 | 319 | ||
| @@ -405,10 +412,11 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) · 92 unmodified lines | |||
| 405 | bool oplock_break_cancelled; | 412 | bool oplock_break_cancelled; |
| 406 | 413 | ||
| 407 | spin_lock(&tcon->open_file_lock); | 414 | spin_lock(&tcon->open_file_lock); |
| 408 | 415 | spin_lock(&cifsi->open_file_lock); | |
| 409 | spin_lock(&cifs_file->file_info_lock); | 416 | spin_lock(&cifs_file->file_info_lock); |
| 410 | if (--cifs_file->count > 0) { | 417 | if (--cifs_file->count > 0) { |
| 411 | spin_unlock(&cifs_file->file_info_lock); | 418 | spin_unlock(&cifs_file->file_info_lock); |
| 419 | spin_unlock(&cifsi->open_file_lock); | ||
| 412 | spin_unlock(&tcon->open_file_lock); | 420 | spin_unlock(&tcon->open_file_lock); |
| 413 | return; | 421 | return; |
| 414 | } | 422 | } |
| @@ -421,9 +429,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) · 6 unmodified lines | |||
| 421 | cifs_add_pending_open_locked(&fid, cifs_file->tlink, &open); | 429 | cifs_add_pending_open_locked(&fid, cifs_file->tlink, &open); |
| 422 | 430 | ||
| 423 | /* remove it from the lists */ | 431 | /* remove it from the lists */ |
| 424 | spin_lock(&cifsi->open_file_lock); | ||
| 425 | list_del(&cifs_file->flist); | 432 | list_del(&cifs_file->flist); |
| 426 | spin_unlock(&cifsi->open_file_lock); | ||
| 427 | list_del(&cifs_file->tlist); | 433 | list_del(&cifs_file->tlist); |
| 428 | atomic_dec(&tcon->num_local_opens); | 434 | atomic_dec(&tcon->num_local_opens); |
| 429 | 435 | ||
| @@ -440,6 +446,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) · 10 unmodified lines | |||
| 440 | cifs_set_oplock_level(cifsi, 0); | 446 | cifs_set_oplock_level(cifsi, 0); |
| 441 | } | 447 | } |
| 442 | 448 | ||
| 449 | spin_unlock(&cifsi->open_file_lock); | ||
| 443 | spin_unlock(&tcon->open_file_lock); | 450 | spin_unlock(&tcon->open_file_lock); |
| 444 | 451 | ||
| 445 | oplock_break_cancelled = wait_oplock_handler ? | 452 | oplock_break_cancelled = wait_oplock_handler ? |
| @@ -464,7 +471,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) · 18 unmodified lines | |||
| 464 | * Delete any outstanding lock records. We'll lose them when the file | 471 | * Delete any outstanding lock records. We'll lose them when the file |
| 465 | * is closed anyway. | 472 | * is closed anyway. |
| 466 | */ | 473 | */ |
| 467 | down_write(&cifsi->lock_sem); | 474 | cifs_down_write(&cifsi->lock_sem); |
| 468 | list_for_each_entry_safe(li, tmp, &cifs_file->llist->locks, llist) { | 475 | list_for_each_entry_safe(li, tmp, &cifs_file->llist->locks, llist) { |
| 469 | list_del(&li->llist); | 476 | list_del(&li->llist); |
| 470 | cifs_del_lock_waiters(li); | 477 | cifs_del_lock_waiters(li); |
| @@ -1027,7 +1034,7 @@ static void · 556 unmodified lines | |||
| 1027 | cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock) | 1034 | cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock) |
| 1028 | { | 1035 | { |
| 1029 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); | 1036 | struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); |
| 1030 | down_write(&cinode->lock_sem); | 1037 | cifs_down_write(&cinode->lock_sem); |
| 1031 | list_add_tail(&lock->llist, &cfile->llist->locks); | 1038 | list_add_tail(&lock->llist, &cfile->llist->locks); |
| 1032 | up_write(&cinode->lock_sem); | 1039 | up_write(&cinode->lock_sem); |
| 1033 | } | 1040 | } |
| @@ -1049,7 +1056,7 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock, · 15 unmodified lines | |||
| 1049 | 1056 | ||
| 1050 | try_again: | 1057 | try_again: |
| 1051 | exist = false; | 1058 | exist = false; |
| 1052 | down_write(&cinode->lock_sem); | 1059 | cifs_down_write(&cinode->lock_sem); |
| 1053 | 1060 | ||
| 1054 | exist = cifs_find_lock_conflict(cfile, lock->offset, lock->length, | 1061 | exist = cifs_find_lock_conflict(cfile, lock->offset, lock->length, |
| 1055 | lock->type, lock->flags, &conf_lock, | 1062 | lock->type, lock->flags, &conf_lock, |
| @@ -1072,7 +1079,7 @@ try_again: · 16 unmodified lines | |||
| 1072 | (lock->blist.next == &lock->blist)); | 1079 | (lock->blist.next == &lock->blist)); |
| 1073 | if (!rc) | 1080 | if (!rc) |
| 1074 | goto try_again; | 1081 | goto try_again; |
| 1075 | down_write(&cinode->lock_sem); | 1082 | cifs_down_write(&cinode->lock_sem); |
| 1076 | list_del_init(&lock->blist); | 1083 | list_del_init(&lock->blist); |
| 1077 | } | 1084 | } |
| 1078 | 1085 | ||
| @@ -1125,7 +1132,7 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock) · 46 unmodified lines | |||
| 1125 | return rc; | 1132 | return rc; |
| 1126 | 1133 | ||
| 1127 | try_again: | 1134 | try_again: |
| 1128 | down_write(&cinode->lock_sem); | 1135 | cifs_down_write(&cinode->lock_sem); |
| 1129 | if (!cinode->can_cache_brlcks) { | 1136 | if (!cinode->can_cache_brlcks) { |
| 1130 | up_write(&cinode->lock_sem); | 1137 | up_write(&cinode->lock_sem); |
| 1131 | return rc; | 1138 | return rc; |
| @@ -1331,7 +1338,7 @@ cifs_push_locks(struct cifsFileInfo *cfile) · 199 unmodified lines | |||
| 1331 | int rc = 0; | 1338 | int rc = 0; |
| 1332 | 1339 | ||
| 1333 | /* we are going to update can_cache_brlcks here - need a write access */ | 1340 | /* we are going to update can_cache_brlcks here - need a write access */ |
| 1334 | down_write(&cinode->lock_sem); | 1341 | cifs_down_write(&cinode->lock_sem); |
| 1335 | if (!cinode->can_cache_brlcks) { | 1342 | if (!cinode->can_cache_brlcks) { |
| 1336 | up_write(&cinode->lock_sem); | 1343 | up_write(&cinode->lock_sem); |
| 1337 | return rc; | 1344 | return rc; |
| @@ -1522,7 +1529,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, · 184 unmodified lines | |||
| 1522 | if (!buf) | 1529 | if (!buf) |
| 1523 | return -ENOMEM; | 1530 | return -ENOMEM; |
| 1524 | 1531 | ||
| 1525 | down_write(&cinode->lock_sem); | 1532 | cifs_down_write(&cinode->lock_sem); |
| 1526 | for (i = 0; i < 2; i++) { | 1533 | for (i = 0; i < 2; i++) { |
| 1527 | cur = buf; | 1534 | cur = buf; |
| 1528 | num = 0; | 1535 | num = 0; |
| @@ -2475,9 +2475,9 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) · 2474 unmodified lines | |||
| 2475 | rc = tcon->ses->server->ops->flush(xid, tcon, &wfile->fid); | 2475 | rc = tcon->ses->server->ops->flush(xid, tcon, &wfile->fid); |
| 2476 | cifsFileInfo_put(wfile); | 2476 | cifsFileInfo_put(wfile); |
| 2477 | if (rc) | 2477 | if (rc) |
| 2478 | return rc; | 2478 | goto cifs_setattr_exit; |
| 2479 | } else if (rc != -EBADF) | 2479 | } else if (rc != -EBADF) |
| 2480 | return rc; | 2480 | goto cifs_setattr_exit; |
| 2481 | else | 2481 | else |
| 2482 | rc = 0; | 2482 | rc = 0; |
| 2483 | } | 2483 | } |
| @@ -171,6 +171,9 @@ cifs_get_next_mid(struct TCP_Server_Info *server) · 170 unmodified lines | |||
| 171 | /* we do not want to loop forever */ | 171 | /* we do not want to loop forever */ |
| 172 | last_mid = cur_mid; | 172 | last_mid = cur_mid; |
| 173 | cur_mid++; | 173 | cur_mid++; |
| 174 | /* avoid 0xFFFF MID */ | ||
| 175 | if (cur_mid == 0xffff) | ||
| 176 | cur_mid++; | ||
| 174 | 177 | ||
| 175 | /* | 178 | /* |
| 176 | * This nested loop looks more expensive than it is. | 179 | * This nested loop looks more expensive than it is. |
| @@ -145,7 +145,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, · 144 unmodified lines | |||
| 145 | 145 | ||
| 146 | cur = buf; | 146 | cur = buf; |
| 147 | 147 | ||
| 148 | down_write(&cinode->lock_sem); | 148 | cifs_down_write(&cinode->lock_sem); |
| 149 | list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { | 149 | list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { |
| 150 | if (flock->fl_start > li->offset || | 150 | if (flock->fl_start > li->offset || |
| 151 | (flock->fl_start + length) < | 151 | (flock->fl_start + length) < |
| @@ -86,22 +86,8 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) · 85 unmodified lines | |||
| 86 | 86 | ||
| 87 | static void _cifs_mid_q_entry_release(struct kref *refcount) | 87 | static void _cifs_mid_q_entry_release(struct kref *refcount) |
| 88 | { | 88 | { |
| 89 | struct mid_q_entry *mid = container_of(refcount, struct mid_q_entry, | 89 | struct mid_q_entry *midEntry = |
| 90 | refcount); | 90 | container_of(refcount, struct mid_q_entry, refcount); |
| 91 | |||
| 92 | mempool_free(mid, cifs_mid_poolp); | ||
| 93 | } | ||
| 94 | |||
| 95 | void cifs_mid_q_entry_release(struct mid_q_entry *midEntry) | ||
| 96 | { | ||
| 97 | spin_lock(&GlobalMid_Lock); | ||
| 98 | kref_put(&midEntry->refcount, _cifs_mid_q_entry_release); | ||
| 99 | spin_unlock(&GlobalMid_Lock); | ||
| 100 | } | ||
| 101 | |||
| 102 | void | ||
| 103 | DeleteMidQEntry(struct mid_q_entry *midEntry) | ||
| 104 | { | ||
| 105 | #ifdef CONFIG_CIFS_STATS2 | 91 | #ifdef CONFIG_CIFS_STATS2 |
| 106 | __le16 command = midEntry->server->vals->lock_cmd; | 92 | __le16 command = midEntry->server->vals->lock_cmd; |
| 107 | __u16 smb_cmd = le16_to_cpu(midEntry->command); | 93 | __u16 smb_cmd = le16_to_cpu(midEntry->command); |
| @@ -166,6 +152,19 @@ DeleteMidQEntry(struct mid_q_entry *midEntry) · 58 unmodified lines | |||
| 166 | } | 152 | } |
| 167 | } | 153 | } |
| 168 | #endif | 154 | #endif |
| 155 | |||
| 156 | mempool_free(midEntry, cifs_mid_poolp); | ||
| 157 | } | ||
| 158 | |||
| 159 | void cifs_mid_q_entry_release(struct mid_q_entry *midEntry) | ||
| 160 | { | ||
| 161 | spin_lock(&GlobalMid_Lock); | ||
| 162 | kref_put(&midEntry->refcount, _cifs_mid_q_entry_release); | ||
| 163 | spin_unlock(&GlobalMid_Lock); | ||
| 164 | } | ||
| 165 | |||
| 166 | void DeleteMidQEntry(struct mid_q_entry *midEntry) | ||
| 167 | { | ||
| 169 | cifs_mid_q_entry_release(midEntry); | 168 | cifs_mid_q_entry_release(midEntry); |
| 170 | } | 169 | } |
| 171 | 170 | ||
| @@ -173,8 +172,10 @@ void · 1 unmodified line | |||
| 173 | cifs_delete_mid(struct mid_q_entry *mid) | 172 | cifs_delete_mid(struct mid_q_entry *mid) |
| 174 | { | 173 | { |
| 175 | spin_lock(&GlobalMid_Lock); | 174 | spin_lock(&GlobalMid_Lock); |
| 176 | list_del_init(&mid->qhead); | 175 | if (!(mid->mid_flags & MID_DELETED)) { |
| 177 | mid->mid_flags |= MID_DELETED; | 176 | list_del_init(&mid->qhead); |
| 177 | mid->mid_flags |= MID_DELETED; | ||
| 178 | } | ||
| 178 | spin_unlock(&GlobalMid_Lock); | 179 | spin_unlock(&GlobalMid_Lock); |
| 179 | 180 | ||
| 180 | DeleteMidQEntry(mid); | 181 | DeleteMidQEntry(mid); |
| @@ -872,7 +873,10 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) · 691 unmodified lines | |||
| 872 | rc = -EHOSTDOWN; | 873 | rc = -EHOSTDOWN; |
| 873 | break; | 874 | break; |
| 874 | default: | 875 | default: |
| 875 | list_del_init(&mid->qhead); | 876 | if (!(mid->mid_flags & MID_DELETED)) { |
| 877 | list_del_init(&mid->qhead); | ||
| 878 | mid->mid_flags |= MID_DELETED; | ||
| 879 | } | ||
| 876 | cifs_server_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n", | 880 | cifs_server_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n", |
| 877 | __func__, mid->mid, mid->mid_state); | 881 | __func__, mid->mid, mid->mid_state); |
| 878 | rc = -EIO; | 882 | rc = -EIO; |
| @@ -220,10 +220,11 @@ static void *get_unlocked_entry(struct xa_state *xas, unsigned int order) · 219 unmodified lines | |||
| 220 | 220 | ||
| 221 | for (;;) { | 221 | for (;;) { |
| 222 | entry = xas_find_conflict(xas); | 222 | entry = xas_find_conflict(xas); |
| 223 | if (!entry || WARN_ON_ONCE(!xa_is_value(entry))) | ||
| 224 | return entry; | ||
| 223 | if (dax_entry_order(entry) < order) | 225 | if (dax_entry_order(entry) < order) |
| 224 | return XA_RETRY_ENTRY; | 226 | return XA_RETRY_ENTRY; |
| 225 | if (!entry || WARN_ON_ONCE(!xa_is_value(entry)) || | 227 | if (!dax_is_locked(entry)) |
| 226 | !dax_is_locked(entry)) | ||
| 227 | return entry; | 228 | return entry; |
| 228 | 229 | ||
| 229 | wq = dax_entry_waitqueue(xas, entry, &ewait.key); | 230 | wq = dax_entry_waitqueue(xas, entry, &ewait.key); |
| @@ -241,9 +241,8 @@ void dio_warn_stale_pagecache(struct file *filp) · 240 unmodified lines | |||
| 241 | } | 241 | } |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | /** | 244 | /* |
| 245 | * dio_complete() - called when all DIO BIO I/O has been completed | 245 | * dio_complete() - called when all DIO BIO I/O has been completed |
| 246 | * @offset: the byte offset in the file of the completed operation | ||
| 247 | * | 246 | * |
| 248 | * This drops i_dio_count, lets interested parties know that a DIO operation | 247 | * This drops i_dio_count, lets interested parties know that a DIO operation |
| 249 | * has completed, and calculates the resulting return code for the operation. | 248 | * has completed, and calculates the resulting return code for the operation. |
| @@ -905,7 +905,7 @@ restart: · 904 unmodified lines | |||
| 905 | * cgroup_writeback_by_id - initiate cgroup writeback from bdi and memcg IDs | 905 | * cgroup_writeback_by_id - initiate cgroup writeback from bdi and memcg IDs |
| 906 | * @bdi_id: target bdi id | 906 | * @bdi_id: target bdi id |
| 907 | * @memcg_id: target memcg css id | 907 | * @memcg_id: target memcg css id |
| 908 | * @nr_pages: number of pages to write, 0 for best-effort dirty flushing | 908 | * @nr: number of pages to write, 0 for best-effort dirty flushing |
| 909 | * @reason: reason why some writeback work initiated | 909 | * @reason: reason why some writeback work initiated |
| 910 | * @done: target wb_completion | 910 | * @done: target wb_completion |
| 911 | * | 911 | * |
| @@ -1600,6 +1600,7 @@ static int gfs2_meta_get_tree(struct fs_context *fc) · 1599 unmodified lines | |||
| 1600 | } | 1600 | } |
| 1601 | 1601 | ||
| 1602 | static const struct fs_context_operations gfs2_meta_context_ops = { | 1602 | static const struct fs_context_operations gfs2_meta_context_ops = { |
| 1603 | .free = gfs2_fc_free, | ||
| 1603 | .get_tree = gfs2_meta_get_tree, | 1604 | .get_tree = gfs2_meta_get_tree, |
| 1604 | }; | 1605 | }; |
| 1605 | 1606 | ||
| @@ -197,6 +197,7 @@ struct io_ring_ctx { · 196 unmodified lines | |||
| 197 | unsigned sq_entries; | 197 | unsigned sq_entries; |
| 198 | unsigned sq_mask; | 198 | unsigned sq_mask; |
| 199 | unsigned sq_thread_idle; | 199 | unsigned sq_thread_idle; |
| 200 | unsigned cached_sq_dropped; | ||
| 200 | struct io_uring_sqe *sq_sqes; | 201 | struct io_uring_sqe *sq_sqes; |
| 201 | 202 | ||
| 202 | struct list_head defer_list; | 203 | struct list_head defer_list; |
| @@ -212,6 +213,7 @@ struct io_ring_ctx { · 9 unmodified lines | |||
| 212 | 213 | ||
| 213 | struct { | 214 | struct { |
| 214 | unsigned cached_cq_tail; | 215 | unsigned cached_cq_tail; |
| 216 | atomic_t cached_cq_overflow; | ||
| 215 | unsigned cq_entries; | 217 | unsigned cq_entries; |
| 216 | unsigned cq_mask; | 218 | unsigned cq_mask; |
| 217 | struct wait_queue_head cq_wait; | 219 | struct wait_queue_head cq_wait; |
| @@ -322,6 +324,8 @@ struct io_kiocb { · 104 unmodified lines | |||
| 322 | #define REQ_F_FAIL_LINK 256 /* fail rest of links */ | 324 | #define REQ_F_FAIL_LINK 256 /* fail rest of links */ |
| 323 | #define REQ_F_SHADOW_DRAIN 512 /* link-drain shadow req */ | 325 | #define REQ_F_SHADOW_DRAIN 512 /* link-drain shadow req */ |
| 324 | #define REQ_F_TIMEOUT 1024 /* timeout request */ | 326 | #define REQ_F_TIMEOUT 1024 /* timeout request */ |
| 327 | #define REQ_F_ISREG 2048 /* regular file */ | ||
| 328 | #define REQ_F_MUST_PUNT 4096 /* must be punted even for NONBLOCK */ | ||
| 325 | u64 user_data; | 329 | u64 user_data; |
| 326 | u32 result; | 330 | u32 result; |
| 327 | u32 sequence; | 331 | u32 sequence; |
| @@ -418,7 +422,8 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) · 90 unmodified lines | |||
| 418 | static inline bool __io_sequence_defer(struct io_ring_ctx *ctx, | 422 | static inline bool __io_sequence_defer(struct io_ring_ctx *ctx, |
| 419 | struct io_kiocb *req) | 423 | struct io_kiocb *req) |
| 420 | { | 424 | { |
| 421 | return req->sequence != ctx->cached_cq_tail + ctx->rings->sq_dropped; | 425 | return req->sequence != ctx->cached_cq_tail + ctx->cached_sq_dropped |
| 426 | + atomic_read(&ctx->cached_cq_overflow); | ||
| 422 | } | 427 | } |
| 423 | 428 | ||
| 424 | static inline bool io_sequence_defer(struct io_ring_ctx *ctx, | 429 | static inline bool io_sequence_defer(struct io_ring_ctx *ctx, |
| @@ -565,9 +570,8 @@ static void io_cqring_fill_event(struct io_ring_ctx *ctx, u64 ki_user_data, · 140 unmodified lines | |||
| 565 | WRITE_ONCE(cqe->res, res); | 570 | WRITE_ONCE(cqe->res, res); |
| 566 | WRITE_ONCE(cqe->flags, 0); | 571 | WRITE_ONCE(cqe->flags, 0); |
| 567 | } else { | 572 | } else { |
| 568 | unsigned overflow = READ_ONCE(ctx->rings->cq_overflow); | 573 | WRITE_ONCE(ctx->rings->cq_overflow, |
| 569 | 574 | atomic_inc_return(&ctx->cached_cq_overflow)); | |
| 570 | WRITE_ONCE(ctx->rings->cq_overflow, overflow + 1); | ||
| 571 | } | 575 | } |
| 572 | } | 576 | } |
| 573 | 577 | ||
| @@ -733,6 +737,14 @@ static unsigned io_cqring_events(struct io_rings *rings) · 159 unmodified lines | |||
| 733 | return READ_ONCE(rings->cq.tail) - READ_ONCE(rings->cq.head); | 737 | return READ_ONCE(rings->cq.tail) - READ_ONCE(rings->cq.head); |
| 734 | } | 738 | } |
| 735 | 739 | ||
| 740 | static inline unsigned int io_sqring_entries(struct io_ring_ctx *ctx) | ||
| 741 | { | ||
| 742 | struct io_rings *rings = ctx->rings; | ||
| 743 | |||
| 744 | /* make sure SQ entry isn't read before tail */ | ||
| 745 | return smp_load_acquire(&rings->sq.tail) - ctx->cached_sq_head; | ||
| 746 | } | ||
| 747 | |||
| 736 | /* | 748 | /* |
| 737 | * Find and free completed poll iocbs | 749 | * Find and free completed poll iocbs |
| 738 | */ | 750 | */ |
| @@ -862,19 +874,11 @@ static void io_iopoll_reap_events(struct io_ring_ctx *ctx) · 123 unmodified lines | |||
| 862 | mutex_unlock(&ctx->uring_lock); | 874 | mutex_unlock(&ctx->uring_lock); |
| 863 | } | 875 | } |
| 864 | 876 | ||
| 865 | static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events, | 877 | static int __io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events, |
| 866 | long min) | 878 | long min) |
| 867 | { | 879 | { |
| 868 | int iters, ret = 0; | 880 | int iters = 0, ret = 0; |
| 869 | 881 | ||
| 870 | /* | ||
| 871 | * We disallow the app entering submit/complete with polling, but we | ||
| 872 | * still need to lock the ring to prevent racing with polled issue | ||
| 873 | * that got punted to a workqueue. | ||
| 874 | */ | ||
| 875 | mutex_lock(&ctx->uring_lock); | ||
| 876 | |||
| 877 | iters = 0; | ||
| 878 | do { | 882 | do { |
| 879 | int tmin = 0; | 883 | int tmin = 0; |
| 880 | 884 | ||
| @@ -910,30 +914,45 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events, · 29 unmodified lines | |||
| 910 | ret = 0; | 914 | ret = 0; |
| 911 | } while (min && !*nr_events && !need_resched()); | 915 | } while (min && !*nr_events && !need_resched()); |
| 912 | 916 | ||
| 917 | return ret; | ||
| 918 | } | ||
| 919 | |||
| 920 | static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events, | ||
| 921 | long min) | ||
| 922 | { | ||
| 923 | int ret; | ||
| 924 | |||
| 925 | /* | ||
| 926 | * We disallow the app entering submit/complete with polling, but we | ||
| 927 | * still need to lock the ring to prevent racing with polled issue | ||
| 928 | * that got punted to a workqueue. | ||
| 929 | */ | ||
| 930 | mutex_lock(&ctx->uring_lock); | ||
| 931 | ret = __io_iopoll_check(ctx, nr_events, min); | ||
| 913 | mutex_unlock(&ctx->uring_lock); | 932 | mutex_unlock(&ctx->uring_lock); |
| 914 | return ret; | 933 | return ret; |
| 915 | } | 934 | } |
| 916 | 935 | ||
| 917 | static void kiocb_end_write(struct kiocb *kiocb) | 936 | static void kiocb_end_write(struct io_kiocb *req) |
| 918 | { | 937 | { |
| 919 | if (kiocb->ki_flags & IOCB_WRITE) { | 938 | /* |
| 920 | struct inode *inode = file_inode(kiocb->ki_filp); | 939 | * Tell lockdep we inherited freeze protection from submission |
| 940 | * thread. | ||
| 941 | */ | ||
| 942 | if (req->flags & REQ_F_ISREG) { | ||
| 943 | struct inode *inode = file_inode(req->file); | ||
| 921 | 944 | ||
| 922 | /* | 945 | __sb_writers_acquired(inode->i_sb, SB_FREEZE_WRITE); |
| 923 | * Tell lockdep we inherited freeze protection from submission | ||
| 924 | * thread. | ||
| 925 | */ | ||
| 926 | if (S_ISREG(inode->i_mode)) | ||
| 927 | __sb_writers_acquired(inode->i_sb, SB_FREEZE_WRITE); | ||
| 928 | file_end_write(kiocb->ki_filp); | ||
| 929 | } | 946 | } |
| 947 | file_end_write(req->file); | ||
| 930 | } | 948 | } |
| 931 | 949 | ||
| 932 | static void io_complete_rw(struct kiocb *kiocb, long res, long res2) | 950 | static void io_complete_rw(struct kiocb *kiocb, long res, long res2) |
| 933 | { | 951 | { |
| 934 | struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw); | 952 | struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw); |
| 935 | 953 | ||
| 936 | kiocb_end_write(kiocb); | 954 | if (kiocb->ki_flags & IOCB_WRITE) |
| 955 | kiocb_end_write(req); | ||
| 937 | 956 | ||
| 938 | if ((req->flags & REQ_F_LINK) && res != req->result) | 957 | if ((req->flags & REQ_F_LINK) && res != req->result) |
| 939 | req->flags |= REQ_F_FAIL_LINK; | 958 | req->flags |= REQ_F_FAIL_LINK; |
| @@ -945,7 +964,8 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2) · 5 unmodified lines | |||
| 945 | { | 964 | { |
| 946 | struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw); | 965 | struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw); |
| 947 | 966 | ||
| 948 | kiocb_end_write(kiocb); | 967 | if (kiocb->ki_flags & IOCB_WRITE) |
| 968 | kiocb_end_write(req); | ||
| 949 | 969 | ||
| 950 | if ((req->flags & REQ_F_LINK) && res != req->result) | 970 | if ((req->flags & REQ_F_LINK) && res != req->result) |
| 951 | req->flags |= REQ_F_FAIL_LINK; | 971 | req->flags |= REQ_F_FAIL_LINK; |
| @@ -1059,8 +1079,17 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s, · 107 unmodified lines | |||
| 1059 | if (!req->file) | 1079 | if (!req->file) |
| 1060 | return -EBADF; | 1080 | return -EBADF; |
| 1061 | 1081 | ||
| 1062 | if (force_nonblock && !io_file_supports_async(req->file)) | 1082 | if (S_ISREG(file_inode(req->file)->i_mode)) |
| 1063 | force_nonblock = false; | 1083 | req->flags |= REQ_F_ISREG; |
| 1084 | |||
| 1085 | /* | ||
| 1086 | * If the file doesn't support async, mark it as REQ_F_MUST_PUNT so | ||
| 1087 | * we know to async punt it even if it was opened O_NONBLOCK | ||
| 1088 | */ | ||
| 1089 | if (force_nonblock && !io_file_supports_async(req->file)) { | ||
| 1090 | req->flags |= REQ_F_MUST_PUNT; | ||
| 1091 | return -EAGAIN; | ||
| 1092 | } | ||
| 1064 | 1093 | ||
| 1065 | kiocb->ki_pos = READ_ONCE(sqe->off); | 1094 | kiocb->ki_pos = READ_ONCE(sqe->off); |
| 1066 | kiocb->ki_flags = iocb_flags(kiocb->ki_filp); | 1095 | kiocb->ki_flags = iocb_flags(kiocb->ki_filp); |
| @@ -1081,7 +1110,8 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s, · 14 unmodified lines | |||
| 1081 | return ret; | 1110 | return ret; |
| 1082 | 1111 | ||
| 1083 | /* don't allow async punt if RWF_NOWAIT was requested */ | 1112 | /* don't allow async punt if RWF_NOWAIT was requested */ |
| 1084 | if (kiocb->ki_flags & IOCB_NOWAIT) | 1113 | if ((kiocb->ki_flags & IOCB_NOWAIT) || |
| 1114 | (req->file->f_flags & O_NONBLOCK)) | ||
| 1085 | req->flags |= REQ_F_NOWAIT; | 1115 | req->flags |= REQ_F_NOWAIT; |
| 1086 | 1116 | ||
| 1087 | if (force_nonblock) | 1117 | if (force_nonblock) |
| @@ -1382,7 +1412,9 @@ static int io_read(struct io_kiocb *req, const struct sqe_submit *s, · 294 unmodified lines | |||
| 1382 | * need async punt anyway, so it's more efficient to do it | 1412 | * need async punt anyway, so it's more efficient to do it |
| 1383 | * here. | 1413 | * here. |
| 1384 | */ | 1414 | */ |
| 1385 | if (force_nonblock && ret2 > 0 && ret2 < read_size) | 1415 | if (force_nonblock && !(req->flags & REQ_F_NOWAIT) && |
| 1416 | (req->flags & REQ_F_ISREG) && | ||
| 1417 | ret2 > 0 && ret2 < read_size) | ||
| 1386 | ret2 = -EAGAIN; | 1418 | ret2 = -EAGAIN; |
| 1387 | /* Catch -EAGAIN return for forced non-blocking submission */ | 1419 | /* Catch -EAGAIN return for forced non-blocking submission */ |
| 1388 | if (!force_nonblock || ret2 != -EAGAIN) { | 1420 | if (!force_nonblock || ret2 != -EAGAIN) { |
| @@ -1447,7 +1479,7 @@ static int io_write(struct io_kiocb *req, const struct sqe_submit *s, · 58 unmodified lines | |||
| 1447 | * released so that it doesn't complain about the held lock when | 1479 | * released so that it doesn't complain about the held lock when |
| 1448 | * we return to userspace. | 1480 | * we return to userspace. |
| 1449 | */ | 1481 | */ |
| 1450 | if (S_ISREG(file_inode(file)->i_mode)) { | 1482 | if (req->flags & REQ_F_ISREG) { |
| 1451 | __sb_start_write(file_inode(file)->i_sb, | 1483 | __sb_start_write(file_inode(file)->i_sb, |
| 1452 | SB_FREEZE_WRITE, true); | 1484 | SB_FREEZE_WRITE, true); |
| 1453 | __sb_writers_release(file_inode(file)->i_sb, | 1485 | __sb_writers_release(file_inode(file)->i_sb, |
| @@ -1862,7 +1894,7 @@ static int io_poll_add(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 408 unmodified lines | |||
| 1862 | static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer) | 1894 | static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer) |
| 1863 | { | 1895 | { |
| 1864 | struct io_ring_ctx *ctx; | 1896 | struct io_ring_ctx *ctx; |
| 1865 | struct io_kiocb *req; | 1897 | struct io_kiocb *req, *prev; |
| 1866 | unsigned long flags; | 1898 | unsigned long flags; |
| 1867 | 1899 | ||
| 1868 | req = container_of(timer, struct io_kiocb, timeout.timer); | 1900 | req = container_of(timer, struct io_kiocb, timeout.timer); |
| @@ -1870,6 +1902,15 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer) · 1 unmodified line | |||
| 1870 | atomic_inc(&ctx->cq_timeouts); | 1902 | atomic_inc(&ctx->cq_timeouts); |
| 1871 | 1903 | ||
| 1872 | spin_lock_irqsave(&ctx->completion_lock, flags); | 1904 | spin_lock_irqsave(&ctx->completion_lock, flags); |
| 1905 | /* | ||
| 1906 | * Adjust the reqs sequence before the current one because it | ||
| 1907 | * will consume a slot in the cq_ring and the the cq_tail pointer | ||
| 1908 | * will be increased, otherwise other timeout reqs may return in | ||
| 1909 | * advance without waiting for enough wait_nr. | ||
| 1910 | */ | ||
| 1911 | prev = req; | ||
| 1912 | list_for_each_entry_continue_reverse(prev, &ctx->timeout_list, list) | ||
| 1913 | prev->sequence++; | ||
| 1873 | list_del(&req->list); | 1914 | list_del(&req->list); |
| 1874 | 1915 | ||
| 1875 | io_cqring_fill_event(ctx, req->user_data, -ETIME); | 1916 | io_cqring_fill_event(ctx, req->user_data, -ETIME); |
| @@ -1884,10 +1925,11 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer) · 8 unmodified lines | |||
| 1884 | 1925 | ||
| 1885 | static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) | 1926 | static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) |
| 1886 | { | 1927 | { |
| 1887 | unsigned count, req_dist, tail_index; | 1928 | unsigned count; |
| 1888 | struct io_ring_ctx *ctx = req->ctx; | 1929 | struct io_ring_ctx *ctx = req->ctx; |
| 1889 | struct list_head *entry; | 1930 | struct list_head *entry; |
| 1890 | struct timespec64 ts; | 1931 | struct timespec64 ts; |
| 1932 | unsigned span = 0; | ||
| 1891 | 1933 | ||
| 1892 | if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) | 1934 | if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) |
| 1893 | return -EINVAL; | 1935 | return -EINVAL; |
| @@ -1907,23 +1949,46 @@ static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 13 unmodified lines | |||
| 1907 | count = 1; | 1949 | count = 1; |
| 1908 | 1950 | ||
| 1909 | req->sequence = ctx->cached_sq_head + count - 1; | 1951 | req->sequence = ctx->cached_sq_head + count - 1; |
| 1952 | /* reuse it to store the count */ | ||
| 1953 | req->submit.sequence = count; | ||
| 1910 | req->flags |= REQ_F_TIMEOUT; | 1954 | req->flags |= REQ_F_TIMEOUT; |
| 1911 | 1955 | ||
| 1912 | /* | 1956 | /* |
| 1913 | * Insertion sort, ensuring the first entry in the list is always | 1957 | * Insertion sort, ensuring the first entry in the list is always |
| 1914 | * the one we need first. | 1958 | * the one we need first. |
| 1915 | */ | 1959 | */ |
| 1916 | tail_index = ctx->cached_cq_tail - ctx->rings->sq_dropped; | ||
| 1917 | req_dist = req->sequence - tail_index; | ||
| 1918 | spin_lock_irq(&ctx->completion_lock); | 1960 | spin_lock_irq(&ctx->completion_lock); |
| 1919 | list_for_each_prev(entry, &ctx->timeout_list) { | 1961 | list_for_each_prev(entry, &ctx->timeout_list) { |
| 1920 | struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list); | 1962 | struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list); |
| 1921 | unsigned dist; | 1963 | unsigned nxt_sq_head; |
| 1964 | long long tmp, tmp_nxt; | ||
| 1965 | |||
| 1966 | /* | ||
| 1967 | * Since cached_sq_head + count - 1 can overflow, use type long | ||
| 1968 | * long to store it. | ||
| 1969 | */ | ||
| 1970 | tmp = (long long)ctx->cached_sq_head + count - 1; | ||
| 1971 | nxt_sq_head = nxt->sequence - nxt->submit.sequence + 1; | ||
| 1972 | tmp_nxt = (long long)nxt_sq_head + nxt->submit.sequence - 1; | ||
| 1922 | 1973 | ||
| 1923 | dist = nxt->sequence - tail_index; | 1974 | /* |
| 1924 | if (req_dist >= dist) | 1975 | * cached_sq_head may overflow, and it will never overflow twice |
| 1976 | * once there is some timeout req still be valid. | ||
| 1977 | */ | ||
| 1978 | if (ctx->cached_sq_head < nxt_sq_head) | ||
| 1979 | tmp += UINT_MAX; | ||
| 1980 | |||
| 1981 | if (tmp > tmp_nxt) | ||
| 1925 | break; | 1982 | break; |
| 1983 | |||
| 1984 | /* | ||
| 1985 | * Sequence of reqs after the insert one and itself should | ||
| 1986 | * be adjusted because each timeout req consumes a slot. | ||
| 1987 | */ | ||
| 1988 | span++; | ||
| 1989 | nxt->sequence++; | ||
| 1926 | } | 1990 | } |
| 1991 | req->sequence -= span; | ||
| 1927 | list_add(&req->list, entry); | 1992 | list_add(&req->list, entry); |
| 1928 | spin_unlock_irq(&ctx->completion_lock); | 1993 | spin_unlock_irq(&ctx->completion_lock); |
| 1929 | 1994 | ||
| @@ -2262,12 +2327,18 @@ static int io_req_set_file(struct io_ring_ctx *ctx, const struct sqe_submit *s, · 332 unmodified lines | |||
| 2262 | } | 2327 | } |
| 2263 | 2328 | ||
| 2264 | static int __io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, | 2329 | static int __io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, |
| 2265 | struct sqe_submit *s, bool force_nonblock) | 2330 | struct sqe_submit *s) |
| 2266 | { | 2331 | { |
| 2267 | int ret; | 2332 | int ret; |
| 2268 | 2333 | ||
| 2269 | ret = __io_submit_sqe(ctx, req, s, force_nonblock); | 2334 | ret = __io_submit_sqe(ctx, req, s, true); |
| 2270 | if (ret == -EAGAIN && !(req->flags & REQ_F_NOWAIT)) { | 2335 | |
| 2336 | /* | ||
| 2337 | * We async punt it if the file wasn't marked NOWAIT, or if the file | ||
| 2338 | * doesn't support non-blocking read/write attempts | ||
| 2339 | */ | ||
| 2340 | if (ret == -EAGAIN && (!(req->flags & REQ_F_NOWAIT) || | ||
| 2341 | (req->flags & REQ_F_MUST_PUNT))) { | ||
| 2271 | struct io_uring_sqe *sqe_copy; | 2342 | struct io_uring_sqe *sqe_copy; |
| 2272 | 2343 | ||
| 2273 | sqe_copy = kmemdup(s->sqe, sizeof(*sqe_copy), GFP_KERNEL); | 2344 | sqe_copy = kmemdup(s->sqe, sizeof(*sqe_copy), GFP_KERNEL); |
| @@ -2307,7 +2378,7 @@ static int __io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, · 33 unmodified lines | |||
| 2307 | } | 2378 | } |
| 2308 | 2379 | ||
| 2309 | static int io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, | 2380 | static int io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, |
| 2310 | struct sqe_submit *s, bool force_nonblock) | 2381 | struct sqe_submit *s) |
| 2311 | { | 2382 | { |
| 2312 | int ret; | 2383 | int ret; |
| 2313 | 2384 | ||
| @@ -2320,18 +2391,17 @@ static int io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, · 6 unmodified lines | |||
| 2320 | return 0; | 2391 | return 0; |
| 2321 | } | 2392 | } |
| 2322 | 2393 | ||
| 2323 | return __io_queue_sqe(ctx, req, s, force_nonblock); | 2394 | return __io_queue_sqe(ctx, req, s); |
| 2324 | } | 2395 | } |
| 2325 | 2396 | ||
| 2326 | static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req, | 2397 | static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req, |
| 2327 | struct sqe_submit *s, struct io_kiocb *shadow, | 2398 | struct sqe_submit *s, struct io_kiocb *shadow) |
| 2328 | bool force_nonblock) | ||
| 2329 | { | 2399 | { |
| 2330 | int ret; | 2400 | int ret; |
| 2331 | int need_submit = false; | 2401 | int need_submit = false; |
| 2332 | 2402 | ||
| 2333 | if (!shadow) | 2403 | if (!shadow) |
| 2334 | return io_queue_sqe(ctx, req, s, force_nonblock); | 2404 | return io_queue_sqe(ctx, req, s); |
| 2335 | 2405 | ||
| 2336 | /* | 2406 | /* |
| 2337 | * Mark the first IO in link list as DRAIN, let all the following | 2407 | * Mark the first IO in link list as DRAIN, let all the following |
| @@ -2360,7 +2430,7 @@ static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req, · 22 unmodified lines | |||
| 2360 | spin_unlock_irq(&ctx->completion_lock); | 2430 | spin_unlock_irq(&ctx->completion_lock); |
| 2361 | 2431 | ||
| 2362 | if (need_submit) | 2432 | if (need_submit) |
| 2363 | return __io_queue_sqe(ctx, req, s, force_nonblock); | 2433 | return __io_queue_sqe(ctx, req, s); |
| 2364 | 2434 | ||
| 2365 | return 0; | 2435 | return 0; |
| 2366 | } | 2436 | } |
| @@ -2368,8 +2438,7 @@ static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req, · 1 unmodified line | |||
| 2368 | #define SQE_VALID_FLAGS (IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK) | 2438 | #define SQE_VALID_FLAGS (IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK) |
| 2369 | 2439 | ||
| 2370 | static void io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s, | 2440 | static void io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s, |
| 2371 | struct io_submit_state *state, struct io_kiocb **link, | 2441 | struct io_submit_state *state, struct io_kiocb **link) |
| 2372 | bool force_nonblock) | ||
| 2373 | { | 2442 | { |
| 2374 | struct io_uring_sqe *sqe_copy; | 2443 | struct io_uring_sqe *sqe_copy; |
| 2375 | struct io_kiocb *req; | 2444 | struct io_kiocb *req; |
| @@ -2396,6 +2465,8 @@ err: · 20 unmodified lines | |||
| 2396 | return; | 2465 | return; |
| 2397 | } | 2466 | } |
| 2398 | 2467 | ||
| 2468 | req->user_data = s->sqe->user_data; | ||
| 2469 | |||
| 2399 | /* | 2470 | /* |
| 2400 | * If we already have a head request, queue this one for async | 2471 | * If we already have a head request, queue this one for async |
| 2401 | * submittal once the head completes. If we don't have a head but | 2472 | * submittal once the head completes. If we don't have a head but |
| @@ -2422,7 +2493,7 @@ err: · 20 unmodified lines | |||
| 2422 | INIT_LIST_HEAD(&req->link_list); | 2493 | INIT_LIST_HEAD(&req->link_list); |
| 2423 | *link = req; | 2494 | *link = req; |
| 2424 | } else { | 2495 | } else { |
| 2425 | io_queue_sqe(ctx, req, s, force_nonblock); | 2496 | io_queue_sqe(ctx, req, s); |
| 2426 | } | 2497 | } |
| 2427 | } | 2498 | } |
| 2428 | 2499 | ||
| @@ -2502,12 +2573,13 @@ static bool io_get_sqring(struct io_ring_ctx *ctx, struct sqe_submit *s) · 73 unmodified lines | |||
| 2502 | 2573 | ||
| 2503 | /* drop invalid entries */ | 2574 | /* drop invalid entries */ |
| 2504 | ctx->cached_sq_head++; | 2575 | ctx->cached_sq_head++; |
| 2505 | rings->sq_dropped++; | 2576 | ctx->cached_sq_dropped++; |
| 2577 | WRITE_ONCE(rings->sq_dropped, ctx->cached_sq_dropped); | ||
| 2506 | return false; | 2578 | return false; |
| 2507 | } | 2579 | } |
| 2508 | 2580 | ||
| 2509 | static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes, | 2581 | static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr, |
| 2510 | unsigned int nr, bool has_user, bool mm_fault) | 2582 | bool has_user, bool mm_fault) |
| 2511 | { | 2583 | { |
| 2512 | struct io_submit_state state, *statep = NULL; | 2584 | struct io_submit_state state, *statep = NULL; |
| 2513 | struct io_kiocb *link = NULL; | 2585 | struct io_kiocb *link = NULL; |
| @@ -2521,19 +2593,23 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes, · 7 unmodified lines | |||
| 2521 | } | 2593 | } |
| 2522 | 2594 | ||
| 2523 | for (i = 0; i < nr; i++) { | 2595 | for (i = 0; i < nr; i++) { |
| 2596 | struct sqe_submit s; | ||
| 2597 | |||
| 2598 | if (!io_get_sqring(ctx, &s)) | ||
| 2599 | break; | ||
| 2600 | |||
| 2524 | /* | 2601 | /* |
| 2525 | * If previous wasn't linked and we have a linked command, | 2602 | * If previous wasn't linked and we have a linked command, |
| 2526 | * that's the end of the chain. Submit the previous link. | 2603 | * that's the end of the chain. Submit the previous link. |
| 2527 | */ | 2604 | */ |
| 2528 | if (!prev_was_link && link) { | 2605 | if (!prev_was_link && link) { |
| 2529 | io_queue_link_head(ctx, link, &link->submit, shadow_req, | 2606 | io_queue_link_head(ctx, link, &link->submit, shadow_req); |
| 2530 | true); | ||
| 2531 | link = NULL; | 2607 | link = NULL; |
| 2532 | shadow_req = NULL; | 2608 | shadow_req = NULL; |
| 2533 | } | 2609 | } |
| 2534 | prev_was_link = (sqes[i].sqe->flags & IOSQE_IO_LINK) != 0; | 2610 | prev_was_link = (s.sqe->flags & IOSQE_IO_LINK) != 0; |
| 2535 | 2611 | ||
| 2536 | if (link && (sqes[i].sqe->flags & IOSQE_IO_DRAIN)) { | 2612 | if (link && (s.sqe->flags & IOSQE_IO_DRAIN)) { |
| 2537 | if (!shadow_req) { | 2613 | if (!shadow_req) { |
| 2538 | shadow_req = io_get_req(ctx, NULL); | 2614 | shadow_req = io_get_req(ctx, NULL); |
| 2539 | if (unlikely(!shadow_req)) | 2615 | if (unlikely(!shadow_req)) |
| @@ -2541,24 +2617,24 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes, · 1 unmodified line | |||
| 2541 | shadow_req->flags |= (REQ_F_IO_DRAIN | REQ_F_SHADOW_DRAIN); | 2617 | shadow_req->flags |= (REQ_F_IO_DRAIN | REQ_F_SHADOW_DRAIN); |
| 2542 | refcount_dec(&shadow_req->refs); | 2618 | refcount_dec(&shadow_req->refs); |
| 2543 | } | 2619 | } |
| 2544 | shadow_req->sequence = sqes[i].sequence; | 2620 | shadow_req->sequence = s.sequence; |
| 2545 | } | 2621 | } |
| 2546 | 2622 | ||
| 2547 | out: | 2623 | out: |
| 2548 | if (unlikely(mm_fault)) { | 2624 | if (unlikely(mm_fault)) { |
| 2549 | io_cqring_add_event(ctx, sqes[i].sqe->user_data, | 2625 | io_cqring_add_event(ctx, s.sqe->user_data, |
| 2550 | -EFAULT); | 2626 | -EFAULT); |
| 2551 | } else { | 2627 | } else { |
| 2552 | sqes[i].has_user = has_user; | 2628 | s.has_user = has_user; |
| 2553 | sqes[i].needs_lock = true; | 2629 | s.needs_lock = true; |
| 2554 | sqes[i].needs_fixed_file = true; | 2630 | s.needs_fixed_file = true; |
| 2555 | io_submit_sqe(ctx, &sqes[i], statep, &link, true); | 2631 | io_submit_sqe(ctx, &s, statep, &link); |
| 2556 | submitted++; | 2632 | submitted++; |
| 2557 | } | 2633 | } |
| 2558 | } | 2634 | } |
| 2559 | 2635 | ||
| 2560 | if (link) | 2636 | if (link) |
| 2561 | io_queue_link_head(ctx, link, &link->submit, shadow_req, true); | 2637 | io_queue_link_head(ctx, link, &link->submit, shadow_req); |
| 2562 | if (statep) | 2638 | if (statep) |
| 2563 | io_submit_state_end(&state); | 2639 | io_submit_state_end(&state); |
| 2564 | 2640 | ||
| @@ -2567,7 +2643,6 @@ out: · 2 unmodified lines | |||
| 2567 | 2643 | ||
| 2568 | static int io_sq_thread(void *data) | 2644 | static int io_sq_thread(void *data) |
| 2569 | { | 2645 | { |
| 2570 | struct sqe_submit sqes[IO_IOPOLL_BATCH]; | ||
| 2571 | struct io_ring_ctx *ctx = data; | 2646 | struct io_ring_ctx *ctx = data; |
| 2572 | struct mm_struct *cur_mm = NULL; | 2647 | struct mm_struct *cur_mm = NULL; |
| 2573 | mm_segment_t old_fs; | 2648 | mm_segment_t old_fs; |
| @@ -2582,14 +2657,27 @@ static int io_sq_thread(void *data) · 8 unmodified lines | |||
| 2582 | 2657 | ||
| 2583 | timeout = inflight = 0; | 2658 | timeout = inflight = 0; |
| 2584 | while (!kthread_should_park()) { | 2659 | while (!kthread_should_park()) { |
| 2585 | bool all_fixed, mm_fault = false; | 2660 | bool mm_fault = false; |
| 2586 | int i; | 2661 | unsigned int to_submit; |
| 2587 | 2662 | ||
| 2588 | if (inflight) { | 2663 | if (inflight) { |
| 2589 | unsigned nr_events = 0; | 2664 | unsigned nr_events = 0; |
| 2590 | 2665 | ||
| 2591 | if (ctx->flags & IORING_SETUP_IOPOLL) { | 2666 | if (ctx->flags & IORING_SETUP_IOPOLL) { |
| 2592 | io_iopoll_check(ctx, &nr_events, 0); | 2667 | /* |
| 2668 | * inflight is the count of the maximum possible | ||
| 2669 | * entries we submitted, but it can be smaller | ||
| 2670 | * if we dropped some of them. If we don't have | ||
| 2671 | * poll entries available, then we know that we | ||
| 2672 | * have nothing left to poll for. Reset the | ||
| 2673 | * inflight count to zero in that case. | ||
| 2674 | */ | ||
| 2675 | mutex_lock(&ctx->uring_lock); | ||
| 2676 | if (!list_empty(&ctx->poll_list)) | ||
| 2677 | __io_iopoll_check(ctx, &nr_events, 0); | ||
| 2678 | else | ||
| 2679 | inflight = 0; | ||
| 2680 | mutex_unlock(&ctx->uring_lock); | ||
| 2593 | } else { | 2681 | } else { |
| 2594 | /* | 2682 | /* |
| 2595 | * Normal IO, just pretend everything completed. | 2683 | * Normal IO, just pretend everything completed. |
| @@ -2603,7 +2691,8 @@ static int io_sq_thread(void *data) · 7 unmodified lines | |||
| 2603 | timeout = jiffies + ctx->sq_thread_idle; | 2691 | timeout = jiffies + ctx->sq_thread_idle; |
| 2604 | } | 2692 | } |
| 2605 | 2693 | ||
| 2606 | if (!io_get_sqring(ctx, &sqes[0])) { | 2694 | to_submit = io_sqring_entries(ctx); |
| 2695 | if (!to_submit) { | ||
| 2607 | /* | 2696 | /* |
| 2608 | * We're polling. If we're within the defined idle | 2697 | * We're polling. If we're within the defined idle |
| 2609 | * period, then let us spin without work before going | 2698 | * period, then let us spin without work before going |
| @@ -2634,7 +2723,8 @@ static int io_sq_thread(void *data) · 24 unmodified lines | |||
| 2634 | /* make sure to read SQ tail after writing flags */ | 2723 | /* make sure to read SQ tail after writing flags */ |
| 2635 | smp_mb(); | 2724 | smp_mb(); |
| 2636 | 2725 | ||
| 2637 | if (!io_get_sqring(ctx, &sqes[0])) { | 2726 | to_submit = io_sqring_entries(ctx); |
| 2727 | if (!to_submit) { | ||
| 2638 | if (kthread_should_park()) { | 2728 | if (kthread_should_park()) { |
| 2639 | finish_wait(&ctx->sqo_wait, &wait); | 2729 | finish_wait(&ctx->sqo_wait, &wait); |
| 2640 | break; | 2730 | break; |
| @@ -2652,19 +2742,8 @@ static int io_sq_thread(void *data) · 11 unmodified lines | |||
| 2652 | ctx->rings->sq_flags &= ~IORING_SQ_NEED_WAKEUP; | 2742 | ctx->rings->sq_flags &= ~IORING_SQ_NEED_WAKEUP; |
| 2653 | } | 2743 | } |
| 2654 | 2744 | ||
| 2655 | i = 0; | ||
| 2656 | all_fixed = true; | ||
| 2657 | do { | ||
| 2658 | if (all_fixed && io_sqe_needs_user(sqes[i].sqe)) | ||
| 2659 | all_fixed = false; | ||
| 2660 | |||
| 2661 | i++; | ||
| 2662 | if (i == ARRAY_SIZE(sqes)) | ||
| 2663 | break; | ||
| 2664 | } while (io_get_sqring(ctx, &sqes[i])); | ||
| 2665 | |||
| 2666 | /* Unless all new commands are FIXED regions, grab mm */ | 2745 | /* Unless all new commands are FIXED regions, grab mm */ |
| 2667 | if (!all_fixed && !cur_mm) { | 2746 | if (!cur_mm) { |
| 2668 | mm_fault = !mmget_not_zero(ctx->sqo_mm); | 2747 | mm_fault = !mmget_not_zero(ctx->sqo_mm); |
| 2669 | if (!mm_fault) { | 2748 | if (!mm_fault) { |
| 2670 | use_mm(ctx->sqo_mm); | 2749 | use_mm(ctx->sqo_mm); |
| @@ -2672,8 +2751,9 @@ static int io_sq_thread(void *data) · 1 unmodified line | |||
| 2672 | } | 2751 | } |
| 2673 | } | 2752 | } |
| 2674 | 2753 | ||
| 2675 | inflight += io_submit_sqes(ctx, sqes, i, cur_mm != NULL, | 2754 | to_submit = min(to_submit, ctx->sq_entries); |
| 2676 | mm_fault); | 2755 | inflight += io_submit_sqes(ctx, to_submit, cur_mm != NULL, |
| 2756 | mm_fault); | ||
| 2677 | 2757 | ||
| 2678 | /* Commit SQ ring head once we've consumed all SQEs */ | 2758 | /* Commit SQ ring head once we've consumed all SQEs */ |
| 2679 | io_commit_sqring(ctx); | 2759 | io_commit_sqring(ctx); |
| @@ -2690,8 +2770,7 @@ static int io_sq_thread(void *data) · 10 unmodified lines | |||
| 2690 | return 0; | 2770 | return 0; |
| 2691 | } | 2771 | } |
| 2692 | 2772 | ||
| 2693 | static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit, | 2773 | static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit) |
| 2694 | bool block_for_last) | ||
| 2695 | { | 2774 | { |
| 2696 | struct io_submit_state state, *statep = NULL; | 2775 | struct io_submit_state state, *statep = NULL; |
| 2697 | struct io_kiocb *link = NULL; | 2776 | struct io_kiocb *link = NULL; |
| @@ -2705,7 +2784,6 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit, · 7 unmodified lines | |||
| 2705 | } | 2784 | } |
| 2706 | 2785 | ||
| 2707 | for (i = 0; i < to_submit; i++) { | 2786 | for (i = 0; i < to_submit; i++) { |
| 2708 | bool force_nonblock = true; | ||
| 2709 | struct sqe_submit s; | 2787 | struct sqe_submit s; |
| 2710 | 2788 | ||
| 2711 | if (!io_get_sqring(ctx, &s)) | 2789 | if (!io_get_sqring(ctx, &s)) |
| @@ -2716,8 +2794,7 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit, · 4 unmodified lines | |||
| 2716 | * that's the end of the chain. Submit the previous link. | 2794 | * that's the end of the chain. Submit the previous link. |
| 2717 | */ | 2795 | */ |
| 2718 | if (!prev_was_link && link) { | 2796 | if (!prev_was_link && link) { |
| 2719 | io_queue_link_head(ctx, link, &link->submit, shadow_req, | 2797 | io_queue_link_head(ctx, link, &link->submit, shadow_req); |
| 2720 | force_nonblock); | ||
| 2721 | link = NULL; | 2798 | link = NULL; |
| 2722 | shadow_req = NULL; | 2799 | shadow_req = NULL; |
| 2723 | } | 2800 | } |
| @@ -2739,27 +2816,16 @@ out: · 15 unmodified lines | |||
| 2739 | s.needs_lock = false; | 2816 | s.needs_lock = false; |
| 2740 | s.needs_fixed_file = false; | 2817 | s.needs_fixed_file = false; |
| 2741 | submit++; | 2818 | submit++; |
| 2742 | 2819 | io_submit_sqe(ctx, &s, statep, &link); | |
| 2743 | /* | ||
| 2744 | * The caller will block for events after submit, submit the | ||
| 2745 | * last IO non-blocking. This is either the only IO it's | ||
| 2746 | * submitting, or it already submitted the previous ones. This | ||
| 2747 | * improves performance by avoiding an async punt that we don't | ||
| 2748 | * need to do. | ||
| 2749 | */ | ||
| 2750 | if (block_for_last && submit == to_submit) | ||
| 2751 | force_nonblock = false; | ||
| 2752 | |||
| 2753 | io_submit_sqe(ctx, &s, statep, &link, force_nonblock); | ||
| 2754 | } | 2820 | } |
| 2755 | io_commit_sqring(ctx); | ||
| 2756 | 2821 | ||
| 2757 | if (link) | 2822 | if (link) |
| 2758 | io_queue_link_head(ctx, link, &link->submit, shadow_req, | 2823 | io_queue_link_head(ctx, link, &link->submit, shadow_req); |
| 2759 | !block_for_last); | ||
| 2760 | if (statep) | 2824 | if (statep) |
| 2761 | io_submit_state_end(statep); | 2825 | io_submit_state_end(statep); |
| 2762 | 2826 | ||
| 2827 | io_commit_sqring(ctx); | ||
| 2828 | |||
| 2763 | return submit; | 2829 | return submit; |
| 2764 | } | 2830 | } |
| 2765 | 2831 | ||
| @@ -3600,21 +3666,10 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 834 unmodified lines | |||
| 3600 | wake_up(&ctx->sqo_wait); | 3666 | wake_up(&ctx->sqo_wait); |
| 3601 | submitted = to_submit; | 3667 | submitted = to_submit; |
| 3602 | } else if (to_submit) { | 3668 | } else if (to_submit) { |
| 3603 | bool block_for_last = false; | ||
| 3604 | |||
| 3605 | to_submit = min(to_submit, ctx->sq_entries); | 3669 | to_submit = min(to_submit, ctx->sq_entries); |
| 3606 | 3670 | ||
| 3607 | /* | ||
| 3608 | * Allow last submission to block in a series, IFF the caller | ||
| 3609 | * asked to wait for events and we don't currently have | ||
| 3610 | * enough. This potentially avoids an async punt. | ||
| 3611 | */ | ||
| 3612 | if (to_submit == min_complete && | ||
| 3613 | io_cqring_events(ctx->rings) < min_complete) | ||
| 3614 | block_for_last = true; | ||
| 3615 | |||
| 3616 | mutex_lock(&ctx->uring_lock); | 3671 | mutex_lock(&ctx->uring_lock); |
| 3617 | submitted = io_ring_submit(ctx, to_submit, block_for_last); | 3672 | submitted = io_ring_submit(ctx, to_submit); |
| 3618 | mutex_unlock(&ctx->uring_lock); | 3673 | mutex_unlock(&ctx->uring_lock); |
| 3619 | } | 3674 | } |
| 3620 | if (flags & IORING_ENTER_GETEVENTS) { | 3675 | if (flags & IORING_ENTER_GETEVENTS) { |
| @@ -473,8 +473,7 @@ EXPORT_SYMBOL(simple_write_begin); · 472 unmodified lines | |||
| 473 | 473 | ||
| 474 | /** | 474 | /** |
| 475 | * simple_write_end - .write_end helper for non-block-device FSes | 475 | * simple_write_end - .write_end helper for non-block-device FSes |
| 476 | * @available: See .write_end of address_space_operations | 476 | * @file: See .write_end of address_space_operations |
| 477 | * @file: " | ||
| 478 | * @mapping: " | 477 | * @mapping: " |
| 479 | * @pos: " | 478 | * @pos: " |
| 480 | * @len: " | 479 | * @len: " |
| @@ -1230,6 +1230,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) · 1229 unmodified lines | |||
| 1230 | transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(attr->ia_uid)); | 1230 | transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(attr->ia_uid)); |
| 1231 | if (IS_ERR(transfer_to[USRQUOTA])) { | 1231 | if (IS_ERR(transfer_to[USRQUOTA])) { |
| 1232 | status = PTR_ERR(transfer_to[USRQUOTA]); | 1232 | status = PTR_ERR(transfer_to[USRQUOTA]); |
| 1233 | transfer_to[USRQUOTA] = NULL; | ||
| 1233 | goto bail_unlock; | 1234 | goto bail_unlock; |
| 1234 | } | 1235 | } |
| 1235 | } | 1236 | } |
| @@ -1239,6 +1240,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) · 3 unmodified lines | |||
| 1239 | transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(attr->ia_gid)); | 1240 | transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(attr->ia_gid)); |
| 1240 | if (IS_ERR(transfer_to[GRPQUOTA])) { | 1241 | if (IS_ERR(transfer_to[GRPQUOTA])) { |
| 1241 | status = PTR_ERR(transfer_to[GRPQUOTA]); | 1242 | status = PTR_ERR(transfer_to[GRPQUOTA]); |
| 1243 | transfer_to[GRPQUOTA] = NULL; | ||
| 1242 | goto bail_unlock; | 1244 | goto bail_unlock; |
| 1243 | } | 1245 | } |
| 1244 | } | 1246 | } |
| @@ -217,7 +217,8 @@ void ocfs2_recovery_exit(struct ocfs2_super *osb) · 216 unmodified lines | |||
| 217 | /* At this point, we know that no more recovery threads can be | 217 | /* At this point, we know that no more recovery threads can be |
| 218 | * launched, so wait for any recovery completion work to | 218 | * launched, so wait for any recovery completion work to |
| 219 | * complete. */ | 219 | * complete. */ |
| 220 | flush_workqueue(osb->ocfs2_wq); | 220 | if (osb->ocfs2_wq) |
| 221 | flush_workqueue(osb->ocfs2_wq); | ||
| 221 | 222 | ||
| 222 | /* | 223 | /* |
| 223 | * Now that recovery is shut down, and the osb is about to be | 224 | * Now that recovery is shut down, and the osb is about to be |
| @@ -377,7 +377,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) · 376 unmodified lines | |||
| 377 | struct ocfs2_dinode *alloc = NULL; | 377 | struct ocfs2_dinode *alloc = NULL; |
| 378 | 378 | ||
| 379 | cancel_delayed_work(&osb->la_enable_wq); | 379 | cancel_delayed_work(&osb->la_enable_wq); |
| 380 | flush_workqueue(osb->ocfs2_wq); | 380 | if (osb->ocfs2_wq) |
| 381 | flush_workqueue(osb->ocfs2_wq); | ||
| 381 | 382 | ||
| 382 | if (osb->local_alloc_state == OCFS2_LA_UNUSED) | 383 | if (osb->local_alloc_state == OCFS2_LA_UNUSED) |
| 383 | goto out; | 384 | goto out; |
| @@ -132,9 +132,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v) · 131 unmodified lines | |||
| 132 | global_node_page_state(NR_SHMEM_THPS) * HPAGE_PMD_NR); | 132 | global_node_page_state(NR_SHMEM_THPS) * HPAGE_PMD_NR); |
| 133 | show_val_kb(m, "ShmemPmdMapped: ", | 133 | show_val_kb(m, "ShmemPmdMapped: ", |
| 134 | global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR); | 134 | global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR); |
| 135 | show_val_kb(m, "FileHugePages: ", | 135 | show_val_kb(m, "FileHugePages: ", |
| 136 | global_node_page_state(NR_FILE_THPS) * HPAGE_PMD_NR); | 136 | global_node_page_state(NR_FILE_THPS) * HPAGE_PMD_NR); |
| 137 | show_val_kb(m, "FilePmdMapped: ", | 137 | show_val_kb(m, "FilePmdMapped: ", |
| 138 | global_node_page_state(NR_FILE_PMDMAPPED) * HPAGE_PMD_NR); | 138 | global_node_page_state(NR_FILE_PMDMAPPED) * HPAGE_PMD_NR); |
| 139 | #endif | 139 | #endif |
| 140 | 140 | ||
| @@ -42,10 +42,12 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf, · 41 unmodified lines | |||
| 42 | return -EINVAL; | 42 | return -EINVAL; |
| 43 | 43 | ||
| 44 | while (count > 0) { | 44 | while (count > 0) { |
| 45 | if (pfn_valid(pfn)) | 45 | /* |
| 46 | ppage = pfn_to_page(pfn); | 46 | * TODO: ZONE_DEVICE support requires to identify |
| 47 | else | 47 | * memmaps that were actually initialized. |
| 48 | ppage = NULL; | 48 | */ |
| 49 | ppage = pfn_to_online_page(pfn); | ||
| 50 | |||
| 49 | if (!ppage || PageSlab(ppage) || page_has_type(ppage)) | 51 | if (!ppage || PageSlab(ppage) || page_has_type(ppage)) |
| 50 | pcount = 0; | 52 | pcount = 0; |
| 51 | else | 53 | else |
| @@ -216,10 +218,11 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf, · 164 unmodified lines | |||
| 216 | return -EINVAL; | 218 | return -EINVAL; |
| 217 | 219 | ||
| 218 | while (count > 0) { | 220 | while (count > 0) { |
| 219 | if (pfn_valid(pfn)) | 221 | /* |
| 220 | ppage = pfn_to_page(pfn); | 222 | * TODO: ZONE_DEVICE support requires to identify |
| 221 | else | 223 | * memmaps that were actually initialized. |
| 222 | ppage = NULL; | 224 | */ |
| 225 | ppage = pfn_to_online_page(pfn); | ||
| 223 | 226 | ||
| 224 | if (put_user(stable_page_flags(ppage), out)) { | 227 | if (put_user(stable_page_flags(ppage), out)) { |
| 225 | ret = -EFAULT; | 228 | ret = -EFAULT; |
| @@ -261,10 +264,11 @@ static ssize_t kpagecgroup_read(struct file *file, char __user *buf, · 35 unmodified lines | |||
| 261 | return -EINVAL; | 264 | return -EINVAL; |
| 262 | 265 | ||
| 263 | while (count > 0) { | 266 | while (count > 0) { |
| 264 | if (pfn_valid(pfn)) | 267 | /* |
| 265 | ppage = pfn_to_page(pfn); | 268 | * TODO: ZONE_DEVICE support requires to identify |
| 266 | else | 269 | * memmaps that were actually initialized. |
| 267 | ppage = NULL; | 270 | */ |
| 271 | ppage = pfn_to_online_page(pfn); | ||
| 268 | 272 | ||
| 269 | if (ppage) | 273 | if (ppage) |
| 270 | ino = page_cgroup_ino(ppage); | 274 | ino = page_cgroup_ino(ppage); |
| @@ -105,9 +105,9 @@ EXPORT_SYMBOL(iterate_dir); · 104 unmodified lines | |||
| 105 | */ | 105 | */ |
| 106 | static int verify_dirent_name(const char *name, int len) | 106 | static int verify_dirent_name(const char *name, int len) |
| 107 | { | 107 | { |
| 108 | if (WARN_ON_ONCE(!len)) | 108 | if (!len) |
| 109 | return -EIO; | 109 | return -EIO; |
| 110 | if (WARN_ON_ONCE(memchr(name, '/', len))) | 110 | if (memchr(name, '/', len)) |
| 111 | return -EIO; | 111 | return -EIO; |
| 112 | return 0; | 112 | return 0; |
| 113 | } | 113 | } |
| @@ -366,11 +366,11 @@ struct xfs_bulkstat { · 365 unmodified lines | |||
| 366 | uint64_t bs_blocks; /* number of blocks */ | 366 | uint64_t bs_blocks; /* number of blocks */ |
| 367 | uint64_t bs_xflags; /* extended flags */ | 367 | uint64_t bs_xflags; /* extended flags */ |
| 368 | 368 | ||
| 369 | uint64_t bs_atime; /* access time, seconds */ | 369 | int64_t bs_atime; /* access time, seconds */ |
| 370 | uint64_t bs_mtime; /* modify time, seconds */ | 370 | int64_t bs_mtime; /* modify time, seconds */ |
| 371 | 371 | ||
| 372 | uint64_t bs_ctime; /* inode change time, seconds */ | 372 | int64_t bs_ctime; /* inode change time, seconds */ |
| 373 | uint64_t bs_btime; /* creation time, seconds */ | 373 | int64_t bs_btime; /* creation time, seconds */ |
| 374 | 374 | ||
| 375 | uint32_t bs_gen; /* generation count */ | 375 | uint32_t bs_gen; /* generation count */ |
| 376 | uint32_t bs_uid; /* user id */ | 376 | uint32_t bs_uid; /* user id */ |
| @@ -232,8 +232,8 @@ struct acpi_processor { · 231 unmodified lines | |||
| 232 | struct acpi_processor_limit limit; | 232 | struct acpi_processor_limit limit; |
| 233 | struct thermal_cooling_device *cdev; | 233 | struct thermal_cooling_device *cdev; |
| 234 | struct device *dev; /* Processor device. */ | 234 | struct device *dev; /* Processor device. */ |
| 235 | struct dev_pm_qos_request perflib_req; | 235 | struct freq_qos_request perflib_req; |
| 236 | struct dev_pm_qos_request thermal_req; | 236 | struct freq_qos_request thermal_req; |
| 237 | }; | 237 | }; |
| 238 | 238 | ||
| 239 | struct acpi_processor_errata { | 239 | struct acpi_processor_errata { |
| @@ -302,8 +302,8 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx · 62 unmodified lines | |||
| 302 | #ifdef CONFIG_CPU_FREQ | 302 | #ifdef CONFIG_CPU_FREQ |
| 303 | extern bool acpi_processor_cpufreq_init; | 303 | extern bool acpi_processor_cpufreq_init; |
| 304 | void acpi_processor_ignore_ppc_init(void); | 304 | void acpi_processor_ignore_ppc_init(void); |
| 305 | void acpi_processor_ppc_init(int cpu); | 305 | void acpi_processor_ppc_init(struct cpufreq_policy *policy); |
| 306 | void acpi_processor_ppc_exit(int cpu); | 306 | void acpi_processor_ppc_exit(struct cpufreq_policy *policy); |
| 307 | void acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag); | 307 | void acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag); |
| 308 | extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit); | 308 | extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit); |
| 309 | #else | 309 | #else |
| @@ -311,11 +311,11 @@ static inline void acpi_processor_ignore_ppc_init(void) · 1 unmodified line | |||
| 311 | { | 311 | { |
| 312 | return; | 312 | return; |
| 313 | } | 313 | } |
| 314 | static inline void acpi_processor_ppc_init(int cpu) | 314 | static inline void acpi_processor_ppc_init(struct cpufreq_policy *policy) |
| 315 | { | 315 | { |
| 316 | return; | 316 | return; |
| 317 | } | 317 | } |
| 318 | static inline void acpi_processor_ppc_exit(int cpu) | 318 | static inline void acpi_processor_ppc_exit(struct cpufreq_policy *policy) |
| 319 | { | 319 | { |
| 320 | return; | 320 | return; |
| 321 | } | 321 | } |
| @@ -431,14 +431,14 @@ static inline int acpi_processor_hotplug(struct acpi_processor *pr) · 109 unmodified lines | |||
| 431 | int acpi_processor_get_limit_info(struct acpi_processor *pr); | 431 | int acpi_processor_get_limit_info(struct acpi_processor *pr); |
| 432 | extern const struct thermal_cooling_device_ops processor_cooling_ops; | 432 | extern const struct thermal_cooling_device_ops processor_cooling_ops; |
| 433 | #if defined(CONFIG_ACPI_CPU_FREQ_PSS) & defined(CONFIG_CPU_FREQ) | 433 | #if defined(CONFIG_ACPI_CPU_FREQ_PSS) & defined(CONFIG_CPU_FREQ) |
| 434 | void acpi_thermal_cpufreq_init(int cpu); | 434 | void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy); |
| 435 | void acpi_thermal_cpufreq_exit(int cpu); | 435 | void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy); |
| 436 | #else | 436 | #else |
| 437 | static inline void acpi_thermal_cpufreq_init(int cpu) | 437 | static inline void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy) |
| 438 | { | 438 | { |
| 439 | return; | 439 | return; |
| 440 | } | 440 | } |
| 441 | static inline void acpi_thermal_cpufreq_exit(int cpu) | 441 | static inline void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy) |
| 442 | { | 442 | { |
| 443 | return; | 443 | return; |
| 444 | } | 444 | } |
| @@ -326,10 +326,11 @@ static inline int bitmap_equal(const unsigned long *src1, · 325 unmodified lines | |||
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | /** | 328 | /** |
| 329 | * bitmap_or_equal - Check whether the or of two bitnaps is equal to a third | 329 | * bitmap_or_equal - Check whether the or of two bitmaps is equal to a third |
| 330 | * @src1: Pointer to bitmap 1 | 330 | * @src1: Pointer to bitmap 1 |
| 331 | * @src2: Pointer to bitmap 2 will be or'ed with bitmap 1 | 331 | * @src2: Pointer to bitmap 2 will be or'ed with bitmap 1 |
| 332 | * @src3: Pointer to bitmap 3. Compare to the result of *@src1 | *@src2 | 332 | * @src3: Pointer to bitmap 3. Compare to the result of *@src1 | *@src2 |
| 333 | * @nbits: number of bits in each of these bitmaps | ||
| 333 | * | 334 | * |
| 334 | * Returns: True if (*@src1 | *@src2) == *@src3, false otherwise | 335 | * Returns: True if (*@src1 | *@src2) == *@src3, false otherwise |
| 335 | */ | 336 | */ |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
| 14 | #include <linux/kobject.h> | 14 | #include <linux/kobject.h> |
| 15 | #include <linux/notifier.h> | 15 | #include <linux/notifier.h> |
| 16 | #include <linux/pm_qos.h> | ||
| 16 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
| 17 | #include <linux/sysfs.h> | 18 | #include <linux/sysfs.h> |
| 18 | 19 | ||
| @@ -76,8 +77,10 @@ struct cpufreq_policy { · 57 unmodified lines | |||
| 76 | struct work_struct update; /* if update_policy() needs to be | 77 | struct work_struct update; /* if update_policy() needs to be |
| 77 | * called, but you're in IRQ context */ | 78 | * called, but you're in IRQ context */ |
| 78 | 79 | ||
| 79 | struct dev_pm_qos_request *min_freq_req; | 80 | struct freq_constraints constraints; |
| 80 | struct dev_pm_qos_request *max_freq_req; | 81 | struct freq_qos_request *min_freq_req; |
| 82 | struct freq_qos_request *max_freq_req; | ||
| 83 | |||
| 81 | struct cpufreq_frequency_table *freq_table; | 84 | struct cpufreq_frequency_table *freq_table; |
| 82 | enum cpufreq_table_sorting freq_table_sorted; | 85 | enum cpufreq_table_sorting freq_table_sorted; |
| 83 | 86 | ||
| @@ -18,8 +18,6 @@ extern struct module __this_module; · 17 unmodified lines | |||
| 18 | #define THIS_MODULE ((struct module *)0) | 18 | #define THIS_MODULE ((struct module *)0) |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | #define NS_SEPARATOR "." | ||
| 22 | |||
| 23 | #ifdef CONFIG_MODVERSIONS | 21 | #ifdef CONFIG_MODVERSIONS |
| 24 | /* Mark the CRC weak since genksyms apparently decides not to | 22 | /* Mark the CRC weak since genksyms apparently decides not to |
| 25 | * generate a checksums for some symbols */ | 23 | * generate a checksums for some symbols */ |
| @@ -48,11 +46,11 @@ extern struct module __this_module; · 22 unmodified lines | |||
| 48 | * absolute relocations that require runtime processing on relocatable | 46 | * absolute relocations that require runtime processing on relocatable |
| 49 | * kernels. | 47 | * kernels. |
| 50 | */ | 48 | */ |
| 51 | #define __KSYMTAB_ENTRY_NS(sym, sec, ns) \ | 49 | #define __KSYMTAB_ENTRY_NS(sym, sec) \ |
| 52 | __ADDRESSABLE(sym) \ | 50 | __ADDRESSABLE(sym) \ |
| 53 | asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ | 51 | asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \ |
| 54 | " .balign 4 \n" \ | 52 | " .balign 4 \n" \ |
| 55 | "__ksymtab_" #ns NS_SEPARATOR #sym ": \n" \ | 53 | "__ksymtab_" #sym ": \n" \ |
| 56 | " .long " #sym "- . \n" \ | 54 | " .long " #sym "- . \n" \ |
| 57 | " .long __kstrtab_" #sym "- . \n" \ | 55 | " .long __kstrtab_" #sym "- . \n" \ |
| 58 | " .long __kstrtabns_" #sym "- . \n" \ | 56 | " .long __kstrtabns_" #sym "- . \n" \ |
| @@ -74,16 +72,14 @@ struct kernel_symbol { · 15 unmodified lines | |||
| 74 | int namespace_offset; | 72 | int namespace_offset; |
| 75 | }; | 73 | }; |
| 76 | #else | 74 | #else |
| 77 | #define __KSYMTAB_ENTRY_NS(sym, sec, ns) \ | 75 | #define __KSYMTAB_ENTRY_NS(sym, sec) \ |
| 78 | static const struct kernel_symbol __ksymtab_##sym##__##ns \ | 76 | static const struct kernel_symbol __ksymtab_##sym \ |
| 79 | asm("__ksymtab_" #ns NS_SEPARATOR #sym) \ | ||
| 80 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ | 77 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ |
| 81 | __aligned(sizeof(void *)) \ | 78 | __aligned(sizeof(void *)) \ |
| 82 | = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } | 79 | = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym } |
| 83 | 80 | ||
| 84 | #define __KSYMTAB_ENTRY(sym, sec) \ | 81 | #define __KSYMTAB_ENTRY(sym, sec) \ |
| 85 | static const struct kernel_symbol __ksymtab_##sym \ | 82 | static const struct kernel_symbol __ksymtab_##sym \ |
| 86 | asm("__ksymtab_" #sym) \ | ||
| 87 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ | 83 | __attribute__((section("___ksymtab" sec "+" #sym), used)) \ |
| 88 | __aligned(sizeof(void *)) \ | 84 | __aligned(sizeof(void *)) \ |
| 89 | = { (unsigned long)&sym, __kstrtab_##sym, NULL } | 85 | = { (unsigned long)&sym, __kstrtab_##sym, NULL } |
| @@ -115,7 +111,7 @@ struct kernel_symbol { · 25 unmodified lines | |||
| 115 | static const char __kstrtabns_##sym[] \ | 111 | static const char __kstrtabns_##sym[] \ |
| 116 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ | 112 | __attribute__((section("__ksymtab_strings"), used, aligned(1))) \ |
| 117 | = #ns; \ | 113 | = #ns; \ |
| 118 | __KSYMTAB_ENTRY_NS(sym, sec, ns) | 114 | __KSYMTAB_ENTRY_NS(sym, sec) |
| 119 | 115 | ||
| 120 | #define ___EXPORT_SYMBOL(sym, sec) \ | 116 | #define ___EXPORT_SYMBOL(sym, sec) \ |
| 121 | ___export_symbol_common(sym, sec); \ | 117 | ___export_symbol_common(sym, sec); \ |
| @@ -201,6 +201,14 @@ struct gpio_irq_chip { · 200 unmodified lines | |||
| 201 | */ | 201 | */ |
| 202 | bool threaded; | 202 | bool threaded; |
| 203 | 203 | ||
| 204 | /** | ||
| 205 | * @init_hw: optional routine to initialize hardware before | ||
| 206 | * an IRQ chip will be added. This is quite useful when | ||
| 207 | * a particular driver wants to clear IRQ related registers | ||
| 208 | * in order to avoid undesired events. | ||
| 209 | */ | ||
| 210 | int (*init_hw)(struct gpio_chip *chip); | ||
| 211 | |||
| 204 | /** | 212 | /** |
| 205 | * @init_valid_mask: optional routine to initialize @valid_mask, to be | 213 | * @init_valid_mask: optional routine to initialize @valid_mask, to be |
| 206 | * used if not all GPIO lines are valid interrupts. Sometimes some | 214 | * used if not all GPIO lines are valid interrupts. Sometimes some |
| @@ -31,7 +31,7 @@ · 30 unmodified lines | |||
| 31 | #define PHY_ID_KSZ886X 0x00221430 | 31 | #define PHY_ID_KSZ886X 0x00221430 |
| 32 | #define PHY_ID_KSZ8863 0x00221435 | 32 | #define PHY_ID_KSZ8863 0x00221435 |
| 33 | 33 | ||
| 34 | #define PHY_ID_KSZ8795 0x00221550 | 34 | #define PHY_ID_KSZ87XX 0x00221550 |
| 35 | 35 | ||
| 36 | #define PHY_ID_KSZ9477 0x00221631 | 36 | #define PHY_ID_KSZ9477 0x00221631 |
| 37 | 37 | ||
| @@ -18,7 +18,7 @@ struct page_ext_operations { · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | enum page_ext_flags { | 19 | enum page_ext_flags { |
| 20 | PAGE_EXT_OWNER, | 20 | PAGE_EXT_OWNER, |
| 21 | PAGE_EXT_OWNER_ACTIVE, | 21 | PAGE_EXT_OWNER_ALLOCATED, |
| 22 | #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT) | 22 | #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT) |
| 23 | PAGE_EXT_YOUNG, | 23 | PAGE_EXT_YOUNG, |
| 24 | PAGE_EXT_IDLE, | 24 | PAGE_EXT_IDLE, |
| @@ -36,6 +36,7 @@ struct page_ext { · 11 unmodified lines | |||
| 36 | unsigned long flags; | 36 | unsigned long flags; |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | extern unsigned long page_ext_size; | ||
| 39 | extern void pgdat_page_ext_init(struct pglist_data *pgdat); | 40 | extern void pgdat_page_ext_init(struct pglist_data *pgdat); |
| 40 | 41 | ||
| 41 | #ifdef CONFIG_SPARSEMEM | 42 | #ifdef CONFIG_SPARSEMEM |
| @@ -52,6 +53,13 @@ static inline void page_ext_init(void) · 10 unmodified lines | |||
| 52 | 53 | ||
| 53 | struct page_ext *lookup_page_ext(const struct page *page); | 54 | struct page_ext *lookup_page_ext(const struct page *page); |
| 54 | 55 | ||
| 56 | static inline struct page_ext *page_ext_next(struct page_ext *curr) | ||
| 57 | { | ||
| 58 | void *next = curr; | ||
| 59 | next += page_ext_size; | ||
| 60 | return next; | ||
| 61 | } | ||
| 62 | |||
| 55 | #else /* !CONFIG_PAGE_EXTENSION */ | 63 | #else /* !CONFIG_PAGE_EXTENSION */ |
| 56 | struct page_ext; | 64 | struct page_ext; |
| 57 | 65 | ||
| @@ -293,7 +293,7 @@ struct pmu { · 292 unmodified lines | |||
| 293 | * -EBUSY -- @event is for this PMU but PMU temporarily unavailable | 293 | * -EBUSY -- @event is for this PMU but PMU temporarily unavailable |
| 294 | * -EINVAL -- @event is for this PMU but @event is not valid | 294 | * -EINVAL -- @event is for this PMU but @event is not valid |
| 295 | * -EOPNOTSUPP -- @event is for this PMU, @event is valid, but not supported | 295 | * -EOPNOTSUPP -- @event is for this PMU, @event is valid, but not supported |
| 296 | * -EACCESS -- @event is for this PMU, @event is valid, but no privilidges | 296 | * -EACCES -- @event is for this PMU, @event is valid, but no privileges |
| 297 | * | 297 | * |
| 298 | * 0 -- @event is for this PMU and valid | 298 | * 0 -- @event is for this PMU and valid |
| 299 | * | 299 | * |
| @@ -34,8 +34,6 @@ enum pm_qos_flags_status { · 33 unmodified lines | |||
| 34 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY | 34 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY |
| 35 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS | 35 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS |
| 36 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 | 36 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 |
| 37 | #define PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE 0 | ||
| 38 | #define PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE (-1) | ||
| 39 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) | 37 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) |
| 40 | 38 | ||
| 41 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) | 39 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) |
| @@ -54,8 +52,6 @@ struct pm_qos_flags_request { · 12 unmodified lines | |||
| 54 | enum dev_pm_qos_req_type { | 52 | enum dev_pm_qos_req_type { |
| 55 | DEV_PM_QOS_RESUME_LATENCY = 1, | 53 | DEV_PM_QOS_RESUME_LATENCY = 1, |
| 56 | DEV_PM_QOS_LATENCY_TOLERANCE, | 54 | DEV_PM_QOS_LATENCY_TOLERANCE, |
| 57 | DEV_PM_QOS_MIN_FREQUENCY, | ||
| 58 | DEV_PM_QOS_MAX_FREQUENCY, | ||
| 59 | DEV_PM_QOS_FLAGS, | 55 | DEV_PM_QOS_FLAGS, |
| 60 | }; | 56 | }; |
| 61 | 57 | ||
| @@ -97,14 +93,10 @@ struct pm_qos_flags { · 35 unmodified lines | |||
| 97 | struct dev_pm_qos { | 93 | struct dev_pm_qos { |
| 98 | struct pm_qos_constraints resume_latency; | 94 | struct pm_qos_constraints resume_latency; |
| 99 | struct pm_qos_constraints latency_tolerance; | 95 | struct pm_qos_constraints latency_tolerance; |
| 100 | struct pm_qos_constraints min_frequency; | ||
| 101 | struct pm_qos_constraints max_frequency; | ||
| 102 | struct pm_qos_flags flags; | 96 | struct pm_qos_flags flags; |
| 103 | struct dev_pm_qos_request *resume_latency_req; | 97 | struct dev_pm_qos_request *resume_latency_req; |
| 104 | struct dev_pm_qos_request *latency_tolerance_req; | 98 | struct dev_pm_qos_request *latency_tolerance_req; |
| 105 | struct dev_pm_qos_request *flags_req; | 99 | struct dev_pm_qos_request *flags_req; |
| 106 | struct dev_pm_qos_request *min_frequency_req; | ||
| 107 | struct dev_pm_qos_request *max_frequency_req; | ||
| 108 | }; | 100 | }; |
| 109 | 101 | ||
| 110 | /* Action requested to pm_qos_update_target */ | 102 | /* Action requested to pm_qos_update_target */ |
| @@ -199,10 +191,6 @@ static inline s32 dev_pm_qos_read_value(struct device *dev, · 88 unmodified lines | |||
| 199 | switch (type) { | 191 | switch (type) { |
| 200 | case DEV_PM_QOS_RESUME_LATENCY: | 192 | case DEV_PM_QOS_RESUME_LATENCY: |
| 201 | return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; | 193 | return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; |
| 202 | case DEV_PM_QOS_MIN_FREQUENCY: | ||
| 203 | return PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE; | ||
| 204 | case DEV_PM_QOS_MAX_FREQUENCY: | ||
| 205 | return PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE; | ||
| 206 | default: | 194 | default: |
| 207 | WARN_ON(1); | 195 | WARN_ON(1); |
| 208 | return 0; | 196 | return 0; |
| @@ -267,4 +255,48 @@ static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev) · 58 unmodified lines | |||
| 267 | } | 255 | } |
| 268 | #endif | 256 | #endif |
| 269 | 257 | ||
| 258 | #define FREQ_QOS_MIN_DEFAULT_VALUE 0 | ||
| 259 | #define FREQ_QOS_MAX_DEFAULT_VALUE (-1) | ||
| 260 | |||
| 261 | enum freq_qos_req_type { | ||
| 262 | FREQ_QOS_MIN = 1, | ||
| 263 | FREQ_QOS_MAX, | ||
| 264 | }; | ||
| 265 | |||
| 266 | struct freq_constraints { | ||
| 267 | struct pm_qos_constraints min_freq; | ||
| 268 | struct blocking_notifier_head min_freq_notifiers; | ||
| 269 | struct pm_qos_constraints max_freq; | ||
| 270 | struct blocking_notifier_head max_freq_notifiers; | ||
| 271 | }; | ||
| 272 | |||
| 273 | struct freq_qos_request { | ||
| 274 | enum freq_qos_req_type type; | ||
| 275 | struct plist_node pnode; | ||
| 276 | struct freq_constraints *qos; | ||
| 277 | }; | ||
| 278 | |||
| 279 | static inline int freq_qos_request_active(struct freq_qos_request *req) | ||
| 280 | { | ||
| 281 | return !IS_ERR_OR_NULL(req->qos); | ||
| 282 | } | ||
| 283 | |||
| 284 | void freq_constraints_init(struct freq_constraints *qos); | ||
| 285 | |||
| 286 | s32 freq_qos_read_value(struct freq_constraints *qos, | ||
| 287 | enum freq_qos_req_type type); | ||
| 288 | |||
| 289 | int freq_qos_add_request(struct freq_constraints *qos, | ||
| 290 | struct freq_qos_request *req, | ||
| 291 | enum freq_qos_req_type type, s32 value); | ||
| 292 | int freq_qos_update_request(struct freq_qos_request *req, s32 new_value); | ||
| 293 | int freq_qos_remove_request(struct freq_qos_request *req); | ||
| 294 | |||
| 295 | int freq_qos_add_notifier(struct freq_constraints *qos, | ||
| 296 | enum freq_qos_req_type type, | ||
| 297 | struct notifier_block *notifier); | ||
| 298 | int freq_qos_remove_notifier(struct freq_constraints *qos, | ||
| 299 | enum freq_qos_req_type type, | ||
| 300 | struct notifier_block *notifier); | ||
| 301 | |||
| 270 | #endif | 302 | #endif |
| @@ -223,6 +223,7 @@ extern long schedule_timeout_uninterruptible(long timeout); · 222 unmodified lines | |||
| 223 | extern long schedule_timeout_idle(long timeout); | 223 | extern long schedule_timeout_idle(long timeout); |
| 224 | asmlinkage void schedule(void); | 224 | asmlinkage void schedule(void); |
| 225 | extern void schedule_preempt_disabled(void); | 225 | extern void schedule_preempt_disabled(void); |
| 226 | asmlinkage void preempt_schedule_irq(void); | ||
| 226 | 227 | ||
| 227 | extern int __must_check io_schedule_prepare(void); | 228 | extern int __must_check io_schedule_prepare(void); |
| 228 | extern void io_schedule_finish(int token); | 229 | extern void io_schedule_finish(int token); |
| @@ -3510,8 +3510,9 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len); · 3509 unmodified lines | |||
| 3510 | int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci); | 3510 | int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci); |
| 3511 | int skb_vlan_pop(struct sk_buff *skb); | 3511 | int skb_vlan_pop(struct sk_buff *skb); |
| 3512 | int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); | 3512 | int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); |
| 3513 | int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto); | 3513 | int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, |
| 3514 | int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto); | 3514 | int mac_len); |
| 3515 | int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len); | ||
| 3515 | int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); | 3516 | int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); |
| 3516 | int skb_mpls_dec_ttl(struct sk_buff *skb); | 3517 | int skb_mpls_dec_ttl(struct sk_buff *skb); |
| 3517 | struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy, | 3518 | struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy, |
| @@ -196,9 +196,9 @@ struct bin_attribute { · 195 unmodified lines | |||
| 196 | .size = _size, \ | 196 | .size = _size, \ |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | #define __BIN_ATTR_WO(_name) { \ | 199 | #define __BIN_ATTR_WO(_name, _size) { \ |
| 200 | .attr = { .name = __stringify(_name), .mode = 0200 }, \ | 200 | .attr = { .name = __stringify(_name), .mode = 0200 }, \ |
| 201 | .store = _name##_store, \ | 201 | .write = _name##_write, \ |
| 202 | .size = _size, \ | 202 | .size = _size, \ |
| 203 | } | 203 | } |
| 204 | 204 | ||
| @@ -393,7 +393,7 @@ struct tcp_sock { · 392 unmodified lines | |||
| 393 | /* fastopen_rsk points to request_sock that resulted in this big | 393 | /* fastopen_rsk points to request_sock that resulted in this big |
| 394 | * socket. Used to retransmit SYNACKs etc. | 394 | * socket. Used to retransmit SYNACKs etc. |
| 395 | */ | 395 | */ |
| 396 | struct request_sock *fastopen_rsk; | 396 | struct request_sock __rcu *fastopen_rsk; |
| 397 | u32 *saved_syn; | 397 | u32 *saved_syn; |
| 398 | }; | 398 | }; |
| 399 | 399 | ||
| @@ -447,8 +447,8 @@ static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) · 47 unmodified lines | |||
| 447 | 447 | ||
| 448 | static inline bool tcp_passive_fastopen(const struct sock *sk) | 448 | static inline bool tcp_passive_fastopen(const struct sock *sk) |
| 449 | { | 449 | { |
| 450 | return (sk->sk_state == TCP_SYN_RECV && | 450 | return sk->sk_state == TCP_SYN_RECV && |
| 451 | tcp_sk(sk)->fastopen_rsk != NULL); | 451 | rcu_access_pointer(tcp_sk(sk)->fastopen_rsk) != NULL; |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | static inline void fastopen_queue_tune(struct sock *sk, int backlog) | 454 | static inline void fastopen_queue_tune(struct sock *sk, int backlog) |
| @@ -230,8 +230,8 @@ static inline int xa_err(void *entry) · 229 unmodified lines | |||
| 230 | * This structure is used either directly or via the XA_LIMIT() macro | 230 | * This structure is used either directly or via the XA_LIMIT() macro |
| 231 | * to communicate the range of IDs that are valid for allocation. | 231 | * to communicate the range of IDs that are valid for allocation. |
| 232 | * Two common ranges are predefined for you: | 232 | * Two common ranges are predefined for you: |
| 233 | * * xa_limit_32b - [0 - UINT_MAX] | 233 | * * xa_limit_32b - [0 - UINT_MAX] |
| 234 | * * xa_limit_31b - [0 - INT_MAX] | 234 | * * xa_limit_31b - [0 - INT_MAX] |
| 235 | */ | 235 | */ |
| 236 | struct xa_limit { | 236 | struct xa_limit { |
| 237 | u32 max; | 237 | u32 max; |
| @@ -5549,6 +5549,14 @@ const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, · 5548 unmodified lines | |||
| 5549 | */ | 5549 | */ |
| 5550 | const char *reg_initiator_name(enum nl80211_reg_initiator initiator); | 5550 | const char *reg_initiator_name(enum nl80211_reg_initiator initiator); |
| 5551 | 5551 | ||
| 5552 | /** | ||
| 5553 | * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom | ||
| 5554 | * @wiphy: wiphy for which pre-CAC capability is checked. | ||
| 5555 | * | ||
| 5556 | * Pre-CAC is allowed only in some regdomains (notable ETSI). | ||
| 5557 | */ | ||
| 5558 | bool regulatory_pre_cac_allowed(struct wiphy *wiphy); | ||
| 5559 | |||
| 5552 | /** | 5560 | /** |
| 5553 | * DOC: Internal regulatory db functions | 5561 | * DOC: Internal regulatory db functions |
| 5554 | * | 5562 | * |
| @@ -104,7 +104,7 @@ void llc_sk_reset(struct sock *sk); · 103 unmodified lines | |||
| 104 | 104 | ||
| 105 | /* Access to a connection */ | 105 | /* Access to a connection */ |
| 106 | int llc_conn_state_process(struct sock *sk, struct sk_buff *skb); | 106 | int llc_conn_state_process(struct sock *sk, struct sk_buff *skb); |
| 107 | int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb); | 107 | void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb); |
| 108 | void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb); | 108 | void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb); |
| 109 | void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit); | 109 | void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit); |
| 110 | void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit); | 110 | void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit); |
| @@ -52,6 +52,9 @@ struct bpf_prog; · 51 unmodified lines | |||
| 52 | #define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS) | 52 | #define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS) |
| 53 | 53 | ||
| 54 | struct net { | 54 | struct net { |
| 55 | /* First cache line can be often dirtied. | ||
| 56 | * Do not place here read-mostly fields. | ||
| 57 | */ | ||
| 55 | refcount_t passive; /* To decide when the network | 58 | refcount_t passive; /* To decide when the network |
| 56 | * namespace should be freed. | 59 | * namespace should be freed. |
| 57 | */ | 60 | */ |
| @@ -60,7 +63,13 @@ struct net { · 2 unmodified lines | |||
| 60 | */ | 63 | */ |
| 61 | spinlock_t rules_mod_lock; | 64 | spinlock_t rules_mod_lock; |
| 62 | 65 | ||
| 63 | u32 hash_mix; | 66 | unsigned int dev_unreg_count; |
| 67 | |||
| 68 | unsigned int dev_base_seq; /* protected by rtnl_mutex */ | ||
| 69 | int ifindex; | ||
| 70 | |||
| 71 | spinlock_t nsid_lock; | ||
| 72 | atomic_t fnhe_genid; | ||
| 64 | 73 | ||
| 65 | struct list_head list; /* list of network namespaces */ | 74 | struct list_head list; /* list of network namespaces */ |
| 66 | struct list_head exit_list; /* To linked to call pernet exit | 75 | struct list_head exit_list; /* To linked to call pernet exit |
| @@ -76,11 +85,11 @@ struct net { · 9 unmodified lines | |||
| 76 | #endif | 85 | #endif |
| 77 | struct user_namespace *user_ns; /* Owning user namespace */ | 86 | struct user_namespace *user_ns; /* Owning user namespace */ |
| 78 | struct ucounts *ucounts; | 87 | struct ucounts *ucounts; |
| 79 | spinlock_t nsid_lock; | ||
| 80 | struct idr netns_ids; | 88 | struct idr netns_ids; |
| 81 | 89 | ||
| 82 | struct ns_common ns; | 90 | struct ns_common ns; |
| 83 | 91 | ||
| 92 | struct list_head dev_base_head; | ||
| 84 | struct proc_dir_entry *proc_net; | 93 | struct proc_dir_entry *proc_net; |
| 85 | struct proc_dir_entry *proc_net_stat; | 94 | struct proc_dir_entry *proc_net_stat; |
| 86 | 95 | ||
| @@ -93,17 +102,18 @@ struct net { · 6 unmodified lines | |||
| 93 | 102 | ||
| 94 | struct uevent_sock *uevent_sock; /* uevent socket */ | 103 | struct uevent_sock *uevent_sock; /* uevent socket */ |
| 95 | 104 | ||
| 96 | struct list_head dev_base_head; | ||
| 97 | struct hlist_head *dev_name_head; | 105 | struct hlist_head *dev_name_head; |
| 98 | struct hlist_head *dev_index_head; | 106 | struct hlist_head *dev_index_head; |
| 99 | unsigned int dev_base_seq; /* protected by rtnl_mutex */ | 107 | /* Note that @hash_mix can be read millions times per second, |
| 100 | int ifindex; | 108 | * it is critical that it is on a read_mostly cache line. |
| 101 | unsigned int dev_unreg_count; | 109 | */ |
| 110 | u32 hash_mix; | ||
| 111 | |||
| 112 | struct net_device *loopback_dev; /* The loopback */ | ||
| 102 | 113 | ||
| 103 | /* core fib_rules */ | 114 | /* core fib_rules */ |
| 104 | struct list_head rules_ops; | 115 | struct list_head rules_ops; |
| 105 | 116 | ||
| 106 | struct net_device *loopback_dev; /* The loopback */ | ||
| 107 | struct netns_core core; | 117 | struct netns_core core; |
| 108 | struct netns_mib mib; | 118 | struct netns_mib mib; |
| 109 | struct netns_packet packet; | 119 | struct netns_packet packet; |
| @@ -171,7 +181,6 @@ struct net { · 61 unmodified lines | |||
| 171 | struct sock *crypto_nlsk; | 181 | struct sock *crypto_nlsk; |
| 172 | #endif | 182 | #endif |
| 173 | struct sock *diag_nlsk; | 183 | struct sock *diag_nlsk; |
| 174 | atomic_t fnhe_genid; | ||
| 175 | } __randomize_layout; | 184 | } __randomize_layout; |
| 176 | 185 | ||
| 177 | #include <linux/seq_file_net.h> | 186 | #include <linux/seq_file_net.h> |
| @@ -185,7 +185,7 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req, · 184 unmodified lines | |||
| 185 | 185 | ||
| 186 | static inline bool reqsk_queue_empty(const struct request_sock_queue *queue) | 186 | static inline bool reqsk_queue_empty(const struct request_sock_queue *queue) |
| 187 | { | 187 | { |
| 188 | return queue->rskq_accept_head == NULL; | 188 | return READ_ONCE(queue->rskq_accept_head) == NULL; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue, | 191 | static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue, |
| @@ -197,7 +197,7 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue · 5 unmodified lines | |||
| 197 | req = queue->rskq_accept_head; | 197 | req = queue->rskq_accept_head; |
| 198 | if (req) { | 198 | if (req) { |
| 199 | sk_acceptq_removed(parent); | 199 | sk_acceptq_removed(parent); |
| 200 | queue->rskq_accept_head = req->dl_next; | 200 | WRITE_ONCE(queue->rskq_accept_head, req->dl_next); |
| 201 | if (queue->rskq_accept_head == NULL) | 201 | if (queue->rskq_accept_head == NULL) |
| 202 | queue->rskq_accept_tail = NULL; | 202 | queue->rskq_accept_tail = NULL; |
| 203 | } | 203 | } |
| @@ -610,4 +610,9 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize) · 609 unmodified lines | |||
| 610 | return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize); | 610 | return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize); |
| 611 | } | 611 | } |
| 612 | 612 | ||
| 613 | static inline bool sctp_newsk_ready(const struct sock *sk) | ||
| 614 | { | ||
| 615 | return sock_flag(sk, SOCK_DEAD) || sk->sk_socket; | ||
| 616 | } | ||
| 617 | |||
| 613 | #endif /* __net_sctp_h__ */ | 618 | #endif /* __net_sctp_h__ */ |
| @@ -878,12 +878,17 @@ static inline bool sk_acceptq_is_full(const struct sock *sk) · 877 unmodified lines | |||
| 878 | */ | 878 | */ |
| 879 | static inline int sk_stream_min_wspace(const struct sock *sk) | 879 | static inline int sk_stream_min_wspace(const struct sock *sk) |
| 880 | { | 880 | { |
| 881 | return sk->sk_wmem_queued >> 1; | 881 | return READ_ONCE(sk->sk_wmem_queued) >> 1; |
| 882 | } | 882 | } |
| 883 | 883 | ||
| 884 | static inline int sk_stream_wspace(const struct sock *sk) | 884 | static inline int sk_stream_wspace(const struct sock *sk) |
| 885 | { | 885 | { |
| 886 | return sk->sk_sndbuf - sk->sk_wmem_queued; | 886 | return READ_ONCE(sk->sk_sndbuf) - READ_ONCE(sk->sk_wmem_queued); |
| 887 | } | ||
| 888 | |||
| 889 | static inline void sk_wmem_queued_add(struct sock *sk, int val) | ||
| 890 | { | ||
| 891 | WRITE_ONCE(sk->sk_wmem_queued, sk->sk_wmem_queued + val); | ||
| 887 | } | 892 | } |
| 888 | 893 | ||
| 889 | void sk_stream_write_space(struct sock *sk); | 894 | void sk_stream_write_space(struct sock *sk); |
| @@ -1207,7 +1212,7 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) · 317 unmodified lines | |||
| 1207 | 1212 | ||
| 1208 | static inline bool __sk_stream_memory_free(const struct sock *sk, int wake) | 1213 | static inline bool __sk_stream_memory_free(const struct sock *sk, int wake) |
| 1209 | { | 1214 | { |
| 1210 | if (sk->sk_wmem_queued >= sk->sk_sndbuf) | 1215 | if (READ_ONCE(sk->sk_wmem_queued) >= READ_ONCE(sk->sk_sndbuf)) |
| 1211 | return false; | 1216 | return false; |
| 1212 | 1217 | ||
| 1213 | return sk->sk_prot->stream_memory_free ? | 1218 | return sk->sk_prot->stream_memory_free ? |
| @@ -1467,7 +1472,7 @@ DECLARE_STATIC_KEY_FALSE(tcp_tx_skb_cache_key); · 253 unmodified lines | |||
| 1467 | static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) | 1472 | static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) |
| 1468 | { | 1473 | { |
| 1469 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); | 1474 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); |
| 1470 | sk->sk_wmem_queued -= skb->truesize; | 1475 | sk_wmem_queued_add(sk, -skb->truesize); |
| 1471 | sk_mem_uncharge(sk, skb->truesize); | 1476 | sk_mem_uncharge(sk, skb->truesize); |
| 1472 | if (static_branch_unlikely(&tcp_tx_skb_cache_key) && | 1477 | if (static_branch_unlikely(&tcp_tx_skb_cache_key) && |
| 1473 | !sk->sk_tx_skb_cache && !skb_cloned(skb)) { | 1478 | !sk->sk_tx_skb_cache && !skb_cloned(skb)) { |
| @@ -2014,7 +2019,7 @@ static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *fro · 540 unmodified lines | |||
| 2014 | skb->len += copy; | 2019 | skb->len += copy; |
| 2015 | skb->data_len += copy; | 2020 | skb->data_len += copy; |
| 2016 | skb->truesize += copy; | 2021 | skb->truesize += copy; |
| 2017 | sk->sk_wmem_queued += copy; | 2022 | sk_wmem_queued_add(sk, copy); |
| 2018 | sk_mem_charge(sk, copy); | 2023 | sk_mem_charge(sk, copy); |
| 2019 | return 0; | 2024 | return 0; |
| 2020 | } | 2025 | } |
| @@ -2220,10 +2225,14 @@ static inline void sk_wake_async(const struct sock *sk, int how, int band) · 199 unmodified lines | |||
| 2220 | 2225 | ||
| 2221 | static inline void sk_stream_moderate_sndbuf(struct sock *sk) | 2226 | static inline void sk_stream_moderate_sndbuf(struct sock *sk) |
| 2222 | { | 2227 | { |
| 2223 | if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) { | 2228 | u32 val; |
| 2224 | sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1); | 2229 | |
| 2225 | sk->sk_sndbuf = max_t(u32, sk->sk_sndbuf, SOCK_MIN_SNDBUF); | 2230 | if (sk->sk_userlocks & SOCK_SNDBUF_LOCK) |
| 2226 | } | 2231 | return; |
| 2232 | |||
| 2233 | val = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1); | ||
| 2234 | |||
| 2235 | WRITE_ONCE(sk->sk_sndbuf, max_t(u32, val, SOCK_MIN_SNDBUF)); | ||
| 2227 | } | 2236 | } |
| 2228 | 2237 | ||
| 2229 | struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, | 2238 | struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp, |
| @@ -2251,7 +2260,7 @@ bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag); · 21 unmodified lines | |||
| 2251 | */ | 2260 | */ |
| 2252 | static inline bool sock_writeable(const struct sock *sk) | 2261 | static inline bool sock_writeable(const struct sock *sk) |
| 2253 | { | 2262 | { |
| 2254 | return refcount_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf >> 1); | 2263 | return refcount_read(&sk->sk_wmem_alloc) < (READ_ONCE(sk->sk_sndbuf) >> 1); |
| 2255 | } | 2264 | } |
| 2256 | 2265 | ||
| 2257 | static inline gfp_t gfp_any(void) | 2266 | static inline gfp_t gfp_any(void) |
| @@ -2271,7 +2280,9 @@ static inline long sock_sndtimeo(const struct sock *sk, bool noblock) · 13 unmodified lines | |||
| 2271 | 2280 | ||
| 2272 | static inline int sock_rcvlowat(const struct sock *sk, int waitall, int len) | 2281 | static inline int sock_rcvlowat(const struct sock *sk, int waitall, int len) |
| 2273 | { | 2282 | { |
| 2274 | return (waitall ? len : min_t(int, sk->sk_rcvlowat, len)) ? : 1; | 2283 | int v = waitall ? len : min_t(int, READ_ONCE(sk->sk_rcvlowat), len); |
| 2284 | |||
| 2285 | return v ?: 1; | ||
| 2275 | } | 2286 | } |
| 2276 | 2287 | ||
| 2277 | /* Alas, with timeout socket operations are not restartable. | 2288 | /* Alas, with timeout socket operations are not restartable. |
| @@ -258,7 +258,7 @@ static inline bool tcp_under_memory_pressure(const struct sock *sk) · 257 unmodified lines | |||
| 258 | mem_cgroup_under_socket_pressure(sk->sk_memcg)) | 258 | mem_cgroup_under_socket_pressure(sk->sk_memcg)) |
| 259 | return true; | 259 | return true; |
| 260 | 260 | ||
| 261 | return tcp_memory_pressure; | 261 | return READ_ONCE(tcp_memory_pressure); |
| 262 | } | 262 | } |
| 263 | /* | 263 | /* |
| 264 | * The next routines deal with comparing 32 bit unsigned ints | 264 | * The next routines deal with comparing 32 bit unsigned ints |
| @@ -1380,13 +1380,14 @@ static inline int tcp_win_from_space(const struct sock *sk, int space) · 1115 unmodified lines | |||
| 1380 | /* Note: caller must be prepared to deal with negative returns */ | 1380 | /* Note: caller must be prepared to deal with negative returns */ |
| 1381 | static inline int tcp_space(const struct sock *sk) | 1381 | static inline int tcp_space(const struct sock *sk) |
| 1382 | { | 1382 | { |
| 1383 | return tcp_win_from_space(sk, sk->sk_rcvbuf - sk->sk_backlog.len - | 1383 | return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) - |
| 1384 | READ_ONCE(sk->sk_backlog.len) - | ||
| 1384 | atomic_read(&sk->sk_rmem_alloc)); | 1385 | atomic_read(&sk->sk_rmem_alloc)); |
| 1385 | } | 1386 | } |
| 1386 | 1387 | ||
| 1387 | static inline int tcp_full_space(const struct sock *sk) | 1388 | static inline int tcp_full_space(const struct sock *sk) |
| 1388 | { | 1389 | { |
| 1389 | return tcp_win_from_space(sk, sk->sk_rcvbuf); | 1390 | return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf)); |
| 1390 | } | 1391 | } |
| 1391 | 1392 | ||
| 1392 | extern void tcp_openreq_init_rwin(struct request_sock *req, | 1393 | extern void tcp_openreq_init_rwin(struct request_sock *req, |
| @@ -1916,7 +1917,8 @@ static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) · 523 unmodified lines | |||
| 1916 | static inline bool tcp_stream_memory_free(const struct sock *sk, int wake) | 1917 | static inline bool tcp_stream_memory_free(const struct sock *sk, int wake) |
| 1917 | { | 1918 | { |
| 1918 | const struct tcp_sock *tp = tcp_sk(sk); | 1919 | const struct tcp_sock *tp = tcp_sk(sk); |
| 1919 | u32 notsent_bytes = tp->write_seq - tp->snd_nxt; | 1920 | u32 notsent_bytes = READ_ONCE(tp->write_seq) - |
| 1921 | READ_ONCE(tp->snd_nxt); | ||
| 1920 | 1922 | ||
| 1921 | return (notsent_bytes << wake) < tcp_notsent_lowat(tp); | 1923 | return (notsent_bytes << wake) < tcp_notsent_lowat(tp); |
| 1922 | } | 1924 | } |
| @@ -32,6 +32,7 @@ extern int scsi_ioctl_reset(struct scsi_device *, int __user *); · 31 unmodified lines | |||
| 32 | struct scsi_eh_save { | 32 | struct scsi_eh_save { |
| 33 | /* saved state */ | 33 | /* saved state */ |
| 34 | int result; | 34 | int result; |
| 35 | unsigned int resid_len; | ||
| 35 | int eh_eflags; | 36 | int eh_eflags; |
| 36 | enum dma_data_direction data_direction; | 37 | enum dma_data_direction data_direction; |
| 37 | unsigned underflow; | 38 | unsigned underflow; |
| @@ -264,6 +264,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; · 263 unmodified lines | |||
| 264 | #define AZX_REG_ML_LOUTPAY 0x20 | 264 | #define AZX_REG_ML_LOUTPAY 0x20 |
| 265 | #define AZX_REG_ML_LINPAY 0x30 | 265 | #define AZX_REG_ML_LINPAY 0x30 |
| 266 | 266 | ||
| 267 | /* bit0 is reserved, with BIT(1) mapping to stream1 */ | ||
| 268 | #define ML_LOSIDV_STREAM_MASK 0xFFFE | ||
| 269 | |||
| 267 | #define ML_LCTL_SCF_MASK 0xF | 270 | #define ML_LCTL_SCF_MASK 0xF |
| 268 | #define AZX_MLCTL_SPA (0x1 << 16) | 271 | #define AZX_MLCTL_SPA (0x1 << 16) |
| 269 | #define AZX_MLCTL_CPA (0x1 << 23) | 272 | #define AZX_MLCTL_CPA (0x1 << 23) |
| @@ -135,9 +135,9 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv, · 134 unmodified lines | |||
| 135 | struct link_info *li); | 135 | struct link_info *li); |
| 136 | 136 | ||
| 137 | #ifdef DEBUG | 137 | #ifdef DEBUG |
| 138 | inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv, | 138 | static inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv, |
| 139 | char *name, | 139 | char *name, |
| 140 | struct asoc_simple_dai *dai) | 140 | struct asoc_simple_dai *dai) |
| 141 | { | 141 | { |
| 142 | struct device *dev = simple_priv_to_dev(priv); | 142 | struct device *dev = simple_priv_to_dev(priv); |
| 143 | 143 | ||
| @@ -167,7 +167,7 @@ inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv, · 23 unmodified lines | |||
| 167 | dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk)); | 167 | dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk)); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | inline void asoc_simple_debug_info(struct asoc_simple_priv *priv) | 170 | static inline void asoc_simple_debug_info(struct asoc_simple_priv *priv) |
| 171 | { | 171 | { |
| 172 | struct snd_soc_card *card = simple_priv_to_card(priv); | 172 | struct snd_soc_card *card = simple_priv_to_card(priv); |
| 173 | struct device *dev = simple_priv_to_dev(priv); | 173 | struct device *dev = simple_priv_to_dev(priv); |
| @@ -1688,6 +1688,7 @@ TRACE_EVENT(qgroup_update_reserve, · 1687 unmodified lines | |||
| 1688 | __entry->qgid = qgroup->qgroupid; | 1688 | __entry->qgid = qgroup->qgroupid; |
| 1689 | __entry->cur_reserved = qgroup->rsv.values[type]; | 1689 | __entry->cur_reserved = qgroup->rsv.values[type]; |
| 1690 | __entry->diff = diff; | 1690 | __entry->diff = diff; |
| 1691 | __entry->type = type; | ||
| 1691 | ), | 1692 | ), |
| 1692 | 1693 | ||
| 1693 | TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", | 1694 | TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", |
| @@ -1710,6 +1711,7 @@ TRACE_EVENT(qgroup_meta_reserve, · 16 unmodified lines | |||
| 1710 | TP_fast_assign_btrfs(root->fs_info, | 1711 | TP_fast_assign_btrfs(root->fs_info, |
| 1711 | __entry->refroot = root->root_key.objectid; | 1712 | __entry->refroot = root->root_key.objectid; |
| 1712 | __entry->diff = diff; | 1713 | __entry->diff = diff; |
| 1714 | __entry->type = type; | ||
| 1713 | ), | 1715 | ), |
| 1714 | 1716 | ||
| 1715 | TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", | 1717 | TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", |
| @@ -1726,7 +1728,6 @@ TRACE_EVENT(qgroup_meta_convert, · 10 unmodified lines | |||
| 1726 | TP_STRUCT__entry_btrfs( | 1728 | TP_STRUCT__entry_btrfs( |
| 1727 | __field( u64, refroot ) | 1729 | __field( u64, refroot ) |
| 1728 | __field( s64, diff ) | 1730 | __field( s64, diff ) |
| 1729 | __field( int, type ) | ||
| 1730 | ), | 1731 | ), |
| 1731 | 1732 | ||
| 1732 | TP_fast_assign_btrfs(root->fs_info, | 1733 | TP_fast_assign_btrfs(root->fs_info, |
| @@ -519,10 +519,10 @@ TRACE_EVENT(rxrpc_local, · 518 unmodified lines | |||
| 519 | ); | 519 | ); |
| 520 | 520 | ||
| 521 | TRACE_EVENT(rxrpc_peer, | 521 | TRACE_EVENT(rxrpc_peer, |
| 522 | TP_PROTO(struct rxrpc_peer *peer, enum rxrpc_peer_trace op, | 522 | TP_PROTO(unsigned int peer_debug_id, enum rxrpc_peer_trace op, |
| 523 | int usage, const void *where), | 523 | int usage, const void *where), |
| 524 | 524 | ||
| 525 | TP_ARGS(peer, op, usage, where), | 525 | TP_ARGS(peer_debug_id, op, usage, where), |
| 526 | 526 | ||
| 527 | TP_STRUCT__entry( | 527 | TP_STRUCT__entry( |
| 528 | __field(unsigned int, peer ) | 528 | __field(unsigned int, peer ) |
| @@ -532,7 +532,7 @@ TRACE_EVENT(rxrpc_peer, · 3 unmodified lines | |||
| 532 | ), | 532 | ), |
| 533 | 533 | ||
| 534 | TP_fast_assign( | 534 | TP_fast_assign( |
| 535 | __entry->peer = peer->debug_id; | 535 | __entry->peer = peer_debug_id; |
| 536 | __entry->op = op; | 536 | __entry->op = op; |
| 537 | __entry->usage = usage; | 537 | __entry->usage = usage; |
| 538 | __entry->where = where; | 538 | __entry->where = where; |
| @@ -546,10 +546,10 @@ TRACE_EVENT(rxrpc_peer, · 7 unmodified lines | |||
| 546 | ); | 546 | ); |
| 547 | 547 | ||
| 548 | TRACE_EVENT(rxrpc_conn, | 548 | TRACE_EVENT(rxrpc_conn, |
| 549 | TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op, | 549 | TP_PROTO(unsigned int conn_debug_id, enum rxrpc_conn_trace op, |
| 550 | int usage, const void *where), | 550 | int usage, const void *where), |
| 551 | 551 | ||
| 552 | TP_ARGS(conn, op, usage, where), | 552 | TP_ARGS(conn_debug_id, op, usage, where), |
| 553 | 553 | ||
| 554 | TP_STRUCT__entry( | 554 | TP_STRUCT__entry( |
| 555 | __field(unsigned int, conn ) | 555 | __field(unsigned int, conn ) |
| @@ -559,7 +559,7 @@ TRACE_EVENT(rxrpc_conn, · 3 unmodified lines | |||
| 559 | ), | 559 | ), |
| 560 | 560 | ||
| 561 | TP_fast_assign( | 561 | TP_fast_assign( |
| 562 | __entry->conn = conn->debug_id; | 562 | __entry->conn = conn_debug_id; |
| 563 | __entry->op = op; | 563 | __entry->op = op; |
| 564 | __entry->usage = usage; | 564 | __entry->usage = usage; |
| 565 | __entry->where = where; | 565 | __entry->where = where; |
| @@ -606,10 +606,10 @@ TRACE_EVENT(rxrpc_client, · 40 unmodified lines | |||
| 606 | ); | 606 | ); |
| 607 | 607 | ||
| 608 | TRACE_EVENT(rxrpc_call, | 608 | TRACE_EVENT(rxrpc_call, |
| 609 | TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op, | 609 | TP_PROTO(unsigned int call_debug_id, enum rxrpc_call_trace op, |
| 610 | int usage, const void *where, const void *aux), | 610 | int usage, const void *where, const void *aux), |
| 611 | 611 | ||
| 612 | TP_ARGS(call, op, usage, where, aux), | 612 | TP_ARGS(call_debug_id, op, usage, where, aux), |
| 613 | 613 | ||
| 614 | TP_STRUCT__entry( | 614 | TP_STRUCT__entry( |
| 615 | __field(unsigned int, call ) | 615 | __field(unsigned int, call ) |
| @@ -620,7 +620,7 @@ TRACE_EVENT(rxrpc_call, · 4 unmodified lines | |||
| 620 | ), | 620 | ), |
| 621 | 621 | ||
| 622 | TP_fast_assign( | 622 | TP_fast_assign( |
| 623 | __entry->call = call->debug_id; | 623 | __entry->call = call_debug_id; |
| 624 | __entry->op = op; | 624 | __entry->op = op; |
| 625 | __entry->usage = usage; | 625 | __entry->usage = usage; |
| 626 | __entry->where = where; | 626 | __entry->where = where; |
| @@ -82,7 +82,7 @@ TRACE_EVENT(sock_rcvqueue_full, · 81 unmodified lines | |||
| 82 | TP_fast_assign( | 82 | TP_fast_assign( |
| 83 | __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc); | 83 | __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc); |
| 84 | __entry->truesize = skb->truesize; | 84 | __entry->truesize = skb->truesize; |
| 85 | __entry->sk_rcvbuf = sk->sk_rcvbuf; | 85 | __entry->sk_rcvbuf = READ_ONCE(sk->sk_rcvbuf); |
| 86 | ), | 86 | ), |
| 87 | 87 | ||
| 88 | TP_printk("rmem_alloc=%d truesize=%u sk_rcvbuf=%d", | 88 | TP_printk("rmem_alloc=%d truesize=%u sk_rcvbuf=%d", |
| @@ -115,7 +115,7 @@ TRACE_EVENT(sock_exceed_buf_limit, · 26 unmodified lines | |||
| 115 | __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc); | 115 | __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc); |
| 116 | __entry->sysctl_wmem = sk_get_wmem0(sk, prot); | 116 | __entry->sysctl_wmem = sk_get_wmem0(sk, prot); |
| 117 | __entry->wmem_alloc = refcount_read(&sk->sk_wmem_alloc); | 117 | __entry->wmem_alloc = refcount_read(&sk->sk_wmem_alloc); |
| 118 | __entry->wmem_queued = sk->sk_wmem_queued; | 118 | __entry->wmem_queued = READ_ONCE(sk->sk_wmem_queued); |
| 119 | __entry->kind = kind; | 119 | __entry->kind = kind; |
| 120 | ), | 120 | ), |
| 121 | 121 | ||
| @@ -6965,7 +6965,7 @@ static void __perf_event_output_stop(struct perf_event *event, void *data) · 6964 unmodified lines | |||
| 6965 | static int __perf_pmu_output_stop(void *info) | 6965 | static int __perf_pmu_output_stop(void *info) |
| 6966 | { | 6966 | { |
| 6967 | struct perf_event *event = info; | 6967 | struct perf_event *event = info; |
| 6968 | struct pmu *pmu = event->pmu; | 6968 | struct pmu *pmu = event->ctx->pmu; |
| 6969 | struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); | 6969 | struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); |
| 6970 | struct remote_output ro = { | 6970 | struct remote_output ro = { |
| 6971 | .rb = event->rb, | 6971 | .rb = event->rb, |
| @@ -10660,7 +10660,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr, · 3688 unmodified lines | |||
| 10660 | 10660 | ||
| 10661 | attr->size = size; | 10661 | attr->size = size; |
| 10662 | 10662 | ||
| 10663 | if (attr->__reserved_1) | 10663 | if (attr->__reserved_1 || attr->__reserved_2) |
| 10664 | return -EINVAL; | 10664 | return -EINVAL; |
| 10665 | 10665 | ||
| 10666 | if (attr->sample_type & ~(PERF_SAMPLE_MAX-1)) | 10666 | if (attr->sample_type & ~(PERF_SAMPLE_MAX-1)) |
| @@ -474,14 +474,17 @@ int uprobe_write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm, · 473 unmodified lines | |||
| 474 | struct vm_area_struct *vma; | 474 | struct vm_area_struct *vma; |
| 475 | int ret, is_register, ref_ctr_updated = 0; | 475 | int ret, is_register, ref_ctr_updated = 0; |
| 476 | bool orig_page_huge = false; | 476 | bool orig_page_huge = false; |
| 477 | unsigned int gup_flags = FOLL_FORCE; | ||
| 477 | 478 | ||
| 478 | is_register = is_swbp_insn(&opcode); | 479 | is_register = is_swbp_insn(&opcode); |
| 479 | uprobe = container_of(auprobe, struct uprobe, arch); | 480 | uprobe = container_of(auprobe, struct uprobe, arch); |
| 480 | 481 | ||
| 481 | retry: | 482 | retry: |
| 483 | if (is_register) | ||
| 484 | gup_flags |= FOLL_SPLIT_PMD; | ||
| 482 | /* Read the page with vaddr into memory */ | 485 | /* Read the page with vaddr into memory */ |
| 483 | ret = get_user_pages_remote(NULL, mm, vaddr, 1, | 486 | ret = get_user_pages_remote(NULL, mm, vaddr, 1, gup_flags, |
| 484 | FOLL_FORCE | FOLL_SPLIT_PMD, &old_page, &vma, NULL); | 487 | &old_page, &vma, NULL); |
| 485 | if (ret <= 0) | 488 | if (ret <= 0) |
| 486 | return ret; | 489 | return ret; |
| 487 | 490 | ||
| @@ -489,6 +492,12 @@ retry: · 1 unmodified line | |||
| 489 | if (ret <= 0) | 492 | if (ret <= 0) |
| 490 | goto put_old; | 493 | goto put_old; |
| 491 | 494 | ||
| 495 | if (WARN(!is_register && PageCompound(old_page), | ||
| 496 | "uprobe unregister should never work on compound page\n")) { | ||
| 497 | ret = -EINVAL; | ||
| 498 | goto put_old; | ||
| 499 | } | ||
| 500 | |||
| 492 | /* We are going to replace instruction, update ref_ctr. */ | 501 | /* We are going to replace instruction, update ref_ctr. */ |
| 493 | if (!ref_ctr_updated && uprobe->ref_ctr_offset) { | 502 | if (!ref_ctr_updated && uprobe->ref_ctr_offset) { |
| 494 | ret = update_ref_ctr(uprobe, mm, is_register ? 1 : -1); | 503 | ret = update_ref_ctr(uprobe, mm, is_register ? 1 : -1); |
| @@ -71,10 +71,13 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1 · 70 unmodified lines | |||
| 71 | find $cpio_dir -type f -print0 | | 71 | find $cpio_dir -type f -print0 | |
| 72 | xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;' | 72 | xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;' |
| 73 | 73 | ||
| 74 | # Create archive and try to normalize metadata for reproducibility | 74 | # Create archive and try to normalize metadata for reproducibility. |
| 75 | tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ | 75 | # For compatibility with older versions of tar, files are fed to tar |
| 76 | --owner=0 --group=0 --sort=name --numeric-owner \ | 76 | # pre-sorted, as --sort=name might not be available. |
| 77 | -Jcf $tarfile -C $cpio_dir/ . > /dev/null | 77 | find $cpio_dir -printf "./%P\n" | LC_ALL=C sort | \ |
| 78 | tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ | ||
| 79 | --owner=0 --group=0 --numeric-owner --no-recursion \ | ||
| 80 | -Jcf $tarfile -C $cpio_dir/ -T - > /dev/null | ||
| 78 | 81 | ||
| 79 | echo "$src_files_md5" > kernel/kheaders.md5 | 82 | echo "$src_files_md5" > kernel/kheaders.md5 |
| 80 | echo "$obj_files_md5" >> kernel/kheaders.md5 | 83 | echo "$obj_files_md5" >> kernel/kheaders.md5 |
| @@ -866,9 +866,9 @@ void kthread_delayed_work_timer_fn(struct timer_list *t) · 865 unmodified lines | |||
| 866 | } | 866 | } |
| 867 | EXPORT_SYMBOL(kthread_delayed_work_timer_fn); | 867 | EXPORT_SYMBOL(kthread_delayed_work_timer_fn); |
| 868 | 868 | ||
| 869 | void __kthread_queue_delayed_work(struct kthread_worker *worker, | 869 | static void __kthread_queue_delayed_work(struct kthread_worker *worker, |
| 870 | struct kthread_delayed_work *dwork, | 870 | struct kthread_delayed_work *dwork, |
| 871 | unsigned long delay) | 871 | unsigned long delay) |
| 872 | { | 872 | { |
| 873 | struct timer_list *timer = &dwork->timer; | 873 | struct timer_list *timer = &dwork->timer; |
| 874 | struct kthread_work *work = &dwork->work; | 874 | struct kthread_work *work = &dwork->work; |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
| 16 | #include <linux/suspend.h> | 16 | #include <linux/suspend.h> |
| 17 | #include <linux/syscalls.h> | 17 | #include <linux/syscalls.h> |
| 18 | #include <linux/pm_runtime.h> | ||
| 18 | 19 | ||
| 19 | #include "power.h" | 20 | #include "power.h" |
| 20 | 21 | ||
| @@ -650,3 +650,243 @@ static int __init pm_qos_power_init(void) · 649 unmodified lines | |||
| 650 | } | 650 | } |
| 651 | 651 | ||
| 652 | late_initcall(pm_qos_power_init); | 652 | late_initcall(pm_qos_power_init); |
| 653 | |||
| 654 | /* Definitions related to the frequency QoS below. */ | ||
| 655 | |||
| 656 | /** | ||
| 657 | * freq_constraints_init - Initialize frequency QoS constraints. | ||
| 658 | * @qos: Frequency QoS constraints to initialize. | ||
| 659 | */ | ||
| 660 | void freq_constraints_init(struct freq_constraints *qos) | ||
| 661 | { | ||
| 662 | struct pm_qos_constraints *c; | ||
| 663 | |||
| 664 | c = &qos->min_freq; | ||
| 665 | plist_head_init(&c->list); | ||
| 666 | c->target_value = FREQ_QOS_MIN_DEFAULT_VALUE; | ||
| 667 | c->default_value = FREQ_QOS_MIN_DEFAULT_VALUE; | ||
| 668 | c->no_constraint_value = FREQ_QOS_MIN_DEFAULT_VALUE; | ||
| 669 | c->type = PM_QOS_MAX; | ||
| 670 | c->notifiers = &qos->min_freq_notifiers; | ||
| 671 | BLOCKING_INIT_NOTIFIER_HEAD(c->notifiers); | ||
| 672 | |||
| 673 | c = &qos->max_freq; | ||
| 674 | plist_head_init(&c->list); | ||
| 675 | c->target_value = FREQ_QOS_MAX_DEFAULT_VALUE; | ||
| 676 | c->default_value = FREQ_QOS_MAX_DEFAULT_VALUE; | ||
| 677 | c->no_constraint_value = FREQ_QOS_MAX_DEFAULT_VALUE; | ||
| 678 | c->type = PM_QOS_MIN; | ||
| 679 | c->notifiers = &qos->max_freq_notifiers; | ||
| 680 | BLOCKING_INIT_NOTIFIER_HEAD(c->notifiers); | ||
| 681 | } | ||
| 682 | |||
| 683 | /** | ||
| 684 | * freq_qos_read_value - Get frequency QoS constraint for a given list. | ||
| 685 | * @qos: Constraints to evaluate. | ||
| 686 | * @type: QoS request type. | ||
| 687 | */ | ||
| 688 | s32 freq_qos_read_value(struct freq_constraints *qos, | ||
| 689 | enum freq_qos_req_type type) | ||
| 690 | { | ||
| 691 | s32 ret; | ||
| 692 | |||
| 693 | switch (type) { | ||
| 694 | case FREQ_QOS_MIN: | ||
| 695 | ret = IS_ERR_OR_NULL(qos) ? | ||
| 696 | FREQ_QOS_MIN_DEFAULT_VALUE : | ||
| 697 | pm_qos_read_value(&qos->min_freq); | ||
| 698 | break; | ||
| 699 | case FREQ_QOS_MAX: | ||
| 700 | ret = IS_ERR_OR_NULL(qos) ? | ||
| 701 | FREQ_QOS_MAX_DEFAULT_VALUE : | ||
| 702 | pm_qos_read_value(&qos->max_freq); | ||
| 703 | break; | ||
| 704 | default: | ||
| 705 | WARN_ON(1); | ||
| 706 | ret = 0; | ||
| 707 | } | ||
| 708 | |||
| 709 | return ret; | ||
| 710 | } | ||
| 711 | |||
| 712 | /** | ||
| 713 | * freq_qos_apply - Add/modify/remove frequency QoS request. | ||
| 714 | * @req: Constraint request to apply. | ||
| 715 | * @action: Action to perform (add/update/remove). | ||
| 716 | * @value: Value to assign to the QoS request. | ||
| 717 | */ | ||
| 718 | static int freq_qos_apply(struct freq_qos_request *req, | ||
| 719 | enum pm_qos_req_action action, s32 value) | ||
| 720 | { | ||
| 721 | int ret; | ||
| 722 | |||
| 723 | switch(req->type) { | ||
| 724 | case FREQ_QOS_MIN: | ||
| 725 | ret = pm_qos_update_target(&req->qos->min_freq, &req->pnode, | ||
| 726 | action, value); | ||
| 727 | break; | ||
| 728 | case FREQ_QOS_MAX: | ||
| 729 | ret = pm_qos_update_target(&req->qos->max_freq, &req->pnode, | ||
| 730 | action, value); | ||
| 731 | break; | ||
| 732 | default: | ||
| 733 | ret = -EINVAL; | ||
| 734 | } | ||
| 735 | |||
| 736 | return ret; | ||
| 737 | } | ||
| 738 | |||
| 739 | /** | ||
| 740 | * freq_qos_add_request - Insert new frequency QoS request into a given list. | ||
| 741 | * @qos: Constraints to update. | ||
| 742 | * @req: Preallocated request object. | ||
| 743 | * @type: Request type. | ||
| 744 | * @value: Request value. | ||
| 745 | * | ||
| 746 | * Insert a new entry into the @qos list of requests, recompute the effective | ||
| 747 | * QoS constraint value for that list and initialize the @req object. The | ||
| 748 | * caller needs to save that object for later use in updates and removal. | ||
| 749 | * | ||
| 750 | * Return 1 if the effective constraint value has changed, 0 if the effective | ||
| 751 | * constraint value has not changed, or a negative error code on failures. | ||
| 752 | */ | ||
| 753 | int freq_qos_add_request(struct freq_constraints *qos, | ||
| 754 | struct freq_qos_request *req, | ||
| 755 | enum freq_qos_req_type type, s32 value) | ||
| 756 | { | ||
| 757 | int ret; | ||
| 758 | |||
| 759 | if (IS_ERR_OR_NULL(qos) || !req) | ||
| 760 | return -EINVAL; | ||
| 761 | |||
| 762 | if (WARN(freq_qos_request_active(req), | ||
| 763 | "%s() called for active request\n", __func__)) | ||
| 764 | return -EINVAL; | ||
| 765 | |||
| 766 | req->qos = qos; | ||
| 767 | req->type = type; | ||
| 768 | ret = freq_qos_apply(req, PM_QOS_ADD_REQ, value); | ||
| 769 | if (ret < 0) { | ||
| 770 | req->qos = NULL; | ||
| 771 | req->type = 0; | ||
| 772 | } | ||
| 773 | |||
| 774 | return ret; | ||
| 775 | } | ||
| 776 | EXPORT_SYMBOL_GPL(freq_qos_add_request); | ||
| 777 | |||
| 778 | /** | ||
| 779 | * freq_qos_update_request - Modify existing frequency QoS request. | ||
| 780 | * @req: Request to modify. | ||
| 781 | * @new_value: New request value. | ||
| 782 | * | ||
| 783 | * Update an existing frequency QoS request along with the effective constraint | ||
| 784 | * value for the list of requests it belongs to. | ||
| 785 | * | ||
| 786 | * Return 1 if the effective constraint value has changed, 0 if the effective | ||
| 787 | * constraint value has not changed, or a negative error code on failures. | ||
| 788 | */ | ||
| 789 | int freq_qos_update_request(struct freq_qos_request *req, s32 new_value) | ||
| 790 | { | ||
| 791 | if (!req) | ||
| 792 | return -EINVAL; | ||
| 793 | |||
| 794 | if (WARN(!freq_qos_request_active(req), | ||
| 795 | "%s() called for unknown object\n", __func__)) | ||
| 796 | return -EINVAL; | ||
| 797 | |||
| 798 | if (req->pnode.prio == new_value) | ||
| 799 | return 0; | ||
| 800 | |||
| 801 | return freq_qos_apply(req, PM_QOS_UPDATE_REQ, new_value); | ||
| 802 | } | ||
| 803 | EXPORT_SYMBOL_GPL(freq_qos_update_request); | ||
| 804 | |||
| 805 | /** | ||
| 806 | * freq_qos_remove_request - Remove frequency QoS request from its list. | ||
| 807 | * @req: Request to remove. | ||
| 808 | * | ||
| 809 | * Remove the given frequency QoS request from the list of constraints it | ||
| 810 | * belongs to and recompute the effective constraint value for that list. | ||
| 811 | * | ||
| 812 | * Return 1 if the effective constraint value has changed, 0 if the effective | ||
| 813 | * constraint value has not changed, or a negative error code on failures. | ||
| 814 | */ | ||
| 815 | int freq_qos_remove_request(struct freq_qos_request *req) | ||
| 816 | { | ||
| 817 | if (!req) | ||
| 818 | return -EINVAL; | ||
| 819 | |||
| 820 | if (WARN(!freq_qos_request_active(req), | ||
| 821 | "%s() called for unknown object\n", __func__)) | ||
| 822 | return -EINVAL; | ||
| 823 | |||
| 824 | return freq_qos_apply(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); | ||
| 825 | } | ||
| 826 | EXPORT_SYMBOL_GPL(freq_qos_remove_request); | ||
| 827 | |||
| 828 | /** | ||
| 829 | * freq_qos_add_notifier - Add frequency QoS change notifier. | ||
| 830 | * @qos: List of requests to add the notifier to. | ||
| 831 | * @type: Request type. | ||
| 832 | * @notifier: Notifier block to add. | ||
| 833 | */ | ||
| 834 | int freq_qos_add_notifier(struct freq_constraints *qos, | ||
| 835 | enum freq_qos_req_type type, | ||
| 836 | struct notifier_block *notifier) | ||
| 837 | { | ||
| 838 | int ret; | ||
| 839 | |||
| 840 | if (IS_ERR_OR_NULL(qos) || !notifier) | ||
| 841 | return -EINVAL; | ||
| 842 | |||
| 843 | switch (type) { | ||
| 844 | case FREQ_QOS_MIN: | ||
| 845 | ret = blocking_notifier_chain_register(qos->min_freq.notifiers, | ||
| 846 | notifier); | ||
| 847 | break; | ||
| 848 | case FREQ_QOS_MAX: | ||
| 849 | ret = blocking_notifier_chain_register(qos->max_freq.notifiers, | ||
| 850 | notifier); | ||
| 851 | break; | ||
| 852 | default: | ||
| 853 | WARN_ON(1); | ||
| 854 | ret = -EINVAL; | ||
| 855 | } | ||
| 856 | |||
| 857 | return ret; | ||
| 858 | } | ||
| 859 | EXPORT_SYMBOL_GPL(freq_qos_add_notifier); | ||
| 860 | |||
| 861 | /** | ||
| 862 | * freq_qos_remove_notifier - Remove frequency QoS change notifier. | ||
| 863 | * @qos: List of requests to remove the notifier from. | ||
| 864 | * @type: Request type. | ||
| 865 | * @notifier: Notifier block to remove. | ||
| 866 | */ | ||
| 867 | int freq_qos_remove_notifier(struct freq_constraints *qos, | ||
| 868 | enum freq_qos_req_type type, | ||
| 869 | struct notifier_block *notifier) | ||
| 870 | { | ||
| 871 | int ret; | ||
| 872 | |||
| 873 | if (IS_ERR_OR_NULL(qos) || !notifier) | ||
| 874 | return -EINVAL; | ||
| 875 | |||
| 876 | switch (type) { | ||
| 877 | case FREQ_QOS_MIN: | ||
| 878 | ret = blocking_notifier_chain_unregister(qos->min_freq.notifiers, | ||
| 879 | notifier); | ||
| 880 | break; | ||
| 881 | case FREQ_QOS_MAX: | ||
| 882 | ret = blocking_notifier_chain_unregister(qos->max_freq.notifiers, | ||
| 883 | notifier); | ||
| 884 | break; | ||
| 885 | default: | ||
| 886 | WARN_ON(1); | ||
| 887 | ret = -EINVAL; | ||
| 888 | } | ||
| 889 | |||
| 890 | return ret; | ||
| 891 | } | ||
| 892 | EXPORT_SYMBOL_GPL(freq_qos_remove_notifier); | ||
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | * Copyright (C) 2010 SUSE Linux Products GmbH | 7 | * Copyright (C) 2010 SUSE Linux Products GmbH |
| 8 | * Copyright (C) 2010 Tejun Heo <tj@kernel.org> | 8 | * Copyright (C) 2010 Tejun Heo <tj@kernel.org> |
| 9 | */ | 9 | */ |
| 10 | #include <linux/compiler.h> | ||
| 10 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
| 11 | #include <linux/cpu.h> | 12 | #include <linux/cpu.h> |
| 12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| @@ -167,7 +168,7 @@ static void set_state(struct multi_stop_data *msdata, · 154 unmodified lines | |||
| 167 | /* Reset ack counter. */ | 168 | /* Reset ack counter. */ |
| 168 | atomic_set(&msdata->thread_ack, msdata->num_threads); | 169 | atomic_set(&msdata->thread_ack, msdata->num_threads); |
| 169 | smp_wmb(); | 170 | smp_wmb(); |
| 170 | msdata->state = newstate; | 171 | WRITE_ONCE(msdata->state, newstate); |
| 171 | } | 172 | } |
| 172 | 173 | ||
| 173 | /* Last one to ack a state moves to the next state. */ | 174 | /* Last one to ack a state moves to the next state. */ |
| @@ -186,7 +187,7 @@ void __weak stop_machine_yield(const struct cpumask *cpumask) · 12 unmodified lines | |||
| 186 | static int multi_cpu_stop(void *data) | 187 | static int multi_cpu_stop(void *data) |
| 187 | { | 188 | { |
| 188 | struct multi_stop_data *msdata = data; | 189 | struct multi_stop_data *msdata = data; |
| 189 | enum multi_stop_state curstate = MULTI_STOP_NONE; | 190 | enum multi_stop_state newstate, curstate = MULTI_STOP_NONE; |
| 190 | int cpu = smp_processor_id(), err = 0; | 191 | int cpu = smp_processor_id(), err = 0; |
| 191 | const struct cpumask *cpumask; | 192 | const struct cpumask *cpumask; |
| 192 | unsigned long flags; | 193 | unsigned long flags; |
| @@ -210,8 +211,9 @@ static int multi_cpu_stop(void *data) · 17 unmodified lines | |||
| 210 | do { | 211 | do { |
| 211 | /* Chill out and ensure we re-read multi_stop_state. */ | 212 | /* Chill out and ensure we re-read multi_stop_state. */ |
| 212 | stop_machine_yield(cpumask); | 213 | stop_machine_yield(cpumask); |
| 213 | if (msdata->state != curstate) { | 214 | newstate = READ_ONCE(msdata->state); |
| 214 | curstate = msdata->state; | 215 | if (newstate != curstate) { |
| 216 | curstate = newstate; | ||
| 215 | switch (curstate) { | 217 | switch (curstate) { |
| 216 | case MULTI_STOP_DISABLE_IRQ: | 218 | case MULTI_STOP_DISABLE_IRQ: |
| 217 | local_irq_disable(); | 219 | local_irq_disable(); |
| @@ -163,7 +163,7 @@ static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); · 162 unmodified lines | |||
| 163 | #ifdef CONFIG_SPARC | 163 | #ifdef CONFIG_SPARC |
| 164 | #endif | 164 | #endif |
| 165 | 165 | ||
| 166 | #ifdef __hppa__ | 166 | #ifdef CONFIG_PARISC |
| 167 | extern int pwrsw_enabled; | 167 | extern int pwrsw_enabled; |
| 168 | #endif | 168 | #endif |
| 169 | 169 | ||
| @@ -620,7 +620,7 @@ static struct ctl_table kern_table[] = { · 450 unmodified lines | |||
| 620 | .proc_handler = proc_dointvec, | 620 | .proc_handler = proc_dointvec, |
| 621 | }, | 621 | }, |
| 622 | #endif | 622 | #endif |
| 623 | #ifdef __hppa__ | 623 | #ifdef CONFIG_PARISC |
| 624 | { | 624 | { |
| 625 | .procname = "soft-power", | 625 | .procname = "soft-power", |
| 626 | .data = &pwrsw_enabled, | 626 | .data = &pwrsw_enabled, |
| @@ -164,7 +164,7 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, · 163 unmodified lines | |||
| 164 | struct hrtimer_clock_base *base; | 164 | struct hrtimer_clock_base *base; |
| 165 | 165 | ||
| 166 | for (;;) { | 166 | for (;;) { |
| 167 | base = timer->base; | 167 | base = READ_ONCE(timer->base); |
| 168 | if (likely(base != &migration_base)) { | 168 | if (likely(base != &migration_base)) { |
| 169 | raw_spin_lock_irqsave(&base->cpu_base->lock, *flags); | 169 | raw_spin_lock_irqsave(&base->cpu_base->lock, *flags); |
| 170 | if (likely(base == timer->base)) | 170 | if (likely(base == timer->base)) |
| @@ -244,7 +244,7 @@ again: · 73 unmodified lines | |||
| 244 | return base; | 244 | return base; |
| 245 | 245 | ||
| 246 | /* See the comment in lock_hrtimer_base() */ | 246 | /* See the comment in lock_hrtimer_base() */ |
| 247 | timer->base = &migration_base; | 247 | WRITE_ONCE(timer->base, &migration_base); |
| 248 | raw_spin_unlock(&base->cpu_base->lock); | 248 | raw_spin_unlock(&base->cpu_base->lock); |
| 249 | raw_spin_lock(&new_base->cpu_base->lock); | 249 | raw_spin_lock(&new_base->cpu_base->lock); |
| 250 | 250 | ||
| @@ -253,10 +253,10 @@ again: · 2 unmodified lines | |||
| 253 | raw_spin_unlock(&new_base->cpu_base->lock); | 253 | raw_spin_unlock(&new_base->cpu_base->lock); |
| 254 | raw_spin_lock(&base->cpu_base->lock); | 254 | raw_spin_lock(&base->cpu_base->lock); |
| 255 | new_cpu_base = this_cpu_base; | 255 | new_cpu_base = this_cpu_base; |
| 256 | timer->base = base; | 256 | WRITE_ONCE(timer->base, base); |
| 257 | goto again; | 257 | goto again; |
| 258 | } | 258 | } |
| 259 | timer->base = new_base; | 259 | WRITE_ONCE(timer->base, new_base); |
| 260 | } else { | 260 | } else { |
| 261 | if (new_cpu_base != this_cpu_base && | 261 | if (new_cpu_base != this_cpu_base && |
| 262 | hrtimer_check_target(timer, new_base)) { | 262 | hrtimer_check_target(timer, new_base)) { |
| @@ -266,7 +266,7 @@ static void update_gt_cputime(struct task_cputime_atomic *cputime_atomic, · 265 unmodified lines | |||
| 266 | /** | 266 | /** |
| 267 | * thread_group_sample_cputime - Sample cputime for a given task | 267 | * thread_group_sample_cputime - Sample cputime for a given task |
| 268 | * @tsk: Task for which cputime needs to be started | 268 | * @tsk: Task for which cputime needs to be started |
| 269 | * @iimes: Storage for time samples | 269 | * @samples: Storage for time samples |
| 270 | * | 270 | * |
| 271 | * Called from sys_getitimer() to calculate the expiry time of an active | 271 | * Called from sys_getitimer() to calculate the expiry time of an active |
| 272 | * timer. That means group cputime accounting is already active. Called | 272 | * timer. That means group cputime accounting is already active. Called |
| @@ -1038,12 +1038,12 @@ unlock: · 765 unmodified lines | |||
| 1038 | * member of @pct->bases[CLK].nextevt. False otherwise | 1038 | * member of @pct->bases[CLK].nextevt. False otherwise |
| 1039 | */ | 1039 | */ |
| 1040 | static inline bool | 1040 | static inline bool |
| 1041 | task_cputimers_expired(const u64 *sample, struct posix_cputimers *pct) | 1041 | task_cputimers_expired(const u64 *samples, struct posix_cputimers *pct) |
| 1042 | { | 1042 | { |
| 1043 | int i; | 1043 | int i; |
| 1044 | 1044 | ||
| 1045 | for (i = 0; i < CPUCLOCK_MAX; i++) { | 1045 | for (i = 0; i < CPUCLOCK_MAX; i++) { |
| 1046 | if (sample[i] >= pct->bases[i].nextevt) | 1046 | if (samples[i] >= pct->bases[i].nextevt) |
| 1047 | return true; | 1047 | return true; |
| 1048 | } | 1048 | } |
| 1049 | return false; | 1049 | return false; |
| @@ -17,6 +17,8 @@ · 16 unmodified lines | |||
| 17 | #include <linux/seqlock.h> | 17 | #include <linux/seqlock.h> |
| 18 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
| 19 | 19 | ||
| 20 | #include "timekeeping.h" | ||
| 21 | |||
| 20 | /** | 22 | /** |
| 21 | * struct clock_read_data - data required to read from sched_clock() | 23 | * struct clock_read_data - data required to read from sched_clock() |
| 22 | * | 24 | * |
| @@ -277,9 +277,11 @@ int perf_kprobe_init(struct perf_event *p_event, bool is_retprobe) · 276 unmodified lines | |||
| 277 | goto out; | 277 | goto out; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | mutex_lock(&event_mutex); | ||
| 280 | ret = perf_trace_event_init(tp_event, p_event); | 281 | ret = perf_trace_event_init(tp_event, p_event); |
| 281 | if (ret) | 282 | if (ret) |
| 282 | destroy_local_trace_kprobe(tp_event); | 283 | destroy_local_trace_kprobe(tp_event); |
| 284 | mutex_unlock(&event_mutex); | ||
| 283 | out: | 285 | out: |
| 284 | kfree(func); | 286 | kfree(func); |
| 285 | return ret; | 287 | return ret; |
| @@ -287,8 +289,10 @@ out: · 1 unmodified line | |||
| 287 | 289 | ||
| 288 | void perf_kprobe_destroy(struct perf_event *p_event) | 290 | void perf_kprobe_destroy(struct perf_event *p_event) |
| 289 | { | 291 | { |
| 292 | mutex_lock(&event_mutex); | ||
| 290 | perf_trace_event_close(p_event); | 293 | perf_trace_event_close(p_event); |
| 291 | perf_trace_event_unreg(p_event); | 294 | perf_trace_event_unreg(p_event); |
| 295 | mutex_unlock(&event_mutex); | ||
| 292 | 296 | ||
| 293 | destroy_local_trace_kprobe(p_event->tp_event); | 297 | destroy_local_trace_kprobe(p_event->tp_event); |
| 294 | } | 298 | } |
| @@ -679,6 +679,8 @@ static bool synth_field_signed(char *type) · 678 unmodified lines | |||
| 679 | { | 679 | { |
| 680 | if (str_has_prefix(type, "u")) | 680 | if (str_has_prefix(type, "u")) |
| 681 | return false; | 681 | return false; |
| 682 | if (strcmp(type, "gfp_t") == 0) | ||
| 683 | return false; | ||
| 682 | 684 | ||
| 683 | return true; | 685 | return true; |
| 684 | } | 686 | } |
| @@ -2,6 +2,7 @@ · 1 unmodified line | |||
| 2 | #include <linux/export.h> | 2 | #include <linux/export.h> |
| 3 | #include <linux/generic-radix-tree.h> | 3 | #include <linux/generic-radix-tree.h> |
| 4 | #include <linux/gfp.h> | 4 | #include <linux/gfp.h> |
| 5 | #include <linux/kmemleak.h> | ||
| 5 | 6 | ||
| 6 | #define GENRADIX_ARY (PAGE_SIZE / sizeof(struct genradix_node *)) | 7 | #define GENRADIX_ARY (PAGE_SIZE / sizeof(struct genradix_node *)) |
| 7 | #define GENRADIX_ARY_SHIFT ilog2(GENRADIX_ARY) | 8 | #define GENRADIX_ARY_SHIFT ilog2(GENRADIX_ARY) |
| @@ -75,6 +76,27 @@ void *__genradix_ptr(struct __genradix *radix, size_t offset) · 67 unmodified lines | |||
| 75 | } | 76 | } |
| 76 | EXPORT_SYMBOL(__genradix_ptr); | 77 | EXPORT_SYMBOL(__genradix_ptr); |
| 77 | 78 | ||
| 79 | static inline struct genradix_node *genradix_alloc_node(gfp_t gfp_mask) | ||
| 80 | { | ||
| 81 | struct genradix_node *node; | ||
| 82 | |||
| 83 | node = (struct genradix_node *)__get_free_page(gfp_mask|__GFP_ZERO); | ||
| 84 | |||
| 85 | /* | ||
| 86 | * We're using pages (not slab allocations) directly for kernel data | ||
| 87 | * structures, so we need to explicitly inform kmemleak of them in order | ||
| 88 | * to avoid false positive memory leak reports. | ||
| 89 | */ | ||
| 90 | kmemleak_alloc(node, PAGE_SIZE, 1, gfp_mask); | ||
| 91 | return node; | ||
| 92 | } | ||
| 93 | |||
| 94 | static inline void genradix_free_node(struct genradix_node *node) | ||
| 95 | { | ||
| 96 | kmemleak_free(node); | ||
| 97 | free_page((unsigned long)node); | ||
| 98 | } | ||
| 99 | |||
| 78 | /* | 100 | /* |
| 79 | * Returns pointer to the specified byte @offset within @radix, allocating it if | 101 | * Returns pointer to the specified byte @offset within @radix, allocating it if |
| 80 | * necessary - newly allocated slots are always zeroed out: | 102 | * necessary - newly allocated slots are always zeroed out: |
| @@ -97,8 +119,7 @@ void *__genradix_ptr_alloc(struct __genradix *radix, size_t offset, · 16 unmodified lines | |||
| 97 | break; | 119 | break; |
| 98 | 120 | ||
| 99 | if (!new_node) { | 121 | if (!new_node) { |
| 100 | new_node = (void *) | 122 | new_node = genradix_alloc_node(gfp_mask); |
| 101 | __get_free_page(gfp_mask|__GFP_ZERO); | ||
| 102 | if (!new_node) | 123 | if (!new_node) |
| 103 | return NULL; | 124 | return NULL; |
| 104 | } | 125 | } |
| @@ -121,8 +142,7 @@ void *__genradix_ptr_alloc(struct __genradix *radix, size_t offset, · 16 unmodified lines | |||
| 121 | n = READ_ONCE(*p); | 142 | n = READ_ONCE(*p); |
| 122 | if (!n) { | 143 | if (!n) { |
| 123 | if (!new_node) { | 144 | if (!new_node) { |
| 124 | new_node = (void *) | 145 | new_node = genradix_alloc_node(gfp_mask); |
| 125 | __get_free_page(gfp_mask|__GFP_ZERO); | ||
| 126 | if (!new_node) | 146 | if (!new_node) |
| 127 | return NULL; | 147 | return NULL; |
| 128 | } | 148 | } |
| @@ -133,7 +153,7 @@ void *__genradix_ptr_alloc(struct __genradix *radix, size_t offset, · 4 unmodified lines | |||
| 133 | } | 153 | } |
| 134 | 154 | ||
| 135 | if (new_node) | 155 | if (new_node) |
| 136 | free_page((unsigned long) new_node); | 156 | genradix_free_node(new_node); |
| 137 | 157 | ||
| 138 | return &n->data[offset]; | 158 | return &n->data[offset]; |
| 139 | } | 159 | } |
| @@ -191,7 +211,7 @@ static void genradix_free_recurse(struct genradix_node *n, unsigned level) · 51 unmodified lines | |||
| 191 | genradix_free_recurse(n->children[i], level - 1); | 211 | genradix_free_recurse(n->children[i], level - 1); |
| 192 | } | 212 | } |
| 193 | 213 | ||
| 194 | free_page((unsigned long) n); | 214 | genradix_free_node(n); |
| 195 | } | 215 | } |
| 196 | 216 | ||
| 197 | int __genradix_prealloc(struct __genradix *radix, size_t size, | 217 | int __genradix_prealloc(struct __genradix *radix, size_t size, |
| @@ -297,6 +297,32 @@ out: · 296 unmodified lines | |||
| 297 | return 1; | 297 | return 1; |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | static int __init do_kmem_cache_size_bulk(int size, int *total_failures) | ||
| 301 | { | ||
| 302 | struct kmem_cache *c; | ||
| 303 | int i, iter, maxiter = 1024; | ||
| 304 | int num, bytes; | ||
| 305 | bool fail = false; | ||
| 306 | void *objects[10]; | ||
| 307 | |||
| 308 | c = kmem_cache_create("test_cache", size, size, 0, NULL); | ||
| 309 | for (iter = 0; (iter < maxiter) && !fail; iter++) { | ||
| 310 | num = kmem_cache_alloc_bulk(c, GFP_KERNEL, ARRAY_SIZE(objects), | ||
| 311 | objects); | ||
| 312 | for (i = 0; i < num; i++) { | ||
| 313 | bytes = count_nonzero_bytes(objects[i], size); | ||
| 314 | if (bytes) | ||
| 315 | fail = true; | ||
| 316 | fill_with_garbage(objects[i], size); | ||
| 317 | } | ||
| 318 | |||
| 319 | if (num) | ||
| 320 | kmem_cache_free_bulk(c, num, objects); | ||
| 321 | } | ||
| 322 | *total_failures += fail; | ||
| 323 | return 1; | ||
| 324 | } | ||
| 325 | |||
| 300 | /* | 326 | /* |
| 301 | * Test kmem_cache allocation by creating caches of different sizes, with and | 327 | * Test kmem_cache allocation by creating caches of different sizes, with and |
| 302 | * without constructors, with and without SLAB_TYPESAFE_BY_RCU. | 328 | * without constructors, with and without SLAB_TYPESAFE_BY_RCU. |
| @@ -318,6 +344,7 @@ static int __init test_kmemcache(int *total_failures) · 15 unmodified lines | |||
| 318 | num_tests += do_kmem_cache_size(size, ctor, rcu, zero, | 344 | num_tests += do_kmem_cache_size(size, ctor, rcu, zero, |
| 319 | &failures); | 345 | &failures); |
| 320 | } | 346 | } |
| 347 | num_tests += do_kmem_cache_size_bulk(size, &failures); | ||
| 321 | } | 348 | } |
| 322 | REPORT_FAILURES_IN_FN(); | 349 | REPORT_FAILURES_IN_FN(); |
| 323 | *total_failures += failures; | 350 | *total_failures += failures; |
| @@ -47,18 +47,35 @@ static bool is_zeroed(void *from, size_t size) · 46 unmodified lines | |||
| 47 | static int test_check_nonzero_user(char *kmem, char __user *umem, size_t size) | 47 | static int test_check_nonzero_user(char *kmem, char __user *umem, size_t size) |
| 48 | { | 48 | { |
| 49 | int ret = 0; | 49 | int ret = 0; |
| 50 | size_t start, end, i; | 50 | size_t start, end, i, zero_start, zero_end; |
| 51 | size_t zero_start = size / 4; | 51 | |
| 52 | size_t zero_end = size - zero_start; | 52 | if (test(size < 2 * PAGE_SIZE, "buffer too small")) |
| 53 | return -EINVAL; | ||
| 54 | |||
| 55 | /* | ||
| 56 | * We want to cross a page boundary to exercise the code more | ||
| 57 | * effectively. We also don't want to make the size we scan too large, | ||
| 58 | * otherwise the test can take a long time and cause soft lockups. So | ||
| 59 | * scan a 1024 byte region across the page boundary. | ||
| 60 | */ | ||
| 61 | size = 1024; | ||
| 62 | start = PAGE_SIZE - (size / 2); | ||
| 63 | |||
| 64 | kmem += start; | ||
| 65 | umem += start; | ||
| 66 | |||
| 67 | zero_start = size / 4; | ||
| 68 | zero_end = size - zero_start; | ||
| 53 | 69 | ||
| 54 | /* | 70 | /* |
| 55 | * We conduct a series of check_nonzero_user() tests on a block of memory | 71 | * We conduct a series of check_nonzero_user() tests on a block of |
| 56 | * with the following byte-pattern (trying every possible [start,end] | 72 | * memory with the following byte-pattern (trying every possible |
| 57 | * pair): | 73 | * [start,end] pair): |
| 58 | * | 74 | * |
| 59 | * [ 00 ff 00 ff ... 00 00 00 00 ... ff 00 ff 00 ] | 75 | * [ 00 ff 00 ff ... 00 00 00 00 ... ff 00 ff 00 ] |
| 60 | * | 76 | * |
| 61 | * And we verify that check_nonzero_user() acts identically to memchr_inv(). | 77 | * And we verify that check_nonzero_user() acts identically to |
| 78 | * memchr_inv(). | ||
| 62 | */ | 79 | */ |
| 63 | 80 | ||
| 64 | memset(kmem, 0x0, size); | 81 | memset(kmem, 0x0, size); |
| @@ -93,11 +110,13 @@ static int test_copy_struct_from_user(char *kmem, char __user *umem, · 28 unmodified lines | |||
| 93 | size_t ksize, usize; | 110 | size_t ksize, usize; |
| 94 | 111 | ||
| 95 | umem_src = kmalloc(size, GFP_KERNEL); | 112 | umem_src = kmalloc(size, GFP_KERNEL); |
| 96 | if ((ret |= test(umem_src == NULL, "kmalloc failed"))) | 113 | ret = test(umem_src == NULL, "kmalloc failed"); |
| 114 | if (ret) | ||
| 97 | goto out_free; | 115 | goto out_free; |
| 98 | 116 | ||
| 99 | expected = kmalloc(size, GFP_KERNEL); | 117 | expected = kmalloc(size, GFP_KERNEL); |
| 100 | if ((ret |= test(expected == NULL, "kmalloc failed"))) | 118 | ret = test(expected == NULL, "kmalloc failed"); |
| 119 | if (ret) | ||
| 101 | goto out_free; | 120 | goto out_free; |
| 102 | 121 | ||
| 103 | /* Fill umem with a fixed byte pattern. */ | 122 | /* Fill umem with a fixed byte pattern. */ |
| @@ -214,9 +214,10 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res) · 213 unmodified lines | |||
| 214 | return -1; | 214 | return -1; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | res->tv_sec = 0; | 217 | if (likely(res)) { |
| 218 | res->tv_nsec = ns; | 218 | res->tv_sec = 0; |
| 219 | 219 | res->tv_nsec = ns; | |
| 220 | } | ||
| 220 | return 0; | 221 | return 0; |
| 221 | } | 222 | } |
| 222 | 223 | ||
| @@ -245,7 +246,7 @@ __cvdso_clock_getres_time32(clockid_t clock, struct old_timespec32 *res) · 22 unmodified lines | |||
| 245 | ret = clock_getres_fallback(clock, &ts); | 246 | ret = clock_getres_fallback(clock, &ts); |
| 246 | #endif | 247 | #endif |
| 247 | 248 | ||
| 248 | if (likely(!ret)) { | 249 | if (likely(!ret && res)) { |
| 249 | res->tv_sec = ts.tv_sec; | 250 | res->tv_sec = ts.tv_sec; |
| 250 | res->tv_nsec = ts.tv_nsec; | 251 | res->tv_nsec = ts.tv_nsec; |
| 251 | } | 252 | } |
| @@ -270,14 +270,15 @@ __reset_isolation_pfn(struct zone *zone, unsigned long pfn, bool check_source, · 269 unmodified lines | |||
| 270 | 270 | ||
| 271 | /* Ensure the start of the pageblock or zone is online and valid */ | 271 | /* Ensure the start of the pageblock or zone is online and valid */ |
| 272 | block_pfn = pageblock_start_pfn(pfn); | 272 | block_pfn = pageblock_start_pfn(pfn); |
| 273 | block_page = pfn_to_online_page(max(block_pfn, zone->zone_start_pfn)); | 273 | block_pfn = max(block_pfn, zone->zone_start_pfn); |
| 274 | block_page = pfn_to_online_page(block_pfn); | ||
| 274 | if (block_page) { | 275 | if (block_page) { |
| 275 | page = block_page; | 276 | page = block_page; |
| 276 | pfn = block_pfn; | 277 | pfn = block_pfn; |
| 277 | } | 278 | } |
| 278 | 279 | ||
| 279 | /* Ensure the end of the pageblock or zone is online and valid */ | 280 | /* Ensure the end of the pageblock or zone is online and valid */ |
| 280 | block_pfn += pageblock_nr_pages; | 281 | block_pfn = pageblock_end_pfn(pfn) - 1; |
| 281 | block_pfn = min(block_pfn, zone_end_pfn(zone) - 1); | 282 | block_pfn = min(block_pfn, zone_end_pfn(zone) - 1); |
| 282 | end_page = pfn_to_online_page(block_pfn); | 283 | end_page = pfn_to_online_page(block_pfn); |
| 283 | if (!end_page) | 284 | if (!end_page) |
| @@ -303,7 +304,7 @@ __reset_isolation_pfn(struct zone *zone, unsigned long pfn, bool check_source, · 19 unmodified lines | |||
| 303 | 304 | ||
| 304 | page += (1 << PAGE_ALLOC_COSTLY_ORDER); | 305 | page += (1 << PAGE_ALLOC_COSTLY_ORDER); |
| 305 | pfn += (1 << PAGE_ALLOC_COSTLY_ORDER); | 306 | pfn += (1 << PAGE_ALLOC_COSTLY_ORDER); |
| 306 | } while (page < end_page); | 307 | } while (page <= end_page); |
| 307 | 308 | ||
| 308 | return false; | 309 | return false; |
| 309 | } | 310 | } |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | |||
| 40 | #include <linux/rmap.h> | 40 | #include <linux/rmap.h> |
| 41 | #include <linux/delayacct.h> | 41 | #include <linux/delayacct.h> |
| 42 | #include <linux/psi.h> | 42 | #include <linux/psi.h> |
| 43 | #include <linux/ramfs.h> | ||
| 43 | #include "internal.h" | 44 | #include "internal.h" |
| 44 | 45 | ||
| 45 | #define CREATE_TRACE_POINTS | 46 | #define CREATE_TRACE_POINTS |
| @@ -1973,7 +1973,8 @@ static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end, · 1972 unmodified lines | |||
| 1973 | } | 1973 | } |
| 1974 | 1974 | ||
| 1975 | static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, | 1975 | static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, |
| 1976 | unsigned long end, int write, struct page **pages, int *nr) | 1976 | unsigned long end, unsigned int flags, |
| 1977 | struct page **pages, int *nr) | ||
| 1977 | { | 1978 | { |
| 1978 | unsigned long pte_end; | 1979 | unsigned long pte_end; |
| 1979 | struct page *head, *page; | 1980 | struct page *head, *page; |
| @@ -1986,7 +1987,7 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, · 6 unmodified lines | |||
| 1986 | 1987 | ||
| 1987 | pte = READ_ONCE(*ptep); | 1988 | pte = READ_ONCE(*ptep); |
| 1988 | 1989 | ||
| 1989 | if (!pte_access_permitted(pte, write)) | 1990 | if (!pte_access_permitted(pte, flags & FOLL_WRITE)) |
| 1990 | return 0; | 1991 | return 0; |
| 1991 | 1992 | ||
| 1992 | /* hugepages are never "special" */ | 1993 | /* hugepages are never "special" */ |
| @@ -2023,7 +2024,7 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, · 30 unmodified lines | |||
| 2023 | } | 2024 | } |
| 2024 | 2025 | ||
| 2025 | static int gup_huge_pd(hugepd_t hugepd, unsigned long addr, | 2026 | static int gup_huge_pd(hugepd_t hugepd, unsigned long addr, |
| 2026 | unsigned int pdshift, unsigned long end, int write, | 2027 | unsigned int pdshift, unsigned long end, unsigned int flags, |
| 2027 | struct page **pages, int *nr) | 2028 | struct page **pages, int *nr) |
| 2028 | { | 2029 | { |
| 2029 | pte_t *ptep; | 2030 | pte_t *ptep; |
| @@ -2033,7 +2034,7 @@ static int gup_huge_pd(hugepd_t hugepd, unsigned long addr, · 3 unmodified lines | |||
| 2033 | ptep = hugepte_offset(hugepd, addr, pdshift); | 2034 | ptep = hugepte_offset(hugepd, addr, pdshift); |
| 2034 | do { | 2035 | do { |
| 2035 | next = hugepte_addr_end(addr, end, sz); | 2036 | next = hugepte_addr_end(addr, end, sz); |
| 2036 | if (!gup_hugepte(ptep, sz, addr, end, write, pages, nr)) | 2037 | if (!gup_hugepte(ptep, sz, addr, end, flags, pages, nr)) |
| 2037 | return 0; | 2038 | return 0; |
| 2038 | } while (ptep++, addr = next, addr != end); | 2039 | } while (ptep++, addr = next, addr != end); |
| 2039 | 2040 | ||
| @@ -2041,7 +2042,7 @@ static int gup_huge_pd(hugepd_t hugepd, unsigned long addr, · 1 unmodified line | |||
| 2041 | } | 2042 | } |
| 2042 | #else | 2043 | #else |
| 2043 | static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr, | 2044 | static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr, |
| 2044 | unsigned pdshift, unsigned long end, int write, | 2045 | unsigned int pdshift, unsigned long end, unsigned int flags, |
| 2045 | struct page **pages, int *nr) | 2046 | struct page **pages, int *nr) |
| 2046 | { | 2047 | { |
| 2047 | return 0; | 2048 | return 0; |
| @@ -2049,7 +2050,8 @@ static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr, · 1 unmodified line | |||
| 2049 | #endif /* CONFIG_ARCH_HAS_HUGEPD */ | 2050 | #endif /* CONFIG_ARCH_HAS_HUGEPD */ |
| 2050 | 2051 | ||
| 2051 | static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, | 2052 | static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr, |
| 2052 | unsigned long end, unsigned int flags, struct page **pages, int *nr) | 2053 | unsigned long end, unsigned int flags, |
| 2054 | struct page **pages, int *nr) | ||
| 2053 | { | 2055 | { |
| 2054 | struct page *head, *page; | 2056 | struct page *head, *page; |
| 2055 | int refs; | 2057 | int refs; |
| @@ -2789,8 +2789,13 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) · 2788 unmodified lines | |||
| 2789 | ds_queue->split_queue_len--; | 2789 | ds_queue->split_queue_len--; |
| 2790 | list_del(page_deferred_list(head)); | 2790 | list_del(page_deferred_list(head)); |
| 2791 | } | 2791 | } |
| 2792 | if (mapping) | 2792 | if (mapping) { |
| 2793 | __dec_node_page_state(page, NR_SHMEM_THPS); | 2793 | if (PageSwapBacked(page)) |
| 2794 | __dec_node_page_state(page, NR_SHMEM_THPS); | ||
| 2795 | else | ||
| 2796 | __dec_node_page_state(page, NR_FILE_THPS); | ||
| 2797 | } | ||
| 2798 | |||
| 2794 | spin_unlock(&ds_queue->split_queue_lock); | 2799 | spin_unlock(&ds_queue->split_queue_lock); |
| 2795 | __split_huge_page(page, list, end, flags); | 2800 | __split_huge_page(page, list, end, flags); |
| 2796 | if (PageSwapCache(head)) { | 2801 | if (PageSwapCache(head)) { |
| @@ -1084,11 +1084,10 @@ static bool pfn_range_valid_gigantic(struct zone *z, · 1083 unmodified lines | |||
| 1084 | struct page *page; | 1084 | struct page *page; |
| 1085 | 1085 | ||
| 1086 | for (i = start_pfn; i < end_pfn; i++) { | 1086 | for (i = start_pfn; i < end_pfn; i++) { |
| 1087 | if (!pfn_valid(i)) | 1087 | page = pfn_to_online_page(i); |
| 1088 | if (!page) | ||
| 1088 | return false; | 1089 | return false; |
| 1089 | 1090 | ||
| 1090 | page = pfn_to_page(i); | ||
| 1091 | |||
| 1092 | if (page_zone(page) != z) | 1091 | if (page_zone(page) != z) |
| 1093 | return false; | 1092 | return false; |
| 1094 | 1093 | ||
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | #include <linux/spinlock.h> | 5 | #include <linux/spinlock.h> |
| 6 | #include <linux/list.h> | 6 | #include <linux/list.h> |
| 7 | #include <linux/cpumask.h> | 7 | #include <linux/cpumask.h> |
| 8 | #include <linux/mman.h> | ||
| 8 | 9 | ||
| 9 | #include <linux/atomic.h> | 10 | #include <linux/atomic.h> |
| 10 | #include <linux/user_namespace.h> | 11 | #include <linux/user_namespace.h> |
| @@ -526,6 +526,16 @@ static struct kmemleak_object *find_and_get_object(unsigned long ptr, int alias) · 525 unmodified lines | |||
| 526 | return object; | 526 | return object; |
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | /* | ||
| 530 | * Remove an object from the object_tree_root and object_list. Must be called | ||
| 531 | * with the kmemleak_lock held _if_ kmemleak is still enabled. | ||
| 532 | */ | ||
| 533 | static void __remove_object(struct kmemleak_object *object) | ||
| 534 | { | ||
| 535 | rb_erase(&object->rb_node, &object_tree_root); | ||
| 536 | list_del_rcu(&object->object_list); | ||
| 537 | } | ||
| 538 | |||
| 529 | /* | 539 | /* |
| 530 | * Look up an object in the object search tree and remove it from both | 540 | * Look up an object in the object search tree and remove it from both |
| 531 | * object_tree_root and object_list. The returned object's use_count should be | 541 | * object_tree_root and object_list. The returned object's use_count should be |
| @@ -538,10 +548,8 @@ static struct kmemleak_object *find_and_remove_object(unsigned long ptr, int ali · 6 unmodified lines | |||
| 538 | 548 | ||
| 539 | write_lock_irqsave(&kmemleak_lock, flags); | 549 | write_lock_irqsave(&kmemleak_lock, flags); |
| 540 | object = lookup_object(ptr, alias); | 550 | object = lookup_object(ptr, alias); |
| 541 | if (object) { | 551 | if (object) |
| 542 | rb_erase(&object->rb_node, &object_tree_root); | 552 | __remove_object(object); |
| 543 | list_del_rcu(&object->object_list); | ||
| 544 | } | ||
| 545 | write_unlock_irqrestore(&kmemleak_lock, flags); | 553 | write_unlock_irqrestore(&kmemleak_lock, flags); |
| 546 | 554 | ||
| 547 | return object; | 555 | return object; |
| @@ -1834,12 +1842,16 @@ static const struct file_operations kmemleak_fops = { · 1286 unmodified lines | |||
| 1834 | 1842 | ||
| 1835 | static void __kmemleak_do_cleanup(void) | 1843 | static void __kmemleak_do_cleanup(void) |
| 1836 | { | 1844 | { |
| 1837 | struct kmemleak_object *object; | 1845 | struct kmemleak_object *object, *tmp; |
| 1838 | 1846 | ||
| 1839 | rcu_read_lock(); | 1847 | /* |
| 1840 | list_for_each_entry_rcu(object, &object_list, object_list) | 1848 | * Kmemleak has already been disabled, no need for RCU list traversal |
| 1841 | delete_object_full(object->pointer); | 1849 | * or kmemleak_lock held. |
| 1842 | rcu_read_unlock(); | 1850 | */ |
| 1851 | list_for_each_entry_safe(object, tmp, &object_list, object_list) { | ||
| 1852 | __remove_object(object); | ||
| 1853 | __delete_object(object); | ||
| 1854 | } | ||
| 1843 | } | 1855 | } |
| 1844 | 1856 | ||
| 1845 | /* | 1857 | /* |
| @@ -1356,9 +1356,6 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, · 1355 unmodified lines | |||
| 1356 | align = SMP_CACHE_BYTES; | 1356 | align = SMP_CACHE_BYTES; |
| 1357 | } | 1357 | } |
| 1358 | 1358 | ||
| 1359 | if (end > memblock.current_limit) | ||
| 1360 | end = memblock.current_limit; | ||
| 1361 | |||
| 1362 | again: | 1359 | again: |
| 1363 | found = memblock_find_in_range_node(size, align, start, end, nid, | 1360 | found = memblock_find_in_range_node(size, align, start, end, nid, |
| 1364 | flags); | 1361 | flags); |
| @@ -1469,6 +1466,9 @@ static void * __init memblock_alloc_internal( · 104 unmodified lines | |||
| 1469 | if (WARN_ON_ONCE(slab_is_available())) | 1466 | if (WARN_ON_ONCE(slab_is_available())) |
| 1470 | return kzalloc_node(size, GFP_NOWAIT, nid); | 1467 | return kzalloc_node(size, GFP_NOWAIT, nid); |
| 1471 | 1468 | ||
| 1469 | if (max_addr > memblock.current_limit) | ||
| 1470 | max_addr = memblock.current_limit; | ||
| 1471 | |||
| 1472 | alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid); | 1472 | alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid); |
| 1473 | 1473 | ||
| 1474 | /* retry allocation without lower limit */ | 1474 | /* retry allocation without lower limit */ |
| @@ -5420,6 +5420,8 @@ static int mem_cgroup_move_account(struct page *page, · 5419 unmodified lines | |||
| 5420 | struct mem_cgroup *from, | 5420 | struct mem_cgroup *from, |
| 5421 | struct mem_cgroup *to) | 5421 | struct mem_cgroup *to) |
| 5422 | { | 5422 | { |
| 5423 | struct lruvec *from_vec, *to_vec; | ||
| 5424 | struct pglist_data *pgdat; | ||
| 5423 | unsigned long flags; | 5425 | unsigned long flags; |
| 5424 | unsigned int nr_pages = compound ? hpage_nr_pages(page) : 1; | 5426 | unsigned int nr_pages = compound ? hpage_nr_pages(page) : 1; |
| 5425 | int ret; | 5427 | int ret; |
| @@ -5443,11 +5445,15 @@ static int mem_cgroup_move_account(struct page *page, · 17 unmodified lines | |||
| 5443 | 5445 | ||
| 5444 | anon = PageAnon(page); | 5446 | anon = PageAnon(page); |
| 5445 | 5447 | ||
| 5448 | pgdat = page_pgdat(page); | ||
| 5449 | from_vec = mem_cgroup_lruvec(pgdat, from); | ||
| 5450 | to_vec = mem_cgroup_lruvec(pgdat, to); | ||
| 5451 | |||
| 5446 | spin_lock_irqsave(&from->move_lock, flags); | 5452 | spin_lock_irqsave(&from->move_lock, flags); |
| 5447 | 5453 | ||
| 5448 | if (!anon && page_mapped(page)) { | 5454 | if (!anon && page_mapped(page)) { |
| 5449 | __mod_memcg_state(from, NR_FILE_MAPPED, -nr_pages); | 5455 | __mod_lruvec_state(from_vec, NR_FILE_MAPPED, -nr_pages); |
| 5450 | __mod_memcg_state(to, NR_FILE_MAPPED, nr_pages); | 5456 | __mod_lruvec_state(to_vec, NR_FILE_MAPPED, nr_pages); |
| 5451 | } | 5457 | } |
| 5452 | 5458 | ||
| 5453 | /* | 5459 | /* |
| @@ -5459,14 +5465,14 @@ static int mem_cgroup_move_account(struct page *page, · 5 unmodified lines | |||
| 5459 | struct address_space *mapping = page_mapping(page); | 5465 | struct address_space *mapping = page_mapping(page); |
| 5460 | 5466 | ||
| 5461 | if (mapping_cap_account_dirty(mapping)) { | 5467 | if (mapping_cap_account_dirty(mapping)) { |
| 5462 | __mod_memcg_state(from, NR_FILE_DIRTY, -nr_pages); | 5468 | __mod_lruvec_state(from_vec, NR_FILE_DIRTY, -nr_pages); |
| 5463 | __mod_memcg_state(to, NR_FILE_DIRTY, nr_pages); | 5469 | __mod_lruvec_state(to_vec, NR_FILE_DIRTY, nr_pages); |
| 5464 | } | 5470 | } |
| 5465 | } | 5471 | } |
| 5466 | 5472 | ||
| 5467 | if (PageWriteback(page)) { | 5473 | if (PageWriteback(page)) { |
| 5468 | __mod_memcg_state(from, NR_WRITEBACK, -nr_pages); | 5474 | __mod_lruvec_state(from_vec, NR_WRITEBACK, -nr_pages); |
| 5469 | __mod_memcg_state(to, NR_WRITEBACK, nr_pages); | 5475 | __mod_lruvec_state(to_vec, NR_WRITEBACK, nr_pages); |
| 5470 | } | 5476 | } |
| 5471 | 5477 | ||
| 5472 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 5478 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| @@ -199,7 +199,6 @@ struct to_kill { · 198 unmodified lines | |||
| 199 | struct task_struct *tsk; | 199 | struct task_struct *tsk; |
| 200 | unsigned long addr; | 200 | unsigned long addr; |
| 201 | short size_shift; | 201 | short size_shift; |
| 202 | char addr_valid; | ||
| 203 | }; | 202 | }; |
| 204 | 203 | ||
| 205 | /* | 204 | /* |
| @@ -324,22 +323,27 @@ static void add_to_kill(struct task_struct *tsk, struct page *p, · 118 unmodified lines | |||
| 324 | } | 323 | } |
| 325 | } | 324 | } |
| 326 | tk->addr = page_address_in_vma(p, vma); | 325 | tk->addr = page_address_in_vma(p, vma); |
| 327 | tk->addr_valid = 1; | ||
| 328 | if (is_zone_device_page(p)) | 326 | if (is_zone_device_page(p)) |
| 329 | tk->size_shift = dev_pagemap_mapping_shift(p, vma); | 327 | tk->size_shift = dev_pagemap_mapping_shift(p, vma); |
| 330 | else | 328 | else |
| 331 | tk->size_shift = compound_order(compound_head(p)) + PAGE_SHIFT; | 329 | tk->size_shift = compound_order(compound_head(p)) + PAGE_SHIFT; |
| 332 | 330 | ||
| 333 | /* | 331 | /* |
| 334 | * In theory we don't have to kill when the page was | 332 | * Send SIGKILL if "tk->addr == -EFAULT". Also, as |
| 335 | * munmaped. But it could be also a mremap. Since that's | 333 | * "tk->size_shift" is always non-zero for !is_zone_device_page(), |
| 336 | * likely very rare kill anyways just out of paranoia, but use | 334 | * so "tk->size_shift == 0" effectively checks no mapping on |
| 337 | * a SIGKILL because the error is not contained anymore. | 335 | * ZONE_DEVICE. Indeed, when a devdax page is mmapped N times |
| 336 | * to a process' address space, it's possible not all N VMAs | ||
| 337 | * contain mappings for the page, but at least one VMA does. | ||
| 338 | * Only deliver SIGBUS with payload derived from the VMA that | ||
| 339 | * has a mapping for the page. | ||
| 338 | */ | 340 | */ |
| 339 | if (tk->addr == -EFAULT || tk->size_shift == 0) { | 341 | if (tk->addr == -EFAULT) { |
| 340 | pr_info("Memory failure: Unable to find user space address %lx in %s\n", | 342 | pr_info("Memory failure: Unable to find user space address %lx in %s\n", |
| 341 | page_to_pfn(p), tsk->comm); | 343 | page_to_pfn(p), tsk->comm); |
| 342 | tk->addr_valid = 0; | 344 | } else if (tk->size_shift == 0) { |
| 345 | kfree(tk); | ||
| 346 | return; | ||
| 343 | } | 347 | } |
| 344 | get_task_struct(tsk); | 348 | get_task_struct(tsk); |
| 345 | tk->tsk = tsk; | 349 | tk->tsk = tsk; |
| @@ -366,7 +370,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, bool fail, · 20 unmodified lines | |||
| 366 | * make sure the process doesn't catch the | 370 | * make sure the process doesn't catch the |
| 367 | * signal and then access the memory. Just kill it. | 371 | * signal and then access the memory. Just kill it. |
| 368 | */ | 372 | */ |
| 369 | if (fail || tk->addr_valid == 0) { | 373 | if (fail || tk->addr == -EFAULT) { |
| 370 | pr_err("Memory failure: %#lx: forcibly killing %s:%d because of failure to unmap corrupted page\n", | 374 | pr_err("Memory failure: %#lx: forcibly killing %s:%d because of failure to unmap corrupted page\n", |
| 371 | pfn, tk->tsk->comm, tk->tsk->pid); | 375 | pfn, tk->tsk->comm, tk->tsk->pid); |
| 372 | do_send_sig_info(SIGKILL, SEND_SIG_PRIV, | 376 | do_send_sig_info(SIGKILL, SEND_SIG_PRIV, |
| @@ -1253,17 +1257,19 @@ int memory_failure(unsigned long pfn, int flags) · 880 unmodified lines | |||
| 1253 | if (!sysctl_memory_failure_recovery) | 1257 | if (!sysctl_memory_failure_recovery) |
| 1254 | panic("Memory failure on page %lx", pfn); | 1258 | panic("Memory failure on page %lx", pfn); |
| 1255 | 1259 | ||
| 1256 | if (!pfn_valid(pfn)) { | 1260 | p = pfn_to_online_page(pfn); |
| 1261 | if (!p) { | ||
| 1262 | if (pfn_valid(pfn)) { | ||
| 1263 | pgmap = get_dev_pagemap(pfn, NULL); | ||
| 1264 | if (pgmap) | ||
| 1265 | return memory_failure_dev_pagemap(pfn, flags, | ||
| 1266 | pgmap); | ||
| 1267 | } | ||
| 1257 | pr_err("Memory failure: %#lx: memory outside kernel control\n", | 1268 | pr_err("Memory failure: %#lx: memory outside kernel control\n", |
| 1258 | pfn); | 1269 | pfn); |
| 1259 | return -ENXIO; | 1270 | return -ENXIO; |
| 1260 | } | 1271 | } |
| 1261 | 1272 | ||
| 1262 | pgmap = get_dev_pagemap(pfn, NULL); | ||
| 1263 | if (pgmap) | ||
| 1264 | return memory_failure_dev_pagemap(pfn, flags, pgmap); | ||
| 1265 | |||
| 1266 | p = pfn_to_page(pfn); | ||
| 1267 | if (PageHuge(p)) | 1273 | if (PageHuge(p)) |
| 1268 | return memory_failure_hugetlb(pfn, flags); | 1274 | return memory_failure_hugetlb(pfn, flags); |
| 1269 | if (TestSetPageHWPoison(p)) { | 1275 | if (TestSetPageHWPoison(p)) { |
| @@ -436,67 +436,25 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, · 435 unmodified lines | |||
| 436 | zone_span_writeunlock(zone); | 436 | zone_span_writeunlock(zone); |
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | static void shrink_pgdat_span(struct pglist_data *pgdat, | 439 | static void update_pgdat_span(struct pglist_data *pgdat) |
| 440 | unsigned long start_pfn, unsigned long end_pfn) | ||
| 441 | { | 440 | { |
| 442 | unsigned long pgdat_start_pfn = pgdat->node_start_pfn; | 441 | unsigned long node_start_pfn = 0, node_end_pfn = 0; |
| 443 | unsigned long p = pgdat_end_pfn(pgdat); /* pgdat_end_pfn namespace clash */ | 442 | struct zone *zone; |
| 444 | unsigned long pgdat_end_pfn = p; | ||
| 445 | unsigned long pfn; | ||
| 446 | int nid = pgdat->node_id; | ||
| 447 | |||
| 448 | if (pgdat_start_pfn == start_pfn) { | ||
| 449 | /* | ||
| 450 | * If the section is smallest section in the pgdat, it need | ||
| 451 | * shrink pgdat->node_start_pfn and pgdat->node_spanned_pages. | ||
| 452 | * In this case, we find second smallest valid mem_section | ||
| 453 | * for shrinking zone. | ||
| 454 | */ | ||
| 455 | pfn = find_smallest_section_pfn(nid, NULL, end_pfn, | ||
| 456 | pgdat_end_pfn); | ||
| 457 | if (pfn) { | ||
| 458 | pgdat->node_start_pfn = pfn; | ||
| 459 | pgdat->node_spanned_pages = pgdat_end_pfn - pfn; | ||
| 460 | } | ||
| 461 | } else if (pgdat_end_pfn == end_pfn) { | ||
| 462 | /* | ||
| 463 | * If the section is biggest section in the pgdat, it need | ||
| 464 | * shrink pgdat->node_spanned_pages. | ||
| 465 | * In this case, we find second biggest valid mem_section for | ||
| 466 | * shrinking zone. | ||
| 467 | */ | ||
| 468 | pfn = find_biggest_section_pfn(nid, NULL, pgdat_start_pfn, | ||
| 469 | start_pfn); | ||
| 470 | if (pfn) | ||
| 471 | pgdat->node_spanned_pages = pfn - pgdat_start_pfn + 1; | ||
| 472 | } | ||
| 473 | |||
| 474 | /* | ||
| 475 | * If the section is not biggest or smallest mem_section in the pgdat, | ||
| 476 | * it only creates a hole in the pgdat. So in this case, we need not | ||
| 477 | * change the pgdat. | ||
| 478 | * But perhaps, the pgdat has only hole data. Thus it check the pgdat | ||
| 479 | * has only hole or not. | ||
| 480 | */ | ||
| 481 | pfn = pgdat_start_pfn; | ||
| 482 | for (; pfn < pgdat_end_pfn; pfn += PAGES_PER_SUBSECTION) { | ||
| 483 | if (unlikely(!pfn_valid(pfn))) | ||
| 484 | continue; | ||
| 485 | |||
| 486 | if (pfn_to_nid(pfn) != nid) | ||
| 487 | continue; | ||
| 488 | 443 | ||
| 489 | /* Skip range to be removed */ | 444 | for (zone = pgdat->node_zones; |
| 490 | if (pfn >= start_pfn && pfn < end_pfn) | 445 | zone < pgdat->node_zones + MAX_NR_ZONES; zone++) { |
| 491 | continue; | 446 | unsigned long zone_end_pfn = zone->zone_start_pfn + |
| 447 | zone->spanned_pages; | ||
| 492 | 448 | ||
| 493 | /* If we find valid section, we have nothing to do */ | 449 | /* No need to lock the zones, they can't change. */ |
| 494 | return; | 450 | if (zone_end_pfn > node_end_pfn) |
| 451 | node_end_pfn = zone_end_pfn; | ||
| 452 | if (zone->zone_start_pfn < node_start_pfn) | ||
| 453 | node_start_pfn = zone->zone_start_pfn; | ||
| 495 | } | 454 | } |
| 496 | 455 | ||
| 497 | /* The pgdat has no valid section */ | 456 | pgdat->node_start_pfn = node_start_pfn; |
| 498 | pgdat->node_start_pfn = 0; | 457 | pgdat->node_spanned_pages = node_end_pfn - node_start_pfn; |
| 499 | pgdat->node_spanned_pages = 0; | ||
| 500 | } | 458 | } |
| 501 | 459 | ||
| 502 | static void __remove_zone(struct zone *zone, unsigned long start_pfn, | 460 | static void __remove_zone(struct zone *zone, unsigned long start_pfn, |
| @@ -507,7 +465,7 @@ static void __remove_zone(struct zone *zone, unsigned long start_pfn, · 4 unmodified lines | |||
| 507 | 465 | ||
| 508 | pgdat_resize_lock(zone->zone_pgdat, &flags); | 466 | pgdat_resize_lock(zone->zone_pgdat, &flags); |
| 509 | shrink_zone_span(zone, start_pfn, start_pfn + nr_pages); | 467 | shrink_zone_span(zone, start_pfn, start_pfn + nr_pages); |
| 510 | shrink_pgdat_span(pgdat, start_pfn, start_pfn + nr_pages); | 468 | update_pgdat_span(pgdat); |
| 511 | pgdat_resize_unlock(zone->zone_pgdat, &flags); | 469 | pgdat_resize_unlock(zone->zone_pgdat, &flags); |
| 512 | } | 470 | } |
| 513 | 471 | ||
| @@ -103,6 +103,7 @@ static void dev_pagemap_cleanup(struct dev_pagemap *pgmap) · 102 unmodified lines | |||
| 103 | void memunmap_pages(struct dev_pagemap *pgmap) | 103 | void memunmap_pages(struct dev_pagemap *pgmap) |
| 104 | { | 104 | { |
| 105 | struct resource *res = &pgmap->res; | 105 | struct resource *res = &pgmap->res; |
| 106 | struct page *first_page; | ||
| 106 | unsigned long pfn; | 107 | unsigned long pfn; |
| 107 | int nid; | 108 | int nid; |
| 108 | 109 | ||
| @@ -111,14 +112,16 @@ void memunmap_pages(struct dev_pagemap *pgmap) · 2 unmodified lines | |||
| 111 | put_page(pfn_to_page(pfn)); | 112 | put_page(pfn_to_page(pfn)); |
| 112 | dev_pagemap_cleanup(pgmap); | 113 | dev_pagemap_cleanup(pgmap); |
| 113 | 114 | ||
| 115 | /* make sure to access a memmap that was actually initialized */ | ||
| 116 | first_page = pfn_to_page(pfn_first(pgmap)); | ||
| 117 | |||
| 114 | /* pages are dead and unused, undo the arch mapping */ | 118 | /* pages are dead and unused, undo the arch mapping */ |
| 115 | nid = page_to_nid(pfn_to_page(PHYS_PFN(res->start))); | 119 | nid = page_to_nid(first_page); |
| 116 | 120 | ||
| 117 | mem_hotplug_begin(); | 121 | mem_hotplug_begin(); |
| 118 | if (pgmap->type == MEMORY_DEVICE_PRIVATE) { | 122 | if (pgmap->type == MEMORY_DEVICE_PRIVATE) { |
| 119 | pfn = PHYS_PFN(res->start); | 123 | __remove_pages(page_zone(first_page), PHYS_PFN(res->start), |
| 120 | __remove_pages(page_zone(pfn_to_page(pfn)), pfn, | 124 | PHYS_PFN(resource_size(res)), NULL); |
| 121 | PHYS_PFN(resource_size(res)), NULL); | ||
| 122 | } else { | 125 | } else { |
| 123 | arch_remove_memory(nid, res->start, resource_size(res), | 126 | arch_remove_memory(nid, res->start, resource_size(res), |
| 124 | pgmap_altmap(pgmap)); | 127 | pgmap_altmap(pgmap)); |
| @@ -4473,12 +4473,14 @@ retry_cpuset: · 4472 unmodified lines | |||
| 4473 | if (page) | 4473 | if (page) |
| 4474 | goto got_pg; | 4474 | goto got_pg; |
| 4475 | 4475 | ||
| 4476 | if (order >= pageblock_order && (gfp_mask & __GFP_IO)) { | 4476 | if (order >= pageblock_order && (gfp_mask & __GFP_IO) && |
| 4477 | !(gfp_mask & __GFP_RETRY_MAYFAIL)) { | ||
| 4477 | /* | 4478 | /* |
| 4478 | * If allocating entire pageblock(s) and compaction | 4479 | * If allocating entire pageblock(s) and compaction |
| 4479 | * failed because all zones are below low watermarks | 4480 | * failed because all zones are below low watermarks |
| 4480 | * or is prohibited because it recently failed at this | 4481 | * or is prohibited because it recently failed at this |
| 4481 | * order, fail immediately. | 4482 | * order, fail immediately unless the allocator has |
| 4483 | * requested compaction and reclaim retry. | ||
| 4482 | * | 4484 | * |
| 4483 | * Reclaim is | 4485 | * Reclaim is |
| 4484 | * - potentially very expensive because zones are far | 4486 | * - potentially very expensive because zones are far |
| @@ -67,8 +67,9 @@ static struct page_ext_operations *page_ext_ops[] = { · 66 unmodified lines | |||
| 67 | #endif | 67 | #endif |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | unsigned long page_ext_size = sizeof(struct page_ext); | ||
| 71 | |||
| 70 | static unsigned long total_usage; | 72 | static unsigned long total_usage; |
| 71 | static unsigned long extra_mem; | ||
| 72 | 73 | ||
| 73 | static bool __init invoke_need_callbacks(void) | 74 | static bool __init invoke_need_callbacks(void) |
| 74 | { | 75 | { |
| @@ -78,9 +79,8 @@ static bool __init invoke_need_callbacks(void) · 3 unmodified lines | |||
| 78 | 79 | ||
| 79 | for (i = 0; i < entries; i++) { | 80 | for (i = 0; i < entries; i++) { |
| 80 | if (page_ext_ops[i]->need && page_ext_ops[i]->need()) { | 81 | if (page_ext_ops[i]->need && page_ext_ops[i]->need()) { |
| 81 | page_ext_ops[i]->offset = sizeof(struct page_ext) + | 82 | page_ext_ops[i]->offset = page_ext_size; |
| 82 | extra_mem; | 83 | page_ext_size += page_ext_ops[i]->size; |
| 83 | extra_mem += page_ext_ops[i]->size; | ||
| 84 | need = true; | 84 | need = true; |
| 85 | } | 85 | } |
| 86 | } | 86 | } |
| @@ -99,14 +99,9 @@ static void __init invoke_init_callbacks(void) · 12 unmodified lines | |||
| 99 | } | 99 | } |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | static unsigned long get_entry_size(void) | ||
| 103 | { | ||
| 104 | return sizeof(struct page_ext) + extra_mem; | ||
| 105 | } | ||
| 106 | |||
| 107 | static inline struct page_ext *get_entry(void *base, unsigned long index) | 102 | static inline struct page_ext *get_entry(void *base, unsigned long index) |
| 108 | { | 103 | { |
| 109 | return base + get_entry_size() * index; | 104 | return base + page_ext_size * index; |
| 110 | } | 105 | } |
| 111 | 106 | ||
| 112 | #if !defined(CONFIG_SPARSEMEM) | 107 | #if !defined(CONFIG_SPARSEMEM) |
| @@ -156,7 +151,7 @@ static int __init alloc_node_page_ext(int nid) · 43 unmodified lines | |||
| 156 | !IS_ALIGNED(node_end_pfn(nid), MAX_ORDER_NR_PAGES)) | 151 | !IS_ALIGNED(node_end_pfn(nid), MAX_ORDER_NR_PAGES)) |
| 157 | nr_pages += MAX_ORDER_NR_PAGES; | 152 | nr_pages += MAX_ORDER_NR_PAGES; |
| 158 | 153 | ||
| 159 | table_size = get_entry_size() * nr_pages; | 154 | table_size = page_ext_size * nr_pages; |
| 160 | 155 | ||
| 161 | base = memblock_alloc_try_nid( | 156 | base = memblock_alloc_try_nid( |
| 162 | table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS), | 157 | table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS), |
| @@ -234,7 +229,7 @@ static int __meminit init_section_page_ext(unsigned long pfn, int nid) · 71 unmodified lines | |||
| 234 | if (section->page_ext) | 229 | if (section->page_ext) |
| 235 | return 0; | 230 | return 0; |
| 236 | 231 | ||
| 237 | table_size = get_entry_size() * PAGES_PER_SECTION; | 232 | table_size = page_ext_size * PAGES_PER_SECTION; |
| 238 | base = alloc_page_ext(table_size, nid); | 233 | base = alloc_page_ext(table_size, nid); |
| 239 | 234 | ||
| 240 | /* | 235 | /* |
| @@ -254,7 +249,7 @@ static int __meminit init_section_page_ext(unsigned long pfn, int nid) · 13 unmodified lines | |||
| 254 | * we need to apply a mask. | 249 | * we need to apply a mask. |
| 255 | */ | 250 | */ |
| 256 | pfn &= PAGE_SECTION_MASK; | 251 | pfn &= PAGE_SECTION_MASK; |
| 257 | section->page_ext = (void *)base - get_entry_size() * pfn; | 252 | section->page_ext = (void *)base - page_ext_size * pfn; |
| 258 | total_usage += table_size; | 253 | total_usage += table_size; |
| 259 | return 0; | 254 | return 0; |
| 260 | } | 255 | } |
| @@ -267,7 +262,7 @@ static void free_page_ext(void *addr) · 6 unmodified lines | |||
| 267 | struct page *page = virt_to_page(addr); | 262 | struct page *page = virt_to_page(addr); |
| 268 | size_t table_size; | 263 | size_t table_size; |
| 269 | 264 | ||
| 270 | table_size = get_entry_size() * PAGES_PER_SECTION; | 265 | table_size = page_ext_size * PAGES_PER_SECTION; |
| 271 | 266 | ||
| 272 | BUG_ON(PageReserved(page)); | 267 | BUG_ON(PageReserved(page)); |
| 273 | kmemleak_free(addr); | 268 | kmemleak_free(addr); |
| @@ -24,12 +24,10 @@ struct page_owner { · 23 unmodified lines | |||
| 24 | short last_migrate_reason; | 24 | short last_migrate_reason; |
| 25 | gfp_t gfp_mask; | 25 | gfp_t gfp_mask; |
| 26 | depot_stack_handle_t handle; | 26 | depot_stack_handle_t handle; |
| 27 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
| 28 | depot_stack_handle_t free_handle; | 27 | depot_stack_handle_t free_handle; |
| 29 | #endif | ||
| 30 | }; | 28 | }; |
| 31 | 29 | ||
| 32 | static bool page_owner_disabled = true; | 30 | static bool page_owner_enabled = false; |
| 33 | DEFINE_STATIC_KEY_FALSE(page_owner_inited); | 31 | DEFINE_STATIC_KEY_FALSE(page_owner_inited); |
| 34 | 32 | ||
| 35 | static depot_stack_handle_t dummy_handle; | 33 | static depot_stack_handle_t dummy_handle; |
| @@ -44,7 +42,7 @@ static int __init early_page_owner_param(char *buf) · 8 unmodified lines | |||
| 44 | return -EINVAL; | 42 | return -EINVAL; |
| 45 | 43 | ||
| 46 | if (strcmp(buf, "on") == 0) | 44 | if (strcmp(buf, "on") == 0) |
| 47 | page_owner_disabled = false; | 45 | page_owner_enabled = true; |
| 48 | 46 | ||
| 49 | return 0; | 47 | return 0; |
| 50 | } | 48 | } |
| @@ -52,10 +50,7 @@ early_param("page_owner", early_page_owner_param); · 1 unmodified line | |||
| 52 | 50 | ||
| 53 | static bool need_page_owner(void) | 51 | static bool need_page_owner(void) |
| 54 | { | 52 | { |
| 55 | if (page_owner_disabled) | 53 | return page_owner_enabled; |
| 56 | return false; | ||
| 57 | |||
| 58 | return true; | ||
| 59 | } | 54 | } |
| 60 | 55 | ||
| 61 | static __always_inline depot_stack_handle_t create_dummy_stack(void) | 56 | static __always_inline depot_stack_handle_t create_dummy_stack(void) |
| @@ -84,7 +79,7 @@ static noinline void register_early_stack(void) · 22 unmodified lines | |||
| 84 | 79 | ||
| 85 | static void init_page_owner(void) | 80 | static void init_page_owner(void) |
| 86 | { | 81 | { |
| 87 | if (page_owner_disabled) | 82 | if (!page_owner_enabled) |
| 88 | return; | 83 | return; |
| 89 | 84 | ||
| 90 | register_dummy_stack(); | 85 | register_dummy_stack(); |
| @@ -148,25 +143,19 @@ void __reset_page_owner(struct page *page, unsigned int order) · 57 unmodified lines | |||
| 148 | { | 143 | { |
| 149 | int i; | 144 | int i; |
| 150 | struct page_ext *page_ext; | 145 | struct page_ext *page_ext; |
| 151 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
| 152 | depot_stack_handle_t handle = 0; | 146 | depot_stack_handle_t handle = 0; |
| 153 | struct page_owner *page_owner; | 147 | struct page_owner *page_owner; |
| 154 | 148 | ||
| 155 | if (debug_pagealloc_enabled()) | 149 | handle = save_stack(GFP_NOWAIT | __GFP_NOWARN); |
| 156 | handle = save_stack(GFP_NOWAIT | __GFP_NOWARN); | ||
| 157 | #endif | ||
| 158 | 150 | ||
| 151 | page_ext = lookup_page_ext(page); | ||
| 152 | if (unlikely(!page_ext)) | ||
| 153 | return; | ||
| 159 | for (i = 0; i < (1 << order); i++) { | 154 | for (i = 0; i < (1 << order); i++) { |
| 160 | page_ext = lookup_page_ext(page + i); | 155 | __clear_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags); |
| 161 | if (unlikely(!page_ext)) | 156 | page_owner = get_page_owner(page_ext); |
| 162 | continue; | 157 | page_owner->free_handle = handle; |
| 163 | __clear_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags); | 158 | page_ext = page_ext_next(page_ext); |
| 164 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
| 165 | if (debug_pagealloc_enabled()) { | ||
| 166 | page_owner = get_page_owner(page_ext); | ||
| 167 | page_owner->free_handle = handle; | ||
| 168 | } | ||
| 169 | #endif | ||
| 170 | } | 159 | } |
| 171 | } | 160 | } |
| 172 | 161 | ||
| @@ -184,9 +173,9 @@ static inline void __set_page_owner_handle(struct page *page, · 11 unmodified lines | |||
| 184 | page_owner->gfp_mask = gfp_mask; | 173 | page_owner->gfp_mask = gfp_mask; |
| 185 | page_owner->last_migrate_reason = -1; | 174 | page_owner->last_migrate_reason = -1; |
| 186 | __set_bit(PAGE_EXT_OWNER, &page_ext->flags); | 175 | __set_bit(PAGE_EXT_OWNER, &page_ext->flags); |
| 187 | __set_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags); | 176 | __set_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags); |
| 188 | 177 | ||
| 189 | page_ext = lookup_page_ext(page + i); | 178 | page_ext = page_ext_next(page_ext); |
| 190 | } | 179 | } |
| 191 | } | 180 | } |
| 192 | 181 | ||
| @@ -224,12 +213,10 @@ void __split_page_owner(struct page *page, unsigned int order) · 31 unmodified lines | |||
| 224 | if (unlikely(!page_ext)) | 213 | if (unlikely(!page_ext)) |
| 225 | return; | 214 | return; |
| 226 | 215 | ||
| 227 | page_owner = get_page_owner(page_ext); | 216 | for (i = 0; i < (1 << order); i++) { |
| 228 | page_owner->order = 0; | ||
| 229 | for (i = 1; i < (1 << order); i++) { | ||
| 230 | page_ext = lookup_page_ext(page + i); | ||
| 231 | page_owner = get_page_owner(page_ext); | 217 | page_owner = get_page_owner(page_ext); |
| 232 | page_owner->order = 0; | 218 | page_owner->order = 0; |
| 219 | page_ext = page_ext_next(page_ext); | ||
| 233 | } | 220 | } |
| 234 | } | 221 | } |
| 235 | 222 | ||
| @@ -260,7 +247,7 @@ void __copy_page_owner(struct page *oldpage, struct page *newpage) · 24 unmodified lines | |||
| 260 | * the new page, which will be freed. | 247 | * the new page, which will be freed. |
| 261 | */ | 248 | */ |
| 262 | __set_bit(PAGE_EXT_OWNER, &new_ext->flags); | 249 | __set_bit(PAGE_EXT_OWNER, &new_ext->flags); |
| 263 | __set_bit(PAGE_EXT_OWNER_ACTIVE, &new_ext->flags); | 250 | __set_bit(PAGE_EXT_OWNER_ALLOCATED, &new_ext->flags); |
| 264 | } | 251 | } |
| 265 | 252 | ||
| 266 | void pagetypeinfo_showmixedcount_print(struct seq_file *m, | 253 | void pagetypeinfo_showmixedcount_print(struct seq_file *m, |
| @@ -284,7 +271,8 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m, · 17 unmodified lines | |||
| 284 | * not matter as the mixed block count will still be correct | 271 | * not matter as the mixed block count will still be correct |
| 285 | */ | 272 | */ |
| 286 | for (; pfn < end_pfn; ) { | 273 | for (; pfn < end_pfn; ) { |
| 287 | if (!pfn_valid(pfn)) { | 274 | page = pfn_to_online_page(pfn); |
| 275 | if (!page) { | ||
| 288 | pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES); | 276 | pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES); |
| 289 | continue; | 277 | continue; |
| 290 | } | 278 | } |
| @@ -292,13 +280,13 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m, · 1 unmodified line | |||
| 292 | block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); | 280 | block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); |
| 293 | block_end_pfn = min(block_end_pfn, end_pfn); | 281 | block_end_pfn = min(block_end_pfn, end_pfn); |
| 294 | 282 | ||
| 295 | page = pfn_to_page(pfn); | ||
| 296 | pageblock_mt = get_pageblock_migratetype(page); | 283 | pageblock_mt = get_pageblock_migratetype(page); |
| 297 | 284 | ||
| 298 | for (; pfn < block_end_pfn; pfn++) { | 285 | for (; pfn < block_end_pfn; pfn++) { |
| 299 | if (!pfn_valid_within(pfn)) | 286 | if (!pfn_valid_within(pfn)) |
| 300 | continue; | 287 | continue; |
| 301 | 288 | ||
| 289 | /* The pageblock is online, no need to recheck. */ | ||
| 302 | page = pfn_to_page(pfn); | 290 | page = pfn_to_page(pfn); |
| 303 | 291 | ||
| 304 | if (page_zone(page) != zone) | 292 | if (page_zone(page) != zone) |
| @@ -320,7 +308,7 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m, · 15 unmodified lines | |||
| 320 | if (unlikely(!page_ext)) | 308 | if (unlikely(!page_ext)) |
| 321 | continue; | 309 | continue; |
| 322 | 310 | ||
| 323 | if (!test_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags)) | 311 | if (!test_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags)) |
| 324 | continue; | 312 | continue; |
| 325 | 313 | ||
| 326 | page_owner = get_page_owner(page_ext); | 314 | page_owner = get_page_owner(page_ext); |
| @@ -435,7 +423,7 @@ void __dump_page_owner(struct page *page) · 108 unmodified lines | |||
| 435 | return; | 423 | return; |
| 436 | } | 424 | } |
| 437 | 425 | ||
| 438 | if (test_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags)) | 426 | if (test_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags)) |
| 439 | pr_alert("page_owner tracks the page as allocated\n"); | 427 | pr_alert("page_owner tracks the page as allocated\n"); |
| 440 | else | 428 | else |
| 441 | pr_alert("page_owner tracks the page as freed\n"); | 429 | pr_alert("page_owner tracks the page as freed\n"); |
| @@ -451,7 +439,6 @@ void __dump_page_owner(struct page *page) · 9 unmodified lines | |||
| 451 | stack_trace_print(entries, nr_entries, 0); | 439 | stack_trace_print(entries, nr_entries, 0); |
| 452 | } | 440 | } |
| 453 | 441 | ||
| 454 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
| 455 | handle = READ_ONCE(page_owner->free_handle); | 442 | handle = READ_ONCE(page_owner->free_handle); |
| 456 | if (!handle) { | 443 | if (!handle) { |
| 457 | pr_alert("page_owner free stack trace missing\n"); | 444 | pr_alert("page_owner free stack trace missing\n"); |
| @@ -460,7 +447,6 @@ void __dump_page_owner(struct page *page) · 2 unmodified lines | |||
| 460 | pr_alert("page last free stack trace:\n"); | 447 | pr_alert("page last free stack trace:\n"); |
| 461 | stack_trace_print(entries, nr_entries, 0); | 448 | stack_trace_print(entries, nr_entries, 0); |
| 462 | } | 449 | } |
| 463 | #endif | ||
| 464 | 450 | ||
| 465 | if (page_owner->last_migrate_reason != -1) | 451 | if (page_owner->last_migrate_reason != -1) |
| 466 | pr_alert("page has been migrated, last migrate reason: %s\n", | 452 | pr_alert("page has been migrated, last migrate reason: %s\n", |
| @@ -527,7 +513,7 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) · 60 unmodified lines | |||
| 527 | * Although we do have the info about past allocation of free | 513 | * Although we do have the info about past allocation of free |
| 528 | * pages, it's not relevant for current memory usage. | 514 | * pages, it's not relevant for current memory usage. |
| 529 | */ | 515 | */ |
| 530 | if (!test_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags)) | 516 | if (!test_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags)) |
| 531 | continue; | 517 | continue; |
| 532 | 518 | ||
| 533 | page_owner = get_page_owner(page_ext); | 519 | page_owner = get_page_owner(page_ext); |
| @@ -61,6 +61,7 @@ · 60 unmodified lines | |||
| 61 | #include <linux/mmu_notifier.h> | 61 | #include <linux/mmu_notifier.h> |
| 62 | #include <linux/migrate.h> | 62 | #include <linux/migrate.h> |
| 63 | #include <linux/hugetlb.h> | 63 | #include <linux/hugetlb.h> |
| 64 | #include <linux/huge_mm.h> | ||
| 64 | #include <linux/backing-dev.h> | 65 | #include <linux/backing-dev.h> |
| 65 | #include <linux/page_idle.h> | 66 | #include <linux/page_idle.h> |
| 66 | #include <linux/memremap.h> | 67 | #include <linux/memremap.h> |
| @@ -4206,9 +4206,12 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page *page, · 4205 unmodified lines | |||
| 4206 | 4206 | ||
| 4207 | /** | 4207 | /** |
| 4208 | * __ksize -- Uninstrumented ksize. | 4208 | * __ksize -- Uninstrumented ksize. |
| 4209 | * @objp: pointer to the object | ||
| 4209 | * | 4210 | * |
| 4210 | * Unlike ksize(), __ksize() is uninstrumented, and does not provide the same | 4211 | * Unlike ksize(), __ksize() is uninstrumented, and does not provide the same |
| 4211 | * safety checks as ksize() with KASAN instrumentation enabled. | 4212 | * safety checks as ksize() with KASAN instrumentation enabled. |
| 4213 | * | ||
| 4214 | * Return: size of the actual memory used by @objp in bytes | ||
| 4212 | */ | 4215 | */ |
| 4213 | size_t __ksize(const void *objp) | 4216 | size_t __ksize(const void *objp) |
| 4214 | { | 4217 | { |
| @@ -178,10 +178,13 @@ static int init_memcg_params(struct kmem_cache *s, · 177 unmodified lines | |||
| 178 | 178 | ||
| 179 | static void destroy_memcg_params(struct kmem_cache *s) | 179 | static void destroy_memcg_params(struct kmem_cache *s) |
| 180 | { | 180 | { |
| 181 | if (is_root_cache(s)) | 181 | if (is_root_cache(s)) { |
| 182 | kvfree(rcu_access_pointer(s->memcg_params.memcg_caches)); | 182 | kvfree(rcu_access_pointer(s->memcg_params.memcg_caches)); |
| 183 | else | 183 | } else { |
| 184 | mem_cgroup_put(s->memcg_params.memcg); | ||
| 185 | WRITE_ONCE(s->memcg_params.memcg, NULL); | ||
| 184 | percpu_ref_exit(&s->memcg_params.refcnt); | 186 | percpu_ref_exit(&s->memcg_params.refcnt); |
| 187 | } | ||
| 185 | } | 188 | } |
| 186 | 189 | ||
| 187 | static void free_memcg_params(struct rcu_head *rcu) | 190 | static void free_memcg_params(struct rcu_head *rcu) |
| @@ -253,8 +256,6 @@ static void memcg_unlink_cache(struct kmem_cache *s) · 65 unmodified lines | |||
| 253 | } else { | 256 | } else { |
| 254 | list_del(&s->memcg_params.children_node); | 257 | list_del(&s->memcg_params.children_node); |
| 255 | list_del(&s->memcg_params.kmem_caches_node); | 258 | list_del(&s->memcg_params.kmem_caches_node); |
| 256 | mem_cgroup_put(s->memcg_params.memcg); | ||
| 257 | WRITE_ONCE(s->memcg_params.memcg, NULL); | ||
| 258 | } | 259 | } |
| 259 | } | 260 | } |
| 260 | #else | 261 | #else |
| @@ -2671,6 +2671,17 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, · 2670 unmodified lines | |||
| 2671 | return p; | 2671 | return p; |
| 2672 | } | 2672 | } |
| 2673 | 2673 | ||
| 2674 | /* | ||
| 2675 | * If the object has been wiped upon free, make sure it's fully initialized by | ||
| 2676 | * zeroing out freelist pointer. | ||
| 2677 | */ | ||
| 2678 | static __always_inline void maybe_wipe_obj_freeptr(struct kmem_cache *s, | ||
| 2679 | void *obj) | ||
| 2680 | { | ||
| 2681 | if (unlikely(slab_want_init_on_free(s)) && obj) | ||
| 2682 | memset((void *)((char *)obj + s->offset), 0, sizeof(void *)); | ||
| 2683 | } | ||
| 2684 | |||
| 2674 | /* | 2685 | /* |
| 2675 | * Inlined fastpath so that allocation functions (kmalloc, kmem_cache_alloc) | 2686 | * Inlined fastpath so that allocation functions (kmalloc, kmem_cache_alloc) |
| 2676 | * have the fastpath folded into their functions. So no function call | 2687 | * have the fastpath folded into their functions. So no function call |
| @@ -2759,12 +2770,8 @@ redo: · 82 unmodified lines | |||
| 2759 | prefetch_freepointer(s, next_object); | 2770 | prefetch_freepointer(s, next_object); |
| 2760 | stat(s, ALLOC_FASTPATH); | 2771 | stat(s, ALLOC_FASTPATH); |
| 2761 | } | 2772 | } |
| 2762 | /* | 2773 | |
| 2763 | * If the object has been wiped upon free, make sure it's fully | 2774 | maybe_wipe_obj_freeptr(s, object); |
| 2764 | * initialized by zeroing out freelist pointer. | ||
| 2765 | */ | ||
| 2766 | if (unlikely(slab_want_init_on_free(s)) && object) | ||
| 2767 | memset(object + s->offset, 0, sizeof(void *)); | ||
| 2768 | 2775 | ||
| 2769 | if (unlikely(slab_want_init_on_alloc(gfpflags, s)) && object) | 2776 | if (unlikely(slab_want_init_on_alloc(gfpflags, s)) && object) |
| 2770 | memset(object, 0, s->object_size); | 2777 | memset(object, 0, s->object_size); |
| @@ -3178,10 +3185,13 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, · 407 unmodified lines | |||
| 3178 | goto error; | 3185 | goto error; |
| 3179 | 3186 | ||
| 3180 | c = this_cpu_ptr(s->cpu_slab); | 3187 | c = this_cpu_ptr(s->cpu_slab); |
| 3188 | maybe_wipe_obj_freeptr(s, p[i]); | ||
| 3189 | |||
| 3181 | continue; /* goto for-loop */ | 3190 | continue; /* goto for-loop */ |
| 3182 | } | 3191 | } |
| 3183 | c->freelist = get_freepointer(s, object); | 3192 | c->freelist = get_freepointer(s, object); |
| 3184 | p[i] = object; | 3193 | p[i] = object; |
| 3194 | maybe_wipe_obj_freeptr(s, p[i]); | ||
| 3185 | } | 3195 | } |
| 3186 | c->tid = next_tid(c->tid); | 3196 | c->tid = next_tid(c->tid); |
| 3187 | local_irq_enable(); | 3197 | local_irq_enable(); |
| @@ -4846,7 +4856,17 @@ static ssize_t show_slab_objects(struct kmem_cache *s, · 1658 unmodified lines | |||
| 4846 | } | 4856 | } |
| 4847 | } | 4857 | } |
| 4848 | 4858 | ||
| 4849 | get_online_mems(); | 4859 | /* |
| 4860 | * It is impossible to take "mem_hotplug_lock" here with "kernfs_mutex" | ||
| 4861 | * already held which will conflict with an existing lock order: | ||
| 4862 | * | ||
| 4863 | * mem_hotplug_lock->slab_mutex->kernfs_mutex | ||
| 4864 | * | ||
| 4865 | * We don't really need mem_hotplug_lock (to hold off | ||
| 4866 | * slab_mem_going_offline_callback) here because slab's memory hot | ||
| 4867 | * unplug code doesn't destroy the kmem_cache->node[] data. | ||
| 4868 | */ | ||
| 4869 | |||
| 4850 | #ifdef CONFIG_SLUB_DEBUG | 4870 | #ifdef CONFIG_SLUB_DEBUG |
| 4851 | if (flags & SO_ALL) { | 4871 | if (flags & SO_ALL) { |
| 4852 | struct kmem_cache_node *n; | 4872 | struct kmem_cache_node *n; |
| @@ -4887,7 +4907,6 @@ static ssize_t show_slab_objects(struct kmem_cache *s, · 34 unmodified lines | |||
| 4887 | x += sprintf(buf + x, " N%d=%lu", | 4907 | x += sprintf(buf + x, " N%d=%lu", |
| 4888 | node, nodes[node]); | 4908 | node, nodes[node]); |
| 4889 | #endif | 4909 | #endif |
| 4890 | put_online_mems(); | ||
| 4891 | kfree(nodes); | 4910 | kfree(nodes); |
| 4892 | return x + sprintf(buf + x, "\n"); | 4911 | return x + sprintf(buf + x, "\n"); |
| 4893 | } | 4912 | } |
| @@ -592,6 +592,16 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping, · 591 unmodified lines | |||
| 592 | unlock_page(page); | 592 | unlock_page(page); |
| 593 | continue; | 593 | continue; |
| 594 | } | 594 | } |
| 595 | |||
| 596 | /* Take a pin outside pagevec */ | ||
| 597 | get_page(page); | ||
| 598 | |||
| 599 | /* | ||
| 600 | * Drop extra pins before trying to invalidate | ||
| 601 | * the huge page. | ||
| 602 | */ | ||
| 603 | pagevec_remove_exceptionals(&pvec); | ||
| 604 | pagevec_release(&pvec); | ||
| 595 | } | 605 | } |
| 596 | 606 | ||
| 597 | ret = invalidate_inode_page(page); | 607 | ret = invalidate_inode_page(page); |
| @@ -602,6 +612,8 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping, · 4 unmodified lines | |||
| 602 | */ | 612 | */ |
| 603 | if (!ret) | 613 | if (!ret) |
| 604 | deactivate_file_page(page); | 614 | deactivate_file_page(page); |
| 615 | if (PageTransHuge(page)) | ||
| 616 | put_page(page); | ||
| 605 | count += ret; | 617 | count += ret; |
| 606 | } | 618 | } |
| 607 | pagevec_remove_exceptionals(&pvec); | 619 | pagevec_remove_exceptionals(&pvec); |
| @@ -351,12 +351,13 @@ unsigned long zone_reclaimable_pages(struct zone *zone) · 350 unmodified lines | |||
| 351 | */ | 351 | */ |
| 352 | unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) | 352 | unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx) |
| 353 | { | 353 | { |
| 354 | unsigned long lru_size; | 354 | unsigned long lru_size = 0; |
| 355 | int zid; | 355 | int zid; |
| 356 | 356 | ||
| 357 | if (!mem_cgroup_disabled()) | 357 | if (!mem_cgroup_disabled()) { |
| 358 | lru_size = lruvec_page_state_local(lruvec, NR_LRU_BASE + lru); | 358 | for (zid = 0; zid < MAX_NR_ZONES; zid++) |
| 359 | else | 359 | lru_size += mem_cgroup_get_zone_lru_size(lruvec, lru, zid); |
| 360 | } else | ||
| 360 | lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru); | 361 | lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru); |
| 361 | 362 | ||
| 362 | for (zid = zone_idx + 1; zid < MAX_NR_ZONES; zid++) { | 363 | for (zid = zone_idx + 1; zid < MAX_NR_ZONES; zid++) { |
| @@ -932,10 +933,7 @@ static int __remove_mapping(struct address_space *mapping, struct page *page, · 569 unmodified lines | |||
| 932 | * Note that if SetPageDirty is always performed via set_page_dirty, | 933 | * Note that if SetPageDirty is always performed via set_page_dirty, |
| 933 | * and thus under the i_pages lock, then this ordering is not required. | 934 | * and thus under the i_pages lock, then this ordering is not required. |
| 934 | */ | 935 | */ |
| 935 | if (unlikely(PageTransHuge(page)) && PageSwapCache(page)) | 936 | refcount = 1 + compound_nr(page); |
| 936 | refcount = 1 + HPAGE_PMD_NR; | ||
| 937 | else | ||
| 938 | refcount = 2; | ||
| 939 | if (!page_ref_freeze(page, refcount)) | 937 | if (!page_ref_freeze(page, refcount)) |
| 940 | goto cannot_free; | 938 | goto cannot_free; |
| 941 | /* note: atomic_cmpxchg in page_ref_freeze provides the smp_rmb */ | 939 | /* note: atomic_cmpxchg in page_ref_freeze provides the smp_rmb */ |
| @@ -33,6 +33,7 @@ static int nf_br_ip_fragment(struct net *net, struct sock *sk, · 32 unmodified lines | |||
| 33 | { | 33 | { |
| 34 | int frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size; | 34 | int frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size; |
| 35 | unsigned int hlen, ll_rs, mtu; | 35 | unsigned int hlen, ll_rs, mtu; |
| 36 | ktime_t tstamp = skb->tstamp; | ||
| 36 | struct ip_frag_state state; | 37 | struct ip_frag_state state; |
| 37 | struct iphdr *iph; | 38 | struct iphdr *iph; |
| 38 | int err; | 39 | int err; |
| @@ -80,6 +81,7 @@ static int nf_br_ip_fragment(struct net *net, struct sock *sk, · 41 unmodified lines | |||
| 80 | if (iter.frag) | 81 | if (iter.frag) |
| 81 | ip_fraglist_prepare(skb, &iter); | 82 | ip_fraglist_prepare(skb, &iter); |
| 82 | 83 | ||
| 84 | skb->tstamp = tstamp; | ||
| 83 | err = output(net, sk, data, skb); | 85 | err = output(net, sk, data, skb); |
| 84 | if (err || !iter.frag) | 86 | if (err || !iter.frag) |
| 85 | break; | 87 | break; |
| @@ -104,6 +106,7 @@ slow_path: · 18 unmodified lines | |||
| 104 | goto blackhole; | 106 | goto blackhole; |
| 105 | } | 107 | } |
| 106 | 108 | ||
| 109 | skb2->tstamp = tstamp; | ||
| 107 | err = output(net, sk, data, skb2); | 110 | err = output(net, sk, data, skb2); |
| 108 | if (err) | 111 | if (err) |
| 109 | goto blackhole; | 112 | goto blackhole; |
| @@ -640,7 +640,7 @@ int __zerocopy_sg_from_iter(struct sock *sk, struct sk_buff *skb, · 639 unmodified lines | |||
| 640 | skb->len += copied; | 640 | skb->len += copied; |
| 641 | skb->truesize += truesize; | 641 | skb->truesize += truesize; |
| 642 | if (sk && sk->sk_type == SOCK_STREAM) { | 642 | if (sk && sk->sk_type == SOCK_STREAM) { |
| 643 | sk->sk_wmem_queued += truesize; | 643 | sk_wmem_queued_add(sk, truesize); |
| 644 | sk_mem_charge(sk, truesize); | 644 | sk_mem_charge(sk, truesize); |
| 645 | } else { | 645 | } else { |
| 646 | refcount_add(truesize, &skb->sk->sk_wmem_alloc); | 646 | refcount_add(truesize, &skb->sk->sk_wmem_alloc); |
| @@ -4252,12 +4252,14 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, · 4251 unmodified lines | |||
| 4252 | case SO_RCVBUF: | 4252 | case SO_RCVBUF: |
| 4253 | val = min_t(u32, val, sysctl_rmem_max); | 4253 | val = min_t(u32, val, sysctl_rmem_max); |
| 4254 | sk->sk_userlocks |= SOCK_RCVBUF_LOCK; | 4254 | sk->sk_userlocks |= SOCK_RCVBUF_LOCK; |
| 4255 | sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF); | 4255 | WRITE_ONCE(sk->sk_rcvbuf, |
| 4256 | max_t(int, val * 2, SOCK_MIN_RCVBUF)); | ||
| 4256 | break; | 4257 | break; |
| 4257 | case SO_SNDBUF: | 4258 | case SO_SNDBUF: |
| 4258 | val = min_t(u32, val, sysctl_wmem_max); | 4259 | val = min_t(u32, val, sysctl_wmem_max); |
| 4259 | sk->sk_userlocks |= SOCK_SNDBUF_LOCK; | 4260 | sk->sk_userlocks |= SOCK_SNDBUF_LOCK; |
| 4260 | sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF); | 4261 | WRITE_ONCE(sk->sk_sndbuf, |
| 4262 | max_t(int, val * 2, SOCK_MIN_SNDBUF)); | ||
| 4261 | break; | 4263 | break; |
| 4262 | case SO_MAX_PACING_RATE: /* 32bit version */ | 4264 | case SO_MAX_PACING_RATE: /* 32bit version */ |
| 4263 | if (val != ~0U) | 4265 | if (val != ~0U) |
| @@ -4274,7 +4276,7 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, · 10 unmodified lines | |||
| 4274 | case SO_RCVLOWAT: | 4276 | case SO_RCVLOWAT: |
| 4275 | if (val < 0) | 4277 | if (val < 0) |
| 4276 | val = INT_MAX; | 4278 | val = INT_MAX; |
| 4277 | sk->sk_rcvlowat = val ? : 1; | 4279 | WRITE_ONCE(sk->sk_rcvlowat, val ? : 1); |
| 4278 | break; | 4280 | break; |
| 4279 | case SO_MARK: | 4281 | case SO_MARK: |
| 4280 | if (sk->sk_mark != val) { | 4282 | if (sk->sk_mark != val) { |
| @@ -245,7 +245,8 @@ static int __peernet2id(struct net *net, struct net *peer) · 244 unmodified lines | |||
| 245 | return __peernet2id_alloc(net, peer, &no); | 245 | return __peernet2id_alloc(net, peer, &no); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | static void rtnl_net_notifyid(struct net *net, int cmd, int id); | 248 | static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid, |
| 249 | struct nlmsghdr *nlh); | ||
| 249 | /* This function returns the id of a peer netns. If no id is assigned, one will | 250 | /* This function returns the id of a peer netns. If no id is assigned, one will |
| 250 | * be allocated and returned. | 251 | * be allocated and returned. |
| 251 | */ | 252 | */ |
| @@ -268,7 +269,7 @@ int peernet2id_alloc(struct net *net, struct net *peer) · 16 unmodified lines | |||
| 268 | id = __peernet2id_alloc(net, peer, &alloc); | 269 | id = __peernet2id_alloc(net, peer, &alloc); |
| 269 | spin_unlock_bh(&net->nsid_lock); | 270 | spin_unlock_bh(&net->nsid_lock); |
| 270 | if (alloc && id >= 0) | 271 | if (alloc && id >= 0) |
| 271 | rtnl_net_notifyid(net, RTM_NEWNSID, id); | 272 | rtnl_net_notifyid(net, RTM_NEWNSID, id, 0, NULL); |
| 272 | if (alive) | 273 | if (alive) |
| 273 | put_net(peer); | 274 | put_net(peer); |
| 274 | return id; | 275 | return id; |
| @@ -532,7 +533,7 @@ static void unhash_nsid(struct net *net, struct net *last) · 257 unmodified lines | |||
| 532 | idr_remove(&tmp->netns_ids, id); | 533 | idr_remove(&tmp->netns_ids, id); |
| 533 | spin_unlock_bh(&tmp->nsid_lock); | 534 | spin_unlock_bh(&tmp->nsid_lock); |
| 534 | if (id >= 0) | 535 | if (id >= 0) |
| 535 | rtnl_net_notifyid(tmp, RTM_DELNSID, id); | 536 | rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL); |
| 536 | if (tmp == last) | 537 | if (tmp == last) |
| 537 | break; | 538 | break; |
| 538 | } | 539 | } |
| @@ -764,7 +765,8 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, · 225 unmodified lines | |||
| 764 | err = alloc_netid(net, peer, nsid); | 765 | err = alloc_netid(net, peer, nsid); |
| 765 | spin_unlock_bh(&net->nsid_lock); | 766 | spin_unlock_bh(&net->nsid_lock); |
| 766 | if (err >= 0) { | 767 | if (err >= 0) { |
| 767 | rtnl_net_notifyid(net, RTM_NEWNSID, err); | 768 | rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid, |
| 769 | nlh); | ||
| 768 | err = 0; | 770 | err = 0; |
| 769 | } else if (err == -ENOSPC && nsid >= 0) { | 771 | } else if (err == -ENOSPC && nsid >= 0) { |
| 770 | err = -EEXIST; | 772 | err = -EEXIST; |
| @@ -1051,9 +1053,12 @@ end: · 280 unmodified lines | |||
| 1051 | return err < 0 ? err : skb->len; | 1053 | return err < 0 ? err : skb->len; |
| 1052 | } | 1054 | } |
| 1053 | 1055 | ||
| 1054 | static void rtnl_net_notifyid(struct net *net, int cmd, int id) | 1056 | static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid, |
| 1057 | struct nlmsghdr *nlh) | ||
| 1055 | { | 1058 | { |
| 1056 | struct net_fill_args fillargs = { | 1059 | struct net_fill_args fillargs = { |
| 1060 | .portid = portid, | ||
| 1061 | .seq = nlh ? nlh->nlmsg_seq : 0, | ||
| 1057 | .cmd = cmd, | 1062 | .cmd = cmd, |
| 1058 | .nsid = id, | 1063 | .nsid = id, |
| 1059 | }; | 1064 | }; |
| @@ -1068,7 +1073,7 @@ static void rtnl_net_notifyid(struct net *net, int cmd, int id) · 8 unmodified lines | |||
| 1068 | if (err < 0) | 1073 | if (err < 0) |
| 1069 | goto err_out; | 1074 | goto err_out; |
| 1070 | 1075 | ||
| 1071 | rtnl_notify(msg, net, 0, RTNLGRP_NSID, NULL, 0); | 1076 | rtnl_notify(msg, net, portid, RTNLGRP_NSID, nlh, 0); |
| 1072 | return; | 1077 | return; |
| 1073 | 1078 | ||
| 1074 | err_out: | 1079 | err_out: |
| @@ -96,7 +96,7 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req, · 95 unmodified lines | |||
| 96 | 96 | ||
| 97 | fastopenq = &inet_csk(lsk)->icsk_accept_queue.fastopenq; | 97 | fastopenq = &inet_csk(lsk)->icsk_accept_queue.fastopenq; |
| 98 | 98 | ||
| 99 | tcp_sk(sk)->fastopen_rsk = NULL; | 99 | RCU_INIT_POINTER(tcp_sk(sk)->fastopen_rsk, NULL); |
| 100 | spin_lock_bh(&fastopenq->lock); | 100 | spin_lock_bh(&fastopenq->lock); |
| 101 | fastopenq->qlen--; | 101 | fastopenq->qlen--; |
| 102 | tcp_rsk(req)->tfo_listener = false; | 102 | tcp_rsk(req)->tfo_listener = false; |
| @@ -4415,7 +4415,7 @@ static void skb_set_err_queue(struct sk_buff *skb) · 4414 unmodified lines | |||
| 4415 | int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | 4415 | int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) |
| 4416 | { | 4416 | { |
| 4417 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= | 4417 | if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= |
| 4418 | (unsigned int)sk->sk_rcvbuf) | 4418 | (unsigned int)READ_ONCE(sk->sk_rcvbuf)) |
| 4419 | return -ENOMEM; | 4419 | return -ENOMEM; |
| 4420 | 4420 | ||
| 4421 | skb_orphan(skb); | 4421 | skb_orphan(skb); |
| @@ -5477,12 +5477,14 @@ static void skb_mod_eth_type(struct sk_buff *skb, struct ethhdr *hdr, · 1055 unmodified lines | |||
| 5477 | * @skb: buffer | 5477 | * @skb: buffer |
| 5478 | * @mpls_lse: MPLS label stack entry to push | 5478 | * @mpls_lse: MPLS label stack entry to push |
| 5479 | * @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848) | 5479 | * @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848) |
| 5480 | * @mac_len: length of the MAC header | ||
| 5480 | * | 5481 | * |
| 5481 | * Expects skb->data at mac header. | 5482 | * Expects skb->data at mac header. |
| 5482 | * | 5483 | * |
| 5483 | * Returns 0 on success, -errno otherwise. | 5484 | * Returns 0 on success, -errno otherwise. |
| 5484 | */ | 5485 | */ |
| 5485 | int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto) | 5486 | int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, |
| 5487 | int mac_len) | ||
| 5486 | { | 5488 | { |
| 5487 | struct mpls_shim_hdr *lse; | 5489 | struct mpls_shim_hdr *lse; |
| 5488 | int err; | 5490 | int err; |
| @@ -5499,15 +5501,15 @@ int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto) · 10 unmodified lines | |||
| 5499 | return err; | 5501 | return err; |
| 5500 | 5502 | ||
| 5501 | if (!skb->inner_protocol) { | 5503 | if (!skb->inner_protocol) { |
| 5502 | skb_set_inner_network_header(skb, skb->mac_len); | 5504 | skb_set_inner_network_header(skb, mac_len); |
| 5503 | skb_set_inner_protocol(skb, skb->protocol); | 5505 | skb_set_inner_protocol(skb, skb->protocol); |
| 5504 | } | 5506 | } |
| 5505 | 5507 | ||
| 5506 | skb_push(skb, MPLS_HLEN); | 5508 | skb_push(skb, MPLS_HLEN); |
| 5507 | memmove(skb_mac_header(skb) - MPLS_HLEN, skb_mac_header(skb), | 5509 | memmove(skb_mac_header(skb) - MPLS_HLEN, skb_mac_header(skb), |
| 5508 | skb->mac_len); | 5510 | mac_len); |
| 5509 | skb_reset_mac_header(skb); | 5511 | skb_reset_mac_header(skb); |
| 5510 | skb_set_network_header(skb, skb->mac_len); | 5512 | skb_set_network_header(skb, mac_len); |
| 5511 | 5513 | ||
| 5512 | lse = mpls_hdr(skb); | 5514 | lse = mpls_hdr(skb); |
| 5513 | lse->label_stack_entry = mpls_lse; | 5515 | lse->label_stack_entry = mpls_lse; |
| @@ -5526,29 +5528,30 @@ EXPORT_SYMBOL_GPL(skb_mpls_push); · 12 unmodified lines | |||
| 5526 | * | 5528 | * |
| 5527 | * @skb: buffer | 5529 | * @skb: buffer |
| 5528 | * @next_proto: ethertype of header after popped MPLS header | 5530 | * @next_proto: ethertype of header after popped MPLS header |
| 5531 | * @mac_len: length of the MAC header | ||
| 5529 | * | 5532 | * |
| 5530 | * Expects skb->data at mac header. | 5533 | * Expects skb->data at mac header. |
| 5531 | * | 5534 | * |
| 5532 | * Returns 0 on success, -errno otherwise. | 5535 | * Returns 0 on success, -errno otherwise. |
| 5533 | */ | 5536 | */ |
| 5534 | int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto) | 5537 | int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len) |
| 5535 | { | 5538 | { |
| 5536 | int err; | 5539 | int err; |
| 5537 | 5540 | ||
| 5538 | if (unlikely(!eth_p_mpls(skb->protocol))) | 5541 | if (unlikely(!eth_p_mpls(skb->protocol))) |
| 5539 | return -EINVAL; | 5542 | return 0; |
| 5540 | 5543 | ||
| 5541 | err = skb_ensure_writable(skb, skb->mac_len + MPLS_HLEN); | 5544 | err = skb_ensure_writable(skb, mac_len + MPLS_HLEN); |
| 5542 | if (unlikely(err)) | 5545 | if (unlikely(err)) |
| 5543 | return err; | 5546 | return err; |
| 5544 | 5547 | ||
| 5545 | skb_postpull_rcsum(skb, mpls_hdr(skb), MPLS_HLEN); | 5548 | skb_postpull_rcsum(skb, mpls_hdr(skb), MPLS_HLEN); |
| 5546 | memmove(skb_mac_header(skb) + MPLS_HLEN, skb_mac_header(skb), | 5549 | memmove(skb_mac_header(skb) + MPLS_HLEN, skb_mac_header(skb), |
| 5547 | skb->mac_len); | 5550 | mac_len); |
| 5548 | 5551 | ||
| 5549 | __skb_pull(skb, MPLS_HLEN); | 5552 | __skb_pull(skb, MPLS_HLEN); |
| 5550 | skb_reset_mac_header(skb); | 5553 | skb_reset_mac_header(skb); |
| 5551 | skb_set_network_header(skb, skb->mac_len); | 5554 | skb_set_network_header(skb, mac_len); |
| 5552 | 5555 | ||
| 5553 | if (skb->dev && skb->dev->type == ARPHRD_ETHER) { | 5556 | if (skb->dev && skb->dev->type == ARPHRD_ETHER) { |
| 5554 | struct ethhdr *hdr; | 5557 | struct ethhdr *hdr; |
| @@ -522,7 +522,7 @@ int __sk_receive_skb(struct sock *sk, struct sk_buff *skb, · 521 unmodified lines | |||
| 522 | rc = sk_backlog_rcv(sk, skb); | 522 | rc = sk_backlog_rcv(sk, skb); |
| 523 | 523 | ||
| 524 | mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_); | 524 | mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_); |
| 525 | } else if (sk_add_backlog(sk, skb, sk->sk_rcvbuf)) { | 525 | } else if (sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf))) { |
| 526 | bh_unlock_sock(sk); | 526 | bh_unlock_sock(sk); |
| 527 | atomic_inc(&sk->sk_drops); | 527 | atomic_inc(&sk->sk_drops); |
| 528 | goto discard_and_relse; | 528 | goto discard_and_relse; |
| @@ -785,7 +785,8 @@ set_sndbuf: · 256 unmodified lines | |||
| 785 | */ | 785 | */ |
| 786 | val = min_t(int, val, INT_MAX / 2); | 786 | val = min_t(int, val, INT_MAX / 2); |
| 787 | sk->sk_userlocks |= SOCK_SNDBUF_LOCK; | 787 | sk->sk_userlocks |= SOCK_SNDBUF_LOCK; |
| 788 | sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF); | 788 | WRITE_ONCE(sk->sk_sndbuf, |
| 789 | max_t(int, val * 2, SOCK_MIN_SNDBUF)); | ||
| 789 | /* Wake up sending tasks if we upped the value. */ | 790 | /* Wake up sending tasks if we upped the value. */ |
| 790 | sk->sk_write_space(sk); | 791 | sk->sk_write_space(sk); |
| 791 | break; | 792 | break; |
| @@ -831,7 +832,8 @@ set_rcvbuf: · 39 unmodified lines | |||
| 831 | * returning the value we actually used in getsockopt | 832 | * returning the value we actually used in getsockopt |
| 832 | * is the most desirable behavior. | 833 | * is the most desirable behavior. |
| 833 | */ | 834 | */ |
| 834 | sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF); | 835 | WRITE_ONCE(sk->sk_rcvbuf, |
| 836 | max_t(int, val * 2, SOCK_MIN_RCVBUF)); | ||
| 835 | break; | 837 | break; |
| 836 | 838 | ||
| 837 | case SO_RCVBUFFORCE: | 839 | case SO_RCVBUFFORCE: |
| @@ -974,7 +976,7 @@ set_rcvbuf: · 136 unmodified lines | |||
| 974 | if (sock->ops->set_rcvlowat) | 976 | if (sock->ops->set_rcvlowat) |
| 975 | ret = sock->ops->set_rcvlowat(sk, val); | 977 | ret = sock->ops->set_rcvlowat(sk, val); |
| 976 | else | 978 | else |
| 977 | sk->sk_rcvlowat = val ? : 1; | 979 | WRITE_ONCE(sk->sk_rcvlowat, val ? : 1); |
| 978 | break; | 980 | break; |
| 979 | 981 | ||
| 980 | case SO_RCVTIMEO_OLD: | 982 | case SO_RCVTIMEO_OLD: |
| @@ -2088,8 +2090,10 @@ EXPORT_SYMBOL(sock_i_ino); · 1107 unmodified lines | |||
| 2088 | struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, | 2090 | struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force, |
| 2089 | gfp_t priority) | 2091 | gfp_t priority) |
| 2090 | { | 2092 | { |
| 2091 | if (force || refcount_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) { | 2093 | if (force || |
| 2094 | refcount_read(&sk->sk_wmem_alloc) < READ_ONCE(sk->sk_sndbuf)) { | ||
| 2092 | struct sk_buff *skb = alloc_skb(size, priority); | 2095 | struct sk_buff *skb = alloc_skb(size, priority); |
| 2096 | |||
| 2093 | if (skb) { | 2097 | if (skb) { |
| 2094 | skb_set_owner_w(skb, sk); | 2098 | skb_set_owner_w(skb, sk); |
| 2095 | return skb; | 2099 | return skb; |
| @@ -2190,7 +2194,7 @@ static long sock_wait_for_wmem(struct sock *sk, long timeo) · 94 unmodified lines | |||
| 2190 | break; | 2194 | break; |
| 2191 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); | 2195 | set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); |
| 2192 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); | 2196 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
| 2193 | if (refcount_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) | 2197 | if (refcount_read(&sk->sk_wmem_alloc) < READ_ONCE(sk->sk_sndbuf)) |
| 2194 | break; | 2198 | break; |
| 2195 | if (sk->sk_shutdown & SEND_SHUTDOWN) | 2199 | if (sk->sk_shutdown & SEND_SHUTDOWN) |
| 2196 | break; | 2200 | break; |
| @@ -2225,7 +2229,7 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len, · 28 unmodified lines | |||
| 2225 | if (sk->sk_shutdown & SEND_SHUTDOWN) | 2229 | if (sk->sk_shutdown & SEND_SHUTDOWN) |
| 2226 | goto failure; | 2230 | goto failure; |
| 2227 | 2231 | ||
| 2228 | if (sk_wmem_alloc_get(sk) < sk->sk_sndbuf) | 2232 | if (sk_wmem_alloc_get(sk) < READ_ONCE(sk->sk_sndbuf)) |
| 2229 | break; | 2233 | break; |
| 2230 | 2234 | ||
| 2231 | sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); | 2235 | sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk); |
| @@ -2334,8 +2338,8 @@ static void sk_leave_memory_pressure(struct sock *sk) · 102 unmodified lines | |||
| 2334 | } else { | 2338 | } else { |
| 2335 | unsigned long *memory_pressure = sk->sk_prot->memory_pressure; | 2339 | unsigned long *memory_pressure = sk->sk_prot->memory_pressure; |
| 2336 | 2340 | ||
| 2337 | if (memory_pressure && *memory_pressure) | 2341 | if (memory_pressure && READ_ONCE(*memory_pressure)) |
| 2338 | *memory_pressure = 0; | 2342 | WRITE_ONCE(*memory_pressure, 0); |
| 2339 | } | 2343 | } |
| 2340 | } | 2344 | } |
| 2341 | 2345 | ||
| @@ -2806,7 +2810,7 @@ static void sock_def_write_space(struct sock *sk) · 464 unmodified lines | |||
| 2806 | /* Do not wake up a writer until he can make "significant" | 2810 | /* Do not wake up a writer until he can make "significant" |
| 2807 | * progress. --DaveM | 2811 | * progress. --DaveM |
| 2808 | */ | 2812 | */ |
| 2809 | if ((refcount_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf) { | 2813 | if ((refcount_read(&sk->sk_wmem_alloc) << 1) <= READ_ONCE(sk->sk_sndbuf)) { |
| 2810 | wq = rcu_dereference(sk->sk_wq); | 2814 | wq = rcu_dereference(sk->sk_wq); |
| 2811 | if (skwq_has_sleeper(wq)) | 2815 | if (skwq_has_sleeper(wq)) |
| 2812 | wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT | | 2816 | wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT | |
| @@ -3204,13 +3208,13 @@ void sk_get_meminfo(const struct sock *sk, u32 *mem) · 391 unmodified lines | |||
| 3204 | memset(mem, 0, sizeof(*mem) * SK_MEMINFO_VARS); | 3208 | memset(mem, 0, sizeof(*mem) * SK_MEMINFO_VARS); |
| 3205 | 3209 | ||
| 3206 | mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk); | 3210 | mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk); |
| 3207 | mem[SK_MEMINFO_RCVBUF] = sk->sk_rcvbuf; | 3211 | mem[SK_MEMINFO_RCVBUF] = READ_ONCE(sk->sk_rcvbuf); |
| 3208 | mem[SK_MEMINFO_WMEM_ALLOC] = sk_wmem_alloc_get(sk); | 3212 | mem[SK_MEMINFO_WMEM_ALLOC] = sk_wmem_alloc_get(sk); |
| 3209 | mem[SK_MEMINFO_SNDBUF] = sk->sk_sndbuf; | 3213 | mem[SK_MEMINFO_SNDBUF] = READ_ONCE(sk->sk_sndbuf); |
| 3210 | mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc; | 3214 | mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc; |
| 3211 | mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued; | 3215 | mem[SK_MEMINFO_WMEM_QUEUED] = READ_ONCE(sk->sk_wmem_queued); |
| 3212 | mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc); | 3216 | mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc); |
| 3213 | mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len; | 3217 | mem[SK_MEMINFO_BACKLOG] = READ_ONCE(sk->sk_backlog.len); |
| 3214 | mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops); | 3218 | mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops); |
| 3215 | } | 3219 | } |
| 3216 | 3220 | ||
| @@ -46,7 +46,7 @@ static struct dsa_switch_tree *dsa_tree_alloc(int index) · 45 unmodified lines | |||
| 46 | dst->index = index; | 46 | dst->index = index; |
| 47 | 47 | ||
| 48 | INIT_LIST_HEAD(&dst->list); | 48 | INIT_LIST_HEAD(&dst->list); |
| 49 | list_add_tail(&dsa_tree_list, &dst->list); | 49 | list_add_tail(&dst->list, &dsa_tree_list); |
| 50 | 50 | ||
| 51 | kref_init(&dst->refcount); | 51 | kref_init(&dst->refcount); |
| 52 | 52 | ||
| @@ -906,7 +906,7 @@ static void inet_child_forget(struct sock *sk, struct request_sock *req, · 905 unmodified lines | |||
| 906 | percpu_counter_inc(sk->sk_prot->orphan_count); | 906 | percpu_counter_inc(sk->sk_prot->orphan_count); |
| 907 | 907 | ||
| 908 | if (sk->sk_protocol == IPPROTO_TCP && tcp_rsk(req)->tfo_listener) { | 908 | if (sk->sk_protocol == IPPROTO_TCP && tcp_rsk(req)->tfo_listener) { |
| 909 | BUG_ON(tcp_sk(child)->fastopen_rsk != req); | 909 | BUG_ON(rcu_access_pointer(tcp_sk(child)->fastopen_rsk) != req); |
| 910 | BUG_ON(sk != req->rsk_listener); | 910 | BUG_ON(sk != req->rsk_listener); |
| 911 | 911 | ||
| 912 | /* Paranoid, to prevent race condition if | 912 | /* Paranoid, to prevent race condition if |
| @@ -915,7 +915,7 @@ static void inet_child_forget(struct sock *sk, struct request_sock *req, · 2 unmodified lines | |||
| 915 | * Also to satisfy an assertion in | 915 | * Also to satisfy an assertion in |
| 916 | * tcp_v4_destroy_sock(). | 916 | * tcp_v4_destroy_sock(). |
| 917 | */ | 917 | */ |
| 918 | tcp_sk(child)->fastopen_rsk = NULL; | 918 | RCU_INIT_POINTER(tcp_sk(child)->fastopen_rsk, NULL); |
| 919 | } | 919 | } |
| 920 | inet_csk_destroy_sock(child); | 920 | inet_csk_destroy_sock(child); |
| 921 | } | 921 | } |
| @@ -934,7 +934,7 @@ struct sock *inet_csk_reqsk_queue_add(struct sock *sk, · 12 unmodified lines | |||
| 934 | req->sk = child; | 934 | req->sk = child; |
| 935 | req->dl_next = NULL; | 935 | req->dl_next = NULL; |
| 936 | if (queue->rskq_accept_head == NULL) | 936 | if (queue->rskq_accept_head == NULL) |
| 937 | queue->rskq_accept_head = req; | 937 | WRITE_ONCE(queue->rskq_accept_head, req); |
| 938 | else | 938 | else |
| 939 | queue->rskq_accept_tail->dl_next = req; | 939 | queue->rskq_accept_tail->dl_next = req; |
| 940 | queue->rskq_accept_tail = req; | 940 | queue->rskq_accept_tail = req; |
| @@ -193,7 +193,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, · 192 unmodified lines | |||
| 193 | if (ext & (1 << (INET_DIAG_MEMINFO - 1))) { | 193 | if (ext & (1 << (INET_DIAG_MEMINFO - 1))) { |
| 194 | struct inet_diag_meminfo minfo = { | 194 | struct inet_diag_meminfo minfo = { |
| 195 | .idiag_rmem = sk_rmem_alloc_get(sk), | 195 | .idiag_rmem = sk_rmem_alloc_get(sk), |
| 196 | .idiag_wmem = sk->sk_wmem_queued, | 196 | .idiag_wmem = READ_ONCE(sk->sk_wmem_queued), |
| 197 | .idiag_fmem = sk->sk_forward_alloc, | 197 | .idiag_fmem = sk->sk_forward_alloc, |
| 198 | .idiag_tmem = sk_wmem_alloc_get(sk), | 198 | .idiag_tmem = sk_wmem_alloc_get(sk), |
| 199 | }; | 199 | }; |
| @@ -771,6 +771,7 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 770 unmodified lines | |||
| 771 | struct rtable *rt = skb_rtable(skb); | 771 | struct rtable *rt = skb_rtable(skb); |
| 772 | unsigned int mtu, hlen, ll_rs; | 772 | unsigned int mtu, hlen, ll_rs; |
| 773 | struct ip_fraglist_iter iter; | 773 | struct ip_fraglist_iter iter; |
| 774 | ktime_t tstamp = skb->tstamp; | ||
| 774 | struct ip_frag_state state; | 775 | struct ip_frag_state state; |
| 775 | int err = 0; | 776 | int err = 0; |
| 776 | 777 | ||
| @@ -846,6 +847,7 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 69 unmodified lines | |||
| 846 | ip_fraglist_prepare(skb, &iter); | 847 | ip_fraglist_prepare(skb, &iter); |
| 847 | } | 848 | } |
| 848 | 849 | ||
| 850 | skb->tstamp = tstamp; | ||
| 849 | err = output(net, sk, skb); | 851 | err = output(net, sk, skb); |
| 850 | 852 | ||
| 851 | if (!err) | 853 | if (!err) |
| @@ -900,6 +902,7 @@ slow_path: · 48 unmodified lines | |||
| 900 | /* | 902 | /* |
| 901 | * Put this fragment into the sending queue. | 903 | * Put this fragment into the sending queue. |
| 902 | */ | 904 | */ |
| 905 | skb2->tstamp = tstamp; | ||
| 903 | err = output(net, sk, skb2); | 906 | err = output(net, sk, skb2); |
| 904 | if (err) | 907 | if (err) |
| 905 | goto fail; | 908 | goto fail; |
| @@ -1482,7 +1482,7 @@ static bool rt_cache_route(struct fib_nh_common *nhc, struct rtable *rt) · 1481 unmodified lines | |||
| 1482 | prev = cmpxchg(p, orig, rt); | 1482 | prev = cmpxchg(p, orig, rt); |
| 1483 | if (prev == orig) { | 1483 | if (prev == orig) { |
| 1484 | if (orig) { | 1484 | if (orig) { |
| 1485 | dst_dev_put(&orig->dst); | 1485 | rt_add_uncached_list(orig); |
| 1486 | dst_release(&orig->dst); | 1486 | dst_release(&orig->dst); |
| 1487 | } | 1487 | } |
| 1488 | } else { | 1488 | } else { |
| @@ -2470,14 +2470,17 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4, · 981 unmodified lines | |||
| 2470 | int orig_oif = fl4->flowi4_oif; | 2470 | int orig_oif = fl4->flowi4_oif; |
| 2471 | unsigned int flags = 0; | 2471 | unsigned int flags = 0; |
| 2472 | struct rtable *rth; | 2472 | struct rtable *rth; |
| 2473 | int err = -ENETUNREACH; | 2473 | int err; |
| 2474 | 2474 | ||
| 2475 | if (fl4->saddr) { | 2475 | if (fl4->saddr) { |
| 2476 | rth = ERR_PTR(-EINVAL); | ||
| 2477 | if (ipv4_is_multicast(fl4->saddr) || | 2476 | if (ipv4_is_multicast(fl4->saddr) || |
| 2478 | ipv4_is_lbcast(fl4->saddr) || | 2477 | ipv4_is_lbcast(fl4->saddr) || |
| 2479 | ipv4_is_zeronet(fl4->saddr)) | 2478 | ipv4_is_zeronet(fl4->saddr)) { |
| 2479 | rth = ERR_PTR(-EINVAL); | ||
| 2480 | goto out; | 2480 | goto out; |
| 2481 | } | ||
| 2482 | |||
| 2483 | rth = ERR_PTR(-ENETUNREACH); | ||
| 2481 | 2484 | ||
| 2482 | /* I removed check for oif == dev_out->oif here. | 2485 | /* I removed check for oif == dev_out->oif here. |
| 2483 | It was wrong for two reasons: | 2486 | It was wrong for two reasons: |
| @@ -326,7 +326,7 @@ void tcp_enter_memory_pressure(struct sock *sk) · 325 unmodified lines | |||
| 326 | { | 326 | { |
| 327 | unsigned long val; | 327 | unsigned long val; |
| 328 | 328 | ||
| 329 | if (tcp_memory_pressure) | 329 | if (READ_ONCE(tcp_memory_pressure)) |
| 330 | return; | 330 | return; |
| 331 | val = jiffies; | 331 | val = jiffies; |
| 332 | 332 | ||
| @@ -341,7 +341,7 @@ void tcp_leave_memory_pressure(struct sock *sk) · 8 unmodified lines | |||
| 341 | { | 341 | { |
| 342 | unsigned long val; | 342 | unsigned long val; |
| 343 | 343 | ||
| 344 | if (!tcp_memory_pressure) | 344 | if (!READ_ONCE(tcp_memory_pressure)) |
| 345 | return; | 345 | return; |
| 346 | val = xchg(&tcp_memory_pressure, 0); | 346 | val = xchg(&tcp_memory_pressure, 0); |
| 347 | if (val) | 347 | if (val) |
| @@ -450,8 +450,8 @@ void tcp_init_sock(struct sock *sk) · 102 unmodified lines | |||
| 450 | 450 | ||
| 451 | icsk->icsk_sync_mss = tcp_sync_mss; | 451 | icsk->icsk_sync_mss = tcp_sync_mss; |
| 452 | 452 | ||
| 453 | sk->sk_sndbuf = sock_net(sk)->ipv4.sysctl_tcp_wmem[1]; | 453 | WRITE_ONCE(sk->sk_sndbuf, sock_net(sk)->ipv4.sysctl_tcp_wmem[1]); |
| 454 | sk->sk_rcvbuf = sock_net(sk)->ipv4.sysctl_tcp_rmem[1]; | 454 | WRITE_ONCE(sk->sk_rcvbuf, sock_net(sk)->ipv4.sysctl_tcp_rmem[1]); |
| 455 | 455 | ||
| 456 | sk_sockets_allocated_inc(sk); | 456 | sk_sockets_allocated_inc(sk); |
| 457 | sk->sk_route_forced_caps = NETIF_F_GSO; | 457 | sk->sk_route_forced_caps = NETIF_F_GSO; |
| @@ -477,7 +477,7 @@ static void tcp_tx_timestamp(struct sock *sk, u16 tsflags) · 19 unmodified lines | |||
| 477 | static inline bool tcp_stream_is_readable(const struct tcp_sock *tp, | 477 | static inline bool tcp_stream_is_readable(const struct tcp_sock *tp, |
| 478 | int target, struct sock *sk) | 478 | int target, struct sock *sk) |
| 479 | { | 479 | { |
| 480 | return (tp->rcv_nxt - tp->copied_seq >= target) || | 480 | return (READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->copied_seq) >= target) || |
| 481 | (sk->sk_prot->stream_memory_read ? | 481 | (sk->sk_prot->stream_memory_read ? |
| 482 | sk->sk_prot->stream_memory_read(sk) : false); | 482 | sk->sk_prot->stream_memory_read(sk) : false); |
| 483 | } | 483 | } |
| @@ -543,10 +543,10 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait) · 59 unmodified lines | |||
| 543 | 543 | ||
| 544 | /* Connected or passive Fast Open socket? */ | 544 | /* Connected or passive Fast Open socket? */ |
| 545 | if (state != TCP_SYN_SENT && | 545 | if (state != TCP_SYN_SENT && |
| 546 | (state != TCP_SYN_RECV || tp->fastopen_rsk)) { | 546 | (state != TCP_SYN_RECV || rcu_access_pointer(tp->fastopen_rsk))) { |
| 547 | int target = sock_rcvlowat(sk, 0, INT_MAX); | 547 | int target = sock_rcvlowat(sk, 0, INT_MAX); |
| 548 | 548 | ||
| 549 | if (tp->urg_seq == tp->copied_seq && | 549 | if (READ_ONCE(tp->urg_seq) == READ_ONCE(tp->copied_seq) && |
| 550 | !sock_flag(sk, SOCK_URGINLINE) && | 550 | !sock_flag(sk, SOCK_URGINLINE) && |
| 551 | tp->urg_data) | 551 | tp->urg_data) |
| 552 | target++; | 552 | target++; |
| @@ -607,7 +607,8 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) · 54 unmodified lines | |||
| 607 | unlock_sock_fast(sk, slow); | 607 | unlock_sock_fast(sk, slow); |
| 608 | break; | 608 | break; |
| 609 | case SIOCATMARK: | 609 | case SIOCATMARK: |
| 610 | answ = tp->urg_data && tp->urg_seq == tp->copied_seq; | 610 | answ = tp->urg_data && |
| 611 | READ_ONCE(tp->urg_seq) == READ_ONCE(tp->copied_seq); | ||
| 611 | break; | 612 | break; |
| 612 | case SIOCOUTQ: | 613 | case SIOCOUTQ: |
| 613 | if (sk->sk_state == TCP_LISTEN) | 614 | if (sk->sk_state == TCP_LISTEN) |
| @@ -616,7 +617,7 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) · 2 unmodified lines | |||
| 616 | if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) | 617 | if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) |
| 617 | answ = 0; | 618 | answ = 0; |
| 618 | else | 619 | else |
| 619 | answ = tp->write_seq - tp->snd_una; | 620 | answ = READ_ONCE(tp->write_seq) - tp->snd_una; |
| 620 | break; | 621 | break; |
| 621 | case SIOCOUTQNSD: | 622 | case SIOCOUTQNSD: |
| 622 | if (sk->sk_state == TCP_LISTEN) | 623 | if (sk->sk_state == TCP_LISTEN) |
| @@ -625,7 +626,8 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) · 2 unmodified lines | |||
| 625 | if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) | 626 | if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) |
| 626 | answ = 0; | 627 | answ = 0; |
| 627 | else | 628 | else |
| 628 | answ = tp->write_seq - tp->snd_nxt; | 629 | answ = READ_ONCE(tp->write_seq) - |
| 630 | READ_ONCE(tp->snd_nxt); | ||
| 629 | break; | 631 | break; |
| 630 | default: | 632 | default: |
| 631 | return -ENOIOCTLCMD; | 633 | return -ENOIOCTLCMD; |
| @@ -657,7 +659,7 @@ static void skb_entail(struct sock *sk, struct sk_buff *skb) · 25 unmodified lines | |||
| 657 | tcb->sacked = 0; | 659 | tcb->sacked = 0; |
| 658 | __skb_header_release(skb); | 660 | __skb_header_release(skb); |
| 659 | tcp_add_write_queue_tail(sk, skb); | 661 | tcp_add_write_queue_tail(sk, skb); |
| 660 | sk->sk_wmem_queued += skb->truesize; | 662 | sk_wmem_queued_add(sk, skb->truesize); |
| 661 | sk_mem_charge(sk, skb->truesize); | 663 | sk_mem_charge(sk, skb->truesize); |
| 662 | if (tp->nonagle & TCP_NAGLE_PUSH) | 664 | if (tp->nonagle & TCP_NAGLE_PUSH) |
| 663 | tp->nonagle &= ~TCP_NAGLE_PUSH; | 665 | tp->nonagle &= ~TCP_NAGLE_PUSH; |
| @@ -1032,10 +1034,10 @@ new_segment: · 368 unmodified lines | |||
| 1032 | skb->len += copy; | 1034 | skb->len += copy; |
| 1033 | skb->data_len += copy; | 1035 | skb->data_len += copy; |
| 1034 | skb->truesize += copy; | 1036 | skb->truesize += copy; |
| 1035 | sk->sk_wmem_queued += copy; | 1037 | sk_wmem_queued_add(sk, copy); |
| 1036 | sk_mem_charge(sk, copy); | 1038 | sk_mem_charge(sk, copy); |
| 1037 | skb->ip_summed = CHECKSUM_PARTIAL; | 1039 | skb->ip_summed = CHECKSUM_PARTIAL; |
| 1038 | tp->write_seq += copy; | 1040 | WRITE_ONCE(tp->write_seq, tp->write_seq + copy); |
| 1039 | TCP_SKB_CB(skb)->end_seq += copy; | 1041 | TCP_SKB_CB(skb)->end_seq += copy; |
| 1040 | tcp_skb_pcount_set(skb, 0); | 1042 | tcp_skb_pcount_set(skb, 0); |
| 1041 | 1043 | ||
| @@ -1362,7 +1364,7 @@ new_segment: · 320 unmodified lines | |||
| 1362 | if (!copied) | 1364 | if (!copied) |
| 1363 | TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; | 1365 | TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH; |
| 1364 | 1366 | ||
| 1365 | tp->write_seq += copy; | 1367 | WRITE_ONCE(tp->write_seq, tp->write_seq + copy); |
| 1366 | TCP_SKB_CB(skb)->end_seq += copy; | 1368 | TCP_SKB_CB(skb)->end_seq += copy; |
| 1367 | tcp_skb_pcount_set(skb, 0); | 1369 | tcp_skb_pcount_set(skb, 0); |
| 1368 | 1370 | ||
| @@ -1668,9 +1670,9 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, · 299 unmodified lines | |||
| 1668 | sk_eat_skb(sk, skb); | 1670 | sk_eat_skb(sk, skb); |
| 1669 | if (!desc->count) | 1671 | if (!desc->count) |
| 1670 | break; | 1672 | break; |
| 1671 | tp->copied_seq = seq; | 1673 | WRITE_ONCE(tp->copied_seq, seq); |
| 1672 | } | 1674 | } |
| 1673 | tp->copied_seq = seq; | 1675 | WRITE_ONCE(tp->copied_seq, seq); |
| 1674 | 1676 | ||
| 1675 | tcp_rcv_space_adjust(sk); | 1677 | tcp_rcv_space_adjust(sk); |
| 1676 | 1678 | ||
| @@ -1699,7 +1701,7 @@ int tcp_set_rcvlowat(struct sock *sk, int val) · 22 unmodified lines | |||
| 1699 | else | 1701 | else |
| 1700 | cap = sock_net(sk)->ipv4.sysctl_tcp_rmem[2] >> 1; | 1702 | cap = sock_net(sk)->ipv4.sysctl_tcp_rmem[2] >> 1; |
| 1701 | val = min(val, cap); | 1703 | val = min(val, cap); |
| 1702 | sk->sk_rcvlowat = val ? : 1; | 1704 | WRITE_ONCE(sk->sk_rcvlowat, val ? : 1); |
| 1703 | 1705 | ||
| 1704 | /* Check if we need to signal EPOLLIN right now */ | 1706 | /* Check if we need to signal EPOLLIN right now */ |
| 1705 | tcp_data_ready(sk); | 1707 | tcp_data_ready(sk); |
| @@ -1709,7 +1711,7 @@ int tcp_set_rcvlowat(struct sock *sk, int val) · 3 unmodified lines | |||
| 1709 | 1711 | ||
| 1710 | val <<= 1; | 1712 | val <<= 1; |
| 1711 | if (val > sk->sk_rcvbuf) { | 1713 | if (val > sk->sk_rcvbuf) { |
| 1712 | sk->sk_rcvbuf = val; | 1714 | WRITE_ONCE(sk->sk_rcvbuf, val); |
| 1713 | tcp_sk(sk)->window_clamp = tcp_win_from_space(sk, val); | 1715 | tcp_sk(sk)->window_clamp = tcp_win_from_space(sk, val); |
| 1714 | } | 1716 | } |
| 1715 | return 0; | 1717 | return 0; |
| @@ -1819,7 +1821,7 @@ static int tcp_zerocopy_receive(struct sock *sk, · 103 unmodified lines | |||
| 1819 | out: | 1821 | out: |
| 1820 | up_read(¤t->mm->mmap_sem); | 1822 | up_read(¤t->mm->mmap_sem); |
| 1821 | if (length) { | 1823 | if (length) { |
| 1822 | tp->copied_seq = seq; | 1824 | WRITE_ONCE(tp->copied_seq, seq); |
| 1823 | tcp_rcv_space_adjust(sk); | 1825 | tcp_rcv_space_adjust(sk); |
| 1824 | 1826 | ||
| 1825 | /* Clean up data we have read: This will do ACK frames. */ | 1827 | /* Clean up data we have read: This will do ACK frames. */ |
| @@ -2117,7 +2119,7 @@ found_ok_skb: · 291 unmodified lines | |||
| 2117 | if (urg_offset < used) { | 2119 | if (urg_offset < used) { |
| 2118 | if (!urg_offset) { | 2120 | if (!urg_offset) { |
| 2119 | if (!sock_flag(sk, SOCK_URGINLINE)) { | 2121 | if (!sock_flag(sk, SOCK_URGINLINE)) { |
| 2120 | ++*seq; | 2122 | WRITE_ONCE(*seq, *seq + 1); |
| 2121 | urg_hole++; | 2123 | urg_hole++; |
| 2122 | offset++; | 2124 | offset++; |
| 2123 | used--; | 2125 | used--; |
| @@ -2139,7 +2141,7 @@ found_ok_skb: · 15 unmodified lines | |||
| 2139 | } | 2141 | } |
| 2140 | } | 2142 | } |
| 2141 | 2143 | ||
| 2142 | *seq += used; | 2144 | WRITE_ONCE(*seq, *seq + used); |
| 2143 | copied += used; | 2145 | copied += used; |
| 2144 | len -= used; | 2146 | len -= used; |
| 2145 | 2147 | ||
| @@ -2166,7 +2168,7 @@ skip_copy: · 20 unmodified lines | |||
| 2166 | 2168 | ||
| 2167 | found_fin_ok: | 2169 | found_fin_ok: |
| 2168 | /* Process the FIN. */ | 2170 | /* Process the FIN. */ |
| 2169 | ++*seq; | 2171 | WRITE_ONCE(*seq, *seq + 1); |
| 2170 | if (!(flags & MSG_PEEK)) | 2172 | if (!(flags & MSG_PEEK)) |
| 2171 | sk_eat_skb(sk, skb); | 2173 | sk_eat_skb(sk, skb); |
| 2172 | break; | 2174 | break; |
| @@ -2487,7 +2489,10 @@ adjudge_to_death: · 314 unmodified lines | |||
| 2487 | } | 2489 | } |
| 2488 | 2490 | ||
| 2489 | if (sk->sk_state == TCP_CLOSE) { | 2491 | if (sk->sk_state == TCP_CLOSE) { |
| 2490 | struct request_sock *req = tcp_sk(sk)->fastopen_rsk; | 2492 | struct request_sock *req; |
| 2493 | |||
| 2494 | req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, | ||
| 2495 | lockdep_sock_is_held(sk)); | ||
| 2491 | /* We could get here with a non-NULL req if the socket is | 2496 | /* We could get here with a non-NULL req if the socket is |
| 2492 | * aborted (e.g., closed with unread data) before 3WHS | 2497 | * aborted (e.g., closed with unread data) before 3WHS |
| 2493 | * finishes. | 2498 | * finishes. |
| @@ -2559,6 +2564,7 @@ int tcp_disconnect(struct sock *sk, int flags) · 65 unmodified lines | |||
| 2559 | struct inet_connection_sock *icsk = inet_csk(sk); | 2564 | struct inet_connection_sock *icsk = inet_csk(sk); |
| 2560 | struct tcp_sock *tp = tcp_sk(sk); | 2565 | struct tcp_sock *tp = tcp_sk(sk); |
| 2561 | int old_state = sk->sk_state; | 2566 | int old_state = sk->sk_state; |
| 2567 | u32 seq; | ||
| 2562 | 2568 | ||
| 2563 | if (old_state != TCP_CLOSE) | 2569 | if (old_state != TCP_CLOSE) |
| 2564 | tcp_set_state(sk, TCP_CLOSE); | 2570 | tcp_set_state(sk, TCP_CLOSE); |
| @@ -2585,7 +2591,7 @@ int tcp_disconnect(struct sock *sk, int flags) · 20 unmodified lines | |||
| 2585 | __kfree_skb(sk->sk_rx_skb_cache); | 2591 | __kfree_skb(sk->sk_rx_skb_cache); |
| 2586 | sk->sk_rx_skb_cache = NULL; | 2592 | sk->sk_rx_skb_cache = NULL; |
| 2587 | } | 2593 | } |
| 2588 | tp->copied_seq = tp->rcv_nxt; | 2594 | WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); |
| 2589 | tp->urg_data = 0; | 2595 | tp->urg_data = 0; |
| 2590 | tcp_write_queue_purge(sk); | 2596 | tcp_write_queue_purge(sk); |
| 2591 | tcp_fastopen_active_disable_ofo_check(sk); | 2597 | tcp_fastopen_active_disable_ofo_check(sk); |
| @@ -2601,9 +2607,12 @@ int tcp_disconnect(struct sock *sk, int flags) · 9 unmodified lines | |||
| 2601 | tp->srtt_us = 0; | 2607 | tp->srtt_us = 0; |
| 2602 | tp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT); | 2608 | tp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT); |
| 2603 | tp->rcv_rtt_last_tsecr = 0; | 2609 | tp->rcv_rtt_last_tsecr = 0; |
| 2604 | tp->write_seq += tp->max_window + 2; | 2610 | |
| 2605 | if (tp->write_seq == 0) | 2611 | seq = tp->write_seq + tp->max_window + 2; |
| 2606 | tp->write_seq = 1; | 2612 | if (!seq) |
| 2613 | seq = 1; | ||
| 2614 | WRITE_ONCE(tp->write_seq, seq); | ||
| 2615 | |||
| 2607 | icsk->icsk_backoff = 0; | 2616 | icsk->icsk_backoff = 0; |
| 2608 | tp->snd_cwnd = 2; | 2617 | tp->snd_cwnd = 2; |
| 2609 | icsk->icsk_probes_out = 0; | 2618 | icsk->icsk_probes_out = 0; |
| @@ -2930,9 +2939,9 @@ static int do_tcp_setsockopt(struct sock *sk, int level, · 320 unmodified lines | |||
| 2930 | if (sk->sk_state != TCP_CLOSE) | 2939 | if (sk->sk_state != TCP_CLOSE) |
| 2931 | err = -EPERM; | 2940 | err = -EPERM; |
| 2932 | else if (tp->repair_queue == TCP_SEND_QUEUE) | 2941 | else if (tp->repair_queue == TCP_SEND_QUEUE) |
| 2933 | tp->write_seq = val; | 2942 | WRITE_ONCE(tp->write_seq, val); |
| 2934 | else if (tp->repair_queue == TCP_RECV_QUEUE) | 2943 | else if (tp->repair_queue == TCP_RECV_QUEUE) |
| 2935 | tp->rcv_nxt = val; | 2944 | WRITE_ONCE(tp->rcv_nxt, val); |
| 2936 | else | 2945 | else |
| 2937 | err = -EINVAL; | 2946 | err = -EINVAL; |
| 2938 | break; | 2947 | break; |
| @@ -3831,7 +3840,13 @@ EXPORT_SYMBOL(tcp_md5_hash_key); · 892 unmodified lines | |||
| 3831 | 3840 | ||
| 3832 | void tcp_done(struct sock *sk) | 3841 | void tcp_done(struct sock *sk) |
| 3833 | { | 3842 | { |
| 3834 | struct request_sock *req = tcp_sk(sk)->fastopen_rsk; | 3843 | struct request_sock *req; |
| 3844 | |||
| 3845 | /* We might be called with a new socket, after | ||
| 3846 | * inet_csk_prepare_forced_close() has been called | ||
| 3847 | * so we can not use lockdep_sock_is_held(sk) | ||
| 3848 | */ | ||
| 3849 | req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, 1); | ||
| 3835 | 3850 | ||
| 3836 | if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) | 3851 | if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV) |
| 3837 | TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS); | 3852 | TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS); |
| @@ -26,8 +26,9 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, · 25 unmodified lines | |||
| 26 | } else if (sk->sk_type == SOCK_STREAM) { | 26 | } else if (sk->sk_type == SOCK_STREAM) { |
| 27 | const struct tcp_sock *tp = tcp_sk(sk); | 27 | const struct tcp_sock *tp = tcp_sk(sk); |
| 28 | 28 | ||
| 29 | r->idiag_rqueue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); | 29 | r->idiag_rqueue = max_t(int, READ_ONCE(tp->rcv_nxt) - |
| 30 | r->idiag_wqueue = tp->write_seq - tp->snd_una; | 30 | READ_ONCE(tp->copied_seq), 0); |
| 31 | r->idiag_wqueue = READ_ONCE(tp->write_seq) - tp->snd_una; | ||
| 31 | } | 32 | } |
| 32 | if (info) | 33 | if (info) |
| 33 | tcp_get_info(sk, info); | 34 | tcp_get_info(sk, info); |
| @@ -253,7 +253,7 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk, · 252 unmodified lines | |||
| 253 | */ | 253 | */ |
| 254 | tp = tcp_sk(child); | 254 | tp = tcp_sk(child); |
| 255 | 255 | ||
| 256 | tp->fastopen_rsk = req; | 256 | rcu_assign_pointer(tp->fastopen_rsk, req); |
| 257 | tcp_rsk(req)->tfo_listener = true; | 257 | tcp_rsk(req)->tfo_listener = true; |
| 258 | 258 | ||
| 259 | /* RFC1323: The window in SYN & SYN/ACK segments is never | 259 | /* RFC1323: The window in SYN & SYN/ACK segments is never |
| @@ -359,7 +359,8 @@ static void tcp_sndbuf_expand(struct sock *sk) · 358 unmodified lines | |||
| 359 | sndmem *= nr_segs * per_mss; | 359 | sndmem *= nr_segs * per_mss; |
| 360 | 360 | ||
| 361 | if (sk->sk_sndbuf < sndmem) | 361 | if (sk->sk_sndbuf < sndmem) |
| 362 | sk->sk_sndbuf = min(sndmem, sock_net(sk)->ipv4.sysctl_tcp_wmem[2]); | 362 | WRITE_ONCE(sk->sk_sndbuf, |
| 363 | min(sndmem, sock_net(sk)->ipv4.sysctl_tcp_wmem[2])); | ||
| 363 | } | 364 | } |
| 364 | 365 | ||
| 365 | /* 2. Tuning advertised window (window_clamp, rcv_ssthresh) | 366 | /* 2. Tuning advertised window (window_clamp, rcv_ssthresh) |
| @@ -483,8 +484,9 @@ static void tcp_clamp_window(struct sock *sk) · 117 unmodified lines | |||
| 483 | !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) && | 484 | !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) && |
| 484 | !tcp_under_memory_pressure(sk) && | 485 | !tcp_under_memory_pressure(sk) && |
| 485 | sk_memory_allocated(sk) < sk_prot_mem_limits(sk, 0)) { | 486 | sk_memory_allocated(sk) < sk_prot_mem_limits(sk, 0)) { |
| 486 | sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc), | 487 | WRITE_ONCE(sk->sk_rcvbuf, |
| 487 | net->ipv4.sysctl_tcp_rmem[2]); | 488 | min(atomic_read(&sk->sk_rmem_alloc), |
| 489 | net->ipv4.sysctl_tcp_rmem[2])); | ||
| 488 | } | 490 | } |
| 489 | if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf) | 491 | if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf) |
| 490 | tp->rcv_ssthresh = min(tp->window_clamp, 2U * tp->advmss); | 492 | tp->rcv_ssthresh = min(tp->window_clamp, 2U * tp->advmss); |
| @@ -648,7 +650,7 @@ void tcp_rcv_space_adjust(struct sock *sk) · 157 unmodified lines | |||
| 648 | rcvbuf = min_t(u64, rcvwin * rcvmem, | 650 | rcvbuf = min_t(u64, rcvwin * rcvmem, |
| 649 | sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); | 651 | sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); |
| 650 | if (rcvbuf > sk->sk_rcvbuf) { | 652 | if (rcvbuf > sk->sk_rcvbuf) { |
| 651 | sk->sk_rcvbuf = rcvbuf; | 653 | WRITE_ONCE(sk->sk_rcvbuf, rcvbuf); |
| 652 | 654 | ||
| 653 | /* Make the window clamp follow along. */ | 655 | /* Make the window clamp follow along. */ |
| 654 | tp->window_clamp = tcp_win_from_space(sk, rcvbuf); | 656 | tp->window_clamp = tcp_win_from_space(sk, rcvbuf); |
| @@ -2666,7 +2668,7 @@ static void tcp_process_loss(struct sock *sk, int flag, int num_dupack, · 2011 unmodified lines | |||
| 2666 | struct tcp_sock *tp = tcp_sk(sk); | 2668 | struct tcp_sock *tp = tcp_sk(sk); |
| 2667 | bool recovered = !before(tp->snd_una, tp->high_seq); | 2669 | bool recovered = !before(tp->snd_una, tp->high_seq); |
| 2668 | 2670 | ||
| 2669 | if ((flag & FLAG_SND_UNA_ADVANCED || tp->fastopen_rsk) && | 2671 | if ((flag & FLAG_SND_UNA_ADVANCED || rcu_access_pointer(tp->fastopen_rsk)) && |
| 2670 | tcp_try_undo_loss(sk, false)) | 2672 | tcp_try_undo_loss(sk, false)) |
| 2671 | return; | 2673 | return; |
| 2672 | 2674 | ||
| @@ -2990,7 +2992,7 @@ void tcp_rearm_rto(struct sock *sk) · 317 unmodified lines | |||
| 2990 | /* If the retrans timer is currently being used by Fast Open | 2992 | /* If the retrans timer is currently being used by Fast Open |
| 2991 | * for SYN-ACK retrans purpose, stay put. | 2993 | * for SYN-ACK retrans purpose, stay put. |
| 2992 | */ | 2994 | */ |
| 2993 | if (tp->fastopen_rsk) | 2995 | if (rcu_access_pointer(tp->fastopen_rsk)) |
| 2994 | return; | 2996 | return; |
| 2995 | 2997 | ||
| 2996 | if (!tp->packets_out) { | 2998 | if (!tp->packets_out) { |
| @@ -3362,7 +3364,7 @@ static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq) · 365 unmodified lines | |||
| 3362 | 3364 | ||
| 3363 | sock_owned_by_me((struct sock *)tp); | 3365 | sock_owned_by_me((struct sock *)tp); |
| 3364 | tp->bytes_received += delta; | 3366 | tp->bytes_received += delta; |
| 3365 | tp->rcv_nxt = seq; | 3367 | WRITE_ONCE(tp->rcv_nxt, seq); |
| 3366 | } | 3368 | } |
| 3367 | 3369 | ||
| 3368 | /* Update our send window. | 3370 | /* Update our send window. |
| @@ -5356,7 +5358,7 @@ static void tcp_check_urg(struct sock *sk, const struct tcphdr *th) · 1987 unmodified lines | |||
| 5356 | } | 5358 | } |
| 5357 | 5359 | ||
| 5358 | tp->urg_data = TCP_URG_NOTYET; | 5360 | tp->urg_data = TCP_URG_NOTYET; |
| 5359 | tp->urg_seq = ptr; | 5361 | WRITE_ONCE(tp->urg_seq, ptr); |
| 5360 | 5362 | ||
| 5361 | /* Disable header prediction. */ | 5363 | /* Disable header prediction. */ |
| 5362 | tp->pred_flags = 0; | 5364 | tp->pred_flags = 0; |
| @@ -5932,7 +5934,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, · 569 unmodified lines | |||
| 5932 | /* Ok.. it's good. Set up sequence numbers and | 5934 | /* Ok.. it's good. Set up sequence numbers and |
| 5933 | * move to established. | 5935 | * move to established. |
| 5934 | */ | 5936 | */ |
| 5935 | tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; | 5937 | WRITE_ONCE(tp->rcv_nxt, TCP_SKB_CB(skb)->seq + 1); |
| 5936 | tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; | 5938 | tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; |
| 5937 | 5939 | ||
| 5938 | /* RFC1323: The window in SYN & SYN/ACK segments is | 5940 | /* RFC1323: The window in SYN & SYN/ACK segments is |
| @@ -5961,7 +5963,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, · 22 unmodified lines | |||
| 5961 | /* Remember, tcp_poll() does not lock socket! | 5963 | /* Remember, tcp_poll() does not lock socket! |
| 5962 | * Change state from SYN-SENT only after copied_seq | 5964 | * Change state from SYN-SENT only after copied_seq |
| 5963 | * is initialized. */ | 5965 | * is initialized. */ |
| 5964 | tp->copied_seq = tp->rcv_nxt; | 5966 | WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); |
| 5965 | 5967 | ||
| 5966 | smc_check_reset_syn(tp); | 5968 | smc_check_reset_syn(tp); |
| 5967 | 5969 | ||
| @@ -6035,8 +6037,8 @@ discard: · 67 unmodified lines | |||
| 6035 | tp->tcp_header_len = sizeof(struct tcphdr); | 6037 | tp->tcp_header_len = sizeof(struct tcphdr); |
| 6036 | } | 6038 | } |
| 6037 | 6039 | ||
| 6038 | tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; | 6040 | WRITE_ONCE(tp->rcv_nxt, TCP_SKB_CB(skb)->seq + 1); |
| 6039 | tp->copied_seq = tp->rcv_nxt; | 6041 | WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); |
| 6040 | tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; | 6042 | tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; |
| 6041 | 6043 | ||
| 6042 | /* RFC1323: The window in SYN & SYN/ACK segments is | 6044 | /* RFC1323: The window in SYN & SYN/ACK segments is |
| @@ -6087,6 +6089,8 @@ reset_and_undo: · 44 unmodified lines | |||
| 6087 | 6089 | ||
| 6088 | static void tcp_rcv_synrecv_state_fastopen(struct sock *sk) | 6090 | static void tcp_rcv_synrecv_state_fastopen(struct sock *sk) |
| 6089 | { | 6091 | { |
| 6092 | struct request_sock *req; | ||
| 6093 | |||
| 6090 | tcp_try_undo_loss(sk, false); | 6094 | tcp_try_undo_loss(sk, false); |
| 6091 | 6095 | ||
| 6092 | /* Reset rtx states to prevent spurious retransmits_timed_out() */ | 6096 | /* Reset rtx states to prevent spurious retransmits_timed_out() */ |
| @@ -6096,7 +6100,9 @@ static void tcp_rcv_synrecv_state_fastopen(struct sock *sk) · 3 unmodified lines | |||
| 6096 | /* Once we leave TCP_SYN_RECV or TCP_FIN_WAIT_1, | 6100 | /* Once we leave TCP_SYN_RECV or TCP_FIN_WAIT_1, |
| 6097 | * we no longer need req so release it. | 6101 | * we no longer need req so release it. |
| 6098 | */ | 6102 | */ |
| 6099 | reqsk_fastopen_remove(sk, tcp_sk(sk)->fastopen_rsk, false); | 6103 | req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, |
| 6104 | lockdep_sock_is_held(sk)); | ||
| 6105 | reqsk_fastopen_remove(sk, req, false); | ||
| 6100 | 6106 | ||
| 6101 | /* Re-arm the timer because data may have been sent out. | 6107 | /* Re-arm the timer because data may have been sent out. |
| 6102 | * This is similar to the regular data transmission case | 6108 | * This is similar to the regular data transmission case |
| @@ -6171,7 +6177,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) · 68 unmodified lines | |||
| 6171 | 6177 | ||
| 6172 | tcp_mstamp_refresh(tp); | 6178 | tcp_mstamp_refresh(tp); |
| 6173 | tp->rx_opt.saw_tstamp = 0; | 6179 | tp->rx_opt.saw_tstamp = 0; |
| 6174 | req = tp->fastopen_rsk; | 6180 | req = rcu_dereference_protected(tp->fastopen_rsk, |
| 6181 | lockdep_sock_is_held(sk)); | ||
| 6175 | if (req) { | 6182 | if (req) { |
| 6176 | bool req_stolen; | 6183 | bool req_stolen; |
| 6177 | 6184 | ||
| @@ -6211,7 +6218,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) · 33 unmodified lines | |||
| 6211 | tcp_try_undo_spurious_syn(sk); | 6218 | tcp_try_undo_spurious_syn(sk); |
| 6212 | tp->retrans_stamp = 0; | 6219 | tp->retrans_stamp = 0; |
| 6213 | tcp_init_transfer(sk, BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB); | 6220 | tcp_init_transfer(sk, BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB); |
| 6214 | tp->copied_seq = tp->rcv_nxt; | 6221 | WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); |
| 6215 | } | 6222 | } |
| 6216 | smp_mb(); | 6223 | smp_mb(); |
| 6217 | tcp_set_state(sk, TCP_ESTABLISHED); | 6224 | tcp_set_state(sk, TCP_ESTABLISHED); |
| @@ -164,9 +164,11 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) · 163 unmodified lines | |||
| 164 | * without appearing to create any others. | 164 | * without appearing to create any others. |
| 165 | */ | 165 | */ |
| 166 | if (likely(!tp->repair)) { | 166 | if (likely(!tp->repair)) { |
| 167 | tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; | 167 | u32 seq = tcptw->tw_snd_nxt + 65535 + 2; |
| 168 | if (tp->write_seq == 0) | 168 | |
| 169 | tp->write_seq = 1; | 169 | if (!seq) |
| 170 | seq = 1; | ||
| 171 | WRITE_ONCE(tp->write_seq, seq); | ||
| 170 | tp->rx_opt.ts_recent = tcptw->tw_ts_recent; | 172 | tp->rx_opt.ts_recent = tcptw->tw_ts_recent; |
| 171 | tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp; | 173 | tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp; |
| 172 | } | 174 | } |
| @@ -253,7 +255,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 80 unmodified lines | |||
| 253 | tp->rx_opt.ts_recent = 0; | 255 | tp->rx_opt.ts_recent = 0; |
| 254 | tp->rx_opt.ts_recent_stamp = 0; | 256 | tp->rx_opt.ts_recent_stamp = 0; |
| 255 | if (likely(!tp->repair)) | 257 | if (likely(!tp->repair)) |
| 256 | tp->write_seq = 0; | 258 | WRITE_ONCE(tp->write_seq, 0); |
| 257 | } | 259 | } |
| 258 | 260 | ||
| 259 | inet->inet_dport = usin->sin_port; | 261 | inet->inet_dport = usin->sin_port; |
| @@ -291,10 +293,11 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 31 unmodified lines | |||
| 291 | 293 | ||
| 292 | if (likely(!tp->repair)) { | 294 | if (likely(!tp->repair)) { |
| 293 | if (!tp->write_seq) | 295 | if (!tp->write_seq) |
| 294 | tp->write_seq = secure_tcp_seq(inet->inet_saddr, | 296 | WRITE_ONCE(tp->write_seq, |
| 295 | inet->inet_daddr, | 297 | secure_tcp_seq(inet->inet_saddr, |
| 296 | inet->inet_sport, | 298 | inet->inet_daddr, |
| 297 | usin->sin_port); | 299 | inet->inet_sport, |
| 300 | usin->sin_port)); | ||
| 298 | tp->tsoffset = secure_tcp_ts_off(sock_net(sk), | 301 | tp->tsoffset = secure_tcp_ts_off(sock_net(sk), |
| 299 | inet->inet_saddr, | 302 | inet->inet_saddr, |
| 300 | inet->inet_daddr); | 303 | inet->inet_daddr); |
| @@ -478,7 +481,7 @@ int tcp_v4_err(struct sk_buff *icmp_skb, u32 info) · 177 unmodified lines | |||
| 478 | icsk = inet_csk(sk); | 481 | icsk = inet_csk(sk); |
| 479 | tp = tcp_sk(sk); | 482 | tp = tcp_sk(sk); |
| 480 | /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */ | 483 | /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */ |
| 481 | fastopen = tp->fastopen_rsk; | 484 | fastopen = rcu_dereference(tp->fastopen_rsk); |
| 482 | snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una; | 485 | snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una; |
| 483 | if (sk->sk_state != TCP_LISTEN && | 486 | if (sk->sk_state != TCP_LISTEN && |
| 484 | !between(seq, snd_una, tp->snd_nxt)) { | 487 | !between(seq, snd_una, tp->snd_nxt)) { |
| @@ -1644,7 +1647,7 @@ int tcp_v4_early_demux(struct sk_buff *skb) · 1159 unmodified lines | |||
| 1644 | 1647 | ||
| 1645 | bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) | 1648 | bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) |
| 1646 | { | 1649 | { |
| 1647 | u32 limit = sk->sk_rcvbuf + sk->sk_sndbuf; | 1650 | u32 limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf); |
| 1648 | struct skb_shared_info *shinfo; | 1651 | struct skb_shared_info *shinfo; |
| 1649 | const struct tcphdr *th; | 1652 | const struct tcphdr *th; |
| 1650 | struct tcphdr *thtail; | 1653 | struct tcphdr *thtail; |
| @@ -2121,7 +2124,7 @@ void tcp_v4_destroy_sock(struct sock *sk) · 470 unmodified lines | |||
| 2121 | if (inet_csk(sk)->icsk_bind_hash) | 2124 | if (inet_csk(sk)->icsk_bind_hash) |
| 2122 | inet_put_port(sk); | 2125 | inet_put_port(sk); |
| 2123 | 2126 | ||
| 2124 | BUG_ON(tp->fastopen_rsk); | 2127 | BUG_ON(rcu_access_pointer(tp->fastopen_rsk)); |
| 2125 | 2128 | ||
| 2126 | /* If socket is aborted during connect operation */ | 2129 | /* If socket is aborted during connect operation */ |
| 2127 | tcp_free_fastopen_req(tp); | 2130 | tcp_free_fastopen_req(tp); |
| @@ -2455,12 +2458,13 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i) · 327 unmodified lines | |||
| 2455 | /* Because we don't lock the socket, | 2458 | /* Because we don't lock the socket, |
| 2456 | * we might find a transient negative value. | 2459 | * we might find a transient negative value. |
| 2457 | */ | 2460 | */ |
| 2458 | rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); | 2461 | rx_queue = max_t(int, READ_ONCE(tp->rcv_nxt) - |
| 2462 | READ_ONCE(tp->copied_seq), 0); | ||
| 2459 | 2463 | ||
| 2460 | seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " | 2464 | seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " |
| 2461 | "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d", | 2465 | "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d", |
| 2462 | i, src, srcp, dest, destp, state, | 2466 | i, src, srcp, dest, destp, state, |
| 2463 | tp->write_seq - tp->snd_una, | 2467 | READ_ONCE(tp->write_seq) - tp->snd_una, |
| 2464 | rx_queue, | 2468 | rx_queue, |
| 2465 | timer_active, | 2469 | timer_active, |
| 2466 | jiffies_delta_to_clock_t(timer_expires - jiffies), | 2470 | jiffies_delta_to_clock_t(timer_expires - jiffies), |
| @@ -462,6 +462,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 461 unmodified lines | |||
| 462 | struct tcp_request_sock *treq = tcp_rsk(req); | 462 | struct tcp_request_sock *treq = tcp_rsk(req); |
| 463 | struct inet_connection_sock *newicsk; | 463 | struct inet_connection_sock *newicsk; |
| 464 | struct tcp_sock *oldtp, *newtp; | 464 | struct tcp_sock *oldtp, *newtp; |
| 465 | u32 seq; | ||
| 465 | 466 | ||
| 466 | if (!newsk) | 467 | if (!newsk) |
| 467 | return NULL; | 468 | return NULL; |
| @@ -475,12 +476,16 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 7 unmodified lines | |||
| 475 | /* Now setup tcp_sock */ | 476 | /* Now setup tcp_sock */ |
| 476 | newtp->pred_flags = 0; | 477 | newtp->pred_flags = 0; |
| 477 | 478 | ||
| 478 | newtp->rcv_wup = newtp->copied_seq = | 479 | seq = treq->rcv_isn + 1; |
| 479 | newtp->rcv_nxt = treq->rcv_isn + 1; | 480 | newtp->rcv_wup = seq; |
| 481 | WRITE_ONCE(newtp->copied_seq, seq); | ||
| 482 | WRITE_ONCE(newtp->rcv_nxt, seq); | ||
| 480 | newtp->segs_in = 1; | 483 | newtp->segs_in = 1; |
| 481 | 484 | ||
| 482 | newtp->snd_sml = newtp->snd_una = | 485 | seq = treq->snt_isn + 1; |
| 483 | newtp->snd_nxt = newtp->snd_up = treq->snt_isn + 1; | 486 | newtp->snd_sml = newtp->snd_una = seq; |
| 487 | WRITE_ONCE(newtp->snd_nxt, seq); | ||
| 488 | newtp->snd_up = seq; | ||
| 484 | 489 | ||
| 485 | INIT_LIST_HEAD(&newtp->tsq_node); | 490 | INIT_LIST_HEAD(&newtp->tsq_node); |
| 486 | INIT_LIST_HEAD(&newtp->tsorted_sent_queue); | 491 | INIT_LIST_HEAD(&newtp->tsorted_sent_queue); |
| @@ -495,7 +500,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 8 unmodified lines | |||
| 495 | newtp->total_retrans = req->num_retrans; | 500 | newtp->total_retrans = req->num_retrans; |
| 496 | 501 | ||
| 497 | tcp_init_xmit_timers(newsk); | 502 | tcp_init_xmit_timers(newsk); |
| 498 | newtp->write_seq = newtp->pushed_seq = treq->snt_isn + 1; | 503 | WRITE_ONCE(newtp->write_seq, newtp->pushed_seq = treq->snt_isn + 1); |
| 499 | 504 | ||
| 500 | if (sock_flag(newsk, SOCK_KEEPOPEN)) | 505 | if (sock_flag(newsk, SOCK_KEEPOPEN)) |
| 501 | inet_csk_reset_keepalive_timer(newsk, | 506 | inet_csk_reset_keepalive_timer(newsk, |
| @@ -541,7 +546,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 39 unmodified lines | |||
| 541 | newtp->rx_opt.mss_clamp = req->mss; | 546 | newtp->rx_opt.mss_clamp = req->mss; |
| 542 | tcp_ecn_openreq_child(newtp, req); | 547 | tcp_ecn_openreq_child(newtp, req); |
| 543 | newtp->fastopen_req = NULL; | 548 | newtp->fastopen_req = NULL; |
| 544 | newtp->fastopen_rsk = NULL; | 549 | RCU_INIT_POINTER(newtp->fastopen_rsk, NULL); |
| 545 | 550 | ||
| 546 | __TCP_INC_STATS(sock_net(sk), TCP_MIB_PASSIVEOPENS); | 551 | __TCP_INC_STATS(sock_net(sk), TCP_MIB_PASSIVEOPENS); |
| 547 | 552 | ||
| @@ -67,7 +67,7 @@ static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb) · 66 unmodified lines | |||
| 67 | struct tcp_sock *tp = tcp_sk(sk); | 67 | struct tcp_sock *tp = tcp_sk(sk); |
| 68 | unsigned int prior_packets = tp->packets_out; | 68 | unsigned int prior_packets = tp->packets_out; |
| 69 | 69 | ||
| 70 | tp->snd_nxt = TCP_SKB_CB(skb)->end_seq; | 70 | WRITE_ONCE(tp->snd_nxt, TCP_SKB_CB(skb)->end_seq); |
| 71 | 71 | ||
| 72 | __skb_unlink(skb, &sk->sk_write_queue); | 72 | __skb_unlink(skb, &sk->sk_write_queue); |
| 73 | tcp_rbtree_insert(&sk->tcp_rtx_queue, skb); | 73 | tcp_rbtree_insert(&sk->tcp_rtx_queue, skb); |
| @@ -1196,10 +1196,10 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb) · 1122 unmodified lines | |||
| 1196 | struct tcp_sock *tp = tcp_sk(sk); | 1196 | struct tcp_sock *tp = tcp_sk(sk); |
| 1197 | 1197 | ||
| 1198 | /* Advance write_seq and place onto the write_queue. */ | 1198 | /* Advance write_seq and place onto the write_queue. */ |
| 1199 | tp->write_seq = TCP_SKB_CB(skb)->end_seq; | 1199 | WRITE_ONCE(tp->write_seq, TCP_SKB_CB(skb)->end_seq); |
| 1200 | __skb_header_release(skb); | 1200 | __skb_header_release(skb); |
| 1201 | tcp_add_write_queue_tail(sk, skb); | 1201 | tcp_add_write_queue_tail(sk, skb); |
| 1202 | sk->sk_wmem_queued += skb->truesize; | 1202 | sk_wmem_queued_add(sk, skb->truesize); |
| 1203 | sk_mem_charge(sk, skb->truesize); | 1203 | sk_mem_charge(sk, skb->truesize); |
| 1204 | } | 1204 | } |
| 1205 | 1205 | ||
| @@ -1333,7 +1333,7 @@ int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue, · 127 unmodified lines | |||
| 1333 | return -ENOMEM; /* We'll just try again later. */ | 1333 | return -ENOMEM; /* We'll just try again later. */ |
| 1334 | skb_copy_decrypted(buff, skb); | 1334 | skb_copy_decrypted(buff, skb); |
| 1335 | 1335 | ||
| 1336 | sk->sk_wmem_queued += buff->truesize; | 1336 | sk_wmem_queued_add(sk, buff->truesize); |
| 1337 | sk_mem_charge(sk, buff->truesize); | 1337 | sk_mem_charge(sk, buff->truesize); |
| 1338 | nlen = skb->len - len - nsize; | 1338 | nlen = skb->len - len - nsize; |
| 1339 | buff->truesize += nlen; | 1339 | buff->truesize += nlen; |
| @@ -1443,7 +1443,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) · 103 unmodified lines | |||
| 1443 | 1443 | ||
| 1444 | if (delta_truesize) { | 1444 | if (delta_truesize) { |
| 1445 | skb->truesize -= delta_truesize; | 1445 | skb->truesize -= delta_truesize; |
| 1446 | sk->sk_wmem_queued -= delta_truesize; | 1446 | sk_wmem_queued_add(sk, -delta_truesize); |
| 1447 | sk_mem_uncharge(sk, delta_truesize); | 1447 | sk_mem_uncharge(sk, delta_truesize); |
| 1448 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); | 1448 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); |
| 1449 | } | 1449 | } |
| @@ -1888,7 +1888,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, · 438 unmodified lines | |||
| 1888 | return -ENOMEM; | 1888 | return -ENOMEM; |
| 1889 | skb_copy_decrypted(buff, skb); | 1889 | skb_copy_decrypted(buff, skb); |
| 1890 | 1890 | ||
| 1891 | sk->sk_wmem_queued += buff->truesize; | 1891 | sk_wmem_queued_add(sk, buff->truesize); |
| 1892 | sk_mem_charge(sk, buff->truesize); | 1892 | sk_mem_charge(sk, buff->truesize); |
| 1893 | buff->truesize += nlen; | 1893 | buff->truesize += nlen; |
| 1894 | skb->truesize -= nlen; | 1894 | skb->truesize -= nlen; |
| @@ -2152,7 +2152,7 @@ static int tcp_mtu_probe(struct sock *sk) · 257 unmodified lines | |||
| 2152 | nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false); | 2152 | nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false); |
| 2153 | if (!nskb) | 2153 | if (!nskb) |
| 2154 | return -1; | 2154 | return -1; |
| 2155 | sk->sk_wmem_queued += nskb->truesize; | 2155 | sk_wmem_queued_add(sk, nskb->truesize); |
| 2156 | sk_mem_charge(sk, nskb->truesize); | 2156 | sk_mem_charge(sk, nskb->truesize); |
| 2157 | 2157 | ||
| 2158 | skb = tcp_send_head(sk); | 2158 | skb = tcp_send_head(sk); |
| @@ -2482,7 +2482,7 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto) · 323 unmodified lines | |||
| 2482 | /* Don't do any loss probe on a Fast Open connection before 3WHS | 2482 | /* Don't do any loss probe on a Fast Open connection before 3WHS |
| 2483 | * finishes. | 2483 | * finishes. |
| 2484 | */ | 2484 | */ |
| 2485 | if (tp->fastopen_rsk) | 2485 | if (rcu_access_pointer(tp->fastopen_rsk)) |
| 2486 | return false; | 2486 | return false; |
| 2487 | 2487 | ||
| 2488 | early_retrans = sock_net(sk)->ipv4.sysctl_tcp_early_retrans; | 2488 | early_retrans = sock_net(sk)->ipv4.sysctl_tcp_early_retrans; |
| @@ -3142,7 +3142,7 @@ void tcp_send_fin(struct sock *sk) · 653 unmodified lines | |||
| 3142 | * if FIN had been sent. This is because retransmit path | 3142 | * if FIN had been sent. This is because retransmit path |
| 3143 | * does not change tp->snd_nxt. | 3143 | * does not change tp->snd_nxt. |
| 3144 | */ | 3144 | */ |
| 3145 | tp->snd_nxt++; | 3145 | WRITE_ONCE(tp->snd_nxt, tp->snd_nxt + 1); |
| 3146 | return; | 3146 | return; |
| 3147 | } | 3147 | } |
| 3148 | } else { | 3148 | } else { |
| @@ -3222,7 +3222,7 @@ int tcp_send_synack(struct sock *sk) · 73 unmodified lines | |||
| 3222 | tcp_rtx_queue_unlink_and_free(skb, sk); | 3222 | tcp_rtx_queue_unlink_and_free(skb, sk); |
| 3223 | __skb_header_release(nskb); | 3223 | __skb_header_release(nskb); |
| 3224 | tcp_rbtree_insert(&sk->tcp_rtx_queue, nskb); | 3224 | tcp_rbtree_insert(&sk->tcp_rtx_queue, nskb); |
| 3225 | sk->sk_wmem_queued += nskb->truesize; | 3225 | sk_wmem_queued_add(sk, nskb->truesize); |
| 3226 | sk_mem_charge(sk, nskb->truesize); | 3226 | sk_mem_charge(sk, nskb->truesize); |
| 3227 | skb = nskb; | 3227 | skb = nskb; |
| 3228 | } | 3228 | } |
| @@ -3426,14 +3426,14 @@ static void tcp_connect_init(struct sock *sk) · 197 unmodified lines | |||
| 3426 | tp->snd_una = tp->write_seq; | 3426 | tp->snd_una = tp->write_seq; |
| 3427 | tp->snd_sml = tp->write_seq; | 3427 | tp->snd_sml = tp->write_seq; |
| 3428 | tp->snd_up = tp->write_seq; | 3428 | tp->snd_up = tp->write_seq; |
| 3429 | tp->snd_nxt = tp->write_seq; | 3429 | WRITE_ONCE(tp->snd_nxt, tp->write_seq); |
| 3430 | 3430 | ||
| 3431 | if (likely(!tp->repair)) | 3431 | if (likely(!tp->repair)) |
| 3432 | tp->rcv_nxt = 0; | 3432 | tp->rcv_nxt = 0; |
| 3433 | else | 3433 | else |
| 3434 | tp->rcv_tstamp = tcp_jiffies32; | 3434 | tp->rcv_tstamp = tcp_jiffies32; |
| 3435 | tp->rcv_wup = tp->rcv_nxt; | 3435 | tp->rcv_wup = tp->rcv_nxt; |
| 3436 | tp->copied_seq = tp->rcv_nxt; | 3436 | WRITE_ONCE(tp->copied_seq, tp->rcv_nxt); |
| 3437 | 3437 | ||
| 3438 | inet_csk(sk)->icsk_rto = tcp_timeout_init(sk); | 3438 | inet_csk(sk)->icsk_rto = tcp_timeout_init(sk); |
| 3439 | inet_csk(sk)->icsk_retransmits = 0; | 3439 | inet_csk(sk)->icsk_retransmits = 0; |
| @@ -3447,9 +3447,9 @@ static void tcp_connect_queue_skb(struct sock *sk, struct sk_buff *skb) · 7 unmodified lines | |||
| 3447 | 3447 | ||
| 3448 | tcb->end_seq += skb->len; | 3448 | tcb->end_seq += skb->len; |
| 3449 | __skb_header_release(skb); | 3449 | __skb_header_release(skb); |
| 3450 | sk->sk_wmem_queued += skb->truesize; | 3450 | sk_wmem_queued_add(sk, skb->truesize); |
| 3451 | sk_mem_charge(sk, skb->truesize); | 3451 | sk_mem_charge(sk, skb->truesize); |
| 3452 | tp->write_seq = tcb->end_seq; | 3452 | WRITE_ONCE(tp->write_seq, tcb->end_seq); |
| 3453 | tp->packets_out += tcp_skb_pcount(skb); | 3453 | tp->packets_out += tcp_skb_pcount(skb); |
| 3454 | } | 3454 | } |
| 3455 | 3455 | ||
| @@ -3586,11 +3586,11 @@ int tcp_connect(struct sock *sk) · 130 unmodified lines | |||
| 3586 | /* We change tp->snd_nxt after the tcp_transmit_skb() call | 3586 | /* We change tp->snd_nxt after the tcp_transmit_skb() call |
| 3587 | * in order to make this packet get counted in tcpOutSegs. | 3587 | * in order to make this packet get counted in tcpOutSegs. |
| 3588 | */ | 3588 | */ |
| 3589 | tp->snd_nxt = tp->write_seq; | 3589 | WRITE_ONCE(tp->snd_nxt, tp->write_seq); |
| 3590 | tp->pushed_seq = tp->write_seq; | 3590 | tp->pushed_seq = tp->write_seq; |
| 3591 | buff = tcp_send_head(sk); | 3591 | buff = tcp_send_head(sk); |
| 3592 | if (unlikely(buff)) { | 3592 | if (unlikely(buff)) { |
| 3593 | tp->snd_nxt = TCP_SKB_CB(buff)->seq; | 3593 | WRITE_ONCE(tp->snd_nxt, TCP_SKB_CB(buff)->seq); |
| 3594 | tp->pushed_seq = TCP_SKB_CB(buff)->seq; | 3594 | tp->pushed_seq = TCP_SKB_CB(buff)->seq; |
| 3595 | } | 3595 | } |
| 3596 | TCP_INC_STATS(sock_net(sk), TCP_MIB_ACTIVEOPENS); | 3596 | TCP_INC_STATS(sock_net(sk), TCP_MIB_ACTIVEOPENS); |
| @@ -386,15 +386,13 @@ abort: tcp_write_err(sk); · 385 unmodified lines | |||
| 386 | * Timer for Fast Open socket to retransmit SYNACK. Note that the | 386 | * Timer for Fast Open socket to retransmit SYNACK. Note that the |
| 387 | * sk here is the child socket, not the parent (listener) socket. | 387 | * sk here is the child socket, not the parent (listener) socket. |
| 388 | */ | 388 | */ |
| 389 | static void tcp_fastopen_synack_timer(struct sock *sk) | 389 | static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req) |
| 390 | { | 390 | { |
| 391 | struct inet_connection_sock *icsk = inet_csk(sk); | 391 | struct inet_connection_sock *icsk = inet_csk(sk); |
| 392 | int max_retries = icsk->icsk_syn_retries ? : | 392 | int max_retries = icsk->icsk_syn_retries ? : |
| 393 | sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */ | 393 | sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */ |
| 394 | struct tcp_sock *tp = tcp_sk(sk); | 394 | struct tcp_sock *tp = tcp_sk(sk); |
| 395 | struct request_sock *req; | ||
| 396 | 395 | ||
| 397 | req = tcp_sk(sk)->fastopen_rsk; | ||
| 398 | req->rsk_ops->syn_ack_timeout(req); | 396 | req->rsk_ops->syn_ack_timeout(req); |
| 399 | 397 | ||
| 400 | if (req->num_timeout >= max_retries) { | 398 | if (req->num_timeout >= max_retries) { |
| @@ -435,11 +433,14 @@ void tcp_retransmit_timer(struct sock *sk) · 34 unmodified lines | |||
| 435 | struct tcp_sock *tp = tcp_sk(sk); | 433 | struct tcp_sock *tp = tcp_sk(sk); |
| 436 | struct net *net = sock_net(sk); | 434 | struct net *net = sock_net(sk); |
| 437 | struct inet_connection_sock *icsk = inet_csk(sk); | 435 | struct inet_connection_sock *icsk = inet_csk(sk); |
| 436 | struct request_sock *req; | ||
| 438 | 437 | ||
| 439 | if (tp->fastopen_rsk) { | 438 | req = rcu_dereference_protected(tp->fastopen_rsk, |
| 439 | lockdep_sock_is_held(sk)); | ||
| 440 | if (req) { | ||
| 440 | WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV && | 441 | WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV && |
| 441 | sk->sk_state != TCP_FIN_WAIT1); | 442 | sk->sk_state != TCP_FIN_WAIT1); |
| 442 | tcp_fastopen_synack_timer(sk); | 443 | tcp_fastopen_synack_timer(sk, req); |
| 443 | /* Before we receive ACK to our SYN-ACK don't retransmit | 444 | /* Before we receive ACK to our SYN-ACK don't retransmit |
| 444 | * anything else (e.g., data or FIN segments). | 445 | * anything else (e.g., data or FIN segments). |
| 445 | */ | 446 | */ |
| @@ -2192,6 +2192,7 @@ static void ip6erspan_tap_setup(struct net_device *dev) · 2191 unmodified lines | |||
| 2192 | { | 2192 | { |
| 2193 | ether_setup(dev); | 2193 | ether_setup(dev); |
| 2194 | 2194 | ||
| 2195 | dev->max_mtu = 0; | ||
| 2195 | dev->netdev_ops = &ip6erspan_netdev_ops; | 2196 | dev->netdev_ops = &ip6erspan_netdev_ops; |
| 2196 | dev->needs_free_netdev = true; | 2197 | dev->needs_free_netdev = true; |
| 2197 | dev->priv_destructor = ip6gre_dev_free; | 2198 | dev->priv_destructor = ip6gre_dev_free; |
| @@ -768,6 +768,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 767 unmodified lines | |||
| 768 | inet6_sk(skb->sk) : NULL; | 768 | inet6_sk(skb->sk) : NULL; |
| 769 | struct ip6_frag_state state; | 769 | struct ip6_frag_state state; |
| 770 | unsigned int mtu, hlen, nexthdr_offset; | 770 | unsigned int mtu, hlen, nexthdr_offset; |
| 771 | ktime_t tstamp = skb->tstamp; | ||
| 771 | int hroom, err = 0; | 772 | int hroom, err = 0; |
| 772 | __be32 frag_id; | 773 | __be32 frag_id; |
| 773 | u8 *prevhdr, nexthdr = 0; | 774 | u8 *prevhdr, nexthdr = 0; |
| @@ -855,6 +856,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 81 unmodified lines | |||
| 855 | if (iter.frag) | 856 | if (iter.frag) |
| 856 | ip6_fraglist_prepare(skb, &iter); | 857 | ip6_fraglist_prepare(skb, &iter); |
| 857 | 858 | ||
| 859 | skb->tstamp = tstamp; | ||
| 858 | err = output(net, sk, skb); | 860 | err = output(net, sk, skb); |
| 859 | if (!err) | 861 | if (!err) |
| 860 | IP6_INC_STATS(net, ip6_dst_idev(&rt->dst), | 862 | IP6_INC_STATS(net, ip6_dst_idev(&rt->dst), |
| @@ -913,6 +915,7 @@ slow_path: · 52 unmodified lines | |||
| 913 | /* | 915 | /* |
| 914 | * Put this fragment into the sending queue. | 916 | * Put this fragment into the sending queue. |
| 915 | */ | 917 | */ |
| 918 | frag->tstamp = tstamp; | ||
| 916 | err = output(net, sk, frag); | 919 | err = output(net, sk, frag); |
| 917 | if (err) | 920 | if (err) |
| 918 | goto fail; | 921 | goto fail; |
| @@ -119,6 +119,7 @@ int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 118 unmodified lines | |||
| 119 | struct sk_buff *)) | 119 | struct sk_buff *)) |
| 120 | { | 120 | { |
| 121 | int frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size; | 121 | int frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size; |
| 122 | ktime_t tstamp = skb->tstamp; | ||
| 122 | struct ip6_frag_state state; | 123 | struct ip6_frag_state state; |
| 123 | u8 *prevhdr, nexthdr = 0; | 124 | u8 *prevhdr, nexthdr = 0; |
| 124 | unsigned int mtu, hlen; | 125 | unsigned int mtu, hlen; |
| @@ -183,6 +184,7 @@ int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 58 unmodified lines | |||
| 183 | if (iter.frag) | 184 | if (iter.frag) |
| 184 | ip6_fraglist_prepare(skb, &iter); | 185 | ip6_fraglist_prepare(skb, &iter); |
| 185 | 186 | ||
| 187 | skb->tstamp = tstamp; | ||
| 186 | err = output(net, sk, data, skb); | 188 | err = output(net, sk, data, skb); |
| 187 | if (err || !iter.frag) | 189 | if (err || !iter.frag) |
| 188 | break; | 190 | break; |
| @@ -215,6 +217,7 @@ slow_path: · 26 unmodified lines | |||
| 215 | goto blackhole; | 217 | goto blackhole; |
| 216 | } | 218 | } |
| 217 | 219 | ||
| 220 | skb2->tstamp = tstamp; | ||
| 218 | err = output(net, sk, data, skb2); | 221 | err = output(net, sk, data, skb2); |
| 219 | if (err) | 222 | if (err) |
| 220 | goto blackhole; | 223 | goto blackhole; |
| @@ -215,7 +215,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, · 214 unmodified lines | |||
| 215 | !ipv6_addr_equal(&sk->sk_v6_daddr, &usin->sin6_addr)) { | 215 | !ipv6_addr_equal(&sk->sk_v6_daddr, &usin->sin6_addr)) { |
| 216 | tp->rx_opt.ts_recent = 0; | 216 | tp->rx_opt.ts_recent = 0; |
| 217 | tp->rx_opt.ts_recent_stamp = 0; | 217 | tp->rx_opt.ts_recent_stamp = 0; |
| 218 | tp->write_seq = 0; | 218 | WRITE_ONCE(tp->write_seq, 0); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | sk->sk_v6_daddr = usin->sin6_addr; | 221 | sk->sk_v6_daddr = usin->sin6_addr; |
| @@ -311,10 +311,11 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, · 89 unmodified lines | |||
| 311 | 311 | ||
| 312 | if (likely(!tp->repair)) { | 312 | if (likely(!tp->repair)) { |
| 313 | if (!tp->write_seq) | 313 | if (!tp->write_seq) |
| 314 | tp->write_seq = secure_tcpv6_seq(np->saddr.s6_addr32, | 314 | WRITE_ONCE(tp->write_seq, |
| 315 | sk->sk_v6_daddr.s6_addr32, | 315 | secure_tcpv6_seq(np->saddr.s6_addr32, |
| 316 | inet->inet_sport, | 316 | sk->sk_v6_daddr.s6_addr32, |
| 317 | inet->inet_dport); | 317 | inet->inet_sport, |
| 318 | inet->inet_dport)); | ||
| 318 | tp->tsoffset = secure_tcpv6_ts_off(sock_net(sk), | 319 | tp->tsoffset = secure_tcpv6_ts_off(sock_net(sk), |
| 319 | np->saddr.s6_addr32, | 320 | np->saddr.s6_addr32, |
| 320 | sk->sk_v6_daddr.s6_addr32); | 321 | sk->sk_v6_daddr.s6_addr32); |
| @@ -406,7 +407,7 @@ static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 85 unmodified lines | |||
| 406 | 407 | ||
| 407 | tp = tcp_sk(sk); | 408 | tp = tcp_sk(sk); |
| 408 | /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */ | 409 | /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */ |
| 409 | fastopen = tp->fastopen_rsk; | 410 | fastopen = rcu_dereference(tp->fastopen_rsk); |
| 410 | snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una; | 411 | snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una; |
| 411 | if (sk->sk_state != TCP_LISTEN && | 412 | if (sk->sk_state != TCP_LISTEN && |
| 412 | !between(seq, snd_una, tp->snd_nxt)) { | 413 | !between(seq, snd_una, tp->snd_nxt)) { |
| @@ -1895,7 +1896,8 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) · 1482 unmodified lines | |||
| 1895 | /* Because we don't lock the socket, | 1896 | /* Because we don't lock the socket, |
| 1896 | * we might find a transient negative value. | 1897 | * we might find a transient negative value. |
| 1897 | */ | 1898 | */ |
| 1898 | rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); | 1899 | rx_queue = max_t(int, READ_ONCE(tp->rcv_nxt) - |
| 1900 | READ_ONCE(tp->copied_seq), 0); | ||
| 1899 | 1901 | ||
| 1900 | seq_printf(seq, | 1902 | seq_printf(seq, |
| 1901 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " | 1903 | "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
| @@ -1906,7 +1908,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) · 4 unmodified lines | |||
| 1906 | dest->s6_addr32[0], dest->s6_addr32[1], | 1908 | dest->s6_addr32[0], dest->s6_addr32[1], |
| 1907 | dest->s6_addr32[2], dest->s6_addr32[3], destp, | 1909 | dest->s6_addr32[2], dest->s6_addr32[3], destp, |
| 1908 | state, | 1910 | state, |
| 1909 | tp->write_seq - tp->snd_una, | 1911 | READ_ONCE(tp->write_seq) - tp->snd_una, |
| 1910 | rx_queue, | 1912 | rx_queue, |
| 1911 | timer_active, | 1913 | timer_active, |
| 1912 | jiffies_delta_to_clock_t(timer_expires - jiffies), | 1914 | jiffies_delta_to_clock_t(timer_expires - jiffies), |
| @@ -113,22 +113,26 @@ static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr) · 112 unmodified lines | |||
| 113 | * | 113 | * |
| 114 | * Send data via reliable llc2 connection. | 114 | * Send data via reliable llc2 connection. |
| 115 | * Returns 0 upon success, non-zero if action did not succeed. | 115 | * Returns 0 upon success, non-zero if action did not succeed. |
| 116 | * | ||
| 117 | * This function always consumes a reference to the skb. | ||
| 116 | */ | 118 | */ |
| 117 | static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock) | 119 | static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock) |
| 118 | { | 120 | { |
| 119 | struct llc_sock* llc = llc_sk(sk); | 121 | struct llc_sock* llc = llc_sk(sk); |
| 120 | int rc = 0; | ||
| 121 | 122 | ||
| 122 | if (unlikely(llc_data_accept_state(llc->state) || | 123 | if (unlikely(llc_data_accept_state(llc->state) || |
| 123 | llc->remote_busy_flag || | 124 | llc->remote_busy_flag || |
| 124 | llc->p_flag)) { | 125 | llc->p_flag)) { |
| 125 | long timeout = sock_sndtimeo(sk, noblock); | 126 | long timeout = sock_sndtimeo(sk, noblock); |
| 127 | int rc; | ||
| 126 | 128 | ||
| 127 | rc = llc_ui_wait_for_busy_core(sk, timeout); | 129 | rc = llc_ui_wait_for_busy_core(sk, timeout); |
| 130 | if (rc) { | ||
| 131 | kfree_skb(skb); | ||
| 132 | return rc; | ||
| 133 | } | ||
| 128 | } | 134 | } |
| 129 | if (unlikely(!rc)) | 135 | return llc_build_and_send_pkt(sk, skb); |
| 130 | rc = llc_build_and_send_pkt(sk, skb); | ||
| 131 | return rc; | ||
| 132 | } | 136 | } |
| 133 | 137 | ||
| 134 | static void llc_ui_sk_init(struct socket *sock, struct sock *sk) | 138 | static void llc_ui_sk_init(struct socket *sock, struct sock *sk) |
| @@ -899,7 +903,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 764 unmodified lines | |||
| 899 | DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name); | 903 | DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name); |
| 900 | int flags = msg->msg_flags; | 904 | int flags = msg->msg_flags; |
| 901 | int noblock = flags & MSG_DONTWAIT; | 905 | int noblock = flags & MSG_DONTWAIT; |
| 902 | struct sk_buff *skb; | 906 | struct sk_buff *skb = NULL; |
| 903 | size_t size = 0; | 907 | size_t size = 0; |
| 904 | int rc = -EINVAL, copied = 0, hdrlen; | 908 | int rc = -EINVAL, copied = 0, hdrlen; |
| 905 | 909 | ||
| @@ -908,10 +912,10 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 2 unmodified lines | |||
| 908 | lock_sock(sk); | 912 | lock_sock(sk); |
| 909 | if (addr) { | 913 | if (addr) { |
| 910 | if (msg->msg_namelen < sizeof(*addr)) | 914 | if (msg->msg_namelen < sizeof(*addr)) |
| 911 | goto release; | 915 | goto out; |
| 912 | } else { | 916 | } else { |
| 913 | if (llc_ui_addr_null(&llc->addr)) | 917 | if (llc_ui_addr_null(&llc->addr)) |
| 914 | goto release; | 918 | goto out; |
| 915 | addr = &llc->addr; | 919 | addr = &llc->addr; |
| 916 | } | 920 | } |
| 917 | /* must bind connection to sap if user hasn't done it. */ | 921 | /* must bind connection to sap if user hasn't done it. */ |
| @@ -919,7 +923,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 1 unmodified line | |||
| 919 | /* bind to sap with null dev, exclusive. */ | 923 | /* bind to sap with null dev, exclusive. */ |
| 920 | rc = llc_ui_autobind(sock, addr); | 924 | rc = llc_ui_autobind(sock, addr); |
| 921 | if (rc) | 925 | if (rc) |
| 922 | goto release; | 926 | goto out; |
| 923 | } | 927 | } |
| 924 | hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr); | 928 | hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr); |
| 925 | size = hdrlen + len; | 929 | size = hdrlen + len; |
| @@ -928,12 +932,12 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 2 unmodified lines | |||
| 928 | copied = size - hdrlen; | 932 | copied = size - hdrlen; |
| 929 | rc = -EINVAL; | 933 | rc = -EINVAL; |
| 930 | if (copied < 0) | 934 | if (copied < 0) |
| 931 | goto release; | 935 | goto out; |
| 932 | release_sock(sk); | 936 | release_sock(sk); |
| 933 | skb = sock_alloc_send_skb(sk, size, noblock, &rc); | 937 | skb = sock_alloc_send_skb(sk, size, noblock, &rc); |
| 934 | lock_sock(sk); | 938 | lock_sock(sk); |
| 935 | if (!skb) | 939 | if (!skb) |
| 936 | goto release; | 940 | goto out; |
| 937 | skb->dev = llc->dev; | 941 | skb->dev = llc->dev; |
| 938 | skb->protocol = llc_proto_type(addr->sllc_arphrd); | 942 | skb->protocol = llc_proto_type(addr->sllc_arphrd); |
| 939 | skb_reserve(skb, hdrlen); | 943 | skb_reserve(skb, hdrlen); |
| @@ -943,29 +947,31 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 3 unmodified lines | |||
| 943 | if (sk->sk_type == SOCK_DGRAM || addr->sllc_ua) { | 947 | if (sk->sk_type == SOCK_DGRAM || addr->sllc_ua) { |
| 944 | llc_build_and_send_ui_pkt(llc->sap, skb, addr->sllc_mac, | 948 | llc_build_and_send_ui_pkt(llc->sap, skb, addr->sllc_mac, |
| 945 | addr->sllc_sap); | 949 | addr->sllc_sap); |
| 950 | skb = NULL; | ||
| 946 | goto out; | 951 | goto out; |
| 947 | } | 952 | } |
| 948 | if (addr->sllc_test) { | 953 | if (addr->sllc_test) { |
| 949 | llc_build_and_send_test_pkt(llc->sap, skb, addr->sllc_mac, | 954 | llc_build_and_send_test_pkt(llc->sap, skb, addr->sllc_mac, |
| 950 | addr->sllc_sap); | 955 | addr->sllc_sap); |
| 956 | skb = NULL; | ||
| 951 | goto out; | 957 | goto out; |
| 952 | } | 958 | } |
| 953 | if (addr->sllc_xid) { | 959 | if (addr->sllc_xid) { |
| 954 | llc_build_and_send_xid_pkt(llc->sap, skb, addr->sllc_mac, | 960 | llc_build_and_send_xid_pkt(llc->sap, skb, addr->sllc_mac, |
| 955 | addr->sllc_sap); | 961 | addr->sllc_sap); |
| 962 | skb = NULL; | ||
| 956 | goto out; | 963 | goto out; |
| 957 | } | 964 | } |
| 958 | rc = -ENOPROTOOPT; | 965 | rc = -ENOPROTOOPT; |
| 959 | if (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua)) | 966 | if (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua)) |
| 960 | goto out; | 967 | goto out; |
| 961 | rc = llc_ui_send_data(sk, skb, noblock); | 968 | rc = llc_ui_send_data(sk, skb, noblock); |
| 969 | skb = NULL; | ||
| 962 | out: | 970 | out: |
| 963 | if (rc) { | 971 | kfree_skb(skb); |
| 964 | kfree_skb(skb); | 972 | if (rc) |
| 965 | release: | ||
| 966 | dprintk("%s: failed sending from %02X to %02X: %d\n", | 973 | dprintk("%s: failed sending from %02X to %02X: %d\n", |
| 967 | __func__, llc->laddr.lsap, llc->daddr.lsap, rc); | 974 | __func__, llc->laddr.lsap, llc->daddr.lsap, rc); |
| 968 | } | ||
| 969 | release_sock(sk); | 975 | release_sock(sk); |
| 970 | return rc ? : copied; | 976 | return rc ? : copied; |
| 971 | } | 977 | } |
| @@ -372,6 +372,7 @@ int llc_conn_ac_send_i_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) · 371 unmodified lines | |||
| 372 | llc_pdu_init_as_i_cmd(skb, 1, llc->vS, llc->vR); | 372 | llc_pdu_init_as_i_cmd(skb, 1, llc->vS, llc->vR); |
| 373 | rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); | 373 | rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); |
| 374 | if (likely(!rc)) { | 374 | if (likely(!rc)) { |
| 375 | skb_get(skb); | ||
| 375 | llc_conn_send_pdu(sk, skb); | 376 | llc_conn_send_pdu(sk, skb); |
| 376 | llc_conn_ac_inc_vs_by_1(sk, skb); | 377 | llc_conn_ac_inc_vs_by_1(sk, skb); |
| 377 | } | 378 | } |
| @@ -389,7 +390,8 @@ static int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk, struct sk_buff *skb) · 11 unmodified lines | |||
| 389 | llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR); | 390 | llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR); |
| 390 | rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); | 391 | rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); |
| 391 | if (likely(!rc)) { | 392 | if (likely(!rc)) { |
| 392 | rc = llc_conn_send_pdu(sk, skb); | 393 | skb_get(skb); |
| 394 | llc_conn_send_pdu(sk, skb); | ||
| 393 | llc_conn_ac_inc_vs_by_1(sk, skb); | 395 | llc_conn_ac_inc_vs_by_1(sk, skb); |
| 394 | } | 396 | } |
| 395 | return rc; | 397 | return rc; |
| @@ -406,6 +408,7 @@ int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) · 10 unmodified lines | |||
| 406 | llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR); | 408 | llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR); |
| 407 | rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); | 409 | rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); |
| 408 | if (likely(!rc)) { | 410 | if (likely(!rc)) { |
| 411 | skb_get(skb); | ||
| 409 | llc_conn_send_pdu(sk, skb); | 412 | llc_conn_send_pdu(sk, skb); |
| 410 | llc_conn_ac_inc_vs_by_1(sk, skb); | 413 | llc_conn_ac_inc_vs_by_1(sk, skb); |
| 411 | } | 414 | } |
| @@ -916,7 +919,8 @@ static int llc_conn_ac_send_i_rsp_f_set_ackpf(struct sock *sk, · 504 unmodified lines | |||
| 916 | llc_pdu_init_as_i_cmd(skb, llc->ack_pf, llc->vS, llc->vR); | 919 | llc_pdu_init_as_i_cmd(skb, llc->ack_pf, llc->vS, llc->vR); |
| 917 | rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); | 920 | rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac); |
| 918 | if (likely(!rc)) { | 921 | if (likely(!rc)) { |
| 919 | rc = llc_conn_send_pdu(sk, skb); | 922 | skb_get(skb); |
| 923 | llc_conn_send_pdu(sk, skb); | ||
| 920 | llc_conn_ac_inc_vs_by_1(sk, skb); | 924 | llc_conn_ac_inc_vs_by_1(sk, skb); |
| 921 | } | 925 | } |
| 922 | return rc; | 926 | return rc; |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | |||
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | static int llc_find_offset(int state, int ev_type); | 32 | static int llc_find_offset(int state, int ev_type); |
| 33 | static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *skb); | 33 | static void llc_conn_send_pdus(struct sock *sk); |
| 34 | static int llc_conn_service(struct sock *sk, struct sk_buff *skb); | 34 | static int llc_conn_service(struct sock *sk, struct sk_buff *skb); |
| 35 | static int llc_exec_conn_trans_actions(struct sock *sk, | 35 | static int llc_exec_conn_trans_actions(struct sock *sk, |
| 36 | struct llc_conn_state_trans *trans, | 36 | struct llc_conn_state_trans *trans, |
| @@ -55,6 +55,8 @@ int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ; · 18 unmodified lines | |||
| 55 | * (executing it's actions and changing state), upper layer will be | 55 | * (executing it's actions and changing state), upper layer will be |
| 56 | * indicated or confirmed, if needed. Returns 0 for success, 1 for | 56 | * indicated or confirmed, if needed. Returns 0 for success, 1 for |
| 57 | * failure. The socket lock has to be held before calling this function. | 57 | * failure. The socket lock has to be held before calling this function. |
| 58 | * | ||
| 59 | * This function always consumes a reference to the skb. | ||
| 58 | */ | 60 | */ |
| 59 | int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) | 61 | int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) |
| 60 | { | 62 | { |
| @@ -62,12 +64,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 1 unmodified line | |||
| 62 | struct llc_sock *llc = llc_sk(skb->sk); | 64 | struct llc_sock *llc = llc_sk(skb->sk); |
| 63 | struct llc_conn_state_ev *ev = llc_conn_ev(skb); | 65 | struct llc_conn_state_ev *ev = llc_conn_ev(skb); |
| 64 | 66 | ||
| 65 | /* | ||
| 66 | * We have to hold the skb, because llc_conn_service will kfree it in | ||
| 67 | * the sending path and we need to look at the skb->cb, where we encode | ||
| 68 | * llc_conn_state_ev. | ||
| 69 | */ | ||
| 70 | skb_get(skb); | ||
| 71 | ev->ind_prim = ev->cfm_prim = 0; | 67 | ev->ind_prim = ev->cfm_prim = 0; |
| 72 | /* | 68 | /* |
| 73 | * Send event to state machine | 69 | * Send event to state machine |
| @@ -75,21 +71,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 1 unmodified line | |||
| 75 | rc = llc_conn_service(skb->sk, skb); | 71 | rc = llc_conn_service(skb->sk, skb); |
| 76 | if (unlikely(rc != 0)) { | 72 | if (unlikely(rc != 0)) { |
| 77 | printk(KERN_ERR "%s: llc_conn_service failed\n", __func__); | 73 | printk(KERN_ERR "%s: llc_conn_service failed\n", __func__); |
| 78 | goto out_kfree_skb; | ||
| 79 | } | ||
| 80 | |||
| 81 | if (unlikely(!ev->ind_prim && !ev->cfm_prim)) { | ||
| 82 | /* indicate or confirm not required */ | ||
| 83 | if (!skb->next) | ||
| 84 | goto out_kfree_skb; | ||
| 85 | goto out_skb_put; | 74 | goto out_skb_put; |
| 86 | } | 75 | } |
| 87 | 76 | ||
| 88 | if (unlikely(ev->ind_prim && ev->cfm_prim)) /* Paranoia */ | ||
| 89 | skb_get(skb); | ||
| 90 | |||
| 91 | switch (ev->ind_prim) { | 77 | switch (ev->ind_prim) { |
| 92 | case LLC_DATA_PRIM: | 78 | case LLC_DATA_PRIM: |
| 79 | skb_get(skb); | ||
| 93 | llc_save_primitive(sk, skb, LLC_DATA_PRIM); | 80 | llc_save_primitive(sk, skb, LLC_DATA_PRIM); |
| 94 | if (unlikely(sock_queue_rcv_skb(sk, skb))) { | 81 | if (unlikely(sock_queue_rcv_skb(sk, skb))) { |
| 95 | /* | 82 | /* |
| @@ -106,6 +93,7 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 10 unmodified lines | |||
| 106 | * skb->sk pointing to the newly created struct sock in | 93 | * skb->sk pointing to the newly created struct sock in |
| 107 | * llc_conn_handler. -acme | 94 | * llc_conn_handler. -acme |
| 108 | */ | 95 | */ |
| 96 | skb_get(skb); | ||
| 109 | skb_queue_tail(&sk->sk_receive_queue, skb); | 97 | skb_queue_tail(&sk->sk_receive_queue, skb); |
| 110 | sk->sk_state_change(sk); | 98 | sk->sk_state_change(sk); |
| 111 | break; | 99 | break; |
| @@ -121,7 +109,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 9 unmodified lines | |||
| 121 | sk->sk_state_change(sk); | 109 | sk->sk_state_change(sk); |
| 122 | } | 110 | } |
| 123 | } | 111 | } |
| 124 | kfree_skb(skb); | ||
| 125 | sock_put(sk); | 112 | sock_put(sk); |
| 126 | break; | 113 | break; |
| 127 | case LLC_RESET_PRIM: | 114 | case LLC_RESET_PRIM: |
| @@ -130,14 +117,11 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 2 unmodified lines | |||
| 130 | * RESET is not being notified to upper layers for now | 117 | * RESET is not being notified to upper layers for now |
| 131 | */ | 118 | */ |
| 132 | printk(KERN_INFO "%s: received a reset ind!\n", __func__); | 119 | printk(KERN_INFO "%s: received a reset ind!\n", __func__); |
| 133 | kfree_skb(skb); | ||
| 134 | break; | 120 | break; |
| 135 | default: | 121 | default: |
| 136 | if (ev->ind_prim) { | 122 | if (ev->ind_prim) |
| 137 | printk(KERN_INFO "%s: received unknown %d prim!\n", | 123 | printk(KERN_INFO "%s: received unknown %d prim!\n", |
| 138 | __func__, ev->ind_prim); | 124 | __func__, ev->ind_prim); |
| 139 | kfree_skb(skb); | ||
| 140 | } | ||
| 141 | /* No indication */ | 125 | /* No indication */ |
| 142 | break; | 126 | break; |
| 143 | } | 127 | } |
| @@ -179,25 +163,22 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 35 unmodified lines | |||
| 179 | printk(KERN_INFO "%s: received a reset conf!\n", __func__); | 163 | printk(KERN_INFO "%s: received a reset conf!\n", __func__); |
| 180 | break; | 164 | break; |
| 181 | default: | 165 | default: |
| 182 | if (ev->cfm_prim) { | 166 | if (ev->cfm_prim) |
| 183 | printk(KERN_INFO "%s: received unknown %d prim!\n", | 167 | printk(KERN_INFO "%s: received unknown %d prim!\n", |
| 184 | __func__, ev->cfm_prim); | 168 | __func__, ev->cfm_prim); |
| 185 | break; | 169 | /* No confirmation */ |
| 186 | } | 170 | break; |
| 187 | goto out_skb_put; /* No confirmation */ | ||
| 188 | } | 171 | } |
| 189 | out_kfree_skb: | ||
| 190 | kfree_skb(skb); | ||
| 191 | out_skb_put: | 172 | out_skb_put: |
| 192 | kfree_skb(skb); | 173 | kfree_skb(skb); |
| 193 | return rc; | 174 | return rc; |
| 194 | } | 175 | } |
| 195 | 176 | ||
| 196 | int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb) | 177 | void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb) |
| 197 | { | 178 | { |
| 198 | /* queue PDU to send to MAC layer */ | 179 | /* queue PDU to send to MAC layer */ |
| 199 | skb_queue_tail(&sk->sk_write_queue, skb); | 180 | skb_queue_tail(&sk->sk_write_queue, skb); |
| 200 | return llc_conn_send_pdus(sk, skb); | 181 | llc_conn_send_pdus(sk); |
| 201 | } | 182 | } |
| 202 | 183 | ||
| 203 | /** | 184 | /** |
| @@ -255,7 +236,7 @@ void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit) · 51 unmodified lines | |||
| 255 | if (howmany_resend > 0) | 236 | if (howmany_resend > 0) |
| 256 | llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; | 237 | llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; |
| 257 | /* any PDUs to re-send are queued up; start sending to MAC */ | 238 | /* any PDUs to re-send are queued up; start sending to MAC */ |
| 258 | llc_conn_send_pdus(sk, NULL); | 239 | llc_conn_send_pdus(sk); |
| 259 | out:; | 240 | out:; |
| 260 | } | 241 | } |
| 261 | 242 | ||
| @@ -296,7 +277,7 @@ void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit) · 34 unmodified lines | |||
| 296 | if (howmany_resend > 0) | 277 | if (howmany_resend > 0) |
| 297 | llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; | 278 | llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; |
| 298 | /* any PDUs to re-send are queued up; start sending to MAC */ | 279 | /* any PDUs to re-send are queued up; start sending to MAC */ |
| 299 | llc_conn_send_pdus(sk, NULL); | 280 | llc_conn_send_pdus(sk); |
| 300 | out:; | 281 | out:; |
| 301 | } | 282 | } |
| 302 | 283 | ||
| @@ -340,16 +321,12 @@ out: · 37 unmodified lines | |||
| 340 | /** | 321 | /** |
| 341 | * llc_conn_send_pdus - Sends queued PDUs | 322 | * llc_conn_send_pdus - Sends queued PDUs |
| 342 | * @sk: active connection | 323 | * @sk: active connection |
| 343 | * @hold_skb: the skb held by caller, or NULL if does not care | ||
| 344 | * | 324 | * |
| 345 | * Sends queued pdus to MAC layer for transmission. When @hold_skb is | 325 | * Sends queued pdus to MAC layer for transmission. |
| 346 | * NULL, always return 0. Otherwise, return 0 if @hold_skb is sent | ||
| 347 | * successfully, or 1 for failure. | ||
| 348 | */ | 326 | */ |
| 349 | static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *hold_skb) | 327 | static void llc_conn_send_pdus(struct sock *sk) |
| 350 | { | 328 | { |
| 351 | struct sk_buff *skb; | 329 | struct sk_buff *skb; |
| 352 | int ret = 0; | ||
| 353 | 330 | ||
| 354 | while ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL) { | 331 | while ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL) { |
| 355 | struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); | 332 | struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb); |
| @@ -361,20 +338,10 @@ static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *hold_skb) · 5 unmodified lines | |||
| 361 | skb_queue_tail(&llc_sk(sk)->pdu_unack_q, skb); | 338 | skb_queue_tail(&llc_sk(sk)->pdu_unack_q, skb); |
| 362 | if (!skb2) | 339 | if (!skb2) |
| 363 | break; | 340 | break; |
| 364 | dev_queue_xmit(skb2); | 341 | skb = skb2; |
| 365 | } else { | ||
| 366 | bool is_target = skb == hold_skb; | ||
| 367 | int rc; | ||
| 368 | |||
| 369 | if (is_target) | ||
| 370 | skb_get(skb); | ||
| 371 | rc = dev_queue_xmit(skb); | ||
| 372 | if (is_target) | ||
| 373 | ret = rc; | ||
| 374 | } | 342 | } |
| 343 | dev_queue_xmit(skb); | ||
| 375 | } | 344 | } |
| 376 | |||
| 377 | return ret; | ||
| 378 | } | 345 | } |
| 379 | 346 | ||
| 380 | /** | 347 | /** |
| @@ -846,7 +813,7 @@ void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb) · 465 unmodified lines | |||
| 846 | else { | 813 | else { |
| 847 | dprintk("%s: adding to backlog...\n", __func__); | 814 | dprintk("%s: adding to backlog...\n", __func__); |
| 848 | llc_set_backlog_type(skb, LLC_PACKET); | 815 | llc_set_backlog_type(skb, LLC_PACKET); |
| 849 | if (sk_add_backlog(sk, skb, sk->sk_rcvbuf)) | 816 | if (sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf))) |
| 850 | goto drop_unlock; | 817 | goto drop_unlock; |
| 851 | } | 818 | } |
| 852 | out: | 819 | out: |
| @@ -38,6 +38,8 @@ · 37 unmodified lines | |||
| 38 | * closed and -EBUSY when sending data is not permitted in this state or | 38 | * closed and -EBUSY when sending data is not permitted in this state or |
| 39 | * LLC has send an I pdu with p bit set to 1 and is waiting for it's | 39 | * LLC has send an I pdu with p bit set to 1 and is waiting for it's |
| 40 | * response. | 40 | * response. |
| 41 | * | ||
| 42 | * This function always consumes a reference to the skb. | ||
| 41 | */ | 43 | */ |
| 42 | int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb) | 44 | int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb) |
| 43 | { | 45 | { |
| @@ -46,20 +48,22 @@ int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb) · 2 unmodified lines | |||
| 46 | struct llc_sock *llc = llc_sk(sk); | 48 | struct llc_sock *llc = llc_sk(sk); |
| 47 | 49 | ||
| 48 | if (unlikely(llc->state == LLC_CONN_STATE_ADM)) | 50 | if (unlikely(llc->state == LLC_CONN_STATE_ADM)) |
| 49 | goto out; | 51 | goto out_free; |
| 50 | rc = -EBUSY; | 52 | rc = -EBUSY; |
| 51 | if (unlikely(llc_data_accept_state(llc->state) || /* data_conn_refuse */ | 53 | if (unlikely(llc_data_accept_state(llc->state) || /* data_conn_refuse */ |
| 52 | llc->p_flag)) { | 54 | llc->p_flag)) { |
| 53 | llc->failed_data_req = 1; | 55 | llc->failed_data_req = 1; |
| 54 | goto out; | 56 | goto out_free; |
| 55 | } | 57 | } |
| 56 | ev = llc_conn_ev(skb); | 58 | ev = llc_conn_ev(skb); |
| 57 | ev->type = LLC_CONN_EV_TYPE_PRIM; | 59 | ev->type = LLC_CONN_EV_TYPE_PRIM; |
| 58 | ev->prim = LLC_DATA_PRIM; | 60 | ev->prim = LLC_DATA_PRIM; |
| 59 | ev->prim_type = LLC_PRIM_TYPE_REQ; | 61 | ev->prim_type = LLC_PRIM_TYPE_REQ; |
| 60 | skb->dev = llc->dev; | 62 | skb->dev = llc->dev; |
| 61 | rc = llc_conn_state_process(sk, skb); | 63 | return llc_conn_state_process(sk, skb); |
| 62 | out: | 64 | |
| 65 | out_free: | ||
| 66 | kfree_skb(skb); | ||
| 63 | return rc; | 67 | return rc; |
| 64 | } | 68 | } |
| 65 | 69 | ||
| @@ -58,8 +58,10 @@ int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb) · 57 unmodified lines | |||
| 58 | ev->daddr.lsap, LLC_PDU_CMD); | 58 | ev->daddr.lsap, LLC_PDU_CMD); |
| 59 | llc_pdu_init_as_ui_cmd(skb); | 59 | llc_pdu_init_as_ui_cmd(skb); |
| 60 | rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); | 60 | rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); |
| 61 | if (likely(!rc)) | 61 | if (likely(!rc)) { |
| 62 | skb_get(skb); | ||
| 62 | rc = dev_queue_xmit(skb); | 63 | rc = dev_queue_xmit(skb); |
| 64 | } | ||
| 63 | return rc; | 65 | return rc; |
| 64 | } | 66 | } |
| 65 | 67 | ||
| @@ -81,8 +83,10 @@ int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb) · 15 unmodified lines | |||
| 81 | ev->daddr.lsap, LLC_PDU_CMD); | 83 | ev->daddr.lsap, LLC_PDU_CMD); |
| 82 | llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0); | 84 | llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0); |
| 83 | rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); | 85 | rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); |
| 84 | if (likely(!rc)) | 86 | if (likely(!rc)) { |
| 87 | skb_get(skb); | ||
| 85 | rc = dev_queue_xmit(skb); | 88 | rc = dev_queue_xmit(skb); |
| 89 | } | ||
| 86 | return rc; | 90 | return rc; |
| 87 | } | 91 | } |
| 88 | 92 | ||
| @@ -135,8 +139,10 @@ int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb) · 46 unmodified lines | |||
| 135 | ev->daddr.lsap, LLC_PDU_CMD); | 139 | ev->daddr.lsap, LLC_PDU_CMD); |
| 136 | llc_pdu_init_as_test_cmd(skb); | 140 | llc_pdu_init_as_test_cmd(skb); |
| 137 | rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); | 141 | rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac); |
| 138 | if (likely(!rc)) | 142 | if (likely(!rc)) { |
| 143 | skb_get(skb); | ||
| 139 | rc = dev_queue_xmit(skb); | 144 | rc = dev_queue_xmit(skb); |
| 145 | } | ||
| 140 | return rc; | 146 | return rc; |
| 141 | } | 147 | } |
| 142 | 148 | ||
| @@ -197,29 +197,22 @@ out: · 196 unmodified lines | |||
| 197 | * After executing actions of the event, upper layer will be indicated | 197 | * After executing actions of the event, upper layer will be indicated |
| 198 | * if needed(on receiving an UI frame). sk can be null for the | 198 | * if needed(on receiving an UI frame). sk can be null for the |
| 199 | * datalink_proto case. | 199 | * datalink_proto case. |
| 200 | * | ||
| 201 | * This function always consumes a reference to the skb. | ||
| 200 | */ | 202 | */ |
| 201 | static void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb) | 203 | static void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb) |
| 202 | { | 204 | { |
| 203 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); | 205 | struct llc_sap_state_ev *ev = llc_sap_ev(skb); |
| 204 | 206 | ||
| 205 | /* | ||
| 206 | * We have to hold the skb, because llc_sap_next_state | ||
| 207 | * will kfree it in the sending path and we need to | ||
| 208 | * look at the skb->cb, where we encode llc_sap_state_ev. | ||
| 209 | */ | ||
| 210 | skb_get(skb); | ||
| 211 | ev->ind_cfm_flag = 0; | 207 | ev->ind_cfm_flag = 0; |
| 212 | llc_sap_next_state(sap, skb); | 208 | llc_sap_next_state(sap, skb); |
| 213 | if (ev->ind_cfm_flag == LLC_IND) { | ||
| 214 | if (skb->sk->sk_state == TCP_LISTEN) | ||
| 215 | kfree_skb(skb); | ||
| 216 | else { | ||
| 217 | llc_save_primitive(skb->sk, skb, ev->prim); | ||
| 218 | 209 | ||
| 219 | /* queue skb to the user. */ | 210 | if (ev->ind_cfm_flag == LLC_IND && skb->sk->sk_state != TCP_LISTEN) { |
| 220 | if (sock_queue_rcv_skb(skb->sk, skb)) | 211 | llc_save_primitive(skb->sk, skb, ev->prim); |
| 221 | kfree_skb(skb); | 212 | |
| 222 | } | 213 | /* queue skb to the user. */ |
| 214 | if (sock_queue_rcv_skb(skb->sk, skb) == 0) | ||
| 215 | return; | ||
| 223 | } | 216 | } |
| 224 | kfree_skb(skb); | 217 | kfree_skb(skb); |
| 225 | } | 218 | } |
| @@ -2633,7 +2633,8 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, · 2632 unmodified lines | |||
| 2633 | 2633 | ||
| 2634 | rcu_read_lock(); | 2634 | rcu_read_lock(); |
| 2635 | ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID); | 2635 | ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID); |
| 2636 | if (WARN_ON_ONCE(ssid == NULL)) | 2636 | if (WARN_ONCE(!ssid || ssid[1] > IEEE80211_MAX_SSID_LEN, |
| 2637 | "invalid SSID element (len=%d)", ssid ? ssid[1] : -1)) | ||
| 2637 | ssid_len = 0; | 2638 | ssid_len = 0; |
| 2638 | else | 2639 | else |
| 2639 | ssid_len = ssid[1]; | 2640 | ssid_len = ssid[1]; |
| @@ -5233,7 +5234,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 2593 unmodified lines | |||
| 5233 | 5234 | ||
| 5234 | rcu_read_lock(); | 5235 | rcu_read_lock(); |
| 5235 | ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); | 5236 | ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); |
| 5236 | if (!ssidie) { | 5237 | if (!ssidie || ssidie[1] > sizeof(assoc_data->ssid)) { |
| 5237 | rcu_read_unlock(); | 5238 | rcu_read_unlock(); |
| 5238 | kfree(assoc_data); | 5239 | kfree(assoc_data); |
| 5239 | return -EINVAL; | 5240 | return -EINVAL; |
| @@ -3467,9 +3467,18 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) · 3466 unmodified lines | |||
| 3467 | case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): | 3467 | case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): |
| 3468 | /* process for all: mesh, mlme, ibss */ | 3468 | /* process for all: mesh, mlme, ibss */ |
| 3469 | break; | 3469 | break; |
| 3470 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): | ||
| 3471 | if (is_multicast_ether_addr(mgmt->da) && | ||
| 3472 | !is_broadcast_ether_addr(mgmt->da)) | ||
| 3473 | return RX_DROP_MONITOR; | ||
| 3474 | |||
| 3475 | /* process only for station/IBSS */ | ||
| 3476 | if (sdata->vif.type != NL80211_IFTYPE_STATION && | ||
| 3477 | sdata->vif.type != NL80211_IFTYPE_ADHOC) | ||
| 3478 | return RX_DROP_MONITOR; | ||
| 3479 | break; | ||
| 3470 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): | 3480 | case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): |
| 3471 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): | 3481 | case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): |
| 3472 | case cpu_to_le16(IEEE80211_STYPE_DEAUTH): | ||
| 3473 | case cpu_to_le16(IEEE80211_STYPE_DISASSOC): | 3482 | case cpu_to_le16(IEEE80211_STYPE_DISASSOC): |
| 3474 | if (is_multicast_ether_addr(mgmt->da) && | 3483 | if (is_multicast_ether_addr(mgmt->da) && |
| 3475 | !is_broadcast_ether_addr(mgmt->da)) | 3484 | !is_broadcast_ether_addr(mgmt->da)) |
| @@ -520,10 +520,33 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local, · 519 unmodified lines | |||
| 520 | return 0; | 520 | return 0; |
| 521 | } | 521 | } |
| 522 | 522 | ||
| 523 | static bool __ieee80211_can_leave_ch(struct ieee80211_sub_if_data *sdata) | ||
| 524 | { | ||
| 525 | struct ieee80211_local *local = sdata->local; | ||
| 526 | struct ieee80211_sub_if_data *sdata_iter; | ||
| 527 | |||
| 528 | if (!ieee80211_is_radar_required(local)) | ||
| 529 | return true; | ||
| 530 | |||
| 531 | if (!regulatory_pre_cac_allowed(local->hw.wiphy)) | ||
| 532 | return false; | ||
| 533 | |||
| 534 | mutex_lock(&local->iflist_mtx); | ||
| 535 | list_for_each_entry(sdata_iter, &local->interfaces, list) { | ||
| 536 | if (sdata_iter->wdev.cac_started) { | ||
| 537 | mutex_unlock(&local->iflist_mtx); | ||
| 538 | return false; | ||
| 539 | } | ||
| 540 | } | ||
| 541 | mutex_unlock(&local->iflist_mtx); | ||
| 542 | |||
| 543 | return true; | ||
| 544 | } | ||
| 545 | |||
| 523 | static bool ieee80211_can_scan(struct ieee80211_local *local, | 546 | static bool ieee80211_can_scan(struct ieee80211_local *local, |
| 524 | struct ieee80211_sub_if_data *sdata) | 547 | struct ieee80211_sub_if_data *sdata) |
| 525 | { | 548 | { |
| 526 | if (ieee80211_is_radar_required(local)) | 549 | if (!__ieee80211_can_leave_ch(sdata)) |
| 527 | return false; | 550 | return false; |
| 528 | 551 | ||
| 529 | if (!list_empty(&local->roc_list)) | 552 | if (!list_empty(&local->roc_list)) |
| @@ -630,7 +653,10 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, · 100 unmodified lines | |||
| 630 | 653 | ||
| 631 | lockdep_assert_held(&local->mtx); | 654 | lockdep_assert_held(&local->mtx); |
| 632 | 655 | ||
| 633 | if (local->scan_req || ieee80211_is_radar_required(local)) | 656 | if (local->scan_req) |
| 657 | return -EBUSY; | ||
| 658 | |||
| 659 | if (!__ieee80211_can_leave_ch(sdata)) | ||
| 634 | return -EBUSY; | 660 | return -EBUSY; |
| 635 | 661 | ||
| 636 | if (!ieee80211_can_scan(local, sdata)) { | 662 | if (!ieee80211_can_scan(local, sdata)) { |
| @@ -1792,8 +1792,8 @@ void __nf_ct_refresh_acct(struct nf_conn *ct, · 1791 unmodified lines | |||
| 1792 | if (nf_ct_is_confirmed(ct)) | 1792 | if (nf_ct_is_confirmed(ct)) |
| 1793 | extra_jiffies += nfct_time_stamp; | 1793 | extra_jiffies += nfct_time_stamp; |
| 1794 | 1794 | ||
| 1795 | if (ct->timeout != extra_jiffies) | 1795 | if (READ_ONCE(ct->timeout) != extra_jiffies) |
| 1796 | ct->timeout = extra_jiffies; | 1796 | WRITE_ONCE(ct->timeout, extra_jiffies); |
| 1797 | acct: | 1797 | acct: |
| 1798 | if (do_acct) | 1798 | if (do_acct) |
| 1799 | nf_ct_acct_update(ct, ctinfo, skb->len); | 1799 | nf_ct_acct_update(ct, ctinfo, skb->len); |
| @@ -165,7 +165,8 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, · 164 unmodified lines | |||
| 165 | { | 165 | { |
| 166 | int err; | 166 | int err; |
| 167 | 167 | ||
| 168 | err = skb_mpls_push(skb, mpls->mpls_lse, mpls->mpls_ethertype); | 168 | err = skb_mpls_push(skb, mpls->mpls_lse, mpls->mpls_ethertype, |
| 169 | skb->mac_len); | ||
| 169 | if (err) | 170 | if (err) |
| 170 | return err; | 171 | return err; |
| 171 | 172 | ||
| @@ -178,7 +179,7 @@ static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key, · 6 unmodified lines | |||
| 178 | { | 179 | { |
| 179 | int err; | 180 | int err; |
| 180 | 181 | ||
| 181 | err = skb_mpls_pop(skb, ethertype); | 182 | err = skb_mpls_pop(skb, ethertype, skb->mac_len); |
| 182 | if (err) | 183 | if (err) |
| 183 | return err; | 184 | return err; |
| 184 | 185 | ||
| @@ -556,6 +556,7 @@ struct rxrpc_call { · 555 unmodified lines | |||
| 556 | struct rxrpc_peer *peer; /* Peer record for remote address */ | 556 | struct rxrpc_peer *peer; /* Peer record for remote address */ |
| 557 | struct rxrpc_sock __rcu *socket; /* socket responsible */ | 557 | struct rxrpc_sock __rcu *socket; /* socket responsible */ |
| 558 | struct rxrpc_net *rxnet; /* Network namespace to which call belongs */ | 558 | struct rxrpc_net *rxnet; /* Network namespace to which call belongs */ |
| 559 | const struct rxrpc_security *security; /* applied security module */ | ||
| 559 | struct mutex user_mutex; /* User access mutex */ | 560 | struct mutex user_mutex; /* User access mutex */ |
| 560 | unsigned long ack_at; /* When deferred ACK needs to happen */ | 561 | unsigned long ack_at; /* When deferred ACK needs to happen */ |
| 561 | unsigned long ack_lost_at; /* When ACK is figured as lost */ | 562 | unsigned long ack_lost_at; /* When ACK is figured as lost */ |
| @@ -84,7 +84,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx, · 83 unmodified lines | |||
| 84 | smp_store_release(&b->conn_backlog_head, | 84 | smp_store_release(&b->conn_backlog_head, |
| 85 | (head + 1) & (size - 1)); | 85 | (head + 1) & (size - 1)); |
| 86 | 86 | ||
| 87 | trace_rxrpc_conn(conn, rxrpc_conn_new_service, | 87 | trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_service, |
| 88 | atomic_read(&conn->usage), here); | 88 | atomic_read(&conn->usage), here); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| @@ -97,7 +97,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx, · 6 unmodified lines | |||
| 97 | call->flags |= (1 << RXRPC_CALL_IS_SERVICE); | 97 | call->flags |= (1 << RXRPC_CALL_IS_SERVICE); |
| 98 | call->state = RXRPC_CALL_SERVER_PREALLOC; | 98 | call->state = RXRPC_CALL_SERVER_PREALLOC; |
| 99 | 99 | ||
| 100 | trace_rxrpc_call(call, rxrpc_call_new_service, | 100 | trace_rxrpc_call(call->debug_id, rxrpc_call_new_service, |
| 101 | atomic_read(&call->usage), | 101 | atomic_read(&call->usage), |
| 102 | here, (const void *)user_call_ID); | 102 | here, (const void *)user_call_ID); |
| 103 | 103 | ||
| @@ -307,6 +307,7 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, · 203 unmodified lines | |||
| 307 | 307 | ||
| 308 | rxrpc_see_call(call); | 308 | rxrpc_see_call(call); |
| 309 | call->conn = conn; | 309 | call->conn = conn; |
| 310 | call->security = conn->security; | ||
| 310 | call->peer = rxrpc_get_peer(conn->params.peer); | 311 | call->peer = rxrpc_get_peer(conn->params.peer); |
| 311 | call->cong_cwnd = call->peer->cong_cwnd; | 312 | call->cong_cwnd = call->peer->cong_cwnd; |
| 312 | return call; | 313 | return call; |
| @@ -240,7 +240,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, · 239 unmodified lines | |||
| 240 | if (p->intr) | 240 | if (p->intr) |
| 241 | __set_bit(RXRPC_CALL_IS_INTR, &call->flags); | 241 | __set_bit(RXRPC_CALL_IS_INTR, &call->flags); |
| 242 | call->tx_total_len = p->tx_total_len; | 242 | call->tx_total_len = p->tx_total_len; |
| 243 | trace_rxrpc_call(call, rxrpc_call_new_client, atomic_read(&call->usage), | 243 | trace_rxrpc_call(call->debug_id, rxrpc_call_new_client, |
| 244 | atomic_read(&call->usage), | ||
| 244 | here, (const void *)p->user_call_ID); | 245 | here, (const void *)p->user_call_ID); |
| 245 | 246 | ||
| 246 | /* We need to protect a partially set up call against the user as we | 247 | /* We need to protect a partially set up call against the user as we |
| @@ -290,8 +291,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, · 43 unmodified lines | |||
| 290 | if (ret < 0) | 291 | if (ret < 0) |
| 291 | goto error; | 292 | goto error; |
| 292 | 293 | ||
| 293 | trace_rxrpc_call(call, rxrpc_call_connected, atomic_read(&call->usage), | 294 | trace_rxrpc_call(call->debug_id, rxrpc_call_connected, |
| 294 | here, NULL); | 295 | atomic_read(&call->usage), here, NULL); |
| 295 | 296 | ||
| 296 | rxrpc_start_call_timer(call); | 297 | rxrpc_start_call_timer(call); |
| 297 | 298 | ||
| @@ -313,8 +314,8 @@ error_dup_user_ID: · 15 unmodified lines | |||
| 313 | error: | 314 | error: |
| 314 | __rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, | 315 | __rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, |
| 315 | RX_CALL_DEAD, ret); | 316 | RX_CALL_DEAD, ret); |
| 316 | trace_rxrpc_call(call, rxrpc_call_error, atomic_read(&call->usage), | 317 | trace_rxrpc_call(call->debug_id, rxrpc_call_error, |
| 317 | here, ERR_PTR(ret)); | 318 | atomic_read(&call->usage), here, ERR_PTR(ret)); |
| 318 | rxrpc_release_call(rx, call); | 319 | rxrpc_release_call(rx, call); |
| 319 | mutex_unlock(&call->user_mutex); | 320 | mutex_unlock(&call->user_mutex); |
| 320 | rxrpc_put_call(call, rxrpc_call_put); | 321 | rxrpc_put_call(call, rxrpc_call_put); |
| @@ -376,7 +377,8 @@ bool rxrpc_queue_call(struct rxrpc_call *call) · 55 unmodified lines | |||
| 376 | if (n == 0) | 377 | if (n == 0) |
| 377 | return false; | 378 | return false; |
| 378 | if (rxrpc_queue_work(&call->processor)) | 379 | if (rxrpc_queue_work(&call->processor)) |
| 379 | trace_rxrpc_call(call, rxrpc_call_queued, n + 1, here, NULL); | 380 | trace_rxrpc_call(call->debug_id, rxrpc_call_queued, n + 1, |
| 381 | here, NULL); | ||
| 380 | else | 382 | else |
| 381 | rxrpc_put_call(call, rxrpc_call_put_noqueue); | 383 | rxrpc_put_call(call, rxrpc_call_put_noqueue); |
| 382 | return true; | 384 | return true; |
| @@ -391,7 +393,8 @@ bool __rxrpc_queue_call(struct rxrpc_call *call) · 8 unmodified lines | |||
| 391 | int n = atomic_read(&call->usage); | 393 | int n = atomic_read(&call->usage); |
| 392 | ASSERTCMP(n, >=, 1); | 394 | ASSERTCMP(n, >=, 1); |
| 393 | if (rxrpc_queue_work(&call->processor)) | 395 | if (rxrpc_queue_work(&call->processor)) |
| 394 | trace_rxrpc_call(call, rxrpc_call_queued_ref, n, here, NULL); | 396 | trace_rxrpc_call(call->debug_id, rxrpc_call_queued_ref, n, |
| 397 | here, NULL); | ||
| 395 | else | 398 | else |
| 396 | rxrpc_put_call(call, rxrpc_call_put_noqueue); | 399 | rxrpc_put_call(call, rxrpc_call_put_noqueue); |
| 397 | return true; | 400 | return true; |
| @@ -406,7 +409,8 @@ void rxrpc_see_call(struct rxrpc_call *call) · 8 unmodified lines | |||
| 406 | if (call) { | 409 | if (call) { |
| 407 | int n = atomic_read(&call->usage); | 410 | int n = atomic_read(&call->usage); |
| 408 | 411 | ||
| 409 | trace_rxrpc_call(call, rxrpc_call_seen, n, here, NULL); | 412 | trace_rxrpc_call(call->debug_id, rxrpc_call_seen, n, |
| 413 | here, NULL); | ||
| 410 | } | 414 | } |
| 411 | } | 415 | } |
| 412 | 416 | ||
| @@ -418,7 +422,7 @@ void rxrpc_get_call(struct rxrpc_call *call, enum rxrpc_call_trace op) · 5 unmodified lines | |||
| 418 | const void *here = __builtin_return_address(0); | 422 | const void *here = __builtin_return_address(0); |
| 419 | int n = atomic_inc_return(&call->usage); | 423 | int n = atomic_inc_return(&call->usage); |
| 420 | 424 | ||
| 421 | trace_rxrpc_call(call, op, n, here, NULL); | 425 | trace_rxrpc_call(call->debug_id, op, n, here, NULL); |
| 422 | } | 426 | } |
| 423 | 427 | ||
| 424 | /* | 428 | /* |
| @@ -445,7 +449,8 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) · 20 unmodified lines | |||
| 445 | 449 | ||
| 446 | _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage)); | 450 | _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage)); |
| 447 | 451 | ||
| 448 | trace_rxrpc_call(call, rxrpc_call_release, atomic_read(&call->usage), | 452 | trace_rxrpc_call(call->debug_id, rxrpc_call_release, |
| 453 | atomic_read(&call->usage), | ||
| 449 | here, (const void *)call->flags); | 454 | here, (const void *)call->flags); |
| 450 | 455 | ||
| 451 | ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE); | 456 | ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE); |
| @@ -488,10 +493,10 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) · 36 unmodified lines | |||
| 488 | 493 | ||
| 489 | _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, conn); | 494 | _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, conn); |
| 490 | 495 | ||
| 491 | if (conn) { | 496 | if (conn) |
| 492 | rxrpc_disconnect_call(call); | 497 | rxrpc_disconnect_call(call); |
| 493 | conn->security->free_call_crypto(call); | 498 | if (call->security) |
| 494 | } | 499 | call->security->free_call_crypto(call); |
| 495 | 500 | ||
| 496 | rxrpc_cleanup_ring(call); | 501 | rxrpc_cleanup_ring(call); |
| 497 | _leave(""); | 502 | _leave(""); |
| @@ -534,12 +539,13 @@ void rxrpc_put_call(struct rxrpc_call *call, enum rxrpc_call_trace op) · 36 unmodified lines | |||
| 534 | { | 539 | { |
| 535 | struct rxrpc_net *rxnet = call->rxnet; | 540 | struct rxrpc_net *rxnet = call->rxnet; |
| 536 | const void *here = __builtin_return_address(0); | 541 | const void *here = __builtin_return_address(0); |
| 542 | unsigned int debug_id = call->debug_id; | ||
| 537 | int n; | 543 | int n; |
| 538 | 544 | ||
| 539 | ASSERT(call != NULL); | 545 | ASSERT(call != NULL); |
| 540 | 546 | ||
| 541 | n = atomic_dec_return(&call->usage); | 547 | n = atomic_dec_return(&call->usage); |
| 542 | trace_rxrpc_call(call, op, n, here, NULL); | 548 | trace_rxrpc_call(debug_id, op, n, here, NULL); |
| 543 | ASSERTCMP(n, >=, 0); | 549 | ASSERTCMP(n, >=, 0); |
| 544 | if (n == 0) { | 550 | if (n == 0) { |
| 545 | _debug("call %d dead", call->debug_id); | 551 | _debug("call %d dead", call->debug_id); |
| @@ -212,7 +212,8 @@ rxrpc_alloc_client_connection(struct rxrpc_conn_parameters *cp, gfp_t gfp) · 211 unmodified lines | |||
| 212 | rxrpc_get_local(conn->params.local); | 212 | rxrpc_get_local(conn->params.local); |
| 213 | key_get(conn->params.key); | 213 | key_get(conn->params.key); |
| 214 | 214 | ||
| 215 | trace_rxrpc_conn(conn, rxrpc_conn_new_client, atomic_read(&conn->usage), | 215 | trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_client, |
| 216 | atomic_read(&conn->usage), | ||
| 216 | __builtin_return_address(0)); | 217 | __builtin_return_address(0)); |
| 217 | trace_rxrpc_client(conn, -1, rxrpc_client_alloc); | 218 | trace_rxrpc_client(conn, -1, rxrpc_client_alloc); |
| 218 | _leave(" = %p", conn); | 219 | _leave(" = %p", conn); |
| @@ -352,6 +353,7 @@ static int rxrpc_get_client_conn(struct rxrpc_sock *rx, · 133 unmodified lines | |||
| 352 | 353 | ||
| 353 | if (cp->exclusive) { | 354 | if (cp->exclusive) { |
| 354 | call->conn = candidate; | 355 | call->conn = candidate; |
| 356 | call->security = candidate->security; | ||
| 355 | call->security_ix = candidate->security_ix; | 357 | call->security_ix = candidate->security_ix; |
| 356 | call->service_id = candidate->service_id; | 358 | call->service_id = candidate->service_id; |
| 357 | _leave(" = 0 [exclusive %d]", candidate->debug_id); | 359 | _leave(" = 0 [exclusive %d]", candidate->debug_id); |
| @@ -403,6 +405,7 @@ static int rxrpc_get_client_conn(struct rxrpc_sock *rx, · 45 unmodified lines | |||
| 403 | candidate_published: | 405 | candidate_published: |
| 404 | set_bit(RXRPC_CONN_IN_CLIENT_CONNS, &candidate->flags); | 406 | set_bit(RXRPC_CONN_IN_CLIENT_CONNS, &candidate->flags); |
| 405 | call->conn = candidate; | 407 | call->conn = candidate; |
| 408 | call->security = candidate->security; | ||
| 406 | call->security_ix = candidate->security_ix; | 409 | call->security_ix = candidate->security_ix; |
| 407 | call->service_id = candidate->service_id; | 410 | call->service_id = candidate->service_id; |
| 408 | spin_unlock(&local->client_conns_lock); | 411 | spin_unlock(&local->client_conns_lock); |
| @@ -425,6 +428,7 @@ found_extant_conn: · 16 unmodified lines | |||
| 425 | 428 | ||
| 426 | spin_lock(&conn->channel_lock); | 429 | spin_lock(&conn->channel_lock); |
| 427 | call->conn = conn; | 430 | call->conn = conn; |
| 431 | call->security = conn->security; | ||
| 428 | call->security_ix = conn->security_ix; | 432 | call->security_ix = conn->security_ix; |
| 429 | call->service_id = conn->service_id; | 433 | call->service_id = conn->service_id; |
| 430 | list_add_tail(&call->chan_wait_link, &conn->waiting_calls); | 434 | list_add_tail(&call->chan_wait_link, &conn->waiting_calls); |
| @@ -985,11 +989,12 @@ rxrpc_put_one_client_conn(struct rxrpc_connection *conn) · 554 unmodified lines | |||
| 985 | void rxrpc_put_client_conn(struct rxrpc_connection *conn) | 989 | void rxrpc_put_client_conn(struct rxrpc_connection *conn) |
| 986 | { | 990 | { |
| 987 | const void *here = __builtin_return_address(0); | 991 | const void *here = __builtin_return_address(0); |
| 992 | unsigned int debug_id = conn->debug_id; | ||
| 988 | int n; | 993 | int n; |
| 989 | 994 | ||
| 990 | do { | 995 | do { |
| 991 | n = atomic_dec_return(&conn->usage); | 996 | n = atomic_dec_return(&conn->usage); |
| 992 | trace_rxrpc_conn(conn, rxrpc_conn_put_client, n, here); | 997 | trace_rxrpc_conn(debug_id, rxrpc_conn_put_client, n, here); |
| 993 | if (n > 0) | 998 | if (n > 0) |
| 994 | return; | 999 | return; |
| 995 | ASSERTCMP(n, >=, 0); | 1000 | ASSERTCMP(n, >=, 0); |
| @@ -269,7 +269,7 @@ bool rxrpc_queue_conn(struct rxrpc_connection *conn) · 268 unmodified lines | |||
| 269 | if (n == 0) | 269 | if (n == 0) |
| 270 | return false; | 270 | return false; |
| 271 | if (rxrpc_queue_work(&conn->processor)) | 271 | if (rxrpc_queue_work(&conn->processor)) |
| 272 | trace_rxrpc_conn(conn, rxrpc_conn_queued, n + 1, here); | 272 | trace_rxrpc_conn(conn->debug_id, rxrpc_conn_queued, n + 1, here); |
| 273 | else | 273 | else |
| 274 | rxrpc_put_connection(conn); | 274 | rxrpc_put_connection(conn); |
| 275 | return true; | 275 | return true; |
| @@ -284,7 +284,7 @@ void rxrpc_see_connection(struct rxrpc_connection *conn) · 8 unmodified lines | |||
| 284 | if (conn) { | 284 | if (conn) { |
| 285 | int n = atomic_read(&conn->usage); | 285 | int n = atomic_read(&conn->usage); |
| 286 | 286 | ||
| 287 | trace_rxrpc_conn(conn, rxrpc_conn_seen, n, here); | 287 | trace_rxrpc_conn(conn->debug_id, rxrpc_conn_seen, n, here); |
| 288 | } | 288 | } |
| 289 | } | 289 | } |
| 290 | 290 | ||
| @@ -296,7 +296,7 @@ void rxrpc_get_connection(struct rxrpc_connection *conn) · 5 unmodified lines | |||
| 296 | const void *here = __builtin_return_address(0); | 296 | const void *here = __builtin_return_address(0); |
| 297 | int n = atomic_inc_return(&conn->usage); | 297 | int n = atomic_inc_return(&conn->usage); |
| 298 | 298 | ||
| 299 | trace_rxrpc_conn(conn, rxrpc_conn_got, n, here); | 299 | trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, n, here); |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | /* | 302 | /* |
| @@ -310,7 +310,7 @@ rxrpc_get_connection_maybe(struct rxrpc_connection *conn) · 7 unmodified lines | |||
| 310 | if (conn) { | 310 | if (conn) { |
| 311 | int n = atomic_fetch_add_unless(&conn->usage, 1, 0); | 311 | int n = atomic_fetch_add_unless(&conn->usage, 1, 0); |
| 312 | if (n > 0) | 312 | if (n > 0) |
| 313 | trace_rxrpc_conn(conn, rxrpc_conn_got, n + 1, here); | 313 | trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, n + 1, here); |
| 314 | else | 314 | else |
| 315 | conn = NULL; | 315 | conn = NULL; |
| 316 | } | 316 | } |
| @@ -333,10 +333,11 @@ static void rxrpc_set_service_reap_timer(struct rxrpc_net *rxnet, · 16 unmodified lines | |||
| 333 | void rxrpc_put_service_conn(struct rxrpc_connection *conn) | 333 | void rxrpc_put_service_conn(struct rxrpc_connection *conn) |
| 334 | { | 334 | { |
| 335 | const void *here = __builtin_return_address(0); | 335 | const void *here = __builtin_return_address(0); |
| 336 | unsigned int debug_id = conn->debug_id; | ||
| 336 | int n; | 337 | int n; |
| 337 | 338 | ||
| 338 | n = atomic_dec_return(&conn->usage); | 339 | n = atomic_dec_return(&conn->usage); |
| 339 | trace_rxrpc_conn(conn, rxrpc_conn_put_service, n, here); | 340 | trace_rxrpc_conn(debug_id, rxrpc_conn_put_service, n, here); |
| 340 | ASSERTCMP(n, >=, 0); | 341 | ASSERTCMP(n, >=, 0); |
| 341 | if (n == 1) | 342 | if (n == 1) |
| 342 | rxrpc_set_service_reap_timer(conn->params.local->rxnet, | 343 | rxrpc_set_service_reap_timer(conn->params.local->rxnet, |
| @@ -420,7 +421,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work) · 77 unmodified lines | |||
| 420 | */ | 421 | */ |
| 421 | if (atomic_cmpxchg(&conn->usage, 1, 0) != 1) | 422 | if (atomic_cmpxchg(&conn->usage, 1, 0) != 1) |
| 422 | continue; | 423 | continue; |
| 423 | trace_rxrpc_conn(conn, rxrpc_conn_reap_service, 0, NULL); | 424 | trace_rxrpc_conn(conn->debug_id, rxrpc_conn_reap_service, 0, NULL); |
| 424 | 425 | ||
| 425 | if (rxrpc_conn_is_client(conn)) | 426 | if (rxrpc_conn_is_client(conn)) |
| 426 | BUG(); | 427 | BUG(); |
| @@ -134,7 +134,7 @@ struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *rxn · 133 unmodified lines | |||
| 134 | list_add_tail(&conn->proc_link, &rxnet->conn_proc_list); | 134 | list_add_tail(&conn->proc_link, &rxnet->conn_proc_list); |
| 135 | write_unlock(&rxnet->conn_lock); | 135 | write_unlock(&rxnet->conn_lock); |
| 136 | 136 | ||
| 137 | trace_rxrpc_conn(conn, rxrpc_conn_new_service, | 137 | trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_service, |
| 138 | atomic_read(&conn->usage), | 138 | atomic_read(&conn->usage), |
| 139 | __builtin_return_address(0)); | 139 | __builtin_return_address(0)); |
| 140 | } | 140 | } |
| @@ -147,10 +147,16 @@ void rxrpc_error_report(struct sock *sk) · 146 unmodified lines | |||
| 147 | { | 147 | { |
| 148 | struct sock_exterr_skb *serr; | 148 | struct sock_exterr_skb *serr; |
| 149 | struct sockaddr_rxrpc srx; | 149 | struct sockaddr_rxrpc srx; |
| 150 | struct rxrpc_local *local = sk->sk_user_data; | 150 | struct rxrpc_local *local; |
| 151 | struct rxrpc_peer *peer; | 151 | struct rxrpc_peer *peer; |
| 152 | struct sk_buff *skb; | 152 | struct sk_buff *skb; |
| 153 | 153 | ||
| 154 | rcu_read_lock(); | ||
| 155 | local = rcu_dereference_sk_user_data(sk); | ||
| 156 | if (unlikely(!local)) { | ||
| 157 | rcu_read_unlock(); | ||
| 158 | return; | ||
| 159 | } | ||
| 154 | _enter("%p{%d}", sk, local->debug_id); | 160 | _enter("%p{%d}", sk, local->debug_id); |
| 155 | 161 | ||
| 156 | /* Clear the outstanding error value on the socket so that it doesn't | 162 | /* Clear the outstanding error value on the socket so that it doesn't |
| @@ -160,6 +166,7 @@ void rxrpc_error_report(struct sock *sk) · 3 unmodified lines | |||
| 160 | 166 | ||
| 161 | skb = sock_dequeue_err_skb(sk); | 167 | skb = sock_dequeue_err_skb(sk); |
| 162 | if (!skb) { | 168 | if (!skb) { |
| 169 | rcu_read_unlock(); | ||
| 163 | _leave("UDP socket errqueue empty"); | 170 | _leave("UDP socket errqueue empty"); |
| 164 | return; | 171 | return; |
| 165 | } | 172 | } |
| @@ -167,11 +174,11 @@ void rxrpc_error_report(struct sock *sk) · 1 unmodified line | |||
| 167 | serr = SKB_EXT_ERR(skb); | 174 | serr = SKB_EXT_ERR(skb); |
| 168 | if (!skb->len && serr->ee.ee_origin == SO_EE_ORIGIN_TIMESTAMPING) { | 175 | if (!skb->len && serr->ee.ee_origin == SO_EE_ORIGIN_TIMESTAMPING) { |
| 169 | _leave("UDP empty message"); | 176 | _leave("UDP empty message"); |
| 177 | rcu_read_unlock(); | ||
| 170 | rxrpc_free_skb(skb, rxrpc_skb_freed); | 178 | rxrpc_free_skb(skb, rxrpc_skb_freed); |
| 171 | return; | 179 | return; |
| 172 | } | 180 | } |
| 173 | 181 | ||
| 174 | rcu_read_lock(); | ||
| 175 | peer = rxrpc_lookup_peer_icmp_rcu(local, skb, &srx); | 182 | peer = rxrpc_lookup_peer_icmp_rcu(local, skb, &srx); |
| 176 | if (peer && !rxrpc_get_peer_maybe(peer)) | 183 | if (peer && !rxrpc_get_peer_maybe(peer)) |
| 177 | peer = NULL; | 184 | peer = NULL; |
| @@ -216,7 +216,7 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp) · 215 unmodified lines | |||
| 216 | peer = kzalloc(sizeof(struct rxrpc_peer), gfp); | 216 | peer = kzalloc(sizeof(struct rxrpc_peer), gfp); |
| 217 | if (peer) { | 217 | if (peer) { |
| 218 | atomic_set(&peer->usage, 1); | 218 | atomic_set(&peer->usage, 1); |
| 219 | peer->local = local; | 219 | peer->local = rxrpc_get_local(local); |
| 220 | INIT_HLIST_HEAD(&peer->error_targets); | 220 | INIT_HLIST_HEAD(&peer->error_targets); |
| 221 | peer->service_conns = RB_ROOT; | 221 | peer->service_conns = RB_ROOT; |
| 222 | seqlock_init(&peer->service_conn_lock); | 222 | seqlock_init(&peer->service_conn_lock); |
| @@ -307,7 +307,6 @@ void rxrpc_new_incoming_peer(struct rxrpc_sock *rx, struct rxrpc_local *local, · 84 unmodified lines | |||
| 307 | unsigned long hash_key; | 307 | unsigned long hash_key; |
| 308 | 308 | ||
| 309 | hash_key = rxrpc_peer_hash_key(local, &peer->srx); | 309 | hash_key = rxrpc_peer_hash_key(local, &peer->srx); |
| 310 | peer->local = local; | ||
| 311 | rxrpc_init_peer(rx, peer, hash_key); | 310 | rxrpc_init_peer(rx, peer, hash_key); |
| 312 | 311 | ||
| 313 | spin_lock(&rxnet->peer_hash_lock); | 312 | spin_lock(&rxnet->peer_hash_lock); |
| @@ -382,7 +381,7 @@ struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *peer) · 68 unmodified lines | |||
| 382 | int n; | 381 | int n; |
| 383 | 382 | ||
| 384 | n = atomic_inc_return(&peer->usage); | 383 | n = atomic_inc_return(&peer->usage); |
| 385 | trace_rxrpc_peer(peer, rxrpc_peer_got, n, here); | 384 | trace_rxrpc_peer(peer->debug_id, rxrpc_peer_got, n, here); |
| 386 | return peer; | 385 | return peer; |
| 387 | } | 386 | } |
| 388 | 387 | ||
| @@ -396,7 +395,7 @@ struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *peer) · 7 unmodified lines | |||
| 396 | if (peer) { | 395 | if (peer) { |
| 397 | int n = atomic_fetch_add_unless(&peer->usage, 1, 0); | 396 | int n = atomic_fetch_add_unless(&peer->usage, 1, 0); |
| 398 | if (n > 0) | 397 | if (n > 0) |
| 399 | trace_rxrpc_peer(peer, rxrpc_peer_got, n + 1, here); | 398 | trace_rxrpc_peer(peer->debug_id, rxrpc_peer_got, n + 1, here); |
| 400 | else | 399 | else |
| 401 | peer = NULL; | 400 | peer = NULL; |
| 402 | } | 401 | } |
| @@ -417,6 +416,7 @@ static void __rxrpc_put_peer(struct rxrpc_peer *peer) · 14 unmodified lines | |||
| 417 | list_del_init(&peer->keepalive_link); | 416 | list_del_init(&peer->keepalive_link); |
| 418 | spin_unlock_bh(&rxnet->peer_hash_lock); | 417 | spin_unlock_bh(&rxnet->peer_hash_lock); |
| 419 | 418 | ||
| 419 | rxrpc_put_local(peer->local); | ||
| 420 | kfree_rcu(peer, rcu); | 420 | kfree_rcu(peer, rcu); |
| 421 | } | 421 | } |
| 422 | 422 | ||
| @@ -426,11 +426,13 @@ static void __rxrpc_put_peer(struct rxrpc_peer *peer) · 3 unmodified lines | |||
| 426 | void rxrpc_put_peer(struct rxrpc_peer *peer) | 426 | void rxrpc_put_peer(struct rxrpc_peer *peer) |
| 427 | { | 427 | { |
| 428 | const void *here = __builtin_return_address(0); | 428 | const void *here = __builtin_return_address(0); |
| 429 | unsigned int debug_id; | ||
| 429 | int n; | 430 | int n; |
| 430 | 431 | ||
| 431 | if (peer) { | 432 | if (peer) { |
| 433 | debug_id = peer->debug_id; | ||
| 432 | n = atomic_dec_return(&peer->usage); | 434 | n = atomic_dec_return(&peer->usage); |
| 433 | trace_rxrpc_peer(peer, rxrpc_peer_put, n, here); | 435 | trace_rxrpc_peer(debug_id, rxrpc_peer_put, n, here); |
| 434 | if (n == 0) | 436 | if (n == 0) |
| 435 | __rxrpc_put_peer(peer); | 437 | __rxrpc_put_peer(peer); |
| 436 | } | 438 | } |
| @@ -443,13 +445,15 @@ void rxrpc_put_peer(struct rxrpc_peer *peer) · 6 unmodified lines | |||
| 443 | void rxrpc_put_peer_locked(struct rxrpc_peer *peer) | 445 | void rxrpc_put_peer_locked(struct rxrpc_peer *peer) |
| 444 | { | 446 | { |
| 445 | const void *here = __builtin_return_address(0); | 447 | const void *here = __builtin_return_address(0); |
| 448 | unsigned int debug_id = peer->debug_id; | ||
| 446 | int n; | 449 | int n; |
| 447 | 450 | ||
| 448 | n = atomic_dec_return(&peer->usage); | 451 | n = atomic_dec_return(&peer->usage); |
| 449 | trace_rxrpc_peer(peer, rxrpc_peer_put, n, here); | 452 | trace_rxrpc_peer(debug_id, rxrpc_peer_put, n, here); |
| 450 | if (n == 0) { | 453 | if (n == 0) { |
| 451 | hash_del_rcu(&peer->hash_link); | 454 | hash_del_rcu(&peer->hash_link); |
| 452 | list_del_init(&peer->keepalive_link); | 455 | list_del_init(&peer->keepalive_link); |
| 456 | rxrpc_put_local(peer->local); | ||
| 453 | kfree_rcu(peer, rcu); | 457 | kfree_rcu(peer, rcu); |
| 454 | } | 458 | } |
| 455 | } | 459 | } |
| @@ -251,8 +251,8 @@ static int rxrpc_verify_packet(struct rxrpc_call *call, struct sk_buff *skb, · 250 unmodified lines | |||
| 251 | seq += subpacket; | 251 | seq += subpacket; |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | return call->conn->security->verify_packet(call, skb, offset, len, | 254 | return call->security->verify_packet(call, skb, offset, len, |
| 255 | seq, cksum); | 255 | seq, cksum); |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | /* | 258 | /* |
| @@ -291,7 +291,7 @@ static int rxrpc_locate_data(struct rxrpc_call *call, struct sk_buff *skb, · 32 unmodified lines | |||
| 291 | 291 | ||
| 292 | *_offset = offset; | 292 | *_offset = offset; |
| 293 | *_len = len; | 293 | *_len = len; |
| 294 | call->conn->security->locate_data(call, skb, _offset, _len); | 294 | call->security->locate_data(call, skb, _offset, _len); |
| 295 | return 0; | 295 | return 0; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| @@ -419,7 +419,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, · 418 unmodified lines | |||
| 419 | call->tx_winsize) | 419 | call->tx_winsize) |
| 420 | sp->hdr.flags |= RXRPC_MORE_PACKETS; | 420 | sp->hdr.flags |= RXRPC_MORE_PACKETS; |
| 421 | 421 | ||
| 422 | ret = conn->security->secure_packet( | 422 | ret = call->security->secure_packet( |
| 423 | call, skb, skb->mark, skb->head); | 423 | call, skb, skb->mark, skb->head); |
| 424 | if (ret < 0) | 424 | if (ret < 0) |
| 425 | goto out; | 425 | goto out; |
| @@ -661,6 +661,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len) · 235 unmodified lines | |||
| 661 | case RXRPC_CALL_SERVER_PREALLOC: | 661 | case RXRPC_CALL_SERVER_PREALLOC: |
| 662 | case RXRPC_CALL_SERVER_SECURING: | 662 | case RXRPC_CALL_SERVER_SECURING: |
| 663 | case RXRPC_CALL_SERVER_ACCEPTING: | 663 | case RXRPC_CALL_SERVER_ACCEPTING: |
| 664 | rxrpc_put_call(call, rxrpc_call_put); | ||
| 664 | ret = -EBUSY; | 665 | ret = -EBUSY; |
| 665 | goto error_release_sock; | 666 | goto error_release_sock; |
| 666 | default: | 667 | default: |
| @@ -832,8 +832,7 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb) · 831 unmodified lines | |||
| 832 | } | 832 | } |
| 833 | 833 | ||
| 834 | static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = { | 834 | static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = { |
| 835 | [TCA_ACT_KIND] = { .type = NLA_NUL_STRING, | 835 | [TCA_ACT_KIND] = { .type = NLA_STRING }, |
| 836 | .len = IFNAMSIZ - 1 }, | ||
| 837 | [TCA_ACT_INDEX] = { .type = NLA_U32 }, | 836 | [TCA_ACT_INDEX] = { .type = NLA_U32 }, |
| 838 | [TCA_ACT_COOKIE] = { .type = NLA_BINARY, | 837 | [TCA_ACT_COOKIE] = { .type = NLA_BINARY, |
| 839 | .len = TC_COOKIE_MAX_SIZE }, | 838 | .len = TC_COOKIE_MAX_SIZE }, |
| @@ -865,8 +864,10 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, · 25 unmodified lines | |||
| 865 | NL_SET_ERR_MSG(extack, "TC action kind must be specified"); | 864 | NL_SET_ERR_MSG(extack, "TC action kind must be specified"); |
| 866 | goto err_out; | 865 | goto err_out; |
| 867 | } | 866 | } |
| 868 | nla_strlcpy(act_name, kind, IFNAMSIZ); | 867 | if (nla_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ) { |
| 869 | 868 | NL_SET_ERR_MSG(extack, "TC action name too long"); | |
| 869 | goto err_out; | ||
| 870 | } | ||
| 870 | if (tb[TCA_ACT_COOKIE]) { | 871 | if (tb[TCA_ACT_COOKIE]) { |
| 871 | cookie = nla_memdup_cookie(tb); | 872 | cookie = nla_memdup_cookie(tb); |
| 872 | if (!cookie) { | 873 | if (!cookie) { |
| @@ -1352,11 +1353,16 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, · 479 unmodified lines | |||
| 1352 | struct netlink_ext_ack *extack) | 1353 | struct netlink_ext_ack *extack) |
| 1353 | { | 1354 | { |
| 1354 | size_t attr_size = 0; | 1355 | size_t attr_size = 0; |
| 1355 | int ret = 0; | 1356 | int loop, ret; |
| 1356 | struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; | 1357 | struct tc_action *actions[TCA_ACT_MAX_PRIO] = {}; |
| 1357 | 1358 | ||
| 1358 | ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, actions, | 1359 | for (loop = 0; loop < 10; loop++) { |
| 1359 | &attr_size, true, extack); | 1360 | ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, |
| 1361 | actions, &attr_size, true, extack); | ||
| 1362 | if (ret != -EAGAIN) | ||
| 1363 | break; | ||
| 1364 | } | ||
| 1365 | |||
| 1360 | if (ret < 0) | 1366 | if (ret < 0) |
| 1361 | return ret; | 1367 | return ret; |
| 1362 | ret = tcf_add_notify(net, n, actions, portid, attr_size, extack); | 1368 | ret = tcf_add_notify(net, n, actions, portid, attr_size, extack); |
| @@ -1406,11 +1412,8 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, · 43 unmodified lines | |||
| 1406 | */ | 1412 | */ |
| 1407 | if (n->nlmsg_flags & NLM_F_REPLACE) | 1413 | if (n->nlmsg_flags & NLM_F_REPLACE) |
| 1408 | ovr = 1; | 1414 | ovr = 1; |
| 1409 | replay: | ||
| 1410 | ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr, | 1415 | ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr, |
| 1411 | extack); | 1416 | extack); |
| 1412 | if (ret == -EAGAIN) | ||
| 1413 | goto replay; | ||
| 1414 | break; | 1417 | break; |
| 1415 | case RTM_DELACTION: | 1418 | case RTM_DELACTION: |
| 1416 | ret = tca_action_gd(net, tca[TCA_ACT_TAB], n, | 1419 | ret = tca_action_gd(net, tca[TCA_ACT_TAB], n, |
| @@ -484,7 +484,11 @@ static int __init mirred_init_module(void) · 483 unmodified lines | |||
| 484 | return err; | 484 | return err; |
| 485 | 485 | ||
| 486 | pr_info("Mirror/redirect action on\n"); | 486 | pr_info("Mirror/redirect action on\n"); |
| 487 | return tcf_register_action(&act_mirred_ops, &mirred_net_ops); | 487 | err = tcf_register_action(&act_mirred_ops, &mirred_net_ops); |
| 488 | if (err) | ||
| 489 | unregister_netdevice_notifier(&mirred_device_notifier); | ||
| 490 | |||
| 491 | return err; | ||
| 488 | } | 492 | } |
| 489 | 493 | ||
| 490 | static void __exit mirred_cleanup_module(void) | 494 | static void __exit mirred_cleanup_module(void) |
| @@ -55,7 +55,7 @@ static int tcf_mpls_act(struct sk_buff *skb, const struct tc_action *a, · 54 unmodified lines | |||
| 55 | struct tcf_mpls *m = to_mpls(a); | 55 | struct tcf_mpls *m = to_mpls(a); |
| 56 | struct tcf_mpls_params *p; | 56 | struct tcf_mpls_params *p; |
| 57 | __be32 new_lse; | 57 | __be32 new_lse; |
| 58 | int ret; | 58 | int ret, mac_len; |
| 59 | 59 | ||
| 60 | tcf_lastuse_update(&m->tcf_tm); | 60 | tcf_lastuse_update(&m->tcf_tm); |
| 61 | bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb); | 61 | bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb); |
| @@ -63,8 +63,12 @@ static int tcf_mpls_act(struct sk_buff *skb, const struct tc_action *a, · 1 unmodified line | |||
| 63 | /* Ensure 'data' points at mac_header prior calling mpls manipulating | 63 | /* Ensure 'data' points at mac_header prior calling mpls manipulating |
| 64 | * functions. | 64 | * functions. |
| 65 | */ | 65 | */ |
| 66 | if (skb_at_tc_ingress(skb)) | 66 | if (skb_at_tc_ingress(skb)) { |
| 67 | skb_push_rcsum(skb, skb->mac_len); | 67 | skb_push_rcsum(skb, skb->mac_len); |
| 68 | mac_len = skb->mac_len; | ||
| 69 | } else { | ||
| 70 | mac_len = skb_network_header(skb) - skb_mac_header(skb); | ||
| 71 | } | ||
| 68 | 72 | ||
| 69 | ret = READ_ONCE(m->tcf_action); | 73 | ret = READ_ONCE(m->tcf_action); |
| 70 | 74 | ||
| @@ -72,12 +76,12 @@ static int tcf_mpls_act(struct sk_buff *skb, const struct tc_action *a, · 1 unmodified line | |||
| 72 | 76 | ||
| 73 | switch (p->tcfm_action) { | 77 | switch (p->tcfm_action) { |
| 74 | case TCA_MPLS_ACT_POP: | 78 | case TCA_MPLS_ACT_POP: |
| 75 | if (skb_mpls_pop(skb, p->tcfm_proto)) | 79 | if (skb_mpls_pop(skb, p->tcfm_proto, mac_len)) |
| 76 | goto drop; | 80 | goto drop; |
| 77 | break; | 81 | break; |
| 78 | case TCA_MPLS_ACT_PUSH: | 82 | case TCA_MPLS_ACT_PUSH: |
| 79 | new_lse = tcf_mpls_get_lse(NULL, p, !eth_p_mpls(skb->protocol)); | 83 | new_lse = tcf_mpls_get_lse(NULL, p, !eth_p_mpls(skb->protocol)); |
| 80 | if (skb_mpls_push(skb, new_lse, p->tcfm_proto)) | 84 | if (skb_mpls_push(skb, new_lse, p->tcfm_proto, mac_len)) |
| 81 | goto drop; | 85 | goto drop; |
| 82 | break; | 86 | break; |
| 83 | case TCA_MPLS_ACT_MODIFY: | 87 | case TCA_MPLS_ACT_MODIFY: |
| @@ -162,11 +162,22 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp) · 161 unmodified lines | |||
| 162 | return TC_H_MAJ(first); | 162 | return TC_H_MAJ(first); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | static bool tcf_proto_check_kind(struct nlattr *kind, char *name) | ||
| 166 | { | ||
| 167 | if (kind) | ||
| 168 | return nla_strlcpy(name, kind, IFNAMSIZ) >= IFNAMSIZ; | ||
| 169 | memset(name, 0, IFNAMSIZ); | ||
| 170 | return false; | ||
| 171 | } | ||
| 172 | |||
| 165 | static bool tcf_proto_is_unlocked(const char *kind) | 173 | static bool tcf_proto_is_unlocked(const char *kind) |
| 166 | { | 174 | { |
| 167 | const struct tcf_proto_ops *ops; | 175 | const struct tcf_proto_ops *ops; |
| 168 | bool ret; | 176 | bool ret; |
| 169 | 177 | ||
| 178 | if (strlen(kind) == 0) | ||
| 179 | return false; | ||
| 180 | |||
| 170 | ops = tcf_proto_lookup_ops(kind, false, NULL); | 181 | ops = tcf_proto_lookup_ops(kind, false, NULL); |
| 171 | /* On error return false to take rtnl lock. Proto lookup/create | 182 | /* On error return false to take rtnl lock. Proto lookup/create |
| 172 | * functions will perform lookup again and properly handle errors. | 183 | * functions will perform lookup again and properly handle errors. |
| @@ -1843,6 +1854,7 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 1670 unmodified lines | |||
| 1843 | { | 1854 | { |
| 1844 | struct net *net = sock_net(skb->sk); | 1855 | struct net *net = sock_net(skb->sk); |
| 1845 | struct nlattr *tca[TCA_MAX + 1]; | 1856 | struct nlattr *tca[TCA_MAX + 1]; |
| 1857 | char name[IFNAMSIZ]; | ||
| 1846 | struct tcmsg *t; | 1858 | struct tcmsg *t; |
| 1847 | u32 protocol; | 1859 | u32 protocol; |
| 1848 | u32 prio; | 1860 | u32 prio; |
| @@ -1899,13 +1911,19 @@ replay: · 50 unmodified lines | |||
| 1899 | if (err) | 1911 | if (err) |
| 1900 | return err; | 1912 | return err; |
| 1901 | 1913 | ||
| 1914 | if (tcf_proto_check_kind(tca[TCA_KIND], name)) { | ||
| 1915 | NL_SET_ERR_MSG(extack, "Specified TC filter name too long"); | ||
| 1916 | err = -EINVAL; | ||
| 1917 | goto errout; | ||
| 1918 | } | ||
| 1919 | |||
| 1902 | /* Take rtnl mutex if rtnl_held was set to true on previous iteration, | 1920 | /* Take rtnl mutex if rtnl_held was set to true on previous iteration, |
| 1903 | * block is shared (no qdisc found), qdisc is not unlocked, classifier | 1921 | * block is shared (no qdisc found), qdisc is not unlocked, classifier |
| 1904 | * type is not specified, classifier is not unlocked. | 1922 | * type is not specified, classifier is not unlocked. |
| 1905 | */ | 1923 | */ |
| 1906 | if (rtnl_held || | 1924 | if (rtnl_held || |
| 1907 | (q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || | 1925 | (q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || |
| 1908 | !tca[TCA_KIND] || !tcf_proto_is_unlocked(nla_data(tca[TCA_KIND]))) { | 1926 | !tcf_proto_is_unlocked(name)) { |
| 1909 | rtnl_held = true; | 1927 | rtnl_held = true; |
| 1910 | rtnl_lock(); | 1928 | rtnl_lock(); |
| 1911 | } | 1929 | } |
| @@ -2063,6 +2081,7 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 151 unmodified lines | |||
| 2063 | { | 2081 | { |
| 2064 | struct net *net = sock_net(skb->sk); | 2082 | struct net *net = sock_net(skb->sk); |
| 2065 | struct nlattr *tca[TCA_MAX + 1]; | 2083 | struct nlattr *tca[TCA_MAX + 1]; |
| 2084 | char name[IFNAMSIZ]; | ||
| 2066 | struct tcmsg *t; | 2085 | struct tcmsg *t; |
| 2067 | u32 protocol; | 2086 | u32 protocol; |
| 2068 | u32 prio; | 2087 | u32 prio; |
| @@ -2102,13 +2121,18 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 33 unmodified lines | |||
| 2102 | if (err) | 2121 | if (err) |
| 2103 | return err; | 2122 | return err; |
| 2104 | 2123 | ||
| 2124 | if (tcf_proto_check_kind(tca[TCA_KIND], name)) { | ||
| 2125 | NL_SET_ERR_MSG(extack, "Specified TC filter name too long"); | ||
| 2126 | err = -EINVAL; | ||
| 2127 | goto errout; | ||
| 2128 | } | ||
| 2105 | /* Take rtnl mutex if flushing whole chain, block is shared (no qdisc | 2129 | /* Take rtnl mutex if flushing whole chain, block is shared (no qdisc |
| 2106 | * found), qdisc is not unlocked, classifier type is not specified, | 2130 | * found), qdisc is not unlocked, classifier type is not specified, |
| 2107 | * classifier is not unlocked. | 2131 | * classifier is not unlocked. |
| 2108 | */ | 2132 | */ |
| 2109 | if (!prio || | 2133 | if (!prio || |
| 2110 | (q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || | 2134 | (q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || |
| 2111 | !tca[TCA_KIND] || !tcf_proto_is_unlocked(nla_data(tca[TCA_KIND]))) { | 2135 | !tcf_proto_is_unlocked(name)) { |
| 2112 | rtnl_held = true; | 2136 | rtnl_held = true; |
| 2113 | rtnl_lock(); | 2137 | rtnl_lock(); |
| 2114 | } | 2138 | } |
| @@ -2216,6 +2240,7 @@ static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 101 unmodified lines | |||
| 2216 | { | 2240 | { |
| 2217 | struct net *net = sock_net(skb->sk); | 2241 | struct net *net = sock_net(skb->sk); |
| 2218 | struct nlattr *tca[TCA_MAX + 1]; | 2242 | struct nlattr *tca[TCA_MAX + 1]; |
| 2243 | char name[IFNAMSIZ]; | ||
| 2219 | struct tcmsg *t; | 2244 | struct tcmsg *t; |
| 2220 | u32 protocol; | 2245 | u32 protocol; |
| 2221 | u32 prio; | 2246 | u32 prio; |
| @@ -2252,12 +2277,17 @@ static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 30 unmodified lines | |||
| 2252 | if (err) | 2277 | if (err) |
| 2253 | return err; | 2278 | return err; |
| 2254 | 2279 | ||
| 2280 | if (tcf_proto_check_kind(tca[TCA_KIND], name)) { | ||
| 2281 | NL_SET_ERR_MSG(extack, "Specified TC filter name too long"); | ||
| 2282 | err = -EINVAL; | ||
| 2283 | goto errout; | ||
| 2284 | } | ||
| 2255 | /* Take rtnl mutex if block is shared (no qdisc found), qdisc is not | 2285 | /* Take rtnl mutex if block is shared (no qdisc found), qdisc is not |
| 2256 | * unlocked, classifier type is not specified, classifier is not | 2286 | * unlocked, classifier type is not specified, classifier is not |
| 2257 | * unlocked. | 2287 | * unlocked. |
| 2258 | */ | 2288 | */ |
| 2259 | if ((q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || | 2289 | if ((q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) || |
| 2260 | !tca[TCA_KIND] || !tcf_proto_is_unlocked(nla_data(tca[TCA_KIND]))) { | 2290 | !tcf_proto_is_unlocked(name)) { |
| 2261 | rtnl_held = true; | 2291 | rtnl_held = true; |
| 2262 | rtnl_lock(); | 2292 | rtnl_lock(); |
| 2263 | } | 2293 | } |
| @@ -446,7 +446,7 @@ META_COLLECTOR(int_sk_wmem_queued) · 445 unmodified lines | |||
| 446 | *err = -1; | 446 | *err = -1; |
| 447 | return; | 447 | return; |
| 448 | } | 448 | } |
| 449 | dst->value = sk->sk_wmem_queued; | 449 | dst->value = READ_ONCE(sk->sk_wmem_queued); |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | META_COLLECTOR(int_sk_fwd_alloc) | 452 | META_COLLECTOR(int_sk_fwd_alloc) |
| @@ -554,7 +554,7 @@ META_COLLECTOR(int_sk_rcvlowat) · 101 unmodified lines | |||
| 554 | *err = -1; | 554 | *err = -1; |
| 555 | return; | 555 | return; |
| 556 | } | 556 | } |
| 557 | dst->value = sk->sk_rcvlowat; | 557 | dst->value = READ_ONCE(sk->sk_rcvlowat); |
| 558 | } | 558 | } |
| 559 | 559 | ||
| 560 | META_COLLECTOR(int_sk_rcvtimeo) | 560 | META_COLLECTOR(int_sk_rcvtimeo) |
| @@ -1390,8 +1390,7 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w) · 1389 unmodified lines | |||
| 1390 | } | 1390 | } |
| 1391 | 1391 | ||
| 1392 | const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = { | 1392 | const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = { |
| 1393 | [TCA_KIND] = { .type = NLA_NUL_STRING, | 1393 | [TCA_KIND] = { .type = NLA_STRING }, |
| 1394 | .len = IFNAMSIZ - 1 }, | ||
| 1395 | [TCA_RATE] = { .type = NLA_BINARY, | 1394 | [TCA_RATE] = { .type = NLA_BINARY, |
| 1396 | .len = sizeof(struct tc_estimator) }, | 1395 | .len = sizeof(struct tc_estimator) }, |
| 1397 | [TCA_STAB] = { .type = NLA_NESTED }, | 1396 | [TCA_STAB] = { .type = NLA_NESTED }, |
| @@ -177,7 +177,7 @@ static int etf_enqueue_timesortedlist(struct sk_buff *nskb, struct Qdisc *sch, · 176 unmodified lines | |||
| 177 | 177 | ||
| 178 | parent = *p; | 178 | parent = *p; |
| 179 | skb = rb_to_skb(parent); | 179 | skb = rb_to_skb(parent); |
| 180 | if (ktime_after(txtime, skb->tstamp)) { | 180 | if (ktime_compare(txtime, skb->tstamp) >= 0) { |
| 181 | p = &parent->rb_right; | 181 | p = &parent->rb_right; |
| 182 | leftmost = false; | 182 | leftmost = false; |
| 183 | } else { | 183 | } else { |
| @@ -509,6 +509,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 508 unmodified lines | |||
| 509 | if (skb->ip_summed == CHECKSUM_PARTIAL && | 509 | if (skb->ip_summed == CHECKSUM_PARTIAL && |
| 510 | skb_checksum_help(skb)) { | 510 | skb_checksum_help(skb)) { |
| 511 | qdisc_drop(skb, sch, to_free); | 511 | qdisc_drop(skb, sch, to_free); |
| 512 | skb = NULL; | ||
| 512 | goto finish_segs; | 513 | goto finish_segs; |
| 513 | } | 514 | } |
| 514 | 515 | ||
| @@ -593,9 +594,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 78 unmodified lines | |||
| 593 | finish_segs: | 594 | finish_segs: |
| 594 | if (segs) { | 595 | if (segs) { |
| 595 | unsigned int len, last_len; | 596 | unsigned int len, last_len; |
| 596 | int nb = 0; | 597 | int nb; |
| 597 | 598 | ||
| 598 | len = skb->len; | 599 | len = skb ? skb->len : 0; |
| 600 | nb = skb ? 1 : 0; | ||
| 599 | 601 | ||
| 600 | while (segs) { | 602 | while (segs) { |
| 601 | skb2 = segs->next; | 603 | skb2 = segs->next; |
| @@ -612,7 +614,10 @@ finish_segs: · 10 unmodified lines | |||
| 612 | } | 614 | } |
| 613 | segs = skb2; | 615 | segs = skb2; |
| 614 | } | 616 | } |
| 615 | qdisc_tree_reduce_backlog(sch, -nb, prev_len - len); | 617 | /* Parent qdiscs accounted for 1 skb of size @prev_len */ |
| 618 | qdisc_tree_reduce_backlog(sch, -(nb - 1), -(len - prev_len)); | ||
| 619 | } else if (!skb) { | ||
| 620 | return NET_XMIT_DROP; | ||
| 616 | } | 621 | } |
| 617 | return NET_XMIT_SUCCESS; | 622 | return NET_XMIT_SUCCESS; |
| 618 | } | 623 | } |
| @@ -1341,6 +1341,10 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb, · 1340 unmodified lines | |||
| 1341 | NL_SET_ERR_MSG(extack, "Specifying a 'clockid' is mandatory"); | 1341 | NL_SET_ERR_MSG(extack, "Specifying a 'clockid' is mandatory"); |
| 1342 | goto out; | 1342 | goto out; |
| 1343 | } | 1343 | } |
| 1344 | |||
| 1345 | /* Everything went ok, return success. */ | ||
| 1346 | err = 0; | ||
| 1347 | |||
| 1344 | out: | 1348 | out: |
| 1345 | return err; | 1349 | return err; |
| 1346 | } | 1350 | } |
| @@ -175,7 +175,7 @@ static int inet_sctp_diag_fill(struct sock *sk, struct sctp_association *asoc, · 174 unmodified lines | |||
| 175 | mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc; | 175 | mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc; |
| 176 | mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued; | 176 | mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued; |
| 177 | mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc); | 177 | mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc); |
| 178 | mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len; | 178 | mem[SK_MEMINFO_BACKLOG] = READ_ONCE(sk->sk_backlog.len); |
| 179 | mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops); | 179 | mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops); |
| 180 | 180 | ||
| 181 | if (nla_put(skb, INET_DIAG_SKMEMINFO, sizeof(mem), &mem) < 0) | 181 | if (nla_put(skb, INET_DIAG_SKMEMINFO, sizeof(mem), &mem) < 0) |
| @@ -243,7 +243,7 @@ int sctp_rcv(struct sk_buff *skb) · 242 unmodified lines | |||
| 243 | bh_lock_sock(sk); | 243 | bh_lock_sock(sk); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | if (sock_owned_by_user(sk)) { | 246 | if (sock_owned_by_user(sk) || !sctp_newsk_ready(sk)) { |
| 247 | if (sctp_add_backlog(sk, skb)) { | 247 | if (sctp_add_backlog(sk, skb)) { |
| 248 | bh_unlock_sock(sk); | 248 | bh_unlock_sock(sk); |
| 249 | sctp_chunk_free(chunk); | 249 | sctp_chunk_free(chunk); |
| @@ -321,8 +321,8 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) · 71 unmodified lines | |||
| 321 | local_bh_disable(); | 321 | local_bh_disable(); |
| 322 | bh_lock_sock(sk); | 322 | bh_lock_sock(sk); |
| 323 | 323 | ||
| 324 | if (sock_owned_by_user(sk)) { | 324 | if (sock_owned_by_user(sk) || !sctp_newsk_ready(sk)) { |
| 325 | if (sk_add_backlog(sk, skb, sk->sk_rcvbuf)) | 325 | if (sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf))) |
| 326 | sctp_chunk_free(chunk); | 326 | sctp_chunk_free(chunk); |
| 327 | else | 327 | else |
| 328 | backloged = 1; | 328 | backloged = 1; |
| @@ -336,7 +336,13 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) · 7 unmodified lines | |||
| 336 | if (backloged) | 336 | if (backloged) |
| 337 | return 0; | 337 | return 0; |
| 338 | } else { | 338 | } else { |
| 339 | sctp_inq_push(inqueue, chunk); | 339 | if (!sctp_newsk_ready(sk)) { |
| 340 | if (!sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf))) | ||
| 341 | return 0; | ||
| 342 | sctp_chunk_free(chunk); | ||
| 343 | } else { | ||
| 344 | sctp_inq_push(inqueue, chunk); | ||
| 345 | } | ||
| 340 | } | 346 | } |
| 341 | 347 | ||
| 342 | done: | 348 | done: |
| @@ -358,7 +364,7 @@ static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb) · 15 unmodified lines | |||
| 358 | struct sctp_ep_common *rcvr = chunk->rcvr; | 364 | struct sctp_ep_common *rcvr = chunk->rcvr; |
| 359 | int ret; | 365 | int ret; |
| 360 | 366 | ||
| 361 | ret = sk_add_backlog(sk, skb, sk->sk_rcvbuf); | 367 | ret = sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf)); |
| 362 | if (!ret) { | 368 | if (!ret) { |
| 363 | /* Hold the assoc/ep while hanging on the backlog queue. | 369 | /* Hold the assoc/ep while hanging on the backlog queue. |
| 364 | * This way, we know structures we need will not disappear | 370 | * This way, we know structures we need will not disappear |
| @@ -9500,7 +9500,7 @@ struct proto sctp_prot = { · 9499 unmodified lines | |||
| 9500 | .backlog_rcv = sctp_backlog_rcv, | 9500 | .backlog_rcv = sctp_backlog_rcv, |
| 9501 | .hash = sctp_hash, | 9501 | .hash = sctp_hash, |
| 9502 | .unhash = sctp_unhash, | 9502 | .unhash = sctp_unhash, |
| 9503 | .get_port = sctp_get_port, | 9503 | .no_autobind = true, |
| 9504 | .obj_size = sizeof(struct sctp_sock), | 9504 | .obj_size = sizeof(struct sctp_sock), |
| 9505 | .useroffset = offsetof(struct sctp_sock, subscribe), | 9505 | .useroffset = offsetof(struct sctp_sock, subscribe), |
| 9506 | .usersize = offsetof(struct sctp_sock, initmsg) - | 9506 | .usersize = offsetof(struct sctp_sock, initmsg) - |
| @@ -9542,7 +9542,7 @@ struct proto sctpv6_prot = { · 35 unmodified lines | |||
| 9542 | .backlog_rcv = sctp_backlog_rcv, | 9542 | .backlog_rcv = sctp_backlog_rcv, |
| 9543 | .hash = sctp_hash, | 9543 | .hash = sctp_hash, |
| 9544 | .unhash = sctp_unhash, | 9544 | .unhash = sctp_unhash, |
| 9545 | .get_port = sctp_get_port, | 9545 | .no_autobind = true, |
| 9546 | .obj_size = sizeof(struct sctp6_sock), | 9546 | .obj_size = sizeof(struct sctp6_sock), |
| 9547 | .useroffset = offsetof(struct sctp6_sock, sctp.subscribe), | 9547 | .useroffset = offsetof(struct sctp6_sock, sctp.subscribe), |
| 9548 | .usersize = offsetof(struct sctp6_sock, sctp.initmsg) - | 9548 | .usersize = offsetof(struct sctp6_sock, sctp.initmsg) - |
| @@ -213,7 +213,7 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini) · 212 unmodified lines | |||
| 213 | lgr = kzalloc(sizeof(*lgr), GFP_KERNEL); | 213 | lgr = kzalloc(sizeof(*lgr), GFP_KERNEL); |
| 214 | if (!lgr) { | 214 | if (!lgr) { |
| 215 | rc = SMC_CLC_DECL_MEM; | 215 | rc = SMC_CLC_DECL_MEM; |
| 216 | goto out; | 216 | goto ism_put_vlan; |
| 217 | } | 217 | } |
| 218 | lgr->is_smcd = ini->is_smcd; | 218 | lgr->is_smcd = ini->is_smcd; |
| 219 | lgr->sync_err = 0; | 219 | lgr->sync_err = 0; |
| @@ -289,6 +289,9 @@ clear_llc_lnk: · 69 unmodified lines | |||
| 289 | smc_llc_link_clear(lnk); | 289 | smc_llc_link_clear(lnk); |
| 290 | free_lgr: | 290 | free_lgr: |
| 291 | kfree(lgr); | 291 | kfree(lgr); |
| 292 | ism_put_vlan: | ||
| 293 | if (ini->is_smcd && ini->vlan_id) | ||
| 294 | smc_ism_put_vlan(ini->ism_dev, ini->vlan_id); | ||
| 292 | out: | 295 | out: |
| 293 | if (rc < 0) { | 296 | if (rc < 0) { |
| 294 | if (rc == -ENOMEM) | 297 | if (rc == -ENOMEM) |
| @@ -211,8 +211,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo, · 210 unmodified lines | |||
| 211 | rc = sk_wait_event(sk, timeo, | 211 | rc = sk_wait_event(sk, timeo, |
| 212 | sk->sk_err || | 212 | sk->sk_err || |
| 213 | sk->sk_shutdown & RCV_SHUTDOWN || | 213 | sk->sk_shutdown & RCV_SHUTDOWN || |
| 214 | fcrit(conn) || | 214 | fcrit(conn), |
| 215 | smc_cdc_rxed_any_close_or_senddone(conn), | ||
| 216 | &wait); | 215 | &wait); |
| 217 | remove_wait_queue(sk_sleep(sk), &wait); | 216 | remove_wait_queue(sk_sleep(sk), &wait); |
| 218 | sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); | 217 | sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); |
| @@ -262,6 +261,18 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len, · 43 unmodified lines | |||
| 262 | return -EAGAIN; | 261 | return -EAGAIN; |
| 263 | } | 262 | } |
| 264 | 263 | ||
| 264 | static bool smc_rx_recvmsg_data_available(struct smc_sock *smc) | ||
| 265 | { | ||
| 266 | struct smc_connection *conn = &smc->conn; | ||
| 267 | |||
| 268 | if (smc_rx_data_available(conn)) | ||
| 269 | return true; | ||
| 270 | else if (conn->urg_state == SMC_URG_VALID) | ||
| 271 | /* we received a single urgent Byte - skip */ | ||
| 272 | smc_rx_update_cons(smc, 0); | ||
| 273 | return false; | ||
| 274 | } | ||
| 275 | |||
| 265 | /* smc_rx_recvmsg - receive data from RMBE | 276 | /* smc_rx_recvmsg - receive data from RMBE |
| 266 | * @msg: copy data to receive buffer | 277 | * @msg: copy data to receive buffer |
| 267 | * @pipe: copy data to pipe if set - indicates splice() call | 278 | * @pipe: copy data to pipe if set - indicates splice() call |
| @@ -303,16 +314,18 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, · 35 unmodified lines | |||
| 303 | if (read_done >= target || (pipe && read_done)) | 314 | if (read_done >= target || (pipe && read_done)) |
| 304 | break; | 315 | break; |
| 305 | 316 | ||
| 306 | if (atomic_read(&conn->bytes_to_rcv)) | 317 | if (smc_rx_recvmsg_data_available(smc)) |
| 307 | goto copy; | 318 | goto copy; |
| 308 | else if (conn->urg_state == SMC_URG_VALID) | ||
| 309 | /* we received a single urgent Byte - skip */ | ||
| 310 | smc_rx_update_cons(smc, 0); | ||
| 311 | 319 | ||
| 312 | if (sk->sk_shutdown & RCV_SHUTDOWN || | 320 | if (sk->sk_shutdown & RCV_SHUTDOWN || |
| 313 | smc_cdc_rxed_any_close_or_senddone(conn) || | 321 | conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) { |
| 314 | conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) | 322 | /* smc_cdc_msg_recv_action() could have run after |
| 323 | * above smc_rx_recvmsg_data_available() | ||
| 324 | */ | ||
| 325 | if (smc_rx_recvmsg_data_available(smc)) | ||
| 326 | goto copy; | ||
| 315 | break; | 327 | break; |
| 328 | } | ||
| 316 | 329 | ||
| 317 | if (read_done) { | 330 | if (read_done) { |
| 318 | if (sk->sk_err || | 331 | if (sk->sk_err || |
| @@ -2119,13 +2119,13 @@ static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *skb) · 2118 unmodified lines | |||
| 2119 | struct tipc_msg *hdr = buf_msg(skb); | 2119 | struct tipc_msg *hdr = buf_msg(skb); |
| 2120 | 2120 | ||
| 2121 | if (unlikely(msg_in_group(hdr))) | 2121 | if (unlikely(msg_in_group(hdr))) |
| 2122 | return sk->sk_rcvbuf; | 2122 | return READ_ONCE(sk->sk_rcvbuf); |
| 2123 | 2123 | ||
| 2124 | if (unlikely(!msg_connected(hdr))) | 2124 | if (unlikely(!msg_connected(hdr))) |
| 2125 | return sk->sk_rcvbuf << msg_importance(hdr); | 2125 | return READ_ONCE(sk->sk_rcvbuf) << msg_importance(hdr); |
| 2126 | 2126 | ||
| 2127 | if (likely(tsk->peer_caps & TIPC_BLOCK_FLOWCTL)) | 2127 | if (likely(tsk->peer_caps & TIPC_BLOCK_FLOWCTL)) |
| 2128 | return sk->sk_rcvbuf; | 2128 | return READ_ONCE(sk->sk_rcvbuf); |
| 2129 | 2129 | ||
| 2130 | return FLOWCTL_MSG_LIM; | 2130 | return FLOWCTL_MSG_LIM; |
| 2131 | } | 2131 | } |
| @@ -3790,7 +3790,7 @@ int tipc_sk_dump(struct sock *sk, u16 dqueues, char *buf) · 1658 unmodified lines | |||
| 3790 | i += scnprintf(buf + i, sz - i, " %d", sk->sk_sndbuf); | 3790 | i += scnprintf(buf + i, sz - i, " %d", sk->sk_sndbuf); |
| 3791 | i += scnprintf(buf + i, sz - i, " | %d", sk_rmem_alloc_get(sk)); | 3791 | i += scnprintf(buf + i, sz - i, " | %d", sk_rmem_alloc_get(sk)); |
| 3792 | i += scnprintf(buf + i, sz - i, " %d", sk->sk_rcvbuf); | 3792 | i += scnprintf(buf + i, sz - i, " %d", sk->sk_rcvbuf); |
| 3793 | i += scnprintf(buf + i, sz - i, " | %d\n", sk->sk_backlog.len); | 3793 | i += scnprintf(buf + i, sz - i, " | %d\n", READ_ONCE(sk->sk_backlog.len)); |
| 3794 | 3794 | ||
| 3795 | if (dqueues & TIPC_DUMP_SK_SNDQ) { | 3795 | if (dqueues & TIPC_DUMP_SK_SNDQ) { |
| 3796 | i += scnprintf(buf + i, sz - i, "sk_write_queue: "); | 3796 | i += scnprintf(buf + i, sz - i, "sk_write_queue: "); |
| @@ -204,10 +204,14 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, · 203 unmodified lines | |||
| 204 | return virtio_transport_get_ops()->send_pkt(pkt); | 204 | return virtio_transport_get_ops()->send_pkt(pkt); |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | static void virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs, | 207 | static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs, |
| 208 | struct virtio_vsock_pkt *pkt) | 208 | struct virtio_vsock_pkt *pkt) |
| 209 | { | 209 | { |
| 210 | if (vvs->rx_bytes + pkt->len > vvs->buf_alloc) | ||
| 211 | return false; | ||
| 212 | |||
| 210 | vvs->rx_bytes += pkt->len; | 213 | vvs->rx_bytes += pkt->len; |
| 214 | return true; | ||
| 211 | } | 215 | } |
| 212 | 216 | ||
| 213 | static void virtio_transport_dec_rx_pkt(struct virtio_vsock_sock *vvs, | 217 | static void virtio_transport_dec_rx_pkt(struct virtio_vsock_sock *vvs, |
| @@ -458,6 +462,9 @@ void virtio_transport_set_buffer_size(struct vsock_sock *vsk, u64 val) · 244 unmodified lines | |||
| 458 | vvs->buf_size_max = val; | 462 | vvs->buf_size_max = val; |
| 459 | vvs->buf_size = val; | 463 | vvs->buf_size = val; |
| 460 | vvs->buf_alloc = val; | 464 | vvs->buf_alloc = val; |
| 465 | |||
| 466 | virtio_transport_send_credit_update(vsk, VIRTIO_VSOCK_TYPE_STREAM, | ||
| 467 | NULL); | ||
| 461 | } | 468 | } |
| 462 | EXPORT_SYMBOL_GPL(virtio_transport_set_buffer_size); | 469 | EXPORT_SYMBOL_GPL(virtio_transport_set_buffer_size); |
| 463 | 470 | ||
| @@ -876,14 +883,18 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk, · 412 unmodified lines | |||
| 876 | struct virtio_vsock_pkt *pkt) | 883 | struct virtio_vsock_pkt *pkt) |
| 877 | { | 884 | { |
| 878 | struct virtio_vsock_sock *vvs = vsk->trans; | 885 | struct virtio_vsock_sock *vvs = vsk->trans; |
| 879 | bool free_pkt = false; | 886 | bool can_enqueue, free_pkt = false; |
| 880 | 887 | ||
| 881 | pkt->len = le32_to_cpu(pkt->hdr.len); | 888 | pkt->len = le32_to_cpu(pkt->hdr.len); |
| 882 | pkt->off = 0; | 889 | pkt->off = 0; |
| 883 | 890 | ||
| 884 | spin_lock_bh(&vvs->rx_lock); | 891 | spin_lock_bh(&vvs->rx_lock); |
| 885 | 892 | ||
| 886 | virtio_transport_inc_rx_pkt(vvs, pkt); | 893 | can_enqueue = virtio_transport_inc_rx_pkt(vvs, pkt); |
| 894 | if (!can_enqueue) { | ||
| 895 | free_pkt = true; | ||
| 896 | goto out; | ||
| 897 | } | ||
| 887 | 898 | ||
| 888 | /* Try to copy small packets into the buffer of last packet queued, | 899 | /* Try to copy small packets into the buffer of last packet queued, |
| 889 | * to avoid wasting memory queueing the entire buffer with a small | 900 | * to avoid wasting memory queueing the entire buffer with a small |
| @@ -13682,7 +13682,7 @@ static int nl80211_get_ftm_responder_stats(struct sk_buff *skb, · 13681 unmodified lines | |||
| 13682 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, | 13682 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
| 13683 | NL80211_CMD_GET_FTM_RESPONDER_STATS); | 13683 | NL80211_CMD_GET_FTM_RESPONDER_STATS); |
| 13684 | if (!hdr) | 13684 | if (!hdr) |
| 13685 | return -ENOBUFS; | 13685 | goto nla_put_failure; |
| 13686 | 13686 | ||
| 13687 | if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) | 13687 | if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex)) |
| 13688 | goto nla_put_failure; | 13688 | goto nla_put_failure; |
| @@ -3883,6 +3883,7 @@ bool regulatory_pre_cac_allowed(struct wiphy *wiphy) · 3882 unmodified lines | |||
| 3883 | 3883 | ||
| 3884 | return pre_cac_allowed; | 3884 | return pre_cac_allowed; |
| 3885 | } | 3885 | } |
| 3886 | EXPORT_SYMBOL(regulatory_pre_cac_allowed); | ||
| 3886 | 3887 | ||
| 3887 | void regulatory_propagate_dfs_state(struct wiphy *wiphy, | 3888 | void regulatory_propagate_dfs_state(struct wiphy *wiphy, |
| 3888 | struct cfg80211_chan_def *chandef, | 3889 | struct cfg80211_chan_def *chandef, |
| @@ -155,14 +155,6 @@ bool regulatory_indoor_allowed(void); · 154 unmodified lines | |||
| 155 | */ | 155 | */ |
| 156 | #define REG_PRE_CAC_EXPIRY_GRACE_MS 2000 | 156 | #define REG_PRE_CAC_EXPIRY_GRACE_MS 2000 |
| 157 | 157 | ||
| 158 | /** | ||
| 159 | * regulatory_pre_cac_allowed - if pre-CAC allowed in the current dfs domain | ||
| 160 | * @wiphy: wiphy for which pre-CAC capability is checked. | ||
| 161 | |||
| 162 | * Pre-CAC is allowed only in ETSI domain. | ||
| 163 | */ | ||
| 164 | bool regulatory_pre_cac_allowed(struct wiphy *wiphy); | ||
| 165 | |||
| 166 | /** | 158 | /** |
| 167 | * regulatory_propagate_dfs_state - Propagate DFS channel state to other wiphys | 159 | * regulatory_propagate_dfs_state - Propagate DFS channel state to other wiphys |
| 168 | * @wiphy - wiphy on which radar is detected and the event will be propagated | 160 | * @wiphy - wiphy on which radar is detected and the event will be propagated |
| @@ -1703,8 +1703,7 @@ cfg80211_parse_mbssid_frame_data(struct wiphy *wiphy, · 1702 unmodified lines | |||
| 1703 | static void | 1703 | static void |
| 1704 | cfg80211_update_notlisted_nontrans(struct wiphy *wiphy, | 1704 | cfg80211_update_notlisted_nontrans(struct wiphy *wiphy, |
| 1705 | struct cfg80211_bss *nontrans_bss, | 1705 | struct cfg80211_bss *nontrans_bss, |
| 1706 | struct ieee80211_mgmt *mgmt, size_t len, | 1706 | struct ieee80211_mgmt *mgmt, size_t len) |
| 1707 | gfp_t gfp) | ||
| 1708 | { | 1707 | { |
| 1709 | u8 *ie, *new_ie, *pos; | 1708 | u8 *ie, *new_ie, *pos; |
| 1710 | const u8 *nontrans_ssid, *trans_ssid, *mbssid; | 1709 | const u8 *nontrans_ssid, *trans_ssid, *mbssid; |
| @@ -1715,6 +1714,8 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy, · 4 unmodified lines | |||
| 1715 | const struct cfg80211_bss_ies *old; | 1714 | const struct cfg80211_bss_ies *old; |
| 1716 | u8 cpy_len; | 1715 | u8 cpy_len; |
| 1717 | 1716 | ||
| 1717 | lockdep_assert_held(&wiphy_to_rdev(wiphy)->bss_lock); | ||
| 1718 | |||
| 1718 | ie = mgmt->u.probe_resp.variable; | 1719 | ie = mgmt->u.probe_resp.variable; |
| 1719 | 1720 | ||
| 1720 | new_ie_len = ielen; | 1721 | new_ie_len = ielen; |
| @@ -1731,23 +1732,22 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy, · 10 unmodified lines | |||
| 1731 | if (!mbssid || mbssid < trans_ssid) | 1732 | if (!mbssid || mbssid < trans_ssid) |
| 1732 | return; | 1733 | return; |
| 1733 | new_ie_len -= mbssid[1]; | 1734 | new_ie_len -= mbssid[1]; |
| 1734 | rcu_read_lock(); | 1735 | |
| 1735 | nontrans_ssid = ieee80211_bss_get_ie(nontrans_bss, WLAN_EID_SSID); | 1736 | nontrans_ssid = ieee80211_bss_get_ie(nontrans_bss, WLAN_EID_SSID); |
| 1736 | if (!nontrans_ssid) { | 1737 | if (!nontrans_ssid) |
| 1737 | rcu_read_unlock(); | ||
| 1738 | return; | 1738 | return; |
| 1739 | } | 1739 | |
| 1740 | new_ie_len += nontrans_ssid[1]; | 1740 | new_ie_len += nontrans_ssid[1]; |
| 1741 | rcu_read_unlock(); | ||
| 1742 | 1741 | ||
| 1743 | /* generate new ie for nontrans BSS | 1742 | /* generate new ie for nontrans BSS |
| 1744 | * 1. replace SSID with nontrans BSS' SSID | 1743 | * 1. replace SSID with nontrans BSS' SSID |
| 1745 | * 2. skip MBSSID IE | 1744 | * 2. skip MBSSID IE |
| 1746 | */ | 1745 | */ |
| 1747 | new_ie = kzalloc(new_ie_len, gfp); | 1746 | new_ie = kzalloc(new_ie_len, GFP_ATOMIC); |
| 1748 | if (!new_ie) | 1747 | if (!new_ie) |
| 1749 | return; | 1748 | return; |
| 1750 | new_ies = kzalloc(sizeof(*new_ies) + new_ie_len, gfp); | 1749 | |
| 1750 | new_ies = kzalloc(sizeof(*new_ies) + new_ie_len, GFP_ATOMIC); | ||
| 1751 | if (!new_ies) | 1751 | if (!new_ies) |
| 1752 | goto out_free; | 1752 | goto out_free; |
| 1753 | 1753 | ||
| @@ -1901,6 +1901,8 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, · 147 unmodified lines | |||
| 1901 | cfg80211_parse_mbssid_frame_data(wiphy, data, mgmt, len, | 1901 | cfg80211_parse_mbssid_frame_data(wiphy, data, mgmt, len, |
| 1902 | &non_tx_data, gfp); | 1902 | &non_tx_data, gfp); |
| 1903 | 1903 | ||
| 1904 | spin_lock_bh(&wiphy_to_rdev(wiphy)->bss_lock); | ||
| 1905 | |||
| 1904 | /* check if the res has other nontransmitting bss which is not | 1906 | /* check if the res has other nontransmitting bss which is not |
| 1905 | * in MBSSID IE | 1907 | * in MBSSID IE |
| 1906 | */ | 1908 | */ |
| @@ -1915,8 +1917,9 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, · 8 unmodified lines | |||
| 1915 | ies2 = rcu_access_pointer(tmp_bss->ies); | 1917 | ies2 = rcu_access_pointer(tmp_bss->ies); |
| 1916 | if (ies2->tsf < ies1->tsf) | 1918 | if (ies2->tsf < ies1->tsf) |
| 1917 | cfg80211_update_notlisted_nontrans(wiphy, tmp_bss, | 1919 | cfg80211_update_notlisted_nontrans(wiphy, tmp_bss, |
| 1918 | mgmt, len, gfp); | 1920 | mgmt, len); |
| 1919 | } | 1921 | } |
| 1922 | spin_unlock_bh(&wiphy_to_rdev(wiphy)->bss_lock); | ||
| 1920 | 1923 | ||
| 1921 | return res; | 1924 | return res; |
| 1922 | } | 1925 | } |
| @@ -202,6 +202,7 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev, · 201 unmodified lines | |||
| 202 | struct iw_point *data, char *ssid) | 202 | struct iw_point *data, char *ssid) |
| 203 | { | 203 | { |
| 204 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 204 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 205 | int ret = 0; | ||
| 205 | 206 | ||
| 206 | /* call only for station! */ | 207 | /* call only for station! */ |
| 207 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) | 208 | if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) |
| @@ -219,7 +220,10 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev, · 11 unmodified lines | |||
| 219 | if (ie) { | 220 | if (ie) { |
| 220 | data->flags = 1; | 221 | data->flags = 1; |
| 221 | data->length = ie[1]; | 222 | data->length = ie[1]; |
| 222 | memcpy(ssid, ie + 2, data->length); | 223 | if (data->length > IW_ESSID_MAX_SIZE) |
| 224 | ret = -EINVAL; | ||
| 225 | else | ||
| 226 | memcpy(ssid, ie + 2, data->length); | ||
| 223 | } | 227 | } |
| 224 | rcu_read_unlock(); | 228 | rcu_read_unlock(); |
| 225 | } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) { | 229 | } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) { |
| @@ -229,7 +233,7 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev, · 3 unmodified lines | |||
| 229 | } | 233 | } |
| 230 | wdev_unlock(wdev); | 234 | wdev_unlock(wdev); |
| 231 | 235 | ||
| 232 | return 0; | 236 | return ret; |
| 233 | } | 237 | } |
| 234 | 238 | ||
| 235 | int cfg80211_mgd_wext_siwap(struct net_device *dev, | 239 | int cfg80211_mgd_wext_siwap(struct net_device *dev, |
| @@ -55,7 +55,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb) · 54 unmodified lines | |||
| 55 | if (!sock_owned_by_user(sk)) { | 55 | if (!sock_owned_by_user(sk)) { |
| 56 | queued = x25_process_rx_frame(sk, skb); | 56 | queued = x25_process_rx_frame(sk, skb); |
| 57 | } else { | 57 | } else { |
| 58 | queued = !sk_add_backlog(sk, skb, sk->sk_rcvbuf); | 58 | queued = !sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf)); |
| 59 | } | 59 | } |
| 60 | bh_unlock_sock(sk); | 60 | bh_unlock_sock(sk); |
| 61 | sock_put(sk); | 61 | sock_put(sk); |
| @@ -305,9 +305,8 @@ out: · 304 unmodified lines | |||
| 305 | } | 305 | } |
| 306 | EXPORT_SYMBOL(xsk_umem_consume_tx); | 306 | EXPORT_SYMBOL(xsk_umem_consume_tx); |
| 307 | 307 | ||
| 308 | static int xsk_zc_xmit(struct sock *sk) | 308 | static int xsk_zc_xmit(struct xdp_sock *xs) |
| 309 | { | 309 | { |
| 310 | struct xdp_sock *xs = xdp_sk(sk); | ||
| 311 | struct net_device *dev = xs->dev; | 310 | struct net_device *dev = xs->dev; |
| 312 | 311 | ||
| 313 | return dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, | 312 | return dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, |
| @@ -327,11 +326,10 @@ static void xsk_destruct_skb(struct sk_buff *skb) · 13 unmodified lines | |||
| 327 | sock_wfree(skb); | 326 | sock_wfree(skb); |
| 328 | } | 327 | } |
| 329 | 328 | ||
| 330 | static int xsk_generic_xmit(struct sock *sk, struct msghdr *m, | 329 | static int xsk_generic_xmit(struct sock *sk) |
| 331 | size_t total_len) | ||
| 332 | { | 330 | { |
| 333 | u32 max_batch = TX_BATCH_SIZE; | ||
| 334 | struct xdp_sock *xs = xdp_sk(sk); | 331 | struct xdp_sock *xs = xdp_sk(sk); |
| 332 | u32 max_batch = TX_BATCH_SIZE; | ||
| 335 | bool sent_frame = false; | 333 | bool sent_frame = false; |
| 336 | struct xdp_desc desc; | 334 | struct xdp_desc desc; |
| 337 | struct sk_buff *skb; | 335 | struct sk_buff *skb; |
| @@ -394,6 +392,18 @@ out: · 56 unmodified lines | |||
| 394 | return err; | 392 | return err; |
| 395 | } | 393 | } |
| 396 | 394 | ||
| 395 | static int __xsk_sendmsg(struct sock *sk) | ||
| 396 | { | ||
| 397 | struct xdp_sock *xs = xdp_sk(sk); | ||
| 398 | |||
| 399 | if (unlikely(!(xs->dev->flags & IFF_UP))) | ||
| 400 | return -ENETDOWN; | ||
| 401 | if (unlikely(!xs->tx)) | ||
| 402 | return -ENOBUFS; | ||
| 403 | |||
| 404 | return xs->zc ? xsk_zc_xmit(xs) : xsk_generic_xmit(sk); | ||
| 405 | } | ||
| 406 | |||
| 397 | static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) | 407 | static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) |
| 398 | { | 408 | { |
| 399 | bool need_wait = !(m->msg_flags & MSG_DONTWAIT); | 409 | bool need_wait = !(m->msg_flags & MSG_DONTWAIT); |
| @@ -402,21 +412,18 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) · 2 unmodified lines | |||
| 402 | 412 | ||
| 403 | if (unlikely(!xsk_is_bound(xs))) | 413 | if (unlikely(!xsk_is_bound(xs))) |
| 404 | return -ENXIO; | 414 | return -ENXIO; |
| 405 | if (unlikely(!(xs->dev->flags & IFF_UP))) | 415 | if (unlikely(need_wait)) |
| 406 | return -ENETDOWN; | ||
| 407 | if (unlikely(!xs->tx)) | ||
| 408 | return -ENOBUFS; | ||
| 409 | if (need_wait) | ||
| 410 | return -EOPNOTSUPP; | 416 | return -EOPNOTSUPP; |
| 411 | 417 | ||
| 412 | return (xs->zc) ? xsk_zc_xmit(sk) : xsk_generic_xmit(sk, m, total_len); | 418 | return __xsk_sendmsg(sk); |
| 413 | } | 419 | } |
| 414 | 420 | ||
| 415 | static unsigned int xsk_poll(struct file *file, struct socket *sock, | 421 | static unsigned int xsk_poll(struct file *file, struct socket *sock, |
| 416 | struct poll_table_struct *wait) | 422 | struct poll_table_struct *wait) |
| 417 | { | 423 | { |
| 418 | unsigned int mask = datagram_poll(file, sock, wait); | 424 | unsigned int mask = datagram_poll(file, sock, wait); |
| 419 | struct xdp_sock *xs = xdp_sk(sock->sk); | 425 | struct sock *sk = sock->sk; |
| 426 | struct xdp_sock *xs = xdp_sk(sk); | ||
| 420 | struct net_device *dev; | 427 | struct net_device *dev; |
| 421 | struct xdp_umem *umem; | 428 | struct xdp_umem *umem; |
| 422 | 429 | ||
| @@ -426,9 +433,14 @@ static unsigned int xsk_poll(struct file *file, struct socket *sock, · 3 unmodified lines | |||
| 426 | dev = xs->dev; | 433 | dev = xs->dev; |
| 427 | umem = xs->umem; | 434 | umem = xs->umem; |
| 428 | 435 | ||
| 429 | if (umem->need_wakeup) | 436 | if (umem->need_wakeup) { |
| 430 | dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, | 437 | if (dev->netdev_ops->ndo_xsk_wakeup) |
| 431 | umem->need_wakeup); | 438 | dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id, |
| 439 | umem->need_wakeup); | ||
| 440 | else | ||
| 441 | /* Poll needs to drive Tx also in copy mode */ | ||
| 442 | __xsk_sendmsg(sk); | ||
| 443 | } | ||
| 432 | 444 | ||
| 433 | if (xs->rx && !xskq_empty_desc(xs->rx)) | 445 | if (xs->rx && !xskq_empty_desc(xs->rx)) |
| 434 | mask |= POLLIN | POLLRDNORM; | 446 | mask |= POLLIN | POLLRDNORM; |
| @@ -3,7 +3,8 @@ · 2 unmodified lines | |||
| 3 | #ifndef __ASM_GOTO_WORKAROUND_H | 3 | #ifndef __ASM_GOTO_WORKAROUND_H |
| 4 | #define __ASM_GOTO_WORKAROUND_H | 4 | #define __ASM_GOTO_WORKAROUND_H |
| 5 | 5 | ||
| 6 | /* this will bring in asm_volatile_goto macro definition | 6 | /* |
| 7 | * This will bring in asm_volatile_goto and asm_inline macro definitions | ||
| 7 | * if enabled by compiler and config options. | 8 | * if enabled by compiler and config options. |
| 8 | */ | 9 | */ |
| 9 | #include <linux/types.h> | 10 | #include <linux/types.h> |
| @@ -13,5 +14,15 @@ · 3 unmodified lines | |||
| 13 | #define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto") | 14 | #define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto") |
| 14 | #endif | 15 | #endif |
| 15 | 16 | ||
| 17 | /* | ||
| 18 | * asm_inline is defined as asm __inline in "include/linux/compiler_types.h" | ||
| 19 | * if supported by the kernel's CC (i.e CONFIG_CC_HAS_ASM_INLINE) which is not | ||
| 20 | * supported by CLANG. | ||
| 21 | */ | ||
| 22 | #ifdef asm_inline | ||
| 23 | #undef asm_inline | ||
| 24 | #define asm_inline asm | ||
| 25 | #endif | ||
| 26 | |||
| 16 | #define volatile(x...) volatile("") | 27 | #define volatile(x...) volatile("") |
| 17 | #endif | 28 | #endif |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <sys/resource.h> | 13 | #include <sys/resource.h> |
| 14 | #include <sys/types.h> | 14 | #include <sys/types.h> |
| 15 | #include <sys/stat.h> | 15 | #include <sys/stat.h> |
| 16 | #include <linux/perf_event.h> | ||
| 16 | 17 | ||
| 17 | #include "libbpf.h" | 18 | #include "libbpf.h" |
| 18 | #include "bpf_load.h" | 19 | #include "bpf_load.h" |
| @@ -1,60 +0,0 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | /// Use devm_platform_ioremap_resource helper which wraps | ||
| 3 | /// platform_get_resource() and devm_ioremap_resource() together. | ||
| 4 | /// | ||
| 5 | // Confidence: High | ||
| 6 | // Copyright: (C) 2019 Himanshu Jha GPLv2. | ||
| 7 | // Copyright: (C) 2019 Julia Lawall, Inria/LIP6. GPLv2. | ||
| 8 | // Keywords: platform_get_resource, devm_ioremap_resource, | ||
| 9 | // Keywords: devm_platform_ioremap_resource | ||
| 10 | |||
| 11 | virtual patch | ||
| 12 | virtual report | ||
| 13 | |||
| 14 | @r depends on patch && !report@ | ||
| 15 | expression e1, e2, arg1, arg2, arg3; | ||
| 16 | identifier id; | ||
| 17 | @@ | ||
| 18 | |||
| 19 | ( | ||
| 20 | - id = platform_get_resource(arg1, IORESOURCE_MEM, arg2); | ||
| 21 | | | ||
| 22 | - struct resource *id = platform_get_resource(arg1, IORESOURCE_MEM, arg2); | ||
| 23 | ) | ||
| 24 | ... when != id | ||
| 25 | - e1 = devm_ioremap_resource(arg3, id); | ||
| 26 | + e1 = devm_platform_ioremap_resource(arg1, arg2); | ||
| 27 | ... when != id | ||
| 28 | ? id = e2 | ||
| 29 | |||
| 30 | @r1 depends on patch && !report@ | ||
| 31 | identifier r.id; | ||
| 32 | type T; | ||
| 33 | @@ | ||
| 34 | |||
| 35 | - T *id; | ||
| 36 | ...when != id | ||
| 37 | |||
| 38 | @r2 depends on report && !patch@ | ||
| 39 | identifier id; | ||
| 40 | expression e1, e2, arg1, arg2, arg3; | ||
| 41 | position j0; | ||
| 42 | @@ | ||
| 43 | |||
| 44 | ( | ||
| 45 | id = platform_get_resource(arg1, IORESOURCE_MEM, arg2); | ||
| 46 | | | ||
| 47 | struct resource *id = platform_get_resource(arg1, IORESOURCE_MEM, arg2); | ||
| 48 | ) | ||
| 49 | ... when != id | ||
| 50 | e1@j0 = devm_ioremap_resource(arg3, id); | ||
| 51 | ... when != id | ||
| 52 | ? id = e2 | ||
| 53 | |||
| 54 | @script:python depends on report && !patch@ | ||
| 55 | e1 << r2.e1; | ||
| 56 | j0 << r2.j0; | ||
| 57 | @@ | ||
| 58 | |||
| 59 | msg = "WARNING: Use devm_platform_ioremap_resource for %s" % (e1) | ||
| 60 | coccilib.report.print_report(j0[0], msg) | ||
| @@ -16,6 +16,8 @@ import sys · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | from linux import utils | 17 | from linux import utils |
| 18 | 18 | ||
| 19 | printk_log_type = utils.CachedType("struct printk_log") | ||
| 20 | |||
| 19 | 21 | ||
| 20 | class LxDmesg(gdb.Command): | 22 | class LxDmesg(gdb.Command): |
| 21 | """Print Linux kernel log buffer.""" | 23 | """Print Linux kernel log buffer.""" |
| @@ -42,9 +44,14 @@ class LxDmesg(gdb.Command): · 20 unmodified lines | |||
| 42 | b = utils.read_memoryview(inf, log_buf_addr, log_next_idx) | 44 | b = utils.read_memoryview(inf, log_buf_addr, log_next_idx) |
| 43 | log_buf = a.tobytes() + b.tobytes() | 45 | log_buf = a.tobytes() + b.tobytes() |
| 44 | 46 | ||
| 47 | length_offset = printk_log_type.get_type()['len'].bitpos // 8 | ||
| 48 | text_len_offset = printk_log_type.get_type()['text_len'].bitpos // 8 | ||
| 49 | time_stamp_offset = printk_log_type.get_type()['ts_nsec'].bitpos // 8 | ||
| 50 | text_offset = printk_log_type.get_type().sizeof | ||
| 51 | |||
| 45 | pos = 0 | 52 | pos = 0 |
| 46 | while pos < log_buf.__len__(): | 53 | while pos < log_buf.__len__(): |
| 47 | length = utils.read_u16(log_buf[pos + 8:pos + 10]) | 54 | length = utils.read_u16(log_buf, pos + length_offset) |
| 48 | if length == 0: | 55 | if length == 0: |
| 49 | if log_buf_2nd_half == -1: | 56 | if log_buf_2nd_half == -1: |
| 50 | gdb.write("Corrupted log buffer!\n") | 57 | gdb.write("Corrupted log buffer!\n") |
| @@ -52,10 +59,11 @@ class LxDmesg(gdb.Command): · 1 unmodified line | |||
| 52 | pos = log_buf_2nd_half | 59 | pos = log_buf_2nd_half |
| 53 | continue | 60 | continue |
| 54 | 61 | ||
| 55 | text_len = utils.read_u16(log_buf[pos + 10:pos + 12]) | 62 | text_len = utils.read_u16(log_buf, pos + text_len_offset) |
| 56 | text = log_buf[pos + 16:pos + 16 + text_len].decode( | 63 | text_start = pos + text_offset |
| 64 | text = log_buf[text_start:text_start + text_len].decode( | ||
| 57 | encoding='utf8', errors='replace') | 65 | encoding='utf8', errors='replace') |
| 58 | time_stamp = utils.read_u64(log_buf[pos:pos + 8]) | 66 | time_stamp = utils.read_u64(log_buf, pos + time_stamp_offset) |
| 59 | 67 | ||
| 60 | for line in text.splitlines(): | 68 | for line in text.splitlines(): |
| 61 | msg = u"[{time:12.6f}] {line}\n".format( | 69 | msg = u"[{time:12.6f}] {line}\n".format( |
| @@ -15,7 +15,7 @@ import gdb · 14 unmodified lines | |||
| 15 | import os | 15 | import os |
| 16 | import re | 16 | import re |
| 17 | 17 | ||
| 18 | from linux import modules | 18 | from linux import modules, utils |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | if hasattr(gdb, 'Breakpoint'): | 21 | if hasattr(gdb, 'Breakpoint'): |
| @@ -116,6 +116,12 @@ lx-symbols command.""" · 94 unmodified lines | |||
| 116 | module_file = self._get_module_file(module_name) | 116 | module_file = self._get_module_file(module_name) |
| 117 | 117 | ||
| 118 | if module_file: | 118 | if module_file: |
| 119 | if utils.is_target_arch('s390'): | ||
| 120 | # Module text is preceded by PLT stubs on s390. | ||
| 121 | module_arch = module['arch'] | ||
| 122 | plt_offset = int(module_arch['plt_offset']) | ||
| 123 | plt_size = int(module_arch['plt_size']) | ||
| 124 | module_addr = hex(int(module_addr, 0) + plt_offset + plt_size) | ||
| 119 | gdb.write("loading @{addr}: {filename}\n".format( | 125 | gdb.write("loading @{addr}: {filename}\n".format( |
| 120 | addr=module_addr, filename=module_file)) | 126 | addr=module_addr, filename=module_file)) |
| 121 | cmdline = "add-symbol-file {filename} {addr}{sections}".format( | 127 | cmdline = "add-symbol-file {filename} {addr}{sections}".format( |
| @@ -92,15 +92,16 @@ def read_memoryview(inf, start, length): · 91 unmodified lines | |||
| 92 | return memoryview(inf.read_memory(start, length)) | 92 | return memoryview(inf.read_memory(start, length)) |
| 93 | 93 | ||
| 94 | 94 | ||
| 95 | def read_u16(buffer): | 95 | def read_u16(buffer, offset): |
| 96 | buffer_val = buffer[offset:offset + 2] | ||
| 96 | value = [0, 0] | 97 | value = [0, 0] |
| 97 | 98 | ||
| 98 | if type(buffer[0]) is str: | 99 | if type(buffer_val[0]) is str: |
| 99 | value[0] = ord(buffer[0]) | 100 | value[0] = ord(buffer_val[0]) |
| 100 | value[1] = ord(buffer[1]) | 101 | value[1] = ord(buffer_val[1]) |
| 101 | else: | 102 | else: |
| 102 | value[0] = buffer[0] | 103 | value[0] = buffer_val[0] |
| 103 | value[1] = buffer[1] | 104 | value[1] = buffer_val[1] |
| 104 | 105 | ||
| 105 | if get_target_endianness() == LITTLE_ENDIAN: | 106 | if get_target_endianness() == LITTLE_ENDIAN: |
| 106 | return value[0] + (value[1] << 8) | 107 | return value[0] + (value[1] << 8) |
| @@ -108,18 +109,18 @@ def read_u16(buffer): · 1 unmodified line | |||
| 108 | return value[1] + (value[0] << 8) | 109 | return value[1] + (value[0] << 8) |
| 109 | 110 | ||
| 110 | 111 | ||
| 111 | def read_u32(buffer): | 112 | def read_u32(buffer, offset): |
| 112 | if get_target_endianness() == LITTLE_ENDIAN: | 113 | if get_target_endianness() == LITTLE_ENDIAN: |
| 113 | return read_u16(buffer[0:2]) + (read_u16(buffer[2:4]) << 16) | 114 | return read_u16(buffer, offset) + (read_u16(buffer, offset + 2) << 16) |
| 114 | else: | 115 | else: |
| 115 | return read_u16(buffer[2:4]) + (read_u16(buffer[0:2]) << 16) | 116 | return read_u16(buffer, offset + 2) + (read_u16(buffer, offset) << 16) |
| 116 | 117 | ||
| 117 | 118 | ||
| 118 | def read_u64(buffer): | 119 | def read_u64(buffer, offset): |
| 119 | if get_target_endianness() == LITTLE_ENDIAN: | 120 | if get_target_endianness() == LITTLE_ENDIAN: |
| 120 | return read_u32(buffer[0:4]) + (read_u32(buffer[4:8]) << 32) | 121 | return read_u32(buffer, offset) + (read_u32(buffer, offset + 4) << 32) |
| 121 | else: | 122 | else: |
| 122 | return read_u32(buffer[4:8]) + (read_u32(buffer[0:4]) << 32) | 123 | return read_u32(buffer, offset + 4) + (read_u32(buffer, offset) << 32) |
| 123 | 124 | ||
| 124 | 125 | ||
| 125 | target_arch = None | 126 | target_arch = None |
| @@ -348,26 +348,38 @@ static enum export export_from_sec(struct elf_info *elf, unsigned int sec) · 347 unmodified lines | |||
| 348 | return export_unknown; | 348 | return export_unknown; |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | static char *sym_extract_namespace(const char **symname) | 351 | static const char *namespace_from_kstrtabns(struct elf_info *info, |
| 352 | Elf_Sym *kstrtabns) | ||
| 352 | { | 353 | { |
| 353 | char *namespace = NULL; | 354 | char *value = info->ksymtab_strings + kstrtabns->st_value; |
| 354 | char *ns_separator; | 355 | return value[0] ? value : NULL; |
| 356 | } | ||
| 357 | |||
| 358 | static void sym_update_namespace(const char *symname, const char *namespace) | ||
| 359 | { | ||
| 360 | struct symbol *s = find_symbol(symname); | ||
| 355 | 361 | ||
| 356 | ns_separator = strchr(*symname, '.'); | 362 | /* |
| 357 | if (ns_separator) { | 363 | * That symbol should have been created earlier and thus this is |
| 358 | namespace = NOFAIL(strndup(*symname, ns_separator - *symname)); | 364 | * actually an assertion. |
| 359 | *symname = ns_separator + 1; | 365 | */ |
| 366 | if (!s) { | ||
| 367 | merror("Could not update namespace(%s) for symbol %s\n", | ||
| 368 | namespace, symname); | ||
| 369 | return; | ||
| 360 | } | 370 | } |
| 361 | 371 | ||
| 362 | return namespace; | 372 | free(s->namespace); |
| 373 | s->namespace = | ||
| 374 | namespace && namespace[0] ? NOFAIL(strdup(namespace)) : NULL; | ||
| 363 | } | 375 | } |
| 364 | 376 | ||
| 365 | /** | 377 | /** |
| 366 | * Add an exported symbol - it may have already been added without a | 378 | * Add an exported symbol - it may have already been added without a |
| 367 | * CRC, in this case just update the CRC | 379 | * CRC, in this case just update the CRC |
| 368 | **/ | 380 | **/ |
| 369 | static struct symbol *sym_add_exported(const char *name, const char *namespace, | 381 | static struct symbol *sym_add_exported(const char *name, struct module *mod, |
| 370 | struct module *mod, enum export export) | 382 | enum export export) |
| 371 | { | 383 | { |
| 372 | struct symbol *s = find_symbol(name); | 384 | struct symbol *s = find_symbol(name); |
| 373 | 385 | ||
| @@ -383,8 +395,6 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace, · 9 unmodified lines | |||
| 383 | s->module = mod; | 395 | s->module = mod; |
| 384 | } | 396 | } |
| 385 | } | 397 | } |
| 386 | free(s->namespace); | ||
| 387 | s->namespace = namespace ? strdup(namespace) : NULL; | ||
| 388 | s->preloaded = 0; | 398 | s->preloaded = 0; |
| 389 | s->vmlinux = is_vmlinux(mod->name); | 399 | s->vmlinux = is_vmlinux(mod->name); |
| 390 | s->kernel = 0; | 400 | s->kernel = 0; |
| @@ -583,6 +593,10 @@ static int parse_elf(struct elf_info *info, const char *filename) · 192 unmodified lines | |||
| 583 | info->export_unused_gpl_sec = i; | 593 | info->export_unused_gpl_sec = i; |
| 584 | else if (strcmp(secname, "__ksymtab_gpl_future") == 0) | 594 | else if (strcmp(secname, "__ksymtab_gpl_future") == 0) |
| 585 | info->export_gpl_future_sec = i; | 595 | info->export_gpl_future_sec = i; |
| 596 | else if (strcmp(secname, "__ksymtab_strings") == 0) | ||
| 597 | info->ksymtab_strings = (void *)hdr + | ||
| 598 | sechdrs[i].sh_offset - | ||
| 599 | sechdrs[i].sh_addr; | ||
| 586 | 600 | ||
| 587 | if (sechdrs[i].sh_type == SHT_SYMTAB) { | 601 | if (sechdrs[i].sh_type == SHT_SYMTAB) { |
| 588 | unsigned int sh_link_idx; | 602 | unsigned int sh_link_idx; |
| @@ -672,7 +686,6 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 83 unmodified lines | |||
| 672 | enum export export; | 686 | enum export export; |
| 673 | bool is_crc = false; | 687 | bool is_crc = false; |
| 674 | const char *name; | 688 | const char *name; |
| 675 | char *namespace; | ||
| 676 | 689 | ||
| 677 | if ((!is_vmlinux(mod->name) || mod->is_dot_o) && | 690 | if ((!is_vmlinux(mod->name) || mod->is_dot_o) && |
| 678 | strstarts(symname, "__ksymtab")) | 691 | strstarts(symname, "__ksymtab")) |
| @@ -745,9 +758,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 66 unmodified lines | |||
| 745 | /* All exported symbols */ | 758 | /* All exported symbols */ |
| 746 | if (strstarts(symname, "__ksymtab_")) { | 759 | if (strstarts(symname, "__ksymtab_")) { |
| 747 | name = symname + strlen("__ksymtab_"); | 760 | name = symname + strlen("__ksymtab_"); |
| 748 | namespace = sym_extract_namespace(&name); | 761 | sym_add_exported(name, mod, export); |
| 749 | sym_add_exported(name, namespace, mod, export); | ||
| 750 | free(namespace); | ||
| 751 | } | 762 | } |
| 752 | if (strcmp(symname, "init_module") == 0) | 763 | if (strcmp(symname, "init_module") == 0) |
| 753 | mod->has_init = 1; | 764 | mod->has_init = 1; |
| @@ -2043,6 +2054,16 @@ static void read_symbols(const char *modname) · 1289 unmodified lines | |||
| 2043 | handle_moddevtable(mod, &info, sym, symname); | 2054 | handle_moddevtable(mod, &info, sym, symname); |
| 2044 | } | 2055 | } |
| 2045 | 2056 | ||
| 2057 | /* Apply symbol namespaces from __kstrtabns_<symbol> entries. */ | ||
| 2058 | for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { | ||
| 2059 | symname = remove_dot(info.strtab + sym->st_name); | ||
| 2060 | |||
| 2061 | if (strstarts(symname, "__kstrtabns_")) | ||
| 2062 | sym_update_namespace(symname + strlen("__kstrtabns_"), | ||
| 2063 | namespace_from_kstrtabns(&info, | ||
| 2064 | sym)); | ||
| 2065 | } | ||
| 2066 | |||
| 2046 | // check for static EXPORT_SYMBOL_* functions && global vars | 2067 | // check for static EXPORT_SYMBOL_* functions && global vars |
| 2047 | for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { | 2068 | for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { |
| 2048 | unsigned char bind = ELF_ST_BIND(sym->st_info); | 2069 | unsigned char bind = ELF_ST_BIND(sym->st_info); |
| @@ -2196,7 +2217,7 @@ static int check_exports(struct module *mod) · 147 unmodified lines | |||
| 2196 | else | 2217 | else |
| 2197 | basename = mod->name; | 2218 | basename = mod->name; |
| 2198 | 2219 | ||
| 2199 | if (exp->namespace && exp->namespace[0]) { | 2220 | if (exp->namespace) { |
| 2200 | add_namespace(&mod->required_namespaces, | 2221 | add_namespace(&mod->required_namespaces, |
| 2201 | exp->namespace); | 2222 | exp->namespace); |
| 2202 | 2223 | ||
| @@ -2454,12 +2475,12 @@ static void read_dump(const char *fname, unsigned int kernel) · 251 unmodified lines | |||
| 2454 | mod = new_module(modname); | 2475 | mod = new_module(modname); |
| 2455 | mod->skip = 1; | 2476 | mod->skip = 1; |
| 2456 | } | 2477 | } |
| 2457 | s = sym_add_exported(symname, namespace, mod, | 2478 | s = sym_add_exported(symname, mod, export_no(export)); |
| 2458 | export_no(export)); | ||
| 2459 | s->kernel = kernel; | 2479 | s->kernel = kernel; |
| 2460 | s->preloaded = 1; | 2480 | s->preloaded = 1; |
| 2461 | s->is_static = 0; | 2481 | s->is_static = 0; |
| 2462 | sym_update_crc(symname, mod, crc, export_no(export)); | 2482 | sym_update_crc(symname, mod, crc, export_no(export)); |
| 2483 | sym_update_namespace(symname, namespace); | ||
| 2463 | } | 2484 | } |
| 2464 | release_file(file, size); | 2485 | release_file(file, size); |
| 2465 | return; | 2486 | return; |
| @@ -143,6 +143,7 @@ struct elf_info { · 142 unmodified lines | |||
| 143 | Elf_Section export_gpl_sec; | 143 | Elf_Section export_gpl_sec; |
| 144 | Elf_Section export_unused_gpl_sec; | 144 | Elf_Section export_unused_gpl_sec; |
| 145 | Elf_Section export_gpl_future_sec; | 145 | Elf_Section export_gpl_future_sec; |
| 146 | char *ksymtab_strings; | ||
| 146 | char *strtab; | 147 | char *strtab; |
| 147 | char *modinfo; | 148 | char *modinfo; |
| 148 | unsigned int modinfo_len; | 149 | unsigned int modinfo_len; |
| @@ -33,7 +33,7 @@ generate_deps() { · 32 unmodified lines | |||
| 33 | if [ ! -f "$ns_deps_file" ]; then return; fi | 33 | if [ ! -f "$ns_deps_file" ]; then return; fi |
| 34 | local mod_source_files=`cat $mod_file | sed -n 1p \ | 34 | local mod_source_files=`cat $mod_file | sed -n 1p \ |
| 35 | | sed -e 's/\.o/\.c/g' \ | 35 | | sed -e 's/\.o/\.c/g' \ |
| 36 | | sed "s/[^ ]* */${srctree}\/&/g"` | 36 | | sed "s|[^ ]* *|${srctree}/&|g"` |
| 37 | for ns in `cat $ns_deps_file`; do | 37 | for ns in `cat $ns_deps_file`; do |
| 38 | echo "Adding namespace $ns to module $mod_name (if needed)." | 38 | echo "Adding namespace $ns to module $mod_name (if needed)." |
| 39 | generate_deps_for_ns $ns $mod_source_files | 39 | generate_deps_for_ns $ns $mod_source_files |
| @@ -93,7 +93,7 @@ scm_version() · 92 unmodified lines | |||
| 93 | # Check for mercurial and a mercurial repo. | 93 | # Check for mercurial and a mercurial repo. |
| 94 | if test -d .hg && hgid=`hg id 2>/dev/null`; then | 94 | if test -d .hg && hgid=`hg id 2>/dev/null`; then |
| 95 | # Do we have an tagged version? If so, latesttagdistance == 1 | 95 | # Do we have an tagged version? If so, latesttagdistance == 1 |
| 96 | if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then | 96 | if [ "`hg log -r . --template '{latesttagdistance}'`" = "1" ]; then |
| 97 | id=`hg log -r . --template '{latesttag}'` | 97 | id=`hg log -r . --template '{latesttag}'` |
| 98 | printf '%s%s' -hg "$id" | 98 | printf '%s%s' -hg "$id" |
| 99 | else | 99 | else |
| @@ -270,6 +270,11 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, · 269 unmodified lines | |||
| 270 | 270 | ||
| 271 | ret = snd_hdac_ext_bus_link_power_up(link); | 271 | ret = snd_hdac_ext_bus_link_power_up(link); |
| 272 | 272 | ||
| 273 | /* | ||
| 274 | * clear the register to invalidate all the output streams | ||
| 275 | */ | ||
| 276 | snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV, | ||
| 277 | ML_LOSIDV_STREAM_MASK, 0); | ||
| 273 | /* | 278 | /* |
| 274 | * wait for 521usec for codec to report status | 279 | * wait for 521usec for codec to report status |
| 275 | * HDA spec section 4.3 - Codec Discovery | 280 | * HDA spec section 4.3 - Codec Discovery |
| @@ -2399,6 +2399,12 @@ static const struct pci_device_id azx_ids[] = { · 2398 unmodified lines | |||
| 2399 | /* Icelake */ | 2399 | /* Icelake */ |
| 2400 | { PCI_DEVICE(0x8086, 0x34c8), | 2400 | { PCI_DEVICE(0x8086, 0x34c8), |
| 2401 | .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, | 2401 | .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
| 2402 | /* Jasperlake */ | ||
| 2403 | { PCI_DEVICE(0x8086, 0x38c8), | ||
| 2404 | .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, | ||
| 2405 | /* Tigerlake */ | ||
| 2406 | { PCI_DEVICE(0x8086, 0xa0c8), | ||
| 2407 | .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, | ||
| 2402 | /* Elkhart Lake */ | 2408 | /* Elkhart Lake */ |
| 2403 | { PCI_DEVICE(0x8086, 0x4b55), | 2409 | { PCI_DEVICE(0x8086, 0x4b55), |
| 2404 | .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, | 2410 | .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
| @@ -3474,6 +3474,8 @@ static int patch_nvhdmi(struct hda_codec *codec) · 3473 unmodified lines | |||
| 3474 | nvhdmi_chmap_cea_alloc_validate_get_type; | 3474 | nvhdmi_chmap_cea_alloc_validate_get_type; |
| 3475 | spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; | 3475 | spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; |
| 3476 | 3476 | ||
| 3477 | codec->link_down_at_suspend = 1; | ||
| 3478 | |||
| 3477 | generic_acomp_init(codec, &nvhdmi_audio_ops, nvhdmi_port2pin); | 3479 | generic_acomp_init(codec, &nvhdmi_audio_ops, nvhdmi_port2pin); |
| 3478 | 3480 | ||
| 3479 | return 0; | 3481 | return 0; |
| @@ -393,6 +393,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) · 392 unmodified lines | |||
| 393 | case 0x10ec0700: | 393 | case 0x10ec0700: |
| 394 | case 0x10ec0701: | 394 | case 0x10ec0701: |
| 395 | case 0x10ec0703: | 395 | case 0x10ec0703: |
| 396 | case 0x10ec0711: | ||
| 396 | alc_update_coef_idx(codec, 0x10, 1<<15, 0); | 397 | alc_update_coef_idx(codec, 0x10, 1<<15, 0); |
| 397 | break; | 398 | break; |
| 398 | case 0x10ec0662: | 399 | case 0x10ec0662: |
| @@ -5358,6 +5359,17 @@ static void alc271_hp_gate_mic_jack(struct hda_codec *codec, · 4959 unmodified lines | |||
| 5358 | } | 5359 | } |
| 5359 | } | 5360 | } |
| 5360 | 5361 | ||
| 5362 | static void alc256_fixup_dell_xps_13_headphone_noise2(struct hda_codec *codec, | ||
| 5363 | const struct hda_fixup *fix, | ||
| 5364 | int action) | ||
| 5365 | { | ||
| 5366 | if (action != HDA_FIXUP_ACT_PRE_PROBE) | ||
| 5367 | return; | ||
| 5368 | |||
| 5369 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 0, HDA_AMP_VOLMASK, 1); | ||
| 5370 | snd_hda_override_wcaps(codec, 0x1a, get_wcaps(codec, 0x1a) & ~AC_WCAP_IN_AMP); | ||
| 5371 | } | ||
| 5372 | |||
| 5361 | static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, | 5373 | static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, |
| 5362 | const struct hda_fixup *fix, | 5374 | const struct hda_fixup *fix, |
| 5363 | int action) | 5375 | int action) |
| @@ -5822,6 +5834,7 @@ enum { · 458 unmodified lines | |||
| 5822 | ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, | 5834 | ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, |
| 5823 | ALC275_FIXUP_DELL_XPS, | 5835 | ALC275_FIXUP_DELL_XPS, |
| 5824 | ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, | 5836 | ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, |
| 5837 | ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2, | ||
| 5825 | ALC293_FIXUP_LENOVO_SPK_NOISE, | 5838 | ALC293_FIXUP_LENOVO_SPK_NOISE, |
| 5826 | ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, | 5839 | ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, |
| 5827 | ALC255_FIXUP_DELL_SPK_NOISE, | 5840 | ALC255_FIXUP_DELL_SPK_NOISE, |
| @@ -5869,6 +5882,7 @@ enum { · 41 unmodified lines | |||
| 5869 | ALC225_FIXUP_WYSE_AUTO_MUTE, | 5882 | ALC225_FIXUP_WYSE_AUTO_MUTE, |
| 5870 | ALC225_FIXUP_WYSE_DISABLE_MIC_VREF, | 5883 | ALC225_FIXUP_WYSE_DISABLE_MIC_VREF, |
| 5871 | ALC286_FIXUP_ACER_AIO_HEADSET_MIC, | 5884 | ALC286_FIXUP_ACER_AIO_HEADSET_MIC, |
| 5885 | ALC256_FIXUP_ASUS_HEADSET_MIC, | ||
| 5872 | ALC256_FIXUP_ASUS_MIC_NO_PRESENCE, | 5886 | ALC256_FIXUP_ASUS_MIC_NO_PRESENCE, |
| 5873 | ALC299_FIXUP_PREDATOR_SPK, | 5887 | ALC299_FIXUP_PREDATOR_SPK, |
| 5874 | ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC, | 5888 | ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC, |
| @@ -6558,6 +6572,12 @@ static const struct hda_fixup alc269_fixups[] = { · 683 unmodified lines | |||
| 6558 | .chained = true, | 6572 | .chained = true, |
| 6559 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | 6573 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE |
| 6560 | }, | 6574 | }, |
| 6575 | [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2] = { | ||
| 6576 | .type = HDA_FIXUP_FUNC, | ||
| 6577 | .v.func = alc256_fixup_dell_xps_13_headphone_noise2, | ||
| 6578 | .chained = true, | ||
| 6579 | .chain_id = ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE | ||
| 6580 | }, | ||
| 6561 | [ALC293_FIXUP_LENOVO_SPK_NOISE] = { | 6581 | [ALC293_FIXUP_LENOVO_SPK_NOISE] = { |
| 6562 | .type = HDA_FIXUP_FUNC, | 6582 | .type = HDA_FIXUP_FUNC, |
| 6563 | .v.func = alc_fixup_disable_aamix, | 6583 | .v.func = alc_fixup_disable_aamix, |
| @@ -6912,6 +6932,15 @@ static const struct hda_fixup alc269_fixups[] = { · 348 unmodified lines | |||
| 6912 | .chained = true, | 6932 | .chained = true, |
| 6913 | .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE | 6933 | .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE |
| 6914 | }, | 6934 | }, |
| 6935 | [ALC256_FIXUP_ASUS_HEADSET_MIC] = { | ||
| 6936 | .type = HDA_FIXUP_PINS, | ||
| 6937 | .v.pins = (const struct hda_pintbl[]) { | ||
| 6938 | { 0x19, 0x03a11020 }, /* headset mic with jack detect */ | ||
| 6939 | { } | ||
| 6940 | }, | ||
| 6941 | .chained = true, | ||
| 6942 | .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE | ||
| 6943 | }, | ||
| 6915 | [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = { | 6944 | [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = { |
| 6916 | .type = HDA_FIXUP_PINS, | 6945 | .type = HDA_FIXUP_PINS, |
| 6917 | .v.pins = (const struct hda_pintbl[]) { | 6946 | .v.pins = (const struct hda_pintbl[]) { |
| @@ -7001,17 +7030,17 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 83 unmodified lines | |||
| 7001 | SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), | 7030 | SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
| 7002 | SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), | 7031 | SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
| 7003 | SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), | 7032 | SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK), |
| 7004 | SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), | 7033 | SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2), |
| 7005 | SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER), | 7034 | SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER), |
| 7006 | SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE), | 7035 | SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE), |
| 7007 | SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP), | 7036 | SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP), |
| 7008 | SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), | 7037 | SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2), |
| 7009 | SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME), | 7038 | SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME), |
| 7010 | SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), | 7039 | SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), |
| 7011 | SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3), | 7040 | SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3), |
| 7012 | SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER), | 7041 | SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER), |
| 7013 | SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE), | 7042 | SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE), |
| 7014 | SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), | 7043 | SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2), |
| 7015 | SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), | 7044 | SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
| 7016 | SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), | 7045 | SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
| 7017 | SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), | 7046 | SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC), |
| @@ -7108,6 +7137,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 90 unmodified lines | |||
| 7108 | SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), | 7137 | SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), |
| 7109 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), | 7138 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
| 7110 | SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC), | 7139 | SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC), |
| 7140 | SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), | ||
| 7111 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), | 7141 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
| 7112 | SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC), | 7142 | SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC), |
| 7113 | SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), | 7143 | SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), |
| @@ -7990,6 +8020,7 @@ static int patch_alc269(struct hda_codec *codec) · 876 unmodified lines | |||
| 7990 | case 0x10ec0700: | 8020 | case 0x10ec0700: |
| 7991 | case 0x10ec0701: | 8021 | case 0x10ec0701: |
| 7992 | case 0x10ec0703: | 8022 | case 0x10ec0703: |
| 8023 | case 0x10ec0711: | ||
| 7993 | spec->codec_variant = ALC269_TYPE_ALC700; | 8024 | spec->codec_variant = ALC269_TYPE_ALC700; |
| 7994 | spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */ | 8025 | spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */ |
| 7995 | alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ | 8026 | alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ |
| @@ -9204,6 +9235,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { · 1208 unmodified lines | |||
| 9204 | HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269), | 9235 | HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269), |
| 9205 | HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269), | 9236 | HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269), |
| 9206 | HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269), | 9237 | HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269), |
| 9238 | HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269), | ||
| 9207 | HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662), | 9239 | HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662), |
| 9208 | HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880), | 9240 | HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880), |
| 9209 | HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882), | 9241 | HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882), |
| @@ -901,16 +901,20 @@ static void max98373_slot_config(struct i2c_client *i2c, · 900 unmodified lines | |||
| 901 | max98373->i_slot = value & 0xF; | 901 | max98373->i_slot = value & 0xF; |
| 902 | else | 902 | else |
| 903 | max98373->i_slot = 1; | 903 | max98373->i_slot = 1; |
| 904 | 904 | if (dev->of_node) { | |
| 905 | max98373->reset_gpio = of_get_named_gpio(dev->of_node, | 905 | max98373->reset_gpio = of_get_named_gpio(dev->of_node, |
| 906 | "maxim,reset-gpio", 0); | 906 | "maxim,reset-gpio", 0); |
| 907 | if (!gpio_is_valid(max98373->reset_gpio)) { | 907 | if (!gpio_is_valid(max98373->reset_gpio)) { |
| 908 | dev_err(dev, "Looking up %s property in node %s failed %d\n", | 908 | dev_err(dev, "Looking up %s property in node %s failed %d\n", |
| 909 | "maxim,reset-gpio", dev->of_node->full_name, | 909 | "maxim,reset-gpio", dev->of_node->full_name, |
| 910 | max98373->reset_gpio); | 910 | max98373->reset_gpio); |
| 911 | } else { | ||
| 912 | dev_dbg(dev, "maxim,reset-gpio=%d", | ||
| 913 | max98373->reset_gpio); | ||
| 914 | } | ||
| 911 | } else { | 915 | } else { |
| 912 | dev_dbg(dev, "maxim,reset-gpio=%d", | 916 | /* this makes reset_gpio as invalid */ |
| 913 | max98373->reset_gpio); | 917 | max98373->reset_gpio = -1; |
| 914 | } | 918 | } |
| 915 | 919 | ||
| 916 | if (!device_property_read_u32(dev, "maxim,spkfb-slot-no", &value)) | 920 | if (!device_property_read_u32(dev, "maxim,spkfb-slot-no", &value)) |
| @@ -243,6 +243,10 @@ static const char *const rx_mix1_text[] = { · 242 unmodified lines | |||
| 243 | "ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3" | 243 | "ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3" |
| 244 | }; | 244 | }; |
| 245 | 245 | ||
| 246 | static const char * const rx_mix2_text[] = { | ||
| 247 | "ZERO", "IIR1", "IIR2" | ||
| 248 | }; | ||
| 249 | |||
| 246 | static const char *const dec_mux_text[] = { | 250 | static const char *const dec_mux_text[] = { |
| 247 | "ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2" | 251 | "ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2" |
| 248 | }; | 252 | }; |
| @@ -270,6 +274,16 @@ static const struct soc_enum rx3_mix1_inp_enum[] = { · 21 unmodified lines | |||
| 270 | SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B2_CTL, 0, 6, rx_mix1_text), | 274 | SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B2_CTL, 0, 6, rx_mix1_text), |
| 271 | }; | 275 | }; |
| 272 | 276 | ||
| 277 | /* RX1 MIX2 */ | ||
| 278 | static const struct soc_enum rx_mix2_inp1_chain_enum = | ||
| 279 | SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX1_B3_CTL, | ||
| 280 | 0, 3, rx_mix2_text); | ||
| 281 | |||
| 282 | /* RX2 MIX2 */ | ||
| 283 | static const struct soc_enum rx2_mix2_inp1_chain_enum = | ||
| 284 | SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B3_CTL, | ||
| 285 | 0, 3, rx_mix2_text); | ||
| 286 | |||
| 273 | /* DEC */ | 287 | /* DEC */ |
| 274 | static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE( | 288 | static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE( |
| 275 | LPASS_CDC_CONN_TX_B1_CTL, 0, 6, dec_mux_text); | 289 | LPASS_CDC_CONN_TX_B1_CTL, 0, 6, dec_mux_text); |
| @@ -309,6 +323,10 @@ static const struct snd_kcontrol_new rx3_mix1_inp2_mux = SOC_DAPM_ENUM( · 33 unmodified lines | |||
| 309 | "RX3 MIX1 INP2 Mux", rx3_mix1_inp_enum[1]); | 323 | "RX3 MIX1 INP2 Mux", rx3_mix1_inp_enum[1]); |
| 310 | static const struct snd_kcontrol_new rx3_mix1_inp3_mux = SOC_DAPM_ENUM( | 324 | static const struct snd_kcontrol_new rx3_mix1_inp3_mux = SOC_DAPM_ENUM( |
| 311 | "RX3 MIX1 INP3 Mux", rx3_mix1_inp_enum[2]); | 325 | "RX3 MIX1 INP3 Mux", rx3_mix1_inp_enum[2]); |
| 326 | static const struct snd_kcontrol_new rx1_mix2_inp1_mux = SOC_DAPM_ENUM( | ||
| 327 | "RX1 MIX2 INP1 Mux", rx_mix2_inp1_chain_enum); | ||
| 328 | static const struct snd_kcontrol_new rx2_mix2_inp1_mux = SOC_DAPM_ENUM( | ||
| 329 | "RX2 MIX2 INP1 Mux", rx2_mix2_inp1_chain_enum); | ||
| 312 | 330 | ||
| 313 | /* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */ | 331 | /* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */ |
| 314 | static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0); | 332 | static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0); |
| @@ -740,6 +758,10 @@ static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = { · 425 unmodified lines | |||
| 740 | &rx3_mix1_inp2_mux), | 758 | &rx3_mix1_inp2_mux), |
| 741 | SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0, | 759 | SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0, |
| 742 | &rx3_mix1_inp3_mux), | 760 | &rx3_mix1_inp3_mux), |
| 761 | SND_SOC_DAPM_MUX("RX1 MIX2 INP1", SND_SOC_NOPM, 0, 0, | ||
| 762 | &rx1_mix2_inp1_mux), | ||
| 763 | SND_SOC_DAPM_MUX("RX2 MIX2 INP1", SND_SOC_NOPM, 0, 0, | ||
| 764 | &rx2_mix2_inp1_mux), | ||
| 743 | 765 | ||
| 744 | SND_SOC_DAPM_MUX("CIC1 MUX", SND_SOC_NOPM, 0, 0, &cic1_mux), | 766 | SND_SOC_DAPM_MUX("CIC1 MUX", SND_SOC_NOPM, 0, 0, &cic1_mux), |
| 745 | SND_SOC_DAPM_MUX("CIC2 MUX", SND_SOC_NOPM, 0, 0, &cic2_mux), | 767 | SND_SOC_DAPM_MUX("CIC2 MUX", SND_SOC_NOPM, 0, 0, &cic2_mux), |
| @@ -1770,6 +1770,9 @@ static int rt5651_detect_headset(struct snd_soc_component *component) · 1769 unmodified lines | |||
| 1770 | 1770 | ||
| 1771 | static bool rt5651_support_button_press(struct rt5651_priv *rt5651) | 1771 | static bool rt5651_support_button_press(struct rt5651_priv *rt5651) |
| 1772 | { | 1772 | { |
| 1773 | if (!rt5651->hp_jack) | ||
| 1774 | return false; | ||
| 1775 | |||
| 1773 | /* Button press support only works with internal jack-detection */ | 1776 | /* Button press support only works with internal jack-detection */ |
| 1774 | return (rt5651->hp_jack->status & SND_JACK_MICROPHONE) && | 1777 | return (rt5651->hp_jack->status & SND_JACK_MICROPHONE) && |
| 1775 | rt5651->gpiod_hp_det == NULL; | 1778 | rt5651->gpiod_hp_det == NULL; |
| @@ -995,6 +995,16 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component, · 994 unmodified lines | |||
| 995 | { | 995 | { |
| 996 | struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); | 996 | struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); |
| 997 | 997 | ||
| 998 | rt5682->hs_jack = hs_jack; | ||
| 999 | |||
| 1000 | if (!hs_jack) { | ||
| 1001 | regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2, | ||
| 1002 | RT5682_JD1_EN_MASK, RT5682_JD1_DIS); | ||
| 1003 | regmap_update_bits(rt5682->regmap, RT5682_RC_CLK_CTRL, | ||
| 1004 | RT5682_POW_JDH | RT5682_POW_JDL, 0); | ||
| 1005 | return 0; | ||
| 1006 | } | ||
| 1007 | |||
| 998 | switch (rt5682->pdata.jd_src) { | 1008 | switch (rt5682->pdata.jd_src) { |
| 999 | case RT5682_JD1: | 1009 | case RT5682_JD1: |
| 1000 | snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_2, | 1010 | snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_2, |
| @@ -1032,8 +1042,6 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component, · 31 unmodified lines | |||
| 1032 | break; | 1042 | break; |
| 1033 | } | 1043 | } |
| 1034 | 1044 | ||
| 1035 | rt5682->hs_jack = hs_jack; | ||
| 1036 | |||
| 1037 | return 0; | 1045 | return 0; |
| 1038 | } | 1046 | } |
| 1039 | 1047 | ||
| @@ -533,13 +533,10 @@ static SOC_ENUM_SINGLE_DECL(dac_osr, · 532 unmodified lines | |||
| 533 | static SOC_ENUM_SINGLE_DECL(adc_osr, | 533 | static SOC_ENUM_SINGLE_DECL(adc_osr, |
| 534 | WM8994_OVERSAMPLING, 1, osr_text); | 534 | WM8994_OVERSAMPLING, 1, osr_text); |
| 535 | 535 | ||
| 536 | static const struct snd_kcontrol_new wm8994_snd_controls[] = { | 536 | static const struct snd_kcontrol_new wm8994_common_snd_controls[] = { |
| 537 | SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME, | 537 | SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME, |
| 538 | WM8994_AIF1_ADC1_RIGHT_VOLUME, | 538 | WM8994_AIF1_ADC1_RIGHT_VOLUME, |
| 539 | 1, 119, 0, digital_tlv), | 539 | 1, 119, 0, digital_tlv), |
| 540 | SOC_DOUBLE_R_TLV("AIF1ADC2 Volume", WM8994_AIF1_ADC2_LEFT_VOLUME, | ||
| 541 | WM8994_AIF1_ADC2_RIGHT_VOLUME, | ||
| 542 | 1, 119, 0, digital_tlv), | ||
| 543 | SOC_DOUBLE_R_TLV("AIF2ADC Volume", WM8994_AIF2_ADC_LEFT_VOLUME, | 540 | SOC_DOUBLE_R_TLV("AIF2ADC Volume", WM8994_AIF2_ADC_LEFT_VOLUME, |
| 544 | WM8994_AIF2_ADC_RIGHT_VOLUME, | 541 | WM8994_AIF2_ADC_RIGHT_VOLUME, |
| 545 | 1, 119, 0, digital_tlv), | 542 | 1, 119, 0, digital_tlv), |
| @@ -556,8 +553,6 @@ SOC_ENUM("AIF2DACR Source", aif2dacr_src), · 10 unmodified lines | |||
| 556 | 553 | ||
| 557 | SOC_DOUBLE_R_TLV("AIF1DAC1 Volume", WM8994_AIF1_DAC1_LEFT_VOLUME, | 554 | SOC_DOUBLE_R_TLV("AIF1DAC1 Volume", WM8994_AIF1_DAC1_LEFT_VOLUME, |
| 558 | WM8994_AIF1_DAC1_RIGHT_VOLUME, 1, 96, 0, digital_tlv), | 555 | WM8994_AIF1_DAC1_RIGHT_VOLUME, 1, 96, 0, digital_tlv), |
| 559 | SOC_DOUBLE_R_TLV("AIF1DAC2 Volume", WM8994_AIF1_DAC2_LEFT_VOLUME, | ||
| 560 | WM8994_AIF1_DAC2_RIGHT_VOLUME, 1, 96, 0, digital_tlv), | ||
| 561 | SOC_DOUBLE_R_TLV("AIF2DAC Volume", WM8994_AIF2_DAC_LEFT_VOLUME, | 556 | SOC_DOUBLE_R_TLV("AIF2DAC Volume", WM8994_AIF2_DAC_LEFT_VOLUME, |
| 562 | WM8994_AIF2_DAC_RIGHT_VOLUME, 1, 96, 0, digital_tlv), | 557 | WM8994_AIF2_DAC_RIGHT_VOLUME, 1, 96, 0, digital_tlv), |
| 563 | 558 | ||
| @@ -565,17 +560,12 @@ SOC_SINGLE_TLV("AIF1 Boost Volume", WM8994_AIF1_CONTROL_2, 10, 3, 0, aif_tlv), · 1 unmodified line | |||
| 565 | SOC_SINGLE_TLV("AIF2 Boost Volume", WM8994_AIF2_CONTROL_2, 10, 3, 0, aif_tlv), | 560 | SOC_SINGLE_TLV("AIF2 Boost Volume", WM8994_AIF2_CONTROL_2, 10, 3, 0, aif_tlv), |
| 566 | 561 | ||
| 567 | SOC_SINGLE("AIF1DAC1 EQ Switch", WM8994_AIF1_DAC1_EQ_GAINS_1, 0, 1, 0), | 562 | SOC_SINGLE("AIF1DAC1 EQ Switch", WM8994_AIF1_DAC1_EQ_GAINS_1, 0, 1, 0), |
| 568 | SOC_SINGLE("AIF1DAC2 EQ Switch", WM8994_AIF1_DAC2_EQ_GAINS_1, 0, 1, 0), | ||
| 569 | SOC_SINGLE("AIF2 EQ Switch", WM8994_AIF2_EQ_GAINS_1, 0, 1, 0), | 563 | SOC_SINGLE("AIF2 EQ Switch", WM8994_AIF2_EQ_GAINS_1, 0, 1, 0), |
| 570 | 564 | ||
| 571 | WM8994_DRC_SWITCH("AIF1DAC1 DRC Switch", WM8994_AIF1_DRC1_1, 2), | 565 | WM8994_DRC_SWITCH("AIF1DAC1 DRC Switch", WM8994_AIF1_DRC1_1, 2), |
| 572 | WM8994_DRC_SWITCH("AIF1ADC1L DRC Switch", WM8994_AIF1_DRC1_1, 1), | 566 | WM8994_DRC_SWITCH("AIF1ADC1L DRC Switch", WM8994_AIF1_DRC1_1, 1), |
| 573 | WM8994_DRC_SWITCH("AIF1ADC1R DRC Switch", WM8994_AIF1_DRC1_1, 0), | 567 | WM8994_DRC_SWITCH("AIF1ADC1R DRC Switch", WM8994_AIF1_DRC1_1, 0), |
| 574 | 568 | ||
| 575 | WM8994_DRC_SWITCH("AIF1DAC2 DRC Switch", WM8994_AIF1_DRC2_1, 2), | ||
| 576 | WM8994_DRC_SWITCH("AIF1ADC2L DRC Switch", WM8994_AIF1_DRC2_1, 1), | ||
| 577 | WM8994_DRC_SWITCH("AIF1ADC2R DRC Switch", WM8994_AIF1_DRC2_1, 0), | ||
| 578 | |||
| 579 | WM8994_DRC_SWITCH("AIF2DAC DRC Switch", WM8994_AIF2_DRC_1, 2), | 569 | WM8994_DRC_SWITCH("AIF2DAC DRC Switch", WM8994_AIF2_DRC_1, 2), |
| 580 | WM8994_DRC_SWITCH("AIF2ADCL DRC Switch", WM8994_AIF2_DRC_1, 1), | 570 | WM8994_DRC_SWITCH("AIF2ADCL DRC Switch", WM8994_AIF2_DRC_1, 1), |
| 581 | WM8994_DRC_SWITCH("AIF2ADCR DRC Switch", WM8994_AIF2_DRC_1, 0), | 571 | WM8994_DRC_SWITCH("AIF2ADCR DRC Switch", WM8994_AIF2_DRC_1, 0), |
| @@ -594,9 +584,6 @@ SOC_SINGLE("Sidetone HPF Switch", WM8994_SIDETONE, 6, 1, 0), · 12 unmodified lines | |||
| 594 | SOC_ENUM("AIF1ADC1 HPF Mode", aif1adc1_hpf), | 584 | SOC_ENUM("AIF1ADC1 HPF Mode", aif1adc1_hpf), |
| 595 | SOC_DOUBLE("AIF1ADC1 HPF Switch", WM8994_AIF1_ADC1_FILTERS, 12, 11, 1, 0), | 585 | SOC_DOUBLE("AIF1ADC1 HPF Switch", WM8994_AIF1_ADC1_FILTERS, 12, 11, 1, 0), |
| 596 | 586 | ||
| 597 | SOC_ENUM("AIF1ADC2 HPF Mode", aif1adc2_hpf), | ||
| 598 | SOC_DOUBLE("AIF1ADC2 HPF Switch", WM8994_AIF1_ADC2_FILTERS, 12, 11, 1, 0), | ||
| 599 | |||
| 600 | SOC_ENUM("AIF2ADC HPF Mode", aif2adc_hpf), | 587 | SOC_ENUM("AIF2ADC HPF Mode", aif2adc_hpf), |
| 601 | SOC_DOUBLE("AIF2ADC HPF Switch", WM8994_AIF2_ADC_FILTERS, 12, 11, 1, 0), | 588 | SOC_DOUBLE("AIF2ADC HPF Switch", WM8994_AIF2_ADC_FILTERS, 12, 11, 1, 0), |
| 602 | 589 | ||
| @@ -637,6 +624,24 @@ SOC_SINGLE("AIF2DAC 3D Stereo Switch", WM8994_AIF2_DAC_FILTERS_2, · 34 unmodified lines | |||
| 637 | 8, 1, 0), | 624 | 8, 1, 0), |
| 638 | }; | 625 | }; |
| 639 | 626 | ||
| 627 | /* Controls not available on WM1811 */ | ||
| 628 | static const struct snd_kcontrol_new wm8994_snd_controls[] = { | ||
| 629 | SOC_DOUBLE_R_TLV("AIF1ADC2 Volume", WM8994_AIF1_ADC2_LEFT_VOLUME, | ||
| 630 | WM8994_AIF1_ADC2_RIGHT_VOLUME, | ||
| 631 | 1, 119, 0, digital_tlv), | ||
| 632 | SOC_DOUBLE_R_TLV("AIF1DAC2 Volume", WM8994_AIF1_DAC2_LEFT_VOLUME, | ||
| 633 | WM8994_AIF1_DAC2_RIGHT_VOLUME, 1, 96, 0, digital_tlv), | ||
| 634 | |||
| 635 | SOC_SINGLE("AIF1DAC2 EQ Switch", WM8994_AIF1_DAC2_EQ_GAINS_1, 0, 1, 0), | ||
| 636 | |||
| 637 | WM8994_DRC_SWITCH("AIF1DAC2 DRC Switch", WM8994_AIF1_DRC2_1, 2), | ||
| 638 | WM8994_DRC_SWITCH("AIF1ADC2L DRC Switch", WM8994_AIF1_DRC2_1, 1), | ||
| 639 | WM8994_DRC_SWITCH("AIF1ADC2R DRC Switch", WM8994_AIF1_DRC2_1, 0), | ||
| 640 | |||
| 641 | SOC_ENUM("AIF1ADC2 HPF Mode", aif1adc2_hpf), | ||
| 642 | SOC_DOUBLE("AIF1ADC2 HPF Switch", WM8994_AIF1_ADC2_FILTERS, 12, 11, 1, 0), | ||
| 643 | }; | ||
| 644 | |||
| 640 | static const struct snd_kcontrol_new wm8994_eq_controls[] = { | 645 | static const struct snd_kcontrol_new wm8994_eq_controls[] = { |
| 641 | SOC_SINGLE_TLV("AIF1DAC1 EQ1 Volume", WM8994_AIF1_DAC1_EQ_GAINS_1, 11, 31, 0, | 646 | SOC_SINGLE_TLV("AIF1DAC1 EQ1 Volume", WM8994_AIF1_DAC1_EQ_GAINS_1, 11, 31, 0, |
| 642 | eq_tlv), | 647 | eq_tlv), |
| @@ -4258,13 +4263,15 @@ static int wm8994_component_probe(struct snd_soc_component *component) · 3615 unmodified lines | |||
| 4258 | wm8994_handle_pdata(wm8994); | 4263 | wm8994_handle_pdata(wm8994); |
| 4259 | 4264 | ||
| 4260 | wm_hubs_add_analogue_controls(component); | 4265 | wm_hubs_add_analogue_controls(component); |
| 4261 | snd_soc_add_component_controls(component, wm8994_snd_controls, | 4266 | snd_soc_add_component_controls(component, wm8994_common_snd_controls, |
| 4262 | ARRAY_SIZE(wm8994_snd_controls)); | 4267 | ARRAY_SIZE(wm8994_common_snd_controls)); |
| 4263 | snd_soc_dapm_new_controls(dapm, wm8994_dapm_widgets, | 4268 | snd_soc_dapm_new_controls(dapm, wm8994_dapm_widgets, |
| 4264 | ARRAY_SIZE(wm8994_dapm_widgets)); | 4269 | ARRAY_SIZE(wm8994_dapm_widgets)); |
| 4265 | 4270 | ||
| 4266 | switch (control->type) { | 4271 | switch (control->type) { |
| 4267 | case WM8994: | 4272 | case WM8994: |
| 4273 | snd_soc_add_component_controls(component, wm8994_snd_controls, | ||
| 4274 | ARRAY_SIZE(wm8994_snd_controls)); | ||
| 4268 | snd_soc_dapm_new_controls(dapm, wm8994_specific_dapm_widgets, | 4275 | snd_soc_dapm_new_controls(dapm, wm8994_specific_dapm_widgets, |
| 4269 | ARRAY_SIZE(wm8994_specific_dapm_widgets)); | 4276 | ARRAY_SIZE(wm8994_specific_dapm_widgets)); |
| 4270 | if (control->revision < 4) { | 4277 | if (control->revision < 4) { |
| @@ -4284,8 +4291,10 @@ static int wm8994_component_probe(struct snd_soc_component *component) · 13 unmodified lines | |||
| 4284 | } | 4291 | } |
| 4285 | break; | 4292 | break; |
| 4286 | case WM8958: | 4293 | case WM8958: |
| 4294 | snd_soc_add_component_controls(component, wm8994_snd_controls, | ||
| 4295 | ARRAY_SIZE(wm8994_snd_controls)); | ||
| 4287 | snd_soc_add_component_controls(component, wm8958_snd_controls, | 4296 | snd_soc_add_component_controls(component, wm8958_snd_controls, |
| 4288 | ARRAY_SIZE(wm8958_snd_controls)); | 4297 | ARRAY_SIZE(wm8958_snd_controls)); |
| 4289 | snd_soc_dapm_new_controls(dapm, wm8958_dapm_widgets, | 4298 | snd_soc_dapm_new_controls(dapm, wm8958_dapm_widgets, |
| 4290 | ARRAY_SIZE(wm8958_dapm_widgets)); | 4299 | ARRAY_SIZE(wm8958_dapm_widgets)); |
| 4291 | if (control->revision < 1) { | 4300 | if (control->revision < 1) { |
| @@ -1259,8 +1259,7 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len) · 1258 unmodified lines | |||
| 1259 | } | 1259 | } |
| 1260 | 1260 | ||
| 1261 | if (in) { | 1261 | if (in) { |
| 1262 | if (in & WMFW_CTL_FLAG_READABLE) | 1262 | out |= rd; |
| 1263 | out |= rd; | ||
| 1264 | if (in & WMFW_CTL_FLAG_WRITEABLE) | 1263 | if (in & WMFW_CTL_FLAG_WRITEABLE) |
| 1265 | out |= wr; | 1264 | out |= wr; |
| 1266 | if (in & WMFW_CTL_FLAG_VOLATILE) | 1265 | if (in & WMFW_CTL_FLAG_VOLATILE) |
| @@ -3697,11 +3696,16 @@ static int wm_adsp_buffer_parse_legacy(struct wm_adsp *dsp) · 2430 unmodified lines | |||
| 3697 | u32 xmalg, addr, magic; | 3696 | u32 xmalg, addr, magic; |
| 3698 | int i, ret; | 3697 | int i, ret; |
| 3699 | 3698 | ||
| 3699 | alg_region = wm_adsp_find_alg_region(dsp, WMFW_ADSP2_XM, dsp->fw_id); | ||
| 3700 | if (!alg_region) { | ||
| 3701 | adsp_err(dsp, "No algorithm region found\n"); | ||
| 3702 | return -EINVAL; | ||
| 3703 | } | ||
| 3704 | |||
| 3700 | buf = wm_adsp_buffer_alloc(dsp); | 3705 | buf = wm_adsp_buffer_alloc(dsp); |
| 3701 | if (!buf) | 3706 | if (!buf) |
| 3702 | return -ENOMEM; | 3707 | return -ENOMEM; |
| 3703 | 3708 | ||
| 3704 | alg_region = wm_adsp_find_alg_region(dsp, WMFW_ADSP2_XM, dsp->fw_id); | ||
| 3705 | xmalg = dsp->ops->sys_config_size / sizeof(__be32); | 3709 | xmalg = dsp->ops->sys_config_size / sizeof(__be32); |
| 3706 | 3710 | ||
| 3707 | addr = alg_region->base + xmalg + ALG_XM_FIELD(magic); | 3711 | addr = alg_region->base + xmalg + ALG_XM_FIELD(magic); |
| @@ -308,6 +308,9 @@ static const struct snd_soc_dapm_widget sof_widgets[] = { · 307 unmodified lines | |||
| 308 | SND_SOC_DAPM_HP("Headphone Jack", NULL), | 308 | SND_SOC_DAPM_HP("Headphone Jack", NULL), |
| 309 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | 309 | SND_SOC_DAPM_MIC("Headset Mic", NULL), |
| 310 | SND_SOC_DAPM_SPK("Spk", NULL), | 310 | SND_SOC_DAPM_SPK("Spk", NULL), |
| 311 | }; | ||
| 312 | |||
| 313 | static const struct snd_soc_dapm_widget dmic_widgets[] = { | ||
| 311 | SND_SOC_DAPM_MIC("SoC DMIC", NULL), | 314 | SND_SOC_DAPM_MIC("SoC DMIC", NULL), |
| 312 | }; | 315 | }; |
| 313 | 316 | ||
| @@ -318,10 +321,6 @@ static const struct snd_soc_dapm_route sof_map[] = { · 4 unmodified lines | |||
| 318 | 321 | ||
| 319 | /* other jacks */ | 322 | /* other jacks */ |
| 320 | { "IN1P", NULL, "Headset Mic" }, | 323 | { "IN1P", NULL, "Headset Mic" }, |
| 321 | |||
| 322 | /* digital mics */ | ||
| 323 | {"DMic", NULL, "SoC DMIC"}, | ||
| 324 | |||
| 325 | }; | 324 | }; |
| 326 | 325 | ||
| 327 | static const struct snd_soc_dapm_route speaker_map[] = { | 326 | static const struct snd_soc_dapm_route speaker_map[] = { |
| @@ -329,6 +328,11 @@ static const struct snd_soc_dapm_route speaker_map[] = { · 1 unmodified line | |||
| 329 | { "Spk", NULL, "Speaker" }, | 328 | { "Spk", NULL, "Speaker" }, |
| 330 | }; | 329 | }; |
| 331 | 330 | ||
| 331 | static const struct snd_soc_dapm_route dmic_map[] = { | ||
| 332 | /* digital mics */ | ||
| 333 | {"DMic", NULL, "SoC DMIC"}, | ||
| 334 | }; | ||
| 335 | |||
| 332 | static int speaker_codec_init(struct snd_soc_pcm_runtime *rtd) | 336 | static int speaker_codec_init(struct snd_soc_pcm_runtime *rtd) |
| 333 | { | 337 | { |
| 334 | struct snd_soc_card *card = rtd->card; | 338 | struct snd_soc_card *card = rtd->card; |
| @@ -342,6 +346,28 @@ static int speaker_codec_init(struct snd_soc_pcm_runtime *rtd) · 7 unmodified lines | |||
| 342 | return ret; | 346 | return ret; |
| 343 | } | 347 | } |
| 344 | 348 | ||
| 349 | static int dmic_init(struct snd_soc_pcm_runtime *rtd) | ||
| 350 | { | ||
| 351 | struct snd_soc_card *card = rtd->card; | ||
| 352 | int ret; | ||
| 353 | |||
| 354 | ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets, | ||
| 355 | ARRAY_SIZE(dmic_widgets)); | ||
| 356 | if (ret) { | ||
| 357 | dev_err(card->dev, "DMic widget addition failed: %d\n", ret); | ||
| 358 | /* Don't need to add routes if widget addition failed */ | ||
| 359 | return ret; | ||
| 360 | } | ||
| 361 | |||
| 362 | ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map, | ||
| 363 | ARRAY_SIZE(dmic_map)); | ||
| 364 | |||
| 365 | if (ret) | ||
| 366 | dev_err(card->dev, "DMic map addition failed: %d\n", ret); | ||
| 367 | |||
| 368 | return ret; | ||
| 369 | } | ||
| 370 | |||
| 345 | /* sof audio machine driver for rt5682 codec */ | 371 | /* sof audio machine driver for rt5682 codec */ |
| 346 | static struct snd_soc_card sof_audio_card_rt5682 = { | 372 | static struct snd_soc_card sof_audio_card_rt5682 = { |
| 347 | .name = "sof_rt5682", | 373 | .name = "sof_rt5682", |
| @@ -445,6 +471,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, · 97 unmodified lines | |||
| 445 | links[id].name = "dmic01"; | 471 | links[id].name = "dmic01"; |
| 446 | links[id].cpus = &cpus[id]; | 472 | links[id].cpus = &cpus[id]; |
| 447 | links[id].cpus->dai_name = "DMIC01 Pin"; | 473 | links[id].cpus->dai_name = "DMIC01 Pin"; |
| 474 | links[id].init = dmic_init; | ||
| 448 | if (dmic_be_num > 1) { | 475 | if (dmic_be_num > 1) { |
| 449 | /* set up 2 BE links at most */ | 476 | /* set up 2 BE links at most */ |
| 450 | links[id + 1].name = "dmic16k"; | 477 | links[id + 1].name = "dmic16k"; |
| @@ -576,6 +603,15 @@ static int sof_audio_probe(struct platform_device *pdev) · 125 unmodified lines | |||
| 576 | /* need to get main clock from pmc */ | 603 | /* need to get main clock from pmc */ |
| 577 | if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) { | 604 | if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) { |
| 578 | ctx->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); | 605 | ctx->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3"); |
| 606 | if (IS_ERR(ctx->mclk)) { | ||
| 607 | ret = PTR_ERR(ctx->mclk); | ||
| 608 | |||
| 609 | dev_err(&pdev->dev, | ||
| 610 | "Failed to get MCLK from pmc_plt_clk_3: %d\n", | ||
| 611 | ret); | ||
| 612 | return ret; | ||
| 613 | } | ||
| 614 | |||
| 579 | ret = clk_prepare_enable(ctx->mclk); | 615 | ret = clk_prepare_enable(ctx->mclk); |
| 580 | if (ret < 0) { | 616 | if (ret < 0) { |
| 581 | dev_err(&pdev->dev, | 617 | dev_err(&pdev->dev, |
| @@ -621,8 +657,24 @@ static int sof_audio_probe(struct platform_device *pdev) · 39 unmodified lines | |||
| 621 | &sof_audio_card_rt5682); | 657 | &sof_audio_card_rt5682); |
| 622 | } | 658 | } |
| 623 | 659 | ||
| 660 | static int sof_rt5682_remove(struct platform_device *pdev) | ||
| 661 | { | ||
| 662 | struct snd_soc_card *card = platform_get_drvdata(pdev); | ||
| 663 | struct snd_soc_component *component = NULL; | ||
| 664 | |||
| 665 | for_each_card_components(card, component) { | ||
| 666 | if (!strcmp(component->name, rt5682_component[0].name)) { | ||
| 667 | snd_soc_component_set_jack(component, NULL, NULL); | ||
| 668 | break; | ||
| 669 | } | ||
| 670 | } | ||
| 671 | |||
| 672 | return 0; | ||
| 673 | } | ||
| 674 | |||
| 624 | static struct platform_driver sof_audio = { | 675 | static struct platform_driver sof_audio = { |
| 625 | .probe = sof_audio_probe, | 676 | .probe = sof_audio_probe, |
| 677 | .remove = sof_rt5682_remove, | ||
| 626 | .driver = { | 678 | .driver = { |
| 627 | .name = "sof_rt5682", | 679 | .name = "sof_rt5682", |
| 628 | .pm = &snd_soc_pm_ops, | 680 | .pm = &snd_soc_pm_ops, |
| @@ -677,7 +677,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev) · 676 unmodified lines | |||
| 677 | ret = rockchip_pcm_platform_register(&pdev->dev); | 677 | ret = rockchip_pcm_platform_register(&pdev->dev); |
| 678 | if (ret) { | 678 | if (ret) { |
| 679 | dev_err(&pdev->dev, "Could not register PCM\n"); | 679 | dev_err(&pdev->dev, "Could not register PCM\n"); |
| 680 | return ret; | 680 | goto err_suspend; |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | return 0; | 683 | return 0; |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | |||
| 5 | // Author: Claude <claude@insginal.co.kr> | 5 | // Author: Claude <claude@insginal.co.kr> |
| 6 | 6 | ||
| 7 | #include <linux/module.h> | 7 | #include <linux/module.h> |
| 8 | #include <linux/of_device.h> | ||
| 8 | #include <linux/platform_device.h> | 9 | #include <linux/platform_device.h> |
| 9 | #include <linux/clk.h> | 10 | #include <linux/clk.h> |
| 10 | 11 | ||
| @@ -74,6 +75,17 @@ static struct snd_soc_card arndale_rt5631 = { · 63 unmodified lines | |||
| 74 | .num_links = ARRAY_SIZE(arndale_rt5631_dai), | 75 | .num_links = ARRAY_SIZE(arndale_rt5631_dai), |
| 75 | }; | 76 | }; |
| 76 | 77 | ||
| 78 | static void arndale_put_of_nodes(struct snd_soc_card *card) | ||
| 79 | { | ||
| 80 | struct snd_soc_dai_link *dai_link; | ||
| 81 | int i; | ||
| 82 | |||
| 83 | for_each_card_prelinks(card, i, dai_link) { | ||
| 84 | of_node_put(dai_link->cpus->of_node); | ||
| 85 | of_node_put(dai_link->codecs->of_node); | ||
| 86 | } | ||
| 87 | } | ||
| 88 | |||
| 77 | static int arndale_audio_probe(struct platform_device *pdev) | 89 | static int arndale_audio_probe(struct platform_device *pdev) |
| 78 | { | 90 | { |
| 79 | int n, ret; | 91 | int n, ret; |
| @@ -103,18 +115,31 @@ static int arndale_audio_probe(struct platform_device *pdev) · 23 unmodified lines | |||
| 103 | if (!arndale_rt5631_dai[0].codecs->of_node) { | 115 | if (!arndale_rt5631_dai[0].codecs->of_node) { |
| 104 | dev_err(&pdev->dev, | 116 | dev_err(&pdev->dev, |
| 105 | "Property 'samsung,audio-codec' missing or invalid\n"); | 117 | "Property 'samsung,audio-codec' missing or invalid\n"); |
| 106 | return -EINVAL; | 118 | ret = -EINVAL; |
| 119 | goto err_put_of_nodes; | ||
| 107 | } | 120 | } |
| 108 | } | 121 | } |
| 109 | 122 | ||
| 110 | ret = devm_snd_soc_register_card(card->dev, card); | 123 | ret = devm_snd_soc_register_card(card->dev, card); |
| 124 | if (ret) { | ||
| 125 | dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); | ||
| 126 | goto err_put_of_nodes; | ||
| 127 | } | ||
| 128 | return 0; | ||
| 111 | 129 | ||
| 112 | if (ret) | 130 | err_put_of_nodes: |
| 113 | dev_err(&pdev->dev, "snd_soc_register_card() failed:%d\n", ret); | 131 | arndale_put_of_nodes(card); |
| 114 | |||
| 115 | return ret; | 132 | return ret; |
| 116 | } | 133 | } |
| 117 | 134 | ||
| 135 | static int arndale_audio_remove(struct platform_device *pdev) | ||
| 136 | { | ||
| 137 | struct snd_soc_card *card = platform_get_drvdata(pdev); | ||
| 138 | |||
| 139 | arndale_put_of_nodes(card); | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | |||
| 118 | static const struct of_device_id samsung_arndale_rt5631_of_match[] __maybe_unused = { | 143 | static const struct of_device_id samsung_arndale_rt5631_of_match[] __maybe_unused = { |
| 119 | { .compatible = "samsung,arndale-rt5631", }, | 144 | { .compatible = "samsung,arndale-rt5631", }, |
| 120 | { .compatible = "samsung,arndale-alc5631", }, | 145 | { .compatible = "samsung,arndale-alc5631", }, |
| @@ -129,6 +154,7 @@ static struct platform_driver arndale_audio_driver = { · 8 unmodified lines | |||
| 129 | .of_match_table = of_match_ptr(samsung_arndale_rt5631_of_match), | 154 | .of_match_table = of_match_ptr(samsung_arndale_rt5631_of_match), |
| 130 | }, | 155 | }, |
| 131 | .probe = arndale_audio_probe, | 156 | .probe = arndale_audio_probe, |
| 157 | .remove = arndale_audio_remove, | ||
| 132 | }; | 158 | }; |
| 133 | 159 | ||
| 134 | module_platform_driver(arndale_audio_driver); | 160 | module_platform_driver(arndale_audio_driver); |
| @@ -761,6 +761,7 @@ static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 760 unmodified lines | |||
| 761 | } | 761 | } |
| 762 | 762 | ||
| 763 | /* set format */ | 763 | /* set format */ |
| 764 | rdai->bit_clk_inv = 0; | ||
| 764 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 765 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
| 765 | case SND_SOC_DAIFMT_I2S: | 766 | case SND_SOC_DAIFMT_I2S: |
| 766 | rdai->sys_delay = 0; | 767 | rdai->sys_delay = 0; |
| @@ -1070,7 +1070,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) · 1069 unmodified lines | |||
| 1070 | return ret; | 1070 | return ret; |
| 1071 | } | 1071 | } |
| 1072 | 1072 | ||
| 1073 | snd_soc_dai_trigger(cpu_dai, substream, cmd); | 1073 | ret = snd_soc_dai_trigger(cpu_dai, substream, cmd); |
| 1074 | if (ret < 0) | 1074 | if (ret < 0) |
| 1075 | return ret; | 1075 | return ret; |
| 1076 | 1076 | ||
| @@ -1097,7 +1097,7 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, · 20 unmodified lines | |||
| 1097 | return ret; | 1097 | return ret; |
| 1098 | } | 1098 | } |
| 1099 | 1099 | ||
| 1100 | snd_soc_dai_bespoke_trigger(cpu_dai, substream, cmd); | 1100 | ret = snd_soc_dai_bespoke_trigger(cpu_dai, substream, cmd); |
| 1101 | if (ret < 0) | 1101 | if (ret < 0) |
| 1102 | return ret; | 1102 | return ret; |
| 1103 | 1103 | ||
| @@ -1146,6 +1146,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, · 42 unmodified lines | |||
| 1146 | { | 1146 | { |
| 1147 | struct snd_soc_dpcm *dpcm; | 1147 | struct snd_soc_dpcm *dpcm; |
| 1148 | unsigned long flags; | 1148 | unsigned long flags; |
| 1149 | char *name; | ||
| 1149 | 1150 | ||
| 1150 | /* only add new dpcms */ | 1151 | /* only add new dpcms */ |
| 1151 | for_each_dpcm_be(fe, stream, dpcm) { | 1152 | for_each_dpcm_be(fe, stream, dpcm) { |
| @@ -1171,9 +1172,15 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, · 19 unmodified lines | |||
| 1171 | stream ? "<-" : "->", be->dai_link->name); | 1172 | stream ? "<-" : "->", be->dai_link->name); |
| 1172 | 1173 | ||
| 1173 | #ifdef CONFIG_DEBUG_FS | 1174 | #ifdef CONFIG_DEBUG_FS |
| 1174 | dpcm->debugfs_state = debugfs_create_dir(be->dai_link->name, | 1175 | name = kasprintf(GFP_KERNEL, "%s:%s", be->dai_link->name, |
| 1175 | fe->debugfs_dpcm_root); | 1176 | stream ? "capture" : "playback"); |
| 1176 | debugfs_create_u32("state", 0644, dpcm->debugfs_state, &dpcm->state); | 1177 | if (name) { |
| 1178 | dpcm->debugfs_state = debugfs_create_dir(name, | ||
| 1179 | fe->debugfs_dpcm_root); | ||
| 1180 | debugfs_create_u32("state", 0644, dpcm->debugfs_state, | ||
| 1181 | &dpcm->state); | ||
| 1182 | kfree(name); | ||
| 1183 | } | ||
| 1177 | #endif | 1184 | #endif |
| 1178 | return 1; | 1185 | return 1; |
| 1179 | } | 1186 | } |
| @@ -1582,7 +1582,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, · 1581 unmodified lines | |||
| 1582 | 1582 | ||
| 1583 | /* map user to kernel widget ID */ | 1583 | /* map user to kernel widget ID */ |
| 1584 | template.id = get_widget_id(le32_to_cpu(w->id)); | 1584 | template.id = get_widget_id(le32_to_cpu(w->id)); |
| 1585 | if (template.id < 0) | 1585 | if ((int)template.id < 0) |
| 1586 | return template.id; | 1586 | return template.id; |
| 1587 | 1587 | ||
| 1588 | /* strings are allocated here, but used and freed by the widget */ | 1588 | /* strings are allocated here, but used and freed by the widget */ |
| @@ -60,13 +60,16 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol, · 59 unmodified lines | |||
| 60 | struct snd_sof_dev *sdev = scontrol->sdev; | 60 | struct snd_sof_dev *sdev = scontrol->sdev; |
| 61 | struct sof_ipc_ctrl_data *cdata = scontrol->control_data; | 61 | struct sof_ipc_ctrl_data *cdata = scontrol->control_data; |
| 62 | unsigned int i, channels = scontrol->num_channels; | 62 | unsigned int i, channels = scontrol->num_channels; |
| 63 | bool change = false; | ||
| 64 | u32 value; | ||
| 63 | 65 | ||
| 64 | /* update each channel */ | 66 | /* update each channel */ |
| 65 | for (i = 0; i < channels; i++) { | 67 | for (i = 0; i < channels; i++) { |
| 66 | cdata->chanv[i].value = | 68 | value = mixer_to_ipc(ucontrol->value.integer.value[i], |
| 67 | mixer_to_ipc(ucontrol->value.integer.value[i], | ||
| 68 | scontrol->volume_table, sm->max + 1); | 69 | scontrol->volume_table, sm->max + 1); |
| 70 | change = change || (value != cdata->chanv[i].value); | ||
| 69 | cdata->chanv[i].channel = i; | 71 | cdata->chanv[i].channel = i; |
| 72 | cdata->chanv[i].value = value; | ||
| 70 | } | 73 | } |
| 71 | 74 | ||
| 72 | /* notify DSP of mixer updates */ | 75 | /* notify DSP of mixer updates */ |
| @@ -76,8 +79,7 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 76 | SOF_CTRL_TYPE_VALUE_CHAN_GET, | 79 | SOF_CTRL_TYPE_VALUE_CHAN_GET, |
| 77 | SOF_CTRL_CMD_VOLUME, | 80 | SOF_CTRL_CMD_VOLUME, |
| 78 | true); | 81 | true); |
| 79 | 82 | return change; | |
| 80 | return 0; | ||
| 81 | } | 83 | } |
| 82 | 84 | ||
| 83 | int snd_sof_switch_get(struct snd_kcontrol *kcontrol, | 85 | int snd_sof_switch_get(struct snd_kcontrol *kcontrol, |
| @@ -105,11 +107,15 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol, · 21 unmodified lines | |||
| 105 | struct snd_sof_dev *sdev = scontrol->sdev; | 107 | struct snd_sof_dev *sdev = scontrol->sdev; |
| 106 | struct sof_ipc_ctrl_data *cdata = scontrol->control_data; | 108 | struct sof_ipc_ctrl_data *cdata = scontrol->control_data; |
| 107 | unsigned int i, channels = scontrol->num_channels; | 109 | unsigned int i, channels = scontrol->num_channels; |
| 110 | bool change = false; | ||
| 111 | u32 value; | ||
| 108 | 112 | ||
| 109 | /* update each channel */ | 113 | /* update each channel */ |
| 110 | for (i = 0; i < channels; i++) { | 114 | for (i = 0; i < channels; i++) { |
| 111 | cdata->chanv[i].value = ucontrol->value.integer.value[i]; | 115 | value = ucontrol->value.integer.value[i]; |
| 116 | change = change || (value != cdata->chanv[i].value); | ||
| 112 | cdata->chanv[i].channel = i; | 117 | cdata->chanv[i].channel = i; |
| 118 | cdata->chanv[i].value = value; | ||
| 113 | } | 119 | } |
| 114 | 120 | ||
| 115 | /* notify DSP of mixer updates */ | 121 | /* notify DSP of mixer updates */ |
| @@ -120,7 +126,7 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 120 | SOF_CTRL_CMD_SWITCH, | 126 | SOF_CTRL_CMD_SWITCH, |
| 121 | true); | 127 | true); |
| 122 | 128 | ||
| 123 | return 0; | 129 | return change; |
| 124 | } | 130 | } |
| 125 | 131 | ||
| 126 | int snd_sof_enum_get(struct snd_kcontrol *kcontrol, | 132 | int snd_sof_enum_get(struct snd_kcontrol *kcontrol, |
| @@ -148,11 +154,15 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol, · 21 unmodified lines | |||
| 148 | struct snd_sof_dev *sdev = scontrol->sdev; | 154 | struct snd_sof_dev *sdev = scontrol->sdev; |
| 149 | struct sof_ipc_ctrl_data *cdata = scontrol->control_data; | 155 | struct sof_ipc_ctrl_data *cdata = scontrol->control_data; |
| 150 | unsigned int i, channels = scontrol->num_channels; | 156 | unsigned int i, channels = scontrol->num_channels; |
| 157 | bool change = false; | ||
| 158 | u32 value; | ||
| 151 | 159 | ||
| 152 | /* update each channel */ | 160 | /* update each channel */ |
| 153 | for (i = 0; i < channels; i++) { | 161 | for (i = 0; i < channels; i++) { |
| 154 | cdata->chanv[i].value = ucontrol->value.enumerated.item[i]; | 162 | value = ucontrol->value.enumerated.item[i]; |
| 163 | change = change || (value != cdata->chanv[i].value); | ||
| 155 | cdata->chanv[i].channel = i; | 164 | cdata->chanv[i].channel = i; |
| 165 | cdata->chanv[i].value = value; | ||
| 156 | } | 166 | } |
| 157 | 167 | ||
| 158 | /* notify DSP of enum updates */ | 168 | /* notify DSP of enum updates */ |
| @@ -163,7 +173,7 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 163 | SOF_CTRL_CMD_ENUM, | 173 | SOF_CTRL_CMD_ENUM, |
| 164 | true); | 174 | true); |
| 165 | 175 | ||
| 166 | return 0; | 176 | return change; |
| 167 | } | 177 | } |
| 168 | 178 | ||
| 169 | int snd_sof_bytes_get(struct snd_kcontrol *kcontrol, | 179 | int snd_sof_bytes_get(struct snd_kcontrol *kcontrol, |
| @@ -273,6 +273,16 @@ config SND_SOC_SOF_HDA_AUDIO_CODEC · 272 unmodified lines | |||
| 273 | Say Y if you want to enable HDAudio codecs with SOF. | 273 | Say Y if you want to enable HDAudio codecs with SOF. |
| 274 | If unsure select "N". | 274 | If unsure select "N". |
| 275 | 275 | ||
| 276 | config SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1 | ||
| 277 | bool "SOF enable DMI Link L1" | ||
| 278 | help | ||
| 279 | This option enables DMI L1 for both playback and capture | ||
| 280 | and disables known workarounds for specific HDaudio platforms. | ||
| 281 | Only use to look into power optimizations on platforms not | ||
| 282 | affected by DMI L1 issues. This option is not recommended. | ||
| 283 | Say Y if you want to enable DMI Link L1 | ||
| 284 | If unsure, select "N". | ||
| 285 | |||
| 276 | endif ## SND_SOC_SOF_HDA_COMMON | 286 | endif ## SND_SOC_SOF_HDA_COMMON |
| 277 | 287 | ||
| 278 | config SND_SOC_SOF_HDA_LINK_BASELINE | 288 | config SND_SOC_SOF_HDA_LINK_BASELINE |
| @@ -37,6 +37,7 @@ · 36 unmodified lines | |||
| 37 | #define MBOX_SIZE 0x1000 | 37 | #define MBOX_SIZE 0x1000 |
| 38 | #define MBOX_DUMP_SIZE 0x30 | 38 | #define MBOX_DUMP_SIZE 0x30 |
| 39 | #define EXCEPT_OFFSET 0x800 | 39 | #define EXCEPT_OFFSET 0x800 |
| 40 | #define EXCEPT_MAX_HDR_SIZE 0x400 | ||
| 40 | 41 | ||
| 41 | /* DSP peripherals */ | 42 | /* DSP peripherals */ |
| 42 | #define DMAC0_OFFSET 0xFE000 | 43 | #define DMAC0_OFFSET 0xFE000 |
| @@ -228,6 +229,11 @@ static void bdw_get_registers(struct snd_sof_dev *sdev, · 185 unmodified lines | |||
| 228 | /* note: variable AR register array is not read */ | 229 | /* note: variable AR register array is not read */ |
| 229 | 230 | ||
| 230 | /* then get panic info */ | 231 | /* then get panic info */ |
| 232 | if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) { | ||
| 233 | dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", | ||
| 234 | xoops->arch_hdr.totalsize); | ||
| 235 | return; | ||
| 236 | } | ||
| 231 | offset += xoops->arch_hdr.totalsize; | 237 | offset += xoops->arch_hdr.totalsize; |
| 232 | sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); | 238 | sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info)); |
| 233 | 239 | ||
| @@ -451,6 +457,7 @@ static int bdw_probe(struct snd_sof_dev *sdev) · 217 unmodified lines | |||
| 451 | /* TODO: add offsets */ | 457 | /* TODO: add offsets */ |
| 452 | sdev->mmio_bar = BDW_DSP_BAR; | 458 | sdev->mmio_bar = BDW_DSP_BAR; |
| 453 | sdev->mailbox_bar = BDW_DSP_BAR; | 459 | sdev->mailbox_bar = BDW_DSP_BAR; |
| 460 | sdev->dsp_oops_offset = MBOX_OFFSET; | ||
| 454 | 461 | ||
| 455 | /* PCI base */ | 462 | /* PCI base */ |
| 456 | mmio = platform_get_resource(pdev, IORESOURCE_MEM, | 463 | mmio = platform_get_resource(pdev, IORESOURCE_MEM, |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | #define MBOX_OFFSET 0x144000 | 28 | #define MBOX_OFFSET 0x144000 |
18 more lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
Empty file added.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.