No conflicts.
Unified · Split
| @@ -126,6 +126,8 @@ Greg Kroah-Hartman <gregkh@suse.de> · 125 unmodified lines | ||
| 126 | 126 | Greg Kroah-Hartman <greg@kroah.com> |
| 127 | 127 | Greg Kurz <groug@kaod.org> <gkurz@linux.vnet.ibm.com> |
| 128 | 128 | Gregory CLEMENT <gregory.clement@bootlin.com> <gregory.clement@free-electrons.com> |
| 129 | +Guo Ren <guoren@kernel.org> <guoren@linux.alibaba.com> | |
| 130 | +Guo Ren <guoren@kernel.org> <ren_guo@c-sky.com> | |
| 129 | 131 | Gustavo Padovan <gustavo@las.ic.unicamp.br> |
| 130 | 132 | Gustavo Padovan <padovan@profusion.mobi> |
| 131 | 133 | Hanjun Guo <guohanjun@huawei.com> <hanjun.guo@linaro.org> |
| @@ -20,9 +20,9 @@ allOf: · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | properties: |
| 22 | 22 | compatible: |
| 23 | − enum: | |
| 24 | − - apple,t8103-i2c | |
| 25 | − - apple,i2c | |
| 23 | + items: | |
| 24 | + - const: apple,t8103-i2c | |
| 25 | + - const: apple,i2c | |
| 26 | 26 | |
| 27 | 27 | reg: |
| 28 | 28 | maxItems: 1 |
| @@ -51,7 +51,7 @@ unevaluatedProperties: false · 22 unmodified lines | ||
| 51 | 51 | examples: |
| 52 | 52 | - | |
| 53 | 53 | i2c@35010000 { |
| 54 | − compatible = "apple,t8103-i2c"; | |
| 54 | + compatible = "apple,t8103-i2c", "apple,i2c"; | |
| 55 | 55 | reg = <0x35010000 0x4000>; |
| 56 | 56 | interrupt-parent = <&aic>; |
| 57 | 57 | interrupts = <0 627 4>; |
| @@ -136,7 +136,7 @@ examples: · 135 unmodified lines | ||
| 136 | 136 | samsung,syscon-phandle = <&pmu_system_controller>; |
| 137 | 137 | |
| 138 | 138 | /* NTC thermistor is a hwmon device */ |
| 139 | − ncp15wb473 { | |
| 139 | + thermistor { | |
| 140 | 140 | compatible = "murata,ncp15wb473"; |
| 141 | 141 | pullup-uv = <1800000>; |
| 142 | 142 | pullup-ohm = <47000>; |
| @@ -142,7 +142,7 @@ examples: · 141 unmodified lines | ||
| 142 | 142 | down { |
| 143 | 143 | label = "GPIO Key DOWN"; |
| 144 | 144 | linux,code = <108>; |
| 145 | − interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; | |
| 145 | + interrupts = <1 IRQ_TYPE_EDGE_FALLING>; | |
| 146 | 146 | }; |
| 147 | 147 | }; |
| 148 | 148 | |
| @@ -79,6 +79,8 @@ properties: · 78 unmodified lines | ||
| 79 | 79 | |
| 80 | 80 | properties: |
| 81 | 81 | data-lanes: |
| 82 | + description: | |
| 83 | + Note that 'fsl,imx7-mipi-csi2' only supports up to 2 data lines. | |
| 82 | 84 | items: |
| 83 | 85 | minItems: 1 |
| 84 | 86 | maxItems: 4 |
| @@ -91,18 +93,6 @@ properties: · 6 unmodified lines | ||
| 91 | 93 | required: |
| 92 | 94 | - data-lanes |
| 93 | 95 | |
| 94 | − allOf: | |
| 95 | − - if: | |
| 96 | − properties: | |
| 97 | − compatible: | |
| 98 | − contains: | |
| 99 | − const: fsl,imx7-mipi-csi2 | |
| 100 | − then: | |
| 101 | − properties: | |
| 102 | − data-lanes: | |
| 103 | − items: | |
| 104 | − maxItems: 2 | |
| 105 | − | |
| 106 | 96 | port@1: |
| 107 | 97 | $ref: /schemas/graph.yaml#/properties/port |
| 108 | 98 | description: |
| @@ -91,6 +91,14 @@ properties: · 90 unmodified lines | ||
| 91 | 91 | compensate for the board being designed with the lanes |
| 92 | 92 | swapped. |
| 93 | 93 | |
| 94 | + enet-phy-lane-no-swap: | |
| 95 | + $ref: /schemas/types.yaml#/definitions/flag | |
| 96 | + description: | |
| 97 | + If set, indicates that PHY will disable swap of the | |
| 98 | + TX/RX lanes. This property allows the PHY to work correcly after | |
| 99 | + e.g. wrong bootstrap configuration caused by issues in PCB | |
| 100 | + layout design. | |
| 101 | + | |
| 94 | 102 | eee-broken-100tx: |
| 95 | 103 | $ref: /schemas/types.yaml#/definitions/flag |
| 96 | 104 | description: |
| @@ -29,7 +29,7 @@ properties: · 28 unmodified lines | ||
| 29 | 29 | - PHY_TYPE_PCIE |
| 30 | 30 | - PHY_TYPE_SATA |
| 31 | 31 | - PHY_TYPE_SGMII |
| 32 | − - PHY_TYPE_USB | |
| 32 | + - PHY_TYPE_USB3 | |
| 33 | 33 | - description: The PHY instance |
| 34 | 34 | minimum: 0 |
| 35 | 35 | maximum: 1 # for DP, SATA or USB |
| @@ -105,7 +105,7 @@ examples: · 104 unmodified lines | ||
| 105 | 105 | reg = <0x65>; |
| 106 | 106 | interrupt-parent = <&gpio1>; |
| 107 | 107 | interrupts = <16 IRQ_TYPE_EDGE_FALLING>; |
| 108 | − ti,watchdog-timer = <0>; | |
| 108 | + ti,watchdog-timeout-ms = <0>; | |
| 109 | 109 | ti,sc-ocp-limit-microamp = <2000000>; |
| 110 | 110 | ti,sc-ovp-limit-microvolt = <17800000>; |
| 111 | 111 | monitored-battery = <&bat>; |
| @@ -19,6 +19,9 @@ properties: · 18 unmodified lines | ||
| 19 | 19 | clocks: |
| 20 | 20 | maxItems: 1 |
| 21 | 21 | |
| 22 | + interrupts: | |
| 23 | + maxItems: 1 | |
| 24 | + | |
| 22 | 25 | "#sound-dai-cells": |
| 23 | 26 | const: 0 |
| 24 | 27 | |
| @@ -440,6 +440,22 @@ NOTE: For 82599-based network connections, if you are enabling jumbo frames in · 439 unmodified lines | ||
| 440 | 440 | a virtual function (VF), jumbo frames must first be enabled in the physical |
| 441 | 441 | function (PF). The VF MTU setting cannot be larger than the PF MTU. |
| 442 | 442 | |
| 443 | +NBASE-T Support | |
| 444 | +--------------- | |
| 445 | +The ixgbe driver supports NBASE-T on some devices. However, the advertisement | |
| 446 | +of NBASE-T speeds is suppressed by default, to accommodate broken network | |
| 447 | +switches which cannot cope with advertised NBASE-T speeds. Use the ethtool | |
| 448 | +command to enable advertising NBASE-T speeds on devices which support it:: | |
| 449 | + | |
| 450 | + ethtool -s eth? advertise 0x1800000001028 | |
| 451 | + | |
| 452 | +On Linux systems with INTERFACES(5), this can be specified as a pre-up command | |
| 453 | +in /etc/network/interfaces so that the interface is always brought up with | |
| 454 | +NBASE-T support, e.g.:: | |
| 455 | + | |
| 456 | + iface eth? inet dhcp | |
| 457 | + pre-up ethtool -s eth? advertise 0x1800000001028 || true | |
| 458 | + | |
| 443 | 459 | Generic Receive Offload, aka GRO |
| 444 | 460 | -------------------------------- |
| 445 | 461 | The driver supports the in-kernel software implementation of GRO. GRO has |
| @@ -3066,7 +3066,7 @@ F: Documentation/devicetree/bindings/phy/phy-ath79-usb.txt · 3065 unmodified lines | ||
| 3066 | 3066 | F: drivers/phy/qualcomm/phy-ath79-usb.c |
| 3067 | 3067 | |
| 3068 | 3068 | ATHEROS ATH GENERIC UTILITIES |
| 3069 | −M: Kalle Valo <kvalo@codeaurora.org> | |
| 3069 | +M: Kalle Valo <kvalo@kernel.org> | |
| 3070 | 3070 | L: linux-wireless@vger.kernel.org |
| 3071 | 3071 | S: Supported |
| 3072 | 3072 | F: drivers/net/wireless/ath/* |
| @@ -3081,7 +3081,7 @@ W: https://wireless.wiki.kernel.org/en/users/Drivers/ath5k · 8 unmodified lines | ||
| 3081 | 3081 | F: drivers/net/wireless/ath/ath5k/ |
| 3082 | 3082 | |
| 3083 | 3083 | ATHEROS ATH6KL WIRELESS DRIVER |
| 3084 | −M: Kalle Valo <kvalo@codeaurora.org> | |
| 3084 | +M: Kalle Valo <kvalo@kernel.org> | |
| 3085 | 3085 | L: linux-wireless@vger.kernel.org |
| 3086 | 3086 | S: Supported |
| 3087 | 3087 | W: https://wireless.wiki.kernel.org/en/users/Drivers/ath6kl |
| @@ -9329,7 +9329,6 @@ S: Maintained · 6241 unmodified lines | ||
| 9329 | 9329 | F: drivers/iio/pressure/dps310.c |
| 9330 | 9330 | |
| 9331 | 9331 | INFINIBAND SUBSYSTEM |
| 9332 | −M: Doug Ledford <dledford@redhat.com> | |
| 9333 | 9332 | M: Jason Gunthorpe <jgg@nvidia.com> |
| 9334 | 9333 | L: linux-rdma@vger.kernel.org |
| 9335 | 9334 | S: Supported |
| @@ -10280,9 +10279,9 @@ F: lib/Kconfig.kcsan · 944 unmodified lines | ||
| 10280 | 10279 | F: scripts/Makefile.kcsan |
| 10281 | 10280 | |
| 10282 | 10281 | KDUMP |
| 10283 | −M: Dave Young <dyoung@redhat.com> | |
| 10284 | 10282 | M: Baoquan He <bhe@redhat.com> |
| 10285 | 10283 | R: Vivek Goyal <vgoyal@redhat.com> |
| 10284 | +R: Dave Young <dyoung@redhat.com> | |
| 10286 | 10285 | L: kexec@lists.infradead.org |
| 10287 | 10286 | S: Maintained |
| 10288 | 10287 | W: http://lse.sourceforge.net/kdump/ |
| @@ -13256,7 +13255,7 @@ F: include/uapi/linux/if_* · 2967 unmodified lines | ||
| 13256 | 13255 | F: include/uapi/linux/netdevice.h |
| 13257 | 13256 | |
| 13258 | 13257 | NETWORKING DRIVERS (WIRELESS) |
| 13259 | −M: Kalle Valo <kvalo@codeaurora.org> | |
| 13258 | +M: Kalle Valo <kvalo@kernel.org> | |
| 13260 | 13259 | L: linux-wireless@vger.kernel.org |
| 13261 | 13260 | S: Maintained |
| 13262 | 13261 | Q: http://patchwork.kernel.org/project/linux-wireless/list/ |
| @@ -15712,7 +15711,7 @@ T: git git://linuxtv.org/anttip/media_tree.git · 2449 unmodified lines | ||
| 15712 | 15711 | F: drivers/media/tuners/qt1010* |
| 15713 | 15712 | |
| 15714 | 15713 | QUALCOMM ATHEROS ATH10K WIRELESS DRIVER |
| 15715 | −M: Kalle Valo <kvalo@codeaurora.org> | |
| 15714 | +M: Kalle Valo <kvalo@kernel.org> | |
| 15716 | 15715 | L: ath10k@lists.infradead.org |
| 15717 | 15716 | S: Supported |
| 15718 | 15717 | W: https://wireless.wiki.kernel.org/en/users/Drivers/ath10k |
| @@ -15720,7 +15719,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git · 1 unmodified line | ||
| 15720 | 15719 | F: drivers/net/wireless/ath/ath10k/ |
| 15721 | 15720 | |
| 15722 | 15721 | QUALCOMM ATHEROS ATH11K WIRELESS DRIVER |
| 15723 | −M: Kalle Valo <kvalo@codeaurora.org> | |
| 15722 | +M: Kalle Valo <kvalo@kernel.org> | |
| 15724 | 15723 | L: ath11k@lists.infradead.org |
| 15725 | 15724 | S: Supported |
| 15726 | 15725 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git |
| @@ -15786,6 +15785,15 @@ S: Maintained · 59 unmodified lines | ||
| 15786 | 15785 | F: Documentation/devicetree/bindings/net/qcom,ethqos.txt |
| 15787 | 15786 | F: drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c |
| 15788 | 15787 | |
| 15788 | +QUALCOMM FASTRPC DRIVER | |
| 15789 | +M: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | |
| 15790 | +M: Amol Maheshwari <amahesh@qti.qualcomm.com> | |
| 15791 | +L: linux-arm-msm@vger.kernel.org | |
| 15792 | +S: Maintained | |
| 15793 | +F: Documentation/devicetree/bindings/misc/qcom,fastrpc.txt | |
| 15794 | +F: drivers/misc/fastrpc.c | |
| 15795 | +F: include/uapi/misc/fastrpc.h | |
| 15796 | + | |
| 15789 | 15797 | QUALCOMM GENERIC INTERFACE I2C DRIVER |
| 15790 | 15798 | M: Akash Asthana <akashast@codeaurora.org> |
| 15791 | 15799 | M: Mukesh Savaliya <msavaliy@codeaurora.org> |
| @@ -15892,7 +15900,7 @@ F: Documentation/devicetree/bindings/media/*venus* · 100 unmodified lines | ||
| 15892 | 15900 | F: drivers/media/platform/qcom/venus/ |
| 15893 | 15901 | |
| 15894 | 15902 | QUALCOMM WCN36XX WIRELESS DRIVER |
| 15895 | −M: Kalle Valo <kvalo@codeaurora.org> | |
| 15903 | +M: Kalle Valo <kvalo@kernel.org> | |
| 15896 | 15904 | L: wcn36xx@lists.infradead.org |
| 15897 | 15905 | S: Supported |
| 15898 | 15906 | W: https://wireless.wiki.kernel.org/en/users/Drivers/wcn36xx |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | VERSION = 5 |
| 3 | 3 | PATCHLEVEL = 16 |
| 4 | 4 | SUBLEVEL = 0 |
| 5 | −EXTRAVERSION = -rc4 | |
| 5 | +EXTRAVERSION = -rc5 | |
| 6 | 6 | NAME = Gobble Gobble |
| 7 | 7 | |
| 8 | 8 | # *DOCUMENTATION* |
| @@ -1374,17 +1374,17 @@ endif · 1365 unmodified lines | ||
| 1374 | 1374 | |
| 1375 | 1375 | ifneq ($(dtstree),) |
| 1376 | 1376 | |
| 1377 | −%.dtb: dt_binding_check include/config/kernel.release scripts_dtc | |
| 1378 | − $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ $(dtstree)/$*.dt.yaml | |
| 1377 | +%.dtb: include/config/kernel.release scripts_dtc | |
| 1378 | + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ | |
| 1379 | 1379 | |
| 1380 | −%.dtbo: dt_binding_check include/config/kernel.release scripts_dtc | |
| 1381 | − $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ $(dtstree)/$*.dt.yaml | |
| 1380 | +%.dtbo: include/config/kernel.release scripts_dtc | |
| 1381 | + $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ | |
| 1382 | 1382 | |
| 1383 | 1383 | PHONY += dtbs dtbs_install dtbs_check |
| 1384 | 1384 | dtbs: include/config/kernel.release scripts_dtc |
| 1385 | 1385 | $(Q)$(MAKE) $(build)=$(dtstree) |
| 1386 | 1386 | |
| 1387 | −ifneq ($(filter dtbs_check %.dtb %.dtbo, $(MAKECMDGOALS)),) | |
| 1387 | +ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) | |
| 1388 | 1388 | export CHECK_DTBS=y |
| 1389 | 1389 | dtbs: dt_binding_check |
| 1390 | 1390 | endif |
| @@ -178,6 +178,8 @@ · 177 unmodified lines | ||
| 178 | 178 | label = "cpu"; |
| 179 | 179 | ethernet = <&fec>; |
| 180 | 180 | phy-mode = "rgmii-id"; |
| 181 | + rx-internal-delay-ps = <2000>; | |
| 182 | + tx-internal-delay-ps = <2000>; | |
| 181 | 183 | |
| 182 | 184 | fixed-link { |
| 183 | 185 | speed = <100>; |
| @@ -82,6 +82,6 @@ · 81 unmodified lines | ||
| 82 | 82 | #define MX6ULL_PAD_CSI_DATA04__ESAI_TX_FS 0x01F4 0x0480 0x0000 0x9 0x0 |
| 83 | 83 | #define MX6ULL_PAD_CSI_DATA05__ESAI_TX_CLK 0x01F8 0x0484 0x0000 0x9 0x0 |
| 84 | 84 | #define MX6ULL_PAD_CSI_DATA06__ESAI_TX5_RX0 0x01FC 0x0488 0x0000 0x9 0x0 |
| 85 | −#define MX6ULL_PAD_CSI_DATA07__ESAI_T0 0x0200 0x048C 0x0000 0x9 0x0 | |
| 85 | +#define MX6ULL_PAD_CSI_DATA07__ESAI_TX0 0x0200 0x048C 0x0000 0x9 0x0 | |
| 86 | 86 | |
| 87 | 87 | #endif /* __DTS_IMX6ULL_PINFUNC_H */ |
| @@ -91,6 +91,8 @@ · 90 unmodified lines | ||
| 91 | 91 | /* Internal port connected to eth2 */ |
| 92 | 92 | ethernet = <&enet2>; |
| 93 | 93 | phy-mode = "rgmii"; |
| 94 | + rx-internal-delay-ps = <0>; | |
| 95 | + tx-internal-delay-ps = <0>; | |
| 94 | 96 | reg = <4>; |
| 95 | 97 | |
| 96 | 98 | fixed-link { |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | flash0: n25q00@0 { |
| 13 | 13 | #address-cells = <1>; |
| 14 | 14 | #size-cells = <1>; |
| 15 | − compatible = "n25q00aa"; | |
| 15 | + compatible = "micron,mt25qu02g", "jedec,spi-nor"; | |
| 16 | 16 | reg = <0>; |
| 17 | 17 | spi-max-frequency = <100000000>; |
| 18 | 18 | |
| @@ -119,7 +119,7 @@ · 118 unmodified lines | ||
| 119 | 119 | flash: flash@0 { |
| 120 | 120 | #address-cells = <1>; |
| 121 | 121 | #size-cells = <1>; |
| 122 | − compatible = "n25q256a"; | |
| 122 | + compatible = "micron,n25q256a", "jedec,spi-nor"; | |
| 123 | 123 | reg = <0>; |
| 124 | 124 | spi-max-frequency = <100000000>; |
| 125 | 125 | |
| @@ -124,7 +124,7 @@ · 123 unmodified lines | ||
| 124 | 124 | flash0: n25q00@0 { |
| 125 | 125 | #address-cells = <1>; |
| 126 | 126 | #size-cells = <1>; |
| 127 | − compatible = "n25q00"; | |
| 127 | + compatible = "micron,mt25qu02g", "jedec,spi-nor"; | |
| 128 | 128 | reg = <0>; /* chip select */ |
| 129 | 129 | spi-max-frequency = <100000000>; |
| 130 | 130 | |
| @@ -169,7 +169,7 @@ · 168 unmodified lines | ||
| 169 | 169 | flash: flash@0 { |
| 170 | 170 | #address-cells = <1>; |
| 171 | 171 | #size-cells = <1>; |
| 172 | − compatible = "n25q00"; | |
| 172 | + compatible = "micron,mt25qu02g", "jedec,spi-nor"; | |
| 173 | 173 | reg = <0>; |
| 174 | 174 | spi-max-frequency = <100000000>; |
| 175 | 175 | |
| @@ -80,7 +80,7 @@ · 79 unmodified lines | ||
| 80 | 80 | flash: flash@0 { |
| 81 | 81 | #address-cells = <1>; |
| 82 | 82 | #size-cells = <1>; |
| 83 | − compatible = "n25q256a"; | |
| 83 | + compatible = "micron,n25q256a", "jedec,spi-nor"; | |
| 84 | 84 | reg = <0>; |
| 85 | 85 | spi-max-frequency = <100000000>; |
| 86 | 86 | m25p,fast-read; |
| @@ -116,7 +116,7 @@ · 115 unmodified lines | ||
| 116 | 116 | flash0: n25q512a@0 { |
| 117 | 117 | #address-cells = <1>; |
| 118 | 118 | #size-cells = <1>; |
| 119 | − compatible = "n25q512a"; | |
| 119 | + compatible = "micron,n25q512a", "jedec,spi-nor"; | |
| 120 | 120 | reg = <0>; |
| 121 | 121 | spi-max-frequency = <100000000>; |
| 122 | 122 | |
| @@ -224,7 +224,7 @@ · 223 unmodified lines | ||
| 224 | 224 | n25q128@0 { |
| 225 | 225 | #address-cells = <1>; |
| 226 | 226 | #size-cells = <1>; |
| 227 | − compatible = "n25q128"; | |
| 227 | + compatible = "micron,n25q128", "jedec,spi-nor"; | |
| 228 | 228 | reg = <0>; /* chip select */ |
| 229 | 229 | spi-max-frequency = <100000000>; |
| 230 | 230 | m25p,fast-read; |
| @@ -241,7 +241,7 @@ · 10 unmodified lines | ||
| 241 | 241 | n25q00@1 { |
| 242 | 242 | #address-cells = <1>; |
| 243 | 243 | #size-cells = <1>; |
| 244 | − compatible = "n25q00"; | |
| 244 | + compatible = "micron,mt25qu02g", "jedec,spi-nor"; | |
| 245 | 245 | reg = <1>; /* chip select */ |
| 246 | 246 | spi-max-frequency = <100000000>; |
| 247 | 247 | m25p,fast-read; |
| @@ -189,7 +189,7 @@ static int __init rockchip_smp_prepare_sram(struct device_node *node) · 188 unmodified lines | ||
| 189 | 189 | rockchip_boot_fn = __pa_symbol(secondary_startup); |
| 190 | 190 | |
| 191 | 191 | /* copy the trampoline to sram, that runs during startup of the core */ |
| 192 | − memcpy(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz); | |
| 192 | + memcpy_toio(sram_base_addr, &rockchip_secondary_trampoline, trampoline_sz); | |
| 193 | 193 | flush_cache_all(); |
| 194 | 194 | outer_clean_range(0, trampoline_sz); |
| 195 | 195 | |
| @@ -161,7 +161,6 @@ config ARCH_MEDIATEK · 160 unmodified lines | ||
| 161 | 161 | |
| 162 | 162 | config ARCH_MESON |
| 163 | 163 | bool "Amlogic Platforms" |
| 164 | − select COMMON_CLK | |
| 165 | 164 | help |
| 166 | 165 | This enables support for the arm64 based Amlogic SoCs |
| 167 | 166 | such as the s905, S905X/D, S912, A113X/D or S905X/D2 |
| @@ -134,23 +134,23 @@ · 133 unmodified lines | ||
| 134 | 134 | type = "critical"; |
| 135 | 135 | }; |
| 136 | 136 | }; |
| 137 | − }; | |
| 138 | 137 | |
| 139 | − cpu_cooling_maps: cooling-maps { | |
| 140 | − map0 { | |
| 141 | − trip = <&cpu_passive>; | |
| 142 | − cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 143 | − <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 144 | − <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 145 | − <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; | |
| 146 | − }; | |
| 138 | + cpu_cooling_maps: cooling-maps { | |
| 139 | + map0 { | |
| 140 | + trip = <&cpu_passive>; | |
| 141 | + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 142 | + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 143 | + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 144 | + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; | |
| 145 | + }; | |
| 147 | 146 | |
| 148 | − map1 { | |
| 149 | − trip = <&cpu_hot>; | |
| 150 | − cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 151 | − <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 152 | − <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 153 | − <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; | |
| 147 | + map1 { | |
| 148 | + trip = <&cpu_hot>; | |
| 149 | + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 150 | + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 151 | + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, | |
| 152 | + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; | |
| 153 | + }; | |
| 154 | 154 | }; |
| 155 | 155 | }; |
| 156 | 156 | }; |
| @@ -60,7 +60,7 @@ · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | &port02 { |
| 62 | 62 | bus-range = <3 3>; |
| 63 | − ethernet0: pci@0,0 { | |
| 63 | + ethernet0: ethernet@0,0 { | |
| 64 | 64 | reg = <0x30000 0x0 0x0 0x0 0x0>; |
| 65 | 65 | /* To be filled by the loader */ |
| 66 | 66 | local-mac-address = [00 10 18 00 00 00]; |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | * Copyright The Asahi Linux Contributors |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | +#include <dt-bindings/gpio/gpio.h> | |
| 10 | 11 | #include <dt-bindings/interrupt-controller/apple-aic.h> |
| 11 | 12 | #include <dt-bindings/interrupt-controller/irq.h> |
| 12 | 13 | #include <dt-bindings/pinctrl/apple.h> |
| @@ -143,6 +144,7 @@ · 130 unmodified lines | ||
| 143 | 144 | apple,npins = <212>; |
| 144 | 145 | |
| 145 | 146 | interrupt-controller; |
| 147 | + #interrupt-cells = <2>; | |
| 146 | 148 | interrupt-parent = <&aic>; |
| 147 | 149 | interrupts = <AIC_IRQ 190 IRQ_TYPE_LEVEL_HIGH>, |
| 148 | 150 | <AIC_IRQ 191 IRQ_TYPE_LEVEL_HIGH>, |
| @@ -169,6 +171,7 @@ · 20 unmodified lines | ||
| 169 | 171 | apple,npins = <42>; |
| 170 | 172 | |
| 171 | 173 | interrupt-controller; |
| 174 | + #interrupt-cells = <2>; | |
| 172 | 175 | interrupt-parent = <&aic>; |
| 173 | 176 | interrupts = <AIC_IRQ 268 IRQ_TYPE_LEVEL_HIGH>, |
| 174 | 177 | <AIC_IRQ 269 IRQ_TYPE_LEVEL_HIGH>, |
| @@ -189,6 +192,7 @@ · 14 unmodified lines | ||
| 189 | 192 | apple,npins = <23>; |
| 190 | 193 | |
| 191 | 194 | interrupt-controller; |
| 195 | + #interrupt-cells = <2>; | |
| 192 | 196 | interrupt-parent = <&aic>; |
| 193 | 197 | interrupts = <AIC_IRQ 330 IRQ_TYPE_LEVEL_HIGH>, |
| 194 | 198 | <AIC_IRQ 331 IRQ_TYPE_LEVEL_HIGH>, |
| @@ -209,6 +213,7 @@ · 14 unmodified lines | ||
| 209 | 213 | apple,npins = <16>; |
| 210 | 214 | |
| 211 | 215 | interrupt-controller; |
| 216 | + #interrupt-cells = <2>; | |
| 212 | 217 | interrupt-parent = <&aic>; |
| 213 | 218 | interrupts = <AIC_IRQ 391 IRQ_TYPE_LEVEL_HIGH>, |
| 214 | 219 | <AIC_IRQ 392 IRQ_TYPE_LEVEL_HIGH>, |
| @@ -281,7 +286,7 @@ · 66 unmodified lines | ||
| 281 | 286 | port00: pci@0,0 { |
| 282 | 287 | device_type = "pci"; |
| 283 | 288 | reg = <0x0 0x0 0x0 0x0 0x0>; |
| 284 | − reset-gpios = <&pinctrl_ap 152 0>; | |
| 289 | + reset-gpios = <&pinctrl_ap 152 GPIO_ACTIVE_LOW>; | |
| 285 | 290 | max-link-speed = <2>; |
| 286 | 291 | |
| 287 | 292 | #address-cells = <3>; |
| @@ -301,7 +306,7 @@ · 13 unmodified lines | ||
| 301 | 306 | port01: pci@1,0 { |
| 302 | 307 | device_type = "pci"; |
| 303 | 308 | reg = <0x800 0x0 0x0 0x0 0x0>; |
| 304 | − reset-gpios = <&pinctrl_ap 153 0>; | |
| 309 | + reset-gpios = <&pinctrl_ap 153 GPIO_ACTIVE_LOW>; | |
| 305 | 310 | max-link-speed = <2>; |
| 306 | 311 | |
| 307 | 312 | #address-cells = <3>; |
| @@ -321,7 +326,7 @@ · 13 unmodified lines | ||
| 321 | 326 | port02: pci@2,0 { |
| 322 | 327 | device_type = "pci"; |
| 323 | 328 | reg = <0x1000 0x0 0x0 0x0 0x0>; |
| 324 | − reset-gpios = <&pinctrl_ap 33 0>; | |
| 329 | + reset-gpios = <&pinctrl_ap 33 GPIO_ACTIVE_LOW>; | |
| 325 | 330 | max-link-speed = <1>; |
| 326 | 331 | |
| 327 | 332 | #address-cells = <3>; |
| @@ -38,7 +38,6 @@ · 37 unmodified lines | ||
| 38 | 38 | powerdn { |
| 39 | 39 | label = "External Power Down"; |
| 40 | 40 | gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; |
| 41 | − interrupts = <&gpio1 17 IRQ_TYPE_EDGE_FALLING>; | |
| 42 | 41 | linux,code = <KEY_POWER>; |
| 43 | 42 | }; |
| 44 | 43 | |
| @@ -46,7 +45,6 @@ · 1 unmodified line | ||
| 46 | 45 | admin { |
| 47 | 46 | label = "ADMIN button"; |
| 48 | 47 | gpios = <&gpio3 8 GPIO_ACTIVE_HIGH>; |
| 49 | − interrupts = <&gpio3 8 IRQ_TYPE_EDGE_RISING>; | |
| 50 | 48 | linux,code = <KEY_WPS_BUTTON>; |
| 51 | 49 | }; |
| 52 | 50 | }; |
| @@ -386,6 +386,8 @@ · 385 unmodified lines | ||
| 386 | 386 | reg = <2>; |
| 387 | 387 | ethernet = <&dpmac17>; |
| 388 | 388 | phy-mode = "rgmii-id"; |
| 389 | + rx-internal-delay-ps = <2000>; | |
| 390 | + tx-internal-delay-ps = <2000>; | |
| 389 | 391 | |
| 390 | 392 | fixed-link { |
| 391 | 393 | speed = <1000>; |
| @@ -529,6 +531,8 @@ · 137 unmodified lines | ||
| 529 | 531 | reg = <2>; |
| 530 | 532 | ethernet = <&dpmac18>; |
| 531 | 533 | phy-mode = "rgmii-id"; |
| 534 | + rx-internal-delay-ps = <2000>; | |
| 535 | + tx-internal-delay-ps = <2000>; | |
| 532 | 536 | |
| 533 | 537 | fixed-link { |
| 534 | 538 | speed = <1000>; |
| @@ -524,8 +524,6 @@ · 523 unmodified lines | ||
| 524 | 524 | <&clk IMX8MQ_VIDEO_PLL1>, |
| 525 | 525 | <&clk IMX8MQ_VIDEO_PLL1_OUT>; |
| 526 | 526 | assigned-clock-rates = <0>, <0>, <0>, <594000000>; |
| 527 | − interconnects = <&noc IMX8MQ_ICM_LCDIF &noc IMX8MQ_ICS_DRAM>; | |
| 528 | − interconnect-names = "dram"; | |
| 529 | 527 | status = "disabled"; |
| 530 | 528 | |
| 531 | 529 | port@0 { |
| @@ -97,7 +97,7 @@ · 96 unmodified lines | ||
| 97 | 97 | regulator-max-microvolt = <3300000>; |
| 98 | 98 | regulator-always-on; |
| 99 | 99 | regulator-boot-on; |
| 100 | − vim-supply = <&vcc_io>; | |
| 100 | + vin-supply = <&vcc_io>; | |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | 103 | vdd_core: vdd-core { |
| @@ -705,7 +705,6 @@ · 704 unmodified lines | ||
| 705 | 705 | &sdhci { |
| 706 | 706 | bus-width = <8>; |
| 707 | 707 | mmc-hs400-1_8v; |
| 708 | − mmc-hs400-enhanced-strobe; | |
| 709 | 708 | non-removable; |
| 710 | 709 | status = "okay"; |
| 711 | 710 | }; |
| @@ -276,6 +276,7 @@ · 275 unmodified lines | ||
| 276 | 276 | clock-output-names = "xin32k", "rk808-clkout2"; |
| 277 | 277 | pinctrl-names = "default"; |
| 278 | 278 | pinctrl-0 = <&pmic_int_l>; |
| 279 | + rockchip,system-power-controller; | |
| 279 | 280 | vcc1-supply = <&vcc5v0_sys>; |
| 280 | 281 | vcc2-supply = <&vcc5v0_sys>; |
| 281 | 282 | vcc3-supply = <&vcc5v0_sys>; |
| @@ -55,7 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | regulator-boot-on; |
| 56 | 56 | regulator-min-microvolt = <3300000>; |
| 57 | 57 | regulator-max-microvolt = <3300000>; |
| 58 | − vim-supply = <&vcc3v3_sys>; | |
| 58 | + vin-supply = <&vcc3v3_sys>; | |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | 61 | vcc3v3_sys: vcc3v3-sys { |
| @@ -502,7 +502,7 @@ · 501 unmodified lines | ||
| 502 | 502 | status = "okay"; |
| 503 | 503 | |
| 504 | 504 | bt656-supply = <&vcc_3v0>; |
| 505 | − audio-supply = <&vcc_3v0>; | |
| 505 | + audio-supply = <&vcc1v8_codec>; | |
| 506 | 506 | sdmmc-supply = <&vcc_sdio>; |
| 507 | 507 | gpio1830-supply = <&vcc_3v0>; |
| 508 | 508 | }; |
| @@ -149,6 +149,7 @@ int load_other_segments(struct kimage *image, · 148 unmodified lines | ||
| 149 | 149 | initrd_len, cmdline, 0); |
| 150 | 150 | if (!dtb) { |
| 151 | 151 | pr_err("Preparing for new dtb failed\n"); |
| 152 | + ret = -EINVAL; | |
| 152 | 153 | goto out_err; |
| 153 | 154 | } |
| 154 | 155 | |
| @@ -209,7 +209,7 @@ asmlinkage void do_trap_illinsn(struct pt_regs *regs) · 208 unmodified lines | ||
| 209 | 209 | |
| 210 | 210 | asmlinkage void do_trap_fpe(struct pt_regs *regs) |
| 211 | 211 | { |
| 212 | −#ifdef CONFIG_CPU_HAS_FP | |
| 212 | +#ifdef CONFIG_CPU_HAS_FPU | |
| 213 | 213 | return fpu_fpe(regs); |
| 214 | 214 | #else |
| 215 | 215 | do_trap_error(regs, SIGILL, ILL_ILLOPC, regs->pc, |
| @@ -219,7 +219,7 @@ asmlinkage void do_trap_fpe(struct pt_regs *regs) · 3 unmodified lines | ||
| 219 | 219 | |
| 220 | 220 | asmlinkage void do_trap_priv(struct pt_regs *regs) |
| 221 | 221 | { |
| 222 | −#ifdef CONFIG_CPU_HAS_FP | |
| 222 | +#ifdef CONFIG_CPU_HAS_FPU | |
| 223 | 223 | if (user_mode(regs) && fpu_libc_helper(regs)) |
| 224 | 224 | return; |
| 225 | 225 | #endif |
| @@ -117,6 +117,7 @@ CONFIG_UNIX=y · 116 unmodified lines | ||
| 117 | 117 | CONFIG_UNIX_DIAG=m |
| 118 | 118 | CONFIG_XFRM_USER=m |
| 119 | 119 | CONFIG_NET_KEY=m |
| 120 | +CONFIG_NET_SWITCHDEV=y | |
| 120 | 121 | CONFIG_SMC=m |
| 121 | 122 | CONFIG_SMC_DIAG=m |
| 122 | 123 | CONFIG_INET=y |
| @@ -511,6 +512,7 @@ CONFIG_NLMON=m · 388 unmodified lines | ||
| 511 | 512 | CONFIG_MLX4_EN=m |
| 512 | 513 | CONFIG_MLX5_CORE=m |
| 513 | 514 | CONFIG_MLX5_CORE_EN=y |
| 515 | +CONFIG_MLX5_ESWITCH=y | |
| 514 | 516 | # CONFIG_NET_VENDOR_MICREL is not set |
| 515 | 517 | # CONFIG_NET_VENDOR_MICROCHIP is not set |
| 516 | 518 | # CONFIG_NET_VENDOR_MICROSEMI is not set |
| @@ -109,6 +109,7 @@ CONFIG_UNIX=y · 108 unmodified lines | ||
| 109 | 109 | CONFIG_UNIX_DIAG=m |
| 110 | 110 | CONFIG_XFRM_USER=m |
| 111 | 111 | CONFIG_NET_KEY=m |
| 112 | +CONFIG_NET_SWITCHDEV=y | |
| 112 | 113 | CONFIG_SMC=m |
| 113 | 114 | CONFIG_SMC_DIAG=m |
| 114 | 115 | CONFIG_INET=y |
| @@ -502,6 +503,7 @@ CONFIG_NLMON=m · 387 unmodified lines | ||
| 502 | 503 | CONFIG_MLX4_EN=m |
| 503 | 504 | CONFIG_MLX5_CORE=m |
| 504 | 505 | CONFIG_MLX5_CORE_EN=y |
| 506 | +CONFIG_MLX5_ESWITCH=y | |
| 505 | 507 | # CONFIG_NET_VENDOR_MICREL is not set |
| 506 | 508 | # CONFIG_NET_VENDOR_MICROCHIP is not set |
| 507 | 509 | # CONFIG_NET_VENDOR_MICROSEMI is not set |
| @@ -290,7 +290,6 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, · 289 unmodified lines | ||
| 290 | 290 | return; |
| 291 | 291 | |
| 292 | 292 | regs = ftrace_get_regs(fregs); |
| 293 | − preempt_disable_notrace(); | |
| 294 | 293 | p = get_kprobe((kprobe_opcode_t *)ip); |
| 295 | 294 | if (unlikely(!p) || kprobe_disabled(p)) |
| 296 | 295 | goto out; |
| @@ -318,7 +317,6 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, · 21 unmodified lines | ||
| 318 | 317 | } |
| 319 | 318 | __this_cpu_write(current_kprobe, NULL); |
| 320 | 319 | out: |
| 321 | − preempt_enable_notrace(); | |
| 322 | 320 | ftrace_test_recursion_unlock(bit); |
| 323 | 321 | } |
| 324 | 322 | NOKPROBE_SYMBOL(kprobe_ftrace_handler); |
| @@ -138,7 +138,7 @@ void noinstr do_io_irq(struct pt_regs *regs) · 137 unmodified lines | ||
| 138 | 138 | struct pt_regs *old_regs = set_irq_regs(regs); |
| 139 | 139 | int from_idle; |
| 140 | 140 | |
| 141 | − irq_enter(); | |
| 141 | + irq_enter_rcu(); | |
| 142 | 142 | |
| 143 | 143 | if (user_mode(regs)) { |
| 144 | 144 | update_timer_sys(); |
| @@ -158,7 +158,8 @@ void noinstr do_io_irq(struct pt_regs *regs) · 13 unmodified lines | ||
| 158 | 158 | do_irq_async(regs, IO_INTERRUPT); |
| 159 | 159 | } while (MACHINE_IS_LPAR && irq_pending(regs)); |
| 160 | 160 | |
| 161 | − irq_exit(); | |
| 161 | + irq_exit_rcu(); | |
| 162 | + | |
| 162 | 163 | set_irq_regs(old_regs); |
| 163 | 164 | irqentry_exit(regs, state); |
| 164 | 165 | |
| @@ -172,7 +173,7 @@ void noinstr do_ext_irq(struct pt_regs *regs) · 7 unmodified lines | ||
| 172 | 173 | struct pt_regs *old_regs = set_irq_regs(regs); |
| 173 | 174 | int from_idle; |
| 174 | 175 | |
| 175 | − irq_enter(); | |
| 176 | + irq_enter_rcu(); | |
| 176 | 177 | |
| 177 | 178 | if (user_mode(regs)) { |
| 178 | 179 | update_timer_sys(); |
| @@ -190,7 +191,7 @@ void noinstr do_ext_irq(struct pt_regs *regs) · 11 unmodified lines | ||
| 190 | 191 | |
| 191 | 192 | do_irq_async(regs, EXT_INTERRUPT); |
| 192 | 193 | |
| 193 | − irq_exit(); | |
| 194 | + irq_exit_rcu(); | |
| 194 | 195 | set_irq_regs(old_regs); |
| 195 | 196 | irqentry_exit(regs, state); |
| 196 | 197 | |
| @@ -7,6 +7,8 @@ · 6 unmodified lines | ||
| 7 | 7 | * Author(s): Philipp Rudo <prudo@linux.vnet.ibm.com> |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | +#define pr_fmt(fmt) "kexec: " fmt | |
| 11 | + | |
| 10 | 12 | #include <linux/elf.h> |
| 11 | 13 | #include <linux/errno.h> |
| 12 | 14 | #include <linux/kexec.h> |
| @@ -290,8 +292,16 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, · 277 unmodified lines | ||
| 290 | 292 | const Elf_Shdr *relsec, |
| 291 | 293 | const Elf_Shdr *symtab) |
| 292 | 294 | { |
| 295 | + const char *strtab, *name, *shstrtab; | |
| 296 | + const Elf_Shdr *sechdrs; | |
| 293 | 297 | Elf_Rela *relas; |
| 294 | 298 | int i, r_type; |
| 299 | + int ret; | |
| 300 | + | |
| 301 | + /* String & section header string table */ | |
| 302 | + sechdrs = (void *)pi->ehdr + pi->ehdr->e_shoff; | |
| 303 | + strtab = (char *)pi->ehdr + sechdrs[symtab->sh_link].sh_offset; | |
| 304 | + shstrtab = (char *)pi->ehdr + sechdrs[pi->ehdr->e_shstrndx].sh_offset; | |
| 295 | 305 | |
| 296 | 306 | relas = (void *)pi->ehdr + relsec->sh_offset; |
| 297 | 307 | |
| @@ -304,15 +314,27 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, · 6 unmodified lines | ||
| 304 | 314 | sym = (void *)pi->ehdr + symtab->sh_offset; |
| 305 | 315 | sym += ELF64_R_SYM(relas[i].r_info); |
| 306 | 316 | |
| 307 | − if (sym->st_shndx == SHN_UNDEF) | |
| 317 | + if (sym->st_name) | |
| 318 | + name = strtab + sym->st_name; | |
| 319 | + else | |
| 320 | + name = shstrtab + sechdrs[sym->st_shndx].sh_name; | |
| 321 | + | |
| 322 | + if (sym->st_shndx == SHN_UNDEF) { | |
| 323 | + pr_err("Undefined symbol: %s\n", name); | |
| 308 | 324 | return -ENOEXEC; |
| 325 | + } | |
| 309 | 326 | |
| 310 | − if (sym->st_shndx == SHN_COMMON) | |
| 327 | + if (sym->st_shndx == SHN_COMMON) { | |
| 328 | + pr_err("symbol '%s' in common section\n", name); | |
| 311 | 329 | return -ENOEXEC; |
| 330 | + } | |
| 312 | 331 | |
| 313 | 332 | if (sym->st_shndx >= pi->ehdr->e_shnum && |
| 314 | − sym->st_shndx != SHN_ABS) | |
| 333 | + sym->st_shndx != SHN_ABS) { | |
| 334 | + pr_err("Invalid section %d for symbol %s\n", | |
| 335 | + sym->st_shndx, name); | |
| 315 | 336 | return -ENOEXEC; |
| 337 | + } | |
| 316 | 338 | |
| 317 | 339 | loc = pi->purgatory_buf; |
| 318 | 340 | loc += section->sh_offset; |
| @@ -326,7 +348,15 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, · 7 unmodified lines | ||
| 326 | 348 | addr = section->sh_addr + relas[i].r_offset; |
| 327 | 349 | |
| 328 | 350 | r_type = ELF64_R_TYPE(relas[i].r_info); |
| 329 | − arch_kexec_do_relocs(r_type, loc, val, addr); | |
| 351 | + | |
| 352 | + if (r_type == R_390_PLT32DBL) | |
| 353 | + r_type = R_390_PC32DBL; | |
| 354 | + | |
| 355 | + ret = arch_kexec_do_relocs(r_type, loc, val, addr); | |
| 356 | + if (ret) { | |
| 357 | + pr_err("Unknown rela relocation: %d\n", r_type); | |
| 358 | + return -ENOEXEC; | |
| 359 | + } | |
| 330 | 360 | } |
| 331 | 361 | return 0; |
| 332 | 362 | } |
| @@ -97,7 +97,7 @@ · 96 unmodified lines | ||
| 97 | 97 | KVM_ARCH_REQ_FLAGS(25, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) |
| 98 | 98 | #define KVM_REQ_TLB_FLUSH_CURRENT KVM_ARCH_REQ(26) |
| 99 | 99 | #define KVM_REQ_TLB_FLUSH_GUEST \ |
| 100 | − KVM_ARCH_REQ_FLAGS(27, KVM_REQUEST_NO_WAKEUP) | |
| 100 | + KVM_ARCH_REQ_FLAGS(27, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) | |
| 101 | 101 | #define KVM_REQ_APF_READY KVM_ARCH_REQ(28) |
| 102 | 102 | #define KVM_REQ_MSR_FILTER_CHANGED KVM_ARCH_REQ(29) |
| 103 | 103 | #define KVM_REQ_UPDATE_CPU_DIRTY_LOGGING \ |
| @@ -579,6 +579,17 @@ static struct sched_domain_topology_level x86_numa_in_package_topology[] = { · 578 unmodified lines | ||
| 579 | 579 | { NULL, }, |
| 580 | 580 | }; |
| 581 | 581 | |
| 582 | +static struct sched_domain_topology_level x86_hybrid_topology[] = { | |
| 583 | +#ifdef CONFIG_SCHED_SMT | |
| 584 | + { cpu_smt_mask, x86_smt_flags, SD_INIT_NAME(SMT) }, | |
| 585 | +#endif | |
| 586 | +#ifdef CONFIG_SCHED_MC | |
| 587 | + { cpu_coregroup_mask, x86_core_flags, SD_INIT_NAME(MC) }, | |
| 588 | +#endif | |
| 589 | + { cpu_cpu_mask, SD_INIT_NAME(DIE) }, | |
| 590 | + { NULL, }, | |
| 591 | +}; | |
| 592 | + | |
| 582 | 593 | static struct sched_domain_topology_level x86_topology[] = { |
| 583 | 594 | #ifdef CONFIG_SCHED_SMT |
| 584 | 595 | { cpu_smt_mask, x86_smt_flags, SD_INIT_NAME(SMT) }, |
| @@ -1469,8 +1480,11 @@ void __init native_smp_cpus_done(unsigned int max_cpus) · 884 unmodified lines | ||
| 1469 | 1480 | |
| 1470 | 1481 | calculate_max_logical_packages(); |
| 1471 | 1482 | |
| 1483 | + /* XXX for now assume numa-in-package and hybrid don't overlap */ | |
| 1472 | 1484 | if (x86_has_numa_in_package) |
| 1473 | 1485 | set_sched_topology(x86_numa_in_package_topology); |
| 1486 | + if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) | |
| 1487 | + set_sched_topology(x86_hybrid_topology); | |
| 1474 | 1488 | |
| 1475 | 1489 | nmi_selftest(); |
| 1476 | 1490 | impress_friends(); |
| @@ -1922,11 +1922,13 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc, bool · 1921 unmodified lines | ||
| 1922 | 1922 | |
| 1923 | 1923 | all_cpus = send_ipi_ex.vp_set.format == HV_GENERIC_SET_ALL; |
| 1924 | 1924 | |
| 1925 | + if (all_cpus) | |
| 1926 | + goto check_and_send_ipi; | |
| 1927 | + | |
| 1925 | 1928 | if (!sparse_banks_len) |
| 1926 | 1929 | goto ret_success; |
| 1927 | 1930 | |
| 1928 | − if (!all_cpus && | |
| 1929 | − kvm_read_guest(kvm, | |
| 1931 | + if (kvm_read_guest(kvm, | |
| 1930 | 1932 | hc->ingpa + offsetof(struct hv_send_ipi_ex, |
| 1931 | 1933 | vp_set.bank_contents), |
| 1932 | 1934 | sparse_banks, |
| @@ -1934,6 +1936,7 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc, bool · 1 unmodified line | ||
| 1934 | 1936 | return HV_STATUS_INVALID_HYPERCALL_INPUT; |
| 1935 | 1937 | } |
| 1936 | 1938 | |
| 1939 | +check_and_send_ipi: | |
| 1937 | 1940 | if ((vector < HV_IPI_LOW_VECTOR) || (vector > HV_IPI_HIGH_VECTOR)) |
| 1938 | 1941 | return HV_STATUS_INVALID_HYPERCALL_INPUT; |
| 1939 | 1942 | |
| @@ -2646,15 +2646,6 @@ int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs) · 2645 unmodified lines | ||
| 2646 | 2646 | if (!loaded_vmcs->msr_bitmap) |
| 2647 | 2647 | goto out_vmcs; |
| 2648 | 2648 | memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE); |
| 2649 | − | |
| 2650 | − if (IS_ENABLED(CONFIG_HYPERV) && | |
| 2651 | − static_branch_unlikely(&enable_evmcs) && | |
| 2652 | − (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) { | |
| 2653 | − struct hv_enlightened_vmcs *evmcs = | |
| 2654 | − (struct hv_enlightened_vmcs *)loaded_vmcs->vmcs; | |
| 2655 | − | |
| 2656 | − evmcs->hv_enlightenments_control.msr_bitmap = 1; | |
| 2657 | − } | |
| 2658 | 2649 | } |
| 2659 | 2650 | |
| 2660 | 2651 | memset(&loaded_vmcs->host_state, 0, sizeof(struct vmcs_host_state)); |
| @@ -6842,6 +6833,19 @@ static int vmx_create_vcpu(struct kvm_vcpu *vcpu) · 4181 unmodified lines | ||
| 6842 | 6833 | if (err < 0) |
| 6843 | 6834 | goto free_pml; |
| 6844 | 6835 | |
| 6836 | + /* | |
| 6837 | + * Use Hyper-V 'Enlightened MSR Bitmap' feature when KVM runs as a | |
| 6838 | + * nested (L1) hypervisor and Hyper-V in L0 supports it. Enable the | |
| 6839 | + * feature only for vmcs01, KVM currently isn't equipped to realize any | |
| 6840 | + * performance benefits from enabling it for vmcs02. | |
| 6841 | + */ | |
| 6842 | + if (IS_ENABLED(CONFIG_HYPERV) && static_branch_unlikely(&enable_evmcs) && | |
| 6843 | + (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) { | |
| 6844 | + struct hv_enlightened_vmcs *evmcs = (void *)vmx->vmcs01.vmcs; | |
| 6845 | + | |
| 6846 | + evmcs->hv_enlightenments_control.msr_bitmap = 1; | |
| 6847 | + } | |
| 6848 | + | |
| 6845 | 6849 | /* The MSR bitmap starts with all ones */ |
| 6846 | 6850 | bitmap_fill(vmx->shadow_msr_intercept.read, MAX_POSSIBLE_PASSTHROUGH_MSRS); |
| 6847 | 6851 | bitmap_fill(vmx->shadow_msr_intercept.write, MAX_POSSIBLE_PASSTHROUGH_MSRS); |
| @@ -890,7 +890,8 @@ int kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 889 unmodified lines | ||
| 890 | 890 | !load_pdptrs(vcpu, vcpu->arch.walk_mmu, kvm_read_cr3(vcpu))) |
| 891 | 891 | return 1; |
| 892 | 892 | |
| 893 | − if (!(cr0 & X86_CR0_PG) && kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE)) | |
| 893 | + if (!(cr0 & X86_CR0_PG) && | |
| 894 | + (is_64_bit_mode(vcpu) || kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE))) | |
| 894 | 895 | return 1; |
| 895 | 896 | |
| 896 | 897 | static_call(kvm_x86_set_cr0)(vcpu, cr0); |
| @@ -7121,7 +7122,13 @@ static int emulator_pio_in(struct kvm_vcpu *vcpu, int size, · 6224 unmodified lines | ||
| 7121 | 7122 | unsigned short port, void *val, unsigned int count) |
| 7122 | 7123 | { |
| 7123 | 7124 | if (vcpu->arch.pio.count) { |
| 7124 | − /* Complete previous iteration. */ | |
| 7125 | + /* | |
| 7126 | + * Complete a previous iteration that required userspace I/O. | |
| 7127 | + * Note, @count isn't guaranteed to match pio.count as userspace | |
| 7128 | + * can modify ECX before rerunning the vCPU. Ignore any such | |
| 7129 | + * shenanigans as KVM doesn't support modifying the rep count, | |
| 7130 | + * and the emulator ensures @count doesn't overflow the buffer. | |
| 7131 | + */ | |
| 7125 | 7132 | } else { |
| 7126 | 7133 | int r = __emulator_pio_in(vcpu, size, port, count); |
| 7127 | 7134 | if (!r) |
| @@ -7130,7 +7137,6 @@ static int emulator_pio_in(struct kvm_vcpu *vcpu, int size, · 2 unmodified lines | ||
| 7130 | 7137 | /* Results already available, fall through. */ |
| 7131 | 7138 | } |
| 7132 | 7139 | |
| 7133 | − WARN_ON(count != vcpu->arch.pio.count); | |
| 7134 | 7140 | complete_emulator_pio_in(vcpu, val); |
| 7135 | 7141 | return 1; |
| 7136 | 7142 | } |
| @@ -1252,19 +1252,54 @@ st: if (is_imm8(insn->off)) · 1251 unmodified lines | ||
| 1252 | 1252 | case BPF_LDX | BPF_MEM | BPF_DW: |
| 1253 | 1253 | case BPF_LDX | BPF_PROBE_MEM | BPF_DW: |
| 1254 | 1254 | if (BPF_MODE(insn->code) == BPF_PROBE_MEM) { |
| 1255 | − /* test src_reg, src_reg */ | |
| 1256 | − maybe_emit_mod(&prog, src_reg, src_reg, true); /* always 1 byte */ | |
| 1257 | − EMIT2(0x85, add_2reg(0xC0, src_reg, src_reg)); | |
| 1258 | − /* jne start_of_ldx */ | |
| 1259 | − EMIT2(X86_JNE, 0); | |
| 1255 | + /* Though the verifier prevents negative insn->off in BPF_PROBE_MEM | |
| 1256 | + * add abs(insn->off) to the limit to make sure that negative | |
| 1257 | + * offset won't be an issue. | |
| 1258 | + * insn->off is s16, so it won't affect valid pointers. | |
| 1259 | + */ | |
| 1260 | + u64 limit = TASK_SIZE_MAX + PAGE_SIZE + abs(insn->off); | |
| 1261 | + u8 *end_of_jmp1, *end_of_jmp2; | |
| 1262 | + | |
| 1263 | + /* Conservatively check that src_reg + insn->off is a kernel address: | |
| 1264 | + * 1. src_reg + insn->off >= limit | |
| 1265 | + * 2. src_reg + insn->off doesn't become small positive. | |
| 1266 | + * Cannot do src_reg + insn->off >= limit in one branch, | |
| 1267 | + * since it needs two spare registers, but JIT has only one. | |
| 1268 | + */ | |
| 1269 | + | |
| 1270 | + /* movabsq r11, limit */ | |
| 1271 | + EMIT2(add_1mod(0x48, AUX_REG), add_1reg(0xB8, AUX_REG)); | |
| 1272 | + EMIT((u32)limit, 4); | |
| 1273 | + EMIT(limit >> 32, 4); | |
| 1274 | + /* cmp src_reg, r11 */ | |
| 1275 | + maybe_emit_mod(&prog, src_reg, AUX_REG, true); | |
| 1276 | + EMIT2(0x39, add_2reg(0xC0, src_reg, AUX_REG)); | |
| 1277 | + /* if unsigned '<' goto end_of_jmp2 */ | |
| 1278 | + EMIT2(X86_JB, 0); | |
| 1279 | + end_of_jmp1 = prog; | |
| 1280 | + | |
| 1281 | + /* mov r11, src_reg */ | |
| 1282 | + emit_mov_reg(&prog, true, AUX_REG, src_reg); | |
| 1283 | + /* add r11, insn->off */ | |
| 1284 | + maybe_emit_1mod(&prog, AUX_REG, true); | |
| 1285 | + EMIT2_off32(0x81, add_1reg(0xC0, AUX_REG), insn->off); | |
| 1286 | + /* jmp if not carry to start_of_ldx | |
| 1287 | + * Otherwise ERR_PTR(-EINVAL) + 128 will be the user addr | |
| 1288 | + * that has to be rejected. | |
| 1289 | + */ | |
| 1290 | + EMIT2(0x73 /* JNC */, 0); | |
| 1291 | + end_of_jmp2 = prog; | |
| 1292 | + | |
| 1260 | 1293 | /* xor dst_reg, dst_reg */ |
| 1261 | 1294 | emit_mov_imm32(&prog, false, dst_reg, 0); |
| 1262 | 1295 | /* jmp byte_after_ldx */ |
| 1263 | 1296 | EMIT2(0xEB, 0); |
| 1264 | 1297 | |
| 1265 | − /* populate jmp_offset for JNE above */ | |
| 1266 | − temp[4] = prog - temp - 5 /* sizeof(test + jne) */; | |
| 1298 | + /* populate jmp_offset for JB above to jump to xor dst_reg */ | |
| 1299 | + end_of_jmp1[-1] = end_of_jmp2 - end_of_jmp1; | |
| 1300 | + /* populate jmp_offset for JNC above to jump to start_of_ldx */ | |
| 1267 | 1301 | start_of_ldx = prog; |
| 1302 | + end_of_jmp2[-1] = start_of_ldx - end_of_jmp2; | |
| 1268 | 1303 | } |
| 1269 | 1304 | emit_ldx(&prog, BPF_SIZE(insn->code), dst_reg, src_reg, insn->off); |
| 1270 | 1305 | if (BPF_MODE(insn->code) == BPF_PROBE_MEM) { |
| @@ -1305,7 +1340,7 @@ st: if (is_imm8(insn->off)) · 34 unmodified lines | ||
| 1305 | 1340 | * End result: x86 insn "mov rbx, qword ptr [rax+0x14]" |
| 1306 | 1341 | * of 4 bytes will be ignored and rbx will be zero inited. |
| 1307 | 1342 | */ |
| 1308 | − ex->fixup = (prog - temp) | (reg2pt_regs[dst_reg] << 8); | |
| 1343 | + ex->fixup = (prog - start_of_ldx) | (reg2pt_regs[dst_reg] << 8); | |
| 1309 | 1344 | } |
| 1310 | 1345 | break; |
| 1311 | 1346 | |
| @@ -341,8 +341,7 @@ static ssize_t __blkdev_direct_IO_async(struct kiocb *iocb, · 340 unmodified lines | ||
| 341 | 341 | } else { |
| 342 | 342 | ret = bio_iov_iter_get_pages(bio, iter); |
| 343 | 343 | if (unlikely(ret)) { |
| 344 | − bio->bi_status = BLK_STS_IOERR; | |
| 345 | − bio_endio(bio); | |
| 344 | + bio_put(bio); | |
| 346 | 345 | return ret; |
| 347 | 346 | } |
| 348 | 347 | } |
| @@ -220,6 +220,7 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) · 219 unmodified lines | ||
| 220 | 220 | pgrp = task_pgrp(current); |
| 221 | 221 | else |
| 222 | 222 | pgrp = find_vpid(who); |
| 223 | + read_lock(&tasklist_lock); | |
| 223 | 224 | do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { |
| 224 | 225 | tmpio = get_task_ioprio(p); |
| 225 | 226 | if (tmpio < 0) |
| @@ -229,6 +230,8 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who) · 3 unmodified lines | ||
| 229 | 230 | else |
| 230 | 231 | ret = ioprio_best(ret, tmpio); |
| 231 | 232 | } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); |
| 233 | + read_unlock(&tasklist_lock); | |
| 234 | + | |
| 232 | 235 | break; |
| 233 | 236 | case IOPRIO_WHO_USER: |
| 234 | 237 | uid = make_kuid(current_user_ns(), who); |
| @@ -41,8 +41,7 @@ obj-$(CONFIG_DMADEVICES) += dma/ · 40 unmodified lines | ||
| 41 | 41 | # SOC specific infrastructure drivers. |
| 42 | 42 | obj-y += soc/ |
| 43 | 43 | |
| 44 | −obj-$(CONFIG_VIRTIO) += virtio/ | |
| 45 | −obj-$(CONFIG_VIRTIO_PCI_LIB) += virtio/ | |
| 44 | +obj-y += virtio/ | |
| 46 | 45 | obj-$(CONFIG_VDPA) += vdpa/ |
| 47 | 46 | obj-$(CONFIG_XEN) += xen/ |
| 48 | 47 | |
| @@ -4422,23 +4422,20 @@ static int binder_thread_release(struct binder_proc *proc, · 4421 unmodified lines | ||
| 4422 | 4422 | __release(&t->lock); |
| 4423 | 4423 | |
| 4424 | 4424 | /* |
| 4425 | − * If this thread used poll, make sure we remove the waitqueue | |
| 4426 | − * from any epoll data structures holding it with POLLFREE. | |
| 4427 | − * waitqueue_active() is safe to use here because we're holding | |
| 4428 | − * the inner lock. | |
| 4425 | + * If this thread used poll, make sure we remove the waitqueue from any | |
| 4426 | + * poll data structures holding it. | |
| 4429 | 4427 | */ |
| 4430 | − if ((thread->looper & BINDER_LOOPER_STATE_POLL) && | |
| 4431 | − waitqueue_active(&thread->wait)) { | |
| 4432 | − wake_up_poll(&thread->wait, EPOLLHUP | POLLFREE); | |
| 4433 | − } | |
| 4428 | + if (thread->looper & BINDER_LOOPER_STATE_POLL) | |
| 4429 | + wake_up_pollfree(&thread->wait); | |
| 4434 | 4430 | |
| 4435 | 4431 | binder_inner_proc_unlock(thread->proc); |
| 4436 | 4432 | |
| 4437 | 4433 | /* |
| 4438 | − * This is needed to avoid races between wake_up_poll() above and | |
| 4439 | − * and ep_remove_waitqueue() called for other reasons (eg the epoll file | |
| 4440 | − * descriptor being closed); ep_remove_waitqueue() holds an RCU read | |
| 4441 | − * lock, so we can be sure it's done after calling synchronize_rcu(). | |
| 4434 | + * This is needed to avoid races between wake_up_pollfree() above and | |
| 4435 | + * someone else removing the last entry from the queue for other reasons | |
| 4436 | + * (e.g. ep_remove_wait_queue() being called due to an epoll file | |
| 4437 | + * descriptor being closed). Such other users hold an RCU read lock, so | |
| 4438 | + * we can be sure they're done after we call synchronize_rcu(). | |
| 4442 | 4439 | */ |
| 4443 | 4440 | if (thread->looper & BINDER_LOOPER_STATE_POLL) |
| 4444 | 4441 | synchronize_rcu(); |
| @@ -94,6 +94,7 @@ struct ceva_ahci_priv { · 93 unmodified lines | ||
| 94 | 94 | static unsigned int ceva_ahci_read_id(struct ata_device *dev, |
| 95 | 95 | struct ata_taskfile *tf, u16 *id) |
| 96 | 96 | { |
| 97 | + __le16 *__id = (__le16 *)id; | |
| 97 | 98 | u32 err_mask; |
| 98 | 99 | |
| 99 | 100 | err_mask = ata_do_dev_read_id(dev, tf, id); |
| @@ -103,7 +104,7 @@ static unsigned int ceva_ahci_read_id(struct ata_device *dev, · 3 unmodified lines | ||
| 103 | 104 | * Since CEVA controller does not support device sleep feature, we |
| 104 | 105 | * need to clear DEVSLP (bit 8) in word78 of the IDENTIFY DEVICE data. |
| 105 | 106 | */ |
| 106 | − id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8)); | |
| 107 | + __id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8)); | |
| 107 | 108 | |
| 108 | 109 | return 0; |
| 109 | 110 | } |
| @@ -3920,6 +3920,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 3919 unmodified lines | ||
| 3920 | 3920 | { "VRFDFC22048UCHC-TE*", NULL, ATA_HORKAGE_NODMA }, |
| 3921 | 3921 | /* Odd clown on sil3726/4726 PMPs */ |
| 3922 | 3922 | { "Config Disk", NULL, ATA_HORKAGE_DISABLE }, |
| 3923 | + /* Similar story with ASMedia 1092 */ | |
| 3924 | + { "ASMT109x- Config", NULL, ATA_HORKAGE_DISABLE }, | |
| 3923 | 3925 | |
| 3924 | 3926 | /* Weird ATAPI devices */ |
| 3925 | 3927 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, |
| @@ -881,7 +881,7 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl) · 880 unmodified lines | ||
| 881 | 881 | } |
| 882 | 882 | EXPORT_SYMBOL_GPL(mhi_pm_suspend); |
| 883 | 883 | |
| 884 | −int mhi_pm_resume(struct mhi_controller *mhi_cntrl) | |
| 884 | +static int __mhi_pm_resume(struct mhi_controller *mhi_cntrl, bool force) | |
| 885 | 885 | { |
| 886 | 886 | struct mhi_chan *itr, *tmp; |
| 887 | 887 | struct device *dev = &mhi_cntrl->mhi_dev->dev; |
| @@ -898,8 +898,12 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl) · 10 unmodified lines | ||
| 898 | 898 | if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) |
| 899 | 899 | return -EIO; |
| 900 | 900 | |
| 901 | − if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3) | |
| 902 | − return -EINVAL; | |
| 901 | + if (mhi_get_mhi_state(mhi_cntrl) != MHI_STATE_M3) { | |
| 902 | + dev_warn(dev, "Resuming from non M3 state (%s)\n", | |
| 903 | + TO_MHI_STATE_STR(mhi_get_mhi_state(mhi_cntrl))); | |
| 904 | + if (!force) | |
| 905 | + return -EINVAL; | |
| 906 | + } | |
| 903 | 907 | |
| 904 | 908 | /* Notify clients about exiting LPM */ |
| 905 | 909 | list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) { |
| @@ -940,8 +944,19 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl) · 34 unmodified lines | ||
| 940 | 944 | |
| 941 | 945 | return 0; |
| 942 | 946 | } |
| 947 | + | |
| 948 | +int mhi_pm_resume(struct mhi_controller *mhi_cntrl) | |
| 949 | +{ | |
| 950 | + return __mhi_pm_resume(mhi_cntrl, false); | |
| 951 | +} | |
| 943 | 952 | EXPORT_SYMBOL_GPL(mhi_pm_resume); |
| 944 | 953 | |
| 954 | +int mhi_pm_resume_force(struct mhi_controller *mhi_cntrl) | |
| 955 | +{ | |
| 956 | + return __mhi_pm_resume(mhi_cntrl, true); | |
| 957 | +} | |
| 958 | +EXPORT_SYMBOL_GPL(mhi_pm_resume_force); | |
| 959 | + | |
| 945 | 960 | int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl) |
| 946 | 961 | { |
| 947 | 962 | int ret; |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | #define MHI_PCI_DEFAULT_BAR_NUM 0 |
| 22 | 22 | |
| 23 | −#define MHI_POST_RESET_DELAY_MS 500 | |
| 23 | +#define MHI_POST_RESET_DELAY_MS 2000 | |
| 24 | 24 | |
| 25 | 25 | #define HEALTH_CHECK_PERIOD (HZ * 2) |
| 26 | 26 | |
| @@ -3418,6 +3418,14 @@ static int __clk_core_init(struct clk_core *core) · 3417 unmodified lines | ||
| 3418 | 3418 | |
| 3419 | 3419 | clk_prepare_lock(); |
| 3420 | 3420 | |
| 3421 | + /* | |
| 3422 | + * Set hw->core after grabbing the prepare_lock to synchronize with | |
| 3423 | + * callers of clk_core_fill_parent_index() where we treat hw->core | |
| 3424 | + * being NULL as the clk not being registered yet. This is crucial so | |
| 3425 | + * that clks aren't parented until their parent is fully registered. | |
| 3426 | + */ | |
| 3427 | + core->hw->core = core; | |
| 3428 | + | |
| 3421 | 3429 | ret = clk_pm_runtime_get(core); |
| 3422 | 3430 | if (ret) |
| 3423 | 3431 | goto unlock; |
| @@ -3582,8 +3590,10 @@ static int __clk_core_init(struct clk_core *core) · 158 unmodified lines | ||
| 3582 | 3590 | out: |
| 3583 | 3591 | clk_pm_runtime_put(core); |
| 3584 | 3592 | unlock: |
| 3585 | − if (ret) | |
| 3593 | + if (ret) { | |
| 3586 | 3594 | hlist_del_init(&core->child_node); |
| 3595 | + core->hw->core = NULL; | |
| 3596 | + } | |
| 3587 | 3597 | |
| 3588 | 3598 | clk_prepare_unlock(); |
| 3589 | 3599 | |
| @@ -3847,7 +3857,6 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw) · 257 unmodified lines | ||
| 3847 | 3857 | core->num_parents = init->num_parents; |
| 3848 | 3858 | core->min_rate = 0; |
| 3849 | 3859 | core->max_rate = ULONG_MAX; |
| 3850 | − hw->core = core; | |
| 3851 | 3860 | |
| 3852 | 3861 | ret = clk_core_populate_parent_map(core, init); |
| 3853 | 3862 | if (ret) |
| @@ -3865,7 +3874,7 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw) · 11 unmodified lines | ||
| 3865 | 3874 | goto fail_create_clk; |
| 3866 | 3875 | } |
| 3867 | 3876 | |
| 3868 | − clk_core_link_consumer(hw->core, hw->clk); | |
| 3877 | + clk_core_link_consumer(core, hw->clk); | |
| 3869 | 3878 | |
| 3870 | 3879 | ret = __clk_core_init(core); |
| 3871 | 3880 | if (!ret) |
| @@ -370,7 +370,7 @@ static struct platform_driver imx8qxp_lpcg_clk_driver = { · 369 unmodified lines | ||
| 370 | 370 | .probe = imx8qxp_lpcg_clk_probe, |
| 371 | 371 | }; |
| 372 | 372 | |
| 373 | −builtin_platform_driver(imx8qxp_lpcg_clk_driver); | |
| 373 | +module_platform_driver(imx8qxp_lpcg_clk_driver); | |
| 374 | 374 | |
| 375 | 375 | MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>"); |
| 376 | 376 | MODULE_DESCRIPTION("NXP i.MX8QXP LPCG clock driver"); |
| @@ -308,7 +308,7 @@ static struct platform_driver imx8qxp_clk_driver = { · 307 unmodified lines | ||
| 308 | 308 | }, |
| 309 | 309 | .probe = imx8qxp_clk_probe, |
| 310 | 310 | }; |
| 311 | −builtin_platform_driver(imx8qxp_clk_driver); | |
| 311 | +module_platform_driver(imx8qxp_clk_driver); | |
| 312 | 312 | |
| 313 | 313 | MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>"); |
| 314 | 314 | MODULE_DESCRIPTION("NXP i.MX8QXP clock driver"); |
| @@ -1429,6 +1429,15 @@ EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_fabia_ops); · 1428 unmodified lines | ||
| 1429 | 1429 | void clk_trion_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap, |
| 1430 | 1430 | const struct alpha_pll_config *config) |
| 1431 | 1431 | { |
| 1432 | + /* | |
| 1433 | + * If the bootloader left the PLL enabled it's likely that there are | |
| 1434 | + * RCGs that will lock up if we disable the PLL below. | |
| 1435 | + */ | |
| 1436 | + if (trion_pll_is_enabled(pll, regmap)) { | |
| 1437 | + pr_debug("Trion PLL is already enabled, skipping configuration\n"); | |
| 1438 | + return; | |
| 1439 | + } | |
| 1440 | + | |
| 1432 | 1441 | clk_alpha_pll_write_config(regmap, PLL_L_VAL(pll), config->l); |
| 1433 | 1442 | regmap_write(regmap, PLL_CAL_L_VAL(pll), TRION_PLL_CAL_VAL); |
| 1434 | 1443 | clk_alpha_pll_write_config(regmap, PLL_ALPHA_VAL(pll), config->alpha); |
| @@ -28,7 +28,7 @@ static u8 mux_get_parent(struct clk_hw *hw) · 27 unmodified lines | ||
| 28 | 28 | val &= mask; |
| 29 | 29 | |
| 30 | 30 | if (mux->parent_map) |
| 31 | − return qcom_find_src_index(hw, mux->parent_map, val); | |
| 31 | + return qcom_find_cfg_index(hw, mux->parent_map, val); | |
| 32 | 32 | |
| 33 | 33 | return val; |
| 34 | 34 | } |
| @@ -69,6 +69,18 @@ int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, u8 src) · 68 unmodified lines | ||
| 69 | 69 | } |
| 70 | 70 | EXPORT_SYMBOL_GPL(qcom_find_src_index); |
| 71 | 71 | |
| 72 | +int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, u8 cfg) | |
| 73 | +{ | |
| 74 | + int i, num_parents = clk_hw_get_num_parents(hw); | |
| 75 | + | |
| 76 | + for (i = 0; i < num_parents; i++) | |
| 77 | + if (cfg == map[i].cfg) | |
| 78 | + return i; | |
| 79 | + | |
| 80 | + return -ENOENT; | |
| 81 | +} | |
| 82 | +EXPORT_SYMBOL_GPL(qcom_find_cfg_index); | |
| 83 | + | |
| 72 | 84 | struct regmap * |
| 73 | 85 | qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc) |
| 74 | 86 | { |
| @@ -49,6 +49,8 @@ extern void · 48 unmodified lines | ||
| 49 | 49 | qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count); |
| 50 | 50 | extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, |
| 51 | 51 | u8 src); |
| 52 | +extern int qcom_find_cfg_index(struct clk_hw *hw, const struct parent_map *map, | |
| 53 | + u8 cfg); | |
| 52 | 54 | |
| 53 | 55 | extern int qcom_cc_register_board_clk(struct device *dev, const char *path, |
| 54 | 56 | const char *name, unsigned long rate); |
| @@ -1121,7 +1121,7 @@ static struct clk_rcg2 gcc_sdcc1_apps_clk_src = { · 1120 unmodified lines | ||
| 1121 | 1121 | .name = "gcc_sdcc1_apps_clk_src", |
| 1122 | 1122 | .parent_data = gcc_parent_data_1, |
| 1123 | 1123 | .num_parents = ARRAY_SIZE(gcc_parent_data_1), |
| 1124 | − .ops = &clk_rcg2_ops, | |
| 1124 | + .ops = &clk_rcg2_floor_ops, | |
| 1125 | 1125 | }, |
| 1126 | 1126 | }; |
| 1127 | 1127 | |
| @@ -1143,7 +1143,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = { · 15 unmodified lines | ||
| 1143 | 1143 | .name = "gcc_sdcc1_ice_core_clk_src", |
| 1144 | 1144 | .parent_data = gcc_parent_data_0, |
| 1145 | 1145 | .num_parents = ARRAY_SIZE(gcc_parent_data_0), |
| 1146 | − .ops = &clk_rcg2_floor_ops, | |
| 1146 | + .ops = &clk_rcg2_ops, | |
| 1147 | 1147 | }, |
| 1148 | 1148 | }; |
| 1149 | 1149 | |
| @@ -543,8 +543,8 @@ static void __init of_syscon_icst_setup(struct device_node *np) · 542 unmodified lines | ||
| 543 | 543 | |
| 544 | 544 | regclk = icst_clk_setup(NULL, &icst_desc, name, parent_name, map, ctype); |
| 545 | 545 | if (IS_ERR(regclk)) { |
| 546 | − kfree(name); | |
| 547 | 546 | pr_err("error setting up syscon ICST clock %s\n", name); |
| 547 | + kfree(name); | |
| 548 | 548 | return; |
| 549 | 549 | } |
| 550 | 550 | of_clk_add_provider(np, of_clk_src_simple_get, regclk); |
| @@ -394,8 +394,13 @@ EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround); · 393 unmodified lines | ||
| 394 | 394 | |
| 395 | 395 | static atomic_t timer_unstable_counter_workaround_in_use = ATOMIC_INIT(0); |
| 396 | 396 | |
| 397 | −static void erratum_set_next_event_generic(const int access, unsigned long evt, | |
| 398 | − struct clock_event_device *clk) | |
| 397 | +/* | |
| 398 | + * Force the inlining of this function so that the register accesses | |
| 399 | + * can be themselves correctly inlined. | |
| 400 | + */ | |
| 401 | +static __always_inline | |
| 402 | +void erratum_set_next_event_generic(const int access, unsigned long evt, | |
| 403 | + struct clock_event_device *clk) | |
| 399 | 404 | { |
| 400 | 405 | unsigned long ctrl; |
| 401 | 406 | u64 cval; |
| @@ -47,7 +47,7 @@ static int __init timer_get_base_and_rate(struct device_node *np, · 46 unmodified lines | ||
| 47 | 47 | pr_warn("pclk for %pOFn is present, but could not be activated\n", |
| 48 | 48 | np); |
| 49 | 49 | |
| 50 | − if (!of_property_read_u32(np, "clock-freq", rate) && | |
| 50 | + if (!of_property_read_u32(np, "clock-freq", rate) || | |
| 51 | 51 | !of_property_read_u32(np, "clock-frequency", rate)) |
| 52 | 52 | return 0; |
| 53 | 53 | |
| @@ -16,7 +16,6 @@ struct scpi_pm_domain { · 15 unmodified lines | ||
| 16 | 16 | struct generic_pm_domain genpd; |
| 17 | 17 | struct scpi_ops *ops; |
| 18 | 18 | u32 domain; |
| 19 | − char name[30]; | |
| 20 | 19 | }; |
| 21 | 20 | |
| 22 | 21 | /* |
| @@ -110,8 +109,13 @@ static int scpi_pm_domain_probe(struct platform_device *pdev) · 87 unmodified lines | ||
| 110 | 109 | |
| 111 | 110 | scpi_pd->domain = i; |
| 112 | 111 | scpi_pd->ops = scpi_ops; |
| 113 | − sprintf(scpi_pd->name, "%pOFn.%d", np, i); | |
| 114 | − scpi_pd->genpd.name = scpi_pd->name; | |
| 112 | + scpi_pd->genpd.name = devm_kasprintf(dev, GFP_KERNEL, | |
| 113 | + "%pOFn.%d", np, i); | |
| 114 | + if (!scpi_pd->genpd.name) { | |
| 115 | + dev_err(dev, "Failed to allocate genpd name:%pOFn.%d\n", | |
| 116 | + np, i); | |
| 117 | + continue; | |
| 118 | + } | |
| 115 | 119 | scpi_pd->genpd.power_off = scpi_pd_power_off; |
| 116 | 120 | scpi_pd->genpd.power_on = scpi_pd_power_on; |
| 117 | 121 | |
| @@ -77,13 +77,14 @@ static const char *get_filename(struct tegra_bpmp *bpmp, · 76 unmodified lines | ||
| 77 | 77 | const char *root_path, *filename = NULL; |
| 78 | 78 | char *root_path_buf; |
| 79 | 79 | size_t root_len; |
| 80 | + size_t root_path_buf_len = 512; | |
| 80 | 81 | |
| 81 | − root_path_buf = kzalloc(512, GFP_KERNEL); | |
| 82 | + root_path_buf = kzalloc(root_path_buf_len, GFP_KERNEL); | |
| 82 | 83 | if (!root_path_buf) |
| 83 | 84 | goto out; |
| 84 | 85 | |
| 85 | 86 | root_path = dentry_path(bpmp->debugfs_mirror, root_path_buf, |
| 86 | − sizeof(root_path_buf)); | |
| 87 | + root_path_buf_len); | |
| 87 | 88 | if (IS_ERR(root_path)) |
| 88 | 89 | goto out; |
| 89 | 90 | |
| @@ -2576,7 +2576,8 @@ static int dm_resume(void *handle) · 2575 unmodified lines | ||
| 2576 | 2576 | */ |
| 2577 | 2577 | link_enc_cfg_init(dm->dc, dc_state); |
| 2578 | 2578 | |
| 2579 | − amdgpu_dm_outbox_init(adev); | |
| 2579 | + if (dc_enable_dmub_notifications(adev->dm.dc)) | |
| 2580 | + amdgpu_dm_outbox_init(adev); | |
| 2580 | 2581 | |
| 2581 | 2582 | r = dm_dmub_hw_init(adev); |
| 2582 | 2583 | if (r) |
| @@ -2625,6 +2626,10 @@ static int dm_resume(void *handle) · 42 unmodified lines | ||
| 2625 | 2626 | /* TODO: Remove dc_state->dccg, use dc->dccg directly. */ |
| 2626 | 2627 | dc_resource_state_construct(dm->dc, dm_state->context); |
| 2627 | 2628 | |
| 2629 | + /* Re-enable outbox interrupts for DPIA. */ | |
| 2630 | + if (dc_enable_dmub_notifications(adev->dm.dc)) | |
| 2631 | + amdgpu_dm_outbox_init(adev); | |
| 2632 | + | |
| 2628 | 2633 | /* Before powering on DC we need to re-initialize DMUB. */ |
| 2629 | 2634 | r = dm_dmub_hw_init(adev); |
| 2630 | 2635 | if (r) |
| @@ -226,6 +226,8 @@ static inline void get_edp_links(const struct dc *dc, · 225 unmodified lines | ||
| 226 | 226 | *edp_num = 0; |
| 227 | 227 | for (i = 0; i < dc->link_count; i++) { |
| 228 | 228 | // report any eDP links, even unconnected DDI's |
| 229 | + if (!dc->links[i]) | |
| 230 | + continue; | |
| 229 | 231 | if (dc->links[i]->connector_signal == SIGNAL_TYPE_EDP) { |
| 230 | 232 | edp_links[*edp_num] = dc->links[i]; |
| 231 | 233 | if (++(*edp_num) == MAX_NUM_EDP) |
| @@ -404,8 +404,17 @@ int drm_syncobj_find_fence(struct drm_file *file_private, · 403 unmodified lines | ||
| 404 | 404 | |
| 405 | 405 | if (*fence) { |
| 406 | 406 | ret = dma_fence_chain_find_seqno(fence, point); |
| 407 | − if (!ret) | |
| 407 | + if (!ret) { | |
| 408 | + /* If the requested seqno is already signaled | |
| 409 | + * drm_syncobj_find_fence may return a NULL | |
| 410 | + * fence. To make sure the recipient gets | |
| 411 | + * signalled, use a new fence instead. | |
| 412 | + */ | |
| 413 | + if (!*fence) | |
| 414 | + *fence = dma_fence_get_stub(); | |
| 415 | + | |
| 408 | 416 | goto out; |
| 417 | + } | |
| 409 | 418 | dma_fence_put(*fence); |
| 410 | 419 | } else { |
| 411 | 420 | ret = -EINVAL; |
| @@ -3277,6 +3277,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, · 3276 unmodified lines | ||
| 3277 | 3277 | out_fence = eb_requests_create(&eb, in_fence, out_fence_fd); |
| 3278 | 3278 | if (IS_ERR(out_fence)) { |
| 3279 | 3279 | err = PTR_ERR(out_fence); |
| 3280 | + out_fence = NULL; | |
| 3280 | 3281 | if (eb.requests[0]) |
| 3281 | 3282 | goto err_request; |
| 3282 | 3283 | else |
| @@ -1127,6 +1127,15 @@ icl_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal) · 1126 unmodified lines | ||
| 1127 | 1127 | GAMT_CHKN_BIT_REG, |
| 1128 | 1128 | GAMT_CHKN_DISABLE_L3_COH_PIPE); |
| 1129 | 1129 | |
| 1130 | + /* Wa_1407352427:icl,ehl */ | |
| 1131 | + wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2, | |
| 1132 | + PSDUNIT_CLKGATE_DIS); | |
| 1133 | + | |
| 1134 | + /* Wa_1406680159:icl,ehl */ | |
| 1135 | + wa_write_or(wal, | |
| 1136 | + SUBSLICE_UNIT_LEVEL_CLKGATE, | |
| 1137 | + GWUNIT_CLKGATE_DIS); | |
| 1138 | + | |
| 1130 | 1139 | /* Wa_1607087056:icl,ehl,jsl */ |
| 1131 | 1140 | if (IS_ICELAKE(i915) || |
| 1132 | 1141 | IS_JSL_EHL_GT_STEP(i915, STEP_A0, STEP_B0)) |
| @@ -1852,15 +1861,6 @@ rcs_engine_wa_init(struct intel_engine_cs *engine, struct i915_wa_list *wal) · 719 unmodified lines | ||
| 1852 | 1861 | wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE, |
| 1853 | 1862 | VSUNIT_CLKGATE_DIS | HSUNIT_CLKGATE_DIS); |
| 1854 | 1863 | |
| 1855 | − /* Wa_1407352427:icl,ehl */ | |
| 1856 | − wa_write_or(wal, UNSLICE_UNIT_LEVEL_CLKGATE2, | |
| 1857 | − PSDUNIT_CLKGATE_DIS); | |
| 1858 | − | |
| 1859 | − /* Wa_1406680159:icl,ehl */ | |
| 1860 | − wa_write_or(wal, | |
| 1861 | − SUBSLICE_UNIT_LEVEL_CLKGATE, | |
| 1862 | − GWUNIT_CLKGATE_DIS); | |
| 1863 | − | |
| 1864 | 1864 | /* |
| 1865 | 1865 | * Wa_1408767742:icl[a2..forever],ehl[all] |
| 1866 | 1866 | * Wa_1605460711:icl[a0..c0] |
| @@ -1103,7 +1103,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, · 1102 unmodified lines | ||
| 1103 | 1103 | * as an indication that we're about to swap out. |
| 1104 | 1104 | */ |
| 1105 | 1105 | memset(&place, 0, sizeof(place)); |
| 1106 | − place.mem_type = TTM_PL_SYSTEM; | |
| 1106 | + place.mem_type = bo->resource->mem_type; | |
| 1107 | 1107 | if (!ttm_bo_evict_swapout_allowable(bo, ctx, &place, &locked, NULL)) |
| 1108 | 1108 | return -EBUSY; |
| 1109 | 1109 | |
| @@ -1135,6 +1135,7 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, · 25 unmodified lines | ||
| 1135 | 1135 | struct ttm_place hop; |
| 1136 | 1136 | |
| 1137 | 1137 | memset(&hop, 0, sizeof(hop)); |
| 1138 | + place.mem_type = TTM_PL_SYSTEM; | |
| 1138 | 1139 | ret = ttm_resource_alloc(bo, &place, &evict_mem); |
| 1139 | 1140 | if (unlikely(ret)) |
| 1140 | 1141 | goto out; |
| @@ -19,6 +19,7 @@ config HYPERV_TIMER · 18 unmodified lines | ||
| 19 | 19 | config HYPERV_UTILS |
| 20 | 20 | tristate "Microsoft Hyper-V Utilities driver" |
| 21 | 21 | depends on HYPERV && CONNECTOR && NLS |
| 22 | + depends on PTP_1588_CLOCK_OPTIONAL | |
| 22 | 23 | help |
| 23 | 24 | Select this option to enable the Hyper-V Utilities. |
| 24 | 25 | |
| @@ -729,7 +729,7 @@ static int corsairpsu_probe(struct hid_device *hdev, const struct hid_device_id · 728 unmodified lines | ||
| 729 | 729 | corsairpsu_check_cmd_support(priv); |
| 730 | 730 | |
| 731 | 731 | priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, "corsairpsu", priv, |
| 732 | − &corsairpsu_chip_info, 0); | |
| 732 | + &corsairpsu_chip_info, NULL); | |
| 733 | 733 | |
| 734 | 734 | if (IS_ERR(priv->hwmon_dev)) { |
| 735 | 735 | ret = PTR_ERR(priv->hwmon_dev); |
| @@ -627,10 +627,9 @@ static void __init i8k_init_procfs(struct device *dev) · 626 unmodified lines | ||
| 627 | 627 | { |
| 628 | 628 | struct dell_smm_data *data = dev_get_drvdata(dev); |
| 629 | 629 | |
| 630 | − /* Register the proc entry */ | |
| 631 | − proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data); | |
| 632 | − | |
| 633 | − devm_add_action_or_reset(dev, i8k_exit_procfs, NULL); | |
| 630 | + /* Only register exit function if creation was successful */ | |
| 631 | + if (proc_create_data("i8k", 0, NULL, &i8k_proc_ops, data)) | |
| 632 | + devm_add_action_or_reset(dev, i8k_exit_procfs, NULL); | |
| 634 | 633 | } |
| 635 | 634 | |
| 636 | 635 | #else |
| @@ -1527,7 +1527,7 @@ static u16 nct6775_wmi_read_value(struct nct6775_data *data, u16 reg) · 1526 unmodified lines | ||
| 1527 | 1527 | |
| 1528 | 1528 | nct6775_wmi_set_bank(data, reg); |
| 1529 | 1529 | |
| 1530 | − err = nct6775_asuswmi_read(data->bank, reg, &tmp); | |
| 1530 | + err = nct6775_asuswmi_read(data->bank, reg & 0xff, &tmp); | |
| 1531 | 1531 | if (err) |
| 1532 | 1532 | return 0; |
| 1533 | 1533 | |
| @@ -336,8 +336,6 @@ static int pwm_fan_probe(struct platform_device *pdev) · 335 unmodified lines | ||
| 336 | 336 | return ret; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | − ctx->pwm_value = MAX_PWM; | |
| 340 | − | |
| 341 | 339 | pwm_init_state(ctx->pwm, &ctx->pwm_state); |
| 342 | 340 | |
| 343 | 341 | /* |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | /* |
| 24 | 24 | * I2C command delays (in microseconds) |
| 25 | 25 | */ |
| 26 | −#define SHT4X_MEAS_DELAY 1000 | |
| 26 | +#define SHT4X_MEAS_DELAY_HPM 8200 /* see t_MEAS,h in datasheet */ | |
| 27 | 27 | #define SHT4X_DELAY_EXTRA 10000 |
| 28 | 28 | |
| 29 | 29 | /* |
| @@ -90,7 +90,7 @@ static int sht4x_read_values(struct sht4x_data *data) · 60 unmodified lines | ||
| 90 | 90 | if (ret < 0) |
| 91 | 91 | goto unlock; |
| 92 | 92 | |
| 93 | − usleep_range(SHT4X_MEAS_DELAY, SHT4X_MEAS_DELAY + SHT4X_DELAY_EXTRA); | |
| 93 | + usleep_range(SHT4X_MEAS_DELAY_HPM, SHT4X_MEAS_DELAY_HPM + SHT4X_DELAY_EXTRA); | |
| 94 | 94 | |
| 95 | 95 | ret = i2c_master_recv(client, raw_data, SHT4X_RESPONSE_LENGTH); |
| 96 | 96 | if (ret != SHT4X_RESPONSE_LENGTH) { |
| @@ -636,7 +636,7 @@ static irqreturn_t mpc_i2c_isr(int irq, void *dev_id) · 635 unmodified lines | ||
| 636 | 636 | status = readb(i2c->base + MPC_I2C_SR); |
| 637 | 637 | if (status & CSR_MIF) { |
| 638 | 638 | /* Wait up to 100us for transfer to properly complete */ |
| 639 | − readb_poll_timeout(i2c->base + MPC_I2C_SR, status, !(status & CSR_MCF), 0, 100); | |
| 639 | + readb_poll_timeout_atomic(i2c->base + MPC_I2C_SR, status, status & CSR_MCF, 0, 100); | |
| 640 | 640 | writeb(0, i2c->base + MPC_I2C_SR); |
| 641 | 641 | mpc_i2c_do_intr(i2c, status); |
| 642 | 642 | return IRQ_HANDLED; |
| @@ -22,24 +22,24 @@ · 21 unmodified lines | ||
| 22 | 22 | /** |
| 23 | 23 | * struct virtio_i2c - virtio I2C data |
| 24 | 24 | * @vdev: virtio device for this controller |
| 25 | − * @completion: completion of virtio I2C message | |
| 26 | 25 | * @adap: I2C adapter for this controller |
| 27 | 26 | * @vq: the virtio virtqueue for communication |
| 28 | 27 | */ |
| 29 | 28 | struct virtio_i2c { |
| 30 | 29 | struct virtio_device *vdev; |
| 31 | − struct completion completion; | |
| 32 | 30 | struct i2c_adapter adap; |
| 33 | 31 | struct virtqueue *vq; |
| 34 | 32 | }; |
| 35 | 33 | |
| 36 | 34 | /** |
| 37 | 35 | * struct virtio_i2c_req - the virtio I2C request structure |
| 36 | + * @completion: completion of virtio I2C message | |
| 38 | 37 | * @out_hdr: the OUT header of the virtio I2C message |
| 39 | 38 | * @buf: the buffer into which data is read, or from which it's written |
| 40 | 39 | * @in_hdr: the IN header of the virtio I2C message |
| 41 | 40 | */ |
| 42 | 41 | struct virtio_i2c_req { |
| 42 | + struct completion completion; | |
| 43 | 43 | struct virtio_i2c_out_hdr out_hdr ____cacheline_aligned; |
| 44 | 44 | uint8_t *buf ____cacheline_aligned; |
| 45 | 45 | struct virtio_i2c_in_hdr in_hdr ____cacheline_aligned; |
| @@ -47,9 +47,11 @@ struct virtio_i2c_req { · 1 unmodified line | ||
| 47 | 47 | |
| 48 | 48 | static void virtio_i2c_msg_done(struct virtqueue *vq) |
| 49 | 49 | { |
| 50 | − struct virtio_i2c *vi = vq->vdev->priv; | |
| 50 | + struct virtio_i2c_req *req; | |
| 51 | + unsigned int len; | |
| 51 | 52 | |
| 52 | − complete(&vi->completion); | |
| 53 | + while ((req = virtqueue_get_buf(vq, &len))) | |
| 54 | + complete(&req->completion); | |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | 57 | static int virtio_i2c_prepare_reqs(struct virtqueue *vq, |
| @@ -62,6 +64,8 @@ static int virtio_i2c_prepare_reqs(struct virtqueue *vq, · 6 unmodified lines | ||
| 62 | 64 | for (i = 0; i < num; i++) { |
| 63 | 65 | int outcnt = 0, incnt = 0; |
| 64 | 66 | |
| 67 | + init_completion(&reqs[i].completion); | |
| 68 | + | |
| 65 | 69 | /* |
| 66 | 70 | * Only 7-bit mode supported for this moment. For the address |
| 67 | 71 | * format, Please check the Virtio I2C Specification. |
| @@ -106,21 +110,15 @@ static int virtio_i2c_complete_reqs(struct virtqueue *vq, · 38 unmodified lines | ||
| 106 | 110 | struct virtio_i2c_req *reqs, |
| 107 | 111 | struct i2c_msg *msgs, int num) |
| 108 | 112 | { |
| 109 | − struct virtio_i2c_req *req; | |
| 110 | 113 | bool failed = false; |
| 111 | − unsigned int len; | |
| 112 | 114 | int i, j = 0; |
| 113 | 115 | |
| 114 | 116 | for (i = 0; i < num; i++) { |
| 115 | − /* Detach the ith request from the vq */ | |
| 116 | − req = virtqueue_get_buf(vq, &len); | |
| 117 | + struct virtio_i2c_req *req = &reqs[i]; | |
| 117 | 118 | |
| 118 | − /* | |
| 119 | − * Condition req == &reqs[i] should always meet since we have | |
| 120 | − * total num requests in the vq. reqs[i] can never be NULL here. | |
| 121 | − */ | |
| 122 | − if (!failed && (WARN_ON(req != &reqs[i]) || | |
| 123 | − req->in_hdr.status != VIRTIO_I2C_MSG_OK)) | |
| 119 | + wait_for_completion(&req->completion); | |
| 120 | + | |
| 121 | + if (!failed && req->in_hdr.status != VIRTIO_I2C_MSG_OK) | |
| 124 | 122 | failed = true; |
| 125 | 123 | |
| 126 | 124 | i2c_put_dma_safe_msg_buf(reqs[i].buf, &msgs[i], !failed); |
| @@ -156,12 +154,8 @@ static int virtio_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, · 29 unmodified lines | ||
| 156 | 154 | * remote here to clear the virtqueue, so we can try another set of |
| 157 | 155 | * messages later on. |
| 158 | 156 | */ |
| 159 | − | |
| 160 | − reinit_completion(&vi->completion); | |
| 161 | 157 | virtqueue_kick(vq); |
| 162 | 158 | |
| 163 | − wait_for_completion(&vi->completion); | |
| 164 | − | |
| 165 | 159 | count = virtio_i2c_complete_reqs(vq, reqs, msgs, count); |
| 166 | 160 | |
| 167 | 161 | err_free: |
| @@ -210,8 +204,6 @@ static int virtio_i2c_probe(struct virtio_device *vdev) · 42 unmodified lines | ||
| 210 | 204 | vdev->priv = vi; |
| 211 | 205 | vi->vdev = vdev; |
| 212 | 206 | |
| 213 | − init_completion(&vi->completion); | |
| 214 | − | |
| 215 | 207 | ret = virtio_i2c_setup_vqs(vi); |
| 216 | 208 | if (ret) |
| 217 | 209 | return ret; |
| @@ -1595,8 +1595,7 @@ static int kxcjk1013_probe(struct i2c_client *client, · 1594 unmodified lines | ||
| 1595 | 1595 | return 0; |
| 1596 | 1596 | |
| 1597 | 1597 | err_buffer_cleanup: |
| 1598 | − if (data->dready_trig) | |
| 1599 | − iio_triggered_buffer_cleanup(indio_dev); | |
| 1598 | + iio_triggered_buffer_cleanup(indio_dev); | |
| 1600 | 1599 | err_trigger_unregister: |
| 1601 | 1600 | if (data->dready_trig) |
| 1602 | 1601 | iio_trigger_unregister(data->dready_trig); |
| @@ -1618,8 +1617,8 @@ static int kxcjk1013_remove(struct i2c_client *client) · 15 unmodified lines | ||
| 1618 | 1617 | pm_runtime_disable(&client->dev); |
| 1619 | 1618 | pm_runtime_set_suspended(&client->dev); |
| 1620 | 1619 | |
| 1620 | + iio_triggered_buffer_cleanup(indio_dev); | |
| 1621 | 1621 | if (data->dready_trig) { |
| 1622 | − iio_triggered_buffer_cleanup(indio_dev); | |
| 1623 | 1622 | iio_trigger_unregister(data->dready_trig); |
| 1624 | 1623 | iio_trigger_unregister(data->motion_trig); |
| 1625 | 1624 | } |
| @@ -224,14 +224,14 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p) · 223 unmodified lines | ||
| 224 | 224 | hw_values.chan, |
| 225 | 225 | sizeof(hw_values.chan)); |
| 226 | 226 | if (ret) { |
| 227 | − dev_err(st->dev, | |
| 228 | − "error reading data\n"); | |
| 229 | − return ret; | |
| 227 | + dev_err(st->dev, "error reading data: %d\n", ret); | |
| 228 | + goto out; | |
| 230 | 229 | } |
| 231 | 230 | |
| 232 | 231 | iio_push_to_buffers_with_timestamp(indio_dev, |
| 233 | 232 | &hw_values, |
| 234 | 233 | iio_get_time_ns(indio_dev)); |
| 234 | +out: | |
| 235 | 235 | iio_trigger_notify_done(indio_dev->trig); |
| 236 | 236 | |
| 237 | 237 | return IRQ_HANDLED; |
| @@ -1470,7 +1470,7 @@ static int mma8452_trigger_setup(struct iio_dev *indio_dev) · 1469 unmodified lines | ||
| 1470 | 1470 | if (ret) |
| 1471 | 1471 | return ret; |
| 1472 | 1472 | |
| 1473 | − indio_dev->trig = trig; | |
| 1473 | + indio_dev->trig = iio_trigger_get(trig); | |
| 1474 | 1474 | |
| 1475 | 1475 | return 0; |
| 1476 | 1476 | } |
| @@ -532,7 +532,7 @@ config IMX7D_ADC · 531 unmodified lines | ||
| 532 | 532 | |
| 533 | 533 | config IMX8QXP_ADC |
| 534 | 534 | tristate "NXP IMX8QXP ADC driver" |
| 535 | − depends on ARCH_MXC_ARM64 || COMPILE_TEST | |
| 535 | + depends on ARCH_MXC || COMPILE_TEST | |
| 536 | 536 | depends on HAS_IOMEM |
| 537 | 537 | help |
| 538 | 538 | Say yes here to build support for IMX8QXP ADC. |
| @@ -480,8 +480,8 @@ static irqreturn_t ad7768_trigger_handler(int irq, void *p) · 479 unmodified lines | ||
| 480 | 480 | iio_push_to_buffers_with_timestamp(indio_dev, &st->data.scan, |
| 481 | 481 | iio_get_time_ns(indio_dev)); |
| 482 | 482 | |
| 483 | − iio_trigger_notify_done(indio_dev->trig); | |
| 484 | 483 | err_unlock: |
| 484 | + iio_trigger_notify_done(indio_dev->trig); | |
| 485 | 485 | mutex_unlock(&st->lock); |
| 486 | 486 | |
| 487 | 487 | return IRQ_HANDLED; |
| @@ -1586,7 +1586,8 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, · 1585 unmodified lines | ||
| 1586 | 1586 | *val = st->conversion_value; |
| 1587 | 1587 | ret = at91_adc_adjust_val_osr(st, val); |
| 1588 | 1588 | if (chan->scan_type.sign == 's') |
| 1589 | − *val = sign_extend32(*val, 11); | |
| 1589 | + *val = sign_extend32(*val, | |
| 1590 | + chan->scan_type.realbits - 1); | |
| 1590 | 1591 | st->conversion_done = false; |
| 1591 | 1592 | } |
| 1592 | 1593 | |
| @@ -251,19 +251,8 @@ static int axp22x_adc_raw(struct iio_dev *indio_dev, · 250 unmodified lines | ||
| 251 | 251 | struct iio_chan_spec const *chan, int *val) |
| 252 | 252 | { |
| 253 | 253 | struct axp20x_adc_iio *info = iio_priv(indio_dev); |
| 254 | − int size; | |
| 255 | 254 | |
| 256 | − /* | |
| 257 | − * N.B.: Unlike the Chinese datasheets tell, the charging current is | |
| 258 | − * stored on 12 bits, not 13 bits. Only discharging current is on 13 | |
| 259 | − * bits. | |
| 260 | − */ | |
| 261 | − if (chan->type == IIO_CURRENT && chan->channel == AXP22X_BATT_DISCHRG_I) | |
| 262 | − size = 13; | |
| 263 | − else | |
| 264 | − size = 12; | |
| 265 | − | |
| 266 | − *val = axp20x_read_variable_width(info->regmap, chan->address, size); | |
| 255 | + *val = axp20x_read_variable_width(info->regmap, chan->address, 12); | |
| 267 | 256 | if (*val < 0) |
| 268 | 257 | return *val; |
| 269 | 258 | |
| @@ -386,9 +375,8 @@ static int axp22x_adc_scale(struct iio_chan_spec const *chan, int *val, · 116 unmodified lines | ||
| 386 | 375 | return IIO_VAL_INT_PLUS_MICRO; |
| 387 | 376 | |
| 388 | 377 | case IIO_CURRENT: |
| 389 | − *val = 0; | |
| 390 | − *val2 = 500000; | |
| 391 | − return IIO_VAL_INT_PLUS_MICRO; | |
| 378 | + *val = 1; | |
| 379 | + return IIO_VAL_INT; | |
| 392 | 380 | |
| 393 | 381 | case IIO_TEMP: |
| 394 | 382 | *val = 100; |
| @@ -248,7 +248,6 @@ static int dln2_adc_set_chan_period(struct dln2_adc *dln2, · 247 unmodified lines | ||
| 248 | 248 | static int dln2_adc_read(struct dln2_adc *dln2, unsigned int channel) |
| 249 | 249 | { |
| 250 | 250 | int ret, i; |
| 251 | − struct iio_dev *indio_dev = platform_get_drvdata(dln2->pdev); | |
| 252 | 251 | u16 conflict; |
| 253 | 252 | __le16 value; |
| 254 | 253 | int olen = sizeof(value); |
| @@ -257,13 +256,9 @@ static int dln2_adc_read(struct dln2_adc *dln2, unsigned int channel) · 2 unmodified lines | ||
| 257 | 256 | .chan = channel, |
| 258 | 257 | }; |
| 259 | 258 | |
| 260 | − ret = iio_device_claim_direct_mode(indio_dev); | |
| 261 | − if (ret < 0) | |
| 262 | − return ret; | |
| 263 | − | |
| 264 | 259 | ret = dln2_adc_set_chan_enabled(dln2, channel, true); |
| 265 | 260 | if (ret < 0) |
| 266 | − goto release_direct; | |
| 261 | + return ret; | |
| 267 | 262 | |
| 268 | 263 | ret = dln2_adc_set_port_enabled(dln2, true, &conflict); |
| 269 | 264 | if (ret < 0) { |
| @@ -300,8 +295,6 @@ disable_port: · 30 unmodified lines | ||
| 300 | 295 | dln2_adc_set_port_enabled(dln2, false, NULL); |
| 301 | 296 | disable_chan: |
| 302 | 297 | dln2_adc_set_chan_enabled(dln2, channel, false); |
| 303 | −release_direct: | |
| 304 | − iio_device_release_direct_mode(indio_dev); | |
| 305 | 298 | |
| 306 | 299 | return ret; |
| 307 | 300 | } |
| @@ -337,10 +330,16 @@ static int dln2_adc_read_raw(struct iio_dev *indio_dev, · 29 unmodified lines | ||
| 337 | 330 | |
| 338 | 331 | switch (mask) { |
| 339 | 332 | case IIO_CHAN_INFO_RAW: |
| 333 | + ret = iio_device_claim_direct_mode(indio_dev); | |
| 334 | + if (ret < 0) | |
| 335 | + return ret; | |
| 336 | + | |
| 340 | 337 | mutex_lock(&dln2->mutex); |
| 341 | 338 | ret = dln2_adc_read(dln2, chan->channel); |
| 342 | 339 | mutex_unlock(&dln2->mutex); |
| 343 | 340 | |
| 341 | + iio_device_release_direct_mode(indio_dev); | |
| 342 | + | |
| 344 | 343 | if (ret < 0) |
| 345 | 344 | return ret; |
| 346 | 345 | |
| @@ -656,7 +655,11 @@ static int dln2_adc_probe(struct platform_device *pdev) · 309 unmodified lines | ||
| 656 | 655 | return -ENOMEM; |
| 657 | 656 | } |
| 658 | 657 | iio_trigger_set_drvdata(dln2->trig, dln2); |
| 659 | − devm_iio_trigger_register(dev, dln2->trig); | |
| 658 | + ret = devm_iio_trigger_register(dev, dln2->trig); | |
| 659 | + if (ret) { | |
| 660 | + dev_err(dev, "failed to register trigger: %d\n", ret); | |
| 661 | + return ret; | |
| 662 | + } | |
| 660 | 663 | iio_trigger_set_immutable(indio_dev, dln2->trig); |
| 661 | 664 | |
| 662 | 665 | ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, |
| @@ -1117,6 +1117,7 @@ static void stm32h7_adc_unprepare(struct iio_dev *indio_dev) · 1116 unmodified lines | ||
| 1117 | 1117 | { |
| 1118 | 1118 | struct stm32_adc *adc = iio_priv(indio_dev); |
| 1119 | 1119 | |
| 1120 | + stm32_adc_writel(adc, STM32H7_ADC_PCSEL, 0); | |
| 1120 | 1121 | stm32h7_adc_disable(indio_dev); |
| 1121 | 1122 | stm32_adc_int_ch_disable(adc); |
| 1122 | 1123 | stm32h7_adc_enter_pwr_down(adc); |
| @@ -1986,7 +1987,7 @@ static int stm32_adc_populate_int_ch(struct iio_dev *indio_dev, const char *ch_n · 863 unmodified lines | ||
| 1986 | 1987 | /* Get calibration data for vrefint channel */ |
| 1987 | 1988 | ret = nvmem_cell_read_u16(&indio_dev->dev, "vrefint", &vrefint); |
| 1988 | 1989 | if (ret && ret != -ENOENT) { |
| 1989 | − return dev_err_probe(&indio_dev->dev, ret, | |
| 1990 | + return dev_err_probe(indio_dev->dev.parent, ret, | |
| 1990 | 1991 | "nvmem access error\n"); |
| 1991 | 1992 | } |
| 1992 | 1993 | if (ret == -ENOENT) |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | #include <linux/bitfield.h> |
| 10 | +#include <linux/bitops.h> | |
| 10 | 11 | #include <linux/delay.h> |
| 11 | 12 | #include <linux/device.h> |
| 12 | 13 | #include <linux/kernel.h> |
| @@ -124,7 +125,7 @@ static int adxrs290_get_rate_data(struct iio_dev *indio_dev, const u8 cmd, int * · 111 unmodified lines | ||
| 124 | 125 | goto err_unlock; |
| 125 | 126 | } |
| 126 | 127 | |
| 127 | − *val = temp; | |
| 128 | + *val = sign_extend32(temp, 15); | |
| 128 | 129 | |
| 129 | 130 | err_unlock: |
| 130 | 131 | mutex_unlock(&st->lock); |
| @@ -146,7 +147,7 @@ static int adxrs290_get_temp_data(struct iio_dev *indio_dev, int *val) · 15 unmodified lines | ||
| 146 | 147 | } |
| 147 | 148 | |
| 148 | 149 | /* extract lower 12 bits temperature reading */ |
| 149 | − *val = temp & 0x0FFF; | |
| 150 | + *val = sign_extend32(temp, 11); | |
| 150 | 151 | |
| 151 | 152 | err_unlock: |
| 152 | 153 | mutex_unlock(&st->lock); |
| @@ -61,9 +61,9 @@ static irqreturn_t itg3200_trigger_handler(int irq, void *p) · 60 unmodified lines | ||
| 61 | 61 | |
| 62 | 62 | iio_push_to_buffers_with_timestamp(indio_dev, &scan, pf->timestamp); |
| 63 | 63 | |
| 64 | +error_ret: | |
| 64 | 65 | iio_trigger_notify_done(indio_dev->trig); |
| 65 | 66 | |
| 66 | −error_ret: | |
| 67 | 67 | return IRQ_HANDLED; |
| 68 | 68 | } |
| 69 | 69 | |
| @@ -556,7 +556,6 @@ struct iio_trigger *viio_trigger_alloc(struct device *parent, · 555 unmodified lines | ||
| 556 | 556 | irq_modify_status(trig->subirq_base + i, |
| 557 | 557 | IRQ_NOREQUEST | IRQ_NOAUTOEN, IRQ_NOPROBE); |
| 558 | 558 | } |
| 559 | − get_device(&trig->dev); | |
| 560 | 559 | |
| 561 | 560 | return trig; |
| 562 | 561 | |
| @@ -1275,7 +1275,7 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) · 1274 unmodified lines | ||
| 1275 | 1275 | ret = regmap_bulk_read(data->regmap, LTR501_ALS_DATA1, |
| 1276 | 1276 | als_buf, sizeof(als_buf)); |
| 1277 | 1277 | if (ret < 0) |
| 1278 | − return ret; | |
| 1278 | + goto done; | |
| 1279 | 1279 | if (test_bit(0, indio_dev->active_scan_mask)) |
| 1280 | 1280 | scan.channels[j++] = le16_to_cpu(als_buf[1]); |
| 1281 | 1281 | if (test_bit(1, indio_dev->active_scan_mask)) |
| @@ -546,9 +546,8 @@ static irqreturn_t stk3310_irq_event_handler(int irq, void *private) · 545 unmodified lines | ||
| 546 | 546 | mutex_lock(&data->lock); |
| 547 | 547 | ret = regmap_field_read(data->reg_flag_nf, &dir); |
| 548 | 548 | if (ret < 0) { |
| 549 | − dev_err(&data->client->dev, "register read failed\n"); | |
| 550 | − mutex_unlock(&data->lock); | |
| 551 | − return ret; | |
| 549 | + dev_err(&data->client->dev, "register read failed: %d\n", ret); | |
| 550 | + goto out; | |
| 552 | 551 | } |
| 553 | 552 | event = IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 1, |
| 554 | 553 | IIO_EV_TYPE_THRESH, |
| @@ -560,6 +559,7 @@ static irqreturn_t stk3310_irq_event_handler(int irq, void *private) · 5 unmodified lines | ||
| 560 | 559 | ret = regmap_field_write(data->reg_flag_psint, 0); |
| 561 | 560 | if (ret < 0) |
| 562 | 561 | dev_err(&data->client->dev, "failed to reset interrupts\n"); |
| 562 | +out: | |
| 563 | 563 | mutex_unlock(&data->lock); |
| 564 | 564 | |
| 565 | 565 | return IRQ_HANDLED; |
| @@ -912,6 +912,6 @@ static struct platform_driver stm32_timer_trigger_driver = { · 911 unmodified lines | ||
| 912 | 912 | }; |
| 913 | 913 | module_platform_driver(stm32_timer_trigger_driver); |
| 914 | 914 | |
| 915 | −MODULE_ALIAS("platform: stm32-timer-trigger"); | |
| 915 | +MODULE_ALIAS("platform:stm32-timer-trigger"); | |
| 916 | 916 | MODULE_DESCRIPTION("STMicroelectronics STM32 Timer Trigger driver"); |
| 917 | 917 | MODULE_LICENSE("GPL v2"); |
| @@ -8415,6 +8415,8 @@ static void receive_interrupt_common(struct hfi1_ctxtdata *rcd) · 8414 unmodified lines | ||
| 8415 | 8415 | */ |
| 8416 | 8416 | static void __hfi1_rcd_eoi_intr(struct hfi1_ctxtdata *rcd) |
| 8417 | 8417 | { |
| 8418 | + if (!rcd->rcvhdrq) | |
| 8419 | + return; | |
| 8418 | 8420 | clear_recv_intr(rcd); |
| 8419 | 8421 | if (check_packet_present(rcd)) |
| 8420 | 8422 | force_recv_intr(rcd); |
| @@ -1012,6 +1012,8 @@ int handle_receive_interrupt(struct hfi1_ctxtdata *rcd, int thread) · 1011 unmodified lines | ||
| 1012 | 1012 | struct hfi1_packet packet; |
| 1013 | 1013 | int skip_pkt = 0; |
| 1014 | 1014 | |
| 1015 | + if (!rcd->rcvhdrq) | |
| 1016 | + return RCV_PKT_OK; | |
| 1015 | 1017 | /* Control context will always use the slow path interrupt handler */ |
| 1016 | 1018 | needset = (rcd->ctxt == HFI1_CTRL_CTXT) ? 0 : 1; |
| 1017 | 1019 | |
| @@ -113,7 +113,6 @@ static int hfi1_create_kctxt(struct hfi1_devdata *dd, · 112 unmodified lines | ||
| 113 | 113 | rcd->fast_handler = get_dma_rtail_setting(rcd) ? |
| 114 | 114 | handle_receive_interrupt_dma_rtail : |
| 115 | 115 | handle_receive_interrupt_nodma_rtail; |
| 116 | − rcd->slow_handler = handle_receive_interrupt; | |
| 117 | 116 | |
| 118 | 117 | hfi1_set_seq_cnt(rcd, 1); |
| 119 | 118 | |
| @@ -334,6 +333,8 @@ int hfi1_create_ctxtdata(struct hfi1_pportdata *ppd, int numa, · 214 unmodified lines | ||
| 334 | 333 | rcd->numa_id = numa; |
| 335 | 334 | rcd->rcv_array_groups = dd->rcv_entries.ngroups; |
| 336 | 335 | rcd->rhf_rcv_function_map = normal_rhf_rcv_functions; |
| 336 | + rcd->slow_handler = handle_receive_interrupt; | |
| 337 | + rcd->do_interrupt = rcd->slow_handler; | |
| 337 | 338 | rcd->msix_intr = CCE_NUM_MSIX_VECTORS; |
| 338 | 339 | |
| 339 | 340 | mutex_init(&rcd->exp_mutex); |
| @@ -874,18 +875,6 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) · 534 unmodified lines | ||
| 874 | 875 | if (ret) |
| 875 | 876 | goto done; |
| 876 | 877 | |
| 877 | − /* allocate dummy tail memory for all receive contexts */ | |
| 878 | − dd->rcvhdrtail_dummy_kvaddr = dma_alloc_coherent(&dd->pcidev->dev, | |
| 879 | − sizeof(u64), | |
| 880 | − &dd->rcvhdrtail_dummy_dma, | |
| 881 | − GFP_KERNEL); | |
| 882 | − | |
| 883 | − if (!dd->rcvhdrtail_dummy_kvaddr) { | |
| 884 | − dd_dev_err(dd, "cannot allocate dummy tail memory\n"); | |
| 885 | − ret = -ENOMEM; | |
| 886 | − goto done; | |
| 887 | − } | |
| 888 | − | |
| 889 | 878 | /* dd->rcd can be NULL if early initialization failed */ |
| 890 | 879 | for (i = 0; dd->rcd && i < dd->first_dyn_alloc_ctxt; ++i) { |
| 891 | 880 | /* |
| @@ -898,8 +887,6 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit) · 6 unmodified lines | ||
| 898 | 887 | if (!rcd) |
| 899 | 888 | continue; |
| 900 | 889 | |
| 901 | − rcd->do_interrupt = &handle_receive_interrupt; | |
| 902 | − | |
| 903 | 890 | lastfail = hfi1_create_rcvhdrq(dd, rcd); |
| 904 | 891 | if (!lastfail) |
| 905 | 892 | lastfail = hfi1_setup_eagerbufs(rcd); |
| @@ -1120,7 +1107,7 @@ void hfi1_free_ctxtdata(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd) · 214 unmodified lines | ||
| 1120 | 1107 | rcd->egrbufs.rcvtids = NULL; |
| 1121 | 1108 | |
| 1122 | 1109 | for (e = 0; e < rcd->egrbufs.alloced; e++) { |
| 1123 | − if (rcd->egrbufs.buffers[e].dma) | |
| 1110 | + if (rcd->egrbufs.buffers[e].addr) | |
| 1124 | 1111 | dma_free_coherent(&dd->pcidev->dev, |
| 1125 | 1112 | rcd->egrbufs.buffers[e].len, |
| 1126 | 1113 | rcd->egrbufs.buffers[e].addr, |
| @@ -1201,6 +1188,11 @@ void hfi1_free_devdata(struct hfi1_devdata *dd) · 74 unmodified lines | ||
| 1201 | 1188 | dd->tx_opstats = NULL; |
| 1202 | 1189 | kfree(dd->comp_vect); |
| 1203 | 1190 | dd->comp_vect = NULL; |
| 1191 | + if (dd->rcvhdrtail_dummy_kvaddr) | |
| 1192 | + dma_free_coherent(&dd->pcidev->dev, sizeof(u64), | |
| 1193 | + (void *)dd->rcvhdrtail_dummy_kvaddr, | |
| 1194 | + dd->rcvhdrtail_dummy_dma); | |
| 1195 | + dd->rcvhdrtail_dummy_kvaddr = NULL; | |
| 1204 | 1196 | sdma_clean(dd, dd->num_sdma); |
| 1205 | 1197 | rvt_dealloc_device(&dd->verbs_dev.rdi); |
| 1206 | 1198 | } |
| @@ -1298,6 +1290,15 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, · 91 unmodified lines | ||
| 1298 | 1290 | goto bail; |
| 1299 | 1291 | } |
| 1300 | 1292 | |
| 1293 | + /* allocate dummy tail memory for all receive contexts */ | |
| 1294 | + dd->rcvhdrtail_dummy_kvaddr = | |
| 1295 | + dma_alloc_coherent(&dd->pcidev->dev, sizeof(u64), | |
| 1296 | + &dd->rcvhdrtail_dummy_dma, GFP_KERNEL); | |
| 1297 | + if (!dd->rcvhdrtail_dummy_kvaddr) { | |
| 1298 | + ret = -ENOMEM; | |
| 1299 | + goto bail; | |
| 1300 | + } | |
| 1301 | + | |
| 1301 | 1302 | atomic_set(&dd->ipoib_rsm_usr_num, 0); |
| 1302 | 1303 | return dd; |
| 1303 | 1304 | |
| @@ -1505,13 +1506,6 @@ static void cleanup_device_data(struct hfi1_devdata *dd) · 201 unmodified lines | ||
| 1505 | 1506 | |
| 1506 | 1507 | free_credit_return(dd); |
| 1507 | 1508 | |
| 1508 | − if (dd->rcvhdrtail_dummy_kvaddr) { | |
| 1509 | − dma_free_coherent(&dd->pcidev->dev, sizeof(u64), | |
| 1510 | − (void *)dd->rcvhdrtail_dummy_kvaddr, | |
| 1511 | − dd->rcvhdrtail_dummy_dma); | |
| 1512 | − dd->rcvhdrtail_dummy_kvaddr = NULL; | |
| 1513 | − } | |
| 1514 | − | |
| 1515 | 1509 | /* |
| 1516 | 1510 | * Free any resources still in use (usually just kernel contexts) |
| 1517 | 1511 | * at unload; we do for ctxtcnt, because that's what we allocate. |
| @@ -838,8 +838,8 @@ struct sdma_engine *sdma_select_user_engine(struct hfi1_devdata *dd, · 837 unmodified lines | ||
| 838 | 838 | if (current->nr_cpus_allowed != 1) |
| 839 | 839 | goto out; |
| 840 | 840 | |
| 841 | − cpu_id = smp_processor_id(); | |
| 842 | 841 | rcu_read_lock(); |
| 842 | + cpu_id = smp_processor_id(); | |
| 843 | 843 | rht_node = rhashtable_lookup(dd->sdma_rht, &cpu_id, |
| 844 | 844 | sdma_rht_params); |
| 845 | 845 | |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #include <linux/acpi.h> |
| 34 | 34 | #include <linux/etherdevice.h> |
| 35 | 35 | #include <linux/interrupt.h> |
| 36 | +#include <linux/iopoll.h> | |
| 36 | 37 | #include <linux/kernel.h> |
| 37 | 38 | #include <linux/types.h> |
| 38 | 39 | #include <net/addrconf.h> |
| @@ -1050,9 +1051,14 @@ static u32 hns_roce_v2_cmd_hw_resetting(struct hns_roce_dev *hr_dev, · 1011 unmodified lines | ||
| 1050 | 1051 | unsigned long instance_stage, |
| 1051 | 1052 | unsigned long reset_stage) |
| 1052 | 1053 | { |
| 1054 | +#define HW_RESET_TIMEOUT_US 1000000 | |
| 1055 | +#define HW_RESET_SLEEP_US 1000 | |
| 1056 | + | |
| 1053 | 1057 | struct hns_roce_v2_priv *priv = hr_dev->priv; |
| 1054 | 1058 | struct hnae3_handle *handle = priv->handle; |
| 1055 | 1059 | const struct hnae3_ae_ops *ops = handle->ae_algo->ops; |
| 1060 | + unsigned long val; | |
| 1061 | + int ret; | |
| 1056 | 1062 | |
| 1057 | 1063 | /* When hardware reset is detected, we should stop sending mailbox&cmq& |
| 1058 | 1064 | * doorbell to hardware. If now in .init_instance() function, we should |
| @@ -1064,7 +1070,11 @@ static u32 hns_roce_v2_cmd_hw_resetting(struct hns_roce_dev *hr_dev, · 5 unmodified lines | ||
| 1064 | 1070 | * again. |
| 1065 | 1071 | */ |
| 1066 | 1072 | hr_dev->dis_db = true; |
| 1067 | − if (!ops->get_hw_reset_stat(handle)) | |
| 1073 | + | |
| 1074 | + ret = read_poll_timeout(ops->ae_dev_reset_cnt, val, | |
| 1075 | + val > hr_dev->reset_cnt, HW_RESET_SLEEP_US, | |
| 1076 | + HW_RESET_TIMEOUT_US, false, handle); | |
| 1077 | + if (!ret) | |
| 1068 | 1078 | hr_dev->is_reset = true; |
| 1069 | 1079 | |
| 1070 | 1080 | if (!hr_dev->is_reset || reset_stage == HNS_ROCE_STATE_RST_INIT || |
| @@ -6387,10 +6397,8 @@ static int hns_roce_hw_v2_reset_notify_down(struct hnae3_handle *handle) · 5316 unmodified lines | ||
| 6387 | 6397 | if (!hr_dev) |
| 6388 | 6398 | return 0; |
| 6389 | 6399 | |
| 6390 | − hr_dev->is_reset = true; | |
| 6391 | 6400 | hr_dev->active = false; |
| 6392 | 6401 | hr_dev->dis_db = true; |
| 6393 | − | |
| 6394 | 6402 | hr_dev->state = HNS_ROCE_DEVICE_STATE_RST_DOWN; |
| 6395 | 6403 | |
| 6396 | 6404 | return 0; |
| @@ -60,6 +60,8 @@ static void irdma_iwarp_ce_handler(struct irdma_sc_cq *iwcq) · 59 unmodified lines | ||
| 60 | 60 | { |
| 61 | 61 | struct irdma_cq *cq = iwcq->back_cq; |
| 62 | 62 | |
| 63 | + if (!cq->user_mode) | |
| 64 | + cq->armed = false; | |
| 63 | 65 | if (cq->ibcq.comp_handler) |
| 64 | 66 | cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context); |
| 65 | 67 | } |
| @@ -146,6 +148,7 @@ static void irdma_set_flush_fields(struct irdma_sc_qp *qp, · 80 unmodified lines | ||
| 146 | 148 | qp->flush_code = FLUSH_PROT_ERR; |
| 147 | 149 | break; |
| 148 | 150 | case IRDMA_AE_AMP_BAD_QP: |
| 151 | + case IRDMA_AE_WQE_UNEXPECTED_OPCODE: | |
| 149 | 152 | qp->flush_code = FLUSH_LOC_QP_OP_ERR; |
| 150 | 153 | break; |
| 151 | 154 | case IRDMA_AE_AMP_BAD_STAG_KEY: |
| @@ -156,7 +159,6 @@ static void irdma_set_flush_fields(struct irdma_sc_qp *qp, · 4 unmodified lines | ||
| 156 | 159 | case IRDMA_AE_PRIV_OPERATION_DENIED: |
| 157 | 160 | case IRDMA_AE_IB_INVALID_REQUEST: |
| 158 | 161 | case IRDMA_AE_IB_REMOTE_ACCESS_ERROR: |
| 159 | − case IRDMA_AE_IB_REMOTE_OP_ERROR: | |
| 160 | 162 | qp->flush_code = FLUSH_REM_ACCESS_ERR; |
| 161 | 163 | qp->event_type = IRDMA_QP_EVENT_ACCESS_ERR; |
| 162 | 164 | break; |
| @@ -184,6 +186,9 @@ static void irdma_set_flush_fields(struct irdma_sc_qp *qp, · 21 unmodified lines | ||
| 184 | 186 | case IRDMA_AE_AMP_MWBIND_INVALID_BOUNDS: |
| 185 | 187 | qp->flush_code = FLUSH_MW_BIND_ERR; |
| 186 | 188 | break; |
| 189 | + case IRDMA_AE_IB_REMOTE_OP_ERROR: | |
| 190 | + qp->flush_code = FLUSH_REM_OP_ERR; | |
| 191 | + break; | |
| 187 | 192 | default: |
| 188 | 193 | qp->flush_code = FLUSH_FATAL_ERR; |
| 189 | 194 | break; |
| @@ -542,6 +542,7 @@ int irdma_ah_cqp_op(struct irdma_pci_f *rf, struct irdma_sc_ah *sc_ah, u8 cmd, · 541 unmodified lines | ||
| 542 | 542 | void (*callback_fcn)(struct irdma_cqp_request *cqp_request), |
| 543 | 543 | void *cb_param); |
| 544 | 544 | void irdma_gsi_ud_qp_ah_cb(struct irdma_cqp_request *cqp_request); |
| 545 | +bool irdma_cq_empty(struct irdma_cq *iwcq); | |
| 545 | 546 | int irdma_inetaddr_event(struct notifier_block *notifier, unsigned long event, |
| 546 | 547 | void *ptr); |
| 547 | 548 | int irdma_inet6addr_event(struct notifier_block *notifier, unsigned long event, |
| @@ -25,8 +25,7 @@ void irdma_destroy_pble_prm(struct irdma_hmc_pble_rsrc *pble_rsrc) · 24 unmodified lines | ||
| 25 | 25 | list_del(&chunk->list); |
| 26 | 26 | if (chunk->type == PBLE_SD_PAGED) |
| 27 | 27 | irdma_pble_free_paged_mem(chunk); |
| 28 | − if (chunk->bitmapbuf) | |
| 29 | − kfree(chunk->bitmapmem.va); | |
| 28 | + bitmap_free(chunk->bitmapbuf); | |
| 30 | 29 | kfree(chunk->chunkmem.va); |
| 31 | 30 | } |
| 32 | 31 | } |
| @@ -283,7 +282,6 @@ add_pble_prm(struct irdma_hmc_pble_rsrc *pble_rsrc) · 250 unmodified lines | ||
| 283 | 282 | "PBLE: next_fpm_addr = %llx chunk_size[%llu] = 0x%llx\n", |
| 284 | 283 | pble_rsrc->next_fpm_addr, chunk->size, chunk->size); |
| 285 | 284 | pble_rsrc->unallocated_pble -= (u32)(chunk->size >> 3); |
| 286 | − list_add(&chunk->list, &pble_rsrc->pinfo.clist); | |
| 287 | 285 | sd_reg_val = (sd_entry_type == IRDMA_SD_TYPE_PAGED) ? |
| 288 | 286 | sd_entry->u.pd_table.pd_page_addr.pa : |
| 289 | 287 | sd_entry->u.bp.addr.pa; |
| @@ -295,12 +293,12 @@ add_pble_prm(struct irdma_hmc_pble_rsrc *pble_rsrc) · 5 unmodified lines | ||
| 295 | 293 | goto error; |
| 296 | 294 | } |
| 297 | 295 | |
| 296 | + list_add(&chunk->list, &pble_rsrc->pinfo.clist); | |
| 298 | 297 | sd_entry->valid = true; |
| 299 | 298 | return 0; |
| 300 | 299 | |
| 301 | 300 | error: |
| 302 | − if (chunk->bitmapbuf) | |
| 303 | − kfree(chunk->bitmapmem.va); | |
| 301 | + bitmap_free(chunk->bitmapbuf); | |
| 304 | 302 | kfree(chunk->chunkmem.va); |
| 305 | 303 | |
| 306 | 304 | return ret_code; |
| @@ -78,7 +78,6 @@ struct irdma_chunk { · 77 unmodified lines | ||
| 78 | 78 | u32 pg_cnt; |
| 79 | 79 | enum irdma_alloc_type type; |
| 80 | 80 | struct irdma_sc_dev *dev; |
| 81 | − struct irdma_virt_mem bitmapmem; | |
| 82 | 81 | struct irdma_virt_mem chunkmem; |
| 83 | 82 | }; |
| 84 | 83 | |
| @@ -2239,15 +2239,10 @@ enum irdma_status_code irdma_prm_add_pble_mem(struct irdma_pble_prm *pprm, · 2238 unmodified lines | ||
| 2239 | 2239 | |
| 2240 | 2240 | sizeofbitmap = (u64)pchunk->size >> pprm->pble_shift; |
| 2241 | 2241 | |
| 2242 | − pchunk->bitmapmem.size = sizeofbitmap >> 3; | |
| 2243 | − pchunk->bitmapmem.va = kzalloc(pchunk->bitmapmem.size, GFP_KERNEL); | |
| 2244 | − | |
| 2245 | − if (!pchunk->bitmapmem.va) | |
| 2242 | + pchunk->bitmapbuf = bitmap_zalloc(sizeofbitmap, GFP_KERNEL); | |
| 2243 | + if (!pchunk->bitmapbuf) | |
| 2246 | 2244 | return IRDMA_ERR_NO_MEMORY; |
| 2247 | 2245 | |
| 2248 | − pchunk->bitmapbuf = pchunk->bitmapmem.va; | |
| 2249 | − bitmap_zero(pchunk->bitmapbuf, sizeofbitmap); | |
| 2250 | − | |
| 2251 | 2246 | pchunk->sizeofbitmap = sizeofbitmap; |
| 2252 | 2247 | /* each pble is 8 bytes hence shift by 3 */ |
| 2253 | 2248 | pprm->total_pble_alloc += pchunk->size >> 3; |
| @@ -2491,3 +2486,18 @@ void irdma_ib_qp_event(struct irdma_qp *iwqp, enum irdma_qp_event_type event) · 237 unmodified lines | ||
| 2491 | 2486 | ibevent.element.qp = &iwqp->ibqp; |
| 2492 | 2487 | iwqp->ibqp.event_handler(&ibevent, iwqp->ibqp.qp_context); |
| 2493 | 2488 | } |
| 2489 | + | |
| 2490 | +bool irdma_cq_empty(struct irdma_cq *iwcq) | |
| 2491 | +{ | |
| 2492 | + struct irdma_cq_uk *ukcq; | |
| 2493 | + u64 qword3; | |
| 2494 | + __le64 *cqe; | |
| 2495 | + u8 polarity; | |
| 2496 | + | |
| 2497 | + ukcq = &iwcq->sc_cq.cq_uk; | |
| 2498 | + cqe = IRDMA_GET_CURRENT_CQ_ELEM(ukcq); | |
| 2499 | + get_64bit_val(cqe, 24, &qword3); | |
| 2500 | + polarity = (u8)FIELD_GET(IRDMA_CQ_VALID, qword3); | |
| 2501 | + | |
| 2502 | + return polarity != ukcq->polarity; | |
| 2503 | +} | |
| @@ -3584,18 +3584,31 @@ static int irdma_req_notify_cq(struct ib_cq *ibcq, · 3583 unmodified lines | ||
| 3584 | 3584 | struct irdma_cq *iwcq; |
| 3585 | 3585 | struct irdma_cq_uk *ukcq; |
| 3586 | 3586 | unsigned long flags; |
| 3587 | − enum irdma_cmpl_notify cq_notify = IRDMA_CQ_COMPL_EVENT; | |
| 3587 | + enum irdma_cmpl_notify cq_notify; | |
| 3588 | + bool promo_event = false; | |
| 3589 | + int ret = 0; | |
| 3588 | 3590 | |
| 3591 | + cq_notify = notify_flags == IB_CQ_SOLICITED ? | |
| 3592 | + IRDMA_CQ_COMPL_SOLICITED : IRDMA_CQ_COMPL_EVENT; | |
| 3589 | 3593 | iwcq = to_iwcq(ibcq); |
| 3590 | 3594 | ukcq = &iwcq->sc_cq.cq_uk; |
| 3591 | − if (notify_flags == IB_CQ_SOLICITED) | |
| 3592 | − cq_notify = IRDMA_CQ_COMPL_SOLICITED; | |
| 3593 | 3595 | |
| 3594 | 3596 | spin_lock_irqsave(&iwcq->lock, flags); |
| 3595 | − irdma_uk_cq_request_notification(ukcq, cq_notify); | |
| 3597 | + /* Only promote to arm the CQ for any event if the last arm event was solicited. */ | |
| 3598 | + if (iwcq->last_notify == IRDMA_CQ_COMPL_SOLICITED && notify_flags != IB_CQ_SOLICITED) | |
| 3599 | + promo_event = true; | |
| 3600 | + | |
| 3601 | + if (!iwcq->armed || promo_event) { | |
| 3602 | + iwcq->armed = true; | |
| 3603 | + iwcq->last_notify = cq_notify; | |
| 3604 | + irdma_uk_cq_request_notification(ukcq, cq_notify); | |
| 3605 | + } | |
| 3606 | + | |
| 3607 | + if ((notify_flags & IB_CQ_REPORT_MISSED_EVENTS) && !irdma_cq_empty(iwcq)) | |
| 3608 | + ret = 1; | |
| 3596 | 3609 | spin_unlock_irqrestore(&iwcq->lock, flags); |
| 3597 | 3610 | |
| 3598 | − return 0; | |
| 3611 | + return ret; | |
| 3599 | 3612 | } |
| 3600 | 3613 | |
| 3601 | 3614 | static int irdma_roce_port_immutable(struct ib_device *ibdev, u32 port_num, |
| @@ -110,6 +110,8 @@ struct irdma_cq { · 109 unmodified lines | ||
| 110 | 110 | u16 cq_size; |
| 111 | 111 | u16 cq_num; |
| 112 | 112 | bool user_mode; |
| 113 | + bool armed; | |
| 114 | + enum irdma_cmpl_notify last_notify; | |
| 113 | 115 | u32 polled_cmpls; |
| 114 | 116 | u32 cq_mem_size; |
| 115 | 117 | struct irdma_dma_mem kmem; |
| @@ -665,7 +665,6 @@ struct mlx5_ib_mr { · 664 unmodified lines | ||
| 665 | 665 | |
| 666 | 666 | /* User MR data */ |
| 667 | 667 | struct mlx5_cache_ent *cache_ent; |
| 668 | − struct ib_umem *umem; | |
| 669 | 668 | |
| 670 | 669 | /* This is zero'd when the MR is allocated */ |
| 671 | 670 | union { |
| @@ -677,7 +676,7 @@ struct mlx5_ib_mr { · 5 unmodified lines | ||
| 677 | 676 | struct list_head list; |
| 678 | 677 | }; |
| 679 | 678 | |
| 680 | − /* Used only by kernel MRs (umem == NULL) */ | |
| 679 | + /* Used only by kernel MRs */ | |
| 681 | 680 | struct { |
| 682 | 681 | void *descs; |
| 683 | 682 | void *descs_alloc; |
| @@ -698,8 +697,9 @@ struct mlx5_ib_mr { · 14 unmodified lines | ||
| 698 | 697 | int data_length; |
| 699 | 698 | }; |
| 700 | 699 | |
| 701 | − /* Used only by User MRs (umem != NULL) */ | |
| 700 | + /* Used only by User MRs */ | |
| 702 | 701 | struct { |
| 702 | + struct ib_umem *umem; | |
| 703 | 703 | unsigned int page_shift; |
| 704 | 704 | /* Current access_flags */ |
| 705 | 705 | int access_flags; |
| @@ -1904,19 +1904,18 @@ err: · 1903 unmodified lines | ||
| 1904 | 1904 | return ret; |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | −static void | |
| 1908 | −mlx5_free_priv_descs(struct mlx5_ib_mr *mr) | |
| 1907 | +static void mlx5_free_priv_descs(struct mlx5_ib_mr *mr) | |
| 1909 | 1908 | { |
| 1910 | − if (!mr->umem && mr->descs) { | |
| 1911 | − struct ib_device *device = mr->ibmr.device; | |
| 1912 | − int size = mr->max_descs * mr->desc_size; | |
| 1913 | − struct mlx5_ib_dev *dev = to_mdev(device); | |
| 1909 | + struct mlx5_ib_dev *dev = to_mdev(mr->ibmr.device); | |
| 1910 | + int size = mr->max_descs * mr->desc_size; | |
| 1914 | 1911 | |
| 1915 | − dma_unmap_single(&dev->mdev->pdev->dev, mr->desc_map, size, | |
| 1916 | − DMA_TO_DEVICE); | |
| 1917 | − kfree(mr->descs_alloc); | |
| 1918 | − mr->descs = NULL; | |
| 1919 | − } | |
| 1912 | + if (!mr->descs) | |
| 1913 | + return; | |
| 1914 | + | |
| 1915 | + dma_unmap_single(&dev->mdev->pdev->dev, mr->desc_map, size, | |
| 1916 | + DMA_TO_DEVICE); | |
| 1917 | + kfree(mr->descs_alloc); | |
| 1918 | + mr->descs = NULL; | |
| 1920 | 1919 | } |
| 1921 | 1920 | |
| 1922 | 1921 | int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) |
| @@ -1992,7 +1991,8 @@ int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) · 69 unmodified lines | ||
| 1992 | 1991 | if (mr->cache_ent) { |
| 1993 | 1992 | mlx5_mr_cache_free(dev, mr); |
| 1994 | 1993 | } else { |
| 1995 | − mlx5_free_priv_descs(mr); | |
| 1994 | + if (!udata) | |
| 1995 | + mlx5_free_priv_descs(mr); | |
| 1996 | 1996 | kfree(mr); |
| 1997 | 1997 | } |
| 1998 | 1998 | return 0; |
| @@ -2079,7 +2079,6 @@ static struct mlx5_ib_mr *mlx5_ib_alloc_pi_mr(struct ib_pd *pd, · 80 unmodified lines | ||
| 2079 | 2079 | if (err) |
| 2080 | 2080 | goto err_free_in; |
| 2081 | 2081 | |
| 2082 | − mr->umem = NULL; | |
| 2083 | 2082 | kfree(in); |
| 2084 | 2083 | |
| 2085 | 2084 | return mr; |
| @@ -2206,7 +2205,6 @@ static struct ib_mr *__mlx5_ib_alloc_mr(struct ib_pd *pd, · 120 unmodified lines | ||
| 2206 | 2205 | } |
| 2207 | 2206 | |
| 2208 | 2207 | mr->ibmr.device = pd->device; |
| 2209 | − mr->umem = NULL; | |
| 2210 | 2208 | |
| 2211 | 2209 | switch (mr_type) { |
| 2212 | 2210 | case IB_MR_TYPE_MEM_REG: |
| @@ -359,6 +359,7 @@ int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd, · 358 unmodified lines | ||
| 359 | 359 | |
| 360 | 360 | err2: |
| 361 | 361 | rxe_queue_cleanup(qp->sq.queue); |
| 362 | + qp->sq.queue = NULL; | |
| 362 | 363 | err1: |
| 363 | 364 | qp->pd = NULL; |
| 364 | 365 | qp->rcq = NULL; |
| @@ -19,7 +19,7 @@ void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con) · 18 unmodified lines | ||
| 19 | 19 | int cpu; |
| 20 | 20 | |
| 21 | 21 | cpu = raw_smp_processor_id(); |
| 22 | − s = this_cpu_ptr(stats->pcpu_stats); | |
| 22 | + s = get_cpu_ptr(stats->pcpu_stats); | |
| 23 | 23 | if (con->cpu != cpu) { |
| 24 | 24 | s->cpu_migr.to++; |
| 25 | 25 | |
| @@ -27,14 +27,16 @@ void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con) · 1 unmodified line | ||
| 27 | 27 | s = per_cpu_ptr(stats->pcpu_stats, con->cpu); |
| 28 | 28 | atomic_inc(&s->cpu_migr.from); |
| 29 | 29 | } |
| 30 | + put_cpu_ptr(stats->pcpu_stats); | |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | void rtrs_clt_inc_failover_cnt(struct rtrs_clt_stats *stats) |
| 33 | 34 | { |
| 34 | 35 | struct rtrs_clt_stats_pcpu *s; |
| 35 | 36 | |
| 36 | − s = this_cpu_ptr(stats->pcpu_stats); | |
| 37 | + s = get_cpu_ptr(stats->pcpu_stats); | |
| 37 | 38 | s->rdma.failover_cnt++; |
| 39 | + put_cpu_ptr(stats->pcpu_stats); | |
| 38 | 40 | } |
| 39 | 41 | |
| 40 | 42 | int rtrs_clt_stats_migration_from_cnt_to_str(struct rtrs_clt_stats *stats, char *buf) |
| @@ -169,9 +171,10 @@ static inline void rtrs_clt_update_rdma_stats(struct rtrs_clt_stats *stats, · 128 unmodified lines | ||
| 169 | 171 | { |
| 170 | 172 | struct rtrs_clt_stats_pcpu *s; |
| 171 | 173 | |
| 172 | − s = this_cpu_ptr(stats->pcpu_stats); | |
| 174 | + s = get_cpu_ptr(stats->pcpu_stats); | |
| 173 | 175 | s->rdma.dir[d].cnt++; |
| 174 | 176 | s->rdma.dir[d].size_total += size; |
| 177 | + put_cpu_ptr(stats->pcpu_stats); | |
| 175 | 178 | } |
| 176 | 179 | |
| 177 | 180 | void rtrs_clt_update_all_stats(struct rtrs_clt_io_req *req, int dir) |
| @@ -707,7 +707,7 @@ static const struct irq_domain_ops aic_ipi_domain_ops = { · 706 unmodified lines | ||
| 707 | 707 | .free = aic_ipi_free, |
| 708 | 708 | }; |
| 709 | 709 | |
| 710 | −static int aic_init_smp(struct aic_irq_chip *irqc, struct device_node *node) | |
| 710 | +static int __init aic_init_smp(struct aic_irq_chip *irqc, struct device_node *node) | |
| 711 | 711 | { |
| 712 | 712 | struct irq_domain *ipi_domain; |
| 713 | 713 | int base_ipi; |
| @@ -232,16 +232,12 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq, · 231 unmodified lines | ||
| 232 | 232 | int hwirq, i; |
| 233 | 233 | |
| 234 | 234 | mutex_lock(&msi_used_lock); |
| 235 | + hwirq = bitmap_find_free_region(msi_used, PCI_MSI_DOORBELL_NR, | |
| 236 | + order_base_2(nr_irqs)); | |
| 237 | + mutex_unlock(&msi_used_lock); | |
| 235 | 238 | |
| 236 | − hwirq = bitmap_find_next_zero_area(msi_used, PCI_MSI_DOORBELL_NR, | |
| 237 | − 0, nr_irqs, 0); | |
| 238 | − if (hwirq >= PCI_MSI_DOORBELL_NR) { | |
| 239 | − mutex_unlock(&msi_used_lock); | |
| 239 | + if (hwirq < 0) | |
| 240 | 240 | return -ENOSPC; |
| 241 | − } | |
| 242 | − | |
| 243 | − bitmap_set(msi_used, hwirq, nr_irqs); | |
| 244 | − mutex_unlock(&msi_used_lock); | |
| 245 | 241 | |
| 246 | 242 | for (i = 0; i < nr_irqs; i++) { |
| 247 | 243 | irq_domain_set_info(domain, virq + i, hwirq + i, |
| @@ -250,7 +246,7 @@ static int armada_370_xp_msi_alloc(struct irq_domain *domain, unsigned int virq, · 2 unmodified lines | ||
| 250 | 246 | NULL, NULL); |
| 251 | 247 | } |
| 252 | 248 | |
| 253 | − return hwirq; | |
| 249 | + return 0; | |
| 254 | 250 | } |
| 255 | 251 | |
| 256 | 252 | static void armada_370_xp_msi_free(struct irq_domain *domain, |
| @@ -259,7 +255,7 @@ static void armada_370_xp_msi_free(struct irq_domain *domain, · 2 unmodified lines | ||
| 259 | 255 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); |
| 260 | 256 | |
| 261 | 257 | mutex_lock(&msi_used_lock); |
| 262 | − bitmap_clear(msi_used, d->hwirq, nr_irqs); | |
| 258 | + bitmap_release_region(msi_used, d->hwirq, order_base_2(nr_irqs)); | |
| 263 | 259 | mutex_unlock(&msi_used_lock); |
| 264 | 260 | } |
| 265 | 261 | |
| @@ -76,8 +76,8 @@ static void aspeed_scu_ic_irq_handler(struct irq_desc *desc) · 75 unmodified lines | ||
| 76 | 76 | generic_handle_domain_irq(scu_ic->irq_domain, |
| 77 | 77 | bit - scu_ic->irq_shift); |
| 78 | 78 | |
| 79 | − regmap_update_bits(scu_ic->scu, scu_ic->reg, mask, | |
| 80 | − BIT(bit + ASPEED_SCU_IC_STATUS_SHIFT)); | |
| 79 | + regmap_write_bits(scu_ic->scu, scu_ic->reg, mask, | |
| 80 | + BIT(bit + ASPEED_SCU_IC_STATUS_SHIFT)); | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | chained_irq_exit(chip, desc); |
| @@ -238,6 +238,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn, · 237 unmodified lines | ||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | data->num_parent_irqs = platform_irq_count(pdev); |
| 241 | + put_device(&pdev->dev); | |
| 241 | 242 | if (data->num_parent_irqs <= 0) { |
| 242 | 243 | pr_err("invalid number of parent interrupts\n"); |
| 243 | 244 | ret = -ENOMEM; |
| @@ -742,7 +742,7 @@ static struct its_collection *its_build_invall_cmd(struct its_node *its, · 741 unmodified lines | ||
| 742 | 742 | |
| 743 | 743 | its_fixup_cmd(cmd); |
| 744 | 744 | |
| 745 | − return NULL; | |
| 745 | + return desc->its_invall_cmd.col; | |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | static struct its_vpe *its_build_vinvall_cmd(struct its_node *its, |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | #define pr_fmt(fmt) "irq-mips-gic: " fmt |
| 11 | 11 | |
| 12 | +#include <linux/bitfield.h> | |
| 12 | 13 | #include <linux/bitmap.h> |
| 13 | 14 | #include <linux/clocksource.h> |
| 14 | 15 | #include <linux/cpuhotplug.h> |
| @@ -735,8 +736,7 @@ static int __init gic_of_init(struct device_node *node, · 720 unmodified lines | ||
| 735 | 736 | mips_gic_base = ioremap(gic_base, gic_len); |
| 736 | 737 | |
| 737 | 738 | gicconfig = read_gic_config(); |
| 738 | − gic_shared_intrs = gicconfig & GIC_CONFIG_NUMINTERRUPTS; | |
| 739 | − gic_shared_intrs >>= __ffs(GIC_CONFIG_NUMINTERRUPTS); | |
| 739 | + gic_shared_intrs = FIELD_GET(GIC_CONFIG_NUMINTERRUPTS, gicconfig); | |
| 740 | 740 | gic_shared_intrs = (gic_shared_intrs + 1) * 8; |
| 741 | 741 | |
| 742 | 742 | if (cpu_has_veic) { |
| @@ -26,7 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | |
| 27 | 27 | #define NVIC_ISER 0x000 |
| 28 | 28 | #define NVIC_ICER 0x080 |
| 29 | −#define NVIC_IPR 0x300 | |
| 29 | +#define NVIC_IPR 0x400 | |
| 30 | 30 | |
| 31 | 31 | #define NVIC_MAX_BANKS 16 |
| 32 | 32 | /* |
| @@ -1963,7 +1963,7 @@ static bool __journal_read_write(struct dm_integrity_io *dio, struct bio *bio, · 1962 unmodified lines | ||
| 1963 | 1963 | n_sectors -= bv.bv_len >> SECTOR_SHIFT; |
| 1964 | 1964 | bio_advance_iter(bio, &bio->bi_iter, bv.bv_len); |
| 1965 | 1965 | retry_kmap: |
| 1966 | − mem = bvec_kmap_local(&bv); | |
| 1966 | + mem = kmap_local_page(bv.bv_page); | |
| 1967 | 1967 | if (likely(dio->op == REQ_OP_WRITE)) |
| 1968 | 1968 | flush_dcache_page(bv.bv_page); |
| 1969 | 1969 | |
| @@ -2189,6 +2189,7 @@ super_1_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors) · 2188 unmodified lines | ||
| 2189 | 2189 | |
| 2190 | 2190 | if (!num_sectors || num_sectors > max_sectors) |
| 2191 | 2191 | num_sectors = max_sectors; |
| 2192 | + rdev->sb_start = sb_start; | |
| 2192 | 2193 | } |
| 2193 | 2194 | sb = page_address(rdev->sb_page); |
| 2194 | 2195 | sb->data_size = cpu_to_le64(num_sectors); |
| @@ -6270,7 +6271,8 @@ static void __md_stop(struct mddev *mddev) · 4075 unmodified lines | ||
| 6270 | 6271 | spin_lock(&mddev->lock); |
| 6271 | 6272 | mddev->pers = NULL; |
| 6272 | 6273 | spin_unlock(&mddev->lock); |
| 6273 | − pers->free(mddev, mddev->private); | |
| 6274 | + if (mddev->private) | |
| 6275 | + pers->free(mddev, mddev->private); | |
| 6274 | 6276 | mddev->private = NULL; |
| 6275 | 6277 | if (pers->sync_request && mddev->to_remove == NULL) |
| 6276 | 6278 | mddev->to_remove = &md_redundancy_group; |
| @@ -423,9 +423,9 @@ static int rebalance_children(struct shadow_spine *s, · 422 unmodified lines | ||
| 423 | 423 | |
| 424 | 424 | memcpy(n, dm_block_data(child), |
| 425 | 425 | dm_bm_block_size(dm_tm_get_bm(info->tm))); |
| 426 | − dm_tm_unlock(info->tm, child); | |
| 427 | 426 | |
| 428 | 427 | dm_tm_dec(info->tm, dm_block_location(child)); |
| 428 | + dm_tm_unlock(info->tm, child); | |
| 429 | 429 | return 0; |
| 430 | 430 | } |
| 431 | 431 | |
| @@ -1803,8 +1803,6 @@ static int rtsx_pci_runtime_suspend(struct device *device) · 1802 unmodified lines | ||
| 1803 | 1803 | mutex_lock(&pcr->pcr_mutex); |
| 1804 | 1804 | rtsx_pci_power_off(pcr, HOST_ENTER_S3); |
| 1805 | 1805 | |
| 1806 | − free_irq(pcr->irq, (void *)pcr); | |
| 1807 | − | |
| 1808 | 1806 | mutex_unlock(&pcr->pcr_mutex); |
| 1809 | 1807 | |
| 1810 | 1808 | pcr->is_runtime_suspended = true; |
| @@ -1825,8 +1823,6 @@ static int rtsx_pci_runtime_resume(struct device *device) · 14 unmodified lines | ||
| 1825 | 1823 | mutex_lock(&pcr->pcr_mutex); |
| 1826 | 1824 | |
| 1827 | 1825 | rtsx_pci_write_register(pcr, HOST_SLEEP_STATE, 0x03, 0x00); |
| 1828 | − rtsx_pci_acquire_irq(pcr); | |
| 1829 | − synchronize_irq(pcr->irq); | |
| 1830 | 1826 | |
| 1831 | 1827 | if (pcr->ops->fetch_vendor_settings) |
| 1832 | 1828 | pcr->ops->fetch_vendor_settings(pcr); |
| @@ -376,7 +376,6 @@ MODULE_DEVICE_TABLE(spi, at25_spi_ids); · 375 unmodified lines | ||
| 376 | 376 | static int at25_probe(struct spi_device *spi) |
| 377 | 377 | { |
| 378 | 378 | struct at25_data *at25 = NULL; |
| 379 | − struct spi_eeprom chip; | |
| 380 | 379 | int err; |
| 381 | 380 | int sr; |
| 382 | 381 | u8 id[FM25_ID_LEN]; |
| @@ -389,15 +388,18 @@ static int at25_probe(struct spi_device *spi) · 6 unmodified lines | ||
| 389 | 388 | if (match && !strcmp(match->compatible, "cypress,fm25")) |
| 390 | 389 | is_fram = 1; |
| 391 | 390 | |
| 391 | + at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL); | |
| 392 | + if (!at25) | |
| 393 | + return -ENOMEM; | |
| 394 | + | |
| 392 | 395 | /* Chip description */ |
| 393 | − if (!spi->dev.platform_data) { | |
| 394 | − if (!is_fram) { | |
| 395 | − err = at25_fw_to_chip(&spi->dev, &chip); | |
| 396 | − if (err) | |
| 397 | − return err; | |
| 398 | − } | |
| 399 | − } else | |
| 400 | − chip = *(struct spi_eeprom *)spi->dev.platform_data; | |
| 396 | + if (spi->dev.platform_data) { | |
| 397 | + memcpy(&at25->chip, spi->dev.platform_data, sizeof(at25->chip)); | |
| 398 | + } else if (!is_fram) { | |
| 399 | + err = at25_fw_to_chip(&spi->dev, &at25->chip); | |
| 400 | + if (err) | |
| 401 | + return err; | |
| 402 | + } | |
| 401 | 403 | |
| 402 | 404 | /* Ping the chip ... the status register is pretty portable, |
| 403 | 405 | * unlike probing manufacturer IDs. We do expect that system |
| @@ -409,12 +411,7 @@ static int at25_probe(struct spi_device *spi) · 5 unmodified lines | ||
| 409 | 411 | return -ENXIO; |
| 410 | 412 | } |
| 411 | 413 | |
| 412 | − at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL); | |
| 413 | − if (!at25) | |
| 414 | − return -ENOMEM; | |
| 415 | − | |
| 416 | 414 | mutex_init(&at25->lock); |
| 417 | − at25->chip = chip; | |
| 418 | 415 | at25->spi = spi; |
| 419 | 416 | spi_set_drvdata(spi, at25); |
| 420 | 417 | |
| @@ -431,7 +428,7 @@ static int at25_probe(struct spi_device *spi) · 10 unmodified lines | ||
| 431 | 428 | dev_err(&spi->dev, "Error: unsupported size (id %02x)\n", id[7]); |
| 432 | 429 | return -ENODEV; |
| 433 | 430 | } |
| 434 | − chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024; | |
| 431 | + at25->chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024; | |
| 435 | 432 | |
| 436 | 433 | if (at25->chip.byte_len > 64 * 1024) |
| 437 | 434 | at25->chip.flags |= EE_ADDR3; |
| @@ -464,7 +461,7 @@ static int at25_probe(struct spi_device *spi) · 26 unmodified lines | ||
| 464 | 461 | at25->nvmem_config.type = is_fram ? NVMEM_TYPE_FRAM : NVMEM_TYPE_EEPROM; |
| 465 | 462 | at25->nvmem_config.name = dev_name(&spi->dev); |
| 466 | 463 | at25->nvmem_config.dev = &spi->dev; |
| 467 | − at25->nvmem_config.read_only = chip.flags & EE_READONLY; | |
| 464 | + at25->nvmem_config.read_only = at25->chip.flags & EE_READONLY; | |
| 468 | 465 | at25->nvmem_config.root_only = true; |
| 469 | 466 | at25->nvmem_config.owner = THIS_MODULE; |
| 470 | 467 | at25->nvmem_config.compat = true; |
| @@ -474,17 +471,18 @@ static int at25_probe(struct spi_device *spi) · 3 unmodified lines | ||
| 474 | 471 | at25->nvmem_config.priv = at25; |
| 475 | 472 | at25->nvmem_config.stride = 1; |
| 476 | 473 | at25->nvmem_config.word_size = 1; |
| 477 | − at25->nvmem_config.size = chip.byte_len; | |
| 474 | + at25->nvmem_config.size = at25->chip.byte_len; | |
| 478 | 475 | |
| 479 | 476 | at25->nvmem = devm_nvmem_register(&spi->dev, &at25->nvmem_config); |
| 480 | 477 | if (IS_ERR(at25->nvmem)) |
| 481 | 478 | return PTR_ERR(at25->nvmem); |
| 482 | 479 | |
| 483 | 480 | dev_info(&spi->dev, "%d %s %s %s%s, pagesize %u\n", |
| 484 | − (chip.byte_len < 1024) ? chip.byte_len : (chip.byte_len / 1024), | |
| 485 | − (chip.byte_len < 1024) ? "Byte" : "KByte", | |
| 481 | + (at25->chip.byte_len < 1024) ? | |
| 482 | + at25->chip.byte_len : (at25->chip.byte_len / 1024), | |
| 483 | + (at25->chip.byte_len < 1024) ? "Byte" : "KByte", | |
| 486 | 484 | at25->chip.name, is_fram ? "fram" : "eeprom", |
| 487 | − (chip.flags & EE_READONLY) ? " (readonly)" : "", | |
| 485 | + (at25->chip.flags & EE_READONLY) ? " (readonly)" : "", | |
| 488 | 486 | at25->chip.page_size); |
| 489 | 487 | return 0; |
| 490 | 488 | } |
| @@ -719,16 +719,18 @@ static int fastrpc_get_meta_size(struct fastrpc_invoke_ctx *ctx) · 718 unmodified lines | ||
| 719 | 719 | static u64 fastrpc_get_payload_size(struct fastrpc_invoke_ctx *ctx, int metalen) |
| 720 | 720 | { |
| 721 | 721 | u64 size = 0; |
| 722 | − int i; | |
| 722 | + int oix; | |
| 723 | 723 | |
| 724 | 724 | size = ALIGN(metalen, FASTRPC_ALIGN); |
| 725 | − for (i = 0; i < ctx->nscalars; i++) { | |
| 725 | + for (oix = 0; oix < ctx->nbufs; oix++) { | |
| 726 | + int i = ctx->olaps[oix].raix; | |
| 727 | + | |
| 726 | 728 | if (ctx->args[i].fd == 0 || ctx->args[i].fd == -1) { |
| 727 | 729 | |
| 728 | − if (ctx->olaps[i].offset == 0) | |
| 730 | + if (ctx->olaps[oix].offset == 0) | |
| 729 | 731 | size = ALIGN(size, FASTRPC_ALIGN); |
| 730 | 732 | |
| 731 | − size += (ctx->olaps[i].mend - ctx->olaps[i].mstart); | |
| 733 | + size += (ctx->olaps[oix].mend - ctx->olaps[oix].mstart); | |
| 732 | 734 | } |
| 733 | 735 | } |
| 734 | 736 | |
| @@ -2291,8 +2291,10 @@ static int msdc_execute_hs400_tuning(struct mmc_host *mmc, struct mmc_card *card · 2290 unmodified lines | ||
| 2291 | 2291 | sdr_set_field(host->base + PAD_DS_TUNE, |
| 2292 | 2292 | PAD_DS_TUNE_DLY1, i); |
| 2293 | 2293 | ret = mmc_get_ext_csd(card, &ext_csd); |
| 2294 | − if (!ret) | |
| 2294 | + if (!ret) { | |
| 2295 | 2295 | result_dly1 |= (1 << i); |
| 2296 | + kfree(ext_csd); | |
| 2297 | + } | |
| 2296 | 2298 | } |
| 2297 | 2299 | host->hs400_tuning = false; |
| 2298 | 2300 | |
| @@ -673,7 +673,7 @@ static int renesas_sdhi_execute_tuning(struct mmc_host *mmc, u32 opcode) · 672 unmodified lines | ||
| 673 | 673 | |
| 674 | 674 | /* Issue CMD19 twice for each tap */ |
| 675 | 675 | for (i = 0; i < 2 * priv->tap_num; i++) { |
| 676 | − int cmd_error; | |
| 676 | + int cmd_error = 0; | |
| 677 | 677 | |
| 678 | 678 | /* Set sampling clock position */ |
| 679 | 679 | sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, i % priv->tap_num); |
| @@ -768,6 +768,10 @@ static void mv88e6xxx_mac_link_down(struct dsa_switch *ds, int port, · 767 unmodified lines | ||
| 768 | 768 | if ((!mv88e6xxx_port_ppu_updates(chip, port) || |
| 769 | 769 | mode == MLO_AN_FIXED) && ops->port_sync_link) |
| 770 | 770 | err = ops->port_sync_link(chip, port, mode, false); |
| 771 | + | |
| 772 | + if (!err && ops->port_set_speed_duplex) | |
| 773 | + err = ops->port_set_speed_duplex(chip, port, SPEED_UNFORCED, | |
| 774 | + DUPLEX_UNFORCED); | |
| 771 | 775 | mv88e6xxx_reg_unlock(chip); |
| 772 | 776 | |
| 773 | 777 | if (err) |
| @@ -283,7 +283,7 @@ static int mv88e6xxx_port_set_speed_duplex(struct mv88e6xxx_chip *chip, · 282 unmodified lines | ||
| 283 | 283 | if (err) |
| 284 | 284 | return err; |
| 285 | 285 | |
| 286 | − if (speed) | |
| 286 | + if (speed != SPEED_UNFORCED) | |
| 287 | 287 | dev_dbg(chip->dev, "p%d: Speed set to %d Mbps\n", port, speed); |
| 288 | 288 | else |
| 289 | 289 | dev_dbg(chip->dev, "p%d: Speed unforced\n", port); |
| @@ -516,7 +516,7 @@ int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, · 226 unmodified lines | ||
| 516 | 516 | if (err) |
| 517 | 517 | return err; |
| 518 | 518 | |
| 519 | − if (speed) | |
| 519 | + if (speed != SPEED_UNFORCED) | |
| 520 | 520 | dev_dbg(chip->dev, "p%d: Speed set to %d Mbps\n", port, speed); |
| 521 | 521 | else |
| 522 | 522 | dev_dbg(chip->dev, "p%d: Speed unforced\n", port); |
| @@ -1309,11 +1309,11 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, · 1308 unmodified lines | ||
| 1309 | 1309 | struct bcm_sysport_priv *priv = netdev_priv(dev); |
| 1310 | 1310 | struct device *kdev = &priv->pdev->dev; |
| 1311 | 1311 | struct bcm_sysport_tx_ring *ring; |
| 1312 | + unsigned long flags, desc_flags; | |
| 1312 | 1313 | struct bcm_sysport_cb *cb; |
| 1313 | 1314 | struct netdev_queue *txq; |
| 1314 | 1315 | u32 len_status, addr_lo; |
| 1315 | 1316 | unsigned int skb_len; |
| 1316 | − unsigned long flags; | |
| 1317 | 1317 | dma_addr_t mapping; |
| 1318 | 1318 | u16 queue; |
| 1319 | 1319 | int ret; |
| @@ -1373,8 +1373,10 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb, · 53 unmodified lines | ||
| 1373 | 1373 | ring->desc_count--; |
| 1374 | 1374 | |
| 1375 | 1375 | /* Ports are latched, so write upper address first */ |
| 1376 | + spin_lock_irqsave(&priv->desc_lock, desc_flags); | |
| 1376 | 1377 | tdma_writel(priv, len_status, TDMA_WRITE_PORT_HI(ring->index)); |
| 1377 | 1378 | tdma_writel(priv, addr_lo, TDMA_WRITE_PORT_LO(ring->index)); |
| 1379 | + spin_unlock_irqrestore(&priv->desc_lock, desc_flags); | |
| 1378 | 1380 | |
| 1379 | 1381 | /* Check ring space and update SW control flow */ |
| 1380 | 1382 | if (ring->desc_count == 0) |
| @@ -2013,6 +2015,7 @@ static int bcm_sysport_open(struct net_device *dev) · 632 unmodified lines | ||
| 2013 | 2015 | } |
| 2014 | 2016 | |
| 2015 | 2017 | /* Initialize both hardware and software ring */ |
| 2018 | + spin_lock_init(&priv->desc_lock); | |
| 2016 | 2019 | for (i = 0; i < dev->num_tx_queues; i++) { |
| 2017 | 2020 | ret = bcm_sysport_init_tx_ring(priv, i); |
| 2018 | 2021 | if (ret) { |
| @@ -711,6 +711,7 @@ struct bcm_sysport_priv { · 710 unmodified lines | ||
| 711 | 711 | int wol_irq; |
| 712 | 712 | |
| 713 | 713 | /* Transmit rings */ |
| 714 | + spinlock_t desc_lock; | |
| 714 | 715 | struct bcm_sysport_tx_ring *tx_rings; |
| 715 | 716 | |
| 716 | 717 | /* Receive queue */ |
| @@ -589,9 +589,9 @@ static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv) · 588 unmodified lines | ||
| 589 | 589 | * Internal or external PHY with MDIO access |
| 590 | 590 | */ |
| 591 | 591 | phydev = phy_attach(priv->dev, phy_name, pd->phy_interface); |
| 592 | − if (!phydev) { | |
| 592 | + if (IS_ERR(phydev)) { | |
| 593 | 593 | dev_err(kdev, "failed to register PHY device\n"); |
| 594 | − return -ENODEV; | |
| 594 | + return PTR_ERR(phydev); | |
| 595 | 595 | } |
| 596 | 596 | } else { |
| 597 | 597 | /* |
| @@ -388,6 +388,8 @@ struct dpaa2_eth_ch_stats { · 387 unmodified lines | ||
| 388 | 388 | __u64 bytes_per_cdan; |
| 389 | 389 | }; |
| 390 | 390 | |
| 391 | +#define DPAA2_ETH_CH_STATS 7 | |
| 392 | + | |
| 391 | 393 | /* Maximum number of queues associated with a DPNI */ |
| 392 | 394 | #define DPAA2_ETH_MAX_TCS 8 |
| 393 | 395 | #define DPAA2_ETH_MAX_RX_QUEUES_PER_TC 16 |
| @@ -278,7 +278,7 @@ static void dpaa2_eth_get_ethtool_stats(struct net_device *net_dev, · 277 unmodified lines | ||
| 278 | 278 | /* Per-channel stats */ |
| 279 | 279 | for (k = 0; k < priv->num_channels; k++) { |
| 280 | 280 | ch_stats = &priv->channel[k]->stats; |
| 281 | − for (j = 0; j < sizeof(*ch_stats) / sizeof(__u64) - 1; j++) | |
| 281 | + for (j = 0; j < DPAA2_ETH_CH_STATS; j++) | |
| 282 | 282 | *((__u64 *)data + i + j) += *((__u64 *)ch_stats + j); |
| 283 | 283 | } |
| 284 | 284 | i += j; |
| @@ -839,6 +839,8 @@ struct hnae3_handle { · 838 unmodified lines | ||
| 839 | 839 | |
| 840 | 840 | u8 netdev_flags; |
| 841 | 841 | struct dentry *hnae3_dbgfs; |
| 842 | + /* protects concurrent contention between debugfs commands */ | |
| 843 | + struct mutex dbgfs_lock; | |
| 842 | 844 | |
| 843 | 845 | /* Network interface message level enabled bits */ |
| 844 | 846 | u32 msg_enable; |
| @@ -1226,6 +1226,7 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, · 1225 unmodified lines | ||
| 1226 | 1226 | if (ret) |
| 1227 | 1227 | return ret; |
| 1228 | 1228 | |
| 1229 | + mutex_lock(&handle->dbgfs_lock); | |
| 1229 | 1230 | save_buf = &hns3_dbg_cmd[index].buf; |
| 1230 | 1231 | |
| 1231 | 1232 | if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state) || |
| @@ -1238,15 +1239,15 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, · 6 unmodified lines | ||
| 1238 | 1239 | read_buf = *save_buf; |
| 1239 | 1240 | } else { |
| 1240 | 1241 | read_buf = kvzalloc(hns3_dbg_cmd[index].buf_len, GFP_KERNEL); |
| 1241 | − if (!read_buf) | |
| 1242 | − return -ENOMEM; | |
| 1242 | + if (!read_buf) { | |
| 1243 | + ret = -ENOMEM; | |
| 1244 | + goto out; | |
| 1245 | + } | |
| 1243 | 1246 | |
| 1244 | 1247 | /* save the buffer addr until the last read operation */ |
| 1245 | 1248 | *save_buf = read_buf; |
| 1246 | − } | |
| 1247 | 1249 | |
| 1248 | − /* get data ready for the first time to read */ | |
| 1249 | − if (!*ppos) { | |
| 1250 | + /* get data ready for the first time to read */ | |
| 1250 | 1251 | ret = hns3_dbg_read_cmd(dbg_data, hns3_dbg_cmd[index].cmd, |
| 1251 | 1252 | read_buf, hns3_dbg_cmd[index].buf_len); |
| 1252 | 1253 | if (ret) |
| @@ -1255,8 +1256,10 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer, · 2 unmodified lines | ||
| 1255 | 1256 | |
| 1256 | 1257 | size = simple_read_from_buffer(buffer, count, ppos, read_buf, |
| 1257 | 1258 | strlen(read_buf)); |
| 1258 | − if (size > 0) | |
| 1259 | + if (size > 0) { | |
| 1260 | + mutex_unlock(&handle->dbgfs_lock); | |
| 1259 | 1261 | return size; |
| 1262 | + } | |
| 1260 | 1263 | |
| 1261 | 1264 | out: |
| 1262 | 1265 | /* free the buffer for the last read operation */ |
| @@ -1265,6 +1268,7 @@ out: · 2 unmodified lines | ||
| 1265 | 1268 | *save_buf = NULL; |
| 1266 | 1269 | } |
| 1267 | 1270 | |
| 1271 | + mutex_unlock(&handle->dbgfs_lock); | |
| 1268 | 1272 | return ret; |
| 1269 | 1273 | } |
| 1270 | 1274 | |
| @@ -1337,6 +1341,8 @@ int hns3_dbg_init(struct hnae3_handle *handle) · 66 unmodified lines | ||
| 1337 | 1341 | debugfs_create_dir(hns3_dbg_dentry[i].name, |
| 1338 | 1342 | handle->hnae3_dbgfs); |
| 1339 | 1343 | |
| 1344 | + mutex_init(&handle->dbgfs_lock); | |
| 1345 | + | |
| 1340 | 1346 | for (i = 0; i < ARRAY_SIZE(hns3_dbg_cmd); i++) { |
| 1341 | 1347 | if ((hns3_dbg_cmd[i].cmd == HNAE3_DBG_CMD_TM_NODES && |
| 1342 | 1348 | ae_dev->dev_version <= HNAE3_DEVICE_VERSION_V2) || |
| @@ -1363,6 +1369,7 @@ int hns3_dbg_init(struct hnae3_handle *handle) · 20 unmodified lines | ||
| 1363 | 1369 | return 0; |
| 1364 | 1370 | |
| 1365 | 1371 | out: |
| 1372 | + mutex_destroy(&handle->dbgfs_lock); | |
| 1366 | 1373 | debugfs_remove_recursive(handle->hnae3_dbgfs); |
| 1367 | 1374 | handle->hnae3_dbgfs = NULL; |
| 1368 | 1375 | return ret; |
| @@ -1378,6 +1385,7 @@ void hns3_dbg_uninit(struct hnae3_handle *handle) · 9 unmodified lines | ||
| 1378 | 1385 | hns3_dbg_cmd[i].buf = NULL; |
| 1379 | 1386 | } |
| 1380 | 1387 | |
| 1388 | + mutex_destroy(&handle->dbgfs_lock); | |
| 1381 | 1389 | debugfs_remove_recursive(handle->hnae3_dbgfs); |
| 1382 | 1390 | handle->hnae3_dbgfs = NULL; |
| 1383 | 1391 | } |
| @@ -114,7 +114,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev, · 113 unmodified lines | ||
| 114 | 114 | |
| 115 | 115 | memcpy(&req->msg, send_msg, sizeof(struct hclge_vf_to_pf_msg)); |
| 116 | 116 | |
| 117 | − trace_hclge_vf_mbx_send(hdev, req); | |
| 117 | + if (test_bit(HCLGEVF_STATE_NIC_REGISTERED, &hdev->state)) | |
| 118 | + trace_hclge_vf_mbx_send(hdev, req); | |
| 118 | 119 | |
| 119 | 120 | /* synchronous send */ |
| 120 | 121 | if (need_resp) { |
| @@ -2046,6 +2046,7 @@ static void iavf_watchdog_task(struct work_struct *work) · 2045 unmodified lines | ||
| 2046 | 2046 | } |
| 2047 | 2047 | adapter->aq_required = 0; |
| 2048 | 2048 | adapter->current_op = VIRTCHNL_OP_UNKNOWN; |
| 2049 | + mutex_unlock(&adapter->crit_lock); | |
| 2049 | 2050 | queue_delayed_work(iavf_wq, |
| 2050 | 2051 | &adapter->watchdog_task, |
| 2051 | 2052 | msecs_to_jiffies(10)); |
| @@ -2076,16 +2077,14 @@ static void iavf_watchdog_task(struct work_struct *work) · 24 unmodified lines | ||
| 2076 | 2077 | iavf_detect_recover_hung(&adapter->vsi); |
| 2077 | 2078 | break; |
| 2078 | 2079 | case __IAVF_REMOVE: |
| 2079 | − mutex_unlock(&adapter->crit_lock); | |
| 2080 | − return; | |
| 2081 | 2080 | default: |
| 2081 | + mutex_unlock(&adapter->crit_lock); | |
| 2082 | 2082 | return; |
| 2083 | 2083 | } |
| 2084 | 2084 | |
| 2085 | 2085 | /* check for hw reset */ |
| 2086 | 2086 | reg_val = rd32(hw, IAVF_VF_ARQLEN1) & IAVF_VF_ARQLEN1_ARQENABLE_MASK; |
| 2087 | 2087 | if (!reg_val) { |
| 2088 | − iavf_change_state(adapter, __IAVF_RESETTING); | |
| 2089 | 2088 | adapter->flags |= IAVF_FLAG_RESET_PENDING; |
| 2090 | 2089 | adapter->aq_required = 0; |
| 2091 | 2090 | adapter->current_op = VIRTCHNL_OP_UNKNOWN; |
| @@ -705,7 +705,7 @@ static int ice_ptp_adjfine(struct ptp_clock_info *info, long scaled_ppm) · 704 unmodified lines | ||
| 705 | 705 | scaled_ppm = -scaled_ppm; |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | − while ((u64)scaled_ppm > div_u64(U64_MAX, incval)) { | |
| 708 | + while ((u64)scaled_ppm > div64_u64(U64_MAX, incval)) { | |
| 709 | 709 | /* handle overflow by scaling down the scaled_ppm and |
| 710 | 710 | * the divisor, losing some precision |
| 711 | 711 | */ |
| @@ -1536,19 +1536,16 @@ static void ice_ptp_tx_tstamp_work(struct kthread_work *work) · 824 unmodified lines | ||
| 1536 | 1536 | if (err) |
| 1537 | 1537 | continue; |
| 1538 | 1538 | |
| 1539 | − /* Check if the timestamp is valid */ | |
| 1540 | − if (!(raw_tstamp & ICE_PTP_TS_VALID)) | |
| 1539 | + /* Check if the timestamp is invalid or stale */ | |
| 1540 | + if (!(raw_tstamp & ICE_PTP_TS_VALID) || | |
| 1541 | + raw_tstamp == tx->tstamps[idx].cached_tstamp) | |
| 1541 | 1542 | continue; |
| 1542 | 1543 | |
| 1543 | − /* clear the timestamp register, so that it won't show valid | |
| 1544 | − * again when re-used. | |
| 1545 | − */ | |
| 1546 | − ice_clear_phy_tstamp(hw, tx->quad, phy_idx); | |
| 1547 | − | |
| 1548 | 1544 | /* The timestamp is valid, so we'll go ahead and clear this |
| 1549 | 1545 | * index and then send the timestamp up to the stack. |
| 1550 | 1546 | */ |
| 1551 | 1547 | spin_lock(&tx->lock); |
| 1548 | + tx->tstamps[idx].cached_tstamp = raw_tstamp; | |
| 1552 | 1549 | clear_bit(idx, tx->in_use); |
| 1553 | 1550 | skb = tx->tstamps[idx].skb; |
| 1554 | 1551 | tx->tstamps[idx].skb = NULL; |
| @@ -55,15 +55,21 @@ struct ice_perout_channel { · 54 unmodified lines | ||
| 55 | 55 | * struct ice_tx_tstamp - Tracking for a single Tx timestamp |
| 56 | 56 | * @skb: pointer to the SKB for this timestamp request |
| 57 | 57 | * @start: jiffies when the timestamp was first requested |
| 58 | + * @cached_tstamp: last read timestamp | |
| 58 | 59 | * |
| 59 | 60 | * This structure tracks a single timestamp request. The SKB pointer is |
| 60 | 61 | * provided when initiating a request. The start time is used to ensure that |
| 61 | 62 | * we discard old requests that were not fulfilled within a 2 second time |
| 62 | 63 | * window. |
| 64 | + * Timestamp values in the PHY are read only and do not get cleared except at | |
| 65 | + * hardware reset or when a new timestamp value is captured. The cached_tstamp | |
| 66 | + * field is used to detect the case where a new timestamp has not yet been | |
| 67 | + * captured, ensuring that we avoid sending stale timestamp data to the stack. | |
| 63 | 68 | */ |
| 64 | 69 | struct ice_tx_tstamp { |
| 65 | 70 | struct sk_buff *skb; |
| 66 | 71 | unsigned long start; |
| 72 | + u64 cached_tstamp; | |
| 67 | 73 | }; |
| 68 | 74 | |
| 69 | 75 | /** |
| @@ -7648,6 +7648,20 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf, · 7647 unmodified lines | ||
| 7648 | 7648 | struct vf_mac_filter *entry = NULL; |
| 7649 | 7649 | int ret = 0; |
| 7650 | 7650 | |
| 7651 | + if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) && | |
| 7652 | + !vf_data->trusted) { | |
| 7653 | + dev_warn(&pdev->dev, | |
| 7654 | + "VF %d requested MAC filter but is administratively denied\n", | |
| 7655 | + vf); | |
| 7656 | + return -EINVAL; | |
| 7657 | + } | |
| 7658 | + if (!is_valid_ether_addr(addr)) { | |
| 7659 | + dev_warn(&pdev->dev, | |
| 7660 | + "VF %d attempted to set invalid MAC filter\n", | |
| 7661 | + vf); | |
| 7662 | + return -EINVAL; | |
| 7663 | + } | |
| 7664 | + | |
| 7651 | 7665 | switch (info) { |
| 7652 | 7666 | case E1000_VF_MAC_FILTER_CLR: |
| 7653 | 7667 | /* remove all unicast MAC filters related to the current VF */ |
| @@ -7661,20 +7675,6 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf, · 7 unmodified lines | ||
| 7661 | 7675 | } |
| 7662 | 7676 | break; |
| 7663 | 7677 | case E1000_VF_MAC_FILTER_ADD: |
| 7664 | − if ((vf_data->flags & IGB_VF_FLAG_PF_SET_MAC) && | |
| 7665 | − !vf_data->trusted) { | |
| 7666 | − dev_warn(&pdev->dev, | |
| 7667 | − "VF %d requested MAC filter but is administratively denied\n", | |
| 7668 | − vf); | |
| 7669 | − return -EINVAL; | |
| 7670 | − } | |
| 7671 | − if (!is_valid_ether_addr(addr)) { | |
| 7672 | − dev_warn(&pdev->dev, | |
| 7673 | − "VF %d attempted to set invalid MAC filter\n", | |
| 7674 | − vf); | |
| 7675 | − return -EINVAL; | |
| 7676 | − } | |
| 7677 | − | |
| 7678 | 7678 | /* try to find empty slot in the list */ |
| 7679 | 7679 | list_for_each(pos, &adapter->vf_macs.l) { |
| 7680 | 7680 | entry = list_entry(pos, struct vf_mac_filter, l); |
| @@ -2859,6 +2859,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 2858 unmodified lines | ||
| 2859 | 2859 | return 0; |
| 2860 | 2860 | |
| 2861 | 2861 | err_hw_init: |
| 2862 | + netif_napi_del(&adapter->rx_ring->napi); | |
| 2862 | 2863 | kfree(adapter->tx_ring); |
| 2863 | 2864 | kfree(adapter->rx_ring); |
| 2864 | 2865 | err_sw_init: |
| @@ -636,7 +636,7 @@ s32 igc_set_ltr_i225(struct igc_hw *hw, bool link) · 635 unmodified lines | ||
| 636 | 636 | ltrv = rd32(IGC_LTRMAXV); |
| 637 | 637 | if (ltr_max != (ltrv & IGC_LTRMAXV_LTRV_MASK)) { |
| 638 | 638 | ltrv = IGC_LTRMAXV_LSNP_REQ | ltr_max | |
| 639 | − (scale_min << IGC_LTRMAXV_SCALE_SHIFT); | |
| 639 | + (scale_max << IGC_LTRMAXV_SCALE_SHIFT); | |
| 640 | 640 | wr32(IGC_LTRMAXV, ltrv); |
| 641 | 641 | } |
| 642 | 642 | } |
| @@ -5531,6 +5531,10 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) · 5530 unmodified lines | ||
| 5531 | 5531 | if (!speed && hw->mac.ops.get_link_capabilities) { |
| 5532 | 5532 | ret = hw->mac.ops.get_link_capabilities(hw, &speed, |
| 5533 | 5533 | &autoneg); |
| 5534 | + /* remove NBASE-T speeds from default autonegotiation | |
| 5535 | + * to accommodate broken network switches in the field | |
| 5536 | + * which cannot cope with advertised NBASE-T speeds | |
| 5537 | + */ | |
| 5534 | 5538 | speed &= ~(IXGBE_LINK_SPEED_5GB_FULL | |
| 5535 | 5539 | IXGBE_LINK_SPEED_2_5GB_FULL); |
| 5536 | 5540 | } |
| @@ -3405,6 +3405,9 @@ static s32 ixgbe_reset_hw_X550em(struct ixgbe_hw *hw) · 3404 unmodified lines | ||
| 3405 | 3405 | /* flush pending Tx transactions */ |
| 3406 | 3406 | ixgbe_clear_tx_pending(hw); |
| 3407 | 3407 | |
| 3408 | + /* set MDIO speed before talking to the PHY in case it's the 1st time */ | |
| 3409 | + ixgbe_set_mdio_speed(hw); | |
| 3410 | + | |
| 3408 | 3411 | /* PHY ops must be identified and initialized prior to reset */ |
| 3409 | 3412 | status = hw->phy.ops.init(hw); |
| 3410 | 3413 | if (status == IXGBE_ERR_SFP_NOT_SUPPORTED || |
| @@ -8505,7 +8505,8 @@ mlxsw_sp_rif_mac_profile_replace(struct mlxsw_sp *mlxsw_sp, · 8504 unmodified lines | ||
| 8505 | 8505 | u8 mac_profile; |
| 8506 | 8506 | int err; |
| 8507 | 8507 | |
| 8508 | − if (!mlxsw_sp_rif_mac_profile_is_shared(rif)) | |
| 8508 | + if (!mlxsw_sp_rif_mac_profile_is_shared(rif) && | |
| 8509 | + !mlxsw_sp_rif_mac_profile_find(mlxsw_sp, new_mac)) | |
| 8509 | 8510 | return mlxsw_sp_rif_mac_profile_edit(rif, new_mac); |
| 8510 | 8511 | |
| 8511 | 8512 | err = mlxsw_sp_rif_mac_profile_get(mlxsw_sp, new_mac, |
| @@ -609,6 +609,9 @@ static size_t ef100_update_stats(struct efx_nic *efx, · 608 unmodified lines | ||
| 609 | 609 | ef100_common_stat_mask(mask); |
| 610 | 610 | ef100_ethtool_stat_mask(mask); |
| 611 | 611 | |
| 612 | + if (!mc_stats) | |
| 613 | + return 0; | |
| 614 | + | |
| 612 | 615 | efx_nic_copy_stats(efx, mc_stats); |
| 613 | 616 | efx_nic_update_stats(ef100_stat_desc, EF100_STAT_COUNT, mask, |
| 614 | 617 | stats, mc_stats, false); |
| @@ -33,6 +33,7 @@ struct rk_gmac_ops { · 32 unmodified lines | ||
| 33 | 33 | void (*set_rgmii_speed)(struct rk_priv_data *bsp_priv, int speed); |
| 34 | 34 | void (*set_rmii_speed)(struct rk_priv_data *bsp_priv, int speed); |
| 35 | 35 | void (*integrated_phy_powerup)(struct rk_priv_data *bsp_priv); |
| 36 | + bool regs_valid; | |
| 36 | 37 | u32 regs[]; |
| 37 | 38 | }; |
| 38 | 39 | |
| @@ -1092,6 +1093,7 @@ static const struct rk_gmac_ops rk3568_ops = { · 1053 unmodified lines | ||
| 1092 | 1093 | .set_to_rmii = rk3568_set_to_rmii, |
| 1093 | 1094 | .set_rgmii_speed = rk3568_set_gmac_speed, |
| 1094 | 1095 | .set_rmii_speed = rk3568_set_gmac_speed, |
| 1096 | + .regs_valid = true, | |
| 1095 | 1097 | .regs = { |
| 1096 | 1098 | 0xfe2a0000, /* gmac0 */ |
| 1097 | 1099 | 0xfe010000, /* gmac1 */ |
| @@ -1383,7 +1385,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, · 285 unmodified lines | ||
| 1383 | 1385 | * to be distinguished. |
| 1384 | 1386 | */ |
| 1385 | 1387 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 1386 | − if (res) { | |
| 1388 | + if (res && ops->regs_valid) { | |
| 1387 | 1389 | int i = 0; |
| 1388 | 1390 | |
| 1389 | 1391 | while (ops->regs[i]) { |
| @@ -171,6 +171,19 @@ struct stmmac_flow_entry { · 170 unmodified lines | ||
| 171 | 171 | int is_l4; |
| 172 | 172 | }; |
| 173 | 173 | |
| 174 | +/* Rx Frame Steering */ | |
| 175 | +enum stmmac_rfs_type { | |
| 176 | + STMMAC_RFS_T_VLAN, | |
| 177 | + STMMAC_RFS_T_MAX, | |
| 178 | +}; | |
| 179 | + | |
| 180 | +struct stmmac_rfs_entry { | |
| 181 | + unsigned long cookie; | |
| 182 | + int in_use; | |
| 183 | + int type; | |
| 184 | + int tc; | |
| 185 | +}; | |
| 186 | + | |
| 174 | 187 | struct stmmac_priv { |
| 175 | 188 | /* Frequently used values are kept adjacent for cache effect */ |
| 176 | 189 | u32 tx_coal_frames[MTL_MAX_TX_QUEUES]; |
| @@ -288,6 +301,10 @@ struct stmmac_priv { · 111 unmodified lines | ||
| 288 | 301 | struct stmmac_tc_entry *tc_entries; |
| 289 | 302 | unsigned int flow_entries_max; |
| 290 | 303 | struct stmmac_flow_entry *flow_entries; |
| 304 | + unsigned int rfs_entries_max[STMMAC_RFS_T_MAX]; | |
| 305 | + unsigned int rfs_entries_cnt[STMMAC_RFS_T_MAX]; | |
| 306 | + unsigned int rfs_entries_total; | |
| 307 | + struct stmmac_rfs_entry *rfs_entries; | |
| 291 | 308 | |
| 292 | 309 | /* Pulse Per Second output */ |
| 293 | 310 | struct stmmac_pps_cfg pps[STMMAC_PPS_MAX]; |
| @@ -1451,16 +1451,20 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, · 1450 unmodified lines | ||
| 1451 | 1451 | { |
| 1452 | 1452 | struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; |
| 1453 | 1453 | struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i]; |
| 1454 | + gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN); | |
| 1455 | + | |
| 1456 | + if (priv->dma_cap.addr64 <= 32) | |
| 1457 | + gfp |= GFP_DMA32; | |
| 1454 | 1458 | |
| 1455 | 1459 | if (!buf->page) { |
| 1456 | − buf->page = page_pool_dev_alloc_pages(rx_q->page_pool); | |
| 1460 | + buf->page = page_pool_alloc_pages(rx_q->page_pool, gfp); | |
| 1457 | 1461 | if (!buf->page) |
| 1458 | 1462 | return -ENOMEM; |
| 1459 | 1463 | buf->page_offset = stmmac_rx_offset(priv); |
| 1460 | 1464 | } |
| 1461 | 1465 | |
| 1462 | 1466 | if (priv->sph && !buf->sec_page) { |
| 1463 | − buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool); | |
| 1467 | + buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp); | |
| 1464 | 1468 | if (!buf->sec_page) |
| 1465 | 1469 | return -ENOMEM; |
| 1466 | 1470 | |
| @@ -4475,6 +4479,10 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) · 3008 unmodified lines | ||
| 4475 | 4479 | struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue]; |
| 4476 | 4480 | int dirty = stmmac_rx_dirty(priv, queue); |
| 4477 | 4481 | unsigned int entry = rx_q->dirty_rx; |
| 4482 | + gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN); | |
| 4483 | + | |
| 4484 | + if (priv->dma_cap.addr64 <= 32) | |
| 4485 | + gfp |= GFP_DMA32; | |
| 4478 | 4486 | |
| 4479 | 4487 | while (dirty-- > 0) { |
| 4480 | 4488 | struct stmmac_rx_buffer *buf = &rx_q->buf_pool[entry]; |
| @@ -4487,13 +4495,13 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) · 6 unmodified lines | ||
| 4487 | 4495 | p = rx_q->dma_rx + entry; |
| 4488 | 4496 | |
| 4489 | 4497 | if (!buf->page) { |
| 4490 | − buf->page = page_pool_dev_alloc_pages(rx_q->page_pool); | |
| 4498 | + buf->page = page_pool_alloc_pages(rx_q->page_pool, gfp); | |
| 4491 | 4499 | if (!buf->page) |
| 4492 | 4500 | break; |
| 4493 | 4501 | } |
| 4494 | 4502 | |
| 4495 | 4503 | if (priv->sph && !buf->sec_page) { |
| 4496 | − buf->sec_page = page_pool_dev_alloc_pages(rx_q->page_pool); | |
| 4504 | + buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp); | |
| 4497 | 4505 | if (!buf->sec_page) |
| 4498 | 4506 | break; |
| 4499 | 4507 | |
| @@ -232,11 +232,33 @@ static int tc_setup_cls_u32(struct stmmac_priv *priv, · 231 unmodified lines | ||
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | +static int tc_rfs_init(struct stmmac_priv *priv) | |
| 236 | +{ | |
| 237 | + int i; | |
| 238 | + | |
| 239 | + priv->rfs_entries_max[STMMAC_RFS_T_VLAN] = 8; | |
| 240 | + | |
| 241 | + for (i = 0; i < STMMAC_RFS_T_MAX; i++) | |
| 242 | + priv->rfs_entries_total += priv->rfs_entries_max[i]; | |
| 243 | + | |
| 244 | + priv->rfs_entries = devm_kcalloc(priv->device, | |
| 245 | + priv->rfs_entries_total, | |
| 246 | + sizeof(*priv->rfs_entries), | |
| 247 | + GFP_KERNEL); | |
| 248 | + if (!priv->rfs_entries) | |
| 249 | + return -ENOMEM; | |
| 250 | + | |
| 251 | + dev_info(priv->device, "Enabled RFS Flow TC (entries=%d)\n", | |
| 252 | + priv->rfs_entries_total); | |
| 253 | + | |
| 254 | + return 0; | |
| 255 | +} | |
| 256 | + | |
| 235 | 257 | static int tc_init(struct stmmac_priv *priv) |
| 236 | 258 | { |
| 237 | 259 | struct dma_features *dma_cap = &priv->dma_cap; |
| 238 | 260 | unsigned int count; |
| 239 | − int i; | |
| 261 | + int ret, i; | |
| 240 | 262 | |
| 241 | 263 | if (dma_cap->l3l4fnum) { |
| 242 | 264 | priv->flow_entries_max = dma_cap->l3l4fnum; |
| @@ -250,10 +272,14 @@ static int tc_init(struct stmmac_priv *priv) · 7 unmodified lines | ||
| 250 | 272 | for (i = 0; i < priv->flow_entries_max; i++) |
| 251 | 273 | priv->flow_entries[i].idx = i; |
| 252 | 274 | |
| 253 | − dev_info(priv->device, "Enabled Flow TC (entries=%d)\n", | |
| 275 | + dev_info(priv->device, "Enabled L3L4 Flow TC (entries=%d)\n", | |
| 254 | 276 | priv->flow_entries_max); |
| 255 | 277 | } |
| 256 | 278 | |
| 279 | + ret = tc_rfs_init(priv); | |
| 280 | + if (ret) | |
| 281 | + return -ENOMEM; | |
| 282 | + | |
| 257 | 283 | if (!priv->plat->fpe_cfg) { |
| 258 | 284 | priv->plat->fpe_cfg = devm_kzalloc(priv->device, |
| 259 | 285 | sizeof(*priv->plat->fpe_cfg), |
| @@ -607,16 +633,45 @@ static int tc_del_flow(struct stmmac_priv *priv, · 347 unmodified lines | ||
| 607 | 633 | return ret; |
| 608 | 634 | } |
| 609 | 635 | |
| 636 | +static struct stmmac_rfs_entry *tc_find_rfs(struct stmmac_priv *priv, | |
| 637 | + struct flow_cls_offload *cls, | |
| 638 | + bool get_free) | |
| 639 | +{ | |
| 640 | + int i; | |
| 641 | + | |
| 642 | + for (i = 0; i < priv->rfs_entries_total; i++) { | |
| 643 | + struct stmmac_rfs_entry *entry = &priv->rfs_entries[i]; | |
| 644 | + | |
| 645 | + if (entry->cookie == cls->cookie) | |
| 646 | + return entry; | |
| 647 | + if (get_free && entry->in_use == false) | |
| 648 | + return entry; | |
| 649 | + } | |
| 650 | + | |
| 651 | + return NULL; | |
| 652 | +} | |
| 653 | + | |
| 610 | 654 | #define VLAN_PRIO_FULL_MASK (0x07) |
| 611 | 655 | |
| 612 | 656 | static int tc_add_vlan_flow(struct stmmac_priv *priv, |
| 613 | 657 | struct flow_cls_offload *cls) |
| 614 | 658 | { |
| 659 | + struct stmmac_rfs_entry *entry = tc_find_rfs(priv, cls, false); | |
| 615 | 660 | struct flow_rule *rule = flow_cls_offload_flow_rule(cls); |
| 616 | 661 | struct flow_dissector *dissector = rule->match.dissector; |
| 617 | 662 | int tc = tc_classid_to_hwtc(priv->dev, cls->classid); |
| 618 | 663 | struct flow_match_vlan match; |
| 619 | 664 | |
| 665 | + if (!entry) { | |
| 666 | + entry = tc_find_rfs(priv, cls, true); | |
| 667 | + if (!entry) | |
| 668 | + return -ENOENT; | |
| 669 | + } | |
| 670 | + | |
| 671 | + if (priv->rfs_entries_cnt[STMMAC_RFS_T_VLAN] >= | |
| 672 | + priv->rfs_entries_max[STMMAC_RFS_T_VLAN]) | |
| 673 | + return -ENOENT; | |
| 674 | + | |
| 620 | 675 | /* Nothing to do here */ |
| 621 | 676 | if (!dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_VLAN)) |
| 622 | 677 | return -EINVAL; |
| @@ -638,6 +693,12 @@ static int tc_add_vlan_flow(struct stmmac_priv *priv, · 15 unmodified lines | ||
| 638 | 693 | |
| 639 | 694 | prio = BIT(match.key->vlan_priority); |
| 640 | 695 | stmmac_rx_queue_prio(priv, priv->hw, prio, tc); |
| 696 | + | |
| 697 | + entry->in_use = true; | |
| 698 | + entry->cookie = cls->cookie; | |
| 699 | + entry->tc = tc; | |
| 700 | + entry->type = STMMAC_RFS_T_VLAN; | |
| 701 | + priv->rfs_entries_cnt[STMMAC_RFS_T_VLAN]++; | |
| 641 | 702 | } |
| 642 | 703 | |
| 643 | 704 | return 0; |
| @@ -646,20 +707,19 @@ static int tc_add_vlan_flow(struct stmmac_priv *priv, · 2 unmodified lines | ||
| 646 | 707 | static int tc_del_vlan_flow(struct stmmac_priv *priv, |
| 647 | 708 | struct flow_cls_offload *cls) |
| 648 | 709 | { |
| 649 | − struct flow_rule *rule = flow_cls_offload_flow_rule(cls); | |
| 650 | − struct flow_dissector *dissector = rule->match.dissector; | |
| 651 | − int tc = tc_classid_to_hwtc(priv->dev, cls->classid); | |
| 710 | + struct stmmac_rfs_entry *entry = tc_find_rfs(priv, cls, false); | |
| 652 | 711 | |
| 653 | − /* Nothing to do here */ | |
| 654 | − if (!dissector_uses_key(dissector, FLOW_DISSECTOR_KEY_VLAN)) | |
| 655 | − return -EINVAL; | |
| 712 | + if (!entry || !entry->in_use || entry->type != STMMAC_RFS_T_VLAN) | |
| 713 | + return -ENOENT; | |
| 656 | 714 | |
| 657 | − if (tc < 0) { | |
| 658 | − netdev_err(priv->dev, "Invalid traffic class\n"); | |
| 659 | − return -EINVAL; | |
| 660 | − } | |
| 715 | + stmmac_rx_queue_prio(priv, priv->hw, 0, entry->tc); | |
| 716 | + | |
| 717 | + entry->in_use = false; | |
| 718 | + entry->cookie = 0; | |
| 719 | + entry->tc = 0; | |
| 720 | + entry->type = 0; | |
| 661 | 721 | |
| 662 | − stmmac_rx_queue_prio(priv, priv->hw, 0, tc); | |
| 722 | + priv->rfs_entries_cnt[STMMAC_RFS_T_VLAN]--; | |
| 663 | 723 | |
| 664 | 724 | return 0; |
| 665 | 725 | } |
| @@ -1844,13 +1844,14 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 1843 unmodified lines | ||
| 1844 | 1844 | if (ret < 0) { |
| 1845 | 1845 | dev_err(dev, "%pOF error reading port_id %d\n", |
| 1846 | 1846 | port_np, ret); |
| 1847 | − return ret; | |
| 1847 | + goto of_node_put; | |
| 1848 | 1848 | } |
| 1849 | 1849 | |
| 1850 | 1850 | if (!port_id || port_id > common->port_num) { |
| 1851 | 1851 | dev_err(dev, "%pOF has invalid port_id %u %s\n", |
| 1852 | 1852 | port_np, port_id, port_np->name); |
| 1853 | − return -EINVAL; | |
| 1853 | + ret = -EINVAL; | |
| 1854 | + goto of_node_put; | |
| 1854 | 1855 | } |
| 1855 | 1856 | |
| 1856 | 1857 | port = am65_common_get_port(common, port_id); |
| @@ -1866,8 +1867,10 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 9 unmodified lines | ||
| 1866 | 1867 | (AM65_CPSW_NU_FRAM_PORT_OFFSET * (port_id - 1)); |
| 1867 | 1868 | |
| 1868 | 1869 | port->slave.mac_sl = cpsw_sl_get("am65", dev, port->port_base); |
| 1869 | − if (IS_ERR(port->slave.mac_sl)) | |
| 1870 | − return PTR_ERR(port->slave.mac_sl); | |
| 1870 | + if (IS_ERR(port->slave.mac_sl)) { | |
| 1871 | + ret = PTR_ERR(port->slave.mac_sl); | |
| 1872 | + goto of_node_put; | |
| 1873 | + } | |
| 1871 | 1874 | |
| 1872 | 1875 | port->disabled = !of_device_is_available(port_np); |
| 1873 | 1876 | if (port->disabled) { |
| @@ -1880,7 +1883,7 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 6 unmodified lines | ||
| 1880 | 1883 | ret = PTR_ERR(port->slave.ifphy); |
| 1881 | 1884 | dev_err(dev, "%pOF error retrieving port phy: %d\n", |
| 1882 | 1885 | port_np, ret); |
| 1883 | − return ret; | |
| 1886 | + goto of_node_put; | |
| 1884 | 1887 | } |
| 1885 | 1888 | |
| 1886 | 1889 | port->slave.mac_only = |
| @@ -1889,10 +1892,12 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 2 unmodified lines | ||
| 1889 | 1892 | /* get phy/link info */ |
| 1890 | 1893 | if (of_phy_is_fixed_link(port_np)) { |
| 1891 | 1894 | ret = of_phy_register_fixed_link(port_np); |
| 1892 | − if (ret) | |
| 1893 | − return dev_err_probe(dev, ret, | |
| 1895 | + if (ret) { | |
| 1896 | + ret = dev_err_probe(dev, ret, | |
| 1894 | 1897 | "failed to register fixed-link phy %pOF\n", |
| 1895 | 1898 | port_np); |
| 1899 | + goto of_node_put; | |
| 1900 | + } | |
| 1896 | 1901 | port->slave.phy_node = of_node_get(port_np); |
| 1897 | 1902 | } else { |
| 1898 | 1903 | port->slave.phy_node = |
| @@ -1902,14 +1907,15 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 3 unmodified lines | ||
| 1902 | 1907 | if (!port->slave.phy_node) { |
| 1903 | 1908 | dev_err(dev, |
| 1904 | 1909 | "slave[%d] no phy found\n", port_id); |
| 1905 | − return -ENODEV; | |
| 1910 | + ret = -ENODEV; | |
| 1911 | + goto of_node_put; | |
| 1906 | 1912 | } |
| 1907 | 1913 | |
| 1908 | 1914 | ret = of_get_phy_mode(port_np, &port->slave.phy_if); |
| 1909 | 1915 | if (ret) { |
| 1910 | 1916 | dev_err(dev, "%pOF read phy-mode err %d\n", |
| 1911 | 1917 | port_np, ret); |
| 1912 | − return ret; | |
| 1918 | + goto of_node_put; | |
| 1913 | 1919 | } |
| 1914 | 1920 | |
| 1915 | 1921 | ret = of_get_mac_address(port_np, port->slave.mac_addr); |
| @@ -1932,6 +1938,11 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) · 16 unmodified lines | ||
| 1932 | 1938 | } |
| 1933 | 1939 | |
| 1934 | 1940 | return 0; |
| 1941 | + | |
| 1942 | +of_node_put: | |
| 1943 | + of_node_put(port_np); | |
| 1944 | + of_node_put(node); | |
| 1945 | + return ret; | |
| 1935 | 1946 | } |
| 1936 | 1947 | |
| 1937 | 1948 | static void am65_cpsw_pcpu_stats_free(void *data) |
| @@ -514,6 +514,7 @@ nsim_bpf_map_alloc(struct netdevsim *ns, struct bpf_offloaded_map *offmap) · 513 unmodified lines | ||
| 514 | 514 | goto err_free; |
| 515 | 515 | key = nmap->entry[i].key; |
| 516 | 516 | *key = i; |
| 517 | + memset(nmap->entry[i].value, 0, offmap->map.value_size); | |
| 517 | 518 | } |
| 518 | 519 | } |
| 519 | 520 | |
| @@ -81,7 +81,10 @@ static int nsim_set_ringparam(struct net_device *dev, · 80 unmodified lines | ||
| 81 | 81 | { |
| 82 | 82 | struct netdevsim *ns = netdev_priv(dev); |
| 83 | 83 | |
| 84 | − memcpy(&ns->ethtool.ring, ring, sizeof(ns->ethtool.ring)); | |
| 84 | + ns->ethtool.ring.rx_pending = ring->rx_pending; | |
| 85 | + ns->ethtool.ring.rx_jumbo_pending = ring->rx_jumbo_pending; | |
| 86 | + ns->ethtool.ring.rx_mini_pending = ring->rx_mini_pending; | |
| 87 | + ns->ethtool.ring.tx_pending = ring->tx_pending; | |
| 85 | 88 | return 0; |
| 86 | 89 | } |
| 87 | 90 | |
| @@ -462,6 +462,9 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus, · 461 unmodified lines | ||
| 462 | 462 | |
| 463 | 463 | if (addr == mdiodev->addr) { |
| 464 | 464 | device_set_node(dev, of_fwnode_handle(child)); |
| 465 | + /* The refcount on "child" is passed to the mdio | |
| 466 | + * device. Do _not_ use of_node_put(child) here. | |
| 467 | + */ | |
| 465 | 468 | return; |
| 466 | 469 | } |
| 467 | 470 | } |
| @@ -76,6 +76,8 @@ · 75 unmodified lines | ||
| 76 | 76 | #define LAN7801_USB_PRODUCT_ID (0x7801) |
| 77 | 77 | #define LAN78XX_EEPROM_MAGIC (0x78A5) |
| 78 | 78 | #define LAN78XX_OTP_MAGIC (0x78F3) |
| 79 | +#define AT29M2AF_USB_VENDOR_ID (0x07C9) | |
| 80 | +#define AT29M2AF_USB_PRODUCT_ID (0x0012) | |
| 79 | 81 | |
| 80 | 82 | #define MII_READ 1 |
| 81 | 83 | #define MII_WRITE 0 |
| @@ -5060,6 +5062,10 @@ static const struct usb_device_id products[] = { · 4978 unmodified lines | ||
| 5060 | 5062 | /* LAN7801 USB Gigabit Ethernet Device */ |
| 5061 | 5063 | USB_DEVICE(LAN78XX_USB_VENDOR_ID, LAN7801_USB_PRODUCT_ID), |
| 5062 | 5064 | }, |
| 5065 | + { | |
| 5066 | + /* ATM2-AF USB Gigabit Ethernet Device */ | |
| 5067 | + USB_DEVICE(AT29M2AF_USB_VENDOR_ID, AT29M2AF_USB_PRODUCT_ID), | |
| 5068 | + }, | |
| 5063 | 5069 | {}, |
| 5064 | 5070 | }; |
| 5065 | 5071 | MODULE_DEVICE_TABLE(usb, products); |
| @@ -1358,6 +1358,7 @@ static const struct usb_device_id products[] = { · 1357 unmodified lines | ||
| 1358 | 1358 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ |
| 1359 | 1359 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */ |
| 1360 | 1360 | {QMI_QUIRK_SET_DTR(0x1bc7, 0x1060, 2)}, /* Telit LN920 */ |
| 1361 | + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1070, 2)}, /* Telit FN990 */ | |
| 1361 | 1362 | {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ |
| 1362 | 1363 | {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */ |
| 1363 | 1364 | {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ |
| @@ -733,7 +733,7 @@ static struct sk_buff *receive_small(struct net_device *dev, · 732 unmodified lines | ||
| 733 | 733 | pr_debug("%s: rx error: len %u exceeds max size %d\n", |
| 734 | 734 | dev->name, len, GOOD_PACKET_LEN); |
| 735 | 735 | dev->stats.rx_length_errors++; |
| 736 | − goto err_len; | |
| 736 | + goto err; | |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | if (likely(!vi->xdp_enabled)) { |
| @@ -825,10 +825,8 @@ static struct sk_buff *receive_small(struct net_device *dev, · 85 unmodified lines | ||
| 825 | 825 | |
| 826 | 826 | skip_xdp: |
| 827 | 827 | skb = build_skb(buf, buflen); |
| 828 | − if (!skb) { | |
| 829 | − put_page(page); | |
| 828 | + if (!skb) | |
| 830 | 829 | goto err; |
| 831 | − } | |
| 832 | 830 | skb_reserve(skb, headroom - delta); |
| 833 | 831 | skb_put(skb, len); |
| 834 | 832 | if (!xdp_prog) { |
| @@ -839,13 +837,12 @@ skip_xdp: · 4 unmodified lines | ||
| 839 | 837 | if (metasize) |
| 840 | 838 | skb_metadata_set(skb, metasize); |
| 841 | 839 | |
| 842 | −err: | |
| 843 | 840 | return skb; |
| 844 | 841 | |
| 845 | 842 | err_xdp: |
| 846 | 843 | rcu_read_unlock(); |
| 847 | 844 | stats->xdp_drops++; |
| 848 | −err_len: | |
| 845 | +err: | |
| 849 | 846 | stats->drops++; |
| 850 | 847 | put_page(page); |
| 851 | 848 | xdp_xmit: |
| @@ -533,7 +533,11 @@ static int ath11k_mhi_set_state(struct ath11k_pci *ab_pci, · 532 unmodified lines | ||
| 533 | 533 | ret = mhi_pm_suspend(ab_pci->mhi_ctrl); |
| 534 | 534 | break; |
| 535 | 535 | case ATH11K_MHI_RESUME: |
| 536 | − ret = mhi_pm_resume(ab_pci->mhi_ctrl); | |
| 536 | + /* Do force MHI resume as some devices like QCA6390, WCN6855 | |
| 537 | + * are not in M3 state but they are functional. So just ignore | |
| 538 | + * the MHI state while resuming. | |
| 539 | + */ | |
| 540 | + ret = mhi_pm_resume_force(ab_pci->mhi_ctrl); | |
| 537 | 541 | break; |
| 538 | 542 | case ATH11K_MHI_TRIGGER_RDDM: |
| 539 | 543 | ret = mhi_force_rddm_mode(ab_pci->mhi_ctrl); |
| @@ -7,16 +7,20 @@ config BRCMSMAC · 6 unmodified lines | ||
| 7 | 7 | depends on MAC80211 |
| 8 | 8 | depends on BCMA_POSSIBLE |
| 9 | 9 | select BCMA |
| 10 | − select NEW_LEDS if BCMA_DRIVER_GPIO | |
| 11 | − select LEDS_CLASS if BCMA_DRIVER_GPIO | |
| 12 | 10 | select BRCMUTIL |
| 13 | 11 | select FW_LOADER |
| 14 | 12 | select CORDIC |
| 15 | 13 | help |
| 16 | 14 | This module adds support for PCIe wireless adapters based on Broadcom |
| 17 | − IEEE802.11n SoftMAC chipsets. It also has WLAN led support, which will | |
| 18 | − be available if you select BCMA_DRIVER_GPIO. If you choose to build a | |
| 19 | − module, the driver will be called brcmsmac.ko. | |
| 15 | + IEEE802.11n SoftMAC chipsets. If you choose to build a module, the | |
| 16 | + driver will be called brcmsmac.ko. | |
| 17 | + | |
| 18 | +config BRCMSMAC_LEDS | |
| 19 | + def_bool BRCMSMAC && BCMA_DRIVER_GPIO && MAC80211_LEDS | |
| 20 | + help | |
| 21 | + The brcmsmac LED support depends on the presence of the | |
| 22 | + BCMA_DRIVER_GPIO driver, and it only works if LED support | |
| 23 | + is enabled and reachable from the driver module. | |
| 20 | 24 | |
| 21 | 25 | source "drivers/net/wireless/broadcom/brcm80211/brcmfmac/Kconfig" |
| 22 | 26 | |
| @@ -42,6 +42,6 @@ brcmsmac-y := \ · 41 unmodified lines | ||
| 42 | 42 | brcms_trace_events.o \ |
| 43 | 43 | debug.o |
| 44 | 44 | |
| 45 | −brcmsmac-$(CONFIG_BCMA_DRIVER_GPIO) += led.o | |
| 45 | +brcmsmac-$(CONFIG_BRCMSMAC_LEDS) += led.o | |
| 46 | 46 | |
| 47 | 47 | obj-$(CONFIG_BRCMSMAC) += brcmsmac.o |
| @@ -24,7 +24,7 @@ struct brcms_led { · 23 unmodified lines | ||
| 24 | 24 | struct gpio_desc *gpiod; |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | −#ifdef CONFIG_BCMA_DRIVER_GPIO | |
| 27 | +#ifdef CONFIG_BRCMSMAC_LEDS | |
| 28 | 28 | void brcms_led_unregister(struct brcms_info *wl); |
| 29 | 29 | int brcms_led_register(struct brcms_info *wl); |
| 30 | 30 | #else |
| @@ -2,14 +2,13 @@ · 1 unmodified line | ||
| 2 | 2 | config IWLEGACY |
| 3 | 3 | tristate |
| 4 | 4 | select FW_LOADER |
| 5 | − select NEW_LEDS | |
| 6 | − select LEDS_CLASS | |
| 7 | 5 | select LEDS_TRIGGERS |
| 8 | 6 | select MAC80211_LEDS |
| 9 | 7 | |
| 10 | 8 | config IWL4965 |
| 11 | 9 | tristate "Intel Wireless WiFi 4965AGN (iwl4965)" |
| 12 | 10 | depends on PCI && MAC80211 |
| 11 | + depends on LEDS_CLASS=y || LEDS_CLASS=MAC80211 | |
| 13 | 12 | select IWLEGACY |
| 14 | 13 | help |
| 15 | 14 | This option enables support for |
| @@ -38,6 +37,7 @@ config IWL4965 · 22 unmodified lines | ||
| 38 | 37 | config IWL3945 |
| 39 | 38 | tristate "Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)" |
| 40 | 39 | depends on PCI && MAC80211 |
| 40 | + depends on LEDS_CLASS=y || LEDS_CLASS=MAC80211 | |
| 41 | 41 | select IWLEGACY |
| 42 | 42 | help |
| 43 | 43 | Select to build the driver supporting the: |
| @@ -47,7 +47,7 @@ if IWLWIFI · 46 unmodified lines | ||
| 47 | 47 | |
| 48 | 48 | config IWLWIFI_LEDS |
| 49 | 49 | bool |
| 50 | − depends on LEDS_CLASS=y || LEDS_CLASS=IWLWIFI | |
| 50 | + depends on LEDS_CLASS=y || LEDS_CLASS=MAC80211 | |
| 51 | 51 | depends on IWLMVM || IWLDVM |
| 52 | 52 | select LEDS_TRIGGERS |
| 53 | 53 | select MAC80211_LEDS |
| @@ -269,17 +269,18 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm, · 268 unmodified lines | ||
| 269 | 269 | u8 rate_plcp; |
| 270 | 270 | u32 rate_flags = 0; |
| 271 | 271 | bool is_cck; |
| 272 | − struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | |
| 273 | 272 | |
| 274 | 273 | /* info->control is only relevant for non HW rate control */ |
| 275 | 274 | if (!ieee80211_hw_check(mvm->hw, HAS_RATE_CONTROL)) { |
| 275 | + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); | |
| 276 | + | |
| 276 | 277 | /* HT rate doesn't make sense for a non data frame */ |
| 277 | 278 | WARN_ONCE(info->control.rates[0].flags & IEEE80211_TX_RC_MCS && |
| 278 | 279 | !ieee80211_is_data(fc), |
| 279 | 280 | "Got a HT rate (flags:0x%x/mcs:%d/fc:0x%x/state:%d) for a non data frame\n", |
| 280 | 281 | info->control.rates[0].flags, |
| 281 | 282 | info->control.rates[0].idx, |
| 282 | − le16_to_cpu(fc), mvmsta->sta_state); | |
| 283 | + le16_to_cpu(fc), sta ? mvmsta->sta_state : -1); | |
| 283 | 284 | |
| 284 | 285 | rate_idx = info->control.rates[0].idx; |
| 285 | 286 | } |
| @@ -34,4 +34,4 @@ obj-$(CONFIG_MT76x2_COMMON) += mt76x2/ · 33 unmodified lines | ||
| 34 | 34 | obj-$(CONFIG_MT7603E) += mt7603/ |
| 35 | 35 | obj-$(CONFIG_MT7615_COMMON) += mt7615/ |
| 36 | 36 | obj-$(CONFIG_MT7915E) += mt7915/ |
| 37 | −obj-$(CONFIG_MT7921E) += mt7921/ | |
| 37 | +obj-$(CONFIG_MT7921_COMMON) += mt7921/ | |
| @@ -666,6 +666,7 @@ blk_status_t nvme_fail_nonready_command(struct nvme_ctrl *ctrl, · 665 unmodified lines | ||
| 666 | 666 | struct request *rq) |
| 667 | 667 | { |
| 668 | 668 | if (ctrl->state != NVME_CTRL_DELETING_NOIO && |
| 669 | + ctrl->state != NVME_CTRL_DELETING && | |
| 669 | 670 | ctrl->state != NVME_CTRL_DEAD && |
| 670 | 671 | !test_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags) && |
| 671 | 672 | !blk_noretry_request(rq) && !(rq->cmd_flags & REQ_NVME_MPATH)) |
| @@ -1749,9 +1750,20 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 1077 unmodified lines | ||
| 1749 | 1750 | */ |
| 1750 | 1751 | if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT))) |
| 1751 | 1752 | return -EINVAL; |
| 1752 | − if (ctrl->max_integrity_segments) | |
| 1753 | − ns->features |= | |
| 1754 | − (NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS); | |
| 1753 | + | |
| 1754 | + ns->features |= NVME_NS_EXT_LBAS; | |
| 1755 | + | |
| 1756 | + /* | |
| 1757 | + * The current fabrics transport drivers support namespace | |
| 1758 | + * metadata formats only if nvme_ns_has_pi() returns true. | |
| 1759 | + * Suppress support for all other formats so the namespace will | |
| 1760 | + * have a 0 capacity and not be usable through the block stack. | |
| 1761 | + * | |
| 1762 | + * Note, this check will need to be modified if any drivers | |
| 1763 | + * gain the ability to use other metadata formats. | |
| 1764 | + */ | |
| 1765 | + if (ctrl->max_integrity_segments && nvme_ns_has_pi(ns)) | |
| 1766 | + ns->features |= NVME_NS_METADATA_SUPPORTED; | |
| 1755 | 1767 | } else { |
| 1756 | 1768 | /* |
| 1757 | 1769 | * For PCIe controllers, we can't easily remap the separate |
| @@ -2696,8 +2708,9 @@ static bool nvme_validate_cntlid(struct nvme_subsystem *subsys, · 938 unmodified lines | ||
| 2696 | 2708 | |
| 2697 | 2709 | if (tmp->cntlid == ctrl->cntlid) { |
| 2698 | 2710 | dev_err(ctrl->device, |
| 2699 | − "Duplicate cntlid %u with %s, rejecting\n", | |
| 2700 | − ctrl->cntlid, dev_name(tmp->device)); | |
| 2711 | + "Duplicate cntlid %u with %s, subsys %s, rejecting\n", | |
| 2712 | + ctrl->cntlid, dev_name(tmp->device), | |
| 2713 | + subsys->subnqn); | |
| 2701 | 2714 | return false; |
| 2702 | 2715 | } |
| 2703 | 2716 | |
| @@ -866,7 +866,7 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) · 865 unmodified lines | ||
| 866 | 866 | } |
| 867 | 867 | if (ana_log_size > ctrl->ana_log_size) { |
| 868 | 868 | nvme_mpath_stop(ctrl); |
| 869 | − kfree(ctrl->ana_log_buf); | |
| 869 | + nvme_mpath_uninit(ctrl); | |
| 870 | 870 | ctrl->ana_log_buf = kmalloc(ana_log_size, GFP_KERNEL); |
| 871 | 871 | if (!ctrl->ana_log_buf) |
| 872 | 872 | return -ENOMEM; |
| @@ -886,4 +886,5 @@ void nvme_mpath_uninit(struct nvme_ctrl *ctrl) · 13 unmodified lines | ||
| 886 | 886 | { |
| 887 | 887 | kfree(ctrl->ana_log_buf); |
| 888 | 888 | ctrl->ana_log_buf = NULL; |
| 889 | + ctrl->ana_log_size = 0; | |
| 889 | 890 | } |
| @@ -709,7 +709,7 @@ static inline bool nvme_check_ready(struct nvme_ctrl *ctrl, struct request *rq, · 708 unmodified lines | ||
| 709 | 709 | return true; |
| 710 | 710 | if (ctrl->ops->flags & NVME_F_FABRICS && |
| 711 | 711 | ctrl->state == NVME_CTRL_DELETING) |
| 712 | − return true; | |
| 712 | + return queue_live; | |
| 713 | 713 | return __nvme_check_ready(ctrl, rq, queue_live); |
| 714 | 714 | } |
| 715 | 715 | int nvme_submit_sync_cmd(struct request_queue *q, struct nvme_command *cmd, |
| @@ -166,7 +166,10 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns, · 165 unmodified lines | ||
| 166 | 166 | zone.len = ns->zsze; |
| 167 | 167 | zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap)); |
| 168 | 168 | zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba)); |
| 169 | − zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp)); | |
| 169 | + if (zone.cond == BLK_ZONE_COND_FULL) | |
| 170 | + zone.wp = zone.start + zone.len; | |
| 171 | + else | |
| 172 | + zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp)); | |
| 170 | 173 | |
| 171 | 174 | return cb(&zone, idx, data); |
| 172 | 175 | } |
| @@ -922,7 +922,14 @@ static void nvmet_tcp_handle_req_failure(struct nvmet_tcp_queue *queue, · 921 unmodified lines | ||
| 922 | 922 | size_t data_len = le32_to_cpu(req->cmd->common.dptr.sgl.length); |
| 923 | 923 | int ret; |
| 924 | 924 | |
| 925 | − if (!nvme_is_write(cmd->req.cmd) || | |
| 925 | + /* | |
| 926 | + * This command has not been processed yet, hence we are trying to | |
| 927 | + * figure out if there is still pending data left to receive. If | |
| 928 | + * we don't, we can simply prepare for the next pdu and bail out, | |
| 929 | + * otherwise we will need to prepare a buffer and receive the | |
| 930 | + * stale data before continuing forward. | |
| 931 | + */ | |
| 932 | + if (!nvme_is_write(cmd->req.cmd) || !data_len || | |
| 926 | 933 | data_len > cmd->req.port->inline_data_size) { |
| 927 | 934 | nvmet_prepare_receive_pdu(queue); |
| 928 | 935 | return; |
| @@ -76,6 +76,26 @@ struct device_node *of_irq_find_parent(struct device_node *child) · 75 unmodified lines | ||
| 76 | 76 | } |
| 77 | 77 | EXPORT_SYMBOL_GPL(of_irq_find_parent); |
| 78 | 78 | |
| 79 | +/* | |
| 80 | + * These interrupt controllers abuse interrupt-map for unspeakable | |
| 81 | + * reasons and rely on the core code to *ignore* it (the drivers do | |
| 82 | + * their own parsing of the property). | |
| 83 | + * | |
| 84 | + * If you think of adding to the list for something *new*, think | |
| 85 | + * again. There is a high chance that you will be sent back to the | |
| 86 | + * drawing board. | |
| 87 | + */ | |
| 88 | +static const char * const of_irq_imap_abusers[] = { | |
| 89 | + "CBEA,platform-spider-pic", | |
| 90 | + "sti,platform-spider-pic", | |
| 91 | + "realtek,rtl-intc", | |
| 92 | + "fsl,ls1021a-extirq", | |
| 93 | + "fsl,ls1043a-extirq", | |
| 94 | + "fsl,ls1088a-extirq", | |
| 95 | + "renesas,rza1-irqc", | |
| 96 | + NULL, | |
| 97 | +}; | |
| 98 | + | |
| 79 | 99 | /** |
| 80 | 100 | * of_irq_parse_raw - Low level interrupt tree parsing |
| 81 | 101 | * @addr: address specifier (start of "reg" property of the device) in be32 format |
| @@ -159,12 +179,15 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) · 77 unmodified lines | ||
| 159 | 179 | /* |
| 160 | 180 | * Now check if cursor is an interrupt-controller and |
| 161 | 181 | * if it is then we are done, unless there is an |
| 162 | − * interrupt-map which takes precedence. | |
| 182 | + * interrupt-map which takes precedence except on one | |
| 183 | + * of these broken platforms that want to parse | |
| 184 | + * interrupt-map themselves for $reason. | |
| 163 | 185 | */ |
| 164 | 186 | bool intc = of_property_read_bool(ipar, "interrupt-controller"); |
| 165 | 187 | |
| 166 | 188 | imap = of_get_property(ipar, "interrupt-map", &imaplen); |
| 167 | − if (imap == NULL && intc) { | |
| 189 | + if (intc && | |
| 190 | + (!imap || of_device_compatible_match(ipar, of_irq_imap_abusers))) { | |
| 168 | 191 | pr_debug(" -> got it !\n"); |
| 169 | 192 | return 0; |
| 170 | 193 | } |
| @@ -332,8 +332,8 @@ config PCIE_APPLE · 331 unmodified lines | ||
| 332 | 332 | If unsure, say Y if you have an Apple Silicon system. |
| 333 | 333 | |
| 334 | 334 | config PCIE_MT7621 |
| 335 | − tristate "MediaTek MT7621 PCIe Controller" | |
| 336 | − depends on (RALINK && SOC_MT7621) || (MIPS && COMPILE_TEST) | |
| 335 | + bool "MediaTek MT7621 PCIe Controller" | |
| 336 | + depends on SOC_MT7621 || (MIPS && COMPILE_TEST) | |
| 337 | 337 | select PHY_MT7621_PCI |
| 338 | 338 | default SOC_MT7621 |
| 339 | 339 | help |
| @@ -32,7 +32,6 @@ · 31 unmodified lines | ||
| 32 | 32 | #define PCIE_CORE_DEV_ID_REG 0x0 |
| 33 | 33 | #define PCIE_CORE_CMD_STATUS_REG 0x4 |
| 34 | 34 | #define PCIE_CORE_DEV_REV_REG 0x8 |
| 35 | −#define PCIE_CORE_EXP_ROM_BAR_REG 0x30 | |
| 36 | 35 | #define PCIE_CORE_PCIEXP_CAP 0xc0 |
| 37 | 36 | #define PCIE_CORE_ERR_CAPCTL_REG 0x118 |
| 38 | 37 | #define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5) |
| @@ -774,10 +773,6 @@ advk_pci_bridge_emul_base_conf_read(struct pci_bridge_emul *bridge, · 735 unmodified lines | ||
| 774 | 773 | *value = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG); |
| 775 | 774 | return PCI_BRIDGE_EMUL_HANDLED; |
| 776 | 775 | |
| 777 | − case PCI_ROM_ADDRESS1: | |
| 778 | − *value = advk_readl(pcie, PCIE_CORE_EXP_ROM_BAR_REG); | |
| 779 | − return PCI_BRIDGE_EMUL_HANDLED; | |
| 780 | − | |
| 781 | 776 | case PCI_INTERRUPT_LINE: { |
| 782 | 777 | /* |
| 783 | 778 | * From the whole 32bit register we support reading from HW only |
| @@ -810,10 +805,6 @@ advk_pci_bridge_emul_base_conf_write(struct pci_bridge_emul *bridge, · 26 unmodified lines | ||
| 810 | 805 | advk_writel(pcie, new, PCIE_CORE_CMD_STATUS_REG); |
| 811 | 806 | break; |
| 812 | 807 | |
| 813 | − case PCI_ROM_ADDRESS1: | |
| 814 | − advk_writel(pcie, new, PCIE_CORE_EXP_ROM_BAR_REG); | |
| 815 | − break; | |
| 816 | − | |
| 817 | 808 | case PCI_INTERRUPT_LINE: |
| 818 | 809 | if (mask & (PCI_BRIDGE_CTL_BUS_RESET << 16)) { |
| 819 | 810 | u32 val = advk_readl(pcie, PCIE_CORE_CTRL1_REG); |
| @@ -516,7 +516,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie, · 515 unmodified lines | ||
| 516 | 516 | int ret, i; |
| 517 | 517 | |
| 518 | 518 | reset = gpiod_get_from_of_node(np, "reset-gpios", 0, |
| 519 | − GPIOD_OUT_LOW, "#PERST"); | |
| 519 | + GPIOD_OUT_LOW, "PERST#"); | |
| 520 | 520 | if (IS_ERR(reset)) |
| 521 | 521 | return PTR_ERR(reset); |
| 522 | 522 | |
| @@ -539,12 +539,22 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie, · 16 unmodified lines | ||
| 539 | 539 | |
| 540 | 540 | rmw_set(PORT_APPCLK_EN, port->base + PORT_APPCLK); |
| 541 | 541 | |
| 542 | + /* Assert PERST# before setting up the clock */ | |
| 543 | + gpiod_set_value(reset, 1); | |
| 544 | + | |
| 542 | 545 | ret = apple_pcie_setup_refclk(pcie, port); |
| 543 | 546 | if (ret < 0) |
| 544 | 547 | return ret; |
| 545 | 548 | |
| 549 | + /* The minimal Tperst-clk value is 100us (PCIe CEM r5.0, 2.9.2) */ | |
| 550 | + usleep_range(100, 200); | |
| 551 | + | |
| 552 | + /* Deassert PERST# */ | |
| 546 | 553 | rmw_set(PORT_PERST_OFF, port->base + PORT_PERST); |
| 547 | − gpiod_set_value(reset, 1); | |
| 554 | + gpiod_set_value(reset, 0); | |
| 555 | + | |
| 556 | + /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ | |
| 557 | + msleep(100); | |
| 548 | 558 | |
| 549 | 559 | ret = readl_relaxed_poll_timeout(port->base + PORT_STATUS, stat, |
| 550 | 560 | stat & PORT_STATUS_READY, 100, 250000); |
| @@ -757,8 +757,8 @@ static int hi3670_pcie_phy_get_resources(struct hi3670_pcie_phy *phy, · 756 unmodified lines | ||
| 757 | 757 | return PTR_ERR(phy->sysctrl); |
| 758 | 758 | |
| 759 | 759 | phy->pmctrl = syscon_regmap_lookup_by_compatible("hisilicon,hi3670-pmctrl"); |
| 760 | − if (IS_ERR(phy->sysctrl)) | |
| 761 | − return PTR_ERR(phy->sysctrl); | |
| 760 | + if (IS_ERR(phy->pmctrl)) | |
| 761 | + return PTR_ERR(phy->pmctrl); | |
| 762 | 762 | |
| 763 | 763 | /* clocks */ |
| 764 | 764 | phy->phy_ref_clk = devm_clk_get(dev, "phy_ref"); |
| @@ -82,9 +82,9 @@ · 81 unmodified lines | ||
| 82 | 82 | * struct mvebu_cp110_utmi - PHY driver data |
| 83 | 83 | * |
| 84 | 84 | * @regs: PHY registers |
| 85 | − * @syscom: Regmap with system controller registers | |
| 85 | + * @syscon: Regmap with system controller registers | |
| 86 | 86 | * @dev: device driver handle |
| 87 | − * @caps: PHY capabilities | |
| 87 | + * @ops: phy ops | |
| 88 | 88 | */ |
| 89 | 89 | struct mvebu_cp110_utmi { |
| 90 | 90 | void __iomem *regs; |
| @@ -127,12 +127,13 @@ struct phy_drvdata { · 126 unmodified lines | ||
| 127 | 127 | }; |
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | − * Write register and read back masked value to confirm it is written | |
| 130 | + * usb_phy_write_readback() - Write register and read back masked value to | |
| 131 | + * confirm it is written | |
| 131 | 132 | * |
| 132 | − * @base - QCOM DWC3 PHY base virtual address. | |
| 133 | − * @offset - register offset. | |
| 134 | − * @mask - register bitmask specifying what should be updated | |
| 135 | − * @val - value to write. | |
| 133 | + * @phy_dwc3: QCOM DWC3 phy context | |
| 134 | + * @offset: register offset. | |
| 135 | + * @mask: register bitmask specifying what should be updated | |
| 136 | + * @val: value to write. | |
| 136 | 137 | */ |
| 137 | 138 | static inline void usb_phy_write_readback(struct usb_phy *phy_dwc3, |
| 138 | 139 | u32 offset, |
| @@ -171,11 +172,11 @@ static int wait_for_latch(void __iomem *addr) · 32 unmodified lines | ||
| 171 | 172 | } |
| 172 | 173 | |
| 173 | 174 | /** |
| 174 | − * Write SSPHY register | |
| 175 | + * usb_ss_write_phycreg() - Write SSPHY register | |
| 175 | 176 | * |
| 176 | − * @base - QCOM DWC3 PHY base virtual address. | |
| 177 | − * @addr - SSPHY address to write. | |
| 178 | − * @val - value to write. | |
| 177 | + * @phy_dwc3: QCOM DWC3 phy context | |
| 178 | + * @addr: SSPHY address to write. | |
| 179 | + * @val: value to write. | |
| 179 | 180 | */ |
| 180 | 181 | static int usb_ss_write_phycreg(struct usb_phy *phy_dwc3, |
| 181 | 182 | u32 addr, u32 val) |
| @@ -209,10 +210,11 @@ err_wait: · 27 unmodified lines | ||
| 209 | 210 | } |
| 210 | 211 | |
| 211 | 212 | /** |
| 212 | − * Read SSPHY register. | |
| 213 | + * usb_ss_read_phycreg() - Read SSPHY register. | |
| 213 | 214 | * |
| 214 | − * @base - QCOM DWC3 PHY base virtual address. | |
| 215 | − * @addr - SSPHY address to read. | |
| 215 | + * @phy_dwc3: QCOM DWC3 phy context | |
| 216 | + * @addr: SSPHY address to read. | |
| 217 | + * @val: pointer in which read is store. | |
| 216 | 218 | */ |
| 217 | 219 | static int usb_ss_read_phycreg(struct usb_phy *phy_dwc3, |
| 218 | 220 | u32 addr, u32 *val) |
| @@ -2973,6 +2973,9 @@ struct qmp_phy_combo_cfg { · 2972 unmodified lines | ||
| 2973 | 2973 | * @qmp: QMP phy to which this lane belongs |
| 2974 | 2974 | * @lane_rst: lane's reset controller |
| 2975 | 2975 | * @mode: current PHY mode |
| 2976 | + * @dp_aux_cfg: Display port aux config | |
| 2977 | + * @dp_opts: Display port optional config | |
| 2978 | + * @dp_clks: Display port clocks | |
| 2976 | 2979 | */ |
| 2977 | 2980 | struct qmp_phy { |
| 2978 | 2981 | struct phy *phy; |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | −/** | |
| 2 | +/* | |
| 3 | 3 | * Copyright (C) 2016 Linaro Ltd |
| 4 | 4 | */ |
| 5 | 5 | #include <linux/module.h> |
| @@ -478,7 +478,7 @@ static void stm32_usbphyc_phy_tuning(struct stm32_usbphyc *usbphyc, · 477 unmodified lines | ||
| 478 | 478 | if (!of_property_read_bool(np, "st,no-lsfs-fb-cap")) |
| 479 | 479 | usbphyc_phy->tune |= LFSCAPEN; |
| 480 | 480 | |
| 481 | − if (of_property_read_bool(np, "st,slow-hs-slew-rate")) | |
| 481 | + if (of_property_read_bool(np, "st,decrease-hs-slew-rate")) | |
| 482 | 482 | usbphyc_phy->tune |= HSDRVSLEW; |
| 483 | 483 | |
| 484 | 484 | ret = of_property_read_u32(np, "st,tune-hs-dc-level", &val); |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | −/** | |
| 2 | +/* | |
| 3 | 3 | * PCIe SERDES driver for AM654x SoC |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2018 - 2019 Texas Instruments Incorporated - http://www.ti.com/ |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | −/** | |
| 2 | +/* | |
| 3 | 3 | * Wrapper driver for SERDES used in J721E |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ |
| @@ -89,9 +89,9 @@ static inline void omap_usb_writel(void __iomem *addr, unsigned int offset, · 88 unmodified lines | ||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | − * omap_usb2_set_comparator - links the comparator present in the system with | |
| 93 | − * this phy | |
| 94 | − * @comparator - the companion phy(comparator) for this phy | |
| 92 | + * omap_usb2_set_comparator() - links the comparator present in the system with this phy | |
| 93 | + * | |
| 94 | + * @comparator: the companion phy(comparator) for this phy | |
| 95 | 95 | * |
| 96 | 96 | * The phy companion driver should call this API passing the phy_companion |
| 97 | 97 | * filled with set_vbus and start_srp to be used by usb phy. |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | −/** | |
| 2 | +/* | |
| 3 | 3 | * tusb1210.c - TUSB1210 USB ULPI PHY driver |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2015 Intel Corporation |
| @@ -20,7 +20,6 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc, · 19 unmodified lines | ||
| 20 | 20 | struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc); |
| 21 | 21 | struct mrq_reset_request request; |
| 22 | 22 | struct tegra_bpmp_message msg; |
| 23 | − int err; | |
| 24 | 23 | |
| 25 | 24 | memset(&request, 0, sizeof(request)); |
| 26 | 25 | request.cmd = command; |
| @@ -31,13 +30,7 @@ static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc, · 4 unmodified lines | ||
| 31 | 30 | msg.tx.data = &request; |
| 32 | 31 | msg.tx.size = sizeof(request); |
| 33 | 32 | |
| 34 | − err = tegra_bpmp_transfer(bpmp, &msg); | |
| 35 | − if (err) | |
| 36 | − return err; | |
| 37 | − if (msg.rx.ret) | |
| 38 | − return -EINVAL; | |
| 39 | − | |
| 40 | − return 0; | |
| 33 | + return tegra_bpmp_transfer(bpmp, &msg); | |
| 41 | 34 | } |
| 42 | 35 | |
| 43 | 36 | static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc, |
| @@ -282,12 +282,12 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, · 281 unmodified lines | ||
| 282 | 282 | if (rc) { |
| 283 | 283 | pm8001_dbg(pm8001_ha, FAIL, |
| 284 | 284 | "pm8001_setup_irq failed [ret: %d]\n", rc); |
| 285 | − goto err_out_shost; | |
| 285 | + goto err_out; | |
| 286 | 286 | } |
| 287 | 287 | /* Request Interrupt */ |
| 288 | 288 | rc = pm8001_request_irq(pm8001_ha); |
| 289 | 289 | if (rc) |
| 290 | − goto err_out_shost; | |
| 290 | + goto err_out; | |
| 291 | 291 | |
| 292 | 292 | count = pm8001_ha->max_q_num; |
| 293 | 293 | /* Queues are chosen based on the number of cores/msix availability */ |
| @@ -423,8 +423,6 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, · 129 unmodified lines | ||
| 423 | 423 | pm8001_tag_init(pm8001_ha); |
| 424 | 424 | return 0; |
| 425 | 425 | |
| 426 | −err_out_shost: | |
| 427 | − scsi_remove_host(pm8001_ha->shost); | |
| 428 | 426 | err_out_nodev: |
| 429 | 427 | for (i = 0; i < pm8001_ha->max_memcnt; i++) { |
| 430 | 428 | if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) { |
| @@ -732,7 +732,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, · 731 unmodified lines | ||
| 732 | 732 | { |
| 733 | 733 | struct qedi_work_map *work, *work_tmp; |
| 734 | 734 | u32 proto_itt = cqe->itid; |
| 735 | − itt_t protoitt = 0; | |
| 736 | 735 | int found = 0; |
| 737 | 736 | struct qedi_cmd *qedi_cmd = NULL; |
| 738 | 737 | u32 iscsi_cid; |
| @@ -812,16 +811,12 @@ unlock: · 73 unmodified lines | ||
| 812 | 811 | return; |
| 813 | 812 | |
| 814 | 813 | check_cleanup_reqs: |
| 815 | − if (qedi_conn->cmd_cleanup_req > 0) { | |
| 816 | − QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID, | |
| 814 | + if (atomic_inc_return(&qedi_conn->cmd_cleanup_cmpl) == | |
| 815 | + qedi_conn->cmd_cleanup_req) { | |
| 816 | + QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, | |
| 817 | 817 | "Freeing tid=0x%x for cid=0x%x\n", |
| 818 | 818 | cqe->itid, qedi_conn->iscsi_conn_id); |
| 819 | − qedi_conn->cmd_cleanup_cmpl++; | |
| 820 | 819 | wake_up(&qedi_conn->wait_queue); |
| 821 | − } else { | |
| 822 | − QEDI_ERR(&qedi->dbg_ctx, | |
| 823 | − "Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x\n", | |
| 824 | − protoitt, cqe->itid, qedi_conn->iscsi_conn_id); | |
| 825 | 820 | } |
| 826 | 821 | } |
| 827 | 822 | |
| @@ -1163,7 +1158,7 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 335 unmodified lines | ||
| 1163 | 1158 | } |
| 1164 | 1159 | |
| 1165 | 1160 | qedi_conn->cmd_cleanup_req = 0; |
| 1166 | − qedi_conn->cmd_cleanup_cmpl = 0; | |
| 1161 | + atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0); | |
| 1167 | 1162 | |
| 1168 | 1163 | QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, |
| 1169 | 1164 | "active_cmd_count=%d, cid=0x%x, in_recovery=%d, lun_reset=%d\n", |
| @@ -1215,16 +1210,15 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 45 unmodified lines | ||
| 1215 | 1210 | qedi_conn->iscsi_conn_id); |
| 1216 | 1211 | |
| 1217 | 1212 | rval = wait_event_interruptible_timeout(qedi_conn->wait_queue, |
| 1218 | − ((qedi_conn->cmd_cleanup_req == | |
| 1219 | − qedi_conn->cmd_cleanup_cmpl) || | |
| 1220 | − test_bit(QEDI_IN_RECOVERY, | |
| 1221 | − &qedi->flags)), | |
| 1222 | − 5 * HZ); | |
| 1213 | + (qedi_conn->cmd_cleanup_req == | |
| 1214 | + atomic_read(&qedi_conn->cmd_cleanup_cmpl)) || | |
| 1215 | + test_bit(QEDI_IN_RECOVERY, &qedi->flags), | |
| 1216 | + 5 * HZ); | |
| 1223 | 1217 | if (rval) { |
| 1224 | 1218 | QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, |
| 1225 | 1219 | "i/o cmd_cleanup_req=%d, equal to cmd_cleanup_cmpl=%d, cid=0x%x\n", |
| 1226 | 1220 | qedi_conn->cmd_cleanup_req, |
| 1227 | − qedi_conn->cmd_cleanup_cmpl, | |
| 1221 | + atomic_read(&qedi_conn->cmd_cleanup_cmpl), | |
| 1228 | 1222 | qedi_conn->iscsi_conn_id); |
| 1229 | 1223 | |
| 1230 | 1224 | return 0; |
| @@ -1233,7 +1227,7 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 2 unmodified lines | ||
| 1233 | 1227 | QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM, |
| 1234 | 1228 | "i/o cmd_cleanup_req=%d, not equal to cmd_cleanup_cmpl=%d, cid=0x%x\n", |
| 1235 | 1229 | qedi_conn->cmd_cleanup_req, |
| 1236 | − qedi_conn->cmd_cleanup_cmpl, | |
| 1230 | + atomic_read(&qedi_conn->cmd_cleanup_cmpl), | |
| 1237 | 1231 | qedi_conn->iscsi_conn_id); |
| 1238 | 1232 | |
| 1239 | 1233 | iscsi_host_for_each_session(qedi->shost, |
| @@ -1242,11 +1236,10 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 2 unmodified lines | ||
| 1242 | 1236 | |
| 1243 | 1237 | /* Enable IOs for all other sessions except current.*/ |
| 1244 | 1238 | if (!wait_event_interruptible_timeout(qedi_conn->wait_queue, |
| 1245 | − (qedi_conn->cmd_cleanup_req == | |
| 1246 | − qedi_conn->cmd_cleanup_cmpl) || | |
| 1247 | − test_bit(QEDI_IN_RECOVERY, | |
| 1248 | − &qedi->flags), | |
| 1249 | − 5 * HZ)) { | |
| 1239 | + (qedi_conn->cmd_cleanup_req == | |
| 1240 | + atomic_read(&qedi_conn->cmd_cleanup_cmpl)) || | |
| 1241 | + test_bit(QEDI_IN_RECOVERY, &qedi->flags), | |
| 1242 | + 5 * HZ)) { | |
| 1250 | 1243 | iscsi_host_for_each_session(qedi->shost, |
| 1251 | 1244 | qedi_mark_device_available); |
| 1252 | 1245 | return -1; |
| @@ -1266,7 +1259,7 @@ void qedi_clearsq(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, · 13 unmodified lines | ||
| 1266 | 1259 | |
| 1267 | 1260 | qedi_ep = qedi_conn->ep; |
| 1268 | 1261 | qedi_conn->cmd_cleanup_req = 0; |
| 1269 | − qedi_conn->cmd_cleanup_cmpl = 0; | |
| 1262 | + atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0); | |
| 1270 | 1263 | |
| 1271 | 1264 | if (!qedi_ep) { |
| 1272 | 1265 | QEDI_WARN(&qedi->dbg_ctx, |
| @@ -412,7 +412,7 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session, · 411 unmodified lines | ||
| 412 | 412 | qedi_conn->iscsi_conn_id = qedi_ep->iscsi_cid; |
| 413 | 413 | qedi_conn->fw_cid = qedi_ep->fw_cid; |
| 414 | 414 | qedi_conn->cmd_cleanup_req = 0; |
| 415 | − qedi_conn->cmd_cleanup_cmpl = 0; | |
| 415 | + atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0); | |
| 416 | 416 | |
| 417 | 417 | if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) { |
| 418 | 418 | rc = -EINVAL; |
| @@ -155,7 +155,7 @@ struct qedi_conn { · 154 unmodified lines | ||
| 155 | 155 | spinlock_t list_lock; /* internal conn lock */ |
| 156 | 156 | u32 active_cmd_count; |
| 157 | 157 | u32 cmd_cleanup_req; |
| 158 | − u32 cmd_cleanup_cmpl; | |
| 158 | + atomic_t cmd_cleanup_cmpl; | |
| 159 | 159 | |
| 160 | 160 | u32 iscsi_conn_id; |
| 161 | 161 | int itt; |
| @@ -2491,6 +2491,9 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...) · 2490 unmodified lines | ||
| 2491 | 2491 | struct va_format vaf; |
| 2492 | 2492 | char pbuf[64]; |
| 2493 | 2493 | |
| 2494 | + if (!ql_mask_match(level) && !trace_ql_dbg_log_enabled()) | |
| 2495 | + return; | |
| 2496 | + | |
| 2494 | 2497 | va_start(va, fmt); |
| 2495 | 2498 | |
| 2496 | 2499 | vaf.fmt = fmt; |
| @@ -4342,7 +4342,7 @@ static int resp_report_zones(struct scsi_cmnd *scp, · 4341 unmodified lines | ||
| 4342 | 4342 | rep_max_zones = min((alloc_len - 64) >> ilog2(RZONES_DESC_HD), |
| 4343 | 4343 | max_zones); |
| 4344 | 4344 | |
| 4345 | − arr = kcalloc(RZONES_DESC_HD, alloc_len, GFP_ATOMIC); | |
| 4345 | + arr = kzalloc(alloc_len, GFP_ATOMIC); | |
| 4346 | 4346 | if (!arr) { |
| 4347 | 4347 | mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, |
| 4348 | 4348 | INSUFF_RES_ASCQ); |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | #define BLK_SFT_RSTN 0x0 |
| 19 | 19 | #define BLK_CLK_EN 0x4 |
| 20 | +#define BLK_MIPI_RESET_DIV 0x8 /* Mini/Nano DISPLAY_BLK_CTRL only */ | |
| 20 | 21 | |
| 21 | 22 | struct imx8m_blk_ctrl_domain; |
| 22 | 23 | |
| @@ -36,6 +37,15 @@ struct imx8m_blk_ctrl_domain_data { · 13 unmodified lines | ||
| 36 | 37 | const char *gpc_name; |
| 37 | 38 | u32 rst_mask; |
| 38 | 39 | u32 clk_mask; |
| 40 | + | |
| 41 | + /* | |
| 42 | + * i.MX8M Mini and Nano have a third DISPLAY_BLK_CTRL register | |
| 43 | + * which is used to control the reset for the MIPI Phy. | |
| 44 | + * Since it's only present in certain circumstances, | |
| 45 | + * an if-statement should be used before setting and clearing this | |
| 46 | + * register. | |
| 47 | + */ | |
| 48 | + u32 mipi_phy_rst_mask; | |
| 39 | 49 | }; |
| 40 | 50 | |
| 41 | 51 | #define DOMAIN_MAX_CLKS 3 |
| @@ -78,6 +88,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd) · 36 unmodified lines | ||
| 78 | 88 | |
| 79 | 89 | /* put devices into reset */ |
| 80 | 90 | regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask); |
| 91 | + if (data->mipi_phy_rst_mask) | |
| 92 | + regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask); | |
| 81 | 93 | |
| 82 | 94 | /* enable upstream and blk-ctrl clocks to allow reset to propagate */ |
| 83 | 95 | ret = clk_bulk_prepare_enable(data->num_clks, domain->clks); |
| @@ -99,6 +111,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd) · 15 unmodified lines | ||
| 99 | 111 | |
| 100 | 112 | /* release reset */ |
| 101 | 113 | regmap_set_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask); |
| 114 | + if (data->mipi_phy_rst_mask) | |
| 115 | + regmap_set_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask); | |
| 102 | 116 | |
| 103 | 117 | /* disable upstream clocks */ |
| 104 | 118 | clk_bulk_disable_unprepare(data->num_clks, domain->clks); |
| @@ -120,6 +134,9 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd) · 15 unmodified lines | ||
| 120 | 134 | struct imx8m_blk_ctrl *bc = domain->bc; |
| 121 | 135 | |
| 122 | 136 | /* put devices into reset and disable clocks */ |
| 137 | + if (data->mipi_phy_rst_mask) | |
| 138 | + regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask); | |
| 139 | + | |
| 123 | 140 | regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask); |
| 124 | 141 | regmap_clear_bits(bc->regmap, BLK_CLK_EN, data->clk_mask); |
| 125 | 142 | |
| @@ -480,6 +497,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] · 354 unmodified lines | ||
| 480 | 497 | .gpc_name = "mipi-dsi", |
| 481 | 498 | .rst_mask = BIT(5), |
| 482 | 499 | .clk_mask = BIT(8) | BIT(9), |
| 500 | + .mipi_phy_rst_mask = BIT(17), | |
| 483 | 501 | }, |
| 484 | 502 | [IMX8MM_DISPBLK_PD_MIPI_CSI] = { |
| 485 | 503 | .name = "dispblk-mipi-csi", |
| @@ -488,6 +506,7 @@ static const struct imx8m_blk_ctrl_domain_data imx8mm_disp_blk_ctl_domain_data[] · 2 unmodified lines | ||
| 488 | 506 | .gpc_name = "mipi-csi", |
| 489 | 507 | .rst_mask = BIT(3) | BIT(4), |
| 490 | 508 | .clk_mask = BIT(10) | BIT(11), |
| 509 | + .mipi_phy_rst_mask = BIT(16), | |
| 491 | 510 | }, |
| 492 | 511 | }; |
| 493 | 512 | |
| @@ -36,6 +36,10 @@ static int __init imx_soc_device_init(void) · 35 unmodified lines | ||
| 36 | 36 | int ret; |
| 37 | 37 | int i; |
| 38 | 38 | |
| 39 | + /* Return early if this is running on devices with different SoCs */ | |
| 40 | + if (!__mxc_cpu_type) | |
| 41 | + return 0; | |
| 42 | + | |
| 39 | 43 | if (of_machine_is_compatible("fsl,ls1021a")) |
| 40 | 44 | return 0; |
| 41 | 45 | |
| @@ -320,7 +320,7 @@ static struct platform_driver tegra_fuse_driver = { · 319 unmodified lines | ||
| 320 | 320 | }; |
| 321 | 321 | builtin_platform_driver(tegra_fuse_driver); |
| 322 | 322 | |
| 323 | −bool __init tegra_fuse_read_spare(unsigned int spare) | |
| 323 | +u32 __init tegra_fuse_read_spare(unsigned int spare) | |
| 324 | 324 | { |
| 325 | 325 | unsigned int offset = fuse->soc->info->spare + spare * 4; |
| 326 | 326 | |
| @@ -65,7 +65,7 @@ struct tegra_fuse { · 64 unmodified lines | ||
| 65 | 65 | void tegra_init_revision(void); |
| 66 | 66 | void tegra_init_apbmisc(void); |
| 67 | 67 | |
| 68 | −bool __init tegra_fuse_read_spare(unsigned int spare); | |
| 68 | +u32 __init tegra_fuse_read_spare(unsigned int spare); | |
| 69 | 69 | u32 __init tegra_fuse_read_early(unsigned int offset); |
| 70 | 70 | |
| 71 | 71 | u8 tegra_get_major_rev(void); |
| @@ -203,9 +203,8 @@ static int copy_ta_binary(struct tee_context *ctx, void *ptr, void **ta, · 202 unmodified lines | ||
| 203 | 203 | |
| 204 | 204 | *ta_size = roundup(fw->size, PAGE_SIZE); |
| 205 | 205 | *ta = (void *)__get_free_pages(GFP_KERNEL, get_order(*ta_size)); |
| 206 | − if (IS_ERR(*ta)) { | |
| 207 | − pr_err("%s: get_free_pages failed 0x%llx\n", __func__, | |
| 208 | − (u64)*ta); | |
| 206 | + if (!*ta) { | |
| 207 | + pr_err("%s: get_free_pages failed\n", __func__); | |
| 209 | 208 | rc = -ENOMEM; |
| 210 | 209 | goto rel_fw; |
| 211 | 210 | } |
| @@ -29,7 +29,7 @@ static const char * const fivr_strings[] = { · 28 unmodified lines | ||
| 29 | 29 | }; |
| 30 | 30 | |
| 31 | 31 | static const struct mmio_reg tgl_fivr_mmio_regs[] = { |
| 32 | − { 0, 0x5A18, 3, 0x7, 12}, /* vco_ref_code_lo */ | |
| 32 | + { 0, 0x5A18, 3, 0x7, 11}, /* vco_ref_code_lo */ | |
| 33 | 33 | { 0, 0x5A18, 8, 0xFF, 16}, /* vco_ref_code_hi */ |
| 34 | 34 | { 0, 0x5A08, 8, 0xFF, 0}, /* spread_spectrum_pct */ |
| 35 | 35 | { 0, 0x5A08, 1, 0x1, 8}, /* spread_spectrum_clk_enable */ |
| @@ -406,7 +406,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, · 405 unmodified lines | ||
| 406 | 406 | * the USB-2 spec requires such endpoints to have wMaxPacketSize = 0 |
| 407 | 407 | * (see the end of section 5.6.3), so don't warn about them. |
| 408 | 408 | */ |
| 409 | − maxp = usb_endpoint_maxp(&endpoint->desc); | |
| 409 | + maxp = le16_to_cpu(endpoint->desc.wMaxPacketSize); | |
| 410 | 410 | if (maxp == 0 && !(usb_endpoint_xfer_isoc(d) && asnum == 0)) { |
| 411 | 411 | dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid wMaxPacketSize 0\n", |
| 412 | 412 | cfgno, inum, asnum, d->bEndpointAddress); |
| @@ -422,9 +422,9 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, · 9 unmodified lines | ||
| 422 | 422 | maxpacket_maxes = full_speed_maxpacket_maxes; |
| 423 | 423 | break; |
| 424 | 424 | case USB_SPEED_HIGH: |
| 425 | − /* Bits 12..11 are allowed only for HS periodic endpoints */ | |
| 425 | + /* Multiple-transactions bits are allowed only for HS periodic endpoints */ | |
| 426 | 426 | if (usb_endpoint_xfer_int(d) || usb_endpoint_xfer_isoc(d)) { |
| 427 | − i = maxp & (BIT(12) | BIT(11)); | |
| 427 | + i = maxp & USB_EP_MAXP_MULT_MASK; | |
| 428 | 428 | maxp &= ~i; |
| 429 | 429 | } |
| 430 | 430 | fallthrough; |
| @@ -649,7 +649,6 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev) · 648 unmodified lines | ||
| 649 | 649 | struct dwc3_qcom *qcom = platform_get_drvdata(pdev); |
| 650 | 650 | struct device_node *np = pdev->dev.of_node, *dwc3_np; |
| 651 | 651 | struct device *dev = &pdev->dev; |
| 652 | − struct property *prop; | |
| 653 | 652 | int ret; |
| 654 | 653 | |
| 655 | 654 | dwc3_np = of_get_compatible_child(np, "snps,dwc3"); |
| @@ -658,20 +657,6 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev) · 2 unmodified lines | ||
| 658 | 657 | return -ENODEV; |
| 659 | 658 | } |
| 660 | 659 | |
| 661 | − prop = devm_kzalloc(dev, sizeof(*prop), GFP_KERNEL); | |
| 662 | − if (!prop) { | |
| 663 | − ret = -ENOMEM; | |
| 664 | − dev_err(dev, "unable to allocate memory for property\n"); | |
| 665 | − goto node_put; | |
| 666 | − } | |
| 667 | − | |
| 668 | − prop->name = "tx-fifo-resize"; | |
| 669 | − ret = of_add_property(dwc3_np, prop); | |
| 670 | − if (ret) { | |
| 671 | − dev_err(dev, "unable to add property\n"); | |
| 672 | − goto node_put; | |
| 673 | − } | |
| 674 | − | |
| 675 | 660 | ret = of_platform_populate(np, NULL, NULL, dev); |
| 676 | 661 | if (ret) { |
| 677 | 662 | dev_err(dev, "failed to register dwc3 core - %d\n", ret); |
| @@ -1679,6 +1679,18 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) · 1678 unmodified lines | ||
| 1679 | 1679 | struct usb_function *f = NULL; |
| 1680 | 1680 | u8 endp; |
| 1681 | 1681 | |
| 1682 | + if (w_length > USB_COMP_EP0_BUFSIZ) { | |
| 1683 | + if (ctrl->bRequestType == USB_DIR_OUT) { | |
| 1684 | + goto done; | |
| 1685 | + } else { | |
| 1686 | + /* Cast away the const, we are going to overwrite on purpose. */ | |
| 1687 | + __le16 *temp = (__le16 *)&ctrl->wLength; | |
| 1688 | + | |
| 1689 | + *temp = cpu_to_le16(USB_COMP_EP0_BUFSIZ); | |
| 1690 | + w_length = USB_COMP_EP0_BUFSIZ; | |
| 1691 | + } | |
| 1692 | + } | |
| 1693 | + | |
| 1682 | 1694 | /* partial re-init of the response message; the function or the |
| 1683 | 1695 | * gadget might need to intercept e.g. a control-OUT completion |
| 1684 | 1696 | * when we delegate to it. |
| @@ -2209,7 +2221,7 @@ int composite_dev_prepare(struct usb_composite_driver *composite, · 524 unmodified lines | ||
| 2209 | 2221 | if (!cdev->req) |
| 2210 | 2222 | return -ENOMEM; |
| 2211 | 2223 | |
| 2212 | − cdev->req->buf = kmalloc(USB_COMP_EP0_BUFSIZ, GFP_KERNEL); | |
| 2224 | + cdev->req->buf = kzalloc(USB_COMP_EP0_BUFSIZ, GFP_KERNEL); | |
| 2213 | 2225 | if (!cdev->req->buf) |
| 2214 | 2226 | goto fail; |
| 2215 | 2227 | |
| @@ -137,7 +137,7 @@ static int dbgp_enable_ep_req(struct usb_ep *ep) · 136 unmodified lines | ||
| 137 | 137 | goto fail_1; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | − req->buf = kmalloc(DBGP_REQ_LEN, GFP_KERNEL); | |
| 140 | + req->buf = kzalloc(DBGP_REQ_LEN, GFP_KERNEL); | |
| 141 | 141 | if (!req->buf) { |
| 142 | 142 | err = -ENOMEM; |
| 143 | 143 | stp = 2; |
| @@ -345,6 +345,19 @@ static int dbgp_setup(struct usb_gadget *gadget, · 201 unmodified lines | ||
| 345 | 345 | void *data = NULL; |
| 346 | 346 | u16 len = 0; |
| 347 | 347 | |
| 348 | + if (length > DBGP_REQ_LEN) { | |
| 349 | + if (ctrl->bRequestType == USB_DIR_OUT) { | |
| 350 | + return err; | |
| 351 | + } else { | |
| 352 | + /* Cast away the const, we are going to overwrite on purpose. */ | |
| 353 | + __le16 *temp = (__le16 *)&ctrl->wLength; | |
| 354 | + | |
| 355 | + *temp = cpu_to_le16(DBGP_REQ_LEN); | |
| 356 | + length = DBGP_REQ_LEN; | |
| 357 | + } | |
| 358 | + } | |
| 359 | + | |
| 360 | + | |
| 348 | 361 | if (request == USB_REQ_GET_DESCRIPTOR) { |
| 349 | 362 | switch (value>>8) { |
| 350 | 363 | case USB_DT_DEVICE: |
| @@ -110,6 +110,8 @@ enum ep0_state { · 109 unmodified lines | ||
| 110 | 110 | /* enough for the whole queue: most events invalidate others */ |
| 111 | 111 | #define N_EVENT 5 |
| 112 | 112 | |
| 113 | +#define RBUF_SIZE 256 | |
| 114 | + | |
| 113 | 115 | struct dev_data { |
| 114 | 116 | spinlock_t lock; |
| 115 | 117 | refcount_t count; |
| @@ -144,7 +146,7 @@ struct dev_data { · 28 unmodified lines | ||
| 144 | 146 | struct dentry *dentry; |
| 145 | 147 | |
| 146 | 148 | /* except this scratch i/o buffer for ep0 */ |
| 147 | − u8 rbuf [256]; | |
| 149 | + u8 rbuf[RBUF_SIZE]; | |
| 148 | 150 | }; |
| 149 | 151 | |
| 150 | 152 | static inline void get_dev (struct dev_data *data) |
| @@ -1331,6 +1333,18 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) · 1180 unmodified lines | ||
| 1331 | 1333 | u16 w_value = le16_to_cpu(ctrl->wValue); |
| 1332 | 1334 | u16 w_length = le16_to_cpu(ctrl->wLength); |
| 1333 | 1335 | |
| 1336 | + if (w_length > RBUF_SIZE) { | |
| 1337 | + if (ctrl->bRequestType == USB_DIR_OUT) { | |
| 1338 | + return value; | |
| 1339 | + } else { | |
| 1340 | + /* Cast away the const, we are going to overwrite on purpose. */ | |
| 1341 | + __le16 *temp = (__le16 *)&ctrl->wLength; | |
| 1342 | + | |
| 1343 | + *temp = cpu_to_le16(RBUF_SIZE); | |
| 1344 | + w_length = RBUF_SIZE; | |
| 1345 | + } | |
| 1346 | + } | |
| 1347 | + | |
| 1334 | 1348 | spin_lock (&dev->lock); |
| 1335 | 1349 | dev->setup_abort = 0; |
| 1336 | 1350 | if (dev->state == STATE_DEV_UNCONNECTED) { |
| @@ -717,6 +717,7 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, · 716 unmodified lines | ||
| 717 | 717 | continue; |
| 718 | 718 | |
| 719 | 719 | retval = xhci_disable_slot(xhci, i); |
| 720 | + xhci_free_virt_device(xhci, i); | |
| 720 | 721 | if (retval) |
| 721 | 722 | xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", |
| 722 | 723 | i, retval); |
| @@ -1525,7 +1525,6 @@ static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) · 1524 unmodified lines | ||
| 1525 | 1525 | if (xhci->quirks & XHCI_EP_LIMIT_QUIRK) |
| 1526 | 1526 | /* Delete default control endpoint resources */ |
| 1527 | 1527 | xhci_free_device_endpoint_resources(xhci, virt_dev, true); |
| 1528 | − xhci_free_virt_device(xhci, slot_id); | |
| 1529 | 1528 | } |
| 1530 | 1529 | |
| 1531 | 1530 | static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id, |
| @@ -3934,7 +3934,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) · 3933 unmodified lines | ||
| 3934 | 3934 | struct xhci_slot_ctx *slot_ctx; |
| 3935 | 3935 | int i, ret; |
| 3936 | 3936 | |
| 3937 | −#ifndef CONFIG_USB_DEFAULT_PERSIST | |
| 3938 | 3937 | /* |
| 3939 | 3938 | * We called pm_runtime_get_noresume when the device was attached. |
| 3940 | 3939 | * Decrement the counter here to allow controller to runtime suspend |
| @@ -3942,7 +3941,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) · 1 unmodified line | ||
| 3942 | 3941 | */ |
| 3943 | 3942 | if (xhci->quirks & XHCI_RESET_ON_RESUME) |
| 3944 | 3943 | pm_runtime_put_noidle(hcd->self.controller); |
| 3945 | −#endif | |
| 3946 | 3944 | |
| 3947 | 3945 | ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__); |
| 3948 | 3946 | /* If the host is halted due to driver unload, we still need to free the |
| @@ -3961,9 +3959,8 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) · 12 unmodified lines | ||
| 3961 | 3959 | del_timer_sync(&virt_dev->eps[i].stop_cmd_timer); |
| 3962 | 3960 | } |
| 3963 | 3961 | virt_dev->udev = NULL; |
| 3964 | − ret = xhci_disable_slot(xhci, udev->slot_id); | |
| 3965 | − if (ret) | |
| 3966 | − xhci_free_virt_device(xhci, udev->slot_id); | |
| 3962 | + xhci_disable_slot(xhci, udev->slot_id); | |
| 3963 | + xhci_free_virt_device(xhci, udev->slot_id); | |
| 3967 | 3964 | } |
| 3968 | 3965 | |
| 3969 | 3966 | int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) |
| @@ -3973,7 +3970,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) · 3 unmodified lines | ||
| 3973 | 3970 | u32 state; |
| 3974 | 3971 | int ret = 0; |
| 3975 | 3972 | |
| 3976 | − command = xhci_alloc_command(xhci, false, GFP_KERNEL); | |
| 3973 | + command = xhci_alloc_command(xhci, true, GFP_KERNEL); | |
| 3977 | 3974 | if (!command) |
| 3978 | 3975 | return -ENOMEM; |
| 3979 | 3976 | |
| @@ -3998,6 +3995,15 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id) · 18 unmodified lines | ||
| 3998 | 3995 | } |
| 3999 | 3996 | xhci_ring_cmd_db(xhci); |
| 4000 | 3997 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 3998 | + | |
| 3999 | + wait_for_completion(command->completion); | |
| 4000 | + | |
| 4001 | + if (command->status != COMP_SUCCESS) | |
| 4002 | + xhci_warn(xhci, "Unsuccessful disable slot %u command, status %d\n", | |
| 4003 | + slot_id, command->status); | |
| 4004 | + | |
| 4005 | + xhci_free_command(xhci, command); | |
| 4006 | + | |
| 4001 | 4007 | return ret; |
| 4002 | 4008 | } |
| 4003 | 4009 | |
| @@ -4094,23 +4100,20 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) · 90 unmodified lines | ||
| 4094 | 4100 | |
| 4095 | 4101 | xhci_debugfs_create_slot(xhci, slot_id); |
| 4096 | 4102 | |
| 4097 | −#ifndef CONFIG_USB_DEFAULT_PERSIST | |
| 4098 | 4103 | /* |
| 4099 | 4104 | * If resetting upon resume, we can't put the controller into runtime |
| 4100 | 4105 | * suspend if there is a device attached. |
| 4101 | 4106 | */ |
| 4102 | 4107 | if (xhci->quirks & XHCI_RESET_ON_RESUME) |
| 4103 | 4108 | pm_runtime_get_noresume(hcd->self.controller); |
| 4104 | −#endif | |
| 4105 | 4109 | |
| 4106 | 4110 | /* Is this a LS or FS device under a HS hub? */ |
| 4107 | 4111 | /* Hub or peripherial? */ |
| 4108 | 4112 | return 1; |
| 4109 | 4113 | |
| 4110 | 4114 | disable_slot: |
| 4111 | − ret = xhci_disable_slot(xhci, udev->slot_id); | |
| 4112 | − if (ret) | |
| 4113 | − xhci_free_virt_device(xhci, udev->slot_id); | |
| 4115 | + xhci_disable_slot(xhci, udev->slot_id); | |
| 4116 | + xhci_free_virt_device(xhci, udev->slot_id); | |
| 4114 | 4117 | |
| 4115 | 4118 | return 0; |
| 4116 | 4119 | } |
| @@ -4240,6 +4243,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, · 123 unmodified lines | ||
| 4240 | 4243 | |
| 4241 | 4244 | mutex_unlock(&xhci->mutex); |
| 4242 | 4245 | ret = xhci_disable_slot(xhci, udev->slot_id); |
| 4246 | + xhci_free_virt_device(xhci, udev->slot_id); | |
| 4243 | 4247 | if (!ret) |
| 4244 | 4248 | xhci_alloc_dev(hcd, udev); |
| 4245 | 4249 | kfree(command->completion); |
| @@ -404,7 +404,8 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m · 403 unmodified lines | ||
| 404 | 404 | goto msg_err; |
| 405 | 405 | |
| 406 | 406 | while (mdev->id_table[i].device) { |
| 407 | − supported_classes |= BIT(mdev->id_table[i].device); | |
| 407 | + if (mdev->id_table[i].device <= 63) | |
| 408 | + supported_classes |= BIT_ULL(mdev->id_table[i].device); | |
| 408 | 409 | i++; |
| 409 | 410 | } |
| 410 | 411 | |
| @@ -655,7 +655,8 @@ static void vduse_vdpa_get_config(struct vdpa_device *vdpa, unsigned int offset, · 654 unmodified lines | ||
| 655 | 655 | { |
| 656 | 656 | struct vduse_dev *dev = vdpa_to_vduse(vdpa); |
| 657 | 657 | |
| 658 | − if (len > dev->config_size - offset) | |
| 658 | + if (offset > dev->config_size || | |
| 659 | + len > dev->config_size - offset) | |
| 659 | 660 | return; |
| 660 | 661 | |
| 661 | 662 | memcpy(buf, dev->config + offset, len); |
| @@ -975,7 +976,8 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd, · 313 unmodified lines | ||
| 975 | 976 | break; |
| 976 | 977 | |
| 977 | 978 | ret = -EINVAL; |
| 978 | − if (config.length == 0 || | |
| 979 | + if (config.offset > dev->config_size || | |
| 980 | + config.length == 0 || | |
| 979 | 981 | config.length > dev->config_size - config.offset) |
| 980 | 982 | break; |
| 981 | 983 | |
| @@ -197,7 +197,7 @@ static int vhost_vdpa_config_validate(struct vhost_vdpa *v, · 196 unmodified lines | ||
| 197 | 197 | struct vdpa_device *vdpa = v->vdpa; |
| 198 | 198 | long size = vdpa->config->get_config_size(vdpa); |
| 199 | 199 | |
| 200 | − if (c->len == 0) | |
| 200 | + if (c->len == 0 || c->off > size) | |
| 201 | 201 | return -EINVAL; |
| 202 | 202 | |
| 203 | 203 | if (c->len > size - c->off) |
| @@ -268,7 +268,7 @@ size_t virtio_max_dma_size(struct virtio_device *vdev) · 267 unmodified lines | ||
| 268 | 268 | size_t max_segment_size = SIZE_MAX; |
| 269 | 269 | |
| 270 | 270 | if (vring_use_dma_api(vdev)) |
| 271 | − max_segment_size = dma_max_mapping_size(&vdev->dev); | |
| 271 | + max_segment_size = dma_max_mapping_size(vdev->dev.parent); | |
| 272 | 272 | |
| 273 | 273 | return max_segment_size; |
| 274 | 274 | } |
| @@ -514,8 +514,9 @@ static void afs_add_open_mmap(struct afs_vnode *vnode) · 513 unmodified lines | ||
| 514 | 514 | if (atomic_inc_return(&vnode->cb_nr_mmap) == 1) { |
| 515 | 515 | down_write(&vnode->volume->cell->fs_open_mmaps_lock); |
| 516 | 516 | |
| 517 | − list_add_tail(&vnode->cb_mmap_link, | |
| 518 | − &vnode->volume->cell->fs_open_mmaps); | |
| 517 | + if (list_empty(&vnode->cb_mmap_link)) | |
| 518 | + list_add_tail(&vnode->cb_mmap_link, | |
| 519 | + &vnode->volume->cell->fs_open_mmaps); | |
| 519 | 520 | |
| 520 | 521 | up_write(&vnode->volume->cell->fs_open_mmaps_lock); |
| 521 | 522 | } |
| @@ -667,6 +667,7 @@ static void afs_i_init_once(void *_vnode) · 666 unmodified lines | ||
| 667 | 667 | INIT_LIST_HEAD(&vnode->pending_locks); |
| 668 | 668 | INIT_LIST_HEAD(&vnode->granted_locks); |
| 669 | 669 | INIT_DELAYED_WORK(&vnode->lock_work, afs_lock_work); |
| 670 | + INIT_LIST_HEAD(&vnode->cb_mmap_link); | |
| 670 | 671 | seqlock_init(&vnode->cb_lock); |
| 671 | 672 | } |
| 672 | 673 | |
| @@ -181,8 +181,9 @@ struct poll_iocb { · 180 unmodified lines | ||
| 181 | 181 | struct file *file; |
| 182 | 182 | struct wait_queue_head *head; |
| 183 | 183 | __poll_t events; |
| 184 | − bool done; | |
| 185 | 184 | bool cancelled; |
| 185 | + bool work_scheduled; | |
| 186 | + bool work_need_resched; | |
| 186 | 187 | struct wait_queue_entry wait; |
| 187 | 188 | struct work_struct work; |
| 188 | 189 | }; |
| @@ -1619,6 +1620,51 @@ static void aio_poll_put_work(struct work_struct *work) · 1430 unmodified lines | ||
| 1619 | 1620 | iocb_put(iocb); |
| 1620 | 1621 | } |
| 1621 | 1622 | |
| 1623 | +/* | |
| 1624 | + * Safely lock the waitqueue which the request is on, synchronizing with the | |
| 1625 | + * case where the ->poll() provider decides to free its waitqueue early. | |
| 1626 | + * | |
| 1627 | + * Returns true on success, meaning that req->head->lock was locked, req->wait | |
| 1628 | + * is on req->head, and an RCU read lock was taken. Returns false if the | |
| 1629 | + * request was already removed from its waitqueue (which might no longer exist). | |
| 1630 | + */ | |
| 1631 | +static bool poll_iocb_lock_wq(struct poll_iocb *req) | |
| 1632 | +{ | |
| 1633 | + wait_queue_head_t *head; | |
| 1634 | + | |
| 1635 | + /* | |
| 1636 | + * While we hold the waitqueue lock and the waitqueue is nonempty, | |
| 1637 | + * wake_up_pollfree() will wait for us. However, taking the waitqueue | |
| 1638 | + * lock in the first place can race with the waitqueue being freed. | |
| 1639 | + * | |
| 1640 | + * We solve this as eventpoll does: by taking advantage of the fact that | |
| 1641 | + * all users of wake_up_pollfree() will RCU-delay the actual free. If | |
| 1642 | + * we enter rcu_read_lock() and see that the pointer to the queue is | |
| 1643 | + * non-NULL, we can then lock it without the memory being freed out from | |
| 1644 | + * under us, then check whether the request is still on the queue. | |
| 1645 | + * | |
| 1646 | + * Keep holding rcu_read_lock() as long as we hold the queue lock, in | |
| 1647 | + * case the caller deletes the entry from the queue, leaving it empty. | |
| 1648 | + * In that case, only RCU prevents the queue memory from being freed. | |
| 1649 | + */ | |
| 1650 | + rcu_read_lock(); | |
| 1651 | + head = smp_load_acquire(&req->head); | |
| 1652 | + if (head) { | |
| 1653 | + spin_lock(&head->lock); | |
| 1654 | + if (!list_empty(&req->wait.entry)) | |
| 1655 | + return true; | |
| 1656 | + spin_unlock(&head->lock); | |
| 1657 | + } | |
| 1658 | + rcu_read_unlock(); | |
| 1659 | + return false; | |
| 1660 | +} | |
| 1661 | + | |
| 1662 | +static void poll_iocb_unlock_wq(struct poll_iocb *req) | |
| 1663 | +{ | |
| 1664 | + spin_unlock(&req->head->lock); | |
| 1665 | + rcu_read_unlock(); | |
| 1666 | +} | |
| 1667 | + | |
| 1622 | 1668 | static void aio_poll_complete_work(struct work_struct *work) |
| 1623 | 1669 | { |
| 1624 | 1670 | struct poll_iocb *req = container_of(work, struct poll_iocb, work); |
| @@ -1638,14 +1684,27 @@ static void aio_poll_complete_work(struct work_struct *work) · 13 unmodified lines | ||
| 1638 | 1684 | * avoid further branches in the fast path. |
| 1639 | 1685 | */ |
| 1640 | 1686 | spin_lock_irq(&ctx->ctx_lock); |
| 1641 | − if (!mask && !READ_ONCE(req->cancelled)) { | |
| 1642 | − add_wait_queue(req->head, &req->wait); | |
| 1643 | − spin_unlock_irq(&ctx->ctx_lock); | |
| 1644 | − return; | |
| 1645 | − } | |
| 1687 | + if (poll_iocb_lock_wq(req)) { | |
| 1688 | + if (!mask && !READ_ONCE(req->cancelled)) { | |
| 1689 | + /* | |
| 1690 | + * The request isn't actually ready to be completed yet. | |
| 1691 | + * Reschedule completion if another wakeup came in. | |
| 1692 | + */ | |
| 1693 | + if (req->work_need_resched) { | |
| 1694 | + schedule_work(&req->work); | |
| 1695 | + req->work_need_resched = false; | |
| 1696 | + } else { | |
| 1697 | + req->work_scheduled = false; | |
| 1698 | + } | |
| 1699 | + poll_iocb_unlock_wq(req); | |
| 1700 | + spin_unlock_irq(&ctx->ctx_lock); | |
| 1701 | + return; | |
| 1702 | + } | |
| 1703 | + list_del_init(&req->wait.entry); | |
| 1704 | + poll_iocb_unlock_wq(req); | |
| 1705 | + } /* else, POLLFREE has freed the waitqueue, so we must complete */ | |
| 1646 | 1706 | list_del_init(&iocb->ki_list); |
| 1647 | 1707 | iocb->ki_res.res = mangle_poll(mask); |
| 1648 | − req->done = true; | |
| 1649 | 1708 | spin_unlock_irq(&ctx->ctx_lock); |
| 1650 | 1709 | |
| 1651 | 1710 | iocb_put(iocb); |
| @@ -1657,13 +1716,14 @@ static int aio_poll_cancel(struct kiocb *iocb) · 5 unmodified lines | ||
| 1657 | 1716 | struct aio_kiocb *aiocb = container_of(iocb, struct aio_kiocb, rw); |
| 1658 | 1717 | struct poll_iocb *req = &aiocb->poll; |
| 1659 | 1718 | |
| 1660 | − spin_lock(&req->head->lock); | |
| 1661 | − WRITE_ONCE(req->cancelled, true); | |
| 1662 | − if (!list_empty(&req->wait.entry)) { | |
| 1663 | − list_del_init(&req->wait.entry); | |
| 1664 | − schedule_work(&aiocb->poll.work); | |
| 1665 | − } | |
| 1666 | − spin_unlock(&req->head->lock); | |
| 1719 | + if (poll_iocb_lock_wq(req)) { | |
| 1720 | + WRITE_ONCE(req->cancelled, true); | |
| 1721 | + if (!req->work_scheduled) { | |
| 1722 | + schedule_work(&aiocb->poll.work); | |
| 1723 | + req->work_scheduled = true; | |
| 1724 | + } | |
| 1725 | + poll_iocb_unlock_wq(req); | |
| 1726 | + } /* else, the request was force-cancelled by POLLFREE already */ | |
| 1667 | 1727 | |
| 1668 | 1728 | return 0; |
| 1669 | 1729 | } |
| @@ -1680,21 +1740,27 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, · 10 unmodified lines | ||
| 1680 | 1740 | if (mask && !(mask & req->events)) |
| 1681 | 1741 | return 0; |
| 1682 | 1742 | |
| 1683 | − list_del_init(&req->wait.entry); | |
| 1684 | − | |
| 1685 | − if (mask && spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) { | |
| 1743 | + /* | |
| 1744 | + * Complete the request inline if possible. This requires that three | |
| 1745 | + * conditions be met: | |
| 1746 | + * 1. An event mask must have been passed. If a plain wakeup was done | |
| 1747 | + * instead, then mask == 0 and we have to call vfs_poll() to get | |
| 1748 | + * the events, so inline completion isn't possible. | |
| 1749 | + * 2. The completion work must not have already been scheduled. | |
| 1750 | + * 3. ctx_lock must not be busy. We have to use trylock because we | |
| 1751 | + * already hold the waitqueue lock, so this inverts the normal | |
| 1752 | + * locking order. Use irqsave/irqrestore because not all | |
| 1753 | + * filesystems (e.g. fuse) call this function with IRQs disabled, | |
| 1754 | + * yet IRQs have to be disabled before ctx_lock is obtained. | |
| 1755 | + */ | |
| 1756 | + if (mask && !req->work_scheduled && | |
| 1757 | + spin_trylock_irqsave(&iocb->ki_ctx->ctx_lock, flags)) { | |
| 1686 | 1758 | struct kioctx *ctx = iocb->ki_ctx; |
| 1687 | 1759 | |
| 1688 | − /* | |
| 1689 | − * Try to complete the iocb inline if we can. Use | |
| 1690 | − * irqsave/irqrestore because not all filesystems (e.g. fuse) | |
| 1691 | − * call this function with IRQs disabled and because IRQs | |
| 1692 | − * have to be disabled before ctx_lock is obtained. | |
| 1693 | − */ | |
| 1760 | + list_del_init(&req->wait.entry); | |
| 1694 | 1761 | list_del(&iocb->ki_list); |
| 1695 | 1762 | iocb->ki_res.res = mangle_poll(mask); |
| 1696 | − req->done = true; | |
| 1697 | − if (iocb->ki_eventfd && eventfd_signal_allowed()) { | |
| 1763 | + if (iocb->ki_eventfd && !eventfd_signal_allowed()) { | |
| 1698 | 1764 | iocb = NULL; |
| 1699 | 1765 | INIT_WORK(&req->work, aio_poll_put_work); |
| 1700 | 1766 | schedule_work(&req->work); |
| @@ -1703,7 +1769,43 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, · 2 unmodified lines | ||
| 1703 | 1769 | if (iocb) |
| 1704 | 1770 | iocb_put(iocb); |
| 1705 | 1771 | } else { |
| 1706 | − schedule_work(&req->work); | |
| 1772 | + /* | |
| 1773 | + * Schedule the completion work if needed. If it was already | |
| 1774 | + * scheduled, record that another wakeup came in. | |
| 1775 | + * | |
| 1776 | + * Don't remove the request from the waitqueue here, as it might | |
| 1777 | + * not actually be complete yet (we won't know until vfs_poll() | |
| 1778 | + * is called), and we must not miss any wakeups. POLLFREE is an | |
| 1779 | + * exception to this; see below. | |
| 1780 | + */ | |
| 1781 | + if (req->work_scheduled) { | |
| 1782 | + req->work_need_resched = true; | |
| 1783 | + } else { | |
| 1784 | + schedule_work(&req->work); | |
| 1785 | + req->work_scheduled = true; | |
| 1786 | + } | |
| 1787 | + | |
| 1788 | + /* | |
| 1789 | + * If the waitqueue is being freed early but we can't complete | |
| 1790 | + * the request inline, we have to tear down the request as best | |
| 1791 | + * we can. That means immediately removing the request from its | |
| 1792 | + * waitqueue and preventing all further accesses to the | |
| 1793 | + * waitqueue via the request. We also need to schedule the | |
| 1794 | + * completion work (done above). Also mark the request as | |
| 1795 | + * cancelled, to potentially skip an unneeded call to ->poll(). | |
| 1796 | + */ | |
| 1797 | + if (mask & POLLFREE) { | |
| 1798 | + WRITE_ONCE(req->cancelled, true); | |
| 1799 | + list_del_init(&req->wait.entry); | |
| 1800 | + | |
| 1801 | + /* | |
| 1802 | + * Careful: this *must* be the last step, since as soon | |
| 1803 | + * as req->head is NULL'ed out, the request can be | |
| 1804 | + * completed and freed, since aio_poll_complete_work() | |
| 1805 | + * will no longer need to take the waitqueue lock. | |
| 1806 | + */ | |
| 1807 | + smp_store_release(&req->head, NULL); | |
| 1808 | + } | |
| 1707 | 1809 | } |
| 1708 | 1810 | return 1; |
| 1709 | 1811 | } |
| @@ -1711,6 +1813,7 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync, · 1 unmodified line | ||
| 1711 | 1813 | struct aio_poll_table { |
| 1712 | 1814 | struct poll_table_struct pt; |
| 1713 | 1815 | struct aio_kiocb *iocb; |
| 1816 | + bool queued; | |
| 1714 | 1817 | int error; |
| 1715 | 1818 | }; |
| 1716 | 1819 | |
| @@ -1721,11 +1824,12 @@ aio_poll_queue_proc(struct file *file, struct wait_queue_head *head, · 4 unmodified lines | ||
| 1721 | 1824 | struct aio_poll_table *pt = container_of(p, struct aio_poll_table, pt); |
| 1722 | 1825 | |
| 1723 | 1826 | /* multiple wait queues per file are not supported */ |
| 1724 | − if (unlikely(pt->iocb->poll.head)) { | |
| 1827 | + if (unlikely(pt->queued)) { | |
| 1725 | 1828 | pt->error = -EINVAL; |
| 1726 | 1829 | return; |
| 1727 | 1830 | } |
| 1728 | 1831 | |
| 1832 | + pt->queued = true; | |
| 1729 | 1833 | pt->error = 0; |
| 1730 | 1834 | pt->iocb->poll.head = head; |
| 1731 | 1835 | add_wait_queue(head, &pt->iocb->poll.wait); |
| @@ -1750,12 +1854,14 @@ static int aio_poll(struct aio_kiocb *aiocb, const struct iocb *iocb) · 18 unmodified lines | ||
| 1750 | 1854 | req->events = demangle_poll(iocb->aio_buf) | EPOLLERR | EPOLLHUP; |
| 1751 | 1855 | |
| 1752 | 1856 | req->head = NULL; |
| 1753 | − req->done = false; | |
| 1754 | 1857 | req->cancelled = false; |
| 1858 | + req->work_scheduled = false; | |
| 1859 | + req->work_need_resched = false; | |
| 1755 | 1860 | |
| 1756 | 1861 | apt.pt._qproc = aio_poll_queue_proc; |
| 1757 | 1862 | apt.pt._key = req->events; |
| 1758 | 1863 | apt.iocb = aiocb; |
| 1864 | + apt.queued = false; | |
| 1759 | 1865 | apt.error = -EINVAL; /* same as no support for IOCB_CMD_POLL */ |
| 1760 | 1866 | |
| 1761 | 1867 | /* initialized the list so that we can do list_empty checks */ |
| @@ -1764,23 +1870,35 @@ static int aio_poll(struct aio_kiocb *aiocb, const struct iocb *iocb) · 2 unmodified lines | ||
| 1764 | 1870 | |
| 1765 | 1871 | mask = vfs_poll(req->file, &apt.pt) & req->events; |
| 1766 | 1872 | spin_lock_irq(&ctx->ctx_lock); |
| 1767 | − if (likely(req->head)) { | |
| 1768 | − spin_lock(&req->head->lock); | |
| 1769 | − if (unlikely(list_empty(&req->wait.entry))) { | |
| 1770 | − if (apt.error) | |
| 1873 | + if (likely(apt.queued)) { | |
| 1874 | + bool on_queue = poll_iocb_lock_wq(req); | |
| 1875 | + | |
| 1876 | + if (!on_queue || req->work_scheduled) { | |
| 1877 | + /* | |
| 1878 | + * aio_poll_wake() already either scheduled the async | |
| 1879 | + * completion work, or completed the request inline. | |
| 1880 | + */ | |
| 1881 | + if (apt.error) /* unsupported case: multiple queues */ | |
| 1771 | 1882 | cancel = true; |
| 1772 | 1883 | apt.error = 0; |
| 1773 | 1884 | mask = 0; |
| 1774 | 1885 | } |
| 1775 | 1886 | if (mask || apt.error) { |
| 1887 | + /* Steal to complete synchronously. */ | |
| 1776 | 1888 | list_del_init(&req->wait.entry); |
| 1777 | 1889 | } else if (cancel) { |
| 1890 | + /* Cancel if possible (may be too late though). */ | |
| 1778 | 1891 | WRITE_ONCE(req->cancelled, true); |
| 1779 | − } else if (!req->done) { /* actually waiting for an event */ | |
| 1892 | + } else if (on_queue) { | |
| 1893 | + /* | |
| 1894 | + * Actually waiting for an event, so add the request to | |
| 1895 | + * active_reqs so that it can be cancelled if needed. | |
| 1896 | + */ | |
| 1780 | 1897 | list_add_tail(&aiocb->ki_list, &ctx->active_reqs); |
| 1781 | 1898 | aiocb->ki_cancel = aio_poll_cancel; |
| 1782 | 1899 | } |
| 1783 | − spin_unlock(&req->head->lock); | |
| 1900 | + if (on_queue) | |
| 1901 | + poll_iocb_unlock_wq(req); | |
| 1784 | 1902 | } |
| 1785 | 1903 | if (mask) { /* no async, we'd stolen it */ |
| 1786 | 1904 | aiocb->ki_res.res = mangle_poll(mask); |
| @@ -143,10 +143,13 @@ int btrfs_check_data_free_space(struct btrfs_inode *inode, · 142 unmodified lines | ||
| 143 | 143 | |
| 144 | 144 | /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */ |
| 145 | 145 | ret = btrfs_qgroup_reserve_data(inode, reserved, start, len); |
| 146 | − if (ret < 0) | |
| 146 | + if (ret < 0) { | |
| 147 | 147 | btrfs_free_reserved_data_space_noquota(fs_info, len); |
| 148 | − else | |
| 148 | + extent_changeset_free(*reserved); | |
| 149 | + *reserved = NULL; | |
| 150 | + } else { | |
| 149 | 151 | ret = 0; |
| 152 | + } | |
| 150 | 153 | return ret; |
| 151 | 154 | } |
| 152 | 155 | |
| @@ -452,8 +455,11 @@ int btrfs_delalloc_reserve_space(struct btrfs_inode *inode, · 299 unmodified lines | ||
| 452 | 455 | if (ret < 0) |
| 453 | 456 | return ret; |
| 454 | 457 | ret = btrfs_delalloc_reserve_metadata(inode, len); |
| 455 | − if (ret < 0) | |
| 458 | + if (ret < 0) { | |
| 456 | 459 | btrfs_free_reserved_data_space(inode, *reserved, start, len); |
| 460 | + extent_changeset_free(*reserved); | |
| 461 | + *reserved = NULL; | |
| 462 | + } | |
| 457 | 463 | return ret; |
| 458 | 464 | } |
| 459 | 465 | |
| @@ -6051,6 +6051,9 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range) · 6050 unmodified lines | ||
| 6051 | 6051 | int dev_ret = 0; |
| 6052 | 6052 | int ret = 0; |
| 6053 | 6053 | |
| 6054 | + if (range->start == U64_MAX) | |
| 6055 | + return -EINVAL; | |
| 6056 | + | |
| 6054 | 6057 | /* |
| 6055 | 6058 | * Check range overflow if range->len is set. |
| 6056 | 6059 | * The default range->len is U64_MAX. |
| @@ -4313,6 +4313,20 @@ static void set_btree_ioerr(struct page *page, struct extent_buffer *eb) · 4312 unmodified lines | ||
| 4313 | 4313 | if (test_and_set_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags)) |
| 4314 | 4314 | return; |
| 4315 | 4315 | |
| 4316 | + /* | |
| 4317 | + * A read may stumble upon this buffer later, make sure that it gets an | |
| 4318 | + * error and knows there was an error. | |
| 4319 | + */ | |
| 4320 | + clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags); | |
| 4321 | + | |
| 4322 | + /* | |
| 4323 | + * We need to set the mapping with the io error as well because a write | |
| 4324 | + * error will flip the file system readonly, and then syncfs() will | |
| 4325 | + * return a 0 because we are readonly if we don't modify the err seq for | |
| 4326 | + * the superblock. | |
| 4327 | + */ | |
| 4328 | + mapping_set_error(page->mapping, -EIO); | |
| 4329 | + | |
| 4316 | 4330 | /* |
| 4317 | 4331 | * If we error out, we should add back the dirty_metadata_bytes |
| 4318 | 4332 | * to make it consistent. |
| @@ -3187,10 +3187,8 @@ static long btrfs_ioctl_rm_dev_v2(struct file *file, void __user *arg) · 3186 unmodified lines | ||
| 3187 | 3187 | return -EPERM; |
| 3188 | 3188 | |
| 3189 | 3189 | vol_args = memdup_user(arg, sizeof(*vol_args)); |
| 3190 | − if (IS_ERR(vol_args)) { | |
| 3191 | − ret = PTR_ERR(vol_args); | |
| 3192 | − goto out; | |
| 3193 | − } | |
| 3190 | + if (IS_ERR(vol_args)) | |
| 3191 | + return PTR_ERR(vol_args); | |
| 3194 | 3192 | |
| 3195 | 3193 | if (vol_args->flags & ~BTRFS_DEVICE_REMOVE_ARGS_MASK) { |
| 3196 | 3194 | ret = -EOPNOTSUPP; |
| @@ -334,7 +334,8 @@ int btrfs_del_root_ref(struct btrfs_trans_handle *trans, u64 root_id, · 333 unmodified lines | ||
| 334 | 334 | key.offset = ref_id; |
| 335 | 335 | again: |
| 336 | 336 | ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1); |
| 337 | − BUG_ON(ret < 0); | |
| 337 | + if (ret < 0) | |
| 338 | + goto out; | |
| 338 | 339 | if (ret == 0) { |
| 339 | 340 | leaf = path->nodes[0]; |
| 340 | 341 | ref = btrfs_item_ptr(leaf, path->slots[0], |
| @@ -2908,6 +2908,8 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans, · 2907 unmodified lines | ||
| 2908 | 2908 | path->nodes[*level]->len); |
| 2909 | 2909 | if (ret) |
| 2910 | 2910 | return ret; |
| 2911 | + btrfs_redirty_list_add(trans->transaction, | |
| 2912 | + next); | |
| 2911 | 2913 | } else { |
| 2912 | 2914 | if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags)) |
| 2913 | 2915 | clear_extent_buffer_dirty(next); |
| @@ -2988,6 +2990,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, · 74 unmodified lines | ||
| 2988 | 2990 | next->start, next->len); |
| 2989 | 2991 | if (ret) |
| 2990 | 2992 | goto out; |
| 2993 | + btrfs_redirty_list_add(trans->transaction, next); | |
| 2991 | 2994 | } else { |
| 2992 | 2995 | if (test_and_clear_bit(EXTENT_BUFFER_DIRTY, &next->bflags)) |
| 2993 | 2996 | clear_extent_buffer_dirty(next); |
| @@ -3438,8 +3441,6 @@ static void free_log_tree(struct btrfs_trans_handle *trans, · 444 unmodified lines | ||
| 3438 | 3441 | EXTENT_DIRTY | EXTENT_NEW | EXTENT_NEED_WAIT); |
| 3439 | 3442 | extent_io_tree_release(&log->log_csum_range); |
| 3440 | 3443 | |
| 3441 | − if (trans && log->node) | |
| 3442 | − btrfs_redirty_list_add(trans->transaction, log->node); | |
| 3443 | 3444 | btrfs_put_root(log); |
| 3444 | 3445 | } |
| 3445 | 3446 | |
| @@ -1860,6 +1860,7 @@ int btrfs_zone_finish(struct btrfs_block_group *block_group) · 1859 unmodified lines | ||
| 1860 | 1860 | block_group->alloc_offset = block_group->zone_capacity; |
| 1861 | 1861 | block_group->free_space_ctl->free_space = 0; |
| 1862 | 1862 | btrfs_clear_treelog_bg(block_group); |
| 1863 | + btrfs_clear_data_reloc_bg(block_group); | |
| 1863 | 1864 | spin_unlock(&block_group->lock); |
| 1864 | 1865 | |
| 1865 | 1866 | ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH, |
| @@ -1942,6 +1943,7 @@ void btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical, u64 len · 76 unmodified lines | ||
| 1942 | 1943 | ASSERT(block_group->alloc_offset == block_group->zone_capacity); |
| 1943 | 1944 | ASSERT(block_group->free_space_ctl->free_space == 0); |
| 1944 | 1945 | btrfs_clear_treelog_bg(block_group); |
| 1946 | + btrfs_clear_data_reloc_bg(block_group); | |
| 1945 | 1947 | spin_unlock(&block_group->lock); |
| 1946 | 1948 | |
| 1947 | 1949 | map = block_group->physical_map; |
| @@ -4350,7 +4350,7 @@ void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count) · 4349 unmodified lines | ||
| 4350 | 4350 | { |
| 4351 | 4351 | struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(ci->vfs_inode.i_sb); |
| 4352 | 4352 | int bits = (fmode << 1) | 1; |
| 4353 | − bool is_opened = false; | |
| 4353 | + bool already_opened = false; | |
| 4354 | 4354 | int i; |
| 4355 | 4355 | |
| 4356 | 4356 | if (count == 1) |
| @@ -4358,19 +4358,19 @@ void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count) · 1 unmodified line | ||
| 4358 | 4358 | |
| 4359 | 4359 | spin_lock(&ci->i_ceph_lock); |
| 4360 | 4360 | for (i = 0; i < CEPH_FILE_MODE_BITS; i++) { |
| 4361 | − if (bits & (1 << i)) | |
| 4362 | − ci->i_nr_by_mode[i] += count; | |
| 4363 | − | |
| 4364 | 4361 | /* |
| 4365 | − * If any of the mode ref is larger than 1, | |
| 4362 | + * If any of the mode ref is larger than 0, | |
| 4366 | 4363 | * that means it has been already opened by |
| 4367 | 4364 | * others. Just skip checking the PIN ref. |
| 4368 | 4365 | */ |
| 4369 | − if (i && ci->i_nr_by_mode[i] > 1) | |
| 4370 | − is_opened = true; | |
| 4366 | + if (i && ci->i_nr_by_mode[i]) | |
| 4367 | + already_opened = true; | |
| 4368 | + | |
| 4369 | + if (bits & (1 << i)) | |
| 4370 | + ci->i_nr_by_mode[i] += count; | |
| 4371 | 4371 | } |
| 4372 | 4372 | |
| 4373 | − if (!is_opened) | |
| 4373 | + if (!already_opened) | |
| 4374 | 4374 | percpu_counter_inc(&mdsc->metric.opened_inodes); |
| 4375 | 4375 | spin_unlock(&ci->i_ceph_lock); |
| 4376 | 4376 | } |
| @@ -605,13 +605,25 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, · 604 unmodified lines | ||
| 605 | 605 | in.cap.realm = cpu_to_le64(ci->i_snap_realm->ino); |
| 606 | 606 | in.cap.flags = CEPH_CAP_FLAG_AUTH; |
| 607 | 607 | in.ctime = in.mtime = in.atime = iinfo.btime; |
| 608 | − in.mode = cpu_to_le32((u32)mode); | |
| 609 | 608 | in.truncate_seq = cpu_to_le32(1); |
| 610 | 609 | in.truncate_size = cpu_to_le64(-1ULL); |
| 611 | 610 | in.xattr_version = cpu_to_le64(1); |
| 612 | 611 | in.uid = cpu_to_le32(from_kuid(&init_user_ns, current_fsuid())); |
| 613 | − in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_mode & S_ISGID ? | |
| 614 | − dir->i_gid : current_fsgid())); | |
| 612 | + if (dir->i_mode & S_ISGID) { | |
| 613 | + in.gid = cpu_to_le32(from_kgid(&init_user_ns, dir->i_gid)); | |
| 614 | + | |
| 615 | + /* Directories always inherit the setgid bit. */ | |
| 616 | + if (S_ISDIR(mode)) | |
| 617 | + mode |= S_ISGID; | |
| 618 | + else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) && | |
| 619 | + !in_group_p(dir->i_gid) && | |
| 620 | + !capable_wrt_inode_uidgid(&init_user_ns, dir, CAP_FSETID)) | |
| 621 | + mode &= ~S_ISGID; | |
| 622 | + } else { | |
| 623 | + in.gid = cpu_to_le32(from_kgid(&init_user_ns, current_fsgid())); | |
| 624 | + } | |
| 625 | + in.mode = cpu_to_le32((u32)mode); | |
| 626 | + | |
| 615 | 627 | in.nlink = cpu_to_le32(1); |
| 616 | 628 | in.max_size = cpu_to_le64(lo->stripe_unit); |
| 617 | 629 | |
| @@ -847,7 +859,7 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *to, · 229 unmodified lines | ||
| 847 | 859 | ssize_t ret; |
| 848 | 860 | u64 off = iocb->ki_pos; |
| 849 | 861 | u64 len = iov_iter_count(to); |
| 850 | − u64 i_size; | |
| 862 | + u64 i_size = i_size_read(inode); | |
| 851 | 863 | |
| 852 | 864 | dout("sync_read on file %p %llu~%u %s\n", file, off, (unsigned)len, |
| 853 | 865 | (file->f_flags & O_DIRECT) ? "O_DIRECT" : ""); |
| @@ -3683,7 +3683,7 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, · 3682 unmodified lines | ||
| 3683 | 3683 | struct ceph_pagelist *pagelist = recon_state->pagelist; |
| 3684 | 3684 | struct dentry *dentry; |
| 3685 | 3685 | char *path; |
| 3686 | − int pathlen, err; | |
| 3686 | + int pathlen = 0, err; | |
| 3687 | 3687 | u64 pathbase; |
| 3688 | 3688 | u64 snap_follows; |
| 3689 | 3689 | |
| @@ -3703,7 +3703,6 @@ static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, · 13 unmodified lines | ||
| 3703 | 3703 | } |
| 3704 | 3704 | } else { |
| 3705 | 3705 | path = NULL; |
| 3706 | − pathlen = 0; | |
| 3707 | 3706 | pathbase = 0; |
| 3708 | 3707 | } |
| 3709 | 3708 | |
| @@ -590,8 +590,8 @@ int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, · 589 unmodified lines | ||
| 590 | 590 | { |
| 591 | 591 | unsigned int tioffset; /* challenge message target info area */ |
| 592 | 592 | unsigned int tilen; /* challenge message target info area length */ |
| 593 | − | |
| 594 | 593 | CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr; |
| 594 | + __u32 server_flags; | |
| 595 | 595 | |
| 596 | 596 | if (blob_len < sizeof(CHALLENGE_MESSAGE)) { |
| 597 | 597 | cifs_dbg(VFS, "challenge blob len %d too small\n", blob_len); |
| @@ -609,12 +609,37 @@ int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, · 11 unmodified lines | ||
| 609 | 609 | return -EINVAL; |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | + server_flags = le32_to_cpu(pblob->NegotiateFlags); | |
| 613 | + cifs_dbg(FYI, "%s: negotiate=0x%08x challenge=0x%08x\n", __func__, | |
| 614 | + ses->ntlmssp->client_flags, server_flags); | |
| 615 | + | |
| 616 | + if ((ses->ntlmssp->client_flags & (NTLMSSP_NEGOTIATE_SEAL | NTLMSSP_NEGOTIATE_SIGN)) && | |
| 617 | + (!(server_flags & NTLMSSP_NEGOTIATE_56) && !(server_flags & NTLMSSP_NEGOTIATE_128))) { | |
| 618 | + cifs_dbg(VFS, "%s: requested signing/encryption but server did not return either 56-bit or 128-bit session key size\n", | |
| 619 | + __func__); | |
| 620 | + return -EINVAL; | |
| 621 | + } | |
| 622 | + if (!(server_flags & NTLMSSP_NEGOTIATE_NTLM) && !(server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC)) { | |
| 623 | + cifs_dbg(VFS, "%s: server does not seem to support either NTLMv1 or NTLMv2\n", __func__); | |
| 624 | + return -EINVAL; | |
| 625 | + } | |
| 626 | + if (ses->server->sign && !(server_flags & NTLMSSP_NEGOTIATE_SIGN)) { | |
| 627 | + cifs_dbg(VFS, "%s: forced packet signing but server does not seem to support it\n", | |
| 628 | + __func__); | |
| 629 | + return -EOPNOTSUPP; | |
| 630 | + } | |
| 631 | + if ((ses->ntlmssp->client_flags & NTLMSSP_NEGOTIATE_KEY_XCH) && | |
| 632 | + !(server_flags & NTLMSSP_NEGOTIATE_KEY_XCH)) | |
| 633 | + pr_warn_once("%s: authentication has been weakened as server does not support key exchange\n", | |
| 634 | + __func__); | |
| 635 | + | |
| 636 | + ses->ntlmssp->server_flags = server_flags; | |
| 637 | + | |
| 612 | 638 | memcpy(ses->ntlmssp->cryptkey, pblob->Challenge, CIFS_CRYPTO_KEY_SIZE); |
| 613 | − /* BB we could decode pblob->NegotiateFlags; some may be useful */ | |
| 614 | 639 | /* In particular we can examine sign flags */ |
| 615 | 640 | /* BB spec says that if AvId field of MsvAvTimestamp is populated then |
| 616 | 641 | we must set the MIC field of the AUTHENTICATE_MESSAGE */ |
| 617 | − ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags); | |
| 642 | + | |
| 618 | 643 | tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset); |
| 619 | 644 | tilen = le16_to_cpu(pblob->TargetInfoArray.Length); |
| 620 | 645 | if (tioffset > blob_len || tioffset + tilen > blob_len) { |
| @@ -721,13 +746,13 @@ int build_ntlmssp_negotiate_blob(unsigned char **pbuffer, · 100 unmodified lines | ||
| 721 | 746 | flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET | |
| 722 | 747 | NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | |
| 723 | 748 | NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC | |
| 724 | − NTLMSSP_NEGOTIATE_SEAL; | |
| 725 | − if (server->sign) | |
| 726 | − flags |= NTLMSSP_NEGOTIATE_SIGN; | |
| 749 | + NTLMSSP_NEGOTIATE_ALWAYS_SIGN | NTLMSSP_NEGOTIATE_SEAL | | |
| 750 | + NTLMSSP_NEGOTIATE_SIGN; | |
| 727 | 751 | if (!server->session_estab || ses->ntlmssp->sesskey_per_smbsess) |
| 728 | 752 | flags |= NTLMSSP_NEGOTIATE_KEY_XCH; |
| 729 | 753 | |
| 730 | 754 | tmp = *pbuffer + sizeof(NEGOTIATE_MESSAGE); |
| 755 | + ses->ntlmssp->client_flags = flags; | |
| 731 | 756 | sec_blob->NegotiateFlags = cpu_to_le32(flags); |
| 732 | 757 | |
| 733 | 758 | /* these fields should be null in negotiate phase MS-NLMP 3.1.5.1.1 */ |
| @@ -779,15 +804,8 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer, · 45 unmodified lines | ||
| 779 | 804 | memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8); |
| 780 | 805 | sec_blob->MessageType = NtLmAuthenticate; |
| 781 | 806 | |
| 782 | − flags = NTLMSSP_NEGOTIATE_56 | | |
| 783 | − NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_TARGET_INFO | | |
| 784 | − NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | | |
| 785 | − NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC | | |
| 786 | − NTLMSSP_NEGOTIATE_SEAL | NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED; | |
| 787 | − if (ses->server->sign) | |
| 788 | − flags |= NTLMSSP_NEGOTIATE_SIGN; | |
| 789 | − if (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess) | |
| 790 | − flags |= NTLMSSP_NEGOTIATE_KEY_XCH; | |
| 807 | + flags = ses->ntlmssp->server_flags | NTLMSSP_REQUEST_TARGET | | |
| 808 | + NTLMSSP_NEGOTIATE_TARGET_INFO | NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED; | |
| 791 | 809 | |
| 792 | 810 | tmp = *pbuffer + sizeof(AUTHENTICATE_MESSAGE); |
| 793 | 811 | sec_blob->NegotiateFlags = cpu_to_le32(flags); |
| @@ -834,9 +852,9 @@ int build_ntlmssp_auth_blob(unsigned char **pbuffer, · 40 unmodified lines | ||
| 834 | 852 | *pbuffer, &tmp, |
| 835 | 853 | nls_cp); |
| 836 | 854 | |
| 837 | − if (((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) || | |
| 838 | − (ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_EXTENDED_SEC)) | |
| 839 | − && !calc_seckey(ses)) { | |
| 855 | + if ((ses->ntlmssp->server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) && | |
| 856 | + (!ses->server->session_estab || ses->ntlmssp->sesskey_per_smbsess) && | |
| 857 | + !calc_seckey(ses)) { | |
| 840 | 858 | memcpy(tmp, ses->ntlmssp->ciphertext, CIFS_CPHTXT_SIZE); |
| 841 | 859 | sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - *pbuffer); |
| 842 | 860 | sec_blob->SessionKey.Length = cpu_to_le16(CIFS_CPHTXT_SIZE); |
| @@ -841,28 +841,68 @@ void do_close_on_exec(struct files_struct *files) · 840 unmodified lines | ||
| 841 | 841 | spin_unlock(&files->file_lock); |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | −static struct file *__fget_files(struct files_struct *files, unsigned int fd, | |
| 845 | − fmode_t mask, unsigned int refs) | |
| 844 | +static inline struct file *__fget_files_rcu(struct files_struct *files, | |
| 845 | + unsigned int fd, fmode_t mask, unsigned int refs) | |
| 846 | 846 | { |
| 847 | − struct file *file; | |
| 847 | + for (;;) { | |
| 848 | + struct file *file; | |
| 849 | + struct fdtable *fdt = rcu_dereference_raw(files->fdt); | |
| 850 | + struct file __rcu **fdentry; | |
| 848 | 851 | |
| 849 | − rcu_read_lock(); | |
| 850 | −loop: | |
| 851 | − file = files_lookup_fd_rcu(files, fd); | |
| 852 | − if (file) { | |
| 853 | − /* File object ref couldn't be taken. | |
| 854 | − * dup2() atomicity guarantee is the reason | |
| 855 | − * we loop to catch the new file (or NULL pointer) | |
| 852 | + if (unlikely(fd >= fdt->max_fds)) | |
| 853 | + return NULL; | |
| 854 | + | |
| 855 | + fdentry = fdt->fd + array_index_nospec(fd, fdt->max_fds); | |
| 856 | + file = rcu_dereference_raw(*fdentry); | |
| 857 | + if (unlikely(!file)) | |
| 858 | + return NULL; | |
| 859 | + | |
| 860 | + if (unlikely(file->f_mode & mask)) | |
| 861 | + return NULL; | |
| 862 | + | |
| 863 | + /* | |
| 864 | + * Ok, we have a file pointer. However, because we do | |
| 865 | + * this all locklessly under RCU, we may be racing with | |
| 866 | + * that file being closed. | |
| 867 | + * | |
| 868 | + * Such a race can take two forms: | |
| 869 | + * | |
| 870 | + * (a) the file ref already went down to zero, | |
| 871 | + * and get_file_rcu_many() fails. Just try | |
| 872 | + * again: | |
| 856 | 873 | */ |
| 857 | − if (file->f_mode & mask) | |
| 858 | − file = NULL; | |
| 859 | − else if (!get_file_rcu_many(file, refs)) | |
| 860 | − goto loop; | |
| 861 | − else if (files_lookup_fd_raw(files, fd) != file) { | |
| 874 | + if (unlikely(!get_file_rcu_many(file, refs))) | |
| 875 | + continue; | |
| 876 | + | |
| 877 | + /* | |
| 878 | + * (b) the file table entry has changed under us. | |
| 879 | + * Note that we don't need to re-check the 'fdt->fd' | |
| 880 | + * pointer having changed, because it always goes | |
| 881 | + * hand-in-hand with 'fdt'. | |
| 882 | + * | |
| 883 | + * If so, we need to put our refs and try again. | |
| 884 | + */ | |
| 885 | + if (unlikely(rcu_dereference_raw(files->fdt) != fdt) || | |
| 886 | + unlikely(rcu_dereference_raw(*fdentry) != file)) { | |
| 862 | 887 | fput_many(file, refs); |
| 863 | − goto loop; | |
| 888 | + continue; | |
| 864 | 889 | } |
| 890 | + | |
| 891 | + /* | |
| 892 | + * Ok, we have a ref to the file, and checked that it | |
| 893 | + * still exists. | |
| 894 | + */ | |
| 895 | + return file; | |
| 865 | 896 | } |
| 897 | +} | |
| 898 | + | |
| 899 | +static struct file *__fget_files(struct files_struct *files, unsigned int fd, | |
| 900 | + fmode_t mask, unsigned int refs) | |
| 901 | +{ | |
| 902 | + struct file *file; | |
| 903 | + | |
| 904 | + rcu_read_lock(); | |
| 905 | + file = __fget_files_rcu(files, fd, mask, refs); | |
| 866 | 906 | rcu_read_unlock(); |
| 867 | 907 | |
| 868 | 908 | return file; |
| @@ -142,6 +142,7 @@ static bool io_acct_cancel_pending_work(struct io_wqe *wqe, · 141 unmodified lines | ||
| 142 | 142 | struct io_wqe_acct *acct, |
| 143 | 143 | struct io_cb_cancel_data *match); |
| 144 | 144 | static void create_worker_cb(struct callback_head *cb); |
| 145 | +static void io_wq_cancel_tw_create(struct io_wq *wq); | |
| 145 | 146 | |
| 146 | 147 | static bool io_worker_get(struct io_worker *worker) |
| 147 | 148 | { |
| @@ -357,12 +358,22 @@ static bool io_queue_worker_create(struct io_worker *worker, · 209 unmodified lines | ||
| 357 | 358 | test_and_set_bit_lock(0, &worker->create_state)) |
| 358 | 359 | goto fail_release; |
| 359 | 360 | |
| 361 | + atomic_inc(&wq->worker_refs); | |
| 360 | 362 | init_task_work(&worker->create_work, func); |
| 361 | 363 | worker->create_index = acct->index; |
| 362 | 364 | if (!task_work_add(wq->task, &worker->create_work, TWA_SIGNAL)) { |
| 363 | − clear_bit_unlock(0, &worker->create_state); | |
| 365 | + /* | |
| 366 | + * EXIT may have been set after checking it above, check after | |
| 367 | + * adding the task_work and remove any creation item if it is | |
| 368 | + * now set. wq exit does that too, but we can have added this | |
| 369 | + * work item after we canceled in io_wq_exit_workers(). | |
| 370 | + */ | |
| 371 | + if (test_bit(IO_WQ_BIT_EXIT, &wq->state)) | |
| 372 | + io_wq_cancel_tw_create(wq); | |
| 373 | + io_worker_ref_put(wq); | |
| 364 | 374 | return true; |
| 365 | 375 | } |
| 376 | + io_worker_ref_put(wq); | |
| 366 | 377 | clear_bit_unlock(0, &worker->create_state); |
| 367 | 378 | fail_release: |
| 368 | 379 | io_worker_release(worker); |
| @@ -1198,13 +1209,9 @@ void io_wq_exit_start(struct io_wq *wq) · 829 unmodified lines | ||
| 1198 | 1209 | set_bit(IO_WQ_BIT_EXIT, &wq->state); |
| 1199 | 1210 | } |
| 1200 | 1211 | |
| 1201 | −static void io_wq_exit_workers(struct io_wq *wq) | |
| 1212 | +static void io_wq_cancel_tw_create(struct io_wq *wq) | |
| 1202 | 1213 | { |
| 1203 | 1214 | struct callback_head *cb; |
| 1204 | − int node; | |
| 1205 | − | |
| 1206 | − if (!wq->task) | |
| 1207 | − return; | |
| 1208 | 1215 | |
| 1209 | 1216 | while ((cb = task_work_cancel_match(wq->task, io_task_work_match, wq)) != NULL) { |
| 1210 | 1217 | struct io_worker *worker; |
| @@ -1212,6 +1219,16 @@ static void io_wq_exit_workers(struct io_wq *wq) · 1 unmodified line | ||
| 1212 | 1219 | worker = container_of(cb, struct io_worker, create_work); |
| 1213 | 1220 | io_worker_cancel_cb(worker); |
| 1214 | 1221 | } |
| 1222 | +} | |
| 1223 | + | |
| 1224 | +static void io_wq_exit_workers(struct io_wq *wq) | |
| 1225 | +{ | |
| 1226 | + int node; | |
| 1227 | + | |
| 1228 | + if (!wq->task) | |
| 1229 | + return; | |
| 1230 | + | |
| 1231 | + io_wq_cancel_tw_create(wq); | |
| 1215 | 1232 | |
| 1216 | 1233 | rcu_read_lock(); |
| 1217 | 1234 | for_each_node(node) { |
| @@ -9824,7 +9824,7 @@ static __cold void io_uring_drop_tctx_refs(struct task_struct *task) · 9823 unmodified lines | ||
| 9824 | 9824 | |
| 9825 | 9825 | /* |
| 9826 | 9826 | * Find any io_uring ctx that this task has registered or done IO on, and cancel |
| 9827 | − * requests. @sqd should be not-null IIF it's an SQPOLL thread cancellation. | |
| 9827 | + * requests. @sqd should be not-null IFF it's an SQPOLL thread cancellation. | |
| 9828 | 9828 | */ |
| 9829 | 9829 | static __cold void io_uring_cancel_generic(bool cancel_all, |
| 9830 | 9830 | struct io_sq_data *sqd) |
| @@ -9866,8 +9866,10 @@ static __cold void io_uring_cancel_generic(bool cancel_all, · 35 unmodified lines | ||
| 9866 | 9866 | cancel_all); |
| 9867 | 9867 | } |
| 9868 | 9868 | |
| 9869 | − prepare_to_wait(&tctx->wait, &wait, TASK_UNINTERRUPTIBLE); | |
| 9869 | + prepare_to_wait(&tctx->wait, &wait, TASK_INTERRUPTIBLE); | |
| 9870 | + io_run_task_work(); | |
| 9870 | 9871 | io_uring_drop_tctx_refs(current); |
| 9872 | + | |
| 9871 | 9873 | /* |
| 9872 | 9874 | * If we've seen completions, retry without waiting. This |
| 9873 | 9875 | * avoids a race where a completion comes in before we did |
| @@ -2156,6 +2156,7 @@ static struct notifier_block nfsd4_cld_block = { · 2155 unmodified lines | ||
| 2156 | 2156 | int |
| 2157 | 2157 | register_cld_notifier(void) |
| 2158 | 2158 | { |
| 2159 | + WARN_ON(!nfsd_net_id); | |
| 2159 | 2160 | return rpc_pipefs_notifier_register(&nfsd4_cld_block); |
| 2160 | 2161 | } |
| 2161 | 2162 | |
| @@ -1207,6 +1207,11 @@ hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp) · 1206 unmodified lines | ||
| 1207 | 1207 | return 0; |
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | +static bool delegation_hashed(struct nfs4_delegation *dp) | |
| 1211 | +{ | |
| 1212 | + return !(list_empty(&dp->dl_perfile)); | |
| 1213 | +} | |
| 1214 | + | |
| 1210 | 1215 | static bool |
| 1211 | 1216 | unhash_delegation_locked(struct nfs4_delegation *dp) |
| 1212 | 1217 | { |
| @@ -1214,7 +1219,7 @@ unhash_delegation_locked(struct nfs4_delegation *dp) · 1 unmodified line | ||
| 1214 | 1219 | |
| 1215 | 1220 | lockdep_assert_held(&state_lock); |
| 1216 | 1221 | |
| 1217 | − if (list_empty(&dp->dl_perfile)) | |
| 1222 | + if (!delegation_hashed(dp)) | |
| 1218 | 1223 | return false; |
| 1219 | 1224 | |
| 1220 | 1225 | dp->dl_stid.sc_type = NFS4_CLOSED_DELEG_STID; |
| @@ -4598,7 +4603,7 @@ static void nfsd4_cb_recall_prepare(struct nfsd4_callback *cb) · 3377 unmodified lines | ||
| 4598 | 4603 | * queued for a lease break. Don't queue it again. |
| 4599 | 4604 | */ |
| 4600 | 4605 | spin_lock(&state_lock); |
| 4601 | − if (dp->dl_time == 0) { | |
| 4606 | + if (delegation_hashed(dp) && dp->dl_time == 0) { | |
| 4602 | 4607 | dp->dl_time = ktime_get_boottime_seconds(); |
| 4603 | 4608 | list_add_tail(&dp->dl_recall_lru, &nn->del_recall_lru); |
| 4604 | 4609 | } |
| @@ -1521,12 +1521,9 @@ static int __init init_nfsd(void) · 1520 unmodified lines | ||
| 1521 | 1521 | int retval; |
| 1522 | 1522 | printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); |
| 1523 | 1523 | |
| 1524 | − retval = register_cld_notifier(); | |
| 1525 | − if (retval) | |
| 1526 | − return retval; | |
| 1527 | 1524 | retval = nfsd4_init_slabs(); |
| 1528 | 1525 | if (retval) |
| 1529 | − goto out_unregister_notifier; | |
| 1526 | + return retval; | |
| 1530 | 1527 | retval = nfsd4_init_pnfs(); |
| 1531 | 1528 | if (retval) |
| 1532 | 1529 | goto out_free_slabs; |
| @@ -1545,9 +1542,14 @@ static int __init init_nfsd(void) · 12 unmodified lines | ||
| 1545 | 1542 | goto out_free_exports; |
| 1546 | 1543 | retval = register_pernet_subsys(&nfsd_net_ops); |
| 1547 | 1544 | if (retval < 0) |
| 1545 | + goto out_free_filesystem; | |
| 1546 | + retval = register_cld_notifier(); | |
| 1547 | + if (retval) | |
| 1548 | 1548 | goto out_free_all; |
| 1549 | 1549 | return 0; |
| 1550 | 1550 | out_free_all: |
| 1551 | + unregister_pernet_subsys(&nfsd_net_ops); | |
| 1552 | +out_free_filesystem: | |
| 1551 | 1553 | unregister_filesystem(&nfsd_fs_type); |
| 1552 | 1554 | out_free_exports: |
| 1553 | 1555 | remove_proc_entry("fs/nfs/exports", NULL); |
| @@ -1561,13 +1563,12 @@ out_free_pnfs: · 7 unmodified lines | ||
| 1561 | 1563 | nfsd4_exit_pnfs(); |
| 1562 | 1564 | out_free_slabs: |
| 1563 | 1565 | nfsd4_free_slabs(); |
| 1564 | −out_unregister_notifier: | |
| 1565 | − unregister_cld_notifier(); | |
| 1566 | 1566 | return retval; |
| 1567 | 1567 | } |
| 1568 | 1568 | |
| 1569 | 1569 | static void __exit exit_nfsd(void) |
| 1570 | 1570 | { |
| 1571 | + unregister_cld_notifier(); | |
| 1571 | 1572 | unregister_pernet_subsys(&nfsd_net_ops); |
| 1572 | 1573 | nfsd_drc_slab_free(); |
| 1573 | 1574 | remove_proc_entry("fs/nfs/exports", NULL); |
| @@ -1577,7 +1578,6 @@ static void __exit exit_nfsd(void) · 3 unmodified lines | ||
| 1577 | 1578 | nfsd4_free_slabs(); |
| 1578 | 1579 | nfsd4_exit_pnfs(); |
| 1579 | 1580 | unregister_filesystem(&nfsd_fs_type); |
| 1580 | − unregister_cld_notifier(); | |
| 1581 | 1581 | } |
| 1582 | 1582 | |
| 1583 | 1583 | MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>"); |
| @@ -35,17 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | void signalfd_cleanup(struct sighand_struct *sighand) |
| 37 | 37 | { |
| 38 | − wait_queue_head_t *wqh = &sighand->signalfd_wqh; | |
| 39 | − /* | |
| 40 | − * The lockless check can race with remove_wait_queue() in progress, | |
| 41 | − * but in this case its caller should run under rcu_read_lock() and | |
| 42 | − * sighand_cachep is SLAB_TYPESAFE_BY_RCU, we can safely return. | |
| 43 | − */ | |
| 44 | − if (likely(!waitqueue_active(wqh))) | |
| 45 | − return; | |
| 46 | − | |
| 47 | − /* wait_queue_entry_t->func(POLLFREE) should do remove_wait_queue() */ | |
| 48 | − wake_up_poll(wqh, EPOLLHUP | POLLFREE); | |
| 38 | + wake_up_pollfree(&sighand->signalfd_wqh); | |
| 49 | 39 | } |
| 50 | 40 | |
| 51 | 41 | struct signalfd_ctx { |
| @@ -72,16 +72,3 @@ void cifs_arc4_crypt(struct arc4_ctx *ctx, u8 *out, const u8 *in, unsigned int l · 71 unmodified lines | ||
| 72 | 72 | ctx->y = y; |
| 73 | 73 | } |
| 74 | 74 | EXPORT_SYMBOL_GPL(cifs_arc4_crypt); |
| 75 | − | |
| 76 | −static int __init | |
| 77 | −init_smbfs_common(void) | |
| 78 | −{ | |
| 79 | − return 0; | |
| 80 | −} | |
| 81 | −static void __init | |
| 82 | −exit_smbfs_common(void) | |
| 83 | −{ | |
| 84 | −} | |
| 85 | − | |
| 86 | −module_init(init_smbfs_common) | |
| 87 | −module_exit(exit_smbfs_common) | |
| @@ -161,6 +161,77 @@ struct tracefs_fs_info { · 160 unmodified lines | ||
| 161 | 161 | struct tracefs_mount_opts mount_opts; |
| 162 | 162 | }; |
| 163 | 163 | |
| 164 | +static void change_gid(struct dentry *dentry, kgid_t gid) | |
| 165 | +{ | |
| 166 | + if (!dentry->d_inode) | |
| 167 | + return; | |
| 168 | + dentry->d_inode->i_gid = gid; | |
| 169 | +} | |
| 170 | + | |
| 171 | +/* | |
| 172 | + * Taken from d_walk, but without he need for handling renames. | |
| 173 | + * Nothing can be renamed while walking the list, as tracefs | |
| 174 | + * does not support renames. This is only called when mounting | |
| 175 | + * or remounting the file system, to set all the files to | |
| 176 | + * the given gid. | |
| 177 | + */ | |
| 178 | +static void set_gid(struct dentry *parent, kgid_t gid) | |
| 179 | +{ | |
| 180 | + struct dentry *this_parent; | |
| 181 | + struct list_head *next; | |
| 182 | + | |
| 183 | + this_parent = parent; | |
| 184 | + spin_lock(&this_parent->d_lock); | |
| 185 | + | |
| 186 | + change_gid(this_parent, gid); | |
| 187 | +repeat: | |
| 188 | + next = this_parent->d_subdirs.next; | |
| 189 | +resume: | |
| 190 | + while (next != &this_parent->d_subdirs) { | |
| 191 | + struct list_head *tmp = next; | |
| 192 | + struct dentry *dentry = list_entry(tmp, struct dentry, d_child); | |
| 193 | + next = tmp->next; | |
| 194 | + | |
| 195 | + spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); | |
| 196 | + | |
| 197 | + change_gid(dentry, gid); | |
| 198 | + | |
| 199 | + if (!list_empty(&dentry->d_subdirs)) { | |
| 200 | + spin_unlock(&this_parent->d_lock); | |
| 201 | + spin_release(&dentry->d_lock.dep_map, _RET_IP_); | |
| 202 | + this_parent = dentry; | |
| 203 | + spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_); | |
| 204 | + goto repeat; | |
| 205 | + } | |
| 206 | + spin_unlock(&dentry->d_lock); | |
| 207 | + } | |
| 208 | + /* | |
| 209 | + * All done at this level ... ascend and resume the search. | |
| 210 | + */ | |
| 211 | + rcu_read_lock(); | |
| 212 | +ascend: | |
| 213 | + if (this_parent != parent) { | |
| 214 | + struct dentry *child = this_parent; | |
| 215 | + this_parent = child->d_parent; | |
| 216 | + | |
| 217 | + spin_unlock(&child->d_lock); | |
| 218 | + spin_lock(&this_parent->d_lock); | |
| 219 | + | |
| 220 | + /* go into the first sibling still alive */ | |
| 221 | + do { | |
| 222 | + next = child->d_child.next; | |
| 223 | + if (next == &this_parent->d_subdirs) | |
| 224 | + goto ascend; | |
| 225 | + child = list_entry(next, struct dentry, d_child); | |
| 226 | + } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); | |
| 227 | + rcu_read_unlock(); | |
| 228 | + goto resume; | |
| 229 | + } | |
| 230 | + rcu_read_unlock(); | |
| 231 | + spin_unlock(&this_parent->d_lock); | |
| 232 | + return; | |
| 233 | +} | |
| 234 | + | |
| 164 | 235 | static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts) |
| 165 | 236 | { |
| 166 | 237 | substring_t args[MAX_OPT_ARGS]; |
| @@ -193,6 +264,7 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts) · 26 unmodified lines | ||
| 193 | 264 | if (!gid_valid(gid)) |
| 194 | 265 | return -EINVAL; |
| 195 | 266 | opts->gid = gid; |
| 267 | + set_gid(tracefs_mount->mnt_root, gid); | |
| 196 | 268 | break; |
| 197 | 269 | case Opt_mode: |
| 198 | 270 | if (match_octal(&args[0], &option)) |
| @@ -414,6 +486,8 @@ struct dentry *tracefs_create_file(const char *name, umode_t mode, · 215 unmodified lines | ||
| 414 | 486 | inode->i_mode = mode; |
| 415 | 487 | inode->i_fop = fops ? fops : &tracefs_file_operations; |
| 416 | 488 | inode->i_private = data; |
| 489 | + inode->i_uid = d_inode(dentry->d_parent)->i_uid; | |
| 490 | + inode->i_gid = d_inode(dentry->d_parent)->i_gid; | |
| 417 | 491 | d_instantiate(dentry, inode); |
| 418 | 492 | fsnotify_create(dentry->d_parent->d_inode, dentry); |
| 419 | 493 | return end_creating(dentry); |
| @@ -436,6 +510,8 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent, · 16 unmodified lines | ||
| 436 | 510 | inode->i_mode = S_IFDIR | S_IRWXU | S_IRUSR| S_IRGRP | S_IXUSR | S_IXGRP; |
| 437 | 511 | inode->i_op = ops; |
| 438 | 512 | inode->i_fop = &simple_dir_operations; |
| 513 | + inode->i_uid = d_inode(dentry->d_parent)->i_uid; | |
| 514 | + inode->i_gid = d_inode(dentry->d_parent)->i_gid; | |
| 439 | 515 | |
| 440 | 516 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ |
| 441 | 517 | inc_nlink(inode); |
| @@ -1765,7 +1765,10 @@ static int · 1764 unmodified lines | ||
| 1765 | 1765 | xfs_remount_ro( |
| 1766 | 1766 | struct xfs_mount *mp) |
| 1767 | 1767 | { |
| 1768 | − int error; | |
| 1768 | + struct xfs_icwalk icw = { | |
| 1769 | + .icw_flags = XFS_ICWALK_FLAG_SYNC, | |
| 1770 | + }; | |
| 1771 | + int error; | |
| 1769 | 1772 | |
| 1770 | 1773 | /* |
| 1771 | 1774 | * Cancel background eofb scanning so it cannot race with the final |
| @@ -1773,8 +1776,13 @@ xfs_remount_ro( · 1 unmodified line | ||
| 1773 | 1776 | */ |
| 1774 | 1777 | xfs_blockgc_stop(mp); |
| 1775 | 1778 | |
| 1776 | − /* Get rid of any leftover CoW reservations... */ | |
| 1777 | − error = xfs_blockgc_free_space(mp, NULL); | |
| 1779 | + /* | |
| 1780 | + * Clear out all remaining COW staging extents and speculative post-EOF | |
| 1781 | + * preallocations so that we don't leave inodes requiring inactivation | |
| 1782 | + * cleanups during reclaim on a read-only mount. We must process every | |
| 1783 | + * cached inode, so this requires a synchronous cache scan. | |
| 1784 | + */ | |
| 1785 | + error = xfs_blockgc_free_space(mp, &icw); | |
| 1778 | 1786 | if (error) { |
| 1779 | 1787 | xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); |
| 1780 | 1788 | return error; |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | #include <linux/math.h> |
| 23 | +#include <linux/sched.h> | |
| 23 | 24 | |
| 24 | 25 | extern unsigned long loops_per_jiffy; |
| 25 | 26 | |
| @@ -58,7 +59,18 @@ void calibrate_delay(void); · 32 unmodified lines | ||
| 58 | 59 | void __attribute__((weak)) calibration_delay_done(void); |
| 59 | 60 | void msleep(unsigned int msecs); |
| 60 | 61 | unsigned long msleep_interruptible(unsigned int msecs); |
| 61 | −void usleep_range(unsigned long min, unsigned long max); | |
| 62 | +void usleep_range_state(unsigned long min, unsigned long max, | |
| 63 | + unsigned int state); | |
| 64 | + | |
| 65 | +static inline void usleep_range(unsigned long min, unsigned long max) | |
| 66 | +{ | |
| 67 | + usleep_range_state(min, max, TASK_UNINTERRUPTIBLE); | |
| 68 | +} | |
| 69 | + | |
| 70 | +static inline void usleep_idle_range(unsigned long min, unsigned long max) | |
| 71 | +{ | |
| 72 | + usleep_range_state(min, max, TASK_IDLE); | |
| 73 | +} | |
| 62 | 74 | |
| 63 | 75 | static inline void ssleep(unsigned int seconds) |
| 64 | 76 | { |
| @@ -663,6 +663,19 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl); · 662 unmodified lines | ||
| 663 | 663 | */ |
| 664 | 664 | int mhi_pm_resume(struct mhi_controller *mhi_cntrl); |
| 665 | 665 | |
| 666 | +/** | |
| 667 | + * mhi_pm_resume_force - Force resume MHI from suspended state | |
| 668 | + * @mhi_cntrl: MHI controller | |
| 669 | + * | |
| 670 | + * Resume the device irrespective of its MHI state. As per the MHI spec, devices | |
| 671 | + * has to be in M3 state during resume. But some devices seem to be in a | |
| 672 | + * different MHI state other than M3 but they continue working fine if allowed. | |
| 673 | + * This API is intented to be used for such devices. | |
| 674 | + * | |
| 675 | + * Return: 0 if the resume succeeds, a negative error code otherwise | |
| 676 | + */ | |
| 677 | +int mhi_pm_resume_force(struct mhi_controller *mhi_cntrl); | |
| 678 | + | |
| 666 | 679 | /** |
| 667 | 680 | * mhi_download_rddm_image - Download ramdump image from device for |
| 668 | 681 | * debugging purpose. |
| @@ -51,9 +51,9 @@ · 50 unmodified lines | ||
| 51 | 51 | #define _LINUX_PERCPU_REFCOUNT_H |
| 52 | 52 | |
| 53 | 53 | #include <linux/atomic.h> |
| 54 | −#include <linux/kernel.h> | |
| 55 | 54 | #include <linux/percpu.h> |
| 56 | 55 | #include <linux/rcupdate.h> |
| 56 | +#include <linux/types.h> | |
| 57 | 57 | #include <linux/gfp.h> |
| 58 | 58 | |
| 59 | 59 | struct percpu_ref; |
| @@ -129,7 +129,7 @@ static inline bool pm_runtime_suspended(struct device *dev) · 128 unmodified lines | ||
| 129 | 129 | * pm_runtime_active - Check whether or not a device is runtime-active. |
| 130 | 130 | * @dev: Target device. |
| 131 | 131 | * |
| 132 | − * Return %true if runtime PM is enabled for @dev and its runtime PM status is | |
| 132 | + * Return %true if runtime PM is disabled for @dev or its runtime PM status is | |
| 133 | 133 | * %RPM_ACTIVE, or %false otherwise. |
| 134 | 134 | * |
| 135 | 135 | * Note that the return value of this function can only be trusted if it is |
| @@ -217,6 +217,7 @@ void __wake_up_sync_key(struct wait_queue_head *wq_head, unsigned int mode, void · 216 unmodified lines | ||
| 217 | 217 | void __wake_up_locked_sync_key(struct wait_queue_head *wq_head, unsigned int mode, void *key); |
| 218 | 218 | void __wake_up_locked(struct wait_queue_head *wq_head, unsigned int mode, int nr); |
| 219 | 219 | void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode); |
| 220 | +void __wake_up_pollfree(struct wait_queue_head *wq_head); | |
| 220 | 221 | |
| 221 | 222 | #define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL) |
| 222 | 223 | #define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL) |
| @@ -245,6 +246,31 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode); · 22 unmodified lines | ||
| 245 | 246 | #define wake_up_interruptible_sync_poll_locked(x, m) \ |
| 246 | 247 | __wake_up_locked_sync_key((x), TASK_INTERRUPTIBLE, poll_to_key(m)) |
| 247 | 248 | |
| 249 | +/** | |
| 250 | + * wake_up_pollfree - signal that a polled waitqueue is going away | |
| 251 | + * @wq_head: the wait queue head | |
| 252 | + * | |
| 253 | + * In the very rare cases where a ->poll() implementation uses a waitqueue whose | |
| 254 | + * lifetime is tied to a task rather than to the 'struct file' being polled, | |
| 255 | + * this function must be called before the waitqueue is freed so that | |
| 256 | + * non-blocking polls (e.g. epoll) are notified that the queue is going away. | |
| 257 | + * | |
| 258 | + * The caller must also RCU-delay the freeing of the wait_queue_head, e.g. via | |
| 259 | + * an explicit synchronize_rcu() or call_rcu(), or via SLAB_TYPESAFE_BY_RCU. | |
| 260 | + */ | |
| 261 | +static inline void wake_up_pollfree(struct wait_queue_head *wq_head) | |
| 262 | +{ | |
| 263 | + /* | |
| 264 | + * For performance reasons, we don't always take the queue lock here. | |
| 265 | + * Therefore, we might race with someone removing the last entry from | |
| 266 | + * the queue, and proceed while they still hold the queue lock. | |
| 267 | + * However, rcu_read_lock() is required to be held in such cases, so we | |
| 268 | + * can safely proceed with an RCU-delayed free. | |
| 269 | + */ | |
| 270 | + if (waitqueue_active(wq_head)) | |
| 271 | + __wake_up_pollfree(wq_head); | |
| 272 | +} | |
| 273 | + | |
| 248 | 274 | #define ___wait_cond_timeout(condition) \ |
| 249 | 275 | ({ \ |
| 250 | 276 | bool __cond = (condition); \ |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #define POLLRDHUP 0x2000 |
| 30 | 30 | #endif |
| 31 | 31 | |
| 32 | −#define POLLFREE (__force __poll_t)0x4000 /* currently only for epoll */ | |
| 32 | +#define POLLFREE (__force __poll_t)0x4000 | |
| 33 | 33 | |
| 34 | 34 | #define POLL_BUSY_LOOP (__force __poll_t)0x8000 |
| 35 | 35 | |
| @@ -136,19 +136,21 @@ struct mptcp_info { · 135 unmodified lines | ||
| 136 | 136 | * MPTCP_EVENT_REMOVED: token, rem_id |
| 137 | 137 | * An address has been lost by the peer. |
| 138 | 138 | * |
| 139 | − * MPTCP_EVENT_SUB_ESTABLISHED: token, family, saddr4 | saddr6, | |
| 140 | − * daddr4 | daddr6, sport, dport, backup, | |
| 141 | − * if_idx [, error] | |
| 139 | + * MPTCP_EVENT_SUB_ESTABLISHED: token, family, loc_id, rem_id, | |
| 140 | + * saddr4 | saddr6, daddr4 | daddr6, sport, | |
| 141 | + * dport, backup, if_idx [, error] | |
| 142 | 142 | * A new subflow has been established. 'error' should not be set. |
| 143 | 143 | * |
| 144 | − * MPTCP_EVENT_SUB_CLOSED: token, family, saddr4 | saddr6, daddr4 | daddr6, | |
| 145 | − * sport, dport, backup, if_idx [, error] | |
| 144 | + * MPTCP_EVENT_SUB_CLOSED: token, family, loc_id, rem_id, saddr4 | saddr6, | |
| 145 | + * daddr4 | daddr6, sport, dport, backup, if_idx | |
| 146 | + * [, error] | |
| 146 | 147 | * A subflow has been closed. An error (copy of sk_err) could be set if an |
| 147 | 148 | * error has been detected for this subflow. |
| 148 | 149 | * |
| 149 | − * MPTCP_EVENT_SUB_PRIORITY: token, family, saddr4 | saddr6, daddr4 | daddr6, | |
| 150 | − * sport, dport, backup, if_idx [, error] | |
| 151 | − * The priority of a subflow has changed. 'error' should not be set. | |
| 150 | + * MPTCP_EVENT_SUB_PRIORITY: token, family, loc_id, rem_id, saddr4 | saddr6, | |
| 151 | + * daddr4 | daddr6, sport, dport, backup, if_idx | |
| 152 | + * [, error] | |
| 153 | + * The priority of a subflow has changed. 'error' should not be set. | |
| 152 | 154 | */ |
| 153 | 155 | enum mptcp_event_type { |
| 154 | 156 | MPTCP_EVENT_UNSPEC = 0, |
| @@ -66,10 +66,17 @@ struct rlimit64 { · 65 unmodified lines | ||
| 66 | 66 | #define _STK_LIM (8*1024*1024) |
| 67 | 67 | |
| 68 | 68 | /* |
| 69 | − * GPG2 wants 64kB of mlocked memory, to make sure pass phrases | |
| 70 | − * and other sensitive information are never written to disk. | |
| 69 | + * Limit the amount of locked memory by some sane default: | |
| 70 | + * root can always increase this limit if needed. | |
| 71 | + * | |
| 72 | + * The main use-cases are (1) preventing sensitive memory | |
| 73 | + * from being swapped; (2) real-time operations; (3) via | |
| 74 | + * IOURING_REGISTER_BUFFERS. | |
| 75 | + * | |
| 76 | + * The first two don't need much. The latter will take as | |
| 77 | + * much as it can get. 8MB is a reasonably sane default. | |
| 71 | 78 | */ |
| 72 | −#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024) | |
| 79 | +#define MLOCK_LIMIT (8*1024*1024) | |
| 73 | 80 | |
| 74 | 81 | /* |
| 75 | 82 | * Due to binary compatibility, the actual resource numbers |
| @@ -718,7 +718,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 717 unmodified lines | ||
| 718 | 718 | { |
| 719 | 719 | int rc = 0; |
| 720 | 720 | struct sk_buff *skb; |
| 721 | − static unsigned int failed = 0; | |
| 721 | + unsigned int failed = 0; | |
| 722 | 722 | |
| 723 | 723 | /* NOTE: kauditd_thread takes care of all our locking, we just use |
| 724 | 724 | * the netlink info passed to us (e.g. sk and portid) */ |
| @@ -735,32 +735,30 @@ static int kauditd_send_queue(struct sock *sk, u32 portid, · 10 unmodified lines | ||
| 735 | 735 | continue; |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | +retry: | |
| 738 | 739 | /* grab an extra skb reference in case of error */ |
| 739 | 740 | skb_get(skb); |
| 740 | 741 | rc = netlink_unicast(sk, skb, portid, 0); |
| 741 | 742 | if (rc < 0) { |
| 742 | − /* fatal failure for our queue flush attempt? */ | |
| 743 | + /* send failed - try a few times unless fatal error */ | |
| 743 | 744 | if (++failed >= retry_limit || |
| 744 | 745 | rc == -ECONNREFUSED || rc == -EPERM) { |
| 745 | − /* yes - error processing for the queue */ | |
| 746 | 746 | sk = NULL; |
| 747 | 747 | if (err_hook) |
| 748 | 748 | (*err_hook)(skb); |
| 749 | − if (!skb_hook) | |
| 750 | − goto out; | |
| 751 | − /* keep processing with the skb_hook */ | |
| 749 | + if (rc == -EAGAIN) | |
| 750 | + rc = 0; | |
| 751 | + /* continue to drain the queue */ | |
| 752 | 752 | continue; |
| 753 | 753 | } else |
| 754 | − /* no - requeue to preserve ordering */ | |
| 755 | − skb_queue_head(queue, skb); | |
| 754 | + goto retry; | |
| 756 | 755 | } else { |
| 757 | − /* it worked - drop the extra reference and continue */ | |
| 756 | + /* skb sent - drop the extra reference and continue */ | |
| 758 | 757 | consume_skb(skb); |
| 759 | 758 | failed = 0; |
| 760 | 759 | } |
| 761 | 760 | } |
| 762 | 761 | |
| 763 | −out: | |
| 764 | 762 | return (rc >= 0 ? 0 : rc); |
| 765 | 763 | } |
| 766 | 764 | |
| @@ -1609,7 +1607,8 @@ static int __net_init audit_net_init(struct net *net) · 842 unmodified lines | ||
| 1609 | 1607 | audit_panic("cannot initialize netlink socket in namespace"); |
| 1610 | 1608 | return -ENOMEM; |
| 1611 | 1609 | } |
| 1612 | − aunet->sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT; | |
| 1610 | + /* limit the timeout in case auditd is blocked/stopped */ | |
| 1611 | + aunet->sk->sk_sndtimeo = HZ / 10; | |
| 1613 | 1612 | |
| 1614 | 1613 | return 0; |
| 1615 | 1614 | } |
| @@ -1368,22 +1368,28 @@ static void __reg_bound_offset(struct bpf_reg_state *reg) · 1367 unmodified lines | ||
| 1368 | 1368 | reg->var_off = tnum_or(tnum_clear_subreg(var64_off), var32_off); |
| 1369 | 1369 | } |
| 1370 | 1370 | |
| 1371 | +static bool __reg32_bound_s64(s32 a) | |
| 1372 | +{ | |
| 1373 | + return a >= 0 && a <= S32_MAX; | |
| 1374 | +} | |
| 1375 | + | |
| 1371 | 1376 | static void __reg_assign_32_into_64(struct bpf_reg_state *reg) |
| 1372 | 1377 | { |
| 1373 | 1378 | reg->umin_value = reg->u32_min_value; |
| 1374 | 1379 | reg->umax_value = reg->u32_max_value; |
| 1375 | − /* Attempt to pull 32-bit signed bounds into 64-bit bounds | |
| 1376 | − * but must be positive otherwise set to worse case bounds | |
| 1377 | − * and refine later from tnum. | |
| 1380 | + | |
| 1381 | + /* Attempt to pull 32-bit signed bounds into 64-bit bounds but must | |
| 1382 | + * be positive otherwise set to worse case bounds and refine later | |
| 1383 | + * from tnum. | |
| 1378 | 1384 | */ |
| 1379 | − if (reg->s32_min_value >= 0 && reg->s32_max_value >= 0) | |
| 1380 | − reg->smax_value = reg->s32_max_value; | |
| 1381 | − else | |
| 1382 | − reg->smax_value = U32_MAX; | |
| 1383 | − if (reg->s32_min_value >= 0) | |
| 1385 | + if (__reg32_bound_s64(reg->s32_min_value) && | |
| 1386 | + __reg32_bound_s64(reg->s32_max_value)) { | |
| 1384 | 1387 | reg->smin_value = reg->s32_min_value; |
| 1385 | − else | |
| 1388 | + reg->smax_value = reg->s32_max_value; | |
| 1389 | + } else { | |
| 1386 | 1390 | reg->smin_value = 0; |
| 1391 | + reg->smax_value = U32_MAX; | |
| 1392 | + } | |
| 1387 | 1393 | } |
| 1388 | 1394 | |
| 1389 | 1395 | static void __reg_combine_32_into_64(struct bpf_reg_state *reg) |
| @@ -2381,8 +2387,6 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx, · 991 unmodified lines | ||
| 2381 | 2387 | */ |
| 2382 | 2388 | if (insn->src_reg != BPF_REG_FP) |
| 2383 | 2389 | return 0; |
| 2384 | − if (BPF_SIZE(insn->code) != BPF_DW) | |
| 2385 | − return 0; | |
| 2386 | 2390 | |
| 2387 | 2391 | /* dreg = *(u64 *)[fp - off] was a fill from the stack. |
| 2388 | 2392 | * that [fp - off] slot contains scalar that needs to be |
| @@ -2405,8 +2409,6 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx, · 16 unmodified lines | ||
| 2405 | 2409 | /* scalars can only be spilled into stack */ |
| 2406 | 2410 | if (insn->dst_reg != BPF_REG_FP) |
| 2407 | 2411 | return 0; |
| 2408 | − if (BPF_SIZE(insn->code) != BPF_DW) | |
| 2409 | − return 0; | |
| 2410 | 2412 | spi = (-insn->off - 1) / BPF_REG_SIZE; |
| 2411 | 2413 | if (spi >= 64) { |
| 2412 | 2414 | verbose(env, "BUG spi %d\n", spi); |
| @@ -4553,9 +4555,16 @@ static int check_atomic(struct bpf_verifier_env *env, int insn_idx, struct bpf_i · 2140 unmodified lines | ||
| 4553 | 4555 | |
| 4554 | 4556 | if (insn->imm == BPF_CMPXCHG) { |
| 4555 | 4557 | /* Check comparison of R0 with memory location */ |
| 4556 | − err = check_reg_arg(env, BPF_REG_0, SRC_OP); | |
| 4558 | + const u32 aux_reg = BPF_REG_0; | |
| 4559 | + | |
| 4560 | + err = check_reg_arg(env, aux_reg, SRC_OP); | |
| 4557 | 4561 | if (err) |
| 4558 | 4562 | return err; |
| 4563 | + | |
| 4564 | + if (is_pointer_value(env, aux_reg)) { | |
| 4565 | + verbose(env, "R%d leaks addr into mem\n", aux_reg); | |
| 4566 | + return -EACCES; | |
| 4567 | + } | |
| 4559 | 4568 | } |
| 4560 | 4569 | |
| 4561 | 4570 | if (is_pointer_value(env, insn->src_reg)) { |
| @@ -4590,13 +4599,19 @@ static int check_atomic(struct bpf_verifier_env *env, int insn_idx, struct bpf_i · 28 unmodified lines | ||
| 4590 | 4599 | load_reg = -1; |
| 4591 | 4600 | } |
| 4592 | 4601 | |
| 4593 | − /* check whether we can read the memory */ | |
| 4602 | + /* Check whether we can read the memory, with second call for fetch | |
| 4603 | + * case to simulate the register fill. | |
| 4604 | + */ | |
| 4594 | 4605 | err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off, |
| 4595 | − BPF_SIZE(insn->code), BPF_READ, load_reg, true); | |
| 4606 | + BPF_SIZE(insn->code), BPF_READ, -1, true); | |
| 4607 | + if (!err && load_reg >= 0) | |
| 4608 | + err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off, | |
| 4609 | + BPF_SIZE(insn->code), BPF_READ, load_reg, | |
| 4610 | + true); | |
| 4596 | 4611 | if (err) |
| 4597 | 4612 | return err; |
| 4598 | 4613 | |
| 4599 | − /* check whether we can write into the same memory */ | |
| 4614 | + /* Check whether we can write into the same memory. */ | |
| 4600 | 4615 | err = check_mem_access(env, insn_idx, insn->dst_reg, insn->off, |
| 4601 | 4616 | BPF_SIZE(insn->code), BPF_WRITE, -1, true); |
| 4602 | 4617 | if (err) |
| @@ -8364,6 +8379,10 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) · 3761 unmodified lines | ||
| 8364 | 8379 | insn->dst_reg); |
| 8365 | 8380 | } |
| 8366 | 8381 | zext_32_to_64(dst_reg); |
| 8382 | + | |
| 8383 | + __update_reg_bounds(dst_reg); | |
| 8384 | + __reg_deduce_bounds(dst_reg); | |
| 8385 | + __reg_bound_offset(dst_reg); | |
| 8367 | 8386 | } |
| 8368 | 8387 | } else { |
| 8369 | 8388 | /* case: R = imm |
| @@ -238,6 +238,13 @@ void __wake_up_sync(struct wait_queue_head *wq_head, unsigned int mode) · 237 unmodified lines | ||
| 238 | 238 | } |
| 239 | 239 | EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */ |
| 240 | 240 | |
| 241 | +void __wake_up_pollfree(struct wait_queue_head *wq_head) | |
| 242 | +{ | |
| 243 | + __wake_up(wq_head, TASK_NORMAL, 0, poll_to_key(EPOLLHUP | POLLFREE)); | |
| 244 | + /* POLLFREE must have cleared the queue. */ | |
| 245 | + WARN_ON_ONCE(waitqueue_active(wq_head)); | |
| 246 | +} | |
| 247 | + | |
| 241 | 248 | /* |
| 242 | 249 | * Note: we use "set_current_state()" _after_ the wait-queue add, |
| 243 | 250 | * because we need a memory barrier there on SMP, so that any |
| @@ -2054,26 +2054,28 @@ unsigned long msleep_interruptible(unsigned int msecs) · 2053 unmodified lines | ||
| 2054 | 2054 | EXPORT_SYMBOL(msleep_interruptible); |
| 2055 | 2055 | |
| 2056 | 2056 | /** |
| 2057 | − * usleep_range - Sleep for an approximate time | |
| 2058 | − * @min: Minimum time in usecs to sleep | |
| 2059 | − * @max: Maximum time in usecs to sleep | |
| 2057 | + * usleep_range_state - Sleep for an approximate time in a given state | |
| 2058 | + * @min: Minimum time in usecs to sleep | |
| 2059 | + * @max: Maximum time in usecs to sleep | |
| 2060 | + * @state: State of the current task that will be while sleeping | |
| 2060 | 2061 | * |
| 2061 | 2062 | * In non-atomic context where the exact wakeup time is flexible, use |
| 2062 | − * usleep_range() instead of udelay(). The sleep improves responsiveness | |
| 2063 | + * usleep_range_state() instead of udelay(). The sleep improves responsiveness | |
| 2063 | 2064 | * by avoiding the CPU-hogging busy-wait of udelay(), and the range reduces |
| 2064 | 2065 | * power usage by allowing hrtimers to take advantage of an already- |
| 2065 | 2066 | * scheduled interrupt instead of scheduling a new one just for this sleep. |
| 2066 | 2067 | */ |
| 2067 | −void __sched usleep_range(unsigned long min, unsigned long max) | |
| 2068 | +void __sched usleep_range_state(unsigned long min, unsigned long max, | |
| 2069 | + unsigned int state) | |
| 2068 | 2070 | { |
| 2069 | 2071 | ktime_t exp = ktime_add_us(ktime_get(), min); |
| 2070 | 2072 | u64 delta = (u64)(max - min) * NSEC_PER_USEC; |
| 2071 | 2073 | |
| 2072 | 2074 | for (;;) { |
| 2073 | − __set_current_state(TASK_UNINTERRUPTIBLE); | |
| 2075 | + __set_current_state(state); | |
| 2074 | 2076 | /* Do not return before the requested sleep time has elapsed */ |
| 2075 | 2077 | if (!schedule_hrtimeout_range(&exp, delta, HRTIMER_MODE_ABS)) |
| 2076 | 2078 | break; |
| 2077 | 2079 | } |
| 2078 | 2080 | } |
| 2079 | −EXPORT_SYMBOL(usleep_range); | |
| 2081 | +EXPORT_SYMBOL(usleep_range_state); | |
| @@ -5217,6 +5217,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr) · 5216 unmodified lines | ||
| 5217 | 5217 | { |
| 5218 | 5218 | struct ftrace_direct_func *direct; |
| 5219 | 5219 | struct ftrace_func_entry *entry; |
| 5220 | + struct ftrace_hash *hash; | |
| 5220 | 5221 | int ret = -ENODEV; |
| 5221 | 5222 | |
| 5222 | 5223 | mutex_lock(&direct_mutex); |
| @@ -5225,7 +5226,8 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr) · 2 unmodified lines | ||
| 5225 | 5226 | if (!entry) |
| 5226 | 5227 | goto out_unlock; |
| 5227 | 5228 | |
| 5228 | − if (direct_functions->count == 1) | |
| 5229 | + hash = direct_ops.func_hash->filter_hash; | |
| 5230 | + if (hash->count == 1) | |
| 5229 | 5231 | unregister_ftrace_function(&direct_ops); |
| 5230 | 5232 | |
| 5231 | 5233 | ret = ftrace_set_filter_ip(&direct_ops, ip, 1, 0); |
| @@ -5540,6 +5542,10 @@ int unregister_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr) · 308 unmodified lines | ||
| 5540 | 5542 | err = unregister_ftrace_function(ops); |
| 5541 | 5543 | remove_direct_functions_hash(hash, addr); |
| 5542 | 5544 | mutex_unlock(&direct_mutex); |
| 5545 | + | |
| 5546 | + /* cleanup for possible another register call */ | |
| 5547 | + ops->func = NULL; | |
| 5548 | + ops->trampoline = 0; | |
| 5543 | 5549 | return err; |
| 5544 | 5550 | } |
| 5545 | 5551 | EXPORT_SYMBOL_GPL(unregister_ftrace_direct_multi); |
| @@ -1237,9 +1237,8 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 1236 unmodified lines | ||
| 1237 | 1237 | argv + consumed, &consumed, |
| 1238 | 1238 | &field_version); |
| 1239 | 1239 | if (IS_ERR(field)) { |
| 1240 | − argv_free(argv); | |
| 1241 | 1240 | ret = PTR_ERR(field); |
| 1242 | − goto err; | |
| 1241 | + goto err_free_arg; | |
| 1243 | 1242 | } |
| 1244 | 1243 | |
| 1245 | 1244 | /* |
| @@ -1262,18 +1261,19 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 16 unmodified lines | ||
| 1262 | 1261 | if (cmd_version > 1 && n_fields_this_loop >= 1) { |
| 1263 | 1262 | synth_err(SYNTH_ERR_INVALID_CMD, errpos(field_str)); |
| 1264 | 1263 | ret = -EINVAL; |
| 1265 | − goto err; | |
| 1264 | + goto err_free_arg; | |
| 1266 | 1265 | } |
| 1267 | 1266 | |
| 1268 | 1267 | fields[n_fields++] = field; |
| 1269 | 1268 | if (n_fields == SYNTH_FIELDS_MAX) { |
| 1270 | 1269 | synth_err(SYNTH_ERR_TOO_MANY_FIELDS, 0); |
| 1271 | 1270 | ret = -EINVAL; |
| 1272 | − goto err; | |
| 1271 | + goto err_free_arg; | |
| 1273 | 1272 | } |
| 1274 | 1273 | |
| 1275 | 1274 | n_fields_this_loop++; |
| 1276 | 1275 | } |
| 1276 | + argv_free(argv); | |
| 1277 | 1277 | |
| 1278 | 1278 | if (consumed < argc) { |
| 1279 | 1279 | synth_err(SYNTH_ERR_INVALID_CMD, 0); |
| @@ -1281,7 +1281,6 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 1 unmodified line | ||
| 1281 | 1281 | goto err; |
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | − argv_free(argv); | |
| 1285 | 1284 | } |
| 1286 | 1285 | |
| 1287 | 1286 | if (n_fields == 0) { |
| @@ -1307,6 +1306,8 @@ static int __create_synth_event(const char *name, const char *raw_fields) · 19 unmodified lines | ||
| 1307 | 1306 | kfree(saved_fields); |
| 1308 | 1307 | |
| 1309 | 1308 | return ret; |
| 1309 | + err_free_arg: | |
| 1310 | + argv_free(argv); | |
| 1310 | 1311 | err: |
| 1311 | 1312 | for (i = 0; i < n_fields; i++) |
| 1312 | 1313 | free_synth_field(fields[i]); |
| @@ -428,7 +428,7 @@ config THP_SWAP · 427 unmodified lines | ||
| 428 | 428 | # UP and nommu archs use km based percpu allocator |
| 429 | 429 | # |
| 430 | 430 | config NEED_PER_CPU_KM |
| 431 | − depends on !SMP | |
| 431 | + depends on !SMP || !MMU | |
| 432 | 432 | bool |
| 433 | 433 | default y |
| 434 | 434 | |
| @@ -945,6 +945,13 @@ void bdi_unregister(struct backing_dev_info *bdi) · 944 unmodified lines | ||
| 945 | 945 | wb_shutdown(&bdi->wb); |
| 946 | 946 | cgwb_bdi_unregister(bdi); |
| 947 | 947 | |
| 948 | + /* | |
| 949 | + * If this BDI's min ratio has been set, use bdi_set_min_ratio() to | |
| 950 | + * update the global bdi_min_ratio. | |
| 951 | + */ | |
| 952 | + if (bdi->min_ratio) | |
| 953 | + bdi_set_min_ratio(bdi, 0); | |
| 954 | + | |
| 948 | 955 | if (bdi->dev) { |
| 949 | 956 | bdi_debug_unregister(bdi); |
| 950 | 957 | device_unregister(bdi->dev); |
| @@ -282,7 +282,6 @@ int damon_set_targets(struct damon_ctx *ctx, · 281 unmodified lines | ||
| 282 | 282 | for (i = 0; i < nr_ids; i++) { |
| 283 | 283 | t = damon_new_target(ids[i]); |
| 284 | 284 | if (!t) { |
| 285 | − pr_err("Failed to alloc damon_target\n"); | |
| 286 | 285 | /* The caller should do cleanup of the ids itself */ |
| 287 | 286 | damon_for_each_target_safe(t, next, ctx) |
| 288 | 287 | damon_destroy_target(t); |
| @@ -312,16 +311,10 @@ int damon_set_attrs(struct damon_ctx *ctx, unsigned long sample_int, · 23 unmodified lines | ||
| 312 | 311 | unsigned long aggr_int, unsigned long primitive_upd_int, |
| 313 | 312 | unsigned long min_nr_reg, unsigned long max_nr_reg) |
| 314 | 313 | { |
| 315 | − if (min_nr_reg < 3) { | |
| 316 | − pr_err("min_nr_regions (%lu) must be at least 3\n", | |
| 317 | − min_nr_reg); | |
| 314 | + if (min_nr_reg < 3) | |
| 318 | 315 | return -EINVAL; |
| 319 | − } | |
| 320 | − if (min_nr_reg > max_nr_reg) { | |
| 321 | − pr_err("invalid nr_regions. min (%lu) > max (%lu)\n", | |
| 322 | − min_nr_reg, max_nr_reg); | |
| 316 | + if (min_nr_reg > max_nr_reg) | |
| 323 | 317 | return -EINVAL; |
| 324 | − } | |
| 325 | 318 | |
| 326 | 319 | ctx->sample_interval = sample_int; |
| 327 | 320 | ctx->aggr_interval = aggr_int; |
| @@ -980,10 +973,11 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme) · 652 unmodified lines | ||
| 980 | 973 | |
| 981 | 974 | static void kdamond_usleep(unsigned long usecs) |
| 982 | 975 | { |
| 983 | − if (usecs > 100 * 1000) | |
| 984 | − schedule_timeout_interruptible(usecs_to_jiffies(usecs)); | |
| 976 | + /* See Documentation/timers/timers-howto.rst for the thresholds */ | |
| 977 | + if (usecs > 20 * USEC_PER_MSEC) | |
| 978 | + schedule_timeout_idle(usecs_to_jiffies(usecs)); | |
| 985 | 979 | else |
| 986 | − usleep_range(usecs, usecs + 1); | |
| 980 | + usleep_idle_range(usecs, usecs + 1); | |
| 987 | 981 | } |
| 988 | 982 | |
| 989 | 983 | /* Returns negative error code if it's not activated but should return */ |
| @@ -1038,7 +1032,7 @@ static int kdamond_fn(void *data) · 48 unmodified lines | ||
| 1038 | 1032 | ctx->callback.after_sampling(ctx)) |
| 1039 | 1033 | done = true; |
| 1040 | 1034 | |
| 1041 | − usleep_range(ctx->sample_interval, ctx->sample_interval + 1); | |
| 1035 | + kdamond_usleep(ctx->sample_interval); | |
| 1042 | 1036 | |
| 1043 | 1037 | if (ctx->primitive.check_accesses) |
| 1044 | 1038 | max_nr_accesses = ctx->primitive.check_accesses(ctx); |
| @@ -210,10 +210,8 @@ static struct damos **str_to_schemes(const char *str, ssize_t len, · 209 unmodified lines | ||
| 210 | 210 | &wmarks.low, &parsed); |
| 211 | 211 | if (ret != 18) |
| 212 | 212 | break; |
| 213 | − if (!damos_action_valid(action)) { | |
| 214 | − pr_err("wrong action %d\n", action); | |
| 213 | + if (!damos_action_valid(action)) | |
| 215 | 214 | goto fail; |
| 216 | − } | |
| 217 | 215 | |
| 218 | 216 | pos += parsed; |
| 219 | 217 | scheme = damon_new_scheme(min_sz, max_sz, min_nr_a, max_nr_a, |
| @@ -135,7 +135,6 @@ static void damon_do_test_apply_three_regions(struct kunit *test, · 134 unmodified lines | ||
| 135 | 135 | struct damon_addr_range *three_regions, |
| 136 | 136 | unsigned long *expected, int nr_expected) |
| 137 | 137 | { |
| 138 | − struct damon_ctx *ctx = damon_new_ctx(); | |
| 139 | 138 | struct damon_target *t; |
| 140 | 139 | struct damon_region *r; |
| 141 | 140 | int i; |
| @@ -145,7 +144,6 @@ static void damon_do_test_apply_three_regions(struct kunit *test, · 3 unmodified lines | ||
| 145 | 144 | r = damon_new_region(regions[i * 2], regions[i * 2 + 1]); |
| 146 | 145 | damon_add_region(r, t); |
| 147 | 146 | } |
| 148 | − damon_add_target(ctx, t); | |
| 149 | 147 | |
| 150 | 148 | damon_va_apply_three_regions(t, three_regions); |
| 151 | 149 | |
| @@ -154,8 +152,6 @@ static void damon_do_test_apply_three_regions(struct kunit *test, · 2 unmodified lines | ||
| 154 | 152 | KUNIT_EXPECT_EQ(test, r->ar.start, expected[i * 2]); |
| 155 | 153 | KUNIT_EXPECT_EQ(test, r->ar.end, expected[i * 2 + 1]); |
| 156 | 154 | } |
| 157 | − | |
| 158 | − damon_destroy_ctx(ctx); | |
| 159 | 155 | } |
| 160 | 156 | |
| 161 | 157 | /* |
| @@ -252,60 +248,59 @@ static void damon_test_apply_three_regions4(struct kunit *test) · 90 unmodified lines | ||
| 252 | 248 | new_three_regions, expected, ARRAY_SIZE(expected)); |
| 253 | 249 | } |
| 254 | 250 | |
| 255 | −static void damon_test_split_evenly(struct kunit *test) | |
| 251 | +static void damon_test_split_evenly_fail(struct kunit *test, | |
| 252 | + unsigned long start, unsigned long end, unsigned int nr_pieces) | |
| 256 | 253 | { |
| 257 | − struct damon_ctx *c = damon_new_ctx(); | |
| 258 | − struct damon_target *t; | |
| 259 | − struct damon_region *r; | |
| 260 | − unsigned long i; | |
| 261 | − | |
| 262 | − KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(NULL, NULL, 5), | |
| 263 | − -EINVAL); | |
| 264 | − | |
| 265 | − t = damon_new_target(42); | |
| 266 | − r = damon_new_region(0, 100); | |
| 267 | − KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 0), -EINVAL); | |
| 254 | + struct damon_target *t = damon_new_target(42); | |
| 255 | + struct damon_region *r = damon_new_region(start, end); | |
| 268 | 256 | |
| 269 | 257 | damon_add_region(r, t); |
| 270 | − KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 10), 0); | |
| 271 | − KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 10u); | |
| 258 | + KUNIT_EXPECT_EQ(test, | |
| 259 | + damon_va_evenly_split_region(t, r, nr_pieces), -EINVAL); | |
| 260 | + KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1u); | |
| 272 | 261 | |
| 273 | − i = 0; | |
| 274 | 262 | damon_for_each_region(r, t) { |
| 275 | − KUNIT_EXPECT_EQ(test, r->ar.start, i++ * 10); | |
| 276 | − KUNIT_EXPECT_EQ(test, r->ar.end, i * 10); | |
| 263 | + KUNIT_EXPECT_EQ(test, r->ar.start, start); | |
| 264 | + KUNIT_EXPECT_EQ(test, r->ar.end, end); | |
| 277 | 265 | } |
| 266 | + | |
| 278 | 267 | damon_free_target(t); |
| 268 | +} | |
| 269 | + | |
| 270 | +static void damon_test_split_evenly_succ(struct kunit *test, | |
| 271 | + unsigned long start, unsigned long end, unsigned int nr_pieces) | |
| 272 | +{ | |
| 273 | + struct damon_target *t = damon_new_target(42); | |
| 274 | + struct damon_region *r = damon_new_region(start, end); | |
| 275 | + unsigned long expected_width = (end - start) / nr_pieces; | |
| 276 | + unsigned long i = 0; | |
| 279 | 277 | |
| 280 | − t = damon_new_target(42); | |
| 281 | − r = damon_new_region(5, 59); | |
| 282 | 278 | damon_add_region(r, t); |
| 283 | − KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 5), 0); | |
| 284 | − KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 5u); | |
| 279 | + KUNIT_EXPECT_EQ(test, | |
| 280 | + damon_va_evenly_split_region(t, r, nr_pieces), 0); | |
| 281 | + KUNIT_EXPECT_EQ(test, damon_nr_regions(t), nr_pieces); | |
| 285 | 282 | |
| 286 | − i = 0; | |
| 287 | 283 | damon_for_each_region(r, t) { |
| 288 | − if (i == 4) | |
| 284 | + if (i == nr_pieces - 1) | |
| 289 | 285 | break; |
| 290 | − KUNIT_EXPECT_EQ(test, r->ar.start, 5 + 10 * i++); | |
| 291 | − KUNIT_EXPECT_EQ(test, r->ar.end, 5 + 10 * i); | |
| 286 | + KUNIT_EXPECT_EQ(test, | |
| 287 | + r->ar.start, start + i++ * expected_width); | |
| 288 | + KUNIT_EXPECT_EQ(test, r->ar.end, start + i * expected_width); | |
| 292 | 289 | } |
| 293 | − KUNIT_EXPECT_EQ(test, r->ar.start, 5 + 10 * i); | |
| 294 | − KUNIT_EXPECT_EQ(test, r->ar.end, 59ul); | |
| 290 | + KUNIT_EXPECT_EQ(test, r->ar.start, start + i * expected_width); | |
| 291 | + KUNIT_EXPECT_EQ(test, r->ar.end, end); | |
| 295 | 292 | damon_free_target(t); |
| 293 | +} | |
| 296 | 294 | |
| 297 | − t = damon_new_target(42); | |
| 298 | − r = damon_new_region(5, 6); | |
| 299 | − damon_add_region(r, t); | |
| 300 | − KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(t, r, 2), -EINVAL); | |
| 301 | − KUNIT_EXPECT_EQ(test, damon_nr_regions(t), 1u); | |
| 295 | +static void damon_test_split_evenly(struct kunit *test) | |
| 296 | +{ | |
| 297 | + KUNIT_EXPECT_EQ(test, damon_va_evenly_split_region(NULL, NULL, 5), | |
| 298 | + -EINVAL); | |
| 302 | 299 | |
| 303 | − damon_for_each_region(r, t) { | |
| 304 | − KUNIT_EXPECT_EQ(test, r->ar.start, 5ul); | |
| 305 | − KUNIT_EXPECT_EQ(test, r->ar.end, 6ul); | |
| 306 | − } | |
| 307 | − damon_free_target(t); | |
| 308 | − damon_destroy_ctx(c); | |
| 300 | + damon_test_split_evenly_fail(test, 0, 100, 0); | |
| 301 | + damon_test_split_evenly_succ(test, 0, 100, 10); | |
| 302 | + damon_test_split_evenly_succ(test, 5, 59, 5); | |
| 303 | + damon_test_split_evenly_fail(test, 5, 6, 2); | |
| 309 | 304 | } |
| 310 | 305 | |
| 311 | 306 | static struct kunit_case damon_test_cases[] = { |
| @@ -627,7 +627,6 @@ int damon_va_apply_scheme(struct damon_ctx *ctx, struct damon_target *t, · 626 unmodified lines | ||
| 627 | 627 | case DAMOS_STAT: |
| 628 | 628 | return 0; |
| 629 | 629 | default: |
| 630 | − pr_warn("Wrong action %d\n", scheme->action); | |
| 631 | 630 | return -EINVAL; |
| 632 | 631 | } |
| 633 | 632 | |
| @@ -3253,8 +3253,6 @@ static struct page *next_uptodate_page(struct page *page, · 3252 unmodified lines | ||
| 3253 | 3253 | goto skip; |
| 3254 | 3254 | if (!PageUptodate(page) || PageReadahead(page)) |
| 3255 | 3255 | goto skip; |
| 3256 | − if (PageHWPoison(page)) | |
| 3257 | − goto skip; | |
| 3258 | 3256 | if (!trylock_page(page)) |
| 3259 | 3257 | goto skip; |
| 3260 | 3258 | if (page->mapping != mapping) |
| @@ -2973,7 +2973,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid) · 2972 unmodified lines | ||
| 2973 | 2973 | struct huge_bootmem_page *m = NULL; /* initialize for clang */ |
| 2974 | 2974 | int nr_nodes, node; |
| 2975 | 2975 | |
| 2976 | − if (nid >= nr_online_nodes) | |
| 2976 | + if (nid != NUMA_NO_NODE && nid >= nr_online_nodes) | |
| 2977 | 2977 | return 0; |
| 2978 | 2978 | /* do node specific alloc */ |
| 2979 | 2979 | if (nid != NUMA_NO_NODE) { |
| @@ -776,24 +776,6 @@ void __mod_lruvec_kmem_state(void *p, enum node_stat_item idx, int val) · 775 unmodified lines | ||
| 776 | 776 | rcu_read_unlock(); |
| 777 | 777 | } |
| 778 | 778 | |
| 779 | −/* | |
| 780 | − * mod_objcg_mlstate() may be called with irq enabled, so | |
| 781 | − * mod_memcg_lruvec_state() should be used. | |
| 782 | − */ | |
| 783 | −static inline void mod_objcg_mlstate(struct obj_cgroup *objcg, | |
| 784 | − struct pglist_data *pgdat, | |
| 785 | − enum node_stat_item idx, int nr) | |
| 786 | −{ | |
| 787 | − struct mem_cgroup *memcg; | |
| 788 | − struct lruvec *lruvec; | |
| 789 | − | |
| 790 | − rcu_read_lock(); | |
| 791 | − memcg = obj_cgroup_memcg(objcg); | |
| 792 | − lruvec = mem_cgroup_lruvec(memcg, pgdat); | |
| 793 | − mod_memcg_lruvec_state(lruvec, idx, nr); | |
| 794 | − rcu_read_unlock(); | |
| 795 | −} | |
| 796 | − | |
| 797 | 779 | /** |
| 798 | 780 | * __count_memcg_events - account VM events in a cgroup |
| 799 | 781 | * @memcg: the memory cgroup |
| @@ -2137,41 +2119,6 @@ static bool obj_stock_flush_required(struct memcg_stock_pcp *stock, · 1337 unmodified lines | ||
| 2137 | 2119 | } |
| 2138 | 2120 | #endif |
| 2139 | 2121 | |
| 2140 | −/* | |
| 2141 | − * Most kmem_cache_alloc() calls are from user context. The irq disable/enable | |
| 2142 | − * sequence used in this case to access content from object stock is slow. | |
| 2143 | − * To optimize for user context access, there are now two object stocks for | |
| 2144 | − * task context and interrupt context access respectively. | |
| 2145 | − * | |
| 2146 | − * The task context object stock can be accessed by disabling preemption only | |
| 2147 | − * which is cheap in non-preempt kernel. The interrupt context object stock | |
| 2148 | − * can only be accessed after disabling interrupt. User context code can | |
| 2149 | − * access interrupt object stock, but not vice versa. | |
| 2150 | − */ | |
| 2151 | −static inline struct obj_stock *get_obj_stock(unsigned long *pflags) | |
| 2152 | −{ | |
| 2153 | − struct memcg_stock_pcp *stock; | |
| 2154 | − | |
| 2155 | − if (likely(in_task())) { | |
| 2156 | − *pflags = 0UL; | |
| 2157 | − preempt_disable(); | |
| 2158 | − stock = this_cpu_ptr(&memcg_stock); | |
| 2159 | − return &stock->task_obj; | |
| 2160 | − } | |
| 2161 | − | |
| 2162 | − local_irq_save(*pflags); | |
| 2163 | − stock = this_cpu_ptr(&memcg_stock); | |
| 2164 | − return &stock->irq_obj; | |
| 2165 | −} | |
| 2166 | − | |
| 2167 | −static inline void put_obj_stock(unsigned long flags) | |
| 2168 | −{ | |
| 2169 | − if (likely(in_task())) | |
| 2170 | − preempt_enable(); | |
| 2171 | − else | |
| 2172 | − local_irq_restore(flags); | |
| 2173 | −} | |
| 2174 | − | |
| 2175 | 2122 | /** |
| 2176 | 2123 | * consume_stock: Try to consume stocked charge on this cpu. |
| 2177 | 2124 | * @memcg: memcg to consume from. |
| @@ -2816,6 +2763,59 @@ retry: · 638 unmodified lines | ||
| 2816 | 2763 | */ |
| 2817 | 2764 | #define OBJCGS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | __GFP_ACCOUNT) |
| 2818 | 2765 | |
| 2766 | +/* | |
| 2767 | + * Most kmem_cache_alloc() calls are from user context. The irq disable/enable | |
| 2768 | + * sequence used in this case to access content from object stock is slow. | |
| 2769 | + * To optimize for user context access, there are now two object stocks for | |
| 2770 | + * task context and interrupt context access respectively. | |
| 2771 | + * | |
| 2772 | + * The task context object stock can be accessed by disabling preemption only | |
| 2773 | + * which is cheap in non-preempt kernel. The interrupt context object stock | |
| 2774 | + * can only be accessed after disabling interrupt. User context code can | |
| 2775 | + * access interrupt object stock, but not vice versa. | |
| 2776 | + */ | |
| 2777 | +static inline struct obj_stock *get_obj_stock(unsigned long *pflags) | |
| 2778 | +{ | |
| 2779 | + struct memcg_stock_pcp *stock; | |
| 2780 | + | |
| 2781 | + if (likely(in_task())) { | |
| 2782 | + *pflags = 0UL; | |
| 2783 | + preempt_disable(); | |
| 2784 | + stock = this_cpu_ptr(&memcg_stock); | |
| 2785 | + return &stock->task_obj; | |
| 2786 | + } | |
| 2787 | + | |
| 2788 | + local_irq_save(*pflags); | |
| 2789 | + stock = this_cpu_ptr(&memcg_stock); | |
| 2790 | + return &stock->irq_obj; | |
| 2791 | +} | |
| 2792 | + | |
| 2793 | +static inline void put_obj_stock(unsigned long flags) | |
| 2794 | +{ | |
| 2795 | + if (likely(in_task())) | |
| 2796 | + preempt_enable(); | |
| 2797 | + else | |
| 2798 | + local_irq_restore(flags); | |
| 2799 | +} | |
| 2800 | + | |
| 2801 | +/* | |
| 2802 | + * mod_objcg_mlstate() may be called with irq enabled, so | |
| 2803 | + * mod_memcg_lruvec_state() should be used. | |
| 2804 | + */ | |
| 2805 | +static inline void mod_objcg_mlstate(struct obj_cgroup *objcg, | |
| 2806 | + struct pglist_data *pgdat, | |
| 2807 | + enum node_stat_item idx, int nr) | |
| 2808 | +{ | |
| 2809 | + struct mem_cgroup *memcg; | |
| 2810 | + struct lruvec *lruvec; | |
| 2811 | + | |
| 2812 | + rcu_read_lock(); | |
| 2813 | + memcg = obj_cgroup_memcg(objcg); | |
| 2814 | + lruvec = mem_cgroup_lruvec(memcg, pgdat); | |
| 2815 | + mod_memcg_lruvec_state(lruvec, idx, nr); | |
| 2816 | + rcu_read_unlock(); | |
| 2817 | +} | |
| 2818 | + | |
| 2819 | 2819 | int memcg_alloc_page_obj_cgroups(struct page *page, struct kmem_cache *s, |
| 2820 | 2820 | gfp_t gfp, bool new_page) |
| 2821 | 2821 | { |
| @@ -5081,6 +5081,7 @@ struct loc_track { · 5080 unmodified lines | ||
| 5081 | 5081 | unsigned long max; |
| 5082 | 5082 | unsigned long count; |
| 5083 | 5083 | struct location *loc; |
| 5084 | + loff_t idx; | |
| 5084 | 5085 | }; |
| 5085 | 5086 | |
| 5086 | 5087 | static struct dentry *slab_debugfs_root; |
| @@ -6052,11 +6053,11 @@ __initcall(slab_sysfs_init); · 965 unmodified lines | ||
| 6052 | 6053 | #if defined(CONFIG_SLUB_DEBUG) && defined(CONFIG_DEBUG_FS) |
| 6053 | 6054 | static int slab_debugfs_show(struct seq_file *seq, void *v) |
| 6054 | 6055 | { |
| 6055 | − | |
| 6056 | − struct location *l; | |
| 6057 | − unsigned int idx = *(unsigned int *)v; | |
| 6058 | 6056 | struct loc_track *t = seq->private; |
| 6057 | + struct location *l; | |
| 6058 | + unsigned long idx; | |
| 6059 | 6059 | |
| 6060 | + idx = (unsigned long) t->idx; | |
| 6060 | 6061 | if (idx < t->count) { |
| 6061 | 6062 | l = &t->loc[idx]; |
| 6062 | 6063 | |
| @@ -6105,16 +6106,18 @@ static void *slab_debugfs_next(struct seq_file *seq, void *v, loff_t *ppos) · 42 unmodified lines | ||
| 6105 | 6106 | { |
| 6106 | 6107 | struct loc_track *t = seq->private; |
| 6107 | 6108 | |
| 6108 | − v = ppos; | |
| 6109 | − ++*ppos; | |
| 6109 | + t->idx = ++(*ppos); | |
| 6110 | 6110 | if (*ppos <= t->count) |
| 6111 | − return v; | |
| 6111 | + return ppos; | |
| 6112 | 6112 | |
| 6113 | 6113 | return NULL; |
| 6114 | 6114 | } |
| 6115 | 6115 | |
| 6116 | 6116 | static void *slab_debugfs_start(struct seq_file *seq, loff_t *ppos) |
| 6117 | 6117 | { |
| 6118 | + struct loc_track *t = seq->private; | |
| 6119 | + | |
| 6120 | + t->idx = *ppos; | |
| 6118 | 6121 | return ppos; |
| 6119 | 6122 | } |
| 6120 | 6123 | |
| @@ -832,7 +832,7 @@ void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt) · 831 unmodified lines | ||
| 832 | 832 | ntohs(skb->protocol), skb->pkt_type, skb->skb_iif); |
| 833 | 833 | |
| 834 | 834 | if (dev) |
| 835 | − printk("%sdev name=%s feat=0x%pNF\n", | |
| 835 | + printk("%sdev name=%s feat=%pNF\n", | |
| 836 | 836 | level, dev->name, &dev->features); |
| 837 | 837 | if (sk) |
| 838 | 838 | printk("%ssk family=%hu type=%u proto=%u\n", |
| @@ -261,6 +261,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, · 260 unmodified lines | ||
| 261 | 261 | r->idiag_state = sk->sk_state; |
| 262 | 262 | r->idiag_timer = 0; |
| 263 | 263 | r->idiag_retrans = 0; |
| 264 | + r->idiag_expires = 0; | |
| 264 | 265 | |
| 265 | 266 | if (inet_diag_msg_attrs_fill(sk, skb, r, ext, |
| 266 | 267 | sk_user_ns(NETLINK_CB(cb->skb).sk), |
| @@ -314,9 +315,6 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, · 47 unmodified lines | ||
| 314 | 315 | r->idiag_retrans = icsk->icsk_probes_out; |
| 315 | 316 | r->idiag_expires = |
| 316 | 317 | jiffies_delta_to_msecs(sk->sk_timer.expires - jiffies); |
| 317 | − } else { | |
| 318 | − r->idiag_timer = 0; | |
| 319 | − r->idiag_expires = 0; | |
| 320 | 318 | } |
| 321 | 319 | |
| 322 | 320 | if ((ext & (1 << (INET_DIAG_INFO - 1))) && handler->idiag_info_size) { |
| @@ -1933,7 +1933,6 @@ static int __net_init sit_init_net(struct net *net) · 1932 unmodified lines | ||
| 1933 | 1933 | return 0; |
| 1934 | 1934 | |
| 1935 | 1935 | err_reg_dev: |
| 1936 | − ipip6_dev_free(sitn->fb_tunnel_dev); | |
| 1937 | 1936 | free_netdev(sitn->fb_tunnel_dev); |
| 1938 | 1937 | err_alloc_dev: |
| 1939 | 1938 | return err; |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> |
| 10 | 10 | * Copyright 2007-2010, Intel Corporation |
| 11 | 11 | * Copyright(c) 2015-2017 Intel Deutschland GmbH |
| 12 | − * Copyright (C) 2018-2020 Intel Corporation | |
| 12 | + * Copyright (C) 2018-2021 Intel Corporation | |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | /** |
| @@ -191,7 +191,8 @@ static void ieee80211_add_addbaext(struct ieee80211_sub_if_data *sdata, · 175 unmodified lines | ||
| 191 | 191 | sband = ieee80211_get_sband(sdata); |
| 192 | 192 | if (!sband) |
| 193 | 193 | return; |
| 194 | − he_cap = ieee80211_get_he_iftype_cap(sband, sdata->vif.type); | |
| 194 | + he_cap = ieee80211_get_he_iftype_cap(sband, | |
| 195 | + ieee80211_vif_type_p2p(&sdata->vif)); | |
| 195 | 196 | if (!he_cap) |
| 196 | 197 | return; |
| 197 | 198 | |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> |
| 10 | 10 | * Copyright 2007-2010, Intel Corporation |
| 11 | 11 | * Copyright(c) 2015-2017 Intel Deutschland GmbH |
| 12 | − * Copyright (C) 2018 - 2020 Intel Corporation | |
| 12 | + * Copyright (C) 2018 - 2021 Intel Corporation | |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | #include <linux/ieee80211.h> |
| @@ -106,7 +106,7 @@ static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, · 90 unmodified lines | ||
| 106 | 106 | mgmt->u.action.u.addba_req.start_seq_num = |
| 107 | 107 | cpu_to_le16(start_seq_num << 4); |
| 108 | 108 | |
| 109 | − ieee80211_tx_skb(sdata, skb); | |
| 109 | + ieee80211_tx_skb_tid(sdata, skb, tid); | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn) |
| @@ -213,6 +213,8 @@ ieee80211_agg_start_txq(struct sta_info *sta, int tid, bool enable) · 100 unmodified lines | ||
| 213 | 213 | struct ieee80211_txq *txq = sta->sta.txq[tid]; |
| 214 | 214 | struct txq_info *txqi; |
| 215 | 215 | |
| 216 | + lockdep_assert_held(&sta->ampdu_mlme.mtx); | |
| 217 | + | |
| 216 | 218 | if (!txq) |
| 217 | 219 | return; |
| 218 | 220 | |
| @@ -290,7 +292,6 @@ static void ieee80211_remove_tid_tx(struct sta_info *sta, int tid) · 71 unmodified lines | ||
| 290 | 292 | ieee80211_assign_tid_tx(sta, tid, NULL); |
| 291 | 293 | |
| 292 | 294 | ieee80211_agg_splice_finish(sta->sdata, tid); |
| 293 | − ieee80211_agg_start_txq(sta, tid, false); | |
| 294 | 295 | |
| 295 | 296 | kfree_rcu(tid_tx, rcu_head); |
| 296 | 297 | } |
| @@ -480,8 +481,7 @@ static void ieee80211_send_addba_with_timeout(struct sta_info *sta, · 183 unmodified lines | ||
| 480 | 481 | |
| 481 | 482 | /* send AddBA request */ |
| 482 | 483 | ieee80211_send_addba_request(sdata, sta->sta.addr, tid, |
| 483 | − tid_tx->dialog_token, | |
| 484 | − sta->tid_seq[tid] >> 4, | |
| 484 | + tid_tx->dialog_token, tid_tx->ssn, | |
| 485 | 485 | buf_size, tid_tx->timeout); |
| 486 | 486 | |
| 487 | 487 | WARN_ON(test_and_set_bit(HT_AGG_STATE_SENT_ADDBA, &tid_tx->state)); |
| @@ -523,6 +523,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) · 35 unmodified lines | ||
| 523 | 523 | |
| 524 | 524 | params.ssn = sta->tid_seq[tid] >> 4; |
| 525 | 525 | ret = drv_ampdu_action(local, sdata, ¶ms); |
| 526 | + tid_tx->ssn = params.ssn; | |
| 526 | 527 | if (ret == IEEE80211_AMPDU_TX_START_DELAY_ADDBA) { |
| 527 | 528 | return; |
| 528 | 529 | } else if (ret == IEEE80211_AMPDU_TX_START_IMMEDIATE) { |
| @@ -889,6 +890,7 @@ void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, · 360 unmodified lines | ||
| 889 | 890 | { |
| 890 | 891 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
| 891 | 892 | bool send_delba = false; |
| 893 | + bool start_txq = false; | |
| 892 | 894 | |
| 893 | 895 | ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n", |
| 894 | 896 | sta->sta.addr, tid); |
| @@ -906,10 +908,14 @@ void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, · 11 unmodified lines | ||
| 906 | 908 | send_delba = true; |
| 907 | 909 | |
| 908 | 910 | ieee80211_remove_tid_tx(sta, tid); |
| 911 | + start_txq = true; | |
| 909 | 912 | |
| 910 | 913 | unlock_sta: |
| 911 | 914 | spin_unlock_bh(&sta->lock); |
| 912 | 915 | |
| 916 | + if (start_txq) | |
| 917 | + ieee80211_agg_start_txq(sta, tid, false); | |
| 918 | + | |
| 913 | 919 | if (send_delba) |
| 914 | 920 | ieee80211_send_delba(sdata, sta->sta.addr, tid, |
| 915 | 921 | WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); |
| @@ -1219,8 +1219,11 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local, · 1218 unmodified lines | ||
| 1219 | 1219 | { |
| 1220 | 1220 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif); |
| 1221 | 1221 | |
| 1222 | − if (local->in_reconfig) | |
| 1222 | + /* In reconfig don't transmit now, but mark for waking later */ | |
| 1223 | + if (local->in_reconfig) { | |
| 1224 | + set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txq->flags); | |
| 1223 | 1225 | return; |
| 1226 | + } | |
| 1224 | 1227 | |
| 1225 | 1228 | if (!check_sdata_in_driver(sdata)) |
| 1226 | 1229 | return; |
| @@ -2452,11 +2452,18 @@ static void ieee80211_sta_tx_wmm_ac_notify(struct ieee80211_sub_if_data *sdata, · 2451 unmodified lines | ||
| 2452 | 2452 | u16 tx_time) |
| 2453 | 2453 | { |
| 2454 | 2454 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
| 2455 | − u16 tid = ieee80211_get_tid(hdr); | |
| 2456 | − int ac = ieee80211_ac_from_tid(tid); | |
| 2457 | − struct ieee80211_sta_tx_tspec *tx_tspec = &ifmgd->tx_tspec[ac]; | |
| 2455 | + u16 tid; | |
| 2456 | + int ac; | |
| 2457 | + struct ieee80211_sta_tx_tspec *tx_tspec; | |
| 2458 | 2458 | unsigned long now = jiffies; |
| 2459 | 2459 | |
| 2460 | + if (!ieee80211_is_data_qos(hdr->frame_control)) | |
| 2461 | + return; | |
| 2462 | + | |
| 2463 | + tid = ieee80211_get_tid(hdr); | |
| 2464 | + ac = ieee80211_ac_from_tid(tid); | |
| 2465 | + tx_tspec = &ifmgd->tx_tspec[ac]; | |
| 2466 | + | |
| 2460 | 2467 | if (likely(!tx_tspec->admitted_time)) |
| 2461 | 2468 | return; |
| 2462 | 2469 | |
| @@ -2944,6 +2944,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) · 2943 unmodified lines | ||
| 2944 | 2944 | if (!fwd_skb) |
| 2945 | 2945 | goto out; |
| 2946 | 2946 | |
| 2947 | + fwd_skb->dev = sdata->dev; | |
| 2947 | 2948 | fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; |
| 2948 | 2949 | fwd_hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_RETRY); |
| 2949 | 2950 | info = IEEE80211_SKB_CB(fwd_skb); |
| @@ -644,13 +644,13 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) · 643 unmodified lines | ||
| 644 | 644 | /* check if STA exists already */ |
| 645 | 645 | if (sta_info_get_bss(sdata, sta->sta.addr)) { |
| 646 | 646 | err = -EEXIST; |
| 647 | − goto out_err; | |
| 647 | + goto out_cleanup; | |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL); |
| 651 | 651 | if (!sinfo) { |
| 652 | 652 | err = -ENOMEM; |
| 653 | − goto out_err; | |
| 653 | + goto out_cleanup; | |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | local->num_sta++; |
| @@ -667,6 +667,15 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) · 10 unmodified lines | ||
| 667 | 667 | |
| 668 | 668 | list_add_tail_rcu(&sta->list, &local->sta_list); |
| 669 | 669 | |
| 670 | + /* update channel context before notifying the driver about state | |
| 671 | + * change, this enables driver using the updated channel context right away. | |
| 672 | + */ | |
| 673 | + if (sta->sta_state >= IEEE80211_STA_ASSOC) { | |
| 674 | + ieee80211_recalc_min_chandef(sta->sdata); | |
| 675 | + if (!sta->sta.support_p2p_ps) | |
| 676 | + ieee80211_recalc_p2p_go_ps_allowed(sta->sdata); | |
| 677 | + } | |
| 678 | + | |
| 670 | 679 | /* notify driver */ |
| 671 | 680 | err = sta_info_insert_drv_state(local, sdata, sta); |
| 672 | 681 | if (err) |
| @@ -674,12 +683,6 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) · 1 unmodified line | ||
| 674 | 683 | |
| 675 | 684 | set_sta_flag(sta, WLAN_STA_INSERTED); |
| 676 | 685 | |
| 677 | − if (sta->sta_state >= IEEE80211_STA_ASSOC) { | |
| 678 | − ieee80211_recalc_min_chandef(sta->sdata); | |
| 679 | − if (!sta->sta.support_p2p_ps) | |
| 680 | − ieee80211_recalc_p2p_go_ps_allowed(sta->sdata); | |
| 681 | − } | |
| 682 | − | |
| 683 | 686 | /* accept BA sessions now */ |
| 684 | 687 | clear_sta_flag(sta, WLAN_STA_BLOCK_BA); |
| 685 | 688 | |
| @@ -706,8 +709,8 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) · 20 unmodified lines | ||
| 706 | 709 | out_drop_sta: |
| 707 | 710 | local->num_sta--; |
| 708 | 711 | synchronize_net(); |
| 712 | + out_cleanup: | |
| 709 | 713 | cleanup_single_sta(sta); |
| 710 | − out_err: | |
| 711 | 714 | mutex_unlock(&local->sta_mtx); |
| 712 | 715 | kfree(sinfo); |
| 713 | 716 | rcu_read_lock(); |
| @@ -176,6 +176,7 @@ struct sta_info; · 175 unmodified lines | ||
| 176 | 176 | * @failed_bar_ssn: ssn of the last failed BAR tx attempt |
| 177 | 177 | * @bar_pending: BAR needs to be re-sent |
| 178 | 178 | * @amsdu: support A-MSDU withing A-MDPU |
| 179 | + * @ssn: starting sequence number of the session | |
| 179 | 180 | * |
| 180 | 181 | * This structure's lifetime is managed by RCU, assignments to |
| 181 | 182 | * the array holding it must hold the aggregation mutex. |
| @@ -199,6 +200,7 @@ struct tid_ampdu_tx { · 17 unmodified lines | ||
| 199 | 200 | u8 stop_initiator; |
| 200 | 201 | bool tx_stop; |
| 201 | 202 | u16 buf_size; |
| 203 | + u16 ssn; | |
| 202 | 204 | |
| 203 | 205 | u16 failed_bar_ssn; |
| 204 | 206 | bool bar_pending; |
| @@ -1822,15 +1822,15 @@ static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx) · 1821 unmodified lines | ||
| 1822 | 1822 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
| 1823 | 1823 | ieee80211_tx_result res = TX_CONTINUE; |
| 1824 | 1824 | |
| 1825 | + if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) | |
| 1826 | + CALL_TXH(ieee80211_tx_h_rate_ctrl); | |
| 1827 | + | |
| 1825 | 1828 | if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) { |
| 1826 | 1829 | __skb_queue_tail(&tx->skbs, tx->skb); |
| 1827 | 1830 | tx->skb = NULL; |
| 1828 | 1831 | goto txh_done; |
| 1829 | 1832 | } |
| 1830 | 1833 | |
| 1831 | − if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)) | |
| 1832 | − CALL_TXH(ieee80211_tx_h_rate_ctrl); | |
| 1833 | − | |
| 1834 | 1834 | CALL_TXH(ieee80211_tx_h_michael_mic_add); |
| 1835 | 1835 | CALL_TXH(ieee80211_tx_h_sequence); |
| 1836 | 1836 | CALL_TXH(ieee80211_tx_h_fragment); |
| @@ -4191,11 +4191,11 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, · 2354 unmodified lines | ||
| 4191 | 4191 | |
| 4192 | 4192 | ieee80211_aggr_check(sdata, sta, skb); |
| 4193 | 4193 | |
| 4194 | + sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); | |
| 4195 | + | |
| 4194 | 4196 | if (sta) { |
| 4195 | 4197 | struct ieee80211_fast_tx *fast_tx; |
| 4196 | 4198 | |
| 4197 | − sk_pacing_shift_update(skb->sk, sdata->local->hw.tx_sk_pacing_shift); | |
| 4198 | − | |
| 4199 | 4199 | fast_tx = rcu_dereference(sta->fast_tx); |
| 4200 | 4200 | |
| 4201 | 4201 | if (fast_tx && |
| @@ -943,7 +943,12 @@ static void ieee80211_parse_extension_element(u32 *crc, · 942 unmodified lines | ||
| 943 | 943 | struct ieee802_11_elems *elems) |
| 944 | 944 | { |
| 945 | 945 | const void *data = elem->data + 1; |
| 946 | − u8 len = elem->datalen - 1; | |
| 946 | + u8 len; | |
| 947 | + | |
| 948 | + if (!elem->datalen) | |
| 949 | + return; | |
| 950 | + | |
| 951 | + len = elem->datalen - 1; | |
| 947 | 952 | |
| 948 | 953 | switch (elem->data[0]) { |
| 949 | 954 | case WLAN_EID_EXT_HE_MU_EDCA: |
| @@ -2063,7 +2068,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, · 1113 unmodified lines | ||
| 2063 | 2068 | chandef.chan = chan; |
| 2064 | 2069 | |
| 2065 | 2070 | skb = ieee80211_probereq_get(&local->hw, src, ssid, ssid_len, |
| 2066 | − 100 + ie_len); | |
| 2071 | + local->scan_ies_len + ie_len); | |
| 2067 | 2072 | if (!skb) |
| 2068 | 2073 | return NULL; |
| 2069 | 2074 | |
| @@ -2646,6 +2651,13 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 576 unmodified lines | ||
| 2646 | 2651 | mutex_unlock(&local->sta_mtx); |
| 2647 | 2652 | } |
| 2648 | 2653 | |
| 2654 | + /* | |
| 2655 | + * If this is for hw restart things are still running. | |
| 2656 | + * We may want to change that later, however. | |
| 2657 | + */ | |
| 2658 | + if (local->open_count && (!suspended || reconfig_due_to_wowlan)) | |
| 2659 | + drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART); | |
| 2660 | + | |
| 2649 | 2661 | if (local->in_reconfig) { |
| 2650 | 2662 | local->in_reconfig = false; |
| 2651 | 2663 | barrier(); |
| @@ -2664,13 +2676,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 12 unmodified lines | ||
| 2664 | 2676 | IEEE80211_QUEUE_STOP_REASON_SUSPEND, |
| 2665 | 2677 | false); |
| 2666 | 2678 | |
| 2667 | − /* | |
| 2668 | − * If this is for hw restart things are still running. | |
| 2669 | − * We may want to change that later, however. | |
| 2670 | − */ | |
| 2671 | − if (local->open_count && (!suspended || reconfig_due_to_wowlan)) | |
| 2672 | − drv_reconfig_complete(local, IEEE80211_RECONFIG_TYPE_RESTART); | |
| 2673 | − | |
| 2674 | 2679 | if (!suspended) |
| 2675 | 2680 | return 0; |
| 2676 | 2681 | |
| @@ -700,6 +700,9 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, · 699 unmodified lines | ||
| 700 | 700 | |
| 701 | 701 | msk_owned_by_me(msk); |
| 702 | 702 | |
| 703 | + if (sk->sk_state == TCP_LISTEN) | |
| 704 | + return; | |
| 705 | + | |
| 703 | 706 | if (!rm_list->nr) |
| 704 | 707 | return; |
| 705 | 708 | |
| @@ -1527,7 +1527,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned int flags) · 1526 unmodified lines | ||
| 1527 | 1527 | int ret = 0; |
| 1528 | 1528 | |
| 1529 | 1529 | prev_ssk = ssk; |
| 1530 | − mptcp_flush_join_list(msk); | |
| 1530 | + __mptcp_flush_join_list(msk); | |
| 1531 | 1531 | ssk = mptcp_subflow_get_send(msk); |
| 1532 | 1532 | |
| 1533 | 1533 | /* First check. If the ssk has changed since |
| @@ -2914,7 +2914,7 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, · 1380 unmodified lines | ||
| 2914 | 2914 | */ |
| 2915 | 2915 | if (WARN_ON_ONCE(!new_mptcp_sock)) { |
| 2916 | 2916 | tcp_sk(newsk)->is_mptcp = 0; |
| 2917 | − return newsk; | |
| 2917 | + goto out; | |
| 2918 | 2918 | } |
| 2919 | 2919 | |
| 2920 | 2920 | /* acquire the 2nd reference for the owning socket */ |
| @@ -2926,6 +2926,8 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err, · 5 unmodified lines | ||
| 2926 | 2926 | MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK); |
| 2927 | 2927 | } |
| 2928 | 2928 | |
| 2929 | +out: | |
| 2930 | + newsk->sk_kern_sock = kern; | |
| 2929 | 2931 | return newsk; |
| 2930 | 2932 | } |
| 2931 | 2933 | |
| @@ -543,7 +543,6 @@ static bool mptcp_supported_sockopt(int level, int optname) · 542 unmodified lines | ||
| 543 | 543 | case TCP_NODELAY: |
| 544 | 544 | case TCP_THIN_LINEAR_TIMEOUTS: |
| 545 | 545 | case TCP_CONGESTION: |
| 546 | − case TCP_ULP: | |
| 547 | 546 | case TCP_CORK: |
| 548 | 547 | case TCP_KEEPIDLE: |
| 549 | 548 | case TCP_KEEPINTVL: |
| @@ -4496,9 +4496,10 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, · 4495 unmodified lines | ||
| 4496 | 4496 | } |
| 4497 | 4497 | |
| 4498 | 4498 | out_free_pg_vec: |
| 4499 | − bitmap_free(rx_owner_map); | |
| 4500 | − if (pg_vec) | |
| 4499 | + if (pg_vec) { | |
| 4500 | + bitmap_free(rx_owner_map); | |
| 4501 | 4501 | free_pg_vec(pg_vec, order, req->tp_block_nr); |
| 4502 | + } | |
| 4502 | 4503 | out: |
| 4503 | 4504 | return err; |
| 4504 | 4505 | } |
| @@ -868,6 +868,7 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp, · 867 unmodified lines | ||
| 868 | 868 | |
| 869 | 869 | err = pep_accept_conn(newsk, skb); |
| 870 | 870 | if (err) { |
| 871 | + __sock_put(sk); | |
| 871 | 872 | sock_put(newsk); |
| 872 | 873 | newsk = NULL; |
| 873 | 874 | goto drop; |
| @@ -253,6 +253,7 @@ static struct rds_connection *__rds_conn_create(struct net *net, · 252 unmodified lines | ||
| 253 | 253 | * should end up here, but if it |
| 254 | 254 | * does, reset/destroy the connection. |
| 255 | 255 | */ |
| 256 | + kfree(conn->c_path); | |
| 256 | 257 | kmem_cache_free(rds_conn_slab, conn); |
| 257 | 258 | conn = ERR_PTR(-EOPNOTSUPP); |
| 258 | 259 | goto out; |
| @@ -3687,6 +3687,7 @@ int tc_setup_flow_action(struct flow_action *flow_action, · 3686 unmodified lines | ||
| 3687 | 3687 | entry->mpls_mangle.ttl = tcf_mpls_ttl(act); |
| 3688 | 3688 | break; |
| 3689 | 3689 | default: |
| 3690 | + err = -EOPNOTSUPP; | |
| 3690 | 3691 | goto err_out_locked; |
| 3691 | 3692 | } |
| 3692 | 3693 | } else if (is_tcf_skbedit_ptype(act)) { |
| @@ -2736,7 +2736,7 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt, · 2735 unmodified lines | ||
| 2736 | 2736 | q->tins = kvcalloc(CAKE_MAX_TINS, sizeof(struct cake_tin_data), |
| 2737 | 2737 | GFP_KERNEL); |
| 2738 | 2738 | if (!q->tins) |
| 2739 | − goto nomem; | |
| 2739 | + return -ENOMEM; | |
| 2740 | 2740 | |
| 2741 | 2741 | for (i = 0; i < CAKE_MAX_TINS; i++) { |
| 2742 | 2742 | struct cake_tin_data *b = q->tins + i; |
| @@ -2766,10 +2766,6 @@ static int cake_init(struct Qdisc *sch, struct nlattr *opt, · 23 unmodified lines | ||
| 2766 | 2766 | q->min_netlen = ~0; |
| 2767 | 2767 | q->min_adjlen = ~0; |
| 2768 | 2768 | return 0; |
| 2769 | − | |
| 2770 | −nomem: | |
| 2771 | − cake_destroy(sch); | |
| 2772 | − return -ENOMEM; | |
| 2773 | 2769 | } |
| 2774 | 2770 | |
| 2775 | 2771 | static int cake_dump(struct Qdisc *sch, struct sk_buff *skb) |
| @@ -666,9 +666,9 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt, · 665 unmodified lines | ||
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | for (i = q->nbands; i < oldbands; i++) { |
| 669 | − qdisc_tree_flush_backlog(q->classes[i].qdisc); | |
| 670 | − if (i >= q->nstrict) | |
| 669 | + if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) | |
| 671 | 670 | list_del(&q->classes[i].alist); |
| 671 | + qdisc_tree_flush_backlog(q->classes[i].qdisc); | |
| 672 | 672 | } |
| 673 | 673 | q->nstrict = nstrict; |
| 674 | 674 | memcpy(q->prio2band, priomap, sizeof(priomap)); |
| @@ -194,7 +194,9 @@ static int smc_release(struct socket *sock) · 193 unmodified lines | ||
| 194 | 194 | /* cleanup for a dangling non-blocking connect */ |
| 195 | 195 | if (smc->connect_nonblock && sk->sk_state == SMC_INIT) |
| 196 | 196 | tcp_abort(smc->clcsock->sk, ECONNABORTED); |
| 197 | − flush_work(&smc->connect_work); | |
| 197 | + | |
| 198 | + if (cancel_work_sync(&smc->connect_work)) | |
| 199 | + sock_put(&smc->sk); /* sock_hold in smc_connect for passive closing */ | |
| 198 | 200 | |
| 199 | 201 | if (sk->sk_state == SMC_LISTEN) |
| 200 | 202 | /* smc_close_non_accepted() is called and acquires |
| @@ -1299,7 +1299,8 @@ void virtio_transport_recv_pkt(struct virtio_transport *t, · 1298 unmodified lines | ||
| 1299 | 1299 | space_available = virtio_transport_space_update(sk, pkt); |
| 1300 | 1300 | |
| 1301 | 1301 | /* Update CID in case it has changed after a transport reset event */ |
| 1302 | − vsk->local_addr.svm_cid = dst.svm_cid; | |
| 1302 | + if (vsk->local_addr.svm_cid != VMADDR_CID_ANY) | |
| 1303 | + vsk->local_addr.svm_cid = dst.svm_cid; | |
| 1303 | 1304 | |
| 1304 | 1305 | if (space_available) |
| 1305 | 1306 | sk->sk_write_space(sk); |
| @@ -133,6 +133,7 @@ static u32 reg_is_indoor_portid; · 132 unmodified lines | ||
| 133 | 133 | |
| 134 | 134 | static void restore_regulatory_settings(bool reset_user, bool cached); |
| 135 | 135 | static void print_regdomain(const struct ieee80211_regdomain *rd); |
| 136 | +static void reg_process_hint(struct regulatory_request *reg_request); | |
| 136 | 137 | |
| 137 | 138 | static const struct ieee80211_regdomain *get_cfg80211_regdom(void) |
| 138 | 139 | { |
| @@ -1098,6 +1099,8 @@ int reg_reload_regdb(void) · 959 unmodified lines | ||
| 1098 | 1099 | const struct firmware *fw; |
| 1099 | 1100 | void *db; |
| 1100 | 1101 | int err; |
| 1102 | + const struct ieee80211_regdomain *current_regdomain; | |
| 1103 | + struct regulatory_request *request; | |
| 1101 | 1104 | |
| 1102 | 1105 | err = request_firmware(&fw, "regulatory.db", ®_pdev->dev); |
| 1103 | 1106 | if (err) |
| @@ -1118,8 +1121,26 @@ int reg_reload_regdb(void) · 14 unmodified lines | ||
| 1118 | 1121 | if (!IS_ERR_OR_NULL(regdb)) |
| 1119 | 1122 | kfree(regdb); |
| 1120 | 1123 | regdb = db; |
| 1121 | − rtnl_unlock(); | |
| 1122 | 1124 | |
| 1125 | + /* reset regulatory domain */ | |
| 1126 | + current_regdomain = get_cfg80211_regdom(); | |
| 1127 | + | |
| 1128 | + request = kzalloc(sizeof(*request), GFP_KERNEL); | |
| 1129 | + if (!request) { | |
| 1130 | + err = -ENOMEM; | |
| 1131 | + goto out_unlock; | |
| 1132 | + } | |
| 1133 | + | |
| 1134 | + request->wiphy_idx = WIPHY_IDX_INVALID; | |
| 1135 | + request->alpha2[0] = current_regdomain->alpha2[0]; | |
| 1136 | + request->alpha2[1] = current_regdomain->alpha2[1]; | |
| 1137 | + request->initiator = NL80211_REGDOM_SET_BY_CORE; | |
| 1138 | + request->user_reg_hint_type = NL80211_USER_REG_HINT_USER; | |
| 1139 | + | |
| 1140 | + reg_process_hint(request); | |
| 1141 | + | |
| 1142 | +out_unlock: | |
| 1143 | + rtnl_unlock(); | |
| 1123 | 1144 | out: |
| 1124 | 1145 | release_firmware(fw); |
| 1125 | 1146 | return err; |
| @@ -2338,6 +2359,7 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) · 1212 unmodified lines | ||
| 2338 | 2359 | struct cfg80211_chan_def chandef = {}; |
| 2339 | 2360 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
| 2340 | 2361 | enum nl80211_iftype iftype; |
| 2362 | + bool ret; | |
| 2341 | 2363 | |
| 2342 | 2364 | wdev_lock(wdev); |
| 2343 | 2365 | iftype = wdev->iftype; |
| @@ -2387,7 +2409,11 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) · 43 unmodified lines | ||
| 2387 | 2409 | case NL80211_IFTYPE_AP: |
| 2388 | 2410 | case NL80211_IFTYPE_P2P_GO: |
| 2389 | 2411 | case NL80211_IFTYPE_ADHOC: |
| 2390 | − return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype); | |
| 2412 | + wiphy_lock(wiphy); | |
| 2413 | + ret = cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype); | |
| 2414 | + wiphy_unlock(wiphy); | |
| 2415 | + | |
| 2416 | + return ret; | |
| 2391 | 2417 | case NL80211_IFTYPE_STATION: |
| 2392 | 2418 | case NL80211_IFTYPE_P2P_CLIENT: |
| 2393 | 2419 | return cfg80211_chandef_usable(wiphy, &chandef, |
| @@ -677,8 +677,6 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock, · 676 unmodified lines | ||
| 677 | 677 | struct xdp_sock *xs = xdp_sk(sk); |
| 678 | 678 | struct xsk_buff_pool *pool; |
| 679 | 679 | |
| 680 | − sock_poll_wait(file, sock, wait); | |
| 681 | − | |
| 682 | 680 | if (unlikely(!xsk_is_bound(xs))) |
| 683 | 681 | return mask; |
| 684 | 682 | |
| @@ -690,6 +688,8 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock, · 5 unmodified lines | ||
| 690 | 688 | else |
| 691 | 689 | /* Poll needs to drive Tx also in copy mode */ |
| 692 | 690 | __xsk_sendmsg(sk); |
| 691 | + } else { | |
| 692 | + sock_poll_wait(file, sock, wait); | |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | if (xs->rx && !xskq_prod_is_empty(xs->rx)) |
| @@ -4,6 +4,7 @@ obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace-direct.o · 3 unmodified lines | ||
| 4 | 4 | obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace-direct-too.o |
| 5 | 5 | obj-$(CONFIG_SAMPLE_FTRACE_DIRECT) += ftrace-direct-modify.o |
| 6 | 6 | obj-$(CONFIG_SAMPLE_FTRACE_DIRECT_MULTI) += ftrace-direct-multi.o |
| 7 | +obj-$(CONFIG_SAMPLE_FTRACE_DIRECT_MULTI) += ftrace-direct-multi-modify.o | |
| 7 | 8 | |
| 8 | 9 | CFLAGS_sample-trace-array.o := -I$(src) |
| 9 | 10 | obj-$(CONFIG_SAMPLE_TRACE_ARRAY) += sample-trace-array.o |
| @@ -0,0 +1,152 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0-only | |
| 2 | +#include <linux/module.h> | |
| 3 | +#include <linux/kthread.h> | |
| 4 | +#include <linux/ftrace.h> | |
| 5 | +#include <asm/asm-offsets.h> | |
| 6 | + | |
| 7 | +void my_direct_func1(unsigned long ip) | |
| 8 | +{ | |
| 9 | + trace_printk("my direct func1 ip %lx\n", ip); | |
| 10 | +} | |
| 11 | + | |
| 12 | +void my_direct_func2(unsigned long ip) | |
| 13 | +{ | |
| 14 | + trace_printk("my direct func2 ip %lx\n", ip); | |
| 15 | +} | |
| 16 | + | |
| 17 | +extern void my_tramp1(void *); | |
| 18 | +extern void my_tramp2(void *); | |
| 19 | + | |
| 20 | +#ifdef CONFIG_X86_64 | |
| 21 | + | |
| 22 | +asm ( | |
| 23 | +" .pushsection .text, \"ax\", @progbits\n" | |
| 24 | +" .type my_tramp1, @function\n" | |
| 25 | +" .globl my_tramp1\n" | |
| 26 | +" my_tramp1:" | |
| 27 | +" pushq %rbp\n" | |
| 28 | +" movq %rsp, %rbp\n" | |
| 29 | +" pushq %rdi\n" | |
| 30 | +" movq 8(%rbp), %rdi\n" | |
| 31 | +" call my_direct_func1\n" | |
| 32 | +" popq %rdi\n" | |
| 33 | +" leave\n" | |
| 34 | +" ret\n" | |
| 35 | +" .size my_tramp1, .-my_tramp1\n" | |
| 36 | +" .type my_tramp2, @function\n" | |
| 37 | +"\n" | |
| 38 | +" .globl my_tramp2\n" | |
| 39 | +" my_tramp2:" | |
| 40 | +" pushq %rbp\n" | |
| 41 | +" movq %rsp, %rbp\n" | |
| 42 | +" pushq %rdi\n" | |
| 43 | +" movq 8(%rbp), %rdi\n" | |
| 44 | +" call my_direct_func2\n" | |
| 45 | +" popq %rdi\n" | |
| 46 | +" leave\n" | |
| 47 | +" ret\n" | |
| 48 | +" .size my_tramp2, .-my_tramp2\n" | |
| 49 | +" .popsection\n" | |
| 50 | +); | |
| 51 | + | |
| 52 | +#endif /* CONFIG_X86_64 */ | |
| 53 | + | |
| 54 | +#ifdef CONFIG_S390 | |
| 55 | + | |
| 56 | +asm ( | |
| 57 | +" .pushsection .text, \"ax\", @progbits\n" | |
| 58 | +" .type my_tramp1, @function\n" | |
| 59 | +" .globl my_tramp1\n" | |
| 60 | +" my_tramp1:" | |
| 61 | +" lgr %r1,%r15\n" | |
| 62 | +" stmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n" | |
| 63 | +" stg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n" | |
| 64 | +" aghi %r15,"__stringify(-STACK_FRAME_OVERHEAD)"\n" | |
| 65 | +" stg %r1,"__stringify(__SF_BACKCHAIN)"(%r15)\n" | |
| 66 | +" lgr %r2,%r0\n" | |
| 67 | +" brasl %r14,my_direct_func1\n" | |
| 68 | +" aghi %r15,"__stringify(STACK_FRAME_OVERHEAD)"\n" | |
| 69 | +" lmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n" | |
| 70 | +" lg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n" | |
| 71 | +" lgr %r1,%r0\n" | |
| 72 | +" br %r1\n" | |
| 73 | +" .size my_tramp1, .-my_tramp1\n" | |
| 74 | +"\n" | |
| 75 | +" .type my_tramp2, @function\n" | |
| 76 | +" .globl my_tramp2\n" | |
| 77 | +" my_tramp2:" | |
| 78 | +" lgr %r1,%r15\n" | |
| 79 | +" stmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n" | |
| 80 | +" stg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n" | |
| 81 | +" aghi %r15,"__stringify(-STACK_FRAME_OVERHEAD)"\n" | |
| 82 | +" stg %r1,"__stringify(__SF_BACKCHAIN)"(%r15)\n" | |
| 83 | +" lgr %r2,%r0\n" | |
| 84 | +" brasl %r14,my_direct_func2\n" | |
| 85 | +" aghi %r15,"__stringify(STACK_FRAME_OVERHEAD)"\n" | |
| 86 | +" lmg %r0,%r5,"__stringify(__SF_GPRS)"(%r15)\n" | |
| 87 | +" lg %r14,"__stringify(__SF_GPRS+8*8)"(%r15)\n" | |
| 88 | +" lgr %r1,%r0\n" | |
| 89 | +" br %r1\n" | |
| 90 | +" .size my_tramp2, .-my_tramp2\n" | |
| 91 | +" .popsection\n" | |
| 92 | +); | |
| 93 | + | |
| 94 | +#endif /* CONFIG_S390 */ | |
| 95 | + | |
| 96 | +static unsigned long my_tramp = (unsigned long)my_tramp1; | |
| 97 | +static unsigned long tramps[2] = { | |
| 98 | + (unsigned long)my_tramp1, | |
| 99 | + (unsigned long)my_tramp2, | |
| 100 | +}; | |
| 101 | + | |
| 102 | +static struct ftrace_ops direct; | |
| 103 | + | |
| 104 | +static int simple_thread(void *arg) | |
| 105 | +{ | |
| 106 | + static int t; | |
| 107 | + int ret = 0; | |
| 108 | + | |
| 109 | + while (!kthread_should_stop()) { | |
| 110 | + set_current_state(TASK_INTERRUPTIBLE); | |
| 111 | + schedule_timeout(2 * HZ); | |
| 112 | + | |
| 113 | + if (ret) | |
| 114 | + continue; | |
| 115 | + t ^= 1; | |
| 116 | + ret = modify_ftrace_direct_multi(&direct, tramps[t]); | |
| 117 | + if (!ret) | |
| 118 | + my_tramp = tramps[t]; | |
| 119 | + WARN_ON_ONCE(ret); | |
| 120 | + } | |
| 121 | + | |
| 122 | + return 0; | |
| 123 | +} | |
| 124 | + | |
| 125 | +static struct task_struct *simple_tsk; | |
| 126 | + | |
| 127 | +static int __init ftrace_direct_multi_init(void) | |
| 128 | +{ | |
| 129 | + int ret; | |
| 130 | + | |
| 131 | + ftrace_set_filter_ip(&direct, (unsigned long) wake_up_process, 0, 0); | |
| 132 | + ftrace_set_filter_ip(&direct, (unsigned long) schedule, 0, 0); | |
| 133 | + | |
| 134 | + ret = register_ftrace_direct_multi(&direct, my_tramp); | |
| 135 | + | |
| 136 | + if (!ret) | |
| 137 | + simple_tsk = kthread_run(simple_thread, NULL, "event-sample-fn"); | |
| 138 | + return ret; | |
| 139 | +} | |
| 140 | + | |
| 141 | +static void __exit ftrace_direct_multi_exit(void) | |
| 142 | +{ | |
| 143 | + kthread_stop(simple_tsk); | |
| 144 | + unregister_ftrace_direct_multi(&direct, my_tramp); | |
| 145 | +} | |
| 146 | + | |
| 147 | +module_init(ftrace_direct_multi_init); | |
| 148 | +module_exit(ftrace_direct_multi_exit); | |
| 149 | + | |
| 150 | +MODULE_AUTHOR("Jiri Olsa"); | |
| 151 | +MODULE_DESCRIPTION("Example use case of using modify_ftrace_direct_multi()"); | |
| 152 | +MODULE_LICENSE("GPL"); | |
| @@ -219,7 +219,7 @@ if ($arch eq "x86_64") { · 218 unmodified lines | ||
| 219 | 219 | |
| 220 | 220 | } elsif ($arch eq "s390" && $bits == 64) { |
| 221 | 221 | if ($cc =~ /-DCC_USING_HOTPATCH/) { |
| 222 | − $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*brcl\\s*0,[0-9a-f]+ <([^\+]*)>\$"; | |
| 222 | + $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*c0 04 00 00 00 00\\s*(bcrl\\s*0,|jgnop\\s*)[0-9a-f]+ <([^\+]*)>\$"; | |
| 223 | 223 | $mcount_adjust = 0; |
| 224 | 224 | } |
| 225 | 225 | $alignment = 8; |
| @@ -264,6 +264,7 @@ static int copy_ctl_value_to_user(void __user *userdata, · 263 unmodified lines | ||
| 264 | 264 | struct snd_ctl_elem_value *data, |
| 265 | 265 | int type, int count) |
| 266 | 266 | { |
| 267 | + struct snd_ctl_elem_value32 __user *data32 = userdata; | |
| 267 | 268 | int i, size; |
| 268 | 269 | |
| 269 | 270 | if (type == SNDRV_CTL_ELEM_TYPE_BOOLEAN || |
| @@ -280,6 +281,8 @@ static int copy_ctl_value_to_user(void __user *userdata, · 10 unmodified lines | ||
| 280 | 281 | if (copy_to_user(valuep, data->value.bytes.data, size)) |
| 281 | 282 | return -EFAULT; |
| 282 | 283 | } |
| 284 | + if (copy_to_user(&data32->id, &data->id, sizeof(data32->id))) | |
| 285 | + return -EFAULT; | |
| 283 | 286 | return 0; |
| 284 | 287 | } |
| 285 | 288 | |
| @@ -147,7 +147,7 @@ snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params, · 146 unmodified lines | ||
| 147 | 147 | * |
| 148 | 148 | * Return the maximum value for field PAR. |
| 149 | 149 | */ |
| 150 | −static unsigned int | |
| 150 | +static int | |
| 151 | 151 | snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params, |
| 152 | 152 | snd_pcm_hw_param_t var, int *dir) |
| 153 | 153 | { |
| @@ -682,18 +682,24 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, · 528 unmodified lines | ||
| 682 | 682 | struct snd_pcm_hw_params *oss_params, |
| 683 | 683 | struct snd_pcm_hw_params *slave_params) |
| 684 | 684 | { |
| 685 | − size_t s; | |
| 686 | − size_t oss_buffer_size, oss_period_size, oss_periods; | |
| 687 | − size_t min_period_size, max_period_size; | |
| 685 | + ssize_t s; | |
| 686 | + ssize_t oss_buffer_size; | |
| 687 | + ssize_t oss_period_size, oss_periods; | |
| 688 | + ssize_t min_period_size, max_period_size; | |
| 688 | 689 | struct snd_pcm_runtime *runtime = substream->runtime; |
| 689 | 690 | size_t oss_frame_size; |
| 690 | 691 | |
| 691 | 692 | oss_frame_size = snd_pcm_format_physical_width(params_format(oss_params)) * |
| 692 | 693 | params_channels(oss_params) / 8; |
| 693 | 694 | |
| 695 | + oss_buffer_size = snd_pcm_hw_param_value_max(slave_params, | |
| 696 | + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, | |
| 697 | + NULL); | |
| 698 | + if (oss_buffer_size <= 0) | |
| 699 | + return -EINVAL; | |
| 694 | 700 | oss_buffer_size = snd_pcm_plug_client_size(substream, |
| 695 | − snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size; | |
| 696 | − if (!oss_buffer_size) | |
| 701 | + oss_buffer_size * oss_frame_size); | |
| 702 | + if (oss_buffer_size <= 0) | |
| 697 | 703 | return -EINVAL; |
| 698 | 704 | oss_buffer_size = rounddown_pow_of_two(oss_buffer_size); |
| 699 | 705 | if (atomic_read(&substream->mmap_count)) { |
| @@ -730,7 +736,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, · 30 unmodified lines | ||
| 730 | 736 | |
| 731 | 737 | min_period_size = snd_pcm_plug_client_size(substream, |
| 732 | 738 | snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL)); |
| 733 | − if (min_period_size) { | |
| 739 | + if (min_period_size > 0) { | |
| 734 | 740 | min_period_size *= oss_frame_size; |
| 735 | 741 | min_period_size = roundup_pow_of_two(min_period_size); |
| 736 | 742 | if (oss_period_size < min_period_size) |
| @@ -739,7 +745,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, · 2 unmodified lines | ||
| 739 | 745 | |
| 740 | 746 | max_period_size = snd_pcm_plug_client_size(substream, |
| 741 | 747 | snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL)); |
| 742 | − if (max_period_size) { | |
| 748 | + if (max_period_size > 0) { | |
| 743 | 749 | max_period_size *= oss_frame_size; |
| 744 | 750 | max_period_size = rounddown_pow_of_two(max_period_size); |
| 745 | 751 | if (oss_period_size > max_period_size) |
| @@ -752,7 +758,7 @@ static int snd_pcm_oss_period_size(struct snd_pcm_substream *substream, · 6 unmodified lines | ||
| 752 | 758 | oss_periods = substream->oss.setup.periods; |
| 753 | 759 | |
| 754 | 760 | s = snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIODS, NULL); |
| 755 | − if (runtime->oss.maxfrags && s > runtime->oss.maxfrags) | |
| 761 | + if (s > 0 && runtime->oss.maxfrags && s > runtime->oss.maxfrags) | |
| 756 | 762 | s = runtime->oss.maxfrags; |
| 757 | 763 | if (oss_periods > s) |
| 758 | 764 | oss_periods = s; |
| @@ -878,8 +884,15 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) · 119 unmodified lines | ||
| 878 | 884 | err = -EINVAL; |
| 879 | 885 | goto failure; |
| 880 | 886 | } |
| 881 | − choose_rate(substream, sparams, runtime->oss.rate); | |
| 882 | − snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL); | |
| 887 | + | |
| 888 | + err = choose_rate(substream, sparams, runtime->oss.rate); | |
| 889 | + if (err < 0) | |
| 890 | + goto failure; | |
| 891 | + err = snd_pcm_hw_param_near(substream, sparams, | |
| 892 | + SNDRV_PCM_HW_PARAM_CHANNELS, | |
| 893 | + runtime->oss.channels, NULL); | |
| 894 | + if (err < 0) | |
| 895 | + goto failure; | |
| 883 | 896 | |
| 884 | 897 | format = snd_pcm_oss_format_from(runtime->oss.format); |
| 885 | 898 | |
| @@ -1956,7 +1969,7 @@ static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsign · 1070 unmodified lines | ||
| 1956 | 1969 | if (runtime->oss.subdivision || runtime->oss.fragshift) |
| 1957 | 1970 | return -EINVAL; |
| 1958 | 1971 | fragshift = val & 0xffff; |
| 1959 | − if (fragshift >= 31) | |
| 1972 | + if (fragshift >= 25) /* should be large enough */ | |
| 1960 | 1973 | return -EINVAL; |
| 1961 | 1974 | runtime->oss.fragshift = fragshift; |
| 1962 | 1975 | runtime->oss.maxfrags = (val >> 16) & 0xffff; |
| @@ -6503,22 +6503,26 @@ static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, · 6502 unmodified lines | ||
| 6503 | 6503 | /* for alc285_fixup_ideapad_s740_coef() */ |
| 6504 | 6504 | #include "ideapad_s740_helper.c" |
| 6505 | 6505 | |
| 6506 | −static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec, | |
| 6507 | − const struct hda_fixup *fix, | |
| 6508 | − int action) | |
| 6506 | +static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = { | |
| 6507 | + WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000), | |
| 6508 | + WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000), | |
| 6509 | + WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089), | |
| 6510 | + {} | |
| 6511 | +}; | |
| 6512 | + | |
| 6513 | +static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, | |
| 6514 | + const struct hda_fixup *fix, | |
| 6515 | + int action) | |
| 6509 | 6516 | { |
| 6510 | 6517 | /* |
| 6511 | − * A certain other OS sets these coeffs to different values. On at least one TongFang | |
| 6512 | − * barebone these settings might survive even a cold reboot. So to restore a clean slate the | |
| 6513 | − * values are explicitly reset to default here. Without this, the external microphone is | |
| 6514 | − * always in a plugged-in state, while the internal microphone is always in an unplugged | |
| 6515 | − * state, breaking the ability to use the internal microphone. | |
| 6516 | − */ | |
| 6517 | − alc_write_coef_idx(codec, 0x24, 0x0000); | |
| 6518 | − alc_write_coef_idx(codec, 0x26, 0x0000); | |
| 6519 | − alc_write_coef_idx(codec, 0x29, 0x3000); | |
| 6520 | − alc_write_coef_idx(codec, 0x37, 0xfe05); | |
| 6521 | − alc_write_coef_idx(codec, 0x45, 0x5089); | |
| 6518 | + * A certain other OS sets these coeffs to different values. On at least | |
| 6519 | + * one TongFang barebone these settings might survive even a cold | |
| 6520 | + * reboot. So to restore a clean slate the values are explicitly reset | |
| 6521 | + * to default here. Without this, the external microphone is always in a | |
| 6522 | + * plugged-in state, while the internal microphone is always in an | |
| 6523 | + * unplugged state, breaking the ability to use the internal microphone. | |
| 6524 | + */ | |
| 6525 | + alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); | |
| 6522 | 6526 | } |
| 6523 | 6527 | |
| 6524 | 6528 | static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = { |
| @@ -6759,7 +6763,7 @@ enum { · 234 unmodified lines | ||
| 6759 | 6763 | ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, |
| 6760 | 6764 | ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, |
| 6761 | 6765 | ALC287_FIXUP_13S_GEN2_SPEAKERS, |
| 6762 | − ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS, | |
| 6766 | + ALC256_FIXUP_SET_COEF_DEFAULTS, | |
| 6763 | 6767 | ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE, |
| 6764 | 6768 | ALC233_FIXUP_NO_AUDIO_JACK, |
| 6765 | 6769 | }; |
| @@ -8465,9 +8469,9 @@ static const struct hda_fixup alc269_fixups[] = { · 1699 unmodified lines | ||
| 8465 | 8469 | .chained = true, |
| 8466 | 8470 | .chain_id = ALC269_FIXUP_HEADSET_MODE, |
| 8467 | 8471 | }, |
| 8468 | − [ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = { | |
| 8472 | + [ALC256_FIXUP_SET_COEF_DEFAULTS] = { | |
| 8469 | 8473 | .type = HDA_FIXUP_FUNC, |
| 8470 | − .v.func = alc256_fixup_tongfang_reset_persistent_settings, | |
| 8474 | + .v.func = alc256_fixup_set_coef_defaults, | |
| 8471 | 8475 | }, |
| 8472 | 8476 | [ALC245_FIXUP_HP_GPIO_LED] = { |
| 8473 | 8477 | .type = HDA_FIXUP_FUNC, |
| @@ -8929,7 +8933,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 455 unmodified lines | ||
| 8929 | 8933 | SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ |
| 8930 | 8934 | SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), |
| 8931 | 8935 | SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), |
| 8932 | − SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS), | |
| 8936 | + SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS), | |
| 8933 | 8937 | SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), |
| 8934 | 8938 | SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 8935 | 8939 | SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), |
| @@ -10231,6 +10235,27 @@ static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, · 1295 unmodified lines | ||
| 10231 | 10235 | } |
| 10232 | 10236 | } |
| 10233 | 10237 | |
| 10238 | +static void alc897_hp_automute_hook(struct hda_codec *codec, | |
| 10239 | + struct hda_jack_callback *jack) | |
| 10240 | +{ | |
| 10241 | + struct alc_spec *spec = codec->spec; | |
| 10242 | + int vref; | |
| 10243 | + | |
| 10244 | + snd_hda_gen_hp_automute(codec, jack); | |
| 10245 | + vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP; | |
| 10246 | + snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
| 10247 | + vref); | |
| 10248 | +} | |
| 10249 | + | |
| 10250 | +static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, | |
| 10251 | + const struct hda_fixup *fix, int action) | |
| 10252 | +{ | |
| 10253 | + struct alc_spec *spec = codec->spec; | |
| 10254 | + if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
| 10255 | + spec->gen.hp_automute_hook = alc897_hp_automute_hook; | |
| 10256 | + } | |
| 10257 | +} | |
| 10258 | + | |
| 10234 | 10259 | static const struct coef_fw alc668_coefs[] = { |
| 10235 | 10260 | WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), |
| 10236 | 10261 | WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), |
| @@ -10311,6 +10336,8 @@ enum { · 74 unmodified lines | ||
| 10311 | 10336 | ALC668_FIXUP_ASUS_NO_HEADSET_MIC, |
| 10312 | 10337 | ALC668_FIXUP_HEADSET_MIC, |
| 10313 | 10338 | ALC668_FIXUP_MIC_DET_COEF, |
| 10339 | + ALC897_FIXUP_LENOVO_HEADSET_MIC, | |
| 10340 | + ALC897_FIXUP_HEADSET_MIC_PIN, | |
| 10314 | 10341 | }; |
| 10315 | 10342 | |
| 10316 | 10343 | static const struct hda_fixup alc662_fixups[] = { |
| @@ -10717,6 +10744,19 @@ static const struct hda_fixup alc662_fixups[] = { · 400 unmodified lines | ||
| 10717 | 10744 | {} |
| 10718 | 10745 | }, |
| 10719 | 10746 | }, |
| 10747 | + [ALC897_FIXUP_LENOVO_HEADSET_MIC] = { | |
| 10748 | + .type = HDA_FIXUP_FUNC, | |
| 10749 | + .v.func = alc897_fixup_lenovo_headset_mic, | |
| 10750 | + }, | |
| 10751 | + [ALC897_FIXUP_HEADSET_MIC_PIN] = { | |
| 10752 | + .type = HDA_FIXUP_PINS, | |
| 10753 | + .v.pins = (const struct hda_pintbl[]) { | |
| 10754 | + { 0x1a, 0x03a11050 }, | |
| 10755 | + { } | |
| 10756 | + }, | |
| 10757 | + .chained = true, | |
| 10758 | + .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC | |
| 10759 | + }, | |
| 10720 | 10760 | }; |
| 10721 | 10761 | |
| 10722 | 10762 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
| @@ -10761,6 +10801,10 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { · 38 unmodified lines | ||
| 10761 | 10801 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
| 10762 | 10802 | SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE), |
| 10763 | 10803 | SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS), |
| 10804 | + SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN), | |
| 10805 | + SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN), | |
| 10806 | + SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN), | |
| 10807 | + SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN), | |
| 10764 | 10808 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
| 10765 | 10809 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
| 10766 | 10810 | SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO), |
| @@ -146,10 +146,11 @@ static int snd_acp6x_probe(struct pci_dev *pci, · 145 unmodified lines | ||
| 146 | 146 | { |
| 147 | 147 | struct acp6x_dev_data *adata; |
| 148 | 148 | struct platform_device_info pdevinfo[ACP6x_DEVS]; |
| 149 | − int ret, index; | |
| 149 | + int index = 0; | |
| 150 | 150 | int val = 0x00; |
| 151 | 151 | u32 addr; |
| 152 | 152 | unsigned int irqflags; |
| 153 | + int ret; | |
| 153 | 154 | |
| 154 | 155 | irqflags = IRQF_SHARED; |
| 155 | 156 | /* Yellow Carp device check */ |
| @@ -2858,6 +2858,8 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682) · 2857 unmodified lines | ||
| 2858 | 2858 | |
| 2859 | 2859 | for (i = 0; i < RT5682_DAI_NUM_CLKS; ++i) { |
| 2860 | 2860 | struct clk_init_data init = { }; |
| 2861 | + struct clk_parent_data parent_data; | |
| 2862 | + const struct clk_hw *parent; | |
| 2861 | 2863 | |
| 2862 | 2864 | dai_clk_hw = &rt5682->dai_clks_hw[i]; |
| 2863 | 2865 | |
| @@ -2865,17 +2867,17 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682) · 1 unmodified line | ||
| 2865 | 2867 | case RT5682_DAI_WCLK_IDX: |
| 2866 | 2868 | /* Make MCLK the parent of WCLK */ |
| 2867 | 2869 | if (rt5682->mclk) { |
| 2868 | − init.parent_data = &(struct clk_parent_data){ | |
| 2870 | + parent_data = (struct clk_parent_data){ | |
| 2869 | 2871 | .fw_name = "mclk", |
| 2870 | 2872 | }; |
| 2873 | + init.parent_data = &parent_data; | |
| 2871 | 2874 | init.num_parents = 1; |
| 2872 | 2875 | } |
| 2873 | 2876 | break; |
| 2874 | 2877 | case RT5682_DAI_BCLK_IDX: |
| 2875 | 2878 | /* Make WCLK the parent of BCLK */ |
| 2876 | − init.parent_hws = &(const struct clk_hw *){ | |
| 2877 | − &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX] | |
| 2878 | − }; | |
| 2879 | + parent = &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX]; | |
| 2880 | + init.parent_hws = &parent; | |
| 2879 | 2881 | init.num_parents = 1; |
| 2880 | 2882 | break; |
| 2881 | 2883 | default: |
| @@ -2693,6 +2693,8 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component) · 2692 unmodified lines | ||
| 2693 | 2693 | |
| 2694 | 2694 | for (i = 0; i < RT5682S_DAI_NUM_CLKS; ++i) { |
| 2695 | 2695 | struct clk_init_data init = { }; |
| 2696 | + struct clk_parent_data parent_data; | |
| 2697 | + const struct clk_hw *parent; | |
| 2696 | 2698 | |
| 2697 | 2699 | dai_clk_hw = &rt5682s->dai_clks_hw[i]; |
| 2698 | 2700 | |
| @@ -2700,17 +2702,17 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component) · 1 unmodified line | ||
| 2700 | 2702 | case RT5682S_DAI_WCLK_IDX: |
| 2701 | 2703 | /* Make MCLK the parent of WCLK */ |
| 2702 | 2704 | if (rt5682s->mclk) { |
| 2703 | − init.parent_data = &(struct clk_parent_data){ | |
| 2705 | + parent_data = (struct clk_parent_data){ | |
| 2704 | 2706 | .fw_name = "mclk", |
| 2705 | 2707 | }; |
| 2708 | + init.parent_data = &parent_data; | |
| 2706 | 2709 | init.num_parents = 1; |
| 2707 | 2710 | } |
| 2708 | 2711 | break; |
| 2709 | 2712 | case RT5682S_DAI_BCLK_IDX: |
| 2710 | 2713 | /* Make WCLK the parent of BCLK */ |
| 2711 | − init.parent_hws = &(const struct clk_hw *){ | |
| 2712 | − &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX] | |
| 2713 | − }; | |
| 2714 | + parent = &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX]; | |
| 2715 | + init.parent_hws = &parent; | |
| 2714 | 2716 | init.num_parents = 1; |
| 2715 | 2717 | break; |
| 2716 | 2718 | default: |
| @@ -3256,6 +3256,9 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc, · 3255 unmodified lines | ||
| 3256 | 3256 | int value = ucontrol->value.integer.value[0]; |
| 3257 | 3257 | int sel; |
| 3258 | 3258 | |
| 3259 | + if (wcd->comp_enabled[comp] == value) | |
| 3260 | + return 0; | |
| 3261 | + | |
| 3259 | 3262 | wcd->comp_enabled[comp] = value; |
| 3260 | 3263 | sel = value ? WCD934X_HPH_GAIN_SRC_SEL_COMPANDER : |
| 3261 | 3264 | WCD934X_HPH_GAIN_SRC_SEL_REGISTER; |
| @@ -3279,10 +3282,10 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc, · 17 unmodified lines | ||
| 3279 | 3282 | case COMPANDER_8: |
| 3280 | 3283 | break; |
| 3281 | 3284 | default: |
| 3282 | − break; | |
| 3285 | + return 0; | |
| 3283 | 3286 | } |
| 3284 | 3287 | |
| 3285 | − return 0; | |
| 3288 | + return 1; | |
| 3286 | 3289 | } |
| 3287 | 3290 | |
| 3288 | 3291 | static int wcd934x_rx_hph_mode_get(struct snd_kcontrol *kc, |
| @@ -3326,6 +3329,31 @@ static int slim_rx_mux_get(struct snd_kcontrol *kc, · 37 unmodified lines | ||
| 3326 | 3329 | return 0; |
| 3327 | 3330 | } |
| 3328 | 3331 | |
| 3332 | +static int slim_rx_mux_to_dai_id(int mux) | |
| 3333 | +{ | |
| 3334 | + int aif_id; | |
| 3335 | + | |
| 3336 | + switch (mux) { | |
| 3337 | + case 1: | |
| 3338 | + aif_id = AIF1_PB; | |
| 3339 | + break; | |
| 3340 | + case 2: | |
| 3341 | + aif_id = AIF2_PB; | |
| 3342 | + break; | |
| 3343 | + case 3: | |
| 3344 | + aif_id = AIF3_PB; | |
| 3345 | + break; | |
| 3346 | + case 4: | |
| 3347 | + aif_id = AIF4_PB; | |
| 3348 | + break; | |
| 3349 | + default: | |
| 3350 | + aif_id = -1; | |
| 3351 | + break; | |
| 3352 | + } | |
| 3353 | + | |
| 3354 | + return aif_id; | |
| 3355 | +} | |
| 3356 | + | |
| 3329 | 3357 | static int slim_rx_mux_put(struct snd_kcontrol *kc, |
| 3330 | 3358 | struct snd_ctl_elem_value *ucontrol) |
| 3331 | 3359 | { |
| @@ -3333,43 +3361,59 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, · 1 unmodified line | ||
| 3333 | 3361 | struct wcd934x_codec *wcd = dev_get_drvdata(w->dapm->dev); |
| 3334 | 3362 | struct soc_enum *e = (struct soc_enum *)kc->private_value; |
| 3335 | 3363 | struct snd_soc_dapm_update *update = NULL; |
| 3364 | + struct wcd934x_slim_ch *ch, *c; | |
| 3336 | 3365 | u32 port_id = w->shift; |
| 3366 | + bool found = false; | |
| 3367 | + int mux_idx; | |
| 3368 | + int prev_mux_idx = wcd->rx_port_value[port_id]; | |
| 3369 | + int aif_id; | |
| 3337 | 3370 | |
| 3338 | − if (wcd->rx_port_value[port_id] == ucontrol->value.enumerated.item[0]) | |
| 3339 | − return 0; | |
| 3371 | + mux_idx = ucontrol->value.enumerated.item[0]; | |
| 3340 | 3372 | |
| 3341 | − wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0]; | |
| 3373 | + if (mux_idx == prev_mux_idx) | |
| 3374 | + return 0; | |
| 3342 | 3375 | |
| 3343 | − switch (wcd->rx_port_value[port_id]) { | |
| 3376 | + switch(mux_idx) { | |
| 3344 | 3377 | case 0: |
| 3345 | − list_del_init(&wcd->rx_chs[port_id].list); | |
| 3346 | − break; | |
| 3347 | − case 1: | |
| 3348 | − list_add_tail(&wcd->rx_chs[port_id].list, | |
| 3349 | − &wcd->dai[AIF1_PB].slim_ch_list); | |
| 3350 | − break; | |
| 3351 | − case 2: | |
| 3352 | − list_add_tail(&wcd->rx_chs[port_id].list, | |
| 3353 | − &wcd->dai[AIF2_PB].slim_ch_list); | |
| 3354 | − break; | |
| 3355 | − case 3: | |
| 3356 | − list_add_tail(&wcd->rx_chs[port_id].list, | |
| 3357 | − &wcd->dai[AIF3_PB].slim_ch_list); | |
| 3378 | + aif_id = slim_rx_mux_to_dai_id(prev_mux_idx); | |
| 3379 | + if (aif_id < 0) | |
| 3380 | + return 0; | |
| 3381 | + | |
| 3382 | + list_for_each_entry_safe(ch, c, &wcd->dai[aif_id].slim_ch_list, list) { | |
| 3383 | + if (ch->port == port_id + WCD934X_RX_START) { | |
| 3384 | + found = true; | |
| 3385 | + list_del_init(&ch->list); | |
| 3386 | + break; | |
| 3387 | + } | |
| 3388 | + } | |
| 3389 | + if (!found) | |
| 3390 | + return 0; | |
| 3391 | + | |
| 3358 | 3392 | break; |
| 3359 | − case 4: | |
| 3360 | − list_add_tail(&wcd->rx_chs[port_id].list, | |
| 3361 | − &wcd->dai[AIF4_PB].slim_ch_list); | |
| 3393 | + case 1 ... 4: | |
| 3394 | + aif_id = slim_rx_mux_to_dai_id(mux_idx); | |
| 3395 | + if (aif_id < 0) | |
| 3396 | + return 0; | |
| 3397 | + | |
| 3398 | + if (list_empty(&wcd->rx_chs[port_id].list)) { | |
| 3399 | + list_add_tail(&wcd->rx_chs[port_id].list, | |
| 3400 | + &wcd->dai[aif_id].slim_ch_list); | |
| 3401 | + } else { | |
| 3402 | + dev_err(wcd->dev ,"SLIM_RX%d PORT is busy\n", port_id); | |
| 3403 | + return 0; | |
| 3404 | + } | |
| 3362 | 3405 | break; |
| 3406 | + | |
| 3363 | 3407 | default: |
| 3364 | − dev_err(wcd->dev, "Unknown AIF %d\n", | |
| 3365 | − wcd->rx_port_value[port_id]); | |
| 3408 | + dev_err(wcd->dev, "Unknown AIF %d\n", mux_idx); | |
| 3366 | 3409 | goto err; |
| 3367 | 3410 | } |
| 3368 | 3411 | |
| 3412 | + wcd->rx_port_value[port_id] = mux_idx; | |
| 3369 | 3413 | snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id], |
| 3370 | 3414 | e, update); |
| 3371 | 3415 | |
| 3372 | − return 0; | |
| 3416 | + return 1; | |
| 3373 | 3417 | err: |
| 3374 | 3418 | return -EINVAL; |
| 3375 | 3419 | } |
| @@ -3815,6 +3859,7 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc, · 439 unmodified lines | ||
| 3815 | 3859 | struct soc_mixer_control *mixer = |
| 3816 | 3860 | (struct soc_mixer_control *)kc->private_value; |
| 3817 | 3861 | int enable = ucontrol->value.integer.value[0]; |
| 3862 | + struct wcd934x_slim_ch *ch, *c; | |
| 3818 | 3863 | int dai_id = widget->shift; |
| 3819 | 3864 | int port_id = mixer->shift; |
| 3820 | 3865 | |
| @@ -3822,17 +3867,32 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc, · 1 unmodified line | ||
| 3822 | 3867 | if (enable == wcd->tx_port_value[port_id]) |
| 3823 | 3868 | return 0; |
| 3824 | 3869 | |
| 3825 | − wcd->tx_port_value[port_id] = enable; | |
| 3826 | − | |
| 3827 | − if (enable) | |
| 3828 | − list_add_tail(&wcd->tx_chs[port_id].list, | |
| 3829 | − &wcd->dai[dai_id].slim_ch_list); | |
| 3830 | − else | |
| 3831 | − list_del_init(&wcd->tx_chs[port_id].list); | |
| 3870 | + if (enable) { | |
| 3871 | + if (list_empty(&wcd->tx_chs[port_id].list)) { | |
| 3872 | + list_add_tail(&wcd->tx_chs[port_id].list, | |
| 3873 | + &wcd->dai[dai_id].slim_ch_list); | |
| 3874 | + } else { | |
| 3875 | + dev_err(wcd->dev ,"SLIM_TX%d PORT is busy\n", port_id); | |
| 3876 | + return 0; | |
| 3877 | + } | |
| 3878 | + } else { | |
| 3879 | + bool found = false; | |
| 3880 | + | |
| 3881 | + list_for_each_entry_safe(ch, c, &wcd->dai[dai_id].slim_ch_list, list) { | |
| 3882 | + if (ch->port == port_id) { | |
| 3883 | + found = true; | |
| 3884 | + list_del_init(&wcd->tx_chs[port_id].list); | |
| 3885 | + break; | |
| 3886 | + } | |
| 3887 | + } | |
| 3888 | + if (!found) | |
| 3889 | + return 0; | |
| 3890 | + } | |
| 3832 | 3891 | |
| 3892 | + wcd->tx_port_value[port_id] = enable; | |
| 3833 | 3893 | snd_soc_dapm_mixer_update_power(widget->dapm, kc, enable, update); |
| 3834 | 3894 | |
| 3835 | − return 0; | |
| 3895 | + return 1; | |
| 3836 | 3896 | } |
| 3837 | 3897 | |
| 3838 | 3898 | static const struct snd_kcontrol_new aif1_slim_cap_mixer[] = { |
| @@ -772,7 +772,8 @@ static int wsa881x_put_pa_gain(struct snd_kcontrol *kc, · 771 unmodified lines | ||
| 772 | 772 | |
| 773 | 773 | usleep_range(1000, 1010); |
| 774 | 774 | } |
| 775 | − return 0; | |
| 775 | + | |
| 776 | + return 1; | |
| 776 | 777 | } |
| 777 | 778 | |
| 778 | 779 | static int wsa881x_get_port(struct snd_kcontrol *kcontrol, |
| @@ -816,15 +817,22 @@ static int wsa881x_set_port(struct snd_kcontrol *kcontrol, · 37 unmodified lines | ||
| 816 | 817 | (struct soc_mixer_control *)kcontrol->private_value; |
| 817 | 818 | int portidx = mixer->reg; |
| 818 | 819 | |
| 819 | − if (ucontrol->value.integer.value[0]) | |
| 820 | + if (ucontrol->value.integer.value[0]) { | |
| 821 | + if (data->port_enable[portidx]) | |
| 822 | + return 0; | |
| 823 | + | |
| 820 | 824 | data->port_enable[portidx] = true; |
| 821 | − else | |
| 825 | + } else { | |
| 826 | + if (!data->port_enable[portidx]) | |
| 827 | + return 0; | |
| 828 | + | |
| 822 | 829 | data->port_enable[portidx] = false; |
| 830 | + } | |
| 823 | 831 | |
| 824 | 832 | if (portidx == WSA881X_PORT_BOOST) /* Boost Switch */ |
| 825 | 833 | wsa881x_boost_ctrl(comp, data->port_enable[portidx]); |
| 826 | 834 | |
| 827 | − return 0; | |
| 835 | + return 1; | |
| 828 | 836 | } |
| 829 | 837 | |
| 830 | 838 | static const char * const smart_boost_lvl_text[] = { |
| @@ -498,14 +498,16 @@ static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol, · 497 unmodified lines | ||
| 498 | 498 | struct session_data *session = &data->sessions[session_id]; |
| 499 | 499 | |
| 500 | 500 | if (ucontrol->value.integer.value[0]) { |
| 501 | + if (session->port_id == be_id) | |
| 502 | + return 0; | |
| 503 | + | |
| 501 | 504 | session->port_id = be_id; |
| 502 | 505 | snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update); |
| 503 | 506 | } else { |
| 504 | − if (session->port_id == be_id) { | |
| 505 | − session->port_id = -1; | |
| 507 | + if (session->port_id == -1 || session->port_id != be_id) | |
| 506 | 508 | return 0; |
| 507 | − } | |
| 508 | 509 | |
| 510 | + session->port_id = -1; | |
| 509 | 511 | snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update); |
| 510 | 512 | } |
| 511 | 513 | |
| @@ -95,6 +95,7 @@ struct rk_i2s_tdm_dev { · 94 unmodified lines | ||
| 95 | 95 | spinlock_t lock; /* xfer lock */ |
| 96 | 96 | bool has_playback; |
| 97 | 97 | bool has_capture; |
| 98 | + struct snd_soc_dai_driver *dai; | |
| 98 | 99 | }; |
| 99 | 100 | |
| 100 | 101 | static int to_ch_num(unsigned int val) |
| @@ -1310,19 +1311,14 @@ static const struct of_device_id rockchip_i2s_tdm_match[] = { · 1209 unmodified lines | ||
| 1310 | 1311 | {}, |
| 1311 | 1312 | }; |
| 1312 | 1313 | |
| 1313 | −static struct snd_soc_dai_driver i2s_tdm_dai = { | |
| 1314 | +static const struct snd_soc_dai_driver i2s_tdm_dai = { | |
| 1314 | 1315 | .probe = rockchip_i2s_tdm_dai_probe, |
| 1315 | − .playback = { | |
| 1316 | − .stream_name = "Playback", | |
| 1317 | − }, | |
| 1318 | − .capture = { | |
| 1319 | − .stream_name = "Capture", | |
| 1320 | − }, | |
| 1321 | 1316 | .ops = &rockchip_i2s_tdm_dai_ops, |
| 1322 | 1317 | }; |
| 1323 | 1318 | |
| 1324 | −static void rockchip_i2s_tdm_init_dai(struct rk_i2s_tdm_dev *i2s_tdm) | |
| 1319 | +static int rockchip_i2s_tdm_init_dai(struct rk_i2s_tdm_dev *i2s_tdm) | |
| 1325 | 1320 | { |
| 1321 | + struct snd_soc_dai_driver *dai; | |
| 1326 | 1322 | struct property *dma_names; |
| 1327 | 1323 | const char *dma_name; |
| 1328 | 1324 | u64 formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE | |
| @@ -1337,19 +1333,33 @@ static void rockchip_i2s_tdm_init_dai(struct rk_i2s_tdm_dev *i2s_tdm) · 8 unmodified lines | ||
| 1337 | 1333 | i2s_tdm->has_capture = true; |
| 1338 | 1334 | } |
| 1339 | 1335 | |
| 1336 | + dai = devm_kmemdup(i2s_tdm->dev, &i2s_tdm_dai, | |
| 1337 | + sizeof(*dai), GFP_KERNEL); | |
| 1338 | + if (!dai) | |
| 1339 | + return -ENOMEM; | |
| 1340 | + | |
| 1340 | 1341 | if (i2s_tdm->has_playback) { |
| 1341 | − i2s_tdm_dai.playback.channels_min = 2; | |
| 1342 | − i2s_tdm_dai.playback.channels_max = 8; | |
| 1343 | − i2s_tdm_dai.playback.rates = SNDRV_PCM_RATE_8000_192000; | |
| 1344 | − i2s_tdm_dai.playback.formats = formats; | |
| 1342 | + dai->playback.stream_name = "Playback"; | |
| 1343 | + dai->playback.channels_min = 2; | |
| 1344 | + dai->playback.channels_max = 8; | |
| 1345 | + dai->playback.rates = SNDRV_PCM_RATE_8000_192000; | |
| 1346 | + dai->playback.formats = formats; | |
| 1345 | 1347 | } |
| 1346 | 1348 | |
| 1347 | 1349 | if (i2s_tdm->has_capture) { |
| 1348 | − i2s_tdm_dai.capture.channels_min = 2; | |
| 1349 | − i2s_tdm_dai.capture.channels_max = 8; | |
| 1350 | − i2s_tdm_dai.capture.rates = SNDRV_PCM_RATE_8000_192000; | |
| 1351 | − i2s_tdm_dai.capture.formats = formats; | |
| 1350 | + dai->capture.stream_name = "Capture"; | |
| 1351 | + dai->capture.channels_min = 2; | |
| 1352 | + dai->capture.channels_max = 8; | |
| 1353 | + dai->capture.rates = SNDRV_PCM_RATE_8000_192000; | |
| 1354 | + dai->capture.formats = formats; | |
| 1352 | 1355 | } |
| 1356 | + | |
| 1357 | + if (i2s_tdm->clk_trcm != TRCM_TXRX) | |
| 1358 | + dai->symmetric_rate = 1; | |
| 1359 | + | |
| 1360 | + i2s_tdm->dai = dai; | |
| 1361 | + | |
| 1362 | + return 0; | |
| 1353 | 1363 | } |
| 1354 | 1364 | |
| 1355 | 1365 | static int rockchip_i2s_tdm_path_check(struct rk_i2s_tdm_dev *i2s_tdm, |
| @@ -1541,8 +1551,6 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) · 185 unmodified lines | ||
| 1541 | 1551 | spin_lock_init(&i2s_tdm->lock); |
| 1542 | 1552 | i2s_tdm->soc_data = (struct rk_i2s_soc_data *)of_id->data; |
| 1543 | 1553 | |
| 1544 | − rockchip_i2s_tdm_init_dai(i2s_tdm); | |
| 1545 | − | |
| 1546 | 1554 | i2s_tdm->frame_width = 64; |
| 1547 | 1555 | |
| 1548 | 1556 | i2s_tdm->clk_trcm = TRCM_TXRX; |
| @@ -1555,8 +1563,10 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) · 6 unmodified lines | ||
| 1555 | 1563 | } |
| 1556 | 1564 | i2s_tdm->clk_trcm = TRCM_RX; |
| 1557 | 1565 | } |
| 1558 | − if (i2s_tdm->clk_trcm != TRCM_TXRX) | |
| 1559 | − i2s_tdm_dai.symmetric_rate = 1; | |
| 1566 | + | |
| 1567 | + ret = rockchip_i2s_tdm_init_dai(i2s_tdm); | |
| 1568 | + if (ret) | |
| 1569 | + return ret; | |
| 1560 | 1570 | |
| 1561 | 1571 | i2s_tdm->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf"); |
| 1562 | 1572 | if (IS_ERR(i2s_tdm->grf)) |
| @@ -1678,7 +1688,7 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) · 115 unmodified lines | ||
| 1678 | 1688 | |
| 1679 | 1689 | ret = devm_snd_soc_register_component(&pdev->dev, |
| 1680 | 1690 | &rockchip_i2s_tdm_component, |
| 1681 | − &i2s_tdm_dai, 1); | |
| 1691 | + i2s_tdm->dai, 1); | |
| 1682 | 1692 | |
| 1683 | 1693 | if (ret) { |
| 1684 | 1694 | dev_err(&pdev->dev, "Could not register DAI\n"); |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | |
| 23 | 23 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC) |
| 24 | 24 | #define IDISP_VID_INTEL 0x80860000 |
| 25 | +#define CODEC_PROBE_RETRIES 3 | |
| 25 | 26 | |
| 26 | 27 | /* load the legacy HDA codec driver */ |
| 27 | 28 | static int request_codec_module(struct hda_codec *codec) |
| @@ -121,12 +122,15 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address, · 93 unmodified lines | ||
| 121 | 122 | u32 hda_cmd = (address << 28) | (AC_NODE_ROOT << 20) | |
| 122 | 123 | (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID; |
| 123 | 124 | u32 resp = -1; |
| 124 | − int ret; | |
| 125 | + int ret, retry = 0; | |
| 126 | + | |
| 127 | + do { | |
| 128 | + mutex_lock(&hbus->core.cmd_mutex); | |
| 129 | + snd_hdac_bus_send_cmd(&hbus->core, hda_cmd); | |
| 130 | + snd_hdac_bus_get_response(&hbus->core, address, &resp); | |
| 131 | + mutex_unlock(&hbus->core.cmd_mutex); | |
| 132 | + } while (resp == -1 && retry++ < CODEC_PROBE_RETRIES); | |
| 125 | 133 | |
| 126 | − mutex_lock(&hbus->core.cmd_mutex); | |
| 127 | − snd_hdac_bus_send_cmd(&hbus->core, hda_cmd); | |
| 128 | − snd_hdac_bus_get_response(&hbus->core, address, &resp); | |
| 129 | − mutex_unlock(&hbus->core.cmd_mutex); | |
| 130 | 134 | if (resp == -1) |
| 131 | 135 | return -EIO; |
| 132 | 136 | dev_dbg(sdev->dev, "HDA codec #%d probed OK: response: %x\n", |
| @@ -514,8 +514,8 @@ static int tegra210_adx_platform_remove(struct platform_device *pdev) · 513 unmodified lines | ||
| 514 | 514 | static const struct dev_pm_ops tegra210_adx_pm_ops = { |
| 515 | 515 | SET_RUNTIME_PM_OPS(tegra210_adx_runtime_suspend, |
| 516 | 516 | tegra210_adx_runtime_resume, NULL) |
| 517 | − SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 518 | − pm_runtime_force_resume) | |
| 517 | + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 518 | + pm_runtime_force_resume) | |
| 519 | 519 | }; |
| 520 | 520 | |
| 521 | 521 | static struct platform_driver tegra210_adx_driver = { |
| @@ -583,8 +583,8 @@ static int tegra210_amx_platform_remove(struct platform_device *pdev) · 582 unmodified lines | ||
| 583 | 583 | static const struct dev_pm_ops tegra210_amx_pm_ops = { |
| 584 | 584 | SET_RUNTIME_PM_OPS(tegra210_amx_runtime_suspend, |
| 585 | 585 | tegra210_amx_runtime_resume, NULL) |
| 586 | − SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 587 | − pm_runtime_force_resume) | |
| 586 | + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 587 | + pm_runtime_force_resume) | |
| 588 | 588 | }; |
| 589 | 589 | |
| 590 | 590 | static struct platform_driver tegra210_amx_driver = { |
| @@ -666,8 +666,8 @@ static int tegra210_mixer_platform_remove(struct platform_device *pdev) · 665 unmodified lines | ||
| 666 | 666 | static const struct dev_pm_ops tegra210_mixer_pm_ops = { |
| 667 | 667 | SET_RUNTIME_PM_OPS(tegra210_mixer_runtime_suspend, |
| 668 | 668 | tegra210_mixer_runtime_resume, NULL) |
| 669 | − SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 670 | − pm_runtime_force_resume) | |
| 669 | + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 670 | + pm_runtime_force_resume) | |
| 671 | 671 | }; |
| 672 | 672 | |
| 673 | 673 | static struct platform_driver tegra210_mixer_driver = { |
| @@ -164,7 +164,7 @@ static int tegra210_mvc_put_mute(struct snd_kcontrol *kcontrol, · 163 unmodified lines | ||
| 164 | 164 | if (err < 0) |
| 165 | 165 | goto end; |
| 166 | 166 | |
| 167 | − return 1; | |
| 167 | + err = 1; | |
| 168 | 168 | |
| 169 | 169 | end: |
| 170 | 170 | pm_runtime_put(cmpnt->dev); |
| @@ -236,7 +236,7 @@ static int tegra210_mvc_put_vol(struct snd_kcontrol *kcontrol, · 65 unmodified lines | ||
| 236 | 236 | TEGRA210_MVC_VOLUME_SWITCH_MASK, |
| 237 | 237 | TEGRA210_MVC_VOLUME_SWITCH_TRIGGER); |
| 238 | 238 | |
| 239 | − return 1; | |
| 239 | + err = 1; | |
| 240 | 240 | |
| 241 | 241 | end: |
| 242 | 242 | pm_runtime_put(cmpnt->dev); |
| @@ -639,8 +639,8 @@ static int tegra210_mvc_platform_remove(struct platform_device *pdev) · 396 unmodified lines | ||
| 639 | 639 | static const struct dev_pm_ops tegra210_mvc_pm_ops = { |
| 640 | 640 | SET_RUNTIME_PM_OPS(tegra210_mvc_runtime_suspend, |
| 641 | 641 | tegra210_mvc_runtime_resume, NULL) |
| 642 | − SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 643 | − pm_runtime_force_resume) | |
| 642 | + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 643 | + pm_runtime_force_resume) | |
| 644 | 644 | }; |
| 645 | 645 | |
| 646 | 646 | static struct platform_driver tegra210_mvc_driver = { |
| @@ -3594,8 +3594,8 @@ static int tegra210_sfc_platform_remove(struct platform_device *pdev) · 3593 unmodified lines | ||
| 3594 | 3594 | static const struct dev_pm_ops tegra210_sfc_pm_ops = { |
| 3595 | 3595 | SET_RUNTIME_PM_OPS(tegra210_sfc_runtime_suspend, |
| 3596 | 3596 | tegra210_sfc_runtime_resume, NULL) |
| 3597 | − SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 3598 | − pm_runtime_force_resume) | |
| 3597 | + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | |
| 3598 | + pm_runtime_force_resume) | |
| 3599 | 3599 | }; |
| 3600 | 3600 | |
| 3601 | 3601 | static struct platform_driver tegra210_sfc_driver = { |
| @@ -3016,11 +3016,11 @@ static const struct snd_djm_ctl snd_djm_ctls_750mk2[] = { · 3015 unmodified lines | ||
| 3016 | 3016 | |
| 3017 | 3017 | |
| 3018 | 3018 | static const struct snd_djm_device snd_djm_devices[] = { |
| 3019 | − SND_DJM_DEVICE(250mk2), | |
| 3020 | − SND_DJM_DEVICE(750), | |
| 3021 | − SND_DJM_DEVICE(750mk2), | |
| 3022 | − SND_DJM_DEVICE(850), | |
| 3023 | − SND_DJM_DEVICE(900nxs2) | |
| 3019 | + [SND_DJM_250MK2_IDX] = SND_DJM_DEVICE(250mk2), | |
| 3020 | + [SND_DJM_750_IDX] = SND_DJM_DEVICE(750), | |
| 3021 | + [SND_DJM_850_IDX] = SND_DJM_DEVICE(850), | |
| 3022 | + [SND_DJM_900NXS2_IDX] = SND_DJM_DEVICE(900nxs2), | |
| 3023 | + [SND_DJM_750MK2_IDX] = SND_DJM_DEVICE(750mk2), | |
| 3024 | 3024 | }; |
| 3025 | 3025 | |
| 3026 | 3026 | |
| @@ -44,13 +44,16 @@ struct perf_event_attr; · 43 unmodified lines | ||
| 44 | 44 | /* perf sample has 16 bits size limit */ |
| 45 | 45 | #define PERF_SAMPLE_MAX_SIZE (1 << 16) |
| 46 | 46 | |
| 47 | +/* number of register is bound by the number of bits in regs_dump::mask (64) */ | |
| 48 | +#define PERF_SAMPLE_REGS_CACHE_SIZE (8 * sizeof(u64)) | |
| 49 | + | |
| 47 | 50 | struct regs_dump { |
| 48 | 51 | u64 abi; |
| 49 | 52 | u64 mask; |
| 50 | 53 | u64 *regs; |
| 51 | 54 | |
| 52 | 55 | /* Cached values/mask filled by first register access. */ |
| 53 | − u64 cache_regs[PERF_REGS_MAX]; | |
| 56 | + u64 cache_regs[PERF_SAMPLE_REGS_CACHE_SIZE]; | |
| 54 | 57 | u64 cache_mask; |
| 55 | 58 | }; |
| 56 | 59 | |
| @@ -1205,61 +1205,69 @@ out_no_progress: · 1204 unmodified lines | ||
| 1205 | 1205 | |
| 1206 | 1206 | static bool intel_pt_fup_event(struct intel_pt_decoder *decoder) |
| 1207 | 1207 | { |
| 1208 | + enum intel_pt_sample_type type = decoder->state.type; | |
| 1208 | 1209 | bool ret = false; |
| 1209 | 1210 | |
| 1211 | + decoder->state.type &= ~INTEL_PT_BRANCH; | |
| 1212 | + | |
| 1210 | 1213 | if (decoder->set_fup_tx_flags) { |
| 1211 | 1214 | decoder->set_fup_tx_flags = false; |
| 1212 | 1215 | decoder->tx_flags = decoder->fup_tx_flags; |
| 1213 | − decoder->state.type = INTEL_PT_TRANSACTION; | |
| 1216 | + decoder->state.type |= INTEL_PT_TRANSACTION; | |
| 1214 | 1217 | if (decoder->fup_tx_flags & INTEL_PT_ABORT_TX) |
| 1215 | 1218 | decoder->state.type |= INTEL_PT_BRANCH; |
| 1216 | − decoder->state.from_ip = decoder->ip; | |
| 1217 | − decoder->state.to_ip = 0; | |
| 1218 | 1219 | decoder->state.flags = decoder->fup_tx_flags; |
| 1219 | − return true; | |
| 1220 | + ret = true; | |
| 1220 | 1221 | } |
| 1221 | 1222 | if (decoder->set_fup_ptw) { |
| 1222 | 1223 | decoder->set_fup_ptw = false; |
| 1223 | − decoder->state.type = INTEL_PT_PTW; | |
| 1224 | + decoder->state.type |= INTEL_PT_PTW; | |
| 1224 | 1225 | decoder->state.flags |= INTEL_PT_FUP_IP; |
| 1225 | − decoder->state.from_ip = decoder->ip; | |
| 1226 | − decoder->state.to_ip = 0; | |
| 1227 | 1226 | decoder->state.ptw_payload = decoder->fup_ptw_payload; |
| 1228 | − return true; | |
| 1227 | + ret = true; | |
| 1229 | 1228 | } |
| 1230 | 1229 | if (decoder->set_fup_mwait) { |
| 1231 | 1230 | decoder->set_fup_mwait = false; |
| 1232 | − decoder->state.type = INTEL_PT_MWAIT_OP; | |
| 1233 | − decoder->state.from_ip = decoder->ip; | |
| 1234 | − decoder->state.to_ip = 0; | |
| 1231 | + decoder->state.type |= INTEL_PT_MWAIT_OP; | |
| 1235 | 1232 | decoder->state.mwait_payload = decoder->fup_mwait_payload; |
| 1236 | 1233 | ret = true; |
| 1237 | 1234 | } |
| 1238 | 1235 | if (decoder->set_fup_pwre) { |
| 1239 | 1236 | decoder->set_fup_pwre = false; |
| 1240 | 1237 | decoder->state.type |= INTEL_PT_PWR_ENTRY; |
| 1241 | − decoder->state.type &= ~INTEL_PT_BRANCH; | |
| 1242 | − decoder->state.from_ip = decoder->ip; | |
| 1243 | − decoder->state.to_ip = 0; | |
| 1244 | 1238 | decoder->state.pwre_payload = decoder->fup_pwre_payload; |
| 1245 | 1239 | ret = true; |
| 1246 | 1240 | } |
| 1247 | 1241 | if (decoder->set_fup_exstop) { |
| 1248 | 1242 | decoder->set_fup_exstop = false; |
| 1249 | 1243 | decoder->state.type |= INTEL_PT_EX_STOP; |
| 1250 | − decoder->state.type &= ~INTEL_PT_BRANCH; | |
| 1251 | 1244 | decoder->state.flags |= INTEL_PT_FUP_IP; |
| 1252 | − decoder->state.from_ip = decoder->ip; | |
| 1253 | − decoder->state.to_ip = 0; | |
| 1254 | 1245 | ret = true; |
| 1255 | 1246 | } |
| 1256 | 1247 | if (decoder->set_fup_bep) { |
| 1257 | 1248 | decoder->set_fup_bep = false; |
| 1258 | 1249 | decoder->state.type |= INTEL_PT_BLK_ITEMS; |
| 1259 | − decoder->state.type &= ~INTEL_PT_BRANCH; | |
| 1250 | + ret = true; | |
| 1251 | + } | |
| 1252 | + if (decoder->overflow) { | |
| 1253 | + decoder->overflow = false; | |
| 1254 | + if (!ret && !decoder->pge) { | |
| 1255 | + if (decoder->hop) { | |
| 1256 | + decoder->state.type = 0; | |
| 1257 | + decoder->pkt_state = INTEL_PT_STATE_RESAMPLE; | |
| 1258 | + } | |
| 1259 | + decoder->pge = true; | |
| 1260 | + decoder->state.type |= INTEL_PT_BRANCH | INTEL_PT_TRACE_BEGIN; | |
| 1261 | + decoder->state.from_ip = 0; | |
| 1262 | + decoder->state.to_ip = decoder->ip; | |
| 1263 | + return true; | |
| 1264 | + } | |
| 1265 | + } | |
| 1266 | + if (ret) { | |
| 1260 | 1267 | decoder->state.from_ip = decoder->ip; |
| 1261 | 1268 | decoder->state.to_ip = 0; |
| 1262 | − ret = true; | |
| 1269 | + } else { | |
| 1270 | + decoder->state.type = type; | |
| 1263 | 1271 | } |
| 1264 | 1272 | return ret; |
| 1265 | 1273 | } |
| @@ -1608,7 +1616,16 @@ static int intel_pt_overflow(struct intel_pt_decoder *decoder) · 342 unmodified lines | ||
| 1608 | 1616 | intel_pt_clear_tx_flags(decoder); |
| 1609 | 1617 | intel_pt_set_nr(decoder); |
| 1610 | 1618 | decoder->timestamp_insn_cnt = 0; |
| 1611 | − decoder->pkt_state = INTEL_PT_STATE_ERR_RESYNC; | |
| 1619 | + decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; | |
| 1620 | + decoder->state.from_ip = decoder->ip; | |
| 1621 | + decoder->ip = 0; | |
| 1622 | + decoder->pge = false; | |
| 1623 | + decoder->set_fup_tx_flags = false; | |
| 1624 | + decoder->set_fup_ptw = false; | |
| 1625 | + decoder->set_fup_mwait = false; | |
| 1626 | + decoder->set_fup_pwre = false; | |
| 1627 | + decoder->set_fup_exstop = false; | |
| 1628 | + decoder->set_fup_bep = false; | |
| 1612 | 1629 | decoder->overflow = true; |
| 1613 | 1630 | return -EOVERFLOW; |
| 1614 | 1631 | } |
| @@ -2666,6 +2683,8 @@ static int intel_pt_scan_for_psb(struct intel_pt_decoder *decoder); · 1051 unmodified lines | ||
| 2666 | 2683 | /* Hop mode: Ignore TNT, do not walk code, but get ip from FUPs and TIPs */ |
| 2667 | 2684 | static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, int *err) |
| 2668 | 2685 | { |
| 2686 | + *err = 0; | |
| 2687 | + | |
| 2669 | 2688 | /* Leap from PSB to PSB, getting ip from FUP within PSB+ */ |
| 2670 | 2689 | if (decoder->leap && !decoder->in_psb && decoder->packet.type != INTEL_PT_PSB) { |
| 2671 | 2690 | *err = intel_pt_scan_for_psb(decoder); |
| @@ -2678,6 +2697,7 @@ static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, in · 6 unmodified lines | ||
| 2678 | 2697 | return HOP_IGNORE; |
| 2679 | 2698 | |
| 2680 | 2699 | case INTEL_PT_TIP_PGD: |
| 2700 | + decoder->pge = false; | |
| 2681 | 2701 | if (!decoder->packet.count) { |
| 2682 | 2702 | intel_pt_set_nr(decoder); |
| 2683 | 2703 | return HOP_IGNORE; |
| @@ -2705,18 +2725,21 @@ static int intel_pt_hop_trace(struct intel_pt_decoder *decoder, bool *no_tip, in · 21 unmodified lines | ||
| 2705 | 2725 | if (!decoder->packet.count) |
| 2706 | 2726 | return HOP_IGNORE; |
| 2707 | 2727 | intel_pt_set_ip(decoder); |
| 2708 | − if (intel_pt_fup_event(decoder)) | |
| 2709 | − return HOP_RETURN; | |
| 2710 | − if (!decoder->branch_enable) | |
| 2728 | + if (decoder->set_fup_mwait || decoder->set_fup_pwre) | |
| 2729 | + *no_tip = true; | |
| 2730 | + if (!decoder->branch_enable || !decoder->pge) | |
| 2711 | 2731 | *no_tip = true; |
| 2712 | 2732 | if (*no_tip) { |
| 2713 | 2733 | decoder->state.type = INTEL_PT_INSTRUCTION; |
| 2714 | 2734 | decoder->state.from_ip = decoder->ip; |
| 2715 | 2735 | decoder->state.to_ip = 0; |
| 2736 | + intel_pt_fup_event(decoder); | |
| 2716 | 2737 | return HOP_RETURN; |
| 2717 | 2738 | } |
| 2739 | + intel_pt_fup_event(decoder); | |
| 2740 | + decoder->state.type |= INTEL_PT_INSTRUCTION | INTEL_PT_BRANCH; | |
| 2718 | 2741 | *err = intel_pt_walk_fup_tip(decoder); |
| 2719 | − if (!*err) | |
| 2742 | + if (!*err && decoder->state.to_ip) | |
| 2720 | 2743 | decoder->pkt_state = INTEL_PT_STATE_RESAMPLE; |
| 2721 | 2744 | return HOP_RETURN; |
| 2722 | 2745 | |
| @@ -2897,7 +2920,7 @@ static bool intel_pt_psb_with_fup(struct intel_pt_decoder *decoder, int *err) · 174 unmodified lines | ||
| 2897 | 2920 | { |
| 2898 | 2921 | struct intel_pt_psb_info data = { .fup = false }; |
| 2899 | 2922 | |
| 2900 | − if (!decoder->branch_enable || !decoder->pge) | |
| 2923 | + if (!decoder->branch_enable) | |
| 2901 | 2924 | return false; |
| 2902 | 2925 | |
| 2903 | 2926 | intel_pt_pkt_lookahead(decoder, intel_pt_psb_lookahead_cb, &data); |
| @@ -2924,6 +2947,7 @@ static int intel_pt_walk_trace(struct intel_pt_decoder *decoder) · 20 unmodified lines | ||
| 2924 | 2947 | if (err) |
| 2925 | 2948 | return err; |
| 2926 | 2949 | next: |
| 2950 | + err = 0; | |
| 2927 | 2951 | if (decoder->cyc_threshold) { |
| 2928 | 2952 | if (decoder->sample_cyc && last_packet_type != INTEL_PT_CYC) |
| 2929 | 2953 | decoder->sample_cyc = false; |
| @@ -2962,6 +2986,7 @@ next: · 32 unmodified lines | ||
| 2962 | 2986 | |
| 2963 | 2987 | case INTEL_PT_TIP_PGE: { |
| 2964 | 2988 | decoder->pge = true; |
| 2989 | + decoder->overflow = false; | |
| 2965 | 2990 | intel_pt_mtc_cyc_cnt_pge(decoder); |
| 2966 | 2991 | intel_pt_set_nr(decoder); |
| 2967 | 2992 | if (decoder->packet.count == 0) { |
| @@ -2999,7 +3024,7 @@ next: · 31 unmodified lines | ||
| 2999 | 3024 | break; |
| 3000 | 3025 | } |
| 3001 | 3026 | intel_pt_set_last_ip(decoder); |
| 3002 | − if (!decoder->branch_enable) { | |
| 3027 | + if (!decoder->branch_enable || !decoder->pge) { | |
| 3003 | 3028 | decoder->ip = decoder->last_ip; |
| 3004 | 3029 | if (intel_pt_fup_event(decoder)) |
| 3005 | 3030 | return 0; |
| @@ -3467,10 +3492,10 @@ static int intel_pt_sync_ip(struct intel_pt_decoder *decoder) · 461 unmodified lines | ||
| 3467 | 3492 | decoder->set_fup_pwre = false; |
| 3468 | 3493 | decoder->set_fup_exstop = false; |
| 3469 | 3494 | decoder->set_fup_bep = false; |
| 3495 | + decoder->overflow = false; | |
| 3470 | 3496 | |
| 3471 | 3497 | if (!decoder->branch_enable) { |
| 3472 | 3498 | decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; |
| 3473 | − decoder->overflow = false; | |
| 3474 | 3499 | decoder->state.type = 0; /* Do not have a sample */ |
| 3475 | 3500 | return 0; |
| 3476 | 3501 | } |
| @@ -3485,7 +3510,6 @@ static int intel_pt_sync_ip(struct intel_pt_decoder *decoder) · 8 unmodified lines | ||
| 3485 | 3510 | decoder->pkt_state = INTEL_PT_STATE_RESAMPLE; |
| 3486 | 3511 | else |
| 3487 | 3512 | decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; |
| 3488 | − decoder->overflow = false; | |
| 3489 | 3513 | |
| 3490 | 3514 | decoder->state.from_ip = 0; |
| 3491 | 3515 | decoder->state.to_ip = decoder->ip; |
| @@ -3607,7 +3631,7 @@ static int intel_pt_sync(struct intel_pt_decoder *decoder) · 115 unmodified lines | ||
| 3607 | 3631 | } |
| 3608 | 3632 | |
| 3609 | 3633 | decoder->have_last_ip = true; |
| 3610 | − decoder->pkt_state = INTEL_PT_STATE_NO_IP; | |
| 3634 | + decoder->pkt_state = INTEL_PT_STATE_IN_SYNC; | |
| 3611 | 3635 | |
| 3612 | 3636 | err = intel_pt_walk_psb(decoder); |
| 3613 | 3637 | if (err) |
| @@ -3704,7 +3728,8 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder) · 90 unmodified lines | ||
| 3704 | 3728 | |
| 3705 | 3729 | if (err) { |
| 3706 | 3730 | decoder->state.err = intel_pt_ext_err(err); |
| 3707 | − decoder->state.from_ip = decoder->ip; | |
| 3731 | + if (err != -EOVERFLOW) | |
| 3732 | + decoder->state.from_ip = decoder->ip; | |
| 3708 | 3733 | intel_pt_update_sample_time(decoder); |
| 3709 | 3734 | decoder->sample_tot_cyc_cnt = decoder->tot_cyc_cnt; |
| 3710 | 3735 | intel_pt_set_nr(decoder); |
| @@ -2565,6 +2565,7 @@ static int intel_pt_run_decoder(struct intel_pt_queue *ptq, u64 *timestamp) · 2564 unmodified lines | ||
| 2565 | 2565 | ptq->sync_switch = false; |
| 2566 | 2566 | intel_pt_next_tid(pt, ptq); |
| 2567 | 2567 | } |
| 2568 | + ptq->timestamp = state->est_timestamp; | |
| 2568 | 2569 | if (pt->synth_opts.errors) { |
| 2569 | 2570 | err = intel_ptq_synth_error(ptq, state); |
| 2570 | 2571 | if (err) |
| @@ -25,6 +25,9 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) · 24 unmodified lines | ||
| 25 | 25 | int i, idx = 0; |
| 26 | 26 | u64 mask = regs->mask; |
| 27 | 27 | |
| 28 | + if ((u64)id >= PERF_SAMPLE_REGS_CACHE_SIZE) | |
| 29 | + return -EINVAL; | |
| 30 | + | |
| 28 | 31 | if (regs->cache_mask & (1ULL << id)) |
| 29 | 32 | goto out; |
| 30 | 33 | |
| @@ -461,7 +461,7 @@ get_tracepoint_field(struct pyrf_event *pevent, PyObject *attr_name) · 460 unmodified lines | ||
| 461 | 461 | struct tep_event *tp_format; |
| 462 | 462 | |
| 463 | 463 | tp_format = trace_event__tp_format_id(evsel->core.attr.config); |
| 464 | − if (!tp_format) | |
| 464 | + if (IS_ERR_OR_NULL(tp_format)) | |
| 465 | 465 | return NULL; |
| 466 | 466 | |
| 467 | 467 | evsel->tp_format = tp_format; |
| @@ -69,6 +69,7 @@ KERNEL_INCLUDE := $(OUTPUT)include · 68 unmodified lines | ||
| 69 | 69 | ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica |
| 70 | 70 | CFLAGS += -D_LINUX -I$(KERNEL_INCLUDE) -I$(ACPICA_INCLUDE) |
| 71 | 71 | CFLAGS += $(WARNINGS) |
| 72 | +MKDIR = mkdir | |
| 72 | 73 | |
| 73 | 74 | ifeq ($(strip $(V)),false) |
| 74 | 75 | QUIET=@ |
| @@ -21,6 +21,7 @@ $(KERNEL_INCLUDE): · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | $(objdir)%.o: %.c $(KERNEL_INCLUDE) |
| 23 | 23 | $(ECHO) " CC " $(subst $(OUTPUT),,$@) |
| 24 | + $(QUIET) $(MKDIR) -p $(objdir) 2>/dev/null | |
| 24 | 25 | $(QUIET) $(CC) -c $(CFLAGS) -o $@ $< |
| 25 | 26 | |
| 26 | 27 | all: $(OUTPUT)$(TOOL) |
| @@ -33,6 +33,22 @@ noinline int bpf_testmod_loop_test(int n) · 32 unmodified lines | ||
| 33 | 33 | return sum; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | +__weak noinline struct file *bpf_testmod_return_ptr(int arg) | |
| 37 | +{ | |
| 38 | + static struct file f = {}; | |
| 39 | + | |
| 40 | + switch (arg) { | |
| 41 | + case 1: return (void *)EINVAL; /* user addr */ | |
| 42 | + case 2: return (void *)0xcafe4a11; /* user addr */ | |
| 43 | + case 3: return (void *)-EINVAL; /* canonical, but invalid */ | |
| 44 | + case 4: return (void *)(1ull << 60); /* non-canonical and invalid */ | |
| 45 | + case 5: return (void *)~(1ull << 30); /* trigger extable */ | |
| 46 | + case 6: return &f; /* valid addr */ | |
| 47 | + case 7: return (void *)((long)&f | 1); /* kernel tricks */ | |
| 48 | + default: return NULL; | |
| 49 | + } | |
| 50 | +} | |
| 51 | + | |
| 36 | 52 | noinline ssize_t |
| 37 | 53 | bpf_testmod_test_read(struct file *file, struct kobject *kobj, |
| 38 | 54 | struct bin_attribute *bin_attr, |
| @@ -43,6 +59,10 @@ bpf_testmod_test_read(struct file *file, struct kobject *kobj, · 4 unmodified lines | ||
| 43 | 59 | .off = off, |
| 44 | 60 | .len = len, |
| 45 | 61 | }; |
| 62 | + int i = 1; | |
| 63 | + | |
| 64 | + while (bpf_testmod_return_ptr(i)) | |
| 65 | + i++; | |
| 46 | 66 | |
| 47 | 67 | /* This is always true. Use the check to make sure the compiler |
| 48 | 68 | * doesn't remove bpf_testmod_loop_test. |
| @@ -90,7 +90,7 @@ static void print_err_line(void) · 89 unmodified lines | ||
| 90 | 90 | |
| 91 | 91 | static void test_conn(void) |
| 92 | 92 | { |
| 93 | − int listen_fd = -1, cli_fd = -1, err; | |
| 93 | + int listen_fd = -1, cli_fd = -1, srv_fd = -1, err; | |
| 94 | 94 | socklen_t addrlen = sizeof(srv_sa6); |
| 95 | 95 | int srv_port; |
| 96 | 96 | |
| @@ -112,6 +112,10 @@ static void test_conn(void) · 15 unmodified lines | ||
| 112 | 112 | if (CHECK_FAIL(cli_fd == -1)) |
| 113 | 113 | goto done; |
| 114 | 114 | |
| 115 | + srv_fd = accept(listen_fd, NULL, NULL); | |
| 116 | + if (CHECK_FAIL(srv_fd == -1)) | |
| 117 | + goto done; | |
| 118 | + | |
| 115 | 119 | if (CHECK(skel->bss->listen_tp_sport != srv_port || |
| 116 | 120 | skel->bss->req_sk_sport != srv_port, |
| 117 | 121 | "Unexpected sk src port", |
| @@ -134,11 +138,13 @@ done: · 16 unmodified lines | ||
| 134 | 138 | close(listen_fd); |
| 135 | 139 | if (cli_fd != -1) |
| 136 | 140 | close(cli_fd); |
| 141 | + if (srv_fd != -1) | |
| 142 | + close(srv_fd); | |
| 137 | 143 | } |
| 138 | 144 | |
| 139 | 145 | static void test_syncookie(void) |
| 140 | 146 | { |
| 141 | − int listen_fd = -1, cli_fd = -1, err; | |
| 147 | + int listen_fd = -1, cli_fd = -1, srv_fd = -1, err; | |
| 142 | 148 | socklen_t addrlen = sizeof(srv_sa6); |
| 143 | 149 | int srv_port; |
| 144 | 150 | |
| @@ -161,6 +167,10 @@ static void test_syncookie(void) · 16 unmodified lines | ||
| 161 | 167 | if (CHECK_FAIL(cli_fd == -1)) |
| 162 | 168 | goto done; |
| 163 | 169 | |
| 170 | + srv_fd = accept(listen_fd, NULL, NULL); | |
| 171 | + if (CHECK_FAIL(srv_fd == -1)) | |
| 172 | + goto done; | |
| 173 | + | |
| 164 | 174 | if (CHECK(skel->bss->listen_tp_sport != srv_port, |
| 165 | 175 | "Unexpected tp src port", |
| 166 | 176 | "listen_tp_sport:%u expected:%u\n", |
| @@ -188,6 +198,8 @@ done: · 21 unmodified lines | ||
| 188 | 198 | close(listen_fd); |
| 189 | 199 | if (cli_fd != -1) |
| 190 | 200 | close(cli_fd); |
| 201 | + if (srv_fd != -1) | |
| 202 | + close(srv_fd); | |
| 191 | 203 | } |
| 192 | 204 | |
| 193 | 205 | struct test { |
| @@ -87,6 +87,18 @@ int BPF_PROG(handle_fexit, · 86 unmodified lines | ||
| 87 | 87 | return 0; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | +SEC("fexit/bpf_testmod_return_ptr") | |
| 91 | +int BPF_PROG(handle_fexit_ret, int arg, struct file *ret) | |
| 92 | +{ | |
| 93 | + long buf = 0; | |
| 94 | + | |
| 95 | + bpf_probe_read_kernel(&buf, 8, ret); | |
| 96 | + bpf_probe_read_kernel(&buf, 8, (char *)ret + 256); | |
| 97 | + *(volatile long long *)ret; | |
| 98 | + *(volatile int *)&ret->f_mode; | |
| 99 | + return 0; | |
| 100 | +} | |
| 101 | + | |
| 90 | 102 | __u32 fmod_ret_read_sz = 0; |
| 91 | 103 | |
| 92 | 104 | SEC("fmod_ret/bpf_testmod_test_read") |
| @@ -54,7 +54,7 @@ · 53 unmodified lines | ||
| 54 | 54 | #define MAX_INSNS BPF_MAXINSNS |
| 55 | 55 | #define MAX_TEST_INSNS 1000000 |
| 56 | 56 | #define MAX_FIXUPS 8 |
| 57 | −#define MAX_NR_MAPS 21 | |
| 57 | +#define MAX_NR_MAPS 22 | |
| 58 | 58 | #define MAX_TEST_RUNS 8 |
| 59 | 59 | #define POINTER_VALUE 0xcafe4all |
| 60 | 60 | #define TEST_DATA_LEN 64 |
| @@ -138,6 +138,8 @@ · 137 unmodified lines | ||
| 138 | 138 | BPF_EXIT_INSN(), |
| 139 | 139 | }, |
| 140 | 140 | .result = ACCEPT, |
| 141 | + .result_unpriv = REJECT, | |
| 142 | + .errstr_unpriv = "R0 leaks addr into mem", | |
| 141 | 143 | }, |
| 142 | 144 | { |
| 143 | 145 | "Dest pointer in r0 - succeed", |
| @@ -156,4 +158,88 @@ · 12 unmodified lines | ||
| 156 | 158 | BPF_EXIT_INSN(), |
| 157 | 159 | }, |
| 158 | 160 | .result = ACCEPT, |
| 161 | + .result_unpriv = REJECT, | |
| 162 | + .errstr_unpriv = "R0 leaks addr into mem", | |
| 163 | +}, | |
| 164 | +{ | |
| 165 | + "Dest pointer in r0 - succeed, check 2", | |
| 166 | + .insns = { | |
| 167 | + /* r0 = &val */ | |
| 168 | + BPF_MOV64_REG(BPF_REG_0, BPF_REG_10), | |
| 169 | + /* val = r0; */ | |
| 170 | + BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_0, -8), | |
| 171 | + /* r5 = &val */ | |
| 172 | + BPF_MOV64_REG(BPF_REG_5, BPF_REG_10), | |
| 173 | + /* r0 = atomic_cmpxchg(&val, r0, r5); */ | |
| 174 | + BPF_ATOMIC_OP(BPF_DW, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8), | |
| 175 | + /* r1 = *r0 */ | |
| 176 | + BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_0, -8), | |
| 177 | + /* exit(0); */ | |
| 178 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 179 | + BPF_EXIT_INSN(), | |
| 180 | + }, | |
| 181 | + .result = ACCEPT, | |
| 182 | + .result_unpriv = REJECT, | |
| 183 | + .errstr_unpriv = "R0 leaks addr into mem", | |
| 184 | +}, | |
| 185 | +{ | |
| 186 | + "Dest pointer in r0 - succeed, check 3", | |
| 187 | + .insns = { | |
| 188 | + /* r0 = &val */ | |
| 189 | + BPF_MOV64_REG(BPF_REG_0, BPF_REG_10), | |
| 190 | + /* val = r0; */ | |
| 191 | + BPF_STX_MEM(BPF_DW, BPF_REG_10, BPF_REG_0, -8), | |
| 192 | + /* r5 = &val */ | |
| 193 | + BPF_MOV64_REG(BPF_REG_5, BPF_REG_10), | |
| 194 | + /* r0 = atomic_cmpxchg(&val, r0, r5); */ | |
| 195 | + BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8), | |
| 196 | + /* exit(0); */ | |
| 197 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 198 | + BPF_EXIT_INSN(), | |
| 199 | + }, | |
| 200 | + .result = REJECT, | |
| 201 | + .errstr = "invalid size of register fill", | |
| 202 | + .errstr_unpriv = "R0 leaks addr into mem", | |
| 203 | +}, | |
| 204 | +{ | |
| 205 | + "Dest pointer in r0 - succeed, check 4", | |
| 206 | + .insns = { | |
| 207 | + /* r0 = &val */ | |
| 208 | + BPF_MOV32_REG(BPF_REG_0, BPF_REG_10), | |
| 209 | + /* val = r0; */ | |
| 210 | + BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -8), | |
| 211 | + /* r5 = &val */ | |
| 212 | + BPF_MOV32_REG(BPF_REG_5, BPF_REG_10), | |
| 213 | + /* r0 = atomic_cmpxchg(&val, r0, r5); */ | |
| 214 | + BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8), | |
| 215 | + /* r1 = *r10 */ | |
| 216 | + BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_10, -8), | |
| 217 | + /* exit(0); */ | |
| 218 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 219 | + BPF_EXIT_INSN(), | |
| 220 | + }, | |
| 221 | + .result = ACCEPT, | |
| 222 | + .result_unpriv = REJECT, | |
| 223 | + .errstr_unpriv = "R10 partial copy of pointer", | |
| 224 | +}, | |
| 225 | +{ | |
| 226 | + "Dest pointer in r0 - succeed, check 5", | |
| 227 | + .insns = { | |
| 228 | + /* r0 = &val */ | |
| 229 | + BPF_MOV32_REG(BPF_REG_0, BPF_REG_10), | |
| 230 | + /* val = r0; */ | |
| 231 | + BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -8), | |
| 232 | + /* r5 = &val */ | |
| 233 | + BPF_MOV32_REG(BPF_REG_5, BPF_REG_10), | |
| 234 | + /* r0 = atomic_cmpxchg(&val, r0, r5); */ | |
| 235 | + BPF_ATOMIC_OP(BPF_W, BPF_CMPXCHG, BPF_REG_10, BPF_REG_5, -8), | |
| 236 | + /* r1 = *r0 */ | |
| 237 | + BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, -8), | |
| 238 | + /* exit(0); */ | |
| 239 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 240 | + BPF_EXIT_INSN(), | |
| 241 | + }, | |
| 242 | + .result = REJECT, | |
| 243 | + .errstr = "R0 invalid mem access", | |
| 244 | + .errstr_unpriv = "R10 partial copy of pointer", | |
| 159 | 245 | }, |
| @@ -1,3 +1,97 @@ | ||
| 1 | +{ | |
| 2 | + "atomic dw/fetch and address leakage of (map ptr & -1) via stack slot", | |
| 3 | + .insns = { | |
| 4 | + BPF_LD_IMM64(BPF_REG_1, -1), | |
| 5 | + BPF_LD_MAP_FD(BPF_REG_8, 0), | |
| 6 | + BPF_LD_MAP_FD(BPF_REG_9, 0), | |
| 7 | + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | |
| 8 | + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | |
| 9 | + BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_9, 0), | |
| 10 | + BPF_ATOMIC_OP(BPF_DW, BPF_AND | BPF_FETCH, BPF_REG_2, BPF_REG_1, 0), | |
| 11 | + BPF_LDX_MEM(BPF_DW, BPF_REG_9, BPF_REG_2, 0), | |
| 12 | + BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0), | |
| 13 | + BPF_MOV64_REG(BPF_REG_1, BPF_REG_8), | |
| 14 | + BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem), | |
| 15 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | |
| 16 | + BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_9, 0), | |
| 17 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 18 | + BPF_EXIT_INSN(), | |
| 19 | + }, | |
| 20 | + .fixup_map_array_48b = { 2, 4 }, | |
| 21 | + .result = ACCEPT, | |
| 22 | + .result_unpriv = REJECT, | |
| 23 | + .errstr_unpriv = "leaking pointer from stack off -8", | |
| 24 | +}, | |
| 25 | +{ | |
| 26 | + "atomic dw/fetch and address leakage of (map ptr & -1) via returned value", | |
| 27 | + .insns = { | |
| 28 | + BPF_LD_IMM64(BPF_REG_1, -1), | |
| 29 | + BPF_LD_MAP_FD(BPF_REG_8, 0), | |
| 30 | + BPF_LD_MAP_FD(BPF_REG_9, 0), | |
| 31 | + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | |
| 32 | + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | |
| 33 | + BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_9, 0), | |
| 34 | + BPF_ATOMIC_OP(BPF_DW, BPF_AND | BPF_FETCH, BPF_REG_2, BPF_REG_1, 0), | |
| 35 | + BPF_MOV64_REG(BPF_REG_9, BPF_REG_1), | |
| 36 | + BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0), | |
| 37 | + BPF_MOV64_REG(BPF_REG_1, BPF_REG_8), | |
| 38 | + BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem), | |
| 39 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | |
| 40 | + BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_9, 0), | |
| 41 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 42 | + BPF_EXIT_INSN(), | |
| 43 | + }, | |
| 44 | + .fixup_map_array_48b = { 2, 4 }, | |
| 45 | + .result = ACCEPT, | |
| 46 | + .result_unpriv = REJECT, | |
| 47 | + .errstr_unpriv = "leaking pointer from stack off -8", | |
| 48 | +}, | |
| 49 | +{ | |
| 50 | + "atomic w/fetch and address leakage of (map ptr & -1) via stack slot", | |
| 51 | + .insns = { | |
| 52 | + BPF_LD_IMM64(BPF_REG_1, -1), | |
| 53 | + BPF_LD_MAP_FD(BPF_REG_8, 0), | |
| 54 | + BPF_LD_MAP_FD(BPF_REG_9, 0), | |
| 55 | + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | |
| 56 | + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | |
| 57 | + BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_9, 0), | |
| 58 | + BPF_ATOMIC_OP(BPF_W, BPF_AND | BPF_FETCH, BPF_REG_2, BPF_REG_1, 0), | |
| 59 | + BPF_LDX_MEM(BPF_DW, BPF_REG_9, BPF_REG_2, 0), | |
| 60 | + BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0), | |
| 61 | + BPF_MOV64_REG(BPF_REG_1, BPF_REG_8), | |
| 62 | + BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem), | |
| 63 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | |
| 64 | + BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_9, 0), | |
| 65 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 66 | + BPF_EXIT_INSN(), | |
| 67 | + }, | |
| 68 | + .fixup_map_array_48b = { 2, 4 }, | |
| 69 | + .result = REJECT, | |
| 70 | + .errstr = "invalid size of register fill", | |
| 71 | +}, | |
| 72 | +{ | |
| 73 | + "atomic w/fetch and address leakage of (map ptr & -1) via returned value", | |
| 74 | + .insns = { | |
| 75 | + BPF_LD_IMM64(BPF_REG_1, -1), | |
| 76 | + BPF_LD_MAP_FD(BPF_REG_8, 0), | |
| 77 | + BPF_LD_MAP_FD(BPF_REG_9, 0), | |
| 78 | + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | |
| 79 | + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | |
| 80 | + BPF_STX_MEM(BPF_DW, BPF_REG_2, BPF_REG_9, 0), | |
| 81 | + BPF_ATOMIC_OP(BPF_W, BPF_AND | BPF_FETCH, BPF_REG_2, BPF_REG_1, 0), | |
| 82 | + BPF_MOV64_REG(BPF_REG_9, BPF_REG_1), | |
| 83 | + BPF_ST_MEM(BPF_DW, BPF_REG_2, 0, 0), | |
| 84 | + BPF_MOV64_REG(BPF_REG_1, BPF_REG_8), | |
| 85 | + BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem), | |
| 86 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | |
| 87 | + BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_9, 0), | |
| 88 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 89 | + BPF_EXIT_INSN(), | |
| 90 | + }, | |
| 91 | + .fixup_map_array_48b = { 2, 4 }, | |
| 92 | + .result = REJECT, | |
| 93 | + .errstr = "invalid size of register fill", | |
| 94 | +}, | |
| 1 | 95 | #define __ATOMIC_FETCH_OP_TEST(src_reg, dst_reg, operand1, op, operand2, expect) \ |
| 2 | 96 | { \ |
| 3 | 97 | "atomic fetch " #op ", src=" #dst_reg " dst=" #dst_reg, \ |
| @@ -132,6 +132,77 @@ · 131 unmodified lines | ||
| 132 | 132 | .result = REJECT, |
| 133 | 133 | .prog_type = BPF_PROG_TYPE_TRACEPOINT, |
| 134 | 134 | }, |
| 135 | +{ | |
| 136 | + "precision tracking for u32 spill/fill", | |
| 137 | + .insns = { | |
| 138 | + BPF_MOV64_REG(BPF_REG_7, BPF_REG_1), | |
| 139 | + BPF_EMIT_CALL(BPF_FUNC_get_prandom_u32), | |
| 140 | + BPF_MOV32_IMM(BPF_REG_6, 32), | |
| 141 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | |
| 142 | + BPF_MOV32_IMM(BPF_REG_6, 4), | |
| 143 | + /* Additional insns to introduce a pruning point. */ | |
| 144 | + BPF_EMIT_CALL(BPF_FUNC_get_prandom_u32), | |
| 145 | + BPF_MOV64_IMM(BPF_REG_3, 0), | |
| 146 | + BPF_MOV64_IMM(BPF_REG_3, 0), | |
| 147 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | |
| 148 | + BPF_MOV64_IMM(BPF_REG_3, 0), | |
| 149 | + /* u32 spill/fill */ | |
| 150 | + BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_6, -8), | |
| 151 | + BPF_LDX_MEM(BPF_W, BPF_REG_8, BPF_REG_10, -8), | |
| 152 | + /* out-of-bound map value access for r6=32 */ | |
| 153 | + BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, 0), | |
| 154 | + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | |
| 155 | + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -16), | |
| 156 | + BPF_LD_MAP_FD(BPF_REG_1, 0), | |
| 157 | + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), | |
| 158 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 2), | |
| 159 | + BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_8), | |
| 160 | + BPF_LDX_MEM(BPF_W, BPF_REG_1, BPF_REG_0, 0), | |
| 161 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 162 | + BPF_EXIT_INSN(), | |
| 163 | + }, | |
| 164 | + .fixup_map_hash_8b = { 15 }, | |
| 165 | + .result = REJECT, | |
| 166 | + .errstr = "R0 min value is outside of the allowed memory range", | |
| 167 | + .prog_type = BPF_PROG_TYPE_TRACEPOINT, | |
| 168 | +}, | |
| 169 | +{ | |
| 170 | + "precision tracking for u32 spills, u64 fill", | |
| 171 | + .insns = { | |
| 172 | + BPF_EMIT_CALL(BPF_FUNC_get_prandom_u32), | |
| 173 | + BPF_MOV64_REG(BPF_REG_6, BPF_REG_0), | |
| 174 | + BPF_MOV32_IMM(BPF_REG_7, 0xffffffff), | |
| 175 | + /* Additional insns to introduce a pruning point. */ | |
| 176 | + BPF_MOV64_IMM(BPF_REG_3, 1), | |
| 177 | + BPF_MOV64_IMM(BPF_REG_3, 1), | |
| 178 | + BPF_MOV64_IMM(BPF_REG_3, 1), | |
| 179 | + BPF_MOV64_IMM(BPF_REG_3, 1), | |
| 180 | + BPF_EMIT_CALL(BPF_FUNC_get_prandom_u32), | |
| 181 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 1), | |
| 182 | + BPF_MOV64_IMM(BPF_REG_3, 1), | |
| 183 | + BPF_ALU32_IMM(BPF_DIV, BPF_REG_3, 0), | |
| 184 | + /* u32 spills, u64 fill */ | |
| 185 | + BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_6, -4), | |
| 186 | + BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_7, -8), | |
| 187 | + BPF_LDX_MEM(BPF_DW, BPF_REG_8, BPF_REG_10, -8), | |
| 188 | + /* if r8 != X goto pc+1 r8 known in fallthrough branch */ | |
| 189 | + BPF_JMP_IMM(BPF_JNE, BPF_REG_8, 0xffffffff, 1), | |
| 190 | + BPF_MOV64_IMM(BPF_REG_3, 1), | |
| 191 | + /* if r8 == X goto pc+1 condition always true on first | |
| 192 | + * traversal, so starts backtracking to mark r8 as requiring | |
| 193 | + * precision. r7 marked as needing precision. r6 not marked | |
| 194 | + * since it's not tracked. | |
| 195 | + */ | |
| 196 | + BPF_JMP_IMM(BPF_JEQ, BPF_REG_8, 0xffffffff, 1), | |
| 197 | + /* fails if r8 correctly marked unknown after fill. */ | |
| 198 | + BPF_ALU32_IMM(BPF_DIV, BPF_REG_3, 0), | |
| 199 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 200 | + BPF_EXIT_INSN(), | |
| 201 | + }, | |
| 202 | + .result = REJECT, | |
| 203 | + .errstr = "div by zero", | |
| 204 | + .prog_type = BPF_PROG_TYPE_TRACEPOINT, | |
| 205 | +}, | |
| 135 | 206 | { |
| 136 | 207 | "allocated_stack", |
| 137 | 208 | .insns = { |
| @@ -175,6 +175,38 @@ · 174 unmodified lines | ||
| 175 | 175 | .errstr = "invalid access to packet", |
| 176 | 176 | .prog_type = BPF_PROG_TYPE_SCHED_CLS, |
| 177 | 177 | }, |
| 178 | +{ | |
| 179 | + "Spill u32 const scalars. Refill as u64. Offset to skb->data", | |
| 180 | + .insns = { | |
| 181 | + BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, | |
| 182 | + offsetof(struct __sk_buff, data)), | |
| 183 | + BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, | |
| 184 | + offsetof(struct __sk_buff, data_end)), | |
| 185 | + /* r6 = 0 */ | |
| 186 | + BPF_MOV32_IMM(BPF_REG_6, 0), | |
| 187 | + /* r7 = 20 */ | |
| 188 | + BPF_MOV32_IMM(BPF_REG_7, 20), | |
| 189 | + /* *(u32 *)(r10 -4) = r6 */ | |
| 190 | + BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_6, -4), | |
| 191 | + /* *(u32 *)(r10 -8) = r7 */ | |
| 192 | + BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_7, -8), | |
| 193 | + /* r4 = *(u64 *)(r10 -8) */ | |
| 194 | + BPF_LDX_MEM(BPF_H, BPF_REG_4, BPF_REG_10, -8), | |
| 195 | + /* r0 = r2 */ | |
| 196 | + BPF_MOV64_REG(BPF_REG_0, BPF_REG_2), | |
| 197 | + /* r0 += r4 R0=pkt R2=pkt R3=pkt_end R4=inv,umax=65535 */ | |
| 198 | + BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_4), | |
| 199 | + /* if (r0 > r3) R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv,umax=65535 */ | |
| 200 | + BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_3, 1), | |
| 201 | + /* r0 = *(u32 *)r2 R0=pkt,umax=65535 R2=pkt R3=pkt_end R4=inv20 */ | |
| 202 | + BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_2, 0), | |
| 203 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 204 | + BPF_EXIT_INSN(), | |
| 205 | + }, | |
| 206 | + .result = REJECT, | |
| 207 | + .errstr = "invalid access to packet", | |
| 208 | + .prog_type = BPF_PROG_TYPE_SCHED_CLS, | |
| 209 | +}, | |
| 178 | 210 | { |
| 179 | 211 | "Spill a u32 const scalar. Refill as u16 from fp-6. Offset to skb->data", |
| 180 | 212 | .insns = { |
| @@ -1077,6 +1077,29 @@ · 1076 unmodified lines | ||
| 1077 | 1077 | .errstr = "R0 invalid mem access 'inv'", |
| 1078 | 1078 | .errstr_unpriv = "R0 pointer -= pointer prohibited", |
| 1079 | 1079 | }, |
| 1080 | +{ | |
| 1081 | + "map access: trying to leak tained dst reg", | |
| 1082 | + .insns = { | |
| 1083 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 1084 | + BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0), | |
| 1085 | + BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), | |
| 1086 | + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8), | |
| 1087 | + BPF_LD_MAP_FD(BPF_REG_1, 0), | |
| 1088 | + BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem), | |
| 1089 | + BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 0, 1), | |
| 1090 | + BPF_EXIT_INSN(), | |
| 1091 | + BPF_MOV64_REG(BPF_REG_2, BPF_REG_0), | |
| 1092 | + BPF_MOV32_IMM(BPF_REG_1, 0xFFFFFFFF), | |
| 1093 | + BPF_MOV32_REG(BPF_REG_1, BPF_REG_1), | |
| 1094 | + BPF_ALU64_REG(BPF_SUB, BPF_REG_2, BPF_REG_1), | |
| 1095 | + BPF_STX_MEM(BPF_DW, BPF_REG_0, BPF_REG_2, 0), | |
| 1096 | + BPF_MOV64_IMM(BPF_REG_0, 0), | |
| 1097 | + BPF_EXIT_INSN(), | |
| 1098 | + }, | |
| 1099 | + .fixup_map_array_48b = { 4 }, | |
| 1100 | + .result = REJECT, | |
| 1101 | + .errstr = "math between map_value pointer and 4294967295 is not allowed", | |
| 1102 | +}, | |
| 1080 | 1103 | { |
| 1081 | 1104 | "32bit pkt_ptr -= scalar", |
| 1082 | 1105 | .insns = { |
| @@ -0,0 +1,2 @@ | ||
| 1 | +# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | +huge_count_read_write | |
| @@ -1,7 +1,10 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | # Makefile for damon selftests |
| 3 | 3 | |
| 4 | −TEST_FILES = _chk_dependency.sh | |
| 5 | −TEST_PROGS = debugfs_attrs.sh | |
| 4 | +TEST_GEN_FILES += huge_count_read_write | |
| 5 | + | |
| 6 | +TEST_FILES = _chk_dependency.sh _debugfs_common.sh | |
| 7 | +TEST_PROGS = debugfs_attrs.sh debugfs_schemes.sh debugfs_target_ids.sh | |
| 8 | +TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh | |
| 6 | 9 | |
| 7 | 10 | include ../lib.mk |
| @@ -0,0 +1,52 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +# SPDX-License-Identifier: GPL-2.0 | |
| 3 | + | |
| 4 | +test_write_result() { | |
| 5 | + file=$1 | |
| 6 | + content=$2 | |
| 7 | + orig_content=$3 | |
| 8 | + expect_reason=$4 | |
| 9 | + expected=$5 | |
| 10 | + | |
| 11 | + echo "$content" > "$file" | |
| 12 | + if [ $? -ne "$expected" ] | |
| 13 | + then | |
| 14 | + echo "writing $content to $file doesn't return $expected" | |
| 15 | + echo "expected because: $expect_reason" | |
| 16 | + echo "$orig_content" > "$file" | |
| 17 | + exit 1 | |
| 18 | + fi | |
| 19 | +} | |
| 20 | + | |
| 21 | +test_write_succ() { | |
| 22 | + test_write_result "$1" "$2" "$3" "$4" 0 | |
| 23 | +} | |
| 24 | + | |
| 25 | +test_write_fail() { | |
| 26 | + test_write_result "$1" "$2" "$3" "$4" 1 | |
| 27 | +} | |
| 28 | + | |
| 29 | +test_content() { | |
| 30 | + file=$1 | |
| 31 | + orig_content=$2 | |
| 32 | + expected=$3 | |
| 33 | + expect_reason=$4 | |
| 34 | + | |
| 35 | + content=$(cat "$file") | |
| 36 | + if [ "$content" != "$expected" ] | |
| 37 | + then | |
| 38 | + echo "reading $file expected $expected but $content" | |
| 39 | + echo "expected because: $expect_reason" | |
| 40 | + echo "$orig_content" > "$file" | |
| 41 | + exit 1 | |
| 42 | + fi | |
| 43 | +} | |
| 44 | + | |
| 45 | +source ./_chk_dependency.sh | |
| 46 | + | |
| 47 | +damon_onoff="$DBGFS/monitor_on" | |
| 48 | +if [ $(cat "$damon_onoff") = "on" ] | |
| 49 | +then | |
| 50 | + echo "monitoring is on" | |
| 51 | + exit $ksft_skip | |
| 52 | +fi | |
| @@ -1,48 +1,7 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | 3 | |
| 4 | −test_write_result() { | |
| 5 | − file=$1 | |
| 6 | − content=$2 | |
| 7 | − orig_content=$3 | |
| 8 | − expect_reason=$4 | |
| 9 | − expected=$5 | |
| 10 | − | |
| 11 | − echo "$content" > "$file" | |
| 12 | − if [ $? -ne "$expected" ] | |
| 13 | − then | |
| 14 | − echo "writing $content to $file doesn't return $expected" | |
| 15 | − echo "expected because: $expect_reason" | |
| 16 | − echo "$orig_content" > "$file" | |
| 17 | − exit 1 | |
| 18 | − fi | |
| 19 | −} | |
| 20 | − | |
| 21 | −test_write_succ() { | |
| 22 | − test_write_result "$1" "$2" "$3" "$4" 0 | |
| 23 | −} | |
| 24 | − | |
| 25 | −test_write_fail() { | |
| 26 | − test_write_result "$1" "$2" "$3" "$4" 1 | |
| 27 | −} | |
| 28 | − | |
| 29 | −test_content() { | |
| 30 | − file=$1 | |
| 31 | − orig_content=$2 | |
| 32 | − expected=$3 | |
| 33 | − expect_reason=$4 | |
| 34 | − | |
| 35 | − content=$(cat "$file") | |
| 36 | − if [ "$content" != "$expected" ] | |
| 37 | − then | |
| 38 | − echo "reading $file expected $expected but $content" | |
| 39 | − echo "expected because: $expect_reason" | |
| 40 | − echo "$orig_content" > "$file" | |
| 41 | − exit 1 | |
| 42 | − fi | |
| 43 | −} | |
| 44 | − | |
| 45 | −source ./_chk_dependency.sh | |
| 4 | +source _debugfs_common.sh | |
| 46 | 5 | |
| 47 | 6 | # Test attrs file |
| 48 | 7 | # =============== |
| @@ -56,33 +15,3 @@ test_write_fail "$file" "1 2 3 5 4" "$orig_content" \ · 7 unmodified lines | ||
| 56 | 15 | "min_nr_regions > max_nr_regions" |
| 57 | 16 | test_content "$file" "$orig_content" "1 2 3 4 5" "successfully written" |
| 58 | 17 | echo "$orig_content" > "$file" |
| 59 | − | |
| 60 | −# Test schemes file | |
| 61 | −# ================= | |
| 62 | − | |
| 63 | −file="$DBGFS/schemes" | |
| 64 | −orig_content=$(cat "$file") | |
| 65 | − | |
| 66 | −test_write_succ "$file" "1 2 3 4 5 6 4 0 0 0 1 2 3 1 100 3 2 1" \ | |
| 67 | − "$orig_content" "valid input" | |
| 68 | −test_write_fail "$file" "1 2 | |
| 69 | −3 4 5 6 3 0 0 0 1 2 3 1 100 3 2 1" "$orig_content" "multi lines" | |
| 70 | −test_write_succ "$file" "" "$orig_content" "disabling" | |
| 71 | −echo "$orig_content" > "$file" | |
| 72 | − | |
| 73 | −# Test target_ids file | |
| 74 | −# ==================== | |
| 75 | − | |
| 76 | −file="$DBGFS/target_ids" | |
| 77 | −orig_content=$(cat "$file") | |
| 78 | − | |
| 79 | −test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input" | |
| 80 | −test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input" | |
| 81 | −test_content "$file" "$orig_content" "1 2" "non-integer was there" | |
| 82 | −test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input" | |
| 83 | −test_content "$file" "$orig_content" "" "wrong input written" | |
| 84 | −test_write_succ "$file" "" "$orig_content" "empty input" | |
| 85 | −test_content "$file" "$orig_content" "" "empty input written" | |
| 86 | −echo "$orig_content" > "$file" | |
| 87 | − | |
| 88 | −echo "PASS" | |
| @@ -0,0 +1,13 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +# SPDX-License-Identifier: GPL-2.0 | |
| 3 | + | |
| 4 | +source _debugfs_common.sh | |
| 5 | + | |
| 6 | +# Test empty targets case | |
| 7 | +# ======================= | |
| 8 | + | |
| 9 | +orig_target_ids=$(cat "$DBGFS/target_ids") | |
| 10 | +echo "" > "$DBGFS/target_ids" | |
| 11 | +orig_monitor_on=$(cat "$DBGFS/monitor_on") | |
| 12 | +test_write_fail "$DBGFS/monitor_on" "on" "orig_monitor_on" "empty target ids" | |
| 13 | +echo "$orig_target_ids" > "$DBGFS/target_ids" | |
| @@ -0,0 +1,22 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +# SPDX-License-Identifier: GPL-2.0 | |
| 3 | + | |
| 4 | +source _debugfs_common.sh | |
| 5 | + | |
| 6 | +# Test huge count read write | |
| 7 | +# ========================== | |
| 8 | + | |
| 9 | +dmesg -C | |
| 10 | + | |
| 11 | +for file in "$DBGFS/"* | |
| 12 | +do | |
| 13 | + ./huge_count_read_write "$file" | |
| 14 | +done | |
| 15 | + | |
| 16 | +if dmesg | grep -q WARNING | |
| 17 | +then | |
| 18 | + dmesg | |
| 19 | + exit 1 | |
| 20 | +else | |
| 21 | + exit 0 | |
| 22 | +fi | |
| @@ -0,0 +1,19 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +# SPDX-License-Identifier: GPL-2.0 | |
| 3 | + | |
| 4 | +source _debugfs_common.sh | |
| 5 | + | |
| 6 | +# Test schemes file | |
| 7 | +# ================= | |
| 8 | + | |
| 9 | +file="$DBGFS/schemes" | |
| 10 | +orig_content=$(cat "$file") | |
| 11 | + | |
| 12 | +test_write_succ "$file" "1 2 3 4 5 6 4 0 0 0 1 2 3 1 100 3 2 1" \ | |
| 13 | + "$orig_content" "valid input" | |
| 14 | +test_write_fail "$file" "1 2 | |
| 15 | +3 4 5 6 3 0 0 0 1 2 3 1 100 3 2 1" "$orig_content" "multi lines" | |
| 16 | +test_write_succ "$file" "" "$orig_content" "disabling" | |
| 17 | +test_write_fail "$file" "2 1 2 1 10 1 3 10 1 1 1 1 1 1 1 1 2 3" \ | |
| 18 | + "$orig_content" "wrong condition ranges" | |
| 19 | +echo "$orig_content" > "$file" | |
| @@ -0,0 +1,19 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +# SPDX-License-Identifier: GPL-2.0 | |
| 3 | + | |
| 4 | +source _debugfs_common.sh | |
| 5 | + | |
| 6 | +# Test target_ids file | |
| 7 | +# ==================== | |
| 8 | + | |
| 9 | +file="$DBGFS/target_ids" | |
| 10 | +orig_content=$(cat "$file") | |
| 11 | + | |
| 12 | +test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input" | |
| 13 | +test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input" | |
| 14 | +test_content "$file" "$orig_content" "1 2" "non-integer was there" | |
| 15 | +test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input" | |
| 16 | +test_content "$file" "$orig_content" "" "wrong input written" | |
| 17 | +test_write_succ "$file" "" "$orig_content" "empty input" | |
| 18 | +test_content "$file" "$orig_content" "" "empty input written" | |
| 19 | +echo "$orig_content" > "$file" | |
| @@ -0,0 +1,39 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | +/* | |
| 3 | + * Author: SeongJae Park <sj@kernel.org> | |
| 4 | + */ | |
| 5 | + | |
| 6 | +#include <fcntl.h> | |
| 7 | +#include <stdlib.h> | |
| 8 | +#include <unistd.h> | |
| 9 | +#include <stdio.h> | |
| 10 | + | |
| 11 | +void write_read_with_huge_count(char *file) | |
| 12 | +{ | |
| 13 | + int filedesc = open(file, O_RDWR); | |
| 14 | + char buf[25]; | |
| 15 | + int ret; | |
| 16 | + | |
| 17 | + printf("%s %s\n", __func__, file); | |
| 18 | + if (filedesc < 0) { | |
| 19 | + fprintf(stderr, "failed opening %s\n", file); | |
| 20 | + exit(1); | |
| 21 | + } | |
| 22 | + | |
| 23 | + write(filedesc, "", 0xfffffffful); | |
| 24 | + perror("after write: "); | |
| 25 | + ret = read(filedesc, buf, 0xfffffffful); | |
| 26 | + perror("after read: "); | |
| 27 | + close(filedesc); | |
| 28 | +} | |
| 29 | + | |
| 30 | +int main(int argc, char *argv[]) | |
| 31 | +{ | |
| 32 | + if (argc != 2) { | |
| 33 | + fprintf(stderr, "Usage: %s <file>\n", argv[0]); | |
| 34 | + exit(1); | |
| 35 | + } | |
| 36 | + write_read_with_huge_count(argv[1]); | |
| 37 | + | |
| 38 | + return 0; | |
| 39 | +} | |
| @@ -72,6 +72,35 @@ rif_mac_profile_replacement_test() · 71 unmodified lines | ||
| 72 | 72 | ip link set $h1.10 address $h1_10_mac |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | +rif_mac_profile_consolidation_test() | |
| 76 | +{ | |
| 77 | + local count=$1; shift | |
| 78 | + local h1_20_mac | |
| 79 | + | |
| 80 | + RET=0 | |
| 81 | + | |
| 82 | + if [[ $count -eq 1 ]]; then | |
| 83 | + return | |
| 84 | + fi | |
| 85 | + | |
| 86 | + h1_20_mac=$(mac_get $h1.20) | |
| 87 | + | |
| 88 | + # Set the MAC of $h1.20 to that of $h1.10 and confirm that they are | |
| 89 | + # using the same MAC profile. | |
| 90 | + ip link set $h1.20 address 00:11:11:11:11:11 | |
| 91 | + check_err $? | |
| 92 | + | |
| 93 | + occ=$(devlink -j resource show $DEVLINK_DEV \ | |
| 94 | + | jq '.[][][] | select(.name=="rif_mac_profiles") |.["occ"]') | |
| 95 | + | |
| 96 | + [[ $occ -eq $((count - 1)) ]] | |
| 97 | + check_err $? "MAC profile occupancy did not decrease" | |
| 98 | + | |
| 99 | + log_test "RIF MAC profile consolidation" | |
| 100 | + | |
| 101 | + ip link set $h1.20 address $h1_20_mac | |
| 102 | +} | |
| 103 | + | |
| 75 | 104 | rif_mac_profile_shared_replacement_test() |
| 76 | 105 | { |
| 77 | 106 | local count=$1; shift |
| @@ -104,6 +133,7 @@ rif_mac_profile_edit_test() · 26 unmodified lines | ||
| 104 | 133 | create_max_rif_mac_profiles $count |
| 105 | 134 | |
| 106 | 135 | rif_mac_profile_replacement_test |
| 136 | + rif_mac_profile_consolidation_test $count | |
| 107 | 137 | rif_mac_profile_shared_replacement_test $count |
| 108 | 138 | } |
| 109 | 139 | |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | /x86_64/svm_int_ctl_test |
| 31 | 31 | /x86_64/sync_regs_test |
| 32 | 32 | /x86_64/tsc_msrs_test |
| 33 | +/x86_64/userspace_io_test | |
| 33 | 34 | /x86_64/userspace_msr_exit_test |
| 34 | 35 | /x86_64/vmx_apic_access_test |
| 35 | 36 | /x86_64/vmx_close_while_nested_test |
| @@ -59,6 +59,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/vmx_preemption_timer_test · 58 unmodified lines | ||
| 59 | 59 | TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test |
| 60 | 60 | TEST_GEN_PROGS_x86_64 += x86_64/svm_int_ctl_test |
| 61 | 61 | TEST_GEN_PROGS_x86_64 += x86_64/sync_regs_test |
| 62 | +TEST_GEN_PROGS_x86_64 += x86_64/userspace_io_test | |
| 62 | 63 | TEST_GEN_PROGS_x86_64 += x86_64/userspace_msr_exit_test |
| 63 | 64 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_apic_access_test |
| 64 | 65 | TEST_GEN_PROGS_x86_64 += x86_64/vmx_close_while_nested_test |
| @@ -71,6 +71,15 @@ enum vm_guest_mode { · 70 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | #endif |
| 73 | 73 | |
| 74 | +#if defined(__x86_64__) | |
| 75 | +unsigned long vm_compute_max_gfn(struct kvm_vm *vm); | |
| 76 | +#else | |
| 77 | +static inline unsigned long vm_compute_max_gfn(struct kvm_vm *vm) | |
| 78 | +{ | |
| 79 | + return ((1ULL << vm->pa_bits) >> vm->page_shift) - 1; | |
| 80 | +} | |
| 81 | +#endif | |
| 82 | + | |
| 74 | 83 | #define MIN_PAGE_SIZE (1U << MIN_PAGE_SHIFT) |
| 75 | 84 | #define PTES_PER_MIN_PAGE ptes_per_page(MIN_PAGE_SIZE) |
| 76 | 85 | |
| @@ -302,7 +302,7 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) · 301 unmodified lines | ||
| 302 | 302 | (1ULL << (vm->va_bits - 1)) >> vm->page_shift); |
| 303 | 303 | |
| 304 | 304 | /* Limit physical addresses to PA-bits. */ |
| 305 | − vm->max_gfn = ((1ULL << vm->pa_bits) >> vm->page_shift) - 1; | |
| 305 | + vm->max_gfn = vm_compute_max_gfn(vm); | |
| 306 | 306 | |
| 307 | 307 | /* Allocate and setup memory for guest. */ |
| 308 | 308 | vm->vpages_mapped = sparsebit_alloc(); |
| @@ -1431,3 +1431,71 @@ struct kvm_cpuid2 *vcpu_get_supported_hv_cpuid(struct kvm_vm *vm, uint32_t vcpui · 1430 unmodified lines | ||
| 1431 | 1431 | |
| 1432 | 1432 | return cpuid; |
| 1433 | 1433 | } |
| 1434 | + | |
| 1435 | +#define X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx 0x68747541 | |
| 1436 | +#define X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx 0x444d4163 | |
| 1437 | +#define X86EMUL_CPUID_VENDOR_AuthenticAMD_edx 0x69746e65 | |
| 1438 | + | |
| 1439 | +static inline unsigned x86_family(unsigned int eax) | |
| 1440 | +{ | |
| 1441 | + unsigned int x86; | |
| 1442 | + | |
| 1443 | + x86 = (eax >> 8) & 0xf; | |
| 1444 | + | |
| 1445 | + if (x86 == 0xf) | |
| 1446 | + x86 += (eax >> 20) & 0xff; | |
| 1447 | + | |
| 1448 | + return x86; | |
| 1449 | +} | |
| 1450 | + | |
| 1451 | +unsigned long vm_compute_max_gfn(struct kvm_vm *vm) | |
| 1452 | +{ | |
| 1453 | + const unsigned long num_ht_pages = 12 << (30 - vm->page_shift); /* 12 GiB */ | |
| 1454 | + unsigned long ht_gfn, max_gfn, max_pfn; | |
| 1455 | + uint32_t eax, ebx, ecx, edx, max_ext_leaf; | |
| 1456 | + | |
| 1457 | + max_gfn = (1ULL << (vm->pa_bits - vm->page_shift)) - 1; | |
| 1458 | + | |
| 1459 | + /* Avoid reserved HyperTransport region on AMD processors. */ | |
| 1460 | + eax = ecx = 0; | |
| 1461 | + cpuid(&eax, &ebx, &ecx, &edx); | |
| 1462 | + if (ebx != X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx || | |
| 1463 | + ecx != X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx || | |
| 1464 | + edx != X86EMUL_CPUID_VENDOR_AuthenticAMD_edx) | |
| 1465 | + return max_gfn; | |
| 1466 | + | |
| 1467 | + /* On parts with <40 physical address bits, the area is fully hidden */ | |
| 1468 | + if (vm->pa_bits < 40) | |
| 1469 | + return max_gfn; | |
| 1470 | + | |
| 1471 | + /* Before family 17h, the HyperTransport area is just below 1T. */ | |
| 1472 | + ht_gfn = (1 << 28) - num_ht_pages; | |
| 1473 | + eax = 1; | |
| 1474 | + cpuid(&eax, &ebx, &ecx, &edx); | |
| 1475 | + if (x86_family(eax) < 0x17) | |
| 1476 | + goto done; | |
| 1477 | + | |
| 1478 | + /* | |
| 1479 | + * Otherwise it's at the top of the physical address space, possibly | |
| 1480 | + * reduced due to SME by bits 11:6 of CPUID[0x8000001f].EBX. Use | |
| 1481 | + * the old conservative value if MAXPHYADDR is not enumerated. | |
| 1482 | + */ | |
| 1483 | + eax = 0x80000000; | |
| 1484 | + cpuid(&eax, &ebx, &ecx, &edx); | |
| 1485 | + max_ext_leaf = eax; | |
| 1486 | + if (max_ext_leaf < 0x80000008) | |
| 1487 | + goto done; | |
| 1488 | + | |
| 1489 | + eax = 0x80000008; | |
| 1490 | + cpuid(&eax, &ebx, &ecx, &edx); | |
| 1491 | + max_pfn = (1ULL << ((eax & 0xff) - vm->page_shift)) - 1; | |
| 1492 | + if (max_ext_leaf >= 0x8000001f) { | |
| 1493 | + eax = 0x8000001f; | |
| 1494 | + cpuid(&eax, &ebx, &ecx, &edx); | |
| 1495 | + max_pfn >>= (ebx >> 6) & 0x3f; | |
| 1496 | + } | |
| 1497 | + | |
| 1498 | + ht_gfn = max_pfn - num_ht_pages; | |
| 1499 | +done: | |
| 1500 | + return min(max_gfn, ht_gfn - 1); | |
| 1501 | +} | |
| @@ -75,7 +75,7 @@ static void l1_guest_code(struct svm_test_data *svm) · 74 unmodified lines | ||
| 75 | 75 | vmcb->control.int_ctl &= ~V_INTR_MASKING_MASK; |
| 76 | 76 | |
| 77 | 77 | /* No intercepts for real and virtual interrupts */ |
| 78 | − vmcb->control.intercept &= ~(1ULL << INTERCEPT_INTR | INTERCEPT_VINTR); | |
| 78 | + vmcb->control.intercept &= ~(BIT(INTERCEPT_INTR) | BIT(INTERCEPT_VINTR)); | |
| 79 | 79 | |
| 80 | 80 | /* Make a virtual interrupt VINTR_IRQ_NUMBER pending */ |
| 81 | 81 | vmcb->control.int_ctl |= V_IRQ_MASK | (0x1 << V_INTR_PRIO_SHIFT); |
| @@ -0,0 +1,114 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0 | |
| 2 | +#include <fcntl.h> | |
| 3 | +#include <stdio.h> | |
| 4 | +#include <stdlib.h> | |
| 5 | +#include <string.h> | |
| 6 | +#include <sys/ioctl.h> | |
| 7 | + | |
| 8 | +#include "test_util.h" | |
| 9 | + | |
| 10 | +#include "kvm_util.h" | |
| 11 | +#include "processor.h" | |
| 12 | + | |
| 13 | +#define VCPU_ID 1 | |
| 14 | + | |
| 15 | +static void guest_ins_port80(uint8_t *buffer, unsigned int count) | |
| 16 | +{ | |
| 17 | + unsigned long end; | |
| 18 | + | |
| 19 | + if (count == 2) | |
| 20 | + end = (unsigned long)buffer + 1; | |
| 21 | + else | |
| 22 | + end = (unsigned long)buffer + 8192; | |
| 23 | + | |
| 24 | + asm volatile("cld; rep; insb" : "+D"(buffer), "+c"(count) : "d"(0x80) : "memory"); | |
| 25 | + GUEST_ASSERT_1(count == 0, count); | |
| 26 | + GUEST_ASSERT_2((unsigned long)buffer == end, buffer, end); | |
| 27 | +} | |
| 28 | + | |
| 29 | +static void guest_code(void) | |
| 30 | +{ | |
| 31 | + uint8_t buffer[8192]; | |
| 32 | + int i; | |
| 33 | + | |
| 34 | + /* | |
| 35 | + * Special case tests. main() will adjust RCX 2 => 1 and 3 => 8192 to | |
| 36 | + * test that KVM doesn't explode when userspace modifies the "count" on | |
| 37 | + * a userspace I/O exit. KVM isn't required to play nice with the I/O | |
| 38 | + * itself as KVM doesn't support manipulating the count, it just needs | |
| 39 | + * to not explode or overflow a buffer. | |
| 40 | + */ | |
| 41 | + guest_ins_port80(buffer, 2); | |
| 42 | + guest_ins_port80(buffer, 3); | |
| 43 | + | |
| 44 | + /* Verify KVM fills the buffer correctly when not stuffing RCX. */ | |
| 45 | + memset(buffer, 0, sizeof(buffer)); | |
| 46 | + guest_ins_port80(buffer, 8192); | |
| 47 | + for (i = 0; i < 8192; i++) | |
| 48 | + GUEST_ASSERT_2(buffer[i] == 0xaa, i, buffer[i]); | |
| 49 | + | |
| 50 | + GUEST_DONE(); | |
| 51 | +} | |
| 52 | + | |
| 53 | +int main(int argc, char *argv[]) | |
| 54 | +{ | |
| 55 | + struct kvm_regs regs; | |
| 56 | + struct kvm_run *run; | |
| 57 | + struct kvm_vm *vm; | |
| 58 | + struct ucall uc; | |
| 59 | + int rc; | |
| 60 | + | |
| 61 | + /* Tell stdout not to buffer its content */ | |
| 62 | + setbuf(stdout, NULL); | |
| 63 | + | |
| 64 | + /* Create VM */ | |
| 65 | + vm = vm_create_default(VCPU_ID, 0, guest_code); | |
| 66 | + run = vcpu_state(vm, VCPU_ID); | |
| 67 | + | |
| 68 | + memset(®s, 0, sizeof(regs)); | |
| 69 | + | |
| 70 | + while (1) { | |
| 71 | + rc = _vcpu_run(vm, VCPU_ID); | |
| 72 | + | |
| 73 | + TEST_ASSERT(rc == 0, "vcpu_run failed: %d\n", rc); | |
| 74 | + TEST_ASSERT(run->exit_reason == KVM_EXIT_IO, | |
| 75 | + "Unexpected exit reason: %u (%s),\n", | |
| 76 | + run->exit_reason, | |
| 77 | + exit_reason_str(run->exit_reason)); | |
| 78 | + | |
| 79 | + if (get_ucall(vm, VCPU_ID, &uc)) | |
| 80 | + break; | |
| 81 | + | |
| 82 | + TEST_ASSERT(run->io.port == 0x80, | |
| 83 | + "Expected I/O at port 0x80, got port 0x%x\n", run->io.port); | |
| 84 | + | |
| 85 | + /* | |
| 86 | + * Modify the rep string count in RCX: 2 => 1 and 3 => 8192. | |
| 87 | + * Note, this abuses KVM's batching of rep string I/O to avoid | |
| 88 | + * getting stuck in an infinite loop. That behavior isn't in | |
| 89 | + * scope from a testing perspective as it's not ABI in any way, | |
| 90 | + * i.e. it really is abusing internal KVM knowledge. | |
| 91 | + */ | |
| 92 | + vcpu_regs_get(vm, VCPU_ID, ®s); | |
| 93 | + if (regs.rcx == 2) | |
| 94 | + regs.rcx = 1; | |
| 95 | + if (regs.rcx == 3) | |
| 96 | + regs.rcx = 8192; | |
| 97 | + memset((void *)run + run->io.data_offset, 0xaa, 4096); | |
| 98 | + vcpu_regs_set(vm, VCPU_ID, ®s); | |
| 99 | + } | |
| 100 | + | |
| 101 | + switch (uc.cmd) { | |
| 102 | + case UCALL_DONE: | |
| 103 | + break; | |
| 104 | + case UCALL_ABORT: | |
| 105 | + TEST_FAIL("%s at %s:%ld : argN+1 = 0x%lx, argN+2 = 0x%lx", | |
| 106 | + (const char *)uc.args[0], __FILE__, uc.args[1], | |
| 107 | + uc.args[2], uc.args[3]); | |
| 108 | + default: | |
| 109 | + TEST_FAIL("Unknown ucall %lu", uc.cmd); | |
| 110 | + } | |
| 111 | + | |
| 112 | + kvm_vm_free(vm); | |
| 113 | + return 0; | |
| 114 | +} | |
| @@ -462,6 +462,22 @@ cleanup() · 461 unmodified lines | ||
| 462 | 462 | ip netns del ${NSC} >/dev/null 2>&1 |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | +cleanup_vrf_dup() | |
| 466 | +{ | |
| 467 | + ip link del ${NSA_DEV2} >/dev/null 2>&1 | |
| 468 | + ip netns pids ${NSC} | xargs kill 2>/dev/null | |
| 469 | + ip netns del ${NSC} >/dev/null 2>&1 | |
| 470 | +} | |
| 471 | + | |
| 472 | +setup_vrf_dup() | |
| 473 | +{ | |
| 474 | + # some VRF tests use ns-C which has the same config as | |
| 475 | + # ns-B but for a device NOT in the VRF | |
| 476 | + create_ns ${NSC} "-" "-" | |
| 477 | + connect_ns ${NSA} ${NSA_DEV2} ${NSA_IP}/24 ${NSA_IP6}/64 \ | |
| 478 | + ${NSC} ${NSC_DEV} ${NSB_IP}/24 ${NSB_IP6}/64 | |
| 479 | +} | |
| 480 | + | |
| 465 | 481 | setup() |
| 466 | 482 | { |
| 467 | 483 | local with_vrf=${1} |
| @@ -491,12 +507,6 @@ setup() · 23 unmodified lines | ||
| 491 | 507 | |
| 492 | 508 | ip -netns ${NSB} ro add ${VRF_IP}/32 via ${NSA_IP} dev ${NSB_DEV} |
| 493 | 509 | ip -netns ${NSB} -6 ro add ${VRF_IP6}/128 via ${NSA_IP6} dev ${NSB_DEV} |
| 494 | − | |
| 495 | − # some VRF tests use ns-C which has the same config as | |
| 496 | − # ns-B but for a device NOT in the VRF | |
| 497 | − create_ns ${NSC} "-" "-" | |
| 498 | − connect_ns ${NSA} ${NSA_DEV2} ${NSA_IP}/24 ${NSA_IP6}/64 \ | |
| 499 | − ${NSC} ${NSC_DEV} ${NSB_IP}/24 ${NSB_IP6}/64 | |
| 500 | 510 | else |
| 501 | 511 | ip -netns ${NSA} ro add ${NSB_LO_IP}/32 via ${NSB_IP} dev ${NSA_DEV} |
| 502 | 512 | ip -netns ${NSA} ro add ${NSB_LO_IP6}/128 via ${NSB_IP6} dev ${NSA_DEV} |
| @@ -1247,7 +1257,9 @@ ipv4_tcp_vrf() · 744 unmodified lines | ||
| 1247 | 1257 | log_test_addr ${a} $? 1 "Global server, local connection" |
| 1248 | 1258 | |
| 1249 | 1259 | # run MD5 tests |
| 1260 | + setup_vrf_dup | |
| 1250 | 1261 | ipv4_tcp_md5 |
| 1262 | + cleanup_vrf_dup | |
| 1251 | 1263 | |
| 1252 | 1264 | # |
| 1253 | 1265 | # enable VRF global server |
| @@ -1813,8 +1825,9 @@ ipv4_addr_bind_vrf() · 559 unmodified lines | ||
| 1813 | 1825 | for a in ${NSA_IP} ${VRF_IP} |
| 1814 | 1826 | do |
| 1815 | 1827 | log_start |
| 1828 | + show_hint "Socket not bound to VRF, but address is in VRF" | |
| 1816 | 1829 | run_cmd nettest -s -R -P icmp -l ${a} -b |
| 1817 | − log_test_addr ${a} $? 0 "Raw socket bind to local address" | |
| 1830 | + log_test_addr ${a} $? 1 "Raw socket bind to local address" | |
| 1818 | 1831 | |
| 1819 | 1832 | log_start |
| 1820 | 1833 | run_cmd nettest -s -R -P icmp -l ${a} -I ${NSA_DEV} -b |
| @@ -2215,7 +2228,7 @@ ipv6_ping_vrf() · 394 unmodified lines | ||
| 2215 | 2228 | log_start |
| 2216 | 2229 | show_hint "Fails since VRF device does not support linklocal or multicast" |
| 2217 | 2230 | run_cmd ${ping6} -c1 -w1 ${a} |
| 2218 | − log_test_addr ${a} $? 2 "ping out, VRF bind" | |
| 2231 | + log_test_addr ${a} $? 1 "ping out, VRF bind" | |
| 2219 | 2232 | done |
| 2220 | 2233 | |
| 2221 | 2234 | for a in ${NSB_IP6} ${NSB_LO_IP6} ${NSB_LINKIP6}%${NSA_DEV} ${MCAST}%${NSA_DEV} |
| @@ -2743,7 +2756,9 @@ ipv6_tcp_vrf() · 521 unmodified lines | ||
| 2743 | 2756 | log_test_addr ${a} $? 1 "Global server, local connection" |
| 2744 | 2757 | |
| 2745 | 2758 | # run MD5 tests |
| 2759 | + setup_vrf_dup | |
| 2746 | 2760 | ipv6_tcp_md5 |
| 2761 | + cleanup_vrf_dup | |
| 2747 | 2762 | |
| 2748 | 2763 | # |
| 2749 | 2764 | # enable VRF global server |
| @@ -3446,11 +3461,14 @@ ipv6_addr_bind_novrf() · 696 unmodified lines | ||
| 3446 | 3461 | run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b |
| 3447 | 3462 | log_test_addr ${a} $? 0 "TCP socket bind to local address after device bind" |
| 3448 | 3463 | |
| 3464 | + # Sadly, the kernel allows binding a socket to a device and then | |
| 3465 | + # binding to an address not on the device. So this test passes | |
| 3466 | + # when it really should not | |
| 3449 | 3467 | a=${NSA_LO_IP6} |
| 3450 | 3468 | log_start |
| 3451 | − show_hint "Should fail with 'Cannot assign requested address'" | |
| 3469 | + show_hint "Tecnically should fail since address is not on device but kernel allows" | |
| 3452 | 3470 | run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b |
| 3453 | − log_test_addr ${a} $? 1 "TCP socket bind to out of scope local address" | |
| 3471 | + log_test_addr ${a} $? 0 "TCP socket bind to out of scope local address" | |
| 3454 | 3472 | } |
| 3455 | 3473 | |
| 3456 | 3474 | ipv6_addr_bind_vrf() |
| @@ -3499,10 +3517,15 @@ ipv6_addr_bind_vrf() · 42 unmodified lines | ||
| 3499 | 3517 | run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b |
| 3500 | 3518 | log_test_addr ${a} $? 0 "TCP socket bind to local address with device bind" |
| 3501 | 3519 | |
| 3520 | + # Sadly, the kernel allows binding a socket to a device and then | |
| 3521 | + # binding to an address not on the device. The only restriction | |
| 3522 | + # is that the address is valid in the L3 domain. So this test | |
| 3523 | + # passes when it really should not | |
| 3502 | 3524 | a=${VRF_IP6} |
| 3503 | 3525 | log_start |
| 3526 | + show_hint "Tecnically should fail since address is not on device but kernel allows" | |
| 3504 | 3527 | run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b |
| 3505 | − log_test_addr ${a} $? 1 "TCP socket bind to VRF address with device bind" | |
| 3528 | + log_test_addr ${a} $? 0 "TCP socket bind to VRF address with device bind" | |
| 3506 | 3529 | |
| 3507 | 3530 | a=${NSA_LO_IP6} |
| 3508 | 3531 | log_start |
| @@ -13,6 +13,8 @@ NETIFS[p5]=veth4 · 12 unmodified lines | ||
| 13 | 13 | NETIFS[p6]=veth5 |
| 14 | 14 | NETIFS[p7]=veth6 |
| 15 | 15 | NETIFS[p8]=veth7 |
| 16 | +NETIFS[p9]=veth8 | |
| 17 | +NETIFS[p10]=veth9 | |
| 16 | 18 | |
| 17 | 19 | # Port that does not have a cable connected. |
| 18 | 20 | NETIF_NO_CABLE=eth8 |
| @@ -311,7 +311,7 @@ check_exception() · 310 unmodified lines | ||
| 311 | 311 | ip -netns h1 ro get ${H1_VRF_ARG} ${H2_N2_IP} | \ |
| 312 | 312 | grep -E -v 'mtu|redirected' | grep -q "cache" |
| 313 | 313 | fi |
| 314 | − log_test $? 0 "IPv4: ${desc}" | |
| 314 | + log_test $? 0 "IPv4: ${desc}" 0 | |
| 315 | 315 | |
| 316 | 316 | # No PMTU info for test "redirect" and "mtu exception plus redirect" |
| 317 | 317 | if [ "$with_redirect" = "yes" ] && [ "$desc" != "redirect exception plus mtu" ]; then |
| @@ -498,7 +498,7 @@ static void parse_opts(int argc, char **argv) · 497 unmodified lines | ||
| 498 | 498 | bool have_toeplitz = false; |
| 499 | 499 | int index, c; |
| 500 | 500 | |
| 501 | − while ((c = getopt_long(argc, argv, "46C:d:i:k:r:stT:u:v", long_options, &index)) != -1) { | |
| 501 | + while ((c = getopt_long(argc, argv, "46C:d:i:k:r:stT:uv", long_options, &index)) != -1) { | |
| 502 | 502 | switch (c) { |
| 503 | 503 | case '4': |
| 504 | 504 | cfg_family = AF_INET; |