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

Merge branch 'mlx5_active_speed' into rdma.git for-next

Leon Romanovsky says:

====================
IBTA declares speed as 16 bits, but kernel stores it in u8. This series
fixes in-kernel declaration while keeping external interface intact.
====================

Based on the mlx5-next branch at
git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux
due to dependencies.

* branch 'mlx5_active_speed':
RDMA: Fix link active_speed size
RDMA/mlx5: Delete duplicated mlx5_ptys_width enum
net/mlx5: Refactor query port speed functions

+5529 -2778
+12
.clang-format
··· 111 111 - 'css_for_each_descendant_pre' 112 112 - 'device_for_each_child_node' 113 113 - 'dma_fence_chain_for_each' 114 + - 'do_for_each_ftrace_op' 114 115 - 'drm_atomic_crtc_for_each_plane' 115 116 - 'drm_atomic_crtc_state_for_each_plane' 116 117 - 'drm_atomic_crtc_state_for_each_plane_state' ··· 137 136 - 'for_each_active_dev_scope' 138 137 - 'for_each_active_drhd_unit' 139 138 - 'for_each_active_iommu' 139 + - 'for_each_aggr_pgid' 140 140 - 'for_each_available_child_of_node' 141 141 - 'for_each_bio' 142 142 - 'for_each_board_func_rsrc' ··· 236 234 - 'for_each_node_state' 237 235 - 'for_each_node_with_cpus' 238 236 - 'for_each_node_with_property' 237 + - 'for_each_nonreserved_multicast_dest_pgid' 239 238 - 'for_each_of_allnodes' 240 239 - 'for_each_of_allnodes_from' 241 240 - 'for_each_of_cpu_node' ··· 259 256 - 'for_each_pci_dev' 260 257 - 'for_each_pci_msi_entry' 261 258 - 'for_each_pcm_streams' 259 + - 'for_each_physmem_range' 262 260 - 'for_each_populated_zone' 263 261 - 'for_each_possible_cpu' 264 262 - 'for_each_present_cpu' ··· 269 265 - 'for_each_process_thread' 270 266 - 'for_each_property_of_node' 271 267 - 'for_each_registered_fb' 268 + - 'for_each_requested_gpio' 269 + - 'for_each_requested_gpio_in_range' 272 270 - 'for_each_reserved_mem_region' 273 271 - 'for_each_rtd_codec_dais' 274 272 - 'for_each_rtd_codec_dais_rollback' ··· 284 278 - 'for_each_sg' 285 279 - 'for_each_sg_dma_page' 286 280 - 'for_each_sg_page' 281 + - 'for_each_sgtable_dma_page' 282 + - 'for_each_sgtable_dma_sg' 283 + - 'for_each_sgtable_page' 284 + - 'for_each_sgtable_sg' 287 285 - 'for_each_sibling_event' 288 286 - 'for_each_subelement' 289 287 - 'for_each_subelement_extid' 290 288 - 'for_each_subelement_id' 291 289 - '__for_each_thread' 292 290 - 'for_each_thread' 291 + - 'for_each_unicast_dest_pgid' 293 292 - 'for_each_wakeup_source' 294 293 - 'for_each_zone' 295 294 - 'for_each_zone_zonelist' ··· 476 465 - 'v4l2_m2m_for_each_src_buf' 477 466 - 'v4l2_m2m_for_each_src_buf_safe' 478 467 - 'virtio_device_for_each_vq' 468 + - 'while_for_each_ftrace_op' 479 469 - 'xa_for_each' 480 470 - 'xa_for_each_marked' 481 471 - 'xa_for_each_range'
+1
.mailmap
··· 308 308 TripleX Chung <xxx.phy@gmail.com> <triplex@zh-kernel.org> 309 309 TripleX Chung <xxx.phy@gmail.com> <zhongyu@18mail.cn> 310 310 Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> 311 + Tycho Andersen <tycho@tycho.pizza> <tycho@tycho.ws> 311 312 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> 312 313 Uwe Kleine-König <ukl@pengutronix.de> 313 314 Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
+1 -1
Documentation/RCU/lockdep.rst
··· 49 49 is invoked by both RCU-sched readers and updaters. 50 50 srcu_dereference_check(p, c): 51 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 53 is invoked by both SRCU readers and updaters. 54 54 rcu_dereference_raw(p): 55 55 Don't check. (Use sparingly, if at all.)
+1 -1
Documentation/admin-guide/devices.txt
··· 1662 1662 1663 1663 98 block User-mode virtual block device 1664 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 1668 Partitions are handled in the same way as for IDE
-1
Documentation/admin-guide/dynamic-debug-howto.rst
··· 156 156 ``line-range`` cannot contain space, e.g. 157 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 160 The meanings of each keyword are: 162 161
+1 -1
Documentation/admin-guide/laptops/thinkpad-acpi.rst
··· 1434 1434 1435 1435 1436 1436 DYTC Lapmode sensor 1437 - ------------------ 1437 + ------------------- 1438 1438 1439 1439 sysfs: dytc_lapmode 1440 1440
+3 -1
Documentation/admin-guide/pm/intel_pstate.rst
··· 123 123 internal P-state selection logic is expected to focus entirely on performance. 124 124 125 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 130 Also, in this configuration the range of P-states available to the processor's 129 131 internal P-state selection logic is always restricted to the upper boundary
+7 -3
Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml
··· 30 30 then: 31 31 properties: 32 32 clock-output-names: 33 - items: 34 - - const: clk_out_sd0 35 - - const: clk_in_sd0 33 + oneOf: 34 + - items: 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 41 properties: 38 42 compatible:
+2
Documentation/devicetree/bindings/mmc/mtk-sd.txt
··· 50 50 error caused by stop clock(fifo full) 51 51 Valid range = [0:0x7]. if not present, default value is 0. 52 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 56 Examples: 55 57 mmc0: mmc@11230000 {
+29 -3
Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt
··· 15 15 - "nvidia,tegra210-sdhci": for Tegra210 16 16 - "nvidia,tegra186-sdhci": for Tegra186 17 17 - "nvidia,tegra194-sdhci": for Tegra194 18 - - clocks : Must contain one entry, for the module clock. 19 - See ../clocks/clock-bindings.txt for details. 18 + - clocks: For Tegra210, Tegra186 and Tegra194 must contain two entries. 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 27 - resets : Must contain an entry for each entry in reset-names. 21 28 See ../reset/reset.txt for details. 22 29 - reset-names : Must include the following entries: ··· 106 99 107 100 Example: 108 101 sdhci@700b0000 { 109 - compatible = "nvidia,tegra210-sdhci", "nvidia,tegra124-sdhci"; 102 + compatible = "nvidia,tegra124-sdhci"; 110 103 reg = <0x0 0x700b0000 0x0 0x200>; 111 104 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 112 105 clocks = <&tegra_car TEGRA210_CLK_SDMMC1>; 113 106 clock-names = "sdhci"; 107 + resets = <&tegra_car 14>; 108 + reset-names = "sdhci"; 109 + pinctrl-names = "sdmmc-3v3", "sdmmc-1v8"; 110 + pinctrl-0 = <&sdmmc1_3v3>; 111 + pinctrl-1 = <&sdmmc1_1v8>; 112 + nvidia,pad-autocal-pull-up-offset-3v3 = <0x00>; 113 + nvidia,pad-autocal-pull-down-offset-3v3 = <0x7d>; 114 + nvidia,pad-autocal-pull-up-offset-1v8 = <0x7b>; 115 + nvidia,pad-autocal-pull-down-offset-1v8 = <0x7b>; 116 + status = "disabled"; 117 + }; 118 + 119 + sdhci@700b0000 { 120 + compatible = "nvidia,tegra210-sdhci"; 121 + reg = <0x0 0x700b0000 0x0 0x200>; 122 + interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 123 + clocks = <&tegra_car TEGRA210_CLK_SDMMC1>, 124 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 125 + clock-names = "sdhci", "tmclk"; 114 126 resets = <&tegra_car 14>; 115 127 reset-names = "sdhci"; 116 128 pinctrl-names = "sdmmc-3v3", "sdmmc-1v8";
+1 -1
Documentation/devicetree/bindings/net/dsa/dsa.txt
··· 1 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.
+8 -8
Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.txt
··· 23 23 24 24 - compatible: 25 25 Must be one of : 26 - "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-qspi" : MSPI+BSPI on BRCMSTB SoCs 27 - "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI 26 + "brcm,spi-brcmstb-qspi", "brcm,spi-bcm-qspi" : MSPI+BSPI on BRCMSTB SoCs 27 + "brcm,spi-brcmstb-mspi", "brcm,spi-bcm-qspi" : Second Instance of MSPI 28 28 BRCMSTB SoCs 29 29 "brcm,spi-bcm7425-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI 30 30 BRCMSTB SoCs ··· 36 36 BRCMSTB SoCs 37 37 "brcm,spi-bcm7278-qspi", "brcm,spi-bcm-qspi", "brcm,spi-brcmstb-mspi" : Second Instance of MSPI 38 38 BRCMSTB SoCs 39 - "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi" : MSPI+BSPI on Cygnus, NSP 40 - "brcm,spi-bcm-qspi", "brcm,spi-ns2-qspi" : NS2 SoCs 39 + "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi" : MSPI+BSPI on Cygnus, NSP 40 + "brcm,spi-ns2-qspi", "brcm,spi-bcm-qspi" : NS2 SoCs 41 41 42 42 - reg: 43 43 Define the bases and ranges of the associated I/O address spaces. ··· 86 86 spi@f03e3400 { 87 87 #address-cells = <0x1>; 88 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 90 reg = <0xf03e0920 0x4 0xf03e3400 0x188 0xf03e3200 0x50>; 91 91 reg-names = "cs_reg", "mspi", "bspi"; 92 92 interrupts = <0x6 0x5 0x4 0x3 0x2 0x1 0x0>; ··· 149 149 #address-cells = <1>; 150 150 #size-cells = <0>; 151 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 153 reg = <0xf0416000 0x180>; 154 154 reg-names = "mspi"; 155 155 interrupts = <0x14>; ··· 160 160 iProc SoC Example: 161 161 162 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 164 reg = <0x18027200 0x184>, 165 165 <0x18027000 0x124>, 166 166 <0x1811c408 0x004>, ··· 191 191 NS2 SoC Example: 192 192 193 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 195 reg = <0x66470200 0x184>, 196 196 <0x66470000 0x124>, 197 197 <0x67017408 0x004>,
+1 -1
Documentation/driver-api/dma-buf.rst
··· 179 179 :internal: 180 180 181 181 Indefinite DMA Fences 182 - ~~~~~~~~~~~~~~~~~~~~ 182 + ~~~~~~~~~~~~~~~~~~~~~ 183 183 184 184 At various times &dma_fence with an indefinite time until dma_fence_wait() 185 185 finishes have been proposed. Examples include:
+3 -3
Documentation/driver-api/fpga/fpga-bridge.rst
··· 6 6 7 7 * struct :c:type:`fpga_bridge` — The FPGA Bridge structure 8 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 10 - * :c:func:`fpga_bridge_register()` — Register a bridge 11 - * :c:func:`fpga_bridge_unregister()` — Unregister a bridge 9 + * devm_fpga_bridge_create() — Allocate and init a bridge struct 10 + * fpga_bridge_register() — Register a bridge 11 + * fpga_bridge_unregister() — Unregister a bridge 12 12 13 13 .. kernel-doc:: include/linux/fpga/fpga-bridge.h 14 14 :functions: fpga_bridge
+3 -3
Documentation/driver-api/fpga/fpga-mgr.rst
··· 104 104 * ``fpga_mgr_states`` — Values for :c:member:`fpga_manager->state`. 105 105 * struct :c:type:`fpga_manager` — the FPGA manager struct 106 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 108 - * :c:func:`fpga_mgr_register` — Register an FPGA manager 109 - * :c:func:`fpga_mgr_unregister` — Unregister an FPGA manager 107 + * devm_fpga_mgr_create() — Allocate and init a manager struct 108 + * fpga_mgr_register() — Register an FPGA manager 109 + * fpga_mgr_unregister() — Unregister an FPGA manager 110 110 111 111 .. kernel-doc:: include/linux/fpga/fpga-mgr.h 112 112 :functions: fpga_mgr_states
+8 -8
Documentation/driver-api/fpga/fpga-programming.rst
··· 6 6 7 7 The in-kernel API for FPGA programming is a combination of APIs from 8 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 12 the FPGA manager and bridges. It will: 13 13 14 14 * lock the region's mutex ··· 20 20 * release the locks 21 21 22 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 24 - :c:func:`fpga_image_info_free()` 23 + allocated/freed by fpga_image_info_alloc() and freed with 24 + fpga_image_info_free() 25 25 26 26 How to program an FPGA using a region 27 27 ------------------------------------- ··· 84 84 API for programming an FPGA 85 85 --------------------------- 86 86 87 - * :c:func:`fpga_region_program_fpga` — Program an FPGA 88 - * :c:type:`fpga_image_info` — Specifies what FPGA image to program 89 - * :c:func:`fpga_image_info_alloc()` — Allocate an FPGA image info struct 90 - * :c:func:`fpga_image_info_free()` — Free an FPGA image info struct 87 + * fpga_region_program_fpga() — Program an FPGA 88 + * fpga_image_info() — Specifies what FPGA image to program 89 + * fpga_image_info_alloc() — Allocate an FPGA image info struct 90 + * fpga_image_info_free() — Free an FPGA image info struct 91 91 92 92 .. kernel-doc:: drivers/fpga/fpga-region.c 93 93 :functions: fpga_region_program_fpga
+9 -9
Documentation/driver-api/fpga/fpga-region.rst
··· 46 46 ---------------------------- 47 47 48 48 * struct :c:type:`fpga_region` — The FPGA region struct 49 - * :c:func:`devm_fpga_region_create` — Allocate and init a region struct 50 - * :c:func:`fpga_region_register` — Register an FPGA region 51 - * :c:func:`fpga_region_unregister` — Unregister an FPGA region 49 + * devm_fpga_region_create() — Allocate and init a region struct 50 + * fpga_region_register() — Register an FPGA region 51 + * fpga_region_unregister() — Unregister an FPGA region 52 52 53 53 The FPGA region's probe function will need to get a reference to the FPGA 54 54 Manager it will be using to do the programming. This usually would happen 55 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 58 - * :c:func:`of_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 + * of_fpga_mgr_get() — Get a reference to an FPGA manager, raise ref count, 59 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 62 The FPGA region will need to specify which bridges to control while programming 63 63 the FPGA. The region driver can build a list of bridges during probe time ··· 66 66 (:c:member:`fpga_region->get_bridges`). The FPGA bridge framework supplies the 67 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 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 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 75 .. kernel-doc:: include/linux/fpga/fpga-region.h 76 76 :functions: fpga_region
+8 -8
Documentation/driver-api/iio/core.rst
··· 11 11 ---------------------- 12 12 13 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 15 - * :c:func:`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 17 - * :c:func:`iio_device_unregister()` - unregister a device from the IIO 14 + * iio_device_alloc() - allocate an :c:type:`iio_dev` from a driver 15 + * iio_device_free() - free an :c:type:`iio_dev` from a driver 16 + * iio_device_register() - register a device with the IIO subsystem 17 + * iio_device_unregister() - unregister a device from the IIO 18 18 subsystem 19 19 20 20 An IIO device usually corresponds to a single hardware sensor and it ··· 34 34 35 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 38 2. Initialize IIO device fields with driver specific information (e.g. 39 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 41 IIO core. After this call the device is ready to accept requests from user 42 42 space applications. 43 43 44 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. 47 - 2. :c:func:`iio_device_free()`, free the memory allocated for the IIO device. 46 + 1. iio_device_unregister(), unregister the device from the IIO core. 47 + 2. iio_device_free(), free the memory allocated for the IIO device. 48 48 49 49 IIO device sysfs interface 50 50 ==========================
+10 -6
Documentation/filesystems/affs.rst
··· 110 110 111 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 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 123 User id and group id will be used unless set[gu]id are given as mount 122 124 options. Since most of the Amiga file systems are single user systems ··· 130 128 131 129 The Linux rwxrwxrwx file mode is handled as follows: 132 130 133 - - r permission will set R for user, group and others. 131 + - r permission will allow R for user, group and others. 134 132 135 - - w permission will set W and D for user, group and others. 133 + - w permission will allow W for user, group and others. 136 134 137 - - x permission of the user will set E for plain files. 135 + - x permission of the user will allow E for plain files. 136 + 137 + - D will be allowed for user, group and others. 138 138 139 139 - All other flags (suid, sgid, ...) are ignored and will 140 140 not be retained.
+3 -3
Documentation/hwmon/abituguru-datasheet.rst
··· 68 68 number of bytes data per sensor and contents/meaning of those bytes. 69 69 70 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 72 bank 0x24 for example the addressing within the bank selects a PWM output not 73 73 a sensor. 74 74 ··· 155 155 turned up which do not hold 0x08 at DATA within 250 reads after writing the 156 156 bank address. With these versions this happens quite frequent, using larger 157 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 159 this and in case of no response in this specific case just goto sleep for a 160 160 while and then retry. 161 161 ··· 331 331 0-0x30 with the reading code used for the sensor banks (0x20-0x28) and this 332 332 resulted in a _permanent_ reprogramming of the voltages, luckily I had the 333 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 335 immediately enter the bios and reload the defaults). This probably means that 336 336 the read/write cycle for the non sensor part is different from the sensor part.
+2 -2
Documentation/hwmon/abituguru.rst
··· 17 17 Note: 18 18 The uGuru is a microcontroller with onboard firmware which programs 19 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 21 Below is an incomplete list with which revisions are used for which 22 22 Motherboards: 23 23 ··· 33 33 sensortype (Volt or Temp) for bank1 sensors, for revision 1 uGuru's 34 34 this does not always work. For these uGuru's the autodetection can 35 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 37 bank1_types=1,1,0,0,0,0,0,2,0,0,0,0,2,0,0,1 38 38 You may also need to specify the fan_sensors option for these boards 39 39 fan_sensors=5
+2 -2
Documentation/hwmon/abituguru3.rst
··· 13 13 Note: 14 14 The uGuru is a microcontroller with onboard firmware which programs 15 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 17 Below is an incomplete list with which revisions are used for which 18 18 Motherboards: 19 19 ··· 24 24 - uGuru 3.0.0.0 ~ 3.0.x.x (AW8, AL8, AT8, NI8 SLI, AT8 32X, AN8 32X, 25 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 28 this driver will not work on older motherboards. For older 29 29 motherboards use the abituguru (without the 3 !) driver. 30 30
+13 -13
Documentation/kbuild/llvm.rst
··· 23 23 Clang 24 24 ----- 25 25 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. 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. :: 28 28 29 29 make CC=clang defconfig 30 30 ··· 34 34 --------------- 35 35 36 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 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 42 - `CROSS_COMPILE` is used to set a command line flag: `--target <triple>`. For 43 - example: 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 43 + example: :: 44 44 45 45 clang --target aarch64-linux-gnu foo.c 46 46 47 47 LLVM Utilities 48 48 -------------- 49 49 50 - LLVM has substitutes for GNU binutils utilities. Kbuild supports `LLVM=1` 51 - to enable them. 50 + LLVM has substitutes for GNU binutils utilities. Kbuild supports ``LLVM=1`` 51 + to enable them. :: 52 52 53 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 \\ 58 - OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size \\ 59 - READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \\ 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 \ 59 + READELF=llvm-readelf HOSTCC=clang HOSTCXX=clang++ HOSTAR=llvm-ar \ 60 60 HOSTLD=ld.lld 61 61 62 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 65 Getting Help 66 66 ------------
+9 -9
Documentation/kbuild/makefiles.rst
··· 16 16 --- 3.5 Library file goals - lib-y 17 17 --- 3.6 Descending down in directories 18 18 --- 3.7 Compilation flags 19 - --- 3.8 Command line dependency 19 + --- 3.8 <deleted> 20 20 --- 3.9 Dependency tracking 21 21 --- 3.10 Special Rules 22 22 --- 3.11 $(CC) support functions ··· 39 39 40 40 === 7 Architecture Makefiles 41 41 --- 7.1 Set variables to tweak the build to the architecture 42 - --- 7.2 Add prerequisites to archheaders: 43 - --- 7.3 Add prerequisites to archprepare: 42 + --- 7.2 Add prerequisites to archheaders 43 + --- 7.3 Add prerequisites to archprepare 44 44 --- 7.4 List directories to visit when descending 45 45 --- 7.5 Architecture-specific boot images 46 46 --- 7.6 Building non-kbuild targets ··· 129 129 be used and if both a 'Makefile' and a 'Kbuild' file exists, then the 'Kbuild' 130 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 133 more details, with real examples. 134 134 135 135 3.1 Goal definitions ··· 965 965 KBUILD_LDFLAGS := -m elf_s390 966 966 967 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 970 LDFLAGS_vmlinux 971 971 Options for $(LD) when linking vmlinux ··· 1121 1121 1122 1122 In this example, the file target maketools will be processed 1123 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 1125 generating offset header files. 1126 1126 1127 1127 ··· 1261 1261 always be built. 1262 1262 Assignments to $(targets) are without $(obj)/ prefix. 1263 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 1266 Note: It is a typical mistake to forget the FORCE prerequisite. 1267 1267 Another common pitfall is that whitespace is sometimes ··· 1411 1411 that may be shared between individual architectures. 1412 1412 The recommended approach how to use a generic header file is 1413 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 1416 7.11 Post-link pass 1417 1417 ------------------- ··· 1601 1601 1602 1602 - Describe how kbuild supports shipped files with _shipped. 1603 1603 - Generating offset header files. 1604 - - Add more variables to section 7? 1604 + - Add more variables to chapters 7 or 9?
+12 -12
Documentation/locking/locktypes.rst
··· 164 164 On non-PREEMPT_RT kernels local_lock operations map to the preemption and 165 165 interrupt disabling and enabling primitives: 166 166 167 - =========================== ====================== 168 - local_lock(&llock) preempt_disable() 169 - local_unlock(&llock) preempt_enable() 170 - local_lock_irq(&llock) local_irq_disable() 171 - local_unlock_irq(&llock) local_irq_enable() 172 - local_lock_save(&llock) local_irq_save() 173 - local_lock_restore(&llock) local_irq_save() 174 - =========================== ====================== 167 + =============================== ====================== 168 + local_lock(&llock) preempt_disable() 169 + local_unlock(&llock) preempt_enable() 170 + local_lock_irq(&llock) local_irq_disable() 171 + local_unlock_irq(&llock) local_irq_enable() 172 + local_lock_irqsave(&llock) local_irq_save() 173 + local_unlock_irqrestore(&llock) local_irq_restore() 174 + =============================== ====================== 175 175 176 176 The named scope of local_lock has two advantages over the regular 177 177 primitives: ··· 353 353 { 354 354 local_irq_save(flags); -> local_lock_irqsave(&local_lock_1, flags); 355 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 359 func2() 360 360 { 361 361 local_irq_save(flags); -> local_lock_irqsave(&local_lock_2, flags); 362 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 366 func3() ··· 379 379 { 380 380 local_irq_save(flags); -> local_lock_irqsave(&local_lock, flags); 381 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 385 func2() 386 386 { 387 387 local_irq_save(flags); -> local_lock_irqsave(&local_lock, flags); 388 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 392 func3()
+1
Documentation/maintainer/maintainer-entry-profile.rst
··· 101 101 102 102 ../doc-guide/maintainer-profile 103 103 ../nvdimm/maintainer-entry-profile 104 + ../riscv/patch-acceptance
+1 -1
Documentation/networking/dsa/configuration.rst
··· 180 180 181 181 # bring up the slave interfaces 182 182 ip link set lan1 up 183 - ip link set lan1 up 183 + ip link set lan2 up 184 184 ip link set lan3 up 185 185 186 186 # create bridge
+1 -1
Documentation/process/deprecated.rst
··· 142 142 (Users of strscpy() still needing NUL-padding should instead 143 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 146 still be used, but destinations should be marked with the `__nonstring 147 147 <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_ 148 148 attribute to avoid future compiler warnings.
+1 -1
Documentation/sound/cards/audigy-mixer.rst
··· 332 332 333 333 334 334 US Patents (https://www.uspto.gov/) 335 - ---------------------------------- 335 + ----------------------------------- 336 336 337 337 US 5925841 338 338 Digital Sampling Instrument employing cache memory (Jul. 20, 1999)
+1 -1
Documentation/sound/cards/sb-live-mixer.rst
··· 337 337 338 338 339 339 US Patents (https://www.uspto.gov/) 340 - ---------------------------------- 340 + ----------------------------------- 341 341 342 342 US 5925841 343 343 Digital Sampling Instrument employing cache memory (Jul. 20, 1999)
+1 -1
Documentation/sound/designs/timestamping.rst
··· 143 143 before returning from the ``STATUS`` and ``STATUS_EXT`` ioctl. in most cases 144 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 148 1. DMA timestamp, no compensation for DMA+analog delay 149 149 ::
+1 -1
Documentation/translations/it_IT/process/deprecated.rst
··· 130 130 strscpy(). (chi usa strscpy() e necessita di estendere la 131 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 134 può continuare ad essere usata, ma i buffer di destinazione devono essere 135 135 marchiati con l'attributo `__nonstring <https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html>`_ 136 136 per evitare avvisi durante la compilazione.
+18 -4
Documentation/virt/kvm/api.rst
··· 6130 6130 8.21 KVM_CAP_HYPERV_DIRECT_TLBFLUSH 6131 6131 ----------------------------------- 6132 6132 6133 - :Architecture: x86 6133 + :Architectures: x86 6134 6134 6135 6135 This capability indicates that KVM running on top of Hyper-V hypervisor 6136 6136 enables Direct TLB flush for its guests meaning that TLB flush ··· 6143 6143 thinks it's running on Hyper-V and only use Hyper-V hypercalls. 6144 6144 6145 6145 8.22 KVM_CAP_S390_VCPU_RESETS 6146 + ----------------------------- 6146 6147 6147 - Architectures: s390 6148 + :Architectures: s390 6148 6149 6149 6150 This capability indicates that the KVM_S390_NORMAL_RESET and 6150 6151 KVM_S390_CLEAR_RESET ioctls are available. 6151 6152 6152 6153 8.23 KVM_CAP_S390_PROTECTED 6154 + --------------------------- 6153 6155 6154 - Architecture: s390 6155 - 6156 + :Architectures: s390 6156 6157 6157 6158 This capability indicates that the Ultravisor has been initialized and 6158 6159 KVM can therefore start protected VMs. 6159 6160 This capability governs the KVM_S390_PV_COMMAND ioctl and the 6160 6161 KVM_MP_STATE_LOAD MP_STATE. KVM_SET_MP_STATE can fail for protected 6161 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".
+51 -20
MAINTAINERS
··· 1694 1694 1695 1695 ARM/CAVIUM THUNDER NETWORK DRIVER 1696 1696 M: Sunil Goutham <sgoutham@marvell.com> 1697 - M: Robert Richter <rrichter@marvell.com> 1698 1697 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1699 1698 S: Supported 1700 1699 F: drivers/net/ethernet/cavium/thunder/ ··· 3388 3389 L: netdev@vger.kernel.org 3389 3390 L: openwrt-devel@lists.openwrt.org (subscribers-only) 3390 3391 S: Supported 3392 + F: Documentation/devicetree/bindings/net/dsa/b53.txt 3391 3393 F: drivers/net/dsa/b53/* 3392 3394 F: include/linux/platform_data/b53.h 3393 3395 ··· 3574 3574 S: Maintained 3575 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 3587 BROADCOM GENET ETHERNET DRIVER 3578 3588 M: Doug Berger <opendmb@gmail.com> 3579 3589 M: Florian Fainelli <f.fainelli@gmail.com> 3580 3590 L: bcm-kernel-feedback-list@broadcom.com 3581 3591 L: netdev@vger.kernel.org 3582 3592 S: Supported 3593 + F: Documentation/devicetree/bindings/net/brcm,bcmgenet.txt 3594 + F: Documentation/devicetree/bindings/net/brcm,unimac-mdio.txt 3583 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 3600 BROADCOM IPROC ARM ARCHITECTURE 3586 3601 M: Ray Jui <rjui@broadcom.com> ··· 3947 3932 F: drivers/net/wireless/ath/carl9170/ 3948 3933 3949 3934 CAVIUM I2C DRIVER 3950 - M: Robert Richter <rrichter@marvell.com> 3951 - S: Supported 3935 + M: Robert Richter <rric@kernel.org> 3936 + S: Odd Fixes 3952 3937 W: http://www.marvell.com 3953 3938 F: drivers/i2c/busses/i2c-octeon* 3954 3939 F: drivers/i2c/busses/i2c-thunderx* ··· 3963 3948 F: drivers/net/ethernet/cavium/liquidio/ 3964 3949 3965 3950 CAVIUM MMC DRIVER 3966 - M: Robert Richter <rrichter@marvell.com> 3967 - S: Supported 3951 + M: Robert Richter <rric@kernel.org> 3952 + S: Odd Fixes 3968 3953 W: http://www.marvell.com 3969 3954 F: drivers/mmc/host/cavium* 3970 3955 ··· 3976 3961 F: drivers/crypto/cavium/cpt/ 3977 3962 3978 3963 CAVIUM THUNDERX2 ARM64 SOC 3979 - M: Robert Richter <rrichter@marvell.com> 3964 + M: Robert Richter <rric@kernel.org> 3980 3965 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 3981 - S: Maintained 3966 + S: Odd Fixes 3982 3967 F: Documentation/devicetree/bindings/arm/cavium-thunder2.txt 3983 3968 F: arch/arm64/boot/dts/cavium/thunder2-99xx* 3984 3969 ··· 4257 4242 F: .clang-format 4258 4243 4259 4244 CLANG/LLVM BUILD SUPPORT 4245 + M: Nathan Chancellor <natechancellor@gmail.com> 4246 + M: Nick Desaulniers <ndesaulniers@google.com> 4260 4247 L: clang-built-linux@googlegroups.com 4261 4248 S: Supported 4262 4249 W: https://clangbuiltlinux.github.io/ ··· 5257 5240 M: Jonathan Corbet <corbet@lwn.net> 5258 5241 L: linux-doc@vger.kernel.org 5259 5242 S: Maintained 5243 + P: Documentation/doc-guide/maintainer-profile.rst 5260 5244 T: git git://git.lwn.net/linux.git docs-next 5261 5245 F: Documentation/ 5262 5246 F: scripts/documentation-file-ref-check ··· 6192 6174 6193 6175 EDAC-CAVIUM OCTEON 6194 6176 M: Ralf Baechle <ralf@linux-mips.org> 6195 - M: Robert Richter <rrichter@marvell.com> 6196 6177 L: linux-edac@vger.kernel.org 6197 6178 L: linux-mips@vger.kernel.org 6198 6179 S: Supported 6199 6180 F: drivers/edac/octeon_edac* 6200 6181 6201 6182 EDAC-CAVIUM THUNDERX 6202 - M: Robert Richter <rrichter@marvell.com> 6183 + M: Robert Richter <rric@kernel.org> 6203 6184 L: linux-edac@vger.kernel.org 6204 - S: Supported 6185 + S: Odd Fixes 6205 6186 F: drivers/edac/thunderx_edac* 6206 6187 6207 6188 EDAC-CORE ··· 6208 6191 M: Mauro Carvalho Chehab <mchehab@kernel.org> 6209 6192 M: Tony Luck <tony.luck@intel.com> 6210 6193 R: James Morse <james.morse@arm.com> 6211 - R: Robert Richter <rrichter@marvell.com> 6194 + R: Robert Richter <rric@kernel.org> 6212 6195 L: linux-edac@vger.kernel.org 6213 6196 S: Supported 6214 6197 T: git git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras.git edac-for-next ··· 6512 6495 6513 6496 ETHERNET PHY LIBRARY 6514 6497 M: Andrew Lunn <andrew@lunn.ch> 6515 - M: Florian Fainelli <f.fainelli@gmail.com> 6516 6498 M: Heiner Kallweit <hkallweit1@gmail.com> 6517 6499 R: Russell King <linux@armlinux.org.uk> 6518 6500 L: netdev@vger.kernel.org ··· 6900 6884 L: linuxppc-dev@lists.ozlabs.org 6901 6885 S: Maintained 6902 6886 F: drivers/dma/fsldma.* 6887 + 6888 + FREESCALE DSPI DRIVER 6889 + M: Vladimir Oltean <olteanv@gmail.com> 6890 + L: linux-spi@vger.kernel.org 6891 + S: Maintained 6892 + F: Documentation/devicetree/bindings/spi/spi-fsl-dspi.txt 6893 + F: drivers/spi/spi-fsl-dspi.c 6894 + F: include/linux/spi/spi-fsl-dspi.h 6903 6895 6904 6896 FREESCALE ENETC ETHERNET DRIVERS 6905 6897 M: Claudiu Manoil <claudiu.manoil@nxp.com> ··· 8280 8256 M: Tony Luck <tony.luck@intel.com> 8281 8257 M: Fenghua Yu <fenghua.yu@intel.com> 8282 8258 L: linux-ia64@vger.kernel.org 8283 - S: Maintained 8259 + S: Odd Fixes 8284 8260 T: git git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git 8285 8261 F: Documentation/ia64/ 8286 8262 F: arch/ia64/ ··· 9800 9776 9801 9777 LEAKING_ADDRESSES 9802 9778 M: Tobin C. Harding <me@tobin.cc> 9803 - M: Tycho Andersen <tycho@tycho.ws> 9779 + M: Tycho Andersen <tycho@tycho.pizza> 9804 9780 L: kernel-hardening@lists.openwall.com 9805 9781 S: Maintained 9806 9782 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks.git ··· 13454 13430 F: drivers/pci/controller/dwc/*artpec* 13455 13431 13456 13432 PCIE DRIVER FOR CAVIUM THUNDERX 13457 - M: Robert Richter <rrichter@marvell.com> 13433 + M: Robert Richter <rric@kernel.org> 13458 13434 L: linux-pci@vger.kernel.org 13459 13435 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 13460 - S: Supported 13436 + S: Odd Fixes 13461 13437 F: drivers/pci/controller/pci-thunder-* 13462 13438 13463 13439 PCIE DRIVER FOR HISILICON ··· 13594 13570 F: tools/lib/perf/ 13595 13571 F: tools/perf/ 13596 13572 13597 - PERFORMANCE EVENTS SUBSYSTEM ARM64 PMU EVENTS 13573 + PERFORMANCE EVENTS TOOLING ARM64 13598 13574 R: John Garry <john.garry@huawei.com> 13599 13575 R: Will Deacon <will@kernel.org> 13576 + R: Mathieu Poirier <mathieu.poirier@linaro.org> 13577 + R: Leo Yan <leo.yan@linaro.org> 13600 13578 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 13601 13579 S: Supported 13580 + F: tools/build/feature/test-libopencsd.c 13581 + F: tools/perf/arch/arm*/ 13602 13582 F: tools/perf/pmu-events/arch/arm64/ 13583 + F: tools/perf/util/arm-spe* 13584 + F: tools/perf/util/cs-etm* 13603 13585 13604 13586 PERSONALITY HANDLING 13605 13587 M: Christoph Hellwig <hch@infradead.org> ··· 14396 14366 L: iommu@lists.linux-foundation.org 14397 14367 L: linux-arm-msm@vger.kernel.org 14398 14368 S: Maintained 14399 - F: drivers/iommu/qcom_iommu.c 14369 + F: drivers/iommu/arm/arm-smmu/qcom_iommu.c 14400 14370 14401 14371 QUALCOMM IPCC MAILBOX DRIVER 14402 14372 M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> ··· 15577 15547 SECURITY CONTACT 15578 15548 M: Security Officers <security@kernel.org> 15579 15549 S: Supported 15550 + F: Documentation/admin-guide/security-bugs.rst 15580 15551 15581 15552 SECURITY SUBSYSTEM 15582 15553 M: James Morris <jmorris@namei.org> ··· 17246 17215 F: drivers/net/thunderbolt.c 17247 17216 17248 17217 THUNDERX GPIO DRIVER 17249 - M: Robert Richter <rrichter@marvell.com> 17250 - S: Maintained 17218 + M: Robert Richter <rric@kernel.org> 17219 + S: Odd Fixes 17251 17220 F: drivers/gpio/gpio-thunderx.c 17252 17221 17253 17222 TI AM437X VPFE DRIVER
+1 -5
Makefile
··· 2 2 VERSION = 5 3 3 PATCHLEVEL = 9 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc3 5 + EXTRAVERSION = -rc5 6 6 NAME = Kleptomaniac Octopus 7 7 8 8 # *DOCUMENTATION* ··· 880 880 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION 881 881 KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections 882 882 LDFLAGS_vmlinux += --gc-sections 883 - endif 884 - 885 - ifdef CONFIG_LIVEPATCH 886 - KBUILD_CFLAGS += $(call cc-option, -flive-patching=inline-clone) 887 883 endif 888 884 889 885 ifdef CONFIG_SHADOW_CALL_STACK
+4 -2
arch/arc/boot/dts/hsdk.dts
··· 88 88 89 89 arcpct: pct { 90 90 compatible = "snps,archs-pct"; 91 + interrupt-parent = <&cpu_intc>; 92 + interrupts = <20>; 91 93 }; 92 94 93 95 /* TIMER0 with interrupt for clockevent */ ··· 210 208 reg = <0x8000 0x2000>; 211 209 interrupts = <10>; 212 210 interrupt-names = "macirq"; 213 - phy-mode = "rgmii"; 211 + phy-mode = "rgmii-id"; 214 212 snps,pbl = <32>; 215 213 snps,multicast-filter-bins = <256>; 216 214 clocks = <&gmacclk>; ··· 228 226 #address-cells = <1>; 229 227 #size-cells = <0>; 230 228 compatible = "snps,dwmac-mdio"; 231 - phy0: ethernet-phy@0 { 229 + phy0: ethernet-phy@0 { /* Micrel KSZ9031 */ 232 230 reg = <0>; 233 231 }; 234 232 };
+2 -2
arch/arc/include/asm/pgalloc.h
··· 18 18 * vineetg: April 2010 19 19 * -Switched pgtable_t from being struct page * to unsigned long 20 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 22 * multiple PG Tbls in one Page Frame 23 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 26 * Amit Bhor, Sameer Dhavale: Codito Technologies 2004 27 27 */
+4 -10
arch/arc/kernel/perf_event.c
··· 562 562 { 563 563 struct arc_reg_pct_build pct_bcr; 564 564 struct arc_reg_cc_build cc_bcr; 565 - int i, has_interrupts; 565 + int i, has_interrupts, irq; 566 566 int counter_size; /* in bits */ 567 567 568 568 union cc_name { ··· 637 637 .attr_groups = arc_pmu->attr_groups, 638 638 }; 639 639 640 - if (has_interrupts) { 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 - } 640 + if (has_interrupts && (irq = platform_get_irq(pdev, 0) >= 0)) { 647 641 648 642 arc_pmu->irq = irq; 649 643 ··· 646 652 this_cpu_ptr(&arc_pmu_cpu)); 647 653 648 654 on_each_cpu(arc_cpu_pmu_irq_init, &irq, 1); 649 - 650 - } else 655 + } else { 651 656 arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; 657 + } 652 658 653 659 /* 654 660 * perf parser doesn't really like '-' symbol in events name, so let's
+30 -47
arch/arc/kernel/troubleshoot.c
··· 18 18 19 19 #define ARC_PATH_MAX 256 20 20 21 - /* 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) 21 + static noinline void print_regs_scratch(struct pt_regs *regs) 27 22 { 28 - unsigned int i; 29 - char buf[512]; 30 - int n = 0, len = sizeof(buf); 23 + pr_cont("BTA: 0x%08lx\n SP: 0x%08lx FP: 0x%08lx BLK: %pS\n", 24 + regs->bta, regs->sp, regs->fp, (void *)regs->blink); 25 + pr_cont("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n", 26 + regs->lp_start, regs->lp_end, regs->lp_count); 31 27 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 - 49 - /* To continue printing callee regs on same line as scratch regs */ 50 - if (start_num == 0) 51 - pr_info("%s", buf); 52 - else 53 - pr_cont("%s\n", buf); 28 + pr_info("r00: 0x%08lx\tr01: 0x%08lx\tr02: 0x%08lx\n" \ 29 + "r03: 0x%08lx\tr04: 0x%08lx\tr05: 0x%08lx\n" \ 30 + "r06: 0x%08lx\tr07: 0x%08lx\tr08: 0x%08lx\n" \ 31 + "r09: 0x%08lx\tr10: 0x%08lx\tr11: 0x%08lx\n" \ 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 54 static void print_task_path_n_nm(struct task_struct *tsk) ··· 168 175 void show_regs(struct pt_regs *regs) 169 176 { 170 177 struct task_struct *tsk = current; 171 - struct callee_regs *cregs; 178 + struct callee_regs *cregs = (struct callee_regs *)tsk->thread.callee_reg; 172 179 173 180 /* 174 181 * generic code calls us with preemption disabled, but some calls ··· 197 204 STS_BIT(regs, A2), STS_BIT(regs, A1), 198 205 STS_BIT(regs, E2), STS_BIT(regs, E1)); 199 206 #else 200 - pr_cont(" [%2s%2s%2s%2s]", 207 + pr_cont(" [%2s%2s%2s%2s] ", 201 208 STS_BIT(regs, IE), 202 209 (regs->status32 & STATUS_U_MASK) ? "U " : "K ", 203 210 STS_BIT(regs, DE), STS_BIT(regs, AE)); 204 211 #endif 205 - pr_cont(" BTA: 0x%08lx\n SP: 0x%08lx FP: 0x%08lx BLK: %pS\n", 206 - regs->bta, regs->sp, regs->fp, (void *)regs->blink); 207 - pr_info("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n", 208 - regs->lp_start, regs->lp_end, regs->lp_count); 209 212 210 - /* print regs->r0 thru regs->r12 211 - * Sequential printing was generating horrible code 212 - */ 213 - print_reg_file(&(regs->r0), 0); 214 - 215 - /* If Callee regs were saved, display them too */ 216 - cregs = (struct callee_regs *)current->thread.callee_reg; 213 + print_regs_scratch(regs); 217 214 if (cregs) 218 - show_callee_regs(cregs); 215 + print_regs_callee(cregs); 219 216 220 217 preempt_disable(); 221 218 }
+16 -11
arch/arc/mm/init.c
··· 26 26 27 27 #ifdef CONFIG_HIGHMEM 28 28 static unsigned long min_high_pfn, max_high_pfn; 29 - static u64 high_mem_start; 30 - static u64 high_mem_sz; 29 + static phys_addr_t high_mem_start; 30 + static phys_addr_t high_mem_sz; 31 31 #endif 32 32 33 33 #ifdef CONFIG_DISCONTIGMEM ··· 69 69 high_mem_sz = size; 70 70 in_use = 1; 71 71 memblock_add_node(base, size, 1); 72 + memblock_reserve(base, size); 72 73 #endif 73 74 } 74 75 ··· 158 157 min_high_pfn = PFN_DOWN(high_mem_start); 159 158 max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz); 160 159 161 - max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn; 160 + max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn; 162 161 163 162 high_memory = (void *)(min_high_pfn << PAGE_SHIFT); 164 163 kmap_init(); 165 164 #endif 166 165 167 166 free_area_init(max_zone_pfn); 167 + } 168 + 169 + static void __init highmem_init(void) 170 + { 171 + #ifdef CONFIG_HIGHMEM 172 + unsigned long tmp; 173 + 174 + memblock_free(high_mem_start, high_mem_sz); 175 + for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++) 176 + free_highmem_page(pfn_to_page(tmp)); 177 + #endif 168 178 } 169 179 170 180 /* ··· 186 174 */ 187 175 void __init mem_init(void) 188 176 { 189 - #ifdef CONFIG_HIGHMEM 190 - unsigned long tmp; 191 - 192 - reset_all_zones_managed_pages(); 193 - for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++) 194 - free_highmem_page(pfn_to_page(tmp)); 195 - #endif 196 - 197 177 memblock_free_all(); 178 + highmem_init(); 198 179 mem_init_print_info(NULL); 199 180 }
-1
arch/arc/plat-eznps/include/plat/ctop.h
··· 33 33 #define CTOP_AUX_DPC (CTOP_AUX_BASE + 0x02C) 34 34 #define CTOP_AUX_LPC (CTOP_AUX_BASE + 0x030) 35 35 #define CTOP_AUX_EFLAGS (CTOP_AUX_BASE + 0x080) 36 - #define CTOP_AUX_IACK (CTOP_AUX_BASE + 0x088) 37 36 #define CTOP_AUX_GPA1 (CTOP_AUX_BASE + 0x08C) 38 37 #define CTOP_AUX_UDMC (CTOP_AUX_BASE + 0x300) 39 38
+1 -1
arch/arm/boot/dts/bcm-hr2.dtsi
··· 217 217 }; 218 218 219 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 221 reg = <0x027200 0x184>, 222 222 <0x027000 0x124>, 223 223 <0x11c408 0x004>,
+1 -1
arch/arm/boot/dts/bcm-nsp.dtsi
··· 284 284 }; 285 285 286 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 288 reg = <0x027200 0x184>, 289 289 <0x027000 0x124>, 290 290 <0x11c408 0x004>,
+1 -1
arch/arm/boot/dts/bcm5301x.dtsi
··· 488 488 }; 489 489 490 490 spi@18029200 { 491 - compatible = "brcm,spi-bcm-qspi", "brcm,spi-nsp-qspi"; 491 + compatible = "brcm,spi-nsp-qspi", "brcm,spi-bcm-qspi"; 492 492 reg = <0x18029200 0x184>, 493 493 <0x18029000 0x124>, 494 494 <0x1811b408 0x004>,
+1 -1
arch/arm/boot/dts/imx6q-logicpd.dts
··· 13 13 14 14 backlight: backlight-lvds { 15 15 compatible = "pwm-backlight"; 16 - pwms = <&pwm3 0 20000>; 16 + pwms = <&pwm3 0 20000 0>; 17 17 brightness-levels = <0 4 8 16 32 64 128 255>; 18 18 default-brightness-level = <6>; 19 19 power-supply = <&reg_lcd>;
+1 -1
arch/arm/boot/dts/imx6q-prtwd2.dts
··· 30 30 }; 31 31 32 32 /* PRTWD2 rev 1 bitbang I2C for Ethernet Switch */ 33 - i2c@4 { 33 + i2c { 34 34 compatible = "i2c-gpio"; 35 35 pinctrl-names = "default"; 36 36 pinctrl-0 = <&pinctrl_i2c4>;
-2
arch/arm/boot/dts/imx6qdl-gw51xx.dtsi
··· 22 22 23 23 gpio-keys { 24 24 compatible = "gpio-keys"; 25 - #address-cells = <1>; 26 - #size-cells = <0>; 27 25 28 26 user-pb { 29 27 label = "user_pb";
+1 -1
arch/arm/boot/dts/imx6sx-pinfunc.h
··· 1026 1026 #define MX6SX_PAD_QSPI1B_DQS__SIM_M_HADDR_15 0x01B0 0x04F8 0x0000 0x7 0x0 1027 1027 #define MX6SX_PAD_QSPI1B_SCLK__QSPI1_B_SCLK 0x01B4 0x04FC 0x0000 0x0 0x0 1028 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 1030 #define MX6SX_PAD_QSPI1B_SCLK__ECSPI3_SCLK 0x01B4 0x04FC 0x0730 0x2 0x1 1031 1031 #define MX6SX_PAD_QSPI1B_SCLK__ESAI_RX_HF_CLK 0x01B4 0x04FC 0x0780 0x3 0x2 1032 1032 #define MX6SX_PAD_QSPI1B_SCLK__CSI1_DATA_16 0x01B4 0x04FC 0x06DC 0x4 0x1
+1 -1
arch/arm/boot/dts/imx7d-zii-rmu2.dts
··· 58 58 <&clks IMX7D_ENET1_TIME_ROOT_CLK>; 59 59 assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>; 60 60 assigned-clock-rates = <0>, <100000000>; 61 - phy-mode = "rgmii"; 61 + phy-mode = "rgmii-id"; 62 62 phy-handle = <&fec1_phy>; 63 63 status = "okay"; 64 64
+4 -4
arch/arm/boot/dts/imx7ulp.dtsi
··· 394 394 clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, 395 395 <&pcc3 IMX7ULP_CLK_PCTLC>; 396 396 clock-names = "gpio", "port"; 397 - gpio-ranges = <&iomuxc1 0 0 32>; 397 + gpio-ranges = <&iomuxc1 0 0 20>; 398 398 }; 399 399 400 400 gpio_ptd: gpio@40af0000 { ··· 408 408 clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, 409 409 <&pcc3 IMX7ULP_CLK_PCTLD>; 410 410 clock-names = "gpio", "port"; 411 - gpio-ranges = <&iomuxc1 0 32 32>; 411 + gpio-ranges = <&iomuxc1 0 32 12>; 412 412 }; 413 413 414 414 gpio_pte: gpio@40b00000 { ··· 422 422 clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, 423 423 <&pcc3 IMX7ULP_CLK_PCTLE>; 424 424 clock-names = "gpio", "port"; 425 - gpio-ranges = <&iomuxc1 0 64 32>; 425 + gpio-ranges = <&iomuxc1 0 64 16>; 426 426 }; 427 427 428 428 gpio_ptf: gpio@40b10000 { ··· 436 436 clocks = <&pcc2 IMX7ULP_CLK_RGPIO2P1>, 437 437 <&pcc3 IMX7ULP_CLK_PCTLF>; 438 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
+7 -22
arch/arm/boot/dts/logicpd-som-lv-baseboard.dtsi
··· 51 51 52 52 &mcbsp2 { 53 53 status = "okay"; 54 + pinctrl-names = "default"; 55 + pinctrl-0 = <&mcbsp2_pins>; 54 56 }; 55 57 56 58 &charger { ··· 104 102 regulator-max-microvolt = <3300000>; 105 103 }; 106 104 107 - lcd0: display@0 { 108 - compatible = "panel-dpi"; 109 - label = "28"; 110 - status = "okay"; 111 - /* default-on; */ 105 + lcd0: display { 106 + /* This isn't the exact LCD, but the timings meet spec */ 107 + compatible = "logicpd,type28"; 112 108 pinctrl-names = "default"; 113 109 pinctrl-0 = <&lcd_enable_pin>; 114 - enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; /* gpio155, lcd INI */ 110 + backlight = <&bl>; 111 + enable-gpios = <&gpio5 27 GPIO_ACTIVE_HIGH>; 115 112 port { 116 113 lcd_in: endpoint { 117 114 remote-endpoint = <&dpi_out>; 118 115 }; 119 - }; 120 - 121 - panel-timing { 122 - clock-frequency = <9000000>; 123 - hactive = <480>; 124 - vactive = <272>; 125 - hfront-porch = <3>; 126 - hback-porch = <2>; 127 - hsync-len = <42>; 128 - vback-porch = <3>; 129 - vfront-porch = <2>; 130 - vsync-len = <11>; 131 - hsync-active = <1>; 132 - vsync-active = <1>; 133 - de-active = <1>; 134 - pixelclk-active = <0>; 135 116 }; 136 117 }; 137 118
+2
arch/arm/boot/dts/logicpd-torpedo-baseboard.dtsi
··· 81 81 }; 82 82 83 83 &mcbsp2 { 84 + pinctrl-names = "default"; 85 + pinctrl-0 = <&mcbsp2_pins>; 84 86 status = "okay"; 85 87 }; 86 88
+1 -1
arch/arm/boot/dts/ls1021a.dtsi
··· 182 182 #address-cells = <1>; 183 183 #size-cells = <0>; 184 184 reg = <0x0 0x1550000 0x0 0x10000>, 185 - <0x0 0x40000000 0x0 0x40000000>; 185 + <0x0 0x40000000 0x0 0x20000000>; 186 186 reg-names = "QuadSPI", "QuadSPI-memory"; 187 187 interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; 188 188 clock-names = "qspi_en", "qspi";
+11 -9
arch/arm/boot/dts/omap5.dtsi
··· 488 488 }; 489 489 }; 490 490 491 - target-module@5000 { 491 + target-module@4000 { 492 492 compatible = "ti,sysc-omap2", "ti,sysc"; 493 - reg = <0x5000 0x4>, 494 - <0x5010 0x4>, 495 - <0x5014 0x4>; 493 + reg = <0x4000 0x4>, 494 + <0x4010 0x4>, 495 + <0x4014 0x4>; 496 496 reg-names = "rev", "sysc", "syss"; 497 497 ti,sysc-sidle = <SYSC_IDLE_FORCE>, 498 498 <SYSC_IDLE_NO>, ··· 504 504 ti,syss-mask = <1>; 505 505 #address-cells = <1>; 506 506 #size-cells = <1>; 507 - ranges = <0 0x5000 0x1000>; 507 + ranges = <0 0x4000 0x1000>; 508 508 509 509 dsi1: encoder@0 { 510 510 compatible = "ti,omap5-dsi"; ··· 514 514 reg-names = "proto", "phy", "pll"; 515 515 interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; 516 516 status = "disabled"; 517 - clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>; 518 - clock-names = "fck"; 517 + clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>, 518 + <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>; 519 + clock-names = "fck", "sys_clk"; 519 520 }; 520 521 }; 521 522 ··· 546 545 reg-names = "proto", "phy", "pll"; 547 546 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; 548 547 status = "disabled"; 549 - clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>; 550 - clock-names = "fck"; 548 + clocks = <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 8>, 549 + <&dss_clkctrl OMAP5_DSS_CORE_CLKCTRL 10>; 550 + clock-names = "fck", "sys_clk"; 551 551 }; 552 552 }; 553 553
+1 -1
arch/arm/boot/dts/socfpga_arria10.dtsi
··· 821 821 timer3: timer3@ffd00100 { 822 822 compatible = "snps,dw-apb-timer"; 823 823 interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>; 824 - reg = <0xffd01000 0x100>; 824 + reg = <0xffd00100 0x100>; 825 825 clocks = <&l4_sys_free_clk>; 826 826 clock-names = "timer"; 827 827 resets = <&rst L4SYSTIMER1_RESET>;
+1 -1
arch/arm/boot/dts/vfxxx.dtsi
··· 495 495 }; 496 496 497 497 ocotp: ocotp@400a5000 { 498 - compatible = "fsl,vf610-ocotp"; 498 + compatible = "fsl,vf610-ocotp", "syscon"; 499 499 reg = <0x400a5000 0x1000>; 500 500 clocks = <&clks VF610_CLK_OCOTP>; 501 501 };
+8 -8
arch/arm/configs/integrator_defconfig
··· 1 1 CONFIG_SYSVIPC=y 2 2 CONFIG_NO_HZ=y 3 3 CONFIG_HIGH_RES_TIMERS=y 4 + CONFIG_PREEMPT=y 4 5 CONFIG_IKCONFIG=y 5 6 CONFIG_IKCONFIG_PROC=y 6 7 CONFIG_LOG_BUF_SHIFT=14 7 8 CONFIG_BLK_DEV_INITRD=y 8 - CONFIG_MODULES=y 9 - CONFIG_MODULE_UNLOAD=y 10 - CONFIG_PARTITION_ADVANCED=y 11 9 CONFIG_ARCH_MULTI_V4T=y 12 10 CONFIG_ARCH_MULTI_V5=y 13 11 # CONFIG_ARCH_MULTI_V7 is not set ··· 13 15 CONFIG_ARCH_INTEGRATOR_AP=y 14 16 CONFIG_INTEGRATOR_IMPD1=y 15 17 CONFIG_ARCH_INTEGRATOR_CP=y 16 - CONFIG_PCI=y 17 - CONFIG_PREEMPT=y 18 18 CONFIG_AEABI=y 19 19 # CONFIG_ATAGS is not set 20 - CONFIG_ZBOOT_ROM_TEXT=0x0 21 - CONFIG_ZBOOT_ROM_BSS=0x0 22 20 CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp" 23 21 CONFIG_CPU_FREQ=y 24 22 CONFIG_CPU_FREQ_GOV_POWERSAVE=y 25 23 CONFIG_CPU_FREQ_GOV_USERSPACE=y 26 24 CONFIG_CPU_FREQ_GOV_ONDEMAND=y 27 25 CONFIG_CPUFREQ_DT=y 28 - CONFIG_CMA=y 26 + CONFIG_MODULES=y 27 + CONFIG_MODULE_UNLOAD=y 28 + CONFIG_PARTITION_ADVANCED=y 29 29 CONFIG_NET=y 30 30 CONFIG_PACKET=y 31 31 CONFIG_UNIX=y ··· 33 37 CONFIG_IP_PNP_DHCP=y 34 38 CONFIG_IP_PNP_BOOTP=y 35 39 # CONFIG_IPV6 is not set 40 + CONFIG_PCI=y 36 41 CONFIG_MTD=y 37 42 CONFIG_MTD_CMDLINE_PARTS=y 38 43 CONFIG_MTD_AFS_PARTS=y ··· 49 52 CONFIG_NETDEVICES=y 50 53 CONFIG_E100=y 51 54 CONFIG_SMC91X=y 55 + CONFIG_INPUT_EVDEV=y 52 56 # CONFIG_KEYBOARD_ATKBD is not set 57 + CONFIG_KEYBOARD_GPIO=y 53 58 # CONFIG_SERIO_SERPORT is not set 54 59 CONFIG_DRM=y 60 + CONFIG_DRM_DISPLAY_CONNECTOR=y 55 61 CONFIG_DRM_SIMPLE_BRIDGE=y 56 62 CONFIG_DRM_PL111=y 57 63 CONFIG_FB_MODE_HELPERS=y
+1 -1
arch/arm/mach-omap2/omap-iommu.c
··· 74 74 return pwrdm; 75 75 76 76 clk = of_clk_get(dev->of_node->parent, 0); 77 - if (!clk) { 77 + if (IS_ERR(clk)) { 78 78 dev_err(dev, "no fck found\n"); 79 79 return NULL; 80 80 }
+1 -1
arch/arm64/boot/dts/broadcom/northstar2/ns2.dtsi
··· 745 745 }; 746 746 747 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 749 reg = <0x66470200 0x184>, 750 750 <0x66470000 0x124>, 751 751 <0x67017408 0x004>,
+1
arch/arm64/boot/dts/freescale/Makefile
··· 28 28 dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-qds.dtb 29 29 dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb 30 30 31 + dtb-$(CONFIG_ARCH_MXC) += imx8mm-beacon-kit.dtb 31 32 dtb-$(CONFIG_ARCH_MXC) += imx8mm-evk.dtb 32 33 dtb-$(CONFIG_ARCH_MXC) += imx8mn-evk.dtb 33 34 dtb-$(CONFIG_ARCH_MXC) += imx8mn-ddr4-evk.dtb
+1 -1
arch/arm64/boot/dts/freescale/imx8mp.dtsi
··· 702 702 reg = <0x30bd0000 0x10000>; 703 703 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; 704 704 clocks = <&clk IMX8MP_CLK_SDMA1_ROOT>, 705 - <&clk IMX8MP_CLK_SDMA1_ROOT>; 705 + <&clk IMX8MP_CLK_AHB>; 706 706 clock-names = "ipg", "ahb"; 707 707 #dma-cells = <3>; 708 708 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
+1 -1
arch/arm64/boot/dts/freescale/imx8mq.dtsi
··· 423 423 tmu: tmu@30260000 { 424 424 compatible = "fsl,imx8mq-tmu"; 425 425 reg = <0x30260000 0x10000>; 426 - interrupt = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; 426 + interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; 427 427 clocks = <&clk IMX8MQ_CLK_TMU_ROOT>; 428 428 little-endian; 429 429 fsl,tmu-range = <0xb0000 0xa0026 0x80048 0x70061>;
+2
arch/arm64/boot/dts/mediatek/mt7622.dtsi
··· 686 686 clocks = <&pericfg CLK_PERI_MSDC30_0_PD>, 687 687 <&topckgen CLK_TOP_MSDC50_0_SEL>; 688 688 clock-names = "source", "hclk"; 689 + resets = <&pericfg MT7622_PERI_MSDC0_SW_RST>; 690 + reset-names = "hrst"; 689 691 status = "disabled"; 690 692 }; 691 693
+12 -8
arch/arm64/boot/dts/nvidia/tegra186.dtsi
··· 337 337 compatible = "nvidia,tegra186-sdhci"; 338 338 reg = <0x0 0x03400000 0x0 0x10000>; 339 339 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; 340 - clocks = <&bpmp TEGRA186_CLK_SDMMC1>; 341 - clock-names = "sdhci"; 340 + clocks = <&bpmp TEGRA186_CLK_SDMMC1>, 341 + <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; 342 + clock-names = "sdhci", "tmclk"; 342 343 resets = <&bpmp TEGRA186_RESET_SDMMC1>; 343 344 reset-names = "sdhci"; 344 345 interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRA &emc>, ··· 367 366 compatible = "nvidia,tegra186-sdhci"; 368 367 reg = <0x0 0x03420000 0x0 0x10000>; 369 368 interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>; 370 - clocks = <&bpmp TEGRA186_CLK_SDMMC2>; 371 - clock-names = "sdhci"; 369 + clocks = <&bpmp TEGRA186_CLK_SDMMC2>, 370 + <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; 371 + clock-names = "sdhci", "tmclk"; 372 372 resets = <&bpmp TEGRA186_RESET_SDMMC2>; 373 373 reset-names = "sdhci"; 374 374 interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCRAA &emc>, ··· 392 390 compatible = "nvidia,tegra186-sdhci"; 393 391 reg = <0x0 0x03440000 0x0 0x10000>; 394 392 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; 395 - clocks = <&bpmp TEGRA186_CLK_SDMMC3>; 396 - clock-names = "sdhci"; 393 + clocks = <&bpmp TEGRA186_CLK_SDMMC3>, 394 + <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; 395 + clock-names = "sdhci", "tmclk"; 397 396 resets = <&bpmp TEGRA186_RESET_SDMMC3>; 398 397 reset-names = "sdhci"; 399 398 interconnects = <&mc TEGRA186_MEMORY_CLIENT_SDMMCR &emc>, ··· 419 416 compatible = "nvidia,tegra186-sdhci"; 420 417 reg = <0x0 0x03460000 0x0 0x10000>; 421 418 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; 422 - clocks = <&bpmp TEGRA186_CLK_SDMMC4>; 423 - clock-names = "sdhci"; 419 + clocks = <&bpmp TEGRA186_CLK_SDMMC4>, 420 + <&bpmp TEGRA186_CLK_SDMMC_LEGACY_TM>; 421 + clock-names = "sdhci", "tmclk"; 424 422 assigned-clocks = <&bpmp TEGRA186_CLK_SDMMC4>, 425 423 <&bpmp TEGRA186_CLK_PLLC4_VCO>; 426 424 assigned-clock-parents = <&bpmp TEGRA186_CLK_PLLC4_VCO>;
+9 -6
arch/arm64/boot/dts/nvidia/tegra194.dtsi
··· 460 460 compatible = "nvidia,tegra194-sdhci"; 461 461 reg = <0x03400000 0x10000>; 462 462 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; 463 - clocks = <&bpmp TEGRA194_CLK_SDMMC1>; 464 - clock-names = "sdhci"; 463 + clocks = <&bpmp TEGRA194_CLK_SDMMC1>, 464 + <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>; 465 + clock-names = "sdhci", "tmclk"; 465 466 resets = <&bpmp TEGRA194_RESET_SDMMC1>; 466 467 reset-names = "sdhci"; 467 468 interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCRA &emc>, ··· 486 485 compatible = "nvidia,tegra194-sdhci"; 487 486 reg = <0x03440000 0x10000>; 488 487 interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; 489 - clocks = <&bpmp TEGRA194_CLK_SDMMC3>; 490 - clock-names = "sdhci"; 488 + clocks = <&bpmp TEGRA194_CLK_SDMMC3>, 489 + <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>; 490 + clock-names = "sdhci", "tmclk"; 491 491 resets = <&bpmp TEGRA194_RESET_SDMMC3>; 492 492 reset-names = "sdhci"; 493 493 interconnects = <&mc TEGRA194_MEMORY_CLIENT_SDMMCR &emc>, ··· 513 511 compatible = "nvidia,tegra194-sdhci"; 514 512 reg = <0x03460000 0x10000>; 515 513 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; 516 - clocks = <&bpmp TEGRA194_CLK_SDMMC4>; 517 - clock-names = "sdhci"; 514 + clocks = <&bpmp TEGRA194_CLK_SDMMC4>, 515 + <&bpmp TEGRA194_CLK_SDMMC_LEGACY_TM>; 516 + clock-names = "sdhci", "tmclk"; 518 517 assigned-clocks = <&bpmp TEGRA194_CLK_SDMMC4>, 519 518 <&bpmp TEGRA194_CLK_PLLC4>; 520 519 assigned-clock-parents =
+12 -8
arch/arm64/boot/dts/nvidia/tegra210.dtsi
··· 1194 1194 compatible = "nvidia,tegra210-sdhci"; 1195 1195 reg = <0x0 0x700b0000 0x0 0x200>; 1196 1196 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 1197 - clocks = <&tegra_car TEGRA210_CLK_SDMMC1>; 1198 - clock-names = "sdhci"; 1197 + clocks = <&tegra_car TEGRA210_CLK_SDMMC1>, 1198 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 1199 + clock-names = "sdhci", "tmclk"; 1199 1200 resets = <&tegra_car 14>; 1200 1201 reset-names = "sdhci"; 1201 1202 pinctrl-names = "sdmmc-3v3", "sdmmc-1v8", ··· 1223 1222 compatible = "nvidia,tegra210-sdhci"; 1224 1223 reg = <0x0 0x700b0200 0x0 0x200>; 1225 1224 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>; 1226 - clocks = <&tegra_car TEGRA210_CLK_SDMMC2>; 1227 - clock-names = "sdhci"; 1225 + clocks = <&tegra_car TEGRA210_CLK_SDMMC2>, 1226 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 1227 + clock-names = "sdhci", "tmclk"; 1228 1228 resets = <&tegra_car 9>; 1229 1229 reset-names = "sdhci"; 1230 1230 pinctrl-names = "sdmmc-1v8-drv"; ··· 1241 1239 compatible = "nvidia,tegra210-sdhci"; 1242 1240 reg = <0x0 0x700b0400 0x0 0x200>; 1243 1241 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; 1244 - clocks = <&tegra_car TEGRA210_CLK_SDMMC3>; 1245 - clock-names = "sdhci"; 1242 + clocks = <&tegra_car TEGRA210_CLK_SDMMC3>, 1243 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 1244 + clock-names = "sdhci", "tmclk"; 1246 1245 resets = <&tegra_car 69>; 1247 1246 reset-names = "sdhci"; 1248 1247 pinctrl-names = "sdmmc-3v3", "sdmmc-1v8", ··· 1265 1262 compatible = "nvidia,tegra210-sdhci"; 1266 1263 reg = <0x0 0x700b0600 0x0 0x200>; 1267 1264 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; 1268 - clocks = <&tegra_car TEGRA210_CLK_SDMMC4>; 1269 - clock-names = "sdhci"; 1265 + clocks = <&tegra_car TEGRA210_CLK_SDMMC4>, 1266 + <&tegra_car TEGRA210_CLK_SDMMC_LEGACY>; 1267 + clock-names = "sdhci", "tmclk"; 1270 1268 resets = <&tegra_car 15>; 1271 1269 reset-names = "sdhci"; 1272 1270 pinctrl-names = "sdmmc-3v3-drv", "sdmmc-1v8-drv";
+11 -1
arch/arm64/boot/dts/xilinx/zynqmp.dtsi
··· 13 13 */ 14 14 15 15 #include <dt-bindings/power/xlnx-zynqmp-power.h> 16 + #include <dt-bindings/reset/xlnx-zynqmp-resets.h> 16 17 17 18 / { 18 19 compatible = "xlnx,zynqmp"; ··· 559 558 }; 560 559 }; 561 560 561 + psgtr: phy@fd400000 { 562 + compatible = "xlnx,zynqmp-psgtr-v1.1"; 563 + status = "disabled"; 564 + reg = <0x0 0xfd400000 0x0 0x40000>, 565 + <0x0 0xfd3d0000 0x0 0x1000>; 566 + reg-names = "serdes", "siou"; 567 + #phy-cells = <4>; 568 + }; 569 + 562 570 rtc: rtc@ffa60000 { 563 571 compatible = "xlnx,zynqmp-rtc"; 564 572 status = "disabled"; ··· 611 601 power-domains = <&zynqmp_firmware PD_SD_1>; 612 602 }; 613 603 614 - smmu: smmu@fd800000 { 604 + smmu: iommu@fd800000 { 615 605 compatible = "arm,mmu-500"; 616 606 reg = <0x0 0xfd800000 0x0 0x20000>; 617 607 status = "disabled";
+12
arch/arm64/configs/defconfig
··· 724 724 CONFIG_USB_RENESAS_USBHS_UDC=m 725 725 CONFIG_USB_RENESAS_USB3=m 726 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 738 CONFIG_TYPEC=m 728 739 CONFIG_TYPEC_TCPM=m 729 740 CONFIG_TYPEC_FUSB302=m ··· 925 914 CONFIG_ARCH_K3_AM6_SOC=y 926 915 CONFIG_ARCH_K3_J721E_SOC=y 927 916 CONFIG_TI_SCI_PM_DOMAINS=y 917 + CONFIG_EXTCON_PTN5150=m 928 918 CONFIG_EXTCON_USB_GPIO=y 929 919 CONFIG_EXTCON_USBC_CROS_EC=y 930 920 CONFIG_IIO=y
+1 -1
arch/arm64/include/asm/kvm_host.h
··· 368 368 369 369 /* Guest PV state */ 370 370 struct { 371 - u64 steal; 372 371 u64 last_steal; 373 372 gpa_t base; 374 373 } steal; ··· 543 544 gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu); 544 545 void kvm_update_stolen_time(struct kvm_vcpu *vcpu); 545 546 547 + bool kvm_arm_pvtime_supported(void); 546 548 int kvm_arm_pvtime_set_attr(struct kvm_vcpu *vcpu, 547 549 struct kvm_device_attr *attr); 548 550 int kvm_arm_pvtime_get_attr(struct kvm_vcpu *vcpu,
+1 -2
arch/arm64/kernel/module-plts.c
··· 305 305 mod->arch.core.plt_shndx = i; 306 306 else if (!strcmp(secstrings + sechdrs[i].sh_name, ".init.plt")) 307 307 mod->arch.init.plt_shndx = i; 308 - else if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE) && 309 - !strcmp(secstrings + sechdrs[i].sh_name, 308 + else if (!strcmp(secstrings + sechdrs[i].sh_name, 310 309 ".text.ftrace_trampoline")) 311 310 tramp = sechdrs + i; 312 311 else if (sechdrs[i].sh_type == SHT_SYMTAB)
-1
arch/arm64/kernel/setup.c
··· 280 280 { 281 281 return __cpu_logical_map[cpu]; 282 282 } 283 - EXPORT_SYMBOL_GPL(cpu_logical_map); 284 283 285 284 void __init __no_sanitize_address setup_arch(char **cmdline_p) 286 285 {
+3
arch/arm64/kvm/arm.c
··· 206 206 */ 207 207 r = 1; 208 208 break; 209 + case KVM_CAP_STEAL_TIME: 210 + r = kvm_arm_pvtime_supported(); 211 + break; 209 212 default: 210 213 r = kvm_arch_vm_ioctl_check_extension(kvm, ext); 211 214 break;
+7 -1
arch/arm64/kvm/mmu.c
··· 1877 1877 !fault_supports_stage2_huge_mapping(memslot, hva, vma_pagesize)) { 1878 1878 force_pte = true; 1879 1879 vma_pagesize = PAGE_SIZE; 1880 + vma_shift = PAGE_SHIFT; 1880 1881 } 1881 1882 1882 1883 /* ··· 1971 1970 (fault_status == FSC_PERM && 1972 1971 stage2_is_exec(mmu, fault_ipa, vma_pagesize)); 1973 1972 1974 - if (vma_pagesize == PUD_SIZE) { 1973 + /* 1974 + * If PUD_SIZE == PMD_SIZE, there is no real PUD level, and 1975 + * all we have is a 2-level page table. Trying to map a PUD in 1976 + * this case would be fatally wrong. 1977 + */ 1978 + if (PUD_SIZE != PMD_SIZE && vma_pagesize == PUD_SIZE) { 1975 1979 pud_t new_pud = kvm_pfn_pud(pfn, mem_type); 1976 1980 1977 1981 new_pud = kvm_pud_mkhuge(new_pud);
+13 -16
arch/arm64/kvm/pvtime.c
··· 13 13 void kvm_update_stolen_time(struct kvm_vcpu *vcpu) 14 14 { 15 15 struct kvm *kvm = vcpu->kvm; 16 - u64 steal; 17 - __le64 steal_le; 18 - u64 offset; 19 - int idx; 20 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 22 if (base == GPA_INVALID) 23 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 25 idx = srcu_read_lock(&kvm->srcu); 33 - offset = offsetof(struct pvclock_vcpu_stolen_time, stolen_time); 34 - kvm_put_guest(kvm, base + offset, steal_le, u64); 26 + if (!kvm_get_guest(kvm, base + offset, steal)) { 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 32 srcu_read_unlock(&kvm->srcu, idx); 36 33 } 37 34 ··· 40 43 switch (feature) { 41 44 case ARM_SMCCC_HV_PV_TIME_FEATURES: 42 45 case ARM_SMCCC_HV_PV_TIME_ST: 43 - val = SMCCC_RET_SUCCESS; 46 + if (vcpu->arch.steal.base != GPA_INVALID) 47 + val = SMCCC_RET_SUCCESS; 44 48 break; 45 49 } 46 50 ··· 62 64 * Start counting stolen time from the time the guest requests 63 65 * the feature enabled. 64 66 */ 65 - vcpu->arch.steal.steal = 0; 66 67 vcpu->arch.steal.last_steal = current->sched_info.run_delay; 67 68 68 69 idx = srcu_read_lock(&kvm->srcu); ··· 71 74 return base; 72 75 } 73 76 74 - static bool kvm_arm_pvtime_supported(void) 77 + bool kvm_arm_pvtime_supported(void) 75 78 { 76 79 return !!sched_info_on(); 77 80 }
+8 -8
arch/arm64/kvm/trace_arm.h
··· 23 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 29 TRACE_EVENT(kvm_exit, ··· 42 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 46 __print_symbolic(__entry->ret, kvm_arm_exception_type), 47 47 __entry->esr_ec, 48 48 __print_symbolic(__entry->esr_ec, kvm_arm_exception_class), ··· 69 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 73 __entry->ipa, __entry->hsr, 74 74 __entry->hxfar, __entry->vcpu_pc) 75 75 ); ··· 131 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 135 __entry->vcpu_pc, __entry->instr, __entry->cpsr) 136 136 ); 137 137 ··· 149 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 153 __entry->start, __entry->end) 154 154 ); 155 155 ··· 165 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 171 TRACE_EVENT(kvm_age_hva, ··· 182 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 186 __entry->start, __entry->end) 187 187 ); 188 188 ··· 198 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 204 TRACE_EVENT(kvm_set_way_flush,
+3 -3
arch/arm64/kvm/trace_handle_exit.h
··· 22 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 26 __entry->is_wfe ? 'e' : 'i', __entry->vcpu_pc) 27 27 ); 28 28 ··· 42 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 46 __entry->vcpu_pc, __entry->r0, __entry->imm) 47 47 ); 48 48 ··· 135 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 141 TRACE_EVENT(kvm_handle_sys_reg,
+1 -1
arch/ia64/kernel/ia64_ksyms.c
··· 3 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 7 #include <linux/compiler.h> 8 8 #include <linux/export.h> 9 9 #include <linux/memblock.h>
+3
arch/microblaze/mm/init.c
··· 46 46 EXPORT_SYMBOL(memory_size); 47 47 unsigned long lowmem_size; 48 48 49 + EXPORT_SYMBOL(min_low_pfn); 50 + EXPORT_SYMBOL(max_low_pfn); 51 + 49 52 #ifdef CONFIG_HIGHMEM 50 53 pte_t *kmap_pte; 51 54 EXPORT_SYMBOL(kmap_pte);
-2
arch/mips/include/asm/mach-loongson64/cpu-feature-overrides.h
··· 26 26 #define cpu_has_counter 1 27 27 #define cpu_has_dc_aliases (PAGE_SIZE < 0x4000) 28 28 #define cpu_has_divec 0 29 - #define cpu_has_ejtag 0 30 29 #define cpu_has_inclusive_pcaches 1 31 30 #define cpu_has_llsc 1 32 31 #define cpu_has_mcheck 0 ··· 41 42 #define cpu_has_veic 0 42 43 #define cpu_has_vint 0 43 44 #define cpu_has_vtag_icache 0 44 - #define cpu_has_watch 1 45 45 #define cpu_has_wsbh 1 46 46 #define cpu_has_ic_fills_f_dc 1 47 47 #define cpu_hwrena_impl_bits 0xc0000000
-2
arch/mips/include/asm/mach-loongson64/irq.h
··· 2 2 #ifndef __ASM_MACH_LOONGSON64_IRQ_H_ 3 3 #define __ASM_MACH_LOONGSON64_IRQ_H_ 4 4 5 - #include <boot_param.h> 6 - 7 5 /* cpu core interrupt numbers */ 8 6 #define NR_IRQS_LEGACY 16 9 7 #define NR_MIPS_CPU_IRQS 8
-1
arch/mips/include/asm/mach-loongson64/mmzone.h
··· 9 9 #ifndef _ASM_MACH_LOONGSON64_MMZONE_H 10 10 #define _ASM_MACH_LOONGSON64_MMZONE_H 11 11 12 - #include <boot_param.h> 13 12 #define NODE_ADDRSPACE_SHIFT 44 14 13 #define NODE0_ADDRSPACE_OFFSET 0x000000000000UL 15 14 #define NODE1_ADDRSPACE_OFFSET 0x100000000000UL
+2 -2
arch/mips/kernel/perf_event_mipsxx.c
··· 1898 1898 (base_id >= 64 && base_id < 90) || 1899 1899 (base_id >= 128 && base_id < 164) || 1900 1900 (base_id >= 192 && base_id < 200) || 1901 - (base_id >= 256 && base_id < 274) || 1902 - (base_id >= 320 && base_id < 358) || 1901 + (base_id >= 256 && base_id < 275) || 1902 + (base_id >= 320 && base_id < 361) || 1903 1903 (base_id >= 384 && base_id < 574)) 1904 1904 break; 1905 1905
+2
arch/mips/kernel/smp-bmips.c
··· 239 239 */ 240 240 static void bmips_init_secondary(void) 241 241 { 242 + bmips_cpu_setup(); 243 + 242 244 switch (current_cpu_type()) { 243 245 case CPU_BMIPS4350: 244 246 case CPU_BMIPS4380:
+12
arch/mips/kernel/traps.c
··· 1287 1287 err = own_fpu_inatomic(1); 1288 1288 if (msa && !err) { 1289 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 1302 set_thread_flag(TIF_USEDMSA); 1291 1303 set_thread_flag(TIF_MSA_CTX_LIVE); 1292 1304 }
+2
arch/mips/kvm/mips.c
··· 137 137 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) 138 138 { 139 139 switch (type) { 140 + case KVM_VM_MIPS_AUTO: 141 + break; 140 142 #ifdef CONFIG_KVM_MIPS_VZ 141 143 case KVM_VM_MIPS_VZ: 142 144 #else
+4
arch/mips/mm/c-r4k.c
··· 1712 1712 printk("MIPS secondary cache %ldkB, %s, linesize %d bytes.\n", 1713 1713 scache_size >> 10, 1714 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 1720 #else 1717 1721 if (!(c->scache.flags & MIPS_CACHE_NOT_PRESENT)) 1718 1722 panic("Dunno how to handle MIPS32 / MIPS64 second level cache");
+3 -1
arch/mips/oprofile/op_model_mipsxx.c
··· 245 245 246 246 switch (counters) { 247 247 #define HANDLE_COUNTER(n) \ 248 - fallthrough; \ 249 248 case n + 1: \ 250 249 control = r_c0_perfctrl ## n(); \ 251 250 counter = r_c0_perfcntr ## n(); \ ··· 255 256 handled = IRQ_HANDLED; \ 256 257 } 257 258 HANDLE_COUNTER(3) 259 + fallthrough; 258 260 HANDLE_COUNTER(2) 261 + fallthrough; 259 262 HANDLE_COUNTER(1) 263 + fallthrough; 260 264 HANDLE_COUNTER(0) 261 265 } 262 266
+2 -2
arch/mips/sni/a20r.c
··· 222 222 irq_set_chip_and_handler(i, &a20r_irq_type, handle_level_irq); 223 223 sni_hwint = a20r_hwint; 224 224 change_c0_status(ST0_IM, IE_IRQ0); 225 - if (request_irq(SNI_A20R_IRQ_BASE + 3, sni_isa_irq_handler, 0, "ISA", 226 - NULL)) 225 + if (request_irq(SNI_A20R_IRQ_BASE + 3, sni_isa_irq_handler, 226 + IRQF_SHARED, "ISA", sni_isa_irq_handler)) 227 227 pr_err("Failed to register ISA interrupt\n"); 228 228 } 229 229
+21 -12
arch/openrisc/include/asm/uaccess.h
··· 165 165 166 166 #define __get_user_nocheck(x, ptr, size) \ 167 167 ({ \ 168 - long __gu_err, __gu_val; \ 169 - __get_user_size(__gu_val, (ptr), (size), __gu_err); \ 170 - (x) = (__force __typeof__(*(ptr)))__gu_val; \ 168 + long __gu_err; \ 169 + __get_user_size((x), (ptr), (size), __gu_err); \ 171 170 __gu_err; \ 172 171 }) 173 172 174 173 #define __get_user_check(x, ptr, size) \ 175 174 ({ \ 176 - long __gu_err = -EFAULT, __gu_val = 0; \ 175 + long __gu_err = -EFAULT; \ 177 176 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ 178 - if (access_ok(__gu_addr, size)) \ 179 - __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ 180 - (x) = (__force __typeof__(*(ptr)))__gu_val; \ 177 + if (access_ok(__gu_addr, size)) \ 178 + __get_user_size((x), __gu_addr, (size), __gu_err); \ 179 + else \ 180 + (x) = (__typeof__(*(ptr))) 0; \ 181 181 __gu_err; \ 182 182 }) 183 183 ··· 191 191 case 2: __get_user_asm(x, ptr, retval, "l.lhz"); break; \ 192 192 case 4: __get_user_asm(x, ptr, retval, "l.lwz"); break; \ 193 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 196 } while (0) 197 197 198 198 #define __get_user_asm(x, addr, err, op) \ 199 + { \ 200 + unsigned long __gu_tmp; \ 199 201 __asm__ __volatile__( \ 200 202 "1: "op" %1,0(%2)\n" \ 201 203 "2:\n" \ ··· 211 209 " .align 2\n" \ 212 210 " .long 1b,3b\n" \ 213 211 ".previous" \ 214 - : "=r"(err), "=r"(x) \ 215 - : "r"(addr), "i"(-EFAULT), "0"(err)) 212 + : "=r"(err), "=r"(__gu_tmp) \ 213 + : "r"(addr), "i"(-EFAULT), "0"(err)); \ 214 + (x) = (__typeof__(*(addr)))__gu_tmp; \ 215 + } 216 216 217 217 #define __get_user_asm2(x, addr, err) \ 218 + { \ 219 + unsigned long long __gu_tmp; \ 218 220 __asm__ __volatile__( \ 219 221 "1: l.lwz %1,0(%2)\n" \ 220 222 "2: l.lwz %H1,4(%2)\n" \ ··· 235 229 " .long 1b,4b\n" \ 236 230 " .long 2b,4b\n" \ 237 231 ".previous" \ 238 - : "=r"(err), "=&r"(x) \ 239 - : "r"(addr), "i"(-EFAULT), "0"(err)) 232 + : "=r"(err), "=&r"(__gu_tmp) \ 233 + : "r"(addr), "i"(-EFAULT), "0"(err)); \ 234 + (x) = (__typeof__(*(addr)))( \ 235 + (__typeof__((x)-(x)))__gu_tmp); \ 236 + } 240 237 241 238 /* more complex routines */ 242 239
+10
arch/openrisc/kernel/setup.c
··· 80 80 */ 81 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 93 early_init_fdt_reserve_self(); 84 94 early_init_fdt_scan_reserved_mem(); 85 95
+1 -1
arch/openrisc/mm/cache.c
··· 16 16 #include <asm/cacheflush.h> 17 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 21 unsigned long paddr = page_to_pfn(page) << PAGE_SHIFT; 22 22 unsigned long line = paddr & ~(L1_CACHE_BYTES - 1);
+1 -1
arch/s390/Kconfig
··· 30 30 def_bool y 31 31 32 32 config GENERIC_LOCKBREAK 33 - def_bool y if PREEMPTTION 33 + def_bool y if PREEMPTION 34 34 35 35 config PGSTE 36 36 def_bool y if KVM
+4
arch/s390/configs/debug_defconfig
··· 626 626 CONFIG_PROC_KCORE=y 627 627 CONFIG_TMPFS=y 628 628 CONFIG_TMPFS_POSIX_ACL=y 629 + CONFIG_TMPFS_INODE64=y 629 630 CONFIG_HUGETLBFS=y 630 631 CONFIG_CONFIGFS_FS=m 631 632 CONFIG_ECRYPT_FS=m ··· 808 807 CONFIG_BUG_ON_DATA_CORRUPTION=y 809 808 CONFIG_DEBUG_CREDENTIALS=y 810 809 CONFIG_RCU_TORTURE_TEST=m 810 + CONFIG_RCU_REF_SCALE_TEST=m 811 811 CONFIG_RCU_CPU_STALL_TIMEOUT=300 812 812 # CONFIG_RCU_TRACE is not set 813 813 CONFIG_LATENCYTOP=y ··· 820 818 CONFIG_SCHED_TRACER=y 821 819 CONFIG_FTRACE_SYSCALLS=y 822 820 CONFIG_BLK_DEV_IO_TRACE=y 821 + CONFIG_BPF_KPROBE_OVERRIDE=y 823 822 CONFIG_HIST_TRIGGERS=y 824 823 CONFIG_S390_PTDUMP=y 825 824 CONFIG_NOTIFIER_ERROR_INJECTION=m ··· 832 829 CONFIG_FAIL_IO_TIMEOUT=y 833 830 CONFIG_FAIL_FUTEX=y 834 831 CONFIG_FAULT_INJECTION_DEBUG_FS=y 832 + CONFIG_FAIL_FUNCTION=y 835 833 CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y 836 834 CONFIG_LKDTM=m 837 835 CONFIG_TEST_LIST_SORT=y
+3
arch/s390/configs/defconfig
··· 617 617 CONFIG_PROC_KCORE=y 618 618 CONFIG_TMPFS=y 619 619 CONFIG_TMPFS_POSIX_ACL=y 620 + CONFIG_TMPFS_INODE64=y 620 621 CONFIG_HUGETLBFS=y 621 622 CONFIG_CONFIGFS_FS=m 622 623 CONFIG_ECRYPT_FS=m ··· 764 763 CONFIG_TEST_LOCKUP=m 765 764 CONFIG_BUG_ON_DATA_CORRUPTION=y 766 765 CONFIG_RCU_TORTURE_TEST=m 766 + CONFIG_RCU_REF_SCALE_TEST=m 767 767 CONFIG_RCU_CPU_STALL_TIMEOUT=60 768 768 CONFIG_LATENCYTOP=y 769 769 CONFIG_BOOTTIME_TRACING=y ··· 773 771 CONFIG_SCHED_TRACER=y 774 772 CONFIG_FTRACE_SYSCALLS=y 775 773 CONFIG_BLK_DEV_IO_TRACE=y 774 + CONFIG_BPF_KPROBE_OVERRIDE=y 776 775 CONFIG_HIST_TRIGGERS=y 777 776 CONFIG_S390_PTDUMP=y 778 777 CONFIG_LKDTM=m
+1
arch/s390/configs/zfcpdump_defconfig
··· 74 74 CONFIG_PANIC_ON_OOPS=y 75 75 # CONFIG_SCHED_DEBUG is not set 76 76 CONFIG_RCU_CPU_STALL_TIMEOUT=60 77 + # CONFIG_RCU_TRACE is not set 77 78 # CONFIG_FTRACE is not set 78 79 # CONFIG_RUNTIME_TESTING_MENU is not set
+20 -9
arch/x86/entry/common.c
··· 60 60 #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) 61 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 63 if (IS_ENABLED(CONFIG_IA32_EMULATION)) 66 64 current_thread_info()->status |= TS_COMPAT; 67 - /* 68 - * Subtlety here: if ptrace pokes something larger than 2^32-1 into 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); 65 + 66 + return (unsigned int)regs->orig_ax; 73 67 } 74 68 75 69 /* ··· 85 91 { 86 92 unsigned int nr = syscall_32_enter(regs); 87 93 94 + /* 95 + * Subtlety here: if ptrace pokes something larger than 2^32-1 into 96 + * orig_ax, the unsigned int return value truncates it. This may 97 + * or may not be necessary, but it matches the old asm behavior. 98 + */ 99 + nr = (unsigned int)syscall_enter_from_user_mode(regs, nr); 100 + 88 101 do_syscall_32_irqs_on(regs, nr); 89 102 syscall_exit_to_user_mode(regs); 90 103 } 91 104 92 105 static noinstr bool __do_fast_syscall_32(struct pt_regs *regs) 93 106 { 94 - unsigned int nr = syscall_32_enter(regs); 107 + unsigned int nr = syscall_32_enter(regs); 95 108 int res; 109 + 110 + /* 111 + * This cannot use syscall_enter_from_user_mode() as it has to 112 + * fetch EBP before invoking any of the syscall entry work 113 + * functions. 114 + */ 115 + syscall_enter_from_user_mode_prepare(regs); 96 116 97 117 instrumentation_begin(); 98 118 /* Fetch EBP from where the vDSO stashed it. */ ··· 129 121 syscall_exit_to_user_mode(regs); 130 122 return false; 131 123 } 124 + 125 + /* The case truncates any ptrace induced syscall nr > 2^32 -1 */ 126 + nr = (unsigned int)syscall_enter_from_user_mode_work(regs, nr); 132 127 133 128 /* Now this is just like a normal syscall. */ 134 129 do_syscall_32_irqs_on(regs, nr);
+10 -2
arch/x86/include/asm/entry-common.h
··· 18 18 * state, not the interrupt state as imagined by Xen. 19 19 */ 20 20 unsigned long flags = native_save_fl(); 21 - WARN_ON_ONCE(flags & (X86_EFLAGS_AC | X86_EFLAGS_DF | 22 - X86_EFLAGS_NT)); 21 + unsigned long mask = X86_EFLAGS_DF | 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 32 /* We think we came from user mode. Make sure pt_regs agrees. */ 25 33 WARN_ON_ONCE(!user_mode(regs));
+1 -1
arch/x86/include/asm/ptrace.h
··· 327 327 static const unsigned int argument_offs[] = { 328 328 #ifdef __i386__ 329 329 offsetof(struct pt_regs, ax), 330 - offsetof(struct pt_regs, cx), 331 330 offsetof(struct pt_regs, dx), 331 + offsetof(struct pt_regs, cx), 332 332 #define NR_REG_ARGUMENTS 3 333 333 #else 334 334 offsetof(struct pt_regs, di),
+20 -6
arch/x86/kernel/kvm.c
··· 270 270 { 271 271 struct pt_regs *old_regs = set_irq_regs(regs); 272 272 u32 token; 273 - irqentry_state_t state; 274 273 275 - state = irqentry_enter(regs); 274 + ack_APIC_irq(); 276 275 277 276 inc_irq_stat(irq_hv_callback_count); 278 277 ··· 282 283 wrmsrl(MSR_KVM_ASYNC_PF_ACK, 1); 283 284 } 284 285 285 - irqentry_exit(regs, state); 286 286 set_irq_regs(old_regs); 287 287 } 288 288 ··· 652 654 } 653 655 654 656 if (pv_tlb_flush_supported()) { 655 - pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; 656 657 pv_ops.mmu.tlb_remove_table = tlb_remove_table; 657 658 pr_info("KVM setup pv remote TLB flush\n"); 658 659 } ··· 764 767 } 765 768 arch_initcall(activate_jump_labels); 766 769 770 + static void kvm_free_pv_cpu_mask(void) 771 + { 772 + unsigned int cpu; 773 + 774 + for_each_possible_cpu(cpu) 775 + free_cpumask_var(per_cpu(__pv_cpu_mask, cpu)); 776 + } 777 + 767 778 static __init int kvm_alloc_cpumask(void) 768 779 { 769 780 int cpu; ··· 790 785 791 786 if (alloc) 792 787 for_each_possible_cpu(cpu) { 793 - zalloc_cpumask_var_node(per_cpu_ptr(&__pv_cpu_mask, cpu), 794 - GFP_KERNEL, cpu_to_node(cpu)); 788 + if (!zalloc_cpumask_var_node( 789 + per_cpu_ptr(&__pv_cpu_mask, cpu), 790 + GFP_KERNEL, cpu_to_node(cpu))) { 791 + goto zalloc_cpumask_fail; 792 + } 795 793 } 796 794 795 + apic->send_IPI_mask_allbutself = kvm_send_ipi_mask_allbutself; 796 + pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others; 797 797 return 0; 798 + 799 + zalloc_cpumask_fail: 800 + kvm_free_pv_cpu_mask(); 801 + return -ENOMEM; 798 802 } 799 803 arch_initcall(kvm_alloc_cpumask); 800 804
+31 -34
arch/x86/kernel/traps.c
··· 729 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 - /* 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(); 734 + unsigned long dr6; 746 735 747 736 /* 748 737 * The Intel SDM says: ··· 744 755 * 745 756 * Keep it simple: clear DR6 immediately. 746 757 */ 747 - get_debugreg(*dr6, 6); 758 + get_debugreg(dr6, 6); 748 759 set_debugreg(0, 6); 749 760 /* Filter out all the reserved bits which are preset to 1 */ 750 - *dr6 &= ~DR6_RESERVED; 751 - } 761 + dr6 &= ~DR6_RESERVED; 752 762 753 - static __always_inline void debug_exit(unsigned long dr7) 754 - { 755 - local_db_restore(dr7); 763 + return dr6; 756 764 } 757 765 758 766 /* ··· 849 863 static __always_inline void exc_debug_kernel(struct pt_regs *regs, 850 864 unsigned long dr6) 851 865 { 866 + /* 867 + * Disable breakpoints during exception handling; recursive exceptions 868 + * are exceedingly 'fun'. 869 + * 870 + * Since this function is NOKPROBE, and that also applies to 871 + * HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a 872 + * HW_BREAKPOINT_W on our stack) 873 + * 874 + * Entry text is excluded for HW_BP_X and cpu_entry_area, which 875 + * includes the entry stack is excluded for everything. 876 + */ 877 + unsigned long dr7 = local_db_save(); 852 878 bool irq_state = idtentry_enter_nmi(regs); 853 879 instrumentation_begin(); 854 880 ··· 881 883 882 884 instrumentation_end(); 883 885 idtentry_exit_nmi(regs, irq_state); 886 + 887 + local_db_restore(dr7); 884 888 } 885 889 886 890 static __always_inline void exc_debug_user(struct pt_regs *regs, ··· 893 893 * #DB, we will malfunction. 894 894 */ 895 895 WARN_ON_ONCE(!user_mode(regs)); 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 + */ 896 905 897 906 irqentry_enter_from_user_mode(regs); 898 907 instrumentation_begin(); ··· 916 907 /* IST stack entry */ 917 908 DEFINE_IDTENTRY_DEBUG(exc_debug) 918 909 { 919 - unsigned long dr6, dr7; 920 - 921 - debug_enter(&dr6, &dr7); 922 - exc_debug_kernel(regs, dr6); 923 - debug_exit(dr7); 910 + exc_debug_kernel(regs, debug_read_clear_dr6()); 924 911 } 925 912 926 913 /* User entry, runs on regular task stack */ 927 914 DEFINE_IDTENTRY_DEBUG_USER(exc_debug) 928 915 { 929 - unsigned long dr6, dr7; 930 - 931 - debug_enter(&dr6, &dr7); 932 - exc_debug_user(regs, dr6); 933 - debug_exit(dr7); 916 + exc_debug_user(regs, debug_read_clear_dr6()); 934 917 } 935 918 #else 936 919 /* 32 bit does not have separate entry points. */ 937 920 DEFINE_IDTENTRY_RAW(exc_debug) 938 921 { 939 - unsigned long dr6, dr7; 940 - 941 - debug_enter(&dr6, &dr7); 922 + unsigned long dr6 = debug_read_clear_dr6(); 942 923 943 924 if (user_mode(regs)) 944 925 exc_debug_user(regs, dr6); 945 926 else 946 927 exc_debug_kernel(regs, dr6); 947 - 948 - debug_exit(dr7); 949 928 } 950 929 #endif 951 930
+17 -5
arch/x86/kvm/emulate.c
··· 2505 2505 *reg_write(ctxt, i) = GET_SMSTATE(u32, smstate, 0x7fd0 + i * 4); 2506 2506 2507 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 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 2517 selector = GET_SMSTATE(u32, smstate, 0x7fc4); 2513 2518 set_desc_base(&desc, GET_SMSTATE(u32, smstate, 0x7f64)); ··· 2565 2560 ctxt->eflags = GET_SMSTATE(u32, smstate, 0x7f70) | X86_EFLAGS_FIXED; 2566 2561 2567 2562 val = GET_SMSTATE(u32, smstate, 0x7f68); 2568 - ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1); 2563 + 2564 + if (ctxt->ops->set_dr(ctxt, 6, (val & DR6_VOLATILE) | DR6_FIXED_1)) 2565 + return X86EMUL_UNHANDLEABLE; 2566 + 2569 2567 val = GET_SMSTATE(u32, smstate, 0x7f60); 2570 - ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1); 2568 + 2569 + if (ctxt->ops->set_dr(ctxt, 7, (val & DR7_VOLATILE) | DR7_FIXED_1)) 2570 + return X86EMUL_UNHANDLEABLE; 2571 2571 2572 2572 cr0 = GET_SMSTATE(u64, smstate, 0x7f58); 2573 2573 cr3 = GET_SMSTATE(u64, smstate, 0x7f50); 2574 2574 cr4 = GET_SMSTATE(u64, smstate, 0x7f48); 2575 2575 ctxt->ops->set_smbase(ctxt, GET_SMSTATE(u32, smstate, 0x7f00)); 2576 2576 val = GET_SMSTATE(u64, smstate, 0x7ed0); 2577 - ctxt->ops->set_msr(ctxt, MSR_EFER, val & ~EFER_LMA); 2577 + 2578 + if (ctxt->ops->set_msr(ctxt, MSR_EFER, val & ~EFER_LMA)) 2579 + return X86EMUL_UNHANDLEABLE; 2578 2580 2579 2581 selector = GET_SMSTATE(u32, smstate, 0x7e90); 2580 2582 rsm_set_desc_flags(&desc, GET_SMSTATE(u32, smstate, 0x7e92) << 8);
+1 -1
arch/x86/kvm/mmu/mmu.c
··· 2469 2469 } 2470 2470 2471 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 2474 __clear_sp_write_flooding_count(sp); 2475 2475
+6 -1
arch/x86/kvm/svm/nested.c
··· 586 586 svm->vcpu.arch.mp_state = KVM_MP_STATE_RUNNABLE; 587 587 588 588 /* Give the current vmcb to the guest */ 589 - svm_set_gif(svm, false); 590 589 591 590 nested_vmcb->save.es = vmcb->save.es; 592 591 nested_vmcb->save.cs = vmcb->save.cs; ··· 630 631 631 632 /* Restore the original control entries */ 632 633 copy_vmcb_control_area(&vmcb->control, &hsave->control); 634 + 635 + /* On vmexit the GIF is set to false */ 636 + svm_set_gif(svm, false); 633 637 634 638 svm->vmcb->control.tsc_offset = svm->vcpu.arch.tsc_offset = 635 639 svm->vcpu.arch.l1_tsc_offset; ··· 1133 1131 svm->nested.vmcb = kvm_state->hdr.svm.vmcb_pa; 1134 1132 load_nested_vmcb_control(svm, &ctl); 1135 1133 nested_prepare_vmcb_control(svm); 1134 + 1135 + if (!nested_svm_vmrun_msrpm(svm)) 1136 + return -EINVAL; 1136 1137 1137 1138 out_set_gif: 1138 1139 svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET));
+1
arch/x86/kvm/svm/sev.c
··· 1106 1106 list_for_each_safe(pos, q, head) { 1107 1107 __unregister_enc_region_locked(kvm, 1108 1108 list_entry(pos, struct enc_region, list)); 1109 + cond_resched(); 1109 1110 } 1110 1111 } 1111 1112
+21 -15
arch/x86/kvm/svm/svm.c
··· 2938 2938 if (npt_enabled) 2939 2939 vcpu->arch.cr3 = svm->vmcb->save.cr3; 2940 2940 2941 - svm_complete_interrupts(svm); 2942 - 2943 2941 if (is_guest_mode(vcpu)) { 2944 2942 int vmexit; 2945 2943 ··· 3502 3504 stgi(); 3503 3505 3504 3506 /* Any pending NMI will happen here */ 3505 - exit_fastpath = svm_exit_handlers_fastpath(vcpu); 3506 3507 3507 3508 if (unlikely(svm->vmcb->control.exit_code == SVM_EXIT_NMI)) 3508 3509 kvm_after_interrupt(&svm->vcpu); ··· 3515 3518 } 3516 3519 3517 3520 svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; 3521 + vmcb_mark_all_clean(svm->vmcb); 3518 3522 3519 3523 /* if exit due to PF check for async PF */ 3520 3524 if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR) ··· 3535 3537 SVM_EXIT_EXCP_BASE + MC_VECTOR)) 3536 3538 svm_handle_mce(svm); 3537 3539 3538 - vmcb_mark_all_clean(svm->vmcb); 3540 + svm_complete_interrupts(svm); 3541 + exit_fastpath = svm_exit_handlers_fastpath(vcpu); 3539 3542 return exit_fastpath; 3540 3543 } 3541 3544 ··· 3899 3900 static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) 3900 3901 { 3901 3902 struct vcpu_svm *svm = to_svm(vcpu); 3902 - struct vmcb *nested_vmcb; 3903 3903 struct kvm_host_map map; 3904 - u64 guest; 3905 - u64 vmcb; 3906 3904 int ret = 0; 3907 3905 3908 - guest = GET_SMSTATE(u64, smstate, 0x7ed8); 3909 - vmcb = GET_SMSTATE(u64, smstate, 0x7ee0); 3906 + if (guest_cpuid_has(vcpu, X86_FEATURE_LM)) { 3907 + u64 saved_efer = GET_SMSTATE(u64, smstate, 0x7ed0); 3908 + u64 guest = GET_SMSTATE(u64, smstate, 0x7ed8); 3909 + u64 vmcb = GET_SMSTATE(u64, smstate, 0x7ee0); 3910 3910 3911 - if (guest) { 3912 - if (kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb), &map) == -EINVAL) 3913 - return 1; 3914 - nested_vmcb = map.hva; 3915 - ret = enter_svm_guest_mode(svm, vmcb, nested_vmcb); 3916 - kvm_vcpu_unmap(&svm->vcpu, &map, true); 3911 + if (guest) { 3912 + if (!guest_cpuid_has(vcpu, X86_FEATURE_SVM)) 3913 + return 1; 3914 + 3915 + if (!(saved_efer & EFER_SVME)) 3916 + return 1; 3917 + 3918 + if (kvm_vcpu_map(&svm->vcpu, 3919 + gpa_to_gfn(vmcb), &map) == -EINVAL) 3920 + return 1; 3921 + 3922 + ret = enter_svm_guest_mode(svm, vmcb, map.hva); 3923 + kvm_vcpu_unmap(&svm->vcpu, &map, true); 3924 + } 3917 3925 } 3918 3926 3919 3927 return ret;
+9 -1
arch/x86/kvm/vmx/nested.c
··· 4404 4404 if (kvm_check_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu)) 4405 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 4415 leave_guest_mode(vcpu); 4408 4416 4409 4417 if (nested_cpu_has_preemption_timer(vmcs12)) ··· 4676 4668 vmx->nested.msrs.entry_ctls_high &= 4677 4669 ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; 4678 4670 vmx->nested.msrs.exit_ctls_high &= 4679 - ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; 4671 + ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; 4680 4672 } 4681 4673 } 4682 4674
+3 -2
arch/x86/kvm/vmx/vmx.c
··· 2971 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 2976 struct kvm_mmu *mmu = vcpu->arch.walk_mmu; 2977 2977 ··· 3114 3114 guest_cr3 = vcpu->arch.cr3; 3115 3115 else /* vmcs01.GUEST_CR3 is already up-to-date. */ 3116 3116 update_guest_cr3 = false; 3117 - ept_load_pdptrs(vcpu); 3117 + vmx_ept_load_pdptrs(vcpu); 3118 3118 } else { 3119 3119 guest_cr3 = pgd; 3120 3120 } ··· 6054 6054 (exit_reason != EXIT_REASON_EXCEPTION_NMI && 6055 6055 exit_reason != EXIT_REASON_EPT_VIOLATION && 6056 6056 exit_reason != EXIT_REASON_PML_FULL && 6057 + exit_reason != EXIT_REASON_APIC_ACCESS && 6057 6058 exit_reason != EXIT_REASON_TASK_SWITCH)) { 6058 6059 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 6059 6060 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV;
+1
arch/x86/kvm/vmx/vmx.h
··· 356 356 int vmx_find_msr_index(struct vmx_msrs *m, u32 msr); 357 357 int vmx_handle_memory_failure(struct kvm_vcpu *vcpu, int r, 358 358 struct x86_exception *e); 359 + void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu); 359 360 360 361 #define POSTED_INTR_ON 0 361 362 #define POSTED_INTR_SN 1
+4 -1
arch/x86/kvm/x86.c
··· 2731 2731 return 1; 2732 2732 2733 2733 if (!lapic_in_kernel(vcpu)) 2734 - return 1; 2734 + return data ? 1 : 0; 2735 2735 2736 2736 vcpu->arch.apf.msr_en_val = data; 2737 2737 ··· 3577 3577 break; 3578 3578 case KVM_CAP_SMALLER_MAXPHYADDR: 3579 3579 r = (int) allow_smaller_maxphyaddr; 3580 + break; 3581 + case KVM_CAP_STEAL_TIME: 3582 + r = sched_info_on(); 3580 3583 break; 3581 3584 default: 3582 3585 break;
+1 -1
arch/x86/lib/Makefile
··· 24 24 CFLAGS_REMOVE_cmdline.o = -pg 25 25 endif 26 26 27 - CFLAGS_cmdline.o := -fno-stack-protector 27 + CFLAGS_cmdline.o := -fno-stack-protector -fno-jump-tables 28 28 endif 29 29 30 30 inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
+78
arch/x86/mm/fault.c
··· 190 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 240 void arch_sync_kernel_mappings(unsigned long start, unsigned long end) 194 241 { 195 242 unsigned long addr; ··· 1156 1109 * space, so do not expect them here. 1157 1110 */ 1158 1111 WARN_ON_ONCE(hw_error_code & X86_PF_PK); 1112 + 1113 + #ifdef CONFIG_X86_32 1114 + /* 1115 + * We can fault-in kernel-space virtual memory on-demand. The 1116 + * 'reference' page table is init_mm.pgd. 1117 + * 1118 + * NOTE! We MUST NOT take any locks for this case. We may 1119 + * be in an interrupt or a critical region, and should 1120 + * only copy the information from the master page table, 1121 + * nothing more. 1122 + * 1123 + * Before doing this on-demand faulting, ensure that the 1124 + * fault is not any of the following: 1125 + * 1. A fault on a PTE with a reserved bit set. 1126 + * 2. A fault caused by a user-mode access. (Do not demand- 1127 + * fault kernel memory due to user-mode accesses). 1128 + * 3. A fault caused by a page-level protection violation. 1129 + * (A demand fault would be on a non-present page which 1130 + * would have X86_PF_PROT==0). 1131 + * 1132 + * This is only needed to close a race condition on x86-32 in 1133 + * the vmalloc mapping/unmapping code. See the comment above 1134 + * vmalloc_fault() for details. On x86-64 the race does not 1135 + * exist as the vmalloc mappings don't need to be synchronized 1136 + * there. 1137 + */ 1138 + if (!(hw_error_code & (X86_PF_RSVD | X86_PF_USER | X86_PF_PROT))) { 1139 + if (vmalloc_fault(address) >= 0) 1140 + return; 1141 + } 1142 + #endif 1159 1143 1160 1144 /* Was the fault spurious, caused by lazy TLB invalidation? */ 1161 1145 if (spurious_kernel_fault(hw_error_code, address))
+1 -1
arch/x86/mm/numa_emulation.c
··· 321 321 u64 addr, u64 max_addr, u64 size) 322 322 { 323 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 327 static int __init setup_emu2phys_nid(int *dfl_phys_nid)
-12
block/bfq-iosched.c
··· 5896 5896 struct bfq_data *bfqd; 5897 5897 5898 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 - /* 5911 5899 * rq either is not associated with any icq, or is an already 5912 5900 * requeued request that has not (yet) been re-inserted into 5913 5901 * a bfq_queue.
+3 -1
block/bio.c
··· 879 879 struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; 880 880 881 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 884 return false; 885 + } 884 886 bv->bv_len += len; 885 887 bio->bi_iter.bi_size += len; 886 888 return true;
+1
block/blk-core.c
··· 539 539 goto fail_stats; 540 540 541 541 q->backing_dev_info->ra_pages = VM_READAHEAD_PAGES; 542 + q->backing_dev_info->io_pages = VM_READAHEAD_PAGES; 542 543 q->backing_dev_info->capabilities = BDI_CAP_CGROUP_WRITEBACK; 543 544 q->node = node_id; 544 545
+3 -2
block/blk-iocost.c
··· 2092 2092 { 2093 2093 struct ioc_gq *iocg = pd_to_iocg(pd); 2094 2094 struct ioc *ioc = iocg->ioc; 2095 + unsigned long flags; 2095 2096 2096 2097 if (ioc) { 2097 - spin_lock(&ioc->lock); 2098 + spin_lock_irqsave(&ioc->lock, flags); 2098 2099 if (!list_empty(&iocg->active_list)) { 2099 2100 propagate_active_weight(iocg, 0, 0); 2100 2101 list_del_init(&iocg->active_list); 2101 2102 } 2102 - spin_unlock(&ioc->lock); 2103 + spin_unlock_irqrestore(&ioc->lock, flags); 2103 2104 2104 2105 hrtimer_cancel(&iocg->waitq_timer); 2105 2106 hrtimer_cancel(&iocg->delay_timer);
+1 -1
block/blk-mq-sched.h
··· 66 66 struct request_queue *q = rq->q; 67 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 70 e->type->ops.requeue_request(rq); 71 71 } 72 72
+11 -6
block/blk-stat.c
··· 137 137 struct blk_stat_callback *cb) 138 138 { 139 139 unsigned int bucket; 140 + unsigned long flags; 140 141 int cpu; 141 142 142 143 for_each_possible_cpu(cpu) { ··· 148 147 blk_rq_stat_init(&cpu_stat[bucket]); 149 148 } 150 149 151 - spin_lock(&q->stats->lock); 150 + spin_lock_irqsave(&q->stats->lock, flags); 152 151 list_add_tail_rcu(&cb->list, &q->stats->callbacks); 153 152 blk_queue_flag_set(QUEUE_FLAG_STATS, q); 154 - spin_unlock(&q->stats->lock); 153 + spin_unlock_irqrestore(&q->stats->lock, flags); 155 154 } 156 155 157 156 void blk_stat_remove_callback(struct request_queue *q, 158 157 struct blk_stat_callback *cb) 159 158 { 160 - spin_lock(&q->stats->lock); 159 + unsigned long flags; 160 + 161 + spin_lock_irqsave(&q->stats->lock, flags); 161 162 list_del_rcu(&cb->list); 162 163 if (list_empty(&q->stats->callbacks) && !q->stats->enable_accounting) 163 164 blk_queue_flag_clear(QUEUE_FLAG_STATS, q); 164 - spin_unlock(&q->stats->lock); 165 + spin_unlock_irqrestore(&q->stats->lock, flags); 165 166 166 167 del_timer_sync(&cb->timer); 167 168 } ··· 186 183 187 184 void blk_stat_enable_accounting(struct request_queue *q) 188 185 { 189 - spin_lock(&q->stats->lock); 186 + unsigned long flags; 187 + 188 + spin_lock_irqsave(&q->stats->lock, flags); 190 189 q->stats->enable_accounting = true; 191 190 blk_queue_flag_set(QUEUE_FLAG_STATS, q); 192 - spin_unlock(&q->stats->lock); 191 + spin_unlock_irqrestore(&q->stats->lock, flags); 193 192 } 194 193 EXPORT_SYMBOL_GPL(blk_stat_enable_accounting); 195 194
+22 -15
block/partitions/core.c
··· 278 278 { 279 279 struct hd_struct *part = 280 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 291 part->start_sect = 0; 283 292 part->nr_sects = 0; ··· 302 293 rcu_dereference_protected(disk->part_tbl, 1); 303 294 304 295 rcu_assign_pointer(ptbl->last_lookup, NULL); 305 - put_device(disk_to_dev(disk)); 306 296 307 297 INIT_RCU_WORK(&part->rcu_work, hd_struct_free_work); 308 298 queue_rcu_work(system_wq, &part->rcu_work); ··· 532 524 int bdev_del_partition(struct block_device *bdev, int partno) 533 525 { 534 526 struct block_device *bdevp; 535 - struct hd_struct *part; 536 - int ret = 0; 527 + struct hd_struct *part = NULL; 528 + int ret; 537 529 538 - part = disk_get_part(bdev->bd_disk, partno); 539 - if (!part) 530 + bdevp = bdget_disk(bdev->bd_disk, partno); 531 + if (!bdevp) 540 532 return -ENXIO; 541 533 542 - ret = -ENOMEM; 543 - bdevp = bdget(part_devt(part)); 544 - if (!bdevp) 545 - goto out_put_part; 546 - 547 534 mutex_lock(&bdevp->bd_mutex); 535 + mutex_lock_nested(&bdev->bd_mutex, 1); 536 + 537 + ret = -ENXIO; 538 + part = disk_get_part(bdev->bd_disk, partno); 539 + if (!part) 540 + goto out_unlock; 548 541 549 542 ret = -EBUSY; 550 543 if (bdevp->bd_openers) ··· 554 545 sync_blockdev(bdevp); 555 546 invalidate_bdev(bdevp); 556 547 557 - mutex_lock_nested(&bdev->bd_mutex, 1); 558 548 delete_partition(bdev->bd_disk, part); 559 - mutex_unlock(&bdev->bd_mutex); 560 - 561 549 ret = 0; 562 550 out_unlock: 551 + mutex_unlock(&bdev->bd_mutex); 563 552 mutex_unlock(&bdevp->bd_mutex); 564 553 bdput(bdevp); 565 - out_put_part: 566 - disk_put_part(part); 554 + if (part) 555 + disk_put_part(part); 567 556 return ret; 568 557 } 569 558
+1 -2
drivers/ata/ahci.c
··· 807 807 (sstatus & 0xf) != 1) 808 808 break; 809 809 810 - ata_link_printk(link, KERN_INFO, "avn bounce port%d\n", 811 - port); 810 + ata_link_info(link, "avn bounce port%d\n", port); 812 811 813 812 pci_read_config_word(pdev, 0x92, &val); 814 813 val &= ~(1 << port);
+2 -3
drivers/ata/libata-core.c
··· 3868 3868 /* https://bugzilla.kernel.org/show_bug.cgi?id=15573 */ 3869 3869 { "C300-CTFDDAC128MAG", "0001", ATA_HORKAGE_NONCQ, }, 3870 3870 3871 - /* Some Sandisk SSDs lock up hard with NCQ enabled. Reported on 3872 - SD7SN6S256G and SD8SN8U256G */ 3873 - { "SanDisk SD[78]SN*G", NULL, ATA_HORKAGE_NONCQ, }, 3871 + /* Sandisk SD7/8/9s lock up hard on large trims */ 3872 + { "SanDisk SD[789]*", NULL, ATA_HORKAGE_MAX_TRIM_128M, }, 3874 3873 3875 3874 /* devices which puke on READ_NATIVE_MAX */ 3876 3875 { "HDS724040KLSA80", "KFAOA20N", ATA_HORKAGE_BROKEN_HPA, },
+7 -1
drivers/ata/libata-scsi.c
··· 2080 2080 2081 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 2084 u16 min_io_sectors; 2084 2085 2085 2086 rbuf[1] = 0xb0; ··· 2106 2105 * with the unmap bit set. 2107 2106 */ 2108 2107 if (ata_id_has_trim(args->id)) { 2109 - put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM, &rbuf[36]); 2108 + u64 max_blocks = 65535 * ATA_MAX_TRIM_RNUM; 2109 + 2110 + if (dev->horkage & ATA_HORKAGE_MAX_TRIM_128M) 2111 + max_blocks = 128 << (20 - SECTOR_SHIFT); 2112 + 2113 + put_unaligned_be64(max_blocks, &rbuf[36]); 2110 2114 put_unaligned_be32(1, &rbuf[28]); 2111 2115 } 2112 2116
+1
drivers/atm/firestream.c
··· 998 998 error = make_rate (pcr, r, &tmc0, NULL); 999 999 if (error) { 1000 1000 kfree(tc); 1001 + kfree(vcc); 1001 1002 return error; 1002 1003 } 1003 1004 }
+1 -1
drivers/auxdisplay/arm-charlcd.c
··· 2 2 /* 3 3 * Driver for the on-board character LCD found on some ARM reference boards 4 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 6 * Currently it will just display the text "ARM Linux" and the linux version 7 7 * 8 8 * Author: Linus Walleij <triad@df.lth.se>
+2 -6
drivers/base/core.c
··· 807 807 void device_link_del(struct device_link *link) 808 808 { 809 809 device_links_write_lock(); 810 - device_pm_lock(); 811 810 device_link_put_kref(link); 812 - device_pm_unlock(); 813 811 device_links_write_unlock(); 814 812 } 815 813 EXPORT_SYMBOL_GPL(device_link_del); ··· 828 830 return; 829 831 830 832 device_links_write_lock(); 831 - device_pm_lock(); 832 833 833 834 list_for_each_entry(link, &supplier->links.consumers, s_node) { 834 835 if (link->consumer == consumer) { ··· 836 839 } 837 840 } 838 841 839 - device_pm_unlock(); 840 842 device_links_write_unlock(); 841 843 } 842 844 EXPORT_SYMBOL_GPL(device_link_remove); ··· 4233 4237 vaf.va = &args; 4234 4238 4235 4239 if (err != -EPROBE_DEFER) { 4236 - dev_err(dev, "error %d: %pV", err, &vaf); 4240 + dev_err(dev, "error %pe: %pV", ERR_PTR(err), &vaf); 4237 4241 } else { 4238 4242 device_set_deferred_probe_reason(dev, &vaf); 4239 - dev_dbg(dev, "error %d: %pV", err, &vaf); 4243 + dev_dbg(dev, "error %pe: %pV", ERR_PTR(err), &vaf); 4240 4244 } 4241 4245 4242 4246 va_end(args);
+2
drivers/base/firmware_loader/firmware.h
··· 142 142 void fw_free_paged_buf(struct fw_priv *fw_priv); 143 143 int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed); 144 144 int fw_map_paged_buf(struct fw_priv *fw_priv); 145 + bool fw_is_paged_buf(struct fw_priv *fw_priv); 145 146 #else 146 147 static inline void fw_free_paged_buf(struct fw_priv *fw_priv) {} 147 148 static inline int fw_grow_paged_buf(struct fw_priv *fw_priv, int pages_needed) { return -ENXIO; } 148 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 151 #endif 150 152 151 153 #endif /* __FIRMWARE_LOADER_H */
+11 -6
drivers/base/firmware_loader/main.c
··· 252 252 list_del(&fw_priv->list); 253 253 spin_unlock(&fwc->lock); 254 254 255 - fw_free_paged_buf(fw_priv); /* free leftover pages */ 256 - if (!fw_priv->allocated_size) 255 + if (fw_is_paged_buf(fw_priv)) 256 + fw_free_paged_buf(fw_priv); 257 + else if (!fw_priv->allocated_size) 257 258 vfree(fw_priv->data); 259 + 258 260 kfree_const(fw_priv->fw_name); 259 261 kfree(fw_priv); 260 262 } ··· 270 268 } 271 269 272 270 #ifdef CONFIG_FW_LOADER_PAGED_BUF 271 + bool fw_is_paged_buf(struct fw_priv *fw_priv) 272 + { 273 + return fw_priv->is_paged_buf; 274 + } 275 + 273 276 void fw_free_paged_buf(struct fw_priv *fw_priv) 274 277 { 275 278 int i; 276 279 277 280 if (!fw_priv->pages) 278 281 return; 282 + 283 + vunmap(fw_priv->data); 279 284 280 285 for (i = 0; i < fw_priv->nr_pages; i++) 281 286 __free_page(fw_priv->pages[i]); ··· 336 327 PAGE_KERNEL_RO); 337 328 if (!fw_priv->data) 338 329 return -ENOMEM; 339 - 340 - /* page table is no longer needed after mapping, let's free */ 341 - kvfree(fw_priv->pages); 342 - fw_priv->pages = NULL; 343 330 344 331 return 0; 345 332 }
+12
drivers/block/rbd.c
··· 5120 5120 { 5121 5121 struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); 5122 5122 5123 + if (!capable(CAP_SYS_ADMIN)) 5124 + return -EPERM; 5125 + 5123 5126 return sprintf(buf, "%s\n", rbd_dev->config_info); 5124 5127 } 5125 5128 ··· 5233 5230 { 5234 5231 struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); 5235 5232 int ret; 5233 + 5234 + if (!capable(CAP_SYS_ADMIN)) 5235 + return -EPERM; 5236 5236 5237 5237 ret = rbd_dev_refresh(rbd_dev); 5238 5238 if (ret) ··· 7065 7059 struct rbd_client *rbdc; 7066 7060 int rc; 7067 7061 7062 + if (!capable(CAP_SYS_ADMIN)) 7063 + return -EPERM; 7064 + 7068 7065 if (!try_module_get(THIS_MODULE)) 7069 7066 return -ENODEV; 7070 7067 ··· 7217 7208 char opt_buf[6]; 7218 7209 bool force = false; 7219 7210 int ret; 7211 + 7212 + if (!capable(CAP_SYS_ADMIN)) 7213 + return -EPERM; 7220 7214 7221 7215 dev_id = -1; 7222 7216 opt_buf[0] = '\0';
+2 -2
drivers/counter/microchip-tcb-capture.c
··· 320 320 } 321 321 322 322 regmap = syscon_node_to_regmap(np->parent); 323 - if (IS_ERR(priv->regmap)) 324 - return PTR_ERR(priv->regmap); 323 + if (IS_ERR(regmap)) 324 + return PTR_ERR(regmap); 325 325 326 326 /* max. channels number is 2 when in QDEC mode */ 327 327 priv->num_channels = of_property_count_u32_elems(np, "reg");
+150 -90
drivers/cpufreq/intel_pstate.c
··· 219 219 * @epp_policy: Last saved policy used to set EPP/EPB 220 220 * @epp_default: Power on default HWP energy performance 221 221 * preference/bias 222 - * @epp_saved: Saved EPP/EPB during system suspend or CPU offline 223 - * operation 224 222 * @epp_cached Cached HWP energy-performance preference value 225 223 * @hwp_req_cached: Cached value of the last HWP Request MSR 226 224 * @hwp_cap_cached: Cached value of the last HWP Capabilities MSR 227 225 * @last_io_update: Last time when IO wake flag was set 228 226 * @sched_flags: Store scheduler flags for possible cross CPU update 229 227 * @hwp_boost_min: Last HWP boosted min performance 228 + * @suspended: Whether or not the driver has been suspended. 230 229 * 231 230 * This structure stores per CPU instance data for all CPUs. 232 231 */ ··· 257 258 s16 epp_powersave; 258 259 s16 epp_policy; 259 260 s16 epp_default; 260 - s16 epp_saved; 261 261 s16 epp_cached; 262 262 u64 hwp_req_cached; 263 263 u64 hwp_cap_cached; 264 264 u64 last_io_update; 265 265 unsigned int sched_flags; 266 266 u32 hwp_boost_min; 267 + bool suspended; 267 268 }; 268 269 269 270 static struct cpudata **all_cpu_data; ··· 643 644 644 645 static int intel_pstate_set_epp(struct cpudata *cpu, u32 epp) 645 646 { 647 + int ret; 648 + 646 649 /* 647 650 * Use the cached HWP Request MSR value, because in the active mode the 648 651 * register itself may be updated by intel_pstate_hwp_boost_up() or ··· 660 659 * function, so it cannot run in parallel with the update below. 661 660 */ 662 661 WRITE_ONCE(cpu->hwp_req_cached, value); 663 - return wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); 662 + ret = wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); 663 + if (!ret) 664 + cpu->epp_cached = epp; 665 + 666 + return ret; 664 667 } 665 668 666 669 static int intel_pstate_set_energy_pref_index(struct cpudata *cpu_data, ··· 682 677 epp = raw_epp; 683 678 else if (epp == -EINVAL) 684 679 epp = epp_values[pref_index - 1]; 680 + 681 + /* 682 + * To avoid confusion, refuse to set EPP to any values different 683 + * from 0 (performance) if the current policy is "performance", 684 + * because those values would be overridden. 685 + */ 686 + if (epp > 0 && cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) 687 + return -EBUSY; 685 688 686 689 ret = intel_pstate_set_epp(cpu_data, epp); 687 690 } else { ··· 775 762 cpufreq_stop_governor(policy); 776 763 ret = intel_pstate_set_epp(cpu, epp); 777 764 err = cpufreq_start_governor(policy); 778 - if (!ret) { 779 - cpu->epp_cached = epp; 765 + if (!ret) 780 766 ret = err; 781 - } 782 767 } 783 768 } 784 769 ··· 836 825 837 826 rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap); 838 827 WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap); 839 - if (global.no_turbo) 828 + if (global.no_turbo || global.turbo_disabled) 840 829 *current_max = HWP_GUARANTEED_PERF(cap); 841 830 else 842 831 *current_max = HWP_HIGHEST_PERF(cap); ··· 870 859 871 860 cpu_data->epp_policy = cpu_data->policy; 872 861 873 - if (cpu_data->epp_saved >= 0) { 874 - epp = cpu_data->epp_saved; 875 - cpu_data->epp_saved = -EINVAL; 876 - goto update_epp; 877 - } 878 - 879 862 if (cpu_data->policy == CPUFREQ_POLICY_PERFORMANCE) { 880 863 epp = intel_pstate_get_epp(cpu_data, value); 881 864 cpu_data->epp_powersave = epp; ··· 896 891 897 892 epp = cpu_data->epp_powersave; 898 893 } 899 - update_epp: 900 894 if (boot_cpu_has(X86_FEATURE_HWP_EPP)) { 901 895 value &= ~GENMASK_ULL(31, 24); 902 896 value |= (u64)epp << 24; ··· 907 903 wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); 908 904 } 909 905 910 - static void intel_pstate_hwp_force_min_perf(int cpu) 906 + static void intel_pstate_hwp_offline(struct cpudata *cpu) 911 907 { 912 - u64 value; 908 + u64 value = READ_ONCE(cpu->hwp_req_cached); 913 909 int min_perf; 914 910 915 - value = all_cpu_data[cpu]->hwp_req_cached; 911 + if (boot_cpu_has(X86_FEATURE_HWP_EPP)) { 912 + /* 913 + * In case the EPP has been set to "performance" by the 914 + * active mode "performance" scaling algorithm, replace that 915 + * temporary value with the cached EPP one. 916 + */ 917 + value &= ~GENMASK_ULL(31, 24); 918 + value |= HWP_ENERGY_PERF_PREFERENCE(cpu->epp_cached); 919 + WRITE_ONCE(cpu->hwp_req_cached, value); 920 + } 921 + 916 922 value &= ~GENMASK_ULL(31, 0); 917 - min_perf = HWP_LOWEST_PERF(all_cpu_data[cpu]->hwp_cap_cached); 923 + min_perf = HWP_LOWEST_PERF(cpu->hwp_cap_cached); 918 924 919 925 /* Set hwp_max = hwp_min */ 920 926 value |= HWP_MAX_PERF(min_perf); ··· 934 920 if (boot_cpu_has(X86_FEATURE_HWP_EPP)) 935 921 value |= HWP_ENERGY_PERF_PREFERENCE(HWP_EPP_POWERSAVE); 936 922 937 - wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); 938 - } 939 - 940 - static int intel_pstate_hwp_save_state(struct cpufreq_policy *policy) 941 - { 942 - struct cpudata *cpu_data = all_cpu_data[policy->cpu]; 943 - 944 - if (!hwp_active) 945 - return 0; 946 - 947 - cpu_data->epp_saved = intel_pstate_get_epp(cpu_data, 0); 948 - 949 - return 0; 923 + wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, value); 950 924 } 951 925 952 926 #define POWER_CTL_EE_ENABLE 1 ··· 961 959 962 960 static void intel_pstate_hwp_enable(struct cpudata *cpudata); 963 961 962 + static void intel_pstate_hwp_reenable(struct cpudata *cpu) 963 + { 964 + intel_pstate_hwp_enable(cpu); 965 + wrmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, READ_ONCE(cpu->hwp_req_cached)); 966 + } 967 + 968 + static int intel_pstate_suspend(struct cpufreq_policy *policy) 969 + { 970 + struct cpudata *cpu = all_cpu_data[policy->cpu]; 971 + 972 + pr_debug("CPU %d suspending\n", cpu->cpu); 973 + 974 + cpu->suspended = true; 975 + 976 + return 0; 977 + } 978 + 964 979 static int intel_pstate_resume(struct cpufreq_policy *policy) 965 980 { 981 + struct cpudata *cpu = all_cpu_data[policy->cpu]; 982 + 983 + pr_debug("CPU %d resuming\n", cpu->cpu); 966 984 967 985 /* Only restore if the system default is changed */ 968 986 if (power_ctl_ee_state == POWER_CTL_EE_ENABLE) ··· 990 968 else if (power_ctl_ee_state == POWER_CTL_EE_DISABLE) 991 969 set_power_ctl_ee_state(false); 992 970 993 - if (!hwp_active) 994 - return 0; 971 + if (cpu->suspended && hwp_active) { 972 + mutex_lock(&intel_pstate_limits_lock); 995 973 996 - mutex_lock(&intel_pstate_limits_lock); 974 + /* Re-enable HWP, because "online" has not done that. */ 975 + intel_pstate_hwp_reenable(cpu); 997 976 998 - if (policy->cpu == 0) 999 - intel_pstate_hwp_enable(all_cpu_data[policy->cpu]); 977 + mutex_unlock(&intel_pstate_limits_lock); 978 + } 1000 979 1001 - all_cpu_data[policy->cpu]->epp_policy = 0; 1002 - intel_pstate_hwp_set(policy->cpu); 1003 - 1004 - mutex_unlock(&intel_pstate_limits_lock); 980 + cpu->suspended = false; 1005 981 1006 982 return 0; 1007 983 } ··· 1448 1428 wrmsrl_on_cpu(cpudata->cpu, MSR_HWP_INTERRUPT, 0x00); 1449 1429 1450 1430 wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1); 1451 - cpudata->epp_policy = 0; 1452 1431 if (cpudata->epp_default == -EINVAL) 1453 1432 cpudata->epp_default = intel_pstate_get_epp(cpudata, 0); 1454 1433 } ··· 2116 2097 2117 2098 all_cpu_data[cpunum] = cpu; 2118 2099 2100 + cpu->cpu = cpunum; 2101 + 2119 2102 cpu->epp_default = -EINVAL; 2120 - cpu->epp_powersave = -EINVAL; 2121 - cpu->epp_saved = -EINVAL; 2103 + 2104 + if (hwp_active) { 2105 + const struct x86_cpu_id *id; 2106 + 2107 + intel_pstate_hwp_enable(cpu); 2108 + 2109 + id = x86_match_cpu(intel_pstate_hwp_boost_ids); 2110 + if (id && intel_pstate_acpi_pm_profile_server()) 2111 + hwp_boost = true; 2112 + } 2113 + } else if (hwp_active) { 2114 + /* 2115 + * Re-enable HWP in case this happens after a resume from ACPI 2116 + * S3 if the CPU was offline during the whole system/resume 2117 + * cycle. 2118 + */ 2119 + intel_pstate_hwp_reenable(cpu); 2122 2120 } 2123 2121 2124 - cpu = all_cpu_data[cpunum]; 2125 - 2126 - cpu->cpu = cpunum; 2127 - 2128 - if (hwp_active) { 2129 - const struct x86_cpu_id *id; 2130 - 2131 - intel_pstate_hwp_enable(cpu); 2132 - 2133 - id = x86_match_cpu(intel_pstate_hwp_boost_ids); 2134 - if (id && intel_pstate_acpi_pm_profile_server()) 2135 - hwp_boost = true; 2136 - } 2122 + cpu->epp_powersave = -EINVAL; 2123 + cpu->epp_policy = 0; 2137 2124 2138 2125 intel_pstate_get_cpu_pstates(cpu); 2139 2126 ··· 2321 2296 return 0; 2322 2297 } 2323 2298 2324 - static void intel_cpufreq_stop_cpu(struct cpufreq_policy *policy) 2299 + static int intel_pstate_cpu_offline(struct cpufreq_policy *policy) 2325 2300 { 2301 + struct cpudata *cpu = all_cpu_data[policy->cpu]; 2302 + 2303 + pr_debug("CPU %d going offline\n", cpu->cpu); 2304 + 2305 + if (cpu->suspended) 2306 + return 0; 2307 + 2308 + /* 2309 + * If the CPU is an SMT thread and it goes offline with the performance 2310 + * settings different from the minimum, it will prevent its sibling 2311 + * from getting to lower performance levels, so force the minimum 2312 + * performance on CPU offline to prevent that from happening. 2313 + */ 2326 2314 if (hwp_active) 2327 - intel_pstate_hwp_force_min_perf(policy->cpu); 2315 + intel_pstate_hwp_offline(cpu); 2328 2316 else 2329 - intel_pstate_set_min_pstate(all_cpu_data[policy->cpu]); 2317 + intel_pstate_set_min_pstate(cpu); 2318 + 2319 + intel_pstate_exit_perf_limits(policy); 2320 + 2321 + return 0; 2322 + } 2323 + 2324 + static int intel_pstate_cpu_online(struct cpufreq_policy *policy) 2325 + { 2326 + struct cpudata *cpu = all_cpu_data[policy->cpu]; 2327 + 2328 + pr_debug("CPU %d going online\n", cpu->cpu); 2329 + 2330 + intel_pstate_init_acpi_perf_limits(policy); 2331 + 2332 + if (hwp_active) { 2333 + /* 2334 + * Re-enable HWP and clear the "suspended" flag to let "resume" 2335 + * know that it need not do that. 2336 + */ 2337 + intel_pstate_hwp_reenable(cpu); 2338 + cpu->suspended = false; 2339 + } 2340 + 2341 + return 0; 2330 2342 } 2331 2343 2332 2344 static void intel_pstate_stop_cpu(struct cpufreq_policy *policy) 2333 2345 { 2334 - pr_debug("CPU %d exiting\n", policy->cpu); 2346 + pr_debug("CPU %d stopping\n", policy->cpu); 2335 2347 2336 2348 intel_pstate_clear_update_util_hook(policy->cpu); 2337 - if (hwp_active) 2338 - intel_pstate_hwp_save_state(policy); 2339 - 2340 - intel_cpufreq_stop_cpu(policy); 2341 2349 } 2342 2350 2343 2351 static int intel_pstate_cpu_exit(struct cpufreq_policy *policy) 2344 2352 { 2345 - intel_pstate_exit_perf_limits(policy); 2353 + pr_debug("CPU %d exiting\n", policy->cpu); 2346 2354 2347 2355 policy->fast_switch_possible = false; 2348 2356 ··· 2436 2378 */ 2437 2379 policy->policy = CPUFREQ_POLICY_POWERSAVE; 2438 2380 2381 + if (hwp_active) { 2382 + struct cpudata *cpu = all_cpu_data[policy->cpu]; 2383 + 2384 + cpu->epp_cached = intel_pstate_get_epp(cpu, 0); 2385 + } 2386 + 2439 2387 return 0; 2440 2388 } 2441 2389 ··· 2449 2385 .flags = CPUFREQ_CONST_LOOPS, 2450 2386 .verify = intel_pstate_verify_policy, 2451 2387 .setpolicy = intel_pstate_set_policy, 2452 - .suspend = intel_pstate_hwp_save_state, 2388 + .suspend = intel_pstate_suspend, 2453 2389 .resume = intel_pstate_resume, 2454 2390 .init = intel_pstate_cpu_init, 2455 2391 .exit = intel_pstate_cpu_exit, 2456 2392 .stop_cpu = intel_pstate_stop_cpu, 2393 + .offline = intel_pstate_cpu_offline, 2394 + .online = intel_pstate_cpu_online, 2457 2395 .update_limits = intel_pstate_update_limits, 2458 2396 .name = "intel_pstate", 2459 2397 }; ··· 2651 2585 policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY_HWP; 2652 2586 rdmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value); 2653 2587 WRITE_ONCE(cpu->hwp_req_cached, value); 2654 - cpu->epp_cached = (value & GENMASK_ULL(31, 24)) >> 24; 2588 + cpu->epp_cached = intel_pstate_get_epp(cpu, value); 2655 2589 } else { 2656 2590 turbo_max = cpu->pstate.turbo_pstate; 2657 2591 policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY; ··· 2710 2644 .fast_switch = intel_cpufreq_fast_switch, 2711 2645 .init = intel_cpufreq_cpu_init, 2712 2646 .exit = intel_cpufreq_cpu_exit, 2713 - .stop_cpu = intel_cpufreq_stop_cpu, 2647 + .offline = intel_pstate_cpu_offline, 2648 + .online = intel_pstate_cpu_online, 2649 + .suspend = intel_pstate_suspend, 2650 + .resume = intel_pstate_resume, 2714 2651 .update_limits = intel_pstate_update_limits, 2715 2652 .name = "intel_cpufreq", 2716 2653 }; ··· 2735 2666 } 2736 2667 } 2737 2668 put_online_cpus(); 2738 - 2739 - if (intel_pstate_driver == &intel_pstate) 2740 - intel_pstate_sysfs_hide_hwp_dynamic_boost(); 2741 2669 2742 2670 intel_pstate_driver = NULL; 2743 2671 } ··· 2761 2695 return 0; 2762 2696 } 2763 2697 2764 - static int intel_pstate_unregister_driver(void) 2765 - { 2766 - cpufreq_unregister_driver(intel_pstate_driver); 2767 - intel_pstate_driver_cleanup(); 2768 - 2769 - return 0; 2770 - } 2771 - 2772 2698 static ssize_t intel_pstate_show_status(char *buf) 2773 2699 { 2774 2700 if (!intel_pstate_driver) ··· 2772 2714 2773 2715 static int intel_pstate_update_status(const char *buf, size_t size) 2774 2716 { 2775 - int ret; 2717 + if (size == 3 && !strncmp(buf, "off", size)) { 2718 + if (!intel_pstate_driver) 2719 + return -EINVAL; 2776 2720 2777 - if (size == 3 && !strncmp(buf, "off", size)) 2778 - return intel_pstate_driver ? 2779 - intel_pstate_unregister_driver() : -EINVAL; 2721 + if (hwp_active) 2722 + return -EBUSY; 2723 + 2724 + cpufreq_unregister_driver(intel_pstate_driver); 2725 + intel_pstate_driver_cleanup(); 2726 + } 2780 2727 2781 2728 if (size == 6 && !strncmp(buf, "active", size)) { 2782 2729 if (intel_pstate_driver) { 2783 2730 if (intel_pstate_driver == &intel_pstate) 2784 2731 return 0; 2785 2732 2786 - ret = intel_pstate_unregister_driver(); 2787 - if (ret) 2788 - return ret; 2733 + cpufreq_unregister_driver(intel_pstate_driver); 2789 2734 } 2790 2735 2791 2736 return intel_pstate_register_driver(&intel_pstate); ··· 2799 2738 if (intel_pstate_driver == &intel_cpufreq) 2800 2739 return 0; 2801 2740 2802 - ret = intel_pstate_unregister_driver(); 2803 - if (ret) 2804 - return ret; 2741 + cpufreq_unregister_driver(intel_pstate_driver); 2742 + intel_pstate_sysfs_hide_hwp_dynamic_boost(); 2805 2743 } 2806 2744 2807 2745 return intel_pstate_register_driver(&intel_cpufreq);
+1 -1
drivers/dax/device.c
··· 429 429 return -EBUSY; 430 430 } 431 431 432 - dev_dax->pgmap.type = MEMORY_DEVICE_DEVDAX; 432 + dev_dax->pgmap.type = MEMORY_DEVICE_GENERIC; 433 433 addr = devm_memremap_pages(dev, &dev_dax->pgmap); 434 434 if (IS_ERR(addr)) 435 435 return PTR_ERR(addr);
+1 -1
drivers/dax/super.c
··· 100 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 104 pr_debug("%s: error: dax unsupported by block device\n", 105 105 bdevname(bdev, buf)); 106 106 return false;
+3 -3
drivers/dma-buf/dma-buf.c
··· 316 316 * name of the dma-buf if the same piece of memory is used for multiple 317 317 * purpose between different devices. 318 318 * 319 - * @dmabuf [in] dmabuf buffer that will be renamed. 320 - * @buf: [in] A piece of userspace memory that contains the name of 321 - * the dma-buf. 319 + * @dmabuf: [in] dmabuf buffer that will be renamed. 320 + * @buf: [in] A piece of userspace memory that contains the name of 321 + * the dma-buf. 322 322 * 323 323 * Returns 0 on success. If the dma-buf buffer is already attached to 324 324 * devices, return -EBUSY.
+1
drivers/dma-buf/dma-fence-chain.c
··· 222 222 * @chain: the chain node to initialize 223 223 * @prev: the previous fence 224 224 * @fence: the current fence 225 + * @seqno: the sequence number to use for the fence chain 225 226 * 226 227 * Initialize a new chain node and either start a new chain or add the node to 227 228 * the existing chain of the previous fence.
+3 -1
drivers/dma/acpi-dma.c
··· 135 135 if (ret < 0) { 136 136 dev_warn(&adev->dev, 137 137 "error in parsing resource group\n"); 138 - return; 138 + break; 139 139 } 140 140 141 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 /**
+9 -2
drivers/dma/at_hdmac.c
··· 1650 1650 return NULL; 1651 1651 1652 1652 dmac_pdev = of_find_device_by_node(dma_spec->np); 1653 + if (!dmac_pdev) 1654 + return NULL; 1653 1655 1654 1656 dma_cap_zero(mask); 1655 1657 dma_cap_set(DMA_SLAVE, mask); 1656 1658 1657 1659 atslave = kmalloc(sizeof(*atslave), GFP_KERNEL); 1658 - if (!atslave) 1660 + if (!atslave) { 1661 + put_device(&dmac_pdev->dev); 1659 1662 return NULL; 1663 + } 1660 1664 1661 1665 atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW; 1662 1666 /* ··· 1689 1685 atslave->dma_dev = &dmac_pdev->dev; 1690 1686 1691 1687 chan = dma_request_channel(mask, at_dma_filter, atslave); 1692 - if (!chan) 1688 + if (!chan) { 1689 + put_device(&dmac_pdev->dev); 1690 + kfree(atslave); 1693 1691 return NULL; 1692 + } 1694 1693 1695 1694 atchan = to_at_dma_chan(chan); 1696 1695 atchan->per_if = dma_spec->args[0] & 0xff;
+19 -19
drivers/dma/dma-jz4780.c
··· 879 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 882 jzdma->clk = devm_clk_get(dev, NULL); 896 883 if (IS_ERR(jzdma->clk)) { 897 884 dev_err(dev, "failed to get clock\n"); 898 885 ret = PTR_ERR(jzdma->clk); 899 - goto err_free_irq; 886 + return ret; 900 887 } 901 888 902 889 clk_prepare_enable(jzdma->clk); ··· 936 949 jzchan->vchan.desc_free = jz4780_dma_desc_free; 937 950 } 938 951 952 + ret = platform_get_irq(pdev, 0); 953 + if (ret < 0) 954 + goto err_disable_clk; 955 + 956 + jzdma->irq = ret; 957 + 958 + ret = request_irq(jzdma->irq, jz4780_dma_irq_handler, 0, dev_name(dev), 959 + jzdma); 960 + if (ret) { 961 + dev_err(dev, "failed to request IRQ %u!\n", jzdma->irq); 962 + goto err_disable_clk; 963 + } 964 + 939 965 ret = dmaenginem_async_device_register(dd); 940 966 if (ret) { 941 967 dev_err(dev, "failed to register device\n"); 942 - goto err_disable_clk; 968 + goto err_free_irq; 943 969 } 944 970 945 971 /* Register with OF DMA helpers. */ ··· 960 960 jzdma); 961 961 if (ret) { 962 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 966 dev_info(dev, "JZ4780 DMA controller initialised\n"); 967 967 return 0; 968 968 969 - err_disable_clk: 970 - clk_disable_unprepare(jzdma->clk); 971 - 972 969 err_free_irq: 973 970 free_irq(jzdma->irq, jzdma); 971 + 972 + err_disable_clk: 973 + clk_disable_unprepare(jzdma->clk); 974 974 return ret; 975 975 } 976 976
+6 -5
drivers/dma/dw-edma/dw-edma-core.c
··· 405 405 if (xfer->cyclic) { 406 406 burst->dar = xfer->xfer.cyclic.paddr; 407 407 } else { 408 - burst->dar = sg_dma_address(sg); 408 + burst->dar = dst_addr; 409 409 /* Unlike the typical assumption by other 410 410 * drivers/IPs the peripheral memory isn't 411 411 * a FIFO memory, in this case, it's a ··· 413 413 * and destination addresses are increased 414 414 * by the same portion (data length) 415 415 */ 416 - src_addr += sg_dma_len(sg); 417 416 } 418 417 } else { 419 418 burst->dar = dst_addr; 420 419 if (xfer->cyclic) { 421 420 burst->sar = xfer->xfer.cyclic.paddr; 422 421 } else { 423 - burst->sar = sg_dma_address(sg); 422 + burst->sar = src_addr; 424 423 /* Unlike the typical assumption by other 425 424 * drivers/IPs the peripheral memory isn't 426 425 * a FIFO memory, in this case, it's a ··· 427 428 * and destination addresses are increased 428 429 * by the same portion (data length) 429 430 */ 430 - dst_addr += sg_dma_len(sg); 431 431 } 432 432 } 433 433 434 - if (!xfer->cyclic) 434 + if (!xfer->cyclic) { 435 + src_addr += sg_dma_len(sg); 436 + dst_addr += sg_dma_len(sg); 435 437 sg = sg_next(sg); 438 + } 436 439 } 437 440 438 441 return vchan_tx_prep(&chan->vc, &desc->vd, xfer->flags);
+26
drivers/dma/idxd/device.c
··· 410 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 429 int idxd_device_disable(struct idxd_device *idxd) 414 430 { 415 431 struct device *dev = &idxd->pdev->dev; 416 432 u32 status; 433 + unsigned long flags; 417 434 418 435 if (!idxd_is_enabled(idxd)) { 419 436 dev_dbg(dev, "Device is not enabled\n"); ··· 446 429 return -ENXIO; 447 430 } 448 431 432 + spin_lock_irqsave(&idxd->dev_lock, flags); 433 + idxd_device_wqs_clear_state(idxd); 449 434 idxd->state = IDXD_DEV_CONF_READY; 435 + spin_unlock_irqrestore(&idxd->dev_lock, flags); 450 436 return 0; 451 437 } 452 438 453 439 void idxd_device_reset(struct idxd_device *idxd) 454 440 { 441 + unsigned long flags; 442 + 455 443 idxd_cmd_exec(idxd, IDXD_CMD_RESET_DEVICE, 0, NULL); 444 + spin_lock_irqsave(&idxd->dev_lock, flags); 445 + idxd_device_wqs_clear_state(idxd); 446 + idxd->state = IDXD_DEV_CONF_READY; 447 + spin_unlock_irqrestore(&idxd->dev_lock, flags); 456 448 } 457 449 458 450 /* Device configuration bits */
-12
drivers/dma/idxd/irq.c
··· 11 11 #include "idxd.h" 12 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 14 static void idxd_device_reinit(struct work_struct *work) 27 15 { 28 16 struct idxd_device *idxd = container_of(work, struct idxd_device, work);
+4 -4
drivers/dma/of-dma.c
··· 71 71 return NULL; 72 72 73 73 chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target); 74 - if (chan) { 75 - chan->router = ofdma->dma_router; 76 - chan->route_data = route_data; 77 - } else { 74 + if (IS_ERR_OR_NULL(chan)) { 78 75 ofdma->dma_router->route_free(ofdma->dma_router->dev, 79 76 route_data); 77 + } else { 78 + chan->router = ofdma->dma_router; 79 + chan->route_data = route_data; 80 80 } 81 81 82 82 /*
+1 -1
drivers/dma/pl330.c
··· 2797 2797 while (burst != (1 << desc->rqcfg.brst_size)) 2798 2798 desc->rqcfg.brst_size++; 2799 2799 2800 + desc->rqcfg.brst_len = get_burst_len(desc, len); 2800 2801 /* 2801 2802 * If burst size is smaller than bus width then make sure we only 2802 2803 * transfer one at a time to avoid a burst stradling an MFIFO entry. ··· 2805 2804 if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width) 2806 2805 desc->rqcfg.brst_len = 1; 2807 2806 2808 - desc->rqcfg.brst_len = get_burst_len(desc, len); 2809 2807 desc->bytes_requested = len; 2810 2808 2811 2809 desc->txd.flags = flags;
+5 -5
drivers/dma/ti/k3-udma.c
··· 2059 2059 return NULL; 2060 2060 } 2061 2061 2062 - cppi5_tr_init(&tr_req[i].flags, CPPI5_TR_TYPE1, false, false, 2063 - CPPI5_TR_EVENT_SIZE_COMPLETION, 0); 2064 - cppi5_tr_csf_set(&tr_req[i].flags, CPPI5_TR_CSF_SUPR_EVT); 2062 + cppi5_tr_init(&tr_req[tr_idx].flags, CPPI5_TR_TYPE1, false, 2063 + false, CPPI5_TR_EVENT_SIZE_COMPLETION, 0); 2064 + cppi5_tr_csf_set(&tr_req[tr_idx].flags, CPPI5_TR_CSF_SUPR_EVT); 2065 2065 2066 2066 tr_req[tr_idx].addr = sg_addr; 2067 2067 tr_req[tr_idx].icnt0 = tr0_cnt0; ··· 3101 3101 .psil_base = 0x1000, 3102 3102 .enable_memcpy_support = true, 3103 3103 .statictr_z_mask = GENMASK(11, 0), 3104 - .rchan_oes_offset = 0x2000, 3104 + .rchan_oes_offset = 0x200, 3105 3105 }; 3106 3106 3107 3107 static struct udma_match_data am654_mcu_data = { 3108 3108 .psil_base = 0x6000, 3109 3109 .enable_memcpy_support = false, 3110 3110 .statictr_z_mask = GENMASK(11, 0), 3111 - .rchan_oes_offset = 0x2000, 3111 + .rchan_oes_offset = 0x200, 3112 3112 }; 3113 3113 3114 3114 static struct udma_match_data j721e_main_data = {
+5 -5
drivers/firmware/efi/embedded-firmware.c
··· 16 16 17 17 /* Exported for use by lib/test_firmware.c only */ 18 18 LIST_HEAD(efi_embedded_fw_list); 19 - EXPORT_SYMBOL_GPL(efi_embedded_fw_list); 20 - 21 - static bool checked_for_fw; 19 + EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_list, TEST_FIRMWARE); 20 + bool efi_embedded_fw_checked; 21 + EXPORT_SYMBOL_NS_GPL(efi_embedded_fw_checked, TEST_FIRMWARE); 22 22 23 23 static const struct dmi_system_id * const embedded_fw_table[] = { 24 24 #ifdef CONFIG_TOUCHSCREEN_DMI ··· 116 116 } 117 117 } 118 118 119 - checked_for_fw = true; 119 + efi_embedded_fw_checked = true; 120 120 } 121 121 122 122 int efi_get_embedded_fw(const char *name, const u8 **data, size_t *size) 123 123 { 124 124 struct efi_embedded_fw *iter, *fw = NULL; 125 125 126 - if (!checked_for_fw) { 126 + if (!efi_embedded_fw_checked) { 127 127 pr_warn("Warning %s called while we did not check for embedded fw\n", 128 128 __func__); 129 129 return -ENOENT;
+7 -3
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
··· 1840 1840 { 1841 1841 int ret = 0; 1842 1842 uint32_t feature_mask[2]; 1843 - unsigned long feature_enabled; 1843 + uint64_t feature_enabled; 1844 + 1844 1845 ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2); 1845 - feature_enabled = (unsigned long)((uint64_t)feature_mask[0] | 1846 - ((uint64_t)feature_mask[1] << 32)); 1846 + if (ret) 1847 + return false; 1848 + 1849 + feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0]; 1850 + 1847 1851 return !!(feature_enabled & SMC_DPM_FEATURE); 1848 1852 } 1849 1853
+2 -1
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
··· 3581 3581 case AMDGPU_PP_SENSOR_GPU_POWER: 3582 3582 return smu7_get_gpu_power(hwmgr, (uint32_t *)value); 3583 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 3586 val_vid = PHM_READ_INDIRECT_FIELD(hwmgr->device, 3586 3587 CGS_IND_REG__SMC, PWR_SVI2_STATUS, PLANE2_VID); 3587 3588 else
+12 -2
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c
··· 374 374 /* compare them in unit celsius degree */ 375 375 if (low < range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES) 376 376 low = range->min / PP_TEMPERATURE_UNITS_PER_CENTIGRADES; 377 - if (high > tdp_table->usSoftwareShutdownTemp) 378 - high = tdp_table->usSoftwareShutdownTemp; 377 + 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 390 if (low > high) 381 391 return -EINVAL;
+7 -3
drivers/gpu/drm/amd/powerplay/navi10_ppt.c
··· 1331 1331 { 1332 1332 int ret = 0; 1333 1333 uint32_t feature_mask[2]; 1334 - unsigned long feature_enabled; 1334 + uint64_t feature_enabled; 1335 + 1335 1336 ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2); 1336 - feature_enabled = (unsigned long)((uint64_t)feature_mask[0] | 1337 - ((uint64_t)feature_mask[1] << 32)); 1337 + if (ret) 1338 + return false; 1339 + 1340 + feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0]; 1341 + 1338 1342 return !!(feature_enabled & SMC_DPM_FEATURE); 1339 1343 } 1340 1344
+10 -4
drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
··· 68 68 FEATURE_MASK(FEATURE_DPM_LINK_BIT) | \ 69 69 FEATURE_MASK(FEATURE_DPM_SOCCLK_BIT) | \ 70 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 74 #define SMU_11_0_7_GFX_BUSY_THRESHOLD 15 74 75 ··· 230 229 231 230 *(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_DPM_PREFETCHER_BIT) 232 231 | FEATURE_MASK(FEATURE_DPM_FCLK_BIT) 232 + | FEATURE_MASK(FEATURE_DPM_MP0CLK_BIT) 233 233 | FEATURE_MASK(FEATURE_DS_SOCCLK_BIT) 234 234 | FEATURE_MASK(FEATURE_DS_DCEFCLK_BIT) 235 235 | FEATURE_MASK(FEATURE_DS_FCLK_BIT) ··· 1149 1147 { 1150 1148 int ret = 0; 1151 1149 uint32_t feature_mask[2]; 1152 - unsigned long feature_enabled; 1150 + uint64_t feature_enabled; 1151 + 1153 1152 ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2); 1154 - feature_enabled = (unsigned long)((uint64_t)feature_mask[0] | 1155 - ((uint64_t)feature_mask[1] << 32)); 1153 + if (ret) 1154 + return false; 1155 + 1156 + feature_enabled = (uint64_t)feature_mask[1] << 32 | feature_mask[0]; 1157 + 1156 1158 return !!(feature_enabled & SMC_DPM_FEATURE); 1157 1159 } 1158 1160
+2
drivers/gpu/drm/amd/powerplay/smumgr/ci_smumgr.c
··· 37 37 #include "cgs_common.h" 38 38 #include "atombios.h" 39 39 #include "pppcielanes.h" 40 + #include "smu7_smumgr.h" 40 41 41 42 #include "smu/smu_7_0_1_d.h" 42 43 #include "smu/smu_7_0_1_sh_mask.h" ··· 2949 2948 .request_smu_load_specific_fw = NULL, 2950 2949 .send_msg_to_smc = ci_send_msg_to_smc, 2951 2950 .send_msg_to_smc_with_parameter = ci_send_msg_to_smc_with_parameter, 2951 + .get_argument = smu7_get_argument, 2952 2952 .download_pptable_settings = NULL, 2953 2953 .upload_pptable_settings = NULL, 2954 2954 .get_offsetof = ci_get_offsetof,
+2 -2
drivers/gpu/drm/i915/display/intel_combo_phy.c
··· 258 258 static bool icl_combo_phy_verify_state(struct drm_i915_private *dev_priv, 259 259 enum phy phy) 260 260 { 261 - bool ret; 261 + bool ret = true; 262 262 u32 expected_val = 0; 263 263 264 264 if (!icl_combo_phy_enabled(dev_priv, phy)) ··· 276 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 281 if (phy_is_master(dev_priv, phy)) { 282 282 ret &= check_phy_reg(dev_priv, phy, ICL_PORT_COMP_DW8(phy),
+4 -6
drivers/gpu/drm/i915/display/intel_display.c
··· 14956 14956 if (dev_priv->wm.distrust_bios_wm) 14957 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 14959 intel_fbc_choose_crtc(dev_priv, state); 14966 14960 ret = calc_watermark_data(state); 14967 14961 if (ret) ··· 14970 14976 goto fail; 14971 14977 14972 14978 if (any_ms) { 14979 + ret = intel_modeset_checks(state); 14980 + if (ret) 14981 + goto fail; 14982 + 14973 14983 ret = intel_modeset_calc_cdclk(state); 14974 14984 if (ret) 14975 14985 return ret;
+27 -7
drivers/gpu/drm/i915/display/intel_hdcp.c
··· 336 336 337 337 /* Fill up the empty slots in sha_text and write it out */ 338 338 sha_empty = sizeof(sha_text) - sha_leftovers; 339 - for (j = 0; j < sha_empty; j++) 340 - sha_text |= ksv[j] << ((sizeof(sha_text) - j - 1) * 8); 339 + for (j = 0; j < sha_empty; j++) { 340 + u8 off = ((sizeof(sha_text) - j - 1 - sha_leftovers) * 8); 341 + sha_text |= ksv[j] << off; 342 + } 341 343 342 344 ret = intel_write_sha_text(dev_priv, sha_text); 343 345 if (ret < 0) ··· 437 435 /* Write 32 bits of text */ 438 436 intel_de_write(dev_priv, HDCP_REP_CTL, 439 437 rep_ctl | HDCP_SHA1_TEXT_32); 440 - sha_text |= bstatus[0] << 24 | bstatus[1] << 16; 438 + sha_text |= bstatus[0] << 8 | bstatus[1]; 441 439 ret = intel_write_sha_text(dev_priv, sha_text); 442 440 if (ret < 0) 443 441 return ret; ··· 452 450 return ret; 453 451 sha_idx += sizeof(sha_text); 454 452 } 455 - } else if (sha_leftovers == 3) { 456 - /* Write 32 bits of text */ 453 + 454 + /* 455 + * Terminate the SHA-1 stream by hand. For the other leftover 456 + * cases this is appended by the hardware. 457 + */ 457 458 intel_de_write(dev_priv, HDCP_REP_CTL, 458 459 rep_ctl | HDCP_SHA1_TEXT_32); 459 - sha_text |= bstatus[0] << 24; 460 + sha_text = DRM_HDCP_SHA1_TERMINATOR << 24; 461 + ret = intel_write_sha_text(dev_priv, sha_text); 462 + if (ret < 0) 463 + return ret; 464 + sha_idx += sizeof(sha_text); 465 + } else if (sha_leftovers == 3) { 466 + /* Write 32 bits of text (filled from LSB) */ 467 + intel_de_write(dev_priv, HDCP_REP_CTL, 468 + rep_ctl | HDCP_SHA1_TEXT_32); 469 + sha_text |= bstatus[0]; 460 470 ret = intel_write_sha_text(dev_priv, sha_text); 461 471 if (ret < 0) 462 472 return ret; 463 473 sha_idx += sizeof(sha_text); 464 474 465 - /* Write 8 bits of text, 24 bits of M0 */ 475 + /* Write 8 bits of text (filled from LSB), 24 bits of M0 */ 466 476 intel_de_write(dev_priv, HDCP_REP_CTL, 467 477 rep_ctl | HDCP_SHA1_TEXT_8); 468 478 ret = intel_write_sha_text(dev_priv, bstatus[1]); ··· 795 781 struct intel_hdcp *hdcp = &connector->hdcp; 796 782 enum port port = dig_port->base.port; 797 783 enum transcoder cpu_transcoder = hdcp->cpu_transcoder; 784 + u32 repeater_ctl; 798 785 int ret; 799 786 800 787 drm_dbg_kms(&dev_priv->drm, "[%s:%d] HDCP is being disabled...\n", ··· 810 795 "Failed to disable HDCP, timeout clearing status\n"); 811 796 return -ETIMEDOUT; 812 797 } 798 + 799 + repeater_ctl = intel_hdcp_get_repeater_ctl(dev_priv, cpu_transcoder, 800 + port); 801 + intel_de_write(dev_priv, HDCP_REP_CTL, 802 + intel_de_read(dev_priv, HDCP_REP_CTL) & ~repeater_ctl); 813 803 814 804 ret = hdcp->shim->toggle_signalling(dig_port, false); 815 805 if (ret) {
+292 -20
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
··· 45 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 55 #define __EXEC_OBJECT_HAS_PIN BIT(31) 49 56 #define __EXEC_OBJECT_HAS_FENCE BIT(30) 50 57 #define __EXEC_OBJECT_NEEDS_MAP BIT(29) ··· 260 253 */ 261 254 struct reloc_cache { 262 255 struct drm_mm_node node; /** temporary GTT binding */ 256 + unsigned long vaddr; /** Current kmap address */ 257 + unsigned long page; /** Currently mapped page index */ 263 258 unsigned int gen; /** Cached value of INTEL_GEN */ 264 259 bool use_64bit_reloc : 1; 265 260 bool has_llc : 1; ··· 605 596 } 606 597 } 607 598 599 + static inline int use_cpu_reloc(const struct reloc_cache *cache, 600 + const struct drm_i915_gem_object *obj) 601 + { 602 + if (!i915_gem_object_has_struct_page(obj)) 603 + return false; 604 + 605 + if (DBG_FORCE_RELOC == FORCE_CPU_RELOC) 606 + return true; 607 + 608 + if (DBG_FORCE_RELOC == FORCE_GTT_RELOC) 609 + return false; 610 + 611 + return (cache->has_llc || 612 + obj->cache_dirty || 613 + obj->cache_level != I915_CACHE_NONE); 614 + } 615 + 608 616 static int eb_reserve_vma(const struct i915_execbuffer *eb, 609 617 struct eb_vma *ev, 610 618 u64 pin_flags) ··· 952 926 static void reloc_cache_init(struct reloc_cache *cache, 953 927 struct drm_i915_private *i915) 954 928 { 929 + cache->page = -1; 930 + cache->vaddr = 0; 955 931 /* Must be a variable in the struct to allow GCC to unroll. */ 956 932 cache->gen = INTEL_GEN(i915); 957 933 cache->has_llc = HAS_LLC(i915); ··· 963 935 cache->node.flags = 0; 964 936 cache->rq = NULL; 965 937 cache->target = NULL; 938 + } 939 + 940 + static inline void *unmask_page(unsigned long p) 941 + { 942 + return (void *)(uintptr_t)(p & PAGE_MASK); 943 + } 944 + 945 + static inline unsigned int unmask_flags(unsigned long p) 946 + { 947 + return p & ~PAGE_MASK; 948 + } 949 + 950 + #define KMAP 0x4 /* after CLFLUSH_FLAGS */ 951 + 952 + static inline struct i915_ggtt *cache_to_ggtt(struct reloc_cache *cache) 953 + { 954 + struct drm_i915_private *i915 = 955 + container_of(cache, struct i915_execbuffer, reloc_cache)->i915; 956 + return &i915->ggtt; 966 957 } 967 958 968 959 #define RELOC_TAIL 4 ··· 1094 1047 i915_request_add(rq); 1095 1048 1096 1049 return err; 1050 + } 1051 + 1052 + static void reloc_cache_reset(struct reloc_cache *cache) 1053 + { 1054 + void *vaddr; 1055 + 1056 + if (!cache->vaddr) 1057 + return; 1058 + 1059 + vaddr = unmask_page(cache->vaddr); 1060 + if (cache->vaddr & KMAP) { 1061 + if (cache->vaddr & CLFLUSH_AFTER) 1062 + mb(); 1063 + 1064 + kunmap_atomic(vaddr); 1065 + i915_gem_object_finish_access((struct drm_i915_gem_object *)cache->node.mm); 1066 + } else { 1067 + struct i915_ggtt *ggtt = cache_to_ggtt(cache); 1068 + 1069 + intel_gt_flush_ggtt_writes(ggtt->vm.gt); 1070 + io_mapping_unmap_atomic((void __iomem *)vaddr); 1071 + 1072 + if (drm_mm_node_allocated(&cache->node)) { 1073 + ggtt->vm.clear_range(&ggtt->vm, 1074 + cache->node.start, 1075 + cache->node.size); 1076 + mutex_lock(&ggtt->vm.mutex); 1077 + drm_mm_remove_node(&cache->node); 1078 + mutex_unlock(&ggtt->vm.mutex); 1079 + } else { 1080 + i915_vma_unpin((struct i915_vma *)cache->node.mm); 1081 + } 1082 + } 1083 + 1084 + cache->vaddr = 0; 1085 + cache->page = -1; 1086 + } 1087 + 1088 + static void *reloc_kmap(struct drm_i915_gem_object *obj, 1089 + struct reloc_cache *cache, 1090 + unsigned long page) 1091 + { 1092 + void *vaddr; 1093 + 1094 + if (cache->vaddr) { 1095 + kunmap_atomic(unmask_page(cache->vaddr)); 1096 + } else { 1097 + unsigned int flushes; 1098 + int err; 1099 + 1100 + err = i915_gem_object_prepare_write(obj, &flushes); 1101 + if (err) 1102 + return ERR_PTR(err); 1103 + 1104 + BUILD_BUG_ON(KMAP & CLFLUSH_FLAGS); 1105 + BUILD_BUG_ON((KMAP | CLFLUSH_FLAGS) & PAGE_MASK); 1106 + 1107 + cache->vaddr = flushes | KMAP; 1108 + cache->node.mm = (void *)obj; 1109 + if (flushes) 1110 + mb(); 1111 + } 1112 + 1113 + vaddr = kmap_atomic(i915_gem_object_get_dirty_page(obj, page)); 1114 + cache->vaddr = unmask_flags(cache->vaddr) | (unsigned long)vaddr; 1115 + cache->page = page; 1116 + 1117 + return vaddr; 1118 + } 1119 + 1120 + static void *reloc_iomap(struct drm_i915_gem_object *obj, 1121 + struct reloc_cache *cache, 1122 + unsigned long page) 1123 + { 1124 + struct i915_ggtt *ggtt = cache_to_ggtt(cache); 1125 + unsigned long offset; 1126 + void *vaddr; 1127 + 1128 + if (cache->vaddr) { 1129 + intel_gt_flush_ggtt_writes(ggtt->vm.gt); 1130 + io_mapping_unmap_atomic((void __force __iomem *) unmask_page(cache->vaddr)); 1131 + } else { 1132 + struct i915_vma *vma; 1133 + int err; 1134 + 1135 + if (i915_gem_object_is_tiled(obj)) 1136 + return ERR_PTR(-EINVAL); 1137 + 1138 + if (use_cpu_reloc(cache, obj)) 1139 + return NULL; 1140 + 1141 + i915_gem_object_lock(obj); 1142 + err = i915_gem_object_set_to_gtt_domain(obj, true); 1143 + i915_gem_object_unlock(obj); 1144 + if (err) 1145 + return ERR_PTR(err); 1146 + 1147 + vma = i915_gem_object_ggtt_pin(obj, NULL, 0, 0, 1148 + PIN_MAPPABLE | 1149 + PIN_NONBLOCK /* NOWARN */ | 1150 + PIN_NOEVICT); 1151 + if (IS_ERR(vma)) { 1152 + memset(&cache->node, 0, sizeof(cache->node)); 1153 + mutex_lock(&ggtt->vm.mutex); 1154 + err = drm_mm_insert_node_in_range 1155 + (&ggtt->vm.mm, &cache->node, 1156 + PAGE_SIZE, 0, I915_COLOR_UNEVICTABLE, 1157 + 0, ggtt->mappable_end, 1158 + DRM_MM_INSERT_LOW); 1159 + mutex_unlock(&ggtt->vm.mutex); 1160 + if (err) /* no inactive aperture space, use cpu reloc */ 1161 + return NULL; 1162 + } else { 1163 + cache->node.start = vma->node.start; 1164 + cache->node.mm = (void *)vma; 1165 + } 1166 + } 1167 + 1168 + offset = cache->node.start; 1169 + if (drm_mm_node_allocated(&cache->node)) { 1170 + ggtt->vm.insert_page(&ggtt->vm, 1171 + i915_gem_object_get_dma_address(obj, page), 1172 + offset, I915_CACHE_NONE, 0); 1173 + } else { 1174 + offset += page << PAGE_SHIFT; 1175 + } 1176 + 1177 + vaddr = (void __force *)io_mapping_map_atomic_wc(&ggtt->iomap, 1178 + offset); 1179 + cache->page = page; 1180 + cache->vaddr = (unsigned long)vaddr; 1181 + 1182 + return vaddr; 1183 + } 1184 + 1185 + static void *reloc_vaddr(struct drm_i915_gem_object *obj, 1186 + struct reloc_cache *cache, 1187 + unsigned long page) 1188 + { 1189 + void *vaddr; 1190 + 1191 + if (cache->page == page) { 1192 + vaddr = unmask_page(cache->vaddr); 1193 + } else { 1194 + vaddr = NULL; 1195 + if ((cache->vaddr & KMAP) == 0) 1196 + vaddr = reloc_iomap(obj, cache, page); 1197 + if (!vaddr) 1198 + vaddr = reloc_kmap(obj, cache, page); 1199 + } 1200 + 1201 + return vaddr; 1202 + } 1203 + 1204 + static void clflush_write32(u32 *addr, u32 value, unsigned int flushes) 1205 + { 1206 + if (unlikely(flushes & (CLFLUSH_BEFORE | CLFLUSH_AFTER))) { 1207 + if (flushes & CLFLUSH_BEFORE) { 1208 + clflushopt(addr); 1209 + mb(); 1210 + } 1211 + 1212 + *addr = value; 1213 + 1214 + /* 1215 + * Writes to the same cacheline are serialised by the CPU 1216 + * (including clflush). On the write path, we only require 1217 + * that it hits memory in an orderly fashion and place 1218 + * mb barriers at the start and end of the relocation phase 1219 + * to ensure ordering of clflush wrt to the system. 1220 + */ 1221 + if (flushes & CLFLUSH_AFTER) 1222 + clflushopt(addr); 1223 + } else 1224 + *addr = value; 1097 1225 } 1098 1226 1099 1227 static int reloc_move_to_gpu(struct i915_request *rq, struct i915_vma *vma) ··· 1436 1214 return cmd; 1437 1215 } 1438 1216 1217 + static inline bool use_reloc_gpu(struct i915_vma *vma) 1218 + { 1219 + if (DBG_FORCE_RELOC == FORCE_GPU_RELOC) 1220 + return true; 1221 + 1222 + if (DBG_FORCE_RELOC) 1223 + return false; 1224 + 1225 + return !dma_resv_test_signaled_rcu(vma->resv, true); 1226 + } 1227 + 1439 1228 static unsigned long vma_phys_addr(struct i915_vma *vma, u32 offset) 1440 1229 { 1441 1230 struct page *page; ··· 1461 1228 return addr + offset_in_page(offset); 1462 1229 } 1463 1230 1464 - static int __reloc_entry_gpu(struct i915_execbuffer *eb, 1465 - struct i915_vma *vma, 1466 - u64 offset, 1467 - u64 target_addr) 1231 + static bool __reloc_entry_gpu(struct i915_execbuffer *eb, 1232 + struct i915_vma *vma, 1233 + u64 offset, 1234 + u64 target_addr) 1468 1235 { 1469 1236 const unsigned int gen = eb->reloc_cache.gen; 1470 1237 unsigned int len; ··· 1480 1247 1481 1248 batch = reloc_gpu(eb, vma, len); 1482 1249 if (IS_ERR(batch)) 1483 - return PTR_ERR(batch); 1250 + return false; 1484 1251 1485 1252 addr = gen8_canonical_addr(vma->node.start + offset); 1486 1253 if (gen >= 8) { ··· 1529 1296 *batch++ = target_addr; 1530 1297 } 1531 1298 1532 - return 0; 1299 + return true; 1300 + } 1301 + 1302 + static bool reloc_entry_gpu(struct i915_execbuffer *eb, 1303 + struct i915_vma *vma, 1304 + u64 offset, 1305 + u64 target_addr) 1306 + { 1307 + if (eb->reloc_cache.vaddr) 1308 + return false; 1309 + 1310 + if (!use_reloc_gpu(vma)) 1311 + return false; 1312 + 1313 + return __reloc_entry_gpu(eb, vma, offset, target_addr); 1533 1314 } 1534 1315 1535 1316 static u64 1536 - relocate_entry(struct i915_execbuffer *eb, 1537 - struct i915_vma *vma, 1317 + relocate_entry(struct i915_vma *vma, 1538 1318 const struct drm_i915_gem_relocation_entry *reloc, 1319 + struct i915_execbuffer *eb, 1539 1320 const struct i915_vma *target) 1540 1321 { 1541 1322 u64 target_addr = relocation_target(reloc, target); 1542 - int err; 1323 + u64 offset = reloc->offset; 1543 1324 1544 - err = __reloc_entry_gpu(eb, vma, reloc->offset, target_addr); 1545 - if (err) 1546 - return err; 1325 + if (!reloc_entry_gpu(eb, vma, offset, target_addr)) { 1326 + bool wide = eb->reloc_cache.use_64bit_reloc; 1327 + void *vaddr; 1328 + 1329 + repeat: 1330 + vaddr = reloc_vaddr(vma->obj, 1331 + &eb->reloc_cache, 1332 + offset >> PAGE_SHIFT); 1333 + if (IS_ERR(vaddr)) 1334 + return PTR_ERR(vaddr); 1335 + 1336 + GEM_BUG_ON(!IS_ALIGNED(offset, sizeof(u32))); 1337 + clflush_write32(vaddr + offset_in_page(offset), 1338 + lower_32_bits(target_addr), 1339 + eb->reloc_cache.vaddr); 1340 + 1341 + if (wide) { 1342 + offset += sizeof(u32); 1343 + target_addr >>= 32; 1344 + wide = false; 1345 + goto repeat; 1346 + } 1347 + } 1547 1348 1548 1349 return target->node.start | UPDATE; 1549 1350 } ··· 1642 1375 * If the relocation already has the right value in it, no 1643 1376 * more work needs to be done. 1644 1377 */ 1645 - if (gen8_canonical_addr(target->vma->node.start) == reloc->presumed_offset) 1378 + if (!DBG_FORCE_RELOC && 1379 + gen8_canonical_addr(target->vma->node.start) == reloc->presumed_offset) 1646 1380 return 0; 1647 1381 1648 1382 /* Check that the relocation address is valid... */ ··· 1675 1407 ev->flags &= ~EXEC_OBJECT_ASYNC; 1676 1408 1677 1409 /* and update the user's relocation entry */ 1678 - return relocate_entry(eb, ev->vma, reloc, target->vma); 1410 + return relocate_entry(ev->vma, reloc, eb, target->vma); 1679 1411 } 1680 1412 1681 1413 static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev) ··· 1713 1445 * this is bad and so lockdep complains vehemently. 1714 1446 */ 1715 1447 copied = __copy_from_user(r, urelocs, count * sizeof(r[0])); 1716 - if (unlikely(copied)) 1717 - return -EFAULT; 1448 + if (unlikely(copied)) { 1449 + remain = -EFAULT; 1450 + goto out; 1451 + } 1718 1452 1719 1453 remain -= count; 1720 1454 do { ··· 1724 1454 1725 1455 if (likely(offset == 0)) { 1726 1456 } else if ((s64)offset < 0) { 1727 - return (int)offset; 1457 + remain = (int)offset; 1458 + goto out; 1728 1459 } else { 1729 1460 /* 1730 1461 * Note that reporting an error now ··· 1755 1484 } while (r++, --count); 1756 1485 urelocs += ARRAY_SIZE(stack); 1757 1486 } while (remain); 1758 - 1759 - return 0; 1487 + out: 1488 + reloc_cache_reset(&eb->reloc_cache); 1489 + return remain; 1760 1490 } 1761 1491 1762 1492 static int eb_relocate(struct i915_execbuffer *eb) ··· 2664 2392 eb.i915 = i915; 2665 2393 eb.file = file; 2666 2394 eb.args = args; 2667 - if (!(args->flags & I915_EXEC_NO_RELOC)) 2395 + if (DBG_FORCE_RELOC || !(args->flags & I915_EXEC_NO_RELOC)) 2668 2396 args->flags |= __EXEC_HAS_RELOC; 2669 2397 2670 2398 eb.exec = exec;
+4
drivers/gpu/drm/i915/gem/i915_gem_object.h
··· 258 258 i915_gem_object_get_page(struct drm_i915_gem_object *obj, 259 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 265 dma_addr_t 262 266 i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj, 263 267 unsigned long n,
+14
drivers/gpu/drm/i915/gem/i915_gem_pages.c
··· 548 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 565 dma_addr_t 552 566 i915_gem_object_get_dma_address_len(struct drm_i915_gem_object *obj, 553 567 unsigned long n,
-8
drivers/gpu/drm/i915/gem/i915_gem_userptr.c
··· 596 596 GFP_KERNEL | 597 597 __GFP_NORETRY | 598 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 599 if (pvec) { 608 600 /* defer to worker if malloc fails */ 609 601 if (!i915_gem_object_is_readonly(obj))
+15 -6
drivers/gpu/drm/i915/gem/selftests/i915_gem_execbuffer.c
··· 37 37 return err; 38 38 39 39 /* 8-Byte aligned */ 40 - err = __reloc_entry_gpu(eb, vma, offsets[0] * sizeof(u32), 0); 41 - if (err) 40 + if (!__reloc_entry_gpu(eb, vma, 41 + offsets[0] * sizeof(u32), 42 + 0)) { 43 + err = -EIO; 42 44 goto unpin_vma; 45 + } 43 46 44 47 /* !8-Byte aligned */ 45 - err = __reloc_entry_gpu(eb, vma, offsets[1] * sizeof(u32), 1); 46 - if (err) 48 + if (!__reloc_entry_gpu(eb, vma, 49 + offsets[1] * sizeof(u32), 50 + 1)) { 51 + err = -EIO; 47 52 goto unpin_vma; 53 + } 48 54 49 55 /* Skip to the end of the cmd page */ 50 56 i = PAGE_SIZE / sizeof(u32) - RELOC_TAIL - 1; ··· 60 54 eb->reloc_cache.rq_size += i; 61 55 62 56 /* Force batch chaining */ 63 - err = __reloc_entry_gpu(eb, vma, offsets[2] * sizeof(u32), 2); 64 - if (err) 57 + if (!__reloc_entry_gpu(eb, vma, 58 + offsets[2] * sizeof(u32), 59 + 2)) { 60 + err = -EIO; 65 61 goto unpin_vma; 62 + } 66 63 67 64 GEM_BUG_ON(!eb->reloc_cache.rq); 68 65 rq = i915_request_get(eb->reloc_cache.rq);
+12 -8
drivers/gpu/drm/ingenic/ingenic-drm-drv.c
··· 673 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 678 struct platform_device *pdev = to_platform_device(dev); 679 679 const struct jz_soc_info *soc_info; ··· 808 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 812 ret = component_bind_all(dev, drm); 813 813 if (ret) { 814 814 if (ret != -EPROBE_DEFER) ··· 939 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 947 static int compare_of(struct device *dev, void *data) 943 948 { 944 949 return dev->of_node == data; ··· 962 957 } 963 958 964 959 static const struct component_master_ops ingenic_master_ops = { 965 - .bind = ingenic_drm_bind, 960 + .bind = ingenic_drm_bind_with_components, 966 961 .unbind = ingenic_drm_unbind, 967 962 }; 968 963 ··· 973 968 struct device_node *np; 974 969 975 970 if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) 976 - return ingenic_drm_bind(dev); 971 + return ingenic_drm_bind(dev, false); 977 972 978 973 /* IPU is at port address 8 */ 979 974 np = of_graph_get_remote_node(dev->of_node, 8, 0); 980 - if (!np) { 981 - dev_err(dev, "Unable to get IPU node\n"); 982 - return -EINVAL; 983 - } 975 + if (!np) 976 + return ingenic_drm_bind(dev, false); 984 977 985 978 drm_of_component_match_add(dev, &match, compare_of, np); 979 + of_node_put(np); 986 980 987 981 return component_master_add_with_match(dev, &ingenic_master_ops, match); 988 982 }
+5
drivers/gpu/drm/msm/adreno/a2xx_gpu.c
··· 164 164 if (ret) 165 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 172 /* NOTE: PM4/micro-engine firmware registers look to be the same 168 173 * for a2xx and a3xx.. we could possibly push that part down to 169 174 * adreno_gpu base class. Or push both PM4 and PFP but
+10
drivers/gpu/drm/msm/adreno/a3xx_gpu.c
··· 211 211 if (ret) 212 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 224 /* setup access protection: */ 215 225 gpu_write(gpu, REG_A3XX_CP_PROTECT_CTRL, 0x00000007); 216 226
+10
drivers/gpu/drm/msm/adreno/a4xx_gpu.c
··· 267 267 if (ret) 268 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 280 /* Load PM4: */ 271 281 ptr = (uint32_t *)(adreno_gpu->fw[ADRENO_FW_PM4]->data); 272 282 len = adreno_gpu->fw[ADRENO_FW_PM4]->size / 4;
+11 -3
drivers/gpu/drm/msm/adreno/a5xx_gpu.c
··· 703 703 if (ret) 704 704 return ret; 705 705 706 - a5xx_preempt_hw_init(gpu); 707 - 708 706 if (!adreno_is_a510(adreno_gpu)) 709 707 a5xx_gpmu_ucode_init(gpu); 710 708 711 709 ret = a5xx_ucode_init(gpu); 712 710 if (ret) 713 711 return ret; 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); 714 721 715 722 /* Disable the interrupts through the initial bringup stage */ 716 723 gpu_write(gpu, REG_A5XX_RBBM_INT_0_MASK, A5XX_INT_MASK); ··· 1518 1511 1519 1512 check_speed_bin(&pdev->dev); 1520 1513 1521 - ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 4); 1514 + /* Restricting nr_rings to 1 to temporarily disable preemption */ 1515 + ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1); 1522 1516 if (ret) { 1523 1517 a5xx_destroy(&(a5xx_gpu->base.base)); 1524 1518 return ERR_PTR(ret);
+1
drivers/gpu/drm/msm/adreno/a5xx_gpu.h
··· 31 31 struct msm_ringbuffer *next_ring; 32 32 33 33 struct drm_gem_object *preempt_bo[MSM_GPU_MAX_RINGS]; 34 + struct drm_gem_object *preempt_counters_bo[MSM_GPU_MAX_RINGS]; 34 35 struct a5xx_preempt_record *preempt[MSM_GPU_MAX_RINGS]; 35 36 uint64_t preempt_iova[MSM_GPU_MAX_RINGS]; 36 37
+20 -5
drivers/gpu/drm/msm/adreno/a5xx_preempt.c
··· 226 226 struct adreno_gpu *adreno_gpu = &a5xx_gpu->base; 227 227 struct msm_gpu *gpu = &adreno_gpu->base; 228 228 struct a5xx_preempt_record *ptr; 229 - struct drm_gem_object *bo = NULL; 230 - u64 iova = 0; 229 + void *counters; 230 + struct drm_gem_object *bo = NULL, *counters_bo = NULL; 231 + u64 iova = 0, counters_iova = 0; 231 232 232 233 ptr = msm_gem_kernel_new(gpu->dev, 233 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 237 if (IS_ERR(ptr)) 237 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 249 msm_gem_object_set_name(bo, "preempt"); 250 + msm_gem_object_set_name(counters_bo, "preempt_counters"); 240 251 241 252 a5xx_gpu->preempt_bo[ring->id] = bo; 253 + a5xx_gpu->preempt_counters_bo[ring->id] = counters_bo; 242 254 a5xx_gpu->preempt_iova[ring->id] = iova; 243 255 a5xx_gpu->preempt[ring->id] = ptr; 244 256 ··· 261 249 ptr->data = 0; 262 250 ptr->cntl = MSM_GPU_RB_CNTL_DEFAULT; 263 251 ptr->rptr_addr = rbmemptr(ring, rptr); 264 - ptr->counter = iova + A5XX_PREEMPT_RECORD_SIZE; 252 + ptr->counter = counters_iova; 265 253 266 254 return 0; 267 255 } ··· 272 260 struct a5xx_gpu *a5xx_gpu = to_a5xx_gpu(adreno_gpu); 273 261 int i; 274 262 275 - for (i = 0; i < gpu->nr_rings; i++) 263 + for (i = 0; i < gpu->nr_rings; i++) { 276 264 msm_gem_kernel_put(a5xx_gpu->preempt_bo[i], gpu->aspace, true); 265 + msm_gem_kernel_put(a5xx_gpu->preempt_counters_bo[i], 266 + gpu->aspace, true); 267 + } 277 268 } 278 269 279 270 void a5xx_preempt_init(struct msm_gpu *gpu)
+12 -1
drivers/gpu/drm/msm/adreno/a6xx_gpu.c
··· 678 678 A6XX_PROTECT_RDONLY(0x980, 0x4)); 679 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 683 gpu_write(gpu, REG_A6XX_CP_APRIV_CNTL, 683 684 (1 << 6) | (1 << 5) | (1 << 3) | (1 << 2) | (1 << 1)); 684 685 } ··· 694 693 ret = a6xx_ucode_init(gpu); 695 694 if (ret) 696 695 goto out; 696 + 697 + /* Set the ringbuffer address */ 698 + gpu_write64(gpu, REG_A6XX_CP_RB_BASE, REG_A6XX_CP_RB_BASE_HI, 699 + gpu->rb[0]->iova); 700 + 701 + gpu_write(gpu, REG_A6XX_CP_RB_CNTL, 702 + MSM_GPU_RB_CNTL_DEFAULT | AXXX_CP_RB_CNTL_NO_UPDATE); 697 703 698 704 /* Always come up on rb 0 */ 699 705 a6xx_gpu->cur_ring = gpu->rb[0]; ··· 1063 1055 1064 1056 adreno_gpu->registers = NULL; 1065 1057 adreno_gpu->reg_offsets = a6xx_register_offsets; 1058 + 1059 + if (adreno_is_a650(adreno_gpu)) 1060 + adreno_gpu->base.hw_apriv = true; 1066 1061 1067 1062 ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1); 1068 1063 if (ret) {
+2 -25
drivers/gpu/drm/msm/adreno/adreno_gpu.c
··· 400 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 403 return 0; 424 404 } 425 405 ··· 407 427 static uint32_t get_rptr(struct adreno_gpu *adreno_gpu, 408 428 struct msm_ringbuffer *ring) 409 429 { 410 - if (adreno_is_a430(adreno_gpu)) 411 - return ring->memptrs->rptr = adreno_gpu_read( 412 - adreno_gpu, REG_ADRENO_CP_RB_RPTR); 413 - else 414 - return ring->memptrs->rptr; 430 + return ring->memptrs->rptr = adreno_gpu_read( 431 + adreno_gpu, REG_ADRENO_CP_RB_RPTR); 415 432 } 416 433 417 434 struct msm_ringbuffer *adreno_active_ring(struct msm_gpu *gpu)
+1 -1
drivers/gpu/drm/msm/msm_gpu.c
··· 908 908 909 909 memptrs = msm_gem_kernel_new(drm, 910 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 912 &memptrs_iova); 913 913 914 914 if (IS_ERR(memptrs)) {
+11
drivers/gpu/drm/msm/msm_gpu.h
··· 15 15 #include "msm_drv.h" 16 16 #include "msm_fence.h" 17 17 #include "msm_ringbuffer.h" 18 + #include "msm_gem.h" 18 19 19 20 struct msm_gem_submit; 20 21 struct msm_gpu_perfcntr; ··· 140 139 } devfreq; 141 140 142 141 struct msm_gpu_state *crashstate; 142 + /* True if the hardware supports expanded apriv (a650 and newer) */ 143 + bool hw_apriv; 143 144 }; 144 145 145 146 /* It turns out that all targets use the same ringbuffer size */ ··· 329 326 330 327 mutex_unlock(&gpu->dev->struct_mutex); 331 328 } 329 + 330 + /* 331 + * Simple macro to semi-cleanly add the MAP_PRIV flag for targets that can 332 + * support expanded privileges 333 + */ 334 + #define check_apriv(gpu, flags) \ 335 + (((gpu)->hw_apriv ? MSM_BO_MAP_PRIV : 0) | (flags)) 336 + 332 337 333 338 #endif /* __MSM_GPU_H__ */
+2 -2
drivers/gpu/drm/msm/msm_ringbuffer.c
··· 27 27 ring->id = id; 28 28 29 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, 31 - &ring->iova); 30 + check_apriv(gpu, MSM_BO_WC | MSM_BO_GPU_READONLY), 31 + gpu->aspace, &ring->bo, &ring->iova); 32 32 33 33 if (IS_ERR(ring->start)) { 34 34 ret = PTR_ERR(ring->start);
+4 -1
drivers/gpu/drm/nouveau/dispnv50/core507d.c
··· 50 50 interlock[NV50_DISP_INTERLOCK_OVLY] | 51 51 NVDEF(NV507D, UPDATE, NOT_DRIVER_FRIENDLY, FALSE) | 52 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 58 return PUSH_KICK(push); 56 59 }
+1 -1
drivers/gpu/drm/nouveau/dispnv50/crcc37d.c
··· 6 6 #include "disp.h" 7 7 #include "head.h" 8 8 9 - #include <nvif/push507c.h> 9 + #include <nvif/pushc37b.h> 10 10 11 11 #include <nvhw/class/clc37d.h> 12 12
+6
drivers/gpu/drm/nouveau/dispnv50/disp.c
··· 257 257 dmac->push->end = dmac->push->bgn; 258 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 266 args->pushbuf = nvif_handle(&dmac->_push.mem.object); 261 267 262 268 ret = nv50_chan_create(device, disp, oclass, head, data, size,
+1 -1
drivers/gpu/drm/nouveau/include/nvif/push507c.h
··· 20 20 PUSH_ASSERT(!((o) & ~DRF_SMASK(NV507C_DMA_JUMP_OFFSET)), "offset"); \ 21 21 PUSH_DATA__((p), NVDEF(NV507C, DMA, OPCODE, JUMP) | \ 22 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 24 } while(0) 25 25 #endif
+1 -1
drivers/gpu/drm/radeon/radeon_display.c
··· 933 933 934 934 /* get matching reference and feedback divider */ 935 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 938 /* limit fb divider to its maximum */ 939 939 if (*fb_div > fb_div_max) {
+1 -3
drivers/gpu/drm/sun4i/sun4i_backend.c
··· 589 589 590 590 /* We can't have an alpha plane at the lowest position */ 591 591 if (!backend->quirks->supports_lowest_plane_alpha && 592 - (plane_states[0]->fb->format->has_alpha || 593 - (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE))) 592 + (plane_states[0]->alpha != DRM_BLEND_ALPHA_OPAQUE)) 594 593 return -EINVAL; 595 594 596 595 for (i = 1; i < num_planes; i++) { ··· 994 995 995 996 static const struct sun4i_backend_quirks sun7i_backend_quirks = { 996 997 .needs_output_muxing = true, 997 - .supports_lowest_plane_alpha = true, 998 998 }; 999 999 1000 1000 static const struct sun4i_backend_quirks sun8i_a33_backend_quirks = {
+6 -2
drivers/gpu/drm/sun4i/sun4i_tcon.c
··· 1433 1433 if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP) && 1434 1434 encoder->encoder_type == DRM_MODE_ENCODER_TMDS) { 1435 1435 ret = sun8i_tcon_top_set_hdmi_src(&pdev->dev, id); 1436 - if (ret) 1436 + if (ret) { 1437 + put_device(&pdev->dev); 1437 1438 return ret; 1439 + } 1438 1440 } 1439 1441 1440 1442 if (IS_ENABLED(CONFIG_DRM_SUN8I_TCON_TOP)) { 1441 1443 ret = sun8i_tcon_top_de_config(&pdev->dev, tcon->id, id); 1442 - if (ret) 1444 + if (ret) { 1445 + put_device(&pdev->dev); 1443 1446 return ret; 1447 + } 1444 1448 } 1445 1449 1446 1450 return 0;
+2 -2
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
··· 889 889 regmap_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(0), 890 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 893 if (!bounce) 894 894 return -ENOMEM; 895 895 ··· 900 900 memcpy((u8 *)bounce + msg->tx_len, &crc, sizeof(crc)); 901 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 904 regmap_write(dsi->regs, SUN6I_DSI_CMD_CTL_REG, len + 4 - 1); 905 905 kfree(bounce); 906 906
+1 -1
drivers/gpu/drm/sun4i/sun8i_vi_layer.c
··· 211 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 216 if (!format->is_yuv) 217 217 return SUN8I_CSC_MODE_OFF;
+21 -1
drivers/gpu/drm/tve200/tve200_display.c
··· 14 14 #include <linux/version.h> 15 15 #include <linux/dma-buf.h> 16 16 #include <linux/of_graph.h> 17 + #include <linux/delay.h> 17 18 18 19 #include <drm/drm_fb_cma_helper.h> 19 20 #include <drm/drm_fourcc.h> ··· 131 130 struct drm_connector *connector = priv->connector; 132 131 u32 format = fb->format->format; 133 132 u32 ctrl1 = 0; 133 + int retries; 134 134 135 135 clk_prepare_enable(priv->clk); 136 + 137 + /* Reset the TVE200 and wait for it to come back online */ 138 + writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4); 139 + for (retries = 0; retries < 5; retries++) { 140 + usleep_range(30000, 50000); 141 + if (readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET) 142 + continue; 143 + else 144 + break; 145 + } 146 + if (retries == 5 && 147 + readl(priv->regs + TVE200_CTRL_4) & TVE200_CTRL_4_RESET) { 148 + dev_err(drm->dev, "can't get hardware out of reset\n"); 149 + return; 150 + } 136 151 137 152 /* Function 1 */ 138 153 ctrl1 |= TVE200_CTRL_CSMODE; ··· 247 230 248 231 drm_crtc_vblank_off(crtc); 249 232 250 - /* Disable and Power Down */ 233 + /* Disable put into reset and Power Down */ 251 234 writel(0, priv->regs + TVE200_CTRL); 235 + writel(TVE200_CTRL_4_RESET, priv->regs + TVE200_CTRL_4); 252 236 253 237 clk_disable_unprepare(priv->clk); 254 238 } ··· 297 279 struct drm_device *drm = crtc->dev; 298 280 struct tve200_drm_dev_private *priv = drm->dev_private; 299 281 282 + /* Clear any IRQs and enable */ 283 + writel(0xFF, priv->regs + TVE200_INT_CLR); 300 284 writel(TVE200_INT_V_STATUS, priv->regs + TVE200_INT_EN); 301 285 return 0; 302 286 }
+11 -4
drivers/gpu/drm/virtio/virtgpu_display.c
··· 97 97 static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc, 98 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 102 static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, ··· 108 111 109 112 virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0); 110 113 virtio_gpu_notify(vgdev); 111 - output->enabled = false; 112 114 } 113 115 114 116 static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, ··· 119 123 static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, 120 124 struct drm_crtc_state *old_state) 121 125 { 126 + struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); 127 + 128 + /* 129 + * virtio-gpu can't do modeset and plane update operations 130 + * independent from each other. So the actual modeset happens 131 + * in the plane update callback, and here we just check 132 + * whenever we must force the modeset. 133 + */ 134 + if (drm_atomic_crtc_needs_modeset(crtc->state)) { 135 + output->needs_modeset = true; 136 + } 122 137 } 123 138 124 139 static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = {
+1 -1
drivers/gpu/drm/virtio/virtgpu_drv.h
··· 137 137 struct edid *edid; 138 138 int cur_x; 139 139 int cur_y; 140 - bool enabled; 140 + bool needs_modeset; 141 141 }; 142 142 #define drm_crtc_to_virtio_gpu_output(x) \ 143 143 container_of(x, struct virtio_gpu_output, crtc)
+7 -1
drivers/gpu/drm/virtio/virtgpu_object.c
··· 151 151 if (ret < 0) 152 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 161 if (!shmem->pages) { 156 162 drm_gem_shmem_unpin(&bo->base.base); 157 163 return -EINVAL;
+4 -2
drivers/gpu/drm/virtio/virtgpu_plane.c
··· 142 142 if (WARN_ON(!output)) 143 143 return; 144 144 145 - if (!plane->state->fb || !output->enabled) { 145 + if (!plane->state->fb || !output->crtc.state->active) { 146 146 DRM_DEBUG("nofb\n"); 147 147 virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 148 148 plane->state->src_w >> 16, ··· 163 163 plane->state->src_w != old_state->src_w || 164 164 plane->state->src_h != old_state->src_h || 165 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 169 DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", 168 170 bo->hw_res_handle, 169 171 plane->state->crtc_w, plane->state->crtc_h,
+5 -4
drivers/gpu/drm/xen/xen_drm_front_gem.c
··· 18 18 #include <drm/drm_probe_helper.h> 19 19 20 20 #include <xen/balloon.h> 21 + #include <xen/xen.h> 21 22 22 23 #include "xen_drm_front.h" 23 24 #include "xen_drm_front_gem.h" ··· 100 99 * allocate ballooned pages which will be used to map 101 100 * grant references provided by the backend 102 101 */ 103 - ret = alloc_xenballooned_pages(xen_obj->num_pages, 104 - xen_obj->pages); 102 + ret = xen_alloc_unpopulated_pages(xen_obj->num_pages, 103 + xen_obj->pages); 105 104 if (ret < 0) { 106 105 DRM_ERROR("Cannot allocate %zu ballooned pages: %d\n", 107 106 xen_obj->num_pages, ret); ··· 153 152 } else { 154 153 if (xen_obj->pages) { 155 154 if (xen_obj->be_alloc) { 156 - free_xenballooned_pages(xen_obj->num_pages, 157 - xen_obj->pages); 155 + xen_free_unpopulated_pages(xen_obj->num_pages, 156 + xen_obj->pages); 158 157 gem_free_pages_array(xen_obj); 159 158 } else { 160 159 drm_gem_put_pages(&xen_obj->base,
+1
drivers/gpu/drm/xlnx/Kconfig
··· 2 2 tristate "ZynqMP DisplayPort Controller Driver" 3 3 depends on ARCH_ZYNQMP || COMPILE_TEST 4 4 depends on COMMON_CLK && DRM && OF 5 + depends on DMADEVICES 5 6 select DMA_ENGINE 6 7 select DRM_GEM_CMA_HELPER 7 8 select DRM_KMS_CMA_HELPER
+13 -2
drivers/hid/hid-core.c
··· 1598 1598 } 1599 1599 1600 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 + 1611 + /* 1601 1612 * Create a report. 'data' has to be allocated using 1602 1613 * hid_alloc_report_buf() so that it has proper size. 1603 1614 */ ··· 1620 1609 if (report->id > 0) 1621 1610 *data++ = report->id; 1622 1611 1623 - memset(data, 0, ((report->size - 1) >> 3) + 1); 1612 + memset(data, 0, hid_compute_report_size(report)); 1624 1613 for (n = 0; n < report->maxfield; n++) 1625 1614 hid_output_field(report->device, report->field[n], data); 1626 1615 } ··· 1750 1739 csize--; 1751 1740 } 1752 1741 1753 - rsize = ((report->size - 1) >> 3) + 1; 1742 + rsize = hid_compute_report_size(report); 1754 1743 1755 1744 if (report_enum->numbered && rsize >= HID_MAX_BUFFER_SIZE) 1756 1745 rsize = HID_MAX_BUFFER_SIZE - 1;
+2
drivers/hid/hid-elan.c
··· 188 188 ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER); 189 189 if (ret) { 190 190 hid_err(hdev, "Failed to init elan MT slots: %d\n", ret); 191 + input_free_device(input); 191 192 return ret; 192 193 } 193 194 ··· 199 198 if (ret) { 200 199 hid_err(hdev, "Failed to register elan input device: %d\n", 201 200 ret); 201 + input_mt_destroy_slots(input); 202 202 input_free_device(input); 203 203 return ret; 204 204 }
+3
drivers/hid/hid-ids.h
··· 850 850 #define USB_DEVICE_ID_MS_POWER_COVER 0x07da 851 851 #define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd 852 852 #define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb 853 + #define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0 853 854 854 855 #define USB_VENDOR_ID_MOJO 0x8282 855 856 #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 ··· 1016 1015 #define USB_DEVICE_ID_SAITEK_RAT9 0x0cfa 1017 1016 #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 1018 1017 #define USB_DEVICE_ID_SAITEK_X52 0x075c 1018 + #define USB_DEVICE_ID_SAITEK_X52_2 0x0255 1019 + #define USB_DEVICE_ID_SAITEK_X52_PRO 0x0762 1019 1020 1020 1021 #define USB_VENDOR_ID_SAMSUNG 0x0419 1021 1022 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
+4
drivers/hid/hid-input.c
··· 1132 1132 } 1133 1133 1134 1134 mapped: 1135 + /* Mapping failed, bail out */ 1136 + if (!bit) 1137 + return; 1138 + 1135 1139 if (device->driver->input_mapped && 1136 1140 device->driver->input_mapped(device, hidinput, field, usage, 1137 1141 &bit, &max) < 0) {
+2
drivers/hid/hid-microsoft.c
··· 448 448 .driver_data = MS_SURFACE_DIAL }, 449 449 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER), 450 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 455 MODULE_DEVICE_TABLE(hid, ms_devices);
+2
drivers/hid/hid-multitouch.c
··· 856 856 code = BTN_0 + ((usage->hid - 1) & HID_USAGE); 857 857 858 858 hid_map_usage(hi, usage, bit, max, EV_KEY, code); 859 + if (!*bit) 860 + return -1; 859 861 input_set_capability(hi->input, EV_KEY, code); 860 862 return 1; 861 863
+2
drivers/hid/hid-quirks.c
··· 150 150 { HID_USB_DEVICE(USB_VENDOR_ID_RETROUSB, USB_DEVICE_ID_RETROUSB_SNES_RETROPORT), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, 151 151 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RUMBLEPAD), HID_QUIRK_BADPAD }, 152 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 155 { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS }, 154 156 { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS }, 155 157 { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET },
+23 -12
drivers/i2c/algos/i2c-algo-pca.c
··· 41 41 pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IPRESET); 42 42 pca_outw(adap, I2C_PCA_IND, 0xA5); 43 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 57 } else { 45 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 ··· 437 423 " Use the nominal frequency.\n", adap->name); 438 424 } 439 425 440 - pca_reset(pca_data); 441 - 442 426 clock = pca_clock(pca_data); 443 427 printk(KERN_INFO "%s: Clock frequency is %dkHz\n", 444 428 adap->name, freqs[clock]); 445 429 446 - pca_set_con(pca_data, I2C_PCA_CON_ENSIO | clock); 430 + /* Store settings as these will be needed when the PCA chip is reset */ 431 + pca_data->bus_settings.clock_freq = clock; 432 + 433 + pca_reset(pca_data); 447 434 } else { 448 435 int clock; 449 436 int mode; ··· 511 496 thi = tlow * min_thi / min_tlow; 512 497 } 513 498 499 + /* Store settings as these will be needed when the PCA chip is reset */ 500 + pca_data->bus_settings.mode = mode; 501 + pca_data->bus_settings.tlow = tlow; 502 + pca_data->bus_settings.thi = thi; 503 + 514 504 pca_reset(pca_data); 515 505 516 506 printk(KERN_INFO 517 507 "%s: Clock frequency is %dHz\n", adap->name, clock * 100); 518 - 519 - pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_IMODE); 520 - pca_outw(pca_data, I2C_PCA_IND, mode); 521 - pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_ISCLL); 522 - pca_outw(pca_data, I2C_PCA_IND, tlow); 523 - pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_ISCLH); 524 - pca_outw(pca_data, I2C_PCA_IND, thi); 525 - 526 - pca_set_con(pca_data, I2C_PCA_CON_ENSIO); 527 508 } 528 509 udelay(500); /* 500 us for oscillator to stabilise */ 529 510
+6 -2
drivers/i2c/busses/i2c-npcm7xx.c
··· 2093 2093 } 2094 2094 } 2095 2095 2096 - /* Adaptive TimeOut: astimated time in usec + 100% margin */ 2097 - timeout_usec = (2 * 10000 / bus->bus_freq) * (2 + nread + nwrite); 2096 + /* 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 2102 timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec)); 2099 2103 if (nwrite >= 32 * 1024 || nread >= 32 * 1024) { 2100 2104 dev_err(bus->dev, "i2c%d buffer too big\n", bus->num);
+12 -3
drivers/iio/accel/bmc150-accel-core.c
··· 189 189 struct mutex mutex; 190 190 u8 fifo_mode, watermark; 191 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 200 u8 bw_bits; 193 201 u32 slope_dur; 194 202 u32 slope_thres; ··· 930 922 * now. 931 923 */ 932 924 for (i = 0; i < count; i++) { 933 - u16 sample[8]; 934 925 int j, bit; 935 926 936 927 j = 0; 937 928 for_each_set_bit(bit, indio_dev->active_scan_mask, 938 929 indio_dev->masklength) 939 - memcpy(&sample[j++], &buffer[i * 3 + bit], 2); 930 + memcpy(&data->scan.channels[j++], &buffer[i * 3 + bit], 931 + sizeof(data->scan.channels[0])); 940 932 941 - iio_push_to_buffers_with_timestamp(indio_dev, sample, tstamp); 933 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 934 + tstamp); 942 935 943 936 tstamp += sample_period; 944 937 }
+11 -5
drivers/iio/accel/kxsd9.c
··· 209 209 const struct iio_poll_func *pf = p; 210 210 struct iio_dev *indio_dev = pf->indio_dev; 211 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 220 int ret; 213 - /* 4 * 16bit values AND timestamp */ 214 - __be16 hw_values[8]; 215 221 216 222 ret = regmap_bulk_read(st->map, 217 223 KXSD9_REG_X, 218 - &hw_values, 219 - 8); 224 + hw_values.chan, 225 + sizeof(hw_values.chan)); 220 226 if (ret) { 221 227 dev_err(st->dev, 222 228 "error reading data\n"); ··· 230 224 } 231 225 232 226 iio_push_to_buffers_with_timestamp(indio_dev, 233 - hw_values, 227 + &hw_values, 234 228 iio_get_time_ns(indio_dev)); 235 229 iio_trigger_notify_done(indio_dev->trig); 236 230
+12 -4
drivers/iio/accel/mma7455_core.c
··· 52 52 53 53 struct mma7455_data { 54 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 65 static int mma7455_drdy(struct mma7455_data *mma7455) ··· 90 82 struct iio_poll_func *pf = p; 91 83 struct iio_dev *indio_dev = pf->indio_dev; 92 84 struct mma7455_data *mma7455 = iio_priv(indio_dev); 93 - u8 buf[16]; /* 3 x 16-bit channels + padding + ts */ 94 85 int ret; 95 86 96 87 ret = mma7455_drdy(mma7455); 97 88 if (ret) 98 89 goto done; 99 90 100 - ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, buf, 101 - sizeof(__le16) * 3); 91 + ret = regmap_bulk_read(mma7455->regmap, MMA7455_REG_XOUTL, 92 + mma7455->scan.channels, 93 + sizeof(mma7455->scan.channels)); 102 94 if (ret) 103 95 goto done; 104 96 105 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 97 + iio_push_to_buffers_with_timestamp(indio_dev, &mma7455->scan, 106 98 iio_get_time_ns(indio_dev)); 107 99 108 100 done:
+8 -3
drivers/iio/accel/mma8452.c
··· 110 110 int sleep_val; 111 111 struct regulator *vdd_reg; 112 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 /** ··· 1097 1091 struct iio_poll_func *pf = p; 1098 1092 struct iio_dev *indio_dev = pf->indio_dev; 1099 1093 struct mma8452_data *data = iio_priv(indio_dev); 1100 - u8 buffer[16]; /* 3 16-bit channels + padding + ts */ 1101 1094 int ret; 1102 1095 1103 - ret = mma8452_read(data, (__be16 *)buffer); 1096 + ret = mma8452_read(data, data->buffer.channels); 1104 1097 if (ret < 0) 1105 1098 goto done; 1106 1099 1107 - iio_push_to_buffers_with_timestamp(indio_dev, buffer, 1100 + iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer, 1108 1101 iio_get_time_ns(indio_dev)); 1109 1102 1110 1103 done:
+2
drivers/iio/adc/Kconfig
··· 865 865 tristate "Rockchip SARADC driver" 866 866 depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST) 867 867 depends on RESET_CONTROLLER 868 + select IIO_BUFFER 869 + select IIO_TRIGGERED_BUFFER 868 870 help 869 871 Say yes here to build support for the SARADC found in SoCs from 870 872 Rockchip.
+7 -4
drivers/iio/adc/ina2xx-adc.c
··· 146 146 int range_vbus; /* Bus voltage maximum in V */ 147 147 int pga_gain_vshunt; /* Shunt voltage PGA gain */ 148 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 156 static const struct ina2xx_config ina2xx_config[] = { ··· 743 738 static int ina2xx_work_buffer(struct iio_dev *indio_dev) 744 739 { 745 740 struct ina2xx_chip_info *chip = iio_priv(indio_dev); 746 - /* data buffer needs space for channel data and timestap */ 747 - unsigned short data[4 + sizeof(s64)/sizeof(short)]; 748 741 int bit, ret, i = 0; 749 742 s64 time; 750 743 ··· 761 758 if (ret < 0) 762 759 return ret; 763 760 764 - data[i++] = val; 761 + chip->scan.chan[i++] = val; 765 762 } 766 763 767 - iio_push_to_buffers_with_timestamp(indio_dev, data, time); 764 + iio_push_to_buffers_with_timestamp(indio_dev, &chip->scan, time); 768 765 769 766 return 0; 770 767 };
+7 -3
drivers/iio/adc/max1118.c
··· 36 36 struct spi_device *spi; 37 37 struct mutex lock; 38 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 45 u8 data ____cacheline_aligned; 41 46 }; ··· 171 166 struct iio_poll_func *pf = p; 172 167 struct iio_dev *indio_dev = pf->indio_dev; 173 168 struct max1118 *adc = iio_priv(indio_dev); 174 - u8 data[16] = { }; /* 2x 8-bit ADC data + padding + 8 bytes timestamp */ 175 169 int scan_index; 176 170 int i = 0; 177 171 ··· 188 184 goto out; 189 185 } 190 186 191 - data[i] = ret; 187 + adc->scan.channels[i] = ret; 192 188 i++; 193 189 } 194 - iio_push_to_buffers_with_timestamp(indio_dev, data, 190 + iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan, 195 191 iio_get_time_ns(indio_dev)); 196 192 out: 197 193 mutex_unlock(&adc->lock);
+10 -6
drivers/iio/adc/mcp3422.c
··· 96 96 { 97 97 int ret; 98 98 99 - mutex_lock(&adc->lock); 100 - 101 99 ret = i2c_master_send(adc->i2c, &newconfig, 1); 102 100 if (ret > 0) { 103 101 adc->config = newconfig; 104 102 ret = 0; 105 103 } 106 - 107 - mutex_unlock(&adc->lock); 108 104 109 105 return ret; 110 106 } ··· 134 138 u8 config; 135 139 u8 req_channel = channel->channel; 136 140 141 + mutex_lock(&adc->lock); 142 + 137 143 if (req_channel != MCP3422_CHANNEL(adc->config)) { 138 144 config = adc->config; 139 145 config &= ~MCP3422_CHANNEL_MASK; ··· 143 145 config &= ~MCP3422_PGA_MASK; 144 146 config |= MCP3422_PGA_VALUE(adc->pga[req_channel]); 145 147 ret = mcp3422_update_config(adc, config); 146 - if (ret < 0) 148 + if (ret < 0) { 149 + mutex_unlock(&adc->lock); 147 150 return ret; 151 + } 148 152 msleep(mcp3422_read_times[MCP3422_SAMPLE_RATE(adc->config)]); 149 153 } 150 154 151 - return mcp3422_read(adc, value, &config); 155 + ret = mcp3422_read(adc, value, &config); 156 + 157 + mutex_unlock(&adc->lock); 158 + 159 + return ret; 152 160 } 153 161 154 162 static int mcp3422_read_raw(struct iio_dev *iio,
+1 -1
drivers/iio/adc/meson_saradc.c
··· 707 707 size_t read_len; 708 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 711 "temperature_calib"); 712 712 if (IS_ERR(temperature_calib)) { 713 713 ret = PTR_ERR(temperature_calib);
+8 -3
drivers/iio/adc/ti-adc081c.c
··· 33 33 34 34 /* 8, 10 or 12 */ 35 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 44 #define REG_CONV_RES 0x00 ··· 134 128 struct iio_poll_func *pf = p; 135 129 struct iio_dev *indio_dev = pf->indio_dev; 136 130 struct adc081c *data = iio_priv(indio_dev); 137 - u16 buf[8]; /* 2 bytes data + 6 bytes padding + 8 bytes timestamp */ 138 131 int ret; 139 132 140 133 ret = i2c_smbus_read_word_swapped(data->i2c, REG_CONV_RES); 141 134 if (ret < 0) 142 135 goto out; 143 - buf[0] = ret; 144 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 136 + data->scan.channel = ret; 137 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 145 138 iio_get_time_ns(indio_dev)); 146 139 out: 147 140 iio_trigger_notify_done(indio_dev->trig);
+7 -3
drivers/iio/adc/ti-adc084s021.c
··· 26 26 struct spi_transfer spi_trans; 27 27 struct regulator *reg; 28 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 35 * DMA (thus cache coherency maintenance) requires the 31 36 * transfer buffers to live in their own cache line. ··· 146 141 struct iio_poll_func *pf = pollfunc; 147 142 struct iio_dev *indio_dev = pf->indio_dev; 148 143 struct adc084s021 *adc = iio_priv(indio_dev); 149 - __be16 data[8] = {0}; /* 4 * 16-bit words of data + 8 bytes timestamp */ 150 144 151 145 mutex_lock(&adc->lock); 152 146 153 - if (adc084s021_adc_conversion(adc, &data) < 0) 147 + if (adc084s021_adc_conversion(adc, adc->scan.channels) < 0) 154 148 dev_err(&adc->spi->dev, "Failed to read data\n"); 155 149 156 - iio_push_to_buffers_with_timestamp(indio_dev, data, 150 + iio_push_to_buffers_with_timestamp(indio_dev, &adc->scan, 157 151 iio_get_time_ns(indio_dev)); 158 152 mutex_unlock(&adc->lock); 159 153 iio_trigger_notify_done(indio_dev->trig);
+10
drivers/iio/adc/ti-ads1015.c
··· 316 316 IIO_CHAN_SOFT_TIMESTAMP(ADS1015_TIMESTAMP), 317 317 }; 318 318 319 + #ifdef CONFIG_PM 319 320 static int ads1015_set_power_state(struct ads1015_data *data, bool on) 320 321 { 321 322 int ret; ··· 333 332 334 333 return ret < 0 ? ret : 0; 335 334 } 335 + 336 + #else /* !CONFIG_PM */ 337 + 338 + static int ads1015_set_power_state(struct ads1015_data *data, bool on) 339 + { 340 + return 0; 341 + } 342 + 343 + #endif /* !CONFIG_PM */ 336 344 337 345 static 338 346 int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
+9 -4
drivers/iio/chemical/ccs811.c
··· 78 78 struct iio_trigger *drdy_trig; 79 79 struct gpio_desc *wakeup_gpio; 80 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 88 static const struct iio_chan_spec ccs811_channels[] = { ··· 332 327 struct iio_dev *indio_dev = pf->indio_dev; 333 328 struct ccs811_data *data = iio_priv(indio_dev); 334 329 struct i2c_client *client = data->client; 335 - s16 buf[8]; /* s16 eCO2 + s16 TVOC + padding + 8 byte timestamp */ 336 330 int ret; 337 331 338 - ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, 4, 339 - (u8 *)&buf); 332 + ret = i2c_smbus_read_i2c_block_data(client, CCS811_ALG_RESULT_DATA, 333 + sizeof(data->scan.channels), 334 + (u8 *)data->scan.channels); 340 335 if (ret != 4) { 341 336 dev_err(&client->dev, "cannot read sensor data\n"); 342 337 goto err; 343 338 } 344 339 345 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 340 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 346 341 iio_get_time_ns(indio_dev)); 347 342 348 343 err:
+4 -1
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
··· 72 72 73 73 switch (type) { 74 74 case MOTIONSENSE_TYPE_ACCEL: 75 - case MOTIONSENSE_TYPE_GYRO: 76 75 *min_freq = 12500; 76 + *max_freq = 100000; 77 + break; 78 + case MOTIONSENSE_TYPE_GYRO: 79 + *min_freq = 25000; 77 80 *max_freq = 100000; 78 81 break; 79 82 case MOTIONSENSE_TYPE_MAG:
+9 -6
drivers/iio/light/ltr501.c
··· 1243 1243 struct iio_poll_func *pf = p; 1244 1244 struct iio_dev *indio_dev = pf->indio_dev; 1245 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 1250 __le16 als_buf[2]; 1248 1251 u8 mask = 0; 1249 1252 int j = 0; 1250 1253 int ret, psdata; 1251 1254 1252 - memset(buf, 0, sizeof(buf)); 1255 + memset(&scan, 0, sizeof(scan)); 1253 1256 1254 1257 /* figure out which data needs to be ready */ 1255 1258 if (test_bit(0, indio_dev->active_scan_mask) || ··· 1271 1268 if (ret < 0) 1272 1269 return ret; 1273 1270 if (test_bit(0, indio_dev->active_scan_mask)) 1274 - buf[j++] = le16_to_cpu(als_buf[1]); 1271 + scan.channels[j++] = le16_to_cpu(als_buf[1]); 1275 1272 if (test_bit(1, indio_dev->active_scan_mask)) 1276 - buf[j++] = le16_to_cpu(als_buf[0]); 1273 + scan.channels[j++] = le16_to_cpu(als_buf[0]); 1277 1274 } 1278 1275 1279 1276 if (mask & LTR501_STATUS_PS_RDY) { ··· 1281 1278 &psdata, 2); 1282 1279 if (ret < 0) 1283 1280 goto done; 1284 - buf[j++] = psdata & LTR501_PS_DATA_MASK; 1281 + scan.channels[j++] = psdata & LTR501_PS_DATA_MASK; 1285 1282 } 1286 1283 1287 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 1284 + iio_push_to_buffers_with_timestamp(indio_dev, &scan, 1288 1285 iio_get_time_ns(indio_dev)); 1289 1286 1290 1287 done:
+8 -4
drivers/iio/light/max44000.c
··· 75 75 struct max44000_data { 76 76 struct mutex lock; 77 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 85 /* Default scale is set to the minimum of 0.03125 or 1 / (1 << 5) lux */ ··· 493 488 struct iio_poll_func *pf = p; 494 489 struct iio_dev *indio_dev = pf->indio_dev; 495 490 struct max44000_data *data = iio_priv(indio_dev); 496 - u16 buf[8]; /* 2x u16 + padding + 8 bytes timestamp */ 497 491 int index = 0; 498 492 unsigned int regval; 499 493 int ret; ··· 502 498 ret = max44000_read_alsval(data); 503 499 if (ret < 0) 504 500 goto out_unlock; 505 - buf[index++] = ret; 501 + data->scan.channels[index++] = ret; 506 502 } 507 503 if (test_bit(MAX44000_SCAN_INDEX_PRX, indio_dev->active_scan_mask)) { 508 504 ret = regmap_read(data->regmap, MAX44000_REG_PRX_DATA, &regval); 509 505 if (ret < 0) 510 506 goto out_unlock; 511 - buf[index] = regval; 507 + data->scan.channels[index] = regval; 512 508 } 513 509 mutex_unlock(&data->lock); 514 510 515 - iio_push_to_buffers_with_timestamp(indio_dev, buf, 511 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 516 512 iio_get_time_ns(indio_dev)); 517 513 iio_trigger_notify_done(indio_dev->trig); 518 514 return IRQ_HANDLED;
+11 -5
drivers/iio/magnetometer/ak8975.c
··· 366 366 struct iio_mount_matrix orientation; 367 367 struct regulator *vdd; 368 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 377 /* Enable attached power regulator if any. */ ··· 799 793 const struct i2c_client *client = data->client; 800 794 const struct ak_def *def = data->def; 801 795 int ret; 802 - s16 buff[8]; /* 3 x 16 bits axis values + 1 aligned 64 bits timestamp */ 803 796 __le16 fval[3]; 804 797 805 798 mutex_lock(&data->lock); ··· 821 816 mutex_unlock(&data->lock); 822 817 823 818 /* Clamp to valid range. */ 824 - buff[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range); 825 - buff[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range); 826 - buff[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range); 819 + data->scan.channels[0] = clamp_t(s16, le16_to_cpu(fval[0]), -def->range, def->range); 820 + data->scan.channels[1] = clamp_t(s16, le16_to_cpu(fval[1]), -def->range, def->range); 821 + data->scan.channels[2] = clamp_t(s16, le16_to_cpu(fval[2]), -def->range, def->range); 827 822 828 - iio_push_to_buffers_with_timestamp(indio_dev, buff, 823 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 829 824 iio_get_time_ns(indio_dev)); 825 + 830 826 return; 831 827 832 828 unlock:
+9 -8
drivers/iio/proximity/mb1232.c
··· 40 40 */ 41 41 struct completion ranging; 42 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 50 static irqreturn_t mb1232_handle_irq(int irq, void *dev_id) ··· 118 113 struct iio_poll_func *pf = p; 119 114 struct iio_dev *indio_dev = pf->indio_dev; 120 115 struct mb1232_data *data = iio_priv(indio_dev); 121 - /* 122 - * triggered buffer 123 - * 16-bit channel + 48-bit padding + 64-bit timestamp 124 - */ 125 - s16 buffer[8] = { 0 }; 126 116 127 - buffer[0] = mb1232_read_distance(data); 128 - if (buffer[0] < 0) 117 + data->scan.distance = mb1232_read_distance(data); 118 + if (data->scan.distance < 0) 129 119 goto err; 130 120 131 - iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp); 121 + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, 122 + pf->timestamp); 132 123 133 124 err: 134 125 iio_trigger_notify_done(indio_dev->trig);
+2 -2
drivers/infiniband/core/cq.c
··· 379 379 { 380 380 LIST_HEAD(tmp_list); 381 381 unsigned int nr_cqs, i; 382 - struct ib_cq *cq; 382 + struct ib_cq *cq, *n; 383 383 int ret; 384 384 385 385 if (poll_ctx > IB_POLL_LAST_POOL_TYPE) { ··· 412 412 return 0; 413 413 414 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 416 cq->shared = false; 417 417 ib_free_cq(cq); 418 418 }
+2 -1
drivers/infiniband/core/uverbs_std_types_device.c
··· 165 165 resp->subnet_timeout = attr->subnet_timeout; 166 166 resp->init_type_reply = attr->init_type_reply; 167 167 resp->active_width = attr->active_width; 168 - resp->active_speed = attr->active_speed; 168 + /* This ABI needs to be extended to provide any speed more than IB_SPEED_NDR */ 169 + resp->active_speed = min_t(u16, attr->active_speed, IB_SPEED_NDR); 169 170 resp->phys_state = attr->phys_state; 170 171 resp->link_layer = rdma_port_get_link_layer(ib_dev, port_num); 171 172 }
+2 -2
drivers/infiniband/core/verbs.c
··· 1793 1793 } 1794 1794 EXPORT_SYMBOL(ib_modify_qp_with_udata); 1795 1795 1796 - int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width) 1796 + int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u16 *speed, u8 *width) 1797 1797 { 1798 1798 int rc; 1799 1799 u32 netdev_speed; ··· 1813 1813 1814 1814 dev_put(netdev); 1815 1815 1816 - if (!rc) { 1816 + if (!rc && lksettings.base.speed != (u32)SPEED_UNKNOWN) { 1817 1817 netdev_speed = lksettings.base.speed; 1818 1818 } else { 1819 1819 netdev_speed = SPEED_1000;
+1 -1
drivers/infiniband/hw/bnxt_re/bnxt_re.h
··· 150 150 151 151 struct delayed_work worker; 152 152 u8 cur_prio_map; 153 - u8 active_speed; 153 + u16 active_speed; 154 154 u8 active_width; 155 155 156 156 /* FP Notification Queue (CQ & SRQ) */
+29 -14
drivers/infiniband/hw/bnxt_re/ib_verbs.c
··· 754 754 gsi_sqp = rdev->gsi_ctx.gsi_sqp; 755 755 gsi_sah = rdev->gsi_ctx.gsi_sah; 756 756 757 - /* remove from active qp list */ 758 - mutex_lock(&rdev->qp_lock); 759 - list_del(&gsi_sqp->list); 760 - mutex_unlock(&rdev->qp_lock); 761 - atomic_dec(&rdev->qp_count); 762 - 763 757 ibdev_dbg(&rdev->ibdev, "Destroy the shadow AH\n"); 764 758 bnxt_qplib_destroy_ah(&rdev->qplib_res, 765 759 &gsi_sah->qplib_ah, ··· 767 773 goto fail; 768 774 } 769 775 bnxt_qplib_free_qp_res(&rdev->qplib_res, &gsi_sqp->qplib_qp); 776 + 777 + /* remove from active qp list */ 778 + mutex_lock(&rdev->qp_lock); 779 + list_del(&gsi_sqp->list); 780 + mutex_unlock(&rdev->qp_lock); 781 + atomic_dec(&rdev->qp_count); 770 782 771 783 kfree(rdev->gsi_ctx.sqp_tbl); 772 784 kfree(gsi_sah); ··· 793 793 struct bnxt_re_dev *rdev = qp->rdev; 794 794 unsigned int flags; 795 795 int rc; 796 - 797 - mutex_lock(&rdev->qp_lock); 798 - list_del(&qp->list); 799 - mutex_unlock(&rdev->qp_lock); 800 - atomic_dec(&rdev->qp_count); 801 796 802 797 bnxt_qplib_flush_cqn_wq(&qp->qplib_qp); 803 798 ··· 815 820 if (rc) 816 821 goto sh_fail; 817 822 } 823 + 824 + mutex_lock(&rdev->qp_lock); 825 + list_del(&qp->list); 826 + mutex_unlock(&rdev->qp_lock); 827 + atomic_dec(&rdev->qp_count); 818 828 819 829 ib_umem_release(qp->rumem); 820 830 ib_umem_release(qp->sumem); ··· 3270 3270 wc->wc_flags |= IB_WC_GRH; 3271 3271 } 3272 3272 3273 + static bool bnxt_re_check_if_vlan_valid(struct bnxt_re_dev *rdev, 3274 + u16 vlan_id) 3275 + { 3276 + /* 3277 + * Check if the vlan is configured in the host. If not configured, it 3278 + * can be a transparent VLAN. So dont report the vlan id. 3279 + */ 3280 + if (!__vlan_find_dev_deep_rcu(rdev->netdev, 3281 + htons(ETH_P_8021Q), vlan_id)) 3282 + return false; 3283 + return true; 3284 + } 3285 + 3273 3286 static bool bnxt_re_is_vlan_pkt(struct bnxt_qplib_cqe *orig_cqe, 3274 3287 u16 *vid, u8 *sl) 3275 3288 { ··· 3351 3338 wc->src_qp = orig_cqe->src_qp; 3352 3339 memcpy(wc->smac, orig_cqe->smac, ETH_ALEN); 3353 3340 if (bnxt_re_is_vlan_pkt(orig_cqe, &vlan_id, &sl)) { 3354 - wc->vlan_id = vlan_id; 3355 - wc->sl = sl; 3356 - wc->wc_flags |= IB_WC_WITH_VLAN; 3341 + if (bnxt_re_check_if_vlan_valid(rdev, vlan_id)) { 3342 + wc->vlan_id = vlan_id; 3343 + wc->sl = sl; 3344 + wc->wc_flags |= IB_WC_WITH_VLAN; 3345 + } 3357 3346 } 3358 3347 wc->port_num = 1; 3359 3348 wc->vendor_err = orig_cqe->status;
+1 -4
drivers/infiniband/hw/bnxt_re/main.c
··· 1009 1009 static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) 1010 1010 { 1011 1011 struct bnxt_re_ring_attr rattr = {}; 1012 - struct bnxt_qplib_ctx *qplib_ctx; 1013 1012 int num_vec_created = 0; 1014 1013 int rc = 0, i; 1015 1014 u8 type; ··· 1031 1032 if (rc) 1032 1033 goto dealloc_res; 1033 1034 1034 - qplib_ctx = &rdev->qplib_ctx; 1035 1035 for (i = 0; i < rdev->num_msix - 1; i++) { 1036 1036 struct bnxt_qplib_nq *nq; 1037 1037 1038 1038 nq = &rdev->nq[i]; 1039 - nq->hwq.max_elements = (qplib_ctx->cq_count + 1040 - qplib_ctx->srqc_count + 2); 1039 + nq->hwq.max_elements = BNXT_QPLIB_NQE_MAX_CNT; 1041 1040 rc = bnxt_qplib_alloc_nq(&rdev->qplib_res, &rdev->nq[i]); 1042 1041 if (rc) { 1043 1042 ibdev_err(&rdev->ibdev, "Alloc Failed NQ%d rc:%#x",
+16 -10
drivers/infiniband/hw/bnxt_re/qplib_fp.c
··· 817 817 u16 cmd_flags = 0; 818 818 u32 qp_flags = 0; 819 819 u8 pg_sz_lvl; 820 + u32 tbl_indx; 820 821 int rc; 821 822 822 823 RCFW_CMD_PREP(req, CREATE_QP1, cmd_flags); ··· 907 906 rq->dbinfo.db = qp->dpi->dbr; 908 907 rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size); 909 908 } 910 - rcfw->qp_tbl[qp->id].qp_id = qp->id; 911 - rcfw->qp_tbl[qp->id].qp_handle = (void *)qp; 909 + tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); 910 + rcfw->qp_tbl[tbl_indx].qp_id = qp->id; 911 + rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp; 912 912 913 913 return 0; 914 914 ··· 936 934 937 935 sq = &qp->sq; 938 936 hwq = &sq->hwq; 937 + /* First psn entry */ 939 938 fpsne = (u64)bnxt_qplib_get_qe(hwq, hwq->depth, &psn_pg); 940 939 if (!IS_ALIGNED(fpsne, PAGE_SIZE)) 941 - indx_pad = ALIGN(fpsne, PAGE_SIZE) / size; 942 - 940 + indx_pad = (fpsne & ~PAGE_MASK) / size; 943 941 hwq->pad_pgofft = indx_pad; 944 942 hwq->pad_pg = (u64 *)psn_pg; 945 943 hwq->pad_stride = size; ··· 960 958 u16 cmd_flags = 0; 961 959 u32 qp_flags = 0; 962 960 u8 pg_sz_lvl; 961 + u32 tbl_indx; 963 962 u16 nsge; 964 963 965 964 RCFW_CMD_PREP(req, CREATE_QP, cmd_flags); ··· 1113 1110 rq->dbinfo.db = qp->dpi->dbr; 1114 1111 rq->dbinfo.max_slot = bnxt_qplib_set_rq_max_slot(rq->wqe_size); 1115 1112 } 1116 - rcfw->qp_tbl[qp->id].qp_id = qp->id; 1117 - rcfw->qp_tbl[qp->id].qp_handle = (void *)qp; 1113 + tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); 1114 + rcfw->qp_tbl[tbl_indx].qp_id = qp->id; 1115 + rcfw->qp_tbl[tbl_indx].qp_handle = (void *)qp; 1118 1116 1119 1117 return 0; 1120 1118 fail: ··· 1460 1456 struct cmdq_destroy_qp req; 1461 1457 struct creq_destroy_qp_resp resp; 1462 1458 u16 cmd_flags = 0; 1459 + u32 tbl_indx; 1463 1460 int rc; 1464 1461 1465 - rcfw->qp_tbl[qp->id].qp_id = BNXT_QPLIB_QP_ID_INVALID; 1466 - rcfw->qp_tbl[qp->id].qp_handle = NULL; 1462 + tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); 1463 + rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID; 1464 + rcfw->qp_tbl[tbl_indx].qp_handle = NULL; 1467 1465 1468 1466 RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags); 1469 1467 ··· 1473 1467 rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, 1474 1468 (void *)&resp, NULL, 0); 1475 1469 if (rc) { 1476 - rcfw->qp_tbl[qp->id].qp_id = qp->id; 1477 - rcfw->qp_tbl[qp->id].qp_handle = qp; 1470 + rcfw->qp_tbl[tbl_indx].qp_id = qp->id; 1471 + rcfw->qp_tbl[tbl_indx].qp_handle = qp; 1478 1472 return rc; 1479 1473 } 1480 1474
+6 -4
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
··· 307 307 __le16 mcookie; 308 308 u16 cookie; 309 309 int rc = 0; 310 - u32 qp_id; 310 + u32 qp_id, tbl_indx; 311 311 312 312 pdev = rcfw->pdev; 313 313 switch (qp_event->event) { 314 314 case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION: 315 315 err_event = (struct creq_qp_error_notification *)qp_event; 316 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 319 dev_dbg(&pdev->dev, "Received QP error notification\n"); 319 320 dev_dbg(&pdev->dev, 320 321 "qpid 0x%x, req_err=0x%x, resp_err=0x%x\n", ··· 616 615 617 616 cmdq->bmap_size = bmap_size; 618 617 619 - rcfw->qp_tbl_size = qp_tbl_sz; 620 - rcfw->qp_tbl = kcalloc(qp_tbl_sz, sizeof(struct bnxt_qplib_qp_node), 618 + /* Allocate one extra to hold the QP1 entries */ 619 + rcfw->qp_tbl_size = qp_tbl_sz + 1; 620 + rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node), 621 621 GFP_KERNEL); 622 622 if (!rcfw->qp_tbl) 623 623 goto fail;
+5
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h
··· 216 216 int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, 217 217 struct bnxt_qplib_ctx *ctx, int is_virtfn); 218 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 224 #endif /* __BNXT_QPLIB_RCFW_H__ */
+1 -1
drivers/infiniband/hw/bnxt_re/qplib_sp.c
··· 149 149 attr->max_inline_data = le32_to_cpu(sb->max_inline_data); 150 150 attr->l2_db_size = (sb->l2_db_space_size + 1) * 151 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 154 bnxt_qplib_query_version(rcfw, attr->fw_ver); 155 155
+1
drivers/infiniband/hw/bnxt_re/qplib_sp.h
··· 47 47 struct bnxt_qplib_dev_attr { 48 48 #define FW_VER_ARR_LEN 4 49 49 u8 fw_ver[FW_VER_ARR_LEN]; 50 + #define BNXT_QPLIB_NUM_GIDS_SUPPORTED 256 50 51 u16 max_sgid; 51 52 u16 max_mrw; 52 53 u32 max_qp;
+1 -1
drivers/infiniband/hw/hfi1/verbs.c
··· 1424 1424 props->gid_tbl_len = HFI1_GUIDS_PER_PORT; 1425 1425 props->active_width = (u8)opa_width_to_ib(ppd->link_width_active); 1426 1426 /* see rate_show() in ib core/sysfs.c */ 1427 - props->active_speed = (u8)opa_speed_to_ib(ppd->link_speed_active); 1427 + props->active_speed = opa_speed_to_ib(ppd->link_speed_active); 1428 1428 props->max_vl_num = ppd->vls_supported; 1429 1429 1430 1430 /* Once we are a "first class" citizen and have added the OPA MTUs to
+2 -1
drivers/infiniband/hw/mlx4/main.c
··· 784 784 props->ip_gids = true; 785 785 props->gid_tbl_len = mdev->dev->caps.gid_table_len[port]; 786 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 789 props->max_mtu = IB_MTU_4096; 789 790 props->max_vl_num = 2; 790 791 props->state = IB_PORT_DOWN;
+15 -26
drivers/infiniband/hw/mlx5/main.c
··· 326 326 spin_unlock(&port->mp.mpi_lock); 327 327 } 328 328 329 - static int translate_eth_legacy_proto_oper(u32 eth_proto_oper, u8 *active_speed, 330 - u8 *active_width) 329 + static int translate_eth_legacy_proto_oper(u32 eth_proto_oper, 330 + u16 *active_speed, u8 *active_width) 331 331 { 332 332 switch (eth_proto_oper) { 333 333 case MLX5E_PROT_MASK(MLX5E_1000BASE_CX_SGMII): ··· 384 384 return 0; 385 385 } 386 386 387 - static int translate_eth_ext_proto_oper(u32 eth_proto_oper, u8 *active_speed, 387 + static int translate_eth_ext_proto_oper(u32 eth_proto_oper, u16 *active_speed, 388 388 u8 *active_width) 389 389 { 390 390 switch (eth_proto_oper) { ··· 436 436 return 0; 437 437 } 438 438 439 - static int translate_eth_proto_oper(u32 eth_proto_oper, u8 *active_speed, 439 + static int translate_eth_proto_oper(u32 eth_proto_oper, u16 *active_speed, 440 440 u8 *active_width, bool ext) 441 441 { 442 442 return ext ? ··· 1175 1175 return 0; 1176 1176 } 1177 1177 1178 - enum mlx5_ib_width { 1179 - MLX5_IB_WIDTH_1X = 1 << 0, 1180 - MLX5_IB_WIDTH_2X = 1 << 1, 1181 - MLX5_IB_WIDTH_4X = 1 << 2, 1182 - MLX5_IB_WIDTH_8X = 1 << 3, 1183 - MLX5_IB_WIDTH_12X = 1 << 4 1184 - }; 1185 - 1186 - static void translate_active_width(struct ib_device *ibdev, u8 active_width, 1187 - u8 *ib_width) 1178 + static void translate_active_width(struct ib_device *ibdev, u16 active_width, 1179 + u8 *ib_width) 1188 1180 { 1189 1181 struct mlx5_ib_dev *dev = to_mdev(ibdev); 1190 1182 1191 - if (active_width & MLX5_IB_WIDTH_1X) 1183 + if (active_width & MLX5_PTYS_WIDTH_1X) 1192 1184 *ib_width = IB_WIDTH_1X; 1193 - else if (active_width & MLX5_IB_WIDTH_2X) 1185 + else if (active_width & MLX5_PTYS_WIDTH_2X) 1194 1186 *ib_width = IB_WIDTH_2X; 1195 - else if (active_width & MLX5_IB_WIDTH_4X) 1187 + else if (active_width & MLX5_PTYS_WIDTH_4X) 1196 1188 *ib_width = IB_WIDTH_4X; 1197 - else if (active_width & MLX5_IB_WIDTH_8X) 1189 + else if (active_width & MLX5_PTYS_WIDTH_8X) 1198 1190 *ib_width = IB_WIDTH_8X; 1199 - else if (active_width & MLX5_IB_WIDTH_12X) 1191 + else if (active_width & MLX5_PTYS_WIDTH_12X) 1200 1192 *ib_width = IB_WIDTH_12X; 1201 1193 else { 1202 1194 mlx5_ib_dbg(dev, "Invalid active_width %d, setting width to default value: 4x\n", 1203 - (int)active_width); 1195 + active_width); 1204 1196 *ib_width = IB_WIDTH_4X; 1205 1197 } 1206 1198 ··· 1269 1277 u16 max_mtu; 1270 1278 u16 oper_mtu; 1271 1279 int err; 1272 - u8 ib_link_width_oper; 1280 + u16 ib_link_width_oper; 1273 1281 u8 vl_hw_cap; 1274 1282 1275 1283 rep = kzalloc(sizeof(*rep), GFP_KERNEL); ··· 1302 1310 if (props->port_cap_flags & IB_PORT_CAP_MASK2_SUP) 1303 1311 props->port_cap_flags2 = rep->cap_mask2; 1304 1312 1305 - err = mlx5_query_port_link_width_oper(mdev, &ib_link_width_oper, port); 1313 + err = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper, 1314 + &props->active_speed, port); 1306 1315 if (err) 1307 1316 goto out; 1308 1317 1309 1318 translate_active_width(ibdev, ib_link_width_oper, &props->active_width); 1310 - 1311 - err = mlx5_query_port_ib_proto_oper(mdev, &props->active_speed, port); 1312 - if (err) 1313 - goto out; 1314 1319 1315 1320 mlx5_query_port_max_mtu(mdev, &max_mtu, port); 1316 1321
+1 -1
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
··· 112 112 } 113 113 114 114 static inline void get_link_speed_and_width(struct ocrdma_dev *dev, 115 - u8 *ib_speed, u8 *ib_width) 115 + u16 *ib_speed, u8 *ib_width) 116 116 { 117 117 int status; 118 118 u8 speed;
+1 -1
drivers/infiniband/hw/qedr/verbs.c
··· 165 165 return 0; 166 166 } 167 167 168 - static inline void get_link_speed_and_width(int speed, u8 *ib_speed, 168 + static inline void get_link_speed_and_width(int speed, u16 *ib_speed, 169 169 u8 *ib_width) 170 170 { 171 171 switch (speed) {
+3 -3
drivers/infiniband/hw/qib/qib.h
··· 619 619 /* LID mask control */ 620 620 u8 lmc; 621 621 u8 link_width_supported; 622 - u8 link_speed_supported; 622 + u16 link_speed_supported; 623 623 u8 link_width_enabled; 624 - u8 link_speed_enabled; 624 + u16 link_speed_enabled; 625 625 u8 link_width_active; 626 - u8 link_speed_active; 626 + u16 link_speed_active; 627 627 u8 vls_supported; 628 628 u8 vls_operational; 629 629 /* Rx Polarity inversion (compensate for ~tx on partner) */
+1 -1
drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h
··· 176 176 u8 subnet_timeout; 177 177 u8 init_type_reply; 178 178 u8 active_width; 179 - u8 active_speed; 179 + u16 active_speed; 180 180 u8 phys_state; 181 181 u8 reserved[2]; 182 182 };
+4
drivers/infiniband/sw/rxe/rxe.c
··· 13 13 MODULE_DESCRIPTION("Soft RDMA transport"); 14 14 MODULE_LICENSE("Dual BSD/GPL"); 15 15 16 + bool rxe_initialized; 17 + 16 18 /* free resources for a rxe device all objects created for this device must 17 19 * have been destroyed 18 20 */ ··· 289 287 return err; 290 288 291 289 rdma_link_register(&rxe_link_ops); 290 + rxe_initialized = true; 292 291 pr_info("loaded\n"); 293 292 return 0; 294 293 } ··· 300 297 ib_unregister_driver(RDMA_DRIVER_RXE); 301 298 rxe_net_exit(); 302 299 300 + rxe_initialized = false; 303 301 pr_info("unloaded\n"); 304 302 } 305 303
+2
drivers/infiniband/sw/rxe/rxe.h
··· 40 40 41 41 #define RXE_ROCE_V2_SPORT (0xc000) 42 42 43 + extern bool rxe_initialized; 44 + 43 45 static inline u32 rxe_crc32(struct rxe_dev *rxe, 44 46 u32 crc, void *next, size_t len) 45 47 {
+1
drivers/infiniband/sw/rxe/rxe_mr.c
··· 178 178 vaddr = page_address(sg_page_iter_page(&sg_iter)); 179 179 if (!vaddr) { 180 180 pr_warn("null vaddr\n"); 181 + ib_umem_release(umem); 181 182 err = -ENOMEM; 182 183 goto err1; 183 184 }
+5
drivers/infiniband/sw/rxe/rxe_sysfs.c
··· 34 34 struct net_device *ndev; 35 35 struct rxe_dev *exists; 36 36 37 + if (!rxe_initialized) { 38 + pr_err("Module parameters are not supported, use rdma link add or rxe_cfg\n"); 39 + return -EAGAIN; 40 + } 41 + 37 42 len = sanitize_arg(val, intf, sizeof(intf)); 38 43 if (!len) { 39 44 pr_err("add: invalid interface name\n");
+1 -1
drivers/infiniband/sw/rxe/rxe_verbs.c
··· 1033 1033 struct rxe_dev *rxe = 1034 1034 rdma_device_to_drv_device(device, struct rxe_dev, ib_dev); 1035 1035 1036 - return snprintf(buf, 16, "%s\n", rxe_parent_name(rxe, 1)); 1036 + return scnprintf(buf, PAGE_SIZE, "%s\n", rxe_parent_name(rxe, 1)); 1037 1037 } 1038 1038 1039 1039 static DEVICE_ATTR_RO(parent);
+47 -46
drivers/infiniband/ulp/isert/ib_isert.c
··· 140 140 rx_desc = isert_conn->rx_descs; 141 141 142 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, 144 - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); 143 + dma_addr = ib_dma_map_single(ib_dev, rx_desc->buf, 144 + ISER_RX_SIZE, DMA_FROM_DEVICE); 145 145 if (ib_dma_mapping_error(ib_dev, dma_addr)) 146 146 goto dma_map_fail; 147 147 148 148 rx_desc->dma_addr = dma_addr; 149 149 150 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 152 rx_sg->length = ISER_RX_PAYLOAD_SIZE; 153 153 rx_sg->lkey = device->pd->local_dma_lkey; 154 154 rx_desc->rx_cqe.done = isert_recv_done; ··· 160 160 rx_desc = isert_conn->rx_descs; 161 161 for (j = 0; j < i; j++, rx_desc++) { 162 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 165 kfree(isert_conn->rx_descs); 166 166 isert_conn->rx_descs = NULL; ··· 181 181 rx_desc = isert_conn->rx_descs; 182 182 for (i = 0; i < ISERT_QP_MAX_RECV_DTOS; i++, rx_desc++) { 183 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 187 kfree(isert_conn->rx_descs); ··· 299 299 ISER_RX_PAYLOAD_SIZE, DMA_TO_DEVICE); 300 300 kfree(isert_conn->login_rsp_buf); 301 301 302 - ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, 303 - ISER_RX_PAYLOAD_SIZE, 304 - DMA_FROM_DEVICE); 305 - kfree(isert_conn->login_req_buf); 302 + ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr, 303 + ISER_RX_SIZE, DMA_FROM_DEVICE); 304 + kfree(isert_conn->login_desc); 306 305 } 307 306 308 307 static int ··· 310 311 { 311 312 int ret; 312 313 313 - isert_conn->login_req_buf = kzalloc(sizeof(*isert_conn->login_req_buf), 314 + isert_conn->login_desc = kzalloc(sizeof(*isert_conn->login_desc), 314 315 GFP_KERNEL); 315 - if (!isert_conn->login_req_buf) 316 + if (!isert_conn->login_desc) 316 317 return -ENOMEM; 317 318 318 - isert_conn->login_req_dma = ib_dma_map_single(ib_dev, 319 - isert_conn->login_req_buf, 320 - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); 321 - ret = ib_dma_mapping_error(ib_dev, isert_conn->login_req_dma); 319 + isert_conn->login_desc->dma_addr = ib_dma_map_single(ib_dev, 320 + isert_conn->login_desc->buf, 321 + ISER_RX_SIZE, DMA_FROM_DEVICE); 322 + ret = ib_dma_mapping_error(ib_dev, isert_conn->login_desc->dma_addr); 322 323 if (ret) { 323 - isert_err("login_req_dma mapping error: %d\n", ret); 324 - isert_conn->login_req_dma = 0; 325 - goto out_free_login_req_buf; 324 + isert_err("login_desc dma mapping error: %d\n", ret); 325 + isert_conn->login_desc->dma_addr = 0; 326 + goto out_free_login_desc; 326 327 } 327 328 328 329 isert_conn->login_rsp_buf = kzalloc(ISER_RX_PAYLOAD_SIZE, GFP_KERNEL); 329 330 if (!isert_conn->login_rsp_buf) { 330 331 ret = -ENOMEM; 331 - goto out_unmap_login_req_buf; 332 + goto out_unmap_login_desc; 332 333 } 333 334 334 335 isert_conn->login_rsp_dma = ib_dma_map_single(ib_dev, ··· 345 346 346 347 out_free_login_rsp_buf: 347 348 kfree(isert_conn->login_rsp_buf); 348 - out_unmap_login_req_buf: 349 - ib_dma_unmap_single(ib_dev, isert_conn->login_req_dma, 350 - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); 351 - out_free_login_req_buf: 352 - kfree(isert_conn->login_req_buf); 349 + out_unmap_login_desc: 350 + ib_dma_unmap_single(ib_dev, isert_conn->login_desc->dma_addr, 351 + ISER_RX_SIZE, DMA_FROM_DEVICE); 352 + out_free_login_desc: 353 + kfree(isert_conn->login_desc); 353 354 return ret; 354 355 } 355 356 ··· 475 476 if (isert_conn->qp) 476 477 isert_destroy_qp(isert_conn); 477 478 478 - if (isert_conn->login_req_buf) 479 + if (isert_conn->login_desc) 479 480 isert_free_login_buf(isert_conn); 480 481 481 482 isert_device_put(device); ··· 861 862 int ret; 862 863 863 864 memset(&sge, 0, sizeof(struct ib_sge)); 864 - sge.addr = isert_conn->login_req_dma; 865 + sge.addr = isert_conn->login_desc->dma_addr + 866 + isert_get_hdr_offset(isert_conn->login_desc); 865 867 sge.length = ISER_RX_PAYLOAD_SIZE; 866 868 sge.lkey = isert_conn->device->pd->local_dma_lkey; 867 869 868 870 isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n", 869 871 sge.addr, sge.length, sge.lkey); 870 872 871 - isert_conn->login_req_buf->rx_cqe.done = isert_login_recv_done; 873 + isert_conn->login_desc->rx_cqe.done = isert_login_recv_done; 872 874 873 875 memset(&rx_wr, 0, sizeof(struct ib_recv_wr)); 874 - rx_wr.wr_cqe = &isert_conn->login_req_buf->rx_cqe; 876 + rx_wr.wr_cqe = &isert_conn->login_desc->rx_cqe; 875 877 rx_wr.sg_list = &sge; 876 878 rx_wr.num_sge = 1; 877 879 ··· 949 949 static void 950 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 953 int rx_buflen = isert_conn->login_req_len; 954 954 struct iscsi_conn *conn = isert_conn->conn; 955 955 struct iscsi_login *login = conn->conn_login; ··· 961 961 962 962 if (login->first_request) { 963 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 966 * Setup the initial iscsi_login values from the leading 967 967 * login request PDU. ··· 980 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 985 size = min(rx_buflen, MAX_KEY_VALUE_PAIRS); 986 986 isert_dbg("Using login payload size: %d, rx_buflen: %d " 987 987 "MAX_KEY_VALUE_PAIRS: %d\n", size, rx_buflen, 988 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 991 if (login->first_request) { 992 992 complete(&isert_conn->login_comp); ··· 1051 1051 if (imm_data_len != data_len) { 1052 1052 sg_nents = max(1UL, DIV_ROUND_UP(imm_data_len, PAGE_SIZE)); 1053 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 1055 isert_dbg("Copy Immediate sg_nents: %u imm_data_len: %d\n", 1056 1056 sg_nents, imm_data_len); 1057 1057 } else { 1058 1058 sg_init_table(&isert_cmd->sg, 1); 1059 1059 cmd->se_cmd.t_data_sg = &isert_cmd->sg; 1060 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 1063 isert_dbg("Transfer Immediate imm_data_len: %d\n", 1063 1064 imm_data_len); 1064 1065 } ··· 1128 1127 } 1129 1128 isert_dbg("Copying DataOut: sg_start: %p, sg_off: %u " 1130 1129 "sg_nents: %u from %p %u\n", sg_start, sg_off, 1131 - sg_nents, &rx_desc->data[0], unsol_data_len); 1130 + sg_nents, isert_get_data(rx_desc), unsol_data_len); 1132 1131 1133 - sg_copy_from_buffer(sg_start, sg_nents, &rx_desc->data[0], 1132 + sg_copy_from_buffer(sg_start, sg_nents, isert_get_data(rx_desc), 1134 1133 unsol_data_len); 1135 1134 1136 1135 rc = iscsit_check_dataout_payload(cmd, hdr, false); ··· 1184 1183 } 1185 1184 cmd->text_in_ptr = text_in; 1186 1185 1187 - memcpy(cmd->text_in_ptr, &rx_desc->data[0], payload_length); 1186 + memcpy(cmd->text_in_ptr, isert_get_data(rx_desc), payload_length); 1188 1187 1189 1188 return iscsit_process_text_cmd(conn, cmd, hdr); 1190 1189 } ··· 1194 1193 uint32_t read_stag, uint64_t read_va, 1195 1194 uint32_t write_stag, uint64_t write_va) 1196 1195 { 1197 - struct iscsi_hdr *hdr = &rx_desc->iscsi_header; 1196 + struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc); 1198 1197 struct iscsi_conn *conn = isert_conn->conn; 1199 1198 struct iscsi_cmd *cmd; 1200 1199 struct isert_cmd *isert_cmd; ··· 1292 1291 struct isert_conn *isert_conn = wc->qp->qp_context; 1293 1292 struct ib_device *ib_dev = isert_conn->cm_id->device; 1294 1293 struct iser_rx_desc *rx_desc = cqe_to_rx_desc(wc->wr_cqe); 1295 - struct iscsi_hdr *hdr = &rx_desc->iscsi_header; 1296 - struct iser_ctrl *iser_ctrl = &rx_desc->iser_header; 1294 + struct iscsi_hdr *hdr = isert_get_iscsi_hdr(rx_desc); 1295 + struct iser_ctrl *iser_ctrl = isert_get_iser_hdr(rx_desc); 1297 1296 uint64_t read_va = 0, write_va = 0; 1298 1297 uint32_t read_stag = 0, write_stag = 0; 1299 1298 ··· 1307 1306 rx_desc->in_use = true; 1308 1307 1309 1308 ib_dma_sync_single_for_cpu(ib_dev, rx_desc->dma_addr, 1310 - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); 1309 + ISER_RX_SIZE, DMA_FROM_DEVICE); 1311 1310 1312 1311 isert_dbg("DMA: 0x%llx, iSCSI opcode: 0x%02x, ITT: 0x%08x, flags: 0x%02x dlen: %d\n", 1313 1312 rx_desc->dma_addr, hdr->opcode, hdr->itt, hdr->flags, ··· 1342 1341 read_stag, read_va, write_stag, write_va); 1343 1342 1344 1343 ib_dma_sync_single_for_device(ib_dev, rx_desc->dma_addr, 1345 - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); 1344 + ISER_RX_SIZE, DMA_FROM_DEVICE); 1346 1345 } 1347 1346 1348 1347 static void ··· 1356 1355 return; 1357 1356 } 1358 1357 1359 - ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_req_dma, 1360 - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); 1358 + ib_dma_sync_single_for_cpu(ib_dev, isert_conn->login_desc->dma_addr, 1359 + ISER_RX_SIZE, DMA_FROM_DEVICE); 1361 1360 1362 1361 isert_conn->login_req_len = wc->byte_len - ISER_HEADERS_LEN; 1363 1362 ··· 1372 1371 complete(&isert_conn->login_req_comp); 1373 1372 mutex_unlock(&isert_conn->mutex); 1374 1373 1375 - ib_dma_sync_single_for_device(ib_dev, isert_conn->login_req_dma, 1376 - ISER_RX_PAYLOAD_SIZE, DMA_FROM_DEVICE); 1374 + ib_dma_sync_single_for_device(ib_dev, isert_conn->login_desc->dma_addr, 1375 + ISER_RX_SIZE, DMA_FROM_DEVICE); 1377 1376 } 1378 1377 1379 1378 static void
+31 -10
drivers/infiniband/ulp/isert/ib_isert.h
··· 59 59 ISERT_MAX_TX_MISC_PDUS + \ 60 60 ISERT_MAX_RX_MISC_PDUS) 61 61 62 - #define ISER_RX_PAD_SIZE (ISCSI_DEF_MAX_RECV_SEG_LEN + 4096 - \ 63 - (ISER_RX_PAYLOAD_SIZE + sizeof(u64) + sizeof(struct ib_sge) + \ 64 - sizeof(struct ib_cqe) + sizeof(bool))) 62 + /* 63 + * RX size is default of 8k plus headers, but data needs to align to 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 68 /* Maximum support is 16MB I/O size */ 67 69 #define ISCSI_ISER_MAX_SG_TABLESIZE 4096 ··· 83 81 }; 84 82 85 83 struct iser_rx_desc { 86 - struct iser_ctrl iser_header; 87 - struct iscsi_hdr iscsi_header; 88 - char data[ISCSI_DEF_MAX_RECV_SEG_LEN]; 84 + char buf[ISER_RX_SIZE]; 89 85 u64 dma_addr; 90 86 struct ib_sge rx_sg; 91 87 struct ib_cqe rx_cqe; 92 88 bool in_use; 93 - char pad[ISER_RX_PAD_SIZE]; 94 - } __packed; 89 + }; 95 90 96 91 static inline struct iser_rx_desc *cqe_to_rx_desc(struct ib_cqe *cqe) 97 92 { 98 93 return container_of(cqe, struct iser_rx_desc, rx_cqe); 94 + } 95 + 96 + static void *isert_get_iser_hdr(struct iser_rx_desc *desc) 97 + { 98 + return PTR_ALIGN(desc->buf + ISER_HEADERS_LEN, 512) - ISER_HEADERS_LEN; 99 + } 100 + 101 + static size_t isert_get_hdr_offset(struct iser_rx_desc *desc) 102 + { 103 + return isert_get_iser_hdr(desc) - (void *)desc->buf; 104 + } 105 + 106 + static void *isert_get_iscsi_hdr(struct iser_rx_desc *desc) 107 + { 108 + return isert_get_iser_hdr(desc) + sizeof(struct iser_ctrl); 109 + } 110 + 111 + static void *isert_get_data(struct iser_rx_desc *desc) 112 + { 113 + void *data = isert_get_iser_hdr(desc) + ISER_HEADERS_LEN; 114 + 115 + WARN_ON((uintptr_t)data & 511); 116 + return data; 99 117 } 100 118 101 119 struct iser_tx_desc { ··· 164 142 u32 responder_resources; 165 143 u32 initiator_depth; 166 144 bool pi_support; 167 - struct iser_rx_desc *login_req_buf; 145 + struct iser_rx_desc *login_desc; 168 146 char *login_rsp_buf; 169 - u64 login_req_dma; 170 147 int login_req_len; 171 148 u64 login_rsp_dma; 172 149 struct iser_rx_desc *rx_descs;
+4 -12
drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c
··· 152 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 155 static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *sess) 163 156 { 164 157 struct rtrs_srv *srv = sess->srv; ··· 165 172 goto unlock; 166 173 } 167 174 srv->dev.class = rtrs_dev_class; 168 - srv->dev.release = rtrs_srv_dev_release; 169 175 err = dev_set_name(&srv->dev, "%s", sess->s.sessname); 170 176 if (err) 171 177 goto unlock; ··· 174 182 * sysfs files are created 175 183 */ 176 184 dev_set_uevent_suppress(&srv->dev, true); 177 - err = device_register(&srv->dev); 185 + err = device_add(&srv->dev); 178 186 if (err) { 179 - pr_err("device_register(): %d\n", err); 187 + pr_err("device_add(): %d\n", err); 180 188 goto put; 181 189 } 182 190 srv->kobj_paths = kobject_create_and_add("paths", &srv->dev.kobj); 183 191 if (!srv->kobj_paths) { 184 192 err = -ENOMEM; 185 193 pr_err("kobject_create_and_add(): %d\n", err); 186 - device_unregister(&srv->dev); 194 + device_del(&srv->dev); 187 195 goto unlock; 188 196 } 189 197 dev_set_uevent_suppress(&srv->dev, false); ··· 208 216 kobject_del(srv->kobj_paths); 209 217 kobject_put(srv->kobj_paths); 210 218 mutex_unlock(&srv->paths_mutex); 211 - device_unregister(&srv->dev); 219 + device_del(&srv->dev); 212 220 } else { 213 221 mutex_unlock(&srv->paths_mutex); 214 222 }
+9
drivers/infiniband/ulp/rtrs/rtrs-srv.c
··· 1321 1321 return sess->cur_cq_vector; 1322 1322 } 1323 1323 1324 + static void rtrs_srv_dev_release(struct device *dev) 1325 + { 1326 + struct rtrs_srv *srv = container_of(dev, struct rtrs_srv, dev); 1327 + 1328 + kfree(srv); 1329 + } 1330 + 1324 1331 static struct rtrs_srv *__alloc_srv(struct rtrs_srv_ctx *ctx, 1325 1332 const uuid_t *paths_uuid) 1326 1333 { ··· 1345 1338 uuid_copy(&srv->paths_uuid, paths_uuid); 1346 1339 srv->queue_depth = sess_queue_depth; 1347 1340 srv->ctx = ctx; 1341 + device_initialize(&srv->dev); 1342 + srv->dev.release = rtrs_srv_dev_release; 1348 1343 1349 1344 srv->chunks = kcalloc(srv->queue_depth, sizeof(*srv->chunks), 1350 1345 GFP_KERNEL);
+8 -2
drivers/interconnect/core.c
··· 55 55 56 56 icc_summary_show_one(s, n); 57 57 hlist_for_each_entry(r, &n->req_list, req_node) { 58 + u32 avg_bw = 0, peak_bw = 0; 59 + 58 60 if (!r->dev) 59 61 continue; 60 62 63 + if (r->enabled) { 64 + avg_bw = r->avg_bw; 65 + peak_bw = r->peak_bw; 66 + } 67 + 61 68 seq_printf(s, " %-27s %12u %12u %12u\n", 62 - dev_name(r->dev), r->tag, r->avg_bw, 63 - r->peak_bw); 69 + dev_name(r->dev), r->tag, avg_bw, peak_bw); 64 70 } 65 71 } 66 72 }
+19 -8
drivers/interconnect/qcom/bcm-voter.c
··· 52 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 66 static void bcm_aggregate(struct qcom_icc_bcm *bcm) 56 67 { 68 + struct qcom_icc_node *node; 57 69 size_t i, bucket; 58 70 u64 agg_avg[QCOM_ICC_NUM_BUCKETS] = {0}; 59 71 u64 agg_peak[QCOM_ICC_NUM_BUCKETS] = {0}; ··· 73 61 74 62 for (bucket = 0; bucket < QCOM_ICC_NUM_BUCKETS; bucket++) { 75 63 for (i = 0; i < bcm->num_nodes; i++) { 76 - temp = bcm->nodes[i]->sum_avg[bucket] * bcm->aux_data.width; 77 - do_div(temp, bcm->nodes[i]->buswidth * bcm->nodes[i]->channels); 64 + node = bcm->nodes[i]; 65 + temp = bcm_div(node->sum_avg[bucket] * bcm->aux_data.width, 66 + node->buswidth * node->channels); 78 67 agg_avg[bucket] = max(agg_avg[bucket], temp); 79 68 80 - temp = bcm->nodes[i]->max_peak[bucket] * bcm->aux_data.width; 81 - do_div(temp, bcm->nodes[i]->buswidth); 69 + temp = bcm_div(node->max_peak[bucket] * bcm->aux_data.width, 70 + node->buswidth); 82 71 agg_peak[bucket] = max(agg_peak[bucket], temp); 83 72 } 84 73 85 74 temp = agg_avg[bucket] * 1000ULL; 86 - do_div(temp, bcm->aux_data.unit); 87 - bcm->vote_x[bucket] = temp; 75 + bcm->vote_x[bucket] = bcm_div(temp, bcm->aux_data.unit); 88 76 89 77 temp = agg_peak[bucket] * 1000ULL; 90 - do_div(temp, bcm->aux_data.unit); 91 - bcm->vote_y[bucket] = temp; 78 + bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit); 92 79 } 93 80 94 81 if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
+1 -1
drivers/iommu/amd/Kconfig
··· 10 10 select IOMMU_API 11 11 select IOMMU_IOVA 12 12 select IOMMU_DMA 13 - depends on X86_64 && PCI && ACPI 13 + depends on X86_64 && PCI && ACPI && HAVE_CMPXCHG_DOUBLE 14 14 help 15 15 With this option you can enable support for AMD IOMMU hardware in 16 16 your system. An IOMMU is a hardware component which provides
+19 -2
drivers/iommu/amd/init.c
··· 1511 1511 iommu->mmio_phys_end = MMIO_REG_END_OFFSET; 1512 1512 else 1513 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 1522 amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY; 1516 1523 break; 1517 1524 case 0x11: ··· 1527 1520 iommu->mmio_phys_end = MMIO_REG_END_OFFSET; 1528 1521 else 1529 1522 iommu->mmio_phys_end = MMIO_CNTR_CONF_OFFSET; 1530 - if (((h->efr_reg & (0x1 << IOMMU_EFR_GASUP_SHIFT)) == 0)) 1523 + 1524 + /* 1525 + * Note: GA (128-bit IRTE) mode requires cmpxchg16b supports. 1526 + * XT, GAM also requires GA mode. Therefore, we need to 1527 + * check cmpxchg16b support before enabling them. 1528 + */ 1529 + if (!boot_cpu_has(X86_FEATURE_CX16) || 1530 + ((h->efr_reg & (0x1 << IOMMU_EFR_GASUP_SHIFT)) == 0)) { 1531 1531 amd_iommu_guest_ir = AMD_IOMMU_GUEST_IR_LEGACY; 1532 + break; 1533 + } 1534 + 1532 1535 /* 1533 1536 * Note: Since iommu_update_intcapxt() leverages 1534 1537 * the IOMMU MMIO access to MSI capability block registers
+21 -5
drivers/iommu/amd/iommu.c
··· 2659 2659 if (!dev_data) 2660 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 2668 return IOMMU_DOMAIN_IDENTITY; 2664 2669 2665 2670 return 0; ··· 3297 3292 static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte, 3298 3293 struct amd_ir_data *data) 3299 3294 { 3295 + bool ret; 3300 3296 struct irq_remap_table *table; 3301 3297 struct amd_iommu *iommu; 3302 3298 unsigned long flags; ··· 3315 3309 3316 3310 entry = (struct irte_ga *)table->table; 3317 3311 entry = &entry[index]; 3318 - entry->lo.fields_remap.valid = 0; 3319 - entry->hi.val = irte->hi.val; 3320 - entry->lo.val = irte->lo.val; 3321 - entry->lo.fields_remap.valid = 1; 3312 + 3313 + ret = cmpxchg_double(&entry->lo.val, &entry->hi.val, 3314 + entry->lo.val, entry->hi.val, 3315 + irte->lo.val, irte->hi.val); 3316 + /* 3317 + * We use cmpxchg16 to atomically update the 128-bit IRTE, 3318 + * and it cannot be updated by the hardware or other processors 3319 + * behind us, so the return value of cmpxchg16 should be the 3320 + * same as the old value. 3321 + */ 3322 + WARN_ON(!ret); 3323 + 3322 3324 if (data) 3323 3325 data->ref = entry; 3324 3326 ··· 3864 3850 struct amd_ir_data *ir_data = (struct amd_ir_data *)data; 3865 3851 struct irte_ga *entry = (struct irte_ga *) ir_data->entry; 3866 3852 struct irq_cfg *cfg = ir_data->cfg; 3853 + u64 valid = entry->lo.fields_remap.valid; 3867 3854 3868 3855 if (!AMD_IOMMU_GUEST_IR_VAPIC(amd_iommu_guest_ir) || 3869 3856 !entry || !entry->lo.fields_vapic.guest_mode) ··· 3873 3858 entry->lo.val = 0; 3874 3859 entry->hi.val = 0; 3875 3860 3861 + entry->lo.fields_remap.valid = valid; 3876 3862 entry->lo.fields_remap.dm = apic->irq_dest_mode; 3877 3863 entry->lo.fields_remap.int_type = apic->irq_delivery_mode; 3878 3864 entry->hi.fields.vector = cfg->vector;
+7
drivers/iommu/amd/iommu_v2.c
··· 737 737 738 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 747 if (!amd_iommu_v2_supported()) 741 748 return -ENODEV; 742 749
+62 -52
drivers/iommu/intel/iommu.c
··· 123 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 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 143 return (pfn + level_size(level) - 1) & level_mask(level); 144 144 } 145 145 146 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 151 /* VT-d pages must always be _smaller_ than MM pages. Otherwise things ··· 364 364 int intel_iommu_gfx_mapped; 365 365 EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped); 366 366 367 - #define DUMMY_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-1)) 368 367 #define DEFER_DEVICE_DOMAIN_INFO ((struct device_domain_info *)(-2)) 369 368 struct device_domain_info *get_domain_info(struct device *dev) 370 369 { ··· 373 374 return NULL; 374 375 375 376 info = dev_iommu_priv_get(dev); 376 - if (unlikely(info == DUMMY_DEVICE_DOMAIN_INFO || 377 - info == DEFER_DEVICE_DOMAIN_INFO)) 377 + if (unlikely(info == DEFER_DEVICE_DOMAIN_INFO)) 378 378 return NULL; 379 379 380 380 return info; ··· 740 742 return &context[devfn]; 741 743 } 742 744 743 - static int iommu_dummy(struct device *dev) 744 - { 745 - return dev_iommu_priv_get(dev) == DUMMY_DEVICE_DOMAIN_INFO; 746 - } 747 - 748 745 static bool attach_deferred(struct device *dev) 749 746 { 750 747 return dev_iommu_priv_get(dev) == DEFER_DEVICE_DOMAIN_INFO; ··· 772 779 return false; 773 780 } 774 781 782 + static bool quirk_ioat_snb_local_iommu(struct pci_dev *pdev) 783 + { 784 + struct dmar_drhd_unit *drhd; 785 + u32 vtbar; 786 + int rc; 787 + 788 + /* We know that this device on this chipset has its own IOMMU. 789 + * If we find it under a different IOMMU, then the BIOS is lying 790 + * to us. Hope that the IOMMU for this device is actually 791 + * disabled, and it needs no translation... 792 + */ 793 + rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0), 0xb0, &vtbar); 794 + if (rc) { 795 + /* "can't" happen */ 796 + dev_info(&pdev->dev, "failed to run vt-d quirk\n"); 797 + return false; 798 + } 799 + vtbar &= 0xffff0000; 800 + 801 + /* we know that the this iommu should be at offset 0xa000 from vtbar */ 802 + drhd = dmar_find_matched_drhd_unit(pdev); 803 + if (!drhd || drhd->reg_base_addr - vtbar != 0xa000) { 804 + pr_warn_once(FW_BUG "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n"); 805 + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 806 + return true; 807 + } 808 + 809 + return false; 810 + } 811 + 812 + static bool iommu_is_dummy(struct intel_iommu *iommu, struct device *dev) 813 + { 814 + if (!iommu || iommu->drhd->ignored) 815 + return true; 816 + 817 + if (dev_is_pci(dev)) { 818 + struct pci_dev *pdev = to_pci_dev(dev); 819 + 820 + if (pdev->vendor == PCI_VENDOR_ID_INTEL && 821 + pdev->device == PCI_DEVICE_ID_INTEL_IOAT_SNB && 822 + quirk_ioat_snb_local_iommu(pdev)) 823 + return true; 824 + } 825 + 826 + return false; 827 + } 828 + 775 829 struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) 776 830 { 777 831 struct dmar_drhd_unit *drhd = NULL; ··· 828 788 u16 segment = 0; 829 789 int i; 830 790 831 - if (!dev || iommu_dummy(dev)) 791 + if (!dev) 832 792 return NULL; 833 793 834 794 if (dev_is_pci(dev)) { ··· 845 805 dev = &ACPI_COMPANION(dev)->dev; 846 806 847 807 rcu_read_lock(); 848 - for_each_active_iommu(iommu, drhd) { 808 + for_each_iommu(iommu, drhd) { 849 809 if (pdev && segment != drhd->segment) 850 810 continue; 851 811 ··· 881 841 } 882 842 iommu = NULL; 883 843 out: 844 + if (iommu_is_dummy(iommu, dev)) 845 + iommu = NULL; 846 + 884 847 rcu_read_unlock(); 885 848 886 849 return iommu; ··· 2490 2447 { 2491 2448 struct device_domain_info *info; 2492 2449 2493 - if (unlikely(attach_deferred(dev) || iommu_dummy(dev))) 2450 + if (unlikely(attach_deferred(dev))) 2494 2451 return NULL; 2495 2452 2496 2453 /* No lock here, assumes no domain exit in normal case */ ··· 4032 3989 iova_cache_put(); 4033 3990 } 4034 3991 4035 - static void quirk_ioat_snb_local_iommu(struct pci_dev *pdev) 4036 - { 4037 - struct dmar_drhd_unit *drhd; 4038 - u32 vtbar; 4039 - int rc; 4040 - 4041 - /* We know that this device on this chipset has its own IOMMU. 4042 - * If we find it under a different IOMMU, then the BIOS is lying 4043 - * to us. Hope that the IOMMU for this device is actually 4044 - * disabled, and it needs no translation... 4045 - */ 4046 - rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0), 0xb0, &vtbar); 4047 - if (rc) { 4048 - /* "can't" happen */ 4049 - dev_info(&pdev->dev, "failed to run vt-d quirk\n"); 4050 - return; 4051 - } 4052 - vtbar &= 0xffff0000; 4053 - 4054 - /* we know that the this iommu should be at offset 0xa000 from vtbar */ 4055 - drhd = dmar_find_matched_drhd_unit(pdev); 4056 - if (!drhd || drhd->reg_base_addr - vtbar != 0xa000) { 4057 - pr_warn_once(FW_BUG "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n"); 4058 - add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 4059 - dev_iommu_priv_set(&pdev->dev, DUMMY_DEVICE_DOMAIN_INFO); 4060 - } 4061 - } 4062 - DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SNB, quirk_ioat_snb_local_iommu); 4063 - 4064 3992 static void __init init_no_remapping_devices(void) 4065 3993 { 4066 3994 struct dmar_drhd_unit *drhd; ··· 4063 4049 /* This IOMMU has *only* gfx devices. Either bypass it or 4064 4050 set the gfx_mapped flag, as appropriate */ 4065 4051 drhd->gfx_dedicated = 1; 4066 - if (!dmar_map_gfx) { 4052 + if (!dmar_map_gfx) 4067 4053 drhd->ignored = 1; 4068 - for_each_active_dev_scope(drhd->devices, 4069 - drhd->devices_cnt, i, dev) 4070 - dev_iommu_priv_set(dev, DUMMY_DEVICE_DOMAIN_INFO); 4071 - } 4072 4054 } 4073 4055 } 4074 4056
+8 -2
drivers/iommu/intel/irq_remapping.c
··· 508 508 509 509 /* Enable interrupt-remapping */ 510 510 iommu->gcmd |= DMA_GCMD_IRE; 511 - iommu->gcmd &= ~DMA_GCMD_CFI; /* Block compatibility-format MSIs */ 512 511 writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG); 513 - 514 512 IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG, 515 513 readl, (sts & DMA_GSTS_IRES), sts); 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 + } 516 522 517 523 /* 518 524 * With CFI clear in the Global Command register, we should be
+6 -2
drivers/md/dm-cache-metadata.c
··· 537 537 CACHE_MAX_CONCURRENT_LOCKS); 538 538 if (IS_ERR(cmd->bm)) { 539 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 545 r = __open_or_format_metadata(cmd, may_format_device); 544 - if (r) 546 + if (r) { 545 547 dm_block_manager_destroy(cmd->bm); 548 + cmd->bm = NULL; 549 + } 546 550 547 551 return r; 548 552 }
+2 -2
drivers/md/dm-crypt.c
··· 739 739 u8 buf[MAX_CIPHER_BLOCKSIZE] __aligned(__alignof__(__le64)); 740 740 struct skcipher_request *req; 741 741 struct scatterlist src, dst; 742 - struct crypto_wait wait; 742 + DECLARE_CRYPTO_WAIT(wait); 743 743 int err; 744 744 745 745 req = skcipher_request_alloc(any_tfm(cc), GFP_NOIO); ··· 936 936 u8 *es, *ks, *data, *data2, *data_offset; 937 937 struct skcipher_request *req; 938 938 struct scatterlist *sg, *sg2, src, dst; 939 - struct crypto_wait wait; 939 + DECLARE_CRYPTO_WAIT(wait); 940 940 int i, r; 941 941 942 942 req = skcipher_request_alloc(elephant->tfm, GFP_NOIO);
+12
drivers/md/dm-integrity.c
··· 2487 2487 range.logical_sector = le64_to_cpu(ic->sb->recalc_sector); 2488 2488 if (unlikely(range.logical_sector >= ic->provided_data_sectors)) { 2489 2489 if (ic->mode == 'B') { 2490 + block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR); 2490 2491 DEBUG_print("queue_delayed_work: bitmap_flush_work\n"); 2491 2492 queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, 0); 2492 2493 } ··· 2563 2562 if (unlikely(r)) { 2564 2563 dm_integrity_io_error(ic, "writing tags", r); 2565 2564 goto err; 2565 + } 2566 + 2567 + if (ic->mode == 'B') { 2568 + sector_t start, end; 2569 + start = (range.logical_sector >> 2570 + (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) << 2571 + (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit); 2572 + end = ((range.logical_sector + range.n_sectors) >> 2573 + (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit)) << 2574 + (ic->sb->log2_sectors_per_block + ic->log2_blocks_per_bitmap_bit); 2575 + block_bitmap_op(ic, ic->recalc_bitmap, start, end - start, BITMAP_OP_CLEAR); 2566 2576 } 2567 2577 2568 2578 advance_and_next:
+15 -7
drivers/md/dm-mpath.c
··· 1287 1287 static void flush_multipath_work(struct multipath *m) 1288 1288 { 1289 1289 if (m->hw_handler_name) { 1290 - set_bit(MPATHF_PG_INIT_DISABLED, &m->flags); 1291 - smp_mb__after_atomic(); 1290 + unsigned long flags; 1292 1291 1293 - if (atomic_read(&m->pg_init_in_progress)) 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); 1299 + 1294 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); 1298 - smp_mb__after_atomic(); 1303 + spin_lock_irqsave(&m->lock, flags); 1304 + clear_bit(MPATHF_PG_INIT_DISABLED, &m->flags); 1305 + } 1306 + spin_unlock_irqrestore(&m->lock, flags); 1299 1307 } 1300 - 1308 + skip: 1301 1309 if (m->queue_mode == DM_TYPE_BIO_BASED) 1302 1310 flush_work(&m->process_queued_bios); 1303 1311 flush_work(&m->trigger_event);
+7 -3
drivers/md/dm-thin-metadata.c
··· 739 739 THIN_MAX_CONCURRENT_LOCKS); 740 740 if (IS_ERR(pmd->bm)) { 741 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 747 r = __open_or_format_metadata(pmd, format_device); 746 - if (r) 748 + if (r) { 747 749 dm_block_manager_destroy(pmd->bm); 750 + pmd->bm = NULL; 751 + } 748 752 749 753 return r; 750 754 } ··· 958 954 } 959 955 960 956 pmd_write_lock_in_core(pmd); 961 - if (!dm_bm_is_read_only(pmd->bm) && !pmd->fail_io) { 957 + if (!pmd->fail_io && !dm_bm_is_read_only(pmd->bm)) { 962 958 r = __commit_transaction(pmd); 963 959 if (r < 0) 964 960 DMWARN("%s: __commit_transaction() failed, error = %d",
+10 -2
drivers/md/dm-writecache.c
··· 231 231 pfn_t pfn; 232 232 int id; 233 233 struct page **pages; 234 + sector_t offset; 234 235 235 236 wc->memory_vmapped = false; 236 237 ··· 246 245 goto err1; 247 246 } 248 247 248 + offset = get_start_sect(wc->ssd_dev->bdev); 249 + if (offset & (PAGE_SIZE / 512 - 1)) { 250 + r = -EINVAL; 251 + goto err1; 252 + } 253 + offset >>= PAGE_SHIFT - 9; 254 + 249 255 id = dax_read_lock(); 250 256 251 - da = dax_direct_access(wc->ssd_dev->dax_dev, 0, p, &wc->memory_map, &pfn); 257 + da = dax_direct_access(wc->ssd_dev->dax_dev, offset, p, &wc->memory_map, &pfn); 252 258 if (da < 0) { 253 259 wc->memory_map = NULL; 254 260 r = da; ··· 277 269 i = 0; 278 270 do { 279 271 long daa; 280 - daa = dax_direct_access(wc->ssd_dev->dax_dev, i, p - i, 272 + daa = dax_direct_access(wc->ssd_dev->dax_dev, offset + i, p - i, 281 273 NULL, &pfn); 282 274 if (daa <= 0) { 283 275 r = daa ? daa : -EINVAL;
+8 -6
drivers/md/persistent-data/dm-block-manager.c
··· 493 493 void *p; 494 494 int r; 495 495 496 - if (bm->read_only) 496 + if (dm_bm_is_read_only(bm)) 497 497 return -EPERM; 498 498 499 499 p = dm_bufio_read(bm->bufio, b, (struct dm_buffer **) result); ··· 562 562 struct buffer_aux *aux; 563 563 void *p; 564 564 565 - if (bm->read_only) 565 + if (dm_bm_is_read_only(bm)) 566 566 return -EPERM; 567 567 568 568 p = dm_bufio_new(bm->bufio, b, (struct dm_buffer **) result); ··· 602 602 603 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 606 return -EPERM; 607 607 608 608 return dm_bufio_write_dirty_buffers(bm->bufio); ··· 616 616 617 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 621 EXPORT_SYMBOL_GPL(dm_bm_is_read_only); 622 622 623 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 628 EXPORT_SYMBOL_GPL(dm_bm_set_read_only); 628 629 629 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 635 EXPORT_SYMBOL_GPL(dm_bm_set_read_write); 634 636
+2 -2
drivers/media/i2c/Kconfig
··· 467 467 config VIDEO_MAX9286 468 468 tristate "Maxim MAX9286 GMSL deserializer support" 469 469 depends on I2C && I2C_MUX 470 - depends on OF 470 + depends on OF_GPIO 471 471 select V4L2_FWNODE 472 472 select VIDEO_V4L2_SUBDEV_API 473 473 select MEDIA_CONTROLLER ··· 741 741 config VIDEO_IMX214 742 742 tristate "Sony IMX214 sensor support" 743 743 depends on GPIOLIB && I2C && VIDEO_V4L2 744 - depends on V4L2_FWNODE 744 + select V4L2_FWNODE 745 745 select MEDIA_CONTROLLER 746 746 select VIDEO_V4L2_SUBDEV_API 747 747 select REGMAP_I2C
+1 -1
drivers/media/platform/ti-vpe/cal.h
··· 226 226 u32 val = cal_read(cal, offset); 227 227 228 228 val &= ~mask; 229 - val |= FIELD_PREP(mask, value); 229 + val |= (value << __ffs(mask)) & mask; 230 230 cal_write(cal, offset, val); 231 231 } 232 232
+5 -11
drivers/media/rc/gpio-ir-tx.c
··· 19 19 struct gpio_desc *gpio; 20 20 unsigned int carrier; 21 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 24 static const struct of_device_id gpio_ir_tx_of_match[] = { ··· 51 53 static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, 52 54 uint count) 53 55 { 54 - unsigned long flags; 55 56 ktime_t edge; 56 57 s32 delta; 57 58 int i; 58 59 59 - spin_lock_irqsave(&gpio_ir->lock, flags); 60 + local_irq_disable(); 60 61 61 62 edge = ktime_get(); 62 63 ··· 69 72 } 70 73 71 74 gpiod_set_value(gpio_ir->gpio, 0); 72 - 73 - spin_unlock_irqrestore(&gpio_ir->lock, flags); 74 75 } 75 76 76 77 static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, 77 78 uint count) 78 79 { 79 - unsigned long flags; 80 80 ktime_t edge; 81 81 /* 82 82 * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on ··· 89 95 space = DIV_ROUND_CLOSEST((100 - gpio_ir->duty_cycle) * 90 96 (NSEC_PER_SEC / 100), gpio_ir->carrier); 91 97 92 - spin_lock_irqsave(&gpio_ir->lock, flags); 98 + local_irq_disable(); 93 99 94 100 edge = ktime_get(); 95 101 ··· 122 128 edge = last; 123 129 } 124 130 } 125 - 126 - spin_unlock_irqrestore(&gpio_ir->lock, flags); 127 131 } 128 132 129 133 static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf, 130 134 unsigned int count) 131 135 { 132 136 struct gpio_ir *gpio_ir = dev->priv; 137 + unsigned long flags; 133 138 139 + local_irq_save(flags); 134 140 if (gpio_ir->carrier) 135 141 gpio_ir_tx_modulated(gpio_ir, txbuf, count); 136 142 else 137 143 gpio_ir_tx_unmodulated(gpio_ir, txbuf, count); 144 + local_irq_restore(flags); 138 145 139 146 return count; 140 147 } ··· 171 176 172 177 gpio_ir->carrier = 38000; 173 178 gpio_ir->duty_cycle = 50; 174 - spin_lock_init(&gpio_ir->lock); 175 179 176 180 rc = devm_rc_register_device(&pdev->dev, rcdev); 177 181 if (rc < 0)
+1 -1
drivers/media/rc/mceusb.c
··· 1726 1726 goto mem_alloc_fail; 1727 1727 1728 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 1730 if (!ir->buf_in) 1731 1731 goto buf_in_alloc_fail; 1732 1732
+28 -16
drivers/media/rc/rc-main.c
··· 1292 1292 } 1293 1293 1294 1294 mutex_lock(&dev->lock); 1295 + if (!dev->registered) { 1296 + mutex_unlock(&dev->lock); 1297 + return -ENODEV; 1298 + } 1295 1299 1296 1300 old_protocols = *current_protocols; 1297 1301 new_protocols = old_protocols; ··· 1434 1430 return -EINVAL; 1435 1431 1436 1432 mutex_lock(&dev->lock); 1433 + if (!dev->registered) { 1434 + mutex_unlock(&dev->lock); 1435 + return -ENODEV; 1436 + } 1437 1437 1438 1438 new_filter = *filter; 1439 1439 if (fattr->mask) ··· 1552 1544 int i; 1553 1545 1554 1546 mutex_lock(&dev->lock); 1547 + if (!dev->registered) { 1548 + mutex_unlock(&dev->lock); 1549 + return -ENODEV; 1550 + } 1555 1551 1556 1552 allowed = dev->allowed_wakeup_protocols; 1557 1553 ··· 1613 1601 kfree(dev); 1614 1602 } 1615 1603 1616 - #define ADD_HOTPLUG_VAR(fmt, val...) \ 1617 - do { \ 1618 - int err = add_uevent_var(env, fmt, val); \ 1619 - if (err) \ 1620 - return err; \ 1621 - } while (0) 1622 - 1623 1604 static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) 1624 1605 { 1625 1606 struct rc_dev *dev = to_rc_dev(device); 1607 + int ret = 0; 1626 1608 1627 - if (dev->rc_map.name) 1628 - ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name); 1629 - if (dev->driver_name) 1630 - ADD_HOTPLUG_VAR("DRV_NAME=%s", dev->driver_name); 1631 - if (dev->device_name) 1632 - ADD_HOTPLUG_VAR("DEV_NAME=%s", dev->device_name); 1609 + mutex_lock(&dev->lock); 1633 1610 1634 - return 0; 1611 + if (!dev->registered) 1612 + ret = -ENODEV; 1613 + if (ret == 0 && dev->rc_map.name) 1614 + ret = add_uevent_var(env, "NAME=%s", dev->rc_map.name); 1615 + if (ret == 0 && dev->driver_name) 1616 + ret = add_uevent_var(env, "DRV_NAME=%s", dev->driver_name); 1617 + if (ret == 0 && dev->device_name) 1618 + ret = add_uevent_var(env, "DEV_NAME=%s", dev->device_name); 1619 + 1620 + mutex_unlock(&dev->lock); 1621 + 1622 + return ret; 1635 1623 } 1636 1624 1637 1625 /* ··· 2023 2011 del_timer_sync(&dev->timer_keyup); 2024 2012 del_timer_sync(&dev->timer_repeat); 2025 2013 2026 - rc_free_rx_device(dev); 2027 - 2028 2014 mutex_lock(&dev->lock); 2029 2015 if (dev->users && dev->close) 2030 2016 dev->close(dev); 2031 2017 dev->registered = false; 2032 2018 mutex_unlock(&dev->lock); 2019 + 2020 + rc_free_rx_device(dev); 2033 2021 2034 2022 /* 2035 2023 * lirc device should be freed with dev->registered = false, so
+1
drivers/media/test-drivers/vicodec/vicodec-core.c
··· 1994 1994 } 1995 1995 ctrl = v4l2_ctrl_request_hdl_ctrl_find(hdl, 1996 1996 vicodec_ctrl_stateless_state.id); 1997 + v4l2_ctrl_request_hdl_put(hdl); 1997 1998 if (!ctrl) { 1998 1999 v4l2_info(&ctx->dev->v4l2_dev, 1999 2000 "Missing required codec control\n");
+27 -23
drivers/media/v4l2-core/v4l2-ioctl.c
··· 3187 3187 #ifdef CONFIG_COMPAT_32BIT_TIME 3188 3188 case VIDIOC_DQEVENT_TIME32: { 3189 3189 struct v4l2_event *ev = parg; 3190 - struct v4l2_event_time32 ev32 = { 3191 - .type = ev->type, 3192 - .pending = ev->pending, 3193 - .sequence = ev->sequence, 3194 - .timestamp.tv_sec = ev->timestamp.tv_sec, 3195 - .timestamp.tv_nsec = ev->timestamp.tv_nsec, 3196 - .id = ev->id, 3197 - }; 3190 + struct v4l2_event_time32 ev32; 3191 + 3192 + memset(&ev32, 0, sizeof(ev32)); 3193 + 3194 + ev32.type = ev->type; 3195 + ev32.pending = ev->pending; 3196 + ev32.sequence = ev->sequence; 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 3201 memcpy(&ev32.u, &ev->u, sizeof(ev->u)); 3200 3202 memcpy(&ev32.reserved, &ev->reserved, sizeof(ev->reserved)); ··· 3210 3208 case VIDIOC_DQBUF_TIME32: 3211 3209 case VIDIOC_PREPARE_BUF_TIME32: { 3212 3210 struct v4l2_buffer *vb = parg; 3213 - struct v4l2_buffer_time32 vb32 = { 3214 - .index = vb->index, 3215 - .type = vb->type, 3216 - .bytesused = vb->bytesused, 3217 - .flags = vb->flags, 3218 - .field = vb->field, 3219 - .timestamp.tv_sec = vb->timestamp.tv_sec, 3220 - .timestamp.tv_usec = vb->timestamp.tv_usec, 3221 - .timecode = vb->timecode, 3222 - .sequence = vb->sequence, 3223 - .memory = vb->memory, 3224 - .m.userptr = vb->m.userptr, 3225 - .length = vb->length, 3226 - .request_fd = vb->request_fd, 3227 - }; 3211 + struct v4l2_buffer_time32 vb32; 3212 + 3213 + memset(&vb32, 0, sizeof(vb32)); 3214 + 3215 + vb32.index = vb->index; 3216 + vb32.type = vb->type; 3217 + vb32.bytesused = vb->bytesused; 3218 + vb32.flags = vb->flags; 3219 + vb32.field = vb->field; 3220 + vb32.timestamp.tv_sec = vb->timestamp.tv_sec; 3221 + vb32.timestamp.tv_usec = vb->timestamp.tv_usec; 3222 + vb32.timecode = vb->timecode; 3223 + vb32.sequence = vb->sequence; 3224 + vb32.memory = vb->memory; 3225 + vb32.m.userptr = vb->m.userptr; 3226 + vb32.length = vb->length; 3227 + vb32.request_fd = vb->request_fd; 3228 3228 3229 3229 if (copy_to_user(arg, &vb32, sizeof(vb32))) 3230 3230 return -EFAULT;
+7 -4
drivers/misc/eeprom/at24.c
··· 692 692 nvmem_config.word_size = 1; 693 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 695 i2c_set_clientdata(client, at24); 700 696 701 697 err = regulator_enable(at24->vcc_reg); ··· 703 707 /* enable runtime pm */ 704 708 pm_runtime_set_active(dev); 705 709 pm_runtime_enable(dev); 710 + 711 + at24->nvmem = devm_nvmem_register(dev, &nvmem_config); 712 + if (IS_ERR(at24->nvmem)) { 713 + pm_runtime_disable(dev); 714 + regulator_disable(at24->vcc_reg); 715 + return PTR_ERR(at24->nvmem); 716 + } 706 717 707 718 /* 708 719 * Perform a one-byte test read to verify that the
+1 -1
drivers/misc/habanalabs/common/debugfs.c
··· 982 982 return 0; 983 983 984 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 986 strlen(tmp_buf) + 1); 987 987 988 988 return rc;
+16 -16
drivers/misc/habanalabs/include/gaudi/gaudi_masks.h
··· 378 378 ((((y) & RAZWI_INITIATOR_Y_MASK) << RAZWI_INITIATOR_Y_SHIFT) | \ 379 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) 382 - #define RAZWI_INITIATOR_ID_X_Y_TPC1 RAZWI_INITIATOR_ID_X_Y(2, 0) 383 - #define RAZWI_INITIATOR_ID_X_Y_MME0_0 RAZWI_INITIATOR_ID_X_Y(3, 0) 384 - #define RAZWI_INITIATOR_ID_X_Y_MME0_1 RAZWI_INITIATOR_ID_X_Y(4, 0) 385 - #define RAZWI_INITIATOR_ID_X_Y_MME1_0 RAZWI_INITIATOR_ID_X_Y(5, 0) 386 - #define RAZWI_INITIATOR_ID_X_Y_MME1_1 RAZWI_INITIATOR_ID_X_Y(6, 0) 387 - #define RAZWI_INITIATOR_ID_X_Y_TPC2 RAZWI_INITIATOR_ID_X_Y(7, 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, 1) 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, 1) 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, 1) 387 + #define RAZWI_INITIATOR_ID_X_Y_TPC2 RAZWI_INITIATOR_ID_X_Y(7, 1) 388 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 390 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_0 RAZWI_INITIATOR_ID_X_Y(0, 1) 391 391 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_S_0 RAZWI_INITIATOR_ID_X_Y(9, 1) 392 392 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_1 RAZWI_INITIATOR_ID_X_Y(0, 2) ··· 395 395 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_0 RAZWI_INITIATOR_ID_X_Y(9, 3) 396 396 #define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_N_1 RAZWI_INITIATOR_ID_X_Y(0, 4) 397 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) 399 - #define RAZWI_INITIATOR_ID_X_Y_TPC5 RAZWI_INITIATOR_ID_X_Y(2, 5) 400 - #define RAZWI_INITIATOR_ID_X_Y_MME2_0 RAZWI_INITIATOR_ID_X_Y(3, 5) 401 - #define RAZWI_INITIATOR_ID_X_Y_MME2_1 RAZWI_INITIATOR_ID_X_Y(4, 5) 402 - #define RAZWI_INITIATOR_ID_X_Y_MME3_0 RAZWI_INITIATOR_ID_X_Y(5, 5) 403 - #define RAZWI_INITIATOR_ID_X_Y_MME3_1 RAZWI_INITIATOR_ID_X_Y(6, 5) 404 - #define RAZWI_INITIATOR_ID_X_Y_TPC6 RAZWI_INITIATOR_ID_X_Y(7, 5) 405 - #define RAZWI_INITIATOR_ID_X_Y_TPC7_NIC4_NIC5 RAZWI_INITIATOR_ID_X_Y(8, 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, 6) 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, 6) 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, 6) 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, 6) 406 406 407 407 #define PSOC_ETR_AXICTL_PROTCTRLBIT1_SHIFT 1 408 408
+22 -17
drivers/mmc/core/sdio_ops.c
··· 121 121 struct sg_table sgtable; 122 122 unsigned int nents, left_size, i; 123 123 unsigned int seg_size = card->host->max_seg_size; 124 + int err; 124 125 125 126 WARN_ON(blksz == 0); 126 127 ··· 171 170 172 171 mmc_set_data_timeout(&data, card); 173 172 173 + mmc_pre_req(card->host, &mrq); 174 + 174 175 mmc_wait_for_req(card->host, &mrq); 176 + 177 + if (cmd.error) 178 + err = cmd.error; 179 + else if (data.error) 180 + err = data.error; 181 + else if (mmc_host_is_spi(card->host)) 182 + /* host driver already reported errors */ 183 + err = 0; 184 + else if (cmd.resp[0] & R5_ERROR) 185 + err = -EIO; 186 + else if (cmd.resp[0] & R5_FUNCTION_NUMBER) 187 + err = -EINVAL; 188 + else if (cmd.resp[0] & R5_OUT_OF_RANGE) 189 + err = -ERANGE; 190 + else 191 + err = 0; 192 + 193 + mmc_post_req(card->host, &mrq, err); 175 194 176 195 if (nents > 1) 177 196 sg_free_table(&sgtable); 178 197 179 - if (cmd.error) 180 - return cmd.error; 181 - if (data.error) 182 - return data.error; 183 - 184 - if (mmc_host_is_spi(card->host)) { 185 - /* host driver already reported errors */ 186 - } else { 187 - if (cmd.resp[0] & R5_ERROR) 188 - return -EIO; 189 - if (cmd.resp[0] & R5_FUNCTION_NUMBER) 190 - return -EINVAL; 191 - if (cmd.resp[0] & R5_OUT_OF_RANGE) 192 - return -ERANGE; 193 - } 194 - 195 - return 0; 198 + return err; 196 199 } 197 200 198 201 int sdio_reset(struct mmc_host *host)
+1 -1
drivers/mmc/host/Kconfig
··· 602 602 603 603 config MMC_SPI 604 604 tristate "MMC/SD/SDIO over SPI" 605 - depends on SPI_MASTER && HAS_DMA 605 + depends on SPI_MASTER 606 606 select CRC7 607 607 select CRC_ITU_T 608 608 help
+52 -34
drivers/mmc/host/mmc_spi.c
··· 1278 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 1327 static int mmc_spi_probe(struct spi_device *spi) 1282 1328 { 1283 1329 void *ones; ··· 1420 1374 if (!host->data) 1421 1375 goto fail_nobuf1; 1422 1376 1423 - if (spi->master->dev.parent->dma_mask) { 1424 - struct device *dev = spi->master->dev.parent; 1425 - 1426 - host->dma_dev = dev; 1427 - host->ones_dma = dma_map_single(dev, ones, 1428 - MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); 1429 - if (dma_mapping_error(dev, host->ones_dma)) 1430 - goto fail_ones_dma; 1431 - host->data_dma = dma_map_single(dev, host->data, 1432 - sizeof(*host->data), DMA_BIDIRECTIONAL); 1433 - if (dma_mapping_error(dev, host->data_dma)) 1434 - goto fail_data_dma; 1435 - 1436 - dma_sync_single_for_cpu(host->dma_dev, 1437 - host->data_dma, sizeof(*host->data), 1438 - DMA_BIDIRECTIONAL); 1439 - } 1377 + status = mmc_spi_dma_alloc(host); 1378 + if (status) 1379 + goto fail_dma; 1440 1380 1441 1381 /* setup message for status/busy readback */ 1442 1382 spi_message_init(&host->readback); ··· 1490 1458 fail_add_host: 1491 1459 mmc_remove_host(mmc); 1492 1460 fail_glue_init: 1493 - if (host->dma_dev) 1494 - dma_unmap_single(host->dma_dev, host->data_dma, 1495 - sizeof(*host->data), DMA_BIDIRECTIONAL); 1496 - fail_data_dma: 1497 - if (host->dma_dev) 1498 - dma_unmap_single(host->dma_dev, host->ones_dma, 1499 - MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); 1500 - fail_ones_dma: 1461 + mmc_spi_dma_free(host); 1462 + fail_dma: 1501 1463 kfree(host->data); 1502 - 1503 1464 fail_nobuf1: 1504 1465 mmc_free_host(mmc); 1505 1466 mmc_spi_put_pdata(spi); 1506 - 1507 1467 nomem: 1508 1468 kfree(ones); 1509 1469 return status; ··· 1513 1489 1514 1490 mmc_remove_host(mmc); 1515 1491 1516 - if (host->dma_dev) { 1517 - dma_unmap_single(host->dma_dev, host->ones_dma, 1518 - MMC_SPI_BLOCKSIZE, DMA_TO_DEVICE); 1519 - dma_unmap_single(host->dma_dev, host->data_dma, 1520 - sizeof(*host->data), DMA_BIDIRECTIONAL); 1521 - } 1522 - 1492 + mmc_spi_dma_free(host); 1523 1493 kfree(host->data); 1524 1494 kfree(host->ones); 1525 1495
+13
drivers/mmc/host/mtk-sd.c
··· 22 22 #include <linux/slab.h> 23 23 #include <linux/spinlock.h> 24 24 #include <linux/interrupt.h> 25 + #include <linux/reset.h> 25 26 26 27 #include <linux/mmc/card.h> 27 28 #include <linux/mmc/core.h> ··· 420 419 struct pinctrl_state *pins_uhs; 421 420 struct delayed_work req_timeout; 422 421 int irq; /* host interrupt */ 422 + struct reset_control *reset; 423 423 424 424 struct clk *src_clk; /* msdc source clock */ 425 425 struct clk *h_clk; /* msdc h_clk */ ··· 1594 1592 u32 val; 1595 1593 u32 tune_reg = host->dev_comp->pad_tune_reg; 1596 1594 1595 + if (host->reset) { 1596 + reset_control_assert(host->reset); 1597 + usleep_range(10, 50); 1598 + reset_control_deassert(host->reset); 1599 + } 1600 + 1597 1601 /* Configure to MMC/SD mode, clock free running */ 1598 1602 sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_MODE | MSDC_CFG_CKPDN); 1599 1603 ··· 2397 2389 host->src_clk_cg = devm_clk_get(&pdev->dev, "source_cg"); 2398 2390 if (IS_ERR(host->src_clk_cg)) 2399 2391 host->src_clk_cg = NULL; 2392 + 2393 + host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev, 2394 + "hrst"); 2395 + if (IS_ERR(host->reset)) 2396 + return PTR_ERR(host->reset); 2400 2397 2401 2398 host->irq = platform_get_irq(pdev, 0); 2402 2399 if (host->irq < 0) {
+77 -13
drivers/mmc/host/sdhci-acpi.c
··· 535 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 543 /* AMD sdhci reset dll register. */ 539 544 #define SDHCI_AMD_RESET_DLL_REGISTER 0x908 540 545 ··· 551 546 return MMC_SET_DRIVER_TYPE_A; 552 547 } 553 548 554 - static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host) 549 + static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host, bool enable) 555 550 { 551 + struct sdhci_acpi_host *acpi_host = sdhci_priv(host); 552 + struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); 553 + 556 554 /* AMD Platform requires dll setting */ 557 555 sdhci_writel(host, 0x40003210, SDHCI_AMD_RESET_DLL_REGISTER); 558 556 usleep_range(10, 20); 559 - sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER); 557 + if (enable) 558 + sdhci_writel(host, 0x40033210, SDHCI_AMD_RESET_DLL_REGISTER); 559 + 560 + amd_host->dll_enabled = enable; 560 561 } 561 562 562 563 /* 563 - * For AMD Platform it is required to disable the tuning 564 - * bit first controller to bring to HS Mode from HS200 565 - * mode, later enable to tune to HS400 mode. 564 + * The initialization sequence for HS400 is: 565 + * HS->HS200->Perform Tuning->HS->HS400 566 + * 567 + * The re-tuning sequence is: 568 + * HS400->DDR52->HS->HS200->Perform Tuning->HS->HS400 569 + * 570 + * The AMD eMMC Controller can only use the tuned clock while in HS200 and HS400 571 + * mode. If we switch to a different mode, we need to disable the tuned clock. 572 + * If we have previously performed tuning and switch back to HS200 or 573 + * HS400, we can re-enable the tuned clock. 574 + * 566 575 */ 567 576 static void amd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 568 577 { 569 578 struct sdhci_host *host = mmc_priv(mmc); 579 + struct sdhci_acpi_host *acpi_host = sdhci_priv(host); 580 + struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); 570 581 unsigned int old_timing = host->timing; 582 + u16 val; 571 583 572 584 sdhci_set_ios(mmc, ios); 573 - if (old_timing == MMC_TIMING_MMC_HS200 && 574 - ios->timing == MMC_TIMING_MMC_HS) 575 - sdhci_writew(host, 0x9, SDHCI_HOST_CONTROL2); 576 - if (old_timing != MMC_TIMING_MMC_HS400 && 577 - ios->timing == MMC_TIMING_MMC_HS400) { 578 - sdhci_writew(host, 0x80, SDHCI_HOST_CONTROL2); 579 - sdhci_acpi_amd_hs400_dll(host); 585 + 586 + if (old_timing != host->timing && amd_host->tuned_clock) { 587 + if (host->timing == MMC_TIMING_MMC_HS400 || 588 + host->timing == MMC_TIMING_MMC_HS200) { 589 + val = sdhci_readw(host, SDHCI_HOST_CONTROL2); 590 + val |= SDHCI_CTRL_TUNED_CLK; 591 + sdhci_writew(host, val, SDHCI_HOST_CONTROL2); 592 + } else { 593 + val = sdhci_readw(host, SDHCI_HOST_CONTROL2); 594 + val &= ~SDHCI_CTRL_TUNED_CLK; 595 + sdhci_writew(host, val, SDHCI_HOST_CONTROL2); 596 + } 597 + 598 + /* DLL is only required for HS400 */ 599 + if (host->timing == MMC_TIMING_MMC_HS400 && 600 + !amd_host->dll_enabled) 601 + sdhci_acpi_amd_hs400_dll(host, true); 580 602 } 603 + } 604 + 605 + static int amd_sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode) 606 + { 607 + int err; 608 + struct sdhci_host *host = mmc_priv(mmc); 609 + struct sdhci_acpi_host *acpi_host = sdhci_priv(host); 610 + struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); 611 + 612 + amd_host->tuned_clock = false; 613 + 614 + err = sdhci_execute_tuning(mmc, opcode); 615 + 616 + if (!err && !host->tuning_err) 617 + amd_host->tuned_clock = true; 618 + 619 + return err; 620 + } 621 + 622 + static void amd_sdhci_reset(struct sdhci_host *host, u8 mask) 623 + { 624 + struct sdhci_acpi_host *acpi_host = sdhci_priv(host); 625 + struct amd_sdhci_host *amd_host = sdhci_acpi_priv(acpi_host); 626 + 627 + if (mask & SDHCI_RESET_ALL) { 628 + amd_host->tuned_clock = false; 629 + sdhci_acpi_amd_hs400_dll(host, false); 630 + } 631 + 632 + sdhci_reset(host, mask); 581 633 } 582 634 583 635 static const struct sdhci_ops sdhci_acpi_ops_amd = { 584 636 .set_clock = sdhci_set_clock, 585 637 .set_bus_width = sdhci_set_bus_width, 586 - .reset = sdhci_reset, 638 + .reset = amd_sdhci_reset, 587 639 .set_uhs_signaling = sdhci_set_uhs_signaling, 588 640 }; 589 641 ··· 664 602 665 603 host->mmc_host_ops.select_drive_strength = amd_select_drive_strength; 666 604 host->mmc_host_ops.set_ios = amd_set_ios; 605 + host->mmc_host_ops.execute_tuning = amd_sdhci_execute_tuning; 667 606 return 0; 668 607 } 669 608 ··· 676 613 SDHCI_QUIRK_32BIT_ADMA_SIZE, 677 614 .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA, 678 615 .probe_slot = sdhci_acpi_emmc_amd_probe_slot, 616 + .priv_size = sizeof(struct amd_sdhci_host), 679 617 }; 680 618 681 619 struct sdhci_acpi_uid_slot {
+17 -1
drivers/mmc/host/sdhci-msm.c
··· 1166 1166 static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode) 1167 1167 { 1168 1168 struct sdhci_host *host = mmc_priv(mmc); 1169 - int tuning_seq_cnt = 3; 1169 + int tuning_seq_cnt = 10; 1170 1170 u8 phase, tuned_phases[16], tuned_phase_cnt = 0; 1171 1171 int rc; 1172 1172 struct mmc_ios ios = host->mmc->ios; ··· 1222 1222 } while (++phase < ARRAY_SIZE(tuned_phases)); 1223 1223 1224 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 1241 rc = msm_find_most_appropriate_phase(host, tuned_phases, 1226 1242 tuned_phase_cnt); 1227 1243 if (rc < 0)
+7 -3
drivers/mmc/host/sdhci-of-esdhc.c
··· 81 81 bool quirk_tuning_erratum_type2; 82 82 bool quirk_ignore_data_inhibit; 83 83 bool quirk_delay_before_data_reset; 84 + bool quirk_trans_complete_erratum; 84 85 bool in_sw_tuning; 85 86 unsigned int peripheral_clock; 86 87 const struct esdhc_clk_fixup *clk_fixup; ··· 1178 1177 1179 1178 static u32 esdhc_irq(struct sdhci_host *host, u32 intmask) 1180 1179 { 1180 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 1181 + struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host); 1181 1182 u32 command; 1182 1183 1183 - if (of_find_compatible_node(NULL, NULL, 1184 - "fsl,p2020-esdhc")) { 1184 + if (esdhc->quirk_trans_complete_erratum) { 1185 1185 command = SDHCI_GET_CMD(sdhci_readw(host, 1186 1186 SDHCI_COMMAND)); 1187 1187 if (command == MMC_WRITE_MULTIPLE_BLOCK && ··· 1336 1334 esdhc->clk_fixup = match->data; 1337 1335 np = pdev->dev.of_node; 1338 1336 1339 - if (of_device_is_compatible(np, "fsl,p2020-esdhc")) 1337 + if (of_device_is_compatible(np, "fsl,p2020-esdhc")) { 1340 1338 esdhc->quirk_delay_before_data_reset = true; 1339 + esdhc->quirk_trans_complete_erratum = true; 1340 + } 1341 1341 1342 1342 clk = of_clk_get(np, 0); 1343 1343 if (!IS_ERR(clk)) {
+9 -1
drivers/mmc/host/sdhci-pci-core.c
··· 232 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 245 * Hardware specific quirk handling * ··· 726 718 .set_power = sdhci_intel_set_power, 727 719 .enable_dma = sdhci_pci_enable_dma, 728 720 .set_bus_width = sdhci_set_bus_width, 729 - .reset = sdhci_reset, 721 + .reset = sdhci_cqhci_reset, 730 722 .set_uhs_signaling = sdhci_set_uhs_signaling, 731 723 .hw_reset = sdhci_pci_hw_reset, 732 724 .irq = sdhci_cqhci_irq,
+51 -4
drivers/mmc/host/sdhci-tegra.c
··· 110 110 #define NVQUIRK_DIS_CARD_CLK_CONFIG_TAP BIT(8) 111 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 119 /* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */ 114 120 #define SDHCI_TEGRA_CQE_BASE_ADDR 0xF000 115 121 ··· 146 140 struct sdhci_tegra { 147 141 const struct sdhci_tegra_soc_data *soc_data; 148 142 struct gpio_desc *power_gpio; 143 + struct clk *tmclk; 149 144 bool ddr_signaling; 150 145 bool pad_calib_required; 151 146 bool pad_control_available; ··· 1425 1418 1426 1419 static const struct sdhci_pltfm_data sdhci_tegra210_pdata = { 1427 1420 .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | 1428 - SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | 1429 1421 SDHCI_QUIRK_SINGLE_POWER_WRITE | 1430 1422 SDHCI_QUIRK_NO_HISPD_BIT | 1431 1423 SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | ··· 1440 1434 NVQUIRK_HAS_PADCALIB | 1441 1435 NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | 1442 1436 NVQUIRK_ENABLE_SDR50 | 1443 - NVQUIRK_ENABLE_SDR104, 1437 + NVQUIRK_ENABLE_SDR104 | 1438 + NVQUIRK_HAS_TMCLK, 1444 1439 .min_tap_delay = 106, 1445 1440 .max_tap_delay = 185, 1446 1441 }; ··· 1463 1456 1464 1457 static const struct sdhci_pltfm_data sdhci_tegra186_pdata = { 1465 1458 .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | 1466 - SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | 1467 1459 SDHCI_QUIRK_SINGLE_POWER_WRITE | 1468 1460 SDHCI_QUIRK_NO_HISPD_BIT | 1469 1461 SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | ··· 1479 1473 NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | 1480 1474 NVQUIRK_ENABLE_SDR50 | 1481 1475 NVQUIRK_ENABLE_SDR104 | 1476 + NVQUIRK_HAS_TMCLK | 1482 1477 NVQUIRK_CQHCI_DCMD_R1B_CMD_TIMING, 1483 1478 .min_tap_delay = 84, 1484 1479 .max_tap_delay = 136, ··· 1492 1485 NVQUIRK_HAS_PADCALIB | 1493 1486 NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | 1494 1487 NVQUIRK_ENABLE_SDR50 | 1495 - NVQUIRK_ENABLE_SDR104, 1488 + NVQUIRK_ENABLE_SDR104 | 1489 + NVQUIRK_HAS_TMCLK, 1496 1490 .min_tap_delay = 96, 1497 1491 .max_tap_delay = 139, 1498 1492 }; ··· 1621 1613 goto err_power_req; 1622 1614 } 1623 1615 1616 + /* 1617 + * Tegra210 has a separate SDMMC_LEGACY_TM clock used for host 1618 + * timeout clock and SW can choose TMCLK or SDCLK for hardware 1619 + * data timeout through the bit USE_TMCLK_FOR_DATA_TIMEOUT of 1620 + * the register SDHCI_TEGRA_VENDOR_SYS_SW_CTRL. 1621 + * 1622 + * USE_TMCLK_FOR_DATA_TIMEOUT bit default is set to 1 and SDMMC uses 1623 + * 12Mhz TMCLK which is advertised in host capability register. 1624 + * With TMCLK of 12Mhz provides maximum data timeout period that can 1625 + * be achieved is 11s better than using SDCLK for data timeout. 1626 + * 1627 + * So, TMCLK is set to 12Mhz and kept enabled all the time on SoC's 1628 + * supporting separate TMCLK. 1629 + */ 1630 + 1631 + if (soc_data->nvquirks & NVQUIRK_HAS_TMCLK) { 1632 + clk = devm_clk_get(&pdev->dev, "tmclk"); 1633 + if (IS_ERR(clk)) { 1634 + rc = PTR_ERR(clk); 1635 + if (rc == -EPROBE_DEFER) 1636 + goto err_power_req; 1637 + 1638 + dev_warn(&pdev->dev, "failed to get tmclk: %d\n", rc); 1639 + clk = NULL; 1640 + } 1641 + 1642 + clk_set_rate(clk, 12000000); 1643 + rc = clk_prepare_enable(clk); 1644 + if (rc) { 1645 + dev_err(&pdev->dev, 1646 + "failed to enable tmclk: %d\n", rc); 1647 + goto err_power_req; 1648 + } 1649 + 1650 + tegra_host->tmclk = clk; 1651 + } 1652 + 1624 1653 clk = devm_clk_get(mmc_dev(host->mmc), NULL); 1625 1654 if (IS_ERR(clk)) { 1626 1655 rc = PTR_ERR(clk); ··· 1701 1656 err_rst_get: 1702 1657 clk_disable_unprepare(pltfm_host->clk); 1703 1658 err_clk_get: 1659 + clk_disable_unprepare(tegra_host->tmclk); 1704 1660 err_power_req: 1705 1661 err_parse_dt: 1706 1662 sdhci_pltfm_free(pdev); ··· 1719 1673 reset_control_assert(tegra_host->rst); 1720 1674 usleep_range(2000, 4000); 1721 1675 clk_disable_unprepare(pltfm_host->clk); 1676 + clk_disable_unprepare(tegra_host->tmclk); 1722 1677 1723 1678 sdhci_pltfm_free(pdev); 1724 1679
+5 -2
drivers/net/dsa/mt7530.c
··· 1326 1326 1327 1327 if (phy_node->parent == priv->dev->of_node->parent) { 1328 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 1331 return ret; 1332 + } 1331 1333 id = of_mdio_parse_addr(ds->dev, phy_node); 1332 1334 if (id == 0) 1333 1335 priv->p5_intf_sel = P5_INTF_SEL_PHY_P0; 1334 1336 if (id == 4) 1335 1337 priv->p5_intf_sel = P5_INTF_SEL_PHY_P4; 1336 1338 } 1339 + of_node_put(mac_np); 1337 1340 of_node_put(phy_node); 1338 1341 break; 1339 1342 } ··· 1504 1501 phylink_set(mask, 100baseT_Full); 1505 1502 1506 1503 if (state->interface != PHY_INTERFACE_MODE_MII) { 1507 - phylink_set(mask, 1000baseT_Half); 1504 + /* This switch only supports 1G full-duplex. */ 1508 1505 phylink_set(mask, 1000baseT_Full); 1509 1506 if (port == 5) 1510 1507 phylink_set(mask, 1000baseX_Full);
+1
drivers/net/dsa/ocelot/felix.c
··· 400 400 if (err < 0) { 401 401 dev_err(dev, "Unsupported PHY mode %s on port %d\n", 402 402 phy_modes(phy_mode), port); 403 + of_node_put(child); 403 404 return err; 404 405 } 405 406
+1 -1
drivers/net/dsa/sja1105/sja1105_main.c
··· 3415 3415 3416 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 3419 const struct sja1105_info *info = match->data; 3420 3420 3421 3421 /* Is what's been probed in our match table at all? */
+13
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
··· 166 166 XGBE_PORT_MODE_10GBASE_T, 167 167 XGBE_PORT_MODE_10GBASE_R, 168 168 XGBE_PORT_MODE_SFP, 169 + XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG, 169 170 XGBE_PORT_MODE_MAX, 170 171 }; 171 172 ··· 1635 1634 if (ad_reg & 0x80) { 1636 1635 switch (phy_data->port_mode) { 1637 1636 case XGBE_PORT_MODE_BACKPLANE: 1637 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 1638 1638 mode = XGBE_MODE_KR; 1639 1639 break; 1640 1640 default: ··· 1645 1643 } else if (ad_reg & 0x20) { 1646 1644 switch (phy_data->port_mode) { 1647 1645 case XGBE_PORT_MODE_BACKPLANE: 1646 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 1648 1647 mode = XGBE_MODE_KX_1000; 1649 1648 break; 1650 1649 case XGBE_PORT_MODE_1000BASE_X: ··· 1785 1782 1786 1783 switch (phy_data->port_mode) { 1787 1784 case XGBE_PORT_MODE_BACKPLANE: 1785 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 1788 1786 XGBE_SET_ADV(dlks, 10000baseKR_Full); 1789 1787 break; 1790 1788 case XGBE_PORT_MODE_BACKPLANE_2500: ··· 1878 1874 switch (phy_data->port_mode) { 1879 1875 case XGBE_PORT_MODE_BACKPLANE: 1880 1876 return XGBE_AN_MODE_CL73; 1877 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 1881 1878 case XGBE_PORT_MODE_BACKPLANE_2500: 1882 1879 return XGBE_AN_MODE_NONE; 1883 1880 case XGBE_PORT_MODE_1000BASE_T: ··· 2161 2156 2162 2157 switch (phy_data->port_mode) { 2163 2158 case XGBE_PORT_MODE_BACKPLANE: 2159 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 2164 2160 return xgbe_phy_switch_bp_mode(pdata); 2165 2161 case XGBE_PORT_MODE_BACKPLANE_2500: 2166 2162 return xgbe_phy_switch_bp_2500_mode(pdata); ··· 2257 2251 2258 2252 switch (phy_data->port_mode) { 2259 2253 case XGBE_PORT_MODE_BACKPLANE: 2254 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 2260 2255 return xgbe_phy_get_bp_mode(speed); 2261 2256 case XGBE_PORT_MODE_BACKPLANE_2500: 2262 2257 return xgbe_phy_get_bp_2500_mode(speed); ··· 2433 2426 2434 2427 switch (phy_data->port_mode) { 2435 2428 case XGBE_PORT_MODE_BACKPLANE: 2429 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 2436 2430 return xgbe_phy_use_bp_mode(pdata, mode); 2437 2431 case XGBE_PORT_MODE_BACKPLANE_2500: 2438 2432 return xgbe_phy_use_bp_2500_mode(pdata, mode); ··· 2523 2515 2524 2516 switch (phy_data->port_mode) { 2525 2517 case XGBE_PORT_MODE_BACKPLANE: 2518 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 2526 2519 return xgbe_phy_valid_speed_bp_mode(speed); 2527 2520 case XGBE_PORT_MODE_BACKPLANE_2500: 2528 2521 return xgbe_phy_valid_speed_bp_2500_mode(speed); ··· 2801 2792 2802 2793 switch (phy_data->port_mode) { 2803 2794 case XGBE_PORT_MODE_BACKPLANE: 2795 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 2804 2796 if ((phy_data->port_speeds & XGBE_PHY_PORT_SPEED_1000) || 2805 2797 (phy_data->port_speeds & XGBE_PHY_PORT_SPEED_10000)) 2806 2798 return false; ··· 2854 2844 2855 2845 switch (phy_data->port_mode) { 2856 2846 case XGBE_PORT_MODE_BACKPLANE: 2847 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 2857 2848 case XGBE_PORT_MODE_BACKPLANE_2500: 2858 2849 if (phy_data->conn_type == XGBE_CONN_TYPE_BACKPLANE) 2859 2850 return false; ··· 3171 3160 /* Backplane support */ 3172 3161 case XGBE_PORT_MODE_BACKPLANE: 3173 3162 XGBE_SET_SUP(lks, Autoneg); 3163 + fallthrough; 3164 + case XGBE_PORT_MODE_BACKPLANE_NO_AUTONEG: 3174 3165 XGBE_SET_SUP(lks, Pause); 3175 3166 XGBE_SET_SUP(lks, Asym_Pause); 3176 3167 XGBE_SET_SUP(lks, Backplane);
+1
drivers/net/ethernet/arc/emac_mdio.c
··· 153 153 if (IS_ERR(data->reset_gpio)) { 154 154 error = PTR_ERR(data->reset_gpio); 155 155 dev_err(priv->dev, "Failed to request gpio: %d\n", error); 156 + mdiobus_free(bus); 156 157 return error; 157 158 } 158 159
+4 -2
drivers/net/ethernet/broadcom/bcmsysport.c
··· 2491 2491 priv->tx_rings = devm_kcalloc(&pdev->dev, txq, 2492 2492 sizeof(struct bcm_sysport_tx_ring), 2493 2493 GFP_KERNEL); 2494 - if (!priv->tx_rings) 2495 - return -ENOMEM; 2494 + if (!priv->tx_rings) { 2495 + ret = -ENOMEM; 2496 + goto err_free_netdev; 2497 + } 2496 2498 2497 2499 priv->is_lite = params->is_lite; 2498 2500 priv->num_rx_desc_words = params->num_rx_desc_words;
+59 -31
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 1141 1141 1142 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 1147 if (BNXT_PF(bp)) 1145 1148 queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay); 1146 1149 else ··· 1160 1157 1161 1158 static void bnxt_cancel_sp_work(struct bnxt *bp) 1162 1159 { 1163 - if (BNXT_PF(bp)) 1160 + if (BNXT_PF(bp)) { 1164 1161 flush_workqueue(bnxt_pf_wq); 1165 - else 1162 + } else { 1166 1163 cancel_work_sync(&bp->sp_task); 1164 + cancel_delayed_work_sync(&bp->fw_reset_task); 1165 + } 1167 1166 } 1168 1167 1169 1168 static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr) ··· 6107 6102 return cp + ulp_stat; 6108 6103 } 6109 6104 6105 + /* Check if a default RSS map needs to be setup. This function is only 6106 + * used on older firmware that does not require reserving RX rings. 6107 + */ 6108 + static void bnxt_check_rss_tbl_no_rmgr(struct bnxt *bp) 6109 + { 6110 + struct bnxt_hw_resc *hw_resc = &bp->hw_resc; 6111 + 6112 + /* The RSS map is valid for RX rings set to resv_rx_rings */ 6113 + if (hw_resc->resv_rx_rings != bp->rx_nr_rings) { 6114 + hw_resc->resv_rx_rings = bp->rx_nr_rings; 6115 + if (!netif_is_rxfh_configured(bp->dev)) 6116 + bnxt_set_dflt_rss_indir_tbl(bp); 6117 + } 6118 + } 6119 + 6110 6120 static bool bnxt_need_reserve_rings(struct bnxt *bp) 6111 6121 { 6112 6122 struct bnxt_hw_resc *hw_resc = &bp->hw_resc; ··· 6130 6110 int rx = bp->rx_nr_rings, stat; 6131 6111 int vnic = 1, grp = rx; 6132 6112 6133 - if (bp->hwrm_spec_code < 0x10601) 6134 - return false; 6135 - 6136 - if (hw_resc->resv_tx_rings != bp->tx_nr_rings) 6113 + if (hw_resc->resv_tx_rings != bp->tx_nr_rings && 6114 + bp->hwrm_spec_code >= 0x10601) 6137 6115 return true; 6138 6116 6117 + /* Old firmware does not need RX ring reservations but we still 6118 + * need to setup a default RSS map when needed. With new firmware 6119 + * we go through RX ring reservations first and then set up the 6120 + * RSS map for the successfully reserved RX rings when needed. 6121 + */ 6122 + if (!BNXT_NEW_RM(bp)) { 6123 + bnxt_check_rss_tbl_no_rmgr(bp); 6124 + return false; 6125 + } 6139 6126 if ((bp->flags & BNXT_FLAG_RFS) && !(bp->flags & BNXT_FLAG_CHIP_P5)) 6140 6127 vnic = rx + 1; 6141 6128 if (bp->flags & BNXT_FLAG_AGG_RINGS) 6142 6129 rx <<= 1; 6143 6130 stat = bnxt_get_func_stat_ctxs(bp); 6144 - if (BNXT_NEW_RM(bp) && 6145 - (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp || 6146 - hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat || 6147 - (hw_resc->resv_hw_ring_grps != grp && 6148 - !(bp->flags & BNXT_FLAG_CHIP_P5)))) 6131 + if (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp || 6132 + hw_resc->resv_vnics != vnic || hw_resc->resv_stat_ctxs != stat || 6133 + (hw_resc->resv_hw_ring_grps != grp && 6134 + !(bp->flags & BNXT_FLAG_CHIP_P5))) 6149 6135 return true; 6150 6136 if ((bp->flags & BNXT_FLAG_CHIP_P5) && BNXT_PF(bp) && 6151 6137 hw_resc->resv_irqs != nq) ··· 6239 6213 6240 6214 if (!tx || !rx || !cp || !grp || !vnic || !stat) 6241 6215 return -ENOMEM; 6216 + 6217 + if (!netif_is_rxfh_configured(bp->dev)) 6218 + bnxt_set_dflt_rss_indir_tbl(bp); 6242 6219 6243 6220 return rc; 6244 6221 } ··· 8524 8495 rc = bnxt_init_int_mode(bp); 8525 8496 bnxt_ulp_irq_restart(bp, rc); 8526 8497 } 8527 - if (!netif_is_rxfh_configured(bp->dev)) 8528 - bnxt_set_dflt_rss_indir_tbl(bp); 8529 - 8530 8498 if (rc) { 8531 8499 netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc); 8532 8500 return rc; ··· 9310 9284 struct hwrm_temp_monitor_query_input req = {0}; 9311 9285 struct hwrm_temp_monitor_query_output *resp; 9312 9286 struct bnxt *bp = dev_get_drvdata(dev); 9313 - u32 temp = 0; 9287 + u32 len = 0; 9314 9288 9315 9289 resp = bp->hwrm_cmd_resp_addr; 9316 9290 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1); 9317 9291 mutex_lock(&bp->hwrm_cmd_lock); 9318 - if (!_hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) 9319 - temp = resp->temp * 1000; /* display millidegree */ 9292 + if (!_hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT)) 9293 + len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */ 9320 9294 mutex_unlock(&bp->hwrm_cmd_lock); 9321 9295 9322 - return sprintf(buf, "%u\n", temp); 9296 + if (len) 9297 + return len; 9298 + 9299 + return sprintf(buf, "unknown\n"); 9323 9300 } 9324 9301 static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0); 9325 9302 ··· 9504 9475 } 9505 9476 } 9506 9477 9507 - bnxt_enable_napi(bp); 9508 - bnxt_debug_dev_init(bp); 9509 - 9510 9478 rc = bnxt_init_nic(bp, irq_re_init); 9511 9479 if (rc) { 9512 9480 netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc); 9513 - goto open_err; 9481 + goto open_err_irq; 9514 9482 } 9483 + 9484 + bnxt_enable_napi(bp); 9485 + bnxt_debug_dev_init(bp); 9515 9486 9516 9487 if (link_re_init) { 9517 9488 mutex_lock(&bp->link_lock); ··· 9542 9513 if (BNXT_PF(bp)) 9543 9514 bnxt_vf_reps_open(bp); 9544 9515 return 0; 9545 - 9546 - open_err: 9547 - bnxt_debug_dev_exit(bp); 9548 - bnxt_disable_napi(bp); 9549 9516 9550 9517 open_err_irq: 9551 9518 bnxt_del_napi(bp); ··· 11786 11761 unregister_netdev(dev); 11787 11762 bnxt_dl_unregister(bp); 11788 11763 bnxt_shutdown_tc(bp); 11764 + clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); 11789 11765 bnxt_cancel_sp_work(bp); 11790 11766 bp->sp_event = 0; 11791 11767 ··· 12226 12200 if (BNXT_CHIP_P5(bp)) 12227 12201 bp->flags |= BNXT_FLAG_CHIP_P5; 12228 12202 12203 + rc = bnxt_alloc_rss_indir_tbl(bp); 12204 + if (rc) 12205 + goto init_err_pci_clean; 12206 + 12229 12207 rc = bnxt_fw_init_one_p2(bp); 12230 12208 if (rc) 12231 12209 goto init_err_pci_clean; ··· 12334 12304 */ 12335 12305 bp->tx_nr_rings_per_tc = bp->tx_nr_rings; 12336 12306 12337 - rc = bnxt_alloc_rss_indir_tbl(bp); 12338 - if (rc) 12339 - goto init_err_pci_clean; 12340 - bnxt_set_dflt_rss_indir_tbl(bp); 12341 - 12342 12307 if (BNXT_PF(bp)) { 12343 12308 if (!bnxt_pf_wq) { 12344 12309 bnxt_pf_wq = ··· 12364 12339 (long)pci_resource_start(pdev, 0), dev->dev_addr); 12365 12340 pcie_print_link_status(pdev); 12366 12341 12342 + pci_save_state(pdev); 12367 12343 return 0; 12368 12344 12369 12345 init_err_cleanup: ··· 12562 12536 "Cannot re-enable PCI device after reset.\n"); 12563 12537 } else { 12564 12538 pci_set_master(pdev); 12539 + pci_restore_state(pdev); 12540 + pci_save_state(pdev); 12565 12541 12566 12542 err = bnxt_hwrm_func_reset(bp); 12567 12543 if (!err) {
+6 -10
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
··· 472 472 static int bnxt_get_num_ring_stats(struct bnxt *bp) 473 473 { 474 474 int rx, tx, cmn; 475 - bool sh = false; 476 - 477 - if (bp->flags & BNXT_FLAG_SHARED_RINGS) 478 - sh = true; 479 475 480 476 rx = NUM_RING_RX_HW_STATS + NUM_RING_RX_SW_STATS + 481 477 bnxt_get_num_tpa_ring_stats(bp); 482 478 tx = NUM_RING_TX_HW_STATS; 483 479 cmn = NUM_RING_CMN_SW_STATS; 484 - if (sh) 485 - return (rx + tx + 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; 480 + return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings + 481 + cmn * bp->cp_nr_rings; 489 482 } 490 483 491 484 static int bnxt_get_num_stats(struct bnxt *bp) ··· 799 806 int max_tx_sch_inputs; 800 807 801 808 /* Get the most up-to-date max_tx_sch_inputs. */ 802 - if (BNXT_NEW_RM(bp)) 809 + if (netif_running(dev) && BNXT_NEW_RM(bp)) 803 810 bnxt_hwrm_func_resc_qcaps(bp, false); 804 811 max_tx_sch_inputs = hw_resc->max_tx_sch_inputs; 805 812 ··· 2315 2322 rc = nvm_get_dir_info(dev, &dir_entries, &entry_length); 2316 2323 if (rc != 0) 2317 2324 return rc; 2325 + 2326 + if (!dir_entries || !entry_length) 2327 + return -EIO; 2318 2328 2319 2329 /* Insert 2 bytes of directory info (count and size of entries) */ 2320 2330 if (len < 2)
+1 -1
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 1364 1364 case ETHER_FLOW: 1365 1365 eth_mask = &cmd->fs.m_u.ether_spec; 1366 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 1368 VALIDATE_MASK(eth_mask->h_source) || 1369 1369 VALIDATE_MASK(eth_mask->h_proto)) { 1370 1370 netdev_err(dev, "rxnfc: Unsupported mask\n");
+13 -4
drivers/net/ethernet/broadcom/tg3.c
··· 7221 7221 7222 7222 static inline void tg3_reset_task_cancel(struct tg3 *tp) 7223 7223 { 7224 - cancel_work_sync(&tp->reset_task); 7225 - tg3_flag_clear(tp, RESET_TASK_PENDING); 7224 + if (test_and_clear_bit(TG3_FLAG_RESET_TASK_PENDING, tp->tg3_flags)) 7225 + cancel_work_sync(&tp->reset_task); 7226 7226 tg3_flag_clear(tp, TX_RECOVERY_PENDING); 7227 7227 } 7228 7228 ··· 11209 11209 11210 11210 tg3_halt(tp, RESET_KIND_SHUTDOWN, 0); 11211 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 11221 goto out; 11222 + } 11214 11223 11215 11224 tg3_netif_start(tp); 11216 11225 11217 - out: 11218 11226 tg3_full_unlock(tp); 11219 11227 11220 11228 if (!err) 11221 11229 tg3_phy_start(tp); 11222 11230 11223 11231 tg3_flag_clear(tp, RESET_TASK_PENDING); 11232 + out: 11224 11233 rtnl_unlock(); 11225 11234 } 11226 11235
+6 -2
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c
··· 62 62 int cxgb4_thermal_init(struct adapter *adap) 63 63 { 64 64 struct ch_thermal *ch_thermal = &adap->ch_thermal; 65 + char ch_tz_name[THERMAL_NAME_LENGTH]; 65 66 int num_trip = CXGB4_NUM_TRIPS; 66 67 u32 param, val; 67 68 int ret; ··· 83 82 ch_thermal->trip_type = THERMAL_TRIP_CRITICAL; 84 83 } 85 84 86 - ch_thermal->tzdev = thermal_zone_device_register("cxgb4", num_trip, 85 + snprintf(ch_tz_name, sizeof(ch_tz_name), "cxgb4_%s", adap->name); 86 + ch_thermal->tzdev = thermal_zone_device_register(ch_tz_name, num_trip, 87 87 0, adap, 88 88 &cxgb4_thermal_ops, 89 89 NULL, 0, 0); ··· 107 105 108 106 int cxgb4_thermal_remove(struct adapter *adap) 109 107 { 110 - if (adap->ch_thermal.tzdev) 108 + if (adap->ch_thermal.tzdev) { 111 109 thermal_zone_device_unregister(adap->ch_thermal.tzdev); 110 + adap->ch_thermal.tzdev = NULL; 111 + } 112 112 return 0; 113 113 }
+18 -18
drivers/net/ethernet/cortina/gemini.c
··· 2446 2446 port->reset = devm_reset_control_get_exclusive(dev, NULL); 2447 2447 if (IS_ERR(port->reset)) { 2448 2448 dev_err(dev, "no reset\n"); 2449 - clk_disable_unprepare(port->pclk); 2450 - return PTR_ERR(port->reset); 2449 + ret = PTR_ERR(port->reset); 2450 + goto unprepare; 2451 2451 } 2452 2452 reset_control_reset(port->reset); 2453 2453 usleep_range(100, 500); ··· 2502 2502 IRQF_SHARED, 2503 2503 port_names[port->id], 2504 2504 port); 2505 - if (ret) { 2506 - clk_disable_unprepare(port->pclk); 2507 - return ret; 2508 - } 2505 + if (ret) 2506 + goto unprepare; 2509 2507 2510 2508 ret = register_netdev(netdev); 2511 - if (!ret) { 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) 2518 - netdev_info(netdev, 2519 - "PHY init failed, deferring to ifup time\n"); 2520 - return 0; 2521 - } 2509 + if (ret) 2510 + goto unprepare; 2522 2511 2523 - port->netdev = NULL; 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) 2518 + netdev_info(netdev, 2519 + "PHY init failed, deferring to ifup time\n"); 2520 + return 0; 2521 + 2522 + unprepare: 2523 + clk_disable_unprepare(port->pclk); 2524 2524 return ret; 2525 2525 } 2526 2526
+6 -3
drivers/net/ethernet/hisilicon/hns/hns_enet.c
··· 2282 2282 priv->enet_ver = AE_VERSION_1; 2283 2283 else if (acpi_dev_found(hns_enet_acpi_match[1].id)) 2284 2284 priv->enet_ver = AE_VERSION_2; 2285 - else 2286 - return -ENXIO; 2285 + else { 2286 + ret = -ENXIO; 2287 + goto out_read_prop_fail; 2288 + } 2287 2289 2288 2290 /* try to find port-idx-in-ae first */ 2289 2291 ret = acpi_node_get_property_reference(dev->fwnode, ··· 2301 2299 priv->fwnode = args.fwnode; 2302 2300 } else { 2303 2301 dev_err(dev, "cannot read cfg data from OF or acpi\n"); 2304 - return -ENXIO; 2302 + ret = -ENXIO; 2303 + goto out_read_prop_fail; 2305 2304 } 2306 2305 2307 2306 ret = device_property_read_u32(dev, "port-idx-in-ae", &port_id);
+4 -2
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 21 21 #include <net/pkt_cls.h> 22 22 #include <net/tcp.h> 23 23 #include <net/vxlan.h> 24 + #include <net/geneve.h> 24 25 25 26 #include "hnae3.h" 26 27 #include "hns3_enet.h" ··· 781 780 * and it is udp packet, which has a dest port as the IANA assigned. 782 781 * the hardware is expected to do the checksum offload, but the 783 782 * hardware will not do the checksum offload when udp dest port is 784 - * 4789. 783 + * 4789 or 6081. 785 784 */ 786 785 static bool hns3_tunnel_csum_bug(struct sk_buff *skb) 787 786 { ··· 790 789 l4.hdr = skb_transport_header(skb); 791 790 792 791 if (!(!skb->encapsulation && 793 - l4.udp->dest == htons(IANA_VXLAN_UDP_PORT))) 792 + (l4.udp->dest == htons(IANA_VXLAN_UDP_PORT) || 793 + l4.udp->dest == htons(GENEVE_UDP_PORT)))) 794 794 return false; 795 795 796 796 skb_checksum_help(skb);
+14 -1
drivers/net/ethernet/ibm/ibmvnic.c
··· 479 479 int i, j, rc; 480 480 u64 *size_array; 481 481 482 + if (!adapter->rx_pool) 483 + return -1; 484 + 482 485 size_array = (u64 *)((u8 *)(adapter->login_rsp_buf) + 483 486 be32_to_cpu(adapter->login_rsp_buf->off_rxadd_buff_size)); 484 487 ··· 651 648 { 652 649 int tx_scrqs; 653 650 int i, rc; 651 + 652 + if (!adapter->tx_pool) 653 + return -1; 654 654 655 655 tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); 656 656 for (i = 0; i < tx_scrqs; i++) { ··· 2017 2011 adapter->req_rx_add_entries_per_subcrq != 2018 2012 old_num_rx_slots || 2019 2013 adapter->req_tx_entries_per_subcrq != 2020 - old_num_tx_slots) { 2014 + old_num_tx_slots || 2015 + !adapter->rx_pool || 2016 + !adapter->tso_pool || 2017 + !adapter->tx_pool) { 2021 2018 release_rx_pools(adapter); 2022 2019 release_tx_pools(adapter); 2023 2020 release_napi(adapter); ··· 2033 2024 } else { 2034 2025 rc = reset_tx_pools(adapter); 2035 2026 if (rc) 2027 + netdev_dbg(adapter->netdev, "reset tx pools failed (%d)\n", 2028 + rc); 2036 2029 goto out; 2037 2030 2038 2031 rc = reset_rx_pools(adapter); 2039 2032 if (rc) 2033 + netdev_dbg(adapter->netdev, "reset rx pools failed (%d)\n", 2034 + rc); 2040 2035 goto out; 2041 2036 } 2042 2037 ibmvnic_disable_irqs(adapter);
+1 -1
drivers/net/ethernet/mellanox/mlx4/mr.c
··· 114 114 goto err_out; 115 115 116 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 118 buddy->bits[i] = kvmalloc_array(s, sizeof(long), GFP_KERNEL | __GFP_ZERO); 119 119 if (!buddy->bits[i]) 120 120 goto err_out_free;
+4 -27
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c
··· 130 130 return mlx5e_ethtool_flash_device(priv, flash); 131 131 } 132 132 133 - enum mlx5_ptys_width { 134 - MLX5_PTYS_WIDTH_1X = 1 << 0, 135 - MLX5_PTYS_WIDTH_2X = 1 << 1, 136 - MLX5_PTYS_WIDTH_4X = 1 << 2, 137 - MLX5_PTYS_WIDTH_8X = 1 << 3, 138 - MLX5_PTYS_WIDTH_12X = 1 << 4, 139 - }; 140 - 141 133 static inline int mlx5_ptys_width_enum_to_int(enum mlx5_ptys_width width) 142 134 { 143 135 switch (width) { ··· 166 174 } 167 175 } 168 176 169 - static int mlx5i_get_port_settings(struct net_device *netdev, 170 - u16 *ib_link_width_oper, u16 *ib_proto_oper) 171 - { 172 - struct mlx5e_priv *priv = mlx5i_epriv(netdev); 173 - struct mlx5_core_dev *mdev = priv->mdev; 174 - u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0}; 175 - int ret; 176 - 177 - ret = mlx5_query_port_ptys(mdev, out, sizeof(out), MLX5_PTYS_IB, 1); 178 - if (ret) 179 - return ret; 180 - 181 - *ib_link_width_oper = MLX5_GET(ptys_reg, out, ib_link_width_oper); 182 - *ib_proto_oper = MLX5_GET(ptys_reg, out, ib_proto_oper); 183 - 184 - return 0; 185 - } 186 - 187 177 static int mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper) 188 178 { 189 179 int rate, width; ··· 183 209 static int mlx5i_get_link_ksettings(struct net_device *netdev, 184 210 struct ethtool_link_ksettings *link_ksettings) 185 211 { 212 + struct mlx5e_priv *priv = mlx5i_epriv(netdev); 213 + struct mlx5_core_dev *mdev = priv->mdev; 186 214 u16 ib_link_width_oper; 187 215 u16 ib_proto_oper; 188 216 int speed, ret; 189 217 190 - ret = mlx5i_get_port_settings(netdev, &ib_link_width_oper, &ib_proto_oper); 218 + ret = mlx5_query_ib_port_oper(mdev, &ib_link_width_oper, &ib_proto_oper, 219 + 1); 191 220 if (ret) 192 221 return ret; 193 222
+4 -19
drivers/net/ethernet/mellanox/mlx5/core/port.c
··· 154 154 sizeof(out), MLX5_REG_MLCR, 0, 1); 155 155 } 156 156 157 - int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev, 158 - u8 *link_width_oper, u8 local_port) 159 - { 160 - u32 out[MLX5_ST_SZ_DW(ptys_reg)]; 161 - int err; 162 - 163 - err = mlx5_query_port_ptys(dev, out, sizeof(out), MLX5_PTYS_IB, local_port); 164 - if (err) 165 - return err; 166 - 167 - *link_width_oper = MLX5_GET(ptys_reg, out, ib_link_width_oper); 168 - 169 - return 0; 170 - } 171 - EXPORT_SYMBOL_GPL(mlx5_query_port_link_width_oper); 172 - 173 - int mlx5_query_port_ib_proto_oper(struct mlx5_core_dev *dev, 174 - u8 *proto_oper, u8 local_port) 157 + int mlx5_query_ib_port_oper(struct mlx5_core_dev *dev, u16 *link_width_oper, 158 + u16 *proto_oper, u8 local_port) 175 159 { 176 160 u32 out[MLX5_ST_SZ_DW(ptys_reg)]; 177 161 int err; ··· 165 181 if (err) 166 182 return err; 167 183 184 + *link_width_oper = MLX5_GET(ptys_reg, out, ib_link_width_oper); 168 185 *proto_oper = MLX5_GET(ptys_reg, out, ib_proto_oper); 169 186 170 187 return 0; 171 188 } 172 - EXPORT_SYMBOL(mlx5_query_port_ib_proto_oper); 189 + EXPORT_SYMBOL(mlx5_query_ib_port_oper); 173 190 174 191 /* This function should be used after setting a port register only */ 175 192 void mlx5_toggle_port_link(struct mlx5_core_dev *dev)
+2
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
··· 61 61 * @flags: options part of the request 62 62 * @tun_info.ipv6: dest IPv6 address of active route 63 63 * @tun_info.egress_port: port the encapsulated packet egressed 64 + * @tun_info.extra: reserved for future use 64 65 * @tun_info: tunnels that have sent traffic in reported period 65 66 */ 66 67 struct nfp_tun_active_tuns_v6 { ··· 71 70 struct route_ip_info_v6 { 72 71 struct in6_addr ipv6; 73 72 __be32 egress_port; 73 + __be32 extra[2]; 74 74 } tun_info[]; 75 75 }; 76 76
+3 -10
drivers/net/ethernet/pensando/ionic/ionic_txrx.c
··· 496 496 struct ionic_cq *txcq; 497 497 u32 rx_work_done = 0; 498 498 u32 tx_work_done = 0; 499 - u32 work_done = 0; 500 499 u32 flags = 0; 501 - bool unmask; 502 500 503 501 lif = rxcq->bound_q->lif; 504 502 idev = &lif->ionic->idev; ··· 510 512 if (rx_work_done) 511 513 ionic_rx_fill_cb(rxcq->bound_q); 512 514 513 - unmask = (rx_work_done < budget) && (tx_work_done < lif->tx_budget); 514 - 515 - if (unmask && napi_complete_done(napi, rx_work_done)) { 515 + if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) { 516 516 flags |= IONIC_INTR_CRED_UNMASK; 517 517 DEBUG_STATS_INTR_REARM(rxcq->bound_intr); 518 - work_done = rx_work_done; 519 - } else { 520 - work_done = budget; 521 518 } 522 519 523 - if (work_done || flags) { 520 + if (rx_work_done || flags) { 524 521 flags |= IONIC_INTR_CRED_RESET_COALESCE; 525 522 ionic_intr_credits(idev->intr_ctrl, rxcq->bound_intr->index, 526 523 tx_work_done + rx_work_done, flags); ··· 524 531 DEBUG_STATS_NAPI_POLL(qcq, rx_work_done); 525 532 DEBUG_STATS_NAPI_POLL(qcq, tx_work_done); 526 533 527 - return work_done; 534 + return rx_work_done; 528 535 } 529 536 530 537 static dma_addr_t ionic_tx_map_single(struct ionic_queue *q,
+55 -55
drivers/net/ethernet/renesas/ravb_main.c
··· 1342 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 1390 /* Network device open function for Ethernet AVB */ 1346 1391 static int ravb_open(struct net_device *ndev) 1347 1392 { ··· 1394 1349 struct platform_device *pdev = priv->pdev; 1395 1350 struct device *dev = &pdev->dev; 1396 1351 int error; 1352 + 1353 + /* MDIO bus init */ 1354 + error = ravb_mdio_init(priv); 1355 + if (error) { 1356 + netdev_err(ndev, "failed to initialize MDIO\n"); 1357 + return error; 1358 + } 1397 1359 1398 1360 napi_enable(&priv->napi[RAVB_BE]); 1399 1361 napi_enable(&priv->napi[RAVB_NC]); ··· 1479 1427 out_napi_off: 1480 1428 napi_disable(&priv->napi[RAVB_NC]); 1481 1429 napi_disable(&priv->napi[RAVB_BE]); 1430 + ravb_mdio_release(priv); 1482 1431 return error; 1483 1432 } 1484 1433 ··· 1789 1736 ravb_ring_free(ndev, RAVB_BE); 1790 1737 ravb_ring_free(ndev, RAVB_NC); 1791 1738 1739 + ravb_mdio_release(priv); 1740 + 1792 1741 return 0; 1793 1742 } 1794 1743 ··· 1941 1886 .ndo_set_mac_address = eth_mac_addr, 1942 1887 .ndo_set_features = ravb_set_features, 1943 1888 }; 1944 - 1945 - /* MDIO bus init function */ 1946 - static int ravb_mdio_init(struct ravb_private *priv) 1947 - { 1948 - struct platform_device *pdev = priv->pdev; 1949 - struct device *dev = &pdev->dev; 1950 - int error; 1951 - 1952 - /* Bitbang init */ 1953 - priv->mdiobb.ops = &bb_ops; 1954 - 1955 - /* MII controller setting */ 1956 - priv->mii_bus = alloc_mdio_bitbang(&priv->mdiobb); 1957 - if (!priv->mii_bus) 1958 - return -ENOMEM; 1959 - 1960 - /* Hook up MII support for ethtool */ 1961 - priv->mii_bus->name = "ravb_mii"; 1962 - priv->mii_bus->parent = dev; 1963 - snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", 1964 - pdev->name, pdev->id); 1965 - 1966 - /* Register MDIO bus */ 1967 - error = of_mdiobus_register(priv->mii_bus, dev->of_node); 1968 - if (error) 1969 - goto out_free_bus; 1970 - 1971 - return 0; 1972 - 1973 - out_free_bus: 1974 - free_mdio_bitbang(priv->mii_bus); 1975 - return error; 1976 - } 1977 - 1978 - /* MDIO bus release function */ 1979 - static int ravb_mdio_release(struct ravb_private *priv) 1980 - { 1981 - /* Unregister mdio bus */ 1982 - mdiobus_unregister(priv->mii_bus); 1983 - 1984 - /* Free bitbang info */ 1985 - free_mdio_bitbang(priv->mii_bus); 1986 - 1987 - return 0; 1988 - } 1989 1889 1990 1890 static const struct of_device_id ravb_match_table[] = { 1991 1891 { .compatible = "renesas,etheravb-r8a7790", .data = (void *)RCAR_GEN2 }, ··· 2184 2174 eth_hw_addr_random(ndev); 2185 2175 } 2186 2176 2187 - /* MDIO bus init */ 2188 - error = ravb_mdio_init(priv); 2189 - if (error) { 2190 - dev_err(&pdev->dev, "failed to initialize MDIO\n"); 2191 - goto out_dma_free; 2192 - } 2193 - 2194 2177 netif_napi_add(ndev, &priv->napi[RAVB_BE], ravb_poll, 64); 2195 2178 netif_napi_add(ndev, &priv->napi[RAVB_NC], ravb_poll, 64); 2196 2179 ··· 2205 2202 out_napi_del: 2206 2203 netif_napi_del(&priv->napi[RAVB_NC]); 2207 2204 netif_napi_del(&priv->napi[RAVB_BE]); 2208 - ravb_mdio_release(priv); 2209 - out_dma_free: 2210 2205 dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, 2211 2206 priv->desc_bat_dma); 2212 2207 ··· 2236 2235 unregister_netdev(ndev); 2237 2236 netif_napi_del(&priv->napi[RAVB_NC]); 2238 2237 netif_napi_del(&priv->napi[RAVB_BE]); 2239 - ravb_mdio_release(priv); 2240 2238 pm_runtime_disable(&pdev->dev); 2241 2239 free_netdev(ndev); 2242 2240 platform_set_drvdata(pdev, NULL);
+4 -4
drivers/net/ethernet/sfc/ef100_rx.c
··· 36 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 41 u16 rxclass; 42 42 u8 l2status; ··· 46 46 47 47 if (likely(l2status == ESE_GZ_RH_HCLASS_L2_STATUS_OK)) 48 48 /* Everything is ok */ 49 - return 0; 49 + return false; 50 50 51 51 if (l2status == ESE_GZ_RH_HCLASS_L2_STATUS_FCS_ERR) 52 52 channel->n_rx_eth_crc_err++; 53 - return 1; 53 + return true; 54 54 } 55 55 56 56 void __ef100_rx_packet(struct efx_channel *channel) ··· 63 63 64 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 67 unlikely(!(efx->net_dev->features & NETIF_F_RXALL))) 68 68 goto out; 69 69
+2
drivers/net/ethernet/ti/am65-cpsw-nuss.c
··· 174 174 if (phy->speed == 10 && phy_interface_is_rgmii(phy)) 175 175 /* Can be used with in band mode only */ 176 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 179 if (phy->duplex) 178 180 mac_control |= CPSW_SL_CTL_FULLDUPLEX; 179 181
+1 -1
drivers/net/ethernet/ti/cpsw.c
··· 1116 1116 HOST_PORT_NUM, ALE_VLAN, vid); 1117 1117 ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, 1118 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 1120 err: 1121 1121 pm_runtime_put(cpsw->dev); 1122 1122 return ret;
+22 -7
drivers/net/ethernet/ti/cpsw_new.c
··· 1032 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 1039 for (i = 0; i < cpsw->data.slaves; i++) { 1036 1040 if (cpsw->slaves[i].ndev && 1037 - vid == cpsw->slaves[i].port_vlan) 1041 + vid == cpsw->slaves[i].port_vlan) { 1042 + ret = -EINVAL; 1038 1043 goto err; 1044 + } 1039 1045 } 1040 1046 1041 1047 dev_dbg(priv->dev, "removing vlanid %d from vlan filter\n", vid); 1042 - cpsw_ale_del_vlan(cpsw->ale, vid, 0); 1043 - cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr, 1044 - HOST_PORT_NUM, ALE_VLAN, vid); 1045 - cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, 1046 - 0, ALE_VLAN, vid); 1047 - cpsw_ale_flush_multicast(cpsw->ale, 0, vid); 1048 + ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0); 1049 + if (ret) 1050 + dev_err(priv->dev, "cpsw_ale_del_vlan() failed: ret %d\n", ret); 1051 + ret = cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr, 1052 + HOST_PORT_NUM, ALE_VLAN, 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 1063 err: 1049 1064 pm_runtime_put(cpsw->dev); 1050 1065 return ret;
+1
drivers/net/gtp.c
··· 1179 1179 goto nlmsg_failure; 1180 1180 1181 1181 if (nla_put_u32(skb, GTPA_VERSION, pctx->gtp_version) || 1182 + nla_put_u32(skb, GTPA_LINK, pctx->dev->ifindex) || 1182 1183 nla_put_be32(skb, GTPA_PEER_ADDRESS, pctx->peer_addr_ip4.s_addr) || 1183 1184 nla_put_be32(skb, GTPA_MS_ADDRESS, pctx->ms_addr_ip4.s_addr)) 1184 1185 goto nla_put_failure;
+2 -2
drivers/net/phy/dp83867.c
··· 215 215 if (wol->wolopts & WAKE_MAGICSECURE) { 216 216 phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_RXFSOP1, 217 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 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 221 (wol->sopass[5] << 8) | wol->sopass[4]); 222 222 223 223 val_rxcfg |= DP83867_WOL_SEC_EN;
+6 -6
drivers/net/phy/dp83869.c
··· 427 427 return ret; 428 428 429 429 val = phy_read_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL); 430 - val &= ~(DP83869_RGMII_TX_CLK_DELAY_EN | 431 - DP83869_RGMII_RX_CLK_DELAY_EN); 430 + val |= (DP83869_RGMII_TX_CLK_DELAY_EN | 431 + DP83869_RGMII_RX_CLK_DELAY_EN); 432 432 433 433 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) 434 - val |= (DP83869_RGMII_TX_CLK_DELAY_EN | 435 - DP83869_RGMII_RX_CLK_DELAY_EN); 434 + val &= ~(DP83869_RGMII_TX_CLK_DELAY_EN | 435 + DP83869_RGMII_RX_CLK_DELAY_EN); 436 436 437 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 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 443 ret = phy_write_mmd(phydev, DP83869_DEVADDR, DP83869_RGMIICTL, 444 444 val);
+1
drivers/net/usb/Kconfig
··· 252 252 config USB_NET_CDC_NCM 253 253 tristate "CDC NCM support" 254 254 depends on USB_USBNET 255 + select USB_NET_CDCETHER 255 256 default y 256 257 help 257 258 This driver provides support for CDC NCM (Network Control Model
+1 -1
drivers/net/usb/asix_common.c
··· 296 296 297 297 netdev_dbg(dev->net, "asix_get_phy_addr()\n"); 298 298 299 - if (ret < 0) { 299 + if (ret < 2) { 300 300 netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret); 301 301 goto out; 302 302 }
+4
drivers/net/usb/dm9601.c
··· 625 625 USB_DEVICE(0x0a46, 0x1269), /* DM9621A USB to Fast Ethernet Adapter */ 626 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 632 {}, // END 629 633 }; 630 634
+1 -1
drivers/net/wan/hdlc.c
··· 229 229 dev->min_mtu = 68; 230 230 dev->max_mtu = HDLC_MAX_MTU; 231 231 dev->type = ARPHRD_RAWHDLC; 232 - dev->hard_header_len = 16; 232 + dev->hard_header_len = 0; 233 233 dev->needed_headroom = 0; 234 234 dev->addr_len = 0; 235 235 dev->header_ops = &hdlc_null_ops;
+1
drivers/net/wan/hdlc_cisco.c
··· 370 370 memcpy(&state(hdlc)->settings, &new_settings, size); 371 371 spin_lock_init(&state(hdlc)->lock); 372 372 dev->header_ops = &cisco_header_ops; 373 + dev->hard_header_len = sizeof(struct hdlc_header); 373 374 dev->type = ARPHRD_CISCO; 374 375 call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev); 375 376 netif_dormant_on(dev);
+3
drivers/net/wan/lapbether.c
··· 210 210 211 211 skb->dev = dev = lapbeth->ethdev; 212 212 213 + skb_reset_network_header(skb); 214 + 213 215 dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0); 214 216 215 217 dev_queue_xmit(skb); ··· 342 340 */ 343 341 ndev->needed_headroom = -1 + 3 + 2 + dev->hard_header_len 344 342 + dev->needed_headroom; 343 + ndev->needed_tailroom = dev->needed_tailroom; 345 344 346 345 lapbeth = netdev_priv(ndev); 347 346 lapbeth->axdev = ndev;
+1 -1
drivers/nfc/st95hf/core.c
··· 966 966 rc = down_killable(&stcontext->exchange_lock); 967 967 if (rc) { 968 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 972 rc = st95hf_spi_send(&stcontext->spicontext, skb->data,
+45 -16
drivers/nvme/host/core.c
··· 2026 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 2066 static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) 2030 2067 { 2031 2068 unsigned lbaf = id->flbas & NVME_NS_FLBAS_LBA_MASK; 2032 2069 struct nvme_ns *ns = disk->private_data; 2033 2070 struct nvme_ctrl *ctrl = ns->ctrl; 2034 2071 int ret; 2035 - u32 iob; 2036 2072 2037 2073 /* 2038 2074 * If identify namespace failed, use default 512 byte block size so ··· 2095 2059 ns->head->ids.csi, ns->head->ns_id); 2096 2060 return -ENODEV; 2097 2061 } 2098 - 2099 - if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && 2100 - is_power_of_2(ctrl->max_hw_sectors)) 2101 - iob = ctrl->max_hw_sectors; 2102 - else 2103 - iob = nvme_lba_to_sect(ns, le16_to_cpu(id->noiob)); 2104 2062 2105 2063 ns->features = 0; 2106 2064 ns->ms = le16_to_cpu(id->lbaf[lbaf].ms); ··· 2127 2097 } 2128 2098 } 2129 2099 2130 - if (iob && !blk_queue_is_zoned(ns->queue)) 2131 - blk_queue_chunk_sectors(ns->queue, rounddown_pow_of_two(iob)); 2100 + nvme_set_chunk_sectors(ns, id); 2132 2101 nvme_update_disk_info(disk, ns, id); 2133 2102 #ifdef CONFIG_NVME_MULTIPATH 2134 2103 if (ns->head->disk) { ··· 3525 3496 { 3526 3497 struct nvme_ctrl *ctrl = dev_get_drvdata(dev); 3527 3498 3528 - /* Can't delete non-created controllers */ 3529 - if (!ctrl->created) 3530 - return -EBUSY; 3531 - 3532 3499 if (device_remove_file_self(dev, attr)) 3533 3500 nvme_delete_ctrl_sync(ctrl); 3534 3501 return count; ··· 3700 3675 if (a == &dev_attr_hostnqn.attr && !ctrl->opts) 3701 3676 return 0; 3702 3677 if (a == &dev_attr_hostid.attr && !ctrl->opts) 3678 + return 0; 3679 + if (a == &dev_attr_ctrl_loss_tmo.attr && !ctrl->opts) 3680 + return 0; 3681 + if (a == &dev_attr_reconnect_delay.attr && !ctrl->opts) 3703 3682 return 0; 3704 3683 3705 3684 return a->mode; ··· 4399 4370 nvme_queue_scan(ctrl); 4400 4371 nvme_start_queues(ctrl); 4401 4372 } 4402 - ctrl->created = true; 4403 4373 } 4404 4374 EXPORT_SYMBOL_GPL(nvme_start_ctrl); 4405 4375 ··· 4418 4390 struct nvme_subsystem *subsys = ctrl->subsys; 4419 4391 struct nvme_cel *cel, *next; 4420 4392 4421 - if (subsys && ctrl->instance != subsys->instance) 4393 + if (!subsys || ctrl->instance != subsys->instance) 4422 4394 ida_simple_remove(&nvme_instance_ida, ctrl->instance); 4423 4395 4424 4396 list_for_each_entry_safe(cel, next, &ctrl->cels, entry) { ··· 4562 4534 } 4563 4535 EXPORT_SYMBOL_GPL(nvme_unfreeze); 4564 4536 4565 - void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) 4537 + int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) 4566 4538 { 4567 4539 struct nvme_ns *ns; 4568 4540 ··· 4573 4545 break; 4574 4546 } 4575 4547 up_read(&ctrl->namespaces_rwsem); 4548 + return timeout; 4576 4549 } 4577 4550 EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout); 4578 4551
+8 -5
drivers/nvme/host/fabrics.c
··· 565 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 569 - * internally generated commands. 568 + * currently we have a problem sending passthru 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 576 return false; 573 577 574 578 /* ··· 580 576 * which is require to set the queue live in the appropinquate states. 581 577 */ 582 578 switch (ctrl->state) { 583 - case NVME_CTRL_NEW: 584 579 case NVME_CTRL_CONNECTING: 585 - if (nvme_is_fabrics(req->cmd) && 580 + if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) && 586 581 req->cmd->fabrics.fctype == nvme_fabrics_type_connect) 587 582 return true; 588 583 break;
+1
drivers/nvme/host/fc.c
··· 2160 2160 struct nvme_fc_fcp_op *aen_op; 2161 2161 int i; 2162 2162 2163 + cancel_work_sync(&ctrl->ctrl.async_event_work); 2163 2164 aen_op = ctrl->aen_ops; 2164 2165 for (i = 0; i < NVME_NR_AEN_COMMANDS; i++, aen_op++) { 2165 2166 __nvme_fc_exit_request(ctrl, aen_op);
+1 -2
drivers/nvme/host/nvme.h
··· 307 307 struct nvme_command ka_cmd; 308 308 struct work_struct fw_act_work; 309 309 unsigned long events; 310 - bool created; 311 310 312 311 #ifdef CONFIG_NVME_MULTIPATH 313 312 /* asymmetric namespace access: */ ··· 604 605 void nvme_sync_queues(struct nvme_ctrl *ctrl); 605 606 void nvme_unfreeze(struct nvme_ctrl *ctrl); 606 607 void nvme_wait_freeze(struct nvme_ctrl *ctrl); 607 - void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); 608 + int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout); 608 609 void nvme_start_freeze(struct nvme_ctrl *ctrl); 609 610 610 611 #define NVME_QID_ANY -1
+2 -2
drivers/nvme/host/pci.c
··· 1249 1249 dev_warn_ratelimited(dev->ctrl.device, 1250 1250 "I/O %d QID %d timeout, disable controller\n", 1251 1251 req->tag, nvmeq->qid); 1252 - nvme_dev_disable(dev, true); 1253 1252 nvme_req(req)->flags |= NVME_REQ_CANCELLED; 1253 + nvme_dev_disable(dev, true); 1254 1254 return BLK_EH_DONE; 1255 1255 case NVME_CTRL_RESETTING: 1256 1256 return BLK_EH_RESET_TIMER; ··· 1267 1267 dev_warn(dev->ctrl.device, 1268 1268 "I/O %d QID %d timeout, reset controller\n", 1269 1269 req->tag, nvmeq->qid); 1270 + nvme_req(req)->flags |= NVME_REQ_CANCELLED; 1270 1271 nvme_dev_disable(dev, false); 1271 1272 nvme_reset_ctrl(&dev->ctrl); 1272 1273 1273 - nvme_req(req)->flags |= NVME_REQ_CANCELLED; 1274 1274 return BLK_EH_DONE; 1275 1275 } 1276 1276
+52 -17
drivers/nvme/host/rdma.c
··· 122 122 struct sockaddr_storage src_addr; 123 123 124 124 struct nvme_ctrl ctrl; 125 + struct mutex teardown_lock; 125 126 bool use_inline_data; 126 127 u32 io_queues[HCTX_MAX_TYPES]; 127 128 }; ··· 835 834 blk_mq_free_tag_set(ctrl->ctrl.admin_tagset); 836 835 } 837 836 if (ctrl->async_event_sqe.data) { 837 + cancel_work_sync(&ctrl->ctrl.async_event_work); 838 838 nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe, 839 839 sizeof(struct nvme_command), DMA_TO_DEVICE); 840 840 ctrl->async_event_sqe.data = NULL; ··· 977 975 978 976 if (!new) { 979 977 nvme_start_queues(&ctrl->ctrl); 980 - nvme_wait_freeze(&ctrl->ctrl); 978 + if (!nvme_wait_freeze_timeout(&ctrl->ctrl, NVME_IO_TIMEOUT)) { 979 + /* 980 + * If we timed out waiting for freeze we are likely to 981 + * be stuck. Fail the controller initialization just 982 + * to be safe. 983 + */ 984 + ret = -ENODEV; 985 + goto out_wait_freeze_timed_out; 986 + } 981 987 blk_mq_update_nr_hw_queues(ctrl->ctrl.tagset, 982 988 ctrl->ctrl.queue_count - 1); 983 989 nvme_unfreeze(&ctrl->ctrl); ··· 993 983 994 984 return 0; 995 985 986 + out_wait_freeze_timed_out: 987 + nvme_stop_queues(&ctrl->ctrl); 988 + nvme_rdma_stop_io_queues(ctrl); 996 989 out_cleanup_connect_q: 997 990 if (new) 998 991 blk_cleanup_queue(ctrl->ctrl.connect_q); ··· 1010 997 static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, 1011 998 bool remove) 1012 999 { 1000 + mutex_lock(&ctrl->teardown_lock); 1013 1001 blk_mq_quiesce_queue(ctrl->ctrl.admin_q); 1014 1002 nvme_rdma_stop_queue(&ctrl->queues[0]); 1015 1003 if (ctrl->ctrl.admin_tagset) { ··· 1021 1007 if (remove) 1022 1008 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); 1023 1009 nvme_rdma_destroy_admin_queue(ctrl, remove); 1010 + mutex_unlock(&ctrl->teardown_lock); 1024 1011 } 1025 1012 1026 1013 static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, 1027 1014 bool remove) 1028 1015 { 1016 + mutex_lock(&ctrl->teardown_lock); 1029 1017 if (ctrl->ctrl.queue_count > 1) { 1030 1018 nvme_start_freeze(&ctrl->ctrl); 1031 1019 nvme_stop_queues(&ctrl->ctrl); ··· 1041 1025 nvme_start_queues(&ctrl->ctrl); 1042 1026 nvme_rdma_destroy_io_queues(ctrl, remove); 1043 1027 } 1028 + mutex_unlock(&ctrl->teardown_lock); 1044 1029 } 1045 1030 1046 1031 static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) ··· 1197 1180 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING)) 1198 1181 return; 1199 1182 1183 + dev_warn(ctrl->ctrl.device, "starting error recovery\n"); 1200 1184 queue_work(nvme_reset_wq, &ctrl->err_work); 1201 1185 } 1202 1186 ··· 1964 1946 return 0; 1965 1947 } 1966 1948 1949 + static void nvme_rdma_complete_timed_out(struct request *rq) 1950 + { 1951 + struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); 1952 + struct nvme_rdma_queue *queue = req->queue; 1953 + struct nvme_rdma_ctrl *ctrl = queue->ctrl; 1954 + 1955 + /* fence other contexts that may complete the command */ 1956 + mutex_lock(&ctrl->teardown_lock); 1957 + nvme_rdma_stop_queue(queue); 1958 + if (!blk_mq_request_completed(rq)) { 1959 + nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; 1960 + blk_mq_complete_request(rq); 1961 + } 1962 + mutex_unlock(&ctrl->teardown_lock); 1963 + } 1964 + 1967 1965 static enum blk_eh_timer_return 1968 1966 nvme_rdma_timeout(struct request *rq, bool reserved) 1969 1967 { ··· 1990 1956 dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", 1991 1957 rq->tag, nvme_rdma_queue_idx(queue)); 1992 1958 1993 - /* 1994 - * Restart the timer if a controller reset is already scheduled. Any 1995 - * timed out commands would be handled before entering the connecting 1996 - * state. 1997 - */ 1998 - if (ctrl->ctrl.state == NVME_CTRL_RESETTING) 1999 - return BLK_EH_RESET_TIMER; 2000 - 2001 1959 if (ctrl->ctrl.state != NVME_CTRL_LIVE) { 2002 1960 /* 2003 - * Teardown immediately if controller times out while starting 2004 - * or we are already started error recovery. all outstanding 2005 - * requests are completed on shutdown, so we return BLK_EH_DONE. 1961 + * If we are resetting, connecting or deleting we should 1962 + * complete immediately because we may block controller 1963 + * teardown or setup sequence 1964 + * - ctrl disable/shutdown fabrics requests 1965 + * - connect requests 1966 + * - initialization admin requests 1967 + * - I/O requests that entered after unquiescing and 1968 + * the controller stopped responding 1969 + * 1970 + * All other requests should be cancelled by the error 1971 + * recovery work, so it's fine that we fail it here. 2006 1972 */ 2007 - flush_work(&ctrl->err_work); 2008 - nvme_rdma_teardown_io_queues(ctrl, false); 2009 - nvme_rdma_teardown_admin_queue(ctrl, false); 1973 + nvme_rdma_complete_timed_out(rq); 2010 1974 return BLK_EH_DONE; 2011 1975 } 2012 1976 2013 - dev_warn(ctrl->ctrl.device, "starting error recovery\n"); 1977 + /* 1978 + * LIVE state should trigger the normal error recovery which will 1979 + * handle completing this request. 1980 + */ 2014 1981 nvme_rdma_error_recovery(ctrl); 2015 - 2016 1982 return BLK_EH_RESET_TIMER; 2017 1983 } 2018 1984 ··· 2312 2278 return ERR_PTR(-ENOMEM); 2313 2279 ctrl->ctrl.opts = opts; 2314 2280 INIT_LIST_HEAD(&ctrl->list); 2281 + mutex_init(&ctrl->teardown_lock); 2315 2282 2316 2283 if (!(opts->mask & NVMF_OPT_TRSVCID)) { 2317 2284 opts->trsvcid =
+58 -23
drivers/nvme/host/tcp.c
··· 124 124 struct sockaddr_storage src_addr; 125 125 struct nvme_ctrl ctrl; 126 126 127 + struct mutex teardown_lock; 127 128 struct work_struct err_work; 128 129 struct delayed_work connect_work; 129 130 struct nvme_tcp_request async_req; ··· 465 464 if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING)) 466 465 return; 467 466 467 + dev_warn(ctrl->device, "starting error recovery\n"); 468 468 queue_work(nvme_reset_wq, &to_tcp_ctrl(ctrl)->err_work); 469 469 } 470 470 ··· 1528 1526 1529 1527 if (!test_and_clear_bit(NVME_TCP_Q_LIVE, &queue->flags)) 1530 1528 return; 1531 - 1532 1529 __nvme_tcp_stop_queue(queue); 1533 1530 } 1534 1531 ··· 1596 1595 static void nvme_tcp_free_admin_queue(struct nvme_ctrl *ctrl) 1597 1596 { 1598 1597 if (to_tcp_ctrl(ctrl)->async_req.pdu) { 1598 + cancel_work_sync(&ctrl->async_event_work); 1599 1599 nvme_tcp_free_async_req(to_tcp_ctrl(ctrl)); 1600 1600 to_tcp_ctrl(ctrl)->async_req.pdu = NULL; 1601 1601 } ··· 1783 1781 1784 1782 if (!new) { 1785 1783 nvme_start_queues(ctrl); 1786 - nvme_wait_freeze(ctrl); 1784 + if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) { 1785 + /* 1786 + * If we timed out waiting for freeze we are likely to 1787 + * be stuck. Fail the controller initialization just 1788 + * to be safe. 1789 + */ 1790 + ret = -ENODEV; 1791 + goto out_wait_freeze_timed_out; 1792 + } 1787 1793 blk_mq_update_nr_hw_queues(ctrl->tagset, 1788 1794 ctrl->queue_count - 1); 1789 1795 nvme_unfreeze(ctrl); ··· 1799 1789 1800 1790 return 0; 1801 1791 1792 + out_wait_freeze_timed_out: 1793 + nvme_stop_queues(ctrl); 1794 + nvme_tcp_stop_io_queues(ctrl); 1802 1795 out_cleanup_connect_q: 1803 1796 if (new) 1804 1797 blk_cleanup_queue(ctrl->connect_q); ··· 1887 1874 static void nvme_tcp_teardown_admin_queue(struct nvme_ctrl *ctrl, 1888 1875 bool remove) 1889 1876 { 1877 + mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); 1890 1878 blk_mq_quiesce_queue(ctrl->admin_q); 1891 1879 nvme_tcp_stop_queue(ctrl, 0); 1892 1880 if (ctrl->admin_tagset) { ··· 1898 1884 if (remove) 1899 1885 blk_mq_unquiesce_queue(ctrl->admin_q); 1900 1886 nvme_tcp_destroy_admin_queue(ctrl, remove); 1887 + mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); 1901 1888 } 1902 1889 1903 1890 static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl, 1904 1891 bool remove) 1905 1892 { 1893 + mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); 1906 1894 if (ctrl->queue_count <= 1) 1907 - return; 1895 + goto out; 1896 + blk_mq_quiesce_queue(ctrl->admin_q); 1908 1897 nvme_start_freeze(ctrl); 1909 1898 nvme_stop_queues(ctrl); 1910 1899 nvme_tcp_stop_io_queues(ctrl); ··· 1919 1902 if (remove) 1920 1903 nvme_start_queues(ctrl); 1921 1904 nvme_tcp_destroy_io_queues(ctrl, remove); 1905 + out: 1906 + mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); 1922 1907 } 1923 1908 1924 1909 static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl) ··· 2167 2148 nvme_tcp_queue_request(&ctrl->async_req, true, true); 2168 2149 } 2169 2150 2151 + static void nvme_tcp_complete_timed_out(struct request *rq) 2152 + { 2153 + struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); 2154 + struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; 2155 + 2156 + /* fence other contexts that may complete the command */ 2157 + mutex_lock(&to_tcp_ctrl(ctrl)->teardown_lock); 2158 + nvme_tcp_stop_queue(ctrl, nvme_tcp_queue_id(req->queue)); 2159 + if (!blk_mq_request_completed(rq)) { 2160 + nvme_req(rq)->status = NVME_SC_HOST_ABORTED_CMD; 2161 + blk_mq_complete_request(rq); 2162 + } 2163 + mutex_unlock(&to_tcp_ctrl(ctrl)->teardown_lock); 2164 + } 2165 + 2170 2166 static enum blk_eh_timer_return 2171 2167 nvme_tcp_timeout(struct request *rq, bool reserved) 2172 2168 { 2173 2169 struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq); 2174 - struct nvme_tcp_ctrl *ctrl = req->queue->ctrl; 2170 + struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl; 2175 2171 struct nvme_tcp_cmd_pdu *pdu = req->pdu; 2176 2172 2177 - /* 2178 - * Restart the timer if a controller reset is already scheduled. Any 2179 - * timed out commands would be handled before entering the connecting 2180 - * state. 2181 - */ 2182 - if (ctrl->ctrl.state == NVME_CTRL_RESETTING) 2183 - return BLK_EH_RESET_TIMER; 2184 - 2185 - dev_warn(ctrl->ctrl.device, 2173 + dev_warn(ctrl->device, 2186 2174 "queue %d: timeout request %#x type %d\n", 2187 2175 nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type); 2188 2176 2189 - if (ctrl->ctrl.state != NVME_CTRL_LIVE) { 2177 + if (ctrl->state != NVME_CTRL_LIVE) { 2190 2178 /* 2191 - * Teardown immediately if controller times out while starting 2192 - * or we are already started error recovery. all outstanding 2193 - * requests are completed on shutdown, so we return BLK_EH_DONE. 2179 + * If we are resetting, connecting or deleting we should 2180 + * complete immediately because we may block controller 2181 + * teardown or setup sequence 2182 + * - ctrl disable/shutdown fabrics requests 2183 + * - connect requests 2184 + * - initialization admin requests 2185 + * - I/O requests that entered after unquiescing and 2186 + * the controller stopped responding 2187 + * 2188 + * All other requests should be cancelled by the error 2189 + * recovery work, so it's fine that we fail it here. 2194 2190 */ 2195 - flush_work(&ctrl->err_work); 2196 - nvme_tcp_teardown_io_queues(&ctrl->ctrl, false); 2197 - nvme_tcp_teardown_admin_queue(&ctrl->ctrl, false); 2191 + nvme_tcp_complete_timed_out(rq); 2198 2192 return BLK_EH_DONE; 2199 2193 } 2200 2194 2201 - dev_warn(ctrl->ctrl.device, "starting error recovery\n"); 2202 - nvme_tcp_error_recovery(&ctrl->ctrl); 2203 - 2195 + /* 2196 + * LIVE state should trigger the normal error recovery which will 2197 + * handle completing this request. 2198 + */ 2199 + nvme_tcp_error_recovery(ctrl); 2204 2200 return BLK_EH_RESET_TIMER; 2205 2201 } 2206 2202 ··· 2456 2422 nvme_tcp_reconnect_ctrl_work); 2457 2423 INIT_WORK(&ctrl->err_work, nvme_tcp_error_recovery_work); 2458 2424 INIT_WORK(&ctrl->ctrl.reset_work, nvme_reset_ctrl_work); 2425 + mutex_init(&ctrl->teardown_lock); 2459 2426 2460 2427 if (!(opts->mask & NVMF_OPT_TRSVCID)) { 2461 2428 opts->trsvcid =
+2 -2
drivers/nvme/target/fc.c
··· 2342 2342 return; 2343 2343 if (fcpreq->fcp_error || 2344 2344 fcpreq->transferred_length != fcpreq->transfer_length) { 2345 - spin_lock(&fod->flock); 2345 + spin_lock_irqsave(&fod->flock, flags); 2346 2346 fod->abort = true; 2347 - spin_unlock(&fod->flock); 2347 + spin_unlock_irqrestore(&fod->flock, flags); 2348 2348 2349 2349 nvmet_req_complete(&fod->req, NVME_SC_INTERNAL); 2350 2350 return;
+9 -1
drivers/nvme/target/tcp.c
··· 160 160 static inline u16 nvmet_tcp_cmd_tag(struct nvmet_tcp_queue *queue, 161 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 168 return cmd - queue->cmds; 164 169 } 165 170 ··· 871 866 struct nvme_tcp_data_pdu *data = &queue->pdu.data; 872 867 struct nvmet_tcp_cmd *cmd; 873 868 874 - cmd = &queue->cmds[data->ttag]; 869 + if (likely(queue->nr_cmds)) 870 + cmd = &queue->cmds[data->ttag]; 871 + else 872 + cmd = &queue->connect; 875 873 876 874 if (le32_to_cpu(data->data_offset) != cmd->rbytes_done) { 877 875 pr_err("ttag %u unexpected data offset %u (expected %u)\n",
+16 -6
drivers/opp/core.c
··· 1296 1296 } 1297 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 1301 struct dev_pm_opp *opp, *tmp; 1302 + bool ret = true; 1302 1303 1303 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 1312 goto unlock; 1307 1313 1308 1314 list_for_each_entry_safe(opp, tmp, &opp_table->opp_list, node) { ··· 1318 1312 1319 1313 unlock: 1320 1314 mutex_unlock(&opp_table->lock); 1315 + 1316 + return ret; 1321 1317 } 1322 1318 1323 1319 /** ··· 2422 2414 return; 2423 2415 } 2424 2416 2425 - _opp_remove_all_static(opp_table); 2417 + /* 2418 + * Drop the extra reference only if the OPP table was successfully added 2419 + * with dev_pm_opp_of_add_table() earlier. 2420 + **/ 2421 + if (_opp_remove_all_static(opp_table)) 2422 + dev_pm_opp_put_opp_table(opp_table); 2426 2423 2427 2424 /* Drop reference taken by _find_opp_table() */ 2428 - dev_pm_opp_put_opp_table(opp_table); 2429 - 2430 - /* Drop reference taken while the OPP table was added */ 2431 2425 dev_pm_opp_put_opp_table(opp_table); 2432 2426 } 2433 2427
+1 -1
drivers/opp/opp.h
··· 212 212 213 213 /* Routines internal to opp core */ 214 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 216 void _get_opp_table_kref(struct opp_table *opp_table); 217 217 int _get_opp_count(struct opp_table *opp_table); 218 218 struct opp_table *_find_opp_table(struct device *dev);
+2 -3
drivers/phy/qualcomm/phy-qcom-ipq806x-usb.c
··· 505 505 size = resource_size(res); 506 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 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 513 phy_dwc3->ref_clk = devm_clk_get(phy_dwc3->dev, "ref"); ··· 557 557 .probe = qcom_ipq806x_usb_phy_probe, 558 558 .driver = { 559 559 .name = "qcom-ipq806x-usb-phy", 560 - .owner = THIS_MODULE, 561 560 .of_match_table = qcom_ipq806x_usb_phy_table, 562 561 }, 563 562 };
+9 -7
drivers/phy/qualcomm/phy-qcom-qmp.c
··· 604 604 QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf), 605 605 QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1), 606 606 QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0), 607 - QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0x1f), 608 - QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x3f), 607 + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff), 608 + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f), 609 609 QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6), 610 610 QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf), 611 611 QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0), ··· 631 631 QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0), 632 632 QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80), 633 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 634 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1), 636 635 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31), 637 636 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1), ··· 639 640 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f), 640 641 QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19), 641 642 QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19), 642 - QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_CNTRL, 0x7), 643 643 }; 644 644 645 645 static const struct qmp_phy_init_tbl ipq8074_pcie_tx_tbl[] = { ··· 646 648 QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6), 647 649 QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2), 648 650 QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12), 651 + QMP_PHY_INIT_CFG(QSERDES_TX_EMP_POST1_LVL, 0x36), 652 + QMP_PHY_INIT_CFG(QSERDES_TX_SLEW_CNTL, 0x0a), 649 653 }; 650 654 651 655 static const struct qmp_phy_init_tbl ipq8074_pcie_rx_tbl[] = { ··· 658 658 QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb), 659 659 QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b), 660 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 663 static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = { ··· 2045 2046 .pwrdn_ctrl = SW_PWRDN, 2046 2047 }; 2047 2048 2049 + static const char * const ipq8074_pciephy_clk_l[] = { 2050 + "aux", "cfg_ahb", 2051 + }; 2048 2052 /* list of resets */ 2049 2053 static const char * const ipq8074_pciephy_reset_l[] = { 2050 2054 "phy", "common", ··· 2065 2063 .rx_tbl_num = ARRAY_SIZE(ipq8074_pcie_rx_tbl), 2066 2064 .pcs_tbl = ipq8074_pcie_pcs_tbl, 2067 2065 .pcs_tbl_num = ARRAY_SIZE(ipq8074_pcie_pcs_tbl), 2068 - .clk_list = NULL, 2069 - .num_clks = 0, 2066 + .clk_list = ipq8074_pciephy_clk_l, 2067 + .num_clks = ARRAY_SIZE(ipq8074_pciephy_clk_l), 2070 2068 .reset_list = ipq8074_pciephy_reset_l, 2071 2069 .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), 2072 2070 .vreg_list = NULL,
+2
drivers/phy/qualcomm/phy-qcom-qmp.h
··· 77 77 #define QSERDES_COM_CORECLK_DIV_MODE1 0x1bc 78 78 79 79 /* Only for QMP V2 PHY - TX registers */ 80 + #define QSERDES_TX_EMP_POST1_LVL 0x018 81 + #define QSERDES_TX_SLEW_CNTL 0x040 80 82 #define QSERDES_TX_RES_CODE_LANE_OFFSET 0x054 81 83 #define QSERDES_TX_DEBUG_BUS_SEL 0x064 82 84 #define QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN 0x068
+40 -7
drivers/phy/ti/phy-omap-usb2.c
··· 22 22 #include <linux/mfd/syscon.h> 23 23 #include <linux/regmap.h> 24 24 #include <linux/of_platform.h> 25 + #include <linux/sys_soc.h> 25 26 26 27 #define USB2PHY_ANA_CONFIG1 0x4c 27 28 #define USB2PHY_DISCON_BYP_LATCH BIT(31) 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) 28 33 29 34 /* SoC Specific USB2_OTG register definitions */ 30 35 #define AM654_USB2_OTG_PD BIT(8) ··· 48 43 #define OMAP_USB2_HAS_START_SRP BIT(0) 49 44 #define OMAP_USB2_HAS_SET_VBUS BIT(1) 50 45 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(2) 46 + #define OMAP_USB2_DISABLE_CHRG_DET BIT(3) 51 47 52 48 struct omap_usb { 53 49 struct usb_phy phy; ··· 242 236 omap_usb_writel(phy->phy_base, USB2PHY_ANA_CONFIG1, val); 243 237 } 244 238 239 + if (phy->flags & OMAP_USB2_DISABLE_CHRG_DET) { 240 + val = omap_usb_readl(phy->phy_base, USB2PHY_CHRG_DET); 241 + val |= USB2PHY_CHRG_DET_USE_CHG_DET_REG | 242 + USB2PHY_CHRG_DET_DIS_CHG_DET; 243 + omap_usb_writel(phy->phy_base, USB2PHY_CHRG_DET, val); 244 + } 245 + 245 246 return 0; 246 247 } 247 248 ··· 342 329 }; 343 330 MODULE_DEVICE_TABLE(of, omap_usb2_id_table); 344 331 332 + static void omap_usb2_init_errata(struct omap_usb *phy) 333 + { 334 + static const struct soc_device_attribute am65x_sr10_soc_devices[] = { 335 + { .family = "AM65X", .revision = "SR1.0" }, 336 + { /* sentinel */ } 337 + }; 338 + 339 + /* 340 + * Errata i2075: USB2PHY: USB2PHY Charger Detect is Enabled by 341 + * Default Without VBUS Presence. 342 + * 343 + * AM654x SR1.0 has a silicon bug due to which D+ is pulled high after 344 + * POR, which could cause enumeration failure with some USB hubs. 345 + * Disabling the USB2_PHY Charger Detect function will put D+ 346 + * into the normal state. 347 + */ 348 + if (soc_device_match(am65x_sr10_soc_devices)) 349 + phy->flags |= OMAP_USB2_DISABLE_CHRG_DET; 350 + } 351 + 345 352 static int omap_usb2_probe(struct platform_device *pdev) 346 353 { 347 354 struct omap_usb *phy; ··· 399 366 phy->mask = phy_data->mask; 400 367 phy->power_on = phy_data->power_on; 401 368 phy->power_off = phy_data->power_off; 369 + phy->flags = phy_data->flags; 402 370 403 - if (phy_data->flags & OMAP_USB2_CALIBRATE_FALSE_DISCONNECT) { 404 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 405 - phy->phy_base = devm_ioremap_resource(&pdev->dev, res); 406 - if (IS_ERR(phy->phy_base)) 407 - return PTR_ERR(phy->phy_base); 408 - phy->flags |= OMAP_USB2_CALIBRATE_FALSE_DISCONNECT; 409 - } 371 + omap_usb2_init_errata(phy); 372 + 373 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 374 + phy->phy_base = devm_ioremap_resource(&pdev->dev, res); 375 + if (IS_ERR(phy->phy_base)) 376 + return PTR_ERR(phy->phy_base); 410 377 411 378 phy->syscon_phy_power = syscon_regmap_lookup_by_phandle(node, 412 379 "syscon-phy-power");
+3
drivers/powercap/intel_rapl_common.c
··· 1035 1035 X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L, &rapl_defaults_core), 1036 1036 X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, &rapl_defaults_core), 1037 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 1041 X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &rapl_defaults_spr_server), 1039 1042 1040 1043 X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, &rapl_defaults_byt),
+1 -1
drivers/rapidio/Kconfig
··· 37 37 config RAPIDIO_DMA_ENGINE 38 38 bool "DMA Engine support for RapidIO" 39 39 depends on RAPIDIO 40 - select DMADEVICES 40 + depends on DMADEVICES 41 41 select DMA_ENGINE 42 42 help 43 43 Say Y here if you want to use DMA Engine frameork for RapidIO data
+96 -83
drivers/regulator/core.c
··· 236 236 static void regulator_unlock_recursive(struct regulator_dev *rdev, 237 237 unsigned int n_coupled) 238 238 { 239 - struct regulator_dev *c_rdev; 240 - int i; 239 + struct regulator_dev *c_rdev, *supply_rdev; 240 + int i, supply_n_coupled; 241 241 242 242 for (i = n_coupled; i > 0; i--) { 243 243 c_rdev = rdev->coupling_desc.coupled_rdevs[i - 1]; ··· 245 245 if (!c_rdev) 246 246 continue; 247 247 248 - if (c_rdev->supply && !regulator_supply_is_couple(c_rdev)) 249 - regulator_unlock_recursive( 250 - c_rdev->supply->rdev, 251 - c_rdev->coupling_desc.n_coupled); 248 + if (c_rdev->supply && !regulator_supply_is_couple(c_rdev)) { 249 + supply_rdev = c_rdev->supply->rdev; 250 + supply_n_coupled = supply_rdev->coupling_desc.n_coupled; 251 + 252 + regulator_unlock_recursive(supply_rdev, 253 + supply_n_coupled); 254 + } 252 255 253 256 regulator_unlock(c_rdev); 254 257 } ··· 1464 1461 const char *consumer_dev_name, 1465 1462 const char *supply) 1466 1463 { 1467 - struct regulator_map *node; 1464 + struct regulator_map *node, *new_node; 1468 1465 int has_dev; 1469 1466 1470 1467 if (supply == NULL) ··· 1475 1472 else 1476 1473 has_dev = 0; 1477 1474 1475 + new_node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL); 1476 + if (new_node == NULL) 1477 + return -ENOMEM; 1478 + 1479 + new_node->regulator = rdev; 1480 + new_node->supply = supply; 1481 + 1482 + if (has_dev) { 1483 + new_node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL); 1484 + if (new_node->dev_name == NULL) { 1485 + kfree(new_node); 1486 + return -ENOMEM; 1487 + } 1488 + } 1489 + 1490 + mutex_lock(&regulator_list_mutex); 1478 1491 list_for_each_entry(node, &regulator_map_list, list) { 1479 1492 if (node->dev_name && consumer_dev_name) { 1480 1493 if (strcmp(node->dev_name, consumer_dev_name) != 0) ··· 1508 1489 node->regulator->desc->name, 1509 1490 supply, 1510 1491 dev_name(&rdev->dev), rdev_get_name(rdev)); 1511 - return -EBUSY; 1492 + goto fail; 1512 1493 } 1513 1494 1514 - node = kzalloc(sizeof(struct regulator_map), GFP_KERNEL); 1515 - if (node == NULL) 1516 - return -ENOMEM; 1495 + list_add(&new_node->list, &regulator_map_list); 1496 + mutex_unlock(&regulator_list_mutex); 1517 1497 1518 - node->regulator = rdev; 1519 - node->supply = supply; 1520 - 1521 - if (has_dev) { 1522 - node->dev_name = kstrdup(consumer_dev_name, GFP_KERNEL); 1523 - if (node->dev_name == NULL) { 1524 - kfree(node); 1525 - return -ENOMEM; 1526 - } 1527 - } 1528 - 1529 - list_add(&node->list, &regulator_map_list); 1530 1498 return 0; 1499 + 1500 + fail: 1501 + mutex_unlock(&regulator_list_mutex); 1502 + kfree(new_node->dev_name); 1503 + kfree(new_node); 1504 + return -EBUSY; 1531 1505 } 1532 1506 1533 1507 static void unset_regulator_supplies(struct regulator_dev *rdev) ··· 1592 1580 const char *supply_name) 1593 1581 { 1594 1582 struct regulator *regulator; 1595 - char buf[REG_STR_SIZE]; 1596 - int err, size; 1583 + int err; 1584 + 1585 + if (dev) { 1586 + char buf[REG_STR_SIZE]; 1587 + int size; 1588 + 1589 + size = snprintf(buf, REG_STR_SIZE, "%s-%s", 1590 + dev->kobj.name, supply_name); 1591 + if (size >= REG_STR_SIZE) 1592 + return NULL; 1593 + 1594 + supply_name = kstrdup(buf, GFP_KERNEL); 1595 + if (supply_name == NULL) 1596 + return NULL; 1597 + } else { 1598 + supply_name = kstrdup_const(supply_name, GFP_KERNEL); 1599 + if (supply_name == NULL) 1600 + return NULL; 1601 + } 1597 1602 1598 1603 regulator = kzalloc(sizeof(*regulator), GFP_KERNEL); 1599 - if (regulator == NULL) 1604 + if (regulator == NULL) { 1605 + kfree(supply_name); 1600 1606 return NULL; 1607 + } 1608 + 1609 + regulator->rdev = rdev; 1610 + regulator->supply_name = supply_name; 1601 1611 1602 1612 regulator_lock(rdev); 1603 - regulator->rdev = rdev; 1604 1613 list_add(&regulator->list, &rdev->consumer_list); 1614 + regulator_unlock(rdev); 1605 1615 1606 1616 if (dev) { 1607 1617 regulator->dev = dev; 1608 1618 1609 1619 /* Add a link to the device sysfs entry */ 1610 - size = snprintf(buf, REG_STR_SIZE, "%s-%s", 1611 - dev->kobj.name, supply_name); 1612 - if (size >= REG_STR_SIZE) 1613 - goto overflow_err; 1614 - 1615 - regulator->supply_name = kstrdup(buf, GFP_KERNEL); 1616 - if (regulator->supply_name == NULL) 1617 - goto overflow_err; 1618 - 1619 1620 err = sysfs_create_link_nowarn(&rdev->dev.kobj, &dev->kobj, 1620 - buf); 1621 + supply_name); 1621 1622 if (err) { 1622 1623 rdev_dbg(rdev, "could not add device link %s err %d\n", 1623 1624 dev->kobj.name, err); 1624 1625 /* non-fatal */ 1625 1626 } 1626 - } else { 1627 - regulator->supply_name = kstrdup_const(supply_name, GFP_KERNEL); 1628 - if (regulator->supply_name == NULL) 1629 - goto overflow_err; 1630 1627 } 1631 1628 1632 - regulator->debugfs = debugfs_create_dir(regulator->supply_name, 1629 + regulator->debugfs = debugfs_create_dir(supply_name, 1633 1630 rdev->debugfs); 1634 1631 if (!regulator->debugfs) { 1635 1632 rdev_dbg(rdev, "Failed to create debugfs directory\n"); ··· 1663 1642 _regulator_is_enabled(rdev)) 1664 1643 regulator->always_on = true; 1665 1644 1666 - regulator_unlock(rdev); 1667 1645 return regulator; 1668 - overflow_err: 1669 - list_del(&regulator->list); 1670 - kfree(regulator); 1671 - regulator_unlock(rdev); 1672 - return NULL; 1673 1646 } 1674 1647 1675 1648 static int _regulator_get_enable_time(struct regulator_dev *rdev) ··· 2245 2230 static int regulator_ena_gpio_request(struct regulator_dev *rdev, 2246 2231 const struct regulator_config *config) 2247 2232 { 2248 - struct regulator_enable_gpio *pin; 2233 + struct regulator_enable_gpio *pin, *new_pin; 2249 2234 struct gpio_desc *gpiod; 2250 2235 2251 2236 gpiod = config->ena_gpiod; 2237 + new_pin = kzalloc(sizeof(*new_pin), GFP_KERNEL); 2238 + 2239 + mutex_lock(&regulator_list_mutex); 2252 2240 2253 2241 list_for_each_entry(pin, &regulator_ena_gpio_list, list) { 2254 2242 if (pin->gpiod == gpiod) { ··· 2260 2242 } 2261 2243 } 2262 2244 2263 - pin = kzalloc(sizeof(struct regulator_enable_gpio), GFP_KERNEL); 2264 - if (pin == NULL) 2245 + if (new_pin == NULL) { 2246 + mutex_unlock(&regulator_list_mutex); 2265 2247 return -ENOMEM; 2248 + } 2249 + 2250 + pin = new_pin; 2251 + new_pin = NULL; 2266 2252 2267 2253 pin->gpiod = gpiod; 2268 2254 list_add(&pin->list, &regulator_ena_gpio_list); ··· 2274 2252 update_ena_gpio_to_rdev: 2275 2253 pin->request_count++; 2276 2254 rdev->ena_pin = pin; 2255 + 2256 + mutex_unlock(&regulator_list_mutex); 2257 + kfree(new_pin); 2258 + 2277 2259 return 0; 2278 2260 } 2279 2261 ··· 2290 2264 2291 2265 /* Free the GPIO only in case of no use */ 2292 2266 list_for_each_entry_safe(pin, n, &regulator_ena_gpio_list, list) { 2293 - if (pin->gpiod == rdev->ena_pin->gpiod) { 2294 - if (pin->request_count <= 1) { 2295 - pin->request_count = 0; 2296 - gpiod_put(pin->gpiod); 2297 - list_del(&pin->list); 2298 - kfree(pin); 2299 - rdev->ena_pin = NULL; 2300 - return; 2301 - } else { 2302 - pin->request_count--; 2303 - } 2304 - } 2267 + if (pin != rdev->ena_pin) 2268 + continue; 2269 + 2270 + if (--pin->request_count) 2271 + break; 2272 + 2273 + gpiod_put(pin->gpiod); 2274 + list_del(&pin->list); 2275 + kfree(pin); 2276 + break; 2305 2277 } 2278 + 2279 + rdev->ena_pin = NULL; 2306 2280 } 2307 2281 2308 2282 /** ··· 4975 4949 return; 4976 4950 } 4977 4951 4978 - regulator_lock(c_rdev); 4979 - 4980 4952 c_desc->coupled_rdevs[i] = c_rdev; 4981 4953 c_desc->n_resolved++; 4982 - 4983 - regulator_unlock(c_rdev); 4984 4954 4985 4955 regulator_resolve_coupling(c_rdev); 4986 4956 } ··· 5062 5040 if (!of_check_coupling_data(rdev)) 5063 5041 return -EPERM; 5064 5042 5043 + mutex_lock(&regulator_list_mutex); 5065 5044 rdev->coupling_desc.coupler = regulator_find_coupler(rdev); 5045 + mutex_unlock(&regulator_list_mutex); 5046 + 5066 5047 if (IS_ERR(rdev->coupling_desc.coupler)) { 5067 5048 err = PTR_ERR(rdev->coupling_desc.coupler); 5068 5049 rdev_err(rdev, "failed to get coupler: %d\n", err); ··· 5166 5141 ret = -ENOMEM; 5167 5142 goto rinse; 5168 5143 } 5144 + device_initialize(&rdev->dev); 5169 5145 5170 5146 /* 5171 5147 * Duplicate the config so the driver could override it after ··· 5174 5148 */ 5175 5149 config = kmemdup(cfg, sizeof(*cfg), GFP_KERNEL); 5176 5150 if (config == NULL) { 5177 - kfree(rdev); 5178 5151 ret = -ENOMEM; 5179 - goto rinse; 5152 + goto clean; 5180 5153 } 5181 5154 5182 5155 init_data = regulator_of_get_init_data(dev, regulator_desc, config, ··· 5187 5162 * from a gpio extender or something else. 5188 5163 */ 5189 5164 if (PTR_ERR(init_data) == -EPROBE_DEFER) { 5190 - kfree(config); 5191 - kfree(rdev); 5192 5165 ret = -EPROBE_DEFER; 5193 - goto rinse; 5166 + goto clean; 5194 5167 } 5195 5168 5196 5169 /* ··· 5229 5206 } 5230 5207 5231 5208 if (config->ena_gpiod) { 5232 - mutex_lock(&regulator_list_mutex); 5233 5209 ret = regulator_ena_gpio_request(rdev, config); 5234 - mutex_unlock(&regulator_list_mutex); 5235 5210 if (ret != 0) { 5236 5211 rdev_err(rdev, "Failed to request enable GPIO: %d\n", 5237 5212 ret); ··· 5241 5220 } 5242 5221 5243 5222 /* register with sysfs */ 5244 - device_initialize(&rdev->dev); 5245 5223 rdev->dev.class = &regulator_class; 5246 5224 rdev->dev.parent = dev; 5247 5225 dev_set_name(&rdev->dev, "regulator.%lu", ··· 5268 5248 if (ret < 0) 5269 5249 goto wash; 5270 5250 5271 - mutex_lock(&regulator_list_mutex); 5272 5251 ret = regulator_init_coupling(rdev); 5273 - mutex_unlock(&regulator_list_mutex); 5274 5252 if (ret < 0) 5275 5253 goto wash; 5276 5254 5277 5255 /* add consumers devices */ 5278 5256 if (init_data) { 5279 - mutex_lock(&regulator_list_mutex); 5280 5257 for (i = 0; i < init_data->num_consumer_supplies; i++) { 5281 5258 ret = set_consumer_device_supply(rdev, 5282 5259 init_data->consumer_supplies[i].dev_name, 5283 5260 init_data->consumer_supplies[i].supply); 5284 5261 if (ret < 0) { 5285 - mutex_unlock(&regulator_list_mutex); 5286 5262 dev_err(dev, "Failed to set supply %s\n", 5287 5263 init_data->consumer_supplies[i].supply); 5288 5264 goto unset_supplies; 5289 5265 } 5290 5266 } 5291 - mutex_unlock(&regulator_list_mutex); 5292 5267 } 5293 5268 5294 5269 if (!rdev->desc->ops->get_voltage && ··· 5318 5303 mutex_lock(&regulator_list_mutex); 5319 5304 regulator_ena_gpio_free(rdev); 5320 5305 mutex_unlock(&regulator_list_mutex); 5321 - put_device(&rdev->dev); 5322 - rdev = NULL; 5323 5306 clean: 5324 5307 if (dangling_of_gpiod) 5325 5308 gpiod_put(config->ena_gpiod); 5326 - kfree(rdev); 5327 5309 kfree(config); 5310 + put_device(&rdev->dev); 5328 5311 rinse: 5329 5312 if (dangling_cfg_gpiod) 5330 5313 gpiod_put(cfg->ena_gpiod);
+3
drivers/regulator/cros-ec-regulator.c
··· 170 170 data->voltages_mV = 171 171 devm_kmemdup(dev, resp.voltages_mv, 172 172 sizeof(u16) * data->num_voltages, GFP_KERNEL); 173 + if (!data->voltages_mV) 174 + return -ENOMEM; 175 + 173 176 data->desc.n_voltages = data->num_voltages; 174 177 175 178 /* Make sure the returned name is always a valid string */
+1 -1
drivers/regulator/fixed.c
··· 182 182 183 183 drvdata->enable_clock = devm_clk_get(dev, NULL); 184 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 186 return -ENOENT; 187 187 } 188 188 } else {
+1 -1
drivers/regulator/pwm-regulator.c
··· 279 279 return ret; 280 280 } 281 281 282 - drvdata->state = -EINVAL; 282 + drvdata->state = -ENOTRECOVERABLE; 283 283 drvdata->duty_cycle_table = duty_cycle_table; 284 284 drvdata->desc.ops = &pwm_regulator_voltage_table_ops; 285 285 drvdata->desc.n_voltages = length / sizeof(*duty_cycle_table);
+1 -1
drivers/scsi/cxgbi/libcxgbi.c
··· 2457 2457 return err; 2458 2458 } 2459 2459 2460 - __kfree_skb(skb); 2461 2460 log_debug(1 << CXGBI_DBG_ISCSI | 1 << CXGBI_DBG_PDU_TX, 2462 2461 "itt 0x%x, skb 0x%p, len %u/%u, xmit err %d.\n", 2463 2462 task->itt, skb, skb->len, skb->data_len, err); 2463 + __kfree_skb(skb); 2464 2464 iscsi_conn_printk(KERN_ERR, task->conn, "xmit err %d.\n", err); 2465 2465 iscsi_conn_failure(task->conn, ISCSI_ERR_XMIT_FAILED); 2466 2466 return err;
-2
drivers/scsi/libfc/fc_disc.c
··· 634 634 fc_frame_free(fp); 635 635 out: 636 636 kref_put(&rdata->kref, fc_rport_destroy); 637 - if (!IS_ERR(fp)) 638 - fc_frame_free(fp); 639 637 } 640 638 641 639 /**
+4 -1
drivers/scsi/libsas/sas_ata.c
··· 209 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 216 task->scatter = qc->sg; 214 217 task->ata_task.retry_count = 1; 215 218 task->task_state_flags = SAS_TASK_STATE_PENDING;
+6 -1
drivers/scsi/lpfc/lpfc_els.c
··· 3517 3517 FC_TLV_DESC_LENGTH_FROM_SZ(prdf->reg_d1)); 3518 3518 prdf->reg_d1.reg_desc.count = cpu_to_be32(ELS_RDF_REG_TAG_CNT); 3519 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 3524 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, 3522 3525 "Issue RDF: did:x%x", ··· 4659 4656 out: 4660 4657 if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) { 4661 4658 spin_lock_irq(shost->host_lock); 4662 - ndlp->nlp_flag &= ~(NLP_ACC_REGLOGIN | NLP_RM_DFLT_RPI); 4659 + if (mbox) 4660 + ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN; 4661 + ndlp->nlp_flag &= ~NLP_RM_DFLT_RPI; 4663 4662 spin_unlock_irq(shost->host_lock); 4664 4663 4665 4664 /* If the node is not being used by another discovery thread,
+1 -1
drivers/scsi/lpfc/lpfc_hw4.h
··· 4800 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 4804 struct lpfc_els_rdf_reg_desc { 4805 4805 struct fc_df_desc_fpin_reg reg_desc; /* descriptor header */ 4806 4806 __be32 desc_tags[ELS_RDF_REG_TAG_CNT];
-1
drivers/scsi/lpfc/lpfc_init.c
··· 11376 11376 { 11377 11377 cpumask_clear(&eqhdl->aff_mask); 11378 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 /**
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 20 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 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */
+1 -1
drivers/scsi/megaraid/megaraid_sas_fusion.c
··· 3689 3689 instance = irq_ctx->instance; 3690 3690 3691 3691 if (irq_ctx->irq_line_enable) { 3692 - disable_irq(irq_ctx->os_irq); 3692 + disable_irq_nosync(irq_ctx->os_irq); 3693 3693 irq_ctx->irq_line_enable = false; 3694 3694 } 3695 3695
+1 -1
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 1733 1733 reply_q = container_of(irqpoll, struct adapter_reply_queue, 1734 1734 irqpoll); 1735 1735 if (reply_q->irq_line_enable) { 1736 - disable_irq(reply_q->os_irq); 1736 + disable_irq_nosync(reply_q->os_irq); 1737 1737 reply_q->irq_line_enable = false; 1738 1738 } 1739 1739 num_entries = _base_process_reply_queue(reply_q);
+1 -1
drivers/scsi/pm8001/pm8001_sas.c
··· 818 818 819 819 res = pm8001_tag_alloc(pm8001_ha, &ccb_tag); 820 820 if (res) 821 - return res; 821 + goto ex_err; 822 822 ccb = &pm8001_ha->ccb_info[ccb_tag]; 823 823 ccb->device = pm8001_dev; 824 824 ccb->ccb_tag = ccb_tag;
+1 -1
drivers/scsi/qedf/qedf_main.c
··· 3863 3863 container_of(work, struct qedf_ctx, stag_work.work); 3864 3864 3865 3865 if (!qedf) { 3866 - QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL"); 3866 + QEDF_ERR(NULL, "qedf is NULL"); 3867 3867 return; 3868 3868 } 3869 3869 QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n");
+1 -1
drivers/scsi/qla2xxx/qla_def.h
··· 1626 1626 */ 1627 1627 uint8_t firmware_options[2]; 1628 1628 1629 - uint16_t frame_payload_size; 1629 + __le16 frame_payload_size; 1630 1630 __le16 max_iocb_allocation; 1631 1631 __le16 execution_throttle; 1632 1632 uint8_t retry_count;
+3 -3
drivers/scsi/qla2xxx/qla_init.c
··· 4603 4603 nv->firmware_options[1] = BIT_7 | BIT_5; 4604 4604 nv->add_firmware_options[0] = BIT_5; 4605 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 4607 nv->special_options[1] = BIT_7; 4608 4608 } else if (IS_QLA2200(ha)) { 4609 4609 nv->firmware_options[0] = BIT_2 | BIT_1; 4610 4610 nv->firmware_options[1] = BIT_7 | BIT_5; 4611 4611 nv->add_firmware_options[0] = BIT_5; 4612 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 4614 } else if (IS_QLA2100(ha)) { 4615 4615 nv->firmware_options[0] = BIT_3 | BIT_1; 4616 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 4620 nv->max_iocb_allocation = cpu_to_le16(256);
-2
drivers/scsi/scsi_debug.c
··· 4482 4482 goto fini; 4483 4483 } 4484 4484 4485 - if (zc == ZC2_IMPLICIT_OPEN) 4486 - zbc_close_zone(devip, zsp); 4487 4485 zbc_open_zone(devip, zsp, true); 4488 4486 fini: 4489 4487 write_unlock(macc_lckp);
+1 -1
drivers/soundwire/bus.c
··· 1372 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 1376 ret = sdw_read(slave, SDW_SCP_INT1); 1377 1377 if (ret < 0) { 1378 1378 dev_err(slave->bus->dev,
+5 -3
drivers/soundwire/stream.c
··· 717 717 kfree(wbuf); 718 718 error_1: 719 719 kfree(wr_msg); 720 + bus->defer_msg.msg = NULL; 720 721 return ret; 721 722 } 722 723 ··· 841 840 error: 842 841 list_for_each_entry(m_rt, &stream->master_list, stream_node) { 843 842 bus = m_rt->bus; 844 - 845 - kfree(bus->defer_msg.msg->buf); 846 - kfree(bus->defer_msg.msg); 843 + if (bus->defer_msg.msg) { 844 + kfree(bus->defer_msg.msg->buf); 845 + kfree(bus->defer_msg.msg); 846 + } 847 847 } 848 848 849 849 msg_unlock:
+14 -3
drivers/spi/spi-cadence-quadspi.c
··· 907 907 struct dma_async_tx_descriptor *tx; 908 908 dma_cookie_t cookie; 909 909 dma_addr_t dma_dst; 910 + struct device *ddev; 910 911 911 912 if (!cqspi->rx_chan || !virt_addr_valid(buf)) { 912 913 memcpy_fromio(buf, cqspi->ahb_base + from, len); 913 914 return 0; 914 915 } 915 916 916 - dma_dst = dma_map_single(dev, buf, len, DMA_FROM_DEVICE); 917 - if (dma_mapping_error(dev, dma_dst)) { 917 + ddev = cqspi->rx_chan->device->dev; 918 + dma_dst = dma_map_single(ddev, buf, len, DMA_FROM_DEVICE); 919 + if (dma_mapping_error(ddev, dma_dst)) { 918 920 dev_err(dev, "dma mapping failed\n"); 919 921 return -ENOMEM; 920 922 } ··· 950 948 } 951 949 952 950 err_unmap: 953 - dma_unmap_single(dev, dma_dst, len, DMA_FROM_DEVICE); 951 + dma_unmap_single(ddev, dma_dst, len, DMA_FROM_DEVICE); 954 952 955 953 return ret; 956 954 } ··· 1130 1128 return 0; 1131 1129 } 1132 1130 1131 + static const char *cqspi_get_name(struct spi_mem *mem) 1132 + { 1133 + struct cqspi_st *cqspi = spi_master_get_devdata(mem->spi->master); 1134 + struct device *dev = &cqspi->pdev->dev; 1135 + 1136 + return devm_kasprintf(dev, GFP_KERNEL, "%s.%d", dev_name(dev), mem->spi->chip_select); 1137 + } 1138 + 1133 1139 static const struct spi_controller_mem_ops cqspi_mem_ops = { 1134 1140 .exec_op = cqspi_exec_mem_op, 1141 + .get_name = cqspi_get_name, 1135 1142 }; 1136 1143 1137 1144 static int cqspi_setup_flash(struct cqspi_st *cqspi)
+1 -1
drivers/spi/spi-loopback-test.c
··· 90 90 { 91 91 .description = "tx/rx-transfer - crossing PAGE_SIZE", 92 92 .fill_option = FILL_COUNT_8, 93 - .iterate_len = { ITERATE_MAX_LEN }, 93 + .iterate_len = { ITERATE_LEN }, 94 94 .iterate_tx_align = ITERATE_ALIGN, 95 95 .iterate_rx_align = ITERATE_ALIGN, 96 96 .transfer_count = 1,
+6 -2
drivers/spi/spi-stm32.c
··· 936 936 } 937 937 938 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 944 if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0))) 941 945 stm32h7_spi_read_rxfifo(spi, false); 942 946 /* ··· 2064 2060 } 2065 2061 2066 2062 ret = pm_runtime_get_sync(dev); 2067 - if (ret) { 2063 + if (ret < 0) { 2068 2064 dev_err(dev, "Unable to power device:%d\n", ret); 2069 2065 return ret; 2070 2066 }
+7 -2
drivers/spi/spi.c
··· 1327 1327 if (msg->status && ctlr->handle_err) 1328 1328 ctlr->handle_err(ctlr, msg); 1329 1329 1330 - spi_res_release(ctlr, msg); 1331 - 1332 1330 spi_finalize_current_message(ctlr); 1333 1331 1334 1332 return ret; ··· 1722 1724 WARN_ON_ONCE(xfer->ptp_sts && !xfer->timestamped); 1723 1725 1724 1726 spi_unmap_msg(ctlr, mesg); 1727 + 1728 + /* In the prepare_messages callback the spi bus has the opportunity to 1729 + * split a transfer to smaller chunks. 1730 + * Release splited transfers here since spi_map_msg is done on the 1731 + * splited transfers. 1732 + */ 1733 + spi_res_release(ctlr, mesg); 1725 1734 1726 1735 if (ctlr->cur_msg_prepared && ctlr->unprepare_message) { 1727 1736 ret = ctlr->unprepare_message(ctlr, mesg);
+1 -2
drivers/staging/greybus/audio_helper.c
··· 173 173 id.index = control->index; 174 174 kctl = snd_ctl_find_id(card, &id); 175 175 if (!kctl) { 176 - dev_err(dev, "%d: Failed to find %s\n", err, 177 - control->name); 176 + dev_err(dev, "Failed to find %s\n", control->name); 178 177 continue; 179 178 } 180 179 err = snd_ctl_remove(card, kctl);
+15 -14
drivers/staging/greybus/audio_topology.c
··· 456 456 val = ucontrol->value.integer.value[0] & mask; 457 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 468 /* update ucontrol */ 460 469 if (gbvalue.value.integer_value[0] != val) { 461 470 for (wi = 0; wi < wlist->num_widgets; wi++) { ··· 475 466 gbvalue.value.integer_value[0] = 476 467 cpu_to_le32(ucontrol->value.integer.value[0]); 477 468 478 - ret = gb_pm_runtime_get_sync(bundle); 479 - if (ret) 480 - return ret; 481 - 482 469 ret = gb_audio_gb_set_control(module->mgmt_connection, 483 470 data->ctl_id, 484 471 GB_AUDIO_INVALID_INDEX, &gbvalue); 485 - 486 - gb_pm_runtime_put_autosuspend(bundle); 487 - 488 - if (ret) { 489 - dev_err_ratelimited(codec_dev, 490 - "%d:Error in %s for %s\n", ret, 491 - __func__, kcontrol->id.name); 492 - return ret; 493 - } 494 472 } 495 473 496 - return 0; 474 + exit: 475 + gb_pm_runtime_put_autosuspend(bundle); 476 + if (ret) 477 + dev_err_ratelimited(codec_dev, "%d:Error in %s for %s\n", ret, 478 + __func__, kcontrol->id.name); 479 + return ret; 497 480 } 498 481 499 482 #define SOC_DAPM_MIXER_GB(xname, kcount, data) \
+6 -1
drivers/staging/media/sunxi/cedrus/cedrus.c
··· 199 199 struct v4l2_ctrl *ctrl_test; 200 200 unsigned int count; 201 201 unsigned int i; 202 + int ret = 0; 202 203 203 204 list_for_each_entry(obj, &req->objects, list) { 204 205 struct vb2_buffer *vb; ··· 244 243 if (!ctrl_test) { 245 244 v4l2_info(&ctx->dev->v4l2_dev, 246 245 "Missing required codec control\n"); 247 - return -ENOENT; 246 + ret = -ENOENT; 247 + break; 248 248 } 249 249 } 250 250 251 251 v4l2_ctrl_request_hdl_put(hdl); 252 + 253 + if (ret) 254 + return ret; 252 255 253 256 return vb2_request_validate(req); 254 257 }
-5
drivers/staging/wlan-ng/hfa384x_usb.c
··· 524 524 */ 525 525 void hfa384x_create(struct hfa384x *hw, struct usb_device *usb) 526 526 { 527 - memset(hw, 0, sizeof(*hw)); 528 527 hw->usb = usb; 529 - 530 - /* set up the endpoints */ 531 - hw->endp_in = usb_rcvbulkpipe(usb, 1); 532 - hw->endp_out = usb_sndbulkpipe(usb, 2); 533 528 534 529 /* Set up the waitq */ 535 530 init_waitqueue_head(&hw->cmdq);
+6 -13
drivers/staging/wlan-ng/prism2usb.c
··· 61 61 const struct usb_device_id *id) 62 62 { 63 63 struct usb_device *dev; 64 - const struct usb_endpoint_descriptor *epd; 65 - const struct usb_host_interface *iface_desc = interface->cur_altsetting; 64 + struct usb_endpoint_descriptor *bulk_in, *bulk_out; 65 + struct usb_host_interface *iface_desc = interface->cur_altsetting; 66 66 struct wlandevice *wlandev = NULL; 67 67 struct hfa384x *hw = NULL; 68 68 int result = 0; 69 69 70 - if (iface_desc->desc.bNumEndpoints != 2) { 71 - result = -ENODEV; 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)) 70 + result = usb_find_common_endpoints(iface_desc, &bulk_in, &bulk_out, NULL, NULL); 71 + if (result) 81 72 goto failed; 82 73 83 74 dev = interface_to_usbdev(interface); ··· 87 96 } 88 97 89 98 /* Initialize the hw data */ 99 + hw->endp_in = usb_rcvbulkpipe(dev, bulk_in->bEndpointAddress); 100 + hw->endp_out = usb_sndbulkpipe(dev, bulk_out->bEndpointAddress); 90 101 hfa384x_create(hw, dev); 91 102 hw->wlandev = wlandev; 92 103
+15 -2
drivers/target/iscsi/iscsi_target.c
··· 1389 1389 sg = cmd->first_data_sg; 1390 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 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 1409 ahash_request_set_crypt(hash, sg, NULL, cur_len); 1396 1410 crypto_ahash_update(hash); 1397 1411 1398 1412 data_length -= cur_len; 1399 - page_off = 0; 1400 1413 /* iscsit_map_iovec has already checked for invalid sg pointers */ 1401 1414 sg = sg_next(sg); 1402 1415 }
+3 -3
drivers/target/iscsi/iscsi_target_login.c
··· 1149 1149 } 1150 1150 1151 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 1154 if (!new_sess) 1155 1155 goto old_sess_out; ··· 1167 1167 conn->sess = NULL; 1168 1168 1169 1169 old_sess_out: 1170 - iscsi_stop_login_thread_timer(np); 1171 1170 /* 1172 1171 * If login negotiation fails check if the Time2Retain timer 1173 1172 * needs to be restarted. ··· 1406 1407 new_sess_out: 1407 1408 new_sess = true; 1408 1409 old_sess_out: 1410 + iscsi_stop_login_thread_timer(np); 1409 1411 tpg_np = conn->tpg_np; 1410 - iscsi_target_login_sess_out(conn, np, zero_tsih, new_sess); 1412 + iscsi_target_login_sess_out(conn, zero_tsih, new_sess); 1411 1413 new_sess = false; 1412 1414 1413 1415 if (tpg) {
+1 -2
drivers/target/iscsi/iscsi_target_login.h
··· 22 22 extern void iscsit_free_conn(struct iscsi_conn *); 23 23 extern int iscsit_start_kthreads(struct iscsi_conn *); 24 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 *, 26 - bool, bool); 25 + extern void iscsi_target_login_sess_out(struct iscsi_conn *, bool, bool); 27 26 extern int iscsi_target_login_thread(void *); 28 27 extern void iscsi_handle_login_thread_timeout(struct timer_list *t); 29 28
+1 -2
drivers/target/iscsi/iscsi_target_nego.c
··· 535 535 536 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 538 bool zero_tsih = login->zero_tsih; 540 539 541 540 iscsi_remove_failed_auth_entry(conn); 542 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 545 struct conn_timeout {
+2 -2
drivers/thermal/qcom/qcom-spmi-temp-alarm.c
··· 1 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 6 #include <linux/bitops.h> ··· 191 191 chip->temp = mili_celsius; 192 192 } 193 193 194 - *temp = chip->temp < 0 ? 0 : chip->temp; 194 + *temp = chip->temp; 195 195 196 196 return 0; 197 197 }
+3 -2
drivers/thermal/thermal_core.c
··· 1516 1516 */ 1517 1517 void thermal_zone_device_unregister(struct thermal_zone_device *tz) 1518 1518 { 1519 - int i; 1519 + int i, tz_id; 1520 1520 const struct thermal_zone_params *tzp; 1521 1521 struct thermal_cooling_device *cdev; 1522 1522 struct thermal_zone_device *pos = NULL; ··· 1525 1525 return; 1526 1526 1527 1527 tzp = tz->tzp; 1528 + tz_id = tz->id; 1528 1529 1529 1530 mutex_lock(&thermal_list_lock); 1530 1531 list_for_each_entry(pos, &thermal_tz_list, node) ··· 1568 1567 mutex_destroy(&tz->lock); 1569 1568 device_unregister(&tz->device); 1570 1569 1571 - thermal_notify_tz_delete(tz->id); 1570 + thermal_notify_tz_delete(tz_id); 1572 1571 } 1573 1572 EXPORT_SYMBOL_GPL(thermal_zone_device_unregister); 1574 1573
+12 -11
drivers/thermal/ti-soc-thermal/omap4-thermal-data.c
··· 37 37 38 38 /* 39 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 43 static const int 43 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 - -20000, -18000, -17000, -15000, -13000, -12000, -10000, -8000, -6000, 46 - -5000, -3000, -1000, 0, 2000, 3000, 5000, 6000, 8000, 10000, 12000, 47 - 13000, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28000, 30000, 48 - 32000, 33000, 35000, 37000, 38000, 40000, 42000, 43000, 45000, 47000, 49 - 48000, 50000, 52000, 53000, 55000, 57000, 58000, 60000, 62000, 64000, 50 - 66000, 68000, 70000, 71000, 73000, 75000, 77000, 78000, 80000, 82000, 51 - 83000, 85000, 87000, 88000, 90000, 92000, 93000, 95000, 97000, 98000, 52 - 100000, 102000, 103000, 105000, 107000, 109000, 111000, 113000, 115000, 53 - 117000, 118000, 120000, 122000, 123000, 45 + -40000, -38000, -35000, -34000, -32000, -30000, -28000, -26000, -24000, 46 + -22000, -20000, -18500, -17000, -15000, -13500, -12000, -10000, -8000, 47 + -6500, -5000, -3500, -1500, 0, 2000, 3500, 5000, 6500, 8500, 10000, 48 + 12000, 13500, 15000, 17000, 19000, 21000, 23000, 25000, 27000, 28500, 49 + 30000, 32000, 33500, 35000, 37000, 38500, 40000, 42000, 43500, 45000, 50 + 47000, 48500, 50000, 52000, 53500, 55000, 57000, 58500, 60000, 62000, 51 + 64000, 66000, 68000, 70000, 71500, 73500, 75000, 77000, 78500, 80000, 52 + 82000, 83500, 85000, 87000, 88500, 90000, 92000, 93500, 95000, 97000, 53 + 98500, 100000, 102000, 103500, 105000, 107000, 109000, 111000, 113000, 54 + 115000, 117000, 118500, 120000, 122000, 123500, 125000, 54 55 }; 55 56 56 57 /* OMAP4430 data */
+7 -3
drivers/thermal/ti-soc-thermal/omap4xxx-bandgap.h
··· 53 53 * and thresholds for OMAP4430. 54 54 */ 55 55 56 - /* ADC conversion table limits */ 57 - #define OMAP4430_ADC_START_VALUE 0 58 - #define OMAP4430_ADC_END_VALUE 127 56 + /* 57 + * ADC conversion table limits. Ignore values outside the TRM listed 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 63 /* bandgap clock limits (no control on 4430) */ 60 64 #define OMAP4430_MAX_FREQ 32768 61 65 #define OMAP4430_MIN_FREQ 32768
+1
drivers/thunderbolt/switch.c
··· 684 684 if (res == -ENODEV) { 685 685 tb_dbg(port->sw->tb, " Port %d: not implemented\n", 686 686 port->port); 687 + port->disabled = true; 687 688 return 0; 688 689 } 689 690 return res;
+1 -1
drivers/thunderbolt/tb.h
··· 186 186 * @cap_adap: Offset of the adapter specific capability (%0 if not present) 187 187 * @cap_usb4: Offset to the USB4 port capability (%0 if not present) 188 188 * @port: Port number on switch 189 - * @disabled: Disabled by eeprom 189 + * @disabled: Disabled by eeprom or enabled but not implemented 190 190 * @bonded: true if the port is bonded (two lanes combined as one) 191 191 * @dual_link_port: If the switch is connected using two ports, points 192 192 * to the other port.
+10 -2
drivers/thunderbolt/tunnel.c
··· 951 951 int ret, max_rate, allocate_up, allocate_down; 952 952 953 953 ret = usb4_usb3_port_actual_link_rate(tunnel->src_port); 954 - if (ret <= 0) { 955 - tb_tunnel_warn(tunnel, "tunnel is not up\n"); 954 + if (ret < 0) { 955 + tb_tunnel_warn(tunnel, "failed to read actual link rate\n"); 956 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 967 * 90% of the max rate can be allocated for isochronous 960 968 * transfers.
+42 -49
drivers/usb/core/message.c
··· 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 1237 * usb_disable_device - Disable all the endpoints for a USB device 1210 1238 * @dev: the device whose endpoints are being disabled ··· 1246 1218 void usb_disable_device(struct usb_device *dev, int skip_ep0) 1247 1219 { 1248 1220 int i; 1249 - struct usb_hcd *hcd = bus_to_hcd(dev->bus); 1250 1221 1251 1222 /* getting rid of interfaces will disconnect 1252 1223 * any drivers bound to them (a key side effect) ··· 1291 1264 1292 1265 dev_dbg(&dev->dev, "%s nuking %s URBs\n", __func__, 1293 1266 skip_ep0 ? "non-ep0" : "all"); 1294 - if (hcd->driver->check_bandwidth) { 1295 - /* First pass: Cancel URBs, leave endpoint pointers intact. */ 1296 - for (i = skip_ep0; i < 16; ++i) { 1297 - usb_disable_endpoint(dev, i, false); 1298 - usb_disable_endpoint(dev, i + USB_DIR_IN, false); 1299 - } 1300 - /* Remove endpoints from the host controller internal state */ 1301 - mutex_lock(hcd->bandwidth_mutex); 1302 - usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); 1303 - mutex_unlock(hcd->bandwidth_mutex); 1304 - /* Second pass: remove endpoint pointers */ 1305 - } 1306 - for (i = skip_ep0; i < 16; ++i) { 1307 - usb_disable_endpoint(dev, i, true); 1308 - usb_disable_endpoint(dev, i + USB_DIR_IN, true); 1309 - } 1267 + 1268 + usb_disable_device_endpoints(dev, skip_ep0); 1310 1269 } 1311 1270 1312 1271 /** ··· 1535 1522 * The caller must own the device lock. 1536 1523 * 1537 1524 * Return: Zero on success, else a negative error code. 1525 + * 1526 + * If this routine fails the device will probably be in an unusable state 1527 + * with endpoints disabled, and interfaces only partially enabled. 1538 1528 */ 1539 1529 int usb_reset_configuration(struct usb_device *dev) 1540 1530 { ··· 1553 1537 * calls during probe() are fine 1554 1538 */ 1555 1539 1556 - for (i = 1; i < 16; ++i) { 1557 - usb_disable_endpoint(dev, i, true); 1558 - usb_disable_endpoint(dev, i + USB_DIR_IN, true); 1559 - } 1540 + usb_disable_device_endpoints(dev, 1); /* skip ep0*/ 1560 1541 1561 1542 config = dev->actconfig; 1562 1543 retval = 0; ··· 1566 1553 mutex_unlock(hcd->bandwidth_mutex); 1567 1554 return -ENOMEM; 1568 1555 } 1569 - /* Make sure we have enough bandwidth for each alternate setting 0 */ 1570 - for (i = 0; i < config->desc.bNumInterfaces; i++) { 1571 - struct usb_interface *intf = config->interface[i]; 1572 - struct usb_host_interface *alt; 1573 1556 1574 - alt = usb_altnum_to_altsetting(intf, 0); 1575 - if (!alt) 1576 - alt = &intf->altsetting[0]; 1577 - if (alt != intf->cur_altsetting) 1578 - retval = usb_hcd_alloc_bandwidth(dev, NULL, 1579 - intf->cur_altsetting, alt); 1580 - if (retval < 0) 1581 - break; 1582 - } 1583 - /* If not, reinstate the old alternate settings */ 1557 + /* xHCI adds all endpoints in usb_hcd_alloc_bandwidth */ 1558 + retval = usb_hcd_alloc_bandwidth(dev, config, NULL, NULL); 1584 1559 if (retval < 0) { 1585 - reset_old_alts: 1586 - for (i--; i >= 0; i--) { 1587 - struct usb_interface *intf = config->interface[i]; 1588 - struct usb_host_interface *alt; 1589 - 1590 - alt = usb_altnum_to_altsetting(intf, 0); 1591 - if (!alt) 1592 - alt = &intf->altsetting[0]; 1593 - if (alt != intf->cur_altsetting) 1594 - usb_hcd_alloc_bandwidth(dev, NULL, 1595 - alt, intf->cur_altsetting); 1596 - } 1597 1560 usb_enable_lpm(dev); 1598 1561 mutex_unlock(hcd->bandwidth_mutex); 1599 1562 return retval; ··· 1578 1589 USB_REQ_SET_CONFIGURATION, 0, 1579 1590 config->desc.bConfigurationValue, 0, 1580 1591 NULL, 0, USB_CTRL_SET_TIMEOUT); 1581 - if (retval < 0) 1582 - goto reset_old_alts; 1592 + if (retval < 0) { 1593 + usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); 1594 + usb_enable_lpm(dev); 1595 + mutex_unlock(hcd->bandwidth_mutex); 1596 + return retval; 1597 + } 1583 1598 mutex_unlock(hcd->bandwidth_mutex); 1584 1599 1585 1600 /* re-init hc/hcd interface/endpoint state */
+5
drivers/usb/core/sysfs.c
··· 889 889 size_t srclen, n; 890 890 int cfgno; 891 891 void *src; 892 + int retval; 892 893 894 + retval = usb_lock_device_interruptible(udev); 895 + if (retval < 0) 896 + return -EINTR; 893 897 /* The binary attribute begins with the device descriptor. 894 898 * Following that are the raw descriptor entries for all the 895 899 * configurations (config plus subsidiary descriptors). ··· 918 914 off -= srclen; 919 915 } 920 916 } 917 + usb_unlock_device(udev); 921 918 return count - nleft; 922 919 } 923 920
+6 -9
drivers/usb/dwc3/dwc3-meson-g12a.c
··· 737 737 goto err_disable_clks; 738 738 } 739 739 740 - ret = reset_control_deassert(priv->reset); 740 + ret = reset_control_reset(priv->reset); 741 741 if (ret) 742 - goto err_assert_reset; 742 + goto err_disable_clks; 743 743 744 744 ret = dwc3_meson_g12a_get_phys(priv); 745 745 if (ret) 746 - goto err_assert_reset; 746 + goto err_disable_clks; 747 747 748 748 ret = priv->drvdata->setup_regmaps(priv, base); 749 749 if (ret) ··· 752 752 if (priv->vbus) { 753 753 ret = regulator_enable(priv->vbus); 754 754 if (ret) 755 - goto err_assert_reset; 755 + goto err_disable_clks; 756 756 } 757 757 758 758 /* Get dr_mode */ ··· 765 765 766 766 ret = priv->drvdata->usb_init(priv); 767 767 if (ret) 768 - goto err_assert_reset; 768 + goto err_disable_clks; 769 769 770 770 /* Init PHYs */ 771 771 for (i = 0 ; i < PHY_COUNT ; ++i) { 772 772 ret = phy_init(priv->phys[i]); 773 773 if (ret) 774 - goto err_assert_reset; 774 + goto err_disable_clks; 775 775 } 776 776 777 777 /* Set PHY Power */ ··· 808 808 err_phys_exit: 809 809 for (i = 0 ; i < PHY_COUNT ; ++i) 810 810 phy_exit(priv->phys[i]); 811 - 812 - err_assert_reset: 813 - reset_control_assert(priv->reset); 814 811 815 812 err_disable_clks: 816 813 clk_bulk_disable_unprepare(priv->drvdata->num_clks,
+1
drivers/usb/serial/ftdi_sio.c
··· 713 713 { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, 714 714 { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, 715 715 { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) }, 716 + { USB_DEVICE(XSENS_VID, XSENS_MTIUSBCONVERTER_PID) }, 716 717 { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, 717 718 { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, 718 719 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
+1
drivers/usb/serial/ftdi_sio_ids.h
··· 160 160 #define XSENS_AWINDA_DONGLE_PID 0x0102 161 161 #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ 162 162 #define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */ 163 + #define XSENS_MTIUSBCONVERTER_PID 0x0301 /* MTi USB converter */ 163 164 #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ 164 165 165 166 /* Xsens devices using FTDI VID */
+14 -8
drivers/usb/serial/option.c
··· 1094 1094 { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M), 1095 1095 .driver_info = RSVD(1) | RSVD(3) }, 1096 1096 /* Quectel products using Quectel vendor ID */ 1097 - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21), 1098 - .driver_info = RSVD(4) }, 1099 - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25), 1100 - .driver_info = RSVD(4) }, 1101 - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95), 1102 - .driver_info = RSVD(4) }, 1103 - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), 1104 - .driver_info = RSVD(4) }, 1097 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0xff, 0xff), 1098 + .driver_info = NUMEP2 }, 1099 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21, 0xff, 0, 0) }, 1100 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0xff, 0xff), 1101 + .driver_info = NUMEP2 }, 1102 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25, 0xff, 0, 0) }, 1103 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG95, 0xff, 0xff, 0xff), 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 1109 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), 1106 1110 .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, 1107 1111 { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, ··· 1823 1819 { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */ 1824 1820 { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */ 1825 1821 .driver_info = RSVD(7) }, 1822 + { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9205, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT+ECM mode */ 1823 + { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9206, 0xff) }, /* Simcom SIM7070/SIM7080/SIM7090 AT-only mode */ 1826 1824 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), 1827 1825 .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) }, 1828 1826 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D),
+2 -12
drivers/usb/typec/mux/intel_pmc_mux.c
··· 61 61 62 62 #define PMC_USB_ALTMODE_ORI_SHIFT 1 63 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 65 /* DP specific Mode Data bits */ 68 66 #define PMC_USB_ALTMODE_DP_MODE_SHIFT 8 69 67 70 68 /* TBT specific Mode Data bits */ 71 - #define PMC_USB_ALTMODE_HPD_HIGH BIT(14) 72 69 #define PMC_USB_ALTMODE_TBT_TYPE BIT(17) 73 70 #define PMC_USB_ALTMODE_CABLE_TYPE BIT(18) 74 71 #define PMC_USB_ALTMODE_ACTIVE_LINK BIT(20) ··· 176 179 req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; 177 180 req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; 178 181 179 - req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; 180 - req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; 181 - 182 182 req.mode_data |= (state->mode - TYPEC_STATE_MODAL) << 183 183 PMC_USB_ALTMODE_DP_MODE_SHIFT; 184 - 185 - if (data->status & DP_STATUS_HPD_STATE) 186 - req.mode_data |= PMC_USB_ALTMODE_HPD_HIGH; 187 184 188 185 ret = pmc_usb_command(port, (void *)&req, sizeof(req)); 189 186 if (ret) ··· 202 211 203 212 req.mode_data = (port->orientation - 1) << PMC_USB_ALTMODE_ORI_SHIFT; 204 213 req.mode_data |= (port->role - 1) << PMC_USB_ALTMODE_UFP_SHIFT; 205 - 206 - req.mode_data |= sbu_orientation(port) << PMC_USB_ALTMODE_ORI_AUX_SHIFT; 207 - req.mode_data |= hsl_orientation(port) << PMC_USB_ALTMODE_ORI_HSL_SHIFT; 208 214 209 215 if (TBT_ADAPTER(data->device_mode) == TBT_ADAPTER_TBT3) 210 216 req.mode_data |= PMC_USB_ALTMODE_TBT_TYPE; ··· 485 497 for (i = 0; i < pmc->num_ports; i++) { 486 498 typec_switch_unregister(pmc->port[i].typec_sw); 487 499 typec_mux_unregister(pmc->port[i].typec_mux); 500 + usb_role_switch_unregister(pmc->port[i].usb_sw); 488 501 } 489 502 490 503 return ret; ··· 499 510 for (i = 0; i < pmc->num_ports; i++) { 500 511 typec_switch_unregister(pmc->port[i].typec_sw); 501 512 typec_mux_unregister(pmc->port[i].typec_mux); 513 + usb_role_switch_unregister(pmc->port[i].usb_sw); 502 514 } 503 515 504 516 return 0;
+4
drivers/usb/typec/ucsi/ucsi_acpi.c
··· 112 112 113 113 static int ucsi_acpi_probe(struct platform_device *pdev) 114 114 { 115 + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); 115 116 struct ucsi_acpi *ua; 116 117 struct resource *res; 117 118 acpi_status status; 118 119 int ret; 120 + 121 + if (adev->dep_unmet) 122 + return -EPROBE_DEFER; 119 123 120 124 ua = devm_kzalloc(&pdev->dev, sizeof(*ua), GFP_KERNEL); 121 125 if (!ua)
+1 -1
drivers/vhost/vhost.c
··· 2537 2537 if (!vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX)) { 2538 2538 r = vhost_update_used_flags(vq); 2539 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 2541 &vq->used->flags, r); 2542 2542 } 2543 2543 }
+1 -1
drivers/video/fbdev/vga16fb.c
··· 1121 1121 char oldop = setop(0); 1122 1122 char oldsr = setsr(0); 1123 1123 char oldmask = selectmask(); 1124 - const char *cdat = image->data; 1124 + const unsigned char *cdat = image->data; 1125 1125 u32 dx = image->dx; 1126 1126 char __iomem *where; 1127 1127 int y;
+10
drivers/xen/Kconfig
··· 325 325 config XEN_FRONT_PGDIR_SHBUF 326 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 338 endmenu
+1
drivers/xen/Makefile
··· 41 41 xen-gntalloc-y := gntalloc.o 42 42 xen-privcmd-y := privcmd.o privcmd-buf.o 43 43 obj-$(CONFIG_XEN_FRONT_PGDIR_SHBUF) += xen-front-pgdir-shbuf.o 44 + obj-$(CONFIG_XEN_UNPOPULATED_ALLOC) += unpopulated-alloc.o
+2 -2
drivers/xen/balloon.c
··· 653 653 } 654 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 657 static void __init balloon_add_region(unsigned long start_pfn, 658 658 unsigned long pages) 659 659 { ··· 707 707 register_sysctl_table(xen_root); 708 708 #endif 709 709 710 - #ifdef CONFIG_XEN_PV 710 + #if defined(CONFIG_XEN_PV) && !defined(CONFIG_XEN_UNPOPULATED_ALLOC) 711 711 { 712 712 int i; 713 713
+2 -2
drivers/xen/grant-table.c
··· 801 801 { 802 802 int ret; 803 803 804 - ret = alloc_xenballooned_pages(nr_pages, pages); 804 + ret = xen_alloc_unpopulated_pages(nr_pages, pages); 805 805 if (ret < 0) 806 806 return ret; 807 807 ··· 836 836 void gnttab_free_pages(int nr_pages, struct page **pages) 837 837 { 838 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 841 EXPORT_SYMBOL_GPL(gnttab_free_pages); 842 842
+2 -2
drivers/xen/privcmd.c
··· 424 424 if (pages == NULL) 425 425 return -ENOMEM; 426 426 427 - rc = alloc_xenballooned_pages(numpgs, pages); 427 + rc = xen_alloc_unpopulated_pages(numpgs, pages); 428 428 if (rc != 0) { 429 429 pr_warn("%s Could not alloc %d pfns rc:%d\n", __func__, 430 430 numpgs, rc); ··· 895 895 896 896 rc = xen_unmap_domain_gfn_range(vma, numgfns, pages); 897 897 if (rc == 0) 898 - free_xenballooned_pages(numpgs, pages); 898 + xen_free_unpopulated_pages(numpgs, pages); 899 899 else 900 900 pr_crit("unable to unmap MFN range: leaking %d pages. rc=%d\n", 901 901 numpgs, rc);
+183
drivers/xen/unpopulated-alloc.c
··· 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
+3 -3
drivers/xen/xenbus/xenbus_client.c
··· 621 621 bool leaked = false; 622 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 625 if (err) 626 626 goto out_err; 627 627 ··· 662 662 addr, nr_pages); 663 663 out_free_ballooned_pages: 664 664 if (!leaked) 665 - free_xenballooned_pages(nr_pages, node->hvm.pages); 665 + xen_free_unpopulated_pages(nr_pages, node->hvm.pages); 666 666 out_err: 667 667 return err; 668 668 } ··· 858 858 info.addrs); 859 859 if (!rv) { 860 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 863 else 864 864 WARN(1, "Leaking %p, size %u page(s)\n", vaddr, nr_pages);
+2 -2
drivers/xen/xlate_mmu.c
··· 232 232 kfree(pages); 233 233 return -ENOMEM; 234 234 } 235 - rc = alloc_xenballooned_pages(nr_pages, pages); 235 + rc = xen_alloc_unpopulated_pages(nr_pages, pages); 236 236 if (rc) { 237 237 pr_warn("%s Couldn't balloon alloc %ld pages rc:%d\n", __func__, 238 238 nr_pages, rc); ··· 249 249 if (!vaddr) { 250 250 pr_warn("%s Couldn't map %ld pages rc:%d\n", __func__, 251 251 nr_pages, rc); 252 - free_xenballooned_pages(nr_pages, pages); 252 + xen_free_unpopulated_pages(nr_pages, pages); 253 253 kfree(pages); 254 254 kfree(pfns); 255 255 return -ENOMEM;
+27
fs/affs/amigaffs.c
··· 420 420 u32 prot = AFFS_I(inode)->i_protect; 421 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 443 if (!(mode & 0100)) 424 444 prot |= FIBF_NOEXECUTE; 425 445 if (!(mode & 0400)) 426 446 prot |= FIBF_NOREAD; 427 447 if (!(mode & 0200)) 428 448 prot |= FIBF_NOWRITE; 449 + 450 + /* Multi-user extended flags. Not inverted. */ 429 451 if (mode & 0010) 430 452 prot |= FIBF_GRP_EXECUTE; 431 453 if (mode & 0040) 432 454 prot |= FIBF_GRP_READ; 433 455 if (mode & 0020) 434 456 prot |= FIBF_GRP_WRITE; 457 + if (mode & 0070) 458 + prot |= FIBF_GRP_DELETE; 459 + 435 460 if (mode & 0001) 436 461 prot |= FIBF_OTR_EXECUTE; 437 462 if (mode & 0004) 438 463 prot |= FIBF_OTR_READ; 439 464 if (mode & 0002) 440 465 prot |= FIBF_OTR_WRITE; 466 + if (mode & 0007) 467 + prot |= FIBF_OTR_DELETE; 441 468 442 469 AFFS_I(inode)->i_protect = prot; 443 470 }
+25 -1
fs/affs/file.c
··· 429 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 450 static sector_t _affs_bmap(struct address_space *mapping, sector_t block) 433 451 { 434 452 return generic_block_bmap(mapping,block,affs_get_block); ··· 456 438 .readpage = affs_readpage, 457 439 .writepage = affs_writepage, 458 440 .write_begin = affs_write_begin, 459 - .write_end = generic_write_end, 441 + .write_end = affs_write_end, 460 442 .direct_IO = affs_direct_IO, 461 443 .bmap = _affs_bmap 462 444 }; ··· 812 794 tmp = (page->index << PAGE_SHIFT) + from; 813 795 if (tmp > inode->i_size) 814 796 inode->i_size = AFFS_I(inode)->mmu_private = tmp; 797 + 798 + /* Clear Archived bit on file writes, as AmigaOS would do */ 799 + if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) { 800 + AFFS_I(inode)->i_protect &= ~FIBF_ARCHIVED; 801 + mark_inode_dirty(inode); 802 + } 815 803 816 804 err_first_bh: 817 805 unlock_page(page);
+2 -2
fs/afs/fs_probe.c
··· 161 161 } 162 162 } 163 163 164 - rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall); 165 - if (rtt_us < server->probe.rtt) { 164 + if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) && 165 + rtt_us < server->probe.rtt) { 166 166 server->probe.rtt = rtt_us; 167 167 server->rtt = rtt_us; 168 168 alist->preferred = index;
+8 -6
fs/afs/internal.h
··· 401 401 #define AFS_VLSERVER_FL_PROBED 0 /* The VL server has been probed */ 402 402 #define AFS_VLSERVER_FL_PROBING 1 /* VL server is being probed */ 403 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 405 rwlock_t lock; /* Lock on addresses */ 405 406 atomic_t usage; 407 + unsigned int rtt; /* Server's current RTT in uS */ 406 408 407 409 /* Probe state */ 408 410 wait_queue_head_t probe_wq; 409 411 atomic_t probe_outstanding; 410 412 spinlock_t probe_lock; 411 413 struct { 412 - unsigned int rtt; /* RTT as ktime/64 */ 414 + unsigned int rtt; /* RTT in uS */ 413 415 u32 abort_code; 414 416 short error; 415 - bool have_result; 416 - bool responded:1; 417 - bool is_yfs:1; 418 - bool not_yfs:1; 419 - bool local_failure:1; 417 + unsigned short flags; 418 + #define AFS_VLSERVER_PROBE_RESPONDED 0x01 /* At least once response (may be abort) */ 419 + #define AFS_VLSERVER_PROBE_IS_YFS 0x02 /* The peer appears to be YFS */ 420 + #define AFS_VLSERVER_PROBE_NOT_YFS 0x04 /* The peer appears not to be YFS */ 421 + #define AFS_VLSERVER_PROBE_LOCAL_FAILURE 0x08 /* A local failure prevented a probe */ 420 422 } probe; 421 423 422 424 u16 port;
+5
fs/afs/proc.c
··· 310 310 alist->preferred == i ? '>' : '-', 311 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 318 return 0; 314 319 } 315 320
+1
fs/afs/vl_list.c
··· 21 21 rwlock_init(&vlserver->lock); 22 22 init_waitqueue_head(&vlserver->probe_wq); 23 23 spin_lock_init(&vlserver->probe_lock); 24 + vlserver->rtt = UINT_MAX; 24 25 vlserver->name_len = name_len; 25 26 vlserver->port = port; 26 27 memcpy(vlserver->name, name, name_len);
+52 -32
fs/afs/vl_probe.c
··· 11 11 #include "internal.h" 12 12 #include "protocol_yfs.h" 13 13 14 - static bool afs_vl_probe_done(struct afs_vlserver *server) 15 - { 16 - if (!atomic_dec_and_test(&server->probe_outstanding)) 17 - return false; 18 14 19 - wake_up_var(&server->probe_outstanding); 15 + /* 16 + * Handle the completion of a set of probes. 17 + */ 18 + static void afs_finished_vl_probe(struct afs_vlserver *server) 19 + { 20 + if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)) { 21 + server->rtt = UINT_MAX; 22 + clear_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags); 23 + } 24 + 20 25 clear_bit_unlock(AFS_VLSERVER_FL_PROBING, &server->flags); 21 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 /* ··· 63 45 server->probe.error = 0; 64 46 goto responded; 65 47 case -ECONNABORTED: 66 - if (!server->probe.responded) { 48 + if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED)) { 67 49 server->probe.abort_code = call->abort_code; 68 50 server->probe.error = ret; 69 51 } 70 52 goto responded; 71 53 case -ENOMEM: 72 54 case -ENONET: 73 - server->probe.local_failure = true; 74 - afs_io_error(call, afs_io_error_vl_probe_fail); 55 + case -EKEYEXPIRED: 56 + case -EKEYREVOKED: 57 + case -EKEYREJECTED: 58 + server->probe.flags |= AFS_VLSERVER_PROBE_LOCAL_FAILURE; 59 + if (server->probe.error == 0) 60 + server->probe.error = ret; 61 + trace_afs_io_error(call->debug_id, ret, afs_io_error_vl_probe_fail); 75 62 goto out; 76 63 case -ECONNRESET: /* Responded, but call expired. */ 77 64 case -ERFKILL: ··· 90 67 default: 91 68 clear_bit(index, &alist->responded); 92 69 set_bit(index, &alist->failed); 93 - if (!server->probe.responded && 70 + if (!(server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) && 94 71 (server->probe.error == 0 || 95 72 server->probe.error == -ETIMEDOUT || 96 73 server->probe.error == -ETIME)) 97 74 server->probe.error = ret; 98 - afs_io_error(call, afs_io_error_vl_probe_fail); 75 + trace_afs_io_error(call->debug_id, ret, afs_io_error_vl_probe_fail); 99 76 goto out; 100 77 } 101 78 ··· 104 81 clear_bit(index, &alist->failed); 105 82 106 83 if (call->service_id == YFS_VL_SERVICE) { 107 - server->probe.is_yfs = true; 84 + server->probe.flags |= AFS_VLSERVER_PROBE_IS_YFS; 108 85 set_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags); 109 86 alist->addrs[index].srx_service = call->service_id; 110 87 } else { 111 - server->probe.not_yfs = true; 112 - if (!server->probe.is_yfs) { 88 + server->probe.flags |= AFS_VLSERVER_PROBE_NOT_YFS; 89 + if (!(server->probe.flags & AFS_VLSERVER_PROBE_IS_YFS)) { 113 90 clear_bit(AFS_VLSERVER_FL_IS_YFS, &server->flags); 114 91 alist->addrs[index].srx_service = call->service_id; 115 92 } 116 93 } 117 94 118 - rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall); 119 - if (rtt_us < server->probe.rtt) { 95 + if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) && 96 + rtt_us < server->probe.rtt) { 120 97 server->probe.rtt = rtt_us; 98 + server->rtt = rtt_us; 121 99 alist->preferred = index; 122 - have_result = true; 123 100 } 124 101 125 102 smp_wmb(); /* Set rtt before responded. */ 126 - server->probe.responded = true; 103 + server->probe.flags |= AFS_VLSERVER_PROBE_RESPONDED; 127 104 set_bit(AFS_VLSERVER_FL_PROBED, &server->flags); 105 + set_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags); 106 + have_result = true; 128 107 out: 129 108 spin_unlock(&server->probe_lock); 130 109 131 110 _debug("probe [%u][%u] %pISpc rtt=%u ret=%d", 132 111 server_index, index, &alist->addrs[index].transport, rtt_us, ret); 133 112 134 - have_result |= afs_vl_probe_done(server); 135 - if (have_result) { 136 - server->probe.have_result = true; 137 - wake_up_var(&server->probe.have_result); 138 - wake_up_all(&server->probe_wq); 139 - } 113 + afs_done_one_vl_probe(server, have_result); 140 114 } 141 115 142 116 /* ··· 171 151 in_progress = true; 172 152 } else { 173 153 afs_prioritise_error(_e, PTR_ERR(call), ac.abort_code); 154 + afs_done_one_vl_probe(server, false); 174 155 } 175 156 } 176 157 177 - if (!in_progress) 178 - afs_vl_probe_done(server); 179 158 return in_progress; 180 159 } 181 160 ··· 212 193 { 213 194 struct wait_queue_entry *waits; 214 195 struct afs_vlserver *server; 215 - unsigned int rtt = UINT_MAX; 196 + unsigned int rtt = UINT_MAX, rtt_s; 216 197 bool have_responders = false; 217 198 int pref = -1, i; 218 199 ··· 224 205 server = vllist->servers[i].server; 225 206 if (!test_bit(AFS_VLSERVER_FL_PROBING, &server->flags)) 226 207 __clear_bit(i, &untried); 227 - if (server->probe.responded) 208 + if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) 228 209 have_responders = true; 229 210 } 230 211 } ··· 250 231 for (i = 0; i < vllist->nr_servers; i++) { 251 232 if (test_bit(i, &untried)) { 252 233 server = vllist->servers[i].server; 253 - if (server->probe.responded) 234 + if (server->probe.flags & AFS_VLSERVER_PROBE_RESPONDED) 254 235 goto stop; 255 236 if (test_bit(AFS_VLSERVER_FL_PROBING, &server->flags)) 256 237 still_probing = true; ··· 268 249 for (i = 0; i < vllist->nr_servers; i++) { 269 250 if (test_bit(i, &untried)) { 270 251 server = vllist->servers[i].server; 271 - if (server->probe.responded && 272 - server->probe.rtt < rtt) { 252 + rtt_s = READ_ONCE(server->rtt); 253 + if (test_bit(AFS_VLSERVER_FL_RESPONDING, &server->flags) && 254 + rtt_s < rtt) { 273 255 pref = i; 274 - rtt = server->probe.rtt; 256 + rtt = rtt_s; 275 257 } 276 258 277 259 remove_wait_queue(&server->probe_wq, &waits[i]);
+6 -1
fs/afs/vl_rotate.c
··· 192 192 for (i = 0; i < vc->server_list->nr_servers; i++) { 193 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 197 continue; 197 198 if (s->probe.rtt < rtt) { 198 199 vc->index = i; ··· 263 262 for (i = 0; i < vc->server_list->nr_servers; i++) { 264 263 struct afs_vlserver *s = vc->server_list->servers[i].server; 265 264 265 + if (test_bit(AFS_VLSERVER_FL_RESPONDING, &s->flags)) 266 + e.responded = true; 266 267 afs_prioritise_error(&e, READ_ONCE(s->probe.error), 267 268 s->probe.abort_code); 268 269 } 270 + 271 + error = e.error; 269 272 270 273 failed_set_error: 271 274 vc->error = error;
+3 -1
fs/btrfs/block-group.c
··· 1798 1798 1799 1799 cache->fs_info = fs_info; 1800 1800 cache->full_stripe_len = btrfs_full_stripe_len(fs_info, start); 1801 - set_free_space_tree_thresholds(cache); 1802 1801 1803 1802 cache->discard_index = BTRFS_DISCARD_INDEX_UNUSED; 1804 1803 ··· 1910 1911 ret = read_block_group_item(cache, path, key); 1911 1912 if (ret < 0) 1912 1913 goto error; 1914 + 1915 + set_free_space_tree_thresholds(cache); 1913 1916 1914 1917 if (need_clear) { 1915 1918 /* ··· 2133 2132 return -ENOMEM; 2134 2133 2135 2134 cache->length = size; 2135 + set_free_space_tree_thresholds(cache); 2136 2136 cache->used = bytes_used; 2137 2137 cache->flags = type; 2138 2138 cache->last_byte_to_unpin = (u64)-1;
+5 -1
fs/btrfs/ctree.c
··· 1297 1297 btrfs_tree_read_unlock_blocking(eb); 1298 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 1302 btrfs_tree_read_lock(eb_rewin); 1301 1303 __tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm); 1302 1304 WARN_ON(btrfs_header_nritems(eb_rewin) > ··· 1372 1370 1373 1371 if (!eb) 1374 1372 return NULL; 1375 - btrfs_tree_read_lock(eb); 1376 1373 if (old_root) { 1377 1374 btrfs_set_header_bytenr(eb, eb->start); 1378 1375 btrfs_set_header_backref_rev(eb, BTRFS_MIXED_BACKREF_REV); ··· 1379 1378 btrfs_set_header_level(eb, old_root->level); 1380 1379 btrfs_set_header_generation(eb, old_generation); 1381 1380 } 1381 + btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb), eb, 1382 + btrfs_header_level(eb)); 1383 + btrfs_tree_read_lock(eb); 1382 1384 if (tm) 1383 1385 __tree_mod_log_rewind(fs_info, eb, time_seq, tm); 1384 1386 else
+2
fs/btrfs/disk-io.c
··· 3418 3418 btrfs_put_block_group_cache(fs_info); 3419 3419 3420 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 3423 free_root_pointers(fs_info, true); 3422 3424 invalidate_inode_pages2(fs_info->btree_inode->i_mapping); 3423 3425
+10 -11
fs/btrfs/extent-tree.c
··· 400 400 if (type == BTRFS_SHARED_BLOCK_REF_KEY) { 401 401 ASSERT(eb->fs_info); 402 402 /* 403 - * Every shared one has parent tree 404 - * block, which must be aligned to 405 - * nodesize. 403 + * Every shared one has parent tree block, 404 + * which must be aligned to sector size. 406 405 */ 407 406 if (offset && 408 - IS_ALIGNED(offset, eb->fs_info->nodesize)) 407 + IS_ALIGNED(offset, eb->fs_info->sectorsize)) 409 408 return type; 410 409 } 411 410 } else if (is_data == BTRFS_REF_TYPE_DATA) { ··· 413 414 if (type == BTRFS_SHARED_DATA_REF_KEY) { 414 415 ASSERT(eb->fs_info); 415 416 /* 416 - * Every shared one has parent tree 417 - * block, which must be aligned to 418 - * nodesize. 417 + * Every shared one has parent tree block, 418 + * which must be aligned to sector size. 419 419 */ 420 420 if (offset && 421 - IS_ALIGNED(offset, eb->fs_info->nodesize)) 421 + IS_ALIGNED(offset, eb->fs_info->sectorsize)) 422 422 return type; 423 423 } 424 424 } else { ··· 427 429 } 428 430 429 431 btrfs_print_leaf((struct extent_buffer *)eb); 430 - btrfs_err(eb->fs_info, "eb %llu invalid extent inline ref type %d", 431 - eb->start, type); 432 + btrfs_err(eb->fs_info, 433 + "eb %llu iref 0x%lx invalid extent inline ref type %d", 434 + eb->start, (unsigned long)iref, type); 432 435 WARN_ON(1); 433 436 434 437 return BTRFS_REF_TYPE_INVALID; ··· 4526 4527 return ERR_PTR(-EUCLEAN); 4527 4528 } 4528 4529 4529 - btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level); 4530 + btrfs_set_buffer_lockdep_class(owner, buf, level); 4530 4531 btrfs_tree_lock(buf); 4531 4532 btrfs_clean_tree_block(buf); 4532 4533 clear_bit(EXTENT_BUFFER_STALE, &buf->bflags);
+4 -4
fs/btrfs/extent_io.c
··· 5655 5655 } 5656 5656 } 5657 5657 5658 - int read_extent_buffer_to_user(const struct extent_buffer *eb, 5659 - void __user *dstv, 5660 - unsigned long start, unsigned long len) 5658 + int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb, 5659 + void __user *dstv, 5660 + unsigned long start, unsigned long len) 5661 5661 { 5662 5662 size_t cur; 5663 5663 size_t offset; ··· 5677 5677 5678 5678 cur = min(len, (PAGE_SIZE - offset)); 5679 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 5681 ret = -EFAULT; 5682 5682 break; 5683 5683 }
+3 -3
fs/btrfs/extent_io.h
··· 241 241 void read_extent_buffer(const struct extent_buffer *eb, void *dst, 242 242 unsigned long start, 243 243 unsigned long len); 244 - int read_extent_buffer_to_user(const struct extent_buffer *eb, 245 - void __user *dst, unsigned long start, 246 - unsigned long len); 244 + int read_extent_buffer_to_user_nofault(const struct extent_buffer *eb, 245 + void __user *dst, unsigned long start, 246 + unsigned long len); 247 247 void write_extent_buffer_fsid(const struct extent_buffer *eb, const void *src); 248 248 void write_extent_buffer_chunk_tree_uuid(const struct extent_buffer *eb, 249 249 const void *src);
+4
fs/btrfs/free-space-tree.c
··· 22 22 size_t bitmap_size; 23 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 30 * We convert to bitmaps when the disk space required for using extents 27 31 * exceeds that required for using bitmaps.
+20 -7
fs/btrfs/ioctl.c
··· 2086 2086 sh.len = item_len; 2087 2087 sh.transid = found_transid; 2088 2088 2089 - /* copy search result header */ 2090 - if (copy_to_user(ubuf + *sk_offset, &sh, sizeof(sh))) { 2091 - ret = -EFAULT; 2089 + /* 2090 + * Copy search result header. If we fault then loop again so we 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 2097 goto out; 2093 2098 } 2094 2099 ··· 2101 2096 2102 2097 if (item_len) { 2103 2098 char __user *up = ubuf + *sk_offset; 2104 - /* copy the item */ 2105 - if (read_extent_buffer_to_user(leaf, up, 2106 - item_off, item_len)) { 2107 - ret = -EFAULT; 2099 + /* 2100 + * Copy the item, same behavior as above, but reset the 2101 + * * sk_offset so we copy the full thing again. 2102 + */ 2103 + if (read_extent_buffer_to_user_nofault(leaf, up, 2104 + item_off, item_len)) { 2105 + ret = 0; 2106 + *sk_offset -= sizeof(sh); 2108 2107 goto out; 2109 2108 } 2110 2109 ··· 2193 2184 key.offset = sk->min_offset; 2194 2185 2195 2186 while (1) { 2187 + ret = fault_in_pages_writeable(ubuf, *buf_size - sk_offset); 2188 + if (ret) 2189 + break; 2190 + 2196 2191 ret = btrfs_search_forward(root, &key, path, sk->min_transid); 2197 2192 if (ret != 0) { 2198 2193 if (ret > 0)
+7 -5
fs/btrfs/print-tree.c
··· 95 95 * offset is supposed to be a tree block which 96 96 * must be aligned to nodesize. 97 97 */ 98 - if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) 99 - pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n", 100 - offset, (unsigned long long)eb->fs_info->nodesize); 98 + if (!IS_ALIGNED(offset, eb->fs_info->sectorsize)) 99 + pr_info( 100 + "\t\t\t(parent %llu not aligned to sectorsize %u)\n", 101 + offset, eb->fs_info->sectorsize); 101 102 break; 102 103 case BTRFS_EXTENT_DATA_REF_KEY: 103 104 dref = (struct btrfs_extent_data_ref *)(&iref->offset); ··· 113 112 * must be aligned to nodesize. 114 113 */ 115 114 if (!IS_ALIGNED(offset, eb->fs_info->nodesize)) 116 - pr_info("\t\t\t(parent %llu is NOT ALIGNED to nodesize %llu)\n", 117 - offset, (unsigned long long)eb->fs_info->nodesize); 115 + pr_info( 116 + "\t\t\t(parent %llu not aligned to sectorsize %u)\n", 117 + offset, eb->fs_info->sectorsize); 118 118 break; 119 119 default: 120 120 pr_cont("(extent %llu has INVALID ref type %d)\n",
+72 -54
fs/btrfs/scrub.c
··· 3716 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 3743 * get a reference count on fs_info->scrub_workers. start worker if necessary 3721 3744 */ 3722 3745 static noinline_for_stack int scrub_workers_get(struct btrfs_fs_info *fs_info, 3723 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 3751 unsigned int flags = WQ_FREEZABLE | WQ_UNBOUND; 3726 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 3758 + scrub_workers = btrfs_alloc_workqueue(fs_info, "scrub", flags, 3759 + is_dev_replace ? 1 : max_active, 4); 3760 + if (!scrub_workers) 3761 + goto fail_scrub_workers; 3762 + 3763 + scrub_wr_comp = btrfs_alloc_workqueue(fs_info, "scrubwrc", flags, 3764 + max_active, 2); 3765 + if (!scrub_wr_comp) 3766 + goto fail_scrub_wr_completion_workers; 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); 3730 3774 if (refcount_read(&fs_info->scrub_workers_refcnt) == 0) { 3731 - ASSERT(fs_info->scrub_workers == NULL); 3732 - fs_info->scrub_workers = btrfs_alloc_workqueue(fs_info, "scrub", 3733 - flags, is_dev_replace ? 1 : max_active, 4); 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 - 3744 - ASSERT(fs_info->scrub_parity_workers == NULL); 3745 - fs_info->scrub_parity_workers = 3746 - btrfs_alloc_workqueue(fs_info, "scrubparity", flags, 3747 - max_active, 2); 3748 - if (!fs_info->scrub_parity_workers) 3749 - goto fail_scrub_parity_workers; 3750 - 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 3781 refcount_set(&fs_info->scrub_workers_refcnt, 1); 3752 - } else { 3753 - refcount_inc(&fs_info->scrub_workers_refcnt); 3782 + mutex_unlock(&fs_info->scrub_lock); 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 3791 fail_scrub_parity_workers: 3758 - btrfs_destroy_workqueue(fs_info->scrub_wr_completion_workers); 3792 + btrfs_destroy_workqueue(scrub_wr_comp); 3759 3793 fail_scrub_wr_completion_workers: 3760 - btrfs_destroy_workqueue(fs_info->scrub_workers); 3794 + btrfs_destroy_workqueue(scrub_workers); 3761 3795 fail_scrub_workers: 3762 - return -ENOMEM; 3796 + return ret; 3763 3797 } 3764 3798 3765 3799 int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, ··· 3804 3770 int ret; 3805 3771 struct btrfs_device *dev; 3806 3772 unsigned int nofs_flag; 3807 - struct btrfs_workqueue *scrub_workers = NULL; 3808 - struct btrfs_workqueue *scrub_wr_comp = NULL; 3809 - struct btrfs_workqueue *scrub_parity = NULL; 3810 3773 3811 3774 if (btrfs_fs_closing(fs_info)) 3812 3775 return -EAGAIN; ··· 3850 3819 if (IS_ERR(sctx)) 3851 3820 return PTR_ERR(sctx); 3852 3821 3822 + ret = scrub_workers_get(fs_info, is_dev_replace); 3823 + if (ret) 3824 + goto out_free_ctx; 3825 + 3853 3826 mutex_lock(&fs_info->fs_devices->device_list_mutex); 3854 3827 dev = btrfs_find_device(fs_info->fs_devices, devid, NULL, NULL, true); 3855 3828 if (!dev || (test_bit(BTRFS_DEV_STATE_MISSING, &dev->dev_state) && 3856 3829 !is_dev_replace)) { 3857 3830 mutex_unlock(&fs_info->fs_devices->device_list_mutex); 3858 3831 ret = -ENODEV; 3859 - goto out_free_ctx; 3832 + goto out; 3860 3833 } 3861 3834 3862 3835 if (!is_dev_replace && !readonly && ··· 3869 3834 btrfs_err_in_rcu(fs_info, "scrub: device %s is not writable", 3870 3835 rcu_str_deref(dev->name)); 3871 3836 ret = -EROFS; 3872 - goto out_free_ctx; 3837 + goto out; 3873 3838 } 3874 3839 3875 3840 mutex_lock(&fs_info->scrub_lock); ··· 3878 3843 mutex_unlock(&fs_info->scrub_lock); 3879 3844 mutex_unlock(&fs_info->fs_devices->device_list_mutex); 3880 3845 ret = -EIO; 3881 - goto out_free_ctx; 3846 + goto out; 3882 3847 } 3883 3848 3884 3849 down_read(&fs_info->dev_replace.rwsem); ··· 3889 3854 mutex_unlock(&fs_info->scrub_lock); 3890 3855 mutex_unlock(&fs_info->fs_devices->device_list_mutex); 3891 3856 ret = -EINPROGRESS; 3892 - goto out_free_ctx; 3857 + goto out; 3893 3858 } 3894 3859 up_read(&fs_info->dev_replace.rwsem); 3895 - 3896 - ret = scrub_workers_get(fs_info, is_dev_replace); 3897 - if (ret) { 3898 - mutex_unlock(&fs_info->scrub_lock); 3899 - mutex_unlock(&fs_info->fs_devices->device_list_mutex); 3900 - goto out_free_ctx; 3901 - } 3902 3860 3903 3861 sctx->readonly = readonly; 3904 3862 dev->scrub_ctx = sctx; ··· 3945 3917 3946 3918 mutex_lock(&fs_info->scrub_lock); 3947 3919 dev->scrub_ctx = NULL; 3948 - if (refcount_dec_and_test(&fs_info->scrub_workers_refcnt)) { 3949 - scrub_workers = fs_info->scrub_workers; 3950 - scrub_wr_comp = fs_info->scrub_wr_completion_workers; 3951 - scrub_parity = fs_info->scrub_parity_workers; 3952 - 3953 - fs_info->scrub_workers = NULL; 3954 - fs_info->scrub_wr_completion_workers = NULL; 3955 - fs_info->scrub_parity_workers = NULL; 3956 - } 3957 3920 mutex_unlock(&fs_info->scrub_lock); 3958 3921 3959 - btrfs_destroy_workqueue(scrub_workers); 3960 - btrfs_destroy_workqueue(scrub_wr_comp); 3961 - btrfs_destroy_workqueue(scrub_parity); 3922 + scrub_workers_put(fs_info); 3962 3923 scrub_put_ctx(sctx); 3963 3924 3964 3925 return ret; 3965 - 3926 + out: 3927 + scrub_workers_put(fs_info); 3966 3928 out_free_ctx: 3967 3929 scrub_free_ctx(sctx); 3968 3930
+1
fs/btrfs/transaction.c
··· 1636 1636 pending->snap = btrfs_get_new_fs_root(fs_info, objectid, pending->anon_dev); 1637 1637 if (IS_ERR(pending->snap)) { 1638 1638 ret = PTR_ERR(pending->snap); 1639 + pending->snap = NULL; 1639 1640 btrfs_abort_transaction(trans, ret); 1640 1641 goto fail; 1641 1642 }
+1 -1
fs/btrfs/tree-checker.c
··· 984 984 /* Note for ROOT_TREE_DIR_ITEM, mkfs could set its transid 0 */ 985 985 if (btrfs_inode_transid(leaf, iitem) > super_gen + 1) { 986 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 988 btrfs_inode_transid(leaf, iitem), super_gen + 1); 989 989 return -EUCLEAN; 990 990 }
+12 -1
fs/btrfs/volumes.c
··· 4 4 */ 5 5 6 6 #include <linux/sched.h> 7 + #include <linux/sched/mm.h> 7 8 #include <linux/bio.h> 8 9 #include <linux/slab.h> 9 10 #include <linux/blkdev.h> ··· 4463 4462 goto skip; 4464 4463 } 4465 4464 update_tree: 4465 + btrfs_release_path(path); 4466 4466 if (!btrfs_is_empty_uuid(root_item.uuid)) { 4467 4467 ret = btrfs_uuid_tree_add(trans, root_item.uuid, 4468 4468 BTRFS_UUID_KEY_SUBVOL, ··· 4488 4486 } 4489 4487 4490 4488 skip: 4489 + btrfs_release_path(path); 4491 4490 if (trans) { 4492 4491 ret = btrfs_end_transaction(trans); 4493 4492 trans = NULL; ··· 4496 4493 break; 4497 4494 } 4498 4495 4499 - btrfs_release_path(path); 4500 4496 if (key.offset < (u64)-1) { 4501 4497 key.offset++; 4502 4498 } else if (key.type < BTRFS_ROOT_ITEM_KEY) { ··· 6485 6483 u64 devid, u8 *dev_uuid) 6486 6484 { 6487 6485 struct btrfs_device *device; 6486 + unsigned int nofs_flag; 6488 6487 6488 + /* 6489 + * We call this under the chunk_mutex, so we want to use NOFS for this 6490 + * allocation, however we don't want to change btrfs_alloc_device() to 6491 + * always do NOFS because we use it in a lot of other GFP_KERNEL safe 6492 + * places. 6493 + */ 6494 + nofs_flag = memalloc_nofs_save(); 6489 6495 device = btrfs_alloc_device(NULL, &devid, dev_uuid); 6496 + memalloc_nofs_restore(nofs_flag); 6490 6497 if (IS_ERR(device)) 6491 6498 return device; 6492 6499
+4
fs/cifs/inode.c
··· 1017 1017 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MODE_FROM_SID) { 1018 1018 rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, true, 1019 1019 full_path, fid); 1020 + if (rc == -EREMOTE) 1021 + rc = 0; 1020 1022 if (rc) { 1021 1023 cifs_dbg(FYI, "%s: Get mode from SID failed. rc=%d\n", 1022 1024 __func__, rc); ··· 1027 1025 } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { 1028 1026 rc = cifs_acl_to_fattr(cifs_sb, &fattr, *inode, false, 1029 1027 full_path, fid); 1028 + if (rc == -EREMOTE) 1029 + rc = 0; 1030 1030 if (rc) { 1031 1031 cifs_dbg(FYI, "%s: Getting ACL failed with error: %d\n", 1032 1032 __func__, rc);
+2 -2
fs/debugfs/file.c
··· 177 177 goto out; 178 178 179 179 if (!fops_get(real_fops)) { 180 - #ifdef MODULE 180 + #ifdef CONFIG_MODULES 181 181 if (real_fops->owner && 182 182 real_fops->owner->state == MODULE_STATE_GOING) 183 183 goto out; ··· 312 312 goto out; 313 313 314 314 if (!fops_get(real_fops)) { 315 - #ifdef MODULE 315 + #ifdef CONFIG_MODULES 316 316 if (real_fops->owner && 317 317 real_fops->owner->state == MODULE_STATE_GOING) 318 318 goto out;
+3 -3
fs/eventpoll.c
··· 1995 1995 * during ep_insert(). 1996 1996 */ 1997 1997 if (list_empty(&epi->ffd.file->f_tfile_llink)) { 1998 - get_file(epi->ffd.file); 1999 - list_add(&epi->ffd.file->f_tfile_llink, 2000 - &tfile_check_list); 1998 + if (get_file_rcu(epi->ffd.file)) 1999 + list_add(&epi->ffd.file->f_tfile_llink, 2000 + &tfile_check_list); 2001 2001 } 2002 2002 } 2003 2003 }
+4 -2
fs/ext2/file.c
··· 93 93 struct inode *inode = file_inode(vmf->vma->vm_file); 94 94 struct ext2_inode_info *ei = EXT2_I(inode); 95 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 100 sb_start_pagefault(inode->i_sb); 99 101 file_update_time(vmf->vma->vm_file); 100 102 } ··· 105 103 ret = dax_iomap_fault(vmf, PE_SIZE_PTE, NULL, NULL, &ext2_iomap_ops); 106 104 107 105 up_read(&ei->dax_sem); 108 - if (vmf->flags & FAULT_FLAG_WRITE) 106 + if (write) 109 107 sb_end_pagefault(inode->i_sb); 110 108 return ret; 111 109 }
+3
fs/f2fs/data.c
··· 3550 3550 unsigned long align = offset | iov_iter_alignment(iter); 3551 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 3556 if (align & blocksize_mask) { 3554 3557 if (bdev) 3555 3558 blkbits = blksize_bits(bdev_logical_block_size(bdev));
+3
fs/f2fs/node.c
··· 2373 2373 if (unlikely(nid >= nm_i->max_nid)) 2374 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 2379 /* Enough entries */ 2377 2380 if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK) 2378 2381 return 0;
+4 -4
fs/f2fs/segment.c
··· 799 799 800 800 if (__is_large_section(sbi)) { 801 801 unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); 802 - unsigned short valid_blocks = 802 + block_t valid_blocks = 803 803 get_valid_blocks(sbi, segno, true); 804 804 805 805 f2fs_bug_on(sbi, unlikely(!valid_blocks || ··· 815 815 enum dirty_type dirty_type) 816 816 { 817 817 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); 818 - unsigned short valid_blocks; 818 + block_t valid_blocks; 819 819 820 820 if (test_and_clear_bit(segno, dirty_i->dirty_segmap[dirty_type])) 821 821 dirty_i->nr_dirty[dirty_type]--; ··· 4316 4316 struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); 4317 4317 struct free_segmap_info *free_i = FREE_I(sbi); 4318 4318 unsigned int segno = 0, offset = 0, secno; 4319 - unsigned short valid_blocks; 4320 - unsigned short blks_per_sec = BLKS_PER_SEC(sbi); 4319 + block_t valid_blocks; 4320 + block_t blks_per_sec = BLKS_PER_SEC(sbi); 4321 4321 4322 4322 while (1) { 4323 4323 /* find dirty segment based on free segmap */
+64 -4
fs/io_uring.c
··· 2300 2300 static bool io_rw_reissue(struct io_kiocb *req, long res) 2301 2301 { 2302 2302 #ifdef CONFIG_BLOCK 2303 + umode_t mode = file_inode(req->file)->i_mode; 2303 2304 int ret; 2304 2305 2306 + if (!S_ISBLK(mode) && !S_ISREG(mode)) 2307 + return false; 2305 2308 if ((res != -EAGAIN && res != -EOPNOTSUPP) || io_wq_current_is_worker()) 2306 2309 return false; 2307 2310 ··· 2980 2977 bool force_nonblock) 2981 2978 { 2982 2979 struct io_async_rw *iorw = &req->io->rw; 2980 + struct iovec *iov; 2983 2981 ssize_t ret; 2984 2982 2985 - iorw->iter.iov = iorw->fast_iov; 2986 - ret = __io_import_iovec(rw, req, (struct iovec **) &iorw->iter.iov, 2987 - &iorw->iter, !force_nonblock); 2983 + iorw->iter.iov = iov = iorw->fast_iov; 2984 + ret = __io_import_iovec(rw, req, &iov, &iorw->iter, !force_nonblock); 2988 2985 if (unlikely(ret < 0)) 2989 2986 return ret; 2990 2987 2988 + iorw->iter.iov = iov; 2991 2989 io_req_map_rw(req, iorw->iter.iov, iorw->fast_iov, &iorw->iter); 2992 2990 return 0; 2993 2991 } ··· 3150 3146 /* IOPOLL retry should happen for io-wq threads */ 3151 3147 if (!force_nonblock && !(req->ctx->flags & IORING_SETUP_IOPOLL)) 3152 3148 goto done; 3149 + /* no retry on NONBLOCK marked file */ 3150 + if (req->file->f_flags & O_NONBLOCK) 3151 + goto done; 3153 3152 /* some cases will consume bytes even on error returns */ 3154 3153 iov_iter_revert(iter, iov_count - iov_iter_count(iter)); 3155 3154 ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false); ··· 3294 3287 */ 3295 3288 if (ret2 == -EOPNOTSUPP && (kiocb->ki_flags & IOCB_NOWAIT)) 3296 3289 ret2 = -EAGAIN; 3290 + /* no retry on NONBLOCK marked file */ 3291 + if (ret2 == -EAGAIN && (req->file->f_flags & O_NONBLOCK)) 3292 + goto done; 3297 3293 if (!force_nonblock || ret2 != -EAGAIN) { 3298 3294 /* IOPOLL retry should happen for io-wq threads */ 3299 3295 if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN) 3300 3296 goto copy_iov; 3297 + done: 3301 3298 kiocb_done(kiocb, ret2, cs); 3302 3299 } else { 3303 3300 copy_iov: ··· 7335 7324 table = &ctx->file_data->table[i >> IORING_FILE_TABLE_SHIFT]; 7336 7325 index = i & IORING_FILE_TABLE_MASK; 7337 7326 if (table->files[index]) { 7338 - file = io_file_from_index(ctx, index); 7327 + file = table->files[index]; 7339 7328 err = io_queue_file_removal(data, file); 7340 7329 if (err) 7341 7330 break; ··· 7364 7353 table->files[index] = file; 7365 7354 err = io_sqe_file_register(ctx, file, i); 7366 7355 if (err) { 7356 + table->files[index] = NULL; 7367 7357 fput(file); 7368 7358 break; 7369 7359 } ··· 8024 8012 return false; 8025 8013 } 8026 8014 8015 + static inline bool io_match_files(struct io_kiocb *req, 8016 + struct files_struct *files) 8017 + { 8018 + return (req->flags & REQ_F_WORK_INITIALIZED) && req->work.files == files; 8019 + } 8020 + 8021 + static bool io_match_link_files(struct io_kiocb *req, 8022 + struct files_struct *files) 8023 + { 8024 + struct io_kiocb *link; 8025 + 8026 + if (io_match_files(req, files)) 8027 + return true; 8028 + if (req->flags & REQ_F_LINK_HEAD) { 8029 + list_for_each_entry(link, &req->link_list, link_list) { 8030 + if (io_match_files(link, files)) 8031 + return true; 8032 + } 8033 + } 8034 + return false; 8035 + } 8036 + 8027 8037 /* 8028 8038 * We're looking to cancel 'req' because it's holding on to our files, but 8029 8039 * 'req' could be a link to another request. See if it is, and cancel that ··· 8120 8086 io_timeout_remove_link(ctx, req); 8121 8087 } 8122 8088 8089 + static void io_cancel_defer_files(struct io_ring_ctx *ctx, 8090 + struct files_struct *files) 8091 + { 8092 + struct io_defer_entry *de = NULL; 8093 + LIST_HEAD(list); 8094 + 8095 + spin_lock_irq(&ctx->completion_lock); 8096 + list_for_each_entry_reverse(de, &ctx->defer_list, list) { 8097 + if (io_match_link_files(de->req, files)) { 8098 + list_cut_position(&list, &ctx->defer_list, &de->list); 8099 + break; 8100 + } 8101 + } 8102 + spin_unlock_irq(&ctx->completion_lock); 8103 + 8104 + while (!list_empty(&list)) { 8105 + de = list_first_entry(&list, struct io_defer_entry, list); 8106 + list_del_init(&de->list); 8107 + req_set_fail_links(de->req); 8108 + io_put_req(de->req); 8109 + io_req_complete(de->req, -ECANCELED); 8110 + kfree(de); 8111 + } 8112 + } 8113 + 8123 8114 static void io_uring_cancel_files(struct io_ring_ctx *ctx, 8124 8115 struct files_struct *files) 8125 8116 { 8126 8117 if (list_empty_careful(&ctx->inflight_list)) 8127 8118 return; 8128 8119 8120 + io_cancel_defer_files(ctx, files); 8129 8121 /* cancel all at once, should be faster than doing it one by one*/ 8130 8122 io_wq_cancel_cb(ctx->io_wq, io_wq_files_match, files, true); 8131 8123
+9 -2
fs/nfs/nfs4proc.c
··· 3293 3293 3294 3294 /* Servers should only apply open mode checks for file size changes */ 3295 3295 truncate = (arg->iap->ia_valid & ATTR_SIZE) ? true : false; 3296 - if (!truncate) 3296 + if (!truncate) { 3297 + nfs4_inode_make_writeable(inode); 3297 3298 goto zero_stateid; 3299 + } 3298 3300 3299 3301 if (nfs4_copy_delegation_stateid(inode, FMODE_WRITE, &arg->stateid, &delegation_cred)) { 3300 3302 /* Use that stateid */ ··· 7300 7298 err = nfs4_set_lock_state(state, fl); 7301 7299 if (err != 0) 7302 7300 return err; 7303 - err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW); 7301 + do { 7302 + err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW); 7303 + if (err != -NFS4ERR_DELAY) 7304 + break; 7305 + ssleep(1); 7306 + } while (err == -NFS4ERR_DELAY); 7304 7307 return nfs4_handle_delegation_recall_error(server, state, stateid, fl, err); 7305 7308 } 7306 7309
+5 -3
fs/xfs/libxfs/xfs_attr_leaf.c
··· 653 653 ASSERT(ifp->if_flags & XFS_IFINLINE); 654 654 } 655 655 xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK); 656 - hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; 657 - hdr->count = 0; 656 + hdr = (struct xfs_attr_sf_hdr *)ifp->if_u1.if_data; 657 + memset(hdr, 0, sizeof(*hdr)); 658 658 hdr->totsize = cpu_to_be16(sizeof(*hdr)); 659 659 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); 660 660 } ··· 1036 1036 * struct xfs_attr_sf_entry has a variable length. 1037 1037 * Check the fixed-offset parts of the structure are 1038 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 1043 return __this_address; 1042 1044 1043 1045 /* Don't allow names with known bad length. */
+1 -1
fs/xfs/libxfs/xfs_bmap.c
··· 6226 6226 6227 6227 isrt = XFS_IS_REALTIME_INODE(ip); 6228 6228 endfsb = irec->br_startblock + irec->br_blockcount - 1; 6229 - if (isrt) { 6229 + if (isrt && whichfork == XFS_DATA_FORK) { 6230 6230 if (!xfs_verify_rtbno(mp, irec->br_startblock)) 6231 6231 return __this_address; 6232 6232 if (!xfs_verify_rtbno(mp, endfsb))
+2 -2
fs/xfs/libxfs/xfs_ialloc.c
··· 688 688 args.minalignslop = igeo->cluster_align - 1; 689 689 690 690 /* Allow space for the inode btree to split. */ 691 - args.minleft = igeo->inobt_maxlevels - 1; 691 + args.minleft = igeo->inobt_maxlevels; 692 692 if ((error = xfs_alloc_vextent(&args))) 693 693 return error; 694 694 ··· 736 736 /* 737 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 740 if ((error = xfs_alloc_vextent(&args))) 741 741 return error; 742 742 }
+1 -1
fs/xfs/libxfs/xfs_trans_space.h
··· 58 58 #define XFS_IALLOC_SPACE_RES(mp) \ 59 59 (M_IGEO(mp)->ialloc_blks + \ 60 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 64 * Space reservation values for various transactions.
+1 -1
fs/xfs/xfs_bmap_util.c
··· 1165 1165 goto out_trans_cancel; 1166 1166 1167 1167 do { 1168 - error = xfs_trans_roll_inode(&tp, ip); 1168 + error = xfs_defer_finish(&tp); 1169 1169 if (error) 1170 1170 goto out_trans_cancel; 1171 1171
+10 -2
fs/xfs/xfs_file.c
··· 1223 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 1234 static vm_fault_t 1227 1235 xfs_filemap_fault( 1228 1236 struct vm_fault *vmf) ··· 1238 1230 /* DAX can shortcut the normal fault path on write faults! */ 1239 1231 return __xfs_filemap_fault(vmf, PE_SIZE_PTE, 1240 1232 IS_DAX(file_inode(vmf->vma->vm_file)) && 1241 - (vmf->flags & FAULT_FLAG_WRITE)); 1233 + xfs_is_write_fault(vmf)); 1242 1234 } 1243 1235 1244 1236 static vm_fault_t ··· 1251 1243 1252 1244 /* DAX can shortcut the normal fault path on write faults! */ 1253 1245 return __xfs_filemap_fault(vmf, pe_size, 1254 - (vmf->flags & FAULT_FLAG_WRITE)); 1246 + xfs_is_write_fault(vmf)); 1255 1247 } 1256 1248 1257 1249 static vm_fault_t
+3
include/drm/drm_hdcp.h
··· 29 29 /* Slave address for the HDCP registers in the receiver */ 30 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 35 /* HDCP register offsets for HDMI/DVI devices */ 33 36 #define DRM_HDCP_DDC_BKSV 0x00 34 37 #define DRM_HDCP_DDC_RI_PRIME 0x08
+8 -1
include/linux/bvec.h
··· 117 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 126 #define for_each_bvec(bvl, bio_vec, iter, start) \ 121 127 for (iter = (start); \ 122 128 (iter).bi_size && \ 123 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 133 /* for iterating one bio from start to end */ 127 134 #define BVEC_ITER_ALL_INIT (struct bvec_iter) \
+1 -7
include/linux/compiler_attributes.h
··· 22 22 23 23 /* 24 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 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 28 #ifndef __has_attribute 35 29 # define __has_attribute(x) __GCC4_has_attribute_##x
+2 -2
include/linux/compiler_types.h
··· 11 11 # define __iomem __attribute__((noderef, address_space(__iomem))) 12 12 # define __percpu __attribute__((noderef, address_space(__percpu))) 13 13 # define __rcu __attribute__((noderef, address_space(__rcu))) 14 - extern void __chk_user_ptr(const volatile void __user *); 15 - extern void __chk_io_ptr(const volatile void __iomem *); 14 + static inline void __chk_user_ptr(const volatile void __user *ptr) { } 15 + static inline void __chk_io_ptr(const volatile void __iomem *ptr) { } 16 16 /* context/locking */ 17 17 # define __must_hold(x) __attribute__((context(x,1,1))) 18 18 # define __acquires(x) __attribute__((context(x,0,1)))
+1
include/linux/device.h
··· 454 454 * @pm_domain: Provide callbacks that are executed during system suspend, 455 455 * hibernation, system resume and during runtime PM transitions 456 456 * along with subsystem-level and driver-level callbacks. 457 + * @em_pd: device's energy model performance domain 457 458 * @pins: For device pin management. 458 459 * See Documentation/driver-api/pinctl.rst for details. 459 460 * @msi_list: Hosts MSI descriptors
+16 -4
include/linux/dynamic_debug.h
··· 49 49 50 50 51 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 56 int ddebug_add_module(struct _ddebug *tab, unsigned int n, 53 57 const char *modname); 54 58 extern int ddebug_remove_module(const char *mod_name); ··· 109 105 static_branch_unlikely(&descriptor.key.dd_key_false) 110 106 #endif 111 107 112 - #else /* !HAVE_JUMP_LABEL */ 108 + #else /* !CONFIG_JUMP_LABEL */ 113 109 114 110 #define _DPRINTK_KEY_INIT 115 111 ··· 121 117 unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) 122 118 #endif 123 119 124 - #endif 120 + #endif /* CONFIG_JUMP_LABEL */ 125 121 126 122 #define __dynamic_func_call(id, fmt, func, ...) do { \ 127 123 DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt); \ ··· 176 172 KERN_DEBUG, prefix_str, prefix_type, \ 177 173 rowsize, groupsize, buf, len, ascii) 178 174 179 - #else 175 + #else /* !CONFIG_DYNAMIC_DEBUG_CORE */ 180 176 181 177 #include <linux/string.h> 182 178 #include <linux/errno.h> 179 + #include <linux/printk.h> 183 180 184 181 static inline int ddebug_add_module(struct _ddebug *tab, unsigned int n, 185 182 const char *modname) ··· 215 210 print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, \ 216 211 rowsize, groupsize, buf, len, ascii); \ 217 212 } while (0) 218 - #endif 213 + 214 + static inline int dynamic_debug_exec_queries(const char *query, const char *modname) 215 + { 216 + pr_warn("kernel not built with CONFIG_DYNAMIC_DEBUG_CORE\n"); 217 + return 0; 218 + } 219 + 220 + #endif /* !CONFIG_DYNAMIC_DEBUG_CORE */ 219 221 220 222 #endif
+2 -4
include/linux/efi_embedded_fw.h
··· 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 12 - * implementation they are in this header for use by lib/test_firmware.c only! 11 + * This struct is private to the efi-embedded fw implementation. 12 + * They are in this header for use by lib/test_firmware.c only! 13 13 */ 14 14 struct efi_embedded_fw { 15 15 struct list_head list; ··· 17 17 const u8 *data; 18 18 size_t length; 19 19 }; 20 - 21 - extern struct list_head efi_embedded_fw_list; 22 20 23 21 /** 24 22 * struct efi_embedded_fw_desc - This struct is used by the EFI embedded-fw
+42 -9
include/linux/entry-common.h
··· 110 110 #endif 111 111 112 112 /** 113 - * syscall_enter_from_user_mode - Check and handle work before invoking 114 - * a syscall 113 + * syscall_enter_from_user_mode_prepare - Establish state and enable interrupts 114 + * @regs: Pointer to currents pt_regs 115 + * 116 + * Invoked from architecture specific syscall entry code with interrupts 117 + * disabled. The calling code has to be non-instrumentable. When the 118 + * function returns all state is correct, interrupts are enabled and the 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 115 131 * @regs: Pointer to currents pt_regs 116 132 * @syscall: The syscall number 117 133 * 118 134 * Invoked from architecture specific syscall entry code with interrupts 119 - * disabled. The calling code has to be non-instrumentable. When the 120 - * function returns all state is correct and the subsequent functions can be 121 - * instrumented. 135 + * enabled after invoking syscall_enter_from_user_mode_prepare() and extra 136 + * architecture specific work. 122 137 * 123 138 * Returns: The original or a modified syscall number 124 139 * ··· 142 127 * syscall_set_return_value() first. If neither of those are called and -1 143 128 * is returned, then the syscall will fail with ENOSYS. 144 129 * 145 - * The following functionality is handled here: 130 + * It handles the following work items: 146 131 * 147 - * 1) Establish state (lockdep, RCU (context tracking), tracing) 148 - * 2) TIF flag dependent invocations of arch_syscall_enter_tracehook(), 132 + * 1) TIF flag dependent invocations of arch_syscall_enter_tracehook(), 149 133 * __secure_computing(), trace_sys_enter() 150 - * 3) Invocation of audit_syscall_entry() 134 + * 2) Invocation of audit_syscall_entry() 135 + */ 136 + long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall); 137 + 138 + /** 139 + * syscall_enter_from_user_mode - Establish state and check and handle work 140 + * before invoking a syscall 141 + * @regs: Pointer to currents pt_regs 142 + * @syscall: The syscall number 143 + * 144 + * Invoked from architecture specific syscall entry code with interrupts 145 + * disabled. The calling code has to be non-instrumentable. When the 146 + * function returns all state is correct, interrupts are enabled and the 147 + * subsequent functions can be instrumented. 148 + * 149 + * This is combination of syscall_enter_from_user_mode_prepare() and 150 + * syscall_enter_from_user_mode_work(). 151 + * 152 + * Returns: The original or a modified syscall number. See 153 + * syscall_enter_from_user_mode_work() for further explanation. 151 154 */ 152 155 long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall); 153 156
+29 -13
include/linux/hid.h
··· 959 959 * @max: maximal valid usage->code to consider later (out parameter) 960 960 * @type: input event type (EV_KEY, EV_REL, ...) 961 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 967 static inline void hid_map_usage(struct hid_input *hidinput, 964 968 struct hid_usage *usage, unsigned long **bit, int *max, 965 - __u8 type, __u16 c) 969 + __u8 type, unsigned int c) 966 970 { 967 971 struct input_dev *input = hidinput->input; 968 - 969 - usage->type = type; 970 - usage->code = c; 972 + unsigned long *bmap = NULL; 973 + unsigned int limit = 0; 971 974 972 975 switch (type) { 973 976 case EV_ABS: 974 - *bit = input->absbit; 975 - *max = ABS_MAX; 977 + bmap = input->absbit; 978 + limit = ABS_MAX; 976 979 break; 977 980 case EV_REL: 978 - *bit = input->relbit; 979 - *max = REL_MAX; 981 + bmap = input->relbit; 982 + limit = REL_MAX; 980 983 break; 981 984 case EV_KEY: 982 - *bit = input->keybit; 983 - *max = KEY_MAX; 985 + bmap = input->keybit; 986 + limit = KEY_MAX; 984 987 break; 985 988 case EV_LED: 986 - *bit = input->ledbit; 987 - *max = LED_MAX; 989 + bmap = input->ledbit; 990 + limit = LED_MAX; 988 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 /** ··· 1015 1000 __u8 type, __u16 c) 1016 1001 { 1017 1002 hid_map_usage(hidinput, usage, bit, max, type, c); 1018 - clear_bit(c, *bit); 1003 + if (*bit) 1004 + clear_bit(usage->code, *bit); 1019 1005 } 1020 1006 1021 1007 /**
+15
include/linux/i2c-algo-pca.h
··· 53 53 #define I2C_PCA_CON_SI 0x08 /* Serial Interrupt */ 54 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 70 struct i2c_algo_pca_data { 57 71 void *data; /* private low level data */ 58 72 void (*write_byte) (void *data, int reg, int val); ··· 78 64 * For PCA9665, use the frequency you want here. */ 79 65 unsigned int i2c_clock; 80 66 unsigned int chip; 67 + struct pca_i2c_bus_settings bus_settings; 81 68 }; 82 69 83 70 int i2c_pca_add_bus(struct i2c_adapter *);
-7
include/linux/ksm.h
··· 53 53 54 54 void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc); 55 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 57 #else /* !CONFIG_KSM */ 60 58 ··· 85 87 86 88 static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) 87 89 { 88 - } 89 - static inline bool reuse_ksm_page(struct page *page, 90 - struct vm_area_struct *vma, unsigned long address) 91 - { 92 - return false; 93 90 } 94 91 #endif /* CONFIG_MMU */ 95 92 #endif /* !CONFIG_KSM */
+26 -5
include/linux/kvm_host.h
··· 749 749 int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, 750 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 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 756 int __ret = -EFAULT; \ 757 757 \ 758 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 780 if (!__ret) \ 761 781 mark_page_dirty(kvm, gfn); \ 762 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 787 gpa_t __gpa = gpa; \ 768 788 struct kvm *__kvm = kvm; \ 789 + \ 769 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 794 int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
+1
include/linux/libata.h
··· 421 421 ATA_HORKAGE_NO_DMA_LOG = (1 << 23), /* don't use DMA for log read */ 422 422 ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ 423 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 426 /* DMA mask for user DMA control: User visible values; DO NOT 426 427 renumber */
+1 -1
include/linux/log2.h
··· 173 173 #define roundup_pow_of_two(n) \ 174 174 ( \ 175 175 __builtin_constant_p(n) ? ( \ 176 - (n == 1) ? 1 : \ 176 + ((n) == 1) ? 1 : \ 177 177 (1UL << (ilog2((n) - 1) + 1)) \ 178 178 ) : \ 179 179 __roundup_pow_of_two(n) \
+4 -5
include/linux/memremap.h
··· 46 46 * wakeup is used to coordinate physical address space management (ex: 47 47 * fs truncate/hole punch) vs pinned pages (ex: device dma). 48 48 * 49 - * MEMORY_DEVICE_DEVDAX: 49 + * MEMORY_DEVICE_GENERIC: 50 50 * Host memory that has similar access semantics as System RAM i.e. DMA 51 - * coherent and supports page pinning. In contrast to 52 - * MEMORY_DEVICE_FS_DAX, this memory is access via a device-dax 53 - * character device. 51 + * coherent and supports page pinning. This is for example used by DAX devices 52 + * that expose memory using a character device. 54 53 * 55 54 * MEMORY_DEVICE_PCI_P2PDMA: 56 55 * Device memory residing in a PCI BAR intended for use with Peer-to-Peer ··· 59 60 /* 0 is reserved to catch uninitialized type fields */ 60 61 MEMORY_DEVICE_PRIVATE = 1, 61 62 MEMORY_DEVICE_FS_DAX, 62 - MEMORY_DEVICE_DEVDAX, 63 + MEMORY_DEVICE_GENERIC, 63 64 MEMORY_DEVICE_PCI_P2PDMA, 64 65 }; 65 66
+11 -4
include/linux/mlx5/port.h
··· 125 125 MLX5E_CONNECTOR_TYPE_NUMBER, 126 126 }; 127 127 128 + enum mlx5_ptys_width { 129 + MLX5_PTYS_WIDTH_1X = 1 << 0, 130 + MLX5_PTYS_WIDTH_2X = 1 << 1, 131 + MLX5_PTYS_WIDTH_4X = 1 << 2, 132 + MLX5_PTYS_WIDTH_8X = 1 << 3, 133 + MLX5_PTYS_WIDTH_12X = 1 << 4, 134 + }; 135 + 128 136 #define MLX5E_PROT_MASK(link_mode) (1 << link_mode) 129 137 #define MLX5_GET_ETH_PROTO(reg, out, ext, field) \ 130 138 (ext ? MLX5_GET(reg, out, ext_##field) : \ ··· 141 133 int mlx5_set_port_caps(struct mlx5_core_dev *dev, u8 port_num, u32 caps); 142 134 int mlx5_query_port_ptys(struct mlx5_core_dev *dev, u32 *ptys, 143 135 int ptys_size, int proto_mask, u8 local_port); 144 - int mlx5_query_port_link_width_oper(struct mlx5_core_dev *dev, 145 - u8 *link_width_oper, u8 local_port); 146 - int mlx5_query_port_ib_proto_oper(struct mlx5_core_dev *dev, 147 - u8 *proto_oper, u8 local_port); 136 + 137 + int mlx5_query_ib_port_oper(struct mlx5_core_dev *dev, u16 *link_width_oper, 138 + u16 *proto_oper, u8 local_port); 148 139 void mlx5_toggle_port_link(struct mlx5_core_dev *dev); 149 140 int mlx5_set_port_admin_status(struct mlx5_core_dev *dev, 150 141 enum mlx5_port_status status);
+2
include/linux/netfilter/nf_conntrack_sctp.h
··· 9 9 enum sctp_conntrack state; 10 10 11 11 __be32 vtag[IP_CT_DIR_MAX]; 12 + u8 last_dir; 13 + u8 flags; 12 14 }; 13 15 14 16 #endif /* _NF_CONNTRACK_SCTP_H */
+1 -2
include/linux/netfilter/nfnetlink.h
··· 43 43 int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, 44 44 unsigned int group, int echo, gfp_t flags); 45 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, 47 - int flags); 46 + int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid); 48 47 49 48 static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type) 50 49 {
+5 -6
include/linux/powercap.h
··· 44 44 }; 45 45 46 46 /** 47 - * struct powercap_control_type- Defines a powercap control_type 48 - * @name: name of control_type 47 + * struct powercap_control_type - Defines a powercap control_type 49 48 * @dev: device for this control_type 50 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 51 * @ops: Pointer to callback struct 53 - * @node_lock: mutex for control type 52 + * @lock: mutex for control type 54 53 * @allocated: This is possible that client owns the memory 55 54 * used by this structure. In this case 56 55 * this flag is set to false by framework to 57 56 * prevent deallocation during release process. 58 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 60 * Defines powercap control_type. This acts as a container for power 62 61 * zones, which use same method to control power. E.g. RAPL, RAPL-PCI etc. ··· 128 129 * this flag is set to false by framework to 129 130 * prevent deallocation during release process. 130 131 * Otherwise this flag is set to true. 131 - * @constraint_ptr: List of constraints for this zone. 132 + * @constraints: List of constraints for this zone. 132 133 * 133 134 * This defines a power zone instance. The fields of this structure are 134 135 * private, and should not be used by client drivers.
+11 -2
include/linux/skbuff.h
··· 71 71 * NETIF_F_IPV6_CSUM - Driver (device) is only able to checksum plain 72 72 * TCP or UDP packets over IPv6. These are specifically 73 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 75 * header is either TCP or UDP. IPv6 extension headers 76 76 * are not supported with this feature. This feature 77 77 * cannot be set in features for a device with ··· 1056 1056 void kfree_skb_list(struct sk_buff *segs); 1057 1057 void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt); 1058 1058 void skb_tx_error(struct sk_buff *skb); 1059 + 1060 + #ifdef CONFIG_TRACEPOINTS 1059 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 1069 void __consume_stateless_skb(struct sk_buff *skb); 1061 1070 void __kfree_skb(struct sk_buff *skb); 1062 1071 extern struct kmem_cache *skbuff_head_cache; ··· 2667 2658 * 2668 2659 * Using max(32, L1_CACHE_BYTES) makes sense (especially with RPS) 2669 2660 * to reduce average number of cache lines per packet. 2670 - * get_rps_cpus() for example only access one 64 bytes aligned block : 2661 + * get_rps_cpu() for example only access one 64 bytes aligned block : 2671 2662 * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) 2672 2663 */ 2673 2664 #ifndef NET_SKB_PAD
+1
include/linux/vm_event_item.h
··· 30 30 PGFAULT, PGMAJFAULT, 31 31 PGLAZYFREED, 32 32 PGREFILL, 33 + PGREUSE, 33 34 PGSTEAL_KSWAPD, 34 35 PGSTEAL_DIRECT, 35 36 PGSCAN_KSWAPD,
+1 -1
include/net/af_rxrpc.h
··· 59 59 void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *); 60 60 void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *, 61 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 63 int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, 64 64 rxrpc_user_attach_call_t, unsigned long, gfp_t, 65 65 unsigned int);
+1 -1
include/net/ndisc.h
··· 494 494 495 495 #ifdef CONFIG_SYSCTL 496 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 498 int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl, 499 499 void __user *oldval, size_t __user *oldlenp, 500 500 void __user *newval, size_t newlen);
+2
include/net/netfilter/nf_tables.h
··· 143 143 static inline void nft_data_copy(u32 *dst, const struct nft_data *src, 144 144 unsigned int len) 145 145 { 146 + if (len % NFT_REG32_SIZE) 147 + dst[len / NFT_REG32_SIZE] = 0; 146 148 memcpy(dst, src, len); 147 149 } 148 150
+4 -3
include/rdma/ib_verbs.h
··· 535 535 IB_SPEED_FDR10 = 8, 536 536 IB_SPEED_FDR = 16, 537 537 IB_SPEED_EDR = 32, 538 - IB_SPEED_HDR = 64 538 + IB_SPEED_HDR = 64, 539 + IB_SPEED_NDR = 128, 539 540 }; 540 541 541 542 /** ··· 670 669 u8 subnet_timeout; 671 670 u8 init_type_reply; 672 671 u8 active_width; 673 - u8 active_speed; 672 + u16 active_speed; 674 673 u8 phys_state; 675 674 u16 port_cap_flags2; 676 675 }; ··· 4325 4324 void ib_drain_sq(struct ib_qp *qp); 4326 4325 void ib_drain_qp(struct ib_qp *qp); 4327 4326 4328 - int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width); 4327 + int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u16 *speed, u8 *width); 4329 4328 4330 4329 static inline u8 *rdma_ah_retrieve_dmac(struct rdma_ah_attr *attr) 4331 4330 {
+6
include/soc/nps/common.h
··· 45 45 #define CTOP_INST_MOV2B_FLIP_R3_B1_B2_INST 0x5B60 46 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 54 #ifndef __ASSEMBLY__ 49 55 50 56 /* In order to increase compilation test coverage */
+22 -5
include/trace/events/rxrpc.h
··· 138 138 }; 139 139 140 140 enum rxrpc_rtt_tx_trace { 141 + rxrpc_rtt_tx_cancel, 141 142 rxrpc_rtt_tx_data, 143 + rxrpc_rtt_tx_no_slot, 142 144 rxrpc_rtt_tx_ping, 143 145 }; 144 146 145 147 enum rxrpc_rtt_rx_trace { 148 + rxrpc_rtt_rx_cancel, 149 + rxrpc_rtt_rx_lost, 150 + rxrpc_rtt_rx_obsolete, 146 151 rxrpc_rtt_rx_ping_response, 147 152 rxrpc_rtt_rx_requested_ack, 148 153 }; ··· 344 339 E_(rxrpc_recvmsg_wait, "WAIT") 345 340 346 341 #define rxrpc_rtt_tx_traces \ 342 + EM(rxrpc_rtt_tx_cancel, "CNCE") \ 347 343 EM(rxrpc_rtt_tx_data, "DATA") \ 344 + EM(rxrpc_rtt_tx_no_slot, "FULL") \ 348 345 E_(rxrpc_rtt_tx_ping, "PING") 349 346 350 347 #define rxrpc_rtt_rx_traces \ 348 + EM(rxrpc_rtt_rx_cancel, "CNCL") \ 349 + EM(rxrpc_rtt_rx_obsolete, "OBSL") \ 350 + EM(rxrpc_rtt_rx_lost, "LOST") \ 351 351 EM(rxrpc_rtt_rx_ping_response, "PONG") \ 352 352 E_(rxrpc_rtt_rx_requested_ack, "RACK") 353 353 ··· 1097 1087 1098 1088 TRACE_EVENT(rxrpc_rtt_tx, 1099 1089 TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why, 1100 - rxrpc_serial_t send_serial), 1090 + int slot, rxrpc_serial_t send_serial), 1101 1091 1102 - TP_ARGS(call, why, send_serial), 1092 + TP_ARGS(call, why, slot, send_serial), 1103 1093 1104 1094 TP_STRUCT__entry( 1105 1095 __field(unsigned int, call ) 1106 1096 __field(enum rxrpc_rtt_tx_trace, why ) 1097 + __field(int, slot ) 1107 1098 __field(rxrpc_serial_t, send_serial ) 1108 1099 ), 1109 1100 1110 1101 TP_fast_assign( 1111 1102 __entry->call = call->debug_id; 1112 1103 __entry->why = why; 1104 + __entry->slot = slot; 1113 1105 __entry->send_serial = send_serial; 1114 1106 ), 1115 1107 1116 - TP_printk("c=%08x %s sr=%08x", 1108 + TP_printk("c=%08x [%d] %s sr=%08x", 1117 1109 __entry->call, 1110 + __entry->slot, 1118 1111 __print_symbolic(__entry->why, rxrpc_rtt_tx_traces), 1119 1112 __entry->send_serial) 1120 1113 ); 1121 1114 1122 1115 TRACE_EVENT(rxrpc_rtt_rx, 1123 1116 TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, 1117 + int slot, 1124 1118 rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial, 1125 1119 u32 rtt, u32 rto), 1126 1120 1127 - TP_ARGS(call, why, send_serial, resp_serial, rtt, rto), 1121 + TP_ARGS(call, why, slot, send_serial, resp_serial, rtt, rto), 1128 1122 1129 1123 TP_STRUCT__entry( 1130 1124 __field(unsigned int, call ) 1131 1125 __field(enum rxrpc_rtt_rx_trace, why ) 1126 + __field(int, slot ) 1132 1127 __field(rxrpc_serial_t, send_serial ) 1133 1128 __field(rxrpc_serial_t, resp_serial ) 1134 1129 __field(u32, rtt ) ··· 1143 1128 TP_fast_assign( 1144 1129 __entry->call = call->debug_id; 1145 1130 __entry->why = why; 1131 + __entry->slot = slot; 1146 1132 __entry->send_serial = send_serial; 1147 1133 __entry->resp_serial = resp_serial; 1148 1134 __entry->rtt = rtt; 1149 1135 __entry->rto = rto; 1150 1136 ), 1151 1137 1152 - TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%u rto=%u", 1138 + TP_printk("c=%08x [%d] %s sr=%08x rr=%08x rtt=%u rto=%u", 1153 1139 __entry->call, 1140 + __entry->slot, 1154 1141 __print_symbolic(__entry->why, rxrpc_rtt_rx_traces), 1155 1142 __entry->send_serial, 1156 1143 __entry->resp_serial,
+1 -1
include/uapi/linux/in.h
··· 135 135 * this socket to prevent accepting spoofed ones. 136 136 */ 137 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 139 * fragmented if they exeed the interface mtu 140 140 */ 141 141 #define IP_PMTUDISC_OMIT 5
+4 -2
include/uapi/linux/kvm.h
··· 790 790 #define KVM_VM_PPC_HV 1 791 791 #define KVM_VM_PPC_PR 2 792 792 793 - /* on MIPS, 0 forces trap & emulate, 1 forces VZ ASE */ 794 - #define KVM_VM_MIPS_TE 0 793 + /* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */ 794 + #define KVM_VM_MIPS_AUTO 0 795 795 #define KVM_VM_MIPS_VZ 1 796 + #define KVM_VM_MIPS_TE 2 796 797 797 798 #define KVM_S390_SIE_PAGE_OFFSET 1 798 799 ··· 1036 1035 #define KVM_CAP_LAST_CPU 184 1037 1036 #define KVM_CAP_SMALLER_MAXPHYADDR 185 1038 1037 #define KVM_CAP_S390_DIAG318 186 1038 + #define KVM_CAP_STEAL_TIME 187 1039 1039 1040 1040 #ifdef KVM_CAP_IRQ_ROUTING 1041 1041
+1 -1
include/uapi/linux/netfilter/nf_tables.h
··· 133 133 * @NFTA_LIST_ELEM: list element (NLA_NESTED) 134 134 */ 135 135 enum nft_list_attributes { 136 - NFTA_LIST_UNPEC, 136 + NFTA_LIST_UNSPEC, 137 137 NFTA_LIST_ELEM, 138 138 __NFTA_LIST_MAX 139 139 };
+4
include/xen/balloon.h
··· 2 2 /****************************************************************************** 3 3 * Xen balloon functionality 4 4 */ 5 + #ifndef _XEN_BALLOON_H 6 + #define _XEN_BALLOON_H 5 7 6 8 #define RETRY_UNLIMITED 0 7 9 ··· 36 34 { 37 35 } 38 36 #endif 37 + 38 + #endif /* _XEN_BALLOON_H */
+9
include/xen/xen.h
··· 52 52 extern u64 xen_saved_max_mem_size; 53 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 64 #endif /* _XEN_XEN_H */
+1 -1
init/initramfs.c
··· 297 297 { 298 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 301 (st.mode ^ fmode) & S_IFMT) { 302 302 if (S_ISDIR(st.mode)) 303 303 init_rmdir(path);
+1 -1
ipc/ipc_sysctl.c
··· 85 85 } 86 86 87 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 90 int ret, semmni; 91 91 struct ipc_namespace *ns = current->nsproxy->ipc_ns;
+1 -1
kernel/bpf/syscall.c
··· 2634 2634 u32 ulen = info->raw_tracepoint.tp_name_len; 2635 2635 size_t tp_len = strlen(tp_name); 2636 2636 2637 - if (ulen && !ubuf) 2637 + if (!ulen ^ !ubuf) 2638 2638 return -EINVAL; 2639 2639 2640 2640 info->raw_tracepoint.tp_name_len = tp_len + 1;
+29 -6
kernel/entry/common.c
··· 69 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 75 unsigned long ti_work; 75 76 76 - enter_from_user_mode(regs); 77 - instrumentation_begin(); 78 - 79 - local_irq_enable(); 80 77 ti_work = READ_ONCE(current_thread_info()->flags); 81 78 if (ti_work & SYSCALL_ENTER_WORK) 82 79 syscall = syscall_trace_enter(regs, syscall, ti_work); 83 - instrumentation_end(); 84 80 85 81 return syscall; 82 + } 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(); 86 109 } 87 110 88 111 /**
+1 -1
kernel/fork.c
··· 3014 3014 } 3015 3015 3016 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 3019 struct ctl_table t; 3020 3020 int ret;
+3 -1
kernel/gcov/gcc_4_7.c
··· 19 19 #include <linux/vmalloc.h> 20 20 #include "gcov.h" 21 21 22 - #if (__GNUC__ >= 7) 22 + #if (__GNUC__ >= 10) 23 + #define GCOV_COUNTERS 8 24 + #elif (__GNUC__ >= 7) 23 25 #define GCOV_COUNTERS 9 24 26 #elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) 25 27 #define GCOV_COUNTERS 10
+3 -2
kernel/padata.c
··· 215 215 padata->pd = pd; 216 216 padata->cb_cpu = *cb_cpu; 217 217 218 - rcu_read_unlock_bh(); 219 - 220 218 spin_lock(&padata_works_lock); 221 219 padata->seq_nr = ++pd->seq_nr; 222 220 pw = padata_work_alloc(); 223 221 spin_unlock(&padata_works_lock); 222 + 223 + rcu_read_unlock_bh(); 224 + 224 225 if (pw) { 225 226 padata_work_init(pw, padata_parallel_worker, padata, 0); 226 227 queue_work(pinst->parallel_wq, &pw->pw_work);
+18 -6
kernel/seccomp.c
··· 1109 1109 } 1110 1110 1111 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 1113 { 1114 - struct seccomp_filter *filter = file->private_data; 1114 + kfree(filter->notif); 1115 + filter->notif = NULL; 1116 + } 1117 + 1118 + static void seccomp_notify_detach(struct seccomp_filter *filter) 1119 + { 1115 1120 struct seccomp_knotif *knotif; 1116 1121 1117 1122 if (!filter) 1118 - return 0; 1123 + return; 1119 1124 1120 1125 mutex_lock(&filter->notify_lock); 1121 1126 ··· 1144 1139 complete(&knotif->ready); 1145 1140 } 1146 1141 1147 - kfree(filter->notif); 1148 - filter->notif = NULL; 1142 + seccomp_notify_free(filter); 1149 1143 mutex_unlock(&filter->notify_lock); 1144 + } 1145 + 1146 + static int seccomp_notify_release(struct inode *inode, struct file *file) 1147 + { 1148 + struct seccomp_filter *filter = file->private_data; 1149 + 1150 + seccomp_notify_detach(filter); 1150 1151 __put_seccomp_filter(filter); 1151 1152 return 0; 1152 1153 } ··· 1499 1488 1500 1489 out_notif: 1501 1490 if (IS_ERR(ret)) 1502 - kfree(filter->notif); 1491 + seccomp_notify_free(filter); 1503 1492 out: 1504 1493 return ret; 1505 1494 } ··· 1592 1581 listener_f->private_data = NULL; 1593 1582 fput(listener_f); 1594 1583 put_unused_fd(listener); 1584 + seccomp_notify_detach(prepared); 1595 1585 } else { 1596 1586 fd_install(listener, listener_f); 1597 1587 ret = listener;
+1 -2
kernel/sysctl.c
··· 204 204 205 205 #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL) 206 206 static int bpf_stats_handler(struct ctl_table *table, int write, 207 - void __user *buffer, size_t *lenp, 208 - loff_t *ppos) 207 + void *buffer, size_t *lenp, loff_t *ppos) 209 208 { 210 209 struct static_key *key = (struct static_key *)table->data; 211 210 static int saved_val;
+46 -36
lib/dynamic_debug.c
··· 353 353 354 354 /* 355 355 * Parse words[] as a ddebug query specification, which is a series 356 - * of (keyword, value) pairs or combined keyword=value terms, 357 - * chosen from these possibilities: 356 + * of (keyword, value) pairs chosen from these possibilities: 358 357 * 359 358 * func <function-name> 360 359 * file <full-pathname> ··· 372 373 unsigned int i; 373 374 int rc = 0; 374 375 char *fline; 375 - char *keyword, *arg; 376 + 377 + /* check we have an even number of words */ 378 + if (nwords % 2 != 0) { 379 + pr_err("expecting pairs of match-spec <value>\n"); 380 + return -EINVAL; 381 + } 376 382 377 383 if (modname) 378 384 /* support $modname.dyndbg=<multiple queries> */ 379 385 query->module = modname; 380 386 381 - for (i = 0; i < nwords; i++) { 382 - /* accept keyword=arg */ 383 - vpr_info("%d w:%s\n", i, words[i]); 384 - 385 - keyword = words[i]; 386 - arg = strchr(keyword, '='); 387 - if (arg) { 388 - *arg++ = '\0'; 389 - } else { 390 - i++; /* next word is arg */ 391 - if (!(i < nwords)) { 392 - pr_err("missing arg to keyword: %s\n", keyword); 393 - return -EINVAL; 394 - } 395 - arg = words[i]; 396 - } 397 - vpr_info("%d key:%s arg:%s\n", i, keyword, arg); 398 - 399 - if (!strcmp(keyword, "func")) { 400 - rc = check_set(&query->function, arg, "func"); 401 - } else if (!strcmp(keyword, "file")) { 402 - if (check_set(&query->filename, arg, "file")) 387 + for (i = 0; i < nwords; i += 2) { 388 + if (!strcmp(words[i], "func")) { 389 + rc = check_set(&query->function, words[i+1], "func"); 390 + } else if (!strcmp(words[i], "file")) { 391 + if (check_set(&query->filename, words[i+1], "file")) 403 392 return -EINVAL; 404 393 405 394 /* tail :$info is function or line-range */ ··· 403 416 if (parse_linerange(query, fline)) 404 417 return -EINVAL; 405 418 } 406 - } else if (!strcmp(keyword, "module")) { 407 - rc = check_set(&query->module, arg, "module"); 408 - } else if (!strcmp(keyword, "format")) { 409 - string_unescape_inplace(arg, UNESCAPE_SPACE | 419 + } else if (!strcmp(words[i], "module")) { 420 + rc = check_set(&query->module, words[i+1], "module"); 421 + } else if (!strcmp(words[i], "format")) { 422 + string_unescape_inplace(words[i+1], UNESCAPE_SPACE | 410 423 UNESCAPE_OCTAL | 411 424 UNESCAPE_SPECIAL); 412 - rc = check_set(&query->format, arg, "format"); 413 - } else if (!strcmp(keyword, "line")) { 414 - if (parse_linerange(query, arg)) 425 + rc = check_set(&query->format, words[i+1], "format"); 426 + } else if (!strcmp(words[i], "line")) { 427 + if (parse_linerange(query, words[i+1])) 415 428 return -EINVAL; 416 429 } else { 417 - pr_err("unknown keyword \"%s\"\n", keyword); 430 + pr_err("unknown keyword \"%s\"\n", words[i]); 418 431 return -EINVAL; 419 432 } 420 433 if (rc) ··· 512 525 last error or number of matching callsites. Module name is either 513 526 in param (for boot arg) or perhaps in query string. 514 527 */ 515 - int ddebug_exec_queries(char *query, const char *modname) 528 + static int ddebug_exec_queries(char *query, const char *modname) 516 529 { 517 530 char *split; 518 531 int i, errs = 0, exitcode = 0, rc, nfound = 0; ··· 544 557 return exitcode; 545 558 return nfound; 546 559 } 547 - EXPORT_SYMBOL_GPL(ddebug_exec_queries); 560 + 561 + /** 562 + * dynamic_debug_exec_queries - select and change dynamic-debug prints 563 + * @query: query-string described in admin-guide/dynamic-debug-howto 564 + * @modname: string containing module name, usually &module.mod_name 565 + * 566 + * This uses the >/proc/dynamic_debug/control reader, allowing module 567 + * authors to modify their dynamic-debug callsites. The modname is 568 + * canonically struct module.mod_name, but can also be null or a 569 + * module-wildcard, for example: "drm*". 570 + */ 571 + int dynamic_debug_exec_queries(const char *query, const char *modname) 572 + { 573 + int rc; 574 + char *qry = kstrndup(query, PAGE_SIZE, GFP_KERNEL); 575 + 576 + if (!query) 577 + return -ENOMEM; 578 + 579 + rc = ddebug_exec_queries(qry, modname); 580 + kfree(qry); 581 + return rc; 582 + } 583 + EXPORT_SYMBOL_GPL(dynamic_debug_exec_queries); 548 584 549 585 #define PREFIX_SIZE 64 550 586 ··· 957 947 list_add(&dt->link, &ddebug_tables); 958 948 mutex_unlock(&ddebug_lock); 959 949 960 - v2pr_info("%u debug prints in module %s\n", n, dt->mod_name); 950 + v2pr_info("%3u debug prints in module %s\n", n, dt->mod_name); 961 951 return 0; 962 952 } 963 953
+5 -4
lib/kobject.c
··· 604 604 struct kernfs_node *sd; 605 605 const struct kobj_type *ktype; 606 606 607 - if (!kobj) 608 - return; 609 - 610 607 sd = kobj->sd; 611 608 ktype = get_ktype(kobj); 612 609 ··· 634 637 */ 635 638 void kobject_del(struct kobject *kobj) 636 639 { 637 - struct kobject *parent = kobj->parent; 640 + struct kobject *parent; 638 641 642 + if (!kobj) 643 + return; 644 + 645 + parent = kobj->parent; 639 646 __kobject_del(kobj); 640 647 kobject_put(parent); 641 648 }
+9
lib/test_firmware.c
··· 26 26 #include <linux/vmalloc.h> 27 27 #include <linux/efi_embedded_fw.h> 28 28 29 + MODULE_IMPORT_NS(TEST_FIRMWARE); 30 + 29 31 #define TEST_FIRMWARE_NAME "test-firmware.bin" 30 32 #define TEST_FIRMWARE_NUM_REQS 4 31 33 #define TEST_FIRMWARE_BUF_SIZE SZ_1K ··· 491 489 static DEVICE_ATTR_WO(trigger_request); 492 490 493 491 #ifdef CONFIG_EFI_EMBEDDED_FIRMWARE 492 + extern struct list_head efi_embedded_fw_list; 493 + extern bool efi_embedded_fw_checked; 494 + 494 495 static ssize_t trigger_request_platform_store(struct device *dev, 495 496 struct device_attribute *attr, 496 497 const char *buf, size_t count) ··· 506 501 }; 507 502 struct efi_embedded_fw efi_embedded_fw; 508 503 const struct firmware *firmware = NULL; 504 + bool saved_efi_embedded_fw_checked; 509 505 char *name; 510 506 int rc; 511 507 ··· 519 513 efi_embedded_fw.data = (void *)test_data; 520 514 efi_embedded_fw.length = sizeof(test_data); 521 515 list_add(&efi_embedded_fw.list, &efi_embedded_fw_list); 516 + saved_efi_embedded_fw_checked = efi_embedded_fw_checked; 517 + efi_embedded_fw_checked = true; 522 518 523 519 pr_info("loading '%s'\n", name); 524 520 rc = firmware_request_platform(&firmware, name, dev); ··· 538 530 rc = count; 539 531 540 532 out: 533 + efi_embedded_fw_checked = saved_efi_embedded_fw_checked; 541 534 release_firmware(firmware); 542 535 list_del(&efi_embedded_fw.list); 543 536 kfree(name);
+6 -36
mm/gup.c
··· 381 381 } 382 382 383 383 /* 384 - * FOLL_FORCE or a forced COW break can write even to unwritable pte's, 385 - * but only after we've gone through a COW cycle and they are dirty. 384 + * FOLL_FORCE can write to even unwritable pte's, but only 385 + * after we've gone through a COW cycle and they are dirty. 386 386 */ 387 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)); 390 - } 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)); 389 + return pte_write(pte) || 390 + ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); 400 391 } 401 392 402 393 static struct page *follow_page_pte(struct vm_area_struct *vma, ··· 834 843 goto unmap; 835 844 *page = pte_page(*pte); 836 845 } 837 - if (unlikely(!try_get_page(*page))) { 846 + if (unlikely(!try_grab_page(*page, gup_flags))) { 838 847 ret = -ENOMEM; 839 848 goto unmap; 840 849 } ··· 1058 1067 goto out; 1059 1068 } 1060 1069 if (is_vm_hugetlb_page(vma)) { 1061 - if (should_force_cow_break(vma, foll_flags)) 1062 - foll_flags |= FOLL_WRITE; 1063 1070 i = follow_hugetlb_page(mm, vma, pages, vmas, 1064 1071 &start, &nr_pages, i, 1065 - foll_flags, locked); 1072 + gup_flags, locked); 1066 1073 if (locked && *locked == 0) { 1067 1074 /* 1068 1075 * We've got a VM_FAULT_RETRY ··· 1074 1085 continue; 1075 1086 } 1076 1087 } 1077 - 1078 - if (should_force_cow_break(vma, foll_flags)) 1079 - foll_flags |= FOLL_WRITE; 1080 - 1081 1088 retry: 1082 1089 /* 1083 1090 * If we have a pending SIGKILL, don't keep faulting pages and ··· 2674 2689 return -EFAULT; 2675 2690 2676 2691 /* 2677 - * The FAST_GUP case requires FOLL_WRITE even for pure reads, 2678 - * because get_user_pages() may need to cause an early COW in 2679 - * order to avoid confusing the normal COW routines. So only 2680 - * targets that are already writable are safe to do by just 2681 - * looking at the page tables. 2682 - * 2683 - * NOTE! With FOLL_FAST_ONLY we allow read-only gup_fast() here, 2684 - * because there is no slow path to fall back on. But you'd 2685 - * better be careful about possible COW pages - you'll get _a_ 2686 - * COW page, but not necessarily the one you intended to get 2687 - * depending on what COW event happens after this. COW may break 2688 - * the page copy in a random direction. 2689 - * 2690 2692 * Disable interrupts. The nested form is used, in order to allow 2691 2693 * full, general purpose use of this routine. 2692 2694 * ··· 2686 2714 */ 2687 2715 if (IS_ENABLED(CONFIG_HAVE_FAST_GUP) && gup_fast_permitted(start, end)) { 2688 2716 unsigned long fast_flags = gup_flags; 2689 - if (!(gup_flags & FOLL_FAST_ONLY)) 2690 - fast_flags |= FOLL_WRITE; 2691 2717 2692 2718 local_irq_save(flags); 2693 2719 gup_pgd_range(addr, end, fast_flags, pages, &nr_pinned);
+4 -3
mm/huge_memory.c
··· 1291 1291 } 1292 1292 1293 1293 /* 1294 - * FOLL_FORCE or a forced COW break can write even to unwritable pmd's, 1295 - * but only after we've gone through a COW cycle and they are dirty. 1294 + * FOLL_FORCE can write to even unwritable pmd's, but only 1295 + * after we've gone through a COW cycle and they are dirty. 1296 1296 */ 1297 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 1303 struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
+37 -12
mm/hugetlb.c
··· 1250 1250 int nid, nodemask_t *nodemask) 1251 1251 { 1252 1252 unsigned long nr_pages = 1UL << huge_page_order(h); 1253 + if (nid == NUMA_NO_NODE) 1254 + nid = numa_mem_id(); 1253 1255 1254 1256 #ifdef CONFIG_CMA 1255 1257 { 1256 1258 struct page *page; 1257 1259 int node; 1258 1260 1259 - for_each_node_mask(node, *nodemask) { 1260 - if (!hugetlb_cma[node]) 1261 - continue; 1262 - 1263 - page = cma_alloc(hugetlb_cma[node], nr_pages, 1264 - huge_page_order(h), true); 1261 + if (hugetlb_cma[nid]) { 1262 + page = cma_alloc(hugetlb_cma[nid], nr_pages, 1263 + huge_page_order(h), true); 1265 1264 if (page) 1266 1265 return page; 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 + } 1267 1278 } 1268 1279 } 1269 1280 #endif ··· 3465 3454 } 3466 3455 3467 3456 #ifdef CONFIG_SYSCTL 3457 + static int proc_hugetlb_doulongvec_minmax(struct ctl_table *table, int write, 3458 + void *buffer, size_t *length, 3459 + loff_t *ppos, unsigned long *out) 3460 + { 3461 + struct ctl_table dup_table; 3462 + 3463 + /* 3464 + * In order to avoid races with __do_proc_doulongvec_minmax(), we 3465 + * can duplicate the @table and alter the duplicate of it. 3466 + */ 3467 + dup_table = *table; 3468 + dup_table.data = out; 3469 + 3470 + return proc_doulongvec_minmax(&dup_table, write, buffer, length, ppos); 3471 + } 3472 + 3468 3473 static int hugetlb_sysctl_handler_common(bool obey_mempolicy, 3469 3474 struct ctl_table *table, int write, 3470 3475 void *buffer, size_t *length, loff_t *ppos) ··· 3492 3465 if (!hugepages_supported()) 3493 3466 return -EOPNOTSUPP; 3494 3467 3495 - table->data = &tmp; 3496 - table->maxlen = sizeof(unsigned long); 3497 - ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); 3468 + ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos, 3469 + &tmp); 3498 3470 if (ret) 3499 3471 goto out; 3500 3472 ··· 3536 3510 if (write && hstate_is_gigantic(h)) 3537 3511 return -EINVAL; 3538 3512 3539 - table->data = &tmp; 3540 - table->maxlen = sizeof(unsigned long); 3541 - ret = proc_doulongvec_minmax(table, write, buffer, length, ppos); 3513 + ret = proc_hugetlb_doulongvec_minmax(table, write, buffer, length, ppos, 3514 + &tmp); 3542 3515 if (ret) 3543 3516 goto out; 3544 3517
+1 -1
mm/khugepaged.c
··· 1709 1709 xas_unlock_irq(&xas); 1710 1710 page_cache_sync_readahead(mapping, &file->f_ra, 1711 1711 file, index, 1712 - PAGE_SIZE); 1712 + end - index); 1713 1713 /* drain pagevecs to help isolate_lru_page() */ 1714 1714 lru_add_drain(); 1715 1715 page = find_lock_page(mapping, index);
-25
mm/ksm.c
··· 2661 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 2664 #ifdef CONFIG_MIGRATION 2690 2665 void ksm_migrate_page(struct page *newpage, struct page *oldpage) 2691 2666 {
+1 -1
mm/madvise.c
··· 289 289 */ 290 290 *prev = NULL; /* tell sys_madvise we drop mmap_lock */ 291 291 get_file(file); 292 - mmap_read_unlock(current->mm); 293 292 offset = (loff_t)(start - vma->vm_start) 294 293 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); 294 + mmap_read_unlock(current->mm); 295 295 vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED); 296 296 fput(file); 297 297 mmap_read_lock(current->mm);
+6
mm/memcontrol.c
··· 6774 6774 __this_cpu_add(ug->memcg->vmstats_percpu->nr_page_events, ug->nr_pages); 6775 6775 memcg_check_events(ug->memcg, ug->dummy_page); 6776 6776 local_irq_restore(flags); 6777 + 6778 + /* drop reference from uncharge_page */ 6779 + css_put(&ug->memcg->css); 6777 6780 } 6778 6781 6779 6782 static void uncharge_page(struct page *page, struct uncharge_gather *ug) ··· 6800 6797 uncharge_gather_clear(ug); 6801 6798 } 6802 6799 ug->memcg = page->mem_cgroup; 6800 + 6801 + /* pairs with css_put in uncharge_batch */ 6802 + css_get(&ug->memcg->css); 6803 6803 } 6804 6804 6805 6805 nr_pages = compound_nr(page);
+42 -55
mm/memory.c
··· 73 73 #include <linux/numa.h> 74 74 #include <linux/perf_event.h> 75 75 #include <linux/ptrace.h> 76 + #include <linux/vmalloc.h> 76 77 77 78 #include <trace/events/kmem.h> 78 79 ··· 84 83 #include <asm/tlb.h> 85 84 #include <asm/tlbflush.h> 86 85 86 + #include "pgalloc-track.h" 87 87 #include "internal.h" 88 88 89 89 #if defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) && !defined(CONFIG_COMPILE_TEST) ··· 2208 2206 2209 2207 static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, 2210 2208 unsigned long addr, unsigned long end, 2211 - pte_fn_t fn, void *data, bool create) 2209 + pte_fn_t fn, void *data, bool create, 2210 + pgtbl_mod_mask *mask) 2212 2211 { 2213 2212 pte_t *pte; 2214 2213 int err = 0; ··· 2217 2214 2218 2215 if (create) { 2219 2216 pte = (mm == &init_mm) ? 2220 - pte_alloc_kernel(pmd, addr) : 2217 + pte_alloc_kernel_track(pmd, addr, mask) : 2221 2218 pte_alloc_map_lock(mm, pmd, addr, &ptl); 2222 2219 if (!pte) 2223 2220 return -ENOMEM; ··· 2238 2235 break; 2239 2236 } 2240 2237 } while (addr += PAGE_SIZE, addr != end); 2238 + *mask |= PGTBL_PTE_MODIFIED; 2241 2239 2242 2240 arch_leave_lazy_mmu_mode(); 2243 2241 ··· 2249 2245 2250 2246 static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, 2251 2247 unsigned long addr, unsigned long end, 2252 - pte_fn_t fn, void *data, bool create) 2248 + pte_fn_t fn, void *data, bool create, 2249 + pgtbl_mod_mask *mask) 2253 2250 { 2254 2251 pmd_t *pmd; 2255 2252 unsigned long next; ··· 2259 2254 BUG_ON(pud_huge(*pud)); 2260 2255 2261 2256 if (create) { 2262 - pmd = pmd_alloc(mm, pud, addr); 2257 + pmd = pmd_alloc_track(mm, pud, addr, mask); 2263 2258 if (!pmd) 2264 2259 return -ENOMEM; 2265 2260 } else { ··· 2269 2264 next = pmd_addr_end(addr, end); 2270 2265 if (create || !pmd_none_or_clear_bad(pmd)) { 2271 2266 err = apply_to_pte_range(mm, pmd, addr, next, fn, data, 2272 - create); 2267 + create, mask); 2273 2268 if (err) 2274 2269 break; 2275 2270 } ··· 2279 2274 2280 2275 static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d, 2281 2276 unsigned long addr, unsigned long end, 2282 - pte_fn_t fn, void *data, bool create) 2277 + pte_fn_t fn, void *data, bool create, 2278 + pgtbl_mod_mask *mask) 2283 2279 { 2284 2280 pud_t *pud; 2285 2281 unsigned long next; 2286 2282 int err = 0; 2287 2283 2288 2284 if (create) { 2289 - pud = pud_alloc(mm, p4d, addr); 2285 + pud = pud_alloc_track(mm, p4d, addr, mask); 2290 2286 if (!pud) 2291 2287 return -ENOMEM; 2292 2288 } else { ··· 2297 2291 next = pud_addr_end(addr, end); 2298 2292 if (create || !pud_none_or_clear_bad(pud)) { 2299 2293 err = apply_to_pmd_range(mm, pud, addr, next, fn, data, 2300 - create); 2294 + create, mask); 2301 2295 if (err) 2302 2296 break; 2303 2297 } ··· 2307 2301 2308 2302 static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd, 2309 2303 unsigned long addr, unsigned long end, 2310 - pte_fn_t fn, void *data, bool create) 2304 + pte_fn_t fn, void *data, bool create, 2305 + pgtbl_mod_mask *mask) 2311 2306 { 2312 2307 p4d_t *p4d; 2313 2308 unsigned long next; 2314 2309 int err = 0; 2315 2310 2316 2311 if (create) { 2317 - p4d = p4d_alloc(mm, pgd, addr); 2312 + p4d = p4d_alloc_track(mm, pgd, addr, mask); 2318 2313 if (!p4d) 2319 2314 return -ENOMEM; 2320 2315 } else { ··· 2325 2318 next = p4d_addr_end(addr, end); 2326 2319 if (create || !p4d_none_or_clear_bad(p4d)) { 2327 2320 err = apply_to_pud_range(mm, p4d, addr, next, fn, data, 2328 - create); 2321 + create, mask); 2329 2322 if (err) 2330 2323 break; 2331 2324 } ··· 2338 2331 void *data, bool create) 2339 2332 { 2340 2333 pgd_t *pgd; 2341 - unsigned long next; 2334 + unsigned long start = addr, next; 2342 2335 unsigned long end = addr + size; 2336 + pgtbl_mod_mask mask = 0; 2343 2337 int err = 0; 2344 2338 2345 2339 if (WARN_ON(addr >= end)) ··· 2351 2343 next = pgd_addr_end(addr, end); 2352 2344 if (!create && pgd_none_or_clear_bad(pgd)) 2353 2345 continue; 2354 - err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create); 2346 + err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create, &mask); 2355 2347 if (err) 2356 2348 break; 2357 2349 } while (pgd++, addr = next, addr != end); 2350 + 2351 + if (mask & ARCH_PAGE_TABLE_SYNC_MASK) 2352 + arch_sync_kernel_mappings(start, start + size); 2358 2353 2359 2354 return err; 2360 2355 } ··· 2633 2622 if (ptep_set_access_flags(vma, vmf->address, vmf->pte, entry, 1)) 2634 2623 update_mmu_cache(vma, vmf->address, vmf->pte); 2635 2624 pte_unmap_unlock(vmf->pte, vmf->ptl); 2625 + count_vm_event(PGREUSE); 2636 2626 } 2637 2627 2638 2628 /* ··· 2939 2927 * not dirty accountable. 2940 2928 */ 2941 2929 if (PageAnon(vmf->page)) { 2942 - int total_map_swapcount; 2943 - if (PageKsm(vmf->page) && (PageSwapCache(vmf->page) || 2944 - page_count(vmf->page) != 1)) 2930 + struct page *page = vmf->page; 2931 + 2932 + /* PageKsm() doesn't necessarily raise the page refcount */ 2933 + if (PageKsm(page) || page_count(page) != 1) 2945 2934 goto copy; 2946 - if (!trylock_page(vmf->page)) { 2947 - get_page(vmf->page); 2948 - pte_unmap_unlock(vmf->pte, vmf->ptl); 2949 - lock_page(vmf->page); 2950 - vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, 2951 - vmf->address, &vmf->ptl); 2952 - if (!pte_same(*vmf->pte, vmf->orig_pte)) { 2953 - update_mmu_tlb(vma, vmf->address, vmf->pte); 2954 - unlock_page(vmf->page); 2955 - pte_unmap_unlock(vmf->pte, vmf->ptl); 2956 - put_page(vmf->page); 2957 - return 0; 2958 - } 2959 - put_page(vmf->page); 2935 + if (!trylock_page(page)) 2936 + goto copy; 2937 + if (PageKsm(page) || page_mapcount(page) != 1 || page_count(page) != 1) { 2938 + unlock_page(page); 2939 + goto copy; 2960 2940 } 2961 - if (PageKsm(vmf->page)) { 2962 - bool reused = reuse_ksm_page(vmf->page, vmf->vma, 2963 - vmf->address); 2964 - unlock_page(vmf->page); 2965 - if (!reused) 2966 - goto copy; 2967 - wp_page_reuse(vmf); 2968 - return VM_FAULT_WRITE; 2969 - } 2970 - if (reuse_swap_page(vmf->page, &total_map_swapcount)) { 2971 - if (total_map_swapcount == 1) { 2972 - /* 2973 - * The page is all ours. Move it to 2974 - * our anon_vma so the rmap code will 2975 - * not search our parent or siblings. 2976 - * Protected against the rmap code by 2977 - * the page lock. 2978 - */ 2979 - page_move_anon_rmap(vmf->page, vma); 2980 - } 2981 - unlock_page(vmf->page); 2982 - wp_page_reuse(vmf); 2983 - return VM_FAULT_WRITE; 2984 - } 2985 - unlock_page(vmf->page); 2941 + /* 2942 + * Ok, we've got the only map reference, and the only 2943 + * page count reference, and the page is locked, 2944 + * it's dark out, and we're wearing sunglasses. Hit it. 2945 + */ 2946 + wp_page_reuse(vmf); 2947 + unlock_page(page); 2948 + return VM_FAULT_WRITE; 2986 2949 } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) == 2987 2950 (VM_WRITE|VM_SHARED))) { 2988 2951 return wp_page_shared(vmf);
+1 -1
mm/memremap.c
··· 216 216 return ERR_PTR(-EINVAL); 217 217 } 218 218 break; 219 - case MEMORY_DEVICE_DEVDAX: 219 + case MEMORY_DEVICE_GENERIC: 220 220 need_devmap_managed = false; 221 221 break; 222 222 case MEMORY_DEVICE_PCI_P2PDMA:
+18 -11
mm/migrate.c
··· 246 246 else if (pte_swp_uffd_wp(*pvmw.pte)) 247 247 pte = pte_mkuffd_wp(pte); 248 248 249 - if (unlikely(is_zone_device_page(new))) { 250 - if (is_device_private_page(new)) { 251 - entry = make_device_private_entry(new, pte_write(pte)); 252 - pte = swp_entry_to_pte(entry); 253 - if (pte_swp_uffd_wp(*pvmw.pte)) 254 - pte = pte_mkuffd_wp(pte); 255 - } 249 + if (unlikely(is_device_private_page(new))) { 250 + entry = make_device_private_entry(new, pte_write(pte)); 251 + pte = swp_entry_to_pte(entry); 252 + if (pte_swp_soft_dirty(*pvmw.pte)) 253 + pte = pte_swp_mksoft_dirty(pte); 254 + if (pte_swp_uffd_wp(*pvmw.pte)) 255 + pte = pte_swp_mkuffd_wp(pte); 256 256 } 257 257 258 258 #ifdef CONFIG_HUGETLB_PAGE ··· 2427 2427 entry = make_migration_entry(page, mpfn & 2428 2428 MIGRATE_PFN_WRITE); 2429 2429 swp_pte = swp_entry_to_pte(entry); 2430 - if (pte_soft_dirty(pte)) 2431 - swp_pte = pte_swp_mksoft_dirty(swp_pte); 2432 - if (pte_uffd_wp(pte)) 2433 - swp_pte = pte_swp_mkuffd_wp(swp_pte); 2430 + if (pte_present(pte)) { 2431 + if (pte_soft_dirty(pte)) 2432 + swp_pte = pte_swp_mksoft_dirty(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 2441 set_pte_at(mm, addr, ptep, swp_pte); 2435 2442 2436 2443 /*
+7 -2
mm/rmap.c
··· 1511 1511 */ 1512 1512 entry = make_migration_entry(page, 0); 1513 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 1520 swp_pte = pte_swp_mksoft_dirty(swp_pte); 1516 - if (pte_uffd_wp(pteval)) 1521 + if (pte_swp_uffd_wp(pteval)) 1517 1522 swp_pte = pte_swp_mkuffd_wp(swp_pte); 1518 1523 set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte); 1519 1524 /*
+6 -6
mm/slub.c
··· 672 672 } 673 673 674 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 677 if ((s->flags & SLAB_CONSISTENCY_CHECKS) && 678 - !check_valid_pointer(s, page, nextfree)) { 679 - object_err(s, page, freelist, "Freechain corrupt"); 680 - freelist = NULL; 678 + !check_valid_pointer(s, page, nextfree) && freelist) { 679 + object_err(s, page, *freelist, "Freechain corrupt"); 680 + *freelist = NULL; 681 681 slab_fix(s, "Isolate corrupted freechain"); 682 682 return true; 683 683 } ··· 1494 1494 int objects) {} 1495 1495 1496 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 1499 return false; 1500 1500 } ··· 2184 2184 * 'freelist' is already corrupted. So isolate all objects 2185 2185 * starting at 'freelist'. 2186 2186 */ 2187 - if (freelist_corrupted(s, page, freelist, nextfree)) 2187 + if (freelist_corrupted(s, page, &freelist, nextfree)) 2188 2188 break; 2189 2189 2190 2190 do {
+8
mm/vmscan.c
··· 2615 2615 unsigned long reclaimed; 2616 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 2626 mem_cgroup_calculate_protection(target_memcg, memcg); 2619 2627 2620 2628 if (mem_cgroup_below_min(memcg)) {
+1
mm/vmstat.c
··· 1241 1241 "pglazyfreed", 1242 1242 1243 1243 "pgrefill", 1244 + "pgreuse", 1244 1245 "pgsteal_kswapd", 1245 1246 "pgsteal_direct", 1246 1247 "pgscan_kswapd",
+6 -5
net/batman-adv/bat_v_ogm.c
··· 881 881 ntohl(ogm_packet->seqno), ogm_throughput, ogm_packet->ttl, 882 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 890 /* If the throughput metric is 0, immediately drop the packet. No need 885 891 * to create orig_node / neigh_node for an unusable route. 886 892 */ ··· 1012 1006 goto free_skb; 1013 1007 1014 1008 if (batadv_is_my_mac(bat_priv, ethhdr->h_source)) 1015 - goto free_skb; 1016 - 1017 - ogm_packet = (struct batadv_ogm2_packet *)skb->data; 1018 - 1019 - if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) 1020 1009 goto free_skb; 1021 1010 1022 1011 batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX);
+4 -1
net/batman-adv/bridge_loop_avoidance.c
··· 437 437 batadv_add_counter(bat_priv, BATADV_CNT_RX_BYTES, 438 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 444 out: 442 445 if (primary_if) 443 446 batadv_hardif_put(primary_if);
+4 -2
net/batman-adv/gateway_client.c
··· 703 703 704 704 chaddr_offset = *header_len + BATADV_DHCP_CHADDR_OFFSET; 705 705 /* store the client address if the message is going to a client */ 706 - if (ret == BATADV_DHCP_TO_CLIENT && 707 - pskb_may_pull(skb, chaddr_offset + ETH_ALEN)) { 706 + if (ret == BATADV_DHCP_TO_CLIENT) { 707 + if (!pskb_may_pull(skb, chaddr_offset + ETH_ALEN)) 708 + return BATADV_DHCP_NO; 709 + 708 710 /* check if the DHCP packet carries an Ethernet DHCP */ 709 711 p = skb->data + *header_len + BATADV_DHCP_HTYPE_OFFSET; 710 712 if (*p != BATADV_DHCP_HTYPE_ETHERNET)
+2 -2
net/caif/cfrfml.c
··· 116 116 if (segmented) { 117 117 if (rfml->incomplete_frm == NULL) { 118 118 /* Initial Segment */ 119 - if (cfpkt_peek_head(pkt, rfml->seghead, 6) < 0) 119 + if (cfpkt_peek_head(pkt, rfml->seghead, 6) != 0) 120 120 goto out; 121 121 122 122 rfml->pdu_size = get_unaligned_le16(rfml->seghead+4); ··· 233 233 if (cfpkt_getlen(pkt) > rfml->fragment_size + RFM_HEAD_SIZE) 234 234 err = cfpkt_peek_head(pkt, head, 6); 235 235 236 - if (err < 0) 236 + if (err != 0) 237 237 goto out; 238 238 239 239 while (cfpkt_getlen(frontpkt) > rfml->fragment_size + RFM_HEAD_SIZE) {
+2 -1
net/core/dev.c
··· 6612 6612 netdev_err_once(dev, "%s() called with weight %d\n", __func__, 6613 6613 weight); 6614 6614 napi->weight = weight; 6615 - list_add(&napi->dev_list, &dev->napi_list); 6616 6615 napi->dev = dev; 6617 6616 #ifdef CONFIG_NETPOLL 6618 6617 napi->poll_owner = -1; 6619 6618 #endif 6620 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 6622 napi_hash_add(napi); 6622 6623 } 6623 6624 EXPORT_SYMBOL(netif_napi_add);
+1 -1
net/core/netpoll.c
··· 162 162 struct napi_struct *napi; 163 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 166 if (cmpxchg(&napi->poll_owner, -1, cpu) == -1) { 167 167 poll_one_napi(napi); 168 168 smp_store_release(&napi->poll_owner, -1);
+1 -1
net/core/pktgen.c
··· 3699 3699 cpu_to_node(cpu), 3700 3700 "kpktgend_%d", cpu); 3701 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 3703 list_del(&t->th_list); 3704 3704 kfree(t); 3705 3705 return PTR_ERR(p);
+2
net/core/skbuff.c
··· 820 820 } 821 821 EXPORT_SYMBOL(skb_tx_error); 822 822 823 + #ifdef CONFIG_TRACEPOINTS 823 824 /** 824 825 * consume_skb - free an skbuff 825 826 * @skb: buffer to free ··· 838 837 __kfree_skb(skb); 839 838 } 840 839 EXPORT_SYMBOL(consume_skb); 840 + #endif 841 841 842 842 /** 843 843 * consume_stateless_skb - free an skbuff, assuming it is stateless
+1 -1
net/core/sock.c
··· 3254 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 3258 * no access to socket. But net still has. 3259 3259 * Step one, detach it from networking: 3260 3260 *
+2 -1
net/ipv4/fib_trie.c
··· 2121 2121 struct hlist_head *head = &net->ipv4.fib_table_hash[h]; 2122 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 2126 __fib_info_notify_update(net, tb, info); 2126 2127 } 2127 2128 }
+1 -1
net/ipv4/netfilter/nf_nat_pptp.c
··· 3 3 * nf_nat_pptp.c 4 4 * 5 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 7 * It is a specification defined by Microsoft and some vendors 8 8 * working with Microsoft. PPTP is built on top of a modified 9 9 * version of the Internet Generic Routing Encapsulation Protocol.
+1 -1
net/ipv4/raw.c
··· 610 610 } else if (!ipc.oif) { 611 611 ipc.oif = inet->uc_index; 612 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 614 * and uc_index is set. oif is most likely set 615 615 * by sk_bound_dev_if. If uc_index != oif check if the 616 616 * oif is an L3 master and uc_index is an L3 slave.
+2 -1
net/ipv6/sysctl_net_ipv6.c
··· 21 21 #include <net/calipso.h> 22 22 #endif 23 23 24 + static int two = 2; 24 25 static int flowlabel_reflect_max = 0x7; 25 26 static int auto_flowlabels_min; 26 27 static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX; ··· 151 150 .mode = 0644, 152 151 .proc_handler = proc_rt6_multipath_hash_policy, 153 152 .extra1 = SYSCTL_ZERO, 154 - .extra2 = SYSCTL_ONE, 153 + .extra2 = &two, 155 154 }, 156 155 { 157 156 .procname = "seg6_flowlabel",
+1 -1
net/l3mdev/l3mdev.c
··· 154 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 158 * master interface 159 159 * @dev: targeted interface 160 160 */
+145 -55
net/mac80211/airtime.c
··· 405 405 return duration; 406 406 } 407 407 408 - u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, 409 - struct ieee80211_rx_status *status, 410 - int len) 408 + static u32 ieee80211_get_rate_duration(struct ieee80211_hw *hw, 409 + struct ieee80211_rx_status *status, 410 + u32 *overhead) 411 411 { 412 - struct ieee80211_supported_band *sband; 413 - const struct ieee80211_rate *rate; 414 412 bool sgi = status->enc_flags & RX_ENC_FLAG_SHORT_GI; 415 - bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE; 416 413 int bw, streams; 417 414 int group, idx; 418 415 u32 duration; 419 - bool cck; 420 416 421 417 switch (status->bw) { 422 418 case RATE_INFO_BW_20: ··· 433 437 } 434 438 435 439 switch (status->encoding) { 436 - case RX_ENC_LEGACY: 437 - if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ)) 438 - return 0; 439 - 440 - sband = hw->wiphy->bands[status->band]; 441 - if (!sband || status->rate_idx >= sband->n_bitrates) 442 - return 0; 443 - 444 - rate = &sband->bitrates[status->rate_idx]; 445 - cck = rate->flags & IEEE80211_RATE_MANDATORY_B; 446 - 447 - return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp, 448 - cck, len); 449 - 450 440 case RX_ENC_VHT: 451 441 streams = status->nss; 452 442 idx = status->rate_idx; ··· 459 477 460 478 duration = airtime_mcs_groups[group].duration[idx]; 461 479 duration <<= airtime_mcs_groups[group].shift; 480 + *overhead = 36 + (streams << 2); 481 + 482 + return duration; 483 + } 484 + 485 + 486 + u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, 487 + struct ieee80211_rx_status *status, 488 + int len) 489 + { 490 + struct ieee80211_supported_band *sband; 491 + u32 duration, overhead = 0; 492 + 493 + if (status->encoding == RX_ENC_LEGACY) { 494 + const struct ieee80211_rate *rate; 495 + bool sp = status->enc_flags & RX_ENC_FLAG_SHORTPRE; 496 + bool cck; 497 + 498 + if (WARN_ON_ONCE(status->band > NL80211_BAND_5GHZ)) 499 + return 0; 500 + 501 + sband = hw->wiphy->bands[status->band]; 502 + if (!sband || status->rate_idx >= sband->n_bitrates) 503 + return 0; 504 + 505 + rate = &sband->bitrates[status->rate_idx]; 506 + cck = rate->flags & IEEE80211_RATE_MANDATORY_B; 507 + 508 + return ieee80211_calc_legacy_rate_duration(rate->bitrate, sp, 509 + cck, len); 510 + } 511 + 512 + duration = ieee80211_get_rate_duration(hw, status, &overhead); 513 + if (!duration) 514 + return 0; 515 + 462 516 duration *= len; 463 517 duration /= AVG_PKT_SIZE; 464 518 duration /= 1024; 465 519 466 - duration += 36 + (streams << 2); 467 - 468 - return duration; 520 + return duration + overhead; 469 521 } 470 522 EXPORT_SYMBOL_GPL(ieee80211_calc_rx_airtime); 471 523 472 - static u32 ieee80211_calc_tx_airtime_rate(struct ieee80211_hw *hw, 473 - struct ieee80211_tx_rate *rate, 474 - u8 band, int len) 524 + static bool ieee80211_fill_rate_info(struct ieee80211_hw *hw, 525 + struct ieee80211_rx_status *stat, u8 band, 526 + struct rate_info *ri) 475 527 { 476 - struct ieee80211_rx_status stat = { 477 - .band = band, 478 - }; 528 + struct ieee80211_supported_band *sband = hw->wiphy->bands[band]; 529 + int i; 479 530 480 - if (rate->idx < 0 || !rate->count) 531 + if (!ri || !sband) 532 + return false; 533 + 534 + stat->bw = ri->bw; 535 + stat->nss = ri->nss; 536 + stat->rate_idx = ri->mcs; 537 + 538 + if (ri->flags & RATE_INFO_FLAGS_HE_MCS) 539 + stat->encoding = RX_ENC_HE; 540 + else if (ri->flags & RATE_INFO_FLAGS_VHT_MCS) 541 + stat->encoding = RX_ENC_VHT; 542 + else if (ri->flags & RATE_INFO_FLAGS_MCS) 543 + stat->encoding = RX_ENC_HT; 544 + else 545 + stat->encoding = RX_ENC_LEGACY; 546 + 547 + if (ri->flags & RATE_INFO_FLAGS_SHORT_GI) 548 + stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; 549 + 550 + stat->he_gi = ri->he_gi; 551 + 552 + if (stat->encoding != RX_ENC_LEGACY) 553 + return true; 554 + 555 + stat->rate_idx = 0; 556 + for (i = 0; i < sband->n_bitrates; i++) { 557 + if (ri->legacy != sband->bitrates[i].bitrate) 558 + continue; 559 + 560 + stat->rate_idx = i; 561 + return true; 562 + } 563 + 564 + return false; 565 + } 566 + 567 + static int ieee80211_fill_rx_status(struct ieee80211_rx_status *stat, 568 + struct ieee80211_hw *hw, 569 + struct ieee80211_tx_rate *rate, 570 + struct rate_info *ri, u8 band, int len) 571 + { 572 + memset(stat, 0, sizeof(*stat)); 573 + stat->band = band; 574 + 575 + if (ieee80211_fill_rate_info(hw, stat, band, ri)) 481 576 return 0; 482 577 578 + if (rate->idx < 0 || !rate->count) 579 + return -1; 580 + 483 581 if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) 484 - stat.bw = RATE_INFO_BW_80; 582 + stat->bw = RATE_INFO_BW_80; 485 583 else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) 486 - stat.bw = RATE_INFO_BW_40; 584 + stat->bw = RATE_INFO_BW_40; 487 585 else 488 - stat.bw = RATE_INFO_BW_20; 586 + stat->bw = RATE_INFO_BW_20; 489 587 490 - stat.enc_flags = 0; 588 + stat->enc_flags = 0; 491 589 if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) 492 - stat.enc_flags |= RX_ENC_FLAG_SHORTPRE; 590 + stat->enc_flags |= RX_ENC_FLAG_SHORTPRE; 493 591 if (rate->flags & IEEE80211_TX_RC_SHORT_GI) 494 - stat.enc_flags |= RX_ENC_FLAG_SHORT_GI; 592 + stat->enc_flags |= RX_ENC_FLAG_SHORT_GI; 495 593 496 - stat.rate_idx = rate->idx; 594 + stat->rate_idx = rate->idx; 497 595 if (rate->flags & IEEE80211_TX_RC_VHT_MCS) { 498 - stat.encoding = RX_ENC_VHT; 499 - stat.rate_idx = ieee80211_rate_get_vht_mcs(rate); 500 - stat.nss = ieee80211_rate_get_vht_nss(rate); 596 + stat->encoding = RX_ENC_VHT; 597 + stat->rate_idx = ieee80211_rate_get_vht_mcs(rate); 598 + stat->nss = ieee80211_rate_get_vht_nss(rate); 501 599 } else if (rate->flags & IEEE80211_TX_RC_MCS) { 502 - stat.encoding = RX_ENC_HT; 600 + stat->encoding = RX_ENC_HT; 503 601 } else { 504 - stat.encoding = RX_ENC_LEGACY; 602 + stat->encoding = RX_ENC_LEGACY; 505 603 } 604 + 605 + return 0; 606 + } 607 + 608 + static u32 ieee80211_calc_tx_airtime_rate(struct ieee80211_hw *hw, 609 + struct ieee80211_tx_rate *rate, 610 + struct rate_info *ri, 611 + u8 band, int len) 612 + { 613 + struct ieee80211_rx_status stat; 614 + 615 + if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len)) 616 + return 0; 506 617 507 618 return ieee80211_calc_rx_airtime(hw, &stat, len); 508 619 } ··· 611 536 struct ieee80211_tx_rate *rate = &info->status.rates[i]; 612 537 u32 cur_duration; 613 538 614 - cur_duration = ieee80211_calc_tx_airtime_rate(hw, rate, 539 + cur_duration = ieee80211_calc_tx_airtime_rate(hw, rate, NULL, 615 540 info->band, len); 616 541 if (!cur_duration) 617 542 break; ··· 647 572 if (pubsta) { 648 573 struct sta_info *sta = container_of(pubsta, struct sta_info, 649 574 sta); 575 + struct ieee80211_rx_status stat; 650 576 struct ieee80211_tx_rate *rate = &sta->tx_stats.last_rate; 651 - u32 airtime; 577 + struct rate_info *ri = &sta->tx_stats.last_rate_info; 578 + u32 duration, overhead; 579 + u8 agg_shift; 652 580 653 - if (!(rate->flags & (IEEE80211_TX_RC_VHT_MCS | 654 - IEEE80211_TX_RC_MCS))) 655 - ampdu = false; 581 + if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len)) 582 + return 0; 656 583 584 + if (stat.encoding == RX_ENC_LEGACY || !ampdu) 585 + return ieee80211_calc_rx_airtime(hw, &stat, len); 586 + 587 + duration = ieee80211_get_rate_duration(hw, &stat, &overhead); 657 588 /* 658 589 * Assume that HT/VHT transmission on any AC except VO will 659 590 * use aggregation. Since we don't have reliable reporting 660 - * of aggregation length, assume an average of 16. 591 + * of aggregation length, assume an average size based on the 592 + * tx rate. 661 593 * This will not be very accurate, but much better than simply 662 - * assuming un-aggregated tx. 594 + * assuming un-aggregated tx in all cases. 663 595 */ 664 - airtime = ieee80211_calc_tx_airtime_rate(hw, rate, band, 665 - ampdu ? len * 16 : len); 666 - if (ampdu) 667 - airtime /= 16; 596 + if (duration > 400) /* <= VHT20 MCS2 1S */ 597 + agg_shift = 1; 598 + else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */ 599 + agg_shift = 2; 600 + else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */ 601 + agg_shift = 3; 602 + else 603 + agg_shift = 4; 668 604 669 - return airtime; 605 + duration *= len; 606 + duration /= AVG_PKT_SIZE; 607 + duration /= 1024; 608 + 609 + return duration + (overhead >> agg_shift); 670 610 } 671 611 672 612 if (!conf)
+3 -2
net/mac80211/sta_info.h
··· 524 524 * @status_stats.retry_failed: # of frames that failed after retry 525 525 * @status_stats.retry_count: # of retries attempted 526 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 528 * @status_stats.msdu_retries: # of MSDU retries 529 529 * @status_stats.msdu_failed: # of failed MSDUs 530 530 * @status_stats.last_ack: last ack timestamp (jiffies) ··· 597 597 unsigned long filtered; 598 598 unsigned long retry_failed, retry_count; 599 599 unsigned int lost_packets; 600 - unsigned long last_tdls_pkt_time; 600 + unsigned long last_pkt_time; 601 601 u64 msdu_retries[IEEE80211_NUM_TIDS + 1]; 602 602 u64 msdu_failed[IEEE80211_NUM_TIDS + 1]; 603 603 unsigned long last_ack; ··· 611 611 u64 packets[IEEE80211_NUM_ACS]; 612 612 u64 bytes[IEEE80211_NUM_ACS]; 613 613 struct ieee80211_tx_rate last_rate; 614 + struct rate_info last_rate_info; 614 615 u64 msdu[IEEE80211_NUM_TIDS + 1]; 615 616 } tx_stats; 616 617 u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1];
+23 -20
net/mac80211/status.c
··· 755 755 * - current throughput (higher value for higher tpt)? 756 756 */ 757 757 #define STA_LOST_PKT_THRESHOLD 50 758 + #define STA_LOST_PKT_TIME HZ /* 1 sec since last ACK */ 758 759 #define STA_LOST_TDLS_PKT_THRESHOLD 10 759 760 #define STA_LOST_TDLS_PKT_TIME (10*HZ) /* 10secs since last ACK */ 760 761 761 762 static void ieee80211_lost_packet(struct sta_info *sta, 762 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 768 /* If driver relies on its own algorithm for station kickout, skip 765 769 * mac80211 packet loss mechanism. 766 770 */ ··· 777 773 return; 778 774 779 775 sta->status_stats.lost_packets++; 780 - if (!sta->sta.tdls && 781 - sta->status_stats.lost_packets < STA_LOST_PKT_THRESHOLD) 782 - return; 776 + if (sta->sta.tdls) { 777 + pkt_time = STA_LOST_TDLS_PKT_TIME; 778 + pkt_thr = STA_LOST_PKT_THRESHOLD; 779 + } 783 780 784 781 /* 785 782 * If we're in TDLS mode, make sure that all STA_LOST_TDLS_PKT_THRESHOLD 786 783 * of the last packets were lost, and that no ACK was received in the 787 784 * last STA_LOST_TDLS_PKT_TIME ms, before triggering the CQM packet-loss 788 785 * mechanism. 786 + * For non-TDLS, use STA_LOST_PKT_THRESHOLD and STA_LOST_PKT_TIME 789 787 */ 790 - if (sta->sta.tdls && 791 - (sta->status_stats.lost_packets < STA_LOST_TDLS_PKT_THRESHOLD || 792 - time_before(jiffies, 793 - sta->status_stats.last_tdls_pkt_time + 794 - STA_LOST_TDLS_PKT_TIME))) 788 + if (sta->status_stats.lost_packets < pkt_thr || 789 + !time_after(jiffies, sta->status_stats.last_pkt_time + pkt_time)) 795 790 return; 796 791 797 792 cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr, ··· 1036 1033 sta->status_stats.lost_packets = 0; 1037 1034 1038 1035 /* Track when last TDLS packet was ACKed */ 1039 - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) 1040 - sta->status_stats.last_tdls_pkt_time = 1041 - jiffies; 1036 + sta->status_stats.last_pkt_time = jiffies; 1042 1037 } else if (noack_success) { 1043 1038 /* nothing to do here, do not account as lost */ 1044 1039 } else { ··· 1138 1137 struct ieee80211_tx_info *info = status->info; 1139 1138 struct ieee80211_sta *pubsta = status->sta; 1140 1139 struct ieee80211_supported_band *sband; 1140 + struct sta_info *sta; 1141 1141 int retry_count; 1142 1142 bool acked, noack_success; 1143 + 1144 + if (pubsta) { 1145 + sta = container_of(pubsta, struct sta_info, sta); 1146 + 1147 + if (status->rate) 1148 + sta->tx_stats.last_rate_info = *status->rate; 1149 + } 1143 1150 1144 1151 if (status->skb) 1145 1152 return __ieee80211_tx_status(hw, status); ··· 1163 1154 noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED); 1164 1155 1165 1156 if (pubsta) { 1166 - struct sta_info *sta; 1167 - 1168 - sta = container_of(pubsta, struct sta_info, sta); 1169 - 1170 1157 if (!acked && !noack_success) 1171 1158 sta->status_stats.retry_failed++; 1172 1159 sta->status_stats.retry_count += retry_count; ··· 1173 1168 if (sta->status_stats.lost_packets) 1174 1169 sta->status_stats.lost_packets = 0; 1175 1170 1176 - /* Track when last TDLS packet was ACKed */ 1177 - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) 1178 - sta->status_stats.last_tdls_pkt_time = jiffies; 1171 + /* Track when last packet was ACKed */ 1172 + sta->status_stats.last_pkt_time = jiffies; 1179 1173 } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { 1180 1174 return; 1181 1175 } else if (noack_success) { ··· 1263 1259 if (sta->status_stats.lost_packets) 1264 1260 sta->status_stats.lost_packets = 0; 1265 1261 1266 - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) 1267 - sta->status_stats.last_tdls_pkt_time = jiffies; 1262 + sta->status_stats.last_pkt_time = jiffies; 1268 1263 } else { 1269 1264 ieee80211_lost_packet(sta, info); 1270 1265 }
+1 -2
net/mptcp/protocol.c
··· 891 891 goto out; 892 892 } 893 893 894 - wait_for_sndbuf: 895 894 __mptcp_flush_join_list(msk); 896 895 ssk = mptcp_subflow_get_send(msk); 897 896 while (!sk_stream_memory_free(sk) || ··· 980 981 */ 981 982 mptcp_set_timeout(sk, ssk); 982 983 release_sock(ssk); 983 - goto wait_for_sndbuf; 984 + goto restart; 984 985 } 985 986 } 986 987 }
+1 -1
net/netfilter/nf_conntrack_pptp.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 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 5 * It is a specification defined by Microsoft and some vendors 6 6 * working with Microsoft. PPTP is built on top of a modified 7 7 * version of the Internet Generic Routing Encapsulation Protocol.
+35 -4
net/netfilter/nf_conntrack_proto_sctp.c
··· 62 62 [SCTP_CONNTRACK_HEARTBEAT_ACKED] = 210 SECS, 63 63 }; 64 64 65 + #define SCTP_FLAG_HEARTBEAT_VTAG_FAILED 1 66 + 65 67 #define sNO SCTP_CONNTRACK_NONE 66 68 #define sCL SCTP_CONNTRACK_CLOSED 67 69 #define sCW SCTP_CONNTRACK_COOKIE_WAIT ··· 371 369 u_int32_t offset, count; 372 370 unsigned int *timeouts; 373 371 unsigned long map[256 / sizeof(unsigned long)] = { 0 }; 372 + bool ignore = false; 374 373 375 374 if (sctp_error(skb, dataoff, state)) 376 375 return -NF_ACCEPT; ··· 430 427 /* Sec 8.5.1 (D) */ 431 428 if (sh->vtag != ct->proto.sctp.vtag[dir]) 432 429 goto out_unlock; 433 - } else if (sch->type == SCTP_CID_HEARTBEAT || 434 - sch->type == SCTP_CID_HEARTBEAT_ACK) { 430 + } else if (sch->type == SCTP_CID_HEARTBEAT) { 431 + if (ct->proto.sctp.vtag[dir] == 0) { 432 + pr_debug("Setting %d vtag %x for dir %d\n", sch->type, sh->vtag, dir); 433 + ct->proto.sctp.vtag[dir] = sh->vtag; 434 + } else if (sh->vtag != ct->proto.sctp.vtag[dir]) { 435 + if (test_bit(SCTP_CID_DATA, map) || ignore) 436 + goto out_unlock; 437 + 438 + ct->proto.sctp.flags |= SCTP_FLAG_HEARTBEAT_VTAG_FAILED; 439 + ct->proto.sctp.last_dir = dir; 440 + ignore = true; 441 + continue; 442 + } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) { 443 + ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED; 444 + } 445 + } else if (sch->type == SCTP_CID_HEARTBEAT_ACK) { 435 446 if (ct->proto.sctp.vtag[dir] == 0) { 436 447 pr_debug("Setting vtag %x for dir %d\n", 437 448 sh->vtag, dir); 438 449 ct->proto.sctp.vtag[dir] = sh->vtag; 439 450 } else if (sh->vtag != ct->proto.sctp.vtag[dir]) { 440 - pr_debug("Verification tag check failed\n"); 441 - goto out_unlock; 451 + if (test_bit(SCTP_CID_DATA, map) || ignore) 452 + goto out_unlock; 453 + 454 + if ((ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) == 0 || 455 + ct->proto.sctp.last_dir == dir) 456 + goto out_unlock; 457 + 458 + ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED; 459 + ct->proto.sctp.vtag[dir] = sh->vtag; 460 + ct->proto.sctp.vtag[!dir] = 0; 461 + } else if (ct->proto.sctp.flags & SCTP_FLAG_HEARTBEAT_VTAG_FAILED) { 462 + ct->proto.sctp.flags &= ~SCTP_FLAG_HEARTBEAT_VTAG_FAILED; 442 463 } 443 464 } 444 465 ··· 496 469 nf_conntrack_event_cache(IPCT_PROTOINFO, ct); 497 470 } 498 471 spin_unlock_bh(&ct->lock); 472 + 473 + /* allow but do not refresh timeout */ 474 + if (ignore) 475 + return NF_ACCEPT; 499 476 500 477 timeouts = nf_ct_timeout_lookup(ct); 501 478 if (!timeouts)
+1 -1
net/netfilter/nf_conntrack_proto_tcp.c
··· 1152 1152 && (old_state == TCP_CONNTRACK_SYN_RECV 1153 1153 || old_state == TCP_CONNTRACK_ESTABLISHED) 1154 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 1156 after SYN_RECV or a valid answer for a picked up 1157 1157 connection. */ 1158 1158 set_bit(IPS_ASSURED_BIT, &ct->status);
+10 -16
net/netfilter/nf_conntrack_proto_udp.c
··· 81 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 84 /* Returns verdict for packet, and may modify conntracktype */ 97 85 int nf_conntrack_udp_packet(struct nf_conn *ct, 98 86 struct sk_buff *skb, ··· 112 124 113 125 nf_ct_refresh_acct(ct, ctinfo, skb, extra); 114 126 127 + /* never set ASSURED for IPS_NAT_CLASH, they time out soon */ 128 + if (unlikely((ct->status & IPS_NAT_CLASH))) 129 + return NF_ACCEPT; 130 + 115 131 /* Also, more likely to be important, and not a probe */ 116 132 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) 117 133 nf_conntrack_event_cache(IPCT_ASSURED, ct); 118 134 } else { 119 - nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo, 120 - timeouts[UDP_CT_UNREPLIED]); 135 + nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED]); 121 136 } 122 137 return NF_ACCEPT; 123 138 } ··· 197 206 if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { 198 207 nf_ct_refresh_acct(ct, ctinfo, skb, 199 208 timeouts[UDP_CT_REPLIED]); 209 + 210 + if (unlikely((ct->status & IPS_NAT_CLASH))) 211 + return NF_ACCEPT; 212 + 200 213 /* Also, more likely to be important, and not a probe */ 201 214 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status)) 202 215 nf_conntrack_event_cache(IPCT_ASSURED, ct); 203 216 } else { 204 - nf_conntrack_udp_refresh_unreplied(ct, skb, ctinfo, 205 - timeouts[UDP_CT_UNREPLIED]); 217 + nf_ct_refresh_acct(ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED]); 206 218 } 207 219 return NF_ACCEPT; 208 220 }
+31 -33
net/netfilter/nf_tables_api.c
··· 815 815 nlh->nlmsg_seq, NFT_MSG_NEWTABLE, 0, 816 816 family, table); 817 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 823 kfree_skb(skb2); 824 824 return err; 825 825 } ··· 1563 1563 nlh->nlmsg_seq, NFT_MSG_NEWCHAIN, 0, 1564 1564 family, table, chain); 1565 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 1571 kfree_skb(skb2); 1572 1572 return err; 1573 1573 } ··· 3008 3008 nlh->nlmsg_seq, NFT_MSG_NEWRULE, 0, 3009 3009 family, table, chain, rule, NULL); 3010 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 3016 kfree_skb(skb2); 3017 3017 return err; 3018 3018 } ··· 3770 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 3775 goto nla_put_failure; 3775 3776 3776 3777 nest = nla_nest_start_noflag(skb, NFTA_SET_DESC); ··· 3968 3967 3969 3968 err = nf_tables_fill_set(skb2, &ctx, set, NFT_MSG_NEWSET, 0); 3970 3969 if (err < 0) 3971 - goto err; 3970 + goto err_fill_set_info; 3972 3971 3973 - return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); 3972 + return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); 3974 3973 3975 - err: 3974 + err_fill_set_info: 3976 3975 kfree_skb(skb2); 3977 3976 return err; 3978 3977 } ··· 4860 4859 err = -ENOMEM; 4861 4860 skb = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC); 4862 4861 if (skb == NULL) 4863 - goto err1; 4862 + return err; 4864 4863 4865 4864 err = nf_tables_fill_setelem_info(skb, ctx, ctx->seq, ctx->portid, 4866 4865 NFT_MSG_NEWSETELEM, 0, set, &elem); 4867 4866 if (err < 0) 4868 - goto err2; 4867 + goto err_fill_setelem; 4869 4868 4870 - err = nfnetlink_unicast(skb, ctx->net, ctx->portid, MSG_DONTWAIT); 4871 - /* This avoids a loop in nfnetlink. */ 4872 - if (err < 0) 4873 - goto err1; 4869 + return nfnetlink_unicast(skb, ctx->net, ctx->portid); 4874 4870 4875 - return 0; 4876 - err2: 4871 + err_fill_setelem: 4877 4872 kfree_skb(skb); 4878 - err1: 4879 - /* this avoids a loop in nfnetlink. */ 4880 - return err == -EAGAIN ? -ENOBUFS : err; 4873 + return err; 4881 4874 } 4882 4875 4883 4876 /* called with rcu_read_lock held */ ··· 6176 6181 nlh->nlmsg_seq, NFT_MSG_NEWOBJ, 0, 6177 6182 family, table, obj, reset); 6178 6183 if (err < 0) 6179 - goto err; 6184 + goto err_fill_obj_info; 6180 6185 6181 - return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); 6182 - err: 6186 + return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); 6187 + 6188 + err_fill_obj_info: 6183 6189 kfree_skb(skb2); 6184 6190 return err; 6185 6191 } ··· 7040 7044 NFT_MSG_NEWFLOWTABLE, 0, family, 7041 7045 flowtable, &flowtable->hook_list); 7042 7046 if (err < 0) 7043 - goto err; 7047 + goto err_fill_flowtable_info; 7044 7048 7045 - return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); 7046 - err: 7049 + return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); 7050 + 7051 + err_fill_flowtable_info: 7047 7052 kfree_skb(skb2); 7048 7053 return err; 7049 7054 } ··· 7230 7233 err = nf_tables_fill_gen_info(skb2, net, NETLINK_CB(skb).portid, 7231 7234 nlh->nlmsg_seq); 7232 7235 if (err < 0) 7233 - goto err; 7236 + goto err_fill_gen_info; 7234 7237 7235 - return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); 7236 - err: 7238 + return nfnetlink_unicast(skb2, net, NETLINK_CB(skb).portid); 7239 + 7240 + err_fill_gen_info: 7237 7241 kfree_skb(skb2); 7238 7242 return err; 7239 7243 }
+8 -3
net/netfilter/nfnetlink.c
··· 149 149 } 150 150 EXPORT_SYMBOL_GPL(nfnetlink_set_err); 151 151 152 - int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid, 153 - int flags) 152 + int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid) 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 162 EXPORT_SYMBOL_GPL(nfnetlink_unicast); 158 163
+1 -1
net/netfilter/nft_flow_offload.c
··· 102 102 } 103 103 104 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 106 goto out; 107 107 108 108 if (!nf_ct_is_confirmed(ct))
+3 -1
net/netfilter/nft_payload.c
··· 87 87 u32 *dest = &regs->data[priv->dreg]; 88 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 93 switch (priv->base) { 92 94 case NFT_PAYLOAD_LL_HEADER: 93 95 if (!skb_mac_header_was_set(skb))
+47 -10
net/netfilter/nft_set_rbtree.c
··· 218 218 struct nft_rbtree_elem *new, 219 219 struct nft_set_ext **ext) 220 220 { 221 + bool overlap = false, dup_end_left = false, dup_end_right = false; 221 222 struct nft_rbtree *priv = nft_set_priv(set); 222 223 u8 genmask = nft_genmask_next(net); 223 224 struct nft_rbtree_elem *rbe; 224 225 struct rb_node *parent, **p; 225 - bool overlap = false; 226 226 int d; 227 227 228 228 /* Detect overlaps as we descend the tree. Set the flag in these cases: ··· 238 238 * 239 239 * b1. _ _ __>| !_ _ __| (insert end before existing start) 240 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 245 * Case a3. resolves to b3.: 244 246 * - if the inserted start element is the leftmost, because the '0' 245 247 * element in the tree serves as end element 246 - * - otherwise, if an existing end is found. Note that end elements are 247 - * always inserted after corresponding start elements. 248 + * - otherwise, if an existing end is found immediately to the left. If 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 255 * For a new, rightmost pair of elements, we'll hit cases b3. and b2., 250 256 * in that order. 251 257 * 252 258 * The flag is also cleared in two special cases: 253 259 * 254 - * b4. |__ _ _!|<_ _ _ (insert start right before existing end) 255 - * b5. |__ _ >|!__ _ _ (insert end right after existing start) 260 + * b5. |__ _ _!|<_ _ _ (insert start right before existing end) 261 + * b6. |__ _ >|!__ _ _ (insert end right after existing start) 256 262 * 257 263 * which always happen as last step and imply that no further 258 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 281 parent = NULL; ··· 292 272 if (nft_rbtree_interval_start(new)) { 293 273 if (nft_rbtree_interval_end(rbe) && 294 274 nft_set_elem_active(&rbe->ext, genmask) && 295 - !nft_set_elem_expired(&rbe->ext)) 275 + !nft_set_elem_expired(&rbe->ext) && !*p) 296 276 overlap = false; 297 277 } else { 278 + if (dup_end_left && !*p) 279 + return -ENOTEMPTY; 280 + 298 281 overlap = nft_rbtree_interval_end(rbe) && 299 282 nft_set_elem_active(&rbe->ext, 300 283 genmask) && 301 284 !nft_set_elem_expired(&rbe->ext); 285 + 286 + if (overlap) { 287 + dup_end_right = true; 288 + continue; 289 + } 302 290 } 303 291 } else if (d > 0) { 304 292 p = &parent->rb_right; 305 293 306 294 if (nft_rbtree_interval_end(new)) { 295 + if (dup_end_right && !*p) 296 + return -ENOTEMPTY; 297 + 307 298 overlap = nft_rbtree_interval_end(rbe) && 308 299 nft_set_elem_active(&rbe->ext, 309 300 genmask) && 310 301 !nft_set_elem_expired(&rbe->ext); 311 - } else if (nft_rbtree_interval_end(rbe) && 312 - nft_set_elem_active(&rbe->ext, genmask) && 302 + 303 + if (overlap) { 304 + dup_end_left = true; 305 + continue; 306 + } 307 + } else if (nft_set_elem_active(&rbe->ext, genmask) && 313 308 !nft_set_elem_expired(&rbe->ext)) { 314 - overlap = true; 309 + overlap = nft_rbtree_interval_end(rbe); 315 310 } 316 311 } else { 317 312 if (nft_rbtree_interval_end(rbe) && ··· 351 316 p = &parent->rb_left; 352 317 } 353 318 } 319 + 320 + dup_end_left = dup_end_right = false; 354 321 } 355 322 356 323 if (overlap)
+1 -1
net/netfilter/xt_recent.c
··· 640 640 struct recent_table *t; 641 641 642 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 644 * remove it. 645 645 */ 646 646 spin_lock_bh(&recent_lock);
+33 -32
net/netlabel/netlabel_domainhash.c
··· 85 85 kfree(netlbl_domhsh_addr6_entry(iter6)); 86 86 } 87 87 #endif /* IPv6 */ 88 + kfree(ptr->def.addrsel); 88 89 } 89 90 kfree(ptr->domain); 90 91 kfree(ptr); ··· 538 537 goto add_return; 539 538 } 540 539 #endif /* IPv6 */ 540 + /* cleanup the new entry since we've moved everything over */ 541 + netlbl_domhsh_free_entry(&entry->rcu); 541 542 } else 542 543 ret_val = -EINVAL; 543 544 ··· 583 580 { 584 581 int ret_val = 0; 585 582 struct audit_buffer *audit_buf; 583 + struct netlbl_af4list *iter4; 584 + struct netlbl_domaddr4_map *map4; 585 + #if IS_ENABLED(CONFIG_IPV6) 586 + struct netlbl_af6list *iter6; 587 + struct netlbl_domaddr6_map *map6; 588 + #endif /* IPv6 */ 586 589 587 590 if (entry == NULL) 588 591 return -ENOENT; ··· 606 597 ret_val = -ENOENT; 607 598 spin_unlock(&netlbl_domhsh_lock); 608 599 600 + if (ret_val) 601 + return ret_val; 602 + 609 603 audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_DEL, audit_info); 610 604 if (audit_buf != NULL) { 611 605 audit_log_format(audit_buf, ··· 618 606 audit_log_end(audit_buf); 619 607 } 620 608 621 - if (ret_val == 0) { 622 - struct netlbl_af4list *iter4; 623 - struct netlbl_domaddr4_map *map4; 624 - #if IS_ENABLED(CONFIG_IPV6) 625 - struct netlbl_af6list *iter6; 626 - struct netlbl_domaddr6_map *map6; 627 - #endif /* IPv6 */ 628 - 629 - switch (entry->def.type) { 630 - case NETLBL_NLTYPE_ADDRSELECT: 631 - netlbl_af4list_foreach_rcu(iter4, 632 - &entry->def.addrsel->list4) { 633 - map4 = netlbl_domhsh_addr4_entry(iter4); 634 - cipso_v4_doi_putdef(map4->def.cipso); 635 - } 636 - #if IS_ENABLED(CONFIG_IPV6) 637 - netlbl_af6list_foreach_rcu(iter6, 638 - &entry->def.addrsel->list6) { 639 - map6 = netlbl_domhsh_addr6_entry(iter6); 640 - calipso_doi_putdef(map6->def.calipso); 641 - } 642 - #endif /* IPv6 */ 643 - break; 644 - case NETLBL_NLTYPE_CIPSOV4: 645 - cipso_v4_doi_putdef(entry->def.cipso); 646 - break; 647 - #if IS_ENABLED(CONFIG_IPV6) 648 - case NETLBL_NLTYPE_CALIPSO: 649 - calipso_doi_putdef(entry->def.calipso); 650 - break; 651 - #endif /* IPv6 */ 609 + switch (entry->def.type) { 610 + case NETLBL_NLTYPE_ADDRSELECT: 611 + netlbl_af4list_foreach_rcu(iter4, &entry->def.addrsel->list4) { 612 + map4 = netlbl_domhsh_addr4_entry(iter4); 613 + cipso_v4_doi_putdef(map4->def.cipso); 652 614 } 653 - call_rcu(&entry->rcu, netlbl_domhsh_free_entry); 615 + #if IS_ENABLED(CONFIG_IPV6) 616 + netlbl_af6list_foreach_rcu(iter6, &entry->def.addrsel->list6) { 617 + map6 = netlbl_domhsh_addr6_entry(iter6); 618 + calipso_doi_putdef(map6->def.calipso); 619 + } 620 + #endif /* IPv6 */ 621 + break; 622 + case NETLBL_NLTYPE_CIPSOV4: 623 + cipso_v4_doi_putdef(entry->def.cipso); 624 + break; 625 + #if IS_ENABLED(CONFIG_IPV6) 626 + case NETLBL_NLTYPE_CALIPSO: 627 + calipso_doi_putdef(entry->def.calipso); 628 + break; 629 + #endif /* IPv6 */ 654 630 } 631 + call_rcu(&entry->rcu, netlbl_domhsh_free_entry); 655 632 656 633 return ret_val; 657 634 }
+1 -1
net/netlink/af_netlink.c
··· 353 353 { 354 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 357 clear_bit(NETLINK_S_CONGESTED, &nlk->state); 358 358 if (!test_bit(NETLINK_S_CONGESTED, &nlk->state)) 359 359 wake_up_interruptible(&nlk->wait);
+6 -1
net/packet/af_packet.c
··· 2170 2170 int skb_len = skb->len; 2171 2171 unsigned int snaplen, res; 2172 2172 unsigned long status = TP_STATUS_USER; 2173 - unsigned short macoff, netoff, hdrlen; 2173 + unsigned short macoff, hdrlen; 2174 + unsigned int netoff; 2174 2175 struct sk_buff *copy_skb = NULL; 2175 2176 struct timespec64 ts; 2176 2177 __u32 ts_status; ··· 2239 2238 do_vnet = true; 2240 2239 } 2241 2240 macoff = netoff - maclen; 2241 + } 2242 + if (netoff > USHRT_MAX) { 2243 + atomic_inc(&po->tp_drops); 2244 + goto drop_n_restore; 2242 2245 } 2243 2246 if (po->tp_version <= TPACKET_V2) { 2244 2247 if (macoff + snaplen > po->rx_ring.frame_size) {
+8 -5
net/rxrpc/ar-internal.h
··· 488 488 RXRPC_CALL_RX_LAST, /* Received the last packet (at rxtx_top) */ 489 489 RXRPC_CALL_TX_LAST, /* Last packet in Tx buffer (at rxtx_top) */ 490 490 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */ 491 - RXRPC_CALL_PINGING, /* Ping in process */ 492 491 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ 493 492 RXRPC_CALL_BEGAN_RX_TIMER, /* We began the expect_rx_by timer */ 494 493 RXRPC_CALL_RX_HEARD, /* The peer responded at least once to this call */ ··· 672 673 rxrpc_seq_t ackr_consumed; /* Highest packet shown consumed */ 673 674 rxrpc_seq_t ackr_seen; /* Highest packet shown seen */ 674 675 675 - /* ping management */ 676 - rxrpc_serial_t ping_serial; /* Last ping sent */ 677 - ktime_t ping_time; /* Time last ping sent */ 676 + /* RTT management */ 677 + rxrpc_serial_t rtt_serial[4]; /* Serial number of DATA or PING sent */ 678 + ktime_t rtt_sent_at[4]; /* Time packet sent */ 679 + unsigned long rtt_avail; /* Mask of available slots in bits 0-3, 680 + * Mask of pending samples in 8-11 */ 681 + #define RXRPC_CALL_RTT_AVAIL_MASK 0xf 682 + #define RXRPC_CALL_RTT_PEND_SHIFT 8 678 683 679 684 /* transmission-phase ACK management */ 680 685 ktime_t acks_latest_ts; /* Timestamp of latest ACK received */ ··· 1040 1037 /* 1041 1038 * rtt.c 1042 1039 */ 1043 - void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace, 1040 + void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace, int, 1044 1041 rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t); 1045 1042 unsigned long rxrpc_get_rto_backoff(struct rxrpc_peer *, bool); 1046 1043 void rxrpc_peer_init_rtt(struct rxrpc_peer *);
+1
net/rxrpc/call_object.c
··· 153 153 call->cong_ssthresh = RXRPC_RXTX_BUFF_SIZE - 1; 154 154 155 155 call->rxnet = rxnet; 156 + call->rtt_avail = RXRPC_CALL_RTT_AVAIL_MASK; 156 157 atomic_inc(&rxnet->nr_calls); 157 158 return call; 158 159
+70 -53
net/rxrpc/input.c
··· 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, 614 - ktime_t resp_time, 615 - rxrpc_serial_t orig_serial, 616 - rxrpc_serial_t ack_serial) 613 + static void rxrpc_complete_rtt_probe(struct rxrpc_call *call, 614 + ktime_t resp_time, 615 + rxrpc_serial_t acked_serial, 616 + rxrpc_serial_t ack_serial, 617 + enum rxrpc_rtt_rx_trace type) 617 618 { 618 - struct rxrpc_skb_priv *sp; 619 - struct sk_buff *skb; 619 + rxrpc_serial_t orig_serial; 620 + unsigned long avail; 620 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++) { 624 - skb = call->rxtx_buffer[ix]; 625 - if (!skb) 625 + avail = READ_ONCE(call->rtt_avail); 626 + smp_rmb(); /* Read avail bits before accessing data. */ 627 + 628 + for (i = 0; i < ARRAY_SIZE(call->rtt_serial); i++) { 629 + if (!test_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &avail)) 626 630 continue; 627 631 628 - sent_at = skb->tstamp; 629 - smp_rmb(); /* Read timestamp before serial. */ 630 - sp = rxrpc_skb(skb); 631 - if (sp->hdr.serial != orig_serial) 632 - continue; 633 - goto found; 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 + } 634 658 } 635 659 636 - return; 637 - 638 - found: 639 - rxrpc_peer_add_rtt(call, rxrpc_rtt_rx_requested_ack, 640 - orig_serial, ack_serial, sent_at, resp_time); 660 + if (!matched) 661 + trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_lost, 9, 0, acked_serial, 0, 0); 641 662 } 642 663 643 664 /* ··· 703 682 */ 704 683 static void rxrpc_input_ping_response(struct rxrpc_call *call, 705 684 ktime_t resp_time, 706 - rxrpc_serial_t orig_serial, 685 + rxrpc_serial_t acked_serial, 707 686 rxrpc_serial_t ack_serial) 708 687 { 709 - rxrpc_serial_t ping_serial; 710 - ktime_t ping_time; 711 - 712 - ping_time = call->ping_time; 713 - smp_rmb(); 714 - ping_serial = READ_ONCE(call->ping_serial); 715 - 716 - if (orig_serial == call->acks_lost_ping) 688 + if (acked_serial == call->acks_lost_ping) 717 689 rxrpc_input_check_for_lost_ack(call); 718 - 719 - if (before(orig_serial, ping_serial) || 720 - !test_and_clear_bit(RXRPC_CALL_PINGING, &call->flags)) 721 - return; 722 - if (after(orig_serial, ping_serial)) 723 - return; 724 - 725 - rxrpc_peer_add_rtt(call, rxrpc_rtt_rx_ping_response, 726 - orig_serial, ack_serial, ping_time, resp_time); 727 690 } 728 691 729 692 /* ··· 848 843 struct rxrpc_ackinfo info; 849 844 u8 acks[RXRPC_MAXACKS]; 850 845 } buf; 851 - rxrpc_serial_t acked_serial; 846 + rxrpc_serial_t ack_serial, acked_serial; 852 847 rxrpc_seq_t first_soft_ack, hard_ack, prev_pkt; 853 848 int nr_acks, offset, ioffset; 854 849 ··· 861 856 } 862 857 offset += sizeof(buf.ack); 863 858 859 + ack_serial = sp->hdr.serial; 864 860 acked_serial = ntohl(buf.ack.serial); 865 861 first_soft_ack = ntohl(buf.ack.firstPacket); 866 862 prev_pkt = ntohl(buf.ack.previousPacket); ··· 870 864 summary.ack_reason = (buf.ack.reason < RXRPC_ACK__INVALID ? 871 865 buf.ack.reason : RXRPC_ACK__INVALID); 872 866 873 - trace_rxrpc_rx_ack(call, sp->hdr.serial, acked_serial, 867 + trace_rxrpc_rx_ack(call, ack_serial, acked_serial, 874 868 first_soft_ack, prev_pkt, 875 869 summary.ack_reason, nr_acks); 876 870 877 - if (buf.ack.reason == RXRPC_ACK_PING_RESPONSE) 871 + switch (buf.ack.reason) { 872 + case RXRPC_ACK_PING_RESPONSE: 878 873 rxrpc_input_ping_response(call, skb->tstamp, acked_serial, 879 - sp->hdr.serial); 880 - if (buf.ack.reason == RXRPC_ACK_REQUESTED) 881 - rxrpc_input_requested_ack(call, skb->tstamp, acked_serial, 882 - sp->hdr.serial); 874 + ack_serial); 875 + rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, 876 + rxrpc_rtt_rx_ping_response); 877 + break; 878 + case RXRPC_ACK_REQUESTED: 879 + rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, 880 + rxrpc_rtt_rx_requested_ack); 881 + break; 882 + default: 883 + if (acked_serial != 0) 884 + rxrpc_complete_rtt_probe(call, skb->tstamp, acked_serial, ack_serial, 885 + rxrpc_rtt_rx_cancel); 886 + break; 887 + } 883 888 884 889 if (buf.ack.reason == RXRPC_ACK_PING) { 885 - _proto("Rx ACK %%%u PING Request", sp->hdr.serial); 890 + _proto("Rx ACK %%%u PING Request", ack_serial); 886 891 rxrpc_propose_ACK(call, RXRPC_ACK_PING_RESPONSE, 887 - sp->hdr.serial, true, true, 892 + ack_serial, true, true, 888 893 rxrpc_propose_ack_respond_to_ping); 889 894 } else if (sp->hdr.flags & RXRPC_REQUEST_ACK) { 890 895 rxrpc_propose_ACK(call, RXRPC_ACK_REQUESTED, 891 - sp->hdr.serial, true, true, 896 + ack_serial, true, true, 892 897 rxrpc_propose_ack_respond_to_ack); 893 898 } 894 899 895 900 /* Discard any out-of-order or duplicate ACKs (outside lock). */ 896 901 if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) { 897 - trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial, 902 + trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial, 898 903 first_soft_ack, call->ackr_first_seq, 899 904 prev_pkt, call->ackr_prev_seq); 900 905 return; ··· 921 904 922 905 /* Discard any out-of-order or duplicate ACKs (inside lock). */ 923 906 if (!rxrpc_is_ack_valid(call, first_soft_ack, prev_pkt)) { 924 - trace_rxrpc_rx_discard_ack(call->debug_id, sp->hdr.serial, 907 + trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial, 925 908 first_soft_ack, call->ackr_first_seq, 926 909 prev_pkt, call->ackr_prev_seq); 927 910 goto out; ··· 981 964 RXRPC_TX_ANNO_LAST && 982 965 summary.nr_acks == call->tx_top - hard_ack && 983 966 rxrpc_is_client_call(call)) 984 - rxrpc_propose_ACK(call, RXRPC_ACK_PING, sp->hdr.serial, 967 + rxrpc_propose_ACK(call, RXRPC_ACK_PING, ack_serial, 985 968 false, true, 986 969 rxrpc_propose_ack_ping_for_lost_reply); 987 970
+61 -21
net/rxrpc/output.c
··· 124 124 } 125 125 126 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 + 169 + /* 127 170 * Send an ACK call packet. 128 171 */ 129 172 int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping, ··· 179 136 rxrpc_serial_t serial; 180 137 rxrpc_seq_t hard_ack, top; 181 138 size_t len, n; 182 - int ret; 139 + int ret, rtt_slot = -1; 183 140 u8 reason; 184 141 185 142 if (test_bit(RXRPC_CALL_DISCONNECTED, &call->flags)) ··· 239 196 if (_serial) 240 197 *_serial = serial; 241 198 242 - if (ping) { 243 - call->ping_serial = serial; 244 - smp_wmb(); 245 - /* We need to stick a time in before we send the packet in case 246 - * the reply gets back before kernel_sendmsg() completes - but 247 - * asking UDP to send the packet can take a relatively long 248 - * time. 249 - */ 250 - call->ping_time = ktime_get_real(); 251 - set_bit(RXRPC_CALL_PINGING, &call->flags); 252 - trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_ping, serial); 253 - } 199 + if (ping) 200 + rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_ping); 254 201 255 202 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); 256 203 conn->params.peer->last_tx_at = ktime_get_seconds(); ··· 254 221 255 222 if (call->state < RXRPC_CALL_COMPLETE) { 256 223 if (ret < 0) { 257 - if (ping) 258 - clear_bit(RXRPC_CALL_PINGING, &call->flags); 224 + rxrpc_cancel_rtt_probe(call, serial, rtt_slot); 259 225 rxrpc_propose_ACK(call, pkt->ack.reason, 260 226 ntohl(pkt->ack.serial), 261 227 false, true, ··· 353 321 struct kvec iov[2]; 354 322 rxrpc_serial_t serial; 355 323 size_t len; 356 - int ret; 324 + int ret, rtt_slot = -1; 357 325 358 326 _enter(",{%d}", skb->len); 359 327 ··· 429 397 sp->hdr.serial = serial; 430 398 smp_wmb(); /* Set serial before timestamp */ 431 399 skb->tstamp = ktime_get_real(); 400 + if (whdr.flags & RXRPC_REQUEST_ACK) 401 + rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data); 432 402 433 403 /* send the packet by UDP 434 404 * - returns -EMSGSIZE if UDP would have to fragment the packet ··· 442 408 conn->params.peer->last_tx_at = ktime_get_seconds(); 443 409 444 410 up_read(&conn->params.local->defrag_sem); 445 - if (ret < 0) 411 + if (ret < 0) { 412 + rxrpc_cancel_rtt_probe(call, serial, rtt_slot); 446 413 trace_rxrpc_tx_fail(call->debug_id, serial, ret, 447 414 rxrpc_tx_point_call_data_nofrag); 448 - else 415 + } else { 449 416 trace_rxrpc_tx_packet(call->debug_id, &whdr, 450 417 rxrpc_tx_point_call_data_nofrag); 418 + } 419 + 451 420 rxrpc_tx_backoff(call, ret); 452 421 if (ret == -EMSGSIZE) 453 422 goto send_fragmentable; ··· 459 422 if (ret >= 0) { 460 423 if (whdr.flags & RXRPC_REQUEST_ACK) { 461 424 call->peer->rtt_last_req = skb->tstamp; 462 - trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial); 463 425 if (call->peer->rtt_count > 1) { 464 426 unsigned long nowj = jiffies, ack_lost_at; 465 427 ··· 505 469 sp->hdr.serial = serial; 506 470 smp_wmb(); /* Set serial before timestamp */ 507 471 skb->tstamp = ktime_get_real(); 472 + if (whdr.flags & RXRPC_REQUEST_ACK) 473 + rtt_slot = rxrpc_begin_rtt_probe(call, serial, rxrpc_rtt_tx_data); 508 474 509 475 switch (conn->params.local->srx.transport.family) { 510 476 case AF_INET6: ··· 525 487 BUG(); 526 488 } 527 489 528 - if (ret < 0) 490 + if (ret < 0) { 491 + rxrpc_cancel_rtt_probe(call, serial, rtt_slot); 529 492 trace_rxrpc_tx_fail(call->debug_id, serial, ret, 530 493 rxrpc_tx_point_call_data_frag); 531 - else 494 + } else { 532 495 trace_rxrpc_tx_packet(call->debug_id, &whdr, 533 496 rxrpc_tx_point_call_data_frag); 497 + } 534 498 rxrpc_tx_backoff(call, ret); 535 499 536 500 up_write(&conn->params.local->defrag_sem);
+13 -3
net/rxrpc/peer_object.c
··· 502 502 * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT 503 503 * @sock: The socket on which the call is in progress. 504 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 522 EXPORT_SYMBOL(rxrpc_kernel_get_srtt);
+2 -1
net/rxrpc/rtt.c
··· 146 146 * exclusive access to the peer RTT data. 147 147 */ 148 148 void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, 149 + int rtt_slot, 149 150 rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial, 150 151 ktime_t send_time, ktime_t resp_time) 151 152 { ··· 163 162 peer->rtt_count++; 164 163 spin_unlock(&peer->rtt_input_lock); 165 164 166 - trace_rxrpc_rtt_rx(call, why, send_serial, resp_serial, 165 + trace_rxrpc_rtt_rx(call, why, rtt_slot, send_serial, resp_serial, 167 166 peer->srtt_us >> 3, peer->rto_j); 168 167 } 169 168
+2 -1
net/rxrpc/rxkad.c
··· 1137 1137 ret = -ENOMEM; 1138 1138 ticket = kmalloc(ticket_len, GFP_NOFS); 1139 1139 if (!ticket) 1140 - goto temporary_error; 1140 + goto temporary_error_free_resp; 1141 1141 1142 1142 eproto = tracepoint_string("rxkad_tkt_short"); 1143 1143 abort_code = RXKADPACKETSHORT; ··· 1230 1230 1231 1231 temporary_error_free_ticket: 1232 1232 kfree(ticket); 1233 + temporary_error_free_resp: 1233 1234 kfree(response); 1234 1235 temporary_error: 1235 1236 /* Ignore the response packet if we got a temporary error such as
+4 -16
net/sched/sch_red.c
··· 353 353 FLOW_BLOCK_BINDER_TYPE_RED_EARLY_DROP, 354 354 tb[TCA_RED_EARLY_DROP_BLOCK], extack); 355 355 if (err) 356 - goto err_early_drop_init; 356 + return err; 357 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 - 366 - err_mark_init: 367 - tcf_qevent_destroy(&q->qe_early_drop, sch); 368 - err_early_drop_init: 369 - del_timer_sync(&q->adapt_timer); 370 - red_offload(sch, false); 371 - qdisc_put(q->qdisc); 372 - return err; 358 + return tcf_qevent_init(&q->qe_mark, sch, 359 + FLOW_BLOCK_BINDER_TYPE_RED_MARK, 360 + tb[TCA_RED_MARK_BLOCK], extack); 373 361 } 374 362 375 363 static int red_change(struct Qdisc *sch, struct nlattr *opt,
+24 -6
net/sched/sch_taprio.c
··· 1176 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 1199 struct sched_gate_list *sched, 1181 - const struct tc_mqprio_qopt *mqprio, 1182 1200 struct tc_taprio_qopt_offload *offload) 1183 1201 { 1184 1202 struct sched_entry *entry; ··· 1211 1193 1212 1194 e->command = entry->command; 1213 1195 e->interval = entry->interval; 1214 - e->gate_mask = entry->gate_mask; 1196 + e->gate_mask = tc_map_to_queue_mask(dev, entry->gate_mask); 1197 + 1215 1198 i++; 1216 1199 } 1217 1200 ··· 1220 1201 } 1221 1202 1222 1203 static int taprio_enable_offload(struct net_device *dev, 1223 - struct tc_mqprio_qopt *mqprio, 1224 1204 struct taprio_sched *q, 1225 1205 struct sched_gate_list *sched, 1226 1206 struct netlink_ext_ack *extack) ··· 1241 1223 return -ENOMEM; 1242 1224 } 1243 1225 offload->enable = 1; 1244 - taprio_sched_to_offload(q, sched, mqprio, offload); 1226 + taprio_sched_to_offload(dev, sched, offload); 1245 1227 1246 1228 err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_TAPRIO, offload); 1247 1229 if (err < 0) { ··· 1503 1485 } 1504 1486 1505 1487 if (FULL_OFFLOAD_IS_ENABLED(q->flags)) 1506 - err = taprio_enable_offload(dev, mqprio, q, new_admin, extack); 1488 + err = taprio_enable_offload(dev, q, new_admin, extack); 1507 1489 else 1508 1490 err = taprio_disable_offload(dev, q, extack); 1509 1491 if (err)
+6 -10
net/sctp/socket.c
··· 8060 8060 8061 8061 pr_debug("%s: begins, snum:%d\n", __func__, snum); 8062 8062 8063 - local_bh_disable(); 8064 - 8065 8063 if (snum == 0) { 8066 8064 /* Search for an available port. */ 8067 8065 int low, high, remaining, index; ··· 8077 8079 continue; 8078 8080 index = sctp_phashfn(net, rover); 8079 8081 head = &sctp_port_hashtable[index]; 8080 - spin_lock(&head->lock); 8082 + spin_lock_bh(&head->lock); 8081 8083 sctp_for_each_hentry(pp, &head->chain) 8082 8084 if ((pp->port == rover) && 8083 8085 net_eq(net, pp->net)) 8084 8086 goto next; 8085 8087 break; 8086 8088 next: 8087 - spin_unlock(&head->lock); 8089 + spin_unlock_bh(&head->lock); 8090 + cond_resched(); 8088 8091 } while (--remaining > 0); 8089 8092 8090 8093 /* Exhausted local port range during search? */ 8091 8094 ret = 1; 8092 8095 if (remaining <= 0) 8093 - goto fail; 8096 + return ret; 8094 8097 8095 8098 /* OK, here is the one we will use. HEAD (the port 8096 8099 * hash table list entry) is non-NULL and we hold it's ··· 8106 8107 * port iterator, pp being NULL. 8107 8108 */ 8108 8109 head = &sctp_port_hashtable[sctp_phashfn(net, snum)]; 8109 - spin_lock(&head->lock); 8110 + spin_lock_bh(&head->lock); 8110 8111 sctp_for_each_hentry(pp, &head->chain) { 8111 8112 if ((pp->port == snum) && net_eq(pp->net, net)) 8112 8113 goto pp_found; ··· 8206 8207 ret = 0; 8207 8208 8208 8209 fail_unlock: 8209 - spin_unlock(&head->lock); 8210 - 8211 - fail: 8212 - local_bh_enable(); 8210 + spin_unlock_bh(&head->lock); 8213 8211 return ret; 8214 8212 } 8215 8213
+8 -7
net/smc/smc_close.c
··· 116 116 cancel_work_sync(&smc->conn.close_work); 117 117 cancel_delayed_work_sync(&smc->conn.tx_work); 118 118 lock_sock(sk); 119 - sk->sk_state = SMC_CLOSED; 120 119 } 121 120 122 121 /* terminate smc socket abnormally - active abort ··· 133 134 } 134 135 switch (sk->sk_state) { 135 136 case SMC_ACTIVE: 136 - sk->sk_state = SMC_PEERABORTWAIT; 137 - smc_close_cancel_work(smc); 138 - sk->sk_state = SMC_CLOSED; 139 - sock_put(sk); /* passive closing */ 140 - break; 141 137 case SMC_APPCLOSEWAIT1: 142 138 case SMC_APPCLOSEWAIT2: 139 + sk->sk_state = SMC_PEERABORTWAIT; 143 140 smc_close_cancel_work(smc); 141 + if (sk->sk_state != SMC_PEERABORTWAIT) 142 + break; 144 143 sk->sk_state = SMC_CLOSED; 145 - sock_put(sk); /* postponed passive closing */ 144 + sock_put(sk); /* (postponed) passive closing */ 146 145 break; 147 146 case SMC_PEERCLOSEWAIT1: 148 147 case SMC_PEERCLOSEWAIT2: 149 148 case SMC_PEERFINCLOSEWAIT: 150 149 sk->sk_state = SMC_PEERABORTWAIT; 151 150 smc_close_cancel_work(smc); 151 + if (sk->sk_state != SMC_PEERABORTWAIT) 152 + break; 152 153 sk->sk_state = SMC_CLOSED; 153 154 smc_conn_free(&smc->conn); 154 155 release_clcsock = true; ··· 158 159 case SMC_APPFINCLOSEWAIT: 159 160 sk->sk_state = SMC_PEERABORTWAIT; 160 161 smc_close_cancel_work(smc); 162 + if (sk->sk_state != SMC_PEERABORTWAIT) 163 + break; 161 164 sk->sk_state = SMC_CLOSED; 162 165 smc_conn_free(&smc->conn); 163 166 release_clcsock = true;
+3
net/smc/smc_core.c
··· 1356 1356 if (ini->is_smcd) { 1357 1357 conn->rx_off = sizeof(struct smcd_cdc_msg); 1358 1358 smcd_cdc_rx_init(conn); /* init tasklet for this conn */ 1359 + } else { 1360 + conn->rx_off = 0; 1359 1361 } 1360 1362 #ifndef KERNEL_HAS_ATOMIC64 1361 1363 spin_lock_init(&conn->acurs_lock); ··· 1779 1777 list_del(&smc->conn.sndbuf_desc->list); 1780 1778 mutex_unlock(&smc->conn.lgr->sndbufs_lock); 1781 1779 smc_buf_free(smc->conn.lgr, false, smc->conn.sndbuf_desc); 1780 + smc->conn.sndbuf_desc = NULL; 1782 1781 } 1783 1782 return rc; 1784 1783 }
+14 -1
net/smc/smc_llc.c
··· 841 841 struct smc_init_info ini; 842 842 int lnk_idx, rc = 0; 843 843 844 + if (!llc->qp_mtu) 845 + goto out_reject; 846 + 844 847 ini.vlan_id = lgr->vlan_id; 845 848 smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev); 846 849 if (!memcmp(llc->sender_gid, link->peer_gid, SMC_GID_SIZE) && ··· 920 917 kfree(qentry); 921 918 } 922 919 920 + static bool smc_llc_is_empty_llc_message(union smc_llc_msg *llc) 921 + { 922 + int i; 923 + 924 + for (i = 0; i < ARRAY_SIZE(llc->raw.data); i++) 925 + if (llc->raw.data[i]) 926 + return false; 927 + return true; 928 + } 929 + 923 930 static bool smc_llc_is_local_add_link(union smc_llc_msg *llc) 924 931 { 925 932 if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK && 926 - !llc->add_link.qp_mtu && !llc->add_link.link_num) 933 + smc_llc_is_empty_llc_message(llc)) 927 934 return true; 928 935 return false; 929 936 }
+2 -2
net/socket.c
··· 3610 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 3614 * @sock: socket 3615 3615 * @addr: address holder 3616 3616 * ··· 3671 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 3675 * @sock: socket 3676 3676 * @how: connection part 3677 3677 *
+2 -2
net/sunrpc/rpcb_clnt.c
··· 982 982 p = xdr_inline_decode(xdr, len); 983 983 if (unlikely(p == NULL)) 984 984 goto out_fail; 985 - dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid, 986 - req->rq_task->tk_msg.rpc_proc->p_name, (char *)p); 985 + dprintk("RPC: %5u RPCB_%s reply: %*pE\n", req->rq_task->tk_pid, 986 + req->rq_task->tk_msg.rpc_proc->p_name, len, (char *)p); 987 987 988 988 if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len, 989 989 sap, sizeof(address)) == 0)
+2
net/sunrpc/xprtrdma/verbs.c
··· 933 933 934 934 rpcrdma_regbuf_dma_unmap(req->rl_sendbuf); 935 935 rpcrdma_regbuf_dma_unmap(req->rl_recvbuf); 936 + 937 + frwr_reset(req); 936 938 } 937 939 938 940 /* ASSUMPTION: the rb_allreqs list is stable for the duration,
+9 -3
net/tipc/crypto.c
··· 326 326 if (aead->cloned) { 327 327 tipc_aead_put(aead->cloned); 328 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 331 list_for_each_entry_safe(tfm_entry, tmp, &head->list, list) { 331 332 crypto_free_aead(tfm_entry->tfm); 332 333 list_del(&tfm_entry->list); ··· 400 399 */ 401 400 static struct crypto_aead *tipc_aead_tfm_next(struct tipc_aead *aead) 402 401 { 403 - struct tipc_tfm **tfm_entry = this_cpu_ptr(aead->tfm_entry); 402 + struct tipc_tfm **tfm_entry; 403 + struct crypto_aead *tfm; 404 404 405 + tfm_entry = get_cpu_ptr(aead->tfm_entry); 405 406 *tfm_entry = list_next_entry(*tfm_entry, list); 406 - return (*tfm_entry)->tfm; 407 + tfm = (*tfm_entry)->tfm; 408 + put_cpu_ptr(tfm_entry); 409 + 410 + return tfm; 407 411 } 408 412 409 413 /**
+6 -3
net/tipc/socket.c
··· 2771 2771 2772 2772 trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " "); 2773 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 2779 if (sk->sk_state == TIPC_DISCONNECTING) { 2777 2780 /* Discard any unreceived messages */ 2778 2781 __skb_queue_purge(&sk->sk_receive_queue); 2779 2782 2780 - /* Wake up anyone sleeping in poll */ 2781 - sk->sk_state_change(sk); 2782 2783 res = 0; 2783 2784 } else { 2784 2785 res = -ENOTCONN; 2785 2786 } 2787 + /* Wake up anyone sleeping in poll. */ 2788 + sk->sk_state_change(sk); 2786 2789 2787 2790 release_sock(sk); 2788 2791 return res;
+11 -4
net/wireless/chan.c
··· 10 10 */ 11 11 12 12 #include <linux/export.h> 13 + #include <linux/bitfield.h> 13 14 #include <net/cfg80211.h> 14 15 #include "core.h" 15 16 #include "rdev-ops.h" ··· 913 912 struct ieee80211_sta_vht_cap *vht_cap; 914 913 struct ieee80211_edmg *edmg_cap; 915 914 u32 width, control_freq, cap; 915 + bool support_80_80 = false; 916 916 917 917 if (WARN_ON(!cfg80211_chandef_valid(chandef))) 918 918 return false; ··· 981 979 return false; 982 980 break; 983 981 case NL80211_CHAN_WIDTH_80P80: 984 - cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; 985 - if (chandef->chan->band != NL80211_BAND_6GHZ && 986 - cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) 982 + cap = vht_cap->cap; 983 + support_80_80 = 984 + (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) || 985 + (cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && 986 + cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) || 987 + u32_get_bits(cap, IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) > 1; 988 + if (chandef->chan->band != NL80211_BAND_6GHZ && !support_80_80) 987 989 return false; 988 990 fallthrough; 989 991 case NL80211_CHAN_WIDTH_80: ··· 1007 1001 return false; 1008 1002 cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK; 1009 1003 if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ && 1010 - cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) 1004 + cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ && 1005 + !(vht_cap->cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK)) 1011 1006 return false; 1012 1007 break; 1013 1008 default:
+1 -1
net/wireless/nl80211.c
··· 6011 6011 6012 6012 if (info->attrs[NL80211_ATTR_HE_6GHZ_CAPABILITY]) 6013 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 6016 if (info->attrs[NL80211_ATTR_AIRTIME_WEIGHT]) 6017 6017 params.airtime_weight =
+3
net/wireless/reg.c
··· 2946 2946 if (WARN_ON(!alpha2)) 2947 2947 return -EINVAL; 2948 2948 2949 + if (!is_world_regdom(alpha2) && !is_an_alpha2(alpha2)) 2950 + return -EINVAL; 2951 + 2949 2952 request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); 2950 2953 if (!request) 2951 2954 return -ENOMEM;
+5 -3
net/wireless/util.c
··· 123 123 return (freq - 2407) / 5; 124 124 else if (freq >= 4910 && freq <= 4980) 125 125 return (freq - 4000) / 5; 126 - else if (freq < 5945) 126 + else if (freq < 5925) 127 127 return (freq - 5000) / 5; 128 + else if (freq == 5935) 129 + return 2; 128 130 else if (freq <= 45000) /* DMG band lower limit */ 129 - /* see 802.11ax D4.1 27.3.22.2 */ 130 - return (freq - 5940) / 5; 131 + /* see 802.11ax D6.1 27.3.22.2 */ 132 + return (freq - 5950) / 5; 131 133 else if (freq >= 58320 && freq <= 70200) 132 134 return (freq - 56160) / 2160; 133 135 else
+2 -2
scripts/checkpatch.pl
··· 2639 2639 2640 2640 # Check if the commit log has what seems like a diff which can confuse patch 2641 2641 if ($in_commit_log && !$commit_log_has_diff && 2642 - (($line =~ m@^\s+diff\b.*a/[\w/]+@ && 2643 - $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) || 2642 + (($line =~ m@^\s+diff\b.*a/([\w/]+)@ && 2643 + $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) || 2644 2644 $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ || 2645 2645 $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) { 2646 2646 ERROR("DIFF_IN_COMMIT_MSG",
-1
scripts/kconfig/nconf.c
··· 755 755 switch (ptype) { 756 756 case P_MENU: 757 757 child_count++; 758 - prompt = prompt; 759 758 if (single_menu_mode) { 760 759 item_make(menu, 'm', 761 760 "%s%*c%s",
+4 -1
scripts/kconfig/streamline_config.pl
··· 593 593 } 594 594 595 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 601 sub in_preserved_kconfigs { 599 602 my $kconfig = $config2kfile{$_[0]};
+6 -2
scripts/tags.sh
··· 26 26 fi 27 27 28 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 35 # Detect if ALLSOURCE_ARCHS is set. If not, we assume SRCARCH 32 36 if [ "${ALLSOURCE_ARCHS}" = "" ]; then ··· 96 92 all_compiled_sources() 97 93 { 98 94 realpath -es $([ -z "$KBUILD_ABS_SRCTREE" ] && echo --relative-to=.) \ 99 - include/generated/autoconf.h $(find -name "*.cmd" -exec \ 95 + include/generated/autoconf.h $(find $ignore -name "*.cmd" -exec \ 100 96 grep -Poh '(?(?=^source_.* \K).*|(?=^ \K\S).*(?= \\))' {} \+ | 101 97 awk '!a[$0]++') | sort -u 102 98 }
+2 -2
sound/core/oss/mulaw.c
··· 329 329 snd_BUG(); 330 330 return -EINVAL; 331 331 } 332 - if (snd_BUG_ON(!snd_pcm_format_linear(format->format))) 333 - return -ENXIO; 332 + if (!snd_pcm_format_linear(format->format)) 333 + return -EINVAL; 334 334 335 335 err = snd_pcm_plugin_build(plug, "Mu-Law<->linear conversion", 336 336 src_format, dst_format,
+3 -4
sound/core/timer.c
··· 816 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 822 unsigned long flags; 823 823 824 824 if (timer->card && timer->card->shutdown) { ··· 967 967 INIT_LIST_HEAD(&timer->ack_list_head); 968 968 INIT_LIST_HEAD(&timer->sack_list_head); 969 969 spin_lock_init(&timer->lock); 970 - tasklet_init(&timer->task_queue, snd_timer_tasklet, 971 - (unsigned long)timer); 970 + tasklet_setup(&timer->task_queue, snd_timer_tasklet); 972 971 timer->max_instances = 1000; /* default limit per timer */ 973 972 if (card != NULL) { 974 973 timer->module = card->module;
+4 -4
sound/firewire/amdtp-stream.c
··· 64 64 #define IT_PKT_HEADER_SIZE_CIP 8 // For 2 CIP header. 65 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 70 * amdtp_stream_init - initialize an AMDTP stream structure ··· 94 94 s->flags = flags; 95 95 s->context = ERR_PTR(-1); 96 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 98 s->packet_index = 0; 99 99 100 100 init_waitqueue_head(&s->callback_wait); ··· 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 447 struct snd_pcm_substream *pcm = READ_ONCE(s->pcm); 448 448 449 449 if (pcm)
+5
sound/firewire/digi00x/digi00x.c
··· 14 14 #define VENDOR_DIGIDESIGN 0x00a07e 15 15 #define MODEL_CONSOLE 0x000001 16 16 #define MODEL_RACK 0x000002 17 + #define SPEC_VERSION 0x000001 17 18 18 19 static int name_card(struct snd_dg00x *dg00x) 19 20 { ··· 176 175 /* Both of 002/003 use the same ID. */ 177 176 { 178 177 .match_flags = IEEE1394_MATCH_VENDOR_ID | 178 + IEEE1394_MATCH_VERSION | 179 179 IEEE1394_MATCH_MODEL_ID, 180 180 .vendor_id = VENDOR_DIGIDESIGN, 181 + .version = SPEC_VERSION, 181 182 .model_id = MODEL_CONSOLE, 182 183 }, 183 184 { 184 185 .match_flags = IEEE1394_MATCH_VENDOR_ID | 186 + IEEE1394_MATCH_VERSION | 185 187 IEEE1394_MATCH_MODEL_ID, 186 188 .vendor_id = VENDOR_DIGIDESIGN, 189 + .version = SPEC_VERSION, 187 190 .model_id = MODEL_RACK, 188 191 }, 189 192 {}
+29 -4
sound/firewire/tascam/tascam.c
··· 39 39 .midi_capture_ports = 2, 40 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 44 static int identify_model(struct snd_tscm *tscm) ··· 208 211 } 209 212 210 213 static const struct ieee1394_device_id snd_tscm_id_table[] = { 214 + // Tascam, FW-1884. 211 215 { 212 216 .match_flags = IEEE1394_MATCH_VENDOR_ID | 213 - IEEE1394_MATCH_SPECIFIER_ID, 217 + IEEE1394_MATCH_SPECIFIER_ID | 218 + IEEE1394_MATCH_VERSION, 214 219 .vendor_id = 0x00022e, 215 220 .specifier_id = 0x00022e, 221 + .version = 0x800000, 222 + }, 223 + // Tascam, FE-8 (.version = 0x800001) 224 + // This kernel module doesn't support FE-8 because the most of features 225 + // can be implemented in userspace without any specific support of this 226 + // module. 227 + // 228 + // .version = 0x800002 is unknown. 229 + // 230 + // Tascam, FW-1082. 231 + { 232 + .match_flags = IEEE1394_MATCH_VENDOR_ID | 233 + IEEE1394_MATCH_SPECIFIER_ID | 234 + IEEE1394_MATCH_VERSION, 235 + .vendor_id = 0x00022e, 236 + .specifier_id = 0x00022e, 237 + .version = 0x800003, 238 + }, 239 + // Tascam, FW-1804. 240 + { 241 + .match_flags = IEEE1394_MATCH_VENDOR_ID | 242 + IEEE1394_MATCH_SPECIFIER_ID | 243 + IEEE1394_MATCH_VERSION, 244 + .vendor_id = 0x00022e, 245 + .specifier_id = 0x00022e, 246 + .version = 0x800004, 216 247 }, 217 248 {} 218 249 };
+2
sound/hda/hdac_device.c
··· 127 127 void snd_hdac_device_exit(struct hdac_device *codec) 128 128 { 129 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 132 snd_hdac_bus_remove_device(codec->bus, codec); 131 133 kfree(codec->vendor_name); 132 134 kfree(codec->chip_name);
+5 -5
sound/hda/intel-dsp-config.c
··· 54 54 #endif 55 55 /* 56 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 58 * Chromebooks (SST) 59 59 */ 60 60 #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE) ··· 89 89 }, 90 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 93 * Chromebooks (SST) 94 94 */ 95 95 ··· 135 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 139 * Chromebooks 140 140 */ 141 141 /* Geminilake */ ··· 157 157 158 158 /* 159 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 161 * present. Two cases are required since Coreboot does not expose NHLT 162 162 * tables. 163 163 * ··· 391 391 if (pci->class == 0x040300) 392 392 return SND_INTEL_DSP_DRIVER_LEGACY; 393 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 395 return SND_INTEL_DSP_DRIVER_LEGACY; 396 396 } 397 397
+4 -5
sound/pci/asihpi/asihpi.c
··· 921 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; 927 - struct snd_card_asihpi *asihpi; 926 + struct snd_card_asihpi *asihpi = from_tasklet(asihpi, t, t); 927 + struct hpi_adapter *a = asihpi->hpi; 928 928 929 929 WARN_ON(!a || !a->snd_card || !a->snd_card->private_data); 930 930 asihpi = (struct snd_card_asihpi *)a->snd_card->private_data; ··· 2871 2871 if (hpi->interrupt_mode) { 2872 2872 asihpi->pcm_start = snd_card_asihpi_pcm_int_start; 2873 2873 asihpi->pcm_stop = snd_card_asihpi_pcm_int_stop; 2874 - tasklet_init(&asihpi->t, snd_card_asihpi_int_task, 2875 - (unsigned long)hpi); 2874 + tasklet_setup(&asihpi->t, snd_card_asihpi_int_task); 2876 2875 hpi->interrupt_callback = snd_card_asihpi_isr; 2877 2876 } else { 2878 2877 asihpi->pcm_start = snd_card_asihpi_pcm_timer_start;
+2 -1
sound/pci/ca0106/ca0106_main.c
··· 537 537 else 538 538 /* Power down */ 539 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 543 return 0; 543 544 }
+3 -4
sound/pci/hda/hda_intel.c
··· 2127 2127 */ 2128 2128 if (dmic_detect) { 2129 2129 err = snd_intel_dsp_driver_probe(pci); 2130 - if (err != SND_INTEL_DSP_DRIVER_ANY && 2131 - err != SND_INTEL_DSP_DRIVER_LEGACY) 2130 + if (err != SND_INTEL_DSP_DRIVER_ANY && err != SND_INTEL_DSP_DRIVER_LEGACY) { 2131 + dev_dbg(&pci->dev, "HDAudio driver not selected, aborting probe\n"); 2132 2132 return -ENODEV; 2133 + } 2133 2134 } else { 2134 2135 dev_warn(&pci->dev, "dmic_detect option is deprecated, pass snd-intel-dspcfg.dsp_driver=1 option instead\n"); 2135 2136 } ··· 2746 2745 .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI }, 2747 2746 /* Zhaoxin */ 2748 2747 { PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN }, 2749 - /* Loongson */ 2750 - { PCI_DEVICE(0x0014, 0x7a07), .driver_data = AZX_DRIVER_GENERIC }, 2751 2748 { 0, } 2752 2749 }; 2753 2750 MODULE_DEVICE_TABLE(pci, azx_ids);
+7
sound/pci/hda/hda_tegra.c
··· 179 179 struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); 180 180 181 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 186 azx_stop_chip(chip); 183 187 azx_enter_link_reset(chip); 184 188 } ··· 204 200 if (chip && chip->running) { 205 201 hda_tegra_init(hda); 206 202 azx_init_chip(chip, 1); 203 + /* disable controller wake up event*/ 204 + azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & 205 + ~STATESTS_INT_MASK); 207 206 } 208 207 209 208 return 0;
+7
sound/pci/hda/patch_hdmi.c
··· 2794 2794 hda_nid_t cvt_nid) 2795 2795 { 2796 2796 if (per_pin) { 2797 + haswell_verify_D0(codec, per_pin->cvt_nid, per_pin->pin_nid); 2797 2798 snd_hda_set_dev_select(codec, per_pin->pin_nid, 2798 2799 per_pin->dev_id); 2799 2800 intel_verify_pin_cvt_connect(codec, per_pin); ··· 3735 3734 3736 3735 static int patch_tegra_hdmi(struct hda_codec *codec) 3737 3736 { 3737 + struct hdmi_spec *spec; 3738 3738 int err; 3739 3739 3740 3740 err = patch_generic_hdmi(codec); ··· 3743 3741 return err; 3744 3742 3745 3743 codec->patch_ops.build_pcms = tegra_hdmi_build_pcms; 3744 + spec = codec->spec; 3745 + spec->chmap.ops.chmap_cea_alloc_validate_get_type = 3746 + nvhdmi_chmap_cea_alloc_validate_get_type; 3747 + spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate; 3746 3748 3747 3749 return 0; 3748 3750 } ··· 4269 4263 HDA_CODEC_ENTRY(0x8086280d, "Geminilake HDMI", patch_i915_glk_hdmi), 4270 4264 HDA_CODEC_ENTRY(0x8086280f, "Icelake HDMI", patch_i915_icl_hdmi), 4271 4265 HDA_CODEC_ENTRY(0x80862812, "Tigerlake HDMI", patch_i915_tgl_hdmi), 4266 + HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi), 4272 4267 HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi), 4273 4268 HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi), 4274 4269 HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi),
+44 -2
sound/pci/hda/patch_realtek.c
··· 2475 2475 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950), 2476 2476 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950), 2477 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 2479 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), 2479 2480 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), 2480 2481 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), ··· 5868 5867 } 5869 5868 } 5870 5869 5870 + /* Quirk for Thinkpad X1 7th and 8th Gen 5871 + * The following fixed routing needed 5872 + * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly 5873 + * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC 5874 + * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp 5875 + */ 5876 + static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, 5877 + const struct hda_fixup *fix, int action) 5878 + { 5879 + static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */ 5880 + static const hda_nid_t preferred_pairs[] = { 5881 + 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0 5882 + }; 5883 + struct alc_spec *spec = codec->spec; 5884 + 5885 + switch (action) { 5886 + case HDA_FIXUP_ACT_PRE_PROBE: 5887 + snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); 5888 + spec->gen.preferred_dacs = preferred_pairs; 5889 + break; 5890 + case HDA_FIXUP_ACT_BUILD: 5891 + /* The generic parser creates somewhat unintuitive volume ctls 5892 + * with the fixed routing above, and the shared DAC2 may be 5893 + * confusing for PA. 5894 + * Rename those to unique names so that PA doesn't touch them 5895 + * and use only Master volume. 5896 + */ 5897 + rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); 5898 + rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); 5899 + break; 5900 + } 5901 + } 5902 + 5871 5903 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, 5872 5904 const struct hda_fixup *fix, 5873 5905 int action) ··· 6169 6135 ALC289_FIXUP_DUAL_SPK, 6170 6136 ALC294_FIXUP_SPK2_TO_DAC1, 6171 6137 ALC294_FIXUP_ASUS_DUAL_SPK, 6138 + ALC285_FIXUP_THINKPAD_X1_GEN7, 6172 6139 ALC285_FIXUP_THINKPAD_HEADSET_JACK, 6173 6140 ALC294_FIXUP_ASUS_HPE, 6174 6141 ALC294_FIXUP_ASUS_COEF_1B, ··· 7315 7280 .chained = true, 7316 7281 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1 7317 7282 }, 7283 + [ALC285_FIXUP_THINKPAD_X1_GEN7] = { 7284 + .type = HDA_FIXUP_FUNC, 7285 + .v.func = alc285_fixup_thinkpad_x1_gen7, 7286 + .chained = true, 7287 + .chain_id = ALC269_FIXUP_THINKPAD_ACPI 7288 + }, 7318 7289 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = { 7319 7290 .type = HDA_FIXUP_FUNC, 7320 7291 .v.func = alc_fixup_headset_jack, 7321 7292 .chained = true, 7322 - .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1 7293 + .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7 7323 7294 }, 7324 7295 [ALC294_FIXUP_ASUS_HPE] = { 7325 7296 .type = HDA_FIXUP_VERBS, ··· 7736 7695 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7737 7696 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7738 7697 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7739 - SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7698 + SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7699 + SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7740 7700 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8), 7741 7701 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 7742 7702 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
+3 -3
sound/pci/riptide/riptide.c
··· 1070 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 1076 struct cmdif *cif = chip->cif; 1077 1077 struct snd_pcm_substream *substream[PLAYBACK_SUBSTREAMS + 1]; 1078 1078 struct snd_pcm_runtime *runtime; ··· 1843 1843 chip->received_irqs = 0; 1844 1844 chip->handled_irqs = 0; 1845 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 1848 if ((chip->res_port = 1849 1849 request_region(chip->port, 64, "RIPTIDE")) == NULL) {
+3 -3
sound/pci/rme9652/hdsp.c
··· 3791 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 3798 if (hdsp->midi[0].pending) 3799 3799 snd_hdsp_midi_input_read (&hdsp->midi[0]); ··· 5182 5182 5183 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 5187 pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev); 5188 5188 hdsp->firmware_rev &= 0xff;
+3 -4
sound/pci/rme9652/hdspm.c
··· 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 2175 int i = 0; 2176 2176 2177 2177 while (i < hdspm->midiPorts) { ··· 6836 6836 6837 6837 } 6838 6838 6839 - tasklet_init(&hdspm->midi_tasklet, 6840 - hdspm_midi_tasklet, (unsigned long) hdspm); 6839 + tasklet_setup(&hdspm->midi_tasklet, hdspm_midi_tasklet); 6841 6840 6842 6841 6843 6842 if (hdspm->io_type != MADIface) {
+3 -4
sound/soc/fsl/fsl_esai.c
··· 708 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 714 bool tx = true, rx = false, enabled[2]; 715 715 unsigned long lock_flags; 716 716 u32 tfcr, rfcr; ··· 1070 1070 return ret; 1071 1071 } 1072 1072 1073 - tasklet_init(&esai_priv->task, fsl_esai_hw_reset, 1074 - (unsigned long)esai_priv); 1073 + tasklet_setup(&esai_priv->task, fsl_esai_hw_reset); 1075 1074 1076 1075 pm_runtime_enable(&pdev->dev); 1077 1076
+4 -6
sound/soc/sh/siu_pcm.c
··· 198 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 204 struct snd_pcm_substream *substream = siu_stream->substream; 205 205 struct device *dev = substream->pcm->card->dev; 206 206 struct snd_pcm_runtime *rt = substream->runtime; ··· 520 520 (*port_info)->pcm = pcm; 521 521 522 522 /* IO tasklets */ 523 - tasklet_init(&(*port_info)->playback.tasklet, siu_io_tasklet, 524 - (unsigned long)&(*port_info)->playback); 525 - tasklet_init(&(*port_info)->capture.tasklet, siu_io_tasklet, 526 - (unsigned long)&(*port_info)->capture); 523 + tasklet_setup(&(*port_info)->playback.tasklet, siu_io_tasklet); 524 + tasklet_setup(&(*port_info)->capture.tasklet, siu_io_tasklet); 527 525 } 528 526 529 527 dev_info(card->dev, "SuperH SIU driver initialized.\n");
+3 -4
sound/soc/txx9/txx9aclc.c
··· 134 134 135 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 140 struct dma_chan *chan = dmadata->dma_chan; 141 141 struct dma_async_tx_descriptor *desc; 142 142 struct snd_pcm_substream *substream = dmadata->substream; ··· 352 352 "playback" : "capture"); 353 353 return -EBUSY; 354 354 } 355 - tasklet_init(&dmadata->tasklet, txx9aclc_dma_tasklet, 356 - (unsigned long)dmadata); 355 + tasklet_setup(&dmadata->tasklet, txx9aclc_dma_tasklet); 357 356 return 0; 358 357 } 359 358
+3 -4
sound/usb/midi.c
··· 344 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 = 350 - (struct snd_usb_midi_out_endpoint *) data; 349 + struct snd_usb_midi_out_endpoint *ep = from_tasklet(ep, t, tasklet); 351 350 352 351 snd_usbmidi_do_output(ep); 353 352 } ··· 1440 1441 } 1441 1442 1442 1443 spin_lock_init(&ep->buffer_lock); 1443 - tasklet_init(&ep->tasklet, snd_usbmidi_out_tasklet, (unsigned long)ep); 1444 + tasklet_setup(&ep->tasklet, snd_usbmidi_out_tasklet); 1444 1445 init_waitqueue_head(&ep->drain_wait); 1445 1446 1446 1447 for (i = 0; i < 0x10; ++i)
+3 -4
sound/usb/misc/ua101.c
··· 247 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 253 unsigned long flags; 254 254 unsigned int frames; 255 255 struct ua101_urb *urb; ··· 1218 1218 spin_lock_init(&ua->lock); 1219 1219 mutex_init(&ua->mutex); 1220 1220 INIT_LIST_HEAD(&ua->ready_playback_urbs); 1221 - tasklet_init(&ua->playback_tasklet, 1222 - playback_tasklet, (unsigned long)ua); 1221 + tasklet_setup(&ua->playback_tasklet, playback_tasklet); 1223 1222 init_waitqueue_head(&ua->alsa_capture_wait); 1224 1223 init_waitqueue_head(&ua->rate_feedback_wait); 1225 1224 init_waitqueue_head(&ua->alsa_playback_wait);
+2
sound/usb/pcm.c
··· 369 369 case USB_ID(0x07fd, 0x0008): /* MOTU M Series */ 370 370 case USB_ID(0x31e9, 0x0001): /* Solid State Logic SSL2 */ 371 371 case USB_ID(0x31e9, 0x0002): /* Solid State Logic SSL2+ */ 372 + case USB_ID(0x0499, 0x172f): /* Steinberg UR22C */ 372 373 case USB_ID(0x0d9a, 0x00df): /* RTX6001 */ 373 374 ep = 0x81; 374 375 ifnum = 2; 375 376 goto add_sync_ep_from_ifnum; 376 377 case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */ 378 + case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */ 377 379 ep = 0x82; 378 380 ifnum = 0; 379 381 goto add_sync_ep_from_ifnum;
+67 -11
sound/usb/quirks-table.h
··· 2827 2827 /* Lenovo ThinkStation P620 Rear Line-in, Line-out and Microphone */ 2828 2828 { 2829 2829 USB_DEVICE(0x17aa, 0x1046), 2830 - QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Rear", 2831 - "Lenovo-ThinkStation-P620-Rear"), 2830 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 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 2838 /* Lenovo ThinkStation P620 Internal Speaker + Front Headset */ 2834 2839 { 2835 2840 USB_DEVICE(0x17aa, 0x104d), 2836 - QUIRK_DEVICE_PROFILE("Lenovo", "ThinkStation P620 Main", 2837 - "Lenovo-ThinkStation-P620-Main"), 2841 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 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 2850 /* Native Instruments MK2 series */ ··· 3559 3549 { 3560 3550 /* 3561 3551 * Pioneer DJ DJM-250MK2 3562 - * PCM is 8 channels out @ 48 fixed (endpoints 0x01). 3563 - * The output from computer to the mixer is usable. 3552 + * PCM is 8 channels out @ 48 fixed (endpoint 0x01) 3553 + * and 8 channels in @ 48 fixed (endpoint 0x82). 3564 3554 * 3565 - * The input (phono or line to computer) is not working. 3566 - * It should be at endpoint 0x82 and probably also 8 channels, 3567 - * but it seems that it works only with Pioneer proprietary software. 3568 - * Even on officially supported OS, the Audacity was unable to record 3569 - * and Mixxx to recognize the control vinyls. 3555 + * Both playback and recording is working, even simultaneously. 3556 + * 3557 + * Playback channels could be mapped to: 3558 + * - CH1 3559 + * - CH2 3560 + * - AUX 3561 + * 3562 + * Recording channels could be mapped to: 3563 + * - Post CH1 Fader 3564 + * - Post CH2 Fader 3565 + * - Cross Fader A 3566 + * - Cross Fader B 3567 + * - MIC 3568 + * - AUX 3569 + * - REC OUT 3570 + * 3571 + * There is remaining problem with recording directly from PHONO/LINE. 3572 + * If we map a channel to: 3573 + * - CH1 Control Tone PHONO 3574 + * - CH1 Control Tone LINE 3575 + * - CH2 Control Tone PHONO 3576 + * - CH2 Control Tone LINE 3577 + * it is silent. 3578 + * There is no signal even on other operating systems with official drivers. 3579 + * The signal appears only when a supported application is started. 3580 + * This needs to be investigated yet... 3581 + * (there is quite a lot communication on the USB in both directions) 3582 + * 3583 + * In current version this mixer could be used for playback 3584 + * and for recording from vinyls (through Post CH* Fader) 3585 + * but not for DVS (Digital Vinyl Systems) like in Mixxx. 3570 3586 */ 3571 3587 USB_DEVICE_VENDOR_SPEC(0x2b73, 0x0017), 3572 3588 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { ··· 3611 3575 .endpoint = 0x01, 3612 3576 .ep_attr = USB_ENDPOINT_XFER_ISOC| 3613 3577 USB_ENDPOINT_SYNC_ASYNC, 3578 + .rates = SNDRV_PCM_RATE_48000, 3579 + .rate_min = 48000, 3580 + .rate_max = 48000, 3581 + .nr_rates = 1, 3582 + .rate_table = (unsigned int[]) { 48000 } 3583 + } 3584 + }, 3585 + { 3586 + .ifnum = 0, 3587 + .type = QUIRK_AUDIO_FIXED_ENDPOINT, 3588 + .data = &(const struct audioformat) { 3589 + .formats = SNDRV_PCM_FMTBIT_S24_3LE, 3590 + .channels = 8, // inputs 3591 + .iface = 0, 3592 + .altsetting = 1, 3593 + .altset_idx = 1, 3594 + .endpoint = 0x82, 3595 + .ep_attr = USB_ENDPOINT_XFER_ISOC| 3596 + USB_ENDPOINT_SYNC_ASYNC| 3597 + USB_ENDPOINT_USAGE_IMPLICIT_FB, 3614 3598 .rates = SNDRV_PCM_RATE_48000, 3615 3599 .rate_min = 48000, 3616 3600 .rate_max = 48000,
+11
sound/usb/quirks.c
··· 518 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 531 * audio-interface quirks 523 532 * ··· 566 557 [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk, 567 558 [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk, 568 559 [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk, 560 + [QUIRK_SETUP_DISABLE_AUTOSUSPEND] = setup_disable_autosuspend, 569 561 }; 570 562 571 563 if (quirk->type < QUIRK_TYPE_COUNT) { ··· 1503 1493 set_format_emu_quirk(subs, fmt); 1504 1494 break; 1505 1495 case USB_ID(0x2b73, 0x000a): /* Pioneer DJ DJM-900NXS2 */ 1496 + case USB_ID(0x2b73, 0x0017): /* Pioneer DJ DJM-250MK2 */ 1506 1497 pioneer_djm_set_format_quirk(subs); 1507 1498 break; 1508 1499 case USB_ID(0x534d, 0x2109): /* MacroSilicon MS2109 */
+1
sound/usb/usbaudio.h
··· 102 102 QUIRK_AUDIO_ALIGN_TRANSFER, 103 103 QUIRK_AUDIO_STANDARD_MIXER, 104 104 QUIRK_SETUP_FMT_AFTER_RESUME, 105 + QUIRK_SETUP_DISABLE_AUTOSUSPEND, 105 106 106 107 QUIRK_TYPE_COUNT 107 108 };
+1 -1
sound/x86/Kconfig
··· 9 9 if SND_X86 10 10 11 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 13 depends on DRM_I915 14 14 select SND_PCM 15 15 help
+1 -1
tools/include/uapi/linux/perf_event.h
··· 1196 1196 1197 1197 #define PERF_MEM_SNOOPX_FWD 0x01 /* forward */ 1198 1198 /* 1 free */ 1199 - #define PERF_MEM_SNOOPX_SHIFT 37 1199 + #define PERF_MEM_SNOOPX_SHIFT 38 1200 1200 1201 1201 /* locked instruction */ 1202 1202 #define PERF_MEM_LOCK_NA 0x01 /* not available */
+1 -1
tools/lib/traceevent/event-parse.c
··· 5259 5259 default: 5260 5260 ret = 0; 5261 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 5263 break; 5264 5264 } 5265 5265
+4
tools/perf/Documentation/perf-record.txt
··· 33 33 - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a 34 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 40 - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where 37 41 'param1', 'param2', etc are defined as formats for the PMU in 38 42 /sys/bus/event_source/devices/<pmu>/format/*.
+7
tools/perf/Documentation/perf-stat.txt
··· 39 39 - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a 40 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 46 - a symbolically formed event like 'pmu/param1=0x3,param2/' where 43 47 param1 and param2 are defined as formats for the PMU in 44 48 /sys/bus/event_source/devices/<pmu>/format/* ··· 419 415 counts for all hardware threads in a core but show the sum counts per 420 416 hardware thread. This is essentially a replacement for the any bit and 421 417 convenient for post processing. 418 + 419 + --summary:: 420 + Print summary for interval mode (-I). 422 421 423 422 EXAMPLES 424 423 --------
+2 -2
tools/perf/bench/synthesize.c
··· 162 162 init_stats(&event_stats); 163 163 for (i = 0; i < multi_iterations; i++) { 164 164 session = perf_session__new(NULL, false, NULL); 165 - if (!session) 166 - return -ENOMEM; 165 + if (IS_ERR(session)) 166 + return PTR_ERR(session); 167 167 168 168 atomic_set(&event_count, 0); 169 169 gettimeofday(&start, NULL);
+1 -1
tools/perf/builtin-record.c
··· 2452 2452 OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize, 2453 2453 "synthesize non-sample events at the end of output"), 2454 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 2456 OPT_BOOLEAN(0, "strict-freq", &record.opts.strict_freq, 2457 2457 "Fail if the specified frequency can't be used"), 2458 2458 OPT_CALLBACK('F', "freq", &record.opts, "freq or 'max'",
+3
tools/perf/builtin-report.c
··· 1332 1332 if (report.mmaps_mode) 1333 1333 report.tasks_mode = true; 1334 1334 1335 + if (dump_trace) 1336 + report.tool.ordered_events = false; 1337 + 1335 1338 if (quiet) 1336 1339 perf_quiet_option(); 1337 1340
+5 -1
tools/perf/builtin-sched.c
··· 2584 2584 } 2585 2585 2586 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 2590 if (sched->idle_hist) { 2590 2591 struct idle_thread_runtime *itr = (void *)tr; ··· 2858 2857 2859 2858 printf("\nIdle stats:\n"); 2860 2859 for (i = 0; i < idle_max_cpu; ++i) { 2860 + if (cpu_list && !test_bit(i, cpu_bitmap)) 2861 + continue; 2862 + 2861 2863 t = idle_threads[i]; 2862 2864 if (!t) 2863 2865 continue;
+5 -3
tools/perf/builtin-stat.c
··· 404 404 { 405 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 408 return; 409 409 410 410 evlist__for_each_entry(evsel_list, counter) { ··· 897 897 if (stat_config.walltime_run_table) 898 898 stat_config.walltime_run[run_idx] = t1 - t0; 899 899 900 - if (interval) { 900 + if (interval && stat_config.summary) { 901 901 stat_config.interval = 0; 902 - stat_config.summary = true; 902 + stat_config.stop_read_counter = true; 903 903 init_stats(&walltime_nsecs_stats); 904 904 update_stats(&walltime_nsecs_stats, t1 - t0); 905 905 ··· 1164 1164 "Use with 'percore' event qualifier to show the event " 1165 1165 "counts of one hardware thread by sum up total hardware " 1166 1166 "threads of same physical core"), 1167 + OPT_BOOLEAN(0, "summary", &stat_config.summary, 1168 + "print summary for interval mode"), 1167 1169 #ifdef HAVE_LIBPFM 1168 1170 OPT_CALLBACK(0, "pfm-events", &evsel_list, "event", 1169 1171 "libpfm4 event selector. use 'perf list' to list available events",
+2
tools/perf/builtin-top.c
··· 1746 1746 goto out_delete_evlist; 1747 1747 } 1748 1748 1749 + #ifdef HAVE_LIBBPF_SUPPORT 1749 1750 if (!top.record_opts.no_bpf_event) { 1750 1751 top.sb_evlist = evlist__new(); 1751 1752 ··· 1760 1759 goto out_delete_evlist; 1761 1760 } 1762 1761 } 1762 + #endif 1763 1763 1764 1764 if (perf_evlist__start_sb_thread(top.sb_evlist, target)) { 1765 1765 pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n");
+1 -1
tools/perf/pmu-events/jevents.c
··· 137 137 return s; 138 138 139 139 /* allocate space for a new string */ 140 - fixed = (char *) malloc(len + 1); 140 + fixed = (char *) malloc(len + esc_count + 1); 141 141 if (!fixed) 142 142 return NULL; 143 143
+1 -1
tools/perf/tests/bpf.c
··· 197 197 perf_mmap__read_done(&md->core); 198 198 } 199 199 200 - if (count != expect) { 200 + if (count != expect * evlist->core.nr_entries) { 201 201 pr_debug("BPF filter result incorrect, expected %d, got %d samples\n", expect, count); 202 202 goto out_delete_evlist; 203 203 }
+2 -2
tools/perf/tests/parse-events.c
··· 719 719 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); 720 720 TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel); 721 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 723 TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); 724 724 TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); 725 725 TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel)); ··· 842 842 TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user); 843 843 TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel); 844 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 846 TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host); 847 847 TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip); 848 848 TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
+3
tools/perf/tests/parse-metric.c
··· 70 70 { 71 71 .metric_expr = "1/m3", 72 72 .metric_name = "M3", 73 + }, 74 + { 75 + .name = NULL, 73 76 } 74 77 }; 75 78
+2 -1
tools/perf/ui/browsers/hists.c
··· 3629 3629 { 3630 3630 int nr_entries = evlist->core.nr_entries; 3631 3631 3632 - single_entry: 3633 3632 if (perf_evlist__single_entry(evlist)) { 3633 + single_entry: { 3634 3634 struct evsel *first = evlist__first(evlist); 3635 3635 3636 3636 return perf_evsel__hists_browse(first, nr_entries, help, 3637 3637 false, hbt, min_pcnt, 3638 3638 env, warn_lost_event, 3639 3639 annotation_opts); 3640 + } 3640 3641 } 3641 3642 3642 3643 if (symbol_conf.event_group) {
+3 -3
tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
··· 182 182 if (payload & BIT(EV_TLB_ACCESS)) 183 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 186 (payload & BIT(EV_LLC_MISS))) 187 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 190 (payload & BIT(EV_LLC_ACCESS))) 191 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 194 (payload & BIT(EV_REMOTE_ACCESS))) 195 195 decoder->record.type |= ARM_SPE_REMOTE_ACCESS; 196 196
+8 -1
tools/perf/util/cs-etm.c
··· 1344 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 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 1357 if (etm->synth_opts.instructions) { 1351 1358 attr.config = PERF_COUNT_HW_INSTRUCTIONS;
+8 -1
tools/perf/util/intel-pt.c
··· 3017 3017 3018 3018 if (pt->synth_opts.callchain) 3019 3019 attr.sample_type |= PERF_SAMPLE_CALLCHAIN; 3020 - if (pt->synth_opts.last_branch) 3020 + if (pt->synth_opts.last_branch) { 3021 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 3030 if (pt->synth_opts.instructions) { 3024 3031 attr.config = PERF_COUNT_HW_INSTRUCTIONS;
-6
tools/perf/util/machine.c
··· 736 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 739 static int machine__process_ksymbol_register(struct machine *machine, 746 740 union perf_event *event, 747 741 struct perf_sample *sample __maybe_unused)
+16
tools/perf/util/map.c
··· 267 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 286 bool __map__is_ool(const struct map *map) 271 287 { 272 288 return map->dso && map->dso->binary_type == DSO_BINARY_TYPE__OOL;
+8 -1
tools/perf/util/map.h
··· 147 147 bool __map__is_kernel(const struct map *map); 148 148 bool __map__is_extra_kernel_map(const struct map *map); 149 149 bool __map__is_bpf_prog(const struct map *map); 150 + bool __map__is_bpf_image(const struct map *map); 150 151 bool __map__is_ool(const struct map *map); 151 152 152 153 static inline bool __map__is_kmodule(const struct map *map) 153 154 { 154 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 160 bool map__has_symbols(const struct map *map); ··· 166 164 return !strcmp(name, ENTRY_TRAMPOLINE_NAME); 167 165 } 168 166 167 + static inline bool is_bpf_image(const char *name) 168 + { 169 + return strncmp(name, "bpf_trampoline_", sizeof("bpf_trampoline_") - 1) == 0 || 170 + strncmp(name, "bpf_dispatcher_", sizeof("bpf_dispatcher_") - 1) == 0; 171 + } 169 172 #endif /* __PERF_MAP_H */
+19 -12
tools/perf/util/parse-events.c
··· 37 37 #include "util/evsel_config.h" 38 38 #include "util/event.h" 39 39 #include "util/pfm.h" 40 + #include "perf.h" 40 41 41 42 #define MAX_NAME_LEN 100 42 43 ··· 1534 1533 evsel = __add_event(list, &parse_state->idx, &attr, true, 1535 1534 get_config_name(head_config), pmu, 1536 1535 &config_terms, auto_merge_stats, NULL); 1537 - if (evsel) { 1538 - evsel->unit = info.unit; 1539 - evsel->scale = info.scale; 1540 - evsel->per_pkg = info.per_pkg; 1541 - evsel->snapshot = info.snapshot; 1542 - evsel->metric_expr = info.metric_expr; 1543 - evsel->metric_name = info.metric_name; 1544 - evsel->pmu_name = name ? strdup(name) : NULL; 1545 - evsel->use_uncore_alias = use_uncore_alias; 1546 - evsel->percore = config_term_percore(&evsel->config_terms); 1547 - } 1536 + if (!evsel) 1537 + return -ENOMEM; 1548 1538 1549 - return evsel ? 0 : -ENOMEM; 1539 + evsel->pmu_name = name ? strdup(name) : NULL; 1540 + evsel->use_uncore_alias = use_uncore_alias; 1541 + evsel->percore = config_term_percore(&evsel->config_terms); 1542 + 1543 + if (parse_state->fake_pmu) 1544 + return 0; 1545 + 1546 + evsel->unit = info.unit; 1547 + evsel->scale = info.scale; 1548 + evsel->per_pkg = info.per_pkg; 1549 + evsel->snapshot = info.snapshot; 1550 + evsel->metric_expr = info.metric_expr; 1551 + evsel->metric_name = info.metric_name; 1552 + return 0; 1550 1553 } 1551 1554 1552 1555 int parse_events_multi_pmu_add(struct parse_events_state *parse_state, ··· 1799 1794 if (*str == 'u') { 1800 1795 if (!exclude) 1801 1796 exclude = eu = ek = eh = 1; 1797 + if (!exclude_GH && !perf_guest) 1798 + eG = 1; 1802 1799 eu = 0; 1803 1800 } else if (*str == 'k') { 1804 1801 if (!exclude)
+4 -4
tools/perf/util/parse-events.y
··· 511 511 list = alloc_list(); 512 512 ABORT_ON(!list); 513 513 err = parse_events_add_breakpoint(list, &parse_state->idx, 514 - (void *) $2, $6, $4); 514 + (void *)(uintptr_t) $2, $6, $4); 515 515 free($6); 516 516 if (err) { 517 517 free(list); ··· 528 528 list = alloc_list(); 529 529 ABORT_ON(!list); 530 530 if (parse_events_add_breakpoint(list, &parse_state->idx, 531 - (void *) $2, NULL, $4)) { 531 + (void *)(uintptr_t) $2, NULL, $4)) { 532 532 free(list); 533 533 YYABORT; 534 534 } ··· 544 544 list = alloc_list(); 545 545 ABORT_ON(!list); 546 546 err = parse_events_add_breakpoint(list, &parse_state->idx, 547 - (void *) $2, $4, 0); 547 + (void *)(uintptr_t) $2, $4, 0); 548 548 free($4); 549 549 if (err) { 550 550 free(list); ··· 561 561 list = alloc_list(); 562 562 ABORT_ON(!list); 563 563 if (parse_events_add_breakpoint(list, &parse_state->idx, 564 - (void *) $2, NULL, 0)) { 564 + (void *)(uintptr_t) $2, NULL, 0)) { 565 565 free(list); 566 566 YYABORT; 567 567 }
+1 -1
tools/perf/util/session.c
··· 87 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 92 return 0; 93 93 }
+1 -1
tools/perf/util/stat-display.c
··· 117 117 cpu_map__id_to_die(id), 118 118 config->csv_output ? 0 : -3, 119 119 cpu_map__id_to_cpu(id), config->csv_sep); 120 - } else { 120 + } else if (id > -1) { 121 121 fprintf(config->output, "CPU%*d%s", 122 122 config->csv_output ? 0 : -7, 123 123 evsel__cpus(evsel)->map[id],
+1
tools/perf/util/stat.h
··· 113 113 bool summary; 114 114 bool metric_no_group; 115 115 bool metric_no_merge; 116 + bool stop_read_counter; 116 117 FILE *output; 117 118 unsigned int interval; 118 119 unsigned int timeout;
+1
tools/perf/util/symbol.c
··· 663 663 "exit_idle", 664 664 "mwait_idle", 665 665 "mwait_idle_with_hints", 666 + "mwait_idle_with_hints.constprop.0", 666 667 "poll_idle", 667 668 "ppc64_runlatch_off", 668 669 "pseries_dedicated_idle_sleep",
+1 -1
tools/perf/util/zstd.c
··· 99 99 while (input.pos < input.size) { 100 100 ret = ZSTD_decompressStream(data->dstream, &output, &input); 101 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 103 src_size, output.size, dst_size, ZSTD_getErrorName(ret)); 104 104 break; 105 105 }
+2
tools/testing/selftests/bpf/test_maps.c
··· 1274 1274 pid_t pid[tasks]; 1275 1275 int i; 1276 1276 1277 + fflush(stdout); 1278 + 1277 1279 for (i = 0; i < tasks; i++) { 1278 1280 pid[i] = fork(); 1279 1281 if (pid[i] == 0) {
+3 -1
tools/testing/selftests/bpf/test_progs.c
··· 618 618 if (!flavor) 619 619 return 0; 620 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 624 return chdir(flavor); 623 625 } 624 626
+37 -30
tools/testing/selftests/netfilter/nft_flowtable.sh
··· 11 11 # result in fragmentation and/or PMTU discovery. 12 12 # 13 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 27 log_netns=$(sysctl -n net.netfilter.nf_log_all_netns) 28 28 29 29 checktool (){ 30 - $1 > /dev/null 2>&1 31 - if [ $? -ne 0 ];then 30 + if ! $1 > /dev/null 2>&1; then 32 31 echo "SKIP: Could not $2" 33 32 exit $ksft_skip 34 33 fi ··· 86 87 lmtu=1500 87 88 rmtu=2000 88 89 90 + usage(){ 91 + echo "nft_flowtable.sh [OPTIONS]" 92 + echo 93 + echo "MTU options" 94 + echo " -o originator" 95 + echo " -l link" 96 + echo " -r responder" 97 + exit 1 98 + } 99 + 89 100 while getopts "o:l:r:" o 90 101 do 91 102 case $o in 92 103 o) omtu=$OPTARG;; 93 104 l) lmtu=$OPTARG;; 94 105 r) rmtu=$OPTARG;; 106 + *) usage;; 95 107 esac 96 108 done 97 109 98 - ip -net nsr1 link set veth0 mtu $omtu 110 + if ! ip -net nsr1 link set veth0 mtu $omtu; then 111 + exit 1 112 + fi 113 + 99 114 ip -net ns1 link set eth0 mtu $omtu 100 115 101 - ip -net nsr2 link set veth1 mtu $rmtu 116 + if ! ip -net nsr2 link set veth1 mtu $rmtu; then 117 + exit 1 118 + fi 119 + 102 120 ip -net ns2 link set eth0 mtu $rmtu 103 121 104 122 # transfer-net between nsr1 and nsr2. ··· 136 120 ip -net ns$i route add default via 10.0.$i.1 137 121 ip -net ns$i addr add dead:$i::99/64 dev eth0 138 122 ip -net ns$i route add default via dead:$i::1 139 - ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null 123 + if ! ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null; then 124 + echo "ERROR: Check Originator/Responder values (problem during address addition)" 125 + exit 1 126 + fi 140 127 141 128 # don't set ip DF bit for first two tests 142 129 ip netns exec ns$i sysctl net.ipv4.ip_no_pmtu_disc=1 > /dev/null ··· 197 178 fi 198 179 199 180 # test basic connectivity 200 - ip netns exec ns1 ping -c 1 -q 10.0.2.99 > /dev/null 201 - if [ $? -ne 0 ];then 181 + if ! ip netns exec ns1 ping -c 1 -q 10.0.2.99 > /dev/null; then 202 182 echo "ERROR: ns1 cannot reach ns2" 1>&2 203 183 bash 204 184 exit 1 205 185 fi 206 186 207 - ip netns exec ns2 ping -c 1 -q 10.0.1.99 > /dev/null 208 - if [ $? -ne 0 ];then 187 + if ! ip netns exec ns2 ping -c 1 -q 10.0.1.99 > /dev/null; then 209 188 echo "ERROR: ns2 cannot reach ns1" 1>&2 210 189 exit 1 211 190 fi ··· 220 203 make_file() 221 204 { 222 205 name=$1 223 - who=$2 224 206 225 207 SIZE=$((RANDOM % (1024 * 8))) 226 208 TSIZE=$((SIZE * 1024)) ··· 238 222 out=$2 239 223 what=$3 240 224 241 - cmp "$in" "$out" > /dev/null 2>&1 242 - if [ $? -ne 0 ] ;then 225 + if ! cmp "$in" "$out" > /dev/null 2>&1; then 243 226 echo "FAIL: file mismatch for $what" 1>&2 244 227 ls -l "$in" 245 228 ls -l "$out" ··· 275 260 276 261 wait 277 262 278 - check_transfer "$ns1in" "$ns2out" "ns1 -> ns2" 279 - if [ $? -ne 0 ];then 263 + if ! check_transfer "$ns1in" "$ns2out" "ns1 -> ns2"; then 280 264 lret=1 281 265 fi 282 266 283 - check_transfer "$ns2in" "$ns1out" "ns1 <- ns2" 284 - if [ $? -ne 0 ];then 267 + if ! check_transfer "$ns2in" "$ns1out" "ns1 <- ns2"; then 285 268 lret=1 286 269 fi 287 270 ··· 308 295 return $lret 309 296 } 310 297 311 - make_file "$ns1in" "ns1" 312 - make_file "$ns2in" "ns2" 298 + make_file "$ns1in" 299 + make_file "$ns2in" 313 300 314 301 # First test: 315 302 # No PMTU discovery, nsr1 is expected to fragment packets from ns1 to ns2 as needed. 316 - test_tcp_forwarding ns1 ns2 317 - if [ $? -eq 0 ] ;then 303 + if test_tcp_forwarding ns1 ns2; then 318 304 echo "PASS: flow offloaded for ns1/ns2" 319 305 else 320 306 echo "FAIL: flow offload for ns1/ns2:" 1>&2 ··· 344 332 } 345 333 EOF 346 334 347 - test_tcp_forwarding_nat ns1 ns2 348 - 349 - if [ $? -eq 0 ] ;then 335 + if test_tcp_forwarding_nat ns1 ns2; then 350 336 echo "PASS: flow offloaded for ns1/ns2 with NAT" 351 337 else 352 338 echo "FAIL: flow offload for ns1/ns2 with NAT" 1>&2 ··· 356 346 # Same as second test, but with PMTU discovery enabled. 357 347 handle=$(ip netns exec nsr1 nft -a list table inet filter | grep something-to-grep-for | cut -d \# -f 2) 358 348 359 - ip netns exec nsr1 nft delete rule inet filter forward $handle 360 - if [ $? -ne 0 ] ;then 349 + if ! ip netns exec nsr1 nft delete rule inet filter forward $handle; then 361 350 echo "FAIL: Could not delete large-packet accept rule" 362 351 exit 1 363 352 fi ··· 364 355 ip netns exec ns1 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null 365 356 ip netns exec ns2 sysctl net.ipv4.ip_no_pmtu_disc=0 > /dev/null 366 357 367 - test_tcp_forwarding_nat ns1 ns2 368 - if [ $? -eq 0 ] ;then 358 + if test_tcp_forwarding_nat ns1 ns2; then 369 359 echo "PASS: flow offloaded for ns1/ns2 with NAT and pmtu discovery" 370 360 else 371 361 echo "FAIL: flow offload for ns1/ns2 with NAT and pmtu discovery" 1>&2 ··· 410 402 ip -net ns2 route add default via 10.0.2.1 411 403 ip -net ns2 route add default via dead:2::1 412 404 413 - test_tcp_forwarding ns1 ns2 414 - if [ $? -eq 0 ] ;then 405 + if test_tcp_forwarding ns1 ns2; then 415 406 echo "PASS: ipsec tunnel mode for ns1/ns2" 416 407 else 417 408 echo "FAIL: ipsec tunnel mode for ns1/ns2"
+1
tools/testing/selftests/timers/Makefile
··· 13 13 14 14 TEST_GEN_PROGS_EXTENDED = $(DESTRUCTIVE_TESTS) 15 15 16 + TEST_FILES := settings 16 17 17 18 include ../lib.mk 18 19
+1
tools/testing/selftests/timers/settings
··· 1 + timeout=0
+20 -2
tools/testing/selftests/x86/test_vsyscall.c
··· 462 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 476 static int test_process_vm_readv(void) 466 477 { 467 478 #ifdef __x86_64__ ··· 488 477 remote.iov_len = 4096; 489 478 ret = process_vm_readv(getpid(), &local, 1, &remote, 1, 0); 490 479 if (ret != 4096) { 491 - printf("[OK]\tprocess_vm_readv() failed (ret = %d, errno = %d)\n", ret, errno); 492 - return 0; 480 + /* 481 + * We expect process_vm_readv() to work if and only if the 482 + * vsyscall page is readable. 483 + */ 484 + printf("[%s]\tprocess_vm_readv() failed (ret = %d, errno = %d)\n", vsyscall_map_r ? "FAIL" : "OK", ret, errno); 485 + return vsyscall_map_r ? 1 : 0; 493 486 } 494 487 495 488 if (vsyscall_map_r) { ··· 503 488 printf("[FAIL]\tIt worked but returned incorrect data\n"); 504 489 return 1; 505 490 } 491 + } else { 492 + printf("[FAIL]\tprocess_rm_readv() succeeded, but it should have failed in this configuration\n"); 493 + return 1; 506 494 } 507 495 #endif 508 496
+12 -9
virt/kvm/kvm_main.c
··· 4332 4332 void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx, 4333 4333 struct kvm_io_device *dev) 4334 4334 { 4335 - int i; 4335 + int i, j; 4336 4336 struct kvm_io_bus *new_bus, *bus; 4337 4337 4338 4338 bus = kvm_get_bus(kvm, bus_idx); ··· 4349 4349 4350 4350 new_bus = kmalloc(struct_size(bus, range, bus->dev_count - 1), 4351 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 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 4366 rcu_assign_pointer(kvm->buses[bus_idx], new_bus); 4364 4367 synchronize_srcu_expedited(&kvm->srcu); 4365 4368 kfree(bus);