We want the char/misc fixes in here as well.
Unified · Split
| @@ -111,6 +111,7 @@ ForEachMacros: · 110 unmodified lines | |||
| 111 | - 'css_for_each_descendant_pre' | 111 | - 'css_for_each_descendant_pre' |
| 112 | - 'device_for_each_child_node' | 112 | - 'device_for_each_child_node' |
| 113 | - 'dma_fence_chain_for_each' | 113 | - 'dma_fence_chain_for_each' |
| 114 | - 'do_for_each_ftrace_op' | ||
| 114 | - 'drm_atomic_crtc_for_each_plane' | 115 | - 'drm_atomic_crtc_for_each_plane' |
| 115 | - 'drm_atomic_crtc_state_for_each_plane' | 116 | - 'drm_atomic_crtc_state_for_each_plane' |
| 116 | - 'drm_atomic_crtc_state_for_each_plane_state' | 117 | - 'drm_atomic_crtc_state_for_each_plane_state' |
| @@ -136,6 +137,7 @@ ForEachMacros: · 19 unmodified lines | |||
| 136 | - 'for_each_active_dev_scope' | 137 | - 'for_each_active_dev_scope' |
| 137 | - 'for_each_active_drhd_unit' | 138 | - 'for_each_active_drhd_unit' |
| 138 | - 'for_each_active_iommu' | 139 | - 'for_each_active_iommu' |
| 140 | - 'for_each_aggr_pgid' | ||
| 139 | - 'for_each_available_child_of_node' | 141 | - 'for_each_available_child_of_node' |
| 140 | - 'for_each_bio' | 142 | - 'for_each_bio' |
| 141 | - 'for_each_board_func_rsrc' | 143 | - 'for_each_board_func_rsrc' |
| @@ -234,6 +236,7 @@ ForEachMacros: · 92 unmodified lines | |||
| 234 | - 'for_each_node_state' | 236 | - 'for_each_node_state' |
| 235 | - 'for_each_node_with_cpus' | 237 | - 'for_each_node_with_cpus' |
| 236 | - 'for_each_node_with_property' | 238 | - 'for_each_node_with_property' |
| 239 | - 'for_each_nonreserved_multicast_dest_pgid' | ||
| 237 | - 'for_each_of_allnodes' | 240 | - 'for_each_of_allnodes' |
| 238 | - 'for_each_of_allnodes_from' | 241 | - 'for_each_of_allnodes_from' |
| 239 | - 'for_each_of_cpu_node' | 242 | - 'for_each_of_cpu_node' |
| @@ -256,6 +259,7 @@ ForEachMacros: · 16 unmodified lines | |||
| 256 | - 'for_each_pci_dev' | 259 | - 'for_each_pci_dev' |
| 257 | - 'for_each_pci_msi_entry' | 260 | - 'for_each_pci_msi_entry' |
| 258 | - 'for_each_pcm_streams' | 261 | - 'for_each_pcm_streams' |
| 262 | - 'for_each_physmem_range' | ||
| 259 | - 'for_each_populated_zone' | 263 | - 'for_each_populated_zone' |
| 260 | - 'for_each_possible_cpu' | 264 | - 'for_each_possible_cpu' |
| 261 | - 'for_each_present_cpu' | 265 | - 'for_each_present_cpu' |
| @@ -265,6 +269,8 @@ ForEachMacros: · 3 unmodified lines | |||
| 265 | - 'for_each_process_thread' | 269 | - 'for_each_process_thread' |
| 266 | - 'for_each_property_of_node' | 270 | - 'for_each_property_of_node' |
| 267 | - 'for_each_registered_fb' | 271 | - 'for_each_registered_fb' |
| 272 | - 'for_each_requested_gpio' | ||
| 273 | - 'for_each_requested_gpio_in_range' | ||
| 268 | - 'for_each_reserved_mem_region' | 274 | - 'for_each_reserved_mem_region' |
| 269 | - 'for_each_rtd_codec_dais' | 275 | - 'for_each_rtd_codec_dais' |
| 270 | - 'for_each_rtd_codec_dais_rollback' | 276 | - 'for_each_rtd_codec_dais_rollback' |
| @@ -278,12 +284,17 @@ ForEachMacros: · 7 unmodified lines | |||
| 278 | - 'for_each_sg' | 284 | - 'for_each_sg' |
| 279 | - 'for_each_sg_dma_page' | 285 | - 'for_each_sg_dma_page' |
| 280 | - 'for_each_sg_page' | 286 | - 'for_each_sg_page' |
| 287 | - 'for_each_sgtable_dma_page' | ||
| 288 | - 'for_each_sgtable_dma_sg' | ||
| 289 | - 'for_each_sgtable_page' | ||
| 290 | - 'for_each_sgtable_sg' | ||
| 281 | - 'for_each_sibling_event' | 291 | - 'for_each_sibling_event' |
| 282 | - 'for_each_subelement' | 292 | - 'for_each_subelement' |
| 283 | - 'for_each_subelement_extid' | 293 | - 'for_each_subelement_extid' |
| 284 | - 'for_each_subelement_id' | 294 | - 'for_each_subelement_id' |
| 285 | - '__for_each_thread' | 295 | - '__for_each_thread' |
| 286 | - 'for_each_thread' | 296 | - 'for_each_thread' |
| 297 | - 'for_each_unicast_dest_pgid' | ||
| 287 | - 'for_each_wakeup_source' | 298 | - 'for_each_wakeup_source' |
| 288 | - 'for_each_zone' | 299 | - 'for_each_zone' |
| 289 | - 'for_each_zone_zonelist' | 300 | - 'for_each_zone_zonelist' |
| @@ -464,6 +475,7 @@ ForEachMacros: · 174 unmodified lines | |||
| 464 | - 'v4l2_m2m_for_each_src_buf' | 475 | - 'v4l2_m2m_for_each_src_buf' |
| 465 | - 'v4l2_m2m_for_each_src_buf_safe' | 476 | - 'v4l2_m2m_for_each_src_buf_safe' |
| 466 | - 'virtio_device_for_each_vq' | 477 | - 'virtio_device_for_each_vq' |
| 478 | - 'while_for_each_ftrace_op' | ||
| 467 | - 'xa_for_each' | 479 | - 'xa_for_each' |
| 468 | - 'xa_for_each_marked' | 480 | - 'xa_for_each_marked' |
| 469 | - 'xa_for_each_range' | 481 | - 'xa_for_each_range' |
| @@ -308,6 +308,7 @@ Tony Luck <tony.luck@intel.com> · 307 unmodified lines | |||
| 308 | TripleX Chung <xxx.phy@gmail.com> <triplex@zh-kernel.org> | 308 | TripleX Chung <xxx.phy@gmail.com> <triplex@zh-kernel.org> |
| 309 | TripleX Chung <xxx.phy@gmail.com> <zhongyu@18mail.cn> | 309 | TripleX Chung <xxx.phy@gmail.com> <zhongyu@18mail.cn> |
| 310 | Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> | 310 | Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> |
| 311 | Tycho Andersen <tycho@tycho.pizza> <tycho@tycho.ws> | ||
| 311 | Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> | 312 | Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> |
| 312 | Uwe Kleine-König <ukl@pengutronix.de> | 313 | Uwe Kleine-König <ukl@pengutronix.de> |
| 313 | Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> | 314 | Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> |
| @@ -49,7 +49,7 @@ checking of rcu_dereference() primitives: · 48 unmodified lines | |||
| 49 | is invoked by both RCU-sched readers and updaters. | 49 | is invoked by both RCU-sched readers and updaters. |
| 50 | srcu_dereference_check(p, c): | 50 | srcu_dereference_check(p, c): |
| 51 | Use explicit check expression "c" along with | 51 | Use explicit check expression "c" along with |
| 52 | srcu_read_lock_held()(). This is useful in code that | 52 | srcu_read_lock_held(). This is useful in code that |
| 53 | is invoked by both SRCU readers and updaters. | 53 | is invoked by both SRCU readers and updaters. |
| 54 | rcu_dereference_raw(p): | 54 | rcu_dereference_raw(p): |
| 55 | Don't check. (Use sparingly, if at all.) | 55 | Don't check. (Use sparingly, if at all.) |
| @@ -1662,7 +1662,7 @@ · 1661 unmodified lines | |||
| 1662 | 1662 | ||
| 1663 | 98 block User-mode virtual block device | 1663 | 98 block User-mode virtual block device |
| 1664 | 0 = /dev/ubda First user-mode block device | 1664 | 0 = /dev/ubda First user-mode block device |
| 1665 | 16 = /dev/udbb Second user-mode block device | 1665 | 16 = /dev/ubdb Second user-mode block device |
| 1666 | ... | 1666 | ... |
| 1667 | 1667 | ||
| 1668 | Partitions are handled in the same way as for IDE | 1668 | Partitions are handled in the same way as for IDE |
| @@ -156,7 +156,6 @@ against. Possible keywords are::: · 155 unmodified lines | |||
| 156 | ``line-range`` cannot contain space, e.g. | 156 | ``line-range`` cannot contain space, e.g. |
| 157 | "1-30" is valid range but "1 - 30" is not. | 157 | "1-30" is valid range but "1 - 30" is not. |
| 158 | 158 | ||
| 159 | ``module=foo`` combined keyword=value form is interchangably accepted | ||
| 160 | 159 | ||
| 161 | The meanings of each keyword are: | 160 | The meanings of each keyword are: |
| 162 | 161 | ||
| @@ -1434,7 +1434,7 @@ on the feature, restricting the viewing angles. · 1433 unmodified lines | |||
| 1434 | 1434 | ||
| 1435 | 1435 | ||
| 1436 | DYTC Lapmode sensor | 1436 | DYTC Lapmode sensor |
| 1437 | ------------------ | 1437 | ------------------- |
| 1438 | 1438 | ||
| 1439 | sysfs: dytc_lapmode | 1439 | sysfs: dytc_lapmode |
| 1440 | 1440 | ||
| @@ -123,7 +123,9 @@ Energy-Performance Bias (EPB) knob (otherwise), which means that the processor's · 122 unmodified lines | |||
| 123 | internal P-state selection logic is expected to focus entirely on performance. | 123 | internal P-state selection logic is expected to focus entirely on performance. |
| 124 | 124 | ||
| 125 | This will override the EPP/EPB setting coming from the ``sysfs`` interface | 125 | This will override the EPP/EPB setting coming from the ``sysfs`` interface |
| 126 | (see `Energy vs Performance Hints`_ below). | 126 | (see `Energy vs Performance Hints`_ below). Moreover, any attempts to change |
| 127 | the EPP/EPB to a value different from 0 ("performance") via ``sysfs`` in this | ||
| 128 | configuration will be rejected. | ||
| 127 | 129 | ||
| 128 | Also, in this configuration the range of P-states available to the processor's | 130 | Also, in this configuration the range of P-states available to the processor's |
| 129 | internal P-state selection logic is always restricted to the upper boundary | 131 | internal P-state selection logic is always restricted to the upper boundary |
| @@ -30,9 +30,13 @@ allOf: · 29 unmodified lines | |||
| 30 | then: | 30 | then: |
| 31 | properties: | 31 | properties: |
| 32 | clock-output-names: | 32 | clock-output-names: |
| 33 | items: | 33 | oneOf: |
| 34 | - const: clk_out_sd0 | 34 | - items: |
| 35 | - const: clk_in_sd0 | 35 | - const: clk_out_sd0 |
| 36 | - const: clk_in_sd0 | ||
| 37 | - items: | ||
| 38 | - const: clk_out_sd1 | ||
| 39 | - const: clk_in_sd1 | ||
| 36 | 40 | ||
| 37 | properties: | 41 | properties: |
| 38 | compatible: | 42 | compatible: |
| @@ -50,6 +50,8 @@ Optional properties: · 49 unmodified lines | |||
| 50 | error caused by stop clock(fifo full) | 50 | error caused by stop clock(fifo full) |
| 51 | Valid range = [0:0x7]. if not present, default value is 0. | 51 | Valid range = [0:0x7]. if not present, default value is 0. |
| 52 | applied to compatible "mediatek,mt2701-mmc". | 52 | applied to compatible "mediatek,mt2701-mmc". |
| 53 | - resets: Phandle and reset specifier pair to softreset line of MSDC IP. | ||
| 54 | - reset-names: Should be "hrst". | ||
| 53 | 55 | ||
| 54 | Examples: | 56 | Examples: |
| 55 | mmc0: mmc@11230000 { | 57 | mmc0: mmc@11230000 { |
| @@ -15,8 +15,15 @@ Required properties: · 14 unmodified lines | |||
| 15 | - "nvidia,tegra210-sdhci": for Tegra210 | 15 | - "nvidia,tegra210-sdhci": for Tegra210 |
| 16 | - "nvidia,tegra186-sdhci": for Tegra186 | 16 | - "nvidia,tegra186-sdhci": for Tegra186 |
| 17 | - "nvidia,tegra194-sdhci": for Tegra194 | 17 | - "nvidia,tegra194-sdhci": for Tegra194 |
| 18 | - clocks : Must contain one entry, for the module clock. | 18 | - clocks: For Tegra210, Tegra186 and Tegra194 must contain two entries. |
| 19 | See ../clocks/clock-bindings.txt for details. | 19 | One for the module clock and one for the timeout clock. |
| 20 | For all other Tegra devices, must contain a single entry for | ||
| 21 | the module clock. See ../clocks/clock-bindings.txt for details. | ||
| 22 | - clock-names: For Tegra210, Tegra186 and Tegra194 must contain the | ||
| 23 | strings 'sdhci' and 'tmclk' to represent the module and | ||
| 24 | the timeout clocks, respectively. | ||
| 25 | For all other Tegra devices must contain the string 'sdhci' | ||
| 26 | to represent the module clock. | ||
| 20 | - resets : Must contain an entry for each entry in reset-names. | 27 | - resets : Must contain an entry for each entry in reset-names. |
| 21 | See ../reset/reset.txt for details. | 28 | See ../reset/reset.txt for details. |
| 22 | - reset-names : Must include the following entries: | 29 | - reset-names : Must include the following entries: |
| @@ -99,7 +106,7 @@ Optional properties for Tegra210, Tegra186 and Tegra194: · 76 unmodified lines | |||
| 99 | 106 | ||
| 100 | Example: | 107 | Example: |
| 101 | sdhci@700b0000 { | 108 | sdhci@700b0000 { |
| 102 | compatible = "nvidia,tegra210-sdhci", "nvidia,tegra124-sdhci"; | 109 | compatible = "nvidia,tegra124-sdhci"; |
| 103 | reg = <0x0 0x700b0000 0x0 0x200>; | 110 | reg = <0x0 0x700b0000 0x0 0x200>; |
| 104 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; | 111 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; |
| 105 | clocks = <&tegra_car TEGRA210_CLK_SDMMC1>; | 112 | clocks = <&tegra_car TEGRA210_CLK_SDMMC1>; |
| @@ -115,3 +122,22 @@ sdhci@700b0000 { · 9 unmodified lines | |||
| 115 | nvidia,pad-autocal-pull-down-offset-1v8 = <0x7b>; | 122 | nvidia,pad-autocal-pull-down-offset-1v8 = <0x7b>; |
| 116 | status = "disabled"; | 123 | status = "disabled"; |
| 117 | }; | 124 | }; |
| 125 | |||
| 126 | sdhci@700b0000 { | ||
| 127 | compatible = "nvidia,tegra210-sdhci"; | ||
| 128 | reg = <0x0 0x700b0000 0x0 0x200>; | ||
| 129 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; | ||
| 130 | clocks = <&tegra_car TEGRA210_CLK_SDMMC1>, | ||
| 131 | <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; | ||
| 132 | clock-names = "sdhci", "tmclk"; | ||
| 133 | resets = <&tegra_car 14>; | ||
| 134 | reset-names = "sdhci"; | ||
| 135 | pinctrl-names = "sdmmc-3v3", "sdmmc-1v8"; | ||
| 136 | pinctrl-0 = <&sdmmc1_3v3>; | ||
| 137 | pinctrl-1 = <&sdmmc1_1v8>; | ||
| 138 | nvidia,pad-autocal-pull-up-offset-3v3 = <0x00>; | ||
| 139 | nvidia,pad-autocal-pull-down-offset-3v3 = <0x7d>; | ||
| 140 | nvidia,pad-autocal-pull-up-offset-1v8 = <0x7b>; | ||
| 141 | nvidia,pad-autocal-pull-down-offset-1v8 = <0x7b>; | ||
| 142 | status = "disabled"; | ||
| 143 | }; | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | Distributed Switch Architecture Device Tree Bindings | 1 | Distributed Switch Architecture Device Tree Bindings |
| 2 | ---------------------------------------------------- | 2 | ---------------------------------------------------- |
| 3 | 3 | ||
| 4 | See Documentation/devicetree/bindings/net/dsa/dsa.yaml for the documenation. | 4 | See Documentation/devicetree/bindings/net/dsa/dsa.yaml for the documentation. |
| @@ -23,8 +23,8 @@ Required properties: · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | - compatible: | 24 | - compatible: |
| 25 | Must be one of : | 25 | Must be one of : |
| 26 | "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-qspi" : MSPI+BSPI on BRCMSTB SoCs | 26 | "brcm,spi-brcmstb-qspi", "brcm,spi-bcm-qspi" : MSPI+BSPI on BRCMSTB SoCs |
| 27 | "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI | 27 | "brcm,spi-brcmstb-mspi", "brcm,spi-bcm-qspi" : Second Instance of MSPI |
| 28 | BRCMSTB SoCs | 28 | BRCMSTB SoCs |
| 29 | "brcm,spi-bcm7425-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI | 29 | "brcm,spi-bcm7425-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI |
| 30 | BRCMSTB SoCs | 30 | BRCMSTB SoCs |
| @@ -36,8 +36,8 @@ Required properties: · 5 unmodified lines | |||
| 36 | BRCMSTB SoCs | 36 | BRCMSTB SoCs |
| 37 | "brcm,spi-bcm7278-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI | 37 | "brcm,spi-bcm7278-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI |
| 38 | BRCMSTB SoCs | 38 | BRCMSTB SoCs |
| 39 | "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi" : MSPI+BSPI on Cygnus, NSP | 39 | "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi" : MSPI+BSPI on Cygnus, NSP |
| 40 | "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi" : NS2 SoCs | 40 | "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi" : NS2 SoCs |
| 41 | 41 | ||
| 42 | - reg: | 42 | - reg: |
| 43 | Define the bases and ranges of the associated I/O address spaces. | 43 | Define the bases and ranges of the associated I/O address spaces. |
| @@ -86,7 +86,7 @@ BRCMSTB SoC Example: · 42 unmodified lines | |||
| 86 | spi@f03e3400 { | 86 | spi@f03e3400 { |
| 87 | #address-cells = <0x1>; | 87 | #address-cells = <0x1>; |
| 88 | #size-cells = <0x0>; | 88 | #size-cells = <0x0>; |
| 89 | compatible = "brcm,spi-brcmstb-qspi", "brcm,spi-brcmstb-qspi"; | 89 | compatible = "brcm,spi-brcmstb-qspi", "brcm,spi-bcm-qspi"; |
| 90 | reg = <0xf03e0920 0x4 0xf03e3400 0x188 0xf03e3200 0x50>; | 90 | reg = <0xf03e0920 0x4 0xf03e3400 0x188 0xf03e3200 0x50>; |
| 91 | reg-names = "cs_reg", "mspi", "bspi"; | 91 | reg-names = "cs_reg", "mspi", "bspi"; |
| 92 | interrupts = <0x6 0x5 0x4 0x3 0x2 0x1 0x0>; | 92 | interrupts = <0x6 0x5 0x4 0x3 0x2 0x1 0x0>; |
| @@ -149,7 +149,7 @@ BRCMSTB SoC Example: · 56 unmodified lines | |||
| 149 | #address-cells = <1>; | 149 | #address-cells = <1>; |
| 150 | #size-cells = <0>; | 150 | #size-cells = <0>; |
| 151 | clocks = <&upg_fixed>; | 151 | clocks = <&upg_fixed>; |
| 152 | compatible = "brcm,spi-brcmstb-qspi", "brcm,spi-brcmstb-mspi"; | 152 | compatible = "brcm,spi-brcmstb-mspi", "brcm,spi-bcm-qspi"; |
| 153 | reg = <0xf0416000 0x180>; | 153 | reg = <0xf0416000 0x180>; |
| 154 | reg-names = "mspi"; | 154 | reg-names = "mspi"; |
| 155 | interrupts = <0x14>; | 155 | interrupts = <0x14>; |
| @@ -160,7 +160,7 @@ BRCMSTB SoC Example: · 4 unmodified lines | |||
| 160 | iProc SoC Example: | 160 | iProc SoC Example: |
| 161 | 161 | ||
| 162 | qspi: spi@18027200 { | 162 | qspi: spi@18027200 { |
| 163 | compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"; | 163 | compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"; |
| 164 | reg = <0x18027200 0x184>, | 164 | reg = <0x18027200 0x184>, |
| 165 | <0x18027000 0x124>, | 165 | <0x18027000 0x124>, |
| 166 | <0x1811c408 0x004>, | 166 | <0x1811c408 0x004>, |
| @@ -191,7 +191,7 @@ iProc SoC Example: · 24 unmodified lines | |||
| 191 | NS2 SoC Example: | 191 | NS2 SoC Example: |
| 192 | 192 | ||
| 193 | qspi: spi@66470200 { | 193 | qspi: spi@66470200 { |
| 194 | compatible = "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi"; | 194 | compatible = "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi"; |
| 195 | reg = <0x66470200 0x184>, | 195 | reg = <0x66470200 0x184>, |
| 196 | <0x66470000 0x124>, | 196 | <0x66470000 0x124>, |
| 197 | <0x67017408 0x004>, | 197 | <0x67017408 0x004>, |
| @@ -179,7 +179,7 @@ DMA Fence uABI/Sync File · 178 unmodified lines | |||
| 179 | :internal: | 179 | :internal: |
| 180 | 180 | ||
| 181 | Indefinite DMA Fences | 181 | Indefinite DMA Fences |
| 182 | ~~~~~~~~~~~~~~~~~~~~ | 182 | ~~~~~~~~~~~~~~~~~~~~~ |
| 183 | 183 | ||
| 184 | At various times &dma_fence with an indefinite time until dma_fence_wait() | 184 | At various times &dma_fence with an indefinite time until dma_fence_wait() |
| 185 | finishes have been proposed. Examples include: | 185 | finishes have been proposed. Examples include: |
| @@ -6,9 +6,9 @@ API to implement a new FPGA bridge · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | * struct :c:type:`fpga_bridge` — The FPGA Bridge structure | 7 | * struct :c:type:`fpga_bridge` — The FPGA Bridge structure |
| 8 | * struct :c:type:`fpga_bridge_ops` — Low level Bridge driver ops | 8 | * struct :c:type:`fpga_bridge_ops` — Low level Bridge driver ops |
| 9 | * :c:func:`devm_fpga_bridge_create()` — Allocate and init a bridge struct | 9 | * devm_fpga_bridge_create() — Allocate and init a bridge struct |
| 10 | * :c:func:`fpga_bridge_register()` — Register a bridge | 10 | * fpga_bridge_register() — Register a bridge |
| 11 | * :c:func:`fpga_bridge_unregister()` — Unregister a bridge | 11 | * fpga_bridge_unregister() — Unregister a bridge |
| 12 | 12 | ||
| 13 | .. kernel-doc:: include/linux/fpga/fpga-bridge.h | 13 | .. kernel-doc:: include/linux/fpga/fpga-bridge.h |
| 14 | :functions: fpga_bridge | 14 | :functions: fpga_bridge |
| @@ -104,9 +104,9 @@ API for implementing a new FPGA Manager driver · 103 unmodified lines | |||
| 104 | * ``fpga_mgr_states`` — Values for :c:member:`fpga_manager->state`. | 104 | * ``fpga_mgr_states`` — Values for :c:member:`fpga_manager->state`. |
| 105 | * struct :c:type:`fpga_manager` — the FPGA manager struct | 105 | * struct :c:type:`fpga_manager` — the FPGA manager struct |
| 106 | * struct :c:type:`fpga_manager_ops` — Low level FPGA manager driver ops | 106 | * struct :c:type:`fpga_manager_ops` — Low level FPGA manager driver ops |
| 107 | * :c:func:`devm_fpga_mgr_create` — Allocate and init a manager struct | 107 | * devm_fpga_mgr_create() — Allocate and init a manager struct |
| 108 | * :c:func:`fpga_mgr_register` — Register an FPGA manager | 108 | * fpga_mgr_register() — Register an FPGA manager |
| 109 | * :c:func:`fpga_mgr_unregister` — Unregister an FPGA manager | 109 | * fpga_mgr_unregister() — Unregister an FPGA manager |
| 110 | 110 | ||
| 111 | .. kernel-doc:: include/linux/fpga/fpga-mgr.h | 111 | .. kernel-doc:: include/linux/fpga/fpga-mgr.h |
| 112 | :functions: fpga_mgr_states | 112 | :functions: fpga_mgr_states |
| @@ -6,9 +6,9 @@ Overview · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | The in-kernel API for FPGA programming is a combination of APIs from | 7 | The in-kernel API for FPGA programming is a combination of APIs from |
| 8 | FPGA manager, bridge, and regions. The actual function used to | 8 | FPGA manager, bridge, and regions. The actual function used to |
| 9 | trigger FPGA programming is :c:func:`fpga_region_program_fpga()`. | 9 | trigger FPGA programming is fpga_region_program_fpga(). |
| 10 | 10 | ||
| 11 | :c:func:`fpga_region_program_fpga()` uses functionality supplied by | 11 | fpga_region_program_fpga() uses functionality supplied by |
| 12 | the FPGA manager and bridges. It will: | 12 | the FPGA manager and bridges. It will: |
| 13 | 13 | ||
| 14 | * lock the region's mutex | 14 | * lock the region's mutex |
| @@ -20,8 +20,8 @@ the FPGA manager and bridges. It will: · 5 unmodified lines | |||
| 20 | * release the locks | 20 | * release the locks |
| 21 | 21 | ||
| 22 | The struct fpga_image_info specifies what FPGA image to program. It is | 22 | The struct fpga_image_info specifies what FPGA image to program. It is |
| 23 | allocated/freed by :c:func:`fpga_image_info_alloc()` and freed with | 23 | allocated/freed by fpga_image_info_alloc() and freed with |
| 24 | :c:func:`fpga_image_info_free()` | 24 | fpga_image_info_free() |
| 25 | 25 | ||
| 26 | How to program an FPGA using a region | 26 | How to program an FPGA using a region |
| 27 | ------------------------------------- | 27 | ------------------------------------- |
| @@ -84,10 +84,10 @@ will generate that list. Here's some sample code of what to do next:: · 56 unmodified lines | |||
| 84 | API for programming an FPGA | 84 | API for programming an FPGA |
| 85 | --------------------------- | 85 | --------------------------- |
| 86 | 86 | ||
| 87 | * :c:func:`fpga_region_program_fpga` — Program an FPGA | 87 | * fpga_region_program_fpga() — Program an FPGA |
| 88 | * :c:type:`fpga_image_info` — Specifies what FPGA image to program | 88 | * fpga_image_info() — Specifies what FPGA image to program |
| 89 | * :c:func:`fpga_image_info_alloc()` — Allocate an FPGA image info struct | 89 | * fpga_image_info_alloc() — Allocate an FPGA image info struct |
| 90 | * :c:func:`fpga_image_info_free()` — Free an FPGA image info struct | 90 | * fpga_image_info_free() — Free an FPGA image info struct |
| 91 | 91 | ||
| 92 | .. kernel-doc:: drivers/fpga/fpga-region.c | 92 | .. kernel-doc:: drivers/fpga/fpga-region.c |
| 93 | :functions: fpga_region_program_fpga | 93 | :functions: fpga_region_program_fpga |
| @@ -46,18 +46,18 @@ API to add a new FPGA region · 45 unmodified lines | |||
| 46 | ---------------------------- | 46 | ---------------------------- |
| 47 | 47 | ||
| 48 | * struct :c:type:`fpga_region` — The FPGA region struct | 48 | * struct :c:type:`fpga_region` — The FPGA region struct |
| 49 | * :c:func:`devm_fpga_region_create` — Allocate and init a region struct | 49 | * devm_fpga_region_create() — Allocate and init a region struct |
| 50 | * :c:func:`fpga_region_register` — Register an FPGA region | 50 | * fpga_region_register() — Register an FPGA region |
| 51 | * :c:func:`fpga_region_unregister` — Unregister an FPGA region | 51 | * fpga_region_unregister() — Unregister an FPGA region |
| 52 | 52 | ||
| 53 | The FPGA region's probe function will need to get a reference to the FPGA | 53 | The FPGA region's probe function will need to get a reference to the FPGA |
| 54 | Manager it will be using to do the programming. This usually would happen | 54 | Manager it will be using to do the programming. This usually would happen |
| 55 | during the region's probe function. | 55 | during the region's probe function. |
| 56 | 56 | ||
| 57 | * :c:func:`fpga_mgr_get` — Get a reference to an FPGA manager, raise ref count | 57 | * fpga_mgr_get() — Get a reference to an FPGA manager, raise ref count |
| 58 | * :c:func:`of_fpga_mgr_get` — Get a reference to an FPGA manager, raise ref count, | 58 | * of_fpga_mgr_get() — Get a reference to an FPGA manager, raise ref count, |
| 59 | given a device node. | 59 | given a device node. |
| 60 | * :c:func:`fpga_mgr_put` — Put an FPGA manager | 60 | * fpga_mgr_put() — Put an FPGA manager |
| 61 | 61 | ||
| 62 | The FPGA region will need to specify which bridges to control while programming | 62 | The FPGA region will need to specify which bridges to control while programming |
| 63 | the FPGA. The region driver can build a list of bridges during probe time | 63 | the FPGA. The region driver can build a list of bridges during probe time |
| @@ -66,11 +66,11 @@ the list of bridges to program just before programming · 2 unmodified lines | |||
| 66 | (:c:member:`fpga_region->get_bridges`). The FPGA bridge framework supplies the | 66 | (:c:member:`fpga_region->get_bridges`). The FPGA bridge framework supplies the |
| 67 | following APIs to handle building or tearing down that list. | 67 | following APIs to handle building or tearing down that list. |
| 68 | 68 | ||
| 69 | * :c:func:`fpga_bridge_get_to_list` — Get a ref of an FPGA bridge, add it to a | 69 | * fpga_bridge_get_to_list() — Get a ref of an FPGA bridge, add it to a |
| 70 | list | 70 | list |
| 71 | * :c:func:`of_fpga_bridge_get_to_list` — Get a ref of an FPGA bridge, add it to a | 71 | * of_fpga_bridge_get_to_list() — Get a ref of an FPGA bridge, add it to a |
| 72 | list, given a device node | 72 | list, given a device node |
| 73 | * :c:func:`fpga_bridges_put` — Given a list of bridges, put them | 73 | * fpga_bridges_put() — Given a list of bridges, put them |
| 74 | 74 | ||
| 75 | .. kernel-doc:: include/linux/fpga/fpga-region.h | 75 | .. kernel-doc:: include/linux/fpga/fpga-region.h |
| 76 | :functions: fpga_region | 76 | :functions: fpga_region |
| @@ -11,10 +11,10 @@ Industrial I/O Devices · 10 unmodified lines | |||
| 11 | ---------------------- | 11 | ---------------------- |
| 12 | 12 | ||
| 13 | * struct :c:type:`iio_dev` - industrial I/O device | 13 | * struct :c:type:`iio_dev` - industrial I/O device |
| 14 | * :c:func:`iio_device_alloc()` - allocate an :c:type:`iio_dev` from a driver | 14 | * iio_device_alloc() - allocate an :c:type:`iio_dev` from a driver |
| 15 | * :c:func:`iio_device_free()` - free an :c:type:`iio_dev` from a driver | 15 | * iio_device_free() - free an :c:type:`iio_dev` from a driver |
| 16 | * :c:func:`iio_device_register()` - register a device with the IIO subsystem | 16 | * iio_device_register() - register a device with the IIO subsystem |
| 17 | * :c:func:`iio_device_unregister()` - unregister a device from the IIO | 17 | * iio_device_unregister() - unregister a device from the IIO |
| 18 | subsystem | 18 | subsystem |
| 19 | 19 | ||
| 20 | An IIO device usually corresponds to a single hardware sensor and it | 20 | An IIO device usually corresponds to a single hardware sensor and it |
| @@ -34,17 +34,17 @@ A typical IIO driver will register itself as an :doc:`I2C <../i2c>` or · 13 unmodified lines | |||
| 34 | 34 | ||
| 35 | At probe: | 35 | At probe: |
| 36 | 36 | ||
| 37 | 1. Call :c:func:`iio_device_alloc()`, which allocates memory for an IIO device. | 37 | 1. Call iio_device_alloc(), which allocates memory for an IIO device. |
| 38 | 2. Initialize IIO device fields with driver specific information (e.g. | 38 | 2. Initialize IIO device fields with driver specific information (e.g. |
| 39 | device name, device channels). | 39 | device name, device channels). |
| 40 | 3. Call :c:func:`iio_device_register()`, this registers the device with the | 40 | 3. Call iio_device_register(), this registers the device with the |
| 41 | IIO core. After this call the device is ready to accept requests from user | 41 | IIO core. After this call the device is ready to accept requests from user |
| 42 | space applications. | 42 | space applications. |
| 43 | 43 | ||
| 44 | At remove, we free the resources allocated in probe in reverse order: | 44 | At remove, we free the resources allocated in probe in reverse order: |
| 45 | 45 | ||
| 46 | 1. :c:func:`iio_device_unregister()`, unregister the device from the IIO core. | 46 | 1. iio_device_unregister(), unregister the device from the IIO core. |
| 47 | 2. :c:func:`iio_device_free()`, free the memory allocated for the IIO device. | 47 | 2. iio_device_free(), free the memory allocated for the IIO device. |
| 48 | 48 | ||
| 49 | IIO device sysfs interface | 49 | IIO device sysfs interface |
| 50 | ========================== | 50 | ========================== |
| @@ -110,13 +110,15 @@ The Amiga protection flags RWEDRWEDHSPARWED are handled as follows: · 109 unmodified lines | |||
| 110 | 110 | ||
| 111 | - R maps to r for user, group and others. On directories, R implies x. | 111 | - R maps to r for user, group and others. On directories, R implies x. |
| 112 | 112 | ||
| 113 | - If both W and D are allowed, w will be set. | 113 | - W maps to w. |
| 114 | 114 | ||
| 115 | - E maps to x. | 115 | - E maps to x. |
| 116 | 116 | ||
| 117 | - H and P are always retained and ignored under Linux. | 117 | - D is ignored. |
| 118 | 118 | ||
| 119 | - A is always reset when a file is written to. | 119 | - H, S and P are always retained and ignored under Linux. |
| 120 | |||
| 121 | - A is cleared when a file is written to. | ||
| 120 | 122 | ||
| 121 | User id and group id will be used unless set[gu]id are given as mount | 123 | User id and group id will be used unless set[gu]id are given as mount |
| 122 | options. Since most of the Amiga file systems are single user systems | 124 | options. Since most of the Amiga file systems are single user systems |
| @@ -128,11 +130,13 @@ Linux -> Amiga: · 5 unmodified lines | |||
| 128 | 130 | ||
| 129 | The Linux rwxrwxrwx file mode is handled as follows: | 131 | The Linux rwxrwxrwx file mode is handled as follows: |
| 130 | 132 | ||
| 131 | - r permission will set R for user, group and others. | 133 | - r permission will allow R for user, group and others. |
| 134 | |||
| 135 | - w permission will allow W for user, group and others. | ||
| 132 | 136 | ||
| 133 | - w permission will set W and D for user, group and others. | 137 | - x permission of the user will allow E for plain files. |
| 134 | 138 | ||
| 135 | - x permission of the user will set E for plain files. | 139 | - D will be allowed for user, group and others. |
| 136 | 140 | ||
| 137 | - All other flags (suid, sgid, ...) are ignored and will | 141 | - All other flags (suid, sgid, ...) are ignored and will |
| 138 | not be retained. | 142 | not be retained. |
| @@ -68,7 +68,7 @@ See below for all known bank addresses, numbers of sensors in that bank, · 67 unmodified lines | |||
| 68 | number of bytes data per sensor and contents/meaning of those bytes. | 68 | number of bytes data per sensor and contents/meaning of those bytes. |
| 69 | 69 | ||
| 70 | Although both this document and the kernel driver have kept the sensor | 70 | Although both this document and the kernel driver have kept the sensor |
| 71 | terminoligy for the addressing within a bank this is not 100% correct, in | 71 | terminology for the addressing within a bank this is not 100% correct, in |
| 72 | bank 0x24 for example the addressing within the bank selects a PWM output not | 72 | bank 0x24 for example the addressing within the bank selects a PWM output not |
| 73 | a sensor. | 73 | a sensor. |
| 74 | 74 | ||
| @@ -155,7 +155,7 @@ After wider testing of the Linux kernel driver some variants of the uGuru have · 80 unmodified lines | |||
| 155 | turned up which do not hold 0x08 at DATA within 250 reads after writing the | 155 | turned up which do not hold 0x08 at DATA within 250 reads after writing the |
| 156 | bank address. With these versions this happens quite frequent, using larger | 156 | bank address. With these versions this happens quite frequent, using larger |
| 157 | timeouts doesn't help, they just go offline for a second or 2, doing some | 157 | timeouts doesn't help, they just go offline for a second or 2, doing some |
| 158 | internal callibration or whatever. Your code should be prepared to handle | 158 | internal calibration or whatever. Your code should be prepared to handle |
| 159 | this and in case of no response in this specific case just goto sleep for a | 159 | this and in case of no response in this specific case just goto sleep for a |
| 160 | while and then retry. | 160 | while and then retry. |
| 161 | 161 | ||
| @@ -331,6 +331,6 @@ the voltage / clock programming out, I tried reading and only reading banks · 169 unmodified lines | |||
| 331 | 0-0x30 with the reading code used for the sensor banks (0x20-0x28) and this | 331 | 0-0x30 with the reading code used for the sensor banks (0x20-0x28) and this |
| 332 | resulted in a _permanent_ reprogramming of the voltages, luckily I had the | 332 | resulted in a _permanent_ reprogramming of the voltages, luckily I had the |
| 333 | sensors part configured so that it would shutdown my system on any out of spec | 333 | sensors part configured so that it would shutdown my system on any out of spec |
| 334 | voltages which proprably safed my computer (after a reboot I managed to | 334 | voltages which probably safed my computer (after a reboot I managed to |
| 335 | immediately enter the bios and reload the defaults). This probably means that | 335 | immediately enter the bios and reload the defaults). This probably means that |
| 336 | the read/write cycle for the non sensor part is different from the sensor part. | 336 | the read/write cycle for the non sensor part is different from the sensor part. |
| @@ -17,7 +17,7 @@ Supported chips: · 16 unmodified lines | |||
| 17 | Note: | 17 | Note: |
| 18 | The uGuru is a microcontroller with onboard firmware which programs | 18 | The uGuru is a microcontroller with onboard firmware which programs |
| 19 | it to behave as a hwmon IC. There are many different revisions of the | 19 | it to behave as a hwmon IC. There are many different revisions of the |
| 20 | firmware and thus effectivly many different revisions of the uGuru. | 20 | firmware and thus effectively many different revisions of the uGuru. |
| 21 | Below is an incomplete list with which revisions are used for which | 21 | Below is an incomplete list with which revisions are used for which |
| 22 | Motherboards: | 22 | Motherboards: |
| 23 | 23 | ||
| @@ -33,7 +33,7 @@ Supported chips: · 9 unmodified lines | |||
| 33 | sensortype (Volt or Temp) for bank1 sensors, for revision 1 uGuru's | 33 | sensortype (Volt or Temp) for bank1 sensors, for revision 1 uGuru's |
| 34 | this does not always work. For these uGuru's the autodetection can | 34 | this does not always work. For these uGuru's the autodetection can |
| 35 | be overridden with the bank1_types module param. For all 3 known | 35 | be overridden with the bank1_types module param. For all 3 known |
| 36 | revison 1 motherboards the correct use of this param is: | 36 | revision 1 motherboards the correct use of this param is: |
| 37 | bank1_types=1,1,0,0,0,0,0,2,0,0,0,0,2,0,0,1 | 37 | bank1_types=1,1,0,0,0,0,0,2,0,0,0,0,2,0,0,1 |
| 38 | You may also need to specify the fan_sensors option for these boards | 38 | You may also need to specify the fan_sensors option for these boards |
| 39 | fan_sensors=5 | 39 | fan_sensors=5 |
| @@ -13,7 +13,7 @@ Supported chips: · 12 unmodified lines | |||
| 13 | Note: | 13 | Note: |
| 14 | The uGuru is a microcontroller with onboard firmware which programs | 14 | The uGuru is a microcontroller with onboard firmware which programs |
| 15 | it to behave as a hwmon IC. There are many different revisions of the | 15 | it to behave as a hwmon IC. There are many different revisions of the |
| 16 | firmware and thus effectivly many different revisions of the uGuru. | 16 | firmware and thus effectively many different revisions of the uGuru. |
| 17 | Below is an incomplete list with which revisions are used for which | 17 | Below is an incomplete list with which revisions are used for which |
| 18 | Motherboards: | 18 | Motherboards: |
| 19 | 19 | ||
| @@ -24,7 +24,7 @@ Supported chips: · 4 unmodified lines | |||
| 24 | - uGuru 3.0.0.0 ~ 3.0.x.x (AW8, AL8, AT8, NI8 SLI, AT8 32X, AN8 32X, | 24 | - uGuru 3.0.0.0 ~ 3.0.x.x (AW8, AL8, AT8, NI8 SLI, AT8 32X, AN8 32X, |
| 25 | AW9D-MAX) | 25 | AW9D-MAX) |
| 26 | 26 | ||
| 27 | The abituguru3 driver is only for revison 3.0.x.x motherboards, | 27 | The abituguru3 driver is only for revision 3.0.x.x motherboards, |
| 28 | this driver will not work on older motherboards. For older | 28 | this driver will not work on older motherboards. For older |
| 29 | motherboards use the abituguru (without the 3 !) driver. | 29 | motherboards use the abituguru (without the 3 !) driver. |
| 30 | 30 | ||
| @@ -23,8 +23,8 @@ supports C and the GNU C extensions required by the kernel, and is pronounced · 22 unmodified lines | |||
| 23 | Clang | 23 | Clang |
| 24 | ----- | 24 | ----- |
| 25 | 25 | ||
| 26 | The compiler used can be swapped out via `CC=` command line argument to `make`. | 26 | The compiler used can be swapped out via ``CC=`` command line argument to ``make``. |
| 27 | `CC=` should be set when selecting a config and during a build. | 27 | ``CC=`` should be set when selecting a config and during a build. :: |
| 28 | 28 | ||
| 29 | make CC=clang defconfig | 29 | make CC=clang defconfig |
| 30 | 30 | ||
| @@ -34,33 +34,33 @@ Cross Compiling · 3 unmodified lines | |||
| 34 | --------------- | 34 | --------------- |
| 35 | 35 | ||
| 36 | A single Clang compiler binary will typically contain all supported backends, | 36 | A single Clang compiler binary will typically contain all supported backends, |
| 37 | which can help simplify cross compiling. | 37 | which can help simplify cross compiling. :: |
| 38 | 38 | ||
| 39 | ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang | 39 | ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang |
| 40 | 40 | ||
| 41 | `CROSS_COMPILE` is not used to prefix the Clang compiler binary, instead | 41 | ``CROSS_COMPILE`` is not used to prefix the Clang compiler binary, instead |
| 42 | `CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For | 42 | ``CROSS_COMPILE`` is used to set a command line flag: ``--target <triple>``. For |
| 43 | example: | 43 | example: :: |
| 44 | 44 | ||
| 45 | clang --target aarch64-linux-gnu foo.c | 45 | clang --target aarch64-linux-gnu foo.c |
| 46 | 46 | ||
| 47 | LLVM Utilities | 47 | LLVM Utilities |
| 48 | -------------- | 48 | -------------- |
| 49 | 49 | ||
| 50 | LLVM has substitutes for GNU binutils utilities. Kbuild supports `LLVM=1` | 50 | LLVM has substitutes for GNU binutils utilities. Kbuild supports ``LLVM=1`` |
| 51 | to enable them. | 51 | to enable them. :: |
| 52 | 52 | ||
| 53 | make LLVM=1 | 53 | make LLVM=1 |
| 54 | 54 | ||
| 55 | They can be enabled individually. The full list of the parameters: | 55 | They can be enabled individually. The full list of the parameters: :: |
| 56 | 56 | ||
| 57 | make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \\ | 57 | make CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip \ |
| 58 | OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\ | 58 | OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \ |
| 59 | READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\ | 59 | READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \ |
| 60 | HOSTLD=ld.lld | 60 | HOSTLD=ld.lld |
| 61 | 61 | ||
| 62 | Currently, the integrated assembler is disabled by default. You can pass | 62 | Currently, the integrated assembler is disabled by default. You can pass |
| 63 | `LLVM_IAS=1` to enable it. | 63 | ``LLVM_IAS=1`` to enable it. |
| 64 | 64 | ||
| 65 | Getting Help | 65 | Getting Help |
| 66 | ------------ | 66 | ------------ |
| @@ -16,7 +16,7 @@ This document describes the Linux kernel Makefiles. · 15 unmodified lines | |||
| 16 | --- 3.5 Library file goals - lib-y | 16 | --- 3.5 Library file goals - lib-y |
| 17 | --- 3.6 Descending down in directories | 17 | --- 3.6 Descending down in directories |
| 18 | --- 3.7 Compilation flags | 18 | --- 3.7 Compilation flags |
| 19 | --- 3.8 Command line dependency | 19 | --- 3.8 <deleted> |
| 20 | --- 3.9 Dependency tracking | 20 | --- 3.9 Dependency tracking |
| 21 | --- 3.10 Special Rules | 21 | --- 3.10 Special Rules |
| 22 | --- 3.11 $(CC) support functions | 22 | --- 3.11 $(CC) support functions |
| @@ -39,8 +39,8 @@ This document describes the Linux kernel Makefiles. · 16 unmodified lines | |||
| 39 | 39 | ||
| 40 | === 7 Architecture Makefiles | 40 | === 7 Architecture Makefiles |
| 41 | --- 7.1 Set variables to tweak the build to the architecture | 41 | --- 7.1 Set variables to tweak the build to the architecture |
| 42 | --- 7.2 Add prerequisites to archheaders: | 42 | --- 7.2 Add prerequisites to archheaders |
| 43 | --- 7.3 Add prerequisites to archprepare: | 43 | --- 7.3 Add prerequisites to archprepare |
| 44 | --- 7.4 List directories to visit when descending | 44 | --- 7.4 List directories to visit when descending |
| 45 | --- 7.5 Architecture-specific boot images | 45 | --- 7.5 Architecture-specific boot images |
| 46 | --- 7.6 Building non-kbuild targets | 46 | --- 7.6 Building non-kbuild targets |
| @@ -129,7 +129,7 @@ The preferred name for the kbuild files are 'Makefile' but 'Kbuild' can · 82 unmodified lines | |||
| 129 | be used and if both a 'Makefile' and a 'Kbuild' file exists, then the 'Kbuild' | 129 | be used and if both a 'Makefile' and a 'Kbuild' file exists, then the 'Kbuild' |
| 130 | file will be used. | 130 | file will be used. |
| 131 | 131 | ||
| 132 | Section 3.1 "Goal definitions" is a quick intro, further chapters provide | 132 | Section 3.1 "Goal definitions" is a quick intro; further chapters provide |
| 133 | more details, with real examples. | 133 | more details, with real examples. |
| 134 | 134 | ||
| 135 | 3.1 Goal definitions | 135 | 3.1 Goal definitions |
| @@ -965,7 +965,7 @@ When kbuild executes, the following steps are followed (roughly): · 829 unmodified lines | |||
| 965 | KBUILD_LDFLAGS := -m elf_s390 | 965 | KBUILD_LDFLAGS := -m elf_s390 |
| 966 | 966 | ||
| 967 | Note: ldflags-y can be used to further customise | 967 | Note: ldflags-y can be used to further customise |
| 968 | the flags used. See chapter 3.7. | 968 | the flags used. See section 3.7. |
| 969 | 969 | ||
| 970 | LDFLAGS_vmlinux | 970 | LDFLAGS_vmlinux |
| 971 | Options for $(LD) when linking vmlinux | 971 | Options for $(LD) when linking vmlinux |
| @@ -1121,7 +1121,7 @@ When kbuild executes, the following steps are followed (roughly): · 149 unmodified lines | |||
| 1121 | 1121 | ||
| 1122 | In this example, the file target maketools will be processed | 1122 | In this example, the file target maketools will be processed |
| 1123 | before descending down in the subdirectories. | 1123 | before descending down in the subdirectories. |
| 1124 | See also chapter XXX-TODO that describe how kbuild supports | 1124 | See also chapter XXX-TODO that describes how kbuild supports |
| 1125 | generating offset header files. | 1125 | generating offset header files. |
| 1126 | 1126 | ||
| 1127 | 1127 | ||
| @@ -1261,7 +1261,7 @@ When kbuild executes, the following steps are followed (roughly): · 133 unmodified lines | |||
| 1261 | always be built. | 1261 | always be built. |
| 1262 | Assignments to $(targets) are without $(obj)/ prefix. | 1262 | Assignments to $(targets) are without $(obj)/ prefix. |
| 1263 | if_changed may be used in conjunction with custom commands as | 1263 | if_changed may be used in conjunction with custom commands as |
| 1264 | defined in 6.8 "Custom kbuild commands". | 1264 | defined in 7.8 "Custom kbuild commands". |
| 1265 | 1265 | ||
| 1266 | Note: It is a typical mistake to forget the FORCE prerequisite. | 1266 | Note: It is a typical mistake to forget the FORCE prerequisite. |
| 1267 | Another common pitfall is that whitespace is sometimes | 1267 | Another common pitfall is that whitespace is sometimes |
| @@ -1411,7 +1411,7 @@ When kbuild executes, the following steps are followed (roughly): · 143 unmodified lines | |||
| 1411 | that may be shared between individual architectures. | 1411 | that may be shared between individual architectures. |
| 1412 | The recommended approach how to use a generic header file is | 1412 | The recommended approach how to use a generic header file is |
| 1413 | to list the file in the Kbuild file. | 1413 | to list the file in the Kbuild file. |
| 1414 | See "7.2 generic-y" for further info on syntax etc. | 1414 | See "8.2 generic-y" for further info on syntax etc. |
| 1415 | 1415 | ||
| 1416 | 7.11 Post-link pass | 1416 | 7.11 Post-link pass |
| 1417 | ------------------- | 1417 | ------------------- |
| @@ -1601,4 +1601,4 @@ is the right choice. · 183 unmodified lines | |||
| 1601 | 1601 | ||
| 1602 | - Describe how kbuild supports shipped files with _shipped. | 1602 | - Describe how kbuild supports shipped files with _shipped. |
| 1603 | - Generating offset header files. | 1603 | - Generating offset header files. |
| 1604 | - Add more variables to section 7? | 1604 | - Add more variables to chapters 7 or 9? |
| @@ -164,14 +164,14 @@ by disabling preemption or interrupts. · 163 unmodified lines | |||
| 164 | On non-PREEMPT_RT kernels local_lock operations map to the preemption and | 164 | On non-PREEMPT_RT kernels local_lock operations map to the preemption and |
| 165 | interrupt disabling and enabling primitives: | 165 | interrupt disabling and enabling primitives: |
| 166 | 166 | ||
| 167 | =========================== ====================== | 167 | =============================== ====================== |
| 168 | local_lock(&llock) preempt_disable() | 168 | local_lock(&llock) preempt_disable() |
| 169 | local_unlock(&llock) preempt_enable() | 169 | local_unlock(&llock) preempt_enable() |
| 170 | local_lock_irq(&llock) local_irq_disable() | 170 | local_lock_irq(&llock) local_irq_disable() |
| 171 | local_unlock_irq(&llock) local_irq_enable() | 171 | local_unlock_irq(&llock) local_irq_enable() |
| 172 | local_lock_save(&llock) local_irq_save() | 172 | local_lock_irqsave(&llock) local_irq_save() |
| 173 | local_lock_restore(&llock) local_irq_save() | 173 | local_unlock_irqrestore(&llock) local_irq_restore() |
| 174 | =========================== ====================== | 174 | =============================== ====================== |
| 175 | 175 | ||
| 176 | The named scope of local_lock has two advantages over the regular | 176 | The named scope of local_lock has two advantages over the regular |
| 177 | primitives: | 177 | primitives: |
| @@ -353,14 +353,14 @@ protection scope. So the following substitution is wrong:: · 175 unmodified lines | |||
| 353 | { | 353 | { |
| 354 | local_irq_save(flags); -> local_lock_irqsave(&local_lock_1, flags); | 354 | local_irq_save(flags); -> local_lock_irqsave(&local_lock_1, flags); |
| 355 | func3(); | 355 | func3(); |
| 356 | local_irq_restore(flags); -> local_lock_irqrestore(&local_lock_1, flags); | 356 | local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock_1, flags); |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | func2() | 359 | func2() |
| 360 | { | 360 | { |
| 361 | local_irq_save(flags); -> local_lock_irqsave(&local_lock_2, flags); | 361 | local_irq_save(flags); -> local_lock_irqsave(&local_lock_2, flags); |
| 362 | func3(); | 362 | func3(); |
| 363 | local_irq_restore(flags); -> local_lock_irqrestore(&local_lock_2, flags); | 363 | local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock_2, flags); |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | func3() | 366 | func3() |
| @@ -379,14 +379,14 @@ PREEMPT_RT-specific semantics of spinlock_t. The correct substitution is:: · 12 unmodified lines | |||
| 379 | { | 379 | { |
| 380 | local_irq_save(flags); -> local_lock_irqsave(&local_lock, flags); | 380 | local_irq_save(flags); -> local_lock_irqsave(&local_lock, flags); |
| 381 | func3(); | 381 | func3(); |
| 382 | local_irq_restore(flags); -> local_lock_irqrestore(&local_lock, flags); | 382 | local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock, flags); |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | func2() | 385 | func2() |
| 386 | { | 386 | { |
| 387 | local_irq_save(flags); -> local_lock_irqsave(&local_lock, flags); | 387 | local_irq_save(flags); -> local_lock_irqsave(&local_lock, flags); |
| 388 | func3(); | 388 | func3(); |
| 389 | local_irq_restore(flags); -> local_lock_irqrestore(&local_lock, flags); | 389 | local_irq_restore(flags); -> local_unlock_irqrestore(&local_lock, flags); |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | func3() | 392 | func3() |
| @@ -101,3 +101,4 @@ to do something different in the near future. · 100 unmodified lines | |||
| 101 | 101 | ||
| 102 | ../doc-guide/maintainer-profile | 102 | ../doc-guide/maintainer-profile |
| 103 | ../nvdimm/maintainer-entry-profile | 103 | ../nvdimm/maintainer-entry-profile |
| 104 | ../riscv/patch-acceptance | ||
| @@ -180,7 +180,7 @@ The configuration can only be set up via VLAN tagging and bridge setup. · 179 unmodified lines | |||
| 180 | 180 | ||
| 181 | # bring up the slave interfaces | 181 | # bring up the slave interfaces |
| 182 | ip link set lan1 up | 182 | ip link set lan1 up |
| 183 | ip link set lan1 up | 183 | ip link set lan2 up |
| 184 | ip link set lan3 up | 184 | ip link set lan3 up |
| 185 | 185 | ||
| 186 | # create bridge | 186 | # create bridge |
| @@ -142,7 +142,7 @@ only NUL-terminated strings. The safe replacement is strscpy(). · 141 unmodified lines | |||
| 142 | (Users of strscpy() still needing NUL-padding should instead | 142 | (Users of strscpy() still needing NUL-padding should instead |
| 143 | use strscpy_pad().) | 143 | use strscpy_pad().) |
| 144 | 144 | ||
| 145 | If a caller is using non-NUL-terminated strings, strncpy()() can | 145 | If a caller is using non-NUL-terminated strings, strncpy() can |
| 146 | still be used, but destinations should be marked with the `__nonstring | 146 | still be used, but destinations should be marked with the `__nonstring |
| 147 | <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_ | 147 | <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_ |
| 148 | attribute to avoid future compiler warnings. | 148 | attribute to avoid future compiler warnings. |
| @@ -332,7 +332,7 @@ WO 9901953 (A1) · 331 unmodified lines | |||
| 332 | 332 | ||
| 333 | 333 | ||
| 334 | US Patents (https://www.uspto.gov/) | 334 | US Patents (https://www.uspto.gov/) |
| 335 | ---------------------------------- | 335 | ----------------------------------- |
| 336 | 336 | ||
| 337 | US 5925841 | 337 | US 5925841 |
| 338 | Digital Sampling Instrument employing cache memory (Jul. 20, 1999) | 338 | Digital Sampling Instrument employing cache memory (Jul. 20, 1999) |
| @@ -337,7 +337,7 @@ WO 9901953 (A1) · 336 unmodified lines | |||
| 337 | 337 | ||
| 338 | 338 | ||
| 339 | US Patents (https://www.uspto.gov/) | 339 | US Patents (https://www.uspto.gov/) |
| 340 | ---------------------------------- | 340 | ----------------------------------- |
| 341 | 341 | ||
| 342 | US 5925841 | 342 | US 5925841 |
| 343 | Digital Sampling Instrument employing cache memory (Jul. 20, 1999) | 343 | Digital Sampling Instrument employing cache memory (Jul. 20, 1999) |
| @@ -143,7 +143,7 @@ timestamp shows when the information is put together by the driver · 142 unmodified lines | |||
| 143 | before returning from the ``STATUS`` and ``STATUS_EXT`` ioctl. in most cases | 143 | before returning from the ``STATUS`` and ``STATUS_EXT`` ioctl. in most cases |
| 144 | this driver_timestamp will be identical to the regular system tstamp. | 144 | this driver_timestamp will be identical to the regular system tstamp. |
| 145 | 145 | ||
| 146 | Examples of typestamping with HDaudio: | 146 | Examples of timestamping with HDAudio: |
| 147 | 147 | ||
| 148 | 1. DMA timestamp, no compensation for DMA+analog delay | 148 | 1. DMA timestamp, no compensation for DMA+analog delay |
| 149 | :: | 149 | :: |
| @@ -130,7 +130,7 @@ chi usa solo stringe terminate. La versione sicura da usare è · 129 unmodified lines | |||
| 130 | strscpy(). (chi usa strscpy() e necessita di estendere la | 130 | strscpy(). (chi usa strscpy() e necessita di estendere la |
| 131 | terminazione con NUL deve aggiungere una chiamata a memset()) | 131 | terminazione con NUL deve aggiungere una chiamata a memset()) |
| 132 | 132 | ||
| 133 | Se il chiamate no usa stringhe terminate con NUL, allore strncpy()() | 133 | Se il chiamate no usa stringhe terminate con NUL, allore strncpy() |
| 134 | può continuare ad essere usata, ma i buffer di destinazione devono essere | 134 | può continuare ad essere usata, ma i buffer di destinazione devono essere |
| 135 | marchiati con l'attributo `__nonstring <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_ | 135 | marchiati con l'attributo `__nonstring <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_ |
| 136 | per evitare avvisi durante la compilazione. | 136 | per evitare avvisi durante la compilazione. |
| @@ -6130,7 +6130,7 @@ HvCallSendSyntheticClusterIpi, HvCallSendSyntheticClusterIpiEx. · 6129 unmodified lines | |||
| 6130 | 8.21 KVM_CAP_HYPERV_DIRECT_TLBFLUSH | 6130 | 8.21 KVM_CAP_HYPERV_DIRECT_TLBFLUSH |
| 6131 | ----------------------------------- | 6131 | ----------------------------------- |
| 6132 | 6132 | ||
| 6133 | :Architecture: x86 | 6133 | :Architectures: x86 |
| 6134 | 6134 | ||
| 6135 | This capability indicates that KVM running on top of Hyper-V hypervisor | 6135 | This capability indicates that KVM running on top of Hyper-V hypervisor |
| 6136 | enables Direct TLB flush for its guests meaning that TLB flush | 6136 | enables Direct TLB flush for its guests meaning that TLB flush |
| @@ -6143,19 +6143,33 @@ in CPUID and only exposes Hyper-V identification. In this case, guest · 6 unmodified lines | |||
| 6143 | thinks it's running on Hyper-V and only use Hyper-V hypercalls. | 6143 | thinks it's running on Hyper-V and only use Hyper-V hypercalls. |
| 6144 | 6144 | ||
| 6145 | 8.22 KVM_CAP_S390_VCPU_RESETS | 6145 | 8.22 KVM_CAP_S390_VCPU_RESETS |
| 6146 | ----------------------------- | ||
| 6146 | 6147 | ||
| 6147 | Architectures: s390 | 6148 | :Architectures: s390 |
| 6148 | 6149 | ||
| 6149 | This capability indicates that the KVM_S390_NORMAL_RESET and | 6150 | This capability indicates that the KVM_S390_NORMAL_RESET and |
| 6150 | KVM_S390_CLEAR_RESET ioctls are available. | 6151 | KVM_S390_CLEAR_RESET ioctls are available. |
| 6151 | 6152 | ||
| 6152 | 8.23 KVM_CAP_S390_PROTECTED | 6153 | 8.23 KVM_CAP_S390_PROTECTED |
| 6154 | --------------------------- | ||
| 6153 | 6155 | ||
| 6154 | Architecture: s390 | 6156 | :Architectures: s390 |
| 6155 | |||
| 6156 | 6157 | ||
| 6157 | This capability indicates that the Ultravisor has been initialized and | 6158 | This capability indicates that the Ultravisor has been initialized and |
| 6158 | KVM can therefore start protected VMs. | 6159 | KVM can therefore start protected VMs. |
| 6159 | This capability governs the KVM_S390_PV_COMMAND ioctl and the | 6160 | This capability governs the KVM_S390_PV_COMMAND ioctl and the |
| 6160 | KVM_MP_STATE_LOAD MP_STATE. KVM_SET_MP_STATE can fail for protected | 6161 | KVM_MP_STATE_LOAD MP_STATE. KVM_SET_MP_STATE can fail for protected |
| 6161 | guests when the state change is invalid. | 6162 | guests when the state change is invalid. |
| 6163 | |||
| 6164 | 8.24 KVM_CAP_STEAL_TIME | ||
| 6165 | ----------------------- | ||
| 6166 | |||
| 6167 | :Architectures: arm64, x86 | ||
| 6168 | |||
| 6169 | This capability indicates that KVM supports steal time accounting. | ||
| 6170 | When steal time accounting is supported it may be enabled with | ||
| 6171 | architecture-specific interfaces. This capability and the architecture- | ||
| 6172 | specific interfaces must be consistent, i.e. if one says the feature | ||
| 6173 | is supported, than the other should as well and vice versa. For arm64 | ||
| 6174 | see Documentation/virt/kvm/devices/vcpu.rst "KVM_ARM_VCPU_PVTIME_CTRL". | ||
| 6175 | For x86 see Documentation/virt/kvm/msr.rst "MSR_KVM_STEAL_TIME". | ||
| @@ -1694,7 +1694,6 @@ F: arch/arm/mach-cns3xxx/ · 1693 unmodified lines | |||
| 1694 | 1694 | ||
| 1695 | ARM/CAVIUM THUNDER NETWORK DRIVER | 1695 | ARM/CAVIUM THUNDER NETWORK DRIVER |
| 1696 | M: Sunil Goutham <sgoutham@marvell.com> | 1696 | M: Sunil Goutham <sgoutham@marvell.com> |
| 1697 | M: Robert Richter <rrichter@marvell.com> | ||
| 1698 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1697 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1699 | S: Supported | 1698 | S: Supported |
| 1700 | F: drivers/net/ethernet/cavium/thunder/ | 1699 | F: drivers/net/ethernet/cavium/thunder/ |
| @@ -3389,6 +3388,7 @@ M: Florian Fainelli <f.fainelli@gmail.com> · 1688 unmodified lines | |||
| 3389 | L: netdev@vger.kernel.org | 3388 | L: netdev@vger.kernel.org |
| 3390 | L: openwrt-devel@lists.openwrt.org (subscribers-only) | 3389 | L: openwrt-devel@lists.openwrt.org (subscribers-only) |
| 3391 | S: Supported | 3390 | S: Supported |
| 3391 | F: Documentation/devicetree/bindings/net/dsa/b53.txt | ||
| 3392 | F: drivers/net/dsa/b53/* | 3392 | F: drivers/net/dsa/b53/* |
| 3393 | F: include/linux/platform_data/b53.h | 3393 | F: include/linux/platform_data/b53.h |
| 3394 | 3394 | ||
| @@ -3574,13 +3574,28 @@ L: bcm-kernel-feedback-list@broadcom.com · 179 unmodified lines | |||
| 3574 | S: Maintained | 3574 | S: Maintained |
| 3575 | F: drivers/phy/broadcom/phy-brcm-usb* | 3575 | F: drivers/phy/broadcom/phy-brcm-usb* |
| 3576 | 3576 | ||
| 3577 | BROADCOM ETHERNET PHY DRIVERS | ||
| 3578 | M: Florian Fainelli <f.fainelli@gmail.com> | ||
| 3579 | L: bcm-kernel-feedback-list@broadcom.com | ||
| 3580 | L: netdev@vger.kernel.org | ||
| 3581 | S: Supported | ||
| 3582 | F: Documentation/devicetree/bindings/net/broadcom-bcm87xx.txt | ||
| 3583 | F: drivers/net/phy/bcm*.[ch] | ||
| 3584 | F: drivers/net/phy/broadcom.c | ||
| 3585 | F: include/linux/brcmphy.h | ||
| 3586 | |||
| 3577 | BROADCOM GENET ETHERNET DRIVER | 3587 | BROADCOM GENET ETHERNET DRIVER |
| 3578 | M: Doug Berger <opendmb@gmail.com> | 3588 | M: Doug Berger <opendmb@gmail.com> |
| 3579 | M: Florian Fainelli <f.fainelli@gmail.com> | 3589 | M: Florian Fainelli <f.fainelli@gmail.com> |
| 3580 | L: bcm-kernel-feedback-list@broadcom.com | 3590 | L: bcm-kernel-feedback-list@broadcom.com |
| 3581 | L: netdev@vger.kernel.org | 3591 | L: netdev@vger.kernel.org |
| 3582 | S: Supported | 3592 | S: Supported |
| 3593 | F: Documentation/devicetree/bindings/net/brcm,bcmgenet.txt | ||
| 3594 | F: Documentation/devicetree/bindings/net/brcm,unimac-mdio.txt | ||
| 3583 | F: drivers/net/ethernet/broadcom/genet/ | 3595 | F: drivers/net/ethernet/broadcom/genet/ |
| 3596 | F: drivers/net/mdio/mdio-bcm-unimac.c | ||
| 3597 | F: include/linux/platform_data/bcmgenet.h | ||
| 3598 | F: include/linux/platform_data/mdio-bcm-unimac.h | ||
| 3584 | 3599 | ||
| 3585 | BROADCOM IPROC ARM ARCHITECTURE | 3600 | BROADCOM IPROC ARM ARCHITECTURE |
| 3586 | M: Ray Jui <rjui@broadcom.com> | 3601 | M: Ray Jui <rjui@broadcom.com> |
| @@ -3932,8 +3947,8 @@ W: https://wireless.wiki.kernel.org/en/users/Drivers/carl9170 · 345 unmodified lines | |||
| 3932 | F: drivers/net/wireless/ath/carl9170/ | 3947 | F: drivers/net/wireless/ath/carl9170/ |
| 3933 | 3948 | ||
| 3934 | CAVIUM I2C DRIVER | 3949 | CAVIUM I2C DRIVER |
| 3935 | M: Robert Richter <rrichter@marvell.com> | 3950 | M: Robert Richter <rric@kernel.org> |
| 3936 | S: Supported | 3951 | S: Odd Fixes |
| 3937 | W: http://www.marvell.com | 3952 | W: http://www.marvell.com |
| 3938 | F: drivers/i2c/busses/i2c-octeon* | 3953 | F: drivers/i2c/busses/i2c-octeon* |
| 3939 | F: drivers/i2c/busses/i2c-thunderx* | 3954 | F: drivers/i2c/busses/i2c-thunderx* |
| @@ -3948,8 +3963,8 @@ W: http://www.marvell.com · 8 unmodified lines | |||
| 3948 | F: drivers/net/ethernet/cavium/liquidio/ | 3963 | F: drivers/net/ethernet/cavium/liquidio/ |
| 3949 | 3964 | ||
| 3950 | CAVIUM MMC DRIVER | 3965 | CAVIUM MMC DRIVER |
| 3951 | M: Robert Richter <rrichter@marvell.com> | 3966 | M: Robert Richter <rric@kernel.org> |
| 3952 | S: Supported | 3967 | S: Odd Fixes |
| 3953 | W: http://www.marvell.com | 3968 | W: http://www.marvell.com |
| 3954 | F: drivers/mmc/host/cavium* | 3969 | F: drivers/mmc/host/cavium* |
| 3955 | 3970 | ||
| @@ -3961,9 +3976,9 @@ W: http://www.marvell.com · 5 unmodified lines | |||
| 3961 | F: drivers/crypto/cavium/cpt/ | 3976 | F: drivers/crypto/cavium/cpt/ |
| 3962 | 3977 | ||
| 3963 | CAVIUM THUNDERX2 ARM64 SOC | 3978 | CAVIUM THUNDERX2 ARM64 SOC |
| 3964 | M: Robert Richter <rrichter@marvell.com> | 3979 | M: Robert Richter <rric@kernel.org> |
| 3965 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 3980 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 3966 | S: Maintained | 3981 | S: Odd Fixes |
| 3967 | F: Documentation/devicetree/bindings/arm/cavium-thunder2.txt | 3982 | F: Documentation/devicetree/bindings/arm/cavium-thunder2.txt |
| 3968 | F: arch/arm64/boot/dts/cavium/thunder2-99xx* | 3983 | F: arch/arm64/boot/dts/cavium/thunder2-99xx* |
| 3969 | 3984 | ||
| @@ -4242,6 +4257,8 @@ S: Maintained · 272 unmodified lines | |||
| 4242 | F: .clang-format | 4257 | F: .clang-format |
| 4243 | 4258 | ||
| 4244 | CLANG/LLVM BUILD SUPPORT | 4259 | CLANG/LLVM BUILD SUPPORT |
| 4260 | M: Nathan Chancellor <natechancellor@gmail.com> | ||
| 4261 | M: Nick Desaulniers <ndesaulniers@google.com> | ||
| 4245 | L: clang-built-linux@googlegroups.com | 4262 | L: clang-built-linux@googlegroups.com |
| 4246 | S: Supported | 4263 | S: Supported |
| 4247 | W: https://clangbuiltlinux.github.io/ | 4264 | W: https://clangbuiltlinux.github.io/ |
| @@ -5240,6 +5257,7 @@ DOCUMENTATION · 992 unmodified lines | |||
| 5240 | M: Jonathan Corbet <corbet@lwn.net> | 5257 | M: Jonathan Corbet <corbet@lwn.net> |
| 5241 | L: linux-doc@vger.kernel.org | 5258 | L: linux-doc@vger.kernel.org |
| 5242 | S: Maintained | 5259 | S: Maintained |
| 5260 | P: Documentation/doc-guide/maintainer-profile.rst | ||
| 5243 | T: git git://git.lwn.net/linux.git docs-next | 5261 | T: git git://git.lwn.net/linux.git docs-next |
| 5244 | F: Documentation/ | 5262 | F: Documentation/ |
| 5245 | F: scripts/documentation-file-ref-check | 5263 | F: scripts/documentation-file-ref-check |
| @@ -6174,16 +6192,15 @@ F: drivers/edac/highbank* · 928 unmodified lines | |||
| 6174 | 6192 | ||
| 6175 | EDAC-CAVIUM OCTEON | 6193 | EDAC-CAVIUM OCTEON |
| 6176 | M: Ralf Baechle <ralf@linux-mips.org> | 6194 | M: Ralf Baechle <ralf@linux-mips.org> |
| 6177 | M: Robert Richter <rrichter@marvell.com> | ||
| 6178 | L: linux-edac@vger.kernel.org | 6195 | L: linux-edac@vger.kernel.org |
| 6179 | L: linux-mips@vger.kernel.org | 6196 | L: linux-mips@vger.kernel.org |
| 6180 | S: Supported | 6197 | S: Supported |
| 6181 | F: drivers/edac/octeon_edac* | 6198 | F: drivers/edac/octeon_edac* |
| 6182 | 6199 | ||
| 6183 | EDAC-CAVIUM THUNDERX | 6200 | EDAC-CAVIUM THUNDERX |
| 6184 | M: Robert Richter <rrichter@marvell.com> | 6201 | M: Robert Richter <rric@kernel.org> |
| 6185 | L: linux-edac@vger.kernel.org | 6202 | L: linux-edac@vger.kernel.org |
| 6186 | S: Supported | 6203 | S: Odd Fixes |
| 6187 | F: drivers/edac/thunderx_edac* | 6204 | F: drivers/edac/thunderx_edac* |
| 6188 | 6205 | ||
| 6189 | EDAC-CORE | 6206 | EDAC-CORE |
| @@ -6191,7 +6208,7 @@ M: Borislav Petkov <bp@alien8.de> · 1 unmodified line | |||
| 6191 | M: Mauro Carvalho Chehab <mchehab@kernel.org> | 6208 | M: Mauro Carvalho Chehab <mchehab@kernel.org> |
| 6192 | M: Tony Luck <tony.luck@intel.com> | 6209 | M: Tony Luck <tony.luck@intel.com> |
| 6193 | R: James Morse <james.morse@arm.com> | 6210 | R: James Morse <james.morse@arm.com> |
| 6194 | R: Robert Richter <rrichter@marvell.com> | 6211 | R: Robert Richter <rric@kernel.org> |
| 6195 | L: linux-edac@vger.kernel.org | 6212 | L: linux-edac@vger.kernel.org |
| 6196 | S: Supported | 6213 | S: Supported |
| 6197 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next | 6214 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next |
| @@ -6495,7 +6512,6 @@ F: net/bridge/ · 297 unmodified lines | |||
| 6495 | 6512 | ||
| 6496 | ETHERNET PHY LIBRARY | 6513 | ETHERNET PHY LIBRARY |
| 6497 | M: Andrew Lunn <andrew@lunn.ch> | 6514 | M: Andrew Lunn <andrew@lunn.ch> |
| 6498 | M: Florian Fainelli <f.fainelli@gmail.com> | ||
| 6499 | M: Heiner Kallweit <hkallweit1@gmail.com> | 6515 | M: Heiner Kallweit <hkallweit1@gmail.com> |
| 6500 | R: Russell King <linux@armlinux.org.uk> | 6516 | R: Russell King <linux@armlinux.org.uk> |
| 6501 | L: netdev@vger.kernel.org | 6517 | L: netdev@vger.kernel.org |
| @@ -6885,6 +6901,14 @@ L: linuxppc-dev@lists.ozlabs.org · 383 unmodified lines | |||
| 6885 | S: Maintained | 6901 | S: Maintained |
| 6886 | F: drivers/dma/fsldma.* | 6902 | F: drivers/dma/fsldma.* |
| 6887 | 6903 | ||
| 6904 | FREESCALE DSPI DRIVER | ||
| 6905 | M: Vladimir Oltean <olteanv@gmail.com> | ||
| 6906 | L: linux-spi@vger.kernel.org | ||
| 6907 | S: Maintained | ||
| 6908 | F: Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt | ||
| 6909 | F: drivers/spi/spi-fsl-dspi.c | ||
| 6910 | F: include/linux/spi/spi-fsl-dspi.h | ||
| 6911 | |||
| 6888 | FREESCALE ENETC ETHERNET DRIVERS | 6912 | FREESCALE ENETC ETHERNET DRIVERS |
| 6889 | M: Claudiu Manoil <claudiu.manoil@nxp.com> | 6913 | M: Claudiu Manoil <claudiu.manoil@nxp.com> |
| 6890 | L: netdev@vger.kernel.org | 6914 | L: netdev@vger.kernel.org |
| @@ -8263,7 +8287,7 @@ IA64 (Itanium) PLATFORM · 1372 unmodified lines | |||
| 8263 | M: Tony Luck <tony.luck@intel.com> | 8287 | M: Tony Luck <tony.luck@intel.com> |
| 8264 | M: Fenghua Yu <fenghua.yu@intel.com> | 8288 | M: Fenghua Yu <fenghua.yu@intel.com> |
| 8265 | L: linux-ia64@vger.kernel.org | 8289 | L: linux-ia64@vger.kernel.org |
| 8266 | S: Maintained | 8290 | S: Odd Fixes |
| 8267 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git | 8291 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git |
| 8268 | F: Documentation/ia64/ | 8292 | F: Documentation/ia64/ |
| 8269 | F: arch/ia64/ | 8293 | F: arch/ia64/ |
| @@ -9783,7 +9807,7 @@ F: drivers/scsi/53c700* · 1513 unmodified lines | |||
| 9783 | 9807 | ||
| 9784 | LEAKING_ADDRESSES | 9808 | LEAKING_ADDRESSES |
| 9785 | M: Tobin C. Harding <me@tobin.cc> | 9809 | M: Tobin C. Harding <me@tobin.cc> |
| 9786 | M: Tycho Andersen <tycho@tycho.ws> | 9810 | M: Tycho Andersen <tycho@tycho.pizza> |
| 9787 | L: kernel-hardening@lists.openwall.com | 9811 | L: kernel-hardening@lists.openwall.com |
| 9788 | S: Maintained | 9812 | S: Maintained |
| 9789 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks.git | 9813 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks.git |
| @@ -13437,10 +13461,10 @@ F: Documentation/devicetree/bindings/pci/axis,artpec* · 3647 unmodified lines | |||
| 13437 | F: drivers/pci/controller/dwc/*artpec* | 13461 | F: drivers/pci/controller/dwc/*artpec* |
| 13438 | 13462 | ||
| 13439 | PCIE DRIVER FOR CAVIUM THUNDERX | 13463 | PCIE DRIVER FOR CAVIUM THUNDERX |
| 13440 | M: Robert Richter <rrichter@marvell.com> | 13464 | M: Robert Richter <rric@kernel.org> |
| 13441 | L: linux-pci@vger.kernel.org | 13465 | L: linux-pci@vger.kernel.org |
| 13442 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 13466 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 13443 | S: Supported | 13467 | S: Odd Fixes |
| 13444 | F: drivers/pci/controller/pci-thunder-* | 13468 | F: drivers/pci/controller/pci-thunder-* |
| 13445 | 13469 | ||
| 13446 | PCIE DRIVER FOR HISILICON | 13470 | PCIE DRIVER FOR HISILICON |
| @@ -13577,12 +13601,18 @@ F: kernel/events/* · 130 unmodified lines | |||
| 13577 | F: tools/lib/perf/ | 13601 | F: tools/lib/perf/ |
| 13578 | F: tools/perf/ | 13602 | F: tools/perf/ |
| 13579 | 13603 | ||
| 13580 | PERFORMANCE EVENTS SUBSYSTEM ARM64 PMU EVENTS | 13604 | PERFORMANCE EVENTS TOOLING ARM64 |
| 13581 | R: John Garry <john.garry@huawei.com> | 13605 | R: John Garry <john.garry@huawei.com> |
| 13582 | R: Will Deacon <will@kernel.org> | 13606 | R: Will Deacon <will@kernel.org> |
| 13607 | R: Mathieu Poirier <mathieu.poirier@linaro.org> | ||
| 13608 | R: Leo Yan <leo.yan@linaro.org> | ||
| 13583 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 13609 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 13584 | S: Supported | 13610 | S: Supported |
| 13611 | F: tools/build/feature/test-libopencsd.c | ||
| 13612 | F: tools/perf/arch/arm*/ | ||
| 13585 | F: tools/perf/pmu-events/arch/arm64/ | 13613 | F: tools/perf/pmu-events/arch/arm64/ |
| 13614 | F: tools/perf/util/arm-spe* | ||
| 13615 | F: tools/perf/util/cs-etm* | ||
| 13586 | 13616 | ||
| 13587 | PERSONALITY HANDLING | 13617 | PERSONALITY HANDLING |
| 13588 | M: Christoph Hellwig <hch@infradead.org> | 13618 | M: Christoph Hellwig <hch@infradead.org> |
| @@ -14373,7 +14403,7 @@ M: Rob Clark <robdclark@gmail.com> · 784 unmodified lines | |||
| 14373 | L: iommu@lists.linux-foundation.org | 14403 | L: iommu@lists.linux-foundation.org |
| 14374 | L: linux-arm-msm@vger.kernel.org | 14404 | L: linux-arm-msm@vger.kernel.org |
| 14375 | S: Maintained | 14405 | S: Maintained |
| 14376 | F: drivers/iommu/qcom_iommu.c | 14406 | F: drivers/iommu/arm/arm-smmu/qcom_iommu.c |
| 14377 | 14407 | ||
| 14378 | QUALCOMM IPCC MAILBOX DRIVER | 14408 | QUALCOMM IPCC MAILBOX DRIVER |
| 14379 | M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> | 14409 | M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
| @@ -15554,6 +15584,7 @@ F: include/uapi/linux/sed* · 1174 unmodified lines | |||
| 15554 | SECURITY CONTACT | 15584 | SECURITY CONTACT |
| 15555 | M: Security Officers <security@kernel.org> | 15585 | M: Security Officers <security@kernel.org> |
| 15556 | S: Supported | 15586 | S: Supported |
| 15587 | F: Documentation/admin-guide/security-bugs.rst | ||
| 15557 | 15588 | ||
| 15558 | SECURITY SUBSYSTEM | 15589 | SECURITY SUBSYSTEM |
| 15559 | M: James Morris <jmorris@namei.org> | 15590 | M: James Morris <jmorris@namei.org> |
| @@ -17222,8 +17253,8 @@ S: Maintained · 1662 unmodified lines | |||
| 17222 | F: drivers/net/thunderbolt.c | 17253 | F: drivers/net/thunderbolt.c |
| 17223 | 17254 | ||
| 17224 | THUNDERX GPIO DRIVER | 17255 | THUNDERX GPIO DRIVER |
| 17225 | M: Robert Richter <rrichter@marvell.com> | 17256 | M: Robert Richter <rric@kernel.org> |
| 17226 | S: Maintained | 17257 | S: Odd Fixes |
| 17227 | F: drivers/gpio/gpio-thunderx.c | 17258 | F: drivers/gpio/gpio-thunderx.c |
| 17228 | 17259 | ||
| 17229 | TI AM437X VPFE DRIVER | 17260 | TI AM437X VPFE DRIVER |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 9 | 3 | PATCHLEVEL = 9 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc3 | 5 | EXTRAVERSION = -rc5 |
| 6 | NAME = Kleptomaniac Octopus | 6 | NAME = Kleptomaniac Octopus |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| @@ -882,10 +882,6 @@ KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections · 873 unmodified lines | |||
| 882 | LDFLAGS_vmlinux += --gc-sections | 882 | LDFLAGS_vmlinux += --gc-sections |
| 883 | endif | 883 | endif |
| 884 | 884 | ||
| 885 | ifdef CONFIG_LIVEPATCH | ||
| 886 | KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone) | ||
| 887 | endif | ||
| 888 | |||
| 889 | ifdef CONFIG_SHADOW_CALL_STACK | 885 | ifdef CONFIG_SHADOW_CALL_STACK |
| 890 | CC_FLAGS_SCS := -fsanitize=shadow-call-stack | 886 | CC_FLAGS_SCS := -fsanitize=shadow-call-stack |
| 891 | KBUILD_CFLAGS += $(CC_FLAGS_SCS) | 887 | KBUILD_CFLAGS += $(CC_FLAGS_SCS) |
| @@ -88,6 +88,8 @@ · 87 unmodified lines | |||
| 88 | 88 | ||
| 89 | arcpct: pct { | 89 | arcpct: pct { |
| 90 | compatible = "snps,archs-pct"; | 90 | compatible = "snps,archs-pct"; |
| 91 | interrupt-parent = <&cpu_intc>; | ||
| 92 | interrupts = <20>; | ||
| 91 | }; | 93 | }; |
| 92 | 94 | ||
| 93 | /* TIMER0 with interrupt for clockevent */ | 95 | /* TIMER0 with interrupt for clockevent */ |
| @@ -208,7 +210,7 @@ · 114 unmodified lines | |||
| 208 | reg = <0x8000 0x2000>; | 210 | reg = <0x8000 0x2000>; |
| 209 | interrupts = <10>; | 211 | interrupts = <10>; |
| 210 | interrupt-names = "macirq"; | 212 | interrupt-names = "macirq"; |
| 211 | phy-mode = "rgmii"; | 213 | phy-mode = "rgmii-id"; |
| 212 | snps,pbl = <32>; | 214 | snps,pbl = <32>; |
| 213 | snps,multicast-filter-bins = <256>; | 215 | snps,multicast-filter-bins = <256>; |
| 214 | clocks = <&gmacclk>; | 216 | clocks = <&gmacclk>; |
| @@ -226,7 +228,7 @@ · 11 unmodified lines | |||
| 226 | #address-cells = <1>; | 228 | #address-cells = <1>; |
| 227 | #size-cells = <0>; | 229 | #size-cells = <0>; |
| 228 | compatible = "snps,dwmac-mdio"; | 230 | compatible = "snps,dwmac-mdio"; |
| 229 | phy0: ethernet-phy@0 { | 231 | phy0: ethernet-phy@0 { /* Micrel KSZ9031 */ |
| 230 | reg = <0>; | 232 | reg = <0>; |
| 231 | }; | 233 | }; |
| 232 | }; | 234 | }; |
| @@ -18,10 +18,10 @@ · 17 unmodified lines | |||
| 18 | * vineetg: April 2010 | 18 | * vineetg: April 2010 |
| 19 | * -Switched pgtable_t from being struct page * to unsigned long | 19 | * -Switched pgtable_t from being struct page * to unsigned long |
| 20 | * =Needed so that Page Table allocator (pte_alloc_one) is not forced to | 20 | * =Needed so that Page Table allocator (pte_alloc_one) is not forced to |
| 21 | * to deal with struct page. Thay way in future we can make it allocate | 21 | * deal with struct page. That way in future we can make it allocate |
| 22 | * multiple PG Tbls in one Page Frame | 22 | * multiple PG Tbls in one Page Frame |
| 23 | * =sweet side effect is avoiding calls to ugly page_address( ) from the | 23 | * =sweet side effect is avoiding calls to ugly page_address( ) from the |
| 24 | * pg-tlb allocator sub-sys (pte_alloc_one, ptr_free, pmd_populate | 24 | * pg-tlb allocator sub-sys (pte_alloc_one, ptr_free, pmd_populate) |
| 25 | * | 25 | * |
| 26 | * Amit Bhor, Sameer Dhavale: Codito Technologies 2004 | 26 | * Amit Bhor, Sameer Dhavale: Codito Technologies 2004 |
| 27 | */ | 27 | */ |
| @@ -562,7 +562,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 561 unmodified lines | |||
| 562 | { | 562 | { |
| 563 | struct arc_reg_pct_build pct_bcr; | 563 | struct arc_reg_pct_build pct_bcr; |
| 564 | struct arc_reg_cc_build cc_bcr; | 564 | struct arc_reg_cc_build cc_bcr; |
| 565 | int i, has_interrupts; | 565 | int i, has_interrupts, irq; |
| 566 | int counter_size; /* in bits */ | 566 | int counter_size; /* in bits */ |
| 567 | 567 | ||
| 568 | union cc_name { | 568 | union cc_name { |
| @@ -637,13 +637,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 68 unmodified lines | |||
| 637 | .attr_groups = arc_pmu->attr_groups, | 637 | .attr_groups = arc_pmu->attr_groups, |
| 638 | }; | 638 | }; |
| 639 | 639 | ||
| 640 | if (has_interrupts) { | 640 | if (has_interrupts && (irq = platform_get_irq(pdev, 0) >= 0)) { |
| 641 | int irq = platform_get_irq(pdev, 0); | ||
| 642 | |||
| 643 | if (irq < 0) { | ||
| 644 | pr_err("Cannot get IRQ number for the platform\n"); | ||
| 645 | return -ENODEV; | ||
| 646 | } | ||
| 647 | 641 | ||
| 648 | arc_pmu->irq = irq; | 642 | arc_pmu->irq = irq; |
| 649 | 643 | ||
| @@ -652,9 +646,9 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 652 | this_cpu_ptr(&arc_pmu_cpu)); | 646 | this_cpu_ptr(&arc_pmu_cpu)); |
| 653 | 647 | ||
| 654 | on_each_cpu(arc_cpu_pmu_irq_init, &irq, 1); | 648 | on_each_cpu(arc_cpu_pmu_irq_init, &irq, 1); |
| 655 | 649 | } else { | |
| 656 | } else | ||
| 657 | arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; | 650 | arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; |
| 651 | } | ||
| 658 | 652 | ||
| 659 | /* | 653 | /* |
| 660 | * perf parser doesn't really like '-' symbol in events name, so let's | 654 | * perf parser doesn't really like '-' symbol in events name, so let's |
| @@ -18,44 +18,37 @@ · 17 unmodified lines | |||
| 18 | 18 | ||
| 19 | #define ARC_PATH_MAX 256 | 19 | #define ARC_PATH_MAX 256 |
| 20 | 20 | ||
| 21 | /* | 21 | static noinline void print_regs_scratch(struct pt_regs *regs) |
| 22 | * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) | ||
| 23 | * -Prints 3 regs per line and a CR. | ||
| 24 | * -To continue, callee regs right after scratch, special handling of CR | ||
| 25 | */ | ||
| 26 | static noinline void print_reg_file(long *reg_rev, int start_num) | ||
| 27 | { | 22 | { |
| 28 | unsigned int i; | 23 | pr_cont("BTA: 0x%08lx\n SP: 0x%08lx FP: 0x%08lx BLK: %pS\n", |
| 29 | char buf[512]; | 24 | regs->bta, regs->sp, regs->fp, (void *)regs->blink); |
| 30 | int n = 0, len = sizeof(buf); | 25 | pr_cont("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n", |
| 31 | 26 | regs->lp_start, regs->lp_end, regs->lp_count); | |
| 32 | for (i = start_num; i < start_num + 13; i++) { | ||
| 33 | n += scnprintf(buf + n, len - n, "r%02u: 0x%08lx\t", | ||
| 34 | i, (unsigned long)*reg_rev); | ||
| 35 | |||
| 36 | if (((i + 1) % 3) == 0) | ||
| 37 | n += scnprintf(buf + n, len - n, "\n"); | ||
| 38 | |||
| 39 | /* because pt_regs has regs reversed: r12..r0, r25..r13 */ | ||
| 40 | if (is_isa_arcv2() && start_num == 0) | ||
| 41 | reg_rev++; | ||
| 42 | else | ||
| 43 | reg_rev--; | ||
| 44 | } | ||
| 45 | |||
| 46 | if (start_num != 0) | ||
| 47 | n += scnprintf(buf + n, len - n, "\n\n"); | ||
| 48 | 27 | ||
| 49 | /* To continue printing callee regs on same line as scratch regs */ | 28 | pr_info("r00: 0x%08lx\tr01: 0x%08lx\tr02: 0x%08lx\n" \ |
| 50 | if (start_num == 0) | 29 | "r03: 0x%08lx\tr04: 0x%08lx\tr05: 0x%08lx\n" \ |
| 51 | pr_info("%s", buf); | 30 | "r06: 0x%08lx\tr07: 0x%08lx\tr08: 0x%08lx\n" \ |
| 52 | else | 31 | "r09: 0x%08lx\tr10: 0x%08lx\tr11: 0x%08lx\n" \ |
| 53 | pr_cont("%s\n", buf); | 32 | "r12: 0x%08lx\t", |
| 33 | regs->r0, regs->r1, regs->r2, | ||
| 34 | regs->r3, regs->r4, regs->r5, | ||
| 35 | regs->r6, regs->r7, regs->r8, | ||
| 36 | regs->r9, regs->r10, regs->r11, | ||
| 37 | regs->r12); | ||
| 54 | } | 38 | } |
| 55 | 39 | ||
| 56 | static void show_callee_regs(struct callee_regs *cregs) | 40 | static void print_regs_callee(struct callee_regs *regs) |
| 57 | { | 41 | { |
| 58 | print_reg_file(&(cregs->r13), 13); | 42 | pr_cont("r13: 0x%08lx\tr14: 0x%08lx\n" \ |
| 43 | "r15: 0x%08lx\tr16: 0x%08lx\tr17: 0x%08lx\n" \ | ||
| 44 | "r18: 0x%08lx\tr19: 0x%08lx\tr20: 0x%08lx\n" \ | ||
| 45 | "r21: 0x%08lx\tr22: 0x%08lx\tr23: 0x%08lx\n" \ | ||
| 46 | "r24: 0x%08lx\tr25: 0x%08lx\n", | ||
| 47 | regs->r13, regs->r14, | ||
| 48 | regs->r15, regs->r16, regs->r17, | ||
| 49 | regs->r18, regs->r19, regs->r20, | ||
| 50 | regs->r21, regs->r22, regs->r23, | ||
| 51 | regs->r24, regs->r25); | ||
| 59 | } | 52 | } |
| 60 | 53 | ||
| 61 | static void print_task_path_n_nm(struct task_struct *tsk) | 54 | static void print_task_path_n_nm(struct task_struct *tsk) |
| @@ -175,7 +168,7 @@ static void show_ecr_verbose(struct pt_regs *regs) · 113 unmodified lines | |||
| 175 | void show_regs(struct pt_regs *regs) | 168 | void show_regs(struct pt_regs *regs) |
| 176 | { | 169 | { |
| 177 | struct task_struct *tsk = current; | 170 | struct task_struct *tsk = current; |
| 178 | struct callee_regs *cregs; | 171 | struct callee_regs *cregs = (struct callee_regs *)tsk->thread.callee_reg; |
| 179 | 172 | ||
| 180 | /* | 173 | /* |
| 181 | * generic code calls us with preemption disabled, but some calls | 174 | * generic code calls us with preemption disabled, but some calls |
| @@ -204,25 +197,15 @@ void show_regs(struct pt_regs *regs) · 22 unmodified lines | |||
| 204 | STS_BIT(regs, A2), STS_BIT(regs, A1), | 197 | STS_BIT(regs, A2), STS_BIT(regs, A1), |
| 205 | STS_BIT(regs, E2), STS_BIT(regs, E1)); | 198 | STS_BIT(regs, E2), STS_BIT(regs, E1)); |
| 206 | #else | 199 | #else |
| 207 | pr_cont(" [%2s%2s%2s%2s]", | 200 | pr_cont(" [%2s%2s%2s%2s] ", |
| 208 | STS_BIT(regs, IE), | 201 | STS_BIT(regs, IE), |
| 209 | (regs->status32 & STATUS_U_MASK) ? "U " : "K ", | 202 | (regs->status32 & STATUS_U_MASK) ? "U " : "K ", |
| 210 | STS_BIT(regs, DE), STS_BIT(regs, AE)); | 203 | STS_BIT(regs, DE), STS_BIT(regs, AE)); |
| 211 | #endif | 204 | #endif |
| 212 | pr_cont(" BTA: 0x%08lx\n SP: 0x%08lx FP: 0x%08lx BLK: %pS\n", | ||
| 213 | regs->bta, regs->sp, regs->fp, (void *)regs->blink); | ||
| 214 | pr_info("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n", | ||
| 215 | regs->lp_start, regs->lp_end, regs->lp_count); | ||
| 216 | |||
| 217 | /* print regs->r0 thru regs->r12 | ||
| 218 | * Sequential printing was generating horrible code | ||
| 219 | */ | ||
| 220 | print_reg_file(&(regs->r0), 0); | ||
| 221 | 205 | ||
| 222 | /* If Callee regs were saved, display them too */ | 206 | print_regs_scratch(regs); |
| 223 | cregs = (struct callee_regs *)current->thread.callee_reg; | ||
| 224 | if (cregs) | 207 | if (cregs) |
| 225 | show_callee_regs(cregs); | 208 | print_regs_callee(cregs); |
| 226 | 209 | ||
| 227 | preempt_disable(); | 210 | preempt_disable(); |
| 228 | } | 211 | } |
| @@ -26,8 +26,8 @@ static unsigned long low_mem_sz; · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | #ifdef CONFIG_HIGHMEM | 27 | #ifdef CONFIG_HIGHMEM |
| 28 | static unsigned long min_high_pfn, max_high_pfn; | 28 | static unsigned long min_high_pfn, max_high_pfn; |
| 29 | static u64 high_mem_start; | 29 | static phys_addr_t high_mem_start; |
| 30 | static u64 high_mem_sz; | 30 | static phys_addr_t high_mem_sz; |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #ifdef CONFIG_DISCONTIGMEM | 33 | #ifdef CONFIG_DISCONTIGMEM |
| @@ -69,6 +69,7 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) · 35 unmodified lines | |||
| 69 | high_mem_sz = size; | 69 | high_mem_sz = size; |
| 70 | in_use = 1; | 70 | in_use = 1; |
| 71 | memblock_add_node(base, size, 1); | 71 | memblock_add_node(base, size, 1); |
| 72 | memblock_reserve(base, size); | ||
| 72 | #endif | 73 | #endif |
| 73 | } | 74 | } |
| 74 | 75 | ||
| @@ -157,7 +158,7 @@ void __init setup_arch_memory(void) · 82 unmodified lines | |||
| 157 | min_high_pfn = PFN_DOWN(high_mem_start); | 158 | min_high_pfn = PFN_DOWN(high_mem_start); |
| 158 | max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz); | 159 | max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz); |
| 159 | 160 | ||
| 160 | max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn; | 161 | max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn; |
| 161 | 162 | ||
| 162 | high_memory = (void *)(min_high_pfn << PAGE_SHIFT); | 163 | high_memory = (void *)(min_high_pfn << PAGE_SHIFT); |
| 163 | kmap_init(); | 164 | kmap_init(); |
| @@ -166,22 +167,26 @@ void __init setup_arch_memory(void) · 2 unmodified lines | |||
| 166 | free_area_init(max_zone_pfn); | 167 | free_area_init(max_zone_pfn); |
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | /* | 170 | static void __init highmem_init(void) |
| 170 | * mem_init - initializes memory | ||
| 171 | * | ||
| 172 | * Frees up bootmem | ||
| 173 | * Calculates and displays memory available/used | ||
| 174 | */ | ||
| 175 | void __init mem_init(void) | ||
| 176 | { | 171 | { |
| 177 | #ifdef CONFIG_HIGHMEM | 172 | #ifdef CONFIG_HIGHMEM |
| 178 | unsigned long tmp; | 173 | unsigned long tmp; |
| 179 | 174 | ||
| 180 | reset_all_zones_managed_pages(); | 175 | memblock_free(high_mem_start, high_mem_sz); |
| 181 | for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++) | 176 | for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++) |
| 182 | free_highmem_page(pfn_to_page(tmp)); | 177 | free_highmem_page(pfn_to_page(tmp)); |
| 183 | #endif | 178 | #endif |
| 179 | } | ||
| 184 | 180 | ||
| 181 | /* | ||
| 182 | * mem_init - initializes memory | ||
| 183 | * | ||
| 184 | * Frees up bootmem | ||
| 185 | * Calculates and displays memory available/used | ||
| 186 | */ | ||
| 187 | void __init mem_init(void) | ||
| 188 | { | ||
| 185 | memblock_free_all(); | 189 | memblock_free_all(); |
| 190 | highmem_init(); | ||
| 186 | mem_init_print_info(NULL); | 191 | mem_init_print_info(NULL); |
| 187 | } | 192 | } |
| @@ -33,7 +33,6 @@ · 32 unmodified lines | |||
| 33 | #define CTOP_AUX_DPC (CTOP_AUX_BASE + 0x02C) | 33 | #define CTOP_AUX_DPC (CTOP_AUX_BASE + 0x02C) |
| 34 | #define CTOP_AUX_LPC (CTOP_AUX_BASE + 0x030) | 34 | #define CTOP_AUX_LPC (CTOP_AUX_BASE + 0x030) |
| 35 | #define CTOP_AUX_EFLAGS (CTOP_AUX_BASE + 0x080) | 35 | #define CTOP_AUX_EFLAGS (CTOP_AUX_BASE + 0x080) |
| 36 | #define CTOP_AUX_IACK (CTOP_AUX_BASE + 0x088) | ||
| 37 | #define CTOP_AUX_GPA1 (CTOP_AUX_BASE + 0x08C) | 36 | #define CTOP_AUX_GPA1 (CTOP_AUX_BASE + 0x08C) |
| 38 | #define CTOP_AUX_UDMC (CTOP_AUX_BASE + 0x300) | 37 | #define CTOP_AUX_UDMC (CTOP_AUX_BASE + 0x300) |
| 39 | 38 | ||
| @@ -217,7 +217,7 @@ · 216 unmodified lines | |||
| 217 | }; | 217 | }; |
| 218 | 218 | ||
| 219 | qspi: spi@27200 { | 219 | qspi: spi@27200 { |
| 220 | compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"; | 220 | compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"; |
| 221 | reg = <0x027200 0x184>, | 221 | reg = <0x027200 0x184>, |
| 222 | <0x027000 0x124>, | 222 | <0x027000 0x124>, |
| 223 | <0x11c408 0x004>, | 223 | <0x11c408 0x004>, |
| @@ -284,7 +284,7 @@ · 283 unmodified lines | |||
| 284 | }; | 284 | }; |
| 285 | 285 | ||
| 286 | qspi: spi@27200 { | 286 | qspi: spi@27200 { |
| 287 | compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"; | 287 | compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"; |
| 288 | reg = <0x027200 0x184>, | 288 | reg = <0x027200 0x184>, |
| 289 | <0x027000 0x124>, | 289 | <0x027000 0x124>, |
| 290 | <0x11c408 0x004>, | 290 | <0x11c408 0x004>, |
| @@ -488,7 +488,7 @@ · 487 unmodified lines | |||
| 488 | }; | 488 | }; |
| 489 | 489 | ||
| 490 | spi@18029200 { | 490 | spi@18029200 { |
| 491 | compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"; | 491 | compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"; |
| 492 | reg = <0x18029200 0x184>, | 492 | reg = <0x18029200 0x184>, |
| 493 | <0x18029000 0x124>, | 493 | <0x18029000 0x124>, |
| 494 | <0x1811b408 0x004>, | 494 | <0x1811b408 0x004>, |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | backlight: backlight-lvds { | 14 | backlight: backlight-lvds { |
| 15 | compatible = "pwm-backlight"; | 15 | compatible = "pwm-backlight"; |
| 16 | pwms = <&pwm3 0 20000>; | 16 | pwms = <&pwm3 0 20000 0>; |
| 17 | brightness-levels = <0 4 8 16 32 64 128 255>; | 17 | brightness-levels = <0 4 8 16 32 64 128 255>; |
| 18 | default-brightness-level = <6>; | 18 | default-brightness-level = <6>; |
| 19 | power-supply = <®_lcd>; | 19 | power-supply = <®_lcd>; |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | |||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | /* PRTWD2 rev 1 bitbang I2C for Ethernet Switch */ | 32 | /* PRTWD2 rev 1 bitbang I2C for Ethernet Switch */ |
| 33 | i2c@4 { | 33 | i2c { |
| 34 | compatible = "i2c-gpio"; | 34 | compatible = "i2c-gpio"; |
| 35 | pinctrl-names = "default"; | 35 | pinctrl-names = "default"; |
| 36 | pinctrl-0 = <&pinctrl_i2c4>; | 36 | pinctrl-0 = <&pinctrl_i2c4>; |
| @@ -22,8 +22,6 @@ · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | gpio-keys { | 23 | gpio-keys { |
| 24 | compatible = "gpio-keys"; | 24 | compatible = "gpio-keys"; |
| 25 | #address-cells = <1>; | ||
| 26 | #size-cells = <0>; | ||
| 27 | 25 | ||
| 28 | user-pb { | 26 | user-pb { |
| 29 | label = "user_pb"; | 27 | label = "user_pb"; |
| @@ -1026,7 +1026,7 @@ · 1025 unmodified lines | |||
| 1026 | #define MX6SX_PAD_QSPI1B_DQS__SIM_M_HADDR_15 0x01B0 0x04F8 0x0000 0x7 0x0 | 1026 | #define MX6SX_PAD_QSPI1B_DQS__SIM_M_HADDR_15 0x01B0 0x04F8 0x0000 0x7 0x0 |
| 1027 | #define MX6SX_PAD_QSPI1B_SCLK__QSPI1_B_SCLK 0x01B4 0x04FC 0x0000 0x0 0x0 | 1027 | #define MX6SX_PAD_QSPI1B_SCLK__QSPI1_B_SCLK 0x01B4 0x04FC 0x0000 0x0 0x0 |
| 1028 | #define MX6SX_PAD_QSPI1B_SCLK__UART3_DCE_RX 0x01B4 0x04FC 0x0840 0x1 0x4 | 1028 | #define MX6SX_PAD_QSPI1B_SCLK__UART3_DCE_RX 0x01B4 0x04FC 0x0840 0x1 0x4 |
| 1029 | #define MX6SX_PAD_QSPI1B_SCLK__UART3_DTE_TX 0x01B4 0x04FC 0x0000 0x0 0x0 | 1029 | #define MX6SX_PAD_QSPI1B_SCLK__UART3_DTE_TX 0x01B4 0x04FC 0x0000 0x1 0x0 |
| 1030 | #define MX6SX_PAD_QSPI1B_SCLK__ECSPI3_SCLK 0x01B4 0x04FC 0x0730 0x2 0x1 | 1030 | #define MX6SX_PAD_QSPI1B_SCLK__ECSPI3_SCLK 0x01B4 0x04FC 0x0730 0x2 0x1 |
| 1031 | #define MX6SX_PAD_QSPI1B_SCLK__ESAI_RX_HF_CLK 0x01B4 0x04FC 0x0780 0x3 0x2 | 1031 | #define MX6SX_PAD_QSPI1B_SCLK__ESAI_RX_HF_CLK 0x01B4 0x04FC 0x0780 0x3 0x2 |
| 1032 | #define MX6SX_PAD_QSPI1B_SCLK__CSI1_DATA_16 0x01B4 0x04FC 0x06DC 0x4 0x1 | 1032 | #define MX6SX_PAD_QSPI1B_SCLK__CSI1_DATA_16 0x01B4 0x04FC 0x06DC 0x4 0x1 |
| @@ -58,7 +58,7 @@ · 57 unmodified lines | |||
| 58 | <&clks IMX7D_ENET1_TIME_ROOT_CLK>; | 58 | <&clks IMX7D_ENET1_TIME_ROOT_CLK>; |
| 59 | assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>; | 59 | assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>; |
| 60 | assigned-clock-rates = <0>, <100000000>; | 60 | assigned-clock-rates = <0>, <100000000>; |
| 61 | phy-mode = "rgmii"; | 61 | phy-mode = "rgmii-id"; |
| 62 | phy-handle = <&fec1_phy>; | 62 | phy-handle = <&fec1_phy>; |
| 63 | status = "okay"; | 63 | status = "okay"; |
| 64 | 64 | ||
| @@ -394,7 +394,7 @@ · 393 unmodified lines | |||
| 394 | clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, | 394 | clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, |
| 395 | <&pcc3 IMX7ULP_CLK_PCTLC>; | 395 | <&pcc3 IMX7ULP_CLK_PCTLC>; |
| 396 | clock-names = "gpio", "port"; | 396 | clock-names = "gpio", "port"; |
| 397 | gpio-ranges = <&iomuxc1 0 0 32>; | 397 | gpio-ranges = <&iomuxc1 0 0 20>; |
| 398 | }; | 398 | }; |
| 399 | 399 | ||
| 400 | gpio_ptd: gpio@40af0000 { | 400 | gpio_ptd: gpio@40af0000 { |
| @@ -408,7 +408,7 @@ · 7 unmodified lines | |||
| 408 | clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, | 408 | clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, |
| 409 | <&pcc3 IMX7ULP_CLK_PCTLD>; | 409 | <&pcc3 IMX7ULP_CLK_PCTLD>; |
| 410 | clock-names = "gpio", "port"; | 410 | clock-names = "gpio", "port"; |
| 411 | gpio-ranges = <&iomuxc1 0 32 32>; | 411 | gpio-ranges = <&iomuxc1 0 32 12>; |
| 412 | }; | 412 | }; |
| 413 | 413 | ||
| 414 | gpio_pte: gpio@40b00000 { | 414 | gpio_pte: gpio@40b00000 { |
| @@ -422,7 +422,7 @@ · 7 unmodified lines | |||
| 422 | clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, | 422 | clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, |
| 423 | <&pcc3 IMX7ULP_CLK_PCTLE>; | 423 | <&pcc3 IMX7ULP_CLK_PCTLE>; |
| 424 | clock-names = "gpio", "port"; | 424 | clock-names = "gpio", "port"; |
| 425 | gpio-ranges = <&iomuxc1 0 64 32>; | 425 | gpio-ranges = <&iomuxc1 0 64 16>; |
| 426 | }; | 426 | }; |
| 427 | 427 | ||
| 428 | gpio_ptf: gpio@40b10000 { | 428 | gpio_ptf: gpio@40b10000 { |
| @@ -436,7 +436,7 @@ · 7 unmodified lines | |||
| 436 | clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, | 436 | clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, |
| 437 | <&pcc3 IMX7ULP_CLK_PCTLF>; | 437 | <&pcc3 IMX7ULP_CLK_PCTLF>; |
| 438 | clock-names = "gpio", "port"; | 438 | clock-names = "gpio", "port"; |
| 439 | gpio-ranges = <&iomuxc1 0 96 32>; | 439 | gpio-ranges = <&iomuxc1 0 96 20>; |
| 440 | }; | 440 | }; |
| 441 | }; | 441 | }; |
| 442 | 442 | ||
| @@ -51,6 +51,8 @@ · 50 unmodified lines | |||
| 51 | 51 | ||
| 52 | &mcbsp2 { | 52 | &mcbsp2 { |
| 53 | status = "okay"; | 53 | status = "okay"; |
| 54 | pinctrl-names = "default"; | ||
| 55 | pinctrl-0 = <&mcbsp2_pins>; | ||
| 54 | }; | 56 | }; |
| 55 | 57 | ||
| 56 | &charger { | 58 | &charger { |
| @@ -102,35 +104,18 @@ · 45 unmodified lines | |||
| 102 | regulator-max-microvolt = <3300000>; | 104 | regulator-max-microvolt = <3300000>; |
| 103 | }; | 105 | }; |
| 104 | 106 | ||
| 105 | lcd0: display@0 { | 107 | lcd0: display { |
| 106 | compatible = "panel-dpi"; | 108 | /* This isn't the exact LCD, but the timings meet spec */ |
| 107 | label = "28"; | 109 | compatible = "logicpd,type28"; |
| 108 | status = "okay"; | ||
| 109 | /* default-on; */ | ||
| 110 | pinctrl-names = "default"; | 110 | pinctrl-names = "default"; |
| 111 | pinctrl-0 = <&lcd_enable_pin>; | 111 | pinctrl-0 = <&lcd_enable_pin>; |
| 112 | enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; /* gpio155, lcd INI */ | 112 | backlight = <&bl>; |
| 113 | enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; | ||
| 113 | port { | 114 | port { |
| 114 | lcd_in: endpoint { | 115 | lcd_in: endpoint { |
| 115 | remote-endpoint = <&dpi_out>; | 116 | remote-endpoint = <&dpi_out>; |
| 116 | }; | 117 | }; |
| 117 | }; | 118 | }; |
| 118 | |||
| 119 | panel-timing { | ||
| 120 | clock-frequency = <9000000>; | ||
| 121 | hactive = <480>; | ||
| 122 | vactive = <272>; | ||
| 123 | hfront-porch = <3>; | ||
| 124 | hback-porch = <2>; | ||
| 125 | hsync-len = <42>; | ||
| 126 | vback-porch = <3>; | ||
| 127 | vfront-porch = <2>; | ||
| 128 | vsync-len = <11>; | ||
| 129 | hsync-active = <1>; | ||
| 130 | vsync-active = <1>; | ||
| 131 | de-active = <1>; | ||
| 132 | pixelclk-active = <0>; | ||
| 133 | }; | ||
| 134 | }; | 119 | }; |
| 135 | 120 | ||
| 136 | bl: backlight { | 121 | bl: backlight { |
| @@ -81,6 +81,8 @@ · 80 unmodified lines | |||
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | &mcbsp2 { | 83 | &mcbsp2 { |
| 84 | pinctrl-names = "default"; | ||
| 85 | pinctrl-0 = <&mcbsp2_pins>; | ||
| 84 | status = "okay"; | 86 | status = "okay"; |
| 85 | }; | 87 | }; |
| 86 | 88 | ||
| @@ -182,7 +182,7 @@ · 181 unmodified lines | |||
| 182 | #address-cells = <1>; | 182 | #address-cells = <1>; |
| 183 | #size-cells = <0>; | 183 | #size-cells = <0>; |
| 184 | reg = <0x0 0x1550000 0x0 0x10000>, | 184 | reg = <0x0 0x1550000 0x0 0x10000>, |
| 185 | <0x0 0x40000000 0x0 0x40000000>; | 185 | <0x0 0x40000000 0x0 0x20000000>; |
| 186 | reg-names = "QuadSPI", "QuadSPI-memory"; | 186 | reg-names = "QuadSPI", "QuadSPI-memory"; |
| 187 | interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; | 187 | interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; |
| 188 | clock-names = "qspi_en", "qspi"; | 188 | clock-names = "qspi_en", "qspi"; |
| @@ -488,11 +488,11 @@ · 487 unmodified lines | |||
| 488 | }; | 488 | }; |
| 489 | }; | 489 | }; |
| 490 | 490 | ||
| 491 | target-module@5000 { | 491 | target-module@4000 { |
| 492 | compatible = "ti,sysc-omap2", "ti,sysc"; | 492 | compatible = "ti,sysc-omap2", "ti,sysc"; |
| 493 | reg = <0x5000 0x4>, | 493 | reg = <0x4000 0x4>, |
| 494 | <0x5010 0x4>, | 494 | <0x4010 0x4>, |
| 495 | <0x5014 0x4>; | 495 | <0x4014 0x4>; |
| 496 | reg-names = "rev", "sysc", "syss"; | 496 | reg-names = "rev", "sysc", "syss"; |
| 497 | ti,sysc-sidle = <SYSC_IDLE_FORCE>, | 497 | ti,sysc-sidle = <SYSC_IDLE_FORCE>, |
| 498 | <SYSC_IDLE_NO>, | 498 | <SYSC_IDLE_NO>, |
| @@ -504,7 +504,7 @@ · 5 unmodified lines | |||
| 504 | ti,syss-mask = <1>; | 504 | ti,syss-mask = <1>; |
| 505 | #address-cells = <1>; | 505 | #address-cells = <1>; |
| 506 | #size-cells = <1>; | 506 | #size-cells = <1>; |
| 507 | ranges = <0 0x5000 0x1000>; | 507 | ranges = <0 0x4000 0x1000>; |
| 508 | 508 | ||
| 509 | dsi1: encoder@0 { | 509 | dsi1: encoder@0 { |
| 510 | compatible = "ti,omap5-dsi"; | 510 | compatible = "ti,omap5-dsi"; |
| @@ -514,8 +514,9 @@ · 3 unmodified lines | |||
| 514 | reg-names = "proto", "phy", "pll"; | 514 | reg-names = "proto", "phy", "pll"; |
| 515 | interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; | 515 | interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; |
| 516 | status = "disabled"; | 516 | status = "disabled"; |
| 517 | clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>; | 517 | clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>, |
| 518 | clock-names = "fck"; | 518 | <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>; |
| 519 | clock-names = "fck", "sys_clk"; | ||
| 519 | }; | 520 | }; |
| 520 | }; | 521 | }; |
| 521 | 522 | ||
| @@ -545,8 +546,9 @@ · 23 unmodified lines | |||
| 545 | reg-names = "proto", "phy", "pll"; | 546 | reg-names = "proto", "phy", "pll"; |
| 546 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; | 547 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; |
| 547 | status = "disabled"; | 548 | status = "disabled"; |
| 548 | clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>; | 549 | clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>, |
| 549 | clock-names = "fck"; | 550 | <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>; |
| 551 | clock-names = "fck", "sys_clk"; | ||
| 550 | }; | 552 | }; |
| 551 | }; | 553 | }; |
| 552 | 554 | ||
| @@ -821,7 +821,7 @@ · 820 unmodified lines | |||
| 821 | timer3: timer3@ffd00100 { | 821 | timer3: timer3@ffd00100 { |
| 822 | compatible = "snps,dw-apb-timer"; | 822 | compatible = "snps,dw-apb-timer"; |
| 823 | interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>; | 823 | interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>; |
| 824 | reg = <0xffd01000 0x100>; | 824 | reg = <0xffd00100 0x100>; |
| 825 | clocks = <&l4_sys_free_clk>; | 825 | clocks = <&l4_sys_free_clk>; |
| 826 | clock-names = "timer"; | 826 | clock-names = "timer"; |
| 827 | resets = <&rst L4SYSTIMER1_RESET>; | 827 | resets = <&rst L4SYSTIMER1_RESET>; |
| @@ -495,7 +495,7 @@ · 494 unmodified lines | |||
| 495 | }; | 495 | }; |
| 496 | 496 | ||
| 497 | ocotp: ocotp@400a5000 { | 497 | ocotp: ocotp@400a5000 { |
| 498 | compatible = "fsl,vf610-ocotp"; | 498 | compatible = "fsl,vf610-ocotp", "syscon"; |
| 499 | reg = <0x400a5000 0x1000>; | 499 | reg = <0x400a5000 0x1000>; |
| 500 | clocks = <&clks VF610_CLK_OCOTP>; | 500 | clocks = <&clks VF610_CLK_OCOTP>; |
| 501 | }; | 501 | }; |
| @@ -1,13 +1,11 @@ | |||
| 1 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
| 2 | CONFIG_NO_HZ=y | 2 | CONFIG_NO_HZ=y |
| 3 | CONFIG_HIGH_RES_TIMERS=y | 3 | CONFIG_HIGH_RES_TIMERS=y |
| 4 | CONFIG_PREEMPT=y | ||
| 4 | CONFIG_IKCONFIG=y | 5 | CONFIG_IKCONFIG=y |
| 5 | CONFIG_IKCONFIG_PROC=y | 6 | CONFIG_IKCONFIG_PROC=y |
| 6 | CONFIG_LOG_BUF_SHIFT=14 | 7 | CONFIG_LOG_BUF_SHIFT=14 |
| 7 | CONFIG_BLK_DEV_INITRD=y | 8 | CONFIG_BLK_DEV_INITRD=y |
| 8 | CONFIG_MODULES=y | ||
| 9 | CONFIG_MODULE_UNLOAD=y | ||
| 10 | CONFIG_PARTITION_ADVANCED=y | ||
| 11 | CONFIG_ARCH_MULTI_V4T=y | 9 | CONFIG_ARCH_MULTI_V4T=y |
| 12 | CONFIG_ARCH_MULTI_V5=y | 10 | CONFIG_ARCH_MULTI_V5=y |
| 13 | # CONFIG_ARCH_MULTI_V7 is not set | 11 | # CONFIG_ARCH_MULTI_V7 is not set |
| @@ -15,19 +13,17 @@ CONFIG_ARCH_INTEGRATOR=y · 1 unmodified line | |||
| 15 | CONFIG_ARCH_INTEGRATOR_AP=y | 13 | CONFIG_ARCH_INTEGRATOR_AP=y |
| 16 | CONFIG_INTEGRATOR_IMPD1=y | 14 | CONFIG_INTEGRATOR_IMPD1=y |
| 17 | CONFIG_ARCH_INTEGRATOR_CP=y | 15 | CONFIG_ARCH_INTEGRATOR_CP=y |
| 18 | CONFIG_PCI=y | ||
| 19 | CONFIG_PREEMPT=y | ||
| 20 | CONFIG_AEABI=y | 16 | CONFIG_AEABI=y |
| 21 | # CONFIG_ATAGS is not set | 17 | # CONFIG_ATAGS is not set |
| 22 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
| 23 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
| 24 | CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp" | 18 | CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp" |
| 25 | CONFIG_CPU_FREQ=y | 19 | CONFIG_CPU_FREQ=y |
| 26 | CONFIG_CPU_FREQ_GOV_POWERSAVE=y | 20 | CONFIG_CPU_FREQ_GOV_POWERSAVE=y |
| 27 | CONFIG_CPU_FREQ_GOV_USERSPACE=y | 21 | CONFIG_CPU_FREQ_GOV_USERSPACE=y |
| 28 | CONFIG_CPU_FREQ_GOV_ONDEMAND=y | 22 | CONFIG_CPU_FREQ_GOV_ONDEMAND=y |
| 29 | CONFIG_CPUFREQ_DT=y | 23 | CONFIG_CPUFREQ_DT=y |
| 30 | CONFIG_CMA=y | 24 | CONFIG_MODULES=y |
| 25 | CONFIG_MODULE_UNLOAD=y | ||
| 26 | CONFIG_PARTITION_ADVANCED=y | ||
| 31 | CONFIG_NET=y | 27 | CONFIG_NET=y |
| 32 | CONFIG_PACKET=y | 28 | CONFIG_PACKET=y |
| 33 | CONFIG_UNIX=y | 29 | CONFIG_UNIX=y |
| @@ -37,6 +33,7 @@ CONFIG_IP_PNP=y · 3 unmodified lines | |||
| 37 | CONFIG_IP_PNP_DHCP=y | 33 | CONFIG_IP_PNP_DHCP=y |
| 38 | CONFIG_IP_PNP_BOOTP=y | 34 | CONFIG_IP_PNP_BOOTP=y |
| 39 | # CONFIG_IPV6 is not set | 35 | # CONFIG_IPV6 is not set |
| 36 | CONFIG_PCI=y | ||
| 40 | CONFIG_MTD=y | 37 | CONFIG_MTD=y |
| 41 | CONFIG_MTD_CMDLINE_PARTS=y | 38 | CONFIG_MTD_CMDLINE_PARTS=y |
| 42 | CONFIG_MTD_AFS_PARTS=y | 39 | CONFIG_MTD_AFS_PARTS=y |
| @@ -52,9 +49,12 @@ CONFIG_BLK_DEV_RAM_SIZE=8192 · 9 unmodified lines | |||
| 52 | CONFIG_NETDEVICES=y | 49 | CONFIG_NETDEVICES=y |
| 53 | CONFIG_E100=y | 50 | CONFIG_E100=y |
| 54 | CONFIG_SMC91X=y | 51 | CONFIG_SMC91X=y |
| 52 | CONFIG_INPUT_EVDEV=y | ||
| 55 | # CONFIG_KEYBOARD_ATKBD is not set | 53 | # CONFIG_KEYBOARD_ATKBD is not set |
| 54 | CONFIG_KEYBOARD_GPIO=y | ||
| 56 | # CONFIG_SERIO_SERPORT is not set | 55 | # CONFIG_SERIO_SERPORT is not set |
| 57 | CONFIG_DRM=y | 56 | CONFIG_DRM=y |
| 57 | CONFIG_DRM_DISPLAY_CONNECTOR=y | ||
| 58 | CONFIG_DRM_SIMPLE_BRIDGE=y | 58 | CONFIG_DRM_SIMPLE_BRIDGE=y |
| 59 | CONFIG_DRM_PL111=y | 59 | CONFIG_DRM_PL111=y |
| 60 | CONFIG_FB_MODE_HELPERS=y | 60 | CONFIG_FB_MODE_HELPERS=y |
| @@ -74,7 +74,7 @@ static struct powerdomain *_get_pwrdm(struct device *dev) · 73 unmodified lines | |||
| 74 | return pwrdm; | 74 | return pwrdm; |
| 75 | 75 | ||
| 76 | clk = of_clk_get(dev->of_node->parent, 0); | 76 | clk = of_clk_get(dev->of_node->parent, 0); |
| 77 | if (!clk) { | 77 | if (IS_ERR(clk)) { |
| 78 | dev_err(dev, "no fck found\n"); | 78 | dev_err(dev, "no fck found\n"); |
| 79 | return NULL; | 79 | return NULL; |
| 80 | } | 80 | } |
| @@ -745,7 +745,7 @@ · 744 unmodified lines | |||
| 745 | }; | 745 | }; |
| 746 | 746 | ||
| 747 | qspi: spi@66470200 { | 747 | qspi: spi@66470200 { |
| 748 | compatible = "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi"; | 748 | compatible = "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi"; |
| 749 | reg = <0x66470200 0x184>, | 749 | reg = <0x66470200 0x184>, |
| 750 | <0x66470000 0x124>, | 750 | <0x66470000 0x124>, |
| 751 | <0x67017408 0x004>, | 751 | <0x67017408 0x004>, |
| @@ -28,6 +28,7 @@ dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-honeycomb.dtb · 27 unmodified lines | |||
| 28 | dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-qds.dtb | 28 | dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-qds.dtb |
| 29 | dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb | 29 | dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb |
| 30 | 30 | ||
| 31 | dtb-$(CONFIG_ARCH_MXC) += imx8mm-beacon-kit.dtb | ||
| 31 | dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb | 32 | dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb |
| 32 | dtb-$(CONFIG_ARCH_MXC) += imx8mn-evk.dtb | 33 | dtb-$(CONFIG_ARCH_MXC) += imx8mn-evk.dtb |
| 33 | dtb-$(CONFIG_ARCH_MXC) += imx8mn-ddr4-evk.dtb | 34 | dtb-$(CONFIG_ARCH_MXC) += imx8mn-ddr4-evk.dtb |
| @@ -702,7 +702,7 @@ · 701 unmodified lines | |||
| 702 | reg = <0x30bd0000 0x10000>; | 702 | reg = <0x30bd0000 0x10000>; |
| 703 | interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; | 703 | interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; |
| 704 | clocks = <&clk IMX8MP_CLK_SDMA1_ROOT>, | 704 | clocks = <&clk IMX8MP_CLK_SDMA1_ROOT>, |
| 705 | <&clk IMX8MP_CLK_SDMA1_ROOT>; | 705 | <&clk IMX8MP_CLK_AHB>; |
| 706 | clock-names = "ipg", "ahb"; | 706 | clock-names = "ipg", "ahb"; |
| 707 | #dma-cells = <3>; | 707 | #dma-cells = <3>; |
| 708 | fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin"; | 708 | fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin"; |
| @@ -423,7 +423,7 @@ · 422 unmodified lines | |||
| 423 | tmu: tmu@30260000 { | 423 | tmu: tmu@30260000 { |
| 424 | compatible = "fsl,imx8mq-tmu"; | 424 | compatible = "fsl,imx8mq-tmu"; |
| 425 | reg = <0x30260000 0x10000>; | 425 | reg = <0x30260000 0x10000>; |
| 426 | interrupt = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; | 426 | interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; |
| 427 | clocks = <&clk IMX8MQ_CLK_TMU_ROOT>; | 427 | clocks = <&clk IMX8MQ_CLK_TMU_ROOT>; |
| 428 | little-endian; | 428 | little-endian; |
| 429 | fsl,tmu-range = <0xb0000 0xa0026 0x80048 0x70061>; | 429 | fsl,tmu-range = <0xb0000 0xa0026 0x80048 0x70061>; |
| @@ -686,6 +686,8 @@ · 685 unmodified lines | |||
| 686 | clocks = <&pericfg CLK_PERI_MSDC30_0_PD>, | 686 | clocks = <&pericfg CLK_PERI_MSDC30_0_PD>, |
| 687 | <&topckgen CLK_TOP_MSDC50_0_SEL>; | 687 | <&topckgen CLK_TOP_MSDC50_0_SEL>; |
| 688 | clock-names = "source", "hclk"; | 688 | clock-names = "source", "hclk"; |
| 689 | resets = <&pericfg MT7622_PERI_MSDC0_SW_RST>; | ||
| 690 | reset-names = "hrst"; | ||
| 689 | status = "disabled"; | 691 | status = "disabled"; |
| 690 | }; | 692 | }; |
| 691 | 693 | ||
| @@ -337,8 +337,9 @@ · 336 unmodified lines | |||
| 337 | compatible = "nvidia,tegra186-sdhci"; | 337 | compatible = "nvidia,tegra186-sdhci"; |
| 338 | reg = <0x0 0x03400000 0x0 0x10000>; | 338 | reg = <0x0 0x03400000 0x0 0x10000>; |
| 339 | interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; | 339 | interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; |
| 340 | clocks = <&bpmp TEGRA186_CLK_SDMMC1>; | 340 | clocks = <&bpmp TEGRA186_CLK_SDMMC1>, |
| 341 | clock-names = "sdhci"; | 341 | <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; |
| 342 | clock-names = "sdhci", "tmclk"; | ||
| 342 | resets = <&bpmp TEGRA186_RESET_SDMMC1>; | 343 | resets = <&bpmp TEGRA186_RESET_SDMMC1>; |
| 343 | reset-names = "sdhci"; | 344 | reset-names = "sdhci"; |
| 344 | interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRA &emc>, | 345 | interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRA &emc>, |
| @@ -366,8 +367,9 @@ · 21 unmodified lines | |||
| 366 | compatible = "nvidia,tegra186-sdhci"; | 367 | compatible = "nvidia,tegra186-sdhci"; |
| 367 | reg = <0x0 0x03420000 0x0 0x10000>; | 368 | reg = <0x0 0x03420000 0x0 0x10000>; |
| 368 | interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>; | 369 | interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>; |
| 369 | clocks = <&bpmp TEGRA186_CLK_SDMMC2>; | 370 | clocks = <&bpmp TEGRA186_CLK_SDMMC2>, |
| 370 | clock-names = "sdhci"; | 371 | <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; |
| 372 | clock-names = "sdhci", "tmclk"; | ||
| 371 | resets = <&bpmp TEGRA186_RESET_SDMMC2>; | 373 | resets = <&bpmp TEGRA186_RESET_SDMMC2>; |
| 372 | reset-names = "sdhci"; | 374 | reset-names = "sdhci"; |
| 373 | interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRAA &emc>, | 375 | interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRAA &emc>, |
| @@ -390,8 +392,9 @@ · 16 unmodified lines | |||
| 390 | compatible = "nvidia,tegra186-sdhci"; | 392 | compatible = "nvidia,tegra186-sdhci"; |
| 391 | reg = <0x0 0x03440000 0x0 0x10000>; | 393 | reg = <0x0 0x03440000 0x0 0x10000>; |
| 392 | interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; | 394 | interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; |
| 393 | clocks = <&bpmp TEGRA186_CLK_SDMMC3>; | 395 | clocks = <&bpmp TEGRA186_CLK_SDMMC3>, |
| 394 | clock-names = "sdhci"; | 396 | <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; |
| 397 | clock-names = "sdhci", "tmclk"; | ||
| 395 | resets = <&bpmp TEGRA186_RESET_SDMMC3>; | 398 | resets = <&bpmp TEGRA186_RESET_SDMMC3>; |
| 396 | reset-names = "sdhci"; | 399 | reset-names = "sdhci"; |
| 397 | interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCR &emc>, | 400 | interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCR &emc>, |
| @@ -416,8 +419,9 @@ · 18 unmodified lines | |||
| 416 | compatible = "nvidia,tegra186-sdhci"; | 419 | compatible = "nvidia,tegra186-sdhci"; |
| 417 | reg = <0x0 0x03460000 0x0 0x10000>; | 420 | reg = <0x0 0x03460000 0x0 0x10000>; |
| 418 | interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; | 421 | interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; |
| 419 | clocks = <&bpmp TEGRA186_CLK_SDMMC4>; | 422 | clocks = <&bpmp TEGRA186_CLK_SDMMC4>, |
| 420 | clock-names = "sdhci"; | 423 | <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; |
| 424 | clock-names = "sdhci", "tmclk"; | ||
| 421 | assigned-clocks = <&bpmp TEGRA186_CLK_SDMMC4>, | 425 | assigned-clocks = <&bpmp TEGRA186_CLK_SDMMC4>, |
| 422 | <&bpmp TEGRA186_CLK_PLLC4_VCO>; | 426 | <&bpmp TEGRA186_CLK_PLLC4_VCO>; |
| 423 | assigned-clock-parents = <&bpmp TEGRA186_CLK_PLLC4_VCO>; | 427 | assigned-clock-parents = <&bpmp TEGRA186_CLK_PLLC4_VCO>; |
| @@ -460,8 +460,9 @@ · 459 unmodified lines | |||
| 460 | compatible = "nvidia,tegra194-sdhci"; | 460 | compatible = "nvidia,tegra194-sdhci"; |
| 461 | reg = <0x03400000 0x10000>; | 461 | reg = <0x03400000 0x10000>; |
| 462 | interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; | 462 | interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; |
| 463 | clocks = <&bpmp TEGRA194_CLK_SDMMC1>; | 463 | clocks = <&bpmp TEGRA194_CLK_SDMMC1>, |
| 464 | clock-names = "sdhci"; | 464 | <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>; |
| 465 | clock-names = "sdhci", "tmclk"; | ||
| 465 | resets = <&bpmp TEGRA194_RESET_SDMMC1>; | 466 | resets = <&bpmp TEGRA194_RESET_SDMMC1>; |
| 466 | reset-names = "sdhci"; | 467 | reset-names = "sdhci"; |
| 467 | interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCRA &emc>, | 468 | interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCRA &emc>, |
| @@ -485,8 +486,9 @@ · 17 unmodified lines | |||
| 485 | compatible = "nvidia,tegra194-sdhci"; | 486 | compatible = "nvidia,tegra194-sdhci"; |
| 486 | reg = <0x03440000 0x10000>; | 487 | reg = <0x03440000 0x10000>; |
| 487 | interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; | 488 | interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; |
| 488 | clocks = <&bpmp TEGRA194_CLK_SDMMC3>; | 489 | clocks = <&bpmp TEGRA194_CLK_SDMMC3>, |
| 489 | clock-names = "sdhci"; | 490 | <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>; |
| 491 | clock-names = "sdhci", "tmclk"; | ||
| 490 | resets = <&bpmp TEGRA194_RESET_SDMMC3>; | 492 | resets = <&bpmp TEGRA194_RESET_SDMMC3>; |
| 491 | reset-names = "sdhci"; | 493 | reset-names = "sdhci"; |
| 492 | interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCR &emc>, | 494 | interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCR &emc>, |
| @@ -511,8 +513,9 @@ · 18 unmodified lines | |||
| 511 | compatible = "nvidia,tegra194-sdhci"; | 513 | compatible = "nvidia,tegra194-sdhci"; |
| 512 | reg = <0x03460000 0x10000>; | 514 | reg = <0x03460000 0x10000>; |
| 513 | interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; | 515 | interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; |
| 514 | clocks = <&bpmp TEGRA194_CLK_SDMMC4>; | 516 | clocks = <&bpmp TEGRA194_CLK_SDMMC4>, |
| 515 | clock-names = "sdhci"; | 517 | <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>; |
| 518 | clock-names = "sdhci", "tmclk"; | ||
| 516 | assigned-clocks = <&bpmp TEGRA194_CLK_SDMMC4>, | 519 | assigned-clocks = <&bpmp TEGRA194_CLK_SDMMC4>, |
| 517 | <&bpmp TEGRA194_CLK_PLLC4>; | 520 | <&bpmp TEGRA194_CLK_PLLC4>; |
| 518 | assigned-clock-parents = | 521 | assigned-clock-parents = |
| @@ -1194,8 +1194,9 @@ · 1193 unmodified lines | |||
| 1194 | compatible = "nvidia,tegra210-sdhci"; | 1194 | compatible = "nvidia,tegra210-sdhci"; |
| 1195 | reg = <0x0 0x700b0000 0x0 0x200>; | 1195 | reg = <0x0 0x700b0000 0x0 0x200>; |
| 1196 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; | 1196 | interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; |
| 1197 | clocks = <&tegra_car TEGRA210_CLK_SDMMC1>; | 1197 | clocks = <&tegra_car TEGRA210_CLK_SDMMC1>, |
| 1198 | clock-names = "sdhci"; | 1198 | <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; |
| 1199 | clock-names = "sdhci", "tmclk"; | ||
| 1199 | resets = <&tegra_car 14>; | 1200 | resets = <&tegra_car 14>; |
| 1200 | reset-names = "sdhci"; | 1201 | reset-names = "sdhci"; |
| 1201 | pinctrl-names = "sdmmc-3v3", "sdmmc-1v8", | 1202 | pinctrl-names = "sdmmc-3v3", "sdmmc-1v8", |
| @@ -1222,8 +1223,9 @@ · 20 unmodified lines | |||
| 1222 | compatible = "nvidia,tegra210-sdhci"; | 1223 | compatible = "nvidia,tegra210-sdhci"; |
| 1223 | reg = <0x0 0x700b0200 0x0 0x200>; | 1224 | reg = <0x0 0x700b0200 0x0 0x200>; |
| 1224 | interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; | 1225 | interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; |
| 1225 | clocks = <&tegra_car TEGRA210_CLK_SDMMC2>; | 1226 | clocks = <&tegra_car TEGRA210_CLK_SDMMC2>, |
| 1226 | clock-names = "sdhci"; | 1227 | <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; |
| 1228 | clock-names = "sdhci", "tmclk"; | ||
| 1227 | resets = <&tegra_car 9>; | 1229 | resets = <&tegra_car 9>; |
| 1228 | reset-names = "sdhci"; | 1230 | reset-names = "sdhci"; |
| 1229 | pinctrl-names = "sdmmc-1v8-drv"; | 1231 | pinctrl-names = "sdmmc-1v8-drv"; |
| @@ -1239,8 +1241,9 @@ · 9 unmodified lines | |||
| 1239 | compatible = "nvidia,tegra210-sdhci"; | 1241 | compatible = "nvidia,tegra210-sdhci"; |
| 1240 | reg = <0x0 0x700b0400 0x0 0x200>; | 1242 | reg = <0x0 0x700b0400 0x0 0x200>; |
| 1241 | interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; | 1243 | interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; |
| 1242 | clocks = <&tegra_car TEGRA210_CLK_SDMMC3>; | 1244 | clocks = <&tegra_car TEGRA210_CLK_SDMMC3>, |
| 1243 | clock-names = "sdhci"; | 1245 | <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; |
| 1246 | clock-names = "sdhci", "tmclk"; | ||
| 1244 | resets = <&tegra_car 69>; | 1247 | resets = <&tegra_car 69>; |
| 1245 | reset-names = "sdhci"; | 1248 | reset-names = "sdhci"; |
| 1246 | pinctrl-names = "sdmmc-3v3", "sdmmc-1v8", | 1249 | pinctrl-names = "sdmmc-3v3", "sdmmc-1v8", |
| @@ -1262,8 +1265,9 @@ · 15 unmodified lines | |||
| 1262 | compatible = "nvidia,tegra210-sdhci"; | 1265 | compatible = "nvidia,tegra210-sdhci"; |
| 1263 | reg = <0x0 0x700b0600 0x0 0x200>; | 1266 | reg = <0x0 0x700b0600 0x0 0x200>; |
| 1264 | interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; | 1267 | interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; |
| 1265 | clocks = <&tegra_car TEGRA210_CLK_SDMMC4>; | 1268 | clocks = <&tegra_car TEGRA210_CLK_SDMMC4>, |
| 1266 | clock-names = "sdhci"; | 1269 | <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; |
| 1270 | clock-names = "sdhci", "tmclk"; | ||
| 1267 | resets = <&tegra_car 15>; | 1271 | resets = <&tegra_car 15>; |
| 1268 | reset-names = "sdhci"; | 1272 | reset-names = "sdhci"; |
| 1269 | pinctrl-names = "sdmmc-3v3-drv", "sdmmc-1v8-drv"; | 1273 | pinctrl-names = "sdmmc-3v3-drv", "sdmmc-1v8-drv"; |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <dt-bindings/power/xlnx-zynqmp-power.h> | 15 | #include <dt-bindings/power/xlnx-zynqmp-power.h> |
| 16 | #include <dt-bindings/reset/xlnx-zynqmp-resets.h> | ||
| 16 | 17 | ||
| 17 | / { | 18 | / { |
| 18 | compatible = "xlnx,zynqmp"; | 19 | compatible = "xlnx,zynqmp"; |
| @@ -558,6 +559,15 @@ · 539 unmodified lines | |||
| 558 | }; | 559 | }; |
| 559 | }; | 560 | }; |
| 560 | 561 | ||
| 562 | psgtr: phy@fd400000 { | ||
| 563 | compatible = "xlnx,zynqmp-psgtr-v1.1"; | ||
| 564 | status = "disabled"; | ||
| 565 | reg = <0x0 0xfd400000 0x0 0x40000>, | ||
| 566 | <0x0 0xfd3d0000 0x0 0x1000>; | ||
| 567 | reg-names = "serdes", "siou"; | ||
| 568 | #phy-cells = <4>; | ||
| 569 | }; | ||
| 570 | |||
| 561 | rtc: rtc@ffa60000 { | 571 | rtc: rtc@ffa60000 { |
| 562 | compatible = "xlnx,zynqmp-rtc"; | 572 | compatible = "xlnx,zynqmp-rtc"; |
| 563 | status = "disabled"; | 573 | status = "disabled"; |
| @@ -601,7 +611,7 @@ · 37 unmodified lines | |||
| 601 | power-domains = <&zynqmp_firmware PD_SD_1>; | 611 | power-domains = <&zynqmp_firmware PD_SD_1>; |
| 602 | }; | 612 | }; |
| 603 | 613 | ||
| 604 | smmu: smmu@fd800000 { | 614 | smmu: iommu@fd800000 { |
| 605 | compatible = "arm,mmu-500"; | 615 | compatible = "arm,mmu-500"; |
| 606 | reg = <0x0 0xfd800000 0x0 0x20000>; | 616 | reg = <0x0 0xfd800000 0x0 0x20000>; |
| 607 | status = "disabled"; | 617 | status = "disabled"; |
| @@ -724,6 +724,17 @@ CONFIG_USB_GADGET=y · 723 unmodified lines | |||
| 724 | CONFIG_USB_RENESAS_USBHS_UDC=m | 724 | CONFIG_USB_RENESAS_USBHS_UDC=m |
| 725 | CONFIG_USB_RENESAS_USB3=m | 725 | CONFIG_USB_RENESAS_USB3=m |
| 726 | CONFIG_USB_TEGRA_XUDC=m | 726 | CONFIG_USB_TEGRA_XUDC=m |
| 727 | CONFIG_USB_CONFIGFS=m | ||
| 728 | CONFIG_USB_CONFIGFS_SERIAL=y | ||
| 729 | CONFIG_USB_CONFIGFS_ACM=y | ||
| 730 | CONFIG_USB_CONFIGFS_OBEX=y | ||
| 731 | CONFIG_USB_CONFIGFS_NCM=y | ||
| 732 | CONFIG_USB_CONFIGFS_ECM=y | ||
| 733 | CONFIG_USB_CONFIGFS_ECM_SUBSET=y | ||
| 734 | CONFIG_USB_CONFIGFS_RNDIS=y | ||
| 735 | CONFIG_USB_CONFIGFS_EEM=y | ||
| 736 | CONFIG_USB_CONFIGFS_MASS_STORAGE=y | ||
| 737 | CONFIG_USB_CONFIGFS_F_FS=y | ||
| 727 | CONFIG_TYPEC=m | 738 | CONFIG_TYPEC=m |
| 728 | CONFIG_TYPEC_TCPM=m | 739 | CONFIG_TYPEC_TCPM=m |
| 729 | CONFIG_TYPEC_FUSB302=m | 740 | CONFIG_TYPEC_FUSB302=m |
| @@ -914,6 +925,7 @@ CONFIG_ARCH_TEGRA_194_SOC=y · 184 unmodified lines | |||
| 914 | CONFIG_ARCH_K3_AM6_SOC=y | 925 | CONFIG_ARCH_K3_AM6_SOC=y |
| 915 | CONFIG_ARCH_K3_J721E_SOC=y | 926 | CONFIG_ARCH_K3_J721E_SOC=y |
| 916 | CONFIG_TI_SCI_PM_DOMAINS=y | 927 | CONFIG_TI_SCI_PM_DOMAINS=y |
| 928 | CONFIG_EXTCON_PTN5150=m | ||
| 917 | CONFIG_EXTCON_USB_GPIO=y | 929 | CONFIG_EXTCON_USB_GPIO=y |
| 918 | CONFIG_EXTCON_USBC_CROS_EC=y | 930 | CONFIG_EXTCON_USBC_CROS_EC=y |
| 919 | CONFIG_IIO=y | 931 | CONFIG_IIO=y |
| @@ -368,7 +368,6 @@ struct kvm_vcpu_arch { · 367 unmodified lines | |||
| 368 | 368 | ||
| 369 | /* Guest PV state */ | 369 | /* Guest PV state */ |
| 370 | struct { | 370 | struct { |
| 371 | u64 steal; | ||
| 372 | u64 last_steal; | 371 | u64 last_steal; |
| 373 | gpa_t base; | 372 | gpa_t base; |
| 374 | } steal; | 373 | } steal; |
| @@ -544,6 +543,7 @@ long kvm_hypercall_pv_features(struct kvm_vcpu *vcpu); · 169 unmodified lines | |||
| 544 | gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu); | 543 | gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu); |
| 545 | void kvm_update_stolen_time(struct kvm_vcpu *vcpu); | 544 | void kvm_update_stolen_time(struct kvm_vcpu *vcpu); |
| 546 | 545 | ||
| 546 | bool kvm_arm_pvtime_supported(void); | ||
| 547 | int kvm_arm_pvtime_set_attr(struct kvm_vcpu *vcpu, | 547 | int kvm_arm_pvtime_set_attr(struct kvm_vcpu *vcpu, |
| 548 | struct kvm_device_attr *attr); | 548 | struct kvm_device_attr *attr); |
| 549 | int kvm_arm_pvtime_get_attr(struct kvm_vcpu *vcpu, | 549 | int kvm_arm_pvtime_get_attr(struct kvm_vcpu *vcpu, |
| @@ -305,8 +305,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, · 304 unmodified lines | |||
| 305 | mod->arch.core.plt_shndx = i; | 305 | mod->arch.core.plt_shndx = i; |
| 306 | else if (!strcmp(secstrings + sechdrs[i].sh_name, ".init.plt")) | 306 | else if (!strcmp(secstrings + sechdrs[i].sh_name, ".init.plt")) |
| 307 | mod->arch.init.plt_shndx = i; | 307 | mod->arch.init.plt_shndx = i; |
| 308 | else if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE) && | 308 | else if (!strcmp(secstrings + sechdrs[i].sh_name, |
| 309 | !strcmp(secstrings + sechdrs[i].sh_name, | ||
| 310 | ".text.ftrace_trampoline")) | 309 | ".text.ftrace_trampoline")) |
| 311 | tramp = sechdrs + i; | 310 | tramp = sechdrs + i; |
| 312 | else if (sechdrs[i].sh_type == SHT_SYMTAB) | 311 | else if (sechdrs[i].sh_type == SHT_SYMTAB) |
| @@ -280,7 +280,6 @@ u64 cpu_logical_map(int cpu) · 279 unmodified lines | |||
| 280 | { | 280 | { |
| 281 | return __cpu_logical_map[cpu]; | 281 | return __cpu_logical_map[cpu]; |
| 282 | } | 282 | } |
| 283 | EXPORT_SYMBOL_GPL(cpu_logical_map); | ||
| 284 | 283 | ||
| 285 | void __init __no_sanitize_address setup_arch(char **cmdline_p) | 284 | void __init __no_sanitize_address setup_arch(char **cmdline_p) |
| 286 | { | 285 | { |
| @@ -206,6 +206,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 205 unmodified lines | |||
| 206 | */ | 206 | */ |
| 207 | r = 1; | 207 | r = 1; |
| 208 | break; | 208 | break; |
| 209 | case KVM_CAP_STEAL_TIME: | ||
| 210 | r = kvm_arm_pvtime_supported(); | ||
| 211 | break; | ||
| 209 | default: | 212 | default: |
| 210 | r = kvm_arch_vm_ioctl_check_extension(kvm, ext); | 213 | r = kvm_arch_vm_ioctl_check_extension(kvm, ext); |
| 211 | break; | 214 | break; |
| @@ -1877,6 +1877,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, · 1876 unmodified lines | |||
| 1877 | !fault_supports_stage2_huge_mapping(memslot, hva, vma_pagesize)) { | 1877 | !fault_supports_stage2_huge_mapping(memslot, hva, vma_pagesize)) { |
| 1878 | force_pte = true; | 1878 | force_pte = true; |
| 1879 | vma_pagesize = PAGE_SIZE; | 1879 | vma_pagesize = PAGE_SIZE; |
| 1880 | vma_shift = PAGE_SHIFT; | ||
| 1880 | } | 1881 | } |
| 1881 | 1882 | ||
| 1882 | /* | 1883 | /* |
| @@ -1970,7 +1971,12 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, · 87 unmodified lines | |||
| 1970 | (fault_status == FSC_PERM && | 1971 | (fault_status == FSC_PERM && |
| 1971 | stage2_is_exec(mmu, fault_ipa, vma_pagesize)); | 1972 | stage2_is_exec(mmu, fault_ipa, vma_pagesize)); |
| 1972 | 1973 | ||
| 1973 | if (vma_pagesize == PUD_SIZE) { | 1974 | /* |
| 1975 | * If PUD_SIZE == PMD_SIZE, there is no real PUD level, and | ||
| 1976 | * all we have is a 2-level page table. Trying to map a PUD in | ||
| 1977 | * this case would be fatally wrong. | ||
| 1978 | */ | ||
| 1979 | if (PUD_SIZE != PMD_SIZE && vma_pagesize == PUD_SIZE) { | ||
| 1974 | pud_t new_pud = kvm_pfn_pud(pfn, mem_type); | 1980 | pud_t new_pud = kvm_pfn_pud(pfn, mem_type); |
| 1975 | 1981 | ||
| 1976 | new_pud = kvm_pud_mkhuge(new_pud); | 1982 | new_pud = kvm_pud_mkhuge(new_pud); |
| @@ -13,25 +13,22 @@ · 12 unmodified lines | |||
| 13 | void kvm_update_stolen_time(struct kvm_vcpu *vcpu) | 13 | void kvm_update_stolen_time(struct kvm_vcpu *vcpu) |
| 14 | { | 14 | { |
| 15 | struct kvm *kvm = vcpu->kvm; | 15 | struct kvm *kvm = vcpu->kvm; |
| 16 | u64 steal; | ||
| 17 | __le64 steal_le; | ||
| 18 | u64 offset; | ||
| 19 | int idx; | ||
| 20 | u64 base = vcpu->arch.steal.base; | 16 | u64 base = vcpu->arch.steal.base; |
| 17 | u64 last_steal = vcpu->arch.steal.last_steal; | ||
| 18 | u64 offset = offsetof(struct pvclock_vcpu_stolen_time, stolen_time); | ||
| 19 | u64 steal = 0; | ||
| 20 | int idx; | ||
| 21 | 21 | ||
| 22 | if (base == GPA_INVALID) | 22 | if (base == GPA_INVALID) |
| 23 | return; | 23 | return; |
| 24 | 24 | ||
| 25 | /* Let's do the local bookkeeping */ | ||
| 26 | steal = vcpu->arch.steal.steal; | ||
| 27 | steal += current->sched_info.run_delay - vcpu->arch.steal.last_steal; | ||
| 28 | vcpu->arch.steal.last_steal = current->sched_info.run_delay; | ||
| 29 | vcpu->arch.steal.steal = steal; | ||
| 30 | |||
| 31 | steal_le = cpu_to_le64(steal); | ||
| 32 | idx = srcu_read_lock(&kvm->srcu); | 25 | idx = srcu_read_lock(&kvm->srcu); |
| 33 | offset = offsetof(struct pvclock_vcpu_stolen_time, stolen_time); | 26 | if (!kvm_get_guest(kvm, base + offset, steal)) { |
| 34 | kvm_put_guest(kvm, base + offset, steal_le, u64); | 27 | steal = le64_to_cpu(steal); |
| 28 | vcpu->arch.steal.last_steal = READ_ONCE(current->sched_info.run_delay); | ||
| 29 | steal += vcpu->arch.steal.last_steal - last_steal; | ||
| 30 | kvm_put_guest(kvm, base + offset, cpu_to_le64(steal)); | ||
| 31 | } | ||
| 35 | srcu_read_unlock(&kvm->srcu, idx); | 32 | srcu_read_unlock(&kvm->srcu, idx); |
| 36 | } | 33 | } |
| 37 | 34 | ||
| @@ -43,7 +40,8 @@ long kvm_hypercall_pv_features(struct kvm_vcpu *vcpu) · 5 unmodified lines | |||
| 43 | switch (feature) { | 40 | switch (feature) { |
| 44 | case ARM_SMCCC_HV_PV_TIME_FEATURES: | 41 | case ARM_SMCCC_HV_PV_TIME_FEATURES: |
| 45 | case ARM_SMCCC_HV_PV_TIME_ST: | 42 | case ARM_SMCCC_HV_PV_TIME_ST: |
| 46 | val = SMCCC_RET_SUCCESS; | 43 | if (vcpu->arch.steal.base != GPA_INVALID) |
| 44 | val = SMCCC_RET_SUCCESS; | ||
| 47 | break; | 45 | break; |
| 48 | } | 46 | } |
| 49 | 47 | ||
| @@ -64,7 +62,6 @@ gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu) · 14 unmodified lines | |||
| 64 | * Start counting stolen time from the time the guest requests | 62 | * Start counting stolen time from the time the guest requests |
| 65 | * the feature enabled. | 63 | * the feature enabled. |
| 66 | */ | 64 | */ |
| 67 | vcpu->arch.steal.steal = 0; | ||
| 68 | vcpu->arch.steal.last_steal = current->sched_info.run_delay; | 65 | vcpu->arch.steal.last_steal = current->sched_info.run_delay; |
| 69 | 66 | ||
| 70 | idx = srcu_read_lock(&kvm->srcu); | 67 | idx = srcu_read_lock(&kvm->srcu); |
| @@ -74,7 +71,7 @@ gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu) · 3 unmodified lines | |||
| 74 | return base; | 71 | return base; |
| 75 | } | 72 | } |
| 76 | 73 | ||
| 77 | static bool kvm_arm_pvtime_supported(void) | 74 | bool kvm_arm_pvtime_supported(void) |
| 78 | { | 75 | { |
| 79 | return !!sched_info_on(); | 76 | return !!sched_info_on(); |
| 80 | } | 77 | } |
| @@ -23,7 +23,7 @@ TRACE_EVENT(kvm_entry, · 22 unmodified lines | |||
| 23 | __entry->vcpu_pc = vcpu_pc; | 23 | __entry->vcpu_pc = vcpu_pc; |
| 24 | ), | 24 | ), |
| 25 | 25 | ||
| 26 | TP_printk("PC: 0x%08lx", __entry->vcpu_pc) | 26 | TP_printk("PC: 0x%016lx", __entry->vcpu_pc) |
| 27 | ); | 27 | ); |
| 28 | 28 | ||
| 29 | TRACE_EVENT(kvm_exit, | 29 | TRACE_EVENT(kvm_exit, |
| @@ -42,7 +42,7 @@ TRACE_EVENT(kvm_exit, · 12 unmodified lines | |||
| 42 | __entry->vcpu_pc = vcpu_pc; | 42 | __entry->vcpu_pc = vcpu_pc; |
| 43 | ), | 43 | ), |
| 44 | 44 | ||
| 45 | TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%08lx", | 45 | TP_printk("%s: HSR_EC: 0x%04x (%s), PC: 0x%016lx", |
| 46 | __print_symbolic(__entry->ret, kvm_arm_exception_type), | 46 | __print_symbolic(__entry->ret, kvm_arm_exception_type), |
| 47 | __entry->esr_ec, | 47 | __entry->esr_ec, |
| 48 | __print_symbolic(__entry->esr_ec, kvm_arm_exception_class), | 48 | __print_symbolic(__entry->esr_ec, kvm_arm_exception_class), |
| @@ -69,7 +69,7 @@ TRACE_EVENT(kvm_guest_fault, · 20 unmodified lines | |||
| 69 | __entry->ipa = ipa; | 69 | __entry->ipa = ipa; |
| 70 | ), | 70 | ), |
| 71 | 71 | ||
| 72 | TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#08lx", | 72 | TP_printk("ipa %#llx, hsr %#08lx, hxfar %#08lx, pc %#016lx", |
| 73 | __entry->ipa, __entry->hsr, | 73 | __entry->ipa, __entry->hsr, |
| 74 | __entry->hxfar, __entry->vcpu_pc) | 74 | __entry->hxfar, __entry->vcpu_pc) |
| 75 | ); | 75 | ); |
| @@ -131,7 +131,7 @@ TRACE_EVENT(kvm_mmio_emulate, · 55 unmodified lines | |||
| 131 | __entry->cpsr = cpsr; | 131 | __entry->cpsr = cpsr; |
| 132 | ), | 132 | ), |
| 133 | 133 | ||
| 134 | TP_printk("Emulate MMIO at: 0x%08lx (instr: %08lx, cpsr: %08lx)", | 134 | TP_printk("Emulate MMIO at: 0x%016lx (instr: %08lx, cpsr: %08lx)", |
| 135 | __entry->vcpu_pc, __entry->instr, __entry->cpsr) | 135 | __entry->vcpu_pc, __entry->instr, __entry->cpsr) |
| 136 | ); | 136 | ); |
| 137 | 137 | ||
| @@ -149,7 +149,7 @@ TRACE_EVENT(kvm_unmap_hva_range, · 11 unmodified lines | |||
| 149 | __entry->end = end; | 149 | __entry->end = end; |
| 150 | ), | 150 | ), |
| 151 | 151 | ||
| 152 | TP_printk("mmu notifier unmap range: %#08lx -- %#08lx", | 152 | TP_printk("mmu notifier unmap range: %#016lx -- %#016lx", |
| 153 | __entry->start, __entry->end) | 153 | __entry->start, __entry->end) |
| 154 | ); | 154 | ); |
| 155 | 155 | ||
| @@ -165,7 +165,7 @@ TRACE_EVENT(kvm_set_spte_hva, · 9 unmodified lines | |||
| 165 | __entry->hva = hva; | 165 | __entry->hva = hva; |
| 166 | ), | 166 | ), |
| 167 | 167 | ||
| 168 | TP_printk("mmu notifier set pte hva: %#08lx", __entry->hva) | 168 | TP_printk("mmu notifier set pte hva: %#016lx", __entry->hva) |
| 169 | ); | 169 | ); |
| 170 | 170 | ||
| 171 | TRACE_EVENT(kvm_age_hva, | 171 | TRACE_EVENT(kvm_age_hva, |
| @@ -182,7 +182,7 @@ TRACE_EVENT(kvm_age_hva, · 10 unmodified lines | |||
| 182 | __entry->end = end; | 182 | __entry->end = end; |
| 183 | ), | 183 | ), |
| 184 | 184 | ||
| 185 | TP_printk("mmu notifier age hva: %#08lx -- %#08lx", | 185 | TP_printk("mmu notifier age hva: %#016lx -- %#016lx", |
| 186 | __entry->start, __entry->end) | 186 | __entry->start, __entry->end) |
| 187 | ); | 187 | ); |
| 188 | 188 | ||
| @@ -198,7 +198,7 @@ TRACE_EVENT(kvm_test_age_hva, · 9 unmodified lines | |||
| 198 | __entry->hva = hva; | 198 | __entry->hva = hva; |
| 199 | ), | 199 | ), |
| 200 | 200 | ||
| 201 | TP_printk("mmu notifier test age hva: %#08lx", __entry->hva) | 201 | TP_printk("mmu notifier test age hva: %#016lx", __entry->hva) |
| 202 | ); | 202 | ); |
| 203 | 203 | ||
| 204 | TRACE_EVENT(kvm_set_way_flush, | 204 | TRACE_EVENT(kvm_set_way_flush, |
| @@ -22,7 +22,7 @@ TRACE_EVENT(kvm_wfx_arm64, · 21 unmodified lines | |||
| 22 | __entry->is_wfe = is_wfe; | 22 | __entry->is_wfe = is_wfe; |
| 23 | ), | 23 | ), |
| 24 | 24 | ||
| 25 | TP_printk("guest executed wf%c at: 0x%08lx", | 25 | TP_printk("guest executed wf%c at: 0x%016lx", |
| 26 | __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc) | 26 | __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc) |
| 27 | ); | 27 | ); |
| 28 | 28 | ||
| @@ -42,7 +42,7 @@ TRACE_EVENT(kvm_hvc_arm64, · 13 unmodified lines | |||
| 42 | __entry->imm = imm; | 42 | __entry->imm = imm; |
| 43 | ), | 43 | ), |
| 44 | 44 | ||
| 45 | TP_printk("HVC at 0x%08lx (r0: 0x%08lx, imm: 0x%lx)", | 45 | TP_printk("HVC at 0x%016lx (r0: 0x%016lx, imm: 0x%lx)", |
| 46 | __entry->vcpu_pc, __entry->r0, __entry->imm) | 46 | __entry->vcpu_pc, __entry->r0, __entry->imm) |
| 47 | ); | 47 | ); |
| 48 | 48 | ||
| @@ -135,7 +135,7 @@ TRACE_EVENT(trap_reg, · 86 unmodified lines | |||
| 135 | __entry->write_value = write_value; | 135 | __entry->write_value = write_value; |
| 136 | ), | 136 | ), |
| 137 | 137 | ||
| 138 | TP_printk("%s %s reg %d (0x%08llx)", __entry->fn, __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value) | 138 | TP_printk("%s %s reg %d (0x%016llx)", __entry->fn, __entry->is_write?"write to":"read from", __entry->reg, __entry->write_value) |
| 139 | ); | 139 | ); |
| 140 | 140 | ||
| 141 | TRACE_EVENT(kvm_handle_sys_reg, | 141 | TRACE_EVENT(kvm_handle_sys_reg, |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * Architecture-specific kernel symbols | 3 | * Architecture-specific kernel symbols |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #ifdef CONFIG_VIRTUAL_MEM_MAP | 6 | #if defined(CONFIG_VIRTUAL_MEM_MAP) || defined(CONFIG_DISCONTIGMEM) |
| 7 | #include <linux/compiler.h> | 7 | #include <linux/compiler.h> |
| 8 | #include <linux/export.h> | 8 | #include <linux/export.h> |
| 9 | #include <linux/memblock.h> | 9 | #include <linux/memblock.h> |
| @@ -46,6 +46,9 @@ unsigned long memory_size; · 45 unmodified lines | |||
| 46 | EXPORT_SYMBOL(memory_size); | 46 | EXPORT_SYMBOL(memory_size); |
| 47 | unsigned long lowmem_size; | 47 | unsigned long lowmem_size; |
| 48 | 48 | ||
| 49 | EXPORT_SYMBOL(min_low_pfn); | ||
| 50 | EXPORT_SYMBOL(max_low_pfn); | ||
| 51 | |||
| 49 | #ifdef CONFIG_HIGHMEM | 52 | #ifdef CONFIG_HIGHMEM |
| 50 | pte_t *kmap_pte; | 53 | pte_t *kmap_pte; |
| 51 | EXPORT_SYMBOL(kmap_pte); | 54 | EXPORT_SYMBOL(kmap_pte); |
| @@ -26,7 +26,6 @@ · 25 unmodified lines | |||
| 26 | #define cpu_has_counter 1 | 26 | #define cpu_has_counter 1 |
| 27 | #define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) | 27 | #define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) |
| 28 | #define cpu_has_divec 0 | 28 | #define cpu_has_divec 0 |
| 29 | #define cpu_has_ejtag 0 | ||
| 30 | #define cpu_has_inclusive_pcaches 1 | 29 | #define cpu_has_inclusive_pcaches 1 |
| 31 | #define cpu_has_llsc 1 | 30 | #define cpu_has_llsc 1 |
| 32 | #define cpu_has_mcheck 0 | 31 | #define cpu_has_mcheck 0 |
| @@ -42,7 +41,6 @@ · 9 unmodified lines | |||
| 42 | #define cpu_has_veic 0 | 41 | #define cpu_has_veic 0 |
| 43 | #define cpu_has_vint 0 | 42 | #define cpu_has_vint 0 |
| 44 | #define cpu_has_vtag_icache 0 | 43 | #define cpu_has_vtag_icache 0 |
| 45 | #define cpu_has_watch 1 | ||
| 46 | #define cpu_has_wsbh 1 | 44 | #define cpu_has_wsbh 1 |
| 47 | #define cpu_has_ic_fills_f_dc 1 | 45 | #define cpu_has_ic_fills_f_dc 1 |
| 48 | #define cpu_hwrena_impl_bits 0xc0000000 | 46 | #define cpu_hwrena_impl_bits 0xc0000000 |
| @@ -2,8 +2,6 @@ · 1 unmodified line | |||
| 2 | #ifndef __ASM_MACH_LOONGSON64_IRQ_H_ | 2 | #ifndef __ASM_MACH_LOONGSON64_IRQ_H_ |
| 3 | #define __ASM_MACH_LOONGSON64_IRQ_H_ | 3 | #define __ASM_MACH_LOONGSON64_IRQ_H_ |
| 4 | 4 | ||
| 5 | #include <boot_param.h> | ||
| 6 | |||
| 7 | /* cpu core interrupt numbers */ | 5 | /* cpu core interrupt numbers */ |
| 8 | #define NR_IRQS_LEGACY 16 | 6 | #define NR_IRQS_LEGACY 16 |
| 9 | #define NR_MIPS_CPU_IRQS 8 | 7 | #define NR_MIPS_CPU_IRQS 8 |
| @@ -9,7 +9,6 @@ · 8 unmodified lines | |||
| 9 | #ifndef _ASM_MACH_LOONGSON64_MMZONE_H | 9 | #ifndef _ASM_MACH_LOONGSON64_MMZONE_H |
| 10 | #define _ASM_MACH_LOONGSON64_MMZONE_H | 10 | #define _ASM_MACH_LOONGSON64_MMZONE_H |
| 11 | 11 | ||
| 12 | #include <boot_param.h> | ||
| 13 | #define NODE_ADDRSPACE_SHIFT 44 | 12 | #define NODE_ADDRSPACE_SHIFT 44 |
| 14 | #define NODE0_ADDRSPACE_OFFSET 0x000000000000UL | 13 | #define NODE0_ADDRSPACE_OFFSET 0x000000000000UL |
| 15 | #define NODE1_ADDRSPACE_OFFSET 0x100000000000UL | 14 | #define NODE1_ADDRSPACE_OFFSET 0x100000000000UL |
| @@ -1898,8 +1898,8 @@ static const struct mips_perf_event *mipsxx_pmu_map_raw_event(u64 config) · 1897 unmodified lines | |||
| 1898 | (base_id >= 64 && base_id < 90) || | 1898 | (base_id >= 64 && base_id < 90) || |
| 1899 | (base_id >= 128 && base_id < 164) || | 1899 | (base_id >= 128 && base_id < 164) || |
| 1900 | (base_id >= 192 && base_id < 200) || | 1900 | (base_id >= 192 && base_id < 200) || |
| 1901 | (base_id >= 256 && base_id < 274) || | 1901 | (base_id >= 256 && base_id < 275) || |
| 1902 | (base_id >= 320 && base_id < 358) || | 1902 | (base_id >= 320 && base_id < 361) || |
| 1903 | (base_id >= 384 && base_id < 574)) | 1903 | (base_id >= 384 && base_id < 574)) |
| 1904 | break; | 1904 | break; |
| 1905 | 1905 | ||
| @@ -239,6 +239,8 @@ static int bmips_boot_secondary(int cpu, struct task_struct *idle) · 238 unmodified lines | |||
| 239 | */ | 239 | */ |
| 240 | static void bmips_init_secondary(void) | 240 | static void bmips_init_secondary(void) |
| 241 | { | 241 | { |
| 242 | bmips_cpu_setup(); | ||
| 243 | |||
| 242 | switch (current_cpu_type()) { | 244 | switch (current_cpu_type()) { |
| 243 | case CPU_BMIPS4350: | 245 | case CPU_BMIPS4350: |
| 244 | case CPU_BMIPS4380: | 246 | case CPU_BMIPS4380: |
| @@ -1287,6 +1287,18 @@ static int enable_restore_fp_context(int msa) · 1286 unmodified lines | |||
| 1287 | err = own_fpu_inatomic(1); | 1287 | err = own_fpu_inatomic(1); |
| 1288 | if (msa && !err) { | 1288 | if (msa && !err) { |
| 1289 | enable_msa(); | 1289 | enable_msa(); |
| 1290 | /* | ||
| 1291 | * with MSA enabled, userspace can see MSACSR | ||
| 1292 | * and MSA regs, but the values in them are from | ||
| 1293 | * other task before current task, restore them | ||
| 1294 | * from saved fp/msa context | ||
| 1295 | */ | ||
| 1296 | write_msa_csr(current->thread.fpu.msacsr); | ||
| 1297 | /* | ||
| 1298 | * own_fpu_inatomic(1) just restore low 64bit, | ||
| 1299 | * fix the high 64bit | ||
| 1300 | */ | ||
| 1301 | init_msa_upper(); | ||
| 1290 | set_thread_flag(TIF_USEDMSA); | 1302 | set_thread_flag(TIF_USEDMSA); |
| 1291 | set_thread_flag(TIF_MSA_CTX_LIVE); | 1303 | set_thread_flag(TIF_MSA_CTX_LIVE); |
| 1292 | } | 1304 | } |
| @@ -137,6 +137,8 @@ extern void kvm_init_loongson_ipi(struct kvm *kvm); · 136 unmodified lines | |||
| 137 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | 137 | int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) |
| 138 | { | 138 | { |
| 139 | switch (type) { | 139 | switch (type) { |
| 140 | case KVM_VM_MIPS_AUTO: | ||
| 141 | break; | ||
| 140 | #ifdef CONFIG_KVM_MIPS_VZ | 142 | #ifdef CONFIG_KVM_MIPS_VZ |
| 141 | case KVM_VM_MIPS_VZ: | 143 | case KVM_VM_MIPS_VZ: |
| 142 | #else | 144 | #else |
| @@ -1712,7 +1712,11 @@ static void setup_scache(void) · 1711 unmodified lines | |||
| 1712 | printk("MIPS secondary cache %ldkB, %s, linesize %d bytes.\n", | 1712 | printk("MIPS secondary cache %ldkB, %s, linesize %d bytes.\n", |
| 1713 | scache_size >> 10, | 1713 | scache_size >> 10, |
| 1714 | way_string[c->scache.ways], c->scache.linesz); | 1714 | way_string[c->scache.ways], c->scache.linesz); |
| 1715 | |||
| 1716 | if (current_cpu_type() == CPU_BMIPS5000) | ||
| 1717 | c->options |= MIPS_CPU_INCLUSIVE_CACHES; | ||
| 1715 | } | 1718 | } |
| 1719 | |||
| 1716 | #else | 1720 | #else |
| 1717 | if (!(c->scache.flags & MIPS_CACHE_NOT_PRESENT)) | 1721 | if (!(c->scache.flags & MIPS_CACHE_NOT_PRESENT)) |
| 1718 | panic("Dunno how to handle MIPS32 / MIPS64 second level cache"); | 1722 | panic("Dunno how to handle MIPS32 / MIPS64 second level cache"); |
| @@ -245,7 +245,6 @@ static int mipsxx_perfcount_handler(void) · 244 unmodified lines | |||
| 245 | 245 | ||
| 246 | switch (counters) { | 246 | switch (counters) { |
| 247 | #define HANDLE_COUNTER(n) \ | 247 | #define HANDLE_COUNTER(n) \ |
| 248 | fallthrough; \ | ||
| 249 | case n + 1: \ | 248 | case n + 1: \ |
| 250 | control = r_c0_perfctrl ## n(); \ | 249 | control = r_c0_perfctrl ## n(); \ |
| 251 | counter = r_c0_perfcntr ## n(); \ | 250 | counter = r_c0_perfcntr ## n(); \ |
| @@ -256,8 +255,11 @@ static int mipsxx_perfcount_handler(void) · 4 unmodified lines | |||
| 256 | handled = IRQ_HANDLED; \ | 255 | handled = IRQ_HANDLED; \ |
| 257 | } | 256 | } |
| 258 | HANDLE_COUNTER(3) | 257 | HANDLE_COUNTER(3) |
| 258 | fallthrough; | ||
| 259 | HANDLE_COUNTER(2) | 259 | HANDLE_COUNTER(2) |
| 260 | fallthrough; | ||
| 260 | HANDLE_COUNTER(1) | 261 | HANDLE_COUNTER(1) |
| 262 | fallthrough; | ||
| 261 | HANDLE_COUNTER(0) | 263 | HANDLE_COUNTER(0) |
| 262 | } | 264 | } |
| 263 | 265 | ||
| @@ -222,8 +222,8 @@ void __init sni_a20r_irq_init(void) · 221 unmodified lines | |||
| 222 | irq_set_chip_and_handler(i, &a20r_irq_type, handle_level_irq); | 222 | irq_set_chip_and_handler(i, &a20r_irq_type, handle_level_irq); |
| 223 | sni_hwint = a20r_hwint; | 223 | sni_hwint = a20r_hwint; |
| 224 | change_c0_status(ST0_IM, IE_IRQ0); | 224 | change_c0_status(ST0_IM, IE_IRQ0); |
| 225 | if (request_irq(SNI_A20R_IRQ_BASE + 3, sni_isa_irq_handler, 0, "ISA", | 225 | if (request_irq(SNI_A20R_IRQ_BASE + 3, sni_isa_irq_handler, |
| 226 | NULL)) | 226 | IRQF_SHARED, "ISA", sni_isa_irq_handler)) |
| 227 | pr_err("Failed to register ISA interrupt\n"); | 227 | pr_err("Failed to register ISA interrupt\n"); |
| 228 | } | 228 | } |
| 229 | 229 | ||
| @@ -165,19 +165,19 @@ struct __large_struct { · 164 unmodified lines | |||
| 165 | 165 | ||
| 166 | #define __get_user_nocheck(x, ptr, size) \ | 166 | #define __get_user_nocheck(x, ptr, size) \ |
| 167 | ({ \ | 167 | ({ \ |
| 168 | long __gu_err, __gu_val; \ | 168 | long __gu_err; \ |
| 169 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ | 169 | __get_user_size((x), (ptr), (size), __gu_err); \ |
| 170 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ | ||
| 171 | __gu_err; \ | 170 | __gu_err; \ |
| 172 | }) | 171 | }) |
| 173 | 172 | ||
| 174 | #define __get_user_check(x, ptr, size) \ | 173 | #define __get_user_check(x, ptr, size) \ |
| 175 | ({ \ | 174 | ({ \ |
| 176 | long __gu_err = -EFAULT, __gu_val = 0; \ | 175 | long __gu_err = -EFAULT; \ |
| 177 | const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ | 176 | const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ |
| 178 | if (access_ok(__gu_addr, size)) \ | 177 | if (access_ok(__gu_addr, size)) \ |
| 179 | __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ | 178 | __get_user_size((x), __gu_addr, (size), __gu_err); \ |
| 180 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ | 179 | else \ |
| 180 | (x) = (__typeof__(*(ptr))) 0; \ | ||
| 181 | __gu_err; \ | 181 | __gu_err; \ |
| 182 | }) | 182 | }) |
| 183 | 183 | ||
| @@ -191,11 +191,13 @@ do { \ · 7 unmodified lines | |||
| 191 | case 2: __get_user_asm(x, ptr, retval, "l.lhz"); break; \ | 191 | case 2: __get_user_asm(x, ptr, retval, "l.lhz"); break; \ |
| 192 | case 4: __get_user_asm(x, ptr, retval, "l.lwz"); break; \ | 192 | case 4: __get_user_asm(x, ptr, retval, "l.lwz"); break; \ |
| 193 | case 8: __get_user_asm2(x, ptr, retval); break; \ | 193 | case 8: __get_user_asm2(x, ptr, retval); break; \ |
| 194 | default: (x) = __get_user_bad(); \ | 194 | default: (x) = (__typeof__(*(ptr)))__get_user_bad(); \ |
| 195 | } \ | 195 | } \ |
| 196 | } while (0) | 196 | } while (0) |
| 197 | 197 | ||
| 198 | #define __get_user_asm(x, addr, err, op) \ | 198 | #define __get_user_asm(x, addr, err, op) \ |
| 199 | { \ | ||
| 200 | unsigned long __gu_tmp; \ | ||
| 199 | __asm__ __volatile__( \ | 201 | __asm__ __volatile__( \ |
| 200 | "1: "op" %1,0(%2)\n" \ | 202 | "1: "op" %1,0(%2)\n" \ |
| 201 | "2:\n" \ | 203 | "2:\n" \ |
| @@ -209,10 +211,14 @@ do { \ · 7 unmodified lines | |||
| 209 | " .align 2\n" \ | 211 | " .align 2\n" \ |
| 210 | " .long 1b,3b\n" \ | 212 | " .long 1b,3b\n" \ |
| 211 | ".previous" \ | 213 | ".previous" \ |
| 212 | : "=r"(err), "=r"(x) \ | 214 | : "=r"(err), "=r"(__gu_tmp) \ |
| 213 | : "r"(addr), "i"(-EFAULT), "0"(err)) | 215 | : "r"(addr), "i"(-EFAULT), "0"(err)); \ |
| 216 | (x) = (__typeof__(*(addr)))__gu_tmp; \ | ||
| 217 | } | ||
| 214 | 218 | ||
| 215 | #define __get_user_asm2(x, addr, err) \ | 219 | #define __get_user_asm2(x, addr, err) \ |
| 220 | { \ | ||
| 221 | unsigned long long __gu_tmp; \ | ||
| 216 | __asm__ __volatile__( \ | 222 | __asm__ __volatile__( \ |
| 217 | "1: l.lwz %1,0(%2)\n" \ | 223 | "1: l.lwz %1,0(%2)\n" \ |
| 218 | "2: l.lwz %H1,4(%2)\n" \ | 224 | "2: l.lwz %H1,4(%2)\n" \ |
| @@ -229,8 +235,11 @@ do { \ · 10 unmodified lines | |||
| 229 | " .long 1b,4b\n" \ | 235 | " .long 1b,4b\n" \ |
| 230 | " .long 2b,4b\n" \ | 236 | " .long 2b,4b\n" \ |
| 231 | ".previous" \ | 237 | ".previous" \ |
| 232 | : "=r"(err), "=&r"(x) \ | 238 | : "=r"(err), "=&r"(__gu_tmp) \ |
| 233 | : "r"(addr), "i"(-EFAULT), "0"(err)) | 239 | : "r"(addr), "i"(-EFAULT), "0"(err)); \ |
| 240 | (x) = (__typeof__(*(addr)))( \ | ||
| 241 | (__typeof__((x)-(x)))__gu_tmp); \ | ||
| 242 | } | ||
| 234 | 243 | ||
| 235 | /* more complex routines */ | 244 | /* more complex routines */ |
| 236 | 245 | ||
| @@ -80,6 +80,16 @@ static void __init setup_memory(void) · 79 unmodified lines | |||
| 80 | */ | 80 | */ |
| 81 | memblock_reserve(__pa(_stext), _end - _stext); | 81 | memblock_reserve(__pa(_stext), _end - _stext); |
| 82 | 82 | ||
| 83 | #ifdef CONFIG_BLK_DEV_INITRD | ||
| 84 | /* Then reserve the initrd, if any */ | ||
| 85 | if (initrd_start && (initrd_end > initrd_start)) { | ||
| 86 | unsigned long aligned_start = ALIGN_DOWN(initrd_start, PAGE_SIZE); | ||
| 87 | unsigned long aligned_end = ALIGN(initrd_end, PAGE_SIZE); | ||
| 88 | |||
| 89 | memblock_reserve(__pa(aligned_start), aligned_end - aligned_start); | ||
| 90 | } | ||
| 91 | #endif /* CONFIG_BLK_DEV_INITRD */ | ||
| 92 | |||
| 83 | early_init_fdt_reserve_self(); | 93 | early_init_fdt_reserve_self(); |
| 84 | early_init_fdt_scan_reserved_mem(); | 94 | early_init_fdt_scan_reserved_mem(); |
| 85 | 95 | ||
| @@ -16,7 +16,7 @@ · 15 unmodified lines | |||
| 16 | #include <asm/cacheflush.h> | 16 | #include <asm/cacheflush.h> |
| 17 | #include <asm/tlbflush.h> | 17 | #include <asm/tlbflush.h> |
| 18 | 18 | ||
| 19 | static void cache_loop(struct page *page, const unsigned int reg) | 19 | static __always_inline void cache_loop(struct page *page, const unsigned int reg) |
| 20 | { | 20 | { |
| 21 | unsigned long paddr = page_to_pfn(page) << PAGE_SHIFT; | 21 | unsigned long paddr = page_to_pfn(page) << PAGE_SHIFT; |
| 22 | unsigned long line = paddr & ~(L1_CACHE_BYTES - 1); | 22 | unsigned long line = paddr & ~(L1_CACHE_BYTES - 1); |
| @@ -30,7 +30,7 @@ config GENERIC_BUG_RELATIVE_POINTERS · 29 unmodified lines | |||
| 30 | def_bool y | 30 | def_bool y |
| 31 | 31 | ||
| 32 | config GENERIC_LOCKBREAK | 32 | config GENERIC_LOCKBREAK |
| 33 | def_bool y if PREEMPTTION | 33 | def_bool y if PREEMPTION |
| 34 | 34 | ||
| 35 | config PGSTE | 35 | config PGSTE |
| 36 | def_bool y if KVM | 36 | def_bool y if KVM |
| @@ -626,6 +626,7 @@ CONFIG_NTFS_RW=y · 625 unmodified lines | |||
| 626 | CONFIG_PROC_KCORE=y | 626 | CONFIG_PROC_KCORE=y |
| 627 | CONFIG_TMPFS=y | 627 | CONFIG_TMPFS=y |
| 628 | CONFIG_TMPFS_POSIX_ACL=y | 628 | CONFIG_TMPFS_POSIX_ACL=y |
| 629 | CONFIG_TMPFS_INODE64=y | ||
| 629 | CONFIG_HUGETLBFS=y | 630 | CONFIG_HUGETLBFS=y |
| 630 | CONFIG_CONFIGFS_FS=m | 631 | CONFIG_CONFIGFS_FS=m |
| 631 | CONFIG_ECRYPT_FS=m | 632 | CONFIG_ECRYPT_FS=m |
| @@ -807,6 +808,7 @@ CONFIG_DEBUG_NOTIFIERS=y · 175 unmodified lines | |||
| 807 | CONFIG_BUG_ON_DATA_CORRUPTION=y | 808 | CONFIG_BUG_ON_DATA_CORRUPTION=y |
| 808 | CONFIG_DEBUG_CREDENTIALS=y | 809 | CONFIG_DEBUG_CREDENTIALS=y |
| 809 | CONFIG_RCU_TORTURE_TEST=m | 810 | CONFIG_RCU_TORTURE_TEST=m |
| 811 | CONFIG_RCU_REF_SCALE_TEST=m | ||
| 810 | CONFIG_RCU_CPU_STALL_TIMEOUT=300 | 812 | CONFIG_RCU_CPU_STALL_TIMEOUT=300 |
| 811 | # CONFIG_RCU_TRACE is not set | 813 | # CONFIG_RCU_TRACE is not set |
| 812 | CONFIG_LATENCYTOP=y | 814 | CONFIG_LATENCYTOP=y |
| @@ -818,6 +820,7 @@ CONFIG_PREEMPT_TRACER=y · 5 unmodified lines | |||
| 818 | CONFIG_SCHED_TRACER=y | 820 | CONFIG_SCHED_TRACER=y |
| 819 | CONFIG_FTRACE_SYSCALLS=y | 821 | CONFIG_FTRACE_SYSCALLS=y |
| 820 | CONFIG_BLK_DEV_IO_TRACE=y | 822 | CONFIG_BLK_DEV_IO_TRACE=y |
| 823 | CONFIG_BPF_KPROBE_OVERRIDE=y | ||
| 821 | CONFIG_HIST_TRIGGERS=y | 824 | CONFIG_HIST_TRIGGERS=y |
| 822 | CONFIG_S390_PTDUMP=y | 825 | CONFIG_S390_PTDUMP=y |
| 823 | CONFIG_NOTIFIER_ERROR_INJECTION=m | 826 | CONFIG_NOTIFIER_ERROR_INJECTION=m |
| @@ -829,6 +832,7 @@ CONFIG_FAIL_MAKE_REQUEST=y · 5 unmodified lines | |||
| 829 | CONFIG_FAIL_IO_TIMEOUT=y | 832 | CONFIG_FAIL_IO_TIMEOUT=y |
| 830 | CONFIG_FAIL_FUTEX=y | 833 | CONFIG_FAIL_FUTEX=y |
| 831 | CONFIG_FAULT_INJECTION_DEBUG_FS=y | 834 | CONFIG_FAULT_INJECTION_DEBUG_FS=y |
| 835 | CONFIG_FAIL_FUNCTION=y | ||
| 832 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y | 836 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y |
| 833 | CONFIG_LKDTM=m | 837 | CONFIG_LKDTM=m |
| 834 | CONFIG_TEST_LIST_SORT=y | 838 | CONFIG_TEST_LIST_SORT=y |
| @@ -617,6 +617,7 @@ CONFIG_NTFS_RW=y · 616 unmodified lines | |||
| 617 | CONFIG_PROC_KCORE=y | 617 | CONFIG_PROC_KCORE=y |
| 618 | CONFIG_TMPFS=y | 618 | CONFIG_TMPFS=y |
| 619 | CONFIG_TMPFS_POSIX_ACL=y | 619 | CONFIG_TMPFS_POSIX_ACL=y |
| 620 | CONFIG_TMPFS_INODE64=y | ||
| 620 | CONFIG_HUGETLBFS=y | 621 | CONFIG_HUGETLBFS=y |
| 621 | CONFIG_CONFIGFS_FS=m | 622 | CONFIG_CONFIGFS_FS=m |
| 622 | CONFIG_ECRYPT_FS=m | 623 | CONFIG_ECRYPT_FS=m |
| @@ -763,6 +764,7 @@ CONFIG_PANIC_ON_OOPS=y · 140 unmodified lines | |||
| 763 | CONFIG_TEST_LOCKUP=m | 764 | CONFIG_TEST_LOCKUP=m |
| 764 | CONFIG_BUG_ON_DATA_CORRUPTION=y | 765 | CONFIG_BUG_ON_DATA_CORRUPTION=y |
| 765 | CONFIG_RCU_TORTURE_TEST=m | 766 | CONFIG_RCU_TORTURE_TEST=m |
| 767 | CONFIG_RCU_REF_SCALE_TEST=m | ||
| 766 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 768 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 767 | CONFIG_LATENCYTOP=y | 769 | CONFIG_LATENCYTOP=y |
| 768 | CONFIG_BOOTTIME_TRACING=y | 770 | CONFIG_BOOTTIME_TRACING=y |
| @@ -771,6 +773,7 @@ CONFIG_STACK_TRACER=y · 2 unmodified lines | |||
| 771 | CONFIG_SCHED_TRACER=y | 773 | CONFIG_SCHED_TRACER=y |
| 772 | CONFIG_FTRACE_SYSCALLS=y | 774 | CONFIG_FTRACE_SYSCALLS=y |
| 773 | CONFIG_BLK_DEV_IO_TRACE=y | 775 | CONFIG_BLK_DEV_IO_TRACE=y |
| 776 | CONFIG_BPF_KPROBE_OVERRIDE=y | ||
| 774 | CONFIG_HIST_TRIGGERS=y | 777 | CONFIG_HIST_TRIGGERS=y |
| 775 | CONFIG_S390_PTDUMP=y | 778 | CONFIG_S390_PTDUMP=y |
| 776 | CONFIG_LKDTM=m | 779 | CONFIG_LKDTM=m |
| @@ -74,5 +74,6 @@ CONFIG_DEBUG_KERNEL=y · 73 unmodified lines | |||
| 74 | CONFIG_PANIC_ON_OOPS=y | 74 | CONFIG_PANIC_ON_OOPS=y |
| 75 | # CONFIG_SCHED_DEBUG is not set | 75 | # CONFIG_SCHED_DEBUG is not set |
| 76 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 76 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
| 77 | # CONFIG_RCU_TRACE is not set | ||
| 77 | # CONFIG_FTRACE is not set | 78 | # CONFIG_FTRACE is not set |
| 78 | # CONFIG_RUNTIME_TESTING_MENU is not set | 79 | # CONFIG_RUNTIME_TESTING_MENU is not set |
| @@ -60,16 +60,10 @@ __visible noinstr void do_syscall_64(unsigned long nr, struct pt_regs *regs) · 59 unmodified lines | |||
| 60 | #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) | 60 | #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) |
| 61 | static __always_inline unsigned int syscall_32_enter(struct pt_regs *regs) | 61 | static __always_inline unsigned int syscall_32_enter(struct pt_regs *regs) |
| 62 | { | 62 | { |
| 63 | unsigned int nr = (unsigned int)regs->orig_ax; | ||
| 64 | |||
| 65 | if (IS_ENABLED(CONFIG_IA32_EMULATION)) | 63 | if (IS_ENABLED(CONFIG_IA32_EMULATION)) |
| 66 | current_thread_info()->status |= TS_COMPAT; | 64 | current_thread_info()->status |= TS_COMPAT; |
| 67 | /* | 65 | |
| 68 | * Subtlety here: if ptrace pokes something larger than 2^32-1 into | 66 | return (unsigned int)regs->orig_ax; |
| 69 | * orig_ax, the unsigned int return value truncates it. This may | ||
| 70 | * or may not be necessary, but it matches the old asm behavior. | ||
| 71 | */ | ||
| 72 | return (unsigned int)syscall_enter_from_user_mode(regs, nr); | ||
| 73 | } | 67 | } |
| 74 | 68 | ||
| 75 | /* | 69 | /* |
| @@ -91,15 +85,29 @@ __visible noinstr void do_int80_syscall_32(struct pt_regs *regs) · 15 unmodified lines | |||
| 91 | { | 85 | { |
| 92 | unsigned int nr = syscall_32_enter(regs); | 86 | unsigned int nr = syscall_32_enter(regs); |
| 93 | 87 | ||
| 88 | /* | ||
| 89 | * Subtlety here: if ptrace pokes something larger than 2^32-1 into | ||
| 90 | * orig_ax, the unsigned int return value truncates it. This may | ||
| 91 | * or may not be necessary, but it matches the old asm behavior. | ||
| 92 | */ | ||
| 93 | nr = (unsigned int)syscall_enter_from_user_mode(regs, nr); | ||
| 94 | |||
| 94 | do_syscall_32_irqs_on(regs, nr); | 95 | do_syscall_32_irqs_on(regs, nr); |
| 95 | syscall_exit_to_user_mode(regs); | 96 | syscall_exit_to_user_mode(regs); |
| 96 | } | 97 | } |
| 97 | 98 | ||
| 98 | static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) | 99 | static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) |
| 99 | { | 100 | { |
| 100 | unsigned int nr = syscall_32_enter(regs); | 101 | unsigned int nr = syscall_32_enter(regs); |
| 101 | int res; | 102 | int res; |
| 102 | 103 | ||
| 104 | /* | ||
| 105 | * This cannot use syscall_enter_from_user_mode() as it has to | ||
| 106 | * fetch EBP before invoking any of the syscall entry work | ||
| 107 | * functions. | ||
| 108 | */ | ||
| 109 | syscall_enter_from_user_mode_prepare(regs); | ||
| 110 | |||
| 103 | instrumentation_begin(); | 111 | instrumentation_begin(); |
| 104 | /* Fetch EBP from where the vDSO stashed it. */ | 112 | /* Fetch EBP from where the vDSO stashed it. */ |
| 105 | if (IS_ENABLED(CONFIG_X86_64)) { | 113 | if (IS_ENABLED(CONFIG_X86_64)) { |
| @@ -122,6 +130,9 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) · 16 unmodified lines | |||
| 122 | return false; | 130 | return false; |
| 123 | } | 131 | } |
| 124 | 132 | ||
| 133 | /* The case truncates any ptrace induced syscall nr > 2^32 -1 */ | ||
| 134 | nr = (unsigned int)syscall_enter_from_user_mode_work(regs, nr); | ||
| 135 | |||
| 125 | /* Now this is just like a normal syscall. */ | 136 | /* Now this is just like a normal syscall. */ |
| 126 | do_syscall_32_irqs_on(regs, nr); | 137 | do_syscall_32_irqs_on(regs, nr); |
| 127 | syscall_exit_to_user_mode(regs); | 138 | syscall_exit_to_user_mode(regs); |
| @@ -18,8 +18,16 @@ static __always_inline void arch_check_user_regs(struct pt_regs *regs) · 17 unmodified lines | |||
| 18 | * state, not the interrupt state as imagined by Xen. | 18 | * state, not the interrupt state as imagined by Xen. |
| 19 | */ | 19 | */ |
| 20 | unsigned long flags = native_save_fl(); | 20 | unsigned long flags = native_save_fl(); |
| 21 | WARN_ON_ONCE(flags & (X86_EFLAGS_AC | X86_EFLAGS_DF | | 21 | unsigned long mask = X86_EFLAGS_DF | X86_EFLAGS_NT; |
| 22 | X86_EFLAGS_NT)); | 22 | |
| 23 | /* | ||
| 24 | * For !SMAP hardware we patch out CLAC on entry. | ||
| 25 | */ | ||
| 26 | if (boot_cpu_has(X86_FEATURE_SMAP) || | ||
| 27 | (IS_ENABLED(CONFIG_64_BIT) && boot_cpu_has(X86_FEATURE_XENPV))) | ||
| 28 | mask |= X86_EFLAGS_AC; | ||
| 29 | |||
| 30 | WARN_ON_ONCE(flags & mask); | ||
| 23 | 31 | ||
| 24 | /* We think we came from user mode. Make sure pt_regs agrees. */ | 32 | /* We think we came from user mode. Make sure pt_regs agrees. */ |
| 25 | WARN_ON_ONCE(!user_mode(regs)); | 33 | WARN_ON_ONCE(!user_mode(regs)); |
| @@ -327,8 +327,8 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs, · 326 unmodified lines | |||
| 327 | static const unsigned int argument_offs[] = { | 327 | static const unsigned int argument_offs[] = { |
| 328 | #ifdef __i386__ | 328 | #ifdef __i386__ |
| 329 | offsetof(struct pt_regs, ax), | 329 | offsetof(struct pt_regs, ax), |
| 330 | offsetof(struct pt_regs, cx), | ||
| 331 | offsetof(struct pt_regs, dx), | 330 | offsetof(struct pt_regs, dx), |
| 331 | offsetof(struct pt_regs, cx), | ||
| 332 | #define NR_REG_ARGUMENTS 3 | 332 | #define NR_REG_ARGUMENTS 3 |
| 333 | #else | 333 | #else |
| 334 | offsetof(struct pt_regs, di), | 334 | offsetof(struct pt_regs, di), |
| @@ -270,9 +270,8 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_kvm_asyncpf_interrupt) · 269 unmodified lines | |||
| 270 | { | 270 | { |
| 271 | struct pt_regs *old_regs = set_irq_regs(regs); | 271 | struct pt_regs *old_regs = set_irq_regs(regs); |
| 272 | u32 token; | 272 | u32 token; |
| 273 | irqentry_state_t state; | ||
| 274 | 273 | ||
| 275 | state = irqentry_enter(regs); | 274 | ack_APIC_irq(); |
| 276 | 275 | ||
| 277 | inc_irq_stat(irq_hv_callback_count); | 276 | inc_irq_stat(irq_hv_callback_count); |
| 278 | 277 | ||
| @@ -283,7 +282,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_kvm_asyncpf_interrupt) · 4 unmodified lines | |||
| 283 | wrmsrl(MSR_KVM_ASYNC_PF_ACK, 1); | 282 | wrmsrl(MSR_KVM_ASYNC_PF_ACK, 1); |
| 284 | } | 283 | } |
| 285 | 284 | ||
| 286 | irqentry_exit(regs, state); | ||
| 287 | set_irq_regs(old_regs); | 285 | set_irq_regs(old_regs); |
| 288 | } | 286 | } |
| 289 | 287 | ||
| @@ -654,7 +652,6 @@ static void __init kvm_guest_init(void) · 364 unmodified lines | |||
| 654 | } | 652 | } |
| 655 | 653 | ||
| 656 | if (pv_tlb_flush_supported()) { | 654 | if (pv_tlb_flush_supported()) { |
| 657 | pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; | ||
| 658 | pv_ops.mmu.tlb_remove_table = tlb_remove_table; | 655 | pv_ops.mmu.tlb_remove_table = tlb_remove_table; |
| 659 | pr_info("KVM setup pv remote TLB flush\n"); | 656 | pr_info("KVM setup pv remote TLB flush\n"); |
| 660 | } | 657 | } |
| @@ -767,6 +764,14 @@ static __init int activate_jump_labels(void) · 106 unmodified lines | |||
| 767 | } | 764 | } |
| 768 | arch_initcall(activate_jump_labels); | 765 | arch_initcall(activate_jump_labels); |
| 769 | 766 | ||
| 767 | static void kvm_free_pv_cpu_mask(void) | ||
| 768 | { | ||
| 769 | unsigned int cpu; | ||
| 770 | |||
| 771 | for_each_possible_cpu(cpu) | ||
| 772 | free_cpumask_var(per_cpu(__pv_cpu_mask, cpu)); | ||
| 773 | } | ||
| 774 | |||
| 770 | static __init int kvm_alloc_cpumask(void) | 775 | static __init int kvm_alloc_cpumask(void) |
| 771 | { | 776 | { |
| 772 | int cpu; | 777 | int cpu; |
| @@ -785,11 +790,20 @@ static __init int kvm_alloc_cpumask(void) · 12 unmodified lines | |||
| 785 | 790 | ||
| 786 | if (alloc) | 791 | if (alloc) |
| 787 | for_each_possible_cpu(cpu) { | 792 | for_each_possible_cpu(cpu) { |
| 788 | zalloc_cpumask_var_node(per_cpu_ptr(&__pv_cpu_mask, cpu), | 793 | if (!zalloc_cpumask_var_node( |
| 789 | GFP_KERNEL, cpu_to_node(cpu)); | 794 | per_cpu_ptr(&__pv_cpu_mask, cpu), |
| 795 | GFP_KERNEL, cpu_to_node(cpu))) { | ||
| 796 | goto zalloc_cpumask_fail; | ||
| 797 | } | ||
| 790 | } | 798 | } |
| 791 | 799 | ||
| 800 | apic->send_IPI_mask_allbutself = kvm_send_ipi_mask_allbutself; | ||
| 801 | pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; | ||
| 792 | return 0; | 802 | return 0; |
| 803 | |||
| 804 | zalloc_cpumask_fail: | ||
| 805 | kvm_free_pv_cpu_mask(); | ||
| 806 | return -ENOMEM; | ||
| 793 | } | 807 | } |
| 794 | arch_initcall(kvm_alloc_cpumask); | 808 | arch_initcall(kvm_alloc_cpumask); |
| 795 | 809 | ||
| @@ -729,20 +729,9 @@ static bool is_sysenter_singlestep(struct pt_regs *regs) · 728 unmodified lines | |||
| 729 | #endif | 729 | #endif |
| 730 | } | 730 | } |
| 731 | 731 | ||
| 732 | static __always_inline void debug_enter(unsigned long *dr6, unsigned long *dr7) | 732 | static __always_inline unsigned long debug_read_clear_dr6(void) |
| 733 | { | 733 | { |
| 734 | /* | 734 | unsigned long dr6; |
| 735 | * Disable breakpoints during exception handling; recursive exceptions | ||
| 736 | * are exceedingly 'fun'. | ||
| 737 | * | ||
| 738 | * Since this function is NOKPROBE, and that also applies to | ||
| 739 | * HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a | ||
| 740 | * HW_BREAKPOINT_W on our stack) | ||
| 741 | * | ||
| 742 | * Entry text is excluded for HW_BP_X and cpu_entry_area, which | ||
| 743 | * includes the entry stack is excluded for everything. | ||
| 744 | */ | ||
| 745 | *dr7 = local_db_save(); | ||
| 746 | 735 | ||
| 747 | /* | 736 | /* |
| 748 | * The Intel SDM says: | 737 | * The Intel SDM says: |
| @@ -755,15 +744,12 @@ static __always_inline void debug_enter(unsigned long *dr6, unsigned long *dr7) · 6 unmodified lines | |||
| 755 | * | 744 | * |
| 756 | * Keep it simple: clear DR6 immediately. | 745 | * Keep it simple: clear DR6 immediately. |
| 757 | */ | 746 | */ |
| 758 | get_debugreg(*dr6, 6); | 747 | get_debugreg(dr6, 6); |
| 759 | set_debugreg(0, 6); | 748 | set_debugreg(0, 6); |
| 760 | /* Filter out all the reserved bits which are preset to 1 */ | 749 | /* Filter out all the reserved bits which are preset to 1 */ |
| 761 | *dr6 &= ~DR6_RESERVED; | 750 | dr6 &= ~DR6_RESERVED; |
| 762 | } | ||
| 763 | 751 | ||
| 764 | static __always_inline void debug_exit(unsigned long dr7) | 752 | return dr6; |
| 765 | { | ||
| 766 | local_db_restore(dr7); | ||
| 767 | } | 753 | } |
| 768 | 754 | ||
| 769 | /* | 755 | /* |
| @@ -863,6 +849,18 @@ out: · 93 unmodified lines | |||
| 863 | static __always_inline void exc_debug_kernel(struct pt_regs *regs, | 849 | static __always_inline void exc_debug_kernel(struct pt_regs *regs, |
| 864 | unsigned long dr6) | 850 | unsigned long dr6) |
| 865 | { | 851 | { |
| 852 | /* | ||
| 853 | * Disable breakpoints during exception handling; recursive exceptions | ||
| 854 | * are exceedingly 'fun'. | ||
| 855 | * | ||
| 856 | * Since this function is NOKPROBE, and that also applies to | ||
| 857 | * HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a | ||
| 858 | * HW_BREAKPOINT_W on our stack) | ||
| 859 | * | ||
| 860 | * Entry text is excluded for HW_BP_X and cpu_entry_area, which | ||
| 861 | * includes the entry stack is excluded for everything. | ||
| 862 | */ | ||
| 863 | unsigned long dr7 = local_db_save(); | ||
| 866 | bool irq_state = idtentry_enter_nmi(regs); | 864 | bool irq_state = idtentry_enter_nmi(regs); |
| 867 | instrumentation_begin(); | 865 | instrumentation_begin(); |
| 868 | 866 | ||
| @@ -883,6 +881,8 @@ static __always_inline void exc_debug_kernel(struct pt_regs *regs, · 14 unmodified lines | |||
| 883 | 881 | ||
| 884 | instrumentation_end(); | 882 | instrumentation_end(); |
| 885 | idtentry_exit_nmi(regs, irq_state); | 883 | idtentry_exit_nmi(regs, irq_state); |
| 884 | |||
| 885 | local_db_restore(dr7); | ||
| 886 | } | 886 | } |
| 887 | 887 | ||
| 888 | static __always_inline void exc_debug_user(struct pt_regs *regs, | 888 | static __always_inline void exc_debug_user(struct pt_regs *regs, |
| @@ -894,6 +894,15 @@ static __always_inline void exc_debug_user(struct pt_regs *regs, · 5 unmodified lines | |||
| 894 | */ | 894 | */ |
| 895 | WARN_ON_ONCE(!user_mode(regs)); | 895 | WARN_ON_ONCE(!user_mode(regs)); |
| 896 | 896 | ||
| 897 | /* | ||
| 898 | * NB: We can't easily clear DR7 here because | ||
| 899 | * idtentry_exit_to_usermode() can invoke ptrace, schedule, access | ||
| 900 | * user memory, etc. This means that a recursive #DB is possible. If | ||
| 901 | * this happens, that #DB will hit exc_debug_kernel() and clear DR7. | ||
| 902 | * Since we're not on the IST stack right now, everything will be | ||
| 903 | * fine. | ||
| 904 | */ | ||
| 905 | |||
| 897 | irqentry_enter_from_user_mode(regs); | 906 | irqentry_enter_from_user_mode(regs); |
| 898 | instrumentation_begin(); | 907 | instrumentation_begin(); |
| 899 | 908 | ||
| @@ -907,36 +916,24 @@ static __always_inline void exc_debug_user(struct pt_regs *regs, · 7 unmodified lines | |||
| 907 | /* IST stack entry */ | 916 | /* IST stack entry */ |
| 908 | DEFINE_IDTENTRY_DEBUG(exc_debug) | 917 | DEFINE_IDTENTRY_DEBUG(exc_debug) |
| 909 | { | 918 | { |
| 910 | unsigned long dr6, dr7; | 919 | exc_debug_kernel(regs, debug_read_clear_dr6()); |
| 911 | |||
| 912 | debug_enter(&dr6, &dr7); | ||
| 913 | exc_debug_kernel(regs, dr6); | ||
| 914 | debug_exit(dr7); | ||
| 915 | } | 920 | } |
| 916 | 921 | ||
| 917 | /* User entry, runs on regular task stack */ | 922 | /* User entry, runs on regular task stack */ |
| 918 | DEFINE_IDTENTRY_DEBUG_USER(exc_debug) | 923 | DEFINE_IDTENTRY_DEBUG_USER(exc_debug) |
| 919 | { | 924 | { |
| 920 | unsigned long dr6, dr7; | 925 | exc_debug_user(regs, debug_read_clear_dr6()); |
| 921 | |||
| 922 | debug_enter(&dr6, &dr7); | ||
| 923 | exc_debug_user(regs, dr6); | ||
| 924 | debug_exit(dr7); | ||
| 925 | } | 926 | } |
| 926 | #else | 927 | #else |
| 927 | /* 32 bit does not have separate entry points. */ | 928 | /* 32 bit does not have separate entry points. */ |
| 928 | DEFINE_IDTENTRY_RAW(exc_debug) | 929 | DEFINE_IDTENTRY_RAW(exc_debug) |
| 929 | { | 930 | { |
| 930 | unsigned long dr6, dr7; | 931 | unsigned long dr6 = debug_read_clear_dr6(); |
| 931 | |||
| 932 | debug_enter(&dr6, &dr7); | ||
| 933 | 932 | ||
| 934 | if (user_mode(regs)) | 933 | if (user_mode(regs)) |
| 935 | exc_debug_user(regs, dr6); | 934 | exc_debug_user(regs, dr6); |
| 936 | else | 935 | else |
| 937 | exc_debug_kernel(regs, dr6); | 936 | exc_debug_kernel(regs, dr6); |
| 938 | |||
| 939 | debug_exit(dr7); | ||
| 940 | } | 937 | } |
| 941 | #endif | 938 | #endif |
| 942 | 939 | ||
| @@ -2505,9 +2505,14 @@ static int rsm_load_state_32(struct x86_emulate_ctxt *ctxt, · 2504 unmodified lines | |||
| 2505 | *reg_write(ctxt, i) = GET_SMSTATE(u32, smstate, 0x7fd0 + i * 4); | 2505 | *reg_write(ctxt, i) = GET_SMSTATE(u32, smstate, 0x7fd0 + i * 4); |
| 2506 | 2506 | ||
| 2507 | val = GET_SMSTATE(u32, smstate, 0x7fcc); | 2507 | val = GET_SMSTATE(u32, smstate, 0x7fcc); |
| 2508 | ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1); | 2508 | |
| 2509 | if (ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1)) | ||
| 2510 | return X86EMUL_UNHANDLEABLE; | ||
| 2511 | |||
| 2509 | val = GET_SMSTATE(u32, smstate, 0x7fc8); | 2512 | val = GET_SMSTATE(u32, smstate, 0x7fc8); |
| 2510 | ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1); | 2513 | |
| 2514 | if (ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1)) | ||
| 2515 | return X86EMUL_UNHANDLEABLE; | ||
| 2511 | 2516 | ||
| 2512 | selector = GET_SMSTATE(u32, smstate, 0x7fc4); | 2517 | selector = GET_SMSTATE(u32, smstate, 0x7fc4); |
| 2513 | set_desc_base(&desc, GET_SMSTATE(u32, smstate, 0x7f64)); | 2518 | set_desc_base(&desc, GET_SMSTATE(u32, smstate, 0x7f64)); |
| @@ -2560,16 +2565,23 @@ static int rsm_load_state_64(struct x86_emulate_ctxt *ctxt, · 46 unmodified lines | |||
| 2560 | ctxt->eflags = GET_SMSTATE(u32, smstate, 0x7f70) | X86_EFLAGS_FIXED; | 2565 | ctxt->eflags = GET_SMSTATE(u32, smstate, 0x7f70) | X86_EFLAGS_FIXED; |
| 2561 | 2566 | ||
| 2562 | val = GET_SMSTATE(u32, smstate, 0x7f68); | 2567 | val = GET_SMSTATE(u32, smstate, 0x7f68); |
| 2563 | ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1); | 2568 | |
| 2569 | if (ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1)) | ||
| 2570 | return X86EMUL_UNHANDLEABLE; | ||
| 2571 | |||
| 2564 | val = GET_SMSTATE(u32, smstate, 0x7f60); | 2572 | val = GET_SMSTATE(u32, smstate, 0x7f60); |
| 2565 | ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1); | 2573 | |
| 2574 | if (ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1)) | ||
| 2575 | return X86EMUL_UNHANDLEABLE; | ||
| 2566 | 2576 | ||
| 2567 | cr0 = GET_SMSTATE(u64, smstate, 0x7f58); | 2577 | cr0 = GET_SMSTATE(u64, smstate, 0x7f58); |
| 2568 | cr3 = GET_SMSTATE(u64, smstate, 0x7f50); | 2578 | cr3 = GET_SMSTATE(u64, smstate, 0x7f50); |
| 2569 | cr4 = GET_SMSTATE(u64, smstate, 0x7f48); | 2579 | cr4 = GET_SMSTATE(u64, smstate, 0x7f48); |
| 2570 | ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smstate, 0x7f00)); | 2580 | ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smstate, 0x7f00)); |
| 2571 | val = GET_SMSTATE(u64, smstate, 0x7ed0); | 2581 | val = GET_SMSTATE(u64, smstate, 0x7ed0); |
| 2572 | ctxt->ops->set_msr(ctxt, MSR_EFER, val & ~EFER_LMA); | 2582 | |
| 2583 | if (ctxt->ops->set_msr(ctxt, MSR_EFER, val & ~EFER_LMA)) | ||
| 2584 | return X86EMUL_UNHANDLEABLE; | ||
| 2573 | 2585 | ||
| 2574 | selector = GET_SMSTATE(u32, smstate, 0x7e90); | 2586 | selector = GET_SMSTATE(u32, smstate, 0x7e90); |
| 2575 | rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smstate, 0x7e92) << 8); | 2587 | rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smstate, 0x7e92) << 8); |
| @@ -2469,7 +2469,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, · 2468 unmodified lines | |||
| 2469 | } | 2469 | } |
| 2470 | 2470 | ||
| 2471 | if (sp->unsync_children) | 2471 | if (sp->unsync_children) |
| 2472 | kvm_make_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu); | 2472 | kvm_make_request(KVM_REQ_MMU_SYNC, vcpu); |
| 2473 | 2473 | ||
| 2474 | __clear_sp_write_flooding_count(sp); | 2474 | __clear_sp_write_flooding_count(sp); |
| 2475 | 2475 | ||
| @@ -586,7 +586,6 @@ int nested_svm_vmexit(struct vcpu_svm *svm) · 585 unmodified lines | |||
| 586 | svm->vcpu.arch.mp_state = KVM_MP_STATE_RUNNABLE; | 586 | svm->vcpu.arch.mp_state = KVM_MP_STATE_RUNNABLE; |
| 587 | 587 | ||
| 588 | /* Give the current vmcb to the guest */ | 588 | /* Give the current vmcb to the guest */ |
| 589 | svm_set_gif(svm, false); | ||
| 590 | 589 | ||
| 591 | nested_vmcb->save.es = vmcb->save.es; | 590 | nested_vmcb->save.es = vmcb->save.es; |
| 592 | nested_vmcb->save.cs = vmcb->save.cs; | 591 | nested_vmcb->save.cs = vmcb->save.cs; |
| @@ -632,6 +631,9 @@ int nested_svm_vmexit(struct vcpu_svm *svm) · 39 unmodified lines | |||
| 632 | /* Restore the original control entries */ | 631 | /* Restore the original control entries */ |
| 633 | copy_vmcb_control_area(&vmcb->control, &hsave->control); | 632 | copy_vmcb_control_area(&vmcb->control, &hsave->control); |
| 634 | 633 | ||
| 634 | /* On vmexit the GIF is set to false */ | ||
| 635 | svm_set_gif(svm, false); | ||
| 636 | |||
| 635 | svm->vmcb->control.tsc_offset = svm->vcpu.arch.tsc_offset = | 637 | svm->vmcb->control.tsc_offset = svm->vcpu.arch.tsc_offset = |
| 636 | svm->vcpu.arch.l1_tsc_offset; | 638 | svm->vcpu.arch.l1_tsc_offset; |
| 637 | 639 | ||
| @@ -1132,6 +1134,9 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 494 unmodified lines | |||
| 1132 | load_nested_vmcb_control(svm, &ctl); | 1134 | load_nested_vmcb_control(svm, &ctl); |
| 1133 | nested_prepare_vmcb_control(svm); | 1135 | nested_prepare_vmcb_control(svm); |
| 1134 | 1136 | ||
| 1137 | if (!nested_svm_vmrun_msrpm(svm)) | ||
| 1138 | return -EINVAL; | ||
| 1139 | |||
| 1135 | out_set_gif: | 1140 | out_set_gif: |
| 1136 | svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET)); | 1141 | svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET)); |
| 1137 | return 0; | 1142 | return 0; |
| @@ -1106,6 +1106,7 @@ void sev_vm_destroy(struct kvm *kvm) · 1105 unmodified lines | |||
| 1106 | list_for_each_safe(pos, q, head) { | 1106 | list_for_each_safe(pos, q, head) { |
| 1107 | __unregister_enc_region_locked(kvm, | 1107 | __unregister_enc_region_locked(kvm, |
| 1108 | list_entry(pos, struct enc_region, list)); | 1108 | list_entry(pos, struct enc_region, list)); |
| 1109 | cond_resched(); | ||
| 1109 | } | 1110 | } |
| 1110 | } | 1111 | } |
| 1111 | 1112 | ||
| @@ -2938,8 +2938,6 @@ static int handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) · 2937 unmodified lines | |||
| 2938 | if (npt_enabled) | 2938 | if (npt_enabled) |
| 2939 | vcpu->arch.cr3 = svm->vmcb->save.cr3; | 2939 | vcpu->arch.cr3 = svm->vmcb->save.cr3; |
| 2940 | 2940 | ||
| 2941 | svm_complete_interrupts(svm); | ||
| 2942 | |||
| 2943 | if (is_guest_mode(vcpu)) { | 2941 | if (is_guest_mode(vcpu)) { |
| 2944 | int vmexit; | 2942 | int vmexit; |
| 2945 | 2943 | ||
| @@ -3504,7 +3502,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) · 558 unmodified lines | |||
| 3504 | stgi(); | 3502 | stgi(); |
| 3505 | 3503 | ||
| 3506 | /* Any pending NMI will happen here */ | 3504 | /* Any pending NMI will happen here */ |
| 3507 | exit_fastpath = svm_exit_handlers_fastpath(vcpu); | ||
| 3508 | 3505 | ||
| 3509 | if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI)) | 3506 | if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI)) |
| 3510 | kvm_after_interrupt(&svm->vcpu); | 3507 | kvm_after_interrupt(&svm->vcpu); |
| @@ -3518,6 +3515,7 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) · 7 unmodified lines | |||
| 3518 | } | 3515 | } |
| 3519 | 3516 | ||
| 3520 | svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; | 3517 | svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; |
| 3518 | vmcb_mark_all_clean(svm->vmcb); | ||
| 3521 | 3519 | ||
| 3522 | /* if exit due to PF check for async PF */ | 3520 | /* if exit due to PF check for async PF */ |
| 3523 | if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR) | 3521 | if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR) |
| @@ -3537,7 +3535,8 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu) · 13 unmodified lines | |||
| 3537 | SVM_EXIT_EXCP_BASE + MC_VECTOR)) | 3535 | SVM_EXIT_EXCP_BASE + MC_VECTOR)) |
| 3538 | svm_handle_mce(svm); | 3536 | svm_handle_mce(svm); |
| 3539 | 3537 | ||
| 3540 | vmcb_mark_all_clean(svm->vmcb); | 3538 | svm_complete_interrupts(svm); |
| 3539 | exit_fastpath = svm_exit_handlers_fastpath(vcpu); | ||
| 3541 | return exit_fastpath; | 3540 | return exit_fastpath; |
| 3542 | } | 3541 | } |
| 3543 | 3542 | ||
| @@ -3900,21 +3899,28 @@ static int svm_pre_enter_smm(struct kvm_vcpu *vcpu, char *smstate) · 356 unmodified lines | |||
| 3900 | static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) | 3899 | static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) |
| 3901 | { | 3900 | { |
| 3902 | struct vcpu_svm *svm = to_svm(vcpu); | 3901 | struct vcpu_svm *svm = to_svm(vcpu); |
| 3903 | struct vmcb *nested_vmcb; | ||
| 3904 | struct kvm_host_map map; | 3902 | struct kvm_host_map map; |
| 3905 | u64 guest; | ||
| 3906 | u64 vmcb; | ||
| 3907 | int ret = 0; | 3903 | int ret = 0; |
| 3908 | 3904 | ||
| 3909 | guest = GET_SMSTATE(u64, smstate, 0x7ed8); | 3905 | if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) { |
| 3910 | vmcb = GET_SMSTATE(u64, smstate, 0x7ee0); | 3906 | u64 saved_efer = GET_SMSTATE(u64, smstate, 0x7ed0); |
| 3907 | u64 guest = GET_SMSTATE(u64, smstate, 0x7ed8); | ||
| 3908 | u64 vmcb = GET_SMSTATE(u64, smstate, 0x7ee0); | ||
| 3911 | 3909 | ||
| 3912 | if (guest) { | 3910 | if (guest) { |
| 3913 | if (kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb), &map) == -EINVAL) | 3911 | if (!guest_cpuid_has(vcpu, X86_FEATURE_SVM)) |
| 3914 | return 1; | 3912 | return 1; |
| 3915 | nested_vmcb = map.hva; | 3913 | |
| 3916 | ret = enter_svm_guest_mode(svm, vmcb, nested_vmcb); | 3914 | if (!(saved_efer & EFER_SVME)) |
| 3917 | kvm_vcpu_unmap(&svm->vcpu, &map, true); | 3915 | return 1; |
| 3916 | |||
| 3917 | if (kvm_vcpu_map(&svm->vcpu, | ||
| 3918 | gpa_to_gfn(vmcb), &map) == -EINVAL) | ||
| 3919 | return 1; | ||
| 3920 | |||
| 3921 | ret = enter_svm_guest_mode(svm, vmcb, map.hva); | ||
| 3922 | kvm_vcpu_unmap(&svm->vcpu, &map, true); | ||
| 3923 | } | ||
| 3918 | } | 3924 | } |
| 3919 | 3925 | ||
| 3920 | return ret; | 3926 | return ret; |
| @@ -4404,6 +4404,14 @@ void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 vm_exit_reason, · 4403 unmodified lines | |||
| 4404 | if (kvm_check_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu)) | 4404 | if (kvm_check_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu)) |
| 4405 | kvm_vcpu_flush_tlb_current(vcpu); | 4405 | kvm_vcpu_flush_tlb_current(vcpu); |
| 4406 | 4406 | ||
| 4407 | /* | ||
| 4408 | * VCPU_EXREG_PDPTR will be clobbered in arch/x86/kvm/vmx/vmx.h between | ||
| 4409 | * now and the new vmentry. Ensure that the VMCS02 PDPTR fields are | ||
| 4410 | * up-to-date before switching to L1. | ||
| 4411 | */ | ||
| 4412 | if (enable_ept && is_pae_paging(vcpu)) | ||
| 4413 | vmx_ept_load_pdptrs(vcpu); | ||
| 4414 | |||
| 4407 | leave_guest_mode(vcpu); | 4415 | leave_guest_mode(vcpu); |
| 4408 | 4416 | ||
| 4409 | if (nested_cpu_has_preemption_timer(vmcs12)) | 4417 | if (nested_cpu_has_preemption_timer(vmcs12)) |
| @@ -4668,7 +4676,7 @@ void nested_vmx_pmu_entry_exit_ctls_update(struct kvm_vcpu *vcpu) · 258 unmodified lines | |||
| 4668 | vmx->nested.msrs.entry_ctls_high &= | 4676 | vmx->nested.msrs.entry_ctls_high &= |
| 4669 | ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; | 4677 | ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; |
| 4670 | vmx->nested.msrs.exit_ctls_high &= | 4678 | vmx->nested.msrs.exit_ctls_high &= |
| 4671 | ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; | 4679 | ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; |
| 4672 | } | 4680 | } |
| 4673 | } | 4681 | } |
| 4674 | 4682 | ||
| @@ -2971,7 +2971,7 @@ static void vmx_flush_tlb_guest(struct kvm_vcpu *vcpu) · 2970 unmodified lines | |||
| 2971 | vpid_sync_context(to_vmx(vcpu)->vpid); | 2971 | vpid_sync_context(to_vmx(vcpu)->vpid); |
| 2972 | } | 2972 | } |
| 2973 | 2973 | ||
| 2974 | static void ept_load_pdptrs(struct kvm_vcpu *vcpu) | 2974 | void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu) |
| 2975 | { | 2975 | { |
| 2976 | struct kvm_mmu *mmu = vcpu->arch.walk_mmu; | 2976 | struct kvm_mmu *mmu = vcpu->arch.walk_mmu; |
| 2977 | 2977 | ||
| @@ -3114,7 +3114,7 @@ static void vmx_load_mmu_pgd(struct kvm_vcpu *vcpu, unsigned long pgd, · 136 unmodified lines | |||
| 3114 | guest_cr3 = vcpu->arch.cr3; | 3114 | guest_cr3 = vcpu->arch.cr3; |
| 3115 | else /* vmcs01.GUEST_CR3 is already up-to-date. */ | 3115 | else /* vmcs01.GUEST_CR3 is already up-to-date. */ |
| 3116 | update_guest_cr3 = false; | 3116 | update_guest_cr3 = false; |
| 3117 | ept_load_pdptrs(vcpu); | 3117 | vmx_ept_load_pdptrs(vcpu); |
| 3118 | } else { | 3118 | } else { |
| 3119 | guest_cr3 = pgd; | 3119 | guest_cr3 = pgd; |
| 3120 | } | 3120 | } |
| @@ -6054,6 +6054,7 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) · 2933 unmodified lines | |||
| 6054 | (exit_reason != EXIT_REASON_EXCEPTION_NMI && | 6054 | (exit_reason != EXIT_REASON_EXCEPTION_NMI && |
| 6055 | exit_reason != EXIT_REASON_EPT_VIOLATION && | 6055 | exit_reason != EXIT_REASON_EPT_VIOLATION && |
| 6056 | exit_reason != EXIT_REASON_PML_FULL && | 6056 | exit_reason != EXIT_REASON_PML_FULL && |
| 6057 | exit_reason != EXIT_REASON_APIC_ACCESS && | ||
| 6057 | exit_reason != EXIT_REASON_TASK_SWITCH)) { | 6058 | exit_reason != EXIT_REASON_TASK_SWITCH)) { |
| 6058 | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | 6059 | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; |
| 6059 | vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV; | 6060 | vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV; |
| @@ -356,6 +356,7 @@ void vmx_update_host_rsp(struct vcpu_vmx *vmx, unsigned long host_rsp); · 355 unmodified lines | |||
| 356 | int vmx_find_msr_index(struct vmx_msrs *m, u32 msr); | 356 | int vmx_find_msr_index(struct vmx_msrs *m, u32 msr); |
| 357 | int vmx_handle_memory_failure(struct kvm_vcpu *vcpu, int r, | 357 | int vmx_handle_memory_failure(struct kvm_vcpu *vcpu, int r, |
| 358 | struct x86_exception *e); | 358 | struct x86_exception *e); |
| 359 | void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu); | ||
| 359 | 360 | ||
| 360 | #define POSTED_INTR_ON 0 | 361 | #define POSTED_INTR_ON 0 |
| 361 | #define POSTED_INTR_SN 1 | 362 | #define POSTED_INTR_SN 1 |
| @@ -2731,7 +2731,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) · 2730 unmodified lines | |||
| 2731 | return 1; | 2731 | return 1; |
| 2732 | 2732 | ||
| 2733 | if (!lapic_in_kernel(vcpu)) | 2733 | if (!lapic_in_kernel(vcpu)) |
| 2734 | return 1; | 2734 | return data ? 1 : 0; |
| 2735 | 2735 | ||
| 2736 | vcpu->arch.apf.msr_en_val = data; | 2736 | vcpu->arch.apf.msr_en_val = data; |
| 2737 | 2737 | ||
| @@ -3578,6 +3578,9 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 840 unmodified lines | |||
| 3578 | case KVM_CAP_SMALLER_MAXPHYADDR: | 3578 | case KVM_CAP_SMALLER_MAXPHYADDR: |
| 3579 | r = (int) allow_smaller_maxphyaddr; | 3579 | r = (int) allow_smaller_maxphyaddr; |
| 3580 | break; | 3580 | break; |
| 3581 | case KVM_CAP_STEAL_TIME: | ||
| 3582 | r = sched_info_on(); | ||
| 3583 | break; | ||
| 3581 | default: | 3584 | default: |
| 3582 | break; | 3585 | break; |
| 3583 | } | 3586 | } |
| @@ -24,7 +24,7 @@ ifdef CONFIG_FUNCTION_TRACER · 23 unmodified lines | |||
| 24 | CFLAGS_REMOVE_cmdline.o = -pg | 24 | CFLAGS_REMOVE_cmdline.o = -pg |
| 25 | endif | 25 | endif |
| 26 | 26 | ||
| 27 | CFLAGS_cmdline.o := -fno-stack-protector | 27 | CFLAGS_cmdline.o := -fno-stack-protector -fno-jump-tables |
| 28 | endif | 28 | endif |
| 29 | 29 | ||
| 30 | inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk | 30 | inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk |
| @@ -190,6 +190,53 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) · 189 unmodified lines | |||
| 190 | return pmd_k; | 190 | return pmd_k; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | /* | ||
| 194 | * Handle a fault on the vmalloc or module mapping area | ||
| 195 | * | ||
| 196 | * This is needed because there is a race condition between the time | ||
| 197 | * when the vmalloc mapping code updates the PMD to the point in time | ||
| 198 | * where it synchronizes this update with the other page-tables in the | ||
| 199 | * system. | ||
| 200 | * | ||
| 201 | * In this race window another thread/CPU can map an area on the same | ||
| 202 | * PMD, finds it already present and does not synchronize it with the | ||
| 203 | * rest of the system yet. As a result v[mz]alloc might return areas | ||
| 204 | * which are not mapped in every page-table in the system, causing an | ||
| 205 | * unhandled page-fault when they are accessed. | ||
| 206 | */ | ||
| 207 | static noinline int vmalloc_fault(unsigned long address) | ||
| 208 | { | ||
| 209 | unsigned long pgd_paddr; | ||
| 210 | pmd_t *pmd_k; | ||
| 211 | pte_t *pte_k; | ||
| 212 | |||
| 213 | /* Make sure we are in vmalloc area: */ | ||
| 214 | if (!(address >= VMALLOC_START && address < VMALLOC_END)) | ||
| 215 | return -1; | ||
| 216 | |||
| 217 | /* | ||
| 218 | * Synchronize this task's top level page-table | ||
| 219 | * with the 'reference' page table. | ||
| 220 | * | ||
| 221 | * Do _not_ use "current" here. We might be inside | ||
| 222 | * an interrupt in the middle of a task switch.. | ||
| 223 | */ | ||
| 224 | pgd_paddr = read_cr3_pa(); | ||
| 225 | pmd_k = vmalloc_sync_one(__va(pgd_paddr), address); | ||
| 226 | if (!pmd_k) | ||
| 227 | return -1; | ||
| 228 | |||
| 229 | if (pmd_large(*pmd_k)) | ||
| 230 | return 0; | ||
| 231 | |||
| 232 | pte_k = pte_offset_kernel(pmd_k, address); | ||
| 233 | if (!pte_present(*pte_k)) | ||
| 234 | return -1; | ||
| 235 | |||
| 236 | return 0; | ||
| 237 | } | ||
| 238 | NOKPROBE_SYMBOL(vmalloc_fault); | ||
| 239 | |||
| 193 | void arch_sync_kernel_mappings(unsigned long start, unsigned long end) | 240 | void arch_sync_kernel_mappings(unsigned long start, unsigned long end) |
| 194 | { | 241 | { |
| 195 | unsigned long addr; | 242 | unsigned long addr; |
| @@ -1110,6 +1157,37 @@ do_kern_addr_fault(struct pt_regs *regs, unsigned long hw_error_code, · 914 unmodified lines | |||
| 1110 | */ | 1157 | */ |
| 1111 | WARN_ON_ONCE(hw_error_code & X86_PF_PK); | 1158 | WARN_ON_ONCE(hw_error_code & X86_PF_PK); |
| 1112 | 1159 | ||
| 1160 | #ifdef CONFIG_X86_32 | ||
| 1161 | /* | ||
| 1162 | * We can fault-in kernel-space virtual memory on-demand. The | ||
| 1163 | * 'reference' page table is init_mm.pgd. | ||
| 1164 | * | ||
| 1165 | * NOTE! We MUST NOT take any locks for this case. We may | ||
| 1166 | * be in an interrupt or a critical region, and should | ||
| 1167 | * only copy the information from the master page table, | ||
| 1168 | * nothing more. | ||
| 1169 | * | ||
| 1170 | * Before doing this on-demand faulting, ensure that the | ||
| 1171 | * fault is not any of the following: | ||
| 1172 | * 1. A fault on a PTE with a reserved bit set. | ||
| 1173 | * 2. A fault caused by a user-mode access. (Do not demand- | ||
| 1174 | * fault kernel memory due to user-mode accesses). | ||
| 1175 | * 3. A fault caused by a page-level protection violation. | ||
| 1176 | * (A demand fault would be on a non-present page which | ||
| 1177 | * would have X86_PF_PROT==0). | ||
| 1178 | * | ||
| 1179 | * This is only needed to close a race condition on x86-32 in | ||
| 1180 | * the vmalloc mapping/unmapping code. See the comment above | ||
| 1181 | * vmalloc_fault() for details. On x86-64 the race does not | ||
| 1182 | * exist as the vmalloc mappings don't need to be synchronized | ||
| 1183 | * there. | ||
| 1184 | */ | ||
| 1185 | if (!(hw_error_code & (X86_PF_RSVD | X86_PF_USER | X86_PF_PROT))) { | ||
| 1186 | if (vmalloc_fault(address) >= 0) | ||
| 1187 | return; | ||
| 1188 | } | ||
| 1189 | #endif | ||
| 1190 | |||
| 1113 | /* Was the fault spurious, caused by lazy TLB invalidation? */ | 1191 | /* Was the fault spurious, caused by lazy TLB invalidation? */ |
| 1114 | if (spurious_kernel_fault(hw_error_code, address)) | 1192 | if (spurious_kernel_fault(hw_error_code, address)) |
| 1115 | return; | 1193 | return; |
| @@ -321,7 +321,7 @@ static int __init split_nodes_size_interleave(struct numa_meminfo *ei, · 320 unmodified lines | |||
| 321 | u64 addr, u64 max_addr, u64 size) | 321 | u64 addr, u64 max_addr, u64 size) |
| 322 | { | 322 | { |
| 323 | return split_nodes_size_interleave_uniform(ei, pi, addr, max_addr, size, | 323 | return split_nodes_size_interleave_uniform(ei, pi, addr, max_addr, size, |
| 324 | 0, NULL, NUMA_NO_NODE); | 324 | 0, NULL, 0); |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | static int __init setup_emu2phys_nid(int *dfl_phys_nid) | 327 | static int __init setup_emu2phys_nid(int *dfl_phys_nid) |
| @@ -5895,18 +5895,6 @@ static void bfq_finish_requeue_request(struct request *rq) · 5894 unmodified lines | |||
| 5895 | struct bfq_queue *bfqq = RQ_BFQQ(rq); | 5895 | struct bfq_queue *bfqq = RQ_BFQQ(rq); |
| 5896 | struct bfq_data *bfqd; | 5896 | struct bfq_data *bfqd; |
| 5897 | 5897 | ||
| 5898 | /* | ||
| 5899 | * Requeue and finish hooks are invoked in blk-mq without | ||
| 5900 | * checking whether the involved request is actually still | ||
| 5901 | * referenced in the scheduler. To handle this fact, the | ||
| 5902 | * following two checks make this function exit in case of | ||
| 5903 | * spurious invocations, for which there is nothing to do. | ||
| 5904 | * | ||
| 5905 | * First, check whether rq has nothing to do with an elevator. | ||
| 5906 | */ | ||
| 5907 | if (unlikely(!(rq->rq_flags & RQF_ELVPRIV))) | ||
| 5908 | return; | ||
| 5909 | |||
| 5910 | /* | 5898 | /* |
| 5911 | * rq either is not associated with any icq, or is an already | 5899 | * rq either is not associated with any icq, or is an already |
| 5912 | * requeued request that has not (yet) been re-inserted into | 5900 | * requeued request that has not (yet) been re-inserted into |
| @@ -879,8 +879,10 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page, · 878 unmodified lines | |||
| 879 | struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; | 879 | struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; |
| 880 | 880 | ||
| 881 | if (page_is_mergeable(bv, page, len, off, same_page)) { | 881 | if (page_is_mergeable(bv, page, len, off, same_page)) { |
| 882 | if (bio->bi_iter.bi_size > UINT_MAX - len) | 882 | if (bio->bi_iter.bi_size > UINT_MAX - len) { |
| 883 | *same_page = false; | ||
| 883 | return false; | 884 | return false; |
| 885 | } | ||
| 884 | bv->bv_len += len; | 886 | bv->bv_len += len; |
| 885 | bio->bi_iter.bi_size += len; | 887 | bio->bi_iter.bi_size += len; |
| 886 | return true; | 888 | return true; |
| @@ -539,6 +539,7 @@ struct request_queue *blk_alloc_queue(int node_id) · 538 unmodified lines | |||
| 539 | goto fail_stats; | 539 | goto fail_stats; |
| 540 | 540 | ||
| 541 | q->backing_dev_info->ra_pages = VM_READAHEAD_PAGES; | 541 | q->backing_dev_info->ra_pages = VM_READAHEAD_PAGES; |
| 542 | q->backing_dev_info->io_pages = VM_READAHEAD_PAGES; | ||
| 542 | q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK; | 543 | q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK; |
| 543 | q->node = node_id; | 544 | q->node = node_id; |
| 544 | 545 | ||
| @@ -2092,14 +2092,15 @@ static void ioc_pd_free(struct blkg_policy_data *pd) · 2091 unmodified lines | |||
| 2092 | { | 2092 | { |
| 2093 | struct ioc_gq *iocg = pd_to_iocg(pd); | 2093 | struct ioc_gq *iocg = pd_to_iocg(pd); |
| 2094 | struct ioc *ioc = iocg->ioc; | 2094 | struct ioc *ioc = iocg->ioc; |
| 2095 | unsigned long flags; | ||
| 2095 | 2096 | ||
| 2096 | if (ioc) { | 2097 | if (ioc) { |
| 2097 | spin_lock(&ioc->lock); | 2098 | spin_lock_irqsave(&ioc->lock, flags); |
| 2098 | if (!list_empty(&iocg->active_list)) { | 2099 | if (!list_empty(&iocg->active_list)) { |
| 2099 | propagate_active_weight(iocg, 0, 0); | 2100 | propagate_active_weight(iocg, 0, 0); |
| 2100 | list_del_init(&iocg->active_list); | 2101 | list_del_init(&iocg->active_list); |
| 2101 | } | 2102 | } |
| 2102 | spin_unlock(&ioc->lock); | 2103 | spin_unlock_irqrestore(&ioc->lock, flags); |
| 2103 | 2104 | ||
| 2104 | hrtimer_cancel(&iocg->waitq_timer); | 2105 | hrtimer_cancel(&iocg->waitq_timer); |
| 2105 | hrtimer_cancel(&iocg->delay_timer); | 2106 | hrtimer_cancel(&iocg->delay_timer); |
| @@ -66,7 +66,7 @@ static inline void blk_mq_sched_requeue_request(struct request *rq) · 65 unmodified lines | |||
| 66 | struct request_queue *q = rq->q; | 66 | struct request_queue *q = rq->q; |
| 67 | struct elevator_queue *e = q->elevator; | 67 | struct elevator_queue *e = q->elevator; |
| 68 | 68 | ||
| 69 | if (e && e->type->ops.requeue_request) | 69 | if ((rq->rq_flags & RQF_ELVPRIV) && e && e->type->ops.requeue_request) |
| 70 | e->type->ops.requeue_request(rq); | 70 | e->type->ops.requeue_request(rq); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| @@ -137,6 +137,7 @@ void blk_stat_add_callback(struct request_queue *q, · 136 unmodified lines | |||
| 137 | struct blk_stat_callback *cb) | 137 | struct blk_stat_callback *cb) |
| 138 | { | 138 | { |
| 139 | unsigned int bucket; | 139 | unsigned int bucket; |
| 140 | unsigned long flags; | ||
| 140 | int cpu; | 141 | int cpu; |
| 141 | 142 | ||
| 142 | for_each_possible_cpu(cpu) { | 143 | for_each_possible_cpu(cpu) { |
| @@ -147,20 +148,22 @@ void blk_stat_add_callback(struct request_queue *q, · 4 unmodified lines | |||
| 147 | blk_rq_stat_init(&cpu_stat[bucket]); | 148 | blk_rq_stat_init(&cpu_stat[bucket]); |
| 148 | } | 149 | } |
| 149 | 150 | ||
| 150 | spin_lock(&q->stats->lock); | 151 | spin_lock_irqsave(&q->stats->lock, flags); |
| 151 | list_add_tail_rcu(&cb->list, &q->stats->callbacks); | 152 | list_add_tail_rcu(&cb->list, &q->stats->callbacks); |
| 152 | blk_queue_flag_set(QUEUE_FLAG_STATS, q); | 153 | blk_queue_flag_set(QUEUE_FLAG_STATS, q); |
| 153 | spin_unlock(&q->stats->lock); | 154 | spin_unlock_irqrestore(&q->stats->lock, flags); |
| 154 | } | 155 | } |
| 155 | 156 | ||
| 156 | void blk_stat_remove_callback(struct request_queue *q, | 157 | void blk_stat_remove_callback(struct request_queue *q, |
| 157 | struct blk_stat_callback *cb) | 158 | struct blk_stat_callback *cb) |
| 158 | { | 159 | { |
| 159 | spin_lock(&q->stats->lock); | 160 | unsigned long flags; |
| 161 | |||
| 162 | spin_lock_irqsave(&q->stats->lock, flags); | ||
| 160 | list_del_rcu(&cb->list); | 163 | list_del_rcu(&cb->list); |
| 161 | if (list_empty(&q->stats->callbacks) && !q->stats->enable_accounting) | 164 | if (list_empty(&q->stats->callbacks) && !q->stats->enable_accounting) |
| 162 | blk_queue_flag_clear(QUEUE_FLAG_STATS, q); | 165 | blk_queue_flag_clear(QUEUE_FLAG_STATS, q); |
| 163 | spin_unlock(&q->stats->lock); | 166 | spin_unlock_irqrestore(&q->stats->lock, flags); |
| 164 | 167 | ||
| 165 | del_timer_sync(&cb->timer); | 168 | del_timer_sync(&cb->timer); |
| 166 | } | 169 | } |
| @@ -183,10 +186,12 @@ void blk_stat_free_callback(struct blk_stat_callback *cb) · 16 unmodified lines | |||
| 183 | 186 | ||
| 184 | void blk_stat_enable_accounting(struct request_queue *q) | 187 | void blk_stat_enable_accounting(struct request_queue *q) |
| 185 | { | 188 | { |
| 186 | spin_lock(&q->stats->lock); | 189 | unsigned long flags; |
| 190 | |||
| 191 | spin_lock_irqsave(&q->stats->lock, flags); | ||
| 187 | q->stats->enable_accounting = true; | 192 | q->stats->enable_accounting = true; |
| 188 | blk_queue_flag_set(QUEUE_FLAG_STATS, q); | 193 | blk_queue_flag_set(QUEUE_FLAG_STATS, q); |
| 189 | spin_unlock(&q->stats->lock); | 194 | spin_unlock_irqrestore(&q->stats->lock, flags); |
| 190 | } | 195 | } |
| 191 | EXPORT_SYMBOL_GPL(blk_stat_enable_accounting); | 196 | EXPORT_SYMBOL_GPL(blk_stat_enable_accounting); |
| 192 | 197 | ||
| @@ -278,6 +278,15 @@ static void hd_struct_free_work(struct work_struct *work) · 277 unmodified lines | |||
| 278 | { | 278 | { |
| 279 | struct hd_struct *part = | 279 | struct hd_struct *part = |
| 280 | container_of(to_rcu_work(work), struct hd_struct, rcu_work); | 280 | container_of(to_rcu_work(work), struct hd_struct, rcu_work); |
| 281 | struct gendisk *disk = part_to_disk(part); | ||
| 282 | |||
| 283 | /* | ||
| 284 | * Release the disk reference acquired in delete_partition here. | ||
| 285 | * We can't release it in hd_struct_free because the final put_device | ||
| 286 | * needs process context and thus can't be run directly from a | ||
| 287 | * percpu_ref ->release handler. | ||
| 288 | */ | ||
| 289 | put_device(disk_to_dev(disk)); | ||
| 281 | 290 | ||
| 282 | part->start_sect = 0; | 291 | part->start_sect = 0; |
| 283 | part->nr_sects = 0; | 292 | part->nr_sects = 0; |
| @@ -293,7 +302,6 @@ static void hd_struct_free(struct percpu_ref *ref) · 9 unmodified lines | |||
| 293 | rcu_dereference_protected(disk->part_tbl, 1); | 302 | rcu_dereference_protected(disk->part_tbl, 1); |
| 294 | 303 | ||
| 295 | rcu_assign_pointer(ptbl->last_lookup, NULL); | 304 | rcu_assign_pointer(ptbl->last_lookup, NULL); |
| 296 | put_device(disk_to_dev(disk)); | ||
| 297 | 305 | ||
| 298 | INIT_RCU_WORK(&part->rcu_work, hd_struct_free_work); | 306 | INIT_RCU_WORK(&part->rcu_work, hd_struct_free_work); |
| 299 | queue_rcu_work(system_wq, &part->rcu_work); | 307 | queue_rcu_work(system_wq, &part->rcu_work); |
| @@ -524,19 +532,20 @@ int bdev_add_partition(struct block_device *bdev, int partno, · 224 unmodified lines | |||
| 524 | int bdev_del_partition(struct block_device *bdev, int partno) | 532 | int bdev_del_partition(struct block_device *bdev, int partno) |
| 525 | { | 533 | { |
| 526 | struct block_device *bdevp; | 534 | struct block_device *bdevp; |
| 527 | struct hd_struct *part; | 535 | struct hd_struct *part = NULL; |
| 528 | int ret = 0; | 536 | int ret; |
| 529 | 537 | ||
| 530 | part = disk_get_part(bdev->bd_disk, partno); | 538 | bdevp = bdget_disk(bdev->bd_disk, partno); |
| 531 | if (!part) | ||
| 532 | return -ENXIO; | ||
| 533 | |||
| 534 | ret = -ENOMEM; | ||
| 535 | bdevp = bdget(part_devt(part)); | ||
| 536 | if (!bdevp) | 539 | if (!bdevp) |
| 537 | goto out_put_part; | 540 | return -ENXIO; |
| 538 | 541 | ||
| 539 | mutex_lock(&bdevp->bd_mutex); | 542 | mutex_lock(&bdevp->bd_mutex); |
| 543 | mutex_lock_nested(&bdev->bd_mutex, 1); | ||
| 544 | |||
| 545 | ret = -ENXIO; | ||
| 546 | part = disk_get_part(bdev->bd_disk, partno); | ||
| 547 | if (!part) | ||
| 548 | goto out_unlock; | ||
| 540 | 549 | ||
| 541 | ret = -EBUSY; | 550 | ret = -EBUSY; |
| 542 | if (bdevp->bd_openers) | 551 | if (bdevp->bd_openers) |
| @@ -545,16 +554,14 @@ int bdev_del_partition(struct block_device *bdev, int partno) · 2 unmodified lines | |||
| 545 | sync_blockdev(bdevp); | 554 | sync_blockdev(bdevp); |
| 546 | invalidate_bdev(bdevp); | 555 | invalidate_bdev(bdevp); |
| 547 | 556 | ||
| 548 | mutex_lock_nested(&bdev->bd_mutex, 1); | ||
| 549 | delete_partition(bdev->bd_disk, part); | 557 | delete_partition(bdev->bd_disk, part); |
| 550 | mutex_unlock(&bdev->bd_mutex); | ||
| 551 | |||
| 552 | ret = 0; | 558 | ret = 0; |
| 553 | out_unlock: | 559 | out_unlock: |
| 560 | mutex_unlock(&bdev->bd_mutex); | ||
| 554 | mutex_unlock(&bdevp->bd_mutex); | 561 | mutex_unlock(&bdevp->bd_mutex); |
| 555 | bdput(bdevp); | 562 | bdput(bdevp); |
| 556 | out_put_part: | 563 | if (part) |
| 557 | disk_put_part(part); | 564 | disk_put_part(part); |
| 558 | return ret; | 565 | return ret; |
| 559 | } | 566 | } |
| 560 | 567 | ||
| @@ -807,8 +807,7 @@ static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class, · 806 unmodified lines | |||
| 807 | (sstatus & 0xf) != 1) | 807 | (sstatus & 0xf) != 1) |
| 808 | break; | 808 | break; |
| 809 | 809 | ||
| 810 | ata_link_printk(link, KERN_INFO, "avn bounce port%d\n", | 810 | ata_link_info(link, "avn bounce port%d\n", port); |
| 811 | port); | ||
| 812 | 811 | ||
| 813 | pci_read_config_word(pdev, 0x92, &val); | 812 | pci_read_config_word(pdev, 0x92, &val); |
| 814 | val &= ~(1 << port); | 813 | val &= ~(1 << port); |
| @@ -3868,9 +3868,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { · 3867 unmodified lines | |||
| 3868 | /* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */ | 3868 | /* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */ |
| 3869 | { "C300-CTFDDAC128MAG", "0001", ATA_HORKAGE_NONCQ, }, | 3869 | { "C300-CTFDDAC128MAG", "0001", ATA_HORKAGE_NONCQ, }, |
| 3870 | 3870 | ||
| 3871 | /* Some Sandisk SSDs lock up hard with NCQ enabled. Reported on | 3871 | /* Sandisk SD7/8/9s lock up hard on large trims */ |
| 3872 | SD7SN6S256G and SD8SN8U256G */ | 3872 | { "SanDisk SD[789]*", NULL, ATA_HORKAGE_MAX_TRIM_128M, }, |
| 3873 | { "SanDisk SD[78]SN*G", NULL, ATA_HORKAGE_NONCQ, }, | ||
| 3874 | 3873 | ||
| 3875 | /* devices which puke on READ_NATIVE_MAX */ | 3874 | /* devices which puke on READ_NATIVE_MAX */ |
| 3876 | { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, | 3875 | { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, }, |
| @@ -2080,6 +2080,7 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf) · 2079 unmodified lines | |||
| 2080 | 2080 | ||
| 2081 | static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf) | 2081 | static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf) |
| 2082 | { | 2082 | { |
| 2083 | struct ata_device *dev = args->dev; | ||
| 2083 | u16 min_io_sectors; | 2084 | u16 min_io_sectors; |
| 2084 | 2085 | ||
| 2085 | rbuf[1] = 0xb0; | 2086 | rbuf[1] = 0xb0; |
| @@ -2105,7 +2106,12 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf) · 19 unmodified lines | |||
| 2105 | * with the unmap bit set. | 2106 | * with the unmap bit set. |
| 2106 | */ | 2107 | */ |
| 2107 | if (ata_id_has_trim(args->id)) { | 2108 | if (ata_id_has_trim(args->id)) { |
| 2108 | put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM, &rbuf[36]); | 2109 | u64 max_blocks = 65535 * ATA_MAX_TRIM_RNUM; |
| 2110 | |||
| 2111 | if (dev->horkage & ATA_HORKAGE_MAX_TRIM_128M) | ||
| 2112 | max_blocks = 128 << (20 - SECTOR_SHIFT); | ||
| 2113 | |||
| 2114 | put_unaligned_be64(max_blocks, &rbuf[36]); | ||
| 2109 | put_unaligned_be32(1, &rbuf[28]); | 2115 | put_unaligned_be32(1, &rbuf[28]); |
| 2110 | } | 2116 | } |
| 2111 | 2117 | ||
| @@ -998,6 +998,7 @@ static int fs_open(struct atm_vcc *atm_vcc) · 997 unmodified lines | |||
| 998 | error = make_rate (pcr, r, &tmc0, NULL); | 998 | error = make_rate (pcr, r, &tmc0, NULL); |
| 999 | if (error) { | 999 | if (error) { |
| 1000 | kfree(tc); | 1000 | kfree(tc); |
| 1001 | kfree(vcc); | ||
| 1001 | return error; | 1002 | return error; |
| 1002 | } | 1003 | } |
| 1003 | } | 1004 | } |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | /* | 2 | /* |
| 3 | * Driver for the on-board character LCD found on some ARM reference boards | 3 | * Driver for the on-board character LCD found on some ARM reference boards |
| 4 | * This is basically an Hitachi HD44780 LCD with a custom IP block to drive it | 4 | * This is basically an Hitachi HD44780 LCD with a custom IP block to drive it |
| 5 | * http://en.wikipedia.org/wiki/HD44780_Character_LCD | 5 | * https://en.wikipedia.org/wiki/HD44780_Character_LCD |
| 6 | * Currently it will just display the text "ARM Linux" and the linux version | 6 | * Currently it will just display the text "ARM Linux" and the linux version |
| 7 | * | 7 | * |
| 8 | * Author: Linus Walleij <triad@df.lth.se> | 8 | * Author: Linus Walleij <triad@df.lth.se> |
| @@ -807,9 +807,7 @@ static void device_link_put_kref(struct device_link *link) · 806 unmodified lines | |||
| 807 | void device_link_del(struct device_link *link) | 807 | void device_link_del(struct device_link *link) |
| 808 | { | 808 | { |
| 809 | device_links_write_lock(); | 809 | device_links_write_lock(); |
| 810 | device_pm_lock(); | ||
| 811 | device_link_put_kref(link); | 810 | device_link_put_kref(link); |
| 812 | device_pm_unlock(); | ||
| 813 | device_links_write_unlock(); | 811 | device_links_write_unlock(); |
| 814 | } | 812 | } |
| 815 | EXPORT_SYMBOL_GPL(device_link_del); | 813 | EXPORT_SYMBOL_GPL(device_link_del); |
| @@ -830,7 +828,6 @@ void device_link_remove(void *consumer, struct device *supplier) · 14 unmodified lines | |||
| 830 | return; | 828 | return; |
| 831 | 829 | ||
| 832 | device_links_write_lock(); | 830 | device_links_write_lock(); |
| 833 | device_pm_lock(); | ||
| 834 | 831 | ||
| 835 | list_for_each_entry(link, &supplier->links.consumers, s_node) { | 832 | list_for_each_entry(link, &supplier->links.consumers, s_node) { |
| 836 | if (link->consumer == consumer) { | 833 | if (link->consumer == consumer) { |
| @@ -839,7 +836,6 @@ void device_link_remove(void *consumer, struct device *supplier) · 2 unmodified lines | |||
| 839 | } | 836 | } |
| 840 | } | 837 | } |
| 841 | 838 | ||
| 842 | device_pm_unlock(); | ||
| 843 | device_links_write_unlock(); | 839 | device_links_write_unlock(); |
| 844 | } | 840 | } |
| 845 | EXPORT_SYMBOL_GPL(device_link_remove); | 841 | EXPORT_SYMBOL_GPL(device_link_remove); |
| @@ -4237,10 +4233,10 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...) · 3391 unmodified lines | |||
| 4237 | vaf.va = &args; | 4233 | vaf.va = &args; |
| 4238 | 4234 | ||
| 4239 | if (err != -EPROBE_DEFER) { | 4235 | if (err != -EPROBE_DEFER) { |
| 4240 | dev_err(dev, "error %d: %pV", err, &vaf); | 4236 | dev_err(dev, "error %pe: %pV", ERR_PTR(err), &vaf); |
| 4241 | } else { | 4237 | } else { |
| 4242 | device_set_deferred_probe_reason(dev, &vaf); | 4238 | device_set_deferred_probe_reason(dev, &vaf); |
| 4243 | dev_dbg(dev, "error %d: %pV", err, &vaf); | 4239 | dev_dbg(dev, "error %pe: %pV", ERR_PTR(err), &vaf); |
| 4244 | } | 4240 | } |
| 4245 | 4241 | ||
| 4246 | va_end(args); | 4242 | va_end(args); |
| @@ -142,10 +142,12 @@ int assign_fw(struct firmware *fw, struct device *device, u32 opt_flags); · 141 unmodified lines | |||
| 142 | void fw_free_paged_buf(struct fw_priv *fw_priv); | 142 | void fw_free_paged_buf(struct fw_priv *fw_priv); |
| 143 | int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed); | 143 | int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed); |
| 144 | int fw_map_paged_buf(struct fw_priv *fw_priv); | 144 | int fw_map_paged_buf(struct fw_priv *fw_priv); |
| 145 | bool fw_is_paged_buf(struct fw_priv *fw_priv); | ||
| 145 | #else | 146 | #else |
| 146 | static inline void fw_free_paged_buf(struct fw_priv *fw_priv) {} | 147 | static inline void fw_free_paged_buf(struct fw_priv *fw_priv) {} |
| 147 | static inline int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed) { return -ENXIO; } | 148 | static inline int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed) { return -ENXIO; } |
| 148 | static inline int fw_map_paged_buf(struct fw_priv *fw_priv) { return -ENXIO; } | 149 | static inline int fw_map_paged_buf(struct fw_priv *fw_priv) { return -ENXIO; } |
| 150 | static inline bool fw_is_paged_buf(struct fw_priv *fw_priv) { return false; } | ||
| 149 | #endif | 151 | #endif |
| 150 | 152 | ||
| 151 | #endif /* __FIRMWARE_LOADER_H */ | 153 | #endif /* __FIRMWARE_LOADER_H */ |
| @@ -252,9 +252,11 @@ static void __free_fw_priv(struct kref *ref) · 251 unmodified lines | |||
| 252 | list_del(&fw_priv->list); | 252 | list_del(&fw_priv->list); |
| 253 | spin_unlock(&fwc->lock); | 253 | spin_unlock(&fwc->lock); |
| 254 | 254 | ||
| 255 | fw_free_paged_buf(fw_priv); /* free leftover pages */ | 255 | if (fw_is_paged_buf(fw_priv)) |
| 256 | if (!fw_priv->allocated_size) | 256 | fw_free_paged_buf(fw_priv); |
| 257 | else if (!fw_priv->allocated_size) | ||
| 257 | vfree(fw_priv->data); | 258 | vfree(fw_priv->data); |
| 259 | |||
| 258 | kfree_const(fw_priv->fw_name); | 260 | kfree_const(fw_priv->fw_name); |
| 259 | kfree(fw_priv); | 261 | kfree(fw_priv); |
| 260 | } | 262 | } |
| @@ -268,6 +270,11 @@ static void free_fw_priv(struct fw_priv *fw_priv) · 7 unmodified lines | |||
| 268 | } | 270 | } |
| 269 | 271 | ||
| 270 | #ifdef CONFIG_FW_LOADER_PAGED_BUF | 272 | #ifdef CONFIG_FW_LOADER_PAGED_BUF |
| 273 | bool fw_is_paged_buf(struct fw_priv *fw_priv) | ||
| 274 | { | ||
| 275 | return fw_priv->is_paged_buf; | ||
| 276 | } | ||
| 277 | |||
| 271 | void fw_free_paged_buf(struct fw_priv *fw_priv) | 278 | void fw_free_paged_buf(struct fw_priv *fw_priv) |
| 272 | { | 279 | { |
| 273 | int i; | 280 | int i; |
| @@ -275,6 +282,8 @@ void fw_free_paged_buf(struct fw_priv *fw_priv) · 1 unmodified line | |||
| 275 | if (!fw_priv->pages) | 282 | if (!fw_priv->pages) |
| 276 | return; | 283 | return; |
| 277 | 284 | ||
| 285 | vunmap(fw_priv->data); | ||
| 286 | |||
| 278 | for (i = 0; i < fw_priv->nr_pages; i++) | 287 | for (i = 0; i < fw_priv->nr_pages; i++) |
| 279 | __free_page(fw_priv->pages[i]); | 288 | __free_page(fw_priv->pages[i]); |
| 280 | kvfree(fw_priv->pages); | 289 | kvfree(fw_priv->pages); |
| @@ -328,10 +337,6 @@ int fw_map_paged_buf(struct fw_priv *fw_priv) · 47 unmodified lines | |||
| 328 | if (!fw_priv->data) | 337 | if (!fw_priv->data) |
| 329 | return -ENOMEM; | 338 | return -ENOMEM; |
| 330 | 339 | ||
| 331 | /* page table is no longer needed after mapping, let's free */ | ||
| 332 | kvfree(fw_priv->pages); | ||
| 333 | fw_priv->pages = NULL; | ||
| 334 | |||
| 335 | return 0; | 340 | return 0; |
| 336 | } | 341 | } |
| 337 | #endif | 342 | #endif |
| @@ -5120,6 +5120,9 @@ static ssize_t rbd_config_info_show(struct device *dev, · 5119 unmodified lines | |||
| 5120 | { | 5120 | { |
| 5121 | struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); | 5121 | struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); |
| 5122 | 5122 | ||
| 5123 | if (!capable(CAP_SYS_ADMIN)) | ||
| 5124 | return -EPERM; | ||
| 5125 | |||
| 5123 | return sprintf(buf, "%s\n", rbd_dev->config_info); | 5126 | return sprintf(buf, "%s\n", rbd_dev->config_info); |
| 5124 | } | 5127 | } |
| 5125 | 5128 | ||
| @@ -5231,6 +5234,9 @@ static ssize_t rbd_image_refresh(struct device *dev, · 105 unmodified lines | |||
| 5231 | struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); | 5234 | struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); |
| 5232 | int ret; | 5235 | int ret; |
| 5233 | 5236 | ||
| 5237 | if (!capable(CAP_SYS_ADMIN)) | ||
| 5238 | return -EPERM; | ||
| 5239 | |||
| 5234 | ret = rbd_dev_refresh(rbd_dev); | 5240 | ret = rbd_dev_refresh(rbd_dev); |
| 5235 | if (ret) | 5241 | if (ret) |
| 5236 | return ret; | 5242 | return ret; |
| @@ -7059,6 +7065,9 @@ static ssize_t do_rbd_add(struct bus_type *bus, · 1822 unmodified lines | |||
| 7059 | struct rbd_client *rbdc; | 7065 | struct rbd_client *rbdc; |
| 7060 | int rc; | 7066 | int rc; |
| 7061 | 7067 | ||
| 7068 | if (!capable(CAP_SYS_ADMIN)) | ||
| 7069 | return -EPERM; | ||
| 7070 | |||
| 7062 | if (!try_module_get(THIS_MODULE)) | 7071 | if (!try_module_get(THIS_MODULE)) |
| 7063 | return -ENODEV; | 7072 | return -ENODEV; |
| 7064 | 7073 | ||
| @@ -7209,6 +7218,9 @@ static ssize_t do_rbd_remove(struct bus_type *bus, · 144 unmodified lines | |||
| 7209 | bool force = false; | 7218 | bool force = false; |
| 7210 | int ret; | 7219 | int ret; |
| 7211 | 7220 | ||
| 7221 | if (!capable(CAP_SYS_ADMIN)) | ||
| 7222 | return -EPERM; | ||
| 7223 | |||
| 7212 | dev_id = -1; | 7224 | dev_id = -1; |
| 7213 | opt_buf[0] = '\0'; | 7225 | opt_buf[0] = '\0'; |
| 7214 | sscanf(buf, "%d %5s", &dev_id, opt_buf); | 7226 | sscanf(buf, "%d %5s", &dev_id, opt_buf); |
| @@ -320,8 +320,8 @@ static int mchp_tc_probe(struct platform_device *pdev) · 319 unmodified lines | |||
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | regmap = syscon_node_to_regmap(np->parent); | 322 | regmap = syscon_node_to_regmap(np->parent); |
| 323 | if (IS_ERR(priv->regmap)) | 323 | if (IS_ERR(regmap)) |
| 324 | return PTR_ERR(priv->regmap); | 324 | return PTR_ERR(regmap); |
| 325 | 325 | ||
| 326 | /* max. channels number is 2 when in QDEC mode */ | 326 | /* max. channels number is 2 when in QDEC mode */ |
| 327 | priv->num_channels = of_property_count_u32_elems(np, "reg"); | 327 | priv->num_channels = of_property_count_u32_elems(np, "reg"); |
| @@ -219,14 +219,13 @@ struct global_params { · 218 unmodified lines | |||
| 219 | * @epp_policy: Last saved policy used to set EPP/EPB | 219 | * @epp_policy: Last saved policy used to set EPP/EPB |
| 220 | * @epp_default: Power on default HWP energy performance | 220 | * @epp_default: Power on default HWP energy performance |
| 221 | * preference/bias | 221 | * preference/bias |
| 222 | * @epp_saved: Saved EPP/EPB during system suspend or CPU offline | ||
| 223 | * operation | ||
| 224 | * @epp_cached Cached HWP energy-performance preference value | 222 | * @epp_cached Cached HWP energy-performance preference value |
| 225 | * @hwp_req_cached: Cached value of the last HWP Request MSR | 223 | * @hwp_req_cached: Cached value of the last HWP Request MSR |
| 226 | * @hwp_cap_cached: Cached value of the last HWP Capabilities MSR | 224 | * @hwp_cap_cached: Cached value of the last HWP Capabilities MSR |
| 227 | * @last_io_update: Last time when IO wake flag was set | 225 | * @last_io_update: Last time when IO wake flag was set |
| 228 | * @sched_flags: Store scheduler flags for possible cross CPU update | 226 | * @sched_flags: Store scheduler flags for possible cross CPU update |
| 229 | * @hwp_boost_min: Last HWP boosted min performance | 227 | * @hwp_boost_min: Last HWP boosted min performance |
| 228 | * @suspended: Whether or not the driver has been suspended. | ||
| 230 | * | 229 | * |
| 231 | * This structure stores per CPU instance data for all CPUs. | 230 | * This structure stores per CPU instance data for all CPUs. |
| 232 | */ | 231 | */ |
| @@ -258,13 +257,13 @@ struct cpudata { · 25 unmodified lines | |||
| 258 | s16 epp_powersave; | 257 | s16 epp_powersave; |
| 259 | s16 epp_policy; | 258 | s16 epp_policy; |
| 260 | s16 epp_default; | 259 | s16 epp_default; |
| 261 | s16 epp_saved; | ||
| 262 | s16 epp_cached; | 260 | s16 epp_cached; |
| 263 | u64 hwp_req_cached; | 261 | u64 hwp_req_cached; |
| 264 | u64 hwp_cap_cached; | 262 | u64 hwp_cap_cached; |
| 265 | u64 last_io_update; | 263 | u64 last_io_update; |
| 266 | unsigned int sched_flags; | 264 | unsigned int sched_flags; |
| 267 | u32 hwp_boost_min; | 265 | u32 hwp_boost_min; |
| 266 | bool suspended; | ||
| 268 | }; | 267 | }; |
| 269 | 268 | ||
| 270 | static struct cpudata **all_cpu_data; | 269 | static struct cpudata **all_cpu_data; |
| @@ -644,6 +643,8 @@ static int intel_pstate_get_energy_pref_index(struct cpudata *cpu_data, int *raw · 373 unmodified lines | |||
| 644 | 643 | ||
| 645 | static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp) | 644 | static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp) |
| 646 | { | 645 | { |
| 646 | int ret; | ||
| 647 | |||
| 647 | /* | 648 | /* |
| 648 | * Use the cached HWP Request MSR value, because in the active mode the | 649 | * Use the cached HWP Request MSR value, because in the active mode the |
| 649 | * register itself may be updated by intel_pstate_hwp_boost_up() or | 650 | * register itself may be updated by intel_pstate_hwp_boost_up() or |
| @@ -659,7 +660,11 @@ static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp) · 9 unmodified lines | |||
| 659 | * function, so it cannot run in parallel with the update below. | 660 | * function, so it cannot run in parallel with the update below. |
| 660 | */ | 661 | */ |
| 661 | WRITE_ONCE(cpu->hwp_req_cached, value); | 662 | WRITE_ONCE(cpu->hwp_req_cached, value); |
| 662 | return wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); | 663 | ret = wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); |
| 664 | if (!ret) | ||
| 665 | cpu->epp_cached = epp; | ||
| 666 | |||
| 667 | return ret; | ||
| 663 | } | 668 | } |
| 664 | 669 | ||
| 665 | static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data, | 670 | static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data, |
| @@ -678,6 +683,14 @@ static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data, · 12 unmodified lines | |||
| 678 | else if (epp == -EINVAL) | 683 | else if (epp == -EINVAL) |
| 679 | epp = epp_values[pref_index - 1]; | 684 | epp = epp_values[pref_index - 1]; |
| 680 | 685 | ||
| 686 | /* | ||
| 687 | * To avoid confusion, refuse to set EPP to any values different | ||
| 688 | * from 0 (performance) if the current policy is "performance", | ||
| 689 | * because those values would be overridden. | ||
| 690 | */ | ||
| 691 | if (epp > 0 && cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) | ||
| 692 | return -EBUSY; | ||
| 693 | |||
| 681 | ret = intel_pstate_set_epp(cpu_data, epp); | 694 | ret = intel_pstate_set_epp(cpu_data, epp); |
| 682 | } else { | 695 | } else { |
| 683 | if (epp == -EINVAL) | 696 | if (epp == -EINVAL) |
| @@ -762,10 +775,8 @@ static ssize_t store_energy_performance_preference( · 78 unmodified lines | |||
| 762 | cpufreq_stop_governor(policy); | 775 | cpufreq_stop_governor(policy); |
| 763 | ret = intel_pstate_set_epp(cpu, epp); | 776 | ret = intel_pstate_set_epp(cpu, epp); |
| 764 | err = cpufreq_start_governor(policy); | 777 | err = cpufreq_start_governor(policy); |
| 765 | if (!ret) { | 778 | if (!ret) |
| 766 | cpu->epp_cached = epp; | ||
| 767 | ret = err; | 779 | ret = err; |
| 768 | } | ||
| 769 | } | 780 | } |
| 770 | } | 781 | } |
| 771 | 782 | ||
| @@ -825,7 +836,7 @@ static void intel_pstate_get_hwp_max(unsigned int cpu, int *phy_max, · 53 unmodified lines | |||
| 825 | 836 | ||
| 826 | rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap); | 837 | rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap); |
| 827 | WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap); | 838 | WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap); |
| 828 | if (global.no_turbo) | 839 | if (global.no_turbo || global.turbo_disabled) |
| 829 | *current_max = HWP_GUARANTEED_PERF(cap); | 840 | *current_max = HWP_GUARANTEED_PERF(cap); |
| 830 | else | 841 | else |
| 831 | *current_max = HWP_HIGHEST_PERF(cap); | 842 | *current_max = HWP_HIGHEST_PERF(cap); |
| @@ -859,12 +870,6 @@ static void intel_pstate_hwp_set(unsigned int cpu) · 27 unmodified lines | |||
| 859 | 870 | ||
| 860 | cpu_data->epp_policy = cpu_data->policy; | 871 | cpu_data->epp_policy = cpu_data->policy; |
| 861 | 872 | ||
| 862 | if (cpu_data->epp_saved >= 0) { | ||
| 863 | epp = cpu_data->epp_saved; | ||
| 864 | cpu_data->epp_saved = -EINVAL; | ||
| 865 | goto update_epp; | ||
| 866 | } | ||
| 867 | |||
| 868 | if (cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) { | 873 | if (cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) { |
| 869 | epp = intel_pstate_get_epp(cpu_data, value); | 874 | epp = intel_pstate_get_epp(cpu_data, value); |
| 870 | cpu_data->epp_powersave = epp; | 875 | cpu_data->epp_powersave = epp; |
| @@ -891,7 +896,6 @@ static void intel_pstate_hwp_set(unsigned int cpu) · 20 unmodified lines | |||
| 891 | 896 | ||
| 892 | epp = cpu_data->epp_powersave; | 897 | epp = cpu_data->epp_powersave; |
| 893 | } | 898 | } |
| 894 | update_epp: | ||
| 895 | if (boot_cpu_has(X86_FEATURE_HWP_EPP)) { | 899 | if (boot_cpu_has(X86_FEATURE_HWP_EPP)) { |
| 896 | value &= ~GENMASK_ULL(31, 24); | 900 | value &= ~GENMASK_ULL(31, 24); |
| 897 | value |= (u64)epp << 24; | 901 | value |= (u64)epp << 24; |
| @@ -903,14 +907,24 @@ skip_epp: · 5 unmodified lines | |||
| 903 | wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); | 907 | wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); |
| 904 | } | 908 | } |
| 905 | 909 | ||
| 906 | static void intel_pstate_hwp_force_min_perf(int cpu) | 910 | static void intel_pstate_hwp_offline(struct cpudata *cpu) |
| 907 | { | 911 | { |
| 908 | u64 value; | 912 | u64 value = READ_ONCE(cpu->hwp_req_cached); |
| 909 | int min_perf; | 913 | int min_perf; |
| 910 | 914 | ||
| 911 | value = all_cpu_data[cpu]->hwp_req_cached; | 915 | if (boot_cpu_has(X86_FEATURE_HWP_EPP)) { |
| 916 | /* | ||
| 917 | * In case the EPP has been set to "performance" by the | ||
| 918 | * active mode "performance" scaling algorithm, replace that | ||
| 919 | * temporary value with the cached EPP one. | ||
| 920 | */ | ||
| 921 | value &= ~GENMASK_ULL(31, 24); | ||
| 922 | value |= HWP_ENERGY_PERF_PREFERENCE(cpu->epp_cached); | ||
| 923 | WRITE_ONCE(cpu->hwp_req_cached, value); | ||
| 924 | } | ||
| 925 | |||
| 912 | value &= ~GENMASK_ULL(31, 0); | 926 | value &= ~GENMASK_ULL(31, 0); |
| 913 | min_perf = HWP_LOWEST_PERF(all_cpu_data[cpu]->hwp_cap_cached); | 927 | min_perf = HWP_LOWEST_PERF(cpu->hwp_cap_cached); |
| 914 | 928 | ||
| 915 | /* Set hwp_max = hwp_min */ | 929 | /* Set hwp_max = hwp_min */ |
| 916 | value |= HWP_MAX_PERF(min_perf); | 930 | value |= HWP_MAX_PERF(min_perf); |
| @@ -920,19 +934,7 @@ static void intel_pstate_hwp_force_min_perf(int cpu) · 3 unmodified lines | |||
| 920 | if (boot_cpu_has(X86_FEATURE_HWP_EPP)) | 934 | if (boot_cpu_has(X86_FEATURE_HWP_EPP)) |
| 921 | value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE); | 935 | value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE); |
| 922 | 936 | ||
| 923 | wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); | 937 | wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); |
| 924 | } | ||
| 925 | |||
| 926 | static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy) | ||
| 927 | { | ||
| 928 | struct cpudata *cpu_data = all_cpu_data[policy->cpu]; | ||
| 929 | |||
| 930 | if (!hwp_active) | ||
| 931 | return 0; | ||
| 932 | |||
| 933 | cpu_data->epp_saved = intel_pstate_get_epp(cpu_data, 0); | ||
| 934 | |||
| 935 | return 0; | ||
| 936 | } | 938 | } |
| 937 | 939 | ||
| 938 | #define POWER_CTL_EE_ENABLE 1 | 940 | #define POWER_CTL_EE_ENABLE 1 |
| @@ -959,8 +961,28 @@ static void set_power_ctl_ee_state(bool input) · 20 unmodified lines | |||
| 959 | 961 | ||
| 960 | static void intel_pstate_hwp_enable(struct cpudata *cpudata); | 962 | static void intel_pstate_hwp_enable(struct cpudata *cpudata); |
| 961 | 963 | ||
| 964 | static void intel_pstate_hwp_reenable(struct cpudata *cpu) | ||
| 965 | { | ||
| 966 | intel_pstate_hwp_enable(cpu); | ||
| 967 | wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, READ_ONCE(cpu->hwp_req_cached)); | ||
| 968 | } | ||
| 969 | |||
| 970 | static int intel_pstate_suspend(struct cpufreq_policy *policy) | ||
| 971 | { | ||
| 972 | struct cpudata *cpu = all_cpu_data[policy->cpu]; | ||
| 973 | |||
| 974 | pr_debug("CPU %d suspending\n", cpu->cpu); | ||
| 975 | |||
| 976 | cpu->suspended = true; | ||
| 977 | |||
| 978 | return 0; | ||
| 979 | } | ||
| 980 | |||
| 962 | static int intel_pstate_resume(struct cpufreq_policy *policy) | 981 | static int intel_pstate_resume(struct cpufreq_policy *policy) |
| 963 | { | 982 | { |
| 983 | struct cpudata *cpu = all_cpu_data[policy->cpu]; | ||
| 984 | |||
| 985 | pr_debug("CPU %d resuming\n", cpu->cpu); | ||
| 964 | 986 | ||
| 965 | /* Only restore if the system default is changed */ | 987 | /* Only restore if the system default is changed */ |
| 966 | if (power_ctl_ee_state == POWER_CTL_EE_ENABLE) | 988 | if (power_ctl_ee_state == POWER_CTL_EE_ENABLE) |
| @@ -968,18 +990,16 @@ static int intel_pstate_resume(struct cpufreq_policy *policy) · 1 unmodified line | |||
| 968 | else if (power_ctl_ee_state == POWER_CTL_EE_DISABLE) | 990 | else if (power_ctl_ee_state == POWER_CTL_EE_DISABLE) |
| 969 | set_power_ctl_ee_state(false); | 991 | set_power_ctl_ee_state(false); |
| 970 | 992 | ||
| 971 | if (!hwp_active) | 993 | if (cpu->suspended && hwp_active) { |
| 972 | return 0; | 994 | mutex_lock(&intel_pstate_limits_lock); |
| 973 | 995 | ||
| 974 | mutex_lock(&intel_pstate_limits_lock); | 996 | /* Re-enable HWP, because "online" has not done that. */ |
| 997 | intel_pstate_hwp_reenable(cpu); | ||
| 975 | 998 | ||
| 976 | if (policy->cpu == 0) | 999 | mutex_unlock(&intel_pstate_limits_lock); |
| 977 | intel_pstate_hwp_enable(all_cpu_data[policy->cpu]); | 1000 | } |
| 978 | 1001 | ||
| 979 | all_cpu_data[policy->cpu]->epp_policy = 0; | 1002 | cpu->suspended = false; |
| 980 | intel_pstate_hwp_set(policy->cpu); | ||
| 981 | |||
| 982 | mutex_unlock(&intel_pstate_limits_lock); | ||
| 983 | 1003 | ||
| 984 | return 0; | 1004 | return 0; |
| 985 | } | 1005 | } |
| @@ -1428,7 +1448,6 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata) · 442 unmodified lines | |||
| 1428 | wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); | 1448 | wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); |
| 1429 | 1449 | ||
| 1430 | wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1); | 1450 | wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1); |
| 1431 | cpudata->epp_policy = 0; | ||
| 1432 | if (cpudata->epp_default == -EINVAL) | 1451 | if (cpudata->epp_default == -EINVAL) |
| 1433 | cpudata->epp_default = intel_pstate_get_epp(cpudata, 0); | 1452 | cpudata->epp_default = intel_pstate_get_epp(cpudata, 0); |
| 1434 | } | 1453 | } |
| @@ -2097,25 +2116,31 @@ static int intel_pstate_init_cpu(unsigned int cpunum) · 662 unmodified lines | |||
| 2097 | 2116 | ||
| 2098 | all_cpu_data[cpunum] = cpu; | 2117 | all_cpu_data[cpunum] = cpu; |
| 2099 | 2118 | ||
| 2100 | cpu->epp_default = -EINVAL; | 2119 | cpu->cpu = cpunum; |
| 2101 | cpu->epp_powersave = -EINVAL; | ||
| 2102 | cpu->epp_saved = -EINVAL; | ||
| 2103 | } | ||
| 2104 | |||
| 2105 | cpu = all_cpu_data[cpunum]; | ||
| 2106 | 2120 | ||
| 2107 | cpu->cpu = cpunum; | 2121 | cpu->epp_default = -EINVAL; |
| 2108 | 2122 | ||
| 2109 | if (hwp_active) { | 2123 | if (hwp_active) { |
| 2110 | const struct x86_cpu_id *id; | 2124 | const struct x86_cpu_id *id; |
| 2111 | 2125 | ||
| 2112 | intel_pstate_hwp_enable(cpu); | 2126 | intel_pstate_hwp_enable(cpu); |
| 2113 | 2127 | ||
| 2114 | id = x86_match_cpu(intel_pstate_hwp_boost_ids); | 2128 | id = x86_match_cpu(intel_pstate_hwp_boost_ids); |
| 2115 | if (id && intel_pstate_acpi_pm_profile_server()) | 2129 | if (id && intel_pstate_acpi_pm_profile_server()) |
| 2116 | hwp_boost = true; | 2130 | hwp_boost = true; |
| 2131 | } | ||
| 2132 | } else if (hwp_active) { | ||
| 2133 | /* | ||
| 2134 | * Re-enable HWP in case this happens after a resume from ACPI | ||
| 2135 | * S3 if the CPU was offline during the whole system/resume | ||
| 2136 | * cycle. | ||
| 2137 | */ | ||
| 2138 | intel_pstate_hwp_reenable(cpu); | ||
| 2117 | } | 2139 | } |
| 2118 | 2140 | ||
| 2141 | cpu->epp_powersave = -EINVAL; | ||
| 2142 | cpu->epp_policy = 0; | ||
| 2143 | |||
| 2119 | intel_pstate_get_cpu_pstates(cpu); | 2144 | intel_pstate_get_cpu_pstates(cpu); |
| 2120 | 2145 | ||
| 2121 | pr_debug("controlling: cpu %d\n", cpunum); | 2146 | pr_debug("controlling: cpu %d\n", cpunum); |
| @@ -2296,28 +2321,61 @@ static int intel_pstate_verify_policy(struct cpufreq_policy_data *policy) · 174 unmodified lines | |||
| 2296 | return 0; | 2321 | return 0; |
| 2297 | } | 2322 | } |
| 2298 | 2323 | ||
| 2299 | static void intel_cpufreq_stop_cpu(struct cpufreq_policy *policy) | 2324 | static int intel_pstate_cpu_offline(struct cpufreq_policy *policy) |
| 2300 | { | 2325 | { |
| 2326 | struct cpudata *cpu = all_cpu_data[policy->cpu]; | ||
| 2327 | |||
| 2328 | pr_debug("CPU %d going offline\n", cpu->cpu); | ||
| 2329 | |||
| 2330 | if (cpu->suspended) | ||
| 2331 | return 0; | ||
| 2332 | |||
| 2333 | /* | ||
| 2334 | * If the CPU is an SMT thread and it goes offline with the performance | ||
| 2335 | * settings different from the minimum, it will prevent its sibling | ||
| 2336 | * from getting to lower performance levels, so force the minimum | ||
| 2337 | * performance on CPU offline to prevent that from happening. | ||
| 2338 | */ | ||
| 2301 | if (hwp_active) | 2339 | if (hwp_active) |
| 2302 | intel_pstate_hwp_force_min_perf(policy->cpu); | 2340 | intel_pstate_hwp_offline(cpu); |
| 2303 | else | 2341 | else |
| 2304 | intel_pstate_set_min_pstate(all_cpu_data[policy->cpu]); | 2342 | intel_pstate_set_min_pstate(cpu); |
| 2343 | |||
| 2344 | intel_pstate_exit_perf_limits(policy); | ||
| 2345 | |||
| 2346 | return 0; | ||
| 2347 | } | ||
| 2348 | |||
| 2349 | static int intel_pstate_cpu_online(struct cpufreq_policy *policy) | ||
| 2350 | { | ||
| 2351 | struct cpudata *cpu = all_cpu_data[policy->cpu]; | ||
| 2352 | |||
| 2353 | pr_debug("CPU %d going online\n", cpu->cpu); | ||
| 2354 | |||
| 2355 | intel_pstate_init_acpi_perf_limits(policy); | ||
| 2356 | |||
| 2357 | if (hwp_active) { | ||
| 2358 | /* | ||
| 2359 | * Re-enable HWP and clear the "suspended" flag to let "resume" | ||
| 2360 | * know that it need not do that. | ||
| 2361 | */ | ||
| 2362 | intel_pstate_hwp_reenable(cpu); | ||
| 2363 | cpu->suspended = false; | ||
| 2364 | } | ||
| 2365 | |||
| 2366 | return 0; | ||
| 2305 | } | 2367 | } |
| 2306 | 2368 | ||
| 2307 | static void intel_pstate_stop_cpu(struct cpufreq_policy *policy) | 2369 | static void intel_pstate_stop_cpu(struct cpufreq_policy *policy) |
| 2308 | { | 2370 | { |
| 2309 | pr_debug("CPU %d exiting\n", policy->cpu); | 2371 | pr_debug("CPU %d stopping\n", policy->cpu); |
| 2310 | 2372 | ||
| 2311 | intel_pstate_clear_update_util_hook(policy->cpu); | 2373 | intel_pstate_clear_update_util_hook(policy->cpu); |
| 2312 | if (hwp_active) | ||
| 2313 | intel_pstate_hwp_save_state(policy); | ||
| 2314 | |||
| 2315 | intel_cpufreq_stop_cpu(policy); | ||
| 2316 | } | 2374 | } |
| 2317 | 2375 | ||
| 2318 | static int intel_pstate_cpu_exit(struct cpufreq_policy *policy) | 2376 | static int intel_pstate_cpu_exit(struct cpufreq_policy *policy) |
| 2319 | { | 2377 | { |
| 2320 | intel_pstate_exit_perf_limits(policy); | 2378 | pr_debug("CPU %d exiting\n", policy->cpu); |
| 2321 | 2379 | ||
| 2322 | policy->fast_switch_possible = false; | 2380 | policy->fast_switch_possible = false; |
| 2323 | 2381 | ||
| @@ -2378,6 +2436,12 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) · 54 unmodified lines | |||
| 2378 | */ | 2436 | */ |
| 2379 | policy->policy = CPUFREQ_POLICY_POWERSAVE; | 2437 | policy->policy = CPUFREQ_POLICY_POWERSAVE; |
| 2380 | 2438 | ||
| 2439 | if (hwp_active) { | ||
| 2440 | struct cpudata *cpu = all_cpu_data[policy->cpu]; | ||
| 2441 | |||
| 2442 | cpu->epp_cached = intel_pstate_get_epp(cpu, 0); | ||
| 2443 | } | ||
| 2444 | |||
| 2381 | return 0; | 2445 | return 0; |
| 2382 | } | 2446 | } |
| 2383 | 2447 | ||
| @@ -2385,11 +2449,13 @@ static struct cpufreq_driver intel_pstate = { · 1 unmodified line | |||
| 2385 | .flags = CPUFREQ_CONST_LOOPS, | 2449 | .flags = CPUFREQ_CONST_LOOPS, |
| 2386 | .verify = intel_pstate_verify_policy, | 2450 | .verify = intel_pstate_verify_policy, |
| 2387 | .setpolicy = intel_pstate_set_policy, | 2451 | .setpolicy = intel_pstate_set_policy, |
| 2388 | .suspend = intel_pstate_hwp_save_state, | 2452 | .suspend = intel_pstate_suspend, |
| 2389 | .resume = intel_pstate_resume, | 2453 | .resume = intel_pstate_resume, |
| 2390 | .init = intel_pstate_cpu_init, | 2454 | .init = intel_pstate_cpu_init, |
| 2391 | .exit = intel_pstate_cpu_exit, | 2455 | .exit = intel_pstate_cpu_exit, |
| 2392 | .stop_cpu = intel_pstate_stop_cpu, | 2456 | .stop_cpu = intel_pstate_stop_cpu, |
| 2457 | .offline = intel_pstate_cpu_offline, | ||
| 2458 | .online = intel_pstate_cpu_online, | ||
| 2393 | .update_limits = intel_pstate_update_limits, | 2459 | .update_limits = intel_pstate_update_limits, |
| 2394 | .name = "intel_pstate", | 2460 | .name = "intel_pstate", |
| 2395 | }; | 2461 | }; |
| @@ -2585,7 +2651,7 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy) · 189 unmodified lines | |||
| 2585 | policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY_HWP; | 2651 | policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY_HWP; |
| 2586 | rdmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value); | 2652 | rdmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value); |
| 2587 | WRITE_ONCE(cpu->hwp_req_cached, value); | 2653 | WRITE_ONCE(cpu->hwp_req_cached, value); |
| 2588 | cpu->epp_cached = (value & GENMASK_ULL(31, 24)) >> 24; | 2654 | cpu->epp_cached = intel_pstate_get_epp(cpu, value); |
| 2589 | } else { | 2655 | } else { |
| 2590 | turbo_max = cpu->pstate.turbo_pstate; | 2656 | turbo_max = cpu->pstate.turbo_pstate; |
| 2591 | policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY; | 2657 | policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY; |
| @@ -2644,7 +2710,10 @@ static struct cpufreq_driver intel_cpufreq = { · 52 unmodified lines | |||
| 2644 | .fast_switch = intel_cpufreq_fast_switch, | 2710 | .fast_switch = intel_cpufreq_fast_switch, |
| 2645 | .init = intel_cpufreq_cpu_init, | 2711 | .init = intel_cpufreq_cpu_init, |
| 2646 | .exit = intel_cpufreq_cpu_exit, | 2712 | .exit = intel_cpufreq_cpu_exit, |
| 2647 | .stop_cpu = intel_cpufreq_stop_cpu, | 2713 | .offline = intel_pstate_cpu_offline, |
| 2714 | .online = intel_pstate_cpu_online, | ||
| 2715 | .suspend = intel_pstate_suspend, | ||
| 2716 | .resume = intel_pstate_resume, | ||
| 2648 | .update_limits = intel_pstate_update_limits, | 2717 | .update_limits = intel_pstate_update_limits, |
| 2649 | .name = "intel_cpufreq", | 2718 | .name = "intel_cpufreq", |
| 2650 | }; | 2719 | }; |
| @@ -2667,9 +2736,6 @@ static void intel_pstate_driver_cleanup(void) · 16 unmodified lines | |||
| 2667 | } | 2736 | } |
| 2668 | put_online_cpus(); | 2737 | put_online_cpus(); |
| 2669 | 2738 | ||
| 2670 | if (intel_pstate_driver == &intel_pstate) | ||
| 2671 | intel_pstate_sysfs_hide_hwp_dynamic_boost(); | ||
| 2672 | |||
| 2673 | intel_pstate_driver = NULL; | 2739 | intel_pstate_driver = NULL; |
| 2674 | } | 2740 | } |
| 2675 | 2741 | ||
| @@ -2695,14 +2761,6 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver) · 19 unmodified lines | |||
| 2695 | return 0; | 2761 | return 0; |
| 2696 | } | 2762 | } |
| 2697 | 2763 | ||
| 2698 | static int intel_pstate_unregister_driver(void) | ||
| 2699 | { | ||
| 2700 | cpufreq_unregister_driver(intel_pstate_driver); | ||
| 2701 | intel_pstate_driver_cleanup(); | ||
| 2702 | |||
| 2703 | return 0; | ||
| 2704 | } | ||
| 2705 | |||
| 2706 | static ssize_t intel_pstate_show_status(char *buf) | 2764 | static ssize_t intel_pstate_show_status(char *buf) |
| 2707 | { | 2765 | { |
| 2708 | if (!intel_pstate_driver) | 2766 | if (!intel_pstate_driver) |
| @@ -2714,20 +2772,23 @@ static ssize_t intel_pstate_show_status(char *buf) · 5 unmodified lines | |||
| 2714 | 2772 | ||
| 2715 | static int intel_pstate_update_status(const char *buf, size_t size) | 2773 | static int intel_pstate_update_status(const char *buf, size_t size) |
| 2716 | { | 2774 | { |
| 2717 | int ret; | 2775 | if (size == 3 && !strncmp(buf, "off", size)) { |
| 2776 | if (!intel_pstate_driver) | ||
| 2777 | return -EINVAL; | ||
| 2778 | |||
| 2779 | if (hwp_active) | ||
| 2780 | return -EBUSY; | ||
| 2718 | 2781 | ||
| 2719 | if (size == 3 && !strncmp(buf, "off", size)) | 2782 | cpufreq_unregister_driver(intel_pstate_driver); |
| 2720 | return intel_pstate_driver ? | 2783 | intel_pstate_driver_cleanup(); |
| 2721 | intel_pstate_unregister_driver() : -EINVAL; | 2784 | } |
| 2722 | 2785 | ||
| 2723 | if (size == 6 && !strncmp(buf, "active", size)) { | 2786 | if (size == 6 && !strncmp(buf, "active", size)) { |
| 2724 | if (intel_pstate_driver) { | 2787 | if (intel_pstate_driver) { |
| 2725 | if (intel_pstate_driver == &intel_pstate) | 2788 | if (intel_pstate_driver == &intel_pstate) |
| 2726 | return 0; | 2789 | return 0; |
| 2727 | 2790 | ||
| 2728 | ret = intel_pstate_unregister_driver(); | 2791 | cpufreq_unregister_driver(intel_pstate_driver); |
| 2729 | if (ret) | ||
| 2730 | return ret; | ||
| 2731 | } | 2792 | } |
| 2732 | 2793 | ||
| 2733 | return intel_pstate_register_driver(&intel_pstate); | 2794 | return intel_pstate_register_driver(&intel_pstate); |
| @@ -2738,9 +2799,8 @@ static int intel_pstate_update_status(const char *buf, size_t size) · 4 unmodified lines | |||
| 2738 | if (intel_pstate_driver == &intel_cpufreq) | 2799 | if (intel_pstate_driver == &intel_cpufreq) |
| 2739 | return 0; | 2800 | return 0; |
| 2740 | 2801 | ||
| 2741 | ret = intel_pstate_unregister_driver(); | 2802 | cpufreq_unregister_driver(intel_pstate_driver); |
| 2742 | if (ret) | 2803 | intel_pstate_sysfs_hide_hwp_dynamic_boost(); |
| 2743 | return ret; | ||
| 2744 | } | 2804 | } |
| 2745 | 2805 | ||
| 2746 | return intel_pstate_register_driver(&intel_cpufreq); | 2806 | return intel_pstate_register_driver(&intel_cpufreq); |
| @@ -429,7 +429,7 @@ int dev_dax_probe(struct device *dev) · 428 unmodified lines | |||
| 429 | return -EBUSY; | 429 | return -EBUSY; |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | dev_dax->pgmap.type = MEMORY_DEVICE_DEVDAX; | 432 | dev_dax->pgmap.type = MEMORY_DEVICE_GENERIC; |
| 433 | addr = devm_memremap_pages(dev, &dev_dax->pgmap); | 433 | addr = devm_memremap_pages(dev, &dev_dax->pgmap); |
| 434 | if (IS_ERR(addr)) | 434 | if (IS_ERR(addr)) |
| 435 | return PTR_ERR(addr); | 435 | return PTR_ERR(addr); |
| @@ -100,7 +100,7 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev, · 99 unmodified lines | |||
| 100 | return false; | 100 | return false; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | if (!dax_dev && !bdev_dax_supported(bdev, blocksize)) { | 103 | if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) { |
| 104 | pr_debug("%s: error: dax unsupported by block device\n", | 104 | pr_debug("%s: error: dax unsupported by block device\n", |
| 105 | bdevname(bdev, buf)); | 105 | bdevname(bdev, buf)); |
| 106 | return false; | 106 | return false; |
| @@ -316,9 +316,9 @@ out: · 315 unmodified lines | |||
| 316 | * name of the dma-buf if the same piece of memory is used for multiple | 316 | * name of the dma-buf if the same piece of memory is used for multiple |
| 317 | * purpose between different devices. | 317 | * purpose between different devices. |
| 318 | * | 318 | * |
| 319 | * @dmabuf [in] dmabuf buffer that will be renamed. | 319 | * @dmabuf: [in] dmabuf buffer that will be renamed. |
| 320 | * @buf: [in] A piece of userspace memory that contains the name of | 320 | * @buf: [in] A piece of userspace memory that contains the name of |
| 321 | * the dma-buf. | 321 | * the dma-buf. |
| 322 | * | 322 | * |
| 323 | * Returns 0 on success. If the dma-buf buffer is already attached to | 323 | * Returns 0 on success. If the dma-buf buffer is already attached to |
| 324 | * devices, return -EBUSY. | 324 | * devices, return -EBUSY. |
| @@ -222,6 +222,7 @@ EXPORT_SYMBOL(dma_fence_chain_ops); · 221 unmodified lines | |||
| 222 | * @chain: the chain node to initialize | 222 | * @chain: the chain node to initialize |
| 223 | * @prev: the previous fence | 223 | * @prev: the previous fence |
| 224 | * @fence: the current fence | 224 | * @fence: the current fence |
| 225 | * @seqno: the sequence number to use for the fence chain | ||
| 225 | * | 226 | * |
| 226 | * Initialize a new chain node and either start a new chain or add the node to | 227 | * Initialize a new chain node and either start a new chain or add the node to |
| 227 | * the existing chain of the previous fence. | 228 | * the existing chain of the previous fence. |
| @@ -135,11 +135,13 @@ static void acpi_dma_parse_csrt(struct acpi_device *adev, struct acpi_dma *adma) · 134 unmodified lines | |||
| 135 | if (ret < 0) { | 135 | if (ret < 0) { |
| 136 | dev_warn(&adev->dev, | 136 | dev_warn(&adev->dev, |
| 137 | "error in parsing resource group\n"); | 137 | "error in parsing resource group\n"); |
| 138 | return; | 138 | break; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | grp = (struct acpi_csrt_group *)((void *)grp + grp->length); | 141 | grp = (struct acpi_csrt_group *)((void *)grp + grp->length); |
| 142 | } | 142 | } |
| 143 | |||
| 144 | acpi_put_table((struct acpi_table_header *)csrt); | ||
| 143 | } | 145 | } |
| 144 | 146 | ||
| 145 | /** | 147 | /** |
| @@ -1650,13 +1650,17 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, · 1649 unmodified lines | |||
| 1650 | return NULL; | 1650 | return NULL; |
| 1651 | 1651 | ||
| 1652 | dmac_pdev = of_find_device_by_node(dma_spec->np); | 1652 | dmac_pdev = of_find_device_by_node(dma_spec->np); |
| 1653 | if (!dmac_pdev) | ||
| 1654 | return NULL; | ||
| 1653 | 1655 | ||
| 1654 | dma_cap_zero(mask); | 1656 | dma_cap_zero(mask); |
| 1655 | dma_cap_set(DMA_SLAVE, mask); | 1657 | dma_cap_set(DMA_SLAVE, mask); |
| 1656 | 1658 | ||
| 1657 | atslave = kmalloc(sizeof(*atslave), GFP_KERNEL); | 1659 | atslave = kmalloc(sizeof(*atslave), GFP_KERNEL); |
| 1658 | if (!atslave) | 1660 | if (!atslave) { |
| 1661 | put_device(&dmac_pdev->dev); | ||
| 1659 | return NULL; | 1662 | return NULL; |
| 1663 | } | ||
| 1660 | 1664 | ||
| 1661 | atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW; | 1665 | atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW; |
| 1662 | /* | 1666 | /* |
| @@ -1685,8 +1689,11 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec, · 22 unmodified lines | |||
| 1685 | atslave->dma_dev = &dmac_pdev->dev; | 1689 | atslave->dma_dev = &dmac_pdev->dev; |
| 1686 | 1690 | ||
| 1687 | chan = dma_request_channel(mask, at_dma_filter, atslave); | 1691 | chan = dma_request_channel(mask, at_dma_filter, atslave); |
| 1688 | if (!chan) | 1692 | if (!chan) { |
| 1693 | put_device(&dmac_pdev->dev); | ||
| 1694 | kfree(atslave); | ||
| 1689 | return NULL; | 1695 | return NULL; |
| 1696 | } | ||
| 1690 | 1697 | ||
| 1691 | atchan = to_at_dma_chan(chan); | 1698 | atchan = to_at_dma_chan(chan); |
| 1692 | atchan->per_if = dma_spec->args[0] & 0xff; | 1699 | atchan->per_if = dma_spec->args[0] & 0xff; |
| @@ -879,24 +879,11 @@ static int jz4780_dma_probe(struct platform_device *pdev) · 878 unmodified lines | |||
| 879 | return -EINVAL; | 879 | return -EINVAL; |
| 880 | } | 880 | } |
| 881 | 881 | ||
| 882 | ret = platform_get_irq(pdev, 0); | ||
| 883 | if (ret < 0) | ||
| 884 | return ret; | ||
| 885 | |||
| 886 | jzdma->irq = ret; | ||
| 887 | |||
| 888 | ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev), | ||
| 889 | jzdma); | ||
| 890 | if (ret) { | ||
| 891 | dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq); | ||
| 892 | return ret; | ||
| 893 | } | ||
| 894 | |||
| 895 | jzdma->clk = devm_clk_get(dev, NULL); | 882 | jzdma->clk = devm_clk_get(dev, NULL); |
| 896 | if (IS_ERR(jzdma->clk)) { | 883 | if (IS_ERR(jzdma->clk)) { |
| 897 | dev_err(dev, "failed to get clock\n"); | 884 | dev_err(dev, "failed to get clock\n"); |
| 898 | ret = PTR_ERR(jzdma->clk); | 885 | ret = PTR_ERR(jzdma->clk); |
| 899 | goto err_free_irq; | 886 | return ret; |
| 900 | } | 887 | } |
| 901 | 888 | ||
| 902 | clk_prepare_enable(jzdma->clk); | 889 | clk_prepare_enable(jzdma->clk); |
| @@ -949,10 +936,23 @@ static int jz4780_dma_probe(struct platform_device *pdev) · 46 unmodified lines | |||
| 949 | jzchan->vchan.desc_free = jz4780_dma_desc_free; | 936 | jzchan->vchan.desc_free = jz4780_dma_desc_free; |
| 950 | } | 937 | } |
| 951 | 938 | ||
| 939 | ret = platform_get_irq(pdev, 0); | ||
| 940 | if (ret < 0) | ||
| 941 | goto err_disable_clk; | ||
| 942 | |||
| 943 | jzdma->irq = ret; | ||
| 944 | |||
| 945 | ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev), | ||
| 946 | jzdma); | ||
| 947 | if (ret) { | ||
| 948 | dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq); | ||
| 949 | goto err_disable_clk; | ||
| 950 | } | ||
| 951 | |||
| 952 | ret = dmaenginem_async_device_register(dd); | 952 | ret = dmaenginem_async_device_register(dd); |
| 953 | if (ret) { | 953 | if (ret) { |
| 954 | dev_err(dev, "failed to register device\n"); | 954 | dev_err(dev, "failed to register device\n"); |
| 955 | goto err_disable_clk; | 955 | goto err_free_irq; |
| 956 | } | 956 | } |
| 957 | 957 | ||
| 958 | /* Register with OF DMA helpers. */ | 958 | /* Register with OF DMA helpers. */ |
| @@ -960,17 +960,17 @@ static int jz4780_dma_probe(struct platform_device *pdev) · 1 unmodified line | |||
| 960 | jzdma); | 960 | jzdma); |
| 961 | if (ret) { | 961 | if (ret) { |
| 962 | dev_err(dev, "failed to register OF DMA controller\n"); | 962 | dev_err(dev, "failed to register OF DMA controller\n"); |
| 963 | goto err_disable_clk; | 963 | goto err_free_irq; |
| 964 | } | 964 | } |
| 965 | 965 | ||
| 966 | dev_info(dev, "JZ4780 DMA controller initialised\n"); | 966 | dev_info(dev, "JZ4780 DMA controller initialised\n"); |
| 967 | return 0; | 967 | return 0; |
| 968 | 968 | ||
| 969 | err_disable_clk: | ||
| 970 | clk_disable_unprepare(jzdma->clk); | ||
| 971 | |||
| 972 | err_free_irq: | 969 | err_free_irq: |
| 973 | free_irq(jzdma->irq, jzdma); | 970 | free_irq(jzdma->irq, jzdma); |
| 971 | |||
| 972 | err_disable_clk: | ||
| 973 | clk_disable_unprepare(jzdma->clk); | ||
| 974 | return ret; | 974 | return ret; |
| 975 | } | 975 | } |
| 976 | 976 | ||
| @@ -405,7 +405,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) · 404 unmodified lines | |||
| 405 | if (xfer->cyclic) { | 405 | if (xfer->cyclic) { |
| 406 | burst->dar = xfer->xfer.cyclic.paddr; | 406 | burst->dar = xfer->xfer.cyclic.paddr; |
| 407 | } else { | 407 | } else { |
| 408 | burst->dar = sg_dma_address(sg); | 408 | burst->dar = dst_addr; |
| 409 | /* Unlike the typical assumption by other | 409 | /* Unlike the typical assumption by other |
| 410 | * drivers/IPs the peripheral memory isn't | 410 | * drivers/IPs the peripheral memory isn't |
| 411 | * a FIFO memory, in this case, it's a | 411 | * a FIFO memory, in this case, it's a |
| @@ -413,14 +413,13 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) · 1 unmodified line | |||
| 413 | * and destination addresses are increased | 413 | * and destination addresses are increased |
| 414 | * by the same portion (data length) | 414 | * by the same portion (data length) |
| 415 | */ | 415 | */ |
| 416 | src_addr += sg_dma_len(sg); | ||
| 417 | } | 416 | } |
| 418 | } else { | 417 | } else { |
| 419 | burst->dar = dst_addr; | 418 | burst->dar = dst_addr; |
| 420 | if (xfer->cyclic) { | 419 | if (xfer->cyclic) { |
| 421 | burst->sar = xfer->xfer.cyclic.paddr; | 420 | burst->sar = xfer->xfer.cyclic.paddr; |
| 422 | } else { | 421 | } else { |
| 423 | burst->sar = sg_dma_address(sg); | 422 | burst->sar = src_addr; |
| 424 | /* Unlike the typical assumption by other | 423 | /* Unlike the typical assumption by other |
| 425 | * drivers/IPs the peripheral memory isn't | 424 | * drivers/IPs the peripheral memory isn't |
| 426 | * a FIFO memory, in this case, it's a | 425 | * a FIFO memory, in this case, it's a |
| @@ -428,12 +427,14 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) · 1 unmodified line | |||
| 428 | * and destination addresses are increased | 427 | * and destination addresses are increased |
| 429 | * by the same portion (data length) | 428 | * by the same portion (data length) |
| 430 | */ | 429 | */ |
| 431 | dst_addr += sg_dma_len(sg); | ||
| 432 | } | 430 | } |
| 433 | } | 431 | } |
| 434 | 432 | ||
| 435 | if (!xfer->cyclic) | 433 | if (!xfer->cyclic) { |
| 434 | src_addr += sg_dma_len(sg); | ||
| 435 | dst_addr += sg_dma_len(sg); | ||
| 436 | sg = sg_next(sg); | 436 | sg = sg_next(sg); |
| 437 | } | ||
| 437 | } | 438 | } |
| 438 | 439 | ||
| 439 | return vchan_tx_prep(&chan->vc, &desc->vd, xfer->flags); | 440 | return vchan_tx_prep(&chan->vc, &desc->vd, xfer->flags); |
| @@ -410,10 +410,27 @@ int idxd_device_enable(struct idxd_device *idxd) · 409 unmodified lines | |||
| 410 | return 0; | 410 | return 0; |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | void idxd_device_wqs_clear_state(struct idxd_device *idxd) | ||
| 414 | { | ||
| 415 | int i; | ||
| 416 | |||
| 417 | lockdep_assert_held(&idxd->dev_lock); | ||
| 418 | |||
| 419 | for (i = 0; i < idxd->max_wqs; i++) { | ||
| 420 | struct idxd_wq *wq = &idxd->wqs[i]; | ||
| 421 | |||
| 422 | if (wq->state == IDXD_WQ_ENABLED) { | ||
| 423 | idxd_wq_disable_cleanup(wq); | ||
| 424 | wq->state = IDXD_WQ_DISABLED; | ||
| 425 | } | ||
| 426 | } | ||
| 427 | } | ||
| 428 | |||
| 413 | int idxd_device_disable(struct idxd_device *idxd) | 429 | int idxd_device_disable(struct idxd_device *idxd) |
| 414 | { | 430 | { |
| 415 | struct device *dev = &idxd->pdev->dev; | 431 | struct device *dev = &idxd->pdev->dev; |
| 416 | u32 status; | 432 | u32 status; |
| 433 | unsigned long flags; | ||
| 417 | 434 | ||
| 418 | if (!idxd_is_enabled(idxd)) { | 435 | if (!idxd_is_enabled(idxd)) { |
| 419 | dev_dbg(dev, "Device is not enabled\n"); | 436 | dev_dbg(dev, "Device is not enabled\n"); |
| @@ -429,13 +446,22 @@ int idxd_device_disable(struct idxd_device *idxd) · 9 unmodified lines | |||
| 429 | return -ENXIO; | 446 | return -ENXIO; |
| 430 | } | 447 | } |
| 431 | 448 | ||
| 449 | spin_lock_irqsave(&idxd->dev_lock, flags); | ||
| 450 | idxd_device_wqs_clear_state(idxd); | ||
| 432 | idxd->state = IDXD_DEV_CONF_READY; | 451 | idxd->state = IDXD_DEV_CONF_READY; |
| 452 | spin_unlock_irqrestore(&idxd->dev_lock, flags); | ||
| 433 | return 0; | 453 | return 0; |
| 434 | } | 454 | } |
| 435 | 455 | ||
| 436 | void idxd_device_reset(struct idxd_device *idxd) | 456 | void idxd_device_reset(struct idxd_device *idxd) |
| 437 | { | 457 | { |
| 458 | unsigned long flags; | ||
| 459 | |||
| 438 | idxd_cmd_exec(idxd, IDXD_CMD_RESET_DEVICE, 0, NULL); | 460 | idxd_cmd_exec(idxd, IDXD_CMD_RESET_DEVICE, 0, NULL); |
| 461 | spin_lock_irqsave(&idxd->dev_lock, flags); | ||
| 462 | idxd_device_wqs_clear_state(idxd); | ||
| 463 | idxd->state = IDXD_DEV_CONF_READY; | ||
| 464 | spin_unlock_irqrestore(&idxd->dev_lock, flags); | ||
| 439 | } | 465 | } |
| 440 | 466 | ||
| 441 | /* Device configuration bits */ | 467 | /* Device configuration bits */ |
| @@ -11,18 +11,6 @@ · 10 unmodified lines | |||
| 11 | #include "idxd.h" | 11 | #include "idxd.h" |
| 12 | #include "registers.h" | 12 | #include "registers.h" |
| 13 | 13 | ||
| 14 | void idxd_device_wqs_clear_state(struct idxd_device *idxd) | ||
| 15 | { | ||
| 16 | int i; | ||
| 17 | |||
| 18 | lockdep_assert_held(&idxd->dev_lock); | ||
| 19 | for (i = 0; i < idxd->max_wqs; i++) { | ||
| 20 | struct idxd_wq *wq = &idxd->wqs[i]; | ||
| 21 | |||
| 22 | wq->state = IDXD_WQ_DISABLED; | ||
| 23 | } | ||
| 24 | } | ||
| 25 | |||
| 26 | static void idxd_device_reinit(struct work_struct *work) | 14 | static void idxd_device_reinit(struct work_struct *work) |
| 27 | { | 15 | { |
| 28 | struct idxd_device *idxd = container_of(work, struct idxd_device, work); | 16 | struct idxd_device *idxd = container_of(work, struct idxd_device, work); |
| @@ -71,12 +71,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec, · 70 unmodified lines | |||
| 71 | return NULL; | 71 | return NULL; |
| 72 | 72 | ||
| 73 | chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target); | 73 | chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target); |
| 74 | if (chan) { | 74 | if (IS_ERR_OR_NULL(chan)) { |
| 75 | chan->router = ofdma->dma_router; | ||
| 76 | chan->route_data = route_data; | ||
| 77 | } else { | ||
| 78 | ofdma->dma_router->route_free(ofdma->dma_router->dev, | 75 | ofdma->dma_router->route_free(ofdma->dma_router->dev, |
| 79 | route_data); | 76 | route_data); |
| 77 | } else { | ||
| 78 | chan->router = ofdma->dma_router; | ||
| 79 | chan->route_data = route_data; | ||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | /* | 82 | /* |
| @@ -2797,6 +2797,7 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, · 2796 unmodified lines | |||
| 2797 | while (burst != (1 << desc->rqcfg.brst_size)) | 2797 | while (burst != (1 << desc->rqcfg.brst_size)) |
| 2798 | desc->rqcfg.brst_size++; | 2798 | desc->rqcfg.brst_size++; |
| 2799 | 2799 | ||
| 2800 | desc->rqcfg.brst_len = get_burst_len(desc, len); | ||
| 2800 | /* | 2801 | /* |
| 2801 | * If burst size is smaller than bus width then make sure we only | 2802 | * If burst size is smaller than bus width then make sure we only |
| 2802 | * transfer one at a time to avoid a burst stradling an MFIFO entry. | 2803 | * transfer one at a time to avoid a burst stradling an MFIFO entry. |
| @@ -2804,7 +2805,6 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst, · 1 unmodified line | |||
| 2804 | if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) | 2805 | if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) |
| 2805 | desc->rqcfg.brst_len = 1; | 2806 | desc->rqcfg.brst_len = 1; |
| 2806 | 2807 | ||
| 2807 | desc->rqcfg.brst_len = get_burst_len(desc, len); | ||
| 2808 | desc->bytes_requested = len; | 2808 | desc->bytes_requested = len; |
| 2809 | 2809 | ||
| 2810 | desc->txd.flags = flags; | 2810 | desc->txd.flags = flags; |
| @@ -2059,9 +2059,9 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl, · 2058 unmodified lines | |||
| 2059 | return NULL; | 2059 | return NULL; |
| 2060 | } | 2060 | } |
| 2061 | 2061 | ||
| 2062 | cppi5_tr_init(&tr_req[i].flags, CPPI5_TR_TYPE1, false, false, | 2062 | cppi5_tr_init(&tr_req[tr_idx].flags, CPPI5_TR_TYPE1, false, |
| 2063 | CPPI5_TR_EVENT_SIZE_COMPLETION, 0); | 2063 | false, CPPI5_TR_EVENT_SIZE_COMPLETION, 0); |
| 2064 | cppi5_tr_csf_set(&tr_req[i].flags, CPPI5_TR_CSF_SUPR_EVT); | 2064 | cppi5_tr_csf_set(&tr_req[tr_idx].flags, CPPI5_TR_CSF_SUPR_EVT); |
| 2065 | 2065 | ||
| 2066 | tr_req[tr_idx].addr = sg_addr; | 2066 | tr_req[tr_idx].addr = sg_addr; |
| 2067 | tr_req[tr_idx].icnt0 = tr0_cnt0; | 2067 | tr_req[tr_idx].icnt0 = tr0_cnt0; |
| @@ -3101,14 +3101,14 @@ static struct udma_match_data am654_main_data = { · 1033 unmodified lines | |||
| 3101 | .psil_base = 0x1000, | 3101 | .psil_base = 0x1000, |
| 3102 | .enable_memcpy_support = true, | 3102 | .enable_memcpy_support = true, |
| 3103 | .statictr_z_mask = GENMASK(11, 0), | 3103 | .statictr_z_mask = GENMASK(11, 0), |
| 3104 | .rchan_oes_offset = 0x2000, | 3104 | .rchan_oes_offset = 0x200, |
| 3105 | }; | 3105 | }; |
| 3106 | 3106 | ||
| 3107 | static struct udma_match_data am654_mcu_data = { | 3107 | static struct udma_match_data am654_mcu_data = { |
| 3108 | .psil_base = 0x6000, | 3108 | .psil_base = 0x6000, |
| 3109 | .enable_memcpy_support = false, | 3109 | .enable_memcpy_support = false, |
| 3110 | .statictr_z_mask = GENMASK(11, 0), | 3110 | .statictr_z_mask = GENMASK(11, 0), |
| 3111 | .rchan_oes_offset = 0x2000, | 3111 | .rchan_oes_offset = 0x200, |
| 3112 | }; | 3112 | }; |
| 3113 | 3113 | ||
| 3114 | static struct udma_match_data j721e_main_data = { | 3114 | static struct udma_match_data j721e_main_data = { |
| @@ -16,9 +16,9 @@ · 15 unmodified lines | |||
| 16 | 16 | ||
| 17 | /* Exported for use by lib/test_firmware.c only */ | 17 | /* Exported for use by lib/test_firmware.c only */ |
| 18 | LIST_HEAD(efi_embedded_fw_list); | 18 | LIST_HEAD(efi_embedded_fw_list); |
| 19 | EXPORT_SYMBOL_GPL(efi_embedded_fw_list); | 19 | EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_list, TEST_FIRMWARE); |
| 20 | 20 | bool efi_embedded_fw_checked; | |
| 21 | static bool checked_for_fw; | 21 | EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_checked, TEST_FIRMWARE); |
| 22 | 22 | ||
| 23 | static const struct dmi_system_id * const embedded_fw_table[] = { | 23 | static const struct dmi_system_id * const embedded_fw_table[] = { |
| 24 | #ifdef CONFIG_TOUCHSCREEN_DMI | 24 | #ifdef CONFIG_TOUCHSCREEN_DMI |
| @@ -116,14 +116,14 @@ void __init efi_check_for_embedded_firmwares(void) · 91 unmodified lines | |||
| 116 | } | 116 | } |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | checked_for_fw = true; | 119 | efi_embedded_fw_checked = true; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | int efi_get_embedded_fw(const char *name, const u8 **data, size_t *size) | 122 | int efi_get_embedded_fw(const char *name, const u8 **data, size_t *size) |
| 123 | { | 123 | { |
| 124 | struct efi_embedded_fw *iter, *fw = NULL; | 124 | struct efi_embedded_fw *iter, *fw = NULL; |
| 125 | 125 | ||
| 126 | if (!checked_for_fw) { | 126 | if (!efi_embedded_fw_checked) { |
| 127 | pr_warn("Warning %s called while we did not check for embedded fw\n", | 127 | pr_warn("Warning %s called while we did not check for embedded fw\n", |
| 128 | __func__); | 128 | __func__); |
| 129 | return -ENOENT; | 129 | return -ENOENT; |
| @@ -1840,10 +1840,14 @@ static bool arcturus_is_dpm_running(struct smu_context *smu) · 1839 unmodified lines | |||
| 1840 | { | 1840 | { |
| 1841 | int ret = 0; | 1841 | int ret = 0; |
| 1842 | uint32_t feature_mask[2]; | 1842 | uint32_t feature_mask[2]; |
| 1843 | unsigned long feature_enabled; | 1843 | uint64_t feature_enabled; |
| 1844 | |||
| 1844 | ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2); | 1845 | ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2); |
| 1845 | feature_enabled = (unsigned long)((uint64_t)feature_mask[0] | | 1846 | if (ret) |
| 1846 | ((uint64_t)feature_mask[1] << 32)); | 1847 | return false; |
| 1848 | |||
| 1849 | feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0]; | ||
| 1850 | |||
| 1847 | return !!(feature_enabled & SMC_DPM_FEATURE); | 1851 | return !!(feature_enabled & SMC_DPM_FEATURE); |
| 1848 | } | 1852 | } |
| 1849 | 1853 | ||
| @@ -3581,7 +3581,8 @@ static int smu7_read_sensor(struct pp_hwmgr *hwmgr, int idx, · 3580 unmodified lines | |||
| 3581 | case AMDGPU_PP_SENSOR_GPU_POWER: | 3581 | case AMDGPU_PP_SENSOR_GPU_POWER: |
| 3582 | return smu7_get_gpu_power(hwmgr, (uint32_t *)value); | 3582 | return smu7_get_gpu_power(hwmgr, (uint32_t *)value); |
| 3583 | case AMDGPU_PP_SENSOR_VDDGFX: | 3583 | case AMDGPU_PP_SENSOR_VDDGFX: |
| 3584 | if ((data->vr_config & 0xff) == 0x2) | 3584 | if ((data->vr_config & VRCONF_VDDGFX_MASK) == |
| 3585 | (VR_SVI2_PLANE_2 << VRCONF_VDDGFX_SHIFT)) | ||
| 3585 | val_vid = PHM_READ_INDIRECT_FIELD(hwmgr->device, | 3586 | val_vid = PHM_READ_INDIRECT_FIELD(hwmgr->device, |
| 3586 | CGS_IND_REG__SMC, PWR_SVI2_STATUS, PLANE2_VID); | 3587 | CGS_IND_REG__SMC, PWR_SVI2_STATUS, PLANE2_VID); |
| 3587 | else | 3588 | else |
| @@ -374,8 +374,18 @@ static int vega10_thermal_set_temperature_range(struct pp_hwmgr *hwmgr, · 373 unmodified lines | |||
| 374 | /* compare them in unit celsius degree */ | 374 | /* compare them in unit celsius degree */ |
| 375 | if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES) | 375 | if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES) |
| 376 | low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES; | 376 | low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES; |
| 377 | if (high > tdp_table->usSoftwareShutdownTemp) | 377 | |
| 378 | high = tdp_table->usSoftwareShutdownTemp; | 378 | /* |
| 379 | * As a common sense, usSoftwareShutdownTemp should be bigger | ||
| 380 | * than ThotspotLimit. For any invalid usSoftwareShutdownTemp, | ||
| 381 | * we will just use the max possible setting VEGA10_THERMAL_MAXIMUM_ALERT_TEMP | ||
| 382 | * to avoid false alarms. | ||
| 383 | */ | ||
| 384 | if ((tdp_table->usSoftwareShutdownTemp > | ||
| 385 | range->hotspot_crit_max / PP_TEMPERATURE_UNITS_PER_CENTIGRADES)) { | ||
| 386 | if (high > tdp_table->usSoftwareShutdownTemp) | ||
| 387 | high = tdp_table->usSoftwareShutdownTemp; | ||
| 388 | } | ||
| 379 | 389 | ||
| 380 | if (low > high) | 390 | if (low > high) |
| 381 | return -EINVAL; | 391 | return -EINVAL; |
| @@ -1331,10 +1331,14 @@ static bool navi10_is_dpm_running(struct smu_context *smu) · 1330 unmodified lines | |||
| 1331 | { | 1331 | { |
| 1332 | int ret = 0; | 1332 | int ret = 0; |
| 1333 | uint32_t feature_mask[2]; | 1333 | uint32_t feature_mask[2]; |
| 1334 | unsigned long feature_enabled; | 1334 | uint64_t feature_enabled; |
| 1335 | |||
| 1335 | ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2); | 1336 | ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2); |
| 1336 | feature_enabled = (unsigned long)((uint64_t)feature_mask[0] | | 1337 | if (ret) |
| 1337 | ((uint64_t)feature_mask[1] << 32)); | 1338 | return false; |
| 1339 | |||
| 1340 | feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0]; | ||
| 1341 | |||
| 1338 | return !!(feature_enabled & SMC_DPM_FEATURE); | 1342 | return !!(feature_enabled & SMC_DPM_FEATURE); |
| 1339 | } | 1343 | } |
| 1340 | 1344 | ||
| @@ -68,7 +68,8 @@ · 67 unmodified lines | |||
| 68 | FEATURE_MASK(FEATURE_DPM_LINK_BIT) | \ | 68 | FEATURE_MASK(FEATURE_DPM_LINK_BIT) | \ |
| 69 | FEATURE_MASK(FEATURE_DPM_SOCCLK_BIT) | \ | 69 | FEATURE_MASK(FEATURE_DPM_SOCCLK_BIT) | \ |
| 70 | FEATURE_MASK(FEATURE_DPM_FCLK_BIT) | \ | 70 | FEATURE_MASK(FEATURE_DPM_FCLK_BIT) | \ |
| 71 | FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT)) | 71 | FEATURE_MASK(FEATURE_DPM_DCEFCLK_BIT) | \ |
| 72 | FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT)) | ||
| 72 | 73 | ||
| 73 | #define SMU_11_0_7_GFX_BUSY_THRESHOLD 15 | 74 | #define SMU_11_0_7_GFX_BUSY_THRESHOLD 15 |
| 74 | 75 | ||
| @@ -229,6 +230,7 @@ sienna_cichlid_get_allowed_feature_mask(struct smu_context *smu, · 154 unmodified lines | |||
| 229 | 230 | ||
| 230 | *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT) | 231 | *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT) |
| 231 | | FEATURE_MASK(FEATURE_DPM_FCLK_BIT) | 232 | | FEATURE_MASK(FEATURE_DPM_FCLK_BIT) |
| 233 | | FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT) | ||
| 232 | | FEATURE_MASK(FEATURE_DS_SOCCLK_BIT) | 234 | | FEATURE_MASK(FEATURE_DS_SOCCLK_BIT) |
| 233 | | FEATURE_MASK(FEATURE_DS_DCEFCLK_BIT) | 235 | | FEATURE_MASK(FEATURE_DS_DCEFCLK_BIT) |
| 234 | | FEATURE_MASK(FEATURE_DS_FCLK_BIT) | 236 | | FEATURE_MASK(FEATURE_DS_FCLK_BIT) |
| @@ -1147,10 +1149,14 @@ static bool sienna_cichlid_is_dpm_running(struct smu_context *smu) · 912 unmodified lines | |||
| 1147 | { | 1149 | { |
| 1148 | int ret = 0; | 1150 | int ret = 0; |
| 1149 | uint32_t feature_mask[2]; | 1151 | uint32_t feature_mask[2]; |
| 1150 | unsigned long feature_enabled; | 1152 | uint64_t feature_enabled; |
| 1153 | |||
| 1151 | ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2); | 1154 | ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2); |
| 1152 | feature_enabled = (unsigned long)((uint64_t)feature_mask[0] | | 1155 | if (ret) |
| 1153 | ((uint64_t)feature_mask[1] << 32)); | 1156 | return false; |
| 1157 | |||
| 1158 | feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0]; | ||
| 1159 | |||
| 1154 | return !!(feature_enabled & SMC_DPM_FEATURE); | 1160 | return !!(feature_enabled & SMC_DPM_FEATURE); |
| 1155 | } | 1161 | } |
| 1156 | 1162 | ||
| @@ -37,6 +37,7 @@ · 36 unmodified lines | |||
| 37 | #include "cgs_common.h" | 37 | #include "cgs_common.h" |
| 38 | #include "atombios.h" | 38 | #include "atombios.h" |
| 39 | #include "pppcielanes.h" | 39 | #include "pppcielanes.h" |
| 40 | #include "smu7_smumgr.h" | ||
| 40 | 41 | ||
| 41 | #include "smu/smu_7_0_1_d.h" | 42 | #include "smu/smu_7_0_1_d.h" |
| 42 | #include "smu/smu_7_0_1_sh_mask.h" | 43 | #include "smu/smu_7_0_1_sh_mask.h" |
| @@ -2948,6 +2949,7 @@ const struct pp_smumgr_func ci_smu_funcs = { · 2905 unmodified lines | |||
| 2948 | .request_smu_load_specific_fw = NULL, | 2949 | .request_smu_load_specific_fw = NULL, |
| 2949 | .send_msg_to_smc = ci_send_msg_to_smc, | 2950 | .send_msg_to_smc = ci_send_msg_to_smc, |
| 2950 | .send_msg_to_smc_with_parameter = ci_send_msg_to_smc_with_parameter, | 2951 | .send_msg_to_smc_with_parameter = ci_send_msg_to_smc_with_parameter, |
| 2952 | .get_argument = smu7_get_argument, | ||
| 2951 | .download_pptable_settings = NULL, | 2953 | .download_pptable_settings = NULL, |
| 2952 | .upload_pptable_settings = NULL, | 2954 | .upload_pptable_settings = NULL, |
| 2953 | .get_offsetof = ci_get_offsetof, | 2955 | .get_offsetof = ci_get_offsetof, |
| @@ -258,7 +258,7 @@ static bool phy_is_master(struct drm_i915_private *dev_priv, enum phy phy) · 257 unmodified lines | |||
| 258 | static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, | 258 | static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, |
| 259 | enum phy phy) | 259 | enum phy phy) |
| 260 | { | 260 | { |
| 261 | bool ret; | 261 | bool ret = true; |
| 262 | u32 expected_val = 0; | 262 | u32 expected_val = 0; |
| 263 | 263 | ||
| 264 | if (!icl_combo_phy_enabled(dev_priv, phy)) | 264 | if (!icl_combo_phy_enabled(dev_priv, phy)) |
| @@ -276,7 +276,7 @@ static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, · 11 unmodified lines | |||
| 276 | DCC_MODE_SELECT_CONTINUOSLY); | 276 | DCC_MODE_SELECT_CONTINUOSLY); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | ret = cnl_verify_procmon_ref_values(dev_priv, phy); | 279 | ret &= cnl_verify_procmon_ref_values(dev_priv, phy); |
| 280 | 280 | ||
| 281 | if (phy_is_master(dev_priv, phy)) { | 281 | if (phy_is_master(dev_priv, phy)) { |
| 282 | ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy), | 282 | ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy), |
| @@ -14956,12 +14956,6 @@ static int intel_atomic_check(struct drm_device *dev, · 14955 unmodified lines | |||
| 14956 | if (dev_priv->wm.distrust_bios_wm) | 14956 | if (dev_priv->wm.distrust_bios_wm) |
| 14957 | any_ms = true; | 14957 | any_ms = true; |
| 14958 | 14958 | ||
| 14959 | if (any_ms) { | ||
| 14960 | ret = intel_modeset_checks(state); | ||
| 14961 | if (ret) | ||
| 14962 | goto fail; | ||
| 14963 | } | ||
| 14964 | |||
| 14965 | intel_fbc_choose_crtc(dev_priv, state); | 14959 | intel_fbc_choose_crtc(dev_priv, state); |
| 14966 | ret = calc_watermark_data(state); | 14960 | ret = calc_watermark_data(state); |
| 14967 | if (ret) | 14961 | if (ret) |
| @@ -14976,6 +14970,10 @@ static int intel_atomic_check(struct drm_device *dev, · 8 unmodified lines | |||
| 14976 | goto fail; | 14970 | goto fail; |
| 14977 | 14971 | ||
| 14978 | if (any_ms) { | 14972 | if (any_ms) { |
| 14973 | ret = intel_modeset_checks(state); | ||
| 14974 | if (ret) | ||
| 14975 | goto fail; | ||
| 14976 | |||
| 14979 | ret = intel_modeset_calc_cdclk(state); | 14977 | ret = intel_modeset_calc_cdclk(state); |
| 14980 | if (ret) | 14978 | if (ret) |
| 14981 | return ret; | 14979 | return ret; |
| @@ -336,8 +336,10 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector, · 335 unmodified lines | |||
| 336 | 336 | ||
| 337 | /* Fill up the empty slots in sha_text and write it out */ | 337 | /* Fill up the empty slots in sha_text and write it out */ |
| 338 | sha_empty = sizeof(sha_text) - sha_leftovers; | 338 | sha_empty = sizeof(sha_text) - sha_leftovers; |
| 339 | for (j = 0; j < sha_empty; j++) | 339 | for (j = 0; j < sha_empty; j++) { |
| 340 | sha_text |= ksv[j] << ((sizeof(sha_text) - j - 1) * 8); | 340 | u8 off = ((sizeof(sha_text) - j - 1 - sha_leftovers) * 8); |
| 341 | sha_text |= ksv[j] << off; | ||
| 342 | } | ||
| 341 | 343 | ||
| 342 | ret = intel_write_sha_text(dev_priv, sha_text); | 344 | ret = intel_write_sha_text(dev_priv, sha_text); |
| 343 | if (ret < 0) | 345 | if (ret < 0) |
| @@ -435,7 +437,7 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector, · 91 unmodified lines | |||
| 435 | /* Write 32 bits of text */ | 437 | /* Write 32 bits of text */ |
| 436 | intel_de_write(dev_priv, HDCP_REP_CTL, | 438 | intel_de_write(dev_priv, HDCP_REP_CTL, |
| 437 | rep_ctl | HDCP_SHA1_TEXT_32); | 439 | rep_ctl | HDCP_SHA1_TEXT_32); |
| 438 | sha_text |= bstatus[0] << 24 | bstatus[1] << 16; | 440 | sha_text |= bstatus[0] << 8 | bstatus[1]; |
| 439 | ret = intel_write_sha_text(dev_priv, sha_text); | 441 | ret = intel_write_sha_text(dev_priv, sha_text); |
| 440 | if (ret < 0) | 442 | if (ret < 0) |
| 441 | return ret; | 443 | return ret; |
| @@ -450,17 +452,29 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector, · 8 unmodified lines | |||
| 450 | return ret; | 452 | return ret; |
| 451 | sha_idx += sizeof(sha_text); | 453 | sha_idx += sizeof(sha_text); |
| 452 | } | 454 | } |
| 455 | |||
| 456 | /* | ||
| 457 | * Terminate the SHA-1 stream by hand. For the other leftover | ||
| 458 | * cases this is appended by the hardware. | ||
| 459 | */ | ||
| 460 | intel_de_write(dev_priv, HDCP_REP_CTL, | ||
| 461 | rep_ctl | HDCP_SHA1_TEXT_32); | ||
| 462 | sha_text = DRM_HDCP_SHA1_TERMINATOR << 24; | ||
| 463 | ret = intel_write_sha_text(dev_priv, sha_text); | ||
| 464 | if (ret < 0) | ||
| 465 | return ret; | ||
| 466 | sha_idx += sizeof(sha_text); | ||
| 453 | } else if (sha_leftovers == 3) { | 467 | } else if (sha_leftovers == 3) { |
| 454 | /* Write 32 bits of text */ | 468 | /* Write 32 bits of text (filled from LSB) */ |
| 455 | intel_de_write(dev_priv, HDCP_REP_CTL, | 469 | intel_de_write(dev_priv, HDCP_REP_CTL, |
| 456 | rep_ctl | HDCP_SHA1_TEXT_32); | 470 | rep_ctl | HDCP_SHA1_TEXT_32); |
| 457 | sha_text |= bstatus[0] << 24; | 471 | sha_text |= bstatus[0]; |
| 458 | ret = intel_write_sha_text(dev_priv, sha_text); | 472 | ret = intel_write_sha_text(dev_priv, sha_text); |
| 459 | if (ret < 0) | 473 | if (ret < 0) |
| 460 | return ret; | 474 | return ret; |
| 461 | sha_idx += sizeof(sha_text); | 475 | sha_idx += sizeof(sha_text); |
| 462 | 476 | ||
| 463 | /* Write 8 bits of text, 24 bits of M0 */ | 477 | /* Write 8 bits of text (filled from LSB), 24 bits of M0 */ |
| 464 | intel_de_write(dev_priv, HDCP_REP_CTL, | 478 | intel_de_write(dev_priv, HDCP_REP_CTL, |
| 465 | rep_ctl | HDCP_SHA1_TEXT_8); | 479 | rep_ctl | HDCP_SHA1_TEXT_8); |
| 466 | ret = intel_write_sha_text(dev_priv, bstatus[1]); | 480 | ret = intel_write_sha_text(dev_priv, bstatus[1]); |
| @@ -781,6 +795,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector) · 314 unmodified lines | |||
| 781 | struct intel_hdcp *hdcp = &connector->hdcp; | 795 | struct intel_hdcp *hdcp = &connector->hdcp; |
| 782 | enum port port = dig_port->base.port; | 796 | enum port port = dig_port->base.port; |
| 783 | enum transcoder cpu_transcoder = hdcp->cpu_transcoder; | 797 | enum transcoder cpu_transcoder = hdcp->cpu_transcoder; |
| 798 | u32 repeater_ctl; | ||
| 784 | int ret; | 799 | int ret; |
| 785 | 800 | ||
| 786 | drm_dbg_kms(&dev_priv->drm, "[%s:%d] HDCP is being disabled...\n", | 801 | drm_dbg_kms(&dev_priv->drm, "[%s:%d] HDCP is being disabled...\n", |
| @@ -796,6 +811,11 @@ static int _intel_hdcp_disable(struct intel_connector *connector) · 9 unmodified lines | |||
| 796 | return -ETIMEDOUT; | 811 | return -ETIMEDOUT; |
| 797 | } | 812 | } |
| 798 | 813 | ||
| 814 | repeater_ctl = intel_hdcp_get_repeater_ctl(dev_priv, cpu_transcoder, | ||
| 815 | port); | ||
| 816 | intel_de_write(dev_priv, HDCP_REP_CTL, | ||
| 817 | intel_de_read(dev_priv, HDCP_REP_CTL) & ~repeater_ctl); | ||
| 818 | |||
| 799 | ret = hdcp->shim->toggle_signalling(dig_port, false); | 819 | ret = hdcp->shim->toggle_signalling(dig_port, false); |
| 800 | if (ret) { | 820 | if (ret) { |
| 801 | drm_err(&dev_priv->drm, "Failed to disable HDCP signalling\n"); | 821 | drm_err(&dev_priv->drm, "Failed to disable HDCP signalling\n"); |
| @@ -45,6 +45,13 @@ struct eb_vma_array { · 44 unmodified lines | |||
| 45 | struct eb_vma vma[]; | 45 | struct eb_vma vma[]; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | enum { | ||
| 49 | FORCE_CPU_RELOC = 1, | ||
| 50 | FORCE_GTT_RELOC, | ||
| 51 | FORCE_GPU_RELOC, | ||
| 52 | #define DBG_FORCE_RELOC 0 /* choose one of the above! */ | ||
| 53 | }; | ||
| 54 | |||
| 48 | #define __EXEC_OBJECT_HAS_PIN BIT(31) | 55 | #define __EXEC_OBJECT_HAS_PIN BIT(31) |
| 49 | #define __EXEC_OBJECT_HAS_FENCE BIT(30) | 56 | #define __EXEC_OBJECT_HAS_FENCE BIT(30) |
| 50 | #define __EXEC_OBJECT_NEEDS_MAP BIT(29) | 57 | #define __EXEC_OBJECT_NEEDS_MAP BIT(29) |
| @@ -253,6 +260,8 @@ struct i915_execbuffer { · 202 unmodified lines | |||
| 253 | */ | 260 | */ |
| 254 | struct reloc_cache { | 261 | struct reloc_cache { |
| 255 | struct drm_mm_node node; /** temporary GTT binding */ | 262 | struct drm_mm_node node; /** temporary GTT binding */ |
| 263 | unsigned long vaddr; /** Current kmap address */ | ||
| 264 | unsigned long page; /** Currently mapped page index */ | ||
| 256 | unsigned int gen; /** Cached value of INTEL_GEN */ | 265 | unsigned int gen; /** Cached value of INTEL_GEN */ |
| 257 | bool use_64bit_reloc : 1; | 266 | bool use_64bit_reloc : 1; |
| 258 | bool has_llc : 1; | 267 | bool has_llc : 1; |
| @@ -596,6 +605,23 @@ eb_add_vma(struct i915_execbuffer *eb, · 337 unmodified lines | |||
| 596 | } | 605 | } |
| 597 | } | 606 | } |
| 598 | 607 | ||
| 608 | static inline int use_cpu_reloc(const struct reloc_cache *cache, | ||
| 609 | const struct drm_i915_gem_object *obj) | ||
| 610 | { | ||
| 611 | if (!i915_gem_object_has_struct_page(obj)) | ||
| 612 | return false; | ||
| 613 | |||
| 614 | if (DBG_FORCE_RELOC == FORCE_CPU_RELOC) | ||
| 615 | return true; | ||
| 616 | |||
| 617 | if (DBG_FORCE_RELOC == FORCE_GTT_RELOC) | ||
| 618 | return false; | ||
| 619 | |||
| 620 | return (cache->has_llc || | ||
| 621 | obj->cache_dirty || | ||
| 622 | obj->cache_level != I915_CACHE_NONE); | ||
| 623 | } | ||
| 624 | |||
| 599 | static int eb_reserve_vma(const struct i915_execbuffer *eb, | 625 | static int eb_reserve_vma(const struct i915_execbuffer *eb, |
| 600 | struct eb_vma *ev, | 626 | struct eb_vma *ev, |
| 601 | u64 pin_flags) | 627 | u64 pin_flags) |
| @@ -926,6 +952,8 @@ relocation_target(const struct drm_i915_gem_relocation_entry *reloc, · 324 unmodified lines | |||
| 926 | static void reloc_cache_init(struct reloc_cache *cache, | 952 | static void reloc_cache_init(struct reloc_cache *cache, |
| 927 | struct drm_i915_private *i915) | 953 | struct drm_i915_private *i915) |
| 928 | { | 954 | { |
| 955 | cache->page = -1; | ||
| 956 | cache->vaddr = 0; | ||
| 929 | /* Must be a variable in the struct to allow GCC to unroll. */ | 957 | /* Must be a variable in the struct to allow GCC to unroll. */ |
| 930 | cache->gen = INTEL_GEN(i915); | 958 | cache->gen = INTEL_GEN(i915); |
| 931 | cache->has_llc = HAS_LLC(i915); | 959 | cache->has_llc = HAS_LLC(i915); |
| @@ -937,6 +965,25 @@ static void reloc_cache_init(struct reloc_cache *cache, · 5 unmodified lines | |||
| 937 | cache->target = NULL; | 965 | cache->target = NULL; |
| 938 | } | 966 | } |
| 939 | 967 | ||
| 968 | static inline void *unmask_page(unsigned long p) | ||
| 969 | { | ||
| 970 | return (void *)(uintptr_t)(p & PAGE_MASK); | ||
| 971 | } | ||
| 972 | |||
| 973 | static inline unsigned int unmask_flags(unsigned long p) | ||
| 974 | { | ||
| 975 | return p & ~PAGE_MASK; | ||
| 976 | } | ||
| 977 | |||
| 978 | #define KMAP 0x4 /* after CLFLUSH_FLAGS */ | ||
| 979 | |||
| 980 | static inline struct i915_ggtt *cache_to_ggtt(struct reloc_cache *cache) | ||
| 981 | { | ||
| 982 | struct drm_i915_private *i915 = | ||
| 983 | container_of(cache, struct i915_execbuffer, reloc_cache)->i915; | ||
| 984 | return &i915->ggtt; | ||
| 985 | } | ||
| 986 | |||
| 940 | #define RELOC_TAIL 4 | 987 | #define RELOC_TAIL 4 |
| 941 | 988 | ||
| 942 | static int reloc_gpu_chain(struct reloc_cache *cache) | 989 | static int reloc_gpu_chain(struct reloc_cache *cache) |
| @@ -1049,6 +1096,181 @@ static int reloc_gpu_flush(struct reloc_cache *cache) · 106 unmodified lines | |||
| 1049 | return err; | 1096 | return err; |
| 1050 | } | 1097 | } |
| 1051 | 1098 | ||
| 1099 | static void reloc_cache_reset(struct reloc_cache *cache) | ||
| 1100 | { | ||
| 1101 | void *vaddr; | ||
| 1102 | |||
| 1103 | if (!cache->vaddr) | ||
| 1104 | return; | ||
| 1105 | |||
| 1106 | vaddr = unmask_page(cache->vaddr); | ||
| 1107 | if (cache->vaddr & KMAP) { | ||
| 1108 | if (cache->vaddr & CLFLUSH_AFTER) | ||
| 1109 | mb(); | ||
| 1110 | |||
| 1111 | kunmap_atomic(vaddr); | ||
| 1112 | i915_gem_object_finish_access((struct drm_i915_gem_object *)cache->node.mm); | ||
| 1113 | } else { | ||
| 1114 | struct i915_ggtt *ggtt = cache_to_ggtt(cache); | ||
| 1115 | |||
| 1116 | intel_gt_flush_ggtt_writes(ggtt->vm.gt); | ||
| 1117 | io_mapping_unmap_atomic((void __iomem *)vaddr); | ||
| 1118 | |||
| 1119 | if (drm_mm_node_allocated(&cache->node)) { | ||
| 1120 | ggtt->vm.clear_range(&ggtt->vm, | ||
| 1121 | cache->node.start, | ||
| 1122 | cache->node.size); | ||
| 1123 | mutex_lock(&ggtt->vm.mutex); | ||
| 1124 | drm_mm_remove_node(&cache->node); | ||
| 1125 | mutex_unlock(&ggtt->vm.mutex); | ||
| 1126 | } else { | ||
| 1127 | i915_vma_unpin((struct i915_vma *)cache->node.mm); | ||
| 1128 | } | ||
| 1129 | } | ||
| 1130 | |||
| 1131 | cache->vaddr = 0; | ||
| 1132 | cache->page = -1; | ||
| 1133 | } | ||
| 1134 | |||
| 1135 | static void *reloc_kmap(struct drm_i915_gem_object *obj, | ||
| 1136 | struct reloc_cache *cache, | ||
| 1137 | unsigned long page) | ||
| 1138 | { | ||
| 1139 | void *vaddr; | ||
| 1140 | |||
| 1141 | if (cache->vaddr) { | ||
| 1142 | kunmap_atomic(unmask_page(cache->vaddr)); | ||
| 1143 | } else { | ||
| 1144 | unsigned int flushes; | ||
| 1145 | int err; | ||
| 1146 | |||
| 1147 | err = i915_gem_object_prepare_write(obj, &flushes); | ||
| 1148 | if (err) | ||
| 1149 | return ERR_PTR(err); | ||
| 1150 | |||
| 1151 | BUILD_BUG_ON(KMAP & CLFLUSH_FLAGS); | ||
| 1152 | BUILD_BUG_ON((KMAP | CLFLUSH_FLAGS) & PAGE_MASK); | ||
| 1153 | |||
| 1154 | cache->vaddr = flushes | KMAP; | ||
| 1155 | cache->node.mm = (void *)obj; | ||
| 1156 | if (flushes) | ||
| 1157 | mb(); | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | vaddr = kmap_atomic(i915_gem_object_get_dirty_page(obj, page)); | ||
| 1161 | cache->vaddr = unmask_flags(cache->vaddr) | (unsigned long)vaddr; | ||
| 1162 | cache->page = page; | ||
| 1163 | |||
| 1164 | return vaddr; | ||
| 1165 | } | ||
| 1166 | |||
| 1167 | static void *reloc_iomap(struct drm_i915_gem_object *obj, | ||
| 1168 | struct reloc_cache *cache, | ||
| 1169 | unsigned long page) | ||
| 1170 | { | ||
| 1171 | struct i915_ggtt *ggtt = cache_to_ggtt(cache); | ||
| 1172 | unsigned long offset; | ||
| 1173 | void *vaddr; | ||
| 1174 | |||
| 1175 | if (cache->vaddr) { | ||
| 1176 | intel_gt_flush_ggtt_writes(ggtt->vm.gt); | ||
| 1177 | io_mapping_unmap_atomic((void __force __iomem *) unmask_page(cache->vaddr)); | ||
| 1178 | } else { | ||
| 1179 | struct i915_vma *vma; | ||
| 1180 | int err; | ||
| 1181 | |||
| 1182 | if (i915_gem_object_is_tiled(obj)) | ||
| 1183 | return ERR_PTR(-EINVAL); | ||
| 1184 | |||
| 1185 | if (use_cpu_reloc(cache, obj)) | ||
| 1186 | return NULL; | ||
| 1187 | |||
| 1188 | i915_gem_object_lock(obj); | ||
| 1189 | err = i915_gem_object_set_to_gtt_domain(obj, true); | ||
| 1190 | i915_gem_object_unlock(obj); | ||
| 1191 | if (err) | ||
| 1192 | return ERR_PTR(err); | ||
| 1193 | |||
| 1194 | vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, | ||
| 1195 | PIN_MAPPABLE | | ||
| 1196 | PIN_NONBLOCK /* NOWARN */ | | ||
| 1197 | PIN_NOEVICT); | ||
| 1198 | if (IS_ERR(vma)) { | ||
| 1199 | memset(&cache->node, 0, sizeof(cache->node)); | ||
| 1200 | mutex_lock(&ggtt->vm.mutex); | ||
| 1201 | err = drm_mm_insert_node_in_range | ||
| 1202 | (&ggtt->vm.mm, &cache->node, | ||
| 1203 | PAGE_SIZE, 0, I915_COLOR_UNEVICTABLE, | ||
| 1204 | 0, ggtt->mappable_end, | ||
| 1205 | DRM_MM_INSERT_LOW); | ||
| 1206 | mutex_unlock(&ggtt->vm.mutex); | ||
| 1207 | if (err) /* no inactive aperture space, use cpu reloc */ | ||
| 1208 | return NULL; | ||
| 1209 | } else { | ||
| 1210 | cache->node.start = vma->node.start; | ||
| 1211 | cache->node.mm = (void *)vma; | ||
| 1212 | } | ||
| 1213 | } | ||
| 1214 | |||
| 1215 | offset = cache->node.start; | ||
| 1216 | if (drm_mm_node_allocated(&cache->node)) { | ||
| 1217 | ggtt->vm.insert_page(&ggtt->vm, | ||
| 1218 | i915_gem_object_get_dma_address(obj, page), | ||
| 1219 | offset, I915_CACHE_NONE, 0); | ||
| 1220 | } else { | ||
| 1221 | offset += page << PAGE_SHIFT; | ||
| 1222 | } | ||
| 1223 | |||
| 1224 | vaddr = (void __force *)io_mapping_map_atomic_wc(&ggtt->iomap, | ||
| 1225 | offset); | ||
| 1226 | cache->page = page; | ||
| 1227 | cache->vaddr = (unsigned long)vaddr; | ||
| 1228 | |||
| 1229 | return vaddr; | ||
| 1230 | } | ||
| 1231 | |||
| 1232 | static void *reloc_vaddr(struct drm_i915_gem_object *obj, | ||
| 1233 | struct reloc_cache *cache, | ||
| 1234 | unsigned long page) | ||
| 1235 | { | ||
| 1236 | void *vaddr; | ||
| 1237 | |||
| 1238 | if (cache->page == page) { | ||
| 1239 | vaddr = unmask_page(cache->vaddr); | ||
| 1240 | } else { | ||
| 1241 | vaddr = NULL; | ||
| 1242 | if ((cache->vaddr & KMAP) == 0) | ||
| 1243 | vaddr = reloc_iomap(obj, cache, page); | ||
| 1244 | if (!vaddr) | ||
| 1245 | vaddr = reloc_kmap(obj, cache, page); | ||
| 1246 | } | ||
| 1247 | |||
| 1248 | return vaddr; | ||
| 1249 | } | ||
| 1250 | |||
| 1251 | static void clflush_write32(u32 *addr, u32 value, unsigned int flushes) | ||
| 1252 | { | ||
| 1253 | if (unlikely(flushes & (CLFLUSH_BEFORE | CLFLUSH_AFTER))) { | ||
| 1254 | if (flushes & CLFLUSH_BEFORE) { | ||
| 1255 | clflushopt(addr); | ||
| 1256 | mb(); | ||
| 1257 | } | ||
| 1258 | |||
| 1259 | *addr = value; | ||
| 1260 | |||
| 1261 | /* | ||
| 1262 | * Writes to the same cacheline are serialised by the CPU | ||
| 1263 | * (including clflush). On the write path, we only require | ||
| 1264 | * that it hits memory in an orderly fashion and place | ||
| 1265 | * mb barriers at the start and end of the relocation phase | ||
| 1266 | * to ensure ordering of clflush wrt to the system. | ||
| 1267 | */ | ||
| 1268 | if (flushes & CLFLUSH_AFTER) | ||
| 1269 | clflushopt(addr); | ||
| 1270 | } else | ||
| 1271 | *addr = value; | ||
| 1272 | } | ||
| 1273 | |||
| 1052 | static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma) | 1274 | static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma) |
| 1053 | { | 1275 | { |
| 1054 | struct drm_i915_gem_object *obj = vma->obj; | 1276 | struct drm_i915_gem_object *obj = vma->obj; |
| @@ -1214,6 +1436,17 @@ static u32 *reloc_gpu(struct i915_execbuffer *eb, · 159 unmodified lines | |||
| 1214 | return cmd; | 1436 | return cmd; |
| 1215 | } | 1437 | } |
| 1216 | 1438 | ||
| 1439 | static inline bool use_reloc_gpu(struct i915_vma *vma) | ||
| 1440 | { | ||
| 1441 | if (DBG_FORCE_RELOC == FORCE_GPU_RELOC) | ||
| 1442 | return true; | ||
| 1443 | |||
| 1444 | if (DBG_FORCE_RELOC) | ||
| 1445 | return false; | ||
| 1446 | |||
| 1447 | return !dma_resv_test_signaled_rcu(vma->resv, true); | ||
| 1448 | } | ||
| 1449 | |||
| 1217 | static unsigned long vma_phys_addr(struct i915_vma *vma, u32 offset) | 1450 | static unsigned long vma_phys_addr(struct i915_vma *vma, u32 offset) |
| 1218 | { | 1451 | { |
| 1219 | struct page *page; | 1452 | struct page *page; |
| @@ -1228,10 +1461,10 @@ static unsigned long vma_phys_addr(struct i915_vma *vma, u32 offset) · 8 unmodified lines | |||
| 1228 | return addr + offset_in_page(offset); | 1461 | return addr + offset_in_page(offset); |
| 1229 | } | 1462 | } |
| 1230 | 1463 | ||
| 1231 | static int __reloc_entry_gpu(struct i915_execbuffer *eb, | 1464 | static bool __reloc_entry_gpu(struct i915_execbuffer *eb, |
| 1232 | struct i915_vma *vma, | 1465 | struct i915_vma *vma, |
| 1233 | u64 offset, | 1466 | u64 offset, |
| 1234 | u64 target_addr) | 1467 | u64 target_addr) |
| 1235 | { | 1468 | { |
| 1236 | const unsigned int gen = eb->reloc_cache.gen; | 1469 | const unsigned int gen = eb->reloc_cache.gen; |
| 1237 | unsigned int len; | 1470 | unsigned int len; |
| @@ -1247,7 +1480,7 @@ static int __reloc_entry_gpu(struct i915_execbuffer *eb, · 9 unmodified lines | |||
| 1247 | 1480 | ||
| 1248 | batch = reloc_gpu(eb, vma, len); | 1481 | batch = reloc_gpu(eb, vma, len); |
| 1249 | if (IS_ERR(batch)) | 1482 | if (IS_ERR(batch)) |
| 1250 | return PTR_ERR(batch); | 1483 | return false; |
| 1251 | 1484 | ||
| 1252 | addr = gen8_canonical_addr(vma->node.start + offset); | 1485 | addr = gen8_canonical_addr(vma->node.start + offset); |
| 1253 | if (gen >= 8) { | 1486 | if (gen >= 8) { |
| @@ -1296,21 +1529,55 @@ static int __reloc_entry_gpu(struct i915_execbuffer *eb, · 42 unmodified lines | |||
| 1296 | *batch++ = target_addr; | 1529 | *batch++ = target_addr; |
| 1297 | } | 1530 | } |
| 1298 | 1531 | ||
| 1299 | return 0; | 1532 | return true; |
| 1533 | } | ||
| 1534 | |||
| 1535 | static bool reloc_entry_gpu(struct i915_execbuffer *eb, | ||
| 1536 | struct i915_vma *vma, | ||
| 1537 | u64 offset, | ||
| 1538 | u64 target_addr) | ||
| 1539 | { | ||
| 1540 | if (eb->reloc_cache.vaddr) | ||
| 1541 | return false; | ||
| 1542 | |||
| 1543 | if (!use_reloc_gpu(vma)) | ||
| 1544 | return false; | ||
| 1545 | |||
| 1546 | return __reloc_entry_gpu(eb, vma, offset, target_addr); | ||
| 1300 | } | 1547 | } |
| 1301 | 1548 | ||
| 1302 | static u64 | 1549 | static u64 |
| 1303 | relocate_entry(struct i915_execbuffer *eb, | 1550 | relocate_entry(struct i915_vma *vma, |
| 1304 | struct i915_vma *vma, | ||
| 1305 | const struct drm_i915_gem_relocation_entry *reloc, | 1551 | const struct drm_i915_gem_relocation_entry *reloc, |
| 1552 | struct i915_execbuffer *eb, | ||
| 1306 | const struct i915_vma *target) | 1553 | const struct i915_vma *target) |
| 1307 | { | 1554 | { |
| 1308 | u64 target_addr = relocation_target(reloc, target); | 1555 | u64 target_addr = relocation_target(reloc, target); |
| 1309 | int err; | 1556 | u64 offset = reloc->offset; |
| 1310 | 1557 | ||
| 1311 | err = __reloc_entry_gpu(eb, vma, reloc->offset, target_addr); | 1558 | if (!reloc_entry_gpu(eb, vma, offset, target_addr)) { |
| 1312 | if (err) | 1559 | bool wide = eb->reloc_cache.use_64bit_reloc; |
| 1313 | return err; | 1560 | void *vaddr; |
| 1561 | |||
| 1562 | repeat: | ||
| 1563 | vaddr = reloc_vaddr(vma->obj, | ||
| 1564 | &eb->reloc_cache, | ||
| 1565 | offset >> PAGE_SHIFT); | ||
| 1566 | if (IS_ERR(vaddr)) | ||
| 1567 | return PTR_ERR(vaddr); | ||
| 1568 | |||
| 1569 | GEM_BUG_ON(!IS_ALIGNED(offset, sizeof(u32))); | ||
| 1570 | clflush_write32(vaddr + offset_in_page(offset), | ||
| 1571 | lower_32_bits(target_addr), | ||
| 1572 | eb->reloc_cache.vaddr); | ||
| 1573 | |||
| 1574 | if (wide) { | ||
| 1575 | offset += sizeof(u32); | ||
| 1576 | target_addr >>= 32; | ||
| 1577 | wide = false; | ||
| 1578 | goto repeat; | ||
| 1579 | } | ||
| 1580 | } | ||
| 1314 | 1581 | ||
| 1315 | return target->node.start | UPDATE; | 1582 | return target->node.start | UPDATE; |
| 1316 | } | 1583 | } |
| @@ -1375,7 +1642,8 @@ eb_relocate_entry(struct i915_execbuffer *eb, · 58 unmodified lines | |||
| 1375 | * If the relocation already has the right value in it, no | 1642 | * If the relocation already has the right value in it, no |
| 1376 | * more work needs to be done. | 1643 | * more work needs to be done. |
| 1377 | */ | 1644 | */ |
| 1378 | if (gen8_canonical_addr(target->vma->node.start) == reloc->presumed_offset) | 1645 | if (!DBG_FORCE_RELOC && |
| 1646 | gen8_canonical_addr(target->vma->node.start) == reloc->presumed_offset) | ||
| 1379 | return 0; | 1647 | return 0; |
| 1380 | 1648 | ||
| 1381 | /* Check that the relocation address is valid... */ | 1649 | /* Check that the relocation address is valid... */ |
| @@ -1407,7 +1675,7 @@ eb_relocate_entry(struct i915_execbuffer *eb, · 25 unmodified lines | |||
| 1407 | ev->flags &= ~EXEC_OBJECT_ASYNC; | 1675 | ev->flags &= ~EXEC_OBJECT_ASYNC; |
| 1408 | 1676 | ||
| 1409 | /* and update the user's relocation entry */ | 1677 | /* and update the user's relocation entry */ |
| 1410 | return relocate_entry(eb, ev->vma, reloc, target->vma); | 1678 | return relocate_entry(ev->vma, reloc, eb, target->vma); |
| 1411 | } | 1679 | } |
| 1412 | 1680 | ||
| 1413 | static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev) | 1681 | static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev) |
| @@ -1445,8 +1713,10 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev) · 31 unmodified lines | |||
| 1445 | * this is bad and so lockdep complains vehemently. | 1713 | * this is bad and so lockdep complains vehemently. |
| 1446 | */ | 1714 | */ |
| 1447 | copied = __copy_from_user(r, urelocs, count * sizeof(r[0])); | 1715 | copied = __copy_from_user(r, urelocs, count * sizeof(r[0])); |
| 1448 | if (unlikely(copied)) | 1716 | if (unlikely(copied)) { |
| 1449 | return -EFAULT; | 1717 | remain = -EFAULT; |
| 1718 | goto out; | ||
| 1719 | } | ||
| 1450 | 1720 | ||
| 1451 | remain -= count; | 1721 | remain -= count; |
| 1452 | do { | 1722 | do { |
| @@ -1454,7 +1724,8 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev) · 1 unmodified line | |||
| 1454 | 1724 | ||
| 1455 | if (likely(offset == 0)) { | 1725 | if (likely(offset == 0)) { |
| 1456 | } else if ((s64)offset < 0) { | 1726 | } else if ((s64)offset < 0) { |
| 1457 | return (int)offset; | 1727 | remain = (int)offset; |
| 1728 | goto out; | ||
| 1458 | } else { | 1729 | } else { |
| 1459 | /* | 1730 | /* |
| 1460 | * Note that reporting an error now | 1731 | * Note that reporting an error now |
| @@ -1484,8 +1755,9 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev) · 23 unmodified lines | |||
| 1484 | } while (r++, --count); | 1755 | } while (r++, --count); |
| 1485 | urelocs += ARRAY_SIZE(stack); | 1756 | urelocs += ARRAY_SIZE(stack); |
| 1486 | } while (remain); | 1757 | } while (remain); |
| 1487 | 1758 | out: | |
| 1488 | return 0; | 1759 | reloc_cache_reset(&eb->reloc_cache); |
| 1760 | return remain; | ||
| 1489 | } | 1761 | } |
| 1490 | 1762 | ||
| 1491 | static int eb_relocate(struct i915_execbuffer *eb) | 1763 | static int eb_relocate(struct i915_execbuffer *eb) |
| @@ -2392,7 +2664,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, · 900 unmodified lines | |||
| 2392 | eb.i915 = i915; | 2664 | eb.i915 = i915; |
| 2393 | eb.file = file; | 2665 | eb.file = file; |
| 2394 | eb.args = args; | 2666 | eb.args = args; |
| 2395 | if (!(args->flags & I915_EXEC_NO_RELOC)) | 2667 | if (DBG_FORCE_RELOC || !(args->flags & I915_EXEC_NO_RELOC)) |
| 2396 | args->flags |= __EXEC_HAS_RELOC; | 2668 | args->flags |= __EXEC_HAS_RELOC; |
| 2397 | 2669 | ||
| 2398 | eb.exec = exec; | 2670 | eb.exec = exec; |
| @@ -258,6 +258,10 @@ struct page * · 257 unmodified lines | |||
| 258 | i915_gem_object_get_page(struct drm_i915_gem_object *obj, | 258 | i915_gem_object_get_page(struct drm_i915_gem_object *obj, |
| 259 | unsigned int n); | 259 | unsigned int n); |
| 260 | 260 | ||
| 261 | struct page * | ||
| 262 | i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, | ||
| 263 | unsigned int n); | ||
| 264 | |||
| 261 | dma_addr_t | 265 | dma_addr_t |
| 262 | i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj, | 266 | i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj, |
| 263 | unsigned long n, | 267 | unsigned long n, |
| @@ -548,6 +548,20 @@ i915_gem_object_get_page(struct drm_i915_gem_object *obj, unsigned int n) · 547 unmodified lines | |||
| 548 | return nth_page(sg_page(sg), offset); | 548 | return nth_page(sg_page(sg), offset); |
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | /* Like i915_gem_object_get_page(), but mark the returned page dirty */ | ||
| 552 | struct page * | ||
| 553 | i915_gem_object_get_dirty_page(struct drm_i915_gem_object *obj, | ||
| 554 | unsigned int n) | ||
| 555 | { | ||
| 556 | struct page *page; | ||
| 557 | |||
| 558 | page = i915_gem_object_get_page(obj, n); | ||
| 559 | if (!obj->mm.dirty) | ||
| 560 | set_page_dirty(page); | ||
| 561 | |||
| 562 | return page; | ||
| 563 | } | ||
| 564 | |||
| 551 | dma_addr_t | 565 | dma_addr_t |
| 552 | i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj, | 566 | i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj, |
| 553 | unsigned long n, | 567 | unsigned long n, |
| @@ -596,14 +596,6 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) · 595 unmodified lines | |||
| 596 | GFP_KERNEL | | 596 | GFP_KERNEL | |
| 597 | __GFP_NORETRY | | 597 | __GFP_NORETRY | |
| 598 | __GFP_NOWARN); | 598 | __GFP_NOWARN); |
| 599 | /* | ||
| 600 | * Using __get_user_pages_fast() with a read-only | ||
| 601 | * access is questionable. A read-only page may be | ||
| 602 | * COW-broken, and then this might end up giving | ||
| 603 | * the wrong side of the COW.. | ||
| 604 | * | ||
| 605 | * We may or may not care. | ||
| 606 | */ | ||
| 607 | if (pvec) { | 599 | if (pvec) { |
| 608 | /* defer to worker if malloc fails */ | 600 | /* defer to worker if malloc fails */ |
| 609 | if (!i915_gem_object_is_readonly(obj)) | 601 | if (!i915_gem_object_is_readonly(obj)) |
| @@ -37,14 +37,20 @@ static int __igt_gpu_reloc(struct i915_execbuffer *eb, · 36 unmodified lines | |||
| 37 | return err; | 37 | return err; |
| 38 | 38 | ||
| 39 | /* 8-Byte aligned */ | 39 | /* 8-Byte aligned */ |
| 40 | err = __reloc_entry_gpu(eb, vma, offsets[0] * sizeof(u32), 0); | 40 | if (!__reloc_entry_gpu(eb, vma, |
| 41 | if (err) | 41 | offsets[0] * sizeof(u32), |
| 42 | 0)) { | ||
| 43 | err = -EIO; | ||
| 42 | goto unpin_vma; | 44 | goto unpin_vma; |
| 45 | } | ||
| 43 | 46 | ||
| 44 | /* !8-Byte aligned */ | 47 | /* !8-Byte aligned */ |
| 45 | err = __reloc_entry_gpu(eb, vma, offsets[1] * sizeof(u32), 1); | 48 | if (!__reloc_entry_gpu(eb, vma, |
| 46 | if (err) | 49 | offsets[1] * sizeof(u32), |
| 50 | 1)) { | ||
| 51 | err = -EIO; | ||
| 47 | goto unpin_vma; | 52 | goto unpin_vma; |
| 53 | } | ||
| 48 | 54 | ||
| 49 | /* Skip to the end of the cmd page */ | 55 | /* Skip to the end of the cmd page */ |
| 50 | i = PAGE_SIZE / sizeof(u32) - RELOC_TAIL - 1; | 56 | i = PAGE_SIZE / sizeof(u32) - RELOC_TAIL - 1; |
| @@ -54,9 +60,12 @@ static int __igt_gpu_reloc(struct i915_execbuffer *eb, · 3 unmodified lines | |||
| 54 | eb->reloc_cache.rq_size += i; | 60 | eb->reloc_cache.rq_size += i; |
| 55 | 61 | ||
| 56 | /* Force batch chaining */ | 62 | /* Force batch chaining */ |
| 57 | err = __reloc_entry_gpu(eb, vma, offsets[2] * sizeof(u32), 2); | 63 | if (!__reloc_entry_gpu(eb, vma, |
| 58 | if (err) | 64 | offsets[2] * sizeof(u32), |
| 65 | 2)) { | ||
| 66 | err = -EIO; | ||
| 59 | goto unpin_vma; | 67 | goto unpin_vma; |
| 68 | } | ||
| 60 | 69 | ||
| 61 | GEM_BUG_ON(!eb->reloc_cache.rq); | 70 | GEM_BUG_ON(!eb->reloc_cache.rq); |
| 62 | rq = i915_request_get(eb->reloc_cache.rq); | 71 | rq = i915_request_get(eb->reloc_cache.rq); |
| @@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d) · 672 unmodified lines | |||
| 673 | component_unbind_all(priv->dev, &priv->drm); | 673 | component_unbind_all(priv->dev, &priv->drm); |
| 674 | } | 674 | } |
| 675 | 675 | ||
| 676 | static int ingenic_drm_bind(struct device *dev) | 676 | static int ingenic_drm_bind(struct device *dev, bool has_components) |
| 677 | { | 677 | { |
| 678 | struct platform_device *pdev = to_platform_device(dev); | 678 | struct platform_device *pdev = to_platform_device(dev); |
| 679 | const struct jz_soc_info *soc_info; | 679 | const struct jz_soc_info *soc_info; |
| @@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev) · 128 unmodified lines | |||
| 808 | return ret; | 808 | return ret; |
| 809 | } | 809 | } |
| 810 | 810 | ||
| 811 | if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) { | 811 | if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) { |
| 812 | ret = component_bind_all(dev, drm); | 812 | ret = component_bind_all(dev, drm); |
| 813 | if (ret) { | 813 | if (ret) { |
| 814 | if (ret != -EPROBE_DEFER) | 814 | if (ret != -EPROBE_DEFER) |
| @@ -939,6 +939,11 @@ err_pixclk_disable: · 124 unmodified lines | |||
| 939 | return ret; | 939 | return ret; |
| 940 | } | 940 | } |
| 941 | 941 | ||
| 942 | static int ingenic_drm_bind_with_components(struct device *dev) | ||
| 943 | { | ||
| 944 | return ingenic_drm_bind(dev, true); | ||
| 945 | } | ||
| 946 | |||
| 942 | static int compare_of(struct device *dev, void *data) | 947 | static int compare_of(struct device *dev, void *data) |
| 943 | { | 948 | { |
| 944 | return dev->of_node == data; | 949 | return dev->of_node == data; |
| @@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device *dev) · 12 unmodified lines | |||
| 957 | } | 962 | } |
| 958 | 963 | ||
| 959 | static const struct component_master_ops ingenic_master_ops = { | 964 | static const struct component_master_ops ingenic_master_ops = { |
| 960 | .bind = ingenic_drm_bind, | 965 | .bind = ingenic_drm_bind_with_components, |
| 961 | .unbind = ingenic_drm_unbind, | 966 | .unbind = ingenic_drm_unbind, |
| 962 | }; | 967 | }; |
| 963 | 968 | ||
| @@ -968,16 +973,15 @@ static int ingenic_drm_probe(struct platform_device *pdev) · 4 unmodified lines | |||
| 968 | struct device_node *np; | 973 | struct device_node *np; |
| 969 | 974 | ||
| 970 | if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) | 975 | if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) |
| 971 | return ingenic_drm_bind(dev); | 976 | return ingenic_drm_bind(dev, false); |
| 972 | 977 | ||
| 973 | /* IPU is at port address 8 */ | 978 | /* IPU is at port address 8 */ |
| 974 | np = of_graph_get_remote_node(dev->of_node, 8, 0); | 979 | np = of_graph_get_remote_node(dev->of_node, 8, 0); |
| 975 | if (!np) { | 980 | if (!np) |
| 976 | dev_err(dev, "Unable to get IPU node\n"); | 981 | return ingenic_drm_bind(dev, false); |
| 977 | return -EINVAL; | ||
| 978 | } | ||
| 979 | 982 | ||
| 980 | drm_of_component_match_add(dev, &match, compare_of, np); | 983 | drm_of_component_match_add(dev, &match, compare_of, np); |
| 984 | of_node_put(np); | ||
| 981 | 985 | ||
| 982 | return component_master_add_with_match(dev, &ingenic_master_ops, match); | 986 | return component_master_add_with_match(dev, &ingenic_master_ops, match); |
| 983 | } | 987 | } |
| @@ -164,6 +164,11 @@ static int a2xx_hw_init(struct msm_gpu *gpu) · 163 unmodified lines | |||
| 164 | if (ret) | 164 | if (ret) |
| 165 | return ret; | 165 | return ret; |
| 166 | 166 | ||
| 167 | gpu_write(gpu, REG_AXXX_CP_RB_CNTL, | ||
| 168 | MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); | ||
| 169 | |||
| 170 | gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova)); | ||
| 171 | |||
| 167 | /* NOTE: PM4/micro-engine firmware registers look to be the same | 172 | /* NOTE: PM4/micro-engine firmware registers look to be the same |
| 168 | * for a2xx and a3xx.. we could possibly push that part down to | 173 | * for a2xx and a3xx.. we could possibly push that part down to |
| 169 | * adreno_gpu base class. Or push both PM4 and PFP but | 174 | * adreno_gpu base class. Or push both PM4 and PFP but |
| @@ -211,6 +211,16 @@ static int a3xx_hw_init(struct msm_gpu *gpu) · 210 unmodified lines | |||
| 211 | if (ret) | 211 | if (ret) |
| 212 | return ret; | 212 | return ret; |
| 213 | 213 | ||
| 214 | /* | ||
| 215 | * Use the default ringbuffer size and block size but disable the RPTR | ||
| 216 | * shadow | ||
| 217 | */ | ||
| 218 | gpu_write(gpu, REG_AXXX_CP_RB_CNTL, | ||
| 219 | MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); | ||
| 220 | |||
| 221 | /* Set the ringbuffer address */ | ||
| 222 | gpu_write(gpu, REG_AXXX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova)); | ||
| 223 | |||
| 214 | /* setup access protection: */ | 224 | /* setup access protection: */ |
| 215 | gpu_write(gpu, REG_A3XX_CP_PROTECT_CTRL, 0x00000007); | 225 | gpu_write(gpu, REG_A3XX_CP_PROTECT_CTRL, 0x00000007); |
| 216 | 226 | ||
| @@ -267,6 +267,16 @@ static int a4xx_hw_init(struct msm_gpu *gpu) · 266 unmodified lines | |||
| 267 | if (ret) | 267 | if (ret) |
| 268 | return ret; | 268 | return ret; |
| 269 | 269 | ||
| 270 | /* | ||
| 271 | * Use the default ringbuffer size and block size but disable the RPTR | ||
| 272 | * shadow | ||
| 273 | */ | ||
| 274 | gpu_write(gpu, REG_A4XX_CP_RB_CNTL, | ||
| 275 | MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); | ||
| 276 | |||
| 277 | /* Set the ringbuffer address */ | ||
| 278 | gpu_write(gpu, REG_A4XX_CP_RB_BASE, lower_32_bits(gpu->rb[0]->iova)); | ||
| 279 | |||
| 270 | /* Load PM4: */ | 280 | /* Load PM4: */ |
| 271 | ptr = (uint32_t *)(adreno_gpu->fw[ADRENO_FW_PM4]->data); | 281 | ptr = (uint32_t *)(adreno_gpu->fw[ADRENO_FW_PM4]->data); |
| 272 | len = adreno_gpu->fw[ADRENO_FW_PM4]->size / 4; | 282 | len = adreno_gpu->fw[ADRENO_FW_PM4]->size / 4; |
| @@ -703,8 +703,6 @@ static int a5xx_hw_init(struct msm_gpu *gpu) · 702 unmodified lines | |||
| 703 | if (ret) | 703 | if (ret) |
| 704 | return ret; | 704 | return ret; |
| 705 | 705 | ||
| 706 | a5xx_preempt_hw_init(gpu); | ||
| 707 | |||
| 708 | if (!adreno_is_a510(adreno_gpu)) | 706 | if (!adreno_is_a510(adreno_gpu)) |
| 709 | a5xx_gpmu_ucode_init(gpu); | 707 | a5xx_gpmu_ucode_init(gpu); |
| 710 | 708 | ||
| @@ -712,6 +710,15 @@ static int a5xx_hw_init(struct msm_gpu *gpu) · 1 unmodified line | |||
| 712 | if (ret) | 710 | if (ret) |
| 713 | return ret; | 711 | return ret; |
| 714 | 712 | ||
| 713 | /* Set the ringbuffer address */ | ||
| 714 | gpu_write64(gpu, REG_A5XX_CP_RB_BASE, REG_A5XX_CP_RB_BASE_HI, | ||
| 715 | gpu->rb[0]->iova); | ||
| 716 | |||
| 717 | gpu_write(gpu, REG_A5XX_CP_RB_CNTL, | ||
| 718 | MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); | ||
| 719 | |||
| 720 | a5xx_preempt_hw_init(gpu); | ||
| 721 | |||
| 715 | /* Disable the interrupts through the initial bringup stage */ | 722 | /* Disable the interrupts through the initial bringup stage */ |
| 716 | gpu_write(gpu, REG_A5XX_RBBM_INT_0_MASK, A5XX_INT_MASK); | 723 | gpu_write(gpu, REG_A5XX_RBBM_INT_0_MASK, A5XX_INT_MASK); |
| 717 | 724 | ||
| @@ -1511,7 +1518,8 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev) · 793 unmodified lines | |||
| 1511 | 1518 | ||
| 1512 | check_speed_bin(&pdev->dev); | 1519 | check_speed_bin(&pdev->dev); |
| 1513 | 1520 | ||
| 1514 | ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 4); | 1521 | /* Restricting nr_rings to 1 to temporarily disable preemption */ |
| 1522 | ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1); | ||
| 1515 | if (ret) { | 1523 | if (ret) { |
| 1516 | a5xx_destroy(&(a5xx_gpu->base.base)); | 1524 | a5xx_destroy(&(a5xx_gpu->base.base)); |
| 1517 | return ERR_PTR(ret); | 1525 | return ERR_PTR(ret); |
| @@ -31,6 +31,7 @@ struct a5xx_gpu { · 30 unmodified lines | |||
| 31 | struct msm_ringbuffer *next_ring; | 31 | struct msm_ringbuffer *next_ring; |
| 32 | 32 | ||
| 33 | struct drm_gem_object *preempt_bo[MSM_GPU_MAX_RINGS]; | 33 | struct drm_gem_object *preempt_bo[MSM_GPU_MAX_RINGS]; |
| 34 | struct drm_gem_object *preempt_counters_bo[MSM_GPU_MAX_RINGS]; | ||
| 34 | struct a5xx_preempt_record *preempt[MSM_GPU_MAX_RINGS]; | 35 | struct a5xx_preempt_record *preempt[MSM_GPU_MAX_RINGS]; |
| 35 | uint64_t preempt_iova[MSM_GPU_MAX_RINGS]; | 36 | uint64_t preempt_iova[MSM_GPU_MAX_RINGS]; |
| 36 | 37 | ||
| @@ -226,19 +226,31 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu, · 225 unmodified lines | |||
| 226 | struct adreno_gpu *adreno_gpu = &a5xx_gpu->base; | 226 | struct adreno_gpu *adreno_gpu = &a5xx_gpu->base; |
| 227 | struct msm_gpu *gpu = &adreno_gpu->base; | 227 | struct msm_gpu *gpu = &adreno_gpu->base; |
| 228 | struct a5xx_preempt_record *ptr; | 228 | struct a5xx_preempt_record *ptr; |
| 229 | struct drm_gem_object *bo = NULL; | 229 | void *counters; |
| 230 | u64 iova = 0; | 230 | struct drm_gem_object *bo = NULL, *counters_bo = NULL; |
| 231 | u64 iova = 0, counters_iova = 0; | ||
| 231 | 232 | ||
| 232 | ptr = msm_gem_kernel_new(gpu->dev, | 233 | ptr = msm_gem_kernel_new(gpu->dev, |
| 233 | A5XX_PREEMPT_RECORD_SIZE + A5XX_PREEMPT_COUNTER_SIZE, | 234 | A5XX_PREEMPT_RECORD_SIZE + A5XX_PREEMPT_COUNTER_SIZE, |
| 234 | MSM_BO_UNCACHED, gpu->aspace, &bo, &iova); | 235 | MSM_BO_UNCACHED | MSM_BO_MAP_PRIV, gpu->aspace, &bo, &iova); |
| 235 | 236 | ||
| 236 | if (IS_ERR(ptr)) | 237 | if (IS_ERR(ptr)) |
| 237 | return PTR_ERR(ptr); | 238 | return PTR_ERR(ptr); |
| 238 | 239 | ||
| 240 | /* The buffer to store counters needs to be unprivileged */ | ||
| 241 | counters = msm_gem_kernel_new(gpu->dev, | ||
| 242 | A5XX_PREEMPT_COUNTER_SIZE, | ||
| 243 | MSM_BO_UNCACHED, gpu->aspace, &counters_bo, &counters_iova); | ||
| 244 | if (IS_ERR(counters)) { | ||
| 245 | msm_gem_kernel_put(bo, gpu->aspace, true); | ||
| 246 | return PTR_ERR(counters); | ||
| 247 | } | ||
| 248 | |||
| 239 | msm_gem_object_set_name(bo, "preempt"); | 249 | msm_gem_object_set_name(bo, "preempt"); |
| 250 | msm_gem_object_set_name(counters_bo, "preempt_counters"); | ||
| 240 | 251 | ||
| 241 | a5xx_gpu->preempt_bo[ring->id] = bo; | 252 | a5xx_gpu->preempt_bo[ring->id] = bo; |
| 253 | a5xx_gpu->preempt_counters_bo[ring->id] = counters_bo; | ||
| 242 | a5xx_gpu->preempt_iova[ring->id] = iova; | 254 | a5xx_gpu->preempt_iova[ring->id] = iova; |
| 243 | a5xx_gpu->preempt[ring->id] = ptr; | 255 | a5xx_gpu->preempt[ring->id] = ptr; |
| 244 | 256 | ||
| @@ -249,7 +261,7 @@ static int preempt_init_ring(struct a5xx_gpu *a5xx_gpu, · 4 unmodified lines | |||
| 249 | ptr->data = 0; | 261 | ptr->data = 0; |
| 250 | ptr->cntl = MSM_GPU_RB_CNTL_DEFAULT; | 262 | ptr->cntl = MSM_GPU_RB_CNTL_DEFAULT; |
| 251 | ptr->rptr_addr = rbmemptr(ring, rptr); | 263 | ptr->rptr_addr = rbmemptr(ring, rptr); |
| 252 | ptr->counter = iova + A5XX_PREEMPT_RECORD_SIZE; | 264 | ptr->counter = counters_iova; |
| 253 | 265 | ||
| 254 | return 0; | 266 | return 0; |
| 255 | } | 267 | } |
| @@ -260,8 +272,11 @@ void a5xx_preempt_fini(struct msm_gpu *gpu) · 4 unmodified lines | |||
| 260 | struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); | 272 | struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); |
| 261 | int i; | 273 | int i; |
| 262 | 274 | ||
| 263 | for (i = 0; i < gpu->nr_rings; i++) | 275 | for (i = 0; i < gpu->nr_rings; i++) { |
| 264 | msm_gem_kernel_put(a5xx_gpu->preempt_bo[i], gpu->aspace, true); | 276 | msm_gem_kernel_put(a5xx_gpu->preempt_bo[i], gpu->aspace, true); |
| 277 | msm_gem_kernel_put(a5xx_gpu->preempt_counters_bo[i], | ||
| 278 | gpu->aspace, true); | ||
| 279 | } | ||
| 265 | } | 280 | } |
| 266 | 281 | ||
| 267 | void a5xx_preempt_init(struct msm_gpu *gpu) | 282 | void a5xx_preempt_init(struct msm_gpu *gpu) |
| @@ -678,7 +678,8 @@ static int a6xx_hw_init(struct msm_gpu *gpu) · 677 unmodified lines | |||
| 678 | A6XX_PROTECT_RDONLY(0x980, 0x4)); | 678 | A6XX_PROTECT_RDONLY(0x980, 0x4)); |
| 679 | gpu_write(gpu, REG_A6XX_CP_PROTECT(25), A6XX_PROTECT_RW(0xa630, 0x0)); | 679 | gpu_write(gpu, REG_A6XX_CP_PROTECT(25), A6XX_PROTECT_RW(0xa630, 0x0)); |
| 680 | 680 | ||
| 681 | if (adreno_is_a650(adreno_gpu)) { | 681 | /* Enable expanded apriv for targets that support it */ |
| 682 | if (gpu->hw_apriv) { | ||
| 682 | gpu_write(gpu, REG_A6XX_CP_APRIV_CNTL, | 683 | gpu_write(gpu, REG_A6XX_CP_APRIV_CNTL, |
| 683 | (1 << 6) | (1 << 5) | (1 << 3) | (1 << 2) | (1 << 1)); | 684 | (1 << 6) | (1 << 5) | (1 << 3) | (1 << 2) | (1 << 1)); |
| 684 | } | 685 | } |
| @@ -694,6 +695,13 @@ static int a6xx_hw_init(struct msm_gpu *gpu) · 9 unmodified lines | |||
| 694 | if (ret) | 695 | if (ret) |
| 695 | goto out; | 696 | goto out; |
| 696 | 697 | ||
| 698 | /* Set the ringbuffer address */ | ||
| 699 | gpu_write64(gpu, REG_A6XX_CP_RB_BASE, REG_A6XX_CP_RB_BASE_HI, | ||
| 700 | gpu->rb[0]->iova); | ||
| 701 | |||
| 702 | gpu_write(gpu, REG_A6XX_CP_RB_CNTL, | ||
| 703 | MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); | ||
| 704 | |||
| 697 | /* Always come up on rb 0 */ | 705 | /* Always come up on rb 0 */ |
| 698 | a6xx_gpu->cur_ring = gpu->rb[0]; | 706 | a6xx_gpu->cur_ring = gpu->rb[0]; |
| 699 | 707 | ||
| @@ -1056,6 +1064,9 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) · 356 unmodified lines | |||
| 1056 | adreno_gpu->registers = NULL; | 1064 | adreno_gpu->registers = NULL; |
| 1057 | adreno_gpu->reg_offsets = a6xx_register_offsets; | 1065 | adreno_gpu->reg_offsets = a6xx_register_offsets; |
| 1058 | 1066 | ||
| 1067 | if (adreno_is_a650(adreno_gpu)) | ||
| 1068 | adreno_gpu->base.hw_apriv = true; | ||
| 1069 | |||
| 1059 | ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1); | 1070 | ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1); |
| 1060 | if (ret) { | 1071 | if (ret) { |
| 1061 | a6xx_destroy(&(a6xx_gpu->base.base)); | 1072 | a6xx_destroy(&(a6xx_gpu->base.base)); |
| @@ -400,26 +400,6 @@ int adreno_hw_init(struct msm_gpu *gpu) · 399 unmodified lines | |||
| 400 | ring->memptrs->rptr = 0; | 400 | ring->memptrs->rptr = 0; |
| 401 | } | 401 | } |
| 402 | 402 | ||
| 403 | /* | ||
| 404 | * Setup REG_CP_RB_CNTL. The same value is used across targets (with | ||
| 405 | * the excpetion of A430 that disables the RPTR shadow) - the cacluation | ||
| 406 | * for the ringbuffer size and block size is moved to msm_gpu.h for the | ||
| 407 | * pre-processor to deal with and the A430 variant is ORed in here | ||
| 408 | */ | ||
| 409 | adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_CNTL, | ||
| 410 | MSM_GPU_RB_CNTL_DEFAULT | | ||
| 411 | (adreno_is_a430(adreno_gpu) ? AXXX_CP_RB_CNTL_NO_UPDATE : 0)); | ||
| 412 | |||
| 413 | /* Setup ringbuffer address - use ringbuffer[0] for GPU init */ | ||
| 414 | adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_BASE, | ||
| 415 | REG_ADRENO_CP_RB_BASE_HI, gpu->rb[0]->iova); | ||
| 416 | |||
| 417 | if (!adreno_is_a430(adreno_gpu)) { | ||
| 418 | adreno_gpu_write64(adreno_gpu, REG_ADRENO_CP_RB_RPTR_ADDR, | ||
| 419 | REG_ADRENO_CP_RB_RPTR_ADDR_HI, | ||
| 420 | rbmemptr(gpu->rb[0], rptr)); | ||
| 421 | } | ||
| 422 | |||
| 423 | return 0; | 403 | return 0; |
| 424 | } | 404 | } |
| 425 | 405 | ||
| @@ -427,11 +407,8 @@ int adreno_hw_init(struct msm_gpu *gpu) · 1 unmodified line | |||
| 427 | static uint32_t get_rptr(struct adreno_gpu *adreno_gpu, | 407 | static uint32_t get_rptr(struct adreno_gpu *adreno_gpu, |
| 428 | struct msm_ringbuffer *ring) | 408 | struct msm_ringbuffer *ring) |
| 429 | { | 409 | { |
| 430 | if (adreno_is_a430(adreno_gpu)) | 410 | return ring->memptrs->rptr = adreno_gpu_read( |
| 431 | return ring->memptrs->rptr = adreno_gpu_read( | 411 | adreno_gpu, REG_ADRENO_CP_RB_RPTR); |
| 432 | adreno_gpu, REG_ADRENO_CP_RB_RPTR); | ||
| 433 | else | ||
| 434 | return ring->memptrs->rptr; | ||
| 435 | } | 412 | } |
| 436 | 413 | ||
| 437 | struct msm_ringbuffer *adreno_active_ring(struct msm_gpu *gpu) | 414 | struct msm_ringbuffer *adreno_active_ring(struct msm_gpu *gpu) |
| @@ -908,7 +908,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, · 907 unmodified lines | |||
| 908 | 908 | ||
| 909 | memptrs = msm_gem_kernel_new(drm, | 909 | memptrs = msm_gem_kernel_new(drm, |
| 910 | sizeof(struct msm_rbmemptrs) * nr_rings, | 910 | sizeof(struct msm_rbmemptrs) * nr_rings, |
| 911 | MSM_BO_UNCACHED, gpu->aspace, &gpu->memptrs_bo, | 911 | check_apriv(gpu, MSM_BO_UNCACHED), gpu->aspace, &gpu->memptrs_bo, |
| 912 | &memptrs_iova); | 912 | &memptrs_iova); |
| 913 | 913 | ||
| 914 | if (IS_ERR(memptrs)) { | 914 | if (IS_ERR(memptrs)) { |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | #include "msm_drv.h" | 15 | #include "msm_drv.h" |
| 16 | #include "msm_fence.h" | 16 | #include "msm_fence.h" |
| 17 | #include "msm_ringbuffer.h" | 17 | #include "msm_ringbuffer.h" |
| 18 | #include "msm_gem.h" | ||
| 18 | 19 | ||
| 19 | struct msm_gem_submit; | 20 | struct msm_gem_submit; |
| 20 | struct msm_gpu_perfcntr; | 21 | struct msm_gpu_perfcntr; |
| @@ -139,6 +140,8 @@ struct msm_gpu { · 118 unmodified lines | |||
| 139 | } devfreq; | 140 | } devfreq; |
| 140 | 141 | ||
| 141 | struct msm_gpu_state *crashstate; | 142 | struct msm_gpu_state *crashstate; |
| 143 | /* True if the hardware supports expanded apriv (a650 and newer) */ | ||
| 144 | bool hw_apriv; | ||
| 142 | }; | 145 | }; |
| 143 | 146 | ||
| 144 | /* It turns out that all targets use the same ringbuffer size */ | 147 | /* It turns out that all targets use the same ringbuffer size */ |
| @@ -327,4 +330,12 @@ static inline void msm_gpu_crashstate_put(struct msm_gpu *gpu) · 182 unmodified lines | |||
| 327 | mutex_unlock(&gpu->dev->struct_mutex); | 330 | mutex_unlock(&gpu->dev->struct_mutex); |
| 328 | } | 331 | } |
| 329 | 332 | ||
| 333 | /* | ||
| 334 | * Simple macro to semi-cleanly add the MAP_PRIV flag for targets that can | ||
| 335 | * support expanded privileges | ||
| 336 | */ | ||
| 337 | #define check_apriv(gpu, flags) \ | ||
| 338 | (((gpu)->hw_apriv ? MSM_BO_MAP_PRIV : 0) | (flags)) | ||
| 339 | |||
| 340 | |||
| 330 | #endif /* __MSM_GPU_H__ */ | 341 | #endif /* __MSM_GPU_H__ */ |
| @@ -27,8 +27,8 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id, · 26 unmodified lines | |||
| 27 | ring->id = id; | 27 | ring->id = id; |
| 28 | 28 | ||
| 29 | ring->start = msm_gem_kernel_new(gpu->dev, MSM_GPU_RINGBUFFER_SZ, | 29 | ring->start = msm_gem_kernel_new(gpu->dev, MSM_GPU_RINGBUFFER_SZ, |
| 30 | MSM_BO_WC | MSM_BO_GPU_READONLY, gpu->aspace, &ring->bo, | 30 | check_apriv(gpu, MSM_BO_WC | MSM_BO_GPU_READONLY), |
| 31 | &ring->iova); | 31 | gpu->aspace, &ring->bo, &ring->iova); |
| 32 | 32 | ||
| 33 | if (IS_ERR(ring->start)) { | 33 | if (IS_ERR(ring->start)) { |
| 34 | ret = PTR_ERR(ring->start); | 34 | ret = PTR_ERR(ring->start); |
| @@ -50,7 +50,10 @@ core507d_update(struct nv50_core *core, u32 *interlock, bool ntfy) · 49 unmodified lines | |||
| 50 | interlock[NV50_DISP_INTERLOCK_OVLY] | | 50 | interlock[NV50_DISP_INTERLOCK_OVLY] | |
| 51 | NVDEF(NV507D, UPDATE, NOT_DRIVER_FRIENDLY, FALSE) | | 51 | NVDEF(NV507D, UPDATE, NOT_DRIVER_FRIENDLY, FALSE) | |
| 52 | NVDEF(NV507D, UPDATE, NOT_DRIVER_UNFRIENDLY, FALSE) | | 52 | NVDEF(NV507D, UPDATE, NOT_DRIVER_UNFRIENDLY, FALSE) | |
| 53 | NVDEF(NV507D, UPDATE, INHIBIT_INTERRUPTS, FALSE)); | 53 | NVDEF(NV507D, UPDATE, INHIBIT_INTERRUPTS, FALSE), |
| 54 | |||
| 55 | SET_NOTIFIER_CONTROL, | ||
| 56 | NVDEF(NV507D, SET_NOTIFIER_CONTROL, NOTIFY, DISABLE)); | ||
| 54 | 57 | ||
| 55 | return PUSH_KICK(push); | 58 | return PUSH_KICK(push); |
| 56 | } | 59 | } |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | |||
| 6 | #include "disp.h" | 6 | #include "disp.h" |
| 7 | #include "head.h" | 7 | #include "head.h" |
| 8 | 8 | ||
| 9 | #include <nvif/push507c.h> | 9 | #include <nvif/pushc37b.h> |
| 10 | 10 | ||
| 11 | #include <nvhw/class/clc37d.h> | 11 | #include <nvhw/class/clc37d.h> |
| 12 | 12 | ||
| @@ -257,6 +257,12 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, · 256 unmodified lines | |||
| 257 | dmac->push->end = dmac->push->bgn; | 257 | dmac->push->end = dmac->push->bgn; |
| 258 | dmac->max = 0x1000/4 - 1; | 258 | dmac->max = 0x1000/4 - 1; |
| 259 | 259 | ||
| 260 | /* EVO channels are affected by a HW bug where the last 12 DWORDs | ||
| 261 | * of the push buffer aren't able to be used safely. | ||
| 262 | */ | ||
| 263 | if (disp->oclass < GV100_DISP) | ||
| 264 | dmac->max -= 12; | ||
| 265 | |||
| 260 | args->pushbuf = nvif_handle(&dmac->_push.mem.object); | 266 | args->pushbuf = nvif_handle(&dmac->_push.mem.object); |
| 261 | 267 | ||
| 262 | ret = nv50_chan_create(device, disp, oclass, head, data, size, | 268 | ret = nv50_chan_create(device, disp, oclass, head, data, size, |
| @@ -20,6 +20,6 @@ · 19 unmodified lines | |||
| 20 | PUSH_ASSERT(!((o) & ~DRF_SMASK(NV507C_DMA_JUMP_OFFSET)), "offset"); \ | 20 | PUSH_ASSERT(!((o) & ~DRF_SMASK(NV507C_DMA_JUMP_OFFSET)), "offset"); \ |
| 21 | PUSH_DATA__((p), NVDEF(NV507C, DMA, OPCODE, JUMP) | \ | 21 | PUSH_DATA__((p), NVDEF(NV507C, DMA, OPCODE, JUMP) | \ |
| 22 | NVVAL(NV507C, DMA, JUMP_OFFSET, (o) >> 2), \ | 22 | NVVAL(NV507C, DMA, JUMP_OFFSET, (o) >> 2), \ |
| 23 | "jump 0x%08x - %s", (u32)(o), __func__); \ | 23 | " jump 0x%08x - %s", (u32)(o), __func__); \ |
| 24 | } while(0) | 24 | } while(0) |
| 25 | #endif | 25 | #endif |
| @@ -933,7 +933,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div, · 932 unmodified lines | |||
| 933 | 933 | ||
| 934 | /* get matching reference and feedback divider */ | 934 | /* get matching reference and feedback divider */ |
| 935 | *ref_div = min(max(den/post_div, 1u), ref_div_max); | 935 | *ref_div = min(max(den/post_div, 1u), ref_div_max); |
| 936 | *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den); | 936 | *fb_div = max(nom * *ref_div * post_div / den, 1u); |
| 937 | 937 | ||
| 938 | /* limit fb divider to its maximum */ | 938 | /* limit fb divider to its maximum */ |
| 939 | if (*fb_div > fb_div_max) { | 939 | if (*fb_div > fb_div_max) { |
| @@ -589,8 +589,7 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, · 588 unmodified lines | |||
| 589 | 589 | ||
| 590 | /* We can't have an alpha plane at the lowest position */ | 590 | /* We can't have an alpha plane at the lowest position */ |
| 591 | if (!backend->quirks->supports_lowest_plane_alpha && | 591 | if (!backend->quirks->supports_lowest_plane_alpha && |
| 592 | (plane_states[0]->fb->format->has_alpha || | 592 | (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE)) |
| 593 | (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE))) | ||
| 594 | return -EINVAL; | 593 | return -EINVAL; |
| 595 | 594 | ||
| 596 | for (i = 1; i < num_planes; i++) { | 595 | for (i = 1; i < num_planes; i++) { |
| @@ -995,7 +994,6 @@ static const struct sun4i_backend_quirks sun6i_backend_quirks = { · 398 unmodified lines | |||
| 995 | 994 | ||
| 996 | static const struct sun4i_backend_quirks sun7i_backend_quirks = { | 995 | static const struct sun4i_backend_quirks sun7i_backend_quirks = { |
| 997 | .needs_output_muxing = true, | 996 | .needs_output_muxing = true, |
| 998 | .supports_lowest_plane_alpha = true, | ||
| 999 | }; | 997 | }; |
| 1000 | 998 | ||
| 1001 | static const struct sun4i_backend_quirks sun8i_a33_backend_quirks = { | 999 | static const struct sun4i_backend_quirks sun8i_a33_backend_quirks = { |
| @@ -1433,14 +1433,18 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon, · 1432 unmodified lines | |||
| 1433 | if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) && | 1433 | if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) && |
| 1434 | encoder->encoder_type == DRM_MODE_ENCODER_TMDS) { | 1434 | encoder->encoder_type == DRM_MODE_ENCODER_TMDS) { |
| 1435 | ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id); | 1435 | ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id); |
| 1436 | if (ret) | 1436 | if (ret) { |
| 1437 | put_device(&pdev->dev); | ||
| 1437 | return ret; | 1438 | return ret; |
| 1439 | } | ||
| 1438 | } | 1440 | } |
| 1439 | 1441 | ||
| 1440 | if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP)) { | 1442 | if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP)) { |
| 1441 | ret = sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id); | 1443 | ret = sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id); |
| 1442 | if (ret) | 1444 | if (ret) { |
| 1445 | put_device(&pdev->dev); | ||
| 1443 | return ret; | 1446 | return ret; |
| 1447 | } | ||
| 1444 | } | 1448 | } |
| 1445 | 1449 | ||
| 1446 | return 0; | 1450 | return 0; |
| @@ -889,7 +889,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi, · 888 unmodified lines | |||
| 889 | regmap_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(0), | 889 | regmap_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(0), |
| 890 | sun6i_dsi_dcs_build_pkt_hdr(dsi, msg)); | 890 | sun6i_dsi_dcs_build_pkt_hdr(dsi, msg)); |
| 891 | 891 | ||
| 892 | bounce = kzalloc(msg->tx_len + sizeof(crc), GFP_KERNEL); | 892 | bounce = kzalloc(ALIGN(msg->tx_len + sizeof(crc), 4), GFP_KERNEL); |
| 893 | if (!bounce) | 893 | if (!bounce) |
| 894 | return -ENOMEM; | 894 | return -ENOMEM; |
| 895 | 895 | ||
| @@ -900,7 +900,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi, · 4 unmodified lines | |||
| 900 | memcpy((u8 *)bounce + msg->tx_len, &crc, sizeof(crc)); | 900 | memcpy((u8 *)bounce + msg->tx_len, &crc, sizeof(crc)); |
| 901 | len += sizeof(crc); | 901 | len += sizeof(crc); |
| 902 | 902 | ||
| 903 | regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, len); | 903 | regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, DIV_ROUND_UP(len, 4)); |
| 904 | regmap_write(dsi->regs, SUN6I_DSI_CMD_CTL_REG, len + 4 - 1); | 904 | regmap_write(dsi->regs, SUN6I_DSI_CMD_CTL_REG, len + 4 - 1); |
| 905 | kfree(bounce); | 905 | kfree(bounce); |
| 906 | 906 | ||
| @@ -211,7 +211,7 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel, · 210 unmodified lines | |||
| 211 | return 0; | 211 | return 0; |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | static bool sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format) | 214 | static u32 sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format) |
| 215 | { | 215 | { |
| 216 | if (!format->is_yuv) | 216 | if (!format->is_yuv) |
| 217 | return SUN8I_CSC_MODE_OFF; | 217 | return SUN8I_CSC_MODE_OFF; |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | |||
| 14 | #include <linux/version.h> | 14 | #include <linux/version.h> |
| 15 | #include <linux/dma-buf.h> | 15 | #include <linux/dma-buf.h> |
| 16 | #include <linux/of_graph.h> | 16 | #include <linux/of_graph.h> |
| 17 | #include <linux/delay.h> | ||
| 17 | 18 | ||
| 18 | #include <drm/drm_fb_cma_helper.h> | 19 | #include <drm/drm_fb_cma_helper.h> |
| 19 | #include <drm/drm_fourcc.h> | 20 | #include <drm/drm_fourcc.h> |
| @@ -130,9 +131,25 @@ static void tve200_display_enable(struct drm_simple_display_pipe *pipe, · 110 unmodified lines | |||
| 130 | struct drm_connector *connector = priv->connector; | 131 | struct drm_connector *connector = priv->connector; |
| 131 | u32 format = fb->format->format; | 132 | u32 format = fb->format->format; |
| 132 | u32 ctrl1 = 0; | 133 | u32 ctrl1 = 0; |
| 134 | int retries; | ||
| 133 | 135 | ||
| 134 | clk_prepare_enable(priv->clk); | 136 | clk_prepare_enable(priv->clk); |
| 135 | 137 | ||
| 138 | /* Reset the TVE200 and wait for it to come back online */ | ||
| 139 | writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4); | ||
| 140 | for (retries = 0; retries < 5; retries++) { | ||
| 141 | usleep_range(30000, 50000); | ||
| 142 | if (readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET) | ||
| 143 | continue; | ||
| 144 | else | ||
| 145 | break; | ||
| 146 | } | ||
| 147 | if (retries == 5 && | ||
| 148 | readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET) { | ||
| 149 | dev_err(drm->dev, "can't get hardware out of reset\n"); | ||
| 150 | return; | ||
| 151 | } | ||
| 152 | |||
| 136 | /* Function 1 */ | 153 | /* Function 1 */ |
| 137 | ctrl1 |= TVE200_CTRL_CSMODE; | 154 | ctrl1 |= TVE200_CTRL_CSMODE; |
| 138 | /* Interlace mode for CCIR656: parameterize? */ | 155 | /* Interlace mode for CCIR656: parameterize? */ |
| @@ -230,8 +247,9 @@ static void tve200_display_disable(struct drm_simple_display_pipe *pipe) · 91 unmodified lines | |||
| 230 | 247 | ||
| 231 | drm_crtc_vblank_off(crtc); | 248 | drm_crtc_vblank_off(crtc); |
| 232 | 249 | ||
| 233 | /* Disable and Power Down */ | 250 | /* Disable put into reset and Power Down */ |
| 234 | writel(0, priv->regs + TVE200_CTRL); | 251 | writel(0, priv->regs + TVE200_CTRL); |
| 252 | writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4); | ||
| 235 | 253 | ||
| 236 | clk_disable_unprepare(priv->clk); | 254 | clk_disable_unprepare(priv->clk); |
| 237 | } | 255 | } |
| @@ -279,6 +297,8 @@ static int tve200_display_enable_vblank(struct drm_simple_display_pipe *pipe) · 41 unmodified lines | |||
| 279 | struct drm_device *drm = crtc->dev; | 297 | struct drm_device *drm = crtc->dev; |
| 280 | struct tve200_drm_dev_private *priv = drm->dev_private; | 298 | struct tve200_drm_dev_private *priv = drm->dev_private; |
| 281 | 299 | ||
| 300 | /* Clear any IRQs and enable */ | ||
| 301 | writel(0xFF, priv->regs + TVE200_INT_CLR); | ||
| 282 | writel(TVE200_INT_V_STATUS, priv->regs + TVE200_INT_EN); | 302 | writel(TVE200_INT_V_STATUS, priv->regs + TVE200_INT_EN); |
| 283 | return 0; | 303 | return 0; |
| 284 | } | 304 | } |
| @@ -97,9 +97,6 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc) · 96 unmodified lines | |||
| 97 | static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc, | 97 | static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc, |
| 98 | struct drm_crtc_state *old_state) | 98 | struct drm_crtc_state *old_state) |
| 99 | { | 99 | { |
| 100 | struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); | ||
| 101 | |||
| 102 | output->enabled = true; | ||
| 103 | } | 100 | } |
| 104 | 101 | ||
| 105 | static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, | 102 | static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, |
| @@ -111,7 +108,6 @@ static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, · 5 unmodified lines | |||
| 111 | 108 | ||
| 112 | virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0); | 109 | virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0); |
| 113 | virtio_gpu_notify(vgdev); | 110 | virtio_gpu_notify(vgdev); |
| 114 | output->enabled = false; | ||
| 115 | } | 111 | } |
| 116 | 112 | ||
| 117 | static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, | 113 | static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, |
| @@ -123,6 +119,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, · 5 unmodified lines | |||
| 123 | static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, | 119 | static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, |
| 124 | struct drm_crtc_state *old_state) | 120 | struct drm_crtc_state *old_state) |
| 125 | { | 121 | { |
| 122 | struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); | ||
| 123 | |||
| 124 | /* | ||
| 125 | * virtio-gpu can't do modeset and plane update operations | ||
| 126 | * independent from each other. So the actual modeset happens | ||
| 127 | * in the plane update callback, and here we just check | ||
| 128 | * whenever we must force the modeset. | ||
| 129 | */ | ||
| 130 | if (drm_atomic_crtc_needs_modeset(crtc->state)) { | ||
| 131 | output->needs_modeset = true; | ||
| 132 | } | ||
| 126 | } | 133 | } |
| 127 | 134 | ||
| 128 | static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = { | 135 | static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = { |
| @@ -137,7 +137,7 @@ struct virtio_gpu_output { · 136 unmodified lines | |||
| 137 | struct edid *edid; | 137 | struct edid *edid; |
| 138 | int cur_x; | 138 | int cur_x; |
| 139 | int cur_y; | 139 | int cur_y; |
| 140 | bool enabled; | 140 | bool needs_modeset; |
| 141 | }; | 141 | }; |
| 142 | #define drm_crtc_to_virtio_gpu_output(x) \ | 142 | #define drm_crtc_to_virtio_gpu_output(x) \ |
| 143 | container_of(x, struct virtio_gpu_output, crtc) | 143 | container_of(x, struct virtio_gpu_output, crtc) |
| @@ -151,7 +151,13 @@ static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev, · 150 unmodified lines | |||
| 151 | if (ret < 0) | 151 | if (ret < 0) |
| 152 | return -EINVAL; | 152 | return -EINVAL; |
| 153 | 153 | ||
| 154 | shmem->pages = drm_gem_shmem_get_pages_sgt(&bo->base.base); | 154 | /* |
| 155 | * virtio_gpu uses drm_gem_shmem_get_sg_table instead of | ||
| 156 | * drm_gem_shmem_get_pages_sgt because virtio has it's own set of | ||
| 157 | * dma-ops. This is discouraged for other drivers, but should be fine | ||
| 158 | * since virtio_gpu doesn't support dma-buf import from other devices. | ||
| 159 | */ | ||
| 160 | shmem->pages = drm_gem_shmem_get_sg_table(&bo->base.base); | ||
| 155 | if (!shmem->pages) { | 161 | if (!shmem->pages) { |
| 156 | drm_gem_shmem_unpin(&bo->base.base); | 162 | drm_gem_shmem_unpin(&bo->base.base); |
| 157 | return -EINVAL; | 163 | return -EINVAL; |
| @@ -142,7 +142,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, · 141 unmodified lines | |||
| 142 | if (WARN_ON(!output)) | 142 | if (WARN_ON(!output)) |
| 143 | return; | 143 | return; |
| 144 | 144 | ||
| 145 | if (!plane->state->fb || !output->enabled) { | 145 | if (!plane->state->fb || !output->crtc.state->active) { |
| 146 | DRM_DEBUG("nofb\n"); | 146 | DRM_DEBUG("nofb\n"); |
| 147 | virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, | 147 | virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, |
| 148 | plane->state->src_w >> 16, | 148 | plane->state->src_w >> 16, |
| @@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, · 14 unmodified lines | |||
| 163 | plane->state->src_w != old_state->src_w || | 163 | plane->state->src_w != old_state->src_w || |
| 164 | plane->state->src_h != old_state->src_h || | 164 | plane->state->src_h != old_state->src_h || |
| 165 | plane->state->src_x != old_state->src_x || | 165 | plane->state->src_x != old_state->src_x || |
| 166 | plane->state->src_y != old_state->src_y) { | 166 | plane->state->src_y != old_state->src_y || |
| 167 | output->needs_modeset) { | ||
| 168 | output->needs_modeset = false; | ||
| 167 | DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", | 169 | DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", |
| 168 | bo->hw_res_handle, | 170 | bo->hw_res_handle, |
| 169 | plane->state->crtc_w, plane->state->crtc_h, | 171 | plane->state->crtc_w, plane->state->crtc_h, |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | |||
| 18 | #include <drm/drm_probe_helper.h> | 18 | #include <drm/drm_probe_helper.h> |
| 19 | 19 | ||
| 20 | #include <xen/balloon.h> | 20 | #include <xen/balloon.h> |
| 21 | #include <xen/xen.h> | ||
| 21 | 22 | ||
| 22 | #include "xen_drm_front.h" | 23 | #include "xen_drm_front.h" |
| 23 | #include "xen_drm_front_gem.h" | 24 | #include "xen_drm_front_gem.h" |
| @@ -99,8 +100,8 @@ static struct xen_gem_object *gem_create(struct drm_device *dev, size_t size) · 75 unmodified lines | |||
| 99 | * allocate ballooned pages which will be used to map | 100 | * allocate ballooned pages which will be used to map |
| 100 | * grant references provided by the backend | 101 | * grant references provided by the backend |
| 101 | */ | 102 | */ |
| 102 | ret = alloc_xenballooned_pages(xen_obj->num_pages, | 103 | ret = xen_alloc_unpopulated_pages(xen_obj->num_pages, |
| 103 | xen_obj->pages); | 104 | xen_obj->pages); |
| 104 | if (ret < 0) { | 105 | if (ret < 0) { |
| 105 | DRM_ERROR("Cannot allocate %zu ballooned pages: %d\n", | 106 | DRM_ERROR("Cannot allocate %zu ballooned pages: %d\n", |
| 106 | xen_obj->num_pages, ret); | 107 | xen_obj->num_pages, ret); |
| @@ -152,8 +153,8 @@ void xen_drm_front_gem_free_object_unlocked(struct drm_gem_object *gem_obj) · 45 unmodified lines | |||
| 152 | } else { | 153 | } else { |
| 153 | if (xen_obj->pages) { | 154 | if (xen_obj->pages) { |
| 154 | if (xen_obj->be_alloc) { | 155 | if (xen_obj->be_alloc) { |
| 155 | free_xenballooned_pages(xen_obj->num_pages, | 156 | xen_free_unpopulated_pages(xen_obj->num_pages, |
| 156 | xen_obj->pages); | 157 | xen_obj->pages); |
| 157 | gem_free_pages_array(xen_obj); | 158 | gem_free_pages_array(xen_obj); |
| 158 | } else { | 159 | } else { |
| 159 | drm_gem_put_pages(&xen_obj->base, | 160 | drm_gem_put_pages(&xen_obj->base, |
| @@ -2,6 +2,7 @@ config DRM_ZYNQMP_DPSUB · 1 unmodified line | |||
| 2 | tristate "ZynqMP DisplayPort Controller Driver" | 2 | tristate "ZynqMP DisplayPort Controller Driver" |
| 3 | depends on ARCH_ZYNQMP || COMPILE_TEST | 3 | depends on ARCH_ZYNQMP || COMPILE_TEST |
| 4 | depends on COMMON_CLK && DRM && OF | 4 | depends on COMMON_CLK && DRM && OF |
| 5 | depends on DMADEVICES | ||
| 5 | select DMA_ENGINE | 6 | select DMA_ENGINE |
| 6 | select DRM_GEM_CMA_HELPER | 7 | select DRM_GEM_CMA_HELPER |
| 7 | select DRM_KMS_CMA_HELPER | 8 | select DRM_KMS_CMA_HELPER |
| @@ -1597,6 +1597,17 @@ static void hid_output_field(const struct hid_device *hid, · 1596 unmodified lines | |||
| 1597 | } | 1597 | } |
| 1598 | } | 1598 | } |
| 1599 | 1599 | ||
| 1600 | /* | ||
| 1601 | * Compute the size of a report. | ||
| 1602 | */ | ||
| 1603 | static size_t hid_compute_report_size(struct hid_report *report) | ||
| 1604 | { | ||
| 1605 | if (report->size) | ||
| 1606 | return ((report->size - 1) >> 3) + 1; | ||
| 1607 | |||
| 1608 | return 0; | ||
| 1609 | } | ||
| 1610 | |||
| 1600 | /* | 1611 | /* |
| 1601 | * Create a report. 'data' has to be allocated using | 1612 | * Create a report. 'data' has to be allocated using |
| 1602 | * hid_alloc_report_buf() so that it has proper size. | 1613 | * hid_alloc_report_buf() so that it has proper size. |
| @@ -1609,7 +1620,7 @@ void hid_output_report(struct hid_report *report, __u8 *data) · 6 unmodified lines | |||
| 1609 | if (report->id > 0) | 1620 | if (report->id > 0) |
| 1610 | *data++ = report->id; | 1621 | *data++ = report->id; |
| 1611 | 1622 | ||
| 1612 | memset(data, 0, ((report->size - 1) >> 3) + 1); | 1623 | memset(data, 0, hid_compute_report_size(report)); |
| 1613 | for (n = 0; n < report->maxfield; n++) | 1624 | for (n = 0; n < report->maxfield; n++) |
| 1614 | hid_output_field(report->device, report->field[n], data); | 1625 | hid_output_field(report->device, report->field[n], data); |
| 1615 | } | 1626 | } |
| @@ -1739,7 +1750,7 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size, · 123 unmodified lines | |||
| 1739 | csize--; | 1750 | csize--; |
| 1740 | } | 1751 | } |
| 1741 | 1752 | ||
| 1742 | rsize = ((report->size - 1) >> 3) + 1; | 1753 | rsize = hid_compute_report_size(report); |
| 1743 | 1754 | ||
| 1744 | if (report_enum->numbered && rsize >= HID_MAX_BUFFER_SIZE) | 1755 | if (report_enum->numbered && rsize >= HID_MAX_BUFFER_SIZE) |
| 1745 | rsize = HID_MAX_BUFFER_SIZE - 1; | 1756 | rsize = HID_MAX_BUFFER_SIZE - 1; |
| @@ -188,6 +188,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) · 187 unmodified lines | |||
| 188 | ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER); | 188 | ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER); |
| 189 | if (ret) { | 189 | if (ret) { |
| 190 | hid_err(hdev, "Failed to init elan MT slots: %d\n", ret); | 190 | hid_err(hdev, "Failed to init elan MT slots: %d\n", ret); |
| 191 | input_free_device(input); | ||
| 191 | return ret; | 192 | return ret; |
| 192 | } | 193 | } |
| 193 | 194 | ||
| @@ -198,6 +199,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) · 4 unmodified lines | |||
| 198 | if (ret) { | 199 | if (ret) { |
| 199 | hid_err(hdev, "Failed to register elan input device: %d\n", | 200 | hid_err(hdev, "Failed to register elan input device: %d\n", |
| 200 | ret); | 201 | ret); |
| 202 | input_mt_destroy_slots(input); | ||
| 201 | input_free_device(input); | 203 | input_free_device(input); |
| 202 | return ret; | 204 | return ret; |
| 203 | } | 205 | } |
| @@ -850,6 +850,7 @@ · 849 unmodified lines | |||
| 850 | #define USB_DEVICE_ID_MS_POWER_COVER 0x07da | 850 | #define USB_DEVICE_ID_MS_POWER_COVER 0x07da |
| 851 | #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd | 851 | #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd |
| 852 | #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb | 852 | #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb |
| 853 | #define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0 | ||
| 853 | 854 | ||
| 854 | #define USB_VENDOR_ID_MOJO 0x8282 | 855 | #define USB_VENDOR_ID_MOJO 0x8282 |
| 855 | #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 | 856 | #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 |
| @@ -1015,6 +1016,8 @@ · 159 unmodified lines | |||
| 1015 | #define USB_DEVICE_ID_SAITEK_RAT9 0x0cfa | 1016 | #define USB_DEVICE_ID_SAITEK_RAT9 0x0cfa |
| 1016 | #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 | 1017 | #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 |
| 1017 | #define USB_DEVICE_ID_SAITEK_X52 0x075c | 1018 | #define USB_DEVICE_ID_SAITEK_X52 0x075c |
| 1019 | #define USB_DEVICE_ID_SAITEK_X52_2 0x0255 | ||
| 1020 | #define USB_DEVICE_ID_SAITEK_X52_PRO 0x0762 | ||
| 1018 | 1021 | ||
| 1019 | #define USB_VENDOR_ID_SAMSUNG 0x0419 | 1022 | #define USB_VENDOR_ID_SAMSUNG 0x0419 |
| 1020 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 | 1023 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
| @@ -1132,6 +1132,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 1131 unmodified lines | |||
| 1132 | } | 1132 | } |
| 1133 | 1133 | ||
| 1134 | mapped: | 1134 | mapped: |
| 1135 | /* Mapping failed, bail out */ | ||
| 1136 | if (!bit) | ||
| 1137 | return; | ||
| 1138 | |||
| 1135 | if (device->driver->input_mapped && | 1139 | if (device->driver->input_mapped && |
| 1136 | device->driver->input_mapped(device, hidinput, field, usage, | 1140 | device->driver->input_mapped(device, hidinput, field, usage, |
| 1137 | &bit, &max) < 0) { | 1141 | &bit, &max) < 0) { |
| @@ -448,6 +448,8 @@ static const struct hid_device_id ms_devices[] = { · 447 unmodified lines | |||
| 448 | .driver_data = MS_SURFACE_DIAL }, | 448 | .driver_data = MS_SURFACE_DIAL }, |
| 449 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER), | 449 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER), |
| 450 | .driver_data = MS_QUIRK_FF }, | 450 | .driver_data = MS_QUIRK_FF }, |
| 451 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS), | ||
| 452 | .driver_data = MS_QUIRK_FF }, | ||
| 451 | { } | 453 | { } |
| 452 | }; | 454 | }; |
| 453 | MODULE_DEVICE_TABLE(hid, ms_devices); | 455 | MODULE_DEVICE_TABLE(hid, ms_devices); |
| @@ -856,6 +856,8 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, · 855 unmodified lines | |||
| 856 | code = BTN_0 + ((usage->hid - 1) & HID_USAGE); | 856 | code = BTN_0 + ((usage->hid - 1) & HID_USAGE); |
| 857 | 857 | ||
| 858 | hid_map_usage(hi, usage, bit, max, EV_KEY, code); | 858 | hid_map_usage(hi, usage, bit, max, EV_KEY, code); |
| 859 | if (!*bit) | ||
| 860 | return -1; | ||
| 859 | input_set_capability(hi->input, EV_KEY, code); | 861 | input_set_capability(hi->input, EV_KEY, code); |
| 860 | return 1; | 862 | return 1; |
| 861 | 863 | ||
| @@ -150,6 +150,8 @@ static const struct hid_device_id hid_quirks[] = { · 149 unmodified lines | |||
| 150 | { HID_USB_DEVICE(USB_VENDOR_ID_RETROUSB, USB_DEVICE_ID_RETROUSB_SNES_RETROPORT), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, | 150 | { HID_USB_DEVICE(USB_VENDOR_ID_RETROUSB, USB_DEVICE_ID_RETROUSB_SNES_RETROPORT), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
| 151 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD), HID_QUIRK_BADPAD }, | 151 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD), HID_QUIRK_BADPAD }, |
| 152 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, | 152 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, |
| 153 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, | ||
| 154 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_PRO), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, | ||
| 153 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS }, | 155 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS }, |
| 154 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS }, | 156 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS }, |
| 155 | { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET }, | 157 | { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET }, |
| @@ -41,8 +41,22 @@ static void pca_reset(struct i2c_algo_pca_data *adap) · 40 unmodified lines | |||
| 41 | pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IPRESET); | 41 | pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IPRESET); |
| 42 | pca_outw(adap, I2C_PCA_IND, 0xA5); | 42 | pca_outw(adap, I2C_PCA_IND, 0xA5); |
| 43 | pca_outw(adap, I2C_PCA_IND, 0x5A); | 43 | pca_outw(adap, I2C_PCA_IND, 0x5A); |
| 44 | |||
| 45 | /* | ||
| 46 | * After a reset we need to re-apply any configuration | ||
| 47 | * (calculated in pca_init) to get the bus in a working state. | ||
| 48 | */ | ||
| 49 | pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IMODE); | ||
| 50 | pca_outw(adap, I2C_PCA_IND, adap->bus_settings.mode); | ||
| 51 | pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_ISCLL); | ||
| 52 | pca_outw(adap, I2C_PCA_IND, adap->bus_settings.tlow); | ||
| 53 | pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_ISCLH); | ||
| 54 | pca_outw(adap, I2C_PCA_IND, adap->bus_settings.thi); | ||
| 55 | |||
| 56 | pca_set_con(adap, I2C_PCA_CON_ENSIO); | ||
| 44 | } else { | 57 | } else { |
| 45 | adap->reset_chip(adap->data); | 58 | adap->reset_chip(adap->data); |
| 59 | pca_set_con(adap, I2C_PCA_CON_ENSIO | adap->bus_settings.clock_freq); | ||
| 46 | } | 60 | } |
| 47 | } | 61 | } |
| 48 | 62 | ||
| @@ -423,13 +437,14 @@ static int pca_init(struct i2c_adapter *adap) · 374 unmodified lines | |||
| 423 | " Use the nominal frequency.\n", adap->name); | 437 | " Use the nominal frequency.\n", adap->name); |
| 424 | } | 438 | } |
| 425 | 439 | ||
| 426 | pca_reset(pca_data); | ||
| 427 | |||
| 428 | clock = pca_clock(pca_data); | 440 | clock = pca_clock(pca_data); |
| 429 | printk(KERN_INFO "%s: Clock frequency is %dkHz\n", | 441 | printk(KERN_INFO "%s: Clock frequency is %dkHz\n", |
| 430 | adap->name, freqs[clock]); | 442 | adap->name, freqs[clock]); |
| 431 | 443 | ||
| 432 | pca_set_con(pca_data, I2C_PCA_CON_ENSIO | clock); | 444 | /* Store settings as these will be needed when the PCA chip is reset */ |
| 445 | pca_data->bus_settings.clock_freq = clock; | ||
| 446 | |||
| 447 | pca_reset(pca_data); | ||
| 433 | } else { | 448 | } else { |
| 434 | int clock; | 449 | int clock; |
| 435 | int mode; | 450 | int mode; |
| @@ -496,19 +511,15 @@ static int pca_init(struct i2c_adapter *adap) · 60 unmodified lines | |||
| 496 | thi = tlow * min_thi / min_tlow; | 511 | thi = tlow * min_thi / min_tlow; |
| 497 | } | 512 | } |
| 498 | 513 | ||
| 514 | /* Store settings as these will be needed when the PCA chip is reset */ | ||
| 515 | pca_data->bus_settings.mode = mode; | ||
| 516 | pca_data->bus_settings.tlow = tlow; | ||
| 517 | pca_data->bus_settings.thi = thi; | ||
| 518 | |||
| 499 | pca_reset(pca_data); | 519 | pca_reset(pca_data); |
| 500 | 520 | ||
| 501 | printk(KERN_INFO | 521 | printk(KERN_INFO |
| 502 | "%s: Clock frequency is %dHz\n", adap->name, clock * 100); | 522 | "%s: Clock frequency is %dHz\n", adap->name, clock * 100); |
| 503 | |||
| 504 | pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_IMODE); | ||
| 505 | pca_outw(pca_data, I2C_PCA_IND, mode); | ||
| 506 | pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_ISCLL); | ||
| 507 | pca_outw(pca_data, I2C_PCA_IND, tlow); | ||
| 508 | pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_ISCLH); | ||
| 509 | pca_outw(pca_data, I2C_PCA_IND, thi); | ||
| 510 | |||
| 511 | pca_set_con(pca_data, I2C_PCA_CON_ENSIO); | ||
| 512 | } | 523 | } |
| 513 | udelay(500); /* 500 us for oscillator to stabilise */ | 524 | udelay(500); /* 500 us for oscillator to stabilise */ |
| 514 | 525 | ||
| @@ -2093,8 +2093,12 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, · 2092 unmodified lines | |||
| 2093 | } | 2093 | } |
| 2094 | } | 2094 | } |
| 2095 | 2095 | ||
| 2096 | /* Adaptive TimeOut: astimated time in usec + 100% margin */ | 2096 | /* |
| 2097 | timeout_usec = (2 * 10000 / bus->bus_freq) * (2 + nread + nwrite); | 2097 | * Adaptive TimeOut: estimated time in usec + 100% margin: |
| 2098 | * 2: double the timeout for clock stretching case | ||
| 2099 | * 9: bits per transaction (including the ack/nack) | ||
| 2100 | */ | ||
| 2101 | timeout_usec = (2 * 9 * USEC_PER_SEC / bus->bus_freq) * (2 + nread + nwrite); | ||
| 2098 | timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec)); | 2102 | timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec)); |
| 2099 | if (nwrite >= 32 * 1024 || nread >= 32 * 1024) { | 2103 | if (nwrite >= 32 * 1024 || nread >= 32 * 1024) { |
| 2100 | dev_err(bus->dev, "i2c%d buffer too big\n", bus->num); | 2104 | dev_err(bus->dev, "i2c%d buffer too big\n", bus->num); |
| @@ -189,6 +189,14 @@ struct bmc150_accel_data { · 188 unmodified lines | |||
| 189 | struct mutex mutex; | 189 | struct mutex mutex; |
| 190 | u8 fifo_mode, watermark; | 190 | u8 fifo_mode, watermark; |
| 191 | s16 buffer[8]; | 191 | s16 buffer[8]; |
| 192 | /* | ||
| 193 | * Ensure there is sufficient space and correct alignment for | ||
| 194 | * the timestamp if enabled | ||
| 195 | */ | ||
| 196 | struct { | ||
| 197 | __le16 channels[3]; | ||
| 198 | s64 ts __aligned(8); | ||
| 199 | } scan; | ||
| 192 | u8 bw_bits; | 200 | u8 bw_bits; |
| 193 | u32 slope_dur; | 201 | u32 slope_dur; |
| 194 | u32 slope_thres; | 202 | u32 slope_thres; |
| @@ -922,15 +930,16 @@ static int __bmc150_accel_fifo_flush(struct iio_dev *indio_dev, · 727 unmodified lines | |||
| 922 | * now. | 930 | * now. |
| 923 | */ | 931 | */ |
| 924 | for (i = 0; i < count; i++) { | 932 | for (i = 0; i < count; i++) { |
| 925 | u16 sample[8]; | ||
| 926 | int j, bit; | 933 | int j, bit; |
| 927 | 934 | ||
| 928 | j = 0; | 935 | j = 0; |
| 929 | for_each_set_bit(bit, indio_dev->active_scan_mask, | 936 | for_each_set_bit(bit, indio_dev->active_scan_mask, |
| 930 | indio_dev->masklength) | 937 | indio_dev->masklength) |
| 931 | memcpy(&sample[j++], &buffer[i * 3 + bit], 2); | 938 | memcpy(&data->scan.channels[j++], &buffer[i * 3 + bit], |
| 939 | sizeof(data->scan.channels[0])); | ||
| 932 | 940 | ||
| 933 | iio_push_to_buffers_with_timestamp(indio_dev, sample, tstamp); | 941 | iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
| 942 | tstamp); | ||
| 934 | 943 | ||
| 935 | tstamp += sample_period; | 944 | tstamp += sample_period; |
| 936 | } | 945 | } |
| @@ -209,14 +209,20 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p) · 208 unmodified lines | |||
| 209 | const struct iio_poll_func *pf = p; | 209 | const struct iio_poll_func *pf = p; |
| 210 | struct iio_dev *indio_dev = pf->indio_dev; | 210 | struct iio_dev *indio_dev = pf->indio_dev; |
| 211 | struct kxsd9_state *st = iio_priv(indio_dev); | 211 | struct kxsd9_state *st = iio_priv(indio_dev); |
| 212 | /* | ||
| 213 | * Ensure correct positioning and alignment of timestamp. | ||
| 214 | * No need to zero initialize as all elements written. | ||
| 215 | */ | ||
| 216 | struct { | ||
| 217 | __be16 chan[4]; | ||
| 218 | s64 ts __aligned(8); | ||
| 219 | } hw_values; | ||
| 212 | int ret; | 220 | int ret; |
| 213 | /* 4 * 16bit values AND timestamp */ | ||
| 214 | __be16 hw_values[8]; | ||
| 215 | 221 | ||
| 216 | ret = regmap_bulk_read(st->map, | 222 | ret = regmap_bulk_read(st->map, |
| 217 | KXSD9_REG_X, | 223 | KXSD9_REG_X, |
| 218 | &hw_values, | 224 | hw_values.chan, |
| 219 | 8); | 225 | sizeof(hw_values.chan)); |
| 220 | if (ret) { | 226 | if (ret) { |
| 221 | dev_err(st->dev, | 227 | dev_err(st->dev, |
| 222 | "error reading data\n"); | 228 | "error reading data\n"); |
| @@ -224,7 +230,7 @@ static irqreturn_t kxsd9_trigger_handler(int irq, void *p) · 1 unmodified line | |||
| 224 | } | 230 | } |
| 225 | 231 | ||
| 226 | iio_push_to_buffers_with_timestamp(indio_dev, | 232 | iio_push_to_buffers_with_timestamp(indio_dev, |
| 227 | hw_values, | 233 | &hw_values, |
| 228 | iio_get_time_ns(indio_dev)); | 234 | iio_get_time_ns(indio_dev)); |
| 229 | iio_trigger_notify_done(indio_dev->trig); | 235 | iio_trigger_notify_done(indio_dev->trig); |
| 230 | 236 | ||
| @@ -52,6 +52,14 @@ · 51 unmodified lines | |||
| 52 | 52 | ||
| 53 | struct mma7455_data { | 53 | struct mma7455_data { |
| 54 | struct regmap *regmap; | 54 | struct regmap *regmap; |
| 55 | /* | ||
| 56 | * Used to reorganize data. Will ensure correct alignment of | ||
| 57 | * the timestamp if present | ||
| 58 | */ | ||
| 59 | struct { | ||
| 60 | __le16 channels[3]; | ||
| 61 | s64 ts __aligned(8); | ||
| 62 | } scan; | ||
| 55 | }; | 63 | }; |
| 56 | 64 | ||
| 57 | static int mma7455_drdy(struct mma7455_data *mma7455) | 65 | static int mma7455_drdy(struct mma7455_data *mma7455) |
| @@ -82,19 +90,19 @@ static irqreturn_t mma7455_trigger_handler(int irq, void *p) · 24 unmodified lines | |||
| 82 | struct iio_poll_func *pf = p; | 90 | struct iio_poll_func *pf = p; |
| 83 | struct iio_dev *indio_dev = pf->indio_dev; | 91 | struct iio_dev *indio_dev = pf->indio_dev; |
| 84 | struct mma7455_data *mma7455 = iio_priv(indio_dev); | 92 | struct mma7455_data *mma7455 = iio_priv(indio_dev); |
| 85 | u8 buf[16]; /* 3 x 16-bit channels + padding + ts */ | ||
| 86 | int ret; | 93 | int ret; |
| 87 | 94 | ||
| 88 | ret = mma7455_drdy(mma7455); | 95 | ret = mma7455_drdy(mma7455); |
| 89 | if (ret) | 96 | if (ret) |
| 90 | goto done; | 97 | goto done; |
| 91 | 98 | ||
| 92 | ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, buf, | 99 | ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, |
| 93 | sizeof(__le16) * 3); | 100 | mma7455->scan.channels, |
| 101 | sizeof(mma7455->scan.channels)); | ||
| 94 | if (ret) | 102 | if (ret) |
| 95 | goto done; | 103 | goto done; |
| 96 | 104 | ||
| 97 | iio_push_to_buffers_with_timestamp(indio_dev, buf, | 105 | iio_push_to_buffers_with_timestamp(indio_dev, &mma7455->scan, |
| 98 | iio_get_time_ns(indio_dev)); | 106 | iio_get_time_ns(indio_dev)); |
| 99 | 107 | ||
| 100 | done: | 108 | done: |
| @@ -110,6 +110,12 @@ struct mma8452_data { · 109 unmodified lines | |||
| 110 | int sleep_val; | 110 | int sleep_val; |
| 111 | struct regulator *vdd_reg; | 111 | struct regulator *vdd_reg; |
| 112 | struct regulator *vddio_reg; | 112 | struct regulator *vddio_reg; |
| 113 | |||
| 114 | /* Ensure correct alignment of time stamp when present */ | ||
| 115 | struct { | ||
| 116 | __be16 channels[3]; | ||
| 117 | s64 ts __aligned(8); | ||
| 118 | } buffer; | ||
| 113 | }; | 119 | }; |
| 114 | 120 | ||
| 115 | /** | 121 | /** |
| @@ -1091,14 +1097,13 @@ static irqreturn_t mma8452_trigger_handler(int irq, void *p) · 975 unmodified lines | |||
| 1091 | struct iio_poll_func *pf = p; | 1097 | struct iio_poll_func *pf = p; |
| 1092 | struct iio_dev *indio_dev = pf->indio_dev; | 1098 | struct iio_dev *indio_dev = pf->indio_dev; |
| 1093 | struct mma8452_data *data = iio_priv(indio_dev); | 1099 | struct mma8452_data *data = iio_priv(indio_dev); |
| 1094 | u8 buffer[16]; /* 3 16-bit channels + padding + ts */ | ||
| 1095 | int ret; | 1100 | int ret; |
| 1096 | 1101 | ||
| 1097 | ret = mma8452_read(data, (__be16 *)buffer); | 1102 | ret = mma8452_read(data, data->buffer.channels); |
| 1098 | if (ret < 0) | 1103 | if (ret < 0) |
| 1099 | goto done; | 1104 | goto done; |
| 1100 | 1105 | ||
| 1101 | iio_push_to_buffers_with_timestamp(indio_dev, buffer, | 1106 | iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer, |
| 1102 | iio_get_time_ns(indio_dev)); | 1107 | iio_get_time_ns(indio_dev)); |
| 1103 | 1108 | ||
| 1104 | done: | 1109 | done: |
| @@ -865,6 +865,8 @@ config ROCKCHIP_SARADC · 864 unmodified lines | |||
| 865 | tristate "Rockchip SARADC driver" | 865 | tristate "Rockchip SARADC driver" |
| 866 | depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST) | 866 | depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST) |
| 867 | depends on RESET_CONTROLLER | 867 | depends on RESET_CONTROLLER |
| 868 | select IIO_BUFFER | ||
| 869 | select IIO_TRIGGERED_BUFFER | ||
| 868 | help | 870 | help |
| 869 | Say yes here to build support for the SARADC found in SoCs from | 871 | Say yes here to build support for the SARADC found in SoCs from |
| 870 | Rockchip. | 872 | Rockchip. |
| @@ -146,6 +146,11 @@ struct ina2xx_chip_info { · 145 unmodified lines | |||
| 146 | int range_vbus; /* Bus voltage maximum in V */ | 146 | int range_vbus; /* Bus voltage maximum in V */ |
| 147 | int pga_gain_vshunt; /* Shunt voltage PGA gain */ | 147 | int pga_gain_vshunt; /* Shunt voltage PGA gain */ |
| 148 | bool allow_async_readout; | 148 | bool allow_async_readout; |
| 149 | /* data buffer needs space for channel data and timestamp */ | ||
| 150 | struct { | ||
| 151 | u16 chan[4]; | ||
| 152 | u64 ts __aligned(8); | ||
| 153 | } scan; | ||
| 149 | }; | 154 | }; |
| 150 | 155 | ||
| 151 | static const struct ina2xx_config ina2xx_config[] = { | 156 | static const struct ina2xx_config ina2xx_config[] = { |
| @@ -738,8 +743,6 @@ static int ina2xx_conversion_ready(struct iio_dev *indio_dev) · 586 unmodified lines | |||
| 738 | static int ina2xx_work_buffer(struct iio_dev *indio_dev) | 743 | static int ina2xx_work_buffer(struct iio_dev *indio_dev) |
| 739 | { | 744 | { |
| 740 | struct ina2xx_chip_info *chip = iio_priv(indio_dev); | 745 | struct ina2xx_chip_info *chip = iio_priv(indio_dev); |
| 741 | /* data buffer needs space for channel data and timestap */ | ||
| 742 | unsigned short data[4 + sizeof(s64)/sizeof(short)]; | ||
| 743 | int bit, ret, i = 0; | 746 | int bit, ret, i = 0; |
| 744 | s64 time; | 747 | s64 time; |
| 745 | 748 | ||
| @@ -758,10 +761,10 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev) · 12 unmodified lines | |||
| 758 | if (ret < 0) | 761 | if (ret < 0) |
| 759 | return ret; | 762 | return ret; |
| 760 | 763 | ||
| 761 | data[i++] = val; | 764 | chip->scan.chan[i++] = val; |
| 762 | } | 765 | } |
| 763 | 766 | ||
| 764 | iio_push_to_buffers_with_timestamp(indio_dev, data, time); | 767 | iio_push_to_buffers_with_timestamp(indio_dev, &chip->scan, time); |
| 765 | 768 | ||
| 766 | return 0; | 769 | return 0; |
| 767 | }; | 770 | }; |
| @@ -36,6 +36,11 @@ struct max1118 { · 35 unmodified lines | |||
| 36 | struct spi_device *spi; | 36 | struct spi_device *spi; |
| 37 | struct mutex lock; | 37 | struct mutex lock; |
| 38 | struct regulator *reg; | 38 | struct regulator *reg; |
| 39 | /* Ensure natural alignment of buffer elements */ | ||
| 40 | struct { | ||
| 41 | u8 channels[2]; | ||
| 42 | s64 ts __aligned(8); | ||
| 43 | } scan; | ||
| 39 | 44 | ||
| 40 | u8 data ____cacheline_aligned; | 45 | u8 data ____cacheline_aligned; |
| 41 | }; | 46 | }; |
| @@ -166,7 +171,6 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p) · 124 unmodified lines | |||
| 166 | struct iio_poll_func *pf = p; | 171 | struct iio_poll_func *pf = p; |
| 167 | struct iio_dev *indio_dev = pf->indio_dev; | 172 | struct iio_dev *indio_dev = pf->indio_dev; |
| 168 | struct max1118 *adc = iio_priv(indio_dev); | 173 | struct max1118 *adc = iio_priv(indio_dev); |
| 169 | u8 data[16] = { }; /* 2x 8-bit ADC data + padding + 8 bytes timestamp */ | ||
| 170 | int scan_index; | 174 | int scan_index; |
| 171 | int i = 0; | 175 | int i = 0; |
| 172 | 176 | ||
| @@ -184,10 +188,10 @@ static irqreturn_t max1118_trigger_handler(int irq, void *p) · 11 unmodified lines | |||
| 184 | goto out; | 188 | goto out; |
| 185 | } | 189 | } |
| 186 | 190 | ||
| 187 | data[i] = ret; | 191 | adc->scan.channels[i] = ret; |
| 188 | i++; | 192 | i++; |
| 189 | } | 193 | } |
| 190 | iio_push_to_buffers_with_timestamp(indio_dev, data, | 194 | iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan, |
| 191 | iio_get_time_ns(indio_dev)); | 195 | iio_get_time_ns(indio_dev)); |
| 192 | out: | 196 | out: |
| 193 | mutex_unlock(&adc->lock); | 197 | mutex_unlock(&adc->lock); |
| @@ -96,16 +96,12 @@ static int mcp3422_update_config(struct mcp3422 *adc, u8 newconfig) · 95 unmodified lines | |||
| 96 | { | 96 | { |
| 97 | int ret; | 97 | int ret; |
| 98 | 98 | ||
| 99 | mutex_lock(&adc->lock); | ||
| 100 | |||
| 101 | ret = i2c_master_send(adc->i2c, &newconfig, 1); | 99 | ret = i2c_master_send(adc->i2c, &newconfig, 1); |
| 102 | if (ret > 0) { | 100 | if (ret > 0) { |
| 103 | adc->config = newconfig; | 101 | adc->config = newconfig; |
| 104 | ret = 0; | 102 | ret = 0; |
| 105 | } | 103 | } |
| 106 | 104 | ||
| 107 | mutex_unlock(&adc->lock); | ||
| 108 | |||
| 109 | return ret; | 105 | return ret; |
| 110 | } | 106 | } |
| 111 | 107 | ||
| @@ -138,6 +134,8 @@ static int mcp3422_read_channel(struct mcp3422 *adc, · 26 unmodified lines | |||
| 138 | u8 config; | 134 | u8 config; |
| 139 | u8 req_channel = channel->channel; | 135 | u8 req_channel = channel->channel; |
| 140 | 136 | ||
| 137 | mutex_lock(&adc->lock); | ||
| 138 | |||
| 141 | if (req_channel != MCP3422_CHANNEL(adc->config)) { | 139 | if (req_channel != MCP3422_CHANNEL(adc->config)) { |
| 142 | config = adc->config; | 140 | config = adc->config; |
| 143 | config &= ~MCP3422_CHANNEL_MASK; | 141 | config &= ~MCP3422_CHANNEL_MASK; |
| @@ -145,12 +143,18 @@ static int mcp3422_read_channel(struct mcp3422 *adc, · 1 unmodified line | |||
| 145 | config &= ~MCP3422_PGA_MASK; | 143 | config &= ~MCP3422_PGA_MASK; |
| 146 | config |= MCP3422_PGA_VALUE(adc->pga[req_channel]); | 144 | config |= MCP3422_PGA_VALUE(adc->pga[req_channel]); |
| 147 | ret = mcp3422_update_config(adc, config); | 145 | ret = mcp3422_update_config(adc, config); |
| 148 | if (ret < 0) | 146 | if (ret < 0) { |
| 147 | mutex_unlock(&adc->lock); | ||
| 149 | return ret; | 148 | return ret; |
| 149 | } | ||
| 150 | msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]); | 150 | msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | return mcp3422_read(adc, value, &config); | 153 | ret = mcp3422_read(adc, value, &config); |
| 154 | |||
| 155 | mutex_unlock(&adc->lock); | ||
| 156 | |||
| 157 | return ret; | ||
| 154 | } | 158 | } |
| 155 | 159 | ||
| 156 | static int mcp3422_read_raw(struct iio_dev *iio, | 160 | static int mcp3422_read_raw(struct iio_dev *iio, |
| @@ -707,7 +707,7 @@ static int meson_sar_adc_temp_sensor_init(struct iio_dev *indio_dev) · 706 unmodified lines | |||
| 707 | size_t read_len; | 707 | size_t read_len; |
| 708 | int ret; | 708 | int ret; |
| 709 | 709 | ||
| 710 | temperature_calib = devm_nvmem_cell_get(&indio_dev->dev, | 710 | temperature_calib = devm_nvmem_cell_get(indio_dev->dev.parent, |
| 711 | "temperature_calib"); | 711 | "temperature_calib"); |
| 712 | if (IS_ERR(temperature_calib)) { | 712 | if (IS_ERR(temperature_calib)) { |
| 713 | ret = PTR_ERR(temperature_calib); | 713 | ret = PTR_ERR(temperature_calib); |
| @@ -33,6 +33,12 @@ struct adc081c { · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | /* 8, 10 or 12 */ | 34 | /* 8, 10 or 12 */ |
| 35 | int bits; | 35 | int bits; |
| 36 | |||
| 37 | /* Ensure natural alignment of buffer elements */ | ||
| 38 | struct { | ||
| 39 | u16 channel; | ||
| 40 | s64 ts __aligned(8); | ||
| 41 | } scan; | ||
| 36 | }; | 42 | }; |
| 37 | 43 | ||
| 38 | #define REG_CONV_RES 0x00 | 44 | #define REG_CONV_RES 0x00 |
| @@ -128,14 +134,13 @@ static irqreturn_t adc081c_trigger_handler(int irq, void *p) · 89 unmodified lines | |||
| 128 | struct iio_poll_func *pf = p; | 134 | struct iio_poll_func *pf = p; |
| 129 | struct iio_dev *indio_dev = pf->indio_dev; | 135 | struct iio_dev *indio_dev = pf->indio_dev; |
| 130 | struct adc081c *data = iio_priv(indio_dev); | 136 | struct adc081c *data = iio_priv(indio_dev); |
| 131 | u16 buf[8]; /* 2 bytes data + 6 bytes padding + 8 bytes timestamp */ | ||
| 132 | int ret; | 137 | int ret; |
| 133 | 138 | ||
| 134 | ret = i2c_smbus_read_word_swapped(data->i2c, REG_CONV_RES); | 139 | ret = i2c_smbus_read_word_swapped(data->i2c, REG_CONV_RES); |
| 135 | if (ret < 0) | 140 | if (ret < 0) |
| 136 | goto out; | 141 | goto out; |
| 137 | buf[0] = ret; | 142 | data->scan.channel = ret; |
| 138 | iio_push_to_buffers_with_timestamp(indio_dev, buf, | 143 | iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
| 139 | iio_get_time_ns(indio_dev)); | 144 | iio_get_time_ns(indio_dev)); |
| 140 | out: | 145 | out: |
| 141 | iio_trigger_notify_done(indio_dev->trig); | 146 | iio_trigger_notify_done(indio_dev->trig); |
| @@ -26,6 +26,11 @@ struct adc084s021 { · 25 unmodified lines | |||
| 26 | struct spi_transfer spi_trans; | 26 | struct spi_transfer spi_trans; |
| 27 | struct regulator *reg; | 27 | struct regulator *reg; |
| 28 | struct mutex lock; | 28 | struct mutex lock; |
| 29 | /* Buffer used to align data */ | ||
| 30 | struct { | ||
| 31 | __be16 channels[4]; | ||
| 32 | s64 ts __aligned(8); | ||
| 33 | } scan; | ||
| 29 | /* | 34 | /* |
| 30 | * DMA (thus cache coherency maintenance) requires the | 35 | * DMA (thus cache coherency maintenance) requires the |
| 31 | * transfer buffers to live in their own cache line. | 36 | * transfer buffers to live in their own cache line. |
| @@ -141,14 +146,13 @@ static irqreturn_t adc084s021_buffer_trigger_handler(int irq, void *pollfunc) · 109 unmodified lines | |||
| 141 | struct iio_poll_func *pf = pollfunc; | 146 | struct iio_poll_func *pf = pollfunc; |
| 142 | struct iio_dev *indio_dev = pf->indio_dev; | 147 | struct iio_dev *indio_dev = pf->indio_dev; |
| 143 | struct adc084s021 *adc = iio_priv(indio_dev); | 148 | struct adc084s021 *adc = iio_priv(indio_dev); |
| 144 | __be16 data[8] = {0}; /* 4 * 16-bit words of data + 8 bytes timestamp */ | ||
| 145 | 149 | ||
| 146 | mutex_lock(&adc->lock); | 150 | mutex_lock(&adc->lock); |
| 147 | 151 | ||
| 148 | if (adc084s021_adc_conversion(adc, &data) < 0) | 152 | if (adc084s021_adc_conversion(adc, adc->scan.channels) < 0) |
| 149 | dev_err(&adc->spi->dev, "Failed to read data\n"); | 153 | dev_err(&adc->spi->dev, "Failed to read data\n"); |
| 150 | 154 | ||
| 151 | iio_push_to_buffers_with_timestamp(indio_dev, data, | 155 | iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan, |
| 152 | iio_get_time_ns(indio_dev)); | 156 | iio_get_time_ns(indio_dev)); |
| 153 | mutex_unlock(&adc->lock); | 157 | mutex_unlock(&adc->lock); |
| 154 | iio_trigger_notify_done(indio_dev->trig); | 158 | iio_trigger_notify_done(indio_dev->trig); |
| @@ -316,6 +316,7 @@ static const struct iio_chan_spec ads1115_channels[] = { · 315 unmodified lines | |||
| 316 | IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP), | 316 | IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP), |
| 317 | }; | 317 | }; |
| 318 | 318 | ||
| 319 | #ifdef CONFIG_PM | ||
| 319 | static int ads1015_set_power_state(struct ads1015_data *data, bool on) | 320 | static int ads1015_set_power_state(struct ads1015_data *data, bool on) |
| 320 | { | 321 | { |
| 321 | int ret; | 322 | int ret; |
| @@ -333,6 +334,15 @@ static int ads1015_set_power_state(struct ads1015_data *data, bool on) · 11 unmodified lines | |||
| 333 | return ret < 0 ? ret : 0; | 334 | return ret < 0 ? ret : 0; |
| 334 | } | 335 | } |
| 335 | 336 | ||
| 337 | #else /* !CONFIG_PM */ | ||
| 338 | |||
| 339 | static int ads1015_set_power_state(struct ads1015_data *data, bool on) | ||
| 340 | { | ||
| 341 | return 0; | ||
| 342 | } | ||
| 343 | |||
| 344 | #endif /* !CONFIG_PM */ | ||
| 345 | |||
| 336 | static | 346 | static |
| 337 | int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val) | 347 | int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val) |
| 338 | { | 348 | { |
| @@ -78,6 +78,11 @@ struct ccs811_data { · 77 unmodified lines | |||
| 78 | struct iio_trigger *drdy_trig; | 78 | struct iio_trigger *drdy_trig; |
| 79 | struct gpio_desc *wakeup_gpio; | 79 | struct gpio_desc *wakeup_gpio; |
| 80 | bool drdy_trig_on; | 80 | bool drdy_trig_on; |
| 81 | /* Ensures correct alignment of timestamp if present */ | ||
| 82 | struct { | ||
| 83 | s16 channels[2]; | ||
| 84 | s64 ts __aligned(8); | ||
| 85 | } scan; | ||
| 81 | }; | 86 | }; |
| 82 | 87 | ||
| 83 | static const struct iio_chan_spec ccs811_channels[] = { | 88 | static const struct iio_chan_spec ccs811_channels[] = { |
| @@ -327,17 +332,17 @@ static irqreturn_t ccs811_trigger_handler(int irq, void *p) · 243 unmodified lines | |||
| 327 | struct iio_dev *indio_dev = pf->indio_dev; | 332 | struct iio_dev *indio_dev = pf->indio_dev; |
| 328 | struct ccs811_data *data = iio_priv(indio_dev); | 333 | struct ccs811_data *data = iio_priv(indio_dev); |
| 329 | struct i2c_client *client = data->client; | 334 | struct i2c_client *client = data->client; |
| 330 | s16 buf[8]; /* s16 eCO2 + s16 TVOC + padding + 8 byte timestamp */ | ||
| 331 | int ret; | 335 | int ret; |
| 332 | 336 | ||
| 333 | ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, 4, | 337 | ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, |
| 334 | (u8 *)&buf); | 338 | sizeof(data->scan.channels), |
| 339 | (u8 *)data->scan.channels); | ||
| 335 | if (ret != 4) { | 340 | if (ret != 4) { |
| 336 | dev_err(&client->dev, "cannot read sensor data\n"); | 341 | dev_err(&client->dev, "cannot read sensor data\n"); |
| 337 | goto err; | 342 | goto err; |
| 338 | } | 343 | } |
| 339 | 344 | ||
| 340 | iio_push_to_buffers_with_timestamp(indio_dev, buf, | 345 | iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
| 341 | iio_get_time_ns(indio_dev)); | 346 | iio_get_time_ns(indio_dev)); |
| 342 | 347 | ||
| 343 | err: | 348 | err: |
| @@ -72,10 +72,13 @@ static void get_default_min_max_freq(enum motionsensor_type type, · 71 unmodified lines | |||
| 72 | 72 | ||
| 73 | switch (type) { | 73 | switch (type) { |
| 74 | case MOTIONSENSE_TYPE_ACCEL: | 74 | case MOTIONSENSE_TYPE_ACCEL: |
| 75 | case MOTIONSENSE_TYPE_GYRO: | ||
| 76 | *min_freq = 12500; | 75 | *min_freq = 12500; |
| 77 | *max_freq = 100000; | 76 | *max_freq = 100000; |
| 78 | break; | 77 | break; |
| 78 | case MOTIONSENSE_TYPE_GYRO: | ||
| 79 | *min_freq = 25000; | ||
| 80 | *max_freq = 100000; | ||
| 81 | break; | ||
| 79 | case MOTIONSENSE_TYPE_MAG: | 82 | case MOTIONSENSE_TYPE_MAG: |
| 80 | *min_freq = 5000; | 83 | *min_freq = 5000; |
| 81 | *max_freq = 25000; | 84 | *max_freq = 25000; |
| @@ -1243,13 +1243,16 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) · 1242 unmodified lines | |||
| 1243 | struct iio_poll_func *pf = p; | 1243 | struct iio_poll_func *pf = p; |
| 1244 | struct iio_dev *indio_dev = pf->indio_dev; | 1244 | struct iio_dev *indio_dev = pf->indio_dev; |
| 1245 | struct ltr501_data *data = iio_priv(indio_dev); | 1245 | struct ltr501_data *data = iio_priv(indio_dev); |
| 1246 | u16 buf[8]; | 1246 | struct { |
| 1247 | u16 channels[3]; | ||
| 1248 | s64 ts __aligned(8); | ||
| 1249 | } scan; | ||
| 1247 | __le16 als_buf[2]; | 1250 | __le16 als_buf[2]; |
| 1248 | u8 mask = 0; | 1251 | u8 mask = 0; |
| 1249 | int j = 0; | 1252 | int j = 0; |
| 1250 | int ret, psdata; | 1253 | int ret, psdata; |
| 1251 | 1254 | ||
| 1252 | memset(buf, 0, sizeof(buf)); | 1255 | memset(&scan, 0, sizeof(scan)); |
| 1253 | 1256 | ||
| 1254 | /* figure out which data needs to be ready */ | 1257 | /* figure out which data needs to be ready */ |
| 1255 | if (test_bit(0, indio_dev->active_scan_mask) || | 1258 | if (test_bit(0, indio_dev->active_scan_mask) || |
| @@ -1268,9 +1271,9 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) · 12 unmodified lines | |||
| 1268 | if (ret < 0) | 1271 | if (ret < 0) |
| 1269 | return ret; | 1272 | return ret; |
| 1270 | if (test_bit(0, indio_dev->active_scan_mask)) | 1273 | if (test_bit(0, indio_dev->active_scan_mask)) |
| 1271 | buf[j++] = le16_to_cpu(als_buf[1]); | 1274 | scan.channels[j++] = le16_to_cpu(als_buf[1]); |
| 1272 | if (test_bit(1, indio_dev->active_scan_mask)) | 1275 | if (test_bit(1, indio_dev->active_scan_mask)) |
| 1273 | buf[j++] = le16_to_cpu(als_buf[0]); | 1276 | scan.channels[j++] = le16_to_cpu(als_buf[0]); |
| 1274 | } | 1277 | } |
| 1275 | 1278 | ||
| 1276 | if (mask & LTR501_STATUS_PS_RDY) { | 1279 | if (mask & LTR501_STATUS_PS_RDY) { |
| @@ -1278,10 +1281,10 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p) · 1 unmodified line | |||
| 1278 | &psdata, 2); | 1281 | &psdata, 2); |
| 1279 | if (ret < 0) | 1282 | if (ret < 0) |
| 1280 | goto done; | 1283 | goto done; |
| 1281 | buf[j++] = psdata & LTR501_PS_DATA_MASK; | 1284 | scan.channels[j++] = psdata & LTR501_PS_DATA_MASK; |
| 1282 | } | 1285 | } |
| 1283 | 1286 | ||
| 1284 | iio_push_to_buffers_with_timestamp(indio_dev, buf, | 1287 | iio_push_to_buffers_with_timestamp(indio_dev, &scan, |
| 1285 | iio_get_time_ns(indio_dev)); | 1288 | iio_get_time_ns(indio_dev)); |
| 1286 | 1289 | ||
| 1287 | done: | 1290 | done: |
| @@ -75,6 +75,11 @@ · 74 unmodified lines | |||
| 75 | struct max44000_data { | 75 | struct max44000_data { |
| 76 | struct mutex lock; | 76 | struct mutex lock; |
| 77 | struct regmap *regmap; | 77 | struct regmap *regmap; |
| 78 | /* Ensure naturally aligned timestamp */ | ||
| 79 | struct { | ||
| 80 | u16 channels[2]; | ||
| 81 | s64 ts __aligned(8); | ||
| 82 | } scan; | ||
| 78 | }; | 83 | }; |
| 79 | 84 | ||
| 80 | /* Default scale is set to the minimum of 0.03125 or 1 / (1 << 5) lux */ | 85 | /* Default scale is set to the minimum of 0.03125 or 1 / (1 << 5) lux */ |
| @@ -488,7 +493,6 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p) · 407 unmodified lines | |||
| 488 | struct iio_poll_func *pf = p; | 493 | struct iio_poll_func *pf = p; |
| 489 | struct iio_dev *indio_dev = pf->indio_dev; | 494 | struct iio_dev *indio_dev = pf->indio_dev; |
| 490 | struct max44000_data *data = iio_priv(indio_dev); | 495 | struct max44000_data *data = iio_priv(indio_dev); |
| 491 | u16 buf[8]; /* 2x u16 + padding + 8 bytes timestamp */ | ||
| 492 | int index = 0; | 496 | int index = 0; |
| 493 | unsigned int regval; | 497 | unsigned int regval; |
| 494 | int ret; | 498 | int ret; |
| @@ -498,17 +502,17 @@ static irqreturn_t max44000_trigger_handler(int irq, void *p) · 3 unmodified lines | |||
| 498 | ret = max44000_read_alsval(data); | 502 | ret = max44000_read_alsval(data); |
| 499 | if (ret < 0) | 503 | if (ret < 0) |
| 500 | goto out_unlock; | 504 | goto out_unlock; |
| 501 | buf[index++] = ret; | 505 | data->scan.channels[index++] = ret; |
| 502 | } | 506 | } |
| 503 | if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) { | 507 | if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) { |
| 504 | ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, ®val); | 508 | ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, ®val); |
| 505 | if (ret < 0) | 509 | if (ret < 0) |
| 506 | goto out_unlock; | 510 | goto out_unlock; |
| 507 | buf[index] = regval; | 511 | data->scan.channels[index] = regval; |
| 508 | } | 512 | } |
| 509 | mutex_unlock(&data->lock); | 513 | mutex_unlock(&data->lock); |
| 510 | 514 | ||
| 511 | iio_push_to_buffers_with_timestamp(indio_dev, buf, | 515 | iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
| 512 | iio_get_time_ns(indio_dev)); | 516 | iio_get_time_ns(indio_dev)); |
| 513 | iio_trigger_notify_done(indio_dev->trig); | 517 | iio_trigger_notify_done(indio_dev->trig); |
| 514 | return IRQ_HANDLED; | 518 | return IRQ_HANDLED; |
| @@ -366,6 +366,12 @@ struct ak8975_data { · 365 unmodified lines | |||
| 366 | struct iio_mount_matrix orientation; | 366 | struct iio_mount_matrix orientation; |
| 367 | struct regulator *vdd; | 367 | struct regulator *vdd; |
| 368 | struct regulator *vid; | 368 | struct regulator *vid; |
| 369 | |||
| 370 | /* Ensure natural alignment of timestamp */ | ||
| 371 | struct { | ||
| 372 | s16 channels[3]; | ||
| 373 | s64 ts __aligned(8); | ||
| 374 | } scan; | ||
| 369 | }; | 375 | }; |
| 370 | 376 | ||
| 371 | /* Enable attached power regulator if any. */ | 377 | /* Enable attached power regulator if any. */ |
| @@ -793,7 +799,6 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev) · 421 unmodified lines | |||
| 793 | const struct i2c_client *client = data->client; | 799 | const struct i2c_client *client = data->client; |
| 794 | const struct ak_def *def = data->def; | 800 | const struct ak_def *def = data->def; |
| 795 | int ret; | 801 | int ret; |
| 796 | s16 buff[8]; /* 3 x 16 bits axis values + 1 aligned 64 bits timestamp */ | ||
| 797 | __le16 fval[3]; | 802 | __le16 fval[3]; |
| 798 | 803 | ||
| 799 | mutex_lock(&data->lock); | 804 | mutex_lock(&data->lock); |
| @@ -816,12 +821,13 @@ static void ak8975_fill_buffer(struct iio_dev *indio_dev) · 16 unmodified lines | |||
| 816 | mutex_unlock(&data->lock); | 821 | mutex_unlock(&data->lock); |
| 817 | 822 | ||
| 818 | /* Clamp to valid range. */ | 823 | /* Clamp to valid range. */ |
| 819 | buff[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range); | 824 | data->scan.channels[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range); |
| 820 | buff[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range); | 825 | data->scan.channels[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range); |
| 821 | buff[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range); | 826 | data->scan.channels[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range); |
| 822 | 827 | ||
| 823 | iio_push_to_buffers_with_timestamp(indio_dev, buff, | 828 | iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
| 824 | iio_get_time_ns(indio_dev)); | 829 | iio_get_time_ns(indio_dev)); |
| 830 | |||
| 825 | return; | 831 | return; |
| 826 | 832 | ||
| 827 | unlock: | 833 | unlock: |
| @@ -40,6 +40,11 @@ struct mb1232_data { · 39 unmodified lines | |||
| 40 | */ | 40 | */ |
| 41 | struct completion ranging; | 41 | struct completion ranging; |
| 42 | int irqnr; | 42 | int irqnr; |
| 43 | /* Ensure correct alignment of data to push to IIO buffer */ | ||
| 44 | struct { | ||
| 45 | s16 distance; | ||
| 46 | s64 ts __aligned(8); | ||
| 47 | } scan; | ||
| 43 | }; | 48 | }; |
| 44 | 49 | ||
| 45 | static irqreturn_t mb1232_handle_irq(int irq, void *dev_id) | 50 | static irqreturn_t mb1232_handle_irq(int irq, void *dev_id) |
| @@ -113,17 +118,13 @@ static irqreturn_t mb1232_trigger_handler(int irq, void *p) · 67 unmodified lines | |||
| 113 | struct iio_poll_func *pf = p; | 118 | struct iio_poll_func *pf = p; |
| 114 | struct iio_dev *indio_dev = pf->indio_dev; | 119 | struct iio_dev *indio_dev = pf->indio_dev; |
| 115 | struct mb1232_data *data = iio_priv(indio_dev); | 120 | struct mb1232_data *data = iio_priv(indio_dev); |
| 116 | /* | ||
| 117 | * triggered buffer | ||
| 118 | * 16-bit channel + 48-bit padding + 64-bit timestamp | ||
| 119 | */ | ||
| 120 | s16 buffer[8] = { 0 }; | ||
| 121 | 121 | ||
| 122 | buffer[0] = mb1232_read_distance(data); | 122 | data->scan.distance = mb1232_read_distance(data); |
| 123 | if (buffer[0] < 0) | 123 | if (data->scan.distance < 0) |
| 124 | goto err; | 124 | goto err; |
| 125 | 125 | ||
| 126 | iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp); | 126 | iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, |
| 127 | pf->timestamp); | ||
| 127 | 128 | ||
| 128 | err: | 129 | err: |
| 129 | iio_trigger_notify_done(indio_dev->trig); | 130 | iio_trigger_notify_done(indio_dev->trig); |
| @@ -379,7 +379,7 @@ static int ib_alloc_cqs(struct ib_device *dev, unsigned int nr_cqes, · 378 unmodified lines | |||
| 379 | { | 379 | { |
| 380 | LIST_HEAD(tmp_list); | 380 | LIST_HEAD(tmp_list); |
| 381 | unsigned int nr_cqs, i; | 381 | unsigned int nr_cqs, i; |
| 382 | struct ib_cq *cq; | 382 | struct ib_cq *cq, *n; |
| 383 | int ret; | 383 | int ret; |
| 384 | 384 | ||
| 385 | if (poll_ctx > IB_POLL_LAST_POOL_TYPE) { | 385 | if (poll_ctx > IB_POLL_LAST_POOL_TYPE) { |
| @@ -412,7 +412,7 @@ static int ib_alloc_cqs(struct ib_device *dev, unsigned int nr_cqes, · 26 unmodified lines | |||
| 412 | return 0; | 412 | return 0; |
| 413 | 413 | ||
| 414 | out_free_cqs: | 414 | out_free_cqs: |
| 415 | list_for_each_entry(cq, &tmp_list, pool_entry) { | 415 | list_for_each_entry_safe(cq, n, &tmp_list, pool_entry) { |
| 416 | cq->shared = false; | 416 | cq->shared = false; |
| 417 | ib_free_cq(cq); | 417 | ib_free_cq(cq); |
| 418 | } | 418 | } |
| @@ -1801,7 +1801,7 @@ int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width) · 1800 unmodified lines | |||
| 1801 | 1801 | ||
| 1802 | dev_put(netdev); | 1802 | dev_put(netdev); |
| 1803 | 1803 | ||
| 1804 | if (!rc) { | 1804 | if (!rc && lksettings.base.speed != (u32)SPEED_UNKNOWN) { |
| 1805 | netdev_speed = lksettings.base.speed; | 1805 | netdev_speed = lksettings.base.speed; |
| 1806 | } else { | 1806 | } else { |
| 1807 | netdev_speed = SPEED_1000; | 1807 | netdev_speed = SPEED_1000; |
| @@ -752,12 +752,6 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp) · 751 unmodified lines | |||
| 752 | gsi_sqp = rdev->gsi_ctx.gsi_sqp; | 752 | gsi_sqp = rdev->gsi_ctx.gsi_sqp; |
| 753 | gsi_sah = rdev->gsi_ctx.gsi_sah; | 753 | gsi_sah = rdev->gsi_ctx.gsi_sah; |
| 754 | 754 | ||
| 755 | /* remove from active qp list */ | ||
| 756 | mutex_lock(&rdev->qp_lock); | ||
| 757 | list_del(&gsi_sqp->list); | ||
| 758 | mutex_unlock(&rdev->qp_lock); | ||
| 759 | atomic_dec(&rdev->qp_count); | ||
| 760 | |||
| 761 | ibdev_dbg(&rdev->ibdev, "Destroy the shadow AH\n"); | 755 | ibdev_dbg(&rdev->ibdev, "Destroy the shadow AH\n"); |
| 762 | bnxt_qplib_destroy_ah(&rdev->qplib_res, | 756 | bnxt_qplib_destroy_ah(&rdev->qplib_res, |
| 763 | &gsi_sah->qplib_ah, | 757 | &gsi_sah->qplib_ah, |
| @@ -772,6 +766,12 @@ static int bnxt_re_destroy_gsi_sqp(struct bnxt_re_qp *qp) · 8 unmodified lines | |||
| 772 | } | 766 | } |
| 773 | bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp); | 767 | bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp); |
| 774 | 768 | ||
| 769 | /* remove from active qp list */ | ||
| 770 | mutex_lock(&rdev->qp_lock); | ||
| 771 | list_del(&gsi_sqp->list); | ||
| 772 | mutex_unlock(&rdev->qp_lock); | ||
| 773 | atomic_dec(&rdev->qp_count); | ||
| 774 | |||
| 775 | kfree(rdev->gsi_ctx.sqp_tbl); | 775 | kfree(rdev->gsi_ctx.sqp_tbl); |
| 776 | kfree(gsi_sah); | 776 | kfree(gsi_sah); |
| 777 | kfree(gsi_sqp); | 777 | kfree(gsi_sqp); |
| @@ -792,11 +792,6 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata) · 14 unmodified lines | |||
| 792 | unsigned int flags; | 792 | unsigned int flags; |
| 793 | int rc; | 793 | int rc; |
| 794 | 794 | ||
| 795 | mutex_lock(&rdev->qp_lock); | ||
| 796 | list_del(&qp->list); | ||
| 797 | mutex_unlock(&rdev->qp_lock); | ||
| 798 | atomic_dec(&rdev->qp_count); | ||
| 799 | |||
| 800 | bnxt_qplib_flush_cqn_wq(&qp->qplib_qp); | 795 | bnxt_qplib_flush_cqn_wq(&qp->qplib_qp); |
| 801 | 796 | ||
| 802 | rc = bnxt_qplib_destroy_qp(&rdev->qplib_res, &qp->qplib_qp); | 797 | rc = bnxt_qplib_destroy_qp(&rdev->qplib_res, &qp->qplib_qp); |
| @@ -819,6 +814,11 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata) · 16 unmodified lines | |||
| 819 | goto sh_fail; | 814 | goto sh_fail; |
| 820 | } | 815 | } |
| 821 | 816 | ||
| 817 | mutex_lock(&rdev->qp_lock); | ||
| 818 | list_del(&qp->list); | ||
| 819 | mutex_unlock(&rdev->qp_lock); | ||
| 820 | atomic_dec(&rdev->qp_count); | ||
| 821 | |||
| 822 | ib_umem_release(qp->rumem); | 822 | ib_umem_release(qp->rumem); |
| 823 | ib_umem_release(qp->sumem); | 823 | ib_umem_release(qp->sumem); |
| 824 | 824 | ||
| @@ -3264,6 +3264,19 @@ static void bnxt_re_process_res_rawqp1_wc(struct ib_wc *wc, · 2439 unmodified lines | |||
| 3264 | wc->wc_flags |= IB_WC_GRH; | 3264 | wc->wc_flags |= IB_WC_GRH; |
| 3265 | } | 3265 | } |
| 3266 | 3266 | ||
| 3267 | static bool bnxt_re_check_if_vlan_valid(struct bnxt_re_dev *rdev, | ||
| 3268 | u16 vlan_id) | ||
| 3269 | { | ||
| 3270 | /* | ||
| 3271 | * Check if the vlan is configured in the host. If not configured, it | ||
| 3272 | * can be a transparent VLAN. So dont report the vlan id. | ||
| 3273 | */ | ||
| 3274 | if (!__vlan_find_dev_deep_rcu(rdev->netdev, | ||
| 3275 | htons(ETH_P_8021Q), vlan_id)) | ||
| 3276 | return false; | ||
| 3277 | return true; | ||
| 3278 | } | ||
| 3279 | |||
| 3267 | static bool bnxt_re_is_vlan_pkt(struct bnxt_qplib_cqe *orig_cqe, | 3280 | static bool bnxt_re_is_vlan_pkt(struct bnxt_qplib_cqe *orig_cqe, |
| 3268 | u16 *vid, u8 *sl) | 3281 | u16 *vid, u8 *sl) |
| 3269 | { | 3282 | { |
| @@ -3332,9 +3345,11 @@ static void bnxt_re_process_res_shadow_qp_wc(struct bnxt_re_qp *gsi_sqp, · 62 unmodified lines | |||
| 3332 | wc->src_qp = orig_cqe->src_qp; | 3345 | wc->src_qp = orig_cqe->src_qp; |
| 3333 | memcpy(wc->smac, orig_cqe->smac, ETH_ALEN); | 3346 | memcpy(wc->smac, orig_cqe->smac, ETH_ALEN); |
| 3334 | if (bnxt_re_is_vlan_pkt(orig_cqe, &vlan_id, &sl)) { | 3347 | if (bnxt_re_is_vlan_pkt(orig_cqe, &vlan_id, &sl)) { |
| 3335 | wc->vlan_id = vlan_id; | 3348 | if (bnxt_re_check_if_vlan_valid(rdev, vlan_id)) { |
| 3336 | wc->sl = sl; | 3349 | wc->vlan_id = vlan_id; |
| 3337 | wc->wc_flags |= IB_WC_WITH_VLAN; | 3350 | wc->sl = sl; |
| 3351 | wc->wc_flags |= IB_WC_WITH_VLAN; | ||
| 3352 | } | ||
| 3338 | } | 3353 | } |
| 3339 | wc->port_num = 1; | 3354 | wc->port_num = 1; |
| 3340 | wc->vendor_err = orig_cqe->status; | 3355 | wc->vendor_err = orig_cqe->status; |
| @@ -1009,7 +1009,6 @@ static void bnxt_re_free_res(struct bnxt_re_dev *rdev) · 1008 unmodified lines | |||
| 1009 | static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) | 1009 | static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) |
| 1010 | { | 1010 | { |
| 1011 | struct bnxt_re_ring_attr rattr = {}; | 1011 | struct bnxt_re_ring_attr rattr = {}; |
| 1012 | struct bnxt_qplib_ctx *qplib_ctx; | ||
| 1013 | int num_vec_created = 0; | 1012 | int num_vec_created = 0; |
| 1014 | int rc = 0, i; | 1013 | int rc = 0, i; |
| 1015 | u8 type; | 1014 | u8 type; |
| @@ -1032,13 +1031,11 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) · 16 unmodified lines | |||
| 1032 | if (rc) | 1031 | if (rc) |
| 1033 | goto dealloc_res; | 1032 | goto dealloc_res; |
| 1034 | 1033 | ||
| 1035 | qplib_ctx = &rdev->qplib_ctx; | ||
| 1036 | for (i = 0; i < rdev->num_msix - 1; i++) { | 1034 | for (i = 0; i < rdev->num_msix - 1; i++) { |
| 1037 | struct bnxt_qplib_nq *nq; | 1035 | struct bnxt_qplib_nq *nq; |
| 1038 | 1036 | ||
| 1039 | nq = &rdev->nq[i]; | 1037 | nq = &rdev->nq[i]; |
| 1040 | nq->hwq.max_elements = (qplib_ctx->cq_count + | 1038 | nq->hwq.max_elements = BNXT_QPLIB_NQE_MAX_CNT; |
| 1041 | qplib_ctx->srqc_count + 2); | ||
| 1042 | rc = bnxt_qplib_alloc_nq(&rdev->qplib_res, &rdev->nq[i]); | 1039 | rc = bnxt_qplib_alloc_nq(&rdev->qplib_res, &rdev->nq[i]); |
| 1043 | if (rc) { | 1040 | if (rc) { |
| 1044 | ibdev_err(&rdev->ibdev, "Alloc Failed NQ%d rc:%#x", | 1041 | ibdev_err(&rdev->ibdev, "Alloc Failed NQ%d rc:%#x", |
| @@ -818,6 +818,7 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 817 unmodified lines | |||
| 818 | u16 cmd_flags = 0; | 818 | u16 cmd_flags = 0; |
| 819 | u32 qp_flags = 0; | 819 | u32 qp_flags = 0; |
| 820 | u8 pg_sz_lvl; | 820 | u8 pg_sz_lvl; |
| 821 | u32 tbl_indx; | ||
| 821 | int rc; | 822 | int rc; |
| 822 | 823 | ||
| 823 | RCFW_CMD_PREP(req, CREATE_QP1, cmd_flags); | 824 | RCFW_CMD_PREP(req, CREATE_QP1, cmd_flags); |
| @@ -907,8 +908,9 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 83 unmodified lines | |||
| 907 | rq->dbinfo.db = qp->dpi->dbr; | 908 | rq->dbinfo.db = qp->dpi->dbr; |
| 908 | rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size); | 909 | rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size); |
| 909 | } | 910 | } |
| 910 | rcfw->qp_tbl[qp->id].qp_id = qp->id; | 911 | tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); |
| 911 | rcfw->qp_tbl[qp->id].qp_handle = (void *)qp; | 912 | rcfw->qp_tbl[tbl_indx].qp_id = qp->id; |
| 913 | rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp; | ||
| 912 | 914 | ||
| 913 | return 0; | 915 | return 0; |
| 914 | 916 | ||
| @@ -935,10 +937,10 @@ static void bnxt_qplib_init_psn_ptr(struct bnxt_qplib_qp *qp, int size) · 20 unmodified lines | |||
| 935 | 937 | ||
| 936 | sq = &qp->sq; | 938 | sq = &qp->sq; |
| 937 | hwq = &sq->hwq; | 939 | hwq = &sq->hwq; |
| 940 | /* First psn entry */ | ||
| 938 | fpsne = (u64)bnxt_qplib_get_qe(hwq, hwq->depth, &psn_pg); | 941 | fpsne = (u64)bnxt_qplib_get_qe(hwq, hwq->depth, &psn_pg); |
| 939 | if (!IS_ALIGNED(fpsne, PAGE_SIZE)) | 942 | if (!IS_ALIGNED(fpsne, PAGE_SIZE)) |
| 940 | indx_pad = ALIGN(fpsne, PAGE_SIZE) / size; | 943 | indx_pad = (fpsne & ~PAGE_MASK) / size; |
| 941 | |||
| 942 | hwq->pad_pgofft = indx_pad; | 944 | hwq->pad_pgofft = indx_pad; |
| 943 | hwq->pad_pg = (u64 *)psn_pg; | 945 | hwq->pad_pg = (u64 *)psn_pg; |
| 944 | hwq->pad_stride = size; | 946 | hwq->pad_stride = size; |
| @@ -959,6 +961,7 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 14 unmodified lines | |||
| 959 | u16 cmd_flags = 0; | 961 | u16 cmd_flags = 0; |
| 960 | u32 qp_flags = 0; | 962 | u32 qp_flags = 0; |
| 961 | u8 pg_sz_lvl; | 963 | u8 pg_sz_lvl; |
| 964 | u32 tbl_indx; | ||
| 962 | u16 nsge; | 965 | u16 nsge; |
| 963 | 966 | ||
| 964 | RCFW_CMD_PREP(req, CREATE_QP, cmd_flags); | 967 | RCFW_CMD_PREP(req, CREATE_QP, cmd_flags); |
| @@ -1111,8 +1114,9 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) · 146 unmodified lines | |||
| 1111 | rq->dbinfo.db = qp->dpi->dbr; | 1114 | rq->dbinfo.db = qp->dpi->dbr; |
| 1112 | rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size); | 1115 | rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size); |
| 1113 | } | 1116 | } |
| 1114 | rcfw->qp_tbl[qp->id].qp_id = qp->id; | 1117 | tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); |
| 1115 | rcfw->qp_tbl[qp->id].qp_handle = (void *)qp; | 1118 | rcfw->qp_tbl[tbl_indx].qp_id = qp->id; |
| 1119 | rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp; | ||
| 1116 | 1120 | ||
| 1117 | return 0; | 1121 | return 0; |
| 1118 | fail: | 1122 | fail: |
| @@ -1457,10 +1461,12 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, · 338 unmodified lines | |||
| 1457 | struct cmdq_destroy_qp req; | 1461 | struct cmdq_destroy_qp req; |
| 1458 | struct creq_destroy_qp_resp resp; | 1462 | struct creq_destroy_qp_resp resp; |
| 1459 | u16 cmd_flags = 0; | 1463 | u16 cmd_flags = 0; |
| 1464 | u32 tbl_indx; | ||
| 1460 | int rc; | 1465 | int rc; |
| 1461 | 1466 | ||
| 1462 | rcfw->qp_tbl[qp->id].qp_id = BNXT_QPLIB_QP_ID_INVALID; | 1467 | tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); |
| 1463 | rcfw->qp_tbl[qp->id].qp_handle = NULL; | 1468 | rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID; |
| 1469 | rcfw->qp_tbl[tbl_indx].qp_handle = NULL; | ||
| 1464 | 1470 | ||
| 1465 | RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags); | 1471 | RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags); |
| 1466 | 1472 | ||
| @@ -1468,8 +1474,8 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, · 1 unmodified line | |||
| 1468 | rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, | 1474 | rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, |
| 1469 | (void *)&resp, NULL, 0); | 1475 | (void *)&resp, NULL, 0); |
| 1470 | if (rc) { | 1476 | if (rc) { |
| 1471 | rcfw->qp_tbl[qp->id].qp_id = qp->id; | 1477 | rcfw->qp_tbl[tbl_indx].qp_id = qp->id; |
| 1472 | rcfw->qp_tbl[qp->id].qp_handle = qp; | 1478 | rcfw->qp_tbl[tbl_indx].qp_handle = qp; |
| 1473 | return rc; | 1479 | return rc; |
| 1474 | } | 1480 | } |
| 1475 | 1481 | ||
| @@ -307,14 +307,15 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, · 306 unmodified lines | |||
| 307 | __le16 mcookie; | 307 | __le16 mcookie; |
| 308 | u16 cookie; | 308 | u16 cookie; |
| 309 | int rc = 0; | 309 | int rc = 0; |
| 310 | u32 qp_id; | 310 | u32 qp_id, tbl_indx; |
| 311 | 311 | ||
| 312 | pdev = rcfw->pdev; | 312 | pdev = rcfw->pdev; |
| 313 | switch (qp_event->event) { | 313 | switch (qp_event->event) { |
| 314 | case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION: | 314 | case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION: |
| 315 | err_event = (struct creq_qp_error_notification *)qp_event; | 315 | err_event = (struct creq_qp_error_notification *)qp_event; |
| 316 | qp_id = le32_to_cpu(err_event->xid); | 316 | qp_id = le32_to_cpu(err_event->xid); |
| 317 | qp = rcfw->qp_tbl[qp_id].qp_handle; | 317 | tbl_indx = map_qp_id_to_tbl_indx(qp_id, rcfw); |
| 318 | qp = rcfw->qp_tbl[tbl_indx].qp_handle; | ||
| 318 | dev_dbg(&pdev->dev, "Received QP error notification\n"); | 319 | dev_dbg(&pdev->dev, "Received QP error notification\n"); |
| 319 | dev_dbg(&pdev->dev, | 320 | dev_dbg(&pdev->dev, |
| 320 | "qpid 0x%x, req_err=0x%x, resp_err=0x%x\n", | 321 | "qpid 0x%x, req_err=0x%x, resp_err=0x%x\n", |
| @@ -615,8 +616,9 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res, · 294 unmodified lines | |||
| 615 | 616 | ||
| 616 | cmdq->bmap_size = bmap_size; | 617 | cmdq->bmap_size = bmap_size; |
| 617 | 618 | ||
| 618 | rcfw->qp_tbl_size = qp_tbl_sz; | 619 | /* Allocate one extra to hold the QP1 entries */ |
| 619 | rcfw->qp_tbl = kcalloc(qp_tbl_sz, sizeof(struct bnxt_qplib_qp_node), | 620 | rcfw->qp_tbl_size = qp_tbl_sz + 1; |
| 621 | rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node), | ||
| 620 | GFP_KERNEL); | 622 | GFP_KERNEL); |
| 621 | if (!rcfw->qp_tbl) | 623 | if (!rcfw->qp_tbl) |
| 622 | goto fail; | 624 | goto fail; |
| @@ -216,4 +216,9 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw); · 215 unmodified lines | |||
| 216 | int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, | 216 | int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, |
| 217 | struct bnxt_qplib_ctx *ctx, int is_virtfn); | 217 | struct bnxt_qplib_ctx *ctx, int is_virtfn); |
| 218 | void bnxt_qplib_mark_qp_error(void *qp_handle); | 218 | void bnxt_qplib_mark_qp_error(void *qp_handle); |
| 219 | static inline u32 map_qp_id_to_tbl_indx(u32 qid, struct bnxt_qplib_rcfw *rcfw) | ||
| 220 | { | ||
| 221 | /* Last index of the qp_tbl is for QP1 ie. qp_tbl_size - 1*/ | ||
| 222 | return (qid == 1) ? rcfw->qp_tbl_size - 1 : qid % rcfw->qp_tbl_size - 2; | ||
| 223 | } | ||
| 219 | #endif /* __BNXT_QPLIB_RCFW_H__ */ | 224 | #endif /* __BNXT_QPLIB_RCFW_H__ */ |
| @@ -149,7 +149,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, · 148 unmodified lines | |||
| 149 | attr->max_inline_data = le32_to_cpu(sb->max_inline_data); | 149 | attr->max_inline_data = le32_to_cpu(sb->max_inline_data); |
| 150 | attr->l2_db_size = (sb->l2_db_space_size + 1) * | 150 | attr->l2_db_size = (sb->l2_db_space_size + 1) * |
| 151 | (0x01 << RCFW_DBR_BASE_PAGE_SHIFT); | 151 | (0x01 << RCFW_DBR_BASE_PAGE_SHIFT); |
| 152 | attr->max_sgid = le32_to_cpu(sb->max_gid); | 152 | attr->max_sgid = BNXT_QPLIB_NUM_GIDS_SUPPORTED; |
| 153 | 153 | ||
| 154 | bnxt_qplib_query_version(rcfw, attr->fw_ver); | 154 | bnxt_qplib_query_version(rcfw, attr->fw_ver); |
| 155 | 155 | ||
| @@ -47,6 +47,7 @@ · 46 unmodified lines | |||
| 47 | struct bnxt_qplib_dev_attr { | 47 | struct bnxt_qplib_dev_attr { |
| 48 | #define FW_VER_ARR_LEN 4 | 48 | #define FW_VER_ARR_LEN 4 |
| 49 | u8 fw_ver[FW_VER_ARR_LEN]; | 49 | u8 fw_ver[FW_VER_ARR_LEN]; |
| 50 | #define BNXT_QPLIB_NUM_GIDS_SUPPORTED 256 | ||
| 50 | u16 max_sgid; | 51 | u16 max_sgid; |
| 51 | u16 max_mrw; | 52 | u16 max_mrw; |
| 52 | u32 max_qp; | 53 | u32 max_qp; |
| @@ -784,7 +784,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, · 783 unmodified lines | |||
| 784 | props->ip_gids = true; | 784 | props->ip_gids = true; |
| 785 | props->gid_tbl_len = mdev->dev->caps.gid_table_len[port]; | 785 | props->gid_tbl_len = mdev->dev->caps.gid_table_len[port]; |
| 786 | props->max_msg_sz = mdev->dev->caps.max_msg_sz; | 786 | props->max_msg_sz = mdev->dev->caps.max_msg_sz; |
| 787 | props->pkey_tbl_len = 1; | 787 | if (mdev->dev->caps.pkey_table_len[port]) |
| 788 | props->pkey_tbl_len = 1; | ||
| 788 | props->max_mtu = IB_MTU_4096; | 789 | props->max_mtu = IB_MTU_4096; |
| 789 | props->max_vl_num = 2; | 790 | props->max_vl_num = 2; |
| 790 | props->state = IB_PORT_DOWN; | 791 | props->state = IB_PORT_DOWN; |
| @@ -40,6 +40,8 @@ MODULE_AUTHOR("Bob Pearson, Frank Zago, John Groves, Kamal Heib"); · 39 unmodified lines | |||
| 40 | MODULE_DESCRIPTION("Soft RDMA transport"); | 40 | MODULE_DESCRIPTION("Soft RDMA transport"); |
| 41 | MODULE_LICENSE("Dual BSD/GPL"); | 41 | MODULE_LICENSE("Dual BSD/GPL"); |
| 42 | 42 | ||
| 43 | bool rxe_initialized; | ||
| 44 | |||
| 43 | /* free resources for a rxe device all objects created for this device must | 45 | /* free resources for a rxe device all objects created for this device must |
| 44 | * have been destroyed | 46 | * have been destroyed |
| 45 | */ | 47 | */ |
| @@ -315,6 +317,7 @@ static int __init rxe_module_init(void) · 269 unmodified lines | |||
| 315 | return err; | 317 | return err; |
| 316 | 318 | ||
| 317 | rdma_link_register(&rxe_link_ops); | 319 | rdma_link_register(&rxe_link_ops); |
| 320 | rxe_initialized = true; | ||
| 318 | pr_info("loaded\n"); | 321 | pr_info("loaded\n"); |
| 319 | return 0; | 322 | return 0; |
| 320 | } | 323 | } |
| @@ -326,6 +329,7 @@ static void __exit rxe_module_exit(void) · 5 unmodified lines | |||
| 326 | rxe_net_exit(); | 329 | rxe_net_exit(); |
| 327 | rxe_cache_exit(); | 330 | rxe_cache_exit(); |
| 328 | 331 | ||
| 332 | rxe_initialized = false; | ||
| 329 | pr_info("unloaded\n"); | 333 | pr_info("unloaded\n"); |
| 330 | } | 334 | } |
| 331 | 335 | ||
| @@ -67,6 +67,8 @@ · 66 unmodified lines | |||
| 67 | 67 | ||
| 68 | #define RXE_ROCE_V2_SPORT (0xc000) | 68 | #define RXE_ROCE_V2_SPORT (0xc000) |
| 69 | 69 | ||
| 70 | extern bool rxe_initialized; | ||
| 71 | |||
| 70 | static inline u32 rxe_crc32(struct rxe_dev *rxe, | 72 | static inline u32 rxe_crc32(struct rxe_dev *rxe, |
| 71 | u32 crc, void *next, size_t len) | 73 | u32 crc, void *next, size_t len) |
| 72 | { | 74 | { |
| @@ -205,6 +205,7 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start, · 204 unmodified lines | |||
| 205 | vaddr = page_address(sg_page_iter_page(&sg_iter)); | 205 | vaddr = page_address(sg_page_iter_page(&sg_iter)); |
| 206 | if (!vaddr) { | 206 | if (!vaddr) { |
| 207 | pr_warn("null vaddr\n"); | 207 | pr_warn("null vaddr\n"); |
| 208 | ib_umem_release(umem); | ||
| 208 | err = -ENOMEM; | 209 | err = -ENOMEM; |
| 209 | goto err1; | 210 | goto err1; |
| 210 | } | 211 | } |
| @@ -61,6 +61,11 @@ static int rxe_param_set_add(const char *val, const struct kernel_param *kp) · 60 unmodified lines | |||
| 61 | struct net_device *ndev; | 61 | struct net_device *ndev; |
| 62 | struct rxe_dev *exists; | 62 | struct rxe_dev *exists; |
| 63 | 63 | ||
| 64 | if (!rxe_initialized) { | ||
| 65 | pr_err("Module parameters are not supported, use rdma link add or rxe_cfg\n"); | ||
| 66 | return -EAGAIN; | ||
| 67 | } | ||
| 68 | |||
| 64 | len = sanitize_arg(val, intf, sizeof(intf)); | 69 | len = sanitize_arg(val, intf, sizeof(intf)); |
| 65 | if (!len) { | 70 | if (!len) { |
| 66 | pr_err("add: invalid interface name\n"); | 71 | pr_err("add: invalid interface name\n"); |
| @@ -1056,7 +1056,7 @@ static ssize_t parent_show(struct device *device, · 1055 unmodified lines | |||
| 1056 | struct rxe_dev *rxe = | 1056 | struct rxe_dev *rxe = |
| 1057 | rdma_device_to_drv_device(device, struct rxe_dev, ib_dev); | 1057 | rdma_device_to_drv_device(device, struct rxe_dev, ib_dev); |
| 1058 | 1058 | ||
| 1059 | return snprintf(buf, 16, "%s\n", rxe_parent_name(rxe, 1)); | 1059 | return scnprintf(buf, PAGE_SIZE, "%s\n", rxe_parent_name(rxe, 1)); |
| 1060 | } | 1060 | } |
| 1061 | 1061 | ||
| 1062 | static DEVICE_ATTR_RO(parent); | 1062 | static DEVICE_ATTR_RO(parent); |
| @@ -140,15 +140,15 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) · 139 unmodified lines | |||
| 140 | rx_desc = isert_conn->rx_descs; | 140 | rx_desc = isert_conn->rx_descs; |
| 141 | 141 | ||
| 142 | for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { | 142 | for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { |
| 143 | dma_addr = ib_dma_map_single(ib_dev, (void *)rx_desc, | 143 | dma_addr = ib_dma_map_single(ib_dev, rx_desc->buf, |
| 144 | ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); | 144 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 145 | if (ib_dma_mapping_error(ib_dev, dma_addr)) | 145 | if (ib_dma_mapping_error(ib_dev, dma_addr)) |
| 146 | goto dma_map_fail; | 146 | goto dma_map_fail; |
| 147 | 147 | ||
| 148 | rx_desc->dma_addr = dma_addr; | 148 | rx_desc->dma_addr = dma_addr; |
| 149 | 149 | ||
| 150 | rx_sg = &rx_desc->rx_sg; | 150 | rx_sg = &rx_desc->rx_sg; |
| 151 | rx_sg->addr = rx_desc->dma_addr; | 151 | rx_sg->addr = rx_desc->dma_addr + isert_get_hdr_offset(rx_desc); |
| 152 | rx_sg->length = ISER_RX_PAYLOAD_SIZE; | 152 | rx_sg->length = ISER_RX_PAYLOAD_SIZE; |
| 153 | rx_sg->lkey = device->pd->local_dma_lkey; | 153 | rx_sg->lkey = device->pd->local_dma_lkey; |
| 154 | rx_desc->rx_cqe.done = isert_recv_done; | 154 | rx_desc->rx_cqe.done = isert_recv_done; |
| @@ -160,7 +160,7 @@ dma_map_fail: · 5 unmodified lines | |||
| 160 | rx_desc = isert_conn->rx_descs; | 160 | rx_desc = isert_conn->rx_descs; |
| 161 | for (j = 0; j < i; j++, rx_desc++) { | 161 | for (j = 0; j < i; j++, rx_desc++) { |
| 162 | ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, | 162 | ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, |
| 163 | ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); | 163 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 164 | } | 164 | } |
| 165 | kfree(isert_conn->rx_descs); | 165 | kfree(isert_conn->rx_descs); |
| 166 | isert_conn->rx_descs = NULL; | 166 | isert_conn->rx_descs = NULL; |
| @@ -181,7 +181,7 @@ isert_free_rx_descriptors(struct isert_conn *isert_conn) · 14 unmodified lines | |||
| 181 | rx_desc = isert_conn->rx_descs; | 181 | rx_desc = isert_conn->rx_descs; |
| 182 | for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { | 182 | for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { |
| 183 | ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, | 183 | ib_dma_unmap_single(ib_dev, rx_desc->dma_addr, |
| 184 | ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); | 184 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | kfree(isert_conn->rx_descs); | 187 | kfree(isert_conn->rx_descs); |
| @@ -299,10 +299,9 @@ isert_free_login_buf(struct isert_conn *isert_conn) · 111 unmodified lines | |||
| 299 | ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE); | 299 | ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE); |
| 300 | kfree(isert_conn->login_rsp_buf); | 300 | kfree(isert_conn->login_rsp_buf); |
| 301 | 301 | ||
| 302 | ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, | 302 | ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr, |
| 303 | ISER_RX_PAYLOAD_SIZE, | 303 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 304 | DMA_FROM_DEVICE); | 304 | kfree(isert_conn->login_desc); |
| 305 | kfree(isert_conn->login_req_buf); | ||
| 306 | } | 305 | } |
| 307 | 306 | ||
| 308 | static int | 307 | static int |
| @@ -311,25 +310,25 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, · 2 unmodified lines | |||
| 311 | { | 310 | { |
| 312 | int ret; | 311 | int ret; |
| 313 | 312 | ||
| 314 | isert_conn->login_req_buf = kzalloc(sizeof(*isert_conn->login_req_buf), | 313 | isert_conn->login_desc = kzalloc(sizeof(*isert_conn->login_desc), |
| 315 | GFP_KERNEL); | 314 | GFP_KERNEL); |
| 316 | if (!isert_conn->login_req_buf) | 315 | if (!isert_conn->login_desc) |
| 317 | return -ENOMEM; | 316 | return -ENOMEM; |
| 318 | 317 | ||
| 319 | isert_conn->login_req_dma = ib_dma_map_single(ib_dev, | 318 | isert_conn->login_desc->dma_addr = ib_dma_map_single(ib_dev, |
| 320 | isert_conn->login_req_buf, | 319 | isert_conn->login_desc->buf, |
| 321 | ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); | 320 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 322 | ret = ib_dma_mapping_error(ib_dev, isert_conn->login_req_dma); | 321 | ret = ib_dma_mapping_error(ib_dev, isert_conn->login_desc->dma_addr); |
| 323 | if (ret) { | 322 | if (ret) { |
| 324 | isert_err("login_req_dma mapping error: %d\n", ret); | 323 | isert_err("login_desc dma mapping error: %d\n", ret); |
| 325 | isert_conn->login_req_dma = 0; | 324 | isert_conn->login_desc->dma_addr = 0; |
| 326 | goto out_free_login_req_buf; | 325 | goto out_free_login_desc; |
| 327 | } | 326 | } |
| 328 | 327 | ||
| 329 | isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL); | 328 | isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL); |
| 330 | if (!isert_conn->login_rsp_buf) { | 329 | if (!isert_conn->login_rsp_buf) { |
| 331 | ret = -ENOMEM; | 330 | ret = -ENOMEM; |
| 332 | goto out_unmap_login_req_buf; | 331 | goto out_unmap_login_desc; |
| 333 | } | 332 | } |
| 334 | 333 | ||
| 335 | isert_conn->login_rsp_dma = ib_dma_map_single(ib_dev, | 334 | isert_conn->login_rsp_dma = ib_dma_map_single(ib_dev, |
| @@ -346,11 +345,11 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, · 10 unmodified lines | |||
| 346 | 345 | ||
| 347 | out_free_login_rsp_buf: | 346 | out_free_login_rsp_buf: |
| 348 | kfree(isert_conn->login_rsp_buf); | 347 | kfree(isert_conn->login_rsp_buf); |
| 349 | out_unmap_login_req_buf: | 348 | out_unmap_login_desc: |
| 350 | ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, | 349 | ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr, |
| 351 | ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); | 350 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 352 | out_free_login_req_buf: | 351 | out_free_login_desc: |
| 353 | kfree(isert_conn->login_req_buf); | 352 | kfree(isert_conn->login_desc); |
| 354 | return ret; | 353 | return ret; |
| 355 | } | 354 | } |
| 356 | 355 | ||
| @@ -476,7 +475,7 @@ isert_connect_release(struct isert_conn *isert_conn) · 119 unmodified lines | |||
| 476 | if (isert_conn->qp) | 475 | if (isert_conn->qp) |
| 477 | isert_destroy_qp(isert_conn); | 476 | isert_destroy_qp(isert_conn); |
| 478 | 477 | ||
| 479 | if (isert_conn->login_req_buf) | 478 | if (isert_conn->login_desc) |
| 480 | isert_free_login_buf(isert_conn); | 479 | isert_free_login_buf(isert_conn); |
| 481 | 480 | ||
| 482 | isert_device_put(device); | 481 | isert_device_put(device); |
| @@ -862,17 +861,18 @@ isert_login_post_recv(struct isert_conn *isert_conn) · 379 unmodified lines | |||
| 862 | int ret; | 861 | int ret; |
| 863 | 862 | ||
| 864 | memset(&sge, 0, sizeof(struct ib_sge)); | 863 | memset(&sge, 0, sizeof(struct ib_sge)); |
| 865 | sge.addr = isert_conn->login_req_dma; | 864 | sge.addr = isert_conn->login_desc->dma_addr + |
| 865 | isert_get_hdr_offset(isert_conn->login_desc); | ||
| 866 | sge.length = ISER_RX_PAYLOAD_SIZE; | 866 | sge.length = ISER_RX_PAYLOAD_SIZE; |
| 867 | sge.lkey = isert_conn->device->pd->local_dma_lkey; | 867 | sge.lkey = isert_conn->device->pd->local_dma_lkey; |
| 868 | 868 | ||
| 869 | isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n", | 869 | isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n", |
| 870 | sge.addr, sge.length, sge.lkey); | 870 | sge.addr, sge.length, sge.lkey); |
| 871 | 871 | ||
| 872 | isert_conn->login_req_buf->rx_cqe.done = isert_login_recv_done; | 872 | isert_conn->login_desc->rx_cqe.done = isert_login_recv_done; |
| 873 | 873 | ||
| 874 | memset(&rx_wr, 0, sizeof(struct ib_recv_wr)); | 874 | memset(&rx_wr, 0, sizeof(struct ib_recv_wr)); |
| 875 | rx_wr.wr_cqe = &isert_conn->login_req_buf->rx_cqe; | 875 | rx_wr.wr_cqe = &isert_conn->login_desc->rx_cqe; |
| 876 | rx_wr.sg_list = &sge; | 876 | rx_wr.sg_list = &sge; |
| 877 | rx_wr.num_sge = 1; | 877 | rx_wr.num_sge = 1; |
| 878 | 878 | ||
| @@ -949,7 +949,7 @@ post_send: · 70 unmodified lines | |||
| 949 | static void | 949 | static void |
| 950 | isert_rx_login_req(struct isert_conn *isert_conn) | 950 | isert_rx_login_req(struct isert_conn *isert_conn) |
| 951 | { | 951 | { |
| 952 | struct iser_rx_desc *rx_desc = isert_conn->login_req_buf; | 952 | struct iser_rx_desc *rx_desc = isert_conn->login_desc; |
| 953 | int rx_buflen = isert_conn->login_req_len; | 953 | int rx_buflen = isert_conn->login_req_len; |
| 954 | struct iscsi_conn *conn = isert_conn->conn; | 954 | struct iscsi_conn *conn = isert_conn->conn; |
| 955 | struct iscsi_login *login = conn->conn_login; | 955 | struct iscsi_login *login = conn->conn_login; |
| @@ -961,7 +961,7 @@ isert_rx_login_req(struct isert_conn *isert_conn) · 5 unmodified lines | |||
| 961 | 961 | ||
| 962 | if (login->first_request) { | 962 | if (login->first_request) { |
| 963 | struct iscsi_login_req *login_req = | 963 | struct iscsi_login_req *login_req = |
| 964 | (struct iscsi_login_req *)&rx_desc->iscsi_header; | 964 | (struct iscsi_login_req *)isert_get_iscsi_hdr(rx_desc); |
| 965 | /* | 965 | /* |
| 966 | * Setup the initial iscsi_login values from the leading | 966 | * Setup the initial iscsi_login values from the leading |
| 967 | * login request PDU. | 967 | * login request PDU. |
| @@ -980,13 +980,13 @@ isert_rx_login_req(struct isert_conn *isert_conn) · 12 unmodified lines | |||
| 980 | login->tsih = be16_to_cpu(login_req->tsih); | 980 | login->tsih = be16_to_cpu(login_req->tsih); |
| 981 | } | 981 | } |
| 982 | 982 | ||
| 983 | memcpy(&login->req[0], (void *)&rx_desc->iscsi_header, ISCSI_HDR_LEN); | 983 | memcpy(&login->req[0], isert_get_iscsi_hdr(rx_desc), ISCSI_HDR_LEN); |
| 984 | 984 | ||
| 985 | size = min(rx_buflen, MAX_KEY_VALUE_PAIRS); | 985 | size = min(rx_buflen, MAX_KEY_VALUE_PAIRS); |
| 986 | isert_dbg("Using login payload size: %d, rx_buflen: %d " | 986 | isert_dbg("Using login payload size: %d, rx_buflen: %d " |
| 987 | "MAX_KEY_VALUE_PAIRS: %d\n", size, rx_buflen, | 987 | "MAX_KEY_VALUE_PAIRS: %d\n", size, rx_buflen, |
| 988 | MAX_KEY_VALUE_PAIRS); | 988 | MAX_KEY_VALUE_PAIRS); |
| 989 | memcpy(login->req_buf, &rx_desc->data[0], size); | 989 | memcpy(login->req_buf, isert_get_data(rx_desc), size); |
| 990 | 990 | ||
| 991 | if (login->first_request) { | 991 | if (login->first_request) { |
| 992 | complete(&isert_conn->login_comp); | 992 | complete(&isert_conn->login_comp); |
| @@ -1051,14 +1051,15 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn, · 58 unmodified lines | |||
| 1051 | if (imm_data_len != data_len) { | 1051 | if (imm_data_len != data_len) { |
| 1052 | sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE)); | 1052 | sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE)); |
| 1053 | sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents, | 1053 | sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents, |
| 1054 | &rx_desc->data[0], imm_data_len); | 1054 | isert_get_data(rx_desc), imm_data_len); |
| 1055 | isert_dbg("Copy Immediate sg_nents: %u imm_data_len: %d\n", | 1055 | isert_dbg("Copy Immediate sg_nents: %u imm_data_len: %d\n", |
| 1056 | sg_nents, imm_data_len); | 1056 | sg_nents, imm_data_len); |
| 1057 | } else { | 1057 | } else { |
| 1058 | sg_init_table(&isert_cmd->sg, 1); | 1058 | sg_init_table(&isert_cmd->sg, 1); |
| 1059 | cmd->se_cmd.t_data_sg = &isert_cmd->sg; | 1059 | cmd->se_cmd.t_data_sg = &isert_cmd->sg; |
| 1060 | cmd->se_cmd.t_data_nents = 1; | 1060 | cmd->se_cmd.t_data_nents = 1; |
| 1061 | sg_set_buf(&isert_cmd->sg, &rx_desc->data[0], imm_data_len); | 1061 | sg_set_buf(&isert_cmd->sg, isert_get_data(rx_desc), |
| 1062 | imm_data_len); | ||
| 1062 | isert_dbg("Transfer Immediate imm_data_len: %d\n", | 1063 | isert_dbg("Transfer Immediate imm_data_len: %d\n", |
| 1063 | imm_data_len); | 1064 | imm_data_len); |
| 1064 | } | 1065 | } |
| @@ -1127,9 +1128,9 @@ isert_handle_iscsi_dataout(struct isert_conn *isert_conn, · 62 unmodified lines | |||
| 1127 | } | 1128 | } |
| 1128 | isert_dbg("Copying DataOut: sg_start: %p, sg_off: %u " | 1129 | isert_dbg("Copying DataOut: sg_start: %p, sg_off: %u " |
| 1129 | "sg_nents: %u from %p %u\n", sg_start, sg_off, | 1130 | "sg_nents: %u from %p %u\n", sg_start, sg_off, |
| 1130 | sg_nents, &rx_desc->data[0], unsol_data_len); | 1131 | sg_nents, isert_get_data(rx_desc), unsol_data_len); |
| 1131 | 1132 | ||
| 1132 | sg_copy_from_buffer(sg_start, sg_nents, &rx_desc->data[0], | 1133 | sg_copy_from_buffer(sg_start, sg_nents, isert_get_data(rx_desc), |
| 1133 | unsol_data_len); | 1134 | unsol_data_len); |
| 1134 | 1135 | ||
| 1135 | rc = iscsit_check_dataout_payload(cmd, hdr, false); | 1136 | rc = iscsit_check_dataout_payload(cmd, hdr, false); |
| @@ -1188,7 +1189,7 @@ isert_handle_text_cmd(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd · 52 unmodified lines | |||
| 1188 | } | 1189 | } |
| 1189 | cmd->text_in_ptr = text_in; | 1190 | cmd->text_in_ptr = text_in; |
| 1190 | 1191 | ||
| 1191 | memcpy(cmd->text_in_ptr, &rx_desc->data[0], payload_length); | 1192 | memcpy(cmd->text_in_ptr, isert_get_data(rx_desc), payload_length); |
| 1192 | 1193 | ||
| 1193 | return iscsit_process_text_cmd(conn, cmd, hdr); | 1194 | return iscsit_process_text_cmd(conn, cmd, hdr); |
| 1194 | } | 1195 | } |
| @@ -1198,7 +1199,7 @@ isert_rx_opcode(struct isert_conn *isert_conn, struct iser_rx_desc *rx_desc, · 3 unmodified lines | |||
| 1198 | uint32_t read_stag, uint64_t read_va, | 1199 | uint32_t read_stag, uint64_t read_va, |
| 1199 | uint32_t write_stag, uint64_t write_va) | 1200 | uint32_t write_stag, uint64_t write_va) |
| 1200 | { | 1201 | { |
| 1201 | struct iscsi_hdr *hdr = &rx_desc->iscsi_header; | 1202 | struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc); |
| 1202 | struct iscsi_conn *conn = isert_conn->conn; | 1203 | struct iscsi_conn *conn = isert_conn->conn; |
| 1203 | struct iscsi_cmd *cmd; | 1204 | struct iscsi_cmd *cmd; |
| 1204 | struct isert_cmd *isert_cmd; | 1205 | struct isert_cmd *isert_cmd; |
| @@ -1296,8 +1297,8 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 91 unmodified lines | |||
| 1296 | struct isert_conn *isert_conn = wc->qp->qp_context; | 1297 | struct isert_conn *isert_conn = wc->qp->qp_context; |
| 1297 | struct ib_device *ib_dev = isert_conn->cm_id->device; | 1298 | struct ib_device *ib_dev = isert_conn->cm_id->device; |
| 1298 | struct iser_rx_desc *rx_desc = cqe_to_rx_desc(wc->wr_cqe); | 1299 | struct iser_rx_desc *rx_desc = cqe_to_rx_desc(wc->wr_cqe); |
| 1299 | struct iscsi_hdr *hdr = &rx_desc->iscsi_header; | 1300 | struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc); |
| 1300 | struct iser_ctrl *iser_ctrl = &rx_desc->iser_header; | 1301 | struct iser_ctrl *iser_ctrl = isert_get_iser_hdr(rx_desc); |
| 1301 | uint64_t read_va = 0, write_va = 0; | 1302 | uint64_t read_va = 0, write_va = 0; |
| 1302 | uint32_t read_stag = 0, write_stag = 0; | 1303 | uint32_t read_stag = 0, write_stag = 0; |
| 1303 | 1304 | ||
| @@ -1311,7 +1312,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 7 unmodified lines | |||
| 1311 | rx_desc->in_use = true; | 1312 | rx_desc->in_use = true; |
| 1312 | 1313 | ||
| 1313 | ib_dma_sync_single_for_cpu(ib_dev, rx_desc->dma_addr, | 1314 | ib_dma_sync_single_for_cpu(ib_dev, rx_desc->dma_addr, |
| 1314 | ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); | 1315 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 1315 | 1316 | ||
| 1316 | isert_dbg("DMA: 0x%llx, iSCSI opcode: 0x%02x, ITT: 0x%08x, flags: 0x%02x dlen: %d\n", | 1317 | isert_dbg("DMA: 0x%llx, iSCSI opcode: 0x%02x, ITT: 0x%08x, flags: 0x%02x dlen: %d\n", |
| 1317 | rx_desc->dma_addr, hdr->opcode, hdr->itt, hdr->flags, | 1318 | rx_desc->dma_addr, hdr->opcode, hdr->itt, hdr->flags, |
| @@ -1346,7 +1347,7 @@ isert_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 28 unmodified lines | |||
| 1346 | read_stag, read_va, write_stag, write_va); | 1347 | read_stag, read_va, write_stag, write_va); |
| 1347 | 1348 | ||
| 1348 | ib_dma_sync_single_for_device(ib_dev, rx_desc->dma_addr, | 1349 | ib_dma_sync_single_for_device(ib_dev, rx_desc->dma_addr, |
| 1349 | ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); | 1350 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 1350 | } | 1351 | } |
| 1351 | 1352 | ||
| 1352 | static void | 1353 | static void |
| @@ -1360,8 +1361,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 7 unmodified lines | |||
| 1360 | return; | 1361 | return; |
| 1361 | } | 1362 | } |
| 1362 | 1363 | ||
| 1363 | ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_req_dma, | 1364 | ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_desc->dma_addr, |
| 1364 | ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); | 1365 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 1365 | 1366 | ||
| 1366 | isert_conn->login_req_len = wc->byte_len - ISER_HEADERS_LEN; | 1367 | isert_conn->login_req_len = wc->byte_len - ISER_HEADERS_LEN; |
| 1367 | 1368 | ||
| @@ -1376,8 +1377,8 @@ isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) · 8 unmodified lines | |||
| 1376 | complete(&isert_conn->login_req_comp); | 1377 | complete(&isert_conn->login_req_comp); |
| 1377 | mutex_unlock(&isert_conn->mutex); | 1378 | mutex_unlock(&isert_conn->mutex); |
| 1378 | 1379 | ||
| 1379 | ib_dma_sync_single_for_device(ib_dev, isert_conn->login_req_dma, | 1380 | ib_dma_sync_single_for_device(ib_dev, isert_conn->login_desc->dma_addr, |
| 1380 | ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); | 1381 | ISER_RX_SIZE, DMA_FROM_DEVICE); |
| 1381 | } | 1382 | } |
| 1382 | 1383 | ||
| 1383 | static void | 1384 | static void |
| @@ -59,9 +59,11 @@ · 58 unmodified lines | |||
| 59 | ISERT_MAX_TX_MISC_PDUS + \ | 59 | ISERT_MAX_TX_MISC_PDUS + \ |
| 60 | ISERT_MAX_RX_MISC_PDUS) | 60 | ISERT_MAX_RX_MISC_PDUS) |
| 61 | 61 | ||
| 62 | #define ISER_RX_PAD_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 4096 - \ | 62 | /* |
| 63 | (ISER_RX_PAYLOAD_SIZE + sizeof(u64) + sizeof(struct ib_sge) + \ | 63 | * RX size is default of 8k plus headers, but data needs to align to |
| 64 | sizeof(struct ib_cqe) + sizeof(bool))) | 64 | * 512 boundary, so use 1024 to have the extra space for alignment. |
| 65 | */ | ||
| 66 | #define ISER_RX_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 1024) | ||
| 65 | 67 | ||
| 66 | /* Maximum support is 16MB I/O size */ | 68 | /* Maximum support is 16MB I/O size */ |
| 67 | #define ISCSI_ISER_MAX_SG_TABLESIZE 4096 | 69 | #define ISCSI_ISER_MAX_SG_TABLESIZE 4096 |
| @@ -81,21 +83,41 @@ enum iser_conn_state { · 13 unmodified lines | |||
| 81 | }; | 83 | }; |
| 82 | 84 | ||
| 83 | struct iser_rx_desc { | 85 | struct iser_rx_desc { |
| 84 | struct iser_ctrl iser_header; | 86 | char buf[ISER_RX_SIZE]; |
| 85 | struct iscsi_hdr iscsi_header; | ||
| 86 | char data[ISCSI_DEF_MAX_RECV_SEG_LEN]; | ||
| 87 | u64 dma_addr; | 87 | u64 dma_addr; |
| 88 | struct ib_sge rx_sg; | 88 | struct ib_sge rx_sg; |
| 89 | struct ib_cqe rx_cqe; | 89 | struct ib_cqe rx_cqe; |
| 90 | bool in_use; | 90 | bool in_use; |
| 91 | char pad[ISER_RX_PAD_SIZE]; | 91 | }; |
| 92 | } __packed; | ||
| 93 | 92 | ||
| 94 | static inline struct iser_rx_desc *cqe_to_rx_desc(struct ib_cqe *cqe) | 93 | static inline struct iser_rx_desc *cqe_to_rx_desc(struct ib_cqe *cqe) |
| 95 | { | 94 | { |
| 96 | return container_of(cqe, struct iser_rx_desc, rx_cqe); | 95 | return container_of(cqe, struct iser_rx_desc, rx_cqe); |
| 97 | } | 96 | } |
| 98 | 97 | ||
| 98 | static void *isert_get_iser_hdr(struct iser_rx_desc *desc) | ||
| 99 | { | ||
| 100 | return PTR_ALIGN(desc->buf + ISER_HEADERS_LEN, 512) - ISER_HEADERS_LEN; | ||
| 101 | } | ||
| 102 | |||
| 103 | static size_t isert_get_hdr_offset(struct iser_rx_desc *desc) | ||
| 104 | { | ||
| 105 | return isert_get_iser_hdr(desc) - (void *)desc->buf; | ||
| 106 | } | ||
| 107 | |||
| 108 | static void *isert_get_iscsi_hdr(struct iser_rx_desc *desc) | ||
| 109 | { | ||
| 110 | return isert_get_iser_hdr(desc) + sizeof(struct iser_ctrl); | ||
| 111 | } | ||
| 112 | |||
| 113 | static void *isert_get_data(struct iser_rx_desc *desc) | ||
| 114 | { | ||
| 115 | void *data = isert_get_iser_hdr(desc) + ISER_HEADERS_LEN; | ||
| 116 | |||
| 117 | WARN_ON((uintptr_t)data & 511); | ||
| 118 | return data; | ||
| 119 | } | ||
| 120 | |||
| 99 | struct iser_tx_desc { | 121 | struct iser_tx_desc { |
| 100 | struct iser_ctrl iser_header; | 122 | struct iser_ctrl iser_header; |
| 101 | struct iscsi_hdr iscsi_header; | 123 | struct iscsi_hdr iscsi_header; |
| @@ -142,9 +164,8 @@ struct isert_conn { · 40 unmodified lines | |||
| 142 | u32 responder_resources; | 164 | u32 responder_resources; |
| 143 | u32 initiator_depth; | 165 | u32 initiator_depth; |
| 144 | bool pi_support; | 166 | bool pi_support; |
| 145 | struct iser_rx_desc *login_req_buf; | 167 | struct iser_rx_desc *login_desc; |
| 146 | char *login_rsp_buf; | 168 | char *login_rsp_buf; |
| 147 | u64 login_req_dma; | ||
| 148 | int login_req_len; | 169 | int login_req_len; |
| 149 | u64 login_rsp_dma; | 170 | u64 login_rsp_dma; |
| 150 | struct iser_rx_desc *rx_descs; | 171 | struct iser_rx_desc *rx_descs; |
| @@ -152,13 +152,6 @@ static struct attribute_group rtrs_srv_stats_attr_group = { · 151 unmodified lines | |||
| 152 | .attrs = rtrs_srv_stats_attrs, | 152 | .attrs = rtrs_srv_stats_attrs, |
| 153 | }; | 153 | }; |
| 154 | 154 | ||
| 155 | static void rtrs_srv_dev_release(struct device *dev) | ||
| 156 | { | ||
| 157 | struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev); | ||
| 158 | |||
| 159 | kfree(srv); | ||
| 160 | } | ||
| 161 | |||
| 162 | static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) | 155 | static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) |
| 163 | { | 156 | { |
| 164 | struct rtrs_srv *srv = sess->srv; | 157 | struct rtrs_srv *srv = sess->srv; |
| @@ -172,7 +165,6 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) · 7 unmodified lines | |||
| 172 | goto unlock; | 165 | goto unlock; |
| 173 | } | 166 | } |
| 174 | srv->dev.class = rtrs_dev_class; | 167 | srv->dev.class = rtrs_dev_class; |
| 175 | srv->dev.release = rtrs_srv_dev_release; | ||
| 176 | err = dev_set_name(&srv->dev, "%s", sess->s.sessname); | 168 | err = dev_set_name(&srv->dev, "%s", sess->s.sessname); |
| 177 | if (err) | 169 | if (err) |
| 178 | goto unlock; | 170 | goto unlock; |
| @@ -182,16 +174,16 @@ static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) · 3 unmodified lines | |||
| 182 | * sysfs files are created | 174 | * sysfs files are created |
| 183 | */ | 175 | */ |
| 184 | dev_set_uevent_suppress(&srv->dev, true); | 176 | dev_set_uevent_suppress(&srv->dev, true); |
| 185 | err = device_register(&srv->dev); | 177 | err = device_add(&srv->dev); |
| 186 | if (err) { | 178 | if (err) { |
| 187 | pr_err("device_register(): %d\n", err); | 179 | pr_err("device_add(): %d\n", err); |
| 188 | goto put; | 180 | goto put; |
| 189 | } | 181 | } |
| 190 | srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj); | 182 | srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj); |
| 191 | if (!srv->kobj_paths) { | 183 | if (!srv->kobj_paths) { |
| 192 | err = -ENOMEM; | 184 | err = -ENOMEM; |
| 193 | pr_err("kobject_create_and_add(): %d\n", err); | 185 | pr_err("kobject_create_and_add(): %d\n", err); |
| 194 | device_unregister(&srv->dev); | 186 | device_del(&srv->dev); |
| 195 | goto unlock; | 187 | goto unlock; |
| 196 | } | 188 | } |
| 197 | dev_set_uevent_suppress(&srv->dev, false); | 189 | dev_set_uevent_suppress(&srv->dev, false); |
| @@ -216,7 +208,7 @@ rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_srv_sess *sess) · 18 unmodified lines | |||
| 216 | kobject_del(srv->kobj_paths); | 208 | kobject_del(srv->kobj_paths); |
| 217 | kobject_put(srv->kobj_paths); | 209 | kobject_put(srv->kobj_paths); |
| 218 | mutex_unlock(&srv->paths_mutex); | 210 | mutex_unlock(&srv->paths_mutex); |
| 219 | device_unregister(&srv->dev); | 211 | device_del(&srv->dev); |
| 220 | } else { | 212 | } else { |
| 221 | mutex_unlock(&srv->paths_mutex); | 213 | mutex_unlock(&srv->paths_mutex); |
| 222 | } | 214 | } |
| @@ -1319,6 +1319,13 @@ static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess) · 1318 unmodified lines | |||
| 1319 | return sess->cur_cq_vector; | 1319 | return sess->cur_cq_vector; |
| 1320 | } | 1320 | } |
| 1321 | 1321 | ||
| 1322 | static void rtrs_srv_dev_release(struct device *dev) | ||
| 1323 | { | ||
| 1324 | struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev); | ||
| 1325 | |||
| 1326 | kfree(srv); | ||
| 1327 | } | ||
| 1328 | |||
| 1322 | static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, | 1329 | static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, |
| 1323 | const uuid_t *paths_uuid) | 1330 | const uuid_t *paths_uuid) |
| 1324 | { | 1331 | { |
| @@ -1336,6 +1343,8 @@ static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, · 11 unmodified lines | |||
| 1336 | uuid_copy(&srv->paths_uuid, paths_uuid); | 1343 | uuid_copy(&srv->paths_uuid, paths_uuid); |
| 1337 | srv->queue_depth = sess_queue_depth; | 1344 | srv->queue_depth = sess_queue_depth; |
| 1338 | srv->ctx = ctx; | 1345 | srv->ctx = ctx; |
| 1346 | device_initialize(&srv->dev); | ||
| 1347 | srv->dev.release = rtrs_srv_dev_release; | ||
| 1339 | 1348 | ||
| 1340 | srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks), | 1349 | srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks), |
| 1341 | GFP_KERNEL); | 1350 | GFP_KERNEL); |
| @@ -55,12 +55,18 @@ static int icc_summary_show(struct seq_file *s, void *data) · 54 unmodified lines | |||
| 55 | 55 | ||
| 56 | icc_summary_show_one(s, n); | 56 | icc_summary_show_one(s, n); |
| 57 | hlist_for_each_entry(r, &n->req_list, req_node) { | 57 | hlist_for_each_entry(r, &n->req_list, req_node) { |
| 58 | u32 avg_bw = 0, peak_bw = 0; | ||
| 59 | |||
| 58 | if (!r->dev) | 60 | if (!r->dev) |
| 59 | continue; | 61 | continue; |
| 60 | 62 | ||
| 63 | if (r->enabled) { | ||
| 64 | avg_bw = r->avg_bw; | ||
| 65 | peak_bw = r->peak_bw; | ||
| 66 | } | ||
| 67 | |||
| 61 | seq_printf(s, " %-27s %12u %12u %12u\n", | 68 | seq_printf(s, " %-27s %12u %12u %12u\n", |
| 62 | dev_name(r->dev), r->tag, r->avg_bw, | 69 | dev_name(r->dev), r->tag, avg_bw, peak_bw); |
| 63 | r->peak_bw); | ||
| 64 | } | 70 | } |
| 65 | } | 71 | } |
| 66 | } | 72 | } |
| @@ -52,8 +52,20 @@ static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b) · 51 unmodified lines | |||
| 52 | return 1; | 52 | return 1; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static u64 bcm_div(u64 num, u32 base) | ||
| 56 | { | ||
| 57 | /* Ensure that small votes aren't lost. */ | ||
| 58 | if (num && num < base) | ||
| 59 | return 1; | ||
| 60 | |||
| 61 | do_div(num, base); | ||
| 62 | |||
| 63 | return num; | ||
| 64 | } | ||
| 65 | |||
| 55 | static void bcm_aggregate(struct qcom_icc_bcm *bcm) | 66 | static void bcm_aggregate(struct qcom_icc_bcm *bcm) |
| 56 | { | 67 | { |
| 68 | struct qcom_icc_node *node; | ||
| 57 | size_t i, bucket; | 69 | size_t i, bucket; |
| 58 | u64 agg_avg[QCOM_ICC_NUM_BUCKETS] = {0}; | 70 | u64 agg_avg[QCOM_ICC_NUM_BUCKETS] = {0}; |
| 59 | u64 agg_peak[QCOM_ICC_NUM_BUCKETS] = {0}; | 71 | u64 agg_peak[QCOM_ICC_NUM_BUCKETS] = {0}; |
| @@ -61,22 +73,21 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm) · 1 unmodified line | |||
| 61 | 73 | ||
| 62 | for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) { | 74 | for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) { |
| 63 | for (i = 0; i < bcm->num_nodes; i++) { | 75 | for (i = 0; i < bcm->num_nodes; i++) { |
| 64 | temp = bcm->nodes[i]->sum_avg[bucket] * bcm->aux_data.width; | 76 | node = bcm->nodes[i]; |
| 65 | do_div(temp, bcm->nodes[i]->buswidth * bcm->nodes[i]->channels); | 77 | temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width, |
| 78 | node->buswidth * node->channels); | ||
| 66 | agg_avg[bucket] = max(agg_avg[bucket], temp); | 79 | agg_avg[bucket] = max(agg_avg[bucket], temp); |
| 67 | 80 | ||
| 68 | temp = bcm->nodes[i]->max_peak[bucket] * bcm->aux_data.width; | 81 | temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width, |
| 69 | do_div(temp, bcm->nodes[i]->buswidth); | 82 | node->buswidth); |
| 70 | agg_peak[bucket] = max(agg_peak[bucket], temp); | 83 | agg_peak[bucket] = max(agg_peak[bucket], temp); |
| 71 | } | 84 | } |
| 72 | 85 | ||
| 73 | temp = agg_avg[bucket] * 1000ULL; | 86 | temp = agg_avg[bucket] * 1000ULL; |
| 74 | do_div(temp, bcm->aux_data.unit); | 87 | bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit); |
| 75 | bcm->vote_x[bucket] = temp; | ||
| 76 | 88 | ||
| 77 | temp = agg_peak[bucket] * 1000ULL; | 89 | temp = agg_peak[bucket] * 1000ULL; |
| 78 | do_div(temp, bcm->aux_data.unit); | 90 | bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit); |
| 79 | bcm->vote_y[bucket] = temp; | ||
| 80 | } | 91 | } |
| 81 | 92 | ||
| 82 | if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 && | 93 | if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 && |
| @@ -10,7 +10,7 @@ config AMD_IOMMU · 9 unmodified lines | |||
| 10 | select IOMMU_API | 10 | select IOMMU_API |
| 11 | select IOMMU_IOVA | 11 | select IOMMU_IOVA |
| 12 | select IOMMU_DMA | 12 | select IOMMU_DMA |
| 13 | depends on X86_64 && PCI && ACPI | 13 | depends on X86_64 && PCI && ACPI && HAVE_CMPXCHG_DOUBLE |
| 14 | help | 14 | help |
| 15 | With this option you can enable support for AMD IOMMU hardware in | 15 | With this option you can enable support for AMD IOMMU hardware in |
| 16 | your system. An IOMMU is a hardware component which provides | 16 | your system. An IOMMU is a hardware component which provides |
| @@ -1511,7 +1511,14 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h) · 1510 unmodified lines | |||
| 1511 | iommu->mmio_phys_end = MMIO_REG_END_OFFSET; | 1511 | iommu->mmio_phys_end = MMIO_REG_END_OFFSET; |
| 1512 | else | 1512 | else |
| 1513 | iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET; | 1513 | iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET; |
| 1514 | if (((h->efr_attr & (0x1 << IOMMU_FEAT_GASUP_SHIFT)) == 0)) | 1514 | |
| 1515 | /* | ||
| 1516 | * Note: GA (128-bit IRTE) mode requires cmpxchg16b supports. | ||
| 1517 | * GAM also requires GA mode. Therefore, we need to | ||
| 1518 | * check cmpxchg16b support before enabling it. | ||
| 1519 | */ | ||
| 1520 | if (!boot_cpu_has(X86_FEATURE_CX16) || | ||
| 1521 | ((h->efr_attr & (0x1 << IOMMU_FEAT_GASUP_SHIFT)) == 0)) | ||
| 1515 | amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY; | 1522 | amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY; |
| 1516 | break; | 1523 | break; |
| 1517 | case 0x11: | 1524 | case 0x11: |
| @@ -1520,8 +1527,18 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h) · 2 unmodified lines | |||
| 1520 | iommu->mmio_phys_end = MMIO_REG_END_OFFSET; | 1527 | iommu->mmio_phys_end = MMIO_REG_END_OFFSET; |
| 1521 | else | 1528 | else |
| 1522 | iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET; | 1529 | iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET; |
| 1523 | if (((h->efr_reg & (0x1 << IOMMU_EFR_GASUP_SHIFT)) == 0)) | 1530 | |
| 1531 | /* | ||
| 1532 | * Note: GA (128-bit IRTE) mode requires cmpxchg16b supports. | ||
| 1533 | * XT, GAM also requires GA mode. Therefore, we need to | ||
| 1534 | * check cmpxchg16b support before enabling them. | ||
| 1535 | */ | ||
| 1536 | if (!boot_cpu_has(X86_FEATURE_CX16) || | ||
| 1537 | ((h->efr_reg & (0x1 << IOMMU_EFR_GASUP_SHIFT)) == 0)) { | ||
| 1524 | amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY; | 1538 | amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY; |
| 1539 | break; | ||
| 1540 | } | ||
| 1541 | |||
| 1525 | /* | 1542 | /* |
| 1526 | * Note: Since iommu_update_intcapxt() leverages | 1543 | * Note: Since iommu_update_intcapxt() leverages |
| 1527 | * the IOMMU MMIO access to MSI capability block registers | 1544 | * the IOMMU MMIO access to MSI capability block registers |
| @@ -2659,7 +2659,12 @@ static int amd_iommu_def_domain_type(struct device *dev) · 2658 unmodified lines | |||
| 2659 | if (!dev_data) | 2659 | if (!dev_data) |
| 2660 | return 0; | 2660 | return 0; |
| 2661 | 2661 | ||
| 2662 | if (dev_data->iommu_v2) | 2662 | /* |
| 2663 | * Do not identity map IOMMUv2 capable devices when memory encryption is | ||
| 2664 | * active, because some of those devices (AMD GPUs) don't have the | ||
| 2665 | * encryption bit in their DMA-mask and require remapping. | ||
| 2666 | */ | ||
| 2667 | if (!mem_encrypt_active() && dev_data->iommu_v2) | ||
| 2663 | return IOMMU_DOMAIN_IDENTITY; | 2668 | return IOMMU_DOMAIN_IDENTITY; |
| 2664 | 2669 | ||
| 2665 | return 0; | 2670 | return 0; |
| @@ -3292,6 +3297,7 @@ out: · 626 unmodified lines | |||
| 3292 | static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte, | 3297 | static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte, |
| 3293 | struct amd_ir_data *data) | 3298 | struct amd_ir_data *data) |
| 3294 | { | 3299 | { |
| 3300 | bool ret; | ||
| 3295 | struct irq_remap_table *table; | 3301 | struct irq_remap_table *table; |
| 3296 | struct amd_iommu *iommu; | 3302 | struct amd_iommu *iommu; |
| 3297 | unsigned long flags; | 3303 | unsigned long flags; |
| @@ -3309,10 +3315,18 @@ static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte, · 11 unmodified lines | |||
| 3309 | 3315 | ||
| 3310 | entry = (struct irte_ga *)table->table; | 3316 | entry = (struct irte_ga *)table->table; |
| 3311 | entry = &entry[index]; | 3317 | entry = &entry[index]; |
| 3312 | entry->lo.fields_remap.valid = 0; | 3318 | |
| 3313 | entry->hi.val = irte->hi.val; | 3319 | ret = cmpxchg_double(&entry->lo.val, &entry->hi.val, |
| 3314 | entry->lo.val = irte->lo.val; | 3320 | entry->lo.val, entry->hi.val, |
| 3315 | entry->lo.fields_remap.valid = 1; | 3321 | irte->lo.val, irte->hi.val); |
| 3322 | /* | ||
| 3323 | * We use cmpxchg16 to atomically update the 128-bit IRTE, | ||
| 3324 | * and it cannot be updated by the hardware or other processors | ||
| 3325 | * behind us, so the return value of cmpxchg16 should be the | ||
| 3326 | * same as the old value. | ||
| 3327 | */ | ||
| 3328 | WARN_ON(!ret); | ||
| 3329 | |||
| 3316 | if (data) | 3330 | if (data) |
| 3317 | data->ref = entry; | 3331 | data->ref = entry; |
| 3318 | 3332 | ||
| @@ -3850,6 +3864,7 @@ int amd_iommu_deactivate_guest_mode(void *data) · 531 unmodified lines | |||
| 3850 | struct amd_ir_data *ir_data = (struct amd_ir_data *)data; | 3864 | struct amd_ir_data *ir_data = (struct amd_ir_data *)data; |
| 3851 | struct irte_ga *entry = (struct irte_ga *) ir_data->entry; | 3865 | struct irte_ga *entry = (struct irte_ga *) ir_data->entry; |
| 3852 | struct irq_cfg *cfg = ir_data->cfg; | 3866 | struct irq_cfg *cfg = ir_data->cfg; |
| 3867 | u64 valid = entry->lo.fields_remap.valid; | ||
| 3853 | 3868 | ||
| 3854 | if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) || | 3869 | if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) || |
| 3855 | !entry || !entry->lo.fields_vapic.guest_mode) | 3870 | !entry || !entry->lo.fields_vapic.guest_mode) |
| @@ -3858,6 +3873,7 @@ int amd_iommu_deactivate_guest_mode(void *data) · 2 unmodified lines | |||
| 3858 | entry->lo.val = 0; | 3873 | entry->lo.val = 0; |
| 3859 | entry->hi.val = 0; | 3874 | entry->hi.val = 0; |
| 3860 | 3875 | ||
| 3876 | entry->lo.fields_remap.valid = valid; | ||
| 3861 | entry->lo.fields_remap.dm = apic->irq_dest_mode; | 3877 | entry->lo.fields_remap.dm = apic->irq_dest_mode; |
| 3862 | entry->lo.fields_remap.int_type = apic->irq_delivery_mode; | 3878 | entry->lo.fields_remap.int_type = apic->irq_delivery_mode; |
| 3863 | entry->hi.fields.vector = cfg->vector; | 3879 | entry->hi.fields.vector = cfg->vector; |
| @@ -737,6 +737,13 @@ int amd_iommu_init_device(struct pci_dev *pdev, int pasids) · 736 unmodified lines | |||
| 737 | 737 | ||
| 738 | might_sleep(); | 738 | might_sleep(); |
| 739 | 739 | ||
| 740 | /* | ||
| 741 | * When memory encryption is active the device is likely not in a | ||
| 742 | * direct-mapped domain. Forbid using IOMMUv2 functionality for now. | ||
| 743 | */ | ||
| 744 | if (mem_encrypt_active()) | ||
| 745 | return -ENODEV; | ||
| 746 | |||
| 740 | if (!amd_iommu_v2_supported()) | 747 | if (!amd_iommu_v2_supported()) |
| 741 | return -ENODEV; | 748 | return -ENODEV; |
| 742 | 749 | ||
| @@ -123,29 +123,29 @@ static inline unsigned int level_to_offset_bits(int level) · 122 unmodified lines | |||
| 123 | return (level - 1) * LEVEL_STRIDE; | 123 | return (level - 1) * LEVEL_STRIDE; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static inline int pfn_level_offset(unsigned long pfn, int level) | 126 | static inline int pfn_level_offset(u64 pfn, int level) |
| 127 | { | 127 | { |
| 128 | return (pfn >> level_to_offset_bits(level)) & LEVEL_MASK; | 128 | return (pfn >> level_to_offset_bits(level)) & LEVEL_MASK; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | static inline unsigned long level_mask(int level) | 131 | static inline u64 level_mask(int level) |
| 132 | { | 132 | { |
| 133 | return -1UL << level_to_offset_bits(level); | 133 | return -1ULL << level_to_offset_bits(level); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | static inline unsigned long level_size(int level) | 136 | static inline u64 level_size(int level) |
| 137 | { | 137 | { |
| 138 | return 1UL << level_to_offset_bits(level); | 138 | return 1ULL << level_to_offset_bits(level); |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | static inline unsigned long align_to_level(unsigned long pfn, int level) | 141 | static inline u64 align_to_level(u64 pfn, int level) |
| 142 | { | 142 | { |
| 143 | return (pfn + level_size(level) - 1) & level_mask(level); | 143 | return (pfn + level_size(level) - 1) & level_mask(level); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | static inline unsigned long lvl_to_nr_pages(unsigned int lvl) | 146 | static inline unsigned long lvl_to_nr_pages(unsigned int lvl) |
| 147 | { | 147 | { |
| 148 | return 1 << min_t(int, (lvl - 1) * LEVEL_STRIDE, MAX_AGAW_PFN_WIDTH); | 148 | return 1UL << min_t(int, (lvl - 1) * LEVEL_STRIDE, MAX_AGAW_PFN_WIDTH); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | /* VT-d pages must always be _smaller_ than MM pages. Otherwise things | 151 | /* VT-d pages must always be _smaller_ than MM pages. Otherwise things |
| @@ -364,7 +364,6 @@ static int iommu_skip_te_disable; · 212 unmodified lines | |||
| 364 | int intel_iommu_gfx_mapped; | 364 | int intel_iommu_gfx_mapped; |
| 365 | EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped); | 365 | EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped); |
| 366 | 366 | ||
| 367 | #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) | ||
| 368 | #define DEFER_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-2)) | 367 | #define DEFER_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-2)) |
| 369 | struct device_domain_info *get_domain_info(struct device *dev) | 368 | struct device_domain_info *get_domain_info(struct device *dev) |
| 370 | { | 369 | { |
| @@ -374,8 +373,7 @@ struct device_domain_info *get_domain_info(struct device *dev) · 3 unmodified lines | |||
| 374 | return NULL; | 373 | return NULL; |
| 375 | 374 | ||
| 376 | info = dev_iommu_priv_get(dev); | 375 | info = dev_iommu_priv_get(dev); |
| 377 | if (unlikely(info == DUMMY_DEVICE_DOMAIN_INFO || | 376 | if (unlikely(info == DEFER_DEVICE_DOMAIN_INFO)) |
| 378 | info == DEFER_DEVICE_DOMAIN_INFO)) | ||
| 379 | return NULL; | 377 | return NULL; |
| 380 | 378 | ||
| 381 | return info; | 379 | return info; |
| @@ -742,11 +740,6 @@ struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus, · 360 unmodified lines | |||
| 742 | return &context[devfn]; | 740 | return &context[devfn]; |
| 743 | } | 741 | } |
| 744 | 742 | ||
| 745 | static int iommu_dummy(struct device *dev) | ||
| 746 | { | ||
| 747 | return dev_iommu_priv_get(dev) == DUMMY_DEVICE_DOMAIN_INFO; | ||
| 748 | } | ||
| 749 | |||
| 750 | static bool attach_deferred(struct device *dev) | 743 | static bool attach_deferred(struct device *dev) |
| 751 | { | 744 | { |
| 752 | return dev_iommu_priv_get(dev) == DEFER_DEVICE_DOMAIN_INFO; | 745 | return dev_iommu_priv_get(dev) == DEFER_DEVICE_DOMAIN_INFO; |
| @@ -779,6 +772,53 @@ is_downstream_to_pci_bridge(struct device *dev, struct device *bridge) · 26 unmodified lines | |||
| 779 | return false; | 772 | return false; |
| 780 | } | 773 | } |
| 781 | 774 | ||
| 775 | static bool quirk_ioat_snb_local_iommu(struct pci_dev *pdev) | ||
| 776 | { | ||
| 777 | struct dmar_drhd_unit *drhd; | ||
| 778 | u32 vtbar; | ||
| 779 | int rc; | ||
| 780 | |||
| 781 | /* We know that this device on this chipset has its own IOMMU. | ||
| 782 | * If we find it under a different IOMMU, then the BIOS is lying | ||
| 783 | * to us. Hope that the IOMMU for this device is actually | ||
| 784 | * disabled, and it needs no translation... | ||
| 785 | */ | ||
| 786 | rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0), 0xb0, &vtbar); | ||
| 787 | if (rc) { | ||
| 788 | /* "can't" happen */ | ||
| 789 | dev_info(&pdev->dev, "failed to run vt-d quirk\n"); | ||
| 790 | return false; | ||
| 791 | } | ||
| 792 | vtbar &= 0xffff0000; | ||
| 793 | |||
| 794 | /* we know that the this iommu should be at offset 0xa000 from vtbar */ | ||
| 795 | drhd = dmar_find_matched_drhd_unit(pdev); | ||
| 796 | if (!drhd || drhd->reg_base_addr - vtbar != 0xa000) { | ||
| 797 | pr_warn_once(FW_BUG "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n"); | ||
| 798 | add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); | ||
| 799 | return true; | ||
| 800 | } | ||
| 801 | |||
| 802 | return false; | ||
| 803 | } | ||
| 804 | |||
| 805 | static bool iommu_is_dummy(struct intel_iommu *iommu, struct device *dev) | ||
| 806 | { | ||
| 807 | if (!iommu || iommu->drhd->ignored) | ||
| 808 | return true; | ||
| 809 | |||
| 810 | if (dev_is_pci(dev)) { | ||
| 811 | struct pci_dev *pdev = to_pci_dev(dev); | ||
| 812 | |||
| 813 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
| 814 | pdev->device == PCI_DEVICE_ID_INTEL_IOAT_SNB && | ||
| 815 | quirk_ioat_snb_local_iommu(pdev)) | ||
| 816 | return true; | ||
| 817 | } | ||
| 818 | |||
| 819 | return false; | ||
| 820 | } | ||
| 821 | |||
| 782 | struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) | 822 | struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) |
| 783 | { | 823 | { |
| 784 | struct dmar_drhd_unit *drhd = NULL; | 824 | struct dmar_drhd_unit *drhd = NULL; |
| @@ -788,7 +828,7 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) · 3 unmodified lines | |||
| 788 | u16 segment = 0; | 828 | u16 segment = 0; |
| 789 | int i; | 829 | int i; |
| 790 | 830 | ||
| 791 | if (!dev || iommu_dummy(dev)) | 831 | if (!dev) |
| 792 | return NULL; | 832 | return NULL; |
| 793 | 833 | ||
| 794 | if (dev_is_pci(dev)) { | 834 | if (dev_is_pci(dev)) { |
| @@ -805,7 +845,7 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) · 10 unmodified lines | |||
| 805 | dev = &ACPI_COMPANION(dev)->dev; | 845 | dev = &ACPI_COMPANION(dev)->dev; |
| 806 | 846 | ||
| 807 | rcu_read_lock(); | 847 | rcu_read_lock(); |
| 808 | for_each_active_iommu(iommu, drhd) { | 848 | for_each_iommu(iommu, drhd) { |
| 809 | if (pdev && segment != drhd->segment) | 849 | if (pdev && segment != drhd->segment) |
| 810 | continue; | 850 | continue; |
| 811 | 851 | ||
| @@ -841,6 +881,9 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) · 29 unmodified lines | |||
| 841 | } | 881 | } |
| 842 | iommu = NULL; | 882 | iommu = NULL; |
| 843 | out: | 883 | out: |
| 884 | if (iommu_is_dummy(iommu, dev)) | ||
| 885 | iommu = NULL; | ||
| 886 | |||
| 844 | rcu_read_unlock(); | 887 | rcu_read_unlock(); |
| 845 | 888 | ||
| 846 | return iommu; | 889 | return iommu; |
| @@ -2447,7 +2490,7 @@ struct dmar_domain *find_domain(struct device *dev) · 1600 unmodified lines | |||
| 2447 | { | 2490 | { |
| 2448 | struct device_domain_info *info; | 2491 | struct device_domain_info *info; |
| 2449 | 2492 | ||
| 2450 | if (unlikely(attach_deferred(dev) || iommu_dummy(dev))) | 2493 | if (unlikely(attach_deferred(dev))) |
| 2451 | return NULL; | 2494 | return NULL; |
| 2452 | 2495 | ||
| 2453 | /* No lock here, assumes no domain exit in normal case */ | 2496 | /* No lock here, assumes no domain exit in normal case */ |
| @@ -3989,35 +4032,6 @@ static void __init iommu_exit_mempool(void) · 1535 unmodified lines | |||
| 3989 | iova_cache_put(); | 4032 | iova_cache_put(); |
| 3990 | } | 4033 | } |
| 3991 | 4034 | ||
| 3992 | static void quirk_ioat_snb_local_iommu(struct pci_dev *pdev) | ||
| 3993 | { | ||
| 3994 | struct dmar_drhd_unit *drhd; | ||
| 3995 | u32 vtbar; | ||
| 3996 | int rc; | ||
| 3997 | |||
| 3998 | /* We know that this device on this chipset has its own IOMMU. | ||
| 3999 | * If we find it under a different IOMMU, then the BIOS is lying | ||
| 4000 | * to us. Hope that the IOMMU for this device is actually | ||
| 4001 | * disabled, and it needs no translation... | ||
| 4002 | */ | ||
| 4003 | rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0), 0xb0, &vtbar); | ||
| 4004 | if (rc) { | ||
| 4005 | /* "can't" happen */ | ||
| 4006 | dev_info(&pdev->dev, "failed to run vt-d quirk\n"); | ||
| 4007 | return; | ||
| 4008 | } | ||
| 4009 | vtbar &= 0xffff0000; | ||
| 4010 | |||
| 4011 | /* we know that the this iommu should be at offset 0xa000 from vtbar */ | ||
| 4012 | drhd = dmar_find_matched_drhd_unit(pdev); | ||
| 4013 | if (!drhd || drhd->reg_base_addr - vtbar != 0xa000) { | ||
| 4014 | pr_warn_once(FW_BUG "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n"); | ||
| 4015 | add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); | ||
| 4016 | dev_iommu_priv_set(&pdev->dev, DUMMY_DEVICE_DOMAIN_INFO); | ||
| 4017 | } | ||
| 4018 | } | ||
| 4019 | DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SNB, quirk_ioat_snb_local_iommu); | ||
| 4020 | |||
| 4021 | static void __init init_no_remapping_devices(void) | 4035 | static void __init init_no_remapping_devices(void) |
| 4022 | { | 4036 | { |
| 4023 | struct dmar_drhd_unit *drhd; | 4037 | struct dmar_drhd_unit *drhd; |
| @@ -4049,12 +4063,8 @@ static void __init init_no_remapping_devices(void) · 25 unmodified lines | |||
| 4049 | /* This IOMMU has *only* gfx devices. Either bypass it or | 4063 | /* This IOMMU has *only* gfx devices. Either bypass it or |
| 4050 | set the gfx_mapped flag, as appropriate */ | 4064 | set the gfx_mapped flag, as appropriate */ |
| 4051 | drhd->gfx_dedicated = 1; | 4065 | drhd->gfx_dedicated = 1; |
| 4052 | if (!dmar_map_gfx) { | 4066 | if (!dmar_map_gfx) |
| 4053 | drhd->ignored = 1; | 4067 | drhd->ignored = 1; |
| 4054 | for_each_active_dev_scope(drhd->devices, | ||
| 4055 | drhd->devices_cnt, i, dev) | ||
| 4056 | dev_iommu_priv_set(dev, DUMMY_DEVICE_DOMAIN_INFO); | ||
| 4057 | } | ||
| 4058 | } | 4068 | } |
| 4059 | } | 4069 | } |
| 4060 | 4070 | ||
| @@ -508,12 +508,18 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu) · 507 unmodified lines | |||
| 508 | 508 | ||
| 509 | /* Enable interrupt-remapping */ | 509 | /* Enable interrupt-remapping */ |
| 510 | iommu->gcmd |= DMA_GCMD_IRE; | 510 | iommu->gcmd |= DMA_GCMD_IRE; |
| 511 | iommu->gcmd &= ~DMA_GCMD_CFI; /* Block compatibility-format MSIs */ | ||
| 512 | writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG); | 511 | writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG); |
| 513 | |||
| 514 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, | 512 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, |
| 515 | readl, (sts & DMA_GSTS_IRES), sts); | 513 | readl, (sts & DMA_GSTS_IRES), sts); |
| 516 | 514 | ||
| 515 | /* Block compatibility-format MSIs */ | ||
| 516 | if (sts & DMA_GSTS_CFIS) { | ||
| 517 | iommu->gcmd &= ~DMA_GCMD_CFI; | ||
| 518 | writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG); | ||
| 519 | IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, | ||
| 520 | readl, !(sts & DMA_GSTS_CFIS), sts); | ||
| 521 | } | ||
| 522 | |||
| 517 | /* | 523 | /* |
| 518 | * With CFI clear in the Global Command register, we should be | 524 | * With CFI clear in the Global Command register, we should be |
| 519 | * protected from dangerous (i.e. compatibility) interrupts | 525 | * protected from dangerous (i.e. compatibility) interrupts |
| @@ -537,12 +537,16 @@ static int __create_persistent_data_objects(struct dm_cache_metadata *cmd, · 536 unmodified lines | |||
| 537 | CACHE_MAX_CONCURRENT_LOCKS); | 537 | CACHE_MAX_CONCURRENT_LOCKS); |
| 538 | if (IS_ERR(cmd->bm)) { | 538 | if (IS_ERR(cmd->bm)) { |
| 539 | DMERR("could not create block manager"); | 539 | DMERR("could not create block manager"); |
| 540 | return PTR_ERR(cmd->bm); | 540 | r = PTR_ERR(cmd->bm); |
| 541 | cmd->bm = NULL; | ||
| 542 | return r; | ||
| 541 | } | 543 | } |
| 542 | 544 | ||
| 543 | r = __open_or_format_metadata(cmd, may_format_device); | 545 | r = __open_or_format_metadata(cmd, may_format_device); |
| 544 | if (r) | 546 | if (r) { |
| 545 | dm_block_manager_destroy(cmd->bm); | 547 | dm_block_manager_destroy(cmd->bm); |
| 548 | cmd->bm = NULL; | ||
| 549 | } | ||
| 546 | 550 | ||
| 547 | return r; | 551 | return r; |
| 548 | } | 552 | } |
| @@ -739,7 +739,7 @@ static int crypt_iv_eboiv_gen(struct crypt_config *cc, u8 *iv, · 738 unmodified lines | |||
| 739 | u8 buf[MAX_CIPHER_BLOCKSIZE] __aligned(__alignof__(__le64)); | 739 | u8 buf[MAX_CIPHER_BLOCKSIZE] __aligned(__alignof__(__le64)); |
| 740 | struct skcipher_request *req; | 740 | struct skcipher_request *req; |
| 741 | struct scatterlist src, dst; | 741 | struct scatterlist src, dst; |
| 742 | struct crypto_wait wait; | 742 | DECLARE_CRYPTO_WAIT(wait); |
| 743 | int err; | 743 | int err; |
| 744 | 744 | ||
| 745 | req = skcipher_request_alloc(any_tfm(cc), GFP_NOIO); | 745 | req = skcipher_request_alloc(any_tfm(cc), GFP_NOIO); |
| @@ -936,7 +936,7 @@ static int crypt_iv_elephant(struct crypt_config *cc, struct dm_crypt_request *d · 190 unmodified lines | |||
| 936 | u8 *es, *ks, *data, *data2, *data_offset; | 936 | u8 *es, *ks, *data, *data2, *data_offset; |
| 937 | struct skcipher_request *req; | 937 | struct skcipher_request *req; |
| 938 | struct scatterlist *sg, *sg2, src, dst; | 938 | struct scatterlist *sg, *sg2, src, dst; |
| 939 | struct crypto_wait wait; | 939 | DECLARE_CRYPTO_WAIT(wait); |
| 940 | int i, r; | 940 | int i, r; |
| 941 | 941 | ||
| 942 | req = skcipher_request_alloc(elephant->tfm, GFP_NOIO); | 942 | req = skcipher_request_alloc(elephant->tfm, GFP_NOIO); |
| @@ -2487,6 +2487,7 @@ next_chunk: · 2486 unmodified lines | |||
| 2487 | range.logical_sector = le64_to_cpu(ic->sb->recalc_sector); | 2487 | range.logical_sector = le64_to_cpu(ic->sb->recalc_sector); |
| 2488 | if (unlikely(range.logical_sector >= ic->provided_data_sectors)) { | 2488 | if (unlikely(range.logical_sector >= ic->provided_data_sectors)) { |
| 2489 | if (ic->mode == 'B') { | 2489 | if (ic->mode == 'B') { |
| 2490 | block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR); | ||
| 2490 | DEBUG_print("queue_delayed_work: bitmap_flush_work\n"); | 2491 | DEBUG_print("queue_delayed_work: bitmap_flush_work\n"); |
| 2491 | queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0); | 2492 | queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0); |
| 2492 | } | 2493 | } |
| @@ -2564,6 +2565,17 @@ next_chunk: · 71 unmodified lines | |||
| 2564 | goto err; | 2565 | goto err; |
| 2565 | } | 2566 | } |
| 2566 | 2567 | ||
| 2568 | if (ic->mode == 'B') { | ||
| 2569 | sector_t start, end; | ||
| 2570 | start = (range.logical_sector >> | ||
| 2571 | (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) << | ||
| 2572 | (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit); | ||
| 2573 | end = ((range.logical_sector + range.n_sectors) >> | ||
| 2574 | (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) << | ||
| 2575 | (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit); | ||
| 2576 | block_bitmap_op(ic, ic->recalc_bitmap, start, end - start, BITMAP_OP_CLEAR); | ||
| 2577 | } | ||
| 2578 | |||
| 2567 | advance_and_next: | 2579 | advance_and_next: |
| 2568 | cond_resched(); | 2580 | cond_resched(); |
| 2569 | 2581 | ||
| @@ -1287,17 +1287,25 @@ static void multipath_wait_for_pg_init_completion(struct multipath *m) · 1286 unmodified lines | |||
| 1287 | static void flush_multipath_work(struct multipath *m) | 1287 | static void flush_multipath_work(struct multipath *m) |
| 1288 | { | 1288 | { |
| 1289 | if (m->hw_handler_name) { | 1289 | if (m->hw_handler_name) { |
| 1290 | set_bit(MPATHF_PG_INIT_DISABLED, &m->flags); | 1290 | unsigned long flags; |
| 1291 | smp_mb__after_atomic(); | 1291 | |
| 1292 | if (!atomic_read(&m->pg_init_in_progress)) | ||
| 1293 | goto skip; | ||
| 1294 | |||
| 1295 | spin_lock_irqsave(&m->lock, flags); | ||
| 1296 | if (atomic_read(&m->pg_init_in_progress) && | ||
| 1297 | !test_and_set_bit(MPATHF_PG_INIT_DISABLED, &m->flags)) { | ||
| 1298 | spin_unlock_irqrestore(&m->lock, flags); | ||
| 1292 | 1299 | ||
| 1293 | if (atomic_read(&m->pg_init_in_progress)) | ||
| 1294 | flush_workqueue(kmpath_handlerd); | 1300 | flush_workqueue(kmpath_handlerd); |
| 1295 | multipath_wait_for_pg_init_completion(m); | 1301 | multipath_wait_for_pg_init_completion(m); |
| 1296 | 1302 | ||
| 1297 | clear_bit(MPATHF_PG_INIT_DISABLED, &m->flags); | 1303 | spin_lock_irqsave(&m->lock, flags); |
| 1298 | smp_mb__after_atomic(); | 1304 | clear_bit(MPATHF_PG_INIT_DISABLED, &m->flags); |
| 1305 | } | ||
| 1306 | spin_unlock_irqrestore(&m->lock, flags); | ||
| 1299 | } | 1307 | } |
| 1300 | 1308 | skip: | |
| 1301 | if (m->queue_mode == DM_TYPE_BIO_BASED) | 1309 | if (m->queue_mode == DM_TYPE_BIO_BASED) |
| 1302 | flush_work(&m->process_queued_bios); | 1310 | flush_work(&m->process_queued_bios); |
| 1303 | flush_work(&m->trigger_event); | 1311 | flush_work(&m->trigger_event); |
| @@ -739,12 +739,16 @@ static int __create_persistent_data_objects(struct dm_pool_metadata *pmd, bool f · 738 unmodified lines | |||
| 739 | THIN_MAX_CONCURRENT_LOCKS); | 739 | THIN_MAX_CONCURRENT_LOCKS); |
| 740 | if (IS_ERR(pmd->bm)) { | 740 | if (IS_ERR(pmd->bm)) { |
| 741 | DMERR("could not create block manager"); | 741 | DMERR("could not create block manager"); |
| 742 | return PTR_ERR(pmd->bm); | 742 | r = PTR_ERR(pmd->bm); |
| 743 | pmd->bm = NULL; | ||
| 744 | return r; | ||
| 743 | } | 745 | } |
| 744 | 746 | ||
| 745 | r = __open_or_format_metadata(pmd, format_device); | 747 | r = __open_or_format_metadata(pmd, format_device); |
| 746 | if (r) | 748 | if (r) { |
| 747 | dm_block_manager_destroy(pmd->bm); | 749 | dm_block_manager_destroy(pmd->bm); |
| 750 | pmd->bm = NULL; | ||
| 751 | } | ||
| 748 | 752 | ||
| 749 | return r; | 753 | return r; |
| 750 | } | 754 | } |
| @@ -954,7 +958,7 @@ int dm_pool_metadata_close(struct dm_pool_metadata *pmd) · 203 unmodified lines | |||
| 954 | } | 958 | } |
| 955 | 959 | ||
| 956 | pmd_write_lock_in_core(pmd); | 960 | pmd_write_lock_in_core(pmd); |
| 957 | if (!dm_bm_is_read_only(pmd->bm) && !pmd->fail_io) { | 961 | if (!pmd->fail_io && !dm_bm_is_read_only(pmd->bm)) { |
| 958 | r = __commit_transaction(pmd); | 962 | r = __commit_transaction(pmd); |
| 959 | if (r < 0) | 963 | if (r < 0) |
| 960 | DMWARN("%s: __commit_transaction() failed, error = %d", | 964 | DMWARN("%s: __commit_transaction() failed, error = %d", |
| @@ -231,6 +231,7 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 230 unmodified lines | |||
| 231 | pfn_t pfn; | 231 | pfn_t pfn; |
| 232 | int id; | 232 | int id; |
| 233 | struct page **pages; | 233 | struct page **pages; |
| 234 | sector_t offset; | ||
| 234 | 235 | ||
| 235 | wc->memory_vmapped = false; | 236 | wc->memory_vmapped = false; |
| 236 | 237 | ||
| @@ -245,9 +246,16 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 8 unmodified lines | |||
| 245 | goto err1; | 246 | goto err1; |
| 246 | } | 247 | } |
| 247 | 248 | ||
| 249 | offset = get_start_sect(wc->ssd_dev->bdev); | ||
| 250 | if (offset & (PAGE_SIZE / 512 - 1)) { | ||
| 251 | r = -EINVAL; | ||
| 252 | goto err1; | ||
| 253 | } | ||
| 254 | offset >>= PAGE_SHIFT - 9; | ||
| 255 | |||
| 248 | id = dax_read_lock(); | 256 | id = dax_read_lock(); |
| 249 | 257 | ||
| 250 | da = dax_direct_access(wc->ssd_dev->dax_dev, 0, p, &wc->memory_map, &pfn); | 258 | da = dax_direct_access(wc->ssd_dev->dax_dev, offset, p, &wc->memory_map, &pfn); |
| 251 | if (da < 0) { | 259 | if (da < 0) { |
| 252 | wc->memory_map = NULL; | 260 | wc->memory_map = NULL; |
| 253 | r = da; | 261 | r = da; |
| @@ -269,7 +277,7 @@ static int persistent_memory_claim(struct dm_writecache *wc) · 15 unmodified lines | |||
| 269 | i = 0; | 277 | i = 0; |
| 270 | do { | 278 | do { |
| 271 | long daa; | 279 | long daa; |
| 272 | daa = dax_direct_access(wc->ssd_dev->dax_dev, i, p - i, | 280 | daa = dax_direct_access(wc->ssd_dev->dax_dev, offset + i, p - i, |
| 273 | NULL, &pfn); | 281 | NULL, &pfn); |
| 274 | if (daa <= 0) { | 282 | if (daa <= 0) { |
| 275 | r = daa ? daa : -EINVAL; | 283 | r = daa ? daa : -EINVAL; |
| @@ -493,7 +493,7 @@ int dm_bm_write_lock(struct dm_block_manager *bm, · 492 unmodified lines | |||
| 493 | void *p; | 493 | void *p; |
| 494 | int r; | 494 | int r; |
| 495 | 495 | ||
| 496 | if (bm->read_only) | 496 | if (dm_bm_is_read_only(bm)) |
| 497 | return -EPERM; | 497 | return -EPERM; |
| 498 | 498 | ||
| 499 | p = dm_bufio_read(bm->bufio, b, (struct dm_buffer **) result); | 499 | p = dm_bufio_read(bm->bufio, b, (struct dm_buffer **) result); |
| @@ -562,7 +562,7 @@ int dm_bm_write_lock_zero(struct dm_block_manager *bm, · 62 unmodified lines | |||
| 562 | struct buffer_aux *aux; | 562 | struct buffer_aux *aux; |
| 563 | void *p; | 563 | void *p; |
| 564 | 564 | ||
| 565 | if (bm->read_only) | 565 | if (dm_bm_is_read_only(bm)) |
| 566 | return -EPERM; | 566 | return -EPERM; |
| 567 | 567 | ||
| 568 | p = dm_bufio_new(bm->bufio, b, (struct dm_buffer **) result); | 568 | p = dm_bufio_new(bm->bufio, b, (struct dm_buffer **) result); |
| @@ -602,7 +602,7 @@ EXPORT_SYMBOL_GPL(dm_bm_unlock); · 33 unmodified lines | |||
| 602 | 602 | ||
| 603 | int dm_bm_flush(struct dm_block_manager *bm) | 603 | int dm_bm_flush(struct dm_block_manager *bm) |
| 604 | { | 604 | { |
| 605 | if (bm->read_only) | 605 | if (dm_bm_is_read_only(bm)) |
| 606 | return -EPERM; | 606 | return -EPERM; |
| 607 | 607 | ||
| 608 | return dm_bufio_write_dirty_buffers(bm->bufio); | 608 | return dm_bufio_write_dirty_buffers(bm->bufio); |
| @@ -616,19 +616,21 @@ void dm_bm_prefetch(struct dm_block_manager *bm, dm_block_t b) · 7 unmodified lines | |||
| 616 | 616 | ||
| 617 | bool dm_bm_is_read_only(struct dm_block_manager *bm) | 617 | bool dm_bm_is_read_only(struct dm_block_manager *bm) |
| 618 | { | 618 | { |
| 619 | return bm->read_only; | 619 | return (bm ? bm->read_only : true); |
| 620 | } | 620 | } |
| 621 | EXPORT_SYMBOL_GPL(dm_bm_is_read_only); | 621 | EXPORT_SYMBOL_GPL(dm_bm_is_read_only); |
| 622 | 622 | ||
| 623 | void dm_bm_set_read_only(struct dm_block_manager *bm) | 623 | void dm_bm_set_read_only(struct dm_block_manager *bm) |
| 624 | { | 624 | { |
| 625 | bm->read_only = true; | 625 | if (bm) |
| 626 | bm->read_only = true; | ||
| 626 | } | 627 | } |
| 627 | EXPORT_SYMBOL_GPL(dm_bm_set_read_only); | 628 | EXPORT_SYMBOL_GPL(dm_bm_set_read_only); |
| 628 | 629 | ||
| 629 | void dm_bm_set_read_write(struct dm_block_manager *bm) | 630 | void dm_bm_set_read_write(struct dm_block_manager *bm) |
| 630 | { | 631 | { |
| 631 | bm->read_only = false; | 632 | if (bm) |
| 633 | bm->read_only = false; | ||
| 632 | } | 634 | } |
| 633 | EXPORT_SYMBOL_GPL(dm_bm_set_read_write); | 635 | EXPORT_SYMBOL_GPL(dm_bm_set_read_write); |
| 634 | 636 | ||
| @@ -467,7 +467,7 @@ config VIDEO_VPX3220 · 466 unmodified lines | |||
| 467 | config VIDEO_MAX9286 | 467 | config VIDEO_MAX9286 |
| 468 | tristate "Maxim MAX9286 GMSL deserializer support" | 468 | tristate "Maxim MAX9286 GMSL deserializer support" |
| 469 | depends on I2C && I2C_MUX | 469 | depends on I2C && I2C_MUX |
| 470 | depends on OF | 470 | depends on OF_GPIO |
| 471 | select V4L2_FWNODE | 471 | select V4L2_FWNODE |
| 472 | select VIDEO_V4L2_SUBDEV_API | 472 | select VIDEO_V4L2_SUBDEV_API |
| 473 | select MEDIA_CONTROLLER | 473 | select MEDIA_CONTROLLER |
| @@ -741,7 +741,7 @@ config VIDEO_HI556 · 267 unmodified lines | |||
| 741 | config VIDEO_IMX214 | 741 | config VIDEO_IMX214 |
| 742 | tristate "Sony IMX214 sensor support" | 742 | tristate "Sony IMX214 sensor support" |
| 743 | depends on GPIOLIB && I2C && VIDEO_V4L2 | 743 | depends on GPIOLIB && I2C && VIDEO_V4L2 |
| 744 | depends on V4L2_FWNODE | 744 | select V4L2_FWNODE |
| 745 | select MEDIA_CONTROLLER | 745 | select MEDIA_CONTROLLER |
| 746 | select VIDEO_V4L2_SUBDEV_API | 746 | select VIDEO_V4L2_SUBDEV_API |
| 747 | select REGMAP_I2C | 747 | select REGMAP_I2C |
| @@ -226,7 +226,7 @@ static inline void cal_write_field(struct cal_dev *cal, u32 offset, u32 value, · 225 unmodified lines | |||
| 226 | u32 val = cal_read(cal, offset); | 226 | u32 val = cal_read(cal, offset); |
| 227 | 227 | ||
| 228 | val &= ~mask; | 228 | val &= ~mask; |
| 229 | val |= FIELD_PREP(mask, value); | 229 | val |= (value << __ffs(mask)) & mask; |
| 230 | cal_write(cal, offset, val); | 230 | cal_write(cal, offset, val); |
| 231 | } | 231 | } |
| 232 | 232 | ||
| @@ -19,8 +19,6 @@ struct gpio_ir { · 18 unmodified lines | |||
| 19 | struct gpio_desc *gpio; | 19 | struct gpio_desc *gpio; |
| 20 | unsigned int carrier; | 20 | unsigned int carrier; |
| 21 | unsigned int duty_cycle; | 21 | unsigned int duty_cycle; |
| 22 | /* we need a spinlock to hold the cpu while transmitting */ | ||
| 23 | spinlock_t lock; | ||
| 24 | }; | 22 | }; |
| 25 | 23 | ||
| 26 | static const struct of_device_id gpio_ir_tx_of_match[] = { | 24 | static const struct of_device_id gpio_ir_tx_of_match[] = { |
| @@ -53,12 +51,11 @@ static int gpio_ir_tx_set_carrier(struct rc_dev *dev, u32 carrier) · 26 unmodified lines | |||
| 53 | static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, | 51 | static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, |
| 54 | uint count) | 52 | uint count) |
| 55 | { | 53 | { |
| 56 | unsigned long flags; | ||
| 57 | ktime_t edge; | 54 | ktime_t edge; |
| 58 | s32 delta; | 55 | s32 delta; |
| 59 | int i; | 56 | int i; |
| 60 | 57 | ||
| 61 | spin_lock_irqsave(&gpio_ir->lock, flags); | 58 | local_irq_disable(); |
| 62 | 59 | ||
| 63 | edge = ktime_get(); | 60 | edge = ktime_get(); |
| 64 | 61 | ||
| @@ -72,14 +69,11 @@ static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, · 7 unmodified lines | |||
| 72 | } | 69 | } |
| 73 | 70 | ||
| 74 | gpiod_set_value(gpio_ir->gpio, 0); | 71 | gpiod_set_value(gpio_ir->gpio, 0); |
| 75 | |||
| 76 | spin_unlock_irqrestore(&gpio_ir->lock, flags); | ||
| 77 | } | 72 | } |
| 78 | 73 | ||
| 79 | static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, | 74 | static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, |
| 80 | uint count) | 75 | uint count) |
| 81 | { | 76 | { |
| 82 | unsigned long flags; | ||
| 83 | ktime_t edge; | 77 | ktime_t edge; |
| 84 | /* | 78 | /* |
| 85 | * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on | 79 | * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on |
| @@ -95,7 +89,7 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, · 9 unmodified lines | |||
| 95 | space = DIV_ROUND_CLOSEST((100 - gpio_ir->duty_cycle) * | 89 | space = DIV_ROUND_CLOSEST((100 - gpio_ir->duty_cycle) * |
| 96 | (NSEC_PER_SEC / 100), gpio_ir->carrier); | 90 | (NSEC_PER_SEC / 100), gpio_ir->carrier); |
| 97 | 91 | ||
| 98 | spin_lock_irqsave(&gpio_ir->lock, flags); | 92 | local_irq_disable(); |
| 99 | 93 | ||
| 100 | edge = ktime_get(); | 94 | edge = ktime_get(); |
| 101 | 95 | ||
| @@ -128,19 +122,20 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, · 26 unmodified lines | |||
| 128 | edge = last; | 122 | edge = last; |
| 129 | } | 123 | } |
| 130 | } | 124 | } |
| 131 | |||
| 132 | spin_unlock_irqrestore(&gpio_ir->lock, flags); | ||
| 133 | } | 125 | } |
| 134 | 126 | ||
| 135 | static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf, | 127 | static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf, |
| 136 | unsigned int count) | 128 | unsigned int count) |
| 137 | { | 129 | { |
| 138 | struct gpio_ir *gpio_ir = dev->priv; | 130 | struct gpio_ir *gpio_ir = dev->priv; |
| 131 | unsigned long flags; | ||
| 139 | 132 | ||
| 133 | local_irq_save(flags); | ||
| 140 | if (gpio_ir->carrier) | 134 | if (gpio_ir->carrier) |
| 141 | gpio_ir_tx_modulated(gpio_ir, txbuf, count); | 135 | gpio_ir_tx_modulated(gpio_ir, txbuf, count); |
| 142 | else | 136 | else |
| 143 | gpio_ir_tx_unmodulated(gpio_ir, txbuf, count); | 137 | gpio_ir_tx_unmodulated(gpio_ir, txbuf, count); |
| 138 | local_irq_restore(flags); | ||
| 144 | 139 | ||
| 145 | return count; | 140 | return count; |
| 146 | } | 141 | } |
| @@ -176,7 +171,6 @@ static int gpio_ir_tx_probe(struct platform_device *pdev) · 29 unmodified lines | |||
| 176 | 171 | ||
| 177 | gpio_ir->carrier = 38000; | 172 | gpio_ir->carrier = 38000; |
| 178 | gpio_ir->duty_cycle = 50; | 173 | gpio_ir->duty_cycle = 50; |
| 179 | spin_lock_init(&gpio_ir->lock); | ||
| 180 | 174 | ||
| 181 | rc = devm_rc_register_device(&pdev->dev, rcdev); | 175 | rc = devm_rc_register_device(&pdev->dev, rcdev); |
| 182 | if (rc < 0) | 176 | if (rc < 0) |
| @@ -1726,7 +1726,7 @@ static int mceusb_dev_probe(struct usb_interface *intf, · 1725 unmodified lines | |||
| 1726 | goto mem_alloc_fail; | 1726 | goto mem_alloc_fail; |
| 1727 | 1727 | ||
| 1728 | ir->pipe_in = pipe; | 1728 | ir->pipe_in = pipe; |
| 1729 | ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_ATOMIC, &ir->dma_in); | 1729 | ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_KERNEL, &ir->dma_in); |
| 1730 | if (!ir->buf_in) | 1730 | if (!ir->buf_in) |
| 1731 | goto buf_in_alloc_fail; | 1731 | goto buf_in_alloc_fail; |
| 1732 | 1732 | ||
| @@ -1292,6 +1292,10 @@ static ssize_t store_protocols(struct device *device, · 1291 unmodified lines | |||
| 1292 | } | 1292 | } |
| 1293 | 1293 | ||
| 1294 | mutex_lock(&dev->lock); | 1294 | mutex_lock(&dev->lock); |
| 1295 | if (!dev->registered) { | ||
| 1296 | mutex_unlock(&dev->lock); | ||
| 1297 | return -ENODEV; | ||
| 1298 | } | ||
| 1295 | 1299 | ||
| 1296 | old_protocols = *current_protocols; | 1300 | old_protocols = *current_protocols; |
| 1297 | new_protocols = old_protocols; | 1301 | new_protocols = old_protocols; |
| @@ -1430,6 +1434,10 @@ static ssize_t store_filter(struct device *device, · 132 unmodified lines | |||
| 1430 | return -EINVAL; | 1434 | return -EINVAL; |
| 1431 | 1435 | ||
| 1432 | mutex_lock(&dev->lock); | 1436 | mutex_lock(&dev->lock); |
| 1437 | if (!dev->registered) { | ||
| 1438 | mutex_unlock(&dev->lock); | ||
| 1439 | return -ENODEV; | ||
| 1440 | } | ||
| 1433 | 1441 | ||
| 1434 | new_filter = *filter; | 1442 | new_filter = *filter; |
| 1435 | if (fattr->mask) | 1443 | if (fattr->mask) |
| @@ -1544,6 +1552,10 @@ static ssize_t store_wakeup_protocols(struct device *device, · 108 unmodified lines | |||
| 1544 | int i; | 1552 | int i; |
| 1545 | 1553 | ||
| 1546 | mutex_lock(&dev->lock); | 1554 | mutex_lock(&dev->lock); |
| 1555 | if (!dev->registered) { | ||
| 1556 | mutex_unlock(&dev->lock); | ||
| 1557 | return -ENODEV; | ||
| 1558 | } | ||
| 1547 | 1559 | ||
| 1548 | allowed = dev->allowed_wakeup_protocols; | 1560 | allowed = dev->allowed_wakeup_protocols; |
| 1549 | 1561 | ||
| @@ -1601,25 +1613,25 @@ static void rc_dev_release(struct device *device) · 51 unmodified lines | |||
| 1601 | kfree(dev); | 1613 | kfree(dev); |
| 1602 | } | 1614 | } |
| 1603 | 1615 | ||
| 1604 | #define ADD_HOTPLUG_VAR(fmt, val...) \ | ||
| 1605 | do { \ | ||
| 1606 | int err = add_uevent_var(env, fmt, val); \ | ||
| 1607 | if (err) \ | ||
| 1608 | return err; \ | ||
| 1609 | } while (0) | ||
| 1610 | |||
| 1611 | static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) | 1616 | static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) |
| 1612 | { | 1617 | { |
| 1613 | struct rc_dev *dev = to_rc_dev(device); | 1618 | struct rc_dev *dev = to_rc_dev(device); |
| 1619 | int ret = 0; | ||
| 1614 | 1620 | ||
| 1615 | if (dev->rc_map.name) | 1621 | mutex_lock(&dev->lock); |
| 1616 | ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name); | ||
| 1617 | if (dev->driver_name) | ||
| 1618 | ADD_HOTPLUG_VAR("DRV_NAME=%s", dev->driver_name); | ||
| 1619 | if (dev->device_name) | ||
| 1620 | ADD_HOTPLUG_VAR("DEV_NAME=%s", dev->device_name); | ||
| 1621 | 1622 | ||
| 1622 | return 0; | 1623 | if (!dev->registered) |
| 1624 | ret = -ENODEV; | ||
| 1625 | if (ret == 0 && dev->rc_map.name) | ||
| 1626 | ret = add_uevent_var(env, "NAME=%s", dev->rc_map.name); | ||
| 1627 | if (ret == 0 && dev->driver_name) | ||
| 1628 | ret = add_uevent_var(env, "DRV_NAME=%s", dev->driver_name); | ||
| 1629 | if (ret == 0 && dev->device_name) | ||
| 1630 | ret = add_uevent_var(env, "DEV_NAME=%s", dev->device_name); | ||
| 1631 | |||
| 1632 | mutex_unlock(&dev->lock); | ||
| 1633 | |||
| 1634 | return ret; | ||
| 1623 | } | 1635 | } |
| 1624 | 1636 | ||
| 1625 | /* | 1637 | /* |
| @@ -2011,14 +2023,14 @@ void rc_unregister_device(struct rc_dev *dev) · 385 unmodified lines | |||
| 2011 | del_timer_sync(&dev->timer_keyup); | 2023 | del_timer_sync(&dev->timer_keyup); |
| 2012 | del_timer_sync(&dev->timer_repeat); | 2024 | del_timer_sync(&dev->timer_repeat); |
| 2013 | 2025 | ||
| 2014 | rc_free_rx_device(dev); | ||
| 2015 | |||
| 2016 | mutex_lock(&dev->lock); | 2026 | mutex_lock(&dev->lock); |
| 2017 | if (dev->users && dev->close) | 2027 | if (dev->users && dev->close) |
| 2018 | dev->close(dev); | 2028 | dev->close(dev); |
| 2019 | dev->registered = false; | 2029 | dev->registered = false; |
| 2020 | mutex_unlock(&dev->lock); | 2030 | mutex_unlock(&dev->lock); |
| 2021 | 2031 | ||
| 2032 | rc_free_rx_device(dev); | ||
| 2033 | |||
| 2022 | /* | 2034 | /* |
| 2023 | * lirc device should be freed with dev->registered = false, so | 2035 | * lirc device should be freed with dev->registered = false, so |
| 2024 | * that userspace polling will get notified. | 2036 | * that userspace polling will get notified. |
| @@ -1994,6 +1994,7 @@ static int vicodec_request_validate(struct media_request *req) · 1993 unmodified lines | |||
| 1994 | } | 1994 | } |
| 1995 | ctrl = v4l2_ctrl_request_hdl_ctrl_find(hdl, | 1995 | ctrl = v4l2_ctrl_request_hdl_ctrl_find(hdl, |
| 1996 | vicodec_ctrl_stateless_state.id); | 1996 | vicodec_ctrl_stateless_state.id); |
| 1997 | v4l2_ctrl_request_hdl_put(hdl); | ||
| 1997 | if (!ctrl) { | 1998 | if (!ctrl) { |
| 1998 | v4l2_info(&ctx->dev->v4l2_dev, | 1999 | v4l2_info(&ctx->dev->v4l2_dev, |
| 1999 | "Missing required codec control\n"); | 2000 | "Missing required codec control\n"); |
| @@ -3187,14 +3187,16 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd) · 3186 unmodified lines | |||
| 3187 | #ifdef CONFIG_COMPAT_32BIT_TIME | 3187 | #ifdef CONFIG_COMPAT_32BIT_TIME |
| 3188 | case VIDIOC_DQEVENT_TIME32: { | 3188 | case VIDIOC_DQEVENT_TIME32: { |
| 3189 | struct v4l2_event *ev = parg; | 3189 | struct v4l2_event *ev = parg; |
| 3190 | struct v4l2_event_time32 ev32 = { | 3190 | struct v4l2_event_time32 ev32; |
| 3191 | .type = ev->type, | 3191 | |
| 3192 | .pending = ev->pending, | 3192 | memset(&ev32, 0, sizeof(ev32)); |
| 3193 | .sequence = ev->sequence, | 3193 | |
| 3194 | .timestamp.tv_sec = ev->timestamp.tv_sec, | 3194 | ev32.type = ev->type; |
| 3195 | .timestamp.tv_nsec = ev->timestamp.tv_nsec, | 3195 | ev32.pending = ev->pending; |
| 3196 | .id = ev->id, | 3196 | ev32.sequence = ev->sequence; |
| 3197 | }; | 3197 | ev32.timestamp.tv_sec = ev->timestamp.tv_sec; |
| 3198 | ev32.timestamp.tv_nsec = ev->timestamp.tv_nsec; | ||
| 3199 | ev32.id = ev->id; | ||
| 3198 | 3200 | ||
| 3199 | memcpy(&ev32.u, &ev->u, sizeof(ev->u)); | 3201 | memcpy(&ev32.u, &ev->u, sizeof(ev->u)); |
| 3200 | memcpy(&ev32.reserved, &ev->reserved, sizeof(ev->reserved)); | 3202 | memcpy(&ev32.reserved, &ev->reserved, sizeof(ev->reserved)); |
| @@ -3208,21 +3210,23 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd) · 7 unmodified lines | |||
| 3208 | case VIDIOC_DQBUF_TIME32: | 3210 | case VIDIOC_DQBUF_TIME32: |
| 3209 | case VIDIOC_PREPARE_BUF_TIME32: { | 3211 | case VIDIOC_PREPARE_BUF_TIME32: { |
| 3210 | struct v4l2_buffer *vb = parg; | 3212 | struct v4l2_buffer *vb = parg; |
| 3211 | struct v4l2_buffer_time32 vb32 = { | 3213 | struct v4l2_buffer_time32 vb32; |
| 3212 | .index = vb->index, | 3214 | |
| 3213 | .type = vb->type, | 3215 | memset(&vb32, 0, sizeof(vb32)); |
| 3214 | .bytesused = vb->bytesused, | 3216 | |
| 3215 | .flags = vb->flags, | 3217 | vb32.index = vb->index; |
| 3216 | .field = vb->field, | 3218 | vb32.type = vb->type; |
| 3217 | .timestamp.tv_sec = vb->timestamp.tv_sec, | 3219 | vb32.bytesused = vb->bytesused; |
| 3218 | .timestamp.tv_usec = vb->timestamp.tv_usec, | 3220 | vb32.flags = vb->flags; |
| 3219 | .timecode = vb->timecode, | 3221 | vb32.field = vb->field; |
| 3220 | .sequence = vb->sequence, | 3222 | vb32.timestamp.tv_sec = vb->timestamp.tv_sec; |
| 3221 | .memory = vb->memory, | 3223 | vb32.timestamp.tv_usec = vb->timestamp.tv_usec; |
| 3222 | .m.userptr = vb->m.userptr, | 3224 | vb32.timecode = vb->timecode; |
| 3223 | .length = vb->length, | 3225 | vb32.sequence = vb->sequence; |
| 3224 | .request_fd = vb->request_fd, | 3226 | vb32.memory = vb->memory; |
| 3225 | }; | 3227 | vb32.m.userptr = vb->m.userptr; |
| 3228 | vb32.length = vb->length; | ||
| 3229 | vb32.request_fd = vb->request_fd; | ||
| 3226 | 3230 | ||
| 3227 | if (copy_to_user(arg, &vb32, sizeof(vb32))) | 3231 | if (copy_to_user(arg, &vb32, sizeof(vb32))) |
| 3228 | return -EFAULT; | 3232 | return -EFAULT; |
| @@ -692,10 +692,6 @@ static int at24_probe(struct i2c_client *client) · 691 unmodified lines | |||
| 692 | nvmem_config.word_size = 1; | 692 | nvmem_config.word_size = 1; |
| 693 | nvmem_config.size = byte_len; | 693 | nvmem_config.size = byte_len; |
| 694 | 694 | ||
| 695 | at24->nvmem = devm_nvmem_register(dev, &nvmem_config); | ||
| 696 | if (IS_ERR(at24->nvmem)) | ||
| 697 | return PTR_ERR(at24->nvmem); | ||
| 698 | |||
| 699 | i2c_set_clientdata(client, at24); | 695 | i2c_set_clientdata(client, at24); |
| 700 | 696 | ||
| 701 | err = regulator_enable(at24->vcc_reg); | 697 | err = regulator_enable(at24->vcc_reg); |
| @@ -708,6 +704,13 @@ static int at24_probe(struct i2c_client *client) · 6 unmodified lines | |||
| 708 | pm_runtime_set_active(dev); | 704 | pm_runtime_set_active(dev); |
| 709 | pm_runtime_enable(dev); | 705 | pm_runtime_enable(dev); |
| 710 | 706 | ||
| 707 | at24->nvmem = devm_nvmem_register(dev, &nvmem_config); | ||
| 708 | if (IS_ERR(at24->nvmem)) { | ||
| 709 | pm_runtime_disable(dev); | ||
| 710 | regulator_disable(at24->vcc_reg); | ||
| 711 | return PTR_ERR(at24->nvmem); | ||
| 712 | } | ||
| 713 | |||
| 711 | /* | 714 | /* |
| 712 | * Perform a one-byte test read to verify that the | 715 | * Perform a one-byte test read to verify that the |
| 713 | * chip is functional. | 716 | * chip is functional. |
| @@ -982,7 +982,7 @@ static ssize_t hl_clk_gate_read(struct file *f, char __user *buf, · 981 unmodified lines | |||
| 982 | return 0; | 982 | return 0; |
| 983 | 983 | ||
| 984 | sprintf(tmp_buf, "0x%llx\n", hdev->clock_gating_mask); | 984 | sprintf(tmp_buf, "0x%llx\n", hdev->clock_gating_mask); |
| 985 | rc = simple_read_from_buffer(buf, strlen(tmp_buf) + 1, ppos, tmp_buf, | 985 | rc = simple_read_from_buffer(buf, count, ppos, tmp_buf, |
| 986 | strlen(tmp_buf) + 1); | 986 | strlen(tmp_buf) + 1); |
| 987 | 987 | ||
| 988 | return rc; | 988 | return rc; |
| @@ -378,15 +378,15 @@ enum axi_id { · 377 unmodified lines | |||
| 378 | ((((y) & RAZWI_INITIATOR_Y_MASK) << RAZWI_INITIATOR_Y_SHIFT) | \ | 378 | ((((y) & RAZWI_INITIATOR_Y_MASK) << RAZWI_INITIATOR_Y_SHIFT) | \ |
| 379 | (((x) & RAZWI_INITIATOR_X_MASK) << RAZWI_INITIATOR_X_SHIFT)) | 379 | (((x) & RAZWI_INITIATOR_X_MASK) << RAZWI_INITIATOR_X_SHIFT)) |
| 380 | 380 | ||
| 381 | #define RAZWI_INITIATOR_ID_X_Y_TPC0_NIC0 RAZWI_INITIATOR_ID_X_Y(1, 0) | 381 | #define RAZWI_INITIATOR_ID_X_Y_TPC0_NIC0 RAZWI_INITIATOR_ID_X_Y(1, 1) |
| 382 | #define RAZWI_INITIATOR_ID_X_Y_TPC1 RAZWI_INITIATOR_ID_X_Y(2, 0) | 382 | #define RAZWI_INITIATOR_ID_X_Y_TPC1 RAZWI_INITIATOR_ID_X_Y(2, 1) |
| 383 | #define RAZWI_INITIATOR_ID_X_Y_MME0_0 RAZWI_INITIATOR_ID_X_Y(3, 0) | 383 | #define RAZWI_INITIATOR_ID_X_Y_MME0_0 RAZWI_INITIATOR_ID_X_Y(3, 1) |
| 384 | #define RAZWI_INITIATOR_ID_X_Y_MME0_1 RAZWI_INITIATOR_ID_X_Y(4, 0) | 384 | #define RAZWI_INITIATOR_ID_X_Y_MME0_1 RAZWI_INITIATOR_ID_X_Y(4, 1) |
| 385 | #define RAZWI_INITIATOR_ID_X_Y_MME1_0 RAZWI_INITIATOR_ID_X_Y(5, 0) | 385 | #define RAZWI_INITIATOR_ID_X_Y_MME1_0 RAZWI_INITIATOR_ID_X_Y(5, 1) |
| 386 | #define RAZWI_INITIATOR_ID_X_Y_MME1_1 RAZWI_INITIATOR_ID_X_Y(6, 0) | 386 | #define RAZWI_INITIATOR_ID_X_Y_MME1_1 RAZWI_INITIATOR_ID_X_Y(6, 1) |
| 387 | #define RAZWI_INITIATOR_ID_X_Y_TPC2 RAZWI_INITIATOR_ID_X_Y(7, 0) | 387 | #define RAZWI_INITIATOR_ID_X_Y_TPC2 RAZWI_INITIATOR_ID_X_Y(7, 1) |
| 388 | #define RAZWI_INITIATOR_ID_X_Y_TPC3_PCI_CPU_PSOC \ | 388 | #define RAZWI_INITIATOR_ID_X_Y_TPC3_PCI_CPU_PSOC \ |
| 389 | RAZWI_INITIATOR_ID_X_Y(8, 0) | 389 | RAZWI_INITIATOR_ID_X_Y(8, 1) |
| 390 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_0 RAZWI_INITIATOR_ID_X_Y(0, 1) | 390 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_0 RAZWI_INITIATOR_ID_X_Y(0, 1) |
| 391 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_S_0 RAZWI_INITIATOR_ID_X_Y(9, 1) | 391 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_S_0 RAZWI_INITIATOR_ID_X_Y(9, 1) |
| 392 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_1 RAZWI_INITIATOR_ID_X_Y(0, 2) | 392 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_1 RAZWI_INITIATOR_ID_X_Y(0, 2) |
| @@ -395,14 +395,14 @@ enum axi_id { · 2 unmodified lines | |||
| 395 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_0 RAZWI_INITIATOR_ID_X_Y(9, 3) | 395 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_0 RAZWI_INITIATOR_ID_X_Y(9, 3) |
| 396 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_N_1 RAZWI_INITIATOR_ID_X_Y(0, 4) | 396 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_N_1 RAZWI_INITIATOR_ID_X_Y(0, 4) |
| 397 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_1 RAZWI_INITIATOR_ID_X_Y(9, 4) | 397 | #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_1 RAZWI_INITIATOR_ID_X_Y(9, 4) |
| 398 | #define RAZWI_INITIATOR_ID_X_Y_TPC4_NIC1_NIC2 RAZWI_INITIATOR_ID_X_Y(1, 5) | 398 | #define RAZWI_INITIATOR_ID_X_Y_TPC4_NIC1_NIC2 RAZWI_INITIATOR_ID_X_Y(1, 6) |
| 399 | #define RAZWI_INITIATOR_ID_X_Y_TPC5 RAZWI_INITIATOR_ID_X_Y(2, 5) | 399 | #define RAZWI_INITIATOR_ID_X_Y_TPC5 RAZWI_INITIATOR_ID_X_Y(2, 6) |
| 400 | #define RAZWI_INITIATOR_ID_X_Y_MME2_0 RAZWI_INITIATOR_ID_X_Y(3, 5) | 400 | #define RAZWI_INITIATOR_ID_X_Y_MME2_0 RAZWI_INITIATOR_ID_X_Y(3, 6) |
| 401 | #define RAZWI_INITIATOR_ID_X_Y_MME2_1 RAZWI_INITIATOR_ID_X_Y(4, 5) | 401 | #define RAZWI_INITIATOR_ID_X_Y_MME2_1 RAZWI_INITIATOR_ID_X_Y(4, 6) |
| 402 | #define RAZWI_INITIATOR_ID_X_Y_MME3_0 RAZWI_INITIATOR_ID_X_Y(5, 5) | 402 | #define RAZWI_INITIATOR_ID_X_Y_MME3_0 RAZWI_INITIATOR_ID_X_Y(5, 6) |
| 403 | #define RAZWI_INITIATOR_ID_X_Y_MME3_1 RAZWI_INITIATOR_ID_X_Y(6, 5) | 403 | #define RAZWI_INITIATOR_ID_X_Y_MME3_1 RAZWI_INITIATOR_ID_X_Y(6, 6) |
| 404 | #define RAZWI_INITIATOR_ID_X_Y_TPC6 RAZWI_INITIATOR_ID_X_Y(7, 5) | 404 | #define RAZWI_INITIATOR_ID_X_Y_TPC6 RAZWI_INITIATOR_ID_X_Y(7, 6) |
| 405 | #define RAZWI_INITIATOR_ID_X_Y_TPC7_NIC4_NIC5 RAZWI_INITIATOR_ID_X_Y(8, 5) | 405 | #define RAZWI_INITIATOR_ID_X_Y_TPC7_NIC4_NIC5 RAZWI_INITIATOR_ID_X_Y(8, 6) |
| 406 | 406 | ||
| 407 | #define PSOC_ETR_AXICTL_PROTCTRLBIT1_SHIFT 1 | 407 | #define PSOC_ETR_AXICTL_PROTCTRLBIT1_SHIFT 1 |
| 408 | 408 | ||
| @@ -121,6 +121,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, · 120 unmodified lines | |||
| 121 | struct sg_table sgtable; | 121 | struct sg_table sgtable; |
| 122 | unsigned int nents, left_size, i; | 122 | unsigned int nents, left_size, i; |
| 123 | unsigned int seg_size = card->host->max_seg_size; | 123 | unsigned int seg_size = card->host->max_seg_size; |
| 124 | int err; | ||
| 124 | 125 | ||
| 125 | WARN_ON(blksz == 0); | 126 | WARN_ON(blksz == 0); |
| 126 | 127 | ||
| @@ -170,28 +171,32 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, · 43 unmodified lines | |||
| 170 | 171 | ||
| 171 | mmc_set_data_timeout(&data, card); | 172 | mmc_set_data_timeout(&data, card); |
| 172 | 173 | ||
| 173 | mmc_wait_for_req(card->host, &mrq); | 174 | mmc_pre_req(card->host, &mrq); |
| 174 | 175 | ||
| 175 | if (nents > 1) | 176 | mmc_wait_for_req(card->host, &mrq); |
| 176 | sg_free_table(&sgtable); | ||
| 177 | 177 | ||
| 178 | if (cmd.error) | 178 | if (cmd.error) |
| 179 | return cmd.error; | 179 | err = cmd.error; |
| 180 | if (data.error) | 180 | else if (data.error) |
| 181 | return data.error; | 181 | err = data.error; |
| 182 | 182 | else if (mmc_host_is_spi(card->host)) | |
| 183 | if (mmc_host_is_spi(card->host)) { | ||
| 184 | /* host driver already reported errors */ | 183 | /* host driver already reported errors */ |
| 185 | } else { | 184 | err = 0; |
| 186 | if (cmd.resp[0] & R5_ERROR) | 185 | else if (cmd.resp[0] & R5_ERROR) |
| 187 | return -EIO; | 186 | err = -EIO; |
| 188 | if (cmd.resp[0] & R5_FUNCTION_NUMBER) | 187 | else if (cmd.resp[0] & R5_FUNCTION_NUMBER) |
| 189 | return -EINVAL; | 188 | err = -EINVAL; |
| 190 | if (cmd.resp[0] & R5_OUT_OF_RANGE) | 189 | else if (cmd.resp[0] & R5_OUT_OF_RANGE) |
| 191 | return -ERANGE; | 190 | err = -ERANGE; |
| 192 | } | 191 | else |
| 192 | err = 0; | ||
| 193 | 193 | ||
| 194 | return 0; | 194 | mmc_post_req(card->host, &mrq, err); |
| 195 | |||
| 196 | if (nents > 1) | ||
| 197 | sg_free_table(&sgtable); | ||
| 198 | |||
| 199 | return err; | ||
| 195 | } | 200 | } |
| 196 | 201 | ||
| 197 | int sdio_reset(struct mmc_host *host) | 202 | int sdio_reset(struct mmc_host *host) |
| @@ -602,7 +602,7 @@ config MMC_GOLDFISH · 601 unmodified lines | |||
| 602 | 602 | ||
| 603 | config MMC_SPI | 603 | config MMC_SPI |
| 604 | tristate "MMC/SD/SDIO over SPI" | 604 | tristate "MMC/SD/SDIO over SPI" |
| 605 | depends on SPI_MASTER && HAS_DMA | 605 | depends on SPI_MASTER |
| 606 | select CRC7 | 606 | select CRC7 |
| 607 | select CRC_ITU_T | 607 | select CRC_ITU_T |
| 608 | help | 608 | help |
| @@ -1278,6 +1278,52 @@ mmc_spi_detect_irq(int irq, void *mmc) · 1277 unmodified lines | |||
| 1278 | return IRQ_HANDLED; | 1278 | return IRQ_HANDLED; |
| 1279 | } | 1279 | } |
| 1280 | 1280 | ||
| 1281 | #ifdef CONFIG_HAS_DMA | ||
| 1282 | static int mmc_spi_dma_alloc(struct mmc_spi_host *host) | ||
| 1283 | { | ||
| 1284 | struct spi_device *spi = host->spi; | ||
| 1285 | struct device *dev; | ||
| 1286 | |||
| 1287 | if (!spi->master->dev.parent->dma_mask) | ||
| 1288 | return 0; | ||
| 1289 | |||
| 1290 | dev = spi->master->dev.parent; | ||
| 1291 | |||
| 1292 | host->ones_dma = dma_map_single(dev, host->ones, MMC_SPI_BLOCKSIZE, | ||
| 1293 | DMA_TO_DEVICE); | ||
| 1294 | if (dma_mapping_error(dev, host->ones_dma)) | ||
| 1295 | return -ENOMEM; | ||
| 1296 | |||
| 1297 | host->data_dma = dma_map_single(dev, host->data, sizeof(*host->data), | ||
| 1298 | DMA_BIDIRECTIONAL); | ||
| 1299 | if (dma_mapping_error(dev, host->data_dma)) { | ||
| 1300 | dma_unmap_single(dev, host->ones_dma, MMC_SPI_BLOCKSIZE, | ||
| 1301 | DMA_TO_DEVICE); | ||
| 1302 | return -ENOMEM; | ||
| 1303 | } | ||
| 1304 | |||
| 1305 | dma_sync_single_for_cpu(dev, host->data_dma, sizeof(*host->data), | ||
| 1306 | DMA_BIDIRECTIONAL); | ||
| 1307 | |||
| 1308 | host->dma_dev = dev; | ||
| 1309 | return 0; | ||
| 1310 | } | ||
| 1311 | |||
| 1312 | static void mmc_spi_dma_free(struct mmc_spi_host *host) | ||
| 1313 | { | ||
| 1314 | if (!host->dma_dev) | ||
| 1315 | return; | ||
| 1316 | |||
| 1317 | dma_unmap_single(host->dma_dev, host->ones_dma, MMC_SPI_BLOCKSIZE, | ||
| 1318 | DMA_TO_DEVICE); | ||
| 1319 | dma_unmap_single(host->dma_dev, host->data_dma, sizeof(*host->data), | ||
| 1320 | DMA_BIDIRECTIONAL); | ||
| 1321 | } | ||
| 1322 | #else | ||
| 1323 | static inline mmc_spi_dma_alloc(struct mmc_spi_host *host) { return 0; } | ||
| 1324 | static inline void mmc_spi_dma_free(struct mmc_spi_host *host) {} | ||
| 1325 | #endif | ||
| 1326 | |||
| 1281 | static int mmc_spi_probe(struct spi_device *spi) | 1327 | static int mmc_spi_probe(struct spi_device *spi) |
| 1282 | { | 1328 | { |
| 1283 | void *ones; | 1329 | void *ones; |
| @@ -1374,23 +1420,9 @@ static int mmc_spi_probe(struct spi_device *spi) · 90 unmodified lines | |||
| 1374 | if (!host->data) | 1420 | if (!host->data) |
| 1375 | goto fail_nobuf1; | 1421 | goto fail_nobuf1; |
| 1376 | 1422 | ||
| 1377 | if (spi->master->dev.parent->dma_mask) { | 1423 | status = mmc_spi_dma_alloc(host); |
| 1378 | struct device *dev = spi->master->dev.parent; | 1424 | if (status) |
| 1379 | 1425 | goto fail_dma; | |
| 1380 | host->dma_dev = dev; | ||
| 1381 | host->ones_dma = dma_map_single(dev, ones, | ||
| 1382 | MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); | ||
| 1383 | if (dma_mapping_error(dev, host->ones_dma)) | ||
| 1384 | goto fail_ones_dma; | ||
| 1385 | host->data_dma = dma_map_single(dev, host->data, | ||
| 1386 | sizeof(*host->data), DMA_BIDIRECTIONAL); | ||
| 1387 | if (dma_mapping_error(dev, host->data_dma)) | ||
| 1388 | goto fail_data_dma; | ||
| 1389 | |||
| 1390 | dma_sync_single_for_cpu(host->dma_dev, | ||
| 1391 | host->data_dma, sizeof(*host->data), | ||
| 1392 | DMA_BIDIRECTIONAL); | ||
| 1393 | } | ||
| 1394 | 1426 | ||
| 1395 | /* setup message for status/busy readback */ | 1427 | /* setup message for status/busy readback */ |
| 1396 | spi_message_init(&host->readback); | 1428 | spi_message_init(&host->readback); |
| @@ -1458,20 +1490,12 @@ static int mmc_spi_probe(struct spi_device *spi) · 61 unmodified lines | |||
| 1458 | fail_add_host: | 1490 | fail_add_host: |
| 1459 | mmc_remove_host(mmc); | 1491 | mmc_remove_host(mmc); |
| 1460 | fail_glue_init: | 1492 | fail_glue_init: |
| 1461 | if (host->dma_dev) | 1493 | mmc_spi_dma_free(host); |
| 1462 | dma_unmap_single(host->dma_dev, host->data_dma, | 1494 | fail_dma: |
| 1463 | sizeof(*host->data), DMA_BIDIRECTIONAL); | ||
| 1464 | fail_data_dma: | ||
| 1465 | if (host->dma_dev) | ||
| 1466 | dma_unmap_single(host->dma_dev, host->ones_dma, | ||
| 1467 | MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); | ||
| 1468 | fail_ones_dma: | ||
| 1469 | kfree(host->data); | 1495 | kfree(host->data); |
| 1470 | |||
| 1471 | fail_nobuf1: | 1496 | fail_nobuf1: |
| 1472 | mmc_free_host(mmc); | 1497 | mmc_free_host(mmc); |
| 1473 | mmc_spi_put_pdata(spi); | 1498 | mmc_spi_put_pdata(spi); |
| 1474 | |||
| 1475 | nomem: | 1499 | nomem: |
| 1476 | kfree(ones); | 1500 | kfree(ones); |
| 1477 | return status; | 1501 | return status; |
| @@ -1489,13 +1513,7 @@ static int mmc_spi_remove(struct spi_device *spi) · 11 unmodified lines | |||
| 1489 | 1513 | ||
| 1490 | mmc_remove_host(mmc); | 1514 | mmc_remove_host(mmc); |
| 1491 | 1515 | ||
| 1492 | if (host->dma_dev) { | 1516 | mmc_spi_dma_free(host); |
| 1493 | dma_unmap_single(host->dma_dev, host->ones_dma, | ||
| 1494 | MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); | ||
| 1495 | dma_unmap_single(host->dma_dev, host->data_dma, | ||
| 1496 | sizeof(*host->data), DMA_BIDIRECTIONAL); | ||
| 1497 | } | ||
| 1498 | |||
| 1499 | kfree(host->data); | 1517 | kfree(host->data); |
| 1500 | kfree(host->ones); | 1518 | kfree(host->ones); |
| 1501 | 1519 | ||
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
| 24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
| 25 | #include <linux/reset.h> | ||
| 25 | 26 | ||
| 26 | #include <linux/mmc/card.h> | 27 | #include <linux/mmc/card.h> |
| 27 | #include <linux/mmc/core.h> | 28 | #include <linux/mmc/core.h> |
| @@ -419,6 +420,7 @@ struct msdc_host { · 391 unmodified lines | |||
| 419 | struct pinctrl_state *pins_uhs; | 420 | struct pinctrl_state *pins_uhs; |
| 420 | struct delayed_work req_timeout; | 421 | struct delayed_work req_timeout; |
| 421 | int irq; /* host interrupt */ | 422 | int irq; /* host interrupt */ |
| 423 | struct reset_control *reset; | ||
| 422 | 424 | ||
| 423 | struct clk *src_clk; /* msdc source clock */ | 425 | struct clk *src_clk; /* msdc source clock */ |
| 424 | struct clk *h_clk; /* msdc h_clk */ | 426 | struct clk *h_clk; /* msdc h_clk */ |
| @@ -1592,6 +1594,12 @@ static void msdc_init_hw(struct msdc_host *host) · 1167 unmodified lines | |||
| 1592 | u32 val; | 1594 | u32 val; |
| 1593 | u32 tune_reg = host->dev_comp->pad_tune_reg; | 1595 | u32 tune_reg = host->dev_comp->pad_tune_reg; |
| 1594 | 1596 | ||
| 1597 | if (host->reset) { | ||
| 1598 | reset_control_assert(host->reset); | ||
| 1599 | usleep_range(10, 50); | ||
| 1600 | reset_control_deassert(host->reset); | ||
| 1601 | } | ||
| 1602 | |||
| 1595 | /* Configure to MMC/SD mode, clock free running */ | 1603 | /* Configure to MMC/SD mode, clock free running */ |
| 1596 | sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN); | 1604 | sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN); |
| 1597 | 1605 | ||
| @@ -2390,6 +2398,11 @@ static int msdc_drv_probe(struct platform_device *pdev) · 792 unmodified lines | |||
| 2390 | if (IS_ERR(host->src_clk_cg)) | 2398 | if (IS_ERR(host->src_clk_cg)) |
| 2391 | host->src_clk_cg = NULL; | 2399 | host->src_clk_cg = NULL; |
| 2392 | 2400 | ||
| 2401 | host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev, | ||
| 2402 | "hrst"); | ||
| 2403 | if (IS_ERR(host->reset)) | ||
| 2404 | return PTR_ERR(host->reset); | ||
| 2405 | |||
| 2393 | host->irq = platform_get_irq(pdev, 0); | 2406 | host->irq = platform_get_irq(pdev, 0); |
| 2394 | if (host->irq < 0) { | 2407 | if (host->irq < 0) { |
| 2395 | ret = -EINVAL; | 2408 | ret = -EINVAL; |
| @@ -535,6 +535,11 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_qcom_sd = { · 534 unmodified lines | |||
| 535 | .caps = MMC_CAP_NONREMOVABLE, | 535 | .caps = MMC_CAP_NONREMOVABLE, |
| 536 | }; | 536 | }; |
| 537 | 537 | ||
| 538 | struct amd_sdhci_host { | ||
| 539 | bool tuned_clock; | ||
| 540 | bool dll_enabled; | ||
| 541 | }; | ||
| 542 | |||
| 538 | /* AMD sdhci reset dll register. */ | 543 | /* AMD sdhci reset dll register. */ |
| 539 | #define SDHCI_AMD_RESET_DLL_REGISTER 0x908 | 544 | #define SDHCI_AMD_RESET_DLL_REGISTER 0x908 |
| 540 | 545 | ||
| @@ -546,39 +551,96 @@ static int amd_select_drive_strength(struct mmc_card *card, · 5 unmodified lines | |||
| 546 | return MMC_SET_DRIVER_TYPE_A; | 551 | return MMC_SET_DRIVER_TYPE_A; |
| 547 | } | 552 | } |
| 548 | 553 | ||
| 549 | static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host) | 554 | static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host, bool enable) |
| 550 | { | 555 | { |
| 556 | struct sdhci_acpi_host *acpi_host = sdhci_priv(host); | ||
| 557 | struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); | ||
| 558 | |||
| 551 | /* AMD Platform requires dll setting */ | 559 | /* AMD Platform requires dll setting */ |
| 552 | sdhci_writel(host, 0x40003210, SDHCI_AMD_RESET_DLL_REGISTER); | 560 | sdhci_writel(host, 0x40003210, SDHCI_AMD_RESET_DLL_REGISTER); |
| 553 | usleep_range(10, 20); | 561 | usleep_range(10, 20); |
| 554 | sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER); | 562 | if (enable) |
| 563 | sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER); | ||
| 564 | |||
| 565 | amd_host->dll_enabled = enable; | ||
| 555 | } | 566 | } |
| 556 | 567 | ||
| 557 | /* | 568 | /* |
| 558 | * For AMD Platform it is required to disable the tuning | 569 | * The initialization sequence for HS400 is: |
| 559 | * bit first controller to bring to HS Mode from HS200 | 570 | * HS->HS200->Perform Tuning->HS->HS400 |
| 560 | * mode, later enable to tune to HS400 mode. | 571 | * |
| 572 | * The re-tuning sequence is: | ||
| 573 | * HS400->DDR52->HS->HS200->Perform Tuning->HS->HS400 | ||
| 574 | * | ||
| 575 | * The AMD eMMC Controller can only use the tuned clock while in HS200 and HS400 | ||
| 576 | * mode. If we switch to a different mode, we need to disable the tuned clock. | ||
| 577 | * If we have previously performed tuning and switch back to HS200 or | ||
| 578 | * HS400, we can re-enable the tuned clock. | ||
| 579 | * | ||
| 561 | */ | 580 | */ |
| 562 | static void amd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | 581 | static void amd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
| 563 | { | 582 | { |
| 564 | struct sdhci_host *host = mmc_priv(mmc); | 583 | struct sdhci_host *host = mmc_priv(mmc); |
| 584 | struct sdhci_acpi_host *acpi_host = sdhci_priv(host); | ||
| 585 | struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); | ||
| 565 | unsigned int old_timing = host->timing; | 586 | unsigned int old_timing = host->timing; |
| 587 | u16 val; | ||
| 566 | 588 | ||
| 567 | sdhci_set_ios(mmc, ios); | 589 | sdhci_set_ios(mmc, ios); |
| 568 | if (old_timing == MMC_TIMING_MMC_HS200 && | 590 | |
| 569 | ios->timing == MMC_TIMING_MMC_HS) | 591 | if (old_timing != host->timing && amd_host->tuned_clock) { |
| 570 | sdhci_writew(host, 0x9, SDHCI_HOST_CONTROL2); | 592 | if (host->timing == MMC_TIMING_MMC_HS400 || |
| 571 | if (old_timing != MMC_TIMING_MMC_HS400 && | 593 | host->timing == MMC_TIMING_MMC_HS200) { |
| 572 | ios->timing == MMC_TIMING_MMC_HS400) { | 594 | val = sdhci_readw(host, SDHCI_HOST_CONTROL2); |
| 573 | sdhci_writew(host, 0x80, SDHCI_HOST_CONTROL2); | 595 | val |= SDHCI_CTRL_TUNED_CLK; |
| 574 | sdhci_acpi_amd_hs400_dll(host); | 596 | sdhci_writew(host, val, SDHCI_HOST_CONTROL2); |
| 597 | } else { | ||
| 598 | val = sdhci_readw(host, SDHCI_HOST_CONTROL2); | ||
| 599 | val &= ~SDHCI_CTRL_TUNED_CLK; | ||
| 600 | sdhci_writew(host, val, SDHCI_HOST_CONTROL2); | ||
| 601 | } | ||
| 602 | |||
| 603 | /* DLL is only required for HS400 */ | ||
| 604 | if (host->timing == MMC_TIMING_MMC_HS400 && | ||
| 605 | !amd_host->dll_enabled) | ||
| 606 | sdhci_acpi_amd_hs400_dll(host, true); | ||
| 607 | } | ||
| 608 | } | ||
| 609 | |||
| 610 | static int amd_sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) | ||
| 611 | { | ||
| 612 | int err; | ||
| 613 | struct sdhci_host *host = mmc_priv(mmc); | ||
| 614 | struct sdhci_acpi_host *acpi_host = sdhci_priv(host); | ||
| 615 | struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); | ||
| 616 | |||
| 617 | amd_host->tuned_clock = false; | ||
| 618 | |||
| 619 | err = sdhci_execute_tuning(mmc, opcode); | ||
| 620 | |||
| 621 | if (!err && !host->tuning_err) | ||
| 622 | amd_host->tuned_clock = true; | ||
| 623 | |||
| 624 | return err; | ||
| 625 | } | ||
| 626 | |||
| 627 | static void amd_sdhci_reset(struct sdhci_host *host, u8 mask) | ||
| 628 | { | ||
| 629 | struct sdhci_acpi_host *acpi_host = sdhci_priv(host); | ||
| 630 | struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); | ||
| 631 | |||
| 632 | if (mask & SDHCI_RESET_ALL) { | ||
| 633 | amd_host->tuned_clock = false; | ||
| 634 | sdhci_acpi_amd_hs400_dll(host, false); | ||
| 575 | } | 635 | } |
| 636 | |||
| 637 | sdhci_reset(host, mask); | ||
| 576 | } | 638 | } |
| 577 | 639 | ||
| 578 | static const struct sdhci_ops sdhci_acpi_ops_amd = { | 640 | static const struct sdhci_ops sdhci_acpi_ops_amd = { |
| 579 | .set_clock = sdhci_set_clock, | 641 | .set_clock = sdhci_set_clock, |
| 580 | .set_bus_width = sdhci_set_bus_width, | 642 | .set_bus_width = sdhci_set_bus_width, |
| 581 | .reset = sdhci_reset, | 643 | .reset = amd_sdhci_reset, |
| 582 | .set_uhs_signaling = sdhci_set_uhs_signaling, | 644 | .set_uhs_signaling = sdhci_set_uhs_signaling, |
| 583 | }; | 645 | }; |
| 584 | 646 | ||
| @@ -602,6 +664,7 @@ static int sdhci_acpi_emmc_amd_probe_slot(struct platform_device *pdev, · 17 unmodified lines | |||
| 602 | 664 | ||
| 603 | host->mmc_host_ops.select_drive_strength = amd_select_drive_strength; | 665 | host->mmc_host_ops.select_drive_strength = amd_select_drive_strength; |
| 604 | host->mmc_host_ops.set_ios = amd_set_ios; | 666 | host->mmc_host_ops.set_ios = amd_set_ios; |
| 667 | host->mmc_host_ops.execute_tuning = amd_sdhci_execute_tuning; | ||
| 605 | return 0; | 668 | return 0; |
| 606 | } | 669 | } |
| 607 | 670 | ||
| @@ -613,6 +676,7 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_amd_emmc = { · 5 unmodified lines | |||
| 613 | SDHCI_QUIRK_32BIT_ADMA_SIZE, | 676 | SDHCI_QUIRK_32BIT_ADMA_SIZE, |
| 614 | .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA, | 677 | .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA, |
| 615 | .probe_slot = sdhci_acpi_emmc_amd_probe_slot, | 678 | .probe_slot = sdhci_acpi_emmc_amd_probe_slot, |
| 679 | .priv_size = sizeof(struct amd_sdhci_host), | ||
| 616 | }; | 680 | }; |
| 617 | 681 | ||
| 618 | struct sdhci_acpi_uid_slot { | 682 | struct sdhci_acpi_uid_slot { |
| @@ -1166,7 +1166,7 @@ static void sdhci_msm_set_cdr(struct sdhci_host *host, bool enable) · 1165 unmodified lines | |||
| 1166 | static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode) | 1166 | static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode) |
| 1167 | { | 1167 | { |
| 1168 | struct sdhci_host *host = mmc_priv(mmc); | 1168 | struct sdhci_host *host = mmc_priv(mmc); |
| 1169 | int tuning_seq_cnt = 3; | 1169 | int tuning_seq_cnt = 10; |
| 1170 | u8 phase, tuned_phases[16], tuned_phase_cnt = 0; | 1170 | u8 phase, tuned_phases[16], tuned_phase_cnt = 0; |
| 1171 | int rc; | 1171 | int rc; |
| 1172 | struct mmc_ios ios = host->mmc->ios; | 1172 | struct mmc_ios ios = host->mmc->ios; |
| @@ -1222,6 +1222,22 @@ retry: · 49 unmodified lines | |||
| 1222 | } while (++phase < ARRAY_SIZE(tuned_phases)); | 1222 | } while (++phase < ARRAY_SIZE(tuned_phases)); |
| 1223 | 1223 | ||
| 1224 | if (tuned_phase_cnt) { | 1224 | if (tuned_phase_cnt) { |
| 1225 | if (tuned_phase_cnt == ARRAY_SIZE(tuned_phases)) { | ||
| 1226 | /* | ||
| 1227 | * All phases valid is _almost_ as bad as no phases | ||
| 1228 | * valid. Probably all phases are not really reliable | ||
| 1229 | * but we didn't detect where the unreliable place is. | ||
| 1230 | * That means we'll essentially be guessing and hoping | ||
| 1231 | * we get a good phase. Better to try a few times. | ||
| 1232 | */ | ||
| 1233 | dev_dbg(mmc_dev(mmc), "%s: All phases valid; try again\n", | ||
| 1234 | mmc_hostname(mmc)); | ||
| 1235 | if (--tuning_seq_cnt) { | ||
| 1236 | tuned_phase_cnt = 0; | ||
| 1237 | goto retry; | ||
| 1238 | } | ||
| 1239 | } | ||
| 1240 | |||
| 1225 | rc = msm_find_most_appropriate_phase(host, tuned_phases, | 1241 | rc = msm_find_most_appropriate_phase(host, tuned_phases, |
| 1226 | tuned_phase_cnt); | 1242 | tuned_phase_cnt); |
| 1227 | if (rc < 0) | 1243 | if (rc < 0) |
| @@ -81,6 +81,7 @@ struct sdhci_esdhc { · 80 unmodified lines | |||
| 81 | bool quirk_tuning_erratum_type2; | 81 | bool quirk_tuning_erratum_type2; |
| 82 | bool quirk_ignore_data_inhibit; | 82 | bool quirk_ignore_data_inhibit; |
| 83 | bool quirk_delay_before_data_reset; | 83 | bool quirk_delay_before_data_reset; |
| 84 | bool quirk_trans_complete_erratum; | ||
| 84 | bool in_sw_tuning; | 85 | bool in_sw_tuning; |
| 85 | unsigned int peripheral_clock; | 86 | unsigned int peripheral_clock; |
| 86 | const struct esdhc_clk_fixup *clk_fixup; | 87 | const struct esdhc_clk_fixup *clk_fixup; |
| @@ -1177,10 +1178,11 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, · 1090 unmodified lines | |||
| 1177 | 1178 | ||
| 1178 | static u32 esdhc_irq(struct sdhci_host *host, u32 intmask) | 1179 | static u32 esdhc_irq(struct sdhci_host *host, u32 intmask) |
| 1179 | { | 1180 | { |
| 1181 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | ||
| 1182 | struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host); | ||
| 1180 | u32 command; | 1183 | u32 command; |
| 1181 | 1184 | ||
| 1182 | if (of_find_compatible_node(NULL, NULL, | 1185 | if (esdhc->quirk_trans_complete_erratum) { |
| 1183 | "fsl,p2020-esdhc")) { | ||
| 1184 | command = SDHCI_GET_CMD(sdhci_readw(host, | 1186 | command = SDHCI_GET_CMD(sdhci_readw(host, |
| 1185 | SDHCI_COMMAND)); | 1187 | SDHCI_COMMAND)); |
| 1186 | if (command == MMC_WRITE_MULTIPLE_BLOCK && | 1188 | if (command == MMC_WRITE_MULTIPLE_BLOCK && |
| @@ -1334,8 +1336,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) · 147 unmodified lines | |||
| 1334 | esdhc->clk_fixup = match->data; | 1336 | esdhc->clk_fixup = match->data; |
| 1335 | np = pdev->dev.of_node; | 1337 | np = pdev->dev.of_node; |
| 1336 | 1338 | ||
| 1337 | if (of_device_is_compatible(np, "fsl,p2020-esdhc")) | 1339 | if (of_device_is_compatible(np, "fsl,p2020-esdhc")) { |
| 1338 | esdhc->quirk_delay_before_data_reset = true; | 1340 | esdhc->quirk_delay_before_data_reset = true; |
| 1341 | esdhc->quirk_trans_complete_erratum = true; | ||
| 1342 | } | ||
| 1339 | 1343 | ||
| 1340 | clk = of_clk_get(np, 0); | 1344 | clk = of_clk_get(np, 0); |
| 1341 | if (!IS_ERR(clk)) { | 1345 | if (!IS_ERR(clk)) { |
| @@ -232,6 +232,14 @@ static void sdhci_pci_dumpregs(struct mmc_host *mmc) · 231 unmodified lines | |||
| 232 | sdhci_dumpregs(mmc_priv(mmc)); | 232 | sdhci_dumpregs(mmc_priv(mmc)); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | static void sdhci_cqhci_reset(struct sdhci_host *host, u8 mask) | ||
| 236 | { | ||
| 237 | if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL) && | ||
| 238 | host->mmc->cqe_private) | ||
| 239 | cqhci_deactivate(host->mmc); | ||
| 240 | sdhci_reset(host, mask); | ||
| 241 | } | ||
| 242 | |||
| 235 | /*****************************************************************************\ | 243 | /*****************************************************************************\ |
| 236 | * * | 244 | * * |
| 237 | * Hardware specific quirk handling * | 245 | * Hardware specific quirk handling * |
| @@ -718,7 +726,7 @@ static const struct sdhci_ops sdhci_intel_glk_ops = { · 480 unmodified lines | |||
| 718 | .set_power = sdhci_intel_set_power, | 726 | .set_power = sdhci_intel_set_power, |
| 719 | .enable_dma = sdhci_pci_enable_dma, | 727 | .enable_dma = sdhci_pci_enable_dma, |
| 720 | .set_bus_width = sdhci_set_bus_width, | 728 | .set_bus_width = sdhci_set_bus_width, |
| 721 | .reset = sdhci_reset, | 729 | .reset = sdhci_cqhci_reset, |
| 722 | .set_uhs_signaling = sdhci_set_uhs_signaling, | 730 | .set_uhs_signaling = sdhci_set_uhs_signaling, |
| 723 | .hw_reset = sdhci_pci_hw_reset, | 731 | .hw_reset = sdhci_pci_hw_reset, |
| 724 | .irq = sdhci_cqhci_irq, | 732 | .irq = sdhci_cqhci_irq, |
| @@ -110,6 +110,12 @@ · 109 unmodified lines | |||
| 110 | #define NVQUIRK_DIS_CARD_CLK_CONFIG_TAP BIT(8) | 110 | #define NVQUIRK_DIS_CARD_CLK_CONFIG_TAP BIT(8) |
| 111 | #define NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING BIT(9) | 111 | #define NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING BIT(9) |
| 112 | 112 | ||
| 113 | /* | ||
| 114 | * NVQUIRK_HAS_TMCLK is for SoC's having separate timeout clock for Tegra | ||
| 115 | * SDMMC hardware data timeout. | ||
| 116 | */ | ||
| 117 | #define NVQUIRK_HAS_TMCLK BIT(10) | ||
| 118 | |||
| 113 | /* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */ | 119 | /* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */ |
| 114 | #define SDHCI_TEGRA_CQE_BASE_ADDR 0xF000 | 120 | #define SDHCI_TEGRA_CQE_BASE_ADDR 0xF000 |
| 115 | 121 | ||
| @@ -140,6 +146,7 @@ struct sdhci_tegra_autocal_offsets { · 24 unmodified lines | |||
| 140 | struct sdhci_tegra { | 146 | struct sdhci_tegra { |
| 141 | const struct sdhci_tegra_soc_data *soc_data; | 147 | const struct sdhci_tegra_soc_data *soc_data; |
| 142 | struct gpio_desc *power_gpio; | 148 | struct gpio_desc *power_gpio; |
| 149 | struct clk *tmclk; | ||
| 143 | bool ddr_signaling; | 150 | bool ddr_signaling; |
| 144 | bool pad_calib_required; | 151 | bool pad_calib_required; |
| 145 | bool pad_control_available; | 152 | bool pad_control_available; |
| @@ -1418,7 +1425,6 @@ static const struct sdhci_ops tegra210_sdhci_ops = { · 1272 unmodified lines | |||
| 1418 | 1425 | ||
| 1419 | static const struct sdhci_pltfm_data sdhci_tegra210_pdata = { | 1426 | static const struct sdhci_pltfm_data sdhci_tegra210_pdata = { |
| 1420 | .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | | 1427 | .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | |
| 1421 | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | | ||
| 1422 | SDHCI_QUIRK_SINGLE_POWER_WRITE | | 1428 | SDHCI_QUIRK_SINGLE_POWER_WRITE | |
| 1423 | SDHCI_QUIRK_NO_HISPD_BIT | | 1429 | SDHCI_QUIRK_NO_HISPD_BIT | |
| 1424 | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | | 1430 | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | |
| @@ -1434,7 +1440,8 @@ static const struct sdhci_tegra_soc_data soc_data_tegra210 = { · 9 unmodified lines | |||
| 1434 | NVQUIRK_HAS_PADCALIB | | 1440 | NVQUIRK_HAS_PADCALIB | |
| 1435 | NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | | 1441 | NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | |
| 1436 | NVQUIRK_ENABLE_SDR50 | | 1442 | NVQUIRK_ENABLE_SDR50 | |
| 1437 | NVQUIRK_ENABLE_SDR104, | 1443 | NVQUIRK_ENABLE_SDR104 | |
| 1444 | NVQUIRK_HAS_TMCLK, | ||
| 1438 | .min_tap_delay = 106, | 1445 | .min_tap_delay = 106, |
| 1439 | .max_tap_delay = 185, | 1446 | .max_tap_delay = 185, |
| 1440 | }; | 1447 | }; |
| @@ -1456,7 +1463,6 @@ static const struct sdhci_ops tegra186_sdhci_ops = { · 15 unmodified lines | |||
| 1456 | 1463 | ||
| 1457 | static const struct sdhci_pltfm_data sdhci_tegra186_pdata = { | 1464 | static const struct sdhci_pltfm_data sdhci_tegra186_pdata = { |
| 1458 | .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | | 1465 | .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | |
| 1459 | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | | ||
| 1460 | SDHCI_QUIRK_SINGLE_POWER_WRITE | | 1466 | SDHCI_QUIRK_SINGLE_POWER_WRITE | |
| 1461 | SDHCI_QUIRK_NO_HISPD_BIT | | 1467 | SDHCI_QUIRK_NO_HISPD_BIT | |
| 1462 | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | | 1468 | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | |
| @@ -1473,6 +1479,7 @@ static const struct sdhci_tegra_soc_data soc_data_tegra186 = { · 10 unmodified lines | |||
| 1473 | NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | | 1479 | NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | |
| 1474 | NVQUIRK_ENABLE_SDR50 | | 1480 | NVQUIRK_ENABLE_SDR50 | |
| 1475 | NVQUIRK_ENABLE_SDR104 | | 1481 | NVQUIRK_ENABLE_SDR104 | |
| 1482 | NVQUIRK_HAS_TMCLK | | ||
| 1476 | NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING, | 1483 | NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING, |
| 1477 | .min_tap_delay = 84, | 1484 | .min_tap_delay = 84, |
| 1478 | .max_tap_delay = 136, | 1485 | .max_tap_delay = 136, |
| @@ -1485,7 +1492,8 @@ static const struct sdhci_tegra_soc_data soc_data_tegra194 = { · 6 unmodified lines | |||
| 1485 | NVQUIRK_HAS_PADCALIB | | 1492 | NVQUIRK_HAS_PADCALIB | |
| 1486 | NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | | 1493 | NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | |
| 1487 | NVQUIRK_ENABLE_SDR50 | | 1494 | NVQUIRK_ENABLE_SDR50 | |
| 1488 | NVQUIRK_ENABLE_SDR104, | 1495 | NVQUIRK_ENABLE_SDR104 | |
| 1496 | NVQUIRK_HAS_TMCLK, | ||
| 1489 | .min_tap_delay = 96, | 1497 | .min_tap_delay = 96, |
| 1490 | .max_tap_delay = 139, | 1498 | .max_tap_delay = 139, |
| 1491 | }; | 1499 | }; |
| @@ -1613,6 +1621,43 @@ static int sdhci_tegra_probe(struct platform_device *pdev) · 121 unmodified lines | |||
| 1613 | goto err_power_req; | 1621 | goto err_power_req; |
| 1614 | } | 1622 | } |
| 1615 | 1623 | ||
| 1624 | /* | ||
| 1625 | * Tegra210 has a separate SDMMC_LEGACY_TM clock used for host | ||
| 1626 | * timeout clock and SW can choose TMCLK or SDCLK for hardware | ||
| 1627 | * data timeout through the bit USE_TMCLK_FOR_DATA_TIMEOUT of | ||
| 1628 | * the register SDHCI_TEGRA_VENDOR_SYS_SW_CTRL. | ||
| 1629 | * | ||
| 1630 | * USE_TMCLK_FOR_DATA_TIMEOUT bit default is set to 1 and SDMMC uses | ||
| 1631 | * 12Mhz TMCLK which is advertised in host capability register. | ||
| 1632 | * With TMCLK of 12Mhz provides maximum data timeout period that can | ||
| 1633 | * be achieved is 11s better than using SDCLK for data timeout. | ||
| 1634 | * | ||
| 1635 | * So, TMCLK is set to 12Mhz and kept enabled all the time on SoC's | ||
| 1636 | * supporting separate TMCLK. | ||
| 1637 | */ | ||
| 1638 | |||
| 1639 | if (soc_data->nvquirks & NVQUIRK_HAS_TMCLK) { | ||
| 1640 | clk = devm_clk_get(&pdev->dev, "tmclk"); | ||
| 1641 | if (IS_ERR(clk)) { | ||
| 1642 | rc = PTR_ERR(clk); | ||
| 1643 | if (rc == -EPROBE_DEFER) | ||
| 1644 | goto err_power_req; | ||
| 1645 | |||
| 1646 | dev_warn(&pdev->dev, "failed to get tmclk: %d\n", rc); | ||
| 1647 | clk = NULL; | ||
| 1648 | } | ||
| 1649 | |||
| 1650 | clk_set_rate(clk, 12000000); | ||
| 1651 | rc = clk_prepare_enable(clk); | ||
| 1652 | if (rc) { | ||
| 1653 | dev_err(&pdev->dev, | ||
| 1654 | "failed to enable tmclk: %d\n", rc); | ||
| 1655 | goto err_power_req; | ||
| 1656 | } | ||
| 1657 | |||
| 1658 | tegra_host->tmclk = clk; | ||
| 1659 | } | ||
| 1660 | |||
| 1616 | clk = devm_clk_get(mmc_dev(host->mmc), NULL); | 1661 | clk = devm_clk_get(mmc_dev(host->mmc), NULL); |
| 1617 | if (IS_ERR(clk)) { | 1662 | if (IS_ERR(clk)) { |
| 1618 | rc = PTR_ERR(clk); | 1663 | rc = PTR_ERR(clk); |
| @@ -1656,6 +1701,7 @@ err_add_host: · 37 unmodified lines | |||
| 1656 | err_rst_get: | 1701 | err_rst_get: |
| 1657 | clk_disable_unprepare(pltfm_host->clk); | 1702 | clk_disable_unprepare(pltfm_host->clk); |
| 1658 | err_clk_get: | 1703 | err_clk_get: |
| 1704 | clk_disable_unprepare(tegra_host->tmclk); | ||
| 1659 | err_power_req: | 1705 | err_power_req: |
| 1660 | err_parse_dt: | 1706 | err_parse_dt: |
| 1661 | sdhci_pltfm_free(pdev); | 1707 | sdhci_pltfm_free(pdev); |
| @@ -1673,6 +1719,7 @@ static int sdhci_tegra_remove(struct platform_device *pdev) · 11 unmodified lines | |||
| 1673 | reset_control_assert(tegra_host->rst); | 1719 | reset_control_assert(tegra_host->rst); |
| 1674 | usleep_range(2000, 4000); | 1720 | usleep_range(2000, 4000); |
| 1675 | clk_disable_unprepare(pltfm_host->clk); | 1721 | clk_disable_unprepare(pltfm_host->clk); |
| 1722 | clk_disable_unprepare(tegra_host->tmclk); | ||
| 1676 | 1723 | ||
| 1677 | sdhci_pltfm_free(pdev); | 1724 | sdhci_pltfm_free(pdev); |
| 1678 | 1725 | ||
| @@ -1326,14 +1326,17 @@ mt7530_setup(struct dsa_switch *ds) · 1325 unmodified lines | |||
| 1326 | 1326 | ||
| 1327 | if (phy_node->parent == priv->dev->of_node->parent) { | 1327 | if (phy_node->parent == priv->dev->of_node->parent) { |
| 1328 | ret = of_get_phy_mode(mac_np, &interface); | 1328 | ret = of_get_phy_mode(mac_np, &interface); |
| 1329 | if (ret && ret != -ENODEV) | 1329 | if (ret && ret != -ENODEV) { |
| 1330 | of_node_put(mac_np); | ||
| 1330 | return ret; | 1331 | return ret; |
| 1332 | } | ||
| 1331 | id = of_mdio_parse_addr(ds->dev, phy_node); | 1333 | id = of_mdio_parse_addr(ds->dev, phy_node); |
| 1332 | if (id == 0) | 1334 | if (id == 0) |
| 1333 | priv->p5_intf_sel = P5_INTF_SEL_PHY_P0; | 1335 | priv->p5_intf_sel = P5_INTF_SEL_PHY_P0; |
| 1334 | if (id == 4) | 1336 | if (id == 4) |
| 1335 | priv->p5_intf_sel = P5_INTF_SEL_PHY_P4; | 1337 | priv->p5_intf_sel = P5_INTF_SEL_PHY_P4; |
| 1336 | } | 1338 | } |
| 1339 | of_node_put(mac_np); | ||
| 1337 | of_node_put(phy_node); | 1340 | of_node_put(phy_node); |
| 1338 | break; | 1341 | break; |
| 1339 | } | 1342 | } |
| @@ -1501,7 +1504,7 @@ unsupported: · 161 unmodified lines | |||
| 1501 | phylink_set(mask, 100baseT_Full); | 1504 | phylink_set(mask, 100baseT_Full); |
| 1502 | 1505 | ||
| 1503 | if (state->interface != PHY_INTERFACE_MODE_MII) { | 1506 | if (state->interface != PHY_INTERFACE_MODE_MII) { |
| 1504 | phylink_set(mask, 1000baseT_Half); | 1507 | /* This switch only supports 1G full-duplex. */ |
| 1505 | phylink_set(mask, 1000baseT_Full); | 1508 | phylink_set(mask, 1000baseT_Full); |
| 1506 | if (port == 5) | 1509 | if (port == 5) |
| 1507 | phylink_set(mask, 1000baseX_Full); | 1510 | phylink_set(mask, 1000baseX_Full); |
| @@ -400,6 +400,7 @@ static int felix_parse_ports_node(struct felix *felix, · 399 unmodified lines | |||
| 400 | if (err < 0) { | 400 | if (err < 0) { |
| 401 | dev_err(dev, "Unsupported PHY mode %s on port %d\n", | 401 | dev_err(dev, "Unsupported PHY mode %s on port %d\n", |
| 402 | phy_modes(phy_mode), port); | 402 | phy_modes(phy_mode), port); |
| 403 | of_node_put(child); | ||
| 403 | return err; | 404 | return err; |
| 404 | } | 405 | } |
| 405 | 406 | ||
| @@ -3415,7 +3415,7 @@ static int sja1105_check_device_id(struct sja1105_private *priv) · 3414 unmodified lines | |||
| 3415 | 3415 | ||
| 3416 | sja1105_unpack(prod_id, &part_no, 19, 4, SJA1105_SIZE_DEVICE_ID); | 3416 | sja1105_unpack(prod_id, &part_no, 19, 4, SJA1105_SIZE_DEVICE_ID); |
| 3417 | 3417 | ||
| 3418 | for (match = sja1105_dt_ids; match->compatible; match++) { | 3418 | for (match = sja1105_dt_ids; match->compatible[0]; match++) { |
| 3419 | const struct sja1105_info *info = match->data; | 3419 | const struct sja1105_info *info = match->data; |
| 3420 | 3420 | ||
| 3421 | /* Is what's been probed in our match table at all? */ | 3421 | /* Is what's been probed in our match table at all? */ |
| @@ -166,6 +166,7 @@ enum xgbe_port_mode { · 165 unmodified lines | |||
| 166 | XGBE_PORT_MODE_10GBASE_T, | 166 | XGBE_PORT_MODE_10GBASE_T, |
| 167 | XGBE_PORT_MODE_10GBASE_R, | 167 | XGBE_PORT_MODE_10GBASE_R, |
| 168 | XGBE_PORT_MODE_SFP, | 168 | XGBE_PORT_MODE_SFP, |
| 169 | XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG, | ||
| 169 | XGBE_PORT_MODE_MAX, | 170 | XGBE_PORT_MODE_MAX, |
| 170 | }; | 171 | }; |
| 171 | 172 | ||
| @@ -1634,6 +1635,7 @@ static enum xgbe_mode xgbe_phy_an73_redrv_outcome(struct xgbe_prv_data *pdata) · 1462 unmodified lines | |||
| 1634 | if (ad_reg & 0x80) { | 1635 | if (ad_reg & 0x80) { |
| 1635 | switch (phy_data->port_mode) { | 1636 | switch (phy_data->port_mode) { |
| 1636 | case XGBE_PORT_MODE_BACKPLANE: | 1637 | case XGBE_PORT_MODE_BACKPLANE: |
| 1638 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 1637 | mode = XGBE_MODE_KR; | 1639 | mode = XGBE_MODE_KR; |
| 1638 | break; | 1640 | break; |
| 1639 | default: | 1641 | default: |
| @@ -1643,6 +1645,7 @@ static enum xgbe_mode xgbe_phy_an73_redrv_outcome(struct xgbe_prv_data *pdata) · 3 unmodified lines | |||
| 1643 | } else if (ad_reg & 0x20) { | 1645 | } else if (ad_reg & 0x20) { |
| 1644 | switch (phy_data->port_mode) { | 1646 | switch (phy_data->port_mode) { |
| 1645 | case XGBE_PORT_MODE_BACKPLANE: | 1647 | case XGBE_PORT_MODE_BACKPLANE: |
| 1648 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 1646 | mode = XGBE_MODE_KX_1000; | 1649 | mode = XGBE_MODE_KX_1000; |
| 1647 | break; | 1650 | break; |
| 1648 | case XGBE_PORT_MODE_1000BASE_X: | 1651 | case XGBE_PORT_MODE_1000BASE_X: |
| @@ -1782,6 +1785,7 @@ static void xgbe_phy_an_advertising(struct xgbe_prv_data *pdata, · 133 unmodified lines | |||
| 1782 | 1785 | ||
| 1783 | switch (phy_data->port_mode) { | 1786 | switch (phy_data->port_mode) { |
| 1784 | case XGBE_PORT_MODE_BACKPLANE: | 1787 | case XGBE_PORT_MODE_BACKPLANE: |
| 1788 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 1785 | XGBE_SET_ADV(dlks, 10000baseKR_Full); | 1789 | XGBE_SET_ADV(dlks, 10000baseKR_Full); |
| 1786 | break; | 1790 | break; |
| 1787 | case XGBE_PORT_MODE_BACKPLANE_2500: | 1791 | case XGBE_PORT_MODE_BACKPLANE_2500: |
| @@ -1874,6 +1878,7 @@ static enum xgbe_an_mode xgbe_phy_an_mode(struct xgbe_prv_data *pdata) · 86 unmodified lines | |||
| 1874 | switch (phy_data->port_mode) { | 1878 | switch (phy_data->port_mode) { |
| 1875 | case XGBE_PORT_MODE_BACKPLANE: | 1879 | case XGBE_PORT_MODE_BACKPLANE: |
| 1876 | return XGBE_AN_MODE_CL73; | 1880 | return XGBE_AN_MODE_CL73; |
| 1881 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 1877 | case XGBE_PORT_MODE_BACKPLANE_2500: | 1882 | case XGBE_PORT_MODE_BACKPLANE_2500: |
| 1878 | return XGBE_AN_MODE_NONE; | 1883 | return XGBE_AN_MODE_NONE; |
| 1879 | case XGBE_PORT_MODE_1000BASE_T: | 1884 | case XGBE_PORT_MODE_1000BASE_T: |
| @@ -2156,6 +2161,7 @@ static enum xgbe_mode xgbe_phy_switch_mode(struct xgbe_prv_data *pdata) · 276 unmodified lines | |||
| 2156 | 2161 | ||
| 2157 | switch (phy_data->port_mode) { | 2162 | switch (phy_data->port_mode) { |
| 2158 | case XGBE_PORT_MODE_BACKPLANE: | 2163 | case XGBE_PORT_MODE_BACKPLANE: |
| 2164 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 2159 | return xgbe_phy_switch_bp_mode(pdata); | 2165 | return xgbe_phy_switch_bp_mode(pdata); |
| 2160 | case XGBE_PORT_MODE_BACKPLANE_2500: | 2166 | case XGBE_PORT_MODE_BACKPLANE_2500: |
| 2161 | return xgbe_phy_switch_bp_2500_mode(pdata); | 2167 | return xgbe_phy_switch_bp_2500_mode(pdata); |
| @@ -2251,6 +2257,7 @@ static enum xgbe_mode xgbe_phy_get_mode(struct xgbe_prv_data *pdata, · 89 unmodified lines | |||
| 2251 | 2257 | ||
| 2252 | switch (phy_data->port_mode) { | 2258 | switch (phy_data->port_mode) { |
| 2253 | case XGBE_PORT_MODE_BACKPLANE: | 2259 | case XGBE_PORT_MODE_BACKPLANE: |
| 2260 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 2254 | return xgbe_phy_get_bp_mode(speed); | 2261 | return xgbe_phy_get_bp_mode(speed); |
| 2255 | case XGBE_PORT_MODE_BACKPLANE_2500: | 2262 | case XGBE_PORT_MODE_BACKPLANE_2500: |
| 2256 | return xgbe_phy_get_bp_2500_mode(speed); | 2263 | return xgbe_phy_get_bp_2500_mode(speed); |
| @@ -2426,6 +2433,7 @@ static bool xgbe_phy_use_mode(struct xgbe_prv_data *pdata, enum xgbe_mode mode) · 169 unmodified lines | |||
| 2426 | 2433 | ||
| 2427 | switch (phy_data->port_mode) { | 2434 | switch (phy_data->port_mode) { |
| 2428 | case XGBE_PORT_MODE_BACKPLANE: | 2435 | case XGBE_PORT_MODE_BACKPLANE: |
| 2436 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 2429 | return xgbe_phy_use_bp_mode(pdata, mode); | 2437 | return xgbe_phy_use_bp_mode(pdata, mode); |
| 2430 | case XGBE_PORT_MODE_BACKPLANE_2500: | 2438 | case XGBE_PORT_MODE_BACKPLANE_2500: |
| 2431 | return xgbe_phy_use_bp_2500_mode(pdata, mode); | 2439 | return xgbe_phy_use_bp_2500_mode(pdata, mode); |
| @@ -2515,6 +2523,7 @@ static bool xgbe_phy_valid_speed(struct xgbe_prv_data *pdata, int speed) · 83 unmodified lines | |||
| 2515 | 2523 | ||
| 2516 | switch (phy_data->port_mode) { | 2524 | switch (phy_data->port_mode) { |
| 2517 | case XGBE_PORT_MODE_BACKPLANE: | 2525 | case XGBE_PORT_MODE_BACKPLANE: |
| 2526 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 2518 | return xgbe_phy_valid_speed_bp_mode(speed); | 2527 | return xgbe_phy_valid_speed_bp_mode(speed); |
| 2519 | case XGBE_PORT_MODE_BACKPLANE_2500: | 2528 | case XGBE_PORT_MODE_BACKPLANE_2500: |
| 2520 | return xgbe_phy_valid_speed_bp_2500_mode(speed); | 2529 | return xgbe_phy_valid_speed_bp_2500_mode(speed); |
| @@ -2792,6 +2801,7 @@ static bool xgbe_phy_port_mode_mismatch(struct xgbe_prv_data *pdata) · 271 unmodified lines | |||
| 2792 | 2801 | ||
| 2793 | switch (phy_data->port_mode) { | 2802 | switch (phy_data->port_mode) { |
| 2794 | case XGBE_PORT_MODE_BACKPLANE: | 2803 | case XGBE_PORT_MODE_BACKPLANE: |
| 2804 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 2795 | if ((phy_data->port_speeds & XGBE_PHY_PORT_SPEED_1000) || | 2805 | if ((phy_data->port_speeds & XGBE_PHY_PORT_SPEED_1000) || |
| 2796 | (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10000)) | 2806 | (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10000)) |
| 2797 | return false; | 2807 | return false; |
| @@ -2844,6 +2854,7 @@ static bool xgbe_phy_conn_type_mismatch(struct xgbe_prv_data *pdata) · 46 unmodified lines | |||
| 2844 | 2854 | ||
| 2845 | switch (phy_data->port_mode) { | 2855 | switch (phy_data->port_mode) { |
| 2846 | case XGBE_PORT_MODE_BACKPLANE: | 2856 | case XGBE_PORT_MODE_BACKPLANE: |
| 2857 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 2847 | case XGBE_PORT_MODE_BACKPLANE_2500: | 2858 | case XGBE_PORT_MODE_BACKPLANE_2500: |
| 2848 | if (phy_data->conn_type == XGBE_CONN_TYPE_BACKPLANE) | 2859 | if (phy_data->conn_type == XGBE_CONN_TYPE_BACKPLANE) |
| 2849 | return false; | 2860 | return false; |
| @@ -3160,6 +3171,8 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) · 310 unmodified lines | |||
| 3160 | /* Backplane support */ | 3171 | /* Backplane support */ |
| 3161 | case XGBE_PORT_MODE_BACKPLANE: | 3172 | case XGBE_PORT_MODE_BACKPLANE: |
| 3162 | XGBE_SET_SUP(lks, Autoneg); | 3173 | XGBE_SET_SUP(lks, Autoneg); |
| 3174 | fallthrough; | ||
| 3175 | case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: | ||
| 3163 | XGBE_SET_SUP(lks, Pause); | 3176 | XGBE_SET_SUP(lks, Pause); |
| 3164 | XGBE_SET_SUP(lks, Asym_Pause); | 3177 | XGBE_SET_SUP(lks, Asym_Pause); |
| 3165 | XGBE_SET_SUP(lks, Backplane); | 3178 | XGBE_SET_SUP(lks, Backplane); |
| @@ -153,6 +153,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv) · 152 unmodified lines | |||
| 153 | if (IS_ERR(data->reset_gpio)) { | 153 | if (IS_ERR(data->reset_gpio)) { |
| 154 | error = PTR_ERR(data->reset_gpio); | 154 | error = PTR_ERR(data->reset_gpio); |
| 155 | dev_err(priv->dev, "Failed to request gpio: %d\n", error); | 155 | dev_err(priv->dev, "Failed to request gpio: %d\n", error); |
| 156 | mdiobus_free(bus); | ||
| 156 | return error; | 157 | return error; |
| 157 | } | 158 | } |
| 158 | 159 | ||
| @@ -2491,8 +2491,10 @@ static int bcm_sysport_probe(struct platform_device *pdev) · 2490 unmodified lines | |||
| 2491 | priv->tx_rings = devm_kcalloc(&pdev->dev, txq, | 2491 | priv->tx_rings = devm_kcalloc(&pdev->dev, txq, |
| 2492 | sizeof(struct bcm_sysport_tx_ring), | 2492 | sizeof(struct bcm_sysport_tx_ring), |
| 2493 | GFP_KERNEL); | 2493 | GFP_KERNEL); |
| 2494 | if (!priv->tx_rings) | 2494 | if (!priv->tx_rings) { |
| 2495 | return -ENOMEM; | 2495 | ret = -ENOMEM; |
| 2496 | goto err_free_netdev; | ||
| 2497 | } | ||
| 2496 | 2498 | ||
| 2497 | priv->is_lite = params->is_lite; | 2499 | priv->is_lite = params->is_lite; |
| 2498 | priv->num_rx_desc_words = params->num_rx_desc_words; | 2500 | priv->num_rx_desc_words = params->num_rx_desc_words; |
| @@ -1141,6 +1141,9 @@ static int bnxt_discard_rx(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, · 1140 unmodified lines | |||
| 1141 | 1141 | ||
| 1142 | static void bnxt_queue_fw_reset_work(struct bnxt *bp, unsigned long delay) | 1142 | static void bnxt_queue_fw_reset_work(struct bnxt *bp, unsigned long delay) |
| 1143 | { | 1143 | { |
| 1144 | if (!(test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))) | ||
| 1145 | return; | ||
| 1146 | |||
| 1144 | if (BNXT_PF(bp)) | 1147 | if (BNXT_PF(bp)) |
| 1145 | queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay); | 1148 | queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay); |
| 1146 | else | 1149 | else |
| @@ -1157,10 +1160,12 @@ static void bnxt_queue_sp_work(struct bnxt *bp) · 10 unmodified lines | |||
| 1157 | 1160 | ||
| 1158 | static void bnxt_cancel_sp_work(struct bnxt *bp) | 1161 | static void bnxt_cancel_sp_work(struct bnxt *bp) |
| 1159 | { | 1162 | { |
| 1160 | if (BNXT_PF(bp)) | 1163 | if (BNXT_PF(bp)) { |
| 1161 | flush_workqueue(bnxt_pf_wq); | 1164 | flush_workqueue(bnxt_pf_wq); |
| 1162 | else | 1165 | } else { |
| 1163 | cancel_work_sync(&bp->sp_task); | 1166 | cancel_work_sync(&bp->sp_task); |
| 1167 | cancel_delayed_work_sync(&bp->fw_reset_task); | ||
| 1168 | } | ||
| 1164 | } | 1169 | } |
| 1165 | 1170 | ||
| 1166 | static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr) | 1171 | static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr) |
| @@ -6102,6 +6107,21 @@ static int bnxt_get_func_stat_ctxs(struct bnxt *bp) · 4935 unmodified lines | |||
| 6102 | return cp + ulp_stat; | 6107 | return cp + ulp_stat; |
| 6103 | } | 6108 | } |
| 6104 | 6109 | ||
| 6110 | /* Check if a default RSS map needs to be setup. This function is only | ||
| 6111 | * used on older firmware that does not require reserving RX rings. | ||
| 6112 | */ | ||
| 6113 | static void bnxt_check_rss_tbl_no_rmgr(struct bnxt *bp) | ||
| 6114 | { | ||
| 6115 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; | ||
| 6116 | |||
| 6117 | /* The RSS map is valid for RX rings set to resv_rx_rings */ | ||
| 6118 | if (hw_resc->resv_rx_rings != bp->rx_nr_rings) { | ||
| 6119 | hw_resc->resv_rx_rings = bp->rx_nr_rings; | ||
| 6120 | if (!netif_is_rxfh_configured(bp->dev)) | ||
| 6121 | bnxt_set_dflt_rss_indir_tbl(bp); | ||
| 6122 | } | ||
| 6123 | } | ||
| 6124 | |||
| 6105 | static bool bnxt_need_reserve_rings(struct bnxt *bp) | 6125 | static bool bnxt_need_reserve_rings(struct bnxt *bp) |
| 6106 | { | 6126 | { |
| 6107 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; | 6127 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; |
| @@ -6110,22 +6130,28 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp) · 2 unmodified lines | |||
| 6110 | int rx = bp->rx_nr_rings, stat; | 6130 | int rx = bp->rx_nr_rings, stat; |
| 6111 | int vnic = 1, grp = rx; | 6131 | int vnic = 1, grp = rx; |
| 6112 | 6132 | ||
| 6113 | if (bp->hwrm_spec_code < 0x10601) | 6133 | if (hw_resc->resv_tx_rings != bp->tx_nr_rings && |
| 6114 | return false; | 6134 | bp->hwrm_spec_code >= 0x10601) |
| 6115 | |||
| 6116 | if (hw_resc->resv_tx_rings != bp->tx_nr_rings) | ||
| 6117 | return true; | 6135 | return true; |
| 6118 | 6136 | ||
| 6137 | /* Old firmware does not need RX ring reservations but we still | ||
| 6138 | * need to setup a default RSS map when needed. With new firmware | ||
| 6139 | * we go through RX ring reservations first and then set up the | ||
| 6140 | * RSS map for the successfully reserved RX rings when needed. | ||
| 6141 | */ | ||
| 6142 | if (!BNXT_NEW_RM(bp)) { | ||
| 6143 | bnxt_check_rss_tbl_no_rmgr(bp); | ||
| 6144 | return false; | ||
| 6145 | } | ||
| 6119 | if ((bp->flags & BNXT_FLAG_RFS) && !(bp->flags & BNXT_FLAG_CHIP_P5)) | 6146 | if ((bp->flags & BNXT_FLAG_RFS) && !(bp->flags & BNXT_FLAG_CHIP_P5)) |
| 6120 | vnic = rx + 1; | 6147 | vnic = rx + 1; |
| 6121 | if (bp->flags & BNXT_FLAG_AGG_RINGS) | 6148 | if (bp->flags & BNXT_FLAG_AGG_RINGS) |
| 6122 | rx <<= 1; | 6149 | rx <<= 1; |
| 6123 | stat = bnxt_get_func_stat_ctxs(bp); | 6150 | stat = bnxt_get_func_stat_ctxs(bp); |
| 6124 | if (BNXT_NEW_RM(bp) && | 6151 | if (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp || |
| 6125 | (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp || | 6152 | hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat || |
| 6126 | hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat || | 6153 | (hw_resc->resv_hw_ring_grps != grp && |
| 6127 | (hw_resc->resv_hw_ring_grps != grp && | 6154 | !(bp->flags & BNXT_FLAG_CHIP_P5))) |
| 6128 | !(bp->flags & BNXT_FLAG_CHIP_P5)))) | ||
| 6129 | return true; | 6155 | return true; |
| 6130 | if ((bp->flags & BNXT_FLAG_CHIP_P5) && BNXT_PF(bp) && | 6156 | if ((bp->flags & BNXT_FLAG_CHIP_P5) && BNXT_PF(bp) && |
| 6131 | hw_resc->resv_irqs != nq) | 6157 | hw_resc->resv_irqs != nq) |
| @@ -6214,6 +6240,9 @@ static int __bnxt_reserve_rings(struct bnxt *bp) · 82 unmodified lines | |||
| 6214 | if (!tx || !rx || !cp || !grp || !vnic || !stat) | 6240 | if (!tx || !rx || !cp || !grp || !vnic || !stat) |
| 6215 | return -ENOMEM; | 6241 | return -ENOMEM; |
| 6216 | 6242 | ||
| 6243 | if (!netif_is_rxfh_configured(bp->dev)) | ||
| 6244 | bnxt_set_dflt_rss_indir_tbl(bp); | ||
| 6245 | |||
| 6217 | return rc; | 6246 | return rc; |
| 6218 | } | 6247 | } |
| 6219 | 6248 | ||
| @@ -8495,9 +8524,6 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init) · 2275 unmodified lines | |||
| 8495 | rc = bnxt_init_int_mode(bp); | 8524 | rc = bnxt_init_int_mode(bp); |
| 8496 | bnxt_ulp_irq_restart(bp, rc); | 8525 | bnxt_ulp_irq_restart(bp, rc); |
| 8497 | } | 8526 | } |
| 8498 | if (!netif_is_rxfh_configured(bp->dev)) | ||
| 8499 | bnxt_set_dflt_rss_indir_tbl(bp); | ||
| 8500 | |||
| 8501 | if (rc) { | 8527 | if (rc) { |
| 8502 | netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc); | 8528 | netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc); |
| 8503 | return rc; | 8529 | return rc; |
| @@ -9284,16 +9310,19 @@ static ssize_t bnxt_show_temp(struct device *dev, · 780 unmodified lines | |||
| 9284 | struct hwrm_temp_monitor_query_input req = {0}; | 9310 | struct hwrm_temp_monitor_query_input req = {0}; |
| 9285 | struct hwrm_temp_monitor_query_output *resp; | 9311 | struct hwrm_temp_monitor_query_output *resp; |
| 9286 | struct bnxt *bp = dev_get_drvdata(dev); | 9312 | struct bnxt *bp = dev_get_drvdata(dev); |
| 9287 | u32 temp = 0; | 9313 | u32 len = 0; |
| 9288 | 9314 | ||
| 9289 | resp = bp->hwrm_cmd_resp_addr; | 9315 | resp = bp->hwrm_cmd_resp_addr; |
| 9290 | bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1); | 9316 | bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1); |
| 9291 | mutex_lock(&bp->hwrm_cmd_lock); | 9317 | mutex_lock(&bp->hwrm_cmd_lock); |
| 9292 | if (!_hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) | 9318 | if (!_hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) |
| 9293 | temp = resp->temp * 1000; /* display millidegree */ | 9319 | len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */ |
| 9294 | mutex_unlock(&bp->hwrm_cmd_lock); | 9320 | mutex_unlock(&bp->hwrm_cmd_lock); |
| 9295 | 9321 | ||
| 9296 | return sprintf(buf, "%u\n", temp); | 9322 | if (len) |
| 9323 | return len; | ||
| 9324 | |||
| 9325 | return sprintf(buf, "unknown\n"); | ||
| 9297 | } | 9326 | } |
| 9298 | static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0); | 9327 | static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0); |
| 9299 | 9328 | ||
| @@ -9475,15 +9504,15 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) · 175 unmodified lines | |||
| 9475 | } | 9504 | } |
| 9476 | } | 9505 | } |
| 9477 | 9506 | ||
| 9478 | bnxt_enable_napi(bp); | ||
| 9479 | bnxt_debug_dev_init(bp); | ||
| 9480 | |||
| 9481 | rc = bnxt_init_nic(bp, irq_re_init); | 9507 | rc = bnxt_init_nic(bp, irq_re_init); |
| 9482 | if (rc) { | 9508 | if (rc) { |
| 9483 | netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc); | 9509 | netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc); |
| 9484 | goto open_err; | 9510 | goto open_err_irq; |
| 9485 | } | 9511 | } |
| 9486 | 9512 | ||
| 9513 | bnxt_enable_napi(bp); | ||
| 9514 | bnxt_debug_dev_init(bp); | ||
| 9515 | |||
| 9487 | if (link_re_init) { | 9516 | if (link_re_init) { |
| 9488 | mutex_lock(&bp->link_lock); | 9517 | mutex_lock(&bp->link_lock); |
| 9489 | rc = bnxt_update_phy_setting(bp); | 9518 | rc = bnxt_update_phy_setting(bp); |
| @@ -9514,10 +9543,6 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init) · 24 unmodified lines | |||
| 9514 | bnxt_vf_reps_open(bp); | 9543 | bnxt_vf_reps_open(bp); |
| 9515 | return 0; | 9544 | return 0; |
| 9516 | 9545 | ||
| 9517 | open_err: | ||
| 9518 | bnxt_debug_dev_exit(bp); | ||
| 9519 | bnxt_disable_napi(bp); | ||
| 9520 | |||
| 9521 | open_err_irq: | 9546 | open_err_irq: |
| 9522 | bnxt_del_napi(bp); | 9547 | bnxt_del_napi(bp); |
| 9523 | 9548 | ||
| @@ -11761,6 +11786,7 @@ static void bnxt_remove_one(struct pci_dev *pdev) · 2237 unmodified lines | |||
| 11761 | unregister_netdev(dev); | 11786 | unregister_netdev(dev); |
| 11762 | bnxt_dl_unregister(bp); | 11787 | bnxt_dl_unregister(bp); |
| 11763 | bnxt_shutdown_tc(bp); | 11788 | bnxt_shutdown_tc(bp); |
| 11789 | clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); | ||
| 11764 | bnxt_cancel_sp_work(bp); | 11790 | bnxt_cancel_sp_work(bp); |
| 11765 | bp->sp_event = 0; | 11791 | bp->sp_event = 0; |
| 11766 | 11792 | ||
| @@ -12200,6 +12226,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 433 unmodified lines | |||
| 12200 | if (BNXT_CHIP_P5(bp)) | 12226 | if (BNXT_CHIP_P5(bp)) |
| 12201 | bp->flags |= BNXT_FLAG_CHIP_P5; | 12227 | bp->flags |= BNXT_FLAG_CHIP_P5; |
| 12202 | 12228 | ||
| 12229 | rc = bnxt_alloc_rss_indir_tbl(bp); | ||
| 12230 | if (rc) | ||
| 12231 | goto init_err_pci_clean; | ||
| 12232 | |||
| 12203 | rc = bnxt_fw_init_one_p2(bp); | 12233 | rc = bnxt_fw_init_one_p2(bp); |
| 12204 | if (rc) | 12234 | if (rc) |
| 12205 | goto init_err_pci_clean; | 12235 | goto init_err_pci_clean; |
| @@ -12304,11 +12334,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 98 unmodified lines | |||
| 12304 | */ | 12334 | */ |
| 12305 | bp->tx_nr_rings_per_tc = bp->tx_nr_rings; | 12335 | bp->tx_nr_rings_per_tc = bp->tx_nr_rings; |
| 12306 | 12336 | ||
| 12307 | rc = bnxt_alloc_rss_indir_tbl(bp); | ||
| 12308 | if (rc) | ||
| 12309 | goto init_err_pci_clean; | ||
| 12310 | bnxt_set_dflt_rss_indir_tbl(bp); | ||
| 12311 | |||
| 12312 | if (BNXT_PF(bp)) { | 12337 | if (BNXT_PF(bp)) { |
| 12313 | if (!bnxt_pf_wq) { | 12338 | if (!bnxt_pf_wq) { |
| 12314 | bnxt_pf_wq = | 12339 | bnxt_pf_wq = |
| @@ -12339,6 +12364,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 24 unmodified lines | |||
| 12339 | (long)pci_resource_start(pdev, 0), dev->dev_addr); | 12364 | (long)pci_resource_start(pdev, 0), dev->dev_addr); |
| 12340 | pcie_print_link_status(pdev); | 12365 | pcie_print_link_status(pdev); |
| 12341 | 12366 | ||
| 12367 | pci_save_state(pdev); | ||
| 12342 | return 0; | 12368 | return 0; |
| 12343 | 12369 | ||
| 12344 | init_err_cleanup: | 12370 | init_err_cleanup: |
| @@ -12536,6 +12562,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) · 191 unmodified lines | |||
| 12536 | "Cannot re-enable PCI device after reset.\n"); | 12562 | "Cannot re-enable PCI device after reset.\n"); |
| 12537 | } else { | 12563 | } else { |
| 12538 | pci_set_master(pdev); | 12564 | pci_set_master(pdev); |
| 12565 | pci_restore_state(pdev); | ||
| 12566 | pci_save_state(pdev); | ||
| 12539 | 12567 | ||
| 12540 | err = bnxt_hwrm_func_reset(bp); | 12568 | err = bnxt_hwrm_func_reset(bp); |
| 12541 | if (!err) { | 12569 | if (!err) { |
| @@ -472,20 +472,13 @@ static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp) · 471 unmodified lines | |||
| 472 | static int bnxt_get_num_ring_stats(struct bnxt *bp) | 472 | static int bnxt_get_num_ring_stats(struct bnxt *bp) |
| 473 | { | 473 | { |
| 474 | int rx, tx, cmn; | 474 | int rx, tx, cmn; |
| 475 | bool sh = false; | ||
| 476 | |||
| 477 | if (bp->flags & BNXT_FLAG_SHARED_RINGS) | ||
| 478 | sh = true; | ||
| 479 | 475 | ||
| 480 | rx = NUM_RING_RX_HW_STATS + NUM_RING_RX_SW_STATS + | 476 | rx = NUM_RING_RX_HW_STATS + NUM_RING_RX_SW_STATS + |
| 481 | bnxt_get_num_tpa_ring_stats(bp); | 477 | bnxt_get_num_tpa_ring_stats(bp); |
| 482 | tx = NUM_RING_TX_HW_STATS; | 478 | tx = NUM_RING_TX_HW_STATS; |
| 483 | cmn = NUM_RING_CMN_SW_STATS; | 479 | cmn = NUM_RING_CMN_SW_STATS; |
| 484 | if (sh) | 480 | return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings + |
| 485 | return (rx + tx + cmn) * bp->cp_nr_rings; | 481 | cmn * bp->cp_nr_rings; |
| 486 | else | ||
| 487 | return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings + | ||
| 488 | cmn * bp->cp_nr_rings; | ||
| 489 | } | 482 | } |
| 490 | 483 | ||
| 491 | static int bnxt_get_num_stats(struct bnxt *bp) | 484 | static int bnxt_get_num_stats(struct bnxt *bp) |
| @@ -806,7 +799,7 @@ static void bnxt_get_channels(struct net_device *dev, · 314 unmodified lines | |||
| 806 | int max_tx_sch_inputs; | 799 | int max_tx_sch_inputs; |
| 807 | 800 | ||
| 808 | /* Get the most up-to-date max_tx_sch_inputs. */ | 801 | /* Get the most up-to-date max_tx_sch_inputs. */ |
| 809 | if (BNXT_NEW_RM(bp)) | 802 | if (netif_running(dev) && BNXT_NEW_RM(bp)) |
| 810 | bnxt_hwrm_func_resc_qcaps(bp, false); | 803 | bnxt_hwrm_func_resc_qcaps(bp, false); |
| 811 | max_tx_sch_inputs = hw_resc->max_tx_sch_inputs; | 804 | max_tx_sch_inputs = hw_resc->max_tx_sch_inputs; |
| 812 | 805 | ||
| @@ -2323,6 +2316,9 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data) · 1510 unmodified lines | |||
| 2323 | if (rc != 0) | 2316 | if (rc != 0) |
| 2324 | return rc; | 2317 | return rc; |
| 2325 | 2318 | ||
| 2319 | if (!dir_entries || !entry_length) | ||
| 2320 | return -EIO; | ||
| 2321 | |||
| 2326 | /* Insert 2 bytes of directory info (count and size of entries) */ | 2322 | /* Insert 2 bytes of directory info (count and size of entries) */ |
| 2327 | if (len < 2) | 2323 | if (len < 2) |
| 2328 | return -EINVAL; | 2324 | return -EINVAL; |
| @@ -1364,7 +1364,7 @@ static int bcmgenet_validate_flow(struct net_device *dev, · 1363 unmodified lines | |||
| 1364 | case ETHER_FLOW: | 1364 | case ETHER_FLOW: |
| 1365 | eth_mask = &cmd->fs.m_u.ether_spec; | 1365 | eth_mask = &cmd->fs.m_u.ether_spec; |
| 1366 | /* don't allow mask which isn't valid */ | 1366 | /* don't allow mask which isn't valid */ |
| 1367 | if (VALIDATE_MASK(eth_mask->h_source) || | 1367 | if (VALIDATE_MASK(eth_mask->h_dest) || |
| 1368 | VALIDATE_MASK(eth_mask->h_source) || | 1368 | VALIDATE_MASK(eth_mask->h_source) || |
| 1369 | VALIDATE_MASK(eth_mask->h_proto)) { | 1369 | VALIDATE_MASK(eth_mask->h_proto)) { |
| 1370 | netdev_err(dev, "rxnfc: Unsupported mask\n"); | 1370 | netdev_err(dev, "rxnfc: Unsupported mask\n"); |
| @@ -7221,8 +7221,8 @@ static inline void tg3_reset_task_schedule(struct tg3 *tp) · 7220 unmodified lines | |||
| 7221 | 7221 | ||
| 7222 | static inline void tg3_reset_task_cancel(struct tg3 *tp) | 7222 | static inline void tg3_reset_task_cancel(struct tg3 *tp) |
| 7223 | { | 7223 | { |
| 7224 | cancel_work_sync(&tp->reset_task); | 7224 | if (test_and_clear_bit(TG3_FLAG_RESET_TASK_PENDING, tp->tg3_flags)) |
| 7225 | tg3_flag_clear(tp, RESET_TASK_PENDING); | 7225 | cancel_work_sync(&tp->reset_task); |
| 7226 | tg3_flag_clear(tp, TX_RECOVERY_PENDING); | 7226 | tg3_flag_clear(tp, TX_RECOVERY_PENDING); |
| 7227 | } | 7227 | } |
| 7228 | 7228 | ||
| @@ -11209,18 +11209,27 @@ static void tg3_reset_task(struct work_struct *work) · 3980 unmodified lines | |||
| 11209 | 11209 | ||
| 11210 | tg3_halt(tp, RESET_KIND_SHUTDOWN, 0); | 11210 | tg3_halt(tp, RESET_KIND_SHUTDOWN, 0); |
| 11211 | err = tg3_init_hw(tp, true); | 11211 | err = tg3_init_hw(tp, true); |
| 11212 | if (err) | 11212 | if (err) { |
| 11213 | tg3_full_unlock(tp); | ||
| 11214 | tp->irq_sync = 0; | ||
| 11215 | tg3_napi_enable(tp); | ||
| 11216 | /* Clear this flag so that tg3_reset_task_cancel() will not | ||
| 11217 | * call cancel_work_sync() and wait forever. | ||
| 11218 | */ | ||
| 11219 | tg3_flag_clear(tp, RESET_TASK_PENDING); | ||
| 11220 | dev_close(tp->dev); | ||
| 11213 | goto out; | 11221 | goto out; |
| 11222 | } | ||
| 11214 | 11223 | ||
| 11215 | tg3_netif_start(tp); | 11224 | tg3_netif_start(tp); |
| 11216 | 11225 | ||
| 11217 | out: | ||
| 11218 | tg3_full_unlock(tp); | 11226 | tg3_full_unlock(tp); |
| 11219 | 11227 | ||
| 11220 | if (!err) | 11228 | if (!err) |
| 11221 | tg3_phy_start(tp); | 11229 | tg3_phy_start(tp); |
| 11222 | 11230 | ||
| 11223 | tg3_flag_clear(tp, RESET_TASK_PENDING); | 11231 | tg3_flag_clear(tp, RESET_TASK_PENDING); |
| 11232 | out: | ||
| 11224 | rtnl_unlock(); | 11233 | rtnl_unlock(); |
| 11225 | } | 11234 | } |
| 11226 | 11235 | ||
| @@ -62,6 +62,7 @@ static struct thermal_zone_device_ops cxgb4_thermal_ops = { · 61 unmodified lines | |||
| 62 | int cxgb4_thermal_init(struct adapter *adap) | 62 | int cxgb4_thermal_init(struct adapter *adap) |
| 63 | { | 63 | { |
| 64 | struct ch_thermal *ch_thermal = &adap->ch_thermal; | 64 | struct ch_thermal *ch_thermal = &adap->ch_thermal; |
| 65 | char ch_tz_name[THERMAL_NAME_LENGTH]; | ||
| 65 | int num_trip = CXGB4_NUM_TRIPS; | 66 | int num_trip = CXGB4_NUM_TRIPS; |
| 66 | u32 param, val; | 67 | u32 param, val; |
| 67 | int ret; | 68 | int ret; |
| @@ -82,7 +83,8 @@ int cxgb4_thermal_init(struct adapter *adap) · 14 unmodified lines | |||
| 82 | ch_thermal->trip_type = THERMAL_TRIP_CRITICAL; | 83 | ch_thermal->trip_type = THERMAL_TRIP_CRITICAL; |
| 83 | } | 84 | } |
| 84 | 85 | ||
| 85 | ch_thermal->tzdev = thermal_zone_device_register("cxgb4", num_trip, | 86 | snprintf(ch_tz_name, sizeof(ch_tz_name), "cxgb4_%s", adap->name); |
| 87 | ch_thermal->tzdev = thermal_zone_device_register(ch_tz_name, num_trip, | ||
| 86 | 0, adap, | 88 | 0, adap, |
| 87 | &cxgb4_thermal_ops, | 89 | &cxgb4_thermal_ops, |
| 88 | NULL, 0, 0); | 90 | NULL, 0, 0); |
| @@ -105,7 +107,9 @@ int cxgb4_thermal_init(struct adapter *adap) · 16 unmodified lines | |||
| 105 | 107 | ||
| 106 | int cxgb4_thermal_remove(struct adapter *adap) | 108 | int cxgb4_thermal_remove(struct adapter *adap) |
| 107 | { | 109 | { |
| 108 | if (adap->ch_thermal.tzdev) | 110 | if (adap->ch_thermal.tzdev) { |
| 109 | thermal_zone_device_unregister(adap->ch_thermal.tzdev); | 111 | thermal_zone_device_unregister(adap->ch_thermal.tzdev); |
| 112 | adap->ch_thermal.tzdev = NULL; | ||
| 113 | } | ||
| 110 | return 0; | 114 | return 0; |
| 111 | } | 115 | } |
| @@ -2446,8 +2446,8 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) · 2445 unmodified lines | |||
| 2446 | port->reset = devm_reset_control_get_exclusive(dev, NULL); | 2446 | port->reset = devm_reset_control_get_exclusive(dev, NULL); |
| 2447 | if (IS_ERR(port->reset)) { | 2447 | if (IS_ERR(port->reset)) { |
| 2448 | dev_err(dev, "no reset\n"); | 2448 | dev_err(dev, "no reset\n"); |
| 2449 | clk_disable_unprepare(port->pclk); | 2449 | ret = PTR_ERR(port->reset); |
| 2450 | return PTR_ERR(port->reset); | 2450 | goto unprepare; |
| 2451 | } | 2451 | } |
| 2452 | reset_control_reset(port->reset); | 2452 | reset_control_reset(port->reset); |
| 2453 | usleep_range(100, 500); | 2453 | usleep_range(100, 500); |
| @@ -2502,25 +2502,25 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) · 48 unmodified lines | |||
| 2502 | IRQF_SHARED, | 2502 | IRQF_SHARED, |
| 2503 | port_names[port->id], | 2503 | port_names[port->id], |
| 2504 | port); | 2504 | port); |
| 2505 | if (ret) { | 2505 | if (ret) |
| 2506 | clk_disable_unprepare(port->pclk); | 2506 | goto unprepare; |
| 2507 | return ret; | ||
| 2508 | } | ||
| 2509 | 2507 | ||
| 2510 | ret = register_netdev(netdev); | 2508 | ret = register_netdev(netdev); |
| 2511 | if (!ret) { | 2509 | if (ret) |
| 2510 | goto unprepare; | ||
| 2511 | |||
| 2512 | netdev_info(netdev, | ||
| 2513 | "irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n", | ||
| 2514 | port->irq, &dmares->start, | ||
| 2515 | &gmacres->start); | ||
| 2516 | ret = gmac_setup_phy(netdev); | ||
| 2517 | if (ret) | ||
| 2512 | netdev_info(netdev, | 2518 | netdev_info(netdev, |
| 2513 | "irq %d, DMA @ 0x%pap, GMAC @ 0x%pap\n", | 2519 | "PHY init failed, deferring to ifup time\n"); |
| 2514 | port->irq, &dmares->start, | 2520 | return 0; |
| 2515 | &gmacres->start); | ||
| 2516 | ret = gmac_setup_phy(netdev); | ||
| 2517 | if (ret) | ||
| 2518 | netdev_info(netdev, | ||
| 2519 | "PHY init failed, deferring to ifup time\n"); | ||
| 2520 | return 0; | ||
| 2521 | } | ||
| 2522 | 2521 | ||
| 2523 | port->netdev = NULL; | 2522 | unprepare: |
| 2523 | clk_disable_unprepare(port->pclk); | ||
| 2524 | return ret; | 2524 | return ret; |
| 2525 | } | 2525 | } |
| 2526 | 2526 | ||
| @@ -2282,8 +2282,10 @@ static int hns_nic_dev_probe(struct platform_device *pdev) · 2281 unmodified lines | |||
| 2282 | priv->enet_ver = AE_VERSION_1; | 2282 | priv->enet_ver = AE_VERSION_1; |
| 2283 | else if (acpi_dev_found(hns_enet_acpi_match[1].id)) | 2283 | else if (acpi_dev_found(hns_enet_acpi_match[1].id)) |
| 2284 | priv->enet_ver = AE_VERSION_2; | 2284 | priv->enet_ver = AE_VERSION_2; |
| 2285 | else | 2285 | else { |
| 2286 | return -ENXIO; | 2286 | ret = -ENXIO; |
| 2287 | goto out_read_prop_fail; | ||
| 2288 | } | ||
| 2287 | 2289 | ||
| 2288 | /* try to find port-idx-in-ae first */ | 2290 | /* try to find port-idx-in-ae first */ |
| 2289 | ret = acpi_node_get_property_reference(dev->fwnode, | 2291 | ret = acpi_node_get_property_reference(dev->fwnode, |
| @@ -2299,7 +2301,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) · 9 unmodified lines | |||
| 2299 | priv->fwnode = args.fwnode; | 2301 | priv->fwnode = args.fwnode; |
| 2300 | } else { | 2302 | } else { |
| 2301 | dev_err(dev, "cannot read cfg data from OF or acpi\n"); | 2303 | dev_err(dev, "cannot read cfg data from OF or acpi\n"); |
| 2302 | return -ENXIO; | 2304 | ret = -ENXIO; |
| 2305 | goto out_read_prop_fail; | ||
| 2303 | } | 2306 | } |
| 2304 | 2307 | ||
| 2305 | ret = device_property_read_u32(dev, "port-idx-in-ae", &port_id); | 2308 | ret = device_property_read_u32(dev, "port-idx-in-ae", &port_id); |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include <net/pkt_cls.h> | 21 | #include <net/pkt_cls.h> |
| 22 | #include <net/tcp.h> | 22 | #include <net/tcp.h> |
| 23 | #include <net/vxlan.h> | 23 | #include <net/vxlan.h> |
| 24 | #include <net/geneve.h> | ||
| 24 | 25 | ||
| 25 | #include "hnae3.h" | 26 | #include "hnae3.h" |
| 26 | #include "hns3_enet.h" | 27 | #include "hns3_enet.h" |
| @@ -780,7 +781,7 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto, · 753 unmodified lines | |||
| 780 | * and it is udp packet, which has a dest port as the IANA assigned. | 781 | * and it is udp packet, which has a dest port as the IANA assigned. |
| 781 | * the hardware is expected to do the checksum offload, but the | 782 | * the hardware is expected to do the checksum offload, but the |
| 782 | * hardware will not do the checksum offload when udp dest port is | 783 | * hardware will not do the checksum offload when udp dest port is |
| 783 | * 4789. | 784 | * 4789 or 6081. |
| 784 | */ | 785 | */ |
| 785 | static bool hns3_tunnel_csum_bug(struct sk_buff *skb) | 786 | static bool hns3_tunnel_csum_bug(struct sk_buff *skb) |
| 786 | { | 787 | { |
| @@ -789,7 +790,8 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb) · 2 unmodified lines | |||
| 789 | l4.hdr = skb_transport_header(skb); | 790 | l4.hdr = skb_transport_header(skb); |
| 790 | 791 | ||
| 791 | if (!(!skb->encapsulation && | 792 | if (!(!skb->encapsulation && |
| 792 | l4.udp->dest == htons(IANA_VXLAN_UDP_PORT))) | 793 | (l4.udp->dest == htons(IANA_VXLAN_UDP_PORT) || |
| 794 | l4.udp->dest == htons(GENEVE_UDP_PORT)))) | ||
| 793 | return false; | 795 | return false; |
| 794 | 796 | ||
| 795 | skb_checksum_help(skb); | 797 | skb_checksum_help(skb); |
| @@ -479,6 +479,9 @@ static int reset_rx_pools(struct ibmvnic_adapter *adapter) · 478 unmodified lines | |||
| 479 | int i, j, rc; | 479 | int i, j, rc; |
| 480 | u64 *size_array; | 480 | u64 *size_array; |
| 481 | 481 | ||
| 482 | if (!adapter->rx_pool) | ||
| 483 | return -1; | ||
| 484 | |||
| 482 | size_array = (u64 *)((u8 *)(adapter->login_rsp_buf) + | 485 | size_array = (u64 *)((u8 *)(adapter->login_rsp_buf) + |
| 483 | be32_to_cpu(adapter->login_rsp_buf->off_rxadd_buff_size)); | 486 | be32_to_cpu(adapter->login_rsp_buf->off_rxadd_buff_size)); |
| 484 | 487 | ||
| @@ -649,6 +652,9 @@ static int reset_tx_pools(struct ibmvnic_adapter *adapter) · 164 unmodified lines | |||
| 649 | int tx_scrqs; | 652 | int tx_scrqs; |
| 650 | int i, rc; | 653 | int i, rc; |
| 651 | 654 | ||
| 655 | if (!adapter->tx_pool) | ||
| 656 | return -1; | ||
| 657 | |||
| 652 | tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); | 658 | tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); |
| 653 | for (i = 0; i < tx_scrqs; i++) { | 659 | for (i = 0; i < tx_scrqs; i++) { |
| 654 | rc = reset_one_tx_pool(adapter, &adapter->tso_pool[i]); | 660 | rc = reset_one_tx_pool(adapter, &adapter->tso_pool[i]); |
| @@ -2011,7 +2017,10 @@ static int do_reset(struct ibmvnic_adapter *adapter, · 1356 unmodified lines | |||
| 2011 | adapter->req_rx_add_entries_per_subcrq != | 2017 | adapter->req_rx_add_entries_per_subcrq != |
| 2012 | old_num_rx_slots || | 2018 | old_num_rx_slots || |
| 2013 | adapter->req_tx_entries_per_subcrq != | 2019 | adapter->req_tx_entries_per_subcrq != |
| 2014 | old_num_tx_slots) { | 2020 | old_num_tx_slots || |
| 2021 | !adapter->rx_pool || | ||
| 2022 | !adapter->tso_pool || | ||
| 2023 | !adapter->tx_pool) { | ||
| 2015 | release_rx_pools(adapter); | 2024 | release_rx_pools(adapter); |
| 2016 | release_tx_pools(adapter); | 2025 | release_tx_pools(adapter); |
| 2017 | release_napi(adapter); | 2026 | release_napi(adapter); |
| @@ -2024,10 +2033,14 @@ static int do_reset(struct ibmvnic_adapter *adapter, · 6 unmodified lines | |||
| 2024 | } else { | 2033 | } else { |
| 2025 | rc = reset_tx_pools(adapter); | 2034 | rc = reset_tx_pools(adapter); |
| 2026 | if (rc) | 2035 | if (rc) |
| 2036 | netdev_dbg(adapter->netdev, "reset tx pools failed (%d)\n", | ||
| 2037 | rc); | ||
| 2027 | goto out; | 2038 | goto out; |
| 2028 | 2039 | ||
| 2029 | rc = reset_rx_pools(adapter); | 2040 | rc = reset_rx_pools(adapter); |
| 2030 | if (rc) | 2041 | if (rc) |
| 2042 | netdev_dbg(adapter->netdev, "reset rx pools failed (%d)\n", | ||
| 2043 | rc); | ||
| 2031 | goto out; | 2044 | goto out; |
| 2032 | } | 2045 | } |
| 2033 | ibmvnic_disable_irqs(adapter); | 2046 | ibmvnic_disable_irqs(adapter); |
| @@ -114,7 +114,7 @@ static int mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order) · 113 unmodified lines | |||
| 114 | goto err_out; | 114 | goto err_out; |
| 115 | 115 | ||
| 116 | for (i = 0; i <= buddy->max_order; ++i) { | 116 | for (i = 0; i <= buddy->max_order; ++i) { |
| 117 | s = BITS_TO_LONGS(1 << (buddy->max_order - i)); | 117 | s = BITS_TO_LONGS(1UL << (buddy->max_order - i)); |
| 118 | buddy->bits[i] = kvmalloc_array(s, sizeof(long), GFP_KERNEL | __GFP_ZERO); | 118 | buddy->bits[i] = kvmalloc_array(s, sizeof(long), GFP_KERNEL | __GFP_ZERO); |
| 119 | if (!buddy->bits[i]) | 119 | if (!buddy->bits[i]) |
| 120 | goto err_out_free; | 120 | goto err_out_free; |
| @@ -61,6 +61,7 @@ struct nfp_tun_active_tuns { · 60 unmodified lines | |||
| 61 | * @flags: options part of the request | 61 | * @flags: options part of the request |
| 62 | * @tun_info.ipv6: dest IPv6 address of active route | 62 | * @tun_info.ipv6: dest IPv6 address of active route |
| 63 | * @tun_info.egress_port: port the encapsulated packet egressed | 63 | * @tun_info.egress_port: port the encapsulated packet egressed |
| 64 | * @tun_info.extra: reserved for future use | ||
| 64 | * @tun_info: tunnels that have sent traffic in reported period | 65 | * @tun_info: tunnels that have sent traffic in reported period |
| 65 | */ | 66 | */ |
| 66 | struct nfp_tun_active_tuns_v6 { | 67 | struct nfp_tun_active_tuns_v6 { |
| @@ -70,6 +71,7 @@ struct nfp_tun_active_tuns_v6 { · 3 unmodified lines | |||
| 70 | struct route_ip_info_v6 { | 71 | struct route_ip_info_v6 { |
| 71 | struct in6_addr ipv6; | 72 | struct in6_addr ipv6; |
| 72 | __be32 egress_port; | 73 | __be32 egress_port; |
| 74 | __be32 extra[2]; | ||
| 73 | } tun_info[]; | 75 | } tun_info[]; |
| 74 | }; | 76 | }; |
| 75 | 77 | ||
| @@ -496,9 +496,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) · 495 unmodified lines | |||
| 496 | struct ionic_cq *txcq; | 496 | struct ionic_cq *txcq; |
| 497 | u32 rx_work_done = 0; | 497 | u32 rx_work_done = 0; |
| 498 | u32 tx_work_done = 0; | 498 | u32 tx_work_done = 0; |
| 499 | u32 work_done = 0; | ||
| 500 | u32 flags = 0; | 499 | u32 flags = 0; |
| 501 | bool unmask; | ||
| 502 | 500 | ||
| 503 | lif = rxcq->bound_q->lif; | 501 | lif = rxcq->bound_q->lif; |
| 504 | idev = &lif->ionic->idev; | 502 | idev = &lif->ionic->idev; |
| @@ -512,17 +510,12 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) · 7 unmodified lines | |||
| 512 | if (rx_work_done) | 510 | if (rx_work_done) |
| 513 | ionic_rx_fill_cb(rxcq->bound_q); | 511 | ionic_rx_fill_cb(rxcq->bound_q); |
| 514 | 512 | ||
| 515 | unmask = (rx_work_done < budget) && (tx_work_done < lif->tx_budget); | 513 | if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) { |
| 516 | |||
| 517 | if (unmask && napi_complete_done(napi, rx_work_done)) { | ||
| 518 | flags |= IONIC_INTR_CRED_UNMASK; | 514 | flags |= IONIC_INTR_CRED_UNMASK; |
| 519 | DEBUG_STATS_INTR_REARM(rxcq->bound_intr); | 515 | DEBUG_STATS_INTR_REARM(rxcq->bound_intr); |
| 520 | work_done = rx_work_done; | ||
| 521 | } else { | ||
| 522 | work_done = budget; | ||
| 523 | } | 516 | } |
| 524 | 517 | ||
| 525 | if (work_done || flags) { | 518 | if (rx_work_done || flags) { |
| 526 | flags |= IONIC_INTR_CRED_RESET_COALESCE; | 519 | flags |= IONIC_INTR_CRED_RESET_COALESCE; |
| 527 | ionic_intr_credits(idev->intr_ctrl, rxcq->bound_intr->index, | 520 | ionic_intr_credits(idev->intr_ctrl, rxcq->bound_intr->index, |
| 528 | tx_work_done + rx_work_done, flags); | 521 | tx_work_done + rx_work_done, flags); |
| @@ -531,7 +524,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) · 2 unmodified lines | |||
| 531 | DEBUG_STATS_NAPI_POLL(qcq, rx_work_done); | 524 | DEBUG_STATS_NAPI_POLL(qcq, rx_work_done); |
| 532 | DEBUG_STATS_NAPI_POLL(qcq, tx_work_done); | 525 | DEBUG_STATS_NAPI_POLL(qcq, tx_work_done); |
| 533 | 526 | ||
| 534 | return work_done; | 527 | return rx_work_done; |
| 535 | } | 528 | } |
| 536 | 529 | ||
| 537 | static dma_addr_t ionic_tx_map_single(struct ionic_queue *q, | 530 | static dma_addr_t ionic_tx_map_single(struct ionic_queue *q, |
| @@ -1342,6 +1342,51 @@ static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler, · 1341 unmodified lines | |||
| 1342 | return error; | 1342 | return error; |
| 1343 | } | 1343 | } |
| 1344 | 1344 | ||
| 1345 | /* MDIO bus init function */ | ||
| 1346 | static int ravb_mdio_init(struct ravb_private *priv) | ||
| 1347 | { | ||
| 1348 | struct platform_device *pdev = priv->pdev; | ||
| 1349 | struct device *dev = &pdev->dev; | ||
| 1350 | int error; | ||
| 1351 | |||
| 1352 | /* Bitbang init */ | ||
| 1353 | priv->mdiobb.ops = &bb_ops; | ||
| 1354 | |||
| 1355 | /* MII controller setting */ | ||
| 1356 | priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb); | ||
| 1357 | if (!priv->mii_bus) | ||
| 1358 | return -ENOMEM; | ||
| 1359 | |||
| 1360 | /* Hook up MII support for ethtool */ | ||
| 1361 | priv->mii_bus->name = "ravb_mii"; | ||
| 1362 | priv->mii_bus->parent = dev; | ||
| 1363 | snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", | ||
| 1364 | pdev->name, pdev->id); | ||
| 1365 | |||
| 1366 | /* Register MDIO bus */ | ||
| 1367 | error = of_mdiobus_register(priv->mii_bus, dev->of_node); | ||
| 1368 | if (error) | ||
| 1369 | goto out_free_bus; | ||
| 1370 | |||
| 1371 | return 0; | ||
| 1372 | |||
| 1373 | out_free_bus: | ||
| 1374 | free_mdio_bitbang(priv->mii_bus); | ||
| 1375 | return error; | ||
| 1376 | } | ||
| 1377 | |||
| 1378 | /* MDIO bus release function */ | ||
| 1379 | static int ravb_mdio_release(struct ravb_private *priv) | ||
| 1380 | { | ||
| 1381 | /* Unregister mdio bus */ | ||
| 1382 | mdiobus_unregister(priv->mii_bus); | ||
| 1383 | |||
| 1384 | /* Free bitbang info */ | ||
| 1385 | free_mdio_bitbang(priv->mii_bus); | ||
| 1386 | |||
| 1387 | return 0; | ||
| 1388 | } | ||
| 1389 | |||
| 1345 | /* Network device open function for Ethernet AVB */ | 1390 | /* Network device open function for Ethernet AVB */ |
| 1346 | static int ravb_open(struct net_device *ndev) | 1391 | static int ravb_open(struct net_device *ndev) |
| 1347 | { | 1392 | { |
| @@ -1350,6 +1395,13 @@ static int ravb_open(struct net_device *ndev) · 2 unmodified lines | |||
| 1350 | struct device *dev = &pdev->dev; | 1395 | struct device *dev = &pdev->dev; |
| 1351 | int error; | 1396 | int error; |
| 1352 | 1397 | ||
| 1398 | /* MDIO bus init */ | ||
| 1399 | error = ravb_mdio_init(priv); | ||
| 1400 | if (error) { | ||
| 1401 | netdev_err(ndev, "failed to initialize MDIO\n"); | ||
| 1402 | return error; | ||
| 1403 | } | ||
| 1404 | |||
| 1353 | napi_enable(&priv->napi[RAVB_BE]); | 1405 | napi_enable(&priv->napi[RAVB_BE]); |
| 1354 | napi_enable(&priv->napi[RAVB_NC]); | 1406 | napi_enable(&priv->napi[RAVB_NC]); |
| 1355 | 1407 | ||
| @@ -1427,6 +1479,7 @@ out_free_irq: · 71 unmodified lines | |||
| 1427 | out_napi_off: | 1479 | out_napi_off: |
| 1428 | napi_disable(&priv->napi[RAVB_NC]); | 1480 | napi_disable(&priv->napi[RAVB_NC]); |
| 1429 | napi_disable(&priv->napi[RAVB_BE]); | 1481 | napi_disable(&priv->napi[RAVB_BE]); |
| 1482 | ravb_mdio_release(priv); | ||
| 1430 | return error; | 1483 | return error; |
| 1431 | } | 1484 | } |
| 1432 | 1485 | ||
| @@ -1736,6 +1789,8 @@ static int ravb_close(struct net_device *ndev) · 303 unmodified lines | |||
| 1736 | ravb_ring_free(ndev, RAVB_BE); | 1789 | ravb_ring_free(ndev, RAVB_BE); |
| 1737 | ravb_ring_free(ndev, RAVB_NC); | 1790 | ravb_ring_free(ndev, RAVB_NC); |
| 1738 | 1791 | ||
| 1792 | ravb_mdio_release(priv); | ||
| 1793 | |||
| 1739 | return 0; | 1794 | return 0; |
| 1740 | } | 1795 | } |
| 1741 | 1796 | ||
| @@ -1887,51 +1942,6 @@ static const struct net_device_ops ravb_netdev_ops = { · 145 unmodified lines | |||
| 1887 | .ndo_set_features = ravb_set_features, | 1942 | .ndo_set_features = ravb_set_features, |
| 1888 | }; | 1943 | }; |
| 1889 | 1944 | ||
| 1890 | /* MDIO bus init function */ | ||
| 1891 | static int ravb_mdio_init(struct ravb_private *priv) | ||
| 1892 | { | ||
| 1893 | struct platform_device *pdev = priv->pdev; | ||
| 1894 | struct device *dev = &pdev->dev; | ||
| 1895 | int error; | ||
| 1896 | |||
| 1897 | /* Bitbang init */ | ||
| 1898 | priv->mdiobb.ops = &bb_ops; | ||
| 1899 | |||
| 1900 | /* MII controller setting */ | ||
| 1901 | priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb); | ||
| 1902 | if (!priv->mii_bus) | ||
| 1903 | return -ENOMEM; | ||
| 1904 | |||
| 1905 | /* Hook up MII support for ethtool */ | ||
| 1906 | priv->mii_bus->name = "ravb_mii"; | ||
| 1907 | priv->mii_bus->parent = dev; | ||
| 1908 | snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", | ||
| 1909 | pdev->name, pdev->id); | ||
| 1910 | |||
| 1911 | /* Register MDIO bus */ | ||
| 1912 | error = of_mdiobus_register(priv->mii_bus, dev->of_node); | ||
| 1913 | if (error) | ||
| 1914 | goto out_free_bus; | ||
| 1915 | |||
| 1916 | return 0; | ||
| 1917 | |||
| 1918 | out_free_bus: | ||
| 1919 | free_mdio_bitbang(priv->mii_bus); | ||
| 1920 | return error; | ||
| 1921 | } | ||
| 1922 | |||
| 1923 | /* MDIO bus release function */ | ||
| 1924 | static int ravb_mdio_release(struct ravb_private *priv) | ||
| 1925 | { | ||
| 1926 | /* Unregister mdio bus */ | ||
| 1927 | mdiobus_unregister(priv->mii_bus); | ||
| 1928 | |||
| 1929 | /* Free bitbang info */ | ||
| 1930 | free_mdio_bitbang(priv->mii_bus); | ||
| 1931 | |||
| 1932 | return 0; | ||
| 1933 | } | ||
| 1934 | |||
| 1935 | static const struct of_device_id ravb_match_table[] = { | 1945 | static const struct of_device_id ravb_match_table[] = { |
| 1936 | { .compatible = "renesas,etheravb-r8a7790", .data = (void *)RCAR_GEN2 }, | 1946 | { .compatible = "renesas,etheravb-r8a7790", .data = (void *)RCAR_GEN2 }, |
| 1937 | { .compatible = "renesas,etheravb-r8a7794", .data = (void *)RCAR_GEN2 }, | 1947 | { .compatible = "renesas,etheravb-r8a7794", .data = (void *)RCAR_GEN2 }, |
| @@ -2174,13 +2184,6 @@ static int ravb_probe(struct platform_device *pdev) · 236 unmodified lines | |||
| 2174 | eth_hw_addr_random(ndev); | 2184 | eth_hw_addr_random(ndev); |
| 2175 | } | 2185 | } |
| 2176 | 2186 | ||
| 2177 | /* MDIO bus init */ | ||
| 2178 | error = ravb_mdio_init(priv); | ||
| 2179 | if (error) { | ||
| 2180 | dev_err(&pdev->dev, "failed to initialize MDIO\n"); | ||
| 2181 | goto out_dma_free; | ||
| 2182 | } | ||
| 2183 | |||
| 2184 | netif_napi_add(ndev, &priv->napi[RAVB_BE], ravb_poll, 64); | 2187 | netif_napi_add(ndev, &priv->napi[RAVB_BE], ravb_poll, 64); |
| 2185 | netif_napi_add(ndev, &priv->napi[RAVB_NC], ravb_poll, 64); | 2188 | netif_napi_add(ndev, &priv->napi[RAVB_NC], ravb_poll, 64); |
| 2186 | 2189 | ||
| @@ -2202,8 +2205,6 @@ static int ravb_probe(struct platform_device *pdev) · 15 unmodified lines | |||
| 2202 | out_napi_del: | 2205 | out_napi_del: |
| 2203 | netif_napi_del(&priv->napi[RAVB_NC]); | 2206 | netif_napi_del(&priv->napi[RAVB_NC]); |
| 2204 | netif_napi_del(&priv->napi[RAVB_BE]); | 2207 | netif_napi_del(&priv->napi[RAVB_BE]); |
| 2205 | ravb_mdio_release(priv); | ||
| 2206 | out_dma_free: | ||
| 2207 | dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, | 2208 | dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, |
| 2208 | priv->desc_bat_dma); | 2209 | priv->desc_bat_dma); |
| 2209 | 2210 | ||
| @@ -2235,7 +2236,6 @@ static int ravb_remove(struct platform_device *pdev) · 25 unmodified lines | |||
| 2235 | unregister_netdev(ndev); | 2236 | unregister_netdev(ndev); |
| 2236 | netif_napi_del(&priv->napi[RAVB_NC]); | 2237 | netif_napi_del(&priv->napi[RAVB_NC]); |
| 2237 | netif_napi_del(&priv->napi[RAVB_BE]); | 2238 | netif_napi_del(&priv->napi[RAVB_BE]); |
| 2238 | ravb_mdio_release(priv); | ||
| 2239 | pm_runtime_disable(&pdev->dev); | 2239 | pm_runtime_disable(&pdev->dev); |
| 2240 | free_netdev(ndev); | 2240 | free_netdev(ndev); |
| 2241 | platform_set_drvdata(pdev, NULL); | 2241 | platform_set_drvdata(pdev, NULL); |
| @@ -36,7 +36,7 @@ bool ef100_rx_buf_hash_valid(const u8 *prefix) · 35 unmodified lines | |||
| 36 | return PREFIX_FIELD(prefix, RSS_HASH_VALID); | 36 | return PREFIX_FIELD(prefix, RSS_HASH_VALID); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | static bool check_fcs(struct efx_channel *channel, u32 *prefix) | 39 | static bool ef100_has_fcs_error(struct efx_channel *channel, u32 *prefix) |
| 40 | { | 40 | { |
| 41 | u16 rxclass; | 41 | u16 rxclass; |
| 42 | u8 l2status; | 42 | u8 l2status; |
| @@ -46,11 +46,11 @@ static bool check_fcs(struct efx_channel *channel, u32 *prefix) · 3 unmodified lines | |||
| 46 | 46 | ||
| 47 | if (likely(l2status == ESE_GZ_RH_HCLASS_L2_STATUS_OK)) | 47 | if (likely(l2status == ESE_GZ_RH_HCLASS_L2_STATUS_OK)) |
| 48 | /* Everything is ok */ | 48 | /* Everything is ok */ |
| 49 | return 0; | 49 | return false; |
| 50 | 50 | ||
| 51 | if (l2status == ESE_GZ_RH_HCLASS_L2_STATUS_FCS_ERR) | 51 | if (l2status == ESE_GZ_RH_HCLASS_L2_STATUS_FCS_ERR) |
| 52 | channel->n_rx_eth_crc_err++; | 52 | channel->n_rx_eth_crc_err++; |
| 53 | return 1; | 53 | return true; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | void __ef100_rx_packet(struct efx_channel *channel) | 56 | void __ef100_rx_packet(struct efx_channel *channel) |
| @@ -63,7 +63,7 @@ void __ef100_rx_packet(struct efx_channel *channel) · 6 unmodified lines | |||
| 63 | 63 | ||
| 64 | prefix = (u32 *)(eh - ESE_GZ_RX_PKT_PREFIX_LEN); | 64 | prefix = (u32 *)(eh - ESE_GZ_RX_PKT_PREFIX_LEN); |
| 65 | 65 | ||
| 66 | if (check_fcs(channel, prefix) && | 66 | if (ef100_has_fcs_error(channel, prefix) && |
| 67 | unlikely(!(efx->net_dev->features & NETIF_F_RXALL))) | 67 | unlikely(!(efx->net_dev->features & NETIF_F_RXALL))) |
| 68 | goto out; | 68 | goto out; |
| 69 | 69 | ||
| @@ -174,6 +174,8 @@ void am65_cpsw_nuss_adjust_link(struct net_device *ndev) · 173 unmodified lines | |||
| 174 | if (phy->speed == 10 && phy_interface_is_rgmii(phy)) | 174 | if (phy->speed == 10 && phy_interface_is_rgmii(phy)) |
| 175 | /* Can be used with in band mode only */ | 175 | /* Can be used with in band mode only */ |
| 176 | mac_control |= CPSW_SL_CTL_EXT_EN; | 176 | mac_control |= CPSW_SL_CTL_EXT_EN; |
| 177 | if (phy->speed == 100 && phy->interface == PHY_INTERFACE_MODE_RMII) | ||
| 178 | mac_control |= CPSW_SL_CTL_IFCTL_A; | ||
| 177 | if (phy->duplex) | 179 | if (phy->duplex) |
| 178 | mac_control |= CPSW_SL_CTL_FULLDUPLEX; | 180 | mac_control |= CPSW_SL_CTL_FULLDUPLEX; |
| 179 | 181 | ||
| @@ -1116,7 +1116,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, · 1115 unmodified lines | |||
| 1116 | HOST_PORT_NUM, ALE_VLAN, vid); | 1116 | HOST_PORT_NUM, ALE_VLAN, vid); |
| 1117 | ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, | 1117 | ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, |
| 1118 | 0, ALE_VLAN, vid); | 1118 | 0, ALE_VLAN, vid); |
| 1119 | ret |= cpsw_ale_flush_multicast(cpsw->ale, 0, vid); | 1119 | ret |= cpsw_ale_flush_multicast(cpsw->ale, ALE_PORT_HOST, vid); |
| 1120 | err: | 1120 | err: |
| 1121 | pm_runtime_put(cpsw->dev); | 1121 | pm_runtime_put(cpsw->dev); |
| 1122 | return ret; | 1122 | return ret; |
| @@ -1032,19 +1032,34 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, · 1031 unmodified lines | |||
| 1032 | return ret; | 1032 | return ret; |
| 1033 | } | 1033 | } |
| 1034 | 1034 | ||
| 1035 | /* reset the return code as pm_runtime_get_sync() can return | ||
| 1036 | * non zero values as well. | ||
| 1037 | */ | ||
| 1038 | ret = 0; | ||
| 1035 | for (i = 0; i < cpsw->data.slaves; i++) { | 1039 | for (i = 0; i < cpsw->data.slaves; i++) { |
| 1036 | if (cpsw->slaves[i].ndev && | 1040 | if (cpsw->slaves[i].ndev && |
| 1037 | vid == cpsw->slaves[i].port_vlan) | 1041 | vid == cpsw->slaves[i].port_vlan) { |
| 1042 | ret = -EINVAL; | ||
| 1038 | goto err; | 1043 | goto err; |
| 1044 | } | ||
| 1039 | } | 1045 | } |
| 1040 | 1046 | ||
| 1041 | dev_dbg(priv->dev, "removing vlanid %d from vlan filter\n", vid); | 1047 | dev_dbg(priv->dev, "removing vlanid %d from vlan filter\n", vid); |
| 1042 | cpsw_ale_del_vlan(cpsw->ale, vid, 0); | 1048 | ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0); |
| 1043 | cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr, | 1049 | if (ret) |
| 1044 | HOST_PORT_NUM, ALE_VLAN, vid); | 1050 | dev_err(priv->dev, "cpsw_ale_del_vlan() failed: ret %d\n", ret); |
| 1045 | cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, | 1051 | ret = cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr, |
| 1046 | 0, ALE_VLAN, vid); | 1052 | HOST_PORT_NUM, ALE_VLAN, vid); |
| 1047 | cpsw_ale_flush_multicast(cpsw->ale, 0, vid); | 1053 | if (ret) |
| 1054 | dev_err(priv->dev, "cpsw_ale_del_ucast() failed: ret %d\n", | ||
| 1055 | ret); | ||
| 1056 | ret = cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, | ||
| 1057 | 0, ALE_VLAN, vid); | ||
| 1058 | if (ret) | ||
| 1059 | dev_err(priv->dev, "cpsw_ale_del_mcast failed. ret %d\n", | ||
| 1060 | ret); | ||
| 1061 | cpsw_ale_flush_multicast(cpsw->ale, ALE_PORT_HOST, vid); | ||
| 1062 | ret = 0; | ||
| 1048 | err: | 1063 | err: |
| 1049 | pm_runtime_put(cpsw->dev); | 1064 | pm_runtime_put(cpsw->dev); |
| 1050 | return ret; | 1065 | return ret; |
| @@ -1179,6 +1179,7 @@ static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq, · 1178 unmodified lines | |||
| 1179 | goto nlmsg_failure; | 1179 | goto nlmsg_failure; |
| 1180 | 1180 | ||
| 1181 | if (nla_put_u32(skb, GTPA_VERSION, pctx->gtp_version) || | 1181 | if (nla_put_u32(skb, GTPA_VERSION, pctx->gtp_version) || |
| 1182 | nla_put_u32(skb, GTPA_LINK, pctx->dev->ifindex) || | ||
| 1182 | nla_put_be32(skb, GTPA_PEER_ADDRESS, pctx->peer_addr_ip4.s_addr) || | 1183 | nla_put_be32(skb, GTPA_PEER_ADDRESS, pctx->peer_addr_ip4.s_addr) || |
| 1183 | nla_put_be32(skb, GTPA_MS_ADDRESS, pctx->ms_addr_ip4.s_addr)) | 1184 | nla_put_be32(skb, GTPA_MS_ADDRESS, pctx->ms_addr_ip4.s_addr)) |
| 1184 | goto nla_put_failure; | 1185 | goto nla_put_failure; |
| @@ -215,9 +215,9 @@ static int dp83867_set_wol(struct phy_device *phydev, · 214 unmodified lines | |||
| 215 | if (wol->wolopts & WAKE_MAGICSECURE) { | 215 | if (wol->wolopts & WAKE_MAGICSECURE) { |
| 216 | phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1, | 216 | phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1, |
| 217 | (wol->sopass[1] << 8) | wol->sopass[0]); | 217 | (wol->sopass[1] << 8) | wol->sopass[0]); |
| 218 | phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1, | 218 | phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP2, |
| 219 | (wol->sopass[3] << 8) | wol->sopass[2]); | 219 | (wol->sopass[3] << 8) | wol->sopass[2]); |
| 220 | phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1, | 220 | phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP3, |
| 221 | (wol->sopass[5] << 8) | wol->sopass[4]); | 221 | (wol->sopass[5] << 8) | wol->sopass[4]); |
| 222 | 222 | ||
| 223 | val_rxcfg |= DP83867_WOL_SEC_EN; | 223 | val_rxcfg |= DP83867_WOL_SEC_EN; |
| @@ -427,18 +427,18 @@ static int dp83869_config_init(struct phy_device *phydev) · 426 unmodified lines | |||
| 427 | return ret; | 427 | return ret; |
| 428 | 428 | ||
| 429 | val = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL); | 429 | val = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL); |
| 430 | val &= ~(DP83869_RGMII_TX_CLK_DELAY_EN | | 430 | val |= (DP83869_RGMII_TX_CLK_DELAY_EN | |
| 431 | DP83869_RGMII_RX_CLK_DELAY_EN); | 431 | DP83869_RGMII_RX_CLK_DELAY_EN); |
| 432 | 432 | ||
| 433 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) | 433 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) |
| 434 | val |= (DP83869_RGMII_TX_CLK_DELAY_EN | | 434 | val &= ~(DP83869_RGMII_TX_CLK_DELAY_EN | |
| 435 | DP83869_RGMII_RX_CLK_DELAY_EN); | 435 | DP83869_RGMII_RX_CLK_DELAY_EN); |
| 436 | 436 | ||
| 437 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) | 437 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) |
| 438 | val |= DP83869_RGMII_TX_CLK_DELAY_EN; | 438 | val &= ~DP83869_RGMII_TX_CLK_DELAY_EN; |
| 439 | 439 | ||
| 440 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) | 440 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) |
| 441 | val |= DP83869_RGMII_RX_CLK_DELAY_EN; | 441 | val &= ~DP83869_RGMII_RX_CLK_DELAY_EN; |
| 442 | 442 | ||
| 443 | ret = phy_write_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL, | 443 | ret = phy_write_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL, |
| 444 | val); | 444 | val); |
| @@ -252,6 +252,7 @@ config USB_NET_CDC_EEM · 251 unmodified lines | |||
| 252 | config USB_NET_CDC_NCM | 252 | config USB_NET_CDC_NCM |
| 253 | tristate "CDC NCM support" | 253 | tristate "CDC NCM support" |
| 254 | depends on USB_USBNET | 254 | depends on USB_USBNET |
| 255 | select USB_NET_CDCETHER | ||
| 255 | default y | 256 | default y |
| 256 | help | 257 | help |
| 257 | This driver provides support for CDC NCM (Network Control Model | 258 | This driver provides support for CDC NCM (Network Control Model |
| @@ -296,7 +296,7 @@ int asix_read_phy_addr(struct usbnet *dev, int internal) · 295 unmodified lines | |||
| 296 | 296 | ||
| 297 | netdev_dbg(dev->net, "asix_get_phy_addr()\n"); | 297 | netdev_dbg(dev->net, "asix_get_phy_addr()\n"); |
| 298 | 298 | ||
| 299 | if (ret < 0) { | 299 | if (ret < 2) { |
| 300 | netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret); | 300 | netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret); |
| 301 | goto out; | 301 | goto out; |
| 302 | } | 302 | } |
| @@ -625,6 +625,10 @@ static const struct usb_device_id products[] = { · 624 unmodified lines | |||
| 625 | USB_DEVICE(0x0a46, 0x1269), /* DM9621A USB to Fast Ethernet Adapter */ | 625 | USB_DEVICE(0x0a46, 0x1269), /* DM9621A USB to Fast Ethernet Adapter */ |
| 626 | .driver_info = (unsigned long)&dm9601_info, | 626 | .driver_info = (unsigned long)&dm9601_info, |
| 627 | }, | 627 | }, |
| 628 | { | ||
| 629 | USB_DEVICE(0x0586, 0x3427), /* ZyXEL Keenetic Plus DSL xDSL modem */ | ||
| 630 | .driver_info = (unsigned long)&dm9601_info, | ||
| 631 | }, | ||
| 628 | {}, // END | 632 | {}, // END |
| 629 | }; | 633 | }; |
| 630 | 634 | ||
| @@ -229,7 +229,7 @@ static void hdlc_setup_dev(struct net_device *dev) · 228 unmodified lines | |||
| 229 | dev->min_mtu = 68; | 229 | dev->min_mtu = 68; |
| 230 | dev->max_mtu = HDLC_MAX_MTU; | 230 | dev->max_mtu = HDLC_MAX_MTU; |
| 231 | dev->type = ARPHRD_RAWHDLC; | 231 | dev->type = ARPHRD_RAWHDLC; |
| 232 | dev->hard_header_len = 16; | 232 | dev->hard_header_len = 0; |
| 233 | dev->needed_headroom = 0; | 233 | dev->needed_headroom = 0; |
| 234 | dev->addr_len = 0; | 234 | dev->addr_len = 0; |
| 235 | dev->header_ops = &hdlc_null_ops; | 235 | dev->header_ops = &hdlc_null_ops; |
| @@ -370,6 +370,7 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr) · 369 unmodified lines | |||
| 370 | memcpy(&state(hdlc)->settings, &new_settings, size); | 370 | memcpy(&state(hdlc)->settings, &new_settings, size); |
| 371 | spin_lock_init(&state(hdlc)->lock); | 371 | spin_lock_init(&state(hdlc)->lock); |
| 372 | dev->header_ops = &cisco_header_ops; | 372 | dev->header_ops = &cisco_header_ops; |
| 373 | dev->hard_header_len = sizeof(struct hdlc_header); | ||
| 373 | dev->type = ARPHRD_CISCO; | 374 | dev->type = ARPHRD_CISCO; |
| 374 | call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev); | 375 | call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev); |
| 375 | netif_dormant_on(dev); | 376 | netif_dormant_on(dev); |
| @@ -210,6 +210,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb) · 209 unmodified lines | |||
| 210 | 210 | ||
| 211 | skb->dev = dev = lapbeth->ethdev; | 211 | skb->dev = dev = lapbeth->ethdev; |
| 212 | 212 | ||
| 213 | skb_reset_network_header(skb); | ||
| 214 | |||
| 213 | dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); | 215 | dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); |
| 214 | 216 | ||
| 215 | dev_queue_xmit(skb); | 217 | dev_queue_xmit(skb); |
| @@ -340,6 +342,7 @@ static int lapbeth_new_device(struct net_device *dev) · 124 unmodified lines | |||
| 340 | */ | 342 | */ |
| 341 | ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len | 343 | ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len |
| 342 | + dev->needed_headroom; | 344 | + dev->needed_headroom; |
| 345 | ndev->needed_tailroom = dev->needed_tailroom; | ||
| 343 | 346 | ||
| 344 | lapbeth = netdev_priv(ndev); | 347 | lapbeth = netdev_priv(ndev); |
| 345 | lapbeth->axdev = ndev; | 348 | lapbeth->axdev = ndev; |
| @@ -966,7 +966,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev, · 965 unmodified lines | |||
| 966 | rc = down_killable(&stcontext->exchange_lock); | 966 | rc = down_killable(&stcontext->exchange_lock); |
| 967 | if (rc) { | 967 | if (rc) { |
| 968 | WARN(1, "Semaphore is not found up in st95hf_in_send_cmd\n"); | 968 | WARN(1, "Semaphore is not found up in st95hf_in_send_cmd\n"); |
| 969 | return rc; | 969 | goto free_skb_resp; |
| 970 | } | 970 | } |
| 971 | 971 | ||
| 972 | rc = st95hf_spi_send(&stcontext->spicontext, skb->data, | 972 | rc = st95hf_spi_send(&stcontext->spicontext, skb->data, |
| @@ -2026,13 +2026,49 @@ static void nvme_update_disk_info(struct gendisk *disk, · 2025 unmodified lines | |||
| 2026 | blk_mq_unfreeze_queue(disk->queue); | 2026 | blk_mq_unfreeze_queue(disk->queue); |
| 2027 | } | 2027 | } |
| 2028 | 2028 | ||
| 2029 | static inline bool nvme_first_scan(struct gendisk *disk) | ||
| 2030 | { | ||
| 2031 | /* nvme_alloc_ns() scans the disk prior to adding it */ | ||
| 2032 | return !(disk->flags & GENHD_FL_UP); | ||
| 2033 | } | ||
| 2034 | |||
| 2035 | static void nvme_set_chunk_sectors(struct nvme_ns *ns, struct nvme_id_ns *id) | ||
| 2036 | { | ||
| 2037 | struct nvme_ctrl *ctrl = ns->ctrl; | ||
| 2038 | u32 iob; | ||
| 2039 | |||
| 2040 | if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && | ||
| 2041 | is_power_of_2(ctrl->max_hw_sectors)) | ||
| 2042 | iob = ctrl->max_hw_sectors; | ||
| 2043 | else | ||
| 2044 | iob = nvme_lba_to_sect(ns, le16_to_cpu(id->noiob)); | ||
| 2045 | |||
| 2046 | if (!iob) | ||
| 2047 | return; | ||
| 2048 | |||
| 2049 | if (!is_power_of_2(iob)) { | ||
| 2050 | if (nvme_first_scan(ns->disk)) | ||
| 2051 | pr_warn("%s: ignoring unaligned IO boundary:%u\n", | ||
| 2052 | ns->disk->disk_name, iob); | ||
| 2053 | return; | ||
| 2054 | } | ||
| 2055 | |||
| 2056 | if (blk_queue_is_zoned(ns->disk->queue)) { | ||
| 2057 | if (nvme_first_scan(ns->disk)) | ||
| 2058 | pr_warn("%s: ignoring zoned namespace IO boundary\n", | ||
| 2059 | ns->disk->disk_name); | ||
| 2060 | return; | ||
| 2061 | } | ||
| 2062 | |||
| 2063 | blk_queue_chunk_sectors(ns->queue, iob); | ||
| 2064 | } | ||
| 2065 | |||
| 2029 | static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) | 2066 | static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) |
| 2030 | { | 2067 | { |
| 2031 | unsigned lbaf = id->flbas & NVME_NS_FLBAS_LBA_MASK; | 2068 | unsigned lbaf = id->flbas & NVME_NS_FLBAS_LBA_MASK; |
| 2032 | struct nvme_ns *ns = disk->private_data; | 2069 | struct nvme_ns *ns = disk->private_data; |
| 2033 | struct nvme_ctrl *ctrl = ns->ctrl; | 2070 | struct nvme_ctrl *ctrl = ns->ctrl; |
| 2034 | int ret; | 2071 | int ret; |
| 2035 | u32 iob; | ||
| 2036 | 2072 | ||
| 2037 | /* | 2073 | /* |
| 2038 | * If identify namespace failed, use default 512 byte block size so | 2074 | * If identify namespace failed, use default 512 byte block size so |
| @@ -2060,12 +2096,6 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) · 21 unmodified lines | |||
| 2060 | return -ENODEV; | 2096 | return -ENODEV; |
| 2061 | } | 2097 | } |
| 2062 | 2098 | ||
| 2063 | if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && | ||
| 2064 | is_power_of_2(ctrl->max_hw_sectors)) | ||
| 2065 | iob = ctrl->max_hw_sectors; | ||
| 2066 | else | ||
| 2067 | iob = nvme_lba_to_sect(ns, le16_to_cpu(id->noiob)); | ||
| 2068 | |||
| 2069 | ns->features = 0; | 2099 | ns->features = 0; |
| 2070 | ns->ms = le16_to_cpu(id->lbaf[lbaf].ms); | 2100 | ns->ms = le16_to_cpu(id->lbaf[lbaf].ms); |
| 2071 | /* the PI implementation requires metadata equal t10 pi tuple size */ | 2101 | /* the PI implementation requires metadata equal t10 pi tuple size */ |
| @@ -2097,8 +2127,7 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) · 25 unmodified lines | |||
| 2097 | } | 2127 | } |
| 2098 | } | 2128 | } |
| 2099 | 2129 | ||
| 2100 | if (iob && !blk_queue_is_zoned(ns->queue)) | 2130 | nvme_set_chunk_sectors(ns, id); |
| 2101 | blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(iob)); | ||
| 2102 | nvme_update_disk_info(disk, ns, id); | 2131 | nvme_update_disk_info(disk, ns, id); |
| 2103 | #ifdef CONFIG_NVME_MULTIPATH | 2132 | #ifdef CONFIG_NVME_MULTIPATH |
| 2104 | if (ns->head->disk) { | 2133 | if (ns->head->disk) { |
| @@ -3496,10 +3525,6 @@ static ssize_t nvme_sysfs_delete(struct device *dev, · 1391 unmodified lines | |||
| 3496 | { | 3525 | { |
| 3497 | struct nvme_ctrl *ctrl = dev_get_drvdata(dev); | 3526 | struct nvme_ctrl *ctrl = dev_get_drvdata(dev); |
| 3498 | 3527 | ||
| 3499 | /* Can't delete non-created controllers */ | ||
| 3500 | if (!ctrl->created) | ||
| 3501 | return -EBUSY; | ||
| 3502 | |||
| 3503 | if (device_remove_file_self(dev, attr)) | 3528 | if (device_remove_file_self(dev, attr)) |
| 3504 | nvme_delete_ctrl_sync(ctrl); | 3529 | nvme_delete_ctrl_sync(ctrl); |
| 3505 | return count; | 3530 | return count; |
| @@ -3676,6 +3701,10 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj, · 170 unmodified lines | |||
| 3676 | return 0; | 3701 | return 0; |
| 3677 | if (a == &dev_attr_hostid.attr && !ctrl->opts) | 3702 | if (a == &dev_attr_hostid.attr && !ctrl->opts) |
| 3678 | return 0; | 3703 | return 0; |
| 3704 | if (a == &dev_attr_ctrl_loss_tmo.attr && !ctrl->opts) | ||
| 3705 | return 0; | ||
| 3706 | if (a == &dev_attr_reconnect_delay.attr && !ctrl->opts) | ||
| 3707 | return 0; | ||
| 3679 | 3708 | ||
| 3680 | return a->mode; | 3709 | return a->mode; |
| 3681 | } | 3710 | } |
| @@ -4370,7 +4399,6 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl) · 688 unmodified lines | |||
| 4370 | nvme_queue_scan(ctrl); | 4399 | nvme_queue_scan(ctrl); |
| 4371 | nvme_start_queues(ctrl); | 4400 | nvme_start_queues(ctrl); |
| 4372 | } | 4401 | } |
| 4373 | ctrl->created = true; | ||
| 4374 | } | 4402 | } |
| 4375 | EXPORT_SYMBOL_GPL(nvme_start_ctrl); | 4403 | EXPORT_SYMBOL_GPL(nvme_start_ctrl); |
| 4376 | 4404 | ||
| @@ -4390,7 +4418,7 @@ static void nvme_free_ctrl(struct device *dev) · 13 unmodified lines | |||
| 4390 | struct nvme_subsystem *subsys = ctrl->subsys; | 4418 | struct nvme_subsystem *subsys = ctrl->subsys; |
| 4391 | struct nvme_cel *cel, *next; | 4419 | struct nvme_cel *cel, *next; |
| 4392 | 4420 | ||
| 4393 | if (subsys && ctrl->instance != subsys->instance) | 4421 | if (!subsys || ctrl->instance != subsys->instance) |
| 4394 | ida_simple_remove(&nvme_instance_ida, ctrl->instance); | 4422 | ida_simple_remove(&nvme_instance_ida, ctrl->instance); |
| 4395 | 4423 | ||
| 4396 | list_for_each_entry_safe(cel, next, &ctrl->cels, entry) { | 4424 | list_for_each_entry_safe(cel, next, &ctrl->cels, entry) { |
| @@ -4534,7 +4562,7 @@ void nvme_unfreeze(struct nvme_ctrl *ctrl) · 137 unmodified lines | |||
| 4534 | } | 4562 | } |
| 4535 | EXPORT_SYMBOL_GPL(nvme_unfreeze); | 4563 | EXPORT_SYMBOL_GPL(nvme_unfreeze); |
| 4536 | 4564 | ||
| 4537 | void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) | 4565 | int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) |
| 4538 | { | 4566 | { |
| 4539 | struct nvme_ns *ns; | 4567 | struct nvme_ns *ns; |
| 4540 | 4568 | ||
| @@ -4545,6 +4573,7 @@ void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) · 4 unmodified lines | |||
| 4545 | break; | 4573 | break; |
| 4546 | } | 4574 | } |
| 4547 | up_read(&ctrl->namespaces_rwsem); | 4575 | up_read(&ctrl->namespaces_rwsem); |
| 4576 | return timeout; | ||
| 4548 | } | 4577 | } |
| 4549 | EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout); | 4578 | EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout); |
| 4550 | 4579 | ||
| @@ -565,10 +565,14 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, · 564 unmodified lines | |||
| 565 | struct nvme_request *req = nvme_req(rq); | 565 | struct nvme_request *req = nvme_req(rq); |
| 566 | 566 | ||
| 567 | /* | 567 | /* |
| 568 | * If we are in some state of setup or teardown only allow | 568 | * currently we have a problem sending passthru commands |
| 569 | * internally generated commands. | 569 | * on the admin_q if the controller is not LIVE because we can't |
| 570 | * make sure that they are going out after the admin connect, | ||
| 571 | * controller enable and/or other commands in the initialization | ||
| 572 | * sequence. until the controller will be LIVE, fail with | ||
| 573 | * BLK_STS_RESOURCE so that they will be rescheduled. | ||
| 570 | */ | 574 | */ |
| 571 | if (!blk_rq_is_passthrough(rq) || (req->flags & NVME_REQ_USERCMD)) | 575 | if (rq->q == ctrl->admin_q && (req->flags & NVME_REQ_USERCMD)) |
| 572 | return false; | 576 | return false; |
| 573 | 577 | ||
| 574 | /* | 578 | /* |
| @@ -576,9 +580,8 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq, · 1 unmodified line | |||
| 576 | * which is require to set the queue live in the appropinquate states. | 580 | * which is require to set the queue live in the appropinquate states. |
| 577 | */ | 581 | */ |
| 578 | switch (ctrl->state) { | 582 | switch (ctrl->state) { |
| 579 | case NVME_CTRL_NEW: | ||
| 580 | case NVME_CTRL_CONNECTING: | 583 | case NVME_CTRL_CONNECTING: |
| 581 | if (nvme_is_fabrics(req->cmd) && | 584 | if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) && |
| 582 | req->cmd->fabrics.fctype == nvme_fabrics_type_connect) | 585 | req->cmd->fabrics.fctype == nvme_fabrics_type_connect) |
| 583 | return true; | 586 | return true; |
| 584 | break; | 587 | break; |
| @@ -2160,6 +2160,7 @@ nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl) · 2159 unmodified lines | |||
| 2160 | struct nvme_fc_fcp_op *aen_op; | 2160 | struct nvme_fc_fcp_op *aen_op; |
| 2161 | int i; | 2161 | int i; |
| 2162 | 2162 | ||
| 2163 | cancel_work_sync(&ctrl->ctrl.async_event_work); | ||
| 2163 | aen_op = ctrl->aen_ops; | 2164 | aen_op = ctrl->aen_ops; |
| 2164 | for (i = 0; i < NVME_NR_AEN_COMMANDS; i++, aen_op++) { | 2165 | for (i = 0; i < NVME_NR_AEN_COMMANDS; i++, aen_op++) { |
| 2165 | __nvme_fc_exit_request(ctrl, aen_op); | 2166 | __nvme_fc_exit_request(ctrl, aen_op); |
| @@ -307,7 +307,6 @@ struct nvme_ctrl { · 306 unmodified lines | |||
| 307 | struct nvme_command ka_cmd; | 307 | struct nvme_command ka_cmd; |
| 308 | struct work_struct fw_act_work; | 308 | struct work_struct fw_act_work; |
| 309 | unsigned long events; | 309 | unsigned long events; |
| 310 | bool created; | ||
| 311 | 310 | ||
| 312 | #ifdef CONFIG_NVME_MULTIPATH | 311 | #ifdef CONFIG_NVME_MULTIPATH |
| 313 | /* asymmetric namespace access: */ | 312 | /* asymmetric namespace access: */ |
| @@ -605,7 +604,7 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl); · 291 unmodified lines | |||
| 605 | void nvme_sync_queues(struct nvme_ctrl *ctrl); | 604 | void nvme_sync_queues(struct nvme_ctrl *ctrl); |
| 606 | void nvme_unfreeze(struct nvme_ctrl *ctrl); | 605 | void nvme_unfreeze(struct nvme_ctrl *ctrl); |
| 607 | void nvme_wait_freeze(struct nvme_ctrl *ctrl); | 606 | void nvme_wait_freeze(struct nvme_ctrl *ctrl); |
| 608 | void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); | 607 | int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); |
| 609 | void nvme_start_freeze(struct nvme_ctrl *ctrl); | 608 | void nvme_start_freeze(struct nvme_ctrl *ctrl); |
| 610 | 609 | ||
| 611 | #define NVME_QID_ANY -1 | 610 | #define NVME_QID_ANY -1 |
| @@ -1249,8 +1249,8 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) · 1248 unmodified lines | |||
| 1249 | dev_warn_ratelimited(dev->ctrl.device, | 1249 | dev_warn_ratelimited(dev->ctrl.device, |
| 1250 | "I/O %d QID %d timeout, disable controller\n", | 1250 | "I/O %d QID %d timeout, disable controller\n", |
| 1251 | req->tag, nvmeq->qid); | 1251 | req->tag, nvmeq->qid); |
| 1252 | nvme_dev_disable(dev, true); | ||
| 1253 | nvme_req(req)->flags |= NVME_REQ_CANCELLED; | 1252 | nvme_req(req)->flags |= NVME_REQ_CANCELLED; |
| 1253 | nvme_dev_disable(dev, true); | ||
| 1254 | return BLK_EH_DONE; | 1254 | return BLK_EH_DONE; |
| 1255 | case NVME_CTRL_RESETTING: | 1255 | case NVME_CTRL_RESETTING: |
| 1256 | return BLK_EH_RESET_TIMER; | 1256 | return BLK_EH_RESET_TIMER; |
| @@ -1267,10 +1267,10 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved) · 10 unmodified lines | |||
| 1267 | dev_warn(dev->ctrl.device, | 1267 | dev_warn(dev->ctrl.device, |
| 1268 | "I/O %d QID %d timeout, reset controller\n", | 1268 | "I/O %d QID %d timeout, reset controller\n", |
| 1269 | req->tag, nvmeq->qid); | 1269 | req->tag, nvmeq->qid); |
| 1270 | nvme_req(req)->flags |= NVME_REQ_CANCELLED; | ||
| 1270 | nvme_dev_disable(dev, false); | 1271 | nvme_dev_disable(dev, false); |
| 1271 | nvme_reset_ctrl(&dev->ctrl); | 1272 | nvme_reset_ctrl(&dev->ctrl); |
| 1272 | 1273 | ||
| 1273 | nvme_req(req)->flags |= NVME_REQ_CANCELLED; | ||
| 1274 | return BLK_EH_DONE; | 1274 | return BLK_EH_DONE; |
| 1275 | } | 1275 | } |
| 1276 | 1276 | ||
| @@ -122,6 +122,7 @@ struct nvme_rdma_ctrl { · 121 unmodified lines | |||
| 122 | struct sockaddr_storage src_addr; | 122 | struct sockaddr_storage src_addr; |
| 123 | 123 | ||
| 124 | struct nvme_ctrl ctrl; | 124 | struct nvme_ctrl ctrl; |
| 125 | struct mutex teardown_lock; | ||
| 125 | bool use_inline_data; | 126 | bool use_inline_data; |
| 126 | u32 io_queues[HCTX_MAX_TYPES]; | 127 | u32 io_queues[HCTX_MAX_TYPES]; |
| 127 | }; | 128 | }; |
| @@ -834,6 +835,7 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl, · 706 unmodified lines | |||
| 834 | blk_mq_free_tag_set(ctrl->ctrl.admin_tagset); | 835 | blk_mq_free_tag_set(ctrl->ctrl.admin_tagset); |
| 835 | } | 836 | } |
| 836 | if (ctrl->async_event_sqe.data) { | 837 | if (ctrl->async_event_sqe.data) { |
| 838 | cancel_work_sync(&ctrl->ctrl.async_event_work); | ||
| 837 | nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, | 839 | nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, |
| 838 | sizeof(struct nvme_command), DMA_TO_DEVICE); | 840 | sizeof(struct nvme_command), DMA_TO_DEVICE); |
| 839 | ctrl->async_event_sqe.data = NULL; | 841 | ctrl->async_event_sqe.data = NULL; |
| @@ -975,7 +977,15 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) · 135 unmodified lines | |||
| 975 | 977 | ||
| 976 | if (!new) { | 978 | if (!new) { |
| 977 | nvme_start_queues(&ctrl->ctrl); | 979 | nvme_start_queues(&ctrl->ctrl); |
| 978 | nvme_wait_freeze(&ctrl->ctrl); | 980 | if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) { |
| 981 | /* | ||
| 982 | * If we timed out waiting for freeze we are likely to | ||
| 983 | * be stuck. Fail the controller initialization just | ||
| 984 | * to be safe. | ||
| 985 | */ | ||
| 986 | ret = -ENODEV; | ||
| 987 | goto out_wait_freeze_timed_out; | ||
| 988 | } | ||
| 979 | blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset, | 989 | blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset, |
| 980 | ctrl->ctrl.queue_count - 1); | 990 | ctrl->ctrl.queue_count - 1); |
| 981 | nvme_unfreeze(&ctrl->ctrl); | 991 | nvme_unfreeze(&ctrl->ctrl); |
| @@ -983,6 +993,9 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) · 1 unmodified line | |||
| 983 | 993 | ||
| 984 | return 0; | 994 | return 0; |
| 985 | 995 | ||
| 996 | out_wait_freeze_timed_out: | ||
| 997 | nvme_stop_queues(&ctrl->ctrl); | ||
| 998 | nvme_rdma_stop_io_queues(ctrl); | ||
| 986 | out_cleanup_connect_q: | 999 | out_cleanup_connect_q: |
| 987 | if (new) | 1000 | if (new) |
| 988 | blk_cleanup_queue(ctrl->ctrl.connect_q); | 1001 | blk_cleanup_queue(ctrl->ctrl.connect_q); |
| @@ -997,6 +1010,7 @@ out_free_io_queues: · 8 unmodified lines | |||
| 997 | static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, | 1010 | static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, |
| 998 | bool remove) | 1011 | bool remove) |
| 999 | { | 1012 | { |
| 1013 | mutex_lock(&ctrl->teardown_lock); | ||
| 1000 | blk_mq_quiesce_queue(ctrl->ctrl.admin_q); | 1014 | blk_mq_quiesce_queue(ctrl->ctrl.admin_q); |
| 1001 | nvme_rdma_stop_queue(&ctrl->queues[0]); | 1015 | nvme_rdma_stop_queue(&ctrl->queues[0]); |
| 1002 | if (ctrl->ctrl.admin_tagset) { | 1016 | if (ctrl->ctrl.admin_tagset) { |
| @@ -1007,11 +1021,13 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, · 4 unmodified lines | |||
| 1007 | if (remove) | 1021 | if (remove) |
| 1008 | blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); | 1022 | blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); |
| 1009 | nvme_rdma_destroy_admin_queue(ctrl, remove); | 1023 | nvme_rdma_destroy_admin_queue(ctrl, remove); |
| 1024 | mutex_unlock(&ctrl->teardown_lock); | ||
| 1010 | } | 1025 | } |
| 1011 | 1026 | ||
| 1012 | static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, | 1027 | static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, |
| 1013 | bool remove) | 1028 | bool remove) |
| 1014 | { | 1029 | { |
| 1030 | mutex_lock(&ctrl->teardown_lock); | ||
| 1015 | if (ctrl->ctrl.queue_count > 1) { | 1031 | if (ctrl->ctrl.queue_count > 1) { |
| 1016 | nvme_start_freeze(&ctrl->ctrl); | 1032 | nvme_start_freeze(&ctrl->ctrl); |
| 1017 | nvme_stop_queues(&ctrl->ctrl); | 1033 | nvme_stop_queues(&ctrl->ctrl); |
| @@ -1025,6 +1041,7 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, · 7 unmodified lines | |||
| 1025 | nvme_start_queues(&ctrl->ctrl); | 1041 | nvme_start_queues(&ctrl->ctrl); |
| 1026 | nvme_rdma_destroy_io_queues(ctrl, remove); | 1042 | nvme_rdma_destroy_io_queues(ctrl, remove); |
| 1027 | } | 1043 | } |
| 1044 | mutex_unlock(&ctrl->teardown_lock); | ||
| 1028 | } | 1045 | } |
| 1029 | 1046 | ||
| 1030 | static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) | 1047 | static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) |
| @@ -1180,6 +1197,7 @@ static void nvme_rdma_error_recovery(struct nvme_rdma_ctrl *ctrl) · 149 unmodified lines | |||
| 1180 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING)) | 1197 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING)) |
| 1181 | return; | 1198 | return; |
| 1182 | 1199 | ||
| 1200 | dev_warn(ctrl->ctrl.device, "starting error recovery\n"); | ||
| 1183 | queue_work(nvme_reset_wq, &ctrl->err_work); | 1201 | queue_work(nvme_reset_wq, &ctrl->err_work); |
| 1184 | } | 1202 | } |
| 1185 | 1203 | ||
| @@ -1946,6 +1964,22 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, · 760 unmodified lines | |||
| 1946 | return 0; | 1964 | return 0; |
| 1947 | } | 1965 | } |
| 1948 | 1966 | ||
| 1967 | static void nvme_rdma_complete_timed_out(struct request *rq) | ||
| 1968 | { | ||
| 1969 | struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); | ||
| 1970 | struct nvme_rdma_queue *queue = req->queue; | ||
| 1971 | struct nvme_rdma_ctrl *ctrl = queue->ctrl; | ||
| 1972 | |||
| 1973 | /* fence other contexts that may complete the command */ | ||
| 1974 | mutex_lock(&ctrl->teardown_lock); | ||
| 1975 | nvme_rdma_stop_queue(queue); | ||
| 1976 | if (!blk_mq_request_completed(rq)) { | ||
| 1977 | nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; | ||
| 1978 | blk_mq_complete_request(rq); | ||
| 1979 | } | ||
| 1980 | mutex_unlock(&ctrl->teardown_lock); | ||
| 1981 | } | ||
| 1982 | |||
| 1949 | static enum blk_eh_timer_return | 1983 | static enum blk_eh_timer_return |
| 1950 | nvme_rdma_timeout(struct request *rq, bool reserved) | 1984 | nvme_rdma_timeout(struct request *rq, bool reserved) |
| 1951 | { | 1985 | { |
| @@ -1956,29 +1990,29 @@ nvme_rdma_timeout(struct request *rq, bool reserved) · 4 unmodified lines | |||
| 1956 | dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", | 1990 | dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", |
| 1957 | rq->tag, nvme_rdma_queue_idx(queue)); | 1991 | rq->tag, nvme_rdma_queue_idx(queue)); |
| 1958 | 1992 | ||
| 1959 | /* | ||
| 1960 | * Restart the timer if a controller reset is already scheduled. Any | ||
| 1961 | * timed out commands would be handled before entering the connecting | ||
| 1962 | * state. | ||
| 1963 | */ | ||
| 1964 | if (ctrl->ctrl.state == NVME_CTRL_RESETTING) | ||
| 1965 | return BLK_EH_RESET_TIMER; | ||
| 1966 | |||
| 1967 | if (ctrl->ctrl.state != NVME_CTRL_LIVE) { | 1993 | if (ctrl->ctrl.state != NVME_CTRL_LIVE) { |
| 1968 | /* | 1994 | /* |
| 1969 | * Teardown immediately if controller times out while starting | 1995 | * If we are resetting, connecting or deleting we should |
| 1970 | * or we are already started error recovery. all outstanding | 1996 | * complete immediately because we may block controller |
| 1971 | * requests are completed on shutdown, so we return BLK_EH_DONE. | 1997 | * teardown or setup sequence |
| 1998 | * - ctrl disable/shutdown fabrics requests | ||
| 1999 | * - connect requests | ||
| 2000 | * - initialization admin requests | ||
| 2001 | * - I/O requests that entered after unquiescing and | ||
| 2002 | * the controller stopped responding | ||
| 2003 | * | ||
| 2004 | * All other requests should be cancelled by the error | ||
| 2005 | * recovery work, so it's fine that we fail it here. | ||
| 1972 | */ | 2006 | */ |
| 1973 | flush_work(&ctrl->err_work); | 2007 | nvme_rdma_complete_timed_out(rq); |
| 1974 | nvme_rdma_teardown_io_queues(ctrl, false); | ||
| 1975 | nvme_rdma_teardown_admin_queue(ctrl, false); | ||
| 1976 | return BLK_EH_DONE; | 2008 | return BLK_EH_DONE; |
| 1977 | } | 2009 | } |
| 1978 | 2010 | ||
| 1979 | dev_warn(ctrl->ctrl.device, "starting error recovery\n"); | 2011 | /* |
| 2012 | * LIVE state should trigger the normal error recovery which will | ||
| 2013 | * handle completing this request. | ||
| 2014 | */ | ||
| 1980 | nvme_rdma_error_recovery(ctrl); | 2015 | nvme_rdma_error_recovery(ctrl); |
| 1981 | |||
| 1982 | return BLK_EH_RESET_TIMER; | 2016 | return BLK_EH_RESET_TIMER; |
| 1983 | } | 2017 | } |
| 1984 | 2018 | ||
| @@ -2278,6 +2312,7 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev, · 293 unmodified lines | |||
| 2278 | return ERR_PTR(-ENOMEM); | 2312 | return ERR_PTR(-ENOMEM); |
| 2279 | ctrl->ctrl.opts = opts; | 2313 | ctrl->ctrl.opts = opts; |
| 2280 | INIT_LIST_HEAD(&ctrl->list); | 2314 | INIT_LIST_HEAD(&ctrl->list); |
| 2315 | mutex_init(&ctrl->teardown_lock); | ||
| 2281 | 2316 | ||
| 2282 | if (!(opts->mask & NVMF_OPT_TRSVCID)) { | 2317 | if (!(opts->mask & NVMF_OPT_TRSVCID)) { |
| 2283 | opts->trsvcid = | 2318 | opts->trsvcid = |
| @@ -124,6 +124,7 @@ struct nvme_tcp_ctrl { · 123 unmodified lines | |||
| 124 | struct sockaddr_storage src_addr; | 124 | struct sockaddr_storage src_addr; |
| 125 | struct nvme_ctrl ctrl; | 125 | struct nvme_ctrl ctrl; |
| 126 | 126 | ||
| 127 | struct mutex teardown_lock; | ||
| 127 | struct work_struct err_work; | 128 | struct work_struct err_work; |
| 128 | struct delayed_work connect_work; | 129 | struct delayed_work connect_work; |
| 129 | struct nvme_tcp_request async_req; | 130 | struct nvme_tcp_request async_req; |
| @@ -464,6 +465,7 @@ static void nvme_tcp_error_recovery(struct nvme_ctrl *ctrl) · 334 unmodified lines | |||
| 464 | if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) | 465 | if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) |
| 465 | return; | 466 | return; |
| 466 | 467 | ||
| 468 | dev_warn(ctrl->device, "starting error recovery\n"); | ||
| 467 | queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work); | 469 | queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work); |
| 468 | } | 470 | } |
| 469 | 471 | ||
| @@ -1526,7 +1528,6 @@ static void nvme_tcp_stop_queue(struct nvme_ctrl *nctrl, int qid) · 1056 unmodified lines | |||
| 1526 | 1528 | ||
| 1527 | if (!test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags)) | 1529 | if (!test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags)) |
| 1528 | return; | 1530 | return; |
| 1529 | |||
| 1530 | __nvme_tcp_stop_queue(queue); | 1531 | __nvme_tcp_stop_queue(queue); |
| 1531 | } | 1532 | } |
| 1532 | 1533 | ||
| @@ -1595,6 +1596,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl, · 62 unmodified lines | |||
| 1595 | static void nvme_tcp_free_admin_queue(struct nvme_ctrl *ctrl) | 1596 | static void nvme_tcp_free_admin_queue(struct nvme_ctrl *ctrl) |
| 1596 | { | 1597 | { |
| 1597 | if (to_tcp_ctrl(ctrl)->async_req.pdu) { | 1598 | if (to_tcp_ctrl(ctrl)->async_req.pdu) { |
| 1599 | cancel_work_sync(&ctrl->async_event_work); | ||
| 1598 | nvme_tcp_free_async_req(to_tcp_ctrl(ctrl)); | 1600 | nvme_tcp_free_async_req(to_tcp_ctrl(ctrl)); |
| 1599 | to_tcp_ctrl(ctrl)->async_req.pdu = NULL; | 1601 | to_tcp_ctrl(ctrl)->async_req.pdu = NULL; |
| 1600 | } | 1602 | } |
| @@ -1781,7 +1783,15 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) · 180 unmodified lines | |||
| 1781 | 1783 | ||
| 1782 | if (!new) { | 1784 | if (!new) { |
| 1783 | nvme_start_queues(ctrl); | 1785 | nvme_start_queues(ctrl); |
| 1784 | nvme_wait_freeze(ctrl); | 1786 | if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) { |
| 1787 | /* | ||
| 1788 | * If we timed out waiting for freeze we are likely to | ||
| 1789 | * be stuck. Fail the controller initialization just | ||
| 1790 | * to be safe. | ||
| 1791 | */ | ||
| 1792 | ret = -ENODEV; | ||
| 1793 | goto out_wait_freeze_timed_out; | ||
| 1794 | } | ||
| 1785 | blk_mq_update_nr_hw_queues(ctrl->tagset, | 1795 | blk_mq_update_nr_hw_queues(ctrl->tagset, |
| 1786 | ctrl->queue_count - 1); | 1796 | ctrl->queue_count - 1); |
| 1787 | nvme_unfreeze(ctrl); | 1797 | nvme_unfreeze(ctrl); |
| @@ -1789,6 +1799,9 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) · 1 unmodified line | |||
| 1789 | 1799 | ||
| 1790 | return 0; | 1800 | return 0; |
| 1791 | 1801 | ||
| 1802 | out_wait_freeze_timed_out: | ||
| 1803 | nvme_stop_queues(ctrl); | ||
| 1804 | nvme_tcp_stop_io_queues(ctrl); | ||
| 1792 | out_cleanup_connect_q: | 1805 | out_cleanup_connect_q: |
| 1793 | if (new) | 1806 | if (new) |
| 1794 | blk_cleanup_queue(ctrl->connect_q); | 1807 | blk_cleanup_queue(ctrl->connect_q); |
| @@ -1874,6 +1887,7 @@ out_free_queue: · 79 unmodified lines | |||
| 1874 | static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, | 1887 | static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, |
| 1875 | bool remove) | 1888 | bool remove) |
| 1876 | { | 1889 | { |
| 1890 | mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 1877 | blk_mq_quiesce_queue(ctrl->admin_q); | 1891 | blk_mq_quiesce_queue(ctrl->admin_q); |
| 1878 | nvme_tcp_stop_queue(ctrl, 0); | 1892 | nvme_tcp_stop_queue(ctrl, 0); |
| 1879 | if (ctrl->admin_tagset) { | 1893 | if (ctrl->admin_tagset) { |
| @@ -1884,13 +1898,16 @@ static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, · 4 unmodified lines | |||
| 1884 | if (remove) | 1898 | if (remove) |
| 1885 | blk_mq_unquiesce_queue(ctrl->admin_q); | 1899 | blk_mq_unquiesce_queue(ctrl->admin_q); |
| 1886 | nvme_tcp_destroy_admin_queue(ctrl, remove); | 1900 | nvme_tcp_destroy_admin_queue(ctrl, remove); |
| 1901 | mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 1887 | } | 1902 | } |
| 1888 | 1903 | ||
| 1889 | static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, | 1904 | static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, |
| 1890 | bool remove) | 1905 | bool remove) |
| 1891 | { | 1906 | { |
| 1907 | mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 1892 | if (ctrl->queue_count <= 1) | 1908 | if (ctrl->queue_count <= 1) |
| 1893 | return; | 1909 | goto out; |
| 1910 | blk_mq_quiesce_queue(ctrl->admin_q); | ||
| 1894 | nvme_start_freeze(ctrl); | 1911 | nvme_start_freeze(ctrl); |
| 1895 | nvme_stop_queues(ctrl); | 1912 | nvme_stop_queues(ctrl); |
| 1896 | nvme_tcp_stop_io_queues(ctrl); | 1913 | nvme_tcp_stop_io_queues(ctrl); |
| @@ -1902,6 +1919,8 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, · 5 unmodified lines | |||
| 1902 | if (remove) | 1919 | if (remove) |
| 1903 | nvme_start_queues(ctrl); | 1920 | nvme_start_queues(ctrl); |
| 1904 | nvme_tcp_destroy_io_queues(ctrl, remove); | 1921 | nvme_tcp_destroy_io_queues(ctrl, remove); |
| 1922 | out: | ||
| 1923 | mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 1905 | } | 1924 | } |
| 1906 | 1925 | ||
| 1907 | static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl) | 1926 | static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl) |
| @@ -2148,40 +2167,55 @@ static void nvme_tcp_submit_async_event(struct nvme_ctrl *arg) · 240 unmodified lines | |||
| 2148 | nvme_tcp_queue_request(&ctrl->async_req, true, true); | 2167 | nvme_tcp_queue_request(&ctrl->async_req, true, true); |
| 2149 | } | 2168 | } |
| 2150 | 2169 | ||
| 2170 | static void nvme_tcp_complete_timed_out(struct request *rq) | ||
| 2171 | { | ||
| 2172 | struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); | ||
| 2173 | struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; | ||
| 2174 | |||
| 2175 | /* fence other contexts that may complete the command */ | ||
| 2176 | mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 2177 | nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue)); | ||
| 2178 | if (!blk_mq_request_completed(rq)) { | ||
| 2179 | nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; | ||
| 2180 | blk_mq_complete_request(rq); | ||
| 2181 | } | ||
| 2182 | mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); | ||
| 2183 | } | ||
| 2184 | |||
| 2151 | static enum blk_eh_timer_return | 2185 | static enum blk_eh_timer_return |
| 2152 | nvme_tcp_timeout(struct request *rq, bool reserved) | 2186 | nvme_tcp_timeout(struct request *rq, bool reserved) |
| 2153 | { | 2187 | { |
| 2154 | struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); | 2188 | struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); |
| 2155 | struct nvme_tcp_ctrl *ctrl = req->queue->ctrl; | 2189 | struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; |
| 2156 | struct nvme_tcp_cmd_pdu *pdu = req->pdu; | 2190 | struct nvme_tcp_cmd_pdu *pdu = req->pdu; |
| 2157 | 2191 | ||
| 2158 | /* | 2192 | dev_warn(ctrl->device, |
| 2159 | * Restart the timer if a controller reset is already scheduled. Any | ||
| 2160 | * timed out commands would be handled before entering the connecting | ||
| 2161 | * state. | ||
| 2162 | */ | ||
| 2163 | if (ctrl->ctrl.state == NVME_CTRL_RESETTING) | ||
| 2164 | return BLK_EH_RESET_TIMER; | ||
| 2165 | |||
| 2166 | dev_warn(ctrl->ctrl.device, | ||
| 2167 | "queue %d: timeout request %#x type %d\n", | 2193 | "queue %d: timeout request %#x type %d\n", |
| 2168 | nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type); | 2194 | nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type); |
| 2169 | 2195 | ||
| 2170 | if (ctrl->ctrl.state != NVME_CTRL_LIVE) { | 2196 | if (ctrl->state != NVME_CTRL_LIVE) { |
| 2171 | /* | 2197 | /* |
| 2172 | * Teardown immediately if controller times out while starting | 2198 | * If we are resetting, connecting or deleting we should |
| 2173 | * or we are already started error recovery. all outstanding | 2199 | * complete immediately because we may block controller |
| 2174 | * requests are completed on shutdown, so we return BLK_EH_DONE. | 2200 | * teardown or setup sequence |
| 2201 | * - ctrl disable/shutdown fabrics requests | ||
| 2202 | * - connect requests | ||
| 2203 | * - initialization admin requests | ||
| 2204 | * - I/O requests that entered after unquiescing and | ||
| 2205 | * the controller stopped responding | ||
| 2206 | * | ||
| 2207 | * All other requests should be cancelled by the error | ||
| 2208 | * recovery work, so it's fine that we fail it here. | ||
| 2175 | */ | 2209 | */ |
| 2176 | flush_work(&ctrl->err_work); | 2210 | nvme_tcp_complete_timed_out(rq); |
| 2177 | nvme_tcp_teardown_io_queues(&ctrl->ctrl, false); | ||
| 2178 | nvme_tcp_teardown_admin_queue(&ctrl->ctrl, false); | ||
| 2179 | return BLK_EH_DONE; | 2211 | return BLK_EH_DONE; |
| 2180 | } | 2212 | } |
| 2181 | 2213 | ||
| 2182 | dev_warn(ctrl->ctrl.device, "starting error recovery\n"); | 2214 | /* |
| 2183 | nvme_tcp_error_recovery(&ctrl->ctrl); | 2215 | * LIVE state should trigger the normal error recovery which will |
| 2184 | 2216 | * handle completing this request. | |
| 2217 | */ | ||
| 2218 | nvme_tcp_error_recovery(ctrl); | ||
| 2185 | return BLK_EH_RESET_TIMER; | 2219 | return BLK_EH_RESET_TIMER; |
| 2186 | } | 2220 | } |
| 2187 | 2221 | ||
| @@ -2422,6 +2456,7 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev, · 234 unmodified lines | |||
| 2422 | nvme_tcp_reconnect_ctrl_work); | 2456 | nvme_tcp_reconnect_ctrl_work); |
| 2423 | INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work); | 2457 | INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work); |
| 2424 | INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work); | 2458 | INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work); |
| 2459 | mutex_init(&ctrl->teardown_lock); | ||
| 2425 | 2460 | ||
| 2426 | if (!(opts->mask & NVMF_OPT_TRSVCID)) { | 2461 | if (!(opts->mask & NVMF_OPT_TRSVCID)) { |
| 2427 | opts->trsvcid = | 2462 | opts->trsvcid = |
| @@ -2342,9 +2342,9 @@ nvmet_fc_fod_op_done(struct nvmet_fc_fcp_iod *fod) · 2341 unmodified lines | |||
| 2342 | return; | 2342 | return; |
| 2343 | if (fcpreq->fcp_error || | 2343 | if (fcpreq->fcp_error || |
| 2344 | fcpreq->transferred_length != fcpreq->transfer_length) { | 2344 | fcpreq->transferred_length != fcpreq->transfer_length) { |
| 2345 | spin_lock(&fod->flock); | 2345 | spin_lock_irqsave(&fod->flock, flags); |
| 2346 | fod->abort = true; | 2346 | fod->abort = true; |
| 2347 | spin_unlock(&fod->flock); | 2347 | spin_unlock_irqrestore(&fod->flock, flags); |
| 2348 | 2348 | ||
| 2349 | nvmet_req_complete(&fod->req, NVME_SC_INTERNAL); | 2349 | nvmet_req_complete(&fod->req, NVME_SC_INTERNAL); |
| 2350 | return; | 2350 | return; |
| @@ -160,6 +160,11 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd); · 159 unmodified lines | |||
| 160 | static inline u16 nvmet_tcp_cmd_tag(struct nvmet_tcp_queue *queue, | 160 | static inline u16 nvmet_tcp_cmd_tag(struct nvmet_tcp_queue *queue, |
| 161 | struct nvmet_tcp_cmd *cmd) | 161 | struct nvmet_tcp_cmd *cmd) |
| 162 | { | 162 | { |
| 163 | if (unlikely(!queue->nr_cmds)) { | ||
| 164 | /* We didn't allocate cmds yet, send 0xffff */ | ||
| 165 | return USHRT_MAX; | ||
| 166 | } | ||
| 167 | |||
| 163 | return cmd - queue->cmds; | 168 | return cmd - queue->cmds; |
| 164 | } | 169 | } |
| 165 | 170 | ||
| @@ -866,7 +871,10 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue) · 700 unmodified lines | |||
| 866 | struct nvme_tcp_data_pdu *data = &queue->pdu.data; | 871 | struct nvme_tcp_data_pdu *data = &queue->pdu.data; |
| 867 | struct nvmet_tcp_cmd *cmd; | 872 | struct nvmet_tcp_cmd *cmd; |
| 868 | 873 | ||
| 869 | cmd = &queue->cmds[data->ttag]; | 874 | if (likely(queue->nr_cmds)) |
| 875 | cmd = &queue->cmds[data->ttag]; | ||
| 876 | else | ||
| 877 | cmd = &queue->connect; | ||
| 870 | 878 | ||
| 871 | if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) { | 879 | if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) { |
| 872 | pr_err("ttag %u unexpected data offset %u (expected %u)\n", | 880 | pr_err("ttag %u unexpected data offset %u (expected %u)\n", |
| @@ -1296,13 +1296,19 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq) · 1295 unmodified lines | |||
| 1296 | } | 1296 | } |
| 1297 | EXPORT_SYMBOL_GPL(dev_pm_opp_remove); | 1297 | EXPORT_SYMBOL_GPL(dev_pm_opp_remove); |
| 1298 | 1298 | ||
| 1299 | void _opp_remove_all_static(struct opp_table *opp_table) | 1299 | bool _opp_remove_all_static(struct opp_table *opp_table) |
| 1300 | { | 1300 | { |
| 1301 | struct dev_pm_opp *opp, *tmp; | 1301 | struct dev_pm_opp *opp, *tmp; |
| 1302 | bool ret = true; | ||
| 1302 | 1303 | ||
| 1303 | mutex_lock(&opp_table->lock); | 1304 | mutex_lock(&opp_table->lock); |
| 1304 | 1305 | ||
| 1305 | if (!opp_table->parsed_static_opps || --opp_table->parsed_static_opps) | 1306 | if (!opp_table->parsed_static_opps) { |
| 1307 | ret = false; | ||
| 1308 | goto unlock; | ||
| 1309 | } | ||
| 1310 | |||
| 1311 | if (--opp_table->parsed_static_opps) | ||
| 1306 | goto unlock; | 1312 | goto unlock; |
| 1307 | 1313 | ||
| 1308 | list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { | 1314 | list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { |
| @@ -1312,6 +1318,8 @@ void _opp_remove_all_static(struct opp_table *opp_table) · 3 unmodified lines | |||
| 1312 | 1318 | ||
| 1313 | unlock: | 1319 | unlock: |
| 1314 | mutex_unlock(&opp_table->lock); | 1320 | mutex_unlock(&opp_table->lock); |
| 1321 | |||
| 1322 | return ret; | ||
| 1315 | } | 1323 | } |
| 1316 | 1324 | ||
| 1317 | /** | 1325 | /** |
| @@ -2414,13 +2422,15 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev) · 1096 unmodified lines | |||
| 2414 | return; | 2422 | return; |
| 2415 | } | 2423 | } |
| 2416 | 2424 | ||
| 2417 | _opp_remove_all_static(opp_table); | 2425 | /* |
| 2426 | * Drop the extra reference only if the OPP table was successfully added | ||
| 2427 | * with dev_pm_opp_of_add_table() earlier. | ||
| 2428 | **/ | ||
| 2429 | if (_opp_remove_all_static(opp_table)) | ||
| 2430 | dev_pm_opp_put_opp_table(opp_table); | ||
| 2418 | 2431 | ||
| 2419 | /* Drop reference taken by _find_opp_table() */ | 2432 | /* Drop reference taken by _find_opp_table() */ |
| 2420 | dev_pm_opp_put_opp_table(opp_table); | 2433 | dev_pm_opp_put_opp_table(opp_table); |
| 2421 | |||
| 2422 | /* Drop reference taken while the OPP table was added */ | ||
| 2423 | dev_pm_opp_put_opp_table(opp_table); | ||
| 2424 | } | 2434 | } |
| 2425 | 2435 | ||
| 2426 | /** | 2436 | /** |
| @@ -212,7 +212,7 @@ struct opp_table { · 211 unmodified lines | |||
| 212 | 212 | ||
| 213 | /* Routines internal to opp core */ | 213 | /* Routines internal to opp core */ |
| 214 | void dev_pm_opp_get(struct dev_pm_opp *opp); | 214 | void dev_pm_opp_get(struct dev_pm_opp *opp); |
| 215 | void _opp_remove_all_static(struct opp_table *opp_table); | 215 | bool _opp_remove_all_static(struct opp_table *opp_table); |
| 216 | void _get_opp_table_kref(struct opp_table *opp_table); | 216 | void _get_opp_table_kref(struct opp_table *opp_table); |
| 217 | int _get_opp_count(struct opp_table *opp_table); | 217 | int _get_opp_count(struct opp_table *opp_table); |
| 218 | struct opp_table *_find_opp_table(struct device *dev); | 218 | struct opp_table *_find_opp_table(struct device *dev); |
| @@ -505,9 +505,9 @@ static int qcom_ipq806x_usb_phy_probe(struct platform_device *pdev) · 504 unmodified lines | |||
| 505 | size = resource_size(res); | 505 | size = resource_size(res); |
| 506 | phy_dwc3->base = devm_ioremap(phy_dwc3->dev, res->start, size); | 506 | phy_dwc3->base = devm_ioremap(phy_dwc3->dev, res->start, size); |
| 507 | 507 | ||
| 508 | if (IS_ERR(phy_dwc3->base)) { | 508 | if (!phy_dwc3->base) { |
| 509 | dev_err(phy_dwc3->dev, "failed to map reg\n"); | 509 | dev_err(phy_dwc3->dev, "failed to map reg\n"); |
| 510 | return PTR_ERR(phy_dwc3->base); | 510 | return -ENOMEM; |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | phy_dwc3->ref_clk = devm_clk_get(phy_dwc3->dev, "ref"); | 513 | phy_dwc3->ref_clk = devm_clk_get(phy_dwc3->dev, "ref"); |
| @@ -557,7 +557,6 @@ static struct platform_driver qcom_ipq806x_usb_phy_driver = { · 43 unmodified lines | |||
| 557 | .probe = qcom_ipq806x_usb_phy_probe, | 557 | .probe = qcom_ipq806x_usb_phy_probe, |
| 558 | .driver = { | 558 | .driver = { |
| 559 | .name = "qcom-ipq806x-usb-phy", | 559 | .name = "qcom-ipq806x-usb-phy", |
| 560 | .owner = THIS_MODULE, | ||
| 561 | .of_match_table = qcom_ipq806x_usb_phy_table, | 560 | .of_match_table = qcom_ipq806x_usb_phy_table, |
| 562 | }, | 561 | }, |
| 563 | }; | 562 | }; |
| @@ -604,8 +604,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { · 603 unmodified lines | |||
| 604 | QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf), | 604 | QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf), |
| 605 | QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1), | 605 | QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1), |
| 606 | QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0), | 606 | QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0), |
| 607 | QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0x1f), | 607 | QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff), |
| 608 | QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x3f), | 608 | QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f), |
| 609 | QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6), | 609 | QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6), |
| 610 | QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf), | 610 | QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf), |
| 611 | QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0), | 611 | QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0), |
| @@ -631,7 +631,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { · 19 unmodified lines | |||
| 631 | QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0), | 631 | QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0), |
| 632 | QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80), | 632 | QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80), |
| 633 | QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1), | 633 | QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1), |
| 634 | QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_CTRL, 0xa), | ||
| 635 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1), | 634 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1), |
| 636 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31), | 635 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31), |
| 637 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1), | 636 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1), |
| @@ -640,7 +639,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_serdes_tbl[] = { · 2 unmodified lines | |||
| 640 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f), | 639 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f), |
| 641 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19), | 640 | QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19), |
| 642 | QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19), | 641 | QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19), |
| 643 | QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_CNTRL, 0x7), | ||
| 644 | }; | 642 | }; |
| 645 | 643 | ||
| 646 | static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = { | 644 | static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = { |
| @@ -648,6 +646,8 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = { · 1 unmodified line | |||
| 648 | QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6), | 646 | QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6), |
| 649 | QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2), | 647 | QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2), |
| 650 | QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12), | 648 | QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12), |
| 649 | QMP_PHY_INIT_CFG(QSERDES_TX_EMP_POST1_LVL, 0x36), | ||
| 650 | QMP_PHY_INIT_CFG(QSERDES_TX_SLEW_CNTL, 0x0a), | ||
| 651 | }; | 651 | }; |
| 652 | 652 | ||
| 653 | static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = { | 653 | static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = { |
| @@ -658,7 +658,6 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = { · 4 unmodified lines | |||
| 658 | QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb), | 658 | QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb), |
| 659 | QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b), | 659 | QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b), |
| 660 | QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4), | 660 | QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4), |
| 661 | QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN_HALF, 0x4), | ||
| 662 | }; | 661 | }; |
| 663 | 662 | ||
| 664 | static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = { | 663 | static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = { |
| @@ -2046,6 +2045,9 @@ static const struct qmp_phy_cfg msm8996_usb3phy_cfg = { · 1381 unmodified lines | |||
| 2046 | .pwrdn_ctrl = SW_PWRDN, | 2045 | .pwrdn_ctrl = SW_PWRDN, |
| 2047 | }; | 2046 | }; |
| 2048 | 2047 | ||
| 2048 | static const char * const ipq8074_pciephy_clk_l[] = { | ||
| 2049 | "aux", "cfg_ahb", | ||
| 2050 | }; | ||
| 2049 | /* list of resets */ | 2051 | /* list of resets */ |
| 2050 | static const char * const ipq8074_pciephy_reset_l[] = { | 2052 | static const char * const ipq8074_pciephy_reset_l[] = { |
| 2051 | "phy", "common", | 2053 | "phy", "common", |
| @@ -2063,8 +2065,8 @@ static const struct qmp_phy_cfg ipq8074_pciephy_cfg = { · 11 unmodified lines | |||
| 2063 | .rx_tbl_num = ARRAY_SIZE(ipq8074_pcie_rx_tbl), | 2065 | .rx_tbl_num = ARRAY_SIZE(ipq8074_pcie_rx_tbl), |
| 2064 | .pcs_tbl = ipq8074_pcie_pcs_tbl, | 2066 | .pcs_tbl = ipq8074_pcie_pcs_tbl, |
| 2065 | .pcs_tbl_num = ARRAY_SIZE(ipq8074_pcie_pcs_tbl), | 2067 | .pcs_tbl_num = ARRAY_SIZE(ipq8074_pcie_pcs_tbl), |
| 2066 | .clk_list = NULL, | 2068 | .clk_list = ipq8074_pciephy_clk_l, |
| 2067 | .num_clks = 0, | 2069 | .num_clks = ARRAY_SIZE(ipq8074_pciephy_clk_l), |
| 2068 | .reset_list = ipq8074_pciephy_reset_l, | 2070 | .reset_list = ipq8074_pciephy_reset_l, |
| 2069 | .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), | 2071 | .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), |
| 2070 | .vreg_list = NULL, | 2072 | .vreg_list = NULL, |
| @@ -77,6 +77,8 @@ · 76 unmodified lines | |||
| 77 | #define QSERDES_COM_CORECLK_DIV_MODE1 0x1bc | 77 | #define QSERDES_COM_CORECLK_DIV_MODE1 0x1bc |
| 78 | 78 | ||
| 79 | /* Only for QMP V2 PHY - TX registers */ | 79 | /* Only for QMP V2 PHY - TX registers */ |
| 80 | #define QSERDES_TX_EMP_POST1_LVL 0x018 | ||
| 81 | #define QSERDES_TX_SLEW_CNTL 0x040 | ||
| 80 | #define QSERDES_TX_RES_CODE_LANE_OFFSET 0x054 | 82 | #define QSERDES_TX_RES_CODE_LANE_OFFSET 0x054 |
| 81 | #define QSERDES_TX_DEBUG_BUS_SEL 0x064 | 83 | #define QSERDES_TX_DEBUG_BUS_SEL 0x064 |
| 82 | #define QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN 0x068 | 84 | #define QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN 0x068 |
| @@ -22,10 +22,15 @@ · 21 unmodified lines | |||
| 22 | #include <linux/mfd/syscon.h> | 22 | #include <linux/mfd/syscon.h> |
| 23 | #include <linux/regmap.h> | 23 | #include <linux/regmap.h> |
| 24 | #include <linux/of_platform.h> | 24 | #include <linux/of_platform.h> |
| 25 | #include <linux/sys_soc.h> | ||
| 25 | 26 | ||
| 26 | #define USB2PHY_ANA_CONFIG1 0x4c | 27 | #define USB2PHY_ANA_CONFIG1 0x4c |
| 27 | #define USB2PHY_DISCON_BYP_LATCH BIT(31) | 28 | #define USB2PHY_DISCON_BYP_LATCH BIT(31) |
| 28 | 29 | ||
| 30 | #define USB2PHY_CHRG_DET 0x14 | ||
| 31 | #define USB2PHY_CHRG_DET_USE_CHG_DET_REG BIT(29) | ||
| 32 | #define USB2PHY_CHRG_DET_DIS_CHG_DET BIT(28) | ||
| 33 | |||
| 29 | /* SoC Specific USB2_OTG register definitions */ | 34 | /* SoC Specific USB2_OTG register definitions */ |
| 30 | #define AM654_USB2_OTG_PD BIT(8) | 35 | #define AM654_USB2_OTG_PD BIT(8) |
| 31 | #define AM654_USB2_VBUS_DET_EN BIT(5) | 36 | #define AM654_USB2_VBUS_DET_EN BIT(5) |
| @@ -43,6 +48,7 @@ · 11 unmodified lines | |||
| 43 | #define OMAP_USB2_HAS_START_SRP BIT(0) | 48 | #define OMAP_USB2_HAS_START_SRP BIT(0) |
| 44 | #define OMAP_USB2_HAS_SET_VBUS BIT(1) | 49 | #define OMAP_USB2_HAS_SET_VBUS BIT(1) |
| 45 | #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(2) | 50 | #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(2) |
| 51 | #define OMAP_USB2_DISABLE_CHRG_DET BIT(3) | ||
| 46 | 52 | ||
| 47 | struct omap_usb { | 53 | struct omap_usb { |
| 48 | struct usb_phy phy; | 54 | struct usb_phy phy; |
| @@ -236,6 +242,13 @@ static int omap_usb_init(struct phy *x) · 187 unmodified lines | |||
| 236 | omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val); | 242 | omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val); |
| 237 | } | 243 | } |
| 238 | 244 | ||
| 245 | if (phy->flags & OMAP_USB2_DISABLE_CHRG_DET) { | ||
| 246 | val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET); | ||
| 247 | val |= USB2PHY_CHRG_DET_USE_CHG_DET_REG | | ||
| 248 | USB2PHY_CHRG_DET_DIS_CHG_DET; | ||
| 249 | omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val); | ||
| 250 | } | ||
| 251 | |||
| 239 | return 0; | 252 | return 0; |
| 240 | } | 253 | } |
| 241 | 254 | ||
| @@ -329,6 +342,26 @@ static const struct of_device_id omap_usb2_id_table[] = { · 87 unmodified lines | |||
| 329 | }; | 342 | }; |
| 330 | MODULE_DEVICE_TABLE(of, omap_usb2_id_table); | 343 | MODULE_DEVICE_TABLE(of, omap_usb2_id_table); |
| 331 | 344 | ||
| 345 | static void omap_usb2_init_errata(struct omap_usb *phy) | ||
| 346 | { | ||
| 347 | static const struct soc_device_attribute am65x_sr10_soc_devices[] = { | ||
| 348 | { .family = "AM65X", .revision = "SR1.0" }, | ||
| 349 | { /* sentinel */ } | ||
| 350 | }; | ||
| 351 | |||
| 352 | /* | ||
| 353 | * Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by | ||
| 354 | * Default Without VBUS Presence. | ||
| 355 | * | ||
| 356 | * AM654x SR1.0 has a silicon bug due to which D+ is pulled high after | ||
| 357 | * POR, which could cause enumeration failure with some USB hubs. | ||
| 358 | * Disabling the USB2_PHY Charger Detect function will put D+ | ||
| 359 | * into the normal state. | ||
| 360 | */ | ||
| 361 | if (soc_device_match(am65x_sr10_soc_devices)) | ||
| 362 | phy->flags |= OMAP_USB2_DISABLE_CHRG_DET; | ||
| 363 | } | ||
| 364 | |||
| 332 | static int omap_usb2_probe(struct platform_device *pdev) | 365 | static int omap_usb2_probe(struct platform_device *pdev) |
| 333 | { | 366 | { |
| 334 | struct omap_usb *phy; | 367 | struct omap_usb *phy; |
| @@ -366,14 +399,14 @@ static int omap_usb2_probe(struct platform_device *pdev) · 31 unmodified lines | |||
| 366 | phy->mask = phy_data->mask; | 399 | phy->mask = phy_data->mask; |
| 367 | phy->power_on = phy_data->power_on; | 400 | phy->power_on = phy_data->power_on; |
| 368 | phy->power_off = phy_data->power_off; | 401 | phy->power_off = phy_data->power_off; |
| 402 | phy->flags = phy_data->flags; | ||
| 369 | 403 | ||
| 370 | if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { | 404 | omap_usb2_init_errata(phy); |
| 371 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 405 | |
| 372 | phy->phy_base = devm_ioremap_resource(&pdev->dev, res); | 406 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 373 | if (IS_ERR(phy->phy_base)) | 407 | phy->phy_base = devm_ioremap_resource(&pdev->dev, res); |
| 374 | return PTR_ERR(phy->phy_base); | 408 | if (IS_ERR(phy->phy_base)) |
| 375 | phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; | 409 | return PTR_ERR(phy->phy_base); |
| 376 | } | ||
| 377 | 410 | ||
| 378 | phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node, | 411 | phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node, |
| 379 | "syscon-phy-power"); | 412 | "syscon-phy-power"); |
| @@ -1035,6 +1035,9 @@ static const struct x86_cpu_id rapl_ids[] __initconst = { · 1034 unmodified lines | |||
| 1035 | X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L, &rapl_defaults_core), | 1035 | X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L, &rapl_defaults_core), |
| 1036 | X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, &rapl_defaults_core), | 1036 | X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, &rapl_defaults_core), |
| 1037 | X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, &rapl_defaults_core), | 1037 | X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, &rapl_defaults_core), |
| 1038 | X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE, &rapl_defaults_core), | ||
| 1039 | X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, &rapl_defaults_core), | ||
| 1040 | X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &rapl_defaults_core), | ||
| 1038 | X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server), | 1041 | X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server), |
| 1039 | 1042 | ||
| 1040 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt), | 1043 | X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt), |
| @@ -37,7 +37,7 @@ config RAPIDIO_ENABLE_RX_TX_PORTS · 36 unmodified lines | |||
| 37 | config RAPIDIO_DMA_ENGINE | 37 | config RAPIDIO_DMA_ENGINE |
| 38 | bool "DMA Engine support for RapidIO" | 38 | bool "DMA Engine support for RapidIO" |
| 39 | depends on RAPIDIO | 39 | depends on RAPIDIO |
| 40 | select DMADEVICES | 40 | depends on DMADEVICES |
| 41 | select DMA_ENGINE | 41 | select DMA_ENGINE |
| 42 | help | 42 | help |
| 43 | Say Y here if you want to use DMA Engine frameork for RapidIO data | 43 | Say Y here if you want to use DMA Engine frameork for RapidIO data |
| @@ -236,8 +236,8 @@ static bool regulator_supply_is_couple(struct regulator_dev *rdev) · 235 unmodified lines | |||
| 236 | static void regulator_unlock_recursive(struct regulator_dev *rdev, | 236 | static void regulator_unlock_recursive(struct regulator_dev *rdev, |
| 237 | unsigned int n_coupled) | 237 | unsigned int n_coupled) |
| 238 | { | 238 | { |
| 239 | struct regulator_dev *c_rdev; | 239 | struct regulator_dev *c_rdev, *supply_rdev; |
| 240 | int i; | 240 | int i, supply_n_coupled; |
| 241 | 241 | ||
| 242 | for (i = n_coupled; i > 0; i--) { | 242 | for (i = n_coupled; i > 0; i--) { |
| 243 | c_rdev = rdev->coupling_desc.coupled_rdevs[i - 1]; | 243 | c_rdev = rdev->coupling_desc.coupled_rdevs[i - 1]; |
| @@ -245,10 +245,13 @@ static void regulator_unlock_recursive(struct regulator_dev *rdev, · 1 unmodified line | |||
| 245 | if (!c_rdev) | 245 | if (!c_rdev) |
| 246 | continue; | 246 | continue; |
| 247 | 247 | ||
| 248 | if (c_rdev->supply && !regulator_supply_is_couple(c_rdev)) | 248 | if (c_rdev->supply && !regulator_supply_is_couple(c_rdev)) { |
| 249 | regulator_unlock_recursive( | 249 | supply_rdev = c_rdev->supply->rdev; |
| 250 | c_rdev->supply->rdev, | 250 | supply_n_coupled = supply_rdev->coupling_desc.n_coupled; |
| 251 | c_rdev->coupling_desc.n_coupled); | 251 | |
| 252 | regulator_unlock_recursive(supply_rdev, | ||
| 253 | supply_n_coupled); | ||
| 254 | } | ||
| 252 | 255 | ||
| 253 | regulator_unlock(c_rdev); | 256 | regulator_unlock(c_rdev); |
| 254 | } | 257 | } |
| @@ -1461,7 +1464,7 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, · 1206 unmodified lines | |||
| 1461 | const char *consumer_dev_name, | 1464 | const char *consumer_dev_name, |
| 1462 | const char *supply) | 1465 | const char *supply) |
| 1463 | { | 1466 | { |
| 1464 | struct regulator_map *node; | 1467 | struct regulator_map *node, *new_node; |
| 1465 | int has_dev; | 1468 | int has_dev; |
| 1466 | 1469 | ||
| 1467 | if (supply == NULL) | 1470 | if (supply == NULL) |
| @@ -1472,6 +1475,22 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, · 4 unmodified lines | |||
| 1472 | else | 1475 | else |
| 1473 | has_dev = 0; | 1476 | has_dev = 0; |
| 1474 | 1477 | ||
| 1478 | new_node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL); | ||
| 1479 | if (new_node == NULL) | ||
| 1480 | return -ENOMEM; | ||
| 1481 | |||
| 1482 | new_node->regulator = rdev; | ||
| 1483 | new_node->supply = supply; | ||
| 1484 | |||
| 1485 | if (has_dev) { | ||
| 1486 | new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL); | ||
| 1487 | if (new_node->dev_name == NULL) { | ||
| 1488 | kfree(new_node); | ||
| 1489 | return -ENOMEM; | ||
| 1490 | } | ||
| 1491 | } | ||
| 1492 | |||
| 1493 | mutex_lock(®ulator_list_mutex); | ||
| 1475 | list_for_each_entry(node, ®ulator_map_list, list) { | 1494 | list_for_each_entry(node, ®ulator_map_list, list) { |
| 1476 | if (node->dev_name && consumer_dev_name) { | 1495 | if (node->dev_name && consumer_dev_name) { |
| 1477 | if (strcmp(node->dev_name, consumer_dev_name) != 0) | 1496 | if (strcmp(node->dev_name, consumer_dev_name) != 0) |
| @@ -1489,26 +1508,19 @@ static int set_consumer_device_supply(struct regulator_dev *rdev, · 11 unmodified lines | |||
| 1489 | node->regulator->desc->name, | 1508 | node->regulator->desc->name, |
| 1490 | supply, | 1509 | supply, |
| 1491 | dev_name(&rdev->dev), rdev_get_name(rdev)); | 1510 | dev_name(&rdev->dev), rdev_get_name(rdev)); |
| 1492 | return -EBUSY; | 1511 | goto fail; |
| 1493 | } | 1512 | } |
| 1494 | 1513 | ||
| 1495 | node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL); | 1514 | list_add(&new_node->list, ®ulator_map_list); |
| 1496 | if (node == NULL) | 1515 | mutex_unlock(®ulator_list_mutex); |
| 1497 | return -ENOMEM; | ||
| 1498 | |||
| 1499 | node->regulator = rdev; | ||
| 1500 | node->supply = supply; | ||
| 1501 | |||
| 1502 | if (has_dev) { | ||
| 1503 | node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL); | ||
| 1504 | if (node->dev_name == NULL) { | ||
| 1505 | kfree(node); | ||
| 1506 | return -ENOMEM; | ||
| 1507 | } | ||
| 1508 | } | ||
| 1509 | 1516 | ||
| 1510 | list_add(&node->list, ®ulator_map_list); | ||
| 1511 | return 0; | 1517 | return 0; |
| 1518 | |||
| 1519 | fail: | ||
| 1520 | mutex_unlock(®ulator_list_mutex); | ||
| 1521 | kfree(new_node->dev_name); | ||
| 1522 | kfree(new_node); | ||
| 1523 | return -EBUSY; | ||
| 1512 | } | 1524 | } |
| 1513 | 1525 | ||
| 1514 | static void unset_regulator_supplies(struct regulator_dev *rdev) | 1526 | static void unset_regulator_supplies(struct regulator_dev *rdev) |
| @@ -1580,44 +1592,53 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, · 65 unmodified lines | |||
| 1580 | const char *supply_name) | 1592 | const char *supply_name) |
| 1581 | { | 1593 | { |
| 1582 | struct regulator *regulator; | 1594 | struct regulator *regulator; |
| 1583 | char buf[REG_STR_SIZE]; | 1595 | int err; |
| 1584 | int err, size; | 1596 | |
| 1597 | if (dev) { | ||
| 1598 | char buf[REG_STR_SIZE]; | ||
| 1599 | int size; | ||
| 1600 | |||
| 1601 | size = snprintf(buf, REG_STR_SIZE, "%s-%s", | ||
| 1602 | dev->kobj.name, supply_name); | ||
| 1603 | if (size >= REG_STR_SIZE) | ||
| 1604 | return NULL; | ||
| 1605 | |||
| 1606 | supply_name = kstrdup(buf, GFP_KERNEL); | ||
| 1607 | if (supply_name == NULL) | ||
| 1608 | return NULL; | ||
| 1609 | } else { | ||
| 1610 | supply_name = kstrdup_const(supply_name, GFP_KERNEL); | ||
| 1611 | if (supply_name == NULL) | ||
| 1612 | return NULL; | ||
| 1613 | } | ||
| 1585 | 1614 | ||
| 1586 | regulator = kzalloc(sizeof(*regulator), GFP_KERNEL); | 1615 | regulator = kzalloc(sizeof(*regulator), GFP_KERNEL); |
| 1587 | if (regulator == NULL) | 1616 | if (regulator == NULL) { |
| 1617 | kfree(supply_name); | ||
| 1588 | return NULL; | 1618 | return NULL; |
| 1619 | } | ||
| 1589 | 1620 | ||
| 1590 | regulator_lock(rdev); | ||
| 1591 | regulator->rdev = rdev; | 1621 | regulator->rdev = rdev; |
| 1622 | regulator->supply_name = supply_name; | ||
| 1623 | |||
| 1624 | regulator_lock(rdev); | ||
| 1592 | list_add(®ulator->list, &rdev->consumer_list); | 1625 | list_add(®ulator->list, &rdev->consumer_list); |
| 1626 | regulator_unlock(rdev); | ||
| 1593 | 1627 | ||
| 1594 | if (dev) { | 1628 | if (dev) { |
| 1595 | regulator->dev = dev; | 1629 | regulator->dev = dev; |
| 1596 | 1630 | ||
| 1597 | /* Add a link to the device sysfs entry */ | 1631 | /* Add a link to the device sysfs entry */ |
| 1598 | size = snprintf(buf, REG_STR_SIZE, "%s-%s", | ||
| 1599 | dev->kobj.name, supply_name); | ||
| 1600 | if (size >= REG_STR_SIZE) | ||
| 1601 | goto overflow_err; | ||
| 1602 | |||
| 1603 | regulator->supply_name = kstrdup(buf, GFP_KERNEL); | ||
| 1604 | if (regulator->supply_name == NULL) | ||
| 1605 | goto overflow_err; | ||
| 1606 | |||
| 1607 | err = sysfs_create_link_nowarn(&rdev->dev.kobj, &dev->kobj, | 1632 | err = sysfs_create_link_nowarn(&rdev->dev.kobj, &dev->kobj, |
| 1608 | buf); | 1633 | supply_name); |
| 1609 | if (err) { | 1634 | if (err) { |
| 1610 | rdev_dbg(rdev, "could not add device link %s err %d\n", | 1635 | rdev_dbg(rdev, "could not add device link %s err %d\n", |
| 1611 | dev->kobj.name, err); | 1636 | dev->kobj.name, err); |
| 1612 | /* non-fatal */ | 1637 | /* non-fatal */ |
| 1613 | } | 1638 | } |
| 1614 | } else { | ||
| 1615 | regulator->supply_name = kstrdup_const(supply_name, GFP_KERNEL); | ||
| 1616 | if (regulator->supply_name == NULL) | ||
| 1617 | goto overflow_err; | ||
| 1618 | } | 1639 | } |
| 1619 | 1640 | ||
| 1620 | regulator->debugfs = debugfs_create_dir(regulator->supply_name, | 1641 | regulator->debugfs = debugfs_create_dir(supply_name, |
| 1621 | rdev->debugfs); | 1642 | rdev->debugfs); |
| 1622 | if (!regulator->debugfs) { | 1643 | if (!regulator->debugfs) { |
| 1623 | rdev_dbg(rdev, "Failed to create debugfs directory\n"); | 1644 | rdev_dbg(rdev, "Failed to create debugfs directory\n"); |
| @@ -1642,13 +1663,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, · 18 unmodified lines | |||
| 1642 | _regulator_is_enabled(rdev)) | 1663 | _regulator_is_enabled(rdev)) |
| 1643 | regulator->always_on = true; | 1664 | regulator->always_on = true; |
| 1644 | 1665 | ||
| 1645 | regulator_unlock(rdev); | ||
| 1646 | return regulator; | 1666 | return regulator; |
| 1647 | overflow_err: | ||
| 1648 | list_del(®ulator->list); | ||
| 1649 | kfree(regulator); | ||
| 1650 | regulator_unlock(rdev); | ||
| 1651 | return NULL; | ||
| 1652 | } | 1667 | } |
| 1653 | 1668 | ||
| 1654 | static int _regulator_get_enable_time(struct regulator_dev *rdev) | 1669 | static int _regulator_get_enable_time(struct regulator_dev *rdev) |
| @@ -2230,10 +2245,13 @@ EXPORT_SYMBOL_GPL(regulator_bulk_unregister_supply_alias); · 575 unmodified lines | |||
| 2230 | static int regulator_ena_gpio_request(struct regulator_dev *rdev, | 2245 | static int regulator_ena_gpio_request(struct regulator_dev *rdev, |
| 2231 | const struct regulator_config *config) | 2246 | const struct regulator_config *config) |
| 2232 | { | 2247 | { |
| 2233 | struct regulator_enable_gpio *pin; | 2248 | struct regulator_enable_gpio *pin, *new_pin; |
| 2234 | struct gpio_desc *gpiod; | 2249 | struct gpio_desc *gpiod; |
| 2235 | 2250 | ||
| 2236 | gpiod = config->ena_gpiod; | 2251 | gpiod = config->ena_gpiod; |
| 2252 | new_pin = kzalloc(sizeof(*new_pin), GFP_KERNEL); | ||
| 2253 | |||
| 2254 | mutex_lock(®ulator_list_mutex); | ||
| 2237 | 2255 | ||
| 2238 | list_for_each_entry(pin, ®ulator_ena_gpio_list, list) { | 2256 | list_for_each_entry(pin, ®ulator_ena_gpio_list, list) { |
| 2239 | if (pin->gpiod == gpiod) { | 2257 | if (pin->gpiod == gpiod) { |
| @@ -2242,9 +2260,13 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev, · 2 unmodified lines | |||
| 2242 | } | 2260 | } |
| 2243 | } | 2261 | } |
| 2244 | 2262 | ||
| 2245 | pin = kzalloc(sizeof(struct regulator_enable_gpio), GFP_KERNEL); | 2263 | if (new_pin == NULL) { |
| 2246 | if (pin == NULL) | 2264 | mutex_unlock(®ulator_list_mutex); |
| 2247 | return -ENOMEM; | 2265 | return -ENOMEM; |
| 2266 | } | ||
| 2267 | |||
| 2268 | pin = new_pin; | ||
| 2269 | new_pin = NULL; | ||
| 2248 | 2270 | ||
| 2249 | pin->gpiod = gpiod; | 2271 | pin->gpiod = gpiod; |
| 2250 | list_add(&pin->list, ®ulator_ena_gpio_list); | 2272 | list_add(&pin->list, ®ulator_ena_gpio_list); |
| @@ -2252,6 +2274,10 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev, · 1 unmodified line | |||
| 2252 | update_ena_gpio_to_rdev: | 2274 | update_ena_gpio_to_rdev: |
| 2253 | pin->request_count++; | 2275 | pin->request_count++; |
| 2254 | rdev->ena_pin = pin; | 2276 | rdev->ena_pin = pin; |
| 2277 | |||
| 2278 | mutex_unlock(®ulator_list_mutex); | ||
| 2279 | kfree(new_pin); | ||
| 2280 | |||
| 2255 | return 0; | 2281 | return 0; |
| 2256 | } | 2282 | } |
| 2257 | 2283 | ||
| @@ -2264,19 +2290,19 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev) · 6 unmodified lines | |||
| 2264 | 2290 | ||
| 2265 | /* Free the GPIO only in case of no use */ | 2291 | /* Free the GPIO only in case of no use */ |
| 2266 | list_for_each_entry_safe(pin, n, ®ulator_ena_gpio_list, list) { | 2292 | list_for_each_entry_safe(pin, n, ®ulator_ena_gpio_list, list) { |
| 2267 | if (pin->gpiod == rdev->ena_pin->gpiod) { | 2293 | if (pin != rdev->ena_pin) |
| 2268 | if (pin->request_count <= 1) { | 2294 | continue; |
| 2269 | pin->request_count = 0; | 2295 | |
| 2270 | gpiod_put(pin->gpiod); | 2296 | if (--pin->request_count) |
| 2271 | list_del(&pin->list); | 2297 | break; |
| 2272 | kfree(pin); | 2298 | |
| 2273 | rdev->ena_pin = NULL; | 2299 | gpiod_put(pin->gpiod); |
| 2274 | return; | 2300 | list_del(&pin->list); |
| 2275 | } else { | 2301 | kfree(pin); |
| 2276 | pin->request_count--; | 2302 | break; |
| 2277 | } | ||
| 2278 | } | ||
| 2279 | } | 2303 | } |
| 2304 | |||
| 2305 | rdev->ena_pin = NULL; | ||
| 2280 | } | 2306 | } |
| 2281 | 2307 | ||
| 2282 | /** | 2308 | /** |
| @@ -4949,13 +4975,9 @@ static void regulator_resolve_coupling(struct regulator_dev *rdev) · 2666 unmodified lines | |||
| 4949 | return; | 4975 | return; |
| 4950 | } | 4976 | } |
| 4951 | 4977 | ||
| 4952 | regulator_lock(c_rdev); | ||
| 4953 | |||
| 4954 | c_desc->coupled_rdevs[i] = c_rdev; | 4978 | c_desc->coupled_rdevs[i] = c_rdev; |
| 4955 | c_desc->n_resolved++; | 4979 | c_desc->n_resolved++; |
| 4956 | 4980 | ||
| 4957 | regulator_unlock(c_rdev); | ||
| 4958 | |||
| 4959 | regulator_resolve_coupling(c_rdev); | 4981 | regulator_resolve_coupling(c_rdev); |
| 4960 | } | 4982 | } |
| 4961 | } | 4983 | } |
| @@ -5040,7 +5062,10 @@ static int regulator_init_coupling(struct regulator_dev *rdev) · 78 unmodified lines | |||
| 5040 | if (!of_check_coupling_data(rdev)) | 5062 | if (!of_check_coupling_data(rdev)) |
| 5041 | return -EPERM; | 5063 | return -EPERM; |
| 5042 | 5064 | ||
| 5065 | mutex_lock(®ulator_list_mutex); | ||
| 5043 | rdev->coupling_desc.coupler = regulator_find_coupler(rdev); | 5066 | rdev->coupling_desc.coupler = regulator_find_coupler(rdev); |
| 5067 | mutex_unlock(®ulator_list_mutex); | ||
| 5068 | |||
| 5044 | if (IS_ERR(rdev->coupling_desc.coupler)) { | 5069 | if (IS_ERR(rdev->coupling_desc.coupler)) { |
| 5045 | err = PTR_ERR(rdev->coupling_desc.coupler); | 5070 | err = PTR_ERR(rdev->coupling_desc.coupler); |
| 5046 | rdev_err(rdev, "failed to get coupler: %d\n", err); | 5071 | rdev_err(rdev, "failed to get coupler: %d\n", err); |
| @@ -5141,6 +5166,7 @@ regulator_register(const struct regulator_desc *regulator_desc, · 94 unmodified lines | |||
| 5141 | ret = -ENOMEM; | 5166 | ret = -ENOMEM; |
| 5142 | goto rinse; | 5167 | goto rinse; |
| 5143 | } | 5168 | } |
| 5169 | device_initialize(&rdev->dev); | ||
| 5144 | 5170 | ||
| 5145 | /* | 5171 | /* |
| 5146 | * Duplicate the config so the driver could override it after | 5172 | * Duplicate the config so the driver could override it after |
| @@ -5148,9 +5174,8 @@ regulator_register(const struct regulator_desc *regulator_desc, · 1 unmodified line | |||
| 5148 | */ | 5174 | */ |
| 5149 | config = kmemdup(cfg, sizeof(*cfg), GFP_KERNEL); | 5175 | config = kmemdup(cfg, sizeof(*cfg), GFP_KERNEL); |
| 5150 | if (config == NULL) { | 5176 | if (config == NULL) { |
| 5151 | kfree(rdev); | ||
| 5152 | ret = -ENOMEM; | 5177 | ret = -ENOMEM; |
| 5153 | goto rinse; | 5178 | goto clean; |
| 5154 | } | 5179 | } |
| 5155 | 5180 | ||
| 5156 | init_data = regulator_of_get_init_data(dev, regulator_desc, config, | 5181 | init_data = regulator_of_get_init_data(dev, regulator_desc, config, |
| @@ -5162,10 +5187,8 @@ regulator_register(const struct regulator_desc *regulator_desc, · 5 unmodified lines | |||
| 5162 | * from a gpio extender or something else. | 5187 | * from a gpio extender or something else. |
| 5163 | */ | 5188 | */ |
| 5164 | if (PTR_ERR(init_data) == -EPROBE_DEFER) { | 5189 | if (PTR_ERR(init_data) == -EPROBE_DEFER) { |
| 5165 | kfree(config); | ||
| 5166 | kfree(rdev); | ||
| 5167 | ret = -EPROBE_DEFER; | 5190 | ret = -EPROBE_DEFER; |
| 5168 | goto rinse; | 5191 | goto clean; |
| 5169 | } | 5192 | } |
| 5170 | 5193 | ||
| 5171 | /* | 5194 | /* |
| @@ -5206,9 +5229,7 @@ regulator_register(const struct regulator_desc *regulator_desc, · 34 unmodified lines | |||
| 5206 | } | 5229 | } |
| 5207 | 5230 | ||
| 5208 | if (config->ena_gpiod) { | 5231 | if (config->ena_gpiod) { |
| 5209 | mutex_lock(®ulator_list_mutex); | ||
| 5210 | ret = regulator_ena_gpio_request(rdev, config); | 5232 | ret = regulator_ena_gpio_request(rdev, config); |
| 5211 | mutex_unlock(®ulator_list_mutex); | ||
| 5212 | if (ret != 0) { | 5233 | if (ret != 0) { |
| 5213 | rdev_err(rdev, "Failed to request enable GPIO: %d\n", | 5234 | rdev_err(rdev, "Failed to request enable GPIO: %d\n", |
| 5214 | ret); | 5235 | ret); |
| @@ -5220,7 +5241,6 @@ regulator_register(const struct regulator_desc *regulator_desc, · 5 unmodified lines | |||
| 5220 | } | 5241 | } |
| 5221 | 5242 | ||
| 5222 | /* register with sysfs */ | 5243 | /* register with sysfs */ |
| 5223 | device_initialize(&rdev->dev); | ||
| 5224 | rdev->dev.class = ®ulator_class; | 5244 | rdev->dev.class = ®ulator_class; |
| 5225 | rdev->dev.parent = dev; | 5245 | rdev->dev.parent = dev; |
| 5226 | dev_set_name(&rdev->dev, "regulator.%lu", | 5246 | dev_set_name(&rdev->dev, "regulator.%lu", |
| @@ -5248,27 +5268,22 @@ regulator_register(const struct regulator_desc *regulator_desc, · 21 unmodified lines | |||
| 5248 | if (ret < 0) | 5268 | if (ret < 0) |
| 5249 | goto wash; | 5269 | goto wash; |
| 5250 | 5270 | ||
| 5251 | mutex_lock(®ulator_list_mutex); | ||
| 5252 | ret = regulator_init_coupling(rdev); | 5271 | ret = regulator_init_coupling(rdev); |
| 5253 | mutex_unlock(®ulator_list_mutex); | ||
| 5254 | if (ret < 0) | 5272 | if (ret < 0) |
| 5255 | goto wash; | 5273 | goto wash; |
| 5256 | 5274 | ||
| 5257 | /* add consumers devices */ | 5275 | /* add consumers devices */ |
| 5258 | if (init_data) { | 5276 | if (init_data) { |
| 5259 | mutex_lock(®ulator_list_mutex); | ||
| 5260 | for (i = 0; i < init_data->num_consumer_supplies; i++) { | 5277 | for (i = 0; i < init_data->num_consumer_supplies; i++) { |
| 5261 | ret = set_consumer_device_supply(rdev, | 5278 | ret = set_consumer_device_supply(rdev, |
| 5262 | init_data->consumer_supplies[i].dev_name, | 5279 | init_data->consumer_supplies[i].dev_name, |
| 5263 | init_data->consumer_supplies[i].supply); | 5280 | init_data->consumer_supplies[i].supply); |
| 5264 | if (ret < 0) { | 5281 | if (ret < 0) { |
| 5265 | mutex_unlock(®ulator_list_mutex); | ||
| 5266 | dev_err(dev, "Failed to set supply %s\n", | 5282 | dev_err(dev, "Failed to set supply %s\n", |
| 5267 | init_data->consumer_supplies[i].supply); | 5283 | init_data->consumer_supplies[i].supply); |
| 5268 | goto unset_supplies; | 5284 | goto unset_supplies; |
| 5269 | } | 5285 | } |
| 5270 | } | 5286 | } |
| 5271 | mutex_unlock(®ulator_list_mutex); | ||
| 5272 | } | 5287 | } |
| 5273 | 5288 | ||
| 5274 | if (!rdev->desc->ops->get_voltage && | 5289 | if (!rdev->desc->ops->get_voltage && |
| @@ -5303,13 +5318,11 @@ wash: · 28 unmodified lines | |||
| 5303 | mutex_lock(®ulator_list_mutex); | 5318 | mutex_lock(®ulator_list_mutex); |
| 5304 | regulator_ena_gpio_free(rdev); | 5319 | regulator_ena_gpio_free(rdev); |
| 5305 | mutex_unlock(®ulator_list_mutex); | 5320 | mutex_unlock(®ulator_list_mutex); |
| 5306 | put_device(&rdev->dev); | ||
| 5307 | rdev = NULL; | ||
| 5308 | clean: | 5321 | clean: |
| 5309 | if (dangling_of_gpiod) | 5322 | if (dangling_of_gpiod) |
| 5310 | gpiod_put(config->ena_gpiod); | 5323 | gpiod_put(config->ena_gpiod); |
| 5311 | kfree(rdev); | ||
| 5312 | kfree(config); | 5324 | kfree(config); |
| 5325 | put_device(&rdev->dev); | ||
| 5313 | rinse: | 5326 | rinse: |
| 5314 | if (dangling_cfg_gpiod) | 5327 | if (dangling_cfg_gpiod) |
| 5315 | gpiod_put(cfg->ena_gpiod); | 5328 | gpiod_put(cfg->ena_gpiod); |
| @@ -170,6 +170,9 @@ static int cros_ec_regulator_init_info(struct device *dev, · 169 unmodified lines | |||
| 170 | data->voltages_mV = | 170 | data->voltages_mV = |
| 171 | devm_kmemdup(dev, resp.voltages_mv, | 171 | devm_kmemdup(dev, resp.voltages_mv, |
| 172 | sizeof(u16) * data->num_voltages, GFP_KERNEL); | 172 | sizeof(u16) * data->num_voltages, GFP_KERNEL); |
| 173 | if (!data->voltages_mV) | ||
| 174 | return -ENOMEM; | ||
| 175 | |||
| 173 | data->desc.n_voltages = data->num_voltages; | 176 | data->desc.n_voltages = data->num_voltages; |
| 174 | 177 | ||
| 175 | /* Make sure the returned name is always a valid string */ | 178 | /* Make sure the returned name is always a valid string */ |
| @@ -182,7 +182,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) · 181 unmodified lines | |||
| 182 | 182 | ||
| 183 | drvdata->enable_clock = devm_clk_get(dev, NULL); | 183 | drvdata->enable_clock = devm_clk_get(dev, NULL); |
| 184 | if (IS_ERR(drvdata->enable_clock)) { | 184 | if (IS_ERR(drvdata->enable_clock)) { |
| 185 | dev_err(dev, "Cant get enable-clock from devicetree\n"); | 185 | dev_err(dev, "Can't get enable-clock from devicetree\n"); |
| 186 | return -ENOENT; | 186 | return -ENOENT; |
| 187 | } | 187 | } |
| 188 | } else { | 188 | } else { |
| @@ -279,7 +279,7 @@ static int pwm_regulator_init_table(struct platform_device *pdev, · 278 unmodified lines | |||
| 279 | return ret; | 279 | return ret; |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | drvdata->state = -EINVAL; | 282 | drvdata->state = -ENOTRECOVERABLE; |
| 283 | drvdata->duty_cycle_table = duty_cycle_table; | 283 | drvdata->duty_cycle_table = duty_cycle_table; |
| 284 | drvdata->desc.ops = &pwm_regulator_voltage_table_ops; | 284 | drvdata->desc.ops = &pwm_regulator_voltage_table_ops; |
| 285 | drvdata->desc.n_voltages = length / sizeof(*duty_cycle_table); | 285 | drvdata->desc.n_voltages = length / sizeof(*duty_cycle_table); |
| @@ -2457,10 +2457,10 @@ int cxgbi_conn_xmit_pdu(struct iscsi_task *task) · 2456 unmodified lines | |||
| 2457 | return err; | 2457 | return err; |
| 2458 | } | 2458 | } |
| 2459 | 2459 | ||
| 2460 | __kfree_skb(skb); | ||
| 2461 | log_debug(1 << CXGBI_DBG_ISCSI | 1 << CXGBI_DBG_PDU_TX, | 2460 | log_debug(1 << CXGBI_DBG_ISCSI | 1 << CXGBI_DBG_PDU_TX, |
| 2462 | "itt 0x%x, skb 0x%p, len %u/%u, xmit err %d.\n", | 2461 | "itt 0x%x, skb 0x%p, len %u/%u, xmit err %d.\n", |
| 2463 | task->itt, skb, skb->len, skb->data_len, err); | 2462 | task->itt, skb, skb->len, skb->data_len, err); |
| 2463 | __kfree_skb(skb); | ||
| 2464 | iscsi_conn_printk(KERN_ERR, task->conn, "xmit err %d.\n", err); | 2464 | iscsi_conn_printk(KERN_ERR, task->conn, "xmit err %d.\n", err); |
| 2465 | iscsi_conn_failure(task->conn, ISCSI_ERR_XMIT_FAILED); | 2465 | iscsi_conn_failure(task->conn, ISCSI_ERR_XMIT_FAILED); |
| 2466 | return err; | 2466 | return err; |
| @@ -634,8 +634,6 @@ free_fp: · 633 unmodified lines | |||
| 634 | fc_frame_free(fp); | 634 | fc_frame_free(fp); |
| 635 | out: | 635 | out: |
| 636 | kref_put(&rdata->kref, fc_rport_destroy); | 636 | kref_put(&rdata->kref, fc_rport_destroy); |
| 637 | if (!IS_ERR(fp)) | ||
| 638 | fc_frame_free(fp); | ||
| 639 | } | 637 | } |
| 640 | 638 | ||
| 641 | /** | 639 | /** |
| @@ -209,7 +209,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) · 208 unmodified lines | |||
| 209 | task->num_scatter = si; | 209 | task->num_scatter = si; |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | task->data_dir = qc->dma_dir; | 212 | if (qc->tf.protocol == ATA_PROT_NODATA) |
| 213 | task->data_dir = DMA_NONE; | ||
| 214 | else | ||
| 215 | task->data_dir = qc->dma_dir; | ||
| 213 | task->scatter = qc->sg; | 216 | task->scatter = qc->sg; |
| 214 | task->ata_task.retry_count = 1; | 217 | task->ata_task.retry_count = 1; |
| 215 | task->task_state_flags = SAS_TASK_STATE_PENDING; | 218 | task->task_state_flags = SAS_TASK_STATE_PENDING; |
| @@ -3517,6 +3517,9 @@ lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t retry) · 3516 unmodified lines | |||
| 3517 | FC_TLV_DESC_LENGTH_FROM_SZ(prdf->reg_d1)); | 3517 | FC_TLV_DESC_LENGTH_FROM_SZ(prdf->reg_d1)); |
| 3518 | prdf->reg_d1.reg_desc.count = cpu_to_be32(ELS_RDF_REG_TAG_CNT); | 3518 | prdf->reg_d1.reg_desc.count = cpu_to_be32(ELS_RDF_REG_TAG_CNT); |
| 3519 | prdf->reg_d1.desc_tags[0] = cpu_to_be32(ELS_DTAG_LNK_INTEGRITY); | 3519 | prdf->reg_d1.desc_tags[0] = cpu_to_be32(ELS_DTAG_LNK_INTEGRITY); |
| 3520 | prdf->reg_d1.desc_tags[1] = cpu_to_be32(ELS_DTAG_DELIVERY); | ||
| 3521 | prdf->reg_d1.desc_tags[2] = cpu_to_be32(ELS_DTAG_PEER_CONGEST); | ||
| 3522 | prdf->reg_d1.desc_tags[3] = cpu_to_be32(ELS_DTAG_CONGESTION); | ||
| 3520 | 3523 | ||
| 3521 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, | 3524 | lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, |
| 3522 | "Issue RDF: did:x%x", | 3525 | "Issue RDF: did:x%x", |
| @@ -4656,7 +4659,9 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 1133 unmodified lines | |||
| 4656 | out: | 4659 | out: |
| 4657 | if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) { | 4660 | if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) { |
| 4658 | spin_lock_irq(shost->host_lock); | 4661 | spin_lock_irq(shost->host_lock); |
| 4659 | ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI); | 4662 | if (mbox) |
| 4663 | ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN; | ||
| 4664 | ndlp->nlp_flag &= ~NLP_RM_DFLT_RPI; | ||
| 4660 | spin_unlock_irq(shost->host_lock); | 4665 | spin_unlock_irq(shost->host_lock); |
| 4661 | 4666 | ||
| 4662 | /* If the node is not being used by another discovery thread, | 4667 | /* If the node is not being used by another discovery thread, |
| @@ -4800,7 +4800,7 @@ struct send_frame_wqe { · 4799 unmodified lines | |||
| 4800 | uint32_t fc_hdr_wd5; /* word 15 */ | 4800 | uint32_t fc_hdr_wd5; /* word 15 */ |
| 4801 | }; | 4801 | }; |
| 4802 | 4802 | ||
| 4803 | #define ELS_RDF_REG_TAG_CNT 1 | 4803 | #define ELS_RDF_REG_TAG_CNT 4 |
| 4804 | struct lpfc_els_rdf_reg_desc { | 4804 | struct lpfc_els_rdf_reg_desc { |
| 4805 | struct fc_df_desc_fpin_reg reg_desc; /* descriptor header */ | 4805 | struct fc_df_desc_fpin_reg reg_desc; /* descriptor header */ |
| 4806 | __be32 desc_tags[ELS_RDF_REG_TAG_CNT]; | 4806 | __be32 desc_tags[ELS_RDF_REG_TAG_CNT]; |
| @@ -11376,7 +11376,6 @@ lpfc_irq_clear_aff(struct lpfc_hba_eq_hdl *eqhdl) · 11375 unmodified lines | |||
| 11376 | { | 11376 | { |
| 11377 | cpumask_clear(&eqhdl->aff_mask); | 11377 | cpumask_clear(&eqhdl->aff_mask); |
| 11378 | irq_clear_status_flags(eqhdl->irq, IRQ_NO_BALANCING); | 11378 | irq_clear_status_flags(eqhdl->irq, IRQ_NO_BALANCING); |
| 11379 | irq_set_affinity_hint(eqhdl->irq, &eqhdl->aff_mask); | ||
| 11380 | } | 11379 | } |
| 11381 | 11380 | ||
| 11382 | /** | 11381 | /** |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | |||
| 20 | * included with this package. * | 20 | * included with this package. * |
| 21 | *******************************************************************/ | 21 | *******************************************************************/ |
| 22 | 22 | ||
| 23 | #define LPFC_DRIVER_VERSION "12.8.0.3" | 23 | #define LPFC_DRIVER_VERSION "12.8.0.4" |
| 24 | #define LPFC_DRIVER_NAME "lpfc" | 24 | #define LPFC_DRIVER_NAME "lpfc" |
| 25 | 25 | ||
| 26 | /* Used for SLI 2/3 */ | 26 | /* Used for SLI 2/3 */ |
| @@ -3689,7 +3689,7 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int budget) · 3688 unmodified lines | |||
| 3689 | instance = irq_ctx->instance; | 3689 | instance = irq_ctx->instance; |
| 3690 | 3690 | ||
| 3691 | if (irq_ctx->irq_line_enable) { | 3691 | if (irq_ctx->irq_line_enable) { |
| 3692 | disable_irq(irq_ctx->os_irq); | 3692 | disable_irq_nosync(irq_ctx->os_irq); |
| 3693 | irq_ctx->irq_line_enable = false; | 3693 | irq_ctx->irq_line_enable = false; |
| 3694 | } | 3694 | } |
| 3695 | 3695 | ||
| @@ -1733,7 +1733,7 @@ _base_irqpoll(struct irq_poll *irqpoll, int budget) · 1732 unmodified lines | |||
| 1733 | reply_q = container_of(irqpoll, struct adapter_reply_queue, | 1733 | reply_q = container_of(irqpoll, struct adapter_reply_queue, |
| 1734 | irqpoll); | 1734 | irqpoll); |
| 1735 | if (reply_q->irq_line_enable) { | 1735 | if (reply_q->irq_line_enable) { |
| 1736 | disable_irq(reply_q->os_irq); | 1736 | disable_irq_nosync(reply_q->os_irq); |
| 1737 | reply_q->irq_line_enable = false; | 1737 | reply_q->irq_line_enable = false; |
| 1738 | } | 1738 | } |
| 1739 | num_entries = _base_process_reply_queue(reply_q); | 1739 | num_entries = _base_process_reply_queue(reply_q); |
| @@ -818,7 +818,7 @@ pm8001_exec_internal_task_abort(struct pm8001_hba_info *pm8001_ha, · 817 unmodified lines | |||
| 818 | 818 | ||
| 819 | res = pm8001_tag_alloc(pm8001_ha, &ccb_tag); | 819 | res = pm8001_tag_alloc(pm8001_ha, &ccb_tag); |
| 820 | if (res) | 820 | if (res) |
| 821 | return res; | 821 | goto ex_err; |
| 822 | ccb = &pm8001_ha->ccb_info[ccb_tag]; | 822 | ccb = &pm8001_ha->ccb_info[ccb_tag]; |
| 823 | ccb->device = pm8001_dev; | 823 | ccb->device = pm8001_dev; |
| 824 | ccb->ccb_tag = ccb_tag; | 824 | ccb->ccb_tag = ccb_tag; |
| @@ -3863,7 +3863,7 @@ void qedf_stag_change_work(struct work_struct *work) · 3862 unmodified lines | |||
| 3863 | container_of(work, struct qedf_ctx, stag_work.work); | 3863 | container_of(work, struct qedf_ctx, stag_work.work); |
| 3864 | 3864 | ||
| 3865 | if (!qedf) { | 3865 | if (!qedf) { |
| 3866 | QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL"); | 3866 | QEDF_ERR(NULL, "qedf is NULL"); |
| 3867 | return; | 3867 | return; |
| 3868 | } | 3868 | } |
| 3869 | QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n"); | 3869 | QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n"); |
| @@ -1626,7 +1626,7 @@ typedef struct { · 1625 unmodified lines | |||
| 1626 | */ | 1626 | */ |
| 1627 | uint8_t firmware_options[2]; | 1627 | uint8_t firmware_options[2]; |
| 1628 | 1628 | ||
| 1629 | uint16_t frame_payload_size; | 1629 | __le16 frame_payload_size; |
| 1630 | __le16 max_iocb_allocation; | 1630 | __le16 max_iocb_allocation; |
| 1631 | __le16 execution_throttle; | 1631 | __le16 execution_throttle; |
| 1632 | uint8_t retry_count; | 1632 | uint8_t retry_count; |
| @@ -4603,18 +4603,18 @@ qla2x00_nvram_config(scsi_qla_host_t *vha) · 4602 unmodified lines | |||
| 4603 | nv->firmware_options[1] = BIT_7 | BIT_5; | 4603 | nv->firmware_options[1] = BIT_7 | BIT_5; |
| 4604 | nv->add_firmware_options[0] = BIT_5; | 4604 | nv->add_firmware_options[0] = BIT_5; |
| 4605 | nv->add_firmware_options[1] = BIT_5 | BIT_4; | 4605 | nv->add_firmware_options[1] = BIT_5 | BIT_4; |
| 4606 | nv->frame_payload_size = 2048; | 4606 | nv->frame_payload_size = cpu_to_le16(2048); |
| 4607 | nv->special_options[1] = BIT_7; | 4607 | nv->special_options[1] = BIT_7; |
| 4608 | } else if (IS_QLA2200(ha)) { | 4608 | } else if (IS_QLA2200(ha)) { |
| 4609 | nv->firmware_options[0] = BIT_2 | BIT_1; | 4609 | nv->firmware_options[0] = BIT_2 | BIT_1; |
| 4610 | nv->firmware_options[1] = BIT_7 | BIT_5; | 4610 | nv->firmware_options[1] = BIT_7 | BIT_5; |
| 4611 | nv->add_firmware_options[0] = BIT_5; | 4611 | nv->add_firmware_options[0] = BIT_5; |
| 4612 | nv->add_firmware_options[1] = BIT_5 | BIT_4; | 4612 | nv->add_firmware_options[1] = BIT_5 | BIT_4; |
| 4613 | nv->frame_payload_size = 1024; | 4613 | nv->frame_payload_size = cpu_to_le16(1024); |
| 4614 | } else if (IS_QLA2100(ha)) { | 4614 | } else if (IS_QLA2100(ha)) { |
| 4615 | nv->firmware_options[0] = BIT_3 | BIT_1; | 4615 | nv->firmware_options[0] = BIT_3 | BIT_1; |
| 4616 | nv->firmware_options[1] = BIT_5; | 4616 | nv->firmware_options[1] = BIT_5; |
| 4617 | nv->frame_payload_size = 1024; | 4617 | nv->frame_payload_size = cpu_to_le16(1024); |
| 4618 | } | 4618 | } |
| 4619 | 4619 | ||
| 4620 | nv->max_iocb_allocation = cpu_to_le16(256); | 4620 | nv->max_iocb_allocation = cpu_to_le16(256); |
| @@ -4482,8 +4482,6 @@ static int resp_open_zone(struct scsi_cmnd *scp, struct sdebug_dev_info *devip) · 4481 unmodified lines | |||
| 4482 | goto fini; | 4482 | goto fini; |
| 4483 | } | 4483 | } |
| 4484 | 4484 | ||
| 4485 | if (zc == ZC2_IMPLICIT_OPEN) | ||
| 4486 | zbc_close_zone(devip, zsp); | ||
| 4487 | zbc_open_zone(devip, zsp, true); | 4485 | zbc_open_zone(devip, zsp, true); |
| 4488 | fini: | 4486 | fini: |
| 4489 | write_unlock(macc_lckp); | 4487 | write_unlock(macc_lckp); |
| @@ -1372,7 +1372,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) · 1371 unmodified lines | |||
| 1372 | return ret; | 1372 | return ret; |
| 1373 | } | 1373 | } |
| 1374 | 1374 | ||
| 1375 | /* Read Instat 1, Instat 2 and Instat 3 registers */ | 1375 | /* Read Intstat 1, Intstat 2 and Intstat 3 registers */ |
| 1376 | ret = sdw_read(slave, SDW_SCP_INT1); | 1376 | ret = sdw_read(slave, SDW_SCP_INT1); |
| 1377 | if (ret < 0) { | 1377 | if (ret < 0) { |
| 1378 | dev_err(slave->bus->dev, | 1378 | dev_err(slave->bus->dev, |
| @@ -717,6 +717,7 @@ error: · 716 unmodified lines | |||
| 717 | kfree(wbuf); | 717 | kfree(wbuf); |
| 718 | error_1: | 718 | error_1: |
| 719 | kfree(wr_msg); | 719 | kfree(wr_msg); |
| 720 | bus->defer_msg.msg = NULL; | ||
| 720 | return ret; | 721 | return ret; |
| 721 | } | 722 | } |
| 722 | 723 | ||
| @@ -840,9 +841,10 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) · 117 unmodified lines | |||
| 840 | error: | 841 | error: |
| 841 | list_for_each_entry(m_rt, &stream->master_list, stream_node) { | 842 | list_for_each_entry(m_rt, &stream->master_list, stream_node) { |
| 842 | bus = m_rt->bus; | 843 | bus = m_rt->bus; |
| 843 | 844 | if (bus->defer_msg.msg) { | |
| 844 | kfree(bus->defer_msg.msg->buf); | 845 | kfree(bus->defer_msg.msg->buf); |
| 845 | kfree(bus->defer_msg.msg); | 846 | kfree(bus->defer_msg.msg); |
| 847 | } | ||
| 846 | } | 848 | } |
| 847 | 849 | ||
| 848 | msg_unlock: | 850 | msg_unlock: |
| @@ -907,14 +907,16 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata, · 906 unmodified lines | |||
| 907 | struct dma_async_tx_descriptor *tx; | 907 | struct dma_async_tx_descriptor *tx; |
| 908 | dma_cookie_t cookie; | 908 | dma_cookie_t cookie; |
| 909 | dma_addr_t dma_dst; | 909 | dma_addr_t dma_dst; |
| 910 | struct device *ddev; | ||
| 910 | 911 | ||
| 911 | if (!cqspi->rx_chan || !virt_addr_valid(buf)) { | 912 | if (!cqspi->rx_chan || !virt_addr_valid(buf)) { |
| 912 | memcpy_fromio(buf, cqspi->ahb_base + from, len); | 913 | memcpy_fromio(buf, cqspi->ahb_base + from, len); |
| 913 | return 0; | 914 | return 0; |
| 914 | } | 915 | } |
| 915 | 916 | ||
| 916 | dma_dst = dma_map_single(dev, buf, len, DMA_FROM_DEVICE); | 917 | ddev = cqspi->rx_chan->device->dev; |
| 917 | if (dma_mapping_error(dev, dma_dst)) { | 918 | dma_dst = dma_map_single(ddev, buf, len, DMA_FROM_DEVICE); |
| 919 | if (dma_mapping_error(ddev, dma_dst)) { | ||
| 918 | dev_err(dev, "dma mapping failed\n"); | 920 | dev_err(dev, "dma mapping failed\n"); |
| 919 | return -ENOMEM; | 921 | return -ENOMEM; |
| 920 | } | 922 | } |
| @@ -948,7 +950,7 @@ static int cqspi_direct_read_execute(struct cqspi_flash_pdata *f_pdata, · 27 unmodified lines | |||
| 948 | } | 950 | } |
| 949 | 951 | ||
| 950 | err_unmap: | 952 | err_unmap: |
| 951 | dma_unmap_single(dev, dma_dst, len, DMA_FROM_DEVICE); | 953 | dma_unmap_single(ddev, dma_dst, len, DMA_FROM_DEVICE); |
| 952 | 954 | ||
| 953 | return ret; | 955 | return ret; |
| 954 | } | 956 | } |
| @@ -1128,8 +1130,17 @@ static int cqspi_request_mmap_dma(struct cqspi_st *cqspi) · 173 unmodified lines | |||
| 1128 | return 0; | 1130 | return 0; |
| 1129 | } | 1131 | } |
| 1130 | 1132 | ||
| 1133 | static const char *cqspi_get_name(struct spi_mem *mem) | ||
| 1134 | { | ||
| 1135 | struct cqspi_st *cqspi = spi_master_get_devdata(mem->spi->master); | ||
| 1136 | struct device *dev = &cqspi->pdev->dev; | ||
| 1137 | |||
| 1138 | return devm_kasprintf(dev, GFP_KERNEL, "%s.%d", dev_name(dev), mem->spi->chip_select); | ||
| 1139 | } | ||
| 1140 | |||
| 1131 | static const struct spi_controller_mem_ops cqspi_mem_ops = { | 1141 | static const struct spi_controller_mem_ops cqspi_mem_ops = { |
| 1132 | .exec_op = cqspi_exec_mem_op, | 1142 | .exec_op = cqspi_exec_mem_op, |
| 1143 | .get_name = cqspi_get_name, | ||
| 1133 | }; | 1144 | }; |
| 1134 | 1145 | ||
| 1135 | static int cqspi_setup_flash(struct cqspi_st *cqspi) | 1146 | static int cqspi_setup_flash(struct cqspi_st *cqspi) |
| @@ -90,7 +90,7 @@ static struct spi_test spi_tests[] = { · 89 unmodified lines | |||
| 90 | { | 90 | { |
| 91 | .description = "tx/rx-transfer - crossing PAGE_SIZE", | 91 | .description = "tx/rx-transfer - crossing PAGE_SIZE", |
| 92 | .fill_option = FILL_COUNT_8, | 92 | .fill_option = FILL_COUNT_8, |
| 93 | .iterate_len = { ITERATE_MAX_LEN }, | 93 | .iterate_len = { ITERATE_LEN }, |
| 94 | .iterate_tx_align = ITERATE_ALIGN, | 94 | .iterate_tx_align = ITERATE_ALIGN, |
| 95 | .iterate_rx_align = ITERATE_ALIGN, | 95 | .iterate_rx_align = ITERATE_ALIGN, |
| 96 | .transfer_count = 1, | 96 | .transfer_count = 1, |
| @@ -936,7 +936,11 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id) · 935 unmodified lines | |||
| 936 | } | 936 | } |
| 937 | 937 | ||
| 938 | if (sr & STM32H7_SPI_SR_SUSP) { | 938 | if (sr & STM32H7_SPI_SR_SUSP) { |
| 939 | dev_warn(spi->dev, "Communication suspended\n"); | 939 | static DEFINE_RATELIMIT_STATE(rs, |
| 940 | DEFAULT_RATELIMIT_INTERVAL * 10, | ||
| 941 | 1); | ||
| 942 | if (__ratelimit(&rs)) | ||
| 943 | dev_dbg_ratelimited(spi->dev, "Communication suspended\n"); | ||
| 940 | if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0))) | 944 | if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0))) |
| 941 | stm32h7_spi_read_rxfifo(spi, false); | 945 | stm32h7_spi_read_rxfifo(spi, false); |
| 942 | /* | 946 | /* |
| @@ -2060,7 +2064,7 @@ static int stm32_spi_resume(struct device *dev) · 1117 unmodified lines | |||
| 2060 | } | 2064 | } |
| 2061 | 2065 | ||
| 2062 | ret = pm_runtime_get_sync(dev); | 2066 | ret = pm_runtime_get_sync(dev); |
| 2063 | if (ret) { | 2067 | if (ret < 0) { |
| 2064 | dev_err(dev, "Unable to power device:%d\n", ret); | 2068 | dev_err(dev, "Unable to power device:%d\n", ret); |
| 2065 | return ret; | 2069 | return ret; |
| 2066 | } | 2070 | } |
| @@ -1327,8 +1327,6 @@ out: · 1326 unmodified lines | |||
| 1327 | if (msg->status && ctlr->handle_err) | 1327 | if (msg->status && ctlr->handle_err) |
| 1328 | ctlr->handle_err(ctlr, msg); | 1328 | ctlr->handle_err(ctlr, msg); |
| 1329 | 1329 | ||
| 1330 | spi_res_release(ctlr, msg); | ||
| 1331 | |||
| 1332 | spi_finalize_current_message(ctlr); | 1330 | spi_finalize_current_message(ctlr); |
| 1333 | 1331 | ||
| 1334 | return ret; | 1332 | return ret; |
| @@ -1725,6 +1723,13 @@ void spi_finalize_current_message(struct spi_controller *ctlr) · 390 unmodified lines | |||
| 1725 | 1723 | ||
| 1726 | spi_unmap_msg(ctlr, mesg); | 1724 | spi_unmap_msg(ctlr, mesg); |
| 1727 | 1725 | ||
| 1726 | /* In the prepare_messages callback the spi bus has the opportunity to | ||
| 1727 | * split a transfer to smaller chunks. | ||
| 1728 | * Release splited transfers here since spi_map_msg is done on the | ||
| 1729 | * splited transfers. | ||
| 1730 | */ | ||
| 1731 | spi_res_release(ctlr, mesg); | ||
| 1732 | |||
| 1728 | if (ctlr->cur_msg_prepared && ctlr->unprepare_message) { | 1733 | if (ctlr->cur_msg_prepared && ctlr->unprepare_message) { |
| 1729 | ret = ctlr->unprepare_message(ctlr, mesg); | 1734 | ret = ctlr->unprepare_message(ctlr, mesg); |
| 1730 | if (ret) { | 1735 | if (ret) { |
| @@ -173,8 +173,7 @@ static int gbaudio_remove_controls(struct snd_card *card, struct device *dev, · 172 unmodified lines | |||
| 173 | id.index = control->index; | 173 | id.index = control->index; |
| 174 | kctl = snd_ctl_find_id(card, &id); | 174 | kctl = snd_ctl_find_id(card, &id); |
| 175 | if (!kctl) { | 175 | if (!kctl) { |
| 176 | dev_err(dev, "%d: Failed to find %s\n", err, | 176 | dev_err(dev, "Failed to find %s\n", control->name); |
| 177 | control->name); | ||
| 178 | continue; | 177 | continue; |
| 179 | } | 178 | } |
| 180 | err = snd_ctl_remove(card, kctl); | 179 | err = snd_ctl_remove(card, kctl); |
| @@ -456,6 +456,15 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 455 unmodified lines | |||
| 456 | val = ucontrol->value.integer.value[0] & mask; | 456 | val = ucontrol->value.integer.value[0] & mask; |
| 457 | connect = !!val; | 457 | connect = !!val; |
| 458 | 458 | ||
| 459 | ret = gb_pm_runtime_get_sync(bundle); | ||
| 460 | if (ret) | ||
| 461 | return ret; | ||
| 462 | |||
| 463 | ret = gb_audio_gb_get_control(module->mgmt_connection, data->ctl_id, | ||
| 464 | GB_AUDIO_INVALID_INDEX, &gbvalue); | ||
| 465 | if (ret) | ||
| 466 | goto exit; | ||
| 467 | |||
| 459 | /* update ucontrol */ | 468 | /* update ucontrol */ |
| 460 | if (gbvalue.value.integer_value[0] != val) { | 469 | if (gbvalue.value.integer_value[0] != val) { |
| 461 | for (wi = 0; wi < wlist->num_widgets; wi++) { | 470 | for (wi = 0; wi < wlist->num_widgets; wi++) { |
| @@ -466,25 +475,17 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 466 | gbvalue.value.integer_value[0] = | 475 | gbvalue.value.integer_value[0] = |
| 467 | cpu_to_le32(ucontrol->value.integer.value[0]); | 476 | cpu_to_le32(ucontrol->value.integer.value[0]); |
| 468 | 477 | ||
| 469 | ret = gb_pm_runtime_get_sync(bundle); | ||
| 470 | if (ret) | ||
| 471 | return ret; | ||
| 472 | |||
| 473 | ret = gb_audio_gb_set_control(module->mgmt_connection, | 478 | ret = gb_audio_gb_set_control(module->mgmt_connection, |
| 474 | data->ctl_id, | 479 | data->ctl_id, |
| 475 | GB_AUDIO_INVALID_INDEX, &gbvalue); | 480 | GB_AUDIO_INVALID_INDEX, &gbvalue); |
| 476 | |||
| 477 | gb_pm_runtime_put_autosuspend(bundle); | ||
| 478 | |||
| 479 | if (ret) { | ||
| 480 | dev_err_ratelimited(codec_dev, | ||
| 481 | "%d:Error in %s for %s\n", ret, | ||
| 482 | __func__, kcontrol->id.name); | ||
| 483 | return ret; | ||
| 484 | } | ||
| 485 | } | 481 | } |
| 486 | 482 | ||
| 487 | return 0; | 483 | exit: |
| 484 | gb_pm_runtime_put_autosuspend(bundle); | ||
| 485 | if (ret) | ||
| 486 | dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret, | ||
| 487 | __func__, kcontrol->id.name); | ||
| 488 | return ret; | ||
| 488 | } | 489 | } |
| 489 | 490 | ||
| 490 | #define SOC_DAPM_MIXER_GB(xname, kcount, data) \ | 491 | #define SOC_DAPM_MIXER_GB(xname, kcount, data) \ |
| @@ -199,6 +199,7 @@ static int cedrus_request_validate(struct media_request *req) · 198 unmodified lines | |||
| 199 | struct v4l2_ctrl *ctrl_test; | 199 | struct v4l2_ctrl *ctrl_test; |
| 200 | unsigned int count; | 200 | unsigned int count; |
| 201 | unsigned int i; | 201 | unsigned int i; |
| 202 | int ret = 0; | ||
| 202 | 203 | ||
| 203 | list_for_each_entry(obj, &req->objects, list) { | 204 | list_for_each_entry(obj, &req->objects, list) { |
| 204 | struct vb2_buffer *vb; | 205 | struct vb2_buffer *vb; |
| @@ -243,12 +244,16 @@ static int cedrus_request_validate(struct media_request *req) · 38 unmodified lines | |||
| 243 | if (!ctrl_test) { | 244 | if (!ctrl_test) { |
| 244 | v4l2_info(&ctx->dev->v4l2_dev, | 245 | v4l2_info(&ctx->dev->v4l2_dev, |
| 245 | "Missing required codec control\n"); | 246 | "Missing required codec control\n"); |
| 246 | return -ENOENT; | 247 | ret = -ENOENT; |
| 248 | break; | ||
| 247 | } | 249 | } |
| 248 | } | 250 | } |
| 249 | 251 | ||
| 250 | v4l2_ctrl_request_hdl_put(hdl); | 252 | v4l2_ctrl_request_hdl_put(hdl); |
| 251 | 253 | ||
| 254 | if (ret) | ||
| 255 | return ret; | ||
| 256 | |||
| 252 | return vb2_request_validate(req); | 257 | return vb2_request_validate(req); |
| 253 | } | 258 | } |
| 254 | 259 | ||
| @@ -524,13 +524,8 @@ static void hfa384x_usb_defer(struct work_struct *data) · 523 unmodified lines | |||
| 524 | */ | 524 | */ |
| 525 | void hfa384x_create(struct hfa384x *hw, struct usb_device *usb) | 525 | void hfa384x_create(struct hfa384x *hw, struct usb_device *usb) |
| 526 | { | 526 | { |
| 527 | memset(hw, 0, sizeof(*hw)); | ||
| 528 | hw->usb = usb; | 527 | hw->usb = usb; |
| 529 | 528 | ||
| 530 | /* set up the endpoints */ | ||
| 531 | hw->endp_in = usb_rcvbulkpipe(usb, 1); | ||
| 532 | hw->endp_out = usb_sndbulkpipe(usb, 2); | ||
| 533 | |||
| 534 | /* Set up the waitq */ | 529 | /* Set up the waitq */ |
| 535 | init_waitqueue_head(&hw->cmdq); | 530 | init_waitqueue_head(&hw->cmdq); |
| 536 | 531 | ||
| @@ -61,23 +61,14 @@ static int prism2sta_probe_usb(struct usb_interface *interface, · 60 unmodified lines | |||
| 61 | const struct usb_device_id *id) | 61 | const struct usb_device_id *id) |
| 62 | { | 62 | { |
| 63 | struct usb_device *dev; | 63 | struct usb_device *dev; |
| 64 | const struct usb_endpoint_descriptor *epd; | 64 | struct usb_endpoint_descriptor *bulk_in, *bulk_out; |
| 65 | const struct usb_host_interface *iface_desc = interface->cur_altsetting; | 65 | struct usb_host_interface *iface_desc = interface->cur_altsetting; |
| 66 | struct wlandevice *wlandev = NULL; | 66 | struct wlandevice *wlandev = NULL; |
| 67 | struct hfa384x *hw = NULL; | 67 | struct hfa384x *hw = NULL; |
| 68 | int result = 0; | 68 | int result = 0; |
| 69 | 69 | ||
| 70 | if (iface_desc->desc.bNumEndpoints != 2) { | 70 | result = usb_find_common_endpoints(iface_desc, &bulk_in, &bulk_out, NULL, NULL); |
| 71 | result = -ENODEV; | 71 | if (result) |
| 72 | goto failed; | ||
| 73 | } | ||
| 74 | |||
| 75 | result = -EINVAL; | ||
| 76 | epd = &iface_desc->endpoint[1].desc; | ||
| 77 | if (!usb_endpoint_is_bulk_in(epd)) | ||
| 78 | goto failed; | ||
| 79 | epd = &iface_desc->endpoint[2].desc; | ||
| 80 | if (!usb_endpoint_is_bulk_out(epd)) | ||
| 81 | goto failed; | 72 | goto failed; |
| 82 | 73 | ||
| 83 | dev = interface_to_usbdev(interface); | 74 | dev = interface_to_usbdev(interface); |
| @@ -96,6 +87,8 @@ static int prism2sta_probe_usb(struct usb_interface *interface, · 12 unmodified lines | |||
| 96 | } | 87 | } |
| 97 | 88 | ||
| 98 | /* Initialize the hw data */ | 89 | /* Initialize the hw data */ |
| 90 | hw->endp_in = usb_rcvbulkpipe(dev, bulk_in->bEndpointAddress); | ||
| 91 | hw->endp_out = usb_sndbulkpipe(dev, bulk_out->bEndpointAddress); | ||
| 99 | hfa384x_create(hw, dev); | 92 | hfa384x_create(hw, dev); |
| 100 | hw->wlandev = wlandev; | 93 | hw->wlandev = wlandev; |
| 101 | 94 | ||
| @@ -1389,14 +1389,27 @@ static u32 iscsit_do_crypto_hash_sg( · 1388 unmodified lines | |||
| 1389 | sg = cmd->first_data_sg; | 1389 | sg = cmd->first_data_sg; |
| 1390 | page_off = cmd->first_data_sg_off; | 1390 | page_off = cmd->first_data_sg_off; |
| 1391 | 1391 | ||
| 1392 | if (data_length && page_off) { | ||
| 1393 | struct scatterlist first_sg; | ||
| 1394 | u32 len = min_t(u32, data_length, sg->length - page_off); | ||
| 1395 | |||
| 1396 | sg_init_table(&first_sg, 1); | ||
| 1397 | sg_set_page(&first_sg, sg_page(sg), len, sg->offset + page_off); | ||
| 1398 | |||
| 1399 | ahash_request_set_crypt(hash, &first_sg, NULL, len); | ||
| 1400 | crypto_ahash_update(hash); | ||
| 1401 | |||
| 1402 | data_length -= len; | ||
| 1403 | sg = sg_next(sg); | ||
| 1404 | } | ||
| 1405 | |||
| 1392 | while (data_length) { | 1406 | while (data_length) { |
| 1393 | u32 cur_len = min_t(u32, data_length, (sg->length - page_off)); | 1407 | u32 cur_len = min_t(u32, data_length, sg->length); |
| 1394 | 1408 | ||
| 1395 | ahash_request_set_crypt(hash, sg, NULL, cur_len); | 1409 | ahash_request_set_crypt(hash, sg, NULL, cur_len); |
| 1396 | crypto_ahash_update(hash); | 1410 | crypto_ahash_update(hash); |
| 1397 | 1411 | ||
| 1398 | data_length -= cur_len; | 1412 | data_length -= cur_len; |
| 1399 | page_off = 0; | ||
| 1400 | /* iscsit_map_iovec has already checked for invalid sg pointers */ | 1413 | /* iscsit_map_iovec has already checked for invalid sg pointers */ |
| 1401 | sg = sg_next(sg); | 1414 | sg = sg_next(sg); |
| 1402 | } | 1415 | } |
| @@ -1149,7 +1149,7 @@ void iscsit_free_conn(struct iscsi_conn *conn) · 1148 unmodified lines | |||
| 1149 | } | 1149 | } |
| 1150 | 1150 | ||
| 1151 | void iscsi_target_login_sess_out(struct iscsi_conn *conn, | 1151 | void iscsi_target_login_sess_out(struct iscsi_conn *conn, |
| 1152 | struct iscsi_np *np, bool zero_tsih, bool new_sess) | 1152 | bool zero_tsih, bool new_sess) |
| 1153 | { | 1153 | { |
| 1154 | if (!new_sess) | 1154 | if (!new_sess) |
| 1155 | goto old_sess_out; | 1155 | goto old_sess_out; |
| @@ -1167,7 +1167,6 @@ void iscsi_target_login_sess_out(struct iscsi_conn *conn, · 11 unmodified lines | |||
| 1167 | conn->sess = NULL; | 1167 | conn->sess = NULL; |
| 1168 | 1168 | ||
| 1169 | old_sess_out: | 1169 | old_sess_out: |
| 1170 | iscsi_stop_login_thread_timer(np); | ||
| 1171 | /* | 1170 | /* |
| 1172 | * If login negotiation fails check if the Time2Retain timer | 1171 | * If login negotiation fails check if the Time2Retain timer |
| 1173 | * needs to be restarted. | 1172 | * needs to be restarted. |
| @@ -1407,8 +1406,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) · 233 unmodified lines | |||
| 1407 | new_sess_out: | 1406 | new_sess_out: |
| 1408 | new_sess = true; | 1407 | new_sess = true; |
| 1409 | old_sess_out: | 1408 | old_sess_out: |
| 1409 | iscsi_stop_login_thread_timer(np); | ||
| 1410 | tpg_np = conn->tpg_np; | 1410 | tpg_np = conn->tpg_np; |
| 1411 | iscsi_target_login_sess_out(conn, np, zero_tsih, new_sess); | 1411 | iscsi_target_login_sess_out(conn, zero_tsih, new_sess); |
| 1412 | new_sess = false; | 1412 | new_sess = false; |
| 1413 | 1413 | ||
| 1414 | if (tpg) { | 1414 | if (tpg) { |
| @@ -22,8 +22,7 @@ extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32); · 21 unmodified lines | |||
| 22 | extern void iscsit_free_conn(struct iscsi_conn *); | 22 | extern void iscsit_free_conn(struct iscsi_conn *); |
| 23 | extern int iscsit_start_kthreads(struct iscsi_conn *); | 23 | extern int iscsit_start_kthreads(struct iscsi_conn *); |
| 24 | extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8); | 24 | extern void iscsi_post_login_handler(struct iscsi_np *, struct iscsi_conn *, u8); |
| 25 | extern void iscsi_target_login_sess_out(struct iscsi_conn *, struct iscsi_np *, | 25 | extern void iscsi_target_login_sess_out(struct iscsi_conn *, bool, bool); |
| 26 | bool, bool); | ||
| 27 | extern int iscsi_target_login_thread(void *); | 26 | extern int iscsi_target_login_thread(void *); |
| 28 | extern void iscsi_handle_login_thread_timeout(struct timer_list *t); | 27 | extern void iscsi_handle_login_thread_timeout(struct timer_list *t); |
| 29 | 28 | ||
| @@ -535,12 +535,11 @@ static bool iscsi_target_sk_check_and_clear(struct iscsi_conn *conn, unsigned in · 534 unmodified lines | |||
| 535 | 535 | ||
| 536 | static void iscsi_target_login_drop(struct iscsi_conn *conn, struct iscsi_login *login) | 536 | static void iscsi_target_login_drop(struct iscsi_conn *conn, struct iscsi_login *login) |
| 537 | { | 537 | { |
| 538 | struct iscsi_np *np = login->np; | ||
| 539 | bool zero_tsih = login->zero_tsih; | 538 | bool zero_tsih = login->zero_tsih; |
| 540 | 539 | ||
| 541 | iscsi_remove_failed_auth_entry(conn); | 540 | iscsi_remove_failed_auth_entry(conn); |
| 542 | iscsi_target_nego_release(conn); | 541 | iscsi_target_nego_release(conn); |
| 543 | iscsi_target_login_sess_out(conn, np, zero_tsih, true); | 542 | iscsi_target_login_sess_out(conn, zero_tsih, true); |
| 544 | } | 543 | } |
| 545 | 544 | ||
| 546 | struct conn_timeout { | 545 | struct conn_timeout { |
| @@ -1,6 +1,6 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2011-2015, 2017, The Linux Foundation. All rights reserved. | 3 | * Copyright (c) 2011-2015, 2017, 2020, The Linux Foundation. All rights reserved. |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #include <linux/bitops.h> | 6 | #include <linux/bitops.h> |
| @@ -191,7 +191,7 @@ static int qpnp_tm_get_temp(void *data, int *temp) · 184 unmodified lines | |||
| 191 | chip->temp = mili_celsius; | 191 | chip->temp = mili_celsius; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | *temp = chip->temp < 0 ? 0 : chip->temp; | 194 | *temp = chip->temp; |
| 195 | 195 | ||
| 196 | return 0; | 196 | return 0; |
| 197 | } | 197 | } |
| @@ -1516,7 +1516,7 @@ EXPORT_SYMBOL_GPL(thermal_zone_device_register); · 1515 unmodified lines | |||
| 1516 | */ | 1516 | */ |
| 1517 | void thermal_zone_device_unregister(struct thermal_zone_device *tz) | 1517 | void thermal_zone_device_unregister(struct thermal_zone_device *tz) |
| 1518 | { | 1518 | { |
| 1519 | int i; | 1519 | int i, tz_id; |
| 1520 | const struct thermal_zone_params *tzp; | 1520 | const struct thermal_zone_params *tzp; |
| 1521 | struct thermal_cooling_device *cdev; | 1521 | struct thermal_cooling_device *cdev; |
| 1522 | struct thermal_zone_device *pos = NULL; | 1522 | struct thermal_zone_device *pos = NULL; |
| @@ -1525,6 +1525,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) · 2 unmodified lines | |||
| 1525 | return; | 1525 | return; |
| 1526 | 1526 | ||
| 1527 | tzp = tz->tzp; | 1527 | tzp = tz->tzp; |
| 1528 | tz_id = tz->id; | ||
| 1528 | 1529 | ||
| 1529 | mutex_lock(&thermal_list_lock); | 1530 | mutex_lock(&thermal_list_lock); |
| 1530 | list_for_each_entry(pos, &thermal_tz_list, node) | 1531 | list_for_each_entry(pos, &thermal_tz_list, node) |
| @@ -1567,7 +1568,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) · 36 unmodified lines | |||
| 1567 | mutex_destroy(&tz->lock); | 1568 | mutex_destroy(&tz->lock); |
| 1568 | device_unregister(&tz->device); | 1569 | device_unregister(&tz->device); |
| 1569 | 1570 | ||
| 1570 | thermal_notify_tz_delete(tz->id); | 1571 | thermal_notify_tz_delete(tz_id); |
| 1571 | } | 1572 | } |
| 1572 | EXPORT_SYMBOL_GPL(thermal_zone_device_unregister); | 1573 | EXPORT_SYMBOL_GPL(thermal_zone_device_unregister); |
| 1573 | 1574 | ||
| @@ -37,20 +37,21 @@ static struct temp_sensor_data omap4430_mpu_temp_sensor_data = { · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | /* | 38 | /* |
| 39 | * Temperature values in milli degree celsius | 39 | * Temperature values in milli degree celsius |
| 40 | * ADC code values from 530 to 923 | 40 | * ADC code values from 13 to 107, see TRM |
| 41 | * "18.4.10.2.3 ADC Codes Versus Temperature". | ||
| 41 | */ | 42 | */ |
| 42 | static const int | 43 | static const int |
| 43 | omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = { | 44 | omap4430_adc_to_temp[OMAP4430_ADC_END_VALUE - OMAP4430_ADC_START_VALUE + 1] = { |
| 44 | -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, -22000, | 45 | -40000, -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, |
| 45 | -20000, -18000, -17000, -15000, -13000, -12000, -10000, -8000, -6000, | 46 | -22000, -20000, -18500, -17000, -15000, -13500, -12000, -10000, -8000, |
| 46 | -5000, -3000, -1000, 0, 2000, 3000, 5000, 6000, 8000, 10000, 12000, | 47 | -6500, -5000, -3500, -1500, 0, 2000, 3500, 5000, 6500, 8500, 10000, |
| 47 | 13000, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28000, 30000, | 48 | 12000, 13500, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28500, |
| 48 | 32000, 33000, 35000, 37000, 38000, 40000, 42000, 43000, 45000, 47000, | 49 | 30000, 32000, 33500, 35000, 37000, 38500, 40000, 42000, 43500, 45000, |
| 49 | 48000, 50000, 52000, 53000, 55000, 57000, 58000, 60000, 62000, 64000, | 50 | 47000, 48500, 50000, 52000, 53500, 55000, 57000, 58500, 60000, 62000, |
| 50 | 66000, 68000, 70000, 71000, 73000, 75000, 77000, 78000, 80000, 82000, | 51 | 64000, 66000, 68000, 70000, 71500, 73500, 75000, 77000, 78500, 80000, |
| 51 | 83000, 85000, 87000, 88000, 90000, 92000, 93000, 95000, 97000, 98000, | 52 | 82000, 83500, 85000, 87000, 88500, 90000, 92000, 93500, 95000, 97000, |
| 52 | 100000, 102000, 103000, 105000, 107000, 109000, 111000, 113000, 115000, | 53 | 98500, 100000, 102000, 103500, 105000, 107000, 109000, 111000, 113000, |
| 53 | 117000, 118000, 120000, 122000, 123000, | 54 | 115000, 117000, 118500, 120000, 122000, 123500, 125000, |
| 54 | }; | 55 | }; |
| 55 | 56 | ||
| 56 | /* OMAP4430 data */ | 57 | /* OMAP4430 data */ |
| @@ -53,9 +53,13 @@ · 52 unmodified lines | |||
| 53 | * and thresholds for OMAP4430. | 53 | * and thresholds for OMAP4430. |
| 54 | */ | 54 | */ |
| 55 | 55 | ||
| 56 | /* ADC conversion table limits */ | 56 | /* |
| 57 | #define OMAP4430_ADC_START_VALUE 0 | 57 | * ADC conversion table limits. Ignore values outside the TRM listed |
| 58 | #define OMAP4430_ADC_END_VALUE 127 | 58 | * range to avoid bogus thermal shutdowns. See omap4430 TRM chapter |
| 59 | * "18.4.10.2.3 ADC Codes Versus Temperature". | ||
| 60 | */ | ||
| 61 | #define OMAP4430_ADC_START_VALUE 13 | ||
| 62 | #define OMAP4430_ADC_END_VALUE 107 | ||
| 59 | /* bandgap clock limits (no control on 4430) */ | 63 | /* bandgap clock limits (no control on 4430) */ |
| 60 | #define OMAP4430_MAX_FREQ 32768 | 64 | #define OMAP4430_MAX_FREQ 32768 |
| 61 | #define OMAP4430_MIN_FREQ 32768 | 65 | #define OMAP4430_MIN_FREQ 32768 |
| @@ -684,6 +684,7 @@ static int tb_init_port(struct tb_port *port) · 683 unmodified lines | |||
| 684 | if (res == -ENODEV) { | 684 | if (res == -ENODEV) { |
| 685 | tb_dbg(port->sw->tb, " Port %d: not implemented\n", | 685 | tb_dbg(port->sw->tb, " Port %d: not implemented\n", |
| 686 | port->port); | 686 | port->port); |
| 687 | port->disabled = true; | ||
| 687 | return 0; | 688 | return 0; |
| 688 | } | 689 | } |
| 689 | return res; | 690 | return res; |
| @@ -186,7 +186,7 @@ struct tb_switch { · 185 unmodified lines | |||
| 186 | * @cap_adap: Offset of the adapter specific capability (%0 if not present) | 186 | * @cap_adap: Offset of the adapter specific capability (%0 if not present) |
| 187 | * @cap_usb4: Offset to the USB4 port capability (%0 if not present) | 187 | * @cap_usb4: Offset to the USB4 port capability (%0 if not present) |
| 188 | * @port: Port number on switch | 188 | * @port: Port number on switch |
| 189 | * @disabled: Disabled by eeprom | 189 | * @disabled: Disabled by eeprom or enabled but not implemented |
| 190 | * @bonded: true if the port is bonded (two lanes combined as one) | 190 | * @bonded: true if the port is bonded (two lanes combined as one) |
| 191 | * @dual_link_port: If the switch is connected using two ports, points | 191 | * @dual_link_port: If the switch is connected using two ports, points |
| 192 | * to the other port. | 192 | * to the other port. |
| @@ -951,10 +951,18 @@ static void tb_usb3_reclaim_available_bandwidth(struct tb_tunnel *tunnel, · 950 unmodified lines | |||
| 951 | int ret, max_rate, allocate_up, allocate_down; | 951 | int ret, max_rate, allocate_up, allocate_down; |
| 952 | 952 | ||
| 953 | ret = usb4_usb3_port_actual_link_rate(tunnel->src_port); | 953 | ret = usb4_usb3_port_actual_link_rate(tunnel->src_port); |
| 954 | if (ret <= 0) { | 954 | if (ret < 0) { |
| 955 | tb_tunnel_warn(tunnel, "tunnel is not up\n"); | 955 | tb_tunnel_warn(tunnel, "failed to read actual link rate\n"); |
| 956 | return; | 956 | return; |
| 957 | } else if (!ret) { | ||
| 958 | /* Use maximum link rate if the link valid is not set */ | ||
| 959 | ret = usb4_usb3_port_max_link_rate(tunnel->src_port); | ||
| 960 | if (ret < 0) { | ||
| 961 | tb_tunnel_warn(tunnel, "failed to read maximum link rate\n"); | ||
| 962 | return; | ||
| 963 | } | ||
| 957 | } | 964 | } |
| 965 | |||
| 958 | /* | 966 | /* |
| 959 | * 90% of the max rate can be allocated for isochronous | 967 | * 90% of the max rate can be allocated for isochronous |
| 960 | * transfers. | 968 | * transfers. |
| @@ -1205,6 +1205,34 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, · 1204 unmodified lines | |||
| 1205 | } | 1205 | } |
| 1206 | } | 1206 | } |
| 1207 | 1207 | ||
| 1208 | /* | ||
| 1209 | * usb_disable_device_endpoints -- Disable all endpoints for a device | ||
| 1210 | * @dev: the device whose endpoints are being disabled | ||
| 1211 | * @skip_ep0: 0 to disable endpoint 0, 1 to skip it. | ||
| 1212 | */ | ||
| 1213 | static void usb_disable_device_endpoints(struct usb_device *dev, int skip_ep0) | ||
| 1214 | { | ||
| 1215 | struct usb_hcd *hcd = bus_to_hcd(dev->bus); | ||
| 1216 | int i; | ||
| 1217 | |||
| 1218 | if (hcd->driver->check_bandwidth) { | ||
| 1219 | /* First pass: Cancel URBs, leave endpoint pointers intact. */ | ||
| 1220 | for (i = skip_ep0; i < 16; ++i) { | ||
| 1221 | usb_disable_endpoint(dev, i, false); | ||
| 1222 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); | ||
| 1223 | } | ||
| 1224 | /* Remove endpoints from the host controller internal state */ | ||
| 1225 | mutex_lock(hcd->bandwidth_mutex); | ||
| 1226 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | ||
| 1227 | mutex_unlock(hcd->bandwidth_mutex); | ||
| 1228 | } | ||
| 1229 | /* Second pass: remove endpoint pointers */ | ||
| 1230 | for (i = skip_ep0; i < 16; ++i) { | ||
| 1231 | usb_disable_endpoint(dev, i, true); | ||
| 1232 | usb_disable_endpoint(dev, i + USB_DIR_IN, true); | ||
| 1233 | } | ||
| 1234 | } | ||
| 1235 | |||
| 1208 | /** | 1236 | /** |
| 1209 | * usb_disable_device - Disable all the endpoints for a USB device | 1237 | * usb_disable_device - Disable all the endpoints for a USB device |
| 1210 | * @dev: the device whose endpoints are being disabled | 1238 | * @dev: the device whose endpoints are being disabled |
| @@ -1218,7 +1246,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, · 7 unmodified lines | |||
| 1218 | void usb_disable_device(struct usb_device *dev, int skip_ep0) | 1246 | void usb_disable_device(struct usb_device *dev, int skip_ep0) |
| 1219 | { | 1247 | { |
| 1220 | int i; | 1248 | int i; |
| 1221 | struct usb_hcd *hcd = bus_to_hcd(dev->bus); | ||
| 1222 | 1249 | ||
| 1223 | /* getting rid of interfaces will disconnect | 1250 | /* getting rid of interfaces will disconnect |
| 1224 | * any drivers bound to them (a key side effect) | 1251 | * any drivers bound to them (a key side effect) |
| @@ -1264,22 +1291,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) · 39 unmodified lines | |||
| 1264 | 1291 | ||
| 1265 | dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, | 1292 | dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, |
| 1266 | skip_ep0 ? "non-ep0" : "all"); | 1293 | skip_ep0 ? "non-ep0" : "all"); |
| 1267 | if (hcd->driver->check_bandwidth) { | 1294 | |
| 1268 | /* First pass: Cancel URBs, leave endpoint pointers intact. */ | 1295 | usb_disable_device_endpoints(dev, skip_ep0); |
| 1269 | for (i = skip_ep0; i < 16; ++i) { | ||
| 1270 | usb_disable_endpoint(dev, i, false); | ||
| 1271 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); | ||
| 1272 | } | ||
| 1273 | /* Remove endpoints from the host controller internal state */ | ||
| 1274 | mutex_lock(hcd->bandwidth_mutex); | ||
| 1275 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | ||
| 1276 | mutex_unlock(hcd->bandwidth_mutex); | ||
| 1277 | /* Second pass: remove endpoint pointers */ | ||
| 1278 | } | ||
| 1279 | for (i = skip_ep0; i < 16; ++i) { | ||
| 1280 | usb_disable_endpoint(dev, i, true); | ||
| 1281 | usb_disable_endpoint(dev, i + USB_DIR_IN, true); | ||
| 1282 | } | ||
| 1283 | } | 1296 | } |
| 1284 | 1297 | ||
| 1285 | /** | 1298 | /** |
| @@ -1522,6 +1535,9 @@ EXPORT_SYMBOL_GPL(usb_set_interface); · 236 unmodified lines | |||
| 1522 | * The caller must own the device lock. | 1535 | * The caller must own the device lock. |
| 1523 | * | 1536 | * |
| 1524 | * Return: Zero on success, else a negative error code. | 1537 | * Return: Zero on success, else a negative error code. |
| 1538 | * | ||
| 1539 | * If this routine fails the device will probably be in an unusable state | ||
| 1540 | * with endpoints disabled, and interfaces only partially enabled. | ||
| 1525 | */ | 1541 | */ |
| 1526 | int usb_reset_configuration(struct usb_device *dev) | 1542 | int usb_reset_configuration(struct usb_device *dev) |
| 1527 | { | 1543 | { |
| @@ -1537,10 +1553,7 @@ int usb_reset_configuration(struct usb_device *dev) · 9 unmodified lines | |||
| 1537 | * calls during probe() are fine | 1553 | * calls during probe() are fine |
| 1538 | */ | 1554 | */ |
| 1539 | 1555 | ||
| 1540 | for (i = 1; i < 16; ++i) { | 1556 | usb_disable_device_endpoints(dev, 1); /* skip ep0*/ |
| 1541 | usb_disable_endpoint(dev, i, true); | ||
| 1542 | usb_disable_endpoint(dev, i + USB_DIR_IN, true); | ||
| 1543 | } | ||
| 1544 | 1557 | ||
| 1545 | config = dev->actconfig; | 1558 | config = dev->actconfig; |
| 1546 | retval = 0; | 1559 | retval = 0; |
| @@ -1553,34 +1566,10 @@ int usb_reset_configuration(struct usb_device *dev) · 6 unmodified lines | |||
| 1553 | mutex_unlock(hcd->bandwidth_mutex); | 1566 | mutex_unlock(hcd->bandwidth_mutex); |
| 1554 | return -ENOMEM; | 1567 | return -ENOMEM; |
| 1555 | } | 1568 | } |
| 1556 | /* Make sure we have enough bandwidth for each alternate setting 0 */ | ||
| 1557 | for (i = 0; i < config->desc.bNumInterfaces; i++) { | ||
| 1558 | struct usb_interface *intf = config->interface[i]; | ||
| 1559 | struct usb_host_interface *alt; | ||
| 1560 | 1569 | ||
| 1561 | alt = usb_altnum_to_altsetting(intf, 0); | 1570 | /* xHCI adds all endpoints in usb_hcd_alloc_bandwidth */ |
| 1562 | if (!alt) | 1571 | retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL); |
| 1563 | alt = &intf->altsetting[0]; | ||
| 1564 | if (alt != intf->cur_altsetting) | ||
| 1565 | retval = usb_hcd_alloc_bandwidth(dev, NULL, | ||
| 1566 | intf->cur_altsetting, alt); | ||
| 1567 | if (retval < 0) | ||
| 1568 | break; | ||
| 1569 | } | ||
| 1570 | /* If not, reinstate the old alternate settings */ | ||
| 1571 | if (retval < 0) { | 1572 | if (retval < 0) { |
| 1572 | reset_old_alts: | ||
| 1573 | for (i--; i >= 0; i--) { | ||
| 1574 | struct usb_interface *intf = config->interface[i]; | ||
| 1575 | struct usb_host_interface *alt; | ||
| 1576 | |||
| 1577 | alt = usb_altnum_to_altsetting(intf, 0); | ||
| 1578 | if (!alt) | ||
| 1579 | alt = &intf->altsetting[0]; | ||
| 1580 | if (alt != intf->cur_altsetting) | ||
| 1581 | usb_hcd_alloc_bandwidth(dev, NULL, | ||
| 1582 | alt, intf->cur_altsetting); | ||
| 1583 | } | ||
| 1584 | usb_enable_lpm(dev); | 1573 | usb_enable_lpm(dev); |
| 1585 | mutex_unlock(hcd->bandwidth_mutex); | 1574 | mutex_unlock(hcd->bandwidth_mutex); |
| 1586 | return retval; | 1575 | return retval; |
| @@ -1589,8 +1578,12 @@ reset_old_alts: · 2 unmodified lines | |||
| 1589 | USB_REQ_SET_CONFIGURATION, 0, | 1578 | USB_REQ_SET_CONFIGURATION, 0, |
| 1590 | config->desc.bConfigurationValue, 0, | 1579 | config->desc.bConfigurationValue, 0, |
| 1591 | NULL, 0, USB_CTRL_SET_TIMEOUT); | 1580 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
| 1592 | if (retval < 0) | 1581 | if (retval < 0) { |
| 1593 | goto reset_old_alts; | 1582 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
| 1583 | usb_enable_lpm(dev); | ||
| 1584 | mutex_unlock(hcd->bandwidth_mutex); | ||
| 1585 | return retval; | ||
| 1586 | } | ||
| 1594 | mutex_unlock(hcd->bandwidth_mutex); | 1587 | mutex_unlock(hcd->bandwidth_mutex); |
| 1595 | 1588 | ||
| 1596 | /* re-init hc/hcd interface/endpoint state */ | 1589 | /* re-init hc/hcd interface/endpoint state */ |
| @@ -889,7 +889,11 @@ read_descriptors(struct file *filp, struct kobject *kobj, · 888 unmodified lines | |||
| 889 | size_t srclen, n; | 889 | size_t srclen, n; |
| 890 | int cfgno; | 890 | int cfgno; |
| 891 | void *src; | 891 | void *src; |
| 892 | int retval; | ||
| 892 | 893 | ||
| 894 | retval = usb_lock_device_interruptible(udev); | ||
| 895 | if (retval < 0) | ||
| 896 | return -EINTR; | ||
| 893 | /* The binary attribute begins with the device descriptor. | 897 | /* The binary attribute begins with the device descriptor. |
| 894 | * Following that are the raw descriptor entries for all the | 898 | * Following that are the raw descriptor entries for all the |
| 895 | * configurations (config plus subsidiary descriptors). | 899 | * configurations (config plus subsidiary descriptors). |
| @@ -914,6 +918,7 @@ read_descriptors(struct file *filp, struct kobject *kobj, · 18 unmodified lines | |||
| 914 | off -= srclen; | 918 | off -= srclen; |
| 915 | } | 919 | } |
| 916 | } | 920 | } |
| 921 | usb_unlock_device(udev); | ||
| 917 | return count - nleft; | 922 | return count - nleft; |
| 918 | } | 923 | } |
| 919 | 924 | ||
| @@ -737,13 +737,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 736 unmodified lines | |||
| 737 | goto err_disable_clks; | 737 | goto err_disable_clks; |
| 738 | } | 738 | } |
| 739 | 739 | ||
| 740 | ret = reset_control_deassert(priv->reset); | 740 | ret = reset_control_reset(priv->reset); |
| 741 | if (ret) | 741 | if (ret) |
| 742 | goto err_assert_reset; | 742 | goto err_disable_clks; |
| 743 | 743 | ||
| 744 | ret = dwc3_meson_g12a_get_phys(priv); | 744 | ret = dwc3_meson_g12a_get_phys(priv); |
| 745 | if (ret) | 745 | if (ret) |
| 746 | goto err_assert_reset; | 746 | goto err_disable_clks; |
| 747 | 747 | ||
| 748 | ret = priv->drvdata->setup_regmaps(priv, base); | 748 | ret = priv->drvdata->setup_regmaps(priv, base); |
| 749 | if (ret) | 749 | if (ret) |
| @@ -752,7 +752,7 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 2 unmodified lines | |||
| 752 | if (priv->vbus) { | 752 | if (priv->vbus) { |
| 753 | ret = regulator_enable(priv->vbus); | 753 | ret = regulator_enable(priv->vbus); |
| 754 | if (ret) | 754 | if (ret) |
| 755 | goto err_assert_reset; | 755 | goto err_disable_clks; |
| 756 | } | 756 | } |
| 757 | 757 | ||
| 758 | /* Get dr_mode */ | 758 | /* Get dr_mode */ |
| @@ -765,13 +765,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 6 unmodified lines | |||
| 765 | 765 | ||
| 766 | ret = priv->drvdata->usb_init(priv); | 766 | ret = priv->drvdata->usb_init(priv); |
| 767 | if (ret) | 767 | if (ret) |
| 768 | goto err_assert_reset; | 768 | goto err_disable_clks; |
| 769 | 769 | ||
| 770 | /* Init PHYs */ | 770 | /* Init PHYs */ |
| 771 | for (i = 0 ; i < PHY_COUNT ; ++i) { | 771 | for (i = 0 ; i < PHY_COUNT ; ++i) { |
| 772 | ret = phy_init(priv->phys[i]); | 772 | ret = phy_init(priv->phys[i]); |
| 773 | if (ret) | 773 | if (ret) |
| 774 | goto err_assert_reset; | 774 | goto err_disable_clks; |
| 775 | } | 775 | } |
| 776 | 776 | ||
| 777 | /* Set PHY Power */ | 777 | /* Set PHY Power */ |
| @@ -809,9 +809,6 @@ err_phys_exit: · 31 unmodified lines | |||
| 809 | for (i = 0 ; i < PHY_COUNT ; ++i) | 809 | for (i = 0 ; i < PHY_COUNT ; ++i) |
| 810 | phy_exit(priv->phys[i]); | 810 | phy_exit(priv->phys[i]); |
| 811 | 811 | ||
| 812 | err_assert_reset: | ||
| 813 | reset_control_assert(priv->reset); | ||
| 814 | |||
| 815 | err_disable_clks: | 812 | err_disable_clks: |
| 816 | clk_bulk_disable_unprepare(priv->drvdata->num_clks, | 813 | clk_bulk_disable_unprepare(priv->drvdata->num_clks, |
| 817 | priv->drvdata->clks); | 814 | priv->drvdata->clks); |
| @@ -713,6 +713,7 @@ static const struct usb_device_id id_table_combined[] = { · 712 unmodified lines | |||
| 713 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, | 713 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, |
| 714 | { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, | 714 | { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, |
| 715 | { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) }, | 715 | { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) }, |
| 716 | { USB_DEVICE(XSENS_VID, XSENS_MTIUSBCONVERTER_PID) }, | ||
| 716 | { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, | 717 | { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, |
| 717 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, | 718 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, |
| 718 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, | 719 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, |
| @@ -160,6 +160,7 @@ · 159 unmodified lines | |||
| 160 | #define XSENS_AWINDA_DONGLE_PID 0x0102 | 160 | #define XSENS_AWINDA_DONGLE_PID 0x0102 |
| 161 | #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ | 161 | #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ |
| 162 | #define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */ | 162 | #define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */ |
| 163 | #define XSENS_MTIUSBCONVERTER_PID 0x0301 /* MTi USB converter */ | ||
| 163 | #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ | 164 | #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ |
| 164 | 165 | ||
| 165 | /* Xsens devices using FTDI VID */ | 166 | /* Xsens devices using FTDI VID */ |
| @@ -1094,14 +1094,18 @@ static const struct usb_device_id option_ids[] = { · 1093 unmodified lines | |||
| 1094 | { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), | 1094 | { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), |
| 1095 | .driver_info = RSVD(1) | RSVD(3) }, | 1095 | .driver_info = RSVD(1) | RSVD(3) }, |
| 1096 | /* Quectel products using Quectel vendor ID */ | 1096 | /* Quectel products using Quectel vendor ID */ |
| 1097 | { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21), | 1097 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff), |
| 1098 | .driver_info = RSVD(4) }, | 1098 | .driver_info = NUMEP2 }, |
| 1099 | { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25), | 1099 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0, 0) }, |
| 1100 | .driver_info = RSVD(4) }, | 1100 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff), |
| 1101 | { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95), | 1101 | .driver_info = NUMEP2 }, |
| 1102 | .driver_info = RSVD(4) }, | 1102 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) }, |
| 1103 | { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), | 1103 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), |
| 1104 | .driver_info = RSVD(4) }, | 1104 | .driver_info = NUMEP2 }, |
| 1105 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0, 0) }, | ||
| 1106 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0xff, 0xff), | ||
| 1107 | .driver_info = NUMEP2 }, | ||
| 1108 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96, 0xff, 0, 0) }, | ||
| 1105 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), | 1109 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), |
| 1106 | .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, | 1110 | .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, |
| 1107 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, | 1111 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, |
| @@ -1819,6 +1823,8 @@ static const struct usb_device_id option_ids[] = { · 711 unmodified lines | |||
| 1819 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */ | 1823 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */ |
| 1820 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */ | 1824 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */ |
| 1821 | .driver_info = RSVD(7) }, | 1825 | .driver_info = RSVD(7) }, |
| 1826 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9205, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT+ECM mode */ | ||
| 1827 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9206, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT-only mode */ | ||
| 1822 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), | 1828 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), |
| 1823 | .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) }, | 1829 | .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) }, |
| 1824 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D), | 1830 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D), |
| @@ -61,14 +61,11 @@ enum { · 60 unmodified lines | |||
| 61 | 61 | ||
| 62 | #define PMC_USB_ALTMODE_ORI_SHIFT 1 | 62 | #define PMC_USB_ALTMODE_ORI_SHIFT 1 |
| 63 | #define PMC_USB_ALTMODE_UFP_SHIFT 3 | 63 | #define PMC_USB_ALTMODE_UFP_SHIFT 3 |
| 64 | #define PMC_USB_ALTMODE_ORI_AUX_SHIFT 4 | ||
| 65 | #define PMC_USB_ALTMODE_ORI_HSL_SHIFT 5 | ||
| 66 | 64 | ||
| 67 | /* DP specific Mode Data bits */ | 65 | /* DP specific Mode Data bits */ |
| 68 | #define PMC_USB_ALTMODE_DP_MODE_SHIFT 8 | 66 | #define PMC_USB_ALTMODE_DP_MODE_SHIFT 8 |
| 69 | 67 | ||
| 70 | /* TBT specific Mode Data bits */ | 68 | /* TBT specific Mode Data bits */ |
| 71 | #define PMC_USB_ALTMODE_HPD_HIGH BIT(14) | ||
| 72 | #define PMC_USB_ALTMODE_TBT_TYPE BIT(17) | 69 | #define PMC_USB_ALTMODE_TBT_TYPE BIT(17) |
| 73 | #define PMC_USB_ALTMODE_CABLE_TYPE BIT(18) | 70 | #define PMC_USB_ALTMODE_CABLE_TYPE BIT(18) |
| 74 | #define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20) | 71 | #define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20) |
| @@ -179,15 +176,9 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) · 104 unmodified lines | |||
| 179 | req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; | 176 | req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; |
| 180 | req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; | 177 | req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; |
| 181 | 178 | ||
| 182 | req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; | ||
| 183 | req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; | ||
| 184 | |||
| 185 | req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << | 179 | req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << |
| 186 | PMC_USB_ALTMODE_DP_MODE_SHIFT; | 180 | PMC_USB_ALTMODE_DP_MODE_SHIFT; |
| 187 | 181 | ||
| 188 | if (data->status & DP_STATUS_HPD_STATE) | ||
| 189 | req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH; | ||
| 190 | |||
| 191 | ret = pmc_usb_command(port, (void *)&req, sizeof(req)); | 182 | ret = pmc_usb_command(port, (void *)&req, sizeof(req)); |
| 192 | if (ret) | 183 | if (ret) |
| 193 | return ret; | 184 | return ret; |
| @@ -212,9 +203,6 @@ pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state) · 18 unmodified lines | |||
| 212 | req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; | 203 | req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; |
| 213 | req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; | 204 | req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; |
| 214 | 205 | ||
| 215 | req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; | ||
| 216 | req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; | ||
| 217 | |||
| 218 | if (TBT_ADAPTER(data->device_mode) == TBT_ADAPTER_TBT3) | 206 | if (TBT_ADAPTER(data->device_mode) == TBT_ADAPTER_TBT3) |
| 219 | req.mode_data |= PMC_USB_ALTMODE_TBT_TYPE; | 207 | req.mode_data |= PMC_USB_ALTMODE_TBT_TYPE; |
| 220 | 208 | ||
| @@ -497,6 +485,7 @@ err_remove_ports: · 276 unmodified lines | |||
| 497 | for (i = 0; i < pmc->num_ports; i++) { | 485 | for (i = 0; i < pmc->num_ports; i++) { |
| 498 | typec_switch_unregister(pmc->port[i].typec_sw); | 486 | typec_switch_unregister(pmc->port[i].typec_sw); |
| 499 | typec_mux_unregister(pmc->port[i].typec_mux); | 487 | typec_mux_unregister(pmc->port[i].typec_mux); |
| 488 | usb_role_switch_unregister(pmc->port[i].usb_sw); | ||
| 500 | } | 489 | } |
| 501 | 490 | ||
| 502 | return ret; | 491 | return ret; |
| @@ -510,6 +499,7 @@ static int pmc_usb_remove(struct platform_device *pdev) · 7 unmodified lines | |||
| 510 | for (i = 0; i < pmc->num_ports; i++) { | 499 | for (i = 0; i < pmc->num_ports; i++) { |
| 511 | typec_switch_unregister(pmc->port[i].typec_sw); | 500 | typec_switch_unregister(pmc->port[i].typec_sw); |
| 512 | typec_mux_unregister(pmc->port[i].typec_mux); | 501 | typec_mux_unregister(pmc->port[i].typec_mux); |
| 502 | usb_role_switch_unregister(pmc->port[i].usb_sw); | ||
| 513 | } | 503 | } |
| 514 | 504 | ||
| 515 | return 0; | 505 | return 0; |
| @@ -112,11 +112,15 @@ static void ucsi_acpi_notify(acpi_handle handle, u32 event, void *data) · 111 unmodified lines | |||
| 112 | 112 | ||
| 113 | static int ucsi_acpi_probe(struct platform_device *pdev) | 113 | static int ucsi_acpi_probe(struct platform_device *pdev) |
| 114 | { | 114 | { |
| 115 | struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); | ||
| 115 | struct ucsi_acpi *ua; | 116 | struct ucsi_acpi *ua; |
| 116 | struct resource *res; | 117 | struct resource *res; |
| 117 | acpi_status status; | 118 | acpi_status status; |
| 118 | int ret; | 119 | int ret; |
| 119 | 120 | ||
| 121 | if (adev->dep_unmet) | ||
| 122 | return -EPROBE_DEFER; | ||
| 123 | |||
| 120 | ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL); | 124 | ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL); |
| 121 | if (!ua) | 125 | if (!ua) |
| 122 | return -ENOMEM; | 126 | return -ENOMEM; |
| @@ -2537,7 +2537,7 @@ void vhost_disable_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq) · 2536 unmodified lines | |||
| 2537 | if (!vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX)) { | 2537 | if (!vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX)) { |
| 2538 | r = vhost_update_used_flags(vq); | 2538 | r = vhost_update_used_flags(vq); |
| 2539 | if (r) | 2539 | if (r) |
| 2540 | vq_err(vq, "Failed to enable notification at %p: %d\n", | 2540 | vq_err(vq, "Failed to disable notification at %p: %d\n", |
| 2541 | &vq->used->flags, r); | 2541 | &vq->used->flags, r); |
| 2542 | } | 2542 | } |
| 2543 | } | 2543 | } |
| @@ -1121,7 +1121,7 @@ static void vga_8planes_imageblit(struct fb_info *info, const struct fb_image *i · 1120 unmodified lines | |||
| 1121 | char oldop = setop(0); | 1121 | char oldop = setop(0); |
| 1122 | char oldsr = setsr(0); | 1122 | char oldsr = setsr(0); |
| 1123 | char oldmask = selectmask(); | 1123 | char oldmask = selectmask(); |
| 1124 | const char *cdat = image->data; | 1124 | const unsigned char *cdat = image->data; |
| 1125 | u32 dx = image->dx; | 1125 | u32 dx = image->dx; |
| 1126 | char __iomem *where; | 1126 | char __iomem *where; |
| 1127 | int y; | 1127 | int y; |
| @@ -325,4 +325,14 @@ config XEN_HAVE_VPMU · 324 unmodified lines | |||
| 325 | config XEN_FRONT_PGDIR_SHBUF | 325 | config XEN_FRONT_PGDIR_SHBUF |
| 326 | tristate | 326 | tristate |
| 327 | 327 | ||
| 328 | config XEN_UNPOPULATED_ALLOC | ||
| 329 | bool "Use unpopulated memory ranges for guest mappings" | ||
| 330 | depends on X86 && ZONE_DEVICE | ||
| 331 | default XEN_BACKEND || XEN_GNTDEV || XEN_DOM0 | ||
| 332 | help | ||
| 333 | Use unpopulated memory ranges in order to create mappings for guest | ||
| 334 | memory regions, including grant maps and foreign pages. This avoids | ||
| 335 | having to balloon out RAM regions in order to obtain physical memory | ||
| 336 | space to create such mappings. | ||
| 337 | |||
| 328 | endmenu | 338 | endmenu |
| @@ -41,3 +41,4 @@ xen-gntdev-$(CONFIG_XEN_GNTDEV_DMABUF) += gntdev-dmabuf.o · 40 unmodified lines | |||
| 41 | xen-gntalloc-y := gntalloc.o | 41 | xen-gntalloc-y := gntalloc.o |
| 42 | xen-privcmd-y := privcmd.o privcmd-buf.o | 42 | xen-privcmd-y := privcmd.o privcmd-buf.o |
| 43 | obj-$(CONFIG_XEN_FRONT_PGDIR_SHBUF) += xen-front-pgdir-shbuf.o | 43 | obj-$(CONFIG_XEN_FRONT_PGDIR_SHBUF) += xen-front-pgdir-shbuf.o |
| 44 | obj-$(CONFIG_XEN_UNPOPULATED_ALLOC) += unpopulated-alloc.o | ||
| @@ -653,7 +653,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) · 652 unmodified lines | |||
| 653 | } | 653 | } |
| 654 | EXPORT_SYMBOL(free_xenballooned_pages); | 654 | EXPORT_SYMBOL(free_xenballooned_pages); |
| 655 | 655 | ||
| 656 | #ifdef CONFIG_XEN_PV | 656 | #if defined(CONFIG_XEN_PV) && !defined(CONFIG_XEN_UNPOPULATED_ALLOC) |
| 657 | static void __init balloon_add_region(unsigned long start_pfn, | 657 | static void __init balloon_add_region(unsigned long start_pfn, |
| 658 | unsigned long pages) | 658 | unsigned long pages) |
| 659 | { | 659 | { |
| @@ -707,7 +707,7 @@ static int __init balloon_init(void) · 47 unmodified lines | |||
| 707 | register_sysctl_table(xen_root); | 707 | register_sysctl_table(xen_root); |
| 708 | #endif | 708 | #endif |
| 709 | 709 | ||
| 710 | #ifdef CONFIG_XEN_PV | 710 | #if defined(CONFIG_XEN_PV) && !defined(CONFIG_XEN_UNPOPULATED_ALLOC) |
| 711 | { | 711 | { |
| 712 | int i; | 712 | int i; |
| 713 | 713 | ||
| @@ -801,7 +801,7 @@ int gnttab_alloc_pages(int nr_pages, struct page **pages) · 800 unmodified lines | |||
| 801 | { | 801 | { |
| 802 | int ret; | 802 | int ret; |
| 803 | 803 | ||
| 804 | ret = alloc_xenballooned_pages(nr_pages, pages); | 804 | ret = xen_alloc_unpopulated_pages(nr_pages, pages); |
| 805 | if (ret < 0) | 805 | if (ret < 0) |
| 806 | return ret; | 806 | return ret; |
| 807 | 807 | ||
| @@ -836,7 +836,7 @@ EXPORT_SYMBOL_GPL(gnttab_pages_clear_private); · 28 unmodified lines | |||
| 836 | void gnttab_free_pages(int nr_pages, struct page **pages) | 836 | void gnttab_free_pages(int nr_pages, struct page **pages) |
| 837 | { | 837 | { |
| 838 | gnttab_pages_clear_private(nr_pages, pages); | 838 | gnttab_pages_clear_private(nr_pages, pages); |
| 839 | free_xenballooned_pages(nr_pages, pages); | 839 | xen_free_unpopulated_pages(nr_pages, pages); |
| 840 | } | 840 | } |
| 841 | EXPORT_SYMBOL_GPL(gnttab_free_pages); | 841 | EXPORT_SYMBOL_GPL(gnttab_free_pages); |
| 842 | 842 | ||
| @@ -424,7 +424,7 @@ static int alloc_empty_pages(struct vm_area_struct *vma, int numpgs) · 423 unmodified lines | |||
| 424 | if (pages == NULL) | 424 | if (pages == NULL) |
| 425 | return -ENOMEM; | 425 | return -ENOMEM; |
| 426 | 426 | ||
| 427 | rc = alloc_xenballooned_pages(numpgs, pages); | 427 | rc = xen_alloc_unpopulated_pages(numpgs, pages); |
| 428 | if (rc != 0) { | 428 | if (rc != 0) { |
| 429 | pr_warn("%s Could not alloc %d pfns rc:%d\n", __func__, | 429 | pr_warn("%s Could not alloc %d pfns rc:%d\n", __func__, |
| 430 | numpgs, rc); | 430 | numpgs, rc); |
| @@ -895,7 +895,7 @@ static void privcmd_close(struct vm_area_struct *vma) · 464 unmodified lines | |||
| 895 | 895 | ||
| 896 | rc = xen_unmap_domain_gfn_range(vma, numgfns, pages); | 896 | rc = xen_unmap_domain_gfn_range(vma, numgfns, pages); |
| 897 | if (rc == 0) | 897 | if (rc == 0) |
| 898 | free_xenballooned_pages(numpgs, pages); | 898 | xen_free_unpopulated_pages(numpgs, pages); |
| 899 | else | 899 | else |
| 900 | pr_crit("unable to unmap MFN range: leaking %d pages. rc=%d\n", | 900 | pr_crit("unable to unmap MFN range: leaking %d pages. rc=%d\n", |
| 901 | numpgs, rc); | 901 | numpgs, rc); |
| @@ -0,0 +1,183 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | #include <linux/errno.h> | ||
| 3 | #include <linux/gfp.h> | ||
| 4 | #include <linux/kernel.h> | ||
| 5 | #include <linux/mm.h> | ||
| 6 | #include <linux/memremap.h> | ||
| 7 | #include <linux/slab.h> | ||
| 8 | |||
| 9 | #include <asm/page.h> | ||
| 10 | |||
| 11 | #include <xen/page.h> | ||
| 12 | #include <xen/xen.h> | ||
| 13 | |||
| 14 | static DEFINE_MUTEX(list_lock); | ||
| 15 | static LIST_HEAD(page_list); | ||
| 16 | static unsigned int list_count; | ||
| 17 | |||
| 18 | static int fill_list(unsigned int nr_pages) | ||
| 19 | { | ||
| 20 | struct dev_pagemap *pgmap; | ||
| 21 | void *vaddr; | ||
| 22 | unsigned int i, alloc_pages = round_up(nr_pages, PAGES_PER_SECTION); | ||
| 23 | int ret; | ||
| 24 | |||
| 25 | pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL); | ||
| 26 | if (!pgmap) | ||
| 27 | return -ENOMEM; | ||
| 28 | |||
| 29 | pgmap->type = MEMORY_DEVICE_GENERIC; | ||
| 30 | pgmap->res.name = "Xen scratch"; | ||
| 31 | pgmap->res.flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
| 32 | |||
| 33 | ret = allocate_resource(&iomem_resource, &pgmap->res, | ||
| 34 | alloc_pages * PAGE_SIZE, 0, -1, | ||
| 35 | PAGES_PER_SECTION * PAGE_SIZE, NULL, NULL); | ||
| 36 | if (ret < 0) { | ||
| 37 | pr_err("Cannot allocate new IOMEM resource\n"); | ||
| 38 | kfree(pgmap); | ||
| 39 | return ret; | ||
| 40 | } | ||
| 41 | |||
| 42 | #ifdef CONFIG_XEN_HAVE_PVMMU | ||
| 43 | /* | ||
| 44 | * memremap will build page tables for the new memory so | ||
| 45 | * the p2m must contain invalid entries so the correct | ||
| 46 | * non-present PTEs will be written. | ||
| 47 | * | ||
| 48 | * If a failure occurs, the original (identity) p2m entries | ||
| 49 | * are not restored since this region is now known not to | ||
| 50 | * conflict with any devices. | ||
| 51 | */ | ||
| 52 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | ||
| 53 | xen_pfn_t pfn = PFN_DOWN(pgmap->res.start); | ||
| 54 | |||
| 55 | for (i = 0; i < alloc_pages; i++) { | ||
| 56 | if (!set_phys_to_machine(pfn + i, INVALID_P2M_ENTRY)) { | ||
| 57 | pr_warn("set_phys_to_machine() failed, no memory added\n"); | ||
| 58 | release_resource(&pgmap->res); | ||
| 59 | kfree(pgmap); | ||
| 60 | return -ENOMEM; | ||
| 61 | } | ||
| 62 | } | ||
| 63 | } | ||
| 64 | #endif | ||
| 65 | |||
| 66 | vaddr = memremap_pages(pgmap, NUMA_NO_NODE); | ||
| 67 | if (IS_ERR(vaddr)) { | ||
| 68 | pr_err("Cannot remap memory range\n"); | ||
| 69 | release_resource(&pgmap->res); | ||
| 70 | kfree(pgmap); | ||
| 71 | return PTR_ERR(vaddr); | ||
| 72 | } | ||
| 73 | |||
| 74 | for (i = 0; i < alloc_pages; i++) { | ||
| 75 | struct page *pg = virt_to_page(vaddr + PAGE_SIZE * i); | ||
| 76 | |||
| 77 | BUG_ON(!virt_addr_valid(vaddr + PAGE_SIZE * i)); | ||
| 78 | list_add(&pg->lru, &page_list); | ||
| 79 | list_count++; | ||
| 80 | } | ||
| 81 | |||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | /** | ||
| 86 | * xen_alloc_unpopulated_pages - alloc unpopulated pages | ||
| 87 | * @nr_pages: Number of pages | ||
| 88 | * @pages: pages returned | ||
| 89 | * @return 0 on success, error otherwise | ||
| 90 | */ | ||
| 91 | int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages) | ||
| 92 | { | ||
| 93 | unsigned int i; | ||
| 94 | int ret = 0; | ||
| 95 | |||
| 96 | mutex_lock(&list_lock); | ||
| 97 | if (list_count < nr_pages) { | ||
| 98 | ret = fill_list(nr_pages - list_count); | ||
| 99 | if (ret) | ||
| 100 | goto out; | ||
| 101 | } | ||
| 102 | |||
| 103 | for (i = 0; i < nr_pages; i++) { | ||
| 104 | struct page *pg = list_first_entry_or_null(&page_list, | ||
| 105 | struct page, | ||
| 106 | lru); | ||
| 107 | |||
| 108 | BUG_ON(!pg); | ||
| 109 | list_del(&pg->lru); | ||
| 110 | list_count--; | ||
| 111 | pages[i] = pg; | ||
| 112 | |||
| 113 | #ifdef CONFIG_XEN_HAVE_PVMMU | ||
| 114 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | ||
| 115 | ret = xen_alloc_p2m_entry(page_to_pfn(pg)); | ||
| 116 | if (ret < 0) { | ||
| 117 | unsigned int j; | ||
| 118 | |||
| 119 | for (j = 0; j <= i; j++) { | ||
| 120 | list_add(&pages[j]->lru, &page_list); | ||
| 121 | list_count++; | ||
| 122 | } | ||
| 123 | goto out; | ||
| 124 | } | ||
| 125 | } | ||
| 126 | #endif | ||
| 127 | } | ||
| 128 | |||
| 129 | out: | ||
| 130 | mutex_unlock(&list_lock); | ||
| 131 | return ret; | ||
| 132 | } | ||
| 133 | EXPORT_SYMBOL(xen_alloc_unpopulated_pages); | ||
| 134 | |||
| 135 | /** | ||
| 136 | * xen_free_unpopulated_pages - return unpopulated pages | ||
| 137 | * @nr_pages: Number of pages | ||
| 138 | * @pages: pages to return | ||
| 139 | */ | ||
| 140 | void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages) | ||
| 141 | { | ||
| 142 | unsigned int i; | ||
| 143 | |||
| 144 | mutex_lock(&list_lock); | ||
| 145 | for (i = 0; i < nr_pages; i++) { | ||
| 146 | list_add(&pages[i]->lru, &page_list); | ||
| 147 | list_count++; | ||
| 148 | } | ||
| 149 | mutex_unlock(&list_lock); | ||
| 150 | } | ||
| 151 | EXPORT_SYMBOL(xen_free_unpopulated_pages); | ||
| 152 | |||
| 153 | #ifdef CONFIG_XEN_PV | ||
| 154 | static int __init init(void) | ||
| 155 | { | ||
| 156 | unsigned int i; | ||
| 157 | |||
| 158 | if (!xen_domain()) | ||
| 159 | return -ENODEV; | ||
| 160 | |||
| 161 | if (!xen_pv_domain()) | ||
| 162 | return 0; | ||
| 163 | |||
| 164 | /* | ||
| 165 | * Initialize with pages from the extra memory regions (see | ||
| 166 | * arch/x86/xen/setup.c). | ||
| 167 | */ | ||
| 168 | for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) { | ||
| 169 | unsigned int j; | ||
| 170 | |||
| 171 | for (j = 0; j < xen_extra_mem[i].n_pfns; j++) { | ||
| 172 | struct page *pg = | ||
| 173 | pfn_to_page(xen_extra_mem[i].start_pfn + j); | ||
| 174 | |||
| 175 | list_add(&pg->lru, &page_list); | ||
| 176 | list_count++; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | |||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | subsys_initcall(init); | ||
| 183 | #endif | ||
| @@ -621,7 +621,7 @@ static int xenbus_map_ring_hvm(struct xenbus_device *dev, · 620 unmodified lines | |||
| 621 | bool leaked = false; | 621 | bool leaked = false; |
| 622 | unsigned int nr_pages = XENBUS_PAGES(nr_grefs); | 622 | unsigned int nr_pages = XENBUS_PAGES(nr_grefs); |
| 623 | 623 | ||
| 624 | err = alloc_xenballooned_pages(nr_pages, node->hvm.pages); | 624 | err = xen_alloc_unpopulated_pages(nr_pages, node->hvm.pages); |
| 625 | if (err) | 625 | if (err) |
| 626 | goto out_err; | 626 | goto out_err; |
| 627 | 627 | ||
| @@ -662,7 +662,7 @@ static int xenbus_map_ring_hvm(struct xenbus_device *dev, · 34 unmodified lines | |||
| 662 | addr, nr_pages); | 662 | addr, nr_pages); |
| 663 | out_free_ballooned_pages: | 663 | out_free_ballooned_pages: |
| 664 | if (!leaked) | 664 | if (!leaked) |
| 665 | free_xenballooned_pages(nr_pages, node->hvm.pages); | 665 | xen_free_unpopulated_pages(nr_pages, node->hvm.pages); |
| 666 | out_err: | 666 | out_err: |
| 667 | return err; | 667 | return err; |
| 668 | } | 668 | } |
| @@ -858,7 +858,7 @@ static int xenbus_unmap_ring_hvm(struct xenbus_device *dev, void *vaddr) · 189 unmodified lines | |||
| 858 | info.addrs); | 858 | info.addrs); |
| 859 | if (!rv) { | 859 | if (!rv) { |
| 860 | vunmap(vaddr); | 860 | vunmap(vaddr); |
| 861 | free_xenballooned_pages(nr_pages, node->hvm.pages); | 861 | xen_free_unpopulated_pages(nr_pages, node->hvm.pages); |
| 862 | } | 862 | } |
| 863 | else | 863 | else |
| 864 | WARN(1, "Leaking %p, size %u page(s)\n", vaddr, nr_pages); | 864 | WARN(1, "Leaking %p, size %u page(s)\n", vaddr, nr_pages); |
| @@ -232,7 +232,7 @@ int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt, · 231 unmodified lines | |||
| 232 | kfree(pages); | 232 | kfree(pages); |
| 233 | return -ENOMEM; | 233 | return -ENOMEM; |
| 234 | } | 234 | } |
| 235 | rc = alloc_xenballooned_pages(nr_pages, pages); | 235 | rc = xen_alloc_unpopulated_pages(nr_pages, pages); |
| 236 | if (rc) { | 236 | if (rc) { |
| 237 | pr_warn("%s Couldn't balloon alloc %ld pages rc:%d\n", __func__, | 237 | pr_warn("%s Couldn't balloon alloc %ld pages rc:%d\n", __func__, |
| 238 | nr_pages, rc); | 238 | nr_pages, rc); |
| @@ -249,7 +249,7 @@ int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt, · 10 unmodified lines | |||
| 249 | if (!vaddr) { | 249 | if (!vaddr) { |
| 250 | pr_warn("%s Couldn't map %ld pages rc:%d\n", __func__, | 250 | pr_warn("%s Couldn't map %ld pages rc:%d\n", __func__, |
| 251 | nr_pages, rc); | 251 | nr_pages, rc); |
| 252 | free_xenballooned_pages(nr_pages, pages); | 252 | xen_free_unpopulated_pages(nr_pages, pages); |
| 253 | kfree(pages); | 253 | kfree(pages); |
| 254 | kfree(pfns); | 254 | kfree(pfns); |
| 255 | return -ENOMEM; | 255 | return -ENOMEM; |
| @@ -420,24 +420,51 @@ affs_mode_to_prot(struct inode *inode) · 419 unmodified lines | |||
| 420 | u32 prot = AFFS_I(inode)->i_protect; | 420 | u32 prot = AFFS_I(inode)->i_protect; |
| 421 | umode_t mode = inode->i_mode; | 421 | umode_t mode = inode->i_mode; |
| 422 | 422 | ||
| 423 | /* | ||
| 424 | * First, clear all RWED bits for owner, group, other. | ||
| 425 | * Then, recalculate them afresh. | ||
| 426 | * | ||
| 427 | * We'll always clear the delete-inhibit bit for the owner, as that is | ||
| 428 | * the classic single-user mode AmigaOS protection bit and we need to | ||
| 429 | * stay compatible with all scenarios. | ||
| 430 | * | ||
| 431 | * Since multi-user AmigaOS is an extension, we'll only set the | ||
| 432 | * delete-allow bit if any of the other bits in the same user class | ||
| 433 | * (group/other) are used. | ||
| 434 | */ | ||
| 435 | prot &= ~(FIBF_NOEXECUTE | FIBF_NOREAD | ||
| 436 | | FIBF_NOWRITE | FIBF_NODELETE | ||
| 437 | | FIBF_GRP_EXECUTE | FIBF_GRP_READ | ||
| 438 | | FIBF_GRP_WRITE | FIBF_GRP_DELETE | ||
| 439 | | FIBF_OTR_EXECUTE | FIBF_OTR_READ | ||
| 440 | | FIBF_OTR_WRITE | FIBF_OTR_DELETE); | ||
| 441 | |||
| 442 | /* Classic single-user AmigaOS flags. These are inverted. */ | ||
| 423 | if (!(mode & 0100)) | 443 | if (!(mode & 0100)) |
| 424 | prot |= FIBF_NOEXECUTE; | 444 | prot |= FIBF_NOEXECUTE; |
| 425 | if (!(mode & 0400)) | 445 | if (!(mode & 0400)) |
| 426 | prot |= FIBF_NOREAD; | 446 | prot |= FIBF_NOREAD; |
| 427 | if (!(mode & 0200)) | 447 | if (!(mode & 0200)) |
| 428 | prot |= FIBF_NOWRITE; | 448 | prot |= FIBF_NOWRITE; |
| 449 | |||
| 450 | /* Multi-user extended flags. Not inverted. */ | ||
| 429 | if (mode & 0010) | 451 | if (mode & 0010) |
| 430 | prot |= FIBF_GRP_EXECUTE; | 452 | prot |= FIBF_GRP_EXECUTE; |
| 431 | if (mode & 0040) | 453 | if (mode & 0040) |
| 432 | prot |= FIBF_GRP_READ; | 454 | prot |= FIBF_GRP_READ; |
| 433 | if (mode & 0020) | 455 | if (mode & 0020) |
| 434 | prot |= FIBF_GRP_WRITE; | 456 | prot |= FIBF_GRP_WRITE; |
| 457 | if (mode & 0070) | ||
| 458 | prot |= FIBF_GRP_DELETE; | ||
| 459 | |||
| 435 | if (mode & 0001) | 460 | if (mode & 0001) |
| 436 | prot |= FIBF_OTR_EXECUTE; | 461 | prot |= FIBF_OTR_EXECUTE; |
| 437 | if (mode & 0004) | 462 | if (mode & 0004) |
| 438 | prot |= FIBF_OTR_READ; | 463 | prot |= FIBF_OTR_READ; |
| 439 | if (mode & 0002) | 464 | if (mode & 0002) |
| 440 | prot |= FIBF_OTR_WRITE; | 465 | prot |= FIBF_OTR_WRITE; |
| 466 | if (mode & 0007) | ||
| 467 | prot |= FIBF_OTR_DELETE; | ||
| 441 | 468 | ||
| 442 | AFFS_I(inode)->i_protect = prot; | 469 | AFFS_I(inode)->i_protect = prot; |
| 443 | } | 470 | } |
| @@ -429,6 +429,24 @@ static int affs_write_begin(struct file *file, struct address_space *mapping, · 428 unmodified lines | |||
| 429 | return ret; | 429 | return ret; |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | static int affs_write_end(struct file *file, struct address_space *mapping, | ||
| 433 | loff_t pos, unsigned int len, unsigned int copied, | ||
| 434 | struct page *page, void *fsdata) | ||
| 435 | { | ||
| 436 | struct inode *inode = mapping->host; | ||
| 437 | int ret; | ||
| 438 | |||
| 439 | ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); | ||
| 440 | |||
| 441 | /* Clear Archived bit on file writes, as AmigaOS would do */ | ||
| 442 | if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) { | ||
| 443 | AFFS_I(inode)->i_protect &= ~FIBF_ARCHIVED; | ||
| 444 | mark_inode_dirty(inode); | ||
| 445 | } | ||
| 446 | |||
| 447 | return ret; | ||
| 448 | } | ||
| 449 | |||
| 432 | static sector_t _affs_bmap(struct address_space *mapping, sector_t block) | 450 | static sector_t _affs_bmap(struct address_space *mapping, sector_t block) |
| 433 | { | 451 | { |
| 434 | return generic_block_bmap(mapping,block,affs_get_block); | 452 | return generic_block_bmap(mapping,block,affs_get_block); |
| @@ -438,7 +456,7 @@ const struct address_space_operations affs_aops = { · 3 unmodified lines | |||
| 438 | .readpage = affs_readpage, | 456 | .readpage = affs_readpage, |
| 439 | .writepage = affs_writepage, | 457 | .writepage = affs_writepage, |
| 440 | .write_begin = affs_write_begin, | 458 | .write_begin = affs_write_begin, |
| 441 | .write_end = generic_write_end, | 459 | .write_end = affs_write_end, |
| 442 | .direct_IO = affs_direct_IO, | 460 | .direct_IO = affs_direct_IO, |
| 443 | .bmap = _affs_bmap | 461 | .bmap = _affs_bmap |
| 444 | }; | 462 | }; |
| @@ -795,6 +813,12 @@ done: · 350 unmodified lines | |||
| 795 | if (tmp > inode->i_size) | 813 | if (tmp > inode->i_size) |
| 796 | inode->i_size = AFFS_I(inode)->mmu_private = tmp; | 814 | inode->i_size = AFFS_I(inode)->mmu_private = tmp; |
| 797 | 815 | ||
| 816 | /* Clear Archived bit on file writes, as AmigaOS would do */ | ||
| 817 | if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) { | ||
| 818 | AFFS_I(inode)->i_protect &= ~FIBF_ARCHIVED; | ||
| 819 | mark_inode_dirty(inode); | ||
| 820 | } | ||
| 821 | |||
| 798 | err_first_bh: | 822 | err_first_bh: |
| 799 | unlock_page(page); | 823 | unlock_page(page); |
| 800 | put_page(page); | 824 | put_page(page); |
| @@ -161,8 +161,8 @@ responded: · 160 unmodified lines | |||
| 161 | } | 161 | } |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall); | 164 | if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) && |
| 165 | if (rtt_us < server->probe.rtt) { | 165 | rtt_us < server->probe.rtt) { |
| 166 | server->probe.rtt = rtt_us; | 166 | server->probe.rtt = rtt_us; |
| 167 | server->rtt = rtt_us; | 167 | server->rtt = rtt_us; |
| 168 | alist->preferred = index; | 168 | alist->preferred = index; |
| @@ -401,22 +401,24 @@ struct afs_vlserver { · 400 unmodified lines | |||
| 401 | #define AFS_VLSERVER_FL_PROBED 0 /* The VL server has been probed */ | 401 | #define AFS_VLSERVER_FL_PROBED 0 /* The VL server has been probed */ |
| 402 | #define AFS_VLSERVER_FL_PROBING 1 /* VL server is being probed */ | 402 | #define AFS_VLSERVER_FL_PROBING 1 /* VL server is being probed */ |
| 403 | #define AFS_VLSERVER_FL_IS_YFS 2 /* Server is YFS not AFS */ | 403 | #define AFS_VLSERVER_FL_IS_YFS 2 /* Server is YFS not AFS */ |
| 404 | #define AFS_VLSERVER_FL_RESPONDING 3 /* VL server is responding */ | ||
| 404 | rwlock_t lock; /* Lock on addresses */ | 405 | rwlock_t lock; /* Lock on addresses */ |
| 405 | atomic_t usage; | 406 | atomic_t usage; |
| 407 | unsigned int rtt; /* Server's current RTT in uS */ | ||
| 406 | 408 | ||
| 407 | /* Probe state */ | 409 | /* Probe state */ |
| 408 | wait_queue_head_t probe_wq; | 410 | wait_queue_head_t probe_wq; |
| 409 | atomic_t probe_outstanding; | 411 | atomic_t probe_outstanding; |
| 410 | spinlock_t probe_lock; | 412 | spinlock_t probe_lock; |
| 411 | struct { | 413 | struct { |
| 412 | unsigned int rtt; /* RTT as ktime/64 */ | 414 | unsigned int rtt; /* RTT in uS */ |
| 413 | u32 abort_code; | 415 | u32 abort_code; |
| 414 | short error; | 416 | short error; |
| 415 | bool have_result; | 417 | unsigned short flags; |
| 416 | bool responded:1; | 418 | #define AFS_VLSERVER_PROBE_RESPONDED 0x01 /* At least once response (may be abort) */ |
| 417 | bool is_yfs:1; | 419 | #define AFS_VLSERVER_PROBE_IS_YFS 0x02 /* The peer appears to be YFS */ |
| 418 | bool not_yfs:1; | 420 | #define AFS_VLSERVER_PROBE_NOT_YFS 0x04 /* The peer appears not to be YFS */ |
| 419 | bool local_failure:1; | 421 | #define AFS_VLSERVER_PROBE_LOCAL_FAILURE 0x08 /* A local failure prevented a probe */ |
| 420 | } probe; | 422 | } probe; |
| 421 | 423 | ||
| 422 | u16 port; | 424 | u16 port; |
| @@ -310,6 +310,11 @@ static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) · 309 unmodified lines | |||
| 310 | alist->preferred == i ? '>' : '-', | 310 | alist->preferred == i ? '>' : '-', |
| 311 | &alist->addrs[i].transport); | 311 | &alist->addrs[i].transport); |
| 312 | } | 312 | } |
| 313 | seq_printf(m, " info: fl=%lx rtt=%d\n", vlserver->flags, vlserver->rtt); | ||
| 314 | seq_printf(m, " probe: fl=%x e=%d ac=%d out=%d\n", | ||
| 315 | vlserver->probe.flags, vlserver->probe.error, | ||
| 316 | vlserver->probe.abort_code, | ||
| 317 | atomic_read(&vlserver->probe_outstanding)); | ||
| 313 | return 0; | 318 | return 0; |
| 314 | } | 319 | } |
| 315 | 320 | ||
| @@ -21,6 +21,7 @@ struct afs_vlserver *afs_alloc_vlserver(const char *name, size_t name_len, · 20 unmodified lines | |||
| 21 | rwlock_init(&vlserver->lock); | 21 | rwlock_init(&vlserver->lock); |
| 22 | init_waitqueue_head(&vlserver->probe_wq); | 22 | init_waitqueue_head(&vlserver->probe_wq); |
| 23 | spin_lock_init(&vlserver->probe_lock); | 23 | spin_lock_init(&vlserver->probe_lock); |
| 24 | vlserver->rtt = UINT_MAX; | ||
| 24 | vlserver->name_len = name_len; | 25 | vlserver->name_len = name_len; |
| 25 | vlserver->port = port; | 26 | vlserver->port = port; |
| 26 | memcpy(vlserver->name, name, name_len); | 27 | memcpy(vlserver->name, name, name_len); |
| @@ -11,15 +11,33 @@ · 10 unmodified lines | |||
| 11 | #include "internal.h" | 11 | #include "internal.h" |
| 12 | #include "protocol_yfs.h" | 12 | #include "protocol_yfs.h" |
| 13 | 13 | ||
| 14 | static bool afs_vl_probe_done(struct afs_vlserver *server) | 14 | |
| 15 | /* | ||
| 16 | * Handle the completion of a set of probes. | ||
| 17 | */ | ||
| 18 | static void afs_finished_vl_probe(struct afs_vlserver *server) | ||
| 15 | { | 19 | { |
| 16 | if (!atomic_dec_and_test(&server->probe_outstanding)) | 20 | if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)) { |
| 17 | return false; | 21 | server->rtt = UINT_MAX; |
| 22 | clear_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags); | ||
| 23 | } | ||
| 18 | 24 | ||
| 19 | wake_up_var(&server->probe_outstanding); | ||
| 20 | clear_bit_unlock(AFS_VLSERVER_FL_PROBING, &server->flags); | 25 | clear_bit_unlock(AFS_VLSERVER_FL_PROBING, &server->flags); |
| 21 | wake_up_bit(&server->flags, AFS_VLSERVER_FL_PROBING); | 26 | wake_up_bit(&server->flags, AFS_VLSERVER_FL_PROBING); |
| 22 | return true; | 27 | } |
| 28 | |||
| 29 | /* | ||
| 30 | * Handle the completion of a probe RPC call. | ||
| 31 | */ | ||
| 32 | static void afs_done_one_vl_probe(struct afs_vlserver *server, bool wake_up) | ||
| 33 | { | ||
| 34 | if (atomic_dec_and_test(&server->probe_outstanding)) { | ||
| 35 | afs_finished_vl_probe(server); | ||
| 36 | wake_up = true; | ||
| 37 | } | ||
| 38 | |||
| 39 | if (wake_up) | ||
| 40 | wake_up_all(&server->probe_wq); | ||
| 23 | } | 41 | } |
| 24 | 42 | ||
| 25 | /* | 43 | /* |
| @@ -45,15 +63,20 @@ void afs_vlserver_probe_result(struct afs_call *call) · 19 unmodified lines | |||
| 45 | server->probe.error = 0; | 63 | server->probe.error = 0; |
| 46 | goto responded; | 64 | goto responded; |
| 47 | case -ECONNABORTED: | 65 | case -ECONNABORTED: |
| 48 | if (!server->probe.responded) { | 66 | if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)) { |
| 49 | server->probe.abort_code = call->abort_code; | 67 | server->probe.abort_code = call->abort_code; |
| 50 | server->probe.error = ret; | 68 | server->probe.error = ret; |
| 51 | } | 69 | } |
| 52 | goto responded; | 70 | goto responded; |
| 53 | case -ENOMEM: | 71 | case -ENOMEM: |
| 54 | case -ENONET: | 72 | case -ENONET: |
| 55 | server->probe.local_failure = true; | 73 | case -EKEYEXPIRED: |
| 56 | afs_io_error(call, afs_io_error_vl_probe_fail); | 74 | case -EKEYREVOKED: |
| 75 | case -EKEYREJECTED: | ||
| 76 | server->probe.flags |= AFS_VLSERVER_PROBE_LOCAL_FAILURE; | ||
| 77 | if (server->probe.error == 0) | ||
| 78 | server->probe.error = ret; | ||
| 79 | trace_afs_io_error(call->debug_id, ret, afs_io_error_vl_probe_fail); | ||
| 57 | goto out; | 80 | goto out; |
| 58 | case -ECONNRESET: /* Responded, but call expired. */ | 81 | case -ECONNRESET: /* Responded, but call expired. */ |
| 59 | case -ERFKILL: | 82 | case -ERFKILL: |
| @@ -67,12 +90,12 @@ void afs_vlserver_probe_result(struct afs_call *call) · 7 unmodified lines | |||
| 67 | default: | 90 | default: |
| 68 | clear_bit(index, &alist->responded); | 91 | clear_bit(index, &alist->responded); |
| 69 | set_bit(index, &alist->failed); | 92 | set_bit(index, &alist->failed); |
| 70 | if (!server->probe.responded && | 93 | if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) && |
| 71 | (server->probe.error == 0 || | 94 | (server->probe.error == 0 || |
| 72 | server->probe.error == -ETIMEDOUT || | 95 | server->probe.error == -ETIMEDOUT || |
| 73 | server->probe.error == -ETIME)) | 96 | server->probe.error == -ETIME)) |
| 74 | server->probe.error = ret; | 97 | server->probe.error = ret; |
| 75 | afs_io_error(call, afs_io_error_vl_probe_fail); | 98 | trace_afs_io_error(call->debug_id, ret, afs_io_error_vl_probe_fail); |
| 76 | goto out; | 99 | goto out; |
| 77 | } | 100 | } |
| 78 | 101 | ||
| @@ -81,39 +104,36 @@ responded: · 2 unmodified lines | |||
| 81 | clear_bit(index, &alist->failed); | 104 | clear_bit(index, &alist->failed); |
| 82 | 105 | ||
| 83 | if (call->service_id == YFS_VL_SERVICE) { | 106 | if (call->service_id == YFS_VL_SERVICE) { |
| 84 | server->probe.is_yfs = true; | 107 | server->probe.flags |= AFS_VLSERVER_PROBE_IS_YFS; |
| 85 | set_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags); | 108 | set_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags); |
| 86 | alist->addrs[index].srx_service = call->service_id; | 109 | alist->addrs[index].srx_service = call->service_id; |
| 87 | } else { | 110 | } else { |
| 88 | server->probe.not_yfs = true; | 111 | server->probe.flags |= AFS_VLSERVER_PROBE_NOT_YFS; |
| 89 | if (!server->probe.is_yfs) { | 112 | if (!(server->probe.flags & AFS_VLSERVER_PROBE_IS_YFS)) { |
| 90 | clear_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags); | 113 | clear_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags); |
| 91 | alist->addrs[index].srx_service = call->service_id; | 114 | alist->addrs[index].srx_service = call->service_id; |
| 92 | } | 115 | } |
| 93 | } | 116 | } |
| 94 | 117 | ||
| 95 | rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall); | 118 | if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) && |
| 96 | if (rtt_us < server->probe.rtt) { | 119 | rtt_us < server->probe.rtt) { |
| 97 | server->probe.rtt = rtt_us; | 120 | server->probe.rtt = rtt_us; |
| 121 | server->rtt = rtt_us; | ||
| 98 | alist->preferred = index; | 122 | alist->preferred = index; |
| 99 | have_result = true; | ||
| 100 | } | 123 | } |
| 101 | 124 | ||
| 102 | smp_wmb(); /* Set rtt before responded. */ | 125 | smp_wmb(); /* Set rtt before responded. */ |
| 103 | server->probe.responded = true; | 126 | server->probe.flags |= AFS_VLSERVER_PROBE_RESPONDED; |
| 104 | set_bit(AFS_VLSERVER_FL_PROBED, &server->flags); | 127 | set_bit(AFS_VLSERVER_FL_PROBED, &server->flags); |
| 128 | set_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags); | ||
| 129 | have_result = true; | ||
| 105 | out: | 130 | out: |
| 106 | spin_unlock(&server->probe_lock); | 131 | spin_unlock(&server->probe_lock); |
| 107 | 132 | ||
| 108 | _debug("probe [%u][%u] %pISpc rtt=%u ret=%d", | 133 | _debug("probe [%u][%u] %pISpc rtt=%u ret=%d", |
| 109 | server_index, index, &alist->addrs[index].transport, rtt_us, ret); | 134 | server_index, index, &alist->addrs[index].transport, rtt_us, ret); |
| 110 | 135 | ||
| 111 | have_result |= afs_vl_probe_done(server); | 136 | afs_done_one_vl_probe(server, have_result); |
| 112 | if (have_result) { | ||
| 113 | server->probe.have_result = true; | ||
| 114 | wake_up_var(&server->probe.have_result); | ||
| 115 | wake_up_all(&server->probe_wq); | ||
| 116 | } | ||
| 117 | } | 137 | } |
| 118 | 138 | ||
| 119 | /* | 139 | /* |
| @@ -151,11 +171,10 @@ static bool afs_do_probe_vlserver(struct afs_net *net, · 31 unmodified lines | |||
| 151 | in_progress = true; | 171 | in_progress = true; |
| 152 | } else { | 172 | } else { |
| 153 | afs_prioritise_error(_e, PTR_ERR(call), ac.abort_code); | 173 | afs_prioritise_error(_e, PTR_ERR(call), ac.abort_code); |
| 174 | afs_done_one_vl_probe(server, false); | ||
| 154 | } | 175 | } |
| 155 | } | 176 | } |
| 156 | 177 | ||
| 157 | if (!in_progress) | ||
| 158 | afs_vl_probe_done(server); | ||
| 159 | return in_progress; | 178 | return in_progress; |
| 160 | } | 179 | } |
| 161 | 180 | ||
| @@ -193,7 +212,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist, · 31 unmodified lines | |||
| 193 | { | 212 | { |
| 194 | struct wait_queue_entry *waits; | 213 | struct wait_queue_entry *waits; |
| 195 | struct afs_vlserver *server; | 214 | struct afs_vlserver *server; |
| 196 | unsigned int rtt = UINT_MAX; | 215 | unsigned int rtt = UINT_MAX, rtt_s; |
| 197 | bool have_responders = false; | 216 | bool have_responders = false; |
| 198 | int pref = -1, i; | 217 | int pref = -1, i; |
| 199 | 218 | ||
| @@ -205,7 +224,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist, · 5 unmodified lines | |||
| 205 | server = vllist->servers[i].server; | 224 | server = vllist->servers[i].server; |
| 206 | if (!test_bit(AFS_VLSERVER_FL_PROBING, &server->flags)) | 225 | if (!test_bit(AFS_VLSERVER_FL_PROBING, &server->flags)) |
| 207 | __clear_bit(i, &untried); | 226 | __clear_bit(i, &untried); |
| 208 | if (server->probe.responded) | 227 | if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) |
| 209 | have_responders = true; | 228 | have_responders = true; |
| 210 | } | 229 | } |
| 211 | } | 230 | } |
| @@ -231,7 +250,7 @@ int afs_wait_for_vl_probes(struct afs_vlserver_list *vllist, · 19 unmodified lines | |||
| 231 | for (i = 0; i < vllist->nr_servers; i++) { | 250 | for (i = 0; i < vllist->nr_servers; i++) { |
| 232 | if (test_bit(i, &untried)) { | 251 | if (test_bit(i, &untried)) { |
| 233 | server = vllist->servers[i].server; | 252 | server = vllist->servers[i].server; |
| 234 | if (server->probe.responded) | 253 | if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) |
| 235 | goto stop; | 254 | goto stop; |
| 236 | if (test_bit(AFS_VLSERVER_FL_PROBING, &server->flags)) | 255 | if (test_bit(AFS_VLSERVER_FL_PROBING, &server->flags)) |
| 237 | still_probing = true; | 256 | still_probing = true; |
| @@ -249,10 +268,11 @@ stop: · 11 unmodified lines | |||
| 249 | for (i = 0; i < vllist->nr_servers; i++) { | 268 | for (i = 0; i < vllist->nr_servers; i++) { |
| 250 | if (test_bit(i, &untried)) { | 269 | if (test_bit(i, &untried)) { |
| 251 | server = vllist->servers[i].server; | 270 | server = vllist->servers[i].server; |
| 252 | if (server->probe.responded && | 271 | rtt_s = READ_ONCE(server->rtt); |
| 253 | server->probe.rtt < rtt) { | 272 | if (test_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags) && |
| 273 | rtt_s < rtt) { | ||
| 254 | pref = i; | 274 | pref = i; |
| 255 | rtt = server->probe.rtt; | 275 | rtt = rtt_s; |
| 256 | } | 276 | } |
| 257 | 277 | ||
| 258 | remove_wait_queue(&server->probe_wq, &waits[i]); | 278 | remove_wait_queue(&server->probe_wq, &waits[i]); |
| @@ -192,7 +192,8 @@ pick_server: · 191 unmodified lines | |||
| 192 | for (i = 0; i < vc->server_list->nr_servers; i++) { | 192 | for (i = 0; i < vc->server_list->nr_servers; i++) { |
| 193 | struct afs_vlserver *s = vc->server_list->servers[i].server; | 193 | struct afs_vlserver *s = vc->server_list->servers[i].server; |
| 194 | 194 | ||
| 195 | if (!test_bit(i, &vc->untried) || !s->probe.responded) | 195 | if (!test_bit(i, &vc->untried) || |
| 196 | !test_bit(AFS_VLSERVER_FL_RESPONDING, &s->flags)) | ||
| 196 | continue; | 197 | continue; |
| 197 | if (s->probe.rtt < rtt) { | 198 | if (s->probe.rtt < rtt) { |
| 198 | vc->index = i; | 199 | vc->index = i; |
| @@ -262,10 +263,14 @@ no_more_servers: · 63 unmodified lines | |||
| 262 | for (i = 0; i < vc->server_list->nr_servers; i++) { | 263 | for (i = 0; i < vc->server_list->nr_servers; i++) { |
| 263 | struct afs_vlserver *s = vc->server_list->servers[i].server; | 264 | struct afs_vlserver *s = vc->server_list->servers[i].server; |
| 264 | 265 | ||
| 266 | if (test_bit(AFS_VLSERVER_FL_RESPONDING, &s->flags)) | ||
| 267 | e.responded = true; | ||
| 265 | afs_prioritise_error(&e, READ_ONCE(s->probe.error), | 268 | afs_prioritise_error(&e, READ_ONCE(s->probe.error), |
| 266 | s->probe.abort_code); | 269 | s->probe.abort_code); |
| 267 | } | 270 | } |
| 268 | 271 | ||
| 272 | error = e.error; | ||
| 273 | |||
| 269 | failed_set_error: | 274 | failed_set_error: |
| 270 | vc->error = error; | 275 | vc->error = error; |
| 271 | failed: | 276 | failed: |
| @@ -1798,7 +1798,6 @@ static struct btrfs_block_group *btrfs_create_block_group_cache( · 1797 unmodified lines | |||
| 1798 | 1798 | ||
| 1799 | cache->fs_info = fs_info; | 1799 | cache->fs_info = fs_info; |
| 1800 | cache->full_stripe_len = btrfs_full_stripe_len(fs_info, start); | 1800 | cache->full_stripe_len = btrfs_full_stripe_len(fs_info, start); |
| 1801 | set_free_space_tree_thresholds(cache); | ||
| 1802 | 1801 | ||
| 1803 | cache->discard_index = BTRFS_DISCARD_INDEX_UNUSED; | 1802 | cache->discard_index = BTRFS_DISCARD_INDEX_UNUSED; |
| 1804 | 1803 | ||
| @@ -1912,6 +1911,8 @@ static int read_one_block_group(struct btrfs_fs_info *info, · 107 unmodified lines | |||
| 1912 | if (ret < 0) | 1911 | if (ret < 0) |
| 1913 | goto error; | 1912 | goto error; |
| 1914 | 1913 | ||
| 1914 | set_free_space_tree_thresholds(cache); | ||
| 1915 | |||
| 1915 | if (need_clear) { | 1916 | if (need_clear) { |
| 1916 | /* | 1917 | /* |
| 1917 | * When we mount with old space cache, we need to | 1918 | * When we mount with old space cache, we need to |
| @@ -2132,6 +2133,7 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used, · 214 unmodified lines | |||
| 2132 | return -ENOMEM; | 2133 | return -ENOMEM; |
| 2133 | 2134 | ||
| 2134 | cache->length = size; | 2135 | cache->length = size; |
| 2136 | set_free_space_tree_thresholds(cache); | ||
| 2135 | cache->used = bytes_used; | 2137 | cache->used = bytes_used; |
| 2136 | cache->flags = type; | 2138 | cache->flags = type; |
| 2137 | cache->last_byte_to_unpin = (u64)-1; | 2139 | cache->last_byte_to_unpin = (u64)-1; |
| @@ -1297,6 +1297,8 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path, · 1296 unmodified lines | |||
| 1297 | btrfs_tree_read_unlock_blocking(eb); | 1297 | btrfs_tree_read_unlock_blocking(eb); |
| 1298 | free_extent_buffer(eb); | 1298 | free_extent_buffer(eb); |
| 1299 | 1299 | ||
| 1300 | btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb_rewin), | ||
| 1301 | eb_rewin, btrfs_header_level(eb_rewin)); | ||
| 1300 | btrfs_tree_read_lock(eb_rewin); | 1302 | btrfs_tree_read_lock(eb_rewin); |
| 1301 | __tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm); | 1303 | __tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm); |
| 1302 | WARN_ON(btrfs_header_nritems(eb_rewin) > | 1304 | WARN_ON(btrfs_header_nritems(eb_rewin) > |
| @@ -1370,7 +1372,6 @@ get_old_root(struct btrfs_root *root, u64 time_seq) · 67 unmodified lines | |||
| 1370 | 1372 | ||
| 1371 | if (!eb) | 1373 | if (!eb) |
| 1372 | return NULL; | 1374 | return NULL; |
| 1373 | btrfs_tree_read_lock(eb); | ||
| 1374 | if (old_root) { | 1375 | if (old_root) { |
| 1375 | btrfs_set_header_bytenr(eb, eb->start); | 1376 | btrfs_set_header_bytenr(eb, eb->start); |
| 1376 | btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV); | 1377 | btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV); |
| @@ -1378,6 +1379,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq) · 1 unmodified line | |||
| 1378 | btrfs_set_header_level(eb, old_root->level); | 1379 | btrfs_set_header_level(eb, old_root->level); |
| 1379 | btrfs_set_header_generation(eb, old_generation); | 1380 | btrfs_set_header_generation(eb, old_generation); |
| 1380 | } | 1381 | } |
| 1382 | btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb), eb, | ||
| 1383 | btrfs_header_level(eb)); | ||
| 1384 | btrfs_tree_read_lock(eb); | ||
| 1381 | if (tm) | 1385 | if (tm) |
| 1382 | __tree_mod_log_rewind(fs_info, eb, time_seq, tm); | 1386 | __tree_mod_log_rewind(fs_info, eb, time_seq, tm); |
| 1383 | else | 1387 | else |
| @@ -3418,6 +3418,8 @@ fail_block_groups: · 3417 unmodified lines | |||
| 3418 | btrfs_put_block_group_cache(fs_info); | 3418 | btrfs_put_block_group_cache(fs_info); |
| 3419 | 3419 | ||
| 3420 | fail_tree_roots: | 3420 | fail_tree_roots: |
| 3421 | if (fs_info->data_reloc_root) | ||
| 3422 | btrfs_drop_and_free_fs_root(fs_info, fs_info->data_reloc_root); | ||
| 3421 | free_root_pointers(fs_info, true); | 3423 | free_root_pointers(fs_info, true); |
| 3422 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); | 3424 | invalidate_inode_pages2(fs_info->btree_inode->i_mapping); |
| 3423 | 3425 | ||
| @@ -400,12 +400,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, · 399 unmodified lines | |||
| 400 | if (type == BTRFS_SHARED_BLOCK_REF_KEY) { | 400 | if (type == BTRFS_SHARED_BLOCK_REF_KEY) { |
| 401 | ASSERT(eb->fs_info); | 401 | ASSERT(eb->fs_info); |
| 402 | /* | 402 | /* |
| 403 | * Every shared one has parent tree | 403 | * Every shared one has parent tree block, |
| 404 | * block, which must be aligned to | 404 | * which must be aligned to sector size. |
| 405 | * nodesize. | ||
| 406 | */ | 405 | */ |
| 407 | if (offset && | 406 | if (offset && |
| 408 | IS_ALIGNED(offset, eb->fs_info->nodesize)) | 407 | IS_ALIGNED(offset, eb->fs_info->sectorsize)) |
| 409 | return type; | 408 | return type; |
| 410 | } | 409 | } |
| 411 | } else if (is_data == BTRFS_REF_TYPE_DATA) { | 410 | } else if (is_data == BTRFS_REF_TYPE_DATA) { |
| @@ -414,12 +413,11 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, · 2 unmodified lines | |||
| 414 | if (type == BTRFS_SHARED_DATA_REF_KEY) { | 413 | if (type == BTRFS_SHARED_DATA_REF_KEY) { |
| 415 | ASSERT(eb->fs_info); | 414 | ASSERT(eb->fs_info); |
| 416 | /* | 415 | /* |
| 417 | * Every shared one has parent tree | 416 | * Every shared one has parent tree block, |
| 418 | * block, which must be aligned to | 417 | * which must be aligned to sector size. |
| 419 | * nodesize. | ||
| 420 | */ | 418 | */ |
| 421 | if (offset && | 419 | if (offset && |
| 422 | IS_ALIGNED(offset, eb->fs_info->nodesize)) | 420 | IS_ALIGNED(offset, eb->fs_info->sectorsize)) |
| 423 | return type; | 421 | return type; |
| 424 | } | 422 | } |
| 425 | } else { | 423 | } else { |
| @@ -429,8 +427,9 @@ int btrfs_get_extent_inline_ref_type(const struct extent_buffer *eb, · 3 unmodified lines | |||
| 429 | } | 427 | } |
| 430 | 428 | ||
| 431 | btrfs_print_leaf((struct extent_buffer *)eb); | 429 | btrfs_print_leaf((struct extent_buffer *)eb); |
| 432 | btrfs_err(eb->fs_info, "eb %llu invalid extent inline ref type %d", | 430 | btrfs_err(eb->fs_info, |
| 433 | eb->start, type); | 431 | "eb %llu iref 0x%lx invalid extent inline ref type %d", |
| 432 | eb->start, (unsigned long)iref, type); | ||
| 434 | WARN_ON(1); | 433 | WARN_ON(1); |
| 435 | 434 | ||
| 436 | return BTRFS_REF_TYPE_INVALID; | 435 | return BTRFS_REF_TYPE_INVALID; |
| @@ -4527,7 +4526,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, · 4090 unmodified lines | |||
| 4527 | return ERR_PTR(-EUCLEAN); | 4526 | return ERR_PTR(-EUCLEAN); |
| 4528 | } | 4527 | } |
| 4529 | 4528 | ||
| 4530 | btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level); | 4529 | btrfs_set_buffer_lockdep_class(owner, buf, level); |
| 4531 | btrfs_tree_lock(buf); | 4530 | btrfs_tree_lock(buf); |
| 4532 | btrfs_clean_tree_block(buf); | 4531 | btrfs_clean_tree_block(buf); |
| 4533 | clear_bit(EXTENT_BUFFER_STALE, &buf->bflags); | 4532 | clear_bit(EXTENT_BUFFER_STALE, &buf->bflags); |
| @@ -5655,9 +5655,9 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dstv, · 5654 unmodified lines | |||
| 5655 | } | 5655 | } |
| 5656 | } | 5656 | } |
| 5657 | 5657 | ||
| 5658 | int read_extent_buffer_to_user(const struct extent_buffer *eb, | 5658 | int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb, |
| 5659 | void __user *dstv, | 5659 | void __user *dstv, |
| 5660 | unsigned long start, unsigned long len) | 5660 | unsigned long start, unsigned long len) |
| 5661 | { | 5661 | { |
| 5662 | size_t cur; | 5662 | size_t cur; |
| 5663 | size_t offset; | 5663 | size_t offset; |
| @@ -5677,7 +5677,7 @@ int read_extent_buffer_to_user(const struct extent_buffer *eb, · 13 unmodified lines | |||
| 5677 | 5677 | ||
| 5678 | cur = min(len, (PAGE_SIZE - offset)); | 5678 | cur = min(len, (PAGE_SIZE - offset)); |
| 5679 | kaddr = page_address(page); | 5679 | kaddr = page_address(page); |
| 5680 | if (copy_to_user(dst, kaddr + offset, cur)) { | 5680 | if (copy_to_user_nofault(dst, kaddr + offset, cur)) { |
| 5681 | ret = -EFAULT; | 5681 | ret = -EFAULT; |
| 5682 | break; | 5682 | break; |
| 5683 | } | 5683 | } |
| @@ -241,9 +241,9 @@ int memcmp_extent_buffer(const struct extent_buffer *eb, const void *ptrv, · 240 unmodified lines | |||
| 241 | void read_extent_buffer(const struct extent_buffer *eb, void *dst, | 241 | void read_extent_buffer(const struct extent_buffer *eb, void *dst, |
| 242 | unsigned long start, | 242 | unsigned long start, |
| 243 | unsigned long len); | 243 | unsigned long len); |
| 244 | int read_extent_buffer_to_user(const struct extent_buffer *eb, | 244 | int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb, |
| 245 | void __user *dst, unsigned long start, | 245 | void __user *dst, unsigned long start, |
| 246 | unsigned long len); | 246 | unsigned long len); |
| 247 | void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *src); | 247 | void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *src); |
| 248 | void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb, | 248 | void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb, |
| 249 | const void *src); | 249 | const void *src); |
| @@ -22,6 +22,10 @@ void set_free_space_tree_thresholds(struct btrfs_block_group *cache) · 21 unmodified lines | |||
| 22 | size_t bitmap_size; | 22 | size_t bitmap_size; |
| 23 | u64 num_bitmaps, total_bitmap_size; | 23 | u64 num_bitmaps, total_bitmap_size; |
| 24 | 24 | ||
| 25 | if (WARN_ON(cache->length == 0)) | ||
| 26 | btrfs_warn(cache->fs_info, "block group %llu length is zero", | ||
| 27 | cache->start); | ||
| 28 | |||
| 25 | /* | 29 | /* |
| 26 | * We convert to bitmaps when the disk space required for using extents | 30 | * We convert to bitmaps when the disk space required for using extents |
| 27 | * exceeds that required for using bitmaps. | 31 | * exceeds that required for using bitmaps. |
| @@ -2086,9 +2086,14 @@ static noinline int copy_to_sk(struct btrfs_path *path, · 2085 unmodified lines | |||
| 2086 | sh.len = item_len; | 2086 | sh.len = item_len; |
| 2087 | sh.transid = found_transid; | 2087 | sh.transid = found_transid; |
| 2088 | 2088 | ||
| 2089 | /* copy search result header */ | 2089 | /* |
| 2090 | if (copy_to_user(ubuf + *sk_offset, &sh, sizeof(sh))) { | 2090 | * Copy search result header. If we fault then loop again so we |
| 2091 | ret = -EFAULT; | 2091 | * can fault in the pages and -EFAULT there if there's a |
| 2092 | * problem. Otherwise we'll fault and then copy the buffer in | ||
| 2093 | * properly this next time through | ||
| 2094 | */ | ||
| 2095 | if (copy_to_user_nofault(ubuf + *sk_offset, &sh, sizeof(sh))) { | ||
| 2096 | ret = 0; | ||
| 2092 | goto out; | 2097 | goto out; |
| 2093 | } | 2098 | } |
| 2094 | 2099 | ||
| @@ -2096,10 +2101,14 @@ static noinline int copy_to_sk(struct btrfs_path *path, · 1 unmodified line | |||
| 2096 | 2101 | ||
| 2097 | if (item_len) { | 2102 | if (item_len) { |
| 2098 | char __user *up = ubuf + *sk_offset; | 2103 | char __user *up = ubuf + *sk_offset; |
| 2099 | /* copy the item */ | 2104 | /* |
| 2100 | if (read_extent_buffer_to_user(leaf, up, | 2105 | * Copy the item, same behavior as above, but reset the |
| 2101 | item_off, item_len)) { | 2106 | * * sk_offset so we copy the full thing again. |
| 2102 | ret = -EFAULT; | 2107 | */ |
| 2108 | if (read_extent_buffer_to_user_nofault(leaf, up, | ||
| 2109 | item_off, item_len)) { | ||
| 2110 | ret = 0; | ||
| 2111 | *sk_offset -= sizeof(sh); | ||
| 2103 | goto out; | 2112 | goto out; |
| 2104 | } | 2113 | } |
| 2105 | 2114 | ||
| @@ -2184,6 +2193,10 @@ static noinline int search_ioctl(struct inode *inode, · 78 unmodified lines | |||
| 2184 | key.offset = sk->min_offset; | 2193 | key.offset = sk->min_offset; |
| 2185 | 2194 | ||
| 2186 | while (1) { | 2195 | while (1) { |
| 2196 | ret = fault_in_pages_writeable(ubuf, *buf_size - sk_offset); | ||
| 2197 | if (ret) | ||
| 2198 | break; | ||
| 2199 | |||
| 2187 | ret = btrfs_search_forward(root, &key, path, sk->min_transid); | 2200 | ret = btrfs_search_forward(root, &key, path, sk->min_transid); |
| 2188 | if (ret != 0) { | 2201 | if (ret != 0) { |
| 2189 | if (ret > 0) | 2202 | if (ret > 0) |
| @@ -95,9 +95,10 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) · 94 unmodified lines | |||
| 95 | * offset is supposed to be a tree block which | 95 | * offset is supposed to be a tree block which |
| 96 | * must be aligned to nodesize. | 96 | * must be aligned to nodesize. |
| 97 | */ | 97 | */ |
| 98 | if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) | 98 | if (!IS_ALIGNED(offset, eb->fs_info->sectorsize)) |
| 99 | pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n", | 99 | pr_info( |
| 100 | offset, (unsigned long long)eb->fs_info->nodesize); | 100 | "\t\t\t(parent %llu not aligned to sectorsize %u)\n", |
| 101 | offset, eb->fs_info->sectorsize); | ||
| 101 | break; | 102 | break; |
| 102 | case BTRFS_EXTENT_DATA_REF_KEY: | 103 | case BTRFS_EXTENT_DATA_REF_KEY: |
| 103 | dref = (struct btrfs_extent_data_ref *)(&iref->offset); | 104 | dref = (struct btrfs_extent_data_ref *)(&iref->offset); |
| @@ -112,8 +113,9 @@ static void print_extent_item(struct extent_buffer *eb, int slot, int type) · 8 unmodified lines | |||
| 112 | * must be aligned to nodesize. | 113 | * must be aligned to nodesize. |
| 113 | */ | 114 | */ |
| 114 | if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) | 115 | if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) |
| 115 | pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n", | 116 | pr_info( |
| 116 | offset, (unsigned long long)eb->fs_info->nodesize); | 117 | "\t\t\t(parent %llu not aligned to sectorsize %u)\n", |
| 118 | offset, eb->fs_info->sectorsize); | ||
| 117 | break; | 119 | break; |
| 118 | default: | 120 | default: |
| 119 | pr_cont("(extent %llu has INVALID ref type %d)\n", | 121 | pr_cont("(extent %llu has INVALID ref type %d)\n", |
| @@ -3716,50 +3716,84 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx, · 3715 unmodified lines | |||
| 3716 | return 0; | 3716 | return 0; |
| 3717 | } | 3717 | } |
| 3718 | 3718 | ||
| 3719 | static void scrub_workers_put(struct btrfs_fs_info *fs_info) | ||
| 3720 | { | ||
| 3721 | if (refcount_dec_and_mutex_lock(&fs_info->scrub_workers_refcnt, | ||
| 3722 | &fs_info->scrub_lock)) { | ||
| 3723 | struct btrfs_workqueue *scrub_workers = NULL; | ||
| 3724 | struct btrfs_workqueue *scrub_wr_comp = NULL; | ||
| 3725 | struct btrfs_workqueue *scrub_parity = NULL; | ||
| 3726 | |||
| 3727 | scrub_workers = fs_info->scrub_workers; | ||
| 3728 | scrub_wr_comp = fs_info->scrub_wr_completion_workers; | ||
| 3729 | scrub_parity = fs_info->scrub_parity_workers; | ||
| 3730 | |||
| 3731 | fs_info->scrub_workers = NULL; | ||
| 3732 | fs_info->scrub_wr_completion_workers = NULL; | ||
| 3733 | fs_info->scrub_parity_workers = NULL; | ||
| 3734 | mutex_unlock(&fs_info->scrub_lock); | ||
| 3735 | |||
| 3736 | btrfs_destroy_workqueue(scrub_workers); | ||
| 3737 | btrfs_destroy_workqueue(scrub_wr_comp); | ||
| 3738 | btrfs_destroy_workqueue(scrub_parity); | ||
| 3739 | } | ||
| 3740 | } | ||
| 3741 | |||
| 3719 | /* | 3742 | /* |
| 3720 | * get a reference count on fs_info->scrub_workers. start worker if necessary | 3743 | * get a reference count on fs_info->scrub_workers. start worker if necessary |
| 3721 | */ | 3744 | */ |
| 3722 | static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info, | 3745 | static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info, |
| 3723 | int is_dev_replace) | 3746 | int is_dev_replace) |
| 3724 | { | 3747 | { |
| 3748 | struct btrfs_workqueue *scrub_workers = NULL; | ||
| 3749 | struct btrfs_workqueue *scrub_wr_comp = NULL; | ||
| 3750 | struct btrfs_workqueue *scrub_parity = NULL; | ||
| 3725 | unsigned int flags = WQ_FREEZABLE | WQ_UNBOUND; | 3751 | unsigned int flags = WQ_FREEZABLE | WQ_UNBOUND; |
| 3726 | int max_active = fs_info->thread_pool_size; | 3752 | int max_active = fs_info->thread_pool_size; |
| 3753 | int ret = -ENOMEM; | ||
| 3727 | 3754 | ||
| 3728 | lockdep_assert_held(&fs_info->scrub_lock); | 3755 | if (refcount_inc_not_zero(&fs_info->scrub_workers_refcnt)) |
| 3756 | return 0; | ||
| 3729 | 3757 | ||
| 3730 | if (refcount_read(&fs_info->scrub_workers_refcnt) == 0) { | 3758 | scrub_workers = btrfs_alloc_workqueue(fs_info, "scrub", flags, |
| 3731 | ASSERT(fs_info->scrub_workers == NULL); | 3759 | is_dev_replace ? 1 : max_active, 4); |
| 3732 | fs_info->scrub_workers = btrfs_alloc_workqueue(fs_info, "scrub", | 3760 | if (!scrub_workers) |
| 3733 | flags, is_dev_replace ? 1 : max_active, 4); | 3761 | goto fail_scrub_workers; |
| 3734 | if (!fs_info->scrub_workers) | ||
| 3735 | goto fail_scrub_workers; | ||
| 3736 | |||
| 3737 | ASSERT(fs_info->scrub_wr_completion_workers == NULL); | ||
| 3738 | fs_info->scrub_wr_completion_workers = | ||
| 3739 | btrfs_alloc_workqueue(fs_info, "scrubwrc", flags, | ||
| 3740 | max_active, 2); | ||
| 3741 | if (!fs_info->scrub_wr_completion_workers) | ||
| 3742 | goto fail_scrub_wr_completion_workers; | ||
| 3743 | 3762 | ||
| 3744 | ASSERT(fs_info->scrub_parity_workers == NULL); | 3763 | scrub_wr_comp = btrfs_alloc_workqueue(fs_info, "scrubwrc", flags, |
| 3745 | fs_info->scrub_parity_workers = | ||
| 3746 | btrfs_alloc_workqueue(fs_info, "scrubparity", flags, | ||
| 3747 | max_active, 2); | 3764 | max_active, 2); |
| 3748 | if (!fs_info->scrub_parity_workers) | 3765 | if (!scrub_wr_comp) |
| 3749 | goto fail_scrub_parity_workers; | 3766 | goto fail_scrub_wr_completion_workers; |
| 3750 | 3767 | ||
| 3768 | scrub_parity = btrfs_alloc_workqueue(fs_info, "scrubparity", flags, | ||
| 3769 | max_active, 2); | ||
| 3770 | if (!scrub_parity) | ||
| 3771 | goto fail_scrub_parity_workers; | ||
| 3772 | |||
| 3773 | mutex_lock(&fs_info->scrub_lock); | ||
| 3774 | if (refcount_read(&fs_info->scrub_workers_refcnt) == 0) { | ||
| 3775 | ASSERT(fs_info->scrub_workers == NULL && | ||
| 3776 | fs_info->scrub_wr_completion_workers == NULL && | ||
| 3777 | fs_info->scrub_parity_workers == NULL); | ||
| 3778 | fs_info->scrub_workers = scrub_workers; | ||
| 3779 | fs_info->scrub_wr_completion_workers = scrub_wr_comp; | ||
| 3780 | fs_info->scrub_parity_workers = scrub_parity; | ||
| 3751 | refcount_set(&fs_info->scrub_workers_refcnt, 1); | 3781 | refcount_set(&fs_info->scrub_workers_refcnt, 1); |
| 3752 | } else { | 3782 | mutex_unlock(&fs_info->scrub_lock); |
| 3753 | refcount_inc(&fs_info->scrub_workers_refcnt); | 3783 | return 0; |
| 3754 | } | 3784 | } |
| 3755 | return 0; | 3785 | /* Other thread raced in and created the workers for us */ |
| 3786 | refcount_inc(&fs_info->scrub_workers_refcnt); | ||
| 3787 | mutex_unlock(&fs_info->scrub_lock); | ||
| 3756 | 3788 | ||
| 3789 | ret = 0; | ||
| 3790 | btrfs_destroy_workqueue(scrub_parity); | ||
| 3757 | fail_scrub_parity_workers: | 3791 | fail_scrub_parity_workers: |
| 3758 | btrfs_destroy_workqueue(fs_info->scrub_wr_completion_workers); | 3792 | btrfs_destroy_workqueue(scrub_wr_comp); |
| 3759 | fail_scrub_wr_completion_workers: | 3793 | fail_scrub_wr_completion_workers: |
| 3760 | btrfs_destroy_workqueue(fs_info->scrub_workers); | 3794 | btrfs_destroy_workqueue(scrub_workers); |
| 3761 | fail_scrub_workers: | 3795 | fail_scrub_workers: |
| 3762 | return -ENOMEM; | 3796 | return ret; |
| 3763 | } | 3797 | } |
| 3764 | 3798 | ||
| 3765 | int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, | 3799 | int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, |
| @@ -3770,9 +3804,6 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 4 unmodified lines | |||
| 3770 | int ret; | 3804 | int ret; |
| 3771 | struct btrfs_device *dev; | 3805 | struct btrfs_device *dev; |
| 3772 | unsigned int nofs_flag; | 3806 | unsigned int nofs_flag; |
| 3773 | struct btrfs_workqueue *scrub_workers = NULL; | ||
| 3774 | struct btrfs_workqueue *scrub_wr_comp = NULL; | ||
| 3775 | struct btrfs_workqueue *scrub_parity = NULL; | ||
| 3776 | 3807 | ||
| 3777 | if (btrfs_fs_closing(fs_info)) | 3808 | if (btrfs_fs_closing(fs_info)) |
| 3778 | return -EAGAIN; | 3809 | return -EAGAIN; |
| @@ -3819,13 +3850,17 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 40 unmodified lines | |||
| 3819 | if (IS_ERR(sctx)) | 3850 | if (IS_ERR(sctx)) |
| 3820 | return PTR_ERR(sctx); | 3851 | return PTR_ERR(sctx); |
| 3821 | 3852 | ||
| 3853 | ret = scrub_workers_get(fs_info, is_dev_replace); | ||
| 3854 | if (ret) | ||
| 3855 | goto out_free_ctx; | ||
| 3856 | |||
| 3822 | mutex_lock(&fs_info->fs_devices->device_list_mutex); | 3857 | mutex_lock(&fs_info->fs_devices->device_list_mutex); |
| 3823 | dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true); | 3858 | dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true); |
| 3824 | if (!dev || (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) && | 3859 | if (!dev || (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) && |
| 3825 | !is_dev_replace)) { | 3860 | !is_dev_replace)) { |
| 3826 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); | 3861 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); |
| 3827 | ret = -ENODEV; | 3862 | ret = -ENODEV; |
| 3828 | goto out_free_ctx; | 3863 | goto out; |
| 3829 | } | 3864 | } |
| 3830 | 3865 | ||
| 3831 | if (!is_dev_replace && !readonly && | 3866 | if (!is_dev_replace && !readonly && |
| @@ -3834,7 +3869,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 2 unmodified lines | |||
| 3834 | btrfs_err_in_rcu(fs_info, "scrub: device %s is not writable", | 3869 | btrfs_err_in_rcu(fs_info, "scrub: device %s is not writable", |
| 3835 | rcu_str_deref(dev->name)); | 3870 | rcu_str_deref(dev->name)); |
| 3836 | ret = -EROFS; | 3871 | ret = -EROFS; |
| 3837 | goto out_free_ctx; | 3872 | goto out; |
| 3838 | } | 3873 | } |
| 3839 | 3874 | ||
| 3840 | mutex_lock(&fs_info->scrub_lock); | 3875 | mutex_lock(&fs_info->scrub_lock); |
| @@ -3843,7 +3878,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 2 unmodified lines | |||
| 3843 | mutex_unlock(&fs_info->scrub_lock); | 3878 | mutex_unlock(&fs_info->scrub_lock); |
| 3844 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); | 3879 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); |
| 3845 | ret = -EIO; | 3880 | ret = -EIO; |
| 3846 | goto out_free_ctx; | 3881 | goto out; |
| 3847 | } | 3882 | } |
| 3848 | 3883 | ||
| 3849 | down_read(&fs_info->dev_replace.rwsem); | 3884 | down_read(&fs_info->dev_replace.rwsem); |
| @@ -3854,17 +3889,10 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 4 unmodified lines | |||
| 3854 | mutex_unlock(&fs_info->scrub_lock); | 3889 | mutex_unlock(&fs_info->scrub_lock); |
| 3855 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); | 3890 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); |
| 3856 | ret = -EINPROGRESS; | 3891 | ret = -EINPROGRESS; |
| 3857 | goto out_free_ctx; | 3892 | goto out; |
| 3858 | } | 3893 | } |
| 3859 | up_read(&fs_info->dev_replace.rwsem); | 3894 | up_read(&fs_info->dev_replace.rwsem); |
| 3860 | 3895 | ||
| 3861 | ret = scrub_workers_get(fs_info, is_dev_replace); | ||
| 3862 | if (ret) { | ||
| 3863 | mutex_unlock(&fs_info->scrub_lock); | ||
| 3864 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); | ||
| 3865 | goto out_free_ctx; | ||
| 3866 | } | ||
| 3867 | |||
| 3868 | sctx->readonly = readonly; | 3896 | sctx->readonly = readonly; |
| 3869 | dev->scrub_ctx = sctx; | 3897 | dev->scrub_ctx = sctx; |
| 3870 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); | 3898 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); |
| @@ -3917,24 +3945,14 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, · 46 unmodified lines | |||
| 3917 | 3945 | ||
| 3918 | mutex_lock(&fs_info->scrub_lock); | 3946 | mutex_lock(&fs_info->scrub_lock); |
| 3919 | dev->scrub_ctx = NULL; | 3947 | dev->scrub_ctx = NULL; |
| 3920 | if (refcount_dec_and_test(&fs_info->scrub_workers_refcnt)) { | ||
| 3921 | scrub_workers = fs_info->scrub_workers; | ||
| 3922 | scrub_wr_comp = fs_info->scrub_wr_completion_workers; | ||
| 3923 | scrub_parity = fs_info->scrub_parity_workers; | ||
| 3924 | |||
| 3925 | fs_info->scrub_workers = NULL; | ||
| 3926 | fs_info->scrub_wr_completion_workers = NULL; | ||
| 3927 | fs_info->scrub_parity_workers = NULL; | ||
| 3928 | } | ||
| 3929 | mutex_unlock(&fs_info->scrub_lock); | 3948 | mutex_unlock(&fs_info->scrub_lock); |
| 3930 | 3949 | ||
| 3931 | btrfs_destroy_workqueue(scrub_workers); | 3950 | scrub_workers_put(fs_info); |
| 3932 | btrfs_destroy_workqueue(scrub_wr_comp); | ||
| 3933 | btrfs_destroy_workqueue(scrub_parity); | ||
| 3934 | scrub_put_ctx(sctx); | 3951 | scrub_put_ctx(sctx); |
| 3935 | 3952 | ||
| 3936 | return ret; | 3953 | return ret; |
| 3937 | 3954 | out: | |
| 3955 | scrub_workers_put(fs_info); | ||
| 3938 | out_free_ctx: | 3956 | out_free_ctx: |
| 3939 | scrub_free_ctx(sctx); | 3957 | scrub_free_ctx(sctx); |
| 3940 | 3958 | ||
| @@ -1636,6 +1636,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, · 1635 unmodified lines | |||
| 1636 | pending->snap = btrfs_get_new_fs_root(fs_info, objectid, pending->anon_dev); | 1636 | pending->snap = btrfs_get_new_fs_root(fs_info, objectid, pending->anon_dev); |
| 1637 | if (IS_ERR(pending->snap)) { | 1637 | if (IS_ERR(pending->snap)) { |
| 1638 | ret = PTR_ERR(pending->snap); | 1638 | ret = PTR_ERR(pending->snap); |
| 1639 | pending->snap = NULL; | ||
| 1639 | btrfs_abort_transaction(trans, ret); | 1640 | btrfs_abort_transaction(trans, ret); |
| 1640 | goto fail; | 1641 | goto fail; |
| 1641 | } | 1642 | } |
| @@ -984,7 +984,7 @@ static int check_inode_item(struct extent_buffer *leaf, · 983 unmodified lines | |||
| 984 | /* Note for ROOT_TREE_DIR_ITEM, mkfs could set its transid 0 */ | 984 | /* Note for ROOT_TREE_DIR_ITEM, mkfs could set its transid 0 */ |
| 985 | if (btrfs_inode_transid(leaf, iitem) > super_gen + 1) { | 985 | if (btrfs_inode_transid(leaf, iitem) > super_gen + 1) { |
| 986 | inode_item_err(leaf, slot, | 986 | inode_item_err(leaf, slot, |
| 987 | "invalid inode generation: has %llu expect [0, %llu]", | 987 | "invalid inode transid: has %llu expect [0, %llu]", |
| 988 | btrfs_inode_transid(leaf, iitem), super_gen + 1); | 988 | btrfs_inode_transid(leaf, iitem), super_gen + 1); |
| 989 | return -EUCLEAN; | 989 | return -EUCLEAN; |
| 990 | } | 990 | } |
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
| 7 | #include <linux/sched/mm.h> | ||
| 7 | #include <linux/bio.h> | 8 | #include <linux/bio.h> |
| 8 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
| 9 | #include <linux/blkdev.h> | 10 | #include <linux/blkdev.h> |
| @@ -4462,6 +4463,7 @@ int btrfs_uuid_scan_kthread(void *data) · 4452 unmodified lines | |||
| 4462 | goto skip; | 4463 | goto skip; |
| 4463 | } | 4464 | } |
| 4464 | update_tree: | 4465 | update_tree: |
| 4466 | btrfs_release_path(path); | ||
| 4465 | if (!btrfs_is_empty_uuid(root_item.uuid)) { | 4467 | if (!btrfs_is_empty_uuid(root_item.uuid)) { |
| 4466 | ret = btrfs_uuid_tree_add(trans, root_item.uuid, | 4468 | ret = btrfs_uuid_tree_add(trans, root_item.uuid, |
| 4467 | BTRFS_UUID_KEY_SUBVOL, | 4469 | BTRFS_UUID_KEY_SUBVOL, |
| @@ -4486,6 +4488,7 @@ update_tree: · 18 unmodified lines | |||
| 4486 | } | 4488 | } |
| 4487 | 4489 | ||
| 4488 | skip: | 4490 | skip: |
| 4491 | btrfs_release_path(path); | ||
| 4489 | if (trans) { | 4492 | if (trans) { |
| 4490 | ret = btrfs_end_transaction(trans); | 4493 | ret = btrfs_end_transaction(trans); |
| 4491 | trans = NULL; | 4494 | trans = NULL; |
| @@ -4493,7 +4496,6 @@ skip: · 1 unmodified line | |||
| 4493 | break; | 4496 | break; |
| 4494 | } | 4497 | } |
| 4495 | 4498 | ||
| 4496 | btrfs_release_path(path); | ||
| 4497 | if (key.offset < (u64)-1) { | 4499 | if (key.offset < (u64)-1) { |
| 4498 | key.offset++; | 4500 | key.offset++; |
| 4499 | } else if (key.type < BTRFS_ROOT_ITEM_KEY) { | 4501 | } else if (key.type < BTRFS_ROOT_ITEM_KEY) { |
| @@ -6483,8 +6485,17 @@ static struct btrfs_device *add_missing_dev(struct btrfs_fs_devices *fs_devices, · 1983 unmodified lines | |||
| 6483 | u64 devid, u8 *dev_uuid) | 6485 | u64 devid, u8 *dev_uuid) |
| 6484 | { | 6486 | { |
| 6485 | struct btrfs_device *device; | 6487 | struct btrfs_device *device; |
| 6488 | unsigned int nofs_flag; | ||
| 6486 | 6489 | ||
| 6490 | /* | ||
| 6491 | * We call this under the chunk_mutex, so we want to use NOFS for this | ||
| 6492 | * allocation, however we don't want to change btrfs_alloc_device() to | ||
| 6493 | * always do NOFS because we use it in a lot of other GFP_KERNEL safe | ||
| 6494 | * places. | ||
| 6495 | */ | ||
| 6496 | nofs_flag = memalloc_nofs_save(); | ||
| 6487 | device = btrfs_alloc_device(NULL, &devid, dev_uuid); | 6497 | device = btrfs_alloc_device(NULL, &devid, dev_uuid); |
| 6498 | memalloc_nofs_restore(nofs_flag); | ||
| 6488 | if (IS_ERR(device)) | 6499 | if (IS_ERR(device)) |
| 6489 | return device; | 6500 | return device; |
| 6490 | 6501 | ||
| @@ -1017,6 +1017,8 @@ handle_mnt_opt: · 1016 unmodified lines | |||
| 1017 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID) { | 1017 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID) { |
| 1018 | rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, true, | 1018 | rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, true, |
| 1019 | full_path, fid); | 1019 | full_path, fid); |
| 1020 | if (rc == -EREMOTE) | ||
| 1021 | rc = 0; | ||
| 1020 | if (rc) { | 1022 | if (rc) { |
| 1021 | cifs_dbg(FYI, "%s: Get mode from SID failed. rc=%d\n", | 1023 | cifs_dbg(FYI, "%s: Get mode from SID failed. rc=%d\n", |
| 1022 | __func__, rc); | 1024 | __func__, rc); |
| @@ -1025,6 +1027,8 @@ handle_mnt_opt: · 2 unmodified lines | |||
| 1025 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | 1027 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { |
| 1026 | rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, false, | 1028 | rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, false, |
| 1027 | full_path, fid); | 1029 | full_path, fid); |
| 1030 | if (rc == -EREMOTE) | ||
| 1031 | rc = 0; | ||
| 1028 | if (rc) { | 1032 | if (rc) { |
| 1029 | cifs_dbg(FYI, "%s: Getting ACL failed with error: %d\n", | 1033 | cifs_dbg(FYI, "%s: Getting ACL failed with error: %d\n", |
| 1030 | __func__, rc); | 1034 | __func__, rc); |
| @@ -177,7 +177,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp) · 176 unmodified lines | |||
| 177 | goto out; | 177 | goto out; |
| 178 | 178 | ||
| 179 | if (!fops_get(real_fops)) { | 179 | if (!fops_get(real_fops)) { |
| 180 | #ifdef MODULE | 180 | #ifdef CONFIG_MODULES |
| 181 | if (real_fops->owner && | 181 | if (real_fops->owner && |
| 182 | real_fops->owner->state == MODULE_STATE_GOING) | 182 | real_fops->owner->state == MODULE_STATE_GOING) |
| 183 | goto out; | 183 | goto out; |
| @@ -312,7 +312,7 @@ static int full_proxy_open(struct inode *inode, struct file *filp) · 128 unmodified lines | |||
| 312 | goto out; | 312 | goto out; |
| 313 | 313 | ||
| 314 | if (!fops_get(real_fops)) { | 314 | if (!fops_get(real_fops)) { |
| 315 | #ifdef MODULE | 315 | #ifdef CONFIG_MODULES |
| 316 | if (real_fops->owner && | 316 | if (real_fops->owner && |
| 317 | real_fops->owner->state == MODULE_STATE_GOING) | 317 | real_fops->owner->state == MODULE_STATE_GOING) |
| 318 | goto out; | 318 | goto out; |
| @@ -1995,9 +1995,9 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) · 1994 unmodified lines | |||
| 1995 | * during ep_insert(). | 1995 | * during ep_insert(). |
| 1996 | */ | 1996 | */ |
| 1997 | if (list_empty(&epi->ffd.file->f_tfile_llink)) { | 1997 | if (list_empty(&epi->ffd.file->f_tfile_llink)) { |
| 1998 | get_file(epi->ffd.file); | 1998 | if (get_file_rcu(epi->ffd.file)) |
| 1999 | list_add(&epi->ffd.file->f_tfile_llink, | 1999 | list_add(&epi->ffd.file->f_tfile_llink, |
| 2000 | &tfile_check_list); | 2000 | &tfile_check_list); |
| 2001 | } | 2001 | } |
| 2002 | } | 2002 | } |
| 2003 | } | 2003 | } |
| @@ -93,8 +93,10 @@ static vm_fault_t ext2_dax_fault(struct vm_fault *vmf) · 92 unmodified lines | |||
| 93 | struct inode *inode = file_inode(vmf->vma->vm_file); | 93 | struct inode *inode = file_inode(vmf->vma->vm_file); |
| 94 | struct ext2_inode_info *ei = EXT2_I(inode); | 94 | struct ext2_inode_info *ei = EXT2_I(inode); |
| 95 | vm_fault_t ret; | 95 | vm_fault_t ret; |
| 96 | bool write = (vmf->flags & FAULT_FLAG_WRITE) && | ||
| 97 | (vmf->vma->vm_flags & VM_SHARED); | ||
| 96 | 98 | ||
| 97 | if (vmf->flags & FAULT_FLAG_WRITE) { | 99 | if (write) { |
| 98 | sb_start_pagefault(inode->i_sb); | 100 | sb_start_pagefault(inode->i_sb); |
| 99 | file_update_time(vmf->vma->vm_file); | 101 | file_update_time(vmf->vma->vm_file); |
| 100 | } | 102 | } |
| @@ -103,7 +105,7 @@ static vm_fault_t ext2_dax_fault(struct vm_fault *vmf) · 2 unmodified lines | |||
| 103 | ret = dax_iomap_fault(vmf, PE_SIZE_PTE, NULL, NULL, &ext2_iomap_ops); | 105 | ret = dax_iomap_fault(vmf, PE_SIZE_PTE, NULL, NULL, &ext2_iomap_ops); |
| 104 | 106 | ||
| 105 | up_read(&ei->dax_sem); | 107 | up_read(&ei->dax_sem); |
| 106 | if (vmf->flags & FAULT_FLAG_WRITE) | 108 | if (write) |
| 107 | sb_end_pagefault(inode->i_sb); | 109 | sb_end_pagefault(inode->i_sb); |
| 108 | return ret; | 110 | return ret; |
| 109 | } | 111 | } |
| @@ -3550,6 +3550,9 @@ static int check_direct_IO(struct inode *inode, struct iov_iter *iter, · 3549 unmodified lines | |||
| 3550 | unsigned long align = offset | iov_iter_alignment(iter); | 3550 | unsigned long align = offset | iov_iter_alignment(iter); |
| 3551 | struct block_device *bdev = inode->i_sb->s_bdev; | 3551 | struct block_device *bdev = inode->i_sb->s_bdev; |
| 3552 | 3552 | ||
| 3553 | if (iov_iter_rw(iter) == READ && offset >= i_size_read(inode)) | ||
| 3554 | return 1; | ||
| 3555 | |||
| 3553 | if (align & blocksize_mask) { | 3556 | if (align & blocksize_mask) { |
| 3554 | if (bdev) | 3557 | if (bdev) |
| 3555 | blkbits = blksize_bits(bdev_logical_block_size(bdev)); | 3558 | blkbits = blksize_bits(bdev_logical_block_size(bdev)); |
| @@ -2373,6 +2373,9 @@ static int __f2fs_build_free_nids(struct f2fs_sb_info *sbi, · 2372 unmodified lines | |||
| 2373 | if (unlikely(nid >= nm_i->max_nid)) | 2373 | if (unlikely(nid >= nm_i->max_nid)) |
| 2374 | nid = 0; | 2374 | nid = 0; |
| 2375 | 2375 | ||
| 2376 | if (unlikely(nid % NAT_ENTRY_PER_BLOCK)) | ||
| 2377 | nid = NAT_BLOCK_OFFSET(nid) * NAT_ENTRY_PER_BLOCK; | ||
| 2378 | |||
| 2376 | /* Enough entries */ | 2379 | /* Enough entries */ |
| 2377 | if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK) | 2380 | if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK) |
| 2378 | return 0; | 2381 | return 0; |
| @@ -799,7 +799,7 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, · 798 unmodified lines | |||
| 799 | 799 | ||
| 800 | if (__is_large_section(sbi)) { | 800 | if (__is_large_section(sbi)) { |
| 801 | unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); | 801 | unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); |
| 802 | unsigned short valid_blocks = | 802 | block_t valid_blocks = |
| 803 | get_valid_blocks(sbi, segno, true); | 803 | get_valid_blocks(sbi, segno, true); |
| 804 | 804 | ||
| 805 | f2fs_bug_on(sbi, unlikely(!valid_blocks || | 805 | f2fs_bug_on(sbi, unlikely(!valid_blocks || |
| @@ -815,7 +815,7 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno, · 9 unmodified lines | |||
| 815 | enum dirty_type dirty_type) | 815 | enum dirty_type dirty_type) |
| 816 | { | 816 | { |
| 817 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); | 817 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); |
| 818 | unsigned short valid_blocks; | 818 | block_t valid_blocks; |
| 819 | 819 | ||
| 820 | if (test_and_clear_bit(segno, dirty_i->dirty_segmap[dirty_type])) | 820 | if (test_and_clear_bit(segno, dirty_i->dirty_segmap[dirty_type])) |
| 821 | dirty_i->nr_dirty[dirty_type]--; | 821 | dirty_i->nr_dirty[dirty_type]--; |
| @@ -4316,8 +4316,8 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi) · 3494 unmodified lines | |||
| 4316 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); | 4316 | struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); |
| 4317 | struct free_segmap_info *free_i = FREE_I(sbi); | 4317 | struct free_segmap_info *free_i = FREE_I(sbi); |
| 4318 | unsigned int segno = 0, offset = 0, secno; | 4318 | unsigned int segno = 0, offset = 0, secno; |
| 4319 | unsigned short valid_blocks; | 4319 | block_t valid_blocks; |
| 4320 | unsigned short blks_per_sec = BLKS_PER_SEC(sbi); | 4320 | block_t blks_per_sec = BLKS_PER_SEC(sbi); |
| 4321 | 4321 | ||
| 4322 | while (1) { | 4322 | while (1) { |
| 4323 | /* find dirty segment based on free segmap */ | 4323 | /* find dirty segment based on free segmap */ |
| @@ -2300,8 +2300,11 @@ end_req: · 2299 unmodified lines | |||
| 2300 | static bool io_rw_reissue(struct io_kiocb *req, long res) | 2300 | static bool io_rw_reissue(struct io_kiocb *req, long res) |
| 2301 | { | 2301 | { |
| 2302 | #ifdef CONFIG_BLOCK | 2302 | #ifdef CONFIG_BLOCK |
| 2303 | umode_t mode = file_inode(req->file)->i_mode; | ||
| 2303 | int ret; | 2304 | int ret; |
| 2304 | 2305 | ||
| 2306 | if (!S_ISBLK(mode) && !S_ISREG(mode)) | ||
| 2307 | return false; | ||
| 2305 | if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker()) | 2308 | if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker()) |
| 2306 | return false; | 2309 | return false; |
| 2307 | 2310 | ||
| @@ -2977,14 +2980,15 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw, · 669 unmodified lines | |||
| 2977 | bool force_nonblock) | 2980 | bool force_nonblock) |
| 2978 | { | 2981 | { |
| 2979 | struct io_async_rw *iorw = &req->io->rw; | 2982 | struct io_async_rw *iorw = &req->io->rw; |
| 2983 | struct iovec *iov; | ||
| 2980 | ssize_t ret; | 2984 | ssize_t ret; |
| 2981 | 2985 | ||
| 2982 | iorw->iter.iov = iorw->fast_iov; | 2986 | iorw->iter.iov = iov = iorw->fast_iov; |
| 2983 | ret = __io_import_iovec(rw, req, (struct iovec **) &iorw->iter.iov, | 2987 | ret = __io_import_iovec(rw, req, &iov, &iorw->iter, !force_nonblock); |
| 2984 | &iorw->iter, !force_nonblock); | ||
| 2985 | if (unlikely(ret < 0)) | 2988 | if (unlikely(ret < 0)) |
| 2986 | return ret; | 2989 | return ret; |
| 2987 | 2990 | ||
| 2991 | iorw->iter.iov = iov; | ||
| 2988 | io_req_map_rw(req, iorw->iter.iov, iorw->fast_iov, &iorw->iter); | 2992 | io_req_map_rw(req, iorw->iter.iov, iorw->fast_iov, &iorw->iter); |
| 2989 | return 0; | 2993 | return 0; |
| 2990 | } | 2994 | } |
| @@ -3146,6 +3150,9 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, · 155 unmodified lines | |||
| 3146 | /* IOPOLL retry should happen for io-wq threads */ | 3150 | /* IOPOLL retry should happen for io-wq threads */ |
| 3147 | if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL)) | 3151 | if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL)) |
| 3148 | goto done; | 3152 | goto done; |
| 3153 | /* no retry on NONBLOCK marked file */ | ||
| 3154 | if (req->file->f_flags & O_NONBLOCK) | ||
| 3155 | goto done; | ||
| 3149 | /* some cases will consume bytes even on error returns */ | 3156 | /* some cases will consume bytes even on error returns */ |
| 3150 | iov_iter_revert(iter, iov_count - iov_iter_count(iter)); | 3157 | iov_iter_revert(iter, iov_count - iov_iter_count(iter)); |
| 3151 | ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false); | 3158 | ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false); |
| @@ -3287,10 +3294,14 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, · 135 unmodified lines | |||
| 3287 | */ | 3294 | */ |
| 3288 | if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT)) | 3295 | if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT)) |
| 3289 | ret2 = -EAGAIN; | 3296 | ret2 = -EAGAIN; |
| 3297 | /* no retry on NONBLOCK marked file */ | ||
| 3298 | if (ret2 == -EAGAIN && (req->file->f_flags & O_NONBLOCK)) | ||
| 3299 | goto done; | ||
| 3290 | if (!force_nonblock || ret2 != -EAGAIN) { | 3300 | if (!force_nonblock || ret2 != -EAGAIN) { |
| 3291 | /* IOPOLL retry should happen for io-wq threads */ | 3301 | /* IOPOLL retry should happen for io-wq threads */ |
| 3292 | if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN) | 3302 | if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN) |
| 3293 | goto copy_iov; | 3303 | goto copy_iov; |
| 3304 | done: | ||
| 3294 | kiocb_done(kiocb, ret2, cs); | 3305 | kiocb_done(kiocb, ret2, cs); |
| 3295 | } else { | 3306 | } else { |
| 3296 | copy_iov: | 3307 | copy_iov: |
| @@ -7324,7 +7335,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, · 4027 unmodified lines | |||
| 7324 | table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT]; | 7335 | table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT]; |
| 7325 | index = i & IORING_FILE_TABLE_MASK; | 7336 | index = i & IORING_FILE_TABLE_MASK; |
| 7326 | if (table->files[index]) { | 7337 | if (table->files[index]) { |
| 7327 | file = io_file_from_index(ctx, index); | 7338 | file = table->files[index]; |
| 7328 | err = io_queue_file_removal(data, file); | 7339 | err = io_queue_file_removal(data, file); |
| 7329 | if (err) | 7340 | if (err) |
| 7330 | break; | 7341 | break; |
| @@ -7353,6 +7364,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, · 22 unmodified lines | |||
| 7353 | table->files[index] = file; | 7364 | table->files[index] = file; |
| 7354 | err = io_sqe_file_register(ctx, file, i); | 7365 | err = io_sqe_file_register(ctx, file, i); |
| 7355 | if (err) { | 7366 | if (err) { |
| 7367 | table->files[index] = NULL; | ||
| 7356 | fput(file); | 7368 | fput(file); |
| 7357 | break; | 7369 | break; |
| 7358 | } | 7370 | } |
| @@ -8012,6 +8024,28 @@ static bool io_match_link(struct io_kiocb *preq, struct io_kiocb *req) · 653 unmodified lines | |||
| 8012 | return false; | 8024 | return false; |
| 8013 | } | 8025 | } |
| 8014 | 8026 | ||
| 8027 | static inline bool io_match_files(struct io_kiocb *req, | ||
| 8028 | struct files_struct *files) | ||
| 8029 | { | ||
| 8030 | return (req->flags & REQ_F_WORK_INITIALIZED) && req->work.files == files; | ||
| 8031 | } | ||
| 8032 | |||
| 8033 | static bool io_match_link_files(struct io_kiocb *req, | ||
| 8034 | struct files_struct *files) | ||
| 8035 | { | ||
| 8036 | struct io_kiocb *link; | ||
| 8037 | |||
| 8038 | if (io_match_files(req, files)) | ||
| 8039 | return true; | ||
| 8040 | if (req->flags & REQ_F_LINK_HEAD) { | ||
| 8041 | list_for_each_entry(link, &req->link_list, link_list) { | ||
| 8042 | if (io_match_files(link, files)) | ||
| 8043 | return true; | ||
| 8044 | } | ||
| 8045 | } | ||
| 8046 | return false; | ||
| 8047 | } | ||
| 8048 | |||
| 8015 | /* | 8049 | /* |
| 8016 | * We're looking to cancel 'req' because it's holding on to our files, but | 8050 | * We're looking to cancel 'req' because it's holding on to our files, but |
| 8017 | * 'req' could be a link to another request. See if it is, and cancel that | 8051 | * 'req' could be a link to another request. See if it is, and cancel that |
| @@ -8086,12 +8120,38 @@ static void io_attempt_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req) · 68 unmodified lines | |||
| 8086 | io_timeout_remove_link(ctx, req); | 8120 | io_timeout_remove_link(ctx, req); |
| 8087 | } | 8121 | } |
| 8088 | 8122 | ||
| 8123 | static void io_cancel_defer_files(struct io_ring_ctx *ctx, | ||
| 8124 | struct files_struct *files) | ||
| 8125 | { | ||
| 8126 | struct io_defer_entry *de = NULL; | ||
| 8127 | LIST_HEAD(list); | ||
| 8128 | |||
| 8129 | spin_lock_irq(&ctx->completion_lock); | ||
| 8130 | list_for_each_entry_reverse(de, &ctx->defer_list, list) { | ||
| 8131 | if (io_match_link_files(de->req, files)) { | ||
| 8132 | list_cut_position(&list, &ctx->defer_list, &de->list); | ||
| 8133 | break; | ||
| 8134 | } | ||
| 8135 | } | ||
| 8136 | spin_unlock_irq(&ctx->completion_lock); | ||
| 8137 | |||
| 8138 | while (!list_empty(&list)) { | ||
| 8139 | de = list_first_entry(&list, struct io_defer_entry, list); | ||
| 8140 | list_del_init(&de->list); | ||
| 8141 | req_set_fail_links(de->req); | ||
| 8142 | io_put_req(de->req); | ||
| 8143 | io_req_complete(de->req, -ECANCELED); | ||
| 8144 | kfree(de); | ||
| 8145 | } | ||
| 8146 | } | ||
| 8147 | |||
| 8089 | static void io_uring_cancel_files(struct io_ring_ctx *ctx, | 8148 | static void io_uring_cancel_files(struct io_ring_ctx *ctx, |
| 8090 | struct files_struct *files) | 8149 | struct files_struct *files) |
| 8091 | { | 8150 | { |
| 8092 | if (list_empty_careful(&ctx->inflight_list)) | 8151 | if (list_empty_careful(&ctx->inflight_list)) |
| 8093 | return; | 8152 | return; |
| 8094 | 8153 | ||
| 8154 | io_cancel_defer_files(ctx, files); | ||
| 8095 | /* cancel all at once, should be faster than doing it one by one*/ | 8155 | /* cancel all at once, should be faster than doing it one by one*/ |
| 8096 | io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true); | 8156 | io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true); |
| 8097 | 8157 | ||
| @@ -3293,8 +3293,10 @@ static int _nfs4_do_setattr(struct inode *inode, · 3292 unmodified lines | |||
| 3293 | 3293 | ||
| 3294 | /* Servers should only apply open mode checks for file size changes */ | 3294 | /* Servers should only apply open mode checks for file size changes */ |
| 3295 | truncate = (arg->iap->ia_valid & ATTR_SIZE) ? true : false; | 3295 | truncate = (arg->iap->ia_valid & ATTR_SIZE) ? true : false; |
| 3296 | if (!truncate) | 3296 | if (!truncate) { |
| 3297 | nfs4_inode_make_writeable(inode); | ||
| 3297 | goto zero_stateid; | 3298 | goto zero_stateid; |
| 3299 | } | ||
| 3298 | 3300 | ||
| 3299 | if (nfs4_copy_delegation_stateid(inode, FMODE_WRITE, &arg->stateid, &delegation_cred)) { | 3301 | if (nfs4_copy_delegation_stateid(inode, FMODE_WRITE, &arg->stateid, &delegation_cred)) { |
| 3300 | /* Use that stateid */ | 3302 | /* Use that stateid */ |
| @@ -7298,7 +7300,12 @@ int nfs4_lock_delegation_recall(struct file_lock *fl, struct nfs4_state *state, · 3997 unmodified lines | |||
| 7298 | err = nfs4_set_lock_state(state, fl); | 7300 | err = nfs4_set_lock_state(state, fl); |
| 7299 | if (err != 0) | 7301 | if (err != 0) |
| 7300 | return err; | 7302 | return err; |
| 7301 | err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW); | 7303 | do { |
| 7304 | err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW); | ||
| 7305 | if (err != -NFS4ERR_DELAY) | ||
| 7306 | break; | ||
| 7307 | ssleep(1); | ||
| 7308 | } while (err == -NFS4ERR_DELAY); | ||
| 7302 | return nfs4_handle_delegation_recall_error(server, state, stateid, fl, err); | 7309 | return nfs4_handle_delegation_recall_error(server, state, stateid, fl, err); |
| 7303 | } | 7310 | } |
| 7304 | 7311 | ||
| @@ -653,8 +653,8 @@ xfs_attr_shortform_create( · 652 unmodified lines | |||
| 653 | ASSERT(ifp->if_flags & XFS_IFINLINE); | 653 | ASSERT(ifp->if_flags & XFS_IFINLINE); |
| 654 | } | 654 | } |
| 655 | xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK); | 655 | xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK); |
| 656 | hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; | 656 | hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data; |
| 657 | hdr->count = 0; | 657 | memset(hdr, 0, sizeof(*hdr)); |
| 658 | hdr->totsize = cpu_to_be16(sizeof(*hdr)); | 658 | hdr->totsize = cpu_to_be16(sizeof(*hdr)); |
| 659 | xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); | 659 | xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); |
| 660 | } | 660 | } |
| @@ -1036,8 +1036,10 @@ xfs_attr_shortform_verify( · 375 unmodified lines | |||
| 1036 | * struct xfs_attr_sf_entry has a variable length. | 1036 | * struct xfs_attr_sf_entry has a variable length. |
| 1037 | * Check the fixed-offset parts of the structure are | 1037 | * Check the fixed-offset parts of the structure are |
| 1038 | * within the data buffer. | 1038 | * within the data buffer. |
| 1039 | * xfs_attr_sf_entry is defined with a 1-byte variable | ||
| 1040 | * array at the end, so we must subtract that off. | ||
| 1039 | */ | 1041 | */ |
| 1040 | if (((char *)sfep + sizeof(*sfep)) >= endp) | 1042 | if (((char *)sfep + sizeof(*sfep) - 1) >= endp) |
| 1041 | return __this_address; | 1043 | return __this_address; |
| 1042 | 1044 | ||
| 1043 | /* Don't allow names with known bad length. */ | 1045 | /* Don't allow names with known bad length. */ |
| @@ -6226,7 +6226,7 @@ xfs_bmap_validate_extent( · 6225 unmodified lines | |||
| 6226 | 6226 | ||
| 6227 | isrt = XFS_IS_REALTIME_INODE(ip); | 6227 | isrt = XFS_IS_REALTIME_INODE(ip); |
| 6228 | endfsb = irec->br_startblock + irec->br_blockcount - 1; | 6228 | endfsb = irec->br_startblock + irec->br_blockcount - 1; |
| 6229 | if (isrt) { | 6229 | if (isrt && whichfork == XFS_DATA_FORK) { |
| 6230 | if (!xfs_verify_rtbno(mp, irec->br_startblock)) | 6230 | if (!xfs_verify_rtbno(mp, irec->br_startblock)) |
| 6231 | return __this_address; | 6231 | return __this_address; |
| 6232 | if (!xfs_verify_rtbno(mp, endfsb)) | 6232 | if (!xfs_verify_rtbno(mp, endfsb)) |
| @@ -688,7 +688,7 @@ xfs_ialloc_ag_alloc( · 687 unmodified lines | |||
| 688 | args.minalignslop = igeo->cluster_align - 1; | 688 | args.minalignslop = igeo->cluster_align - 1; |
| 689 | 689 | ||
| 690 | /* Allow space for the inode btree to split. */ | 690 | /* Allow space for the inode btree to split. */ |
| 691 | args.minleft = igeo->inobt_maxlevels - 1; | 691 | args.minleft = igeo->inobt_maxlevels; |
| 692 | if ((error = xfs_alloc_vextent(&args))) | 692 | if ((error = xfs_alloc_vextent(&args))) |
| 693 | return error; | 693 | return error; |
| 694 | 694 | ||
| @@ -736,7 +736,7 @@ xfs_ialloc_ag_alloc( · 41 unmodified lines | |||
| 736 | /* | 736 | /* |
| 737 | * Allow space for the inode btree to split. | 737 | * Allow space for the inode btree to split. |
| 738 | */ | 738 | */ |
| 739 | args.minleft = igeo->inobt_maxlevels - 1; | 739 | args.minleft = igeo->inobt_maxlevels; |
| 740 | if ((error = xfs_alloc_vextent(&args))) | 740 | if ((error = xfs_alloc_vextent(&args))) |
| 741 | return error; | 741 | return error; |
| 742 | } | 742 | } |
| @@ -58,7 +58,7 @@ · 57 unmodified lines | |||
| 58 | #define XFS_IALLOC_SPACE_RES(mp) \ | 58 | #define XFS_IALLOC_SPACE_RES(mp) \ |
| 59 | (M_IGEO(mp)->ialloc_blks + \ | 59 | (M_IGEO(mp)->ialloc_blks + \ |
| 60 | ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \ | 60 | ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \ |
| 61 | (M_IGEO(mp)->inobt_maxlevels - 1))) | 61 | M_IGEO(mp)->inobt_maxlevels)) |
| 62 | 62 | ||
| 63 | /* | 63 | /* |
| 64 | * Space reservation values for various transactions. | 64 | * Space reservation values for various transactions. |
| @@ -1165,7 +1165,7 @@ xfs_insert_file_space( · 1164 unmodified lines | |||
| 1165 | goto out_trans_cancel; | 1165 | goto out_trans_cancel; |
| 1166 | 1166 | ||
| 1167 | do { | 1167 | do { |
| 1168 | error = xfs_trans_roll_inode(&tp, ip); | 1168 | error = xfs_defer_finish(&tp); |
| 1169 | if (error) | 1169 | if (error) |
| 1170 | goto out_trans_cancel; | 1170 | goto out_trans_cancel; |
| 1171 | 1171 | ||
| @@ -1223,6 +1223,14 @@ __xfs_filemap_fault( · 1222 unmodified lines | |||
| 1223 | return ret; | 1223 | return ret; |
| 1224 | } | 1224 | } |
| 1225 | 1225 | ||
| 1226 | static inline bool | ||
| 1227 | xfs_is_write_fault( | ||
| 1228 | struct vm_fault *vmf) | ||
| 1229 | { | ||
| 1230 | return (vmf->flags & FAULT_FLAG_WRITE) && | ||
| 1231 | (vmf->vma->vm_flags & VM_SHARED); | ||
| 1232 | } | ||
| 1233 | |||
| 1226 | static vm_fault_t | 1234 | static vm_fault_t |
| 1227 | xfs_filemap_fault( | 1235 | xfs_filemap_fault( |
| 1228 | struct vm_fault *vmf) | 1236 | struct vm_fault *vmf) |
| @@ -1230,7 +1238,7 @@ xfs_filemap_fault( · 1 unmodified line | |||
| 1230 | /* DAX can shortcut the normal fault path on write faults! */ | 1238 | /* DAX can shortcut the normal fault path on write faults! */ |
| 1231 | return __xfs_filemap_fault(vmf, PE_SIZE_PTE, | 1239 | return __xfs_filemap_fault(vmf, PE_SIZE_PTE, |
| 1232 | IS_DAX(file_inode(vmf->vma->vm_file)) && | 1240 | IS_DAX(file_inode(vmf->vma->vm_file)) && |
| 1233 | (vmf->flags & FAULT_FLAG_WRITE)); | 1241 | xfs_is_write_fault(vmf)); |
| 1234 | } | 1242 | } |
| 1235 | 1243 | ||
| 1236 | static vm_fault_t | 1244 | static vm_fault_t |
| @@ -1243,7 +1251,7 @@ xfs_filemap_huge_fault( · 6 unmodified lines | |||
| 1243 | 1251 | ||
| 1244 | /* DAX can shortcut the normal fault path on write faults! */ | 1252 | /* DAX can shortcut the normal fault path on write faults! */ |
| 1245 | return __xfs_filemap_fault(vmf, pe_size, | 1253 | return __xfs_filemap_fault(vmf, pe_size, |
| 1246 | (vmf->flags & FAULT_FLAG_WRITE)); | 1254 | xfs_is_write_fault(vmf)); |
| 1247 | } | 1255 | } |
| 1248 | 1256 | ||
| 1249 | static vm_fault_t | 1257 | static vm_fault_t |
| @@ -29,6 +29,9 @@ · 28 unmodified lines | |||
| 29 | /* Slave address for the HDCP registers in the receiver */ | 29 | /* Slave address for the HDCP registers in the receiver */ |
| 30 | #define DRM_HDCP_DDC_ADDR 0x3A | 30 | #define DRM_HDCP_DDC_ADDR 0x3A |
| 31 | 31 | ||
| 32 | /* Value to use at the end of the SHA-1 bytestream used for repeaters */ | ||
| 33 | #define DRM_HDCP_SHA1_TERMINATOR 0x80 | ||
| 34 | |||
| 32 | /* HDCP register offsets for HDMI/DVI devices */ | 35 | /* HDCP register offsets for HDMI/DVI devices */ |
| 33 | #define DRM_HDCP_DDC_BKSV 0x00 | 36 | #define DRM_HDCP_DDC_BKSV 0x00 |
| 34 | #define DRM_HDCP_DDC_RI_PRIME 0x08 | 37 | #define DRM_HDCP_DDC_RI_PRIME 0x08 |
| @@ -117,11 +117,18 @@ static inline bool bvec_iter_advance(const struct bio_vec *bv, · 116 unmodified lines | |||
| 117 | return true; | 117 | return true; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | static inline void bvec_iter_skip_zero_bvec(struct bvec_iter *iter) | ||
| 121 | { | ||
| 122 | iter->bi_bvec_done = 0; | ||
| 123 | iter->bi_idx++; | ||
| 124 | } | ||
| 125 | |||
| 120 | #define for_each_bvec(bvl, bio_vec, iter, start) \ | 126 | #define for_each_bvec(bvl, bio_vec, iter, start) \ |
| 121 | for (iter = (start); \ | 127 | for (iter = (start); \ |
| 122 | (iter).bi_size && \ | 128 | (iter).bi_size && \ |
| 123 | ((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \ | 129 | ((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \ |
| 124 | bvec_iter_advance((bio_vec), &(iter), (bvl).bv_len)) | 130 | (bvl).bv_len ? (void)bvec_iter_advance((bio_vec), &(iter), \ |
| 131 | (bvl).bv_len) : bvec_iter_skip_zero_bvec(&(iter))) | ||
| 125 | 132 | ||
| 126 | /* for iterating one bio from start to end */ | 133 | /* for iterating one bio from start to end */ |
| 127 | #define BVEC_ITER_ALL_INIT (struct bvec_iter) \ | 134 | #define BVEC_ITER_ALL_INIT (struct bvec_iter) \ |
| @@ -22,14 +22,8 @@ · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | /* | 23 | /* |
| 24 | * __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17. | 24 | * __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17. |
| 25 | * In the meantime, to support 4.6 <= gcc < 5, we implement __has_attribute | 25 | * In the meantime, to support gcc < 5, we implement __has_attribute |
| 26 | * by hand. | 26 | * by hand. |
| 27 | * | ||
| 28 | * sparse does not support __has_attribute (yet) and defines __GNUC_MINOR__ | ||
| 29 | * depending on the compiler used to build it; however, these attributes have | ||
| 30 | * no semantic effects for sparse, so it does not matter. Also note that, | ||
| 31 | * in order to avoid sparse's warnings, even the unsupported ones must be | ||
| 32 | * defined to 0. | ||
| 33 | */ | 27 | */ |
| 34 | #ifndef __has_attribute | 28 | #ifndef __has_attribute |
| 35 | # define __has_attribute(x) __GCC4_has_attribute_##x | 29 | # define __has_attribute(x) __GCC4_has_attribute_##x |
| @@ -11,8 +11,8 @@ · 10 unmodified lines | |||
| 11 | # define __iomem __attribute__((noderef, address_space(__iomem))) | 11 | # define __iomem __attribute__((noderef, address_space(__iomem))) |
| 12 | # define __percpu __attribute__((noderef, address_space(__percpu))) | 12 | # define __percpu __attribute__((noderef, address_space(__percpu))) |
| 13 | # define __rcu __attribute__((noderef, address_space(__rcu))) | 13 | # define __rcu __attribute__((noderef, address_space(__rcu))) |
| 14 | extern void __chk_user_ptr(const volatile void __user *); | 14 | static inline void __chk_user_ptr(const volatile void __user *ptr) { } |
| 15 | extern void __chk_io_ptr(const volatile void __iomem *); | 15 | static inline void __chk_io_ptr(const volatile void __iomem *ptr) { } |
| 16 | /* context/locking */ | 16 | /* context/locking */ |
| 17 | # define __must_hold(x) __attribute__((context(x,1,1))) | 17 | # define __must_hold(x) __attribute__((context(x,1,1))) |
| 18 | # define __acquires(x) __attribute__((context(x,0,1))) | 18 | # define __acquires(x) __attribute__((context(x,0,1))) |
| @@ -454,6 +454,7 @@ struct dev_links_info { · 453 unmodified lines | |||
| 454 | * @pm_domain: Provide callbacks that are executed during system suspend, | 454 | * @pm_domain: Provide callbacks that are executed during system suspend, |
| 455 | * hibernation, system resume and during runtime PM transitions | 455 | * hibernation, system resume and during runtime PM transitions |
| 456 | * along with subsystem-level and driver-level callbacks. | 456 | * along with subsystem-level and driver-level callbacks. |
| 457 | * @em_pd: device's energy model performance domain | ||
| 457 | * @pins: For device pin management. | 458 | * @pins: For device pin management. |
| 458 | * See Documentation/driver-api/pinctl.rst for details. | 459 | * See Documentation/driver-api/pinctl.rst for details. |
| 459 | * @msi_list: Hosts MSI descriptors | 460 | * @msi_list: Hosts MSI descriptors |
| @@ -49,6 +49,10 @@ struct _ddebug { · 48 unmodified lines | |||
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | #if defined(CONFIG_DYNAMIC_DEBUG_CORE) | 51 | #if defined(CONFIG_DYNAMIC_DEBUG_CORE) |
| 52 | |||
| 53 | /* exported for module authors to exercise >control */ | ||
| 54 | int dynamic_debug_exec_queries(const char *query, const char *modname); | ||
| 55 | |||
| 52 | int ddebug_add_module(struct _ddebug *tab, unsigned int n, | 56 | int ddebug_add_module(struct _ddebug *tab, unsigned int n, |
| 53 | const char *modname); | 57 | const char *modname); |
| 54 | extern int ddebug_remove_module(const char *mod_name); | 58 | extern int ddebug_remove_module(const char *mod_name); |
| @@ -105,7 +109,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, · 50 unmodified lines | |||
| 105 | static_branch_unlikely(&descriptor.key.dd_key_false) | 109 | static_branch_unlikely(&descriptor.key.dd_key_false) |
| 106 | #endif | 110 | #endif |
| 107 | 111 | ||
| 108 | #else /* !HAVE_JUMP_LABEL */ | 112 | #else /* !CONFIG_JUMP_LABEL */ |
| 109 | 113 | ||
| 110 | #define _DPRINTK_KEY_INIT | 114 | #define _DPRINTK_KEY_INIT |
| 111 | 115 | ||
| @@ -117,7 +121,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, · 5 unmodified lines | |||
| 117 | unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) | 121 | unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) |
| 118 | #endif | 122 | #endif |
| 119 | 123 | ||
| 120 | #endif | 124 | #endif /* CONFIG_JUMP_LABEL */ |
| 121 | 125 | ||
| 122 | #define __dynamic_func_call(id, fmt, func, ...) do { \ | 126 | #define __dynamic_func_call(id, fmt, func, ...) do { \ |
| 123 | DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt); \ | 127 | DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt); \ |
| @@ -172,10 +176,11 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, · 48 unmodified lines | |||
| 172 | KERN_DEBUG, prefix_str, prefix_type, \ | 176 | KERN_DEBUG, prefix_str, prefix_type, \ |
| 173 | rowsize, groupsize, buf, len, ascii) | 177 | rowsize, groupsize, buf, len, ascii) |
| 174 | 178 | ||
| 175 | #else | 179 | #else /* !CONFIG_DYNAMIC_DEBUG_CORE */ |
| 176 | 180 | ||
| 177 | #include <linux/string.h> | 181 | #include <linux/string.h> |
| 178 | #include <linux/errno.h> | 182 | #include <linux/errno.h> |
| 183 | #include <linux/printk.h> | ||
| 179 | 184 | ||
| 180 | static inline int ddebug_add_module(struct _ddebug *tab, unsigned int n, | 185 | static inline int ddebug_add_module(struct _ddebug *tab, unsigned int n, |
| 181 | const char *modname) | 186 | const char *modname) |
| @@ -210,6 +215,13 @@ static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, · 28 unmodified lines | |||
| 210 | print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, \ | 215 | print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, \ |
| 211 | rowsize, groupsize, buf, len, ascii); \ | 216 | rowsize, groupsize, buf, len, ascii); \ |
| 212 | } while (0) | 217 | } while (0) |
| 213 | #endif | 218 | |
| 219 | static inline int dynamic_debug_exec_queries(const char *query, const char *modname) | ||
| 220 | { | ||
| 221 | pr_warn("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n"); | ||
| 222 | return 0; | ||
| 223 | } | ||
| 224 | |||
| 225 | #endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ | ||
| 214 | 226 | ||
| 215 | #endif | 227 | #endif |
| @@ -8,8 +8,8 @@ · 7 unmodified lines | |||
| 8 | #define EFI_EMBEDDED_FW_PREFIX_LEN 8 | 8 | #define EFI_EMBEDDED_FW_PREFIX_LEN 8 |
| 9 | 9 | ||
| 10 | /* | 10 | /* |
| 11 | * This struct and efi_embedded_fw_list are private to the efi-embedded fw | 11 | * This struct is private to the efi-embedded fw implementation. |
| 12 | * implementation they are in this header for use by lib/test_firmware.c only! | 12 | * They are in this header for use by lib/test_firmware.c only! |
| 13 | */ | 13 | */ |
| 14 | struct efi_embedded_fw { | 14 | struct efi_embedded_fw { |
| 15 | struct list_head list; | 15 | struct list_head list; |
| @@ -18,8 +18,6 @@ struct efi_embedded_fw { · 2 unmodified lines | |||
| 18 | size_t length; | 18 | size_t length; |
| 19 | }; | 19 | }; |
| 20 | 20 | ||
| 21 | extern struct list_head efi_embedded_fw_list; | ||
| 22 | |||
| 23 | /** | 21 | /** |
| 24 | * struct efi_embedded_fw_desc - This struct is used by the EFI embedded-fw | 22 | * struct efi_embedded_fw_desc - This struct is used by the EFI embedded-fw |
| 25 | * code to search for embedded firmwares. | 23 | * code to search for embedded firmwares. |
| @@ -110,15 +110,30 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs · 109 unmodified lines | |||
| 110 | #endif | 110 | #endif |
| 111 | 111 | ||
| 112 | /** | 112 | /** |
| 113 | * syscall_enter_from_user_mode - Check and handle work before invoking | 113 | * syscall_enter_from_user_mode_prepare - Establish state and enable interrupts |
| 114 | * a syscall | ||
| 115 | * @regs: Pointer to currents pt_regs | 114 | * @regs: Pointer to currents pt_regs |
| 116 | * @syscall: The syscall number | ||
| 117 | * | 115 | * |
| 118 | * Invoked from architecture specific syscall entry code with interrupts | 116 | * Invoked from architecture specific syscall entry code with interrupts |
| 119 | * disabled. The calling code has to be non-instrumentable. When the | 117 | * disabled. The calling code has to be non-instrumentable. When the |
| 120 | * function returns all state is correct and the subsequent functions can be | 118 | * function returns all state is correct, interrupts are enabled and the |
| 121 | * instrumented. | 119 | * subsequent functions can be instrumented. |
| 120 | * | ||
| 121 | * This handles lockdep, RCU (context tracking) and tracing state. | ||
| 122 | * | ||
| 123 | * This is invoked when there is extra architecture specific functionality | ||
| 124 | * to be done between establishing state and handling user mode entry work. | ||
| 125 | */ | ||
| 126 | void syscall_enter_from_user_mode_prepare(struct pt_regs *regs); | ||
| 127 | |||
| 128 | /** | ||
| 129 | * syscall_enter_from_user_mode_work - Check and handle work before invoking | ||
| 130 | * a syscall | ||
| 131 | * @regs: Pointer to currents pt_regs | ||
| 132 | * @syscall: The syscall number | ||
| 133 | * | ||
| 134 | * Invoked from architecture specific syscall entry code with interrupts | ||
| 135 | * enabled after invoking syscall_enter_from_user_mode_prepare() and extra | ||
| 136 | * architecture specific work. | ||
| 122 | * | 137 | * |
| 123 | * Returns: The original or a modified syscall number | 138 | * Returns: The original or a modified syscall number |
| 124 | * | 139 | * |
| @@ -127,12 +142,30 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs · 2 unmodified lines | |||
| 127 | * syscall_set_return_value() first. If neither of those are called and -1 | 142 | * syscall_set_return_value() first. If neither of those are called and -1 |
| 128 | * is returned, then the syscall will fail with ENOSYS. | 143 | * is returned, then the syscall will fail with ENOSYS. |
| 129 | * | 144 | * |
| 130 | * The following functionality is handled here: | 145 | * It handles the following work items: |
| 131 | * | 146 | * |
| 132 | * 1) Establish state (lockdep, RCU (context tracking), tracing) | 147 | * 1) TIF flag dependent invocations of arch_syscall_enter_tracehook(), |
| 133 | * 2) TIF flag dependent invocations of arch_syscall_enter_tracehook(), | ||
| 134 | * __secure_computing(), trace_sys_enter() | 148 | * __secure_computing(), trace_sys_enter() |
| 135 | * 3) Invocation of audit_syscall_entry() | 149 | * 2) Invocation of audit_syscall_entry() |
| 150 | */ | ||
| 151 | long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall); | ||
| 152 | |||
| 153 | /** | ||
| 154 | * syscall_enter_from_user_mode - Establish state and check and handle work | ||
| 155 | * before invoking a syscall | ||
| 156 | * @regs: Pointer to currents pt_regs | ||
| 157 | * @syscall: The syscall number | ||
| 158 | * | ||
| 159 | * Invoked from architecture specific syscall entry code with interrupts | ||
| 160 | * disabled. The calling code has to be non-instrumentable. When the | ||
| 161 | * function returns all state is correct, interrupts are enabled and the | ||
| 162 | * subsequent functions can be instrumented. | ||
| 163 | * | ||
| 164 | * This is combination of syscall_enter_from_user_mode_prepare() and | ||
| 165 | * syscall_enter_from_user_mode_work(). | ||
| 166 | * | ||
| 167 | * Returns: The original or a modified syscall number. See | ||
| 168 | * syscall_enter_from_user_mode_work() for further explanation. | ||
| 136 | */ | 169 | */ |
| 137 | long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall); | 170 | long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall); |
| 138 | 171 | ||
| @@ -959,34 +959,49 @@ static inline void hid_device_io_stop(struct hid_device *hid) { · 958 unmodified lines | |||
| 959 | * @max: maximal valid usage->code to consider later (out parameter) | 959 | * @max: maximal valid usage->code to consider later (out parameter) |
| 960 | * @type: input event type (EV_KEY, EV_REL, ...) | 960 | * @type: input event type (EV_KEY, EV_REL, ...) |
| 961 | * @c: code which corresponds to this usage and type | 961 | * @c: code which corresponds to this usage and type |
| 962 | * | ||
| 963 | * The value pointed to by @bit will be set to NULL if either @type is | ||
| 964 | * an unhandled event type, or if @c is out of range for @type. This | ||
| 965 | * can be used as an error condition. | ||
| 962 | */ | 966 | */ |
| 963 | static inline void hid_map_usage(struct hid_input *hidinput, | 967 | static inline void hid_map_usage(struct hid_input *hidinput, |
| 964 | struct hid_usage *usage, unsigned long **bit, int *max, | 968 | struct hid_usage *usage, unsigned long **bit, int *max, |
| 965 | __u8 type, __u16 c) | 969 | __u8 type, unsigned int c) |
| 966 | { | 970 | { |
| 967 | struct input_dev *input = hidinput->input; | 971 | struct input_dev *input = hidinput->input; |
| 968 | 972 | unsigned long *bmap = NULL; | |
| 969 | usage->type = type; | 973 | unsigned int limit = 0; |
| 970 | usage->code = c; | ||
| 971 | 974 | ||
| 972 | switch (type) { | 975 | switch (type) { |
| 973 | case EV_ABS: | 976 | case EV_ABS: |
| 974 | *bit = input->absbit; | 977 | bmap = input->absbit; |
| 975 | *max = ABS_MAX; | 978 | limit = ABS_MAX; |
| 976 | break; | 979 | break; |
| 977 | case EV_REL: | 980 | case EV_REL: |
| 978 | *bit = input->relbit; | 981 | bmap = input->relbit; |
| 979 | *max = REL_MAX; | 982 | limit = REL_MAX; |
| 980 | break; | 983 | break; |
| 981 | case EV_KEY: | 984 | case EV_KEY: |
| 982 | *bit = input->keybit; | 985 | bmap = input->keybit; |
| 983 | *max = KEY_MAX; | 986 | limit = KEY_MAX; |
| 984 | break; | 987 | break; |
| 985 | case EV_LED: | 988 | case EV_LED: |
| 986 | *bit = input->ledbit; | 989 | bmap = input->ledbit; |
| 987 | *max = LED_MAX; | 990 | limit = LED_MAX; |
| 988 | break; | 991 | break; |
| 989 | } | 992 | } |
| 993 | |||
| 994 | if (unlikely(c > limit || !bmap)) { | ||
| 995 | pr_warn_ratelimited("%s: Invalid code %d type %d\n", | ||
| 996 | input->name, c, type); | ||
| 997 | *bit = NULL; | ||
| 998 | return; | ||
| 999 | } | ||
| 1000 | |||
| 1001 | usage->type = type; | ||
| 1002 | usage->code = c; | ||
| 1003 | *max = limit; | ||
| 1004 | *bit = bmap; | ||
| 990 | } | 1005 | } |
| 991 | 1006 | ||
| 992 | /** | 1007 | /** |
| @@ -1000,7 +1015,8 @@ static inline void hid_map_usage_clear(struct hid_input *hidinput, · 7 unmodified lines | |||
| 1000 | __u8 type, __u16 c) | 1015 | __u8 type, __u16 c) |
| 1001 | { | 1016 | { |
| 1002 | hid_map_usage(hidinput, usage, bit, max, type, c); | 1017 | hid_map_usage(hidinput, usage, bit, max, type, c); |
| 1003 | clear_bit(c, *bit); | 1018 | if (*bit) |
| 1019 | clear_bit(usage->code, *bit); | ||
| 1004 | } | 1020 | } |
| 1005 | 1021 | ||
| 1006 | /** | 1022 | /** |
| @@ -53,6 +53,20 @@ · 52 unmodified lines | |||
| 53 | #define I2C_PCA_CON_SI 0x08 /* Serial Interrupt */ | 53 | #define I2C_PCA_CON_SI 0x08 /* Serial Interrupt */ |
| 54 | #define I2C_PCA_CON_CR 0x07 /* Clock Rate (MASK) */ | 54 | #define I2C_PCA_CON_CR 0x07 /* Clock Rate (MASK) */ |
| 55 | 55 | ||
| 56 | /** | ||
| 57 | * struct pca_i2c_bus_settings - The configured PCA i2c bus settings | ||
| 58 | * @mode: Configured i2c bus mode | ||
| 59 | * @tlow: Configured SCL LOW period | ||
| 60 | * @thi: Configured SCL HIGH period | ||
| 61 | * @clock_freq: The configured clock frequency | ||
| 62 | */ | ||
| 63 | struct pca_i2c_bus_settings { | ||
| 64 | int mode; | ||
| 65 | int tlow; | ||
| 66 | int thi; | ||
| 67 | int clock_freq; | ||
| 68 | }; | ||
| 69 | |||
| 56 | struct i2c_algo_pca_data { | 70 | struct i2c_algo_pca_data { |
| 57 | void *data; /* private low level data */ | 71 | void *data; /* private low level data */ |
| 58 | void (*write_byte) (void *data, int reg, int val); | 72 | void (*write_byte) (void *data, int reg, int val); |
| @@ -64,6 +78,7 @@ struct i2c_algo_pca_data { · 5 unmodified lines | |||
| 64 | * For PCA9665, use the frequency you want here. */ | 78 | * For PCA9665, use the frequency you want here. */ |
| 65 | unsigned int i2c_clock; | 79 | unsigned int i2c_clock; |
| 66 | unsigned int chip; | 80 | unsigned int chip; |
| 81 | struct pca_i2c_bus_settings bus_settings; | ||
| 67 | }; | 82 | }; |
| 68 | 83 | ||
| 69 | int i2c_pca_add_bus(struct i2c_adapter *); | 84 | int i2c_pca_add_bus(struct i2c_adapter *); |
| @@ -53,8 +53,6 @@ struct page *ksm_might_need_to_copy(struct page *page, · 52 unmodified lines | |||
| 53 | 53 | ||
| 54 | void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc); | 54 | void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc); |
| 55 | void ksm_migrate_page(struct page *newpage, struct page *oldpage); | 55 | void ksm_migrate_page(struct page *newpage, struct page *oldpage); |
| 56 | bool reuse_ksm_page(struct page *page, | ||
| 57 | struct vm_area_struct *vma, unsigned long address); | ||
| 58 | 56 | ||
| 59 | #else /* !CONFIG_KSM */ | 57 | #else /* !CONFIG_KSM */ |
| 60 | 58 | ||
| @@ -88,11 +86,6 @@ static inline void rmap_walk_ksm(struct page *page, · 27 unmodified lines | |||
| 88 | static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) | 86 | static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) |
| 89 | { | 87 | { |
| 90 | } | 88 | } |
| 91 | static inline bool reuse_ksm_page(struct page *page, | ||
| 92 | struct vm_area_struct *vma, unsigned long address) | ||
| 93 | { | ||
| 94 | return false; | ||
| 95 | } | ||
| 96 | #endif /* CONFIG_MMU */ | 89 | #endif /* CONFIG_MMU */ |
| 97 | #endif /* !CONFIG_KSM */ | 90 | #endif /* !CONFIG_KSM */ |
| 98 | 91 | ||
| @@ -749,25 +749,46 @@ int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc, · 748 unmodified lines | |||
| 749 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, | 749 | int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, |
| 750 | gpa_t gpa, unsigned long len); | 750 | gpa_t gpa, unsigned long len); |
| 751 | 751 | ||
| 752 | #define __kvm_put_guest(kvm, gfn, offset, value, type) \ | 752 | #define __kvm_get_guest(kvm, gfn, offset, v) \ |
| 753 | ({ \ | 753 | ({ \ |
| 754 | unsigned long __addr = gfn_to_hva(kvm, gfn); \ | 754 | unsigned long __addr = gfn_to_hva(kvm, gfn); \ |
| 755 | type __user *__uaddr = (type __user *)(__addr + offset); \ | 755 | typeof(v) __user *__uaddr = (typeof(__uaddr))(__addr + offset); \ |
| 756 | int __ret = -EFAULT; \ | 756 | int __ret = -EFAULT; \ |
| 757 | \ | 757 | \ |
| 758 | if (!kvm_is_error_hva(__addr)) \ | 758 | if (!kvm_is_error_hva(__addr)) \ |
| 759 | __ret = put_user(value, __uaddr); \ | 759 | __ret = get_user(v, __uaddr); \ |
| 760 | __ret; \ | ||
| 761 | }) | ||
| 762 | |||
| 763 | #define kvm_get_guest(kvm, gpa, v) \ | ||
| 764 | ({ \ | ||
| 765 | gpa_t __gpa = gpa; \ | ||
| 766 | struct kvm *__kvm = kvm; \ | ||
| 767 | \ | ||
| 768 | __kvm_get_guest(__kvm, __gpa >> PAGE_SHIFT, \ | ||
| 769 | offset_in_page(__gpa), v); \ | ||
| 770 | }) | ||
| 771 | |||
| 772 | #define __kvm_put_guest(kvm, gfn, offset, v) \ | ||
| 773 | ({ \ | ||
| 774 | unsigned long __addr = gfn_to_hva(kvm, gfn); \ | ||
| 775 | typeof(v) __user *__uaddr = (typeof(__uaddr))(__addr + offset); \ | ||
| 776 | int __ret = -EFAULT; \ | ||
| 777 | \ | ||
| 778 | if (!kvm_is_error_hva(__addr)) \ | ||
| 779 | __ret = put_user(v, __uaddr); \ | ||
| 760 | if (!__ret) \ | 780 | if (!__ret) \ |
| 761 | mark_page_dirty(kvm, gfn); \ | 781 | mark_page_dirty(kvm, gfn); \ |
| 762 | __ret; \ | 782 | __ret; \ |
| 763 | }) | 783 | }) |
| 764 | 784 | ||
| 765 | #define kvm_put_guest(kvm, gpa, value, type) \ | 785 | #define kvm_put_guest(kvm, gpa, v) \ |
| 766 | ({ \ | 786 | ({ \ |
| 767 | gpa_t __gpa = gpa; \ | 787 | gpa_t __gpa = gpa; \ |
| 768 | struct kvm *__kvm = kvm; \ | 788 | struct kvm *__kvm = kvm; \ |
| 789 | \ | ||
| 769 | __kvm_put_guest(__kvm, __gpa >> PAGE_SHIFT, \ | 790 | __kvm_put_guest(__kvm, __gpa >> PAGE_SHIFT, \ |
| 770 | offset_in_page(__gpa), (value), type); \ | 791 | offset_in_page(__gpa), v); \ |
| 771 | }) | 792 | }) |
| 772 | 793 | ||
| 773 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); | 794 | int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len); |
| @@ -421,6 +421,7 @@ enum { · 420 unmodified lines | |||
| 421 | ATA_HORKAGE_NO_DMA_LOG = (1 << 23), /* don't use DMA for log read */ | 421 | ATA_HORKAGE_NO_DMA_LOG = (1 << 23), /* don't use DMA for log read */ |
| 422 | ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ | 422 | ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ |
| 423 | ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */ | 423 | ATA_HORKAGE_MAX_SEC_1024 = (1 << 25), /* Limit max sects to 1024 */ |
| 424 | ATA_HORKAGE_MAX_TRIM_128M = (1 << 26), /* Limit max trim size to 128M */ | ||
| 424 | 425 | ||
| 425 | /* DMA mask for user DMA control: User visible values; DO NOT | 426 | /* DMA mask for user DMA control: User visible values; DO NOT |
| 426 | renumber */ | 427 | renumber */ |
| @@ -173,7 +173,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) · 172 unmodified lines | |||
| 173 | #define roundup_pow_of_two(n) \ | 173 | #define roundup_pow_of_two(n) \ |
| 174 | ( \ | 174 | ( \ |
| 175 | __builtin_constant_p(n) ? ( \ | 175 | __builtin_constant_p(n) ? ( \ |
| 176 | (n == 1) ? 1 : \ | 176 | ((n) == 1) ? 1 : \ |
| 177 | (1UL << (ilog2((n) - 1) + 1)) \ | 177 | (1UL << (ilog2((n) - 1) + 1)) \ |
| 178 | ) : \ | 178 | ) : \ |
| 179 | __roundup_pow_of_two(n) \ | 179 | __roundup_pow_of_two(n) \ |
| @@ -46,11 +46,10 @@ struct vmem_altmap { · 45 unmodified lines | |||
| 46 | * wakeup is used to coordinate physical address space management (ex: | 46 | * wakeup is used to coordinate physical address space management (ex: |
| 47 | * fs truncate/hole punch) vs pinned pages (ex: device dma). | 47 | * fs truncate/hole punch) vs pinned pages (ex: device dma). |
| 48 | * | 48 | * |
| 49 | * MEMORY_DEVICE_DEVDAX: | 49 | * MEMORY_DEVICE_GENERIC: |
| 50 | * Host memory that has similar access semantics as System RAM i.e. DMA | 50 | * Host memory that has similar access semantics as System RAM i.e. DMA |
| 51 | * coherent and supports page pinning. In contrast to | 51 | * coherent and supports page pinning. This is for example used by DAX devices |
| 52 | * MEMORY_DEVICE_FS_DAX, this memory is access via a device-dax | 52 | * that expose memory using a character device. |
| 53 | * character device. | ||
| 54 | * | 53 | * |
| 55 | * MEMORY_DEVICE_PCI_P2PDMA: | 54 | * MEMORY_DEVICE_PCI_P2PDMA: |
| 56 | * Device memory residing in a PCI BAR intended for use with Peer-to-Peer | 55 | * Device memory residing in a PCI BAR intended for use with Peer-to-Peer |
| @@ -60,7 +59,7 @@ enum memory_type { · 3 unmodified lines | |||
| 60 | /* 0 is reserved to catch uninitialized type fields */ | 59 | /* 0 is reserved to catch uninitialized type fields */ |
| 61 | MEMORY_DEVICE_PRIVATE = 1, | 60 | MEMORY_DEVICE_PRIVATE = 1, |
| 62 | MEMORY_DEVICE_FS_DAX, | 61 | MEMORY_DEVICE_FS_DAX, |
| 63 | MEMORY_DEVICE_DEVDAX, | 62 | MEMORY_DEVICE_GENERIC, |
| 64 | MEMORY_DEVICE_PCI_P2PDMA, | 63 | MEMORY_DEVICE_PCI_P2PDMA, |
| 65 | }; | 64 | }; |
| 66 | 65 | ||
| @@ -9,6 +9,8 @@ struct ip_ct_sctp { · 8 unmodified lines | |||
| 9 | enum sctp_conntrack state; | 9 | enum sctp_conntrack state; |
| 10 | 10 | ||
| 11 | __be32 vtag[IP_CT_DIR_MAX]; | 11 | __be32 vtag[IP_CT_DIR_MAX]; |
| 12 | u8 last_dir; | ||
| 13 | u8 flags; | ||
| 12 | }; | 14 | }; |
| 13 | 15 | ||
| 14 | #endif /* _NF_CONNTRACK_SCTP_H */ | 16 | #endif /* _NF_CONNTRACK_SCTP_H */ |
| @@ -43,8 +43,7 @@ int nfnetlink_has_listeners(struct net *net, unsigned int group); · 42 unmodified lines | |||
| 43 | int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, | 43 | int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, |
| 44 | unsigned int group, int echo, gfp_t flags); | 44 | unsigned int group, int echo, gfp_t flags); |
| 45 | int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); | 45 | int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); |
| 46 | int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid, | 46 | int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid); |
| 47 | int flags); | ||
| 48 | 47 | ||
| 49 | static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type) | 48 | static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type) |
| 50 | { | 49 | { |
| @@ -44,19 +44,18 @@ struct powercap_control_type_ops { · 43 unmodified lines | |||
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | /** | 46 | /** |
| 47 | * struct powercap_control_type- Defines a powercap control_type | 47 | * struct powercap_control_type - Defines a powercap control_type |
| 48 | * @name: name of control_type | ||
| 49 | * @dev: device for this control_type | 48 | * @dev: device for this control_type |
| 50 | * @idr: idr to have unique id for its child | 49 | * @idr: idr to have unique id for its child |
| 51 | * @root_node: Root holding power zones for this control_type | 50 | * @nr_zones: counter for number of zones of this type |
| 52 | * @ops: Pointer to callback struct | 51 | * @ops: Pointer to callback struct |
| 53 | * @node_lock: mutex for control type | 52 | * @lock: mutex for control type |
| 54 | * @allocated: This is possible that client owns the memory | 53 | * @allocated: This is possible that client owns the memory |
| 55 | * used by this structure. In this case | 54 | * used by this structure. In this case |
| 56 | * this flag is set to false by framework to | 55 | * this flag is set to false by framework to |
| 57 | * prevent deallocation during release process. | 56 | * prevent deallocation during release process. |
| 58 | * Otherwise this flag is set to true. | 57 | * Otherwise this flag is set to true. |
| 59 | * @ctrl_inst: link to the control_type list | 58 | * @node: linked-list node |
| 60 | * | 59 | * |
| 61 | * Defines powercap control_type. This acts as a container for power | 60 | * Defines powercap control_type. This acts as a container for power |
| 62 | * zones, which use same method to control power. E.g. RAPL, RAPL-PCI etc. | 61 | * zones, which use same method to control power. E.g. RAPL, RAPL-PCI etc. |
| @@ -129,7 +128,7 @@ struct powercap_zone_ops { · 66 unmodified lines | |||
| 129 | * this flag is set to false by framework to | 128 | * this flag is set to false by framework to |
| 130 | * prevent deallocation during release process. | 129 | * prevent deallocation during release process. |
| 131 | * Otherwise this flag is set to true. | 130 | * Otherwise this flag is set to true. |
| 132 | * @constraint_ptr: List of constraints for this zone. | 131 | * @constraints: List of constraints for this zone. |
| 133 | * | 132 | * |
| 134 | * This defines a power zone instance. The fields of this structure are | 133 | * This defines a power zone instance. The fields of this structure are |
| 135 | * private, and should not be used by client drivers. | 134 | * private, and should not be used by client drivers. |
| @@ -71,7 +71,7 @@ · 70 unmodified lines | |||
| 71 | * NETIF_F_IPV6_CSUM - Driver (device) is only able to checksum plain | 71 | * NETIF_F_IPV6_CSUM - Driver (device) is only able to checksum plain |
| 72 | * TCP or UDP packets over IPv6. These are specifically | 72 | * TCP or UDP packets over IPv6. These are specifically |
| 73 | * unencapsulated packets of the form IPv6|TCP or | 73 | * unencapsulated packets of the form IPv6|TCP or |
| 74 | * IPv4|UDP where the Next Header field in the IPv6 | 74 | * IPv6|UDP where the Next Header field in the IPv6 |
| 75 | * header is either TCP or UDP. IPv6 extension headers | 75 | * header is either TCP or UDP. IPv6 extension headers |
| 76 | * are not supported with this feature. This feature | 76 | * are not supported with this feature. This feature |
| 77 | * cannot be set in features for a device with | 77 | * cannot be set in features for a device with |
| @@ -1056,7 +1056,16 @@ void kfree_skb(struct sk_buff *skb); · 978 unmodified lines | |||
| 1056 | void kfree_skb_list(struct sk_buff *segs); | 1056 | void kfree_skb_list(struct sk_buff *segs); |
| 1057 | void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt); | 1057 | void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt); |
| 1058 | void skb_tx_error(struct sk_buff *skb); | 1058 | void skb_tx_error(struct sk_buff *skb); |
| 1059 | |||
| 1060 | #ifdef CONFIG_TRACEPOINTS | ||
| 1059 | void consume_skb(struct sk_buff *skb); | 1061 | void consume_skb(struct sk_buff *skb); |
| 1062 | #else | ||
| 1063 | static inline void consume_skb(struct sk_buff *skb) | ||
| 1064 | { | ||
| 1065 | return kfree_skb(skb); | ||
| 1066 | } | ||
| 1067 | #endif | ||
| 1068 | |||
| 1060 | void __consume_stateless_skb(struct sk_buff *skb); | 1069 | void __consume_stateless_skb(struct sk_buff *skb); |
| 1061 | void __kfree_skb(struct sk_buff *skb); | 1070 | void __kfree_skb(struct sk_buff *skb); |
| 1062 | extern struct kmem_cache *skbuff_head_cache; | 1071 | extern struct kmem_cache *skbuff_head_cache; |
| @@ -2658,7 +2667,7 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) · 1595 unmodified lines | |||
| 2658 | * | 2667 | * |
| 2659 | * Using max(32, L1_CACHE_BYTES) makes sense (especially with RPS) | 2668 | * Using max(32, L1_CACHE_BYTES) makes sense (especially with RPS) |
| 2660 | * to reduce average number of cache lines per packet. | 2669 | * to reduce average number of cache lines per packet. |
| 2661 | * get_rps_cpus() for example only access one 64 bytes aligned block : | 2670 | * get_rps_cpu() for example only access one 64 bytes aligned block : |
| 2662 | * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) | 2671 | * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) |
| 2663 | */ | 2672 | */ |
| 2664 | #ifndef NET_SKB_PAD | 2673 | #ifndef NET_SKB_PAD |
| @@ -30,6 +30,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, · 29 unmodified lines | |||
| 30 | PGFAULT, PGMAJFAULT, | 30 | PGFAULT, PGMAJFAULT, |
| 31 | PGLAZYFREED, | 31 | PGLAZYFREED, |
| 32 | PGREFILL, | 32 | PGREFILL, |
| 33 | PGREUSE, | ||
| 33 | PGSTEAL_KSWAPD, | 34 | PGSTEAL_KSWAPD, |
| 34 | PGSTEAL_DIRECT, | 35 | PGSTEAL_DIRECT, |
| 35 | PGSCAN_KSWAPD, | 36 | PGSCAN_KSWAPD, |
| @@ -59,7 +59,7 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *, · 58 unmodified lines | |||
| 59 | void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *); | 59 | void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *); |
| 60 | void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *, | 60 | void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *, |
| 61 | struct sockaddr_rxrpc *); | 61 | struct sockaddr_rxrpc *); |
| 62 | u32 rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *); | 62 | bool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *); |
| 63 | int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, | 63 | int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, |
| 64 | rxrpc_user_attach_call_t, unsigned long, gfp_t, | 64 | rxrpc_user_attach_call_t, unsigned long, gfp_t, |
| 65 | unsigned int); | 65 | unsigned int); |
| @@ -494,7 +494,7 @@ int igmp6_event_report(struct sk_buff *skb); · 493 unmodified lines | |||
| 494 | 494 | ||
| 495 | #ifdef CONFIG_SYSCTL | 495 | #ifdef CONFIG_SYSCTL |
| 496 | int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, | 496 | int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, |
| 497 | void __user *buffer, size_t *lenp, loff_t *ppos); | 497 | void *buffer, size_t *lenp, loff_t *ppos); |
| 498 | int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl, | 498 | int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl, |
| 499 | void __user *oldval, size_t __user *oldlenp, | 499 | void __user *oldval, size_t __user *oldlenp, |
| 500 | void __user *newval, size_t newlen); | 500 | void __user *newval, size_t newlen); |
| @@ -143,6 +143,8 @@ static inline u64 nft_reg_load64(const u32 *sreg) · 142 unmodified lines | |||
| 143 | static inline void nft_data_copy(u32 *dst, const struct nft_data *src, | 143 | static inline void nft_data_copy(u32 *dst, const struct nft_data *src, |
| 144 | unsigned int len) | 144 | unsigned int len) |
| 145 | { | 145 | { |
| 146 | if (len % NFT_REG32_SIZE) | ||
| 147 | dst[len / NFT_REG32_SIZE] = 0; | ||
| 146 | memcpy(dst, src, len); | 148 | memcpy(dst, src, len); |
| 147 | } | 149 | } |
| 148 | 150 | ||
| @@ -45,6 +45,12 @@ · 44 unmodified lines | |||
| 45 | #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST 0x5B60 | 45 | #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST 0x5B60 |
| 46 | #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_LIMM 0x00010422 | 46 | #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_LIMM 0x00010422 |
| 47 | 47 | ||
| 48 | #ifndef AUX_IENABLE | ||
| 49 | #define AUX_IENABLE 0x40c | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #define CTOP_AUX_IACK (0xFFFFF800 + 0x088) | ||
| 53 | |||
| 48 | #ifndef __ASSEMBLY__ | 54 | #ifndef __ASSEMBLY__ |
| 49 | 55 | ||
| 50 | /* In order to increase compilation test coverage */ | 56 | /* In order to increase compilation test coverage */ |
| @@ -138,11 +138,16 @@ enum rxrpc_recvmsg_trace { · 137 unmodified lines | |||
| 138 | }; | 138 | }; |
| 139 | 139 | ||
| 140 | enum rxrpc_rtt_tx_trace { | 140 | enum rxrpc_rtt_tx_trace { |
| 141 | rxrpc_rtt_tx_cancel, | ||
| 141 | rxrpc_rtt_tx_data, | 142 | rxrpc_rtt_tx_data, |
| 143 | rxrpc_rtt_tx_no_slot, | ||
| 142 | rxrpc_rtt_tx_ping, | 144 | rxrpc_rtt_tx_ping, |
| 143 | }; | 145 | }; |
| 144 | 146 | ||
| 145 | enum rxrpc_rtt_rx_trace { | 147 | enum rxrpc_rtt_rx_trace { |
| 148 | rxrpc_rtt_rx_cancel, | ||
| 149 | rxrpc_rtt_rx_lost, | ||
| 150 | rxrpc_rtt_rx_obsolete, | ||
| 146 | rxrpc_rtt_rx_ping_response, | 151 | rxrpc_rtt_rx_ping_response, |
| 147 | rxrpc_rtt_rx_requested_ack, | 152 | rxrpc_rtt_rx_requested_ack, |
| 148 | }; | 153 | }; |
| @@ -339,10 +344,15 @@ enum rxrpc_tx_point { · 190 unmodified lines | |||
| 339 | E_(rxrpc_recvmsg_wait, "WAIT") | 344 | E_(rxrpc_recvmsg_wait, "WAIT") |
| 340 | 345 | ||
| 341 | #define rxrpc_rtt_tx_traces \ | 346 | #define rxrpc_rtt_tx_traces \ |
| 347 | EM(rxrpc_rtt_tx_cancel, "CNCE") \ | ||
| 342 | EM(rxrpc_rtt_tx_data, "DATA") \ | 348 | EM(rxrpc_rtt_tx_data, "DATA") \ |
| 349 | EM(rxrpc_rtt_tx_no_slot, "FULL") \ | ||
| 343 | E_(rxrpc_rtt_tx_ping, "PING") | 350 | E_(rxrpc_rtt_tx_ping, "PING") |
| 344 | 351 | ||
| 345 | #define rxrpc_rtt_rx_traces \ | 352 | #define rxrpc_rtt_rx_traces \ |
| 353 | EM(rxrpc_rtt_rx_cancel, "CNCL") \ | ||
| 354 | EM(rxrpc_rtt_rx_obsolete, "OBSL") \ | ||
| 355 | EM(rxrpc_rtt_rx_lost, "LOST") \ | ||
| 346 | EM(rxrpc_rtt_rx_ping_response, "PONG") \ | 356 | EM(rxrpc_rtt_rx_ping_response, "PONG") \ |
| 347 | E_(rxrpc_rtt_rx_requested_ack, "RACK") | 357 | E_(rxrpc_rtt_rx_requested_ack, "RACK") |
| 348 | 358 | ||
| @@ -1087,38 +1097,43 @@ TRACE_EVENT(rxrpc_recvmsg, · 738 unmodified lines | |||
| 1087 | 1097 | ||
| 1088 | TRACE_EVENT(rxrpc_rtt_tx, | 1098 | TRACE_EVENT(rxrpc_rtt_tx, |
| 1089 | TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why, | 1099 | TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why, |
| 1090 | rxrpc_serial_t send_serial), | 1100 | int slot, rxrpc_serial_t send_serial), |
| 1091 | 1101 | ||
| 1092 | TP_ARGS(call, why, send_serial), | 1102 | TP_ARGS(call, why, slot, send_serial), |
| 1093 | 1103 | ||
| 1094 | TP_STRUCT__entry( | 1104 | TP_STRUCT__entry( |
| 1095 | __field(unsigned int, call ) | 1105 | __field(unsigned int, call ) |
| 1096 | __field(enum rxrpc_rtt_tx_trace, why ) | 1106 | __field(enum rxrpc_rtt_tx_trace, why ) |
| 1107 | __field(int, slot ) | ||
| 1097 | __field(rxrpc_serial_t, send_serial ) | 1108 | __field(rxrpc_serial_t, send_serial ) |
| 1098 | ), | 1109 | ), |
| 1099 | 1110 | ||
| 1100 | TP_fast_assign( | 1111 | TP_fast_assign( |
| 1101 | __entry->call = call->debug_id; | 1112 | __entry->call = call->debug_id; |
| 1102 | __entry->why = why; | 1113 | __entry->why = why; |
| 1114 | __entry->slot = slot; | ||
| 1103 | __entry->send_serial = send_serial; | 1115 | __entry->send_serial = send_serial; |
| 1104 | ), | 1116 | ), |
| 1105 | 1117 | ||
| 1106 | TP_printk("c=%08x %s sr=%08x", | 1118 | TP_printk("c=%08x [%d] %s sr=%08x", |
| 1107 | __entry->call, | 1119 | __entry->call, |
| 1120 | __entry->slot, | ||
| 1108 | __print_symbolic(__entry->why, rxrpc_rtt_tx_traces), | 1121 | __print_symbolic(__entry->why, rxrpc_rtt_tx_traces), |
| 1109 | __entry->send_serial) | 1122 | __entry->send_serial) |
| 1110 | ); | 1123 | ); |
| 1111 | 1124 | ||
| 1112 | TRACE_EVENT(rxrpc_rtt_rx, | 1125 | TRACE_EVENT(rxrpc_rtt_rx, |
| 1113 | TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, | 1126 | TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, |
| 1127 | int slot, | ||
| 1114 | rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial, | 1128 | rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial, |
| 1115 | u32 rtt, u32 rto), | 1129 | u32 rtt, u32 rto), |
| 1116 | 1130 | ||
| 1117 | TP_ARGS(call, why, send_serial, resp_serial, rtt, rto), | 1131 | TP_ARGS(call, why, slot, send_serial, resp_serial, rtt, rto), |
| 1118 | 1132 | ||
| 1119 | TP_STRUCT__entry( | 1133 | TP_STRUCT__entry( |
| 1120 | __field(unsigned int, call ) | 1134 | __field(unsigned int, call ) |
| 1121 | __field(enum rxrpc_rtt_rx_trace, why ) | 1135 | __field(enum rxrpc_rtt_rx_trace, why ) |
| 1136 | __field(int, slot ) | ||
| 1122 | __field(rxrpc_serial_t, send_serial ) | 1137 | __field(rxrpc_serial_t, send_serial ) |
| 1123 | __field(rxrpc_serial_t, resp_serial ) | 1138 | __field(rxrpc_serial_t, resp_serial ) |
| 1124 | __field(u32, rtt ) | 1139 | __field(u32, rtt ) |
| @@ -1128,14 +1143,16 @@ TRACE_EVENT(rxrpc_rtt_rx, · 3 unmodified lines | |||
| 1128 | TP_fast_assign( | 1143 | TP_fast_assign( |
| 1129 | __entry->call = call->debug_id; | 1144 | __entry->call = call->debug_id; |
| 1130 | __entry->why = why; | 1145 | __entry->why = why; |
| 1146 | __entry->slot = slot; | ||
| 1131 | __entry->send_serial = send_serial; | 1147 | __entry->send_serial = send_serial; |
| 1132 | __entry->resp_serial = resp_serial; | 1148 | __entry->resp_serial = resp_serial; |
| 1133 | __entry->rtt = rtt; | 1149 | __entry->rtt = rtt; |
| 1134 | __entry->rto = rto; | 1150 | __entry->rto = rto; |
| 1135 | ), | 1151 | ), |
| 1136 | 1152 | ||
| 1137 | TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%u rto=%u", | 1153 | TP_printk("c=%08x [%d] %s sr=%08x rr=%08x rtt=%u rto=%u", |
| 1138 | __entry->call, | 1154 | __entry->call, |
| 1155 | __entry->slot, | ||
| 1139 | __print_symbolic(__entry->why, rxrpc_rtt_rx_traces), | 1156 | __print_symbolic(__entry->why, rxrpc_rtt_rx_traces), |
| 1140 | __entry->send_serial, | 1157 | __entry->send_serial, |
| 1141 | __entry->resp_serial, | 1158 | __entry->resp_serial, |
| @@ -135,7 +135,7 @@ struct in_addr { · 134 unmodified lines | |||
| 135 | * this socket to prevent accepting spoofed ones. | 135 | * this socket to prevent accepting spoofed ones. |
| 136 | */ | 136 | */ |
| 137 | #define IP_PMTUDISC_INTERFACE 4 | 137 | #define IP_PMTUDISC_INTERFACE 4 |
| 138 | /* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get | 138 | /* weaker version of IP_PMTUDISC_INTERFACE, which allows packets to get |
| 139 | * fragmented if they exeed the interface mtu | 139 | * fragmented if they exeed the interface mtu |
| 140 | */ | 140 | */ |
| 141 | #define IP_PMTUDISC_OMIT 5 | 141 | #define IP_PMTUDISC_OMIT 5 |
| @@ -790,9 +790,10 @@ struct kvm_ppc_resize_hpt { · 789 unmodified lines | |||
| 790 | #define KVM_VM_PPC_HV 1 | 790 | #define KVM_VM_PPC_HV 1 |
| 791 | #define KVM_VM_PPC_PR 2 | 791 | #define KVM_VM_PPC_PR 2 |
| 792 | 792 | ||
| 793 | /* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */ | 793 | /* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */ |
| 794 | #define KVM_VM_MIPS_TE 0 | 794 | #define KVM_VM_MIPS_AUTO 0 |
| 795 | #define KVM_VM_MIPS_VZ 1 | 795 | #define KVM_VM_MIPS_VZ 1 |
| 796 | #define KVM_VM_MIPS_TE 2 | ||
| 796 | 797 | ||
| 797 | #define KVM_S390_SIE_PAGE_OFFSET 1 | 798 | #define KVM_S390_SIE_PAGE_OFFSET 1 |
| 798 | 799 | ||
| @@ -1035,6 +1036,7 @@ struct kvm_ppc_resize_hpt { · 236 unmodified lines | |||
| 1035 | #define KVM_CAP_LAST_CPU 184 | 1036 | #define KVM_CAP_LAST_CPU 184 |
| 1036 | #define KVM_CAP_SMALLER_MAXPHYADDR 185 | 1037 | #define KVM_CAP_SMALLER_MAXPHYADDR 185 |
| 1037 | #define KVM_CAP_S390_DIAG318 186 | 1038 | #define KVM_CAP_S390_DIAG318 186 |
| 1039 | #define KVM_CAP_STEAL_TIME 187 | ||
| 1038 | 1040 | ||
| 1039 | #ifdef KVM_CAP_IRQ_ROUTING | 1041 | #ifdef KVM_CAP_IRQ_ROUTING |
| 1040 | 1042 | ||
| @@ -133,7 +133,7 @@ enum nf_tables_msg_types { · 132 unmodified lines | |||
| 133 | * @NFTA_LIST_ELEM: list element (NLA_NESTED) | 133 | * @NFTA_LIST_ELEM: list element (NLA_NESTED) |
| 134 | */ | 134 | */ |
| 135 | enum nft_list_attributes { | 135 | enum nft_list_attributes { |
| 136 | NFTA_LIST_UNPEC, | 136 | NFTA_LIST_UNSPEC, |
| 137 | NFTA_LIST_ELEM, | 137 | NFTA_LIST_ELEM, |
| 138 | __NFTA_LIST_MAX | 138 | __NFTA_LIST_MAX |
| 139 | }; | 139 | }; |
| @@ -2,6 +2,8 @@ · 1 unmodified line | |||
| 2 | /****************************************************************************** | 2 | /****************************************************************************** |
| 3 | * Xen balloon functionality | 3 | * Xen balloon functionality |
| 4 | */ | 4 | */ |
| 5 | #ifndef _XEN_BALLOON_H | ||
| 6 | #define _XEN_BALLOON_H | ||
| 5 | 7 | ||
| 6 | #define RETRY_UNLIMITED 0 | 8 | #define RETRY_UNLIMITED 0 |
| 7 | 9 | ||
| @@ -34,3 +36,5 @@ static inline void xen_balloon_init(void) · 26 unmodified lines | |||
| 34 | { | 36 | { |
| 35 | } | 37 | } |
| 36 | #endif | 38 | #endif |
| 39 | |||
| 40 | #endif /* _XEN_BALLOON_H */ | ||
| @@ -52,4 +52,13 @@ bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, · 51 unmodified lines | |||
| 52 | extern u64 xen_saved_max_mem_size; | 52 | extern u64 xen_saved_max_mem_size; |
| 53 | #endif | 53 | #endif |
| 54 | 54 | ||
| 55 | #ifdef CONFIG_XEN_UNPOPULATED_ALLOC | ||
| 56 | int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages); | ||
| 57 | void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages); | ||
| 58 | #else | ||
| 59 | #define xen_alloc_unpopulated_pages alloc_xenballooned_pages | ||
| 60 | #define xen_free_unpopulated_pages free_xenballooned_pages | ||
| 61 | #include <xen/balloon.h> | ||
| 62 | #endif | ||
| 63 | |||
| 55 | #endif /* _XEN_XEN_H */ | 64 | #endif /* _XEN_XEN_H */ |
| @@ -297,7 +297,7 @@ static void __init clean_path(char *path, umode_t fmode) · 296 unmodified lines | |||
| 297 | { | 297 | { |
| 298 | struct kstat st; | 298 | struct kstat st; |
| 299 | 299 | ||
| 300 | if (init_stat(path, &st, AT_SYMLINK_NOFOLLOW) && | 300 | if (!init_stat(path, &st, AT_SYMLINK_NOFOLLOW) && |
| 301 | (st.mode ^ fmode) & S_IFMT) { | 301 | (st.mode ^ fmode) & S_IFMT) { |
| 302 | if (S_ISDIR(st.mode)) | 302 | if (S_ISDIR(st.mode)) |
| 303 | init_rmdir(path); | 303 | init_rmdir(path); |
| @@ -85,7 +85,7 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int write, · 84 unmodified lines | |||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | static int proc_ipc_sem_dointvec(struct ctl_table *table, int write, | 87 | static int proc_ipc_sem_dointvec(struct ctl_table *table, int write, |
| 88 | void __user *buffer, size_t *lenp, loff_t *ppos) | 88 | void *buffer, size_t *lenp, loff_t *ppos) |
| 89 | { | 89 | { |
| 90 | int ret, semmni; | 90 | int ret, semmni; |
| 91 | struct ipc_namespace *ns = current->nsproxy->ipc_ns; | 91 | struct ipc_namespace *ns = current->nsproxy->ipc_ns; |
| @@ -2634,7 +2634,7 @@ static int bpf_raw_tp_link_fill_link_info(const struct bpf_link *link, · 2633 unmodified lines | |||
| 2634 | u32 ulen = info->raw_tracepoint.tp_name_len; | 2634 | u32 ulen = info->raw_tracepoint.tp_name_len; |
| 2635 | size_t tp_len = strlen(tp_name); | 2635 | size_t tp_len = strlen(tp_name); |
| 2636 | 2636 | ||
| 2637 | if (ulen && !ubuf) | 2637 | if (!ulen ^ !ubuf) |
| 2638 | return -EINVAL; | 2638 | return -EINVAL; |
| 2639 | 2639 | ||
| 2640 | info->raw_tracepoint.tp_name_len = tp_len + 1; | 2640 | info->raw_tracepoint.tp_name_len = tp_len + 1; |
| @@ -69,22 +69,45 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall, · 68 unmodified lines | |||
| 69 | return ret ? : syscall_get_nr(current, regs); | 69 | return ret ? : syscall_get_nr(current, regs); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall) | 72 | static __always_inline long |
| 73 | __syscall_enter_from_user_work(struct pt_regs *regs, long syscall) | ||
| 73 | { | 74 | { |
| 74 | unsigned long ti_work; | 75 | unsigned long ti_work; |
| 75 | 76 | ||
| 76 | enter_from_user_mode(regs); | ||
| 77 | instrumentation_begin(); | ||
| 78 | |||
| 79 | local_irq_enable(); | ||
| 80 | ti_work = READ_ONCE(current_thread_info()->flags); | 77 | ti_work = READ_ONCE(current_thread_info()->flags); |
| 81 | if (ti_work & SYSCALL_ENTER_WORK) | 78 | if (ti_work & SYSCALL_ENTER_WORK) |
| 82 | syscall = syscall_trace_enter(regs, syscall, ti_work); | 79 | syscall = syscall_trace_enter(regs, syscall, ti_work); |
| 83 | instrumentation_end(); | ||
| 84 | 80 | ||
| 85 | return syscall; | 81 | return syscall; |
| 86 | } | 82 | } |
| 87 | 83 | ||
| 84 | long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall) | ||
| 85 | { | ||
| 86 | return __syscall_enter_from_user_work(regs, syscall); | ||
| 87 | } | ||
| 88 | |||
| 89 | noinstr long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall) | ||
| 90 | { | ||
| 91 | long ret; | ||
| 92 | |||
| 93 | enter_from_user_mode(regs); | ||
| 94 | |||
| 95 | instrumentation_begin(); | ||
| 96 | local_irq_enable(); | ||
| 97 | ret = __syscall_enter_from_user_work(regs, syscall); | ||
| 98 | instrumentation_end(); | ||
| 99 | |||
| 100 | return ret; | ||
| 101 | } | ||
| 102 | |||
| 103 | noinstr void syscall_enter_from_user_mode_prepare(struct pt_regs *regs) | ||
| 104 | { | ||
| 105 | enter_from_user_mode(regs); | ||
| 106 | instrumentation_begin(); | ||
| 107 | local_irq_enable(); | ||
| 108 | instrumentation_end(); | ||
| 109 | } | ||
| 110 | |||
| 88 | /** | 111 | /** |
| 89 | * exit_to_user_mode - Fixup state when exiting to user mode | 112 | * exit_to_user_mode - Fixup state when exiting to user mode |
| 90 | * | 113 | * |
| @@ -3014,7 +3014,7 @@ int unshare_files(struct files_struct **displaced) · 3013 unmodified lines | |||
| 3014 | } | 3014 | } |
| 3015 | 3015 | ||
| 3016 | int sysctl_max_threads(struct ctl_table *table, int write, | 3016 | int sysctl_max_threads(struct ctl_table *table, int write, |
| 3017 | void __user *buffer, size_t *lenp, loff_t *ppos) | 3017 | void *buffer, size_t *lenp, loff_t *ppos) |
| 3018 | { | 3018 | { |
| 3019 | struct ctl_table t; | 3019 | struct ctl_table t; |
| 3020 | int ret; | 3020 | int ret; |
| @@ -19,7 +19,9 @@ · 18 unmodified lines | |||
| 19 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
| 20 | #include "gcov.h" | 20 | #include "gcov.h" |
| 21 | 21 | ||
| 22 | #if (__GNUC__ >= 7) | 22 | #if (__GNUC__ >= 10) |
| 23 | #define GCOV_COUNTERS 8 | ||
| 24 | #elif (__GNUC__ >= 7) | ||
| 23 | #define GCOV_COUNTERS 9 | 25 | #define GCOV_COUNTERS 9 |
| 24 | #elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) | 26 | #elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) |
| 25 | #define GCOV_COUNTERS 10 | 27 | #define GCOV_COUNTERS 10 |
| @@ -215,12 +215,13 @@ int padata_do_parallel(struct padata_shell *ps, · 214 unmodified lines | |||
| 215 | padata->pd = pd; | 215 | padata->pd = pd; |
| 216 | padata->cb_cpu = *cb_cpu; | 216 | padata->cb_cpu = *cb_cpu; |
| 217 | 217 | ||
| 218 | rcu_read_unlock_bh(); | ||
| 219 | |||
| 220 | spin_lock(&padata_works_lock); | 218 | spin_lock(&padata_works_lock); |
| 221 | padata->seq_nr = ++pd->seq_nr; | 219 | padata->seq_nr = ++pd->seq_nr; |
| 222 | pw = padata_work_alloc(); | 220 | pw = padata_work_alloc(); |
| 223 | spin_unlock(&padata_works_lock); | 221 | spin_unlock(&padata_works_lock); |
| 222 | |||
| 223 | rcu_read_unlock_bh(); | ||
| 224 | |||
| 224 | if (pw) { | 225 | if (pw) { |
| 225 | padata_work_init(pw, padata_parallel_worker, padata, 0); | 226 | padata_work_init(pw, padata_parallel_worker, padata, 0); |
| 226 | queue_work(pinst->parallel_wq, &pw->pw_work); | 227 | queue_work(pinst->parallel_wq, &pw->pw_work); |
| @@ -1109,13 +1109,18 @@ out: · 1108 unmodified lines | |||
| 1109 | } | 1109 | } |
| 1110 | 1110 | ||
| 1111 | #ifdef CONFIG_SECCOMP_FILTER | 1111 | #ifdef CONFIG_SECCOMP_FILTER |
| 1112 | static int seccomp_notify_release(struct inode *inode, struct file *file) | 1112 | static void seccomp_notify_free(struct seccomp_filter *filter) |
| 1113 | { | ||
| 1114 | kfree(filter->notif); | ||
| 1115 | filter->notif = NULL; | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | static void seccomp_notify_detach(struct seccomp_filter *filter) | ||
| 1113 | { | 1119 | { |
| 1114 | struct seccomp_filter *filter = file->private_data; | ||
| 1115 | struct seccomp_knotif *knotif; | 1120 | struct seccomp_knotif *knotif; |
| 1116 | 1121 | ||
| 1117 | if (!filter) | 1122 | if (!filter) |
| 1118 | return 0; | 1123 | return; |
| 1119 | 1124 | ||
| 1120 | mutex_lock(&filter->notify_lock); | 1125 | mutex_lock(&filter->notify_lock); |
| 1121 | 1126 | ||
| @@ -1139,9 +1144,15 @@ static int seccomp_notify_release(struct inode *inode, struct file *file) · 17 unmodified lines | |||
| 1139 | complete(&knotif->ready); | 1144 | complete(&knotif->ready); |
| 1140 | } | 1145 | } |
| 1141 | 1146 | ||
| 1142 | kfree(filter->notif); | 1147 | seccomp_notify_free(filter); |
| 1143 | filter->notif = NULL; | ||
| 1144 | mutex_unlock(&filter->notify_lock); | 1148 | mutex_unlock(&filter->notify_lock); |
| 1149 | } | ||
| 1150 | |||
| 1151 | static int seccomp_notify_release(struct inode *inode, struct file *file) | ||
| 1152 | { | ||
| 1153 | struct seccomp_filter *filter = file->private_data; | ||
| 1154 | |||
| 1155 | seccomp_notify_detach(filter); | ||
| 1145 | __put_seccomp_filter(filter); | 1156 | __put_seccomp_filter(filter); |
| 1146 | return 0; | 1157 | return 0; |
| 1147 | } | 1158 | } |
| @@ -1488,7 +1499,7 @@ static struct file *init_listener(struct seccomp_filter *filter) · 340 unmodified lines | |||
| 1488 | 1499 | ||
| 1489 | out_notif: | 1500 | out_notif: |
| 1490 | if (IS_ERR(ret)) | 1501 | if (IS_ERR(ret)) |
| 1491 | kfree(filter->notif); | 1502 | seccomp_notify_free(filter); |
| 1492 | out: | 1503 | out: |
| 1493 | return ret; | 1504 | return ret; |
| 1494 | } | 1505 | } |
| @@ -1581,6 +1592,7 @@ out_put_fd: · 86 unmodified lines | |||
| 1581 | listener_f->private_data = NULL; | 1592 | listener_f->private_data = NULL; |
| 1582 | fput(listener_f); | 1593 | fput(listener_f); |
| 1583 | put_unused_fd(listener); | 1594 | put_unused_fd(listener); |
| 1595 | seccomp_notify_detach(prepared); | ||
| 1584 | } else { | 1596 | } else { |
| 1585 | fd_install(listener, listener_f); | 1597 | fd_install(listener, listener_f); |
| 1586 | ret = listener; | 1598 | ret = listener; |
| @@ -204,8 +204,7 @@ static int max_extfrag_threshold = 1000; · 203 unmodified lines | |||
| 204 | 204 | ||
| 205 | #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL) | 205 | #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL) |
| 206 | static int bpf_stats_handler(struct ctl_table *table, int write, | 206 | static int bpf_stats_handler(struct ctl_table *table, int write, |
| 207 | void __user *buffer, size_t *lenp, | 207 | void *buffer, size_t *lenp, loff_t *ppos) |
| 208 | loff_t *ppos) | ||
| 209 | { | 208 | { |
| 210 | struct static_key *key = (struct static_key *)table->data; | 209 | struct static_key *key = (struct static_key *)table->data; |
| 211 | static int saved_val; | 210 | static int saved_val; |
| @@ -353,8 +353,7 @@ static int check_set(const char **dest, char *src, char *name) · 352 unmodified lines | |||
| 353 | 353 | ||
| 354 | /* | 354 | /* |
| 355 | * Parse words[] as a ddebug query specification, which is a series | 355 | * Parse words[] as a ddebug query specification, which is a series |
| 356 | * of (keyword, value) pairs or combined keyword=value terms, | 356 | * of (keyword, value) pairs chosen from these possibilities: |
| 357 | * chosen from these possibilities: | ||
| 358 | * | 357 | * |
| 359 | * func <function-name> | 358 | * func <function-name> |
| 360 | * file <full-pathname> | 359 | * file <full-pathname> |
| @@ -373,34 +372,22 @@ static int ddebug_parse_query(char *words[], int nwords, · 12 unmodified lines | |||
| 373 | unsigned int i; | 372 | unsigned int i; |
| 374 | int rc = 0; | 373 | int rc = 0; |
| 375 | char *fline; | 374 | char *fline; |
| 376 | char *keyword, *arg; | 375 | |
| 376 | /* check we have an even number of words */ | ||
| 377 | if (nwords % 2 != 0) { | ||
| 378 | pr_err("expecting pairs of match-spec <value>\n"); | ||
| 379 | return -EINVAL; | ||
| 380 | } | ||
| 377 | 381 | ||
| 378 | if (modname) | 382 | if (modname) |
| 379 | /* support $modname.dyndbg=<multiple queries> */ | 383 | /* support $modname.dyndbg=<multiple queries> */ |
| 380 | query->module = modname; | 384 | query->module = modname; |
| 381 | 385 | ||
| 382 | for (i = 0; i < nwords; i++) { | 386 | for (i = 0; i < nwords; i += 2) { |
| 383 | /* accept keyword=arg */ | 387 | if (!strcmp(words[i], "func")) { |
| 384 | vpr_info("%d w:%s\n", i, words[i]); | 388 | rc = check_set(&query->function, words[i+1], "func"); |
| 385 | 389 | } else if (!strcmp(words[i], "file")) { | |
| 386 | keyword = words[i]; | 390 | if (check_set(&query->filename, words[i+1], "file")) |
| 387 | arg = strchr(keyword, '='); | ||
| 388 | if (arg) { | ||
| 389 | *arg++ = '\0'; | ||
| 390 | } else { | ||
| 391 | i++; /* next word is arg */ | ||
| 392 | if (!(i < nwords)) { | ||
| 393 | pr_err("missing arg to keyword: %s\n", keyword); | ||
| 394 | return -EINVAL; | ||
| 395 | } | ||
| 396 | arg = words[i]; | ||
| 397 | } | ||
| 398 | vpr_info("%d key:%s arg:%s\n", i, keyword, arg); | ||
| 399 | |||
| 400 | if (!strcmp(keyword, "func")) { | ||
| 401 | rc = check_set(&query->function, arg, "func"); | ||
| 402 | } else if (!strcmp(keyword, "file")) { | ||
| 403 | if (check_set(&query->filename, arg, "file")) | ||
| 404 | return -EINVAL; | 391 | return -EINVAL; |
| 405 | 392 | ||
| 406 | /* tail :$info is function or line-range */ | 393 | /* tail :$info is function or line-range */ |
| @@ -416,18 +403,18 @@ static int ddebug_parse_query(char *words[], int nwords, · 9 unmodified lines | |||
| 416 | if (parse_linerange(query, fline)) | 403 | if (parse_linerange(query, fline)) |
| 417 | return -EINVAL; | 404 | return -EINVAL; |
| 418 | } | 405 | } |
| 419 | } else if (!strcmp(keyword, "module")) { | 406 | } else if (!strcmp(words[i], "module")) { |
| 420 | rc = check_set(&query->module, arg, "module"); | 407 | rc = check_set(&query->module, words[i+1], "module"); |
| 421 | } else if (!strcmp(keyword, "format")) { | 408 | } else if (!strcmp(words[i], "format")) { |
| 422 | string_unescape_inplace(arg, UNESCAPE_SPACE | | 409 | string_unescape_inplace(words[i+1], UNESCAPE_SPACE | |
| 423 | UNESCAPE_OCTAL | | 410 | UNESCAPE_OCTAL | |
| 424 | UNESCAPE_SPECIAL); | 411 | UNESCAPE_SPECIAL); |
| 425 | rc = check_set(&query->format, arg, "format"); | 412 | rc = check_set(&query->format, words[i+1], "format"); |
| 426 | } else if (!strcmp(keyword, "line")) { | 413 | } else if (!strcmp(words[i], "line")) { |
| 427 | if (parse_linerange(query, arg)) | 414 | if (parse_linerange(query, words[i+1])) |
| 428 | return -EINVAL; | 415 | return -EINVAL; |
| 429 | } else { | 416 | } else { |
| 430 | pr_err("unknown keyword \"%s\"\n", keyword); | 417 | pr_err("unknown keyword \"%s\"\n", words[i]); |
| 431 | return -EINVAL; | 418 | return -EINVAL; |
| 432 | } | 419 | } |
| 433 | if (rc) | 420 | if (rc) |
| @@ -525,7 +512,7 @@ static int ddebug_exec_query(char *query_string, const char *modname) · 91 unmodified lines | |||
| 525 | last error or number of matching callsites. Module name is either | 512 | last error or number of matching callsites. Module name is either |
| 526 | in param (for boot arg) or perhaps in query string. | 513 | in param (for boot arg) or perhaps in query string. |
| 527 | */ | 514 | */ |
| 528 | int ddebug_exec_queries(char *query, const char *modname) | 515 | static int ddebug_exec_queries(char *query, const char *modname) |
| 529 | { | 516 | { |
| 530 | char *split; | 517 | char *split; |
| 531 | int i, errs = 0, exitcode = 0, rc, nfound = 0; | 518 | int i, errs = 0, exitcode = 0, rc, nfound = 0; |
| @@ -557,7 +544,30 @@ int ddebug_exec_queries(char *query, const char *modname) · 25 unmodified lines | |||
| 557 | return exitcode; | 544 | return exitcode; |
| 558 | return nfound; | 545 | return nfound; |
| 559 | } | 546 | } |
| 560 | EXPORT_SYMBOL_GPL(ddebug_exec_queries); | 547 | |
| 548 | /** | ||
| 549 | * dynamic_debug_exec_queries - select and change dynamic-debug prints | ||
| 550 | * @query: query-string described in admin-guide/dynamic-debug-howto | ||
| 551 | * @modname: string containing module name, usually &module.mod_name | ||
| 552 | * | ||
| 553 | * This uses the >/proc/dynamic_debug/control reader, allowing module | ||
| 554 | * authors to modify their dynamic-debug callsites. The modname is | ||
| 555 | * canonically struct module.mod_name, but can also be null or a | ||
| 556 | * module-wildcard, for example: "drm*". | ||
| 557 | */ | ||
| 558 | int dynamic_debug_exec_queries(const char *query, const char *modname) | ||
| 559 | { | ||
| 560 | int rc; | ||
| 561 | char *qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL); | ||
| 562 | |||
| 563 | if (!query) | ||
| 564 | return -ENOMEM; | ||
| 565 | |||
| 566 | rc = ddebug_exec_queries(qry, modname); | ||
| 567 | kfree(qry); | ||
| 568 | return rc; | ||
| 569 | } | ||
| 570 | EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries); | ||
| 561 | 571 | ||
| 562 | #define PREFIX_SIZE 64 | 572 | #define PREFIX_SIZE 64 |
| 563 | 573 | ||
| @@ -947,7 +957,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n, · 383 unmodified lines | |||
| 947 | list_add(&dt->link, &ddebug_tables); | 957 | list_add(&dt->link, &ddebug_tables); |
| 948 | mutex_unlock(&ddebug_lock); | 958 | mutex_unlock(&ddebug_lock); |
| 949 | 959 | ||
| 950 | v2pr_info("%u debug prints in module %s\n", n, dt->mod_name); | 960 | v2pr_info("%3u debug prints in module %s\n", n, dt->mod_name); |
| 951 | return 0; | 961 | return 0; |
| 952 | } | 962 | } |
| 953 | 963 | ||
| @@ -604,9 +604,6 @@ static void __kobject_del(struct kobject *kobj) · 603 unmodified lines | |||
| 604 | struct kernfs_node *sd; | 604 | struct kernfs_node *sd; |
| 605 | const struct kobj_type *ktype; | 605 | const struct kobj_type *ktype; |
| 606 | 606 | ||
| 607 | if (!kobj) | ||
| 608 | return; | ||
| 609 | |||
| 610 | sd = kobj->sd; | 607 | sd = kobj->sd; |
| 611 | ktype = get_ktype(kobj); | 608 | ktype = get_ktype(kobj); |
| 612 | 609 | ||
| @@ -637,8 +634,12 @@ static void __kobject_del(struct kobject *kobj) · 24 unmodified lines | |||
| 637 | */ | 634 | */ |
| 638 | void kobject_del(struct kobject *kobj) | 635 | void kobject_del(struct kobject *kobj) |
| 639 | { | 636 | { |
| 640 | struct kobject *parent = kobj->parent; | 637 | struct kobject *parent; |
| 638 | |||
| 639 | if (!kobj) | ||
| 640 | return; | ||
| 641 | 641 | ||
| 642 | parent = kobj->parent; | ||
| 642 | __kobject_del(kobj); | 643 | __kobject_del(kobj); |
| 643 | kobject_put(parent); | 644 | kobject_put(parent); |
| 644 | } | 645 | } |
| @@ -26,6 +26,8 @@ · 25 unmodified lines | |||
| 26 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
| 27 | #include <linux/efi_embedded_fw.h> | 27 | #include <linux/efi_embedded_fw.h> |
| 28 | 28 | ||
| 29 | MODULE_IMPORT_NS(TEST_FIRMWARE); | ||
| 30 | |||
| 29 | #define TEST_FIRMWARE_NAME "test-firmware.bin" | 31 | #define TEST_FIRMWARE_NAME "test-firmware.bin" |
| 30 | #define TEST_FIRMWARE_NUM_REQS 4 | 32 | #define TEST_FIRMWARE_NUM_REQS 4 |
| 31 | #define TEST_FIRMWARE_BUF_SIZE SZ_1K | 33 | #define TEST_FIRMWARE_BUF_SIZE SZ_1K |
| @@ -489,6 +491,9 @@ out: · 457 unmodified lines | |||
| 489 | static DEVICE_ATTR_WO(trigger_request); | 491 | static DEVICE_ATTR_WO(trigger_request); |
| 490 | 492 | ||
| 491 | #ifdef CONFIG_EFI_EMBEDDED_FIRMWARE | 493 | #ifdef CONFIG_EFI_EMBEDDED_FIRMWARE |
| 494 | extern struct list_head efi_embedded_fw_list; | ||
| 495 | extern bool efi_embedded_fw_checked; | ||
| 496 | |||
| 492 | static ssize_t trigger_request_platform_store(struct device *dev, | 497 | static ssize_t trigger_request_platform_store(struct device *dev, |
| 493 | struct device_attribute *attr, | 498 | struct device_attribute *attr, |
| 494 | const char *buf, size_t count) | 499 | const char *buf, size_t count) |
| @@ -501,6 +506,7 @@ static ssize_t trigger_request_platform_store(struct device *dev, · 6 unmodified lines | |||
| 501 | }; | 506 | }; |
| 502 | struct efi_embedded_fw efi_embedded_fw; | 507 | struct efi_embedded_fw efi_embedded_fw; |
| 503 | const struct firmware *firmware = NULL; | 508 | const struct firmware *firmware = NULL; |
| 509 | bool saved_efi_embedded_fw_checked; | ||
| 504 | char *name; | 510 | char *name; |
| 505 | int rc; | 511 | int rc; |
| 506 | 512 | ||
| @@ -513,6 +519,8 @@ static ssize_t trigger_request_platform_store(struct device *dev, · 6 unmodified lines | |||
| 513 | efi_embedded_fw.data = (void *)test_data; | 519 | efi_embedded_fw.data = (void *)test_data; |
| 514 | efi_embedded_fw.length = sizeof(test_data); | 520 | efi_embedded_fw.length = sizeof(test_data); |
| 515 | list_add(&efi_embedded_fw.list, &efi_embedded_fw_list); | 521 | list_add(&efi_embedded_fw.list, &efi_embedded_fw_list); |
| 522 | saved_efi_embedded_fw_checked = efi_embedded_fw_checked; | ||
| 523 | efi_embedded_fw_checked = true; | ||
| 516 | 524 | ||
| 517 | pr_info("loading '%s'\n", name); | 525 | pr_info("loading '%s'\n", name); |
| 518 | rc = firmware_request_platform(&firmware, name, dev); | 526 | rc = firmware_request_platform(&firmware, name, dev); |
| @@ -530,6 +538,7 @@ static ssize_t trigger_request_platform_store(struct device *dev, · 11 unmodified lines | |||
| 530 | rc = count; | 538 | rc = count; |
| 531 | 539 | ||
| 532 | out: | 540 | out: |
| 541 | efi_embedded_fw_checked = saved_efi_embedded_fw_checked; | ||
| 533 | release_firmware(firmware); | 542 | release_firmware(firmware); |
| 534 | list_del(&efi_embedded_fw.list); | 543 | list_del(&efi_embedded_fw.list); |
| 535 | kfree(name); | 544 | kfree(name); |
| @@ -381,22 +381,13 @@ static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address, · 380 unmodified lines | |||
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | /* | 383 | /* |
| 384 | * FOLL_FORCE or a forced COW break can write even to unwritable pte's, | 384 | * FOLL_FORCE can write to even unwritable pte's, but only |
| 385 | * but only after we've gone through a COW cycle and they are dirty. | 385 | * after we've gone through a COW cycle and they are dirty. |
| 386 | */ | 386 | */ |
| 387 | static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) | 387 | static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) |
| 388 | { | 388 | { |
| 389 | return pte_write(pte) || ((flags & FOLL_COW) && pte_dirty(pte)); | 389 | return pte_write(pte) || |
| 390 | } | 390 | ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); |
| 391 | |||
| 392 | /* | ||
| 393 | * A (separate) COW fault might break the page the other way and | ||
| 394 | * get_user_pages() would return the page from what is now the wrong | ||
| 395 | * VM. So we need to force a COW break at GUP time even for reads. | ||
| 396 | */ | ||
| 397 | static inline bool should_force_cow_break(struct vm_area_struct *vma, unsigned int flags) | ||
| 398 | { | ||
| 399 | return is_cow_mapping(vma->vm_flags) && (flags & (FOLL_GET | FOLL_PIN)); | ||
| 400 | } | 391 | } |
| 401 | 392 | ||
| 402 | static struct page *follow_page_pte(struct vm_area_struct *vma, | 393 | static struct page *follow_page_pte(struct vm_area_struct *vma, |
| @@ -843,7 +834,7 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address, · 440 unmodified lines | |||
| 843 | goto unmap; | 834 | goto unmap; |
| 844 | *page = pte_page(*pte); | 835 | *page = pte_page(*pte); |
| 845 | } | 836 | } |
| 846 | if (unlikely(!try_get_page(*page))) { | 837 | if (unlikely(!try_grab_page(*page, gup_flags))) { |
| 847 | ret = -ENOMEM; | 838 | ret = -ENOMEM; |
| 848 | goto unmap; | 839 | goto unmap; |
| 849 | } | 840 | } |
| @@ -1067,11 +1058,9 @@ static long __get_user_pages(struct mm_struct *mm, · 217 unmodified lines | |||
| 1067 | goto out; | 1058 | goto out; |
| 1068 | } | 1059 | } |
| 1069 | if (is_vm_hugetlb_page(vma)) { | 1060 | if (is_vm_hugetlb_page(vma)) { |
| 1070 | if (should_force_cow_break(vma, foll_flags)) | ||
| 1071 | foll_flags |= FOLL_WRITE; | ||
| 1072 | i = follow_hugetlb_page(mm, vma, pages, vmas, | 1061 | i = follow_hugetlb_page(mm, vma, pages, vmas, |
| 1073 | &start, &nr_pages, i, | 1062 | &start, &nr_pages, i, |
| 1074 | foll_flags, locked); | 1063 | gup_flags, locked); |
| 1075 | if (locked && *locked == 0) { | 1064 | if (locked && *locked == 0) { |
| 1076 | /* | 1065 | /* |
| 1077 | * We've got a VM_FAULT_RETRY | 1066 | * We've got a VM_FAULT_RETRY |
| @@ -1085,10 +1074,6 @@ static long __get_user_pages(struct mm_struct *mm, · 7 unmodified lines | |||
| 1085 | continue; | 1074 | continue; |
| 1086 | } | 1075 | } |
| 1087 | } | 1076 | } |
| 1088 | |||
| 1089 | if (should_force_cow_break(vma, foll_flags)) | ||
| 1090 | foll_flags |= FOLL_WRITE; | ||
| 1091 | |||
| 1092 | retry: | 1077 | retry: |
| 1093 | /* | 1078 | /* |
| 1094 | * If we have a pending SIGKILL, don't keep faulting pages and | 1079 | * If we have a pending SIGKILL, don't keep faulting pages and |
| @@ -2689,19 +2674,6 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages, · 1594 unmodified lines | |||
| 2689 | return -EFAULT; | 2674 | return -EFAULT; |
| 2690 | 2675 | ||
| 2691 | /* | 2676 | /* |
| 2692 | * The FAST_GUP case requires FOLL_WRITE even for pure reads, | ||
| 2693 | * because get_user_pages() may need to cause an early COW in | ||
| 2694 | * order to avoid confusing the normal COW routines. So only | ||
| 2695 | * targets that are already writable are safe to do by just | ||
| 2696 | * looking at the page tables. | ||
| 2697 | * | ||
| 2698 | * NOTE! With FOLL_FAST_ONLY we allow read-only gup_fast() here, | ||
| 2699 | * because there is no slow path to fall back on. But you'd | ||
| 2700 | * better be careful about possible COW pages - you'll get _a_ | ||
| 2701 | * COW page, but not necessarily the one you intended to get | ||
| 2702 | * depending on what COW event happens after this. COW may break | ||
| 2703 | * the page copy in a random direction. | ||
| 2704 | * | ||
| 2705 | * Disable interrupts. The nested form is used, in order to allow | 2677 | * Disable interrupts. The nested form is used, in order to allow |
| 2706 | * full, general purpose use of this routine. | 2678 | * full, general purpose use of this routine. |
| 2707 | * | 2679 | * |
| @@ -2714,8 +2686,6 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages, · 6 unmodified lines | |||
| 2714 | */ | 2686 | */ |
| 2715 | if (IS_ENABLED(CONFIG_HAVE_FAST_GUP) && gup_fast_permitted(start, end)) { | 2687 | if (IS_ENABLED(CONFIG_HAVE_FAST_GUP) && gup_fast_permitted(start, end)) { |
| 2716 | unsigned long fast_flags = gup_flags; | 2688 | unsigned long fast_flags = gup_flags; |
| 2717 | if (!(gup_flags & FOLL_FAST_ONLY)) | ||
| 2718 | fast_flags |= FOLL_WRITE; | ||
| 2719 | 2689 | ||
| 2720 | local_irq_save(flags); | 2690 | local_irq_save(flags); |
| 2721 | gup_pgd_range(addr, end, fast_flags, pages, &nr_pinned); | 2691 | gup_pgd_range(addr, end, fast_flags, pages, &nr_pinned); |
| @@ -1291,12 +1291,13 @@ fallback: · 1290 unmodified lines | |||
| 1291 | } | 1291 | } |
| 1292 | 1292 | ||
| 1293 | /* | 1293 | /* |
| 1294 | * FOLL_FORCE or a forced COW break can write even to unwritable pmd's, | 1294 | * FOLL_FORCE can write to even unwritable pmd's, but only |
| 1295 | * but only after we've gone through a COW cycle and they are dirty. | 1295 | * after we've gone through a COW cycle and they are dirty. |
| 1296 | */ | 1296 | */ |
| 1297 | static inline bool can_follow_write_pmd(pmd_t pmd, unsigned int flags) | 1297 | static inline bool can_follow_write_pmd(pmd_t pmd, unsigned int flags) |
| 1298 | { | 1298 | { |
| 1299 | return pmd_write(pmd) || ((flags & FOLL_COW) && pmd_dirty(pmd)); | 1299 | return pmd_write(pmd) || |
| 1300 | ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pmd_dirty(pmd)); | ||
| 1300 | } | 1301 | } |
| 1301 | 1302 | ||
| 1302 | struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, | 1303 | struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, |
| @@ -1250,21 +1250,32 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, · 1249 unmodified lines | |||
| 1250 | int nid, nodemask_t *nodemask) | 1250 | int nid, nodemask_t *nodemask) |
| 1251 | { | 1251 | { |
| 1252 | unsigned long nr_pages = 1UL << huge_page_order(h); | 1252 | unsigned long nr_pages = 1UL << huge_page_order(h); |
| 1253 | if (nid == NUMA_NO_NODE) | ||
| 1254 | nid = numa_mem_id(); | ||
| 1253 | 1255 | ||
| 1254 | #ifdef CONFIG_CMA | 1256 | #ifdef CONFIG_CMA |
| 1255 | { | 1257 | { |
| 1256 | struct page *page; | 1258 | struct page *page; |
| 1257 | int node; | 1259 | int node; |
| 1258 | 1260 | ||
| 1259 | for_each_node_mask(node, *nodemask) { | 1261 | if (hugetlb_cma[nid]) { |
| 1260 | if (!hugetlb_cma[node]) | 1262 | page = cma_alloc(hugetlb_cma[nid], nr_pages, |
| 1261 | continue; | 1263 | huge_page_order(h), true); |
| 1262 | |||
| 1263 | page = cma_alloc(hugetlb_cma[node], nr_pages, | ||
| 1264 | huge_page_order(h), true); | ||
| 1265 | if (page) | 1264 | if (page) |
| 1266 | return page; | 1265 | return page; |
| 1267 | } | 1266 | } |
| 1267 | |||
| 1268 | if (!(gfp_mask & __GFP_THISNODE)) { | ||
| 1269 | for_each_node_mask(node, *nodemask) { | ||
| 1270 | if (node == nid || !hugetlb_cma[node]) | ||
| 1271 | continue; | ||
| 1272 | |||
| 1273 | page = cma_alloc(hugetlb_cma[node], nr_pages, | ||
| 1274 | huge_page_order(h), true); | ||
| 1275 | if (page) | ||
| 1276 | return page; | ||
| 1277 | } | ||
| 1278 | } | ||
| 1268 | } | 1279 | } |
| 1269 | #endif | 1280 | #endif |
| 1270 | 1281 | ||
| @@ -3454,6 +3465,22 @@ static unsigned int allowed_mems_nr(struct hstate *h) · 2183 unmodified lines | |||
| 3454 | } | 3465 | } |
| 3455 | 3466 | ||
| 3456 | #ifdef CONFIG_SYSCTL | 3467 | #ifdef CONFIG_SYSCTL |
| 3468 | static int proc_hugetlb_doulongvec_minmax(struct ctl_table *table, int write, | ||
| 3469 | void *buffer, size_t *length, | ||
| 3470 | loff_t *ppos, unsigned long *out) | ||
| 3471 | { | ||
| 3472 | struct ctl_table dup_table; | ||
| 3473 | |||
| 3474 | /* | ||
| 3475 | * In order to avoid races with __do_proc_doulongvec_minmax(), we | ||
| 3476 | * can duplicate the @table and alter the duplicate of it. | ||
| 3477 | */ | ||
| 3478 | dup_table = *table; | ||
| 3479 | dup_table.data = out; | ||
| 3480 | |||
| 3481 | return proc_doulongvec_minmax(&dup_table, write, buffer, length, ppos); | ||
| 3482 | } | ||
| 3483 | |||
| 3457 | static int hugetlb_sysctl_handler_common(bool obey_mempolicy, | 3484 | static int hugetlb_sysctl_handler_common(bool obey_mempolicy, |
| 3458 | struct ctl_table *table, int write, | 3485 | struct ctl_table *table, int write, |
| 3459 | void *buffer, size_t *length, loff_t *ppos) | 3486 | void *buffer, size_t *length, loff_t *ppos) |
| @@ -3465,9 +3492,8 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy, · 5 unmodified lines | |||
| 3465 | if (!hugepages_supported()) | 3492 | if (!hugepages_supported()) |
| 3466 | return -EOPNOTSUPP; | 3493 | return -EOPNOTSUPP; |
| 3467 | 3494 | ||
| 3468 | table->data = &tmp; | 3495 | ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos, |
| 3469 | table->maxlen = sizeof(unsigned long); | 3496 | &tmp); |
| 3470 | ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); | ||
| 3471 | if (ret) | 3497 | if (ret) |
| 3472 | goto out; | 3498 | goto out; |
| 3473 | 3499 | ||
| @@ -3510,9 +3536,8 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write, · 36 unmodified lines | |||
| 3510 | if (write && hstate_is_gigantic(h)) | 3536 | if (write && hstate_is_gigantic(h)) |
| 3511 | return -EINVAL; | 3537 | return -EINVAL; |
| 3512 | 3538 | ||
| 3513 | table->data = &tmp; | 3539 | ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos, |
| 3514 | table->maxlen = sizeof(unsigned long); | 3540 | &tmp); |
| 3515 | ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); | ||
| 3516 | if (ret) | 3541 | if (ret) |
| 3517 | goto out; | 3542 | goto out; |
| 3518 | 3543 | ||
| @@ -1709,7 +1709,7 @@ static void collapse_file(struct mm_struct *mm, · 1708 unmodified lines | |||
| 1709 | xas_unlock_irq(&xas); | 1709 | xas_unlock_irq(&xas); |
| 1710 | page_cache_sync_readahead(mapping, &file->f_ra, | 1710 | page_cache_sync_readahead(mapping, &file->f_ra, |
| 1711 | file, index, | 1711 | file, index, |
| 1712 | PAGE_SIZE); | 1712 | end - index); |
| 1713 | /* drain pagevecs to help isolate_lru_page() */ | 1713 | /* drain pagevecs to help isolate_lru_page() */ |
| 1714 | lru_add_drain(); | 1714 | lru_add_drain(); |
| 1715 | page = find_lock_page(mapping, index); | 1715 | page = find_lock_page(mapping, index); |
| @@ -2661,31 +2661,6 @@ again: · 2660 unmodified lines | |||
| 2661 | goto again; | 2661 | goto again; |
| 2662 | } | 2662 | } |
| 2663 | 2663 | ||
| 2664 | bool reuse_ksm_page(struct page *page, | ||
| 2665 | struct vm_area_struct *vma, | ||
| 2666 | unsigned long address) | ||
| 2667 | { | ||
| 2668 | #ifdef CONFIG_DEBUG_VM | ||
| 2669 | if (WARN_ON(is_zero_pfn(page_to_pfn(page))) || | ||
| 2670 | WARN_ON(!page_mapped(page)) || | ||
| 2671 | WARN_ON(!PageLocked(page))) { | ||
| 2672 | dump_page(page, "reuse_ksm_page"); | ||
| 2673 | return false; | ||
| 2674 | } | ||
| 2675 | #endif | ||
| 2676 | |||
| 2677 | if (PageSwapCache(page) || !page_stable_node(page)) | ||
| 2678 | return false; | ||
| 2679 | /* Prohibit parallel get_ksm_page() */ | ||
| 2680 | if (!page_ref_freeze(page, 1)) | ||
| 2681 | return false; | ||
| 2682 | |||
| 2683 | page_move_anon_rmap(page, vma); | ||
| 2684 | page->index = linear_page_index(vma, address); | ||
| 2685 | page_ref_unfreeze(page, 1); | ||
| 2686 | |||
| 2687 | return true; | ||
| 2688 | } | ||
| 2689 | #ifdef CONFIG_MIGRATION | 2664 | #ifdef CONFIG_MIGRATION |
| 2690 | void ksm_migrate_page(struct page *newpage, struct page *oldpage) | 2665 | void ksm_migrate_page(struct page *newpage, struct page *oldpage) |
| 2691 | { | 2666 | { |
| @@ -289,9 +289,9 @@ static long madvise_willneed(struct vm_area_struct *vma, · 288 unmodified lines | |||
| 289 | */ | 289 | */ |
| 290 | *prev = NULL; /* tell sys_madvise we drop mmap_lock */ | 290 | *prev = NULL; /* tell sys_madvise we drop mmap_lock */ |
| 291 | get_file(file); | 291 | get_file(file); |
| 292 | mmap_read_unlock(current->mm); | ||
| 293 | offset = (loff_t)(start - vma->vm_start) | 292 | offset = (loff_t)(start - vma->vm_start) |
| 294 | + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); | 293 | + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); |
| 294 | mmap_read_unlock(current->mm); | ||
| 295 | vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED); | 295 | vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED); |
| 296 | fput(file); | 296 | fput(file); |
| 297 | mmap_read_lock(current->mm); | 297 | mmap_read_lock(current->mm); |
| @@ -6774,6 +6774,9 @@ static void uncharge_batch(const struct uncharge_gather *ug) · 6773 unmodified lines | |||
| 6774 | __this_cpu_add(ug->memcg->vmstats_percpu->nr_page_events, ug->nr_pages); | 6774 | __this_cpu_add(ug->memcg->vmstats_percpu->nr_page_events, ug->nr_pages); |
| 6775 | memcg_check_events(ug->memcg, ug->dummy_page); | 6775 | memcg_check_events(ug->memcg, ug->dummy_page); |
| 6776 | local_irq_restore(flags); | 6776 | local_irq_restore(flags); |
| 6777 | |||
| 6778 | /* drop reference from uncharge_page */ | ||
| 6779 | css_put(&ug->memcg->css); | ||
| 6777 | } | 6780 | } |
| 6778 | 6781 | ||
| 6779 | static void uncharge_page(struct page *page, struct uncharge_gather *ug) | 6782 | static void uncharge_page(struct page *page, struct uncharge_gather *ug) |
| @@ -6797,6 +6800,9 @@ static void uncharge_page(struct page *page, struct uncharge_gather *ug) · 17 unmodified lines | |||
| 6797 | uncharge_gather_clear(ug); | 6800 | uncharge_gather_clear(ug); |
| 6798 | } | 6801 | } |
| 6799 | ug->memcg = page->mem_cgroup; | 6802 | ug->memcg = page->mem_cgroup; |
| 6803 | |||
| 6804 | /* pairs with css_put in uncharge_batch */ | ||
| 6805 | css_get(&ug->memcg->css); | ||
| 6800 | } | 6806 | } |
| 6801 | 6807 | ||
| 6802 | nr_pages = compound_nr(page); | 6808 | nr_pages = compound_nr(page); |
| @@ -73,6 +73,7 @@ · 72 unmodified lines | |||
| 73 | #include <linux/numa.h> | 73 | #include <linux/numa.h> |
| 74 | #include <linux/perf_event.h> | 74 | #include <linux/perf_event.h> |
| 75 | #include <linux/ptrace.h> | 75 | #include <linux/ptrace.h> |
| 76 | #include <linux/vmalloc.h> | ||
| 76 | 77 | ||
| 77 | #include <trace/events/kmem.h> | 78 | #include <trace/events/kmem.h> |
| 78 | 79 | ||
| @@ -83,6 +84,7 @@ · 4 unmodified lines | |||
| 83 | #include <asm/tlb.h> | 84 | #include <asm/tlb.h> |
| 84 | #include <asm/tlbflush.h> | 85 | #include <asm/tlbflush.h> |
| 85 | 86 | ||
| 87 | #include "pgalloc-track.h" | ||
| 86 | #include "internal.h" | 88 | #include "internal.h" |
| 87 | 89 | ||
| 88 | #if defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) && !defined(CONFIG_COMPILE_TEST) | 90 | #if defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) && !defined(CONFIG_COMPILE_TEST) |
| @@ -2206,7 +2208,8 @@ EXPORT_SYMBOL(vm_iomap_memory); · 2117 unmodified lines | |||
| 2206 | 2208 | ||
| 2207 | static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, | 2209 | static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, |
| 2208 | unsigned long addr, unsigned long end, | 2210 | unsigned long addr, unsigned long end, |
| 2209 | pte_fn_t fn, void *data, bool create) | 2211 | pte_fn_t fn, void *data, bool create, |
| 2212 | pgtbl_mod_mask *mask) | ||
| 2210 | { | 2213 | { |
| 2211 | pte_t *pte; | 2214 | pte_t *pte; |
| 2212 | int err = 0; | 2215 | int err = 0; |
| @@ -2214,7 +2217,7 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, · 1 unmodified line | |||
| 2214 | 2217 | ||
| 2215 | if (create) { | 2218 | if (create) { |
| 2216 | pte = (mm == &init_mm) ? | 2219 | pte = (mm == &init_mm) ? |
| 2217 | pte_alloc_kernel(pmd, addr) : | 2220 | pte_alloc_kernel_track(pmd, addr, mask) : |
| 2218 | pte_alloc_map_lock(mm, pmd, addr, &ptl); | 2221 | pte_alloc_map_lock(mm, pmd, addr, &ptl); |
| 2219 | if (!pte) | 2222 | if (!pte) |
| 2220 | return -ENOMEM; | 2223 | return -ENOMEM; |
| @@ -2235,6 +2238,7 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, · 14 unmodified lines | |||
| 2235 | break; | 2238 | break; |
| 2236 | } | 2239 | } |
| 2237 | } while (addr += PAGE_SIZE, addr != end); | 2240 | } while (addr += PAGE_SIZE, addr != end); |
| 2241 | *mask |= PGTBL_PTE_MODIFIED; | ||
| 2238 | 2242 | ||
| 2239 | arch_leave_lazy_mmu_mode(); | 2243 | arch_leave_lazy_mmu_mode(); |
| 2240 | 2244 | ||
| @@ -2245,7 +2249,8 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, · 4 unmodified lines | |||
| 2245 | 2249 | ||
| 2246 | static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, | 2250 | static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, |
| 2247 | unsigned long addr, unsigned long end, | 2251 | unsigned long addr, unsigned long end, |
| 2248 | pte_fn_t fn, void *data, bool create) | 2252 | pte_fn_t fn, void *data, bool create, |
| 2253 | pgtbl_mod_mask *mask) | ||
| 2249 | { | 2254 | { |
| 2250 | pmd_t *pmd; | 2255 | pmd_t *pmd; |
| 2251 | unsigned long next; | 2256 | unsigned long next; |
| @@ -2254,7 +2259,7 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, · 2 unmodified lines | |||
| 2254 | BUG_ON(pud_huge(*pud)); | 2259 | BUG_ON(pud_huge(*pud)); |
| 2255 | 2260 | ||
| 2256 | if (create) { | 2261 | if (create) { |
| 2257 | pmd = pmd_alloc(mm, pud, addr); | 2262 | pmd = pmd_alloc_track(mm, pud, addr, mask); |
| 2258 | if (!pmd) | 2263 | if (!pmd) |
| 2259 | return -ENOMEM; | 2264 | return -ENOMEM; |
| 2260 | } else { | 2265 | } else { |
| @@ -2264,7 +2269,7 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, · 3 unmodified lines | |||
| 2264 | next = pmd_addr_end(addr, end); | 2269 | next = pmd_addr_end(addr, end); |
| 2265 | if (create || !pmd_none_or_clear_bad(pmd)) { | 2270 | if (create || !pmd_none_or_clear_bad(pmd)) { |
| 2266 | err = apply_to_pte_range(mm, pmd, addr, next, fn, data, | 2271 | err = apply_to_pte_range(mm, pmd, addr, next, fn, data, |
| 2267 | create); | 2272 | create, mask); |
| 2268 | if (err) | 2273 | if (err) |
| 2269 | break; | 2274 | break; |
| 2270 | } | 2275 | } |
| @@ -2274,14 +2279,15 @@ static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, · 3 unmodified lines | |||
| 2274 | 2279 | ||
| 2275 | static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d, | 2280 | static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d, |
| 2276 | unsigned long addr, unsigned long end, | 2281 | unsigned long addr, unsigned long end, |
| 2277 | pte_fn_t fn, void *data, bool create) | 2282 | pte_fn_t fn, void *data, bool create, |
| 2283 | pgtbl_mod_mask *mask) | ||
| 2278 | { | 2284 | { |
| 2279 | pud_t *pud; | 2285 | pud_t *pud; |
| 2280 | unsigned long next; | 2286 | unsigned long next; |
| 2281 | int err = 0; | 2287 | int err = 0; |
| 2282 | 2288 | ||
| 2283 | if (create) { | 2289 | if (create) { |
| 2284 | pud = pud_alloc(mm, p4d, addr); | 2290 | pud = pud_alloc_track(mm, p4d, addr, mask); |
| 2285 | if (!pud) | 2291 | if (!pud) |
| 2286 | return -ENOMEM; | 2292 | return -ENOMEM; |
| 2287 | } else { | 2293 | } else { |
| @@ -2291,7 +2297,7 @@ static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d, · 3 unmodified lines | |||
| 2291 | next = pud_addr_end(addr, end); | 2297 | next = pud_addr_end(addr, end); |
| 2292 | if (create || !pud_none_or_clear_bad(pud)) { | 2298 | if (create || !pud_none_or_clear_bad(pud)) { |
| 2293 | err = apply_to_pmd_range(mm, pud, addr, next, fn, data, | 2299 | err = apply_to_pmd_range(mm, pud, addr, next, fn, data, |
| 2294 | create); | 2300 | create, mask); |
| 2295 | if (err) | 2301 | if (err) |
| 2296 | break; | 2302 | break; |
| 2297 | } | 2303 | } |
| @@ -2301,14 +2307,15 @@ static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d, · 3 unmodified lines | |||
| 2301 | 2307 | ||
| 2302 | static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd, | 2308 | static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd, |
| 2303 | unsigned long addr, unsigned long end, | 2309 | unsigned long addr, unsigned long end, |
| 2304 | pte_fn_t fn, void *data, bool create) | 2310 | pte_fn_t fn, void *data, bool create, |
| 2311 | pgtbl_mod_mask *mask) | ||
| 2305 | { | 2312 | { |
| 2306 | p4d_t *p4d; | 2313 | p4d_t *p4d; |
| 2307 | unsigned long next; | 2314 | unsigned long next; |
| 2308 | int err = 0; | 2315 | int err = 0; |
| 2309 | 2316 | ||
| 2310 | if (create) { | 2317 | if (create) { |
| 2311 | p4d = p4d_alloc(mm, pgd, addr); | 2318 | p4d = p4d_alloc_track(mm, pgd, addr, mask); |
| 2312 | if (!p4d) | 2319 | if (!p4d) |
| 2313 | return -ENOMEM; | 2320 | return -ENOMEM; |
| 2314 | } else { | 2321 | } else { |
| @@ -2318,7 +2325,7 @@ static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd, · 3 unmodified lines | |||
| 2318 | next = p4d_addr_end(addr, end); | 2325 | next = p4d_addr_end(addr, end); |
| 2319 | if (create || !p4d_none_or_clear_bad(p4d)) { | 2326 | if (create || !p4d_none_or_clear_bad(p4d)) { |
| 2320 | err = apply_to_pud_range(mm, p4d, addr, next, fn, data, | 2327 | err = apply_to_pud_range(mm, p4d, addr, next, fn, data, |
| 2321 | create); | 2328 | create, mask); |
| 2322 | if (err) | 2329 | if (err) |
| 2323 | break; | 2330 | break; |
| 2324 | } | 2331 | } |
| @@ -2331,8 +2338,9 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr, · 6 unmodified lines | |||
| 2331 | void *data, bool create) | 2338 | void *data, bool create) |
| 2332 | { | 2339 | { |
| 2333 | pgd_t *pgd; | 2340 | pgd_t *pgd; |
| 2334 | unsigned long next; | 2341 | unsigned long start = addr, next; |
| 2335 | unsigned long end = addr + size; | 2342 | unsigned long end = addr + size; |
| 2343 | pgtbl_mod_mask mask = 0; | ||
| 2336 | int err = 0; | 2344 | int err = 0; |
| 2337 | 2345 | ||
| 2338 | if (WARN_ON(addr >= end)) | 2346 | if (WARN_ON(addr >= end)) |
| @@ -2343,11 +2351,14 @@ static int __apply_to_page_range(struct mm_struct *mm, unsigned long addr, · 4 unmodified lines | |||
| 2343 | next = pgd_addr_end(addr, end); | 2351 | next = pgd_addr_end(addr, end); |
| 2344 | if (!create && pgd_none_or_clear_bad(pgd)) | 2352 | if (!create && pgd_none_or_clear_bad(pgd)) |
| 2345 | continue; | 2353 | continue; |
| 2346 | err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create); | 2354 | err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create, &mask); |
| 2347 | if (err) | 2355 | if (err) |
| 2348 | break; | 2356 | break; |
| 2349 | } while (pgd++, addr = next, addr != end); | 2357 | } while (pgd++, addr = next, addr != end); |
| 2350 | 2358 | ||
| 2359 | if (mask & ARCH_PAGE_TABLE_SYNC_MASK) | ||
| 2360 | arch_sync_kernel_mappings(start, start + size); | ||
| 2361 | |||
| 2351 | return err; | 2362 | return err; |
| 2352 | } | 2363 | } |
| 2353 | 2364 | ||
| @@ -2622,6 +2633,7 @@ static inline void wp_page_reuse(struct vm_fault *vmf) · 268 unmodified lines | |||
| 2622 | if (ptep_set_access_flags(vma, vmf->address, vmf->pte, entry, 1)) | 2633 | if (ptep_set_access_flags(vma, vmf->address, vmf->pte, entry, 1)) |
| 2623 | update_mmu_cache(vma, vmf->address, vmf->pte); | 2634 | update_mmu_cache(vma, vmf->address, vmf->pte); |
| 2624 | pte_unmap_unlock(vmf->pte, vmf->ptl); | 2635 | pte_unmap_unlock(vmf->pte, vmf->ptl); |
| 2636 | count_vm_event(PGREUSE); | ||
| 2625 | } | 2637 | } |
| 2626 | 2638 | ||
| 2627 | /* | 2639 | /* |
| @@ -2927,50 +2939,25 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) · 299 unmodified lines | |||
| 2927 | * not dirty accountable. | 2939 | * not dirty accountable. |
| 2928 | */ | 2940 | */ |
| 2929 | if (PageAnon(vmf->page)) { | 2941 | if (PageAnon(vmf->page)) { |
| 2930 | int total_map_swapcount; | 2942 | struct page *page = vmf->page; |
| 2931 | if (PageKsm(vmf->page) && (PageSwapCache(vmf->page) || | 2943 | |
| 2932 | page_count(vmf->page) != 1)) | 2944 | /* PageKsm() doesn't necessarily raise the page refcount */ |
| 2945 | if (PageKsm(page) || page_count(page) != 1) | ||
| 2946 | goto copy; | ||
| 2947 | if (!trylock_page(page)) | ||
| 2948 | goto copy; | ||
| 2949 | if (PageKsm(page) || page_mapcount(page) != 1 || page_count(page) != 1) { | ||
| 2950 | unlock_page(page); | ||
| 2933 | goto copy; | 2951 | goto copy; |
| 2934 | if (!trylock_page(vmf->page)) { | ||
| 2935 | get_page(vmf->page); | ||
| 2936 | pte_unmap_unlock(vmf->pte, vmf->ptl); | ||
| 2937 | lock_page(vmf->page); | ||
| 2938 | vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, | ||
| 2939 | vmf->address, &vmf->ptl); | ||
| 2940 | if (!pte_same(*vmf->pte, vmf->orig_pte)) { | ||
| 2941 | update_mmu_tlb(vma, vmf->address, vmf->pte); | ||
| 2942 | unlock_page(vmf->page); | ||
| 2943 | pte_unmap_unlock(vmf->pte, vmf->ptl); | ||
| 2944 | put_page(vmf->page); | ||
| 2945 | return 0; | ||
| 2946 | } | ||
| 2947 | put_page(vmf->page); | ||
| 2948 | } | ||
| 2949 | if (PageKsm(vmf->page)) { | ||
| 2950 | bool reused = reuse_ksm_page(vmf->page, vmf->vma, | ||
| 2951 | vmf->address); | ||
| 2952 | unlock_page(vmf->page); | ||
| 2953 | if (!reused) | ||
| 2954 | goto copy; | ||
| 2955 | wp_page_reuse(vmf); | ||
| 2956 | return VM_FAULT_WRITE; | ||
| 2957 | } | ||
| 2958 | if (reuse_swap_page(vmf->page, &total_map_swapcount)) { | ||
| 2959 | if (total_map_swapcount == 1) { | ||
| 2960 | /* | ||
| 2961 | * The page is all ours. Move it to | ||
| 2962 | * our anon_vma so the rmap code will | ||
| 2963 | * not search our parent or siblings. | ||
| 2964 | * Protected against the rmap code by | ||
| 2965 | * the page lock. | ||
| 2966 | */ | ||
| 2967 | page_move_anon_rmap(vmf->page, vma); | ||
| 2968 | } | ||
| 2969 | unlock_page(vmf->page); | ||
| 2970 | wp_page_reuse(vmf); | ||
| 2971 | return VM_FAULT_WRITE; | ||
| 2972 | } | 2952 | } |
| 2973 | unlock_page(vmf->page); | 2953 | /* |
| 2954 | * Ok, we've got the only map reference, and the only | ||
| 2955 | * page count reference, and the page is locked, | ||
| 2956 | * it's dark out, and we're wearing sunglasses. Hit it. | ||
| 2957 | */ | ||
| 2958 | wp_page_reuse(vmf); | ||
| 2959 | unlock_page(page); | ||
| 2960 | return VM_FAULT_WRITE; | ||
| 2974 | } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) == | 2961 | } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) == |
| 2975 | (VM_WRITE|VM_SHARED))) { | 2962 | (VM_WRITE|VM_SHARED))) { |
| 2976 | return wp_page_shared(vmf); | 2963 | return wp_page_shared(vmf); |
| @@ -216,7 +216,7 @@ void *memremap_pages(struct dev_pagemap *pgmap, int nid) · 215 unmodified lines | |||
| 216 | return ERR_PTR(-EINVAL); | 216 | return ERR_PTR(-EINVAL); |
| 217 | } | 217 | } |
| 218 | break; | 218 | break; |
| 219 | case MEMORY_DEVICE_DEVDAX: | 219 | case MEMORY_DEVICE_GENERIC: |
| 220 | need_devmap_managed = false; | 220 | need_devmap_managed = false; |
| 221 | break; | 221 | break; |
| 222 | case MEMORY_DEVICE_PCI_P2PDMA: | 222 | case MEMORY_DEVICE_PCI_P2PDMA: |
| @@ -246,13 +246,13 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma, · 245 unmodified lines | |||
| 246 | else if (pte_swp_uffd_wp(*pvmw.pte)) | 246 | else if (pte_swp_uffd_wp(*pvmw.pte)) |
| 247 | pte = pte_mkuffd_wp(pte); | 247 | pte = pte_mkuffd_wp(pte); |
| 248 | 248 | ||
| 249 | if (unlikely(is_zone_device_page(new))) { | 249 | if (unlikely(is_device_private_page(new))) { |
| 250 | if (is_device_private_page(new)) { | 250 | entry = make_device_private_entry(new, pte_write(pte)); |
| 251 | entry = make_device_private_entry(new, pte_write(pte)); | 251 | pte = swp_entry_to_pte(entry); |
| 252 | pte = swp_entry_to_pte(entry); | 252 | if (pte_swp_soft_dirty(*pvmw.pte)) |
| 253 | if (pte_swp_uffd_wp(*pvmw.pte)) | 253 | pte = pte_swp_mksoft_dirty(pte); |
| 254 | pte = pte_mkuffd_wp(pte); | 254 | if (pte_swp_uffd_wp(*pvmw.pte)) |
| 255 | } | 255 | pte = pte_swp_mkuffd_wp(pte); |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | #ifdef CONFIG_HUGETLB_PAGE | 258 | #ifdef CONFIG_HUGETLB_PAGE |
| @@ -2427,10 +2427,17 @@ again: · 2168 unmodified lines | |||
| 2427 | entry = make_migration_entry(page, mpfn & | 2427 | entry = make_migration_entry(page, mpfn & |
| 2428 | MIGRATE_PFN_WRITE); | 2428 | MIGRATE_PFN_WRITE); |
| 2429 | swp_pte = swp_entry_to_pte(entry); | 2429 | swp_pte = swp_entry_to_pte(entry); |
| 2430 | if (pte_soft_dirty(pte)) | 2430 | if (pte_present(pte)) { |
| 2431 | swp_pte = pte_swp_mksoft_dirty(swp_pte); | 2431 | if (pte_soft_dirty(pte)) |
| 2432 | if (pte_uffd_wp(pte)) | 2432 | swp_pte = pte_swp_mksoft_dirty(swp_pte); |
| 2433 | swp_pte = pte_swp_mkuffd_wp(swp_pte); | 2433 | if (pte_uffd_wp(pte)) |
| 2434 | swp_pte = pte_swp_mkuffd_wp(swp_pte); | ||
| 2435 | } else { | ||
| 2436 | if (pte_swp_soft_dirty(pte)) | ||
| 2437 | swp_pte = pte_swp_mksoft_dirty(swp_pte); | ||
| 2438 | if (pte_swp_uffd_wp(pte)) | ||
| 2439 | swp_pte = pte_swp_mkuffd_wp(swp_pte); | ||
| 2440 | } | ||
| 2434 | set_pte_at(mm, addr, ptep, swp_pte); | 2441 | set_pte_at(mm, addr, ptep, swp_pte); |
| 2435 | 2442 | ||
| 2436 | /* | 2443 | /* |
| @@ -1511,9 +1511,14 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, · 1510 unmodified lines | |||
| 1511 | */ | 1511 | */ |
| 1512 | entry = make_migration_entry(page, 0); | 1512 | entry = make_migration_entry(page, 0); |
| 1513 | swp_pte = swp_entry_to_pte(entry); | 1513 | swp_pte = swp_entry_to_pte(entry); |
| 1514 | if (pte_soft_dirty(pteval)) | 1514 | |
| 1515 | /* | ||
| 1516 | * pteval maps a zone device page and is therefore | ||
| 1517 | * a swap pte. | ||
| 1518 | */ | ||
| 1519 | if (pte_swp_soft_dirty(pteval)) | ||
| 1515 | swp_pte = pte_swp_mksoft_dirty(swp_pte); | 1520 | swp_pte = pte_swp_mksoft_dirty(swp_pte); |
| 1516 | if (pte_uffd_wp(pteval)) | 1521 | if (pte_swp_uffd_wp(pteval)) |
| 1517 | swp_pte = pte_swp_mkuffd_wp(swp_pte); | 1522 | swp_pte = pte_swp_mkuffd_wp(swp_pte); |
| 1518 | set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte); | 1523 | set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte); |
| 1519 | /* | 1524 | /* |
| @@ -672,12 +672,12 @@ static void slab_fix(struct kmem_cache *s, char *fmt, ...) · 671 unmodified lines | |||
| 672 | } | 672 | } |
| 673 | 673 | ||
| 674 | static bool freelist_corrupted(struct kmem_cache *s, struct page *page, | 674 | static bool freelist_corrupted(struct kmem_cache *s, struct page *page, |
| 675 | void *freelist, void *nextfree) | 675 | void **freelist, void *nextfree) |
| 676 | { | 676 | { |
| 677 | if ((s->flags & SLAB_CONSISTENCY_CHECKS) && | 677 | if ((s->flags & SLAB_CONSISTENCY_CHECKS) && |
| 678 | !check_valid_pointer(s, page, nextfree)) { | 678 | !check_valid_pointer(s, page, nextfree) && freelist) { |
| 679 | object_err(s, page, freelist, "Freechain corrupt"); | 679 | object_err(s, page, *freelist, "Freechain corrupt"); |
| 680 | freelist = NULL; | 680 | *freelist = NULL; |
| 681 | slab_fix(s, "Isolate corrupted freechain"); | 681 | slab_fix(s, "Isolate corrupted freechain"); |
| 682 | return true; | 682 | return true; |
| 683 | } | 683 | } |
| @@ -1494,7 +1494,7 @@ static inline void dec_slabs_node(struct kmem_cache *s, int node, · 810 unmodified lines | |||
| 1494 | int objects) {} | 1494 | int objects) {} |
| 1495 | 1495 | ||
| 1496 | static bool freelist_corrupted(struct kmem_cache *s, struct page *page, | 1496 | static bool freelist_corrupted(struct kmem_cache *s, struct page *page, |
| 1497 | void *freelist, void *nextfree) | 1497 | void **freelist, void *nextfree) |
| 1498 | { | 1498 | { |
| 1499 | return false; | 1499 | return false; |
| 1500 | } | 1500 | } |
| @@ -2184,7 +2184,7 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page, · 683 unmodified lines | |||
| 2184 | * 'freelist' is already corrupted. So isolate all objects | 2184 | * 'freelist' is already corrupted. So isolate all objects |
| 2185 | * starting at 'freelist'. | 2185 | * starting at 'freelist'. |
| 2186 | */ | 2186 | */ |
| 2187 | if (freelist_corrupted(s, page, freelist, nextfree)) | 2187 | if (freelist_corrupted(s, page, &freelist, nextfree)) |
| 2188 | break; | 2188 | break; |
| 2189 | 2189 | ||
| 2190 | do { | 2190 | do { |
| @@ -2615,6 +2615,14 @@ static void shrink_node_memcgs(pg_data_t *pgdat, struct scan_control *sc) · 2614 unmodified lines | |||
| 2615 | unsigned long reclaimed; | 2615 | unsigned long reclaimed; |
| 2616 | unsigned long scanned; | 2616 | unsigned long scanned; |
| 2617 | 2617 | ||
| 2618 | /* | ||
| 2619 | * This loop can become CPU-bound when target memcgs | ||
| 2620 | * aren't eligible for reclaim - either because they | ||
| 2621 | * don't have any reclaimable pages, or because their | ||
| 2622 | * memory is explicitly protected. Avoid soft lockups. | ||
| 2623 | */ | ||
| 2624 | cond_resched(); | ||
| 2625 | |||
| 2618 | mem_cgroup_calculate_protection(target_memcg, memcg); | 2626 | mem_cgroup_calculate_protection(target_memcg, memcg); |
| 2619 | 2627 | ||
| 2620 | if (mem_cgroup_below_min(memcg)) { | 2628 | if (mem_cgroup_below_min(memcg)) { |
| @@ -1241,6 +1241,7 @@ const char * const vmstat_text[] = { · 1240 unmodified lines | |||
| 1241 | "pglazyfreed", | 1241 | "pglazyfreed", |
| 1242 | 1242 | ||
| 1243 | "pgrefill", | 1243 | "pgrefill", |
| 1244 | "pgreuse", | ||
| 1244 | "pgsteal_kswapd", | 1245 | "pgsteal_kswapd", |
| 1245 | "pgsteal_direct", | 1246 | "pgsteal_direct", |
| 1246 | "pgscan_kswapd", | 1247 | "pgscan_kswapd", |
| @@ -881,6 +881,12 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset, · 880 unmodified lines | |||
| 881 | ntohl(ogm_packet->seqno), ogm_throughput, ogm_packet->ttl, | 881 | ntohl(ogm_packet->seqno), ogm_throughput, ogm_packet->ttl, |
| 882 | ogm_packet->version, ntohs(ogm_packet->tvlv_len)); | 882 | ogm_packet->version, ntohs(ogm_packet->tvlv_len)); |
| 883 | 883 | ||
| 884 | if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) { | ||
| 885 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, | ||
| 886 | "Drop packet: originator packet from ourself\n"); | ||
| 887 | return; | ||
| 888 | } | ||
| 889 | |||
| 884 | /* If the throughput metric is 0, immediately drop the packet. No need | 890 | /* If the throughput metric is 0, immediately drop the packet. No need |
| 885 | * to create orig_node / neigh_node for an unusable route. | 891 | * to create orig_node / neigh_node for an unusable route. |
| 886 | */ | 892 | */ |
| @@ -1008,11 +1014,6 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb, · 121 unmodified lines | |||
| 1008 | if (batadv_is_my_mac(bat_priv, ethhdr->h_source)) | 1014 | if (batadv_is_my_mac(bat_priv, ethhdr->h_source)) |
| 1009 | goto free_skb; | 1015 | goto free_skb; |
| 1010 | 1016 | ||
| 1011 | ogm_packet = (struct batadv_ogm2_packet *)skb->data; | ||
| 1012 | |||
| 1013 | if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) | ||
| 1014 | goto free_skb; | ||
| 1015 | |||
| 1016 | batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX); | 1017 | batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX); |
| 1017 | batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES, | 1018 | batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES, |
| 1018 | skb->len + ETH_HLEN); | 1019 | skb->len + ETH_HLEN); |
| @@ -437,7 +437,10 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac, · 436 unmodified lines | |||
| 437 | batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES, | 437 | batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES, |
| 438 | skb->len + ETH_HLEN); | 438 | skb->len + ETH_HLEN); |
| 439 | 439 | ||
| 440 | netif_rx(skb); | 440 | if (in_interrupt()) |
| 441 | netif_rx(skb); | ||
| 442 | else | ||
| 443 | netif_rx_ni(skb); | ||
| 441 | out: | 444 | out: |
| 442 | if (primary_if) | 445 | if (primary_if) |
| 443 | batadv_hardif_put(primary_if); | 446 | batadv_hardif_put(primary_if); |
| @@ -703,8 +703,10 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len, · 702 unmodified lines | |||
| 703 | 703 | ||
| 704 | chaddr_offset = *header_len + BATADV_DHCP_CHADDR_OFFSET; | 704 | chaddr_offset = *header_len + BATADV_DHCP_CHADDR_OFFSET; |
| 705 | /* store the client address if the message is going to a client */ | 705 | /* store the client address if the message is going to a client */ |
| 706 | if (ret == BATADV_DHCP_TO_CLIENT && | 706 | if (ret == BATADV_DHCP_TO_CLIENT) { |
| 707 | pskb_may_pull(skb, chaddr_offset + ETH_ALEN)) { | 707 | if (!pskb_may_pull(skb, chaddr_offset + ETH_ALEN)) |
| 708 | return BATADV_DHCP_NO; | ||
| 709 | |||
| 708 | /* check if the DHCP packet carries an Ethernet DHCP */ | 710 | /* check if the DHCP packet carries an Ethernet DHCP */ |
| 709 | p = skb->data + *header_len + BATADV_DHCP_HTYPE_OFFSET; | 711 | p = skb->data + *header_len + BATADV_DHCP_HTYPE_OFFSET; |
| 710 | if (*p != BATADV_DHCP_HTYPE_ETHERNET) | 712 | if (*p != BATADV_DHCP_HTYPE_ETHERNET) |
| @@ -116,7 +116,7 @@ static int cfrfml_receive(struct cflayer *layr, struct cfpkt *pkt) · 115 unmodified lines | |||
| 116 | if (segmented) { | 116 | if (segmented) { |
| 117 | if (rfml->incomplete_frm == NULL) { | 117 | if (rfml->incomplete_frm == NULL) { |
| 118 | /* Initial Segment */ | 118 | /* Initial Segment */ |
| 119 | if (cfpkt_peek_head(pkt, rfml->seghead, 6) < 0) | 119 | if (cfpkt_peek_head(pkt, rfml->seghead, 6) != 0) |
| 120 | goto out; | 120 | goto out; |
| 121 | 121 | ||
| 122 | rfml->pdu_size = get_unaligned_le16(rfml->seghead+4); | 122 | rfml->pdu_size = get_unaligned_le16(rfml->seghead+4); |
| @@ -233,7 +233,7 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt) · 110 unmodified lines | |||
| 233 | if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE) | 233 | if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE) |
| 234 | err = cfpkt_peek_head(pkt, head, 6); | 234 | err = cfpkt_peek_head(pkt, head, 6); |
| 235 | 235 | ||
| 236 | if (err < 0) | 236 | if (err != 0) |
| 237 | goto out; | 237 | goto out; |
| 238 | 238 | ||
| 239 | while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) { | 239 | while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) { |
| @@ -6612,12 +6612,13 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi, · 6611 unmodified lines | |||
| 6612 | netdev_err_once(dev, "%s() called with weight %d\n", __func__, | 6612 | netdev_err_once(dev, "%s() called with weight %d\n", __func__, |
| 6613 | weight); | 6613 | weight); |
| 6614 | napi->weight = weight; | 6614 | napi->weight = weight; |
| 6615 | list_add(&napi->dev_list, &dev->napi_list); | ||
| 6616 | napi->dev = dev; | 6615 | napi->dev = dev; |
| 6617 | #ifdef CONFIG_NETPOLL | 6616 | #ifdef CONFIG_NETPOLL |
| 6618 | napi->poll_owner = -1; | 6617 | napi->poll_owner = -1; |
| 6619 | #endif | 6618 | #endif |
| 6620 | set_bit(NAPI_STATE_SCHED, &napi->state); | 6619 | set_bit(NAPI_STATE_SCHED, &napi->state); |
| 6620 | set_bit(NAPI_STATE_NPSVC, &napi->state); | ||
| 6621 | list_add_rcu(&napi->dev_list, &dev->napi_list); | ||
| 6621 | napi_hash_add(napi); | 6622 | napi_hash_add(napi); |
| 6622 | } | 6623 | } |
| 6623 | EXPORT_SYMBOL(netif_napi_add); | 6624 | EXPORT_SYMBOL(netif_napi_add); |
| @@ -162,7 +162,7 @@ static void poll_napi(struct net_device *dev) · 161 unmodified lines | |||
| 162 | struct napi_struct *napi; | 162 | struct napi_struct *napi; |
| 163 | int cpu = smp_processor_id(); | 163 | int cpu = smp_processor_id(); |
| 164 | 164 | ||
| 165 | list_for_each_entry(napi, &dev->napi_list, dev_list) { | 165 | list_for_each_entry_rcu(napi, &dev->napi_list, dev_list) { |
| 166 | if (cmpxchg(&napi->poll_owner, -1, cpu) == -1) { | 166 | if (cmpxchg(&napi->poll_owner, -1, cpu) == -1) { |
| 167 | poll_one_napi(napi); | 167 | poll_one_napi(napi); |
| 168 | smp_store_release(&napi->poll_owner, -1); | 168 | smp_store_release(&napi->poll_owner, -1); |
| @@ -3699,7 +3699,7 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn) · 3698 unmodified lines | |||
| 3699 | cpu_to_node(cpu), | 3699 | cpu_to_node(cpu), |
| 3700 | "kpktgend_%d", cpu); | 3700 | "kpktgend_%d", cpu); |
| 3701 | if (IS_ERR(p)) { | 3701 | if (IS_ERR(p)) { |
| 3702 | pr_err("kernel_thread() failed for cpu %d\n", t->cpu); | 3702 | pr_err("kthread_create_on_node() failed for cpu %d\n", t->cpu); |
| 3703 | list_del(&t->th_list); | 3703 | list_del(&t->th_list); |
| 3704 | kfree(t); | 3704 | kfree(t); |
| 3705 | return PTR_ERR(p); | 3705 | return PTR_ERR(p); |
| @@ -820,6 +820,7 @@ void skb_tx_error(struct sk_buff *skb) · 819 unmodified lines | |||
| 820 | } | 820 | } |
| 821 | EXPORT_SYMBOL(skb_tx_error); | 821 | EXPORT_SYMBOL(skb_tx_error); |
| 822 | 822 | ||
| 823 | #ifdef CONFIG_TRACEPOINTS | ||
| 823 | /** | 824 | /** |
| 824 | * consume_skb - free an skbuff | 825 | * consume_skb - free an skbuff |
| 825 | * @skb: buffer to free | 826 | * @skb: buffer to free |
| @@ -837,6 +838,7 @@ void consume_skb(struct sk_buff *skb) · 11 unmodified lines | |||
| 837 | __kfree_skb(skb); | 838 | __kfree_skb(skb); |
| 838 | } | 839 | } |
| 839 | EXPORT_SYMBOL(consume_skb); | 840 | EXPORT_SYMBOL(consume_skb); |
| 841 | #endif | ||
| 840 | 842 | ||
| 841 | /** | 843 | /** |
| 842 | * consume_stateless_skb - free an skbuff, assuming it is stateless | 844 | * consume_stateless_skb - free an skbuff, assuming it is stateless |
| @@ -3254,7 +3254,7 @@ void sk_common_release(struct sock *sk) · 3253 unmodified lines | |||
| 3254 | sk->sk_prot->destroy(sk); | 3254 | sk->sk_prot->destroy(sk); |
| 3255 | 3255 | ||
| 3256 | /* | 3256 | /* |
| 3257 | * Observation: when sock_common_release is called, processes have | 3257 | * Observation: when sk_common_release is called, processes have |
| 3258 | * no access to socket. But net still has. | 3258 | * no access to socket. But net still has. |
| 3259 | * Step one, detach it from networking: | 3259 | * Step one, detach it from networking: |
| 3260 | * | 3260 | * |
| @@ -2121,7 +2121,8 @@ void fib_info_notify_update(struct net *net, struct nl_info *info) · 2120 unmodified lines | |||
| 2121 | struct hlist_head *head = &net->ipv4.fib_table_hash[h]; | 2121 | struct hlist_head *head = &net->ipv4.fib_table_hash[h]; |
| 2122 | struct fib_table *tb; | 2122 | struct fib_table *tb; |
| 2123 | 2123 | ||
| 2124 | hlist_for_each_entry_rcu(tb, head, tb_hlist) | 2124 | hlist_for_each_entry_rcu(tb, head, tb_hlist, |
| 2125 | lockdep_rtnl_is_held()) | ||
| 2125 | __fib_info_notify_update(net, tb, info); | 2126 | __fib_info_notify_update(net, tb, info); |
| 2126 | } | 2127 | } |
| 2127 | } | 2128 | } |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | |||
| 3 | * nf_nat_pptp.c | 3 | * nf_nat_pptp.c |
| 4 | * | 4 | * |
| 5 | * NAT support for PPTP (Point to Point Tunneling Protocol). | 5 | * NAT support for PPTP (Point to Point Tunneling Protocol). |
| 6 | * PPTP is a a protocol for creating virtual private networks. | 6 | * PPTP is a protocol for creating virtual private networks. |
| 7 | * It is a specification defined by Microsoft and some vendors | 7 | * It is a specification defined by Microsoft and some vendors |
| 8 | * working with Microsoft. PPTP is built on top of a modified | 8 | * working with Microsoft. PPTP is built on top of a modified |
| 9 | * version of the Internet Generic Routing Encapsulation Protocol. | 9 | * version of the Internet Generic Routing Encapsulation Protocol. |
| @@ -610,7 +610,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 609 unmodified lines | |||
| 610 | } else if (!ipc.oif) { | 610 | } else if (!ipc.oif) { |
| 611 | ipc.oif = inet->uc_index; | 611 | ipc.oif = inet->uc_index; |
| 612 | } else if (ipv4_is_lbcast(daddr) && inet->uc_index) { | 612 | } else if (ipv4_is_lbcast(daddr) && inet->uc_index) { |
| 613 | /* oif is set, packet is to local broadcast and | 613 | /* oif is set, packet is to local broadcast |
| 614 | * and uc_index is set. oif is most likely set | 614 | * and uc_index is set. oif is most likely set |
| 615 | * by sk_bound_dev_if. If uc_index != oif check if the | 615 | * by sk_bound_dev_if. If uc_index != oif check if the |
| 616 | * oif is an L3 master and uc_index is an L3 slave. | 616 | * oif is an L3 master and uc_index is an L3 slave. |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include <net/calipso.h> | 21 | #include <net/calipso.h> |
| 22 | #endif | 22 | #endif |
| 23 | 23 | ||
| 24 | static int two = 2; | ||
| 24 | static int flowlabel_reflect_max = 0x7; | 25 | static int flowlabel_reflect_max = 0x7; |
| 25 | static int auto_flowlabels_min; | 26 | static int auto_flowlabels_min; |
| 26 | static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX; | 27 | static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX; |
| @@ -150,7 +151,7 @@ static struct ctl_table ipv6_table_template[] = { · 123 unmodified lines | |||
| 150 | .mode = 0644, | 151 | .mode = 0644, |
| 151 | .proc_handler = proc_rt6_multipath_hash_policy, | 152 | .proc_handler = proc_rt6_multipath_hash_policy, |
| 152 | .extra1 = SYSCTL_ZERO, | 153 | .extra1 = SYSCTL_ZERO, |
| 153 | .extra2 = SYSCTL_ONE, | 154 | .extra2 = &two, |
| 154 | }, | 155 | }, |
| 155 | { | 156 | { |
| 156 | .procname = "seg6_flowlabel", | 157 | .procname = "seg6_flowlabel", |
| @@ -154,7 +154,7 @@ int l3mdev_master_upper_ifindex_by_index_rcu(struct net *net, int ifindex) · 153 unmodified lines | |||
| 154 | EXPORT_SYMBOL_GPL(l3mdev_master_upper_ifindex_by_index_rcu); | 154 | EXPORT_SYMBOL_GPL(l3mdev_master_upper_ifindex_by_index_rcu); |
| 155 | 155 | ||
| 156 | /** | 156 | /** |
| 157 | * l3mdev_fib_table - get FIB table id associated with an L3 | 157 | * l3mdev_fib_table_rcu - get FIB table id associated with an L3 |
| 158 | * master interface | 158 | * master interface |
| 159 | * @dev: targeted interface | 159 | * @dev: targeted interface |
| 160 | */ | 160 | */ |
| @@ -405,18 +405,14 @@ ieee80211_calc_legacy_rate_duration(u16 bitrate, bool short_pre, · 404 unmodified lines | |||
| 405 | return duration; | 405 | return duration; |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, | 408 | static u32 ieee80211_get_rate_duration(struct ieee80211_hw *hw, |
| 409 | struct ieee80211_rx_status *status, | 409 | struct ieee80211_rx_status *status, |
| 410 | int len) | 410 | u32 *overhead) |
| 411 | { | 411 | { |
| 412 | struct ieee80211_supported_band *sband; | ||
| 413 | const struct ieee80211_rate *rate; | ||
| 414 | bool sgi = status->enc_flags & RX_ENC_FLAG_SHORT_GI; | 412 | bool sgi = status->enc_flags & RX_ENC_FLAG_SHORT_GI; |
| 415 | bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE; | ||
| 416 | int bw, streams; | 413 | int bw, streams; |
| 417 | int group, idx; | 414 | int group, idx; |
| 418 | u32 duration; | 415 | u32 duration; |
| 419 | bool cck; | ||
| 420 | 416 | ||
| 421 | switch (status->bw) { | 417 | switch (status->bw) { |
| 422 | case RATE_INFO_BW_20: | 418 | case RATE_INFO_BW_20: |
| @@ -437,20 +433,6 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, · 14 unmodified lines | |||
| 437 | } | 433 | } |
| 438 | 434 | ||
| 439 | switch (status->encoding) { | 435 | switch (status->encoding) { |
| 440 | case RX_ENC_LEGACY: | ||
| 441 | if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ)) | ||
| 442 | return 0; | ||
| 443 | |||
| 444 | sband = hw->wiphy->bands[status->band]; | ||
| 445 | if (!sband || status->rate_idx >= sband->n_bitrates) | ||
| 446 | return 0; | ||
| 447 | |||
| 448 | rate = &sband->bitrates[status->rate_idx]; | ||
| 449 | cck = rate->flags & IEEE80211_RATE_MANDATORY_B; | ||
| 450 | |||
| 451 | return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp, | ||
| 452 | cck, len); | ||
| 453 | |||
| 454 | case RX_ENC_VHT: | 436 | case RX_ENC_VHT: |
| 455 | streams = status->nss; | 437 | streams = status->nss; |
| 456 | idx = status->rate_idx; | 438 | idx = status->rate_idx; |
| @@ -477,51 +459,144 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, · 20 unmodified lines | |||
| 477 | 459 | ||
| 478 | duration = airtime_mcs_groups[group].duration[idx]; | 460 | duration = airtime_mcs_groups[group].duration[idx]; |
| 479 | duration <<= airtime_mcs_groups[group].shift; | 461 | duration <<= airtime_mcs_groups[group].shift; |
| 462 | *overhead = 36 + (streams << 2); | ||
| 463 | |||
| 464 | return duration; | ||
| 465 | } | ||
| 466 | |||
| 467 | |||
| 468 | u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, | ||
| 469 | struct ieee80211_rx_status *status, | ||
| 470 | int len) | ||
| 471 | { | ||
| 472 | struct ieee80211_supported_band *sband; | ||
| 473 | u32 duration, overhead = 0; | ||
| 474 | |||
| 475 | if (status->encoding == RX_ENC_LEGACY) { | ||
| 476 | const struct ieee80211_rate *rate; | ||
| 477 | bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE; | ||
| 478 | bool cck; | ||
| 479 | |||
| 480 | if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ)) | ||
| 481 | return 0; | ||
| 482 | |||
| 483 | sband = hw->wiphy->bands[status->band]; | ||
| 484 | if (!sband || status->rate_idx >= sband->n_bitrates) | ||
| 485 | return 0; | ||
| 486 | |||
| 487 | rate = &sband->bitrates[status->rate_idx]; | ||
| 488 | cck = rate->flags & IEEE80211_RATE_MANDATORY_B; | ||
| 489 | |||
| 490 | return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp, | ||
| 491 | cck, len); | ||
| 492 | } | ||
| 493 | |||
| 494 | duration = ieee80211_get_rate_duration(hw, status, &overhead); | ||
| 495 | if (!duration) | ||
| 496 | return 0; | ||
| 497 | |||
| 480 | duration *= len; | 498 | duration *= len; |
| 481 | duration /= AVG_PKT_SIZE; | 499 | duration /= AVG_PKT_SIZE; |
| 482 | duration /= 1024; | 500 | duration /= 1024; |
| 483 | 501 | ||
| 484 | duration += 36 + (streams << 2); | 502 | return duration + overhead; |
| 485 | |||
| 486 | return duration; | ||
| 487 | } | 503 | } |
| 488 | EXPORT_SYMBOL_GPL(ieee80211_calc_rx_airtime); | 504 | EXPORT_SYMBOL_GPL(ieee80211_calc_rx_airtime); |
| 489 | 505 | ||
| 490 | static u32 ieee80211_calc_tx_airtime_rate(struct ieee80211_hw *hw, | 506 | static bool ieee80211_fill_rate_info(struct ieee80211_hw *hw, |
| 491 | struct ieee80211_tx_rate *rate, | 507 | struct ieee80211_rx_status *stat, u8 band, |
| 492 | u8 band, int len) | 508 | struct rate_info *ri) |
| 493 | { | 509 | { |
| 494 | struct ieee80211_rx_status stat = { | 510 | struct ieee80211_supported_band *sband = hw->wiphy->bands[band]; |
| 495 | .band = band, | 511 | int i; |
| 496 | }; | ||
| 497 | 512 | ||
| 498 | if (rate->idx < 0 || !rate->count) | 513 | if (!ri || !sband) |
| 514 | return false; | ||
| 515 | |||
| 516 | stat->bw = ri->bw; | ||
| 517 | stat->nss = ri->nss; | ||
| 518 | stat->rate_idx = ri->mcs; | ||
| 519 | |||
| 520 | if (ri->flags & RATE_INFO_FLAGS_HE_MCS) | ||
| 521 | stat->encoding = RX_ENC_HE; | ||
| 522 | else if (ri->flags & RATE_INFO_FLAGS_VHT_MCS) | ||
| 523 | stat->encoding = RX_ENC_VHT; | ||
| 524 | else if (ri->flags & RATE_INFO_FLAGS_MCS) | ||
| 525 | stat->encoding = RX_ENC_HT; | ||
| 526 | else | ||
| 527 | stat->encoding = RX_ENC_LEGACY; | ||
| 528 | |||
| 529 | if (ri->flags & RATE_INFO_FLAGS_SHORT_GI) | ||
| 530 | stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; | ||
| 531 | |||
| 532 | stat->he_gi = ri->he_gi; | ||
| 533 | |||
| 534 | if (stat->encoding != RX_ENC_LEGACY) | ||
| 535 | return true; | ||
| 536 | |||
| 537 | stat->rate_idx = 0; | ||
| 538 | for (i = 0; i < sband->n_bitrates; i++) { | ||
| 539 | if (ri->legacy != sband->bitrates[i].bitrate) | ||
| 540 | continue; | ||
| 541 | |||
| 542 | stat->rate_idx = i; | ||
| 543 | return true; | ||
| 544 | } | ||
| 545 | |||
| 546 | return false; | ||
| 547 | } | ||
| 548 | |||
| 549 | static int ieee80211_fill_rx_status(struct ieee80211_rx_status *stat, | ||
| 550 | struct ieee80211_hw *hw, | ||
| 551 | struct ieee80211_tx_rate *rate, | ||
| 552 | struct rate_info *ri, u8 band, int len) | ||
| 553 | { | ||
| 554 | memset(stat, 0, sizeof(*stat)); | ||
| 555 | stat->band = band; | ||
| 556 | |||
| 557 | if (ieee80211_fill_rate_info(hw, stat, band, ri)) | ||
| 499 | return 0; | 558 | return 0; |
| 500 | 559 | ||
| 560 | if (rate->idx < 0 || !rate->count) | ||
| 561 | return -1; | ||
| 562 | |||
| 501 | if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) | 563 | if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) |
| 502 | stat.bw = RATE_INFO_BW_80; | 564 | stat->bw = RATE_INFO_BW_80; |
| 503 | else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) | 565 | else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) |
| 504 | stat.bw = RATE_INFO_BW_40; | 566 | stat->bw = RATE_INFO_BW_40; |
| 505 | else | 567 | else |
| 506 | stat.bw = RATE_INFO_BW_20; | 568 | stat->bw = RATE_INFO_BW_20; |
| 507 | 569 | ||
| 508 | stat.enc_flags = 0; | 570 | stat->enc_flags = 0; |
| 509 | if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) | 571 | if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) |
| 510 | stat.enc_flags |= RX_ENC_FLAG_SHORTPRE; | 572 | stat->enc_flags |= RX_ENC_FLAG_SHORTPRE; |
| 511 | if (rate->flags & IEEE80211_TX_RC_SHORT_GI) | 573 | if (rate->flags & IEEE80211_TX_RC_SHORT_GI) |
| 512 | stat.enc_flags |= RX_ENC_FLAG_SHORT_GI; | 574 | stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; |
| 513 | 575 | ||
| 514 | stat.rate_idx = rate->idx; | 576 | stat->rate_idx = rate->idx; |
| 515 | if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { | 577 | if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { |
| 516 | stat.encoding = RX_ENC_VHT; | 578 | stat->encoding = RX_ENC_VHT; |
| 517 | stat.rate_idx = ieee80211_rate_get_vht_mcs(rate); | 579 | stat->rate_idx = ieee80211_rate_get_vht_mcs(rate); |
| 518 | stat.nss = ieee80211_rate_get_vht_nss(rate); | 580 | stat->nss = ieee80211_rate_get_vht_nss(rate); |
| 519 | } else if (rate->flags & IEEE80211_TX_RC_MCS) { | 581 | } else if (rate->flags & IEEE80211_TX_RC_MCS) { |
| 520 | stat.encoding = RX_ENC_HT; | 582 | stat->encoding = RX_ENC_HT; |
| 521 | } else { | 583 | } else { |
| 522 | stat.encoding = RX_ENC_LEGACY; | 584 | stat->encoding = RX_ENC_LEGACY; |
| 523 | } | 585 | } |
| 524 | 586 | ||
| 587 | return 0; | ||
| 588 | } | ||
| 589 | |||
| 590 | static u32 ieee80211_calc_tx_airtime_rate(struct ieee80211_hw *hw, | ||
| 591 | struct ieee80211_tx_rate *rate, | ||
| 592 | struct rate_info *ri, | ||
| 593 | u8 band, int len) | ||
| 594 | { | ||
| 595 | struct ieee80211_rx_status stat; | ||
| 596 | |||
| 597 | if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len)) | ||
| 598 | return 0; | ||
| 599 | |||
| 525 | return ieee80211_calc_rx_airtime(hw, &stat, len); | 600 | return ieee80211_calc_rx_airtime(hw, &stat, len); |
| 526 | } | 601 | } |
| 527 | 602 | ||
| @@ -536,7 +611,7 @@ u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw, · 8 unmodified lines | |||
| 536 | struct ieee80211_tx_rate *rate = &info->status.rates[i]; | 611 | struct ieee80211_tx_rate *rate = &info->status.rates[i]; |
| 537 | u32 cur_duration; | 612 | u32 cur_duration; |
| 538 | 613 | ||
| 539 | cur_duration = ieee80211_calc_tx_airtime_rate(hw, rate, | 614 | cur_duration = ieee80211_calc_tx_airtime_rate(hw, rate, NULL, |
| 540 | info->band, len); | 615 | info->band, len); |
| 541 | if (!cur_duration) | 616 | if (!cur_duration) |
| 542 | break; | 617 | break; |
| @@ -572,26 +647,41 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, · 29 unmodified lines | |||
| 572 | if (pubsta) { | 647 | if (pubsta) { |
| 573 | struct sta_info *sta = container_of(pubsta, struct sta_info, | 648 | struct sta_info *sta = container_of(pubsta, struct sta_info, |
| 574 | sta); | 649 | sta); |
| 650 | struct ieee80211_rx_status stat; | ||
| 575 | struct ieee80211_tx_rate *rate = &sta->tx_stats.last_rate; | 651 | struct ieee80211_tx_rate *rate = &sta->tx_stats.last_rate; |
| 576 | u32 airtime; | 652 | struct rate_info *ri = &sta->tx_stats.last_rate_info; |
| 653 | u32 duration, overhead; | ||
| 654 | u8 agg_shift; | ||
| 577 | 655 | ||
| 578 | if (!(rate->flags & (IEEE80211_TX_RC_VHT_MCS | | 656 | if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len)) |
| 579 | IEEE80211_TX_RC_MCS))) | 657 | return 0; |
| 580 | ampdu = false; | ||
| 581 | 658 | ||
| 659 | if (stat.encoding == RX_ENC_LEGACY || !ampdu) | ||
| 660 | return ieee80211_calc_rx_airtime(hw, &stat, len); | ||
| 661 | |||
| 662 | duration = ieee80211_get_rate_duration(hw, &stat, &overhead); | ||
| 582 | /* | 663 | /* |
| 583 | * Assume that HT/VHT transmission on any AC except VO will | 664 | * Assume that HT/VHT transmission on any AC except VO will |
| 584 | * use aggregation. Since we don't have reliable reporting | 665 | * use aggregation. Since we don't have reliable reporting |
| 585 | * of aggregation length, assume an average of 16. | 666 | * of aggregation length, assume an average size based on the |
| 667 | * tx rate. | ||
| 586 | * This will not be very accurate, but much better than simply | 668 | * This will not be very accurate, but much better than simply |
| 587 | * assuming un-aggregated tx. | 669 | * assuming un-aggregated tx in all cases. |
| 588 | */ | 670 | */ |
| 589 | airtime = ieee80211_calc_tx_airtime_rate(hw, rate, band, | 671 | if (duration > 400) /* <= VHT20 MCS2 1S */ |
| 590 | ampdu ? len * 16 : len); | 672 | agg_shift = 1; |
| 591 | if (ampdu) | 673 | else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */ |
| 592 | airtime /= 16; | 674 | agg_shift = 2; |
| 593 | 675 | else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */ | |
| 594 | return airtime; | 676 | agg_shift = 3; |
| 677 | else | ||
| 678 | agg_shift = 4; | ||
| 679 | |||
| 680 | duration *= len; | ||
| 681 | duration /= AVG_PKT_SIZE; | ||
| 682 | duration /= 1024; | ||
| 683 | |||
| 684 | return duration + (overhead >> agg_shift); | ||
| 595 | } | 685 | } |
| 596 | 686 | ||
| 597 | if (!conf) | 687 | if (!conf) |
| @@ -524,7 +524,7 @@ struct ieee80211_sta_rx_stats { · 523 unmodified lines | |||
| 524 | * @status_stats.retry_failed: # of frames that failed after retry | 524 | * @status_stats.retry_failed: # of frames that failed after retry |
| 525 | * @status_stats.retry_count: # of retries attempted | 525 | * @status_stats.retry_count: # of retries attempted |
| 526 | * @status_stats.lost_packets: # of lost packets | 526 | * @status_stats.lost_packets: # of lost packets |
| 527 | * @status_stats.last_tdls_pkt_time: timestamp of last TDLS packet | 527 | * @status_stats.last_pkt_time: timestamp of last ACKed packet |
| 528 | * @status_stats.msdu_retries: # of MSDU retries | 528 | * @status_stats.msdu_retries: # of MSDU retries |
| 529 | * @status_stats.msdu_failed: # of failed MSDUs | 529 | * @status_stats.msdu_failed: # of failed MSDUs |
| 530 | * @status_stats.last_ack: last ack timestamp (jiffies) | 530 | * @status_stats.last_ack: last ack timestamp (jiffies) |
| @@ -597,7 +597,7 @@ struct sta_info { · 66 unmodified lines | |||
| 597 | unsigned long filtered; | 597 | unsigned long filtered; |
| 598 | unsigned long retry_failed, retry_count; | 598 | unsigned long retry_failed, retry_count; |
| 599 | unsigned int lost_packets; | 599 | unsigned int lost_packets; |
| 600 | unsigned long last_tdls_pkt_time; | 600 | unsigned long last_pkt_time; |
| 601 | u64 msdu_retries[IEEE80211_NUM_TIDS + 1]; | 601 | u64 msdu_retries[IEEE80211_NUM_TIDS + 1]; |
| 602 | u64 msdu_failed[IEEE80211_NUM_TIDS + 1]; | 602 | u64 msdu_failed[IEEE80211_NUM_TIDS + 1]; |
| 603 | unsigned long last_ack; | 603 | unsigned long last_ack; |
| @@ -611,6 +611,7 @@ struct sta_info { · 7 unmodified lines | |||
| 611 | u64 packets[IEEE80211_NUM_ACS]; | 611 | u64 packets[IEEE80211_NUM_ACS]; |
| 612 | u64 bytes[IEEE80211_NUM_ACS]; | 612 | u64 bytes[IEEE80211_NUM_ACS]; |
| 613 | struct ieee80211_tx_rate last_rate; | 613 | struct ieee80211_tx_rate last_rate; |
| 614 | struct rate_info last_rate_info; | ||
| 614 | u64 msdu[IEEE80211_NUM_TIDS + 1]; | 615 | u64 msdu[IEEE80211_NUM_TIDS + 1]; |
| 615 | } tx_stats; | 616 | } tx_stats; |
| 616 | u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; | 617 | u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; |
| @@ -755,12 +755,16 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local, · 754 unmodified lines | |||
| 755 | * - current throughput (higher value for higher tpt)? | 755 | * - current throughput (higher value for higher tpt)? |
| 756 | */ | 756 | */ |
| 757 | #define STA_LOST_PKT_THRESHOLD 50 | 757 | #define STA_LOST_PKT_THRESHOLD 50 |
| 758 | #define STA_LOST_PKT_TIME HZ /* 1 sec since last ACK */ | ||
| 758 | #define STA_LOST_TDLS_PKT_THRESHOLD 10 | 759 | #define STA_LOST_TDLS_PKT_THRESHOLD 10 |
| 759 | #define STA_LOST_TDLS_PKT_TIME (10*HZ) /* 10secs since last ACK */ | 760 | #define STA_LOST_TDLS_PKT_TIME (10*HZ) /* 10secs since last ACK */ |
| 760 | 761 | ||
| 761 | static void ieee80211_lost_packet(struct sta_info *sta, | 762 | static void ieee80211_lost_packet(struct sta_info *sta, |
| 762 | struct ieee80211_tx_info *info) | 763 | struct ieee80211_tx_info *info) |
| 763 | { | 764 | { |
| 765 | unsigned long pkt_time = STA_LOST_PKT_TIME; | ||
| 766 | unsigned int pkt_thr = STA_LOST_PKT_THRESHOLD; | ||
| 767 | |||
| 764 | /* If driver relies on its own algorithm for station kickout, skip | 768 | /* If driver relies on its own algorithm for station kickout, skip |
| 765 | * mac80211 packet loss mechanism. | 769 | * mac80211 packet loss mechanism. |
| 766 | */ | 770 | */ |
| @@ -773,21 +777,20 @@ static void ieee80211_lost_packet(struct sta_info *sta, · 6 unmodified lines | |||
| 773 | return; | 777 | return; |
| 774 | 778 | ||
| 775 | sta->status_stats.lost_packets++; | 779 | sta->status_stats.lost_packets++; |
| 776 | if (!sta->sta.tdls && | 780 | if (sta->sta.tdls) { |
| 777 | sta->status_stats.lost_packets < STA_LOST_PKT_THRESHOLD) | 781 | pkt_time = STA_LOST_TDLS_PKT_TIME; |
| 778 | return; | 782 | pkt_thr = STA_LOST_PKT_THRESHOLD; |
| 783 | } | ||
| 779 | 784 | ||
| 780 | /* | 785 | /* |
| 781 | * If we're in TDLS mode, make sure that all STA_LOST_TDLS_PKT_THRESHOLD | 786 | * If we're in TDLS mode, make sure that all STA_LOST_TDLS_PKT_THRESHOLD |
| 782 | * of the last packets were lost, and that no ACK was received in the | 787 | * of the last packets were lost, and that no ACK was received in the |
| 783 | * last STA_LOST_TDLS_PKT_TIME ms, before triggering the CQM packet-loss | 788 | * last STA_LOST_TDLS_PKT_TIME ms, before triggering the CQM packet-loss |
| 784 | * mechanism. | 789 | * mechanism. |
| 790 | * For non-TDLS, use STA_LOST_PKT_THRESHOLD and STA_LOST_PKT_TIME | ||
| 785 | */ | 791 | */ |
| 786 | if (sta->sta.tdls && | 792 | if (sta->status_stats.lost_packets < pkt_thr || |
| 787 | (sta->status_stats.lost_packets < STA_LOST_TDLS_PKT_THRESHOLD || | 793 | !time_after(jiffies, sta->status_stats.last_pkt_time + pkt_time)) |
| 788 | time_before(jiffies, | ||
| 789 | sta->status_stats.last_tdls_pkt_time + | ||
| 790 | STA_LOST_TDLS_PKT_TIME))) | ||
| 791 | return; | 794 | return; |
| 792 | 795 | ||
| 793 | cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr, | 796 | cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr, |
| @@ -1033,9 +1036,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw, · 239 unmodified lines | |||
| 1033 | sta->status_stats.lost_packets = 0; | 1036 | sta->status_stats.lost_packets = 0; |
| 1034 | 1037 | ||
| 1035 | /* Track when last TDLS packet was ACKed */ | 1038 | /* Track when last TDLS packet was ACKed */ |
| 1036 | if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) | 1039 | sta->status_stats.last_pkt_time = jiffies; |
| 1037 | sta->status_stats.last_tdls_pkt_time = | ||
| 1038 | jiffies; | ||
| 1039 | } else if (noack_success) { | 1040 | } else if (noack_success) { |
| 1040 | /* nothing to do here, do not account as lost */ | 1041 | /* nothing to do here, do not account as lost */ |
| 1041 | } else { | 1042 | } else { |
| @@ -1137,9 +1138,17 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw, · 95 unmodified lines | |||
| 1137 | struct ieee80211_tx_info *info = status->info; | 1138 | struct ieee80211_tx_info *info = status->info; |
| 1138 | struct ieee80211_sta *pubsta = status->sta; | 1139 | struct ieee80211_sta *pubsta = status->sta; |
| 1139 | struct ieee80211_supported_band *sband; | 1140 | struct ieee80211_supported_band *sband; |
| 1141 | struct sta_info *sta; | ||
| 1140 | int retry_count; | 1142 | int retry_count; |
| 1141 | bool acked, noack_success; | 1143 | bool acked, noack_success; |
| 1142 | 1144 | ||
| 1145 | if (pubsta) { | ||
| 1146 | sta = container_of(pubsta, struct sta_info, sta); | ||
| 1147 | |||
| 1148 | if (status->rate) | ||
| 1149 | sta->tx_stats.last_rate_info = *status->rate; | ||
| 1150 | } | ||
| 1151 | |||
| 1143 | if (status->skb) | 1152 | if (status->skb) |
| 1144 | return __ieee80211_tx_status(hw, status); | 1153 | return __ieee80211_tx_status(hw, status); |
| 1145 | 1154 | ||
| @@ -1154,10 +1163,6 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw, · 8 unmodified lines | |||
| 1154 | noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED); | 1163 | noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED); |
| 1155 | 1164 | ||
| 1156 | if (pubsta) { | 1165 | if (pubsta) { |
| 1157 | struct sta_info *sta; | ||
| 1158 | |||
| 1159 | sta = container_of(pubsta, struct sta_info, sta); | ||
| 1160 | |||
| 1161 | if (!acked && !noack_success) | 1166 | if (!acked && !noack_success) |
| 1162 | sta->status_stats.retry_failed++; | 1167 | sta->status_stats.retry_failed++; |
| 1163 | sta->status_stats.retry_count += retry_count; | 1168 | sta->status_stats.retry_count += retry_count; |
| @@ -1168,9 +1173,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw, · 4 unmodified lines | |||
| 1168 | if (sta->status_stats.lost_packets) | 1173 | if (sta->status_stats.lost_packets) |
| 1169 | sta->status_stats.lost_packets = 0; | 1174 | sta->status_stats.lost_packets = 0; |
| 1170 | 1175 | ||
| 1171 | /* Track when last TDLS packet was ACKed */ | 1176 | /* Track when last packet was ACKed */ |
| 1172 | if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) | 1177 | sta->status_stats.last_pkt_time = jiffies; |
| 1173 | sta->status_stats.last_tdls_pkt_time = jiffies; | ||
| 1174 | } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { | 1178 | } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { |
| 1175 | return; | 1179 | return; |
| 1176 | } else if (noack_success) { | 1180 | } else if (noack_success) { |
| @@ -1259,8 +1263,7 @@ void ieee80211_tx_status_8023(struct ieee80211_hw *hw, · 82 unmodified lines | |||
| 1259 | if (sta->status_stats.lost_packets) | 1263 | if (sta->status_stats.lost_packets) |
| 1260 | sta->status_stats.lost_packets = 0; | 1264 | sta->status_stats.lost_packets = 0; |
| 1261 | 1265 | ||
| 1262 | if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) | 1266 | sta->status_stats.last_pkt_time = jiffies; |
| 1263 | sta->status_stats.last_tdls_pkt_time = jiffies; | ||
| 1264 | } else { | 1267 | } else { |
| 1265 | ieee80211_lost_packet(sta, info); | 1268 | ieee80211_lost_packet(sta, info); |
| 1266 | } | 1269 | } |
| @@ -891,7 +891,6 @@ restart: · 890 unmodified lines | |||
| 891 | goto out; | 891 | goto out; |
| 892 | } | 892 | } |
| 893 | 893 | ||
| 894 | wait_for_sndbuf: | ||
| 895 | __mptcp_flush_join_list(msk); | 894 | __mptcp_flush_join_list(msk); |
| 896 | ssk = mptcp_subflow_get_send(msk); | 895 | ssk = mptcp_subflow_get_send(msk); |
| 897 | while (!sk_stream_memory_free(sk) || | 896 | while (!sk_stream_memory_free(sk) || |
| @@ -981,7 +980,7 @@ wait_for_sndbuf: · 83 unmodified lines | |||
| 981 | */ | 980 | */ |
| 982 | mptcp_set_timeout(sk, ssk); | 981 | mptcp_set_timeout(sk, ssk); |
| 983 | release_sock(ssk); | 982 | release_sock(ssk); |
| 984 | goto wait_for_sndbuf; | 983 | goto restart; |
| 985 | } | 984 | } |
| 986 | } | 985 | } |
| 987 | } | 986 | } |
| @@ -1,7 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | /* | 2 | /* |
| 3 | * Connection tracking support for PPTP (Point to Point Tunneling Protocol). | 3 | * Connection tracking support for PPTP (Point to Point Tunneling Protocol). |
| 4 | * PPTP is a a protocol for creating virtual private networks. | 4 | * PPTP is a protocol for creating virtual private networks. |
| 5 | * It is a specification defined by Microsoft and some vendors | 5 | * It is a specification defined by Microsoft and some vendors |
| 6 | * working with Microsoft. PPTP is built on top of a modified | 6 | * working with Microsoft. PPTP is built on top of a modified |
| 7 | * version of the Internet Generic Routing Encapsulation Protocol. | 7 | * version of the Internet Generic Routing Encapsulation Protocol. |
| @@ -62,6 +62,8 @@ static const unsigned int sctp_timeouts[SCTP_CONNTRACK_MAX] = { · 61 unmodified lines | |||
| 62 | [SCTP_CONNTRACK_HEARTBEAT_ACKED] = 210 SECS, | 62 | [SCTP_CONNTRACK_HEARTBEAT_ACKED] = 210 SECS, |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | #define SCTP_FLAG_HEARTBEAT_VTAG_FAILED 1 | ||
| 66 | |||
| 65 | #define sNO SCTP_CONNTRACK_NONE | 67 | #define sNO SCTP_CONNTRACK_NONE |
| 66 | #define sCL SCTP_CONNTRACK_CLOSED | 68 | #define sCL SCTP_CONNTRACK_CLOSED |
| 67 | #define sCW SCTP_CONNTRACK_COOKIE_WAIT | 69 | #define sCW SCTP_CONNTRACK_COOKIE_WAIT |
| @@ -369,6 +371,7 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 301 unmodified lines | |||
| 369 | u_int32_t offset, count; | 371 | u_int32_t offset, count; |
| 370 | unsigned int *timeouts; | 372 | unsigned int *timeouts; |
| 371 | unsigned long map[256 / sizeof(unsigned long)] = { 0 }; | 373 | unsigned long map[256 / sizeof(unsigned long)] = { 0 }; |
| 374 | bool ignore = false; | ||
| 372 | 375 | ||
| 373 | if (sctp_error(skb, dataoff, state)) | 376 | if (sctp_error(skb, dataoff, state)) |
| 374 | return -NF_ACCEPT; | 377 | return -NF_ACCEPT; |
| @@ -427,15 +430,39 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 52 unmodified lines | |||
| 427 | /* Sec 8.5.1 (D) */ | 430 | /* Sec 8.5.1 (D) */ |
| 428 | if (sh->vtag != ct->proto.sctp.vtag[dir]) | 431 | if (sh->vtag != ct->proto.sctp.vtag[dir]) |
| 429 | goto out_unlock; | 432 | goto out_unlock; |
| 430 | } else if (sch->type == SCTP_CID_HEARTBEAT || | 433 | } else if (sch->type == SCTP_CID_HEARTBEAT) { |
| 431 | sch->type == SCTP_CID_HEARTBEAT_ACK) { | 434 | if (ct->proto.sctp.vtag[dir] == 0) { |
| 435 | pr_debug("Setting %d vtag %x for dir %d\n", sch->type, sh->vtag, dir); | ||
| 436 | ct->proto.sctp.vtag[dir] = sh->vtag; | ||
| 437 | } else if (sh->vtag != ct->proto.sctp.vtag[dir]) { | ||
| 438 | if (test_bit(SCTP_CID_DATA, map) || ignore) | ||
| 439 | goto out_unlock; | ||
| 440 | |||
| 441 | ct->proto.sctp.flags |= SCTP_FLAG_HEARTBEAT_VTAG_FAILED; | ||
| 442 | ct->proto.sctp.last_dir = dir; | ||
| 443 | ignore = true; | ||
| 444 | continue; | ||
| 445 | } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) { | ||
| 446 | ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED; | ||
| 447 | } | ||
| 448 | } else if (sch->type == SCTP_CID_HEARTBEAT_ACK) { | ||
| 432 | if (ct->proto.sctp.vtag[dir] == 0) { | 449 | if (ct->proto.sctp.vtag[dir] == 0) { |
| 433 | pr_debug("Setting vtag %x for dir %d\n", | 450 | pr_debug("Setting vtag %x for dir %d\n", |
| 434 | sh->vtag, dir); | 451 | sh->vtag, dir); |
| 435 | ct->proto.sctp.vtag[dir] = sh->vtag; | 452 | ct->proto.sctp.vtag[dir] = sh->vtag; |
| 436 | } else if (sh->vtag != ct->proto.sctp.vtag[dir]) { | 453 | } else if (sh->vtag != ct->proto.sctp.vtag[dir]) { |
| 437 | pr_debug("Verification tag check failed\n"); | 454 | if (test_bit(SCTP_CID_DATA, map) || ignore) |
| 438 | goto out_unlock; | 455 | goto out_unlock; |
| 456 | |||
| 457 | if ((ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) == 0 || | ||
| 458 | ct->proto.sctp.last_dir == dir) | ||
| 459 | goto out_unlock; | ||
| 460 | |||
| 461 | ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED; | ||
| 462 | ct->proto.sctp.vtag[dir] = sh->vtag; | ||
| 463 | ct->proto.sctp.vtag[!dir] = 0; | ||
| 464 | } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) { | ||
| 465 | ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED; | ||
| 439 | } | 466 | } |
| 440 | } | 467 | } |
| 441 | 468 | ||
| @@ -470,6 +497,10 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 28 unmodified lines | |||
| 470 | } | 497 | } |
| 471 | spin_unlock_bh(&ct->lock); | 498 | spin_unlock_bh(&ct->lock); |
| 472 | 499 | ||
| 500 | /* allow but do not refresh timeout */ | ||
| 501 | if (ignore) | ||
| 502 | return NF_ACCEPT; | ||
| 503 | |||
| 473 | timeouts = nf_ct_timeout_lookup(ct); | 504 | timeouts = nf_ct_timeout_lookup(ct); |
| 474 | if (!timeouts) | 505 | if (!timeouts) |
| 475 | timeouts = nf_sctp_pernet(nf_ct_net(ct))->timeouts; | 506 | timeouts = nf_sctp_pernet(nf_ct_net(ct))->timeouts; |
| @@ -1152,7 +1152,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, · 1151 unmodified lines | |||
| 1152 | && (old_state == TCP_CONNTRACK_SYN_RECV | 1152 | && (old_state == TCP_CONNTRACK_SYN_RECV |
| 1153 | || old_state == TCP_CONNTRACK_ESTABLISHED) | 1153 | || old_state == TCP_CONNTRACK_ESTABLISHED) |
| 1154 | && new_state == TCP_CONNTRACK_ESTABLISHED) { | 1154 | && new_state == TCP_CONNTRACK_ESTABLISHED) { |
| 1155 | /* Set ASSURED if we see see valid ack in ESTABLISHED | 1155 | /* Set ASSURED if we see valid ack in ESTABLISHED |
| 1156 | after SYN_RECV or a valid answer for a picked up | 1156 | after SYN_RECV or a valid answer for a picked up |
| 1157 | connection. */ | 1157 | connection. */ |
| 1158 | set_bit(IPS_ASSURED_BIT, &ct->status); | 1158 | set_bit(IPS_ASSURED_BIT, &ct->status); |
| @@ -81,18 +81,6 @@ static bool udp_error(struct sk_buff *skb, · 80 unmodified lines | |||
| 81 | return false; | 81 | return false; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | static void nf_conntrack_udp_refresh_unreplied(struct nf_conn *ct, | ||
| 85 | struct sk_buff *skb, | ||
| 86 | enum ip_conntrack_info ctinfo, | ||
| 87 | u32 extra_jiffies) | ||
| 88 | { | ||
| 89 | if (unlikely(ctinfo == IP_CT_ESTABLISHED_REPLY && | ||
| 90 | ct->status & IPS_NAT_CLASH)) | ||
| 91 | nf_ct_kill(ct); | ||
| 92 | else | ||
| 93 | nf_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies); | ||
| 94 | } | ||
| 95 | |||
| 96 | /* Returns verdict for packet, and may modify conntracktype */ | 84 | /* Returns verdict for packet, and may modify conntracktype */ |
| 97 | int nf_conntrack_udp_packet(struct nf_conn *ct, | 85 | int nf_conntrack_udp_packet(struct nf_conn *ct, |
| 98 | struct sk_buff *skb, | 86 | struct sk_buff *skb, |
| @@ -124,12 +112,15 @@ int nf_conntrack_udp_packet(struct nf_conn *ct, · 25 unmodified lines | |||
| 124 | 112 | ||
| 125 | nf_ct_refresh_acct(ct, ctinfo, skb, extra); | 113 | nf_ct_refresh_acct(ct, ctinfo, skb, extra); |
| 126 | 114 | ||
| 115 | /* never set ASSURED for IPS_NAT_CLASH, they time out soon */ | ||
| 116 | if (unlikely((ct->status & IPS_NAT_CLASH))) | ||
| 117 | return NF_ACCEPT; | ||
| 118 | |||
| 127 | /* Also, more likely to be important, and not a probe */ | 119 | /* Also, more likely to be important, and not a probe */ |
| 128 | if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) | 120 | if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) |
| 129 | nf_conntrack_event_cache(IPCT_ASSURED, ct); | 121 | nf_conntrack_event_cache(IPCT_ASSURED, ct); |
| 130 | } else { | 122 | } else { |
| 131 | nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo, | 123 | nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED]); |
| 132 | timeouts[UDP_CT_UNREPLIED]); | ||
| 133 | } | 124 | } |
| 134 | return NF_ACCEPT; | 125 | return NF_ACCEPT; |
| 135 | } | 126 | } |
| @@ -206,12 +197,15 @@ int nf_conntrack_udplite_packet(struct nf_conn *ct, · 70 unmodified lines | |||
| 206 | if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { | 197 | if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { |
| 207 | nf_ct_refresh_acct(ct, ctinfo, skb, | 198 | nf_ct_refresh_acct(ct, ctinfo, skb, |
| 208 | timeouts[UDP_CT_REPLIED]); | 199 | timeouts[UDP_CT_REPLIED]); |
| 200 | |||
| 201 | if (unlikely((ct->status & IPS_NAT_CLASH))) | ||
| 202 | return NF_ACCEPT; | ||
| 203 | |||
| 209 | /* Also, more likely to be important, and not a probe */ | 204 | /* Also, more likely to be important, and not a probe */ |
| 210 | if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) | 205 | if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) |
| 211 | nf_conntrack_event_cache(IPCT_ASSURED, ct); | 206 | nf_conntrack_event_cache(IPCT_ASSURED, ct); |
| 212 | } else { | 207 | } else { |
| 213 | nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo, | 208 | nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED]); |
| 214 | timeouts[UDP_CT_UNREPLIED]); | ||
| 215 | } | 209 | } |
| 216 | return NF_ACCEPT; | 210 | return NF_ACCEPT; |
| 217 | } | 211 | } |
| @@ -815,11 +815,11 @@ static int nf_tables_gettable(struct net *net, struct sock *nlsk, · 814 unmodified lines | |||
| 815 | nlh->nlmsg_seq, NFT_MSG_NEWTABLE, 0, | 815 | nlh->nlmsg_seq, NFT_MSG_NEWTABLE, 0, |
| 816 | family, table); | 816 | family, table); |
| 817 | if (err < 0) | 817 | if (err < 0) |
| 818 | goto err; | 818 | goto err_fill_table_info; |
| 819 | 819 | ||
| 820 | return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); | 820 | return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); |
| 821 | 821 | ||
| 822 | err: | 822 | err_fill_table_info: |
| 823 | kfree_skb(skb2); | 823 | kfree_skb(skb2); |
| 824 | return err; | 824 | return err; |
| 825 | } | 825 | } |
| @@ -1563,11 +1563,11 @@ static int nf_tables_getchain(struct net *net, struct sock *nlsk, · 737 unmodified lines | |||
| 1563 | nlh->nlmsg_seq, NFT_MSG_NEWCHAIN, 0, | 1563 | nlh->nlmsg_seq, NFT_MSG_NEWCHAIN, 0, |
| 1564 | family, table, chain); | 1564 | family, table, chain); |
| 1565 | if (err < 0) | 1565 | if (err < 0) |
| 1566 | goto err; | 1566 | goto err_fill_chain_info; |
| 1567 | 1567 | ||
| 1568 | return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); | 1568 | return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); |
| 1569 | 1569 | ||
| 1570 | err: | 1570 | err_fill_chain_info: |
| 1571 | kfree_skb(skb2); | 1571 | kfree_skb(skb2); |
| 1572 | return err; | 1572 | return err; |
| 1573 | } | 1573 | } |
| @@ -3008,11 +3008,11 @@ static int nf_tables_getrule(struct net *net, struct sock *nlsk, · 1434 unmodified lines | |||
| 3008 | nlh->nlmsg_seq, NFT_MSG_NEWRULE, 0, | 3008 | nlh->nlmsg_seq, NFT_MSG_NEWRULE, 0, |
| 3009 | family, table, chain, rule, NULL); | 3009 | family, table, chain, rule, NULL); |
| 3010 | if (err < 0) | 3010 | if (err < 0) |
| 3011 | goto err; | 3011 | goto err_fill_rule_info; |
| 3012 | 3012 | ||
| 3013 | return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); | 3013 | return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); |
| 3014 | 3014 | ||
| 3015 | err: | 3015 | err_fill_rule_info: |
| 3016 | kfree_skb(skb2); | 3016 | kfree_skb(skb2); |
| 3017 | return err; | 3017 | return err; |
| 3018 | } | 3018 | } |
| @@ -3770,7 +3770,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, · 751 unmodified lines | |||
| 3770 | goto nla_put_failure; | 3770 | goto nla_put_failure; |
| 3771 | } | 3771 | } |
| 3772 | 3772 | ||
| 3773 | if (nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata)) | 3773 | if (set->udata && |
| 3774 | nla_put(skb, NFTA_SET_USERDATA, set->udlen, set->udata)) | ||
| 3774 | goto nla_put_failure; | 3775 | goto nla_put_failure; |
| 3775 | 3776 | ||
| 3776 | nest = nla_nest_start_noflag(skb, NFTA_SET_DESC); | 3777 | nest = nla_nest_start_noflag(skb, NFTA_SET_DESC); |
| @@ -3967,11 +3968,11 @@ static int nf_tables_getset(struct net *net, struct sock *nlsk, · 190 unmodified lines | |||
| 3967 | 3968 | ||
| 3968 | err = nf_tables_fill_set(skb2, &ctx, set, NFT_MSG_NEWSET, 0); | 3969 | err = nf_tables_fill_set(skb2, &ctx, set, NFT_MSG_NEWSET, 0); |
| 3969 | if (err < 0) | 3970 | if (err < 0) |
| 3970 | goto err; | 3971 | goto err_fill_set_info; |
| 3971 | 3972 | ||
| 3972 | return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); | 3973 | return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); |
| 3973 | 3974 | ||
| 3974 | err: | 3975 | err_fill_set_info: |
| 3975 | kfree_skb(skb2); | 3976 | kfree_skb(skb2); |
| 3976 | return err; | 3977 | return err; |
| 3977 | } | 3978 | } |
| @@ -4859,24 +4860,18 @@ static int nft_get_set_elem(struct nft_ctx *ctx, struct nft_set *set, · 881 unmodified lines | |||
| 4859 | err = -ENOMEM; | 4860 | err = -ENOMEM; |
| 4860 | skb = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); | 4861 | skb = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); |
| 4861 | if (skb == NULL) | 4862 | if (skb == NULL) |
| 4862 | goto err1; | 4863 | return err; |
| 4863 | 4864 | ||
| 4864 | err = nf_tables_fill_setelem_info(skb, ctx, ctx->seq, ctx->portid, | 4865 | err = nf_tables_fill_setelem_info(skb, ctx, ctx->seq, ctx->portid, |
| 4865 | NFT_MSG_NEWSETELEM, 0, set, &elem); | 4866 | NFT_MSG_NEWSETELEM, 0, set, &elem); |
| 4866 | if (err < 0) | 4867 | if (err < 0) |
| 4867 | goto err2; | 4868 | goto err_fill_setelem; |
| 4868 | 4869 | ||
| 4869 | err = nfnetlink_unicast(skb, ctx->net, ctx->portid, MSG_DONTWAIT); | 4870 | return nfnetlink_unicast(skb, ctx->net, ctx->portid); |
| 4870 | /* This avoids a loop in nfnetlink. */ | ||
| 4871 | if (err < 0) | ||
| 4872 | goto err1; | ||
| 4873 | 4871 | ||
| 4874 | return 0; | 4872 | err_fill_setelem: |
| 4875 | err2: | ||
| 4876 | kfree_skb(skb); | 4873 | kfree_skb(skb); |
| 4877 | err1: | 4874 | return err; |
| 4878 | /* this avoids a loop in nfnetlink. */ | ||
| 4879 | return err == -EAGAIN ? -ENOBUFS : err; | ||
| 4880 | } | 4875 | } |
| 4881 | 4876 | ||
| 4882 | /* called with rcu_read_lock held */ | 4877 | /* called with rcu_read_lock held */ |
| @@ -6181,10 +6176,11 @@ static int nf_tables_getobj(struct net *net, struct sock *nlsk, · 1298 unmodified lines | |||
| 6181 | nlh->nlmsg_seq, NFT_MSG_NEWOBJ, 0, | 6176 | nlh->nlmsg_seq, NFT_MSG_NEWOBJ, 0, |
| 6182 | family, table, obj, reset); | 6177 | family, table, obj, reset); |
| 6183 | if (err < 0) | 6178 | if (err < 0) |
| 6184 | goto err; | 6179 | goto err_fill_obj_info; |
| 6185 | 6180 | ||
| 6186 | return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); | 6181 | return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); |
| 6187 | err: | 6182 | |
| 6183 | err_fill_obj_info: | ||
| 6188 | kfree_skb(skb2); | 6184 | kfree_skb(skb2); |
| 6189 | return err; | 6185 | return err; |
| 6190 | } | 6186 | } |
| @@ -7044,10 +7040,11 @@ static int nf_tables_getflowtable(struct net *net, struct sock *nlsk, · 853 unmodified lines | |||
| 7044 | NFT_MSG_NEWFLOWTABLE, 0, family, | 7040 | NFT_MSG_NEWFLOWTABLE, 0, family, |
| 7045 | flowtable, &flowtable->hook_list); | 7041 | flowtable, &flowtable->hook_list); |
| 7046 | if (err < 0) | 7042 | if (err < 0) |
| 7047 | goto err; | 7043 | goto err_fill_flowtable_info; |
| 7048 | 7044 | ||
| 7049 | return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); | 7045 | return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); |
| 7050 | err: | 7046 | |
| 7047 | err_fill_flowtable_info: | ||
| 7051 | kfree_skb(skb2); | 7048 | kfree_skb(skb2); |
| 7052 | return err; | 7049 | return err; |
| 7053 | } | 7050 | } |
| @@ -7233,10 +7230,11 @@ static int nf_tables_getgen(struct net *net, struct sock *nlsk, · 179 unmodified lines | |||
| 7233 | err = nf_tables_fill_gen_info(skb2, net, NETLINK_CB(skb).portid, | 7230 | err = nf_tables_fill_gen_info(skb2, net, NETLINK_CB(skb).portid, |
| 7234 | nlh->nlmsg_seq); | 7231 | nlh->nlmsg_seq); |
| 7235 | if (err < 0) | 7232 | if (err < 0) |
| 7236 | goto err; | 7233 | goto err_fill_gen_info; |
| 7237 | 7234 | ||
| 7238 | return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); | 7235 | return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); |
| 7239 | err: | 7236 | |
| 7237 | err_fill_gen_info: | ||
| 7240 | kfree_skb(skb2); | 7238 | kfree_skb(skb2); |
| 7241 | return err; | 7239 | return err; |
| 7242 | } | 7240 | } |
| @@ -149,10 +149,15 @@ int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error) · 148 unmodified lines | |||
| 149 | } | 149 | } |
| 150 | EXPORT_SYMBOL_GPL(nfnetlink_set_err); | 150 | EXPORT_SYMBOL_GPL(nfnetlink_set_err); |
| 151 | 151 | ||
| 152 | int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid, | 152 | int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid) |
| 153 | int flags) | ||
| 154 | { | 153 | { |
| 155 | return netlink_unicast(net->nfnl, skb, portid, flags); | 154 | int err; |
| 155 | |||
| 156 | err = nlmsg_unicast(net->nfnl, skb, portid); | ||
| 157 | if (err == -EAGAIN) | ||
| 158 | err = -ENOBUFS; | ||
| 159 | |||
| 160 | return err; | ||
| 156 | } | 161 | } |
| 157 | EXPORT_SYMBOL_GPL(nfnetlink_unicast); | 162 | EXPORT_SYMBOL_GPL(nfnetlink_unicast); |
| 158 | 163 | ||
| @@ -356,8 +356,7 @@ __nfulnl_send(struct nfulnl_instance *inst) · 355 unmodified lines | |||
| 356 | goto out; | 356 | goto out; |
| 357 | } | 357 | } |
| 358 | } | 358 | } |
| 359 | nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, | 359 | nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid); |
| 360 | MSG_DONTWAIT); | ||
| 361 | out: | 360 | out: |
| 362 | inst->qlen = 0; | 361 | inst->qlen = 0; |
| 363 | inst->skb = NULL; | 362 | inst->skb = NULL; |
| @@ -681,7 +681,7 @@ __nfqnl_enqueue_packet(struct net *net, struct nfqnl_instance *queue, · 680 unmodified lines | |||
| 681 | *packet_id_ptr = htonl(entry->id); | 681 | *packet_id_ptr = htonl(entry->id); |
| 682 | 682 | ||
| 683 | /* nfnetlink_unicast will either free the nskb or add it to a socket */ | 683 | /* nfnetlink_unicast will either free the nskb or add it to a socket */ |
| 684 | err = nfnetlink_unicast(nskb, net, queue->peer_portid, MSG_DONTWAIT); | 684 | err = nfnetlink_unicast(nskb, net, queue->peer_portid); |
| 685 | if (err < 0) { | 685 | if (err < 0) { |
| 686 | if (queue->flags & NFQA_CFG_F_FAIL_OPEN) { | 686 | if (queue->flags & NFQA_CFG_F_FAIL_OPEN) { |
| 687 | failopen = 1; | 687 | failopen = 1; |
| @@ -102,7 +102,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, · 101 unmodified lines | |||
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) || | 104 | if (nf_ct_ext_exist(ct, NF_CT_EXT_HELPER) || |
| 105 | ct->status & IPS_SEQ_ADJUST) | 105 | ct->status & (IPS_SEQ_ADJUST | IPS_NAT_CLASH)) |
| 106 | goto out; | 106 | goto out; |
| 107 | 107 | ||
| 108 | if (!nf_ct_is_confirmed(ct)) | 108 | if (!nf_ct_is_confirmed(ct)) |
| @@ -87,7 +87,9 @@ void nft_payload_eval(const struct nft_expr *expr, · 86 unmodified lines | |||
| 87 | u32 *dest = ®s->data[priv->dreg]; | 87 | u32 *dest = ®s->data[priv->dreg]; |
| 88 | int offset; | 88 | int offset; |
| 89 | 89 | ||
| 90 | dest[priv->len / NFT_REG32_SIZE] = 0; | 90 | if (priv->len % NFT_REG32_SIZE) |
| 91 | dest[priv->len / NFT_REG32_SIZE] = 0; | ||
| 92 | |||
| 91 | switch (priv->base) { | 93 | switch (priv->base) { |
| 92 | case NFT_PAYLOAD_LL_HEADER: | 94 | case NFT_PAYLOAD_LL_HEADER: |
| 93 | if (!skb_mac_header_was_set(skb)) | 95 | if (!skb_mac_header_was_set(skb)) |
| @@ -218,11 +218,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 217 unmodified lines | |||
| 218 | struct nft_rbtree_elem *new, | 218 | struct nft_rbtree_elem *new, |
| 219 | struct nft_set_ext **ext) | 219 | struct nft_set_ext **ext) |
| 220 | { | 220 | { |
| 221 | bool overlap = false, dup_end_left = false, dup_end_right = false; | ||
| 221 | struct nft_rbtree *priv = nft_set_priv(set); | 222 | struct nft_rbtree *priv = nft_set_priv(set); |
| 222 | u8 genmask = nft_genmask_next(net); | 223 | u8 genmask = nft_genmask_next(net); |
| 223 | struct nft_rbtree_elem *rbe; | 224 | struct nft_rbtree_elem *rbe; |
| 224 | struct rb_node *parent, **p; | 225 | struct rb_node *parent, **p; |
| 225 | bool overlap = false; | ||
| 226 | int d; | 226 | int d; |
| 227 | 227 | ||
| 228 | /* Detect overlaps as we descend the tree. Set the flag in these cases: | 228 | /* Detect overlaps as we descend the tree. Set the flag in these cases: |
| @@ -238,24 +238,44 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 9 unmodified lines | |||
| 238 | * | 238 | * |
| 239 | * b1. _ _ __>| !_ _ __| (insert end before existing start) | 239 | * b1. _ _ __>| !_ _ __| (insert end before existing start) |
| 240 | * b2. _ _ ___| !_ _ _>| (insert end after existing start) | 240 | * b2. _ _ ___| !_ _ _>| (insert end after existing start) |
| 241 | * b3. _ _ ___! >|_ _ __| (insert start after existing end) | 241 | * b3. _ _ ___! >|_ _ __| (insert start after existing end, as a leaf) |
| 242 | * '--' no nodes falling in this range | ||
| 243 | * b4. >|_ _ ! (insert start before existing start) | ||
| 242 | * | 244 | * |
| 243 | * Case a3. resolves to b3.: | 245 | * Case a3. resolves to b3.: |
| 244 | * - if the inserted start element is the leftmost, because the '0' | 246 | * - if the inserted start element is the leftmost, because the '0' |
| 245 | * element in the tree serves as end element | 247 | * element in the tree serves as end element |
| 246 | * - otherwise, if an existing end is found. Note that end elements are | 248 | * - otherwise, if an existing end is found immediately to the left. If |
| 247 | * always inserted after corresponding start elements. | 249 | * there are existing nodes in between, we need to further descend the |
| 250 | * tree before we can conclude the new start isn't causing an overlap | ||
| 251 | * | ||
| 252 | * or to b4., which, preceded by a3., means we already traversed one or | ||
| 253 | * more existing intervals entirely, from the right. | ||
| 248 | * | 254 | * |
| 249 | * For a new, rightmost pair of elements, we'll hit cases b3. and b2., | 255 | * For a new, rightmost pair of elements, we'll hit cases b3. and b2., |
| 250 | * in that order. | 256 | * in that order. |
| 251 | * | 257 | * |
| 252 | * The flag is also cleared in two special cases: | 258 | * The flag is also cleared in two special cases: |
| 253 | * | 259 | * |
| 254 | * b4. |__ _ _!|<_ _ _ (insert start right before existing end) | 260 | * b5. |__ _ _!|<_ _ _ (insert start right before existing end) |
| 255 | * b5. |__ _ >|!__ _ _ (insert end right after existing start) | 261 | * b6. |__ _ >|!__ _ _ (insert end right after existing start) |
| 256 | * | 262 | * |
| 257 | * which always happen as last step and imply that no further | 263 | * which always happen as last step and imply that no further |
| 258 | * overlapping is possible. | 264 | * overlapping is possible. |
| 265 | * | ||
| 266 | * Another special case comes from the fact that start elements matching | ||
| 267 | * an already existing start element are allowed: insertion is not | ||
| 268 | * performed but we return -EEXIST in that case, and the error will be | ||
| 269 | * cleared by the caller if NLM_F_EXCL is not present in the request. | ||
| 270 | * This way, request for insertion of an exact overlap isn't reported as | ||
| 271 | * error to userspace if not desired. | ||
| 272 | * | ||
| 273 | * However, if the existing start matches a pre-existing start, but the | ||
| 274 | * end element doesn't match the corresponding pre-existing end element, | ||
| 275 | * we need to report a partial overlap. This is a local condition that | ||
| 276 | * can be noticed without need for a tracking flag, by checking for a | ||
| 277 | * local duplicated end for a corresponding start, from left and right, | ||
| 278 | * separately. | ||
| 259 | */ | 279 | */ |
| 260 | 280 | ||
| 261 | parent = NULL; | 281 | parent = NULL; |
| @@ -272,26 +292,41 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 10 unmodified lines | |||
| 272 | if (nft_rbtree_interval_start(new)) { | 292 | if (nft_rbtree_interval_start(new)) { |
| 273 | if (nft_rbtree_interval_end(rbe) && | 293 | if (nft_rbtree_interval_end(rbe) && |
| 274 | nft_set_elem_active(&rbe->ext, genmask) && | 294 | nft_set_elem_active(&rbe->ext, genmask) && |
| 275 | !nft_set_elem_expired(&rbe->ext)) | 295 | !nft_set_elem_expired(&rbe->ext) && !*p) |
| 276 | overlap = false; | 296 | overlap = false; |
| 277 | } else { | 297 | } else { |
| 298 | if (dup_end_left && !*p) | ||
| 299 | return -ENOTEMPTY; | ||
| 300 | |||
| 278 | overlap = nft_rbtree_interval_end(rbe) && | 301 | overlap = nft_rbtree_interval_end(rbe) && |
| 279 | nft_set_elem_active(&rbe->ext, | 302 | nft_set_elem_active(&rbe->ext, |
| 280 | genmask) && | 303 | genmask) && |
| 281 | !nft_set_elem_expired(&rbe->ext); | 304 | !nft_set_elem_expired(&rbe->ext); |
| 305 | |||
| 306 | if (overlap) { | ||
| 307 | dup_end_right = true; | ||
| 308 | continue; | ||
| 309 | } | ||
| 282 | } | 310 | } |
| 283 | } else if (d > 0) { | 311 | } else if (d > 0) { |
| 284 | p = &parent->rb_right; | 312 | p = &parent->rb_right; |
| 285 | 313 | ||
| 286 | if (nft_rbtree_interval_end(new)) { | 314 | if (nft_rbtree_interval_end(new)) { |
| 315 | if (dup_end_right && !*p) | ||
| 316 | return -ENOTEMPTY; | ||
| 317 | |||
| 287 | overlap = nft_rbtree_interval_end(rbe) && | 318 | overlap = nft_rbtree_interval_end(rbe) && |
| 288 | nft_set_elem_active(&rbe->ext, | 319 | nft_set_elem_active(&rbe->ext, |
| 289 | genmask) && | 320 | genmask) && |
| 290 | !nft_set_elem_expired(&rbe->ext); | 321 | !nft_set_elem_expired(&rbe->ext); |
| 291 | } else if (nft_rbtree_interval_end(rbe) && | 322 | |
| 292 | nft_set_elem_active(&rbe->ext, genmask) && | 323 | if (overlap) { |
| 324 | dup_end_left = true; | ||
| 325 | continue; | ||
| 326 | } | ||
| 327 | } else if (nft_set_elem_active(&rbe->ext, genmask) && | ||
| 293 | !nft_set_elem_expired(&rbe->ext)) { | 328 | !nft_set_elem_expired(&rbe->ext)) { |
| 294 | overlap = true; | 329 | overlap = nft_rbtree_interval_end(rbe); |
| 295 | } | 330 | } |
| 296 | } else { | 331 | } else { |
| 297 | if (nft_rbtree_interval_end(rbe) && | 332 | if (nft_rbtree_interval_end(rbe) && |
| @@ -316,6 +351,8 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 18 unmodified lines | |||
| 316 | p = &parent->rb_left; | 351 | p = &parent->rb_left; |
| 317 | } | 352 | } |
| 318 | } | 353 | } |
| 354 | |||
| 355 | dup_end_left = dup_end_right = false; | ||
| 319 | } | 356 | } |
| 320 | 357 | ||
| 321 | if (overlap) | 358 | if (overlap) |
| @@ -640,7 +640,7 @@ static void __net_exit recent_proc_net_exit(struct net *net) · 639 unmodified lines | |||
| 640 | struct recent_table *t; | 640 | struct recent_table *t; |
| 641 | 641 | ||
| 642 | /* recent_net_exit() is called before recent_mt_destroy(). Make sure | 642 | /* recent_net_exit() is called before recent_mt_destroy(). Make sure |
| 643 | * that the parent xt_recent proc entry is is empty before trying to | 643 | * that the parent xt_recent proc entry is empty before trying to |
| 644 | * remove it. | 644 | * remove it. |
| 645 | */ | 645 | */ |
| 646 | spin_lock_bh(&recent_lock); | 646 | spin_lock_bh(&recent_lock); |
| @@ -85,6 +85,7 @@ static void netlbl_domhsh_free_entry(struct rcu_head *entry) · 84 unmodified lines | |||
| 85 | kfree(netlbl_domhsh_addr6_entry(iter6)); | 85 | kfree(netlbl_domhsh_addr6_entry(iter6)); |
| 86 | } | 86 | } |
| 87 | #endif /* IPv6 */ | 87 | #endif /* IPv6 */ |
| 88 | kfree(ptr->def.addrsel); | ||
| 88 | } | 89 | } |
| 89 | kfree(ptr->domain); | 90 | kfree(ptr->domain); |
| 90 | kfree(ptr); | 91 | kfree(ptr); |
| @@ -537,6 +538,8 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry, · 446 unmodified lines | |||
| 537 | goto add_return; | 538 | goto add_return; |
| 538 | } | 539 | } |
| 539 | #endif /* IPv6 */ | 540 | #endif /* IPv6 */ |
| 541 | /* cleanup the new entry since we've moved everything over */ | ||
| 542 | netlbl_domhsh_free_entry(&entry->rcu); | ||
| 540 | } else | 543 | } else |
| 541 | ret_val = -EINVAL; | 544 | ret_val = -EINVAL; |
| 542 | 545 | ||
| @@ -580,6 +583,12 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, · 37 unmodified lines | |||
| 580 | { | 583 | { |
| 581 | int ret_val = 0; | 584 | int ret_val = 0; |
| 582 | struct audit_buffer *audit_buf; | 585 | struct audit_buffer *audit_buf; |
| 586 | struct netlbl_af4list *iter4; | ||
| 587 | struct netlbl_domaddr4_map *map4; | ||
| 588 | #if IS_ENABLED(CONFIG_IPV6) | ||
| 589 | struct netlbl_af6list *iter6; | ||
| 590 | struct netlbl_domaddr6_map *map6; | ||
| 591 | #endif /* IPv6 */ | ||
| 583 | 592 | ||
| 584 | if (entry == NULL) | 593 | if (entry == NULL) |
| 585 | return -ENOENT; | 594 | return -ENOENT; |
| @@ -597,6 +606,9 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, · 11 unmodified lines | |||
| 597 | ret_val = -ENOENT; | 606 | ret_val = -ENOENT; |
| 598 | spin_unlock(&netlbl_domhsh_lock); | 607 | spin_unlock(&netlbl_domhsh_lock); |
| 599 | 608 | ||
| 609 | if (ret_val) | ||
| 610 | return ret_val; | ||
| 611 | |||
| 600 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_DEL, audit_info); | 612 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_DEL, audit_info); |
| 601 | if (audit_buf != NULL) { | 613 | if (audit_buf != NULL) { |
| 602 | audit_log_format(audit_buf, | 614 | audit_log_format(audit_buf, |
| @@ -606,40 +618,29 @@ int netlbl_domhsh_remove_entry(struct netlbl_dom_map *entry, · 3 unmodified lines | |||
| 606 | audit_log_end(audit_buf); | 618 | audit_log_end(audit_buf); |
| 607 | } | 619 | } |
| 608 | 620 | ||
| 609 | if (ret_val == 0) { | 621 | switch (entry->def.type) { |
| 610 | struct netlbl_af4list *iter4; | 622 | case NETLBL_NLTYPE_ADDRSELECT: |
| 611 | struct netlbl_domaddr4_map *map4; | 623 | netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) { |
| 612 | #if IS_ENABLED(CONFIG_IPV6) | 624 | map4 = netlbl_domhsh_addr4_entry(iter4); |
| 613 | struct netlbl_af6list *iter6; | 625 | cipso_v4_doi_putdef(map4->def.cipso); |
| 614 | struct netlbl_domaddr6_map *map6; | 626 | } |
| 615 | #endif /* IPv6 */ | ||
| 616 | |||
| 617 | switch (entry->def.type) { | ||
| 618 | case NETLBL_NLTYPE_ADDRSELECT: | ||
| 619 | netlbl_af4list_foreach_rcu(iter4, | ||
| 620 | &entry->def.addrsel->list4) { | ||
| 621 | map4 = netlbl_domhsh_addr4_entry(iter4); | ||
| 622 | cipso_v4_doi_putdef(map4->def.cipso); | ||
| 623 | } | ||
| 624 | #if IS_ENABLED(CONFIG_IPV6) | 627 | #if IS_ENABLED(CONFIG_IPV6) |
| 625 | netlbl_af6list_foreach_rcu(iter6, | 628 | netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) { |
| 626 | &entry->def.addrsel->list6) { | 629 | map6 = netlbl_domhsh_addr6_entry(iter6); |
| 627 | map6 = netlbl_domhsh_addr6_entry(iter6); | 630 | calipso_doi_putdef(map6->def.calipso); |
| 628 | calipso_doi_putdef(map6->def.calipso); | 631 | } |
| 629 | } | ||
| 630 | #endif /* IPv6 */ | 632 | #endif /* IPv6 */ |
| 631 | break; | 633 | break; |
| 632 | case NETLBL_NLTYPE_CIPSOV4: | 634 | case NETLBL_NLTYPE_CIPSOV4: |
| 633 | cipso_v4_doi_putdef(entry->def.cipso); | 635 | cipso_v4_doi_putdef(entry->def.cipso); |
| 634 | break; | 636 | break; |
| 635 | #if IS_ENABLED(CONFIG_IPV6) | 637 | #if IS_ENABLED(CONFIG_IPV6) |
| 636 | case NETLBL_NLTYPE_CALIPSO: | 638 | case NETLBL_NLTYPE_CALIPSO: |
| 637 | calipso_doi_putdef(entry->def.calipso); | 639 | calipso_doi_putdef(entry->def.calipso); |
| 638 | break; | 640 | break; |
| 639 | #endif /* IPv6 */ | 641 | #endif /* IPv6 */ |
| 640 | } | ||
| 641 | call_rcu(&entry->rcu, netlbl_domhsh_free_entry); | ||
| 642 | } | 642 | } |
| 643 | call_rcu(&entry->rcu, netlbl_domhsh_free_entry); | ||
| 643 | 644 | ||
| 644 | return ret_val; | 645 | return ret_val; |
| 645 | } | 646 | } |
| @@ -353,7 +353,7 @@ static void netlink_rcv_wake(struct sock *sk) · 352 unmodified lines | |||
| 353 | { | 353 | { |
| 354 | struct netlink_sock *nlk = nlk_sk(sk); | 354 | struct netlink_sock *nlk = nlk_sk(sk); |
| 355 | 355 | ||
| 356 | if (skb_queue_empty(&sk->sk_receive_queue)) | 356 | if (skb_queue_empty_lockless(&sk->sk_receive_queue)) |
| 357 | clear_bit(NETLINK_S_CONGESTED, &nlk->state); | 357 | clear_bit(NETLINK_S_CONGESTED, &nlk->state); |
| 358 | if (!test_bit(NETLINK_S_CONGESTED, &nlk->state)) | 358 | if (!test_bit(NETLINK_S_CONGESTED, &nlk->state)) |
| 359 | wake_up_interruptible(&nlk->wait); | 359 | wake_up_interruptible(&nlk->wait); |
| @@ -2170,7 +2170,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, · 2169 unmodified lines | |||
| 2170 | int skb_len = skb->len; | 2170 | int skb_len = skb->len; |
| 2171 | unsigned int snaplen, res; | 2171 | unsigned int snaplen, res; |
| 2172 | unsigned long status = TP_STATUS_USER; | 2172 | unsigned long status = TP_STATUS_USER; |
| 2173 | unsigned short macoff, netoff, hdrlen; | 2173 | unsigned short macoff, hdrlen; |
| 2174 | unsigned int netoff; | ||
| 2174 | struct sk_buff *copy_skb = NULL; | 2175 | struct sk_buff *copy_skb = NULL; |
| 2175 | struct timespec64 ts; | 2176 | struct timespec64 ts; |
| 2176 | __u32 ts_status; | 2177 | __u32 ts_status; |
| @@ -2239,6 +2240,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, · 62 unmodified lines | |||
| 2239 | } | 2240 | } |
| 2240 | macoff = netoff - maclen; | 2241 | macoff = netoff - maclen; |
| 2241 | } | 2242 | } |
| 2243 | if (netoff > USHRT_MAX) { | ||
| 2244 | atomic_inc(&po->tp_drops); | ||
| 2245 | goto drop_n_restore; | ||
| 2246 | } | ||
| 2242 | if (po->tp_version <= TPACKET_V2) { | 2247 | if (po->tp_version <= TPACKET_V2) { |
| 2243 | if (macoff + snaplen > po->rx_ring.frame_size) { | 2248 | if (macoff + snaplen > po->rx_ring.frame_size) { |
| 2244 | if (po->copy_thresh && | 2249 | if (po->copy_thresh && |
| @@ -488,7 +488,6 @@ enum rxrpc_call_flag { · 487 unmodified lines | |||
| 488 | RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */ | 488 | RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */ |
| 489 | RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */ | 489 | RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */ |
| 490 | RXRPC_CALL_SEND_PING, /* A ping will need to be sent */ | 490 | RXRPC_CALL_SEND_PING, /* A ping will need to be sent */ |
| 491 | RXRPC_CALL_PINGING, /* Ping in process */ | ||
| 492 | RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ | 491 | RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ |
| 493 | RXRPC_CALL_BEGAN_RX_TIMER, /* We began the expect_rx_by timer */ | 492 | RXRPC_CALL_BEGAN_RX_TIMER, /* We began the expect_rx_by timer */ |
| 494 | RXRPC_CALL_RX_HEARD, /* The peer responded at least once to this call */ | 493 | RXRPC_CALL_RX_HEARD, /* The peer responded at least once to this call */ |
| @@ -673,9 +672,13 @@ struct rxrpc_call { · 178 unmodified lines | |||
| 673 | rxrpc_seq_t ackr_consumed; /* Highest packet shown consumed */ | 672 | rxrpc_seq_t ackr_consumed; /* Highest packet shown consumed */ |
| 674 | rxrpc_seq_t ackr_seen; /* Highest packet shown seen */ | 673 | rxrpc_seq_t ackr_seen; /* Highest packet shown seen */ |
| 675 | 674 | ||
| 676 | /* ping management */ | 675 | /* RTT management */ |
| 677 | rxrpc_serial_t ping_serial; /* Last ping sent */ | 676 | rxrpc_serial_t rtt_serial[4]; /* Serial number of DATA or PING sent */ |
| 678 | ktime_t ping_time; /* Time last ping sent */ | 677 | ktime_t rtt_sent_at[4]; /* Time packet sent */ |
| 678 | unsigned long rtt_avail; /* Mask of available slots in bits 0-3, | ||
| 679 | * Mask of pending samples in 8-11 */ | ||
| 680 | #define RXRPC_CALL_RTT_AVAIL_MASK 0xf | ||
| 681 | #define RXRPC_CALL_RTT_PEND_SHIFT 8 | ||
| 679 | 682 | ||
| 680 | /* transmission-phase ACK management */ | 683 | /* transmission-phase ACK management */ |
| 681 | ktime_t acks_latest_ts; /* Timestamp of latest ACK received */ | 684 | ktime_t acks_latest_ts; /* Timestamp of latest ACK received */ |
| @@ -1037,7 +1040,7 @@ static inline bool __rxrpc_abort_eproto(struct rxrpc_call *call, · 355 unmodified lines | |||
| 1037 | /* | 1040 | /* |
| 1038 | * rtt.c | 1041 | * rtt.c |
| 1039 | */ | 1042 | */ |
| 1040 | void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace, | 1043 | void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace, int, |
| 1041 | rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t); | 1044 | rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t); |
| 1042 | unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *, bool); | 1045 | unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *, bool); |
| 1043 | void rxrpc_peer_init_rtt(struct rxrpc_peer *); | 1046 | void rxrpc_peer_init_rtt(struct rxrpc_peer *); |
| @@ -153,6 +153,7 @@ struct rxrpc_call *rxrpc_alloc_call(struct rxrpc_sock *rx, gfp_t gfp, · 152 unmodified lines | |||
| 153 | call->cong_ssthresh = RXRPC_RXTX_BUFF_SIZE - 1; | 153 | call->cong_ssthresh = RXRPC_RXTX_BUFF_SIZE - 1; |
| 154 | 154 | ||
| 155 | call->rxnet = rxnet; | 155 | call->rxnet = rxnet; |
| 156 | call->rtt_avail = RXRPC_CALL_RTT_AVAIL_MASK; | ||
| 156 | atomic_inc(&rxnet->nr_calls); | 157 | atomic_inc(&rxnet->nr_calls); |
| 157 | return call; | 158 | return call; |
| 158 | 159 | ||
| @@ -608,36 +608,57 @@ unlock: · 607 unmodified lines | |||
| 608 | } | 608 | } |
| 609 | 609 | ||
| 610 | /* | 610 | /* |
| 611 | * Process a requested ACK. | 611 | * See if there's a cached RTT probe to complete. |
| 612 | */ | 612 | */ |
| 613 | static void rxrpc_input_requested_ack(struct rxrpc_call *call, | 613 | static void rxrpc_complete_rtt_probe(struct rxrpc_call *call, |
| 614 | ktime_t resp_time, | 614 | ktime_t resp_time, |
| 615 | rxrpc_serial_t orig_serial, | 615 | rxrpc_serial_t acked_serial, |
| 616 | rxrpc_serial_t ack_serial) | 616 | rxrpc_serial_t ack_serial, |
| 617 | enum rxrpc_rtt_rx_trace type) | ||
| 617 | { | 618 | { |
| 618 | struct rxrpc_skb_priv *sp; | 619 | rxrpc_serial_t orig_serial; |
| 619 | struct sk_buff *skb; | 620 | unsigned long avail; |
| 620 | ktime_t sent_at; | 621 | ktime_t sent_at; |
| 621 | int ix; | 622 | bool matched = false; |
| 623 | int i; | ||
| 622 | 624 | ||
| 623 | for (ix = 0; ix < RXRPC_RXTX_BUFF_SIZE; ix++) { | 625 | avail = READ_ONCE(call->rtt_avail); |
| 624 | skb = call->rxtx_buffer[ix]; | 626 | smp_rmb(); /* Read avail bits before accessing data. */ |
| 625 | if (!skb) | ||
| 626 | continue; | ||
| 627 | 627 | ||
| 628 | sent_at = skb->tstamp; | 628 | for (i = 0; i < ARRAY_SIZE(call->rtt_serial); i++) { |
| 629 | smp_rmb(); /* Read timestamp before serial. */ | 629 | if (!test_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &avail)) |
| 630 | sp = rxrpc_skb(skb); | ||
| 631 | if (sp->hdr.serial != orig_serial) | ||
| 632 | continue; | 630 | continue; |
| 633 | goto found; | ||
| 634 | } | ||
| 635 | 631 | ||
| 636 | return; | 632 | sent_at = call->rtt_sent_at[i]; |
| 633 | orig_serial = call->rtt_serial[i]; | ||
| 634 | |||
| 635 | if (orig_serial == acked_serial) { | ||
| 636 | clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail); | ||
| 637 | smp_mb(); /* Read data before setting avail bit */ | ||
| 638 | set_bit(i, &call->rtt_avail); | ||
| 639 | if (type != rxrpc_rtt_rx_cancel) | ||
| 640 | rxrpc_peer_add_rtt(call, type, i, acked_serial, ack_serial, | ||
| 641 | sent_at, resp_time); | ||
| 642 | else | ||
| 643 | trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_cancel, i, | ||
| 644 | orig_serial, acked_serial, 0, 0); | ||
| 645 | matched = true; | ||
| 646 | } | ||
| 647 | |||
| 648 | /* If a later serial is being acked, then mark this slot as | ||
| 649 | * being available. | ||
| 650 | */ | ||
| 651 | if (after(acked_serial, orig_serial)) { | ||
| 652 | trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_obsolete, i, | ||
| 653 | orig_serial, acked_serial, 0, 0); | ||
| 654 | clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail); | ||
| 655 | smp_wmb(); | ||
| 656 | set_bit(i, &call->rtt_avail); | ||
| 657 | } | ||
| 658 | } | ||
| 637 | 659 | ||
| 638 | found: | 660 | if (!matched) |
| 639 | rxrpc_peer_add_rtt(call, rxrpc_rtt_rx_requested_ack, | 661 | trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_lost, 9, 0, acked_serial, 0, 0); |
| 640 | orig_serial, ack_serial, sent_at, resp_time); | ||
| 641 | } | 662 | } |
| 642 | 663 | ||
| 643 | /* | 664 | /* |
| @@ -682,27 +703,11 @@ static void rxrpc_input_check_for_lost_ack(struct rxrpc_call *call) · 38 unmodified lines | |||
| 682 | */ | 703 | */ |
| 683 | static void rxrpc_input_ping_response(struct rxrpc_call *call, | 704 | static void rxrpc_input_ping_response(struct rxrpc_call *call, |
| 684 | ktime_t resp_time, | 705 | ktime_t resp_time, |
| 685 | rxrpc_serial_t orig_serial, | 706 | rxrpc_serial_t acked_serial, |
| 686 | rxrpc_serial_t ack_serial) | 707 | rxrpc_serial_t ack_serial) |
| 687 | { | 708 | { |
| 688 | rxrpc_serial_t ping_serial; | 709 | if (acked_serial == call->acks_lost_ping) |
| 689 | ktime_t ping_time; | ||
| 690 | |||
| 691 | ping_time = call->ping_time; | ||
| 692 | smp_rmb(); | ||
| 693 | ping_serial = READ_ONCE(call->ping_serial); | ||
| 694 | |||
| 695 | if (orig_serial == call->acks_lost_ping) | ||
| 696 | rxrpc_input_check_for_lost_ack(call); | 710 | rxrpc_input_check_for_lost_ack(call); |
| 697 | |||
| 698 | if (before(orig_serial, ping_serial) || | ||
| 699 | !test_and_clear_bit(RXRPC_CALL_PINGING, &call->flags)) | ||
| 700 | return; | ||
| 701 | if (after(orig_serial, ping_serial)) | ||
| 702 | return; | ||
| 703 | |||
| 704 | rxrpc_peer_add_rtt(call, rxrpc_rtt_rx_ping_response, | ||
| 705 | orig_serial, ack_serial, ping_time, resp_time); | ||
| 706 | } | 711 | } |
| 707 | 712 | ||
| 708 | /* | 713 | /* |
| @@ -843,7 +848,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 134 unmodified lines | |||
| 843 | struct rxrpc_ackinfo info; | 848 | struct rxrpc_ackinfo info; |
| 844 | u8 acks[RXRPC_MAXACKS]; | 849 | u8 acks[RXRPC_MAXACKS]; |
| 845 | } buf; | 850 | } buf; |
| 846 | rxrpc_serial_t acked_serial; | 851 | rxrpc_serial_t ack_serial, acked_serial; |
| 847 | rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt; | 852 | rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt; |
| 848 | int nr_acks, offset, ioffset; | 853 | int nr_acks, offset, ioffset; |
| 849 | 854 | ||
| @@ -856,6 +861,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 6 unmodified lines | |||
| 856 | } | 861 | } |
| 857 | offset += sizeof(buf.ack); | 862 | offset += sizeof(buf.ack); |
| 858 | 863 | ||
| 864 | ack_serial = sp->hdr.serial; | ||
| 859 | acked_serial = ntohl(buf.ack.serial); | 865 | acked_serial = ntohl(buf.ack.serial); |
| 860 | first_soft_ack = ntohl(buf.ack.firstPacket); | 866 | first_soft_ack = ntohl(buf.ack.firstPacket); |
| 861 | prev_pkt = ntohl(buf.ack.previousPacket); | 867 | prev_pkt = ntohl(buf.ack.previousPacket); |
| @@ -864,31 +870,42 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 2 unmodified lines | |||
| 864 | summary.ack_reason = (buf.ack.reason < RXRPC_ACK__INVALID ? | 870 | summary.ack_reason = (buf.ack.reason < RXRPC_ACK__INVALID ? |
| 865 | buf.ack.reason : RXRPC_ACK__INVALID); | 871 | buf.ack.reason : RXRPC_ACK__INVALID); |
| 866 | 872 | ||
| 867 | trace_rxrpc_rx_ack(call, sp->hdr.serial, acked_serial, | 873 | trace_rxrpc_rx_ack(call, ack_serial, acked_serial, |
| 868 | first_soft_ack, prev_pkt, | 874 | first_soft_ack, prev_pkt, |
| 869 | summary.ack_reason, nr_acks); | 875 | summary.ack_reason, nr_acks); |
| 870 | 876 | ||
| 871 | if (buf.ack.reason == RXRPC_ACK_PING_RESPONSE) | 877 | switch (buf.ack.reason) { |
| 878 | case RXRPC_ACK_PING_RESPONSE: | ||
| 872 | rxrpc_input_ping_response(call, skb->tstamp, acked_serial, | 879 | rxrpc_input_ping_response(call, skb->tstamp, acked_serial, |
| 873 | sp->hdr.serial); | 880 | ack_serial); |
| 874 | if (buf.ack.reason == RXRPC_ACK_REQUESTED) | 881 | rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, |
| 875 | rxrpc_input_requested_ack(call, skb->tstamp, acked_serial, | 882 | rxrpc_rtt_rx_ping_response); |
| 876 | sp->hdr.serial); | 883 | break; |
| 884 | case RXRPC_ACK_REQUESTED: | ||
| 885 | rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, | ||
| 886 | rxrpc_rtt_rx_requested_ack); | ||
| 887 | break; | ||
| 888 | default: | ||
| 889 | if (acked_serial != 0) | ||
| 890 | rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, | ||
| 891 | rxrpc_rtt_rx_cancel); | ||
| 892 | break; | ||
| 893 | } | ||
| 877 | 894 | ||
| 878 | if (buf.ack.reason == RXRPC_ACK_PING) { | 895 | if (buf.ack.reason == RXRPC_ACK_PING) { |
| 879 | _proto("Rx ACK %%%u PING Request", sp->hdr.serial); | 896 | _proto("Rx ACK %%%u PING Request", ack_serial); |
| 880 | rxrpc_propose_ACK(call, RXRPC_ACK_PING_RESPONSE, | 897 | rxrpc_propose_ACK(call, RXRPC_ACK_PING_RESPONSE, |
| 881 | sp->hdr.serial, true, true, | 898 | ack_serial, true, true, |
| 882 | rxrpc_propose_ack_respond_to_ping); | 899 | rxrpc_propose_ack_respond_to_ping); |
| 883 | } else if (sp->hdr.flags & RXRPC_REQUEST_ACK) { | 900 | } else if (sp->hdr.flags & RXRPC_REQUEST_ACK) { |
| 884 | rxrpc_propose_ACK(call, RXRPC_ACK_REQUESTED, | 901 | rxrpc_propose_ACK(call, RXRPC_ACK_REQUESTED, |
| 885 | sp->hdr.serial, true, true, | 902 | ack_serial, true, true, |
| 886 | rxrpc_propose_ack_respond_to_ack); | 903 | rxrpc_propose_ack_respond_to_ack); |
| 887 | } | 904 | } |
| 888 | 905 | ||
| 889 | /* Discard any out-of-order or duplicate ACKs (outside lock). */ | 906 | /* Discard any out-of-order or duplicate ACKs (outside lock). */ |
| 890 | if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) { | 907 | if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) { |
| 891 | trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial, | 908 | trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial, |
| 892 | first_soft_ack, call->ackr_first_seq, | 909 | first_soft_ack, call->ackr_first_seq, |
| 893 | prev_pkt, call->ackr_prev_seq); | 910 | prev_pkt, call->ackr_prev_seq); |
| 894 | return; | 911 | return; |
| @@ -904,7 +921,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 9 unmodified lines | |||
| 904 | 921 | ||
| 905 | /* Discard any out-of-order or duplicate ACKs (inside lock). */ | 922 | /* Discard any out-of-order or duplicate ACKs (inside lock). */ |
| 906 | if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) { | 923 | if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) { |
| 907 | trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial, | 924 | trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial, |
| 908 | first_soft_ack, call->ackr_first_seq, | 925 | first_soft_ack, call->ackr_first_seq, |
| 909 | prev_pkt, call->ackr_prev_seq); | 926 | prev_pkt, call->ackr_prev_seq); |
| 910 | goto out; | 927 | goto out; |
| @@ -964,7 +981,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) · 53 unmodified lines | |||
| 964 | RXRPC_TX_ANNO_LAST && | 981 | RXRPC_TX_ANNO_LAST && |
| 965 | summary.nr_acks == call->tx_top - hard_ack && | 982 | summary.nr_acks == call->tx_top - hard_ack && |
| 966 | rxrpc_is_client_call(call)) | 983 | rxrpc_is_client_call(call)) |
| 967 | rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial, | 984 | rxrpc_propose_ACK(call, RXRPC_ACK_PING, ack_serial, |
| 968 | false, true, | 985 | false, true, |
| 969 | rxrpc_propose_ack_ping_for_lost_reply); | 986 | rxrpc_propose_ack_ping_for_lost_reply); |
| 970 | 987 | ||
| @@ -123,6 +123,49 @@ static size_t rxrpc_fill_out_ack(struct rxrpc_connection *conn, · 122 unmodified lines | |||
| 123 | return top - hard_ack + 3; | 123 | return top - hard_ack + 3; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | /* | ||
| 127 | * Record the beginning of an RTT probe. | ||
| 128 | */ | ||
| 129 | static int rxrpc_begin_rtt_probe(struct rxrpc_call *call, rxrpc_serial_t serial, | ||
| 130 | enum rxrpc_rtt_tx_trace why) | ||
| 131 | { | ||
| 132 | unsigned long avail = call->rtt_avail; | ||
| 133 | int rtt_slot = 9; | ||
| 134 | |||
| 135 | if (!(avail & RXRPC_CALL_RTT_AVAIL_MASK)) | ||
| 136 | goto no_slot; | ||
| 137 | |||
| 138 | rtt_slot = __ffs(avail & RXRPC_CALL_RTT_AVAIL_MASK); | ||
| 139 | if (!test_and_clear_bit(rtt_slot, &call->rtt_avail)) | ||
| 140 | goto no_slot; | ||
| 141 | |||
| 142 | call->rtt_serial[rtt_slot] = serial; | ||
| 143 | call->rtt_sent_at[rtt_slot] = ktime_get_real(); | ||
| 144 | smp_wmb(); /* Write data before avail bit */ | ||
| 145 | set_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail); | ||
| 146 | |||
| 147 | trace_rxrpc_rtt_tx(call, why, rtt_slot, serial); | ||
| 148 | return rtt_slot; | ||
| 149 | |||
| 150 | no_slot: | ||
| 151 | trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_no_slot, rtt_slot, serial); | ||
| 152 | return -1; | ||
| 153 | } | ||
| 154 | |||
| 155 | /* | ||
| 156 | * Cancel an RTT probe. | ||
| 157 | */ | ||
| 158 | static void rxrpc_cancel_rtt_probe(struct rxrpc_call *call, | ||
| 159 | rxrpc_serial_t serial, int rtt_slot) | ||
| 160 | { | ||
| 161 | if (rtt_slot != -1) { | ||
| 162 | clear_bit(rtt_slot + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail); | ||
| 163 | smp_wmb(); /* Clear pending bit before setting slot */ | ||
| 164 | set_bit(rtt_slot, &call->rtt_avail); | ||
| 165 | trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_cancel, rtt_slot, serial); | ||
| 166 | } | ||
| 167 | } | ||
| 168 | |||
| 126 | /* | 169 | /* |
| 127 | * Send an ACK call packet. | 170 | * Send an ACK call packet. |
| 128 | */ | 171 | */ |
| @@ -136,7 +179,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, · 7 unmodified lines | |||
| 136 | rxrpc_serial_t serial; | 179 | rxrpc_serial_t serial; |
| 137 | rxrpc_seq_t hard_ack, top; | 180 | rxrpc_seq_t hard_ack, top; |
| 138 | size_t len, n; | 181 | size_t len, n; |
| 139 | int ret; | 182 | int ret, rtt_slot = -1; |
| 140 | u8 reason; | 183 | u8 reason; |
| 141 | 184 | ||
| 142 | if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) | 185 | if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) |
| @@ -196,18 +239,8 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, · 53 unmodified lines | |||
| 196 | if (_serial) | 239 | if (_serial) |
| 197 | *_serial = serial; | 240 | *_serial = serial; |
| 198 | 241 | ||
| 199 | if (ping) { | 242 | if (ping) |
| 200 | call->ping_serial = serial; | 243 | rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_ping); |
| 201 | smp_wmb(); | ||
| 202 | /* We need to stick a time in before we send the packet in case | ||
| 203 | * the reply gets back before kernel_sendmsg() completes - but | ||
| 204 | * asking UDP to send the packet can take a relatively long | ||
| 205 | * time. | ||
| 206 | */ | ||
| 207 | call->ping_time = ktime_get_real(); | ||
| 208 | set_bit(RXRPC_CALL_PINGING, &call->flags); | ||
| 209 | trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_ping, serial); | ||
| 210 | } | ||
| 211 | 244 | ||
| 212 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); | 245 | ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); |
| 213 | conn->params.peer->last_tx_at = ktime_get_seconds(); | 246 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
| @@ -221,8 +254,7 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, · 7 unmodified lines | |||
| 221 | 254 | ||
| 222 | if (call->state < RXRPC_CALL_COMPLETE) { | 255 | if (call->state < RXRPC_CALL_COMPLETE) { |
| 223 | if (ret < 0) { | 256 | if (ret < 0) { |
| 224 | if (ping) | 257 | rxrpc_cancel_rtt_probe(call, serial, rtt_slot); |
| 225 | clear_bit(RXRPC_CALL_PINGING, &call->flags); | ||
| 226 | rxrpc_propose_ACK(call, pkt->ack.reason, | 258 | rxrpc_propose_ACK(call, pkt->ack.reason, |
| 227 | ntohl(pkt->ack.serial), | 259 | ntohl(pkt->ack.serial), |
| 228 | false, true, | 260 | false, true, |
| @@ -321,7 +353,7 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, · 92 unmodified lines | |||
| 321 | struct kvec iov[2]; | 353 | struct kvec iov[2]; |
| 322 | rxrpc_serial_t serial; | 354 | rxrpc_serial_t serial; |
| 323 | size_t len; | 355 | size_t len; |
| 324 | int ret; | 356 | int ret, rtt_slot = -1; |
| 325 | 357 | ||
| 326 | _enter(",{%d}", skb->len); | 358 | _enter(",{%d}", skb->len); |
| 327 | 359 | ||
| @@ -397,6 +429,8 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, · 69 unmodified lines | |||
| 397 | sp->hdr.serial = serial; | 429 | sp->hdr.serial = serial; |
| 398 | smp_wmb(); /* Set serial before timestamp */ | 430 | smp_wmb(); /* Set serial before timestamp */ |
| 399 | skb->tstamp = ktime_get_real(); | 431 | skb->tstamp = ktime_get_real(); |
| 432 | if (whdr.flags & RXRPC_REQUEST_ACK) | ||
| 433 | rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data); | ||
| 400 | 434 | ||
| 401 | /* send the packet by UDP | 435 | /* send the packet by UDP |
| 402 | * - returns -EMSGSIZE if UDP would have to fragment the packet | 436 | * - returns -EMSGSIZE if UDP would have to fragment the packet |
| @@ -408,12 +442,15 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb, · 5 unmodified lines | |||
| 408 | conn->params.peer->last_tx_at = ktime_get_seconds(); | 442 | conn->params.peer->last_tx_at = ktime_get_seconds(); |
| 409 | 443 | ||
| 410 | up_read(&conn->params.local->defrag_sem); | 444 | up_read(&conn->params.local->defrag_sem); |
| 411 | if (ret < 0) | 445 | if (ret < 0) { |
| 446 | rxrpc_cancel_rtt_probe(call, serial, rtt_slot); | ||
| 412 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, | 447 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, |
| 413 | rxrpc_tx_point_call_data_nofrag); | 448 | rxrpc_tx_point_call_data_nofrag); |
| 414 | else | 449 | } else { |
| 415 | trace_rxrpc_tx_packet(call->debug_id, &whdr, | 450 | trace_rxrpc_tx_packet(call->debug_id, &whdr, |
| 416 | rxrpc_tx_point_call_data_nofrag); | 451 | rxrpc_tx_point_call_data_nofrag); |
| 452 | } | ||
| 453 | |||
| 417 | rxrpc_tx_backoff(call, ret); | 454 | rxrpc_tx_backoff(call, ret); |
| 418 | if (ret == -EMSGSIZE) | 455 | if (ret == -EMSGSIZE) |
| 419 | goto send_fragmentable; | 456 | goto send_fragmentable; |
| @@ -422,7 +459,6 @@ done: · 2 unmodified lines | |||
| 422 | if (ret >= 0) { | 459 | if (ret >= 0) { |
| 423 | if (whdr.flags & RXRPC_REQUEST_ACK) { | 460 | if (whdr.flags & RXRPC_REQUEST_ACK) { |
| 424 | call->peer->rtt_last_req = skb->tstamp; | 461 | call->peer->rtt_last_req = skb->tstamp; |
| 425 | trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial); | ||
| 426 | if (call->peer->rtt_count > 1) { | 462 | if (call->peer->rtt_count > 1) { |
| 427 | unsigned long nowj = jiffies, ack_lost_at; | 463 | unsigned long nowj = jiffies, ack_lost_at; |
| 428 | 464 | ||
| @@ -469,6 +505,8 @@ send_fragmentable: · 40 unmodified lines | |||
| 469 | sp->hdr.serial = serial; | 505 | sp->hdr.serial = serial; |
| 470 | smp_wmb(); /* Set serial before timestamp */ | 506 | smp_wmb(); /* Set serial before timestamp */ |
| 471 | skb->tstamp = ktime_get_real(); | 507 | skb->tstamp = ktime_get_real(); |
| 508 | if (whdr.flags & RXRPC_REQUEST_ACK) | ||
| 509 | rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data); | ||
| 472 | 510 | ||
| 473 | switch (conn->params.local->srx.transport.family) { | 511 | switch (conn->params.local->srx.transport.family) { |
| 474 | case AF_INET6: | 512 | case AF_INET6: |
| @@ -487,12 +525,14 @@ send_fragmentable: · 12 unmodified lines | |||
| 487 | BUG(); | 525 | BUG(); |
| 488 | } | 526 | } |
| 489 | 527 | ||
| 490 | if (ret < 0) | 528 | if (ret < 0) { |
| 529 | rxrpc_cancel_rtt_probe(call, serial, rtt_slot); | ||
| 491 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, | 530 | trace_rxrpc_tx_fail(call->debug_id, serial, ret, |
| 492 | rxrpc_tx_point_call_data_frag); | 531 | rxrpc_tx_point_call_data_frag); |
| 493 | else | 532 | } else { |
| 494 | trace_rxrpc_tx_packet(call->debug_id, &whdr, | 533 | trace_rxrpc_tx_packet(call->debug_id, &whdr, |
| 495 | rxrpc_tx_point_call_data_frag); | 534 | rxrpc_tx_point_call_data_frag); |
| 535 | } | ||
| 496 | rxrpc_tx_backoff(call, ret); | 536 | rxrpc_tx_backoff(call, ret); |
| 497 | 537 | ||
| 498 | up_write(&conn->params.local->defrag_sem); | 538 | up_write(&conn->params.local->defrag_sem); |
| @@ -502,11 +502,21 @@ EXPORT_SYMBOL(rxrpc_kernel_get_peer); · 501 unmodified lines | |||
| 502 | * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT | 502 | * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT |
| 503 | * @sock: The socket on which the call is in progress. | 503 | * @sock: The socket on which the call is in progress. |
| 504 | * @call: The call to query | 504 | * @call: The call to query |
| 505 | * @_srtt: Where to store the SRTT value. | ||
| 505 | * | 506 | * |
| 506 | * Get the call's peer smoothed RTT. | 507 | * Get the call's peer smoothed RTT in uS. |
| 507 | */ | 508 | */ |
| 508 | u32 rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call) | 509 | bool rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call, |
| 510 | u32 *_srtt) | ||
| 509 | { | 511 | { |
| 510 | return call->peer->srtt_us >> 3; | 512 | struct rxrpc_peer *peer = call->peer; |
| 513 | |||
| 514 | if (peer->rtt_count == 0) { | ||
| 515 | *_srtt = 1000000; /* 1S */ | ||
| 516 | return false; | ||
| 517 | } | ||
| 518 | |||
| 519 | *_srtt = call->peer->srtt_us >> 3; | ||
| 520 | return true; | ||
| 511 | } | 521 | } |
| 512 | EXPORT_SYMBOL(rxrpc_kernel_get_srtt); | 522 | EXPORT_SYMBOL(rxrpc_kernel_get_srtt); |
| @@ -146,6 +146,7 @@ static void rxrpc_ack_update_rtt(struct rxrpc_peer *peer, long rtt_us) · 145 unmodified lines | |||
| 146 | * exclusive access to the peer RTT data. | 146 | * exclusive access to the peer RTT data. |
| 147 | */ | 147 | */ |
| 148 | void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, | 148 | void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, |
| 149 | int rtt_slot, | ||
| 149 | rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial, | 150 | rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial, |
| 150 | ktime_t send_time, ktime_t resp_time) | 151 | ktime_t send_time, ktime_t resp_time) |
| 151 | { | 152 | { |
| @@ -162,7 +163,7 @@ void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, · 10 unmodified lines | |||
| 162 | peer->rtt_count++; | 163 | peer->rtt_count++; |
| 163 | spin_unlock(&peer->rtt_input_lock); | 164 | spin_unlock(&peer->rtt_input_lock); |
| 164 | 165 | ||
| 165 | trace_rxrpc_rtt_rx(call, why, send_serial, resp_serial, | 166 | trace_rxrpc_rtt_rx(call, why, rtt_slot, send_serial, resp_serial, |
| 166 | peer->srtt_us >> 3, peer->rto_j); | 167 | peer->srtt_us >> 3, peer->rto_j); |
| 167 | } | 168 | } |
| 168 | 169 | ||
| @@ -1137,7 +1137,7 @@ static int rxkad_verify_response(struct rxrpc_connection *conn, · 1136 unmodified lines | |||
| 1137 | ret = -ENOMEM; | 1137 | ret = -ENOMEM; |
| 1138 | ticket = kmalloc(ticket_len, GFP_NOFS); | 1138 | ticket = kmalloc(ticket_len, GFP_NOFS); |
| 1139 | if (!ticket) | 1139 | if (!ticket) |
| 1140 | goto temporary_error; | 1140 | goto temporary_error_free_resp; |
| 1141 | 1141 | ||
| 1142 | eproto = tracepoint_string("rxkad_tkt_short"); | 1142 | eproto = tracepoint_string("rxkad_tkt_short"); |
| 1143 | abort_code = RXKADPACKETSHORT; | 1143 | abort_code = RXKADPACKETSHORT; |
| @@ -1230,6 +1230,7 @@ protocol_error: · 86 unmodified lines | |||
| 1230 | 1230 | ||
| 1231 | temporary_error_free_ticket: | 1231 | temporary_error_free_ticket: |
| 1232 | kfree(ticket); | 1232 | kfree(ticket); |
| 1233 | temporary_error_free_resp: | ||
| 1233 | kfree(response); | 1234 | kfree(response); |
| 1234 | temporary_error: | 1235 | temporary_error: |
| 1235 | /* Ignore the response packet if we got a temporary error such as | 1236 | /* Ignore the response packet if we got a temporary error such as |
| @@ -353,23 +353,11 @@ static int red_init(struct Qdisc *sch, struct nlattr *opt, · 352 unmodified lines | |||
| 353 | FLOW_BLOCK_BINDER_TYPE_RED_EARLY_DROP, | 353 | FLOW_BLOCK_BINDER_TYPE_RED_EARLY_DROP, |
| 354 | tb[TCA_RED_EARLY_DROP_BLOCK], extack); | 354 | tb[TCA_RED_EARLY_DROP_BLOCK], extack); |
| 355 | if (err) | 355 | if (err) |
| 356 | goto err_early_drop_init; | 356 | return err; |
| 357 | |||
| 358 | err = tcf_qevent_init(&q->qe_mark, sch, | ||
| 359 | FLOW_BLOCK_BINDER_TYPE_RED_MARK, | ||
| 360 | tb[TCA_RED_MARK_BLOCK], extack); | ||
| 361 | if (err) | ||
| 362 | goto err_mark_init; | ||
| 363 | |||
| 364 | return 0; | ||
| 365 | 357 | ||
| 366 | err_mark_init: | 358 | return tcf_qevent_init(&q->qe_mark, sch, |
| 367 | tcf_qevent_destroy(&q->qe_early_drop, sch); | 359 | FLOW_BLOCK_BINDER_TYPE_RED_MARK, |
| 368 | err_early_drop_init: | 360 | tb[TCA_RED_MARK_BLOCK], extack); |
| 369 | del_timer_sync(&q->adapt_timer); | ||
| 370 | red_offload(sch, false); | ||
| 371 | qdisc_put(q->qdisc); | ||
| 372 | return err; | ||
| 373 | } | 361 | } |
| 374 | 362 | ||
| 375 | static int red_change(struct Qdisc *sch, struct nlattr *opt, | 363 | static int red_change(struct Qdisc *sch, struct nlattr *opt, |
| @@ -1176,9 +1176,27 @@ static void taprio_offload_config_changed(struct taprio_sched *q) · 1175 unmodified lines | |||
| 1176 | spin_unlock(&q->current_entry_lock); | 1176 | spin_unlock(&q->current_entry_lock); |
| 1177 | } | 1177 | } |
| 1178 | 1178 | ||
| 1179 | static void taprio_sched_to_offload(struct taprio_sched *q, | 1179 | static u32 tc_map_to_queue_mask(struct net_device *dev, u32 tc_mask) |
| 1180 | { | ||
| 1181 | u32 i, queue_mask = 0; | ||
| 1182 | |||
| 1183 | for (i = 0; i < dev->num_tc; i++) { | ||
| 1184 | u32 offset, count; | ||
| 1185 | |||
| 1186 | if (!(tc_mask & BIT(i))) | ||
| 1187 | continue; | ||
| 1188 | |||
| 1189 | offset = dev->tc_to_txq[i].offset; | ||
| 1190 | count = dev->tc_to_txq[i].count; | ||
| 1191 | |||
| 1192 | queue_mask |= GENMASK(offset + count - 1, offset); | ||
| 1193 | } | ||
| 1194 | |||
| 1195 | return queue_mask; | ||
| 1196 | } | ||
| 1197 | |||
| 1198 | static void taprio_sched_to_offload(struct net_device *dev, | ||
| 1180 | struct sched_gate_list *sched, | 1199 | struct sched_gate_list *sched, |
| 1181 | const struct tc_mqprio_qopt *mqprio, | ||
| 1182 | struct tc_taprio_qopt_offload *offload) | 1200 | struct tc_taprio_qopt_offload *offload) |
| 1183 | { | 1201 | { |
| 1184 | struct sched_entry *entry; | 1202 | struct sched_entry *entry; |
| @@ -1193,7 +1211,8 @@ static void taprio_sched_to_offload(struct taprio_sched *q, · 8 unmodified lines | |||
| 1193 | 1211 | ||
| 1194 | e->command = entry->command; | 1212 | e->command = entry->command; |
| 1195 | e->interval = entry->interval; | 1213 | e->interval = entry->interval; |
| 1196 | e->gate_mask = entry->gate_mask; | 1214 | e->gate_mask = tc_map_to_queue_mask(dev, entry->gate_mask); |
| 1215 | |||
| 1197 | i++; | 1216 | i++; |
| 1198 | } | 1217 | } |
| 1199 | 1218 | ||
| @@ -1201,7 +1220,6 @@ static void taprio_sched_to_offload(struct taprio_sched *q, · 1 unmodified line | |||
| 1201 | } | 1220 | } |
| 1202 | 1221 | ||
| 1203 | static int taprio_enable_offload(struct net_device *dev, | 1222 | static int taprio_enable_offload(struct net_device *dev, |
| 1204 | struct tc_mqprio_qopt *mqprio, | ||
| 1205 | struct taprio_sched *q, | 1223 | struct taprio_sched *q, |
| 1206 | struct sched_gate_list *sched, | 1224 | struct sched_gate_list *sched, |
| 1207 | struct netlink_ext_ack *extack) | 1225 | struct netlink_ext_ack *extack) |
| @@ -1223,7 +1241,7 @@ static int taprio_enable_offload(struct net_device *dev, · 15 unmodified lines | |||
| 1223 | return -ENOMEM; | 1241 | return -ENOMEM; |
| 1224 | } | 1242 | } |
| 1225 | offload->enable = 1; | 1243 | offload->enable = 1; |
| 1226 | taprio_sched_to_offload(q, sched, mqprio, offload); | 1244 | taprio_sched_to_offload(dev, sched, offload); |
| 1227 | 1245 | ||
| 1228 | err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_TAPRIO, offload); | 1246 | err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_TAPRIO, offload); |
| 1229 | if (err < 0) { | 1247 | if (err < 0) { |
| @@ -1485,7 +1503,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, · 255 unmodified lines | |||
| 1485 | } | 1503 | } |
| 1486 | 1504 | ||
| 1487 | if (FULL_OFFLOAD_IS_ENABLED(q->flags)) | 1505 | if (FULL_OFFLOAD_IS_ENABLED(q->flags)) |
| 1488 | err = taprio_enable_offload(dev, mqprio, q, new_admin, extack); | 1506 | err = taprio_enable_offload(dev, q, new_admin, extack); |
| 1489 | else | 1507 | else |
| 1490 | err = taprio_disable_offload(dev, q, extack); | 1508 | err = taprio_disable_offload(dev, q, extack); |
| 1491 | if (err) | 1509 | if (err) |
| @@ -8060,8 +8060,6 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr) · 8059 unmodified lines | |||
| 8060 | 8060 | ||
| 8061 | pr_debug("%s: begins, snum:%d\n", __func__, snum); | 8061 | pr_debug("%s: begins, snum:%d\n", __func__, snum); |
| 8062 | 8062 | ||
| 8063 | local_bh_disable(); | ||
| 8064 | |||
| 8065 | if (snum == 0) { | 8063 | if (snum == 0) { |
| 8066 | /* Search for an available port. */ | 8064 | /* Search for an available port. */ |
| 8067 | int low, high, remaining, index; | 8065 | int low, high, remaining, index; |
| @@ -8079,20 +8077,21 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr) · 11 unmodified lines | |||
| 8079 | continue; | 8077 | continue; |
| 8080 | index = sctp_phashfn(net, rover); | 8078 | index = sctp_phashfn(net, rover); |
| 8081 | head = &sctp_port_hashtable[index]; | 8079 | head = &sctp_port_hashtable[index]; |
| 8082 | spin_lock(&head->lock); | 8080 | spin_lock_bh(&head->lock); |
| 8083 | sctp_for_each_hentry(pp, &head->chain) | 8081 | sctp_for_each_hentry(pp, &head->chain) |
| 8084 | if ((pp->port == rover) && | 8082 | if ((pp->port == rover) && |
| 8085 | net_eq(net, pp->net)) | 8083 | net_eq(net, pp->net)) |
| 8086 | goto next; | 8084 | goto next; |
| 8087 | break; | 8085 | break; |
| 8088 | next: | 8086 | next: |
| 8089 | spin_unlock(&head->lock); | 8087 | spin_unlock_bh(&head->lock); |
| 8088 | cond_resched(); | ||
| 8090 | } while (--remaining > 0); | 8089 | } while (--remaining > 0); |
| 8091 | 8090 | ||
| 8092 | /* Exhausted local port range during search? */ | 8091 | /* Exhausted local port range during search? */ |
| 8093 | ret = 1; | 8092 | ret = 1; |
| 8094 | if (remaining <= 0) | 8093 | if (remaining <= 0) |
| 8095 | goto fail; | 8094 | return ret; |
| 8096 | 8095 | ||
| 8097 | /* OK, here is the one we will use. HEAD (the port | 8096 | /* OK, here is the one we will use. HEAD (the port |
| 8098 | * hash table list entry) is non-NULL and we hold it's | 8097 | * hash table list entry) is non-NULL and we hold it's |
| @@ -8107,7 +8106,7 @@ static int sctp_get_port_local(struct sock *sk, union sctp_addr *addr) · 8 unmodified lines | |||
| 8107 | * port iterator, pp being NULL. | 8106 | * port iterator, pp being NULL. |
| 8108 | */ | 8107 | */ |
| 8109 | head = &sctp_port_hashtable[sctp_phashfn(net, snum)]; | 8108 | head = &sctp_port_hashtable[sctp_phashfn(net, snum)]; |
| 8110 | spin_lock(&head->lock); | 8109 | spin_lock_bh(&head->lock); |
| 8111 | sctp_for_each_hentry(pp, &head->chain) { | 8110 | sctp_for_each_hentry(pp, &head->chain) { |
| 8112 | if ((pp->port == snum) && net_eq(pp->net, net)) | 8111 | if ((pp->port == snum) && net_eq(pp->net, net)) |
| 8113 | goto pp_found; | 8112 | goto pp_found; |
| @@ -8207,10 +8206,7 @@ success: · 93 unmodified lines | |||
| 8207 | ret = 0; | 8206 | ret = 0; |
| 8208 | 8207 | ||
| 8209 | fail_unlock: | 8208 | fail_unlock: |
| 8210 | spin_unlock(&head->lock); | 8209 | spin_unlock_bh(&head->lock); |
| 8211 | |||
| 8212 | fail: | ||
| 8213 | local_bh_enable(); | ||
| 8214 | return ret; | 8210 | return ret; |
| 8215 | } | 8211 | } |
| 8216 | 8212 | ||
| @@ -116,7 +116,6 @@ static void smc_close_cancel_work(struct smc_sock *smc) · 115 unmodified lines | |||
| 116 | cancel_work_sync(&smc->conn.close_work); | 116 | cancel_work_sync(&smc->conn.close_work); |
| 117 | cancel_delayed_work_sync(&smc->conn.tx_work); | 117 | cancel_delayed_work_sync(&smc->conn.tx_work); |
| 118 | lock_sock(sk); | 118 | lock_sock(sk); |
| 119 | sk->sk_state = SMC_CLOSED; | ||
| 120 | } | 119 | } |
| 121 | 120 | ||
| 122 | /* terminate smc socket abnormally - active abort | 121 | /* terminate smc socket abnormally - active abort |
| @@ -134,22 +133,22 @@ void smc_close_active_abort(struct smc_sock *smc) · 11 unmodified lines | |||
| 134 | } | 133 | } |
| 135 | switch (sk->sk_state) { | 134 | switch (sk->sk_state) { |
| 136 | case SMC_ACTIVE: | 135 | case SMC_ACTIVE: |
| 137 | sk->sk_state = SMC_PEERABORTWAIT; | ||
| 138 | smc_close_cancel_work(smc); | ||
| 139 | sk->sk_state = SMC_CLOSED; | ||
| 140 | sock_put(sk); /* passive closing */ | ||
| 141 | break; | ||
| 142 | case SMC_APPCLOSEWAIT1: | 136 | case SMC_APPCLOSEWAIT1: |
| 143 | case SMC_APPCLOSEWAIT2: | 137 | case SMC_APPCLOSEWAIT2: |
| 138 | sk->sk_state = SMC_PEERABORTWAIT; | ||
| 144 | smc_close_cancel_work(smc); | 139 | smc_close_cancel_work(smc); |
| 140 | if (sk->sk_state != SMC_PEERABORTWAIT) | ||
| 141 | break; | ||
| 145 | sk->sk_state = SMC_CLOSED; | 142 | sk->sk_state = SMC_CLOSED; |
| 146 | sock_put(sk); /* postponed passive closing */ | 143 | sock_put(sk); /* (postponed) passive closing */ |
| 147 | break; | 144 | break; |
| 148 | case SMC_PEERCLOSEWAIT1: | 145 | case SMC_PEERCLOSEWAIT1: |
| 149 | case SMC_PEERCLOSEWAIT2: | 146 | case SMC_PEERCLOSEWAIT2: |
| 150 | case SMC_PEERFINCLOSEWAIT: | 147 | case SMC_PEERFINCLOSEWAIT: |
| 151 | sk->sk_state = SMC_PEERABORTWAIT; | 148 | sk->sk_state = SMC_PEERABORTWAIT; |
| 152 | smc_close_cancel_work(smc); | 149 | smc_close_cancel_work(smc); |
| 150 | if (sk->sk_state != SMC_PEERABORTWAIT) | ||
| 151 | break; | ||
| 153 | sk->sk_state = SMC_CLOSED; | 152 | sk->sk_state = SMC_CLOSED; |
| 154 | smc_conn_free(&smc->conn); | 153 | smc_conn_free(&smc->conn); |
| 155 | release_clcsock = true; | 154 | release_clcsock = true; |
| @@ -159,6 +158,8 @@ void smc_close_active_abort(struct smc_sock *smc) · 3 unmodified lines | |||
| 159 | case SMC_APPFINCLOSEWAIT: | 158 | case SMC_APPFINCLOSEWAIT: |
| 160 | sk->sk_state = SMC_PEERABORTWAIT; | 159 | sk->sk_state = SMC_PEERABORTWAIT; |
| 161 | smc_close_cancel_work(smc); | 160 | smc_close_cancel_work(smc); |
| 161 | if (sk->sk_state != SMC_PEERABORTWAIT) | ||
| 162 | break; | ||
| 162 | sk->sk_state = SMC_CLOSED; | 163 | sk->sk_state = SMC_CLOSED; |
| 163 | smc_conn_free(&smc->conn); | 164 | smc_conn_free(&smc->conn); |
| 164 | release_clcsock = true; | 165 | release_clcsock = true; |
| @@ -1356,6 +1356,8 @@ create: · 1355 unmodified lines | |||
| 1356 | if (ini->is_smcd) { | 1356 | if (ini->is_smcd) { |
| 1357 | conn->rx_off = sizeof(struct smcd_cdc_msg); | 1357 | conn->rx_off = sizeof(struct smcd_cdc_msg); |
| 1358 | smcd_cdc_rx_init(conn); /* init tasklet for this conn */ | 1358 | smcd_cdc_rx_init(conn); /* init tasklet for this conn */ |
| 1359 | } else { | ||
| 1360 | conn->rx_off = 0; | ||
| 1359 | } | 1361 | } |
| 1360 | #ifndef KERNEL_HAS_ATOMIC64 | 1362 | #ifndef KERNEL_HAS_ATOMIC64 |
| 1361 | spin_lock_init(&conn->acurs_lock); | 1363 | spin_lock_init(&conn->acurs_lock); |
| @@ -1777,6 +1779,7 @@ int smc_buf_create(struct smc_sock *smc, bool is_smcd) · 415 unmodified lines | |||
| 1777 | list_del(&smc->conn.sndbuf_desc->list); | 1779 | list_del(&smc->conn.sndbuf_desc->list); |
| 1778 | mutex_unlock(&smc->conn.lgr->sndbufs_lock); | 1780 | mutex_unlock(&smc->conn.lgr->sndbufs_lock); |
| 1779 | smc_buf_free(smc->conn.lgr, false, smc->conn.sndbuf_desc); | 1781 | smc_buf_free(smc->conn.lgr, false, smc->conn.sndbuf_desc); |
| 1782 | smc->conn.sndbuf_desc = NULL; | ||
| 1780 | } | 1783 | } |
| 1781 | return rc; | 1784 | return rc; |
| 1782 | } | 1785 | } |
| @@ -841,6 +841,9 @@ int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry) · 840 unmodified lines | |||
| 841 | struct smc_init_info ini; | 841 | struct smc_init_info ini; |
| 842 | int lnk_idx, rc = 0; | 842 | int lnk_idx, rc = 0; |
| 843 | 843 | ||
| 844 | if (!llc->qp_mtu) | ||
| 845 | goto out_reject; | ||
| 846 | |||
| 844 | ini.vlan_id = lgr->vlan_id; | 847 | ini.vlan_id = lgr->vlan_id; |
| 845 | smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev); | 848 | smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev); |
| 846 | if (!memcmp(llc->sender_gid, link->peer_gid, SMC_GID_SIZE) && | 849 | if (!memcmp(llc->sender_gid, link->peer_gid, SMC_GID_SIZE) && |
| @@ -917,10 +920,20 @@ out: · 70 unmodified lines | |||
| 917 | kfree(qentry); | 920 | kfree(qentry); |
| 918 | } | 921 | } |
| 919 | 922 | ||
| 923 | static bool smc_llc_is_empty_llc_message(union smc_llc_msg *llc) | ||
| 924 | { | ||
| 925 | int i; | ||
| 926 | |||
| 927 | for (i = 0; i < ARRAY_SIZE(llc->raw.data); i++) | ||
| 928 | if (llc->raw.data[i]) | ||
| 929 | return false; | ||
| 930 | return true; | ||
| 931 | } | ||
| 932 | |||
| 920 | static bool smc_llc_is_local_add_link(union smc_llc_msg *llc) | 933 | static bool smc_llc_is_local_add_link(union smc_llc_msg *llc) |
| 921 | { | 934 | { |
| 922 | if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK && | 935 | if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK && |
| 923 | !llc->add_link.qp_mtu && !llc->add_link.link_num) | 936 | smc_llc_is_empty_llc_message(llc)) |
| 924 | return true; | 937 | return true; |
| 925 | return false; | 938 | return false; |
| 926 | } | 939 | } |
| @@ -3610,7 +3610,7 @@ int kernel_getsockname(struct socket *sock, struct sockaddr *addr) · 3609 unmodified lines | |||
| 3610 | EXPORT_SYMBOL(kernel_getsockname); | 3610 | EXPORT_SYMBOL(kernel_getsockname); |
| 3611 | 3611 | ||
| 3612 | /** | 3612 | /** |
| 3613 | * kernel_peername - get the address which the socket is connected (kernel space) | 3613 | * kernel_getpeername - get the address which the socket is connected (kernel space) |
| 3614 | * @sock: socket | 3614 | * @sock: socket |
| 3615 | * @addr: address holder | 3615 | * @addr: address holder |
| 3616 | * | 3616 | * |
| @@ -3671,7 +3671,7 @@ int kernel_sendpage_locked(struct sock *sk, struct page *page, int offset, · 54 unmodified lines | |||
| 3671 | EXPORT_SYMBOL(kernel_sendpage_locked); | 3671 | EXPORT_SYMBOL(kernel_sendpage_locked); |
| 3672 | 3672 | ||
| 3673 | /** | 3673 | /** |
| 3674 | * kernel_shutdown - shut down part of a full-duplex connection (kernel space) | 3674 | * kernel_sock_shutdown - shut down part of a full-duplex connection (kernel space) |
| 3675 | * @sock: socket | 3675 | * @sock: socket |
| 3676 | * @how: connection part | 3676 | * @how: connection part |
| 3677 | * | 3677 | * |
| @@ -982,8 +982,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, · 981 unmodified lines | |||
| 982 | p = xdr_inline_decode(xdr, len); | 982 | p = xdr_inline_decode(xdr, len); |
| 983 | if (unlikely(p == NULL)) | 983 | if (unlikely(p == NULL)) |
| 984 | goto out_fail; | 984 | goto out_fail; |
| 985 | dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid, | 985 | dprintk("RPC: %5u RPCB_%s reply: %*pE\n", req->rq_task->tk_pid, |
| 986 | req->rq_task->tk_msg.rpc_proc->p_name, (char *)p); | 986 | req->rq_task->tk_msg.rpc_proc->p_name, len, (char *)p); |
| 987 | 987 | ||
| 988 | if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len, | 988 | if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len, |
| 989 | sap, sizeof(address)) == 0) | 989 | sap, sizeof(address)) == 0) |
| @@ -933,6 +933,8 @@ static void rpcrdma_req_reset(struct rpcrdma_req *req) · 932 unmodified lines | |||
| 933 | 933 | ||
| 934 | rpcrdma_regbuf_dma_unmap(req->rl_sendbuf); | 934 | rpcrdma_regbuf_dma_unmap(req->rl_sendbuf); |
| 935 | rpcrdma_regbuf_dma_unmap(req->rl_recvbuf); | 935 | rpcrdma_regbuf_dma_unmap(req->rl_recvbuf); |
| 936 | |||
| 937 | frwr_reset(req); | ||
| 936 | } | 938 | } |
| 937 | 939 | ||
| 938 | /* ASSUMPTION: the rb_allreqs list is stable for the duration, | 940 | /* ASSUMPTION: the rb_allreqs list is stable for the duration, |
| @@ -326,7 +326,8 @@ static void tipc_aead_free(struct rcu_head *rp) · 325 unmodified lines | |||
| 326 | if (aead->cloned) { | 326 | if (aead->cloned) { |
| 327 | tipc_aead_put(aead->cloned); | 327 | tipc_aead_put(aead->cloned); |
| 328 | } else { | 328 | } else { |
| 329 | head = *this_cpu_ptr(aead->tfm_entry); | 329 | head = *get_cpu_ptr(aead->tfm_entry); |
| 330 | put_cpu_ptr(aead->tfm_entry); | ||
| 330 | list_for_each_entry_safe(tfm_entry, tmp, &head->list, list) { | 331 | list_for_each_entry_safe(tfm_entry, tmp, &head->list, list) { |
| 331 | crypto_free_aead(tfm_entry->tfm); | 332 | crypto_free_aead(tfm_entry->tfm); |
| 332 | list_del(&tfm_entry->list); | 333 | list_del(&tfm_entry->list); |
| @@ -399,10 +400,15 @@ static void tipc_aead_users_set(struct tipc_aead __rcu *aead, int val) · 66 unmodified lines | |||
| 399 | */ | 400 | */ |
| 400 | static struct crypto_aead *tipc_aead_tfm_next(struct tipc_aead *aead) | 401 | static struct crypto_aead *tipc_aead_tfm_next(struct tipc_aead *aead) |
| 401 | { | 402 | { |
| 402 | struct tipc_tfm **tfm_entry = this_cpu_ptr(aead->tfm_entry); | 403 | struct tipc_tfm **tfm_entry; |
| 404 | struct crypto_aead *tfm; | ||
| 403 | 405 | ||
| 406 | tfm_entry = get_cpu_ptr(aead->tfm_entry); | ||
| 404 | *tfm_entry = list_next_entry(*tfm_entry, list); | 407 | *tfm_entry = list_next_entry(*tfm_entry, list); |
| 405 | return (*tfm_entry)->tfm; | 408 | tfm = (*tfm_entry)->tfm; |
| 409 | put_cpu_ptr(tfm_entry); | ||
| 410 | |||
| 411 | return tfm; | ||
| 406 | } | 412 | } |
| 407 | 413 | ||
| 408 | /** | 414 | /** |
| @@ -2771,18 +2771,21 @@ static int tipc_shutdown(struct socket *sock, int how) · 2770 unmodified lines | |||
| 2771 | 2771 | ||
| 2772 | trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " "); | 2772 | trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " "); |
| 2773 | __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN); | 2773 | __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN); |
| 2774 | sk->sk_shutdown = SEND_SHUTDOWN; | 2774 | if (tipc_sk_type_connectionless(sk)) |
| 2775 | sk->sk_shutdown = SHUTDOWN_MASK; | ||
| 2776 | else | ||
| 2777 | sk->sk_shutdown = SEND_SHUTDOWN; | ||
| 2775 | 2778 | ||
| 2776 | if (sk->sk_state == TIPC_DISCONNECTING) { | 2779 | if (sk->sk_state == TIPC_DISCONNECTING) { |
| 2777 | /* Discard any unreceived messages */ | 2780 | /* Discard any unreceived messages */ |
| 2778 | __skb_queue_purge(&sk->sk_receive_queue); | 2781 | __skb_queue_purge(&sk->sk_receive_queue); |
| 2779 | 2782 | ||
| 2780 | /* Wake up anyone sleeping in poll */ | ||
| 2781 | sk->sk_state_change(sk); | ||
| 2782 | res = 0; | 2783 | res = 0; |
| 2783 | } else { | 2784 | } else { |
| 2784 | res = -ENOTCONN; | 2785 | res = -ENOTCONN; |
| 2785 | } | 2786 | } |
| 2787 | /* Wake up anyone sleeping in poll. */ | ||
| 2788 | sk->sk_state_change(sk); | ||
| 2786 | 2789 | ||
| 2787 | release_sock(sk); | 2790 | release_sock(sk); |
| 2788 | return res; | 2791 | return res; |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | |||
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/export.h> | 12 | #include <linux/export.h> |
| 13 | #include <linux/bitfield.h> | ||
| 13 | #include <net/cfg80211.h> | 14 | #include <net/cfg80211.h> |
| 14 | #include "core.h" | 15 | #include "core.h" |
| 15 | #include "rdev-ops.h" | 16 | #include "rdev-ops.h" |
| @@ -912,6 +913,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, · 896 unmodified lines | |||
| 912 | struct ieee80211_sta_vht_cap *vht_cap; | 913 | struct ieee80211_sta_vht_cap *vht_cap; |
| 913 | struct ieee80211_edmg *edmg_cap; | 914 | struct ieee80211_edmg *edmg_cap; |
| 914 | u32 width, control_freq, cap; | 915 | u32 width, control_freq, cap; |
| 916 | bool support_80_80 = false; | ||
| 915 | 917 | ||
| 916 | if (WARN_ON(!cfg80211_chandef_valid(chandef))) | 918 | if (WARN_ON(!cfg80211_chandef_valid(chandef))) |
| 917 | return false; | 919 | return false; |
| @@ -979,9 +981,13 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, · 61 unmodified lines | |||
| 979 | return false; | 981 | return false; |
| 980 | break; | 982 | break; |
| 981 | case NL80211_CHAN_WIDTH_80P80: | 983 | case NL80211_CHAN_WIDTH_80P80: |
| 982 | cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; | 984 | cap = vht_cap->cap; |
| 983 | if (chandef->chan->band != NL80211_BAND_6GHZ && | 985 | support_80_80 = |
| 984 | cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) | 986 | (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) || |
| 987 | (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && | ||
| 988 | cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) || | ||
| 989 | u32_get_bits(cap, IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) > 1; | ||
| 990 | if (chandef->chan->band != NL80211_BAND_6GHZ && !support_80_80) | ||
| 985 | return false; | 991 | return false; |
| 986 | fallthrough; | 992 | fallthrough; |
| 987 | case NL80211_CHAN_WIDTH_80: | 993 | case NL80211_CHAN_WIDTH_80: |
| @@ -1001,7 +1007,8 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy, · 13 unmodified lines | |||
| 1001 | return false; | 1007 | return false; |
| 1002 | cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; | 1008 | cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; |
| 1003 | if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && | 1009 | if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && |
| 1004 | cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) | 1010 | cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ && |
| 1011 | !(vht_cap->cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK)) | ||
| 1005 | return false; | 1012 | return false; |
| 1006 | break; | 1013 | break; |
| 1007 | default: | 1014 | default: |
| @@ -6011,7 +6011,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) · 6010 unmodified lines | |||
| 6011 | 6011 | ||
| 6012 | if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]) | 6012 | if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]) |
| 6013 | params.he_6ghz_capa = | 6013 | params.he_6ghz_capa = |
| 6014 | nla_data(info->attrs[NL80211_ATTR_HE_CAPABILITY]); | 6014 | nla_data(info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]); |
| 6015 | 6015 | ||
| 6016 | if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]) | 6016 | if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]) |
| 6017 | params.airtime_weight = | 6017 | params.airtime_weight = |
| @@ -2946,6 +2946,9 @@ int regulatory_hint_user(const char *alpha2, · 2945 unmodified lines | |||
| 2946 | if (WARN_ON(!alpha2)) | 2946 | if (WARN_ON(!alpha2)) |
| 2947 | return -EINVAL; | 2947 | return -EINVAL; |
| 2948 | 2948 | ||
| 2949 | if (!is_world_regdom(alpha2) && !is_an_alpha2(alpha2)) | ||
| 2950 | return -EINVAL; | ||
| 2951 | |||
| 2949 | request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); | 2952 | request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); |
| 2950 | if (!request) | 2953 | if (!request) |
| 2951 | return -ENOMEM; | 2954 | return -ENOMEM; |
| @@ -123,11 +123,13 @@ int ieee80211_freq_khz_to_channel(u32 freq) · 122 unmodified lines | |||
| 123 | return (freq - 2407) / 5; | 123 | return (freq - 2407) / 5; |
| 124 | else if (freq >= 4910 && freq <= 4980) | 124 | else if (freq >= 4910 && freq <= 4980) |
| 125 | return (freq - 4000) / 5; | 125 | return (freq - 4000) / 5; |
| 126 | else if (freq < 5945) | 126 | else if (freq < 5925) |
| 127 | return (freq - 5000) / 5; | 127 | return (freq - 5000) / 5; |
| 128 | else if (freq == 5935) | ||
| 129 | return 2; | ||
| 128 | else if (freq <= 45000) /* DMG band lower limit */ | 130 | else if (freq <= 45000) /* DMG band lower limit */ |
| 129 | /* see 802.11ax D4.1 27.3.22.2 */ | 131 | /* see 802.11ax D6.1 27.3.22.2 */ |
| 130 | return (freq - 5940) / 5; | 132 | return (freq - 5950) / 5; |
| 131 | else if (freq >= 58320 && freq <= 70200) | 133 | else if (freq >= 58320 && freq <= 70200) |
| 132 | return (freq - 56160) / 2160; | 134 | return (freq - 56160) / 2160; |
| 133 | else | 135 | else |
| @@ -2639,8 +2639,8 @@ sub process { · 2638 unmodified lines | |||
| 2639 | 2639 | ||
| 2640 | # Check if the commit log has what seems like a diff which can confuse patch | 2640 | # Check if the commit log has what seems like a diff which can confuse patch |
| 2641 | if ($in_commit_log && !$commit_log_has_diff && | 2641 | if ($in_commit_log && !$commit_log_has_diff && |
| 2642 | (($line =~ m@^\s+diff\b.*a/[\w/]+@ && | 2642 | (($line =~ m@^\s+diff\b.*a/([\w/]+)@ && |
| 2643 | $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) || | 2643 | $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) || |
| 2644 | $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ || | 2644 | $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ || |
| 2645 | $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) { | 2645 | $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) { |
| 2646 | ERROR("DIFF_IN_COMMIT_MSG", | 2646 | ERROR("DIFF_IN_COMMIT_MSG", |
| @@ -755,7 +755,6 @@ static void build_conf(struct menu *menu) · 754 unmodified lines | |||
| 755 | switch (ptype) { | 755 | switch (ptype) { |
| 756 | case P_MENU: | 756 | case P_MENU: |
| 757 | child_count++; | 757 | child_count++; |
| 758 | prompt = prompt; | ||
| 759 | if (single_menu_mode) { | 758 | if (single_menu_mode) { |
| 760 | item_make(menu, 'm', | 759 | item_make(menu, 'm', |
| 761 | "%s%*c%s", | 760 | "%s%*c%s", |
| @@ -593,7 +593,10 @@ while ($repeat) { · 592 unmodified lines | |||
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | my %setconfigs; | 595 | my %setconfigs; |
| 596 | my @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP}); | 596 | my @preserved_kconfigs; |
| 597 | if (defined($ENV{'LMC_KEEP'})) { | ||
| 598 | @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP}); | ||
| 599 | } | ||
| 597 | 600 | ||
| 598 | sub in_preserved_kconfigs { | 601 | sub in_preserved_kconfigs { |
| 599 | my $kconfig = $config2kfile{$_[0]}; | 602 | my $kconfig = $config2kfile{$_[0]}; |
| @@ -26,7 +26,11 @@ else · 25 unmodified lines | |||
| 26 | fi | 26 | fi |
| 27 | 27 | ||
| 28 | # ignore userspace tools | 28 | # ignore userspace tools |
| 29 | ignore="$ignore ( -path ${tree}tools ) -prune -o" | 29 | if [ -n "$COMPILED_SOURCE" ]; then |
| 30 | ignore="$ignore ( -path ./tools ) -prune -o" | ||
| 31 | else | ||
| 32 | ignore="$ignore ( -path ${tree}tools ) -prune -o" | ||
| 33 | fi | ||
| 30 | 34 | ||
| 31 | # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH | 35 | # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH |
| 32 | if [ "${ALLSOURCE_ARCHS}" = "" ]; then | 36 | if [ "${ALLSOURCE_ARCHS}" = "" ]; then |
| @@ -92,7 +96,7 @@ all_sources() · 59 unmodified lines | |||
| 92 | all_compiled_sources() | 96 | all_compiled_sources() |
| 93 | { | 97 | { |
| 94 | realpath -es $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) \ | 98 | realpath -es $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) \ |
| 95 | include/generated/autoconf.h $(find -name "*.cmd" -exec \ | 99 | include/generated/autoconf.h $(find $ignore -name "*.cmd" -exec \ |
| 96 | grep -Poh '(?(?=^source_.* \K).*|(?=^ \K\S).*(?= \\))' {} \+ | | 100 | grep -Poh '(?(?=^source_.* \K).*|(?=^ \K\S).*(?= \\))' {} \+ | |
| 97 | awk '!a[$0]++') | sort -u | 101 | awk '!a[$0]++') | sort -u |
| 98 | } | 102 | } |
| @@ -329,8 +329,8 @@ int snd_pcm_plugin_build_mulaw(struct snd_pcm_substream *plug, · 328 unmodified lines | |||
| 329 | snd_BUG(); | 329 | snd_BUG(); |
| 330 | return -EINVAL; | 330 | return -EINVAL; |
| 331 | } | 331 | } |
| 332 | if (snd_BUG_ON(!snd_pcm_format_linear(format->format))) | 332 | if (!snd_pcm_format_linear(format->format)) |
| 333 | return -ENXIO; | 333 | return -EINVAL; |
| 334 | 334 | ||
| 335 | err = snd_pcm_plugin_build(plug, "Mu-Law<->linear conversion", | 335 | err = snd_pcm_plugin_build(plug, "Mu-Law<->linear conversion", |
| 336 | src_format, dst_format, | 336 | src_format, dst_format, |
| @@ -816,9 +816,9 @@ static void snd_timer_clear_callbacks(struct snd_timer *timer, · 815 unmodified lines | |||
| 816 | * timer tasklet | 816 | * timer tasklet |
| 817 | * | 817 | * |
| 818 | */ | 818 | */ |
| 819 | static void snd_timer_tasklet(unsigned long arg) | 819 | static void snd_timer_tasklet(struct tasklet_struct *t) |
| 820 | { | 820 | { |
| 821 | struct snd_timer *timer = (struct snd_timer *) arg; | 821 | struct snd_timer *timer = from_tasklet(timer, t, task_queue); |
| 822 | unsigned long flags; | 822 | unsigned long flags; |
| 823 | 823 | ||
| 824 | if (timer->card && timer->card->shutdown) { | 824 | if (timer->card && timer->card->shutdown) { |
| @@ -967,8 +967,7 @@ int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, · 142 unmodified lines | |||
| 967 | INIT_LIST_HEAD(&timer->ack_list_head); | 967 | INIT_LIST_HEAD(&timer->ack_list_head); |
| 968 | INIT_LIST_HEAD(&timer->sack_list_head); | 968 | INIT_LIST_HEAD(&timer->sack_list_head); |
| 969 | spin_lock_init(&timer->lock); | 969 | spin_lock_init(&timer->lock); |
| 970 | tasklet_init(&timer->task_queue, snd_timer_tasklet, | 970 | tasklet_setup(&timer->task_queue, snd_timer_tasklet); |
| 971 | (unsigned long)timer); | ||
| 972 | timer->max_instances = 1000; /* default limit per timer */ | 971 | timer->max_instances = 1000; /* default limit per timer */ |
| 973 | if (card != NULL) { | 972 | if (card != NULL) { |
| 974 | timer->module = card->module; | 973 | timer->module = card->module; |
| @@ -64,7 +64,7 @@ · 63 unmodified lines | |||
| 64 | #define IT_PKT_HEADER_SIZE_CIP 8 // For 2 CIP header. | 64 | #define IT_PKT_HEADER_SIZE_CIP 8 // For 2 CIP header. |
| 65 | #define IT_PKT_HEADER_SIZE_NO_CIP 0 // Nothing. | 65 | #define IT_PKT_HEADER_SIZE_NO_CIP 0 // Nothing. |
| 66 | 66 | ||
| 67 | static void pcm_period_tasklet(unsigned long data); | 67 | static void pcm_period_tasklet(struct tasklet_struct *t); |
| 68 | 68 | ||
| 69 | /** | 69 | /** |
| 70 | * amdtp_stream_init - initialize an AMDTP stream structure | 70 | * amdtp_stream_init - initialize an AMDTP stream structure |
| @@ -94,7 +94,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, · 23 unmodified lines | |||
| 94 | s->flags = flags; | 94 | s->flags = flags; |
| 95 | s->context = ERR_PTR(-1); | 95 | s->context = ERR_PTR(-1); |
| 96 | mutex_init(&s->mutex); | 96 | mutex_init(&s->mutex); |
| 97 | tasklet_init(&s->period_tasklet, pcm_period_tasklet, (unsigned long)s); | 97 | tasklet_setup(&s->period_tasklet, pcm_period_tasklet); |
| 98 | s->packet_index = 0; | 98 | s->packet_index = 0; |
| 99 | 99 | ||
| 100 | init_waitqueue_head(&s->callback_wait); | 100 | init_waitqueue_head(&s->callback_wait); |
| @@ -441,9 +441,9 @@ static void update_pcm_pointers(struct amdtp_stream *s, · 340 unmodified lines | |||
| 441 | } | 441 | } |
| 442 | } | 442 | } |
| 443 | 443 | ||
| 444 | static void pcm_period_tasklet(unsigned long data) | 444 | static void pcm_period_tasklet(struct tasklet_struct *t) |
| 445 | { | 445 | { |
| 446 | struct amdtp_stream *s = (void *)data; | 446 | struct amdtp_stream *s = from_tasklet(s, t, period_tasklet); |
| 447 | struct snd_pcm_substream *pcm = READ_ONCE(s->pcm); | 447 | struct snd_pcm_substream *pcm = READ_ONCE(s->pcm); |
| 448 | 448 | ||
| 449 | if (pcm) | 449 | if (pcm) |
| @@ -14,6 +14,7 @@ MODULE_LICENSE("GPL v2"); · 13 unmodified lines | |||
| 14 | #define VENDOR_DIGIDESIGN 0x00a07e | 14 | #define VENDOR_DIGIDESIGN 0x00a07e |
| 15 | #define MODEL_CONSOLE 0x000001 | 15 | #define MODEL_CONSOLE 0x000001 |
| 16 | #define MODEL_RACK 0x000002 | 16 | #define MODEL_RACK 0x000002 |
| 17 | #define SPEC_VERSION 0x000001 | ||
| 17 | 18 | ||
| 18 | static int name_card(struct snd_dg00x *dg00x) | 19 | static int name_card(struct snd_dg00x *dg00x) |
| 19 | { | 20 | { |
| @@ -175,14 +176,18 @@ static const struct ieee1394_device_id snd_dg00x_id_table[] = { · 155 unmodified lines | |||
| 175 | /* Both of 002/003 use the same ID. */ | 176 | /* Both of 002/003 use the same ID. */ |
| 176 | { | 177 | { |
| 177 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | 178 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 179 | IEEE1394_MATCH_VERSION | | ||
| 178 | IEEE1394_MATCH_MODEL_ID, | 180 | IEEE1394_MATCH_MODEL_ID, |
| 179 | .vendor_id = VENDOR_DIGIDESIGN, | 181 | .vendor_id = VENDOR_DIGIDESIGN, |
| 182 | .version = SPEC_VERSION, | ||
| 180 | .model_id = MODEL_CONSOLE, | 183 | .model_id = MODEL_CONSOLE, |
| 181 | }, | 184 | }, |
| 182 | { | 185 | { |
| 183 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | 186 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 187 | IEEE1394_MATCH_VERSION | | ||
| 184 | IEEE1394_MATCH_MODEL_ID, | 188 | IEEE1394_MATCH_MODEL_ID, |
| 185 | .vendor_id = VENDOR_DIGIDESIGN, | 189 | .vendor_id = VENDOR_DIGIDESIGN, |
| 190 | .version = SPEC_VERSION, | ||
| 186 | .model_id = MODEL_RACK, | 191 | .model_id = MODEL_RACK, |
| 187 | }, | 192 | }, |
| 188 | {} | 193 | {} |
| @@ -39,9 +39,6 @@ static const struct snd_tscm_spec model_specs[] = { · 38 unmodified lines | |||
| 39 | .midi_capture_ports = 2, | 39 | .midi_capture_ports = 2, |
| 40 | .midi_playback_ports = 4, | 40 | .midi_playback_ports = 4, |
| 41 | }, | 41 | }, |
| 42 | // This kernel module doesn't support FE-8 because the most of features | ||
| 43 | // can be implemented in userspace without any specific support of this | ||
| 44 | // module. | ||
| 45 | }; | 42 | }; |
| 46 | 43 | ||
| 47 | static int identify_model(struct snd_tscm *tscm) | 44 | static int identify_model(struct snd_tscm *tscm) |
| @@ -211,11 +208,39 @@ static void snd_tscm_remove(struct fw_unit *unit) · 163 unmodified lines | |||
| 211 | } | 208 | } |
| 212 | 209 | ||
| 213 | static const struct ieee1394_device_id snd_tscm_id_table[] = { | 210 | static const struct ieee1394_device_id snd_tscm_id_table[] = { |
| 211 | // Tascam, FW-1884. | ||
| 212 | { | ||
| 213 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | ||
| 214 | IEEE1394_MATCH_SPECIFIER_ID | | ||
| 215 | IEEE1394_MATCH_VERSION, | ||
| 216 | .vendor_id = 0x00022e, | ||
| 217 | .specifier_id = 0x00022e, | ||
| 218 | .version = 0x800000, | ||
| 219 | }, | ||
| 220 | // Tascam, FE-8 (.version = 0x800001) | ||
| 221 | // This kernel module doesn't support FE-8 because the most of features | ||
| 222 | // can be implemented in userspace without any specific support of this | ||
| 223 | // module. | ||
| 224 | // | ||
| 225 | // .version = 0x800002 is unknown. | ||
| 226 | // | ||
| 227 | // Tascam, FW-1082. | ||
| 228 | { | ||
| 229 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | ||
| 230 | IEEE1394_MATCH_SPECIFIER_ID | | ||
| 231 | IEEE1394_MATCH_VERSION, | ||
| 232 | .vendor_id = 0x00022e, | ||
| 233 | .specifier_id = 0x00022e, | ||
| 234 | .version = 0x800003, | ||
| 235 | }, | ||
| 236 | // Tascam, FW-1804. | ||
| 214 | { | 237 | { |
| 215 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | 238 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 216 | IEEE1394_MATCH_SPECIFIER_ID, | 239 | IEEE1394_MATCH_SPECIFIER_ID | |
| 240 | IEEE1394_MATCH_VERSION, | ||
| 217 | .vendor_id = 0x00022e, | 241 | .vendor_id = 0x00022e, |
| 218 | .specifier_id = 0x00022e, | 242 | .specifier_id = 0x00022e, |
| 243 | .version = 0x800004, | ||
| 219 | }, | 244 | }, |
| 220 | {} | 245 | {} |
| 221 | }; | 246 | }; |
| @@ -127,6 +127,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_init); · 126 unmodified lines | |||
| 127 | void snd_hdac_device_exit(struct hdac_device *codec) | 127 | void snd_hdac_device_exit(struct hdac_device *codec) |
| 128 | { | 128 | { |
| 129 | pm_runtime_put_noidle(&codec->dev); | 129 | pm_runtime_put_noidle(&codec->dev); |
| 130 | /* keep balance of runtime PM child_count in parent device */ | ||
| 131 | pm_runtime_set_suspended(&codec->dev); | ||
| 130 | snd_hdac_bus_remove_device(codec->bus, codec); | 132 | snd_hdac_bus_remove_device(codec->bus, codec); |
| 131 | kfree(codec->vendor_name); | 133 | kfree(codec->vendor_name); |
| 132 | kfree(codec->chip_name); | 134 | kfree(codec->chip_name); |
| @@ -54,7 +54,7 @@ static const struct config_entry config_table[] = { · 53 unmodified lines | |||
| 54 | #endif | 54 | #endif |
| 55 | /* | 55 | /* |
| 56 | * Apollolake (Broxton-P) | 56 | * Apollolake (Broxton-P) |
| 57 | * the legacy HDaudio driver is used except on Up Squared (SOF) and | 57 | * the legacy HDAudio driver is used except on Up Squared (SOF) and |
| 58 | * Chromebooks (SST) | 58 | * Chromebooks (SST) |
| 59 | */ | 59 | */ |
| 60 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) | 60 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) |
| @@ -89,7 +89,7 @@ static const struct config_entry config_table[] = { · 28 unmodified lines | |||
| 89 | }, | 89 | }, |
| 90 | #endif | 90 | #endif |
| 91 | /* | 91 | /* |
| 92 | * Skylake and Kabylake use legacy HDaudio driver except for Google | 92 | * Skylake and Kabylake use legacy HDAudio driver except for Google |
| 93 | * Chromebooks (SST) | 93 | * Chromebooks (SST) |
| 94 | */ | 94 | */ |
| 95 | 95 | ||
| @@ -135,7 +135,7 @@ static const struct config_entry config_table[] = { · 39 unmodified lines | |||
| 135 | #endif | 135 | #endif |
| 136 | 136 | ||
| 137 | /* | 137 | /* |
| 138 | * Geminilake uses legacy HDaudio driver except for Google | 138 | * Geminilake uses legacy HDAudio driver except for Google |
| 139 | * Chromebooks | 139 | * Chromebooks |
| 140 | */ | 140 | */ |
| 141 | /* Geminilake */ | 141 | /* Geminilake */ |
| @@ -157,7 +157,7 @@ static const struct config_entry config_table[] = { · 15 unmodified lines | |||
| 157 | 157 | ||
| 158 | /* | 158 | /* |
| 159 | * CoffeeLake, CannonLake, CometLake, IceLake, TigerLake use legacy | 159 | * CoffeeLake, CannonLake, CometLake, IceLake, TigerLake use legacy |
| 160 | * HDaudio driver except for Google Chromebooks and when DMICs are | 160 | * HDAudio driver except for Google Chromebooks and when DMICs are |
| 161 | * present. Two cases are required since Coreboot does not expose NHLT | 161 | * present. Two cases are required since Coreboot does not expose NHLT |
| 162 | * tables. | 162 | * tables. |
| 163 | * | 163 | * |
| @@ -391,7 +391,7 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci) · 227 unmodified lines | |||
| 391 | if (pci->class == 0x040300) | 391 | if (pci->class == 0x040300) |
| 392 | return SND_INTEL_DSP_DRIVER_LEGACY; | 392 | return SND_INTEL_DSP_DRIVER_LEGACY; |
| 393 | if (pci->class != 0x040100 && pci->class != 0x040380) { | 393 | if (pci->class != 0x040100 && pci->class != 0x040380) { |
| 394 | dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDA legacy driver\n", pci->class); | 394 | dev_err(&pci->dev, "Unknown PCI class/subclass/prog-if information (0x%06x) found, selecting HDAudio legacy driver\n", pci->class); |
| 395 | return SND_INTEL_DSP_DRIVER_LEGACY; | 395 | return SND_INTEL_DSP_DRIVER_LEGACY; |
| 396 | } | 396 | } |
| 397 | 397 | ||
| @@ -921,10 +921,10 @@ static void snd_card_asihpi_timer_function(struct timer_list *t) · 920 unmodified lines | |||
| 921 | add_timer(&dpcm->timer); | 921 | add_timer(&dpcm->timer); |
| 922 | } | 922 | } |
| 923 | 923 | ||
| 924 | static void snd_card_asihpi_int_task(unsigned long data) | 924 | static void snd_card_asihpi_int_task(struct tasklet_struct *t) |
| 925 | { | 925 | { |
| 926 | struct hpi_adapter *a = (struct hpi_adapter *)data; | 926 | struct snd_card_asihpi *asihpi = from_tasklet(asihpi, t, t); |
| 927 | struct snd_card_asihpi *asihpi; | 927 | struct hpi_adapter *a = asihpi->hpi; |
| 928 | 928 | ||
| 929 | WARN_ON(!a || !a->snd_card || !a->snd_card->private_data); | 929 | WARN_ON(!a || !a->snd_card || !a->snd_card->private_data); |
| 930 | asihpi = (struct snd_card_asihpi *)a->snd_card->private_data; | 930 | asihpi = (struct snd_card_asihpi *)a->snd_card->private_data; |
| @@ -2871,8 +2871,7 @@ static int snd_asihpi_probe(struct pci_dev *pci_dev, · 1940 unmodified lines | |||
| 2871 | if (hpi->interrupt_mode) { | 2871 | if (hpi->interrupt_mode) { |
| 2872 | asihpi->pcm_start = snd_card_asihpi_pcm_int_start; | 2872 | asihpi->pcm_start = snd_card_asihpi_pcm_int_start; |
| 2873 | asihpi->pcm_stop = snd_card_asihpi_pcm_int_stop; | 2873 | asihpi->pcm_stop = snd_card_asihpi_pcm_int_stop; |
| 2874 | tasklet_init(&asihpi->t, snd_card_asihpi_int_task, | 2874 | tasklet_setup(&asihpi->t, snd_card_asihpi_int_task); |
| 2875 | (unsigned long)hpi); | ||
| 2876 | hpi->interrupt_callback = snd_card_asihpi_isr; | 2875 | hpi->interrupt_callback = snd_card_asihpi_isr; |
| 2877 | } else { | 2876 | } else { |
| 2878 | asihpi->pcm_start = snd_card_asihpi_pcm_timer_start; | 2877 | asihpi->pcm_start = snd_card_asihpi_pcm_timer_start; |
| @@ -537,7 +537,8 @@ static int snd_ca0106_pcm_power_dac(struct snd_ca0106 *chip, int channel_id, · 536 unmodified lines | |||
| 537 | else | 537 | else |
| 538 | /* Power down */ | 538 | /* Power down */ |
| 539 | chip->spi_dac_reg[reg] |= bit; | 539 | chip->spi_dac_reg[reg] |= bit; |
| 540 | return snd_ca0106_spi_write(chip, chip->spi_dac_reg[reg]); | 540 | if (snd_ca0106_spi_write(chip, chip->spi_dac_reg[reg]) != 0) |
| 541 | return -ENXIO; | ||
| 541 | } | 542 | } |
| 542 | return 0; | 543 | return 0; |
| 543 | } | 544 | } |
| @@ -2127,9 +2127,10 @@ static int azx_probe(struct pci_dev *pci, · 2126 unmodified lines | |||
| 2127 | */ | 2127 | */ |
| 2128 | if (dmic_detect) { | 2128 | if (dmic_detect) { |
| 2129 | err = snd_intel_dsp_driver_probe(pci); | 2129 | err = snd_intel_dsp_driver_probe(pci); |
| 2130 | if (err != SND_INTEL_DSP_DRIVER_ANY && | 2130 | if (err != SND_INTEL_DSP_DRIVER_ANY && err != SND_INTEL_DSP_DRIVER_LEGACY) { |
| 2131 | err != SND_INTEL_DSP_DRIVER_LEGACY) | 2131 | dev_dbg(&pci->dev, "HDAudio driver not selected, aborting probe\n"); |
| 2132 | return -ENODEV; | 2132 | return -ENODEV; |
| 2133 | } | ||
| 2133 | } else { | 2134 | } else { |
| 2134 | dev_warn(&pci->dev, "dmic_detect option is deprecated, pass snd-intel-dspcfg.dsp_driver=1 option instead\n"); | 2135 | dev_warn(&pci->dev, "dmic_detect option is deprecated, pass snd-intel-dspcfg.dsp_driver=1 option instead\n"); |
| 2135 | } | 2136 | } |
| @@ -2745,8 +2746,6 @@ static const struct pci_device_id azx_ids[] = { · 609 unmodified lines | |||
| 2745 | .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI }, | 2746 | .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI }, |
| 2746 | /* Zhaoxin */ | 2747 | /* Zhaoxin */ |
| 2747 | { PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN }, | 2748 | { PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN }, |
| 2748 | /* Loongson */ | ||
| 2749 | { PCI_DEVICE(0x0014, 0x7a07), .driver_data = AZX_DRIVER_GENERIC }, | ||
| 2750 | { 0, } | 2749 | { 0, } |
| 2751 | }; | 2750 | }; |
| 2752 | MODULE_DEVICE_TABLE(pci, azx_ids); | 2751 | MODULE_DEVICE_TABLE(pci, azx_ids); |
| @@ -179,6 +179,10 @@ static int __maybe_unused hda_tegra_runtime_suspend(struct device *dev) · 178 unmodified lines | |||
| 179 | struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); | 179 | struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); |
| 180 | 180 | ||
| 181 | if (chip && chip->running) { | 181 | if (chip && chip->running) { |
| 182 | /* enable controller wake up event */ | ||
| 183 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | | ||
| 184 | STATESTS_INT_MASK); | ||
| 185 | |||
| 182 | azx_stop_chip(chip); | 186 | azx_stop_chip(chip); |
| 183 | azx_enter_link_reset(chip); | 187 | azx_enter_link_reset(chip); |
| 184 | } | 188 | } |
| @@ -200,6 +204,9 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) · 15 unmodified lines | |||
| 200 | if (chip && chip->running) { | 204 | if (chip && chip->running) { |
| 201 | hda_tegra_init(hda); | 205 | hda_tegra_init(hda); |
| 202 | azx_init_chip(chip, 1); | 206 | azx_init_chip(chip, 1); |
| 207 | /* disable controller wake up event*/ | ||
| 208 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & | ||
| 209 | ~STATESTS_INT_MASK); | ||
| 203 | } | 210 | } |
| 204 | 211 | ||
| 205 | return 0; | 212 | return 0; |
| @@ -2794,6 +2794,7 @@ static void i915_pin_cvt_fixup(struct hda_codec *codec, · 2793 unmodified lines | |||
| 2794 | hda_nid_t cvt_nid) | 2794 | hda_nid_t cvt_nid) |
| 2795 | { | 2795 | { |
| 2796 | if (per_pin) { | 2796 | if (per_pin) { |
| 2797 | haswell_verify_D0(codec, per_pin->cvt_nid, per_pin->pin_nid); | ||
| 2797 | snd_hda_set_dev_select(codec, per_pin->pin_nid, | 2798 | snd_hda_set_dev_select(codec, per_pin->pin_nid, |
| 2798 | per_pin->dev_id); | 2799 | per_pin->dev_id); |
| 2799 | intel_verify_pin_cvt_connect(codec, per_pin); | 2800 | intel_verify_pin_cvt_connect(codec, per_pin); |
| @@ -3734,6 +3735,7 @@ static int tegra_hdmi_build_pcms(struct hda_codec *codec) · 934 unmodified lines | |||
| 3734 | 3735 | ||
| 3735 | static int patch_tegra_hdmi(struct hda_codec *codec) | 3736 | static int patch_tegra_hdmi(struct hda_codec *codec) |
| 3736 | { | 3737 | { |
| 3738 | struct hdmi_spec *spec; | ||
| 3737 | int err; | 3739 | int err; |
| 3738 | 3740 | ||
| 3739 | err = patch_generic_hdmi(codec); | 3741 | err = patch_generic_hdmi(codec); |
| @@ -3741,6 +3743,10 @@ static int patch_tegra_hdmi(struct hda_codec *codec) · 1 unmodified line | |||
| 3741 | return err; | 3743 | return err; |
| 3742 | 3744 | ||
| 3743 | codec->patch_ops.build_pcms = tegra_hdmi_build_pcms; | 3745 | codec->patch_ops.build_pcms = tegra_hdmi_build_pcms; |
| 3746 | spec = codec->spec; | ||
| 3747 | spec->chmap.ops.chmap_cea_alloc_validate_get_type = | ||
| 3748 | nvhdmi_chmap_cea_alloc_validate_get_type; | ||
| 3749 | spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; | ||
| 3744 | 3750 | ||
| 3745 | return 0; | 3751 | return 0; |
| 3746 | } | 3752 | } |
| @@ -4263,6 +4269,7 @@ HDA_CODEC_ENTRY(0x8086280c, "Cannonlake HDMI", patch_i915_glk_hdmi), · 516 unmodified lines | |||
| 4263 | HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), | 4269 | HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), |
| 4264 | HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), | 4270 | HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), |
| 4265 | HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi), | 4271 | HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi), |
| 4272 | HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi), | ||
| 4266 | HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi), | 4273 | HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi), |
| 4267 | HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi), | 4274 | HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi), |
| 4268 | HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), | 4275 | HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), |
| @@ -2475,6 +2475,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { · 2474 unmodified lines | |||
| 2475 | SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950), | 2475 | SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950), |
| 2476 | SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950), | 2476 | SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950), |
| 2477 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), | 2477 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), |
| 2478 | SND_PCI_QUIRK(0x1462, 0x9c37, "MSI X570-A PRO", ALC1220_FIXUP_CLEVO_P950), | ||
| 2478 | SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), | 2479 | SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), |
| 2479 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), | 2480 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), |
| 2480 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), | 2481 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), |
| @@ -5867,6 +5868,39 @@ static void alc275_fixup_gpio4_off(struct hda_codec *codec, · 3386 unmodified lines | |||
| 5867 | } | 5868 | } |
| 5868 | } | 5869 | } |
| 5869 | 5870 | ||
| 5871 | /* Quirk for Thinkpad X1 7th and 8th Gen | ||
| 5872 | * The following fixed routing needed | ||
| 5873 | * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly | ||
| 5874 | * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC | ||
| 5875 | * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp | ||
| 5876 | */ | ||
| 5877 | static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, | ||
| 5878 | const struct hda_fixup *fix, int action) | ||
| 5879 | { | ||
| 5880 | static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */ | ||
| 5881 | static const hda_nid_t preferred_pairs[] = { | ||
| 5882 | 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0 | ||
| 5883 | }; | ||
| 5884 | struct alc_spec *spec = codec->spec; | ||
| 5885 | |||
| 5886 | switch (action) { | ||
| 5887 | case HDA_FIXUP_ACT_PRE_PROBE: | ||
| 5888 | snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); | ||
| 5889 | spec->gen.preferred_dacs = preferred_pairs; | ||
| 5890 | break; | ||
| 5891 | case HDA_FIXUP_ACT_BUILD: | ||
| 5892 | /* The generic parser creates somewhat unintuitive volume ctls | ||
| 5893 | * with the fixed routing above, and the shared DAC2 may be | ||
| 5894 | * confusing for PA. | ||
| 5895 | * Rename those to unique names so that PA doesn't touch them | ||
| 5896 | * and use only Master volume. | ||
| 5897 | */ | ||
| 5898 | rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); | ||
| 5899 | rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); | ||
| 5900 | break; | ||
| 5901 | } | ||
| 5902 | } | ||
| 5903 | |||
| 5870 | static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, | 5904 | static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, |
| 5871 | const struct hda_fixup *fix, | 5905 | const struct hda_fixup *fix, |
| 5872 | int action) | 5906 | int action) |
| @@ -6135,6 +6169,7 @@ enum { · 262 unmodified lines | |||
| 6135 | ALC289_FIXUP_DUAL_SPK, | 6169 | ALC289_FIXUP_DUAL_SPK, |
| 6136 | ALC294_FIXUP_SPK2_TO_DAC1, | 6170 | ALC294_FIXUP_SPK2_TO_DAC1, |
| 6137 | ALC294_FIXUP_ASUS_DUAL_SPK, | 6171 | ALC294_FIXUP_ASUS_DUAL_SPK, |
| 6172 | ALC285_FIXUP_THINKPAD_X1_GEN7, | ||
| 6138 | ALC285_FIXUP_THINKPAD_HEADSET_JACK, | 6173 | ALC285_FIXUP_THINKPAD_HEADSET_JACK, |
| 6139 | ALC294_FIXUP_ASUS_HPE, | 6174 | ALC294_FIXUP_ASUS_HPE, |
| 6140 | ALC294_FIXUP_ASUS_COEF_1B, | 6175 | ALC294_FIXUP_ASUS_COEF_1B, |
| @@ -7280,11 +7315,17 @@ static const struct hda_fixup alc269_fixups[] = { · 1139 unmodified lines | |||
| 7280 | .chained = true, | 7315 | .chained = true, |
| 7281 | .chain_id = ALC294_FIXUP_SPK2_TO_DAC1 | 7316 | .chain_id = ALC294_FIXUP_SPK2_TO_DAC1 |
| 7282 | }, | 7317 | }, |
| 7318 | [ALC285_FIXUP_THINKPAD_X1_GEN7] = { | ||
| 7319 | .type = HDA_FIXUP_FUNC, | ||
| 7320 | .v.func = alc285_fixup_thinkpad_x1_gen7, | ||
| 7321 | .chained = true, | ||
| 7322 | .chain_id = ALC269_FIXUP_THINKPAD_ACPI | ||
| 7323 | }, | ||
| 7283 | [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = { | 7324 | [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = { |
| 7284 | .type = HDA_FIXUP_FUNC, | 7325 | .type = HDA_FIXUP_FUNC, |
| 7285 | .v.func = alc_fixup_headset_jack, | 7326 | .v.func = alc_fixup_headset_jack, |
| 7286 | .chained = true, | 7327 | .chained = true, |
| 7287 | .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1 | 7328 | .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7 |
| 7288 | }, | 7329 | }, |
| 7289 | [ALC294_FIXUP_ASUS_HPE] = { | 7330 | [ALC294_FIXUP_ASUS_HPE] = { |
| 7290 | .type = HDA_FIXUP_VERBS, | 7331 | .type = HDA_FIXUP_VERBS, |
| @@ -7695,7 +7736,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 404 unmodified lines | |||
| 7695 | SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), | 7736 | SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
| 7696 | SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), | 7737 | SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
| 7697 | SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), | 7738 | SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
| 7698 | SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), | 7739 | SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
| 7740 | SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), | ||
| 7699 | SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), | 7741 | SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), |
| 7700 | SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), | 7742 | SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), |
| 7701 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), | 7743 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), |
| @@ -1070,9 +1070,9 @@ getmixer(struct cmdif *cif, short num, unsigned short *rval, · 1069 unmodified lines | |||
| 1070 | return 0; | 1070 | return 0; |
| 1071 | } | 1071 | } |
| 1072 | 1072 | ||
| 1073 | static void riptide_handleirq(unsigned long dev_id) | 1073 | static void riptide_handleirq(struct tasklet_struct *t) |
| 1074 | { | 1074 | { |
| 1075 | struct snd_riptide *chip = (void *)dev_id; | 1075 | struct snd_riptide *chip = from_tasklet(chip, t, riptide_tq); |
| 1076 | struct cmdif *cif = chip->cif; | 1076 | struct cmdif *cif = chip->cif; |
| 1077 | struct snd_pcm_substream *substream[PLAYBACK_SUBSTREAMS + 1]; | 1077 | struct snd_pcm_substream *substream[PLAYBACK_SUBSTREAMS + 1]; |
| 1078 | struct snd_pcm_runtime *runtime; | 1078 | struct snd_pcm_runtime *runtime; |
| @@ -1843,7 +1843,7 @@ snd_riptide_create(struct snd_card *card, struct pci_dev *pci, · 764 unmodified lines | |||
| 1843 | chip->received_irqs = 0; | 1843 | chip->received_irqs = 0; |
| 1844 | chip->handled_irqs = 0; | 1844 | chip->handled_irqs = 0; |
| 1845 | chip->cif = NULL; | 1845 | chip->cif = NULL; |
| 1846 | tasklet_init(&chip->riptide_tq, riptide_handleirq, (unsigned long)chip); | 1846 | tasklet_setup(&chip->riptide_tq, riptide_handleirq); |
| 1847 | 1847 | ||
| 1848 | if ((chip->res_port = | 1848 | if ((chip->res_port = |
| 1849 | request_region(chip->port, 64, "RIPTIDE")) == NULL) { | 1849 | request_region(chip->port, 64, "RIPTIDE")) == NULL) { |
| @@ -3791,9 +3791,9 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) · 3790 unmodified lines | |||
| 3791 | return 0; | 3791 | return 0; |
| 3792 | } | 3792 | } |
| 3793 | 3793 | ||
| 3794 | static void hdsp_midi_tasklet(unsigned long arg) | 3794 | static void hdsp_midi_tasklet(struct tasklet_struct *t) |
| 3795 | { | 3795 | { |
| 3796 | struct hdsp *hdsp = (struct hdsp *)arg; | 3796 | struct hdsp *hdsp = from_tasklet(hdsp, t, midi_tasklet); |
| 3797 | 3797 | ||
| 3798 | if (hdsp->midi[0].pending) | 3798 | if (hdsp->midi[0].pending) |
| 3799 | snd_hdsp_midi_input_read (&hdsp->midi[0]); | 3799 | snd_hdsp_midi_input_read (&hdsp->midi[0]); |
| @@ -5182,7 +5182,7 @@ static int snd_hdsp_create(struct snd_card *card, · 1382 unmodified lines | |||
| 5182 | 5182 | ||
| 5183 | spin_lock_init(&hdsp->lock); | 5183 | spin_lock_init(&hdsp->lock); |
| 5184 | 5184 | ||
| 5185 | tasklet_init(&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long)hdsp); | 5185 | tasklet_setup(&hdsp->midi_tasklet, hdsp_midi_tasklet); |
| 5186 | 5186 | ||
| 5187 | pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev); | 5187 | pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev); |
| 5188 | hdsp->firmware_rev &= 0xff; | 5188 | hdsp->firmware_rev &= 0xff; |
| @@ -2169,9 +2169,9 @@ static int snd_hdspm_create_midi(struct snd_card *card, · 2168 unmodified lines | |||
| 2169 | } | 2169 | } |
| 2170 | 2170 | ||
| 2171 | 2171 | ||
| 2172 | static void hdspm_midi_tasklet(unsigned long arg) | 2172 | static void hdspm_midi_tasklet(struct tasklet_struct *t) |
| 2173 | { | 2173 | { |
| 2174 | struct hdspm *hdspm = (struct hdspm *)arg; | 2174 | struct hdspm *hdspm = from_tasklet(hdspm, t, midi_tasklet); |
| 2175 | int i = 0; | 2175 | int i = 0; |
| 2176 | 2176 | ||
| 2177 | while (i < hdspm->midiPorts) { | 2177 | while (i < hdspm->midiPorts) { |
| @@ -6836,8 +6836,7 @@ static int snd_hdspm_create(struct snd_card *card, · 4658 unmodified lines | |||
| 6836 | 6836 | ||
| 6837 | } | 6837 | } |
| 6838 | 6838 | ||
| 6839 | tasklet_init(&hdspm->midi_tasklet, | 6839 | tasklet_setup(&hdspm->midi_tasklet, hdspm_midi_tasklet); |
| 6840 | hdspm_midi_tasklet, (unsigned long) hdspm); | ||
| 6841 | 6840 | ||
| 6842 | 6841 | ||
| 6843 | if (hdspm->io_type != MADIface) { | 6842 | if (hdspm->io_type != MADIface) { |
| @@ -708,9 +708,9 @@ static void fsl_esai_trigger_stop(struct fsl_esai *esai_priv, bool tx) · 707 unmodified lines | |||
| 708 | ESAI_xFCR_xFR, 0); | 708 | ESAI_xFCR_xFR, 0); |
| 709 | } | 709 | } |
| 710 | 710 | ||
| 711 | static void fsl_esai_hw_reset(unsigned long arg) | 711 | static void fsl_esai_hw_reset(struct tasklet_struct *t) |
| 712 | { | 712 | { |
| 713 | struct fsl_esai *esai_priv = (struct fsl_esai *)arg; | 713 | struct fsl_esai *esai_priv = from_tasklet(esai_priv, t, task); |
| 714 | bool tx = true, rx = false, enabled[2]; | 714 | bool tx = true, rx = false, enabled[2]; |
| 715 | unsigned long lock_flags; | 715 | unsigned long lock_flags; |
| 716 | u32 tfcr, rfcr; | 716 | u32 tfcr, rfcr; |
| @@ -1070,8 +1070,7 @@ static int fsl_esai_probe(struct platform_device *pdev) · 353 unmodified lines | |||
| 1070 | return ret; | 1070 | return ret; |
| 1071 | } | 1071 | } |
| 1072 | 1072 | ||
| 1073 | tasklet_init(&esai_priv->task, fsl_esai_hw_reset, | 1073 | tasklet_setup(&esai_priv->task, fsl_esai_hw_reset); |
| 1074 | (unsigned long)esai_priv); | ||
| 1075 | 1074 | ||
| 1076 | pm_runtime_enable(&pdev->dev); | 1075 | pm_runtime_enable(&pdev->dev); |
| 1077 | 1076 | ||
| @@ -198,9 +198,9 @@ static int siu_pcm_rd_set(struct siu_port *port_info, · 197 unmodified lines | |||
| 198 | return 0; | 198 | return 0; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | static void siu_io_tasklet(unsigned long data) | 201 | static void siu_io_tasklet(struct tasklet_struct *t) |
| 202 | { | 202 | { |
| 203 | struct siu_stream *siu_stream = (struct siu_stream *)data; | 203 | struct siu_stream *siu_stream = from_tasklet(siu_stream, t, tasklet); |
| 204 | struct snd_pcm_substream *substream = siu_stream->substream; | 204 | struct snd_pcm_substream *substream = siu_stream->substream; |
| 205 | struct device *dev = substream->pcm->card->dev; | 205 | struct device *dev = substream->pcm->card->dev; |
| 206 | struct snd_pcm_runtime *rt = substream->runtime; | 206 | struct snd_pcm_runtime *rt = substream->runtime; |
| @@ -520,10 +520,8 @@ static int siu_pcm_new(struct snd_soc_component *component, · 313 unmodified lines | |||
| 520 | (*port_info)->pcm = pcm; | 520 | (*port_info)->pcm = pcm; |
| 521 | 521 | ||
| 522 | /* IO tasklets */ | 522 | /* IO tasklets */ |
| 523 | tasklet_init(&(*port_info)->playback.tasklet, siu_io_tasklet, | 523 | tasklet_setup(&(*port_info)->playback.tasklet, siu_io_tasklet); |
| 524 | (unsigned long)&(*port_info)->playback); | 524 | tasklet_setup(&(*port_info)->capture.tasklet, siu_io_tasklet); |
| 525 | tasklet_init(&(*port_info)->capture.tasklet, siu_io_tasklet, | ||
| 526 | (unsigned long)&(*port_info)->capture); | ||
| 527 | } | 525 | } |
| 528 | 526 | ||
| 529 | dev_info(card->dev, "SuperH SIU driver initialized.\n"); | 527 | dev_info(card->dev, "SuperH SIU driver initialized.\n"); |
| @@ -134,9 +134,9 @@ txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr) · 133 unmodified lines | |||
| 134 | 134 | ||
| 135 | #define NR_DMA_CHAIN 2 | 135 | #define NR_DMA_CHAIN 2 |
| 136 | 136 | ||
| 137 | static void txx9aclc_dma_tasklet(unsigned long data) | 137 | static void txx9aclc_dma_tasklet(struct tasklet_struct *t) |
| 138 | { | 138 | { |
| 139 | struct txx9aclc_dmadata *dmadata = (struct txx9aclc_dmadata *)data; | 139 | struct txx9aclc_dmadata *dmadata = from_tasklet(dmadata, t, tasklet); |
| 140 | struct dma_chan *chan = dmadata->dma_chan; | 140 | struct dma_chan *chan = dmadata->dma_chan; |
| 141 | struct dma_async_tx_descriptor *desc; | 141 | struct dma_async_tx_descriptor *desc; |
| 142 | struct snd_pcm_substream *substream = dmadata->substream; | 142 | struct snd_pcm_substream *substream = dmadata->substream; |
| @@ -352,8 +352,7 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev, · 209 unmodified lines | |||
| 352 | "playback" : "capture"); | 352 | "playback" : "capture"); |
| 353 | return -EBUSY; | 353 | return -EBUSY; |
| 354 | } | 354 | } |
| 355 | tasklet_init(&dmadata->tasklet, txx9aclc_dma_tasklet, | 355 | tasklet_setup(&dmadata->tasklet, txx9aclc_dma_tasklet); |
| 356 | (unsigned long)dmadata); | ||
| 357 | return 0; | 356 | return 0; |
| 358 | } | 357 | } |
| 359 | 358 | ||
| @@ -344,10 +344,9 @@ static void snd_usbmidi_do_output(struct snd_usb_midi_out_endpoint *ep) · 343 unmodified lines | |||
| 344 | spin_unlock_irqrestore(&ep->buffer_lock, flags); | 344 | spin_unlock_irqrestore(&ep->buffer_lock, flags); |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | static void snd_usbmidi_out_tasklet(unsigned long data) | 347 | static void snd_usbmidi_out_tasklet(struct tasklet_struct *t) |
| 348 | { | 348 | { |
| 349 | struct snd_usb_midi_out_endpoint *ep = | 349 | struct snd_usb_midi_out_endpoint *ep = from_tasklet(ep, t, tasklet); |
| 350 | (struct snd_usb_midi_out_endpoint *) data; | ||
| 351 | 350 | ||
| 352 | snd_usbmidi_do_output(ep); | 351 | snd_usbmidi_do_output(ep); |
| 353 | } | 352 | } |
| @@ -1441,7 +1440,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi *umidi, · 1087 unmodified lines | |||
| 1441 | } | 1440 | } |
| 1442 | 1441 | ||
| 1443 | spin_lock_init(&ep->buffer_lock); | 1442 | spin_lock_init(&ep->buffer_lock); |
| 1444 | tasklet_init(&ep->tasklet, snd_usbmidi_out_tasklet, (unsigned long)ep); | 1443 | tasklet_setup(&ep->tasklet, snd_usbmidi_out_tasklet); |
| 1445 | init_waitqueue_head(&ep->drain_wait); | 1444 | init_waitqueue_head(&ep->drain_wait); |
| 1446 | 1445 | ||
| 1447 | for (i = 0; i < 0x10; ++i) | 1446 | for (i = 0; i < 0x10; ++i) |
| @@ -247,9 +247,9 @@ static inline void add_with_wraparound(struct ua101 *ua, · 246 unmodified lines | |||
| 247 | *value -= ua->playback.queue_length; | 247 | *value -= ua->playback.queue_length; |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | static void playback_tasklet(unsigned long data) | 250 | static void playback_tasklet(struct tasklet_struct *t) |
| 251 | { | 251 | { |
| 252 | struct ua101 *ua = (void *)data; | 252 | struct ua101 *ua = from_tasklet(ua, t, playback_tasklet); |
| 253 | unsigned long flags; | 253 | unsigned long flags; |
| 254 | unsigned int frames; | 254 | unsigned int frames; |
| 255 | struct ua101_urb *urb; | 255 | struct ua101_urb *urb; |
| @@ -1218,8 +1218,7 @@ static int ua101_probe(struct usb_interface *interface, · 962 unmodified lines | |||
| 1218 | spin_lock_init(&ua->lock); | 1218 | spin_lock_init(&ua->lock); |
| 1219 | mutex_init(&ua->mutex); | 1219 | mutex_init(&ua->mutex); |
| 1220 | INIT_LIST_HEAD(&ua->ready_playback_urbs); | 1220 | INIT_LIST_HEAD(&ua->ready_playback_urbs); |
| 1221 | tasklet_init(&ua->playback_tasklet, | 1221 | tasklet_setup(&ua->playback_tasklet, playback_tasklet); |
| 1222 | playback_tasklet, (unsigned long)ua); | ||
| 1223 | init_waitqueue_head(&ua->alsa_capture_wait); | 1222 | init_waitqueue_head(&ua->alsa_capture_wait); |
| 1224 | init_waitqueue_head(&ua->rate_feedback_wait); | 1223 | init_waitqueue_head(&ua->rate_feedback_wait); |
| 1225 | init_waitqueue_head(&ua->alsa_playback_wait); | 1224 | init_waitqueue_head(&ua->alsa_playback_wait); |
| @@ -369,11 +369,13 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, · 368 unmodified lines | |||
| 369 | case USB_ID(0x07fd, 0x0008): /* MOTU M Series */ | 369 | case USB_ID(0x07fd, 0x0008): /* MOTU M Series */ |
| 370 | case USB_ID(0x31e9, 0x0001): /* Solid State Logic SSL2 */ | 370 | case USB_ID(0x31e9, 0x0001): /* Solid State Logic SSL2 */ |
| 371 | case USB_ID(0x31e9, 0x0002): /* Solid State Logic SSL2+ */ | 371 | case USB_ID(0x31e9, 0x0002): /* Solid State Logic SSL2+ */ |
| 372 | case USB_ID(0x0499, 0x172f): /* Steinberg UR22C */ | ||
| 372 | case USB_ID(0x0d9a, 0x00df): /* RTX6001 */ | 373 | case USB_ID(0x0d9a, 0x00df): /* RTX6001 */ |
| 373 | ep = 0x81; | 374 | ep = 0x81; |
| 374 | ifnum = 2; | 375 | ifnum = 2; |
| 375 | goto add_sync_ep_from_ifnum; | 376 | goto add_sync_ep_from_ifnum; |
| 376 | case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */ | 377 | case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */ |
| 378 | case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */ | ||
| 377 | ep = 0x82; | 379 | ep = 0x82; |
| 378 | ifnum = 0; | 380 | ifnum = 0; |
| 379 | goto add_sync_ep_from_ifnum; | 381 | goto add_sync_ep_from_ifnum; |
| @@ -2827,14 +2827,24 @@ YAMAHA_DEVICE(0x7010, "UB99"), · 2826 unmodified lines | |||
| 2827 | /* Lenovo ThinkStation P620 Rear Line-in, Line-out and Microphone */ | 2827 | /* Lenovo ThinkStation P620 Rear Line-in, Line-out and Microphone */ |
| 2828 | { | 2828 | { |
| 2829 | USB_DEVICE(0x17aa, 0x1046), | 2829 | USB_DEVICE(0x17aa, 0x1046), |
| 2830 | QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Rear", | 2830 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
| 2831 | "Lenovo-ThinkStation-P620-Rear"), | 2831 | .vendor_name = "Lenovo", |
| 2832 | .product_name = "ThinkStation P620 Rear", | ||
| 2833 | .profile_name = "Lenovo-ThinkStation-P620-Rear", | ||
| 2834 | .ifnum = QUIRK_ANY_INTERFACE, | ||
| 2835 | .type = QUIRK_SETUP_DISABLE_AUTOSUSPEND | ||
| 2836 | } | ||
| 2832 | }, | 2837 | }, |
| 2833 | /* Lenovo ThinkStation P620 Internal Speaker + Front Headset */ | 2838 | /* Lenovo ThinkStation P620 Internal Speaker + Front Headset */ |
| 2834 | { | 2839 | { |
| 2835 | USB_DEVICE(0x17aa, 0x104d), | 2840 | USB_DEVICE(0x17aa, 0x104d), |
| 2836 | QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Main", | 2841 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
| 2837 | "Lenovo-ThinkStation-P620-Main"), | 2842 | .vendor_name = "Lenovo", |
| 2843 | .product_name = "ThinkStation P620 Main", | ||
| 2844 | .profile_name = "Lenovo-ThinkStation-P620-Main", | ||
| 2845 | .ifnum = QUIRK_ANY_INTERFACE, | ||
| 2846 | .type = QUIRK_SETUP_DISABLE_AUTOSUSPEND | ||
| 2847 | } | ||
| 2838 | }, | 2848 | }, |
| 2839 | 2849 | ||
| 2840 | /* Native Instruments MK2 series */ | 2850 | /* Native Instruments MK2 series */ |
| @@ -3549,14 +3559,40 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), · 708 unmodified lines | |||
| 3549 | { | 3559 | { |
| 3550 | /* | 3560 | /* |
| 3551 | * Pioneer DJ DJM-250MK2 | 3561 | * Pioneer DJ DJM-250MK2 |
| 3552 | * PCM is 8 channels out @ 48 fixed (endpoints 0x01). | 3562 | * PCM is 8 channels out @ 48 fixed (endpoint 0x01) |
| 3553 | * The output from computer to the mixer is usable. | 3563 | * and 8 channels in @ 48 fixed (endpoint 0x82). |
| 3564 | * | ||
| 3565 | * Both playback and recording is working, even simultaneously. | ||
| 3554 | * | 3566 | * |
| 3555 | * The input (phono or line to computer) is not working. | 3567 | * Playback channels could be mapped to: |
| 3556 | * It should be at endpoint 0x82 and probably also 8 channels, | 3568 | * - CH1 |
| 3557 | * but it seems that it works only with Pioneer proprietary software. | 3569 | * - CH2 |
| 3558 | * Even on officially supported OS, the Audacity was unable to record | 3570 | * - AUX |
| 3559 | * and Mixxx to recognize the control vinyls. | 3571 | * |
| 3572 | * Recording channels could be mapped to: | ||
| 3573 | * - Post CH1 Fader | ||
| 3574 | * - Post CH2 Fader | ||
| 3575 | * - Cross Fader A | ||
| 3576 | * - Cross Fader B | ||
| 3577 | * - MIC | ||
| 3578 | * - AUX | ||
| 3579 | * - REC OUT | ||
| 3580 | * | ||
| 3581 | * There is remaining problem with recording directly from PHONO/LINE. | ||
| 3582 | * If we map a channel to: | ||
| 3583 | * - CH1 Control Tone PHONO | ||
| 3584 | * - CH1 Control Tone LINE | ||
| 3585 | * - CH2 Control Tone PHONO | ||
| 3586 | * - CH2 Control Tone LINE | ||
| 3587 | * it is silent. | ||
| 3588 | * There is no signal even on other operating systems with official drivers. | ||
| 3589 | * The signal appears only when a supported application is started. | ||
| 3590 | * This needs to be investigated yet... | ||
| 3591 | * (there is quite a lot communication on the USB in both directions) | ||
| 3592 | * | ||
| 3593 | * In current version this mixer could be used for playback | ||
| 3594 | * and for recording from vinyls (through Post CH* Fader) | ||
| 3595 | * but not for DVS (Digital Vinyl Systems) like in Mixxx. | ||
| 3560 | */ | 3596 | */ |
| 3561 | USB_DEVICE_VENDOR_SPEC(0x2b73, 0x0017), | 3597 | USB_DEVICE_VENDOR_SPEC(0x2b73, 0x0017), |
| 3562 | .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { | 3598 | .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { |
| @@ -3580,6 +3616,26 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), · 17 unmodified lines | |||
| 3580 | .rate_max = 48000, | 3616 | .rate_max = 48000, |
| 3581 | .nr_rates = 1, | 3617 | .nr_rates = 1, |
| 3582 | .rate_table = (unsigned int[]) { 48000 } | 3618 | .rate_table = (unsigned int[]) { 48000 } |
| 3619 | } | ||
| 3620 | }, | ||
| 3621 | { | ||
| 3622 | .ifnum = 0, | ||
| 3623 | .type = QUIRK_AUDIO_FIXED_ENDPOINT, | ||
| 3624 | .data = &(const struct audioformat) { | ||
| 3625 | .formats = SNDRV_PCM_FMTBIT_S24_3LE, | ||
| 3626 | .channels = 8, // inputs | ||
| 3627 | .iface = 0, | ||
| 3628 | .altsetting = 1, | ||
| 3629 | .altset_idx = 1, | ||
| 3630 | .endpoint = 0x82, | ||
| 3631 | .ep_attr = USB_ENDPOINT_XFER_ISOC| | ||
| 3632 | USB_ENDPOINT_SYNC_ASYNC| | ||
| 3633 | USB_ENDPOINT_USAGE_IMPLICIT_FB, | ||
| 3634 | .rates = SNDRV_PCM_RATE_48000, | ||
| 3635 | .rate_min = 48000, | ||
| 3636 | .rate_max = 48000, | ||
| 3637 | .nr_rates = 1, | ||
| 3638 | .rate_table = (unsigned int[]) { 48000 } | ||
| 3583 | } | 3639 | } |
| 3584 | }, | 3640 | }, |
| 3585 | { | 3641 | { |
| @@ -518,6 +518,15 @@ static int setup_fmt_after_resume_quirk(struct snd_usb_audio *chip, · 517 unmodified lines | |||
| 518 | return 1; /* Continue with creating streams and mixer */ | 518 | return 1; /* Continue with creating streams and mixer */ |
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | static int setup_disable_autosuspend(struct snd_usb_audio *chip, | ||
| 522 | struct usb_interface *iface, | ||
| 523 | struct usb_driver *driver, | ||
| 524 | const struct snd_usb_audio_quirk *quirk) | ||
| 525 | { | ||
| 526 | driver->supports_autosuspend = 0; | ||
| 527 | return 1; /* Continue with creating streams and mixer */ | ||
| 528 | } | ||
| 529 | |||
| 521 | /* | 530 | /* |
| 522 | * audio-interface quirks | 531 | * audio-interface quirks |
| 523 | * | 532 | * |
| @@ -557,6 +566,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, · 33 unmodified lines | |||
| 557 | [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk, | 566 | [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk, |
| 558 | [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk, | 567 | [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk, |
| 559 | [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk, | 568 | [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk, |
| 569 | [QUIRK_SETUP_DISABLE_AUTOSUSPEND] = setup_disable_autosuspend, | ||
| 560 | }; | 570 | }; |
| 561 | 571 | ||
| 562 | if (quirk->type < QUIRK_TYPE_COUNT) { | 572 | if (quirk->type < QUIRK_TYPE_COUNT) { |
| @@ -1493,6 +1503,7 @@ void snd_usb_set_format_quirk(struct snd_usb_substream *subs, · 930 unmodified lines | |||
| 1493 | set_format_emu_quirk(subs, fmt); | 1503 | set_format_emu_quirk(subs, fmt); |
| 1494 | break; | 1504 | break; |
| 1495 | case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */ | 1505 | case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */ |
| 1506 | case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */ | ||
| 1496 | pioneer_djm_set_format_quirk(subs); | 1507 | pioneer_djm_set_format_quirk(subs); |
| 1497 | break; | 1508 | break; |
| 1498 | case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ | 1509 | case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */ |
| @@ -102,6 +102,7 @@ enum quirk_type { · 101 unmodified lines | |||
| 102 | QUIRK_AUDIO_ALIGN_TRANSFER, | 102 | QUIRK_AUDIO_ALIGN_TRANSFER, |
| 103 | QUIRK_AUDIO_STANDARD_MIXER, | 103 | QUIRK_AUDIO_STANDARD_MIXER, |
| 104 | QUIRK_SETUP_FMT_AFTER_RESUME, | 104 | QUIRK_SETUP_FMT_AFTER_RESUME, |
| 105 | QUIRK_SETUP_DISABLE_AUTOSUSPEND, | ||
| 105 | 106 | ||
| 106 | QUIRK_TYPE_COUNT | 107 | QUIRK_TYPE_COUNT |
| 107 | }; | 108 | }; |
| @@ -9,7 +9,7 @@ menuconfig SND_X86 · 8 unmodified lines | |||
| 9 | if SND_X86 | 9 | if SND_X86 |
| 10 | 10 | ||
| 11 | config HDMI_LPE_AUDIO | 11 | config HDMI_LPE_AUDIO |
| 12 | tristate "HDMI audio without HDaudio on Intel Atom platforms" | 12 | tristate "HDMI audio without HDAudio on Intel Atom platforms" |
| 13 | depends on DRM_I915 | 13 | depends on DRM_I915 |
| 14 | select SND_PCM | 14 | select SND_PCM |
| 15 | help | 15 | help |
| @@ -1196,7 +1196,7 @@ union perf_mem_data_src { · 1195 unmodified lines | |||
| 1196 | 1196 | ||
| 1197 | #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ | 1197 | #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ |
| 1198 | /* 1 free */ | 1198 | /* 1 free */ |
| 1199 | #define PERF_MEM_SNOOPX_SHIFT 37 | 1199 | #define PERF_MEM_SNOOPX_SHIFT 38 |
| 1200 | 1200 | ||
| 1201 | /* locked instruction */ | 1201 | /* locked instruction */ |
| 1202 | #define PERF_MEM_LOCK_NA 0x01 /* not available */ | 1202 | #define PERF_MEM_LOCK_NA 0x01 /* not available */ |
| @@ -5259,7 +5259,7 @@ static int print_arg_pointer(struct trace_seq *s, const char *format, int plen, · 5258 unmodified lines | |||
| 5259 | default: | 5259 | default: |
| 5260 | ret = 0; | 5260 | ret = 0; |
| 5261 | val = eval_num_arg(data, size, event, arg); | 5261 | val = eval_num_arg(data, size, event, arg); |
| 5262 | trace_seq_printf(s, "%p", (void *)val); | 5262 | trace_seq_printf(s, "%p", (void *)(intptr_t)val); |
| 5263 | break; | 5263 | break; |
| 5264 | } | 5264 | } |
| 5265 | 5265 | ||
| @@ -33,6 +33,10 @@ OPTIONS · 32 unmodified lines | |||
| 33 | - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a | 33 | - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a |
| 34 | hexadecimal event descriptor. | 34 | hexadecimal event descriptor. |
| 35 | 35 | ||
| 36 | - a symbolic or raw PMU event followed by an optional colon | ||
| 37 | and a list of event modifiers, e.g., cpu-cycles:p. See the | ||
| 38 | linkperf:perf-list[1] man page for details on event modifiers. | ||
| 39 | |||
| 36 | - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where | 40 | - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where |
| 37 | 'param1', 'param2', etc are defined as formats for the PMU in | 41 | 'param1', 'param2', etc are defined as formats for the PMU in |
| 38 | /sys/bus/event_source/devices/<pmu>/format/*. | 42 | /sys/bus/event_source/devices/<pmu>/format/*. |
| @@ -39,6 +39,10 @@ report:: · 38 unmodified lines | |||
| 39 | - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a | 39 | - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a |
| 40 | hexadecimal event descriptor. | 40 | hexadecimal event descriptor. |
| 41 | 41 | ||
| 42 | - a symbolic or raw PMU event followed by an optional colon | ||
| 43 | and a list of event modifiers, e.g., cpu-cycles:p. See the | ||
| 44 | linkperf:perf-list[1] man page for details on event modifiers. | ||
| 45 | |||
| 42 | - a symbolically formed event like 'pmu/param1=0x3,param2/' where | 46 | - a symbolically formed event like 'pmu/param1=0x3,param2/' where |
| 43 | param1 and param2 are defined as formats for the PMU in | 47 | param1 and param2 are defined as formats for the PMU in |
| 44 | /sys/bus/event_source/devices/<pmu>/format/* | 48 | /sys/bus/event_source/devices/<pmu>/format/* |
| @@ -416,6 +420,9 @@ counts for all hardware threads in a core but show the sum counts per · 371 unmodified lines | |||
| 416 | hardware thread. This is essentially a replacement for the any bit and | 420 | hardware thread. This is essentially a replacement for the any bit and |
| 417 | convenient for post processing. | 421 | convenient for post processing. |
| 418 | 422 | ||
| 423 | --summary:: | ||
| 424 | Print summary for interval mode (-I). | ||
| 425 | |||
| 419 | EXAMPLES | 426 | EXAMPLES |
| 420 | -------- | 427 | -------- |
| 421 | 428 | ||
| @@ -162,8 +162,8 @@ static int do_run_multi_threaded(struct target *target, · 161 unmodified lines | |||
| 162 | init_stats(&event_stats); | 162 | init_stats(&event_stats); |
| 163 | for (i = 0; i < multi_iterations; i++) { | 163 | for (i = 0; i < multi_iterations; i++) { |
| 164 | session = perf_session__new(NULL, false, NULL); | 164 | session = perf_session__new(NULL, false, NULL); |
| 165 | if (!session) | 165 | if (IS_ERR(session)) |
| 166 | return -ENOMEM; | 166 | return PTR_ERR(session); |
| 167 | 167 | ||
| 168 | atomic_set(&event_count, 0); | 168 | atomic_set(&event_count, 0); |
| 169 | gettimeofday(&start, NULL); | 169 | gettimeofday(&start, NULL); |
| @@ -2452,7 +2452,7 @@ static struct option __record_options[] = { · 2451 unmodified lines | |||
| 2452 | OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize, | 2452 | OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize, |
| 2453 | "synthesize non-sample events at the end of output"), | 2453 | "synthesize non-sample events at the end of output"), |
| 2454 | OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"), | 2454 | OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"), |
| 2455 | OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "record bpf events"), | 2455 | OPT_BOOLEAN(0, "no-bpf-event", &record.opts.no_bpf_event, "do not record bpf events"), |
| 2456 | OPT_BOOLEAN(0, "strict-freq", &record.opts.strict_freq, | 2456 | OPT_BOOLEAN(0, "strict-freq", &record.opts.strict_freq, |
| 2457 | "Fail if the specified frequency can't be used"), | 2457 | "Fail if the specified frequency can't be used"), |
| 2458 | OPT_CALLBACK('F', "freq", &record.opts, "freq or 'max'", | 2458 | OPT_CALLBACK('F', "freq", &record.opts, "freq or 'max'", |
| @@ -1332,6 +1332,9 @@ int cmd_report(int argc, const char **argv) · 1331 unmodified lines | |||
| 1332 | if (report.mmaps_mode) | 1332 | if (report.mmaps_mode) |
| 1333 | report.tasks_mode = true; | 1333 | report.tasks_mode = true; |
| 1334 | 1334 | ||
| 1335 | if (dump_trace) | ||
| 1336 | report.tool.ordered_events = false; | ||
| 1337 | |||
| 1335 | if (quiet) | 1338 | if (quiet) |
| 1336 | perf_quiet_option(); | 1339 | perf_quiet_option(); |
| 1337 | 1340 | ||
| @@ -2584,7 +2584,8 @@ static int timehist_sched_change_event(struct perf_tool *tool, · 2583 unmodified lines | |||
| 2584 | } | 2584 | } |
| 2585 | 2585 | ||
| 2586 | if (!sched->idle_hist || thread->tid == 0) { | 2586 | if (!sched->idle_hist || thread->tid == 0) { |
| 2587 | timehist_update_runtime_stats(tr, t, tprev); | 2587 | if (!cpu_list || test_bit(sample->cpu, cpu_bitmap)) |
| 2588 | timehist_update_runtime_stats(tr, t, tprev); | ||
| 2588 | 2589 | ||
| 2589 | if (sched->idle_hist) { | 2590 | if (sched->idle_hist) { |
| 2590 | struct idle_thread_runtime *itr = (void *)tr; | 2591 | struct idle_thread_runtime *itr = (void *)tr; |
| @@ -2857,6 +2858,9 @@ static void timehist_print_summary(struct perf_sched *sched, · 266 unmodified lines | |||
| 2857 | 2858 | ||
| 2858 | printf("\nIdle stats:\n"); | 2859 | printf("\nIdle stats:\n"); |
| 2859 | for (i = 0; i < idle_max_cpu; ++i) { | 2860 | for (i = 0; i < idle_max_cpu; ++i) { |
| 2861 | if (cpu_list && !test_bit(i, cpu_bitmap)) | ||
| 2862 | continue; | ||
| 2863 | |||
| 2860 | t = idle_threads[i]; | 2864 | t = idle_threads[i]; |
| 2861 | if (!t) | 2865 | if (!t) |
| 2862 | continue; | 2866 | continue; |
| @@ -404,7 +404,7 @@ static void read_counters(struct timespec *rs) · 403 unmodified lines | |||
| 404 | { | 404 | { |
| 405 | struct evsel *counter; | 405 | struct evsel *counter; |
| 406 | 406 | ||
| 407 | if (!stat_config.summary && (read_affinity_counters(rs) < 0)) | 407 | if (!stat_config.stop_read_counter && (read_affinity_counters(rs) < 0)) |
| 408 | return; | 408 | return; |
| 409 | 409 | ||
| 410 | evlist__for_each_entry(evsel_list, counter) { | 410 | evlist__for_each_entry(evsel_list, counter) { |
| @@ -897,9 +897,9 @@ try_again_reset: · 486 unmodified lines | |||
| 897 | if (stat_config.walltime_run_table) | 897 | if (stat_config.walltime_run_table) |
| 898 | stat_config.walltime_run[run_idx] = t1 - t0; | 898 | stat_config.walltime_run[run_idx] = t1 - t0; |
| 899 | 899 | ||
| 900 | if (interval) { | 900 | if (interval && stat_config.summary) { |
| 901 | stat_config.interval = 0; | 901 | stat_config.interval = 0; |
| 902 | stat_config.summary = true; | 902 | stat_config.stop_read_counter = true; |
| 903 | init_stats(&walltime_nsecs_stats); | 903 | init_stats(&walltime_nsecs_stats); |
| 904 | update_stats(&walltime_nsecs_stats, t1 - t0); | 904 | update_stats(&walltime_nsecs_stats, t1 - t0); |
| 905 | 905 | ||
| @@ -1164,6 +1164,8 @@ static struct option stat_options[] = { · 258 unmodified lines | |||
| 1164 | "Use with 'percore' event qualifier to show the event " | 1164 | "Use with 'percore' event qualifier to show the event " |
| 1165 | "counts of one hardware thread by sum up total hardware " | 1165 | "counts of one hardware thread by sum up total hardware " |
| 1166 | "threads of same physical core"), | 1166 | "threads of same physical core"), |
| 1167 | OPT_BOOLEAN(0, "summary", &stat_config.summary, | ||
| 1168 | "print summary for interval mode"), | ||
| 1167 | #ifdef HAVE_LIBPFM | 1169 | #ifdef HAVE_LIBPFM |
| 1168 | OPT_CALLBACK(0, "pfm-events", &evsel_list, "event", | 1170 | OPT_CALLBACK(0, "pfm-events", &evsel_list, "event", |
| 1169 | "libpfm4 event selector. use 'perf list' to list available events", | 1171 | "libpfm4 event selector. use 'perf list' to list available events", |
| @@ -1746,6 +1746,7 @@ int cmd_top(int argc, const char **argv) · 1745 unmodified lines | |||
| 1746 | goto out_delete_evlist; | 1746 | goto out_delete_evlist; |
| 1747 | } | 1747 | } |
| 1748 | 1748 | ||
| 1749 | #ifdef HAVE_LIBBPF_SUPPORT | ||
| 1749 | if (!top.record_opts.no_bpf_event) { | 1750 | if (!top.record_opts.no_bpf_event) { |
| 1750 | top.sb_evlist = evlist__new(); | 1751 | top.sb_evlist = evlist__new(); |
| 1751 | 1752 | ||
| @@ -1759,6 +1760,7 @@ int cmd_top(int argc, const char **argv) · 7 unmodified lines | |||
| 1759 | goto out_delete_evlist; | 1760 | goto out_delete_evlist; |
| 1760 | } | 1761 | } |
| 1761 | } | 1762 | } |
| 1763 | #endif | ||
| 1762 | 1764 | ||
| 1763 | if (perf_evlist__start_sb_thread(top.sb_evlist, target)) { | 1765 | if (perf_evlist__start_sb_thread(top.sb_evlist, target)) { |
| 1764 | pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n"); | 1766 | pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n"); |
| @@ -137,7 +137,7 @@ static char *fixregex(char *s) · 136 unmodified lines | |||
| 137 | return s; | 137 | return s; |
| 138 | 138 | ||
| 139 | /* allocate space for a new string */ | 139 | /* allocate space for a new string */ |
| 140 | fixed = (char *) malloc(len + 1); | 140 | fixed = (char *) malloc(len + esc_count + 1); |
| 141 | if (!fixed) | 141 | if (!fixed) |
| 142 | return NULL; | 142 | return NULL; |
| 143 | 143 | ||
| @@ -197,7 +197,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void), · 196 unmodified lines | |||
| 197 | perf_mmap__read_done(&md->core); | 197 | perf_mmap__read_done(&md->core); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | if (count != expect) { | 200 | if (count != expect * evlist->core.nr_entries) { |
| 201 | pr_debug("BPF filter result incorrect, expected %d, got %d samples\n", expect, count); | 201 | pr_debug("BPF filter result incorrect, expected %d, got %d samples\n", expect, count); |
| 202 | goto out_delete_evlist; | 202 | goto out_delete_evlist; |
| 203 | } | 203 | } |
| @@ -719,7 +719,7 @@ static int test__group2(struct evlist *evlist) · 718 unmodified lines | |||
| 719 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); | 719 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); |
| 720 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); | 720 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); |
| 721 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); | 721 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); |
| 722 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); | 722 | TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); |
| 723 | TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); | 723 | TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); |
| 724 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); | 724 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); |
| 725 | TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); | 725 | TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); |
| @@ -842,7 +842,7 @@ static int test__group3(struct evlist *evlist __maybe_unused) · 116 unmodified lines | |||
| 842 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); | 842 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); |
| 843 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); | 843 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); |
| 844 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); | 844 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv); |
| 845 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest); | 845 | TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest); |
| 846 | TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); | 846 | TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); |
| 847 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); | 847 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); |
| 848 | TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); | 848 | TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); |
| @@ -70,6 +70,9 @@ static struct pmu_event pme_test[] = { · 69 unmodified lines | |||
| 70 | { | 70 | { |
| 71 | .metric_expr = "1/m3", | 71 | .metric_expr = "1/m3", |
| 72 | .metric_name = "M3", | 72 | .metric_name = "M3", |
| 73 | }, | ||
| 74 | { | ||
| 75 | .name = NULL, | ||
| 73 | } | 76 | } |
| 74 | }; | 77 | }; |
| 75 | 78 | ||
| @@ -3629,8 +3629,8 @@ int perf_evlist__tui_browse_hists(struct evlist *evlist, const char *help, · 3628 unmodified lines | |||
| 3629 | { | 3629 | { |
| 3630 | int nr_entries = evlist->core.nr_entries; | 3630 | int nr_entries = evlist->core.nr_entries; |
| 3631 | 3631 | ||
| 3632 | single_entry: | ||
| 3633 | if (perf_evlist__single_entry(evlist)) { | 3632 | if (perf_evlist__single_entry(evlist)) { |
| 3633 | single_entry: { | ||
| 3634 | struct evsel *first = evlist__first(evlist); | 3634 | struct evsel *first = evlist__first(evlist); |
| 3635 | 3635 | ||
| 3636 | return perf_evsel__hists_browse(first, nr_entries, help, | 3636 | return perf_evsel__hists_browse(first, nr_entries, help, |
| @@ -3638,6 +3638,7 @@ single_entry: · 1 unmodified line | |||
| 3638 | env, warn_lost_event, | 3638 | env, warn_lost_event, |
| 3639 | annotation_opts); | 3639 | annotation_opts); |
| 3640 | } | 3640 | } |
| 3641 | } | ||
| 3641 | 3642 | ||
| 3642 | if (symbol_conf.event_group) { | 3643 | if (symbol_conf.event_group) { |
| 3643 | struct evsel *pos; | 3644 | struct evsel *pos; |
| @@ -182,15 +182,15 @@ static int arm_spe_read_record(struct arm_spe_decoder *decoder) · 181 unmodified lines | |||
| 182 | if (payload & BIT(EV_TLB_ACCESS)) | 182 | if (payload & BIT(EV_TLB_ACCESS)) |
| 183 | decoder->record.type |= ARM_SPE_TLB_ACCESS; | 183 | decoder->record.type |= ARM_SPE_TLB_ACCESS; |
| 184 | 184 | ||
| 185 | if ((idx == 1 || idx == 2 || idx == 3) && | 185 | if ((idx == 2 || idx == 4 || idx == 8) && |
| 186 | (payload & BIT(EV_LLC_MISS))) | 186 | (payload & BIT(EV_LLC_MISS))) |
| 187 | decoder->record.type |= ARM_SPE_LLC_MISS; | 187 | decoder->record.type |= ARM_SPE_LLC_MISS; |
| 188 | 188 | ||
| 189 | if ((idx == 1 || idx == 2 || idx == 3) && | 189 | if ((idx == 2 || idx == 4 || idx == 8) && |
| 190 | (payload & BIT(EV_LLC_ACCESS))) | 190 | (payload & BIT(EV_LLC_ACCESS))) |
| 191 | decoder->record.type |= ARM_SPE_LLC_ACCESS; | 191 | decoder->record.type |= ARM_SPE_LLC_ACCESS; |
| 192 | 192 | ||
| 193 | if ((idx == 1 || idx == 2 || idx == 3) && | 193 | if ((idx == 2 || idx == 4 || idx == 8) && |
| 194 | (payload & BIT(EV_REMOTE_ACCESS))) | 194 | (payload & BIT(EV_REMOTE_ACCESS))) |
| 195 | decoder->record.type |= ARM_SPE_REMOTE_ACCESS; | 195 | decoder->record.type |= ARM_SPE_REMOTE_ACCESS; |
| 196 | 196 | ||
| @@ -1344,8 +1344,15 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · 1343 unmodified lines | |||
| 1344 | attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR; | 1344 | attr.sample_type &= ~(u64)PERF_SAMPLE_ADDR; |
| 1345 | } | 1345 | } |
| 1346 | 1346 | ||
| 1347 | if (etm->synth_opts.last_branch) | 1347 | if (etm->synth_opts.last_branch) { |
| 1348 | attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; | 1348 | attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; |
| 1349 | /* | ||
| 1350 | * We don't use the hardware index, but the sample generation | ||
| 1351 | * code uses the new format branch_stack with this field, | ||
| 1352 | * so the event attributes must indicate that it's present. | ||
| 1353 | */ | ||
| 1354 | attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX; | ||
| 1355 | } | ||
| 1349 | 1356 | ||
| 1350 | if (etm->synth_opts.instructions) { | 1357 | if (etm->synth_opts.instructions) { |
| 1351 | attr.config = PERF_COUNT_HW_INSTRUCTIONS; | 1358 | attr.config = PERF_COUNT_HW_INSTRUCTIONS; |
| @@ -3017,8 +3017,15 @@ static int intel_pt_synth_events(struct intel_pt *pt, · 3016 unmodified lines | |||
| 3017 | 3017 | ||
| 3018 | if (pt->synth_opts.callchain) | 3018 | if (pt->synth_opts.callchain) |
| 3019 | attr.sample_type |= PERF_SAMPLE_CALLCHAIN; | 3019 | attr.sample_type |= PERF_SAMPLE_CALLCHAIN; |
| 3020 | if (pt->synth_opts.last_branch) | 3020 | if (pt->synth_opts.last_branch) { |
| 3021 | attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; | 3021 | attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; |
| 3022 | /* | ||
| 3023 | * We don't use the hardware index, but the sample generation | ||
| 3024 | * code uses the new format branch_stack with this field, | ||
| 3025 | * so the event attributes must indicate that it's present. | ||
| 3026 | */ | ||
| 3027 | attr.branch_sample_type |= PERF_SAMPLE_BRANCH_HW_INDEX; | ||
| 3028 | } | ||
| 3022 | 3029 | ||
| 3023 | if (pt->synth_opts.instructions) { | 3030 | if (pt->synth_opts.instructions) { |
| 3024 | attr.config = PERF_COUNT_HW_INSTRUCTIONS; | 3031 | attr.config = PERF_COUNT_HW_INSTRUCTIONS; |
| @@ -736,12 +736,6 @@ int machine__process_switch_event(struct machine *machine __maybe_unused, · 735 unmodified lines | |||
| 736 | return 0; | 736 | return 0; |
| 737 | } | 737 | } |
| 738 | 738 | ||
| 739 | static int is_bpf_image(const char *name) | ||
| 740 | { | ||
| 741 | return strncmp(name, "bpf_trampoline_", sizeof("bpf_trampoline_") - 1) == 0 || | ||
| 742 | strncmp(name, "bpf_dispatcher_", sizeof("bpf_dispatcher_") - 1) == 0; | ||
| 743 | } | ||
| 744 | |||
| 745 | static int machine__process_ksymbol_register(struct machine *machine, | 739 | static int machine__process_ksymbol_register(struct machine *machine, |
| 746 | union perf_event *event, | 740 | union perf_event *event, |
| 747 | struct perf_sample *sample __maybe_unused) | 741 | struct perf_sample *sample __maybe_unused) |
| @@ -267,6 +267,22 @@ bool __map__is_bpf_prog(const struct map *map) · 266 unmodified lines | |||
| 267 | return name && (strstr(name, "bpf_prog_") == name); | 267 | return name && (strstr(name, "bpf_prog_") == name); |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | bool __map__is_bpf_image(const struct map *map) | ||
| 271 | { | ||
| 272 | const char *name; | ||
| 273 | |||
| 274 | if (map->dso->binary_type == DSO_BINARY_TYPE__BPF_IMAGE) | ||
| 275 | return true; | ||
| 276 | |||
| 277 | /* | ||
| 278 | * If PERF_RECORD_KSYMBOL is not included, the dso will not have | ||
| 279 | * type of DSO_BINARY_TYPE__BPF_IMAGE. In such cases, we can | ||
| 280 | * guess the type based on name. | ||
| 281 | */ | ||
| 282 | name = map->dso->short_name; | ||
| 283 | return name && is_bpf_image(name); | ||
| 284 | } | ||
| 285 | |||
| 270 | bool __map__is_ool(const struct map *map) | 286 | bool __map__is_ool(const struct map *map) |
| 271 | { | 287 | { |
| 272 | return map->dso && map->dso->binary_type == DSO_BINARY_TYPE__OOL; | 288 | return map->dso && map->dso->binary_type == DSO_BINARY_TYPE__OOL; |
| @@ -147,12 +147,14 @@ int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, · 146 unmodified lines | |||
| 147 | bool __map__is_kernel(const struct map *map); | 147 | bool __map__is_kernel(const struct map *map); |
| 148 | bool __map__is_extra_kernel_map(const struct map *map); | 148 | bool __map__is_extra_kernel_map(const struct map *map); |
| 149 | bool __map__is_bpf_prog(const struct map *map); | 149 | bool __map__is_bpf_prog(const struct map *map); |
| 150 | bool __map__is_bpf_image(const struct map *map); | ||
| 150 | bool __map__is_ool(const struct map *map); | 151 | bool __map__is_ool(const struct map *map); |
| 151 | 152 | ||
| 152 | static inline bool __map__is_kmodule(const struct map *map) | 153 | static inline bool __map__is_kmodule(const struct map *map) |
| 153 | { | 154 | { |
| 154 | return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map) && | 155 | return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map) && |
| 155 | !__map__is_bpf_prog(map) && !__map__is_ool(map); | 156 | !__map__is_bpf_prog(map) && !__map__is_ool(map) && |
| 157 | !__map__is_bpf_image(map); | ||
| 156 | } | 158 | } |
| 157 | 159 | ||
| 158 | bool map__has_symbols(const struct map *map); | 160 | bool map__has_symbols(const struct map *map); |
| @@ -164,4 +166,9 @@ static inline bool is_entry_trampoline(const char *name) · 5 unmodified lines | |||
| 164 | return !strcmp(name, ENTRY_TRAMPOLINE_NAME); | 166 | return !strcmp(name, ENTRY_TRAMPOLINE_NAME); |
| 165 | } | 167 | } |
| 166 | 168 | ||
| 169 | static inline bool is_bpf_image(const char *name) | ||
| 170 | { | ||
| 171 | return strncmp(name, "bpf_trampoline_", sizeof("bpf_trampoline_") - 1) == 0 || | ||
| 172 | strncmp(name, "bpf_dispatcher_", sizeof("bpf_dispatcher_") - 1) == 0; | ||
| 173 | } | ||
| 167 | #endif /* __PERF_MAP_H */ | 174 | #endif /* __PERF_MAP_H */ |
| @@ -37,6 +37,7 @@ · 36 unmodified lines | |||
| 37 | #include "util/evsel_config.h" | 37 | #include "util/evsel_config.h" |
| 38 | #include "util/event.h" | 38 | #include "util/event.h" |
| 39 | #include "util/pfm.h" | 39 | #include "util/pfm.h" |
| 40 | #include "perf.h" | ||
| 40 | 41 | ||
| 41 | #define MAX_NAME_LEN 100 | 42 | #define MAX_NAME_LEN 100 |
| 42 | 43 | ||
| @@ -1533,19 +1534,23 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, · 1490 unmodified lines | |||
| 1533 | evsel = __add_event(list, &parse_state->idx, &attr, true, | 1534 | evsel = __add_event(list, &parse_state->idx, &attr, true, |
| 1534 | get_config_name(head_config), pmu, | 1535 | get_config_name(head_config), pmu, |
| 1535 | &config_terms, auto_merge_stats, NULL); | 1536 | &config_terms, auto_merge_stats, NULL); |
| 1536 | if (evsel) { | 1537 | if (!evsel) |
| 1537 | evsel->unit = info.unit; | 1538 | return -ENOMEM; |
| 1538 | evsel->scale = info.scale; | 1539 | |
| 1539 | evsel->per_pkg = info.per_pkg; | 1540 | evsel->pmu_name = name ? strdup(name) : NULL; |
| 1540 | evsel->snapshot = info.snapshot; | 1541 | evsel->use_uncore_alias = use_uncore_alias; |
| 1541 | evsel->metric_expr = info.metric_expr; | 1542 | evsel->percore = config_term_percore(&evsel->config_terms); |
| 1542 | evsel->metric_name = info.metric_name; | ||
| 1543 | evsel->pmu_name = name ? strdup(name) : NULL; | ||
| 1544 | evsel->use_uncore_alias = use_uncore_alias; | ||
| 1545 | evsel->percore = config_term_percore(&evsel->config_terms); | ||
| 1546 | } | ||
| 1547 | 1543 | ||
| 1548 | return evsel ? 0 : -ENOMEM; | 1544 | if (parse_state->fake_pmu) |
| 1545 | return 0; | ||
| 1546 | |||
| 1547 | evsel->unit = info.unit; | ||
| 1548 | evsel->scale = info.scale; | ||
| 1549 | evsel->per_pkg = info.per_pkg; | ||
| 1550 | evsel->snapshot = info.snapshot; | ||
| 1551 | evsel->metric_expr = info.metric_expr; | ||
| 1552 | evsel->metric_name = info.metric_name; | ||
| 1553 | return 0; | ||
| 1549 | } | 1554 | } |
| 1550 | 1555 | ||
| 1551 | int parse_events_multi_pmu_add(struct parse_events_state *parse_state, | 1556 | int parse_events_multi_pmu_add(struct parse_events_state *parse_state, |
| @@ -1794,6 +1799,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str, · 242 unmodified lines | |||
| 1794 | if (*str == 'u') { | 1799 | if (*str == 'u') { |
| 1795 | if (!exclude) | 1800 | if (!exclude) |
| 1796 | exclude = eu = ek = eh = 1; | 1801 | exclude = eu = ek = eh = 1; |
| 1802 | if (!exclude_GH && !perf_guest) | ||
| 1803 | eG = 1; | ||
| 1797 | eu = 0; | 1804 | eu = 0; |
| 1798 | } else if (*str == 'k') { | 1805 | } else if (*str == 'k') { |
| 1799 | if (!exclude) | 1806 | if (!exclude) |
| @@ -511,7 +511,7 @@ PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc · 510 unmodified lines | |||
| 511 | list = alloc_list(); | 511 | list = alloc_list(); |
| 512 | ABORT_ON(!list); | 512 | ABORT_ON(!list); |
| 513 | err = parse_events_add_breakpoint(list, &parse_state->idx, | 513 | err = parse_events_add_breakpoint(list, &parse_state->idx, |
| 514 | (void *) $2, $6, $4); | 514 | (void *)(uintptr_t) $2, $6, $4); |
| 515 | free($6); | 515 | free($6); |
| 516 | if (err) { | 516 | if (err) { |
| 517 | free(list); | 517 | free(list); |
| @@ -528,7 +528,7 @@ PE_PREFIX_MEM PE_VALUE '/' PE_VALUE sep_dc · 10 unmodified lines | |||
| 528 | list = alloc_list(); | 528 | list = alloc_list(); |
| 529 | ABORT_ON(!list); | 529 | ABORT_ON(!list); |
| 530 | if (parse_events_add_breakpoint(list, &parse_state->idx, | 530 | if (parse_events_add_breakpoint(list, &parse_state->idx, |
| 531 | (void *) $2, NULL, $4)) { | 531 | (void *)(uintptr_t) $2, NULL, $4)) { |
| 532 | free(list); | 532 | free(list); |
| 533 | YYABORT; | 533 | YYABORT; |
| 534 | } | 534 | } |
| @@ -544,7 +544,7 @@ PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc · 9 unmodified lines | |||
| 544 | list = alloc_list(); | 544 | list = alloc_list(); |
| 545 | ABORT_ON(!list); | 545 | ABORT_ON(!list); |
| 546 | err = parse_events_add_breakpoint(list, &parse_state->idx, | 546 | err = parse_events_add_breakpoint(list, &parse_state->idx, |
| 547 | (void *) $2, $4, 0); | 547 | (void *)(uintptr_t) $2, $4, 0); |
| 548 | free($4); | 548 | free($4); |
| 549 | if (err) { | 549 | if (err) { |
| 550 | free(list); | 550 | free(list); |
| @@ -561,7 +561,7 @@ PE_PREFIX_MEM PE_VALUE sep_dc · 10 unmodified lines | |||
| 561 | list = alloc_list(); | 561 | list = alloc_list(); |
| 562 | ABORT_ON(!list); | 562 | ABORT_ON(!list); |
| 563 | if (parse_events_add_breakpoint(list, &parse_state->idx, | 563 | if (parse_events_add_breakpoint(list, &parse_state->idx, |
| 564 | (void *) $2, NULL, 0)) { | 564 | (void *)(uintptr_t) $2, NULL, 0)) { |
| 565 | free(list); | 565 | free(list); |
| 566 | YYABORT; | 566 | YYABORT; |
| 567 | } | 567 | } |
| @@ -87,7 +87,7 @@ static int perf_session__process_compressed_event(struct perf_session *session, · 86 unmodified lines | |||
| 87 | session->decomp_last = decomp; | 87 | session->decomp_last = decomp; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | pr_debug("decomp (B): %ld to %ld\n", src_size, decomp_size); | 90 | pr_debug("decomp (B): %zd to %zd\n", src_size, decomp_size); |
| 91 | 91 | ||
| 92 | return 0; | 92 | return 0; |
| 93 | } | 93 | } |
| @@ -117,7 +117,7 @@ static void aggr_printout(struct perf_stat_config *config, · 116 unmodified lines | |||
| 117 | cpu_map__id_to_die(id), | 117 | cpu_map__id_to_die(id), |
| 118 | config->csv_output ? 0 : -3, | 118 | config->csv_output ? 0 : -3, |
| 119 | cpu_map__id_to_cpu(id), config->csv_sep); | 119 | cpu_map__id_to_cpu(id), config->csv_sep); |
| 120 | } else { | 120 | } else if (id > -1) { |
| 121 | fprintf(config->output, "CPU%*d%s", | 121 | fprintf(config->output, "CPU%*d%s", |
| 122 | config->csv_output ? 0 : -7, | 122 | config->csv_output ? 0 : -7, |
| 123 | evsel__cpus(evsel)->map[id], | 123 | evsel__cpus(evsel)->map[id], |
| @@ -113,6 +113,7 @@ struct perf_stat_config { · 112 unmodified lines | |||
| 113 | bool summary; | 113 | bool summary; |
| 114 | bool metric_no_group; | 114 | bool metric_no_group; |
| 115 | bool metric_no_merge; | 115 | bool metric_no_merge; |
| 116 | bool stop_read_counter; | ||
| 116 | FILE *output; | 117 | FILE *output; |
| 117 | unsigned int interval; | 118 | unsigned int interval; |
| 118 | unsigned int timeout; | 119 | unsigned int timeout; |
| @@ -663,6 +663,7 @@ static bool symbol__is_idle(const char *name) · 662 unmodified lines | |||
| 663 | "exit_idle", | 663 | "exit_idle", |
| 664 | "mwait_idle", | 664 | "mwait_idle", |
| 665 | "mwait_idle_with_hints", | 665 | "mwait_idle_with_hints", |
| 666 | "mwait_idle_with_hints.constprop.0", | ||
| 666 | "poll_idle", | 667 | "poll_idle", |
| 667 | "ppc64_runlatch_off", | 668 | "ppc64_runlatch_off", |
| 668 | "pseries_dedicated_idle_sleep", | 669 | "pseries_dedicated_idle_sleep", |
| @@ -99,7 +99,7 @@ size_t zstd_decompress_stream(struct zstd_data *data, void *src, size_t src_size · 98 unmodified lines | |||
| 99 | while (input.pos < input.size) { | 99 | while (input.pos < input.size) { |
| 100 | ret = ZSTD_decompressStream(data->dstream, &output, &input); | 100 | ret = ZSTD_decompressStream(data->dstream, &output, &input); |
| 101 | if (ZSTD_isError(ret)) { | 101 | if (ZSTD_isError(ret)) { |
| 102 | pr_err("failed to decompress (B): %ld -> %ld, dst_size %ld : %s\n", | 102 | pr_err("failed to decompress (B): %zd -> %zd, dst_size %zd : %s\n", |
| 103 | src_size, output.size, dst_size, ZSTD_getErrorName(ret)); | 103 | src_size, output.size, dst_size, ZSTD_getErrorName(ret)); |
| 104 | break; | 104 | break; |
| 105 | } | 105 | } |
| @@ -1274,6 +1274,8 @@ static void __run_parallel(unsigned int tasks, · 1273 unmodified lines | |||
| 1274 | pid_t pid[tasks]; | 1274 | pid_t pid[tasks]; |
| 1275 | int i; | 1275 | int i; |
| 1276 | 1276 | ||
| 1277 | fflush(stdout); | ||
| 1278 | |||
| 1277 | for (i = 0; i < tasks; i++) { | 1279 | for (i = 0; i < tasks; i++) { |
| 1278 | pid[i] = fork(); | 1280 | pid[i] = fork(); |
| 1279 | if (pid[i] == 0) { | 1281 | if (pid[i] == 0) { |
| @@ -618,7 +618,9 @@ int cd_flavor_subdir(const char *exec_name) · 617 unmodified lines | |||
| 618 | if (!flavor) | 618 | if (!flavor) |
| 619 | return 0; | 619 | return 0; |
| 620 | flavor++; | 620 | flavor++; |
| 621 | fprintf(stdout, "Switching to flavor '%s' subdirectory...\n", flavor); | 621 | if (env.verbosity > VERBOSE_NONE) |
| 622 | fprintf(stdout, "Switching to flavor '%s' subdirectory...\n", flavor); | ||
| 623 | |||
| 622 | return chdir(flavor); | 624 | return chdir(flavor); |
| 623 | } | 625 | } |
| 624 | 626 | ||
| @@ -11,7 +11,7 @@ · 10 unmodified lines | |||
| 11 | # result in fragmentation and/or PMTU discovery. | 11 | # result in fragmentation and/or PMTU discovery. |
| 12 | # | 12 | # |
| 13 | # You can check with different Orgininator/Link/Responder MTU eg: | 13 | # You can check with different Orgininator/Link/Responder MTU eg: |
| 14 | # sh nft_flowtable.sh -o1000 -l500 -r100 | 14 | # nft_flowtable.sh -o8000 -l1500 -r2000 |
| 15 | # | 15 | # |
| 16 | 16 | ||
| 17 | 17 | ||
| @@ -27,8 +27,7 @@ ns2out="" · 9 unmodified lines | |||
| 27 | log_netns=$(sysctl -n net.netfilter.nf_log_all_netns) | 27 | log_netns=$(sysctl -n net.netfilter.nf_log_all_netns) |
| 28 | 28 | ||
| 29 | checktool (){ | 29 | checktool (){ |
| 30 | $1 > /dev/null 2>&1 | 30 | if ! $1 > /dev/null 2>&1; then |
| 31 | if [ $? -ne 0 ];then | ||
| 32 | echo "SKIP: Could not $2" | 31 | echo "SKIP: Could not $2" |
| 33 | exit $ksft_skip | 32 | exit $ksft_skip |
| 34 | fi | 33 | fi |
| @@ -87,19 +86,36 @@ omtu=9000 · 52 unmodified lines | |||
| 87 | lmtu=1500 | 86 | lmtu=1500 |
| 88 | rmtu=2000 | 87 | rmtu=2000 |
| 89 | 88 | ||
| 89 | usage(){ | ||
| 90 | echo "nft_flowtable.sh [OPTIONS]" | ||
| 91 | echo | ||
| 92 | echo "MTU options" | ||
| 93 | echo " -o originator" | ||
| 94 | echo " -l link" | ||
| 95 | echo " -r responder" | ||
| 96 | exit 1 | ||
| 97 | } | ||
| 98 | |||
| 90 | while getopts "o:l:r:" o | 99 | while getopts "o:l:r:" o |
| 91 | do | 100 | do |
| 92 | case $o in | 101 | case $o in |
| 93 | o) omtu=$OPTARG;; | 102 | o) omtu=$OPTARG;; |
| 94 | l) lmtu=$OPTARG;; | 103 | l) lmtu=$OPTARG;; |
| 95 | r) rmtu=$OPTARG;; | 104 | r) rmtu=$OPTARG;; |
| 105 | *) usage;; | ||
| 96 | esac | 106 | esac |
| 97 | done | 107 | done |
| 98 | 108 | ||
| 99 | ip -net nsr1 link set veth0 mtu $omtu | 109 | if ! ip -net nsr1 link set veth0 mtu $omtu; then |
| 110 | exit 1 | ||
| 111 | fi | ||
| 112 | |||
| 100 | ip -net ns1 link set eth0 mtu $omtu | 113 | ip -net ns1 link set eth0 mtu $omtu |
| 101 | 114 | ||
| 102 | ip -net nsr2 link set veth1 mtu $rmtu | 115 | if ! ip -net nsr2 link set veth1 mtu $rmtu; then |
| 116 | exit 1 | ||
| 117 | fi | ||
| 118 | |||
| 103 | ip -net ns2 link set eth0 mtu $rmtu | 119 | ip -net ns2 link set eth0 mtu $rmtu |
| 104 | 120 | ||
| 105 | # transfer-net between nsr1 and nsr2. | 121 | # transfer-net between nsr1 and nsr2. |
| @@ -120,7 +136,10 @@ for i in 1 2; do · 14 unmodified lines | |||
| 120 | ip -net ns$i route add default via 10.0.$i.1 | 136 | ip -net ns$i route add default via 10.0.$i.1 |
| 121 | ip -net ns$i addr add dead:$i::99/64 dev eth0 | 137 | ip -net ns$i addr add dead:$i::99/64 dev eth0 |
| 122 | ip -net ns$i route add default via dead:$i::1 | 138 | ip -net ns$i route add default via dead:$i::1 |
| 123 | ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null | 139 | if ! ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null; then |
| 140 | echo "ERROR: Check Originator/Responder values (problem during address addition)" | ||
| 141 | exit 1 | ||
| 142 | fi | ||
| 124 | 143 | ||
| 125 | # don't set ip DF bit for first two tests | 144 | # don't set ip DF bit for first two tests |
| 126 | ip netns exec ns$i sysctl net.ipv4.ip_no_pmtu_disc=1 > /dev/null | 145 | ip netns exec ns$i sysctl net.ipv4.ip_no_pmtu_disc=1 > /dev/null |
| @@ -178,15 +197,13 @@ if [ $? -ne 0 ]; then · 51 unmodified lines | |||
| 178 | fi | 197 | fi |
| 179 | 198 | ||
| 180 | # test basic connectivity | 199 | # test basic connectivity |
| 181 | ip netns exec ns1 ping -c 1 -q 10.0.2.99 > /dev/null | 200 | if ! ip netns exec ns1 ping -c 1 -q 10.0.2.99 > /dev/null; then |
| 182 | if [ $? -ne 0 ];then | ||
| 183 | echo "ERROR: ns1 cannot reach ns2" 1>&2 | 201 | echo "ERROR: ns1 cannot reach ns2" 1>&2 |
| 184 | bash | 202 | bash |
| 185 | exit 1 | 203 | exit 1 |
| 186 | fi | 204 | fi |
| 187 | 205 | ||
| 188 | ip netns exec ns2 ping -c 1 -q 10.0.1.99 > /dev/null | 206 | if ! ip netns exec ns2 ping -c 1 -q 10.0.1.99 > /dev/null; then |
| 189 | if [ $? -ne 0 ];then | ||
| 190 | echo "ERROR: ns2 cannot reach ns1" 1>&2 | 207 | echo "ERROR: ns2 cannot reach ns1" 1>&2 |
| 191 | exit 1 | 208 | exit 1 |
| 192 | fi | 209 | fi |
| @@ -203,7 +220,6 @@ ns2out=$(mktemp) · 10 unmodified lines | |||
| 203 | make_file() | 220 | make_file() |
| 204 | { | 221 | { |
| 205 | name=$1 | 222 | name=$1 |
| 206 | who=$2 | ||
| 207 | 223 | ||
| 208 | SIZE=$((RANDOM % (1024 * 8))) | 224 | SIZE=$((RANDOM % (1024 * 8))) |
| 209 | TSIZE=$((SIZE * 1024)) | 225 | TSIZE=$((SIZE * 1024)) |
| @@ -222,8 +238,7 @@ check_transfer() · 12 unmodified lines | |||
| 222 | out=$2 | 238 | out=$2 |
| 223 | what=$3 | 239 | what=$3 |
| 224 | 240 | ||
| 225 | cmp "$in" "$out" > /dev/null 2>&1 | 241 | if ! cmp "$in" "$out" > /dev/null 2>&1; then |
| 226 | if [ $? -ne 0 ] ;then | ||
| 227 | echo "FAIL: file mismatch for $what" 1>&2 | 242 | echo "FAIL: file mismatch for $what" 1>&2 |
| 228 | ls -l "$in" | 243 | ls -l "$in" |
| 229 | ls -l "$out" | 244 | ls -l "$out" |
| @@ -260,13 +275,11 @@ test_tcp_forwarding_ip() · 30 unmodified lines | |||
| 260 | 275 | ||
| 261 | wait | 276 | wait |
| 262 | 277 | ||
| 263 | check_transfer "$ns1in" "$ns2out" "ns1 -> ns2" | 278 | if ! check_transfer "$ns1in" "$ns2out" "ns1 -> ns2"; then |
| 264 | if [ $? -ne 0 ];then | ||
| 265 | lret=1 | 279 | lret=1 |
| 266 | fi | 280 | fi |
| 267 | 281 | ||
| 268 | check_transfer "$ns2in" "$ns1out" "ns1 <- ns2" | 282 | if ! check_transfer "$ns2in" "$ns1out" "ns1 <- ns2"; then |
| 269 | if [ $? -ne 0 ];then | ||
| 270 | lret=1 | 283 | lret=1 |
| 271 | fi | 284 | fi |
| 272 | 285 | ||
| @@ -295,13 +308,12 @@ test_tcp_forwarding_nat() · 22 unmodified lines | |||
| 295 | return $lret | 308 | return $lret |
| 296 | } | 309 | } |
| 297 | 310 | ||
| 298 | make_file "$ns1in" "ns1" | 311 | make_file "$ns1in" |
| 299 | make_file "$ns2in" "ns2" | 312 | make_file "$ns2in" |
| 300 | 313 | ||
| 301 | # First test: | 314 | # First test: |
| 302 | # No PMTU discovery, nsr1 is expected to fragment packets from ns1 to ns2 as needed. | 315 | # No PMTU discovery, nsr1 is expected to fragment packets from ns1 to ns2 as needed. |
| 303 | test_tcp_forwarding ns1 ns2 | 316 | if test_tcp_forwarding ns1 ns2; then |
| 304 | if [ $? -eq 0 ] ;then | ||
| 305 | echo "PASS: flow offloaded for ns1/ns2" | 317 | echo "PASS: flow offloaded for ns1/ns2" |
| 306 | else | 318 | else |
| 307 | echo "FAIL: flow offload for ns1/ns2:" 1>&2 | 319 | echo "FAIL: flow offload for ns1/ns2:" 1>&2 |
| @@ -332,9 +344,7 @@ table ip nat { · 24 unmodified lines | |||
| 332 | } | 344 | } |
| 333 | EOF | 345 | EOF |
| 334 | 346 | ||
| 335 | test_tcp_forwarding_nat ns1 ns2 | 347 | if test_tcp_forwarding_nat ns1 ns2; then |
| 336 | |||
| 337 | if [ $? -eq 0 ] ;then | ||
| 338 | echo "PASS: flow offloaded for ns1/ns2 with NAT" | 348 | echo "PASS: flow offloaded for ns1/ns2 with NAT" |
| 339 | else | 349 | else |
| 340 | echo "FAIL: flow offload for ns1/ns2 with NAT" 1>&2 | 350 | echo "FAIL: flow offload for ns1/ns2 with NAT" 1>&2 |
| @@ -346,8 +356,7 @@ fi · 5 unmodified lines | |||
| 346 | # Same as second test, but with PMTU discovery enabled. | 356 | # Same as second test, but with PMTU discovery enabled. |
| 347 | handle=$(ip netns exec nsr1 nft -a list table inet filter | grep something-to-grep-for | cut -d \# -f 2) | 357 | handle=$(ip netns exec nsr1 nft -a list table inet filter | grep something-to-grep-for | cut -d \# -f 2) |
| 348 | 358 | ||
| 349 | ip netns exec nsr1 nft delete rule inet filter forward $handle | 359 | if ! ip netns exec nsr1 nft delete rule inet filter forward $handle; then |
| 350 | if [ $? -ne 0 ] ;then | ||
| 351 | echo "FAIL: Could not delete large-packet accept rule" | 360 | echo "FAIL: Could not delete large-packet accept rule" |
| 352 | exit 1 | 361 | exit 1 |
| 353 | fi | 362 | fi |
| @@ -355,8 +364,7 @@ fi · 1 unmodified line | |||
| 355 | ip netns exec ns1 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null | 364 | ip netns exec ns1 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null |
| 356 | ip netns exec ns2 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null | 365 | ip netns exec ns2 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null |
| 357 | 366 | ||
| 358 | test_tcp_forwarding_nat ns1 ns2 | 367 | if test_tcp_forwarding_nat ns1 ns2; then |
| 359 | if [ $? -eq 0 ] ;then | ||
| 360 | echo "PASS: flow offloaded for ns1/ns2 with NAT and pmtu discovery" | 368 | echo "PASS: flow offloaded for ns1/ns2 with NAT and pmtu discovery" |
| 361 | else | 369 | else |
| 362 | echo "FAIL: flow offload for ns1/ns2 with NAT and pmtu discovery" 1>&2 | 370 | echo "FAIL: flow offload for ns1/ns2 with NAT and pmtu discovery" 1>&2 |
| @@ -402,8 +410,7 @@ ip -net ns2 route del 192.168.10.1 via 10.0.2.1 · 39 unmodified lines | |||
| 402 | ip -net ns2 route add default via 10.0.2.1 | 410 | ip -net ns2 route add default via 10.0.2.1 |
| 403 | ip -net ns2 route add default via dead:2::1 | 411 | ip -net ns2 route add default via dead:2::1 |
| 404 | 412 | ||
| 405 | test_tcp_forwarding ns1 ns2 | 413 | if test_tcp_forwarding ns1 ns2; then |
| 406 | if [ $? -eq 0 ] ;then | ||
| 407 | echo "PASS: ipsec tunnel mode for ns1/ns2" | 414 | echo "PASS: ipsec tunnel mode for ns1/ns2" |
| 408 | else | 415 | else |
| 409 | echo "FAIL: ipsec tunnel mode for ns1/ns2" | 416 | echo "FAIL: ipsec tunnel mode for ns1/ns2" |
| @@ -13,6 +13,7 @@ DESTRUCTIVE_TESTS = alarmtimer-suspend valid-adjtimex adjtick change_skew \ · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | TEST_GEN_PROGS_EXTENDED = $(DESTRUCTIVE_TESTS) | 14 | TEST_GEN_PROGS_EXTENDED = $(DESTRUCTIVE_TESTS) |
| 15 | 15 | ||
| 16 | TEST_FILES := settings | ||
| 16 | 17 | ||
| 17 | include ../lib.mk | 18 | include ../lib.mk |
| 18 | 19 | ||
| @@ -0,0 +1 @@ | |||
| 1 | timeout=0 | ||
| @@ -462,6 +462,17 @@ static int test_vsys_x(void) · 461 unmodified lines | |||
| 462 | return 0; | 462 | return 0; |
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | /* | ||
| 466 | * Debuggers expect ptrace() to be able to peek at the vsyscall page. | ||
| 467 | * Use process_vm_readv() as a proxy for ptrace() to test this. We | ||
| 468 | * want it to work in the vsyscall=emulate case and to fail in the | ||
| 469 | * vsyscall=xonly case. | ||
| 470 | * | ||
| 471 | * It's worth noting that this ABI is a bit nutty. write(2) can't | ||
| 472 | * read from the vsyscall page on any kernel version or mode. The | ||
| 473 | * fact that ptrace() ever worked was a nice courtesy of old kernels, | ||
| 474 | * but the code to support it is fairly gross. | ||
| 475 | */ | ||
| 465 | static int test_process_vm_readv(void) | 476 | static int test_process_vm_readv(void) |
| 466 | { | 477 | { |
| 467 | #ifdef __x86_64__ | 478 | #ifdef __x86_64__ |
| @@ -477,8 +488,12 @@ static int test_process_vm_readv(void) · 9 unmodified lines | |||
| 477 | remote.iov_len = 4096; | 488 | remote.iov_len = 4096; |
| 478 | ret = process_vm_readv(getpid(), &local, 1, &remote, 1, 0); | 489 | ret = process_vm_readv(getpid(), &local, 1, &remote, 1, 0); |
| 479 | if (ret != 4096) { | 490 | if (ret != 4096) { |
| 480 | printf("[OK]\tprocess_vm_readv() failed (ret = %d, errno = %d)\n", ret, errno); | 491 | /* |
| 481 | return 0; | 492 | * We expect process_vm_readv() to work if and only if the |
| 493 | * vsyscall page is readable. | ||
| 494 | */ | ||
| 495 | printf("[%s]\tprocess_vm_readv() failed (ret = %d, errno = %d)\n", vsyscall_map_r ? "FAIL" : "OK", ret, errno); | ||
| 496 | return vsyscall_map_r ? 1 : 0; | ||
| 482 | } | 497 | } |
| 483 | 498 | ||
| 484 | if (vsyscall_map_r) { | 499 | if (vsyscall_map_r) { |
| @@ -488,6 +503,9 @@ static int test_process_vm_readv(void) · 3 unmodified lines | |||
| 488 | printf("[FAIL]\tIt worked but returned incorrect data\n"); | 503 | printf("[FAIL]\tIt worked but returned incorrect data\n"); |
| 489 | return 1; | 504 | return 1; |
| 490 | } | 505 | } |
| 506 | } else { | ||
| 507 | printf("[FAIL]\tprocess_rm_readv() succeeded, but it should have failed in this configuration\n"); | ||
| 508 | return 1; | ||
| 491 | } | 509 | } |
| 492 | #endif | 510 | #endif |
| 493 | 511 | ||
| @@ -4332,7 +4332,7 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr, · 4331 unmodified lines | |||
| 4332 | void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, | 4332 | void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, |
| 4333 | struct kvm_io_device *dev) | 4333 | struct kvm_io_device *dev) |
| 4334 | { | 4334 | { |
| 4335 | int i; | 4335 | int i, j; |
| 4336 | struct kvm_io_bus *new_bus, *bus; | 4336 | struct kvm_io_bus *new_bus, *bus; |
| 4337 | 4337 | ||
| 4338 | bus = kvm_get_bus(kvm, bus_idx); | 4338 | bus = kvm_get_bus(kvm, bus_idx); |
| @@ -4349,17 +4349,20 @@ void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, · 10 unmodified lines | |||
| 4349 | 4349 | ||
| 4350 | new_bus = kmalloc(struct_size(bus, range, bus->dev_count - 1), | 4350 | new_bus = kmalloc(struct_size(bus, range, bus->dev_count - 1), |
| 4351 | GFP_KERNEL_ACCOUNT); | 4351 | GFP_KERNEL_ACCOUNT); |
| 4352 | if (!new_bus) { | 4352 | if (new_bus) { |
| 4353 | memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range)); | ||
| 4354 | new_bus->dev_count--; | ||
| 4355 | memcpy(new_bus->range + i, bus->range + i + 1, | ||
| 4356 | (new_bus->dev_count - i) * sizeof(struct kvm_io_range)); | ||
| 4357 | } else { | ||
| 4353 | pr_err("kvm: failed to shrink bus, removing it completely\n"); | 4358 | pr_err("kvm: failed to shrink bus, removing it completely\n"); |
| 4354 | goto broken; | 4359 | for (j = 0; j < bus->dev_count; j++) { |
| 4360 | if (j == i) | ||
| 4361 | continue; | ||
| 4362 | kvm_iodevice_destructor(bus->range[j].dev); | ||
| 4363 | } | ||
| 4355 | } | 4364 | } |
| 4356 | 4365 | ||
| 4357 | memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range)); | ||
| 4358 | new_bus->dev_count--; | ||
| 4359 | memcpy(new_bus->range + i, bus->range + i + 1, | ||
| 4360 | (new_bus->dev_count - i) * sizeof(struct kvm_io_range)); | ||
| 4361 | |||
| 4362 | broken: | ||
| 4363 | rcu_assign_pointer(kvm->buses[bus_idx], new_bus); | 4366 | rcu_assign_pointer(kvm->buses[bus_idx], new_bus); |
| 4364 | synchronize_srcu_expedited(&kvm->srcu); | 4367 | synchronize_srcu_expedited(&kvm->srcu); |
| 4365 | kfree(bus); | 4368 | kfree(bus); |