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

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Cross-merge networking fixes after downstream PR.

No conflicts.

Adjacent changes:

kernel/bpf/verifier.c
829955981c55 ("bpf: Fix verifier log for async callback return values")
a923819fb2c5 ("bpf: Treat first argument as return value for bpf_throw")

Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+3328 -1379
+2
Documentation/arch/arm64/silicon-errata.rst
··· 71 71 +----------------+-----------------+-----------------+-----------------------------+ 72 72 | ARM | Cortex-A510 | #2658417 | ARM64_ERRATUM_2658417 | 73 73 +----------------+-----------------+-----------------+-----------------------------+ 74 + | ARM | Cortex-A520 | #2966298 | ARM64_ERRATUM_2966298 | 75 + +----------------+-----------------+-----------------+-----------------------------+ 74 76 | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | 75 77 +----------------+-----------------+-----------------+-----------------------------+ 76 78 | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
+1 -1
Documentation/devicetree/bindings/cache/andestech,ax45mp-cache.yaml
··· 69 69 - | 70 70 #include <dt-bindings/interrupt-controller/irq.h> 71 71 72 - cache-controller@2010000 { 72 + cache-controller@13400000 { 73 73 compatible = "andestech,ax45mp-cache", "cache"; 74 74 reg = <0x13400000 0x100000>; 75 75 interrupts = <508 IRQ_TYPE_LEVEL_HIGH>;
+1 -1
Documentation/devicetree/bindings/display/imx/fsl,imx6-hdmi.yaml
··· 87 87 - interrupts 88 88 - ports 89 89 90 - additionalProperties: false 90 + unevaluatedProperties: false 91 91 92 92 examples: 93 93 - |
+12
Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
··· 106 106 $ref: /schemas/types.yaml#/definitions/uint32 107 107 maximum: 4096 108 108 109 + dma-noncoherent: 110 + description: 111 + Present if the GIC redistributors permit programming shareability 112 + and cacheability attributes but are connected to a non-coherent 113 + downstream interconnect. 114 + 109 115 msi-controller: 110 116 description: 111 117 Only present if the Message Based Interrupt functionality is ··· 198 192 properties: 199 193 compatible: 200 194 const: arm,gic-v3-its 195 + 196 + dma-noncoherent: 197 + description: 198 + Present if the GIC ITS permits programming shareability and 199 + cacheability attributes but is connected to a non-coherent 200 + downstream interconnect. 201 201 202 202 msi-controller: true 203 203
+1
Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.yaml
··· 37 37 - renesas,intc-ex-r8a77990 # R-Car E3 38 38 - renesas,intc-ex-r8a77995 # R-Car D3 39 39 - renesas,intc-ex-r8a779a0 # R-Car V3U 40 + - renesas,intc-ex-r8a779f0 # R-Car S4-8 40 41 - renesas,intc-ex-r8a779g0 # R-Car V4H 41 42 - const: renesas,irqc 42 43
+173 -57
Documentation/devicetree/bindings/interrupt-controller/renesas,rzg2l-irqc.yaml
··· 19 19 - NMI edge select (NMI is not treated as NMI exception and supports fall edge and 20 20 stand-up edge detection interrupts) 21 21 22 - allOf: 23 - - $ref: /schemas/interrupt-controller.yaml# 24 - 25 22 properties: 26 23 compatible: 27 24 items: 28 25 - enum: 26 + - renesas,r9a07g043u-irqc # RZ/G2UL 29 27 - renesas,r9a07g044-irqc # RZ/G2{L,LC} 30 28 - renesas,r9a07g054-irqc # RZ/V2L 31 29 - const: renesas,rzg2l-irqc 32 30 33 31 '#interrupt-cells': 34 - description: The first cell should contain external interrupt number (IRQ0-7) and the 35 - second cell is used to specify the flag. 32 + description: The first cell should contain a macro RZG2L_{NMI,IRQX} included in the 33 + include/dt-bindings/interrupt-controller/irqc-rzg2l.h and the second 34 + cell is used to specify the flag. 36 35 const: 2 37 36 38 37 '#address-cells': ··· 43 44 maxItems: 1 44 45 45 46 interrupts: 46 - maxItems: 41 47 + minItems: 41 48 + items: 49 + - description: NMI interrupt 50 + - description: IRQ0 interrupt 51 + - description: IRQ1 interrupt 52 + - description: IRQ2 interrupt 53 + - description: IRQ3 interrupt 54 + - description: IRQ4 interrupt 55 + - description: IRQ5 interrupt 56 + - description: IRQ6 interrupt 57 + - description: IRQ7 interrupt 58 + - description: GPIO interrupt, TINT0 59 + - description: GPIO interrupt, TINT1 60 + - description: GPIO interrupt, TINT2 61 + - description: GPIO interrupt, TINT3 62 + - description: GPIO interrupt, TINT4 63 + - description: GPIO interrupt, TINT5 64 + - description: GPIO interrupt, TINT6 65 + - description: GPIO interrupt, TINT7 66 + - description: GPIO interrupt, TINT8 67 + - description: GPIO interrupt, TINT9 68 + - description: GPIO interrupt, TINT10 69 + - description: GPIO interrupt, TINT11 70 + - description: GPIO interrupt, TINT12 71 + - description: GPIO interrupt, TINT13 72 + - description: GPIO interrupt, TINT14 73 + - description: GPIO interrupt, TINT15 74 + - description: GPIO interrupt, TINT16 75 + - description: GPIO interrupt, TINT17 76 + - description: GPIO interrupt, TINT18 77 + - description: GPIO interrupt, TINT19 78 + - description: GPIO interrupt, TINT20 79 + - description: GPIO interrupt, TINT21 80 + - description: GPIO interrupt, TINT22 81 + - description: GPIO interrupt, TINT23 82 + - description: GPIO interrupt, TINT24 83 + - description: GPIO interrupt, TINT25 84 + - description: GPIO interrupt, TINT26 85 + - description: GPIO interrupt, TINT27 86 + - description: GPIO interrupt, TINT28 87 + - description: GPIO interrupt, TINT29 88 + - description: GPIO interrupt, TINT30 89 + - description: GPIO interrupt, TINT31 90 + - description: Bus error interrupt 91 + 92 + interrupt-names: 93 + minItems: 41 94 + items: 95 + - const: nmi 96 + - const: irq0 97 + - const: irq1 98 + - const: irq2 99 + - const: irq3 100 + - const: irq4 101 + - const: irq5 102 + - const: irq6 103 + - const: irq7 104 + - const: tint0 105 + - const: tint1 106 + - const: tint2 107 + - const: tint3 108 + - const: tint4 109 + - const: tint5 110 + - const: tint6 111 + - const: tint7 112 + - const: tint8 113 + - const: tint9 114 + - const: tint10 115 + - const: tint11 116 + - const: tint12 117 + - const: tint13 118 + - const: tint14 119 + - const: tint15 120 + - const: tint16 121 + - const: tint17 122 + - const: tint18 123 + - const: tint19 124 + - const: tint20 125 + - const: tint21 126 + - const: tint22 127 + - const: tint23 128 + - const: tint24 129 + - const: tint25 130 + - const: tint26 131 + - const: tint27 132 + - const: tint28 133 + - const: tint29 134 + - const: tint30 135 + - const: tint31 136 + - const: bus-err 47 137 48 138 clocks: 49 139 maxItems: 2 ··· 160 72 - power-domains 161 73 - resets 162 74 75 + allOf: 76 + - $ref: /schemas/interrupt-controller.yaml# 77 + 78 + - if: 79 + properties: 80 + compatible: 81 + contains: 82 + const: renesas,r9a07g043u-irqc 83 + then: 84 + properties: 85 + interrupts: 86 + minItems: 42 87 + interrupt-names: 88 + minItems: 42 89 + required: 90 + - interrupt-names 91 + 163 92 unevaluatedProperties: false 164 93 165 94 examples: ··· 185 80 #include <dt-bindings/clock/r9a07g044-cpg.h> 186 81 187 82 irqc: interrupt-controller@110a0000 { 188 - compatible = "renesas,r9a07g044-irqc", "renesas,rzg2l-irqc"; 189 - reg = <0x110a0000 0x10000>; 190 - #interrupt-cells = <2>; 191 - #address-cells = <0>; 192 - interrupt-controller; 193 - interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, 194 - <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, 195 - <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, 196 - <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, 197 - <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, 198 - <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>, 199 - <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>, 200 - <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, 201 - <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, 202 - <GIC_SPI 444 IRQ_TYPE_LEVEL_HIGH>, 203 - <GIC_SPI 445 IRQ_TYPE_LEVEL_HIGH>, 204 - <GIC_SPI 446 IRQ_TYPE_LEVEL_HIGH>, 205 - <GIC_SPI 447 IRQ_TYPE_LEVEL_HIGH>, 206 - <GIC_SPI 448 IRQ_TYPE_LEVEL_HIGH>, 207 - <GIC_SPI 449 IRQ_TYPE_LEVEL_HIGH>, 208 - <GIC_SPI 450 IRQ_TYPE_LEVEL_HIGH>, 209 - <GIC_SPI 451 IRQ_TYPE_LEVEL_HIGH>, 210 - <GIC_SPI 452 IRQ_TYPE_LEVEL_HIGH>, 211 - <GIC_SPI 453 IRQ_TYPE_LEVEL_HIGH>, 212 - <GIC_SPI 454 IRQ_TYPE_LEVEL_HIGH>, 213 - <GIC_SPI 455 IRQ_TYPE_LEVEL_HIGH>, 214 - <GIC_SPI 456 IRQ_TYPE_LEVEL_HIGH>, 215 - <GIC_SPI 457 IRQ_TYPE_LEVEL_HIGH>, 216 - <GIC_SPI 458 IRQ_TYPE_LEVEL_HIGH>, 217 - <GIC_SPI 459 IRQ_TYPE_LEVEL_HIGH>, 218 - <GIC_SPI 460 IRQ_TYPE_LEVEL_HIGH>, 219 - <GIC_SPI 461 IRQ_TYPE_LEVEL_HIGH>, 220 - <GIC_SPI 462 IRQ_TYPE_LEVEL_HIGH>, 221 - <GIC_SPI 463 IRQ_TYPE_LEVEL_HIGH>, 222 - <GIC_SPI 464 IRQ_TYPE_LEVEL_HIGH>, 223 - <GIC_SPI 465 IRQ_TYPE_LEVEL_HIGH>, 224 - <GIC_SPI 466 IRQ_TYPE_LEVEL_HIGH>, 225 - <GIC_SPI 467 IRQ_TYPE_LEVEL_HIGH>, 226 - <GIC_SPI 468 IRQ_TYPE_LEVEL_HIGH>, 227 - <GIC_SPI 469 IRQ_TYPE_LEVEL_HIGH>, 228 - <GIC_SPI 470 IRQ_TYPE_LEVEL_HIGH>, 229 - <GIC_SPI 471 IRQ_TYPE_LEVEL_HIGH>, 230 - <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>, 231 - <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>, 232 - <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>, 233 - <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>; 234 - clocks = <&cpg CPG_MOD R9A07G044_IA55_CLK>, 235 - <&cpg CPG_MOD R9A07G044_IA55_PCLK>; 236 - clock-names = "clk", "pclk"; 237 - power-domains = <&cpg>; 238 - resets = <&cpg R9A07G044_IA55_RESETN>; 83 + compatible = "renesas,r9a07g044-irqc", "renesas,rzg2l-irqc"; 84 + reg = <0x110a0000 0x10000>; 85 + #interrupt-cells = <2>; 86 + #address-cells = <0>; 87 + interrupt-controller; 88 + interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, 89 + <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>, 90 + <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>, 91 + <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>, 92 + <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>, 93 + <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>, 94 + <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>, 95 + <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>, 96 + <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>, 97 + <GIC_SPI 444 IRQ_TYPE_LEVEL_HIGH>, 98 + <GIC_SPI 445 IRQ_TYPE_LEVEL_HIGH>, 99 + <GIC_SPI 446 IRQ_TYPE_LEVEL_HIGH>, 100 + <GIC_SPI 447 IRQ_TYPE_LEVEL_HIGH>, 101 + <GIC_SPI 448 IRQ_TYPE_LEVEL_HIGH>, 102 + <GIC_SPI 449 IRQ_TYPE_LEVEL_HIGH>, 103 + <GIC_SPI 450 IRQ_TYPE_LEVEL_HIGH>, 104 + <GIC_SPI 451 IRQ_TYPE_LEVEL_HIGH>, 105 + <GIC_SPI 452 IRQ_TYPE_LEVEL_HIGH>, 106 + <GIC_SPI 453 IRQ_TYPE_LEVEL_HIGH>, 107 + <GIC_SPI 454 IRQ_TYPE_LEVEL_HIGH>, 108 + <GIC_SPI 455 IRQ_TYPE_LEVEL_HIGH>, 109 + <GIC_SPI 456 IRQ_TYPE_LEVEL_HIGH>, 110 + <GIC_SPI 457 IRQ_TYPE_LEVEL_HIGH>, 111 + <GIC_SPI 458 IRQ_TYPE_LEVEL_HIGH>, 112 + <GIC_SPI 459 IRQ_TYPE_LEVEL_HIGH>, 113 + <GIC_SPI 460 IRQ_TYPE_LEVEL_HIGH>, 114 + <GIC_SPI 461 IRQ_TYPE_LEVEL_HIGH>, 115 + <GIC_SPI 462 IRQ_TYPE_LEVEL_HIGH>, 116 + <GIC_SPI 463 IRQ_TYPE_LEVEL_HIGH>, 117 + <GIC_SPI 464 IRQ_TYPE_LEVEL_HIGH>, 118 + <GIC_SPI 465 IRQ_TYPE_LEVEL_HIGH>, 119 + <GIC_SPI 466 IRQ_TYPE_LEVEL_HIGH>, 120 + <GIC_SPI 467 IRQ_TYPE_LEVEL_HIGH>, 121 + <GIC_SPI 468 IRQ_TYPE_LEVEL_HIGH>, 122 + <GIC_SPI 469 IRQ_TYPE_LEVEL_HIGH>, 123 + <GIC_SPI 470 IRQ_TYPE_LEVEL_HIGH>, 124 + <GIC_SPI 471 IRQ_TYPE_LEVEL_HIGH>, 125 + <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>, 126 + <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>, 127 + <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>, 128 + <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>; 129 + interrupt-names = "nmi", 130 + "irq0", "irq1", "irq2", "irq3", 131 + "irq4", "irq5", "irq6", "irq7", 132 + "tint0", "tint1", "tint2", "tint3", 133 + "tint4", "tint5", "tint6", "tint7", 134 + "tint8", "tint9", "tint10", "tint11", 135 + "tint12", "tint13", "tint14", "tint15", 136 + "tint16", "tint17", "tint18", "tint19", 137 + "tint20", "tint21", "tint22", "tint23", 138 + "tint24", "tint25", "tint26", "tint27", 139 + "tint28", "tint29", "tint30", "tint31"; 140 + clocks = <&cpg CPG_MOD R9A07G044_IA55_CLK>, 141 + <&cpg CPG_MOD R9A07G044_IA55_PCLK>; 142 + clock-names = "clk", "pclk"; 143 + power-domains = <&cpg>; 144 + resets = <&cpg R9A07G044_IA55_RESETN>; 239 145 };
+1
Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml
··· 54 54 55 55 port: 56 56 $ref: /schemas/graph.yaml#/$defs/port-base 57 + unevaluatedProperties: false 57 58 58 59 properties: 59 60 endpoint:
+2
Documentation/devicetree/bindings/media/i2c/toshiba,tc358746.yaml
··· 69 69 properties: 70 70 port@0: 71 71 $ref: /schemas/graph.yaml#/$defs/port-base 72 + unevaluatedProperties: false 72 73 description: Input port 73 74 74 75 properties: ··· 90 89 91 90 port@1: 92 91 $ref: /schemas/graph.yaml#/$defs/port-base 92 + unevaluatedProperties: false 93 93 description: Output port 94 94 95 95 properties:
-1
Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml
··· 59 59 compatible: 60 60 contains: 61 61 enum: 62 - - fsl,imx8mq-csi 63 62 - fsl,imx8mm-csi 64 63 then: 65 64 required:
+2 -2
Documentation/devicetree/bindings/media/renesas,vin.yaml
··· 95 95 synchronization is selected. 96 96 default: 1 97 97 98 - field-active-even: true 98 + field-even-active: true 99 99 100 100 bus-width: true 101 101 ··· 144 144 synchronization is selected. 145 145 default: 1 146 146 147 - field-active-even: true 147 + field-even-active: true 148 148 149 149 bus-width: true 150 150
+1
Documentation/devicetree/bindings/media/samsung,fimc.yaml
··· 57 57 patternProperties: 58 58 "^port@[01]$": 59 59 $ref: /schemas/graph.yaml#/$defs/port-base 60 + unevaluatedProperties: false 60 61 description: 61 62 Camera A and camera B inputs. 62 63
+62 -73
Documentation/devicetree/bindings/pci/brcm,iproc-pcie.yaml
··· 12 12 13 13 allOf: 14 14 - $ref: /schemas/pci/pci-bus.yaml# 15 - - $ref: /schemas/interrupt-controller/msi-controller.yaml# 16 15 17 16 properties: 18 17 compatible: ··· 33 34 description: > 34 35 Base address and length of the PCIe controller I/O register space 35 36 36 - interrupt-map: true 37 - 38 - interrupt-map-mask: true 39 - 40 - "#interrupt-cells": 41 - const: 1 42 - 43 37 ranges: 44 38 minItems: 1 45 39 maxItems: 2 ··· 46 54 items: 47 55 - const: pcie-phy 48 56 49 - bus-range: true 50 - 51 57 dma-coherent: true 52 - 53 - "#address-cells": true 54 - 55 - "#size-cells": true 56 - 57 - device_type: true 58 58 59 59 brcm,pcie-ob: 60 60 type: boolean ··· 62 78 63 79 msi: 64 80 type: object 81 + $ref: /schemas/interrupt-controller/msi-controller.yaml# 82 + unevaluatedProperties: false 83 + 65 84 properties: 66 85 compatible: 67 86 items: 68 87 - const: brcm,iproc-msi 69 88 89 + interrupts: 90 + maxItems: 4 91 + 92 + brcm,pcie-msi-inten: 93 + type: boolean 94 + description: 95 + Needs to be present for some older iProc platforms that require the 96 + interrupt enable registers to be set explicitly to enable MSI 97 + 70 98 msi-parent: true 71 - 72 - msi-controller: true 73 - 74 - brcm,pcie-msi-inten: 75 - type: boolean 76 - description: > 77 - Needs to be present for some older iProc platforms that require the 78 - interrupt enable registers to be set explicitly to enable MSI 79 99 80 100 dependencies: 81 101 brcm,pcie-ob-axi-offset: ["brcm,pcie-ob"] ··· 105 117 106 118 examples: 107 119 - | 108 - #include <dt-bindings/interrupt-controller/arm-gic.h> 120 + #include <dt-bindings/interrupt-controller/arm-gic.h> 109 121 110 - bus { 111 - #address-cells = <1>; 112 - #size-cells = <1>; 113 - pcie0: pcie@18012000 { 114 - compatible = "brcm,iproc-pcie"; 115 - reg = <0x18012000 0x1000>; 122 + gic: interrupt-controller { 123 + interrupt-controller; 124 + #interrupt-cells = <3>; 125 + }; 116 126 117 - #interrupt-cells = <1>; 118 - interrupt-map-mask = <0 0 0 0>; 119 - interrupt-map = <0 0 0 0 &gic GIC_SPI 100 IRQ_TYPE_NONE>; 127 + pcie@18012000 { 128 + compatible = "brcm,iproc-pcie"; 129 + reg = <0x18012000 0x1000>; 120 130 121 - linux,pci-domain = <0>; 131 + #interrupt-cells = <1>; 132 + interrupt-map-mask = <0 0 0 0>; 133 + interrupt-map = <0 0 0 0 &gic GIC_SPI 100 IRQ_TYPE_NONE>; 122 134 123 - bus-range = <0x00 0xff>; 135 + linux,pci-domain = <0>; 124 136 125 - #address-cells = <3>; 126 - #size-cells = <2>; 127 - device_type = "pci"; 128 - ranges = <0x81000000 0 0 0x28000000 0 0x00010000>, 129 - <0x82000000 0 0x20000000 0x20000000 0 0x04000000>; 137 + bus-range = <0x00 0xff>; 130 138 131 - phys = <&phy 0 5>; 132 - phy-names = "pcie-phy"; 139 + #address-cells = <3>; 140 + #size-cells = <2>; 141 + device_type = "pci"; 142 + ranges = <0x81000000 0 0 0x28000000 0 0x00010000>, 143 + <0x82000000 0 0x20000000 0x20000000 0 0x04000000>; 133 144 134 - brcm,pcie-ob; 135 - brcm,pcie-ob-axi-offset = <0x00000000>; 145 + phys = <&phy 0 5>; 146 + phy-names = "pcie-phy"; 136 147 137 - msi-parent = <&msi0>; 148 + brcm,pcie-ob; 149 + brcm,pcie-ob-axi-offset = <0x00000000>; 138 150 139 - /* iProc event queue based MSI */ 140 - msi0: msi { 141 - compatible = "brcm,iproc-msi"; 142 - msi-controller; 143 - interrupt-parent = <&gic>; 144 - interrupts = <GIC_SPI 96 IRQ_TYPE_NONE>, 145 - <GIC_SPI 97 IRQ_TYPE_NONE>, 146 - <GIC_SPI 98 IRQ_TYPE_NONE>, 147 - <GIC_SPI 99 IRQ_TYPE_NONE>; 148 - }; 149 - }; 151 + msi-parent = <&msi0>; 150 152 151 - pcie1: pcie@18013000 { 152 - compatible = "brcm,iproc-pcie"; 153 - reg = <0x18013000 0x1000>; 153 + /* iProc event queue based MSI */ 154 + msi0: msi { 155 + compatible = "brcm,iproc-msi"; 156 + msi-controller; 157 + interrupt-parent = <&gic>; 158 + interrupts = <GIC_SPI 96 IRQ_TYPE_NONE>, 159 + <GIC_SPI 97 IRQ_TYPE_NONE>, 160 + <GIC_SPI 98 IRQ_TYPE_NONE>, 161 + <GIC_SPI 99 IRQ_TYPE_NONE>; 162 + }; 163 + }; 164 + - | 165 + pcie@18013000 { 166 + compatible = "brcm,iproc-pcie"; 167 + reg = <0x18013000 0x1000>; 154 168 155 - #interrupt-cells = <1>; 156 - interrupt-map-mask = <0 0 0 0>; 157 - interrupt-map = <0 0 0 0 &gic GIC_SPI 106 IRQ_TYPE_NONE>; 169 + #interrupt-cells = <1>; 170 + interrupt-map-mask = <0 0 0 0>; 171 + interrupt-map = <0 0 0 0 &gic GIC_SPI 106 IRQ_TYPE_NONE>; 158 172 159 - linux,pci-domain = <1>; 173 + linux,pci-domain = <1>; 160 174 161 - bus-range = <0x00 0xff>; 175 + bus-range = <0x00 0xff>; 162 176 163 - #address-cells = <3>; 164 - #size-cells = <2>; 165 - device_type = "pci"; 166 - ranges = <0x81000000 0 0 0x48000000 0 0x00010000>, 167 - <0x82000000 0 0x40000000 0x40000000 0 0x04000000>; 177 + #address-cells = <3>; 178 + #size-cells = <2>; 179 + device_type = "pci"; 180 + ranges = <0x81000000 0 0 0x48000000 0 0x00010000>, 181 + <0x82000000 0 0x40000000 0x40000000 0 0x04000000>; 168 182 169 - phys = <&phy 1 6>; 170 - phy-names = "pcie-phy"; 171 - }; 183 + phys = <&phy 1 6>; 184 + phy-names = "pcie-phy"; 172 185 };
+1
Documentation/devicetree/bindings/riscv/cpus.yaml
··· 91 91 92 92 interrupt-controller: 93 93 type: object 94 + additionalProperties: false 94 95 description: Describes the CPU's local interrupt controller 95 96 96 97 properties:
+3
Documentation/devicetree/bindings/sound/fsl,micfil.yaml
··· 56 56 - const: clkext3 57 57 minItems: 2 58 58 59 + "#sound-dai-cells": 60 + const: 0 61 + 59 62 required: 60 63 - compatible 61 64 - reg
+1
Documentation/devicetree/bindings/sound/rockchip-spdif.yaml
··· 26 26 - const: rockchip,rk3568-spdif 27 27 - items: 28 28 - enum: 29 + - rockchip,rk3128-spdif 29 30 - rockchip,rk3188-spdif 30 31 - rockchip,rk3288-spdif 31 32 - rockchip,rk3308-spdif
+1 -1
Documentation/devicetree/bindings/trivial-devices.yaml
··· 232 232 # MEMSIC magnetometer 233 233 - memsic,mmc35240 234 234 # MEMSIC 3-axis accelerometer 235 - - memsic,mx4005 235 + - memsic,mxc4005 236 236 # MEMSIC 2-axis 8-bit digital accelerometer 237 237 - memsic,mxc6225 238 238 # MEMSIC 2-axis 8-bit digital accelerometer
+37 -3
Documentation/filesystems/erofs.rst
··· 58 58 59 59 - Support extended attributes as an option; 60 60 61 + - Support a bloom filter that speeds up negative extended attribute lookups; 62 + 61 63 - Support POSIX.1e ACLs by using extended attributes; 62 64 63 65 - Support transparent data compression as an option: 64 - LZ4 and MicroLZMA algorithms can be used on a per-file basis; In addition, 65 - inplace decompression is also supported to avoid bounce compressed buffers 66 - and page cache thrashing. 66 + LZ4, MicroLZMA and DEFLATE algorithms can be used on a per-file basis; In 67 + addition, inplace decompression is also supported to avoid bounce compressed 68 + buffers and unnecessary page cache thrashing. 67 69 68 70 - Support chunk-based data deduplication and rolling-hash compressed data 69 71 deduplication; ··· 269 267 details.) 270 268 271 269 By the way, chunk-based files are all uncompressed for now. 270 + 271 + Long extended attribute name prefixes 272 + ------------------------------------- 273 + There are use cases where extended attributes with different values can have 274 + only a few common prefixes (such as overlayfs xattrs). The predefined prefixes 275 + work inefficiently in both image size and runtime performance in such cases. 276 + 277 + The long xattr name prefixes feature is introduced to address this issue. The 278 + overall idea is that, apart from the existing predefined prefixes, the xattr 279 + entry could also refer to user-specified long xattr name prefixes, e.g. 280 + "trusted.overlay.". 281 + 282 + When referring to a long xattr name prefix, the highest bit (bit 7) of 283 + erofs_xattr_entry.e_name_index is set, while the lower bits (bit 0-6) as a whole 284 + represent the index of the referred long name prefix among all long name 285 + prefixes. Therefore, only the trailing part of the name apart from the long 286 + xattr name prefix is stored in erofs_xattr_entry.e_name, which could be empty if 287 + the full xattr name matches exactly as its long xattr name prefix. 288 + 289 + All long xattr prefixes are stored one by one in the packed inode as long as 290 + the packed inode is valid, or in the meta inode otherwise. The 291 + xattr_prefix_count (of the on-disk superblock) indicates the total number of 292 + long xattr name prefixes, while (xattr_prefix_start * 4) indicates the start 293 + offset of long name prefixes in the packed/meta inode. Note that, long extended 294 + attribute name prefixes are disabled if xattr_prefix_count is 0. 295 + 296 + Each long name prefix is stored in the format: ALIGN({__le16 len, data}, 4), 297 + where len represents the total size of the data part. The data part is actually 298 + represented by 'struct erofs_xattr_long_prefix', where base_index represents the 299 + index of the predefined xattr name prefix, e.g. EROFS_XATTR_INDEX_TRUSTED for 300 + "trusted.overlay." long name prefix, while the infix string keeps the string 301 + after stripping the short prefix, e.g. "overlay." for the example above. 272 302 273 303 Data compression 274 304 ----------------
+24 -22
MAINTAINERS
··· 1583 1583 F: arch/arm64/include/asm/arch_timer.h 1584 1584 F: drivers/clocksource/arm_arch_timer.c 1585 1585 1586 + ARM GENERIC INTERRUPT CONTROLLER DRIVERS 1587 + M: Marc Zyngier <maz@kernel.org> 1588 + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1589 + S: Maintained 1590 + F: Documentation/devicetree/bindings/interrupt-controller/arm,gic* 1591 + F: arch/arm/include/asm/arch_gicv3.h 1592 + F: arch/arm64/include/asm/arch_gicv3.h 1593 + F: drivers/irqchip/irq-gic*.[ch] 1594 + F: include/linux/irqchip/arm-gic*.h 1595 + F: include/linux/irqchip/arm-vgic-info.h 1596 + 1586 1597 ARM HDLCD DRM DRIVER 1587 1598 M: Liviu Dudau <liviu.dudau@arm.com> 1588 1599 S: Supported ··· 2220 2209 ARM/INTEL IXP4XX ARM ARCHITECTURE 2221 2210 M: Linus Walleij <linusw@kernel.org> 2222 2211 M: Imre Kaloz <kaloz@openwrt.org> 2223 - M: Krzysztof Halasa <khalasa@piap.pl> 2224 2212 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 2225 2213 S: Maintained 2226 2214 F: Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml 2227 2215 F: Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt 2228 2216 F: Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml 2229 2217 F: Documentation/devicetree/bindings/memory-controllers/intel,ixp4xx-expansion* 2218 + F: Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml 2230 2219 F: Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml 2231 2220 F: arch/arm/boot/dts/intel/ixp/ 2232 2221 F: arch/arm/mach-ixp4xx/ 2233 2222 F: drivers/bus/intel-ixp4xx-eb.c 2223 + F: drivers/char/hw_random/ixp4xx-rng.c 2234 2224 F: drivers/clocksource/timer-ixp4xx.c 2235 2225 F: drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c 2236 2226 F: drivers/gpio/gpio-ixp4xx.c 2237 2227 F: drivers/irqchip/irq-ixp4xx.c 2228 + F: drivers/net/ethernet/xscale/ixp4xx_eth.c 2229 + F: drivers/net/wan/ixp4xx_hss.c 2230 + F: drivers/soc/ixp4xx/ixp4xx-npe.c 2231 + F: drivers/soc/ixp4xx/ixp4xx-qmgr.c 2232 + F: include/linux/soc/ixp4xx/npe.h 2233 + F: include/linux/soc/ixp4xx/qmgr.h 2238 2234 2239 2235 ARM/INTEL KEEMBAY ARCHITECTURE 2240 2236 M: Paul J. Murphy <paul.j.murphy@intel.com> ··· 2343 2325 2344 2326 ARM/Mediatek SoC support 2345 2327 M: Matthias Brugger <matthias.bgg@gmail.com> 2346 - R: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 2328 + M: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 2347 2329 L: linux-kernel@vger.kernel.org 2348 2330 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 2349 2331 L: linux-mediatek@lists.infradead.org (moderated for non-subscribers) ··· 5995 5977 DEVICE-MAPPER (LVM) 5996 5978 M: Alasdair Kergon <agk@redhat.com> 5997 5979 M: Mike Snitzer <snitzer@kernel.org> 5998 - M: dm-devel@redhat.com 5999 - L: dm-devel@redhat.com 5980 + M: dm-devel@lists.linux.dev 5981 + L: dm-devel@lists.linux.dev 6000 5982 S: Maintained 6001 5983 W: http://sources.redhat.com/dm 6002 5984 Q: http://patchwork.kernel.org/project/dm-devel/list/ ··· 10641 10623 S: Maintained 10642 10624 F: drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c 10643 10625 10644 - INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT 10645 - M: Krzysztof Halasa <khalasa@piap.pl> 10646 - S: Maintained 10647 - F: drivers/net/ethernet/xscale/ixp4xx_eth.c 10648 - F: drivers/net/wan/ixp4xx_hss.c 10649 - F: drivers/soc/ixp4xx/ixp4xx-npe.c 10650 - F: drivers/soc/ixp4xx/ixp4xx-qmgr.c 10651 - F: include/linux/soc/ixp4xx/npe.h 10652 - F: include/linux/soc/ixp4xx/qmgr.h 10653 - 10654 - INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT 10655 - M: Deepak Saxena <dsaxena@plexity.net> 10656 - S: Maintained 10657 - F: Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml 10658 - F: drivers/char/hw_random/ixp4xx-rng.c 10659 - 10660 10626 INTEL KEEM BAY DRM DRIVER 10661 10627 M: Anitha Chrisanthus <anitha.chrisanthus@intel.com> 10662 10628 M: Edmund Dea <edmund.j.dea@intel.com> ··· 11066 11064 F: sound/soc/codecs/sma* 11067 11065 11068 11066 IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY) 11069 - M: Marc Zyngier <maz@kernel.org> 11067 + M: Thomas Gleixner <tglx@linutronix.de> 11070 11068 S: Maintained 11071 11069 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core 11072 11070 F: Documentation/core-api/irq/irq-domain.rst ··· 11085 11083 11086 11084 IRQCHIP DRIVERS 11087 11085 M: Thomas Gleixner <tglx@linutronix.de> 11088 - M: Marc Zyngier <maz@kernel.org> 11089 11086 L: linux-kernel@vger.kernel.org 11090 11087 S: Maintained 11091 11088 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core ··· 20490 20489 STARFIVE JH71X0 PINCTRL DRIVERS 20491 20490 M: Emil Renner Berthing <kernel@esmil.dk> 20492 20491 M: Jianlong Huang <jianlong.huang@starfivetech.com> 20492 + M: Hal Feng <hal.feng@starfivetech.com> 20493 20493 L: linux-gpio@vger.kernel.org 20494 20494 S: Maintained 20495 20495 F: Documentation/devicetree/bindings/pinctrl/starfive,jh71*.yaml
+1 -1
Makefile
··· 2 2 VERSION = 6 3 3 PATCHLEVEL = 6 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc4 5 + EXTRAVERSION = -rc5 6 6 NAME = Hurr durr I'ma ninja sloth 7 7 8 8 # *DOCUMENTATION*
+13
arch/arm64/Kconfig
··· 1037 1037 1038 1038 If unsure, say Y. 1039 1039 1040 + config ARM64_ERRATUM_2966298 1041 + bool "Cortex-A520: 2966298: workaround for speculatively executed unprivileged load" 1042 + default y 1043 + help 1044 + This option adds the workaround for ARM Cortex-A520 erratum 2966298. 1045 + 1046 + On an affected Cortex-A520 core, a speculatively executed unprivileged 1047 + load might leak data from a privileged level via a cache side channel. 1048 + 1049 + Work around this problem by executing a TLBI before returning to EL0. 1050 + 1051 + If unsure, say Y. 1052 + 1040 1053 config CAVIUM_ERRATUM_22375 1041 1054 bool "Cavium erratum 22375, 24313" 1042 1055 default y
+3 -1
arch/arm64/boot/dts/freescale/imx93.dtsi
··· 185 185 #size-cells = <1>; 186 186 ranges; 187 187 188 - anomix_ns_gpr: syscon@44210000 { 188 + aonmix_ns_gpr: syscon@44210000 { 189 189 compatible = "fsl,imx93-aonmix-ns-syscfg", "syscon"; 190 190 reg = <0x44210000 0x1000>; 191 191 }; ··· 319 319 assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1_DIV2>; 320 320 assigned-clock-rates = <40000000>; 321 321 fsl,clk-source = /bits/ 8 <0>; 322 + fsl,stop-mode = <&aonmix_ns_gpr 0x14 0>; 322 323 status = "disabled"; 323 324 }; 324 325 ··· 592 591 assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1_DIV2>; 593 592 assigned-clock-rates = <40000000>; 594 593 fsl,clk-source = /bits/ 8 <0>; 594 + fsl,stop-mode = <&wakeupmix_gpr 0x0c 2>; 595 595 status = "disabled"; 596 596 }; 597 597
+1 -1
arch/arm64/boot/dts/mediatek/mt7622.dtsi
··· 905 905 status = "disabled"; 906 906 }; 907 907 908 - sata_phy: t-phy@1a243000 { 908 + sata_phy: t-phy { 909 909 compatible = "mediatek,mt7622-tphy", 910 910 "mediatek,generic-tphy-v1"; 911 911 #address-cells = <2>;
+1 -1
arch/arm64/boot/dts/mediatek/mt7986a.dtsi
··· 434 434 }; 435 435 }; 436 436 437 - pcie_phy: t-phy@11c00000 { 437 + pcie_phy: t-phy { 438 438 compatible = "mediatek,mt7986-tphy", 439 439 "mediatek,generic-tphy-v2"; 440 440 #address-cells = <2>;
+31 -8
arch/arm64/boot/dts/mediatek/mt8195-demo.dts
··· 48 48 49 49 memory@40000000 { 50 50 device_type = "memory"; 51 - reg = <0 0x40000000 0 0x80000000>; 51 + reg = <0 0x40000000 0x2 0x00000000>; 52 52 }; 53 53 54 54 reserved-memory { ··· 56 56 #size-cells = <2>; 57 57 ranges; 58 58 59 - /* 2 MiB reserved for ARM Trusted Firmware (BL31) */ 60 - bl31_secmon_reserved: secmon@54600000 { 61 - no-map; 62 - reg = <0 0x54600000 0x0 0x200000>; 63 - }; 64 - 65 - /* 12 MiB reserved for OP-TEE (BL32) 59 + /* 60 + * 12 MiB reserved for OP-TEE (BL32) 66 61 * +-----------------------+ 0x43e0_0000 67 62 * | SHMEM 2MiB | 68 63 * +-----------------------+ 0x43c0_0000 ··· 69 74 optee_reserved: optee@43200000 { 70 75 no-map; 71 76 reg = <0 0x43200000 0 0x00c00000>; 77 + }; 78 + 79 + scp_mem: memory@50000000 { 80 + compatible = "shared-dma-pool"; 81 + reg = <0 0x50000000 0 0x2900000>; 82 + no-map; 83 + }; 84 + 85 + vpu_mem: memory@53000000 { 86 + compatible = "shared-dma-pool"; 87 + reg = <0 0x53000000 0 0x1400000>; /* 20 MB */ 88 + }; 89 + 90 + /* 2 MiB reserved for ARM Trusted Firmware (BL31) */ 91 + bl31_secmon_mem: memory@54600000 { 92 + no-map; 93 + reg = <0 0x54600000 0x0 0x200000>; 94 + }; 95 + 96 + snd_dma_mem: memory@60000000 { 97 + compatible = "shared-dma-pool"; 98 + reg = <0 0x60000000 0 0x1100000>; 99 + no-map; 100 + }; 101 + 102 + apu_mem: memory@62000000 { 103 + compatible = "shared-dma-pool"; 104 + reg = <0 0x62000000 0 0x1400000>; /* 20 MB */ 72 105 }; 73 106 }; 74 107 };
+1
arch/arm64/boot/dts/mediatek/mt8195.dtsi
··· 313 313 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH 0>; 314 314 cpus = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>, 315 315 <&cpu4>, <&cpu5>, <&cpu6>, <&cpu7>; 316 + status = "fail"; 316 317 }; 317 318 318 319 dmic_codec: dmic-codec {
+1 -1
arch/arm64/boot/dts/qcom/sm8150.dtsi
··· 3958 3958 3959 3959 pdc: interrupt-controller@b220000 { 3960 3960 compatible = "qcom,sm8150-pdc", "qcom,pdc"; 3961 - reg = <0 0x0b220000 0 0x400>; 3961 + reg = <0 0x0b220000 0 0x30000>; 3962 3962 qcom,pdc-ranges = <0 480 94>, <94 609 31>, 3963 3963 <125 63 1>; 3964 3964 #interrupt-cells = <2>;
+19
arch/arm64/include/asm/acpi.h
··· 9 9 #ifndef _ASM_ACPI_H 10 10 #define _ASM_ACPI_H 11 11 12 + #include <linux/cpuidle.h> 12 13 #include <linux/efi.h> 13 14 #include <linux/memblock.h> 14 15 #include <linux/psci.h> ··· 45 44 46 45 #define ACPI_MADT_GICC_TRBE (offsetof(struct acpi_madt_generic_interrupt, \ 47 46 trbe_interrupt) + sizeof(u16)) 47 + /* 48 + * Arm® Functional Fixed Hardware Specification Version 1.2. 49 + * Table 2: Arm Architecture context loss flags 50 + */ 51 + #define CPUIDLE_CORE_CTXT BIT(0) /* Core context Lost */ 52 + 53 + static inline unsigned int arch_get_idle_state_flags(u32 arch_flags) 54 + { 55 + if (arch_flags & CPUIDLE_CORE_CTXT) 56 + return CPUIDLE_FLAG_TIMER_STOP; 57 + 58 + return 0; 59 + } 60 + #define arch_get_idle_state_flags arch_get_idle_state_flags 61 + 62 + #define CPUIDLE_TRACE_CTXT BIT(1) /* Trace context loss */ 63 + #define CPUIDLE_GICR_CTXT BIT(2) /* GICR */ 64 + #define CPUIDLE_GICD_CTXT BIT(3) /* GICD */ 48 65 49 66 /* Basic configuration for ACPI */ 50 67 #ifdef CONFIG_ACPI
+2
arch/arm64/include/asm/cputype.h
··· 79 79 #define ARM_CPU_PART_CORTEX_A78AE 0xD42 80 80 #define ARM_CPU_PART_CORTEX_X1 0xD44 81 81 #define ARM_CPU_PART_CORTEX_A510 0xD46 82 + #define ARM_CPU_PART_CORTEX_A520 0xD80 82 83 #define ARM_CPU_PART_CORTEX_A710 0xD47 83 84 #define ARM_CPU_PART_CORTEX_A715 0xD4D 84 85 #define ARM_CPU_PART_CORTEX_X2 0xD48 ··· 149 148 #define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE) 150 149 #define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1) 151 150 #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510) 151 + #define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520) 152 152 #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) 153 153 #define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715) 154 154 #define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)
+8
arch/arm64/kernel/cpu_errata.c
··· 730 730 .cpu_enable = cpu_clear_bf16_from_user_emulation, 731 731 }, 732 732 #endif 733 + #ifdef CONFIG_ARM64_ERRATUM_2966298 734 + { 735 + .desc = "ARM erratum 2966298", 736 + .capability = ARM64_WORKAROUND_2966298, 737 + /* Cortex-A520 r0p0 - r0p1 */ 738 + ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A520, 0, 0, 1), 739 + }, 740 + #endif 733 741 #ifdef CONFIG_AMPERE_ERRATUM_AC03_CPU_38 734 742 { 735 743 .desc = "AmpereOne erratum AC03_CPU_38",
+4
arch/arm64/kernel/entry.S
··· 428 428 ldp x28, x29, [sp, #16 * 14] 429 429 430 430 .if \el == 0 431 + alternative_if ARM64_WORKAROUND_2966298 432 + tlbi vale1, xzr 433 + dsb nsh 434 + alternative_else_nop_endif 431 435 alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0 432 436 ldr lr, [sp, #S_LR] 433 437 add sp, sp, #PT_REGS_SIZE // restore sp
+1
arch/arm64/tools/cpucaps
··· 84 84 WORKAROUND_2457168 85 85 WORKAROUND_2645198 86 86 WORKAROUND_2658417 87 + WORKAROUND_2966298 87 88 WORKAROUND_AMPERE_AC03_CPU_38 88 89 WORKAROUND_TRBE_OVERWRITE_FILL_MODE 89 90 WORKAROUND_TSB_FLUSH_FAILURE
+20 -17
arch/parisc/include/asm/ldcw.h
··· 2 2 #ifndef __PARISC_LDCW_H 3 3 #define __PARISC_LDCW_H 4 4 5 - #ifndef CONFIG_PA20 6 5 /* Because kmalloc only guarantees 8-byte alignment for kmalloc'd data, 7 6 and GCC only guarantees 8-byte alignment for stack locals, we can't 8 7 be assured of 16-byte alignment for atomic lock data even if we 9 8 specify "__attribute ((aligned(16)))" in the type declaration. So, 10 9 we use a struct containing an array of four ints for the atomic lock 11 10 type and dynamically select the 16-byte aligned int from the array 12 - for the semaphore. */ 11 + for the semaphore. */ 12 + 13 + /* From: "Jim Hull" <jim.hull of hp.com> 14 + I've attached a summary of the change, but basically, for PA 2.0, as 15 + long as the ",CO" (coherent operation) completer is implemented, then the 16 + 16-byte alignment requirement for ldcw and ldcd is relaxed, and instead 17 + they only require "natural" alignment (4-byte for ldcw, 8-byte for 18 + ldcd). 19 + 20 + Although the cache control hint is accepted by all PA 2.0 processors, 21 + it is only implemented on PA8800/PA8900 CPUs. Prior PA8X00 CPUs still 22 + require 16-byte alignment. If the address is unaligned, the operation 23 + of the instruction is undefined. The ldcw instruction does not generate 24 + unaligned data reference traps so misaligned accesses are not detected. 25 + This hid the problem for years. So, restore the 16-byte alignment dropped 26 + by Kyle McMartin in "Remove __ldcw_align for PA-RISC 2.0 processors". */ 13 27 14 28 #define __PA_LDCW_ALIGNMENT 16 15 - #define __PA_LDCW_ALIGN_ORDER 4 16 29 #define __ldcw_align(a) ({ \ 17 30 unsigned long __ret = (unsigned long) &(a)->lock[0]; \ 18 31 __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) \ 19 32 & ~(__PA_LDCW_ALIGNMENT - 1); \ 20 33 (volatile unsigned int *) __ret; \ 21 34 }) 22 - #define __LDCW "ldcw" 23 35 24 - #else /*CONFIG_PA20*/ 25 - /* From: "Jim Hull" <jim.hull of hp.com> 26 - I've attached a summary of the change, but basically, for PA 2.0, as 27 - long as the ",CO" (coherent operation) completer is specified, then the 28 - 16-byte alignment requirement for ldcw and ldcd is relaxed, and instead 29 - they only require "natural" alignment (4-byte for ldcw, 8-byte for 30 - ldcd). */ 31 - 32 - #define __PA_LDCW_ALIGNMENT 4 33 - #define __PA_LDCW_ALIGN_ORDER 2 34 - #define __ldcw_align(a) (&(a)->slock) 36 + #ifdef CONFIG_PA20 35 37 #define __LDCW "ldcw,co" 36 - 37 - #endif /*!CONFIG_PA20*/ 38 + #else 39 + #define __LDCW "ldcw" 40 + #endif 38 41 39 42 /* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. 40 43 We don't explicitly expose that "*a" may be written as reload
-5
arch/parisc/include/asm/spinlock_types.h
··· 9 9 #ifndef __ASSEMBLY__ 10 10 11 11 typedef struct { 12 - #ifdef CONFIG_PA20 13 - volatile unsigned int slock; 14 - # define __ARCH_SPIN_LOCK_UNLOCKED { __ARCH_SPIN_LOCK_UNLOCKED_VAL } 15 - #else 16 12 volatile unsigned int lock[4]; 17 13 # define __ARCH_SPIN_LOCK_UNLOCKED \ 18 14 { { __ARCH_SPIN_LOCK_UNLOCKED_VAL, __ARCH_SPIN_LOCK_UNLOCKED_VAL, \ 19 15 __ARCH_SPIN_LOCK_UNLOCKED_VAL, __ARCH_SPIN_LOCK_UNLOCKED_VAL } } 20 - #endif 21 16 } arch_spinlock_t; 22 17 23 18
+3 -1
arch/parisc/kernel/smp.c
··· 440 440 if (cpu_online(cpu)) 441 441 return 0; 442 442 443 - if (num_online_cpus() < setup_max_cpus && smp_boot_one_cpu(cpu, tidle)) 443 + if (num_online_cpus() < nr_cpu_ids && 444 + num_online_cpus() < setup_max_cpus && 445 + smp_boot_one_cpu(cpu, tidle)) 444 446 return -EIO; 445 447 446 448 return cpu_online(cpu) ? 0 : -EIO;
+12 -6
arch/riscv/net/bpf_jit_comp64.c
··· 245 245 emit_addi(RV_REG_SP, RV_REG_SP, stack_adjust, ctx); 246 246 /* Set return value. */ 247 247 if (!is_tail_call) 248 - emit_mv(RV_REG_A0, RV_REG_A5, ctx); 248 + emit_addiw(RV_REG_A0, RV_REG_A5, 0, ctx); 249 249 emit_jalr(RV_REG_ZERO, is_tail_call ? RV_REG_T3 : RV_REG_RA, 250 250 is_tail_call ? (RV_FENTRY_NINSNS + 1) * 4 : 0, /* skip reserved nops and TCC init */ 251 251 ctx); ··· 759 759 if (ret) 760 760 return ret; 761 761 762 - if (save_ret) 763 - emit_sd(RV_REG_FP, -retval_off, regmap[BPF_REG_0], ctx); 762 + if (save_ret) { 763 + emit_sd(RV_REG_FP, -retval_off, RV_REG_A0, ctx); 764 + emit_sd(RV_REG_FP, -(retval_off - 8), regmap[BPF_REG_0], ctx); 765 + } 764 766 765 767 /* update branch with beqz */ 766 768 if (ctx->insns) { ··· 855 853 856 854 save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET); 857 855 if (save_ret) { 858 - stack_size += 8; 856 + stack_size += 16; /* Save both A5 (BPF R0) and A0 */ 859 857 retval_off = stack_size; 860 858 } 861 859 ··· 959 957 if (ret) 960 958 goto out; 961 959 emit_sd(RV_REG_FP, -retval_off, RV_REG_A0, ctx); 960 + emit_sd(RV_REG_FP, -(retval_off - 8), regmap[BPF_REG_0], ctx); 962 961 im->ip_after_call = ctx->insns + ctx->ninsns; 963 962 /* 2 nops reserved for auipc+jalr pair */ 964 963 emit(rv_nop(), ctx); ··· 991 988 if (flags & BPF_TRAMP_F_RESTORE_REGS) 992 989 restore_args(nregs, args_off, ctx); 993 990 994 - if (save_ret) 991 + if (save_ret) { 995 992 emit_ld(RV_REG_A0, -retval_off, RV_REG_FP, ctx); 993 + emit_ld(regmap[BPF_REG_0], -(retval_off - 8), RV_REG_FP, ctx); 994 + } 996 995 997 996 emit_ld(RV_REG_S1, -sreg_off, RV_REG_FP, ctx); 998 997 ··· 1520 1515 if (ret) 1521 1516 return ret; 1522 1517 1523 - emit_mv(bpf_to_rv_reg(BPF_REG_0, ctx), RV_REG_A0, ctx); 1518 + if (insn->src_reg != BPF_PSEUDO_CALL) 1519 + emit_mv(bpf_to_rv_reg(BPF_REG_0, ctx), RV_REG_A0, ctx); 1524 1520 break; 1525 1521 } 1526 1522 /* tail call */
+20 -5
arch/s390/net/bpf_jit_comp.c
··· 2066 2066 * func_addr's original caller 2067 2067 */ 2068 2068 int stack_size; /* Trampoline stack size */ 2069 + int backchain_off; /* Offset of backchain */ 2069 2070 int stack_args_off; /* Offset of stack arguments for calling 2070 2071 * func_addr, has to be at the top 2071 2072 */ ··· 2087 2086 * for __bpf_prog_enter() return value and 2088 2087 * func_addr respectively 2089 2088 */ 2090 - int r14_off; /* Offset of saved %r14 */ 2091 2089 int run_ctx_off; /* Offset of struct bpf_tramp_run_ctx */ 2092 2090 int tccnt_off; /* Offset of saved tailcall counter */ 2091 + int r14_off; /* Offset of saved %r14, has to be at the 2092 + * bottom */ 2093 2093 int do_fexit; /* do_fexit: label */ 2094 2094 }; 2095 2095 ··· 2249 2247 * Calculate the stack layout. 2250 2248 */ 2251 2249 2252 - /* Reserve STACK_FRAME_OVERHEAD bytes for the callees. */ 2250 + /* 2251 + * Allocate STACK_FRAME_OVERHEAD bytes for the callees. As the s390x 2252 + * ABI requires, put our backchain at the end of the allocated memory. 2253 + */ 2253 2254 tjit->stack_size = STACK_FRAME_OVERHEAD; 2255 + tjit->backchain_off = tjit->stack_size - sizeof(u64); 2254 2256 tjit->stack_args_off = alloc_stack(tjit, nr_stack_args * sizeof(u64)); 2255 2257 tjit->reg_args_off = alloc_stack(tjit, nr_reg_args * sizeof(u64)); 2256 2258 tjit->ip_off = alloc_stack(tjit, sizeof(u64)); ··· 2262 2256 tjit->bpf_args_off = alloc_stack(tjit, nr_bpf_args * sizeof(u64)); 2263 2257 tjit->retval_off = alloc_stack(tjit, sizeof(u64)); 2264 2258 tjit->r7_r8_off = alloc_stack(tjit, 2 * sizeof(u64)); 2265 - tjit->r14_off = alloc_stack(tjit, sizeof(u64)); 2266 2259 tjit->run_ctx_off = alloc_stack(tjit, 2267 2260 sizeof(struct bpf_tramp_run_ctx)); 2268 2261 tjit->tccnt_off = alloc_stack(tjit, sizeof(u64)); 2269 - /* The caller has already reserved STACK_FRAME_OVERHEAD bytes. */ 2270 - tjit->stack_size -= STACK_FRAME_OVERHEAD; 2262 + tjit->r14_off = alloc_stack(tjit, sizeof(u64) * 2); 2263 + /* 2264 + * In accordance with the s390x ABI, the caller has allocated 2265 + * STACK_FRAME_OVERHEAD bytes for us. 8 of them contain the caller's 2266 + * backchain, and the rest we can use. 2267 + */ 2268 + tjit->stack_size -= STACK_FRAME_OVERHEAD - sizeof(u64); 2271 2269 tjit->orig_stack_args_off = tjit->stack_size + STACK_FRAME_OVERHEAD; 2272 2270 2271 + /* lgr %r1,%r15 */ 2272 + EMIT4(0xb9040000, REG_1, REG_15); 2273 2273 /* aghi %r15,-stack_size */ 2274 2274 EMIT4_IMM(0xa70b0000, REG_15, -tjit->stack_size); 2275 + /* stg %r1,backchain_off(%r15) */ 2276 + EMIT6_DISP_LH(0xe3000000, 0x0024, REG_1, REG_0, REG_15, 2277 + tjit->backchain_off); 2275 2278 /* mvc tccnt_off(4,%r15),stack_size+STK_OFF_TCCNT(%r15) */ 2276 2279 _EMIT6(0xd203f000 | tjit->tccnt_off, 2277 2280 0xf000 | (tjit->stack_size + STK_OFF_TCCNT));
+14 -6
arch/x86/hyperv/hv_init.c
··· 7 7 * Author : K. Y. Srinivasan <kys@microsoft.com> 8 8 */ 9 9 10 + #define pr_fmt(fmt) "Hyper-V: " fmt 11 + 10 12 #include <linux/efi.h> 11 13 #include <linux/types.h> 12 14 #include <linux/bitfield.h> ··· 193 191 struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1}; 194 192 195 193 if (!hv_reenlightenment_available()) { 196 - pr_warn("Hyper-V: reenlightenment support is unavailable\n"); 194 + pr_warn("reenlightenment support is unavailable\n"); 197 195 return; 198 196 } 199 197 ··· 396 394 local_irq_restore(flags); 397 395 } 398 396 397 + #if IS_ENABLED(CONFIG_HYPERV_VTL_MODE) 399 398 static u8 __init get_vtl(void) 400 399 { 401 400 u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_REGISTERS; ··· 419 416 if (hv_result_success(ret)) { 420 417 ret = output->as64.low & HV_X64_VTL_MASK; 421 418 } else { 422 - pr_err("Failed to get VTL(%lld) and set VTL to zero by default.\n", ret); 423 - ret = 0; 419 + pr_err("Failed to get VTL(error: %lld) exiting...\n", ret); 420 + BUG(); 424 421 } 425 422 426 423 local_irq_restore(flags); 427 424 return ret; 428 425 } 426 + #else 427 + static inline u8 get_vtl(void) { return 0; } 428 + #endif 429 429 430 430 /* 431 431 * This function is to be invoked early in the boot sequence after the ··· 570 564 if (cpu_feature_enabled(X86_FEATURE_IBT) && 571 565 *(u32 *)hv_hypercall_pg != gen_endbr()) { 572 566 setup_clear_cpu_cap(X86_FEATURE_IBT); 573 - pr_warn("Hyper-V: Disabling IBT because of Hyper-V bug\n"); 567 + pr_warn("Disabling IBT because of Hyper-V bug\n"); 574 568 } 575 569 #endif 576 570 ··· 610 604 hv_query_ext_cap(0); 611 605 612 606 /* Find the VTL */ 613 - if (!ms_hyperv.paravisor_present && hv_isolation_type_snp()) 614 - ms_hyperv.vtl = get_vtl(); 607 + ms_hyperv.vtl = get_vtl(); 608 + 609 + if (ms_hyperv.vtl > 0) /* non default VTL */ 610 + hv_vtl_early_init(); 615 611 616 612 return; 617 613
+1 -2
arch/x86/hyperv/hv_vtl.c
··· 215 215 return hv_vtl_bringup_vcpu(vp_id, start_eip); 216 216 } 217 217 218 - static int __init hv_vtl_early_init(void) 218 + int __init hv_vtl_early_init(void) 219 219 { 220 220 /* 221 221 * `boot_cpu_has` returns the runtime feature support, ··· 230 230 231 231 return 0; 232 232 } 233 - early_initcall(hv_vtl_early_init);
+2
arch/x86/include/asm/mshyperv.h
··· 340 340 341 341 #ifdef CONFIG_HYPERV_VTL_MODE 342 342 void __init hv_vtl_init_platform(void); 343 + int __init hv_vtl_early_init(void); 343 344 #else 344 345 static inline void __init hv_vtl_init_platform(void) {} 346 + static inline int __init hv_vtl_early_init(void) { return 0; } 345 347 #endif 346 348 347 349 #include <asm-generic/mshyperv.h>
+55 -14
arch/x86/kernel/sev-shared.c
··· 256 256 return 0; 257 257 } 258 258 259 - static int sev_cpuid_hv(struct cpuid_leaf *leaf) 259 + static int __sev_cpuid_hv_msr(struct cpuid_leaf *leaf) 260 260 { 261 261 int ret; 262 262 ··· 277 277 ret = ret ? : __sev_cpuid_hv(leaf->fn, GHCB_CPUID_REQ_EDX, &leaf->edx); 278 278 279 279 return ret; 280 + } 281 + 282 + static int __sev_cpuid_hv_ghcb(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf) 283 + { 284 + u32 cr4 = native_read_cr4(); 285 + int ret; 286 + 287 + ghcb_set_rax(ghcb, leaf->fn); 288 + ghcb_set_rcx(ghcb, leaf->subfn); 289 + 290 + if (cr4 & X86_CR4_OSXSAVE) 291 + /* Safe to read xcr0 */ 292 + ghcb_set_xcr0(ghcb, xgetbv(XCR_XFEATURE_ENABLED_MASK)); 293 + else 294 + /* xgetbv will cause #UD - use reset value for xcr0 */ 295 + ghcb_set_xcr0(ghcb, 1); 296 + 297 + ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_CPUID, 0, 0); 298 + if (ret != ES_OK) 299 + return ret; 300 + 301 + if (!(ghcb_rax_is_valid(ghcb) && 302 + ghcb_rbx_is_valid(ghcb) && 303 + ghcb_rcx_is_valid(ghcb) && 304 + ghcb_rdx_is_valid(ghcb))) 305 + return ES_VMM_ERROR; 306 + 307 + leaf->eax = ghcb->save.rax; 308 + leaf->ebx = ghcb->save.rbx; 309 + leaf->ecx = ghcb->save.rcx; 310 + leaf->edx = ghcb->save.rdx; 311 + 312 + return ES_OK; 313 + } 314 + 315 + static int sev_cpuid_hv(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf) 316 + { 317 + return ghcb ? __sev_cpuid_hv_ghcb(ghcb, ctxt, leaf) 318 + : __sev_cpuid_hv_msr(leaf); 280 319 } 281 320 282 321 /* ··· 427 388 return false; 428 389 } 429 390 430 - static void snp_cpuid_hv(struct cpuid_leaf *leaf) 391 + static void snp_cpuid_hv(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf) 431 392 { 432 - if (sev_cpuid_hv(leaf)) 393 + if (sev_cpuid_hv(ghcb, ctxt, leaf)) 433 394 sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_CPUID_HV); 434 395 } 435 396 436 - static int snp_cpuid_postprocess(struct cpuid_leaf *leaf) 397 + static int snp_cpuid_postprocess(struct ghcb *ghcb, struct es_em_ctxt *ctxt, 398 + struct cpuid_leaf *leaf) 437 399 { 438 400 struct cpuid_leaf leaf_hv = *leaf; 439 401 440 402 switch (leaf->fn) { 441 403 case 0x1: 442 - snp_cpuid_hv(&leaf_hv); 404 + snp_cpuid_hv(ghcb, ctxt, &leaf_hv); 443 405 444 406 /* initial APIC ID */ 445 407 leaf->ebx = (leaf_hv.ebx & GENMASK(31, 24)) | (leaf->ebx & GENMASK(23, 0)); ··· 459 419 break; 460 420 case 0xB: 461 421 leaf_hv.subfn = 0; 462 - snp_cpuid_hv(&leaf_hv); 422 + snp_cpuid_hv(ghcb, ctxt, &leaf_hv); 463 423 464 424 /* extended APIC ID */ 465 425 leaf->edx = leaf_hv.edx; ··· 507 467 } 508 468 break; 509 469 case 0x8000001E: 510 - snp_cpuid_hv(&leaf_hv); 470 + snp_cpuid_hv(ghcb, ctxt, &leaf_hv); 511 471 512 472 /* extended APIC ID */ 513 473 leaf->eax = leaf_hv.eax; ··· 528 488 * Returns -EOPNOTSUPP if feature not enabled. Any other non-zero return value 529 489 * should be treated as fatal by caller. 530 490 */ 531 - static int snp_cpuid(struct cpuid_leaf *leaf) 491 + static int snp_cpuid(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf) 532 492 { 533 493 const struct snp_cpuid_table *cpuid_table = snp_cpuid_get_table(); 534 494 ··· 562 522 return 0; 563 523 } 564 524 565 - return snp_cpuid_postprocess(leaf); 525 + return snp_cpuid_postprocess(ghcb, ctxt, leaf); 566 526 } 567 527 568 528 /* ··· 584 544 leaf.fn = fn; 585 545 leaf.subfn = subfn; 586 546 587 - ret = snp_cpuid(&leaf); 547 + ret = snp_cpuid(NULL, NULL, &leaf); 588 548 if (!ret) 589 549 goto cpuid_done; 590 550 591 551 if (ret != -EOPNOTSUPP) 592 552 goto fail; 593 553 594 - if (sev_cpuid_hv(&leaf)) 554 + if (__sev_cpuid_hv_msr(&leaf)) 595 555 goto fail; 596 556 597 557 cpuid_done: ··· 888 848 return ret; 889 849 } 890 850 891 - static int vc_handle_cpuid_snp(struct pt_regs *regs) 851 + static int vc_handle_cpuid_snp(struct ghcb *ghcb, struct es_em_ctxt *ctxt) 892 852 { 853 + struct pt_regs *regs = ctxt->regs; 893 854 struct cpuid_leaf leaf; 894 855 int ret; 895 856 896 857 leaf.fn = regs->ax; 897 858 leaf.subfn = regs->cx; 898 - ret = snp_cpuid(&leaf); 859 + ret = snp_cpuid(ghcb, ctxt, &leaf); 899 860 if (!ret) { 900 861 regs->ax = leaf.eax; 901 862 regs->bx = leaf.ebx; ··· 915 874 enum es_result ret; 916 875 int snp_cpuid_ret; 917 876 918 - snp_cpuid_ret = vc_handle_cpuid_snp(regs); 877 + snp_cpuid_ret = vc_handle_cpuid_snp(ghcb, ctxt); 919 878 if (!snp_cpuid_ret) 920 879 return ES_OK; 921 880 if (snp_cpuid_ret != -EOPNOTSUPP)
+1 -2
arch/x86/kernel/sev.c
··· 868 868 869 869 void snp_accept_memory(phys_addr_t start, phys_addr_t end) 870 870 { 871 - unsigned long vaddr; 872 - unsigned int npages; 871 + unsigned long vaddr, npages; 873 872 874 873 if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP)) 875 874 return;
+1 -2
drivers/acpi/processor_idle.c
··· 1217 1217 strscpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN); 1218 1218 state->exit_latency = lpi->wake_latency; 1219 1219 state->target_residency = lpi->min_residency; 1220 - if (lpi->arch_flags) 1221 - state->flags |= CPUIDLE_FLAG_TIMER_STOP; 1220 + state->flags |= arch_get_idle_state_flags(lpi->arch_flags); 1222 1221 if (i != 0 && lpi->entry_method == ACPI_CSTATE_FFH) 1223 1222 state->flags |= CPUIDLE_FLAG_RCU_IDLE; 1224 1223 state->enter = acpi_idle_lpi_enter;
+2 -12
drivers/ata/pata_parport/fit3.c
··· 9 9 * 10 10 * The TD-2000 and certain older devices use a different protocol. 11 11 * Try the fit2 protocol module with them. 12 - * 13 - * NB: The FIT adapters do not appear to support the control 14 - * registers. So, we map ALT_STATUS to STATUS and NO-OP writes 15 - * to the device control register - this means that IDE reset 16 - * will not work on these devices. 17 12 */ 18 13 19 14 #include <linux/module.h> ··· 32 37 33 38 static void fit3_write_regr(struct pi_adapter *pi, int cont, int regr, int val) 34 39 { 35 - if (cont == 1) 36 - return; 40 + regr += cont << 3; 37 41 38 42 switch (pi->mode) { 39 43 case 0: ··· 53 59 { 54 60 int a, b; 55 61 56 - if (cont) { 57 - if (regr != 6) 58 - return 0xff; 59 - regr = 7; 60 - } 62 + regr += cont << 3; 61 63 62 64 switch (pi->mode) { 63 65 case 0:
+76 -2
drivers/ata/pata_parport/pata_parport.c
··· 51 51 ata_sff_pause(ap); 52 52 } 53 53 54 + static void pata_parport_set_devctl(struct ata_port *ap, u8 ctl) 55 + { 56 + struct pi_adapter *pi = ap->host->private_data; 57 + 58 + pi->proto->write_regr(pi, 1, 6, ctl); 59 + } 60 + 54 61 static bool pata_parport_devchk(struct ata_port *ap, unsigned int device) 55 62 { 56 63 struct pi_adapter *pi = ap->host->private_data; ··· 71 64 pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0xaa); 72 65 pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0x55); 73 66 74 - pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 055); 67 + pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0x55); 75 68 pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0xaa); 76 69 77 70 nsect = pi->proto->read_regr(pi, 0, ATA_REG_NSECT); 78 71 lbal = pi->proto->read_regr(pi, 0, ATA_REG_LBAL); 79 72 80 73 return (nsect == 0x55) && (lbal == 0xaa); 74 + } 75 + 76 + static int pata_parport_wait_after_reset(struct ata_link *link, 77 + unsigned int devmask, 78 + unsigned long deadline) 79 + { 80 + struct ata_port *ap = link->ap; 81 + struct pi_adapter *pi = ap->host->private_data; 82 + unsigned int dev0 = devmask & (1 << 0); 83 + unsigned int dev1 = devmask & (1 << 1); 84 + int rc, ret = 0; 85 + 86 + ata_msleep(ap, ATA_WAIT_AFTER_RESET); 87 + 88 + /* always check readiness of the master device */ 89 + rc = ata_sff_wait_ready(link, deadline); 90 + if (rc) { 91 + /* 92 + * some adapters return bogus values if master device is not 93 + * present, so don't abort now if a slave device is present 94 + */ 95 + if (!dev1) 96 + return rc; 97 + ret = -ENODEV; 98 + } 99 + 100 + /* 101 + * if device 1 was found in ata_devchk, wait for register 102 + * access briefly, then wait for BSY to clear. 103 + */ 104 + if (dev1) { 105 + int i; 106 + 107 + pata_parport_dev_select(ap, 1); 108 + 109 + /* 110 + * Wait for register access. Some ATAPI devices fail 111 + * to set nsect/lbal after reset, so don't waste too 112 + * much time on it. We're gonna wait for !BSY anyway. 113 + */ 114 + for (i = 0; i < 2; i++) { 115 + u8 nsect, lbal; 116 + 117 + nsect = pi->proto->read_regr(pi, 0, ATA_REG_NSECT); 118 + lbal = pi->proto->read_regr(pi, 0, ATA_REG_LBAL); 119 + if (nsect == 1 && lbal == 1) 120 + break; 121 + /* give drive a breather */ 122 + ata_msleep(ap, 50); 123 + } 124 + 125 + rc = ata_sff_wait_ready(link, deadline); 126 + if (rc) { 127 + if (rc != -ENODEV) 128 + return rc; 129 + ret = rc; 130 + } 131 + } 132 + 133 + pata_parport_dev_select(ap, 0); 134 + if (dev1) 135 + pata_parport_dev_select(ap, 1); 136 + if (dev0) 137 + pata_parport_dev_select(ap, 0); 138 + 139 + return ret; 81 140 } 82 141 83 142 static int pata_parport_bus_softreset(struct ata_port *ap, unsigned int devmask, ··· 160 87 ap->last_ctl = ap->ctl; 161 88 162 89 /* wait the port to become ready */ 163 - return ata_sff_wait_after_reset(&ap->link, devmask, deadline); 90 + return pata_parport_wait_after_reset(&ap->link, devmask, deadline); 164 91 } 165 92 166 93 static int pata_parport_softreset(struct ata_link *link, unsigned int *classes, ··· 325 252 .hardreset = NULL, 326 253 327 254 .sff_dev_select = pata_parport_dev_select, 255 + .sff_set_devctl = pata_parport_set_devctl, 328 256 .sff_check_status = pata_parport_check_status, 329 257 .sff_check_altstatus = pata_parport_check_altstatus, 330 258 .sff_tf_load = pata_parport_tf_load,
+2 -1
drivers/block/nbd.c
··· 1436 1436 1437 1437 static void nbd_clear_sock_ioctl(struct nbd_device *nbd) 1438 1438 { 1439 - blk_mark_disk_dead(nbd->disk); 1440 1439 nbd_clear_sock(nbd); 1440 + disk_force_media_change(nbd->disk); 1441 + nbd_bdev_reset(nbd); 1441 1442 if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF, 1442 1443 &nbd->config->runtime_flags)) 1443 1444 nbd_config_put(nbd);
+1 -1
drivers/gpio/gpio-aspeed.c
··· 973 973 else if (param == PIN_CONFIG_BIAS_DISABLE || 974 974 param == PIN_CONFIG_BIAS_PULL_DOWN || 975 975 param == PIN_CONFIG_DRIVE_STRENGTH) 976 - return pinctrl_gpio_set_config(offset, config); 976 + return pinctrl_gpio_set_config(chip->base + offset, config); 977 977 else if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN || 978 978 param == PIN_CONFIG_DRIVE_OPEN_SOURCE) 979 979 /* Return -ENOTSUPP to trigger emulation, as per datasheet */
+1
drivers/gpio/gpio-pxa.c
··· 237 237 switch (gpio_type) { 238 238 case PXA3XX_GPIO: 239 239 case MMP2_GPIO: 240 + case MMP_GPIO: 240 241 return false; 241 242 242 243 default:
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 2093 2093 adev->flags |= AMD_IS_PX; 2094 2094 2095 2095 if (!(adev->flags & AMD_IS_APU)) { 2096 - parent = pci_upstream_bridge(adev->pdev); 2096 + parent = pcie_find_root_port(adev->pdev); 2097 2097 adev->has_pr3 = parent ? pci_pr3_present(parent) : false; 2098 2098 } 2099 2099
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c
··· 170 170 csum += pia[size - 1]; 171 171 if (csum) { 172 172 DRM_ERROR("Bad Product Info Area checksum: 0x%02x", csum); 173 + kfree(pia); 173 174 return -EIO; 174 175 } 175 176
+2 -2
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c
··· 157 157 int32_t N; 158 158 int32_t j; 159 159 160 - if (!pipe_ctx->stream) 160 + if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) 161 161 continue; 162 162 /* Virtual encoders don't have this function */ 163 163 if (!stream_enc->funcs->get_fifo_cal_average_level) ··· 188 188 int32_t N; 189 189 int32_t j; 190 190 191 - if (!pipe_ctx->stream) 191 + if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) 192 192 continue; 193 193 /* Virtual encoders don't have this function */ 194 194 if (!stream_enc->funcs->get_fifo_cal_average_level)
+2 -2
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c
··· 355 355 int32_t N; 356 356 int32_t j; 357 357 358 - if (!pipe_ctx->stream) 358 + if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) 359 359 continue; 360 360 /* Virtual encoders don't have this function */ 361 361 if (!stream_enc->funcs->get_fifo_cal_average_level) ··· 401 401 int32_t N; 402 402 int32_t j; 403 403 404 - if (!pipe_ctx->stream) 404 + if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER)) 405 405 continue; 406 406 /* Virtual encoders don't have this function */ 407 407 if (!stream_enc->funcs->get_fifo_cal_average_level)
+1
drivers/gpu/drm/amd/pm/amdgpu_pm.c
··· 2040 2040 case IP_VERSION(11, 0, 0): 2041 2041 case IP_VERSION(11, 0, 1): 2042 2042 case IP_VERSION(11, 0, 2): 2043 + case IP_VERSION(11, 0, 3): 2043 2044 *states = ATTR_STATE_SUPPORTED; 2044 2045 break; 2045 2046 default:
+24 -19
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
··· 2082 2082 return ret; 2083 2083 } 2084 2084 2085 + #define MAX(a, b) ((a) > (b) ? (a) : (b)) 2086 + 2085 2087 static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu, 2086 2088 uint32_t pcie_gen_cap, 2087 2089 uint32_t pcie_width_cap) 2088 2090 { 2089 2091 struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; 2090 2092 struct smu_11_0_pcie_table *pcie_table = &dpm_context->dpm_tables.pcie_table; 2091 - u32 smu_pcie_arg; 2093 + uint8_t *table_member1, *table_member2; 2094 + uint32_t min_gen_speed, max_gen_speed; 2095 + uint32_t min_lane_width, max_lane_width; 2096 + uint32_t smu_pcie_arg; 2092 2097 int ret, i; 2093 2098 2094 - /* PCIE gen speed and lane width override */ 2099 + GET_PPTABLE_MEMBER(PcieGenSpeed, &table_member1); 2100 + GET_PPTABLE_MEMBER(PcieLaneCount, &table_member2); 2101 + 2102 + min_gen_speed = MAX(0, table_member1[0]); 2103 + max_gen_speed = MIN(pcie_gen_cap, table_member1[1]); 2104 + min_gen_speed = min_gen_speed > max_gen_speed ? 2105 + max_gen_speed : min_gen_speed; 2106 + min_lane_width = MAX(1, table_member2[0]); 2107 + max_lane_width = MIN(pcie_width_cap, table_member2[1]); 2108 + min_lane_width = min_lane_width > max_lane_width ? 2109 + max_lane_width : min_lane_width; 2110 + 2095 2111 if (!amdgpu_device_pcie_dynamic_switching_supported()) { 2096 - if (pcie_table->pcie_gen[NUM_LINK_LEVELS - 1] < pcie_gen_cap) 2097 - pcie_gen_cap = pcie_table->pcie_gen[NUM_LINK_LEVELS - 1]; 2098 - 2099 - if (pcie_table->pcie_lane[NUM_LINK_LEVELS - 1] < pcie_width_cap) 2100 - pcie_width_cap = pcie_table->pcie_lane[NUM_LINK_LEVELS - 1]; 2101 - 2102 - /* Force all levels to use the same settings */ 2103 - for (i = 0; i < NUM_LINK_LEVELS; i++) { 2104 - pcie_table->pcie_gen[i] = pcie_gen_cap; 2105 - pcie_table->pcie_lane[i] = pcie_width_cap; 2106 - } 2112 + pcie_table->pcie_gen[0] = max_gen_speed; 2113 + pcie_table->pcie_lane[0] = max_lane_width; 2107 2114 } else { 2108 - for (i = 0; i < NUM_LINK_LEVELS; i++) { 2109 - if (pcie_table->pcie_gen[i] > pcie_gen_cap) 2110 - pcie_table->pcie_gen[i] = pcie_gen_cap; 2111 - if (pcie_table->pcie_lane[i] > pcie_width_cap) 2112 - pcie_table->pcie_lane[i] = pcie_width_cap; 2113 - } 2115 + pcie_table->pcie_gen[0] = min_gen_speed; 2116 + pcie_table->pcie_lane[0] = min_lane_width; 2114 2117 } 2118 + pcie_table->pcie_gen[1] = max_gen_speed; 2119 + pcie_table->pcie_lane[1] = max_lane_width; 2115 2120 2116 2121 for (i = 0; i < NUM_LINK_LEVELS; i++) { 2117 2122 smu_pcie_arg = (i << 16 |
+16
drivers/gpu/drm/drm_panel_orientation_quirks.c
··· 38 38 .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, 39 39 }; 40 40 41 + static const struct drm_dmi_panel_orientation_data gpd_onemix2s = { 42 + .width = 1200, 43 + .height = 1920, 44 + .bios_dates = (const char * const []){ "05/21/2018", "10/26/2018", 45 + "03/04/2019", NULL }, 46 + .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, 47 + }; 48 + 41 49 static const struct drm_dmi_panel_orientation_data gpd_pocket = { 42 50 .width = 1200, 43 51 .height = 1920, ··· 409 401 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "LTH17"), 410 402 }, 411 403 .driver_data = (void *)&lcd800x1280_rightside_up, 404 + }, { /* One Mix 2S (generic strings, also match on bios date) */ 405 + .matches = { 406 + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"), 407 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"), 408 + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"), 409 + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), 410 + }, 411 + .driver_data = (void *)&gpd_onemix2s, 412 412 }, 413 413 {} 414 414 };
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_pages.c
··· 198 198 199 199 for_each_gt(gt, i915, id) { 200 200 if (!obj->mm.tlb[id]) 201 - return; 201 + continue; 202 202 203 203 intel_gt_invalidate_tlb_full(gt, obj->mm.tlb[id]); 204 204 obj->mm.tlb[id] = 0;
+10 -1
drivers/gpu/drm/i915/gt/gen8_engine_cs.c
··· 271 271 if (GRAPHICS_VER_FULL(rq->i915) >= IP_VER(12, 70)) 272 272 bit_group_0 |= PIPE_CONTROL_CCS_FLUSH; 273 273 274 + /* 275 + * L3 fabric flush is needed for AUX CCS invalidation 276 + * which happens as part of pipe-control so we can 277 + * ignore PIPE_CONTROL_FLUSH_L3. Also PIPE_CONTROL_FLUSH_L3 278 + * deals with Protected Memory which is not needed for 279 + * AUX CCS invalidation and lead to unwanted side effects. 280 + */ 281 + if (mode & EMIT_FLUSH) 282 + bit_group_1 |= PIPE_CONTROL_FLUSH_L3; 283 + 274 284 bit_group_1 |= PIPE_CONTROL_TILE_CACHE_FLUSH; 275 - bit_group_1 |= PIPE_CONTROL_FLUSH_L3; 276 285 bit_group_1 |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH; 277 286 bit_group_1 |= PIPE_CONTROL_DEPTH_CACHE_FLUSH; 278 287 /* Wa_1409600907:tgl,adl-p */
+7 -2
drivers/gpu/drm/i915/i915_gem.c
··· 1199 1199 goto err_unlock; 1200 1200 } 1201 1201 1202 + /* 1203 + * Register engines early to ensure the engine list is in its final 1204 + * rb-tree form, lowering the amount of code that has to deal with 1205 + * the intermediate llist state. 1206 + */ 1207 + intel_engines_driver_register(dev_priv); 1208 + 1202 1209 return 0; 1203 1210 1204 1211 /* ··· 1253 1246 void i915_gem_driver_register(struct drm_i915_private *i915) 1254 1247 { 1255 1248 i915_gem_driver_register__shrinker(i915); 1256 - 1257 - intel_engines_driver_register(i915); 1258 1249 } 1259 1250 1260 1251 void i915_gem_driver_unregister(struct drm_i915_private *i915)
+21
drivers/gpu/drm/nouveau/nouveau_abi16.c
··· 31 31 32 32 #include "nouveau_drv.h" 33 33 #include "nouveau_dma.h" 34 + #include "nouveau_exec.h" 34 35 #include "nouveau_gem.h" 35 36 #include "nouveau_chan.h" 36 37 #include "nouveau_abi16.h" ··· 184 183 cli->abi16 = NULL; 185 184 } 186 185 186 + static inline int 187 + getparam_dma_ib_max(struct nvif_device *device) 188 + { 189 + const struct nvif_mclass dmas[] = { 190 + { NV03_CHANNEL_DMA, 0 }, 191 + { NV10_CHANNEL_DMA, 0 }, 192 + { NV17_CHANNEL_DMA, 0 }, 193 + { NV40_CHANNEL_DMA, 0 }, 194 + {} 195 + }; 196 + 197 + return nvif_mclass(&device->object, dmas) < 0 ? NV50_DMA_IB_MAX : 0; 198 + } 199 + 187 200 int 188 201 nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) 189 202 { ··· 262 247 case NOUVEAU_GETPARAM_GRAPH_UNITS: 263 248 getparam->value = nvkm_gr_units(gr); 264 249 break; 250 + case NOUVEAU_GETPARAM_EXEC_PUSH_MAX: { 251 + int ib_max = getparam_dma_ib_max(device); 252 + 253 + getparam->value = nouveau_exec_push_max_from_ib_max(ib_max); 254 + break; 255 + } 265 256 default: 266 257 NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param); 267 258 return -EINVAL;
+7 -8
drivers/gpu/drm/nouveau/nouveau_chan.c
··· 257 257 nouveau_channel_ctor(struct nouveau_drm *drm, struct nvif_device *device, bool priv, u64 runm, 258 258 struct nouveau_channel **pchan) 259 259 { 260 - static const struct { 261 - s32 oclass; 262 - int version; 263 - } hosts[] = { 260 + const struct nvif_mclass hosts[] = { 264 261 { AMPERE_CHANNEL_GPFIFO_B, 0 }, 265 262 { AMPERE_CHANNEL_GPFIFO_A, 0 }, 266 263 { TURING_CHANNEL_GPFIFO_A, 0 }, ··· 440 443 } 441 444 442 445 /* initialise dma tracking parameters */ 443 - switch (chan->user.oclass & 0x00ff) { 444 - case 0x006b: 445 - case 0x006e: 446 + switch (chan->user.oclass) { 447 + case NV03_CHANNEL_DMA: 448 + case NV10_CHANNEL_DMA: 449 + case NV17_CHANNEL_DMA: 450 + case NV40_CHANNEL_DMA: 446 451 chan->user_put = 0x40; 447 452 chan->user_get = 0x44; 448 453 chan->dma.max = (0x10000 / 4) - 2; ··· 454 455 chan->user_get = 0x44; 455 456 chan->user_get_hi = 0x60; 456 457 chan->dma.ib_base = 0x10000 / 4; 457 - chan->dma.ib_max = (0x02000 / 8) - 1; 458 + chan->dma.ib_max = NV50_DMA_IB_MAX; 458 459 chan->dma.ib_put = 0; 459 460 chan->dma.ib_free = chan->dma.ib_max - chan->dma.ib_put; 460 461 chan->dma.max = chan->dma.ib_base;
+3
drivers/gpu/drm/nouveau/nouveau_dma.h
··· 49 49 /* Maximum push buffer size. */ 50 50 #define NV50_DMA_PUSH_MAX_LENGTH 0x7fffff 51 51 52 + /* Maximum IBs per ring. */ 53 + #define NV50_DMA_IB_MAX ((0x02000 / 8) - 1) 54 + 52 55 /* Object handles - for stuff that's doesn't use handle == oclass. */ 53 56 enum { 54 57 NvDmaFB = 0x80000002,
+4 -3
drivers/gpu/drm/nouveau/nouveau_exec.c
··· 379 379 struct nouveau_channel *chan = NULL; 380 380 struct nouveau_exec_job_args args = {}; 381 381 struct drm_nouveau_exec *req = data; 382 - int ret = 0; 382 + int push_max, ret = 0; 383 383 384 384 if (unlikely(!abi16)) 385 385 return -ENOMEM; ··· 404 404 if (!chan->dma.ib_max) 405 405 return nouveau_abi16_put(abi16, -ENOSYS); 406 406 407 - if (unlikely(req->push_count > NOUVEAU_GEM_MAX_PUSH)) { 407 + push_max = nouveau_exec_push_max_from_ib_max(chan->dma.ib_max); 408 + if (unlikely(req->push_count > push_max)) { 408 409 NV_PRINTK(err, cli, "pushbuf push count exceeds limit: %d max %d\n", 409 - req->push_count, NOUVEAU_GEM_MAX_PUSH); 410 + req->push_count, push_max); 410 411 return nouveau_abi16_put(abi16, -EINVAL); 411 412 } 412 413
+10
drivers/gpu/drm/nouveau/nouveau_exec.h
··· 51 51 int nouveau_exec_ioctl_exec(struct drm_device *dev, void *data, 52 52 struct drm_file *file_priv); 53 53 54 + static inline unsigned int 55 + nouveau_exec_push_max_from_ib_max(int ib_max) 56 + { 57 + /* Limit the number of IBs per job to half the size of the ring in order 58 + * to avoid the ring running dry between submissions and preserve one 59 + * more slot for the job's HW fence. 60 + */ 61 + return ib_max > 1 ? ib_max / 2 - 1 : 0; 62 + } 63 + 54 64 #endif
+1 -1
drivers/gpu/drm/tests/drm_kunit_helpers.c
··· 118 118 119 119 kunit_release_action(test, 120 120 kunit_action_platform_driver_unregister, 121 - pdev); 121 + &fake_platform_driver); 122 122 } 123 123 EXPORT_SYMBOL_GPL(drm_kunit_helper_free_device); 124 124
+2
drivers/hid/Kconfig
··· 799 799 tristate "NVIDIA SHIELD devices" 800 800 depends on USB_HID 801 801 depends on BT_HIDP 802 + depends on LEDS_CLASS 803 + select POWER_SUPPLY 802 804 help 803 805 Support for NVIDIA SHIELD accessories. 804 806
+4
drivers/hid/hid-holtek-kbd.c
··· 130 130 return -ENODEV; 131 131 132 132 boot_hid = usb_get_intfdata(boot_interface); 133 + if (list_empty(&boot_hid->inputs)) { 134 + hid_err(hid, "no inputs found\n"); 135 + return -ENODEV; 136 + } 133 137 boot_hid_input = list_first_entry(&boot_hid->inputs, 134 138 struct hid_input, list); 135 139
+1
drivers/hid/hid-ids.h
··· 425 425 #define I2C_DEVICE_ID_HP_SPECTRE_X360_13T_AW100 0x29F5 426 426 #define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V1 0x2BED 427 427 #define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2 0x2BEE 428 + #define I2C_DEVICE_ID_HP_ENVY_X360_15_EU0556NG 0x2D02 428 429 429 430 #define USB_VENDOR_ID_ELECOM 0x056e 430 431 #define USB_DEVICE_ID_ELECOM_BM084 0x0061
+2
drivers/hid/hid-input.c
··· 409 409 HID_BATTERY_QUIRK_IGNORE }, 410 410 { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2), 411 411 HID_BATTERY_QUIRK_IGNORE }, 412 + { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15_EU0556NG), 413 + HID_BATTERY_QUIRK_IGNORE }, 412 414 {} 413 415 }; 414 416
+4 -1
drivers/hid/hid-logitech-hidpp.c
··· 4515 4515 goto hid_hw_init_fail; 4516 4516 } 4517 4517 4518 - hidpp_connect_event(hidpp); 4518 + schedule_work(&hidpp->work); 4519 + flush_work(&hidpp->work); 4519 4520 4520 4521 if (will_restart) { 4521 4522 /* Reset the HID node state */ ··· 4678 4677 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) }, 4679 4678 { /* MX Master mouse over Bluetooth */ 4680 4679 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012) }, 4680 + { /* M720 Triathlon mouse over Bluetooth */ 4681 + HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb015) }, 4681 4682 { /* MX Ergo trackball over Bluetooth */ 4682 4683 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) }, 4683 4684 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) },
+4
drivers/hid/hid-multitouch.c
··· 2146 2146 /* Synaptics devices */ 2147 2147 { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, 2148 2148 HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, 2149 + USB_VENDOR_ID_SYNAPTICS, 0xcd7e) }, 2150 + 2151 + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, 2152 + HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, 2149 2153 USB_VENDOR_ID_SYNAPTICS, 0xce08) }, 2150 2154 2151 2155 { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
+103 -72
drivers/hid/hid-nintendo.c
··· 2088 2088 struct joycon_input_report *report; 2089 2089 2090 2090 req.subcmd_id = JC_SUBCMD_REQ_DEV_INFO; 2091 + mutex_lock(&ctlr->output_mutex); 2091 2092 ret = joycon_send_subcmd(ctlr, &req, 0, HZ); 2093 + mutex_unlock(&ctlr->output_mutex); 2092 2094 if (ret) { 2093 2095 hid_err(ctlr->hdev, "Failed to get joycon info; ret=%d\n", ret); 2094 2096 return ret; ··· 2117 2115 ctlr->ctlr_type = report->subcmd_reply.data[2]; 2118 2116 2119 2117 return 0; 2118 + } 2119 + 2120 + static int joycon_init(struct hid_device *hdev) 2121 + { 2122 + struct joycon_ctlr *ctlr = hid_get_drvdata(hdev); 2123 + int ret = 0; 2124 + 2125 + mutex_lock(&ctlr->output_mutex); 2126 + /* if handshake command fails, assume ble pro controller */ 2127 + if ((jc_type_is_procon(ctlr) || jc_type_is_chrggrip(ctlr)) && 2128 + !joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ)) { 2129 + hid_dbg(hdev, "detected USB controller\n"); 2130 + /* set baudrate for improved latency */ 2131 + ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ); 2132 + if (ret) { 2133 + hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret); 2134 + goto out_unlock; 2135 + } 2136 + /* handshake */ 2137 + ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ); 2138 + if (ret) { 2139 + hid_err(hdev, "Failed handshake; ret=%d\n", ret); 2140 + goto out_unlock; 2141 + } 2142 + /* 2143 + * Set no timeout (to keep controller in USB mode). 2144 + * This doesn't send a response, so ignore the timeout. 2145 + */ 2146 + joycon_send_usb(ctlr, JC_USB_CMD_NO_TIMEOUT, HZ/10); 2147 + } else if (jc_type_is_chrggrip(ctlr)) { 2148 + hid_err(hdev, "Failed charging grip handshake\n"); 2149 + ret = -ETIMEDOUT; 2150 + goto out_unlock; 2151 + } 2152 + 2153 + /* get controller calibration data, and parse it */ 2154 + ret = joycon_request_calibration(ctlr); 2155 + if (ret) { 2156 + /* 2157 + * We can function with default calibration, but it may be 2158 + * inaccurate. Provide a warning, and continue on. 2159 + */ 2160 + hid_warn(hdev, "Analog stick positions may be inaccurate\n"); 2161 + } 2162 + 2163 + /* get IMU calibration data, and parse it */ 2164 + ret = joycon_request_imu_calibration(ctlr); 2165 + if (ret) { 2166 + /* 2167 + * We can function with default calibration, but it may be 2168 + * inaccurate. Provide a warning, and continue on. 2169 + */ 2170 + hid_warn(hdev, "Unable to read IMU calibration data\n"); 2171 + } 2172 + 2173 + /* Set the reporting mode to 0x30, which is the full report mode */ 2174 + ret = joycon_set_report_mode(ctlr); 2175 + if (ret) { 2176 + hid_err(hdev, "Failed to set report mode; ret=%d\n", ret); 2177 + goto out_unlock; 2178 + } 2179 + 2180 + /* Enable rumble */ 2181 + ret = joycon_enable_rumble(ctlr); 2182 + if (ret) { 2183 + hid_err(hdev, "Failed to enable rumble; ret=%d\n", ret); 2184 + goto out_unlock; 2185 + } 2186 + 2187 + /* Enable the IMU */ 2188 + ret = joycon_enable_imu(ctlr); 2189 + if (ret) { 2190 + hid_err(hdev, "Failed to enable the IMU; ret=%d\n", ret); 2191 + goto out_unlock; 2192 + } 2193 + 2194 + out_unlock: 2195 + mutex_unlock(&ctlr->output_mutex); 2196 + return ret; 2120 2197 } 2121 2198 2122 2199 /* Common handler for parsing inputs */ ··· 2329 2248 2330 2249 hid_device_io_start(hdev); 2331 2250 2332 - /* Initialize the controller */ 2333 - mutex_lock(&ctlr->output_mutex); 2334 - /* if handshake command fails, assume ble pro controller */ 2335 - if ((jc_type_is_procon(ctlr) || jc_type_is_chrggrip(ctlr)) && 2336 - !joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ)) { 2337 - hid_dbg(hdev, "detected USB controller\n"); 2338 - /* set baudrate for improved latency */ 2339 - ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ); 2340 - if (ret) { 2341 - hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret); 2342 - goto err_mutex; 2343 - } 2344 - /* handshake */ 2345 - ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ); 2346 - if (ret) { 2347 - hid_err(hdev, "Failed handshake; ret=%d\n", ret); 2348 - goto err_mutex; 2349 - } 2350 - /* 2351 - * Set no timeout (to keep controller in USB mode). 2352 - * This doesn't send a response, so ignore the timeout. 2353 - */ 2354 - joycon_send_usb(ctlr, JC_USB_CMD_NO_TIMEOUT, HZ/10); 2355 - } else if (jc_type_is_chrggrip(ctlr)) { 2356 - hid_err(hdev, "Failed charging grip handshake\n"); 2357 - ret = -ETIMEDOUT; 2358 - goto err_mutex; 2359 - } 2360 - 2361 - /* get controller calibration data, and parse it */ 2362 - ret = joycon_request_calibration(ctlr); 2251 + ret = joycon_init(hdev); 2363 2252 if (ret) { 2364 - /* 2365 - * We can function with default calibration, but it may be 2366 - * inaccurate. Provide a warning, and continue on. 2367 - */ 2368 - hid_warn(hdev, "Analog stick positions may be inaccurate\n"); 2369 - } 2370 - 2371 - /* get IMU calibration data, and parse it */ 2372 - ret = joycon_request_imu_calibration(ctlr); 2373 - if (ret) { 2374 - /* 2375 - * We can function with default calibration, but it may be 2376 - * inaccurate. Provide a warning, and continue on. 2377 - */ 2378 - hid_warn(hdev, "Unable to read IMU calibration data\n"); 2379 - } 2380 - 2381 - /* Set the reporting mode to 0x30, which is the full report mode */ 2382 - ret = joycon_set_report_mode(ctlr); 2383 - if (ret) { 2384 - hid_err(hdev, "Failed to set report mode; ret=%d\n", ret); 2385 - goto err_mutex; 2386 - } 2387 - 2388 - /* Enable rumble */ 2389 - ret = joycon_enable_rumble(ctlr); 2390 - if (ret) { 2391 - hid_err(hdev, "Failed to enable rumble; ret=%d\n", ret); 2392 - goto err_mutex; 2393 - } 2394 - 2395 - /* Enable the IMU */ 2396 - ret = joycon_enable_imu(ctlr); 2397 - if (ret) { 2398 - hid_err(hdev, "Failed to enable the IMU; ret=%d\n", ret); 2399 - goto err_mutex; 2253 + hid_err(hdev, "Failed to initialize controller; ret=%d\n", ret); 2254 + goto err_close; 2400 2255 } 2401 2256 2402 2257 ret = joycon_read_info(ctlr); 2403 2258 if (ret) { 2404 2259 hid_err(hdev, "Failed to retrieve controller info; ret=%d\n", 2405 2260 ret); 2406 - goto err_mutex; 2261 + goto err_close; 2407 2262 } 2408 - 2409 - mutex_unlock(&ctlr->output_mutex); 2410 2263 2411 2264 /* Initialize the leds */ 2412 2265 ret = joycon_leds_create(ctlr); ··· 2367 2352 hid_dbg(hdev, "probe - success\n"); 2368 2353 return 0; 2369 2354 2370 - err_mutex: 2371 - mutex_unlock(&ctlr->output_mutex); 2372 2355 err_close: 2373 2356 hid_hw_close(hdev); 2374 2357 err_stop: ··· 2396 2383 hid_hw_stop(hdev); 2397 2384 } 2398 2385 2386 + #ifdef CONFIG_PM 2387 + 2388 + static int nintendo_hid_resume(struct hid_device *hdev) 2389 + { 2390 + int ret = joycon_init(hdev); 2391 + 2392 + if (ret) 2393 + hid_err(hdev, "Failed to restore controller after resume"); 2394 + 2395 + return ret; 2396 + } 2397 + 2398 + #endif 2399 + 2399 2400 static const struct hid_device_id nintendo_hid_devices[] = { 2400 2401 { HID_USB_DEVICE(USB_VENDOR_ID_NINTENDO, 2401 2402 USB_DEVICE_ID_NINTENDO_PROCON) }, ··· 2431 2404 .probe = nintendo_hid_probe, 2432 2405 .remove = nintendo_hid_remove, 2433 2406 .raw_event = nintendo_hid_event, 2407 + 2408 + #ifdef CONFIG_PM 2409 + .resume = nintendo_hid_resume, 2410 + #endif 2434 2411 }; 2435 2412 module_hid_driver(nintendo_hid_driver); 2436 2413
+6 -3
drivers/hid/hid-nvidia-shield.c
··· 801 801 led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL, 802 802 "thunderstrike%d:blue:led", ts->id); 803 803 led->max_brightness = 1; 804 - led->flags = LED_CORE_SUSPENDRESUME; 804 + led->flags = LED_CORE_SUSPENDRESUME | LED_RETAIN_AT_SHUTDOWN; 805 805 led->brightness_get = &thunderstrike_led_get_brightness; 806 806 led->brightness_set = &thunderstrike_led_set_brightness; 807 807 ··· 1058 1058 ret = hid_hw_start(hdev, HID_CONNECT_HIDINPUT); 1059 1059 if (ret) { 1060 1060 hid_err(hdev, "Failed to start HID device\n"); 1061 - goto err_haptics; 1061 + goto err_ts_create; 1062 1062 } 1063 1063 1064 1064 ret = hid_hw_open(hdev); ··· 1073 1073 1074 1074 err_stop: 1075 1075 hid_hw_stop(hdev); 1076 - err_haptics: 1076 + err_ts_create: 1077 + power_supply_unregister(ts->base.battery_dev.psy); 1077 1078 if (ts->haptics_dev) 1078 1079 input_unregister_device(ts->haptics_dev); 1080 + led_classdev_unregister(&ts->led_dev); 1081 + ida_free(&thunderstrike_ida, ts->id); 1079 1082 return ret; 1080 1083 } 1081 1084
+2
drivers/hid/hid-sony.c
··· 2155 2155 return ret; 2156 2156 2157 2157 err: 2158 + usb_free_urb(sc->ghl_urb); 2159 + 2158 2160 hid_hw_stop(hdev); 2159 2161 return ret; 2160 2162 }
+1 -1
drivers/hid/hid-steelseries.c
··· 390 390 ret = hid_hw_raw_request(hdev, arctis_1_battery_request[0], 391 391 write_buf, sizeof(arctis_1_battery_request), 392 392 HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); 393 - if (ret < sizeof(arctis_1_battery_request)) { 393 + if (ret < (int)sizeof(arctis_1_battery_request)) { 394 394 hid_err(hdev, "hid_hw_raw_request() failed with %d\n", ret); 395 395 ret = -ENODATA; 396 396 }
+81 -63
drivers/hid/i2c-hid/i2c-hid-core.c
··· 998 998 return hid_driver_reset_resume(hid); 999 999 } 1000 1000 1001 - /** 1002 - * __do_i2c_hid_core_initial_power_up() - First time power up of the i2c-hid device. 1003 - * @ihid: The ihid object created during probe. 1004 - * 1005 - * This function is called at probe time. 1006 - * 1007 - * The initial power on is where we do some basic validation that the device 1008 - * exists, where we fetch the HID descriptor, and where we create the actual 1009 - * HID devices. 1010 - * 1011 - * Return: 0 or error code. 1001 + /* 1002 + * Check that the device exists and parse the HID descriptor. 1012 1003 */ 1013 - static int __do_i2c_hid_core_initial_power_up(struct i2c_hid *ihid) 1004 + static int __i2c_hid_core_probe(struct i2c_hid *ihid) 1014 1005 { 1015 1006 struct i2c_client *client = ihid->client; 1016 1007 struct hid_device *hid = ihid->hid; 1017 1008 int ret; 1018 1009 1019 - ret = i2c_hid_core_power_up(ihid); 1020 - if (ret) 1021 - return ret; 1022 - 1023 1010 /* Make sure there is something at this address */ 1024 1011 ret = i2c_smbus_read_byte(client); 1025 1012 if (ret < 0) { 1026 1013 i2c_hid_dbg(ihid, "nothing at this address: %d\n", ret); 1027 - ret = -ENXIO; 1028 - goto err; 1014 + return -ENXIO; 1029 1015 } 1030 1016 1031 1017 ret = i2c_hid_fetch_hid_descriptor(ihid); 1032 1018 if (ret < 0) { 1033 1019 dev_err(&client->dev, 1034 1020 "Failed to fetch the HID Descriptor\n"); 1035 - goto err; 1021 + return ret; 1036 1022 } 1037 - 1038 - enable_irq(client->irq); 1039 1023 1040 1024 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion); 1041 1025 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); ··· 1034 1050 1035 1051 ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product); 1036 1052 1053 + return 0; 1054 + } 1055 + 1056 + static int i2c_hid_core_register_hid(struct i2c_hid *ihid) 1057 + { 1058 + struct i2c_client *client = ihid->client; 1059 + struct hid_device *hid = ihid->hid; 1060 + int ret; 1061 + 1062 + enable_irq(client->irq); 1063 + 1037 1064 ret = hid_add_device(hid); 1038 1065 if (ret) { 1039 1066 if (ret != -ENODEV) 1040 1067 hid_err(client, "can't add hid device: %d\n", ret); 1041 - goto err; 1068 + disable_irq(client->irq); 1069 + return ret; 1042 1070 } 1043 1071 1044 1072 return 0; 1073 + } 1045 1074 1046 - err: 1075 + static int i2c_hid_core_probe_panel_follower(struct i2c_hid *ihid) 1076 + { 1077 + int ret; 1078 + 1079 + ret = i2c_hid_core_power_up(ihid); 1080 + if (ret) 1081 + return ret; 1082 + 1083 + ret = __i2c_hid_core_probe(ihid); 1084 + if (ret) 1085 + goto err_power_down; 1086 + 1087 + ret = i2c_hid_core_register_hid(ihid); 1088 + if (ret) 1089 + goto err_power_down; 1090 + 1091 + return 0; 1092 + 1093 + err_power_down: 1047 1094 i2c_hid_core_power_down(ihid); 1095 + 1048 1096 return ret; 1049 1097 } 1050 1098 ··· 1093 1077 * steps. 1094 1078 */ 1095 1079 if (!hid->version) 1096 - ret = __do_i2c_hid_core_initial_power_up(ihid); 1080 + ret = i2c_hid_core_probe_panel_follower(ihid); 1097 1081 else 1098 1082 ret = i2c_hid_core_resume(ihid); 1099 1083 ··· 1152 1136 struct device *dev = &ihid->client->dev; 1153 1137 int ret; 1154 1138 1155 - ihid->is_panel_follower = true; 1156 1139 ihid->panel_follower.funcs = &i2c_hid_core_panel_follower_funcs; 1157 1140 1158 1141 /* ··· 1169 1154 return ret; 1170 1155 1171 1156 return 0; 1172 - } 1173 - 1174 - static int i2c_hid_core_initial_power_up(struct i2c_hid *ihid) 1175 - { 1176 - /* 1177 - * If we're a panel follower, we'll register and do our initial power 1178 - * up when the panel turns on; otherwise we do it right away. 1179 - */ 1180 - if (drm_is_panel_follower(&ihid->client->dev)) 1181 - return i2c_hid_core_register_panel_follower(ihid); 1182 - else 1183 - return __do_i2c_hid_core_initial_power_up(ihid); 1184 - } 1185 - 1186 - static void i2c_hid_core_final_power_down(struct i2c_hid *ihid) 1187 - { 1188 - /* 1189 - * If we're a follower, the act of unfollowing will cause us to be 1190 - * powered down. Otherwise we need to manually do it. 1191 - */ 1192 - if (ihid->is_panel_follower) 1193 - drm_panel_remove_follower(&ihid->panel_follower); 1194 - else 1195 - i2c_hid_core_suspend(ihid, true); 1196 1157 } 1197 1158 1198 1159 int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, ··· 1202 1211 ihid->ops = ops; 1203 1212 ihid->client = client; 1204 1213 ihid->wHIDDescRegister = cpu_to_le16(hid_descriptor_address); 1214 + ihid->is_panel_follower = drm_is_panel_follower(&client->dev); 1205 1215 1206 1216 init_waitqueue_head(&ihid->wait); 1207 1217 mutex_init(&ihid->reset_lock); ··· 1216 1224 return ret; 1217 1225 device_enable_async_suspend(&client->dev); 1218 1226 1219 - ret = i2c_hid_init_irq(client); 1220 - if (ret < 0) 1221 - goto err_buffers_allocated; 1222 - 1223 1227 hid = hid_allocate_device(); 1224 1228 if (IS_ERR(hid)) { 1225 1229 ret = PTR_ERR(hid); 1226 - goto err_irq; 1230 + goto err_free_buffers; 1227 1231 } 1228 1232 1229 1233 ihid->hid = hid; ··· 1230 1242 hid->bus = BUS_I2C; 1231 1243 hid->initial_quirks = quirks; 1232 1244 1233 - ret = i2c_hid_core_initial_power_up(ihid); 1245 + /* Power on and probe unless device is a panel follower. */ 1246 + if (!ihid->is_panel_follower) { 1247 + ret = i2c_hid_core_power_up(ihid); 1248 + if (ret < 0) 1249 + goto err_destroy_device; 1250 + 1251 + ret = __i2c_hid_core_probe(ihid); 1252 + if (ret < 0) 1253 + goto err_power_down; 1254 + } 1255 + 1256 + ret = i2c_hid_init_irq(client); 1257 + if (ret < 0) 1258 + goto err_power_down; 1259 + 1260 + /* 1261 + * If we're a panel follower, we'll register when the panel turns on; 1262 + * otherwise we do it right away. 1263 + */ 1264 + if (ihid->is_panel_follower) 1265 + ret = i2c_hid_core_register_panel_follower(ihid); 1266 + else 1267 + ret = i2c_hid_core_register_hid(ihid); 1234 1268 if (ret) 1235 - goto err_mem_free; 1269 + goto err_free_irq; 1236 1270 1237 1271 return 0; 1238 1272 1239 - err_mem_free: 1240 - hid_destroy_device(hid); 1241 - 1242 - err_irq: 1273 + err_free_irq: 1243 1274 free_irq(client->irq, ihid); 1244 - 1245 - err_buffers_allocated: 1275 + err_power_down: 1276 + if (!ihid->is_panel_follower) 1277 + i2c_hid_core_power_down(ihid); 1278 + err_destroy_device: 1279 + hid_destroy_device(hid); 1280 + err_free_buffers: 1246 1281 i2c_hid_free_buffers(ihid); 1247 1282 1248 1283 return ret; ··· 1277 1266 struct i2c_hid *ihid = i2c_get_clientdata(client); 1278 1267 struct hid_device *hid; 1279 1268 1280 - i2c_hid_core_final_power_down(ihid); 1269 + /* 1270 + * If we're a follower, the act of unfollowing will cause us to be 1271 + * powered down. Otherwise we need to manually do it. 1272 + */ 1273 + if (ihid->is_panel_follower) 1274 + drm_panel_remove_follower(&ihid->panel_follower); 1275 + else 1276 + i2c_hid_core_suspend(ihid, true); 1281 1277 1282 1278 hid = ihid->hid; 1283 1279 hid_destroy_device(hid);
+8
drivers/hid/intel-ish-hid/ipc/pci-ish.c
··· 133 133 } 134 134 wakeup = &adev->wakeup; 135 135 136 + /* 137 + * Call acpi_disable_gpe(), so that reference count 138 + * gpe_event_info->runtime_count doesn't overflow. 139 + * When gpe_event_info->runtime_count = 0, the call 140 + * to acpi_disable_gpe() simply return. 141 + */ 142 + acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); 143 + 136 144 acpi_sts = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number); 137 145 if (ACPI_FAILURE(acpi_sts)) { 138 146 dev_err(dev, "enable ose_gpe failed\n");
+1 -1
drivers/infiniband/core/cma.c
··· 4968 4968 int err = 0; 4969 4969 struct sockaddr *addr = (struct sockaddr *)&mc->addr; 4970 4970 struct net_device *ndev = NULL; 4971 - struct ib_sa_multicast ib; 4971 + struct ib_sa_multicast ib = {}; 4972 4972 enum ib_gid_type gid_type; 4973 4973 bool send_only; 4974 4974
+1 -1
drivers/infiniband/core/cma_configfs.c
··· 217 217 return -ENOMEM; 218 218 219 219 for (i = 0; i < ports_num; i++) { 220 - char port_str[10]; 220 + char port_str[11]; 221 221 222 222 ports[i].port_num = i + 1; 223 223 snprintf(port_str, sizeof(port_str), "%u", i + 1);
+1
drivers/infiniband/core/nldev.c
··· 2529 2529 }, 2530 2530 [RDMA_NLDEV_CMD_SYS_SET] = { 2531 2531 .doit = nldev_set_sys_set_doit, 2532 + .flags = RDMA_NL_ADMIN_PERM, 2532 2533 }, 2533 2534 [RDMA_NLDEV_CMD_STAT_SET] = { 2534 2535 .doit = nldev_stat_set_doit,
+1 -1
drivers/infiniband/core/uverbs_main.c
··· 546 546 if (hdr->in_words * 4 != count) 547 547 return -EINVAL; 548 548 549 - if (count < method_elm->req_size + sizeof(hdr)) { 549 + if (count < method_elm->req_size + sizeof(*hdr)) { 550 550 /* 551 551 * rdma-core v18 and v19 have a bug where they send DESTROY_CQ 552 552 * with a 16 byte write instead of 24. Old kernels didn't
+4
drivers/infiniband/hw/bnxt_re/ib_verbs.c
··· 910 910 list_del(&qp->list); 911 911 mutex_unlock(&rdev->qp_lock); 912 912 atomic_dec(&rdev->stats.res.qp_count); 913 + if (qp->qplib_qp.type == CMDQ_CREATE_QP_TYPE_RC) 914 + atomic_dec(&rdev->stats.res.rc_qp_count); 915 + else if (qp->qplib_qp.type == CMDQ_CREATE_QP_TYPE_UD) 916 + atomic_dec(&rdev->stats.res.ud_qp_count); 913 917 914 918 ib_umem_release(qp->rumem); 915 919 ib_umem_release(qp->sumem);
+9 -2
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
··· 665 665 blocked = cookie & RCFW_CMD_IS_BLOCKING; 666 666 cookie &= RCFW_MAX_COOKIE_VALUE; 667 667 crsqe = &rcfw->crsqe_tbl[cookie]; 668 - crsqe->is_in_used = false; 669 668 670 669 if (WARN_ONCE(test_bit(FIRMWARE_STALL_DETECTED, 671 670 &rcfw->cmdq.flags), ··· 680 681 atomic_dec(&rcfw->timeout_send); 681 682 682 683 if (crsqe->is_waiter_alive) { 683 - if (crsqe->resp) 684 + if (crsqe->resp) { 684 685 memcpy(crsqe->resp, qp_event, sizeof(*qp_event)); 686 + /* Insert write memory barrier to ensure that 687 + * response data is copied before clearing the 688 + * flags 689 + */ 690 + smp_wmb(); 691 + } 685 692 if (!blocked) 686 693 wait_cmds++; 687 694 } ··· 698 693 crsqe->req_size = 0; 699 694 if (!is_waiter_alive) 700 695 crsqe->resp = NULL; 696 + 697 + crsqe->is_in_used = false; 701 698 702 699 hwq->cons += req_size; 703 700
+3
drivers/infiniband/hw/cxgb4/cm.c
··· 1965 1965 int win; 1966 1966 1967 1967 skb = get_skb(NULL, sizeof(*req), GFP_KERNEL); 1968 + if (!skb) 1969 + return -ENOMEM; 1970 + 1968 1971 req = __skb_put_zero(skb, sizeof(*req)); 1969 1972 req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR)); 1970 1973 req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
+3 -4
drivers/infiniband/hw/erdma/erdma_verbs.c
··· 133 133 static int regmr_cmd(struct erdma_dev *dev, struct erdma_mr *mr) 134 134 { 135 135 struct erdma_pd *pd = to_epd(mr->ibmr.pd); 136 + u32 mtt_level = ERDMA_MR_MTT_0LEVEL; 136 137 struct erdma_cmdq_reg_mr_req req; 137 - u32 mtt_level; 138 138 139 139 erdma_cmdq_build_reqhdr(&req.hdr, CMDQ_SUBMOD_RDMA, CMDQ_OPCODE_REG_MR); 140 140 ··· 147 147 req.phy_addr[0] = sg_dma_address(mr->mem.mtt->sglist); 148 148 mtt_level = mr->mem.mtt->level; 149 149 } 150 - } else { 150 + } else if (mr->type != ERDMA_MR_TYPE_DMA) { 151 151 memcpy(req.phy_addr, mr->mem.mtt->buf, 152 152 MTT_SIZE(mr->mem.page_cnt)); 153 - mtt_level = ERDMA_MR_MTT_0LEVEL; 154 153 } 155 154 156 155 req.cfg0 = FIELD_PREP(ERDMA_CMD_MR_VALID_MASK, mr->valid) | ··· 654 655 655 656 mtt = kzalloc(sizeof(*mtt), GFP_KERNEL); 656 657 if (!mtt) 657 - return NULL; 658 + return ERR_PTR(-ENOMEM); 658 659 659 660 mtt->size = ALIGN(size, PAGE_SIZE); 660 661 mtt->buf = vzalloc(mtt->size);
+1 -1
drivers/infiniband/hw/mlx4/sysfs.c
··· 223 223 static int add_port_entries(struct mlx4_ib_dev *device, int port_num) 224 224 { 225 225 int i; 226 - char buff[11]; 226 + char buff[12]; 227 227 struct mlx4_ib_iov_port *port = NULL; 228 228 int ret = 0 ; 229 229 struct ib_port_attr attr;
+1 -1
drivers/infiniband/hw/mlx5/fs.c
··· 2470 2470 mlx5_steering_anchor_destroy_res(ft_prio); 2471 2471 put_flow_table: 2472 2472 put_flow_table(dev, ft_prio, true); 2473 - mutex_unlock(&dev->flow_db->lock); 2474 2473 free_obj: 2474 + mutex_unlock(&dev->flow_db->lock); 2475 2475 kfree(obj); 2476 2476 2477 2477 return err;
+1 -1
drivers/infiniband/hw/mlx5/main.c
··· 2084 2084 case MLX5_IB_MMAP_DEVICE_MEM: 2085 2085 return "Device Memory"; 2086 2086 default: 2087 - return NULL; 2087 + return "Unknown"; 2088 2088 } 2089 2089 } 2090 2090
+11 -3
drivers/infiniband/hw/mlx5/mr.c
··· 301 301 302 302 static void set_cache_mkc(struct mlx5_cache_ent *ent, void *mkc) 303 303 { 304 - set_mkc_access_pd_addr_fields(mkc, 0, 0, ent->dev->umrc.pd); 304 + set_mkc_access_pd_addr_fields(mkc, ent->rb_key.access_flags, 0, 305 + ent->dev->umrc.pd); 305 306 MLX5_SET(mkc, mkc, free, 1); 306 307 MLX5_SET(mkc, mkc, umr_en, 1); 307 308 MLX5_SET(mkc, mkc, access_mode_1_0, ent->rb_key.access_mode & 0x3); ··· 1025 1024 if (!dev->cache.wq) 1026 1025 return; 1027 1026 1028 - cancel_delayed_work_sync(&dev->cache.remove_ent_dwork); 1029 1027 mutex_lock(&dev->cache.rb_lock); 1030 1028 for (node = rb_first(root); node; node = rb_next(node)) { 1031 1029 ent = rb_entry(node, struct mlx5_cache_ent, node); 1032 1030 xa_lock_irq(&ent->mkeys); 1033 1031 ent->disabled = true; 1034 1032 xa_unlock_irq(&ent->mkeys); 1035 - cancel_delayed_work_sync(&ent->dwork); 1036 1033 } 1034 + mutex_unlock(&dev->cache.rb_lock); 1035 + 1036 + /* 1037 + * After all entries are disabled and will not reschedule on WQ, 1038 + * flush it and all async commands. 1039 + */ 1040 + flush_workqueue(dev->cache.wq); 1037 1041 1038 1042 mlx5_mkey_cache_debugfs_cleanup(dev); 1039 1043 mlx5_cmd_cleanup_async_ctx(&dev->async_ctx); 1040 1044 1045 + /* At this point all entries are disabled and have no concurrent work. */ 1046 + mutex_lock(&dev->cache.rb_lock); 1041 1047 node = rb_first(root); 1042 1048 while (node) { 1043 1049 ent = rb_entry(node, struct mlx5_cache_ent, node);
+12 -4
drivers/infiniband/sw/siw/siw_cm.c
··· 976 976 siw_cep_put(cep); 977 977 new_cep->listen_cep = NULL; 978 978 if (rv) { 979 + siw_cancel_mpatimer(new_cep); 979 980 siw_cep_set_free(new_cep); 980 981 goto error; 981 982 } ··· 1101 1100 /* 1102 1101 * Socket close before MPA request received. 1103 1102 */ 1104 - siw_dbg_cep(cep, "no mpareq: drop listener\n"); 1105 - siw_cep_put(cep->listen_cep); 1106 - cep->listen_cep = NULL; 1103 + if (cep->listen_cep) { 1104 + siw_dbg_cep(cep, 1105 + "no mpareq: drop listener\n"); 1106 + siw_cep_put(cep->listen_cep); 1107 + cep->listen_cep = NULL; 1108 + } 1107 1109 } 1108 1110 } 1109 1111 release_cep = 1; ··· 1231 1227 if (!cep) 1232 1228 goto out; 1233 1229 1234 - siw_dbg_cep(cep, "state: %d\n", cep->state); 1230 + siw_dbg_cep(cep, "cep state: %d, socket state %d\n", 1231 + cep->state, sk->sk_state); 1232 + 1233 + if (sk->sk_state != TCP_ESTABLISHED) 1234 + goto out; 1235 1235 1236 1236 switch (cep->state) { 1237 1237 case SIW_EPSTATE_RDMA_MODE:
+5 -11
drivers/infiniband/ulp/srp/ib_srp.c
··· 2784 2784 u32 tag; 2785 2785 u16 ch_idx; 2786 2786 struct srp_rdma_ch *ch; 2787 - int ret; 2788 2787 2789 2788 shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n"); 2790 2789 ··· 2797 2798 shost_printk(KERN_ERR, target->scsi_host, 2798 2799 "Sending SRP abort for tag %#x\n", tag); 2799 2800 if (srp_send_tsk_mgmt(ch, tag, scmnd->device->lun, 2800 - SRP_TSK_ABORT_TASK, NULL) == 0) 2801 - ret = SUCCESS; 2802 - else if (target->rport->state == SRP_RPORT_LOST) 2803 - ret = FAST_IO_FAIL; 2804 - else 2805 - ret = FAILED; 2806 - if (ret == SUCCESS) { 2801 + SRP_TSK_ABORT_TASK, NULL) == 0) { 2807 2802 srp_free_req(ch, req, scmnd, 0); 2808 - scmnd->result = DID_ABORT << 16; 2809 - scsi_done(scmnd); 2803 + return SUCCESS; 2810 2804 } 2805 + if (target->rport->state == SRP_RPORT_LOST) 2806 + return FAST_IO_FAIL; 2811 2807 2812 - return ret; 2808 + return FAILED; 2813 2809 } 2814 2810 2815 2811 static int srp_reset_device(struct scsi_cmnd *scmnd)
+4
drivers/irqchip/irq-gic-common.h
··· 29 29 void gic_enable_of_quirks(const struct device_node *np, 30 30 const struct gic_quirk *quirks, void *data); 31 31 32 + #define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0) 33 + #define RDIST_FLAGS_RD_TABLES_PREALLOCATED (1 << 1) 34 + #define RDIST_FLAGS_FORCE_NON_SHAREABLE (1 << 2) 35 + 32 36 #endif /* _IRQ_GIC_COMMON_H */
+106 -64
drivers/irqchip/irq-gic-v3-its.c
··· 44 44 #define ITS_FLAGS_WORKAROUND_CAVIUM_23144 (1ULL << 2) 45 45 #define ITS_FLAGS_FORCE_NON_SHAREABLE (1ULL << 3) 46 46 47 - #define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0) 48 - #define RDIST_FLAGS_RD_TABLES_PREALLOCATED (1 << 1) 49 - #define RDIST_FLAGS_FORCE_NON_SHAREABLE (1 << 2) 50 - 51 47 #define RD_LOCAL_LPI_ENABLED BIT(0) 52 48 #define RD_LOCAL_PENDTABLE_PREALLOCATED BIT(1) 53 49 #define RD_LOCAL_MEMRESERVE_DONE BIT(2) ··· 4750 4754 return true; 4751 4755 } 4752 4756 4757 + static bool its_set_non_coherent(void *data) 4758 + { 4759 + struct its_node *its = data; 4760 + 4761 + its->flags |= ITS_FLAGS_FORCE_NON_SHAREABLE; 4762 + return true; 4763 + } 4764 + 4753 4765 static const struct gic_quirk its_quirks[] = { 4754 4766 #ifdef CONFIG_CAVIUM_ERRATUM_22375 4755 4767 { ··· 4813 4809 }, 4814 4810 #endif 4815 4811 { 4812 + .desc = "ITS: non-coherent attribute", 4813 + .property = "dma-noncoherent", 4814 + .init = its_set_non_coherent, 4815 + }, 4816 + { 4816 4817 } 4817 4818 }; 4818 4819 ··· 4826 4817 u32 iidr = readl_relaxed(its->base + GITS_IIDR); 4827 4818 4828 4819 gic_enable_quirks(iidr, its_quirks, its); 4820 + 4821 + if (is_of_node(its->fwnode_handle)) 4822 + gic_enable_of_quirks(to_of_node(its->fwnode_handle), 4823 + its_quirks, its); 4829 4824 } 4830 4825 4831 4826 static int its_save_disable(void) ··· 4965 4952 return NULL; 4966 4953 } 4967 4954 4968 - static int its_init_domain(struct fwnode_handle *handle, struct its_node *its) 4955 + static int its_init_domain(struct its_node *its) 4969 4956 { 4970 4957 struct irq_domain *inner_domain; 4971 4958 struct msi_domain_info *info; ··· 4979 4966 4980 4967 inner_domain = irq_domain_create_hierarchy(its_parent, 4981 4968 its->msi_domain_flags, 0, 4982 - handle, &its_domain_ops, 4969 + its->fwnode_handle, &its_domain_ops, 4983 4970 info); 4984 4971 if (!inner_domain) { 4985 4972 kfree(info); ··· 5030 5017 return 0; 5031 5018 } 5032 5019 5033 - static int __init its_compute_its_list_map(struct resource *res, 5034 - void __iomem *its_base) 5020 + static int __init its_compute_its_list_map(struct its_node *its) 5035 5021 { 5036 5022 int its_number; 5037 5023 u32 ctlr; ··· 5044 5032 its_number = find_first_zero_bit(&its_list_map, GICv4_ITS_LIST_MAX); 5045 5033 if (its_number >= GICv4_ITS_LIST_MAX) { 5046 5034 pr_err("ITS@%pa: No ITSList entry available!\n", 5047 - &res->start); 5035 + &its->phys_base); 5048 5036 return -EINVAL; 5049 5037 } 5050 5038 5051 - ctlr = readl_relaxed(its_base + GITS_CTLR); 5039 + ctlr = readl_relaxed(its->base + GITS_CTLR); 5052 5040 ctlr &= ~GITS_CTLR_ITS_NUMBER; 5053 5041 ctlr |= its_number << GITS_CTLR_ITS_NUMBER_SHIFT; 5054 - writel_relaxed(ctlr, its_base + GITS_CTLR); 5055 - ctlr = readl_relaxed(its_base + GITS_CTLR); 5042 + writel_relaxed(ctlr, its->base + GITS_CTLR); 5043 + ctlr = readl_relaxed(its->base + GITS_CTLR); 5056 5044 if ((ctlr & GITS_CTLR_ITS_NUMBER) != (its_number << GITS_CTLR_ITS_NUMBER_SHIFT)) { 5057 5045 its_number = ctlr & GITS_CTLR_ITS_NUMBER; 5058 5046 its_number >>= GITS_CTLR_ITS_NUMBER_SHIFT; ··· 5060 5048 5061 5049 if (test_and_set_bit(its_number, &its_list_map)) { 5062 5050 pr_err("ITS@%pa: Duplicate ITSList entry %d\n", 5063 - &res->start, its_number); 5051 + &its->phys_base, its_number); 5064 5052 return -EINVAL; 5065 5053 } 5066 5054 5067 5055 return its_number; 5068 5056 } 5069 5057 5070 - static int __init its_probe_one(struct resource *res, 5071 - struct fwnode_handle *handle, int numa_node) 5058 + static int __init its_probe_one(struct its_node *its) 5072 5059 { 5073 - struct its_node *its; 5074 - void __iomem *its_base; 5075 - u64 baser, tmp, typer; 5060 + u64 baser, tmp; 5076 5061 struct page *page; 5077 5062 u32 ctlr; 5078 5063 int err; 5079 5064 5080 - its_base = its_map_one(res, &err); 5081 - if (!its_base) 5082 - return err; 5083 - 5084 - pr_info("ITS %pR\n", res); 5085 - 5086 - its = kzalloc(sizeof(*its), GFP_KERNEL); 5087 - if (!its) { 5088 - err = -ENOMEM; 5089 - goto out_unmap; 5090 - } 5091 - 5092 - raw_spin_lock_init(&its->lock); 5093 - mutex_init(&its->dev_alloc_lock); 5094 - INIT_LIST_HEAD(&its->entry); 5095 - INIT_LIST_HEAD(&its->its_device_list); 5096 - typer = gic_read_typer(its_base + GITS_TYPER); 5097 - its->typer = typer; 5098 - its->base = its_base; 5099 - its->phys_base = res->start; 5100 5065 if (is_v4(its)) { 5101 - if (!(typer & GITS_TYPER_VMOVP)) { 5102 - err = its_compute_its_list_map(res, its_base); 5066 + if (!(its->typer & GITS_TYPER_VMOVP)) { 5067 + err = its_compute_its_list_map(its); 5103 5068 if (err < 0) 5104 - goto out_free_its; 5069 + goto out; 5105 5070 5106 5071 its->list_nr = err; 5107 5072 5108 5073 pr_info("ITS@%pa: Using ITS number %d\n", 5109 - &res->start, err); 5074 + &its->phys_base, err); 5110 5075 } else { 5111 - pr_info("ITS@%pa: Single VMOVP capable\n", &res->start); 5076 + pr_info("ITS@%pa: Single VMOVP capable\n", &its->phys_base); 5112 5077 } 5113 5078 5114 5079 if (is_v4_1(its)) { 5115 - u32 svpet = FIELD_GET(GITS_TYPER_SVPET, typer); 5080 + u32 svpet = FIELD_GET(GITS_TYPER_SVPET, its->typer); 5116 5081 5117 - its->sgir_base = ioremap(res->start + SZ_128K, SZ_64K); 5082 + its->sgir_base = ioremap(its->phys_base + SZ_128K, SZ_64K); 5118 5083 if (!its->sgir_base) { 5119 5084 err = -ENOMEM; 5120 - goto out_free_its; 5085 + goto out; 5121 5086 } 5122 5087 5123 - its->mpidr = readl_relaxed(its_base + GITS_MPIDR); 5088 + its->mpidr = readl_relaxed(its->base + GITS_MPIDR); 5124 5089 5125 5090 pr_info("ITS@%pa: Using GICv4.1 mode %08x %08x\n", 5126 - &res->start, its->mpidr, svpet); 5091 + &its->phys_base, its->mpidr, svpet); 5127 5092 } 5128 5093 } 5129 - 5130 - its->numa_node = numa_node; 5131 5094 5132 5095 page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO, 5133 5096 get_order(ITS_CMD_QUEUE_SZ)); ··· 5112 5125 } 5113 5126 its->cmd_base = (void *)page_address(page); 5114 5127 its->cmd_write = its->cmd_base; 5115 - its->fwnode_handle = handle; 5116 5128 its->get_msi_base = its_irq_get_msi_base; 5117 5129 its->msi_domain_flags = IRQ_DOMAIN_FLAG_ISOLATED_MSI; 5118 - 5119 - its_enable_quirks(its); 5120 5130 5121 5131 err = its_alloc_tables(its); 5122 5132 if (err) ··· 5158 5174 ctlr |= GITS_CTLR_ImDe; 5159 5175 writel_relaxed(ctlr, its->base + GITS_CTLR); 5160 5176 5161 - err = its_init_domain(handle, its); 5177 + err = its_init_domain(its); 5162 5178 if (err) 5163 5179 goto out_free_tables; 5164 5180 ··· 5175 5191 out_unmap_sgir: 5176 5192 if (its->sgir_base) 5177 5193 iounmap(its->sgir_base); 5178 - out_free_its: 5179 - kfree(its); 5180 - out_unmap: 5181 - iounmap(its_base); 5182 - pr_err("ITS@%pa: failed probing (%d)\n", &res->start, err); 5194 + out: 5195 + pr_err("ITS@%pa: failed probing (%d)\n", &its->phys_base, err); 5183 5196 return err; 5184 5197 } 5185 5198 ··· 5337 5356 {}, 5338 5357 }; 5339 5358 5359 + static struct its_node __init *its_node_init(struct resource *res, 5360 + struct fwnode_handle *handle, int numa_node) 5361 + { 5362 + void __iomem *its_base; 5363 + struct its_node *its; 5364 + int err; 5365 + 5366 + its_base = its_map_one(res, &err); 5367 + if (!its_base) 5368 + return NULL; 5369 + 5370 + pr_info("ITS %pR\n", res); 5371 + 5372 + its = kzalloc(sizeof(*its), GFP_KERNEL); 5373 + if (!its) 5374 + goto out_unmap; 5375 + 5376 + raw_spin_lock_init(&its->lock); 5377 + mutex_init(&its->dev_alloc_lock); 5378 + INIT_LIST_HEAD(&its->entry); 5379 + INIT_LIST_HEAD(&its->its_device_list); 5380 + 5381 + its->typer = gic_read_typer(its_base + GITS_TYPER); 5382 + its->base = its_base; 5383 + its->phys_base = res->start; 5384 + 5385 + its->numa_node = numa_node; 5386 + its->fwnode_handle = handle; 5387 + 5388 + return its; 5389 + 5390 + out_unmap: 5391 + iounmap(its_base); 5392 + return NULL; 5393 + } 5394 + 5395 + static void its_node_destroy(struct its_node *its) 5396 + { 5397 + iounmap(its->base); 5398 + kfree(its); 5399 + } 5400 + 5340 5401 static int __init its_of_probe(struct device_node *node) 5341 5402 { 5342 5403 struct device_node *np; 5343 5404 struct resource res; 5405 + int err; 5344 5406 5345 5407 /* 5346 5408 * Make sure *all* the ITS are reset before we probe any, as ··· 5393 5369 */ 5394 5370 for (np = of_find_matching_node(node, its_device_id); np; 5395 5371 np = of_find_matching_node(np, its_device_id)) { 5396 - int err; 5397 - 5398 5372 if (!of_device_is_available(np) || 5399 5373 !of_property_read_bool(np, "msi-controller") || 5400 5374 of_address_to_resource(np, 0, &res)) ··· 5405 5383 5406 5384 for (np = of_find_matching_node(node, its_device_id); np; 5407 5385 np = of_find_matching_node(np, its_device_id)) { 5386 + struct its_node *its; 5387 + 5408 5388 if (!of_device_is_available(np)) 5409 5389 continue; 5410 5390 if (!of_property_read_bool(np, "msi-controller")) { ··· 5420 5396 continue; 5421 5397 } 5422 5398 5423 - its_probe_one(&res, &np->fwnode, of_node_to_nid(np)); 5399 + 5400 + its = its_node_init(&res, &np->fwnode, of_node_to_nid(np)); 5401 + if (!its) 5402 + return -ENOMEM; 5403 + 5404 + its_enable_quirks(its); 5405 + err = its_probe_one(its); 5406 + if (err) { 5407 + its_node_destroy(its); 5408 + return err; 5409 + } 5424 5410 } 5425 5411 return 0; 5426 5412 } ··· 5542 5508 { 5543 5509 struct acpi_madt_generic_translator *its_entry; 5544 5510 struct fwnode_handle *dom_handle; 5511 + struct its_node *its; 5545 5512 struct resource res; 5546 5513 int err; 5547 5514 ··· 5567 5532 goto dom_err; 5568 5533 } 5569 5534 5570 - err = its_probe_one(&res, dom_handle, 5571 - acpi_get_its_numa_node(its_entry->translation_id)); 5535 + its = its_node_init(&res, dom_handle, 5536 + acpi_get_its_numa_node(its_entry->translation_id)); 5537 + if (!its) { 5538 + err = -ENOMEM; 5539 + goto node_err; 5540 + } 5541 + 5542 + err = its_probe_one(its); 5572 5543 if (!err) 5573 5544 return 0; 5574 5545 5546 + node_err: 5575 5547 iort_deregister_domain_token(its_entry->translation_id); 5576 5548 dom_err: 5577 5549 irq_domain_free_fwnode(dom_handle);
+13
drivers/irqchip/irq-gic-v3.c
··· 1857 1857 return true; 1858 1858 } 1859 1859 1860 + static bool rd_set_non_coherent(void *data) 1861 + { 1862 + struct gic_chip_data *d = data; 1863 + 1864 + d->rdists.flags |= RDIST_FLAGS_FORCE_NON_SHAREABLE; 1865 + return true; 1866 + } 1867 + 1860 1868 static const struct gic_quirk gic_quirks[] = { 1861 1869 { 1862 1870 .desc = "GICv3: Qualcomm MSM8996 broken firmware", ··· 1930 1922 .iidr = 0x0402043b, 1931 1923 .mask = 0xff0f0fff, 1932 1924 .init = gic_enable_quirk_arm64_2941627, 1925 + }, 1926 + { 1927 + .desc = "GICv3: non-coherent attribute", 1928 + .property = "dma-noncoherent", 1929 + .init = rd_set_non_coherent, 1933 1930 }, 1934 1931 { 1935 1932 }
+2 -2
drivers/irqchip/irq-renesas-rzg2l.c
··· 118 118 119 119 raw_spin_lock(&priv->lock); 120 120 reg = readl_relaxed(priv->base + TSSR(tssr_index)); 121 - reg &= ~(TSSEL_MASK << tssr_offset); 121 + reg &= ~(TSSEL_MASK << TSSEL_SHIFT(tssr_offset)); 122 122 writel_relaxed(reg, priv->base + TSSR(tssr_index)); 123 123 raw_spin_unlock(&priv->lock); 124 124 } ··· 130 130 unsigned int hw_irq = irqd_to_hwirq(d); 131 131 132 132 if (hw_irq >= IRQC_TINT_START && hw_irq < IRQC_NUM_IRQ) { 133 + unsigned long tint = (uintptr_t)irq_data_get_irq_chip_data(d); 133 134 struct rzg2l_irqc_priv *priv = irq_data_to_priv(d); 134 - unsigned long tint = (uintptr_t)d->chip_data; 135 135 u32 offset = hw_irq - IRQC_TINT_START; 136 136 u32 tssr_offset = TSSR_OFFSET(offset); 137 137 u8 tssr_index = TSSR_INDEX(offset);
+9 -1
drivers/irqchip/irq-riscv-intc.c
··· 155 155 * for each INTC DT node. We only need to do INTC initialization 156 156 * for the INTC DT node belonging to boot CPU (or boot HART). 157 157 */ 158 - if (riscv_hartid_to_cpuid(hartid) != smp_processor_id()) 158 + if (riscv_hartid_to_cpuid(hartid) != smp_processor_id()) { 159 + /* 160 + * The INTC nodes of each CPU are suppliers for downstream 161 + * interrupt controllers (such as PLIC, IMSIC and APLIC 162 + * direct-mode) so we should mark an INTC node as initialized 163 + * if we are not creating IRQ domain for it. 164 + */ 165 + fwnode_dev_initialized(of_fwnode_handle(node), true); 159 166 return 0; 167 + } 160 168 161 169 return riscv_intc_init_common(of_node_to_fwnode(node)); 162 170 }
+1
drivers/irqchip/irq-stm32-exti.c
··· 460 460 .map = irq_map_generic_chip, 461 461 .alloc = stm32_exti_alloc, 462 462 .free = stm32_exti_free, 463 + .xlate = irq_domain_xlate_twocell, 463 464 }; 464 465 465 466 static void stm32_irq_ack(struct irq_data *d)
+51 -18
drivers/irqchip/qcom-pdc.c
··· 22 22 23 23 #define PDC_MAX_GPIO_IRQS 256 24 24 25 + /* Valid only on HW version < 3.2 */ 25 26 #define IRQ_ENABLE_BANK 0x10 26 27 #define IRQ_i_CFG 0x110 28 + 29 + /* Valid only on HW version >= 3.2 */ 30 + #define IRQ_i_CFG_IRQ_ENABLE 3 31 + 32 + #define IRQ_i_CFG_TYPE_MASK GENMASK(2, 0) 33 + 34 + #define PDC_VERSION_REG 0x1000 35 + 36 + /* Notable PDC versions */ 37 + #define PDC_VERSION_3_2 0x30200 27 38 28 39 struct pdc_pin_region { 29 40 u32 pin_base; ··· 48 37 static void __iomem *pdc_base; 49 38 static struct pdc_pin_region *pdc_region; 50 39 static int pdc_region_cnt; 40 + static unsigned int pdc_version; 51 41 52 42 static void pdc_reg_write(int reg, u32 i, u32 val) 53 43 { ··· 60 48 return readl_relaxed(pdc_base + reg + i * sizeof(u32)); 61 49 } 62 50 51 + static void __pdc_enable_intr(int pin_out, bool on) 52 + { 53 + unsigned long enable; 54 + 55 + if (pdc_version < PDC_VERSION_3_2) { 56 + u32 index, mask; 57 + 58 + index = pin_out / 32; 59 + mask = pin_out % 32; 60 + 61 + enable = pdc_reg_read(IRQ_ENABLE_BANK, index); 62 + __assign_bit(mask, &enable, on); 63 + pdc_reg_write(IRQ_ENABLE_BANK, index, enable); 64 + } else { 65 + enable = pdc_reg_read(IRQ_i_CFG, pin_out); 66 + __assign_bit(IRQ_i_CFG_IRQ_ENABLE, &enable, on); 67 + pdc_reg_write(IRQ_i_CFG, pin_out, enable); 68 + } 69 + } 70 + 63 71 static void pdc_enable_intr(struct irq_data *d, bool on) 64 72 { 65 - int pin_out = d->hwirq; 66 - unsigned long enable; 67 73 unsigned long flags; 68 - u32 index, mask; 69 - 70 - index = pin_out / 32; 71 - mask = pin_out % 32; 72 74 73 75 raw_spin_lock_irqsave(&pdc_lock, flags); 74 - enable = pdc_reg_read(IRQ_ENABLE_BANK, index); 75 - __assign_bit(mask, &enable, on); 76 - pdc_reg_write(IRQ_ENABLE_BANK, index, enable); 76 + __pdc_enable_intr(d->hwirq, on); 77 77 raw_spin_unlock_irqrestore(&pdc_lock, flags); 78 78 } 79 79 ··· 166 142 } 167 143 168 144 old_pdc_type = pdc_reg_read(IRQ_i_CFG, d->hwirq); 145 + pdc_type |= (old_pdc_type & ~IRQ_i_CFG_TYPE_MASK); 169 146 pdc_reg_write(IRQ_i_CFG, d->hwirq, pdc_type); 170 147 171 148 ret = irq_chip_set_type_parent(d, type); ··· 271 246 static int pdc_setup_pin_mapping(struct device_node *np) 272 247 { 273 248 int ret, n, i; 274 - u32 irq_index, reg_index, val; 275 249 276 250 n = of_property_count_elems_of_size(np, "qcom,pdc-ranges", sizeof(u32)); 277 251 if (n <= 0 || n % 3) ··· 300 276 if (ret) 301 277 return ret; 302 278 303 - for (i = 0; i < pdc_region[n].cnt; i++) { 304 - reg_index = (i + pdc_region[n].pin_base) >> 5; 305 - irq_index = (i + pdc_region[n].pin_base) & 0x1f; 306 - val = pdc_reg_read(IRQ_ENABLE_BANK, reg_index); 307 - val &= ~BIT(irq_index); 308 - pdc_reg_write(IRQ_ENABLE_BANK, reg_index, val); 309 - } 279 + for (i = 0; i < pdc_region[n].cnt; i++) 280 + __pdc_enable_intr(i + pdc_region[n].pin_base, 0); 310 281 } 311 282 312 283 return 0; 313 284 } 314 285 286 + #define QCOM_PDC_SIZE 0x30000 287 + 315 288 static int qcom_pdc_init(struct device_node *node, struct device_node *parent) 316 289 { 317 290 struct irq_domain *parent_domain, *pdc_domain; 291 + resource_size_t res_size; 292 + struct resource res; 318 293 int ret; 319 294 320 - pdc_base = of_iomap(node, 0); 295 + /* compat with old sm8150 DT which had very small region for PDC */ 296 + if (of_address_to_resource(node, 0, &res)) 297 + return -EINVAL; 298 + 299 + res_size = max_t(resource_size_t, resource_size(&res), QCOM_PDC_SIZE); 300 + if (res_size > resource_size(&res)) 301 + pr_warn("%pOF: invalid reg size, please fix DT\n", node); 302 + 303 + pdc_base = ioremap(res.start, res_size); 321 304 if (!pdc_base) { 322 305 pr_err("%pOF: unable to map PDC registers\n", node); 323 306 return -ENXIO; 324 307 } 308 + 309 + pdc_version = pdc_reg_read(PDC_VERSION_REG, 0); 325 310 326 311 parent_domain = irq_find_host(parent); 327 312 if (!parent_domain) {
+2 -1
drivers/md/dm-crypt.c
··· 753 753 int err; 754 754 u8 *buf; 755 755 756 - reqsize = ALIGN(crypto_skcipher_reqsize(tfm), __alignof__(__le64)); 756 + reqsize = sizeof(*req) + crypto_skcipher_reqsize(tfm); 757 + reqsize = ALIGN(reqsize, __alignof__(__le64)); 757 758 758 759 req = kmalloc(reqsize + cc->iv_size, GFP_NOIO); 759 760 if (!req)
+7 -8
drivers/md/dm-zoned-target.c
··· 748 748 /* 749 749 * Cleanup zoned device information. 750 750 */ 751 - static void dmz_put_zoned_device(struct dm_target *ti) 751 + static void dmz_put_zoned_devices(struct dm_target *ti) 752 752 { 753 753 struct dmz_target *dmz = ti->private; 754 754 int i; 755 755 756 - for (i = 0; i < dmz->nr_ddevs; i++) { 757 - if (dmz->ddev[i]) { 756 + for (i = 0; i < dmz->nr_ddevs; i++) 757 + if (dmz->ddev[i]) 758 758 dm_put_device(ti, dmz->ddev[i]); 759 - dmz->ddev[i] = NULL; 760 - } 761 - } 759 + 760 + kfree(dmz->ddev); 762 761 } 763 762 764 763 static int dmz_fixup_devices(struct dm_target *ti) ··· 947 948 err_meta: 948 949 dmz_dtr_metadata(dmz->metadata); 949 950 err_dev: 950 - dmz_put_zoned_device(ti); 951 + dmz_put_zoned_devices(ti); 951 952 err: 952 953 kfree(dmz->dev); 953 954 kfree(dmz); ··· 977 978 978 979 bioset_exit(&dmz->bio_set); 979 980 980 - dmz_put_zoned_device(ti); 981 + dmz_put_zoned_devices(ti); 981 982 982 983 mutex_destroy(&dmz->chunk_lock); 983 984
+7
drivers/md/raid5.c
··· 854 854 855 855 set_bit(R5_INACTIVE_BLOCKED, &conf->cache_state); 856 856 r5l_wake_reclaim(conf->log, 0); 857 + 858 + /* release batch_last before wait to avoid risk of deadlock */ 859 + if (ctx && ctx->batch_last) { 860 + raid5_release_stripe(ctx->batch_last); 861 + ctx->batch_last = NULL; 862 + } 863 + 857 864 wait_event_lock_irq(conf->wait_for_stripe, 858 865 is_inactive_blocked(conf, hash), 859 866 *(conf->hash_locks + hash));
+15 -7
drivers/media/pci/intel/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - config IPU_BRIDGE 3 - tristate 4 - depends on I2C && ACPI 5 - help 6 - This is a helper module for the IPU bridge, which can be 7 - used by ipu3 and other drivers. In order to handle module 8 - dependencies, this is selected by each driver that needs it. 9 2 10 3 source "drivers/media/pci/intel/ipu3/Kconfig" 11 4 source "drivers/media/pci/intel/ivsc/Kconfig" 5 + 6 + config IPU_BRIDGE 7 + tristate "Intel IPU Bridge" 8 + depends on I2C && ACPI 9 + help 10 + The IPU bridge is a helper library for Intel IPU drivers to 11 + function on systems shipped with Windows. 12 + 13 + Currently used by the ipu3-cio2 and atomisp drivers. 14 + 15 + Supported systems include: 16 + 17 + - Microsoft Surface models (except Surface Pro 3) 18 + - The Lenovo Miix line (for example the 510, 520, 710 and 720) 19 + - Dell 7285
+1 -20
drivers/media/pci/intel/ipu3/Kconfig
··· 2 2 config VIDEO_IPU3_CIO2 3 3 tristate "Intel ipu3-cio2 driver" 4 4 depends on VIDEO_DEV && PCI 5 + depends on IPU_BRIDGE || !IPU_BRIDGE 5 6 depends on ACPI || COMPILE_TEST 6 7 depends on X86 7 8 select MEDIA_CONTROLLER 8 9 select VIDEO_V4L2_SUBDEV_API 9 10 select V4L2_FWNODE 10 11 select VIDEOBUF2_DMA_SG 11 - select IPU_BRIDGE if CIO2_BRIDGE 12 12 13 13 help 14 14 This is the Intel IPU3 CIO2 CSI-2 receiver unit, found in Intel ··· 18 18 Say Y or M here if you have a Skylake/Kaby Lake SoC with MIPI CSI-2 19 19 connected camera. 20 20 The module will be called ipu3-cio2. 21 - 22 - config CIO2_BRIDGE 23 - bool "IPU3 CIO2 Sensors Bridge" 24 - depends on VIDEO_IPU3_CIO2 && ACPI 25 - depends on I2C 26 - help 27 - This extension provides an API for the ipu3-cio2 driver to create 28 - connections to cameras that are hidden in the SSDB buffer in ACPI. 29 - It can be used to enable support for cameras in detachable / hybrid 30 - devices that ship with Windows. 31 - 32 - Say Y here if your device is a detachable / hybrid laptop that comes 33 - with Windows installed by the OEM, for example: 34 - 35 - - Microsoft Surface models (except Surface Pro 3) 36 - - The Lenovo Miix line (for example the 510, 520, 710 and 720) 37 - - Dell 7285 38 - 39 - If in doubt, say N here.
+1 -1
drivers/media/pci/intel/ivsc/Kconfig
··· 6 6 depends on INTEL_MEI && ACPI && VIDEO_DEV 7 7 select MEDIA_CONTROLLER 8 8 select VIDEO_V4L2_SUBDEV_API 9 - select V4L2_ASYNC 9 + select V4L2_FWNODE 10 10 help 11 11 This adds support for Intel Visual Sensing Controller (IVSC). 12 12
+1 -1
drivers/media/platform/intel/pxa_camera.c
··· 2398 2398 PXA_CAM_DRV_NAME, pcdev); 2399 2399 if (err) { 2400 2400 dev_err(&pdev->dev, "Camera interrupt register failed\n"); 2401 - goto exit_v4l2_device_unregister; 2401 + goto exit_deactivate; 2402 2402 } 2403 2403 2404 2404 pcdev->notifier.ops = &pxa_camera_sensor_ops;
+2 -1
drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c
··· 138 138 vpu->ctx->vpu_inst = vpu; 139 139 140 140 status = mtk_vcodec_fw_ipi_register(vpu->ctx->dev->fw_handler, vpu->id, 141 - vpu_enc_ipi_handler, "venc", NULL); 141 + vpu_enc_ipi_handler, "venc", 142 + vpu->ctx->dev); 142 143 143 144 if (status) { 144 145 mtk_venc_err(vpu->ctx, "vpu_ipi_register fail %d", status);
+1 -1
drivers/net/can/Kconfig
··· 191 191 192 192 config CAN_SUN4I 193 193 tristate "Allwinner A10 CAN controller" 194 - depends on MACH_SUN4I || MACH_SUN7I || RISCV || COMPILE_TEST 194 + depends on MACH_SUN4I || MACH_SUN7I || (RISCV && ARCH_SUNXI) || COMPILE_TEST 195 195 help 196 196 Say Y here if you want to use CAN controller found on Allwinner 197 197 A10/A20/D1 SoCs.
+13 -33
drivers/net/can/flexcan/flexcan-core.c
··· 348 348 static struct flexcan_devtype_data fsl_imx93_devtype_data = { 349 349 .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | 350 350 FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_RX_MAILBOX | 351 - FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_AUTO_STOP_MODE | 351 + FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR | 352 352 FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC | 353 353 FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX | 354 354 FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR, ··· 544 544 } else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR) { 545 545 regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, 546 546 1 << priv->stm.req_bit, 1 << priv->stm.req_bit); 547 - } else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE) { 548 - /* For the auto stop mode, software do nothing, hardware will cover 549 - * all the operation automatically after system go into low power mode. 550 - */ 551 - return 0; 552 547 } 553 548 554 549 return flexcan_low_power_enter_ack(priv); ··· 568 573 reg_mcr = priv->read(&regs->mcr); 569 574 reg_mcr &= ~FLEXCAN_MCR_SLF_WAK; 570 575 priv->write(reg_mcr, &regs->mcr); 571 - 572 - /* For the auto stop mode, hardware will exist stop mode 573 - * automatically after system go out of low power mode. 574 - */ 575 - if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE) 576 - return 0; 577 576 578 577 return flexcan_low_power_exit_ack(priv); 579 578 } ··· 1983 1994 ret = flexcan_setup_stop_mode_scfw(pdev); 1984 1995 else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR) 1985 1996 ret = flexcan_setup_stop_mode_gpr(pdev); 1986 - else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE) 1987 - ret = 0; 1988 1997 else 1989 1998 /* return 0 directly if doesn't support stop mode feature */ 1990 1999 return 0; 1991 2000 1992 - if (ret) 2001 + /* If ret is -EINVAL, this means SoC claim to support stop mode, but 2002 + * dts file lack the stop mode property definition. For this case, 2003 + * directly return 0, this will skip the wakeup capable setting and 2004 + * will not block the driver probe. 2005 + */ 2006 + if (ret == -EINVAL) 2007 + return 0; 2008 + else if (ret) 1993 2009 return ret; 1994 2010 1995 2011 device_set_wakeup_capable(&pdev->dev, true); ··· 2314 2320 if (netif_running(dev)) { 2315 2321 int err; 2316 2322 2317 - if (device_may_wakeup(device)) { 2323 + if (device_may_wakeup(device)) 2318 2324 flexcan_enable_wakeup_irq(priv, true); 2319 - /* For auto stop mode, need to keep the clock on before 2320 - * system go into low power mode. After system go into 2321 - * low power mode, hardware will config the flexcan into 2322 - * stop mode, and gate off the clock automatically. 2323 - */ 2324 - if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE) 2325 - return 0; 2326 - } 2327 2325 2328 2326 err = pm_runtime_force_suspend(device); 2329 2327 if (err) ··· 2333 2347 if (netif_running(dev)) { 2334 2348 int err; 2335 2349 2336 - /* For the wakeup in auto stop mode, no need to gate on the 2337 - * clock here, hardware will do this automatically. 2338 - */ 2339 - if (!(device_may_wakeup(device) && 2340 - priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)) { 2341 - err = pm_runtime_force_resume(device); 2342 - if (err) 2343 - return err; 2344 - } 2350 + err = pm_runtime_force_resume(device); 2351 + if (err) 2352 + return err; 2345 2353 2346 2354 if (device_may_wakeup(device)) 2347 2355 flexcan_enable_wakeup_irq(priv, false);
-2
drivers/net/can/flexcan/flexcan.h
··· 68 68 #define FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR BIT(15) 69 69 /* Device supports RX via FIFO */ 70 70 #define FLEXCAN_QUIRK_SUPPORT_RX_FIFO BIT(16) 71 - /* auto enter stop mode to support wakeup */ 72 - #define FLEXCAN_QUIRK_AUTO_STOP_MODE BIT(17) 73 71 74 72 struct flexcan_devtype_data { 75 73 u32 quirks; /* quirks needed for different IP cores */
+1 -1
drivers/net/can/m_can/tcan4x5x-core.c
··· 125 125 }, 126 126 [TCAN4553] = { 127 127 .name = "4553", 128 - .id2_register = 0x32353534, 128 + .id2_register = 0x33353534, 129 129 }, 130 130 /* generic version with no id2_register at the end */ 131 131 [TCAN4X5X] = {
+7 -1
drivers/net/can/sja1000/sja1000.c
··· 392 392 struct net_device *dev = (struct net_device *)dev_id; 393 393 394 394 netdev_dbg(dev, "performing a soft reset upon overrun\n"); 395 - sja1000_start(dev); 395 + 396 + netif_tx_lock(dev); 397 + 398 + can_free_echo_skb(dev, 0, NULL); 399 + sja1000_set_mode(dev, CAN_MODE_START); 400 + 401 + netif_tx_unlock(dev); 396 402 397 403 return IRQ_HANDLED; 398 404 }
+13 -2
drivers/net/dsa/qca/qca8k-8xxx.c
··· 505 505 void *val_buf, size_t val_len) 506 506 { 507 507 int i, count = val_len / sizeof(u32), ret; 508 - u32 reg = *(u32 *)reg_buf & U16_MAX; 509 508 struct qca8k_priv *priv = ctx; 509 + u32 reg = *(u16 *)reg_buf; 510 510 511 511 if (priv->mgmt_master && 512 512 !qca8k_read_eth(priv, reg, val_buf, val_len)) ··· 527 527 const void *val_buf, size_t val_len) 528 528 { 529 529 int i, count = val_len / sizeof(u32), ret; 530 - u32 reg = *(u32 *)reg_buf & U16_MAX; 531 530 struct qca8k_priv *priv = ctx; 531 + u32 reg = *(u16 *)reg_buf; 532 532 u32 *val = (u32 *)val_buf; 533 533 534 534 if (priv->mgmt_master && ··· 666 666 goto err_read_skb; 667 667 } 668 668 669 + /* It seems that accessing the switch's internal PHYs via management 670 + * packets still uses the MDIO bus within the switch internally, and 671 + * these accesses can conflict with external MDIO accesses to other 672 + * devices on the MDIO bus. 673 + * We therefore need to lock the MDIO bus onto which the switch is 674 + * connected. 675 + */ 676 + mutex_lock(&priv->bus->mdio_lock); 677 + 669 678 /* Actually start the request: 670 679 * 1. Send mdio master packet 671 680 * 2. Busy Wait for mdio master command ··· 687 678 mgmt_master = priv->mgmt_master; 688 679 if (!mgmt_master) { 689 680 mutex_unlock(&mgmt_eth_data->mutex); 681 + mutex_unlock(&priv->bus->mdio_lock); 690 682 ret = -EINVAL; 691 683 goto err_mgmt_master; 692 684 } ··· 775 765 QCA8K_ETHERNET_TIMEOUT); 776 766 777 767 mutex_unlock(&mgmt_eth_data->mutex); 768 + mutex_unlock(&priv->bus->mdio_lock); 778 769 779 770 return ret; 780 771
+32
drivers/net/ethernet/intel/ice/ice_lag.c
··· 2069 2069 } 2070 2070 mutex_unlock(&pf->lag_mutex); 2071 2071 } 2072 + 2073 + /** 2074 + * ice_lag_is_switchdev_running 2075 + * @pf: pointer to PF structure 2076 + * 2077 + * Check if switchdev is running on any of the interfaces connected to lag. 2078 + */ 2079 + bool ice_lag_is_switchdev_running(struct ice_pf *pf) 2080 + { 2081 + struct ice_lag *lag = pf->lag; 2082 + struct net_device *tmp_nd; 2083 + 2084 + if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG) || !lag) 2085 + return false; 2086 + 2087 + rcu_read_lock(); 2088 + for_each_netdev_in_bond_rcu(lag->upper_netdev, tmp_nd) { 2089 + struct ice_netdev_priv *priv = netdev_priv(tmp_nd); 2090 + 2091 + if (!netif_is_ice(tmp_nd) || !priv || !priv->vsi || 2092 + !priv->vsi->back) 2093 + continue; 2094 + 2095 + if (ice_is_switchdev_running(priv->vsi->back)) { 2096 + rcu_read_unlock(); 2097 + return true; 2098 + } 2099 + } 2100 + rcu_read_unlock(); 2101 + 2102 + return false; 2103 + }
+1
drivers/net/ethernet/intel/ice/ice_lag.h
··· 62 62 int ice_init_lag(struct ice_pf *pf); 63 63 void ice_deinit_lag(struct ice_pf *pf); 64 64 void ice_lag_rebuild(struct ice_pf *pf); 65 + bool ice_lag_is_switchdev_running(struct ice_pf *pf); 65 66 #endif /* _ICE_LAG_H_ */
+6
drivers/net/ethernet/intel/ice/ice_lib.c
··· 3562 3562 3563 3563 dev = ice_pf_to_dev(vsi->back); 3564 3564 3565 + if (ice_lag_is_switchdev_running(vsi->back)) { 3566 + dev_dbg(dev, "VSI %d passed is a part of LAG containing interfaces in switchdev mode, nothing to do\n", 3567 + vsi->vsi_num); 3568 + return 0; 3569 + } 3570 + 3565 3571 /* the VSI passed in is already the default VSI */ 3566 3572 if (ice_is_vsi_dflt_vsi(vsi)) { 3567 3573 dev_dbg(dev, "VSI %d passed in is already the default forwarding VSI, nothing to do\n",
+3 -2
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
··· 28 28 struct vf_macvlans *mv_list; 29 29 int num_vf_macvlans, i; 30 30 31 + /* Initialize list of VF macvlans */ 32 + INIT_LIST_HEAD(&adapter->vf_mvs.l); 33 + 31 34 num_vf_macvlans = hw->mac.num_rar_entries - 32 35 (IXGBE_MAX_PF_MACVLANS + 1 + num_vfs); 33 36 if (!num_vf_macvlans) ··· 39 36 mv_list = kcalloc(num_vf_macvlans, sizeof(struct vf_macvlans), 40 37 GFP_KERNEL); 41 38 if (mv_list) { 42 - /* Initialize list of VF macvlans */ 43 - INIT_LIST_HEAD(&adapter->vf_mvs.l); 44 39 for (i = 0; i < num_vf_macvlans; i++) { 45 40 mv_list[i].vf = -1; 46 41 mv_list[i].free = true;
+9 -4
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c
··· 1357 1357 1358 1358 if (netif_running(secy->netdev)) { 1359 1359 /* Keys cannot be changed after creation */ 1360 - err = cn10k_write_tx_sa_pn(pfvf, txsc, sa_num, 1361 - sw_tx_sa->next_pn); 1362 - if (err) 1363 - return err; 1360 + if (ctx->sa.update_pn) { 1361 + err = cn10k_write_tx_sa_pn(pfvf, txsc, sa_num, 1362 + sw_tx_sa->next_pn); 1363 + if (err) 1364 + return err; 1365 + } 1364 1366 1365 1367 err = cn10k_mcs_link_tx_sa2sc(pfvf, secy, txsc, 1366 1368 sa_num, sw_tx_sa->active); ··· 1530 1528 err = cn10k_mcs_write_rx_sa_plcy(pfvf, secy, rxsc, sa_num, sa_in_use); 1531 1529 if (err) 1532 1530 return err; 1531 + 1532 + if (!ctx->sa.update_pn) 1533 + return 0; 1533 1534 1534 1535 err = cn10k_mcs_write_rx_sa_pn(pfvf, rxsc, sa_num, 1535 1536 rx_sa->next_pn);
+1
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
··· 1403 1403 return 0; 1404 1404 } 1405 1405 1406 + pp_params.order = get_order(buf_size); 1406 1407 pp_params.flags = PP_FLAG_PAGE_FRAG | PP_FLAG_DMA_MAP; 1407 1408 pp_params.pool_size = min(OTX2_PAGE_POOL_SZ, numptrs); 1408 1409 pp_params.nid = NUMA_NO_NODE;
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
··· 580 580 goto out; 581 581 } 582 582 583 - if (tx_sa->next_pn != ctx_tx_sa->next_pn_halves.lower) { 583 + if (ctx->sa.update_pn) { 584 584 netdev_err(netdev, "MACsec offload: update TX sa %d PN isn't supported\n", 585 585 assoc_num); 586 586 err = -EINVAL; ··· 973 973 goto out; 974 974 } 975 975 976 - if (rx_sa->next_pn != ctx_rx_sa->next_pn_halves.lower) { 976 + if (ctx->sa.update_pn) { 977 977 netdev_err(ctx->netdev, 978 978 "MACsec offload update RX sa %d PN isn't supported\n", 979 979 assoc_num);
+2 -1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 3952 3952 struct mlx5e_channels *chs = &priv->channels; 3953 3953 struct mlx5e_params new_params; 3954 3954 int err; 3955 + bool rx_ts_over_crc = !enable; 3955 3956 3956 3957 mutex_lock(&priv->state_lock); 3957 3958 3958 3959 new_params = chs->params; 3959 3960 new_params.scatter_fcs_en = enable; 3960 3961 err = mlx5e_safe_switch_params(priv, &new_params, mlx5e_set_rx_port_ts_wrap, 3961 - &new_params.scatter_fcs_en, true); 3962 + &rx_ts_over_crc, true); 3962 3963 mutex_unlock(&priv->state_lock); 3963 3964 return err; 3964 3965 }
+2 -2
drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
··· 310 310 .fdb_clear_offload = mlxsw_sp_nve_vxlan_clear_offload, 311 311 }; 312 312 313 - static bool mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp, 314 - bool learning_en) 313 + static int mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp, 314 + bool learning_en) 315 315 { 316 316 char tnpc_pl[MLXSW_REG_TNPC_LEN]; 317 317
+6 -4
drivers/net/ethernet/netronome/nfp/flower/cmsg.c
··· 210 210 unsigned int msg_len = nfp_flower_cmsg_get_data_len(skb); 211 211 struct nfp_flower_cmsg_merge_hint *msg; 212 212 struct nfp_fl_payload *sub_flows[2]; 213 + struct nfp_flower_priv *priv; 213 214 int err, i, flow_cnt; 214 215 215 216 msg = nfp_flower_cmsg_get_data(skb); ··· 229 228 return; 230 229 } 231 230 232 - rtnl_lock(); 231 + priv = app->priv; 232 + mutex_lock(&priv->nfp_fl_lock); 233 233 for (i = 0; i < flow_cnt; i++) { 234 234 u32 ctx = be32_to_cpu(msg->flow[i].host_ctx); 235 235 236 236 sub_flows[i] = nfp_flower_get_fl_payload_from_ctx(app, ctx); 237 237 if (!sub_flows[i]) { 238 238 nfp_flower_cmsg_warn(app, "Invalid flow in merge hint\n"); 239 - goto err_rtnl_unlock; 239 + goto err_mutex_unlock; 240 240 } 241 241 } 242 242 ··· 246 244 if (err == -ENOMEM) 247 245 nfp_flower_cmsg_warn(app, "Flow merge memory fail.\n"); 248 246 249 - err_rtnl_unlock: 250 - rtnl_unlock(); 247 + err_mutex_unlock: 248 + mutex_unlock(&priv->nfp_fl_lock); 251 249 } 252 250 253 251 static void
+13 -6
drivers/net/ethernet/netronome/nfp/flower/conntrack.c
··· 2131 2131 struct nfp_fl_ct_flow_entry *ct_entry; 2132 2132 struct netlink_ext_ack *extack = NULL; 2133 2133 2134 - ASSERT_RTNL(); 2135 - 2136 2134 extack = flow->common.extack; 2137 2135 switch (flow->command) { 2138 2136 case FLOW_CLS_REPLACE: ··· 2176 2178 2177 2179 switch (type) { 2178 2180 case TC_SETUP_CLSFLOWER: 2179 - rtnl_lock(); 2181 + while (!mutex_trylock(&zt->priv->nfp_fl_lock)) { 2182 + if (!zt->nft) /* avoid deadlock */ 2183 + return err; 2184 + msleep(20); 2185 + } 2180 2186 err = nfp_fl_ct_offload_nft_flow(zt, flow); 2181 - rtnl_unlock(); 2187 + mutex_unlock(&zt->priv->nfp_fl_lock); 2182 2188 break; 2183 2189 default: 2184 2190 return -EOPNOTSUPP; ··· 2210 2208 struct nfp_fl_ct_flow_entry *ct_entry; 2211 2209 struct nfp_fl_ct_zone_entry *zt; 2212 2210 struct rhashtable *m_table; 2211 + struct nf_flowtable *nft; 2213 2212 2214 2213 if (!ct_map_ent) 2215 2214 return -ENOENT; ··· 2229 2226 if (ct_map_ent->cookie > 0) 2230 2227 kfree(ct_map_ent); 2231 2228 2232 - if (!zt->pre_ct_count) { 2233 - zt->nft = NULL; 2229 + if (!zt->pre_ct_count && zt->nft) { 2230 + nft = zt->nft; 2231 + zt->nft = NULL; /* avoid deadlock */ 2232 + nf_flow_table_offload_del_cb(nft, 2233 + nfp_fl_ct_handle_nft_flow, 2234 + zt); 2234 2235 nfp_fl_ct_clean_nft_entries(zt); 2235 2236 } 2236 2237 break;
+2
drivers/net/ethernet/netronome/nfp/flower/main.h
··· 297 297 * @predt_list: List to keep track of decap pretun flows 298 298 * @neigh_table: Table to keep track of neighbor entries 299 299 * @predt_lock: Lock to serialise predt/neigh table updates 300 + * @nfp_fl_lock: Lock to protect the flow offload operation 300 301 */ 301 302 struct nfp_flower_priv { 302 303 struct nfp_app *app; ··· 340 339 struct list_head predt_list; 341 340 struct rhashtable neigh_table; 342 341 spinlock_t predt_lock; /* Lock to serialise predt/neigh table updates */ 342 + struct mutex nfp_fl_lock; /* Protect the flow operation */ 343 343 }; 344 344 345 345 /**
+2
drivers/net/ethernet/netronome/nfp/flower/metadata.c
··· 528 528 if (err) 529 529 goto err_free_stats_ctx_table; 530 530 531 + mutex_init(&priv->nfp_fl_lock); 532 + 531 533 err = rhashtable_init(&priv->ct_zone_table, &nfp_zone_table_params); 532 534 if (err) 533 535 goto err_free_merge_table;
+18 -6
drivers/net/ethernet/netronome/nfp/flower/offload.c
··· 1009 1009 u64 parent_ctx = 0; 1010 1010 int err; 1011 1011 1012 - ASSERT_RTNL(); 1013 - 1014 1012 if (sub_flow1 == sub_flow2 || 1015 1013 nfp_flower_is_merge_flow(sub_flow1) || 1016 1014 nfp_flower_is_merge_flow(sub_flow2)) ··· 1725 1727 nfp_flower_repr_offload(struct nfp_app *app, struct net_device *netdev, 1726 1728 struct flow_cls_offload *flower) 1727 1729 { 1730 + struct nfp_flower_priv *priv = app->priv; 1731 + int ret; 1732 + 1728 1733 if (!eth_proto_is_802_3(flower->common.protocol)) 1729 1734 return -EOPNOTSUPP; 1730 1735 1736 + mutex_lock(&priv->nfp_fl_lock); 1731 1737 switch (flower->command) { 1732 1738 case FLOW_CLS_REPLACE: 1733 - return nfp_flower_add_offload(app, netdev, flower); 1739 + ret = nfp_flower_add_offload(app, netdev, flower); 1740 + break; 1734 1741 case FLOW_CLS_DESTROY: 1735 - return nfp_flower_del_offload(app, netdev, flower); 1742 + ret = nfp_flower_del_offload(app, netdev, flower); 1743 + break; 1736 1744 case FLOW_CLS_STATS: 1737 - return nfp_flower_get_stats(app, netdev, flower); 1745 + ret = nfp_flower_get_stats(app, netdev, flower); 1746 + break; 1738 1747 default: 1739 - return -EOPNOTSUPP; 1748 + ret = -EOPNOTSUPP; 1749 + break; 1740 1750 } 1751 + mutex_unlock(&priv->nfp_fl_lock); 1752 + 1753 + return ret; 1741 1754 } 1742 1755 1743 1756 static int nfp_flower_setup_tc_block_cb(enum tc_setup_type type, ··· 1787 1778 repr_priv = repr->app_priv; 1788 1779 repr_priv->block_shared = f->block_shared; 1789 1780 f->driver_block_list = &nfp_block_cb_list; 1781 + f->unlocked_driver_cb = true; 1790 1782 1791 1783 switch (f->command) { 1792 1784 case FLOW_BLOCK_BIND: ··· 1885 1875 (f->binder_type != FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS && 1886 1876 nfp_flower_internal_port_can_offload(app, netdev))) 1887 1877 return -EOPNOTSUPP; 1878 + 1879 + f->unlocked_driver_cb = true; 1888 1880 1889 1881 switch (f->command) { 1890 1882 case FLOW_BLOCK_BIND:
+13 -7
drivers/net/ethernet/netronome/nfp/flower/qos_conf.c
··· 523 523 { 524 524 struct netlink_ext_ack *extack = flow->common.extack; 525 525 struct nfp_flower_priv *fl_priv = app->priv; 526 + int ret; 526 527 527 528 if (!(fl_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM)) { 528 529 NL_SET_ERR_MSG_MOD(extack, "unsupported offload: loaded firmware does not support qos rate limit offload"); 529 530 return -EOPNOTSUPP; 530 531 } 531 532 533 + mutex_lock(&fl_priv->nfp_fl_lock); 532 534 switch (flow->command) { 533 535 case TC_CLSMATCHALL_REPLACE: 534 - return nfp_flower_install_rate_limiter(app, netdev, flow, 535 - extack); 536 + ret = nfp_flower_install_rate_limiter(app, netdev, flow, extack); 537 + break; 536 538 case TC_CLSMATCHALL_DESTROY: 537 - return nfp_flower_remove_rate_limiter(app, netdev, flow, 538 - extack); 539 + ret = nfp_flower_remove_rate_limiter(app, netdev, flow, extack); 540 + break; 539 541 case TC_CLSMATCHALL_STATS: 540 - return nfp_flower_stats_rate_limiter(app, netdev, flow, 541 - extack); 542 + ret = nfp_flower_stats_rate_limiter(app, netdev, flow, extack); 543 + break; 542 544 default: 543 - return -EOPNOTSUPP; 545 + ret = -EOPNOTSUPP; 546 + break; 544 547 } 548 + mutex_unlock(&fl_priv->nfp_fl_lock); 549 + 550 + return ret; 545 551 } 546 552 547 553 /* Offload tc action, currently only for tc police */
+4 -2
drivers/net/ethernet/renesas/ravb_main.c
··· 2167 2167 of_phy_deregister_fixed_link(np); 2168 2168 } 2169 2169 2170 + cancel_work_sync(&priv->work); 2171 + 2170 2172 if (info->multi_irqs) { 2171 2173 free_irq(priv->tx_irqs[RAVB_NC], ndev); 2172 2174 free_irq(priv->rx_irqs[RAVB_NC], ndev); ··· 2893 2891 clk_disable_unprepare(priv->gptp_clk); 2894 2892 clk_disable_unprepare(priv->refclk); 2895 2893 2896 - dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, 2897 - priv->desc_bat_dma); 2898 2894 /* Set reset mode */ 2899 2895 ravb_write(ndev, CCC_OPC_RESET, CCC); 2900 2896 unregister_netdev(ndev); ··· 2900 2900 netif_napi_del(&priv->napi[RAVB_NC]); 2901 2901 netif_napi_del(&priv->napi[RAVB_BE]); 2902 2902 ravb_mdio_release(priv); 2903 + dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, 2904 + priv->desc_bat_dma); 2903 2905 pm_runtime_put_sync(&pdev->dev); 2904 2906 pm_runtime_disable(&pdev->dev); 2905 2907 reset_control_assert(priv->rstc);
+7 -5
drivers/net/ethernet/renesas/rswitch.c
··· 1254 1254 phy_print_status(phydev); 1255 1255 if (phydev->link) 1256 1256 phy_power_on(rdev->serdes); 1257 - else 1257 + else if (rdev->serdes->power_count) 1258 1258 phy_power_off(rdev->serdes); 1259 1259 1260 1260 rdev->etha->link = phydev->link; ··· 1964 1964 rswitch_gwca_hw_deinit(priv); 1965 1965 rcar_gen4_ptp_unregister(priv->ptp_priv); 1966 1966 1967 - for (i = 0; i < RSWITCH_NUM_PORTS; i++) { 1967 + rswitch_for_each_enabled_port(priv, i) { 1968 1968 struct rswitch_device *rdev = priv->rdev[i]; 1969 1969 1970 - phy_exit(priv->rdev[i]->serdes); 1971 - rswitch_ether_port_deinit_one(rdev); 1972 1970 unregister_netdev(rdev->ndev); 1973 - rswitch_device_free(priv, i); 1971 + rswitch_ether_port_deinit_one(rdev); 1972 + phy_exit(priv->rdev[i]->serdes); 1974 1973 } 1974 + 1975 + for (i = 0; i < RSWITCH_NUM_PORTS; i++) 1976 + rswitch_device_free(priv, i); 1975 1977 1976 1978 rswitch_gwca_ts_queue_free(priv); 1977 1979 rswitch_gwca_linkfix_free(priv);
+3 -14
drivers/net/ieee802154/ca8210.c
··· 2740 2740 struct device_node *np = spi->dev.of_node; 2741 2741 struct ca8210_priv *priv = spi_get_drvdata(spi); 2742 2742 struct ca8210_platform_data *pdata = spi->dev.platform_data; 2743 - int ret = 0; 2744 2743 2745 2744 if (!np) 2746 2745 return -EFAULT; ··· 2756 2757 dev_crit(&spi->dev, "Failed to register external clk\n"); 2757 2758 return PTR_ERR(priv->clk); 2758 2759 } 2759 - ret = of_clk_add_provider(np, of_clk_src_simple_get, priv->clk); 2760 - if (ret) { 2761 - clk_unregister(priv->clk); 2762 - dev_crit( 2763 - &spi->dev, 2764 - "Failed to register external clock as clock provider\n" 2765 - ); 2766 - } else { 2767 - dev_info(&spi->dev, "External clock set as clock provider\n"); 2768 - } 2769 2760 2770 - return ret; 2761 + return of_clk_add_provider(np, of_clk_src_simple_get, priv->clk); 2771 2762 } 2772 2763 2773 2764 /** ··· 2769 2780 { 2770 2781 struct ca8210_priv *priv = spi_get_drvdata(spi); 2771 2782 2772 - if (!priv->clk) 2773 - return 2783 + if (IS_ERR_OR_NULL(priv->clk)) 2784 + return; 2774 2785 2775 2786 of_clk_del_provider(spi->dev.of_node); 2776 2787 clk_unregister(priv->clk);
+2
drivers/net/macsec.c
··· 2383 2383 2384 2384 ctx.sa.assoc_num = assoc_num; 2385 2385 ctx.sa.tx_sa = tx_sa; 2386 + ctx.sa.update_pn = !!prev_pn.full64; 2386 2387 ctx.secy = secy; 2387 2388 2388 2389 ret = macsec_offload(ops->mdo_upd_txsa, &ctx); ··· 2477 2476 2478 2477 ctx.sa.assoc_num = assoc_num; 2479 2478 ctx.sa.rx_sa = rx_sa; 2479 + ctx.sa.update_pn = !!prev_pn.full64; 2480 2480 ctx.secy = secy; 2481 2481 2482 2482 ret = macsec_offload(ops->mdo_upd_rxsa, &ctx);
+6
drivers/net/phy/mscc/mscc_macsec.c
··· 849 849 struct macsec_flow *flow; 850 850 int ret; 851 851 852 + if (ctx->sa.update_pn) 853 + return -EINVAL; 854 + 852 855 flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR); 853 856 if (IS_ERR(flow)) 854 857 return PTR_ERR(flow); ··· 902 899 { 903 900 struct macsec_flow *flow; 904 901 int ret; 902 + 903 + if (ctx->sa.update_pn) 904 + return -EINVAL; 905 905 906 906 flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR); 907 907 if (IS_ERR(flow))
+6 -1
drivers/net/usb/dm9601.c
··· 222 222 struct usbnet *dev = netdev_priv(netdev); 223 223 224 224 __le16 res; 225 + int err; 225 226 226 227 if (phy_id) { 227 228 netdev_dbg(dev->net, "Only internal phy supported\n"); 228 229 return 0; 229 230 } 230 231 231 - dm_read_shared_word(dev, 1, loc, &res); 232 + err = dm_read_shared_word(dev, 1, loc, &res); 233 + if (err < 0) { 234 + netdev_err(dev->net, "MDIO read error: %d\n", err); 235 + return err; 236 + } 232 237 233 238 netdev_dbg(dev->net, 234 239 "dm9601_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n",
-4
drivers/net/xen-netback/interface.c
··· 41 41 #include <asm/xen/hypercall.h> 42 42 #include <xen/balloon.h> 43 43 44 - #define XENVIF_QUEUE_LENGTH 32 45 - 46 44 /* Number of bytes allowed on the internal guest Rx queue. */ 47 45 #define XENVIF_RX_QUEUE_BYTES (XEN_NETIF_RX_RING_SIZE/2 * PAGE_SIZE) 48 46 ··· 527 529 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_FRAGLIST; 528 530 dev->features = dev->hw_features | NETIF_F_RXCSUM; 529 531 dev->ethtool_ops = &xenvif_ethtool_ops; 530 - 531 - dev->tx_queue_len = XENVIF_QUEUE_LENGTH; 532 532 533 533 dev->min_mtu = ETH_MIN_MTU; 534 534 dev->max_mtu = ETH_MAX_MTU - VLAN_ETH_HLEN;
+3 -3
drivers/of/dynamic.c
··· 890 890 { 891 891 struct of_changeset_entry *ce; 892 892 893 + if (WARN_ON(action >= ARRAY_SIZE(action_names))) 894 + return -EINVAL; 895 + 893 896 ce = kzalloc(sizeof(*ce), GFP_KERNEL); 894 897 if (!ce) 895 898 return -ENOMEM; 896 - 897 - if (WARN_ON(action >= ARRAY_SIZE(action_names))) 898 - return -EINVAL; 899 899 900 900 /* get a reference to the node */ 901 901 ce->action = action;
+1 -1
drivers/of/overlay.c
··· 45 45 46 46 /** 47 47 * struct fragment - info about fragment nodes in overlay expanded device tree 48 - * @target: target of the overlay operation 49 48 * @overlay: pointer to the __overlay__ node 49 + * @target: target of the overlay operation 50 50 */ 51 51 struct fragment { 52 52 struct device_node *overlay;
+1 -3
drivers/pci/controller/dwc/pcie-qcom.c
··· 43 43 #define PARF_PHY_REFCLK 0x4c 44 44 #define PARF_CONFIG_BITS 0x50 45 45 #define PARF_DBI_BASE_ADDR 0x168 46 - #define PARF_SLV_ADDR_SPACE_SIZE_2_3_3 0x16c /* Register offset specific to IP ver 2.3.3 */ 47 46 #define PARF_MHI_CLOCK_RESET_CTRL 0x174 48 47 #define PARF_AXI_MSTR_WR_ADDR_HALT 0x178 49 48 #define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1a8 ··· 796 797 u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); 797 798 u32 val; 798 799 799 - writel(SLV_ADDR_SPACE_SZ, 800 - pcie->parf + PARF_SLV_ADDR_SPACE_SIZE_2_3_3); 800 + writel(SLV_ADDR_SPACE_SZ, pcie->parf + PARF_SLV_ADDR_SPACE_SIZE); 801 801 802 802 val = readl(pcie->parf + PARF_PHY_CTRL); 803 803 val &= ~PHY_TEST_PWR_DOWN;
+11 -8
drivers/pci/of.c
··· 657 657 658 658 cset = kmalloc(sizeof(*cset), GFP_KERNEL); 659 659 if (!cset) 660 - goto failed; 660 + goto out_free_name; 661 661 of_changeset_init(cset); 662 662 663 663 np = of_changeset_create_node(cset, ppnode, name); 664 664 if (!np) 665 - goto failed; 666 - np->data = cset; 665 + goto out_destroy_cset; 667 666 668 667 ret = of_pci_add_properties(pdev, cset, np); 669 668 if (ret) 670 - goto failed; 669 + goto out_free_node; 671 670 672 671 ret = of_changeset_apply(cset); 673 672 if (ret) 674 - goto failed; 673 + goto out_free_node; 675 674 675 + np->data = cset; 676 676 pdev->dev.of_node = np; 677 677 kfree(name); 678 678 679 679 return; 680 680 681 - failed: 682 - if (np) 683 - of_node_put(np); 681 + out_free_node: 682 + of_node_put(np); 683 + out_destroy_cset: 684 + of_changeset_destroy(cset); 685 + kfree(cset); 686 + out_free_name: 684 687 kfree(name); 685 688 } 686 689 #endif
+18 -7
drivers/pci/of_property.c
··· 186 186 static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs, 187 187 struct device_node *np) 188 188 { 189 + u32 i, addr_sz[OF_PCI_MAX_INT_PIN] = { 0 }, map_sz = 0; 189 190 struct of_phandle_args out_irq[OF_PCI_MAX_INT_PIN]; 190 - u32 i, addr_sz[OF_PCI_MAX_INT_PIN], map_sz = 0; 191 191 __be32 laddr[OF_PCI_ADDRESS_CELLS] = { 0 }; 192 192 u32 int_map_mask[] = { 0xffff00, 0, 0, 7 }; 193 193 struct device_node *pnode; ··· 213 213 out_irq[i].args[0] = pin; 214 214 ret = of_irq_parse_raw(laddr, &out_irq[i]); 215 215 if (ret) { 216 - pci_err(pdev, "parse irq %d failed, ret %d", pin, ret); 216 + out_irq[i].np = NULL; 217 + pci_dbg(pdev, "parse irq %d failed, ret %d", pin, ret); 217 218 continue; 218 219 } 219 - ret = of_property_read_u32(out_irq[i].np, "#address-cells", 220 - &addr_sz[i]); 221 - if (ret) 222 - addr_sz[i] = 0; 220 + of_property_read_u32(out_irq[i].np, "#address-cells", 221 + &addr_sz[i]); 223 222 } 224 223 225 224 list_for_each_entry(child, &pdev->subordinate->devices, bus_list) { 226 225 for (pin = 1; pin <= OF_PCI_MAX_INT_PIN; pin++) { 227 226 i = pci_swizzle_interrupt_pin(child, pin) - 1; 227 + if (!out_irq[i].np) 228 + continue; 228 229 map_sz += 5 + addr_sz[i] + out_irq[i].args_count; 229 230 } 230 231 } 232 + 233 + /* 234 + * Parsing interrupt failed for all pins. In this case, it does not 235 + * need to generate interrupt-map property. 236 + */ 237 + if (!map_sz) 238 + return 0; 231 239 232 240 int_map = kcalloc(map_sz, sizeof(u32), GFP_KERNEL); 233 241 mapp = int_map; 234 242 235 243 list_for_each_entry(child, &pdev->subordinate->devices, bus_list) { 236 244 for (pin = 1; pin <= OF_PCI_MAX_INT_PIN; pin++) { 245 + i = pci_swizzle_interrupt_pin(child, pin) - 1; 246 + if (!out_irq[i].np) 247 + continue; 248 + 237 249 *mapp = (child->bus->number << 16) | 238 250 (child->devfn << 8); 239 251 mapp += OF_PCI_ADDRESS_CELLS; 240 252 *mapp = pin; 241 253 mapp++; 242 - i = pci_swizzle_interrupt_pin(child, pin) - 1; 243 254 *mapp = out_irq[i].np->phandle; 244 255 mapp++; 245 256 if (addr_sz[i]) {
+13 -1
drivers/pci/pci-driver.c
··· 572 572 573 573 static void pci_pm_bridge_power_up_actions(struct pci_dev *pci_dev) 574 574 { 575 - pci_bridge_wait_for_secondary_bus(pci_dev, "resume"); 575 + int ret; 576 + 577 + ret = pci_bridge_wait_for_secondary_bus(pci_dev, "resume"); 578 + if (ret) { 579 + /* 580 + * The downstream link failed to come up, so mark the 581 + * devices below as disconnected to make sure we don't 582 + * attempt to resume them. 583 + */ 584 + pci_walk_bus(pci_dev->subordinate, pci_dev_set_disconnected, 585 + NULL); 586 + return; 587 + } 576 588 577 589 /* 578 590 * When powering on a bridge from D3cold, the whole hierarchy may be
+1 -1
drivers/perf/arm-cmn.c
··· 1972 1972 u64 delta; 1973 1973 int i; 1974 1974 1975 - for (i = 0; i < CMN_DTM_NUM_COUNTERS; i++) { 1975 + for (i = 0; i < CMN_DT_NUM_COUNTERS; i++) { 1976 1976 if (status & (1U << i)) { 1977 1977 ret = IRQ_HANDLED; 1978 1978 if (WARN_ON(!dtc->counters[i]))
+24 -3
drivers/phy/freescale/phy-fsl-lynx-28g.c
··· 127 127 struct lynx_28g_priv { 128 128 void __iomem *base; 129 129 struct device *dev; 130 + /* Serialize concurrent access to registers shared between lanes, 131 + * like PCCn 132 + */ 133 + spinlock_t pcc_lock; 130 134 struct lynx_28g_pll pll[LYNX_28G_NUM_PLL]; 131 135 struct lynx_28g_lane lane[LYNX_28G_NUM_LANE]; 132 136 ··· 401 397 if (powered_up) 402 398 lynx_28g_power_off(phy); 403 399 400 + spin_lock(&priv->pcc_lock); 401 + 404 402 switch (submode) { 405 403 case PHY_INTERFACE_MODE_SGMII: 406 404 case PHY_INTERFACE_MODE_1000BASEX: ··· 419 413 lane->interface = submode; 420 414 421 415 out: 416 + spin_unlock(&priv->pcc_lock); 417 + 422 418 /* Power up the lane if necessary */ 423 419 if (powered_up) 424 420 lynx_28g_power_on(phy); ··· 516 508 for (i = 0; i < LYNX_28G_NUM_LANE; i++) { 517 509 lane = &priv->lane[i]; 518 510 519 - if (!lane->init) 520 - continue; 511 + mutex_lock(&lane->phy->mutex); 521 512 522 - if (!lane->powered_up) 513 + if (!lane->init || !lane->powered_up) { 514 + mutex_unlock(&lane->phy->mutex); 523 515 continue; 516 + } 524 517 525 518 rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); 526 519 if (!(rrstctl & LYNX_28G_LNaRRSTCTL_CDR_LOCK)) { ··· 530 521 rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL); 531 522 } while (!(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE)); 532 523 } 524 + 525 + mutex_unlock(&lane->phy->mutex); 533 526 } 534 527 queue_delayed_work(system_power_efficient_wq, &priv->cdr_check, 535 528 msecs_to_jiffies(1000)); ··· 604 593 605 594 dev_set_drvdata(dev, priv); 606 595 596 + spin_lock_init(&priv->pcc_lock); 607 597 INIT_DELAYED_WORK(&priv->cdr_check, lynx_28g_cdr_lock_check); 608 598 609 599 queue_delayed_work(system_power_efficient_wq, &priv->cdr_check, ··· 616 604 return PTR_ERR_OR_ZERO(provider); 617 605 } 618 606 607 + static void lynx_28g_remove(struct platform_device *pdev) 608 + { 609 + struct device *dev = &pdev->dev; 610 + struct lynx_28g_priv *priv = dev_get_drvdata(dev); 611 + 612 + cancel_delayed_work_sync(&priv->cdr_check); 613 + } 614 + 619 615 static const struct of_device_id lynx_28g_of_match_table[] = { 620 616 { .compatible = "fsl,lynx-28g" }, 621 617 { }, ··· 632 612 633 613 static struct platform_driver lynx_28g_driver = { 634 614 .probe = lynx_28g_probe, 615 + .remove_new = lynx_28g_remove, 635 616 .driver = { 636 617 .name = "lynx-28g", 637 618 .of_match_table = lynx_28g_of_match_table,
+9 -7
drivers/pinctrl/core.c
··· 1022 1022 1023 1023 static struct pinctrl *find_pinctrl(struct device *dev) 1024 1024 { 1025 - struct pinctrl *p; 1025 + struct pinctrl *entry, *p = NULL; 1026 1026 1027 1027 mutex_lock(&pinctrl_list_mutex); 1028 - list_for_each_entry(p, &pinctrl_list, node) 1029 - if (p->dev == dev) { 1030 - mutex_unlock(&pinctrl_list_mutex); 1031 - return p; 1028 + 1029 + list_for_each_entry(entry, &pinctrl_list, node) { 1030 + if (entry->dev == dev) { 1031 + p = entry; 1032 + kref_get(&p->users); 1033 + break; 1032 1034 } 1035 + } 1033 1036 1034 1037 mutex_unlock(&pinctrl_list_mutex); 1035 - return NULL; 1038 + return p; 1036 1039 } 1037 1040 1038 1041 static void pinctrl_free(struct pinctrl *p, bool inlist); ··· 1143 1140 p = find_pinctrl(dev); 1144 1141 if (p) { 1145 1142 dev_dbg(dev, "obtain a copy of previously claimed pinctrl\n"); 1146 - kref_get(&p->users); 1147 1143 return p; 1148 1144 } 1149 1145
+3 -3
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
··· 1062 1062 if (ret < 0) 1063 1063 return ret; 1064 1064 1065 - gpio = &pctrl->gpio_bank[reg]; 1066 - gpio->pctrl = pctrl; 1067 - 1068 1065 if (reg >= WPCM450_NUM_BANKS) 1069 1066 return dev_err_probe(dev, -EINVAL, 1070 1067 "GPIO index %d out of range!\n", reg); 1068 + 1069 + gpio = &pctrl->gpio_bank[reg]; 1070 + gpio->pctrl = pctrl; 1071 1071 1072 1072 bank = &wpcm450_banks[reg]; 1073 1073 gpio->bank = bank;
-1
drivers/pinctrl/pinctrl-lantiq.h
··· 198 198 199 199 extern int ltq_pinctrl_register(struct platform_device *pdev, 200 200 struct ltq_pinmux_info *info); 201 - extern int ltq_pinctrl_unregister(struct platform_device *pdev); 202 201 #endif /* __PINCTRL_LANTIQ_H */
+1
drivers/pinctrl/renesas/Kconfig
··· 235 235 depends on OF 236 236 depends on ARCH_RZN1 || COMPILE_TEST 237 237 select GENERIC_PINCONF 238 + select PINMUX 238 239 help 239 240 This selects pinctrl driver for Renesas RZ/N1 devices. 240 241
+4
drivers/pinctrl/starfive/pinctrl-starfive-jh7110-aon.c
··· 31 31 #define JH7110_AON_NGPIO 4 32 32 #define JH7110_AON_GC_BASE 64 33 33 34 + #define JH7110_AON_REGS_NUM 37 35 + 34 36 /* registers */ 35 37 #define JH7110_AON_DOEN 0x0 36 38 #define JH7110_AON_DOUT 0x4 ··· 147 145 .gpi_mask = GENMASK(3, 0), 148 146 .gpioin_reg_base = JH7110_AON_GPIOIN, 149 147 .irq_reg = &jh7110_aon_irq_reg, 148 + .nsaved_regs = JH7110_AON_REGS_NUM, 150 149 .jh7110_set_one_pin_mux = jh7110_aon_set_one_pin_mux, 151 150 .jh7110_get_padcfg_base = jh7110_aon_get_padcfg_base, 152 151 .jh7110_gpio_irq_handler = jh7110_aon_irq_handler, ··· 168 165 .driver = { 169 166 .name = "starfive-jh7110-aon-pinctrl", 170 167 .of_match_table = jh7110_aon_pinctrl_of_match, 168 + .pm = pm_sleep_ptr(&jh7110_pinctrl_pm_ops), 171 169 }, 172 170 }; 173 171 module_platform_driver(jh7110_aon_pinctrl_driver);
+4
drivers/pinctrl/starfive/pinctrl-starfive-jh7110-sys.c
··· 31 31 #define JH7110_SYS_NGPIO 64 32 32 #define JH7110_SYS_GC_BASE 0 33 33 34 + #define JH7110_SYS_REGS_NUM 174 35 + 34 36 /* registers */ 35 37 #define JH7110_SYS_DOEN 0x000 36 38 #define JH7110_SYS_DOUT 0x040 ··· 419 417 .gpi_mask = GENMASK(6, 0), 420 418 .gpioin_reg_base = JH7110_SYS_GPIOIN, 421 419 .irq_reg = &jh7110_sys_irq_reg, 420 + .nsaved_regs = JH7110_SYS_REGS_NUM, 422 421 .jh7110_set_one_pin_mux = jh7110_sys_set_one_pin_mux, 423 422 .jh7110_get_padcfg_base = jh7110_sys_get_padcfg_base, 424 423 .jh7110_gpio_irq_handler = jh7110_sys_irq_handler, ··· 440 437 .driver = { 441 438 .name = "starfive-jh7110-sys-pinctrl", 442 439 .of_match_table = jh7110_sys_pinctrl_of_match, 440 + .pm = pm_sleep_ptr(&jh7110_pinctrl_pm_ops), 443 441 }, 444 442 }; 445 443 module_platform_driver(jh7110_sys_pinctrl_driver);
+40 -2
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c
··· 872 872 if (!sfp) 873 873 return -ENOMEM; 874 874 875 + #if IS_ENABLED(CONFIG_PM_SLEEP) 876 + sfp->saved_regs = devm_kcalloc(dev, info->nsaved_regs, 877 + sizeof(*sfp->saved_regs), GFP_KERNEL); 878 + if (!sfp->saved_regs) 879 + return -ENOMEM; 880 + #endif 881 + 875 882 sfp->base = devm_platform_ioremap_resource(pdev, 0); 876 883 if (IS_ERR(sfp->base)) 877 884 return PTR_ERR(sfp->base); ··· 974 967 if (ret) 975 968 return dev_err_probe(dev, ret, "could not register gpiochip\n"); 976 969 977 - irq_domain_set_pm_device(sfp->gc.irq.domain, dev); 978 - 979 970 dev_info(dev, "StarFive GPIO chip registered %d GPIOs\n", sfp->gc.ngpio); 980 971 981 972 return pinctrl_enable(sfp->pctl); 982 973 } 983 974 EXPORT_SYMBOL_GPL(jh7110_pinctrl_probe); 975 + 976 + static int jh7110_pinctrl_suspend(struct device *dev) 977 + { 978 + struct jh7110_pinctrl *sfp = dev_get_drvdata(dev); 979 + unsigned long flags; 980 + unsigned int i; 981 + 982 + raw_spin_lock_irqsave(&sfp->lock, flags); 983 + for (i = 0 ; i < sfp->info->nsaved_regs ; i++) 984 + sfp->saved_regs[i] = readl_relaxed(sfp->base + 4 * i); 985 + 986 + raw_spin_unlock_irqrestore(&sfp->lock, flags); 987 + return 0; 988 + } 989 + 990 + static int jh7110_pinctrl_resume(struct device *dev) 991 + { 992 + struct jh7110_pinctrl *sfp = dev_get_drvdata(dev); 993 + unsigned long flags; 994 + unsigned int i; 995 + 996 + raw_spin_lock_irqsave(&sfp->lock, flags); 997 + for (i = 0 ; i < sfp->info->nsaved_regs ; i++) 998 + writel_relaxed(sfp->saved_regs[i], sfp->base + 4 * i); 999 + 1000 + raw_spin_unlock_irqrestore(&sfp->lock, flags); 1001 + return 0; 1002 + } 1003 + 1004 + const struct dev_pm_ops jh7110_pinctrl_pm_ops = { 1005 + LATE_SYSTEM_SLEEP_PM_OPS(jh7110_pinctrl_suspend, jh7110_pinctrl_resume) 1006 + }; 1007 + EXPORT_SYMBOL_GPL(jh7110_pinctrl_pm_ops); 984 1008 985 1009 MODULE_DESCRIPTION("Pinctrl driver for the StarFive JH7110 SoC"); 986 1010 MODULE_AUTHOR("Emil Renner Berthing <kernel@esmil.dk>");
+4
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h
··· 21 21 /* register read/write mutex */ 22 22 struct mutex mutex; 23 23 const struct jh7110_pinctrl_soc_info *info; 24 + u32 *saved_regs; 24 25 }; 25 26 26 27 struct jh7110_gpio_irq_reg { ··· 51 50 52 51 const struct jh7110_gpio_irq_reg *irq_reg; 53 52 53 + unsigned int nsaved_regs; 54 + 54 55 /* generic pinmux */ 55 56 int (*jh7110_set_one_pin_mux)(struct jh7110_pinctrl *sfp, 56 57 unsigned int pin, ··· 69 66 unsigned int din, u32 dout, u32 doen); 70 67 int jh7110_pinctrl_probe(struct platform_device *pdev); 71 68 struct jh7110_pinctrl *jh7110_from_irq_desc(struct irq_desc *desc); 69 + extern const struct dev_pm_ops jh7110_pinctrl_pm_ops; 72 70 73 71 #endif /* __PINCTRL_STARFIVE_JH7110_H__ */
+2 -17
drivers/pinctrl/tegra/pinctrl-tegra.c
··· 96 96 {"nvidia,slew-rate-falling", TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING}, 97 97 {"nvidia,slew-rate-rising", TEGRA_PINCONF_PARAM_SLEW_RATE_RISING}, 98 98 {"nvidia,drive-type", TEGRA_PINCONF_PARAM_DRIVE_TYPE}, 99 - {"nvidia,function", TEGRA_PINCONF_PARAM_FUNCTION}, 100 99 }; 101 100 102 101 static int tegra_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, ··· 470 471 *bit = g->drvtype_bit; 471 472 *width = 2; 472 473 break; 473 - case TEGRA_PINCONF_PARAM_FUNCTION: 474 - *bank = g->mux_bank; 475 - *reg = g->mux_reg; 476 - *bit = g->mux_bit; 477 - *width = 2; 478 - break; 479 474 default: 480 475 dev_err(pmx->dev, "Invalid config param %04x\n", param); 481 476 return -ENOTSUPP; ··· 633 640 val >>= bit; 634 641 val &= (1 << width) - 1; 635 642 636 - if (cfg_params[i].param == TEGRA_PINCONF_PARAM_FUNCTION) { 637 - u8 idx = pmx->soc->groups[group].funcs[val]; 638 - 639 - seq_printf(s, "\n\t%s=%s", 640 - strip_prefix(cfg_params[i].property), 641 - pmx->functions[idx].name); 642 - } else { 643 - seq_printf(s, "\n\t%s=%u", 644 - strip_prefix(cfg_params[i].property), val); 645 - } 643 + seq_printf(s, "\n\t%s=%u", 644 + strip_prefix(cfg_params[i].property), val); 646 645 } 647 646 } 648 647
-2
drivers/pinctrl/tegra/pinctrl-tegra.h
··· 54 54 TEGRA_PINCONF_PARAM_SLEW_RATE_RISING, 55 55 /* argument: Integer, range is HW-dependant */ 56 56 TEGRA_PINCONF_PARAM_DRIVE_TYPE, 57 - /* argument: pinmux settings */ 58 - TEGRA_PINCONF_PARAM_FUNCTION, 59 57 }; 60 58 61 59 enum tegra_pinconf_pull {
+8 -6
drivers/platform/mellanox/mlxbf-tmfifo.c
··· 53 53 struct mlxbf_tmfifo; 54 54 55 55 /** 56 - * mlxbf_tmfifo_vring - Structure of the TmFifo virtual ring 56 + * struct mlxbf_tmfifo_vring - Structure of the TmFifo virtual ring 57 57 * @va: virtual address of the ring 58 58 * @dma: dma address of the ring 59 59 * @vq: pointer to the virtio virtqueue ··· 113 113 }; 114 114 115 115 /** 116 - * mlxbf_tmfifo_vdev - Structure of the TmFifo virtual device 116 + * struct mlxbf_tmfifo_vdev - Structure of the TmFifo virtual device 117 117 * @vdev: virtio device, in which the vdev.id.device field has the 118 118 * VIRTIO_ID_xxx id to distinguish the virtual device. 119 119 * @status: status of the device 120 120 * @features: supported features of the device 121 121 * @vrings: array of tmfifo vrings of this device 122 + * @config: non-anonymous union for cons and net 122 123 * @config.cons: virtual console config - 123 124 * select if vdev.id.device is VIRTIO_ID_CONSOLE 124 125 * @config.net: virtual network config - ··· 139 138 }; 140 139 141 140 /** 142 - * mlxbf_tmfifo_irq_info - Structure of the interrupt information 141 + * struct mlxbf_tmfifo_irq_info - Structure of the interrupt information 143 142 * @fifo: pointer to the tmfifo structure 144 143 * @irq: interrupt number 145 144 * @index: index into the interrupt array ··· 151 150 }; 152 151 153 152 /** 154 - * mlxbf_tmfifo_io - Structure of the TmFifo IO resource (for both rx & tx) 153 + * struct mlxbf_tmfifo_io - Structure of the TmFifo IO resource (for both rx & tx) 155 154 * @ctl: control register offset (TMFIFO_RX_CTL / TMFIFO_TX_CTL) 156 155 * @sts: status register offset (TMFIFO_RX_STS / TMFIFO_TX_STS) 157 156 * @data: data register offset (TMFIFO_RX_DATA / TMFIFO_TX_DATA) ··· 163 162 }; 164 163 165 164 /** 166 - * mlxbf_tmfifo - Structure of the TmFifo 165 + * struct mlxbf_tmfifo - Structure of the TmFifo 167 166 * @vdev: array of the virtual devices running over the TmFifo 168 167 * @lock: lock to protect the TmFifo access 169 168 * @res0: mapped resource block 0 ··· 199 198 }; 200 199 201 200 /** 202 - * mlxbf_tmfifo_msg_hdr - Structure of the TmFifo message header 201 + * struct mlxbf_tmfifo_msg_hdr - Structure of the TmFifo message header 203 202 * @type: message type 204 203 * @len: payload length in network byte order. Messages sent into the FIFO 205 204 * will be read by the other side as data stream in the same byte order. ··· 209 208 struct mlxbf_tmfifo_msg_hdr { 210 209 u8 type; 211 210 __be16 len; 211 + /* private: */ 212 212 u8 unused[5]; 213 213 } __packed __aligned(sizeof(u64)); 214 214
+10 -4
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
··· 659 659 const char *guid, int min_elements, 660 660 int instance_id) 661 661 { 662 - struct kobject *attr_name_kobj; 662 + struct kobject *attr_name_kobj, *duplicate; 663 663 union acpi_object *elements; 664 664 struct kset *temp_kset; 665 665 ··· 704 704 } 705 705 706 706 /* All duplicate attributes found are ignored */ 707 - if (kset_find_obj(temp_kset, str_value)) { 707 + duplicate = kset_find_obj(temp_kset, str_value); 708 + if (duplicate) { 708 709 pr_debug("Duplicate attribute name found - %s\n", str_value); 710 + /* kset_find_obj() returns a reference */ 711 + kobject_put(duplicate); 709 712 goto pack_attr_exit; 710 713 } 711 714 ··· 771 768 const char *guid, int min_elements, 772 769 int instance_id) 773 770 { 774 - struct kobject *attr_name_kobj; 771 + struct kobject *attr_name_kobj, *duplicate; 775 772 struct kset *temp_kset; 776 773 char str[MAX_BUFF_SIZE]; 777 774 ··· 797 794 temp_kset = bioscfg_drv.main_dir_kset; 798 795 799 796 /* All duplicate attributes found are ignored */ 800 - if (kset_find_obj(temp_kset, str)) { 797 + duplicate = kset_find_obj(temp_kset, str); 798 + if (duplicate) { 801 799 pr_debug("Duplicate attribute name found - %s\n", str); 800 + /* kset_find_obj() returns a reference */ 801 + kobject_put(duplicate); 802 802 goto buff_attr_exit; 803 803 } 804 804
+7 -1
drivers/platform/x86/hp/hp-wmi.c
··· 1548 1548 .restore = hp_wmi_resume_handler, 1549 1549 }; 1550 1550 1551 - static struct platform_driver hp_wmi_driver = { 1551 + /* 1552 + * hp_wmi_bios_remove() lives in .exit.text. For drivers registered via 1553 + * module_platform_driver_probe() this is ok because they cannot get unbound at 1554 + * runtime. So mark the driver struct with __refdata to prevent modpost 1555 + * triggering a section mismatch warning. 1556 + */ 1557 + static struct platform_driver hp_wmi_driver __refdata = { 1552 1558 .driver = { 1553 1559 .name = "hp-wmi", 1554 1560 .pm = &hp_wmi_pm_ops,
+4 -3
drivers/platform/x86/intel/ifs/runtest.c
··· 331 331 switch (test->test_num) { 332 332 case IFS_TYPE_SAF: 333 333 if (!ifsd->loaded) 334 - return -EPERM; 335 - ifs_test_core(cpu, dev); 334 + ret = -EPERM; 335 + else 336 + ifs_test_core(cpu, dev); 336 337 break; 337 338 case IFS_TYPE_ARRAY_BIST: 338 339 ifs_array_test_core(cpu, dev); 339 340 break; 340 341 default: 341 - return -EINVAL; 342 + ret = -EINVAL; 342 343 } 343 344 out: 344 345 cpus_read_unlock();
+20 -4
drivers/platform/x86/think-lmi.c
··· 1248 1248 kset_unregister(tlmi_priv.authentication_kset); 1249 1249 } 1250 1250 1251 + static int tlmi_validate_setting_name(struct kset *attribute_kset, char *name) 1252 + { 1253 + struct kobject *duplicate; 1254 + 1255 + if (!strcmp(name, "Reserved")) 1256 + return -EINVAL; 1257 + 1258 + duplicate = kset_find_obj(attribute_kset, name); 1259 + if (duplicate) { 1260 + pr_debug("Duplicate attribute name found - %s\n", name); 1261 + /* kset_find_obj() returns a reference */ 1262 + kobject_put(duplicate); 1263 + return -EBUSY; 1264 + } 1265 + 1266 + return 0; 1267 + } 1268 + 1251 1269 static int tlmi_sysfs_init(void) 1252 1270 { 1253 1271 int i, ret; ··· 1294 1276 continue; 1295 1277 1296 1278 /* check for duplicate or reserved values */ 1297 - if (kset_find_obj(tlmi_priv.attribute_kset, tlmi_priv.setting[i]->display_name) || 1298 - !strcmp(tlmi_priv.setting[i]->display_name, "Reserved")) { 1299 - pr_debug("duplicate or reserved attribute name found - %s\n", 1300 - tlmi_priv.setting[i]->display_name); 1279 + if (tlmi_validate_setting_name(tlmi_priv.attribute_kset, 1280 + tlmi_priv.setting[i]->display_name) < 0) { 1301 1281 kfree(tlmi_priv.setting[i]->possible_values); 1302 1282 kfree(tlmi_priv.setting[i]); 1303 1283 tlmi_priv.setting[i] = NULL;
+45
drivers/platform/x86/touchscreen_dmi.c
··· 42 42 .properties = archos_101_cesium_educ_props, 43 43 }; 44 44 45 + static const struct property_entry bush_bush_windows_tablet_props[] = { 46 + PROPERTY_ENTRY_U32("touchscreen-size-x", 1850), 47 + PROPERTY_ENTRY_U32("touchscreen-size-y", 1280), 48 + PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"), 49 + PROPERTY_ENTRY_U32("silead,max-fingers", 10), 50 + PROPERTY_ENTRY_BOOL("silead,home-button"), 51 + PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-bush-bush-windows-tablet.fw"), 52 + { } 53 + }; 54 + 55 + static const struct ts_dmi_data bush_bush_windows_tablet_data = { 56 + .acpi_name = "MSSL1680:00", 57 + .properties = bush_bush_windows_tablet_props, 58 + }; 59 + 45 60 static const struct property_entry chuwi_hi8_props[] = { 46 61 PROPERTY_ENTRY_U32("touchscreen-size-x", 1665), 47 62 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140), ··· 771 756 .properties = pipo_w11_props, 772 757 }; 773 758 759 + static const struct property_entry positivo_c4128b_props[] = { 760 + PROPERTY_ENTRY_U32("touchscreen-min-x", 4), 761 + PROPERTY_ENTRY_U32("touchscreen-min-y", 13), 762 + PROPERTY_ENTRY_U32("touchscreen-size-x", 1915), 763 + PROPERTY_ENTRY_U32("touchscreen-size-y", 1269), 764 + PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-positivo-c4128b.fw"), 765 + PROPERTY_ENTRY_U32("silead,max-fingers", 10), 766 + { } 767 + }; 768 + 769 + static const struct ts_dmi_data positivo_c4128b_data = { 770 + .acpi_name = "MSSL1680:00", 771 + .properties = positivo_c4128b_props, 772 + }; 773 + 774 774 static const struct property_entry pov_mobii_wintab_p800w_v20_props[] = { 775 775 PROPERTY_ENTRY_U32("touchscreen-min-x", 32), 776 776 PROPERTY_ENTRY_U32("touchscreen-min-y", 16), ··· 1098 1068 .driver_data = (void *)&archos_101_cesium_educ_data, 1099 1069 .matches = { 1100 1070 DMI_MATCH(DMI_PRODUCT_NAME, "ARCHOS 101 Cesium Educ"), 1071 + }, 1072 + }, 1073 + { 1074 + /* Bush Windows tablet */ 1075 + .driver_data = (void *)&bush_bush_windows_tablet_data, 1076 + .matches = { 1077 + DMI_MATCH(DMI_PRODUCT_NAME, "Bush Windows tablet"), 1101 1078 }, 1102 1079 }, 1103 1080 { ··· 1515 1478 DMI_MATCH(DMI_PRODUCT_NAME, "MOMO7W"), 1516 1479 /* Exact match, different versions need different fw */ 1517 1480 DMI_MATCH(DMI_BIOS_VERSION, "MOMO.G.WI71C.MABMRBA02"), 1481 + }, 1482 + }, 1483 + { 1484 + /* Positivo C4128B */ 1485 + .driver_data = (void *)&positivo_c4128b_data, 1486 + .matches = { 1487 + DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"), 1488 + DMI_MATCH(DMI_PRODUCT_NAME, "C4128B-1"), 1518 1489 }, 1519 1490 }, 1520 1491 {
+2 -1
drivers/pmdomain/imx/scu-pd.c
··· 150 150 { "mclk-out-1", IMX_SC_R_MCLK_OUT_1, 1, false, 0 }, 151 151 { "dma0-ch", IMX_SC_R_DMA_0_CH0, 32, true, 0 }, 152 152 { "dma1-ch", IMX_SC_R_DMA_1_CH0, 16, true, 0 }, 153 - { "dma2-ch", IMX_SC_R_DMA_2_CH0, 32, true, 0 }, 153 + { "dma2-ch-0", IMX_SC_R_DMA_2_CH0, 5, true, 0 }, 154 + { "dma2-ch-1", IMX_SC_R_DMA_2_CH5, 27, true, 0 }, 154 155 { "dma3-ch", IMX_SC_R_DMA_3_CH0, 32, true, 0 }, 155 156 { "asrc0", IMX_SC_R_ASRC_0, 1, false, 0 }, 156 157 { "asrc1", IMX_SC_R_ASRC_1, 1, false, 0 },
+1 -1
drivers/s390/net/Kconfig
··· 102 102 103 103 config ISM 104 104 tristate "Support for ISM vPCI Adapter" 105 - depends on PCI && SMC 105 + depends on PCI 106 106 default n 107 107 help 108 108 Select this option if you want to use the Internal Shared Memory
+6 -5
drivers/scsi/scsi_scan.c
··· 1627 1627 device_lock(dev); 1628 1628 1629 1629 /* 1630 - * Bail out if the device is not running. Otherwise, the rescan may 1631 - * block waiting for commands to be executed, with us holding the 1632 - * device lock. This can result in a potential deadlock in the power 1633 - * management core code when system resume is on-going. 1630 + * Bail out if the device or its queue are not running. Otherwise, 1631 + * the rescan may block waiting for commands to be executed, with us 1632 + * holding the device lock. This can result in a potential deadlock 1633 + * in the power management core code when system resume is on-going. 1634 1634 */ 1635 - if (sdev->sdev_state != SDEV_RUNNING) { 1635 + if (sdev->sdev_state != SDEV_RUNNING || 1636 + blk_queue_pm_only(sdev->request_queue)) { 1636 1637 ret = -EWOULDBLOCK; 1637 1638 goto unlock; 1638 1639 }
+1
drivers/soc/renesas/Kconfig
··· 333 333 334 334 config ARCH_R9A07G043 335 335 bool "RISC-V Platform support for RZ/Five" 336 + depends on NONPORTABLE 336 337 select ARCH_RZG2L 337 338 select AX45MP_L2_CACHE if RISCV_DMA_NONCOHERENT 338 339 select DMA_GLOBAL_POOL
+1 -1
drivers/staging/media/atomisp/Kconfig
··· 12 12 config VIDEO_ATOMISP 13 13 tristate "Intel Atom Image Signal Processor Driver" 14 14 depends on VIDEO_DEV && INTEL_ATOMISP 15 + depends on IPU_BRIDGE 15 16 depends on MEDIA_PCI_SUPPORT 16 17 depends on PMIC_OPREGION 17 18 depends on I2C 18 19 select V4L2_FWNODE 19 20 select IOSF_MBI 20 - select IPU_BRIDGE 21 21 select VIDEOBUF2_VMALLOC 22 22 select VIDEO_V4L2_SUBDEV_API 23 23 help
+10 -6
drivers/staging/media/tegra-video/vi.c
··· 1455 1455 } 1456 1456 1457 1457 /* 1458 - * Graph Management 1458 + * Find the entity matching a given fwnode in an v4l2_async_notifier list 1459 1459 */ 1460 1460 static struct tegra_vi_graph_entity * 1461 - tegra_vi_graph_find_entity(struct tegra_vi_channel *chan, 1461 + tegra_vi_graph_find_entity(struct list_head *list, 1462 1462 const struct fwnode_handle *fwnode) 1463 1463 { 1464 1464 struct tegra_vi_graph_entity *entity; 1465 1465 struct v4l2_async_connection *asd; 1466 1466 1467 - list_for_each_entry(asd, &chan->notifier.done_list, asc_entry) { 1467 + list_for_each_entry(asd, list, asc_entry) { 1468 1468 entity = to_tegra_vi_graph_entity(asd); 1469 + 1469 1470 if (entity->asd.match.fwnode == fwnode) 1470 1471 return entity; 1471 1472 } ··· 1533 1532 } 1534 1533 1535 1534 /* find the remote entity from notifier list */ 1536 - ent = tegra_vi_graph_find_entity(chan, link.remote_node); 1535 + ent = tegra_vi_graph_find_entity(&chan->notifier.done_list, 1536 + link.remote_node); 1537 1537 if (!ent) { 1538 1538 dev_err(vi->dev, "no entity found for %pOF\n", 1539 1539 to_of_node(link.remote_node)); ··· 1666 1664 * Locate the entity corresponding to the bound subdev and store the 1667 1665 * subdev pointer. 1668 1666 */ 1669 - entity = tegra_vi_graph_find_entity(chan, subdev->fwnode); 1667 + entity = tegra_vi_graph_find_entity(&chan->notifier.waiting_list, 1668 + subdev->fwnode); 1670 1669 if (!entity) { 1671 1670 dev_err(vi->dev, "no entity for subdev %s\n", subdev->name); 1672 1671 return -EINVAL; ··· 1716 1713 1717 1714 /* skip entities that are already processed */ 1718 1715 if (device_match_fwnode(vi->dev, remote) || 1719 - tegra_vi_graph_find_entity(chan, remote)) { 1716 + tegra_vi_graph_find_entity(&chan->notifier.waiting_list, 1717 + remote)) { 1720 1718 fwnode_handle_put(remote); 1721 1719 continue; 1722 1720 }
+6 -4
drivers/tee/amdtee/core.c
··· 217 217 return rc; 218 218 } 219 219 220 + /* mutex must be held by caller */ 220 221 static void destroy_session(struct kref *ref) 221 222 { 222 223 struct amdtee_session *sess = container_of(ref, struct amdtee_session, 223 224 refcount); 224 225 225 - mutex_lock(&session_list_mutex); 226 226 list_del(&sess->list_node); 227 227 mutex_unlock(&session_list_mutex); 228 228 kfree(sess); ··· 272 272 if (arg->ret != TEEC_SUCCESS) { 273 273 pr_err("open_session failed %d\n", arg->ret); 274 274 handle_unload_ta(ta_handle); 275 - kref_put(&sess->refcount, destroy_session); 275 + kref_put_mutex(&sess->refcount, destroy_session, 276 + &session_list_mutex); 276 277 goto out; 277 278 } 278 279 ··· 291 290 pr_err("reached maximum session count %d\n", TEE_NUM_SESSIONS); 292 291 handle_close_session(ta_handle, session_info); 293 292 handle_unload_ta(ta_handle); 294 - kref_put(&sess->refcount, destroy_session); 293 + kref_put_mutex(&sess->refcount, destroy_session, 294 + &session_list_mutex); 295 295 rc = -ENOMEM; 296 296 goto out; 297 297 } ··· 333 331 handle_close_session(ta_handle, session_info); 334 332 handle_unload_ta(ta_handle); 335 333 336 - kref_put(&sess->refcount, destroy_session); 334 + kref_put_mutex(&sess->refcount, destroy_session, &session_list_mutex); 337 335 338 336 return 0; 339 337 }
+46 -41
drivers/xen/events/events_base.c
··· 33 33 #include <linux/slab.h> 34 34 #include <linux/irqnr.h> 35 35 #include <linux/pci.h> 36 + #include <linux/rcupdate.h> 36 37 #include <linux/spinlock.h> 37 38 #include <linux/cpuhotplug.h> 38 39 #include <linux/atomic.h> ··· 97 96 struct irq_info { 98 97 struct list_head list; 99 98 struct list_head eoi_list; 99 + struct rcu_work rwork; 100 100 short refcnt; 101 101 u8 spurious_cnt; 102 102 u8 is_accounted; ··· 149 147 static DEFINE_MUTEX(irq_mapping_update_lock); 150 148 151 149 /* 152 - * Lock protecting event handling loop against removing event channels. 153 - * Adding of event channels is no issue as the associated IRQ becomes active 154 - * only after everything is setup (before request_[threaded_]irq() the handler 155 - * can't be entered for an event, as the event channel will be unmasked only 156 - * then). 157 - */ 158 - static DEFINE_RWLOCK(evtchn_rwlock); 159 - 160 - /* 161 150 * Lock hierarchy: 162 151 * 163 152 * irq_mapping_update_lock 164 - * evtchn_rwlock 165 - * IRQ-desc lock 166 - * percpu eoi_list_lock 167 - * irq_info->lock 153 + * IRQ-desc lock 154 + * percpu eoi_list_lock 155 + * irq_info->lock 168 156 */ 169 157 170 158 static LIST_HEAD(xen_irq_list_head); ··· 296 304 return; 297 305 298 306 info->is_accounted = 1; 307 + } 308 + 309 + static void delayed_free_irq(struct work_struct *work) 310 + { 311 + struct irq_info *info = container_of(to_rcu_work(work), struct irq_info, 312 + rwork); 313 + unsigned int irq = info->irq; 314 + 315 + /* Remove the info pointer only now, with no potential users left. */ 316 + set_info_for_irq(irq, NULL); 317 + 318 + kfree(info); 319 + 320 + /* Legacy IRQ descriptors are managed by the arch. */ 321 + if (irq >= nr_legacy_irqs()) 322 + irq_free_desc(irq); 299 323 } 300 324 301 325 /* Constructors for packed IRQ information. */ ··· 676 668 677 669 eoi = container_of(to_delayed_work(work), struct lateeoi_work, delayed); 678 670 679 - read_lock_irqsave(&evtchn_rwlock, flags); 671 + rcu_read_lock(); 680 672 681 673 while (true) { 682 - spin_lock(&eoi->eoi_list_lock); 674 + spin_lock_irqsave(&eoi->eoi_list_lock, flags); 683 675 684 676 info = list_first_entry_or_null(&eoi->eoi_list, struct irq_info, 685 677 eoi_list); 686 678 687 - if (info == NULL || now < info->eoi_time) { 688 - spin_unlock(&eoi->eoi_list_lock); 679 + if (info == NULL) 680 + break; 681 + 682 + if (now < info->eoi_time) { 683 + mod_delayed_work_on(info->eoi_cpu, system_wq, 684 + &eoi->delayed, 685 + info->eoi_time - now); 689 686 break; 690 687 } 691 688 692 689 list_del_init(&info->eoi_list); 693 690 694 - spin_unlock(&eoi->eoi_list_lock); 691 + spin_unlock_irqrestore(&eoi->eoi_list_lock, flags); 695 692 696 693 info->eoi_time = 0; 697 694 698 695 xen_irq_lateeoi_locked(info, false); 699 696 } 700 697 701 - if (info) 702 - mod_delayed_work_on(info->eoi_cpu, system_wq, 703 - &eoi->delayed, info->eoi_time - now); 698 + spin_unlock_irqrestore(&eoi->eoi_list_lock, flags); 704 699 705 - read_unlock_irqrestore(&evtchn_rwlock, flags); 700 + rcu_read_unlock(); 706 701 } 707 702 708 703 static void xen_cpu_init_eoi(unsigned int cpu) ··· 720 709 void xen_irq_lateeoi(unsigned int irq, unsigned int eoi_flags) 721 710 { 722 711 struct irq_info *info; 723 - unsigned long flags; 724 712 725 - read_lock_irqsave(&evtchn_rwlock, flags); 713 + rcu_read_lock(); 726 714 727 715 info = info_for_irq(irq); 728 716 729 717 if (info) 730 718 xen_irq_lateeoi_locked(info, eoi_flags & XEN_EOI_FLAG_SPURIOUS); 731 719 732 - read_unlock_irqrestore(&evtchn_rwlock, flags); 720 + rcu_read_unlock(); 733 721 } 734 722 EXPORT_SYMBOL_GPL(xen_irq_lateeoi); 735 723 ··· 742 732 743 733 info->type = IRQT_UNBOUND; 744 734 info->refcnt = -1; 735 + INIT_RCU_WORK(&info->rwork, delayed_free_irq); 745 736 746 737 set_info_for_irq(irq, info); 747 738 /* ··· 800 789 static void xen_free_irq(unsigned irq) 801 790 { 802 791 struct irq_info *info = info_for_irq(irq); 803 - unsigned long flags; 804 792 805 793 if (WARN_ON(!info)) 806 794 return; 807 - 808 - write_lock_irqsave(&evtchn_rwlock, flags); 809 795 810 796 if (!list_empty(&info->eoi_list)) 811 797 lateeoi_list_del(info); 812 798 813 799 list_del(&info->list); 814 800 815 - set_info_for_irq(irq, NULL); 816 - 817 801 WARN_ON(info->refcnt > 0); 818 802 819 - write_unlock_irqrestore(&evtchn_rwlock, flags); 820 - 821 - kfree(info); 822 - 823 - /* Legacy IRQ descriptors are managed by the arch. */ 824 - if (irq < nr_legacy_irqs()) 825 - return; 826 - 827 - irq_free_desc(irq); 803 + queue_rcu_work(system_wq, &info->rwork); 828 804 } 829 805 830 806 /* Not called for lateeoi events. */ ··· 1709 1711 int cpu = smp_processor_id(); 1710 1712 struct evtchn_loop_ctrl ctrl = { 0 }; 1711 1713 1712 - read_lock(&evtchn_rwlock); 1714 + /* 1715 + * When closing an event channel the associated IRQ must not be freed 1716 + * until all cpus have left the event handling loop. This is ensured 1717 + * by taking the rcu_read_lock() while handling events, as freeing of 1718 + * the IRQ is handled via queue_rcu_work() _after_ closing the event 1719 + * channel. 1720 + */ 1721 + rcu_read_lock(); 1713 1722 1714 1723 do { 1715 1724 vcpu_info->evtchn_upcall_pending = 0; ··· 1729 1724 1730 1725 } while (vcpu_info->evtchn_upcall_pending); 1731 1726 1732 - read_unlock(&evtchn_rwlock); 1727 + rcu_read_unlock(); 1733 1728 1734 1729 /* 1735 1730 * Increment irq_epoch only now to defer EOIs only for
+39 -13
fs/btrfs/ctree.c
··· 682 682 u64 search_start; 683 683 int ret; 684 684 685 - if (test_bit(BTRFS_ROOT_DELETING, &root->state)) 686 - btrfs_err(fs_info, 687 - "COW'ing blocks on a fs root that's being dropped"); 685 + if (unlikely(test_bit(BTRFS_ROOT_DELETING, &root->state))) { 686 + btrfs_abort_transaction(trans, -EUCLEAN); 687 + btrfs_crit(fs_info, 688 + "attempt to COW block %llu on root %llu that is being deleted", 689 + buf->start, btrfs_root_id(root)); 690 + return -EUCLEAN; 691 + } 688 692 689 - if (trans->transaction != fs_info->running_transaction) 690 - WARN(1, KERN_CRIT "trans %llu running %llu\n", 691 - trans->transid, 692 - fs_info->running_transaction->transid); 693 - 694 - if (trans->transid != fs_info->generation) 695 - WARN(1, KERN_CRIT "trans %llu running %llu\n", 696 - trans->transid, fs_info->generation); 693 + /* 694 + * COWing must happen through a running transaction, which always 695 + * matches the current fs generation (it's a transaction with a state 696 + * less than TRANS_STATE_UNBLOCKED). If it doesn't, then turn the fs 697 + * into error state to prevent the commit of any transaction. 698 + */ 699 + if (unlikely(trans->transaction != fs_info->running_transaction || 700 + trans->transid != fs_info->generation)) { 701 + btrfs_abort_transaction(trans, -EUCLEAN); 702 + btrfs_crit(fs_info, 703 + "unexpected transaction when attempting to COW block %llu on root %llu, transaction %llu running transaction %llu fs generation %llu", 704 + buf->start, btrfs_root_id(root), trans->transid, 705 + fs_info->running_transaction->transid, 706 + fs_info->generation); 707 + return -EUCLEAN; 708 + } 697 709 698 710 if (!should_cow_block(trans, root, buf)) { 699 711 *cow_ret = buf; ··· 817 805 int progress_passed = 0; 818 806 struct btrfs_disk_key disk_key; 819 807 820 - WARN_ON(trans->transaction != fs_info->running_transaction); 821 - WARN_ON(trans->transid != fs_info->generation); 808 + /* 809 + * COWing must happen through a running transaction, which always 810 + * matches the current fs generation (it's a transaction with a state 811 + * less than TRANS_STATE_UNBLOCKED). If it doesn't, then turn the fs 812 + * into error state to prevent the commit of any transaction. 813 + */ 814 + if (unlikely(trans->transaction != fs_info->running_transaction || 815 + trans->transid != fs_info->generation)) { 816 + btrfs_abort_transaction(trans, -EUCLEAN); 817 + btrfs_crit(fs_info, 818 + "unexpected transaction when attempting to reallocate parent %llu for root %llu, transaction %llu running transaction %llu fs generation %llu", 819 + parent->start, btrfs_root_id(root), trans->transid, 820 + fs_info->running_transaction->transid, 821 + fs_info->generation); 822 + return -EUCLEAN; 823 + } 822 824 823 825 parent_nritems = btrfs_header_nritems(parent); 824 826 blocksize = fs_info->nodesize;
+1 -1
fs/btrfs/delayed-inode.c
··· 313 313 { 314 314 struct btrfs_delayed_item *item; 315 315 316 - item = kmalloc(sizeof(*item) + data_len, GFP_NOFS); 316 + item = kmalloc(struct_size(item, data, data_len), GFP_NOFS); 317 317 if (item) { 318 318 item->data_len = data_len; 319 319 item->type = type;
+1 -1
fs/btrfs/delayed-inode.h
··· 95 95 bool logged; 96 96 /* The maximum leaf size is 64K, so u16 is more than enough. */ 97 97 u16 data_len; 98 - char data[]; 98 + char data[] __counted_by(data_len); 99 99 }; 100 100 101 101 static inline void btrfs_init_delayed_root(
+2 -2
fs/btrfs/ioctl.c
··· 2978 2978 static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info, 2979 2979 void __user *arg) 2980 2980 { 2981 - struct btrfs_ioctl_space_args space_args; 2981 + struct btrfs_ioctl_space_args space_args = { 0 }; 2982 2982 struct btrfs_ioctl_space_info space; 2983 2983 struct btrfs_ioctl_space_info *dest; 2984 2984 struct btrfs_ioctl_space_info *dest_orig; ··· 4338 4338 4339 4339 if (compat) { 4340 4340 #if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT) 4341 - struct btrfs_ioctl_send_args_32 args32; 4341 + struct btrfs_ioctl_send_args_32 args32 = { 0 }; 4342 4342 4343 4343 ret = copy_from_user(&args32, argp, sizeof(args32)); 4344 4344 if (ret)
+2 -2
fs/btrfs/transaction.h
··· 219 219 (errno))) { \ 220 220 /* Stack trace printed. */ \ 221 221 } else { \ 222 - btrfs_debug((trans)->fs_info, \ 223 - "Transaction aborted (error %d)", \ 222 + btrfs_err((trans)->fs_info, \ 223 + "Transaction aborted (error %d)", \ 224 224 (errno)); \ 225 225 } \ 226 226 } \
+4 -1
fs/erofs/decompressor_lzma.c
··· 217 217 strm->buf.out_size = min_t(u32, outlen, 218 218 PAGE_SIZE - pageofs); 219 219 outlen -= strm->buf.out_size; 220 - if (!rq->out[no] && rq->fillgaps) /* deduped */ 220 + if (!rq->out[no] && rq->fillgaps) { /* deduped */ 221 221 rq->out[no] = erofs_allocpage(pagepool, 222 222 GFP_KERNEL | __GFP_NOFAIL); 223 + set_page_private(rq->out[no], 224 + Z_EROFS_SHORTLIVED_PAGE); 225 + } 223 226 if (rq->out[no]) 224 227 strm->buf.out = kmap(rq->out[no]) + pageofs; 225 228 pageofs = 0;
+1 -1
fs/erofs/super.c
··· 235 235 return PTR_ERR(ptr); 236 236 dis = ptr + erofs_blkoff(sb, *pos); 237 237 238 - if (!dif->path) { 238 + if (!sbi->devs->flatdev && !dif->path) { 239 239 if (!dis->tag[0]) { 240 240 erofs_err(sb, "empty device tag @ pos %llu", *pos); 241 241 return -EINVAL;
+39 -27
fs/quota/dquot.c
··· 233 233 * All dquots are placed to the end of inuse_list when first created, and this 234 234 * list is used for invalidate operation, which must look at every dquot. 235 235 * 236 - * When the last reference of a dquot will be dropped, the dquot will be 237 - * added to releasing_dquots. We'd then queue work item which would call 236 + * When the last reference of a dquot is dropped, the dquot is added to 237 + * releasing_dquots. We'll then queue work item which will call 238 238 * synchronize_srcu() and after that perform the final cleanup of all the 239 - * dquots on the list. Both releasing_dquots and free_dquots use the 240 - * dq_free list_head in the dquot struct. When a dquot is removed from 241 - * releasing_dquots, a reference count is always subtracted, and if 242 - * dq_count == 0 at that point, the dquot will be added to the free_dquots. 239 + * dquots on the list. Each cleaned up dquot is moved to free_dquots list. 240 + * Both releasing_dquots and free_dquots use the dq_free list_head in the dquot 241 + * struct. 243 242 * 244 - * Unused dquots (dq_count == 0) are added to the free_dquots list when freed, 245 - * and this list is searched whenever we need an available dquot. Dquots are 246 - * removed from the list as soon as they are used again, and 247 - * dqstats.free_dquots gives the number of dquots on the list. When 248 - * dquot is invalidated it's completely released from memory. 243 + * Unused and cleaned up dquots are in the free_dquots list and this list is 244 + * searched whenever we need an available dquot. Dquots are removed from the 245 + * list as soon as they are used again and dqstats.free_dquots gives the number 246 + * of dquots on the list. When dquot is invalidated it's completely released 247 + * from memory. 249 248 * 250 249 * Dirty dquots are added to the dqi_dirty_list of quota_info when mark 251 250 * dirtied, and this list is searched when writing dirty dquots back to ··· 320 321 static inline void put_releasing_dquots(struct dquot *dquot) 321 322 { 322 323 list_add_tail(&dquot->dq_free, &releasing_dquots); 324 + set_bit(DQ_RELEASING_B, &dquot->dq_flags); 323 325 } 324 326 325 327 static inline void remove_free_dquot(struct dquot *dquot) ··· 328 328 if (list_empty(&dquot->dq_free)) 329 329 return; 330 330 list_del_init(&dquot->dq_free); 331 - if (!atomic_read(&dquot->dq_count)) 331 + if (!test_bit(DQ_RELEASING_B, &dquot->dq_flags)) 332 332 dqstats_dec(DQST_FREE_DQUOTS); 333 + else 334 + clear_bit(DQ_RELEASING_B, &dquot->dq_flags); 333 335 } 334 336 335 337 static inline void put_inuse(struct dquot *dquot) ··· 583 581 continue; 584 582 /* Wait for dquot users */ 585 583 if (atomic_read(&dquot->dq_count)) { 586 - /* dquot in releasing_dquots, flush and retry */ 587 - if (!list_empty(&dquot->dq_free)) { 588 - spin_unlock(&dq_list_lock); 589 - goto restart; 590 - } 591 - 592 584 atomic_inc(&dquot->dq_count); 593 585 spin_unlock(&dq_list_lock); 594 586 /* ··· 599 603 /* At this moment dquot() need not exist (it could be 600 604 * reclaimed by prune_dqcache(). Hence we must 601 605 * restart. */ 606 + goto restart; 607 + } 608 + /* 609 + * The last user already dropped its reference but dquot didn't 610 + * get fully cleaned up yet. Restart the scan which flushes the 611 + * work cleaning up released dquots. 612 + */ 613 + if (test_bit(DQ_RELEASING_B, &dquot->dq_flags)) { 614 + spin_unlock(&dq_list_lock); 602 615 goto restart; 603 616 } 604 617 /* ··· 701 696 dq_dirty); 702 697 703 698 WARN_ON(!dquot_active(dquot)); 699 + /* If the dquot is releasing we should not touch it */ 700 + if (test_bit(DQ_RELEASING_B, &dquot->dq_flags)) { 701 + spin_unlock(&dq_list_lock); 702 + flush_delayed_work(&quota_release_work); 703 + spin_lock(&dq_list_lock); 704 + continue; 705 + } 704 706 705 707 /* Now we have active dquot from which someone is 706 708 * holding reference so we can safely just increase ··· 821 809 /* Exchange the list head to avoid livelock. */ 822 810 list_replace_init(&releasing_dquots, &rls_head); 823 811 spin_unlock(&dq_list_lock); 812 + synchronize_srcu(&dquot_srcu); 824 813 825 814 restart: 826 - synchronize_srcu(&dquot_srcu); 827 815 spin_lock(&dq_list_lock); 828 816 while (!list_empty(&rls_head)) { 829 817 dquot = list_first_entry(&rls_head, struct dquot, dq_free); 830 - /* Dquot got used again? */ 831 - if (atomic_read(&dquot->dq_count) > 1) { 832 - remove_free_dquot(dquot); 833 - atomic_dec(&dquot->dq_count); 834 - continue; 835 - } 818 + WARN_ON_ONCE(atomic_read(&dquot->dq_count)); 819 + /* 820 + * Note that DQ_RELEASING_B protects us from racing with 821 + * invalidate_dquots() calls so we are safe to work with the 822 + * dquot even after we drop dq_list_lock. 823 + */ 836 824 if (dquot_dirty(dquot)) { 837 825 spin_unlock(&dq_list_lock); 838 826 /* Commit dquot before releasing */ ··· 846 834 } 847 835 /* Dquot is inactive and clean, now move it to free list */ 848 836 remove_free_dquot(dquot); 849 - atomic_dec(&dquot->dq_count); 850 837 put_dquot_last(dquot); 851 838 } 852 839 spin_unlock(&dq_list_lock); ··· 886 875 BUG_ON(!list_empty(&dquot->dq_free)); 887 876 #endif 888 877 put_releasing_dquots(dquot); 878 + atomic_dec(&dquot->dq_count); 889 879 spin_unlock(&dq_list_lock); 890 880 queue_delayed_work(system_unbound_wq, &quota_release_work, 1); 891 881 } ··· 975 963 dqstats_inc(DQST_LOOKUPS); 976 964 } 977 965 /* Wait for dq_lock - after this we know that either dquot_release() is 978 - * already finished or it will be canceled due to dq_count > 1 test */ 966 + * already finished or it will be canceled due to dq_count > 0 test */ 979 967 wait_on_dquot(dquot); 980 968 /* Read the dquot / allocate space in quota file */ 981 969 if (!dquot_active(dquot)) {
+13 -13
fs/smb/client/connect.c
··· 2474 2474 static struct cifs_tcon * 2475 2475 cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) 2476 2476 { 2477 - int rc, xid; 2478 2477 struct cifs_tcon *tcon; 2478 + bool nohandlecache; 2479 + int rc, xid; 2479 2480 2480 2481 tcon = cifs_find_tcon(ses, ctx); 2481 2482 if (tcon) { ··· 2494 2493 goto out_fail; 2495 2494 } 2496 2495 2497 - if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) 2498 - tcon = tcon_info_alloc(true); 2496 + if (ses->server->dialect >= SMB20_PROT_ID && 2497 + (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING)) 2498 + nohandlecache = ctx->nohandlecache; 2499 2499 else 2500 - tcon = tcon_info_alloc(false); 2500 + nohandlecache = true; 2501 + tcon = tcon_info_alloc(!nohandlecache); 2501 2502 if (tcon == NULL) { 2502 2503 rc = -ENOMEM; 2503 2504 goto out_fail; 2504 2505 } 2506 + tcon->nohandlecache = nohandlecache; 2505 2507 2506 2508 if (ctx->snapshot_time) { 2507 2509 if (ses->server->vals->protocol_id == 0) { ··· 2666 2662 tcon->nocase = ctx->nocase; 2667 2663 tcon->broken_sparse_sup = ctx->no_sparse; 2668 2664 tcon->max_cached_dirs = ctx->max_cached_dirs; 2669 - if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) 2670 - tcon->nohandlecache = ctx->nohandlecache; 2671 - else 2672 - tcon->nohandlecache = true; 2673 2665 tcon->nodelete = ctx->nodelete; 2674 2666 tcon->local_lease = ctx->local_lease; 2675 2667 INIT_LIST_HEAD(&tcon->pending_opens); ··· 2895 2895 if (server->srcaddr.ss_family != AF_UNSPEC) { 2896 2896 /* Bind to the specified local IP address */ 2897 2897 struct socket *socket = server->ssocket; 2898 - rc = socket->ops->bind(socket, 2899 - (struct sockaddr *) &server->srcaddr, 2900 - sizeof(server->srcaddr)); 2898 + rc = kernel_bind(socket, 2899 + (struct sockaddr *) &server->srcaddr, 2900 + sizeof(server->srcaddr)); 2901 2901 if (rc < 0) { 2902 2902 struct sockaddr_in *saddr4; 2903 2903 struct sockaddr_in6 *saddr6; ··· 3046 3046 socket->sk->sk_sndbuf, 3047 3047 socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo); 3048 3048 3049 - rc = socket->ops->connect(socket, saddr, slen, 3050 - server->noblockcnt ? O_NONBLOCK : 0); 3049 + rc = kernel_connect(socket, saddr, slen, 3050 + server->noblockcnt ? O_NONBLOCK : 0); 3051 3051 /* 3052 3052 * When mounting SMB root file systems, we do not want to block in 3053 3053 * connect. Otherwise bail out and then let cifs_reconnect() perform
+2
fs/smb/server/connection.c
··· 84 84 spin_lock_init(&conn->llist_lock); 85 85 INIT_LIST_HEAD(&conn->lock_list); 86 86 87 + init_rwsem(&conn->session_lock); 88 + 87 89 down_write(&conn_list_lock); 88 90 list_add(&conn->conns_list, &conn_list); 89 91 up_write(&conn_list_lock);
+1
fs/smb/server/connection.h
··· 50 50 struct nls_table *local_nls; 51 51 struct unicode_map *um; 52 52 struct list_head conns_list; 53 + struct rw_semaphore session_lock; 53 54 /* smb session 1 per user */ 54 55 struct xarray sessions; 55 56 unsigned long last_active;
+39 -3
fs/smb/server/mgmt/tree_connect.c
··· 73 73 74 74 tree_conn->user = sess->user; 75 75 tree_conn->share_conf = sc; 76 + tree_conn->t_state = TREE_NEW; 76 77 status.tree_conn = tree_conn; 78 + atomic_set(&tree_conn->refcount, 1); 79 + init_waitqueue_head(&tree_conn->refcount_q); 77 80 78 81 ret = xa_err(xa_store(&sess->tree_conns, tree_conn->id, tree_conn, 79 82 GFP_KERNEL)); ··· 96 93 return status; 97 94 } 98 95 96 + void ksmbd_tree_connect_put(struct ksmbd_tree_connect *tcon) 97 + { 98 + /* 99 + * Checking waitqueue to releasing tree connect on 100 + * tree disconnect. waitqueue_active is safe because it 101 + * uses atomic operation for condition. 102 + */ 103 + if (!atomic_dec_return(&tcon->refcount) && 104 + waitqueue_active(&tcon->refcount_q)) 105 + wake_up(&tcon->refcount_q); 106 + } 107 + 99 108 int ksmbd_tree_conn_disconnect(struct ksmbd_session *sess, 100 109 struct ksmbd_tree_connect *tree_conn) 101 110 { 102 111 int ret; 103 112 113 + write_lock(&sess->tree_conns_lock); 114 + xa_erase(&sess->tree_conns, tree_conn->id); 115 + write_unlock(&sess->tree_conns_lock); 116 + 117 + if (!atomic_dec_and_test(&tree_conn->refcount)) 118 + wait_event(tree_conn->refcount_q, 119 + atomic_read(&tree_conn->refcount) == 0); 120 + 104 121 ret = ksmbd_ipc_tree_disconnect_request(sess->id, tree_conn->id); 105 122 ksmbd_release_tree_conn_id(sess, tree_conn->id); 106 - xa_erase(&sess->tree_conns, tree_conn->id); 107 123 ksmbd_share_config_put(tree_conn->share_conf); 108 124 kfree(tree_conn); 109 125 return ret; ··· 133 111 { 134 112 struct ksmbd_tree_connect *tcon; 135 113 114 + read_lock(&sess->tree_conns_lock); 136 115 tcon = xa_load(&sess->tree_conns, id); 137 116 if (tcon) { 138 - if (test_bit(TREE_CONN_EXPIRE, &tcon->status)) 117 + if (tcon->t_state != TREE_CONNECTED) 118 + tcon = NULL; 119 + else if (!atomic_inc_not_zero(&tcon->refcount)) 139 120 tcon = NULL; 140 121 } 122 + read_unlock(&sess->tree_conns_lock); 141 123 142 124 return tcon; 143 125 } ··· 155 129 if (!sess) 156 130 return -EINVAL; 157 131 158 - xa_for_each(&sess->tree_conns, id, tc) 132 + xa_for_each(&sess->tree_conns, id, tc) { 133 + write_lock(&sess->tree_conns_lock); 134 + if (tc->t_state == TREE_DISCONNECTED) { 135 + write_unlock(&sess->tree_conns_lock); 136 + ret = -ENOENT; 137 + continue; 138 + } 139 + tc->t_state = TREE_DISCONNECTED; 140 + write_unlock(&sess->tree_conns_lock); 141 + 159 142 ret |= ksmbd_tree_conn_disconnect(sess, tc); 143 + } 160 144 xa_destroy(&sess->tree_conns); 161 145 return ret; 162 146 }
+9 -2
fs/smb/server/mgmt/tree_connect.h
··· 14 14 struct ksmbd_user; 15 15 struct ksmbd_conn; 16 16 17 - #define TREE_CONN_EXPIRE 1 17 + enum { 18 + TREE_NEW = 0, 19 + TREE_CONNECTED, 20 + TREE_DISCONNECTED 21 + }; 18 22 19 23 struct ksmbd_tree_connect { 20 24 int id; ··· 31 27 32 28 int maximal_access; 33 29 bool posix_extensions; 34 - unsigned long status; 30 + atomic_t refcount; 31 + wait_queue_head_t refcount_q; 32 + unsigned int t_state; 35 33 }; 36 34 37 35 struct ksmbd_tree_conn_status { ··· 52 46 struct ksmbd_tree_conn_status 53 47 ksmbd_tree_conn_connect(struct ksmbd_conn *conn, struct ksmbd_session *sess, 54 48 const char *share_name); 49 + void ksmbd_tree_connect_put(struct ksmbd_tree_connect *tcon); 55 50 56 51 int ksmbd_tree_conn_disconnect(struct ksmbd_session *sess, 57 52 struct ksmbd_tree_connect *tree_conn);
+8 -3
fs/smb/server/mgmt/user_session.c
··· 174 174 unsigned long id; 175 175 struct ksmbd_session *sess; 176 176 177 - down_write(&sessions_table_lock); 177 + down_write(&conn->session_lock); 178 178 xa_for_each(&conn->sessions, id, sess) { 179 179 if (sess->state != SMB2_SESSION_VALID || 180 180 time_after(jiffies, ··· 185 185 continue; 186 186 } 187 187 } 188 - up_write(&sessions_table_lock); 188 + up_write(&conn->session_lock); 189 189 } 190 190 191 191 int ksmbd_session_register(struct ksmbd_conn *conn, ··· 227 227 } 228 228 } 229 229 } 230 + up_write(&sessions_table_lock); 230 231 232 + down_write(&conn->session_lock); 231 233 xa_for_each(&conn->sessions, id, sess) { 232 234 unsigned long chann_id; 233 235 struct channel *chann; ··· 246 244 ksmbd_session_destroy(sess); 247 245 } 248 246 } 249 - up_write(&sessions_table_lock); 247 + up_write(&conn->session_lock); 250 248 } 251 249 252 250 struct ksmbd_session *ksmbd_session_lookup(struct ksmbd_conn *conn, ··· 254 252 { 255 253 struct ksmbd_session *sess; 256 254 255 + down_read(&conn->session_lock); 257 256 sess = xa_load(&conn->sessions, id); 258 257 if (sess) 259 258 sess->last_active = jiffies; 259 + up_read(&conn->session_lock); 260 260 return sess; 261 261 } 262 262 ··· 355 351 xa_init(&sess->ksmbd_chann_list); 356 352 xa_init(&sess->rpc_handle_list); 357 353 sess->sequence_number = 1; 354 + rwlock_init(&sess->tree_conns_lock); 358 355 359 356 ret = __init_smb2_session(sess); 360 357 if (ret)
+1
fs/smb/server/mgmt/user_session.h
··· 60 60 61 61 struct ksmbd_file_table file_table; 62 62 unsigned long last_active; 63 + rwlock_t tree_conns_lock; 63 64 }; 64 65 65 66 static inline int test_session_flag(struct ksmbd_session *sess, int bit)
+2
fs/smb/server/server.c
··· 241 241 } while (is_chained == true); 242 242 243 243 send: 244 + if (work->tcon) 245 + ksmbd_tree_connect_put(work->tcon); 244 246 smb3_preauth_hash_rsp(work); 245 247 if (work->sess && work->sess->enc && work->encrypted && 246 248 conn->ops->encrypt_resp) {
+61 -35
fs/smb/server/smb2pdu.c
··· 1993 1993 if (conn->posix_ext_supported) 1994 1994 status.tree_conn->posix_extensions = true; 1995 1995 1996 + write_lock(&sess->tree_conns_lock); 1997 + status.tree_conn->t_state = TREE_CONNECTED; 1998 + write_unlock(&sess->tree_conns_lock); 1996 1999 rsp->StructureSize = cpu_to_le16(16); 1997 2000 out_err1: 1998 2001 rsp->Capabilities = 0; ··· 2125 2122 2126 2123 ksmbd_debug(SMB, "request\n"); 2127 2124 2125 + if (!tcon) { 2126 + ksmbd_debug(SMB, "Invalid tid %d\n", req->hdr.Id.SyncId.TreeId); 2127 + 2128 + rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED; 2129 + err = -ENOENT; 2130 + goto err_out; 2131 + } 2132 + 2133 + ksmbd_close_tree_conn_fds(work); 2134 + 2135 + write_lock(&sess->tree_conns_lock); 2136 + if (tcon->t_state == TREE_DISCONNECTED) { 2137 + write_unlock(&sess->tree_conns_lock); 2138 + rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED; 2139 + err = -ENOENT; 2140 + goto err_out; 2141 + } 2142 + 2143 + WARN_ON_ONCE(atomic_dec_and_test(&tcon->refcount)); 2144 + tcon->t_state = TREE_DISCONNECTED; 2145 + write_unlock(&sess->tree_conns_lock); 2146 + 2147 + err = ksmbd_tree_conn_disconnect(sess, tcon); 2148 + if (err) { 2149 + rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED; 2150 + goto err_out; 2151 + } 2152 + 2153 + work->tcon = NULL; 2154 + 2128 2155 rsp->StructureSize = cpu_to_le16(4); 2129 2156 err = ksmbd_iov_pin_rsp(work, rsp, 2130 2157 sizeof(struct smb2_tree_disconnect_rsp)); 2131 2158 if (err) { 2132 2159 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES; 2133 - smb2_set_err_rsp(work); 2134 - return err; 2160 + goto err_out; 2135 2161 } 2136 2162 2137 - if (!tcon || test_and_set_bit(TREE_CONN_EXPIRE, &tcon->status)) { 2138 - ksmbd_debug(SMB, "Invalid tid %d\n", req->hdr.Id.SyncId.TreeId); 2139 - 2140 - rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED; 2141 - smb2_set_err_rsp(work); 2142 - return -ENOENT; 2143 - } 2144 - 2145 - ksmbd_close_tree_conn_fds(work); 2146 - ksmbd_tree_conn_disconnect(sess, tcon); 2147 - work->tcon = NULL; 2148 2163 return 0; 2164 + 2165 + err_out: 2166 + smb2_set_err_rsp(work); 2167 + return err; 2168 + 2149 2169 } 2150 2170 2151 2171 /** ··· 2190 2164 2191 2165 ksmbd_debug(SMB, "request\n"); 2192 2166 2193 - sess_id = le64_to_cpu(req->hdr.SessionId); 2194 - 2195 - rsp->StructureSize = cpu_to_le16(4); 2196 - err = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_logoff_rsp)); 2197 - if (err) { 2198 - rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES; 2167 + ksmbd_conn_lock(conn); 2168 + if (!ksmbd_conn_good(conn)) { 2169 + ksmbd_conn_unlock(conn); 2170 + rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED; 2199 2171 smb2_set_err_rsp(work); 2200 - return err; 2172 + return -ENOENT; 2201 2173 } 2202 - 2174 + sess_id = le64_to_cpu(req->hdr.SessionId); 2203 2175 ksmbd_all_conn_set_status(sess_id, KSMBD_SESS_NEED_RECONNECT); 2176 + ksmbd_conn_unlock(conn); 2177 + 2204 2178 ksmbd_close_session_fds(work); 2205 2179 ksmbd_conn_wait_idle(conn, sess_id); 2206 2180 ··· 2222 2196 ksmbd_free_user(sess->user); 2223 2197 sess->user = NULL; 2224 2198 ksmbd_all_conn_set_status(sess_id, KSMBD_SESS_NEED_NEGOTIATE); 2199 + 2200 + rsp->StructureSize = cpu_to_le16(4); 2201 + err = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_logoff_rsp)); 2202 + if (err) { 2203 + rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES; 2204 + smb2_set_err_rsp(work); 2205 + return err; 2206 + } 2225 2207 return 0; 2226 2208 } 2227 2209 ··· 3404 3370 } 3405 3371 ksmbd_revert_fsids(work); 3406 3372 err_out1: 3407 - if (!rc) 3373 + if (!rc) { 3374 + ksmbd_update_fstate(&work->sess->file_table, fp, FP_INITED); 3408 3375 rc = ksmbd_iov_pin_rsp(work, (void *)rsp, iov_len); 3376 + } 3409 3377 if (rc) { 3410 3378 if (rc == -EINVAL) 3411 3379 rsp->hdr.Status = STATUS_INVALID_PARAMETER; ··· 7064 7028 7065 7029 ksmbd_debug(SMB, 7066 7030 "would have to wait for getting lock\n"); 7067 - spin_lock(&work->conn->llist_lock); 7068 - list_add_tail(&smb_lock->clist, 7069 - &work->conn->lock_list); 7070 - spin_unlock(&work->conn->llist_lock); 7071 7031 list_add(&smb_lock->llist, &rollback_list); 7072 7032 7073 7033 argv = kmalloc(sizeof(void *), GFP_KERNEL); ··· 7094 7062 7095 7063 if (work->state != KSMBD_WORK_ACTIVE) { 7096 7064 list_del(&smb_lock->llist); 7097 - spin_lock(&work->conn->llist_lock); 7098 - list_del(&smb_lock->clist); 7099 - spin_unlock(&work->conn->llist_lock); 7100 7065 locks_free_lock(flock); 7101 7066 7102 7067 if (work->state == KSMBD_WORK_CANCELLED) { ··· 7113 7084 } 7114 7085 7115 7086 list_del(&smb_lock->llist); 7116 - spin_lock(&work->conn->llist_lock); 7117 - list_del(&smb_lock->clist); 7118 - spin_unlock(&work->conn->llist_lock); 7119 7087 release_async_work(work); 7120 7088 goto retry; 7121 7089 } else if (!rc) { 7090 + list_add(&smb_lock->llist, &rollback_list); 7122 7091 spin_lock(&work->conn->llist_lock); 7123 7092 list_add_tail(&smb_lock->clist, 7124 7093 &work->conn->lock_list); 7125 7094 list_add_tail(&smb_lock->flist, 7126 7095 &fp->lock_list); 7127 7096 spin_unlock(&work->conn->llist_lock); 7128 - list_add(&smb_lock->llist, &rollback_list); 7129 7097 ksmbd_debug(SMB, "successful in taking lock\n"); 7130 7098 } else { 7131 7099 goto out; ··· 8062 8036 goto err_out; 8063 8037 } 8064 8038 8065 - opinfo_put(opinfo); 8066 - ksmbd_fd_put(work, fp); 8067 8039 opinfo->op_state = OPLOCK_STATE_NONE; 8068 8040 wake_up_interruptible_all(&opinfo->oplock_q); 8041 + opinfo_put(opinfo); 8042 + ksmbd_fd_put(work, fp); 8069 8043 8070 8044 rsp->StructureSize = cpu_to_le16(24); 8071 8045 rsp->OplockLevel = rsp_oplevel;
+20 -3
fs/smb/server/vfs_cache.c
··· 333 333 334 334 static struct ksmbd_file *ksmbd_fp_get(struct ksmbd_file *fp) 335 335 { 336 + if (fp->f_state != FP_INITED) 337 + return NULL; 338 + 336 339 if (!atomic_inc_not_zero(&fp->refcount)) 337 340 return NULL; 338 341 return fp; ··· 385 382 return 0; 386 383 387 384 ft = &work->sess->file_table; 388 - read_lock(&ft->lock); 385 + write_lock(&ft->lock); 389 386 fp = idr_find(ft->idr, id); 390 387 if (fp) { 391 388 set_close_state_blocked_works(fp); 392 389 393 - if (!atomic_dec_and_test(&fp->refcount)) 390 + if (fp->f_state != FP_INITED) 394 391 fp = NULL; 392 + else { 393 + fp->f_state = FP_CLOSED; 394 + if (!atomic_dec_and_test(&fp->refcount)) 395 + fp = NULL; 396 + } 395 397 } 396 - read_unlock(&ft->lock); 398 + write_unlock(&ft->lock); 397 399 398 400 if (!fp) 399 401 return -EINVAL; ··· 578 570 fp->tcon = work->tcon; 579 571 fp->volatile_id = KSMBD_NO_FID; 580 572 fp->persistent_id = KSMBD_NO_FID; 573 + fp->f_state = FP_NEW; 581 574 fp->f_ci = ksmbd_inode_get(fp); 582 575 583 576 if (!fp->f_ci) { ··· 598 589 err_out: 599 590 kmem_cache_free(filp_cache, fp); 600 591 return ERR_PTR(ret); 592 + } 593 + 594 + void ksmbd_update_fstate(struct ksmbd_file_table *ft, struct ksmbd_file *fp, 595 + unsigned int state) 596 + { 597 + write_lock(&ft->lock); 598 + fp->f_state = state; 599 + write_unlock(&ft->lock); 601 600 } 602 601 603 602 static int
+9
fs/smb/server/vfs_cache.h
··· 60 60 __le32 m_fattr; 61 61 }; 62 62 63 + enum { 64 + FP_NEW = 0, 65 + FP_INITED, 66 + FP_CLOSED 67 + }; 68 + 63 69 struct ksmbd_file { 64 70 struct file *filp; 65 71 u64 persistent_id; ··· 104 98 /* if ls is happening on directory, below is valid*/ 105 99 struct ksmbd_readdir_data readdir_data; 106 100 int dot_dotdot[2]; 101 + unsigned int f_state; 107 102 }; 108 103 109 104 static inline void set_ctx_actor(struct dir_context *ctx, ··· 149 142 int ksmbd_init_global_file_table(void); 150 143 void ksmbd_free_global_file_table(void); 151 144 void ksmbd_set_fd_limit(unsigned long limit); 145 + void ksmbd_update_fstate(struct ksmbd_file_table *ft, struct ksmbd_file *fp, 146 + unsigned int state); 152 147 153 148 /* 154 149 * INODE hash
+242 -24
fs/xfs/xfs_discard.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * Copyright (C) 2010 Red Hat, Inc. 3 + * Copyright (C) 2010, 2023 Red Hat, Inc. 4 4 * All Rights Reserved. 5 5 */ 6 6 #include "xfs.h" ··· 19 19 #include "xfs_log.h" 20 20 #include "xfs_ag.h" 21 21 22 - STATIC int 23 - xfs_trim_extents( 22 + /* 23 + * Notes on an efficient, low latency fstrim algorithm 24 + * 25 + * We need to walk the filesystem free space and issue discards on the free 26 + * space that meet the search criteria (size and location). We cannot issue 27 + * discards on extents that might be in use, or are so recently in use they are 28 + * still marked as busy. To serialise against extent state changes whilst we are 29 + * gathering extents to trim, we must hold the AGF lock to lock out other 30 + * allocations and extent free operations that might change extent state. 31 + * 32 + * However, we cannot just hold the AGF for the entire AG free space walk whilst 33 + * we issue discards on each free space that is found. Storage devices can have 34 + * extremely slow discard implementations (e.g. ceph RBD) and so walking a 35 + * couple of million free extents and issuing synchronous discards on each 36 + * extent can take a *long* time. Whilst we are doing this walk, nothing else 37 + * can access the AGF, and we can stall transactions and hence the log whilst 38 + * modifications wait for the AGF lock to be released. This can lead hung tasks 39 + * kicking the hung task timer and rebooting the system. This is bad. 40 + * 41 + * Hence we need to take a leaf from the bulkstat playbook. It takes the AGI 42 + * lock, gathers a range of inode cluster buffers that are allocated, drops the 43 + * AGI lock and then reads all the inode cluster buffers and processes them. It 44 + * loops doing this, using a cursor to keep track of where it is up to in the AG 45 + * for each iteration to restart the INOBT lookup from. 46 + * 47 + * We can't do this exactly with free space - once we drop the AGF lock, the 48 + * state of the free extent is out of our control and we cannot run a discard 49 + * safely on it in this situation. Unless, of course, we've marked the free 50 + * extent as busy and undergoing a discard operation whilst we held the AGF 51 + * locked. 52 + * 53 + * This is exactly how online discard works - free extents are marked busy when 54 + * they are freed, and once the extent free has been committed to the journal, 55 + * the busy extent record is marked as "undergoing discard" and the discard is 56 + * then issued on the free extent. Once the discard completes, the busy extent 57 + * record is removed and the extent is able to be allocated again. 58 + * 59 + * In the context of fstrim, if we find a free extent we need to discard, we 60 + * don't have to discard it immediately. All we need to do it record that free 61 + * extent as being busy and under discard, and all the allocation routines will 62 + * now avoid trying to allocate it. Hence if we mark the extent as busy under 63 + * the AGF lock, we can safely discard it without holding the AGF lock because 64 + * nothing will attempt to allocate that free space until the discard completes. 65 + * 66 + * This also allows us to issue discards asynchronously like we do with online 67 + * discard, and so for fast devices fstrim will run much faster as we can have 68 + * multiple discard operations in flight at once, as well as pipeline the free 69 + * extent search so that it overlaps in flight discard IO. 70 + */ 71 + 72 + struct workqueue_struct *xfs_discard_wq; 73 + 74 + static void 75 + xfs_discard_endio_work( 76 + struct work_struct *work) 77 + { 78 + struct xfs_busy_extents *extents = 79 + container_of(work, struct xfs_busy_extents, endio_work); 80 + 81 + xfs_extent_busy_clear(extents->mount, &extents->extent_list, false); 82 + kmem_free(extents->owner); 83 + } 84 + 85 + /* 86 + * Queue up the actual completion to a thread to avoid IRQ-safe locking for 87 + * pagb_lock. 88 + */ 89 + static void 90 + xfs_discard_endio( 91 + struct bio *bio) 92 + { 93 + struct xfs_busy_extents *extents = bio->bi_private; 94 + 95 + INIT_WORK(&extents->endio_work, xfs_discard_endio_work); 96 + queue_work(xfs_discard_wq, &extents->endio_work); 97 + bio_put(bio); 98 + } 99 + 100 + /* 101 + * Walk the discard list and issue discards on all the busy extents in the 102 + * list. We plug and chain the bios so that we only need a single completion 103 + * call to clear all the busy extents once the discards are complete. 104 + */ 105 + int 106 + xfs_discard_extents( 107 + struct xfs_mount *mp, 108 + struct xfs_busy_extents *extents) 109 + { 110 + struct xfs_extent_busy *busyp; 111 + struct bio *bio = NULL; 112 + struct blk_plug plug; 113 + int error = 0; 114 + 115 + blk_start_plug(&plug); 116 + list_for_each_entry(busyp, &extents->extent_list, list) { 117 + trace_xfs_discard_extent(mp, busyp->agno, busyp->bno, 118 + busyp->length); 119 + 120 + error = __blkdev_issue_discard(mp->m_ddev_targp->bt_bdev, 121 + XFS_AGB_TO_DADDR(mp, busyp->agno, busyp->bno), 122 + XFS_FSB_TO_BB(mp, busyp->length), 123 + GFP_NOFS, &bio); 124 + if (error && error != -EOPNOTSUPP) { 125 + xfs_info(mp, 126 + "discard failed for extent [0x%llx,%u], error %d", 127 + (unsigned long long)busyp->bno, 128 + busyp->length, 129 + error); 130 + break; 131 + } 132 + } 133 + 134 + if (bio) { 135 + bio->bi_private = extents; 136 + bio->bi_end_io = xfs_discard_endio; 137 + submit_bio(bio); 138 + } else { 139 + xfs_discard_endio_work(&extents->endio_work); 140 + } 141 + blk_finish_plug(&plug); 142 + 143 + return error; 144 + } 145 + 146 + 147 + static int 148 + xfs_trim_gather_extents( 24 149 struct xfs_perag *pag, 25 150 xfs_daddr_t start, 26 151 xfs_daddr_t end, 27 152 xfs_daddr_t minlen, 153 + struct xfs_alloc_rec_incore *tcur, 154 + struct xfs_busy_extents *extents, 28 155 uint64_t *blocks_trimmed) 29 156 { 30 157 struct xfs_mount *mp = pag->pag_mount; 31 - struct block_device *bdev = mp->m_ddev_targp->bt_bdev; 32 158 struct xfs_btree_cur *cur; 33 159 struct xfs_buf *agbp; 34 - struct xfs_agf *agf; 35 160 int error; 36 161 int i; 162 + int batch = 100; 37 163 38 164 /* 39 165 * Force out the log. This means any transactions that might have freed ··· 171 45 error = xfs_alloc_read_agf(pag, NULL, 0, &agbp); 172 46 if (error) 173 47 return error; 174 - agf = agbp->b_addr; 175 48 176 49 cur = xfs_allocbt_init_cursor(mp, NULL, agbp, pag, XFS_BTNUM_CNT); 177 50 178 51 /* 179 - * Look up the longest btree in the AGF and start with it. 52 + * Look up the extent length requested in the AGF and start with it. 180 53 */ 181 - error = xfs_alloc_lookup_ge(cur, 0, be32_to_cpu(agf->agf_longest), &i); 54 + if (tcur->ar_startblock == NULLAGBLOCK) 55 + error = xfs_alloc_lookup_ge(cur, 0, tcur->ar_blockcount, &i); 56 + else 57 + error = xfs_alloc_lookup_le(cur, tcur->ar_startblock, 58 + tcur->ar_blockcount, &i); 182 59 if (error) 183 60 goto out_del_cursor; 61 + if (i == 0) { 62 + /* nothing of that length left in the AG, we are done */ 63 + tcur->ar_blockcount = 0; 64 + goto out_del_cursor; 65 + } 184 66 185 67 /* 186 68 * Loop until we are done with all extents that are large 187 - * enough to be worth discarding. 69 + * enough to be worth discarding or we hit batch limits. 188 70 */ 189 71 while (i) { 190 72 xfs_agblock_t fbno; ··· 207 73 error = -EFSCORRUPTED; 208 74 break; 209 75 } 210 - ASSERT(flen <= be32_to_cpu(agf->agf_longest)); 76 + 77 + if (--batch <= 0) { 78 + /* 79 + * Update the cursor to point at this extent so we 80 + * restart the next batch from this extent. 81 + */ 82 + tcur->ar_startblock = fbno; 83 + tcur->ar_blockcount = flen; 84 + break; 85 + } 211 86 212 87 /* 213 88 * use daddr format for all range/len calculations as that is ··· 231 88 */ 232 89 if (dlen < minlen) { 233 90 trace_xfs_discard_toosmall(mp, pag->pag_agno, fbno, flen); 91 + tcur->ar_blockcount = 0; 234 92 break; 235 93 } 236 94 ··· 254 110 goto next_extent; 255 111 } 256 112 257 - trace_xfs_discard_extent(mp, pag->pag_agno, fbno, flen); 258 - error = blkdev_issue_discard(bdev, dbno, dlen, GFP_NOFS); 259 - if (error) 260 - break; 113 + xfs_extent_busy_insert_discard(pag, fbno, flen, 114 + &extents->extent_list); 261 115 *blocks_trimmed += flen; 262 - 263 116 next_extent: 264 117 error = xfs_btree_decrement(cur, 0, &i); 265 118 if (error) 266 119 break; 267 120 268 - if (fatal_signal_pending(current)) { 269 - error = -ERESTARTSYS; 270 - break; 271 - } 121 + /* 122 + * If there's no more records in the tree, we are done. Set the 123 + * cursor block count to 0 to indicate to the caller that there 124 + * is no more extents to search. 125 + */ 126 + if (i == 0) 127 + tcur->ar_blockcount = 0; 272 128 } 273 129 130 + /* 131 + * If there was an error, release all the gathered busy extents because 132 + * we aren't going to issue a discard on them any more. 133 + */ 134 + if (error) 135 + xfs_extent_busy_clear(mp, &extents->extent_list, false); 274 136 out_del_cursor: 275 137 xfs_btree_del_cursor(cur, error); 276 138 xfs_buf_relse(agbp); 277 139 return error; 140 + } 141 + 142 + static bool 143 + xfs_trim_should_stop(void) 144 + { 145 + return fatal_signal_pending(current) || freezing(current); 146 + } 147 + 148 + /* 149 + * Iterate the free list gathering extents and discarding them. We need a cursor 150 + * for the repeated iteration of gather/discard loop, so use the longest extent 151 + * we found in the last batch as the key to start the next. 152 + */ 153 + static int 154 + xfs_trim_extents( 155 + struct xfs_perag *pag, 156 + xfs_daddr_t start, 157 + xfs_daddr_t end, 158 + xfs_daddr_t minlen, 159 + uint64_t *blocks_trimmed) 160 + { 161 + struct xfs_alloc_rec_incore tcur = { 162 + .ar_blockcount = pag->pagf_longest, 163 + .ar_startblock = NULLAGBLOCK, 164 + }; 165 + int error = 0; 166 + 167 + do { 168 + struct xfs_busy_extents *extents; 169 + 170 + extents = kzalloc(sizeof(*extents), GFP_KERNEL); 171 + if (!extents) { 172 + error = -ENOMEM; 173 + break; 174 + } 175 + 176 + extents->mount = pag->pag_mount; 177 + extents->owner = extents; 178 + INIT_LIST_HEAD(&extents->extent_list); 179 + 180 + error = xfs_trim_gather_extents(pag, start, end, minlen, 181 + &tcur, extents, blocks_trimmed); 182 + if (error) { 183 + kfree(extents); 184 + break; 185 + } 186 + 187 + /* 188 + * We hand the extent list to the discard function here so the 189 + * discarded extents can be removed from the busy extent list. 190 + * This allows the discards to run asynchronously with gathering 191 + * the next round of extents to discard. 192 + * 193 + * However, we must ensure that we do not reference the extent 194 + * list after this function call, as it may have been freed by 195 + * the time control returns to us. 196 + */ 197 + error = xfs_discard_extents(pag->pag_mount, extents); 198 + if (error) 199 + break; 200 + 201 + if (xfs_trim_should_stop()) 202 + break; 203 + 204 + } while (tcur.ar_blockcount != 0); 205 + 206 + return error; 207 + 278 208 } 279 209 280 210 /* ··· 413 195 for_each_perag_range(mp, agno, xfs_daddr_to_agno(mp, end), pag) { 414 196 error = xfs_trim_extents(pag, start, end, minlen, 415 197 &blocks_trimmed); 416 - if (error) { 198 + if (error) 417 199 last_error = error; 418 - if (error == -ERESTARTSYS) { 419 - xfs_perag_rele(pag); 420 - break; 421 - } 200 + 201 + if (xfs_trim_should_stop()) { 202 + xfs_perag_rele(pag); 203 + break; 422 204 } 423 205 } 424 206
+4 -2
fs/xfs/xfs_discard.h
··· 3 3 #define XFS_DISCARD_H 1 4 4 5 5 struct fstrim_range; 6 - struct list_head; 6 + struct xfs_mount; 7 + struct xfs_busy_extents; 7 8 8 - extern int xfs_ioc_trim(struct xfs_mount *, struct fstrim_range __user *); 9 + int xfs_discard_extents(struct xfs_mount *mp, struct xfs_busy_extents *busy); 10 + int xfs_ioc_trim(struct xfs_mount *mp, struct fstrim_range __user *fstrim); 9 11 10 12 #endif /* XFS_DISCARD_H */
+28 -6
fs/xfs/xfs_extent_busy.c
··· 19 19 #include "xfs_log.h" 20 20 #include "xfs_ag.h" 21 21 22 - void 23 - xfs_extent_busy_insert( 24 - struct xfs_trans *tp, 22 + static void 23 + xfs_extent_busy_insert_list( 25 24 struct xfs_perag *pag, 26 25 xfs_agblock_t bno, 27 26 xfs_extlen_t len, 28 - unsigned int flags) 27 + unsigned int flags, 28 + struct list_head *busy_list) 29 29 { 30 30 struct xfs_extent_busy *new; 31 31 struct xfs_extent_busy *busyp; ··· 40 40 new->flags = flags; 41 41 42 42 /* trace before insert to be able to see failed inserts */ 43 - trace_xfs_extent_busy(tp->t_mountp, pag->pag_agno, bno, len); 43 + trace_xfs_extent_busy(pag->pag_mount, pag->pag_agno, bno, len); 44 44 45 45 spin_lock(&pag->pagb_lock); 46 46 rbp = &pag->pagb_tree.rb_node; ··· 62 62 rb_link_node(&new->rb_node, parent, rbp); 63 63 rb_insert_color(&new->rb_node, &pag->pagb_tree); 64 64 65 - list_add(&new->list, &tp->t_busy); 65 + list_add(&new->list, busy_list); 66 66 spin_unlock(&pag->pagb_lock); 67 + } 68 + 69 + void 70 + xfs_extent_busy_insert( 71 + struct xfs_trans *tp, 72 + struct xfs_perag *pag, 73 + xfs_agblock_t bno, 74 + xfs_extlen_t len, 75 + unsigned int flags) 76 + { 77 + xfs_extent_busy_insert_list(pag, bno, len, flags, &tp->t_busy); 78 + } 79 + 80 + void 81 + xfs_extent_busy_insert_discard( 82 + struct xfs_perag *pag, 83 + xfs_agblock_t bno, 84 + xfs_extlen_t len, 85 + struct list_head *busy_list) 86 + { 87 + xfs_extent_busy_insert_list(pag, bno, len, XFS_EXTENT_BUSY_DISCARDED, 88 + busy_list); 67 89 } 68 90 69 91 /*
+21 -3
fs/xfs/xfs_extent_busy.h
··· 16 16 /* 17 17 * Busy block/extent entry. Indexed by a rbtree in perag to mark blocks that 18 18 * have been freed but whose transactions aren't committed to disk yet. 19 - * 20 - * Note that we use the transaction ID to record the transaction, not the 21 - * transaction structure itself. See xfs_extent_busy_insert() for details. 22 19 */ 23 20 struct xfs_extent_busy { 24 21 struct rb_node rb_node; /* ag by-bno indexed search tree */ ··· 28 31 #define XFS_EXTENT_BUSY_SKIP_DISCARD 0x02 /* do not discard */ 29 32 }; 30 33 34 + /* 35 + * List used to track groups of related busy extents all the way through 36 + * to discard completion. 37 + */ 38 + struct xfs_busy_extents { 39 + struct xfs_mount *mount; 40 + struct list_head extent_list; 41 + struct work_struct endio_work; 42 + 43 + /* 44 + * Owner is the object containing the struct xfs_busy_extents to free 45 + * once the busy extents have been processed. If only the 46 + * xfs_busy_extents object needs freeing, then point this at itself. 47 + */ 48 + void *owner; 49 + }; 50 + 31 51 void 32 52 xfs_extent_busy_insert(struct xfs_trans *tp, struct xfs_perag *pag, 33 53 xfs_agblock_t bno, xfs_extlen_t len, unsigned int flags); 54 + 55 + void 56 + xfs_extent_busy_insert_discard(struct xfs_perag *pag, xfs_agblock_t bno, 57 + xfs_extlen_t len, struct list_head *busy_list); 34 58 35 59 void 36 60 xfs_extent_busy_clear(struct xfs_mount *mp, struct list_head *list,
+13 -80
fs/xfs/xfs_log_cil.c
··· 16 16 #include "xfs_log.h" 17 17 #include "xfs_log_priv.h" 18 18 #include "xfs_trace.h" 19 - 20 - struct workqueue_struct *xfs_discard_wq; 19 + #include "xfs_discard.h" 21 20 22 21 /* 23 22 * Allocate a new ticket. Failing to get a new ticket makes it really hard to ··· 102 103 103 104 ctx = kmem_zalloc(sizeof(*ctx), KM_NOFS); 104 105 INIT_LIST_HEAD(&ctx->committing); 105 - INIT_LIST_HEAD(&ctx->busy_extents); 106 + INIT_LIST_HEAD(&ctx->busy_extents.extent_list); 106 107 INIT_LIST_HEAD(&ctx->log_items); 107 108 INIT_LIST_HEAD(&ctx->lv_chain); 108 109 INIT_WORK(&ctx->push_work, xlog_cil_push_work); ··· 131 132 132 133 if (!list_empty(&cilpcp->busy_extents)) { 133 134 list_splice_init(&cilpcp->busy_extents, 134 - &ctx->busy_extents); 135 + &ctx->busy_extents.extent_list); 135 136 } 136 137 if (!list_empty(&cilpcp->log_items)) 137 138 list_splice_init(&cilpcp->log_items, &ctx->log_items); ··· 707 708 } 708 709 } 709 710 710 - static void 711 - xlog_discard_endio_work( 712 - struct work_struct *work) 713 - { 714 - struct xfs_cil_ctx *ctx = 715 - container_of(work, struct xfs_cil_ctx, discard_endio_work); 716 - struct xfs_mount *mp = ctx->cil->xc_log->l_mp; 717 - 718 - xfs_extent_busy_clear(mp, &ctx->busy_extents, false); 719 - kmem_free(ctx); 720 - } 721 - 722 - /* 723 - * Queue up the actual completion to a thread to avoid IRQ-safe locking for 724 - * pagb_lock. Note that we need a unbounded workqueue, otherwise we might 725 - * get the execution delayed up to 30 seconds for weird reasons. 726 - */ 727 - static void 728 - xlog_discard_endio( 729 - struct bio *bio) 730 - { 731 - struct xfs_cil_ctx *ctx = bio->bi_private; 732 - 733 - INIT_WORK(&ctx->discard_endio_work, xlog_discard_endio_work); 734 - queue_work(xfs_discard_wq, &ctx->discard_endio_work); 735 - bio_put(bio); 736 - } 737 - 738 - static void 739 - xlog_discard_busy_extents( 740 - struct xfs_mount *mp, 741 - struct xfs_cil_ctx *ctx) 742 - { 743 - struct list_head *list = &ctx->busy_extents; 744 - struct xfs_extent_busy *busyp; 745 - struct bio *bio = NULL; 746 - struct blk_plug plug; 747 - int error = 0; 748 - 749 - ASSERT(xfs_has_discard(mp)); 750 - 751 - blk_start_plug(&plug); 752 - list_for_each_entry(busyp, list, list) { 753 - trace_xfs_discard_extent(mp, busyp->agno, busyp->bno, 754 - busyp->length); 755 - 756 - error = __blkdev_issue_discard(mp->m_ddev_targp->bt_bdev, 757 - XFS_AGB_TO_DADDR(mp, busyp->agno, busyp->bno), 758 - XFS_FSB_TO_BB(mp, busyp->length), 759 - GFP_NOFS, &bio); 760 - if (error && error != -EOPNOTSUPP) { 761 - xfs_info(mp, 762 - "discard failed for extent [0x%llx,%u], error %d", 763 - (unsigned long long)busyp->bno, 764 - busyp->length, 765 - error); 766 - break; 767 - } 768 - } 769 - 770 - if (bio) { 771 - bio->bi_private = ctx; 772 - bio->bi_end_io = xlog_discard_endio; 773 - submit_bio(bio); 774 - } else { 775 - xlog_discard_endio_work(&ctx->discard_endio_work); 776 - } 777 - blk_finish_plug(&plug); 778 - } 779 - 780 711 /* 781 712 * Mark all items committed and clear busy extents. We free the log vector 782 713 * chains in a separate pass so that we unpin the log items as quickly as ··· 736 807 xfs_trans_committed_bulk(ctx->cil->xc_log->l_ailp, &ctx->lv_chain, 737 808 ctx->start_lsn, abort); 738 809 739 - xfs_extent_busy_sort(&ctx->busy_extents); 740 - xfs_extent_busy_clear(mp, &ctx->busy_extents, 810 + xfs_extent_busy_sort(&ctx->busy_extents.extent_list); 811 + xfs_extent_busy_clear(mp, &ctx->busy_extents.extent_list, 741 812 xfs_has_discard(mp) && !abort); 742 813 743 814 spin_lock(&ctx->cil->xc_push_lock); ··· 746 817 747 818 xlog_cil_free_logvec(&ctx->lv_chain); 748 819 749 - if (!list_empty(&ctx->busy_extents)) 750 - xlog_discard_busy_extents(mp, ctx); 751 - else 752 - kmem_free(ctx); 820 + if (!list_empty(&ctx->busy_extents.extent_list)) { 821 + ctx->busy_extents.mount = mp; 822 + ctx->busy_extents.owner = ctx; 823 + xfs_discard_extents(mp, &ctx->busy_extents); 824 + return; 825 + } 826 + 827 + kmem_free(ctx); 753 828 } 754 829 755 830 void
+3 -2
fs/xfs/xfs_log_priv.h
··· 6 6 #ifndef __XFS_LOG_PRIV_H__ 7 7 #define __XFS_LOG_PRIV_H__ 8 8 9 + #include "xfs_extent_busy.h" /* for struct xfs_busy_extents */ 10 + 9 11 struct xfs_buf; 10 12 struct xlog; 11 13 struct xlog_ticket; ··· 225 223 struct xlog_in_core *commit_iclog; 226 224 struct xlog_ticket *ticket; /* chkpt ticket */ 227 225 atomic_t space_used; /* aggregate size of regions */ 228 - struct list_head busy_extents; /* busy extents in chkpt */ 226 + struct xfs_busy_extents busy_extents; 229 227 struct list_head log_items; /* log items in chkpt */ 230 228 struct list_head lv_chain; /* logvecs being pushed */ 231 229 struct list_head iclog_entry; 232 230 struct list_head committing; /* ctx committing list */ 233 - struct work_struct discard_endio_work; 234 231 struct work_struct push_work; 235 232 atomic_t order_id; 236 233
+1 -1
include/asm-generic/mshyperv.h
··· 36 36 u32 nested_features; 37 37 u32 max_vp_index; 38 38 u32 max_lp_index; 39 + u8 vtl; 39 40 union { 40 41 u32 isolation_config_a; 41 42 struct { ··· 55 54 }; 56 55 }; 57 56 u64 shared_gpa_boundary; 58 - u8 vtl; 59 57 }; 60 58 extern struct ms_hyperv_info ms_hyperv; 61 59 extern bool hv_nested;
+9
include/linux/acpi.h
··· 1480 1480 } 1481 1481 #endif 1482 1482 1483 + #ifdef CONFIG_ACPI_PROCESSOR_IDLE 1484 + #ifndef arch_get_idle_state_flags 1485 + static inline unsigned int arch_get_idle_state_flags(u32 arch_flags) 1486 + { 1487 + return 0; 1488 + } 1489 + #endif 1490 + #endif /* CONFIG_ACPI_PROCESSOR_IDLE */ 1491 + 1483 1492 #ifdef CONFIG_ACPI_PPTT 1484 1493 int acpi_pptt_cpu_is_thread(unsigned int cpu); 1485 1494 int find_acpi_cpu_topology(unsigned int cpu, int level);
+3 -1
include/linux/quota.h
··· 285 285 #define DQ_FAKE_B 3 /* no limits only usage */ 286 286 #define DQ_READ_B 4 /* dquot was read into memory */ 287 287 #define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ 288 - #define DQ_LASTSET_B 6 /* Following 6 bits (see QIF_) are reserved\ 288 + #define DQ_RELEASING_B 6 /* dquot is in releasing_dquots list waiting 289 + * to be cleaned up */ 290 + #define DQ_LASTSET_B 7 /* Following 6 bits (see QIF_) are reserved\ 289 291 * for the mask of entries set via SETQUOTA\ 290 292 * quotactl. They are set under dq_data_lock\ 291 293 * and the quota format handling dquot can\
+1 -1
include/linux/quotaops.h
··· 57 57 { 58 58 if (test_bit(DQ_MOD_B, &dquot->dq_flags)) 59 59 return true; 60 - if (atomic_read(&dquot->dq_count) > 1) 60 + if (atomic_read(&dquot->dq_count) > 0) 61 61 return true; 62 62 return false; 63 63 }
+2 -2
include/linux/skbuff.h
··· 1309 1309 * 1310 1310 * Returns true if skb is a fast clone, and its clone is not freed. 1311 1311 * Some drivers call skb_orphan() in their ndo_start_xmit(), 1312 - * so we also check that this didnt happen. 1312 + * so we also check that didn't happen. 1313 1313 */ 1314 1314 static inline bool skb_fclone_busy(const struct sock *sk, 1315 1315 const struct sk_buff *skb) ··· 2016 2016 * Copy shared buffers into a new sk_buff. We effectively do COW on 2017 2017 * packets to handle cases where we have a local reader and forward 2018 2018 * and a couple of other messy ones. The normal one is tcpdumping 2019 - * a packet thats being forwarded. 2019 + * a packet that's being forwarded. 2020 2020 */ 2021 2021 2022 2022 /**
+1
include/net/macsec.h
··· 258 258 struct macsec_secy *secy; 259 259 struct macsec_rx_sc *rx_sc; 260 260 struct { 261 + bool update_pn; 261 262 unsigned char assoc_num; 262 263 u8 key[MACSEC_MAX_KEY_LEN]; 263 264 union {
+2
include/sound/soc.h
··· 1126 1126 unsigned int pop_wait:1; 1127 1127 unsigned int fe_compr:1; /* for Dynamic PCM */ 1128 1128 1129 + bool initialized; 1130 + 1129 1131 int num_components; 1130 1132 struct snd_soc_component *components[]; /* CPU/Codec/Platform */ 1131 1133 };
+10
include/uapi/drm/nouveau_drm.h
··· 44 44 #define NOUVEAU_GETPARAM_PTIMER_TIME 14 45 45 #define NOUVEAU_GETPARAM_HAS_BO_USAGE 15 46 46 #define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16 47 + 48 + /** 49 + * @NOUVEAU_GETPARAM_EXEC_PUSH_MAX 50 + * 51 + * Query the maximum amount of IBs that can be pushed through a single 52 + * &drm_nouveau_exec structure and hence a single &DRM_IOCTL_NOUVEAU_EXEC 53 + * ioctl(). 54 + */ 55 + #define NOUVEAU_GETPARAM_EXEC_PUSH_MAX 17 56 + 47 57 struct drm_nouveau_getparam { 48 58 __u64 param; 49 59 __u64 value;
+1 -5
include/uapi/linux/if_packet.h
··· 18 18 unsigned short sll_hatype; 19 19 unsigned char sll_pkttype; 20 20 unsigned char sll_halen; 21 - union { 22 - unsigned char sll_addr[8]; 23 - /* Actual length is in sll_halen. */ 24 - __DECLARE_FLEX_ARRAY(unsigned char, sll_addr_flex); 25 - }; 21 + unsigned char sll_addr[8]; 26 22 }; 27 23 28 24 /* Packet types */
+4 -6
io_uring/io-wq.c
··· 1151 1151 wq = kzalloc(sizeof(struct io_wq), GFP_KERNEL); 1152 1152 if (!wq) 1153 1153 return ERR_PTR(-ENOMEM); 1154 - ret = cpuhp_state_add_instance_nocalls(io_wq_online, &wq->cpuhp_node); 1155 - if (ret) 1156 - goto err_wq; 1157 1154 1158 1155 refcount_inc(&data->hash->refs); 1159 1156 wq->hash = data->hash; ··· 1183 1186 wq->task = get_task_struct(data->task); 1184 1187 atomic_set(&wq->worker_refs, 1); 1185 1188 init_completion(&wq->worker_done); 1189 + ret = cpuhp_state_add_instance_nocalls(io_wq_online, &wq->cpuhp_node); 1190 + if (ret) 1191 + goto err; 1192 + 1186 1193 return wq; 1187 1194 err: 1188 1195 io_wq_put_hash(data->hash); 1189 - cpuhp_state_remove_instance_nocalls(io_wq_online, &wq->cpuhp_node); 1190 - 1191 1196 free_cpumask_var(wq->cpu_mask); 1192 - err_wq: 1193 1197 kfree(wq); 1194 1198 return ERR_PTR(ret); 1195 1199 }
+15 -1
io_uring/io_uring.c
··· 2686 2686 { 2687 2687 struct page **page_array; 2688 2688 unsigned int nr_pages; 2689 - int ret; 2689 + int ret, i; 2690 2690 2691 2691 *npages = 0; 2692 2692 ··· 2716 2716 */ 2717 2717 if (page_array[0] != page_array[ret - 1]) 2718 2718 goto err; 2719 + 2720 + /* 2721 + * Can't support mapping user allocated ring memory on 32-bit archs 2722 + * where it could potentially reside in highmem. Just fail those with 2723 + * -EINVAL, just like we did on kernels that didn't support this 2724 + * feature. 2725 + */ 2726 + for (i = 0; i < nr_pages; i++) { 2727 + if (PageHighMem(page_array[i])) { 2728 + ret = -EINVAL; 2729 + goto err; 2730 + } 2731 + } 2732 + 2719 2733 *pages = page_array; 2720 2734 *npages = nr_pages; 2721 2735 return page_to_virt(page_array[0]);
+27 -14
io_uring/io_uring.h
··· 86 86 bool io_match_task_safe(struct io_kiocb *head, struct task_struct *task, 87 87 bool cancel_all); 88 88 89 - #define io_lockdep_assert_cq_locked(ctx) \ 90 - do { \ 91 - lockdep_assert(in_task()); \ 92 - \ 93 - if (ctx->flags & IORING_SETUP_IOPOLL) { \ 94 - lockdep_assert_held(&ctx->uring_lock); \ 95 - } else if (!ctx->task_complete) { \ 96 - lockdep_assert_held(&ctx->completion_lock); \ 97 - } else if (ctx->submitter_task->flags & PF_EXITING) { \ 98 - lockdep_assert(current_work()); \ 99 - } else { \ 100 - lockdep_assert(current == ctx->submitter_task); \ 101 - } \ 102 - } while (0) 89 + #if defined(CONFIG_PROVE_LOCKING) 90 + static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx) 91 + { 92 + lockdep_assert(in_task()); 93 + 94 + if (ctx->flags & IORING_SETUP_IOPOLL) { 95 + lockdep_assert_held(&ctx->uring_lock); 96 + } else if (!ctx->task_complete) { 97 + lockdep_assert_held(&ctx->completion_lock); 98 + } else if (ctx->submitter_task) { 99 + /* 100 + * ->submitter_task may be NULL and we can still post a CQE, 101 + * if the ring has been setup with IORING_SETUP_R_DISABLED. 102 + * Not from an SQE, as those cannot be submitted, but via 103 + * updating tagged resources. 104 + */ 105 + if (ctx->submitter_task->flags & PF_EXITING) 106 + lockdep_assert(current_work()); 107 + else 108 + lockdep_assert(current == ctx->submitter_task); 109 + } 110 + } 111 + #else 112 + static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx) 113 + { 114 + } 115 + #endif 103 116 104 117 static inline void io_req_task_work_add(struct io_kiocb *req) 105 118 {
+19 -8
io_uring/kbuf.c
··· 477 477 { 478 478 struct io_uring_buf_ring *br; 479 479 struct page **pages; 480 - int nr_pages; 480 + int i, nr_pages; 481 481 482 482 pages = io_pin_pages(reg->ring_addr, 483 483 flex_array_size(br, bufs, reg->ring_entries), 484 484 &nr_pages); 485 485 if (IS_ERR(pages)) 486 486 return PTR_ERR(pages); 487 + 488 + /* 489 + * Apparently some 32-bit boxes (ARM) will return highmem pages, 490 + * which then need to be mapped. We could support that, but it'd 491 + * complicate the code and slowdown the common cases quite a bit. 492 + * So just error out, returning -EINVAL just like we did on kernels 493 + * that didn't support mapped buffer rings. 494 + */ 495 + for (i = 0; i < nr_pages; i++) 496 + if (PageHighMem(pages[i])) 497 + goto error_unpin; 487 498 488 499 br = page_address(pages[0]); 489 500 #ifdef SHM_COLOUR ··· 507 496 * should use IOU_PBUF_RING_MMAP instead, and liburing will handle 508 497 * this transparently. 509 498 */ 510 - if ((reg->ring_addr | (unsigned long) br) & (SHM_COLOUR - 1)) { 511 - int i; 512 - 513 - for (i = 0; i < nr_pages; i++) 514 - unpin_user_page(pages[i]); 515 - return -EINVAL; 516 - } 499 + if ((reg->ring_addr | (unsigned long) br) & (SHM_COLOUR - 1)) 500 + goto error_unpin; 517 501 #endif 518 502 bl->buf_pages = pages; 519 503 bl->buf_nr_pages = nr_pages; ··· 516 510 bl->is_mapped = 1; 517 511 bl->is_mmap = 0; 518 512 return 0; 513 + error_unpin: 514 + for (i = 0; i < nr_pages; i++) 515 + unpin_user_page(pages[i]); 516 + kvfree(pages); 517 + return -EINVAL; 519 518 } 520 519 521 520 static int io_alloc_pbuf_ring(struct io_uring_buf_reg *reg,
+6 -4
kernel/bpf/mprog.c
··· 401 401 struct bpf_mprog_cp *cp; 402 402 struct bpf_prog *prog; 403 403 const u32 flags = 0; 404 + u32 id, count = 0; 405 + u64 revision = 1; 404 406 int i, ret = 0; 405 - u32 id, count; 406 - u64 revision; 407 407 408 408 if (attr->query.query_flags || attr->query.attach_flags) 409 409 return -EINVAL; 410 - revision = bpf_mprog_revision(entry); 411 - count = bpf_mprog_total(entry); 410 + if (entry) { 411 + revision = bpf_mprog_revision(entry); 412 + count = bpf_mprog_total(entry); 413 + } 412 414 if (copy_to_user(&uattr->query.attach_flags, &flags, sizeof(flags))) 413 415 return -EFAULT; 414 416 if (copy_to_user(&uattr->query.revision, &revision, sizeof(revision)))
+15 -6
kernel/bpf/syscall.c
··· 3800 3800 { 3801 3801 enum bpf_prog_type ptype; 3802 3802 struct bpf_prog *prog; 3803 - u32 mask; 3804 3803 int ret; 3805 3804 3806 3805 if (CHECK_ATTR(BPF_PROG_ATTACH)) ··· 3808 3809 ptype = attach_type_to_prog_type(attr->attach_type); 3809 3810 if (ptype == BPF_PROG_TYPE_UNSPEC) 3810 3811 return -EINVAL; 3811 - mask = bpf_mprog_supported(ptype) ? 3812 - BPF_F_ATTACH_MASK_MPROG : BPF_F_ATTACH_MASK_BASE; 3813 - if (attr->attach_flags & ~mask) 3814 - return -EINVAL; 3812 + if (bpf_mprog_supported(ptype)) { 3813 + if (attr->attach_flags & ~BPF_F_ATTACH_MASK_MPROG) 3814 + return -EINVAL; 3815 + } else { 3816 + if (attr->attach_flags & ~BPF_F_ATTACH_MASK_BASE) 3817 + return -EINVAL; 3818 + if (attr->relative_fd || 3819 + attr->expected_revision) 3820 + return -EINVAL; 3821 + } 3815 3822 3816 3823 prog = bpf_prog_get_type(attr->attach_bpf_fd, ptype); 3817 3824 if (IS_ERR(prog)) ··· 3887 3882 if (IS_ERR(prog)) 3888 3883 return PTR_ERR(prog); 3889 3884 } 3885 + } else if (attr->attach_flags || 3886 + attr->relative_fd || 3887 + attr->expected_revision) { 3888 + return -EINVAL; 3890 3889 } 3891 3890 3892 3891 switch (ptype) { ··· 3926 3917 return ret; 3927 3918 } 3928 3919 3929 - #define BPF_PROG_QUERY_LAST_FIELD query.link_attach_flags 3920 + #define BPF_PROG_QUERY_LAST_FIELD query.revision 3930 3921 3931 3922 static int bpf_prog_query(const union bpf_attr *attr, 3932 3923 union bpf_attr __user *uattr)
+1 -7
kernel/bpf/tcx.c
··· 123 123 { 124 124 bool ingress = attr->query.attach_type == BPF_TCX_INGRESS; 125 125 struct net *net = current->nsproxy->net_ns; 126 - struct bpf_mprog_entry *entry; 127 126 struct net_device *dev; 128 127 int ret; 129 128 ··· 132 133 ret = -ENODEV; 133 134 goto out; 134 135 } 135 - entry = tcx_entry_fetch(dev, ingress); 136 - if (!entry) { 137 - ret = -ENOENT; 138 - goto out; 139 - } 140 - ret = bpf_mprog_query(attr, uattr, entry); 136 + ret = bpf_mprog_query(attr, uattr, tcx_entry_fetch(dev, ingress)); 141 137 out: 142 138 rtnl_unlock(); 143 139 return ret;
+3 -3
kernel/bpf/verifier.c
··· 14727 14727 struct tnum enforce_attach_type_range = tnum_unknown; 14728 14728 const struct bpf_prog *prog = env->prog; 14729 14729 struct bpf_reg_state *reg; 14730 - struct tnum range = tnum_range(0, 1); 14730 + struct tnum range = tnum_range(0, 1), const_0 = tnum_const(0); 14731 14731 enum bpf_prog_type prog_type = resolve_prog_type(env->prog); 14732 14732 int err; 14733 14733 struct bpf_func_state *frame = env->cur_state->frame[0]; ··· 14775 14775 return -EINVAL; 14776 14776 } 14777 14777 14778 - if (!tnum_in(tnum_const(0), reg->var_off)) { 14779 - verbose_invalid_scalar(env, reg, &range, "async callback", "R0"); 14778 + if (!tnum_in(const_0, reg->var_off)) { 14779 + verbose_invalid_scalar(env, reg, &const_0, "async callback", "R0"); 14780 14780 return -EINVAL; 14781 14781 } 14782 14782 return 0;
+2 -2
kernel/power/snapshot.c
··· 2647 2647 memory_bm_free(bm, PG_UNSAFE_KEEP); 2648 2648 2649 2649 /* Make a copy of zero_bm so it can be created in safe pages */ 2650 - error = memory_bm_create(&tmp, GFP_ATOMIC, PG_ANY); 2650 + error = memory_bm_create(&tmp, GFP_ATOMIC, PG_SAFE); 2651 2651 if (error) 2652 2652 goto Free; 2653 2653 ··· 2660 2660 goto Free; 2661 2661 2662 2662 duplicate_memory_bitmap(zero_bm, &tmp); 2663 - memory_bm_free(&tmp, PG_UNSAFE_KEEP); 2663 + memory_bm_free(&tmp, PG_UNSAFE_CLEAR); 2664 2664 /* At this point zero_bm is in safe pages and it can be used for restoring. */ 2665 2665 2666 2666 if (nr_highmem > 0) {
+7 -1
kernel/printk/printk.c
··· 3740 3740 3741 3741 seq = prb_next_seq(prb); 3742 3742 3743 + /* Flush the consoles so that records up to @seq are printed. */ 3744 + console_lock(); 3745 + console_unlock(); 3746 + 3743 3747 for (;;) { 3744 3748 diff = 0; 3745 3749 3746 3750 /* 3747 3751 * Hold the console_lock to guarantee safe access to 3748 - * console->seq. 3752 + * console->seq. Releasing console_lock flushes more 3753 + * records in case @seq is still not printed on all 3754 + * usable consoles. 3749 3755 */ 3750 3756 console_lock(); 3751 3757
+2 -1
kernel/sched/cpufreq_schedutil.c
··· 350 350 * Except when the rq is capped by uclamp_max. 351 351 */ 352 352 if (!uclamp_rq_is_capped(cpu_rq(sg_cpu->cpu)) && 353 - sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) { 353 + sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq && 354 + !sg_policy->need_freq_update) { 354 355 next_f = sg_policy->next_freq; 355 356 356 357 /* Restore cached freq as next_freq has changed */
+13 -3
kernel/sched/fair.c
··· 664 664 cfs_rq->avg_vruntime -= cfs_rq->avg_load * delta; 665 665 } 666 666 667 + /* 668 + * Specifically: avg_runtime() + 0 must result in entity_eligible() := true 669 + * For this to be so, the result of this function must have a left bias. 670 + */ 667 671 u64 avg_vruntime(struct cfs_rq *cfs_rq) 668 672 { 669 673 struct sched_entity *curr = cfs_rq->curr; ··· 681 677 load += weight; 682 678 } 683 679 684 - if (load) 680 + if (load) { 681 + /* sign flips effective floor / ceil */ 682 + if (avg < 0) 683 + avg -= (load - 1); 685 684 avg = div_s64(avg, load); 685 + } 686 686 687 687 return cfs_rq->min_vruntime + avg; 688 688 } ··· 4927 4919 static void 4928 4920 place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) 4929 4921 { 4930 - u64 vslice = calc_delta_fair(se->slice, se); 4931 - u64 vruntime = avg_vruntime(cfs_rq); 4922 + u64 vslice, vruntime = avg_vruntime(cfs_rq); 4932 4923 s64 lag = 0; 4924 + 4925 + se->slice = sysctl_sched_base_slice; 4926 + vslice = calc_delta_fair(se->slice, se); 4933 4927 4934 4928 /* 4935 4929 * Due to how V is constructed as the weighted average of entities,
+8 -11
net/can/isotp.c
··· 948 948 if (!so->bound || so->tx.state == ISOTP_SHUTDOWN) 949 949 return -EADDRNOTAVAIL; 950 950 951 - wait_free_buffer: 952 - /* we do not support multiple buffers - for now */ 953 - if (wq_has_sleeper(&so->wait) && (msg->msg_flags & MSG_DONTWAIT)) 954 - return -EAGAIN; 951 + while (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE) { 952 + /* we do not support multiple buffers - for now */ 953 + if (msg->msg_flags & MSG_DONTWAIT) 954 + return -EAGAIN; 955 955 956 - /* wait for complete transmission of current pdu */ 957 - err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); 958 - if (err) 959 - goto err_event_drop; 960 - 961 - if (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE) { 962 956 if (so->tx.state == ISOTP_SHUTDOWN) 963 957 return -EADDRNOTAVAIL; 964 958 965 - goto wait_free_buffer; 959 + /* wait for complete transmission of current pdu */ 960 + err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); 961 + if (err) 962 + goto err_event_drop; 966 963 } 967 964 968 965 /* PDU size > default => try max_pdu_size */
+6 -2
net/core/dev.c
··· 3292 3292 3293 3293 offset = skb_checksum_start_offset(skb); 3294 3294 ret = -EINVAL; 3295 - if (WARN_ON_ONCE(offset >= skb_headlen(skb))) { 3295 + if (unlikely(offset >= skb_headlen(skb))) { 3296 3296 DO_ONCE_LITE(skb_dump, KERN_ERR, skb, false); 3297 + WARN_ONCE(true, "offset (%d) >= skb_headlen() (%u)\n", 3298 + offset, skb_headlen(skb)); 3297 3299 goto out; 3298 3300 } 3299 3301 csum = skb_checksum(skb, offset, skb->len - offset, 0); 3300 3302 3301 3303 offset += skb->csum_offset; 3302 - if (WARN_ON_ONCE(offset + sizeof(__sum16) > skb_headlen(skb))) { 3304 + if (unlikely(offset + sizeof(__sum16) > skb_headlen(skb))) { 3303 3305 DO_ONCE_LITE(skb_dump, KERN_ERR, skb, false); 3306 + WARN_ONCE(true, "offset+2 (%zu) > skb_headlen() (%u)\n", 3307 + offset + sizeof(__sum16), skb_headlen(skb)); 3304 3308 goto out; 3305 3309 } 3306 3310 ret = skb_ensure_writable(skb, offset + sizeof(__sum16));
+16 -14
net/devlink/health.c
··· 58 58 struct devlink *devlink; 59 59 struct devlink_port *devlink_port; 60 60 struct devlink_fmsg *dump_fmsg; 61 - struct mutex dump_lock; /* lock parallel read/write from dump buffers */ 62 61 u64 graceful_period; 63 62 bool auto_recover; 64 63 bool auto_dump; ··· 124 125 reporter->graceful_period = graceful_period; 125 126 reporter->auto_recover = !!ops->recover; 126 127 reporter->auto_dump = !!ops->dump; 127 - mutex_init(&reporter->dump_lock); 128 128 return reporter; 129 129 } 130 130 ··· 224 226 static void 225 227 devlink_health_reporter_free(struct devlink_health_reporter *reporter) 226 228 { 227 - mutex_destroy(&reporter->dump_lock); 228 229 if (reporter->dump_fmsg) 229 230 devlink_fmsg_free(reporter->dump_fmsg); 230 231 kfree(reporter); ··· 622 625 } 623 626 624 627 if (reporter->auto_dump) { 625 - mutex_lock(&reporter->dump_lock); 628 + devl_lock(devlink); 626 629 /* store current dump of current error, for later analysis */ 627 630 devlink_health_do_dump(reporter, priv_ctx, NULL); 628 - mutex_unlock(&reporter->dump_lock); 631 + devl_unlock(devlink); 629 632 } 630 633 631 634 if (!reporter->auto_recover) ··· 1259 1262 } 1260 1263 1261 1264 static struct devlink_health_reporter * 1262 - devlink_health_reporter_get_from_cb(struct netlink_callback *cb) 1265 + devlink_health_reporter_get_from_cb_lock(struct netlink_callback *cb) 1263 1266 { 1264 1267 const struct genl_info *info = genl_info_dump(cb); 1265 1268 struct devlink_health_reporter *reporter; ··· 1269 1272 devlink = devlink_get_from_attrs_lock(sock_net(cb->skb->sk), attrs); 1270 1273 if (IS_ERR(devlink)) 1271 1274 return NULL; 1272 - devl_unlock(devlink); 1273 1275 1274 1276 reporter = devlink_health_reporter_get_from_attrs(devlink, attrs); 1275 - devlink_put(devlink); 1277 + if (!reporter) { 1278 + devl_unlock(devlink); 1279 + devlink_put(devlink); 1280 + } 1276 1281 return reporter; 1277 1282 } 1278 1283 ··· 1283 1284 { 1284 1285 struct devlink_nl_dump_state *state = devlink_dump_state(cb); 1285 1286 struct devlink_health_reporter *reporter; 1287 + struct devlink *devlink; 1286 1288 int err; 1287 1289 1288 - reporter = devlink_health_reporter_get_from_cb(cb); 1290 + reporter = devlink_health_reporter_get_from_cb_lock(cb); 1289 1291 if (!reporter) 1290 1292 return -EINVAL; 1291 1293 1292 - if (!reporter->ops->dump) 1294 + devlink = reporter->devlink; 1295 + if (!reporter->ops->dump) { 1296 + devl_unlock(devlink); 1297 + devlink_put(devlink); 1293 1298 return -EOPNOTSUPP; 1299 + } 1294 1300 1295 - mutex_lock(&reporter->dump_lock); 1296 1301 if (!state->idx) { 1297 1302 err = devlink_health_do_dump(reporter, NULL, cb->extack); 1298 1303 if (err) ··· 1312 1309 err = devlink_fmsg_dumpit(reporter->dump_fmsg, skb, cb, 1313 1310 DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET); 1314 1311 unlock: 1315 - mutex_unlock(&reporter->dump_lock); 1312 + devl_unlock(devlink); 1313 + devlink_put(devlink); 1316 1314 return err; 1317 1315 } 1318 1316 ··· 1330 1326 if (!reporter->ops->dump) 1331 1327 return -EOPNOTSUPP; 1332 1328 1333 - mutex_lock(&reporter->dump_lock); 1334 1329 devlink_health_dump_clear(reporter); 1335 - mutex_unlock(&reporter->dump_lock); 1336 1330 return 0; 1337 1331 } 1338 1332
+26 -6
net/ethtool/bitset.c
··· 431 431 ethnl_string_array_t names, 432 432 struct netlink_ext_ack *extack, bool *mod) 433 433 { 434 + u32 *orig_bitmap, *saved_bitmap = NULL; 434 435 struct nlattr *bit_attr; 435 436 bool no_mask; 437 + bool dummy; 436 438 int rem; 437 439 int ret; 438 440 ··· 450 448 } 451 449 452 450 no_mask = tb[ETHTOOL_A_BITSET_NOMASK]; 453 - if (no_mask) 454 - ethnl_bitmap32_clear(bitmap, 0, nbits, mod); 451 + if (no_mask) { 452 + unsigned int nwords = DIV_ROUND_UP(nbits, 32); 453 + unsigned int nbytes = nwords * sizeof(u32); 454 + 455 + /* The bitmap size is only the size of the map part without 456 + * its mask part. 457 + */ 458 + saved_bitmap = kcalloc(nwords, sizeof(u32), GFP_KERNEL); 459 + if (!saved_bitmap) 460 + return -ENOMEM; 461 + memcpy(saved_bitmap, bitmap, nbytes); 462 + ethnl_bitmap32_clear(bitmap, 0, nbits, &dummy); 463 + orig_bitmap = saved_bitmap; 464 + } else { 465 + orig_bitmap = bitmap; 466 + } 455 467 456 468 nla_for_each_nested(bit_attr, tb[ETHTOOL_A_BITSET_BITS], rem) { 457 469 bool old_val, new_val; ··· 474 458 if (nla_type(bit_attr) != ETHTOOL_A_BITSET_BITS_BIT) { 475 459 NL_SET_ERR_MSG_ATTR(extack, bit_attr, 476 460 "only ETHTOOL_A_BITSET_BITS_BIT allowed in ETHTOOL_A_BITSET_BITS"); 477 - return -EINVAL; 461 + ret = -EINVAL; 462 + goto out; 478 463 } 479 464 ret = ethnl_parse_bit(&idx, &new_val, nbits, bit_attr, no_mask, 480 465 names, extack); 481 466 if (ret < 0) 482 - return ret; 483 - old_val = bitmap[idx / 32] & ((u32)1 << (idx % 32)); 467 + goto out; 468 + old_val = orig_bitmap[idx / 32] & ((u32)1 << (idx % 32)); 484 469 if (new_val != old_val) { 485 470 if (new_val) 486 471 bitmap[idx / 32] |= ((u32)1 << (idx % 32)); ··· 491 474 } 492 475 } 493 476 494 - return 0; 477 + ret = 0; 478 + out: 479 + kfree(saved_bitmap); 480 + return ret; 495 481 } 496 482 497 483 static int ethnl_compact_sanity_checks(unsigned int nbits,
+1
net/ipv4/tcp_output.c
··· 2449 2449 2450 2450 /* build the payload, and be prepared to abort if this fails. */ 2451 2451 if (tcp_clone_payload(sk, nskb, probe_size)) { 2452 + tcp_skb_tsorted_anchor_cleanup(nskb); 2452 2453 consume_skb(nskb); 2453 2454 return -1; 2454 2455 }
+16 -6
net/mctp/route.c
··· 737 737 { 738 738 struct mctp_route *tmp, *rt = NULL; 739 739 740 + rcu_read_lock(); 741 + 740 742 list_for_each_entry_rcu(tmp, &net->mctp.routes, list) { 741 743 /* TODO: add metrics */ 742 744 if (mctp_rt_match_eid(tmp, dnet, daddr)) { ··· 749 747 } 750 748 } 751 749 750 + rcu_read_unlock(); 751 + 752 752 return rt; 753 753 } 754 754 755 755 static struct mctp_route *mctp_route_lookup_null(struct net *net, 756 756 struct net_device *dev) 757 757 { 758 - struct mctp_route *rt; 758 + struct mctp_route *tmp, *rt = NULL; 759 759 760 - list_for_each_entry_rcu(rt, &net->mctp.routes, list) { 761 - if (rt->dev->dev == dev && rt->type == RTN_LOCAL && 762 - refcount_inc_not_zero(&rt->refs)) 763 - return rt; 760 + rcu_read_lock(); 761 + 762 + list_for_each_entry_rcu(tmp, &net->mctp.routes, list) { 763 + if (tmp->dev->dev == dev && tmp->type == RTN_LOCAL && 764 + refcount_inc_not_zero(&tmp->refs)) { 765 + rt = tmp; 766 + break; 767 + } 764 768 } 765 769 766 - return NULL; 770 + rcu_read_unlock(); 771 + 772 + return rt; 767 773 } 768 774 769 775 static int mctp_do_fragment_route(struct mctp_route *rt, struct sk_buff *skb,
+12 -18
net/nfc/llcp_core.c
··· 203 203 204 204 if (tmp_sock->ssap == ssap && tmp_sock->dsap == dsap) { 205 205 llcp_sock = tmp_sock; 206 + sock_hold(&llcp_sock->sk); 206 207 break; 207 208 } 208 209 } 209 210 210 211 read_unlock(&local->sockets.lock); 211 - 212 - if (llcp_sock == NULL) 213 - return NULL; 214 - 215 - sock_hold(&llcp_sock->sk); 216 212 217 213 return llcp_sock; 218 214 } ··· 342 346 343 347 static 344 348 struct nfc_llcp_sock *nfc_llcp_sock_from_sn(struct nfc_llcp_local *local, 345 - const u8 *sn, size_t sn_len) 349 + const u8 *sn, size_t sn_len, 350 + bool needref) 346 351 { 347 352 struct sock *sk; 348 353 struct nfc_llcp_sock *llcp_sock, *tmp_sock; ··· 379 382 380 383 if (memcmp(sn, tmp_sock->service_name, sn_len) == 0) { 381 384 llcp_sock = tmp_sock; 385 + if (needref) 386 + sock_hold(&llcp_sock->sk); 382 387 break; 383 388 } 384 389 } ··· 422 423 * to this service name. 423 424 */ 424 425 if (nfc_llcp_sock_from_sn(local, sock->service_name, 425 - sock->service_name_len) != NULL) { 426 + sock->service_name_len, 427 + false) != NULL) { 426 428 mutex_unlock(&local->sdp_lock); 427 429 428 430 return LLCP_SAP_MAX; ··· 824 824 static struct nfc_llcp_sock *nfc_llcp_sock_get_sn(struct nfc_llcp_local *local, 825 825 const u8 *sn, size_t sn_len) 826 826 { 827 - struct nfc_llcp_sock *llcp_sock; 828 - 829 - llcp_sock = nfc_llcp_sock_from_sn(local, sn, sn_len); 830 - 831 - if (llcp_sock == NULL) 832 - return NULL; 833 - 834 - sock_hold(&llcp_sock->sk); 835 - 836 - return llcp_sock; 827 + return nfc_llcp_sock_from_sn(local, sn, sn_len, true); 837 828 } 838 829 839 830 static const u8 *nfc_llcp_connect_sn(const struct sk_buff *skb, size_t *sn_len) ··· 1289 1298 } 1290 1299 1291 1300 llcp_sock = nfc_llcp_sock_from_sn(local, service_name, 1292 - service_name_len); 1301 + service_name_len, 1302 + true); 1293 1303 if (!llcp_sock) { 1294 1304 sap = 0; 1295 1305 goto add_snl; ··· 1310 1318 1311 1319 if (sap == LLCP_SAP_MAX) { 1312 1320 sap = 0; 1321 + nfc_llcp_sock_put(llcp_sock); 1313 1322 goto add_snl; 1314 1323 } 1315 1324 ··· 1328 1335 1329 1336 pr_debug("%p %d\n", llcp_sock, sap); 1330 1337 1338 + nfc_llcp_sock_put(llcp_sock); 1331 1339 add_snl: 1332 1340 sdp = nfc_llcp_build_sdres_tlv(tid, sap); 1333 1341 if (sdp == NULL)
+5
net/nfc/nci/core.c
··· 909 909 return -EINVAL; 910 910 } 911 911 912 + if (protocol >= NFC_PROTO_MAX) { 913 + pr_err("the requested nfc protocol is invalid\n"); 914 + return -EINVAL; 915 + } 916 + 912 917 if (!(nci_target->supported_protocols & (1 << protocol))) { 913 918 pr_err("target does not support the requested protocol 0x%x\n", 914 919 protocol);
+6 -1
net/packet/af_packet.c
··· 3607 3607 if (dev) { 3608 3608 sll->sll_hatype = dev->type; 3609 3609 sll->sll_halen = dev->addr_len; 3610 - memcpy(sll->sll_addr_flex, dev->dev_addr, dev->addr_len); 3610 + 3611 + /* Let __fortify_memcpy_chk() know the actual buffer size. */ 3612 + memcpy(((struct sockaddr_storage *)sll)->__data + 3613 + offsetof(struct sockaddr_ll, sll_addr) - 3614 + offsetofend(struct sockaddr_ll, sll_family), 3615 + dev->dev_addr, dev->addr_len); 3611 3616 } else { 3612 3617 sll->sll_hatype = 0; /* Bad: we have no ARPHRD_UNSPEC */ 3613 3618 sll->sll_halen = 0;
+1 -1
net/sched/cls_u32.c
··· 366 366 idr_init(&root_ht->handle_idr); 367 367 368 368 if (tp_c == NULL) { 369 - tp_c = kzalloc(struct_size(tp_c, hlist->ht, 1), GFP_KERNEL); 369 + tp_c = kzalloc(sizeof(*tp_c), GFP_KERNEL); 370 370 if (tp_c == NULL) { 371 371 kfree(root_ht); 372 372 return -ENOBUFS;
+1
net/smc/Kconfig
··· 2 2 config SMC 3 3 tristate "SMC socket protocol family" 4 4 depends on INET && INFINIBAND 5 + depends on m || ISM != m 5 6 help 6 7 SMC-R provides a "sockets over RDMA" solution making use of 7 8 RDMA over Converged Ethernet (RoCE) technology to upgrade
+9 -5
net/smc/smc_stats.h
··· 92 92 typeof(_smc_stats) stats = (_smc_stats); \ 93 93 typeof(_tech) t = (_tech); \ 94 94 typeof(_len) l = (_len); \ 95 - int _pos = fls64((l) >> 13); \ 95 + int _pos; \ 96 96 typeof(_rc) r = (_rc); \ 97 97 int m = SMC_BUF_MAX - 1; \ 98 98 this_cpu_inc((*stats).smc[t].key ## _cnt); \ 99 - if (r <= 0) \ 99 + if (r <= 0 || l <= 0) \ 100 100 break; \ 101 - _pos = (_pos < m) ? ((l == 1 << (_pos + 12)) ? _pos - 1 : _pos) : m; \ 101 + _pos = fls64((l - 1) >> 13); \ 102 + _pos = (_pos <= m) ? _pos : m; \ 102 103 this_cpu_inc((*stats).smc[t].key ## _pd.buf[_pos]); \ 103 104 this_cpu_add((*stats).smc[t].key ## _bytes, r); \ 104 105 } \ ··· 139 138 do { \ 140 139 typeof(_len) _l = (_len); \ 141 140 typeof(_tech) t = (_tech); \ 142 - int _pos = fls((_l) >> 13); \ 141 + int _pos; \ 143 142 int m = SMC_BUF_MAX - 1; \ 144 - _pos = (_pos < m) ? ((_l == 1 << (_pos + 12)) ? _pos - 1 : _pos) : m; \ 143 + if (_l <= 0) \ 144 + break; \ 145 + _pos = fls((_l - 1) >> 13); \ 146 + _pos = (_pos <= m) ? _pos : m; \ 145 147 this_cpu_inc((*(_smc_stats)).smc[t].k ## _rmbsize.buf[_pos]); \ 146 148 } \ 147 149 while (0)
+10
net/xdp/xsk_queue.c
··· 34 34 q->ring_mask = nentries - 1; 35 35 36 36 size = xskq_get_ring_size(q, umem_queue); 37 + 38 + /* size which is overflowing or close to SIZE_MAX will become 0 in 39 + * PAGE_ALIGN(), checking SIZE_MAX is enough due to the previous 40 + * is_power_of_2(), the rest will be handled by vmalloc_user() 41 + */ 42 + if (unlikely(size == SIZE_MAX)) { 43 + kfree(q); 44 + return NULL; 45 + } 46 + 37 47 size = PAGE_ALIGN(size); 38 48 39 49 q->ring = vmalloc_user(size);
+5 -8
security/keys/trusted-keys/trusted_core.c
··· 44 44 #endif 45 45 }; 46 46 47 - DEFINE_STATIC_CALL_NULL(trusted_key_init, *trusted_key_sources[0].ops->init); 48 47 DEFINE_STATIC_CALL_NULL(trusted_key_seal, *trusted_key_sources[0].ops->seal); 49 48 DEFINE_STATIC_CALL_NULL(trusted_key_unseal, 50 49 *trusted_key_sources[0].ops->unseal); 51 50 DEFINE_STATIC_CALL_NULL(trusted_key_get_random, 52 51 *trusted_key_sources[0].ops->get_random); 53 - DEFINE_STATIC_CALL_NULL(trusted_key_exit, *trusted_key_sources[0].ops->exit); 52 + static void (*trusted_key_exit)(void); 54 53 static unsigned char migratable; 55 54 56 55 enum { ··· 358 359 if (!get_random) 359 360 get_random = kernel_get_random; 360 361 361 - static_call_update(trusted_key_init, 362 - trusted_key_sources[i].ops->init); 363 362 static_call_update(trusted_key_seal, 364 363 trusted_key_sources[i].ops->seal); 365 364 static_call_update(trusted_key_unseal, 366 365 trusted_key_sources[i].ops->unseal); 367 366 static_call_update(trusted_key_get_random, 368 367 get_random); 369 - static_call_update(trusted_key_exit, 370 - trusted_key_sources[i].ops->exit); 368 + trusted_key_exit = trusted_key_sources[i].ops->exit; 371 369 migratable = trusted_key_sources[i].ops->migratable; 372 370 373 - ret = static_call(trusted_key_init)(); 371 + ret = trusted_key_sources[i].ops->init(); 374 372 if (!ret) 375 373 break; 376 374 } ··· 384 388 385 389 static void __exit cleanup_trusted(void) 386 390 { 387 - static_call_cond(trusted_key_exit)(); 391 + if (trusted_key_exit) 392 + (*trusted_key_exit)(); 388 393 } 389 394 390 395 late_initcall(init_trusted);
+79 -36
sound/pci/hda/cs35l41_hda.c
··· 185 185 cs35l41->speaker_id, "wmfw"); 186 186 if (!ret) { 187 187 /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */ 188 - return cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, 189 - CS35L41_FIRMWARE_ROOT, 190 - cs35l41->acpi_subsystem_id, cs35l41->amp_name, 191 - cs35l41->speaker_id, "bin"); 188 + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, 189 + CS35L41_FIRMWARE_ROOT, 190 + cs35l41->acpi_subsystem_id, cs35l41->amp_name, 191 + cs35l41->speaker_id, "bin"); 192 + if (ret) 193 + goto coeff_err; 194 + 195 + return 0; 192 196 } 193 197 194 198 /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */ ··· 201 197 cs35l41->amp_name, -1, "wmfw"); 202 198 if (!ret) { 203 199 /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */ 204 - return cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, 205 - CS35L41_FIRMWARE_ROOT, 206 - cs35l41->acpi_subsystem_id, cs35l41->amp_name, 207 - cs35l41->speaker_id, "bin"); 200 + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, 201 + CS35L41_FIRMWARE_ROOT, 202 + cs35l41->acpi_subsystem_id, cs35l41->amp_name, 203 + cs35l41->speaker_id, "bin"); 204 + if (ret) 205 + goto coeff_err; 206 + 207 + return 0; 208 208 } 209 209 210 210 /* try cirrus/part-dspN-fwtype-sub<-spkidN>.wmfw */ ··· 223 215 cs35l41->amp_name, cs35l41->speaker_id, "bin"); 224 216 if (ret) 225 217 /* try cirrus/part-dspN-fwtype-sub<-spkidN>.bin */ 226 - return cs35l41_request_firmware_file(cs35l41, coeff_firmware, 227 - coeff_filename, CS35L41_FIRMWARE_ROOT, 228 - cs35l41->acpi_subsystem_id, NULL, 229 - cs35l41->speaker_id, "bin"); 218 + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, 219 + coeff_filename, CS35L41_FIRMWARE_ROOT, 220 + cs35l41->acpi_subsystem_id, NULL, 221 + cs35l41->speaker_id, "bin"); 222 + if (ret) 223 + goto coeff_err; 224 + 225 + return 0; 230 226 } 231 227 232 228 /* try cirrus/part-dspN-fwtype-sub.wmfw */ ··· 245 233 cs35l41->speaker_id, "bin"); 246 234 if (ret) 247 235 /* try cirrus/part-dspN-fwtype-sub<-spkidN>.bin */ 248 - return cs35l41_request_firmware_file(cs35l41, coeff_firmware, 249 - coeff_filename, CS35L41_FIRMWARE_ROOT, 250 - cs35l41->acpi_subsystem_id, NULL, 251 - cs35l41->speaker_id, "bin"); 236 + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, 237 + coeff_filename, CS35L41_FIRMWARE_ROOT, 238 + cs35l41->acpi_subsystem_id, NULL, 239 + cs35l41->speaker_id, "bin"); 240 + if (ret) 241 + goto coeff_err; 252 242 } 253 243 244 + return ret; 245 + coeff_err: 246 + release_firmware(*wmfw_firmware); 247 + kfree(*wmfw_filename); 248 + return ret; 249 + } 250 + 251 + static int cs35l41_fallback_firmware_file(struct cs35l41_hda *cs35l41, 252 + const struct firmware **wmfw_firmware, 253 + char **wmfw_filename, 254 + const struct firmware **coeff_firmware, 255 + char **coeff_filename) 256 + { 257 + int ret; 258 + 259 + /* Handle fallback */ 260 + dev_warn(cs35l41->dev, "Falling back to default firmware.\n"); 261 + 262 + /* fallback try cirrus/part-dspN-fwtype.wmfw */ 263 + ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, 264 + CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "wmfw"); 265 + if (ret) 266 + goto err; 267 + 268 + /* fallback try cirrus/part-dspN-fwtype.bin */ 269 + ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, 270 + CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin"); 271 + if (ret) { 272 + release_firmware(*wmfw_firmware); 273 + kfree(*wmfw_filename); 274 + goto err; 275 + } 276 + return 0; 277 + 278 + err: 279 + dev_warn(cs35l41->dev, "Unable to find firmware and tuning\n"); 254 280 return ret; 255 281 } 256 282 ··· 304 254 ret = cs35l41_request_firmware_files_spkid(cs35l41, wmfw_firmware, wmfw_filename, 305 255 coeff_firmware, coeff_filename); 306 256 goto out; 307 - 308 257 } 309 258 310 259 /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */ ··· 316 267 CS35L41_FIRMWARE_ROOT, 317 268 cs35l41->acpi_subsystem_id, cs35l41->amp_name, 318 269 -1, "bin"); 270 + if (ret) 271 + goto coeff_err; 272 + 319 273 goto out; 320 274 } 321 275 ··· 338 286 CS35L41_FIRMWARE_ROOT, 339 287 cs35l41->acpi_subsystem_id, NULL, -1, 340 288 "bin"); 289 + if (ret) 290 + goto coeff_err; 341 291 } 342 292 343 293 out: 344 - if (!ret) 345 - return 0; 294 + if (ret) 295 + /* if all attempts at finding firmware fail, try fallback */ 296 + goto fallback; 346 297 347 - /* Handle fallback */ 348 - dev_warn(cs35l41->dev, "Falling back to default firmware.\n"); 298 + return 0; 349 299 300 + coeff_err: 350 301 release_firmware(*wmfw_firmware); 351 302 kfree(*wmfw_filename); 352 - 353 - /* fallback try cirrus/part-dspN-fwtype.wmfw */ 354 - ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, 355 - CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "wmfw"); 356 - if (!ret) 357 - /* fallback try cirrus/part-dspN-fwtype.bin */ 358 - ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename, 359 - CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin"); 360 - 361 - if (ret) { 362 - release_firmware(*wmfw_firmware); 363 - kfree(*wmfw_filename); 364 - dev_warn(cs35l41->dev, "Unable to find firmware and tuning\n"); 365 - } 366 - return ret; 303 + fallback: 304 + return cs35l41_fallback_firmware_file(cs35l41, wmfw_firmware, wmfw_filename, 305 + coeff_firmware, coeff_filename); 367 306 } 368 307 369 308 #if IS_ENABLED(CONFIG_EFI)
+17 -10
sound/pci/hda/patch_realtek.c
··· 7343 7343 ALC245_FIXUP_HP_MUTE_LED_COEFBIT, 7344 7344 ALC245_FIXUP_HP_X360_MUTE_LEDS, 7345 7345 ALC287_FIXUP_THINKPAD_I2S_SPK, 7346 + ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD, 7346 7347 }; 7347 7348 7348 7349 /* A special fixup for Lenovo C940 and Yoga Duet 7; ··· 9442 9441 .type = HDA_FIXUP_FUNC, 9443 9442 .v.func = alc287_fixup_bind_dacs, 9444 9443 }, 9444 + [ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = { 9445 + .type = HDA_FIXUP_FUNC, 9446 + .v.func = alc287_fixup_bind_dacs, 9447 + .chained = true, 9448 + .chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI, 9449 + }, 9445 9450 }; 9446 9451 9447 9452 static const struct snd_pci_quirk alc269_fixup_tbl[] = { ··· 9861 9854 SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), 9862 9855 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), 9863 9856 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), 9864 - SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC225_FIXUP_HEADSET_JACK), 9857 + SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), 9865 9858 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE), 9866 9859 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), 9867 9860 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP), ··· 9995 9988 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK), 9996 9989 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK), 9997 9990 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK), 9998 - SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI), 9999 - SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI), 10000 - SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI), 10001 - SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI), 10002 - SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI), 10003 - SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI), 10004 - SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI), 10005 - SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI), 9991 + SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 9992 + SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 9993 + SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 9994 + SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 9995 + SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 9996 + SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 9997 + SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 9998 + SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD), 10006 9999 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), 10007 10000 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), 10008 10001 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), ··· 10098 10091 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC), 10099 10092 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED), 10100 10093 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10), 10101 - SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC225_FIXUP_HEADSET_JACK), 10094 + SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK), 10102 10095 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE), 10103 10096 10104 10097 #if 0
+7
sound/soc/amd/yc/acp6x-mach.c
··· 244 244 { 245 245 .driver_data = &acp6x_card, 246 246 .matches = { 247 + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), 248 + DMI_MATCH(DMI_PRODUCT_NAME, "82YM"), 249 + } 250 + }, 251 + { 252 + .driver_data = &acp6x_card, 253 + .matches = { 247 254 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."), 248 255 DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"), 249 256 }
+4 -1
sound/soc/codecs/hdmi-codec.c
··· 531 531 hp->sample_rate = sample_rate; 532 532 hp->channels = channels; 533 533 534 - hcp->chmap_idx = idx; 534 + if (pcm_audio) 535 + hcp->chmap_idx = ca_id; 536 + else 537 + hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN; 535 538 536 539 return 0; 537 540 }
+5 -5
sound/soc/codecs/rt5682-i2c.c
··· 157 157 return ret; 158 158 } 159 159 160 - ret = devm_add_action_or_reset(&i2c->dev, rt5682_i2c_disable_regulators, 161 - rt5682); 162 - if (ret) 163 - return ret; 164 - 165 160 ret = regulator_bulk_enable(ARRAY_SIZE(rt5682->supplies), 166 161 rt5682->supplies); 167 162 if (ret) { 168 163 dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); 169 164 return ret; 170 165 } 166 + 167 + ret = devm_add_action_or_reset(&i2c->dev, rt5682_i2c_disable_regulators, 168 + rt5682); 169 + if (ret) 170 + return ret; 171 171 172 172 ret = rt5682_get_ldo1(rt5682, &i2c->dev); 173 173 if (ret)
+2 -2
sound/soc/codecs/tlv320adc3xxx.c
··· 293 293 #define ADC3XXX_BYPASS_RPGA 0x80 294 294 295 295 /* MICBIAS control bits */ 296 - #define ADC3XXX_MICBIAS_MASK 0x2 296 + #define ADC3XXX_MICBIAS_MASK 0x3 297 297 #define ADC3XXX_MICBIAS1_SHIFT 5 298 298 #define ADC3XXX_MICBIAS2_SHIFT 3 299 299 ··· 1099 1099 unsigned int val; 1100 1100 1101 1101 if (!of_property_read_u32(np, propname, &val)) { 1102 - if (val >= ADC3XXX_MICBIAS_AVDD) { 1102 + if (val > ADC3XXX_MICBIAS_AVDD) { 1103 1103 dev_err(dev, "Invalid property value for '%s'\n", propname); 1104 1104 return -EINVAL; 1105 1105 }
+8 -4
sound/soc/fsl/fsl-asoc-card.c
··· 52 52 unsigned long mclk_freq; 53 53 unsigned long free_freq; 54 54 u32 mclk_id; 55 - u32 fll_id; 56 - u32 pll_id; 55 + int fll_id; 56 + int pll_id; 57 57 }; 58 58 59 59 /** ··· 206 206 } 207 207 208 208 /* Specific configuration for PLL */ 209 - if (codec_priv->pll_id && codec_priv->fll_id) { 209 + if (codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { 210 210 if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE) 211 211 pll_out = priv->sample_rate * 384; 212 212 else ··· 248 248 249 249 priv->streams &= ~BIT(substream->stream); 250 250 251 - if (!priv->streams && codec_priv->pll_id && codec_priv->fll_id) { 251 + if (!priv->streams && codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) { 252 252 /* Force freq to be free_freq to avoid error message in codec */ 253 253 ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0), 254 254 codec_priv->mclk_id, ··· 621 621 priv->card.dapm_routes = audio_map; 622 622 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map); 623 623 priv->card.driver_name = DRIVER_NAME; 624 + 625 + priv->codec_priv.fll_id = -1; 626 + priv->codec_priv.pll_id = -1; 627 + 624 628 /* Diversify the card configurations */ 625 629 if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) { 626 630 codec_dai_name = "cs42888";
+7 -2
sound/soc/fsl/fsl_sai.c
··· 710 710 { 711 711 unsigned int ofs = sai->soc_data->reg_offset; 712 712 bool tx = dir == TX; 713 - u32 xcsr, count = 100; 713 + u32 xcsr, count = 100, mask; 714 + 715 + if (sai->soc_data->mclk_with_tere && sai->mclk_direction_output) 716 + mask = FSL_SAI_CSR_TERE; 717 + else 718 + mask = FSL_SAI_CSR_TERE | FSL_SAI_CSR_BCE; 714 719 715 720 regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs), 716 - FSL_SAI_CSR_TERE | FSL_SAI_CSR_BCE, 0); 721 + mask, 0); 717 722 718 723 /* TERE will remain set till the end of current frame */ 719 724 do {
+2 -1
sound/soc/generic/simple-card-utils.c
··· 310 310 if (fixed_sysclk % props->mclk_fs) { 311 311 dev_err(rtd->dev, "fixed sysclk %u not divisible by mclk_fs %u\n", 312 312 fixed_sysclk, props->mclk_fs); 313 - return -EINVAL; 313 + ret = -EINVAL; 314 + goto codec_err; 314 315 } 315 316 ret = snd_pcm_hw_constraint_minmax(substream->runtime, SNDRV_PCM_HW_PARAM_RATE, 316 317 fixed_rate, fixed_rate);
+4 -2
sound/soc/generic/simple-card.c
··· 759 759 struct snd_soc_dai_link *dai_link = priv->dai_link; 760 760 struct simple_dai_props *dai_props = priv->dai_props; 761 761 762 + ret = -EINVAL; 763 + 762 764 cinfo = dev->platform_data; 763 765 if (!cinfo) { 764 766 dev_err(dev, "no info for asoc-simple-card\n"); 765 - return -EINVAL; 767 + goto err; 766 768 } 767 769 768 770 if (!cinfo->name || ··· 773 771 !cinfo->platform || 774 772 !cinfo->cpu_dai.name) { 775 773 dev_err(dev, "insufficient asoc_simple_card_info settings\n"); 776 - return -EINVAL; 774 + goto err; 777 775 } 778 776 779 777 cpus = dai_link->cpus;
+10
sound/soc/intel/boards/sof_es8336.c
··· 808 808 SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK | 809 809 SOF_ES8336_JD_INVERTED), 810 810 }, 811 + { 812 + .name = "mtl_es83x6_c1_h02", 813 + .driver_data = (kernel_ulong_t)(SOF_ES8336_SSP_CODEC(1) | 814 + SOF_NO_OF_HDMI_CAPTURE_SSP(2) | 815 + SOF_HDMI_CAPTURE_1_SSP(0) | 816 + SOF_HDMI_CAPTURE_2_SSP(2) | 817 + SOF_SSP_HDMI_CAPTURE_PRESENT | 818 + SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK | 819 + SOF_ES8336_JD_INVERTED), 820 + }, 811 821 { } 812 822 }; 813 823 MODULE_DEVICE_TABLE(platform, board_ids);
+10
sound/soc/intel/boards/sof_sdw.c
··· 380 380 .callback = sof_sdw_quirk_cb, 381 381 .matches = { 382 382 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 383 + DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0B14"), 384 + }, 385 + /* No Jack */ 386 + .driver_data = (void *)SOF_SDW_TGL_HDMI, 387 + }, 388 + 389 + { 390 + .callback = sof_sdw_quirk_cb, 391 + .matches = { 392 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 383 393 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0B29"), 384 394 }, 385 395 .driver_data = (void *)(SOF_SDW_TGL_HDMI |
+6 -6
sound/soc/intel/common/soc-acpi-intel-adl-match.c
··· 656 656 .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg", 657 657 }, 658 658 { 659 - .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */ 660 - .links = adl_sdw_rt1316_link1_rt714_link0, 661 - .drv_name = "sof_sdw", 662 - .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg", 663 - }, 664 - { 665 659 .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */ 666 660 .links = adl_sdw_rt1316_link12_rt714_link0, 667 661 .drv_name = "sof_sdw", 668 662 .sof_tplg_filename = "sof-adl-rt1316-l12-rt714-l0.tplg", 663 + }, 664 + { 665 + .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */ 666 + .links = adl_sdw_rt1316_link1_rt714_link0, 667 + .drv_name = "sof_sdw", 668 + .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg", 669 669 }, 670 670 { 671 671 .link_mask = 0x5, /* 2 active links required */
+25
sound/soc/intel/common/soc-acpi-intel-mtl-match.c
··· 30 30 .codecs = {"10EC5682", "RTL5682"}, 31 31 }; 32 32 33 + static const struct snd_soc_acpi_codecs mtl_essx_83x6 = { 34 + .num_codecs = 3, 35 + .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"}, 36 + }; 37 + 38 + static const struct snd_soc_acpi_codecs mtl_lt6911_hdmi = { 39 + .num_codecs = 1, 40 + .codecs = {"INTC10B0"} 41 + }; 42 + 33 43 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = { 34 44 { 35 45 .comp_ids = &mtl_rt5682_rt5682s_hp, ··· 61 51 .machine_quirk = snd_soc_acpi_codec_list, 62 52 .quirk_data = &mtl_rt1019p_amp, 63 53 .sof_tplg_filename = "sof-mtl-rt1019-rt5682.tplg", 54 + }, 55 + { 56 + .comp_ids = &mtl_essx_83x6, 57 + .drv_name = "mtl_es83x6_c1_h02", 58 + .machine_quirk = snd_soc_acpi_codec_list, 59 + .quirk_data = &mtl_lt6911_hdmi, 60 + .sof_tplg_filename = "sof-mtl-es83x6-ssp1-hdmi-ssp02.tplg", 61 + }, 62 + { 63 + .comp_ids = &mtl_essx_83x6, 64 + .drv_name = "sof-essx8336", 65 + .sof_tplg_filename = "sof-mtl-es8336", /* the tplg suffix is added at run time */ 66 + .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER | 67 + SND_SOC_ACPI_TPLG_INTEL_SSP_MSB | 68 + SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, 64 69 }, 65 70 {}, 66 71 };
+17 -7
sound/soc/soc-core.c
··· 1347 1347 snd_soc_runtime_get_dai_fmt(rtd); 1348 1348 ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); 1349 1349 if (ret) 1350 - return ret; 1350 + goto err; 1351 1351 1352 1352 /* add DPCM sysfs entries */ 1353 1353 soc_dpcm_debugfs_add(rtd); ··· 1372 1372 /* create compress_device if possible */ 1373 1373 ret = snd_soc_dai_compress_new(cpu_dai, rtd, num); 1374 1374 if (ret != -ENOTSUPP) 1375 - return ret; 1375 + goto err; 1376 1376 1377 1377 /* create the pcm */ 1378 1378 ret = soc_new_pcm(rtd, num); 1379 1379 if (ret < 0) { 1380 1380 dev_err(card->dev, "ASoC: can't create pcm %s :%d\n", 1381 1381 dai_link->stream_name, ret); 1382 - return ret; 1382 + goto err; 1383 1383 } 1384 1384 1385 - return snd_soc_pcm_dai_new(rtd); 1385 + ret = snd_soc_pcm_dai_new(rtd); 1386 + if (ret < 0) 1387 + goto err; 1388 + 1389 + rtd->initialized = true; 1390 + 1391 + return 0; 1392 + err: 1393 + snd_soc_link_exit(rtd); 1394 + return ret; 1386 1395 } 1387 1396 1388 1397 static void soc_set_name_prefix(struct snd_soc_card *card, ··· 1454 1445 if (component->card) { 1455 1446 if (component->card != card) { 1456 1447 dev_err(component->dev, 1457 - "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n", 1458 - card->name, component->card->name); 1448 + "Trying to bind component \"%s\" to card \"%s\" but is already bound to card \"%s\"\n", 1449 + component->name, card->name, component->card->name); 1459 1450 return -ENODEV; 1460 1451 } 1461 1452 return 0; ··· 1989 1980 1990 1981 /* release machine specific resources */ 1991 1982 for_each_card_rtds(card, rtd) 1992 - snd_soc_link_exit(rtd); 1983 + if (rtd->initialized) 1984 + snd_soc_link_exit(rtd); 1993 1985 /* remove and free each DAI */ 1994 1986 soc_remove_link_dais(card); 1995 1987 soc_remove_link_components(card);
+2 -2
sound/soc/soc-generic-dmaengine-pcm.c
··· 44 44 * platforms which make use of the snd_dmaengine_dai_dma_data struct for their 45 45 * DAI DMA data. Internally the function will first call 46 46 * snd_hwparams_to_dma_slave_config to fill in the slave config based on the 47 - * hw_params, followed by snd_dmaengine_set_config_from_dai_data to fill in the 48 - * remaining fields based on the DAI DMA data. 47 + * hw_params, followed by snd_dmaengine_pcm_set_config_from_dai_data to fill in 48 + * the remaining fields based on the DAI DMA data. 49 49 */ 50 50 int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream, 51 51 struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config)
-1
sound/soc/sof/amd/pci-rmb.c
··· 35 35 .dsp_intr_base = ACP6X_DSP_SW_INTR_BASE, 36 36 .sram_pte_offset = ACP6X_SRAM_PTE_OFFSET, 37 37 .hw_semaphore_offset = ACP6X_AXI2DAGB_SEM_0, 38 - .acp_clkmux_sel = ACP6X_CLKMUX_SEL, 39 38 .fusion_dsp_offset = ACP6X_DSP_FUSION_RUNSTALL, 40 39 .probe_reg_offset = ACP6X_FUTURE_REG_ACLK_0, 41 40 };
+7
sound/usb/mixer.c
··· 1204 1204 cval->res = 16; 1205 1205 } 1206 1206 break; 1207 + case USB_ID(0x1bcf, 0x2283): /* NexiGo N930AF FHD Webcam */ 1208 + if (!strcmp(kctl->id.name, "Mic Capture Volume")) { 1209 + usb_audio_info(chip, 1210 + "set resolution quirk: cval->res = 16\n"); 1211 + cval->res = 16; 1212 + } 1213 + break; 1207 1214 } 1208 1215 } 1209 1216
+7 -1
sound/usb/quirks.c
··· 1994 1994 /* mic works only when ep packet size is set to wMaxPacketSize */ 1995 1995 fp->attributes |= UAC_EP_CS_ATTR_FILL_MAX; 1996 1996 break; 1997 - 1997 + case USB_ID(0x3511, 0x2b1e): /* Opencomm2 UC USB Bluetooth dongle */ 1998 + /* mic works only when ep pitch control is not set */ 1999 + if (stream == SNDRV_PCM_STREAM_CAPTURE) 2000 + fp->attributes &= ~UAC_EP_CS_ATTR_PITCH_CONTROL; 2001 + break; 1998 2002 } 1999 2003 } 2000 2004 ··· 2177 2173 QUIRK_FLAG_FIXED_RATE), 2178 2174 DEVICE_FLG(0x0ecb, 0x2069, /* JBL Quantum810 Wireless */ 2179 2175 QUIRK_FLAG_FIXED_RATE), 2176 + DEVICE_FLG(0x1bcf, 0x2283, /* NexiGo N930AF FHD Webcam */ 2177 + QUIRK_FLAG_GET_SAMPLE_RATE), 2180 2178 2181 2179 /* Vendor matches */ 2182 2180 VENDOR_FLG(0x045e, /* MS Lifecam */
+206 -35
tools/hv/hv_kvp_daemon.c
··· 1171 1171 return 0; 1172 1172 } 1173 1173 1174 + /* 1175 + * Only IPv4 subnet strings needs to be converted to plen 1176 + * For IPv6 the subnet is already privided in plen format 1177 + */ 1178 + static int kvp_subnet_to_plen(char *subnet_addr_str) 1179 + { 1180 + int plen = 0; 1181 + struct in_addr subnet_addr4; 1182 + 1183 + /* 1184 + * Convert subnet address to binary representation 1185 + */ 1186 + if (inet_pton(AF_INET, subnet_addr_str, &subnet_addr4) == 1) { 1187 + uint32_t subnet_mask = ntohl(subnet_addr4.s_addr); 1188 + 1189 + while (subnet_mask & 0x80000000) { 1190 + plen++; 1191 + subnet_mask <<= 1; 1192 + } 1193 + } else { 1194 + return -1; 1195 + } 1196 + 1197 + return plen; 1198 + } 1199 + 1200 + static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet, 1201 + int is_ipv6) 1202 + { 1203 + char addr[INET6_ADDRSTRLEN]; 1204 + char subnet_addr[INET6_ADDRSTRLEN]; 1205 + int error, i = 0; 1206 + int ip_offset = 0, subnet_offset = 0; 1207 + int plen; 1208 + 1209 + memset(addr, 0, sizeof(addr)); 1210 + memset(subnet_addr, 0, sizeof(subnet_addr)); 1211 + 1212 + while (parse_ip_val_buffer(ip_string, &ip_offset, addr, 1213 + (MAX_IP_ADDR_SIZE * 2)) && 1214 + parse_ip_val_buffer(subnet, 1215 + &subnet_offset, 1216 + subnet_addr, 1217 + (MAX_IP_ADDR_SIZE * 1218 + 2))) { 1219 + if (!is_ipv6) 1220 + plen = kvp_subnet_to_plen((char *)subnet_addr); 1221 + else 1222 + plen = atoi(subnet_addr); 1223 + 1224 + if (plen < 0) 1225 + return plen; 1226 + 1227 + error = fprintf(f, "address%d=%s/%d\n", ++i, (char *)addr, 1228 + plen); 1229 + if (error < 0) 1230 + return error; 1231 + 1232 + memset(addr, 0, sizeof(addr)); 1233 + memset(subnet_addr, 0, sizeof(subnet_addr)); 1234 + } 1235 + 1236 + return 0; 1237 + } 1238 + 1174 1239 static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) 1175 1240 { 1176 1241 int error = 0; 1177 - char if_file[PATH_MAX]; 1178 - FILE *file; 1242 + char if_filename[PATH_MAX]; 1243 + char nm_filename[PATH_MAX]; 1244 + FILE *ifcfg_file, *nmfile; 1179 1245 char cmd[PATH_MAX]; 1246 + int is_ipv6 = 0; 1180 1247 char *mac_addr; 1181 1248 int str_len; 1182 1249 ··· 1264 1197 * in a given distro to configure the interface and so are free 1265 1198 * ignore information that may not be relevant. 1266 1199 * 1267 - * Here is the format of the ip configuration file: 1200 + * Here is the ifcfg format of the ip configuration file: 1268 1201 * 1269 1202 * HWADDR=macaddr 1270 1203 * DEVICE=interface name ··· 1287 1220 * tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as 1288 1221 * IPV6NETMASK. 1289 1222 * 1223 + * Here is the keyfile format of the ip configuration file: 1224 + * 1225 + * [ethernet] 1226 + * mac-address=macaddr 1227 + * [connection] 1228 + * interface-name=interface name 1229 + * 1230 + * [ipv4] 1231 + * method=<protocol> (where <protocol> is "auto" if DHCP is configured 1232 + * or "manual" if no boot-time protocol should be used) 1233 + * 1234 + * address1=ipaddr1/plen 1235 + * address2=ipaddr2/plen 1236 + * 1237 + * gateway=gateway1;gateway2 1238 + * 1239 + * dns=dns1;dns2 1240 + * 1241 + * [ipv6] 1242 + * address1=ipaddr1/plen 1243 + * address2=ipaddr2/plen 1244 + * 1245 + * gateway=gateway1;gateway2 1246 + * 1247 + * dns=dns1;dns2 1248 + * 1290 1249 * The host can specify multiple ipv4 and ipv6 addresses to be 1291 1250 * configured for the interface. Furthermore, the configuration 1292 1251 * needs to be persistent. A subsequent GET call on the interface ··· 1320 1227 * call. 1321 1228 */ 1322 1229 1323 - snprintf(if_file, sizeof(if_file), "%s%s%s", KVP_CONFIG_LOC, 1324 - "/ifcfg-", if_name); 1230 + /* 1231 + * We are populating both ifcfg and nmconnection files 1232 + */ 1233 + snprintf(if_filename, sizeof(if_filename), "%s%s%s", KVP_CONFIG_LOC, 1234 + "/ifcfg-", if_name); 1325 1235 1326 - file = fopen(if_file, "w"); 1236 + ifcfg_file = fopen(if_filename, "w"); 1327 1237 1328 - if (file == NULL) { 1238 + if (!ifcfg_file) { 1329 1239 syslog(LOG_ERR, "Failed to open config file; error: %d %s", 1330 - errno, strerror(errno)); 1240 + errno, strerror(errno)); 1241 + return HV_E_FAIL; 1242 + } 1243 + 1244 + snprintf(nm_filename, sizeof(nm_filename), "%s%s%s%s", KVP_CONFIG_LOC, 1245 + "/", if_name, ".nmconnection"); 1246 + 1247 + nmfile = fopen(nm_filename, "w"); 1248 + 1249 + if (!nmfile) { 1250 + syslog(LOG_ERR, "Failed to open config file; error: %d %s", 1251 + errno, strerror(errno)); 1252 + fclose(ifcfg_file); 1331 1253 return HV_E_FAIL; 1332 1254 } 1333 1255 ··· 1356 1248 goto setval_error; 1357 1249 } 1358 1250 1359 - error = kvp_write_file(file, "HWADDR", "", mac_addr); 1360 - free(mac_addr); 1361 - if (error) 1362 - goto setval_error; 1251 + error = kvp_write_file(ifcfg_file, "HWADDR", "", mac_addr); 1252 + if (error < 0) 1253 + goto setmac_error; 1363 1254 1364 - error = kvp_write_file(file, "DEVICE", "", if_name); 1255 + error = kvp_write_file(ifcfg_file, "DEVICE", "", if_name); 1256 + if (error < 0) 1257 + goto setmac_error; 1258 + 1259 + error = fprintf(nmfile, "\n[connection]\n"); 1260 + if (error < 0) 1261 + goto setmac_error; 1262 + 1263 + error = kvp_write_file(nmfile, "interface-name", "", if_name); 1365 1264 if (error) 1366 - goto setval_error; 1265 + goto setmac_error; 1266 + 1267 + error = fprintf(nmfile, "\n[ethernet]\n"); 1268 + if (error < 0) 1269 + goto setmac_error; 1270 + 1271 + error = kvp_write_file(nmfile, "mac-address", "", mac_addr); 1272 + if (error) 1273 + goto setmac_error; 1274 + 1275 + free(mac_addr); 1367 1276 1368 1277 /* 1369 1278 * The dhcp_enabled flag is only for IPv4. In the case the host only ··· 1388 1263 * proceed to parse and pass the IPv6 information to the 1389 1264 * disto-specific script hv_set_ifconfig. 1390 1265 */ 1266 + 1267 + /* 1268 + * First populate the ifcfg file format 1269 + */ 1391 1270 if (new_val->dhcp_enabled) { 1392 - error = kvp_write_file(file, "BOOTPROTO", "", "dhcp"); 1271 + error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "dhcp"); 1393 1272 if (error) 1394 1273 goto setval_error; 1395 - 1396 1274 } else { 1397 - error = kvp_write_file(file, "BOOTPROTO", "", "none"); 1275 + error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "none"); 1398 1276 if (error) 1277 + goto setval_error; 1278 + } 1279 + 1280 + error = process_ip_string(ifcfg_file, (char *)new_val->ip_addr, 1281 + IPADDR); 1282 + if (error) 1283 + goto setval_error; 1284 + 1285 + error = process_ip_string(ifcfg_file, (char *)new_val->sub_net, 1286 + NETMASK); 1287 + if (error) 1288 + goto setval_error; 1289 + 1290 + error = process_ip_string(ifcfg_file, (char *)new_val->gate_way, 1291 + GATEWAY); 1292 + if (error) 1293 + goto setval_error; 1294 + 1295 + error = process_ip_string(ifcfg_file, (char *)new_val->dns_addr, DNS); 1296 + if (error) 1297 + goto setval_error; 1298 + 1299 + if (new_val->addr_family == ADDR_FAMILY_IPV6) { 1300 + error = fprintf(nmfile, "\n[ipv6]\n"); 1301 + if (error < 0) 1302 + goto setval_error; 1303 + is_ipv6 = 1; 1304 + } else { 1305 + error = fprintf(nmfile, "\n[ipv4]\n"); 1306 + if (error < 0) 1307 + goto setval_error; 1308 + } 1309 + 1310 + /* 1311 + * Now we populate the keyfile format 1312 + */ 1313 + 1314 + if (new_val->dhcp_enabled) { 1315 + error = kvp_write_file(nmfile, "method", "", "auto"); 1316 + if (error < 0) 1317 + goto setval_error; 1318 + } else { 1319 + error = kvp_write_file(nmfile, "method", "", "manual"); 1320 + if (error < 0) 1399 1321 goto setval_error; 1400 1322 } 1401 1323 1402 1324 /* 1403 1325 * Write the configuration for ipaddress, netmask, gateway and 1404 - * name servers. 1326 + * name services 1405 1327 */ 1406 - 1407 - error = process_ip_string(file, (char *)new_val->ip_addr, IPADDR); 1408 - if (error) 1328 + error = process_ip_string_nm(nmfile, (char *)new_val->ip_addr, 1329 + (char *)new_val->sub_net, is_ipv6); 1330 + if (error < 0) 1409 1331 goto setval_error; 1410 1332 1411 - error = process_ip_string(file, (char *)new_val->sub_net, NETMASK); 1412 - if (error) 1333 + error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way); 1334 + if (error < 0) 1413 1335 goto setval_error; 1414 1336 1415 - error = process_ip_string(file, (char *)new_val->gate_way, GATEWAY); 1416 - if (error) 1337 + error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr); 1338 + if (error < 0) 1417 1339 goto setval_error; 1418 1340 1419 - error = process_ip_string(file, (char *)new_val->dns_addr, DNS); 1420 - if (error) 1421 - goto setval_error; 1422 - 1423 - fclose(file); 1341 + fclose(nmfile); 1342 + fclose(ifcfg_file); 1424 1343 1425 1344 /* 1426 1345 * Now that we have populated the configuration file, 1427 1346 * invoke the external script to do its magic. 1428 1347 */ 1429 1348 1430 - str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s", 1431 - "hv_set_ifconfig", if_file); 1349 + str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s %s", 1350 + "hv_set_ifconfig", if_filename, nm_filename); 1432 1351 /* 1433 1352 * This is a little overcautious, but it's necessary to suppress some 1434 1353 * false warnings from gcc 8.0.1. ··· 1485 1316 1486 1317 if (system(cmd)) { 1487 1318 syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s", 1488 - cmd, errno, strerror(errno)); 1319 + cmd, errno, strerror(errno)); 1489 1320 return HV_E_FAIL; 1490 1321 } 1491 1322 return 0; 1492 - 1323 + setmac_error: 1324 + free(mac_addr); 1493 1325 setval_error: 1494 1326 syslog(LOG_ERR, "Failed to write config file"); 1495 - fclose(file); 1327 + fclose(ifcfg_file); 1328 + fclose(nmfile); 1496 1329 return error; 1497 1330 } 1498 1331
+33 -6
tools/hv/hv_set_ifconfig.sh
··· 18 18 # 19 19 # This example script is based on a RHEL environment. 20 20 # 21 - # Here is the format of the ip configuration file: 21 + # Here is the ifcfg format of the ip configuration file: 22 22 # 23 23 # HWADDR=macaddr 24 24 # DEVICE=interface name 25 25 # BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured 26 - # or "none" if no boot-time protocol should be used) 26 + # or "none" if no boot-time protocol should be used) 27 27 # 28 28 # IPADDR0=ipaddr1 29 29 # IPADDR1=ipaddr2 ··· 41 41 # tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as 42 42 # IPV6NETMASK. 43 43 # 44 + # Here is the keyfile format of the ip configuration file: 45 + # 46 + # [ethernet] 47 + # mac-address=macaddr 48 + # [connection] 49 + # interface-name=interface name 50 + # 51 + # [ipv4] 52 + # method=<protocol> (where <protocol> is "auto" if DHCP is configured 53 + # or "manual" if no boot-time protocol should be used) 54 + # 55 + # address1=ipaddr1/plen 56 + # address=ipaddr2/plen 57 + # 58 + # gateway=gateway1;gateway2 59 + # 60 + # dns=dns1; 61 + # 62 + # [ipv6] 63 + # address1=ipaddr1/plen 64 + # address2=ipaddr1/plen 65 + # 66 + # gateway=gateway1;gateway2 67 + # 68 + # dns=dns1;dns2 69 + # 44 70 # The host can specify multiple ipv4 and ipv6 addresses to be 45 71 # configured for the interface. Furthermore, the configuration 46 72 # needs to be persistent. A subsequent GET call on the interface ··· 74 48 # call. 75 49 # 76 50 77 - 78 - 79 51 echo "IPV6INIT=yes" >> $1 80 52 echo "NM_CONTROLLED=no" >> $1 81 53 echo "PEERDNS=yes" >> $1 82 54 echo "ONBOOT=yes" >> $1 83 55 84 - 85 56 cp $1 /etc/sysconfig/network-scripts/ 86 57 58 + chmod 600 $2 59 + interface=$(echo $2 | awk -F - '{ print $2 }') 60 + filename="${2##*/}" 87 61 88 - interface=$(echo $1 | awk -F - '{ print $2 }') 62 + sed '/\[connection\]/a autoconnect=true' $2 > /etc/NetworkManager/system-connections/${filename} 63 + 89 64 90 65 /sbin/ifdown $interface 2>/dev/null 91 66 /sbin/ifup $interface 2>/dev/null
+9 -7
tools/testing/selftests/bpf/prog_tests/tc_helpers.h
··· 45 45 return link_info.tcx.ifindex; 46 46 } 47 47 48 - static inline void __assert_mprog_count(int target, int expected, bool miniq, int ifindex) 48 + static inline void __assert_mprog_count(int target, int expected, int ifindex) 49 49 { 50 50 __u32 count = 0, attach_flags = 0; 51 51 int err; ··· 53 53 err = bpf_prog_query(ifindex, target, 0, &attach_flags, 54 54 NULL, &count); 55 55 ASSERT_EQ(count, expected, "count"); 56 - if (!expected && !miniq) 57 - ASSERT_EQ(err, -ENOENT, "prog_query"); 58 - else 59 - ASSERT_EQ(err, 0, "prog_query"); 56 + ASSERT_EQ(err, 0, "prog_query"); 60 57 } 61 58 62 59 static inline void assert_mprog_count(int target, int expected) 63 60 { 64 - __assert_mprog_count(target, expected, false, loopback); 61 + __assert_mprog_count(target, expected, loopback); 65 62 } 66 63 67 64 static inline void assert_mprog_count_ifindex(int ifindex, int target, int expected) 68 65 { 69 - __assert_mprog_count(target, expected, false, ifindex); 66 + __assert_mprog_count(target, expected, ifindex); 67 + } 68 + 69 + static inline void tc_skel_reset_all_seen(struct test_tc_link *skel) 70 + { 71 + memset(skel->bss, 0, sizeof(*skel->bss)); 70 72 } 71 73 72 74 #endif /* TC_HELPERS */
+23 -41
tools/testing/selftests/bpf/prog_tests/tc_links.c
··· 65 65 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]"); 66 66 ASSERT_EQ(optq.link_ids[1], 0, "link_ids[1]"); 67 67 68 + tc_skel_reset_all_seen(skel); 68 69 ASSERT_OK(system(ping_cmd), ping_cmd); 69 70 70 71 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 98 97 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]"); 99 98 ASSERT_EQ(optq.link_ids[1], 0, "link_ids[1]"); 100 99 100 + tc_skel_reset_all_seen(skel); 101 101 ASSERT_OK(system(ping_cmd), ping_cmd); 102 102 103 103 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 189 187 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 190 188 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]"); 191 189 190 + tc_skel_reset_all_seen(skel); 192 191 ASSERT_OK(system(ping_cmd), ping_cmd); 193 192 194 193 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 195 194 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2"); 196 195 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3"); 197 196 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4"); 198 - 199 - skel->bss->seen_tc1 = false; 200 - skel->bss->seen_tc2 = false; 201 197 202 198 LIBBPF_OPTS_RESET(optl, 203 199 .flags = BPF_F_BEFORE, ··· 246 246 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]"); 247 247 ASSERT_EQ(optq.link_ids[4], 0, "link_ids[4]"); 248 248 249 + tc_skel_reset_all_seen(skel); 249 250 ASSERT_OK(system(ping_cmd), ping_cmd); 250 251 251 252 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 343 342 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 344 343 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]"); 345 344 345 + tc_skel_reset_all_seen(skel); 346 346 ASSERT_OK(system(ping_cmd), ping_cmd); 347 347 348 348 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 349 349 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2"); 350 350 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3"); 351 351 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4"); 352 - 353 - skel->bss->seen_tc1 = false; 354 - skel->bss->seen_tc2 = false; 355 352 356 353 LIBBPF_OPTS_RESET(optl, 357 354 .flags = BPF_F_AFTER, ··· 400 401 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]"); 401 402 ASSERT_EQ(optq.link_ids[4], 0, "link_ids[4]"); 402 403 404 + tc_skel_reset_all_seen(skel); 403 405 ASSERT_OK(system(ping_cmd), ping_cmd); 404 406 405 407 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 502 502 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 503 503 ASSERT_EQ(optq.link_ids[2], 0, "prog_ids[2]"); 504 504 505 + tc_skel_reset_all_seen(skel); 505 506 ASSERT_OK(system(ping_cmd), ping_cmd); 506 507 507 508 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 582 581 583 582 assert_mprog_count(target, 2); 584 583 584 + tc_skel_reset_all_seen(skel); 585 585 ASSERT_OK(system(ping_cmd), ping_cmd); 586 586 587 587 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 588 588 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2"); 589 589 ASSERT_EQ(skel->bss->seen_tc3, chain_tc_old, "seen_tc3"); 590 - 591 - skel->bss->seen_tc1 = false; 592 - skel->bss->seen_tc2 = false; 593 - skel->bss->seen_tc3 = false; 594 590 595 591 err = bpf_link__detach(skel->links.tc2); 596 592 if (!ASSERT_OK(err, "prog_detach")) ··· 595 597 596 598 assert_mprog_count(target, 1); 597 599 600 + tc_skel_reset_all_seen(skel); 598 601 ASSERT_OK(system(ping_cmd), ping_cmd); 599 602 600 603 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 706 707 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 707 708 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]"); 708 709 710 + tc_skel_reset_all_seen(skel); 709 711 ASSERT_OK(system(ping_cmd), ping_cmd); 710 712 711 713 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 712 714 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2"); 713 715 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3"); 714 - 715 - skel->bss->seen_tc1 = false; 716 - skel->bss->seen_tc2 = false; 717 - skel->bss->seen_tc3 = false; 718 716 719 717 LIBBPF_OPTS_RESET(optl, 720 718 .flags = BPF_F_REPLACE, ··· 777 781 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 778 782 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]"); 779 783 784 + tc_skel_reset_all_seen(skel); 780 785 ASSERT_OK(system(ping_cmd), ping_cmd); 781 786 782 787 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 783 788 ASSERT_EQ(skel->bss->seen_tc2, false, "seen_tc2"); 784 789 ASSERT_EQ(skel->bss->seen_tc3, true, "seen_tc3"); 785 - 786 - skel->bss->seen_tc1 = false; 787 - skel->bss->seen_tc2 = false; 788 - skel->bss->seen_tc3 = false; 789 790 790 791 err = bpf_link__detach(skel->links.tc2); 791 792 if (!ASSERT_OK(err, "link_detach")) ··· 805 812 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]"); 806 813 ASSERT_EQ(optq.link_ids[1], 0, "link_ids[1]"); 807 814 815 + tc_skel_reset_all_seen(skel); 808 816 ASSERT_OK(system(ping_cmd), ping_cmd); 809 817 810 818 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 811 819 ASSERT_EQ(skel->bss->seen_tc2, false, "seen_tc2"); 812 820 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3"); 813 - 814 - skel->bss->seen_tc1 = false; 815 - skel->bss->seen_tc2 = false; 816 - skel->bss->seen_tc3 = false; 817 821 818 822 err = bpf_link__update_program(skel->links.tc1, skel->progs.tc1); 819 823 if (!ASSERT_OK(err, "link_update_self")) ··· 833 843 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]"); 834 844 ASSERT_EQ(optq.link_ids[1], 0, "link_ids[1]"); 835 845 846 + tc_skel_reset_all_seen(skel); 836 847 ASSERT_OK(system(ping_cmd), ping_cmd); 837 848 838 849 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 1245 1254 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 1246 1255 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]"); 1247 1256 1257 + tc_skel_reset_all_seen(skel); 1248 1258 ASSERT_OK(system(ping_cmd), ping_cmd); 1249 1259 1250 1260 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 1251 1261 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2"); 1252 1262 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3"); 1253 1263 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4"); 1254 - 1255 - skel->bss->seen_tc1 = false; 1256 - skel->bss->seen_tc2 = false; 1257 1264 1258 1265 LIBBPF_OPTS_RESET(optl, 1259 1266 .flags = BPF_F_BEFORE, ··· 1300 1311 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]"); 1301 1312 ASSERT_EQ(optq.link_ids[4], 0, "link_ids[4]"); 1302 1313 1314 + tc_skel_reset_all_seen(skel); 1303 1315 ASSERT_OK(system(ping_cmd), ping_cmd); 1304 1316 1305 1317 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 1401 1411 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 1402 1412 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]"); 1403 1413 1414 + tc_skel_reset_all_seen(skel); 1404 1415 ASSERT_OK(system(ping_cmd), ping_cmd); 1405 1416 1406 1417 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 1407 1418 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2"); 1408 1419 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3"); 1409 1420 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4"); 1410 - 1411 - skel->bss->seen_tc1 = false; 1412 - skel->bss->seen_tc2 = false; 1413 1421 1414 1422 LIBBPF_OPTS_RESET(optl, 1415 1423 .flags = BPF_F_AFTER, ··· 1456 1468 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]"); 1457 1469 ASSERT_EQ(optq.link_ids[4], 0, "link_ids[4]"); 1458 1470 1471 + tc_skel_reset_all_seen(skel); 1459 1472 ASSERT_OK(system(ping_cmd), ping_cmd); 1460 1473 1461 1474 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 1626 1637 1627 1638 assert_mprog_count(target, 1); 1628 1639 1640 + tc_skel_reset_all_seen(skel); 1629 1641 ASSERT_OK(system(ping_cmd), ping_cmd); 1630 1642 1631 1643 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4"); 1632 1644 ASSERT_EQ(skel->bss->seen_tc5, false, "seen_tc5"); 1633 1645 ASSERT_EQ(skel->bss->seen_tc6, true, "seen_tc6"); 1634 - 1635 - skel->bss->seen_tc4 = false; 1636 - skel->bss->seen_tc5 = false; 1637 - skel->bss->seen_tc6 = false; 1638 1646 1639 1647 err = bpf_link__update_program(skel->links.tc6, skel->progs.tc4); 1640 1648 if (!ASSERT_OK(err, "link_update")) ··· 1639 1653 1640 1654 assert_mprog_count(target, 1); 1641 1655 1656 + tc_skel_reset_all_seen(skel); 1642 1657 ASSERT_OK(system(ping_cmd), ping_cmd); 1643 1658 1644 1659 ASSERT_EQ(skel->bss->seen_tc4, true, "seen_tc4"); 1645 1660 ASSERT_EQ(skel->bss->seen_tc5, true, "seen_tc5"); 1646 1661 ASSERT_EQ(skel->bss->seen_tc6, false, "seen_tc6"); 1647 1662 1648 - skel->bss->seen_tc4 = false; 1649 - skel->bss->seen_tc5 = false; 1650 - skel->bss->seen_tc6 = false; 1651 - 1652 1663 err = bpf_link__detach(skel->links.tc6); 1653 1664 if (!ASSERT_OK(err, "prog_detach")) 1654 1665 goto cleanup; 1655 1666 1656 - __assert_mprog_count(target, 0, true, loopback); 1667 + assert_mprog_count(target, 0); 1657 1668 1669 + tc_skel_reset_all_seen(skel); 1658 1670 ASSERT_OK(system(ping_cmd), ping_cmd); 1659 1671 1660 1672 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4"); ··· 1742 1758 1743 1759 assert_mprog_count(target, 2); 1744 1760 1761 + tc_skel_reset_all_seen(skel); 1745 1762 ASSERT_OK(system(ping_cmd), ping_cmd); 1746 1763 1747 1764 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 1748 1765 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2"); 1749 1766 ASSERT_EQ(skel->bss->seen_tc3, chain_tc_old, "seen_tc3"); 1750 - 1751 - skel->bss->seen_tc1 = false; 1752 - skel->bss->seen_tc2 = false; 1753 - skel->bss->seen_tc3 = false; 1754 1767 1755 1768 err = bpf_link__detach(skel->links.tc2); 1756 1769 if (!ASSERT_OK(err, "prog_detach")) ··· 1755 1774 1756 1775 assert_mprog_count(target, 1); 1757 1776 1777 + tc_skel_reset_all_seen(skel); 1758 1778 ASSERT_OK(system(ping_cmd), ping_cmd); 1759 1779 1760 1780 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
+248 -23
tools/testing/selftests/bpf/prog_tests/tc_opts.c
··· 59 59 ASSERT_EQ(optq.prog_ids[0], id1, "prog_ids[0]"); 60 60 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]"); 61 61 62 + tc_skel_reset_all_seen(skel); 62 63 ASSERT_OK(system(ping_cmd), ping_cmd); 63 64 64 65 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 84 83 ASSERT_EQ(optq.prog_ids[0], id2, "prog_ids[0]"); 85 84 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]"); 86 85 86 + tc_skel_reset_all_seen(skel); 87 87 ASSERT_OK(system(ping_cmd), ping_cmd); 88 88 89 89 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 165 163 ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]"); 166 164 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 167 165 166 + tc_skel_reset_all_seen(skel); 168 167 ASSERT_OK(system(ping_cmd), ping_cmd); 169 168 170 169 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 222 219 ASSERT_EQ(optq.prog_ids[3], id2, "prog_ids[3]"); 223 220 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]"); 224 221 222 + tc_skel_reset_all_seen(skel); 225 223 ASSERT_OK(system(ping_cmd), ping_cmd); 226 224 227 225 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 317 313 ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]"); 318 314 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 319 315 316 + tc_skel_reset_all_seen(skel); 320 317 ASSERT_OK(system(ping_cmd), ping_cmd); 321 318 322 319 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 374 369 ASSERT_EQ(optq.prog_ids[3], id4, "prog_ids[3]"); 375 370 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]"); 376 371 372 + tc_skel_reset_all_seen(skel); 377 373 ASSERT_OK(system(ping_cmd), ping_cmd); 378 374 379 375 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 520 514 ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]"); 521 515 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 522 516 517 + tc_skel_reset_all_seen(skel); 523 518 ASSERT_OK(system(ping_cmd), ping_cmd); 524 519 525 520 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 615 608 616 609 assert_mprog_count(target, 2); 617 610 611 + tc_skel_reset_all_seen(skel); 618 612 ASSERT_OK(system(ping_cmd), ping_cmd); 619 613 620 614 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 621 615 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2"); 622 616 ASSERT_EQ(skel->bss->seen_tc3, chain_tc_old, "seen_tc3"); 623 - 624 - skel->bss->seen_tc1 = false; 625 - skel->bss->seen_tc2 = false; 626 - skel->bss->seen_tc3 = false; 627 617 628 618 err = bpf_prog_detach_opts(fd2, loopback, target, &optd); 629 619 if (!ASSERT_OK(err, "prog_detach")) ··· 628 624 629 625 assert_mprog_count(target, 1); 630 626 627 + tc_skel_reset_all_seen(skel); 631 628 ASSERT_OK(system(ping_cmd), ping_cmd); 632 629 633 630 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 640 635 if (!ASSERT_OK(err, "prog_detach")) 641 636 goto cleanup; 642 637 643 - __assert_mprog_count(target, 0, chain_tc_old, loopback); 638 + assert_mprog_count(target, 0); 644 639 cleanup: 645 640 if (tc_attached) { 646 641 tc_opts.flags = tc_opts.prog_fd = tc_opts.prog_id = 0; ··· 735 730 ASSERT_EQ(optq.prog_attach_flags[1], 0, "prog_flags[1]"); 736 731 ASSERT_EQ(optq.prog_attach_flags[2], 0, "prog_flags[2]"); 737 732 733 + tc_skel_reset_all_seen(skel); 738 734 ASSERT_OK(system(ping_cmd), ping_cmd); 739 735 740 736 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 741 737 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2"); 742 738 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3"); 743 - 744 - skel->bss->seen_tc1 = false; 745 - skel->bss->seen_tc2 = false; 746 - skel->bss->seen_tc3 = false; 747 739 748 740 LIBBPF_OPTS_RESET(opta, 749 741 .flags = BPF_F_REPLACE, ··· 769 767 ASSERT_EQ(optq.prog_ids[1], id1, "prog_ids[1]"); 770 768 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 771 769 770 + tc_skel_reset_all_seen(skel); 772 771 ASSERT_OK(system(ping_cmd), ping_cmd); 773 772 774 773 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); 775 774 ASSERT_EQ(skel->bss->seen_tc2, false, "seen_tc2"); 776 775 ASSERT_EQ(skel->bss->seen_tc3, true, "seen_tc3"); 777 - 778 - skel->bss->seen_tc1 = false; 779 - skel->bss->seen_tc2 = false; 780 - skel->bss->seen_tc3 = false; 781 776 782 777 LIBBPF_OPTS_RESET(opta, 783 778 .flags = BPF_F_REPLACE | BPF_F_BEFORE, ··· 804 805 ASSERT_EQ(optq.prog_ids[1], id1, "prog_ids[1]"); 805 806 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 806 807 808 + tc_skel_reset_all_seen(skel); 807 809 ASSERT_OK(system(ping_cmd), ping_cmd); 808 810 809 811 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 1084 1084 ASSERT_EQ(optq.prog_ids[1], id1, "prog_ids[1]"); 1085 1085 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 1086 1086 1087 + tc_skel_reset_all_seen(skel); 1087 1088 ASSERT_OK(system(ping_cmd), ping_cmd); 1088 1089 1089 1090 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 1125 1124 ASSERT_EQ(optq.prog_ids[3], id1, "prog_ids[3]"); 1126 1125 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]"); 1127 1126 1127 + tc_skel_reset_all_seen(skel); 1128 1128 ASSERT_OK(system(ping_cmd), ping_cmd); 1129 1129 1130 1130 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 1224 1222 ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]"); 1225 1223 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]"); 1226 1224 1225 + tc_skel_reset_all_seen(skel); 1227 1226 ASSERT_OK(system(ping_cmd), ping_cmd); 1228 1227 1229 1228 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 1265 1262 ASSERT_EQ(optq.prog_ids[3], id4, "prog_ids[3]"); 1266 1263 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]"); 1267 1264 1265 + tc_skel_reset_all_seen(skel); 1268 1266 ASSERT_OK(system(ping_cmd), ping_cmd); 1269 1267 1270 1268 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1"); ··· 2254 2250 BPF_TC_INGRESS : BPF_TC_EGRESS; 2255 2251 err = bpf_tc_hook_create(&tc_hook); 2256 2252 ASSERT_OK(err, "bpf_tc_hook_create"); 2257 - __assert_mprog_count(target, 0, true, loopback); 2253 + assert_mprog_count(target, 0); 2258 2254 } 2259 2255 err = bpf_prog_detach_opts(0, loopback, target, &optd); 2260 2256 ASSERT_EQ(err, -ENOENT, "prog_detach"); ··· 2320 2316 2321 2317 assert_mprog_count(target, 1); 2322 2318 2319 + tc_skel_reset_all_seen(skel); 2323 2320 ASSERT_OK(system(ping_cmd), ping_cmd); 2324 2321 2325 2322 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4"); 2326 2323 ASSERT_EQ(skel->bss->seen_tc5, false, "seen_tc5"); 2327 2324 ASSERT_EQ(skel->bss->seen_tc6, true, "seen_tc6"); 2328 - 2329 - skel->bss->seen_tc4 = false; 2330 - skel->bss->seen_tc5 = false; 2331 - skel->bss->seen_tc6 = false; 2332 2325 2333 2326 LIBBPF_OPTS_RESET(opta, 2334 2327 .flags = BPF_F_REPLACE, ··· 2340 2339 2341 2340 assert_mprog_count(target, 1); 2342 2341 2342 + tc_skel_reset_all_seen(skel); 2343 2343 ASSERT_OK(system(ping_cmd), ping_cmd); 2344 2344 2345 2345 ASSERT_EQ(skel->bss->seen_tc4, true, "seen_tc4"); 2346 2346 ASSERT_EQ(skel->bss->seen_tc5, true, "seen_tc5"); 2347 2347 ASSERT_EQ(skel->bss->seen_tc6, false, "seen_tc6"); 2348 2348 2349 - skel->bss->seen_tc4 = false; 2350 - skel->bss->seen_tc5 = false; 2351 - skel->bss->seen_tc6 = false; 2352 - 2353 2349 cleanup_opts: 2354 2350 err = bpf_prog_detach_opts(detach_fd, loopback, target, &optd); 2355 2351 ASSERT_OK(err, "prog_detach"); 2356 - __assert_mprog_count(target, 0, true, loopback); 2352 + assert_mprog_count(target, 0); 2357 2353 2354 + tc_skel_reset_all_seen(skel); 2358 2355 ASSERT_OK(system(ping_cmd), ping_cmd); 2359 2356 2360 2357 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4"); ··· 2460 2461 2461 2462 test_tc_opts_max_target(BPF_TCX_INGRESS, BPF_F_AFTER, true); 2462 2463 test_tc_opts_max_target(BPF_TCX_EGRESS, BPF_F_AFTER, false); 2464 + } 2465 + 2466 + static void test_tc_opts_query_target(int target) 2467 + { 2468 + const size_t attr_size = offsetofend(union bpf_attr, query); 2469 + LIBBPF_OPTS(bpf_prog_attach_opts, opta); 2470 + LIBBPF_OPTS(bpf_prog_detach_opts, optd); 2471 + LIBBPF_OPTS(bpf_prog_query_opts, optq); 2472 + __u32 fd1, fd2, fd3, fd4, id1, id2, id3, id4; 2473 + struct test_tc_link *skel; 2474 + union bpf_attr attr; 2475 + __u32 prog_ids[5]; 2476 + int err; 2477 + 2478 + skel = test_tc_link__open_and_load(); 2479 + if (!ASSERT_OK_PTR(skel, "skel_load")) 2480 + goto cleanup; 2481 + 2482 + fd1 = bpf_program__fd(skel->progs.tc1); 2483 + fd2 = bpf_program__fd(skel->progs.tc2); 2484 + fd3 = bpf_program__fd(skel->progs.tc3); 2485 + fd4 = bpf_program__fd(skel->progs.tc4); 2486 + 2487 + id1 = id_from_prog_fd(fd1); 2488 + id2 = id_from_prog_fd(fd2); 2489 + id3 = id_from_prog_fd(fd3); 2490 + id4 = id_from_prog_fd(fd4); 2491 + 2492 + assert_mprog_count(target, 0); 2493 + 2494 + LIBBPF_OPTS_RESET(opta, 2495 + .expected_revision = 1, 2496 + ); 2497 + 2498 + err = bpf_prog_attach_opts(fd1, loopback, target, &opta); 2499 + if (!ASSERT_EQ(err, 0, "prog_attach")) 2500 + goto cleanup; 2501 + 2502 + assert_mprog_count(target, 1); 2503 + 2504 + LIBBPF_OPTS_RESET(opta, 2505 + .expected_revision = 2, 2506 + ); 2507 + 2508 + err = bpf_prog_attach_opts(fd2, loopback, target, &opta); 2509 + if (!ASSERT_EQ(err, 0, "prog_attach")) 2510 + goto cleanup1; 2511 + 2512 + assert_mprog_count(target, 2); 2513 + 2514 + LIBBPF_OPTS_RESET(opta, 2515 + .expected_revision = 3, 2516 + ); 2517 + 2518 + err = bpf_prog_attach_opts(fd3, loopback, target, &opta); 2519 + if (!ASSERT_EQ(err, 0, "prog_attach")) 2520 + goto cleanup2; 2521 + 2522 + assert_mprog_count(target, 3); 2523 + 2524 + LIBBPF_OPTS_RESET(opta, 2525 + .expected_revision = 4, 2526 + ); 2527 + 2528 + err = bpf_prog_attach_opts(fd4, loopback, target, &opta); 2529 + if (!ASSERT_EQ(err, 0, "prog_attach")) 2530 + goto cleanup3; 2531 + 2532 + assert_mprog_count(target, 4); 2533 + 2534 + /* Test 1: Double query via libbpf API */ 2535 + err = bpf_prog_query_opts(loopback, target, &optq); 2536 + if (!ASSERT_OK(err, "prog_query")) 2537 + goto cleanup4; 2538 + 2539 + ASSERT_EQ(optq.count, 4, "count"); 2540 + ASSERT_EQ(optq.revision, 5, "revision"); 2541 + ASSERT_EQ(optq.prog_ids, NULL, "prog_ids"); 2542 + ASSERT_EQ(optq.link_ids, NULL, "link_ids"); 2543 + 2544 + memset(prog_ids, 0, sizeof(prog_ids)); 2545 + optq.prog_ids = prog_ids; 2546 + 2547 + err = bpf_prog_query_opts(loopback, target, &optq); 2548 + if (!ASSERT_OK(err, "prog_query")) 2549 + goto cleanup4; 2550 + 2551 + ASSERT_EQ(optq.count, 4, "count"); 2552 + ASSERT_EQ(optq.revision, 5, "revision"); 2553 + ASSERT_EQ(optq.prog_ids[0], id1, "prog_ids[0]"); 2554 + ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]"); 2555 + ASSERT_EQ(optq.prog_ids[2], id3, "prog_ids[2]"); 2556 + ASSERT_EQ(optq.prog_ids[3], id4, "prog_ids[3]"); 2557 + ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]"); 2558 + ASSERT_EQ(optq.link_ids, NULL, "link_ids"); 2559 + 2560 + /* Test 2: Double query via bpf_attr & bpf(2) directly */ 2561 + memset(&attr, 0, attr_size); 2562 + attr.query.target_ifindex = loopback; 2563 + attr.query.attach_type = target; 2564 + 2565 + err = syscall(__NR_bpf, BPF_PROG_QUERY, &attr, attr_size); 2566 + if (!ASSERT_OK(err, "prog_query")) 2567 + goto cleanup4; 2568 + 2569 + ASSERT_EQ(attr.query.count, 4, "count"); 2570 + ASSERT_EQ(attr.query.revision, 5, "revision"); 2571 + ASSERT_EQ(attr.query.query_flags, 0, "query_flags"); 2572 + ASSERT_EQ(attr.query.attach_flags, 0, "attach_flags"); 2573 + ASSERT_EQ(attr.query.target_ifindex, loopback, "target_ifindex"); 2574 + ASSERT_EQ(attr.query.attach_type, target, "attach_type"); 2575 + ASSERT_EQ(attr.query.prog_ids, 0, "prog_ids"); 2576 + ASSERT_EQ(attr.query.prog_attach_flags, 0, "prog_attach_flags"); 2577 + ASSERT_EQ(attr.query.link_ids, 0, "link_ids"); 2578 + ASSERT_EQ(attr.query.link_attach_flags, 0, "link_attach_flags"); 2579 + 2580 + memset(prog_ids, 0, sizeof(prog_ids)); 2581 + attr.query.prog_ids = ptr_to_u64(prog_ids); 2582 + 2583 + err = syscall(__NR_bpf, BPF_PROG_QUERY, &attr, attr_size); 2584 + if (!ASSERT_OK(err, "prog_query")) 2585 + goto cleanup4; 2586 + 2587 + ASSERT_EQ(attr.query.count, 4, "count"); 2588 + ASSERT_EQ(attr.query.revision, 5, "revision"); 2589 + ASSERT_EQ(attr.query.query_flags, 0, "query_flags"); 2590 + ASSERT_EQ(attr.query.attach_flags, 0, "attach_flags"); 2591 + ASSERT_EQ(attr.query.target_ifindex, loopback, "target_ifindex"); 2592 + ASSERT_EQ(attr.query.attach_type, target, "attach_type"); 2593 + ASSERT_EQ(attr.query.prog_ids, ptr_to_u64(prog_ids), "prog_ids"); 2594 + ASSERT_EQ(prog_ids[0], id1, "prog_ids[0]"); 2595 + ASSERT_EQ(prog_ids[1], id2, "prog_ids[1]"); 2596 + ASSERT_EQ(prog_ids[2], id3, "prog_ids[2]"); 2597 + ASSERT_EQ(prog_ids[3], id4, "prog_ids[3]"); 2598 + ASSERT_EQ(prog_ids[4], 0, "prog_ids[4]"); 2599 + ASSERT_EQ(attr.query.prog_attach_flags, 0, "prog_attach_flags"); 2600 + ASSERT_EQ(attr.query.link_ids, 0, "link_ids"); 2601 + ASSERT_EQ(attr.query.link_attach_flags, 0, "link_attach_flags"); 2602 + 2603 + cleanup4: 2604 + err = bpf_prog_detach_opts(fd4, loopback, target, &optd); 2605 + ASSERT_OK(err, "prog_detach"); 2606 + assert_mprog_count(target, 3); 2607 + 2608 + cleanup3: 2609 + err = bpf_prog_detach_opts(fd3, loopback, target, &optd); 2610 + ASSERT_OK(err, "prog_detach"); 2611 + assert_mprog_count(target, 2); 2612 + 2613 + cleanup2: 2614 + err = bpf_prog_detach_opts(fd2, loopback, target, &optd); 2615 + ASSERT_OK(err, "prog_detach"); 2616 + assert_mprog_count(target, 1); 2617 + 2618 + cleanup1: 2619 + err = bpf_prog_detach_opts(fd1, loopback, target, &optd); 2620 + ASSERT_OK(err, "prog_detach"); 2621 + assert_mprog_count(target, 0); 2622 + 2623 + cleanup: 2624 + test_tc_link__destroy(skel); 2625 + } 2626 + 2627 + void serial_test_tc_opts_query(void) 2628 + { 2629 + test_tc_opts_query_target(BPF_TCX_INGRESS); 2630 + test_tc_opts_query_target(BPF_TCX_EGRESS); 2631 + } 2632 + 2633 + static void test_tc_opts_query_attach_target(int target) 2634 + { 2635 + LIBBPF_OPTS(bpf_prog_attach_opts, opta); 2636 + LIBBPF_OPTS(bpf_prog_detach_opts, optd); 2637 + LIBBPF_OPTS(bpf_prog_query_opts, optq); 2638 + struct test_tc_link *skel; 2639 + __u32 prog_ids[2]; 2640 + __u32 fd1, id1; 2641 + int err; 2642 + 2643 + skel = test_tc_link__open_and_load(); 2644 + if (!ASSERT_OK_PTR(skel, "skel_load")) 2645 + goto cleanup; 2646 + 2647 + fd1 = bpf_program__fd(skel->progs.tc1); 2648 + id1 = id_from_prog_fd(fd1); 2649 + 2650 + err = bpf_prog_query_opts(loopback, target, &optq); 2651 + if (!ASSERT_OK(err, "prog_query")) 2652 + goto cleanup; 2653 + 2654 + ASSERT_EQ(optq.count, 0, "count"); 2655 + ASSERT_EQ(optq.revision, 1, "revision"); 2656 + 2657 + LIBBPF_OPTS_RESET(opta, 2658 + .expected_revision = optq.revision, 2659 + ); 2660 + 2661 + err = bpf_prog_attach_opts(fd1, loopback, target, &opta); 2662 + if (!ASSERT_EQ(err, 0, "prog_attach")) 2663 + goto cleanup; 2664 + 2665 + memset(prog_ids, 0, sizeof(prog_ids)); 2666 + optq.prog_ids = prog_ids; 2667 + optq.count = ARRAY_SIZE(prog_ids); 2668 + 2669 + err = bpf_prog_query_opts(loopback, target, &optq); 2670 + if (!ASSERT_OK(err, "prog_query")) 2671 + goto cleanup1; 2672 + 2673 + ASSERT_EQ(optq.count, 1, "count"); 2674 + ASSERT_EQ(optq.revision, 2, "revision"); 2675 + ASSERT_EQ(optq.prog_ids[0], id1, "prog_ids[0]"); 2676 + ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]"); 2677 + 2678 + cleanup1: 2679 + err = bpf_prog_detach_opts(fd1, loopback, target, &optd); 2680 + ASSERT_OK(err, "prog_detach"); 2681 + assert_mprog_count(target, 0); 2682 + cleanup: 2683 + test_tc_link__destroy(skel); 2684 + } 2685 + 2686 + void serial_test_tc_opts_query_attach(void) 2687 + { 2688 + test_tc_opts_query_attach_target(BPF_TCX_INGRESS); 2689 + test_tc_opts_query_attach_target(BPF_TCX_EGRESS); 2463 2690 }
+4 -2
tools/testing/selftests/bpf/prog_tests/timer.c
··· 2 2 /* Copyright (c) 2021 Facebook */ 3 3 #include <test_progs.h> 4 4 #include "timer.skel.h" 5 + #include "timer_failure.skel.h" 5 6 6 7 static int timer(struct timer *timer_skel) 7 8 { ··· 50 49 51 50 timer_skel = timer__open_and_load(); 52 51 if (!ASSERT_OK_PTR(timer_skel, "timer_skel_load")) 53 - goto cleanup; 52 + return; 54 53 55 54 err = timer(timer_skel); 56 55 ASSERT_OK(err, "timer"); 57 - cleanup: 58 56 timer__destroy(timer_skel); 57 + 58 + RUN_TESTS(timer_failure); 59 59 }
+47
tools/testing/selftests/bpf/progs/timer_failure.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */ 3 + 4 + #include <linux/bpf.h> 5 + #include <time.h> 6 + #include <errno.h> 7 + #include <bpf/bpf_helpers.h> 8 + #include "bpf_misc.h" 9 + #include "bpf_tcp_helpers.h" 10 + 11 + char _license[] SEC("license") = "GPL"; 12 + 13 + struct elem { 14 + struct bpf_timer t; 15 + }; 16 + 17 + struct { 18 + __uint(type, BPF_MAP_TYPE_ARRAY); 19 + __uint(max_entries, 1); 20 + __type(key, int); 21 + __type(value, struct elem); 22 + } timer_map SEC(".maps"); 23 + 24 + static int timer_cb_ret1(void *map, int *key, struct bpf_timer *timer) 25 + { 26 + if (bpf_get_smp_processor_id() % 2) 27 + return 1; 28 + else 29 + return 0; 30 + } 31 + 32 + SEC("fentry/bpf_fentry_test1") 33 + __failure __msg("should have been in (0x0; 0x0)") 34 + int BPF_PROG2(test_ret_1, int, a) 35 + { 36 + int key = 0; 37 + struct bpf_timer *timer; 38 + 39 + timer = bpf_map_lookup_elem(&timer_map, &key); 40 + if (timer) { 41 + bpf_timer_init(timer, &timer_map, CLOCK_BOOTTIME); 42 + bpf_timer_set_callback(timer, timer_cb_ret1); 43 + bpf_timer_start(timer, 1000, 0); 44 + } 45 + 46 + return 0; 47 + }