Pick up upstream changes to avoid conflicts for pending patches.
Unified · Split
| @@ -72,6 +72,10 @@ ForEachMacros: · 71 unmodified lines | ||
| 72 | 72 | - 'apei_estatus_for_each_section' |
| 73 | 73 | - 'ata_for_each_dev' |
| 74 | 74 | - 'ata_for_each_link' |
| 75 | + - '__ata_qc_for_each' | |
| 76 | + - 'ata_qc_for_each' | |
| 77 | + - 'ata_qc_for_each_raw' | |
| 78 | + - 'ata_qc_for_each_with_internal' | |
| 75 | 79 | - 'ax25_for_each' |
| 76 | 80 | - 'ax25_uid_for_each' |
| 77 | 81 | - 'bio_for_each_integrity_vec' |
| @@ -85,6 +89,7 @@ ForEachMacros: · 7 unmodified lines | ||
| 85 | 89 | - 'blk_queue_for_each_rl' |
| 86 | 90 | - 'bond_for_each_slave' |
| 87 | 91 | - 'bond_for_each_slave_rcu' |
| 92 | + - 'bpf_for_each_spilled_reg' | |
| 88 | 93 | - 'btree_for_each_safe128' |
| 89 | 94 | - 'btree_for_each_safe32' |
| 90 | 95 | - 'btree_for_each_safe64' |
| @@ -103,6 +108,8 @@ ForEachMacros: · 12 unmodified lines | ||
| 103 | 108 | - 'drm_atomic_crtc_for_each_plane' |
| 104 | 109 | - 'drm_atomic_crtc_state_for_each_plane' |
| 105 | 110 | - 'drm_atomic_crtc_state_for_each_plane_state' |
| 111 | + - 'drm_atomic_for_each_plane_damage' | |
| 112 | + - 'drm_connector_for_each_possible_encoder' | |
| 106 | 113 | - 'drm_for_each_connector_iter' |
| 107 | 114 | - 'drm_for_each_crtc' |
| 108 | 115 | - 'drm_for_each_encoder' |
| @@ -121,11 +128,21 @@ ForEachMacros: · 12 unmodified lines | ||
| 121 | 128 | - 'for_each_bio' |
| 122 | 129 | - 'for_each_board_func_rsrc' |
| 123 | 130 | - 'for_each_bvec' |
| 131 | + - 'for_each_card_components' | |
| 132 | + - 'for_each_card_links' | |
| 133 | + - 'for_each_card_links_safe' | |
| 134 | + - 'for_each_card_prelinks' | |
| 135 | + - 'for_each_card_rtds' | |
| 136 | + - 'for_each_card_rtds_safe' | |
| 137 | + - 'for_each_cgroup_storage_type' | |
| 124 | 138 | - 'for_each_child_of_node' |
| 125 | 139 | - 'for_each_clear_bit' |
| 126 | 140 | - 'for_each_clear_bit_from' |
| 127 | 141 | - 'for_each_cmsghdr' |
| 128 | 142 | - 'for_each_compatible_node' |
| 143 | + - 'for_each_component_dais' | |
| 144 | + - 'for_each_component_dais_safe' | |
| 145 | + - 'for_each_comp_order' | |
| 129 | 146 | - 'for_each_console' |
| 130 | 147 | - 'for_each_cpu' |
| 131 | 148 | - 'for_each_cpu_and' |
| @@ -133,6 +150,10 @@ ForEachMacros: · 1 unmodified line | ||
| 133 | 150 | - 'for_each_cpu_wrap' |
| 134 | 151 | - 'for_each_dev_addr' |
| 135 | 152 | - 'for_each_dma_cap_mask' |
| 153 | + - 'for_each_dpcm_be' | |
| 154 | + - 'for_each_dpcm_be_rollback' | |
| 155 | + - 'for_each_dpcm_be_safe' | |
| 156 | + - 'for_each_dpcm_fe' | |
| 136 | 157 | - 'for_each_drhd_unit' |
| 137 | 158 | - 'for_each_dss_dev' |
| 138 | 159 | - 'for_each_efi_memory_desc' |
| @@ -149,6 +170,7 @@ ForEachMacros: · 10 unmodified lines | ||
| 149 | 170 | - 'for_each_iommu' |
| 150 | 171 | - 'for_each_ip_tunnel_rcu' |
| 151 | 172 | - 'for_each_irq_nr' |
| 173 | + - 'for_each_link_codecs' | |
| 152 | 174 | - 'for_each_lru' |
| 153 | 175 | - 'for_each_matching_node' |
| 154 | 176 | - 'for_each_matching_node_and_match' |
| @@ -160,6 +182,7 @@ ForEachMacros: · 5 unmodified lines | ||
| 160 | 182 | - 'for_each_mem_range_rev' |
| 161 | 183 | - 'for_each_migratetype_order' |
| 162 | 184 | - 'for_each_msi_entry' |
| 185 | + - 'for_each_msi_entry_safe' | |
| 163 | 186 | - 'for_each_net' |
| 164 | 187 | - 'for_each_netdev' |
| 165 | 188 | - 'for_each_netdev_continue' |
| @@ -183,12 +206,14 @@ ForEachMacros: · 17 unmodified lines | ||
| 183 | 206 | - 'for_each_node_with_property' |
| 184 | 207 | - 'for_each_of_allnodes' |
| 185 | 208 | - 'for_each_of_allnodes_from' |
| 209 | + - 'for_each_of_cpu_node' | |
| 186 | 210 | - 'for_each_of_pci_range' |
| 187 | 211 | - 'for_each_old_connector_in_state' |
| 188 | 212 | - 'for_each_old_crtc_in_state' |
| 189 | 213 | - 'for_each_oldnew_connector_in_state' |
| 190 | 214 | - 'for_each_oldnew_crtc_in_state' |
| 191 | 215 | - 'for_each_oldnew_plane_in_state' |
| 216 | + - 'for_each_oldnew_plane_in_state_reverse' | |
| 192 | 217 | - 'for_each_oldnew_private_obj_in_state' |
| 193 | 218 | - 'for_each_old_plane_in_state' |
| 194 | 219 | - 'for_each_old_private_obj_in_state' |
| @@ -206,14 +231,17 @@ ForEachMacros: · 11 unmodified lines | ||
| 206 | 231 | - 'for_each_process' |
| 207 | 232 | - 'for_each_process_thread' |
| 208 | 233 | - 'for_each_property_of_node' |
| 234 | + - 'for_each_registered_fb' | |
| 209 | 235 | - 'for_each_reserved_mem_region' |
| 210 | − - 'for_each_resv_unavail_range' | |
| 236 | + - 'for_each_rtd_codec_dai' | |
| 237 | + - 'for_each_rtd_codec_dai_rollback' | |
| 211 | 238 | - 'for_each_rtdcom' |
| 212 | 239 | - 'for_each_rtdcom_safe' |
| 213 | 240 | - 'for_each_set_bit' |
| 214 | 241 | - 'for_each_set_bit_from' |
| 215 | 242 | - 'for_each_sg' |
| 216 | 243 | - 'for_each_sg_page' |
| 244 | + - 'for_each_sibling_event' | |
| 217 | 245 | - '__for_each_thread' |
| 218 | 246 | - 'for_each_thread' |
| 219 | 247 | - 'for_each_zone' |
| @@ -251,6 +279,8 @@ ForEachMacros: · 31 unmodified lines | ||
| 251 | 279 | - 'hlist_nulls_for_each_entry_from' |
| 252 | 280 | - 'hlist_nulls_for_each_entry_rcu' |
| 253 | 281 | - 'hlist_nulls_for_each_entry_safe' |
| 282 | + - 'i3c_bus_for_each_i2cdev' | |
| 283 | + - 'i3c_bus_for_each_i3cdev' | |
| 254 | 284 | - 'ide_host_for_each_port' |
| 255 | 285 | - 'ide_port_for_each_dev' |
| 256 | 286 | - 'ide_port_for_each_present_dev' |
| @@ -267,11 +297,14 @@ ForEachMacros: · 10 unmodified lines | ||
| 267 | 297 | - 'kvm_for_each_memslot' |
| 268 | 298 | - 'kvm_for_each_vcpu' |
| 269 | 299 | - 'list_for_each' |
| 300 | + - 'list_for_each_codec' | |
| 301 | + - 'list_for_each_codec_safe' | |
| 270 | 302 | - 'list_for_each_entry' |
| 271 | 303 | - 'list_for_each_entry_continue' |
| 272 | 304 | - 'list_for_each_entry_continue_rcu' |
| 273 | 305 | - 'list_for_each_entry_continue_reverse' |
| 274 | 306 | - 'list_for_each_entry_from' |
| 307 | + - 'list_for_each_entry_from_rcu' | |
| 275 | 308 | - 'list_for_each_entry_from_reverse' |
| 276 | 309 | - 'list_for_each_entry_lockless' |
| 277 | 310 | - 'list_for_each_entry_rcu' |
| @@ -291,6 +324,7 @@ ForEachMacros: · 13 unmodified lines | ||
| 291 | 324 | - 'media_device_for_each_intf' |
| 292 | 325 | - 'media_device_for_each_link' |
| 293 | 326 | - 'media_device_for_each_pad' |
| 327 | + - 'nanddev_io_for_each_page' | |
| 294 | 328 | - 'netdev_for_each_lower_dev' |
| 295 | 329 | - 'netdev_for_each_lower_private' |
| 296 | 330 | - 'netdev_for_each_lower_private_rcu' |
| @@ -357,12 +391,14 @@ ForEachMacros: · 60 unmodified lines | ||
| 357 | 391 | - 'sk_nulls_for_each' |
| 358 | 392 | - 'sk_nulls_for_each_from' |
| 359 | 393 | - 'sk_nulls_for_each_rcu' |
| 394 | + - 'snd_array_for_each' | |
| 360 | 395 | - 'snd_pcm_group_for_each_entry' |
| 361 | 396 | - 'snd_soc_dapm_widget_for_each_path' |
| 362 | 397 | - 'snd_soc_dapm_widget_for_each_path_safe' |
| 363 | 398 | - 'snd_soc_dapm_widget_for_each_sink_path' |
| 364 | 399 | - 'snd_soc_dapm_widget_for_each_source_path' |
| 365 | 400 | - 'tb_property_for_each' |
| 401 | + - 'tcf_exts_for_each_action' | |
| 366 | 402 | - 'udp_portaddr_for_each_entry' |
| 367 | 403 | - 'udp_portaddr_for_each_entry_rcu' |
| 368 | 404 | - 'usb_hub_for_each_child' |
| @@ -371,6 +407,11 @@ ForEachMacros: · 2 unmodified lines | ||
| 371 | 407 | - 'v4l2_m2m_for_each_dst_buf_safe' |
| 372 | 408 | - 'v4l2_m2m_for_each_src_buf' |
| 373 | 409 | - 'v4l2_m2m_for_each_src_buf_safe' |
| 410 | + - 'virtio_device_for_each_vq' | |
| 411 | + - 'xa_for_each' | |
| 412 | + - 'xas_for_each' | |
| 413 | + - 'xas_for_each_conflict' | |
| 414 | + - 'xas_for_each_marked' | |
| 374 | 415 | - 'zorro_for_each_dev' |
| 375 | 416 | |
| 376 | 417 | #IncludeBlocks: Preserve # Unknown to clang-format-5.0 |
| @@ -24,7 +24,7 @@ What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ · 23 unmodified lines | ||
| 24 | 24 | cpld3_version |
| 25 | 25 | |
| 26 | 26 | Date: November 2018 |
| 27 | −KernelVersion: 4.21 | |
| 27 | +KernelVersion: 5.0 | |
| 28 | 28 | Contact: Vadim Pasternak <vadimpmellanox.com> |
| 29 | 29 | Description: These files show with which CPLD versions have been burned |
| 30 | 30 | on LED board. |
| @@ -35,7 +35,7 @@ What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ · 4 unmodified lines | ||
| 35 | 35 | jtag_enable |
| 36 | 36 | |
| 37 | 37 | Date: November 2018 |
| 38 | −KernelVersion: 4.21 | |
| 38 | +KernelVersion: 5.0 | |
| 39 | 39 | Contact: Vadim Pasternak <vadimpmellanox.com> |
| 40 | 40 | Description: These files enable and disable the access to the JTAG domain. |
| 41 | 41 | By default access to the JTAG domain is disabled. |
| @@ -105,7 +105,7 @@ What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/ · 63 unmodified lines | ||
| 105 | 105 | reset_voltmon_upgrade_fail |
| 106 | 106 | |
| 107 | 107 | Date: November 2018 |
| 108 | −KernelVersion: 4.21 | |
| 108 | +KernelVersion: 5.0 | |
| 109 | 109 | Contact: Vadim Pasternak <vadimpmellanox.com> |
| 110 | 110 | Description: These files show the system reset cause, as following: ComEx |
| 111 | 111 | power fail, reset from ComEx, system platform reset, reset |
| @@ -157,12 +157,11 @@ Q: Does BPF have a stable ABI? · 156 unmodified lines | ||
| 157 | 157 | ------------------------------ |
| 158 | 158 | A: YES. BPF instructions, arguments to BPF programs, set of helper |
| 159 | 159 | functions and their arguments, recognized return codes are all part |
| 160 | −of ABI. However when tracing programs are using bpf_probe_read() helper | |
| 161 | −to walk kernel internal datastructures and compile with kernel | |
| 162 | −internal headers these accesses can and will break with newer | |
| 163 | −kernels. The union bpf_attr -> kern_version is checked at load time | |
| 164 | −to prevent accidentally loading kprobe-based bpf programs written | |
| 165 | −for a different kernel. Networking programs don't do kern_version check. | |
| 160 | +of ABI. However there is one specific exception to tracing programs | |
| 161 | +which are using helpers like bpf_probe_read() to walk kernel internal | |
| 162 | +data structures and compile with kernel internal headers. Both of these | |
| 163 | +kernel internals are subject to change and can break with newer kernels | |
| 164 | +such that the program needs to be adapted accordingly. | |
| 166 | 165 | |
| 167 | 166 | Q: How much stack space a BPF program uses? |
| 168 | 167 | ------------------------------------------- |
| @@ -108,12 +108,13 @@ some, but not all of the other indices changing. · 107 unmodified lines | ||
| 108 | 108 | |
| 109 | 109 | Sometimes you need to ensure that a subsequent call to :c:func:`xa_store` |
| 110 | 110 | will not need to allocate memory. The :c:func:`xa_reserve` function |
| 111 | −will store a reserved entry at the indicated index. Users of the normal | |
| 112 | −API will see this entry as containing ``NULL``. If you do not need to | |
| 113 | −use the reserved entry, you can call :c:func:`xa_release` to remove the | |
| 114 | −unused entry. If another user has stored to the entry in the meantime, | |
| 115 | −:c:func:`xa_release` will do nothing; if instead you want the entry to | |
| 116 | −become ``NULL``, you should use :c:func:`xa_erase`. | |
| 111 | +will store a reserved entry at the indicated index. Users of the | |
| 112 | +normal API will see this entry as containing ``NULL``. If you do | |
| 113 | +not need to use the reserved entry, you can call :c:func:`xa_release` | |
| 114 | +to remove the unused entry. If another user has stored to the entry | |
| 115 | +in the meantime, :c:func:`xa_release` will do nothing; if instead you | |
| 116 | +want the entry to become ``NULL``, you should use :c:func:`xa_erase`. | |
| 117 | +Using :c:func:`xa_insert` on a reserved entry will fail. | |
| 117 | 118 | |
| 118 | 119 | If all entries in the array are ``NULL``, the :c:func:`xa_empty` function |
| 119 | 120 | will return ``true``. |
| @@ -183,6 +184,8 @@ Takes xa_lock internally: · 63 unmodified lines | ||
| 183 | 184 | * :c:func:`xa_store_bh` |
| 184 | 185 | * :c:func:`xa_store_irq` |
| 185 | 186 | * :c:func:`xa_insert` |
| 187 | + * :c:func:`xa_insert_bh` | |
| 188 | + * :c:func:`xa_insert_irq` | |
| 186 | 189 | * :c:func:`xa_erase` |
| 187 | 190 | * :c:func:`xa_erase_bh` |
| 188 | 191 | * :c:func:`xa_erase_irq` |
| @@ -17,7 +17,11 @@ extra-y += $(DT_TMP_SCHEMA) · 16 unmodified lines | ||
| 17 | 17 | quiet_cmd_mk_schema = SCHEMA $@ |
| 18 | 18 | cmd_mk_schema = $(DT_MK_SCHEMA) $(DT_MK_SCHEMA_FLAGS) -o $@ $(filter-out FORCE, $^) |
| 19 | 19 | |
| 20 | −DT_DOCS = $(shell cd $(srctree)/$(src) && find * -name '*.yaml') | |
| 20 | +DT_DOCS = $(shell \ | |
| 21 | + cd $(srctree)/$(src) && \ | |
| 22 | + find * \( -name '*.yaml' ! -name $(DT_TMP_SCHEMA) \) \ | |
| 23 | + ) | |
| 24 | + | |
| 21 | 25 | DT_SCHEMA_FILES ?= $(addprefix $(src)/,$(DT_DOCS)) |
| 22 | 26 | |
| 23 | 27 | extra-y += $(patsubst $(src)/%.yaml,%.example.dts, $(DT_SCHEMA_FILES)) |
| @@ -235,4 +235,4 @@ cpus { · 234 unmodified lines | ||
| 235 | 235 | =========================================== |
| 236 | 236 | |
| 237 | 237 | [1] ARM Linux Kernel documentation - CPUs bindings |
| 238 | − Documentation/devicetree/bindings/arm/cpus.txt | |
| 238 | + Documentation/devicetree/bindings/arm/cpus.yaml | |
| @@ -684,7 +684,7 @@ cpus { · 683 unmodified lines | ||
| 684 | 684 | =========================================== |
| 685 | 685 | |
| 686 | 686 | [1] ARM Linux Kernel documentation - CPUs bindings |
| 687 | − Documentation/devicetree/bindings/arm/cpus.txt | |
| 687 | + Documentation/devicetree/bindings/arm/cpus.yaml | |
| 688 | 688 | |
| 689 | 689 | [2] ARM Linux Kernel documentation - PSCI bindings |
| 690 | 690 | Documentation/devicetree/bindings/arm/psci.txt |
| @@ -4,7 +4,7 @@ SP810 System Controller · 3 unmodified lines | ||
| 4 | 4 | Required properties: |
| 5 | 5 | |
| 6 | 6 | - compatible: standard compatible string for a Primecell peripheral, |
| 7 | − see Documentation/devicetree/bindings/arm/primecell.txt | |
| 7 | + see Documentation/devicetree/bindings/arm/primecell.yaml | |
| 8 | 8 | for more details |
| 9 | 9 | should be: "arm,sp810", "arm,primecell" |
| 10 | 10 | |
| @@ -472,4 +472,4 @@ cpus { · 471 unmodified lines | ||
| 472 | 472 | |
| 473 | 473 | =============================================================================== |
| 474 | 474 | [1] ARM Linux kernel documentation |
| 475 | − Documentation/devicetree/bindings/arm/cpus.txt | |
| 475 | + Documentation/devicetree/bindings/arm/cpus.yaml | |
| @@ -18,4 +18,4 @@ Required Properties: · 17 unmodified lines | ||
| 18 | 18 | Each clock is assigned an identifier and client nodes use this identifier |
| 19 | 19 | to specify the clock which they consume. |
| 20 | 20 | |
| 21 | −All these identifier could be found in <dt-bindings/clock/marvell-mmp2.h>. | |
| 21 | +All these identifiers could be found in <dt-bindings/clock/marvell,mmp2.h>. | |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | * ARM PrimeCell Color LCD Controller PL110/PL111 |
| 2 | 2 | |
| 3 | −See also Documentation/devicetree/bindings/arm/primecell.txt | |
| 3 | +See also Documentation/devicetree/bindings/arm/primecell.yaml | |
| 4 | 4 | |
| 5 | 5 | Required properties: |
| 6 | 6 | |
| @@ -27,7 +27,6 @@ Example: · 26 unmodified lines | ||
| 27 | 27 | reg = <0x04300000 0x20000>; |
| 28 | 28 | reg-names = "kgsl_3d0_reg_memory"; |
| 29 | 29 | interrupts = <GIC_SPI 80 0>; |
| 30 | − interrupt-names = "kgsl_3d0_irq"; | |
| 31 | 30 | clock-names = |
| 32 | 31 | "core", |
| 33 | 32 | "iface", |
| @@ -14,8 +14,6 @@ Required properties: · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | "marvell,armada-8k-gpio" should be used for the Armada 7K and 8K |
| 16 | 16 | SoCs (either from AP or CP), see |
| 17 | − Documentation/devicetree/bindings/arm/marvell/cp110-system-controller0.txt | |
| 18 | − and | |
| 19 | 17 | Documentation/devicetree/bindings/arm/marvell/ap806-system-controller.txt |
| 20 | 18 | for specific details about the offset property. |
| 21 | 19 | |
| @@ -78,7 +78,7 @@ Sub-nodes: · 77 unmodified lines | ||
| 78 | 78 | PPI affinity can be expressed as a single "ppi-partitions" node, |
| 79 | 79 | containing a set of sub-nodes, each with the following property: |
| 80 | 80 | - affinity: Should be a list of phandles to CPU nodes (as described in |
| 81 | −Documentation/devicetree/bindings/arm/cpus.txt). | |
| 81 | + Documentation/devicetree/bindings/arm/cpus.yaml). | |
| 82 | 82 | |
| 83 | 83 | GICv3 has one or more Interrupt Translation Services (ITS) that are |
| 84 | 84 | used to route Message Signalled Interrupts (MSI) to the CPUs. |
| @@ -4,14 +4,10 @@ Required properties: · 3 unmodified lines | ||
| 4 | 4 | - compatible : "olpc,ap-sp" |
| 5 | 5 | - reg : base address and length of SoC's WTM registers |
| 6 | 6 | - interrupts : SP-AP interrupt |
| 7 | −- clocks : phandle + clock-specifier for the clock that drives the WTM | |
| 8 | −- clock-names: should be "sp" | |
| 9 | 7 | |
| 10 | 8 | Example: |
| 11 | 9 | ap-sp@d4290000 { |
| 12 | 10 | compatible = "olpc,ap-sp"; |
| 13 | 11 | reg = <0xd4290000 0x1000>; |
| 14 | 12 | interrupts = <40>; |
| 15 | − clocks = <&soc_clocks MMP2_CLK_SP>; | |
| 16 | − clock-names = "sp"; | |
| 17 | 13 | } |
| @@ -55,7 +55,7 @@ of these nodes are defined by the individual bindings for the specific function · 54 unmodified lines | ||
| 55 | 55 | = EXAMPLE |
| 56 | 56 | The following example represents the GLINK RPM node on a MSM8996 device, with |
| 57 | 57 | the function for the "rpm_request" channel defined, which is used for |
| 58 | −regualtors and root clocks. | |
| 58 | +regulators and root clocks. | |
| 59 | 59 | |
| 60 | 60 | apcs_glb: mailbox@9820000 { |
| 61 | 61 | compatible = "qcom,msm8996-apcs-hmss-global"; |
| @@ -41,12 +41,12 @@ processor ID) and a string identifier. · 40 unmodified lines | ||
| 41 | 41 | - qcom,local-pid: |
| 42 | 42 | Usage: required |
| 43 | 43 | Value type: <u32> |
| 44 | − Definition: specifies the identfier of the local endpoint of this edge | |
| 44 | + Definition: specifies the identifier of the local endpoint of this edge | |
| 45 | 45 | |
| 46 | 46 | - qcom,remote-pid: |
| 47 | 47 | Usage: required |
| 48 | 48 | Value type: <u32> |
| 49 | − Definition: specifies the identfier of the remote endpoint of this edge | |
| 49 | + Definition: specifies the identifier of the remote endpoint of this edge | |
| 50 | 50 | |
| 51 | 51 | = SUBNODES |
| 52 | 52 | Each SMP2P pair contain a set of inbound and outbound entries, these are |
| @@ -163,6 +163,14 @@ C. Boot options · 162 unmodified lines | ||
| 163 | 163 | be preserved until there actually is some text is output to the console. |
| 164 | 164 | This option causes fbcon to bind immediately to the fbdev device. |
| 165 | 165 | |
| 166 | +7. fbcon=logo-pos:<location> | |
| 167 | + | |
| 168 | + The only possible 'location' is 'center' (without quotes), and when | |
| 169 | + given, the bootup logo is moved from the default top-left corner | |
| 170 | + location to the center of the framebuffer. If more than one logo is | |
| 171 | + displayed due to multiple CPUs, the collected line of logos is moved | |
| 172 | + as a whole. | |
| 173 | + | |
| 166 | 174 | C. Attaching, Detaching and Unloading |
| 167 | 175 | |
| 168 | 176 | Before going on to how to attach, detach and unload the framebuffer console, an |
| @@ -11,19 +11,19 @@ Contents: · 10 unmodified lines | ||
| 11 | 11 | batman-adv |
| 12 | 12 | can |
| 13 | 13 | can_ucan_protocol |
| 14 | − dpaa2/index | |
| 15 | − e100 | |
| 16 | − e1000 | |
| 17 | − e1000e | |
| 18 | − fm10k | |
| 19 | − igb | |
| 20 | − igbvf | |
| 21 | − ixgb | |
| 22 | − ixgbe | |
| 23 | − ixgbevf | |
| 24 | − i40e | |
| 25 | − iavf | |
| 26 | − ice | |
| 14 | + device_drivers/freescale/dpaa2/index | |
| 15 | + device_drivers/intel/e100 | |
| 16 | + device_drivers/intel/e1000 | |
| 17 | + device_drivers/intel/e1000e | |
| 18 | + device_drivers/intel/fm10k | |
| 19 | + device_drivers/intel/igb | |
| 20 | + device_drivers/intel/igbvf | |
| 21 | + device_drivers/intel/ixgb | |
| 22 | + device_drivers/intel/ixgbe | |
| 23 | + device_drivers/intel/ixgbevf | |
| 24 | + device_drivers/intel/i40e | |
| 25 | + device_drivers/intel/iavf | |
| 26 | + device_drivers/intel/ice | |
| 27 | 27 | kapi |
| 28 | 28 | z8530book |
| 29 | 29 | msg_zerocopy |
| @@ -1000,51 +1000,6 @@ The kernel interface functions are as follows: · 999 unmodified lines | ||
| 1000 | 1000 | size should be set when the call is begun. tx_total_len may not be less |
| 1001 | 1001 | than zero. |
| 1002 | 1002 | |
| 1003 | − (*) Check to see the completion state of a call so that the caller can assess | |
| 1004 | − whether it needs to be retried. | |
| 1005 | − | |
| 1006 | − enum rxrpc_call_completion { | |
| 1007 | − RXRPC_CALL_SUCCEEDED, | |
| 1008 | − RXRPC_CALL_REMOTELY_ABORTED, | |
| 1009 | − RXRPC_CALL_LOCALLY_ABORTED, | |
| 1010 | − RXRPC_CALL_LOCAL_ERROR, | |
| 1011 | − RXRPC_CALL_NETWORK_ERROR, | |
| 1012 | − }; | |
| 1013 | − | |
| 1014 | − int rxrpc_kernel_check_call(struct socket *sock, struct rxrpc_call *call, | |
| 1015 | − enum rxrpc_call_completion *_compl, | |
| 1016 | − u32 *_abort_code); | |
| 1017 | − | |
| 1018 | − On return, -EINPROGRESS will be returned if the call is still ongoing; if | |
| 1019 | − it is finished, *_compl will be set to indicate the manner of completion, | |
| 1020 | − *_abort_code will be set to any abort code that occurred. 0 will be | |
| 1021 | − returned on a successful completion, -ECONNABORTED will be returned if the | |
| 1022 | − client failed due to a remote abort and anything else will return an | |
| 1023 | − appropriate error code. | |
| 1024 | − | |
| 1025 | − The caller should look at this information to decide if it's worth | |
| 1026 | − retrying the call. | |
| 1027 | − | |
| 1028 | − (*) Retry a client call. | |
| 1029 | − | |
| 1030 | − int rxrpc_kernel_retry_call(struct socket *sock, | |
| 1031 | − struct rxrpc_call *call, | |
| 1032 | − struct sockaddr_rxrpc *srx, | |
| 1033 | − struct key *key); | |
| 1034 | − | |
| 1035 | − This attempts to partially reinitialise a call and submit it again while | |
| 1036 | − reusing the original call's Tx queue to avoid the need to repackage and | |
| 1037 | − re-encrypt the data to be sent. call indicates the call to retry, srx the | |
| 1038 | − new address to send it to and key the encryption key to use for signing or | |
| 1039 | − encrypting the packets. | |
| 1040 | − | |
| 1041 | − For this to work, the first Tx data packet must still be in the transmit | |
| 1042 | − queue, and currently this is only permitted for local and network errors | |
| 1043 | − and the call must not have been aborted. Any partially constructed Tx | |
| 1044 | − packet is left as is and can continue being filled afterwards. | |
| 1045 | − | |
| 1046 | − It returns 0 if the call was requeued and an error otherwise. | |
| 1047 | − | |
| 1048 | 1003 | (*) Get call RTT. |
| 1049 | 1004 | |
| 1050 | 1005 | u64 rxrpc_kernel_get_rtt(struct socket *sock, struct rxrpc_call *call); |
| @@ -336,7 +336,26 @@ time client replies ACK, this socket will get another chance to move · 335 unmodified lines | ||
| 336 | 336 | to the accept queue. |
| 337 | 337 | |
| 338 | 338 | |
| 339 | −TCP Fast Open | |
| 339 | +* TcpEstabResets | |
| 340 | +Defined in `RFC1213 tcpEstabResets`_. | |
| 341 | + | |
| 342 | +.. _RFC1213 tcpEstabResets: https://tools.ietf.org/html/rfc1213#page-48 | |
| 343 | + | |
| 344 | +* TcpAttemptFails | |
| 345 | +Defined in `RFC1213 tcpAttemptFails`_. | |
| 346 | + | |
| 347 | +.. _RFC1213 tcpAttemptFails: https://tools.ietf.org/html/rfc1213#page-48 | |
| 348 | + | |
| 349 | +* TcpOutRsts | |
| 350 | +Defined in `RFC1213 tcpOutRsts`_. The RFC says this counter indicates | |
| 351 | +the 'segments sent containing the RST flag', but in linux kernel, this | |
| 352 | +couner indicates the segments kerenl tried to send. The sending | |
| 353 | +process might be failed due to some errors (e.g. memory alloc failed). | |
| 354 | + | |
| 355 | +.. _RFC1213 tcpOutRsts: https://tools.ietf.org/html/rfc1213#page-52 | |
| 356 | + | |
| 357 | + | |
| 358 | +TCP Fast Path | |
| 340 | 359 | ============ |
| 341 | 360 | When kernel receives a TCP packet, it has two paths to handler the |
| 342 | 361 | packet, one is fast path, another is slow path. The comment in kernel |
| @@ -383,8 +402,6 @@ increase 1. · 40 unmodified lines | ||
| 383 | 402 | |
| 384 | 403 | TCP abort |
| 385 | 404 | ======== |
| 386 | − | |
| 387 | − | |
| 388 | 405 | * TcpExtTCPAbortOnData |
| 389 | 406 | It means TCP layer has data in flight, but need to close the |
| 390 | 407 | connection. So TCP layer sends a RST to the other side, indicate the |
| @@ -545,7 +562,6 @@ packet yet, the sender would know packet 4 is out of order. The TCP · 154 unmodified lines | ||
| 545 | 562 | stack of kernel will increase TcpExtTCPSACKReorder for both of the |
| 546 | 563 | above scenarios. |
| 547 | 564 | |
| 548 | − | |
| 549 | 565 | DSACK |
| 550 | 566 | ===== |
| 551 | 567 | The DSACK is defined in `RFC2883`_. The receiver uses DSACK to report |
| @@ -566,13 +582,63 @@ The TCP stack receives an out of order duplicate packet, so it sends a · 14 unmodified lines | ||
| 566 | 582 | DSACK to the sender. |
| 567 | 583 | |
| 568 | 584 | * TcpExtTCPDSACKRecv |
| 569 | −The TCP stack receives a DSACK, which indicate an acknowledged | |
| 585 | +The TCP stack receives a DSACK, which indicates an acknowledged | |
| 570 | 586 | duplicate packet is received. |
| 571 | 587 | |
| 572 | 588 | * TcpExtTCPDSACKOfoRecv |
| 573 | 589 | The TCP stack receives a DSACK, which indicate an out of order |
| 574 | 590 | duplicate packet is received. |
| 575 | 591 | |
| 592 | +invalid SACK and DSACK | |
| 593 | +==================== | |
| 594 | +When a SACK (or DSACK) block is invalid, a corresponding counter would | |
| 595 | +be updated. The validation method is base on the start/end sequence | |
| 596 | +number of the SACK block. For more details, please refer the comment | |
| 597 | +of the function tcp_is_sackblock_valid in the kernel source code. A | |
| 598 | +SACK option could have up to 4 blocks, they are checked | |
| 599 | +individually. E.g., if 3 blocks of a SACk is invalid, the | |
| 600 | +corresponding counter would be updated 3 times. The comment of the | |
| 601 | +`Add counters for discarded SACK blocks`_ patch has additional | |
| 602 | +explaination: | |
| 603 | + | |
| 604 | +.. _Add counters for discarded SACK blocks: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=18f02545a9a16c9a89778b91a162ad16d510bb32 | |
| 605 | + | |
| 606 | +* TcpExtTCPSACKDiscard | |
| 607 | +This counter indicates how many SACK blocks are invalid. If the invalid | |
| 608 | +SACK block is caused by ACK recording, the TCP stack will only ignore | |
| 609 | +it and won't update this counter. | |
| 610 | + | |
| 611 | +* TcpExtTCPDSACKIgnoredOld and TcpExtTCPDSACKIgnoredNoUndo | |
| 612 | +When a DSACK block is invalid, one of these two counters would be | |
| 613 | +updated. Which counter will be updated depends on the undo_marker flag | |
| 614 | +of the TCP socket. If the undo_marker is not set, the TCP stack isn't | |
| 615 | +likely to re-transmit any packets, and we still receive an invalid | |
| 616 | +DSACK block, the reason might be that the packet is duplicated in the | |
| 617 | +middle of the network. In such scenario, TcpExtTCPDSACKIgnoredNoUndo | |
| 618 | +will be updated. If the undo_marker is set, TcpExtTCPDSACKIgnoredOld | |
| 619 | +will be updated. As implied in its name, it might be an old packet. | |
| 620 | + | |
| 621 | +SACK shift | |
| 622 | +========= | |
| 623 | +The linux networking stack stores data in sk_buff struct (skb for | |
| 624 | +short). If a SACK block acrosses multiple skb, the TCP stack will try | |
| 625 | +to re-arrange data in these skb. E.g. if a SACK block acknowledges seq | |
| 626 | +10 to 15, skb1 has seq 10 to 13, skb2 has seq 14 to 20. The seq 14 and | |
| 627 | +15 in skb2 would be moved to skb1. This operation is 'shift'. If a | |
| 628 | +SACK block acknowledges seq 10 to 20, skb1 has seq 10 to 13, skb2 has | |
| 629 | +seq 14 to 20. All data in skb2 will be moved to skb1, and skb2 will be | |
| 630 | +discard, this operation is 'merge'. | |
| 631 | + | |
| 632 | +* TcpExtTCPSackShifted | |
| 633 | +A skb is shifted | |
| 634 | + | |
| 635 | +* TcpExtTCPSackMerged | |
| 636 | +A skb is merged | |
| 637 | + | |
| 638 | +* TcpExtTCPSackShiftFallback | |
| 639 | +A skb should be shifted or merged, but the TCP stack doesn't do it for | |
| 640 | +some reasons. | |
| 641 | + | |
| 576 | 642 | TCP out of order |
| 577 | 643 | =============== |
| 578 | 644 | * TcpExtTCPOFOQueue |
| @@ -662,6 +728,60 @@ unacknowledged number (more strict than `RFC 5961 section 5.2`_). · 83 unmodified lines | ||
| 662 | 728 | .. _RFC 5961 section 4.2: https://tools.ietf.org/html/rfc5961#page-9 |
| 663 | 729 | .. _RFC 5961 section 5.2: https://tools.ietf.org/html/rfc5961#page-11 |
| 664 | 730 | |
| 731 | +TCP receive window | |
| 732 | +================= | |
| 733 | +* TcpExtTCPWantZeroWindowAdv | |
| 734 | +Depending on current memory usage, the TCP stack tries to set receive | |
| 735 | +window to zero. But the receive window might still be a no-zero | |
| 736 | +value. For example, if the previous window size is 10, and the TCP | |
| 737 | +stack receives 3 bytes, the current window size would be 7 even if the | |
| 738 | +window size calculated by the memory usage is zero. | |
| 739 | + | |
| 740 | +* TcpExtTCPToZeroWindowAdv | |
| 741 | +The TCP receive window is set to zero from a no-zero value. | |
| 742 | + | |
| 743 | +* TcpExtTCPFromZeroWindowAdv | |
| 744 | +The TCP receive window is set to no-zero value from zero. | |
| 745 | + | |
| 746 | + | |
| 747 | +Delayed ACK | |
| 748 | +========== | |
| 749 | +The TCP Delayed ACK is a technique which is used for reducing the | |
| 750 | +packet count in the network. For more details, please refer the | |
| 751 | +`Delayed ACK wiki`_ | |
| 752 | + | |
| 753 | +.. _Delayed ACK wiki: https://en.wikipedia.org/wiki/TCP_delayed_acknowledgment | |
| 754 | + | |
| 755 | +* TcpExtDelayedACKs | |
| 756 | +A delayed ACK timer expires. The TCP stack will send a pure ACK packet | |
| 757 | +and exit the delayed ACK mode. | |
| 758 | + | |
| 759 | +* TcpExtDelayedACKLocked | |
| 760 | +A delayed ACK timer expires, but the TCP stack can't send an ACK | |
| 761 | +immediately due to the socket is locked by a userspace program. The | |
| 762 | +TCP stack will send a pure ACK later (after the userspace program | |
| 763 | +unlock the socket). When the TCP stack sends the pure ACK later, the | |
| 764 | +TCP stack will also update TcpExtDelayedACKs and exit the delayed ACK | |
| 765 | +mode. | |
| 766 | + | |
| 767 | +* TcpExtDelayedACKLost | |
| 768 | +It will be updated when the TCP stack receives a packet which has been | |
| 769 | +ACKed. A Delayed ACK loss might cause this issue, but it would also be | |
| 770 | +triggered by other reasons, such as a packet is duplicated in the | |
| 771 | +network. | |
| 772 | + | |
| 773 | +Tail Loss Probe (TLP) | |
| 774 | +=================== | |
| 775 | +TLP is an algorithm which is used to detect TCP packet loss. For more | |
| 776 | +details, please refer the `TLP paper`_. | |
| 777 | + | |
| 778 | +.. _TLP paper: https://tools.ietf.org/html/draft-dukkipati-tcpm-tcp-loss-probe-01 | |
| 779 | + | |
| 780 | +* TcpExtTCPLossProbes | |
| 781 | +A TLP probe packet is sent. | |
| 782 | + | |
| 783 | +* TcpExtTCPLossProbeRecovery | |
| 784 | +A packet loss is detected and recovered by TLP. | |
| 665 | 785 | |
| 666 | 786 | examples |
| 667 | 787 | ======= |
| @@ -417,7 +417,7 @@ is again deprecated and ts[2] holds a hardware timestamp if set. · 416 unmodified lines | ||
| 417 | 417 | |
| 418 | 418 | Hardware time stamping must also be initialized for each device driver |
| 419 | 419 | that is expected to do hardware time stamping. The parameter is defined in |
| 420 | −/include/linux/net_tstamp.h as: | |
| 420 | +include/uapi/linux/net_tstamp.h as: | |
| 421 | 421 | |
| 422 | 422 | struct hwtstamp_config { |
| 423 | 423 | int flags; /* no flags defined right now, must be zero */ |
| @@ -487,7 +487,7 @@ enum { · 63 unmodified lines | ||
| 487 | 487 | HWTSTAMP_FILTER_PTP_V1_L4_EVENT, |
| 488 | 488 | |
| 489 | 489 | /* for the complete list of values, please check |
| 490 | − * the include file /include/linux/net_tstamp.h | |
| 490 | + * the include file include/uapi/linux/net_tstamp.h | |
| 491 | 491 | */ |
| 492 | 492 | }; |
| 493 | 493 | |
| @@ -56,26 +56,32 @@ of any kernel data structures. · 55 unmodified lines | ||
| 56 | 56 | |
| 57 | 57 | dentry-state: |
| 58 | 58 | |
| 59 | −From linux/fs/dentry.c: | |
| 59 | +From linux/include/linux/dcache.h: | |
| 60 | 60 | -------------------------------------------------------------- |
| 61 | −struct { | |
| 61 | +struct dentry_stat_t dentry_stat { | |
| 62 | 62 | int nr_dentry; |
| 63 | 63 | int nr_unused; |
| 64 | 64 | int age_limit; /* age in seconds */ |
| 65 | 65 | int want_pages; /* pages requested by system */ |
| 66 | − int dummy[2]; | |
| 67 | −} dentry_stat = {0, 0, 45, 0,}; | |
| 68 | −-------------------------------------------------------------- | |
| 69 | − | |
| 70 | −Dentries are dynamically allocated and deallocated, and | |
| 71 | −nr_dentry seems to be 0 all the time. Hence it's safe to | |
| 72 | −assume that only nr_unused, age_limit and want_pages are | |
| 73 | −used. Nr_unused seems to be exactly what its name says. | |
| 66 | + int nr_negative; /* # of unused negative dentries */ | |
| 67 | + int dummy; /* Reserved for future use */ | |
| 68 | +}; | |
| 69 | +-------------------------------------------------------------- | |
| 70 | + | |
| 71 | +Dentries are dynamically allocated and deallocated. | |
| 72 | + | |
| 73 | +nr_dentry shows the total number of dentries allocated (active | |
| 74 | ++ unused). nr_unused shows the number of dentries that are not | |
| 75 | +actively used, but are saved in the LRU list for future reuse. | |
| 76 | + | |
| 74 | 77 | Age_limit is the age in seconds after which dcache entries |
| 75 | 78 | can be reclaimed when memory is short and want_pages is |
| 76 | 79 | nonzero when shrink_dcache_pages() has been called and the |
| 77 | 80 | dcache isn't pruned yet. |
| 78 | 81 | |
| 82 | +nr_negative shows the number of unused dentries that are also | |
| 83 | +negative dentries which do not mapped to actual files. | |
| 84 | + | |
| 79 | 85 | ============================================================== |
| 80 | 86 | |
| 81 | 87 | dquot-max & dquot-nr: |
| @@ -9,7 +9,7 @@ Fenghua Yu <fenghua.yu@intel.com> · 8 unmodified lines | ||
| 9 | 9 | Tony Luck <tony.luck@intel.com> |
| 10 | 10 | Vikas Shivappa <vikas.shivappa@intel.com> |
| 11 | 11 | |
| 12 | −This feature is enabled by the CONFIG_X86_RESCTRL and the x86 /proc/cpuinfo | |
| 12 | +This feature is enabled by the CONFIG_X86_CPU_RESCTRL and the x86 /proc/cpuinfo | |
| 13 | 13 | flag bits: |
| 14 | 14 | RDT (Resource Director Technology) Allocation - "rdt_a" |
| 15 | 15 | CAT (Cache Allocation Technology) - "cat_l3", "cat_l2" |
| @@ -3052,8 +3052,8 @@ F: include/linux/bcm963xx_nvram.h · 3051 unmodified lines | ||
| 3052 | 3052 | F: include/linux/bcm963xx_tag.h |
| 3053 | 3053 | |
| 3054 | 3054 | BROADCOM BNX2 GIGABIT ETHERNET DRIVER |
| 3055 | −M: Rasesh Mody <rasesh.mody@cavium.com> | |
| 3056 | −M: Dept-GELinuxNICDev@cavium.com | |
| 3055 | +M: Rasesh Mody <rmody@marvell.com> | |
| 3056 | +M: GR-Linux-NIC-Dev@marvell.com | |
| 3057 | 3057 | L: netdev@vger.kernel.org |
| 3058 | 3058 | S: Supported |
| 3059 | 3059 | F: drivers/net/ethernet/broadcom/bnx2.* |
| @@ -3072,9 +3072,9 @@ S: Supported · 12 unmodified lines | ||
| 3072 | 3072 | F: drivers/scsi/bnx2i/ |
| 3073 | 3073 | |
| 3074 | 3074 | BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER |
| 3075 | −M: Ariel Elior <ariel.elior@cavium.com> | |
| 3076 | −M: Sudarsana Kalluru <sudarsana.kalluru@cavium.com> | |
| 3077 | −M: everest-linux-l2@cavium.com | |
| 3075 | +M: Ariel Elior <aelior@marvell.com> | |
| 3076 | +M: Sudarsana Kalluru <skalluru@marvell.com> | |
| 3077 | +M: GR-everest-linux-l2@marvell.com | |
| 3078 | 3078 | L: netdev@vger.kernel.org |
| 3079 | 3079 | S: Supported |
| 3080 | 3080 | F: drivers/net/ethernet/broadcom/bnx2x/ |
| @@ -3249,9 +3249,9 @@ S: Supported · 168 unmodified lines | ||
| 3249 | 3249 | F: drivers/scsi/bfa/ |
| 3250 | 3250 | |
| 3251 | 3251 | BROCADE BNA 10 GIGABIT ETHERNET DRIVER |
| 3252 | −M: Rasesh Mody <rasesh.mody@cavium.com> | |
| 3253 | −M: Sudarsana Kalluru <sudarsana.kalluru@cavium.com> | |
| 3254 | −M: Dept-GELinuxNICDev@cavium.com | |
| 3252 | +M: Rasesh Mody <rmody@marvell.com> | |
| 3253 | +M: Sudarsana Kalluru <skalluru@marvell.com> | |
| 3254 | +M: GR-Linux-NIC-Dev@marvell.com | |
| 3255 | 3255 | L: netdev@vger.kernel.org |
| 3256 | 3256 | S: Supported |
| 3257 | 3257 | F: drivers/net/ethernet/brocade/bna/ |
| @@ -3471,10 +3471,9 @@ F: drivers/i2c/busses/i2c-octeon* · 213 unmodified lines | ||
| 3471 | 3471 | F: drivers/i2c/busses/i2c-thunderx* |
| 3472 | 3472 | |
| 3473 | 3473 | CAVIUM LIQUIDIO NETWORK DRIVER |
| 3474 | −M: Derek Chickles <derek.chickles@caviumnetworks.com> | |
| 3475 | −M: Satanand Burla <satananda.burla@caviumnetworks.com> | |
| 3476 | −M: Felix Manlunas <felix.manlunas@caviumnetworks.com> | |
| 3477 | −M: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com> | |
| 3474 | +M: Derek Chickles <dchickles@marvell.com> | |
| 3475 | +M: Satanand Burla <sburla@marvell.com> | |
| 3476 | +M: Felix Manlunas <fmanlunas@marvell.com> | |
| 3478 | 3477 | L: netdev@vger.kernel.org |
| 3479 | 3478 | W: http://www.cavium.com |
| 3480 | 3479 | S: Supported |
| @@ -3979,6 +3978,7 @@ F: drivers/cpufreq/arm_big_little.c · 498 unmodified lines | ||
| 3979 | 3978 | CPU POWER MONITORING SUBSYSTEM |
| 3980 | 3979 | M: Thomas Renninger <trenn@suse.com> |
| 3981 | 3980 | M: Shuah Khan <shuah@kernel.org> |
| 3981 | +M: Shuah Khan <skhan@linuxfoundation.org> | |
| 3982 | 3982 | L: linux-pm@vger.kernel.org |
| 3983 | 3983 | S: Maintained |
| 3984 | 3984 | F: tools/power/cpupower/ |
| @@ -8259,6 +8259,7 @@ F: include/uapi/linux/sunrpc/ · 4274 unmodified lines | ||
| 8259 | 8259 | |
| 8260 | 8260 | KERNEL SELFTEST FRAMEWORK |
| 8261 | 8261 | M: Shuah Khan <shuah@kernel.org> |
| 8262 | +M: Shuah Khan <skhan@linuxfoundation.org> | |
| 8262 | 8263 | L: linux-kselftest@vger.kernel.org |
| 8263 | 8264 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git |
| 8264 | 8265 | Q: https://patchwork.kernel.org/project/linux-kselftest/list/ |
| @@ -10689,9 +10690,9 @@ S: Maintained · 2424 unmodified lines | ||
| 10689 | 10690 | F: drivers/net/netdevsim/* |
| 10690 | 10691 | |
| 10691 | 10692 | NETXEN (1/10) GbE SUPPORT |
| 10692 | −M: Manish Chopra <manish.chopra@cavium.com> | |
| 10693 | −M: Rahul Verma <rahul.verma@cavium.com> | |
| 10694 | −M: Dept-GELinuxNICDev@cavium.com | |
| 10693 | +M: Manish Chopra <manishc@marvell.com> | |
| 10694 | +M: Rahul Verma <rahulv@marvell.com> | |
| 10695 | +M: GR-Linux-NIC-Dev@marvell.com | |
| 10695 | 10696 | L: netdev@vger.kernel.org |
| 10696 | 10697 | S: Supported |
| 10697 | 10698 | F: drivers/net/ethernet/qlogic/netxen/ |
| @@ -12475,8 +12476,8 @@ S: Supported · 1777 unmodified lines | ||
| 12475 | 12476 | F: drivers/scsi/qedi/ |
| 12476 | 12477 | |
| 12477 | 12478 | QLOGIC QL4xxx ETHERNET DRIVER |
| 12478 | −M: Ariel Elior <Ariel.Elior@cavium.com> | |
| 12479 | −M: everest-linux-l2@cavium.com | |
| 12479 | +M: Ariel Elior <aelior@marvell.com> | |
| 12480 | +M: GR-everest-linux-l2@marvell.com | |
| 12480 | 12481 | L: netdev@vger.kernel.org |
| 12481 | 12482 | S: Supported |
| 12482 | 12483 | F: drivers/net/ethernet/qlogic/qed/ |
| @@ -12484,8 +12485,8 @@ F: include/linux/qed/ · 1 unmodified line | ||
| 12484 | 12485 | F: drivers/net/ethernet/qlogic/qede/ |
| 12485 | 12486 | |
| 12486 | 12487 | QLOGIC QL4xxx RDMA DRIVER |
| 12487 | −M: Michal Kalderon <Michal.Kalderon@cavium.com> | |
| 12488 | −M: Ariel Elior <Ariel.Elior@cavium.com> | |
| 12488 | +M: Michal Kalderon <mkalderon@marvell.com> | |
| 12489 | +M: Ariel Elior <aelior@marvell.com> | |
| 12489 | 12490 | L: linux-rdma@vger.kernel.org |
| 12490 | 12491 | S: Supported |
| 12491 | 12492 | F: drivers/infiniband/hw/qedr/ |
| @@ -12505,7 +12506,7 @@ F: Documentation/scsi/LICENSE.qla2xxx · 13 unmodified lines | ||
| 12505 | 12506 | F: drivers/scsi/qla2xxx/ |
| 12506 | 12507 | |
| 12507 | 12508 | QLOGIC QLA3XXX NETWORK DRIVER |
| 12508 | −M: Dept-GELinuxNICDev@cavium.com | |
| 12509 | +M: GR-Linux-NIC-Dev@marvell.com | |
| 12509 | 12510 | L: netdev@vger.kernel.org |
| 12510 | 12511 | S: Supported |
| 12511 | 12512 | F: Documentation/networking/device_drivers/qlogic/LICENSE.qla3xxx |
| @@ -12519,16 +12520,16 @@ F: Documentation/scsi/LICENSE.qla4xxx · 7 unmodified lines | ||
| 12519 | 12520 | F: drivers/scsi/qla4xxx/ |
| 12520 | 12521 | |
| 12521 | 12522 | QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER |
| 12522 | −M: Shahed Shaikh <Shahed.Shaikh@cavium.com> | |
| 12523 | −M: Manish Chopra <manish.chopra@cavium.com> | |
| 12524 | −M: Dept-GELinuxNICDev@cavium.com | |
| 12523 | +M: Shahed Shaikh <shshaikh@marvell.com> | |
| 12524 | +M: Manish Chopra <manishc@marvell.com> | |
| 12525 | +M: GR-Linux-NIC-Dev@marvell.com | |
| 12525 | 12526 | L: netdev@vger.kernel.org |
| 12526 | 12527 | S: Supported |
| 12527 | 12528 | F: drivers/net/ethernet/qlogic/qlcnic/ |
| 12528 | 12529 | |
| 12529 | 12530 | QLOGIC QLGE 10Gb ETHERNET DRIVER |
| 12530 | −M: Manish Chopra <manish.chopra@cavium.com> | |
| 12531 | −M: Dept-GELinuxNICDev@cavium.com | |
| 12531 | +M: Manish Chopra <manishc@marvell.com> | |
| 12532 | +M: GR-Linux-NIC-Dev@marvell.com | |
| 12532 | 12533 | L: netdev@vger.kernel.org |
| 12533 | 12534 | S: Supported |
| 12534 | 12535 | F: drivers/net/ethernet/qlogic/qlge/ |
| @@ -15842,6 +15843,7 @@ F: drivers/usb/common/usb-otg-fsm.c · 3307 unmodified lines | ||
| 15842 | 15843 | USB OVER IP DRIVER |
| 15843 | 15844 | M: Valentina Manea <valentina.manea.m@gmail.com> |
| 15844 | 15845 | M: Shuah Khan <shuah@kernel.org> |
| 15846 | +M: Shuah Khan <skhan@linuxfoundation.org> | |
| 15845 | 15847 | L: linux-usb@vger.kernel.org |
| 15846 | 15848 | S: Maintained |
| 15847 | 15849 | F: Documentation/usb/usbip_protocol.txt |
| @@ -16639,6 +16641,15 @@ S: Maintained · 791 unmodified lines | ||
| 16639 | 16641 | F: drivers/platform/x86/ |
| 16640 | 16642 | F: drivers/platform/olpc/ |
| 16641 | 16643 | |
| 16644 | +X86 PLATFORM DRIVERS - ARCH | |
| 16645 | +R: Darren Hart <dvhart@infradead.org> | |
| 16646 | +R: Andy Shevchenko <andy@infradead.org> | |
| 16647 | +L: platform-driver-x86@vger.kernel.org | |
| 16648 | +L: x86@kernel.org | |
| 16649 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core | |
| 16650 | +S: Maintained | |
| 16651 | +F: arch/x86/platform | |
| 16652 | + | |
| 16642 | 16653 | X86 VDSO |
| 16643 | 16654 | M: Andy Lutomirski <luto@kernel.org> |
| 16644 | 16655 | L: linux-kernel@vger.kernel.org |
| @@ -16671,6 +16682,24 @@ T: git git://linuxtv.org/media_tree.git · 26 unmodified lines | ||
| 16671 | 16682 | S: Maintained |
| 16672 | 16683 | F: drivers/media/tuners/tuner-xc2028.* |
| 16673 | 16684 | |
| 16685 | +XDP (eXpress Data Path) | |
| 16686 | +M: Alexei Starovoitov <ast@kernel.org> | |
| 16687 | +M: Daniel Borkmann <daniel@iogearbox.net> | |
| 16688 | +M: David S. Miller <davem@davemloft.net> | |
| 16689 | +M: Jakub Kicinski <jakub.kicinski@netronome.com> | |
| 16690 | +M: Jesper Dangaard Brouer <hawk@kernel.org> | |
| 16691 | +M: John Fastabend <john.fastabend@gmail.com> | |
| 16692 | +L: netdev@vger.kernel.org | |
| 16693 | +L: xdp-newbies@vger.kernel.org | |
| 16694 | +S: Supported | |
| 16695 | +F: net/core/xdp.c | |
| 16696 | +F: include/net/xdp.h | |
| 16697 | +F: kernel/bpf/devmap.c | |
| 16698 | +F: kernel/bpf/cpumap.c | |
| 16699 | +F: include/trace/events/xdp.h | |
| 16700 | +K: xdp | |
| 16701 | +N: xdp | |
| 16702 | + | |
| 16674 | 16703 | XDP SOCKETS (AF_XDP) |
| 16675 | 16704 | M: Björn Töpel <bjorn.topel@intel.com> |
| 16676 | 16705 | M: Magnus Karlsson <magnus.karlsson@intel.com> |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | VERSION = 5 |
| 3 | 3 | PATCHLEVEL = 0 |
| 4 | 4 | SUBLEVEL = 0 |
| 5 | −EXTRAVERSION = -rc2 | |
| 5 | +EXTRAVERSION = -rc5 | |
| 6 | 6 | NAME = Shy Crocodile |
| 7 | 7 | |
| 8 | 8 | # *DOCUMENTATION* |
| @@ -955,6 +955,7 @@ ifdef CONFIG_STACK_VALIDATION · 946 unmodified lines | ||
| 955 | 955 | endif |
| 956 | 956 | endif |
| 957 | 957 | |
| 958 | +PHONY += prepare0 | |
| 958 | 959 | |
| 959 | 960 | ifeq ($(KBUILD_EXTMOD),) |
| 960 | 961 | core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ |
| @@ -1061,8 +1062,7 @@ scripts: scripts_basic scripts_dtc · 100 unmodified lines | ||
| 1061 | 1062 | # archprepare is used in arch Makefiles and when processed asm symlink, |
| 1062 | 1063 | # version.h and scripts_basic is processed / created. |
| 1063 | 1064 | |
| 1064 | −# Listed in dependency order | |
| 1065 | −PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 | |
| 1065 | +PHONY += prepare archprepare prepare1 prepare2 prepare3 | |
| 1066 | 1066 | |
| 1067 | 1067 | # prepare3 is used to check if we are building in a separate output directory, |
| 1068 | 1068 | # and if so do: |
| @@ -1360,11 +1360,11 @@ mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) · 291 unmodified lines | ||
| 1360 | 1360 | mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) |
| 1361 | 1361 | mrproper-dirs := $(addprefix _mrproper_,scripts) |
| 1362 | 1362 | |
| 1363 | −PHONY += $(mrproper-dirs) mrproper archmrproper | |
| 1363 | +PHONY += $(mrproper-dirs) mrproper | |
| 1364 | 1364 | $(mrproper-dirs): |
| 1365 | 1365 | $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@) |
| 1366 | 1366 | |
| 1367 | −mrproper: clean archmrproper $(mrproper-dirs) | |
| 1367 | +mrproper: clean $(mrproper-dirs) | |
| 1368 | 1368 | $(call cmd,rmdirs) |
| 1369 | 1369 | $(call cmd,rmfiles) |
| 1370 | 1370 | |
| @@ -3,23 +3,19 @@ generic-y += bugs.h · 2 unmodified lines | ||
| 3 | 3 | generic-y += compat.h |
| 4 | 4 | generic-y += device.h |
| 5 | 5 | generic-y += div64.h |
| 6 | −generic-y += dma-mapping.h | |
| 7 | 6 | generic-y += emergency-restart.h |
| 8 | 7 | generic-y += extable.h |
| 9 | −generic-y += fb.h | |
| 10 | 8 | generic-y += ftrace.h |
| 11 | 9 | generic-y += hardirq.h |
| 12 | 10 | generic-y += hw_irq.h |
| 13 | 11 | generic-y += irq_regs.h |
| 14 | 12 | generic-y += irq_work.h |
| 15 | −generic-y += kmap_types.h | |
| 16 | 13 | generic-y += local.h |
| 17 | 14 | generic-y += local64.h |
| 18 | 15 | generic-y += mcs_spinlock.h |
| 19 | 16 | generic-y += mm-arch-hooks.h |
| 20 | 17 | generic-y += msi.h |
| 21 | 18 | generic-y += parport.h |
| 22 | −generic-y += pci.h | |
| 23 | 19 | generic-y += percpu.h |
| 24 | 20 | generic-y += preempt.h |
| 25 | 21 | generic-y += topology.h |
| @@ -216,6 +216,14 @@ struct bcr_fp_arcv2 { · 215 unmodified lines | ||
| 216 | 216 | #endif |
| 217 | 217 | }; |
| 218 | 218 | |
| 219 | +struct bcr_actionpoint { | |
| 220 | +#ifdef CONFIG_CPU_BIG_ENDIAN | |
| 221 | + unsigned int pad:21, min:1, num:2, ver:8; | |
| 222 | +#else | |
| 223 | + unsigned int ver:8, num:2, min:1, pad:21; | |
| 224 | +#endif | |
| 225 | +}; | |
| 226 | + | |
| 219 | 227 | #include <soc/arc/timers.h> |
| 220 | 228 | |
| 221 | 229 | struct bcr_bpu_arcompact { |
| @@ -283,7 +291,7 @@ struct cpuinfo_arc_cache { · 61 unmodified lines | ||
| 283 | 291 | }; |
| 284 | 292 | |
| 285 | 293 | struct cpuinfo_arc_bpu { |
| 286 | − unsigned int ver, full, num_cache, num_pred; | |
| 294 | + unsigned int ver, full, num_cache, num_pred, ret_stk; | |
| 287 | 295 | }; |
| 288 | 296 | |
| 289 | 297 | struct cpuinfo_arc_ccm { |
| @@ -302,7 +310,7 @@ struct cpuinfo_arc { · 12 unmodified lines | ||
| 302 | 310 | struct { |
| 303 | 311 | unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2, |
| 304 | 312 | fpu_sp:1, fpu_dp:1, dual:1, dual_enb:1, pad2:4, |
| 305 | − debug:1, ap:1, smart:1, rtt:1, pad3:4, | |
| 313 | + ap_num:4, ap_full:1, smart:1, rtt:1, pad3:1, | |
| 306 | 314 | timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; |
| 307 | 315 | } extn; |
| 308 | 316 | struct bcr_mpy extn_mpy; |
| @@ -340,7 +340,7 @@ static inline __attribute__ ((const)) int __fls(unsigned long x) · 339 unmodified lines | ||
| 340 | 340 | /* |
| 341 | 341 | * __ffs: Similar to ffs, but zero based (0-31) |
| 342 | 342 | */ |
| 343 | −static inline __attribute__ ((const)) int __ffs(unsigned long word) | |
| 343 | +static inline __attribute__ ((const)) unsigned long __ffs(unsigned long word) | |
| 344 | 344 | { |
| 345 | 345 | if (!word) |
| 346 | 346 | return word; |
| @@ -400,9 +400,9 @@ static inline __attribute__ ((const)) int ffs(unsigned long x) · 53 unmodified lines | ||
| 400 | 400 | /* |
| 401 | 401 | * __ffs: Similar to ffs, but zero based (0-31) |
| 402 | 402 | */ |
| 403 | −static inline __attribute__ ((const)) int __ffs(unsigned long x) | |
| 403 | +static inline __attribute__ ((const)) unsigned long __ffs(unsigned long x) | |
| 404 | 404 | { |
| 405 | − int n; | |
| 405 | + unsigned long n; | |
| 406 | 406 | |
| 407 | 407 | asm volatile( |
| 408 | 408 | " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ |
| @@ -103,7 +103,8 @@ static const char * const arc_pmu_ev_hw_map[] = { · 102 unmodified lines | ||
| 103 | 103 | |
| 104 | 104 | /* counts condition */ |
| 105 | 105 | [PERF_COUNT_HW_INSTRUCTIONS] = "iall", |
| 106 | − [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmp", /* Excludes ZOL jumps */ | |
| 106 | + /* All jump instructions that are taken */ | |
| 107 | + [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmptak", | |
| 107 | 108 | [PERF_COUNT_ARC_BPOK] = "bpok", /* NP-NT, PT-T, PNT-NT */ |
| 108 | 109 | #ifdef CONFIG_ISA_ARCV2 |
| 109 | 110 | [PERF_COUNT_HW_BRANCH_MISSES] = "bpmp", |
| @@ -1,15 +1,10 @@ | ||
| 1 | −/* | |
| 2 | − * Linux performance counter support for ARC700 series | |
| 3 | − * | |
| 4 | − * Copyright (C) 2013-2015 Synopsys, Inc. (www.synopsys.com) | |
| 5 | − * | |
| 6 | − * This code is inspired by the perf support of various other architectures. | |
| 7 | − * | |
| 8 | − * This program is free software; you can redistribute it and/or modify | |
| 9 | − * it under the terms of the GNU General Public License version 2 as | |
| 10 | − * published by the Free Software Foundation. | |
| 11 | − * | |
| 12 | − */ | |
| 1 | +// SPDX-License-Identifier: GPL-2.0+ | |
| 2 | +// | |
| 3 | +// Linux performance counter support for ARC CPUs. | |
| 4 | +// This code is inspired by the perf support of various other architectures. | |
| 5 | +// | |
| 6 | +// Copyright (C) 2013-2018 Synopsys, Inc. (www.synopsys.com) | |
| 7 | + | |
| 13 | 8 | #include <linux/errno.h> |
| 14 | 9 | #include <linux/interrupt.h> |
| 15 | 10 | #include <linux/module.h> |
| @@ -19,12 +14,31 @@ · 3 unmodified lines | ||
| 19 | 14 | #include <asm/arcregs.h> |
| 20 | 15 | #include <asm/stacktrace.h> |
| 21 | 16 | |
| 17 | +/* HW holds 8 symbols + one for null terminator */ | |
| 18 | +#define ARCPMU_EVENT_NAME_LEN 9 | |
| 19 | + | |
| 20 | +enum arc_pmu_attr_groups { | |
| 21 | + ARCPMU_ATTR_GR_EVENTS, | |
| 22 | + ARCPMU_ATTR_GR_FORMATS, | |
| 23 | + ARCPMU_NR_ATTR_GR | |
| 24 | +}; | |
| 25 | + | |
| 26 | +struct arc_pmu_raw_event_entry { | |
| 27 | + char name[ARCPMU_EVENT_NAME_LEN]; | |
| 28 | +}; | |
| 29 | + | |
| 22 | 30 | struct arc_pmu { |
| 23 | 31 | struct pmu pmu; |
| 24 | 32 | unsigned int irq; |
| 25 | 33 | int n_counters; |
| 34 | + int n_events; | |
| 26 | 35 | u64 max_period; |
| 27 | 36 | int ev_hw_idx[PERF_COUNT_ARC_HW_MAX]; |
| 37 | + | |
| 38 | + struct arc_pmu_raw_event_entry *raw_entry; | |
| 39 | + struct attribute **attrs; | |
| 40 | + struct perf_pmu_events_attr *attr; | |
| 41 | + const struct attribute_group *attr_groups[ARCPMU_NR_ATTR_GR + 1]; | |
| 28 | 42 | }; |
| 29 | 43 | |
| 30 | 44 | struct arc_pmu_cpu { |
| @@ -49,6 +63,7 @@ static int callchain_trace(unsigned int addr, void *data) · 18 unmodified lines | ||
| 49 | 63 | { |
| 50 | 64 | struct arc_callchain_trace *ctrl = data; |
| 51 | 65 | struct perf_callchain_entry_ctx *entry = ctrl->perf_stuff; |
| 66 | + | |
| 52 | 67 | perf_callchain_store(entry, addr); |
| 53 | 68 | |
| 54 | 69 | if (ctrl->depth++ < 3) |
| @@ -57,8 +72,8 @@ static int callchain_trace(unsigned int addr, void *data) · 2 unmodified lines | ||
| 57 | 72 | return -1; |
| 58 | 73 | } |
| 59 | 74 | |
| 60 | −void | |
| 61 | −perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) | |
| 75 | +void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, | |
| 76 | + struct pt_regs *regs) | |
| 62 | 77 | { |
| 63 | 78 | struct arc_callchain_trace ctrl = { |
| 64 | 79 | .depth = 0, |
| @@ -68,8 +83,8 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re · 3 unmodified lines | ||
| 68 | 83 | arc_unwind_core(NULL, regs, callchain_trace, &ctrl); |
| 69 | 84 | } |
| 70 | 85 | |
| 71 | −void | |
| 72 | −perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) | |
| 86 | +void perf_callchain_user(struct perf_callchain_entry_ctx *entry, | |
| 87 | + struct pt_regs *regs) | |
| 73 | 88 | { |
| 74 | 89 | /* |
| 75 | 90 | * User stack can't be unwound trivially with kernel dwarf unwinder |
| @@ -82,10 +97,10 @@ static struct arc_pmu *arc_pmu; · 6 unmodified lines | ||
| 82 | 97 | static DEFINE_PER_CPU(struct arc_pmu_cpu, arc_pmu_cpu); |
| 83 | 98 | |
| 84 | 99 | /* read counter #idx; note that counter# != event# on ARC! */ |
| 85 | −static uint64_t arc_pmu_read_counter(int idx) | |
| 100 | +static u64 arc_pmu_read_counter(int idx) | |
| 86 | 101 | { |
| 87 | − uint32_t tmp; | |
| 88 | − uint64_t result; | |
| 102 | + u32 tmp; | |
| 103 | + u64 result; | |
| 89 | 104 | |
| 90 | 105 | /* |
| 91 | 106 | * ARC supports making 'snapshots' of the counters, so we don't |
| @@ -94,7 +109,7 @@ static uint64_t arc_pmu_read_counter(int idx) · 2 unmodified lines | ||
| 94 | 109 | write_aux_reg(ARC_REG_PCT_INDEX, idx); |
| 95 | 110 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); |
| 96 | 111 | write_aux_reg(ARC_REG_PCT_CONTROL, tmp | ARC_REG_PCT_CONTROL_SN); |
| 97 | − result = (uint64_t) (read_aux_reg(ARC_REG_PCT_SNAPH)) << 32; | |
| 112 | + result = (u64) (read_aux_reg(ARC_REG_PCT_SNAPH)) << 32; | |
| 98 | 113 | result |= read_aux_reg(ARC_REG_PCT_SNAPL); |
| 99 | 114 | |
| 100 | 115 | return result; |
| @@ -103,9 +118,9 @@ static uint64_t arc_pmu_read_counter(int idx) · 2 unmodified lines | ||
| 103 | 118 | static void arc_perf_event_update(struct perf_event *event, |
| 104 | 119 | struct hw_perf_event *hwc, int idx) |
| 105 | 120 | { |
| 106 | − uint64_t prev_raw_count = local64_read(&hwc->prev_count); | |
| 107 | − uint64_t new_raw_count = arc_pmu_read_counter(idx); | |
| 108 | − int64_t delta = new_raw_count - prev_raw_count; | |
| 121 | + u64 prev_raw_count = local64_read(&hwc->prev_count); | |
| 122 | + u64 new_raw_count = arc_pmu_read_counter(idx); | |
| 123 | + s64 delta = new_raw_count - prev_raw_count; | |
| 109 | 124 | |
| 110 | 125 | /* |
| 111 | 126 | * We aren't afraid of hwc->prev_count changing beneath our feet |
| @@ -155,7 +170,7 @@ static int arc_pmu_event_init(struct perf_event *event) · 43 unmodified lines | ||
| 155 | 170 | int ret; |
| 156 | 171 | |
| 157 | 172 | if (!is_sampling_event(event)) { |
| 158 | − hwc->sample_period = arc_pmu->max_period; | |
| 173 | + hwc->sample_period = arc_pmu->max_period; | |
| 159 | 174 | hwc->last_period = hwc->sample_period; |
| 160 | 175 | local64_set(&hwc->period_left, hwc->sample_period); |
| 161 | 176 | } |
| @@ -192,6 +207,18 @@ static int arc_pmu_event_init(struct perf_event *event) · 30 unmodified lines | ||
| 192 | 207 | pr_debug("init cache event with h/w %08x \'%s\'\n", |
| 193 | 208 | (int)hwc->config, arc_pmu_ev_hw_map[ret]); |
| 194 | 209 | return 0; |
| 210 | + | |
| 211 | + case PERF_TYPE_RAW: | |
| 212 | + if (event->attr.config >= arc_pmu->n_events) | |
| 213 | + return -ENOENT; | |
| 214 | + | |
| 215 | + hwc->config |= event->attr.config; | |
| 216 | + pr_debug("init raw event with idx %lld \'%s\'\n", | |
| 217 | + event->attr.config, | |
| 218 | + arc_pmu->raw_entry[event->attr.config].name); | |
| 219 | + | |
| 220 | + return 0; | |
| 221 | + | |
| 195 | 222 | default: |
| 196 | 223 | return -ENOENT; |
| 197 | 224 | } |
| @@ -200,7 +227,7 @@ static int arc_pmu_event_init(struct perf_event *event) · 2 unmodified lines | ||
| 200 | 227 | /* starts all counters */ |
| 201 | 228 | static void arc_pmu_enable(struct pmu *pmu) |
| 202 | 229 | { |
| 203 | − uint32_t tmp; | |
| 230 | + u32 tmp; | |
| 204 | 231 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); |
| 205 | 232 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x1); |
| 206 | 233 | } |
| @@ -208,7 +235,7 @@ static void arc_pmu_enable(struct pmu *pmu) · 1 unmodified line | ||
| 208 | 235 | /* stops all counters */ |
| 209 | 236 | static void arc_pmu_disable(struct pmu *pmu) |
| 210 | 237 | { |
| 211 | − uint32_t tmp; | |
| 238 | + u32 tmp; | |
| 212 | 239 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); |
| 213 | 240 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x0); |
| 214 | 241 | } |
| @@ -228,7 +255,7 @@ static int arc_pmu_event_set_period(struct perf_event *event) · 13 unmodified lines | ||
| 228 | 255 | local64_set(&hwc->period_left, left); |
| 229 | 256 | hwc->last_period = period; |
| 230 | 257 | overflow = 1; |
| 231 | − } else if (unlikely(left <= 0)) { | |
| 258 | + } else if (unlikely(left <= 0)) { | |
| 232 | 259 | /* left underflowed by less than period. */ |
| 233 | 260 | left += period; |
| 234 | 261 | local64_set(&hwc->period_left, left); |
| @@ -246,8 +273,8 @@ static int arc_pmu_event_set_period(struct perf_event *event) · 11 unmodified lines | ||
| 246 | 273 | write_aux_reg(ARC_REG_PCT_INDEX, idx); |
| 247 | 274 | |
| 248 | 275 | /* Write value */ |
| 249 | − write_aux_reg(ARC_REG_PCT_COUNTL, (u32)value); | |
| 250 | − write_aux_reg(ARC_REG_PCT_COUNTH, (value >> 32)); | |
| 276 | + write_aux_reg(ARC_REG_PCT_COUNTL, lower_32_bits(value)); | |
| 277 | + write_aux_reg(ARC_REG_PCT_COUNTH, upper_32_bits(value)); | |
| 251 | 278 | |
| 252 | 279 | perf_event_update_userpage(event); |
| 253 | 280 | |
| @@ -277,7 +304,7 @@ static void arc_pmu_start(struct perf_event *event, int flags) · 23 unmodified lines | ||
| 277 | 304 | /* Enable interrupt for this counter */ |
| 278 | 305 | if (is_sampling_event(event)) |
| 279 | 306 | write_aux_reg(ARC_REG_PCT_INT_CTRL, |
| 280 | − read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx)); | |
| 307 | + read_aux_reg(ARC_REG_PCT_INT_CTRL) | BIT(idx)); | |
| 281 | 308 | |
| 282 | 309 | /* enable ARC pmu here */ |
| 283 | 310 | write_aux_reg(ARC_REG_PCT_INDEX, idx); /* counter # */ |
| @@ -295,9 +322,9 @@ static void arc_pmu_stop(struct perf_event *event, int flags) · 11 unmodified lines | ||
| 295 | 322 | * Reset interrupt flag by writing of 1. This is required |
| 296 | 323 | * to make sure pending interrupt was not left. |
| 297 | 324 | */ |
| 298 | − write_aux_reg(ARC_REG_PCT_INT_ACT, 1 << idx); | |
| 325 | + write_aux_reg(ARC_REG_PCT_INT_ACT, BIT(idx)); | |
| 299 | 326 | write_aux_reg(ARC_REG_PCT_INT_CTRL, |
| 300 | − read_aux_reg(ARC_REG_PCT_INT_CTRL) & ~(1 << idx)); | |
| 327 | + read_aux_reg(ARC_REG_PCT_INT_CTRL) & ~BIT(idx)); | |
| 301 | 328 | } |
| 302 | 329 | |
| 303 | 330 | if (!(event->hw.state & PERF_HES_STOPPED)) { |
| @@ -349,9 +376,10 @@ static int arc_pmu_add(struct perf_event *event, int flags) · 45 unmodified lines | ||
| 349 | 376 | |
| 350 | 377 | if (is_sampling_event(event)) { |
| 351 | 378 | /* Mimic full counter overflow as other arches do */ |
| 352 | − write_aux_reg(ARC_REG_PCT_INT_CNTL, (u32)arc_pmu->max_period); | |
| 379 | + write_aux_reg(ARC_REG_PCT_INT_CNTL, | |
| 380 | + lower_32_bits(arc_pmu->max_period)); | |
| 353 | 381 | write_aux_reg(ARC_REG_PCT_INT_CNTH, |
| 354 | − (arc_pmu->max_period >> 32)); | |
| 382 | + upper_32_bits(arc_pmu->max_period)); | |
| 355 | 383 | } |
| 356 | 384 | |
| 357 | 385 | write_aux_reg(ARC_REG_PCT_CONFIG, 0); |
| @@ -392,7 +420,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) · 34 unmodified lines | ||
| 392 | 420 | idx = __ffs(active_ints); |
| 393 | 421 | |
| 394 | 422 | /* Reset interrupt flag by writing of 1 */ |
| 395 | − write_aux_reg(ARC_REG_PCT_INT_ACT, 1 << idx); | |
| 423 | + write_aux_reg(ARC_REG_PCT_INT_ACT, BIT(idx)); | |
| 396 | 424 | |
| 397 | 425 | /* |
| 398 | 426 | * On reset of "interrupt active" bit corresponding |
| @@ -400,7 +428,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) · 1 unmodified line | ||
| 400 | 428 | * Now we need to re-enable interrupt for the counter. |
| 401 | 429 | */ |
| 402 | 430 | write_aux_reg(ARC_REG_PCT_INT_CTRL, |
| 403 | − read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx)); | |
| 431 | + read_aux_reg(ARC_REG_PCT_INT_CTRL) | BIT(idx)); | |
| 404 | 432 | |
| 405 | 433 | event = pmu_cpu->act_counter[idx]; |
| 406 | 434 | hwc = &event->hw; |
| @@ -414,7 +442,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) · 7 unmodified lines | ||
| 414 | 442 | arc_pmu_stop(event, 0); |
| 415 | 443 | } |
| 416 | 444 | |
| 417 | − active_ints &= ~(1U << idx); | |
| 445 | + active_ints &= ~BIT(idx); | |
| 418 | 446 | } while (active_ints); |
| 419 | 447 | |
| 420 | 448 | done: |
| @@ -441,19 +469,108 @@ static void arc_cpu_pmu_irq_init(void *data) · 20 unmodified lines | ||
| 441 | 469 | write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff); |
| 442 | 470 | } |
| 443 | 471 | |
| 472 | +/* Event field occupies the bottom 15 bits of our config field */ | |
| 473 | +PMU_FORMAT_ATTR(event, "config:0-14"); | |
| 474 | +static struct attribute *arc_pmu_format_attrs[] = { | |
| 475 | + &format_attr_event.attr, | |
| 476 | + NULL, | |
| 477 | +}; | |
| 478 | + | |
| 479 | +static struct attribute_group arc_pmu_format_attr_gr = { | |
| 480 | + .name = "format", | |
| 481 | + .attrs = arc_pmu_format_attrs, | |
| 482 | +}; | |
| 483 | + | |
| 484 | +static ssize_t arc_pmu_events_sysfs_show(struct device *dev, | |
| 485 | + struct device_attribute *attr, | |
| 486 | + char *page) | |
| 487 | +{ | |
| 488 | + struct perf_pmu_events_attr *pmu_attr; | |
| 489 | + | |
| 490 | + pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr); | |
| 491 | + return sprintf(page, "event=0x%04llx\n", pmu_attr->id); | |
| 492 | +} | |
| 493 | + | |
| 494 | +/* | |
| 495 | + * We don't add attrs here as we don't have pre-defined list of perf events. | |
| 496 | + * We will generate and add attrs dynamically in probe() after we read HW | |
| 497 | + * configuration. | |
| 498 | + */ | |
| 499 | +static struct attribute_group arc_pmu_events_attr_gr = { | |
| 500 | + .name = "events", | |
| 501 | +}; | |
| 502 | + | |
| 503 | +static void arc_pmu_add_raw_event_attr(int j, char *str) | |
| 504 | +{ | |
| 505 | + memmove(arc_pmu->raw_entry[j].name, str, ARCPMU_EVENT_NAME_LEN - 1); | |
| 506 | + arc_pmu->attr[j].attr.attr.name = arc_pmu->raw_entry[j].name; | |
| 507 | + arc_pmu->attr[j].attr.attr.mode = VERIFY_OCTAL_PERMISSIONS(0444); | |
| 508 | + arc_pmu->attr[j].attr.show = arc_pmu_events_sysfs_show; | |
| 509 | + arc_pmu->attr[j].id = j; | |
| 510 | + arc_pmu->attrs[j] = &(arc_pmu->attr[j].attr.attr); | |
| 511 | +} | |
| 512 | + | |
| 513 | +static int arc_pmu_raw_alloc(struct device *dev) | |
| 514 | +{ | |
| 515 | + arc_pmu->attr = devm_kmalloc_array(dev, arc_pmu->n_events + 1, | |
| 516 | + sizeof(*arc_pmu->attr), GFP_KERNEL | __GFP_ZERO); | |
| 517 | + if (!arc_pmu->attr) | |
| 518 | + return -ENOMEM; | |
| 519 | + | |
| 520 | + arc_pmu->attrs = devm_kmalloc_array(dev, arc_pmu->n_events + 1, | |
| 521 | + sizeof(*arc_pmu->attrs), GFP_KERNEL | __GFP_ZERO); | |
| 522 | + if (!arc_pmu->attrs) | |
| 523 | + return -ENOMEM; | |
| 524 | + | |
| 525 | + arc_pmu->raw_entry = devm_kmalloc_array(dev, arc_pmu->n_events, | |
| 526 | + sizeof(*arc_pmu->raw_entry), GFP_KERNEL | __GFP_ZERO); | |
| 527 | + if (!arc_pmu->raw_entry) | |
| 528 | + return -ENOMEM; | |
| 529 | + | |
| 530 | + return 0; | |
| 531 | +} | |
| 532 | + | |
| 533 | +static inline bool event_in_hw_event_map(int i, char *name) | |
| 534 | +{ | |
| 535 | + if (!arc_pmu_ev_hw_map[i]) | |
| 536 | + return false; | |
| 537 | + | |
| 538 | + if (!strlen(arc_pmu_ev_hw_map[i])) | |
| 539 | + return false; | |
| 540 | + | |
| 541 | + if (strcmp(arc_pmu_ev_hw_map[i], name)) | |
| 542 | + return false; | |
| 543 | + | |
| 544 | + return true; | |
| 545 | +} | |
| 546 | + | |
| 547 | +static void arc_pmu_map_hw_event(int j, char *str) | |
| 548 | +{ | |
| 549 | + int i; | |
| 550 | + | |
| 551 | + /* See if HW condition has been mapped to a perf event_id */ | |
| 552 | + for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) { | |
| 553 | + if (event_in_hw_event_map(i, str)) { | |
| 554 | + pr_debug("mapping perf event %2d to h/w event \'%8s\' (idx %d)\n", | |
| 555 | + i, str, j); | |
| 556 | + arc_pmu->ev_hw_idx[i] = j; | |
| 557 | + } | |
| 558 | + } | |
| 559 | +} | |
| 560 | + | |
| 444 | 561 | static int arc_pmu_device_probe(struct platform_device *pdev) |
| 445 | 562 | { |
| 446 | 563 | struct arc_reg_pct_build pct_bcr; |
| 447 | 564 | struct arc_reg_cc_build cc_bcr; |
| 448 | − int i, j, has_interrupts; | |
| 565 | + int i, has_interrupts; | |
| 449 | 566 | int counter_size; /* in bits */ |
| 450 | 567 | |
| 451 | 568 | union cc_name { |
| 452 | 569 | struct { |
| 453 | − uint32_t word0, word1; | |
| 570 | + u32 word0, word1; | |
| 454 | 571 | char sentinel; |
| 455 | 572 | } indiv; |
| 456 | − char str[9]; | |
| 573 | + char str[ARCPMU_EVENT_NAME_LEN]; | |
| 457 | 574 | } cc_name; |
| 458 | 575 | |
| 459 | 576 | |
| @@ -463,15 +580,22 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 3 unmodified lines | ||
| 463 | 580 | return -ENODEV; |
| 464 | 581 | } |
| 465 | 582 | BUILD_BUG_ON(ARC_PERF_MAX_COUNTERS > 32); |
| 466 | − BUG_ON(pct_bcr.c > ARC_PERF_MAX_COUNTERS); | |
| 583 | + if (WARN_ON(pct_bcr.c > ARC_PERF_MAX_COUNTERS)) | |
| 584 | + return -EINVAL; | |
| 467 | 585 | |
| 468 | 586 | READ_BCR(ARC_REG_CC_BUILD, cc_bcr); |
| 469 | − BUG_ON(!cc_bcr.v); /* Counters exist but No countable conditions ? */ | |
| 587 | + if (WARN(!cc_bcr.v, "Counters exist but No countable conditions?")) | |
| 588 | + return -EINVAL; | |
| 470 | 589 | |
| 471 | 590 | arc_pmu = devm_kzalloc(&pdev->dev, sizeof(struct arc_pmu), GFP_KERNEL); |
| 472 | 591 | if (!arc_pmu) |
| 473 | 592 | return -ENOMEM; |
| 474 | 593 | |
| 594 | + arc_pmu->n_events = cc_bcr.c; | |
| 595 | + | |
| 596 | + if (arc_pmu_raw_alloc(&pdev->dev)) | |
| 597 | + return -ENOMEM; | |
| 598 | + | |
| 475 | 599 | has_interrupts = is_isa_arcv2() ? pct_bcr.i : 0; |
| 476 | 600 | |
| 477 | 601 | arc_pmu->n_counters = pct_bcr.c; |
| @@ -481,30 +605,26 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 3 unmodified lines | ||
| 481 | 605 | |
| 482 | 606 | pr_info("ARC perf\t: %d counters (%d bits), %d conditions%s\n", |
| 483 | 607 | arc_pmu->n_counters, counter_size, cc_bcr.c, |
| 484 | − has_interrupts ? ", [overflow IRQ support]":""); | |
| 608 | + has_interrupts ? ", [overflow IRQ support]" : ""); | |
| 485 | 609 | |
| 486 | − cc_name.str[8] = 0; | |
| 610 | + cc_name.str[ARCPMU_EVENT_NAME_LEN - 1] = 0; | |
| 487 | 611 | for (i = 0; i < PERF_COUNT_ARC_HW_MAX; i++) |
| 488 | 612 | arc_pmu->ev_hw_idx[i] = -1; |
| 489 | 613 | |
| 490 | 614 | /* loop thru all available h/w condition indexes */ |
| 491 | − for (j = 0; j < cc_bcr.c; j++) { | |
| 492 | − write_aux_reg(ARC_REG_CC_INDEX, j); | |
| 615 | + for (i = 0; i < cc_bcr.c; i++) { | |
| 616 | + write_aux_reg(ARC_REG_CC_INDEX, i); | |
| 493 | 617 | cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0); |
| 494 | 618 | cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1); |
| 495 | 619 | |
| 496 | − /* See if it has been mapped to a perf event_id */ | |
| 497 | − for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) { | |
| 498 | − if (arc_pmu_ev_hw_map[i] && | |
| 499 | − !strcmp(arc_pmu_ev_hw_map[i], cc_name.str) && | |
| 500 | − strlen(arc_pmu_ev_hw_map[i])) { | |
| 501 | − pr_debug("mapping perf event %2d to h/w event \'%8s\' (idx %d)\n", | |
| 502 | − i, cc_name.str, j); | |
| 503 | − arc_pmu->ev_hw_idx[i] = j; | |
| 504 | − } | |
| 505 | − } | |
| 620 | + arc_pmu_map_hw_event(i, cc_name.str); | |
| 621 | + arc_pmu_add_raw_event_attr(i, cc_name.str); | |
| 506 | 622 | } |
| 507 | 623 | |
| 624 | + arc_pmu_events_attr_gr.attrs = arc_pmu->attrs; | |
| 625 | + arc_pmu->attr_groups[ARCPMU_ATTR_GR_EVENTS] = &arc_pmu_events_attr_gr; | |
| 626 | + arc_pmu->attr_groups[ARCPMU_ATTR_GR_FORMATS] = &arc_pmu_format_attr_gr; | |
| 627 | + | |
| 508 | 628 | arc_pmu->pmu = (struct pmu) { |
| 509 | 629 | .pmu_enable = arc_pmu_enable, |
| 510 | 630 | .pmu_disable = arc_pmu_disable, |
| @@ -514,6 +634,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 3 unmodified lines | ||
| 514 | 634 | .start = arc_pmu_start, |
| 515 | 635 | .stop = arc_pmu_stop, |
| 516 | 636 | .read = arc_pmu_read, |
| 637 | + .attr_groups = arc_pmu->attr_groups, | |
| 517 | 638 | }; |
| 518 | 639 | |
| 519 | 640 | if (has_interrupts) { |
| @@ -535,17 +656,19 @@ static int arc_pmu_device_probe(struct platform_device *pdev) · 15 unmodified lines | ||
| 535 | 656 | } else |
| 536 | 657 | arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; |
| 537 | 658 | |
| 538 | − return perf_pmu_register(&arc_pmu->pmu, pdev->name, PERF_TYPE_RAW); | |
| 659 | + /* | |
| 660 | + * perf parser doesn't really like '-' symbol in events name, so let's | |
| 661 | + * use '_' in arc pct name as it goes to kernel PMU event prefix. | |
| 662 | + */ | |
| 663 | + return perf_pmu_register(&arc_pmu->pmu, "arc_pct", PERF_TYPE_RAW); | |
| 539 | 664 | } |
| 540 | 665 | |
| 541 | −#ifdef CONFIG_OF | |
| 542 | 666 | static const struct of_device_id arc_pmu_match[] = { |
| 543 | 667 | { .compatible = "snps,arc700-pct" }, |
| 544 | 668 | { .compatible = "snps,archs-pct" }, |
| 545 | 669 | {}, |
| 546 | 670 | }; |
| 547 | 671 | MODULE_DEVICE_TABLE(of, arc_pmu_match); |
| 548 | −#endif | |
| 549 | 672 | |
| 550 | 673 | static struct platform_driver arc_pmu_driver = { |
| 551 | 674 | .driver = { |
| @@ -123,6 +123,7 @@ static void read_arc_build_cfg_regs(void) · 122 unmodified lines | ||
| 123 | 123 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; |
| 124 | 124 | const struct id_to_str *tbl; |
| 125 | 125 | struct bcr_isa_arcv2 isa; |
| 126 | + struct bcr_actionpoint ap; | |
| 126 | 127 | |
| 127 | 128 | FIX_PTR(cpu); |
| 128 | 129 | |
| @@ -195,6 +196,7 @@ static void read_arc_build_cfg_regs(void) · 66 unmodified lines | ||
| 195 | 196 | cpu->bpu.full = bpu.ft; |
| 196 | 197 | cpu->bpu.num_cache = 256 << bpu.bce; |
| 197 | 198 | cpu->bpu.num_pred = 2048 << bpu.pte; |
| 199 | + cpu->bpu.ret_stk = 4 << bpu.rse; | |
| 198 | 200 | |
| 199 | 201 | if (cpu->core.family >= 0x54) { |
| 200 | 202 | unsigned int exec_ctrl; |
| @@ -207,8 +209,11 @@ static void read_arc_build_cfg_regs(void) · 6 unmodified lines | ||
| 207 | 209 | } |
| 208 | 210 | } |
| 209 | 211 | |
| 210 | − READ_BCR(ARC_REG_AP_BCR, bcr); | |
| 211 | − cpu->extn.ap = bcr.ver ? 1 : 0; | |
| 212 | + READ_BCR(ARC_REG_AP_BCR, ap); | |
| 213 | + if (ap.ver) { | |
| 214 | + cpu->extn.ap_num = 2 << ap.num; | |
| 215 | + cpu->extn.ap_full = !!ap.min; | |
| 216 | + } | |
| 212 | 217 | |
| 213 | 218 | READ_BCR(ARC_REG_SMART_BCR, bcr); |
| 214 | 219 | cpu->extn.smart = bcr.ver ? 1 : 0; |
| @@ -216,8 +221,6 @@ static void read_arc_build_cfg_regs(void) · 1 unmodified line | ||
| 216 | 221 | READ_BCR(ARC_REG_RTT_BCR, bcr); |
| 217 | 222 | cpu->extn.rtt = bcr.ver ? 1 : 0; |
| 218 | 223 | |
| 219 | − cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt; | |
| 220 | − | |
| 221 | 224 | READ_BCR(ARC_REG_ISA_CFG_BCR, isa); |
| 222 | 225 | |
| 223 | 226 | /* some hacks for lack of feature BCR info in old ARC700 cores */ |
| @@ -299,10 +302,10 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) · 75 unmodified lines | ||
| 299 | 302 | |
| 300 | 303 | if (cpu->bpu.ver) |
| 301 | 304 | n += scnprintf(buf + n, len - n, |
| 302 | − "BPU\t\t: %s%s match, cache:%d, Predict Table:%d", | |
| 305 | + "BPU\t\t: %s%s match, cache:%d, Predict Table:%d Return stk: %d", | |
| 303 | 306 | IS_AVAIL1(cpu->bpu.full, "full"), |
| 304 | 307 | IS_AVAIL1(!cpu->bpu.full, "partial"), |
| 305 | − cpu->bpu.num_cache, cpu->bpu.num_pred); | |
| 308 | + cpu->bpu.num_cache, cpu->bpu.num_pred, cpu->bpu.ret_stk); | |
| 306 | 309 | |
| 307 | 310 | if (is_isa_arcv2()) { |
| 308 | 311 | struct bcr_lpb lpb; |
| @@ -336,11 +339,17 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len) · 27 unmodified lines | ||
| 336 | 339 | IS_AVAIL1(cpu->extn.fpu_sp, "SP "), |
| 337 | 340 | IS_AVAIL1(cpu->extn.fpu_dp, "DP ")); |
| 338 | 341 | |
| 339 | − if (cpu->extn.debug) | |
| 340 | − n += scnprintf(buf + n, len - n, "DEBUG\t\t: %s%s%s\n", | |
| 341 | − IS_AVAIL1(cpu->extn.ap, "ActionPoint "), | |
| 342 | + if (cpu->extn.ap_num | cpu->extn.smart | cpu->extn.rtt) { | |
| 343 | + n += scnprintf(buf + n, len - n, "DEBUG\t\t: %s%s", | |
| 342 | 344 | IS_AVAIL1(cpu->extn.smart, "smaRT "), |
| 343 | 345 | IS_AVAIL1(cpu->extn.rtt, "RTT ")); |
| 346 | + if (cpu->extn.ap_num) { | |
| 347 | + n += scnprintf(buf + n, len - n, "ActionPoint %d/%s", | |
| 348 | + cpu->extn.ap_num, | |
| 349 | + cpu->extn.ap_full ? "full":"min"); | |
| 350 | + } | |
| 351 | + n += scnprintf(buf + n, len - n, "\n"); | |
| 352 | + } | |
| 344 | 353 | |
| 345 | 354 | if (cpu->dccm.sz || cpu->iccm.sz) |
| 346 | 355 | n += scnprintf(buf + n, len - n, "Extn [CCM]\t: DCCM @ %x, %d KB / ICCM: @ %x, %d KB\n", |
| @@ -18,6 +18,8 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <asm/arcregs.h> |
| 19 | 19 | #include <asm/irqflags.h> |
| 20 | 20 | |
| 21 | +#define ARC_PATH_MAX 256 | |
| 22 | + | |
| 21 | 23 | /* |
| 22 | 24 | * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) |
| 23 | 25 | * -Prints 3 regs per line and a CR. |
| @@ -58,11 +60,12 @@ static void show_callee_regs(struct callee_regs *cregs) · 34 unmodified lines | ||
| 58 | 60 | print_reg_file(&(cregs->r13), 13); |
| 59 | 61 | } |
| 60 | 62 | |
| 61 | −static void print_task_path_n_nm(struct task_struct *tsk, char *buf) | |
| 63 | +static void print_task_path_n_nm(struct task_struct *tsk) | |
| 62 | 64 | { |
| 63 | 65 | char *path_nm = NULL; |
| 64 | 66 | struct mm_struct *mm; |
| 65 | 67 | struct file *exe_file; |
| 68 | + char buf[ARC_PATH_MAX]; | |
| 66 | 69 | |
| 67 | 70 | mm = get_task_mm(tsk); |
| 68 | 71 | if (!mm) |
| @@ -72,7 +75,7 @@ static void print_task_path_n_nm(struct task_struct *tsk, char *buf) · 3 unmodified lines | ||
| 72 | 75 | mmput(mm); |
| 73 | 76 | |
| 74 | 77 | if (exe_file) { |
| 75 | − path_nm = file_path(exe_file, buf, 255); | |
| 78 | + path_nm = file_path(exe_file, buf, ARC_PATH_MAX-1); | |
| 76 | 79 | fput(exe_file); |
| 77 | 80 | } |
| 78 | 81 | |
| @@ -80,10 +83,9 @@ done: · 1 unmodified line | ||
| 80 | 83 | pr_info("Path: %s\n", !IS_ERR(path_nm) ? path_nm : "?"); |
| 81 | 84 | } |
| 82 | 85 | |
| 83 | −static void show_faulting_vma(unsigned long address, char *buf) | |
| 86 | +static void show_faulting_vma(unsigned long address) | |
| 84 | 87 | { |
| 85 | 88 | struct vm_area_struct *vma; |
| 86 | − char *nm = buf; | |
| 87 | 89 | struct mm_struct *active_mm = current->active_mm; |
| 88 | 90 | |
| 89 | 91 | /* can't use print_vma_addr() yet as it doesn't check for |
| @@ -96,8 +98,11 @@ static void show_faulting_vma(unsigned long address, char *buf) · 6 unmodified lines | ||
| 96 | 98 | * if the container VMA is not found |
| 97 | 99 | */ |
| 98 | 100 | if (vma && (vma->vm_start <= address)) { |
| 101 | + char buf[ARC_PATH_MAX]; | |
| 102 | + char *nm = "?"; | |
| 103 | + | |
| 99 | 104 | if (vma->vm_file) { |
| 100 | − nm = file_path(vma->vm_file, buf, PAGE_SIZE - 1); | |
| 105 | + nm = file_path(vma->vm_file, buf, ARC_PATH_MAX-1); | |
| 101 | 106 | if (IS_ERR(nm)) |
| 102 | 107 | nm = "?"; |
| 103 | 108 | } |
| @@ -173,13 +178,14 @@ void show_regs(struct pt_regs *regs) · 69 unmodified lines | ||
| 173 | 178 | { |
| 174 | 179 | struct task_struct *tsk = current; |
| 175 | 180 | struct callee_regs *cregs; |
| 176 | − char *buf; | |
| 177 | 181 | |
| 178 | − buf = (char *)__get_free_page(GFP_KERNEL); | |
| 179 | − if (!buf) | |
| 180 | − return; | |
| 182 | + /* | |
| 183 | + * generic code calls us with preemption disabled, but some calls | |
| 184 | + * here could sleep, so re-enable to avoid lockdep splat | |
| 185 | + */ | |
| 186 | + preempt_enable(); | |
| 181 | 187 | |
| 182 | − print_task_path_n_nm(tsk, buf); | |
| 188 | + print_task_path_n_nm(tsk); | |
| 183 | 189 | show_regs_print_info(KERN_INFO); |
| 184 | 190 | |
| 185 | 191 | show_ecr_verbose(regs); |
| @@ -189,7 +195,7 @@ void show_regs(struct pt_regs *regs) · 3 unmodified lines | ||
| 189 | 195 | (void *)regs->blink, (void *)regs->ret); |
| 190 | 196 | |
| 191 | 197 | if (user_mode(regs)) |
| 192 | − show_faulting_vma(regs->ret, buf); /* faulting code, not data */ | |
| 198 | + show_faulting_vma(regs->ret); /* faulting code, not data */ | |
| 193 | 199 | |
| 194 | 200 | pr_info("[STAT32]: 0x%08lx", regs->status32); |
| 195 | 201 | |
| @@ -222,7 +228,7 @@ void show_regs(struct pt_regs *regs) · 26 unmodified lines | ||
| 222 | 228 | if (cregs) |
| 223 | 229 | show_callee_regs(cregs); |
| 224 | 230 | |
| 225 | − free_page((unsigned long)buf); | |
| 231 | + preempt_disable(); | |
| 226 | 232 | } |
| 227 | 233 | |
| 228 | 234 | void show_kernel_fault_diag(const char *str, struct pt_regs *regs, |
| @@ -7,11 +7,39 @@ · 6 unmodified lines | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | #include <linux/linkage.h> |
| 10 | +#include <asm/cache.h> | |
| 10 | 11 | |
| 11 | −#undef PREALLOC_NOT_AVAIL | |
| 12 | +/* | |
| 13 | + * The memset implementation below is optimized to use prefetchw and prealloc | |
| 14 | + * instruction in case of CPU with 64B L1 data cache line (L1_CACHE_SHIFT == 6) | |
| 15 | + * If you want to implement optimized memset for other possible L1 data cache | |
| 16 | + * line lengths (32B and 128B) you should rewrite code carefully checking | |
| 17 | + * we don't call any prefetchw/prealloc instruction for L1 cache lines which | |
| 18 | + * don't belongs to memset area. | |
| 19 | + */ | |
| 20 | + | |
| 21 | +#if L1_CACHE_SHIFT == 6 | |
| 22 | + | |
| 23 | +.macro PREALLOC_INSTR reg, off | |
| 24 | + prealloc [\reg, \off] | |
| 25 | +.endm | |
| 26 | + | |
| 27 | +.macro PREFETCHW_INSTR reg, off | |
| 28 | + prefetchw [\reg, \off] | |
| 29 | +.endm | |
| 30 | + | |
| 31 | +#else | |
| 32 | + | |
| 33 | +.macro PREALLOC_INSTR | |
| 34 | +.endm | |
| 35 | + | |
| 36 | +.macro PREFETCHW_INSTR | |
| 37 | +.endm | |
| 38 | + | |
| 39 | +#endif | |
| 12 | 40 | |
| 13 | 41 | ENTRY_CFI(memset) |
| 14 | − prefetchw [r0] ; Prefetch the write location | |
| 42 | + PREFETCHW_INSTR r0, 0 ; Prefetch the first write location | |
| 15 | 43 | mov.f 0, r2 |
| 16 | 44 | ;;; if size is zero |
| 17 | 45 | jz.d [blink] |
| @@ -48,11 +76,8 @@ ENTRY_CFI(memset) · 30 unmodified lines | ||
| 48 | 76 | |
| 49 | 77 | lpnz @.Lset64bytes |
| 50 | 78 | ;; LOOP START |
| 51 | −#ifdef PREALLOC_NOT_AVAIL | |
| 52 | − prefetchw [r3, 64] ;Prefetch the next write location | |
| 53 | −#else | |
| 54 | − prealloc [r3, 64] | |
| 55 | −#endif | |
| 79 | + PREALLOC_INSTR r3, 64 ; alloc next line w/o fetching | |
| 80 | + | |
| 56 | 81 | #ifdef CONFIG_ARC_HAS_LL64 |
| 57 | 82 | std.ab r4, [r3, 8] |
| 58 | 83 | std.ab r4, [r3, 8] |
| @@ -85,7 +110,6 @@ ENTRY_CFI(memset) · 26 unmodified lines | ||
| 85 | 110 | lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes |
| 86 | 111 | lpnz .Lset32bytes |
| 87 | 112 | ;; LOOP START |
| 88 | − prefetchw [r3, 32] ;Prefetch the next write location | |
| 89 | 113 | #ifdef CONFIG_ARC_HAS_LL64 |
| 90 | 114 | std.ab r4, [r3, 8] |
| 91 | 115 | std.ab r4, [r3, 8] |
| @@ -141,12 +141,17 @@ good_area: · 140 unmodified lines | ||
| 141 | 141 | */ |
| 142 | 142 | fault = handle_mm_fault(vma, address, flags); |
| 143 | 143 | |
| 144 | − /* If Pagefault was interrupted by SIGKILL, exit page fault "early" */ | |
| 145 | 144 | if (fatal_signal_pending(current)) { |
| 146 | − if ((fault & VM_FAULT_ERROR) && !(fault & VM_FAULT_RETRY)) | |
| 147 | − up_read(&mm->mmap_sem); | |
| 148 | − if (user_mode(regs)) | |
| 145 | + | |
| 146 | + /* | |
| 147 | + * if fault retry, mmap_sem already relinquished by core mm | |
| 148 | + * so OK to return to user mode (with signal handled first) | |
| 149 | + */ | |
| 150 | + if (fault & VM_FAULT_RETRY) { | |
| 151 | + if (!user_mode(regs)) | |
| 152 | + goto no_context; | |
| 149 | 153 | return; |
| 154 | + } | |
| 150 | 155 | } |
| 151 | 156 | |
| 152 | 157 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); |
| @@ -119,7 +119,8 @@ void __init setup_arch_memory(void) · 118 unmodified lines | ||
| 119 | 119 | */ |
| 120 | 120 | |
| 121 | 121 | memblock_add_node(low_mem_start, low_mem_sz, 0); |
| 122 | − memblock_reserve(low_mem_start, __pa(_end) - low_mem_start); | |
| 122 | + memblock_reserve(CONFIG_LINUX_LINK_BASE, | |
| 123 | + __pa(_end) - CONFIG_LINUX_LINK_BASE); | |
| 123 | 124 | |
| 124 | 125 | #ifdef CONFIG_BLK_DEV_INITRD |
| 125 | 126 | if (phys_initrd_size) { |
| @@ -1 +1,95 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _ASM_ARM_XEN_PAGE_COHERENT_H | |
| 3 | +#define _ASM_ARM_XEN_PAGE_COHERENT_H | |
| 4 | + | |
| 5 | +#include <linux/dma-mapping.h> | |
| 6 | +#include <asm/page.h> | |
| 1 | 7 | #include <xen/arm/page-coherent.h> |
| 8 | + | |
| 9 | +static inline const struct dma_map_ops *xen_get_dma_ops(struct device *dev) | |
| 10 | +{ | |
| 11 | + if (dev && dev->archdata.dev_dma_ops) | |
| 12 | + return dev->archdata.dev_dma_ops; | |
| 13 | + return get_arch_dma_ops(NULL); | |
| 14 | +} | |
| 15 | + | |
| 16 | +static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, | |
| 17 | + dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) | |
| 18 | +{ | |
| 19 | + return xen_get_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs); | |
| 20 | +} | |
| 21 | + | |
| 22 | +static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, | |
| 23 | + void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) | |
| 24 | +{ | |
| 25 | + xen_get_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs); | |
| 26 | +} | |
| 27 | + | |
| 28 | +static inline void xen_dma_map_page(struct device *hwdev, struct page *page, | |
| 29 | + dma_addr_t dev_addr, unsigned long offset, size_t size, | |
| 30 | + enum dma_data_direction dir, unsigned long attrs) | |
| 31 | +{ | |
| 32 | + unsigned long page_pfn = page_to_xen_pfn(page); | |
| 33 | + unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); | |
| 34 | + unsigned long compound_pages = | |
| 35 | + (1<<compound_order(page)) * XEN_PFN_PER_PAGE; | |
| 36 | + bool local = (page_pfn <= dev_pfn) && | |
| 37 | + (dev_pfn - page_pfn < compound_pages); | |
| 38 | + | |
| 39 | + /* | |
| 40 | + * Dom0 is mapped 1:1, while the Linux page can span across | |
| 41 | + * multiple Xen pages, it's not possible for it to contain a | |
| 42 | + * mix of local and foreign Xen pages. So if the first xen_pfn | |
| 43 | + * == mfn the page is local otherwise it's a foreign page | |
| 44 | + * grant-mapped in dom0. If the page is local we can safely | |
| 45 | + * call the native dma_ops function, otherwise we call the xen | |
| 46 | + * specific function. | |
| 47 | + */ | |
| 48 | + if (local) | |
| 49 | + xen_get_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); | |
| 50 | + else | |
| 51 | + __xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs); | |
| 52 | +} | |
| 53 | + | |
| 54 | +static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | |
| 55 | + size_t size, enum dma_data_direction dir, unsigned long attrs) | |
| 56 | +{ | |
| 57 | + unsigned long pfn = PFN_DOWN(handle); | |
| 58 | + /* | |
| 59 | + * Dom0 is mapped 1:1, while the Linux page can be spanned accross | |
| 60 | + * multiple Xen page, it's not possible to have a mix of local and | |
| 61 | + * foreign Xen page. Dom0 is mapped 1:1, so calling pfn_valid on a | |
| 62 | + * foreign mfn will always return false. If the page is local we can | |
| 63 | + * safely call the native dma_ops function, otherwise we call the xen | |
| 64 | + * specific function. | |
| 65 | + */ | |
| 66 | + if (pfn_valid(pfn)) { | |
| 67 | + if (xen_get_dma_ops(hwdev)->unmap_page) | |
| 68 | + xen_get_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs); | |
| 69 | + } else | |
| 70 | + __xen_dma_unmap_page(hwdev, handle, size, dir, attrs); | |
| 71 | +} | |
| 72 | + | |
| 73 | +static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, | |
| 74 | + dma_addr_t handle, size_t size, enum dma_data_direction dir) | |
| 75 | +{ | |
| 76 | + unsigned long pfn = PFN_DOWN(handle); | |
| 77 | + if (pfn_valid(pfn)) { | |
| 78 | + if (xen_get_dma_ops(hwdev)->sync_single_for_cpu) | |
| 79 | + xen_get_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir); | |
| 80 | + } else | |
| 81 | + __xen_dma_sync_single_for_cpu(hwdev, handle, size, dir); | |
| 82 | +} | |
| 83 | + | |
| 84 | +static inline void xen_dma_sync_single_for_device(struct device *hwdev, | |
| 85 | + dma_addr_t handle, size_t size, enum dma_data_direction dir) | |
| 86 | +{ | |
| 87 | + unsigned long pfn = PFN_DOWN(handle); | |
| 88 | + if (pfn_valid(pfn)) { | |
| 89 | + if (xen_get_dma_ops(hwdev)->sync_single_for_device) | |
| 90 | + xen_get_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir); | |
| 91 | + } else | |
| 92 | + __xen_dma_sync_single_for_device(hwdev, handle, size, dir); | |
| 93 | +} | |
| 94 | + | |
| 95 | +#endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ | |
| @@ -83,7 +83,7 @@ static void __iomem *cns3xxx_pci_map_bus(struct pci_bus *bus, · 82 unmodified lines | ||
| 83 | 83 | } else /* remote PCI bus */ |
| 84 | 84 | base = cnspci->cfg1_regs + ((busno & 0xf) << 20); |
| 85 | 85 | |
| 86 | − return base + (where & 0xffc) + (devfn << 12); | |
| 86 | + return base + where + (devfn << 12); | |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, |
| @@ -93,7 +93,7 @@ static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, · 3 unmodified lines | ||
| 93 | 93 | u32 mask = (0x1ull << (size * 8)) - 1; |
| 94 | 94 | int shift = (where % 4) * 8; |
| 95 | 95 | |
| 96 | − ret = pci_generic_config_read32(bus, devfn, where, size, val); | |
| 96 | + ret = pci_generic_config_read(bus, devfn, where, size, val); | |
| 97 | 97 | |
| 98 | 98 | if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && |
| 99 | 99 | (where & 0xffc) == PCI_CLASS_REVISION) |
| @@ -60,8 +60,6 @@ · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | #ifdef CONFIG_KASAN_SW_TAGS |
| 62 | 62 | #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) |
| 63 | −#else | |
| 64 | −#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long) | |
| 65 | 63 | #endif |
| 66 | 64 | |
| 67 | 65 | #ifndef __ASSEMBLY__ |
| @@ -20,9 +20,6 @@ struct dev_archdata { · 19 unmodified lines | ||
| 20 | 20 | #ifdef CONFIG_IOMMU_API |
| 21 | 21 | void *iommu; /* private IOMMU data */ |
| 22 | 22 | #endif |
| 23 | −#ifdef CONFIG_XEN | |
| 24 | − const struct dma_map_ops *dev_dma_ops; | |
| 25 | −#endif | |
| 26 | 23 | }; |
| 27 | 24 | |
| 28 | 25 | struct pdev_archdata { |
| @@ -60,8 +60,11 @@ static inline bool arm64_kernel_use_ng_mappings(void) · 59 unmodified lines | ||
| 60 | 60 | * later determine that kpti is required, then |
| 61 | 61 | * kpti_install_ng_mappings() will make them non-global. |
| 62 | 62 | */ |
| 63 | + if (arm64_kernel_unmapped_at_el0()) | |
| 64 | + return true; | |
| 65 | + | |
| 63 | 66 | if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE)) |
| 64 | − return arm64_kernel_unmapped_at_el0(); | |
| 67 | + return false; | |
| 65 | 68 | |
| 66 | 69 | /* |
| 67 | 70 | * KASLR is enabled so we're going to be enabling kpti on non-broken |
| @@ -1 +1,77 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _ASM_ARM64_XEN_PAGE_COHERENT_H | |
| 3 | +#define _ASM_ARM64_XEN_PAGE_COHERENT_H | |
| 4 | + | |
| 5 | +#include <linux/dma-mapping.h> | |
| 6 | +#include <asm/page.h> | |
| 1 | 7 | #include <xen/arm/page-coherent.h> |
| 8 | + | |
| 9 | +static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, | |
| 10 | + dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) | |
| 11 | +{ | |
| 12 | + return dma_direct_alloc(hwdev, size, dma_handle, flags, attrs); | |
| 13 | +} | |
| 14 | + | |
| 15 | +static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, | |
| 16 | + void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) | |
| 17 | +{ | |
| 18 | + dma_direct_free(hwdev, size, cpu_addr, dma_handle, attrs); | |
| 19 | +} | |
| 20 | + | |
| 21 | +static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, | |
| 22 | + dma_addr_t handle, size_t size, enum dma_data_direction dir) | |
| 23 | +{ | |
| 24 | + unsigned long pfn = PFN_DOWN(handle); | |
| 25 | + | |
| 26 | + if (pfn_valid(pfn)) | |
| 27 | + dma_direct_sync_single_for_cpu(hwdev, handle, size, dir); | |
| 28 | + else | |
| 29 | + __xen_dma_sync_single_for_cpu(hwdev, handle, size, dir); | |
| 30 | +} | |
| 31 | + | |
| 32 | +static inline void xen_dma_sync_single_for_device(struct device *hwdev, | |
| 33 | + dma_addr_t handle, size_t size, enum dma_data_direction dir) | |
| 34 | +{ | |
| 35 | + unsigned long pfn = PFN_DOWN(handle); | |
| 36 | + if (pfn_valid(pfn)) | |
| 37 | + dma_direct_sync_single_for_device(hwdev, handle, size, dir); | |
| 38 | + else | |
| 39 | + __xen_dma_sync_single_for_device(hwdev, handle, size, dir); | |
| 40 | +} | |
| 41 | + | |
| 42 | +static inline void xen_dma_map_page(struct device *hwdev, struct page *page, | |
| 43 | + dma_addr_t dev_addr, unsigned long offset, size_t size, | |
| 44 | + enum dma_data_direction dir, unsigned long attrs) | |
| 45 | +{ | |
| 46 | + unsigned long page_pfn = page_to_xen_pfn(page); | |
| 47 | + unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); | |
| 48 | + unsigned long compound_pages = | |
| 49 | + (1<<compound_order(page)) * XEN_PFN_PER_PAGE; | |
| 50 | + bool local = (page_pfn <= dev_pfn) && | |
| 51 | + (dev_pfn - page_pfn < compound_pages); | |
| 52 | + | |
| 53 | + if (local) | |
| 54 | + dma_direct_map_page(hwdev, page, offset, size, dir, attrs); | |
| 55 | + else | |
| 56 | + __xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs); | |
| 57 | +} | |
| 58 | + | |
| 59 | +static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | |
| 60 | + size_t size, enum dma_data_direction dir, unsigned long attrs) | |
| 61 | +{ | |
| 62 | + unsigned long pfn = PFN_DOWN(handle); | |
| 63 | + /* | |
| 64 | + * Dom0 is mapped 1:1, while the Linux page can be spanned accross | |
| 65 | + * multiple Xen page, it's not possible to have a mix of local and | |
| 66 | + * foreign Xen page. Dom0 is mapped 1:1, so calling pfn_valid on a | |
| 67 | + * foreign mfn will always return false. If the page is local we can | |
| 68 | + * safely call the native dma_ops function, otherwise we call the xen | |
| 69 | + * specific function. | |
| 70 | + */ | |
| 71 | + if (pfn_valid(pfn)) | |
| 72 | + dma_direct_unmap_page(hwdev, handle, size, dir, attrs); | |
| 73 | + else | |
| 74 | + __xen_dma_unmap_page(hwdev, handle, size, dir, attrs); | |
| 75 | +} | |
| 76 | + | |
| 77 | +#endif /* _ASM_ARM64_XEN_PAGE_COHERENT_H */ | |
| @@ -299,8 +299,10 @@ int swsusp_arch_suspend(void) · 298 unmodified lines | ||
| 299 | 299 | dcache_clean_range(__idmap_text_start, __idmap_text_end); |
| 300 | 300 | |
| 301 | 301 | /* Clean kvm setup code to PoC? */ |
| 302 | − if (el2_reset_needed()) | |
| 302 | + if (el2_reset_needed()) { | |
| 303 | 303 | dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end); |
| 304 | + dcache_clean_range(__hyp_text_start, __hyp_text_end); | |
| 305 | + } | |
| 304 | 306 | |
| 305 | 307 | /* make the crash dump kernel image protected again */ |
| 306 | 308 | crash_post_resume(); |
| @@ -28,6 +28,8 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <asm/virt.h> |
| 29 | 29 | |
| 30 | 30 | .text |
| 31 | + .pushsection .hyp.text, "ax" | |
| 32 | + | |
| 31 | 33 | .align 11 |
| 32 | 34 | |
| 33 | 35 | ENTRY(__hyp_stub_vectors) |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/sched.h> |
| 15 | 15 | #include <linux/types.h> |
| 16 | 16 | |
| 17 | +#include <asm/cacheflush.h> | |
| 17 | 18 | #include <asm/fixmap.h> |
| 18 | 19 | #include <asm/kernel-pgtable.h> |
| 19 | 20 | #include <asm/memory.h> |
| @@ -43,7 +44,7 @@ static __init u64 get_kaslr_seed(void *fdt) · 23 unmodified lines | ||
| 43 | 44 | return ret; |
| 44 | 45 | } |
| 45 | 46 | |
| 46 | −static __init const u8 *get_cmdline(void *fdt) | |
| 47 | +static __init const u8 *kaslr_get_cmdline(void *fdt) | |
| 47 | 48 | { |
| 48 | 49 | static __initconst const u8 default_cmdline[] = CONFIG_CMDLINE; |
| 49 | 50 | |
| @@ -87,6 +88,7 @@ u64 __init kaslr_early_init(u64 dt_phys) · 37 unmodified lines | ||
| 87 | 88 | * we end up running with module randomization disabled. |
| 88 | 89 | */ |
| 89 | 90 | module_alloc_base = (u64)_etext - MODULES_VSIZE; |
| 91 | + __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); | |
| 90 | 92 | |
| 91 | 93 | /* |
| 92 | 94 | * Try to map the FDT early. If this fails, we simply bail, |
| @@ -109,7 +111,7 @@ u64 __init kaslr_early_init(u64 dt_phys) · 16 unmodified lines | ||
| 109 | 111 | * Check if 'nokaslr' appears on the command line, and |
| 110 | 112 | * return 0 if that is the case. |
| 111 | 113 | */ |
| 112 | − cmdline = get_cmdline(fdt); | |
| 114 | + cmdline = kaslr_get_cmdline(fdt); | |
| 113 | 115 | str = strstr(cmdline, "nokaslr"); |
| 114 | 116 | if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) |
| 115 | 117 | return 0; |
| @@ -169,5 +171,8 @@ u64 __init kaslr_early_init(u64 dt_phys) · 53 unmodified lines | ||
| 169 | 171 | module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; |
| 170 | 172 | module_alloc_base &= PAGE_MASK; |
| 171 | 173 | |
| 174 | + __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); | |
| 175 | + __flush_dcache_area(&memstart_offset_seed, sizeof(memstart_offset_seed)); | |
| 176 | + | |
| 172 | 177 | return offset; |
| 173 | 178 | } |
| @@ -478,13 +478,13 @@ bool arch_within_kprobe_blacklist(unsigned long addr) · 477 unmodified lines | ||
| 478 | 478 | addr < (unsigned long)__entry_text_end) || |
| 479 | 479 | (addr >= (unsigned long)__idmap_text_start && |
| 480 | 480 | addr < (unsigned long)__idmap_text_end) || |
| 481 | + (addr >= (unsigned long)__hyp_text_start && | |
| 482 | + addr < (unsigned long)__hyp_text_end) || | |
| 481 | 483 | !!search_exception_tables(addr)) |
| 482 | 484 | return true; |
| 483 | 485 | |
| 484 | 486 | if (!is_kernel_in_hyp_mode()) { |
| 485 | − if ((addr >= (unsigned long)__hyp_text_start && | |
| 486 | − addr < (unsigned long)__hyp_text_end) || | |
| 487 | − (addr >= (unsigned long)__hyp_idmap_text_start && | |
| 487 | + if ((addr >= (unsigned long)__hyp_idmap_text_start && | |
| 488 | 488 | addr < (unsigned long)__hyp_idmap_text_end)) |
| 489 | 489 | return true; |
| 490 | 490 | } |
| @@ -466,9 +466,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, · 465 unmodified lines | ||
| 466 | 466 | __iommu_setup_dma_ops(dev, dma_base, size, iommu); |
| 467 | 467 | |
| 468 | 468 | #ifdef CONFIG_XEN |
| 469 | − if (xen_initial_domain()) { | |
| 470 | − dev->archdata.dev_dma_ops = dev->dma_ops; | |
| 469 | + if (xen_initial_domain()) | |
| 471 | 470 | dev->dma_ops = xen_dma_ops; |
| 472 | − } | |
| 473 | 471 | #endif |
| 474 | 472 | } |
| @@ -33,7 +33,11 @@ void sync_icache_aliases(void *kaddr, unsigned long len) · 32 unmodified lines | ||
| 33 | 33 | __clean_dcache_area_pou(kaddr, len); |
| 34 | 34 | __flush_icache_all(); |
| 35 | 35 | } else { |
| 36 | − flush_icache_range(addr, addr + len); | |
| 36 | + /* | |
| 37 | + * Don't issue kick_all_cpus_sync() after I-cache invalidation | |
| 38 | + * for user mappings. | |
| 39 | + */ | |
| 40 | + __flush_icache_range(addr, addr + len); | |
| 37 | 41 | } |
| 38 | 42 | } |
| 39 | 43 | |
| @@ -30,6 +30,7 @@ generic-y += pgalloc.h · 29 unmodified lines | ||
| 30 | 30 | generic-y += preempt.h |
| 31 | 31 | generic-y += segment.h |
| 32 | 32 | generic-y += serial.h |
| 33 | +generic-y += shmparam.h | |
| 33 | 34 | generic-y += tlbflush.h |
| 34 | 35 | generic-y += topology.h |
| 35 | 36 | generic-y += trace_clock.h |
| @@ -1,5 +1,4 @@ | ||
| 1 | 1 | include include/uapi/asm-generic/Kbuild.asm |
| 2 | 2 | |
| 3 | 3 | generic-y += kvm_para.h |
| 4 | −generic-y += shmparam.h | |
| 5 | 4 | generic-y += ucontext.h |
| @@ -37,8 +37,6 @@ libs-y += arch/$(ARCH)/lib/ · 36 unmodified lines | ||
| 37 | 37 | |
| 38 | 38 | boot := arch/h8300/boot |
| 39 | 39 | |
| 40 | −archmrproper: | |
| 41 | − | |
| 42 | 40 | archclean: |
| 43 | 41 | $(Q)$(MAKE) $(clean)=$(boot) |
| 44 | 42 | |
| @@ -40,6 +40,7 @@ generic-y += preempt.h · 39 unmodified lines | ||
| 40 | 40 | generic-y += scatterlist.h |
| 41 | 41 | generic-y += sections.h |
| 42 | 42 | generic-y += serial.h |
| 43 | +generic-y += shmparam.h | |
| 43 | 44 | generic-y += sizes.h |
| 44 | 45 | generic-y += spinlock.h |
| 45 | 46 | generic-y += timex.h |
| @@ -1,5 +1,4 @@ | ||
| 1 | 1 | include include/uapi/asm-generic/Kbuild.asm |
| 2 | 2 | |
| 3 | 3 | generic-y += kvm_para.h |
| 4 | −generic-y += shmparam.h | |
| 5 | 4 | generic-y += ucontext.h |
| @@ -30,6 +30,7 @@ generic-y += rwsem.h · 29 unmodified lines | ||
| 30 | 30 | generic-y += sections.h |
| 31 | 31 | generic-y += segment.h |
| 32 | 32 | generic-y += serial.h |
| 33 | +generic-y += shmparam.h | |
| 33 | 34 | generic-y += sizes.h |
| 34 | 35 | generic-y += topology.h |
| 35 | 36 | generic-y += trace_clock.h |
| @@ -1,4 +1,3 @@ | ||
| 1 | 1 | include include/uapi/asm-generic/Kbuild.asm |
| 2 | 2 | |
| 3 | −generic-y += shmparam.h | |
| 4 | 3 | generic-y += ucontext.h |
| @@ -16,8 +16,6 @@ KBUILD_DEFCONFIG := generic_defconfig · 15 unmodified lines | ||
| 16 | 16 | NM := $(CROSS_COMPILE)nm -B |
| 17 | 17 | READELF := $(CROSS_COMPILE)readelf |
| 18 | 18 | |
| 19 | −export AWK | |
| 20 | − | |
| 21 | 19 | CHECKFLAGS += -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__ |
| 22 | 20 | |
| 23 | 21 | OBJCOPYFLAGS := --strip-all |
| @@ -20,6 +20,7 @@ generic-y += mm-arch-hooks.h · 19 unmodified lines | ||
| 20 | 20 | generic-y += percpu.h |
| 21 | 21 | generic-y += preempt.h |
| 22 | 22 | generic-y += sections.h |
| 23 | +generic-y += shmparam.h | |
| 23 | 24 | generic-y += spinlock.h |
| 24 | 25 | generic-y += topology.h |
| 25 | 26 | generic-y += trace_clock.h |
| @@ -2,4 +2,3 @@ include include/uapi/asm-generic/Kbuild.asm · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | generated-y += unistd_32.h |
| 4 | 4 | generic-y += kvm_para.h |
| 5 | −generic-y += shmparam.h | |
| @@ -26,6 +26,7 @@ generic-y += parport.h · 25 unmodified lines | ||
| 26 | 26 | generic-y += percpu.h |
| 27 | 27 | generic-y += preempt.h |
| 28 | 28 | generic-y += serial.h |
| 29 | +generic-y += shmparam.h | |
| 29 | 30 | generic-y += syscalls.h |
| 30 | 31 | generic-y += topology.h |
| 31 | 32 | generic-y += trace_clock.h |
| @@ -2,5 +2,4 @@ include include/uapi/asm-generic/Kbuild.asm · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | generated-y += unistd_32.h |
| 4 | 4 | generic-y += kvm_para.h |
| 5 | −generic-y += shmparam.h | |
| 6 | 5 | generic-y += ucontext.h |
| @@ -3155,6 +3155,7 @@ config MIPS32_O32 · 3154 unmodified lines | ||
| 3155 | 3155 | config MIPS32_N32 |
| 3156 | 3156 | bool "Kernel support for n32 binaries" |
| 3157 | 3157 | depends on 64BIT |
| 3158 | + select ARCH_WANT_COMPAT_IPC_PARSE_VERSION | |
| 3158 | 3159 | select COMPAT |
| 3159 | 3160 | select MIPS32_COMPAT |
| 3160 | 3161 | select SYSVIPC_COMPAT if SYSVIPC |
| @@ -173,6 +173,31 @@ void __init plat_mem_setup(void) · 172 unmodified lines | ||
| 173 | 173 | pm_power_off = bcm47xx_machine_halt; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | +#ifdef CONFIG_BCM47XX_BCMA | |
| 177 | +static struct device * __init bcm47xx_setup_device(void) | |
| 178 | +{ | |
| 179 | + struct device *dev; | |
| 180 | + int err; | |
| 181 | + | |
| 182 | + dev = kzalloc(sizeof(*dev), GFP_KERNEL); | |
| 183 | + if (!dev) | |
| 184 | + return NULL; | |
| 185 | + | |
| 186 | + err = dev_set_name(dev, "bcm47xx_soc"); | |
| 187 | + if (err) { | |
| 188 | + pr_err("Failed to set SoC device name: %d\n", err); | |
| 189 | + kfree(dev); | |
| 190 | + return NULL; | |
| 191 | + } | |
| 192 | + | |
| 193 | + err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32)); | |
| 194 | + if (err) | |
| 195 | + pr_err("Failed to set SoC DMA mask: %d\n", err); | |
| 196 | + | |
| 197 | + return dev; | |
| 198 | +} | |
| 199 | +#endif | |
| 200 | + | |
| 176 | 201 | /* |
| 177 | 202 | * This finishes bus initialization doing things that were not possible without |
| 178 | 203 | * kmalloc. Make sure to call it late enough (after mm_init). |
| @@ -183,6 +208,10 @@ void __init bcm47xx_bus_setup(void) · 4 unmodified lines | ||
| 183 | 208 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) { |
| 184 | 209 | int err; |
| 185 | 210 | |
| 211 | + bcm47xx_bus.bcma.dev = bcm47xx_setup_device(); | |
| 212 | + if (!bcm47xx_bus.bcma.dev) | |
| 213 | + panic("Failed to setup SoC device\n"); | |
| 214 | + | |
| 186 | 215 | err = bcma_host_soc_init(&bcm47xx_bus.bcma); |
| 187 | 216 | if (err) |
| 188 | 217 | panic("Failed to initialize BCMA bus (err %d)", err); |
| @@ -235,6 +264,8 @@ static int __init bcm47xx_register_bus_complete(void) · 46 unmodified lines | ||
| 235 | 264 | #endif |
| 236 | 265 | #ifdef CONFIG_BCM47XX_BCMA |
| 237 | 266 | case BCM47XX_BUS_TYPE_BCMA: |
| 267 | + if (device_register(bcm47xx_bus.bcma.dev)) | |
| 268 | + pr_err("Failed to register SoC device\n"); | |
| 238 | 269 | bcma_bus_register(&bcm47xx_bus.bcma.bus); |
| 239 | 270 | break; |
| 240 | 271 | #endif |
| @@ -98,7 +98,7 @@ static void octeon_kexec_smp_down(void *ignored) · 97 unmodified lines | ||
| 98 | 98 | " sync \n" |
| 99 | 99 | " synci ($0) \n"); |
| 100 | 100 | |
| 101 | − relocated_kexec_smp_wait(NULL); | |
| 101 | + kexec_reboot(); | |
| 102 | 102 | } |
| 103 | 103 | #endif |
| 104 | 104 | |
| @@ -66,6 +66,7 @@ CONFIG_SERIAL_8250_CONSOLE=y · 65 unmodified lines | ||
| 66 | 66 | # CONFIG_SERIAL_8250_PCI is not set |
| 67 | 67 | CONFIG_SERIAL_8250_NR_UARTS=1 |
| 68 | 68 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 |
| 69 | +CONFIG_SERIAL_OF_PLATFORM=y | |
| 69 | 70 | CONFIG_SERIAL_AR933X=y |
| 70 | 71 | CONFIG_SERIAL_AR933X_CONSOLE=y |
| 71 | 72 | # CONFIG_HW_RANDOM is not set |
| @@ -18,8 +18,6 @@ · 17 unmodified lines | ||
| 18 | 18 | #define INT_NUM_EXTRA_START (INT_NUM_IM4_IRL0 + 32) |
| 19 | 19 | #define INT_NUM_IM_OFFSET (INT_NUM_IM1_IRL0 - INT_NUM_IM0_IRL0) |
| 20 | 20 | |
| 21 | −#define MIPS_CPU_TIMER_IRQ 7 | |
| 22 | − | |
| 23 | 21 | #define MAX_IM 5 |
| 24 | 22 | |
| 25 | 23 | #endif /* _FALCON_IRQ__ */ |
| @@ -19,8 +19,6 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #define LTQ_DMA_CH0_INT (INT_NUM_IM2_IRL0) |
| 21 | 21 | |
| 22 | −#define MIPS_CPU_TIMER_IRQ 7 | |
| 23 | − | |
| 24 | 22 | #define MAX_IM 5 |
| 25 | 23 | |
| 26 | 24 | #endif |
| @@ -74,14 +74,15 @@ static int __init vdma_init(void) · 73 unmodified lines | ||
| 74 | 74 | get_order(VDMA_PGTBL_SIZE)); |
| 75 | 75 | BUG_ON(!pgtbl); |
| 76 | 76 | dma_cache_wback_inv((unsigned long)pgtbl, VDMA_PGTBL_SIZE); |
| 77 | − pgtbl = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl); | |
| 77 | + pgtbl = (VDMA_PGTBL_ENTRY *)CKSEG1ADDR((unsigned long)pgtbl); | |
| 78 | 78 | |
| 79 | 79 | /* |
| 80 | 80 | * Clear the R4030 translation table |
| 81 | 81 | */ |
| 82 | 82 | vdma_pgtbl_init(); |
| 83 | 83 | |
| 84 | − r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, CPHYSADDR(pgtbl)); | |
| 84 | + r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, | |
| 85 | + CPHYSADDR((unsigned long)pgtbl)); | |
| 85 | 86 | r4030_write_reg32(JAZZ_R4030_TRSTBL_LIM, VDMA_PGTBL_SIZE); |
| 86 | 87 | r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0); |
| 87 | 88 | |
| @@ -224,9 +224,11 @@ static struct irq_chip ltq_eiu_type = { · 223 unmodified lines | ||
| 224 | 224 | .irq_set_type = ltq_eiu_settype, |
| 225 | 225 | }; |
| 226 | 226 | |
| 227 | −static void ltq_hw_irqdispatch(int module) | |
| 227 | +static void ltq_hw_irq_handler(struct irq_desc *desc) | |
| 228 | 228 | { |
| 229 | + int module = irq_desc_get_irq(desc) - 2; | |
| 229 | 230 | u32 irq; |
| 231 | + int hwirq; | |
| 230 | 232 | |
| 231 | 233 | irq = ltq_icu_r32(module, LTQ_ICU_IM0_IOSR); |
| 232 | 234 | if (irq == 0) |
| @@ -237,7 +239,8 @@ static void ltq_hw_irqdispatch(int module) · 4 unmodified lines | ||
| 237 | 239 | * other bits might be bogus |
| 238 | 240 | */ |
| 239 | 241 | irq = __fls(irq); |
| 240 | − do_IRQ((int)irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module)); | |
| 242 | + hwirq = irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module); | |
| 243 | + generic_handle_irq(irq_linear_revmap(ltq_domain, hwirq)); | |
| 241 | 244 | |
| 242 | 245 | /* if this is a EBU irq, we need to ack it or get a deadlock */ |
| 243 | 246 | if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT) |
| @@ -245,49 +248,6 @@ static void ltq_hw_irqdispatch(int module) · 1 unmodified line | ||
| 245 | 248 | LTQ_EBU_PCC_ISTAT); |
| 246 | 249 | } |
| 247 | 250 | |
| 248 | −#define DEFINE_HWx_IRQDISPATCH(x) \ | |
| 249 | − static void ltq_hw ## x ## _irqdispatch(void) \ | |
| 250 | − { \ | |
| 251 | − ltq_hw_irqdispatch(x); \ | |
| 252 | − } | |
| 253 | −DEFINE_HWx_IRQDISPATCH(0) | |
| 254 | −DEFINE_HWx_IRQDISPATCH(1) | |
| 255 | −DEFINE_HWx_IRQDISPATCH(2) | |
| 256 | −DEFINE_HWx_IRQDISPATCH(3) | |
| 257 | −DEFINE_HWx_IRQDISPATCH(4) | |
| 258 | − | |
| 259 | −#if MIPS_CPU_TIMER_IRQ == 7 | |
| 260 | −static void ltq_hw5_irqdispatch(void) | |
| 261 | −{ | |
| 262 | − do_IRQ(MIPS_CPU_TIMER_IRQ); | |
| 263 | −} | |
| 264 | −#else | |
| 265 | −DEFINE_HWx_IRQDISPATCH(5) | |
| 266 | −#endif | |
| 267 | − | |
| 268 | −static void ltq_hw_irq_handler(struct irq_desc *desc) | |
| 269 | −{ | |
| 270 | − ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2); | |
| 271 | −} | |
| 272 | − | |
| 273 | −asmlinkage void plat_irq_dispatch(void) | |
| 274 | −{ | |
| 275 | − unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; | |
| 276 | − int irq; | |
| 277 | − | |
| 278 | − if (!pending) { | |
| 279 | − spurious_interrupt(); | |
| 280 | − return; | |
| 281 | − } | |
| 282 | − | |
| 283 | − pending >>= CAUSEB_IP; | |
| 284 | − while (pending) { | |
| 285 | − irq = fls(pending) - 1; | |
| 286 | − do_IRQ(MIPS_CPU_IRQ_BASE + irq); | |
| 287 | − pending &= ~BIT(irq); | |
| 288 | − } | |
| 289 | −} | |
| 290 | − | |
| 291 | 251 | static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) |
| 292 | 252 | { |
| 293 | 253 | struct irq_chip *chip = <q_irq_type; |
| @@ -343,38 +303,13 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) · 49 unmodified lines | ||
| 343 | 303 | for (i = 0; i < MAX_IM; i++) |
| 344 | 304 | irq_set_chained_handler(i + 2, ltq_hw_irq_handler); |
| 345 | 305 | |
| 346 | − if (cpu_has_vint) { | |
| 347 | − pr_info("Setting up vectored interrupts\n"); | |
| 348 | − set_vi_handler(2, ltq_hw0_irqdispatch); | |
| 349 | − set_vi_handler(3, ltq_hw1_irqdispatch); | |
| 350 | − set_vi_handler(4, ltq_hw2_irqdispatch); | |
| 351 | − set_vi_handler(5, ltq_hw3_irqdispatch); | |
| 352 | − set_vi_handler(6, ltq_hw4_irqdispatch); | |
| 353 | − set_vi_handler(7, ltq_hw5_irqdispatch); | |
| 354 | − } | |
| 355 | − | |
| 356 | 306 | ltq_domain = irq_domain_add_linear(node, |
| 357 | 307 | (MAX_IM * INT_NUM_IM_OFFSET) + MIPS_CPU_IRQ_CASCADE, |
| 358 | 308 | &irq_domain_ops, 0); |
| 359 | 309 | |
| 360 | −#ifndef CONFIG_MIPS_MT_SMP | |
| 361 | − set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | | |
| 362 | − IE_IRQ3 | IE_IRQ4 | IE_IRQ5); | |
| 363 | −#else | |
| 364 | − set_c0_status(IE_SW0 | IE_SW1 | IE_IRQ0 | IE_IRQ1 | | |
| 365 | − IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5); | |
| 366 | −#endif | |
| 367 | − | |
| 368 | 310 | /* tell oprofile which irq to use */ |
| 369 | 311 | ltq_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ); |
| 370 | 312 | |
| 371 | − /* | |
| 372 | − * if the timer irq is not one of the mips irqs we need to | |
| 373 | − * create a mapping | |
| 374 | − */ | |
| 375 | − if (MIPS_CPU_TIMER_IRQ != 7) | |
| 376 | − irq_create_mapping(ltq_domain, MIPS_CPU_TIMER_IRQ); | |
| 377 | − | |
| 378 | 313 | /* the external interrupts are optional and xway only */ |
| 379 | 314 | eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway"); |
| 380 | 315 | if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) { |
| @@ -411,7 +346,7 @@ EXPORT_SYMBOL_GPL(get_c0_perfcount_int); · 30 unmodified lines | ||
| 411 | 346 | |
| 412 | 347 | unsigned int get_c0_compare_int(void) |
| 413 | 348 | { |
| 414 | − return MIPS_CPU_TIMER_IRQ; | |
| 349 | + return CP0_LEGACY_COMPARE_IRQ; | |
| 415 | 350 | } |
| 416 | 351 | |
| 417 | 352 | static struct of_device_id __initdata of_irq_ids[] = { |
| @@ -369,7 +369,9 @@ int __init octeon_msi_initialize(void) · 368 unmodified lines | ||
| 369 | 369 | int irq; |
| 370 | 370 | struct irq_chip *msi; |
| 371 | 371 | |
| 372 | − if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_PCIE) { | |
| 372 | + if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_INVALID) { | |
| 373 | + return 0; | |
| 374 | + } else if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_PCIE) { | |
| 373 | 375 | msi_rcv_reg[0] = CVMX_PEXP_NPEI_MSI_RCV0; |
| 374 | 376 | msi_rcv_reg[1] = CVMX_PEXP_NPEI_MSI_RCV1; |
| 375 | 377 | msi_rcv_reg[2] = CVMX_PEXP_NPEI_MSI_RCV2; |
| @@ -3,9 +3,6 @@ OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment -S · 2 unmodified lines | ||
| 3 | 3 | |
| 4 | 4 | KBUILD_DEFCONFIG := defconfig |
| 5 | 5 | |
| 6 | −comma = , | |
| 7 | − | |
| 8 | − | |
| 9 | 6 | ifdef CONFIG_FUNCTION_TRACER |
| 10 | 7 | arch-y += -malways-save-lp -mno-relax |
| 11 | 8 | endif |
| @@ -54,8 +51,6 @@ endif · 42 unmodified lines | ||
| 54 | 51 | boot := arch/nds32/boot |
| 55 | 52 | core-y += $(boot)/dts/ |
| 56 | 53 | |
| 57 | −.PHONY: FORCE | |
| 58 | − | |
| 59 | 54 | Image: vmlinux |
| 60 | 55 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 61 | 56 | |
| @@ -68,9 +63,6 @@ prepare: vdso_prepare · 6 unmodified lines | ||
| 68 | 63 | vdso_prepare: prepare0 |
| 69 | 64 | $(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h |
| 70 | 65 | |
| 71 | −CLEAN_FILES += include/asm-nds32/constants.h* | |
| 72 | − | |
| 73 | −# We use MRPROPER_FILES and CLEAN_FILES now | |
| 74 | 66 | archclean: |
| 75 | 67 | $(Q)$(MAKE) $(clean)=$(boot) |
| 76 | 68 | |
| @@ -20,7 +20,6 @@ · 19 unmodified lines | ||
| 20 | 20 | KBUILD_DEFCONFIG := or1ksim_defconfig |
| 21 | 21 | |
| 22 | 22 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S |
| 23 | −LDFLAGS_vmlinux := | |
| 24 | 23 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
| 25 | 24 | |
| 26 | 25 | KBUILD_CFLAGS += -pipe -ffixed-r10 -D__linux__ |
| @@ -50,5 +49,3 @@ else · 23 unmodified lines | ||
| 50 | 49 | BUILTIN_DTB := n |
| 51 | 50 | endif |
| 52 | 51 | core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/ |
| 53 | − | |
| 54 | −all: vmlinux | |
| @@ -34,6 +34,7 @@ generic-y += qrwlock_types.h · 33 unmodified lines | ||
| 34 | 34 | generic-y += qrwlock.h |
| 35 | 35 | generic-y += sections.h |
| 36 | 36 | generic-y += segment.h |
| 37 | +generic-y += shmparam.h | |
| 37 | 38 | generic-y += string.h |
| 38 | 39 | generic-y += switch_to.h |
| 39 | 40 | generic-y += topology.h |
| @@ -1,5 +1,4 @@ | ||
| 1 | 1 | include include/uapi/asm-generic/Kbuild.asm |
| 2 | 2 | |
| 3 | 3 | generic-y += kvm_para.h |
| 4 | −generic-y += shmparam.h | |
| 5 | 4 | generic-y += ucontext.h |
| @@ -47,6 +47,7 @@ enum perf_event_powerpc_regs { · 46 unmodified lines | ||
| 47 | 47 | PERF_REG_POWERPC_DAR, |
| 48 | 48 | PERF_REG_POWERPC_DSISR, |
| 49 | 49 | PERF_REG_POWERPC_SIER, |
| 50 | + PERF_REG_POWERPC_MMCRA, | |
| 50 | 51 | PERF_REG_POWERPC_MAX, |
| 51 | 52 | }; |
| 52 | 53 | #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */ |
| @@ -852,11 +852,12 @@ start_here: · 851 unmodified lines | ||
| 852 | 852 | |
| 853 | 853 | /* set up the PTE pointers for the Abatron bdiGDB. |
| 854 | 854 | */ |
| 855 | − tovirt(r6,r6) | |
| 856 | 855 | lis r5, abatron_pteptrs@h |
| 857 | 856 | ori r5, r5, abatron_pteptrs@l |
| 858 | 857 | stw r5, 0xf0(0) /* Must match your Abatron config file */ |
| 859 | 858 | tophys(r5,r5) |
| 859 | + lis r6, swapper_pg_dir@h | |
| 860 | + ori r6, r6, swapper_pg_dir@l | |
| 860 | 861 | stw r6, 0(r5) |
| 861 | 862 | |
| 862 | 863 | /* Now turn on the MMU for real! */ |
| @@ -755,11 +755,12 @@ SYSCALL_DEFINE0(rt_sigreturn) · 754 unmodified lines | ||
| 755 | 755 | if (restore_tm_sigcontexts(current, &uc->uc_mcontext, |
| 756 | 756 | &uc_transact->uc_mcontext)) |
| 757 | 757 | goto badframe; |
| 758 | − } | |
| 758 | + } else | |
| 759 | 759 | #endif |
| 760 | − /* Fall through, for non-TM restore */ | |
| 761 | − if (!MSR_TM_ACTIVE(msr)) { | |
| 760 | + { | |
| 762 | 761 | /* |
| 762 | + * Fall through, for non-TM restore | |
| 763 | + * | |
| 763 | 764 | * Unset MSR[TS] on the thread regs since MSR from user |
| 764 | 765 | * context does not have MSR active, and recheckpoint was |
| 765 | 766 | * not called since restore_tm_sigcontexts() was not called |
| @@ -967,13 +967,6 @@ out: · 966 unmodified lines | ||
| 967 | 967 | } |
| 968 | 968 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
| 969 | 969 | |
| 970 | −#if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64) | |
| 971 | −unsigned long __init arch_syscall_addr(int nr) | |
| 972 | −{ | |
| 973 | − return sys_call_table[nr*2]; | |
| 974 | −} | |
| 975 | −#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_PPC64 */ | |
| 976 | − | |
| 977 | 970 | #ifdef PPC64_ELF_ABI_v1 |
| 978 | 971 | char *arch_ftrace_match_adjust(char *str, const char *search) |
| 979 | 972 | { |
| @@ -70,6 +70,7 @@ static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = { · 69 unmodified lines | ||
| 70 | 70 | PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar), |
| 71 | 71 | PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr), |
| 72 | 72 | PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar), |
| 73 | + PT_REGS_OFFSET(PERF_REG_POWERPC_MMCRA, dsisr), | |
| 73 | 74 | }; |
| 74 | 75 | |
| 75 | 76 | u64 perf_reg_value(struct pt_regs *regs, int idx) |
| @@ -83,6 +84,11 @@ u64 perf_reg_value(struct pt_regs *regs, int idx) · 7 unmodified lines | ||
| 83 | 84 | !is_sier_available())) |
| 84 | 85 | return 0; |
| 85 | 86 | |
| 87 | + if (idx == PERF_REG_POWERPC_MMCRA && | |
| 88 | + (IS_ENABLED(CONFIG_FSL_EMB_PERF_EVENT) || | |
| 89 | + IS_ENABLED(CONFIG_PPC32))) | |
| 90 | + return 0; | |
| 91 | + | |
| 86 | 92 | return regs_get_register(regs, pt_regs_offset[idx]); |
| 87 | 93 | } |
| 88 | 94 | |
| @@ -237,12 +237,12 @@ static int ocm_debugfs_show(struct seq_file *m, void *v) · 236 unmodified lines | ||
| 237 | 237 | continue; |
| 238 | 238 | |
| 239 | 239 | seq_printf(m, "PPC4XX OCM : %d\n", ocm->index); |
| 240 | − seq_printf(m, "PhysAddr : %pa[p]\n", &(ocm->phys)); | |
| 240 | + seq_printf(m, "PhysAddr : %pa\n", &(ocm->phys)); | |
| 241 | 241 | seq_printf(m, "MemTotal : %d Bytes\n", ocm->memtotal); |
| 242 | 242 | seq_printf(m, "MemTotal(NC) : %d Bytes\n", ocm->nc.memtotal); |
| 243 | 243 | seq_printf(m, "MemTotal(C) : %d Bytes\n\n", ocm->c.memtotal); |
| 244 | 244 | |
| 245 | − seq_printf(m, "NC.PhysAddr : %pa[p]\n", &(ocm->nc.phys)); | |
| 245 | + seq_printf(m, "NC.PhysAddr : %pa\n", &(ocm->nc.phys)); | |
| 246 | 246 | seq_printf(m, "NC.VirtAddr : 0x%p\n", ocm->nc.virt); |
| 247 | 247 | seq_printf(m, "NC.MemTotal : %d Bytes\n", ocm->nc.memtotal); |
| 248 | 248 | seq_printf(m, "NC.MemFree : %d Bytes\n", ocm->nc.memfree); |
| @@ -252,7 +252,7 @@ static int ocm_debugfs_show(struct seq_file *m, void *v) · 3 unmodified lines | ||
| 252 | 252 | blk->size, blk->owner); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | − seq_printf(m, "\nC.PhysAddr : %pa[p]\n", &(ocm->c.phys)); | |
| 255 | + seq_printf(m, "\nC.PhysAddr : %pa\n", &(ocm->c.phys)); | |
| 256 | 256 | seq_printf(m, "C.VirtAddr : 0x%p\n", ocm->c.virt); |
| 257 | 257 | seq_printf(m, "C.MemTotal : %d Bytes\n", ocm->c.memtotal); |
| 258 | 258 | seq_printf(m, "C.MemFree : %d Bytes\n", ocm->c.memfree); |
| @@ -538,8 +538,7 @@ static void __init chrp_init_IRQ(void) · 537 unmodified lines | ||
| 538 | 538 | /* see if there is a keyboard in the device tree |
| 539 | 539 | with a parent of type "adb" */ |
| 540 | 540 | for_each_node_by_name(kbd, "keyboard") |
| 541 | − if (kbd->parent && kbd->parent->type | |
| 542 | − && strcmp(kbd->parent->type, "adb") == 0) | |
| 541 | + if (of_node_is_type(kbd->parent, "adb")) | |
| 543 | 542 | break; |
| 544 | 543 | of_node_put(kbd); |
| 545 | 544 | if (kbd) |
| @@ -564,7 +564,7 @@ struct iommu_table_group *pnv_try_setup_npu_table_group(struct pnv_ioda_pe *pe) · 563 unmodified lines | ||
| 564 | 564 | } |
| 565 | 565 | } else { |
| 566 | 566 | /* Create a group for 1 GPU and attached NPUs for POWER8 */ |
| 567 | − pe->npucomp = kzalloc(sizeof(pe->npucomp), GFP_KERNEL); | |
| 567 | + pe->npucomp = kzalloc(sizeof(*pe->npucomp), GFP_KERNEL); | |
| 568 | 568 | table_group = &pe->npucomp->table_group; |
| 569 | 569 | table_group->ops = &pnv_npu_peers_ops; |
| 570 | 570 | iommu_register_group(table_group, hose->global_number, |
| @@ -2681,7 +2681,8 @@ static void pnv_pci_ioda_setup_iommu_api(void) · 2680 unmodified lines | ||
| 2681 | 2681 | list_for_each_entry(hose, &hose_list, list_node) { |
| 2682 | 2682 | phb = hose->private_data; |
| 2683 | 2683 | |
| 2684 | − if (phb->type == PNV_PHB_NPU_NVLINK) | |
| 2684 | + if (phb->type == PNV_PHB_NPU_NVLINK || | |
| 2685 | + phb->type == PNV_PHB_NPU_OCAPI) | |
| 2685 | 2686 | continue; |
| 2686 | 2687 | |
| 2687 | 2688 | list_for_each_entry(pe, &phb->ioda.pe_list, list) { |
| @@ -264,7 +264,9 @@ void __init pSeries_final_fixup(void) · 263 unmodified lines | ||
| 264 | 264 | if (!of_device_is_compatible(nvdn->parent, |
| 265 | 265 | "ibm,power9-npu")) |
| 266 | 266 | continue; |
| 267 | +#ifdef CONFIG_PPC_POWERNV | |
| 267 | 268 | WARN_ON_ONCE(pnv_npu2_init(hose)); |
| 269 | +#endif | |
| 268 | 270 | break; |
| 269 | 271 | } |
| 270 | 272 | } |
| @@ -103,7 +103,7 @@ choice · 102 unmodified lines | ||
| 103 | 103 | prompt "Base ISA" |
| 104 | 104 | default ARCH_RV64I |
| 105 | 105 | help |
| 106 | − This selects the base ISA that this kernel will traget and must match | |
| 106 | + This selects the base ISA that this kernel will target and must match | |
| 107 | 107 | the target platform. |
| 108 | 108 | |
| 109 | 109 | config ARCH_RV32I |
| @@ -13,8 +13,6 @@ CONFIG_BLK_DEV_INITRD=y · 12 unmodified lines | ||
| 13 | 13 | CONFIG_EXPERT=y |
| 14 | 14 | CONFIG_BPF_SYSCALL=y |
| 15 | 15 | CONFIG_SMP=y |
| 16 | −CONFIG_PCI=y | |
| 17 | −CONFIG_PCIE_XILINX=y | |
| 18 | 16 | CONFIG_MODULES=y |
| 19 | 17 | CONFIG_MODULE_UNLOAD=y |
| 20 | 18 | CONFIG_NET=y |
| @@ -28,6 +26,10 @@ CONFIG_IP_PNP_DHCP=y · 7 unmodified lines | ||
| 28 | 26 | CONFIG_IP_PNP_BOOTP=y |
| 29 | 27 | CONFIG_IP_PNP_RARP=y |
| 30 | 28 | CONFIG_NETLINK_DIAG=y |
| 29 | +CONFIG_PCI=y | |
| 30 | +CONFIG_PCIEPORTBUS=y | |
| 31 | +CONFIG_PCI_HOST_GENERIC=y | |
| 32 | +CONFIG_PCIE_XILINX=y | |
| 31 | 33 | CONFIG_DEVTMPFS=y |
| 32 | 34 | CONFIG_BLK_DEV_LOOP=y |
| 33 | 35 | CONFIG_VIRTIO_BLK=y |
| @@ -63,7 +65,6 @@ CONFIG_USB_STORAGE=y · 29 unmodified lines | ||
| 63 | 65 | CONFIG_USB_UAS=y |
| 64 | 66 | CONFIG_VIRTIO_MMIO=y |
| 65 | 67 | CONFIG_SIFIVE_PLIC=y |
| 66 | −CONFIG_RAS=y | |
| 67 | 68 | CONFIG_EXT4_FS=y |
| 68 | 69 | CONFIG_EXT4_FS_POSIX_ACL=y |
| 69 | 70 | CONFIG_AUTOFS4_FS=y |
| @@ -77,5 +78,6 @@ CONFIG_NFS_V4_1=y · 7 unmodified lines | ||
| 77 | 78 | CONFIG_NFS_V4_2=y |
| 78 | 79 | CONFIG_ROOT_NFS=y |
| 79 | 80 | CONFIG_CRYPTO_USER_API_HASH=y |
| 81 | +CONFIG_CRYPTO_DEV_VIRTIO=y | |
| 80 | 82 | CONFIG_PRINTK_TIME=y |
| 81 | 83 | # CONFIG_RCU_TRACE is not set |
| @@ -80,7 +80,7 @@ typedef struct page *pgtable_t; · 79 unmodified lines | ||
| 80 | 80 | #define __pgd(x) ((pgd_t) { (x) }) |
| 81 | 81 | #define __pgprot(x) ((pgprot_t) { (x) }) |
| 82 | 82 | |
| 83 | −#ifdef CONFIG_64BITS | |
| 83 | +#ifdef CONFIG_64BIT | |
| 84 | 84 | #define PTE_FMT "%016lx" |
| 85 | 85 | #else |
| 86 | 86 | #define PTE_FMT "%08lx" |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | * This decides where the kernel will search for a free chunk of vm |
| 23 | 23 | * space during mmap's. |
| 24 | 24 | */ |
| 25 | −#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE >> 1) | |
| 25 | +#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) | |
| 26 | 26 | |
| 27 | 27 | #define STACK_TOP TASK_SIZE |
| 28 | 28 | #define STACK_TOP_MAX STACK_TOP |
| @@ -39,6 +39,7 @@ void asm_offsets(void) · 38 unmodified lines | ||
| 39 | 39 | OFFSET(TASK_STACK, task_struct, stack); |
| 40 | 40 | OFFSET(TASK_TI, task_struct, thread_info); |
| 41 | 41 | OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); |
| 42 | + OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count); | |
| 42 | 43 | OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); |
| 43 | 44 | OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp); |
| 44 | 45 | OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu); |
| @@ -144,6 +144,10 @@ _save_context: · 143 unmodified lines | ||
| 144 | 144 | REG_L x2, PT_SP(sp) |
| 145 | 145 | .endm |
| 146 | 146 | |
| 147 | +#if !IS_ENABLED(CONFIG_PREEMPT) | |
| 148 | +.set resume_kernel, restore_all | |
| 149 | +#endif | |
| 150 | + | |
| 147 | 151 | ENTRY(handle_exception) |
| 148 | 152 | SAVE_ALL |
| 149 | 153 | |
| @@ -228,7 +232,7 @@ ret_from_exception: · 78 unmodified lines | ||
| 228 | 232 | REG_L s0, PT_SSTATUS(sp) |
| 229 | 233 | csrc sstatus, SR_SIE |
| 230 | 234 | andi s0, s0, SR_SPP |
| 231 | − bnez s0, restore_all | |
| 235 | + bnez s0, resume_kernel | |
| 232 | 236 | |
| 233 | 237 | resume_userspace: |
| 234 | 238 | /* Interrupts must be disabled here so flags are checked atomically */ |
| @@ -250,6 +254,18 @@ restore_all: · 15 unmodified lines | ||
| 250 | 254 | RESTORE_ALL |
| 251 | 255 | sret |
| 252 | 256 | |
| 257 | +#if IS_ENABLED(CONFIG_PREEMPT) | |
| 258 | +resume_kernel: | |
| 259 | + REG_L s0, TASK_TI_PREEMPT_COUNT(tp) | |
| 260 | + bnez s0, restore_all | |
| 261 | +need_resched: | |
| 262 | + REG_L s0, TASK_TI_FLAGS(tp) | |
| 263 | + andi s0, s0, _TIF_NEED_RESCHED | |
| 264 | + beqz s0, restore_all | |
| 265 | + call preempt_schedule_irq | |
| 266 | + j need_resched | |
| 267 | +#endif | |
| 268 | + | |
| 253 | 269 | work_pending: |
| 254 | 270 | /* Enter slow path for supplementary processing */ |
| 255 | 271 | la ra, ret_from_exception |
| @@ -181,7 +181,7 @@ static void __init setup_bootmem(void) · 180 unmodified lines | ||
| 181 | 181 | BUG_ON(mem_size == 0); |
| 182 | 182 | |
| 183 | 183 | set_max_mapnr(PFN_DOWN(mem_size)); |
| 184 | − max_low_pfn = memblock_end_of_DRAM(); | |
| 184 | + max_low_pfn = PFN_DOWN(memblock_end_of_DRAM()); | |
| 185 | 185 | |
| 186 | 186 | #ifdef CONFIG_BLK_DEV_INITRD |
| 187 | 187 | setup_initrd(); |
| @@ -57,15 +57,12 @@ void __init setup_smp(void) · 56 unmodified lines | ||
| 57 | 57 | |
| 58 | 58 | while ((dn = of_find_node_by_type(dn, "cpu"))) { |
| 59 | 59 | hart = riscv_of_processor_hartid(dn); |
| 60 | − if (hart < 0) { | |
| 61 | − of_node_put(dn); | |
| 60 | + if (hart < 0) | |
| 62 | 61 | continue; |
| 63 | − } | |
| 64 | 62 | |
| 65 | 63 | if (hart == cpuid_to_hartid_map(0)) { |
| 66 | 64 | BUG_ON(found_boot_cpu); |
| 67 | 65 | found_boot_cpu = 1; |
| 68 | − of_node_put(dn); | |
| 69 | 66 | continue; |
| 70 | 67 | } |
| 71 | 68 | |
| @@ -73,7 +70,6 @@ void __init setup_smp(void) · 1 unmodified line | ||
| 73 | 70 | set_cpu_possible(cpuid, true); |
| 74 | 71 | set_cpu_present(cpuid, true); |
| 75 | 72 | cpuid++; |
| 76 | − of_node_put(dn); | |
| 77 | 73 | } |
| 78 | 74 | |
| 79 | 75 | BUG_ON(!found_boot_cpu); |
| @@ -28,7 +28,8 @@ static void __init zone_sizes_init(void) · 27 unmodified lines | ||
| 28 | 28 | unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, }; |
| 29 | 29 | |
| 30 | 30 | #ifdef CONFIG_ZONE_DMA32 |
| 31 | − max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G, max_low_pfn)); | |
| 31 | + max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G, | |
| 32 | + (unsigned long) PFN_PHYS(max_low_pfn))); | |
| 32 | 33 | #endif |
| 33 | 34 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; |
| 34 | 35 | |
| @@ -25,7 +25,7 @@ static inline int init_new_context(struct task_struct *tsk, · 24 unmodified lines | ||
| 25 | 25 | atomic_set(&mm->context.flush_count, 0); |
| 26 | 26 | mm->context.gmap_asce = 0; |
| 27 | 27 | mm->context.flush_mm = 0; |
| 28 | − mm->context.compat_mm = 0; | |
| 28 | + mm->context.compat_mm = test_thread_flag(TIF_31BIT); | |
| 29 | 29 | #ifdef CONFIG_PGSTE |
| 30 | 30 | mm->context.alloc_pgste = page_table_allocate_pgste || |
| 31 | 31 | test_thread_flag(TIF_PGSTE) || |
| @@ -90,8 +90,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · 58 unmodified lines | ||
| 90 | 90 | { |
| 91 | 91 | int cpu = smp_processor_id(); |
| 92 | 92 | |
| 93 | − if (prev == next) | |
| 94 | − return; | |
| 95 | 93 | S390_lowcore.user_asce = next->context.asce; |
| 96 | 94 | cpumask_set_cpu(cpu, &next->context.cpu_attach_mask); |
| 97 | 95 | /* Clear previous user-ASCE from CR1 and CR7 */ |
| @@ -103,7 +101,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, · 5 unmodified lines | ||
| 103 | 101 | __ctl_load(S390_lowcore.vdso_asce, 7, 7); |
| 104 | 102 | clear_cpu_flag(CIF_ASCE_SECONDARY); |
| 105 | 103 | } |
| 106 | − cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); | |
| 104 | + if (prev != next) | |
| 105 | + cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); | |
| 107 | 106 | } |
| 108 | 107 | |
| 109 | 108 | #define finish_arch_post_lock_switch finish_arch_post_lock_switch |
| @@ -63,10 +63,10 @@ static noinline __init void detect_machine_type(void) · 62 unmodified lines | ||
| 63 | 63 | if (stsi(vmms, 3, 2, 2) || !vmms->count) |
| 64 | 64 | return; |
| 65 | 65 | |
| 66 | − /* Running under KVM? If not we assume z/VM */ | |
| 66 | + /* Detect known hypervisors */ | |
| 67 | 67 | if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3)) |
| 68 | 68 | S390_lowcore.machine_flags |= MACHINE_FLAG_KVM; |
| 69 | − else | |
| 69 | + else if (!memcmp(vmms->vm[0].cpi, "\xa9\x61\xe5\xd4", 4)) | |
| 70 | 70 | S390_lowcore.machine_flags |= MACHINE_FLAG_VM; |
| 71 | 71 | } |
| 72 | 72 | |
| @@ -1006,6 +1006,8 @@ void __init setup_arch(char **cmdline_p) · 1005 unmodified lines | ||
| 1006 | 1006 | pr_info("Linux is running under KVM in 64-bit mode\n"); |
| 1007 | 1007 | else if (MACHINE_IS_LPAR) |
| 1008 | 1008 | pr_info("Linux is running natively in 64-bit mode\n"); |
| 1009 | + else | |
| 1010 | + pr_info("Linux is running as a guest in 64-bit mode\n"); | |
| 1009 | 1011 | |
| 1010 | 1012 | /* Have one command line that is parsed and saved in /proc/cmdline */ |
| 1011 | 1013 | /* boot_command_line has been already set up in early.c */ |
| @@ -381,8 +381,13 @@ void smp_call_online_cpu(void (*func)(void *), void *data) · 380 unmodified lines | ||
| 381 | 381 | */ |
| 382 | 382 | void smp_call_ipl_cpu(void (*func)(void *), void *data) |
| 383 | 383 | { |
| 384 | + struct lowcore *lc = pcpu_devices->lowcore; | |
| 385 | + | |
| 386 | + if (pcpu_devices[0].address == stap()) | |
| 387 | + lc = &S390_lowcore; | |
| 388 | + | |
| 384 | 389 | pcpu_delegate(&pcpu_devices[0], func, data, |
| 385 | − pcpu_devices->lowcore->nodat_stack); | |
| 390 | + lc->nodat_stack); | |
| 386 | 391 | } |
| 387 | 392 | |
| 388 | 393 | int smp_find_processor_id(u16 address) |
| @@ -1166,7 +1171,11 @@ static ssize_t __ref rescan_store(struct device *dev, · 777 unmodified lines | ||
| 1166 | 1171 | { |
| 1167 | 1172 | int rc; |
| 1168 | 1173 | |
| 1174 | + rc = lock_device_hotplug_sysfs(); | |
| 1175 | + if (rc) | |
| 1176 | + return rc; | |
| 1169 | 1177 | rc = smp_rescan_cpus(); |
| 1178 | + unlock_device_hotplug(); | |
| 1170 | 1179 | return rc ? rc : count; |
| 1171 | 1180 | } |
| 1172 | 1181 | static DEVICE_ATTR_WO(rescan); |
| @@ -224,10 +224,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) · 223 unmodified lines | ||
| 224 | 224 | |
| 225 | 225 | vdso_pages = vdso64_pages; |
| 226 | 226 | #ifdef CONFIG_COMPAT |
| 227 | − if (is_compat_task()) { | |
| 227 | + mm->context.compat_mm = is_compat_task(); | |
| 228 | + if (mm->context.compat_mm) | |
| 228 | 229 | vdso_pages = vdso32_pages; |
| 229 | − mm->context.compat_mm = 1; | |
| 230 | − } | |
| 231 | 230 | #endif |
| 232 | 231 | /* |
| 233 | 232 | * vDSO has a problem and was disabled, just don't "enable" it for |
| @@ -28,6 +28,7 @@ generic-y += preempt.h · 27 unmodified lines | ||
| 28 | 28 | generic-y += sections.h |
| 29 | 29 | generic-y += segment.h |
| 30 | 30 | generic-y += serial.h |
| 31 | +generic-y += shmparam.h | |
| 31 | 32 | generic-y += sizes.h |
| 32 | 33 | generic-y += syscalls.h |
| 33 | 34 | generic-y += topology.h |
| @@ -1,5 +1,4 @@ | ||
| 1 | 1 | include include/uapi/asm-generic/Kbuild.asm |
| 2 | 2 | |
| 3 | 3 | generic-y += kvm_para.h |
| 4 | −generic-y += shmparam.h | |
| 5 | 4 | generic-y += ucontext.h |
| @@ -198,7 +198,7 @@ config X86 · 197 unmodified lines | ||
| 198 | 198 | select IRQ_FORCED_THREADING |
| 199 | 199 | select NEED_SG_DMA_LENGTH |
| 200 | 200 | select PCI_DOMAINS if PCI |
| 201 | − select PCI_LOCKLESS_CONFIG | |
| 201 | + select PCI_LOCKLESS_CONFIG if PCI | |
| 202 | 202 | select PERF_EVENTS |
| 203 | 203 | select RTC_LIB |
| 204 | 204 | select RTC_MC146818_LIB |
| @@ -446,12 +446,12 @@ config RETPOLINE · 241 unmodified lines | ||
| 446 | 446 | branches. Requires a compiler with -mindirect-branch=thunk-extern |
| 447 | 447 | support for full protection. The kernel may run slower. |
| 448 | 448 | |
| 449 | −config X86_RESCTRL | |
| 450 | − bool "Resource Control support" | |
| 449 | +config X86_CPU_RESCTRL | |
| 450 | + bool "x86 CPU resource control support" | |
| 451 | 451 | depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD) |
| 452 | 452 | select KERNFS |
| 453 | 453 | help |
| 454 | − Enable Resource Control support. | |
| 454 | + Enable x86 CPU resource control support. | |
| 455 | 455 | |
| 456 | 456 | Provide support for the allocation and monitoring of system resources |
| 457 | 457 | usage by the CPU. |
| @@ -617,7 +617,7 @@ config X86_INTEL_QUARK · 159 unmodified lines | ||
| 617 | 617 | |
| 618 | 618 | config X86_INTEL_LPSS |
| 619 | 619 | bool "Intel Low Power Subsystem Support" |
| 620 | − depends on X86 && ACPI | |
| 620 | + depends on X86 && ACPI && PCI | |
| 621 | 621 | select COMMON_CLK |
| 622 | 622 | select PINCTRL |
| 623 | 623 | select IOSF_MBI |
| @@ -600,6 +600,14 @@ ENTRY(trampoline_32bit_src) · 599 unmodified lines | ||
| 600 | 600 | leal TRAMPOLINE_32BIT_PGTABLE_OFFSET(%ecx), %eax |
| 601 | 601 | movl %eax, %cr3 |
| 602 | 602 | 3: |
| 603 | + /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */ | |
| 604 | + pushl %ecx | |
| 605 | + movl $MSR_EFER, %ecx | |
| 606 | + rdmsr | |
| 607 | + btsl $_EFER_LME, %eax | |
| 608 | + wrmsr | |
| 609 | + popl %ecx | |
| 610 | + | |
| 603 | 611 | /* Enable PAE and LA57 (if required) paging modes */ |
| 604 | 612 | movl $X86_CR4_PAE, %eax |
| 605 | 613 | cmpl $0, %edx |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | #define TRAMPOLINE_32BIT_PGTABLE_OFFSET 0 |
| 7 | 7 | |
| 8 | 8 | #define TRAMPOLINE_32BIT_CODE_OFFSET PAGE_SIZE |
| 9 | −#define TRAMPOLINE_32BIT_CODE_SIZE 0x60 | |
| 9 | +#define TRAMPOLINE_32BIT_CODE_SIZE 0x70 | |
| 10 | 10 | |
| 11 | 11 | #define TRAMPOLINE_32BIT_STACK_END TRAMPOLINE_32BIT_SIZE |
| 12 | 12 | |
| @@ -361,7 +361,8 @@ ENTRY(entry_INT80_compat) · 360 unmodified lines | ||
| 361 | 361 | |
| 362 | 362 | /* Need to switch before accessing the thread stack. */ |
| 363 | 363 | SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi |
| 364 | − movq %rsp, %rdi | |
| 364 | + /* In the Xen PV case we already run on the thread stack. */ | |
| 365 | + ALTERNATIVE "movq %rsp, %rdi", "jmp .Lint80_keep_stack", X86_FEATURE_XENPV | |
| 365 | 366 | movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp |
| 366 | 367 | |
| 367 | 368 | pushq 6*8(%rdi) /* regs->ss */ |
| @@ -370,8 +371,9 @@ ENTRY(entry_INT80_compat) · 2 unmodified lines | ||
| 370 | 371 | pushq 3*8(%rdi) /* regs->cs */ |
| 371 | 372 | pushq 2*8(%rdi) /* regs->ip */ |
| 372 | 373 | pushq 1*8(%rdi) /* regs->orig_ax */ |
| 373 | − | |
| 374 | 374 | pushq (%rdi) /* pt_regs->di */ |
| 375 | +.Lint80_keep_stack: | |
| 376 | + | |
| 375 | 377 | pushq %rsi /* pt_regs->si */ |
| 376 | 378 | xorl %esi, %esi /* nospec si */ |
| 377 | 379 | pushq %rdx /* pt_regs->dx */ |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | * "Big Core" Processors (Branded as Core, Xeon, etc...) |
| 7 | 7 | * |
| 8 | 8 | * The "_X" parts are generally the EP and EX Xeons, or the |
| 9 | − * "Extreme" ones, like Broadwell-E. | |
| 9 | + * "Extreme" ones, like Broadwell-E, or Atom microserver. | |
| 10 | 10 | * |
| 11 | 11 | * While adding a new CPUID for a new microarchitecture, add a new |
| 12 | 12 | * group to keep logically sorted out in chronological order. Within |
| @@ -71,6 +71,7 @@ · 58 unmodified lines | ||
| 71 | 71 | #define INTEL_FAM6_ATOM_GOLDMONT 0x5C /* Apollo Lake */ |
| 72 | 72 | #define INTEL_FAM6_ATOM_GOLDMONT_X 0x5F /* Denverton */ |
| 73 | 73 | #define INTEL_FAM6_ATOM_GOLDMONT_PLUS 0x7A /* Gemini Lake */ |
| 74 | +#define INTEL_FAM6_ATOM_TREMONT_X 0x86 /* Jacobsville */ | |
| 74 | 75 | |
| 75 | 76 | /* Xeon Phi */ |
| 76 | 77 | |
| @@ -178,6 +178,10 @@ static inline void switch_ldt(struct mm_struct *prev, struct mm_struct *next) · 177 unmodified lines | ||
| 178 | 178 | |
| 179 | 179 | void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk); |
| 180 | 180 | |
| 181 | +/* | |
| 182 | + * Init a new mm. Used on mm copies, like at fork() | |
| 183 | + * and on mm's that are brand-new, like at execve(). | |
| 184 | + */ | |
| 181 | 185 | static inline int init_new_context(struct task_struct *tsk, |
| 182 | 186 | struct mm_struct *mm) |
| 183 | 187 | { |
| @@ -228,8 +232,22 @@ do { \ · 44 unmodified lines | ||
| 228 | 232 | } while (0) |
| 229 | 233 | #endif |
| 230 | 234 | |
| 235 | +static inline void arch_dup_pkeys(struct mm_struct *oldmm, | |
| 236 | + struct mm_struct *mm) | |
| 237 | +{ | |
| 238 | +#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS | |
| 239 | + if (!cpu_feature_enabled(X86_FEATURE_OSPKE)) | |
| 240 | + return; | |
| 241 | + | |
| 242 | + /* Duplicate the oldmm pkey state in mm: */ | |
| 243 | + mm->context.pkey_allocation_map = oldmm->context.pkey_allocation_map; | |
| 244 | + mm->context.execute_only_pkey = oldmm->context.execute_only_pkey; | |
| 245 | +#endif | |
| 246 | +} | |
| 247 | + | |
| 231 | 248 | static inline int arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) |
| 232 | 249 | { |
| 250 | + arch_dup_pkeys(oldmm, mm); | |
| 233 | 251 | paravirt_arch_dup_mmap(oldmm, mm); |
| 234 | 252 | return ldt_dup_context(oldmm, mm); |
| 235 | 253 | } |
| @@ -7,7 +7,11 @@ · 6 unmodified lines | ||
| 7 | 7 | #endif |
| 8 | 8 | |
| 9 | 9 | #ifdef CONFIG_KASAN |
| 10 | +#ifdef CONFIG_KASAN_EXTRA | |
| 11 | +#define KASAN_STACK_ORDER 2 | |
| 12 | +#else | |
| 10 | 13 | #define KASAN_STACK_ORDER 1 |
| 14 | +#endif | |
| 11 | 15 | #else |
| 12 | 16 | #define KASAN_STACK_ORDER 0 |
| 13 | 17 | #endif |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _ASM_X86_RESCTRL_SCHED_H |
| 3 | 3 | #define _ASM_X86_RESCTRL_SCHED_H |
| 4 | 4 | |
| 5 | −#ifdef CONFIG_X86_RESCTRL | |
| 5 | +#ifdef CONFIG_X86_CPU_RESCTRL | |
| 6 | 6 | |
| 7 | 7 | #include <linux/sched.h> |
| 8 | 8 | #include <linux/jump_label.h> |
| @@ -88,6 +88,6 @@ static inline void resctrl_sched_in(void) · 79 unmodified lines | ||
| 88 | 88 | |
| 89 | 89 | static inline void resctrl_sched_in(void) {} |
| 90 | 90 | |
| 91 | −#endif /* CONFIG_X86_RESCTRL */ | |
| 91 | +#endif /* CONFIG_X86_CPU_RESCTRL */ | |
| 92 | 92 | |
| 93 | 93 | #endif /* _ASM_X86_RESCTRL_SCHED_H */ |
| @@ -711,7 +711,7 @@ static __must_check inline bool user_access_begin(const void __user *ptr, size_t · 710 unmodified lines | ||
| 711 | 711 | { |
| 712 | 712 | if (unlikely(!access_ok(ptr,len))) |
| 713 | 713 | return 0; |
| 714 | − __uaccess_begin(); | |
| 714 | + __uaccess_begin_nospec(); | |
| 715 | 715 | return 1; |
| 716 | 716 | } |
| 717 | 717 | #define user_access_begin(a,b) user_access_begin(a,b) |
| @@ -39,7 +39,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o · 38 unmodified lines | ||
| 39 | 39 | obj-$(CONFIG_X86_MCE) += mce/ |
| 40 | 40 | obj-$(CONFIG_MTRR) += mtrr/ |
| 41 | 41 | obj-$(CONFIG_MICROCODE) += microcode/ |
| 42 | −obj-$(CONFIG_X86_RESCTRL) += resctrl/ | |
| 42 | +obj-$(CONFIG_X86_CPU_RESCTRL) += resctrl/ | |
| 43 | 43 | |
| 44 | 44 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o |
| 45 | 45 | |
| @@ -71,7 +71,7 @@ void __init check_bugs(void) · 70 unmodified lines | ||
| 71 | 71 | * identify_boot_cpu() initialized SMT support information, let the |
| 72 | 72 | * core code know. |
| 73 | 73 | */ |
| 74 | − cpu_smt_check_topology_early(); | |
| 74 | + cpu_smt_check_topology(); | |
| 75 | 75 | |
| 76 | 76 | if (!IS_ENABLED(CONFIG_SMP)) { |
| 77 | 77 | pr_info("CPU: "); |
| @@ -855,7 +855,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) · 854 unmodified lines | ||
| 855 | 855 | if (!p) { |
| 856 | 856 | return ret; |
| 857 | 857 | } else { |
| 858 | − if (boot_cpu_data.microcode == p->patch_id) | |
| 858 | + if (boot_cpu_data.microcode >= p->patch_id) | |
| 859 | 859 | return ret; |
| 860 | 860 | |
| 861 | 861 | ret = UCODE_NEW; |
| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | −obj-$(CONFIG_X86_RESCTRL) += core.o rdtgroup.o monitor.o | |
| 3 | −obj-$(CONFIG_X86_RESCTRL) += ctrlmondata.o pseudo_lock.o | |
| 2 | +obj-$(CONFIG_X86_CPU_RESCTRL) += core.o rdtgroup.o monitor.o | |
| 3 | +obj-$(CONFIG_X86_CPU_RESCTRL) += ctrlmondata.o pseudo_lock.o | |
| 4 | 4 | CFLAGS_pseudo_lock.o = -I$(src) |
| @@ -470,6 +470,7 @@ int crash_load_segments(struct kimage *image) · 469 unmodified lines | ||
| 470 | 470 | |
| 471 | 471 | kbuf.memsz = kbuf.bufsz; |
| 472 | 472 | kbuf.buf_align = ELF_CORE_HEADER_ALIGN; |
| 473 | + kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | |
| 473 | 474 | ret = kexec_add_buffer(&kbuf); |
| 474 | 475 | if (ret) { |
| 475 | 476 | vfree((void *)image->arch.elf_headers); |
| @@ -21,10 +21,6 @@ · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | #define HPET_MASK CLOCKSOURCE_MASK(32) |
| 23 | 23 | |
| 24 | −/* FSEC = 10^-15 | |
| 25 | − NSEC = 10^-9 */ | |
| 26 | −#define FSEC_PER_NSEC 1000000L | |
| 27 | − | |
| 28 | 24 | #define HPET_DEV_USED_BIT 2 |
| 29 | 25 | #define HPET_DEV_USED (1 << HPET_DEV_USED_BIT) |
| 30 | 26 | #define HPET_DEV_VALID 0x8 |
| @@ -167,6 +167,9 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr, · 166 unmodified lines | ||
| 167 | 167 | struct efi_info *current_ei = &boot_params.efi_info; |
| 168 | 168 | struct efi_info *ei = ¶ms->efi_info; |
| 169 | 169 | |
| 170 | + if (!efi_enabled(EFI_RUNTIME_SERVICES)) | |
| 171 | + return 0; | |
| 172 | + | |
| 170 | 173 | if (!current_ei->efi_memmap_size) |
| 171 | 174 | return 0; |
| 172 | 175 | |
| @@ -434,6 +437,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, · 261 unmodified lines | ||
| 434 | 437 | kbuf.memsz = PAGE_ALIGN(header->init_size); |
| 435 | 438 | kbuf.buf_align = header->kernel_alignment; |
| 436 | 439 | kbuf.buf_min = MIN_KERNEL_LOAD_ADDR; |
| 440 | + kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | |
| 437 | 441 | ret = kexec_add_buffer(&kbuf); |
| 438 | 442 | if (ret) |
| 439 | 443 | goto out_free_params; |
| @@ -448,6 +452,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, · 8 unmodified lines | ||
| 448 | 452 | kbuf.bufsz = kbuf.memsz = initrd_len; |
| 449 | 453 | kbuf.buf_align = PAGE_SIZE; |
| 450 | 454 | kbuf.buf_min = MIN_INITRD_LOAD_ADDR; |
| 455 | + kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | |
| 451 | 456 | ret = kexec_add_buffer(&kbuf); |
| 452 | 457 | if (ret) |
| 453 | 458 | goto out_free_params; |
| @@ -457,6 +457,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) · 456 unmodified lines | ||
| 457 | 457 | #else |
| 458 | 458 | u64 ipi_bitmap = 0; |
| 459 | 459 | #endif |
| 460 | + long ret; | |
| 460 | 461 | |
| 461 | 462 | if (cpumask_empty(mask)) |
| 462 | 463 | return; |
| @@ -482,8 +483,9 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) · 19 unmodified lines | ||
| 482 | 483 | } else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) { |
| 483 | 484 | max = apic_id < max ? max : apic_id; |
| 484 | 485 | } else { |
| 485 | − kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | |
| 486 | + ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | |
| 486 | 487 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); |
| 488 | + WARN_ONCE(ret < 0, "KVM: failed to send PV IPI: %ld", ret); | |
| 487 | 489 | min = max = apic_id; |
| 488 | 490 | ipi_bitmap = 0; |
| 489 | 491 | } |
| @@ -491,8 +493,9 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) · 1 unmodified line | ||
| 491 | 493 | } |
| 492 | 494 | |
| 493 | 495 | if (ipi_bitmap) { |
| 494 | − kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | |
| 496 | + ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | |
| 495 | 497 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); |
| 498 | + WARN_ONCE(ret < 0, "KVM: failed to send PV IPI: %ld", ret); | |
| 496 | 499 | } |
| 497 | 500 | |
| 498 | 501 | local_irq_restore(flags); |
| @@ -297,15 +297,16 @@ static int __init tsc_setup(char *str) · 296 unmodified lines | ||
| 297 | 297 | |
| 298 | 298 | __setup("tsc=", tsc_setup); |
| 299 | 299 | |
| 300 | −#define MAX_RETRIES 5 | |
| 301 | −#define SMI_TRESHOLD 50000 | |
| 300 | +#define MAX_RETRIES 5 | |
| 301 | +#define TSC_DEFAULT_THRESHOLD 0x20000 | |
| 302 | 302 | |
| 303 | 303 | /* |
| 304 | − * Read TSC and the reference counters. Take care of SMI disturbance | |
| 304 | + * Read TSC and the reference counters. Take care of any disturbances | |
| 305 | 305 | */ |
| 306 | 306 | static u64 tsc_read_refs(u64 *p, int hpet) |
| 307 | 307 | { |
| 308 | 308 | u64 t1, t2; |
| 309 | + u64 thresh = tsc_khz ? tsc_khz >> 5 : TSC_DEFAULT_THRESHOLD; | |
| 309 | 310 | int i; |
| 310 | 311 | |
| 311 | 312 | for (i = 0; i < MAX_RETRIES; i++) { |
| @@ -315,7 +316,7 @@ static u64 tsc_read_refs(u64 *p, int hpet) · 3 unmodified lines | ||
| 315 | 316 | else |
| 316 | 317 | *p = acpi_pm_read_early(); |
| 317 | 318 | t2 = get_cycles(); |
| 318 | − if ((t2 - t1) < SMI_TRESHOLD) | |
| 319 | + if ((t2 - t1) < thresh) | |
| 319 | 320 | return t2; |
| 320 | 321 | } |
| 321 | 322 | return ULLONG_MAX; |
| @@ -703,15 +704,15 @@ static unsigned long pit_hpet_ptimer_calibrate_cpu(void) · 381 unmodified lines | ||
| 703 | 704 | * zero. In each wait loop iteration we read the TSC and check |
| 704 | 705 | * the delta to the previous read. We keep track of the min |
| 705 | 706 | * and max values of that delta. The delta is mostly defined |
| 706 | − * by the IO time of the PIT access, so we can detect when a | |
| 707 | − * SMI/SMM disturbance happened between the two reads. If the | |
| 707 | + * by the IO time of the PIT access, so we can detect when | |
| 708 | + * any disturbance happened between the two reads. If the | |
| 708 | 709 | * maximum time is significantly larger than the minimum time, |
| 709 | 710 | * then we discard the result and have another try. |
| 710 | 711 | * |
| 711 | 712 | * 2) Reference counter. If available we use the HPET or the |
| 712 | 713 | * PMTIMER as a reference to check the sanity of that value. |
| 713 | 714 | * We use separate TSC readouts and check inside of the |
| 714 | − * reference read for a SMI/SMM disturbance. We dicard | |
| 715 | + * reference read for any possible disturbance. We dicard | |
| 715 | 716 | * disturbed values here as well. We do that around the PIT |
| 716 | 717 | * calibration delay loop as we have to wait for a certain |
| 717 | 718 | * amount of time anyway. |
| @@ -744,7 +745,7 @@ static unsigned long pit_hpet_ptimer_calibrate_cpu(void) · 26 unmodified lines | ||
| 744 | 745 | if (ref1 == ref2) |
| 745 | 746 | continue; |
| 746 | 747 | |
| 747 | − /* Check, whether the sampling was disturbed by an SMI */ | |
| 748 | + /* Check, whether the sampling was disturbed */ | |
| 748 | 749 | if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) |
| 749 | 750 | continue; |
| 750 | 751 | |
| @@ -1268,7 +1269,7 @@ static DECLARE_DELAYED_WORK(tsc_irqwork, tsc_refine_calibration_work); · 517 unmodified lines | ||
| 1268 | 1269 | */ |
| 1269 | 1270 | static void tsc_refine_calibration_work(struct work_struct *work) |
| 1270 | 1271 | { |
| 1271 | − static u64 tsc_start = -1, ref_start; | |
| 1272 | + static u64 tsc_start = ULLONG_MAX, ref_start; | |
| 1272 | 1273 | static int hpet; |
| 1273 | 1274 | u64 tsc_stop, ref_stop, delta; |
| 1274 | 1275 | unsigned long freq; |
| @@ -1283,14 +1284,15 @@ static void tsc_refine_calibration_work(struct work_struct *work) · 8 unmodified lines | ||
| 1283 | 1284 | * delayed the first time we expire. So set the workqueue |
| 1284 | 1285 | * again once we know timers are working. |
| 1285 | 1286 | */ |
| 1286 | − if (tsc_start == -1) { | |
| 1287 | + if (tsc_start == ULLONG_MAX) { | |
| 1288 | +restart: | |
| 1287 | 1289 | /* |
| 1288 | 1290 | * Only set hpet once, to avoid mixing hardware |
| 1289 | 1291 | * if the hpet becomes enabled later. |
| 1290 | 1292 | */ |
| 1291 | 1293 | hpet = is_hpet_enabled(); |
| 1292 | − schedule_delayed_work(&tsc_irqwork, HZ); | |
| 1293 | 1294 | tsc_start = tsc_read_refs(&ref_start, hpet); |
| 1295 | + schedule_delayed_work(&tsc_irqwork, HZ); | |
| 1294 | 1296 | return; |
| 1295 | 1297 | } |
| 1296 | 1298 | |
| @@ -1300,9 +1302,9 @@ static void tsc_refine_calibration_work(struct work_struct *work) · 3 unmodified lines | ||
| 1300 | 1302 | if (ref_start == ref_stop) |
| 1301 | 1303 | goto out; |
| 1302 | 1304 | |
| 1303 | − /* Check, whether the sampling was disturbed by an SMI */ | |
| 1304 | − if (tsc_start == ULLONG_MAX || tsc_stop == ULLONG_MAX) | |
| 1305 | − goto out; | |
| 1305 | + /* Check, whether the sampling was disturbed */ | |
| 1306 | + if (tsc_stop == ULLONG_MAX) | |
| 1307 | + goto restart; | |
| 1306 | 1308 | |
| 1307 | 1309 | delta = tsc_stop - tsc_start; |
| 1308 | 1310 | delta *= 1000000LL; |
| @@ -2,10 +2,6 @@ · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | ccflags-y += -Iarch/x86/kvm |
| 4 | 4 | |
| 5 | −CFLAGS_x86.o := -I. | |
| 6 | −CFLAGS_svm.o := -I. | |
| 7 | −CFLAGS_vmx.o := -I. | |
| 8 | − | |
| 9 | 5 | KVM := ../../../virt/kvm |
| 10 | 6 | |
| 11 | 7 | kvm-y += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \ |
| @@ -1636,7 +1636,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) · 1635 unmodified lines | ||
| 1636 | 1636 | ret = kvm_hvcall_signal_event(vcpu, fast, ingpa); |
| 1637 | 1637 | if (ret != HV_STATUS_INVALID_PORT_ID) |
| 1638 | 1638 | break; |
| 1639 | − /* maybe userspace knows this conn_id: fall through */ | |
| 1639 | + /* fall through - maybe userspace knows this conn_id. */ | |
| 1640 | 1640 | case HVCALL_POST_MESSAGE: |
| 1641 | 1641 | /* don't bother userspace if it has no way to handle it */ |
| 1642 | 1642 | if (unlikely(rep || !vcpu_to_synic(vcpu)->active)) { |
| @@ -1832,7 +1832,6 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, · 189 unmodified lines | ||
| 1832 | 1832 | ent->eax |= HV_X64_MSR_VP_INDEX_AVAILABLE; |
| 1833 | 1833 | ent->eax |= HV_X64_MSR_RESET_AVAILABLE; |
| 1834 | 1834 | ent->eax |= HV_MSR_REFERENCE_TSC_AVAILABLE; |
| 1835 | − ent->eax |= HV_X64_MSR_GUEST_IDLE_AVAILABLE; | |
| 1836 | 1835 | ent->eax |= HV_X64_ACCESS_FREQUENCY_MSRS; |
| 1837 | 1836 | ent->eax |= HV_X64_ACCESS_REENLIGHTENMENT; |
| 1838 | 1837 | |
| @@ -1848,11 +1847,11 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, · 9 unmodified lines | ||
| 1848 | 1847 | case HYPERV_CPUID_ENLIGHTMENT_INFO: |
| 1849 | 1848 | ent->eax |= HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED; |
| 1850 | 1849 | ent->eax |= HV_X64_APIC_ACCESS_RECOMMENDED; |
| 1851 | − ent->eax |= HV_X64_SYSTEM_RESET_RECOMMENDED; | |
| 1852 | 1850 | ent->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED; |
| 1853 | 1851 | ent->eax |= HV_X64_CLUSTER_IPI_RECOMMENDED; |
| 1854 | 1852 | ent->eax |= HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED; |
| 1855 | − ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED; | |
| 1853 | + if (evmcs_ver) | |
| 1854 | + ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED; | |
| 1856 | 1855 | |
| 1857 | 1856 | /* |
| 1858 | 1857 | * Default number of spinlock retry attempts, matches |
| @@ -1035,6 +1035,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, · 1034 unmodified lines | ||
| 1035 | 1035 | switch (delivery_mode) { |
| 1036 | 1036 | case APIC_DM_LOWEST: |
| 1037 | 1037 | vcpu->arch.apic_arb_prio++; |
| 1038 | + /* fall through */ | |
| 1038 | 1039 | case APIC_DM_FIXED: |
| 1039 | 1040 | if (unlikely(trig_mode && !level)) |
| 1040 | 1041 | break; |
| @@ -1874,6 +1875,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) · 833 unmodified lines | ||
| 1874 | 1875 | |
| 1875 | 1876 | case APIC_LVT0: |
| 1876 | 1877 | apic_manage_nmi_watchdog(apic, val); |
| 1878 | + /* fall through */ | |
| 1877 | 1879 | case APIC_LVTTHMR: |
| 1878 | 1880 | case APIC_LVTPC: |
| 1879 | 1881 | case APIC_LVT1: |
| @@ -4371,6 +4371,7 @@ __reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, · 4370 unmodified lines | ||
| 4371 | 4371 | rsvd_bits(maxphyaddr, 51); |
| 4372 | 4372 | rsvd_check->rsvd_bits_mask[1][4] = |
| 4373 | 4373 | rsvd_check->rsvd_bits_mask[0][4]; |
| 4374 | + /* fall through */ | |
| 4374 | 4375 | case PT64_ROOT_4LEVEL: |
| 4375 | 4376 | rsvd_check->rsvd_bits_mask[0][3] = exb_bit_rsvd | |
| 4376 | 4377 | nonleaf_bit8_rsvd | rsvd_bits(7, 7) | |
| @@ -3414,6 +3414,14 @@ static int nested_svm_vmexit(struct vcpu_svm *svm) · 3413 unmodified lines | ||
| 3414 | 3414 | kvm_mmu_reset_context(&svm->vcpu); |
| 3415 | 3415 | kvm_mmu_load(&svm->vcpu); |
| 3416 | 3416 | |
| 3417 | + /* | |
| 3418 | + * Drop what we picked up for L2 via svm_complete_interrupts() so it | |
| 3419 | + * doesn't end up in L1. | |
| 3420 | + */ | |
| 3421 | + svm->vcpu.arch.nmi_injected = false; | |
| 3422 | + kvm_clear_exception_queue(&svm->vcpu); | |
| 3423 | + kvm_clear_interrupt_queue(&svm->vcpu); | |
| 3424 | + | |
| 3417 | 3425 | return 0; |
| 3418 | 3426 | } |
| 3419 | 3427 | |
| @@ -4395,7 +4403,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 975 unmodified lines | ||
| 4395 | 4403 | case MSR_IA32_APICBASE: |
| 4396 | 4404 | if (kvm_vcpu_apicv_active(vcpu)) |
| 4397 | 4405 | avic_update_vapic_bar(to_svm(vcpu), data); |
| 4398 | − /* Follow through */ | |
| 4406 | + /* Fall through */ | |
| 4399 | 4407 | default: |
| 4400 | 4408 | return kvm_set_msr_common(vcpu, msr); |
| 4401 | 4409 | } |
| @@ -4504,28 +4512,19 @@ static int avic_incomplete_ipi_interception(struct vcpu_svm *svm) · 102 unmodified lines | ||
| 4504 | 4512 | kvm_lapic_reg_write(apic, APIC_ICR, icrl); |
| 4505 | 4513 | break; |
| 4506 | 4514 | case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: { |
| 4507 | − int i; | |
| 4508 | − struct kvm_vcpu *vcpu; | |
| 4509 | − struct kvm *kvm = svm->vcpu.kvm; | |
| 4510 | 4515 | struct kvm_lapic *apic = svm->vcpu.arch.apic; |
| 4511 | 4516 | |
| 4512 | 4517 | /* |
| 4513 | − * At this point, we expect that the AVIC HW has already | |
| 4514 | − * set the appropriate IRR bits on the valid target | |
| 4515 | − * vcpus. So, we just need to kick the appropriate vcpu. | |
| 4518 | + * Update ICR high and low, then emulate sending IPI, | |
| 4519 | + * which is handled when writing APIC_ICR. | |
| 4516 | 4520 | */ |
| 4517 | − kvm_for_each_vcpu(i, vcpu, kvm) { | |
| 4518 | − bool m = kvm_apic_match_dest(vcpu, apic, | |
| 4519 | − icrl & KVM_APIC_SHORT_MASK, | |
| 4520 | − GET_APIC_DEST_FIELD(icrh), | |
| 4521 | − icrl & KVM_APIC_DEST_MASK); | |
| 4522 | − | |
| 4523 | − if (m && !avic_vcpu_is_running(vcpu)) | |
| 4524 | − kvm_vcpu_wake_up(vcpu); | |
| 4525 | − } | |
| 4521 | + kvm_lapic_reg_write(apic, APIC_ICR2, icrh); | |
| 4522 | + kvm_lapic_reg_write(apic, APIC_ICR, icrl); | |
| 4526 | 4523 | break; |
| 4527 | 4524 | } |
| 4528 | 4525 | case AVIC_IPI_FAILURE_INVALID_TARGET: |
| 4526 | + WARN_ONCE(1, "Invalid IPI target: index=%u, vcpu=%d, icr=%#0x:%#0x\n", | |
| 4527 | + index, svm->vcpu.vcpu_id, icrh, icrl); | |
| 4529 | 4528 | break; |
| 4530 | 4529 | case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE: |
| 4531 | 4530 | WARN_ONCE(1, "Invalid backing page\n"); |
| @@ -1465,7 +1465,7 @@ TRACE_EVENT(kvm_hv_send_ipi_ex, · 1464 unmodified lines | ||
| 1465 | 1465 | #endif /* _TRACE_KVM_H */ |
| 1466 | 1466 | |
| 1467 | 1467 | #undef TRACE_INCLUDE_PATH |
| 1468 | −#define TRACE_INCLUDE_PATH arch/x86/kvm | |
| 1468 | +#define TRACE_INCLUDE_PATH ../../arch/x86/kvm | |
| 1469 | 1469 | #undef TRACE_INCLUDE_FILE |
| 1470 | 1470 | #define TRACE_INCLUDE_FILE trace |
| 1471 | 1471 | |
| @@ -332,16 +332,17 @@ int nested_enable_evmcs(struct kvm_vcpu *vcpu, · 331 unmodified lines | ||
| 332 | 332 | uint16_t *vmcs_version) |
| 333 | 333 | { |
| 334 | 334 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| 335 | + bool evmcs_already_enabled = vmx->nested.enlightened_vmcs_enabled; | |
| 336 | + | |
| 337 | + vmx->nested.enlightened_vmcs_enabled = true; | |
| 335 | 338 | |
| 336 | 339 | if (vmcs_version) |
| 337 | 340 | *vmcs_version = nested_get_evmcs_version(vcpu); |
| 338 | 341 | |
| 339 | 342 | /* We don't support disabling the feature for simplicity. */ |
| 340 | − if (vmx->nested.enlightened_vmcs_enabled) | |
| 343 | + if (evmcs_already_enabled) | |
| 341 | 344 | return 0; |
| 342 | 345 | |
| 343 | − vmx->nested.enlightened_vmcs_enabled = true; | |
| 344 | − | |
| 345 | 346 | vmx->nested.msrs.pinbased_ctls_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; |
| 346 | 347 | vmx->nested.msrs.entry_ctls_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; |
| 347 | 348 | vmx->nested.msrs.exit_ctls_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; |
| @@ -55,7 +55,7 @@ static u16 shadow_read_write_fields[] = { · 54 unmodified lines | ||
| 55 | 55 | static int max_shadow_read_write_fields = |
| 56 | 56 | ARRAY_SIZE(shadow_read_write_fields); |
| 57 | 57 | |
| 58 | −void init_vmcs_shadow_fields(void) | |
| 58 | +static void init_vmcs_shadow_fields(void) | |
| 59 | 59 | { |
| 60 | 60 | int i, j; |
| 61 | 61 | |
| @@ -211,6 +211,7 @@ static void free_nested(struct kvm_vcpu *vcpu) · 149 unmodified lines | ||
| 211 | 211 | if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon) |
| 212 | 212 | return; |
| 213 | 213 | |
| 214 | + hrtimer_cancel(&vmx->nested.preemption_timer); | |
| 214 | 215 | vmx->nested.vmxon = false; |
| 215 | 216 | vmx->nested.smm.vmxon = false; |
| 216 | 217 | free_vpid(vmx->nested.vpid02); |
| @@ -4140,11 +4141,11 @@ static int enter_vmx_operation(struct kvm_vcpu *vcpu) · 3923 unmodified lines | ||
| 4140 | 4141 | if (r < 0) |
| 4141 | 4142 | goto out_vmcs02; |
| 4142 | 4143 | |
| 4143 | − vmx->nested.cached_vmcs12 = kmalloc(VMCS12_SIZE, GFP_KERNEL); | |
| 4144 | + vmx->nested.cached_vmcs12 = kzalloc(VMCS12_SIZE, GFP_KERNEL); | |
| 4144 | 4145 | if (!vmx->nested.cached_vmcs12) |
| 4145 | 4146 | goto out_cached_vmcs12; |
| 4146 | 4147 | |
| 4147 | − vmx->nested.cached_shadow_vmcs12 = kmalloc(VMCS12_SIZE, GFP_KERNEL); | |
| 4148 | + vmx->nested.cached_shadow_vmcs12 = kzalloc(VMCS12_SIZE, GFP_KERNEL); | |
| 4148 | 4149 | if (!vmx->nested.cached_shadow_vmcs12) |
| 4149 | 4150 | goto out_cached_shadow_vmcs12; |
| 4150 | 4151 | |
| @@ -5263,13 +5264,17 @@ static int vmx_get_nested_state(struct kvm_vcpu *vcpu, · 1112 unmodified lines | ||
| 5263 | 5264 | copy_shadow_to_vmcs12(vmx); |
| 5264 | 5265 | } |
| 5265 | 5266 | |
| 5266 | − if (copy_to_user(user_kvm_nested_state->data, vmcs12, sizeof(*vmcs12))) | |
| 5267 | + /* | |
| 5268 | + * Copy over the full allocated size of vmcs12 rather than just the size | |
| 5269 | + * of the struct. | |
| 5270 | + */ | |
| 5271 | + if (copy_to_user(user_kvm_nested_state->data, vmcs12, VMCS12_SIZE)) | |
| 5267 | 5272 | return -EFAULT; |
| 5268 | 5273 | |
| 5269 | 5274 | if (nested_cpu_has_shadow_vmcs(vmcs12) && |
| 5270 | 5275 | vmcs12->vmcs_link_pointer != -1ull) { |
| 5271 | 5276 | if (copy_to_user(user_kvm_nested_state->data + VMCS12_SIZE, |
| 5272 | − get_shadow_vmcs12(vcpu), sizeof(*vmcs12))) | |
| 5277 | + get_shadow_vmcs12(vcpu), VMCS12_SIZE)) | |
| 5273 | 5278 | return -EFAULT; |
| 5274 | 5279 | } |
| 5275 | 5280 | |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <linux/mod_devicetable.h> |
| 27 | 27 | #include <linux/mm.h> |
| 28 | 28 | #include <linux/sched.h> |
| 29 | +#include <linux/sched/smt.h> | |
| 29 | 30 | #include <linux/slab.h> |
| 30 | 31 | #include <linux/tboot.h> |
| 31 | 32 | #include <linux/trace_events.h> |
| @@ -423,7 +424,7 @@ static void check_ept_pointer_match(struct kvm *kvm) · 391 unmodified lines | ||
| 423 | 424 | to_kvm_vmx(kvm)->ept_pointers_match = EPT_POINTERS_MATCH; |
| 424 | 425 | } |
| 425 | 426 | |
| 426 | −int kvm_fill_hv_flush_list_func(struct hv_guest_mapping_flush_list *flush, | |
| 427 | +static int kvm_fill_hv_flush_list_func(struct hv_guest_mapping_flush_list *flush, | |
| 427 | 428 | void *data) |
| 428 | 429 | { |
| 429 | 430 | struct kvm_tlb_range *range = data; |
| @@ -1773,7 +1774,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 1343 unmodified lines | ||
| 1773 | 1774 | if (!msr_info->host_initiated && |
| 1774 | 1775 | !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP)) |
| 1775 | 1776 | return 1; |
| 1776 | − /* Otherwise falls through */ | |
| 1777 | + /* Else, falls through */ | |
| 1777 | 1778 | default: |
| 1778 | 1779 | msr = find_msr_entry(vmx, msr_info->index); |
| 1779 | 1780 | if (msr) { |
| @@ -2014,7 +2015,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 234 unmodified lines | ||
| 2014 | 2015 | /* Check reserved bit, higher 32 bits should be zero */ |
| 2015 | 2016 | if ((data >> 32) != 0) |
| 2016 | 2017 | return 1; |
| 2017 | − /* Otherwise falls through */ | |
| 2018 | + /* Else, falls through */ | |
| 2018 | 2019 | default: |
| 2019 | 2020 | msr = find_msr_entry(vmx, msr_index); |
| 2020 | 2021 | if (msr) { |
| @@ -2344,7 +2345,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, · 323 unmodified lines | ||
| 2344 | 2345 | case 37: /* AAT100 */ |
| 2345 | 2346 | case 44: /* BC86,AAY89,BD102 */ |
| 2346 | 2347 | case 46: /* BA97 */ |
| 2347 | − _vmexit_control &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; | |
| 2348 | + _vmentry_control &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; | |
| 2348 | 2349 | _vmexit_control &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; |
| 2349 | 2350 | pr_warn_once("kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL " |
| 2350 | 2351 | "does not work properly. Using workaround\n"); |
| @@ -6362,72 +6363,9 @@ static void vmx_update_hv_timer(struct kvm_vcpu *vcpu) · 4011 unmodified lines | ||
| 6362 | 6363 | vmx->loaded_vmcs->hv_timer_armed = false; |
| 6363 | 6364 | } |
| 6364 | 6365 | |
| 6365 | −static void vmx_vcpu_run(struct kvm_vcpu *vcpu) | |
| 6366 | +static void __vmx_vcpu_run(struct kvm_vcpu *vcpu, struct vcpu_vmx *vmx) | |
| 6366 | 6367 | { |
| 6367 | − struct vcpu_vmx *vmx = to_vmx(vcpu); | |
| 6368 | − unsigned long cr3, cr4, evmcs_rsp; | |
| 6369 | − | |
| 6370 | − /* Record the guest's net vcpu time for enforced NMI injections. */ | |
| 6371 | − if (unlikely(!enable_vnmi && | |
| 6372 | − vmx->loaded_vmcs->soft_vnmi_blocked)) | |
| 6373 | − vmx->loaded_vmcs->entry_time = ktime_get(); | |
| 6374 | − | |
| 6375 | − /* Don't enter VMX if guest state is invalid, let the exit handler | |
| 6376 | − start emulation until we arrive back to a valid state */ | |
| 6377 | − if (vmx->emulation_required) | |
| 6378 | − return; | |
| 6379 | − | |
| 6380 | − if (vmx->ple_window_dirty) { | |
| 6381 | − vmx->ple_window_dirty = false; | |
| 6382 | − vmcs_write32(PLE_WINDOW, vmx->ple_window); | |
| 6383 | − } | |
| 6384 | − | |
| 6385 | − if (vmx->nested.need_vmcs12_sync) | |
| 6386 | − nested_sync_from_vmcs12(vcpu); | |
| 6387 | − | |
| 6388 | − if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty)) | |
| 6389 | − vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); | |
| 6390 | − if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) | |
| 6391 | − vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); | |
| 6392 | − | |
| 6393 | − cr3 = __get_current_cr3_fast(); | |
| 6394 | − if (unlikely(cr3 != vmx->loaded_vmcs->host_state.cr3)) { | |
| 6395 | − vmcs_writel(HOST_CR3, cr3); | |
| 6396 | − vmx->loaded_vmcs->host_state.cr3 = cr3; | |
| 6397 | − } | |
| 6398 | − | |
| 6399 | − cr4 = cr4_read_shadow(); | |
| 6400 | − if (unlikely(cr4 != vmx->loaded_vmcs->host_state.cr4)) { | |
| 6401 | − vmcs_writel(HOST_CR4, cr4); | |
| 6402 | − vmx->loaded_vmcs->host_state.cr4 = cr4; | |
| 6403 | − } | |
| 6404 | − | |
| 6405 | − /* When single-stepping over STI and MOV SS, we must clear the | |
| 6406 | − * corresponding interruptibility bits in the guest state. Otherwise | |
| 6407 | − * vmentry fails as it then expects bit 14 (BS) in pending debug | |
| 6408 | − * exceptions being set, but that's not correct for the guest debugging | |
| 6409 | − * case. */ | |
| 6410 | − if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) | |
| 6411 | − vmx_set_interrupt_shadow(vcpu, 0); | |
| 6412 | − | |
| 6413 | − if (static_cpu_has(X86_FEATURE_PKU) && | |
| 6414 | − kvm_read_cr4_bits(vcpu, X86_CR4_PKE) && | |
| 6415 | − vcpu->arch.pkru != vmx->host_pkru) | |
| 6416 | − __write_pkru(vcpu->arch.pkru); | |
| 6417 | − | |
| 6418 | − pt_guest_enter(vmx); | |
| 6419 | − | |
| 6420 | − atomic_switch_perf_msrs(vmx); | |
| 6421 | − | |
| 6422 | − vmx_update_hv_timer(vcpu); | |
| 6423 | − | |
| 6424 | − /* | |
| 6425 | − * If this vCPU has touched SPEC_CTRL, restore the guest's value if | |
| 6426 | − * it's non-zero. Since vmentry is serialising on affected CPUs, there | |
| 6427 | − * is no need to worry about the conditional branch over the wrmsr | |
| 6428 | − * being speculatively taken. | |
| 6429 | − */ | |
| 6430 | − x86_spec_ctrl_set_guest(vmx->spec_ctrl, 0); | |
| 6368 | + unsigned long evmcs_rsp; | |
| 6431 | 6369 | |
| 6432 | 6370 | vmx->__launched = vmx->loaded_vmcs->launched; |
| 6433 | 6371 | |
| @@ -6567,6 +6505,77 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) · 133 unmodified lines | ||
| 6567 | 6505 | , "eax", "ebx", "edi" |
| 6568 | 6506 | #endif |
| 6569 | 6507 | ); |
| 6508 | +} | |
| 6509 | +STACK_FRAME_NON_STANDARD(__vmx_vcpu_run); | |
| 6510 | + | |
| 6511 | +static void vmx_vcpu_run(struct kvm_vcpu *vcpu) | |
| 6512 | +{ | |
| 6513 | + struct vcpu_vmx *vmx = to_vmx(vcpu); | |
| 6514 | + unsigned long cr3, cr4; | |
| 6515 | + | |
| 6516 | + /* Record the guest's net vcpu time for enforced NMI injections. */ | |
| 6517 | + if (unlikely(!enable_vnmi && | |
| 6518 | + vmx->loaded_vmcs->soft_vnmi_blocked)) | |
| 6519 | + vmx->loaded_vmcs->entry_time = ktime_get(); | |
| 6520 | + | |
| 6521 | + /* Don't enter VMX if guest state is invalid, let the exit handler | |
| 6522 | + start emulation until we arrive back to a valid state */ | |
| 6523 | + if (vmx->emulation_required) | |
| 6524 | + return; | |
| 6525 | + | |
| 6526 | + if (vmx->ple_window_dirty) { | |
| 6527 | + vmx->ple_window_dirty = false; | |
| 6528 | + vmcs_write32(PLE_WINDOW, vmx->ple_window); | |
| 6529 | + } | |
| 6530 | + | |
| 6531 | + if (vmx->nested.need_vmcs12_sync) | |
| 6532 | + nested_sync_from_vmcs12(vcpu); | |
| 6533 | + | |
| 6534 | + if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty)) | |
| 6535 | + vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); | |
| 6536 | + if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) | |
| 6537 | + vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); | |
| 6538 | + | |
| 6539 | + cr3 = __get_current_cr3_fast(); | |
| 6540 | + if (unlikely(cr3 != vmx->loaded_vmcs->host_state.cr3)) { | |
| 6541 | + vmcs_writel(HOST_CR3, cr3); | |
| 6542 | + vmx->loaded_vmcs->host_state.cr3 = cr3; | |
| 6543 | + } | |
| 6544 | + | |
| 6545 | + cr4 = cr4_read_shadow(); | |
| 6546 | + if (unlikely(cr4 != vmx->loaded_vmcs->host_state.cr4)) { | |
| 6547 | + vmcs_writel(HOST_CR4, cr4); | |
| 6548 | + vmx->loaded_vmcs->host_state.cr4 = cr4; | |
| 6549 | + } | |
| 6550 | + | |
| 6551 | + /* When single-stepping over STI and MOV SS, we must clear the | |
| 6552 | + * corresponding interruptibility bits in the guest state. Otherwise | |
| 6553 | + * vmentry fails as it then expects bit 14 (BS) in pending debug | |
| 6554 | + * exceptions being set, but that's not correct for the guest debugging | |
| 6555 | + * case. */ | |
| 6556 | + if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) | |
| 6557 | + vmx_set_interrupt_shadow(vcpu, 0); | |
| 6558 | + | |
| 6559 | + if (static_cpu_has(X86_FEATURE_PKU) && | |
| 6560 | + kvm_read_cr4_bits(vcpu, X86_CR4_PKE) && | |
| 6561 | + vcpu->arch.pkru != vmx->host_pkru) | |
| 6562 | + __write_pkru(vcpu->arch.pkru); | |
| 6563 | + | |
| 6564 | + pt_guest_enter(vmx); | |
| 6565 | + | |
| 6566 | + atomic_switch_perf_msrs(vmx); | |
| 6567 | + | |
| 6568 | + vmx_update_hv_timer(vcpu); | |
| 6569 | + | |
| 6570 | + /* | |
| 6571 | + * If this vCPU has touched SPEC_CTRL, restore the guest's value if | |
| 6572 | + * it's non-zero. Since vmentry is serialising on affected CPUs, there | |
| 6573 | + * is no need to worry about the conditional branch over the wrmsr | |
| 6574 | + * being speculatively taken. | |
| 6575 | + */ | |
| 6576 | + x86_spec_ctrl_set_guest(vmx->spec_ctrl, 0); | |
| 6577 | + | |
| 6578 | + __vmx_vcpu_run(vcpu, vmx); | |
| 6570 | 6579 | |
| 6571 | 6580 | /* |
| 6572 | 6581 | * We do not use IBRS in the kernel. If this vCPU has used the |
| @@ -6648,7 +6657,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) · 75 unmodified lines | ||
| 6648 | 6657 | vmx_recover_nmi_blocking(vmx); |
| 6649 | 6658 | vmx_complete_interrupts(vmx); |
| 6650 | 6659 | } |
| 6651 | −STACK_FRAME_NON_STANDARD(vmx_vcpu_run); | |
| 6652 | 6660 | |
| 6653 | 6661 | static struct kvm *vmx_vm_alloc(void) |
| 6654 | 6662 | { |
| @@ -6816,7 +6824,7 @@ static int vmx_vm_init(struct kvm *kvm) · 161 unmodified lines | ||
| 6816 | 6824 | * Warn upon starting the first VM in a potentially |
| 6817 | 6825 | * insecure environment. |
| 6818 | 6826 | */ |
| 6819 | − if (cpu_smt_control == CPU_SMT_ENABLED) | |
| 6827 | + if (sched_smt_active()) | |
| 6820 | 6828 | pr_warn_once(L1TF_MSG_SMT); |
| 6821 | 6829 | if (l1tf_vmx_mitigation == VMENTER_L1D_FLUSH_NEVER) |
| 6822 | 6830 | pr_warn_once(L1TF_MSG_L1D); |
| @@ -3834,6 +3834,8 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, · 3833 unmodified lines | ||
| 3834 | 3834 | case KVM_CAP_HYPERV_SYNIC2: |
| 3835 | 3835 | if (cap->args[0]) |
| 3836 | 3836 | return -EINVAL; |
| 3837 | + /* fall through */ | |
| 3838 | + | |
| 3837 | 3839 | case KVM_CAP_HYPERV_SYNIC: |
| 3838 | 3840 | if (!irqchip_in_kernel(vcpu->kvm)) |
| 3839 | 3841 | return -EINVAL; |
| @@ -5114,6 +5116,13 @@ int kvm_read_guest_virt(struct kvm_vcpu *vcpu, · 1274 unmodified lines | ||
| 5114 | 5116 | { |
| 5115 | 5117 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; |
| 5116 | 5118 | |
| 5119 | + /* | |
| 5120 | + * FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED | |
| 5121 | + * is returned, but our callers are not ready for that and they blindly | |
| 5122 | + * call kvm_inject_page_fault. Ensure that they at least do not leak | |
| 5123 | + * uninitialized kernel stack memory into cr2 and error code. | |
| 5124 | + */ | |
| 5125 | + memset(exception, 0, sizeof(*exception)); | |
| 5117 | 5126 | return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, |
| 5118 | 5127 | exception); |
| 5119 | 5128 | } |
| @@ -6480,8 +6489,7 @@ restart: · 1360 unmodified lines | ||
| 6480 | 6489 | toggle_interruptibility(vcpu, ctxt->interruptibility); |
| 6481 | 6490 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; |
| 6482 | 6491 | kvm_rip_write(vcpu, ctxt->eip); |
| 6483 | − if (r == EMULATE_DONE && | |
| 6484 | − (ctxt->tf || (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP))) | |
| 6492 | + if (r == EMULATE_DONE && ctxt->tf) | |
| 6485 | 6493 | kvm_vcpu_do_singlestep(vcpu, &r); |
| 6486 | 6494 | if (!ctxt->have_exception || |
| 6487 | 6495 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) |
| @@ -7093,10 +7101,10 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) · 605 unmodified lines | ||
| 7093 | 7101 | case KVM_HC_CLOCK_PAIRING: |
| 7094 | 7102 | ret = kvm_pv_clock_pairing(vcpu, a0, a1); |
| 7095 | 7103 | break; |
| 7104 | +#endif | |
| 7096 | 7105 | case KVM_HC_SEND_IPI: |
| 7097 | 7106 | ret = kvm_pv_send_ipi(vcpu->kvm, a0, a1, a2, a3, op_64_bit); |
| 7098 | 7107 | break; |
| 7099 | −#endif | |
| 7100 | 7108 | default: |
| 7101 | 7109 | ret = -KVM_ENOSYS; |
| 7102 | 7110 | break; |
| @@ -7937,6 +7945,7 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu) · 834 unmodified lines | ||
| 7937 | 7945 | vcpu->arch.pv.pv_unhalted = false; |
| 7938 | 7946 | vcpu->arch.mp_state = |
| 7939 | 7947 | KVM_MP_STATE_RUNNABLE; |
| 7948 | + /* fall through */ | |
| 7940 | 7949 | case KVM_MP_STATE_RUNNABLE: |
| 7941 | 7950 | vcpu->arch.apf.halted = false; |
| 7942 | 7951 | break; |
| @@ -2,8 +2,11 @@ · 1 unmodified line | ||
| 2 | 2 | #include <linux/module.h> |
| 3 | 3 | #include <linux/io.h> |
| 4 | 4 | |
| 5 | +#define movs(type,to,from) \ | |
| 6 | + asm volatile("movs" type:"=&D" (to), "=&S" (from):"0" (to), "1" (from):"memory") | |
| 7 | + | |
| 5 | 8 | /* Originally from i386/string.h */ |
| 6 | −static __always_inline void __iomem_memcpy(void *to, const void *from, size_t n) | |
| 9 | +static __always_inline void rep_movs(void *to, const void *from, size_t n) | |
| 7 | 10 | { |
| 8 | 11 | unsigned long d0, d1, d2; |
| 9 | 12 | asm volatile("rep ; movsl\n\t" |
| @@ -21,13 +24,37 @@ static __always_inline void __iomem_memcpy(void *to, const void *from, size_t n) · 11 unmodified lines | ||
| 21 | 24 | |
| 22 | 25 | void memcpy_fromio(void *to, const volatile void __iomem *from, size_t n) |
| 23 | 26 | { |
| 24 | − __iomem_memcpy(to, (const void *)from, n); | |
| 27 | + if (unlikely(!n)) | |
| 28 | + return; | |
| 29 | + | |
| 30 | + /* Align any unaligned source IO */ | |
| 31 | + if (unlikely(1 & (unsigned long)from)) { | |
| 32 | + movs("b", to, from); | |
| 33 | + n--; | |
| 34 | + } | |
| 35 | + if (n > 1 && unlikely(2 & (unsigned long)from)) { | |
| 36 | + movs("w", to, from); | |
| 37 | + n-=2; | |
| 38 | + } | |
| 39 | + rep_movs(to, (const void *)from, n); | |
| 25 | 40 | } |
| 26 | 41 | EXPORT_SYMBOL(memcpy_fromio); |
| 27 | 42 | |
| 28 | 43 | void memcpy_toio(volatile void __iomem *to, const void *from, size_t n) |
| 29 | 44 | { |
| 30 | − __iomem_memcpy((void *)to, (const void *) from, n); | |
| 45 | + if (unlikely(!n)) | |
| 46 | + return; | |
| 47 | + | |
| 48 | + /* Align any unaligned destination IO */ | |
| 49 | + if (unlikely(1 & (unsigned long)to)) { | |
| 50 | + movs("b", to, from); | |
| 51 | + n--; | |
| 52 | + } | |
| 53 | + if (n > 1 && unlikely(2 & (unsigned long)to)) { | |
| 54 | + movs("w", to, from); | |
| 55 | + n-=2; | |
| 56 | + } | |
| 57 | + rep_movs((void *)to, (const void *) from, n); | |
| 31 | 58 | } |
| 32 | 59 | EXPORT_SYMBOL(memcpy_toio); |
| 33 | 60 | |
| @@ -36,8 +36,8 @@ static inline u16 i8254(void) · 35 unmodified lines | ||
| 36 | 36 | u16 status, timer; |
| 37 | 37 | |
| 38 | 38 | do { |
| 39 | − outb(I8254_PORT_CONTROL, | |
| 40 | − I8254_CMD_READBACK | I8254_SELECT_COUNTER0); | |
| 39 | + outb(I8254_CMD_READBACK | I8254_SELECT_COUNTER0, | |
| 40 | + I8254_PORT_CONTROL); | |
| 41 | 41 | status = inb(I8254_PORT_COUNTER0); |
| 42 | 42 | timer = inb(I8254_PORT_COUNTER0); |
| 43 | 43 | timer |= inb(I8254_PORT_COUNTER0) << 8; |
| @@ -595,7 +595,7 @@ static void show_ldttss(const struct desc_ptr *gdt, const char *name, u16 index) · 594 unmodified lines | ||
| 595 | 595 | return; |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | − addr = desc.base0 | (desc.base1 << 16) | (desc.base2 << 24); | |
| 598 | + addr = desc.base0 | (desc.base1 << 16) | ((unsigned long)desc.base2 << 24); | |
| 599 | 599 | #ifdef CONFIG_X86_64 |
| 600 | 600 | addr |= ((u64)desc.base3 << 32); |
| 601 | 601 | #endif |
| @@ -158,8 +158,8 @@ static void __init sme_populate_pgd(struct sme_populate_pgd_data *ppd) · 157 unmodified lines | ||
| 158 | 158 | pmd = pmd_offset(pud, ppd->vaddr); |
| 159 | 159 | if (pmd_none(*pmd)) { |
| 160 | 160 | pte = ppd->pgtable_area; |
| 161 | − memset(pte, 0, sizeof(pte) * PTRS_PER_PTE); | |
| 162 | − ppd->pgtable_area += sizeof(pte) * PTRS_PER_PTE; | |
| 161 | + memset(pte, 0, sizeof(*pte) * PTRS_PER_PTE); | |
| 162 | + ppd->pgtable_area += sizeof(*pte) * PTRS_PER_PTE; | |
| 163 | 163 | set_pmd(pmd, __pmd(PMD_FLAGS | __pa(pte))); |
| 164 | 164 | } |
| 165 | 165 | |
| @@ -898,10 +898,7 @@ static u64 xen_read_msr_safe(unsigned int msr, int *err) · 897 unmodified lines | ||
| 898 | 898 | val = native_read_msr_safe(msr, err); |
| 899 | 899 | switch (msr) { |
| 900 | 900 | case MSR_IA32_APICBASE: |
| 901 | −#ifdef CONFIG_X86_X2APIC | |
| 902 | − if (!(cpuid_ecx(1) & (1 << (X86_FEATURE_X2APIC & 31)))) | |
| 903 | −#endif | |
| 904 | − val &= ~X2APIC_ENABLE; | |
| 901 | + val &= ~X2APIC_ENABLE; | |
| 905 | 902 | break; |
| 906 | 903 | } |
| 907 | 904 | return val; |
| @@ -361,8 +361,6 @@ void xen_timer_resume(void) · 360 unmodified lines | ||
| 361 | 361 | { |
| 362 | 362 | int cpu; |
| 363 | 363 | |
| 364 | − pvclock_resume(); | |
| 365 | − | |
| 366 | 364 | if (xen_clockevent != &xen_vcpuop_clockevent) |
| 367 | 365 | return; |
| 368 | 366 | |
| @@ -379,12 +377,15 @@ static const struct pv_time_ops xen_time_ops __initconst = { · 10 unmodified lines | ||
| 379 | 377 | }; |
| 380 | 378 | |
| 381 | 379 | static struct pvclock_vsyscall_time_info *xen_clock __read_mostly; |
| 380 | +static u64 xen_clock_value_saved; | |
| 382 | 381 | |
| 383 | 382 | void xen_save_time_memory_area(void) |
| 384 | 383 | { |
| 385 | 384 | struct vcpu_register_time_memory_area t; |
| 386 | 385 | int ret; |
| 387 | 386 | |
| 387 | + xen_clock_value_saved = xen_clocksource_read() - xen_sched_clock_offset; | |
| 388 | + | |
| 388 | 389 | if (!xen_clock) |
| 389 | 390 | return; |
| 390 | 391 | |
| @@ -404,7 +405,7 @@ void xen_restore_time_memory_area(void) · 13 unmodified lines | ||
| 404 | 405 | int ret; |
| 405 | 406 | |
| 406 | 407 | if (!xen_clock) |
| 407 | − return; | |
| 408 | + goto out; | |
| 408 | 409 | |
| 409 | 410 | t.addr.v = &xen_clock->pvti; |
| 410 | 411 | |
| @@ -421,6 +422,11 @@ void xen_restore_time_memory_area(void) · 10 unmodified lines | ||
| 421 | 422 | if (ret != 0) |
| 422 | 423 | pr_notice("Cannot restore secondary vcpu_time_info (err %d)", |
| 423 | 424 | ret); |
| 425 | + | |
| 426 | +out: | |
| 427 | + /* Need pvclock_resume() before using xen_clocksource_read(). */ | |
| 428 | + pvclock_resume(); | |
| 429 | + xen_sched_clock_offset = xen_clocksource_read() - xen_clock_value_saved; | |
| 424 | 430 | } |
| 425 | 431 | |
| 426 | 432 | static void xen_setup_vsyscall_time_info(void) |
| @@ -164,7 +164,7 @@ config XTENSA_FAKE_NMI · 163 unmodified lines | ||
| 164 | 164 | If unsure, say N. |
| 165 | 165 | |
| 166 | 166 | config XTENSA_UNALIGNED_USER |
| 167 | − bool "Unaligned memory access in use space" | |
| 167 | + bool "Unaligned memory access in user space" | |
| 168 | 168 | help |
| 169 | 169 | The Xtensa architecture currently does not handle unaligned |
| 170 | 170 | memory accesses in hardware but through an exception handler. |
| @@ -451,7 +451,7 @@ config USE_OF · 280 unmodified lines | ||
| 451 | 451 | help |
| 452 | 452 | Include support for flattened device tree machine descriptions. |
| 453 | 453 | |
| 454 | −config BUILTIN_DTB | |
| 454 | +config BUILTIN_DTB_SOURCE | |
| 455 | 455 | string "DTB to build into the kernel image" |
| 456 | 456 | depends on OF |
| 457 | 457 | |
| @@ -7,9 +7,9 @@ · 6 unmodified lines | ||
| 7 | 7 | # |
| 8 | 8 | # |
| 9 | 9 | |
| 10 | −BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o | |
| 11 | −ifneq ($(CONFIG_BUILTIN_DTB),"") | |
| 12 | −obj-$(CONFIG_OF) += $(BUILTIN_DTB) | |
| 10 | +BUILTIN_DTB_SOURCE := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o | |
| 11 | +ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") | |
| 12 | +obj-$(CONFIG_OF) += $(BUILTIN_DTB_SOURCE) | |
| 13 | 13 | endif |
| 14 | 14 | |
| 15 | 15 | # for CONFIG_OF_ALL_DTBS test |
| @@ -34,7 +34,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y · 33 unmodified lines | ||
| 34 | 34 | CONFIG_CMDLINE_BOOL=y |
| 35 | 35 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" |
| 36 | 36 | CONFIG_USE_OF=y |
| 37 | −CONFIG_BUILTIN_DTB="kc705" | |
| 37 | +CONFIG_BUILTIN_DTB_SOURCE="kc705" | |
| 38 | 38 | # CONFIG_COMPACTION is not set |
| 39 | 39 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 40 | 40 | CONFIG_PM=y |
| @@ -38,7 +38,7 @@ CONFIG_HIGHMEM=y · 37 unmodified lines | ||
| 38 | 38 | # CONFIG_PCI is not set |
| 39 | 39 | CONFIG_XTENSA_PLATFORM_XTFPGA=y |
| 40 | 40 | CONFIG_USE_OF=y |
| 41 | −CONFIG_BUILTIN_DTB="csp" | |
| 41 | +CONFIG_BUILTIN_DTB_SOURCE="csp" | |
| 42 | 42 | # CONFIG_COMPACTION is not set |
| 43 | 43 | CONFIG_XTFPGA_LCD=y |
| 44 | 44 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| @@ -33,7 +33,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y · 32 unmodified lines | ||
| 33 | 33 | CONFIG_CMDLINE_BOOL=y |
| 34 | 34 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" |
| 35 | 35 | CONFIG_USE_OF=y |
| 36 | −CONFIG_BUILTIN_DTB="kc705" | |
| 36 | +CONFIG_BUILTIN_DTB_SOURCE="kc705" | |
| 37 | 37 | # CONFIG_COMPACTION is not set |
| 38 | 38 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 39 | 39 | CONFIG_NET=y |
| @@ -39,7 +39,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y · 38 unmodified lines | ||
| 39 | 39 | CONFIG_CMDLINE_BOOL=y |
| 40 | 40 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=256M@0x60000000" |
| 41 | 41 | CONFIG_USE_OF=y |
| 42 | −CONFIG_BUILTIN_DTB="kc705_nommu" | |
| 42 | +CONFIG_BUILTIN_DTB_SOURCE="kc705_nommu" | |
| 43 | 43 | CONFIG_BINFMT_FLAT=y |
| 44 | 44 | CONFIG_NET=y |
| 45 | 45 | CONFIG_PACKET=y |
| @@ -33,11 +33,12 @@ CONFIG_SMP=y · 32 unmodified lines | ||
| 33 | 33 | CONFIG_HOTPLUG_CPU=y |
| 34 | 34 | # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set |
| 35 | 35 | # CONFIG_PCI is not set |
| 36 | +CONFIG_VECTORS_OFFSET=0x00002000 | |
| 36 | 37 | CONFIG_XTENSA_PLATFORM_XTFPGA=y |
| 37 | 38 | CONFIG_CMDLINE_BOOL=y |
| 38 | 39 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0" |
| 39 | 40 | CONFIG_USE_OF=y |
| 40 | −CONFIG_BUILTIN_DTB="lx200mx" | |
| 41 | +CONFIG_BUILTIN_DTB_SOURCE="lx200mx" | |
| 41 | 42 | # CONFIG_COMPACTION is not set |
| 42 | 43 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 43 | 44 | CONFIG_NET=y |
| @@ -276,12 +276,13 @@ should_never_return: · 275 unmodified lines | ||
| 276 | 276 | |
| 277 | 277 | movi a2, cpu_start_ccount |
| 278 | 278 | 1: |
| 279 | + memw | |
| 279 | 280 | l32i a3, a2, 0 |
| 280 | 281 | beqi a3, 0, 1b |
| 281 | 282 | movi a3, 0 |
| 282 | 283 | s32i a3, a2, 0 |
| 283 | − memw | |
| 284 | 284 | 1: |
| 285 | + memw | |
| 285 | 286 | l32i a3, a2, 0 |
| 286 | 287 | beqi a3, 0, 1b |
| 287 | 288 | wsr a3, ccount |
| @@ -317,11 +318,13 @@ ENTRY(cpu_restart) · 29 unmodified lines | ||
| 317 | 318 | rsr a0, prid |
| 318 | 319 | neg a2, a0 |
| 319 | 320 | movi a3, cpu_start_id |
| 321 | + memw | |
| 320 | 322 | s32i a2, a3, 0 |
| 321 | 323 | #if XCHAL_DCACHE_IS_WRITEBACK |
| 322 | 324 | dhwbi a3, 0 |
| 323 | 325 | #endif |
| 324 | 326 | 1: |
| 327 | + memw | |
| 325 | 328 | l32i a2, a3, 0 |
| 326 | 329 | dhi a3, 0 |
| 327 | 330 | bne a2, a0, 1b |
| @@ -83,7 +83,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) · 82 unmodified lines | ||
| 83 | 83 | { |
| 84 | 84 | unsigned i; |
| 85 | 85 | |
| 86 | − for (i = 0; i < max_cpus; ++i) | |
| 86 | + for_each_possible_cpu(i) | |
| 87 | 87 | set_cpu_present(i, true); |
| 88 | 88 | } |
| 89 | 89 | |
| @@ -96,6 +96,11 @@ void __init smp_init_cpus(void) · 6 unmodified lines | ||
| 96 | 96 | pr_info("%s: Core Count = %d\n", __func__, ncpus); |
| 97 | 97 | pr_info("%s: Core Id = %d\n", __func__, core_id); |
| 98 | 98 | |
| 99 | + if (ncpus > NR_CPUS) { | |
| 100 | + ncpus = NR_CPUS; | |
| 101 | + pr_info("%s: limiting core count by %d\n", __func__, ncpus); | |
| 102 | + } | |
| 103 | + | |
| 99 | 104 | for (i = 0; i < ncpus; ++i) |
| 100 | 105 | set_cpu_possible(i, true); |
| 101 | 106 | } |
| @@ -195,9 +200,11 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) · 93 unmodified lines | ||
| 195 | 200 | int i; |
| 196 | 201 | |
| 197 | 202 | #ifdef CONFIG_HOTPLUG_CPU |
| 198 | − cpu_start_id = cpu; | |
| 199 | − system_flush_invalidate_dcache_range( | |
| 200 | − (unsigned long)&cpu_start_id, sizeof(cpu_start_id)); | |
| 203 | + WRITE_ONCE(cpu_start_id, cpu); | |
| 204 | + /* Pairs with the third memw in the cpu_restart */ | |
| 205 | + mb(); | |
| 206 | + system_flush_invalidate_dcache_range((unsigned long)&cpu_start_id, | |
| 207 | + sizeof(cpu_start_id)); | |
| 201 | 208 | #endif |
| 202 | 209 | smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1); |
| 203 | 210 | |
| @@ -206,18 +213,21 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) · 2 unmodified lines | ||
| 206 | 213 | ccount = get_ccount(); |
| 207 | 214 | while (!ccount); |
| 208 | 215 | |
| 209 | − cpu_start_ccount = ccount; | |
| 216 | + WRITE_ONCE(cpu_start_ccount, ccount); | |
| 210 | 217 | |
| 211 | − while (time_before(jiffies, timeout)) { | |
| 218 | + do { | |
| 219 | + /* | |
| 220 | + * Pairs with the first two memws in the | |
| 221 | + * .Lboot_secondary. | |
| 222 | + */ | |
| 212 | 223 | mb(); |
| 213 | − if (!cpu_start_ccount) | |
| 214 | − break; | |
| 215 | − } | |
| 224 | + ccount = READ_ONCE(cpu_start_ccount); | |
| 225 | + } while (ccount && time_before(jiffies, timeout)); | |
| 216 | 226 | |
| 217 | − if (cpu_start_ccount) { | |
| 227 | + if (ccount) { | |
| 218 | 228 | smp_call_function_single(0, mx_cpu_stop, |
| 219 | − (void *)cpu, 1); | |
| 220 | − cpu_start_ccount = 0; | |
| 229 | + (void *)cpu, 1); | |
| 230 | + WRITE_ONCE(cpu_start_ccount, 0); | |
| 221 | 231 | return -EIO; |
| 222 | 232 | } |
| 223 | 233 | } |
| @@ -237,6 +247,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) · 13 unmodified lines | ||
| 237 | 247 | pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n", |
| 238 | 248 | __func__, cpu, idle, start_info.stack); |
| 239 | 249 | |
| 250 | + init_completion(&cpu_running); | |
| 240 | 251 | ret = boot_secondary(cpu, idle); |
| 241 | 252 | if (ret == 0) { |
| 242 | 253 | wait_for_completion_timeout(&cpu_running, |
| @@ -298,8 +309,10 @@ void __cpu_die(unsigned int cpu) · 55 unmodified lines | ||
| 298 | 309 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
| 299 | 310 | while (time_before(jiffies, timeout)) { |
| 300 | 311 | system_invalidate_dcache_range((unsigned long)&cpu_start_id, |
| 301 | − sizeof(cpu_start_id)); | |
| 302 | − if (cpu_start_id == -cpu) { | |
| 312 | + sizeof(cpu_start_id)); | |
| 313 | + /* Pairs with the second memw in the cpu_restart */ | |
| 314 | + mb(); | |
| 315 | + if (READ_ONCE(cpu_start_id) == -cpu) { | |
| 303 | 316 | platform_cpu_kill(cpu); |
| 304 | 317 | return; |
| 305 | 318 | } |
| @@ -89,7 +89,7 @@ static int ccount_timer_shutdown(struct clock_event_device *evt) · 88 unmodified lines | ||
| 89 | 89 | container_of(evt, struct ccount_timer, evt); |
| 90 | 90 | |
| 91 | 91 | if (timer->irq_enabled) { |
| 92 | − disable_irq(evt->irq); | |
| 92 | + disable_irq_nosync(evt->irq); | |
| 93 | 93 | timer->irq_enabled = 0; |
| 94 | 94 | } |
| 95 | 95 | return 0; |
| @@ -1154,15 +1154,14 @@ static void bfq_activate_requeue_entity(struct bfq_entity *entity, · 1153 unmodified lines | ||
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | 1156 | /** |
| 1157 | − * __bfq_deactivate_entity - deactivate an entity from its service tree. | |
| 1158 | − * @entity: the entity to deactivate. | |
| 1157 | + * __bfq_deactivate_entity - update sched_data and service trees for | |
| 1158 | + * entity, so as to represent entity as inactive | |
| 1159 | + * @entity: the entity being deactivated. | |
| 1159 | 1160 | * @ins_into_idle_tree: if false, the entity will not be put into the |
| 1160 | 1161 | * idle tree. |
| 1161 | 1162 | * |
| 1162 | − * Deactivates an entity, independently of its previous state. Must | |
| 1163 | − * be invoked only if entity is on a service tree. Extracts the entity | |
| 1164 | − * from that tree, and if necessary and allowed, puts it into the idle | |
| 1165 | − * tree. | |
| 1163 | + * If necessary and allowed, puts entity into the idle tree. NOTE: | |
| 1164 | + * entity may be on no tree if in service. | |
| 1166 | 1165 | */ |
| 1167 | 1166 | bool __bfq_deactivate_entity(struct bfq_entity *entity, bool ins_into_idle_tree) |
| 1168 | 1167 | { |
| @@ -462,6 +462,10 @@ static void blk_rq_timed_out_timer(struct timer_list *t) · 461 unmodified lines | ||
| 462 | 462 | kblockd_schedule_work(&q->timeout_work); |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | +static void blk_timeout_work(struct work_struct *work) | |
| 466 | +{ | |
| 467 | +} | |
| 468 | + | |
| 465 | 469 | /** |
| 466 | 470 | * blk_alloc_queue_node - allocate a request queue |
| 467 | 471 | * @gfp_mask: memory allocation flags |
| @@ -505,7 +509,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id) · 37 unmodified lines | ||
| 505 | 509 | timer_setup(&q->backing_dev_info->laptop_mode_wb_timer, |
| 506 | 510 | laptop_mode_timer_fn, 0); |
| 507 | 511 | timer_setup(&q->timeout, blk_rq_timed_out_timer, 0); |
| 508 | − INIT_WORK(&q->timeout_work, NULL); | |
| 512 | + INIT_WORK(&q->timeout_work, blk_timeout_work); | |
| 509 | 513 | INIT_LIST_HEAD(&q->icq_list); |
| 510 | 514 | #ifdef CONFIG_BLK_CGROUP |
| 511 | 515 | INIT_LIST_HEAD(&q->blkg_list); |
| @@ -335,7 +335,7 @@ static void mq_flush_data_end_io(struct request *rq, blk_status_t error) · 334 unmodified lines | ||
| 335 | 335 | blk_flush_complete_seq(rq, fq, REQ_FSEQ_DATA, error); |
| 336 | 336 | spin_unlock_irqrestore(&fq->mq_flush_lock, flags); |
| 337 | 337 | |
| 338 | − blk_mq_run_hw_queue(hctx, true); | |
| 338 | + blk_mq_sched_restart(hctx); | |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
| @@ -1,8 +1,6 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2017 Western Digital Corporation or its affiliates. |
| 4 | − * | |
| 5 | − * This file is released under the GPL. | |
| 6 | 4 | */ |
| 7 | 5 | |
| 8 | 6 | #include <linux/blkdev.h> |
| @@ -308,8 +308,9 @@ static const char *const cmd_flag_name[] = { · 307 unmodified lines | ||
| 308 | 308 | CMD_FLAG_NAME(PREFLUSH), |
| 309 | 309 | CMD_FLAG_NAME(RAHEAD), |
| 310 | 310 | CMD_FLAG_NAME(BACKGROUND), |
| 311 | − CMD_FLAG_NAME(NOUNMAP), | |
| 312 | 311 | CMD_FLAG_NAME(NOWAIT), |
| 312 | + CMD_FLAG_NAME(NOUNMAP), | |
| 313 | + CMD_FLAG_NAME(HIPRI), | |
| 313 | 314 | }; |
| 314 | 315 | #undef CMD_FLAG_NAME |
| 315 | 316 | |
| @@ -1906,7 +1906,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 1905 unmodified lines | ||
| 1906 | 1906 | { |
| 1907 | 1907 | const int is_sync = op_is_sync(bio->bi_opf); |
| 1908 | 1908 | const int is_flush_fua = op_is_flush(bio->bi_opf); |
| 1909 | − struct blk_mq_alloc_data data = { .flags = 0, .cmd_flags = bio->bi_opf }; | |
| 1909 | + struct blk_mq_alloc_data data = { .flags = 0}; | |
| 1910 | 1910 | struct request *rq; |
| 1911 | 1911 | struct blk_plug *plug; |
| 1912 | 1912 | struct request *same_queue_rq = NULL; |
| @@ -1928,6 +1928,7 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) · 15 unmodified lines | ||
| 1928 | 1928 | |
| 1929 | 1929 | rq_qos_throttle(q, bio); |
| 1930 | 1930 | |
| 1931 | + data.cmd_flags = bio->bi_opf; | |
| 1931 | 1932 | rq = blk_mq_get_request(q, bio, &data); |
| 1932 | 1933 | if (unlikely(!rq)) { |
| 1933 | 1934 | rq_qos_cleanup(q, bio); |
| @@ -597,7 +597,7 @@ static void wbt_track(struct rq_qos *rqos, struct request *rq, struct bio *bio) · 596 unmodified lines | ||
| 597 | 597 | rq->wbt_flags |= bio_to_wbt_flags(rwb, bio); |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | −void wbt_issue(struct rq_qos *rqos, struct request *rq) | |
| 600 | +static void wbt_issue(struct rq_qos *rqos, struct request *rq) | |
| 601 | 601 | { |
| 602 | 602 | struct rq_wb *rwb = RQWB(rqos); |
| 603 | 603 | |
| @@ -617,7 +617,7 @@ void wbt_issue(struct rq_qos *rqos, struct request *rq) · 13 unmodified lines | ||
| 617 | 617 | } |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | −void wbt_requeue(struct rq_qos *rqos, struct request *rq) | |
| 620 | +static void wbt_requeue(struct rq_qos *rqos, struct request *rq) | |
| 621 | 621 | { |
| 622 | 622 | struct rq_wb *rwb = RQWB(rqos); |
| 623 | 623 | if (!rwb_enabled(rwb)) |
| @@ -539,6 +539,8 @@ static int adiantum_create(struct crypto_template *tmpl, struct rtattr **tb) · 538 unmodified lines | ||
| 539 | 539 | ictx = skcipher_instance_ctx(inst); |
| 540 | 540 | |
| 541 | 541 | /* Stream cipher, e.g. "xchacha12" */ |
| 542 | + crypto_set_skcipher_spawn(&ictx->streamcipher_spawn, | |
| 543 | + skcipher_crypto_instance(inst)); | |
| 542 | 544 | err = crypto_grab_skcipher(&ictx->streamcipher_spawn, streamcipher_name, |
| 543 | 545 | 0, crypto_requires_sync(algt->type, |
| 544 | 546 | algt->mask)); |
| @@ -547,6 +549,8 @@ static int adiantum_create(struct crypto_template *tmpl, struct rtattr **tb) · 2 unmodified lines | ||
| 547 | 549 | streamcipher_alg = crypto_spawn_skcipher_alg(&ictx->streamcipher_spawn); |
| 548 | 550 | |
| 549 | 551 | /* Block cipher, e.g. "aes" */ |
| 552 | + crypto_set_spawn(&ictx->blockcipher_spawn, | |
| 553 | + skcipher_crypto_instance(inst)); | |
| 550 | 554 | err = crypto_grab_spawn(&ictx->blockcipher_spawn, blockcipher_name, |
| 551 | 555 | CRYPTO_ALG_TYPE_CIPHER, CRYPTO_ALG_TYPE_MASK); |
| 552 | 556 | if (err) |
| @@ -58,14 +58,22 @@ int crypto_authenc_extractkeys(struct crypto_authenc_keys *keys, const u8 *key, · 57 unmodified lines | ||
| 58 | 58 | return -EINVAL; |
| 59 | 59 | if (rta->rta_type != CRYPTO_AUTHENC_KEYA_PARAM) |
| 60 | 60 | return -EINVAL; |
| 61 | − if (RTA_PAYLOAD(rta) < sizeof(*param)) | |
| 61 | + | |
| 62 | + /* | |
| 63 | + * RTA_OK() didn't align the rtattr's payload when validating that it | |
| 64 | + * fits in the buffer. Yet, the keys should start on the next 4-byte | |
| 65 | + * aligned boundary. To avoid confusion, require that the rtattr | |
| 66 | + * payload be exactly the param struct, which has a 4-byte aligned size. | |
| 67 | + */ | |
| 68 | + if (RTA_PAYLOAD(rta) != sizeof(*param)) | |
| 62 | 69 | return -EINVAL; |
| 70 | + BUILD_BUG_ON(sizeof(*param) % RTA_ALIGNTO); | |
| 63 | 71 | |
| 64 | 72 | param = RTA_DATA(rta); |
| 65 | 73 | keys->enckeylen = be32_to_cpu(param->enckeylen); |
| 66 | 74 | |
| 67 | − key += RTA_ALIGN(rta->rta_len); | |
| 68 | − keylen -= RTA_ALIGN(rta->rta_len); | |
| 75 | + key += rta->rta_len; | |
| 76 | + keylen -= rta->rta_len; | |
| 69 | 77 | |
| 70 | 78 | if (keylen < keys->enckeylen) |
| 71 | 79 | return -EINVAL; |
| @@ -279,7 +279,7 @@ static void authenc_esn_verify_ahash_done(struct crypto_async_request *areq, · 278 unmodified lines | ||
| 279 | 279 | struct aead_request *req = areq->data; |
| 280 | 280 | |
| 281 | 281 | err = err ?: crypto_authenc_esn_decrypt_tail(req, 0); |
| 282 | − aead_request_complete(req, err); | |
| 282 | + authenc_esn_request_complete(req, err); | |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | static int crypto_authenc_esn_decrypt(struct aead_request *req) |
| @@ -100,7 +100,7 @@ static void sm3_compress(u32 *w, u32 *wt, u32 *m) · 99 unmodified lines | ||
| 100 | 100 | |
| 101 | 101 | for (i = 0; i <= 63; i++) { |
| 102 | 102 | |
| 103 | − ss1 = rol32((rol32(a, 12) + e + rol32(t(i), i)), 7); | |
| 103 | + ss1 = rol32((rol32(a, 12) + e + rol32(t(i), i & 31)), 7); | |
| 104 | 104 | |
| 105 | 105 | ss2 = ss1 ^ rol32(a, 12); |
| 106 | 106 | |
| @@ -41,7 +41,8 @@ acpi-y += ec.o · 40 unmodified lines | ||
| 41 | 41 | acpi-$(CONFIG_ACPI_DOCK) += dock.o |
| 42 | 42 | acpi-$(CONFIG_PCI) += pci_root.o pci_link.o pci_irq.o |
| 43 | 43 | obj-$(CONFIG_ACPI_MCFG) += pci_mcfg.o |
| 44 | −acpi-y += acpi_lpss.o acpi_apd.o | |
| 44 | +acpi-$(CONFIG_PCI) += acpi_lpss.o | |
| 45 | +acpi-y += acpi_apd.o | |
| 45 | 46 | acpi-y += acpi_platform.o |
| 46 | 47 | acpi-y += acpi_pnp.o |
| 47 | 48 | acpi-$(CONFIG_ARM_AMBA) += acpi_amba.o |
| @@ -1054,18 +1054,6 @@ void __init acpi_early_init(void) · 1053 unmodified lines | ||
| 1054 | 1054 | goto error0; |
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | − /* | |
| 1058 | − * ACPI 2.0 requires the EC driver to be loaded and work before | |
| 1059 | − * the EC device is found in the namespace (i.e. before | |
| 1060 | − * acpi_load_tables() is called). | |
| 1061 | − * | |
| 1062 | − * This is accomplished by looking for the ECDT table, and getting | |
| 1063 | − * the EC parameters out of that. | |
| 1064 | − * | |
| 1065 | − * Ignore the result. Not having an ECDT is not fatal. | |
| 1066 | − */ | |
| 1067 | − status = acpi_ec_ecdt_probe(); | |
| 1068 | − | |
| 1069 | 1057 | #ifdef CONFIG_X86 |
| 1070 | 1058 | if (!acpi_ioapic) { |
| 1071 | 1059 | /* compatible (0) means level (3) */ |
| @@ -1142,6 +1130,18 @@ static int __init acpi_bus_init(void) · 70 unmodified lines | ||
| 1142 | 1130 | goto error1; |
| 1143 | 1131 | } |
| 1144 | 1132 | |
| 1133 | + /* | |
| 1134 | + * ACPI 2.0 requires the EC driver to be loaded and work before the EC | |
| 1135 | + * device is found in the namespace. | |
| 1136 | + * | |
| 1137 | + * This is accomplished by looking for the ECDT table and getting the EC | |
| 1138 | + * parameters out of that. | |
| 1139 | + * | |
| 1140 | + * Do that before calling acpi_initialize_objects() which may trigger EC | |
| 1141 | + * address space accesses. | |
| 1142 | + */ | |
| 1143 | + acpi_ec_ecdt_probe(); | |
| 1144 | + | |
| 1145 | 1145 | status = acpi_enable_subsystem(ACPI_NO_ACPI_ENABLE); |
| 1146 | 1146 | if (ACPI_FAILURE(status)) { |
| 1147 | 1147 | printk(KERN_ERR PREFIX |
| @@ -81,7 +81,11 @@ void acpi_debugfs_init(void); · 80 unmodified lines | ||
| 81 | 81 | #else |
| 82 | 82 | static inline void acpi_debugfs_init(void) { return; } |
| 83 | 83 | #endif |
| 84 | +#ifdef CONFIG_PCI | |
| 84 | 85 | void acpi_lpss_init(void); |
| 86 | +#else | |
| 87 | +static inline void acpi_lpss_init(void) {} | |
| 88 | +#endif | |
| 85 | 89 | |
| 86 | 90 | void acpi_apd_init(void); |
| 87 | 91 | |
| @@ -26,7 +26,6 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <acpi/nfit.h> |
| 27 | 27 | #include "intel.h" |
| 28 | 28 | #include "nfit.h" |
| 29 | −#include "intel.h" | |
| 30 | 29 | |
| 31 | 30 | /* |
| 32 | 31 | * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is |
| @@ -78,12 +77,6 @@ const guid_t *to_nfit_uuid(enum nfit_uuids id) · 45 unmodified lines | ||
| 78 | 77 | } |
| 79 | 78 | EXPORT_SYMBOL(to_nfit_uuid); |
| 80 | 79 | |
| 81 | −static struct acpi_nfit_desc *to_acpi_nfit_desc( | |
| 82 | − struct nvdimm_bus_descriptor *nd_desc) | |
| 83 | −{ | |
| 84 | − return container_of(nd_desc, struct acpi_nfit_desc, nd_desc); | |
| 85 | −} | |
| 86 | − | |
| 87 | 80 | static struct acpi_device *to_acpi_dev(struct acpi_nfit_desc *acpi_desc) |
| 88 | 81 | { |
| 89 | 82 | struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; |
| @@ -416,10 +409,36 @@ static bool payload_dumpable(struct nvdimm *nvdimm, unsigned int func) · 326 unmodified lines | ||
| 416 | 409 | return true; |
| 417 | 410 | } |
| 418 | 411 | |
| 412 | +static int cmd_to_func(struct nfit_mem *nfit_mem, unsigned int cmd, | |
| 413 | + struct nd_cmd_pkg *call_pkg) | |
| 414 | +{ | |
| 415 | + if (call_pkg) { | |
| 416 | + int i; | |
| 417 | + | |
| 418 | + if (nfit_mem->family != call_pkg->nd_family) | |
| 419 | + return -ENOTTY; | |
| 420 | + | |
| 421 | + for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++) | |
| 422 | + if (call_pkg->nd_reserved2[i]) | |
| 423 | + return -EINVAL; | |
| 424 | + return call_pkg->nd_command; | |
| 425 | + } | |
| 426 | + | |
| 427 | + /* Linux ND commands == NVDIMM_FAMILY_INTEL function numbers */ | |
| 428 | + if (nfit_mem->family == NVDIMM_FAMILY_INTEL) | |
| 429 | + return cmd; | |
| 430 | + | |
| 431 | + /* | |
| 432 | + * Force function number validation to fail since 0 is never | |
| 433 | + * published as a valid function in dsm_mask. | |
| 434 | + */ | |
| 435 | + return 0; | |
| 436 | +} | |
| 437 | + | |
| 419 | 438 | int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, |
| 420 | 439 | unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc) |
| 421 | 440 | { |
| 422 | − struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | |
| 441 | + struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); | |
| 423 | 442 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); |
| 424 | 443 | union acpi_object in_obj, in_buf, *out_obj; |
| 425 | 444 | const struct nd_cmd_desc *desc = NULL; |
| @@ -429,30 +448,23 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, · 3 unmodified lines | ||
| 429 | 448 | unsigned long cmd_mask, dsm_mask; |
| 430 | 449 | u32 offset, fw_status = 0; |
| 431 | 450 | acpi_handle handle; |
| 432 | − unsigned int func; | |
| 433 | 451 | const guid_t *guid; |
| 434 | − int rc, i; | |
| 452 | + int func, rc, i; | |
| 435 | 453 | |
| 436 | 454 | if (cmd_rc) |
| 437 | 455 | *cmd_rc = -EINVAL; |
| 438 | − func = cmd; | |
| 439 | − if (cmd == ND_CMD_CALL) { | |
| 440 | − call_pkg = buf; | |
| 441 | − func = call_pkg->nd_command; | |
| 442 | − | |
| 443 | − for (i = 0; i < ARRAY_SIZE(call_pkg->nd_reserved2); i++) | |
| 444 | − if (call_pkg->nd_reserved2[i]) | |
| 445 | − return -EINVAL; | |
| 446 | − } | |
| 447 | 456 | |
| 448 | 457 | if (nvdimm) { |
| 449 | 458 | struct acpi_device *adev = nfit_mem->adev; |
| 450 | 459 | |
| 451 | 460 | if (!adev) |
| 452 | 461 | return -ENOTTY; |
| 453 | − if (call_pkg && nfit_mem->family != call_pkg->nd_family) | |
| 454 | − return -ENOTTY; | |
| 455 | 462 | |
| 463 | + if (cmd == ND_CMD_CALL) | |
| 464 | + call_pkg = buf; | |
| 465 | + func = cmd_to_func(nfit_mem, cmd, call_pkg); | |
| 466 | + if (func < 0) | |
| 467 | + return func; | |
| 456 | 468 | dimm_name = nvdimm_name(nvdimm); |
| 457 | 469 | cmd_name = nvdimm_cmd_name(cmd); |
| 458 | 470 | cmd_mask = nvdimm_cmd_mask(nvdimm); |
| @@ -463,6 +475,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, · 4 unmodified lines | ||
| 463 | 475 | } else { |
| 464 | 476 | struct acpi_device *adev = to_acpi_dev(acpi_desc); |
| 465 | 477 | |
| 478 | + func = cmd; | |
| 466 | 479 | cmd_name = nvdimm_bus_cmd_name(cmd); |
| 467 | 480 | cmd_mask = nd_desc->cmd_mask; |
| 468 | 481 | dsm_mask = cmd_mask; |
| @@ -477,7 +490,13 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, · 8 unmodified lines | ||
| 477 | 490 | if (!desc || (cmd && (desc->out_num + desc->in_num == 0))) |
| 478 | 491 | return -ENOTTY; |
| 479 | 492 | |
| 480 | − if (!test_bit(cmd, &cmd_mask) || !test_bit(func, &dsm_mask)) | |
| 493 | + /* | |
| 494 | + * Check for a valid command. For ND_CMD_CALL, we also have to | |
| 495 | + * make sure that the DSM function is supported. | |
| 496 | + */ | |
| 497 | + if (cmd == ND_CMD_CALL && !test_bit(func, &dsm_mask)) | |
| 498 | + return -ENOTTY; | |
| 499 | + else if (!test_bit(cmd, &cmd_mask)) | |
| 481 | 500 | return -ENOTTY; |
| 482 | 501 | |
| 483 | 502 | in_obj.type = ACPI_TYPE_PACKAGE; |
| @@ -721,6 +740,7 @@ int nfit_get_smbios_id(u32 device_handle, u16 *flags) · 237 unmodified lines | ||
| 721 | 740 | struct acpi_nfit_memory_map *memdev; |
| 722 | 741 | struct acpi_nfit_desc *acpi_desc; |
| 723 | 742 | struct nfit_mem *nfit_mem; |
| 743 | + u16 physical_id; | |
| 724 | 744 | |
| 725 | 745 | mutex_lock(&acpi_desc_lock); |
| 726 | 746 | list_for_each_entry(acpi_desc, &acpi_descs, list) { |
| @@ -728,10 +748,11 @@ int nfit_get_smbios_id(u32 device_handle, u16 *flags) · 1 unmodified line | ||
| 728 | 748 | list_for_each_entry(nfit_mem, &acpi_desc->dimms, list) { |
| 729 | 749 | memdev = __to_nfit_memdev(nfit_mem); |
| 730 | 750 | if (memdev->device_handle == device_handle) { |
| 751 | + *flags = memdev->flags; | |
| 752 | + physical_id = memdev->physical_id; | |
| 731 | 753 | mutex_unlock(&acpi_desc->init_mutex); |
| 732 | 754 | mutex_unlock(&acpi_desc_lock); |
| 733 | − *flags = memdev->flags; | |
| 734 | − return memdev->physical_id; | |
| 755 | + return physical_id; | |
| 735 | 756 | } |
| 736 | 757 | } |
| 737 | 758 | mutex_unlock(&acpi_desc->init_mutex); |
| @@ -1872,6 +1893,13 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc, · 1134 unmodified lines | ||
| 1872 | 1893 | return 0; |
| 1873 | 1894 | } |
| 1874 | 1895 | |
| 1896 | + /* | |
| 1897 | + * Function 0 is the command interrogation function, don't | |
| 1898 | + * export it to potential userspace use, and enable it to be | |
| 1899 | + * used as an error value in acpi_nfit_ctl(). | |
| 1900 | + */ | |
| 1901 | + dsm_mask &= ~1UL; | |
| 1902 | + | |
| 1875 | 1903 | guid = to_nfit_uuid(nfit_mem->family); |
| 1876 | 1904 | for_each_set_bit(i, &dsm_mask, BITS_PER_LONG) |
| 1877 | 1905 | if (acpi_check_dsm(adev_dimm->handle, guid, |
| @@ -2047,11 +2075,6 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) · 169 unmodified lines | ||
| 2047 | 2075 | if (!nvdimm) |
| 2048 | 2076 | continue; |
| 2049 | 2077 | |
| 2050 | − rc = nvdimm_security_setup_events(nvdimm); | |
| 2051 | − if (rc < 0) | |
| 2052 | − dev_warn(acpi_desc->dev, | |
| 2053 | − "security event setup failed: %d\n", rc); | |
| 2054 | − | |
| 2055 | 2078 | nfit_kernfs = sysfs_get_dirent(nvdimm_kobj(nvdimm)->sd, "nfit"); |
| 2056 | 2079 | if (nfit_kernfs) |
| 2057 | 2080 | nfit_mem->flags_attr = sysfs_get_dirent(nfit_kernfs, |
| @@ -2231,7 +2254,6 @@ static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc, · 173 unmodified lines | ||
| 2231 | 2254 | nd_set = devm_kzalloc(dev, sizeof(*nd_set), GFP_KERNEL); |
| 2232 | 2255 | if (!nd_set) |
| 2233 | 2256 | return -ENOMEM; |
| 2234 | − ndr_desc->nd_set = nd_set; | |
| 2235 | 2257 | guid_copy(&nd_set->type_guid, (guid_t *) spa->range_guid); |
| 2236 | 2258 | |
| 2237 | 2259 | info = devm_kzalloc(dev, sizeof_nfit_set_info(nr), GFP_KERNEL); |
| @@ -3367,7 +3389,7 @@ EXPORT_SYMBOL_GPL(acpi_nfit_init); · 1129 unmodified lines | ||
| 3367 | 3389 | |
| 3368 | 3390 | static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) |
| 3369 | 3391 | { |
| 3370 | − struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | |
| 3392 | + struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); | |
| 3371 | 3393 | struct device *dev = acpi_desc->dev; |
| 3372 | 3394 | |
| 3373 | 3395 | /* Bounce the device lock to flush acpi_nfit_add / acpi_nfit_notify */ |
| @@ -3384,7 +3406,7 @@ static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc) · 10 unmodified lines | ||
| 3384 | 3406 | static int __acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, |
| 3385 | 3407 | struct nvdimm *nvdimm, unsigned int cmd) |
| 3386 | 3408 | { |
| 3387 | − struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | |
| 3409 | + struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc); | |
| 3388 | 3410 | |
| 3389 | 3411 | if (nvdimm) |
| 3390 | 3412 | return 0; |
| @@ -146,7 +146,7 @@ static int intel_security_change_key(struct nvdimm *nvdimm, · 145 unmodified lines | ||
| 146 | 146 | |
| 147 | 147 | static void nvdimm_invalidate_cache(void); |
| 148 | 148 | |
| 149 | −static int intel_security_unlock(struct nvdimm *nvdimm, | |
| 149 | +static int __maybe_unused intel_security_unlock(struct nvdimm *nvdimm, | |
| 150 | 150 | const struct nvdimm_key_data *key_data) |
| 151 | 151 | { |
| 152 | 152 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); |
| @@ -227,7 +227,7 @@ static int intel_security_disable(struct nvdimm *nvdimm, · 74 unmodified lines | ||
| 227 | 227 | return 0; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | −static int intel_security_erase(struct nvdimm *nvdimm, | |
| 230 | +static int __maybe_unused intel_security_erase(struct nvdimm *nvdimm, | |
| 231 | 231 | const struct nvdimm_key_data *key, |
| 232 | 232 | enum nvdimm_passphrase_type ptype) |
| 233 | 233 | { |
| @@ -276,7 +276,7 @@ static int intel_security_erase(struct nvdimm *nvdimm, · 42 unmodified lines | ||
| 276 | 276 | return 0; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | −static int intel_security_query_overwrite(struct nvdimm *nvdimm) | |
| 279 | +static int __maybe_unused intel_security_query_overwrite(struct nvdimm *nvdimm) | |
| 280 | 280 | { |
| 281 | 281 | int rc; |
| 282 | 282 | struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm); |
| @@ -313,7 +313,7 @@ static int intel_security_query_overwrite(struct nvdimm *nvdimm) · 30 unmodified lines | ||
| 313 | 313 | return 0; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | −static int intel_security_overwrite(struct nvdimm *nvdimm, | |
| 316 | +static int __maybe_unused intel_security_overwrite(struct nvdimm *nvdimm, | |
| 317 | 317 | const struct nvdimm_key_data *nkey) |
| 318 | 318 | { |
| 319 | 319 | int rc; |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/kdev_t.h> |
| 12 | 12 | #include <linux/kernel.h> |
| 13 | 13 | #include <linux/list.h> |
| 14 | +#include <linux/namei.h> | |
| 14 | 15 | #include <linux/magic.h> |
| 15 | 16 | #include <linux/major.h> |
| 16 | 17 | #include <linux/miscdevice.h> |
| @@ -20,6 +21,7 @@ · 3 unmodified lines | ||
| 20 | 21 | #include <linux/parser.h> |
| 21 | 22 | #include <linux/radix-tree.h> |
| 22 | 23 | #include <linux/sched.h> |
| 24 | +#include <linux/seq_file.h> | |
| 23 | 25 | #include <linux/slab.h> |
| 24 | 26 | #include <linux/spinlock_types.h> |
| 25 | 27 | #include <linux/stddef.h> |
| @@ -30,7 +32,7 @@ · 4 unmodified lines | ||
| 30 | 32 | #include <linux/xarray.h> |
| 31 | 33 | #include <uapi/asm-generic/errno-base.h> |
| 32 | 34 | #include <uapi/linux/android/binder.h> |
| 33 | −#include <uapi/linux/android/binder_ctl.h> | |
| 35 | +#include <uapi/linux/android/binderfs.h> | |
| 34 | 36 | |
| 35 | 37 | #include "binder_internal.h" |
| 36 | 38 | |
| @@ -39,13 +41,31 @@ · 2 unmodified lines | ||
| 39 | 41 | #define INODE_OFFSET 3 |
| 40 | 42 | #define INTSTRLEN 21 |
| 41 | 43 | #define BINDERFS_MAX_MINOR (1U << MINORBITS) |
| 42 | − | |
| 43 | −static struct vfsmount *binderfs_mnt; | |
| 44 | +/* Ensure that the initial ipc namespace always has devices available. */ | |
| 45 | +#define BINDERFS_MAX_MINOR_CAPPED (BINDERFS_MAX_MINOR - 4) | |
| 44 | 46 | |
| 45 | 47 | static dev_t binderfs_dev; |
| 46 | 48 | static DEFINE_MUTEX(binderfs_minors_mutex); |
| 47 | 49 | static DEFINE_IDA(binderfs_minors); |
| 48 | 50 | |
| 51 | +/** | |
| 52 | + * binderfs_mount_opts - mount options for binderfs | |
| 53 | + * @max: maximum number of allocatable binderfs binder devices | |
| 54 | + */ | |
| 55 | +struct binderfs_mount_opts { | |
| 56 | + int max; | |
| 57 | +}; | |
| 58 | + | |
| 59 | +enum { | |
| 60 | + Opt_max, | |
| 61 | + Opt_err | |
| 62 | +}; | |
| 63 | + | |
| 64 | +static const match_table_t tokens = { | |
| 65 | + { Opt_max, "max=%d" }, | |
| 66 | + { Opt_err, NULL } | |
| 67 | +}; | |
| 68 | + | |
| 49 | 69 | /** |
| 50 | 70 | * binderfs_info - information about a binderfs mount |
| 51 | 71 | * @ipc_ns: The ipc namespace the binderfs mount belongs to. |
| @@ -55,13 +75,16 @@ static DEFINE_IDA(binderfs_minors); · 3 unmodified lines | ||
| 55 | 75 | * created. |
| 56 | 76 | * @root_gid: gid that needs to be used when a new binder device is |
| 57 | 77 | * created. |
| 78 | + * @mount_opts: The mount options in use. | |
| 79 | + * @device_count: The current number of allocated binder devices. | |
| 58 | 80 | */ |
| 59 | 81 | struct binderfs_info { |
| 60 | 82 | struct ipc_namespace *ipc_ns; |
| 61 | 83 | struct dentry *control_dentry; |
| 62 | 84 | kuid_t root_uid; |
| 63 | 85 | kgid_t root_gid; |
| 64 | − | |
| 86 | + struct binderfs_mount_opts mount_opts; | |
| 87 | + int device_count; | |
| 65 | 88 | }; |
| 66 | 89 | |
| 67 | 90 | static inline struct binderfs_info *BINDERFS_I(const struct inode *inode) |
| @@ -84,7 +107,7 @@ bool is_binderfs_device(const struct inode *inode) · 16 unmodified lines | ||
| 84 | 107 | * @userp: buffer to copy information about new device for userspace to |
| 85 | 108 | * @req: struct binderfs_device as copied from userspace |
| 86 | 109 | * |
| 87 | − * This function allocated a new binder_device and reserves a new minor | |
| 110 | + * This function allocates a new binder_device and reserves a new minor | |
| 88 | 111 | * number for it. |
| 89 | 112 | * Minor numbers are limited and tracked globally in binderfs_minors. The |
| 90 | 113 | * function will stash a struct binder_device for the specific binder |
| @@ -100,20 +123,34 @@ static int binderfs_binder_device_create(struct inode *ref_inode, · 9 unmodified lines | ||
| 100 | 123 | struct binderfs_device *req) |
| 101 | 124 | { |
| 102 | 125 | int minor, ret; |
| 103 | − struct dentry *dentry, *dup, *root; | |
| 126 | + struct dentry *dentry, *root; | |
| 104 | 127 | struct binder_device *device; |
| 105 | − size_t name_len = BINDERFS_MAX_NAME + 1; | |
| 106 | 128 | char *name = NULL; |
| 129 | + size_t name_len; | |
| 107 | 130 | struct inode *inode = NULL; |
| 108 | 131 | struct super_block *sb = ref_inode->i_sb; |
| 109 | 132 | struct binderfs_info *info = sb->s_fs_info; |
| 133 | +#if defined(CONFIG_IPC_NS) | |
| 134 | + bool use_reserve = (info->ipc_ns == &init_ipc_ns); | |
| 135 | +#else | |
| 136 | + bool use_reserve = true; | |
| 137 | +#endif | |
| 110 | 138 | |
| 111 | 139 | /* Reserve new minor number for the new device. */ |
| 112 | 140 | mutex_lock(&binderfs_minors_mutex); |
| 113 | − minor = ida_alloc_max(&binderfs_minors, BINDERFS_MAX_MINOR, GFP_KERNEL); | |
| 114 | − mutex_unlock(&binderfs_minors_mutex); | |
| 115 | − if (minor < 0) | |
| 141 | + if (++info->device_count <= info->mount_opts.max) | |
| 142 | + minor = ida_alloc_max(&binderfs_minors, | |
| 143 | + use_reserve ? BINDERFS_MAX_MINOR : | |
| 144 | + BINDERFS_MAX_MINOR_CAPPED, | |
| 145 | + GFP_KERNEL); | |
| 146 | + else | |
| 147 | + minor = -ENOSPC; | |
| 148 | + if (minor < 0) { | |
| 149 | + --info->device_count; | |
| 150 | + mutex_unlock(&binderfs_minors_mutex); | |
| 116 | 151 | return minor; |
| 152 | + } | |
| 153 | + mutex_unlock(&binderfs_minors_mutex); | |
| 117 | 154 | |
| 118 | 155 | ret = -ENOMEM; |
| 119 | 156 | device = kzalloc(sizeof(*device), GFP_KERNEL); |
| @@ -132,12 +169,13 @@ static int binderfs_binder_device_create(struct inode *ref_inode, · 12 unmodified lines | ||
| 132 | 169 | inode->i_uid = info->root_uid; |
| 133 | 170 | inode->i_gid = info->root_gid; |
| 134 | 171 | |
| 135 | − name = kmalloc(name_len, GFP_KERNEL); | |
| 172 | + req->name[BINDERFS_MAX_NAME] = '\0'; /* NUL-terminate */ | |
| 173 | + name_len = strlen(req->name); | |
| 174 | + /* Make sure to include terminating NUL byte */ | |
| 175 | + name = kmemdup(req->name, name_len + 1, GFP_KERNEL); | |
| 136 | 176 | if (!name) |
| 137 | 177 | goto err; |
| 138 | 178 | |
| 139 | − strscpy(name, req->name, name_len); | |
| 140 | − | |
| 141 | 179 | device->binderfs_inode = inode; |
| 142 | 180 | device->context.binder_context_mgr_uid = INVALID_UID; |
| 143 | 181 | device->context.name = name; |
| @@ -156,28 +194,25 @@ static int binderfs_binder_device_create(struct inode *ref_inode, · 12 unmodified lines | ||
| 156 | 194 | |
| 157 | 195 | root = sb->s_root; |
| 158 | 196 | inode_lock(d_inode(root)); |
| 159 | − dentry = d_alloc_name(root, name); | |
| 160 | − if (!dentry) { | |
| 197 | + | |
| 198 | + /* look it up */ | |
| 199 | + dentry = lookup_one_len(name, root, name_len); | |
| 200 | + if (IS_ERR(dentry)) { | |
| 161 | 201 | inode_unlock(d_inode(root)); |
| 162 | − ret = -ENOMEM; | |
| 202 | + ret = PTR_ERR(dentry); | |
| 163 | 203 | goto err; |
| 164 | 204 | } |
| 165 | 205 | |
| 166 | − /* Verify that the name userspace gave us is not already in use. */ | |
| 167 | − dup = d_lookup(root, &dentry->d_name); | |
| 168 | − if (dup) { | |
| 169 | − if (d_really_is_positive(dup)) { | |
| 170 | − dput(dup); | |
| 171 | − dput(dentry); | |
| 172 | − inode_unlock(d_inode(root)); | |
| 173 | − ret = -EEXIST; | |
| 174 | − goto err; | |
| 175 | − } | |
| 176 | − dput(dup); | |
| 206 | + if (d_really_is_positive(dentry)) { | |
| 207 | + /* already exists */ | |
| 208 | + dput(dentry); | |
| 209 | + inode_unlock(d_inode(root)); | |
| 210 | + ret = -EEXIST; | |
| 211 | + goto err; | |
| 177 | 212 | } |
| 178 | 213 | |
| 179 | 214 | inode->i_private = device; |
| 180 | − d_add(dentry, inode); | |
| 215 | + d_instantiate(dentry, inode); | |
| 181 | 216 | fsnotify_create(root->d_inode, dentry); |
| 182 | 217 | inode_unlock(d_inode(root)); |
| 183 | 218 | |
| @@ -187,6 +222,7 @@ err: · 3 unmodified lines | ||
| 187 | 222 | kfree(name); |
| 188 | 223 | kfree(device); |
| 189 | 224 | mutex_lock(&binderfs_minors_mutex); |
| 225 | + --info->device_count; | |
| 190 | 226 | ida_free(&binderfs_minors, minor); |
| 191 | 227 | mutex_unlock(&binderfs_minors_mutex); |
| 192 | 228 | iput(inode); |
| @@ -232,6 +268,7 @@ static long binder_ctl_ioctl(struct file *file, unsigned int cmd, · 39 unmodified lines | ||
| 232 | 268 | static void binderfs_evict_inode(struct inode *inode) |
| 233 | 269 | { |
| 234 | 270 | struct binder_device *device = inode->i_private; |
| 271 | + struct binderfs_info *info = BINDERFS_I(inode); | |
| 235 | 272 | |
| 236 | 273 | clear_inode(inode); |
| 237 | 274 | |
| @@ -239,6 +276,7 @@ static void binderfs_evict_inode(struct inode *inode) · 1 unmodified line | ||
| 239 | 276 | return; |
| 240 | 277 | |
| 241 | 278 | mutex_lock(&binderfs_minors_mutex); |
| 279 | + --info->device_count; | |
| 242 | 280 | ida_free(&binderfs_minors, device->miscdev.minor); |
| 243 | 281 | mutex_unlock(&binderfs_minors_mutex); |
| 244 | 282 | |
| @@ -246,43 +284,87 @@ static void binderfs_evict_inode(struct inode *inode) · 1 unmodified line | ||
| 246 | 284 | kfree(device); |
| 247 | 285 | } |
| 248 | 286 | |
| 287 | +/** | |
| 288 | + * binderfs_parse_mount_opts - parse binderfs mount options | |
| 289 | + * @data: options to set (can be NULL in which case defaults are used) | |
| 290 | + */ | |
| 291 | +static int binderfs_parse_mount_opts(char *data, | |
| 292 | + struct binderfs_mount_opts *opts) | |
| 293 | +{ | |
| 294 | + char *p; | |
| 295 | + opts->max = BINDERFS_MAX_MINOR; | |
| 296 | + | |
| 297 | + while ((p = strsep(&data, ",")) != NULL) { | |
| 298 | + substring_t args[MAX_OPT_ARGS]; | |
| 299 | + int token; | |
| 300 | + int max_devices; | |
| 301 | + | |
| 302 | + if (!*p) | |
| 303 | + continue; | |
| 304 | + | |
| 305 | + token = match_token(p, tokens, args); | |
| 306 | + switch (token) { | |
| 307 | + case Opt_max: | |
| 308 | + if (match_int(&args[0], &max_devices) || | |
| 309 | + (max_devices < 0 || | |
| 310 | + (max_devices > BINDERFS_MAX_MINOR))) | |
| 311 | + return -EINVAL; | |
| 312 | + | |
| 313 | + opts->max = max_devices; | |
| 314 | + break; | |
| 315 | + default: | |
| 316 | + pr_err("Invalid mount options\n"); | |
| 317 | + return -EINVAL; | |
| 318 | + } | |
| 319 | + } | |
| 320 | + | |
| 321 | + return 0; | |
| 322 | +} | |
| 323 | + | |
| 324 | +static int binderfs_remount(struct super_block *sb, int *flags, char *data) | |
| 325 | +{ | |
| 326 | + struct binderfs_info *info = sb->s_fs_info; | |
| 327 | + return binderfs_parse_mount_opts(data, &info->mount_opts); | |
| 328 | +} | |
| 329 | + | |
| 330 | +static int binderfs_show_mount_opts(struct seq_file *seq, struct dentry *root) | |
| 331 | +{ | |
| 332 | + struct binderfs_info *info; | |
| 333 | + | |
| 334 | + info = root->d_sb->s_fs_info; | |
| 335 | + if (info->mount_opts.max <= BINDERFS_MAX_MINOR) | |
| 336 | + seq_printf(seq, ",max=%d", info->mount_opts.max); | |
| 337 | + | |
| 338 | + return 0; | |
| 339 | +} | |
| 340 | + | |
| 249 | 341 | static const struct super_operations binderfs_super_ops = { |
| 250 | − .statfs = simple_statfs, | |
| 251 | − .evict_inode = binderfs_evict_inode, | |
| 342 | + .evict_inode = binderfs_evict_inode, | |
| 343 | + .remount_fs = binderfs_remount, | |
| 344 | + .show_options = binderfs_show_mount_opts, | |
| 345 | + .statfs = simple_statfs, | |
| 252 | 346 | }; |
| 253 | 347 | |
| 348 | +static inline bool is_binderfs_control_device(const struct dentry *dentry) | |
| 349 | +{ | |
| 350 | + struct binderfs_info *info = dentry->d_sb->s_fs_info; | |
| 351 | + return info->control_dentry == dentry; | |
| 352 | +} | |
| 353 | + | |
| 254 | 354 | static int binderfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
| 255 | 355 | struct inode *new_dir, struct dentry *new_dentry, |
| 256 | 356 | unsigned int flags) |
| 257 | 357 | { |
| 258 | − struct inode *inode = d_inode(old_dentry); | |
| 259 | − | |
| 260 | − /* binderfs doesn't support directories. */ | |
| 261 | − if (d_is_dir(old_dentry)) | |
| 358 | + if (is_binderfs_control_device(old_dentry) || | |
| 359 | + is_binderfs_control_device(new_dentry)) | |
| 262 | 360 | return -EPERM; |
| 263 | 361 | |
| 264 | − if (flags & ~RENAME_NOREPLACE) | |
| 265 | − return -EINVAL; | |
| 266 | − | |
| 267 | − if (!simple_empty(new_dentry)) | |
| 268 | − return -ENOTEMPTY; | |
| 269 | − | |
| 270 | − if (d_really_is_positive(new_dentry)) | |
| 271 | − simple_unlink(new_dir, new_dentry); | |
| 272 | − | |
| 273 | − old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = | |
| 274 | − new_dir->i_mtime = inode->i_ctime = current_time(old_dir); | |
| 275 | − | |
| 276 | − return 0; | |
| 362 | + return simple_rename(old_dir, old_dentry, new_dir, new_dentry, flags); | |
| 277 | 363 | } |
| 278 | 364 | |
| 279 | 365 | static int binderfs_unlink(struct inode *dir, struct dentry *dentry) |
| 280 | 366 | { |
| 281 | − /* | |
| 282 | − * The control dentry is only ever touched during mount so checking it | |
| 283 | − * here should not require us to take lock. | |
| 284 | − */ | |
| 285 | − if (BINDERFS_I(dir)->control_dentry == dentry) | |
| 367 | + if (is_binderfs_control_device(dentry)) | |
| 286 | 368 | return -EPERM; |
| 287 | 369 | |
| 288 | 370 | return simple_unlink(dir, dentry); |
| @@ -318,8 +400,6 @@ static int binderfs_binder_ctl_create(struct super_block *sb) · 29 unmodified lines | ||
| 318 | 400 | if (!device) |
| 319 | 401 | return -ENOMEM; |
| 320 | 402 | |
| 321 | − inode_lock(d_inode(root)); | |
| 322 | − | |
| 323 | 403 | /* If we have already created a binder-control node, return. */ |
| 324 | 404 | if (info->control_dentry) { |
| 325 | 405 | ret = 0; |
| @@ -358,12 +438,10 @@ static int binderfs_binder_ctl_create(struct super_block *sb) · 32 unmodified lines | ||
| 358 | 438 | inode->i_private = device; |
| 359 | 439 | info->control_dentry = dentry; |
| 360 | 440 | d_add(dentry, inode); |
| 361 | − inode_unlock(d_inode(root)); | |
| 362 | 441 | |
| 363 | 442 | return 0; |
| 364 | 443 | |
| 365 | 444 | out: |
| 366 | − inode_unlock(d_inode(root)); | |
| 367 | 445 | kfree(device); |
| 368 | 446 | iput(inode); |
| 369 | 447 | |
| @@ -378,12 +456,9 @@ static const struct inode_operations binderfs_dir_inode_operations = { · 8 unmodified lines | ||
| 378 | 456 | |
| 379 | 457 | static int binderfs_fill_super(struct super_block *sb, void *data, int silent) |
| 380 | 458 | { |
| 459 | + int ret; | |
| 381 | 460 | struct binderfs_info *info; |
| 382 | − int ret = -ENOMEM; | |
| 383 | 461 | struct inode *inode = NULL; |
| 384 | − struct ipc_namespace *ipc_ns = sb->s_fs_info; | |
| 385 | − | |
| 386 | − get_ipc_ns(ipc_ns); | |
| 387 | 462 | |
| 388 | 463 | sb->s_blocksize = PAGE_SIZE; |
| 389 | 464 | sb->s_blocksize_bits = PAGE_SHIFT; |
| @@ -405,11 +480,17 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) · 15 unmodified lines | ||
| 405 | 480 | sb->s_op = &binderfs_super_ops; |
| 406 | 481 | sb->s_time_gran = 1; |
| 407 | 482 | |
| 408 | − info = kzalloc(sizeof(struct binderfs_info), GFP_KERNEL); | |
| 409 | − if (!info) | |
| 410 | − goto err_without_dentry; | |
| 483 | + sb->s_fs_info = kzalloc(sizeof(struct binderfs_info), GFP_KERNEL); | |
| 484 | + if (!sb->s_fs_info) | |
| 485 | + return -ENOMEM; | |
| 486 | + info = sb->s_fs_info; | |
| 487 | + | |
| 488 | + info->ipc_ns = get_ipc_ns(current->nsproxy->ipc_ns); | |
| 489 | + | |
| 490 | + ret = binderfs_parse_mount_opts(data, &info->mount_opts); | |
| 491 | + if (ret) | |
| 492 | + return ret; | |
| 411 | 493 | |
| 412 | − info->ipc_ns = ipc_ns; | |
| 413 | 494 | info->root_gid = make_kgid(sb->s_user_ns, 0); |
| 414 | 495 | if (!gid_valid(info->root_gid)) |
| 415 | 496 | info->root_gid = GLOBAL_ROOT_GID; |
| @@ -417,11 +498,9 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) · 1 unmodified line | ||
| 417 | 498 | if (!uid_valid(info->root_uid)) |
| 418 | 499 | info->root_uid = GLOBAL_ROOT_UID; |
| 419 | 500 | |
| 420 | − sb->s_fs_info = info; | |
| 421 | − | |
| 422 | 501 | inode = new_inode(sb); |
| 423 | 502 | if (!inode) |
| 424 | − goto err_without_dentry; | |
| 503 | + return -ENOMEM; | |
| 425 | 504 | |
| 426 | 505 | inode->i_ino = FIRST_INODE; |
| 427 | 506 | inode->i_fop = &simple_dir_operations; |
| @@ -432,79 +511,28 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent) · 4 unmodified lines | ||
| 432 | 511 | |
| 433 | 512 | sb->s_root = d_make_root(inode); |
| 434 | 513 | if (!sb->s_root) |
| 435 | − goto err_without_dentry; | |
| 436 | − | |
| 437 | − ret = binderfs_binder_ctl_create(sb); | |
| 438 | − if (ret) | |
| 439 | − goto err_with_dentry; | |
| 440 | − | |
| 441 | − return 0; | |
| 442 | − | |
| 443 | −err_with_dentry: | |
| 444 | − dput(sb->s_root); | |
| 445 | − sb->s_root = NULL; | |
| 446 | − | |
| 447 | −err_without_dentry: | |
| 448 | − put_ipc_ns(ipc_ns); | |
| 449 | − iput(inode); | |
| 450 | − kfree(info); | |
| 451 | − | |
| 452 | − return ret; | |
| 453 | −} | |
| 454 | − | |
| 455 | −static int binderfs_test_super(struct super_block *sb, void *data) | |
| 456 | −{ | |
| 457 | − struct binderfs_info *info = sb->s_fs_info; | |
| 458 | − | |
| 459 | − if (info) | |
| 460 | − return info->ipc_ns == data; | |
| 461 | − | |
| 462 | − return 0; | |
| 463 | −} | |
| 514 | + return -ENOMEM; | |
| 464 | 515 | |
| 465 | −static int binderfs_set_super(struct super_block *sb, void *data) | |
| 466 | −{ | |
| 467 | − sb->s_fs_info = data; | |
| 468 | − return set_anon_super(sb, NULL); | |
| 516 | + return binderfs_binder_ctl_create(sb); | |
| 469 | 517 | } |
| 470 | 518 | |
| 471 | 519 | static struct dentry *binderfs_mount(struct file_system_type *fs_type, |
| 472 | 520 | int flags, const char *dev_name, |
| 473 | 521 | void *data) |
| 474 | 522 | { |
| 475 | − struct super_block *sb; | |
| 476 | − struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns; | |
| 477 | − | |
| 478 | − if (!ns_capable(ipc_ns->user_ns, CAP_SYS_ADMIN)) | |
| 479 | − return ERR_PTR(-EPERM); | |
| 480 | − | |
| 481 | − sb = sget_userns(fs_type, binderfs_test_super, binderfs_set_super, | |
| 482 | − flags, ipc_ns->user_ns, ipc_ns); | |
| 483 | − if (IS_ERR(sb)) | |
| 484 | − return ERR_CAST(sb); | |
| 485 | − | |
| 486 | − if (!sb->s_root) { | |
| 487 | − int ret = binderfs_fill_super(sb, data, flags & SB_SILENT ? 1 : 0); | |
| 488 | − if (ret) { | |
| 489 | − deactivate_locked_super(sb); | |
| 490 | − return ERR_PTR(ret); | |
| 491 | − } | |
| 492 | − | |
| 493 | − sb->s_flags |= SB_ACTIVE; | |
| 494 | − } | |
| 495 | − | |
| 496 | − return dget(sb->s_root); | |
| 523 | + return mount_nodev(fs_type, flags, data, binderfs_fill_super); | |
| 497 | 524 | } |
| 498 | 525 | |
| 499 | 526 | static void binderfs_kill_super(struct super_block *sb) |
| 500 | 527 | { |
| 501 | 528 | struct binderfs_info *info = sb->s_fs_info; |
| 502 | 529 | |
| 530 | + kill_litter_super(sb); | |
| 531 | + | |
| 503 | 532 | if (info && info->ipc_ns) |
| 504 | 533 | put_ipc_ns(info->ipc_ns); |
| 505 | 534 | |
| 506 | 535 | kfree(info); |
| 507 | − kill_litter_super(sb); | |
| 508 | 536 | } |
| 509 | 537 | |
| 510 | 538 | static struct file_system_type binder_fs_type = { |
| @@ -530,14 +558,6 @@ static int __init init_binderfs(void) · 19 unmodified lines | ||
| 530 | 558 | return ret; |
| 531 | 559 | } |
| 532 | 560 | |
| 533 | − binderfs_mnt = kern_mount(&binder_fs_type); | |
| 534 | − if (IS_ERR(binderfs_mnt)) { | |
| 535 | − ret = PTR_ERR(binderfs_mnt); | |
| 536 | − binderfs_mnt = NULL; | |
| 537 | − unregister_filesystem(&binder_fs_type); | |
| 538 | − unregister_chrdev_region(binderfs_dev, BINDERFS_MAX_MINOR); | |
| 539 | − } | |
| 540 | − | |
| 541 | 561 | return ret; |
| 542 | 562 | } |
| 543 | 563 | |
| @@ -1091,7 +1091,7 @@ comment "Generic fallback / legacy drivers" · 1090 unmodified lines | ||
| 1091 | 1091 | |
| 1092 | 1092 | config PATA_ACPI |
| 1093 | 1093 | tristate "ACPI firmware driver for PATA" |
| 1094 | − depends on ATA_ACPI && ATA_BMDMA | |
| 1094 | + depends on ATA_ACPI && ATA_BMDMA && PCI | |
| 1095 | 1095 | help |
| 1096 | 1096 | This option enables an ACPI method driver which drives |
| 1097 | 1097 | motherboard PATA controller interfaces through the ACPI |
| @@ -915,6 +915,10 @@ static struct scsi_host_template pata_macio_sht = { · 914 unmodified lines | ||
| 915 | 915 | .sg_tablesize = MAX_DCMDS, |
| 916 | 916 | /* We may not need that strict one */ |
| 917 | 917 | .dma_boundary = ATA_DMA_BOUNDARY, |
| 918 | + /* Not sure what the real max is but we know it's less than 64K, let's | |
| 919 | + * use 64K minus 256 | |
| 920 | + */ | |
| 921 | + .max_segment_size = MAX_DBDMA_SEG, | |
| 918 | 922 | .slave_configure = pata_macio_slave_config, |
| 919 | 923 | }; |
| 920 | 924 | |
| @@ -1044,11 +1048,6 @@ static int pata_macio_common_init(struct pata_macio_priv *priv, · 123 unmodified lines | ||
| 1044 | 1048 | /* Make sure we have sane initial timings in the cache */ |
| 1045 | 1049 | pata_macio_default_timings(priv); |
| 1046 | 1050 | |
| 1047 | − /* Not sure what the real max is but we know it's less than 64K, let's | |
| 1048 | − * use 64K minus 256 | |
| 1049 | − */ | |
| 1050 | − dma_set_max_seg_size(priv->dev, MAX_DBDMA_SEG); | |
| 1051 | − | |
| 1052 | 1051 | /* Allocate libata host for 1 port */ |
| 1053 | 1052 | memset(&pinfo, 0, sizeof(struct ata_port_info)); |
| 1054 | 1053 | pmac_macio_calc_timing_masks(priv, &pinfo); |
| @@ -245,8 +245,15 @@ struct inic_port_priv { · 244 unmodified lines | ||
| 245 | 245 | |
| 246 | 246 | static struct scsi_host_template inic_sht = { |
| 247 | 247 | ATA_BASE_SHT(DRV_NAME), |
| 248 | − .sg_tablesize = LIBATA_MAX_PRD, /* maybe it can be larger? */ | |
| 249 | − .dma_boundary = INIC_DMA_BOUNDARY, | |
| 248 | + .sg_tablesize = LIBATA_MAX_PRD, /* maybe it can be larger? */ | |
| 249 | + | |
| 250 | + /* | |
| 251 | + * This controller is braindamaged. dma_boundary is 0xffff like others | |
| 252 | + * but it will lock up the whole machine HARD if 65536 byte PRD entry | |
| 253 | + * is fed. Reduce maximum segment size. | |
| 254 | + */ | |
| 255 | + .dma_boundary = INIC_DMA_BOUNDARY, | |
| 256 | + .max_segment_size = 65536 - 512, | |
| 250 | 257 | }; |
| 251 | 258 | |
| 252 | 259 | static const int scr_map[] = { |
| @@ -868,17 +875,6 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 615 unmodified lines | ||
| 868 | 875 | return rc; |
| 869 | 876 | } |
| 870 | 877 | |
| 871 | − /* | |
| 872 | − * This controller is braindamaged. dma_boundary is 0xffff | |
| 873 | − * like others but it will lock up the whole machine HARD if | |
| 874 | − * 65536 byte PRD entry is fed. Reduce maximum segment size. | |
| 875 | − */ | |
| 876 | − rc = dma_set_max_seg_size(&pdev->dev, 65536 - 512); | |
| 877 | − if (rc) { | |
| 878 | − dev_err(&pdev->dev, "failed to set the maximum segment size\n"); | |
| 879 | − return rc; | |
| 880 | − } | |
| 881 | − | |
| 882 | 878 | rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); |
| 883 | 879 | if (rc) { |
| 884 | 880 | dev_err(&pdev->dev, "failed to initialize controller\n"); |
| @@ -718,7 +718,7 @@ static int he_init_cs_block_rcm(struct he_dev *he_dev) · 717 unmodified lines | ||
| 718 | 718 | instead of '/ 512', use '>> 9' to prevent a call |
| 719 | 719 | to divdu3 on x86 platforms |
| 720 | 720 | */ |
| 721 | − rate_cps = (unsigned long long) (1 << exp) * (man + 512) >> 9; | |
| 721 | + rate_cps = (unsigned long long) (1UL << exp) * (man + 512) >> 9; | |
| 722 | 722 | |
| 723 | 723 | if (rate_cps < 10) |
| 724 | 724 | rate_cps = 10; /* 2.2.1 minimum payload rate is 10 cps */ |
| @@ -130,7 +130,7 @@ u64 pm_runtime_autosuspend_expiration(struct device *dev) · 129 unmodified lines | ||
| 130 | 130 | { |
| 131 | 131 | int autosuspend_delay; |
| 132 | 132 | u64 last_busy, expires = 0; |
| 133 | − u64 now = ktime_to_ns(ktime_get()); | |
| 133 | + u64 now = ktime_get_mono_fast_ns(); | |
| 134 | 134 | |
| 135 | 135 | if (!dev->power.use_autosuspend) |
| 136 | 136 | goto out; |
| @@ -909,7 +909,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) · 772 unmodified lines | ||
| 909 | 909 | * If 'expires' is after the current time, we've been called |
| 910 | 910 | * too early. |
| 911 | 911 | */ |
| 912 | − if (expires > 0 && expires < ktime_to_ns(ktime_get())) { | |
| 912 | + if (expires > 0 && expires < ktime_get_mono_fast_ns()) { | |
| 913 | 913 | dev->power.timer_expires = 0; |
| 914 | 914 | rpm_suspend(dev, dev->power.timer_autosuspends ? |
| 915 | 915 | (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); |
| @@ -928,7 +928,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) · 12 unmodified lines | ||
| 928 | 928 | int pm_schedule_suspend(struct device *dev, unsigned int delay) |
| 929 | 929 | { |
| 930 | 930 | unsigned long flags; |
| 931 | − ktime_t expires; | |
| 931 | + u64 expires; | |
| 932 | 932 | int retval; |
| 933 | 933 | |
| 934 | 934 | spin_lock_irqsave(&dev->power.lock, flags); |
| @@ -945,8 +945,8 @@ int pm_schedule_suspend(struct device *dev, unsigned int delay) · 10 unmodified lines | ||
| 945 | 945 | /* Other scheduled or pending requests need to be canceled. */ |
| 946 | 946 | pm_runtime_cancel_pending(dev); |
| 947 | 947 | |
| 948 | − expires = ktime_add(ktime_get(), ms_to_ktime(delay)); | |
| 949 | − dev->power.timer_expires = ktime_to_ns(expires); | |
| 948 | + expires = ktime_get_mono_fast_ns() + (u64)delay * NSEC_PER_MSEC; | |
| 949 | + dev->power.timer_expires = expires; | |
| 950 | 950 | dev->power.timer_autosuspends = 0; |
| 951 | 951 | hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); |
| 952 | 952 | |
| @@ -108,6 +108,9 @@ static void regmap_irq_sync_unlock(struct irq_data *data) · 107 unmodified lines | ||
| 108 | 108 | * suppress pointless writes. |
| 109 | 109 | */ |
| 110 | 110 | for (i = 0; i < d->chip->num_regs; i++) { |
| 111 | + if (!d->chip->mask_base) | |
| 112 | + continue; | |
| 113 | + | |
| 111 | 114 | reg = d->chip->mask_base + |
| 112 | 115 | (i * map->reg_stride * d->irq_reg_stride); |
| 113 | 116 | if (d->chip->mask_invert) { |
| @@ -258,7 +261,7 @@ static int regmap_irq_set_type(struct irq_data *data, unsigned int type) · 144 unmodified lines | ||
| 258 | 261 | const struct regmap_irq_type *t = &irq_data->type; |
| 259 | 262 | |
| 260 | 263 | if ((t->types_supported & type) != type) |
| 261 | − return -ENOTSUPP; | |
| 264 | + return 0; | |
| 262 | 265 | |
| 263 | 266 | reg = t->type_reg_offset / map->reg_stride; |
| 264 | 267 | |
| @@ -588,6 +591,9 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, · 323 unmodified lines | ||
| 588 | 591 | /* Mask all the interrupts by default */ |
| 589 | 592 | for (i = 0; i < chip->num_regs; i++) { |
| 590 | 593 | d->mask_buf[i] = d->mask_buf_def[i]; |
| 594 | + if (!chip->mask_base) | |
| 595 | + continue; | |
| 596 | + | |
| 591 | 597 | reg = chip->mask_base + |
| 592 | 598 | (i * map->reg_stride * d->irq_reg_stride); |
| 593 | 599 | if (chip->mask_invert) |
| @@ -288,9 +288,10 @@ static void nbd_size_update(struct nbd_device *nbd) · 287 unmodified lines | ||
| 288 | 288 | blk_queue_physical_block_size(nbd->disk->queue, config->blksize); |
| 289 | 289 | set_capacity(nbd->disk, config->bytesize >> 9); |
| 290 | 290 | if (bdev) { |
| 291 | − if (bdev->bd_disk) | |
| 291 | + if (bdev->bd_disk) { | |
| 292 | 292 | bd_set_size(bdev, config->bytesize); |
| 293 | − else | |
| 293 | + set_blocksize(bdev, config->blksize); | |
| 294 | + } else | |
| 294 | 295 | bdev->bd_invalidated = 1; |
| 295 | 296 | bdput(bdev); |
| 296 | 297 | } |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | #include <linux/moduleparam.h> |
| 33 | 33 | #include <linux/workqueue.h> |
| 34 | 34 | #include <linux/uuid.h> |
| 35 | +#include <linux/nospec.h> | |
| 35 | 36 | |
| 36 | 37 | #define IPMI_DRIVER_VERSION "39.2" |
| 37 | 38 | |
| @@ -62,7 +63,8 @@ static void ipmi_debug_msg(const char *title, unsigned char *data, · 24 unmodified lines | ||
| 62 | 63 | { } |
| 63 | 64 | #endif |
| 64 | 65 | |
| 65 | −static int initialized; | |
| 66 | +static bool initialized; | |
| 67 | +static bool drvregistered; | |
| 66 | 68 | |
| 67 | 69 | enum ipmi_panic_event_op { |
| 68 | 70 | IPMI_SEND_PANIC_EVENT_NONE, |
| @@ -612,7 +614,7 @@ static DEFINE_MUTEX(ipmidriver_mutex); · 543 unmodified lines | ||
| 612 | 614 | |
| 613 | 615 | static LIST_HEAD(ipmi_interfaces); |
| 614 | 616 | static DEFINE_MUTEX(ipmi_interfaces_mutex); |
| 615 | −DEFINE_STATIC_SRCU(ipmi_interfaces_srcu); | |
| 617 | +struct srcu_struct ipmi_interfaces_srcu; | |
| 616 | 618 | |
| 617 | 619 | /* |
| 618 | 620 | * List of watchers that want to know when smi's are added and deleted. |
| @@ -720,7 +722,15 @@ struct watcher_entry { · 101 unmodified lines | ||
| 720 | 722 | int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) |
| 721 | 723 | { |
| 722 | 724 | struct ipmi_smi *intf; |
| 723 | − int index; | |
| 725 | + int index, rv; | |
| 726 | + | |
| 727 | + /* | |
| 728 | + * Make sure the driver is actually initialized, this handles | |
| 729 | + * problems with initialization order. | |
| 730 | + */ | |
| 731 | + rv = ipmi_init_msghandler(); | |
| 732 | + if (rv) | |
| 733 | + return rv; | |
| 724 | 734 | |
| 725 | 735 | mutex_lock(&smi_watchers_mutex); |
| 726 | 736 | |
| @@ -884,7 +894,7 @@ static int deliver_response(struct ipmi_smi *intf, struct ipmi_recv_msg *msg) · 157 unmodified lines | ||
| 884 | 894 | |
| 885 | 895 | if (user) { |
| 886 | 896 | user->handler->ipmi_recv_hndl(msg, user->handler_data); |
| 887 | − release_ipmi_user(msg->user, index); | |
| 897 | + release_ipmi_user(user, index); | |
| 888 | 898 | } else { |
| 889 | 899 | /* User went away, give up. */ |
| 890 | 900 | ipmi_free_recv_msg(msg); |
| @@ -1076,7 +1086,7 @@ int ipmi_create_user(unsigned int if_num, · 185 unmodified lines | ||
| 1076 | 1086 | { |
| 1077 | 1087 | unsigned long flags; |
| 1078 | 1088 | struct ipmi_user *new_user; |
| 1079 | − int rv = 0, index; | |
| 1089 | + int rv, index; | |
| 1080 | 1090 | struct ipmi_smi *intf; |
| 1081 | 1091 | |
| 1082 | 1092 | /* |
| @@ -1094,18 +1104,9 @@ int ipmi_create_user(unsigned int if_num, · 11 unmodified lines | ||
| 1094 | 1104 | * Make sure the driver is actually initialized, this handles |
| 1095 | 1105 | * problems with initialization order. |
| 1096 | 1106 | */ |
| 1097 | − if (!initialized) { | |
| 1098 | − rv = ipmi_init_msghandler(); | |
| 1099 | − if (rv) | |
| 1100 | − return rv; | |
| 1101 | − | |
| 1102 | − /* | |
| 1103 | − * The init code doesn't return an error if it was turned | |
| 1104 | − * off, but it won't initialize. Check that. | |
| 1105 | − */ | |
| 1106 | − if (!initialized) | |
| 1107 | − return -ENODEV; | |
| 1108 | − } | |
| 1107 | + rv = ipmi_init_msghandler(); | |
| 1108 | + if (rv) | |
| 1109 | + return rv; | |
| 1109 | 1110 | |
| 1110 | 1111 | new_user = kmalloc(sizeof(*new_user), GFP_KERNEL); |
| 1111 | 1112 | if (!new_user) |
| @@ -1183,6 +1184,7 @@ EXPORT_SYMBOL(ipmi_get_smi_info); · 71 unmodified lines | ||
| 1183 | 1184 | static void free_user(struct kref *ref) |
| 1184 | 1185 | { |
| 1185 | 1186 | struct ipmi_user *user = container_of(ref, struct ipmi_user, refcount); |
| 1187 | + cleanup_srcu_struct(&user->release_barrier); | |
| 1186 | 1188 | kfree(user); |
| 1187 | 1189 | } |
| 1188 | 1190 | |
| @@ -1259,7 +1261,6 @@ int ipmi_destroy_user(struct ipmi_user *user) · 70 unmodified lines | ||
| 1259 | 1261 | { |
| 1260 | 1262 | _ipmi_destroy_user(user); |
| 1261 | 1263 | |
| 1262 | − cleanup_srcu_struct(&user->release_barrier); | |
| 1263 | 1264 | kref_put(&user->refcount, free_user); |
| 1264 | 1265 | |
| 1265 | 1266 | return 0; |
| @@ -1298,10 +1299,12 @@ int ipmi_set_my_address(struct ipmi_user *user, · 32 unmodified lines | ||
| 1298 | 1299 | if (!user) |
| 1299 | 1300 | return -ENODEV; |
| 1300 | 1301 | |
| 1301 | − if (channel >= IPMI_MAX_CHANNELS) | |
| 1302 | + if (channel >= IPMI_MAX_CHANNELS) { | |
| 1302 | 1303 | rv = -EINVAL; |
| 1303 | − else | |
| 1304 | + } else { | |
| 1305 | + channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | |
| 1304 | 1306 | user->intf->addrinfo[channel].address = address; |
| 1307 | + } | |
| 1305 | 1308 | release_ipmi_user(user, index); |
| 1306 | 1309 | |
| 1307 | 1310 | return rv; |
| @@ -1318,10 +1321,12 @@ int ipmi_get_my_address(struct ipmi_user *user, · 10 unmodified lines | ||
| 1318 | 1321 | if (!user) |
| 1319 | 1322 | return -ENODEV; |
| 1320 | 1323 | |
| 1321 | − if (channel >= IPMI_MAX_CHANNELS) | |
| 1324 | + if (channel >= IPMI_MAX_CHANNELS) { | |
| 1322 | 1325 | rv = -EINVAL; |
| 1323 | − else | |
| 1326 | + } else { | |
| 1327 | + channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | |
| 1324 | 1328 | *address = user->intf->addrinfo[channel].address; |
| 1329 | + } | |
| 1325 | 1330 | release_ipmi_user(user, index); |
| 1326 | 1331 | |
| 1327 | 1332 | return rv; |
| @@ -1338,10 +1343,12 @@ int ipmi_set_my_LUN(struct ipmi_user *user, · 10 unmodified lines | ||
| 1338 | 1343 | if (!user) |
| 1339 | 1344 | return -ENODEV; |
| 1340 | 1345 | |
| 1341 | − if (channel >= IPMI_MAX_CHANNELS) | |
| 1346 | + if (channel >= IPMI_MAX_CHANNELS) { | |
| 1342 | 1347 | rv = -EINVAL; |
| 1343 | − else | |
| 1348 | + } else { | |
| 1349 | + channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | |
| 1344 | 1350 | user->intf->addrinfo[channel].lun = LUN & 0x3; |
| 1351 | + } | |
| 1345 | 1352 | release_ipmi_user(user, index); |
| 1346 | 1353 | |
| 1347 | 1354 | return rv; |
| @@ -1358,10 +1365,12 @@ int ipmi_get_my_LUN(struct ipmi_user *user, · 10 unmodified lines | ||
| 1358 | 1365 | if (!user) |
| 1359 | 1366 | return -ENODEV; |
| 1360 | 1367 | |
| 1361 | − if (channel >= IPMI_MAX_CHANNELS) | |
| 1368 | + if (channel >= IPMI_MAX_CHANNELS) { | |
| 1362 | 1369 | rv = -EINVAL; |
| 1363 | − else | |
| 1370 | + } else { | |
| 1371 | + channel = array_index_nospec(channel, IPMI_MAX_CHANNELS); | |
| 1364 | 1372 | *address = user->intf->addrinfo[channel].lun; |
| 1373 | + } | |
| 1365 | 1374 | release_ipmi_user(user, index); |
| 1366 | 1375 | |
| 1367 | 1376 | return rv; |
| @@ -2184,6 +2193,7 @@ static int check_addr(struct ipmi_smi *intf, · 816 unmodified lines | ||
| 2184 | 2193 | { |
| 2185 | 2194 | if (addr->channel >= IPMI_MAX_CHANNELS) |
| 2186 | 2195 | return -EINVAL; |
| 2196 | + addr->channel = array_index_nospec(addr->channel, IPMI_MAX_CHANNELS); | |
| 2187 | 2197 | *lun = intf->addrinfo[addr->channel].lun; |
| 2188 | 2198 | *saddr = intf->addrinfo[addr->channel].address; |
| 2189 | 2199 | return 0; |
| @@ -3291,17 +3301,9 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers, · 1101 unmodified lines | ||
| 3291 | 3301 | * Make sure the driver is actually initialized, this handles |
| 3292 | 3302 | * problems with initialization order. |
| 3293 | 3303 | */ |
| 3294 | − if (!initialized) { | |
| 3295 | − rv = ipmi_init_msghandler(); | |
| 3296 | − if (rv) | |
| 3297 | − return rv; | |
| 3298 | − /* | |
| 3299 | − * The init code doesn't return an error if it was turned | |
| 3300 | − * off, but it won't initialize. Check that. | |
| 3301 | − */ | |
| 3302 | − if (!initialized) | |
| 3303 | − return -ENODEV; | |
| 3304 | − } | |
| 3304 | + rv = ipmi_init_msghandler(); | |
| 3305 | + if (rv) | |
| 3306 | + return rv; | |
| 3305 | 3307 | |
| 3306 | 3308 | intf = kzalloc(sizeof(*intf), GFP_KERNEL); |
| 3307 | 3309 | if (!intf) |
| @@ -5017,6 +5019,22 @@ static int panic_event(struct notifier_block *this, · 1709 unmodified lines | ||
| 5017 | 5019 | return NOTIFY_DONE; |
| 5018 | 5020 | } |
| 5019 | 5021 | |
| 5022 | +/* Must be called with ipmi_interfaces_mutex held. */ | |
| 5023 | +static int ipmi_register_driver(void) | |
| 5024 | +{ | |
| 5025 | + int rv; | |
| 5026 | + | |
| 5027 | + if (drvregistered) | |
| 5028 | + return 0; | |
| 5029 | + | |
| 5030 | + rv = driver_register(&ipmidriver.driver); | |
| 5031 | + if (rv) | |
| 5032 | + pr_err("Could not register IPMI driver\n"); | |
| 5033 | + else | |
| 5034 | + drvregistered = true; | |
| 5035 | + return rv; | |
| 5036 | +} | |
| 5037 | + | |
| 5020 | 5038 | static struct notifier_block panic_block = { |
| 5021 | 5039 | .notifier_call = panic_event, |
| 5022 | 5040 | .next = NULL, |
| @@ -5027,66 +5045,75 @@ static int ipmi_init_msghandler(void) · 4 unmodified lines | ||
| 5027 | 5045 | { |
| 5028 | 5046 | int rv; |
| 5029 | 5047 | |
| 5048 | + mutex_lock(&ipmi_interfaces_mutex); | |
| 5049 | + rv = ipmi_register_driver(); | |
| 5050 | + if (rv) | |
| 5051 | + goto out; | |
| 5030 | 5052 | if (initialized) |
| 5031 | − return 0; | |
| 5032 | − | |
| 5033 | − rv = driver_register(&ipmidriver.driver); | |
| 5034 | − if (rv) { | |
| 5035 | − pr_err("Could not register IPMI driver\n"); | |
| 5036 | − return rv; | |
| 5037 | − } | |
| 5053 | + goto out; | |
| 5038 | 5054 | |
| 5039 | − pr_info("version " IPMI_DRIVER_VERSION "\n"); | |
| 5055 | + init_srcu_struct(&ipmi_interfaces_srcu); | |
| 5040 | 5056 | |
| 5041 | 5057 | timer_setup(&ipmi_timer, ipmi_timeout, 0); |
| 5042 | 5058 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); |
| 5043 | 5059 | |
| 5044 | 5060 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); |
| 5045 | 5061 | |
| 5046 | − initialized = 1; | |
| 5062 | + initialized = true; | |
| 5047 | 5063 | |
| 5048 | − return 0; | |
| 5064 | +out: | |
| 5065 | + mutex_unlock(&ipmi_interfaces_mutex); | |
| 5066 | + return rv; | |
| 5049 | 5067 | } |
| 5050 | 5068 | |
| 5051 | 5069 | static int __init ipmi_init_msghandler_mod(void) |
| 5052 | 5070 | { |
| 5053 | − ipmi_init_msghandler(); | |
| 5054 | − return 0; | |
| 5071 | + int rv; | |
| 5072 | + | |
| 5073 | + pr_info("version " IPMI_DRIVER_VERSION "\n"); | |
| 5074 | + | |
| 5075 | + mutex_lock(&ipmi_interfaces_mutex); | |
| 5076 | + rv = ipmi_register_driver(); | |
| 5077 | + mutex_unlock(&ipmi_interfaces_mutex); | |
| 5078 | + | |
| 5079 | + return rv; | |
| 5055 | 5080 | } |
| 5056 | 5081 | |
| 5057 | 5082 | static void __exit cleanup_ipmi(void) |
| 5058 | 5083 | { |
| 5059 | 5084 | int count; |
| 5060 | 5085 | |
| 5061 | − if (!initialized) | |
| 5062 | − return; | |
| 5063 | − | |
| 5064 | − atomic_notifier_chain_unregister(&panic_notifier_list, &panic_block); | |
| 5086 | + if (initialized) { | |
| 5087 | + atomic_notifier_chain_unregister(&panic_notifier_list, | |
| 5088 | + &panic_block); | |
| 5065 | 5089 | |
| 5066 | − /* | |
| 5067 | − * This can't be called if any interfaces exist, so no worry | |
| 5068 | − * about shutting down the interfaces. | |
| 5069 | − */ | |
| 5090 | + /* | |
| 5091 | + * This can't be called if any interfaces exist, so no worry | |
| 5092 | + * about shutting down the interfaces. | |
| 5093 | + */ | |
| 5070 | 5094 | |
| 5071 | − /* | |
| 5072 | − * Tell the timer to stop, then wait for it to stop. This | |
| 5073 | − * avoids problems with race conditions removing the timer | |
| 5074 | − * here. | |
| 5075 | − */ | |
| 5076 | − atomic_inc(&stop_operation); | |
| 5077 | − del_timer_sync(&ipmi_timer); | |
| 5095 | + /* | |
| 5096 | + * Tell the timer to stop, then wait for it to stop. This | |
| 5097 | + * avoids problems with race conditions removing the timer | |
| 5098 | + * here. | |
| 5099 | + */ | |
| 5100 | + atomic_inc(&stop_operation); | |
| 5101 | + del_timer_sync(&ipmi_timer); | |
| 5078 | 5102 | |
| 5079 | − driver_unregister(&ipmidriver.driver); | |
| 5103 | + initialized = false; | |
| 5080 | 5104 | |
| 5081 | − initialized = 0; | |
| 5105 | + /* Check for buffer leaks. */ | |
| 5106 | + count = atomic_read(&smi_msg_inuse_count); | |
| 5107 | + if (count != 0) | |
| 5108 | + pr_warn("SMI message count %d at exit\n", count); | |
| 5109 | + count = atomic_read(&recv_msg_inuse_count); | |
| 5110 | + if (count != 0) | |
| 5111 | + pr_warn("recv message count %d at exit\n", count); | |
| 5082 | 5112 | |
| 5083 | − /* Check for buffer leaks. */ | |
| 5084 | − count = atomic_read(&smi_msg_inuse_count); | |
| 5085 | − if (count != 0) | |
| 5086 | − pr_warn("SMI message count %d at exit\n", count); | |
| 5087 | − count = atomic_read(&recv_msg_inuse_count); | |
| 5088 | − if (count != 0) | |
| 5089 | − pr_warn("recv message count %d at exit\n", count); | |
| 5113 | + cleanup_srcu_struct(&ipmi_interfaces_srcu); | |
| 5114 | + } | |
| 5115 | + if (drvregistered) | |
| 5116 | + driver_unregister(&ipmidriver.driver); | |
| 5090 | 5117 | } |
| 5091 | 5118 | module_exit(cleanup_ipmi); |
| 5092 | 5119 | |
| @@ -632,8 +632,9 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 631 unmodified lines | ||
| 632 | 632 | |
| 633 | 633 | /* Remove the multi-part read marker. */ |
| 634 | 634 | len -= 2; |
| 635 | + data += 2; | |
| 635 | 636 | for (i = 0; i < len; i++) |
| 636 | − ssif_info->data[i] = data[i+2]; | |
| 637 | + ssif_info->data[i] = data[i]; | |
| 637 | 638 | ssif_info->multi_len = len; |
| 638 | 639 | ssif_info->multi_pos = 1; |
| 639 | 640 | |
| @@ -661,8 +662,19 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 21 unmodified lines | ||
| 661 | 662 | } |
| 662 | 663 | |
| 663 | 664 | blocknum = data[0]; |
| 665 | + len--; | |
| 666 | + data++; | |
| 667 | + | |
| 668 | + if (blocknum != 0xff && len != 31) { | |
| 669 | + /* All blocks but the last must have 31 data bytes. */ | |
| 670 | + result = -EIO; | |
| 671 | + if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) | |
| 672 | + pr_info("Received middle message <31\n"); | |
| 664 | 673 | |
| 665 | − if (ssif_info->multi_len + len - 1 > IPMI_MAX_MSG_LENGTH) { | |
| 674 | + goto continue_op; | |
| 675 | + } | |
| 676 | + | |
| 677 | + if (ssif_info->multi_len + len > IPMI_MAX_MSG_LENGTH) { | |
| 666 | 678 | /* Received message too big, abort the operation. */ |
| 667 | 679 | result = -E2BIG; |
| 668 | 680 | if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) |
| @@ -671,16 +683,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 2 unmodified lines | ||
| 671 | 683 | goto continue_op; |
| 672 | 684 | } |
| 673 | 685 | |
| 674 | − /* Remove the blocknum from the data. */ | |
| 675 | − len--; | |
| 676 | 686 | for (i = 0; i < len; i++) |
| 677 | − ssif_info->data[i + ssif_info->multi_len] = data[i + 1]; | |
| 687 | + ssif_info->data[i + ssif_info->multi_len] = data[i]; | |
| 678 | 688 | ssif_info->multi_len += len; |
| 679 | 689 | if (blocknum == 0xff) { |
| 680 | 690 | /* End of read */ |
| 681 | 691 | len = ssif_info->multi_len; |
| 682 | 692 | data = ssif_info->data; |
| 683 | − } else if (blocknum + 1 != ssif_info->multi_pos) { | |
| 693 | + } else if (blocknum != ssif_info->multi_pos) { | |
| 684 | 694 | /* |
| 685 | 695 | * Out of sequence block, just abort. Block |
| 686 | 696 | * numbers start at zero for the second block, |
| @@ -707,6 +717,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 20 unmodified lines | ||
| 707 | 717 | } |
| 708 | 718 | } |
| 709 | 719 | |
| 720 | + continue_op: | |
| 710 | 721 | if (result < 0) { |
| 711 | 722 | ssif_inc_stat(ssif_info, receive_errors); |
| 712 | 723 | } else { |
| @@ -714,8 +725,6 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, · 1 unmodified line | ||
| 714 | 725 | ssif_inc_stat(ssif_info, received_message_parts); |
| 715 | 726 | } |
| 716 | 727 | |
| 717 | − | |
| 718 | − continue_op: | |
| 719 | 728 | if (ssif_info->ssif_debug & SSIF_DEBUG_STATE) |
| 720 | 729 | pr_info("DONE 1: state = %d, result=%d\n", |
| 721 | 730 | ssif_info->ssif_state, result); |
| @@ -59,6 +59,7 @@ · 58 unmodified lines | ||
| 59 | 59 | #include <linux/mutex.h> |
| 60 | 60 | #include <linux/delay.h> |
| 61 | 61 | #include <linux/serial_8250.h> |
| 62 | +#include <linux/nospec.h> | |
| 62 | 63 | #include "smapi.h" |
| 63 | 64 | #include "mwavedd.h" |
| 64 | 65 | #include "3780i.h" |
| @@ -289,6 +290,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, · 224 unmodified lines | ||
| 289 | 290 | ipcnum); |
| 290 | 291 | return -EINVAL; |
| 291 | 292 | } |
| 293 | + ipcnum = array_index_nospec(ipcnum, | |
| 294 | + ARRAY_SIZE(pDrvData->IPCs)); | |
| 292 | 295 | PRINTK_3(TRACE_MWAVE, |
| 293 | 296 | "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC" |
| 294 | 297 | " ipcnum %x entry usIntCount %x\n", |
| @@ -317,6 +320,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, · 22 unmodified lines | ||
| 317 | 320 | " Invalid ipcnum %x\n", ipcnum); |
| 318 | 321 | return -EINVAL; |
| 319 | 322 | } |
| 323 | + ipcnum = array_index_nospec(ipcnum, | |
| 324 | + ARRAY_SIZE(pDrvData->IPCs)); | |
| 320 | 325 | PRINTK_3(TRACE_MWAVE, |
| 321 | 326 | "mwavedd::mwave_ioctl IOCTL_MW_GET_IPC" |
| 322 | 327 | " ipcnum %x, usIntCount %x\n", |
| @@ -383,6 +388,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, · 60 unmodified lines | ||
| 383 | 388 | ipcnum); |
| 384 | 389 | return -EINVAL; |
| 385 | 390 | } |
| 391 | + ipcnum = array_index_nospec(ipcnum, | |
| 392 | + ARRAY_SIZE(pDrvData->IPCs)); | |
| 386 | 393 | mutex_lock(&mwave_mutex); |
| 387 | 394 | if (pDrvData->IPCs[ipcnum].bIsEnabled == true) { |
| 388 | 395 | pDrvData->IPCs[ipcnum].bIsEnabled = false; |
| @@ -293,7 +293,6 @@ config COMMON_CLK_BD718XX · 292 unmodified lines | ||
| 293 | 293 | source "drivers/clk/actions/Kconfig" |
| 294 | 294 | source "drivers/clk/bcm/Kconfig" |
| 295 | 295 | source "drivers/clk/hisilicon/Kconfig" |
| 296 | −source "drivers/clk/imx/Kconfig" | |
| 297 | 296 | source "drivers/clk/imgtec/Kconfig" |
| 298 | 297 | source "drivers/clk/imx/Kconfig" |
| 299 | 298 | source "drivers/clk/ingenic/Kconfig" |
| @@ -262,8 +262,10 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index) · 261 unmodified lines | ||
| 262 | 262 | |
| 263 | 263 | if (vc5->clk_mux_ins == VC5_MUX_IN_XIN) |
| 264 | 264 | src = VC5_PRIM_SRC_SHDN_EN_XTAL; |
| 265 | − if (vc5->clk_mux_ins == VC5_MUX_IN_CLKIN) | |
| 265 | + else if (vc5->clk_mux_ins == VC5_MUX_IN_CLKIN) | |
| 266 | 266 | src = VC5_PRIM_SRC_SHDN_EN_CLKIN; |
| 267 | + else /* Invalid; should have been caught by vc5_probe() */ | |
| 268 | + return -EINVAL; | |
| 267 | 269 | } |
| 268 | 270 | |
| 269 | 271 | return regmap_update_bits(vc5->regmap, VC5_PRIM_SRC_SHDN, mask, src); |
| @@ -1513,9 +1513,19 @@ static int clk_fetch_parent_index(struct clk_core *core, · 1512 unmodified lines | ||
| 1513 | 1513 | if (!parent) |
| 1514 | 1514 | return -EINVAL; |
| 1515 | 1515 | |
| 1516 | − for (i = 0; i < core->num_parents; i++) | |
| 1517 | − if (clk_core_get_parent_by_index(core, i) == parent) | |
| 1516 | + for (i = 0; i < core->num_parents; i++) { | |
| 1517 | + if (core->parents[i] == parent) | |
| 1518 | + return i; | |
| 1519 | + | |
| 1520 | + if (core->parents[i]) | |
| 1521 | + continue; | |
| 1522 | + | |
| 1523 | + /* Fallback to comparing globally unique names */ | |
| 1524 | + if (!strcmp(parent->name, core->parent_names[i])) { | |
| 1525 | + core->parents[i] = parent; | |
| 1518 | 1526 | return i; |
| 1527 | + } | |
| 1528 | + } | |
| 1519 | 1529 | |
| 1520 | 1530 | return -EINVAL; |
| 1521 | 1531 | } |
| @@ -2779,7 +2789,7 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level) · 1257 unmodified lines | ||
| 2779 | 2789 | seq_printf(s, "\"protect_count\": %d,", c->protect_count); |
| 2780 | 2790 | seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c)); |
| 2781 | 2791 | seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c)); |
| 2782 | − seq_printf(s, "\"phase\": %d", clk_core_get_phase(c)); | |
| 2792 | + seq_printf(s, "\"phase\": %d,", clk_core_get_phase(c)); | |
| 2783 | 2793 | seq_printf(s, "\"duty_cycle\": %u", |
| 2784 | 2794 | clk_core_get_scaled_duty_cycle(c, 100000)); |
| 2785 | 2795 | } |
| @@ -155,13 +155,14 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, · 154 unmodified lines | ||
| 155 | 155 | { |
| 156 | 156 | struct clk_frac_pll *pll = to_clk_frac_pll(hw); |
| 157 | 157 | u32 val, divfi, divff; |
| 158 | − u64 temp64 = parent_rate; | |
| 158 | + u64 temp64; | |
| 159 | 159 | int ret; |
| 160 | 160 | |
| 161 | 161 | parent_rate *= 8; |
| 162 | 162 | rate *= 2; |
| 163 | 163 | divfi = rate / parent_rate; |
| 164 | − temp64 *= rate - divfi; | |
| 164 | + temp64 = parent_rate * divfi; | |
| 165 | + temp64 = rate - temp64; | |
| 165 | 166 | temp64 *= PLL_FRAC_DENOM; |
| 166 | 167 | do_div(temp64, parent_rate); |
| 167 | 168 | divff = temp64; |
| @@ -169,6 +169,8 @@ static int imx8qxp_lpcg_clk_probe(struct platform_device *pdev) · 168 unmodified lines | ||
| 169 | 169 | return -ENODEV; |
| 170 | 170 | |
| 171 | 171 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 172 | + if (!res) | |
| 173 | + return -EINVAL; | |
| 172 | 174 | base = devm_ioremap(dev, res->start, resource_size(res)); |
| 173 | 175 | if (!base) |
| 174 | 176 | return -ENOMEM; |
| @@ -53,7 +53,6 @@ · 52 unmodified lines | ||
| 53 | 53 | #define APMU_DISP1 0x110 |
| 54 | 54 | #define APMU_CCIC0 0x50 |
| 55 | 55 | #define APMU_CCIC1 0xf4 |
| 56 | −#define APMU_SP 0x68 | |
| 57 | 56 | #define MPMU_UART_PLL 0x14 |
| 58 | 57 | |
| 59 | 58 | struct mmp2_clk_unit { |
| @@ -210,8 +209,6 @@ static struct mmp_clk_mix_config ccic1_mix_config = { · 150 unmodified lines | ||
| 210 | 209 | .reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32), |
| 211 | 210 | }; |
| 212 | 211 | |
| 213 | −static DEFINE_SPINLOCK(sp_lock); | |
| 214 | − | |
| 215 | 212 | static struct mmp_param_mux_clk apmu_mux_clks[] = { |
| 216 | 213 | {MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock}, |
| 217 | 214 | {MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock}, |
| @@ -242,7 +239,6 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = { · 24 unmodified lines | ||
| 242 | 239 | {MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock}, |
| 243 | 240 | {MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock}, |
| 244 | 241 | {MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock}, |
| 245 | − {MMP2_CLK_SP, "sp_clk", NULL, CLK_SET_RATE_PARENT, APMU_SP, 0x1b, 0x1b, 0x0, 0, &sp_lock}, | |
| 246 | 242 | }; |
| 247 | 243 | |
| 248 | 244 | static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit) |
| @@ -215,6 +215,7 @@ config MSM_MMCC_8996 · 214 unmodified lines | ||
| 215 | 215 | |
| 216 | 216 | config MSM_GCC_8998 |
| 217 | 217 | tristate "MSM8998 Global Clock Controller" |
| 218 | + select QCOM_GDSC | |
| 218 | 219 | help |
| 219 | 220 | Support for the global clock controller on msm8998 devices. |
| 220 | 221 | Say Y if you want to use peripheral devices such as UART, SPI, |
| @@ -115,8 +115,8 @@ static const char * const gcc_parent_names_6[] = { · 114 unmodified lines | ||
| 115 | 115 | "core_bi_pll_test_se", |
| 116 | 116 | }; |
| 117 | 117 | |
| 118 | −static const char * const gcc_parent_names_7[] = { | |
| 119 | − "bi_tcxo", | |
| 118 | +static const char * const gcc_parent_names_7_ao[] = { | |
| 119 | + "bi_tcxo_ao", | |
| 120 | 120 | "gpll0", |
| 121 | 121 | "gpll0_out_even", |
| 122 | 122 | "core_bi_pll_test_se", |
| @@ -128,6 +128,12 @@ static const char * const gcc_parent_names_8[] = { · 5 unmodified lines | ||
| 128 | 128 | "core_bi_pll_test_se", |
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | +static const char * const gcc_parent_names_8_ao[] = { | |
| 132 | + "bi_tcxo_ao", | |
| 133 | + "gpll0", | |
| 134 | + "core_bi_pll_test_se", | |
| 135 | +}; | |
| 136 | + | |
| 131 | 137 | static const struct parent_map gcc_parent_map_10[] = { |
| 132 | 138 | { P_BI_TCXO, 0 }, |
| 133 | 139 | { P_GPLL0_OUT_MAIN, 1 }, |
| @@ -210,7 +216,7 @@ static struct clk_rcg2 gcc_cpuss_ahb_clk_src = { · 76 unmodified lines | ||
| 210 | 216 | .freq_tbl = ftbl_gcc_cpuss_ahb_clk_src, |
| 211 | 217 | .clkr.hw.init = &(struct clk_init_data){ |
| 212 | 218 | .name = "gcc_cpuss_ahb_clk_src", |
| 213 | − .parent_names = gcc_parent_names_7, | |
| 219 | + .parent_names = gcc_parent_names_7_ao, | |
| 214 | 220 | .num_parents = 4, |
| 215 | 221 | .ops = &clk_rcg2_ops, |
| 216 | 222 | }, |
| @@ -229,7 +235,7 @@ static struct clk_rcg2 gcc_cpuss_rbcpr_clk_src = { · 12 unmodified lines | ||
| 229 | 235 | .freq_tbl = ftbl_gcc_cpuss_rbcpr_clk_src, |
| 230 | 236 | .clkr.hw.init = &(struct clk_init_data){ |
| 231 | 237 | .name = "gcc_cpuss_rbcpr_clk_src", |
| 232 | − .parent_names = gcc_parent_names_8, | |
| 238 | + .parent_names = gcc_parent_names_8_ao, | |
| 233 | 239 | .num_parents = 3, |
| 234 | 240 | .ops = &clk_rcg2_ops, |
| 235 | 241 | }, |
| @@ -43,7 +43,7 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hwclk, · 42 unmodified lines | ||
| 43 | 43 | /* Read mdiv and fdiv from the fdbck register */ |
| 44 | 44 | reg = readl(socfpgaclk->hw.reg + 0x4); |
| 45 | 45 | mdiv = (reg & SOCFPGA_PLL_MDIV_MASK) >> SOCFPGA_PLL_MDIV_SHIFT; |
| 46 | − vco_freq = (unsigned long long)parent_rate * (mdiv + 6); | |
| 46 | + vco_freq = (unsigned long long)vco_freq * (mdiv + 6); | |
| 47 | 47 | |
| 48 | 48 | return (unsigned long)vco_freq; |
| 49 | 49 | } |
| @@ -12,17 +12,17 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | #include "stratix10-clk.h" |
| 14 | 14 | |
| 15 | −static const char * const pll_mux[] = { "osc1", "cb_intosc_hs_div2_clk", | |
| 16 | − "f2s_free_clk",}; | |
| 15 | +static const char * const pll_mux[] = { "osc1", "cb-intosc-hs-div2-clk", | |
| 16 | + "f2s-free-clk",}; | |
| 17 | 17 | static const char * const cntr_mux[] = { "main_pll", "periph_pll", |
| 18 | − "osc1", "cb_intosc_hs_div2_clk", | |
| 19 | − "f2s_free_clk"}; | |
| 20 | −static const char * const boot_mux[] = { "osc1", "cb_intosc_hs_div2_clk",}; | |
| 18 | + "osc1", "cb-intosc-hs-div2-clk", | |
| 19 | + "f2s-free-clk"}; | |
| 20 | +static const char * const boot_mux[] = { "osc1", "cb-intosc-hs-div2-clk",}; | |
| 21 | 21 | |
| 22 | 22 | static const char * const noc_free_mux[] = {"main_noc_base_clk", |
| 23 | 23 | "peri_noc_base_clk", |
| 24 | − "osc1", "cb_intosc_hs_div2_clk", | |
| 25 | − "f2s_free_clk"}; | |
| 24 | + "osc1", "cb-intosc-hs-div2-clk", | |
| 25 | + "f2s-free-clk"}; | |
| 26 | 26 | |
| 27 | 27 | static const char * const emaca_free_mux[] = {"peri_emaca_clk", "boot_clk"}; |
| 28 | 28 | static const char * const emacb_free_mux[] = {"peri_emacb_clk", "boot_clk"}; |
| @@ -33,14 +33,14 @@ static const char * const s2f_usr1_free_mux[] = {"peri_s2f_usr1_clk", "boot_clk" · 4 unmodified lines | ||
| 33 | 33 | static const char * const psi_ref_free_mux[] = {"peri_psi_ref_clk", "boot_clk"}; |
| 34 | 34 | static const char * const mpu_mux[] = { "mpu_free_clk", "boot_clk",}; |
| 35 | 35 | |
| 36 | −static const char * const s2f_usr0_mux[] = {"f2s_free_clk", "boot_clk"}; | |
| 36 | +static const char * const s2f_usr0_mux[] = {"f2s-free-clk", "boot_clk"}; | |
| 37 | 37 | static const char * const emac_mux[] = {"emaca_free_clk", "emacb_free_clk"}; |
| 38 | 38 | static const char * const noc_mux[] = {"noc_free_clk", "boot_clk"}; |
| 39 | 39 | |
| 40 | 40 | static const char * const mpu_free_mux[] = {"main_mpu_base_clk", |
| 41 | 41 | "peri_mpu_base_clk", |
| 42 | − "osc1", "cb_intosc_hs_div2_clk", | |
| 43 | − "f2s_free_clk"}; | |
| 42 | + "osc1", "cb-intosc-hs-div2-clk", | |
| 43 | + "f2s-free-clk"}; | |
| 44 | 44 | |
| 45 | 45 | /* clocks in AO (always on) controller */ |
| 46 | 46 | static const struct stratix10_pll_clock s10_pll_clks[] = { |
| @@ -133,9 +133,11 @@ static int tegra124_dfll_fcpu_remove(struct platform_device *pdev) · 132 unmodified lines | ||
| 133 | 133 | struct tegra_dfll_soc_data *soc; |
| 134 | 134 | |
| 135 | 135 | soc = tegra_dfll_unregister(pdev); |
| 136 | − if (IS_ERR(soc)) | |
| 136 | + if (IS_ERR(soc)) { | |
| 137 | 137 | dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n", |
| 138 | 138 | PTR_ERR(soc)); |
| 139 | + return PTR_ERR(soc); | |
| 140 | + } | |
| 139 | 141 | |
| 140 | 142 | tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq); |
| 141 | 143 | |
| @@ -403,8 +403,10 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div, · 402 unmodified lines | ||
| 403 | 403 | num_dividers = i; |
| 404 | 404 | |
| 405 | 405 | tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL); |
| 406 | − if (!tmp) | |
| 406 | + if (!tmp) { | |
| 407 | + *table = ERR_PTR(-ENOMEM); | |
| 407 | 408 | return -ENOMEM; |
| 409 | + } | |
| 408 | 410 | |
| 409 | 411 | valid_div = 0; |
| 410 | 412 | *width = 0; |
| @@ -439,6 +441,7 @@ struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) · 28 unmodified lines | ||
| 439 | 441 | { |
| 440 | 442 | struct clk_omap_divider *div; |
| 441 | 443 | struct clk_omap_reg *reg; |
| 444 | + int ret; | |
| 442 | 445 | |
| 443 | 446 | if (!setup) |
| 444 | 447 | return NULL; |
| @@ -458,6 +461,12 @@ struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) · 13 unmodified lines | ||
| 458 | 461 | div->flags |= CLK_DIVIDER_POWER_OF_TWO; |
| 459 | 462 | |
| 460 | 463 | div->table = _get_div_table_from_setup(setup, &div->width); |
| 464 | + if (IS_ERR(div->table)) { | |
| 465 | + ret = PTR_ERR(div->table); | |
| 466 | + kfree(div); | |
| 467 | + return ERR_PTR(ret); | |
| 468 | + } | |
| 469 | + | |
| 461 | 470 | |
| 462 | 471 | div->shift = setup->bit_shift; |
| 463 | 472 | div->latch = -EINVAL; |
| @@ -669,8 +669,8 @@ static int zynqmp_clk_setup(struct device_node *np) · 668 unmodified lines | ||
| 669 | 669 | if (ret) |
| 670 | 670 | return ret; |
| 671 | 671 | |
| 672 | − zynqmp_data = kzalloc(sizeof(*zynqmp_data) + sizeof(*zynqmp_data) * | |
| 673 | − clock_max_idx, GFP_KERNEL); | |
| 672 | + zynqmp_data = kzalloc(struct_size(zynqmp_data, hws, clock_max_idx), | |
| 673 | + GFP_KERNEL); | |
| 674 | 674 | if (!zynqmp_data) |
| 675 | 675 | return -ENOMEM; |
| 676 | 676 | |
| @@ -21,7 +21,7 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev, · 20 unmodified lines | ||
| 21 | 21 | local_irq_enable(); |
| 22 | 22 | if (!current_set_polling_and_test()) { |
| 23 | 23 | unsigned int loop_count = 0; |
| 24 | − u64 limit = TICK_USEC; | |
| 24 | + u64 limit = TICK_NSEC; | |
| 25 | 25 | int i; |
| 26 | 26 | |
| 27 | 27 | for (i = 1; i < drv->state_count; i++) { |
| @@ -692,6 +692,7 @@ config CRYPTO_DEV_BCM_SPU · 691 unmodified lines | ||
| 692 | 692 | depends on ARCH_BCM_IPROC |
| 693 | 693 | depends on MAILBOX |
| 694 | 694 | default m |
| 695 | + select CRYPTO_AUTHENC | |
| 695 | 696 | select CRYPTO_DES |
| 696 | 697 | select CRYPTO_MD5 |
| 697 | 698 | select CRYPTO_SHA1 |
| @@ -2845,44 +2845,28 @@ static int aead_authenc_setkey(struct crypto_aead *cipher, · 2844 unmodified lines | ||
| 2845 | 2845 | struct spu_hw *spu = &iproc_priv.spu; |
| 2846 | 2846 | struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); |
| 2847 | 2847 | struct crypto_tfm *tfm = crypto_aead_tfm(cipher); |
| 2848 | − struct rtattr *rta = (void *)key; | |
| 2849 | − struct crypto_authenc_key_param *param; | |
| 2850 | − const u8 *origkey = key; | |
| 2851 | − const unsigned int origkeylen = keylen; | |
| 2852 | − | |
| 2853 | − int ret = 0; | |
| 2848 | + struct crypto_authenc_keys keys; | |
| 2849 | + int ret; | |
| 2854 | 2850 | |
| 2855 | 2851 | flow_log("%s() aead:%p key:%p keylen:%u\n", __func__, cipher, key, |
| 2856 | 2852 | keylen); |
| 2857 | 2853 | flow_dump(" key: ", key, keylen); |
| 2858 | 2854 | |
| 2859 | − if (!RTA_OK(rta, keylen)) | |
| 2860 | − goto badkey; | |
| 2861 | − if (rta->rta_type != CRYPTO_AUTHENC_KEYA_PARAM) | |
| 2862 | − goto badkey; | |
| 2863 | − if (RTA_PAYLOAD(rta) < sizeof(*param)) | |
| 2855 | + ret = crypto_authenc_extractkeys(&keys, key, keylen); | |
| 2856 | + if (ret) | |
| 2864 | 2857 | goto badkey; |
| 2865 | 2858 | |
| 2866 | − param = RTA_DATA(rta); | |
| 2867 | − ctx->enckeylen = be32_to_cpu(param->enckeylen); | |
| 2868 | − | |
| 2869 | − key += RTA_ALIGN(rta->rta_len); | |
| 2870 | − keylen -= RTA_ALIGN(rta->rta_len); | |
| 2871 | − | |
| 2872 | − if (keylen < ctx->enckeylen) | |
| 2873 | − goto badkey; | |
| 2874 | − if (ctx->enckeylen > MAX_KEY_SIZE) | |
| 2859 | + if (keys.enckeylen > MAX_KEY_SIZE || | |
| 2860 | + keys.authkeylen > MAX_KEY_SIZE) | |
| 2875 | 2861 | goto badkey; |
| 2876 | 2862 | |
| 2877 | − ctx->authkeylen = keylen - ctx->enckeylen; | |
| 2878 | − | |
| 2879 | − if (ctx->authkeylen > MAX_KEY_SIZE) | |
| 2880 | − goto badkey; | |
| 2863 | + ctx->enckeylen = keys.enckeylen; | |
| 2864 | + ctx->authkeylen = keys.authkeylen; | |
| 2881 | 2865 | |
| 2882 | − memcpy(ctx->enckey, key + ctx->authkeylen, ctx->enckeylen); | |
| 2866 | + memcpy(ctx->enckey, keys.enckey, keys.enckeylen); | |
| 2883 | 2867 | /* May end up padding auth key. So make sure it's zeroed. */ |
| 2884 | 2868 | memset(ctx->authkey, 0, sizeof(ctx->authkey)); |
| 2885 | − memcpy(ctx->authkey, key, ctx->authkeylen); | |
| 2869 | + memcpy(ctx->authkey, keys.authkey, keys.authkeylen); | |
| 2886 | 2870 | |
| 2887 | 2871 | switch (ctx->alg->cipher_info.alg) { |
| 2888 | 2872 | case CIPHER_ALG_DES: |
| @@ -2890,7 +2874,7 @@ static int aead_authenc_setkey(struct crypto_aead *cipher, · 1 unmodified line | ||
| 2890 | 2874 | u32 tmp[DES_EXPKEY_WORDS]; |
| 2891 | 2875 | u32 flags = CRYPTO_TFM_RES_WEAK_KEY; |
| 2892 | 2876 | |
| 2893 | − if (des_ekey(tmp, key) == 0) { | |
| 2877 | + if (des_ekey(tmp, keys.enckey) == 0) { | |
| 2894 | 2878 | if (crypto_aead_get_flags(cipher) & |
| 2895 | 2879 | CRYPTO_TFM_REQ_WEAK_KEY) { |
| 2896 | 2880 | crypto_aead_set_flags(cipher, flags); |
| @@ -2905,7 +2889,7 @@ static int aead_authenc_setkey(struct crypto_aead *cipher, · 8 unmodified lines | ||
| 2905 | 2889 | break; |
| 2906 | 2890 | case CIPHER_ALG_3DES: |
| 2907 | 2891 | if (ctx->enckeylen == (DES_KEY_SIZE * 3)) { |
| 2908 | − const u32 *K = (const u32 *)key; | |
| 2892 | + const u32 *K = (const u32 *)keys.enckey; | |
| 2909 | 2893 | u32 flags = CRYPTO_TFM_RES_BAD_KEY_SCHED; |
| 2910 | 2894 | |
| 2911 | 2895 | if (!((K[0] ^ K[2]) | (K[1] ^ K[3])) || |
| @@ -2956,9 +2940,7 @@ static int aead_authenc_setkey(struct crypto_aead *cipher, · 44 unmodified lines | ||
| 2956 | 2940 | ctx->fallback_cipher->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; |
| 2957 | 2941 | ctx->fallback_cipher->base.crt_flags |= |
| 2958 | 2942 | tfm->crt_flags & CRYPTO_TFM_REQ_MASK; |
| 2959 | − ret = | |
| 2960 | − crypto_aead_setkey(ctx->fallback_cipher, origkey, | |
| 2961 | − origkeylen); | |
| 2943 | + ret = crypto_aead_setkey(ctx->fallback_cipher, key, keylen); | |
| 2962 | 2944 | if (ret) { |
| 2963 | 2945 | flow_log(" fallback setkey() returned:%d\n", ret); |
| 2964 | 2946 | tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; |
| @@ -3476,7 +3476,7 @@ static int __init caam_algapi_init(void) · 3475 unmodified lines | ||
| 3476 | 3476 | * Skip algorithms requiring message digests |
| 3477 | 3477 | * if MD or MD size is not supported by device. |
| 3478 | 3478 | */ |
| 3479 | − if ((c2_alg_sel & ~OP_ALG_ALGSEL_SUBMASK) == 0x40 && | |
| 3479 | + if (is_mdha(c2_alg_sel) && | |
| 3480 | 3480 | (!md_inst || t_alg->aead.maxauthsize > md_limit)) |
| 3481 | 3481 | continue; |
| 3482 | 3482 | |
| @@ -1072,13 +1072,16 @@ static int ahash_final_no_ctx(struct ahash_request *req) · 1071 unmodified lines | ||
| 1072 | 1072 | |
| 1073 | 1073 | desc = edesc->hw_desc; |
| 1074 | 1074 | |
| 1075 | − state->buf_dma = dma_map_single(jrdev, buf, buflen, DMA_TO_DEVICE); | |
| 1076 | − if (dma_mapping_error(jrdev, state->buf_dma)) { | |
| 1077 | − dev_err(jrdev, "unable to map src\n"); | |
| 1078 | − goto unmap; | |
| 1079 | − } | |
| 1075 | + if (buflen) { | |
| 1076 | + state->buf_dma = dma_map_single(jrdev, buf, buflen, | |
| 1077 | + DMA_TO_DEVICE); | |
| 1078 | + if (dma_mapping_error(jrdev, state->buf_dma)) { | |
| 1079 | + dev_err(jrdev, "unable to map src\n"); | |
| 1080 | + goto unmap; | |
| 1081 | + } | |
| 1080 | 1082 | |
| 1081 | − append_seq_in_ptr(desc, state->buf_dma, buflen, 0); | |
| 1083 | + append_seq_in_ptr(desc, state->buf_dma, buflen, 0); | |
| 1084 | + } | |
| 1082 | 1085 | |
| 1083 | 1086 | edesc->dst_dma = map_seq_out_ptr_result(desc, jrdev, req->result, |
| 1084 | 1087 | digestsize); |
| @@ -1155,6 +1155,7 @@ · 1154 unmodified lines | ||
| 1155 | 1155 | #define OP_ALG_ALGSEL_DES (0x20 << OP_ALG_ALGSEL_SHIFT) |
| 1156 | 1156 | #define OP_ALG_ALGSEL_3DES (0x21 << OP_ALG_ALGSEL_SHIFT) |
| 1157 | 1157 | #define OP_ALG_ALGSEL_ARC4 (0x30 << OP_ALG_ALGSEL_SHIFT) |
| 1158 | +#define OP_ALG_CHA_MDHA (0x40 << OP_ALG_ALGSEL_SHIFT) | |
| 1158 | 1159 | #define OP_ALG_ALGSEL_MD5 (0x40 << OP_ALG_ALGSEL_SHIFT) |
| 1159 | 1160 | #define OP_ALG_ALGSEL_SHA1 (0x41 << OP_ALG_ALGSEL_SHIFT) |
| 1160 | 1161 | #define OP_ALG_ALGSEL_SHA224 (0x42 << OP_ALG_ALGSEL_SHIFT) |
| @@ -7,6 +7,9 @@ · 6 unmodified lines | ||
| 7 | 7 | |
| 8 | 8 | #ifndef CAAM_ERROR_H |
| 9 | 9 | #define CAAM_ERROR_H |
| 10 | + | |
| 11 | +#include "desc.h" | |
| 12 | + | |
| 10 | 13 | #define CAAM_ERROR_STR_MAX 302 |
| 11 | 14 | |
| 12 | 15 | void caam_strstatus(struct device *dev, u32 status, bool qi_v2); |
| @@ -17,4 +20,10 @@ void caam_strstatus(struct device *dev, u32 status, bool qi_v2); · 4 unmodified lines | ||
| 17 | 20 | void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type, |
| 18 | 21 | int rowsize, int groupsize, struct scatterlist *sg, |
| 19 | 22 | size_t tlen, bool ascii); |
| 23 | + | |
| 24 | +static inline bool is_mdha(u32 algtype) | |
| 25 | +{ | |
| 26 | + return (algtype & OP_ALG_ALGSEL_MASK & ~OP_ALG_ALGSEL_SUBMASK) == | |
| 27 | + OP_ALG_CHA_MDHA; | |
| 28 | +} | |
| 20 | 29 | #endif /* CAAM_ERROR_H */ |
| @@ -537,6 +537,8 @@ static void process_response_list(struct nitrox_cmdq *cmdq) · 536 unmodified lines | ||
| 537 | 537 | struct nitrox_device *ndev = cmdq->ndev; |
| 538 | 538 | struct nitrox_softreq *sr; |
| 539 | 539 | int req_completed = 0, err = 0, budget; |
| 540 | + completion_t callback; | |
| 541 | + void *cb_arg; | |
| 540 | 542 | |
| 541 | 543 | /* check all pending requests */ |
| 542 | 544 | budget = atomic_read(&cmdq->pending_count); |
| @@ -564,13 +566,13 @@ static void process_response_list(struct nitrox_cmdq *cmdq) · 21 unmodified lines | ||
| 564 | 566 | smp_mb__after_atomic(); |
| 565 | 567 | /* remove from response list */ |
| 566 | 568 | response_list_del(sr, cmdq); |
| 567 | − | |
| 568 | 569 | /* ORH error code */ |
| 569 | 570 | err = READ_ONCE(*sr->resp.orh) & 0xff; |
| 571 | + callback = sr->callback; | |
| 572 | + cb_arg = sr->cb_arg; | |
| 570 | 573 | softreq_destroy(sr); |
| 571 | − | |
| 572 | − if (sr->callback) | |
| 573 | − sr->callback(sr->cb_arg, err); | |
| 574 | + if (callback) | |
| 575 | + callback(cb_arg, err); | |
| 574 | 576 | |
| 575 | 577 | req_completed++; |
| 576 | 578 | } |
| @@ -549,13 +549,12 @@ static int cc_aead_setkey(struct crypto_aead *tfm, const u8 *key, · 548 unmodified lines | ||
| 549 | 549 | unsigned int keylen) |
| 550 | 550 | { |
| 551 | 551 | struct cc_aead_ctx *ctx = crypto_aead_ctx(tfm); |
| 552 | − struct rtattr *rta = (struct rtattr *)key; | |
| 553 | 552 | struct cc_crypto_req cc_req = {}; |
| 554 | − struct crypto_authenc_key_param *param; | |
| 555 | 553 | struct cc_hw_desc desc[MAX_AEAD_SETKEY_SEQ]; |
| 556 | − int rc = -EINVAL; | |
| 557 | 554 | unsigned int seq_len = 0; |
| 558 | 555 | struct device *dev = drvdata_to_dev(ctx->drvdata); |
| 556 | + const u8 *enckey, *authkey; | |
| 557 | + int rc; | |
| 559 | 558 | |
| 560 | 559 | dev_dbg(dev, "Setting key in context @%p for %s. key=%p keylen=%u\n", |
| 561 | 560 | ctx, crypto_tfm_alg_name(crypto_aead_tfm(tfm)), key, keylen); |
| @@ -563,35 +562,33 @@ static int cc_aead_setkey(struct crypto_aead *tfm, const u8 *key, · 1 unmodified line | ||
| 563 | 562 | /* STAT_PHASE_0: Init and sanity checks */ |
| 564 | 563 | |
| 565 | 564 | if (ctx->auth_mode != DRV_HASH_NULL) { /* authenc() alg. */ |
| 566 | − if (!RTA_OK(rta, keylen)) | |
| 567 | − goto badkey; | |
| 568 | − if (rta->rta_type != CRYPTO_AUTHENC_KEYA_PARAM) | |
| 569 | − goto badkey; | |
| 570 | − if (RTA_PAYLOAD(rta) < sizeof(*param)) | |
| 571 | − goto badkey; | |
| 572 | − param = RTA_DATA(rta); | |
| 573 | − ctx->enc_keylen = be32_to_cpu(param->enckeylen); | |
| 574 | − key += RTA_ALIGN(rta->rta_len); | |
| 575 | − keylen -= RTA_ALIGN(rta->rta_len); | |
| 576 | − if (keylen < ctx->enc_keylen) | |
| 565 | + struct crypto_authenc_keys keys; | |
| 566 | + | |
| 567 | + rc = crypto_authenc_extractkeys(&keys, key, keylen); | |
| 568 | + if (rc) | |
| 577 | 569 | goto badkey; |
| 578 | − ctx->auth_keylen = keylen - ctx->enc_keylen; | |
| 570 | + enckey = keys.enckey; | |
| 571 | + authkey = keys.authkey; | |
| 572 | + ctx->enc_keylen = keys.enckeylen; | |
| 573 | + ctx->auth_keylen = keys.authkeylen; | |
| 579 | 574 | |
| 580 | 575 | if (ctx->cipher_mode == DRV_CIPHER_CTR) { |
| 581 | 576 | /* the nonce is stored in bytes at end of key */ |
| 577 | + rc = -EINVAL; | |
| 582 | 578 | if (ctx->enc_keylen < |
| 583 | 579 | (AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE)) |
| 584 | 580 | goto badkey; |
| 585 | 581 | /* Copy nonce from last 4 bytes in CTR key to |
| 586 | 582 | * first 4 bytes in CTR IV |
| 587 | 583 | */ |
| 588 | − memcpy(ctx->ctr_nonce, key + ctx->auth_keylen + | |
| 589 | − ctx->enc_keylen - CTR_RFC3686_NONCE_SIZE, | |
| 590 | − CTR_RFC3686_NONCE_SIZE); | |
| 584 | + memcpy(ctx->ctr_nonce, enckey + ctx->enc_keylen - | |
| 585 | + CTR_RFC3686_NONCE_SIZE, CTR_RFC3686_NONCE_SIZE); | |
| 591 | 586 | /* Set CTR key size */ |
| 592 | 587 | ctx->enc_keylen -= CTR_RFC3686_NONCE_SIZE; |
| 593 | 588 | } |
| 594 | 589 | } else { /* non-authenc - has just one key */ |
| 590 | + enckey = key; | |
| 591 | + authkey = NULL; | |
| 595 | 592 | ctx->enc_keylen = keylen; |
| 596 | 593 | ctx->auth_keylen = 0; |
| 597 | 594 | } |
| @@ -603,13 +600,14 @@ static int cc_aead_setkey(struct crypto_aead *tfm, const u8 *key, · 5 unmodified lines | ||
| 603 | 600 | /* STAT_PHASE_1: Copy key to ctx */ |
| 604 | 601 | |
| 605 | 602 | /* Get key material */ |
| 606 | − memcpy(ctx->enckey, key + ctx->auth_keylen, ctx->enc_keylen); | |
| 603 | + memcpy(ctx->enckey, enckey, ctx->enc_keylen); | |
| 607 | 604 | if (ctx->enc_keylen == 24) |
| 608 | 605 | memset(ctx->enckey + 24, 0, CC_AES_KEY_SIZE_MAX - 24); |
| 609 | 606 | if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { |
| 610 | − memcpy(ctx->auth_state.xcbc.xcbc_keys, key, ctx->auth_keylen); | |
| 607 | + memcpy(ctx->auth_state.xcbc.xcbc_keys, authkey, | |
| 608 | + ctx->auth_keylen); | |
| 611 | 609 | } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC */ |
| 612 | − rc = cc_get_plain_hmac_key(tfm, key, ctx->auth_keylen); | |
| 610 | + rc = cc_get_plain_hmac_key(tfm, authkey, ctx->auth_keylen); | |
| 613 | 611 | if (rc) |
| 614 | 612 | goto badkey; |
| 615 | 613 | } |
| @@ -1361,23 +1361,18 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, · 1360 unmodified lines | ||
| 1361 | 1361 | struct talitos_private *priv = dev_get_drvdata(dev); |
| 1362 | 1362 | bool is_sec1 = has_ftr_sec1(priv); |
| 1363 | 1363 | int max_len = is_sec1 ? TALITOS1_MAX_DATA_LEN : TALITOS2_MAX_DATA_LEN; |
| 1364 | − void *err; | |
| 1365 | 1364 | |
| 1366 | 1365 | if (cryptlen + authsize > max_len) { |
| 1367 | 1366 | dev_err(dev, "length exceeds h/w max limit\n"); |
| 1368 | 1367 | return ERR_PTR(-EINVAL); |
| 1369 | 1368 | } |
| 1370 | 1369 | |
| 1371 | − if (ivsize) | |
| 1372 | − iv_dma = dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE); | |
| 1373 | − | |
| 1374 | 1370 | if (!dst || dst == src) { |
| 1375 | 1371 | src_len = assoclen + cryptlen + authsize; |
| 1376 | 1372 | src_nents = sg_nents_for_len(src, src_len); |
| 1377 | 1373 | if (src_nents < 0) { |
| 1378 | 1374 | dev_err(dev, "Invalid number of src SG.\n"); |
| 1379 | − err = ERR_PTR(-EINVAL); | |
| 1380 | − goto error_sg; | |
| 1375 | + return ERR_PTR(-EINVAL); | |
| 1381 | 1376 | } |
| 1382 | 1377 | src_nents = (src_nents == 1) ? 0 : src_nents; |
| 1383 | 1378 | dst_nents = dst ? src_nents : 0; |
| @@ -1387,16 +1382,14 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, · 3 unmodified lines | ||
| 1387 | 1382 | src_nents = sg_nents_for_len(src, src_len); |
| 1388 | 1383 | if (src_nents < 0) { |
| 1389 | 1384 | dev_err(dev, "Invalid number of src SG.\n"); |
| 1390 | − err = ERR_PTR(-EINVAL); | |
| 1391 | − goto error_sg; | |
| 1385 | + return ERR_PTR(-EINVAL); | |
| 1392 | 1386 | } |
| 1393 | 1387 | src_nents = (src_nents == 1) ? 0 : src_nents; |
| 1394 | 1388 | dst_len = assoclen + cryptlen + (encrypt ? authsize : 0); |
| 1395 | 1389 | dst_nents = sg_nents_for_len(dst, dst_len); |
| 1396 | 1390 | if (dst_nents < 0) { |
| 1397 | 1391 | dev_err(dev, "Invalid number of dst SG.\n"); |
| 1398 | − err = ERR_PTR(-EINVAL); | |
| 1399 | − goto error_sg; | |
| 1392 | + return ERR_PTR(-EINVAL); | |
| 1400 | 1393 | } |
| 1401 | 1394 | dst_nents = (dst_nents == 1) ? 0 : dst_nents; |
| 1402 | 1395 | } |
| @@ -1423,11 +1416,14 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, · 20 unmodified lines | ||
| 1423 | 1416 | /* if its a ahash, add space for a second desc next to the first one */ |
| 1424 | 1417 | if (is_sec1 && !dst) |
| 1425 | 1418 | alloc_len += sizeof(struct talitos_desc); |
| 1419 | + alloc_len += ivsize; | |
| 1426 | 1420 | |
| 1427 | 1421 | edesc = kmalloc(alloc_len, GFP_DMA | flags); |
| 1428 | − if (!edesc) { | |
| 1429 | − err = ERR_PTR(-ENOMEM); | |
| 1430 | − goto error_sg; | |
| 1422 | + if (!edesc) | |
| 1423 | + return ERR_PTR(-ENOMEM); | |
| 1424 | + if (ivsize) { | |
| 1425 | + iv = memcpy(((u8 *)edesc) + alloc_len - ivsize, iv, ivsize); | |
| 1426 | + iv_dma = dma_map_single(dev, iv, ivsize, DMA_TO_DEVICE); | |
| 1431 | 1427 | } |
| 1432 | 1428 | memset(&edesc->desc, 0, sizeof(edesc->desc)); |
| 1433 | 1429 | |
| @@ -1445,10 +1441,6 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, · 11 unmodified lines | ||
| 1445 | 1441 | DMA_BIDIRECTIONAL); |
| 1446 | 1442 | } |
| 1447 | 1443 | return edesc; |
| 1448 | −error_sg: | |
| 1449 | − if (iv_dma) | |
| 1450 | − dma_unmap_single(dev, iv_dma, ivsize, DMA_TO_DEVICE); | |
| 1451 | − return err; | |
| 1452 | 1444 | } |
| 1453 | 1445 | |
| 1454 | 1446 | static struct talitos_edesc *aead_edesc_alloc(struct aead_request *areq, u8 *iv, |
| @@ -295,8 +295,8 @@ struct altr_sdram_mc_data { · 294 unmodified lines | ||
| 295 | 295 | #define S10_SYSMGR_ECC_INTSTAT_DERR_OFST 0xA0 |
| 296 | 296 | |
| 297 | 297 | /* Sticky registers for Uncorrected Errors */ |
| 298 | −#define S10_SYSMGR_UE_VAL_OFST 0x120 | |
| 299 | −#define S10_SYSMGR_UE_ADDR_OFST 0x124 | |
| 298 | +#define S10_SYSMGR_UE_VAL_OFST 0x220 | |
| 299 | +#define S10_SYSMGR_UE_ADDR_OFST 0x224 | |
| 300 | 300 | |
| 301 | 301 | #define S10_DDR0_IRQ_MASK BIT(16) |
| 302 | 302 | |
| @@ -1144,10 +1144,6 @@ static int sbp2_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) · 1143 unmodified lines | ||
| 1144 | 1144 | if (device->is_local) |
| 1145 | 1145 | return -ENODEV; |
| 1146 | 1146 | |
| 1147 | − if (dma_get_max_seg_size(device->card->device) > SBP2_MAX_SEG_SIZE) | |
| 1148 | − WARN_ON(dma_set_max_seg_size(device->card->device, | |
| 1149 | − SBP2_MAX_SEG_SIZE)); | |
| 1150 | − | |
| 1151 | 1147 | shost = scsi_host_alloc(&scsi_driver_template, sizeof(*tgt)); |
| 1152 | 1148 | if (shost == NULL) |
| 1153 | 1149 | return -ENOMEM; |
| @@ -1610,6 +1606,7 @@ static struct scsi_host_template scsi_driver_template = { · 456 unmodified lines | ||
| 1610 | 1606 | .eh_abort_handler = sbp2_scsi_abort, |
| 1611 | 1607 | .this_id = -1, |
| 1612 | 1608 | .sg_tablesize = SG_ALL, |
| 1609 | + .max_segment_size = SBP2_MAX_SEG_SIZE, | |
| 1613 | 1610 | .can_queue = 1, |
| 1614 | 1611 | .sdev_attrs = sbp2_scsi_sysfs_attrs, |
| 1615 | 1612 | }; |
| @@ -37,8 +37,9 @@ extern u64 efi_system_table; · 36 unmodified lines | ||
| 37 | 37 | static struct ptdump_info efi_ptdump_info = { |
| 38 | 38 | .mm = &efi_mm, |
| 39 | 39 | .markers = (struct addr_marker[]){ |
| 40 | − { 0, "UEFI runtime start" }, | |
| 41 | − { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" } | |
| 40 | + { 0, "UEFI runtime start" }, | |
| 41 | + { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" }, | |
| 42 | + { -1, NULL } | |
| 42 | 43 | }, |
| 43 | 44 | .base_addr = 0, |
| 44 | 45 | }; |
| @@ -66,8 +66,10 @@ static int altr_a10sr_gpio_direction_input(struct gpio_chip *gc, · 65 unmodified lines | ||
| 66 | 66 | static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, |
| 67 | 67 | unsigned int nr, int value) |
| 68 | 68 | { |
| 69 | − if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) | |
| 69 | + if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) { | |
| 70 | + altr_a10sr_gpio_set(gc, nr, value); | |
| 70 | 71 | return 0; |
| 72 | + } | |
| 71 | 73 | return -EINVAL; |
| 72 | 74 | } |
| 73 | 75 | |
| @@ -180,7 +180,18 @@ static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset) · 179 unmodified lines | ||
| 180 | 180 | |
| 181 | 181 | static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) |
| 182 | 182 | { |
| 183 | − return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | |
| 183 | + struct sprd_eic *sprd_eic = gpiochip_get_data(chip); | |
| 184 | + | |
| 185 | + switch (sprd_eic->type) { | |
| 186 | + case SPRD_EIC_DEBOUNCE: | |
| 187 | + return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | |
| 188 | + case SPRD_EIC_ASYNC: | |
| 189 | + return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA); | |
| 190 | + case SPRD_EIC_SYNC: | |
| 191 | + return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA); | |
| 192 | + default: | |
| 193 | + return -ENOTSUPP; | |
| 194 | + } | |
| 184 | 195 | } |
| 185 | 196 | |
| 186 | 197 | static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) |
| @@ -368,6 +379,7 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) · 181 unmodified lines | ||
| 368 | 379 | irq_set_handler_locked(data, handle_edge_irq); |
| 369 | 380 | break; |
| 370 | 381 | case IRQ_TYPE_EDGE_BOTH: |
| 382 | + sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0); | |
| 371 | 383 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); |
| 372 | 384 | irq_set_handler_locked(data, handle_edge_irq); |
| 373 | 385 | break; |
| @@ -289,7 +289,7 @@ static bool pca953x_volatile_register(struct device *dev, unsigned int reg) · 288 unmodified lines | ||
| 289 | 289 | return pca953x_check_register(chip, reg, bank); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | −const struct regmap_config pca953x_i2c_regmap = { | |
| 292 | +static const struct regmap_config pca953x_i2c_regmap = { | |
| 293 | 293 | .reg_bits = 8, |
| 294 | 294 | .val_bits = 8, |
| 295 | 295 | |
| @@ -84,6 +84,7 @@ MODULE_DEVICE_TABLE(of, pcf857x_of_table); · 83 unmodified lines | ||
| 84 | 84 | */ |
| 85 | 85 | struct pcf857x { |
| 86 | 86 | struct gpio_chip chip; |
| 87 | + struct irq_chip irqchip; | |
| 87 | 88 | struct i2c_client *client; |
| 88 | 89 | struct mutex lock; /* protect 'out' */ |
| 89 | 90 | unsigned out; /* software latch */ |
| @@ -252,18 +253,6 @@ static void pcf857x_irq_bus_sync_unlock(struct irq_data *data) · 162 unmodified lines | ||
| 252 | 253 | mutex_unlock(&gpio->lock); |
| 253 | 254 | } |
| 254 | 255 | |
| 255 | −static struct irq_chip pcf857x_irq_chip = { | |
| 256 | − .name = "pcf857x", | |
| 257 | − .irq_enable = pcf857x_irq_enable, | |
| 258 | − .irq_disable = pcf857x_irq_disable, | |
| 259 | − .irq_ack = noop, | |
| 260 | − .irq_mask = noop, | |
| 261 | − .irq_unmask = noop, | |
| 262 | − .irq_set_wake = pcf857x_irq_set_wake, | |
| 263 | − .irq_bus_lock = pcf857x_irq_bus_lock, | |
| 264 | − .irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | |
| 265 | −}; | |
| 266 | − | |
| 267 | 256 | /*-------------------------------------------------------------------------*/ |
| 268 | 257 | |
| 269 | 258 | static int pcf857x_probe(struct i2c_client *client, |
| @@ -376,8 +365,17 @@ static int pcf857x_probe(struct i2c_client *client, · 106 unmodified lines | ||
| 376 | 365 | |
| 377 | 366 | /* Enable irqchip if we have an interrupt */ |
| 378 | 367 | if (client->irq) { |
| 368 | + gpio->irqchip.name = "pcf857x", | |
| 369 | + gpio->irqchip.irq_enable = pcf857x_irq_enable, | |
| 370 | + gpio->irqchip.irq_disable = pcf857x_irq_disable, | |
| 371 | + gpio->irqchip.irq_ack = noop, | |
| 372 | + gpio->irqchip.irq_mask = noop, | |
| 373 | + gpio->irqchip.irq_unmask = noop, | |
| 374 | + gpio->irqchip.irq_set_wake = pcf857x_irq_set_wake, | |
| 375 | + gpio->irqchip.irq_bus_lock = pcf857x_irq_bus_lock, | |
| 376 | + gpio->irqchip.irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | |
| 379 | 377 | status = gpiochip_irqchip_add_nested(&gpio->chip, |
| 380 | − &pcf857x_irq_chip, | |
| 378 | + &gpio->irqchip, | |
| 381 | 379 | 0, handle_level_irq, |
| 382 | 380 | IRQ_TYPE_NONE); |
| 383 | 381 | if (status) { |
| @@ -392,7 +390,7 @@ static int pcf857x_probe(struct i2c_client *client, · 8 unmodified lines | ||
| 392 | 390 | if (status) |
| 393 | 391 | goto fail; |
| 394 | 392 | |
| 395 | − gpiochip_set_nested_irqchip(&gpio->chip, &pcf857x_irq_chip, | |
| 393 | + gpiochip_set_nested_irqchip(&gpio->chip, &gpio->irqchip, | |
| 396 | 394 | client->irq); |
| 397 | 395 | gpio->irq_parent = client->irq; |
| 398 | 396 | } |
| @@ -253,6 +253,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) · 252 unmodified lines | ||
| 253 | 253 | struct vf610_gpio_port *port; |
| 254 | 254 | struct resource *iores; |
| 255 | 255 | struct gpio_chip *gc; |
| 256 | + int i; | |
| 256 | 257 | int ret; |
| 257 | 258 | |
| 258 | 259 | port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); |
| @@ -319,6 +320,10 @@ static int vf610_gpio_probe(struct platform_device *pdev) · 60 unmodified lines | ||
| 319 | 320 | if (ret < 0) |
| 320 | 321 | return ret; |
| 321 | 322 | |
| 323 | + /* Mask all GPIO interrupts */ | |
| 324 | + for (i = 0; i < gc->ngpio; i++) | |
| 325 | + vf610_gpio_writel(0, port->base + PORT_PCR(i)); | |
| 326 | + | |
| 322 | 327 | /* Clear the interrupt status register for all GPIO's */ |
| 323 | 328 | vf610_gpio_writel(~0, port->base + PORT_ISFR); |
| 324 | 329 | |
| @@ -357,8 +357,6 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) · 356 unmodified lines | ||
| 357 | 357 | mutex_unlock(&acpi_gpio_deferred_req_irqs_lock); |
| 358 | 358 | |
| 359 | 359 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { |
| 360 | − struct gpio_desc *desc; | |
| 361 | − | |
| 362 | 360 | if (event->irq_requested) { |
| 363 | 361 | if (event->irq_is_wake) |
| 364 | 362 | disable_irq_wake(event->irq); |
| @@ -366,11 +364,8 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) · 1 unmodified line | ||
| 366 | 364 | free_irq(event->irq, event); |
| 367 | 365 | } |
| 368 | 366 | |
| 369 | − desc = event->desc; | |
| 370 | − if (WARN_ON(IS_ERR(desc))) | |
| 371 | − continue; | |
| 372 | 367 | gpiochip_unlock_as_irq(chip, event->pin); |
| 373 | − gpiochip_free_own_desc(desc); | |
| 368 | + gpiochip_free_own_desc(event->desc); | |
| 374 | 369 | list_del(&event->node); |
| 375 | 370 | kfree(event); |
| 376 | 371 | } |
| @@ -828,7 +828,14 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p) · 827 unmodified lines | ||
| 828 | 828 | /* Do not leak kernel stack to userspace */ |
| 829 | 829 | memset(&ge, 0, sizeof(ge)); |
| 830 | 830 | |
| 831 | − ge.timestamp = le->timestamp; | |
| 831 | + /* | |
| 832 | + * We may be running from a nested threaded interrupt in which case | |
| 833 | + * we didn't get the timestamp from lineevent_irq_handler(). | |
| 834 | + */ | |
| 835 | + if (!le->timestamp) | |
| 836 | + ge.timestamp = ktime_get_real_ns(); | |
| 837 | + else | |
| 838 | + ge.timestamp = le->timestamp; | |
| 832 | 839 | |
| 833 | 840 | if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE |
| 834 | 841 | && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { |
| @@ -576,6 +576,7 @@ static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = { · 575 unmodified lines | ||
| 576 | 576 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
| 577 | 577 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
| 578 | 578 | { 0x1002, 0x6900, 0x1025, 0x125A, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
| 579 | + { 0x1002, 0x6900, 0x17AA, 0x3806, AMDGPU_PX_QUIRK_FORCE_ATPX }, | |
| 579 | 580 | { 0, 0, 0, 0, 0 }, |
| 580 | 581 | }; |
| 581 | 582 | |
| @@ -531,17 +531,6 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev, · 530 unmodified lines | ||
| 531 | 531 | struct drm_gem_object *obj; |
| 532 | 532 | struct amdgpu_framebuffer *amdgpu_fb; |
| 533 | 533 | int ret; |
| 534 | − int height; | |
| 535 | − struct amdgpu_device *adev = dev->dev_private; | |
| 536 | − int cpp = drm_format_plane_cpp(mode_cmd->pixel_format, 0); | |
| 537 | − int pitch = mode_cmd->pitches[0] / cpp; | |
| 538 | − | |
| 539 | − pitch = amdgpu_align_pitch(adev, pitch, cpp, false); | |
| 540 | − if (mode_cmd->pitches[0] != pitch) { | |
| 541 | − DRM_DEBUG_KMS("Invalid pitch: expecting %d but got %d\n", | |
| 542 | − pitch, mode_cmd->pitches[0]); | |
| 543 | − return ERR_PTR(-EINVAL); | |
| 544 | − } | |
| 545 | 534 | |
| 546 | 535 | obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]); |
| 547 | 536 | if (obj == NULL) { |
| @@ -556,13 +545,6 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev, · 8 unmodified lines | ||
| 556 | 545 | return ERR_PTR(-EINVAL); |
| 557 | 546 | } |
| 558 | 547 | |
| 559 | − height = ALIGN(mode_cmd->height, 8); | |
| 560 | − if (obj->size < pitch * height) { | |
| 561 | − DRM_DEBUG_KMS("Invalid GEM size: expecting >= %d but got %zu\n", | |
| 562 | − pitch * height, obj->size); | |
| 563 | − return ERR_PTR(-EINVAL); | |
| 564 | − } | |
| 565 | − | |
| 566 | 548 | amdgpu_fb = kzalloc(sizeof(*amdgpu_fb), GFP_KERNEL); |
| 567 | 549 | if (amdgpu_fb == NULL) { |
| 568 | 550 | drm_gem_object_put_unlocked(obj); |
| @@ -4,8 +4,8 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | config HSA_AMD |
| 6 | 6 | bool "HSA kernel driver for AMD GPU devices" |
| 7 | − depends on DRM_AMDGPU && X86_64 | |
| 8 | − imply AMD_IOMMU_V2 | |
| 7 | + depends on DRM_AMDGPU && (X86_64 || ARM64) | |
| 8 | + imply AMD_IOMMU_V2 if X86_64 | |
| 9 | 9 | select MMU_NOTIFIER |
| 10 | 10 | help |
| 11 | 11 | Enable this if you want to use HSA features on AMD GPU devices. |
| @@ -863,6 +863,7 @@ static int kfd_fill_mem_info_for_cpu(int numa_node_id, int *avail_size, · 862 unmodified lines | ||
| 863 | 863 | return 0; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | +#if CONFIG_X86_64 | |
| 866 | 867 | static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size, |
| 867 | 868 | uint32_t *num_entries, |
| 868 | 869 | struct crat_subtype_iolink *sub_type_hdr) |
| @@ -905,6 +906,7 @@ static int kfd_fill_iolink_info_for_cpu(int numa_node_id, int *avail_size, · 36 unmodified lines | ||
| 905 | 906 | |
| 906 | 907 | return 0; |
| 907 | 908 | } |
| 909 | +#endif | |
| 908 | 910 | |
| 909 | 911 | /* kfd_create_vcrat_image_cpu - Create Virtual CRAT for CPU |
| 910 | 912 | * |
| @@ -920,7 +922,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size) · 9 unmodified lines | ||
| 920 | 922 | struct crat_subtype_generic *sub_type_hdr; |
| 921 | 923 | int avail_size = *size; |
| 922 | 924 | int numa_node_id; |
| 925 | +#ifdef CONFIG_X86_64 | |
| 923 | 926 | uint32_t entries = 0; |
| 927 | +#endif | |
| 924 | 928 | int ret = 0; |
| 925 | 929 | |
| 926 | 930 | if (!pcrat_image || avail_size < VCRAT_SIZE_FOR_CPU) |
| @@ -982,6 +986,7 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size) · 55 unmodified lines | ||
| 982 | 986 | sub_type_hdr->length); |
| 983 | 987 | |
| 984 | 988 | /* Fill in Subtype: IO Link */ |
| 989 | +#ifdef CONFIG_X86_64 | |
| 985 | 990 | ret = kfd_fill_iolink_info_for_cpu(numa_node_id, &avail_size, |
| 986 | 991 | &entries, |
| 987 | 992 | (struct crat_subtype_iolink *)sub_type_hdr); |
| @@ -992,6 +997,9 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size) · 4 unmodified lines | ||
| 992 | 997 | |
| 993 | 998 | sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr + |
| 994 | 999 | sub_type_hdr->length * entries); |
| 1000 | +#else | |
| 1001 | + pr_info("IO link not available for non x86 platforms\n"); | |
| 1002 | +#endif | |
| 995 | 1003 | |
| 996 | 1004 | crat_table->num_domains++; |
| 997 | 1005 | } |
| @@ -1093,8 +1093,6 @@ static uint32_t kfd_generate_gpu_id(struct kfd_dev *gpu) · 1092 unmodified lines | ||
| 1093 | 1093 | * the GPU device is not already present in the topology device |
| 1094 | 1094 | * list then return NULL. This means a new topology device has to |
| 1095 | 1095 | * be created for this GPU. |
| 1096 | − * TODO: Rather than assiging @gpu to first topology device withtout | |
| 1097 | − * gpu attached, it will better to have more stringent check. | |
| 1098 | 1096 | */ |
| 1099 | 1097 | static struct kfd_topology_device *kfd_assign_gpu(struct kfd_dev *gpu) |
| 1100 | 1098 | { |
| @@ -1102,12 +1100,20 @@ static struct kfd_topology_device *kfd_assign_gpu(struct kfd_dev *gpu) · 1 unmodified line | ||
| 1102 | 1100 | struct kfd_topology_device *out_dev = NULL; |
| 1103 | 1101 | |
| 1104 | 1102 | down_write(&topology_lock); |
| 1105 | − list_for_each_entry(dev, &topology_device_list, list) | |
| 1103 | + list_for_each_entry(dev, &topology_device_list, list) { | |
| 1104 | + /* Discrete GPUs need their own topology device list | |
| 1105 | + * entries. Don't assign them to CPU/APU nodes. | |
| 1106 | + */ | |
| 1107 | + if (!gpu->device_info->needs_iommu_device && | |
| 1108 | + dev->node_props.cpu_cores_count) | |
| 1109 | + continue; | |
| 1110 | + | |
| 1106 | 1111 | if (!dev->gpu && (dev->node_props.simd_count > 0)) { |
| 1107 | 1112 | dev->gpu = gpu; |
| 1108 | 1113 | out_dev = dev; |
| 1109 | 1114 | break; |
| 1110 | 1115 | } |
| 1116 | + } | |
| 1111 | 1117 | up_write(&topology_lock); |
| 1112 | 1118 | return out_dev; |
| 1113 | 1119 | } |
| @@ -1392,7 +1398,6 @@ int kfd_topology_enum_kfd_devices(uint8_t idx, struct kfd_dev **kdev) · 278 unmodified lines | ||
| 1392 | 1398 | |
| 1393 | 1399 | static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask) |
| 1394 | 1400 | { |
| 1395 | − const struct cpuinfo_x86 *cpuinfo; | |
| 1396 | 1401 | int first_cpu_of_numa_node; |
| 1397 | 1402 | |
| 1398 | 1403 | if (!cpumask || cpumask == cpu_none_mask) |
| @@ -1400,9 +1405,11 @@ static int kfd_cpumask_to_apic_id(const struct cpumask *cpumask) · 1 unmodified line | ||
| 1400 | 1405 | first_cpu_of_numa_node = cpumask_first(cpumask); |
| 1401 | 1406 | if (first_cpu_of_numa_node >= nr_cpu_ids) |
| 1402 | 1407 | return -1; |
| 1403 | − cpuinfo = &cpu_data(first_cpu_of_numa_node); | |
| 1404 | − | |
| 1405 | − return cpuinfo->apicid; | |
| 1408 | +#ifdef CONFIG_X86_64 | |
| 1409 | + return cpu_data(first_cpu_of_numa_node).apicid; | |
| 1410 | +#else | |
| 1411 | + return first_cpu_of_numa_node; | |
| 1412 | +#endif | |
| 1406 | 1413 | } |
| 1407 | 1414 | |
| 1408 | 1415 | /* kfd_numa_node_to_apic_id - Returns the APIC ID of the first logical processor |
| @@ -1772,7 +1772,7 @@ static int amdgpu_dm_backlight_update_status(struct backlight_device *bd) · 1771 unmodified lines | ||
| 1772 | 1772 | + caps.min_input_signal * 0x101; |
| 1773 | 1773 | |
| 1774 | 1774 | if (dc_link_set_backlight_level(dm->backlight_link, |
| 1775 | − brightness, 0, 0)) | |
| 1775 | + brightness, 0)) | |
| 1776 | 1776 | return 0; |
| 1777 | 1777 | else |
| 1778 | 1778 | return 1; |
| @@ -5933,7 +5933,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, · 4154 unmodified lines | ||
| 5933 | 5933 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { |
| 5934 | 5934 | if (!drm_atomic_crtc_needs_modeset(new_crtc_state) && |
| 5935 | 5935 | !new_crtc_state->color_mgmt_changed && |
| 5936 | − !new_crtc_state->vrr_enabled) | |
| 5936 | + old_crtc_state->vrr_enabled == new_crtc_state->vrr_enabled) | |
| 5937 | 5937 | continue; |
| 5938 | 5938 | |
| 5939 | 5939 | if (!new_crtc_state->enable) |
| @@ -2190,8 +2190,7 @@ int dc_link_get_backlight_level(const struct dc_link *link) · 2189 unmodified lines | ||
| 2190 | 2190 | |
| 2191 | 2191 | bool dc_link_set_backlight_level(const struct dc_link *link, |
| 2192 | 2192 | uint32_t backlight_pwm_u16_16, |
| 2193 | − uint32_t frame_ramp, | |
| 2194 | − const struct dc_stream_state *stream) | |
| 2193 | + uint32_t frame_ramp) | |
| 2195 | 2194 | { |
| 2196 | 2195 | struct dc *core_dc = link->ctx->dc; |
| 2197 | 2196 | struct abm *abm = core_dc->res_pool->abm; |
| @@ -2206,10 +2205,6 @@ bool dc_link_set_backlight_level(const struct dc_link *link, · 8 unmodified lines | ||
| 2206 | 2205 | (abm->funcs->set_backlight_level_pwm == NULL)) |
| 2207 | 2206 | return false; |
| 2208 | 2207 | |
| 2209 | − if (stream) | |
| 2210 | − ((struct dc_stream_state *)stream)->bl_pwm_level = | |
| 2211 | − backlight_pwm_u16_16; | |
| 2212 | − | |
| 2213 | 2208 | use_smooth_brightness = dmcu->funcs->is_dmcu_initialized(dmcu); |
| 2214 | 2209 | |
| 2215 | 2210 | DC_LOG_BACKLIGHT("New Backlight level: %d (0x%X)\n", |
| @@ -2637,11 +2632,6 @@ void core_link_enable_stream( · 421 unmodified lines | ||
| 2637 | 2632 | |
| 2638 | 2633 | if (dc_is_dp_signal(pipe_ctx->stream->signal)) |
| 2639 | 2634 | enable_stream_features(pipe_ctx); |
| 2640 | − | |
| 2641 | − dc_link_set_backlight_level(pipe_ctx->stream->sink->link, | |
| 2642 | − pipe_ctx->stream->bl_pwm_level, | |
| 2643 | − 0, | |
| 2644 | − pipe_ctx->stream); | |
| 2645 | 2635 | } |
| 2646 | 2636 | |
| 2647 | 2637 | } |
| @@ -146,8 +146,7 @@ static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_ · 145 unmodified lines | ||
| 146 | 146 | */ |
| 147 | 147 | bool dc_link_set_backlight_level(const struct dc_link *dc_link, |
| 148 | 148 | uint32_t backlight_pwm_u16_16, |
| 149 | − uint32_t frame_ramp, | |
| 150 | − const struct dc_stream_state *stream); | |
| 149 | + uint32_t frame_ramp); | |
| 151 | 150 | |
| 152 | 151 | int dc_link_get_backlight_level(const struct dc_link *dc_link); |
| 153 | 152 | |
| @@ -91,7 +91,6 @@ struct dc_stream_state { · 90 unmodified lines | ||
| 91 | 91 | |
| 92 | 92 | /* DMCU info */ |
| 93 | 93 | unsigned int abm_level; |
| 94 | − unsigned int bl_pwm_level; | |
| 95 | 94 | |
| 96 | 95 | /* from core_stream struct */ |
| 97 | 96 | struct dc_context *ctx; |
| @@ -1000,7 +1000,7 @@ void dce110_enable_audio_stream(struct pipe_ctx *pipe_ctx) · 999 unmodified lines | ||
| 1000 | 1000 | |
| 1001 | 1001 | pipe_ctx->stream_res.audio->funcs->az_enable(pipe_ctx->stream_res.audio); |
| 1002 | 1002 | |
| 1003 | − if (num_audio == 1 && pp_smu != NULL && pp_smu->set_pme_wa_enable != NULL) | |
| 1003 | + if (num_audio >= 1 && pp_smu != NULL && pp_smu->set_pme_wa_enable != NULL) | |
| 1004 | 1004 | /*this is the first audio. apply the PME w/a in order to wake AZ from D3*/ |
| 1005 | 1005 | pp_smu->set_pme_wa_enable(&pp_smu->pp_smu); |
| 1006 | 1006 | /* un-mute audio */ |
| @@ -1017,6 +1017,8 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option) · 10 unmodified lines | ||
| 1017 | 1017 | pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control( |
| 1018 | 1018 | pipe_ctx->stream_res.stream_enc, true); |
| 1019 | 1019 | if (pipe_ctx->stream_res.audio) { |
| 1020 | + struct pp_smu_funcs_rv *pp_smu = dc->res_pool->pp_smu; | |
| 1021 | + | |
| 1020 | 1022 | if (option != KEEP_ACQUIRED_RESOURCE || |
| 1021 | 1023 | !dc->debug.az_endpoint_mute_only) { |
| 1022 | 1024 | /*only disalbe az_endpoint if power down or free*/ |
| @@ -1036,6 +1038,9 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option) · 13 unmodified lines | ||
| 1036 | 1038 | update_audio_usage(&dc->current_state->res_ctx, dc->res_pool, pipe_ctx->stream_res.audio, false); |
| 1037 | 1039 | pipe_ctx->stream_res.audio = NULL; |
| 1038 | 1040 | } |
| 1041 | + if (pp_smu != NULL && pp_smu->set_pme_wa_enable != NULL) | |
| 1042 | + /*this is the first audio. apply the PME w/a in order to wake AZ from D3*/ | |
| 1043 | + pp_smu->set_pme_wa_enable(&pp_smu->pp_smu); | |
| 1039 | 1044 | |
| 1040 | 1045 | /* TODO: notify audio driver for if audio modes list changed |
| 1041 | 1046 | * add audio mode list change flag */ |
| @@ -463,7 +463,7 @@ void dpp1_set_cursor_position( · 462 unmodified lines | ||
| 463 | 463 | if (src_y_offset >= (int)param->viewport.height) |
| 464 | 464 | cur_en = 0; /* not visible beyond bottom edge*/ |
| 465 | 465 | |
| 466 | − if (src_y_offset < 0) | |
| 466 | + if (src_y_offset + (int)height <= 0) | |
| 467 | 467 | cur_en = 0; /* not visible beyond top edge*/ |
| 468 | 468 | |
| 469 | 469 | REG_UPDATE(CURSOR0_CONTROL, |
| @@ -1140,7 +1140,7 @@ void hubp1_cursor_set_position( · 1139 unmodified lines | ||
| 1140 | 1140 | if (src_y_offset >= (int)param->viewport.height) |
| 1141 | 1141 | cur_en = 0; /* not visible beyond bottom edge*/ |
| 1142 | 1142 | |
| 1143 | − if (src_y_offset < 0) //+ (int)hubp->curs_attr.height | |
| 1143 | + if (src_y_offset + (int)hubp->curs_attr.height <= 0) | |
| 1144 | 1144 | cur_en = 0; /* not visible beyond top edge*/ |
| 1145 | 1145 | |
| 1146 | 1146 | if (cur_en && REG_READ(CURSOR_SURFACE_ADDRESS) == 0) |
| @@ -2355,29 +2355,22 @@ static void dcn10_apply_ctx_for_surface( · 2354 unmodified lines | ||
| 2355 | 2355 | top_pipe_to_program->plane_state->update_flags.bits.full_update) |
| 2356 | 2356 | for (i = 0; i < dc->res_pool->pipe_count; i++) { |
| 2357 | 2357 | struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; |
| 2358 | − | |
| 2358 | + tg = pipe_ctx->stream_res.tg; | |
| 2359 | 2359 | /* Skip inactive pipes and ones already updated */ |
| 2360 | 2360 | if (!pipe_ctx->stream || pipe_ctx->stream == stream |
| 2361 | − || !pipe_ctx->plane_state) | |
| 2361 | + || !pipe_ctx->plane_state | |
| 2362 | + || !tg->funcs->is_tg_enabled(tg)) | |
| 2362 | 2363 | continue; |
| 2363 | 2364 | |
| 2364 | − pipe_ctx->stream_res.tg->funcs->lock(pipe_ctx->stream_res.tg); | |
| 2365 | + tg->funcs->lock(tg); | |
| 2365 | 2366 | |
| 2366 | 2367 | pipe_ctx->plane_res.hubp->funcs->hubp_setup_interdependent( |
| 2367 | 2368 | pipe_ctx->plane_res.hubp, |
| 2368 | 2369 | &pipe_ctx->dlg_regs, |
| 2369 | 2370 | &pipe_ctx->ttu_regs); |
| 2370 | − } | |
| 2371 | − | |
| 2372 | − for (i = 0; i < dc->res_pool->pipe_count; i++) { | |
| 2373 | − struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; | |
| 2374 | 2371 | |
| 2375 | − if (!pipe_ctx->stream || pipe_ctx->stream == stream | |
| 2376 | − || !pipe_ctx->plane_state) | |
| 2377 | − continue; | |
| 2378 | − | |
| 2379 | − dcn10_pipe_control_lock(dc, pipe_ctx, false); | |
| 2380 | − } | |
| 2372 | + tg->funcs->unlock(tg); | |
| 2373 | + } | |
| 2381 | 2374 | |
| 2382 | 2375 | if (num_planes == 0) |
| 2383 | 2376 | false_optc_underflow_wa(dc, stream, tg); |
| @@ -57,6 +57,7 @@ static const unsigned char abm_config[abm_defines_max_config][abm_defines_max_le · 56 unmodified lines | ||
| 57 | 57 | #define NUM_POWER_FN_SEGS 8 |
| 58 | 58 | #define NUM_BL_CURVE_SEGS 16 |
| 59 | 59 | |
| 60 | +#pragma pack(push, 1) | |
| 60 | 61 | /* NOTE: iRAM is 256B in size */ |
| 61 | 62 | struct iram_table_v_2 { |
| 62 | 63 | /* flags */ |
| @@ -100,6 +101,7 @@ struct iram_table_v_2 { · 37 unmodified lines | ||
| 100 | 101 | uint8_t dummy8; /* 0xfe */ |
| 101 | 102 | uint8_t dummy9; /* 0xff */ |
| 102 | 103 | }; |
| 104 | +#pragma pack(pop) | |
| 103 | 105 | |
| 104 | 106 | static uint16_t backlight_8_to_16(unsigned int backlight_8bit) |
| 105 | 107 | { |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | #include "vega10_pptable.h" |
| 33 | 33 | |
| 34 | 34 | #define NUM_DSPCLK_LEVELS 8 |
| 35 | +#define VEGA10_ENGINECLOCK_HARDMAX 198000 | |
| 35 | 36 | |
| 36 | 37 | static void set_hw_cap(struct pp_hwmgr *hwmgr, bool enable, |
| 37 | 38 | enum phm_platform_caps cap) |
| @@ -258,7 +259,26 @@ static int init_over_drive_limits( · 220 unmodified lines | ||
| 258 | 259 | struct pp_hwmgr *hwmgr, |
| 259 | 260 | const ATOM_Vega10_POWERPLAYTABLE *powerplay_table) |
| 260 | 261 | { |
| 261 | − hwmgr->platform_descriptor.overdriveLimit.engineClock = | |
| 262 | + const ATOM_Vega10_GFXCLK_Dependency_Table *gfxclk_dep_table = | |
| 263 | + (const ATOM_Vega10_GFXCLK_Dependency_Table *) | |
| 264 | + (((unsigned long) powerplay_table) + | |
| 265 | + le16_to_cpu(powerplay_table->usGfxclkDependencyTableOffset)); | |
| 266 | + bool is_acg_enabled = false; | |
| 267 | + ATOM_Vega10_GFXCLK_Dependency_Record_V2 *patom_record_v2; | |
| 268 | + | |
| 269 | + if (gfxclk_dep_table->ucRevId == 1) { | |
| 270 | + patom_record_v2 = | |
| 271 | + (ATOM_Vega10_GFXCLK_Dependency_Record_V2 *)gfxclk_dep_table->entries; | |
| 272 | + is_acg_enabled = | |
| 273 | + (bool)patom_record_v2[gfxclk_dep_table->ucNumEntries-1].ucACGEnable; | |
| 274 | + } | |
| 275 | + | |
| 276 | + if (powerplay_table->ulMaxODEngineClock > VEGA10_ENGINECLOCK_HARDMAX && | |
| 277 | + !is_acg_enabled) | |
| 278 | + hwmgr->platform_descriptor.overdriveLimit.engineClock = | |
| 279 | + VEGA10_ENGINECLOCK_HARDMAX; | |
| 280 | + else | |
| 281 | + hwmgr->platform_descriptor.overdriveLimit.engineClock = | |
| 262 | 282 | le32_to_cpu(powerplay_table->ulMaxODEngineClock); |
| 263 | 283 | hwmgr->platform_descriptor.overdriveLimit.memoryClock = |
| 264 | 284 | le32_to_cpu(powerplay_table->ulMaxODMemoryClock); |
| @@ -753,6 +753,22 @@ static int vega12_init_smc_table(struct pp_hwmgr *hwmgr) · 752 unmodified lines | ||
| 753 | 753 | return 0; |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | +static int vega12_run_acg_btc(struct pp_hwmgr *hwmgr) | |
| 757 | +{ | |
| 758 | + uint32_t result; | |
| 759 | + | |
| 760 | + PP_ASSERT_WITH_CODE( | |
| 761 | + smum_send_msg_to_smc(hwmgr, PPSMC_MSG_RunAcgBtc) == 0, | |
| 762 | + "[Run_ACG_BTC] Attempt to run ACG BTC failed!", | |
| 763 | + return -EINVAL); | |
| 764 | + | |
| 765 | + result = smum_get_argument(hwmgr); | |
| 766 | + PP_ASSERT_WITH_CODE(result == 1, | |
| 767 | + "Failed to run ACG BTC!", return -EINVAL); | |
| 768 | + | |
| 769 | + return 0; | |
| 770 | +} | |
| 771 | + | |
| 756 | 772 | static int vega12_set_allowed_featuresmask(struct pp_hwmgr *hwmgr) |
| 757 | 773 | { |
| 758 | 774 | struct vega12_hwmgr *data = |
| @@ -931,6 +947,11 @@ static int vega12_enable_dpm_tasks(struct pp_hwmgr *hwmgr) · 172 unmodified lines | ||
| 931 | 947 | "Failed to initialize SMC table!", |
| 932 | 948 | result = tmp_result); |
| 933 | 949 | |
| 950 | + tmp_result = vega12_run_acg_btc(hwmgr); | |
| 951 | + PP_ASSERT_WITH_CODE(!tmp_result, | |
| 952 | + "Failed to run ACG BTC!", | |
| 953 | + result = tmp_result); | |
| 954 | + | |
| 934 | 955 | result = vega12_enable_all_smu_features(hwmgr); |
| 935 | 956 | PP_ASSERT_WITH_CODE(!result, |
| 936 | 957 | "Failed to enable all smu features!", |
| @@ -2799,6 +2799,7 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) · 2798 unmodified lines | ||
| 2799 | 2799 | MMIO_DFH(_MMIO(0xe2a0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); |
| 2800 | 2800 | MMIO_DFH(_MMIO(0xe2b0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); |
| 2801 | 2801 | MMIO_DFH(_MMIO(0xe2c0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); |
| 2802 | + MMIO_DFH(_MMIO(0x21f0), D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); | |
| 2802 | 2803 | return 0; |
| 2803 | 2804 | } |
| 2804 | 2805 | |
| @@ -41,7 +41,7 @@ struct intel_gvt_mpt { · 40 unmodified lines | ||
| 41 | 41 | int (*host_init)(struct device *dev, void *gvt, const void *ops); |
| 42 | 42 | void (*host_exit)(struct device *dev, void *gvt); |
| 43 | 43 | int (*attach_vgpu)(void *vgpu, unsigned long *handle); |
| 44 | − void (*detach_vgpu)(unsigned long handle); | |
| 44 | + void (*detach_vgpu)(void *vgpu); | |
| 45 | 45 | int (*inject_msi)(unsigned long handle, u32 addr, u16 data); |
| 46 | 46 | unsigned long (*from_virt_to_mfn)(void *p); |
| 47 | 47 | int (*enable_page_track)(unsigned long handle, u64 gfn); |
| @@ -996,7 +996,7 @@ static int intel_vgpu_mmap(struct mdev_device *mdev, struct vm_area_struct *vma) · 995 unmodified lines | ||
| 996 | 996 | { |
| 997 | 997 | unsigned int index; |
| 998 | 998 | u64 virtaddr; |
| 999 | − unsigned long req_size, pgoff = 0; | |
| 999 | + unsigned long req_size, pgoff, req_start; | |
| 1000 | 1000 | pgprot_t pg_prot; |
| 1001 | 1001 | struct intel_vgpu *vgpu = mdev_get_drvdata(mdev); |
| 1002 | 1002 | |
| @@ -1014,7 +1014,17 @@ static int intel_vgpu_mmap(struct mdev_device *mdev, struct vm_area_struct *vma) · 11 unmodified lines | ||
| 1014 | 1014 | pg_prot = vma->vm_page_prot; |
| 1015 | 1015 | virtaddr = vma->vm_start; |
| 1016 | 1016 | req_size = vma->vm_end - vma->vm_start; |
| 1017 | − pgoff = vgpu_aperture_pa_base(vgpu) >> PAGE_SHIFT; | |
| 1017 | + pgoff = vma->vm_pgoff & | |
| 1018 | + ((1U << (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT)) - 1); | |
| 1019 | + req_start = pgoff << PAGE_SHIFT; | |
| 1020 | + | |
| 1021 | + if (!intel_vgpu_in_aperture(vgpu, req_start)) | |
| 1022 | + return -EINVAL; | |
| 1023 | + if (req_start + req_size > | |
| 1024 | + vgpu_aperture_offset(vgpu) + vgpu_aperture_sz(vgpu)) | |
| 1025 | + return -EINVAL; | |
| 1026 | + | |
| 1027 | + pgoff = (gvt_aperture_pa_base(vgpu->gvt) >> PAGE_SHIFT) + pgoff; | |
| 1018 | 1028 | |
| 1019 | 1029 | return remap_pfn_range(vma, virtaddr, pgoff, req_size, pg_prot); |
| 1020 | 1030 | } |
| @@ -1662,9 +1672,21 @@ static int kvmgt_attach_vgpu(void *vgpu, unsigned long *handle) · 641 unmodified lines | ||
| 1662 | 1672 | return 0; |
| 1663 | 1673 | } |
| 1664 | 1674 | |
| 1665 | −static void kvmgt_detach_vgpu(unsigned long handle) | |
| 1675 | +static void kvmgt_detach_vgpu(void *p_vgpu) | |
| 1666 | 1676 | { |
| 1667 | − /* nothing to do here */ | |
| 1677 | + int i; | |
| 1678 | + struct intel_vgpu *vgpu = (struct intel_vgpu *)p_vgpu; | |
| 1679 | + | |
| 1680 | + if (!vgpu->vdev.region) | |
| 1681 | + return; | |
| 1682 | + | |
| 1683 | + for (i = 0; i < vgpu->vdev.num_regions; i++) | |
| 1684 | + if (vgpu->vdev.region[i].ops->release) | |
| 1685 | + vgpu->vdev.region[i].ops->release(vgpu, | |
| 1686 | + &vgpu->vdev.region[i]); | |
| 1687 | + vgpu->vdev.num_regions = 0; | |
| 1688 | + kfree(vgpu->vdev.region); | |
| 1689 | + vgpu->vdev.region = NULL; | |
| 1668 | 1690 | } |
| 1669 | 1691 | |
| 1670 | 1692 | static int kvmgt_inject_msi(unsigned long handle, u32 addr, u16 data) |
| @@ -101,7 +101,7 @@ static inline void intel_gvt_hypervisor_detach_vgpu(struct intel_vgpu *vgpu) · 100 unmodified lines | ||
| 101 | 101 | if (!intel_gvt_host.mpt->detach_vgpu) |
| 102 | 102 | return; |
| 103 | 103 | |
| 104 | − intel_gvt_host.mpt->detach_vgpu(vgpu->handle); | |
| 104 | + intel_gvt_host.mpt->detach_vgpu(vgpu); | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | #define MSI_CAP_CONTROL(offset) (offset + 2) |
| @@ -332,6 +332,9 @@ static void release_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) · 331 unmodified lines | ||
| 332 | 332 | |
| 333 | 333 | i915_gem_object_unpin_map(wa_ctx->indirect_ctx.obj); |
| 334 | 334 | i915_gem_object_put(wa_ctx->indirect_ctx.obj); |
| 335 | + | |
| 336 | + wa_ctx->indirect_ctx.obj = NULL; | |
| 337 | + wa_ctx->indirect_ctx.shadow_va = NULL; | |
| 335 | 338 | } |
| 336 | 339 | |
| 337 | 340 | static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, |
| @@ -911,11 +914,6 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) · 573 unmodified lines | ||
| 911 | 914 | |
| 912 | 915 | list_del_init(&workload->list); |
| 913 | 916 | |
| 914 | − if (!workload->status) { | |
| 915 | − release_shadow_batch_buffer(workload); | |
| 916 | − release_shadow_wa_ctx(&workload->wa_ctx); | |
| 917 | − } | |
| 918 | − | |
| 919 | 917 | if (workload->status || (vgpu->resetting_eng & ENGINE_MASK(ring_id))) { |
| 920 | 918 | /* if workload->status is not successful means HW GPU |
| 921 | 919 | * has occurred GPU hang or something wrong with i915/GVT, |
| @@ -1283,6 +1281,9 @@ void intel_vgpu_destroy_workload(struct intel_vgpu_workload *workload) · 361 unmodified lines | ||
| 1283 | 1281 | { |
| 1284 | 1282 | struct intel_vgpu_submission *s = &workload->vgpu->submission; |
| 1285 | 1283 | |
| 1284 | + release_shadow_batch_buffer(workload); | |
| 1285 | + release_shadow_wa_ctx(&workload->wa_ctx); | |
| 1286 | + | |
| 1286 | 1287 | if (workload->shadow_mm) |
| 1287 | 1288 | intel_vgpu_mm_put(workload->shadow_mm); |
| 1288 | 1289 | |
| @@ -303,6 +303,7 @@ static void __unwind_incomplete_requests(struct intel_engine_cs *engine) · 302 unmodified lines | ||
| 303 | 303 | */ |
| 304 | 304 | if (!(prio & I915_PRIORITY_NEWCLIENT)) { |
| 305 | 305 | prio |= I915_PRIORITY_NEWCLIENT; |
| 306 | + active->sched.attr.priority = prio; | |
| 306 | 307 | list_move_tail(&active->sched.link, |
| 307 | 308 | i915_sched_lookup_priolist(engine, prio)); |
| 308 | 309 | } |
| @@ -645,6 +646,9 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 336 unmodified lines | ||
| 645 | 646 | int i; |
| 646 | 647 | |
| 647 | 648 | priolist_for_each_request_consume(rq, rn, p, i) { |
| 649 | + GEM_BUG_ON(last && | |
| 650 | + need_preempt(engine, last, rq_prio(rq))); | |
| 651 | + | |
| 648 | 652 | /* |
| 649 | 653 | * Can we combine this request with the current port? |
| 650 | 654 | * It has to be the same context/ringbuffer and not |
| @@ -46,7 +46,6 @@ struct meson_crtc { · 45 unmodified lines | ||
| 46 | 46 | struct drm_crtc base; |
| 47 | 47 | struct drm_pending_vblank_event *event; |
| 48 | 48 | struct meson_drm *priv; |
| 49 | − bool enabled; | |
| 50 | 49 | }; |
| 51 | 50 | #define to_meson_crtc(x) container_of(x, struct meson_crtc, base) |
| 52 | 51 | |
| @@ -82,7 +81,8 @@ static const struct drm_crtc_funcs meson_crtc_funcs = { · 29 unmodified lines | ||
| 82 | 81 | |
| 83 | 82 | }; |
| 84 | 83 | |
| 85 | −static void meson_crtc_enable(struct drm_crtc *crtc) | |
| 84 | +static void meson_crtc_atomic_enable(struct drm_crtc *crtc, | |
| 85 | + struct drm_crtc_state *old_state) | |
| 86 | 86 | { |
| 87 | 87 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); |
| 88 | 88 | struct drm_crtc_state *crtc_state = crtc->state; |
| @@ -108,20 +108,6 @@ static void meson_crtc_enable(struct drm_crtc *crtc) · 19 unmodified lines | ||
| 108 | 108 | |
| 109 | 109 | drm_crtc_vblank_on(crtc); |
| 110 | 110 | |
| 111 | − meson_crtc->enabled = true; | |
| 112 | −} | |
| 113 | − | |
| 114 | −static void meson_crtc_atomic_enable(struct drm_crtc *crtc, | |
| 115 | − struct drm_crtc_state *old_state) | |
| 116 | −{ | |
| 117 | − struct meson_crtc *meson_crtc = to_meson_crtc(crtc); | |
| 118 | − struct meson_drm *priv = meson_crtc->priv; | |
| 119 | − | |
| 120 | − DRM_DEBUG_DRIVER("\n"); | |
| 121 | − | |
| 122 | − if (!meson_crtc->enabled) | |
| 123 | − meson_crtc_enable(crtc); | |
| 124 | − | |
| 125 | 111 | priv->viu.osd1_enabled = true; |
| 126 | 112 | } |
| 127 | 113 | |
| @@ -153,8 +139,6 @@ static void meson_crtc_atomic_disable(struct drm_crtc *crtc, · 25 unmodified lines | ||
| 153 | 139 | |
| 154 | 140 | crtc->state->event = NULL; |
| 155 | 141 | } |
| 156 | − | |
| 157 | − meson_crtc->enabled = false; | |
| 158 | 142 | } |
| 159 | 143 | |
| 160 | 144 | static void meson_crtc_atomic_begin(struct drm_crtc *crtc, |
| @@ -163,9 +147,6 @@ static void meson_crtc_atomic_begin(struct drm_crtc *crtc, · 2 unmodified lines | ||
| 163 | 147 | struct meson_crtc *meson_crtc = to_meson_crtc(crtc); |
| 164 | 148 | unsigned long flags; |
| 165 | 149 | |
| 166 | − if (crtc->state->enable && !meson_crtc->enabled) | |
| 167 | − meson_crtc_enable(crtc); | |
| 168 | − | |
| 169 | 150 | if (crtc->state->event) { |
| 170 | 151 | WARN_ON(drm_crtc_vblank_get(crtc) != 0); |
| 171 | 152 | |
| @@ -75,6 +75,10 @@ static const struct drm_mode_config_funcs meson_mode_config_funcs = { · 74 unmodified lines | ||
| 75 | 75 | .fb_create = drm_gem_fb_create, |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | +static const struct drm_mode_config_helper_funcs meson_mode_config_helpers = { | |
| 79 | + .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, | |
| 80 | +}; | |
| 81 | + | |
| 78 | 82 | static irqreturn_t meson_irq(int irq, void *arg) |
| 79 | 83 | { |
| 80 | 84 | struct drm_device *dev = arg; |
| @@ -266,6 +270,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) · 185 unmodified lines | ||
| 266 | 270 | drm->mode_config.max_width = 3840; |
| 267 | 271 | drm->mode_config.max_height = 2160; |
| 268 | 272 | drm->mode_config.funcs = &meson_mode_config_funcs; |
| 273 | + drm->mode_config.helper_private = &meson_mode_config_helpers; | |
| 269 | 274 | |
| 270 | 275 | /* Hardware Initialization */ |
| 271 | 276 | |
| @@ -388,8 +393,10 @@ static int meson_probe_remote(struct platform_device *pdev, · 116 unmodified lines | ||
| 388 | 393 | remote_node = of_graph_get_remote_port_parent(ep); |
| 389 | 394 | if (!remote_node || |
| 390 | 395 | remote_node == parent || /* Ignore parent endpoint */ |
| 391 | − !of_device_is_available(remote_node)) | |
| 396 | + !of_device_is_available(remote_node)) { | |
| 397 | + of_node_put(remote_node); | |
| 392 | 398 | continue; |
| 399 | + } | |
| 393 | 400 | |
| 394 | 401 | count += meson_probe_remote(pdev, match, remote, remote_node); |
| 395 | 402 | |
| @@ -408,10 +415,13 @@ static int meson_drv_probe(struct platform_device *pdev) · 12 unmodified lines | ||
| 408 | 415 | |
| 409 | 416 | for_each_endpoint_of_node(np, ep) { |
| 410 | 417 | remote = of_graph_get_remote_port_parent(ep); |
| 411 | − if (!remote || !of_device_is_available(remote)) | |
| 418 | + if (!remote || !of_device_is_available(remote)) { | |
| 419 | + of_node_put(remote); | |
| 412 | 420 | continue; |
| 421 | + } | |
| 413 | 422 | |
| 414 | 423 | count += meson_probe_remote(pdev, &match, np, remote); |
| 424 | + of_node_put(remote); | |
| 415 | 425 | } |
| 416 | 426 | |
| 417 | 427 | if (count && !match) |
| @@ -944,7 +944,7 @@ static u32 a6xx_gmu_get_arc_level(struct device *dev, unsigned long freq) · 943 unmodified lines | ||
| 944 | 944 | np = dev_pm_opp_get_of_node(opp); |
| 945 | 945 | |
| 946 | 946 | if (np) { |
| 947 | − of_property_read_u32(np, "qcom,level", &val); | |
| 947 | + of_property_read_u32(np, "opp-level", &val); | |
| 948 | 948 | of_node_put(np); |
| 949 | 949 | } |
| 950 | 950 | |
| @@ -765,7 +765,6 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, · 764 unmodified lines | ||
| 765 | 765 | adreno_gpu->rev = config->rev; |
| 766 | 766 | |
| 767 | 767 | adreno_gpu_config.ioname = "kgsl_3d0_reg_memory"; |
| 768 | − adreno_gpu_config.irqname = "kgsl_3d0_irq"; | |
| 769 | 768 | |
| 770 | 769 | adreno_gpu_config.va_start = SZ_16M; |
| 771 | 770 | adreno_gpu_config.va_end = 0xffffffff; |
| @@ -365,19 +365,6 @@ static void _dpu_plane_set_qos_ctrl(struct drm_plane *plane, · 364 unmodified lines | ||
| 365 | 365 | &pdpu->pipe_qos_cfg); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | −static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) | |
| 369 | −{ | |
| 370 | − struct dpu_plane *pdpu = to_dpu_plane(plane); | |
| 371 | − struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane); | |
| 372 | − | |
| 373 | − if (!pdpu->is_rt_pipe) | |
| 374 | − return; | |
| 375 | − | |
| 376 | − pm_runtime_get_sync(&dpu_kms->pdev->dev); | |
| 377 | − _dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL); | |
| 378 | − pm_runtime_put_sync(&dpu_kms->pdev->dev); | |
| 379 | −} | |
| 380 | − | |
| 381 | 368 | /** |
| 382 | 369 | * _dpu_plane_set_ot_limit - set OT limit for the given plane |
| 383 | 370 | * @plane: Pointer to drm plane |
| @@ -1248,6 +1235,19 @@ static void dpu_plane_reset(struct drm_plane *plane) · 864 unmodified lines | ||
| 1248 | 1235 | } |
| 1249 | 1236 | |
| 1250 | 1237 | #ifdef CONFIG_DEBUG_FS |
| 1238 | +static void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) | |
| 1239 | +{ | |
| 1240 | + struct dpu_plane *pdpu = to_dpu_plane(plane); | |
| 1241 | + struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane); | |
| 1242 | + | |
| 1243 | + if (!pdpu->is_rt_pipe) | |
| 1244 | + return; | |
| 1245 | + | |
| 1246 | + pm_runtime_get_sync(&dpu_kms->pdev->dev); | |
| 1247 | + _dpu_plane_set_qos_ctrl(plane, enable, DPU_PLANE_QOS_PANIC_CTRL); | |
| 1248 | + pm_runtime_put_sync(&dpu_kms->pdev->dev); | |
| 1249 | +} | |
| 1250 | + | |
| 1251 | 1251 | static ssize_t _dpu_plane_danger_read(struct file *file, |
| 1252 | 1252 | char __user *buff, size_t count, loff_t *ppos) |
| 1253 | 1253 | { |
| @@ -250,7 +250,8 @@ void msm_gem_purge_vma(struct msm_gem_address_space *aspace, · 249 unmodified lines | ||
| 250 | 250 | void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, |
| 251 | 251 | struct msm_gem_vma *vma); |
| 252 | 252 | int msm_gem_map_vma(struct msm_gem_address_space *aspace, |
| 253 | − struct msm_gem_vma *vma, struct sg_table *sgt, int npages); | |
| 253 | + struct msm_gem_vma *vma, int prot, | |
| 254 | + struct sg_table *sgt, int npages); | |
| 254 | 255 | void msm_gem_close_vma(struct msm_gem_address_space *aspace, |
| 255 | 256 | struct msm_gem_vma *vma); |
| 256 | 257 | |
| @@ -333,6 +334,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo, · 76 unmodified lines | ||
| 333 | 334 | struct drm_gem_object *msm_gem_import(struct drm_device *dev, |
| 334 | 335 | struct dma_buf *dmabuf, struct sg_table *sgt); |
| 335 | 336 | |
| 337 | +__printf(2, 3) | |
| 336 | 338 | void msm_gem_object_set_name(struct drm_gem_object *bo, const char *fmt, ...); |
| 337 | 339 | |
| 338 | 340 | int msm_framebuffer_prepare(struct drm_framebuffer *fb, |
| @@ -396,12 +398,14 @@ void msm_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m); · 57 unmodified lines | ||
| 396 | 398 | int msm_debugfs_late_init(struct drm_device *dev); |
| 397 | 399 | int msm_rd_debugfs_init(struct drm_minor *minor); |
| 398 | 400 | void msm_rd_debugfs_cleanup(struct msm_drm_private *priv); |
| 401 | +__printf(3, 4) | |
| 399 | 402 | void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, |
| 400 | 403 | const char *fmt, ...); |
| 401 | 404 | int msm_perf_debugfs_init(struct drm_minor *minor); |
| 402 | 405 | void msm_perf_debugfs_cleanup(struct msm_drm_private *priv); |
| 403 | 406 | #else |
| 404 | 407 | static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; } |
| 408 | +__printf(3, 4) | |
| 405 | 409 | static inline void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, |
| 406 | 410 | const char *fmt, ...) {} |
| 407 | 411 | static inline void msm_rd_debugfs_cleanup(struct msm_drm_private *priv) {} |
| @@ -391,6 +391,10 @@ static int msm_gem_pin_iova(struct drm_gem_object *obj, · 390 unmodified lines | ||
| 391 | 391 | struct msm_gem_object *msm_obj = to_msm_bo(obj); |
| 392 | 392 | struct msm_gem_vma *vma; |
| 393 | 393 | struct page **pages; |
| 394 | + int prot = IOMMU_READ; | |
| 395 | + | |
| 396 | + if (!(msm_obj->flags & MSM_BO_GPU_READONLY)) | |
| 397 | + prot |= IOMMU_WRITE; | |
| 394 | 398 | |
| 395 | 399 | WARN_ON(!mutex_is_locked(&msm_obj->lock)); |
| 396 | 400 | |
| @@ -405,8 +409,8 @@ static int msm_gem_pin_iova(struct drm_gem_object *obj, · 8 unmodified lines | ||
| 405 | 409 | if (IS_ERR(pages)) |
| 406 | 410 | return PTR_ERR(pages); |
| 407 | 411 | |
| 408 | − return msm_gem_map_vma(aspace, vma, msm_obj->sgt, | |
| 409 | − obj->size >> PAGE_SHIFT); | |
| 412 | + return msm_gem_map_vma(aspace, vma, prot, | |
| 413 | + msm_obj->sgt, obj->size >> PAGE_SHIFT); | |
| 410 | 414 | } |
| 411 | 415 | |
| 412 | 416 | /* get iova and pin it. Should have a matching put */ |
| @@ -68,7 +68,8 @@ void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, · 67 unmodified lines | ||
| 68 | 68 | |
| 69 | 69 | int |
| 70 | 70 | msm_gem_map_vma(struct msm_gem_address_space *aspace, |
| 71 | − struct msm_gem_vma *vma, struct sg_table *sgt, int npages) | |
| 71 | + struct msm_gem_vma *vma, int prot, | |
| 72 | + struct sg_table *sgt, int npages) | |
| 72 | 73 | { |
| 73 | 74 | unsigned size = npages << PAGE_SHIFT; |
| 74 | 75 | int ret = 0; |
| @@ -86,7 +87,7 @@ msm_gem_map_vma(struct msm_gem_address_space *aspace, · 11 unmodified lines | ||
| 86 | 87 | |
| 87 | 88 | if (aspace->mmu) |
| 88 | 89 | ret = aspace->mmu->funcs->map(aspace->mmu, vma->iova, sgt, |
| 89 | − size, IOMMU_READ | IOMMU_WRITE); | |
| 90 | + size, prot); | |
| 90 | 91 | |
| 91 | 92 | if (ret) |
| 92 | 93 | vma->mapped = false; |
| @@ -900,7 +900,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, · 899 unmodified lines | ||
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | /* Get Interrupt: */ |
| 903 | − gpu->irq = platform_get_irq_byname(pdev, config->irqname); | |
| 903 | + gpu->irq = platform_get_irq(pdev, 0); | |
| 904 | 904 | if (gpu->irq < 0) { |
| 905 | 905 | ret = gpu->irq; |
| 906 | 906 | DRM_DEV_ERROR(drm->dev, "failed to get irq: %d\n", ret); |
| @@ -31,7 +31,6 @@ struct msm_gpu_state; · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | struct msm_gpu_config { |
| 33 | 33 | const char *ioname; |
| 34 | − const char *irqname; | |
| 35 | 34 | uint64_t va_start; |
| 36 | 35 | uint64_t va_end; |
| 37 | 36 | unsigned int nr_rings; |
| @@ -63,7 +62,7 @@ struct msm_gpu_funcs { · 25 unmodified lines | ||
| 63 | 62 | struct msm_ringbuffer *(*active_ring)(struct msm_gpu *gpu); |
| 64 | 63 | void (*recover)(struct msm_gpu *gpu); |
| 65 | 64 | void (*destroy)(struct msm_gpu *gpu); |
| 66 | −#ifdef CONFIG_DEBUG_FS | |
| 65 | +#if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP) | |
| 67 | 66 | /* show GPU status in debugfs: */ |
| 68 | 67 | void (*show)(struct msm_gpu *gpu, struct msm_gpu_state *state, |
| 69 | 68 | struct drm_printer *p); |
| @@ -115,7 +115,9 @@ static void rd_write(struct msm_rd_state *rd, const void *buf, int sz) · 114 unmodified lines | ||
| 115 | 115 | char *fptr = &fifo->buf[fifo->head]; |
| 116 | 116 | int n; |
| 117 | 117 | |
| 118 | − wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0); | |
| 118 | + wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0 || !rd->open); | |
| 119 | + if (!rd->open) | |
| 120 | + return; | |
| 119 | 121 | |
| 120 | 122 | /* Note that smp_load_acquire() is not strictly required |
| 121 | 123 | * as CIRC_SPACE_TO_END() does not access the tail more |
| @@ -213,7 +215,10 @@ out: · 91 unmodified lines | ||
| 213 | 215 | static int rd_release(struct inode *inode, struct file *file) |
| 214 | 216 | { |
| 215 | 217 | struct msm_rd_state *rd = inode->i_private; |
| 218 | + | |
| 216 | 219 | rd->open = false; |
| 220 | + wake_up_all(&rd->fifo_event); | |
| 221 | + | |
| 217 | 222 | return 0; |
| 218 | 223 | } |
| 219 | 224 | |
| @@ -2434,6 +2434,38 @@ nv140_chipset = { · 2433 unmodified lines | ||
| 2434 | 2434 | .sec2 = gp102_sec2_new, |
| 2435 | 2435 | }; |
| 2436 | 2436 | |
| 2437 | +static const struct nvkm_device_chip | |
| 2438 | +nv162_chipset = { | |
| 2439 | + .name = "TU102", | |
| 2440 | + .bar = tu104_bar_new, | |
| 2441 | + .bios = nvkm_bios_new, | |
| 2442 | + .bus = gf100_bus_new, | |
| 2443 | + .devinit = tu104_devinit_new, | |
| 2444 | + .fault = tu104_fault_new, | |
| 2445 | + .fb = gv100_fb_new, | |
| 2446 | + .fuse = gm107_fuse_new, | |
| 2447 | + .gpio = gk104_gpio_new, | |
| 2448 | + .i2c = gm200_i2c_new, | |
| 2449 | + .ibus = gm200_ibus_new, | |
| 2450 | + .imem = nv50_instmem_new, | |
| 2451 | + .ltc = gp102_ltc_new, | |
| 2452 | + .mc = tu104_mc_new, | |
| 2453 | + .mmu = tu104_mmu_new, | |
| 2454 | + .pci = gp100_pci_new, | |
| 2455 | + .pmu = gp102_pmu_new, | |
| 2456 | + .therm = gp100_therm_new, | |
| 2457 | + .timer = gk20a_timer_new, | |
| 2458 | + .top = gk104_top_new, | |
| 2459 | + .ce[0] = tu104_ce_new, | |
| 2460 | + .ce[1] = tu104_ce_new, | |
| 2461 | + .ce[2] = tu104_ce_new, | |
| 2462 | + .ce[3] = tu104_ce_new, | |
| 2463 | + .ce[4] = tu104_ce_new, | |
| 2464 | + .disp = tu104_disp_new, | |
| 2465 | + .dma = gv100_dma_new, | |
| 2466 | + .fifo = tu104_fifo_new, | |
| 2467 | +}; | |
| 2468 | + | |
| 2437 | 2469 | static const struct nvkm_device_chip |
| 2438 | 2470 | nv164_chipset = { |
| 2439 | 2471 | .name = "TU104", |
| @@ -2950,6 +2982,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, · 510 unmodified lines | ||
| 2950 | 2982 | case 0x138: device->chip = &nv138_chipset; break; |
| 2951 | 2983 | case 0x13b: device->chip = &nv13b_chipset; break; |
| 2952 | 2984 | case 0x140: device->chip = &nv140_chipset; break; |
| 2985 | + case 0x162: device->chip = &nv162_chipset; break; | |
| 2953 | 2986 | case 0x164: device->chip = &nv164_chipset; break; |
| 2954 | 2987 | case 0x166: device->chip = &nv166_chipset; break; |
| 2955 | 2988 | default: |
| @@ -250,14 +250,10 @@ static struct drm_driver qxl_driver = { · 249 unmodified lines | ||
| 250 | 250 | #if defined(CONFIG_DEBUG_FS) |
| 251 | 251 | .debugfs_init = qxl_debugfs_init, |
| 252 | 252 | #endif |
| 253 | − .prime_handle_to_fd = drm_gem_prime_handle_to_fd, | |
| 254 | − .prime_fd_to_handle = drm_gem_prime_fd_to_handle, | |
| 255 | 253 | .gem_prime_export = drm_gem_prime_export, |
| 256 | 254 | .gem_prime_import = drm_gem_prime_import, |
| 257 | 255 | .gem_prime_pin = qxl_gem_prime_pin, |
| 258 | 256 | .gem_prime_unpin = qxl_gem_prime_unpin, |
| 259 | − .gem_prime_get_sg_table = qxl_gem_prime_get_sg_table, | |
| 260 | − .gem_prime_import_sg_table = qxl_gem_prime_import_sg_table, | |
| 261 | 257 | .gem_prime_vmap = qxl_gem_prime_vmap, |
| 262 | 258 | .gem_prime_vunmap = qxl_gem_prime_vunmap, |
| 263 | 259 | .gem_prime_mmap = qxl_gem_prime_mmap, |
| @@ -38,20 +38,6 @@ void qxl_gem_prime_unpin(struct drm_gem_object *obj) · 37 unmodified lines | ||
| 38 | 38 | WARN_ONCE(1, "not implemented"); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | −struct sg_table *qxl_gem_prime_get_sg_table(struct drm_gem_object *obj) | |
| 42 | −{ | |
| 43 | − WARN_ONCE(1, "not implemented"); | |
| 44 | − return ERR_PTR(-ENOSYS); | |
| 45 | −} | |
| 46 | − | |
| 47 | −struct drm_gem_object *qxl_gem_prime_import_sg_table( | |
| 48 | − struct drm_device *dev, struct dma_buf_attachment *attach, | |
| 49 | − struct sg_table *table) | |
| 50 | −{ | |
| 51 | − WARN_ONCE(1, "not implemented"); | |
| 52 | − return ERR_PTR(-ENOSYS); | |
| 53 | −} | |
| 54 | − | |
| 55 | 41 | void *qxl_gem_prime_vmap(struct drm_gem_object *obj) |
| 56 | 42 | { |
| 57 | 43 | WARN_ONCE(1, "not implemented"); |
| @@ -113,8 +113,10 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, · 112 unmodified lines | ||
| 113 | 113 | child_count++; |
| 114 | 114 | ret = drm_of_find_panel_or_bridge(dev->of_node, 0, endpoint_id, |
| 115 | 115 | &panel, &bridge); |
| 116 | − if (!ret) | |
| 116 | + if (!ret) { | |
| 117 | + of_node_put(endpoint); | |
| 117 | 118 | break; |
| 119 | + } | |
| 118 | 120 | } |
| 119 | 121 | |
| 120 | 122 | of_node_put(port); |
| @@ -786,17 +786,18 @@ static struct sun4i_frontend *sun4i_backend_find_frontend(struct sun4i_drv *drv, · 785 unmodified lines | ||
| 786 | 786 | remote = of_graph_get_remote_port_parent(ep); |
| 787 | 787 | if (!remote) |
| 788 | 788 | continue; |
| 789 | + of_node_put(remote); | |
| 789 | 790 | |
| 790 | 791 | /* does this node match any registered engines? */ |
| 791 | 792 | list_for_each_entry(frontend, &drv->frontend_list, list) { |
| 792 | 793 | if (remote == frontend->node) { |
| 793 | − of_node_put(remote); | |
| 794 | 794 | of_node_put(port); |
| 795 | + of_node_put(ep); | |
| 795 | 796 | return frontend; |
| 796 | 797 | } |
| 797 | 798 | } |
| 798 | 799 | } |
| 799 | − | |
| 800 | + of_node_put(port); | |
| 800 | 801 | return ERR_PTR(-EINVAL); |
| 801 | 802 | } |
| 802 | 803 | |
| @@ -92,6 +92,8 @@ static void sun4i_hdmi_disable(struct drm_encoder *encoder) · 91 unmodified lines | ||
| 92 | 92 | val = readl(hdmi->base + SUN4I_HDMI_VID_CTRL_REG); |
| 93 | 93 | val &= ~SUN4I_HDMI_VID_CTRL_ENABLE; |
| 94 | 94 | writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); |
| 95 | + | |
| 96 | + clk_disable_unprepare(hdmi->tmds_clk); | |
| 95 | 97 | } |
| 96 | 98 | |
| 97 | 99 | static void sun4i_hdmi_enable(struct drm_encoder *encoder) |
| @@ -102,6 +104,8 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder) · 4 unmodified lines | ||
| 102 | 104 | |
| 103 | 105 | DRM_DEBUG_DRIVER("Enabling the HDMI Output\n"); |
| 104 | 106 | |
| 107 | + clk_prepare_enable(hdmi->tmds_clk); | |
| 108 | + | |
| 105 | 109 | sun4i_hdmi_setup_avi_infoframes(hdmi, mode); |
| 106 | 110 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(0, SUN4I_HDMI_PKT_AVI); |
| 107 | 111 | val |= SUN4I_HDMI_PKT_CTRL_TYPE(1, SUN4I_HDMI_PKT_END); |
| @@ -127,14 +127,10 @@ static struct drm_driver driver = { · 126 unmodified lines | ||
| 127 | 127 | #if defined(CONFIG_DEBUG_FS) |
| 128 | 128 | .debugfs_init = virtio_gpu_debugfs_init, |
| 129 | 129 | #endif |
| 130 | − .prime_handle_to_fd = drm_gem_prime_handle_to_fd, | |
| 131 | − .prime_fd_to_handle = drm_gem_prime_fd_to_handle, | |
| 132 | 130 | .gem_prime_export = drm_gem_prime_export, |
| 133 | 131 | .gem_prime_import = drm_gem_prime_import, |
| 134 | 132 | .gem_prime_pin = virtgpu_gem_prime_pin, |
| 135 | 133 | .gem_prime_unpin = virtgpu_gem_prime_unpin, |
| 136 | − .gem_prime_get_sg_table = virtgpu_gem_prime_get_sg_table, | |
| 137 | − .gem_prime_import_sg_table = virtgpu_gem_prime_import_sg_table, | |
| 138 | 134 | .gem_prime_vmap = virtgpu_gem_prime_vmap, |
| 139 | 135 | .gem_prime_vunmap = virtgpu_gem_prime_vunmap, |
| 140 | 136 | .gem_prime_mmap = virtgpu_gem_prime_mmap, |
| @@ -372,10 +372,6 @@ int virtio_gpu_object_wait(struct virtio_gpu_object *bo, bool no_wait); · 371 unmodified lines | ||
| 372 | 372 | /* virtgpu_prime.c */ |
| 373 | 373 | int virtgpu_gem_prime_pin(struct drm_gem_object *obj); |
| 374 | 374 | void virtgpu_gem_prime_unpin(struct drm_gem_object *obj); |
| 375 | −struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj); | |
| 376 | −struct drm_gem_object *virtgpu_gem_prime_import_sg_table( | |
| 377 | − struct drm_device *dev, struct dma_buf_attachment *attach, | |
| 378 | − struct sg_table *sgt); | |
| 379 | 375 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj); |
| 380 | 376 | void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); |
| 381 | 377 | int virtgpu_gem_prime_mmap(struct drm_gem_object *obj, |
| @@ -39,20 +39,6 @@ void virtgpu_gem_prime_unpin(struct drm_gem_object *obj) · 38 unmodified lines | ||
| 39 | 39 | WARN_ONCE(1, "not implemented"); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | −struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj) | |
| 43 | −{ | |
| 44 | − WARN_ONCE(1, "not implemented"); | |
| 45 | − return ERR_PTR(-ENODEV); | |
| 46 | −} | |
| 47 | − | |
| 48 | −struct drm_gem_object *virtgpu_gem_prime_import_sg_table( | |
| 49 | − struct drm_device *dev, struct dma_buf_attachment *attach, | |
| 50 | − struct sg_table *table) | |
| 51 | −{ | |
| 52 | − WARN_ONCE(1, "not implemented"); | |
| 53 | − return ERR_PTR(-ENODEV); | |
| 54 | −} | |
| 55 | − | |
| 56 | 42 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj) |
| 57 | 43 | { |
| 58 | 44 | struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj); |
| @@ -21,6 +21,7 @@ config VGA_SWITCHEROO · 20 unmodified lines | ||
| 21 | 21 | bool "Laptop Hybrid Graphics - GPU switching support" |
| 22 | 22 | depends on X86 |
| 23 | 23 | depends on ACPI |
| 24 | + depends on PCI | |
| 24 | 25 | select VGA_ARB |
| 25 | 26 | help |
| 26 | 27 | Many laptops released in 2008/9/10 have two GPUs with a multiplexer |
| @@ -125,6 +125,7 @@ static int open_collection(struct hid_parser *parser, unsigned type) · 124 unmodified lines | ||
| 125 | 125 | { |
| 126 | 126 | struct hid_collection *collection; |
| 127 | 127 | unsigned usage; |
| 128 | + int collection_index; | |
| 128 | 129 | |
| 129 | 130 | usage = parser->local.usage[0]; |
| 130 | 131 | |
| @@ -167,13 +168,13 @@ static int open_collection(struct hid_parser *parser, unsigned type) · 36 unmodified lines | ||
| 167 | 168 | parser->collection_stack[parser->collection_stack_ptr++] = |
| 168 | 169 | parser->device->maxcollection; |
| 169 | 170 | |
| 170 | − collection = parser->device->collection + | |
| 171 | − parser->device->maxcollection++; | |
| 171 | + collection_index = parser->device->maxcollection++; | |
| 172 | + collection = parser->device->collection + collection_index; | |
| 172 | 173 | collection->type = type; |
| 173 | 174 | collection->usage = usage; |
| 174 | 175 | collection->level = parser->collection_stack_ptr - 1; |
| 175 | − collection->parent = parser->active_collection; | |
| 176 | − parser->active_collection = collection; | |
| 176 | + collection->parent_idx = (collection->level == 0) ? -1 : | |
| 177 | + parser->collection_stack[collection->level - 1]; | |
| 177 | 178 | |
| 178 | 179 | if (type == HID_COLLECTION_APPLICATION) |
| 179 | 180 | parser->device->maxapplication++; |
| @@ -192,8 +193,6 @@ static int close_collection(struct hid_parser *parser) · 12 unmodified lines | ||
| 192 | 193 | return -EINVAL; |
| 193 | 194 | } |
| 194 | 195 | parser->collection_stack_ptr--; |
| 195 | − if (parser->active_collection) | |
| 196 | − parser->active_collection = parser->active_collection->parent; | |
| 197 | 196 | return 0; |
| 198 | 197 | } |
| 199 | 198 | |
| @@ -1006,10 +1005,12 @@ static void hid_apply_multiplier_to_field(struct hid_device *hid, · 806 unmodified lines | ||
| 1006 | 1005 | usage = &field->usage[i]; |
| 1007 | 1006 | |
| 1008 | 1007 | collection = &hid->collection[usage->collection_index]; |
| 1009 | − while (collection && collection != multiplier_collection) | |
| 1010 | − collection = collection->parent; | |
| 1008 | + while (collection->parent_idx != -1 && | |
| 1009 | + collection != multiplier_collection) | |
| 1010 | + collection = &hid->collection[collection->parent_idx]; | |
| 1011 | 1011 | |
| 1012 | − if (collection || multiplier_collection == NULL) | |
| 1012 | + if (collection->parent_idx != -1 || | |
| 1013 | + multiplier_collection == NULL) | |
| 1013 | 1014 | usage->resolution_multiplier = effective_multiplier; |
| 1014 | 1015 | |
| 1015 | 1016 | } |
| @@ -1044,9 +1045,9 @@ static void hid_apply_multiplier(struct hid_device *hid, · 28 unmodified lines | ||
| 1044 | 1045 | * applicable fields later. |
| 1045 | 1046 | */ |
| 1046 | 1047 | multiplier_collection = &hid->collection[multiplier->usage->collection_index]; |
| 1047 | − while (multiplier_collection && | |
| 1048 | + while (multiplier_collection->parent_idx != -1 && | |
| 1048 | 1049 | multiplier_collection->type != HID_COLLECTION_LOGICAL) |
| 1049 | − multiplier_collection = multiplier_collection->parent; | |
| 1050 | + multiplier_collection = &hid->collection[multiplier_collection->parent_idx]; | |
| 1050 | 1051 | |
| 1051 | 1052 | effective_multiplier = hid_calculate_multiplier(hid, multiplier); |
| 1052 | 1053 | |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | #include <linux/debugfs.h> |
| 32 | 32 | #include <linux/seq_file.h> |
| 33 | +#include <linux/kfifo.h> | |
| 33 | 34 | #include <linux/sched/signal.h> |
| 34 | 35 | #include <linux/export.h> |
| 35 | 36 | #include <linux/slab.h> |
| @@ -661,17 +662,12 @@ EXPORT_SYMBOL_GPL(hid_dump_device); · 625 unmodified lines | ||
| 661 | 662 | /* enqueue string to 'events' ring buffer */ |
| 662 | 663 | void hid_debug_event(struct hid_device *hdev, char *buf) |
| 663 | 664 | { |
| 664 | − unsigned i; | |
| 665 | 665 | struct hid_debug_list *list; |
| 666 | 666 | unsigned long flags; |
| 667 | 667 | |
| 668 | 668 | spin_lock_irqsave(&hdev->debug_list_lock, flags); |
| 669 | − list_for_each_entry(list, &hdev->debug_list, node) { | |
| 670 | − for (i = 0; buf[i]; i++) | |
| 671 | − list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] = | |
| 672 | − buf[i]; | |
| 673 | − list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE; | |
| 674 | − } | |
| 669 | + list_for_each_entry(list, &hdev->debug_list, node) | |
| 670 | + kfifo_in(&list->hid_debug_fifo, buf, strlen(buf)); | |
| 675 | 671 | spin_unlock_irqrestore(&hdev->debug_list_lock, flags); |
| 676 | 672 | |
| 677 | 673 | wake_up_interruptible(&hdev->debug_wait); |
| @@ -722,8 +718,7 @@ void hid_dump_input(struct hid_device *hdev, struct hid_usage *usage, __s32 valu · 44 unmodified lines | ||
| 722 | 718 | hid_debug_event(hdev, buf); |
| 723 | 719 | |
| 724 | 720 | kfree(buf); |
| 725 | − wake_up_interruptible(&hdev->debug_wait); | |
| 726 | − | |
| 721 | + wake_up_interruptible(&hdev->debug_wait); | |
| 727 | 722 | } |
| 728 | 723 | EXPORT_SYMBOL_GPL(hid_dump_input); |
| 729 | 724 | |
| @@ -1083,8 +1078,8 @@ static int hid_debug_events_open(struct inode *inode, struct file *file) · 353 unmodified lines | ||
| 1083 | 1078 | goto out; |
| 1084 | 1079 | } |
| 1085 | 1080 | |
| 1086 | − if (!(list->hid_debug_buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_KERNEL))) { | |
| 1087 | − err = -ENOMEM; | |
| 1081 | + err = kfifo_alloc(&list->hid_debug_fifo, HID_DEBUG_FIFOSIZE, GFP_KERNEL); | |
| 1082 | + if (err) { | |
| 1088 | 1083 | kfree(list); |
| 1089 | 1084 | goto out; |
| 1090 | 1085 | } |
| @@ -1104,77 +1099,57 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer, · 13 unmodified lines | ||
| 1104 | 1099 | size_t count, loff_t *ppos) |
| 1105 | 1100 | { |
| 1106 | 1101 | struct hid_debug_list *list = file->private_data; |
| 1107 | − int ret = 0, len; | |
| 1102 | + int ret = 0, copied; | |
| 1108 | 1103 | DECLARE_WAITQUEUE(wait, current); |
| 1109 | 1104 | |
| 1110 | 1105 | mutex_lock(&list->read_mutex); |
| 1111 | − while (ret == 0) { | |
| 1112 | − if (list->head == list->tail) { | |
| 1113 | − add_wait_queue(&list->hdev->debug_wait, &wait); | |
| 1114 | − set_current_state(TASK_INTERRUPTIBLE); | |
| 1115 | − | |
| 1116 | − while (list->head == list->tail) { | |
| 1117 | − if (file->f_flags & O_NONBLOCK) { | |
| 1118 | − ret = -EAGAIN; | |
| 1119 | − break; | |
| 1120 | − } | |
| 1121 | − if (signal_pending(current)) { | |
| 1122 | − ret = -ERESTARTSYS; | |
| 1123 | − break; | |
| 1124 | − } | |
| 1106 | + if (kfifo_is_empty(&list->hid_debug_fifo)) { | |
| 1107 | + add_wait_queue(&list->hdev->debug_wait, &wait); | |
| 1108 | + set_current_state(TASK_INTERRUPTIBLE); | |
| 1109 | + | |
| 1110 | + while (kfifo_is_empty(&list->hid_debug_fifo)) { | |
| 1111 | + if (file->f_flags & O_NONBLOCK) { | |
| 1112 | + ret = -EAGAIN; | |
| 1113 | + break; | |
| 1114 | + } | |
| 1125 | 1115 | |
| 1126 | − if (!list->hdev || !list->hdev->debug) { | |
| 1127 | − ret = -EIO; | |
| 1128 | − set_current_state(TASK_RUNNING); | |
| 1129 | − goto out; | |
| 1130 | − } | |
| 1116 | + if (signal_pending(current)) { | |
| 1117 | + ret = -ERESTARTSYS; | |
| 1118 | + break; | |
| 1119 | + } | |
| 1131 | 1120 | |
| 1132 | − /* allow O_NONBLOCK from other threads */ | |
| 1133 | − mutex_unlock(&list->read_mutex); | |
| 1134 | − schedule(); | |
| 1135 | − mutex_lock(&list->read_mutex); | |
| 1136 | − set_current_state(TASK_INTERRUPTIBLE); | |
| 1121 | + /* if list->hdev is NULL we cannot remove_wait_queue(). | |
| 1122 | + * if list->hdev->debug is 0 then hid_debug_unregister() | |
| 1123 | + * was already called and list->hdev is being destroyed. | |
| 1124 | + * if we add remove_wait_queue() here we can hit a race. | |
| 1125 | + */ | |
| 1126 | + if (!list->hdev || !list->hdev->debug) { | |
| 1127 | + ret = -EIO; | |
| 1128 | + set_current_state(TASK_RUNNING); | |
| 1129 | + goto out; | |
| 1137 | 1130 | } |
| 1138 | 1131 | |
| 1139 | − set_current_state(TASK_RUNNING); | |
| 1140 | − remove_wait_queue(&list->hdev->debug_wait, &wait); | |
| 1132 | + /* allow O_NONBLOCK from other threads */ | |
| 1133 | + mutex_unlock(&list->read_mutex); | |
| 1134 | + schedule(); | |
| 1135 | + mutex_lock(&list->read_mutex); | |
| 1136 | + set_current_state(TASK_INTERRUPTIBLE); | |
| 1141 | 1137 | } |
| 1142 | 1138 | |
| 1143 | − if (ret) | |
| 1144 | − goto out; | |
| 1139 | + __set_current_state(TASK_RUNNING); | |
| 1140 | + remove_wait_queue(&list->hdev->debug_wait, &wait); | |
| 1145 | 1141 | |
| 1146 | − /* pass the ringbuffer contents to userspace */ | |
| 1147 | −copy_rest: | |
| 1148 | − if (list->tail == list->head) | |
| 1142 | + if (ret) | |
| 1149 | 1143 | goto out; |
| 1150 | − if (list->tail > list->head) { | |
| 1151 | − len = list->tail - list->head; | |
| 1152 | − if (len > count) | |
| 1153 | − len = count; | |
| 1154 | − | |
| 1155 | − if (copy_to_user(buffer + ret, &list->hid_debug_buf[list->head], len)) { | |
| 1156 | − ret = -EFAULT; | |
| 1157 | − goto out; | |
| 1158 | − } | |
| 1159 | − ret += len; | |
| 1160 | − list->head += len; | |
| 1161 | − } else { | |
| 1162 | − len = HID_DEBUG_BUFSIZE - list->head; | |
| 1163 | − if (len > count) | |
| 1164 | − len = count; | |
| 1165 | − | |
| 1166 | − if (copy_to_user(buffer, &list->hid_debug_buf[list->head], len)) { | |
| 1167 | − ret = -EFAULT; | |
| 1168 | − goto out; | |
| 1169 | − } | |
| 1170 | − list->head = 0; | |
| 1171 | − ret += len; | |
| 1172 | − count -= len; | |
| 1173 | − if (count > 0) | |
| 1174 | − goto copy_rest; | |
| 1175 | − } | |
| 1176 | − | |
| 1177 | 1144 | } |
| 1145 | + | |
| 1146 | + /* pass the fifo content to userspace, locking is not needed with only | |
| 1147 | + * one concurrent reader and one concurrent writer | |
| 1148 | + */ | |
| 1149 | + ret = kfifo_to_user(&list->hid_debug_fifo, buffer, count, &copied); | |
| 1150 | + if (ret) | |
| 1151 | + goto out; | |
| 1152 | + ret = copied; | |
| 1178 | 1153 | out: |
| 1179 | 1154 | mutex_unlock(&list->read_mutex); |
| 1180 | 1155 | return ret; |
| @@ -1185,7 +1160,7 @@ static __poll_t hid_debug_events_poll(struct file *file, poll_table *wait) · 4 unmodified lines | ||
| 1185 | 1160 | struct hid_debug_list *list = file->private_data; |
| 1186 | 1161 | |
| 1187 | 1162 | poll_wait(file, &list->hdev->debug_wait, wait); |
| 1188 | − if (list->head != list->tail) | |
| 1163 | + if (!kfifo_is_empty(&list->hid_debug_fifo)) | |
| 1189 | 1164 | return EPOLLIN | EPOLLRDNORM; |
| 1190 | 1165 | if (!list->hdev->debug) |
| 1191 | 1166 | return EPOLLERR | EPOLLHUP; |
| @@ -1200,7 +1175,7 @@ static int hid_debug_events_release(struct inode *inode, struct file *file) · 8 unmodified lines | ||
| 1200 | 1175 | spin_lock_irqsave(&list->hdev->debug_list_lock, flags); |
| 1201 | 1176 | list_del(&list->node); |
| 1202 | 1177 | spin_unlock_irqrestore(&list->hdev->debug_list_lock, flags); |
| 1203 | − kfree(list->hid_debug_buf); | |
| 1178 | + kfifo_free(&list->hid_debug_fifo); | |
| 1204 | 1179 | kfree(list); |
| 1205 | 1180 | |
| 1206 | 1181 | return 0; |
| @@ -1246,4 +1221,3 @@ void hid_debug_exit(void) · 39 unmodified lines | ||
| 1246 | 1221 | { |
| 1247 | 1222 | debugfs_remove_recursive(hid_debug_root); |
| 1248 | 1223 | } |
| 1249 | − | |
| @@ -461,6 +461,9 @@ · 460 unmodified lines | ||
| 461 | 461 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_010A 0x010a |
| 462 | 462 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PIT_E100 0xe100 |
| 463 | 463 | |
| 464 | +#define I2C_VENDOR_ID_GOODIX 0x27c6 | |
| 465 | +#define I2C_DEVICE_ID_GOODIX_01F0 0x01f0 | |
| 466 | + | |
| 464 | 467 | #define USB_VENDOR_ID_GOODTOUCH 0x1aad |
| 465 | 468 | #define USB_DEVICE_ID_GOODTOUCH_000f 0x000f |
| 466 | 469 | |
| @@ -179,6 +179,8 @@ static const struct i2c_hid_quirks { · 178 unmodified lines | ||
| 179 | 179 | I2C_HID_QUIRK_DELAY_AFTER_SLEEP }, |
| 180 | 180 | { USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_8001, |
| 181 | 181 | I2C_HID_QUIRK_NO_RUNTIME_PM }, |
| 182 | + { I2C_VENDOR_ID_GOODIX, I2C_DEVICE_ID_GOODIX_01F0, | |
| 183 | + I2C_HID_QUIRK_NO_RUNTIME_PM }, | |
| 182 | 184 | { 0, 0 } |
| 183 | 185 | }; |
| 184 | 186 | |
| @@ -701,19 +701,12 @@ static int vmbus_close_internal(struct vmbus_channel *channel) · 700 unmodified lines | ||
| 701 | 701 | int vmbus_disconnect_ring(struct vmbus_channel *channel) |
| 702 | 702 | { |
| 703 | 703 | struct vmbus_channel *cur_channel, *tmp; |
| 704 | − unsigned long flags; | |
| 705 | − LIST_HEAD(list); | |
| 706 | 704 | int ret; |
| 707 | 705 | |
| 708 | 706 | if (channel->primary_channel != NULL) |
| 709 | 707 | return -EINVAL; |
| 710 | 708 | |
| 711 | − /* Snapshot the list of subchannels */ | |
| 712 | − spin_lock_irqsave(&channel->lock, flags); | |
| 713 | − list_splice_init(&channel->sc_list, &list); | |
| 714 | − spin_unlock_irqrestore(&channel->lock, flags); | |
| 715 | − | |
| 716 | − list_for_each_entry_safe(cur_channel, tmp, &list, sc_list) { | |
| 709 | + list_for_each_entry_safe(cur_channel, tmp, &channel->sc_list, sc_list) { | |
| 717 | 710 | if (cur_channel->rescind) |
| 718 | 711 | wait_for_completion(&cur_channel->rescind_event); |
| 719 | 712 | |
| @@ -888,12 +888,14 @@ static unsigned long handle_pg_range(unsigned long pg_start, · 887 unmodified lines | ||
| 888 | 888 | pfn_cnt -= pgs_ol; |
| 889 | 889 | /* |
| 890 | 890 | * Check if the corresponding memory block is already |
| 891 | − * online by checking its last previously backed page. | |
| 892 | − * In case it is we need to bring rest (which was not | |
| 893 | − * backed previously) online too. | |
| 891 | + * online. It is possible to observe struct pages still | |
| 892 | + * being uninitialized here so check section instead. | |
| 893 | + * In case the section is online we need to bring the | |
| 894 | + * rest of pfns (which were not backed previously) | |
| 895 | + * online too. | |
| 894 | 896 | */ |
| 895 | 897 | if (start_pfn > has->start_pfn && |
| 896 | − !PageReserved(pfn_to_page(start_pfn - 1))) | |
| 898 | + online_section_nr(pfn_to_section_nr(start_pfn))) | |
| 897 | 899 | hv_bring_pgs_online(has, start_pfn, pgs_ol); |
| 898 | 900 | |
| 899 | 901 | } |
| @@ -164,26 +164,25 @@ hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi, · 163 unmodified lines | ||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /* Get various debug metrics for the specified ring buffer. */ |
| 167 | −void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, | |
| 168 | − struct hv_ring_buffer_debug_info *debug_info) | |
| 167 | +int hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info, | |
| 168 | + struct hv_ring_buffer_debug_info *debug_info) | |
| 169 | 169 | { |
| 170 | 170 | u32 bytes_avail_towrite; |
| 171 | 171 | u32 bytes_avail_toread; |
| 172 | 172 | |
| 173 | − if (ring_info->ring_buffer) { | |
| 174 | − hv_get_ringbuffer_availbytes(ring_info, | |
| 175 | − &bytes_avail_toread, | |
| 176 | − &bytes_avail_towrite); | |
| 177 | − | |
| 178 | − debug_info->bytes_avail_toread = bytes_avail_toread; | |
| 179 | − debug_info->bytes_avail_towrite = bytes_avail_towrite; | |
| 180 | − debug_info->current_read_index = | |
| 181 | − ring_info->ring_buffer->read_index; | |
| 182 | − debug_info->current_write_index = | |
| 183 | − ring_info->ring_buffer->write_index; | |
| 184 | − debug_info->current_interrupt_mask = | |
| 185 | − ring_info->ring_buffer->interrupt_mask; | |
| 186 | − } | |
| 173 | + if (!ring_info->ring_buffer) | |
| 174 | + return -EINVAL; | |
| 175 | + | |
| 176 | + hv_get_ringbuffer_availbytes(ring_info, | |
| 177 | + &bytes_avail_toread, | |
| 178 | + &bytes_avail_towrite); | |
| 179 | + debug_info->bytes_avail_toread = bytes_avail_toread; | |
| 180 | + debug_info->bytes_avail_towrite = bytes_avail_towrite; | |
| 181 | + debug_info->current_read_index = ring_info->ring_buffer->read_index; | |
| 182 | + debug_info->current_write_index = ring_info->ring_buffer->write_index; | |
| 183 | + debug_info->current_interrupt_mask | |
| 184 | + = ring_info->ring_buffer->interrupt_mask; | |
| 185 | + return 0; | |
| 187 | 186 | } |
| 188 | 187 | EXPORT_SYMBOL_GPL(hv_ringbuffer_get_debuginfo); |
| 189 | 188 | |
| @@ -313,12 +313,16 @@ static ssize_t out_intr_mask_show(struct device *dev, · 312 unmodified lines | ||
| 313 | 313 | { |
| 314 | 314 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 315 | 315 | struct hv_ring_buffer_debug_info outbound; |
| 316 | + int ret; | |
| 316 | 317 | |
| 317 | 318 | if (!hv_dev->channel) |
| 318 | 319 | return -ENODEV; |
| 319 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 320 | − return -EINVAL; | |
| 321 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | |
| 320 | + | |
| 321 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, | |
| 322 | + &outbound); | |
| 323 | + if (ret < 0) | |
| 324 | + return ret; | |
| 325 | + | |
| 322 | 326 | return sprintf(buf, "%d\n", outbound.current_interrupt_mask); |
| 323 | 327 | } |
| 324 | 328 | static DEVICE_ATTR_RO(out_intr_mask); |
| @@ -328,12 +332,15 @@ static ssize_t out_read_index_show(struct device *dev, · 3 unmodified lines | ||
| 328 | 332 | { |
| 329 | 333 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 330 | 334 | struct hv_ring_buffer_debug_info outbound; |
| 335 | + int ret; | |
| 331 | 336 | |
| 332 | 337 | if (!hv_dev->channel) |
| 333 | 338 | return -ENODEV; |
| 334 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 335 | − return -EINVAL; | |
| 336 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | |
| 339 | + | |
| 340 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, | |
| 341 | + &outbound); | |
| 342 | + if (ret < 0) | |
| 343 | + return ret; | |
| 337 | 344 | return sprintf(buf, "%d\n", outbound.current_read_index); |
| 338 | 345 | } |
| 339 | 346 | static DEVICE_ATTR_RO(out_read_index); |
| @@ -344,12 +351,15 @@ static ssize_t out_write_index_show(struct device *dev, · 4 unmodified lines | ||
| 344 | 351 | { |
| 345 | 352 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 346 | 353 | struct hv_ring_buffer_debug_info outbound; |
| 354 | + int ret; | |
| 347 | 355 | |
| 348 | 356 | if (!hv_dev->channel) |
| 349 | 357 | return -ENODEV; |
| 350 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 351 | − return -EINVAL; | |
| 352 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | |
| 358 | + | |
| 359 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, | |
| 360 | + &outbound); | |
| 361 | + if (ret < 0) | |
| 362 | + return ret; | |
| 353 | 363 | return sprintf(buf, "%d\n", outbound.current_write_index); |
| 354 | 364 | } |
| 355 | 365 | static DEVICE_ATTR_RO(out_write_index); |
| @@ -360,12 +370,15 @@ static ssize_t out_read_bytes_avail_show(struct device *dev, · 4 unmodified lines | ||
| 360 | 370 | { |
| 361 | 371 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 362 | 372 | struct hv_ring_buffer_debug_info outbound; |
| 373 | + int ret; | |
| 363 | 374 | |
| 364 | 375 | if (!hv_dev->channel) |
| 365 | 376 | return -ENODEV; |
| 366 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 367 | − return -EINVAL; | |
| 368 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | |
| 377 | + | |
| 378 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, | |
| 379 | + &outbound); | |
| 380 | + if (ret < 0) | |
| 381 | + return ret; | |
| 369 | 382 | return sprintf(buf, "%d\n", outbound.bytes_avail_toread); |
| 370 | 383 | } |
| 371 | 384 | static DEVICE_ATTR_RO(out_read_bytes_avail); |
| @@ -376,12 +389,15 @@ static ssize_t out_write_bytes_avail_show(struct device *dev, · 4 unmodified lines | ||
| 376 | 389 | { |
| 377 | 390 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 378 | 391 | struct hv_ring_buffer_debug_info outbound; |
| 392 | + int ret; | |
| 379 | 393 | |
| 380 | 394 | if (!hv_dev->channel) |
| 381 | 395 | return -ENODEV; |
| 382 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 383 | − return -EINVAL; | |
| 384 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound); | |
| 396 | + | |
| 397 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, | |
| 398 | + &outbound); | |
| 399 | + if (ret < 0) | |
| 400 | + return ret; | |
| 385 | 401 | return sprintf(buf, "%d\n", outbound.bytes_avail_towrite); |
| 386 | 402 | } |
| 387 | 403 | static DEVICE_ATTR_RO(out_write_bytes_avail); |
| @@ -391,12 +407,15 @@ static ssize_t in_intr_mask_show(struct device *dev, · 3 unmodified lines | ||
| 391 | 407 | { |
| 392 | 408 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 393 | 409 | struct hv_ring_buffer_debug_info inbound; |
| 410 | + int ret; | |
| 394 | 411 | |
| 395 | 412 | if (!hv_dev->channel) |
| 396 | 413 | return -ENODEV; |
| 397 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 398 | − return -EINVAL; | |
| 399 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 414 | + | |
| 415 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 416 | + if (ret < 0) | |
| 417 | + return ret; | |
| 418 | + | |
| 400 | 419 | return sprintf(buf, "%d\n", inbound.current_interrupt_mask); |
| 401 | 420 | } |
| 402 | 421 | static DEVICE_ATTR_RO(in_intr_mask); |
| @@ -406,12 +425,15 @@ static ssize_t in_read_index_show(struct device *dev, · 3 unmodified lines | ||
| 406 | 425 | { |
| 407 | 426 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 408 | 427 | struct hv_ring_buffer_debug_info inbound; |
| 428 | + int ret; | |
| 409 | 429 | |
| 410 | 430 | if (!hv_dev->channel) |
| 411 | 431 | return -ENODEV; |
| 412 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 413 | − return -EINVAL; | |
| 414 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 432 | + | |
| 433 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 434 | + if (ret < 0) | |
| 435 | + return ret; | |
| 436 | + | |
| 415 | 437 | return sprintf(buf, "%d\n", inbound.current_read_index); |
| 416 | 438 | } |
| 417 | 439 | static DEVICE_ATTR_RO(in_read_index); |
| @@ -421,12 +443,15 @@ static ssize_t in_write_index_show(struct device *dev, · 3 unmodified lines | ||
| 421 | 443 | { |
| 422 | 444 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 423 | 445 | struct hv_ring_buffer_debug_info inbound; |
| 446 | + int ret; | |
| 424 | 447 | |
| 425 | 448 | if (!hv_dev->channel) |
| 426 | 449 | return -ENODEV; |
| 427 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 428 | − return -EINVAL; | |
| 429 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 450 | + | |
| 451 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 452 | + if (ret < 0) | |
| 453 | + return ret; | |
| 454 | + | |
| 430 | 455 | return sprintf(buf, "%d\n", inbound.current_write_index); |
| 431 | 456 | } |
| 432 | 457 | static DEVICE_ATTR_RO(in_write_index); |
| @@ -437,12 +462,15 @@ static ssize_t in_read_bytes_avail_show(struct device *dev, · 4 unmodified lines | ||
| 437 | 462 | { |
| 438 | 463 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 439 | 464 | struct hv_ring_buffer_debug_info inbound; |
| 465 | + int ret; | |
| 440 | 466 | |
| 441 | 467 | if (!hv_dev->channel) |
| 442 | 468 | return -ENODEV; |
| 443 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 444 | − return -EINVAL; | |
| 445 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 469 | + | |
| 470 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 471 | + if (ret < 0) | |
| 472 | + return ret; | |
| 473 | + | |
| 446 | 474 | return sprintf(buf, "%d\n", inbound.bytes_avail_toread); |
| 447 | 475 | } |
| 448 | 476 | static DEVICE_ATTR_RO(in_read_bytes_avail); |
| @@ -453,12 +481,15 @@ static ssize_t in_write_bytes_avail_show(struct device *dev, · 4 unmodified lines | ||
| 453 | 481 | { |
| 454 | 482 | struct hv_device *hv_dev = device_to_hv_device(dev); |
| 455 | 483 | struct hv_ring_buffer_debug_info inbound; |
| 484 | + int ret; | |
| 456 | 485 | |
| 457 | 486 | if (!hv_dev->channel) |
| 458 | 487 | return -ENODEV; |
| 459 | − if (hv_dev->channel->state != CHANNEL_OPENED_STATE) | |
| 460 | − return -EINVAL; | |
| 461 | − hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 488 | + | |
| 489 | + ret = hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound); | |
| 490 | + if (ret < 0) | |
| 491 | + return ret; | |
| 492 | + | |
| 462 | 493 | return sprintf(buf, "%d\n", inbound.bytes_avail_towrite); |
| 463 | 494 | } |
| 464 | 495 | static DEVICE_ATTR_RO(in_write_bytes_avail); |
| @@ -393,8 +393,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, · 392 unmodified lines | ||
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | rv = lm80_read_value(client, LM80_REG_FANDIV); |
| 396 | − if (rv < 0) | |
| 396 | + if (rv < 0) { | |
| 397 | + mutex_unlock(&data->update_lock); | |
| 397 | 398 | return rv; |
| 399 | + } | |
| 398 | 400 | reg = (rv & ~(3 << (2 * (nr + 1)))) |
| 399 | 401 | | (data->fan_div[nr] << (2 * (nr + 1))); |
| 400 | 402 | lm80_write_value(client, LM80_REG_FANDIV, reg); |
| @@ -44,8 +44,8 @@ · 43 unmodified lines | ||
| 44 | 44 | * nct6796d 14 7 7 2+6 0xd420 0xc1 0x5ca3 |
| 45 | 45 | * nct6797d 14 7 7 2+6 0xd450 0xc1 0x5ca3 |
| 46 | 46 | * (0xd451) |
| 47 | − * nct6798d 14 7 7 2+6 0xd458 0xc1 0x5ca3 | |
| 48 | − * (0xd459) | |
| 47 | + * nct6798d 14 7 7 2+6 0xd428 0xc1 0x5ca3 | |
| 48 | + * (0xd429) | |
| 49 | 49 | * |
| 50 | 50 | * #temp lists the number of monitored temperature sources (first value) plus |
| 51 | 51 | * the number of directly connectable temperature sensors (second value). |
| @@ -138,7 +138,7 @@ MODULE_PARM_DESC(fan_debounce, "Enable debouncing for fan RPM signal"); · 86 unmodified lines | ||
| 138 | 138 | #define SIO_NCT6795_ID 0xd350 |
| 139 | 139 | #define SIO_NCT6796_ID 0xd420 |
| 140 | 140 | #define SIO_NCT6797_ID 0xd450 |
| 141 | −#define SIO_NCT6798_ID 0xd458 | |
| 141 | +#define SIO_NCT6798_ID 0xd428 | |
| 142 | 142 | #define SIO_ID_MASK 0xFFF8 |
| 143 | 143 | |
| 144 | 144 | enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 }; |
| @@ -4508,7 +4508,8 @@ static int __maybe_unused nct6775_resume(struct device *dev) · 4363 unmodified lines | ||
| 4508 | 4508 | |
| 4509 | 4509 | if (data->kind == nct6791 || data->kind == nct6792 || |
| 4510 | 4510 | data->kind == nct6793 || data->kind == nct6795 || |
| 4511 | − data->kind == nct6796) | |
| 4511 | + data->kind == nct6796 || data->kind == nct6797 || | |
| 4512 | + data->kind == nct6798) | |
| 4512 | 4513 | nct6791_enable_io_mapping(sioreg); |
| 4513 | 4514 | |
| 4514 | 4515 | superio_exit(sioreg); |
| @@ -4644,7 +4645,8 @@ static int __init nct6775_find(int sioaddr, struct nct6775_sio_data *sio_data) · 129 unmodified lines | ||
| 4644 | 4645 | |
| 4645 | 4646 | if (sio_data->kind == nct6791 || sio_data->kind == nct6792 || |
| 4646 | 4647 | sio_data->kind == nct6793 || sio_data->kind == nct6795 || |
| 4647 | − sio_data->kind == nct6796) | |
| 4648 | + sio_data->kind == nct6796 || sio_data->kind == nct6797 || | |
| 4649 | + sio_data->kind == nct6798) | |
| 4648 | 4650 | nct6791_enable_io_mapping(sioaddr); |
| 4649 | 4651 | |
| 4650 | 4652 | superio_exit(sioaddr); |
| @@ -380,8 +380,8 @@ static ssize_t occ_show_power_1(struct device *dev, · 379 unmodified lines | ||
| 380 | 380 | val *= 1000000ULL; |
| 381 | 381 | break; |
| 382 | 382 | case 2: |
| 383 | − val = get_unaligned_be32(&power->update_tag) * | |
| 384 | − occ->powr_sample_time_us; | |
| 383 | + val = (u64)get_unaligned_be32(&power->update_tag) * | |
| 384 | + occ->powr_sample_time_us; | |
| 385 | 385 | break; |
| 386 | 386 | case 3: |
| 387 | 387 | val = get_unaligned_be16(&power->value) * 1000000ULL; |
| @@ -425,8 +425,8 @@ static ssize_t occ_show_power_2(struct device *dev, · 37 unmodified lines | ||
| 425 | 425 | &power->update_tag); |
| 426 | 426 | break; |
| 427 | 427 | case 2: |
| 428 | − val = get_unaligned_be32(&power->update_tag) * | |
| 429 | − occ->powr_sample_time_us; | |
| 428 | + val = (u64)get_unaligned_be32(&power->update_tag) * | |
| 429 | + occ->powr_sample_time_us; | |
| 430 | 430 | break; |
| 431 | 431 | case 3: |
| 432 | 432 | val = get_unaligned_be16(&power->value) * 1000000ULL; |
| @@ -463,8 +463,8 @@ static ssize_t occ_show_power_a0(struct device *dev, · 30 unmodified lines | ||
| 463 | 463 | &power->system.update_tag); |
| 464 | 464 | break; |
| 465 | 465 | case 2: |
| 466 | − val = get_unaligned_be32(&power->system.update_tag) * | |
| 467 | − occ->powr_sample_time_us; | |
| 466 | + val = (u64)get_unaligned_be32(&power->system.update_tag) * | |
| 467 | + occ->powr_sample_time_us; | |
| 468 | 468 | break; |
| 469 | 469 | case 3: |
| 470 | 470 | val = get_unaligned_be16(&power->system.value) * 1000000ULL; |
| @@ -477,8 +477,8 @@ static ssize_t occ_show_power_a0(struct device *dev, · 6 unmodified lines | ||
| 477 | 477 | &power->proc.update_tag); |
| 478 | 478 | break; |
| 479 | 479 | case 6: |
| 480 | − val = get_unaligned_be32(&power->proc.update_tag) * | |
| 481 | − occ->powr_sample_time_us; | |
| 480 | + val = (u64)get_unaligned_be32(&power->proc.update_tag) * | |
| 481 | + occ->powr_sample_time_us; | |
| 482 | 482 | break; |
| 483 | 483 | case 7: |
| 484 | 484 | val = get_unaligned_be16(&power->proc.value) * 1000000ULL; |
| @@ -491,8 +491,8 @@ static ssize_t occ_show_power_a0(struct device *dev, · 6 unmodified lines | ||
| 491 | 491 | &power->vdd.update_tag); |
| 492 | 492 | break; |
| 493 | 493 | case 10: |
| 494 | − val = get_unaligned_be32(&power->vdd.update_tag) * | |
| 495 | − occ->powr_sample_time_us; | |
| 494 | + val = (u64)get_unaligned_be32(&power->vdd.update_tag) * | |
| 495 | + occ->powr_sample_time_us; | |
| 496 | 496 | break; |
| 497 | 497 | case 11: |
| 498 | 498 | val = get_unaligned_be16(&power->vdd.value) * 1000000ULL; |
| @@ -505,8 +505,8 @@ static ssize_t occ_show_power_a0(struct device *dev, · 6 unmodified lines | ||
| 505 | 505 | &power->vdn.update_tag); |
| 506 | 506 | break; |
| 507 | 507 | case 14: |
| 508 | − val = get_unaligned_be32(&power->vdn.update_tag) * | |
| 509 | − occ->powr_sample_time_us; | |
| 508 | + val = (u64)get_unaligned_be32(&power->vdn.update_tag) * | |
| 509 | + occ->powr_sample_time_us; | |
| 510 | 510 | break; |
| 511 | 511 | case 15: |
| 512 | 512 | val = get_unaligned_be16(&power->vdn.value) * 1000000ULL; |
| @@ -88,7 +88,7 @@ static const struct of_device_id tmp421_of_match[] = { · 87 unmodified lines | ||
| 88 | 88 | .data = (void *)2 |
| 89 | 89 | }, |
| 90 | 90 | { |
| 91 | − .compatible = "ti,tmp422", | |
| 91 | + .compatible = "ti,tmp442", | |
| 92 | 92 | .data = (void *)3 |
| 93 | 93 | }, |
| 94 | 94 | { }, |
| @@ -1828,7 +1828,7 @@ int i3c_master_add_i3c_dev_locked(struct i3c_master_controller *master, · 1827 unmodified lines | ||
| 1828 | 1828 | |
| 1829 | 1829 | ret = i3c_master_retrieve_dev_info(newdev); |
| 1830 | 1830 | if (ret) |
| 1831 | − goto err_free_dev; | |
| 1831 | + goto err_detach_dev; | |
| 1832 | 1832 | |
| 1833 | 1833 | olddev = i3c_master_search_i3c_dev_duplicate(newdev); |
| 1834 | 1834 | if (olddev) { |
| @@ -419,12 +419,9 @@ static void dw_i3c_master_enqueue_xfer(struct dw_i3c_master *master, · 418 unmodified lines | ||
| 419 | 419 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | −static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | |
| 423 | − struct dw_i3c_xfer *xfer) | |
| 422 | +static void dw_i3c_master_dequeue_xfer_locked(struct dw_i3c_master *master, | |
| 423 | + struct dw_i3c_xfer *xfer) | |
| 424 | 424 | { |
| 425 | − unsigned long flags; | |
| 426 | − | |
| 427 | − spin_lock_irqsave(&master->xferqueue.lock, flags); | |
| 428 | 425 | if (master->xferqueue.cur == xfer) { |
| 429 | 426 | u32 status; |
| 430 | 427 | |
| @@ -439,6 +436,15 @@ static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, · 8 unmodified lines | ||
| 439 | 436 | } else { |
| 440 | 437 | list_del_init(&xfer->node); |
| 441 | 438 | } |
| 439 | +} | |
| 440 | + | |
| 441 | +static void dw_i3c_master_dequeue_xfer(struct dw_i3c_master *master, | |
| 442 | + struct dw_i3c_xfer *xfer) | |
| 443 | +{ | |
| 444 | + unsigned long flags; | |
| 445 | + | |
| 446 | + spin_lock_irqsave(&master->xferqueue.lock, flags); | |
| 447 | + dw_i3c_master_dequeue_xfer_locked(master, xfer); | |
| 442 | 448 | spin_unlock_irqrestore(&master->xferqueue.lock, flags); |
| 443 | 449 | } |
| 444 | 450 | |
| @@ -494,7 +500,7 @@ static void dw_i3c_master_end_xfer_locked(struct dw_i3c_master *master, u32 isr) · 49 unmodified lines | ||
| 494 | 500 | complete(&xfer->comp); |
| 495 | 501 | |
| 496 | 502 | if (ret < 0) { |
| 497 | − dw_i3c_master_dequeue_xfer(master, xfer); | |
| 503 | + dw_i3c_master_dequeue_xfer_locked(master, xfer); | |
| 498 | 504 | writel(readl(master->regs + DEVICE_CTRL) | DEV_CTRL_RESUME, |
| 499 | 505 | master->regs + DEVICE_CTRL); |
| 500 | 506 | } |
| @@ -901,9 +907,6 @@ static int dw_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev, · 400 unmodified lines | ||
| 901 | 907 | master->regs + |
| 902 | 908 | DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index)); |
| 903 | 909 | |
| 904 | − if (!old_dyn_addr) | |
| 905 | − return 0; | |
| 906 | − | |
| 907 | 910 | master->addrs[data->index] = dev->info.dyn_addr; |
| 908 | 911 | |
| 909 | 912 | return 0; |
| @@ -925,11 +928,11 @@ static int dw_i3c_master_attach_i3c_dev(struct i3c_dev_desc *dev) · 15 unmodified lines | ||
| 925 | 928 | return -ENOMEM; |
| 926 | 929 | |
| 927 | 930 | data->index = pos; |
| 928 | − master->addrs[pos] = dev->info.dyn_addr; | |
| 931 | + master->addrs[pos] = dev->info.dyn_addr ? : dev->info.static_addr; | |
| 929 | 932 | master->free_pos &= ~BIT(pos); |
| 930 | 933 | i3c_dev_set_master_data(dev, data); |
| 931 | 934 | |
| 932 | − writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(dev->info.dyn_addr), | |
| 935 | + writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(master->addrs[pos]), | |
| 933 | 936 | master->regs + |
| 934 | 937 | DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index)); |
| 935 | 938 | |
| @@ -1556,8 +1556,8 @@ static int cdns_i3c_master_probe(struct platform_device *pdev) · 1555 unmodified lines | ||
| 1556 | 1556 | return PTR_ERR(master->pclk); |
| 1557 | 1557 | |
| 1558 | 1558 | master->sysclk = devm_clk_get(&pdev->dev, "sysclk"); |
| 1559 | − if (IS_ERR(master->pclk)) | |
| 1560 | − return PTR_ERR(master->pclk); | |
| 1559 | + if (IS_ERR(master->sysclk)) | |
| 1560 | + return PTR_ERR(master->sysclk); | |
| 1561 | 1561 | |
| 1562 | 1562 | irq = platform_get_irq(pdev, 0); |
| 1563 | 1563 | if (irq < 0) |
| @@ -235,21 +235,28 @@ EXPORT_SYMBOL_GPL(ide_prep_sense); · 234 unmodified lines | ||
| 235 | 235 | |
| 236 | 236 | int ide_queue_sense_rq(ide_drive_t *drive, void *special) |
| 237 | 237 | { |
| 238 | − struct request *sense_rq = drive->sense_rq; | |
| 238 | + ide_hwif_t *hwif = drive->hwif; | |
| 239 | + struct request *sense_rq; | |
| 240 | + unsigned long flags; | |
| 241 | + | |
| 242 | + spin_lock_irqsave(&hwif->lock, flags); | |
| 239 | 243 | |
| 240 | 244 | /* deferred failure from ide_prep_sense() */ |
| 241 | 245 | if (!drive->sense_rq_armed) { |
| 242 | 246 | printk(KERN_WARNING PFX "%s: error queuing a sense request\n", |
| 243 | 247 | drive->name); |
| 248 | + spin_unlock_irqrestore(&hwif->lock, flags); | |
| 244 | 249 | return -ENOMEM; |
| 245 | 250 | } |
| 246 | 251 | |
| 252 | + sense_rq = drive->sense_rq; | |
| 247 | 253 | ide_req(sense_rq)->special = special; |
| 248 | 254 | drive->sense_rq_armed = false; |
| 249 | 255 | |
| 250 | 256 | drive->hwif->rq = NULL; |
| 251 | 257 | |
| 252 | 258 | ide_insert_request_head(drive, sense_rq); |
| 259 | + spin_unlock_irqrestore(&hwif->lock, flags); | |
| 253 | 260 | return 0; |
| 254 | 261 | } |
| 255 | 262 | EXPORT_SYMBOL_GPL(ide_queue_sense_rq); |
| @@ -68,8 +68,10 @@ int ide_end_rq(ide_drive_t *drive, struct request *rq, blk_status_t error, · 67 unmodified lines | ||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | if (!blk_update_request(rq, error, nr_bytes)) { |
| 71 | − if (rq == drive->sense_rq) | |
| 71 | + if (rq == drive->sense_rq) { | |
| 72 | 72 | drive->sense_rq = NULL; |
| 73 | + drive->sense_rq_active = false; | |
| 74 | + } | |
| 73 | 75 | |
| 74 | 76 | __blk_mq_end_request(rq, error); |
| 75 | 77 | return 0; |
| @@ -451,16 +453,11 @@ void ide_requeue_and_plug(ide_drive_t *drive, struct request *rq) · 375 unmodified lines | ||
| 451 | 453 | blk_mq_delay_run_hw_queue(q->queue_hw_ctx[0], 3); |
| 452 | 454 | } |
| 453 | 455 | |
| 454 | −/* | |
| 455 | − * Issue a new request to a device. | |
| 456 | − */ | |
| 457 | −blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, | |
| 458 | − const struct blk_mq_queue_data *bd) | |
| 456 | +blk_status_t ide_issue_rq(ide_drive_t *drive, struct request *rq, | |
| 457 | + bool local_requeue) | |
| 459 | 458 | { |
| 460 | − ide_drive_t *drive = hctx->queue->queuedata; | |
| 461 | − ide_hwif_t *hwif = drive->hwif; | |
| 459 | + ide_hwif_t *hwif = drive->hwif; | |
| 462 | 460 | struct ide_host *host = hwif->host; |
| 463 | − struct request *rq = bd->rq; | |
| 464 | 461 | ide_startstop_t startstop; |
| 465 | 462 | |
| 466 | 463 | if (!blk_rq_is_passthrough(rq) && !(rq->rq_flags & RQF_DONTPREP)) { |
| @@ -474,8 +471,6 @@ blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, · 7 unmodified lines | ||
| 474 | 471 | if (ide_lock_host(host, hwif)) |
| 475 | 472 | return BLK_STS_DEV_RESOURCE; |
| 476 | 473 | |
| 477 | − blk_mq_start_request(rq); | |
| 478 | − | |
| 479 | 474 | spin_lock_irq(&hwif->lock); |
| 480 | 475 | |
| 481 | 476 | if (!ide_lock_port(hwif)) { |
| @@ -510,18 +505,6 @@ repeat: · 28 unmodified lines | ||
| 510 | 505 | hwif->cur_dev = drive; |
| 511 | 506 | drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); |
| 512 | 507 | |
| 513 | − /* | |
| 514 | − * we know that the queue isn't empty, but this can happen | |
| 515 | − * if ->prep_rq() decides to kill a request | |
| 516 | − */ | |
| 517 | − if (!rq) { | |
| 518 | − rq = bd->rq; | |
| 519 | − if (!rq) { | |
| 520 | − ide_unlock_port(hwif); | |
| 521 | − goto out; | |
| 522 | − } | |
| 523 | − } | |
| 524 | − | |
| 525 | 508 | /* |
| 526 | 509 | * Sanity: don't accept a request that isn't a PM request |
| 527 | 510 | * if we are currently power managed. This is very important as |
| @@ -560,9 +543,12 @@ repeat: · 32 unmodified lines | ||
| 560 | 543 | } |
| 561 | 544 | } else { |
| 562 | 545 | plug_device: |
| 546 | + if (local_requeue) | |
| 547 | + list_add(&rq->queuelist, &drive->rq_list); | |
| 563 | 548 | spin_unlock_irq(&hwif->lock); |
| 564 | 549 | ide_unlock_host(host); |
| 565 | − ide_requeue_and_plug(drive, rq); | |
| 550 | + if (!local_requeue) | |
| 551 | + ide_requeue_and_plug(drive, rq); | |
| 566 | 552 | return BLK_STS_OK; |
| 567 | 553 | } |
| 568 | 554 | |
| @@ -573,6 +559,26 @@ out: · 4 unmodified lines | ||
| 573 | 559 | return BLK_STS_OK; |
| 574 | 560 | } |
| 575 | 561 | |
| 562 | +/* | |
| 563 | + * Issue a new request to a device. | |
| 564 | + */ | |
| 565 | +blk_status_t ide_queue_rq(struct blk_mq_hw_ctx *hctx, | |
| 566 | + const struct blk_mq_queue_data *bd) | |
| 567 | +{ | |
| 568 | + ide_drive_t *drive = hctx->queue->queuedata; | |
| 569 | + ide_hwif_t *hwif = drive->hwif; | |
| 570 | + | |
| 571 | + spin_lock_irq(&hwif->lock); | |
| 572 | + if (drive->sense_rq_active) { | |
| 573 | + spin_unlock_irq(&hwif->lock); | |
| 574 | + return BLK_STS_DEV_RESOURCE; | |
| 575 | + } | |
| 576 | + spin_unlock_irq(&hwif->lock); | |
| 577 | + | |
| 578 | + blk_mq_start_request(bd->rq); | |
| 579 | + return ide_issue_rq(drive, bd->rq, false); | |
| 580 | +} | |
| 581 | + | |
| 576 | 582 | static int drive_is_ready(ide_drive_t *drive) |
| 577 | 583 | { |
| 578 | 584 | ide_hwif_t *hwif = drive->hwif; |
| @@ -893,13 +899,8 @@ EXPORT_SYMBOL_GPL(ide_pad_transfer); · 314 unmodified lines | ||
| 893 | 899 | |
| 894 | 900 | void ide_insert_request_head(ide_drive_t *drive, struct request *rq) |
| 895 | 901 | { |
| 896 | − ide_hwif_t *hwif = drive->hwif; | |
| 897 | − unsigned long flags; | |
| 898 | − | |
| 899 | − spin_lock_irqsave(&hwif->lock, flags); | |
| 902 | + drive->sense_rq_active = true; | |
| 900 | 903 | list_add_tail(&rq->queuelist, &drive->rq_list); |
| 901 | − spin_unlock_irqrestore(&hwif->lock, flags); | |
| 902 | − | |
| 903 | 904 | kblockd_schedule_work(&drive->rq_work); |
| 904 | 905 | } |
| 905 | 906 | EXPORT_SYMBOL_GPL(ide_insert_request_head); |
| @@ -54,7 +54,9 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) · 53 unmodified lines | ||
| 54 | 54 | scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS; |
| 55 | 55 | scsi_req(rq)->cmd_len = 1; |
| 56 | 56 | ide_req(rq)->type = ATA_PRIV_MISC; |
| 57 | + spin_lock_irq(&hwif->lock); | |
| 57 | 58 | ide_insert_request_head(drive, rq); |
| 59 | + spin_unlock_irq(&hwif->lock); | |
| 58 | 60 | |
| 59 | 61 | out: |
| 60 | 62 | return; |
| @@ -1159,18 +1159,27 @@ static void drive_rq_insert_work(struct work_struct *work) · 1158 unmodified lines | ||
| 1159 | 1159 | ide_drive_t *drive = container_of(work, ide_drive_t, rq_work); |
| 1160 | 1160 | ide_hwif_t *hwif = drive->hwif; |
| 1161 | 1161 | struct request *rq; |
| 1162 | + blk_status_t ret; | |
| 1162 | 1163 | LIST_HEAD(list); |
| 1163 | 1164 | |
| 1164 | − spin_lock_irq(&hwif->lock); | |
| 1165 | − if (!list_empty(&drive->rq_list)) | |
| 1166 | − list_splice_init(&drive->rq_list, &list); | |
| 1167 | − spin_unlock_irq(&hwif->lock); | |
| 1165 | + blk_mq_quiesce_queue(drive->queue); | |
| 1168 | 1166 | |
| 1169 | − while (!list_empty(&list)) { | |
| 1170 | − rq = list_first_entry(&list, struct request, queuelist); | |
| 1167 | + ret = BLK_STS_OK; | |
| 1168 | + spin_lock_irq(&hwif->lock); | |
| 1169 | + while (!list_empty(&drive->rq_list)) { | |
| 1170 | + rq = list_first_entry(&drive->rq_list, struct request, queuelist); | |
| 1171 | 1171 | list_del_init(&rq->queuelist); |
| 1172 | − blk_execute_rq_nowait(drive->queue, rq->rq_disk, rq, true, NULL); | |
| 1172 | + | |
| 1173 | + spin_unlock_irq(&hwif->lock); | |
| 1174 | + ret = ide_issue_rq(drive, rq, true); | |
| 1175 | + spin_lock_irq(&hwif->lock); | |
| 1173 | 1176 | } |
| 1177 | + spin_unlock_irq(&hwif->lock); | |
| 1178 | + | |
| 1179 | + blk_mq_unquiesce_queue(drive->queue); | |
| 1180 | + | |
| 1181 | + if (ret != BLK_STS_OK) | |
| 1182 | + kblockd_schedule_work(&drive->rq_work); | |
| 1174 | 1183 | } |
| 1175 | 1184 | |
| 1176 | 1185 | static const u8 ide_hwif_to_major[] = |
| @@ -544,7 +544,7 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif) · 543 unmodified lines | ||
| 544 | 544 | drive->proc = proc_mkdir(drive->name, parent); |
| 545 | 545 | if (drive->proc) { |
| 546 | 546 | ide_add_proc_entries(drive->proc, generic_drive_entries, drive); |
| 547 | − proc_create_data("setting", S_IFREG|S_IRUSR|S_IWUSR, | |
| 547 | + proc_create_data("settings", S_IFREG|S_IRUSR|S_IWUSR, | |
| 548 | 548 | drive->proc, &ide_settings_proc_fops, |
| 549 | 549 | drive); |
| 550 | 550 | } |
| @@ -142,7 +142,10 @@ static void tiadc_step_config(struct iio_dev *indio_dev) · 141 unmodified lines | ||
| 142 | 142 | stepconfig |= STEPCONFIG_MODE_SWCNT; |
| 143 | 143 | |
| 144 | 144 | tiadc_writel(adc_dev, REG_STEPCONFIG(steps), |
| 145 | − stepconfig | STEPCONFIG_INP(chan)); | |
| 145 | + stepconfig | STEPCONFIG_INP(chan) | | |
| 146 | + STEPCONFIG_INM_ADCREFM | | |
| 147 | + STEPCONFIG_RFP_VREFP | | |
| 148 | + STEPCONFIG_RFM_VREFN); | |
| 146 | 149 | |
| 147 | 150 | if (adc_dev->open_delay[i] > STEPDELAY_OPEN_MASK) { |
| 148 | 151 | dev_warn(dev, "chan %d open delay truncating to 0x3FFFF\n", |
| @@ -494,7 +494,10 @@ static void _cma_attach_to_dev(struct rdma_id_private *id_priv, · 493 unmodified lines | ||
| 494 | 494 | id_priv->id.route.addr.dev_addr.transport = |
| 495 | 495 | rdma_node_get_transport(cma_dev->device->node_type); |
| 496 | 496 | list_add_tail(&id_priv->list, &cma_dev->id_list); |
| 497 | − rdma_restrack_kadd(&id_priv->res); | |
| 497 | + if (id_priv->res.kern_name) | |
| 498 | + rdma_restrack_kadd(&id_priv->res); | |
| 499 | + else | |
| 500 | + rdma_restrack_uadd(&id_priv->res); | |
| 498 | 501 | } |
| 499 | 502 | |
| 500 | 503 | static void cma_attach_to_dev(struct rdma_id_private *id_priv, |
| @@ -267,7 +267,6 @@ static inline int ib_mad_enforce_security(struct ib_mad_agent_private *map, · 266 unmodified lines | ||
| 267 | 267 | #endif |
| 268 | 268 | |
| 269 | 269 | struct ib_device *ib_device_get_by_index(u32 ifindex); |
| 270 | −void ib_device_put(struct ib_device *device); | |
| 271 | 270 | /* RDMA device netlink */ |
| 272 | 271 | void nldev_init(void); |
| 273 | 272 | void nldev_exit(void); |
| @@ -156,19 +156,26 @@ struct ib_device *ib_device_get_by_index(u32 index) · 155 unmodified lines | ||
| 156 | 156 | down_read(&lists_rwsem); |
| 157 | 157 | device = __ib_device_get_by_index(index); |
| 158 | 158 | if (device) { |
| 159 | − /* Do not return a device if unregistration has started. */ | |
| 160 | − if (!refcount_inc_not_zero(&device->refcount)) | |
| 159 | + if (!ib_device_try_get(device)) | |
| 161 | 160 | device = NULL; |
| 162 | 161 | } |
| 163 | 162 | up_read(&lists_rwsem); |
| 164 | 163 | return device; |
| 165 | 164 | } |
| 166 | 165 | |
| 166 | +/** | |
| 167 | + * ib_device_put - Release IB device reference | |
| 168 | + * @device: device whose reference to be released | |
| 169 | + * | |
| 170 | + * ib_device_put() releases reference to the IB device to allow it to be | |
| 171 | + * unregistered and eventually free. | |
| 172 | + */ | |
| 167 | 173 | void ib_device_put(struct ib_device *device) |
| 168 | 174 | { |
| 169 | 175 | if (refcount_dec_and_test(&device->refcount)) |
| 170 | 176 | complete(&device->unreg_completion); |
| 171 | 177 | } |
| 178 | +EXPORT_SYMBOL(ib_device_put); | |
| 172 | 179 | |
| 173 | 180 | static struct ib_device *__ib_device_get_by_name(const char *name) |
| 174 | 181 | { |
| @@ -303,7 +310,6 @@ struct ib_device *ib_alloc_device(size_t size) · 128 unmodified lines | ||
| 303 | 310 | rwlock_init(&device->client_data_lock); |
| 304 | 311 | INIT_LIST_HEAD(&device->client_data_list); |
| 305 | 312 | INIT_LIST_HEAD(&device->port_list); |
| 306 | − refcount_set(&device->refcount, 1); | |
| 307 | 313 | init_completion(&device->unreg_completion); |
| 308 | 314 | |
| 309 | 315 | return device; |
| @@ -620,6 +626,7 @@ int ib_register_device(struct ib_device *device, const char *name, · 310 unmodified lines | ||
| 620 | 626 | goto cg_cleanup; |
| 621 | 627 | } |
| 622 | 628 | |
| 629 | + refcount_set(&device->refcount, 1); | |
| 623 | 630 | device->reg_state = IB_DEV_REGISTERED; |
| 624 | 631 | |
| 625 | 632 | list_for_each_entry(client, &client_list, list) |
| @@ -584,10 +584,6 @@ static int fill_res_pd_entry(struct sk_buff *msg, struct netlink_callback *cb, · 583 unmodified lines | ||
| 584 | 584 | if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_RES_USECNT, |
| 585 | 585 | atomic_read(&pd->usecnt), RDMA_NLDEV_ATTR_PAD)) |
| 586 | 586 | goto err; |
| 587 | − if ((pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY) && | |
| 588 | − nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY, | |
| 589 | − pd->unsafe_global_rkey)) | |
| 590 | − goto err; | |
| 591 | 587 | |
| 592 | 588 | if (fill_res_name_pid(msg, res)) |
| 593 | 589 | goto err; |
| @@ -106,6 +106,8 @@ int uverbs_finalize_object(struct ib_uobject *uobj, · 105 unmodified lines | ||
| 106 | 106 | enum uverbs_obj_access access, |
| 107 | 107 | bool commit); |
| 108 | 108 | |
| 109 | +int uverbs_output_written(const struct uverbs_attr_bundle *bundle, size_t idx); | |
| 110 | + | |
| 109 | 111 | void setup_ufile_idr_uobject(struct ib_uverbs_file *ufile); |
| 110 | 112 | void release_ufile_idr_uobject(struct ib_uverbs_file *ufile); |
| 111 | 113 | |
| @@ -352,6 +352,8 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, · 351 unmodified lines | ||
| 352 | 352 | umem->writable = 1; |
| 353 | 353 | umem->is_odp = 1; |
| 354 | 354 | odp_data->per_mm = per_mm; |
| 355 | + umem->owning_mm = per_mm->mm; | |
| 356 | + mmgrab(umem->owning_mm); | |
| 355 | 357 | |
| 356 | 358 | mutex_init(&odp_data->umem_mutex); |
| 357 | 359 | init_completion(&odp_data->notifier_completion); |
| @@ -384,6 +386,7 @@ struct ib_umem_odp *ib_alloc_odp_umem(struct ib_ucontext_per_mm *per_mm, · 26 unmodified lines | ||
| 384 | 386 | out_page_list: |
| 385 | 387 | vfree(odp_data->page_list); |
| 386 | 388 | out_odp_data: |
| 389 | + mmdrop(umem->owning_mm); | |
| 387 | 390 | kfree(odp_data); |
| 388 | 391 | return ERR_PTR(ret); |
| 389 | 392 | } |
| @@ -60,6 +60,10 @@ static int uverbs_response(struct uverbs_attr_bundle *attrs, const void *resp, · 59 unmodified lines | ||
| 60 | 60 | { |
| 61 | 61 | int ret; |
| 62 | 62 | |
| 63 | + if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_CORE_OUT)) | |
| 64 | + return uverbs_copy_to_struct_or_zero( | |
| 65 | + attrs, UVERBS_ATTR_CORE_OUT, resp, resp_len); | |
| 66 | + | |
| 63 | 67 | if (copy_to_user(attrs->ucore.outbuf, resp, |
| 64 | 68 | min(attrs->ucore.outlen, resp_len))) |
| 65 | 69 | return -EFAULT; |
| @@ -1181,6 +1185,9 @@ static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs) · 1115 unmodified lines | ||
| 1181 | 1185 | goto out_put; |
| 1182 | 1186 | } |
| 1183 | 1187 | |
| 1188 | + if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_CORE_OUT)) | |
| 1189 | + ret = uverbs_output_written(attrs, UVERBS_ATTR_CORE_OUT); | |
| 1190 | + | |
| 1184 | 1191 | ret = 0; |
| 1185 | 1192 | |
| 1186 | 1193 | out_put: |
| @@ -2012,8 +2019,10 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs) · 825 unmodified lines | ||
| 2012 | 2019 | return -ENOMEM; |
| 2013 | 2020 | |
| 2014 | 2021 | qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs); |
| 2015 | − if (!qp) | |
| 2022 | + if (!qp) { | |
| 2023 | + ret = -EINVAL; | |
| 2016 | 2024 | goto out; |
| 2025 | + } | |
| 2017 | 2026 | |
| 2018 | 2027 | is_ud = qp->qp_type == IB_QPT_UD; |
| 2019 | 2028 | sg_ind = 0; |
| @@ -144,6 +144,21 @@ static bool uverbs_is_attr_cleared(const struct ib_uverbs_attr *uattr, · 143 unmodified lines | ||
| 144 | 144 | 0, uattr->len - len); |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | +static int uverbs_set_output(const struct uverbs_attr_bundle *bundle, | |
| 148 | + const struct uverbs_attr *attr) | |
| 149 | +{ | |
| 150 | + struct bundle_priv *pbundle = | |
| 151 | + container_of(bundle, struct bundle_priv, bundle); | |
| 152 | + u16 flags; | |
| 153 | + | |
| 154 | + flags = pbundle->uattrs[attr->ptr_attr.uattr_idx].flags | | |
| 155 | + UVERBS_ATTR_F_VALID_OUTPUT; | |
| 156 | + if (put_user(flags, | |
| 157 | + &pbundle->user_attrs[attr->ptr_attr.uattr_idx].flags)) | |
| 158 | + return -EFAULT; | |
| 159 | + return 0; | |
| 160 | +} | |
| 161 | + | |
| 147 | 162 | static int uverbs_process_idrs_array(struct bundle_priv *pbundle, |
| 148 | 163 | const struct uverbs_api_attr *attr_uapi, |
| 149 | 164 | struct uverbs_objs_arr_attr *attr, |
| @@ -455,6 +470,19 @@ static int ib_uverbs_run_method(struct bundle_priv *pbundle, · 305 unmodified lines | ||
| 455 | 470 | ret = handler(&pbundle->bundle); |
| 456 | 471 | } |
| 457 | 472 | |
| 473 | + /* | |
| 474 | + * Until the drivers are revised to use the bundle directly we have to | |
| 475 | + * assume that the driver wrote to its UHW_OUT and flag userspace | |
| 476 | + * appropriately. | |
| 477 | + */ | |
| 478 | + if (!ret && pbundle->method_elm->has_udata) { | |
| 479 | + const struct uverbs_attr *attr = | |
| 480 | + uverbs_attr_get(&pbundle->bundle, UVERBS_ATTR_UHW_OUT); | |
| 481 | + | |
| 482 | + if (!IS_ERR(attr)) | |
| 483 | + ret = uverbs_set_output(&pbundle->bundle, attr); | |
| 484 | + } | |
| 485 | + | |
| 458 | 486 | /* |
| 459 | 487 | * EPROTONOSUPPORT is ONLY to be returned if the ioctl framework can |
| 460 | 488 | * not invoke the method because the request is not supported. No |
| @@ -706,10 +734,7 @@ void uverbs_fill_udata(struct uverbs_attr_bundle *bundle, · 245 unmodified lines | ||
| 706 | 734 | int uverbs_copy_to(const struct uverbs_attr_bundle *bundle, size_t idx, |
| 707 | 735 | const void *from, size_t size) |
| 708 | 736 | { |
| 709 | − struct bundle_priv *pbundle = | |
| 710 | − container_of(bundle, struct bundle_priv, bundle); | |
| 711 | 737 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); |
| 712 | − u16 flags; | |
| 713 | 738 | size_t min_size; |
| 714 | 739 | |
| 715 | 740 | if (IS_ERR(attr)) |
| @@ -719,16 +744,25 @@ int uverbs_copy_to(const struct uverbs_attr_bundle *bundle, size_t idx, · 3 unmodified lines | ||
| 719 | 744 | if (copy_to_user(u64_to_user_ptr(attr->ptr_attr.data), from, min_size)) |
| 720 | 745 | return -EFAULT; |
| 721 | 746 | |
| 722 | − flags = pbundle->uattrs[attr->ptr_attr.uattr_idx].flags | | |
| 723 | − UVERBS_ATTR_F_VALID_OUTPUT; | |
| 724 | − if (put_user(flags, | |
| 725 | − &pbundle->user_attrs[attr->ptr_attr.uattr_idx].flags)) | |
| 726 | − return -EFAULT; | |
| 727 | − | |
| 728 | − return 0; | |
| 747 | + return uverbs_set_output(bundle, attr); | |
| 729 | 748 | } |
| 730 | 749 | EXPORT_SYMBOL(uverbs_copy_to); |
| 731 | 750 | |
| 751 | + | |
| 752 | +/* | |
| 753 | + * This is only used if the caller has directly used copy_to_use to write the | |
| 754 | + * data. It signals to user space that the buffer is filled in. | |
| 755 | + */ | |
| 756 | +int uverbs_output_written(const struct uverbs_attr_bundle *bundle, size_t idx) | |
| 757 | +{ | |
| 758 | + const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); | |
| 759 | + | |
| 760 | + if (IS_ERR(attr)) | |
| 761 | + return PTR_ERR(attr); | |
| 762 | + | |
| 763 | + return uverbs_set_output(bundle, attr); | |
| 764 | +} | |
| 765 | + | |
| 732 | 766 | int _uverbs_get_const(s64 *to, const struct uverbs_attr_bundle *attrs_bundle, |
| 733 | 767 | size_t idx, s64 lower_bound, u64 upper_bound, |
| 734 | 768 | s64 *def_val) |
| @@ -757,8 +791,10 @@ int uverbs_copy_to_struct_or_zero(const struct uverbs_attr_bundle *bundle, · 22 unmodified lines | ||
| 757 | 791 | { |
| 758 | 792 | const struct uverbs_attr *attr = uverbs_attr_get(bundle, idx); |
| 759 | 793 | |
| 760 | − if (clear_user(u64_to_user_ptr(attr->ptr_attr.data), | |
| 761 | − attr->ptr_attr.len)) | |
| 762 | − return -EFAULT; | |
| 794 | + if (size < attr->ptr_attr.len) { | |
| 795 | + if (clear_user(u64_to_user_ptr(attr->ptr_attr.data) + size, | |
| 796 | + attr->ptr_attr.len - size)) | |
| 797 | + return -EFAULT; | |
| 798 | + } | |
| 763 | 799 | return uverbs_copy_to(bundle, idx, from, size); |
| 764 | 800 | } |
| @@ -204,6 +204,9 @@ void ib_uverbs_release_file(struct kref *ref) · 203 unmodified lines | ||
| 204 | 204 | if (atomic_dec_and_test(&file->device->refcount)) |
| 205 | 205 | ib_uverbs_comp_dev(file->device); |
| 206 | 206 | |
| 207 | + if (file->async_file) | |
| 208 | + kref_put(&file->async_file->ref, | |
| 209 | + ib_uverbs_release_async_event_file); | |
| 207 | 210 | put_device(&file->device->dev); |
| 208 | 211 | kfree(file); |
| 209 | 212 | } |
| @@ -690,6 +693,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, · 480 unmodified lines | ||
| 690 | 693 | |
| 691 | 694 | buf += sizeof(hdr); |
| 692 | 695 | |
| 696 | + memset(bundle.attr_present, 0, sizeof(bundle.attr_present)); | |
| 693 | 697 | bundle.ufile = file; |
| 694 | 698 | if (!method_elm->is_ex) { |
| 695 | 699 | size_t in_len = hdr.in_words * 4 - sizeof(hdr); |
| @@ -963,11 +967,19 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) · 267 unmodified lines | ||
| 963 | 967 | |
| 964 | 968 | /* Get an arbitrary mm pointer that hasn't been cleaned yet */ |
| 965 | 969 | mutex_lock(&ufile->umap_lock); |
| 966 | − if (!list_empty(&ufile->umaps)) { | |
| 967 | − mm = list_first_entry(&ufile->umaps, | |
| 968 | − struct rdma_umap_priv, list) | |
| 969 | − ->vma->vm_mm; | |
| 970 | − mmget(mm); | |
| 970 | + while (!list_empty(&ufile->umaps)) { | |
| 971 | + int ret; | |
| 972 | + | |
| 973 | + priv = list_first_entry(&ufile->umaps, | |
| 974 | + struct rdma_umap_priv, list); | |
| 975 | + mm = priv->vma->vm_mm; | |
| 976 | + ret = mmget_not_zero(mm); | |
| 977 | + if (!ret) { | |
| 978 | + list_del_init(&priv->list); | |
| 979 | + mm = NULL; | |
| 980 | + continue; | |
| 981 | + } | |
| 982 | + break; | |
| 971 | 983 | } |
| 972 | 984 | mutex_unlock(&ufile->umap_lock); |
| 973 | 985 | if (!mm) |
| @@ -1095,10 +1107,6 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp) · 121 unmodified lines | ||
| 1095 | 1107 | list_del_init(&file->list); |
| 1096 | 1108 | mutex_unlock(&file->device->lists_mutex); |
| 1097 | 1109 | |
| 1098 | − if (file->async_file) | |
| 1099 | − kref_put(&file->async_file->ref, | |
| 1100 | − ib_uverbs_release_async_event_file); | |
| 1101 | − | |
| 1102 | 1110 | kref_put(&file->ref, ib_uverbs_release_file); |
| 1103 | 1111 | |
| 1104 | 1112 | return 0; |
| @@ -168,12 +168,18 @@ void copy_port_attr_to_resp(struct ib_port_attr *attr, · 167 unmodified lines | ||
| 168 | 168 | static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_PORT)( |
| 169 | 169 | struct uverbs_attr_bundle *attrs) |
| 170 | 170 | { |
| 171 | − struct ib_device *ib_dev = attrs->ufile->device->ib_dev; | |
| 171 | + struct ib_device *ib_dev; | |
| 172 | 172 | struct ib_port_attr attr = {}; |
| 173 | 173 | struct ib_uverbs_query_port_resp_ex resp = {}; |
| 174 | + struct ib_ucontext *ucontext; | |
| 174 | 175 | int ret; |
| 175 | 176 | u8 port_num; |
| 176 | 177 | |
| 178 | + ucontext = ib_uverbs_get_ucontext(attrs); | |
| 179 | + if (IS_ERR(ucontext)) | |
| 180 | + return PTR_ERR(ucontext); | |
| 181 | + ib_dev = ucontext->device; | |
| 182 | + | |
| 177 | 183 | /* FIXME: Extend the UAPI_DEF_OBJ_NEEDS_FN stuff.. */ |
| 178 | 184 | if (!ib_dev->ops.query_port) |
| 179 | 185 | return -EOPNOTSUPP; |
| @@ -488,7 +488,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) · 487 unmodified lines | ||
| 488 | 488 | vmf = 1; |
| 489 | 489 | break; |
| 490 | 490 | case STATUS: |
| 491 | − if (flags & (unsigned long)(VM_WRITE | VM_EXEC)) { | |
| 491 | + if (flags & VM_WRITE) { | |
| 492 | 492 | ret = -EPERM; |
| 493 | 493 | goto done; |
| 494 | 494 | } |
| @@ -987,7 +987,6 @@ void hfi1_ud_rcv(struct hfi1_packet *packet) · 986 unmodified lines | ||
| 987 | 987 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 988 | 988 | wc.ex.imm_data = packet->ohdr->u.ud.imm_data; |
| 989 | 989 | wc.wc_flags = IB_WC_WITH_IMM; |
| 990 | − tlen -= sizeof(u32); | |
| 991 | 990 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 992 | 991 | wc.ex.imm_data = 0; |
| 993 | 992 | wc.wc_flags = 0; |
| @@ -210,6 +210,7 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, · 209 unmodified lines | ||
| 210 | 210 | struct ib_udata *udata) |
| 211 | 211 | { |
| 212 | 212 | struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); |
| 213 | + struct hns_roce_ib_create_srq_resp resp = {}; | |
| 213 | 214 | struct hns_roce_srq *srq; |
| 214 | 215 | int srq_desc_size; |
| 215 | 216 | int srq_buf_size; |
| @@ -378,16 +379,21 @@ struct ib_srq *hns_roce_create_srq(struct ib_pd *pd, · 162 unmodified lines | ||
| 378 | 379 | |
| 379 | 380 | srq->event = hns_roce_ib_srq_event; |
| 380 | 381 | srq->ibsrq.ext.xrc.srq_num = srq->srqn; |
| 382 | + resp.srqn = srq->srqn; | |
| 381 | 383 | |
| 382 | 384 | if (udata) { |
| 383 | − if (ib_copy_to_udata(udata, &srq->srqn, sizeof(__u32))) { | |
| 385 | + if (ib_copy_to_udata(udata, &resp, | |
| 386 | + min(udata->outlen, sizeof(resp)))) { | |
| 384 | 387 | ret = -EFAULT; |
| 385 | − goto err_wrid; | |
| 388 | + goto err_srqc_alloc; | |
| 386 | 389 | } |
| 387 | 390 | } |
| 388 | 391 | |
| 389 | 392 | return &srq->ibsrq; |
| 390 | 393 | |
| 394 | +err_srqc_alloc: | |
| 395 | + hns_roce_srq_free(hr_dev, srq); | |
| 396 | + | |
| 391 | 397 | err_wrid: |
| 392 | 398 | kvfree(srq->wrid); |
| 393 | 399 | |
| @@ -1411,7 +1411,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port, · 1410 unmodified lines | ||
| 1411 | 1411 | |
| 1412 | 1412 | sqp_mad = (struct mlx4_mad_snd_buf *) (sqp->tx_ring[wire_tx_ix].buf.addr); |
| 1413 | 1413 | if (sqp->tx_ring[wire_tx_ix].ah) |
| 1414 | − rdma_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); | |
| 1414 | + mlx4_ib_destroy_ah(sqp->tx_ring[wire_tx_ix].ah, 0); | |
| 1415 | 1415 | sqp->tx_ring[wire_tx_ix].ah = ah; |
| 1416 | 1416 | ib_dma_sync_single_for_cpu(&dev->ib_dev, |
| 1417 | 1417 | sqp->tx_ring[wire_tx_ix].buf.map, |
| @@ -1902,7 +1902,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) · 484 unmodified lines | ||
| 1902 | 1902 | if (wc.status == IB_WC_SUCCESS) { |
| 1903 | 1903 | switch (wc.opcode) { |
| 1904 | 1904 | case IB_WC_SEND: |
| 1905 | − rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | |
| 1905 | + mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & | |
| 1906 | 1906 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1907 | 1907 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1908 | 1908 | = NULL; |
| @@ -1931,7 +1931,7 @@ static void mlx4_ib_sqp_comp_worker(struct work_struct *work) · 22 unmodified lines | ||
| 1931 | 1931 | " status = %d, wrid = 0x%llx\n", |
| 1932 | 1932 | ctx->slave, wc.status, wc.wr_id); |
| 1933 | 1933 | if (!MLX4_TUN_IS_RECV(wc.wr_id)) { |
| 1934 | − rdma_destroy_ah(sqp->tx_ring[wc.wr_id & | |
| 1934 | + mlx4_ib_destroy_ah(sqp->tx_ring[wc.wr_id & | |
| 1935 | 1935 | (MLX4_NUM_TUNNEL_BUFS - 1)].ah, 0); |
| 1936 | 1936 | sqp->tx_ring[wc.wr_id & (MLX4_NUM_TUNNEL_BUFS - 1)].ah |
| 1937 | 1937 | = NULL; |
| @@ -630,8 +630,7 @@ const struct uapi_definition mlx5_ib_flow_defs[] = { · 629 unmodified lines | ||
| 630 | 630 | UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), |
| 631 | 631 | UAPI_DEF_CHAIN_OBJ_TREE( |
| 632 | 632 | UVERBS_OBJECT_FLOW, |
| 633 | − &mlx5_ib_fs, | |
| 634 | − UAPI_DEF_IS_OBJ_SUPPORTED(flow_is_supported)), | |
| 633 | + &mlx5_ib_fs), | |
| 635 | 634 | UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_FLOW_ACTION, |
| 636 | 635 | &mlx5_ib_flow_actions), |
| 637 | 636 | {}, |
| @@ -1595,10 +1595,12 @@ static void mlx5_ib_prefetch_mr_work(struct work_struct *work) · 1594 unmodified lines | ||
| 1595 | 1595 | struct prefetch_mr_work *w = |
| 1596 | 1596 | container_of(work, struct prefetch_mr_work, work); |
| 1597 | 1597 | |
| 1598 | − if (w->dev->ib_dev.reg_state == IB_DEV_REGISTERED) | |
| 1598 | + if (ib_device_try_get(&w->dev->ib_dev)) { | |
| 1599 | 1599 | mlx5_ib_prefetch_sg_list(w->dev, w->pf_flags, w->sg_list, |
| 1600 | 1600 | w->num_sge); |
| 1601 | − | |
| 1601 | + ib_device_put(&w->dev->ib_dev); | |
| 1602 | + } | |
| 1603 | + put_device(&w->dev->ib_dev.dev); | |
| 1602 | 1604 | kfree(w); |
| 1603 | 1605 | } |
| 1604 | 1606 | |
| @@ -1617,15 +1619,13 @@ int mlx5_ib_advise_mr_prefetch(struct ib_pd *pd, · 12 unmodified lines | ||
| 1617 | 1619 | return mlx5_ib_prefetch_sg_list(dev, pf_flags, sg_list, |
| 1618 | 1620 | num_sge); |
| 1619 | 1621 | |
| 1620 | − if (dev->ib_dev.reg_state != IB_DEV_REGISTERED) | |
| 1621 | − return -ENODEV; | |
| 1622 | − | |
| 1623 | 1622 | work = kvzalloc(struct_size(work, sg_list, num_sge), GFP_KERNEL); |
| 1624 | 1623 | if (!work) |
| 1625 | 1624 | return -ENOMEM; |
| 1626 | 1625 | |
| 1627 | 1626 | memcpy(work->sg_list, sg_list, num_sge * sizeof(struct ib_sge)); |
| 1628 | 1627 | |
| 1628 | + get_device(&dev->ib_dev.dev); | |
| 1629 | 1629 | work->dev = dev; |
| 1630 | 1630 | work->pf_flags = pf_flags; |
| 1631 | 1631 | work->num_sge = num_sge; |
| @@ -1912,14 +1912,16 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, · 1911 unmodified lines | ||
| 1912 | 1912 | } |
| 1913 | 1913 | |
| 1914 | 1914 | if (!check_flags_mask(ucmd.flags, |
| 1915 | + MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | |
| 1916 | + MLX5_QP_FLAG_BFREG_INDEX | | |
| 1917 | + MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE | | |
| 1918 | + MLX5_QP_FLAG_SCATTER_CQE | | |
| 1915 | 1919 | MLX5_QP_FLAG_SIGNATURE | |
| 1916 | − MLX5_QP_FLAG_SCATTER_CQE | | |
| 1917 | − MLX5_QP_FLAG_TUNNEL_OFFLOADS | | |
| 1918 | − MLX5_QP_FLAG_BFREG_INDEX | | |
| 1919 | − MLX5_QP_FLAG_TYPE_DCT | | |
| 1920 | − MLX5_QP_FLAG_TYPE_DCI | | |
| 1921 | − MLX5_QP_FLAG_ALLOW_SCATTER_CQE | | |
| 1922 | − MLX5_QP_FLAG_PACKET_BASED_CREDIT_MODE)) | |
| 1920 | + MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_MC | | |
| 1921 | + MLX5_QP_FLAG_TIR_ALLOW_SELF_LB_UC | | |
| 1922 | + MLX5_QP_FLAG_TUNNEL_OFFLOADS | | |
| 1923 | + MLX5_QP_FLAG_TYPE_DCI | | |
| 1924 | + MLX5_QP_FLAG_TYPE_DCT)) | |
| 1923 | 1925 | return -EINVAL; |
| 1924 | 1926 | |
| 1925 | 1927 | err = get_qp_user_index(to_mucontext(pd->uobject->context), |
| @@ -534,7 +534,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, · 533 unmodified lines | ||
| 534 | 534 | { |
| 535 | 535 | struct mthca_ucontext *context; |
| 536 | 536 | |
| 537 | − qp = kmalloc(sizeof *qp, GFP_KERNEL); | |
| 537 | + qp = kzalloc(sizeof(*qp), GFP_KERNEL); | |
| 538 | 538 | if (!qp) |
| 539 | 539 | return ERR_PTR(-ENOMEM); |
| 540 | 540 | |
| @@ -600,7 +600,7 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd, · 59 unmodified lines | ||
| 600 | 600 | if (udata) |
| 601 | 601 | return ERR_PTR(-EINVAL); |
| 602 | 602 | |
| 603 | − qp = kmalloc(sizeof (struct mthca_sqp), GFP_KERNEL); | |
| 603 | + qp = kzalloc(sizeof(struct mthca_sqp), GFP_KERNEL); | |
| 604 | 604 | if (!qp) |
| 605 | 605 | return ERR_PTR(-ENOMEM); |
| 606 | 606 | |
| @@ -512,7 +512,6 @@ void qib_ud_rcv(struct qib_ibport *ibp, struct ib_header *hdr, · 511 unmodified lines | ||
| 512 | 512 | opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) { |
| 513 | 513 | wc.ex.imm_data = ohdr->u.ud.imm_data; |
| 514 | 514 | wc.wc_flags = IB_WC_WITH_IMM; |
| 515 | − tlen -= sizeof(u32); | |
| 516 | 515 | } else if (opcode == IB_OPCODE_UD_SEND_ONLY) { |
| 517 | 516 | wc.ex.imm_data = 0; |
| 518 | 517 | wc.wc_flags = 0; |
| @@ -427,7 +427,40 @@ static inline enum ib_qp_state pvrdma_qp_state_to_ib(enum pvrdma_qp_state state) · 426 unmodified lines | ||
| 427 | 427 | |
| 428 | 428 | static inline enum pvrdma_wr_opcode ib_wr_opcode_to_pvrdma(enum ib_wr_opcode op) |
| 429 | 429 | { |
| 430 | − return (enum pvrdma_wr_opcode)op; | |
| 430 | + switch (op) { | |
| 431 | + case IB_WR_RDMA_WRITE: | |
| 432 | + return PVRDMA_WR_RDMA_WRITE; | |
| 433 | + case IB_WR_RDMA_WRITE_WITH_IMM: | |
| 434 | + return PVRDMA_WR_RDMA_WRITE_WITH_IMM; | |
| 435 | + case IB_WR_SEND: | |
| 436 | + return PVRDMA_WR_SEND; | |
| 437 | + case IB_WR_SEND_WITH_IMM: | |
| 438 | + return PVRDMA_WR_SEND_WITH_IMM; | |
| 439 | + case IB_WR_RDMA_READ: | |
| 440 | + return PVRDMA_WR_RDMA_READ; | |
| 441 | + case IB_WR_ATOMIC_CMP_AND_SWP: | |
| 442 | + return PVRDMA_WR_ATOMIC_CMP_AND_SWP; | |
| 443 | + case IB_WR_ATOMIC_FETCH_AND_ADD: | |
| 444 | + return PVRDMA_WR_ATOMIC_FETCH_AND_ADD; | |
| 445 | + case IB_WR_LSO: | |
| 446 | + return PVRDMA_WR_LSO; | |
| 447 | + case IB_WR_SEND_WITH_INV: | |
| 448 | + return PVRDMA_WR_SEND_WITH_INV; | |
| 449 | + case IB_WR_RDMA_READ_WITH_INV: | |
| 450 | + return PVRDMA_WR_RDMA_READ_WITH_INV; | |
| 451 | + case IB_WR_LOCAL_INV: | |
| 452 | + return PVRDMA_WR_LOCAL_INV; | |
| 453 | + case IB_WR_REG_MR: | |
| 454 | + return PVRDMA_WR_FAST_REG_MR; | |
| 455 | + case IB_WR_MASKED_ATOMIC_CMP_AND_SWP: | |
| 456 | + return PVRDMA_WR_MASKED_ATOMIC_CMP_AND_SWP; | |
| 457 | + case IB_WR_MASKED_ATOMIC_FETCH_AND_ADD: | |
| 458 | + return PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD; | |
| 459 | + case IB_WR_REG_SIG_MR: | |
| 460 | + return PVRDMA_WR_REG_SIG_MR; | |
| 461 | + default: | |
| 462 | + return PVRDMA_WR_ERROR; | |
| 463 | + } | |
| 431 | 464 | } |
| 432 | 465 | |
| 433 | 466 | static inline enum ib_wc_status pvrdma_wc_status_to_ib( |
| @@ -721,6 +721,12 @@ int pvrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, · 720 unmodified lines | ||
| 721 | 721 | wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM) |
| 722 | 722 | wqe_hdr->ex.imm_data = wr->ex.imm_data; |
| 723 | 723 | |
| 724 | + if (unlikely(wqe_hdr->opcode == PVRDMA_WR_ERROR)) { | |
| 725 | + *bad_wr = wr; | |
| 726 | + ret = -EINVAL; | |
| 727 | + goto out; | |
| 728 | + } | |
| 729 | + | |
| 724 | 730 | switch (qp->ibqp.qp_type) { |
| 725 | 731 | case IB_QPT_GSI: |
| 726 | 732 | case IB_QPT_UD: |
| @@ -2910,6 +2910,8 @@ send: · 2909 unmodified lines | ||
| 2910 | 2910 | goto op_err; |
| 2911 | 2911 | if (!ret) |
| 2912 | 2912 | goto rnr_nak; |
| 2913 | + if (wqe->length > qp->r_len) | |
| 2914 | + goto inv_err; | |
| 2913 | 2915 | break; |
| 2914 | 2916 | |
| 2915 | 2917 | case IB_WR_RDMA_WRITE_WITH_IMM: |
| @@ -3078,7 +3080,10 @@ op_err: · 162 unmodified lines | ||
| 3078 | 3080 | goto err; |
| 3079 | 3081 | |
| 3080 | 3082 | inv_err: |
| 3081 | − send_status = IB_WC_REM_INV_REQ_ERR; | |
| 3083 | + send_status = | |
| 3084 | + sqp->ibqp.qp_type == IB_QPT_RC ? | |
| 3085 | + IB_WC_REM_INV_REQ_ERR : | |
| 3086 | + IB_WC_SUCCESS; | |
| 3082 | 3087 | wc.status = IB_WC_LOC_QP_OP_ERR; |
| 3083 | 3088 | goto err; |
| 3084 | 3089 | |
| @@ -248,7 +248,6 @@ struct ipoib_cm_tx { · 247 unmodified lines | ||
| 248 | 248 | struct list_head list; |
| 249 | 249 | struct net_device *dev; |
| 250 | 250 | struct ipoib_neigh *neigh; |
| 251 | − struct ipoib_path *path; | |
| 252 | 251 | struct ipoib_tx_buf *tx_ring; |
| 253 | 252 | unsigned int tx_head; |
| 254 | 253 | unsigned int tx_tail; |
| @@ -1312,7 +1312,6 @@ struct ipoib_cm_tx *ipoib_cm_create_tx(struct net_device *dev, struct ipoib_path · 1311 unmodified lines | ||
| 1312 | 1312 | |
| 1313 | 1313 | neigh->cm = tx; |
| 1314 | 1314 | tx->neigh = neigh; |
| 1315 | − tx->path = path; | |
| 1316 | 1315 | tx->dev = dev; |
| 1317 | 1316 | list_add(&tx->list, &priv->cm.start_list); |
| 1318 | 1317 | set_bit(IPOIB_FLAG_INITIALIZED, &tx->flags); |
| @@ -1371,7 +1370,7 @@ static void ipoib_cm_tx_start(struct work_struct *work) · 52 unmodified lines | ||
| 1371 | 1370 | neigh->daddr + QPN_AND_OPTIONS_OFFSET); |
| 1372 | 1371 | goto free_neigh; |
| 1373 | 1372 | } |
| 1374 | − memcpy(&pathrec, &p->path->pathrec, sizeof(pathrec)); | |
| 1373 | + memcpy(&pathrec, &path->pathrec, sizeof(pathrec)); | |
| 1375 | 1374 | |
| 1376 | 1375 | spin_unlock_irqrestore(&priv->lock, flags); |
| 1377 | 1376 | netif_tx_unlock_bh(dev); |
| @@ -252,6 +252,8 @@ static const struct xpad_device { · 251 unmodified lines | ||
| 252 | 252 | { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, |
| 253 | 253 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, |
| 254 | 254 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, |
| 255 | + { 0x1038, 0x1430, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, | |
| 256 | + { 0x1038, 0x1431, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, | |
| 255 | 257 | { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 }, |
| 256 | 258 | { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, |
| 257 | 259 | { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 }, |
| @@ -428,6 +430,7 @@ static const struct usb_device_id xpad_table[] = { · 170 unmodified lines | ||
| 428 | 430 | XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ |
| 429 | 431 | XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ |
| 430 | 432 | XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ |
| 433 | + XPAD_XBOX360_VENDOR(0x1038), /* SteelSeries Controllers */ | |
| 431 | 434 | XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */ |
| 432 | 435 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ |
| 433 | 436 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ |
| @@ -39,6 +39,7 @@ · 38 unmodified lines | ||
| 39 | 39 | #include <linux/init.h> |
| 40 | 40 | #include <linux/fs.h> |
| 41 | 41 | #include <linux/miscdevice.h> |
| 42 | +#include <linux/overflow.h> | |
| 42 | 43 | #include <linux/input/mt.h> |
| 43 | 44 | #include "../input-compat.h" |
| 44 | 45 | |
| @@ -405,7 +406,7 @@ static int uinput_open(struct inode *inode, struct file *file) · 360 unmodified lines | ||
| 405 | 406 | static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code, |
| 406 | 407 | const struct input_absinfo *abs) |
| 407 | 408 | { |
| 408 | − int min, max; | |
| 409 | + int min, max, range; | |
| 409 | 410 | |
| 410 | 411 | min = abs->minimum; |
| 411 | 412 | max = abs->maximum; |
| @@ -417,7 +418,7 @@ static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code, · 5 unmodified lines | ||
| 417 | 418 | return -EINVAL; |
| 418 | 419 | } |
| 419 | 420 | |
| 420 | − if (abs->flat > max - min) { | |
| 421 | + if (!check_sub_overflow(max, min, &range) && abs->flat > range) { | |
| 421 | 422 | printk(KERN_DEBUG |
| 422 | 423 | "%s: abs_flat #%02x out of range: %d (min:%d/max:%d)\n", |
| 423 | 424 | UINPUT_NAME, code, abs->flat, min, max); |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/of.h> |
| 24 | 24 | #include <linux/slab.h> |
| 25 | 25 | #include <linux/delay.h> |
| 26 | −#include <linux/clk.h> | |
| 27 | 26 | |
| 28 | 27 | /* |
| 29 | 28 | * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller. |
| @@ -75,7 +74,6 @@ struct olpc_apsp { · 45 unmodified lines | ||
| 75 | 74 | struct serio *kbio; |
| 76 | 75 | struct serio *padio; |
| 77 | 76 | void __iomem *base; |
| 78 | − struct clk *clk; | |
| 79 | 77 | int open_count; |
| 80 | 78 | int irq; |
| 81 | 79 | }; |
| @@ -148,17 +146,11 @@ static int olpc_apsp_open(struct serio *port) · 66 unmodified lines | ||
| 148 | 146 | struct olpc_apsp *priv = port->port_data; |
| 149 | 147 | unsigned int tmp; |
| 150 | 148 | unsigned long l; |
| 151 | − int error; | |
| 152 | 149 | |
| 153 | 150 | if (priv->open_count++ == 0) { |
| 154 | − error = clk_prepare_enable(priv->clk); | |
| 155 | − if (error) | |
| 156 | − return error; | |
| 157 | − | |
| 158 | 151 | l = readl(priv->base + COMMAND_FIFO_STATUS); |
| 159 | 152 | if (!(l & CMD_STS_MASK)) { |
| 160 | 153 | dev_err(priv->dev, "SP cannot accept commands.\n"); |
| 161 | − clk_disable_unprepare(priv->clk); | |
| 162 | 154 | return -EIO; |
| 163 | 155 | } |
| 164 | 156 | |
| @@ -179,8 +171,6 @@ static void olpc_apsp_close(struct serio *port) · 14 unmodified lines | ||
| 179 | 171 | /* Disable interrupt 0 */ |
| 180 | 172 | tmp = readl(priv->base + PJ_INTERRUPT_MASK); |
| 181 | 173 | writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK); |
| 182 | − | |
| 183 | − clk_disable_unprepare(priv->clk); | |
| 184 | 174 | } |
| 185 | 175 | } |
| 186 | 176 | |
| @@ -195,6 +185,8 @@ static int olpc_apsp_probe(struct platform_device *pdev) · 8 unmodified lines | ||
| 195 | 185 | if (!priv) |
| 196 | 186 | return -ENOMEM; |
| 197 | 187 | |
| 188 | + priv->dev = &pdev->dev; | |
| 189 | + | |
| 198 | 190 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 199 | 191 | priv->base = devm_ioremap_resource(&pdev->dev, res); |
| 200 | 192 | if (IS_ERR(priv->base)) { |
| @@ -206,10 +198,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) · 5 unmodified lines | ||
| 206 | 198 | if (priv->irq < 0) |
| 207 | 199 | return priv->irq; |
| 208 | 200 | |
| 209 | − priv->clk = devm_clk_get(&pdev->dev, "sp"); | |
| 210 | − if (IS_ERR(priv->clk)) | |
| 211 | − return PTR_ERR(priv->clk); | |
| 212 | − | |
| 213 | 201 | /* KEYBOARD */ |
| 214 | 202 | kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
| 215 | 203 | if (!kb_serio) |
| @@ -248,7 +236,6 @@ static int olpc_apsp_probe(struct platform_device *pdev) · 32 unmodified lines | ||
| 248 | 236 | goto err_irq; |
| 249 | 237 | } |
| 250 | 238 | |
| 251 | − priv->dev = &pdev->dev; | |
| 252 | 239 | device_init_wakeup(priv->dev, 1); |
| 253 | 240 | platform_set_drvdata(pdev, priv); |
| 254 | 241 | |
| @@ -698,7 +698,7 @@ config TOUCHSCREEN_EDT_FT5X06 · 697 unmodified lines | ||
| 698 | 698 | |
| 699 | 699 | config TOUCHSCREEN_RASPBERRYPI_FW |
| 700 | 700 | tristate "Raspberry Pi's firmware base touch screen support" |
| 701 | − depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST | |
| 701 | + depends on RASPBERRYPI_FIRMWARE || (RASPBERRYPI_FIRMWARE=n && COMPILE_TEST) | |
| 702 | 702 | help |
| 703 | 703 | Say Y here if you have the official Raspberry Pi 7 inch screen on |
| 704 | 704 | your system. |
| @@ -1991,16 +1991,13 @@ static void do_attach(struct iommu_dev_data *dev_data, · 1990 unmodified lines | ||
| 1991 | 1991 | |
| 1992 | 1992 | static void do_detach(struct iommu_dev_data *dev_data) |
| 1993 | 1993 | { |
| 1994 | + struct protection_domain *domain = dev_data->domain; | |
| 1994 | 1995 | struct amd_iommu *iommu; |
| 1995 | 1996 | u16 alias; |
| 1996 | 1997 | |
| 1997 | 1998 | iommu = amd_iommu_rlookup_table[dev_data->devid]; |
| 1998 | 1999 | alias = dev_data->alias; |
| 1999 | 2000 | |
| 2000 | − /* decrease reference counters */ | |
| 2001 | − dev_data->domain->dev_iommu[iommu->index] -= 1; | |
| 2002 | − dev_data->domain->dev_cnt -= 1; | |
| 2003 | − | |
| 2004 | 2001 | /* Update data structures */ |
| 2005 | 2002 | dev_data->domain = NULL; |
| 2006 | 2003 | list_del(&dev_data->list); |
| @@ -2010,6 +2007,16 @@ static void do_detach(struct iommu_dev_data *dev_data) · 3 unmodified lines | ||
| 2010 | 2007 | |
| 2011 | 2008 | /* Flush the DTE entry */ |
| 2012 | 2009 | device_flush_dte(dev_data); |
| 2010 | + | |
| 2011 | + /* Flush IOTLB */ | |
| 2012 | + domain_flush_tlb_pde(domain); | |
| 2013 | + | |
| 2014 | + /* Wait for the flushes to finish */ | |
| 2015 | + domain_flush_complete(domain); | |
| 2016 | + | |
| 2017 | + /* decrease reference counters - needs to happen after the flushes */ | |
| 2018 | + domain->dev_iommu[iommu->index] -= 1; | |
| 2019 | + domain->dev_cnt -= 1; | |
| 2013 | 2020 | } |
| 2014 | 2021 | |
| 2015 | 2022 | /* |
| @@ -2617,13 +2624,13 @@ out_unmap: · 601 unmodified lines | ||
| 2617 | 2624 | bus_addr = address + s->dma_address + (j << PAGE_SHIFT); |
| 2618 | 2625 | iommu_unmap_page(domain, bus_addr, PAGE_SIZE); |
| 2619 | 2626 | |
| 2620 | − if (--mapped_pages) | |
| 2627 | + if (--mapped_pages == 0) | |
| 2621 | 2628 | goto out_free_iova; |
| 2622 | 2629 | } |
| 2623 | 2630 | } |
| 2624 | 2631 | |
| 2625 | 2632 | out_free_iova: |
| 2626 | − free_iova_fast(&dma_dom->iovad, address, npages); | |
| 2633 | + free_iova_fast(&dma_dom->iovad, address >> PAGE_SHIFT, npages); | |
| 2627 | 2634 | |
| 2628 | 2635 | out_err: |
| 2629 | 2636 | return 0; |
| @@ -5294,7 +5294,7 @@ static void intel_iommu_put_resv_regions(struct device *dev, · 5293 unmodified lines | ||
| 5294 | 5294 | struct iommu_resv_region *entry, *next; |
| 5295 | 5295 | |
| 5296 | 5296 | list_for_each_entry_safe(entry, next, head, list) { |
| 5297 | − if (entry->type == IOMMU_RESV_RESERVED) | |
| 5297 | + if (entry->type == IOMMU_RESV_MSI) | |
| 5298 | 5298 | kfree(entry); |
| 5299 | 5299 | } |
| 5300 | 5300 | } |
| @@ -441,6 +441,10 @@ static int mtk_iommu_add_device(struct device *dev) · 440 unmodified lines | ||
| 441 | 441 | iommu_spec.args_count = count; |
| 442 | 442 | |
| 443 | 443 | mtk_iommu_create_mapping(dev, &iommu_spec); |
| 444 | + | |
| 445 | + /* dev->iommu_fwspec might have changed */ | |
| 446 | + fwspec = dev_iommu_fwspec_get(dev); | |
| 447 | + | |
| 444 | 448 | of_node_put(iommu_spec.np); |
| 445 | 449 | } |
| 446 | 450 | |
| @@ -224,7 +224,7 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, · 223 unmodified lines | ||
| 224 | 224 | * If we have reason to believe the IOMMU driver missed the initial |
| 225 | 225 | * probe for dev, replay it to get things in order. |
| 226 | 226 | */ |
| 227 | − if (dev->bus && !device_iommu_mapped(dev)) | |
| 227 | + if (!err && dev->bus && !device_iommu_mapped(dev)) | |
| 228 | 228 | err = iommu_probe_device(dev); |
| 229 | 229 | |
| 230 | 230 | /* Ignore all other errors apart from EPROBE_DEFER */ |
| @@ -2399,13 +2399,14 @@ static void its_free_device(struct its_device *its_dev) · 2398 unmodified lines | ||
| 2399 | 2399 | kfree(its_dev); |
| 2400 | 2400 | } |
| 2401 | 2401 | |
| 2402 | −static int its_alloc_device_irq(struct its_device *dev, irq_hw_number_t *hwirq) | |
| 2402 | +static int its_alloc_device_irq(struct its_device *dev, int nvecs, irq_hw_number_t *hwirq) | |
| 2403 | 2403 | { |
| 2404 | 2404 | int idx; |
| 2405 | 2405 | |
| 2406 | − idx = find_first_zero_bit(dev->event_map.lpi_map, | |
| 2407 | − dev->event_map.nr_lpis); | |
| 2408 | − if (idx == dev->event_map.nr_lpis) | |
| 2406 | + idx = bitmap_find_free_region(dev->event_map.lpi_map, | |
| 2407 | + dev->event_map.nr_lpis, | |
| 2408 | + get_count_order(nvecs)); | |
| 2409 | + if (idx < 0) | |
| 2409 | 2410 | return -ENOSPC; |
| 2410 | 2411 | |
| 2411 | 2412 | *hwirq = dev->event_map.lpi_base + idx; |
| @@ -2501,21 +2502,21 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, · 89 unmodified lines | ||
| 2501 | 2502 | int err; |
| 2502 | 2503 | int i; |
| 2503 | 2504 | |
| 2504 | − for (i = 0; i < nr_irqs; i++) { | |
| 2505 | − err = its_alloc_device_irq(its_dev, &hwirq); | |
| 2506 | − if (err) | |
| 2507 | − return err; | |
| 2505 | + err = its_alloc_device_irq(its_dev, nr_irqs, &hwirq); | |
| 2506 | + if (err) | |
| 2507 | + return err; | |
| 2508 | 2508 | |
| 2509 | − err = its_irq_gic_domain_alloc(domain, virq + i, hwirq); | |
| 2509 | + for (i = 0; i < nr_irqs; i++) { | |
| 2510 | + err = its_irq_gic_domain_alloc(domain, virq + i, hwirq + i); | |
| 2510 | 2511 | if (err) |
| 2511 | 2512 | return err; |
| 2512 | 2513 | |
| 2513 | 2514 | irq_domain_set_hwirq_and_chip(domain, virq + i, |
| 2514 | − hwirq, &its_irq_chip, its_dev); | |
| 2515 | + hwirq + i, &its_irq_chip, its_dev); | |
| 2515 | 2516 | irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq + i))); |
| 2516 | 2517 | pr_debug("ID:%d pID:%d vID:%d\n", |
| 2517 | − (int)(hwirq - its_dev->event_map.lpi_base), | |
| 2518 | − (int) hwirq, virq + i); | |
| 2518 | + (int)(hwirq + i - its_dev->event_map.lpi_base), | |
| 2519 | + (int)(hwirq + i), virq + i); | |
| 2519 | 2520 | } |
| 2520 | 2521 | |
| 2521 | 2522 | return 0; |
| @@ -24,7 +24,7 @@ struct mbi_range { · 23 unmodified lines | ||
| 24 | 24 | unsigned long *bm; |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | −static struct mutex mbi_lock; | |
| 27 | +static DEFINE_MUTEX(mbi_lock); | |
| 28 | 28 | static phys_addr_t mbi_phys_base; |
| 29 | 29 | static struct mbi_range *mbi_ranges; |
| 30 | 30 | static unsigned int mbi_range_nr; |
| @@ -7,7 +7,6 @@ · 6 unmodified lines | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | #include <linux/module.h> |
| 10 | −#include <linux/gpio.h> | |
| 11 | 10 | #include <linux/interrupt.h> |
| 12 | 11 | #include <linux/irq.h> |
| 13 | 12 | #include <linux/irqdomain.h> |
| @@ -16,7 +15,6 @@ · 2 unmodified lines | ||
| 16 | 15 | #include <linux/slab.h> |
| 17 | 16 | #include <linux/of.h> |
| 18 | 17 | #include <linux/of_device.h> |
| 19 | −#include <linux/of_gpio.h> | |
| 20 | 18 | #include <linux/of_irq.h> |
| 21 | 19 | #include <linux/irqchip/irq-madera.h> |
| 22 | 20 | #include <linux/mfd/madera/core.h> |
| @@ -822,6 +822,7 @@ out_unmap: · 821 unmodified lines | ||
| 822 | 822 | static const struct irq_domain_ops stm32_exti_h_domain_ops = { |
| 823 | 823 | .alloc = stm32_exti_h_domain_alloc, |
| 824 | 824 | .free = irq_domain_free_irqs_common, |
| 825 | + .xlate = irq_domain_xlate_twocell, | |
| 825 | 826 | }; |
| 826 | 827 | |
| 827 | 828 | static int |
| @@ -71,14 +71,17 @@ static void xtensa_mx_irq_mask(struct irq_data *d) · 70 unmodified lines | ||
| 71 | 71 | unsigned int mask = 1u << d->hwirq; |
| 72 | 72 | |
| 73 | 73 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | |
| 74 | − XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | |
| 75 | − set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - | |
| 76 | − HW_IRQ_MX_BASE), MIENG); | |
| 77 | − } else { | |
| 78 | − mask = __this_cpu_read(cached_irq_mask) & ~mask; | |
| 79 | − __this_cpu_write(cached_irq_mask, mask); | |
| 80 | − xtensa_set_sr(mask, intenable); | |
| 74 | + XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | |
| 75 | + unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq); | |
| 76 | + | |
| 77 | + if (ext_irq >= HW_IRQ_MX_BASE) { | |
| 78 | + set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENG); | |
| 79 | + return; | |
| 80 | + } | |
| 81 | 81 | } |
| 82 | + mask = __this_cpu_read(cached_irq_mask) & ~mask; | |
| 83 | + __this_cpu_write(cached_irq_mask, mask); | |
| 84 | + xtensa_set_sr(mask, intenable); | |
| 82 | 85 | } |
| 83 | 86 | |
| 84 | 87 | static void xtensa_mx_irq_unmask(struct irq_data *d) |
| @@ -86,14 +89,17 @@ static void xtensa_mx_irq_unmask(struct irq_data *d) · 1 unmodified line | ||
| 86 | 89 | unsigned int mask = 1u << d->hwirq; |
| 87 | 90 | |
| 88 | 91 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | |
| 89 | − XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | |
| 90 | − set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - | |
| 91 | − HW_IRQ_MX_BASE), MIENGSET); | |
| 92 | − } else { | |
| 93 | − mask |= __this_cpu_read(cached_irq_mask); | |
| 94 | − __this_cpu_write(cached_irq_mask, mask); | |
| 95 | − xtensa_set_sr(mask, intenable); | |
| 92 | + XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | |
| 93 | + unsigned int ext_irq = xtensa_get_ext_irq_no(d->hwirq); | |
| 94 | + | |
| 95 | + if (ext_irq >= HW_IRQ_MX_BASE) { | |
| 96 | + set_er(1u << (ext_irq - HW_IRQ_MX_BASE), MIENGSET); | |
| 97 | + return; | |
| 98 | + } | |
| 96 | 99 | } |
| 100 | + mask |= __this_cpu_read(cached_irq_mask); | |
| 101 | + __this_cpu_write(cached_irq_mask, mask); | |
| 102 | + xtensa_set_sr(mask, intenable); | |
| 97 | 103 | } |
| 98 | 104 | |
| 99 | 105 | static void xtensa_mx_irq_enable(struct irq_data *d) |
| @@ -113,7 +119,11 @@ static void xtensa_mx_irq_ack(struct irq_data *d) · 13 unmodified lines | ||
| 113 | 119 | |
| 114 | 120 | static int xtensa_mx_irq_retrigger(struct irq_data *d) |
| 115 | 121 | { |
| 116 | − xtensa_set_sr(1 << d->hwirq, intset); | |
| 122 | + unsigned int mask = 1u << d->hwirq; | |
| 123 | + | |
| 124 | + if (WARN_ON(mask & ~XCHAL_INTTYPE_MASK_SOFTWARE)) | |
| 125 | + return 0; | |
| 126 | + xtensa_set_sr(mask, intset); | |
| 117 | 127 | return 1; |
| 118 | 128 | } |
| 119 | 129 | |
| @@ -70,7 +70,11 @@ static void xtensa_irq_ack(struct irq_data *d) · 69 unmodified lines | ||
| 70 | 70 | |
| 71 | 71 | static int xtensa_irq_retrigger(struct irq_data *d) |
| 72 | 72 | { |
| 73 | − xtensa_set_sr(1 << d->hwirq, intset); | |
| 73 | + unsigned int mask = 1u << d->hwirq; | |
| 74 | + | |
| 75 | + if (WARN_ON(mask & ~XCHAL_INTTYPE_MASK_SOFTWARE)) | |
| 76 | + return 0; | |
| 77 | + xtensa_set_sr(mask, intset); | |
| 74 | 78 | return 1; |
| 75 | 79 | } |
| 76 | 80 | |
| @@ -423,7 +423,7 @@ void b1_parse_version(avmctrl_info *cinfo) · 422 unmodified lines | ||
| 423 | 423 | int i, j; |
| 424 | 424 | |
| 425 | 425 | for (j = 0; j < AVM_MAXVERSION; j++) |
| 426 | − cinfo->version[j] = "\0\0" + 1; | |
| 426 | + cinfo->version[j] = ""; | |
| 427 | 427 | for (i = 0, j = 0; |
| 428 | 428 | j < AVM_MAXVERSION && i < cinfo->versionlen; |
| 429 | 429 | j++, i += cinfo->versionbuf[i] + 1) |
| @@ -262,8 +262,7 @@ hfcsusb_ph_info(struct hfcsusb *hw) · 261 unmodified lines | ||
| 262 | 262 | struct dchannel *dch = &hw->dch; |
| 263 | 263 | int i; |
| 264 | 264 | |
| 265 | − phi = kzalloc(sizeof(struct ph_info) + | |
| 266 | − dch->dev.nrbchan * sizeof(struct ph_info_ch), GFP_ATOMIC); | |
| 265 | + phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC); | |
| 267 | 266 | phi->dch.ch.protocol = hw->protocol; |
| 268 | 267 | phi->dch.ch.Flags = dch->Flags; |
| 269 | 268 | phi->dch.state = dch->state; |
| @@ -1437,15 +1437,19 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) · 1436 unmodified lines | ||
| 1437 | 1437 | { |
| 1438 | 1438 | modem_info *info = (modem_info *) tty->driver_data; |
| 1439 | 1439 | |
| 1440 | + mutex_lock(&modem_info_mutex); | |
| 1440 | 1441 | if (!old_termios) |
| 1441 | 1442 | isdn_tty_change_speed(info); |
| 1442 | 1443 | else { |
| 1443 | 1444 | if (tty->termios.c_cflag == old_termios->c_cflag && |
| 1444 | 1445 | tty->termios.c_ispeed == old_termios->c_ispeed && |
| 1445 | − tty->termios.c_ospeed == old_termios->c_ospeed) | |
| 1446 | + tty->termios.c_ospeed == old_termios->c_ospeed) { | |
| 1447 | + mutex_unlock(&modem_info_mutex); | |
| 1446 | 1448 | return; |
| 1449 | + } | |
| 1447 | 1450 | isdn_tty_change_speed(info); |
| 1448 | 1451 | } |
| 1452 | + mutex_unlock(&modem_info_mutex); | |
| 1449 | 1453 | } |
| 1450 | 1454 | |
| 1451 | 1455 | /* |
| @@ -318,7 +318,9 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip) · 317 unmodified lines | ||
| 318 | 318 | |
| 319 | 319 | /* Let the programs run for couple of ms and check the engine status */ |
| 320 | 320 | usleep_range(3000, 6000); |
| 321 | − lp55xx_read(chip, LP5523_REG_STATUS, &status); | |
| 321 | + ret = lp55xx_read(chip, LP5523_REG_STATUS, &status); | |
| 322 | + if (ret) | |
| 323 | + return ret; | |
| 322 | 324 | status &= LP5523_ENG_STATUS_MASK; |
| 323 | 325 | |
| 324 | 326 | if (status != LP5523_ENG_STATUS_MASK) { |
| @@ -2414,9 +2414,21 @@ static int crypt_ctr_cipher_new(struct dm_target *ti, char *cipher_in, char *key · 2413 unmodified lines | ||
| 2414 | 2414 | * capi:cipher_api_spec-iv:ivopts |
| 2415 | 2415 | */ |
| 2416 | 2416 | tmp = &cipher_in[strlen("capi:")]; |
| 2417 | − cipher_api = strsep(&tmp, "-"); | |
| 2418 | − *ivmode = strsep(&tmp, ":"); | |
| 2419 | − *ivopts = tmp; | |
| 2417 | + | |
| 2418 | + /* Separate IV options if present, it can contain another '-' in hash name */ | |
| 2419 | + *ivopts = strrchr(tmp, ':'); | |
| 2420 | + if (*ivopts) { | |
| 2421 | + **ivopts = '\0'; | |
| 2422 | + (*ivopts)++; | |
| 2423 | + } | |
| 2424 | + /* Parse IV mode */ | |
| 2425 | + *ivmode = strrchr(tmp, '-'); | |
| 2426 | + if (*ivmode) { | |
| 2427 | + **ivmode = '\0'; | |
| 2428 | + (*ivmode)++; | |
| 2429 | + } | |
| 2430 | + /* The rest is crypto API spec */ | |
| 2431 | + cipher_api = tmp; | |
| 2420 | 2432 | |
| 2421 | 2433 | if (*ivmode && !strcmp(*ivmode, "lmk")) |
| 2422 | 2434 | cc->tfms_count = 64; |
| @@ -2486,11 +2498,8 @@ static int crypt_ctr_cipher_old(struct dm_target *ti, char *cipher_in, char *key · 63 unmodified lines | ||
| 2486 | 2498 | goto bad_mem; |
| 2487 | 2499 | |
| 2488 | 2500 | chainmode = strsep(&tmp, "-"); |
| 2489 | − *ivopts = strsep(&tmp, "-"); | |
| 2490 | − *ivmode = strsep(&*ivopts, ":"); | |
| 2491 | − | |
| 2492 | − if (tmp) | |
| 2493 | − DMWARN("Ignoring unexpected additional cipher options"); | |
| 2501 | + *ivmode = strsep(&tmp, ":"); | |
| 2502 | + *ivopts = tmp; | |
| 2494 | 2503 | |
| 2495 | 2504 | /* |
| 2496 | 2505 | * For compatibility with the original dm-crypt mapping format, if |
| @@ -131,7 +131,7 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig) · 130 unmodified lines | ||
| 131 | 131 | static void rq_completed(struct mapped_device *md) |
| 132 | 132 | { |
| 133 | 133 | /* nudge anyone waiting on suspend queue */ |
| 134 | − if (unlikely(waitqueue_active(&md->wait))) | |
| 134 | + if (unlikely(wq_has_sleeper(&md->wait))) | |
| 135 | 135 | wake_up(&md->wait); |
| 136 | 136 | |
| 137 | 137 | /* |
| @@ -1678,7 +1678,7 @@ int dm_thin_remove_range(struct dm_thin_device *td, · 1677 unmodified lines | ||
| 1678 | 1678 | return r; |
| 1679 | 1679 | } |
| 1680 | 1680 | |
| 1681 | −int dm_pool_block_is_used(struct dm_pool_metadata *pmd, dm_block_t b, bool *result) | |
| 1681 | +int dm_pool_block_is_shared(struct dm_pool_metadata *pmd, dm_block_t b, bool *result) | |
| 1682 | 1682 | { |
| 1683 | 1683 | int r; |
| 1684 | 1684 | uint32_t ref_count; |
| @@ -1686,7 +1686,7 @@ int dm_pool_block_is_used(struct dm_pool_metadata *pmd, dm_block_t b, bool *resu · 1 unmodified line | ||
| 1686 | 1686 | down_read(&pmd->root_lock); |
| 1687 | 1687 | r = dm_sm_get_count(pmd->data_sm, b, &ref_count); |
| 1688 | 1688 | if (!r) |
| 1689 | − *result = (ref_count != 0); | |
| 1689 | + *result = (ref_count > 1); | |
| 1690 | 1690 | up_read(&pmd->root_lock); |
| 1691 | 1691 | |
| 1692 | 1692 | return r; |
| @@ -195,7 +195,7 @@ int dm_pool_get_metadata_dev_size(struct dm_pool_metadata *pmd, · 194 unmodified lines | ||
| 195 | 195 | |
| 196 | 196 | int dm_pool_get_data_dev_size(struct dm_pool_metadata *pmd, dm_block_t *result); |
| 197 | 197 | |
| 198 | −int dm_pool_block_is_used(struct dm_pool_metadata *pmd, dm_block_t b, bool *result); | |
| 198 | +int dm_pool_block_is_shared(struct dm_pool_metadata *pmd, dm_block_t b, bool *result); | |
| 199 | 199 | |
| 200 | 200 | int dm_pool_inc_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); |
| 201 | 201 | int dm_pool_dec_data_range(struct dm_pool_metadata *pmd, dm_block_t b, dm_block_t e); |
| @@ -1048,7 +1048,7 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m · 1047 unmodified lines | ||
| 1048 | 1048 | * passdown we have to check that these blocks are now unused. |
| 1049 | 1049 | */ |
| 1050 | 1050 | int r = 0; |
| 1051 | − bool used = true; | |
| 1051 | + bool shared = true; | |
| 1052 | 1052 | struct thin_c *tc = m->tc; |
| 1053 | 1053 | struct pool *pool = tc->pool; |
| 1054 | 1054 | dm_block_t b = m->data_block, e, end = m->data_block + m->virt_end - m->virt_begin; |
| @@ -1058,11 +1058,11 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m · 3 unmodified lines | ||
| 1058 | 1058 | while (b != end) { |
| 1059 | 1059 | /* find start of unmapped run */ |
| 1060 | 1060 | for (; b < end; b++) { |
| 1061 | − r = dm_pool_block_is_used(pool->pmd, b, &used); | |
| 1061 | + r = dm_pool_block_is_shared(pool->pmd, b, &shared); | |
| 1062 | 1062 | if (r) |
| 1063 | 1063 | goto out; |
| 1064 | 1064 | |
| 1065 | − if (!used) | |
| 1065 | + if (!shared) | |
| 1066 | 1066 | break; |
| 1067 | 1067 | } |
| 1068 | 1068 | |
| @@ -1071,11 +1071,11 @@ static void passdown_double_checking_shared_status(struct dm_thin_new_mapping *m · 2 unmodified lines | ||
| 1071 | 1071 | |
| 1072 | 1072 | /* find end of run */ |
| 1073 | 1073 | for (e = b + 1; e != end; e++) { |
| 1074 | − r = dm_pool_block_is_used(pool->pmd, e, &used); | |
| 1074 | + r = dm_pool_block_is_shared(pool->pmd, e, &shared); | |
| 1075 | 1075 | if (r) |
| 1076 | 1076 | goto out; |
| 1077 | 1077 | |
| 1078 | − if (used) | |
| 1078 | + if (shared) | |
| 1079 | 1079 | break; |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| @@ -699,7 +699,7 @@ static void end_io_acct(struct dm_io *io) · 698 unmodified lines | ||
| 699 | 699 | true, duration, &io->stats_aux); |
| 700 | 700 | |
| 701 | 701 | /* nudge anyone waiting on suspend queue */ |
| 702 | − if (unlikely(waitqueue_active(&md->wait))) | |
| 702 | + if (unlikely(wq_has_sleeper(&md->wait))) | |
| 703 | 703 | wake_up(&md->wait); |
| 704 | 704 | } |
| 705 | 705 | |
| @@ -1320,7 +1320,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, · 614 unmodified lines | ||
| 1320 | 1320 | |
| 1321 | 1321 | __bio_clone_fast(clone, bio); |
| 1322 | 1322 | |
| 1323 | − if (unlikely(bio_integrity(bio) != NULL)) { | |
| 1323 | + if (bio_integrity(bio)) { | |
| 1324 | 1324 | int r; |
| 1325 | 1325 | |
| 1326 | 1326 | if (unlikely(!dm_target_has_integrity(tio->ti->type) && |
| @@ -1339,7 +1339,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, · 12 unmodified lines | ||
| 1339 | 1339 | bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); |
| 1340 | 1340 | clone->bi_iter.bi_size = to_bytes(len); |
| 1341 | 1341 | |
| 1342 | − if (unlikely(bio_integrity(bio) != NULL)) | |
| 1342 | + if (bio_integrity(bio)) | |
| 1343 | 1343 | bio_integrity_trim(clone); |
| 1344 | 1344 | |
| 1345 | 1345 | return 0; |
| @@ -1588,6 +1588,9 @@ static void init_clone_info(struct clone_info *ci, struct mapped_device *md, · 242 unmodified lines | ||
| 1588 | 1588 | ci->sector = bio->bi_iter.bi_sector; |
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | +#define __dm_part_stat_sub(part, field, subnd) \ | |
| 1592 | + (part_stat_get(part, field) -= (subnd)) | |
| 1593 | + | |
| 1591 | 1594 | /* |
| 1592 | 1595 | * Entry point to split a bio into clones and submit them to the targets. |
| 1593 | 1596 | */ |
| @@ -1642,7 +1645,21 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, · 48 unmodified lines | ||
| 1642 | 1645 | struct bio *b = bio_split(bio, bio_sectors(bio) - ci.sector_count, |
| 1643 | 1646 | GFP_NOIO, &md->queue->bio_split); |
| 1644 | 1647 | ci.io->orig_bio = b; |
| 1648 | + | |
| 1649 | + /* | |
| 1650 | + * Adjust IO stats for each split, otherwise upon queue | |
| 1651 | + * reentry there will be redundant IO accounting. | |
| 1652 | + * NOTE: this is a stop-gap fix, a proper fix involves | |
| 1653 | + * significant refactoring of DM core's bio splitting | |
| 1654 | + * (by eliminating DM's splitting and just using bio_split) | |
| 1655 | + */ | |
| 1656 | + part_stat_lock(); | |
| 1657 | + __dm_part_stat_sub(&dm_disk(md)->part0, | |
| 1658 | + sectors[op_stat_group(bio_op(bio))], ci.sector_count); | |
| 1659 | + part_stat_unlock(); | |
| 1660 | + | |
| 1645 | 1661 | bio_chain(b, bio); |
| 1662 | + trace_block_split(md->queue, b, bio->bi_iter.bi_sector); | |
| 1646 | 1663 | ret = generic_make_request(bio); |
| 1647 | 1664 | break; |
| 1648 | 1665 | } |
| @@ -1713,6 +1730,15 @@ out: · 64 unmodified lines | ||
| 1713 | 1730 | return ret; |
| 1714 | 1731 | } |
| 1715 | 1732 | |
| 1733 | +static blk_qc_t dm_process_bio(struct mapped_device *md, | |
| 1734 | + struct dm_table *map, struct bio *bio) | |
| 1735 | +{ | |
| 1736 | + if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) | |
| 1737 | + return __process_bio(md, map, bio); | |
| 1738 | + else | |
| 1739 | + return __split_and_process_bio(md, map, bio); | |
| 1740 | +} | |
| 1741 | + | |
| 1716 | 1742 | static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) |
| 1717 | 1743 | { |
| 1718 | 1744 | struct mapped_device *md = q->queuedata; |
| @@ -1733,10 +1759,7 @@ static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) · 14 unmodified lines | ||
| 1733 | 1759 | return ret; |
| 1734 | 1760 | } |
| 1735 | 1761 | |
| 1736 | − if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED) | |
| 1737 | − ret = __process_bio(md, map, bio); | |
| 1738 | − else | |
| 1739 | − ret = __split_and_process_bio(md, map, bio); | |
| 1762 | + ret = dm_process_bio(md, map, bio); | |
| 1740 | 1763 | |
| 1741 | 1764 | dm_put_live_table(md, srcu_idx); |
| 1742 | 1765 | return ret; |
| @@ -2415,9 +2438,9 @@ static void dm_wq_work(struct work_struct *work) · 672 unmodified lines | ||
| 2415 | 2438 | break; |
| 2416 | 2439 | |
| 2417 | 2440 | if (dm_request_based(md)) |
| 2418 | − generic_make_request(c); | |
| 2441 | + (void) generic_make_request(c); | |
| 2419 | 2442 | else |
| 2420 | − __split_and_process_bio(md, map, c); | |
| 2443 | + (void) dm_process_bio(md, map, c); | |
| 2421 | 2444 | } |
| 2422 | 2445 | |
| 2423 | 2446 | dm_put_live_table(md, srcu_idx); |
| @@ -207,15 +207,10 @@ static bool create_on_open = true; · 206 unmodified lines | ||
| 207 | 207 | struct bio *bio_alloc_mddev(gfp_t gfp_mask, int nr_iovecs, |
| 208 | 208 | struct mddev *mddev) |
| 209 | 209 | { |
| 210 | − struct bio *b; | |
| 211 | − | |
| 212 | 210 | if (!mddev || !bioset_initialized(&mddev->bio_set)) |
| 213 | 211 | return bio_alloc(gfp_mask, nr_iovecs); |
| 214 | 212 | |
| 215 | − b = bio_alloc_bioset(gfp_mask, nr_iovecs, &mddev->bio_set); | |
| 216 | − if (!b) | |
| 217 | − return NULL; | |
| 218 | − return b; | |
| 213 | + return bio_alloc_bioset(gfp_mask, nr_iovecs, &mddev->bio_set); | |
| 219 | 214 | } |
| 220 | 215 | EXPORT_SYMBOL_GPL(bio_alloc_mddev); |
| 221 | 216 | |
| @@ -1935,12 +1935,14 @@ out: · 1934 unmodified lines | ||
| 1935 | 1935 | } |
| 1936 | 1936 | |
| 1937 | 1937 | static struct stripe_head * |
| 1938 | −r5c_recovery_alloc_stripe(struct r5conf *conf, | |
| 1939 | − sector_t stripe_sect) | |
| 1938 | +r5c_recovery_alloc_stripe( | |
| 1939 | + struct r5conf *conf, | |
| 1940 | + sector_t stripe_sect, | |
| 1941 | + int noblock) | |
| 1940 | 1942 | { |
| 1941 | 1943 | struct stripe_head *sh; |
| 1942 | 1944 | |
| 1943 | − sh = raid5_get_active_stripe(conf, stripe_sect, 0, 1, 0); | |
| 1945 | + sh = raid5_get_active_stripe(conf, stripe_sect, 0, noblock, 0); | |
| 1944 | 1946 | if (!sh) |
| 1945 | 1947 | return NULL; /* no more stripe available */ |
| 1946 | 1948 | |
| @@ -2150,7 +2152,7 @@ r5c_recovery_analyze_meta_block(struct r5l_log *log, · 203 unmodified lines | ||
| 2150 | 2152 | stripe_sect); |
| 2151 | 2153 | |
| 2152 | 2154 | if (!sh) { |
| 2153 | − sh = r5c_recovery_alloc_stripe(conf, stripe_sect); | |
| 2155 | + sh = r5c_recovery_alloc_stripe(conf, stripe_sect, 1); | |
| 2154 | 2156 | /* |
| 2155 | 2157 | * cannot get stripe from raid5_get_active_stripe |
| 2156 | 2158 | * try replay some stripes |
| @@ -2159,20 +2161,29 @@ r5c_recovery_analyze_meta_block(struct r5l_log *log, · 2 unmodified lines | ||
| 2159 | 2161 | r5c_recovery_replay_stripes( |
| 2160 | 2162 | cached_stripe_list, ctx); |
| 2161 | 2163 | sh = r5c_recovery_alloc_stripe( |
| 2162 | − conf, stripe_sect); | |
| 2164 | + conf, stripe_sect, 1); | |
| 2163 | 2165 | } |
| 2164 | 2166 | if (!sh) { |
| 2167 | + int new_size = conf->min_nr_stripes * 2; | |
| 2165 | 2168 | pr_debug("md/raid:%s: Increasing stripe cache size to %d to recovery data on journal.\n", |
| 2166 | 2169 | mdname(mddev), |
| 2167 | − conf->min_nr_stripes * 2); | |
| 2168 | − raid5_set_cache_size(mddev, | |
| 2169 | − conf->min_nr_stripes * 2); | |
| 2170 | − sh = r5c_recovery_alloc_stripe(conf, | |
| 2171 | − stripe_sect); | |
| 2170 | + new_size); | |
| 2171 | + ret = raid5_set_cache_size(mddev, new_size); | |
| 2172 | + if (conf->min_nr_stripes <= new_size / 2) { | |
| 2173 | + pr_err("md/raid:%s: Cannot increase cache size, ret=%d, new_size=%d, min_nr_stripes=%d, max_nr_stripes=%d\n", | |
| 2174 | + mdname(mddev), | |
| 2175 | + ret, | |
| 2176 | + new_size, | |
| 2177 | + conf->min_nr_stripes, | |
| 2178 | + conf->max_nr_stripes); | |
| 2179 | + return -ENOMEM; | |
| 2180 | + } | |
| 2181 | + sh = r5c_recovery_alloc_stripe( | |
| 2182 | + conf, stripe_sect, 0); | |
| 2172 | 2183 | } |
| 2173 | 2184 | if (!sh) { |
| 2174 | 2185 | pr_err("md/raid:%s: Cannot get enough stripes due to memory pressure. Recovery failed.\n", |
| 2175 | − mdname(mddev)); | |
| 2186 | + mdname(mddev)); | |
| 2176 | 2187 | return -ENOMEM; |
| 2177 | 2188 | } |
| 2178 | 2189 | list_add_tail(&sh->lru, cached_stripe_list); |
| @@ -6369,6 +6369,7 @@ raid5_show_stripe_cache_size(struct mddev *mddev, char *page) · 6368 unmodified lines | ||
| 6369 | 6369 | int |
| 6370 | 6370 | raid5_set_cache_size(struct mddev *mddev, int size) |
| 6371 | 6371 | { |
| 6372 | + int result = 0; | |
| 6372 | 6373 | struct r5conf *conf = mddev->private; |
| 6373 | 6374 | |
| 6374 | 6375 | if (size <= 16 || size > 32768) |
| @@ -6385,11 +6386,14 @@ raid5_set_cache_size(struct mddev *mddev, int size) · 10 unmodified lines | ||
| 6385 | 6386 | |
| 6386 | 6387 | mutex_lock(&conf->cache_size_mutex); |
| 6387 | 6388 | while (size > conf->max_nr_stripes) |
| 6388 | − if (!grow_one_stripe(conf, GFP_KERNEL)) | |
| 6389 | + if (!grow_one_stripe(conf, GFP_KERNEL)) { | |
| 6390 | + conf->min_nr_stripes = conf->max_nr_stripes; | |
| 6391 | + result = -ENOMEM; | |
| 6389 | 6392 | break; |
| 6393 | + } | |
| 6390 | 6394 | mutex_unlock(&conf->cache_size_mutex); |
| 6391 | 6395 | |
| 6392 | − return 0; | |
| 6396 | + return result; | |
| 6393 | 6397 | } |
| 6394 | 6398 | EXPORT_SYMBOL(raid5_set_cache_size); |
| 6395 | 6399 | |
| @@ -807,7 +807,9 @@ static void vim2m_stop_streaming(struct vb2_queue *q) · 806 unmodified lines | ||
| 807 | 807 | struct vb2_v4l2_buffer *vbuf; |
| 808 | 808 | unsigned long flags; |
| 809 | 809 | |
| 810 | − cancel_delayed_work_sync(&dev->work_run); | |
| 810 | + if (v4l2_m2m_get_curr_priv(dev->m2m_dev) == ctx) | |
| 811 | + cancel_delayed_work_sync(&dev->work_run); | |
| 812 | + | |
| 811 | 813 | for (;;) { |
| 812 | 814 | if (V4L2_TYPE_IS_OUTPUT(q->type)) |
| 813 | 815 | vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); |
| @@ -287,6 +287,7 @@ static void v4l_print_format(const void *arg, bool write_only) · 286 unmodified lines | ||
| 287 | 287 | const struct v4l2_window *win; |
| 288 | 288 | const struct v4l2_sdr_format *sdr; |
| 289 | 289 | const struct v4l2_meta_format *meta; |
| 290 | + u32 planes; | |
| 290 | 291 | unsigned i; |
| 291 | 292 | |
| 292 | 293 | pr_cont("type=%s", prt_names(p->type, v4l2_type_names)); |
| @@ -317,7 +318,8 @@ static void v4l_print_format(const void *arg, bool write_only) · 24 unmodified lines | ||
| 317 | 318 | prt_names(mp->field, v4l2_field_names), |
| 318 | 319 | mp->colorspace, mp->num_planes, mp->flags, |
| 319 | 320 | mp->ycbcr_enc, mp->quantization, mp->xfer_func); |
| 320 | − for (i = 0; i < mp->num_planes; i++) | |
| 321 | + planes = min_t(u32, mp->num_planes, VIDEO_MAX_PLANES); | |
| 322 | + for (i = 0; i < planes; i++) | |
| 321 | 323 | printk(KERN_DEBUG "plane %u: bytesperline=%u sizeimage=%u\n", i, |
| 322 | 324 | mp->plane_fmt[i].bytesperline, |
| 323 | 325 | mp->plane_fmt[i].sizeimage); |
| @@ -1551,8 +1553,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, · 1227 unmodified lines | ||
| 1551 | 1553 | if (unlikely(!ops->vidioc_s_fmt_vid_cap_mplane)) |
| 1552 | 1554 | break; |
| 1553 | 1555 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); |
| 1556 | + if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES) | |
| 1557 | + break; | |
| 1554 | 1558 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) |
| 1555 | − CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); | |
| 1559 | + CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], | |
| 1560 | + bytesperline); | |
| 1556 | 1561 | return ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg); |
| 1557 | 1562 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
| 1558 | 1563 | if (unlikely(!ops->vidioc_s_fmt_vid_overlay)) |
| @@ -1581,8 +1586,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, · 22 unmodified lines | ||
| 1581 | 1586 | if (unlikely(!ops->vidioc_s_fmt_vid_out_mplane)) |
| 1582 | 1587 | break; |
| 1583 | 1588 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); |
| 1589 | + if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES) | |
| 1590 | + break; | |
| 1584 | 1591 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) |
| 1585 | − CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); | |
| 1592 | + CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], | |
| 1593 | + bytesperline); | |
| 1586 | 1594 | return ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg); |
| 1587 | 1595 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: |
| 1588 | 1596 | if (unlikely(!ops->vidioc_s_fmt_vid_out_overlay)) |
| @@ -1648,8 +1656,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, · 59 unmodified lines | ||
| 1648 | 1656 | if (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane)) |
| 1649 | 1657 | break; |
| 1650 | 1658 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); |
| 1659 | + if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES) | |
| 1660 | + break; | |
| 1651 | 1661 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) |
| 1652 | − CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); | |
| 1662 | + CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], | |
| 1663 | + bytesperline); | |
| 1653 | 1664 | return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg); |
| 1654 | 1665 | case V4L2_BUF_TYPE_VIDEO_OVERLAY: |
| 1655 | 1666 | if (unlikely(!ops->vidioc_try_fmt_vid_overlay)) |
| @@ -1678,8 +1689,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, · 22 unmodified lines | ||
| 1678 | 1689 | if (unlikely(!ops->vidioc_try_fmt_vid_out_mplane)) |
| 1679 | 1690 | break; |
| 1680 | 1691 | CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func); |
| 1692 | + if (p->fmt.pix_mp.num_planes > VIDEO_MAX_PLANES) | |
| 1693 | + break; | |
| 1681 | 1694 | for (i = 0; i < p->fmt.pix_mp.num_planes; i++) |
| 1682 | − CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline); | |
| 1695 | + CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i], | |
| 1696 | + bytesperline); | |
| 1683 | 1697 | return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg); |
| 1684 | 1698 | case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: |
| 1685 | 1699 | if (unlikely(!ops->vidioc_try_fmt_vid_out_overlay)) |
| @@ -102,6 +102,7 @@ config MFD_AAT2870_CORE · 101 unmodified lines | ||
| 102 | 102 | config MFD_AT91_USART |
| 103 | 103 | tristate "AT91 USART Driver" |
| 104 | 104 | select MFD_CORE |
| 105 | + depends on ARCH_AT91 || COMPILE_TEST | |
| 105 | 106 | help |
| 106 | 107 | Select this to get support for AT91 USART IP. This is a wrapper |
| 107 | 108 | over at91-usart-serial driver and usart-spi-driver. Only one function |
| @@ -1418,7 +1419,7 @@ config MFD_TPS65217 · 1310 unmodified lines | ||
| 1418 | 1419 | |
| 1419 | 1420 | config MFD_TPS68470 |
| 1420 | 1421 | bool "TI TPS68470 Power Management / LED chips" |
| 1421 | − depends on ACPI && I2C=y | |
| 1422 | + depends on ACPI && PCI && I2C=y | |
| 1422 | 1423 | select MFD_CORE |
| 1423 | 1424 | select REGMAP_I2C |
| 1424 | 1425 | select I2C_DESIGNWARE_PLATFORM |
| @@ -261,7 +261,7 @@ static int get_register_interruptible(struct ab8500 *ab8500, u8 bank, · 260 unmodified lines | ||
| 261 | 261 | mutex_unlock(&ab8500->lock); |
| 262 | 262 | dev_vdbg(ab8500->dev, "rd: addr %#x => data %#x\n", addr, ret); |
| 263 | 263 | |
| 264 | − return ret; | |
| 264 | + return (ret < 0) ? ret : 0; | |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | static int ab8500_get_register(struct device *dev, u8 bank, |
| @@ -641,9 +641,9 @@ static const struct mfd_cell axp221_cells[] = { · 640 unmodified lines | ||
| 641 | 641 | |
| 642 | 642 | static const struct mfd_cell axp223_cells[] = { |
| 643 | 643 | { |
| 644 | − .name = "axp221-pek", | |
| 645 | − .num_resources = ARRAY_SIZE(axp22x_pek_resources), | |
| 646 | − .resources = axp22x_pek_resources, | |
| 644 | + .name = "axp221-pek", | |
| 645 | + .num_resources = ARRAY_SIZE(axp22x_pek_resources), | |
| 646 | + .resources = axp22x_pek_resources, | |
| 647 | 647 | }, { |
| 648 | 648 | .name = "axp22x-adc", |
| 649 | 649 | .of_compatible = "x-powers,axp221-adc", |
| @@ -651,7 +651,7 @@ static const struct mfd_cell axp223_cells[] = { · 1 unmodified line | ||
| 651 | 651 | .name = "axp20x-battery-power-supply", |
| 652 | 652 | .of_compatible = "x-powers,axp221-battery-power-supply", |
| 653 | 653 | }, { |
| 654 | − .name = "axp20x-regulator", | |
| 654 | + .name = "axp20x-regulator", | |
| 655 | 655 | }, { |
| 656 | 656 | .name = "axp20x-ac-power-supply", |
| 657 | 657 | .of_compatible = "x-powers,axp221-ac-power-supply", |
| @@ -667,9 +667,9 @@ static const struct mfd_cell axp223_cells[] = { · 9 unmodified lines | ||
| 667 | 667 | |
| 668 | 668 | static const struct mfd_cell axp152_cells[] = { |
| 669 | 669 | { |
| 670 | − .name = "axp20x-pek", | |
| 671 | − .num_resources = ARRAY_SIZE(axp152_pek_resources), | |
| 672 | − .resources = axp152_pek_resources, | |
| 670 | + .name = "axp20x-pek", | |
| 671 | + .num_resources = ARRAY_SIZE(axp152_pek_resources), | |
| 672 | + .resources = axp152_pek_resources, | |
| 673 | 673 | }, |
| 674 | 674 | }; |
| 675 | 675 | |
| @@ -698,87 +698,101 @@ static const struct resource axp288_charger_resources[] = { · 22 unmodified lines | ||
| 698 | 698 | |
| 699 | 699 | static const struct mfd_cell axp288_cells[] = { |
| 700 | 700 | { |
| 701 | − .name = "axp288_adc", | |
| 702 | − .num_resources = ARRAY_SIZE(axp288_adc_resources), | |
| 703 | − .resources = axp288_adc_resources, | |
| 704 | − }, | |
| 705 | − { | |
| 706 | − .name = "axp288_extcon", | |
| 707 | − .num_resources = ARRAY_SIZE(axp288_extcon_resources), | |
| 708 | − .resources = axp288_extcon_resources, | |
| 709 | − }, | |
| 710 | − { | |
| 711 | − .name = "axp288_charger", | |
| 712 | − .num_resources = ARRAY_SIZE(axp288_charger_resources), | |
| 713 | − .resources = axp288_charger_resources, | |
| 714 | − }, | |
| 715 | − { | |
| 716 | − .name = "axp288_fuel_gauge", | |
| 717 | − .num_resources = ARRAY_SIZE(axp288_fuel_gauge_resources), | |
| 718 | − .resources = axp288_fuel_gauge_resources, | |
| 719 | − }, | |
| 720 | − { | |
| 721 | − .name = "axp221-pek", | |
| 722 | − .num_resources = ARRAY_SIZE(axp288_power_button_resources), | |
| 723 | − .resources = axp288_power_button_resources, | |
| 724 | − }, | |
| 725 | − { | |
| 726 | − .name = "axp288_pmic_acpi", | |
| 701 | + .name = "axp288_adc", | |
| 702 | + .num_resources = ARRAY_SIZE(axp288_adc_resources), | |
| 703 | + .resources = axp288_adc_resources, | |
| 704 | + }, { | |
| 705 | + .name = "axp288_extcon", | |
| 706 | + .num_resources = ARRAY_SIZE(axp288_extcon_resources), | |
| 707 | + .resources = axp288_extcon_resources, | |
| 708 | + }, { | |
| 709 | + .name = "axp288_charger", | |
| 710 | + .num_resources = ARRAY_SIZE(axp288_charger_resources), | |
| 711 | + .resources = axp288_charger_resources, | |
| 712 | + }, { | |
| 713 | + .name = "axp288_fuel_gauge", | |
| 714 | + .num_resources = ARRAY_SIZE(axp288_fuel_gauge_resources), | |
| 715 | + .resources = axp288_fuel_gauge_resources, | |
| 716 | + }, { | |
| 717 | + .name = "axp221-pek", | |
| 718 | + .num_resources = ARRAY_SIZE(axp288_power_button_resources), | |
| 719 | + .resources = axp288_power_button_resources, | |
| 720 | + }, { | |
| 721 | + .name = "axp288_pmic_acpi", | |
| 727 | 722 | }, |
| 728 | 723 | }; |
| 729 | 724 | |
| 730 | 725 | static const struct mfd_cell axp803_cells[] = { |
| 731 | 726 | { |
| 732 | − .name = "axp221-pek", | |
| 733 | − .num_resources = ARRAY_SIZE(axp803_pek_resources), | |
| 734 | − .resources = axp803_pek_resources, | |
| 727 | + .name = "axp221-pek", | |
| 728 | + .num_resources = ARRAY_SIZE(axp803_pek_resources), | |
| 729 | + .resources = axp803_pek_resources, | |
| 730 | + }, { | |
| 731 | + .name = "axp20x-gpio", | |
| 732 | + .of_compatible = "x-powers,axp813-gpio", | |
| 733 | + }, { | |
| 734 | + .name = "axp813-adc", | |
| 735 | + .of_compatible = "x-powers,axp813-adc", | |
| 736 | + }, { | |
| 737 | + .name = "axp20x-battery-power-supply", | |
| 738 | + .of_compatible = "x-powers,axp813-battery-power-supply", | |
| 739 | + }, { | |
| 740 | + .name = "axp20x-ac-power-supply", | |
| 741 | + .of_compatible = "x-powers,axp813-ac-power-supply", | |
| 742 | + .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), | |
| 743 | + .resources = axp20x_ac_power_supply_resources, | |
| 735 | 744 | }, |
| 736 | − { .name = "axp20x-regulator" }, | |
| 745 | + { .name = "axp20x-regulator" }, | |
| 737 | 746 | }; |
| 738 | 747 | |
| 739 | 748 | static const struct mfd_cell axp806_self_working_cells[] = { |
| 740 | 749 | { |
| 741 | − .name = "axp221-pek", | |
| 742 | − .num_resources = ARRAY_SIZE(axp806_pek_resources), | |
| 743 | − .resources = axp806_pek_resources, | |
| 750 | + .name = "axp221-pek", | |
| 751 | + .num_resources = ARRAY_SIZE(axp806_pek_resources), | |
| 752 | + .resources = axp806_pek_resources, | |
| 744 | 753 | }, |
| 745 | − { .name = "axp20x-regulator" }, | |
| 754 | + { .name = "axp20x-regulator" }, | |
| 746 | 755 | }; |
| 747 | 756 | |
| 748 | 757 | static const struct mfd_cell axp806_cells[] = { |
| 749 | 758 | { |
| 750 | − .id = 2, | |
| 751 | − .name = "axp20x-regulator", | |
| 759 | + .id = 2, | |
| 760 | + .name = "axp20x-regulator", | |
| 752 | 761 | }, |
| 753 | 762 | }; |
| 754 | 763 | |
| 755 | 764 | static const struct mfd_cell axp809_cells[] = { |
| 756 | 765 | { |
| 757 | − .name = "axp221-pek", | |
| 758 | − .num_resources = ARRAY_SIZE(axp809_pek_resources), | |
| 759 | − .resources = axp809_pek_resources, | |
| 766 | + .name = "axp221-pek", | |
| 767 | + .num_resources = ARRAY_SIZE(axp809_pek_resources), | |
| 768 | + .resources = axp809_pek_resources, | |
| 760 | 769 | }, { |
| 761 | − .id = 1, | |
| 762 | − .name = "axp20x-regulator", | |
| 770 | + .id = 1, | |
| 771 | + .name = "axp20x-regulator", | |
| 763 | 772 | }, |
| 764 | 773 | }; |
| 765 | 774 | |
| 766 | 775 | static const struct mfd_cell axp813_cells[] = { |
| 767 | 776 | { |
| 768 | − .name = "axp221-pek", | |
| 769 | − .num_resources = ARRAY_SIZE(axp803_pek_resources), | |
| 770 | − .resources = axp803_pek_resources, | |
| 777 | + .name = "axp221-pek", | |
| 778 | + .num_resources = ARRAY_SIZE(axp803_pek_resources), | |
| 779 | + .resources = axp803_pek_resources, | |
| 771 | 780 | }, { |
| 772 | − .name = "axp20x-regulator", | |
| 781 | + .name = "axp20x-regulator", | |
| 773 | 782 | }, { |
| 774 | − .name = "axp20x-gpio", | |
| 775 | − .of_compatible = "x-powers,axp813-gpio", | |
| 783 | + .name = "axp20x-gpio", | |
| 784 | + .of_compatible = "x-powers,axp813-gpio", | |
| 776 | 785 | }, { |
| 777 | − .name = "axp813-adc", | |
| 778 | − .of_compatible = "x-powers,axp813-adc", | |
| 786 | + .name = "axp813-adc", | |
| 787 | + .of_compatible = "x-powers,axp813-adc", | |
| 779 | 788 | }, { |
| 780 | 789 | .name = "axp20x-battery-power-supply", |
| 781 | 790 | .of_compatible = "x-powers,axp813-battery-power-supply", |
| 791 | + }, { | |
| 792 | + .name = "axp20x-ac-power-supply", | |
| 793 | + .of_compatible = "x-powers,axp813-ac-power-supply", | |
| 794 | + .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), | |
| 795 | + .resources = axp20x_ac_power_supply_resources, | |
| 782 | 796 | }, |
| 783 | 797 | }; |
| 784 | 798 | |
| @@ -59,6 +59,7 @@ static const struct regmap_access_table bd9571mwv_writable_table = { · 58 unmodified lines | ||
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | 61 | static const struct regmap_range bd9571mwv_volatile_yes_ranges[] = { |
| 62 | + regmap_reg_range(BD9571MWV_DVFS_MONIVDAC, BD9571MWV_DVFS_MONIVDAC), | |
| 62 | 63 | regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN), |
| 63 | 64 | regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INT), |
| 64 | 65 | regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTREQ), |
| @@ -499,6 +499,7 @@ static int ec_device_remove(struct platform_device *pdev) · 498 unmodified lines | ||
| 499 | 499 | |
| 500 | 500 | cros_ec_debugfs_remove(ec); |
| 501 | 501 | |
| 502 | + mfd_remove_devices(ec->dev); | |
| 502 | 503 | cdev_del(&ec->cdev); |
| 503 | 504 | device_unregister(&ec->class_dev); |
| 504 | 505 | return 0; |
| @@ -2584,7 +2584,7 @@ static struct irq_chip prcmu_irq_chip = { · 2583 unmodified lines | ||
| 2584 | 2584 | .irq_unmask = prcmu_irq_unmask, |
| 2585 | 2585 | }; |
| 2586 | 2586 | |
| 2587 | −static __init char *fw_project_name(u32 project) | |
| 2587 | +static char *fw_project_name(u32 project) | |
| 2588 | 2588 | { |
| 2589 | 2589 | switch (project) { |
| 2590 | 2590 | case PRCMU_FW_PROJECT_U8500: |
| @@ -2732,7 +2732,7 @@ void __init db8500_prcmu_early_init(u32 phy_base, u32 size) · 141 unmodified lines | ||
| 2732 | 2732 | INIT_WORK(&mb0_transfer.mask_work, prcmu_mask_work); |
| 2733 | 2733 | } |
| 2734 | 2734 | |
| 2735 | −static void __init init_prcm_registers(void) | |
| 2735 | +static void init_prcm_registers(void) | |
| 2736 | 2736 | { |
| 2737 | 2737 | u32 val; |
| 2738 | 2738 | |
| @@ -82,11 +82,13 @@ static void exynos_lpass_enable(struct exynos_lpass *lpass) · 81 unmodified lines | ||
| 82 | 82 | LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S); |
| 83 | 83 | |
| 84 | 84 | regmap_write(lpass->top, SFR_LPASS_INTR_CPU_MASK, |
| 85 | − LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S); | |
| 85 | + LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S | | |
| 86 | + LPASS_INTR_UART); | |
| 86 | 87 | |
| 87 | 88 | exynos_lpass_core_sw_reset(lpass, LPASS_I2S_SW_RESET); |
| 88 | 89 | exynos_lpass_core_sw_reset(lpass, LPASS_DMA_SW_RESET); |
| 89 | 90 | exynos_lpass_core_sw_reset(lpass, LPASS_MEM_SW_RESET); |
| 91 | + exynos_lpass_core_sw_reset(lpass, LPASS_UART_SW_RESET); | |
| 90 | 92 | } |
| 91 | 93 | |
| 92 | 94 | static void exynos_lpass_disable(struct exynos_lpass *lpass) |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/gpio.h> |
| 16 | 16 | #include <linux/mfd/core.h> |
| 17 | 17 | #include <linux/module.h> |
| 18 | +#include <linux/mutex.h> | |
| 18 | 19 | #include <linux/notifier.h> |
| 19 | 20 | #include <linux/of.h> |
| 20 | 21 | #include <linux/of_gpio.h> |
| @@ -155,7 +156,7 @@ static int madera_wait_for_boot(struct madera *madera) · 134 unmodified lines | ||
| 155 | 156 | usleep_range(MADERA_BOOT_POLL_INTERVAL_USEC / 2, |
| 156 | 157 | MADERA_BOOT_POLL_INTERVAL_USEC); |
| 157 | 158 | regmap_read(madera->regmap, MADERA_IRQ1_RAW_STATUS_1, &val); |
| 158 | − }; | |
| 159 | + } | |
| 159 | 160 | |
| 160 | 161 | if (!(val & MADERA_BOOT_DONE_STS1)) { |
| 161 | 162 | dev_err(madera->dev, "Polling BOOT_DONE_STS timed out\n"); |
| @@ -357,6 +358,8 @@ int madera_dev_init(struct madera *madera) · 195 unmodified lines | ||
| 357 | 358 | |
| 358 | 359 | dev_set_drvdata(madera->dev, madera); |
| 359 | 360 | BLOCKING_INIT_NOTIFIER_HEAD(&madera->notifier); |
| 361 | + mutex_init(&madera->dapm_ptr_lock); | |
| 362 | + | |
| 360 | 363 | madera_set_micbias_info(madera); |
| 361 | 364 | |
| 362 | 365 | /* |
| @@ -280,7 +280,7 @@ static int max77620_config_fps(struct max77620_chip *chip, · 279 unmodified lines | ||
| 280 | 280 | |
| 281 | 281 | for (fps_id = 0; fps_id < MAX77620_FPS_COUNT; fps_id++) { |
| 282 | 282 | sprintf(fps_name, "fps%d", fps_id); |
| 283 | − if (!strcmp(fps_np->name, fps_name)) | |
| 283 | + if (of_node_name_eq(fps_np, fps_name)) | |
| 284 | 284 | break; |
| 285 | 285 | } |
| 286 | 286 | |
| @@ -274,7 +274,9 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, · 273 unmodified lines | ||
| 274 | 274 | |
| 275 | 275 | mc13xxx->adcflags |= MC13XXX_ADC_WORKING; |
| 276 | 276 | |
| 277 | − mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0); | |
| 277 | + ret = mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0); | |
| 278 | + if (ret) | |
| 279 | + goto out; | |
| 278 | 280 | |
| 279 | 281 | adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2 | |
| 280 | 282 | MC13XXX_ADC0_CHRGRAWDIV; |
| @@ -329,8 +329,7 @@ static int mt6397_probe(struct platform_device *pdev) · 328 unmodified lines | ||
| 329 | 329 | |
| 330 | 330 | default: |
| 331 | 331 | dev_err(&pdev->dev, "unsupported chip: %d\n", id); |
| 332 | − ret = -ENODEV; | |
| 333 | − break; | |
| 332 | + return -ENODEV; | |
| 334 | 333 | } |
| 335 | 334 | |
| 336 | 335 | if (ret) { |
| @@ -638,6 +638,10 @@ static int qcom_rpm_probe(struct platform_device *pdev) · 637 unmodified lines | ||
| 638 | 638 | return -EFAULT; |
| 639 | 639 | } |
| 640 | 640 | |
| 641 | + writel(fw_version[0], RPM_CTRL_REG(rpm, 0)); | |
| 642 | + writel(fw_version[1], RPM_CTRL_REG(rpm, 1)); | |
| 643 | + writel(fw_version[2], RPM_CTRL_REG(rpm, 2)); | |
| 644 | + | |
| 641 | 645 | dev_info(&pdev->dev, "RPM firmware %u.%u.%u\n", fw_version[0], |
| 642 | 646 | fw_version[1], |
| 643 | 647 | fw_version[2]); |
| @@ -109,7 +109,7 @@ struct rave_sp_reply { · 108 unmodified lines | ||
| 109 | 109 | /** |
| 110 | 110 | * struct rave_sp_checksum - Variant specific checksum implementation details |
| 111 | 111 | * |
| 112 | − * @length: Caculated checksum length | |
| 112 | + * @length: Calculated checksum length | |
| 113 | 113 | * @subroutine: Utilized checksum algorithm implementation |
| 114 | 114 | */ |
| 115 | 115 | struct rave_sp_checksum { |
| @@ -1302,17 +1302,17 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata, · 1301 unmodified lines | ||
| 1302 | 1302 | pdata->autosleep = (pdata->autosleep_timeout) ? true : false; |
| 1303 | 1303 | |
| 1304 | 1304 | for_each_child_of_node(np, child) { |
| 1305 | − if (!strcmp(child->name, "stmpe_gpio")) { | |
| 1305 | + if (of_node_name_eq(child, "stmpe_gpio")) { | |
| 1306 | 1306 | pdata->blocks |= STMPE_BLOCK_GPIO; |
| 1307 | − } else if (!strcmp(child->name, "stmpe_keypad")) { | |
| 1307 | + } else if (of_node_name_eq(child, "stmpe_keypad")) { | |
| 1308 | 1308 | pdata->blocks |= STMPE_BLOCK_KEYPAD; |
| 1309 | − } else if (!strcmp(child->name, "stmpe_touchscreen")) { | |
| 1309 | + } else if (of_node_name_eq(child, "stmpe_touchscreen")) { | |
| 1310 | 1310 | pdata->blocks |= STMPE_BLOCK_TOUCHSCREEN; |
| 1311 | − } else if (!strcmp(child->name, "stmpe_adc")) { | |
| 1311 | + } else if (of_node_name_eq(child, "stmpe_adc")) { | |
| 1312 | 1312 | pdata->blocks |= STMPE_BLOCK_ADC; |
| 1313 | − } else if (!strcmp(child->name, "stmpe_pwm")) { | |
| 1313 | + } else if (of_node_name_eq(child, "stmpe_pwm")) { | |
| 1314 | 1314 | pdata->blocks |= STMPE_BLOCK_PWM; |
| 1315 | − } else if (!strcmp(child->name, "stmpe_rotator")) { | |
| 1315 | + } else if (of_node_name_eq(child, "stmpe_rotator")) { | |
| 1316 | 1316 | pdata->blocks |= STMPE_BLOCK_ROTATOR; |
| 1317 | 1317 | } |
| 1318 | 1318 | } |
| @@ -264,8 +264,9 @@ static int ti_tscadc_probe(struct platform_device *pdev) · 263 unmodified lines | ||
| 264 | 264 | cell->pdata_size = sizeof(tscadc); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | − err = mfd_add_devices(&pdev->dev, pdev->id, tscadc->cells, | |
| 268 | − tscadc->used_cells, NULL, 0, NULL); | |
| 267 | + err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, | |
| 268 | + tscadc->cells, tscadc->used_cells, NULL, | |
| 269 | + 0, NULL); | |
| 269 | 270 | if (err < 0) |
| 270 | 271 | goto err_disable_clk; |
| 271 | 272 | |
| @@ -235,9 +235,9 @@ static int tps65218_probe(struct i2c_client *client, · 234 unmodified lines | ||
| 235 | 235 | |
| 236 | 236 | mutex_init(&tps->tps_lock); |
| 237 | 237 | |
| 238 | − ret = regmap_add_irq_chip(tps->regmap, tps->irq, | |
| 239 | − IRQF_ONESHOT, 0, &tps65218_irq_chip, | |
| 240 | − &tps->irq_data); | |
| 238 | + ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, tps->irq, | |
| 239 | + IRQF_ONESHOT, 0, &tps65218_irq_chip, | |
| 240 | + &tps->irq_data); | |
| 241 | 241 | if (ret < 0) |
| 242 | 242 | return ret; |
| 243 | 243 | |
| @@ -253,26 +253,9 @@ static int tps65218_probe(struct i2c_client *client, · 9 unmodified lines | ||
| 253 | 253 | ARRAY_SIZE(tps65218_cells), NULL, 0, |
| 254 | 254 | regmap_irq_get_domain(tps->irq_data)); |
| 255 | 255 | |
| 256 | − if (ret < 0) | |
| 257 | − goto err_irq; | |
| 258 | − | |
| 259 | − return 0; | |
| 260 | − | |
| 261 | −err_irq: | |
| 262 | − regmap_del_irq_chip(tps->irq, tps->irq_data); | |
| 263 | − | |
| 264 | 256 | return ret; |
| 265 | 257 | } |
| 266 | 258 | |
| 267 | −static int tps65218_remove(struct i2c_client *client) | |
| 268 | −{ | |
| 269 | − struct tps65218 *tps = i2c_get_clientdata(client); | |
| 270 | − | |
| 271 | − regmap_del_irq_chip(tps->irq, tps->irq_data); | |
| 272 | − | |
| 273 | − return 0; | |
| 274 | −} | |
| 275 | − | |
| 276 | 259 | static const struct i2c_device_id tps65218_id_table[] = { |
| 277 | 260 | { "tps65218", TPS65218 }, |
| 278 | 261 | { }, |
| @@ -285,7 +268,6 @@ static struct i2c_driver tps65218_driver = { · 6 unmodified lines | ||
| 285 | 268 | .of_match_table = of_tps65218_match_table, |
| 286 | 269 | }, |
| 287 | 270 | .probe = tps65218_probe, |
| 288 | − .remove = tps65218_remove, | |
| 289 | 271 | .id_table = tps65218_id_table, |
| 290 | 272 | }; |
| 291 | 273 | |
| @@ -592,6 +592,29 @@ static int tps6586x_i2c_remove(struct i2c_client *client) · 591 unmodified lines | ||
| 592 | 592 | return 0; |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | +static int __maybe_unused tps6586x_i2c_suspend(struct device *dev) | |
| 596 | +{ | |
| 597 | + struct tps6586x *tps6586x = dev_get_drvdata(dev); | |
| 598 | + | |
| 599 | + if (tps6586x->client->irq) | |
| 600 | + disable_irq(tps6586x->client->irq); | |
| 601 | + | |
| 602 | + return 0; | |
| 603 | +} | |
| 604 | + | |
| 605 | +static int __maybe_unused tps6586x_i2c_resume(struct device *dev) | |
| 606 | +{ | |
| 607 | + struct tps6586x *tps6586x = dev_get_drvdata(dev); | |
| 608 | + | |
| 609 | + if (tps6586x->client->irq) | |
| 610 | + enable_irq(tps6586x->client->irq); | |
| 611 | + | |
| 612 | + return 0; | |
| 613 | +} | |
| 614 | + | |
| 615 | +static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_i2c_suspend, | |
| 616 | + tps6586x_i2c_resume); | |
| 617 | + | |
| 595 | 618 | static const struct i2c_device_id tps6586x_id_table[] = { |
| 596 | 619 | { "tps6586x", 0 }, |
| 597 | 620 | { }, |
| @@ -602,6 +625,7 @@ static struct i2c_driver tps6586x_driver = { · 4 unmodified lines | ||
| 602 | 625 | .driver = { |
| 603 | 626 | .name = "tps6586x", |
| 604 | 627 | .of_match_table = of_match_ptr(tps6586x_of_match), |
| 628 | + .pm = &tps6586x_pm_ops, | |
| 605 | 629 | }, |
| 606 | 630 | .probe = tps6586x_i2c_probe, |
| 607 | 631 | .remove = tps6586x_i2c_remove, |
| @@ -979,7 +979,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, · 978 unmodified lines | ||
| 979 | 979 | * letting it generate the right frequencies for USB, MADC, and |
| 980 | 980 | * other purposes. |
| 981 | 981 | */ |
| 982 | −static inline int __init protect_pm_master(void) | |
| 982 | +static inline int protect_pm_master(void) | |
| 983 | 983 | { |
| 984 | 984 | int e = 0; |
| 985 | 985 | |
| @@ -988,7 +988,7 @@ static inline int __init protect_pm_master(void) · 2 unmodified lines | ||
| 988 | 988 | return e; |
| 989 | 989 | } |
| 990 | 990 | |
| 991 | −static inline int __init unprotect_pm_master(void) | |
| 991 | +static inline int unprotect_pm_master(void) | |
| 992 | 992 | { |
| 993 | 993 | int e = 0; |
| 994 | 994 | |
| @@ -1618,6 +1618,7 @@ static const struct reg_default wm5110_reg_default[] = { · 1617 unmodified lines | ||
| 1618 | 1618 | { 0x00000ECD, 0x0000 }, /* R3789 - HPLPF4_2 */ |
| 1619 | 1619 | { 0x00000EE0, 0x0000 }, /* R3808 - ASRC_ENABLE */ |
| 1620 | 1620 | { 0x00000EE2, 0x0000 }, /* R3810 - ASRC_RATE1 */ |
| 1621 | + { 0x00000EE3, 0x4000 }, /* R3811 - ASRC_RATE2 */ | |
| 1621 | 1622 | { 0x00000EF0, 0x0000 }, /* R3824 - ISRC 1 CTRL 1 */ |
| 1622 | 1623 | { 0x00000EF1, 0x0000 }, /* R3825 - ISRC 1 CTRL 2 */ |
| 1623 | 1624 | { 0x00000EF2, 0x0000 }, /* R3826 - ISRC 1 CTRL 3 */ |
| @@ -2869,6 +2870,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg) · 1245 unmodified lines | ||
| 2869 | 2870 | case ARIZONA_ASRC_ENABLE: |
| 2870 | 2871 | case ARIZONA_ASRC_STATUS: |
| 2871 | 2872 | case ARIZONA_ASRC_RATE1: |
| 2873 | + case ARIZONA_ASRC_RATE2: | |
| 2872 | 2874 | case ARIZONA_ISRC_1_CTRL_1: |
| 2873 | 2875 | case ARIZONA_ISRC_1_CTRL_2: |
| 2874 | 2876 | case ARIZONA_ISRC_1_CTRL_3: |
| @@ -820,21 +820,24 @@ static int ibmvmc_send_msg(struct crq_server_adapter *adapter, · 819 unmodified lines | ||
| 820 | 820 | * |
| 821 | 821 | * Return: |
| 822 | 822 | * 0 - Success |
| 823 | + * Non-zero - Failure | |
| 823 | 824 | */ |
| 824 | 825 | static int ibmvmc_open(struct inode *inode, struct file *file) |
| 825 | 826 | { |
| 826 | 827 | struct ibmvmc_file_session *session; |
| 827 | − int rc = 0; | |
| 828 | 828 | |
| 829 | 829 | pr_debug("%s: inode = 0x%lx, file = 0x%lx, state = 0x%x\n", __func__, |
| 830 | 830 | (unsigned long)inode, (unsigned long)file, |
| 831 | 831 | ibmvmc.state); |
| 832 | 832 | |
| 833 | 833 | session = kzalloc(sizeof(*session), GFP_KERNEL); |
| 834 | + if (!session) | |
| 835 | + return -ENOMEM; | |
| 836 | + | |
| 834 | 837 | session->file = file; |
| 835 | 838 | file->private_data = session; |
| 836 | 839 | |
| 837 | − return rc; | |
| 840 | + return 0; | |
| 838 | 841 | } |
| 839 | 842 | |
| 840 | 843 | /** |
| @@ -1187,9 +1187,15 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) · 1186 unmodified lines | ||
| 1187 | 1187 | dma_setup_res = (struct hbm_dma_setup_response *)mei_msg; |
| 1188 | 1188 | |
| 1189 | 1189 | if (dma_setup_res->status) { |
| 1190 | − dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", | |
| 1191 | − dma_setup_res->status, | |
| 1192 | − mei_hbm_status_str(dma_setup_res->status)); | |
| 1190 | + u8 status = dma_setup_res->status; | |
| 1191 | + | |
| 1192 | + if (status == MEI_HBMS_NOT_ALLOWED) { | |
| 1193 | + dev_dbg(dev->dev, "hbm: dma setup not allowed\n"); | |
| 1194 | + } else { | |
| 1195 | + dev_info(dev->dev, "hbm: dma setup response: failure = %d %s\n", | |
| 1196 | + status, | |
| 1197 | + mei_hbm_status_str(status)); | |
| 1198 | + } | |
| 1193 | 1199 | dev->hbm_f_dr_supported = 0; |
| 1194 | 1200 | mei_dmam_ring_free(dev); |
| 1195 | 1201 | } |
| @@ -127,6 +127,8 @@ · 126 unmodified lines | ||
| 127 | 127 | #define MEI_DEV_ID_BXT_M 0x1A9A /* Broxton M */ |
| 128 | 128 | #define MEI_DEV_ID_APL_I 0x5A9A /* Apollo Lake I */ |
| 129 | 129 | |
| 130 | +#define MEI_DEV_ID_DNV_IE 0x19E5 /* Denverton IE */ | |
| 131 | + | |
| 130 | 132 | #define MEI_DEV_ID_GLK 0x319A /* Gemini Lake */ |
| 131 | 133 | |
| 132 | 134 | #define MEI_DEV_ID_KBP 0xA2BA /* Kaby Point */ |
| @@ -88,11 +88,13 @@ static const struct pci_device_id mei_me_pci_tbl[] = { · 87 unmodified lines | ||
| 88 | 88 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, MEI_ME_PCH8_CFG)}, |
| 89 | 89 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, MEI_ME_PCH8_SPS_CFG)}, |
| 90 | 90 | {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, MEI_ME_PCH8_SPS_CFG)}, |
| 91 | − {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH8_CFG)}, | |
| 91 | + {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, MEI_ME_PCH12_CFG)}, | |
| 92 | 92 | |
| 93 | 93 | {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, MEI_ME_PCH8_CFG)}, |
| 94 | 94 | {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, MEI_ME_PCH8_CFG)}, |
| 95 | 95 | |
| 96 | + {MEI_PCI_DEVICE(MEI_DEV_ID_DNV_IE, MEI_ME_PCH8_CFG)}, | |
| 97 | + | |
| 96 | 98 | {MEI_PCI_DEVICE(MEI_DEV_ID_GLK, MEI_ME_PCH8_CFG)}, |
| 97 | 99 | |
| 98 | 100 | {MEI_PCI_DEVICE(MEI_DEV_ID_KBP, MEI_ME_PCH8_CFG)}, |
| @@ -394,16 +394,21 @@ static int vop_find_vqs(struct virtio_device *dev, unsigned nvqs, · 393 unmodified lines | ||
| 394 | 394 | struct _vop_vdev *vdev = to_vopvdev(dev); |
| 395 | 395 | struct vop_device *vpdev = vdev->vpdev; |
| 396 | 396 | struct mic_device_ctrl __iomem *dc = vdev->dc; |
| 397 | − int i, err, retry; | |
| 397 | + int i, err, retry, queue_idx = 0; | |
| 398 | 398 | |
| 399 | 399 | /* We must have this many virtqueues. */ |
| 400 | 400 | if (nvqs > ioread8(&vdev->desc->num_vq)) |
| 401 | 401 | return -ENOENT; |
| 402 | 402 | |
| 403 | 403 | for (i = 0; i < nvqs; ++i) { |
| 404 | + if (!names[i]) { | |
| 405 | + vqs[i] = NULL; | |
| 406 | + continue; | |
| 407 | + } | |
| 408 | + | |
| 404 | 409 | dev_dbg(_vop_dev(vdev), "%s: %d: %s\n", |
| 405 | 410 | __func__, i, names[i]); |
| 406 | − vqs[i] = vop_find_vq(dev, i, callbacks[i], names[i], | |
| 411 | + vqs[i] = vop_find_vq(dev, queue_idx++, callbacks[i], names[i], | |
| 407 | 412 | ctx ? ctx[i] : false); |
| 408 | 413 | if (IS_ERR(vqs[i])) { |
| 409 | 414 | err = PTR_ERR(vqs[i]); |
| @@ -70,8 +70,12 @@ pvpanic_walk_resources(struct acpi_resource *res, void *context) · 69 unmodified lines | ||
| 70 | 70 | struct resource r; |
| 71 | 71 | |
| 72 | 72 | if (acpi_dev_resource_io(res, &r)) { |
| 73 | +#ifdef CONFIG_HAS_IOPORT_MAP | |
| 73 | 74 | base = ioport_map(r.start, resource_size(&r)); |
| 74 | 75 | return AE_OK; |
| 76 | +#else | |
| 77 | + return AE_ERROR; | |
| 78 | +#endif | |
| 75 | 79 | } else if (acpi_dev_resource_memory(res, &r)) { |
| 76 | 80 | base = ioremap(r.start, resource_size(&r)); |
| 77 | 81 | return AE_OK; |
| @@ -234,7 +234,7 @@ int mmc_of_parse(struct mmc_host *host) · 233 unmodified lines | ||
| 234 | 234 | if (device_property_read_bool(dev, "broken-cd")) |
| 235 | 235 | host->caps |= MMC_CAP_NEEDS_POLL; |
| 236 | 236 | |
| 237 | − ret = mmc_gpiod_request_cd(host, "cd", 0, true, | |
| 237 | + ret = mmc_gpiod_request_cd(host, "cd", 0, false, | |
| 238 | 238 | cd_debounce_delay_ms * 1000, |
| 239 | 239 | &cd_gpio_invert); |
| 240 | 240 | if (!ret) |
| @@ -116,7 +116,7 @@ config MMC_RICOH_MMC · 115 unmodified lines | ||
| 116 | 116 | |
| 117 | 117 | config MMC_SDHCI_ACPI |
| 118 | 118 | tristate "SDHCI support for ACPI enumerated SDHCI controllers" |
| 119 | − depends on MMC_SDHCI && ACPI | |
| 119 | + depends on MMC_SDHCI && ACPI && PCI | |
| 120 | 120 | select IOSF_MBI if X86 |
| 121 | 121 | help |
| 122 | 122 | This selects support for ACPI enumerated SDHCI controllers, |
| @@ -978,7 +978,7 @@ config MMC_SDHCI_OMAP · 855 unmodified lines | ||
| 978 | 978 | tristate "TI SDHCI Controller Support" |
| 979 | 979 | depends on MMC_SDHCI_PLTFM && OF |
| 980 | 980 | select THERMAL |
| 981 | − select TI_SOC_THERMAL | |
| 981 | + imply TI_SOC_THERMAL | |
| 982 | 982 | help |
| 983 | 983 | This selects the Secure Digital Host Controller Interface (SDHCI) |
| 984 | 984 | support present in TI's DRA7 SOCs. The controller supports |
| @@ -1431,6 +1431,8 @@ static int bcm2835_probe(struct platform_device *pdev) · 1430 unmodified lines | ||
| 1431 | 1431 | |
| 1432 | 1432 | err: |
| 1433 | 1433 | dev_dbg(dev, "%s -> err %d\n", __func__, ret); |
| 1434 | + if (host->dma_chan_rxtx) | |
| 1435 | + dma_release_channel(host->dma_chan_rxtx); | |
| 1434 | 1436 | mmc_free_host(mmc); |
| 1435 | 1437 | |
| 1436 | 1438 | return ret; |
| @@ -1,11 +1,6 @@ | ||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | 2 | /* |
| 3 | 3 | * Copyright (C) 2018 Mellanox Technologies. |
| 4 | − * | |
| 5 | − * This program is free software; you can redistribute it and/or modify | |
| 6 | − * it under the terms of the GNU General Public License as published by | |
| 7 | − * the Free Software Foundation; either version 2 of the License, or | |
| 8 | − * (at your option) any later version. | |
| 9 | 4 | */ |
| 10 | 5 | |
| 11 | 6 | #include <linux/bitfield.h> |
| @@ -179,6 +179,8 @@ struct meson_host { · 178 unmodified lines | ||
| 179 | 179 | struct sd_emmc_desc *descs; |
| 180 | 180 | dma_addr_t descs_dma_addr; |
| 181 | 181 | |
| 182 | + int irq; | |
| 183 | + | |
| 182 | 184 | bool vqmmc_enabled; |
| 183 | 185 | }; |
| 184 | 186 | |
| @@ -738,6 +740,11 @@ static int meson_mmc_clk_phase_tuning(struct mmc_host *mmc, u32 opcode, · 553 unmodified lines | ||
| 738 | 740 | static int meson_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) |
| 739 | 741 | { |
| 740 | 742 | struct meson_host *host = mmc_priv(mmc); |
| 743 | + int adj = 0; | |
| 744 | + | |
| 745 | + /* enable signal resampling w/o delay */ | |
| 746 | + adj = ADJUST_ADJ_EN; | |
| 747 | + writel(adj, host->regs + host->data->adjust); | |
| 741 | 748 | |
| 742 | 749 | return meson_mmc_clk_phase_tuning(mmc, opcode, host->rx_clk); |
| 743 | 750 | } |
| @@ -768,6 +775,9 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · 24 unmodified lines | ||
| 768 | 775 | if (!IS_ERR(mmc->supply.vmmc)) |
| 769 | 776 | mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); |
| 770 | 777 | |
| 778 | + /* disable signal resampling */ | |
| 779 | + writel(0, host->regs + host->data->adjust); | |
| 780 | + | |
| 771 | 781 | /* Reset rx phase */ |
| 772 | 782 | clk_set_phase(host->rx_clk, 0); |
| 773 | 783 | |
| @@ -1166,7 +1176,7 @@ static int meson_mmc_get_cd(struct mmc_host *mmc) · 392 unmodified lines | ||
| 1166 | 1176 | |
| 1167 | 1177 | static void meson_mmc_cfg_init(struct meson_host *host) |
| 1168 | 1178 | { |
| 1169 | − u32 cfg = 0, adj = 0; | |
| 1179 | + u32 cfg = 0; | |
| 1170 | 1180 | |
| 1171 | 1181 | cfg |= FIELD_PREP(CFG_RESP_TIMEOUT_MASK, |
| 1172 | 1182 | ilog2(SD_EMMC_CFG_RESP_TIMEOUT)); |
| @@ -1177,10 +1187,6 @@ static void meson_mmc_cfg_init(struct meson_host *host) · 4 unmodified lines | ||
| 1177 | 1187 | cfg |= CFG_ERR_ABORT; |
| 1178 | 1188 | |
| 1179 | 1189 | writel(cfg, host->regs + SD_EMMC_CFG); |
| 1180 | − | |
| 1181 | − /* enable signal resampling w/o delay */ | |
| 1182 | − adj = ADJUST_ADJ_EN; | |
| 1183 | − writel(adj, host->regs + host->data->adjust); | |
| 1184 | 1190 | } |
| 1185 | 1191 | |
| 1186 | 1192 | static int meson_mmc_card_busy(struct mmc_host *mmc) |
| @@ -1231,7 +1237,7 @@ static int meson_mmc_probe(struct platform_device *pdev) · 44 unmodified lines | ||
| 1231 | 1237 | struct resource *res; |
| 1232 | 1238 | struct meson_host *host; |
| 1233 | 1239 | struct mmc_host *mmc; |
| 1234 | − int ret, irq; | |
| 1240 | + int ret; | |
| 1235 | 1241 | |
| 1236 | 1242 | mmc = mmc_alloc_host(sizeof(struct meson_host), &pdev->dev); |
| 1237 | 1243 | if (!mmc) |
| @@ -1276,8 +1282,8 @@ static int meson_mmc_probe(struct platform_device *pdev) · 38 unmodified lines | ||
| 1276 | 1282 | goto free_host; |
| 1277 | 1283 | } |
| 1278 | 1284 | |
| 1279 | − irq = platform_get_irq(pdev, 0); | |
| 1280 | − if (irq <= 0) { | |
| 1285 | + host->irq = platform_get_irq(pdev, 0); | |
| 1286 | + if (host->irq <= 0) { | |
| 1281 | 1287 | dev_err(&pdev->dev, "failed to get interrupt resource.\n"); |
| 1282 | 1288 | ret = -EINVAL; |
| 1283 | 1289 | goto free_host; |
| @@ -1331,9 +1337,8 @@ static int meson_mmc_probe(struct platform_device *pdev) · 47 unmodified lines | ||
| 1331 | 1337 | writel(IRQ_CRC_ERR | IRQ_TIMEOUTS | IRQ_END_OF_CHAIN, |
| 1332 | 1338 | host->regs + SD_EMMC_IRQ_EN); |
| 1333 | 1339 | |
| 1334 | − ret = devm_request_threaded_irq(&pdev->dev, irq, meson_mmc_irq, | |
| 1335 | − meson_mmc_irq_thread, IRQF_SHARED, | |
| 1336 | − NULL, host); | |
| 1340 | + ret = request_threaded_irq(host->irq, meson_mmc_irq, | |
| 1341 | + meson_mmc_irq_thread, IRQF_SHARED, NULL, host); | |
| 1337 | 1342 | if (ret) |
| 1338 | 1343 | goto err_init_clk; |
| 1339 | 1344 | |
| @@ -1351,7 +1356,7 @@ static int meson_mmc_probe(struct platform_device *pdev) · 11 unmodified lines | ||
| 1351 | 1356 | if (host->bounce_buf == NULL) { |
| 1352 | 1357 | dev_err(host->dev, "Unable to map allocate DMA bounce buffer.\n"); |
| 1353 | 1358 | ret = -ENOMEM; |
| 1354 | − goto err_init_clk; | |
| 1359 | + goto err_free_irq; | |
| 1355 | 1360 | } |
| 1356 | 1361 | |
| 1357 | 1362 | host->descs = dma_alloc_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, |
| @@ -1370,6 +1375,8 @@ static int meson_mmc_probe(struct platform_device *pdev) · 12 unmodified lines | ||
| 1370 | 1375 | err_bounce_buf: |
| 1371 | 1376 | dma_free_coherent(host->dev, host->bounce_buf_size, |
| 1372 | 1377 | host->bounce_buf, host->bounce_dma_addr); |
| 1378 | +err_free_irq: | |
| 1379 | + free_irq(host->irq, host); | |
| 1373 | 1380 | err_init_clk: |
| 1374 | 1381 | clk_disable_unprepare(host->mmc_clk); |
| 1375 | 1382 | err_core_clk: |
| @@ -1387,6 +1394,7 @@ static int meson_mmc_remove(struct platform_device *pdev) · 11 unmodified lines | ||
| 1387 | 1394 | |
| 1388 | 1395 | /* disable interrupts */ |
| 1389 | 1396 | writel(0, host->regs + SD_EMMC_IRQ_EN); |
| 1397 | + free_irq(host->irq, host); | |
| 1390 | 1398 | |
| 1391 | 1399 | dma_free_coherent(host->dev, SD_EMMC_DESC_BUF_LEN, |
| 1392 | 1400 | host->descs, host->descs_dma_addr); |
| @@ -846,7 +846,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz) · 845 unmodified lines | ||
| 846 | 846 | |
| 847 | 847 | if (timing == MMC_TIMING_MMC_HS400 && |
| 848 | 848 | host->dev_comp->hs400_tune) |
| 849 | − sdr_set_field(host->base + PAD_CMD_TUNE, | |
| 849 | + sdr_set_field(host->base + tune_reg, | |
| 850 | 850 | MSDC_PAD_TUNE_CMDRRDLY, |
| 851 | 851 | host->hs400_cmd_int_delay); |
| 852 | 852 | dev_dbg(host->dev, "sclk: %d, timing: %d\n", host->mmc->actual_clock, |
| @@ -296,7 +296,10 @@ static int sdhci_iproc_probe(struct platform_device *pdev) · 295 unmodified lines | ||
| 296 | 296 | |
| 297 | 297 | iproc_host->data = iproc_data; |
| 298 | 298 | |
| 299 | − mmc_of_parse(host->mmc); | |
| 299 | + ret = mmc_of_parse(host->mmc); | |
| 300 | + if (ret) | |
| 301 | + goto err; | |
| 302 | + | |
| 300 | 303 | sdhci_get_property(pdev); |
| 301 | 304 | |
| 302 | 305 | host->mmc->caps |= iproc_host->data->mmc_caps; |
| @@ -1322,7 +1322,7 @@ int denali_init(struct denali_nand_info *denali) · 1321 unmodified lines | ||
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | /* clk rate info is needed for setup_data_interface */ |
| 1325 | − if (denali->clk_rate && denali->clk_x_rate) | |
| 1325 | + if (!denali->clk_rate || !denali->clk_x_rate) | |
| 1326 | 1326 | chip->options |= NAND_KEEP_TIMINGS; |
| 1327 | 1327 | |
| 1328 | 1328 | chip->legacy.dummy_controller.ops = &denali_controller_ops; |
| @@ -593,23 +593,6 @@ static void fsmc_write_buf_dma(struct fsmc_nand_data *host, const u8 *buf, · 592 unmodified lines | ||
| 593 | 593 | dma_xfer(host, (void *)buf, len, DMA_TO_DEVICE); |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | −/* fsmc_select_chip - assert or deassert nCE */ | |
| 597 | −static void fsmc_ce_ctrl(struct fsmc_nand_data *host, bool assert) | |
| 598 | −{ | |
| 599 | − u32 pc = readl(host->regs_va + FSMC_PC); | |
| 600 | − | |
| 601 | − if (!assert) | |
| 602 | − writel_relaxed(pc & ~FSMC_ENABLE, host->regs_va + FSMC_PC); | |
| 603 | − else | |
| 604 | − writel_relaxed(pc | FSMC_ENABLE, host->regs_va + FSMC_PC); | |
| 605 | − | |
| 606 | − /* | |
| 607 | − * nCE line changes must be applied before returning from this | |
| 608 | − * function. | |
| 609 | − */ | |
| 610 | − mb(); | |
| 611 | −} | |
| 612 | − | |
| 613 | 596 | /* |
| 614 | 597 | * fsmc_exec_op - hook called by the core to execute NAND operations |
| 615 | 598 | * |
| @@ -627,8 +610,6 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op, · 11 unmodified lines | ||
| 627 | 610 | |
| 628 | 611 | pr_debug("Executing operation [%d instructions]:\n", op->ninstrs); |
| 629 | 612 | |
| 630 | − fsmc_ce_ctrl(host, true); | |
| 631 | − | |
| 632 | 613 | for (op_id = 0; op_id < op->ninstrs; op_id++) { |
| 633 | 614 | instr = &op->instrs[op_id]; |
| 634 | 615 | |
| @@ -686,8 +667,6 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op, · 51 unmodified lines | ||
| 686 | 667 | } |
| 687 | 668 | } |
| 688 | 669 | |
| 689 | − fsmc_ce_ctrl(host, false); | |
| 690 | − | |
| 691 | 670 | return ret; |
| 692 | 671 | } |
| 693 | 672 | |
| @@ -260,7 +260,7 @@ static int jz_nand_correct_ecc_rs(struct nand_chip *chip, uint8_t *dat, · 259 unmodified lines | ||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | static int jz_nand_ioremap_resource(struct platform_device *pdev, |
| 263 | − const char *name, struct resource **res, void *__iomem *base) | |
| 263 | + const char *name, struct resource **res, void __iomem **base) | |
| 264 | 264 | { |
| 265 | 265 | int ret; |
| 266 | 266 | |
| @@ -519,7 +519,7 @@ config NET_FAILOVER · 518 unmodified lines | ||
| 519 | 519 | and destroy a failover master netdev and manages a primary and |
| 520 | 520 | standby slave netdevs that get registered via the generic failover |
| 521 | 521 | infrastructure. This can be used by paravirtual drivers to enable |
| 522 | − an alternate low latency datapath. It alsoenables live migration of | |
| 522 | + an alternate low latency datapath. It also enables live migration of | |
| 523 | 523 | a VM with direct attached VF by failing over to the paravirtual |
| 524 | 524 | datapath when the VF is unplugged. |
| 525 | 525 | |
| @@ -1963,6 +1963,9 @@ static int __bond_release_one(struct net_device *bond_dev, · 1962 unmodified lines | ||
| 1963 | 1963 | if (!bond_has_slaves(bond)) { |
| 1964 | 1964 | bond_set_carrier(bond); |
| 1965 | 1965 | eth_hw_addr_random(bond_dev); |
| 1966 | + bond->nest_level = SINGLE_DEPTH_NESTING; | |
| 1967 | + } else { | |
| 1968 | + bond->nest_level = dev_get_nest_level(bond_dev) + 1; | |
| 1966 | 1969 | } |
| 1967 | 1970 | |
| 1968 | 1971 | unblock_netpoll_tx(); |
| @@ -257,10 +257,7 @@ static int handle_tx(struct ser_device *ser) · 256 unmodified lines | ||
| 257 | 257 | if (skb->len == 0) { |
| 258 | 258 | struct sk_buff *tmp = skb_dequeue(&ser->head); |
| 259 | 259 | WARN_ON(tmp != skb); |
| 260 | − if (in_interrupt()) | |
| 261 | − dev_kfree_skb_irq(skb); | |
| 262 | − else | |
| 263 | − kfree_skb(skb); | |
| 260 | + dev_consume_skb_any(skb); | |
| 264 | 261 | } |
| 265 | 262 | } |
| 266 | 263 | /* Send flow off if queue is empty */ |
| @@ -480,8 +480,6 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb); · 479 unmodified lines | ||
| 480 | 480 | struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr) |
| 481 | 481 | { |
| 482 | 482 | struct can_priv *priv = netdev_priv(dev); |
| 483 | − struct sk_buff *skb = priv->echo_skb[idx]; | |
| 484 | − struct canfd_frame *cf; | |
| 485 | 483 | |
| 486 | 484 | if (idx >= priv->echo_skb_max) { |
| 487 | 485 | netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n", |
| @@ -489,20 +487,21 @@ struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 · 1 unmodified line | ||
| 489 | 487 | return NULL; |
| 490 | 488 | } |
| 491 | 489 | |
| 492 | − if (!skb) { | |
| 493 | − netdev_err(dev, "%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n", | |
| 494 | − __func__, idx); | |
| 495 | − return NULL; | |
| 496 | − } | |
| 490 | + if (priv->echo_skb[idx]) { | |
| 491 | + /* Using "struct canfd_frame::len" for the frame | |
| 492 | + * length is supported on both CAN and CANFD frames. | |
| 493 | + */ | |
| 494 | + struct sk_buff *skb = priv->echo_skb[idx]; | |
| 495 | + struct canfd_frame *cf = (struct canfd_frame *)skb->data; | |
| 496 | + u8 len = cf->len; | |
| 497 | 497 | |
| 498 | − /* Using "struct canfd_frame::len" for the frame | |
| 499 | − * length is supported on both CAN and CANFD frames. | |
| 500 | − */ | |
| 501 | − cf = (struct canfd_frame *)skb->data; | |
| 502 | − *len_ptr = cf->len; | |
| 503 | − priv->echo_skb[idx] = NULL; | |
| 498 | + *len_ptr = len; | |
| 499 | + priv->echo_skb[idx] = NULL; | |
| 504 | 500 | |
| 505 | − return skb; | |
| 501 | + return skb; | |
| 502 | + } | |
| 503 | + | |
| 504 | + return NULL; | |
| 506 | 505 | } |
| 507 | 506 | |
| 508 | 507 | /* |
| @@ -1106,7 +1106,7 @@ static int flexcan_chip_start(struct net_device *dev) · 1105 unmodified lines | ||
| 1106 | 1106 | } |
| 1107 | 1107 | } else { |
| 1108 | 1108 | /* clear and invalidate unused mailboxes first */ |
| 1109 | − for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i <= priv->mb_count; i++) { | |
| 1109 | + for (i = FLEXCAN_TX_MB_RESERVED_OFF_FIFO; i < priv->mb_count; i++) { | |
| 1110 | 1110 | mb = flexcan_get_mb(priv, i); |
| 1111 | 1111 | priv->write(FLEXCAN_MB_CODE_RX_INACTIVE, |
| 1112 | 1112 | &mb->can_ctrl); |
| @@ -1432,7 +1432,7 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) · 319 unmodified lines | ||
| 1432 | 1432 | gpr_np = of_find_node_by_phandle(phandle); |
| 1433 | 1433 | if (!gpr_np) { |
| 1434 | 1434 | dev_dbg(&pdev->dev, "could not find gpr node by phandle\n"); |
| 1435 | − return PTR_ERR(gpr_np); | |
| 1435 | + return -ENODEV; | |
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | priv = netdev_priv(dev); |
| @@ -7,7 +7,6 @@ · 6 unmodified lines | ||
| 7 | 7 | |
| 8 | 8 | #include <linux/delay.h> |
| 9 | 9 | #include <linux/export.h> |
| 10 | −#include <linux/gpio.h> | |
| 11 | 10 | #include <linux/gpio/consumer.h> |
| 12 | 11 | #include <linux/kernel.h> |
| 13 | 12 | #include <linux/module.h> |
| @@ -15,7 +14,6 @@ · 1 unmodified line | ||
| 15 | 14 | #include <linux/phy.h> |
| 16 | 15 | #include <linux/etherdevice.h> |
| 17 | 16 | #include <linux/if_bridge.h> |
| 18 | −#include <linux/of_gpio.h> | |
| 19 | 17 | #include <linux/of_net.h> |
| 20 | 18 | #include <net/dsa.h> |
| 21 | 19 | #include <net/switchdev.h> |
| @@ -18,7 +18,6 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/mfd/syscon.h> |
| 19 | 19 | #include <linux/module.h> |
| 20 | 20 | #include <linux/netdevice.h> |
| 21 | −#include <linux/of_gpio.h> | |
| 22 | 21 | #include <linux/of_mdio.h> |
| 23 | 22 | #include <linux/of_net.h> |
| 24 | 23 | #include <linux/of_platform.h> |
| @@ -2403,6 +2403,107 @@ static int mv88e6xxx_stats_setup(struct mv88e6xxx_chip *chip) · 2402 unmodified lines | ||
| 2403 | 2403 | return mv88e6xxx_g1_stats_clear(chip); |
| 2404 | 2404 | } |
| 2405 | 2405 | |
| 2406 | +/* The mv88e6390 has some hidden registers used for debug and | |
| 2407 | + * development. The errata also makes use of them. | |
| 2408 | + */ | |
| 2409 | +static int mv88e6390_hidden_write(struct mv88e6xxx_chip *chip, int port, | |
| 2410 | + int reg, u16 val) | |
| 2411 | +{ | |
| 2412 | + u16 ctrl; | |
| 2413 | + int err; | |
| 2414 | + | |
| 2415 | + err = mv88e6xxx_port_write(chip, PORT_RESERVED_1A_DATA_PORT, | |
| 2416 | + PORT_RESERVED_1A, val); | |
| 2417 | + if (err) | |
| 2418 | + return err; | |
| 2419 | + | |
| 2420 | + ctrl = PORT_RESERVED_1A_BUSY | PORT_RESERVED_1A_WRITE | | |
| 2421 | + PORT_RESERVED_1A_BLOCK | port << PORT_RESERVED_1A_PORT_SHIFT | | |
| 2422 | + reg; | |
| 2423 | + | |
| 2424 | + return mv88e6xxx_port_write(chip, PORT_RESERVED_1A_CTRL_PORT, | |
| 2425 | + PORT_RESERVED_1A, ctrl); | |
| 2426 | +} | |
| 2427 | + | |
| 2428 | +static int mv88e6390_hidden_wait(struct mv88e6xxx_chip *chip) | |
| 2429 | +{ | |
| 2430 | + return mv88e6xxx_wait(chip, PORT_RESERVED_1A_CTRL_PORT, | |
| 2431 | + PORT_RESERVED_1A, PORT_RESERVED_1A_BUSY); | |
| 2432 | +} | |
| 2433 | + | |
| 2434 | + | |
| 2435 | +static int mv88e6390_hidden_read(struct mv88e6xxx_chip *chip, int port, | |
| 2436 | + int reg, u16 *val) | |
| 2437 | +{ | |
| 2438 | + u16 ctrl; | |
| 2439 | + int err; | |
| 2440 | + | |
| 2441 | + ctrl = PORT_RESERVED_1A_BUSY | PORT_RESERVED_1A_READ | | |
| 2442 | + PORT_RESERVED_1A_BLOCK | port << PORT_RESERVED_1A_PORT_SHIFT | | |
| 2443 | + reg; | |
| 2444 | + | |
| 2445 | + err = mv88e6xxx_port_write(chip, PORT_RESERVED_1A_CTRL_PORT, | |
| 2446 | + PORT_RESERVED_1A, ctrl); | |
| 2447 | + if (err) | |
| 2448 | + return err; | |
| 2449 | + | |
| 2450 | + err = mv88e6390_hidden_wait(chip); | |
| 2451 | + if (err) | |
| 2452 | + return err; | |
| 2453 | + | |
| 2454 | + return mv88e6xxx_port_read(chip, PORT_RESERVED_1A_DATA_PORT, | |
| 2455 | + PORT_RESERVED_1A, val); | |
| 2456 | +} | |
| 2457 | + | |
| 2458 | +/* Check if the errata has already been applied. */ | |
| 2459 | +static bool mv88e6390_setup_errata_applied(struct mv88e6xxx_chip *chip) | |
| 2460 | +{ | |
| 2461 | + int port; | |
| 2462 | + int err; | |
| 2463 | + u16 val; | |
| 2464 | + | |
| 2465 | + for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { | |
| 2466 | + err = mv88e6390_hidden_read(chip, port, 0, &val); | |
| 2467 | + if (err) { | |
| 2468 | + dev_err(chip->dev, | |
| 2469 | + "Error reading hidden register: %d\n", err); | |
| 2470 | + return false; | |
| 2471 | + } | |
| 2472 | + if (val != 0x01c0) | |
| 2473 | + return false; | |
| 2474 | + } | |
| 2475 | + | |
| 2476 | + return true; | |
| 2477 | +} | |
| 2478 | + | |
| 2479 | +/* The 6390 copper ports have an errata which require poking magic | |
| 2480 | + * values into undocumented hidden registers and then performing a | |
| 2481 | + * software reset. | |
| 2482 | + */ | |
| 2483 | +static int mv88e6390_setup_errata(struct mv88e6xxx_chip *chip) | |
| 2484 | +{ | |
| 2485 | + int port; | |
| 2486 | + int err; | |
| 2487 | + | |
| 2488 | + if (mv88e6390_setup_errata_applied(chip)) | |
| 2489 | + return 0; | |
| 2490 | + | |
| 2491 | + /* Set the ports into blocking mode */ | |
| 2492 | + for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { | |
| 2493 | + err = mv88e6xxx_port_set_state(chip, port, BR_STATE_DISABLED); | |
| 2494 | + if (err) | |
| 2495 | + return err; | |
| 2496 | + } | |
| 2497 | + | |
| 2498 | + for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { | |
| 2499 | + err = mv88e6390_hidden_write(chip, port, 0, 0x01c0); | |
| 2500 | + if (err) | |
| 2501 | + return err; | |
| 2502 | + } | |
| 2503 | + | |
| 2504 | + return mv88e6xxx_software_reset(chip); | |
| 2505 | +} | |
| 2506 | + | |
| 2406 | 2507 | static int mv88e6xxx_setup(struct dsa_switch *ds) |
| 2407 | 2508 | { |
| 2408 | 2509 | struct mv88e6xxx_chip *chip = ds->priv; |
| @@ -2415,6 +2516,12 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) · 6 unmodified lines | ||
| 2415 | 2516 | |
| 2416 | 2517 | mutex_lock(&chip->reg_lock); |
| 2417 | 2518 | |
| 2519 | + if (chip->info->ops->setup_errata) { | |
| 2520 | + err = chip->info->ops->setup_errata(chip); | |
| 2521 | + if (err) | |
| 2522 | + goto unlock; | |
| 2523 | + } | |
| 2524 | + | |
| 2418 | 2525 | /* Cache the cmode of each port. */ |
| 2419 | 2526 | for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { |
| 2420 | 2527 | if (chip->info->ops->port_get_cmode) { |
| @@ -3226,6 +3333,7 @@ static const struct mv88e6xxx_ops mv88e6185_ops = { · 805 unmodified lines | ||
| 3226 | 3333 | |
| 3227 | 3334 | static const struct mv88e6xxx_ops mv88e6190_ops = { |
| 3228 | 3335 | /* MV88E6XXX_FAMILY_6390 */ |
| 3336 | + .setup_errata = mv88e6390_setup_errata, | |
| 3229 | 3337 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3230 | 3338 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3231 | 3339 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3269,6 +3377,7 @@ static const struct mv88e6xxx_ops mv88e6190_ops = { · 37 unmodified lines | ||
| 3269 | 3377 | |
| 3270 | 3378 | static const struct mv88e6xxx_ops mv88e6190x_ops = { |
| 3271 | 3379 | /* MV88E6XXX_FAMILY_6390 */ |
| 3380 | + .setup_errata = mv88e6390_setup_errata, | |
| 3272 | 3381 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3273 | 3382 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3274 | 3383 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3312,6 +3421,7 @@ static const struct mv88e6xxx_ops mv88e6190x_ops = { · 37 unmodified lines | ||
| 3312 | 3421 | |
| 3313 | 3422 | static const struct mv88e6xxx_ops mv88e6191_ops = { |
| 3314 | 3423 | /* MV88E6XXX_FAMILY_6390 */ |
| 3424 | + .setup_errata = mv88e6390_setup_errata, | |
| 3315 | 3425 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3316 | 3426 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3317 | 3427 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3404,6 +3514,7 @@ static const struct mv88e6xxx_ops mv88e6240_ops = { · 86 unmodified lines | ||
| 3404 | 3514 | |
| 3405 | 3515 | static const struct mv88e6xxx_ops mv88e6290_ops = { |
| 3406 | 3516 | /* MV88E6XXX_FAMILY_6390 */ |
| 3517 | + .setup_errata = mv88e6390_setup_errata, | |
| 3407 | 3518 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3408 | 3519 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3409 | 3520 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3709,6 +3820,7 @@ static const struct mv88e6xxx_ops mv88e6352_ops = { · 299 unmodified lines | ||
| 3709 | 3820 | |
| 3710 | 3821 | static const struct mv88e6xxx_ops mv88e6390_ops = { |
| 3711 | 3822 | /* MV88E6XXX_FAMILY_6390 */ |
| 3823 | + .setup_errata = mv88e6390_setup_errata, | |
| 3712 | 3824 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3713 | 3825 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3714 | 3826 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -3756,6 +3868,7 @@ static const struct mv88e6xxx_ops mv88e6390_ops = { · 41 unmodified lines | ||
| 3756 | 3868 | |
| 3757 | 3869 | static const struct mv88e6xxx_ops mv88e6390x_ops = { |
| 3758 | 3870 | /* MV88E6XXX_FAMILY_6390 */ |
| 3871 | + .setup_errata = mv88e6390_setup_errata, | |
| 3759 | 3872 | .irl_init_all = mv88e6390_g2_irl_init_all, |
| 3760 | 3873 | .get_eeprom = mv88e6xxx_g2_get_eeprom8, |
| 3761 | 3874 | .set_eeprom = mv88e6xxx_g2_set_eeprom8, |
| @@ -300,6 +300,11 @@ struct mv88e6xxx_mdio_bus { · 299 unmodified lines | ||
| 300 | 300 | }; |
| 301 | 301 | |
| 302 | 302 | struct mv88e6xxx_ops { |
| 303 | + /* Switch Setup Errata, called early in the switch setup to | |
| 304 | + * allow any errata actions to be performed | |
| 305 | + */ | |
| 306 | + int (*setup_errata)(struct mv88e6xxx_chip *chip); | |
| 307 | + | |
| 303 | 308 | int (*ieee_pri_map)(struct mv88e6xxx_chip *chip); |
| 304 | 309 | int (*ip_pri_map)(struct mv88e6xxx_chip *chip); |
| 305 | 310 | |
| @@ -251,6 +251,16 @@ · 250 unmodified lines | ||
| 251 | 251 | /* Offset 0x19: Port IEEE Priority Remapping Registers (4-7) */ |
| 252 | 252 | #define MV88E6095_PORT_IEEE_PRIO_REMAP_4567 0x19 |
| 253 | 253 | |
| 254 | +/* Offset 0x1a: Magic undocumented errata register */ | |
| 255 | +#define PORT_RESERVED_1A 0x1a | |
| 256 | +#define PORT_RESERVED_1A_BUSY BIT(15) | |
| 257 | +#define PORT_RESERVED_1A_WRITE BIT(14) | |
| 258 | +#define PORT_RESERVED_1A_READ 0 | |
| 259 | +#define PORT_RESERVED_1A_PORT_SHIFT 5 | |
| 260 | +#define PORT_RESERVED_1A_BLOCK (0xf << 10) | |
| 261 | +#define PORT_RESERVED_1A_CTRL_PORT 4 | |
| 262 | +#define PORT_RESERVED_1A_DATA_PORT 5 | |
| 263 | + | |
| 254 | 264 | int mv88e6xxx_port_read(struct mv88e6xxx_chip *chip, int port, int reg, |
| 255 | 265 | u16 *val); |
| 256 | 266 | int mv88e6xxx_port_write(struct mv88e6xxx_chip *chip, int port, int reg, |
| @@ -664,7 +664,7 @@ int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port) · 663 unmodified lines | ||
| 664 | 664 | if (port < 9) |
| 665 | 665 | return 0; |
| 666 | 666 | |
| 667 | − return mv88e6390_serdes_irq_setup(chip, port); | |
| 667 | + return mv88e6390x_serdes_irq_setup(chip, port); | |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | void mv88e6390x_serdes_irq_free(struct mv88e6xxx_chip *chip, int port) |
| @@ -347,16 +347,17 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 346 unmodified lines | ||
| 347 | 347 | struct device_node *mdio_np; |
| 348 | 348 | int ret; |
| 349 | 349 | |
| 350 | − mdio_np = of_find_compatible_node(smi->dev->of_node, NULL, | |
| 351 | − "realtek,smi-mdio"); | |
| 350 | + mdio_np = of_get_compatible_child(smi->dev->of_node, "realtek,smi-mdio"); | |
| 352 | 351 | if (!mdio_np) { |
| 353 | 352 | dev_err(smi->dev, "no MDIO bus node\n"); |
| 354 | 353 | return -ENODEV; |
| 355 | 354 | } |
| 356 | 355 | |
| 357 | 356 | smi->slave_mii_bus = devm_mdiobus_alloc(smi->dev); |
| 358 | − if (!smi->slave_mii_bus) | |
| 359 | − return -ENOMEM; | |
| 357 | + if (!smi->slave_mii_bus) { | |
| 358 | + ret = -ENOMEM; | |
| 359 | + goto err_put_node; | |
| 360 | + } | |
| 360 | 361 | smi->slave_mii_bus->priv = smi; |
| 361 | 362 | smi->slave_mii_bus->name = "SMI slave MII"; |
| 362 | 363 | smi->slave_mii_bus->read = realtek_smi_mdio_read; |
| @@ -371,10 +372,15 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) · 8 unmodified lines | ||
| 371 | 372 | if (ret) { |
| 372 | 373 | dev_err(smi->dev, "unable to register MDIO bus %s\n", |
| 373 | 374 | smi->slave_mii_bus->id); |
| 374 | − of_node_put(mdio_np); | |
| 375 | + goto err_put_node; | |
| 375 | 376 | } |
| 376 | 377 | |
| 377 | 378 | return 0; |
| 379 | + | |
| 380 | +err_put_node: | |
| 381 | + of_node_put(mdio_np); | |
| 382 | + | |
| 383 | + return ret; | |
| 378 | 384 | } |
| 379 | 385 | |
| 380 | 386 | static int realtek_smi_probe(struct platform_device *pdev) |
| @@ -457,6 +463,8 @@ static int realtek_smi_remove(struct platform_device *pdev) · 76 unmodified lines | ||
| 457 | 463 | struct realtek_smi *smi = dev_get_drvdata(&pdev->dev); |
| 458 | 464 | |
| 459 | 465 | dsa_unregister_switch(smi->ds); |
| 466 | + if (smi->slave_mii_bus) | |
| 467 | + of_node_put(smi->slave_mii_bus->dev.of_node); | |
| 460 | 468 | gpiod_set_value(smi->reset, 1); |
| 461 | 469 | |
| 462 | 470 | return 0; |
| @@ -2059,7 +2059,7 @@ static inline void ace_tx_int(struct net_device *dev, · 2058 unmodified lines | ||
| 2059 | 2059 | if (skb) { |
| 2060 | 2060 | dev->stats.tx_packets++; |
| 2061 | 2061 | dev->stats.tx_bytes += skb->len; |
| 2062 | − dev_kfree_skb_irq(skb); | |
| 2062 | + dev_consume_skb_irq(skb); | |
| 2063 | 2063 | info->skb = NULL; |
| 2064 | 2064 | } |
| 2065 | 2065 | |
| @@ -145,7 +145,8 @@ u32 msgdma_tx_completions(struct altera_tse_private *priv) · 144 unmodified lines | ||
| 145 | 145 | & 0xffff; |
| 146 | 146 | |
| 147 | 147 | if (inuse) { /* Tx FIFO is not empty */ |
| 148 | − ready = priv->tx_prod - priv->tx_cons - inuse - 1; | |
| 148 | + ready = max_t(int, | |
| 149 | + priv->tx_prod - priv->tx_cons - inuse - 1, 0); | |
| 149 | 150 | } else { |
| 150 | 151 | /* Check for buffered last packet */ |
| 151 | 152 | status = csrrd32(priv->tx_dma_csr, msgdma_csroffs(status)); |
| @@ -714,8 +714,10 @@ static struct phy_device *connect_local_phy(struct net_device *dev) · 713 unmodified lines | ||
| 714 | 714 | |
| 715 | 715 | phydev = phy_connect(dev, phy_id_fmt, &altera_tse_adjust_link, |
| 716 | 716 | priv->phy_iface); |
| 717 | − if (IS_ERR(phydev)) | |
| 717 | + if (IS_ERR(phydev)) { | |
| 718 | 718 | netdev_err(dev, "Could not attach to PHY\n"); |
| 719 | + phydev = NULL; | |
| 720 | + } | |
| 719 | 721 | |
| 720 | 722 | } else { |
| 721 | 723 | int ret; |
| @@ -666,7 +666,7 @@ static int amd8111e_tx(struct net_device *dev) · 665 unmodified lines | ||
| 666 | 666 | pci_unmap_single(lp->pci_dev, lp->tx_dma_addr[tx_index], |
| 667 | 667 | lp->tx_skbuff[tx_index]->len, |
| 668 | 668 | PCI_DMA_TODEVICE); |
| 669 | − dev_kfree_skb_irq (lp->tx_skbuff[tx_index]); | |
| 669 | + dev_consume_skb_irq(lp->tx_skbuff[tx_index]); | |
| 670 | 670 | lp->tx_skbuff[tx_index] = NULL; |
| 671 | 671 | lp->tx_dma_addr[tx_index] = 0; |
| 672 | 672 | } |
| @@ -431,8 +431,6 @@ · 430 unmodified lines | ||
| 431 | 431 | #define MAC_MDIOSCAR_PA_WIDTH 5 |
| 432 | 432 | #define MAC_MDIOSCAR_RA_INDEX 0 |
| 433 | 433 | #define MAC_MDIOSCAR_RA_WIDTH 16 |
| 434 | −#define MAC_MDIOSCAR_REG_INDEX 0 | |
| 435 | −#define MAC_MDIOSCAR_REG_WIDTH 21 | |
| 436 | 434 | #define MAC_MDIOSCCDR_BUSY_INDEX 22 |
| 437 | 435 | #define MAC_MDIOSCCDR_BUSY_WIDTH 1 |
| 438 | 436 | #define MAC_MDIOSCCDR_CMD_INDEX 16 |
| @@ -1284,6 +1284,20 @@ static void xgbe_write_mmd_regs(struct xgbe_prv_data *pdata, int prtad, · 1283 unmodified lines | ||
| 1284 | 1284 | } |
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | +static unsigned int xgbe_create_mdio_sca(int port, int reg) | |
| 1288 | +{ | |
| 1289 | + unsigned int mdio_sca, da; | |
| 1290 | + | |
| 1291 | + da = (reg & MII_ADDR_C45) ? reg >> 16 : 0; | |
| 1292 | + | |
| 1293 | + mdio_sca = 0; | |
| 1294 | + XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, RA, reg); | |
| 1295 | + XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, PA, port); | |
| 1296 | + XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, da); | |
| 1297 | + | |
| 1298 | + return mdio_sca; | |
| 1299 | +} | |
| 1300 | + | |
| 1287 | 1301 | static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, |
| 1288 | 1302 | int reg, u16 val) |
| 1289 | 1303 | { |
| @@ -1291,9 +1305,7 @@ static int xgbe_write_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, · 1 unmodified line | ||
| 1291 | 1305 | |
| 1292 | 1306 | reinit_completion(&pdata->mdio_complete); |
| 1293 | 1307 | |
| 1294 | − mdio_sca = 0; | |
| 1295 | − XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg); | |
| 1296 | − XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr); | |
| 1308 | + mdio_sca = xgbe_create_mdio_sca(addr, reg); | |
| 1297 | 1309 | XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); |
| 1298 | 1310 | |
| 1299 | 1311 | mdio_sccd = 0; |
| @@ -1317,9 +1329,7 @@ static int xgbe_read_ext_mii_regs(struct xgbe_prv_data *pdata, int addr, · 17 unmodified lines | ||
| 1317 | 1329 | |
| 1318 | 1330 | reinit_completion(&pdata->mdio_complete); |
| 1319 | 1331 | |
| 1320 | − mdio_sca = 0; | |
| 1321 | − XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, REG, reg); | |
| 1322 | − XGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, DA, addr); | |
| 1332 | + mdio_sca = xgbe_create_mdio_sca(addr, reg); | |
| 1323 | 1333 | XGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); |
| 1324 | 1334 | |
| 1325 | 1335 | mdio_sccd = 0; |
| @@ -777,7 +777,7 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id) · 776 unmodified lines | ||
| 777 | 777 | |
| 778 | 778 | if (bp->tx_bufs[bp->tx_empty]) { |
| 779 | 779 | ++dev->stats.tx_packets; |
| 780 | − dev_kfree_skb_irq(bp->tx_bufs[bp->tx_empty]); | |
| 780 | + dev_consume_skb_irq(bp->tx_bufs[bp->tx_empty]); | |
| 781 | 781 | } |
| 782 | 782 | bp->tx_bufs[bp->tx_empty] = NULL; |
| 783 | 783 | bp->tx_fullup = 0; |
| @@ -638,7 +638,7 @@ static void b44_tx(struct b44 *bp) · 637 unmodified lines | ||
| 638 | 638 | bytes_compl += skb->len; |
| 639 | 639 | pkts_compl++; |
| 640 | 640 | |
| 641 | − dev_kfree_skb_irq(skb); | |
| 641 | + dev_consume_skb_irq(skb); | |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | netdev_completed_queue(bp->dev, pkts_compl, bytes_compl); |
| @@ -1012,7 +1012,7 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev) · 367 unmodified lines | ||
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), len); |
| 1015 | − dev_kfree_skb_any(skb); | |
| 1015 | + dev_consume_skb_any(skb); | |
| 1016 | 1016 | skb = bounce_skb; |
| 1017 | 1017 | } |
| 1018 | 1018 | |
| @@ -5601,7 +5601,8 @@ static int bnxt_hwrm_check_pf_rings(struct bnxt *bp, int tx_rings, int rx_rings, · 5600 unmodified lines | ||
| 5601 | 5601 | FUNC_CFG_REQ_FLAGS_STAT_CTX_ASSETS_TEST | |
| 5602 | 5602 | FUNC_CFG_REQ_FLAGS_VNIC_ASSETS_TEST; |
| 5603 | 5603 | if (bp->flags & BNXT_FLAG_CHIP_P5) |
| 5604 | − flags |= FUNC_CFG_REQ_FLAGS_RSSCOS_CTX_ASSETS_TEST; | |
| 5604 | + flags |= FUNC_CFG_REQ_FLAGS_RSSCOS_CTX_ASSETS_TEST | | |
| 5605 | + FUNC_CFG_REQ_FLAGS_NQ_ASSETS_TEST; | |
| 5605 | 5606 | else |
| 5606 | 5607 | flags |= FUNC_CFG_REQ_FLAGS_RING_GRP_ASSETS_TEST; |
| 5607 | 5608 | } |
| @@ -6221,9 +6222,12 @@ static int bnxt_alloc_ctx_pg_tbls(struct bnxt *bp, · 613 unmodified lines | ||
| 6221 | 6222 | rmem->pg_tbl_map = ctx_pg->ctx_dma_arr[i]; |
| 6222 | 6223 | rmem->depth = 1; |
| 6223 | 6224 | rmem->nr_pages = MAX_CTX_PAGES; |
| 6224 | − if (i == (nr_tbls - 1)) | |
| 6225 | − rmem->nr_pages = ctx_pg->nr_pages % | |
| 6226 | − MAX_CTX_PAGES; | |
| 6225 | + if (i == (nr_tbls - 1)) { | |
| 6226 | + int rem = ctx_pg->nr_pages % MAX_CTX_PAGES; | |
| 6227 | + | |
| 6228 | + if (rem) | |
| 6229 | + rmem->nr_pages = rem; | |
| 6230 | + } | |
| 6227 | 6231 | rc = bnxt_alloc_ctx_mem_blk(bp, pg_tbl); |
| 6228 | 6232 | if (rc) |
| 6229 | 6233 | break; |
| @@ -386,8 +386,8 @@ struct hwrm_err_output { · 385 unmodified lines | ||
| 386 | 386 | #define HWRM_VERSION_MAJOR 1 |
| 387 | 387 | #define HWRM_VERSION_MINOR 10 |
| 388 | 388 | #define HWRM_VERSION_UPDATE 0 |
| 389 | −#define HWRM_VERSION_RSVD 33 | |
| 390 | −#define HWRM_VERSION_STR "1.10.0.33" | |
| 389 | +#define HWRM_VERSION_RSVD 35 | |
| 390 | +#define HWRM_VERSION_STR "1.10.0.35" | |
| 391 | 391 | |
| 392 | 392 | /* hwrm_ver_get_input (size:192b/24B) */ |
| 393 | 393 | struct hwrm_ver_get_input { |
| @@ -1184,6 +1184,7 @@ struct hwrm_func_cfg_input { · 790 unmodified lines | ||
| 1184 | 1184 | #define FUNC_CFG_REQ_FLAGS_L2_CTX_ASSETS_TEST 0x100000UL |
| 1185 | 1185 | #define FUNC_CFG_REQ_FLAGS_TRUSTED_VF_ENABLE 0x200000UL |
| 1186 | 1186 | #define FUNC_CFG_REQ_FLAGS_DYNAMIC_TX_RING_ALLOC 0x400000UL |
| 1187 | + #define FUNC_CFG_REQ_FLAGS_NQ_ASSETS_TEST 0x800000UL | |
| 1187 | 1188 | __le32 enables; |
| 1188 | 1189 | #define FUNC_CFG_REQ_ENABLES_MTU 0x1UL |
| 1189 | 1190 | #define FUNC_CFG_REQ_ENABLES_MRU 0x2UL |
| @@ -643,6 +643,7 @@ · 642 unmodified lines | ||
| 643 | 643 | #define MACB_CAPS_JUMBO 0x00000020 |
| 644 | 644 | #define MACB_CAPS_GEM_HAS_PTP 0x00000040 |
| 645 | 645 | #define MACB_CAPS_BD_RD_PREFETCH 0x00000080 |
| 646 | +#define MACB_CAPS_NEEDS_RSTONUBR 0x00000100 | |
| 646 | 647 | #define MACB_CAPS_FIFO_MODE 0x10000000 |
| 647 | 648 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 |
| 648 | 649 | #define MACB_CAPS_SG_DISABLED 0x40000000 |
| @@ -1214,6 +1215,8 @@ struct macb { · 565 unmodified lines | ||
| 1214 | 1215 | |
| 1215 | 1216 | int rx_bd_rd_prefetch; |
| 1216 | 1217 | int tx_bd_rd_prefetch; |
| 1218 | + | |
| 1219 | + u32 rx_intr_mask; | |
| 1217 | 1220 | }; |
| 1218 | 1221 | |
| 1219 | 1222 | #ifdef CONFIG_MACB_USE_HWSTAMP |
| @@ -56,8 +56,7 @@ · 55 unmodified lines | ||
| 56 | 56 | /* level of occupied TX descriptors under which we wake up TX process */ |
| 57 | 57 | #define MACB_TX_WAKEUP_THRESH(bp) (3 * (bp)->tx_ring_size / 4) |
| 58 | 58 | |
| 59 | −#define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(RXUBR) \ | |
| 60 | − | MACB_BIT(ISR_ROVR)) | |
| 59 | +#define MACB_RX_INT_FLAGS (MACB_BIT(RCOMP) | MACB_BIT(ISR_ROVR)) | |
| 61 | 60 | #define MACB_TX_ERR_FLAGS (MACB_BIT(ISR_TUND) \ |
| 62 | 61 | | MACB_BIT(ISR_RLE) \ |
| 63 | 62 | | MACB_BIT(TXERR)) |
| @@ -1270,7 +1269,7 @@ static int macb_poll(struct napi_struct *napi, int budget) · 1206 unmodified lines | ||
| 1270 | 1269 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); |
| 1271 | 1270 | napi_reschedule(napi); |
| 1272 | 1271 | } else { |
| 1273 | − queue_writel(queue, IER, MACB_RX_INT_FLAGS); | |
| 1272 | + queue_writel(queue, IER, bp->rx_intr_mask); | |
| 1274 | 1273 | } |
| 1275 | 1274 | } |
| 1276 | 1275 | |
| @@ -1288,7 +1287,7 @@ static void macb_hresp_error_task(unsigned long data) · 11 unmodified lines | ||
| 1288 | 1287 | u32 ctrl; |
| 1289 | 1288 | |
| 1290 | 1289 | for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) { |
| 1291 | − queue_writel(queue, IDR, MACB_RX_INT_FLAGS | | |
| 1290 | + queue_writel(queue, IDR, bp->rx_intr_mask | | |
| 1292 | 1291 | MACB_TX_INT_FLAGS | |
| 1293 | 1292 | MACB_BIT(HRESP)); |
| 1294 | 1293 | } |
| @@ -1318,7 +1317,7 @@ static void macb_hresp_error_task(unsigned long data) · 23 unmodified lines | ||
| 1318 | 1317 | |
| 1319 | 1318 | /* Enable interrupts */ |
| 1320 | 1319 | queue_writel(queue, IER, |
| 1321 | − MACB_RX_INT_FLAGS | | |
| 1320 | + bp->rx_intr_mask | | |
| 1322 | 1321 | MACB_TX_INT_FLAGS | |
| 1323 | 1322 | MACB_BIT(HRESP)); |
| 1324 | 1323 | } |
| @@ -1372,14 +1371,14 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) · 47 unmodified lines | ||
| 1372 | 1371 | (unsigned int)(queue - bp->queues), |
| 1373 | 1372 | (unsigned long)status); |
| 1374 | 1373 | |
| 1375 | − if (status & MACB_RX_INT_FLAGS) { | |
| 1374 | + if (status & bp->rx_intr_mask) { | |
| 1376 | 1375 | /* There's no point taking any more interrupts |
| 1377 | 1376 | * until we have processed the buffers. The |
| 1378 | 1377 | * scheduling call may fail if the poll routine |
| 1379 | 1378 | * is already scheduled, so disable interrupts |
| 1380 | 1379 | * now. |
| 1381 | 1380 | */ |
| 1382 | − queue_writel(queue, IDR, MACB_RX_INT_FLAGS); | |
| 1381 | + queue_writel(queue, IDR, bp->rx_intr_mask); | |
| 1383 | 1382 | if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) |
| 1384 | 1383 | queue_writel(queue, ISR, MACB_BIT(RCOMP)); |
| 1385 | 1384 | |
| @@ -1412,8 +1411,9 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) · 26 unmodified lines | ||
| 1412 | 1411 | /* There is a hardware issue under heavy load where DMA can |
| 1413 | 1412 | * stop, this causes endless "used buffer descriptor read" |
| 1414 | 1413 | * interrupts but it can be cleared by re-enabling RX. See |
| 1415 | − * the at91 manual, section 41.3.1 or the Zynq manual | |
| 1416 | − * section 16.7.4 for details. | |
| 1414 | + * the at91rm9200 manual, section 41.3.1 or the Zynq manual | |
| 1415 | + * section 16.7.4 for details. RXUBR is only enabled for | |
| 1416 | + * these two versions. | |
| 1417 | 1417 | */ |
| 1418 | 1418 | if (status & MACB_BIT(RXUBR)) { |
| 1419 | 1419 | ctrl = macb_readl(bp, NCR); |
| @@ -1738,12 +1738,8 @@ static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *ndev) · 318 unmodified lines | ||
| 1738 | 1738 | *skb = nskb; |
| 1739 | 1739 | } |
| 1740 | 1740 | |
| 1741 | − if (padlen) { | |
| 1742 | − if (padlen >= ETH_FCS_LEN) | |
| 1743 | − skb_put_zero(*skb, padlen - ETH_FCS_LEN); | |
| 1744 | − else | |
| 1745 | − skb_trim(*skb, ETH_FCS_LEN - padlen); | |
| 1746 | − } | |
| 1741 | + if (padlen > ETH_FCS_LEN) | |
| 1742 | + skb_put_zero(*skb, padlen - ETH_FCS_LEN); | |
| 1747 | 1743 | |
| 1748 | 1744 | add_fcs: |
| 1749 | 1745 | /* set FCS to packet */ |
| @@ -2263,7 +2259,7 @@ static void macb_init_hw(struct macb *bp) · 513 unmodified lines | ||
| 2263 | 2259 | |
| 2264 | 2260 | /* Enable interrupts */ |
| 2265 | 2261 | queue_writel(queue, IER, |
| 2266 | − MACB_RX_INT_FLAGS | | |
| 2262 | + bp->rx_intr_mask | | |
| 2267 | 2263 | MACB_TX_INT_FLAGS | |
| 2268 | 2264 | MACB_BIT(HRESP)); |
| 2269 | 2265 | } |
| @@ -3911,6 +3907,7 @@ static const struct macb_config sama5d4_config = { · 1641 unmodified lines | ||
| 3911 | 3907 | }; |
| 3912 | 3908 | |
| 3913 | 3909 | static const struct macb_config emac_config = { |
| 3910 | + .caps = MACB_CAPS_NEEDS_RSTONUBR, | |
| 3914 | 3911 | .clk_init = at91ether_clk_init, |
| 3915 | 3912 | .init = at91ether_init, |
| 3916 | 3913 | }; |
| @@ -3932,7 +3929,8 @@ static const struct macb_config zynqmp_config = { · 15 unmodified lines | ||
| 3932 | 3929 | }; |
| 3933 | 3930 | |
| 3934 | 3931 | static const struct macb_config zynq_config = { |
| 3935 | − .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF, | |
| 3932 | + .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_NO_GIGABIT_HALF | | |
| 3933 | + MACB_CAPS_NEEDS_RSTONUBR, | |
| 3936 | 3934 | .dma_burst_length = 16, |
| 3937 | 3935 | .clk_init = macb_clk_init, |
| 3938 | 3936 | .init = macb_init, |
| @@ -4087,6 +4085,10 @@ static int macb_probe(struct platform_device *pdev) · 148 unmodified lines | ||
| 4087 | 4085 | macb_dma_desc_get_size(bp); |
| 4088 | 4086 | } |
| 4089 | 4087 | |
| 4088 | + bp->rx_intr_mask = MACB_RX_INT_FLAGS; | |
| 4089 | + if (bp->caps & MACB_CAPS_NEEDS_RSTONUBR) | |
| 4090 | + bp->rx_intr_mask |= MACB_BIT(RXUBR); | |
| 4091 | + | |
| 4090 | 4092 | mac = of_get_mac_address(np); |
| 4091 | 4093 | if (mac) { |
| 4092 | 4094 | ether_addr_copy(bp->dev->dev_addr, mac); |
| @@ -2381,7 +2381,7 @@ no_mem: · 2380 unmodified lines | ||
| 2381 | 2381 | lro_add_page(adap, qs, fl, |
| 2382 | 2382 | G_RSPD_LEN(len), |
| 2383 | 2383 | flags & F_RSPD_EOP); |
| 2384 | − goto next_fl; | |
| 2384 | + goto next_fl; | |
| 2385 | 2385 | } |
| 2386 | 2386 | |
| 2387 | 2387 | skb = get_packet_pg(adap, fl, q, |
| @@ -3214,11 +3214,13 @@ void t3_start_sge_timers(struct adapter *adap) · 826 unmodified lines | ||
| 3214 | 3214 | for (i = 0; i < SGE_QSETS; ++i) { |
| 3215 | 3215 | struct sge_qset *q = &adap->sge.qs[i]; |
| 3216 | 3216 | |
| 3217 | − if (q->tx_reclaim_timer.function) | |
| 3218 | − mod_timer(&q->tx_reclaim_timer, jiffies + TX_RECLAIM_PERIOD); | |
| 3217 | + if (q->tx_reclaim_timer.function) | |
| 3218 | + mod_timer(&q->tx_reclaim_timer, | |
| 3219 | + jiffies + TX_RECLAIM_PERIOD); | |
| 3219 | 3220 | |
| 3220 | − if (q->rx_reclaim_timer.function) | |
| 3221 | − mod_timer(&q->rx_reclaim_timer, jiffies + RX_RECLAIM_PERIOD); | |
| 3221 | + if (q->rx_reclaim_timer.function) | |
| 3222 | + mod_timer(&q->rx_reclaim_timer, | |
| 3223 | + jiffies + RX_RECLAIM_PERIOD); | |
| 3222 | 3224 | } |
| 3223 | 3225 | } |
| 3224 | 3226 | |
| @@ -1082,7 +1082,7 @@ int t3_check_fw_version(struct adapter *adapter) · 1081 unmodified lines | ||
| 1082 | 1082 | CH_WARN(adapter, "found newer FW version(%u.%u), " |
| 1083 | 1083 | "driver compiled for version %u.%u\n", major, minor, |
| 1084 | 1084 | FW_VERSION_MAJOR, FW_VERSION_MINOR); |
| 1085 | − return 0; | |
| 1085 | + return 0; | |
| 1086 | 1086 | } |
| 1087 | 1087 | return -EINVAL; |
| 1088 | 1088 | } |
| @@ -3619,7 +3619,7 @@ int t3_reset_adapter(struct adapter *adapter) · 2530 unmodified lines | ||
| 3619 | 3619 | |
| 3620 | 3620 | static int init_parity(struct adapter *adap) |
| 3621 | 3621 | { |
| 3622 | − int i, err, addr; | |
| 3622 | + int i, err, addr; | |
| 3623 | 3623 | |
| 3624 | 3624 | if (t3_read_reg(adap, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY) |
| 3625 | 3625 | return -EBUSY; |
| @@ -3806,6 +3806,6 @@ int t3_replay_prep_adapter(struct adapter *adapter) · 180 unmodified lines | ||
| 3806 | 3806 | p->phy.ops->power_down(&p->phy, 1); |
| 3807 | 3807 | } |
| 3808 | 3808 | |
| 3809 | −return 0; | |
| 3809 | + return 0; | |
| 3810 | 3810 | } |
| 3811 | 3811 | |
| @@ -378,10 +378,10 @@ static void cxgb4_init_ptp_timer(struct adapter *adapter) · 377 unmodified lines | ||
| 378 | 378 | int err; |
| 379 | 379 | |
| 380 | 380 | memset(&c, 0, sizeof(c)); |
| 381 | − c.op_to_portid = cpu_to_be32(FW_CMD_OP_V(FW_PTP_CMD) | | |
| 382 | − FW_CMD_REQUEST_F | | |
| 383 | − FW_CMD_WRITE_F | | |
| 384 | − FW_PTP_CMD_PORTID_V(0)); | |
| 381 | + c.op_to_portid = cpu_to_be32(FW_CMD_OP_V(FW_PTP_CMD) | | |
| 382 | + FW_CMD_REQUEST_F | | |
| 383 | + FW_CMD_WRITE_F | | |
| 384 | + FW_PTP_CMD_PORTID_V(0)); | |
| 385 | 385 | c.retval_len16 = cpu_to_be32(FW_CMD_LEN16_V(sizeof(c) / 16)); |
| 386 | 386 | c.u.scmd.sc = FW_PTP_SC_INIT_TIMER; |
| 387 | 387 | |
| @@ -78,7 +78,7 @@ static void free_msix_idx_in_bmap(struct adapter *adap, unsigned int msix_idx) · 77 unmodified lines | ||
| 78 | 78 | unsigned long flags; |
| 79 | 79 | |
| 80 | 80 | spin_lock_irqsave(&bmap->lock, flags); |
| 81 | − __clear_bit(msix_idx, bmap->msix_bmap); | |
| 81 | + __clear_bit(msix_idx, bmap->msix_bmap); | |
| 82 | 82 | spin_unlock_irqrestore(&bmap->lock, flags); |
| 83 | 83 | } |
| 84 | 84 | |
| @@ -3794,7 +3794,7 @@ int t4_load_phy_fw(struct adapter *adap, · 3793 unmodified lines | ||
| 3794 | 3794 | /* If we have version number support, then check to see if the adapter |
| 3795 | 3795 | * already has up-to-date PHY firmware loaded. |
| 3796 | 3796 | */ |
| 3797 | − if (phy_fw_version) { | |
| 3797 | + if (phy_fw_version) { | |
| 3798 | 3798 | new_phy_fw_vers = phy_fw_version(phy_fw_data, phy_fw_size); |
| 3799 | 3799 | ret = t4_phy_fw_ver(adap, &cur_phy_fw_ver); |
| 3800 | 3800 | if (ret < 0) |
| @@ -2051,6 +2051,7 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) · 2050 unmodified lines | ||
| 2051 | 2051 | bool nonlinear = skb_is_nonlinear(skb); |
| 2052 | 2052 | struct rtnl_link_stats64 *percpu_stats; |
| 2053 | 2053 | struct dpaa_percpu_priv *percpu_priv; |
| 2054 | + struct netdev_queue *txq; | |
| 2054 | 2055 | struct dpaa_priv *priv; |
| 2055 | 2056 | struct qm_fd fd; |
| 2056 | 2057 | int offset = 0; |
| @@ -2100,6 +2101,11 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev) · 43 unmodified lines | ||
| 2100 | 2101 | if (unlikely(err < 0)) |
| 2101 | 2102 | goto skb_to_fd_failed; |
| 2102 | 2103 | |
| 2104 | + txq = netdev_get_tx_queue(net_dev, queue_mapping); | |
| 2105 | + | |
| 2106 | + /* LLTX requires to do our own update of trans_start */ | |
| 2107 | + txq->trans_start = jiffies; | |
| 2108 | + | |
| 2103 | 2109 | if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { |
| 2104 | 2110 | fd.cmd |= cpu_to_be32(FM_FD_CMD_UPD); |
| 2105 | 2111 | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
| @@ -9,8 +9,9 @@ config FSL_DPAA2_ETH · 8 unmodified lines | ||
| 9 | 9 | |
| 10 | 10 | config FSL_DPAA2_PTP_CLOCK |
| 11 | 11 | tristate "Freescale DPAA2 PTP Clock" |
| 12 | − depends on FSL_DPAA2_ETH && POSIX_TIMERS | |
| 13 | − select PTP_1588_CLOCK | |
| 12 | + depends on FSL_DPAA2_ETH | |
| 13 | + imply PTP_1588_CLOCK | |
| 14 | + default y | |
| 14 | 15 | help |
| 15 | 16 | This driver adds support for using the DPAA2 1588 timer module |
| 16 | 17 | as a PTP clock. |
| @@ -3467,7 +3467,7 @@ fec_probe(struct platform_device *pdev) · 3466 unmodified lines | ||
| 3467 | 3467 | if (ret) |
| 3468 | 3468 | goto failed_clk_ipg; |
| 3469 | 3469 | |
| 3470 | − fep->reg_phy = devm_regulator_get(&pdev->dev, "phy"); | |
| 3470 | + fep->reg_phy = devm_regulator_get_optional(&pdev->dev, "phy"); | |
| 3471 | 3471 | if (!IS_ERR(fep->reg_phy)) { |
| 3472 | 3472 | ret = regulator_enable(fep->reg_phy); |
| 3473 | 3473 | if (ret) { |
| @@ -147,12 +147,10 @@ static void hns_ae_put_handle(struct hnae_handle *handle) · 146 unmodified lines | ||
| 147 | 147 | struct hnae_vf_cb *vf_cb = hns_ae_get_vf_cb(handle); |
| 148 | 148 | int i; |
| 149 | 149 | |
| 150 | − vf_cb->mac_cb = NULL; | |
| 151 | − | |
| 152 | − kfree(vf_cb); | |
| 153 | − | |
| 154 | 150 | for (i = 0; i < handle->q_num; i++) |
| 155 | 151 | hns_ae_get_ring_pair(handle->qs[i])->used_by_vf = 0; |
| 152 | + | |
| 153 | + kfree(vf_cb); | |
| 156 | 154 | } |
| 157 | 155 | |
| 158 | 156 | static int hns_ae_wait_flow_down(struct hnae_handle *handle) |
| @@ -1170,6 +1170,13 @@ int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h) · 1169 unmodified lines | ||
| 1170 | 1170 | if (!h->phy_dev) |
| 1171 | 1171 | return 0; |
| 1172 | 1172 | |
| 1173 | + ethtool_convert_legacy_u32_to_link_mode(supported, h->if_support); | |
| 1174 | + linkmode_and(phy_dev->supported, phy_dev->supported, supported); | |
| 1175 | + linkmode_copy(phy_dev->advertising, phy_dev->supported); | |
| 1176 | + | |
| 1177 | + if (h->phy_if == PHY_INTERFACE_MODE_XGMII) | |
| 1178 | + phy_dev->autoneg = false; | |
| 1179 | + | |
| 1173 | 1180 | if (h->phy_if != PHY_INTERFACE_MODE_XGMII) { |
| 1174 | 1181 | phy_dev->dev_flags = 0; |
| 1175 | 1182 | |
| @@ -1181,16 +1188,6 @@ int hns_nic_init_phy(struct net_device *ndev, struct hnae_handle *h) · 5 unmodified lines | ||
| 1181 | 1188 | if (unlikely(ret)) |
| 1182 | 1189 | return -ENODEV; |
| 1183 | 1190 | |
| 1184 | − ethtool_convert_legacy_u32_to_link_mode(supported, h->if_support); | |
| 1185 | − linkmode_and(phy_dev->supported, phy_dev->supported, supported); | |
| 1186 | − linkmode_copy(phy_dev->advertising, phy_dev->supported); | |
| 1187 | − | |
| 1188 | − if (h->phy_if == PHY_INTERFACE_MODE_XGMII) | |
| 1189 | − phy_dev->autoneg = false; | |
| 1190 | − | |
| 1191 | − if (h->phy_if == PHY_INTERFACE_MODE_SGMII) | |
| 1192 | − phy_stop(phy_dev); | |
| 1193 | − | |
| 1194 | 1191 | return 0; |
| 1195 | 1192 | } |
| 1196 | 1193 | |
| @@ -2421,6 +2418,8 @@ static int hns_nic_dev_probe(struct platform_device *pdev) · 1224 unmodified lines | ||
| 2421 | 2418 | out_notify_fail: |
| 2422 | 2419 | (void)cancel_work_sync(&priv->service_task); |
| 2423 | 2420 | out_read_prop_fail: |
| 2421 | + /* safe for ACPI FW */ | |
| 2422 | + of_node_put(to_of_node(priv->fwnode)); | |
| 2424 | 2423 | free_netdev(ndev); |
| 2425 | 2424 | return ret; |
| 2426 | 2425 | } |
| @@ -2450,6 +2449,9 @@ static int hns_nic_dev_remove(struct platform_device *pdev) · 23 unmodified lines | ||
| 2450 | 2449 | set_bit(NIC_STATE_REMOVING, &priv->state); |
| 2451 | 2450 | (void)cancel_work_sync(&priv->service_task); |
| 2452 | 2451 | |
| 2452 | + /* safe for ACPI FW */ | |
| 2453 | + of_node_put(to_of_node(priv->fwnode)); | |
| 2454 | + | |
| 2453 | 2455 | free_netdev(ndev); |
| 2454 | 2456 | return 0; |
| 2455 | 2457 | } |
| @@ -1157,16 +1157,18 @@ static int hns_get_regs_len(struct net_device *net_dev) · 1156 unmodified lines | ||
| 1157 | 1157 | */ |
| 1158 | 1158 | static int hns_nic_nway_reset(struct net_device *netdev) |
| 1159 | 1159 | { |
| 1160 | − int ret = 0; | |
| 1161 | 1160 | struct phy_device *phy = netdev->phydev; |
| 1162 | 1161 | |
| 1163 | − if (netif_running(netdev)) { | |
| 1164 | − /* if autoneg is disabled, don't restart auto-negotiation */ | |
| 1165 | − if (phy && phy->autoneg == AUTONEG_ENABLE) | |
| 1166 | − ret = genphy_restart_aneg(phy); | |
| 1167 | − } | |
| 1162 | + if (!netif_running(netdev)) | |
| 1163 | + return 0; | |
| 1168 | 1164 | |
| 1169 | − return ret; | |
| 1165 | + if (!phy) | |
| 1166 | + return -EOPNOTSUPP; | |
| 1167 | + | |
| 1168 | + if (phy->autoneg != AUTONEG_ENABLE) | |
| 1169 | + return -EINVAL; | |
| 1170 | + | |
| 1171 | + return genphy_restart_aneg(phy); | |
| 1170 | 1172 | } |
| 1171 | 1173 | |
| 1172 | 1174 | static u32 |
| @@ -321,7 +321,7 @@ static int hns_mdio_read(struct mii_bus *bus, int phy_id, int regnum) · 320 unmodified lines | ||
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | hns_mdio_cmd_write(mdio_dev, is_c45, |
| 324 | − MDIO_C45_WRITE_ADDR, phy_id, devad); | |
| 324 | + MDIO_C45_READ, phy_id, devad); | |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /* Step 5: waitting for MDIO_COMMAND_REG 's mdio_start==0,*/ |
| @@ -1310,7 +1310,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id) · 1309 unmodified lines | ||
| 1310 | 1310 | dev->stats.tx_aborted_errors++; |
| 1311 | 1311 | } |
| 1312 | 1312 | |
| 1313 | − dev_kfree_skb_irq(skb); | |
| 1313 | + dev_consume_skb_irq(skb); | |
| 1314 | 1314 | |
| 1315 | 1315 | tx_cmd->cmd.command = 0; /* Mark free */ |
| 1316 | 1316 | break; |
| @@ -1313,7 +1313,6 @@ static int ibmveth_poll(struct napi_struct *napi, int budget) · 1312 unmodified lines | ||
| 1313 | 1313 | unsigned long lpar_rc; |
| 1314 | 1314 | u16 mss = 0; |
| 1315 | 1315 | |
| 1316 | −restart_poll: | |
| 1317 | 1316 | while (frames_processed < budget) { |
| 1318 | 1317 | if (!ibmveth_rxq_pending_buffer(adapter)) |
| 1319 | 1318 | break; |
| @@ -1401,7 +1400,6 @@ restart_poll: · 81 unmodified lines | ||
| 1401 | 1400 | napi_reschedule(napi)) { |
| 1402 | 1401 | lpar_rc = h_vio_signal(adapter->vdev->unit_address, |
| 1403 | 1402 | VIO_IRQ_DISABLE); |
| 1404 | − goto restart_poll; | |
| 1405 | 1403 | } |
| 1406 | 1404 | } |
| 1407 | 1405 | |
| @@ -159,7 +159,7 @@ config IXGBE · 158 unmodified lines | ||
| 159 | 159 | tristate "Intel(R) 10GbE PCI Express adapters support" |
| 160 | 160 | depends on PCI |
| 161 | 161 | select MDIO |
| 162 | − select MDIO_DEVICE | |
| 162 | + select PHYLIB | |
| 163 | 163 | imply PTP_1588_CLOCK |
| 164 | 164 | ---help--- |
| 165 | 165 | This driver supports Intel(R) 10GbE PCI Express family of |
| @@ -515,7 +515,7 @@ struct igb_adapter { · 514 unmodified lines | ||
| 515 | 515 | /* OS defined structs */ |
| 516 | 516 | struct pci_dev *pdev; |
| 517 | 517 | |
| 518 | − struct mutex stats64_lock; | |
| 518 | + spinlock_t stats64_lock; | |
| 519 | 519 | struct rtnl_link_stats64 stats64; |
| 520 | 520 | |
| 521 | 521 | /* structs defined in e1000_hw.h */ |
| @@ -2295,7 +2295,7 @@ static void igb_get_ethtool_stats(struct net_device *netdev, · 2294 unmodified lines | ||
| 2295 | 2295 | int i, j; |
| 2296 | 2296 | char *p; |
| 2297 | 2297 | |
| 2298 | − mutex_lock(&adapter->stats64_lock); | |
| 2298 | + spin_lock(&adapter->stats64_lock); | |
| 2299 | 2299 | igb_update_stats(adapter); |
| 2300 | 2300 | |
| 2301 | 2301 | for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) { |
| @@ -2338,7 +2338,7 @@ static void igb_get_ethtool_stats(struct net_device *netdev, · 36 unmodified lines | ||
| 2338 | 2338 | } while (u64_stats_fetch_retry_irq(&ring->rx_syncp, start)); |
| 2339 | 2339 | i += IGB_RX_QUEUE_STATS_LEN; |
| 2340 | 2340 | } |
| 2341 | − mutex_unlock(&adapter->stats64_lock); | |
| 2341 | + spin_unlock(&adapter->stats64_lock); | |
| 2342 | 2342 | } |
| 2343 | 2343 | |
| 2344 | 2344 | static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) |
| @@ -2203,9 +2203,9 @@ void igb_down(struct igb_adapter *adapter) · 2202 unmodified lines | ||
| 2203 | 2203 | del_timer_sync(&adapter->phy_info_timer); |
| 2204 | 2204 | |
| 2205 | 2205 | /* record the stats before reset*/ |
| 2206 | − mutex_lock(&adapter->stats64_lock); | |
| 2206 | + spin_lock(&adapter->stats64_lock); | |
| 2207 | 2207 | igb_update_stats(adapter); |
| 2208 | − mutex_unlock(&adapter->stats64_lock); | |
| 2208 | + spin_unlock(&adapter->stats64_lock); | |
| 2209 | 2209 | |
| 2210 | 2210 | adapter->link_speed = 0; |
| 2211 | 2211 | adapter->link_duplex = 0; |
| @@ -3840,7 +3840,7 @@ static int igb_sw_init(struct igb_adapter *adapter) · 1628 unmodified lines | ||
| 3840 | 3840 | adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; |
| 3841 | 3841 | |
| 3842 | 3842 | spin_lock_init(&adapter->nfc_lock); |
| 3843 | − mutex_init(&adapter->stats64_lock); | |
| 3843 | + spin_lock_init(&adapter->stats64_lock); | |
| 3844 | 3844 | #ifdef CONFIG_PCI_IOV |
| 3845 | 3845 | switch (hw->mac.type) { |
| 3846 | 3846 | case e1000_82576: |
| @@ -5406,9 +5406,9 @@ no_wait: · 1559 unmodified lines | ||
| 5406 | 5406 | } |
| 5407 | 5407 | } |
| 5408 | 5408 | |
| 5409 | − mutex_lock(&adapter->stats64_lock); | |
| 5409 | + spin_lock(&adapter->stats64_lock); | |
| 5410 | 5410 | igb_update_stats(adapter); |
| 5411 | − mutex_unlock(&adapter->stats64_lock); | |
| 5411 | + spin_unlock(&adapter->stats64_lock); | |
| 5412 | 5412 | |
| 5413 | 5413 | for (i = 0; i < adapter->num_tx_queues; i++) { |
| 5414 | 5414 | struct igb_ring *tx_ring = adapter->tx_ring[i]; |
| @@ -6235,10 +6235,10 @@ static void igb_get_stats64(struct net_device *netdev, · 820 unmodified lines | ||
| 6235 | 6235 | { |
| 6236 | 6236 | struct igb_adapter *adapter = netdev_priv(netdev); |
| 6237 | 6237 | |
| 6238 | − mutex_lock(&adapter->stats64_lock); | |
| 6238 | + spin_lock(&adapter->stats64_lock); | |
| 6239 | 6239 | igb_update_stats(adapter); |
| 6240 | 6240 | memcpy(stats, &adapter->stats64, sizeof(*stats)); |
| 6241 | − mutex_unlock(&adapter->stats64_lock); | |
| 6241 | + spin_unlock(&adapter->stats64_lock); | |
| 6242 | 6242 | } |
| 6243 | 6243 | |
| 6244 | 6244 | /** |
| @@ -825,7 +825,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 824 unmodified lines | ||
| 825 | 825 | if (!cgx->cgx_cmd_workq) { |
| 826 | 826 | dev_err(dev, "alloc workqueue failed for cgx cmd"); |
| 827 | 827 | err = -ENOMEM; |
| 828 | − goto err_release_regions; | |
| 828 | + goto err_free_irq_vectors; | |
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | list_add(&cgx->cgx_list, &cgx_list); |
| @@ -841,6 +841,8 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 9 unmodified lines | ||
| 841 | 841 | err_release_lmac: |
| 842 | 842 | cgx_lmac_exit(cgx); |
| 843 | 843 | list_del(&cgx->cgx_list); |
| 844 | +err_free_irq_vectors: | |
| 845 | + pci_free_irq_vectors(pdev); | |
| 844 | 846 | err_release_regions: |
| 845 | 847 | pci_release_regions(pdev); |
| 846 | 848 | err_disable_device: |
| @@ -258,11 +258,6 @@ static void mtk_phy_link_adjust(struct net_device *dev) · 257 unmodified lines | ||
| 258 | 258 | |
| 259 | 259 | mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); |
| 260 | 260 | |
| 261 | − if (dev->phydev->link) | |
| 262 | − netif_carrier_on(dev); | |
| 263 | − else | |
| 264 | − netif_carrier_off(dev); | |
| 265 | − | |
| 266 | 261 | if (!of_phy_is_fixed_link(mac->of_node)) |
| 267 | 262 | phy_print_status(dev->phydev); |
| 268 | 263 | } |
| @@ -347,17 +342,6 @@ static int mtk_phy_connect(struct net_device *dev) · 78 unmodified lines | ||
| 347 | 342 | if (mtk_phy_connect_node(eth, mac, np)) |
| 348 | 343 | goto err_phy; |
| 349 | 344 | |
| 350 | − dev->phydev->autoneg = AUTONEG_ENABLE; | |
| 351 | − dev->phydev->speed = 0; | |
| 352 | − dev->phydev->duplex = 0; | |
| 353 | − | |
| 354 | − phy_set_max_speed(dev->phydev, SPEED_1000); | |
| 355 | − phy_support_asym_pause(dev->phydev); | |
| 356 | − linkmode_copy(dev->phydev->advertising, dev->phydev->supported); | |
| 357 | − linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, | |
| 358 | − dev->phydev->advertising); | |
| 359 | − phy_start_aneg(dev->phydev); | |
| 360 | − | |
| 361 | 345 | of_node_put(np); |
| 362 | 346 | |
| 363 | 347 | return 0; |
| @@ -306,14 +306,16 @@ static int mlx4_init_user_cqes(void *buf, int entries, int cqe_size) · 305 unmodified lines | ||
| 306 | 306 | |
| 307 | 307 | if (entries_per_copy < entries) { |
| 308 | 308 | for (i = 0; i < entries / entries_per_copy; i++) { |
| 309 | − err = copy_to_user(buf, init_ents, PAGE_SIZE); | |
| 309 | + err = copy_to_user((void __user *)buf, init_ents, PAGE_SIZE) ? | |
| 310 | + -EFAULT : 0; | |
| 310 | 311 | if (err) |
| 311 | 312 | goto out; |
| 312 | 313 | |
| 313 | 314 | buf += PAGE_SIZE; |
| 314 | 315 | } |
| 315 | 316 | } else { |
| 316 | − err = copy_to_user(buf, init_ents, entries * cqe_size); | |
| 317 | + err = copy_to_user((void __user *)buf, init_ents, entries * cqe_size) ? | |
| 318 | + -EFAULT : 0; | |
| 317 | 319 | } |
| 318 | 320 | |
| 319 | 321 | out: |
| @@ -2067,9 +2067,11 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, · 2066 unmodified lines | ||
| 2067 | 2067 | { |
| 2068 | 2068 | struct mlx4_cmd_mailbox *mailbox; |
| 2069 | 2069 | __be32 *outbox; |
| 2070 | + u64 qword_field; | |
| 2070 | 2071 | u32 dword_field; |
| 2071 | − int err; | |
| 2072 | + u16 word_field; | |
| 2072 | 2073 | u8 byte_field; |
| 2074 | + int err; | |
| 2073 | 2075 | static const u8 a0_dmfs_query_hw_steering[] = { |
| 2074 | 2076 | [0] = MLX4_STEERING_DMFS_A0_DEFAULT, |
| 2075 | 2077 | [1] = MLX4_STEERING_DMFS_A0_DYNAMIC, |
| @@ -2097,19 +2099,32 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, · 21 unmodified lines | ||
| 2097 | 2099 | |
| 2098 | 2100 | /* QPC/EEC/CQC/EQC/RDMARC attributes */ |
| 2099 | 2101 | |
| 2100 | − MLX4_GET(param->qpc_base, outbox, INIT_HCA_QPC_BASE_OFFSET); | |
| 2101 | − MLX4_GET(param->log_num_qps, outbox, INIT_HCA_LOG_QP_OFFSET); | |
| 2102 | − MLX4_GET(param->srqc_base, outbox, INIT_HCA_SRQC_BASE_OFFSET); | |
| 2103 | − MLX4_GET(param->log_num_srqs, outbox, INIT_HCA_LOG_SRQ_OFFSET); | |
| 2104 | − MLX4_GET(param->cqc_base, outbox, INIT_HCA_CQC_BASE_OFFSET); | |
| 2105 | − MLX4_GET(param->log_num_cqs, outbox, INIT_HCA_LOG_CQ_OFFSET); | |
| 2106 | − MLX4_GET(param->altc_base, outbox, INIT_HCA_ALTC_BASE_OFFSET); | |
| 2107 | − MLX4_GET(param->auxc_base, outbox, INIT_HCA_AUXC_BASE_OFFSET); | |
| 2108 | − MLX4_GET(param->eqc_base, outbox, INIT_HCA_EQC_BASE_OFFSET); | |
| 2109 | − MLX4_GET(param->log_num_eqs, outbox, INIT_HCA_LOG_EQ_OFFSET); | |
| 2110 | − MLX4_GET(param->num_sys_eqs, outbox, INIT_HCA_NUM_SYS_EQS_OFFSET); | |
| 2111 | − MLX4_GET(param->rdmarc_base, outbox, INIT_HCA_RDMARC_BASE_OFFSET); | |
| 2112 | − MLX4_GET(param->log_rd_per_qp, outbox, INIT_HCA_LOG_RD_OFFSET); | |
| 2102 | + MLX4_GET(qword_field, outbox, INIT_HCA_QPC_BASE_OFFSET); | |
| 2103 | + param->qpc_base = qword_field & ~((u64)0x1f); | |
| 2104 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_QP_OFFSET); | |
| 2105 | + param->log_num_qps = byte_field & 0x1f; | |
| 2106 | + MLX4_GET(qword_field, outbox, INIT_HCA_SRQC_BASE_OFFSET); | |
| 2107 | + param->srqc_base = qword_field & ~((u64)0x1f); | |
| 2108 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_SRQ_OFFSET); | |
| 2109 | + param->log_num_srqs = byte_field & 0x1f; | |
| 2110 | + MLX4_GET(qword_field, outbox, INIT_HCA_CQC_BASE_OFFSET); | |
| 2111 | + param->cqc_base = qword_field & ~((u64)0x1f); | |
| 2112 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_CQ_OFFSET); | |
| 2113 | + param->log_num_cqs = byte_field & 0x1f; | |
| 2114 | + MLX4_GET(qword_field, outbox, INIT_HCA_ALTC_BASE_OFFSET); | |
| 2115 | + param->altc_base = qword_field; | |
| 2116 | + MLX4_GET(qword_field, outbox, INIT_HCA_AUXC_BASE_OFFSET); | |
| 2117 | + param->auxc_base = qword_field; | |
| 2118 | + MLX4_GET(qword_field, outbox, INIT_HCA_EQC_BASE_OFFSET); | |
| 2119 | + param->eqc_base = qword_field & ~((u64)0x1f); | |
| 2120 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_EQ_OFFSET); | |
| 2121 | + param->log_num_eqs = byte_field & 0x1f; | |
| 2122 | + MLX4_GET(word_field, outbox, INIT_HCA_NUM_SYS_EQS_OFFSET); | |
| 2123 | + param->num_sys_eqs = word_field & 0xfff; | |
| 2124 | + MLX4_GET(qword_field, outbox, INIT_HCA_RDMARC_BASE_OFFSET); | |
| 2125 | + param->rdmarc_base = qword_field & ~((u64)0x1f); | |
| 2126 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_RD_OFFSET); | |
| 2127 | + param->log_rd_per_qp = byte_field & 0x7; | |
| 2113 | 2128 | |
| 2114 | 2129 | MLX4_GET(dword_field, outbox, INIT_HCA_FLAGS_OFFSET); |
| 2115 | 2130 | if (dword_field & (1 << INIT_HCA_DEVICE_MANAGED_FLOW_STEERING_EN)) { |
| @@ -2128,22 +2143,21 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, · 12 unmodified lines | ||
| 2128 | 2143 | /* steering attributes */ |
| 2129 | 2144 | if (param->steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED) { |
| 2130 | 2145 | MLX4_GET(param->mc_base, outbox, INIT_HCA_FS_BASE_OFFSET); |
| 2131 | − MLX4_GET(param->log_mc_entry_sz, outbox, | |
| 2132 | − INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET); | |
| 2133 | − MLX4_GET(param->log_mc_table_sz, outbox, | |
| 2134 | − INIT_HCA_FS_LOG_TABLE_SZ_OFFSET); | |
| 2135 | − MLX4_GET(byte_field, outbox, | |
| 2136 | − INIT_HCA_FS_A0_OFFSET); | |
| 2146 | + MLX4_GET(byte_field, outbox, INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET); | |
| 2147 | + param->log_mc_entry_sz = byte_field & 0x1f; | |
| 2148 | + MLX4_GET(byte_field, outbox, INIT_HCA_FS_LOG_TABLE_SZ_OFFSET); | |
| 2149 | + param->log_mc_table_sz = byte_field & 0x1f; | |
| 2150 | + MLX4_GET(byte_field, outbox, INIT_HCA_FS_A0_OFFSET); | |
| 2137 | 2151 | param->dmfs_high_steer_mode = |
| 2138 | 2152 | a0_dmfs_query_hw_steering[(byte_field >> 6) & 3]; |
| 2139 | 2153 | } else { |
| 2140 | 2154 | MLX4_GET(param->mc_base, outbox, INIT_HCA_MC_BASE_OFFSET); |
| 2141 | − MLX4_GET(param->log_mc_entry_sz, outbox, | |
| 2142 | − INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET); | |
| 2143 | − MLX4_GET(param->log_mc_hash_sz, outbox, | |
| 2144 | − INIT_HCA_LOG_MC_HASH_SZ_OFFSET); | |
| 2145 | − MLX4_GET(param->log_mc_table_sz, outbox, | |
| 2146 | − INIT_HCA_LOG_MC_TABLE_SZ_OFFSET); | |
| 2155 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_MC_ENTRY_SZ_OFFSET); | |
| 2156 | + param->log_mc_entry_sz = byte_field & 0x1f; | |
| 2157 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_MC_HASH_SZ_OFFSET); | |
| 2158 | + param->log_mc_hash_sz = byte_field & 0x1f; | |
| 2159 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_MC_TABLE_SZ_OFFSET); | |
| 2160 | + param->log_mc_table_sz = byte_field & 0x1f; | |
| 2147 | 2161 | } |
| 2148 | 2162 | |
| 2149 | 2163 | /* CX3 is capable of extending CQEs/EQEs from 32 to 64 bytes */ |
| @@ -2167,15 +2181,18 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, · 17 unmodified lines | ||
| 2167 | 2181 | /* TPT attributes */ |
| 2168 | 2182 | |
| 2169 | 2183 | MLX4_GET(param->dmpt_base, outbox, INIT_HCA_DMPT_BASE_OFFSET); |
| 2170 | − MLX4_GET(param->mw_enabled, outbox, INIT_HCA_TPT_MW_OFFSET); | |
| 2171 | − MLX4_GET(param->log_mpt_sz, outbox, INIT_HCA_LOG_MPT_SZ_OFFSET); | |
| 2184 | + MLX4_GET(byte_field, outbox, INIT_HCA_TPT_MW_OFFSET); | |
| 2185 | + param->mw_enabled = byte_field >> 7; | |
| 2186 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_MPT_SZ_OFFSET); | |
| 2187 | + param->log_mpt_sz = byte_field & 0x3f; | |
| 2172 | 2188 | MLX4_GET(param->mtt_base, outbox, INIT_HCA_MTT_BASE_OFFSET); |
| 2173 | 2189 | MLX4_GET(param->cmpt_base, outbox, INIT_HCA_CMPT_BASE_OFFSET); |
| 2174 | 2190 | |
| 2175 | 2191 | /* UAR attributes */ |
| 2176 | 2192 | |
| 2177 | 2193 | MLX4_GET(param->uar_page_sz, outbox, INIT_HCA_UAR_PAGE_SZ_OFFSET); |
| 2178 | − MLX4_GET(param->log_uar_sz, outbox, INIT_HCA_LOG_UAR_SZ_OFFSET); | |
| 2194 | + MLX4_GET(byte_field, outbox, INIT_HCA_LOG_UAR_SZ_OFFSET); | |
| 2195 | + param->log_uar_sz = byte_field & 0xf; | |
| 2179 | 2196 | |
| 2180 | 2197 | /* phv_check enable */ |
| 2181 | 2198 | MLX4_GET(byte_field, outbox, INIT_HCA_CACHELINE_SZ_OFFSET); |
| @@ -57,12 +57,12 @@ static void mlx4_free_icm_pages(struct mlx4_dev *dev, struct mlx4_icm_chunk *chu · 56 unmodified lines | ||
| 57 | 57 | int i; |
| 58 | 58 | |
| 59 | 59 | if (chunk->nsg > 0) |
| 60 | − pci_unmap_sg(dev->persist->pdev, chunk->mem, chunk->npages, | |
| 61 | − PCI_DMA_BIDIRECTIONAL); | |
| 60 | + dma_unmap_sg(&dev->persist->pdev->dev, chunk->sg, chunk->npages, | |
| 61 | + DMA_BIDIRECTIONAL); | |
| 62 | 62 | |
| 63 | 63 | for (i = 0; i < chunk->npages; ++i) |
| 64 | − __free_pages(sg_page(&chunk->mem[i]), | |
| 65 | − get_order(chunk->mem[i].length)); | |
| 64 | + __free_pages(sg_page(&chunk->sg[i]), | |
| 65 | + get_order(chunk->sg[i].length)); | |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | static void mlx4_free_icm_coherent(struct mlx4_dev *dev, struct mlx4_icm_chunk *chunk) |
| @@ -71,9 +71,9 @@ static void mlx4_free_icm_coherent(struct mlx4_dev *dev, struct mlx4_icm_chunk * · 2 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | for (i = 0; i < chunk->npages; ++i) |
| 73 | 73 | dma_free_coherent(&dev->persist->pdev->dev, |
| 74 | − chunk->mem[i].length, | |
| 75 | − lowmem_page_address(sg_page(&chunk->mem[i])), | |
| 76 | − sg_dma_address(&chunk->mem[i])); | |
| 74 | + chunk->buf[i].size, | |
| 75 | + chunk->buf[i].addr, | |
| 76 | + chunk->buf[i].dma_addr); | |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | void mlx4_free_icm(struct mlx4_dev *dev, struct mlx4_icm *icm, int coherent) |
| @@ -111,22 +111,21 @@ static int mlx4_alloc_icm_pages(struct scatterlist *mem, int order, · 31 unmodified lines | ||
| 111 | 111 | return 0; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | −static int mlx4_alloc_icm_coherent(struct device *dev, struct scatterlist *mem, | |
| 115 | − int order, gfp_t gfp_mask) | |
| 114 | +static int mlx4_alloc_icm_coherent(struct device *dev, struct mlx4_icm_buf *buf, | |
| 115 | + int order, gfp_t gfp_mask) | |
| 116 | 116 | { |
| 117 | − void *buf = dma_alloc_coherent(dev, PAGE_SIZE << order, | |
| 118 | − &sg_dma_address(mem), gfp_mask); | |
| 119 | − if (!buf) | |
| 117 | + buf->addr = dma_alloc_coherent(dev, PAGE_SIZE << order, | |
| 118 | + &buf->dma_addr, gfp_mask); | |
| 119 | + if (!buf->addr) | |
| 120 | 120 | return -ENOMEM; |
| 121 | 121 | |
| 122 | − if (offset_in_page(buf)) { | |
| 123 | − dma_free_coherent(dev, PAGE_SIZE << order, | |
| 124 | − buf, sg_dma_address(mem)); | |
| 122 | + if (offset_in_page(buf->addr)) { | |
| 123 | + dma_free_coherent(dev, PAGE_SIZE << order, buf->addr, | |
| 124 | + buf->dma_addr); | |
| 125 | 125 | return -ENOMEM; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | − sg_set_buf(mem, buf, PAGE_SIZE << order); | |
| 129 | − sg_dma_len(mem) = PAGE_SIZE << order; | |
| 128 | + buf->size = PAGE_SIZE << order; | |
| 130 | 129 | return 0; |
| 131 | 130 | } |
| 132 | 131 | |
| @@ -159,21 +158,21 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, · 26 unmodified lines | ||
| 159 | 158 | |
| 160 | 159 | while (npages > 0) { |
| 161 | 160 | if (!chunk) { |
| 162 | − chunk = kmalloc_node(sizeof(*chunk), | |
| 161 | + chunk = kzalloc_node(sizeof(*chunk), | |
| 163 | 162 | gfp_mask & ~(__GFP_HIGHMEM | |
| 164 | 163 | __GFP_NOWARN), |
| 165 | 164 | dev->numa_node); |
| 166 | 165 | if (!chunk) { |
| 167 | − chunk = kmalloc(sizeof(*chunk), | |
| 166 | + chunk = kzalloc(sizeof(*chunk), | |
| 168 | 167 | gfp_mask & ~(__GFP_HIGHMEM | |
| 169 | 168 | __GFP_NOWARN)); |
| 170 | 169 | if (!chunk) |
| 171 | 170 | goto fail; |
| 172 | 171 | } |
| 172 | + chunk->coherent = coherent; | |
| 173 | 173 | |
| 174 | − sg_init_table(chunk->mem, MLX4_ICM_CHUNK_LEN); | |
| 175 | − chunk->npages = 0; | |
| 176 | − chunk->nsg = 0; | |
| 174 | + if (!coherent) | |
| 175 | + sg_init_table(chunk->sg, MLX4_ICM_CHUNK_LEN); | |
| 177 | 176 | list_add_tail(&chunk->list, &icm->chunk_list); |
| 178 | 177 | } |
| 179 | 178 | |
| @@ -186,10 +185,10 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, · 6 unmodified lines | ||
| 186 | 185 | |
| 187 | 186 | if (coherent) |
| 188 | 187 | ret = mlx4_alloc_icm_coherent(&dev->persist->pdev->dev, |
| 189 | − &chunk->mem[chunk->npages], | |
| 190 | − cur_order, mask); | |
| 188 | + &chunk->buf[chunk->npages], | |
| 189 | + cur_order, mask); | |
| 191 | 190 | else |
| 192 | − ret = mlx4_alloc_icm_pages(&chunk->mem[chunk->npages], | |
| 191 | + ret = mlx4_alloc_icm_pages(&chunk->sg[chunk->npages], | |
| 193 | 192 | cur_order, mask, |
| 194 | 193 | dev->numa_node); |
| 195 | 194 | |
| @@ -205,9 +204,9 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, · 9 unmodified lines | ||
| 205 | 204 | if (coherent) |
| 206 | 205 | ++chunk->nsg; |
| 207 | 206 | else if (chunk->npages == MLX4_ICM_CHUNK_LEN) { |
| 208 | − chunk->nsg = pci_map_sg(dev->persist->pdev, chunk->mem, | |
| 209 | − chunk->npages, | |
| 210 | − PCI_DMA_BIDIRECTIONAL); | |
| 207 | + chunk->nsg = dma_map_sg(&dev->persist->pdev->dev, | |
| 208 | + chunk->sg, chunk->npages, | |
| 209 | + DMA_BIDIRECTIONAL); | |
| 211 | 210 | |
| 212 | 211 | if (chunk->nsg <= 0) |
| 213 | 212 | goto fail; |
| @@ -220,9 +219,8 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, · 6 unmodified lines | ||
| 220 | 219 | } |
| 221 | 220 | |
| 222 | 221 | if (!coherent && chunk) { |
| 223 | − chunk->nsg = pci_map_sg(dev->persist->pdev, chunk->mem, | |
| 224 | − chunk->npages, | |
| 225 | − PCI_DMA_BIDIRECTIONAL); | |
| 222 | + chunk->nsg = dma_map_sg(&dev->persist->pdev->dev, chunk->sg, | |
| 223 | + chunk->npages, DMA_BIDIRECTIONAL); | |
| 226 | 224 | |
| 227 | 225 | if (chunk->nsg <= 0) |
| 228 | 226 | goto fail; |
| @@ -320,7 +318,7 @@ void *mlx4_table_find(struct mlx4_icm_table *table, u32 obj, · 91 unmodified lines | ||
| 320 | 318 | u64 idx; |
| 321 | 319 | struct mlx4_icm_chunk *chunk; |
| 322 | 320 | struct mlx4_icm *icm; |
| 323 | − struct page *page = NULL; | |
| 321 | + void *addr = NULL; | |
| 324 | 322 | |
| 325 | 323 | if (!table->lowmem) |
| 326 | 324 | return NULL; |
| @@ -336,28 +334,49 @@ void *mlx4_table_find(struct mlx4_icm_table *table, u32 obj, · 9 unmodified lines | ||
| 336 | 334 | |
| 337 | 335 | list_for_each_entry(chunk, &icm->chunk_list, list) { |
| 338 | 336 | for (i = 0; i < chunk->npages; ++i) { |
| 337 | + dma_addr_t dma_addr; | |
| 338 | + size_t len; | |
| 339 | + | |
| 340 | + if (table->coherent) { | |
| 341 | + len = chunk->buf[i].size; | |
| 342 | + dma_addr = chunk->buf[i].dma_addr; | |
| 343 | + addr = chunk->buf[i].addr; | |
| 344 | + } else { | |
| 345 | + struct page *page; | |
| 346 | + | |
| 347 | + len = sg_dma_len(&chunk->sg[i]); | |
| 348 | + dma_addr = sg_dma_address(&chunk->sg[i]); | |
| 349 | + | |
| 350 | + /* XXX: we should never do this for highmem | |
| 351 | + * allocation. This function either needs | |
| 352 | + * to be split, or the kernel virtual address | |
| 353 | + * return needs to be made optional. | |
| 354 | + */ | |
| 355 | + page = sg_page(&chunk->sg[i]); | |
| 356 | + addr = lowmem_page_address(page); | |
| 357 | + } | |
| 358 | + | |
| 339 | 359 | if (dma_handle && dma_offset >= 0) { |
| 340 | − if (sg_dma_len(&chunk->mem[i]) > dma_offset) | |
| 341 | − *dma_handle = sg_dma_address(&chunk->mem[i]) + | |
| 342 | − dma_offset; | |
| 343 | − dma_offset -= sg_dma_len(&chunk->mem[i]); | |
| 360 | + if (len > dma_offset) | |
| 361 | + *dma_handle = dma_addr + dma_offset; | |
| 362 | + dma_offset -= len; | |
| 344 | 363 | } |
| 364 | + | |
| 345 | 365 | /* |
| 346 | 366 | * DMA mapping can merge pages but not split them, |
| 347 | 367 | * so if we found the page, dma_handle has already |
| 348 | 368 | * been assigned to. |
| 349 | 369 | */ |
| 350 | − if (chunk->mem[i].length > offset) { | |
| 351 | − page = sg_page(&chunk->mem[i]); | |
| 370 | + if (len > offset) | |
| 352 | 371 | goto out; |
| 353 | − } | |
| 354 | − offset -= chunk->mem[i].length; | |
| 372 | + offset -= len; | |
| 355 | 373 | } |
| 356 | 374 | } |
| 357 | 375 | |
| 376 | + addr = NULL; | |
| 358 | 377 | out: |
| 359 | 378 | mutex_unlock(&table->mutex); |
| 360 | − return page ? lowmem_page_address(page) + offset : NULL; | |
| 379 | + return addr ? addr + offset : NULL; | |
| 361 | 380 | } |
| 362 | 381 | |
| 363 | 382 | int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, |
| @@ -47,11 +47,21 @@ enum { · 46 unmodified lines | ||
| 47 | 47 | MLX4_ICM_PAGE_SIZE = 1 << MLX4_ICM_PAGE_SHIFT, |
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | +struct mlx4_icm_buf { | |
| 51 | + void *addr; | |
| 52 | + size_t size; | |
| 53 | + dma_addr_t dma_addr; | |
| 54 | +}; | |
| 55 | + | |
| 50 | 56 | struct mlx4_icm_chunk { |
| 51 | 57 | struct list_head list; |
| 52 | 58 | int npages; |
| 53 | 59 | int nsg; |
| 54 | − struct scatterlist mem[MLX4_ICM_CHUNK_LEN]; | |
| 60 | + bool coherent; | |
| 61 | + union { | |
| 62 | + struct scatterlist sg[MLX4_ICM_CHUNK_LEN]; | |
| 63 | + struct mlx4_icm_buf buf[MLX4_ICM_CHUNK_LEN]; | |
| 64 | + }; | |
| 55 | 65 | }; |
| 56 | 66 | |
| 57 | 67 | struct mlx4_icm { |
| @@ -114,12 +124,18 @@ static inline void mlx4_icm_next(struct mlx4_icm_iter *iter) · 56 unmodified lines | ||
| 114 | 124 | |
| 115 | 125 | static inline dma_addr_t mlx4_icm_addr(struct mlx4_icm_iter *iter) |
| 116 | 126 | { |
| 117 | − return sg_dma_address(&iter->chunk->mem[iter->page_idx]); | |
| 127 | + if (iter->chunk->coherent) | |
| 128 | + return iter->chunk->buf[iter->page_idx].dma_addr; | |
| 129 | + else | |
| 130 | + return sg_dma_address(&iter->chunk->sg[iter->page_idx]); | |
| 118 | 131 | } |
| 119 | 132 | |
| 120 | 133 | static inline unsigned long mlx4_icm_size(struct mlx4_icm_iter *iter) |
| 121 | 134 | { |
| 122 | − return sg_dma_len(&iter->chunk->mem[iter->page_idx]); | |
| 135 | + if (iter->chunk->coherent) | |
| 136 | + return iter->chunk->buf[iter->page_idx].size; | |
| 137 | + else | |
| 138 | + return sg_dma_len(&iter->chunk->sg[iter->page_idx]); | |
| 123 | 139 | } |
| 124 | 140 | |
| 125 | 141 | int mlx4_MAP_ICM_AUX(struct mlx4_dev *dev, struct mlx4_icm *icm); |
| @@ -844,9 +844,12 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, · 843 unmodified lines | ||
| 844 | 844 | ethtool_link_ksettings_add_link_mode(link_ksettings, supported, |
| 845 | 845 | Autoneg); |
| 846 | 846 | |
| 847 | − if (get_fec_supported_advertised(mdev, link_ksettings)) | |
| 847 | + err = get_fec_supported_advertised(mdev, link_ksettings); | |
| 848 | + if (err) { | |
| 848 | 849 | netdev_dbg(priv->netdev, "%s: FEC caps query failed: %d\n", |
| 849 | 850 | __func__, err); |
| 851 | + err = 0; /* don't fail caps query because of FEC error */ | |
| 852 | + } | |
| 850 | 853 | |
| 851 | 854 | if (!an_disable_admin) |
| 852 | 855 | ethtool_link_ksettings_add_link_mode(link_ksettings, |
| @@ -950,7 +950,7 @@ static int mlx5e_open_rq(struct mlx5e_channel *c, · 949 unmodified lines | ||
| 950 | 950 | if (params->rx_dim_enabled) |
| 951 | 951 | __set_bit(MLX5E_RQ_STATE_AM, &c->rq.state); |
| 952 | 952 | |
| 953 | − if (params->pflags & MLX5E_PFLAG_RX_NO_CSUM_COMPLETE) | |
| 953 | + if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_NO_CSUM_COMPLETE)) | |
| 954 | 954 | __set_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &c->rq.state); |
| 955 | 955 | |
| 956 | 956 | return 0; |
| @@ -58,7 +58,8 @@ struct mlx5e_rep_indr_block_priv { · 57 unmodified lines | ||
| 58 | 58 | struct list_head list; |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | −static void mlx5e_rep_indr_unregister_block(struct net_device *netdev); | |
| 61 | +static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv, | |
| 62 | + struct net_device *netdev); | |
| 62 | 63 | |
| 63 | 64 | static void mlx5e_rep_get_drvinfo(struct net_device *dev, |
| 64 | 65 | struct ethtool_drvinfo *drvinfo) |
| @@ -179,6 +180,7 @@ static void mlx5e_rep_update_sw_counters(struct mlx5e_priv *priv) · 114 unmodified lines | ||
| 179 | 180 | |
| 180 | 181 | s->tx_packets += sq_stats->packets; |
| 181 | 182 | s->tx_bytes += sq_stats->bytes; |
| 183 | + s->tx_queue_dropped += sq_stats->dropped; | |
| 182 | 184 | } |
| 183 | 185 | } |
| 184 | 186 | } |
| @@ -663,7 +665,7 @@ static void mlx5e_rep_indr_clean_block_privs(struct mlx5e_rep_priv *rpriv) · 478 unmodified lines | ||
| 663 | 665 | struct list_head *head = &rpriv->uplink_priv.tc_indr_block_priv_list; |
| 664 | 666 | |
| 665 | 667 | list_for_each_entry_safe(cb_priv, temp, head, list) { |
| 666 | − mlx5e_rep_indr_unregister_block(cb_priv->netdev); | |
| 668 | + mlx5e_rep_indr_unregister_block(rpriv, cb_priv->netdev); | |
| 667 | 669 | kfree(cb_priv); |
| 668 | 670 | } |
| 669 | 671 | } |
| @@ -735,7 +737,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev, · 65 unmodified lines | ||
| 735 | 737 | |
| 736 | 738 | err = tcf_block_cb_register(f->block, |
| 737 | 739 | mlx5e_rep_indr_setup_block_cb, |
| 738 | − netdev, indr_priv, f->extack); | |
| 740 | + indr_priv, indr_priv, f->extack); | |
| 739 | 741 | if (err) { |
| 740 | 742 | list_del(&indr_priv->list); |
| 741 | 743 | kfree(indr_priv); |
| @@ -743,14 +745,15 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev, · 1 unmodified line | ||
| 743 | 745 | |
| 744 | 746 | return err; |
| 745 | 747 | case TC_BLOCK_UNBIND: |
| 748 | + indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev); | |
| 749 | + if (!indr_priv) | |
| 750 | + return -ENOENT; | |
| 751 | + | |
| 746 | 752 | tcf_block_cb_unregister(f->block, |
| 747 | 753 | mlx5e_rep_indr_setup_block_cb, |
| 748 | − netdev); | |
| 749 | − indr_priv = mlx5e_rep_indr_block_priv_lookup(rpriv, netdev); | |
| 750 | − if (indr_priv) { | |
| 751 | − list_del(&indr_priv->list); | |
| 752 | − kfree(indr_priv); | |
| 753 | − } | |
| 754 | + indr_priv); | |
| 755 | + list_del(&indr_priv->list); | |
| 756 | + kfree(indr_priv); | |
| 754 | 757 | |
| 755 | 758 | return 0; |
| 756 | 759 | default: |
| @@ -779,7 +782,7 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv, · 22 unmodified lines | ||
| 779 | 782 | |
| 780 | 783 | err = __tc_indr_block_cb_register(netdev, rpriv, |
| 781 | 784 | mlx5e_rep_indr_setup_tc_cb, |
| 782 | − netdev); | |
| 785 | + rpriv); | |
| 783 | 786 | if (err) { |
| 784 | 787 | struct mlx5e_priv *priv = netdev_priv(rpriv->netdev); |
| 785 | 788 | |
| @@ -789,10 +792,11 @@ static int mlx5e_rep_indr_register_block(struct mlx5e_rep_priv *rpriv, · 3 unmodified lines | ||
| 789 | 792 | return err; |
| 790 | 793 | } |
| 791 | 794 | |
| 792 | −static void mlx5e_rep_indr_unregister_block(struct net_device *netdev) | |
| 795 | +static void mlx5e_rep_indr_unregister_block(struct mlx5e_rep_priv *rpriv, | |
| 796 | + struct net_device *netdev) | |
| 793 | 797 | { |
| 794 | 798 | __tc_indr_block_cb_unregister(netdev, mlx5e_rep_indr_setup_tc_cb, |
| 795 | − netdev); | |
| 799 | + rpriv); | |
| 796 | 800 | } |
| 797 | 801 | |
| 798 | 802 | static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, |
| @@ -811,7 +815,7 @@ static int mlx5e_nic_rep_netdevice_event(struct notifier_block *nb, · 12 unmodified lines | ||
| 811 | 815 | mlx5e_rep_indr_register_block(rpriv, netdev); |
| 812 | 816 | break; |
| 813 | 817 | case NETDEV_UNREGISTER: |
| 814 | − mlx5e_rep_indr_unregister_block(netdev); | |
| 818 | + mlx5e_rep_indr_unregister_block(rpriv, netdev); | |
| 815 | 819 | break; |
| 816 | 820 | } |
| 817 | 821 | return NOTIFY_OK; |
| @@ -1122,9 +1126,17 @@ static int mlx5e_rep_get_phys_port_name(struct net_device *dev, · 304 unmodified lines | ||
| 1122 | 1126 | struct mlx5e_priv *priv = netdev_priv(dev); |
| 1123 | 1127 | struct mlx5e_rep_priv *rpriv = priv->ppriv; |
| 1124 | 1128 | struct mlx5_eswitch_rep *rep = rpriv->rep; |
| 1125 | − int ret; | |
| 1129 | + int ret, pf_num; | |
| 1130 | + | |
| 1131 | + ret = mlx5_lag_get_pf_num(priv->mdev, &pf_num); | |
| 1132 | + if (ret) | |
| 1133 | + return ret; | |
| 1134 | + | |
| 1135 | + if (rep->vport == FDB_UPLINK_VPORT) | |
| 1136 | + ret = snprintf(buf, len, "p%d", pf_num); | |
| 1137 | + else | |
| 1138 | + ret = snprintf(buf, len, "pf%dvf%d", pf_num, rep->vport - 1); | |
| 1126 | 1139 | |
| 1127 | − ret = snprintf(buf, len, "%d", rep->vport - 1); | |
| 1128 | 1140 | if (ret >= len) |
| 1129 | 1141 | return -EOPNOTSUPP; |
| 1130 | 1142 | |
| @@ -1281,6 +1293,18 @@ static int mlx5e_uplink_rep_set_mac(struct net_device *netdev, void *addr) · 150 unmodified lines | ||
| 1281 | 1293 | return 0; |
| 1282 | 1294 | } |
| 1283 | 1295 | |
| 1296 | +static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlan, u8 qos, | |
| 1297 | + __be16 vlan_proto) | |
| 1298 | +{ | |
| 1299 | + netdev_warn_once(dev, "legacy vf vlan setting isn't supported in switchdev mode\n"); | |
| 1300 | + | |
| 1301 | + if (vlan != 0) | |
| 1302 | + return -EOPNOTSUPP; | |
| 1303 | + | |
| 1304 | + /* allow setting 0-vid for compatibility with libvirt */ | |
| 1305 | + return 0; | |
| 1306 | +} | |
| 1307 | + | |
| 1284 | 1308 | static const struct switchdev_ops mlx5e_rep_switchdev_ops = { |
| 1285 | 1309 | .switchdev_port_attr_get = mlx5e_attr_get, |
| 1286 | 1310 | }; |
| @@ -1315,6 +1339,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { · 28 unmodified lines | ||
| 1315 | 1339 | .ndo_set_vf_rate = mlx5e_set_vf_rate, |
| 1316 | 1340 | .ndo_get_vf_config = mlx5e_get_vf_config, |
| 1317 | 1341 | .ndo_get_vf_stats = mlx5e_get_vf_stats, |
| 1342 | + .ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan, | |
| 1318 | 1343 | }; |
| 1319 | 1344 | |
| 1320 | 1345 | bool mlx5e_eswitch_rep(struct net_device *netdev) |
| @@ -732,6 +732,8 @@ static u8 get_ip_proto(struct sk_buff *skb, int network_depth, __be16 proto) · 731 unmodified lines | ||
| 732 | 732 | ((struct ipv6hdr *)ip_p)->nexthdr; |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | +#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN) | |
| 736 | + | |
| 735 | 737 | static inline void mlx5e_handle_csum(struct net_device *netdev, |
| 736 | 738 | struct mlx5_cqe64 *cqe, |
| 737 | 739 | struct mlx5e_rq *rq, |
| @@ -754,6 +756,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, · 16 unmodified lines | ||
| 754 | 756 | if (unlikely(test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))) |
| 755 | 757 | goto csum_unnecessary; |
| 756 | 758 | |
| 759 | + /* CQE csum doesn't cover padding octets in short ethernet | |
| 760 | + * frames. And the pad field is appended prior to calculating | |
| 761 | + * and appending the FCS field. | |
| 762 | + * | |
| 763 | + * Detecting these padded frames requires to verify and parse | |
| 764 | + * IP headers, so we simply force all those small frames to be | |
| 765 | + * CHECKSUM_UNNECESSARY even if they are not padded. | |
| 766 | + */ | |
| 767 | + if (short_frame(skb->len)) | |
| 768 | + goto csum_unnecessary; | |
| 769 | + | |
| 757 | 770 | if (likely(is_last_ethertype_ip(skb, &network_depth, &proto))) { |
| 758 | 771 | if (unlikely(get_ip_proto(skb, network_depth, proto) == IPPROTO_SCTP)) |
| 759 | 772 | goto csum_unnecessary; |
| @@ -1134,13 +1134,6 @@ static int esw_vport_ingress_config(struct mlx5_eswitch *esw, · 1133 unmodified lines | ||
| 1134 | 1134 | int err = 0; |
| 1135 | 1135 | u8 *smac_v; |
| 1136 | 1136 | |
| 1137 | − if (vport->info.spoofchk && !is_valid_ether_addr(vport->info.mac)) { | |
| 1138 | − mlx5_core_warn(esw->dev, | |
| 1139 | − "vport[%d] configure ingress rules failed, illegal mac with spoofchk\n", | |
| 1140 | − vport->vport); | |
| 1141 | − return -EPERM; | |
| 1142 | − } | |
| 1143 | − | |
| 1144 | 1137 | esw_vport_cleanup_ingress_rules(esw, vport); |
| 1145 | 1138 | |
| 1146 | 1139 | if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) { |
| @@ -1728,7 +1721,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) · 581 unmodified lines | ||
| 1728 | 1721 | int vport_num; |
| 1729 | 1722 | int err; |
| 1730 | 1723 | |
| 1731 | − if (!MLX5_ESWITCH_MANAGER(dev)) | |
| 1724 | + if (!MLX5_VPORT_MANAGER(dev)) | |
| 1732 | 1725 | return 0; |
| 1733 | 1726 | |
| 1734 | 1727 | esw_info(dev, |
| @@ -1797,7 +1790,7 @@ abort: · 62 unmodified lines | ||
| 1797 | 1790 | |
| 1798 | 1791 | void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) |
| 1799 | 1792 | { |
| 1800 | − if (!esw || !MLX5_ESWITCH_MANAGER(esw->dev)) | |
| 1793 | + if (!esw || !MLX5_VPORT_MANAGER(esw->dev)) | |
| 1801 | 1794 | return; |
| 1802 | 1795 | |
| 1803 | 1796 | esw_info(esw->dev, "cleanup\n"); |
| @@ -1827,13 +1820,10 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw, · 23 unmodified lines | ||
| 1827 | 1820 | mutex_lock(&esw->state_lock); |
| 1828 | 1821 | evport = &esw->vports[vport]; |
| 1829 | 1822 | |
| 1830 | − if (evport->info.spoofchk && !is_valid_ether_addr(mac)) { | |
| 1823 | + if (evport->info.spoofchk && !is_valid_ether_addr(mac)) | |
| 1831 | 1824 | mlx5_core_warn(esw->dev, |
| 1832 | − "MAC invalidation is not allowed when spoofchk is on, vport(%d)\n", | |
| 1825 | + "Set invalid MAC while spoofchk is on, vport(%d)\n", | |
| 1833 | 1826 | vport); |
| 1834 | − err = -EPERM; | |
| 1835 | − goto unlock; | |
| 1836 | − } | |
| 1837 | 1827 | |
| 1838 | 1828 | err = mlx5_modify_nic_vport_mac_address(esw->dev, vport, mac); |
| 1839 | 1829 | if (err) { |
| @@ -1979,6 +1969,10 @@ int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw, · 139 unmodified lines | ||
| 1979 | 1969 | evport = &esw->vports[vport]; |
| 1980 | 1970 | pschk = evport->info.spoofchk; |
| 1981 | 1971 | evport->info.spoofchk = spoofchk; |
| 1972 | + if (pschk && !is_valid_ether_addr(evport->info.mac)) | |
| 1973 | + mlx5_core_warn(esw->dev, | |
| 1974 | + "Spoofchk in set while MAC is invalid, vport(%d)\n", | |
| 1975 | + evport->vport); | |
| 1982 | 1976 | if (evport->enabled && esw->mode == SRIOV_LEGACY) |
| 1983 | 1977 | err = esw_vport_ingress_config(esw, evport); |
| 1984 | 1978 | if (err) |
| @@ -616,6 +616,27 @@ void mlx5_lag_add(struct mlx5_core_dev *dev, struct net_device *netdev) · 615 unmodified lines | ||
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | |
| 619 | +int mlx5_lag_get_pf_num(struct mlx5_core_dev *dev, int *pf_num) | |
| 620 | +{ | |
| 621 | + struct mlx5_lag *ldev; | |
| 622 | + int n; | |
| 623 | + | |
| 624 | + ldev = mlx5_lag_dev_get(dev); | |
| 625 | + if (!ldev) { | |
| 626 | + mlx5_core_warn(dev, "no lag device, can't get pf num\n"); | |
| 627 | + return -EINVAL; | |
| 628 | + } | |
| 629 | + | |
| 630 | + for (n = 0; n < MLX5_MAX_PORTS; n++) | |
| 631 | + if (ldev->pf[n].dev == dev) { | |
| 632 | + *pf_num = n; | |
| 633 | + return 0; | |
| 634 | + } | |
| 635 | + | |
| 636 | + mlx5_core_warn(dev, "wasn't able to locate pf in the lag device\n"); | |
| 637 | + return -EINVAL; | |
| 638 | +} | |
| 639 | + | |
| 619 | 640 | /* Must be called with intf_mutex held */ |
| 620 | 641 | void mlx5_lag_remove(struct mlx5_core_dev *dev) |
| 621 | 642 | { |
| @@ -187,6 +187,8 @@ static inline int mlx5_lag_is_lacp_owner(struct mlx5_core_dev *dev) · 186 unmodified lines | ||
| 187 | 187 | MLX5_CAP_GEN(dev, lag_master); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | +int mlx5_lag_get_pf_num(struct mlx5_core_dev *dev, int *pf_num); | |
| 191 | + | |
| 190 | 192 | void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol); |
| 191 | 193 | void mlx5_lag_update(struct mlx5_core_dev *dev); |
| 192 | 194 | |
| @@ -44,14 +44,15 @@ static struct mlx5_core_rsc_common * · 43 unmodified lines | ||
| 44 | 44 | mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn) |
| 45 | 45 | { |
| 46 | 46 | struct mlx5_core_rsc_common *common; |
| 47 | + unsigned long flags; | |
| 47 | 48 | |
| 48 | − spin_lock(&table->lock); | |
| 49 | + spin_lock_irqsave(&table->lock, flags); | |
| 49 | 50 | |
| 50 | 51 | common = radix_tree_lookup(&table->tree, rsn); |
| 51 | 52 | if (common) |
| 52 | 53 | atomic_inc(&common->refcount); |
| 53 | 54 | |
| 54 | − spin_unlock(&table->lock); | |
| 55 | + spin_unlock_irqrestore(&table->lock, flags); | |
| 55 | 56 | |
| 56 | 57 | return common; |
| 57 | 58 | } |
| @@ -78,6 +78,7 @@ config MLXSW_SPECTRUM · 77 unmodified lines | ||
| 78 | 78 | depends on IPV6 || IPV6=n |
| 79 | 79 | depends on NET_IPGRE || NET_IPGRE=n |
| 80 | 80 | depends on IPV6_GRE || IPV6_GRE=n |
| 81 | + depends on VXLAN || VXLAN=n | |
| 81 | 82 | select GENERIC_ALLOCATOR |
| 82 | 83 | select PARMAN |
| 83 | 84 | select OBJAGG |
| @@ -604,29 +604,31 @@ static void mlxsw_pci_cq_tasklet(unsigned long data) · 603 unmodified lines | ||
| 604 | 604 | u16 wqe_counter = mlxsw_pci_cqe_wqe_counter_get(cqe); |
| 605 | 605 | u8 sendq = mlxsw_pci_cqe_sr_get(q->u.cq.v, cqe); |
| 606 | 606 | u8 dqn = mlxsw_pci_cqe_dqn_get(q->u.cq.v, cqe); |
| 607 | + char ncqe[MLXSW_PCI_CQE_SIZE_MAX]; | |
| 608 | + | |
| 609 | + memcpy(ncqe, cqe, q->elem_size); | |
| 610 | + mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q); | |
| 607 | 611 | |
| 608 | 612 | if (sendq) { |
| 609 | 613 | struct mlxsw_pci_queue *sdq; |
| 610 | 614 | |
| 611 | 615 | sdq = mlxsw_pci_sdq_get(mlxsw_pci, dqn); |
| 612 | 616 | mlxsw_pci_cqe_sdq_handle(mlxsw_pci, sdq, |
| 613 | − wqe_counter, cqe); | |
| 617 | + wqe_counter, ncqe); | |
| 614 | 618 | q->u.cq.comp_sdq_count++; |
| 615 | 619 | } else { |
| 616 | 620 | struct mlxsw_pci_queue *rdq; |
| 617 | 621 | |
| 618 | 622 | rdq = mlxsw_pci_rdq_get(mlxsw_pci, dqn); |
| 619 | 623 | mlxsw_pci_cqe_rdq_handle(mlxsw_pci, rdq, |
| 620 | − wqe_counter, q->u.cq.v, cqe); | |
| 624 | + wqe_counter, q->u.cq.v, ncqe); | |
| 621 | 625 | q->u.cq.comp_rdq_count++; |
| 622 | 626 | } |
| 623 | 627 | if (++items == credits) |
| 624 | 628 | break; |
| 625 | 629 | } |
| 626 | − if (items) { | |
| 627 | − mlxsw_pci_queue_doorbell_consumer_ring(mlxsw_pci, q); | |
| 630 | + if (items) | |
| 628 | 631 | mlxsw_pci_queue_doorbell_arm_consumer_ring(mlxsw_pci, q); |
| 629 | − } | |
| 630 | 632 | } |
| 631 | 633 | |
| 632 | 634 | static u16 mlxsw_pci_cq_elem_count(const struct mlxsw_pci_queue *q) |
| @@ -1365,10 +1367,10 @@ static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci, · 732 unmodified lines | ||
| 1365 | 1367 | u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY); |
| 1366 | 1368 | |
| 1367 | 1369 | if ((val & MLXSW_PCI_FW_READY_MASK) == MLXSW_PCI_FW_READY_MAGIC) |
| 1368 | − break; | |
| 1370 | + return 0; | |
| 1369 | 1371 | cond_resched(); |
| 1370 | 1372 | } while (time_before(jiffies, end)); |
| 1371 | − return 0; | |
| 1373 | + return -EBUSY; | |
| 1372 | 1374 | } |
| 1373 | 1375 | |
| 1374 | 1376 | static int mlxsw_pci_alloc_irq_vectors(struct mlxsw_pci *mlxsw_pci) |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | #define MLXSW_PCI_SW_RESET 0xF0010 |
| 29 | 29 | #define MLXSW_PCI_SW_RESET_RST_BIT BIT(0) |
| 30 | −#define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 5000 | |
| 30 | +#define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 13000 | |
| 31 | 31 | #define MLXSW_PCI_SW_RESET_WAIT_MSECS 100 |
| 32 | 32 | #define MLXSW_PCI_FW_READY 0xA1844 |
| 33 | 33 | #define MLXSW_PCI_FW_READY_MASK 0xFFFF |
| @@ -53,6 +53,7 @@ · 19 unmodified lines | ||
| 53 | 53 | #define MLXSW_PCI_WQE_SIZE 32 /* 32 bytes per element */ |
| 54 | 54 | #define MLXSW_PCI_CQE01_SIZE 16 /* 16 bytes per element */ |
| 55 | 55 | #define MLXSW_PCI_CQE2_SIZE 32 /* 32 bytes per element */ |
| 56 | +#define MLXSW_PCI_CQE_SIZE_MAX MLXSW_PCI_CQE2_SIZE | |
| 56 | 57 | #define MLXSW_PCI_EQE_SIZE 16 /* 16 bytes per element */ |
| 57 | 58 | #define MLXSW_PCI_WQE_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_WQE_SIZE) |
| 58 | 59 | #define MLXSW_PCI_CQE01_COUNT (MLXSW_PCI_AQ_SIZE / MLXSW_PCI_CQE01_SIZE) |
| @@ -5005,12 +5005,15 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev, · 5004 unmodified lines | ||
| 5005 | 5005 | lower_dev, |
| 5006 | 5006 | upper_dev); |
| 5007 | 5007 | } else if (netif_is_lag_master(upper_dev)) { |
| 5008 | − if (info->linking) | |
| 5008 | + if (info->linking) { | |
| 5009 | 5009 | err = mlxsw_sp_port_lag_join(mlxsw_sp_port, |
| 5010 | 5010 | upper_dev); |
| 5011 | − else | |
| 5011 | + } else { | |
| 5012 | + mlxsw_sp_port_lag_tx_en_set(mlxsw_sp_port, | |
| 5013 | + false); | |
| 5012 | 5014 | mlxsw_sp_port_lag_leave(mlxsw_sp_port, |
| 5013 | 5015 | upper_dev); |
| 5016 | + } | |
| 5014 | 5017 | } else if (netif_is_ovs_master(upper_dev)) { |
| 5015 | 5018 | if (info->linking) |
| 5016 | 5019 | err = mlxsw_sp_port_ovs_join(mlxsw_sp_port); |
| @@ -72,7 +72,15 @@ mlxsw_sp_acl_ctcam_region_entry_insert(struct mlxsw_sp *mlxsw_sp, · 71 unmodified lines | ||
| 72 | 72 | act_set = mlxsw_afa_block_first_set(rulei->act_block); |
| 73 | 73 | mlxsw_reg_ptce2_flex_action_set_memcpy_to(ptce2_pl, act_set); |
| 74 | 74 | |
| 75 | − return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptce2), ptce2_pl); | |
| 75 | + err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptce2), ptce2_pl); | |
| 76 | + if (err) | |
| 77 | + goto err_ptce2_write; | |
| 78 | + | |
| 79 | + return 0; | |
| 80 | + | |
| 81 | +err_ptce2_write: | |
| 82 | + cregion->ops->entry_remove(cregion, centry); | |
| 83 | + return err; | |
| 76 | 84 | } |
| 77 | 85 | |
| 78 | 86 | static void |
| @@ -1022,7 +1022,6 @@ void mlxsw_sp_acl_erp_mask_put(struct mlxsw_sp_acl_atcam_region *aregion, · 1021 unmodified lines | ||
| 1022 | 1022 | { |
| 1023 | 1023 | struct objagg_obj *objagg_obj = (struct objagg_obj *) erp_mask; |
| 1024 | 1024 | |
| 1025 | − ASSERT_RTNL(); | |
| 1026 | 1025 | objagg_obj_put(aregion->erp_table->objagg, objagg_obj); |
| 1027 | 1026 | } |
| 1028 | 1027 | |
| @@ -1054,7 +1053,6 @@ void mlxsw_sp_acl_erp_bf_remove(struct mlxsw_sp *mlxsw_sp, · 25 unmodified lines | ||
| 1054 | 1053 | const struct mlxsw_sp_acl_erp *erp = objagg_obj_root_priv(objagg_obj); |
| 1055 | 1054 | unsigned int erp_bank; |
| 1056 | 1055 | |
| 1057 | − ASSERT_RTNL(); | |
| 1058 | 1056 | if (!mlxsw_sp_acl_erp_table_is_used(erp->erp_table)) |
| 1059 | 1057 | return; |
| 1060 | 1058 | |
| @@ -997,8 +997,8 @@ static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_dummy_ops = { · 996 unmodified lines | ||
| 997 | 997 | static const struct mlxsw_sp_fid_family mlxsw_sp_fid_dummy_family = { |
| 998 | 998 | .type = MLXSW_SP_FID_TYPE_DUMMY, |
| 999 | 999 | .fid_size = sizeof(struct mlxsw_sp_fid), |
| 1000 | − .start_index = MLXSW_SP_RFID_BASE - 1, | |
| 1001 | − .end_index = MLXSW_SP_RFID_BASE - 1, | |
| 1000 | + .start_index = VLAN_N_VID - 1, | |
| 1001 | + .end_index = VLAN_N_VID - 1, | |
| 1002 | 1002 | .ops = &mlxsw_sp_fid_dummy_ops, |
| 1003 | 1003 | }; |
| 1004 | 1004 | |
| @@ -816,14 +816,14 @@ int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid, · 815 unmodified lines | ||
| 816 | 816 | ops = nve->nve_ops_arr[params->type]; |
| 817 | 817 | |
| 818 | 818 | if (!ops->can_offload(nve, params->dev, extack)) |
| 819 | − return -EOPNOTSUPP; | |
| 819 | + return -EINVAL; | |
| 820 | 820 | |
| 821 | 821 | memset(&config, 0, sizeof(config)); |
| 822 | 822 | ops->nve_config(nve, params->dev, &config); |
| 823 | 823 | if (nve->num_nve_tunnels && |
| 824 | 824 | memcmp(&config, &nve->config, sizeof(config))) { |
| 825 | 825 | NL_SET_ERR_MSG_MOD(extack, "Conflicting NVE tunnels configuration"); |
| 826 | − return -EOPNOTSUPP; | |
| 826 | + return -EINVAL; | |
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | err = mlxsw_sp_nve_tunnel_init(mlxsw_sp, &config); |
| @@ -1078,8 +1078,7 @@ static int · 1077 unmodified lines | ||
| 1078 | 1078 | mlxsw_sp_bridge_port_vlan_add(struct mlxsw_sp_port *mlxsw_sp_port, |
| 1079 | 1079 | struct mlxsw_sp_bridge_port *bridge_port, |
| 1080 | 1080 | u16 vid, bool is_untagged, bool is_pvid, |
| 1081 | − struct netlink_ext_ack *extack, | |
| 1082 | − struct switchdev_trans *trans) | |
| 1081 | + struct netlink_ext_ack *extack) | |
| 1083 | 1082 | { |
| 1084 | 1083 | u16 pvid = mlxsw_sp_port_pvid_determine(mlxsw_sp_port, vid, is_pvid); |
| 1085 | 1084 | struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; |
| @@ -1095,9 +1094,6 @@ mlxsw_sp_bridge_port_vlan_add(struct mlxsw_sp_port *mlxsw_sp_port, · 9 unmodified lines | ||
| 1095 | 1094 | mlxsw_sp_port_vlan->bridge_port != bridge_port) |
| 1096 | 1095 | return -EEXIST; |
| 1097 | 1096 | |
| 1098 | − if (switchdev_trans_ph_prepare(trans)) | |
| 1099 | − return 0; | |
| 1100 | − | |
| 1101 | 1097 | if (!mlxsw_sp_port_vlan) { |
| 1102 | 1098 | mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_create(mlxsw_sp_port, |
| 1103 | 1099 | vid); |
| @@ -1188,6 +1184,9 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, · 84 unmodified lines | ||
| 1188 | 1184 | return err; |
| 1189 | 1185 | } |
| 1190 | 1186 | |
| 1187 | + if (switchdev_trans_ph_commit(trans)) | |
| 1188 | + return 0; | |
| 1189 | + | |
| 1191 | 1190 | bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); |
| 1192 | 1191 | if (WARN_ON(!bridge_port)) |
| 1193 | 1192 | return -EINVAL; |
| @@ -1200,7 +1199,7 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port, · 6 unmodified lines | ||
| 1200 | 1199 | |
| 1201 | 1200 | err = mlxsw_sp_bridge_port_vlan_add(mlxsw_sp_port, bridge_port, |
| 1202 | 1201 | vid, flag_untagged, |
| 1203 | − flag_pvid, extack, trans); | |
| 1202 | + flag_pvid, extack); | |
| 1204 | 1203 | if (err) |
| 1205 | 1204 | return err; |
| 1206 | 1205 | } |
| @@ -1234,7 +1233,7 @@ mlxsw_sp_bridge_port_fdb_flush(struct mlxsw_sp *mlxsw_sp, · 27 unmodified lines | ||
| 1234 | 1233 | static enum mlxsw_reg_sfd_rec_policy mlxsw_sp_sfd_rec_policy(bool dynamic) |
| 1235 | 1234 | { |
| 1236 | 1235 | return dynamic ? MLXSW_REG_SFD_REC_POLICY_DYNAMIC_ENTRY_INGRESS : |
| 1237 | − MLXSW_REG_SFD_REC_POLICY_STATIC_ENTRY; | |
| 1236 | + MLXSW_REG_SFD_REC_POLICY_DYNAMIC_ENTRY_MLAG; | |
| 1238 | 1237 | } |
| 1239 | 1238 | |
| 1240 | 1239 | static enum mlxsw_reg_sfd_op mlxsw_sp_sfd_op(bool adding) |
| @@ -1291,7 +1290,7 @@ out: · 50 unmodified lines | ||
| 1291 | 1290 | static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, |
| 1292 | 1291 | const char *mac, u16 fid, bool adding, |
| 1293 | 1292 | enum mlxsw_reg_sfd_rec_action action, |
| 1294 | − bool dynamic) | |
| 1293 | + enum mlxsw_reg_sfd_rec_policy policy) | |
| 1295 | 1294 | { |
| 1296 | 1295 | char *sfd_pl; |
| 1297 | 1296 | u8 num_rec; |
| @@ -1302,8 +1301,7 @@ static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, · 4 unmodified lines | ||
| 1302 | 1301 | return -ENOMEM; |
| 1303 | 1302 | |
| 1304 | 1303 | mlxsw_reg_sfd_pack(sfd_pl, mlxsw_sp_sfd_op(adding), 0); |
| 1305 | − mlxsw_reg_sfd_uc_pack(sfd_pl, 0, mlxsw_sp_sfd_rec_policy(dynamic), | |
| 1306 | − mac, fid, action, local_port); | |
| 1304 | + mlxsw_reg_sfd_uc_pack(sfd_pl, 0, policy, mac, fid, action, local_port); | |
| 1307 | 1305 | num_rec = mlxsw_reg_sfd_num_rec_get(sfd_pl); |
| 1308 | 1306 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl); |
| 1309 | 1307 | if (err) |
| @@ -1322,7 +1320,8 @@ static int mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, · 12 unmodified lines | ||
| 1322 | 1320 | bool dynamic) |
| 1323 | 1321 | { |
| 1324 | 1322 | return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, adding, |
| 1325 | − MLXSW_REG_SFD_REC_ACTION_NOP, dynamic); | |
| 1323 | + MLXSW_REG_SFD_REC_ACTION_NOP, | |
| 1324 | + mlxsw_sp_sfd_rec_policy(dynamic)); | |
| 1326 | 1325 | } |
| 1327 | 1326 | |
| 1328 | 1327 | int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, |
| @@ -1330,7 +1329,7 @@ int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, · 1 unmodified line | ||
| 1330 | 1329 | { |
| 1331 | 1330 | return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, 0, mac, fid, adding, |
| 1332 | 1331 | MLXSW_REG_SFD_REC_ACTION_FORWARD_IP_ROUTER, |
| 1333 | − false); | |
| 1332 | + MLXSW_REG_SFD_REC_POLICY_STATIC_ENTRY); | |
| 1334 | 1333 | } |
| 1335 | 1334 | |
| 1336 | 1335 | static int mlxsw_sp_port_fdb_uc_lag_op(struct mlxsw_sp *mlxsw_sp, u16 lag_id, |
| @@ -1808,7 +1807,7 @@ static void · 471 unmodified lines | ||
| 1808 | 1807 | mlxsw_sp_bridge_port_vlan_del(struct mlxsw_sp_port *mlxsw_sp_port, |
| 1809 | 1808 | struct mlxsw_sp_bridge_port *bridge_port, u16 vid) |
| 1810 | 1809 | { |
| 1811 | − u16 pvid = mlxsw_sp_port->pvid == vid ? 0 : vid; | |
| 1810 | + u16 pvid = mlxsw_sp_port->pvid == vid ? 0 : mlxsw_sp_port->pvid; | |
| 1812 | 1811 | struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; |
| 1813 | 1812 | |
| 1814 | 1813 | mlxsw_sp_port_vlan = mlxsw_sp_port_vlan_find_by_vid(mlxsw_sp_port, vid); |
| @@ -3207,7 +3206,6 @@ mlxsw_sp_switchdev_vxlan_vlan_add(struct mlxsw_sp *mlxsw_sp, · 1392 unmodified lines | ||
| 3207 | 3206 | struct mlxsw_sp_bridge_device *bridge_device, |
| 3208 | 3207 | const struct net_device *vxlan_dev, u16 vid, |
| 3209 | 3208 | bool flag_untagged, bool flag_pvid, |
| 3210 | − struct switchdev_trans *trans, | |
| 3211 | 3209 | struct netlink_ext_ack *extack) |
| 3212 | 3210 | { |
| 3213 | 3211 | struct vxlan_dev *vxlan = netdev_priv(vxlan_dev); |
| @@ -3225,9 +3223,6 @@ mlxsw_sp_switchdev_vxlan_vlan_add(struct mlxsw_sp *mlxsw_sp, · 11 unmodified lines | ||
| 3225 | 3223 | mlxsw_sp_bridge_8021q_vxlan_dev_find(bridge_device->dev, vid)) |
| 3226 | 3224 | return -EINVAL; |
| 3227 | 3225 | |
| 3228 | − if (switchdev_trans_ph_prepare(trans)) | |
| 3229 | − return 0; | |
| 3230 | − | |
| 3231 | 3226 | if (!netif_running(vxlan_dev)) |
| 3232 | 3227 | return 0; |
| 3233 | 3228 | |
| @@ -3345,6 +3340,9 @@ mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev, · 111 unmodified lines | ||
| 3345 | 3340 | |
| 3346 | 3341 | port_obj_info->handled = true; |
| 3347 | 3342 | |
| 3343 | + if (switchdev_trans_ph_commit(trans)) | |
| 3344 | + return 0; | |
| 3345 | + | |
| 3348 | 3346 | bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev); |
| 3349 | 3347 | if (!bridge_device) |
| 3350 | 3348 | return -EINVAL; |
| @@ -3358,8 +3356,7 @@ mlxsw_sp_switchdev_vxlan_vlans_add(struct net_device *vxlan_dev, · 7 unmodified lines | ||
| 3358 | 3356 | err = mlxsw_sp_switchdev_vxlan_vlan_add(mlxsw_sp, bridge_device, |
| 3359 | 3357 | vxlan_dev, vid, |
| 3360 | 3358 | flag_untagged, |
| 3361 | − flag_pvid, trans, | |
| 3362 | − extack); | |
| 3359 | + flag_pvid, extack); | |
| 3363 | 3360 | if (err) |
| 3364 | 3361 | return err; |
| 3365 | 3362 | } |
| @@ -962,13 +962,10 @@ static void lan743x_phy_link_status_change(struct net_device *netdev) · 961 unmodified lines | ||
| 962 | 962 | |
| 963 | 963 | memset(&ksettings, 0, sizeof(ksettings)); |
| 964 | 964 | phy_ethtool_get_link_ksettings(netdev, &ksettings); |
| 965 | − local_advertisement = phy_read(phydev, MII_ADVERTISE); | |
| 966 | − if (local_advertisement < 0) | |
| 967 | − return; | |
| 968 | − | |
| 969 | − remote_advertisement = phy_read(phydev, MII_LPA); | |
| 970 | − if (remote_advertisement < 0) | |
| 971 | − return; | |
| 965 | + local_advertisement = | |
| 966 | + linkmode_adv_to_mii_adv_t(phydev->advertising); | |
| 967 | + remote_advertisement = | |
| 968 | + linkmode_adv_to_mii_adv_t(phydev->lp_advertising); | |
| 972 | 969 | |
| 973 | 970 | lan743x_phy_update_flowcontrol(adapter, |
| 974 | 971 | ksettings.base.duplex, |
| @@ -795,19 +795,19 @@ static void qed_init_qm_pq(struct qed_hwfn *p_hwfn, · 794 unmodified lines | ||
| 795 | 795 | |
| 796 | 796 | /* get pq index according to PQ_FLAGS */ |
| 797 | 797 | static u16 *qed_init_qm_get_idx_from_flags(struct qed_hwfn *p_hwfn, |
| 798 | − u32 pq_flags) | |
| 798 | + unsigned long pq_flags) | |
| 799 | 799 | { |
| 800 | 800 | struct qed_qm_info *qm_info = &p_hwfn->qm_info; |
| 801 | 801 | |
| 802 | 802 | /* Can't have multiple flags set here */ |
| 803 | − if (bitmap_weight((unsigned long *)&pq_flags, | |
| 803 | + if (bitmap_weight(&pq_flags, | |
| 804 | 804 | sizeof(pq_flags) * BITS_PER_BYTE) > 1) { |
| 805 | − DP_ERR(p_hwfn, "requested multiple pq flags 0x%x\n", pq_flags); | |
| 805 | + DP_ERR(p_hwfn, "requested multiple pq flags 0x%lx\n", pq_flags); | |
| 806 | 806 | goto err; |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | if (!(qed_get_pq_flags(p_hwfn) & pq_flags)) { |
| 810 | − DP_ERR(p_hwfn, "pq flag 0x%x is not set\n", pq_flags); | |
| 810 | + DP_ERR(p_hwfn, "pq flag 0x%lx is not set\n", pq_flags); | |
| 811 | 811 | goto err; |
| 812 | 812 | } |
| 813 | 813 | |
| @@ -609,6 +609,10 @@ qed_sp_update_accept_mode(struct qed_hwfn *p_hwfn, · 608 unmodified lines | ||
| 609 | 609 | (!!(accept_filter & QED_ACCEPT_MCAST_MATCHED) && |
| 610 | 610 | !!(accept_filter & QED_ACCEPT_MCAST_UNMATCHED))); |
| 611 | 611 | |
| 612 | + SET_FIELD(state, ETH_VPORT_TX_MODE_UCAST_ACCEPT_ALL, | |
| 613 | + (!!(accept_filter & QED_ACCEPT_UCAST_MATCHED) && | |
| 614 | + !!(accept_filter & QED_ACCEPT_UCAST_UNMATCHED))); | |
| 615 | + | |
| 612 | 616 | SET_FIELD(state, ETH_VPORT_TX_MODE_BCAST_ACCEPT_ALL, |
| 613 | 617 | !!(accept_filter & QED_ACCEPT_BCAST)); |
| 614 | 618 | |
| @@ -744,6 +748,11 @@ int qed_sp_vport_update(struct qed_hwfn *p_hwfn, · 129 unmodified lines | ||
| 744 | 748 | return rc; |
| 745 | 749 | } |
| 746 | 750 | |
| 751 | + if (p_params->update_ctl_frame_check) { | |
| 752 | + p_cmn->ctl_frame_mac_check_en = p_params->mac_chk_en; | |
| 753 | + p_cmn->ctl_frame_ethtype_check_en = p_params->ethtype_chk_en; | |
| 754 | + } | |
| 755 | + | |
| 747 | 756 | /* Update mcast bins for VFs, PF doesn't use this functionality */ |
| 748 | 757 | qed_sp_update_mcast_bin(p_hwfn, p_ramrod, p_params); |
| 749 | 758 | |
| @@ -2688,7 +2697,8 @@ static int qed_configure_filter_rx_mode(struct qed_dev *cdev, · 1938 unmodified lines | ||
| 2688 | 2697 | if (type == QED_FILTER_RX_MODE_TYPE_PROMISC) { |
| 2689 | 2698 | accept_flags.rx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | |
| 2690 | 2699 | QED_ACCEPT_MCAST_UNMATCHED; |
| 2691 | − accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; | |
| 2700 | + accept_flags.tx_accept_filter |= QED_ACCEPT_UCAST_UNMATCHED | | |
| 2701 | + QED_ACCEPT_MCAST_UNMATCHED; | |
| 2692 | 2702 | } else if (type == QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC) { |
| 2693 | 2703 | accept_flags.rx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
| 2694 | 2704 | accept_flags.tx_accept_filter |= QED_ACCEPT_MCAST_UNMATCHED; |
| @@ -219,6 +219,9 @@ struct qed_sp_vport_update_params { · 218 unmodified lines | ||
| 219 | 219 | struct qed_rss_params *rss_params; |
| 220 | 220 | struct qed_filter_accept_flags accept_flags; |
| 221 | 221 | struct qed_sge_tpa_params *sge_tpa_params; |
| 222 | + u8 update_ctl_frame_check; | |
| 223 | + u8 mac_chk_en; | |
| 224 | + u8 ethtype_chk_en; | |
| 222 | 225 | }; |
| 223 | 226 | |
| 224 | 227 | int qed_sp_vport_update(struct qed_hwfn *p_hwfn, |
| @@ -1619,6 +1619,10 @@ static void qed_ll2_post_rx_buffer_notify_fw(struct qed_hwfn *p_hwfn, · 1618 unmodified lines | ||
| 1619 | 1619 | cq_prod = qed_chain_get_prod_idx(&p_rx->rcq_chain); |
| 1620 | 1620 | rx_prod.bd_prod = cpu_to_le16(bd_prod); |
| 1621 | 1621 | rx_prod.cqe_prod = cpu_to_le16(cq_prod); |
| 1622 | + | |
| 1623 | + /* Make sure chain element is updated before ringing the doorbell */ | |
| 1624 | + dma_wmb(); | |
| 1625 | + | |
| 1622 | 1626 | DIRECT_REG_WR(p_rx->set_prod_addr, *((u32 *)&rx_prod)); |
| 1623 | 1627 | } |
| 1624 | 1628 | |
| @@ -2447,19 +2451,24 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, · 822 unmodified lines | ||
| 2447 | 2451 | { |
| 2448 | 2452 | struct qed_ll2_tx_pkt_info pkt; |
| 2449 | 2453 | const skb_frag_t *frag; |
| 2454 | + u8 flags = 0, nr_frags; | |
| 2450 | 2455 | int rc = -EINVAL, i; |
| 2451 | 2456 | dma_addr_t mapping; |
| 2452 | 2457 | u16 vlan = 0; |
| 2453 | − u8 flags = 0; | |
| 2454 | 2458 | |
| 2455 | 2459 | if (unlikely(skb->ip_summed != CHECKSUM_NONE)) { |
| 2456 | 2460 | DP_INFO(cdev, "Cannot transmit a checksummed packet\n"); |
| 2457 | 2461 | return -EINVAL; |
| 2458 | 2462 | } |
| 2459 | 2463 | |
| 2460 | − if (1 + skb_shinfo(skb)->nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { | |
| 2464 | + /* Cache number of fragments from SKB since SKB may be freed by | |
| 2465 | + * the completion routine after calling qed_ll2_prepare_tx_packet() | |
| 2466 | + */ | |
| 2467 | + nr_frags = skb_shinfo(skb)->nr_frags; | |
| 2468 | + | |
| 2469 | + if (1 + nr_frags > CORE_LL2_TX_MAX_BDS_PER_PACKET) { | |
| 2461 | 2470 | DP_ERR(cdev, "Cannot transmit a packet with %d fragments\n", |
| 2462 | − 1 + skb_shinfo(skb)->nr_frags); | |
| 2471 | + 1 + nr_frags); | |
| 2463 | 2472 | return -EINVAL; |
| 2464 | 2473 | } |
| 2465 | 2474 | |
| @@ -2481,7 +2490,7 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, · 15 unmodified lines | ||
| 2481 | 2490 | } |
| 2482 | 2491 | |
| 2483 | 2492 | memset(&pkt, 0, sizeof(pkt)); |
| 2484 | − pkt.num_of_bds = 1 + skb_shinfo(skb)->nr_frags; | |
| 2493 | + pkt.num_of_bds = 1 + nr_frags; | |
| 2485 | 2494 | pkt.vlan = vlan; |
| 2486 | 2495 | pkt.bd_flags = flags; |
| 2487 | 2496 | pkt.tx_dest = QED_LL2_TX_DEST_NW; |
| @@ -2492,12 +2501,17 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb, · 4 unmodified lines | ||
| 2492 | 2501 | test_bit(QED_LL2_XMIT_FLAGS_FIP_DISCOVERY, &xmit_flags)) |
| 2493 | 2502 | pkt.remove_stag = true; |
| 2494 | 2503 | |
| 2504 | + /* qed_ll2_prepare_tx_packet() may actually send the packet if | |
| 2505 | + * there are no fragments in the skb and subsequently the completion | |
| 2506 | + * routine may run and free the SKB, so no dereferencing the SKB | |
| 2507 | + * beyond this point unless skb has any fragments. | |
| 2508 | + */ | |
| 2495 | 2509 | rc = qed_ll2_prepare_tx_packet(&cdev->hwfns[0], cdev->ll2->handle, |
| 2496 | 2510 | &pkt, 1); |
| 2497 | 2511 | if (rc) |
| 2498 | 2512 | goto err; |
| 2499 | 2513 | |
| 2500 | − for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | |
| 2514 | + for (i = 0; i < nr_frags; i++) { | |
| 2501 | 2515 | frag = &skb_shinfo(skb)->frags[i]; |
| 2502 | 2516 | |
| 2503 | 2517 | mapping = skb_frag_dma_map(&cdev->pdev->dev, frag, 0, |
| @@ -1969,7 +1969,9 @@ static void qed_iov_vf_mbx_start_vport(struct qed_hwfn *p_hwfn, · 1968 unmodified lines | ||
| 1969 | 1969 | params.vport_id = vf->vport_id; |
| 1970 | 1970 | params.max_buffers_per_cqe = start->max_buffers_per_cqe; |
| 1971 | 1971 | params.mtu = vf->mtu; |
| 1972 | − params.check_mac = true; | |
| 1972 | + | |
| 1973 | + /* Non trusted VFs should enable control frame filtering */ | |
| 1974 | + params.check_mac = !vf->p_vf_info.is_trusted_configured; | |
| 1973 | 1975 | |
| 1974 | 1976 | rc = qed_sp_eth_vport_start(p_hwfn, ¶ms); |
| 1975 | 1977 | if (rc) { |
| @@ -5130,6 +5132,9 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) · 3154 unmodified lines | ||
| 5130 | 5132 | params.opaque_fid = vf->opaque_fid; |
| 5131 | 5133 | params.vport_id = vf->vport_id; |
| 5132 | 5134 | |
| 5135 | + params.update_ctl_frame_check = 1; | |
| 5136 | + params.mac_chk_en = !vf_info->is_trusted_configured; | |
| 5137 | + | |
| 5133 | 5138 | if (vf_info->rx_accept_mode & mask) { |
| 5134 | 5139 | flags->update_rx_mode_config = 1; |
| 5135 | 5140 | flags->rx_accept_filter = vf_info->rx_accept_mode; |
| @@ -5147,7 +5152,8 @@ static void qed_iov_handle_trust_change(struct qed_hwfn *hwfn) · 11 unmodified lines | ||
| 5147 | 5152 | } |
| 5148 | 5153 | |
| 5149 | 5154 | if (flags->update_rx_mode_config || |
| 5150 | − flags->update_tx_mode_config) | |
| 5155 | + flags->update_tx_mode_config || | |
| 5156 | + params.update_ctl_frame_check) | |
| 5151 | 5157 | qed_sp_vport_update(hwfn, ¶ms, |
| 5152 | 5158 | QED_SPQ_MODE_EBLOCK, NULL); |
| 5153 | 5159 | } |
| @@ -261,6 +261,7 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) · 260 unmodified lines | ||
| 261 | 261 | struct pfvf_acquire_resp_tlv *resp = &p_iov->pf2vf_reply->acquire_resp; |
| 262 | 262 | struct pf_vf_pfdev_info *pfdev_info = &resp->pfdev_info; |
| 263 | 263 | struct vf_pf_resc_request *p_resc; |
| 264 | + u8 retry_cnt = VF_ACQUIRE_THRESH; | |
| 264 | 265 | bool resources_acquired = false; |
| 265 | 266 | struct vfpf_acquire_tlv *req; |
| 266 | 267 | int rc = 0, attempts = 0; |
| @@ -314,6 +315,15 @@ static int qed_vf_pf_acquire(struct qed_hwfn *p_hwfn) · 47 unmodified lines | ||
| 314 | 315 | |
| 315 | 316 | /* send acquire request */ |
| 316 | 317 | rc = qed_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); |
| 318 | + | |
| 319 | + /* Re-try acquire in case of vf-pf hw channel timeout */ | |
| 320 | + if (retry_cnt && rc == -EBUSY) { | |
| 321 | + DP_VERBOSE(p_hwfn, QED_MSG_IOV, | |
| 322 | + "VF retrying to acquire due to VPC timeout\n"); | |
| 323 | + retry_cnt--; | |
| 324 | + continue; | |
| 325 | + } | |
| 326 | + | |
| 317 | 327 | if (rc) |
| 318 | 328 | goto exit; |
| 319 | 329 | |
| @@ -691,7 +691,7 @@ static void cp_tx (struct cp_private *cp) · 690 unmodified lines | ||
| 691 | 691 | } |
| 692 | 692 | bytes_compl += skb->len; |
| 693 | 693 | pkts_compl++; |
| 694 | − dev_kfree_skb_irq(skb); | |
| 694 | + dev_consume_skb_irq(skb); | |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | cp->tx_skb[tx_tail] = NULL; |
| @@ -205,6 +205,8 @@ enum cfg_version { · 204 unmodified lines | ||
| 205 | 205 | }; |
| 206 | 206 | |
| 207 | 207 | static const struct pci_device_id rtl8169_pci_tbl[] = { |
| 208 | + { PCI_VDEVICE(REALTEK, 0x2502), RTL_CFG_1 }, | |
| 209 | + { PCI_VDEVICE(REALTEK, 0x2600), RTL_CFG_1 }, | |
| 208 | 210 | { PCI_VDEVICE(REALTEK, 0x8129), RTL_CFG_0 }, |
| 209 | 211 | { PCI_VDEVICE(REALTEK, 0x8136), RTL_CFG_2 }, |
| 210 | 212 | { PCI_VDEVICE(REALTEK, 0x8161), RTL_CFG_1 }, |
| @@ -706,6 +708,7 @@ module_param(use_dac, int, 0); · 495 unmodified lines | ||
| 706 | 708 | MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot."); |
| 707 | 709 | module_param_named(debug, debug.msg_enable, int, 0); |
| 708 | 710 | MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., 16=all)"); |
| 711 | +MODULE_SOFTDEP("pre: realtek"); | |
| 709 | 712 | MODULE_LICENSE("GPL"); |
| 710 | 713 | MODULE_FIRMWARE(FIRMWARE_8168D_1); |
| 711 | 714 | MODULE_FIRMWARE(FIRMWARE_8168D_2); |
| @@ -1679,11 +1682,13 @@ static bool rtl8169_reset_counters(struct rtl8169_private *tp) · 967 unmodified lines | ||
| 1679 | 1682 | |
| 1680 | 1683 | static bool rtl8169_update_counters(struct rtl8169_private *tp) |
| 1681 | 1684 | { |
| 1685 | + u8 val = RTL_R8(tp, ChipCmd); | |
| 1686 | + | |
| 1682 | 1687 | /* |
| 1683 | 1688 | * Some chips are unable to dump tally counters when the receiver |
| 1684 | − * is disabled. | |
| 1689 | + * is disabled. If 0xff chip may be in a PCI power-save state. | |
| 1685 | 1690 | */ |
| 1686 | − if ((RTL_R8(tp, ChipCmd) & CmdRxEnb) == 0) | |
| 1691 | + if (!(val & CmdRxEnb) || val == 0xff) | |
| 1687 | 1692 | return true; |
| 1688 | 1693 | |
| 1689 | 1694 | return rtl8169_do_counters(tp, CounterDump); |
| @@ -343,7 +343,7 @@ static int ravb_ring_init(struct net_device *ndev, int q) · 342 unmodified lines | ||
| 343 | 343 | int i; |
| 344 | 344 | |
| 345 | 345 | priv->rx_buf_sz = (ndev->mtu <= 1492 ? PKT_BUF_SZ : ndev->mtu) + |
| 346 | − ETH_HLEN + VLAN_HLEN; | |
| 346 | + ETH_HLEN + VLAN_HLEN + sizeof(__sum16); | |
| 347 | 347 | |
| 348 | 348 | /* Allocate RX and TX skb rings */ |
| 349 | 349 | priv->rx_skb[q] = kcalloc(priv->num_rx_ring[q], |
| @@ -524,13 +524,15 @@ static void ravb_rx_csum(struct sk_buff *skb) · 174 unmodified lines | ||
| 524 | 524 | { |
| 525 | 525 | u8 *hw_csum; |
| 526 | 526 | |
| 527 | − /* The hardware checksum is 2 bytes appended to packet data */ | |
| 528 | − if (unlikely(skb->len < 2)) | |
| 527 | + /* The hardware checksum is contained in sizeof(__sum16) (2) bytes | |
| 528 | + * appended to packet data | |
| 529 | + */ | |
| 530 | + if (unlikely(skb->len < sizeof(__sum16))) | |
| 529 | 531 | return; |
| 530 | − hw_csum = skb_tail_pointer(skb) - 2; | |
| 532 | + hw_csum = skb_tail_pointer(skb) - sizeof(__sum16); | |
| 531 | 533 | skb->csum = csum_unfold((__force __sum16)get_unaligned_le16(hw_csum)); |
| 532 | 534 | skb->ip_summed = CHECKSUM_COMPLETE; |
| 533 | − skb_trim(skb, skb->len - 2); | |
| 535 | + skb_trim(skb, skb->len - sizeof(__sum16)); | |
| 534 | 536 | } |
| 535 | 537 | |
| 536 | 538 | /* Packet receive function for Ethernet AVB */ |
| @@ -6046,22 +6046,25 @@ static const struct efx_ef10_nvram_type_info efx_ef10_nvram_types[] = { · 6045 unmodified lines | ||
| 6046 | 6046 | { NVRAM_PARTITION_TYPE_EXPANSION_UEFI, 0, 0, "sfc_uefi" }, |
| 6047 | 6047 | { NVRAM_PARTITION_TYPE_STATUS, 0, 0, "sfc_status" } |
| 6048 | 6048 | }; |
| 6049 | +#define EF10_NVRAM_PARTITION_COUNT ARRAY_SIZE(efx_ef10_nvram_types) | |
| 6049 | 6050 | |
| 6050 | 6051 | static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, |
| 6051 | 6052 | struct efx_mcdi_mtd_partition *part, |
| 6052 | − unsigned int type) | |
| 6053 | + unsigned int type, | |
| 6054 | + unsigned long *found) | |
| 6053 | 6055 | { |
| 6054 | 6056 | MCDI_DECLARE_BUF(inbuf, MC_CMD_NVRAM_METADATA_IN_LEN); |
| 6055 | 6057 | MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_METADATA_OUT_LENMAX); |
| 6056 | 6058 | const struct efx_ef10_nvram_type_info *info; |
| 6057 | 6059 | size_t size, erase_size, outlen; |
| 6060 | + int type_idx = 0; | |
| 6058 | 6061 | bool protected; |
| 6059 | 6062 | int rc; |
| 6060 | 6063 | |
| 6061 | − for (info = efx_ef10_nvram_types; ; info++) { | |
| 6062 | − if (info == | |
| 6063 | − efx_ef10_nvram_types + ARRAY_SIZE(efx_ef10_nvram_types)) | |
| 6064 | + for (type_idx = 0; ; type_idx++) { | |
| 6065 | + if (type_idx == EF10_NVRAM_PARTITION_COUNT) | |
| 6064 | 6066 | return -ENODEV; |
| 6067 | + info = efx_ef10_nvram_types + type_idx; | |
| 6065 | 6068 | if ((type & ~info->type_mask) == info->type) |
| 6066 | 6069 | break; |
| 6067 | 6070 | } |
| @@ -6074,6 +6077,13 @@ static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, · 6 unmodified lines | ||
| 6074 | 6077 | if (protected) |
| 6075 | 6078 | return -ENODEV; /* hide it */ |
| 6076 | 6079 | |
| 6080 | + /* If we've already exposed a partition of this type, hide this | |
| 6081 | + * duplicate. All operations on MTDs are keyed by the type anyway, | |
| 6082 | + * so we can't act on the duplicate. | |
| 6083 | + */ | |
| 6084 | + if (__test_and_set_bit(type_idx, found)) | |
| 6085 | + return -EEXIST; | |
| 6086 | + | |
| 6077 | 6087 | part->nvram_type = type; |
| 6078 | 6088 | |
| 6079 | 6089 | MCDI_SET_DWORD(inbuf, NVRAM_METADATA_IN_TYPE, type); |
| @@ -6105,6 +6115,7 @@ static int efx_ef10_mtd_probe_partition(struct efx_nic *efx, · 25 unmodified lines | ||
| 6105 | 6115 | static int efx_ef10_mtd_probe(struct efx_nic *efx) |
| 6106 | 6116 | { |
| 6107 | 6117 | MCDI_DECLARE_BUF(outbuf, MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX); |
| 6118 | + DECLARE_BITMAP(found, EF10_NVRAM_PARTITION_COUNT); | |
| 6108 | 6119 | struct efx_mcdi_mtd_partition *parts; |
| 6109 | 6120 | size_t outlen, n_parts_total, i, n_parts; |
| 6110 | 6121 | unsigned int type; |
| @@ -6133,11 +6144,13 @@ static int efx_ef10_mtd_probe(struct efx_nic *efx) · 22 unmodified lines | ||
| 6133 | 6144 | for (i = 0; i < n_parts_total; i++) { |
| 6134 | 6145 | type = MCDI_ARRAY_DWORD(outbuf, NVRAM_PARTITIONS_OUT_TYPE_ID, |
| 6135 | 6146 | i); |
| 6136 | − rc = efx_ef10_mtd_probe_partition(efx, &parts[n_parts], type); | |
| 6137 | − if (rc == 0) | |
| 6138 | − n_parts++; | |
| 6139 | − else if (rc != -ENODEV) | |
| 6147 | + rc = efx_ef10_mtd_probe_partition(efx, &parts[n_parts], type, | |
| 6148 | + found); | |
| 6149 | + if (rc == -EEXIST || rc == -ENODEV) | |
| 6150 | + continue; | |
| 6151 | + if (rc) | |
| 6140 | 6152 | goto fail; |
| 6153 | + n_parts++; | |
| 6141 | 6154 | } |
| 6142 | 6155 | |
| 6143 | 6156 | rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); |
| @@ -1342,8 +1342,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv) · 1341 unmodified lines | ||
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | ret = phy_power_on(bsp_priv, true); |
| 1345 | − if (ret) | |
| 1345 | + if (ret) { | |
| 1346 | + gmac_clk_enable(bsp_priv, false); | |
| 1346 | 1347 | return ret; |
| 1348 | + } | |
| 1347 | 1349 | |
| 1348 | 1350 | pm_runtime_enable(dev); |
| 1349 | 1351 | pm_runtime_get_sync(dev); |
| @@ -263,6 +263,7 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, · 262 unmodified lines | ||
| 263 | 263 | struct stmmac_extra_stats *x, u32 chan) |
| 264 | 264 | { |
| 265 | 265 | u32 intr_status = readl(ioaddr + XGMAC_DMA_CH_STATUS(chan)); |
| 266 | + u32 intr_en = readl(ioaddr + XGMAC_DMA_CH_INT_EN(chan)); | |
| 266 | 267 | int ret = 0; |
| 267 | 268 | |
| 268 | 269 | /* ABNORMAL interrupts */ |
| @@ -282,8 +283,7 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, · 13 unmodified lines | ||
| 282 | 283 | x->normal_irq_n++; |
| 283 | 284 | |
| 284 | 285 | if (likely(intr_status & XGMAC_RI)) { |
| 285 | − u32 value = readl(ioaddr + XGMAC_DMA_CH_INT_EN(chan)); | |
| 286 | − if (likely(value & XGMAC_RIE)) { | |
| 286 | + if (likely(intr_en & XGMAC_RIE)) { | |
| 287 | 287 | x->rx_normal_irq_n++; |
| 288 | 288 | ret |= handle_rx; |
| 289 | 289 | } |
| @@ -295,7 +295,7 @@ static int dwxgmac2_dma_interrupt(void __iomem *ioaddr, · 5 unmodified lines | ||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /* Clear interrupts */ |
| 298 | − writel(~0x0, ioaddr + XGMAC_DMA_CH_STATUS(chan)); | |
| 298 | + writel(intr_en & intr_status, ioaddr + XGMAC_DMA_CH_STATUS(chan)); | |
| 299 | 299 | |
| 300 | 300 | return ret; |
| 301 | 301 | } |
| @@ -3517,27 +3517,28 @@ static int stmmac_napi_poll(struct napi_struct *napi, int budget) · 3516 unmodified lines | ||
| 3517 | 3517 | struct stmmac_channel *ch = |
| 3518 | 3518 | container_of(napi, struct stmmac_channel, napi); |
| 3519 | 3519 | struct stmmac_priv *priv = ch->priv_data; |
| 3520 | − int work_done = 0, work_rem = budget; | |
| 3520 | + int work_done, rx_done = 0, tx_done = 0; | |
| 3521 | 3521 | u32 chan = ch->index; |
| 3522 | 3522 | |
| 3523 | 3523 | priv->xstats.napi_poll++; |
| 3524 | 3524 | |
| 3525 | − if (ch->has_tx) { | |
| 3526 | − int done = stmmac_tx_clean(priv, work_rem, chan); | |
| 3525 | + if (ch->has_tx) | |
| 3526 | + tx_done = stmmac_tx_clean(priv, budget, chan); | |
| 3527 | + if (ch->has_rx) | |
| 3528 | + rx_done = stmmac_rx(priv, budget, chan); | |
| 3527 | 3529 | |
| 3528 | − work_done += done; | |
| 3529 | − work_rem -= done; | |
| 3530 | − } | |
| 3531 | − | |
| 3532 | − if (ch->has_rx) { | |
| 3533 | − int done = stmmac_rx(priv, work_rem, chan); | |
| 3530 | + work_done = max(rx_done, tx_done); | |
| 3531 | + work_done = min(work_done, budget); | |
| 3534 | 3532 | |
| 3535 | − work_done += done; | |
| 3536 | − work_rem -= done; | |
| 3537 | − } | |
| 3533 | + if (work_done < budget && napi_complete_done(napi, work_done)) { | |
| 3534 | + int stat; | |
| 3538 | 3535 | |
| 3539 | − if (work_done < budget && napi_complete_done(napi, work_done)) | |
| 3540 | 3536 | stmmac_enable_dma_irq(priv, priv->ioaddr, chan); |
| 3537 | + stat = stmmac_dma_interrupt_status(priv, priv->ioaddr, | |
| 3538 | + &priv->xstats, chan); | |
| 3539 | + if (stat && napi_reschedule(napi)) | |
| 3540 | + stmmac_disable_dma_irq(priv, priv->ioaddr, chan); | |
| 3541 | + } | |
| 3541 | 3542 | |
| 3542 | 3543 | return work_done; |
| 3543 | 3544 | } |
| @@ -4160,6 +4161,18 @@ static int stmmac_hw_init(struct stmmac_priv *priv) · 616 unmodified lines | ||
| 4160 | 4161 | return ret; |
| 4161 | 4162 | } |
| 4162 | 4163 | |
| 4164 | + /* Rx Watchdog is available in the COREs newer than the 3.40. | |
| 4165 | + * In some case, for example on bugged HW this feature | |
| 4166 | + * has to be disable and this can be done by passing the | |
| 4167 | + * riwt_off field from the platform. | |
| 4168 | + */ | |
| 4169 | + if (((priv->synopsys_id >= DWMAC_CORE_3_50) || | |
| 4170 | + (priv->plat->has_xgmac)) && (!priv->plat->riwt_off)) { | |
| 4171 | + priv->use_riwt = 1; | |
| 4172 | + dev_info(priv->device, | |
| 4173 | + "Enable RX Mitigation via HW Watchdog Timer\n"); | |
| 4174 | + } | |
| 4175 | + | |
| 4163 | 4176 | return 0; |
| 4164 | 4177 | } |
| 4165 | 4178 | |
| @@ -4292,18 +4305,6 @@ int stmmac_dvr_probe(struct device *device, · 126 unmodified lines | ||
| 4292 | 4305 | if (flow_ctrl) |
| 4293 | 4306 | priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */ |
| 4294 | 4307 | |
| 4295 | − /* Rx Watchdog is available in the COREs newer than the 3.40. | |
| 4296 | − * In some case, for example on bugged HW this feature | |
| 4297 | − * has to be disable and this can be done by passing the | |
| 4298 | − * riwt_off field from the platform. | |
| 4299 | − */ | |
| 4300 | − if (((priv->synopsys_id >= DWMAC_CORE_3_50) || | |
| 4301 | − (priv->plat->has_xgmac)) && (!priv->plat->riwt_off)) { | |
| 4302 | − priv->use_riwt = 1; | |
| 4303 | − dev_info(priv->device, | |
| 4304 | − "Enable RX Mitigation via HW Watchdog Timer\n"); | |
| 4305 | − } | |
| 4306 | − | |
| 4307 | 4308 | /* Setup channels NAPI */ |
| 4308 | 4309 | maxq = max(priv->plat->rx_queues_to_use, priv->plat->tx_queues_to_use); |
| 4309 | 4310 | |
| @@ -299,7 +299,17 @@ static int stmmac_pci_probe(struct pci_dev *pdev, · 298 unmodified lines | ||
| 299 | 299 | */ |
| 300 | 300 | static void stmmac_pci_remove(struct pci_dev *pdev) |
| 301 | 301 | { |
| 302 | + int i; | |
| 303 | + | |
| 302 | 304 | stmmac_dvr_remove(&pdev->dev); |
| 305 | + | |
| 306 | + for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { | |
| 307 | + if (pci_resource_len(pdev, i) == 0) | |
| 308 | + continue; | |
| 309 | + pcim_iounmap_regions(pdev, BIT(i)); | |
| 310 | + break; | |
| 311 | + } | |
| 312 | + | |
| 303 | 313 | pci_disable_device(pdev); |
| 304 | 314 | } |
| 305 | 315 | |
| @@ -301,6 +301,8 @@ static int tc_setup_cbs(struct stmmac_priv *priv, · 300 unmodified lines | ||
| 301 | 301 | /* Queue 0 is not AVB capable */ |
| 302 | 302 | if (queue <= 0 || queue >= tx_queues_count) |
| 303 | 303 | return -EINVAL; |
| 304 | + if (!priv->dma_cap.av) | |
| 305 | + return -EOPNOTSUPP; | |
| 304 | 306 | if (priv->speed != SPEED_100 && priv->speed != SPEED_1000) |
| 305 | 307 | return -EOPNOTSUPP; |
| 306 | 308 | |
| @@ -1,22 +1,9 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +// SPDX-License-Identifier: GPL-2.0+ | |
| 2 | 2 | /* cassini.c: Sun Microsystems Cassini(+) ethernet driver. |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2004 Sun Microsystems Inc. |
| 5 | 5 | * Copyright (C) 2003 Adrian Sun (asun@darksunrising.com) |
| 6 | 6 | * |
| 7 | − * This program is free software; you can redistribute it and/or | |
| 8 | − * modify it under the terms of the GNU General Public License as | |
| 9 | − * published by the Free Software Foundation; either version 2 of the | |
| 10 | − * License, or (at your option) any later version. | |
| 11 | − * | |
| 12 | − * This program is distributed in the hope that it will be useful, | |
| 13 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | − * GNU General Public License for more details. | |
| 16 | − * | |
| 17 | − * You should have received a copy of the GNU General Public License | |
| 18 | − * along with this program; if not, see <http://www.gnu.org/licenses/>. | |
| 19 | − * | |
| 20 | 7 | * This driver uses the sungem driver (c) David Miller |
| 21 | 8 | * (davem@redhat.com) as its basis. |
| 22 | 9 | * |
| @@ -1,23 +1,10 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ | |
| 2 | 2 | /* $Id: cassini.h,v 1.16 2004/08/17 21:15:16 zaumen Exp $ |
| 3 | 3 | * cassini.h: Definitions for Sun Microsystems Cassini(+) ethernet driver. |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2004 Sun Microsystems Inc. |
| 6 | 6 | * Copyright (c) 2003 Adrian Sun (asun@darksunrising.com) |
| 7 | 7 | * |
| 8 | − * This program is free software; you can redistribute it and/or | |
| 9 | − * modify it under the terms of the GNU General Public License as | |
| 10 | − * published by the Free Software Foundation; either version 2 of the | |
| 11 | − * License, or (at your option) any later version. | |
| 12 | − * | |
| 13 | − * This program is distributed in the hope that it will be useful, | |
| 14 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | − * GNU General Public License for more details. | |
| 17 | − * | |
| 18 | − * You should have received a copy of the GNU General Public License | |
| 19 | − * along with this program; if not, see <http://www.gnu.org/licenses/>. | |
| 20 | − * | |
| 21 | 8 | * vendor id: 0x108E (Sun Microsystems, Inc.) |
| 22 | 9 | * device id: 0xabba (Cassini) |
| 23 | 10 | * revision ids: 0x01 = Cassini |
| @@ -608,7 +608,7 @@ static void cpmac_end_xmit(struct net_device *dev, int queue) · 607 unmodified lines | ||
| 608 | 608 | netdev_dbg(dev, "sent 0x%p, len=%d\n", |
| 609 | 609 | desc->skb, desc->skb->len); |
| 610 | 610 | |
| 611 | − dev_kfree_skb_irq(desc->skb); | |
| 611 | + dev_consume_skb_irq(desc->skb); | |
| 612 | 612 | desc->skb = NULL; |
| 613 | 613 | if (__netif_subqueue_stopped(dev, queue)) |
| 614 | 614 | netif_wake_subqueue(dev, queue); |
| @@ -144,6 +144,8 @@ struct hv_netvsc_packet { · 143 unmodified lines | ||
| 144 | 144 | u32 total_data_buflen; |
| 145 | 145 | }; |
| 146 | 146 | |
| 147 | +#define NETVSC_HASH_KEYLEN 40 | |
| 148 | + | |
| 147 | 149 | struct netvsc_device_info { |
| 148 | 150 | unsigned char mac_adr[ETH_ALEN]; |
| 149 | 151 | u32 num_chn; |
| @@ -151,6 +153,8 @@ struct netvsc_device_info { · 1 unmodified line | ||
| 151 | 153 | u32 recv_sections; |
| 152 | 154 | u32 send_section_size; |
| 153 | 155 | u32 recv_section_size; |
| 156 | + | |
| 157 | + u8 rss_key[NETVSC_HASH_KEYLEN]; | |
| 154 | 158 | }; |
| 155 | 159 | |
| 156 | 160 | enum rndis_device_state { |
| @@ -160,8 +164,6 @@ enum rndis_device_state { · 3 unmodified lines | ||
| 160 | 164 | RNDIS_DEV_DATAINITIALIZED, |
| 161 | 165 | }; |
| 162 | 166 | |
| 163 | −#define NETVSC_HASH_KEYLEN 40 | |
| 164 | − | |
| 165 | 167 | struct rndis_device { |
| 166 | 168 | struct net_device *ndev; |
| 167 | 169 | |
| @@ -209,7 +211,9 @@ int netvsc_recv_callback(struct net_device *net, · 41 unmodified lines | ||
| 209 | 211 | void netvsc_channel_cb(void *context); |
| 210 | 212 | int netvsc_poll(struct napi_struct *napi, int budget); |
| 211 | 213 | |
| 212 | −int rndis_set_subchannel(struct net_device *ndev, struct netvsc_device *nvdev); | |
| 214 | +int rndis_set_subchannel(struct net_device *ndev, | |
| 215 | + struct netvsc_device *nvdev, | |
| 216 | + struct netvsc_device_info *dev_info); | |
| 213 | 217 | int rndis_filter_open(struct netvsc_device *nvdev); |
| 214 | 218 | int rndis_filter_close(struct netvsc_device *nvdev); |
| 215 | 219 | struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, |
| @@ -1177,7 +1181,7 @@ enum ndis_per_pkt_info_type { · 961 unmodified lines | ||
| 1177 | 1181 | |
| 1178 | 1182 | enum rndis_per_pkt_info_interal_type { |
| 1179 | 1183 | RNDIS_PKTINFO_ID = 1, |
| 1180 | − /* Add more memebers here */ | |
| 1184 | + /* Add more members here */ | |
| 1181 | 1185 | |
| 1182 | 1186 | RNDIS_PKTINFO_MAX |
| 1183 | 1187 | }; |
| @@ -84,7 +84,7 @@ static void netvsc_subchan_work(struct work_struct *w) · 83 unmodified lines | ||
| 84 | 84 | |
| 85 | 85 | rdev = nvdev->extension; |
| 86 | 86 | if (rdev) { |
| 87 | − ret = rndis_set_subchannel(rdev->ndev, nvdev); | |
| 87 | + ret = rndis_set_subchannel(rdev->ndev, nvdev, NULL); | |
| 88 | 88 | if (ret == 0) { |
| 89 | 89 | netif_device_attach(rdev->ndev); |
| 90 | 90 | } else { |
| @@ -1331,7 +1331,7 @@ void netvsc_channel_cb(void *context) · 1240 unmodified lines | ||
| 1331 | 1331 | prefetch(hv_get_ring_buffer(rbi) + rbi->priv_read_index); |
| 1332 | 1332 | |
| 1333 | 1333 | if (napi_schedule_prep(&nvchan->napi)) { |
| 1334 | − /* disable interupts from host */ | |
| 1334 | + /* disable interrupts from host */ | |
| 1335 | 1335 | hv_begin_read(rbi); |
| 1336 | 1336 | |
| 1337 | 1337 | __napi_schedule_irqoff(&nvchan->napi); |
| @@ -370,7 +370,7 @@ static u32 fill_pg_buf(struct page *page, u32 offset, u32 len, · 369 unmodified lines | ||
| 370 | 370 | { |
| 371 | 371 | int j = 0; |
| 372 | 372 | |
| 373 | − /* Deal with compund pages by ignoring unused part | |
| 373 | + /* Deal with compound pages by ignoring unused part | |
| 374 | 374 | * of the page. |
| 375 | 375 | */ |
| 376 | 376 | page += (offset >> PAGE_SHIFT); |
| @@ -858,6 +858,39 @@ static void netvsc_get_channels(struct net_device *net, · 481 unmodified lines | ||
| 858 | 858 | } |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | +/* Alloc struct netvsc_device_info, and initialize it from either existing | |
| 862 | + * struct netvsc_device, or from default values. | |
| 863 | + */ | |
| 864 | +static struct netvsc_device_info *netvsc_devinfo_get | |
| 865 | + (struct netvsc_device *nvdev) | |
| 866 | +{ | |
| 867 | + struct netvsc_device_info *dev_info; | |
| 868 | + | |
| 869 | + dev_info = kzalloc(sizeof(*dev_info), GFP_ATOMIC); | |
| 870 | + | |
| 871 | + if (!dev_info) | |
| 872 | + return NULL; | |
| 873 | + | |
| 874 | + if (nvdev) { | |
| 875 | + dev_info->num_chn = nvdev->num_chn; | |
| 876 | + dev_info->send_sections = nvdev->send_section_cnt; | |
| 877 | + dev_info->send_section_size = nvdev->send_section_size; | |
| 878 | + dev_info->recv_sections = nvdev->recv_section_cnt; | |
| 879 | + dev_info->recv_section_size = nvdev->recv_section_size; | |
| 880 | + | |
| 881 | + memcpy(dev_info->rss_key, nvdev->extension->rss_key, | |
| 882 | + NETVSC_HASH_KEYLEN); | |
| 883 | + } else { | |
| 884 | + dev_info->num_chn = VRSS_CHANNEL_DEFAULT; | |
| 885 | + dev_info->send_sections = NETVSC_DEFAULT_TX; | |
| 886 | + dev_info->send_section_size = NETVSC_SEND_SECTION_SIZE; | |
| 887 | + dev_info->recv_sections = NETVSC_DEFAULT_RX; | |
| 888 | + dev_info->recv_section_size = NETVSC_RECV_SECTION_SIZE; | |
| 889 | + } | |
| 890 | + | |
| 891 | + return dev_info; | |
| 892 | +} | |
| 893 | + | |
| 861 | 894 | static int netvsc_detach(struct net_device *ndev, |
| 862 | 895 | struct netvsc_device *nvdev) |
| 863 | 896 | { |
| @@ -909,7 +942,7 @@ static int netvsc_attach(struct net_device *ndev, · 45 unmodified lines | ||
| 909 | 942 | return PTR_ERR(nvdev); |
| 910 | 943 | |
| 911 | 944 | if (nvdev->num_chn > 1) { |
| 912 | − ret = rndis_set_subchannel(ndev, nvdev); | |
| 945 | + ret = rndis_set_subchannel(ndev, nvdev, dev_info); | |
| 913 | 946 | |
| 914 | 947 | /* if unavailable, just proceed with one queue */ |
| 915 | 948 | if (ret) { |
| @@ -943,7 +976,7 @@ static int netvsc_set_channels(struct net_device *net, · 27 unmodified lines | ||
| 943 | 976 | struct net_device_context *net_device_ctx = netdev_priv(net); |
| 944 | 977 | struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev); |
| 945 | 978 | unsigned int orig, count = channels->combined_count; |
| 946 | − struct netvsc_device_info device_info; | |
| 979 | + struct netvsc_device_info *device_info; | |
| 947 | 980 | int ret; |
| 948 | 981 | |
| 949 | 982 | /* We do not support separate count for rx, tx, or other */ |
| @@ -962,24 +995,26 @@ static int netvsc_set_channels(struct net_device *net, · 12 unmodified lines | ||
| 962 | 995 | |
| 963 | 996 | orig = nvdev->num_chn; |
| 964 | 997 | |
| 965 | − memset(&device_info, 0, sizeof(device_info)); | |
| 966 | − device_info.num_chn = count; | |
| 967 | − device_info.send_sections = nvdev->send_section_cnt; | |
| 968 | − device_info.send_section_size = nvdev->send_section_size; | |
| 969 | − device_info.recv_sections = nvdev->recv_section_cnt; | |
| 970 | − device_info.recv_section_size = nvdev->recv_section_size; | |
| 998 | + device_info = netvsc_devinfo_get(nvdev); | |
| 999 | + | |
| 1000 | + if (!device_info) | |
| 1001 | + return -ENOMEM; | |
| 1002 | + | |
| 1003 | + device_info->num_chn = count; | |
| 971 | 1004 | |
| 972 | 1005 | ret = netvsc_detach(net, nvdev); |
| 973 | 1006 | if (ret) |
| 974 | − return ret; | |
| 1007 | + goto out; | |
| 975 | 1008 | |
| 976 | − ret = netvsc_attach(net, &device_info); | |
| 1009 | + ret = netvsc_attach(net, device_info); | |
| 977 | 1010 | if (ret) { |
| 978 | − device_info.num_chn = orig; | |
| 979 | − if (netvsc_attach(net, &device_info)) | |
| 1011 | + device_info->num_chn = orig; | |
| 1012 | + if (netvsc_attach(net, device_info)) | |
| 980 | 1013 | netdev_err(net, "restoring channel setting failed\n"); |
| 981 | 1014 | } |
| 982 | 1015 | |
| 1016 | +out: | |
| 1017 | + kfree(device_info); | |
| 983 | 1018 | return ret; |
| 984 | 1019 | } |
| 985 | 1020 | |
| @@ -1048,48 +1083,45 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) · 62 unmodified lines | ||
| 1048 | 1083 | struct net_device *vf_netdev = rtnl_dereference(ndevctx->vf_netdev); |
| 1049 | 1084 | struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); |
| 1050 | 1085 | int orig_mtu = ndev->mtu; |
| 1051 | − struct netvsc_device_info device_info; | |
| 1086 | + struct netvsc_device_info *device_info; | |
| 1052 | 1087 | int ret = 0; |
| 1053 | 1088 | |
| 1054 | 1089 | if (!nvdev || nvdev->destroy) |
| 1055 | 1090 | return -ENODEV; |
| 1056 | 1091 | |
| 1092 | + device_info = netvsc_devinfo_get(nvdev); | |
| 1093 | + | |
| 1094 | + if (!device_info) | |
| 1095 | + return -ENOMEM; | |
| 1096 | + | |
| 1057 | 1097 | /* Change MTU of underlying VF netdev first. */ |
| 1058 | 1098 | if (vf_netdev) { |
| 1059 | 1099 | ret = dev_set_mtu(vf_netdev, mtu); |
| 1060 | 1100 | if (ret) |
| 1061 | − return ret; | |
| 1101 | + goto out; | |
| 1062 | 1102 | } |
| 1063 | 1103 | |
| 1064 | − memset(&device_info, 0, sizeof(device_info)); | |
| 1065 | − device_info.num_chn = nvdev->num_chn; | |
| 1066 | − device_info.send_sections = nvdev->send_section_cnt; | |
| 1067 | − device_info.send_section_size = nvdev->send_section_size; | |
| 1068 | − device_info.recv_sections = nvdev->recv_section_cnt; | |
| 1069 | − device_info.recv_section_size = nvdev->recv_section_size; | |
| 1070 | − | |
| 1071 | 1104 | ret = netvsc_detach(ndev, nvdev); |
| 1072 | 1105 | if (ret) |
| 1073 | 1106 | goto rollback_vf; |
| 1074 | 1107 | |
| 1075 | 1108 | ndev->mtu = mtu; |
| 1076 | 1109 | |
| 1077 | − ret = netvsc_attach(ndev, &device_info); | |
| 1078 | − if (ret) | |
| 1079 | − goto rollback; | |
| 1080 | − | |
| 1081 | − return 0; | |
| 1110 | + ret = netvsc_attach(ndev, device_info); | |
| 1111 | + if (!ret) | |
| 1112 | + goto out; | |
| 1082 | 1113 | |
| 1083 | −rollback: | |
| 1084 | 1114 | /* Attempt rollback to original MTU */ |
| 1085 | 1115 | ndev->mtu = orig_mtu; |
| 1086 | 1116 | |
| 1087 | − if (netvsc_attach(ndev, &device_info)) | |
| 1117 | + if (netvsc_attach(ndev, device_info)) | |
| 1088 | 1118 | netdev_err(ndev, "restoring mtu failed\n"); |
| 1089 | 1119 | rollback_vf: |
| 1090 | 1120 | if (vf_netdev) |
| 1091 | 1121 | dev_set_mtu(vf_netdev, orig_mtu); |
| 1092 | 1122 | |
| 1123 | +out: | |
| 1124 | + kfree(device_info); | |
| 1093 | 1125 | return ret; |
| 1094 | 1126 | } |
| 1095 | 1127 | |
| @@ -1674,7 +1706,7 @@ static int netvsc_set_ringparam(struct net_device *ndev, · 578 unmodified lines | ||
| 1674 | 1706 | { |
| 1675 | 1707 | struct net_device_context *ndevctx = netdev_priv(ndev); |
| 1676 | 1708 | struct netvsc_device *nvdev = rtnl_dereference(ndevctx->nvdev); |
| 1677 | − struct netvsc_device_info device_info; | |
| 1709 | + struct netvsc_device_info *device_info; | |
| 1678 | 1710 | struct ethtool_ringparam orig; |
| 1679 | 1711 | u32 new_tx, new_rx; |
| 1680 | 1712 | int ret = 0; |
| @@ -1694,26 +1726,29 @@ static int netvsc_set_ringparam(struct net_device *ndev, · 13 unmodified lines | ||
| 1694 | 1726 | new_rx == orig.rx_pending) |
| 1695 | 1727 | return 0; /* no change */ |
| 1696 | 1728 | |
| 1697 | − memset(&device_info, 0, sizeof(device_info)); | |
| 1698 | − device_info.num_chn = nvdev->num_chn; | |
| 1699 | − device_info.send_sections = new_tx; | |
| 1700 | − device_info.send_section_size = nvdev->send_section_size; | |
| 1701 | − device_info.recv_sections = new_rx; | |
| 1702 | − device_info.recv_section_size = nvdev->recv_section_size; | |
| 1729 | + device_info = netvsc_devinfo_get(nvdev); | |
| 1730 | + | |
| 1731 | + if (!device_info) | |
| 1732 | + return -ENOMEM; | |
| 1733 | + | |
| 1734 | + device_info->send_sections = new_tx; | |
| 1735 | + device_info->recv_sections = new_rx; | |
| 1703 | 1736 | |
| 1704 | 1737 | ret = netvsc_detach(ndev, nvdev); |
| 1705 | 1738 | if (ret) |
| 1706 | − return ret; | |
| 1739 | + goto out; | |
| 1707 | 1740 | |
| 1708 | − ret = netvsc_attach(ndev, &device_info); | |
| 1741 | + ret = netvsc_attach(ndev, device_info); | |
| 1709 | 1742 | if (ret) { |
| 1710 | − device_info.send_sections = orig.tx_pending; | |
| 1711 | − device_info.recv_sections = orig.rx_pending; | |
| 1743 | + device_info->send_sections = orig.tx_pending; | |
| 1744 | + device_info->recv_sections = orig.rx_pending; | |
| 1712 | 1745 | |
| 1713 | − if (netvsc_attach(ndev, &device_info)) | |
| 1746 | + if (netvsc_attach(ndev, device_info)) | |
| 1714 | 1747 | netdev_err(ndev, "restoring ringparam failed"); |
| 1715 | 1748 | } |
| 1716 | 1749 | |
| 1750 | +out: | |
| 1751 | + kfree(device_info); | |
| 1717 | 1752 | return ret; |
| 1718 | 1753 | } |
| 1719 | 1754 | |
| @@ -2088,7 +2123,7 @@ static int netvsc_register_vf(struct net_device *vf_netdev) · 368 unmodified lines | ||
| 2088 | 2123 | if (!netvsc_dev || rtnl_dereference(net_device_ctx->vf_netdev)) |
| 2089 | 2124 | return NOTIFY_DONE; |
| 2090 | 2125 | |
| 2091 | − /* if syntihetic interface is a different namespace, | |
| 2126 | + /* if synthetic interface is a different namespace, | |
| 2092 | 2127 | * then move the VF to that namespace; join will be |
| 2093 | 2128 | * done again in that context. |
| 2094 | 2129 | */ |
| @@ -2167,7 +2202,7 @@ static int netvsc_probe(struct hv_device *dev, · 72 unmodified lines | ||
| 2167 | 2202 | { |
| 2168 | 2203 | struct net_device *net = NULL; |
| 2169 | 2204 | struct net_device_context *net_device_ctx; |
| 2170 | − struct netvsc_device_info device_info; | |
| 2205 | + struct netvsc_device_info *device_info = NULL; | |
| 2171 | 2206 | struct netvsc_device *nvdev; |
| 2172 | 2207 | int ret = -ENOMEM; |
| 2173 | 2208 | |
| @@ -2214,21 +2249,21 @@ static int netvsc_probe(struct hv_device *dev, · 40 unmodified lines | ||
| 2214 | 2249 | netif_set_real_num_rx_queues(net, 1); |
| 2215 | 2250 | |
| 2216 | 2251 | /* Notify the netvsc driver of the new device */ |
| 2217 | − memset(&device_info, 0, sizeof(device_info)); | |
| 2218 | − device_info.num_chn = VRSS_CHANNEL_DEFAULT; | |
| 2219 | − device_info.send_sections = NETVSC_DEFAULT_TX; | |
| 2220 | − device_info.send_section_size = NETVSC_SEND_SECTION_SIZE; | |
| 2221 | − device_info.recv_sections = NETVSC_DEFAULT_RX; | |
| 2222 | − device_info.recv_section_size = NETVSC_RECV_SECTION_SIZE; | |
| 2223 | − | |
| 2224 | − nvdev = rndis_filter_device_add(dev, &device_info); | |
| 2252 | + device_info = netvsc_devinfo_get(NULL); | |
| 2253 | + | |
| 2254 | + if (!device_info) { | |
| 2255 | + ret = -ENOMEM; | |
| 2256 | + goto devinfo_failed; | |
| 2257 | + } | |
| 2258 | + | |
| 2259 | + nvdev = rndis_filter_device_add(dev, device_info); | |
| 2225 | 2260 | if (IS_ERR(nvdev)) { |
| 2226 | 2261 | ret = PTR_ERR(nvdev); |
| 2227 | 2262 | netdev_err(net, "unable to add netvsc device (ret %d)\n", ret); |
| 2228 | 2263 | goto rndis_failed; |
| 2229 | 2264 | } |
| 2230 | 2265 | |
| 2231 | − memcpy(net->dev_addr, device_info.mac_adr, ETH_ALEN); | |
| 2266 | + memcpy(net->dev_addr, device_info->mac_adr, ETH_ALEN); | |
| 2232 | 2267 | |
| 2233 | 2268 | /* We must get rtnl lock before scheduling nvdev->subchan_work, |
| 2234 | 2269 | * otherwise netvsc_subchan_work() can get rtnl lock first and wait |
| @@ -2236,7 +2271,7 @@ static int netvsc_probe(struct hv_device *dev, · 1 unmodified line | ||
| 2236 | 2271 | * netvsc_probe() can't get rtnl lock and as a result vmbus_onoffer() |
| 2237 | 2272 | * -> ... -> device_add() -> ... -> __device_attach() can't get |
| 2238 | 2273 | * the device lock, so all the subchannels can't be processed -- |
| 2239 | − * finally netvsc_subchan_work() hangs for ever. | |
| 2274 | + * finally netvsc_subchan_work() hangs forever. | |
| 2240 | 2275 | */ |
| 2241 | 2276 | rtnl_lock(); |
| 2242 | 2277 | |
| @@ -2266,12 +2301,16 @@ static int netvsc_probe(struct hv_device *dev, · 23 unmodified lines | ||
| 2266 | 2301 | |
| 2267 | 2302 | list_add(&net_device_ctx->list, &netvsc_dev_list); |
| 2268 | 2303 | rtnl_unlock(); |
| 2304 | + | |
| 2305 | + kfree(device_info); | |
| 2269 | 2306 | return 0; |
| 2270 | 2307 | |
| 2271 | 2308 | register_failed: |
| 2272 | 2309 | rtnl_unlock(); |
| 2273 | 2310 | rndis_filter_device_remove(dev, nvdev); |
| 2274 | 2311 | rndis_failed: |
| 2312 | + kfree(device_info); | |
| 2313 | +devinfo_failed: | |
| 2275 | 2314 | free_percpu(net_device_ctx->vf_stats); |
| 2276 | 2315 | no_stats: |
| 2277 | 2316 | hv_set_drvdata(dev, NULL); |
| @@ -774,8 +774,8 @@ cleanup: · 773 unmodified lines | ||
| 774 | 774 | return ret; |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | −int rndis_filter_set_rss_param(struct rndis_device *rdev, | |
| 778 | − const u8 *rss_key) | |
| 777 | +static int rndis_set_rss_param_msg(struct rndis_device *rdev, | |
| 778 | + const u8 *rss_key, u16 flag) | |
| 779 | 779 | { |
| 780 | 780 | struct net_device *ndev = rdev->ndev; |
| 781 | 781 | struct rndis_request *request; |
| @@ -804,7 +804,7 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev, · 22 unmodified lines | ||
| 804 | 804 | rssp->hdr.type = NDIS_OBJECT_TYPE_RSS_PARAMETERS; |
| 805 | 805 | rssp->hdr.rev = NDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2; |
| 806 | 806 | rssp->hdr.size = sizeof(struct ndis_recv_scale_param); |
| 807 | − rssp->flag = 0; | |
| 807 | + rssp->flag = flag; | |
| 808 | 808 | rssp->hashinfo = NDIS_HASH_FUNC_TOEPLITZ | NDIS_HASH_IPV4 | |
| 809 | 809 | NDIS_HASH_TCP_IPV4 | NDIS_HASH_IPV6 | |
| 810 | 810 | NDIS_HASH_TCP_IPV6; |
| @@ -829,9 +829,12 @@ int rndis_filter_set_rss_param(struct rndis_device *rdev, · 18 unmodified lines | ||
| 829 | 829 | |
| 830 | 830 | wait_for_completion(&request->wait_event); |
| 831 | 831 | set_complete = &request->response_msg.msg.set_complete; |
| 832 | − if (set_complete->status == RNDIS_STATUS_SUCCESS) | |
| 833 | − memcpy(rdev->rss_key, rss_key, NETVSC_HASH_KEYLEN); | |
| 834 | − else { | |
| 832 | + if (set_complete->status == RNDIS_STATUS_SUCCESS) { | |
| 833 | + if (!(flag & NDIS_RSS_PARAM_FLAG_DISABLE_RSS) && | |
| 834 | + !(flag & NDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED)) | |
| 835 | + memcpy(rdev->rss_key, rss_key, NETVSC_HASH_KEYLEN); | |
| 836 | + | |
| 837 | + } else { | |
| 835 | 838 | netdev_err(ndev, "Fail to set RSS parameters:0x%x\n", |
| 836 | 839 | set_complete->status); |
| 837 | 840 | ret = -EINVAL; |
| @@ -842,6 +845,16 @@ cleanup: · 4 unmodified lines | ||
| 842 | 845 | return ret; |
| 843 | 846 | } |
| 844 | 847 | |
| 848 | +int rndis_filter_set_rss_param(struct rndis_device *rdev, | |
| 849 | + const u8 *rss_key) | |
| 850 | +{ | |
| 851 | + /* Disable RSS before change */ | |
| 852 | + rndis_set_rss_param_msg(rdev, rss_key, | |
| 853 | + NDIS_RSS_PARAM_FLAG_DISABLE_RSS); | |
| 854 | + | |
| 855 | + return rndis_set_rss_param_msg(rdev, rss_key, 0); | |
| 856 | +} | |
| 857 | + | |
| 845 | 858 | static int rndis_filter_query_device_link_status(struct rndis_device *dev, |
| 846 | 859 | struct netvsc_device *net_device) |
| 847 | 860 | { |
| @@ -1121,7 +1134,9 @@ static void netvsc_sc_open(struct vmbus_channel *new_sc) · 273 unmodified lines | ||
| 1121 | 1134 | * This breaks overlap of processing the host message for the |
| 1122 | 1135 | * new primary channel with the initialization of sub-channels. |
| 1123 | 1136 | */ |
| 1124 | −int rndis_set_subchannel(struct net_device *ndev, struct netvsc_device *nvdev) | |
| 1137 | +int rndis_set_subchannel(struct net_device *ndev, | |
| 1138 | + struct netvsc_device *nvdev, | |
| 1139 | + struct netvsc_device_info *dev_info) | |
| 1125 | 1140 | { |
| 1126 | 1141 | struct nvsp_message *init_packet = &nvdev->channel_init_pkt; |
| 1127 | 1142 | struct net_device_context *ndev_ctx = netdev_priv(ndev); |
| @@ -1161,8 +1176,11 @@ int rndis_set_subchannel(struct net_device *ndev, struct netvsc_device *nvdev) · 33 unmodified lines | ||
| 1161 | 1176 | wait_event(nvdev->subchan_open, |
| 1162 | 1177 | atomic_read(&nvdev->open_chn) == nvdev->num_chn); |
| 1163 | 1178 | |
| 1164 | − /* ignore failues from setting rss parameters, still have channels */ | |
| 1165 | − rndis_filter_set_rss_param(rdev, netvsc_hash_key); | |
| 1179 | + /* ignore failures from setting rss parameters, still have channels */ | |
| 1180 | + if (dev_info) | |
| 1181 | + rndis_filter_set_rss_param(rdev, dev_info->rss_key); | |
| 1182 | + else | |
| 1183 | + rndis_filter_set_rss_param(rdev, netvsc_hash_key); | |
| 1166 | 1184 | |
| 1167 | 1185 | netif_set_real_num_tx_queues(ndev, nvdev->num_chn); |
| 1168 | 1186 | netif_set_real_num_rx_queues(ndev, nvdev->num_chn); |
| @@ -337,7 +337,7 @@ static void macvlan_process_broadcast(struct work_struct *w) · 336 unmodified lines | ||
| 337 | 337 | |
| 338 | 338 | if (src) |
| 339 | 339 | dev_put(src->dev); |
| 340 | − kfree_skb(skb); | |
| 340 | + consume_skb(skb); | |
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
| @@ -1,13 +1,7 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 1 | +// SPDX-License-Identifier: GPL-2.0+ | |
| 2 | 2 | /* Driver for Asix PHYs |
| 3 | 3 | * |
| 4 | 4 | * Author: Michael Schmitz <schmitzmic@gmail.com> |
| 5 | − * | |
| 6 | − * This program is free software; you can redistribute it and/or modify it | |
| 7 | − * under the terms of the GNU General Public License as published by the | |
| 8 | − * Free Software Foundation; either version 2 of the License, or (at your | |
| 9 | − * option) any later version. | |
| 10 | − * | |
| 11 | 5 | */ |
| 12 | 6 | #include <linux/kernel.h> |
| 13 | 7 | #include <linux/errno.h> |
| @@ -197,6 +197,7 @@ static struct phy_driver bcm87xx_driver[] = { · 196 unmodified lines | ||
| 197 | 197 | .phy_id = PHY_ID_BCM8706, |
| 198 | 198 | .phy_id_mask = 0xffffffff, |
| 199 | 199 | .name = "Broadcom BCM8706", |
| 200 | + .features = PHY_10GBIT_FEC_FEATURES, | |
| 200 | 201 | .config_init = bcm87xx_config_init, |
| 201 | 202 | .config_aneg = bcm87xx_config_aneg, |
| 202 | 203 | .read_status = bcm87xx_read_status, |
| @@ -208,6 +209,7 @@ static struct phy_driver bcm87xx_driver[] = { · 5 unmodified lines | ||
| 208 | 209 | .phy_id = PHY_ID_BCM8727, |
| 209 | 210 | .phy_id_mask = 0xffffffff, |
| 210 | 211 | .name = "Broadcom BCM8727", |
| 212 | + .features = PHY_10GBIT_FEC_FEATURES, | |
| 211 | 213 | .config_init = bcm87xx_config_init, |
| 212 | 214 | .config_aneg = bcm87xx_config_aneg, |
| 213 | 215 | .read_status = bcm87xx_read_status, |
| @@ -88,6 +88,7 @@ static struct phy_driver cortina_driver[] = { · 87 unmodified lines | ||
| 88 | 88 | .phy_id = PHY_ID_CS4340, |
| 89 | 89 | .phy_id_mask = 0xffffffff, |
| 90 | 90 | .name = "Cortina CS4340", |
| 91 | + .features = PHY_10GBIT_FEATURES, | |
| 91 | 92 | .config_init = gen10g_config_init, |
| 92 | 93 | .config_aneg = gen10g_config_aneg, |
| 93 | 94 | .read_status = cortina_read_status, |
| @@ -1046,6 +1046,39 @@ static int m88e1145_config_init(struct phy_device *phydev) · 1045 unmodified lines | ||
| 1046 | 1046 | return 0; |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | +/* The VOD can be out of specification on link up. Poke an | |
| 1050 | + * undocumented register, in an undocumented page, with a magic value | |
| 1051 | + * to fix this. | |
| 1052 | + */ | |
| 1053 | +static int m88e6390_errata(struct phy_device *phydev) | |
| 1054 | +{ | |
| 1055 | + int err; | |
| 1056 | + | |
| 1057 | + err = phy_write(phydev, MII_BMCR, | |
| 1058 | + BMCR_ANENABLE | BMCR_SPEED1000 | BMCR_FULLDPLX); | |
| 1059 | + if (err) | |
| 1060 | + return err; | |
| 1061 | + | |
| 1062 | + usleep_range(300, 400); | |
| 1063 | + | |
| 1064 | + err = phy_write_paged(phydev, 0xf8, 0x08, 0x36); | |
| 1065 | + if (err) | |
| 1066 | + return err; | |
| 1067 | + | |
| 1068 | + return genphy_soft_reset(phydev); | |
| 1069 | +} | |
| 1070 | + | |
| 1071 | +static int m88e6390_config_aneg(struct phy_device *phydev) | |
| 1072 | +{ | |
| 1073 | + int err; | |
| 1074 | + | |
| 1075 | + err = m88e6390_errata(phydev); | |
| 1076 | + if (err) | |
| 1077 | + return err; | |
| 1078 | + | |
| 1079 | + return m88e1510_config_aneg(phydev); | |
| 1080 | +} | |
| 1081 | + | |
| 1049 | 1082 | /** |
| 1050 | 1083 | * fiber_lpa_mod_linkmode_lpa_t |
| 1051 | 1084 | * @advertising: the linkmode advertisement settings |
| @@ -1402,7 +1435,7 @@ static int m88e1318_set_wol(struct phy_device *phydev, · 350 unmodified lines | ||
| 1402 | 1435 | * before enabling it if !phy_interrupt_is_valid() |
| 1403 | 1436 | */ |
| 1404 | 1437 | if (!phy_interrupt_is_valid(phydev)) |
| 1405 | − phy_read(phydev, MII_M1011_IEVENT); | |
| 1438 | + __phy_read(phydev, MII_M1011_IEVENT); | |
| 1406 | 1439 | |
| 1407 | 1440 | /* Enable the WOL interrupt */ |
| 1408 | 1441 | err = __phy_modify(phydev, MII_88E1318S_PHY_CSIER, 0, |
| @@ -2283,7 +2316,7 @@ static struct phy_driver marvell_drivers[] = { · 874 unmodified lines | ||
| 2283 | 2316 | .features = PHY_GBIT_FEATURES, |
| 2284 | 2317 | .probe = m88e6390_probe, |
| 2285 | 2318 | .config_init = &marvell_config_init, |
| 2286 | − .config_aneg = &m88e1510_config_aneg, | |
| 2319 | + .config_aneg = &m88e6390_config_aneg, | |
| 2287 | 2320 | .read_status = &marvell_read_status, |
| 2288 | 2321 | .ack_interrupt = &marvell_ack_interrupt, |
| 2289 | 2322 | .config_intr = &marvell_config_intr, |
| @@ -1,20 +1,8 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0+ | |
| 1 | 2 | /* |
| 2 | 3 | * Hisilicon Fast Ethernet MDIO Bus Driver |
| 3 | 4 | * |
| 4 | 5 | * Copyright (c) 2016 HiSilicon Technologies Co., Ltd. |
| 5 | − * | |
| 6 | − * This program is free software; you can redistribute it and/or modify | |
| 7 | − * it under the terms of the GNU General Public License as published by | |
| 8 | − * the Free Software Foundation; either version 2 of the License, or | |
| 9 | − * (at your option) any later version. | |
| 10 | − * | |
| 11 | − * This program is distributed in the hope that it will be useful, | |
| 12 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | − * GNU General Public License for more details. | |
| 15 | − * | |
| 16 | − * You should have received a copy of the GNU General Public License | |
| 17 | − * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 18 | 6 | */ |
| 19 | 7 | |
| 20 | 8 | #include <linux/clk.h> |
| @@ -163,4 +151,4 @@ module_platform_driver(hisi_femac_mdio_driver); · 142 unmodified lines | ||
| 163 | 151 | |
| 164 | 152 | MODULE_DESCRIPTION("Hisilicon Fast Ethernet MAC MDIO interface driver"); |
| 165 | 153 | MODULE_AUTHOR("Dongpo Li <lidongpo@hisilicon.com>"); |
| 166 | −MODULE_LICENSE("GPL v2"); | |
| 154 | +MODULE_LICENSE("GPL"); | |
| @@ -390,6 +390,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) · 389 unmodified lines | ||
| 390 | 390 | if (IS_ERR(gpiod)) { |
| 391 | 391 | dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n", |
| 392 | 392 | bus->id); |
| 393 | + device_del(&bus->dev); | |
| 393 | 394 | return PTR_ERR(gpiod); |
| 394 | 395 | } else if (gpiod) { |
| 395 | 396 | bus->reset_gpiod = gpiod; |
| @@ -233,6 +233,7 @@ static struct phy_driver meson_gxl_phy[] = { · 232 unmodified lines | ||
| 233 | 233 | .name = "Meson GXL Internal PHY", |
| 234 | 234 | .features = PHY_BASIC_FEATURES, |
| 235 | 235 | .flags = PHY_IS_INTERNAL, |
| 236 | + .soft_reset = genphy_soft_reset, | |
| 236 | 237 | .config_init = meson_gxl_config_init, |
| 237 | 238 | .aneg_done = genphy_aneg_done, |
| 238 | 239 | .read_status = meson_gxl_read_status, |
| @@ -1070,6 +1070,7 @@ static struct phy_driver ksphy_driver[] = { · 1069 unmodified lines | ||
| 1070 | 1070 | .driver_data = &ksz9021_type, |
| 1071 | 1071 | .probe = kszphy_probe, |
| 1072 | 1072 | .config_init = ksz9031_config_init, |
| 1073 | + .soft_reset = genphy_soft_reset, | |
| 1073 | 1074 | .read_status = ksz9031_read_status, |
| 1074 | 1075 | .ack_interrupt = kszphy_ack_interrupt, |
| 1075 | 1076 | .config_intr = kszphy_config_intr, |
| @@ -1098,6 +1099,7 @@ static struct phy_driver ksphy_driver[] = { · 22 unmodified lines | ||
| 1098 | 1099 | .phy_id = PHY_ID_KSZ8873MLL, |
| 1099 | 1100 | .phy_id_mask = MICREL_PHY_ID_MASK, |
| 1100 | 1101 | .name = "Micrel KSZ8873MLL Switch", |
| 1102 | + .features = PHY_BASIC_FEATURES, | |
| 1101 | 1103 | .config_init = kszphy_config_init, |
| 1102 | 1104 | .config_aneg = ksz8873mll_config_aneg, |
| 1103 | 1105 | .read_status = ksz8873mll_read_status, |
| @@ -543,13 +543,6 @@ int phy_start_aneg(struct phy_device *phydev) · 542 unmodified lines | ||
| 543 | 543 | |
| 544 | 544 | mutex_lock(&phydev->lock); |
| 545 | 545 | |
| 546 | − if (!__phy_is_started(phydev)) { | |
| 547 | − WARN(1, "called from state %s\n", | |
| 548 | − phy_state_to_str(phydev->state)); | |
| 549 | − err = -EBUSY; | |
| 550 | − goto out_unlock; | |
| 551 | − } | |
| 552 | − | |
| 553 | 546 | if (AUTONEG_DISABLE == phydev->autoneg) |
| 554 | 547 | phy_sanitize_settings(phydev); |
| 555 | 548 | |
| @@ -560,11 +553,13 @@ int phy_start_aneg(struct phy_device *phydev) · 4 unmodified lines | ||
| 560 | 553 | if (err < 0) |
| 561 | 554 | goto out_unlock; |
| 562 | 555 | |
| 563 | − if (phydev->autoneg == AUTONEG_ENABLE) { | |
| 564 | − err = phy_check_link_status(phydev); | |
| 565 | − } else { | |
| 566 | − phydev->state = PHY_FORCING; | |
| 567 | − phydev->link_timeout = PHY_FORCE_TIMEOUT; | |
| 556 | + if (__phy_is_started(phydev)) { | |
| 557 | + if (phydev->autoneg == AUTONEG_ENABLE) { | |
| 558 | + err = phy_check_link_status(phydev); | |
| 559 | + } else { | |
| 560 | + phydev->state = PHY_FORCING; | |
| 561 | + phydev->link_timeout = PHY_FORCE_TIMEOUT; | |
| 562 | + } | |
| 568 | 563 | } |
| 569 | 564 | |
| 570 | 565 | out_unlock: |
| @@ -61,6 +61,9 @@ EXPORT_SYMBOL_GPL(phy_gbit_all_ports_features); · 60 unmodified lines | ||
| 61 | 61 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_features) __ro_after_init; |
| 62 | 62 | EXPORT_SYMBOL_GPL(phy_10gbit_features); |
| 63 | 63 | |
| 64 | +__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_fec_features) __ro_after_init; | |
| 65 | +EXPORT_SYMBOL_GPL(phy_10gbit_fec_features); | |
| 66 | + | |
| 64 | 67 | static const int phy_basic_ports_array[] = { |
| 65 | 68 | ETHTOOL_LINK_MODE_Autoneg_BIT, |
| 66 | 69 | ETHTOOL_LINK_MODE_TP_BIT, |
| @@ -109,6 +112,11 @@ const int phy_10gbit_features_array[1] = { · 42 unmodified lines | ||
| 109 | 112 | }; |
| 110 | 113 | EXPORT_SYMBOL_GPL(phy_10gbit_features_array); |
| 111 | 114 | |
| 115 | +const int phy_10gbit_fec_features_array[1] = { | |
| 116 | + ETHTOOL_LINK_MODE_10000baseR_FEC_BIT, | |
| 117 | +}; | |
| 118 | +EXPORT_SYMBOL_GPL(phy_10gbit_fec_features_array); | |
| 119 | + | |
| 112 | 120 | __ETHTOOL_DECLARE_LINK_MODE_MASK(phy_10gbit_full_features) __ro_after_init; |
| 113 | 121 | EXPORT_SYMBOL_GPL(phy_10gbit_full_features); |
| 114 | 122 | |
| @@ -191,6 +199,10 @@ static void features_init(void) · 76 unmodified lines | ||
| 191 | 199 | linkmode_set_bit_array(phy_10gbit_full_features_array, |
| 192 | 200 | ARRAY_SIZE(phy_10gbit_full_features_array), |
| 193 | 201 | phy_10gbit_full_features); |
| 202 | + /* 10G FEC only */ | |
| 203 | + linkmode_set_bit_array(phy_10gbit_fec_features_array, | |
| 204 | + ARRAY_SIZE(phy_10gbit_fec_features_array), | |
| 205 | + phy_10gbit_fec_features); | |
| 194 | 206 | } |
| 195 | 207 | |
| 196 | 208 | void phy_device_free(struct phy_device *phydev) |
| @@ -2243,6 +2255,11 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner) · 2046 unmodified lines | ||
| 2243 | 2255 | { |
| 2244 | 2256 | int retval; |
| 2245 | 2257 | |
| 2258 | + if (WARN_ON(!new_driver->features)) { | |
| 2259 | + pr_err("%s: Driver features are missing\n", new_driver->name); | |
| 2260 | + return -EINVAL; | |
| 2261 | + } | |
| 2262 | + | |
| 2246 | 2263 | new_driver->mdiodrv.flags |= MDIO_DEVICE_IS_PHY; |
| 2247 | 2264 | new_driver->mdiodrv.driver.name = new_driver->name; |
| 2248 | 2265 | new_driver->mdiodrv.driver.bus = &mdio_bus_type; |
| @@ -1,3 +1,4 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0+ | |
| 1 | 2 | /** |
| 2 | 3 | * drivers/net/phy/rockchip.c |
| 3 | 4 | * |
| @@ -6,12 +7,6 @@ · 2 unmodified lines | ||
| 6 | 7 | * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd |
| 7 | 8 | * |
| 8 | 9 | * David Wu <david.wu@rock-chips.com> |
| 9 | − * | |
| 10 | − * This program is free software; you can redistribute it and/or modify | |
| 11 | − * it under the terms of the GNU General Public License as published by | |
| 12 | − * the Free Software Foundation; either version 2 of the License, or | |
| 13 | − * (at your option) any later version. | |
| 14 | − * | |
| 15 | 10 | */ |
| 16 | 11 | |
| 17 | 12 | #include <linux/ethtool.h> |
| @@ -229,4 +224,4 @@ MODULE_DEVICE_TABLE(mdio, rockchip_phy_tbl); · 211 unmodified lines | ||
| 229 | 224 | |
| 230 | 225 | MODULE_AUTHOR("David Wu <david.wu@rock-chips.com>"); |
| 231 | 226 | MODULE_DESCRIPTION("Rockchip Ethernet PHY driver"); |
| 232 | −MODULE_LICENSE("GPL v2"); | |
| 227 | +MODULE_LICENSE("GPL"); | |
| @@ -80,6 +80,7 @@ static struct phy_driver teranetics_driver[] = { · 79 unmodified lines | ||
| 80 | 80 | .phy_id = PHY_ID_TN2020, |
| 81 | 81 | .phy_id_mask = 0xffffffff, |
| 82 | 82 | .name = "Teranetics TN2020", |
| 83 | + .features = PHY_10GBIT_FEATURES, | |
| 83 | 84 | .soft_reset = gen10g_no_soft_reset, |
| 84 | 85 | .aneg_done = teranetics_aneg_done, |
| 85 | 86 | .config_init = gen10g_config_init, |
| @@ -445,6 +445,7 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev, · 444 unmodified lines | ||
| 445 | 445 | if (pskb_trim_rcsum(skb, len)) |
| 446 | 446 | goto drop; |
| 447 | 447 | |
| 448 | + ph = pppoe_hdr(skb); | |
| 448 | 449 | pn = pppoe_pernet(dev_net(dev)); |
| 449 | 450 | |
| 450 | 451 | /* Note that get_item does a sock_hold(), so sk_pppox(po) |
| @@ -856,10 +856,6 @@ static int tun_attach(struct tun_struct *tun, struct file *file, · 855 unmodified lines | ||
| 856 | 856 | err = 0; |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | − rcu_assign_pointer(tfile->tun, tun); | |
| 860 | − rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); | |
| 861 | − tun->numqueues++; | |
| 862 | − | |
| 863 | 859 | if (tfile->detached) { |
| 864 | 860 | tun_enable_queue(tfile); |
| 865 | 861 | } else { |
| @@ -876,6 +872,13 @@ static int tun_attach(struct tun_struct *tun, struct file *file, · 10 unmodified lines | ||
| 876 | 872 | * refcnt. |
| 877 | 873 | */ |
| 878 | 874 | |
| 875 | + /* Publish tfile->tun and tun->tfiles only after we've fully | |
| 876 | + * initialized tfile; otherwise we risk using half-initialized | |
| 877 | + * object. | |
| 878 | + */ | |
| 879 | + rcu_assign_pointer(tfile->tun, tun); | |
| 880 | + rcu_assign_pointer(tun->tfiles[tun->numqueues], tfile); | |
| 881 | + tun->numqueues++; | |
| 879 | 882 | out: |
| 880 | 883 | return err; |
| 881 | 884 | } |
| @@ -1287,6 +1287,20 @@ static const struct driver_info asix112_info = { · 1286 unmodified lines | ||
| 1287 | 1287 | |
| 1288 | 1288 | #undef ASIX112_DESC |
| 1289 | 1289 | |
| 1290 | +static const struct driver_info trendnet_info = { | |
| 1291 | + .description = "USB-C 3.1 to 5GBASE-T Ethernet Adapter", | |
| 1292 | + .bind = aqc111_bind, | |
| 1293 | + .unbind = aqc111_unbind, | |
| 1294 | + .status = aqc111_status, | |
| 1295 | + .link_reset = aqc111_link_reset, | |
| 1296 | + .reset = aqc111_reset, | |
| 1297 | + .stop = aqc111_stop, | |
| 1298 | + .flags = FLAG_ETHER | FLAG_FRAMING_AX | | |
| 1299 | + FLAG_AVOID_UNLINK_URBS | FLAG_MULTI_PACKET, | |
| 1300 | + .rx_fixup = aqc111_rx_fixup, | |
| 1301 | + .tx_fixup = aqc111_tx_fixup, | |
| 1302 | +}; | |
| 1303 | + | |
| 1290 | 1304 | static int aqc111_suspend(struct usb_interface *intf, pm_message_t message) |
| 1291 | 1305 | { |
| 1292 | 1306 | struct usbnet *dev = usb_get_intfdata(intf); |
| @@ -1440,6 +1454,7 @@ static const struct usb_device_id products[] = { · 147 unmodified lines | ||
| 1440 | 1454 | {AQC111_USB_ETH_DEV(0x2eca, 0xc101, aqc111_info)}, |
| 1441 | 1455 | {AQC111_USB_ETH_DEV(0x0b95, 0x2790, asix111_info)}, |
| 1442 | 1456 | {AQC111_USB_ETH_DEV(0x0b95, 0x2791, asix112_info)}, |
| 1457 | + {AQC111_USB_ETH_DEV(0x20f4, 0xe05a, trendnet_info)}, | |
| 1443 | 1458 | { },/* END */ |
| 1444 | 1459 | }; |
| 1445 | 1460 | MODULE_DEVICE_TABLE(usb, products); |
| @@ -739,8 +739,13 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) · 738 unmodified lines | ||
| 739 | 739 | asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0); |
| 740 | 740 | chipcode &= AX_CHIPCODE_MASK; |
| 741 | 741 | |
| 742 | − (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) : | |
| 743 | − ax88772a_hw_reset(dev, 0); | |
| 742 | + ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) : | |
| 743 | + ax88772a_hw_reset(dev, 0); | |
| 744 | + | |
| 745 | + if (ret < 0) { | |
| 746 | + netdev_dbg(dev->net, "Failed to reset AX88772: %d\n", ret); | |
| 747 | + return ret; | |
| 748 | + } | |
| 744 | 749 | |
| 745 | 750 | /* Read PHYID register *AFTER* the PHY was reset properly */ |
| 746 | 751 | phyid = asix_get_phyid(dev); |
| @@ -179,10 +179,8 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) · 178 unmodified lines | ||
| 179 | 179 | * probed with) and a slave/data interface; union |
| 180 | 180 | * descriptors sort this all out. |
| 181 | 181 | */ |
| 182 | − info->control = usb_ifnum_to_if(dev->udev, | |
| 183 | − info->u->bMasterInterface0); | |
| 184 | − info->data = usb_ifnum_to_if(dev->udev, | |
| 185 | − info->u->bSlaveInterface0); | |
| 182 | + info->control = usb_ifnum_to_if(dev->udev, info->u->bMasterInterface0); | |
| 183 | + info->data = usb_ifnum_to_if(dev->udev, info->u->bSlaveInterface0); | |
| 186 | 184 | if (!info->control || !info->data) { |
| 187 | 185 | dev_dbg(&intf->dev, |
| 188 | 186 | "master #%u/%p slave #%u/%p\n", |
| @@ -216,18 +214,16 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) · 27 unmodified lines | ||
| 216 | 214 | /* a data interface altsetting does the real i/o */ |
| 217 | 215 | d = &info->data->cur_altsetting->desc; |
| 218 | 216 | if (d->bInterfaceClass != USB_CLASS_CDC_DATA) { |
| 219 | − dev_dbg(&intf->dev, "slave class %u\n", | |
| 220 | − d->bInterfaceClass); | |
| 217 | + dev_dbg(&intf->dev, "slave class %u\n", d->bInterfaceClass); | |
| 221 | 218 | goto bad_desc; |
| 222 | 219 | } |
| 223 | 220 | skip: |
| 224 | − if ( rndis && | |
| 225 | − header.usb_cdc_acm_descriptor && | |
| 226 | − header.usb_cdc_acm_descriptor->bmCapabilities) { | |
| 227 | − dev_dbg(&intf->dev, | |
| 228 | − "ACM capabilities %02x, not really RNDIS?\n", | |
| 229 | − header.usb_cdc_acm_descriptor->bmCapabilities); | |
| 230 | − goto bad_desc; | |
| 221 | + if (rndis && header.usb_cdc_acm_descriptor && | |
| 222 | + header.usb_cdc_acm_descriptor->bmCapabilities) { | |
| 223 | + dev_dbg(&intf->dev, | |
| 224 | + "ACM capabilities %02x, not really RNDIS?\n", | |
| 225 | + header.usb_cdc_acm_descriptor->bmCapabilities); | |
| 226 | + goto bad_desc; | |
| 231 | 227 | } |
| 232 | 228 | |
| 233 | 229 | if (header.usb_cdc_ether_desc && info->ether->wMaxSegmentSize) { |
| @@ -238,7 +234,7 @@ skip: · 4 unmodified lines | ||
| 238 | 234 | } |
| 239 | 235 | |
| 240 | 236 | if (header.usb_cdc_mdlm_desc && |
| 241 | − memcmp(header.usb_cdc_mdlm_desc->bGUID, mbm_guid, 16)) { | |
| 237 | + memcmp(header.usb_cdc_mdlm_desc->bGUID, mbm_guid, 16)) { | |
| 242 | 238 | dev_dbg(&intf->dev, "GUID doesn't match\n"); |
| 243 | 239 | goto bad_desc; |
| 244 | 240 | } |
| @@ -302,7 +298,7 @@ skip: · 57 unmodified lines | ||
| 302 | 298 | if (info->control->cur_altsetting->desc.bNumEndpoints == 1) { |
| 303 | 299 | struct usb_endpoint_descriptor *desc; |
| 304 | 300 | |
| 305 | − dev->status = &info->control->cur_altsetting->endpoint [0]; | |
| 301 | + dev->status = &info->control->cur_altsetting->endpoint[0]; | |
| 306 | 302 | desc = &dev->status->desc; |
| 307 | 303 | if (!usb_endpoint_is_int_in(desc) || |
| 308 | 304 | (le16_to_cpu(desc->wMaxPacketSize) |
| @@ -847,6 +843,14 @@ static const struct usb_device_id products[] = { · 538 unmodified lines | ||
| 847 | 843 | .driver_info = 0, |
| 848 | 844 | }, |
| 849 | 845 | |
| 846 | +/* USB-C 3.1 to 5GBASE-T Ethernet Adapter (based on AQC111U) */ | |
| 847 | +{ | |
| 848 | + USB_DEVICE_AND_INTERFACE_INFO(0x20f4, 0xe05a, USB_CLASS_COMM, | |
| 849 | + USB_CDC_SUBCLASS_ETHERNET, | |
| 850 | + USB_CDC_PROTO_NONE), | |
| 851 | + .driver_info = 0, | |
| 852 | +}, | |
| 853 | + | |
| 850 | 854 | /* WHITELIST!!! |
| 851 | 855 | * |
| 852 | 856 | * CDC Ether uses two interfaces, not necessarily consecutive. |
| @@ -123,6 +123,7 @@ static void qmimux_setup(struct net_device *dev) · 122 unmodified lines | ||
| 123 | 123 | dev->addr_len = 0; |
| 124 | 124 | dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; |
| 125 | 125 | dev->netdev_ops = &qmimux_netdev_ops; |
| 126 | + dev->mtu = 1500; | |
| 126 | 127 | dev->needs_free_netdev = true; |
| 127 | 128 | } |
| 128 | 129 | |
| @@ -1330,7 +1330,7 @@ static int virtnet_receive(struct receive_queue *rq, int budget, · 1329 unmodified lines | ||
| 1330 | 1330 | return stats.packets; |
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | −static void free_old_xmit_skbs(struct send_queue *sq) | |
| 1333 | +static void free_old_xmit_skbs(struct send_queue *sq, bool in_napi) | |
| 1334 | 1334 | { |
| 1335 | 1335 | struct sk_buff *skb; |
| 1336 | 1336 | unsigned int len; |
| @@ -1343,7 +1343,7 @@ static void free_old_xmit_skbs(struct send_queue *sq) · 6 unmodified lines | ||
| 1343 | 1343 | bytes += skb->len; |
| 1344 | 1344 | packets++; |
| 1345 | 1345 | |
| 1346 | − dev_consume_skb_any(skb); | |
| 1346 | + napi_consume_skb(skb, in_napi); | |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | 1349 | /* Avoid overhead when no packets have been processed |
| @@ -1369,7 +1369,7 @@ static void virtnet_poll_cleantx(struct receive_queue *rq) · 19 unmodified lines | ||
| 1369 | 1369 | return; |
| 1370 | 1370 | |
| 1371 | 1371 | if (__netif_tx_trylock(txq)) { |
| 1372 | − free_old_xmit_skbs(sq); | |
| 1372 | + free_old_xmit_skbs(sq, true); | |
| 1373 | 1373 | __netif_tx_unlock(txq); |
| 1374 | 1374 | } |
| 1375 | 1375 | |
| @@ -1445,7 +1445,7 @@ static int virtnet_poll_tx(struct napi_struct *napi, int budget) · 69 unmodified lines | ||
| 1445 | 1445 | struct netdev_queue *txq = netdev_get_tx_queue(vi->dev, vq2txq(sq->vq)); |
| 1446 | 1446 | |
| 1447 | 1447 | __netif_tx_lock(txq, raw_smp_processor_id()); |
| 1448 | − free_old_xmit_skbs(sq); | |
| 1448 | + free_old_xmit_skbs(sq, true); | |
| 1449 | 1449 | __netif_tx_unlock(txq); |
| 1450 | 1450 | |
| 1451 | 1451 | virtqueue_napi_complete(napi, sq->vq, 0); |
| @@ -1514,7 +1514,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 62 unmodified lines | ||
| 1514 | 1514 | bool use_napi = sq->napi.weight; |
| 1515 | 1515 | |
| 1516 | 1516 | /* Free up any pending old buffers before queueing new ones. */ |
| 1517 | − free_old_xmit_skbs(sq); | |
| 1517 | + free_old_xmit_skbs(sq, false); | |
| 1518 | 1518 | |
| 1519 | 1519 | if (use_napi && kick) |
| 1520 | 1520 | virtqueue_enable_cb_delayed(sq->vq); |
| @@ -1557,7 +1557,7 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) · 36 unmodified lines | ||
| 1557 | 1557 | if (!use_napi && |
| 1558 | 1558 | unlikely(!virtqueue_enable_cb_delayed(sq->vq))) { |
| 1559 | 1559 | /* More just got used, free them then recheck. */ |
| 1560 | − free_old_xmit_skbs(sq); | |
| 1560 | + free_old_xmit_skbs(sq, false); | |
| 1561 | 1561 | if (sq->vq->num_free >= 2+MAX_SKB_FRAGS) { |
| 1562 | 1562 | netif_start_subqueue(dev, qnum); |
| 1563 | 1563 | virtqueue_disable_cb(sq->vq); |
| @@ -1056,6 +1056,54 @@ static const struct net_device_ops uhdlc_ops = { · 1055 unmodified lines | ||
| 1056 | 1056 | .ndo_tx_timeout = uhdlc_tx_timeout, |
| 1057 | 1057 | }; |
| 1058 | 1058 | |
| 1059 | +static int hdlc_map_iomem(char *name, int init_flag, void __iomem **ptr) | |
| 1060 | +{ | |
| 1061 | + struct device_node *np; | |
| 1062 | + struct platform_device *pdev; | |
| 1063 | + struct resource *res; | |
| 1064 | + static int siram_init_flag; | |
| 1065 | + int ret = 0; | |
| 1066 | + | |
| 1067 | + np = of_find_compatible_node(NULL, NULL, name); | |
| 1068 | + if (!np) | |
| 1069 | + return -EINVAL; | |
| 1070 | + | |
| 1071 | + pdev = of_find_device_by_node(np); | |
| 1072 | + if (!pdev) { | |
| 1073 | + pr_err("%pOFn: failed to lookup pdev\n", np); | |
| 1074 | + of_node_put(np); | |
| 1075 | + return -EINVAL; | |
| 1076 | + } | |
| 1077 | + | |
| 1078 | + of_node_put(np); | |
| 1079 | + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
| 1080 | + if (!res) { | |
| 1081 | + ret = -EINVAL; | |
| 1082 | + goto error_put_device; | |
| 1083 | + } | |
| 1084 | + *ptr = ioremap(res->start, resource_size(res)); | |
| 1085 | + if (!*ptr) { | |
| 1086 | + ret = -ENOMEM; | |
| 1087 | + goto error_put_device; | |
| 1088 | + } | |
| 1089 | + | |
| 1090 | + /* We've remapped the addresses, and we don't need the device any | |
| 1091 | + * more, so we should release it. | |
| 1092 | + */ | |
| 1093 | + put_device(&pdev->dev); | |
| 1094 | + | |
| 1095 | + if (init_flag && siram_init_flag == 0) { | |
| 1096 | + memset_io(*ptr, 0, resource_size(res)); | |
| 1097 | + siram_init_flag = 1; | |
| 1098 | + } | |
| 1099 | + return 0; | |
| 1100 | + | |
| 1101 | +error_put_device: | |
| 1102 | + put_device(&pdev->dev); | |
| 1103 | + | |
| 1104 | + return ret; | |
| 1105 | +} | |
| 1106 | + | |
| 1059 | 1107 | static int ucc_hdlc_probe(struct platform_device *pdev) |
| 1060 | 1108 | { |
| 1061 | 1109 | struct device_node *np = pdev->dev.of_node; |
| @@ -1150,6 +1198,15 @@ static int ucc_hdlc_probe(struct platform_device *pdev) · 88 unmodified lines | ||
| 1150 | 1198 | ret = ucc_of_parse_tdm(np, utdm, ut_info); |
| 1151 | 1199 | if (ret) |
| 1152 | 1200 | goto free_utdm; |
| 1201 | + | |
| 1202 | + ret = hdlc_map_iomem("fsl,t1040-qe-si", 0, | |
| 1203 | + (void __iomem **)&utdm->si_regs); | |
| 1204 | + if (ret) | |
| 1205 | + goto free_utdm; | |
| 1206 | + ret = hdlc_map_iomem("fsl,t1040-qe-siram", 1, | |
| 1207 | + (void __iomem **)&utdm->siram); | |
| 1208 | + if (ret) | |
| 1209 | + goto unmap_si_regs; | |
| 1153 | 1210 | } |
| 1154 | 1211 | |
| 1155 | 1212 | if (of_property_read_u16(np, "fsl,hmask", &uhdlc_priv->hmask)) |
| @@ -1158,7 +1215,7 @@ static int ucc_hdlc_probe(struct platform_device *pdev) · 2 unmodified lines | ||
| 1158 | 1215 | ret = uhdlc_init(uhdlc_priv); |
| 1159 | 1216 | if (ret) { |
| 1160 | 1217 | dev_err(&pdev->dev, "Failed to init uhdlc\n"); |
| 1161 | − goto free_utdm; | |
| 1218 | + goto undo_uhdlc_init; | |
| 1162 | 1219 | } |
| 1163 | 1220 | |
| 1164 | 1221 | dev = alloc_hdlcdev(uhdlc_priv); |
| @@ -1187,6 +1244,9 @@ static int ucc_hdlc_probe(struct platform_device *pdev) · 22 unmodified lines | ||
| 1187 | 1244 | free_dev: |
| 1188 | 1245 | free_netdev(dev); |
| 1189 | 1246 | undo_uhdlc_init: |
| 1247 | + iounmap(utdm->siram); | |
| 1248 | +unmap_si_regs: | |
| 1249 | + iounmap(utdm->si_regs); | |
| 1190 | 1250 | free_utdm: |
| 1191 | 1251 | if (uhdlc_priv->tsa) |
| 1192 | 1252 | kfree(utdm); |
| @@ -2761,6 +2761,11 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, · 2760 unmodified lines | ||
| 2761 | 2761 | BIT(NL80211_CHAN_WIDTH_160); |
| 2762 | 2762 | } |
| 2763 | 2763 | |
| 2764 | + if (!n_limits) { | |
| 2765 | + err = -EINVAL; | |
| 2766 | + goto failed_hw; | |
| 2767 | + } | |
| 2768 | + | |
| 2764 | 2769 | data->if_combination.n_limits = n_limits; |
| 2765 | 2770 | data->if_combination.max_interfaces = 2048; |
| 2766 | 2771 | data->if_combination.limits = data->if_limits; |
| @@ -530,8 +530,10 @@ static int virt_wifi_newlink(struct net *src_net, struct net_device *dev, · 529 unmodified lines | ||
| 530 | 530 | SET_NETDEV_DEV(dev, &priv->lowerdev->dev); |
| 531 | 531 | dev->ieee80211_ptr = kzalloc(sizeof(*dev->ieee80211_ptr), GFP_KERNEL); |
| 532 | 532 | |
| 533 | − if (!dev->ieee80211_ptr) | |
| 533 | + if (!dev->ieee80211_ptr) { | |
| 534 | + err = -ENOMEM; | |
| 534 | 535 | goto remove_handler; |
| 536 | + } | |
| 535 | 537 | |
| 536 | 538 | dev->ieee80211_ptr->iftype = NL80211_IFTYPE_STATION; |
| 537 | 539 | dev->ieee80211_ptr->wiphy = common_wiphy; |
| @@ -26,6 +26,12 @@ static int nvdimm_probe(struct device *dev) · 25 unmodified lines | ||
| 26 | 26 | struct nvdimm_drvdata *ndd; |
| 27 | 27 | int rc; |
| 28 | 28 | |
| 29 | + rc = nvdimm_security_setup_events(dev); | |
| 30 | + if (rc < 0) { | |
| 31 | + dev_err(dev, "security event setup failed: %d\n", rc); | |
| 32 | + return rc; | |
| 33 | + } | |
| 34 | + | |
| 29 | 35 | rc = nvdimm_check_config_data(dev); |
| 30 | 36 | if (rc) { |
| 31 | 37 | /* not required for non-aliased nvdimm, ex. NVDIMM-N */ |
| @@ -578,13 +578,25 @@ struct nvdimm *__nvdimm_create(struct nvdimm_bus *nvdimm_bus, · 577 unmodified lines | ||
| 578 | 578 | } |
| 579 | 579 | EXPORT_SYMBOL_GPL(__nvdimm_create); |
| 580 | 580 | |
| 581 | −int nvdimm_security_setup_events(struct nvdimm *nvdimm) | |
| 581 | +static void shutdown_security_notify(void *data) | |
| 582 | 582 | { |
| 583 | − nvdimm->sec.overwrite_state = sysfs_get_dirent(nvdimm->dev.kobj.sd, | |
| 584 | − "security"); | |
| 583 | + struct nvdimm *nvdimm = data; | |
| 584 | + | |
| 585 | + sysfs_put(nvdimm->sec.overwrite_state); | |
| 586 | +} | |
| 587 | + | |
| 588 | +int nvdimm_security_setup_events(struct device *dev) | |
| 589 | +{ | |
| 590 | + struct nvdimm *nvdimm = to_nvdimm(dev); | |
| 591 | + | |
| 592 | + if (nvdimm->sec.state < 0 || !nvdimm->sec.ops | |
| 593 | + || !nvdimm->sec.ops->overwrite) | |
| 594 | + return 0; | |
| 595 | + nvdimm->sec.overwrite_state = sysfs_get_dirent(dev->kobj.sd, "security"); | |
| 585 | 596 | if (!nvdimm->sec.overwrite_state) |
| 586 | − return -ENODEV; | |
| 587 | − return 0; | |
| 597 | + return -ENOMEM; | |
| 598 | + | |
| 599 | + return devm_add_action_or_reset(dev, shutdown_security_notify, nvdimm); | |
| 588 | 600 | } |
| 589 | 601 | EXPORT_SYMBOL_GPL(nvdimm_security_setup_events); |
| 590 | 602 | |
| @@ -54,12 +54,12 @@ struct nvdimm { · 53 unmodified lines | ||
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | 56 | static inline enum nvdimm_security_state nvdimm_security_state( |
| 57 | − struct nvdimm *nvdimm, bool master) | |
| 57 | + struct nvdimm *nvdimm, enum nvdimm_passphrase_type ptype) | |
| 58 | 58 | { |
| 59 | 59 | if (!nvdimm->sec.ops) |
| 60 | 60 | return -ENXIO; |
| 61 | 61 | |
| 62 | − return nvdimm->sec.ops->state(nvdimm, master); | |
| 62 | + return nvdimm->sec.ops->state(nvdimm, ptype); | |
| 63 | 63 | } |
| 64 | 64 | int nvdimm_security_freeze(struct nvdimm *nvdimm); |
| 65 | 65 | #if IS_ENABLED(CONFIG_NVDIMM_KEYS) |
| @@ -250,6 +250,7 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys, · 249 unmodified lines | ||
| 250 | 250 | void nvdimm_set_aliasing(struct device *dev); |
| 251 | 251 | void nvdimm_set_locked(struct device *dev); |
| 252 | 252 | void nvdimm_clear_locked(struct device *dev); |
| 253 | +int nvdimm_security_setup_events(struct device *dev); | |
| 253 | 254 | #if IS_ENABLED(CONFIG_NVDIMM_KEYS) |
| 254 | 255 | int nvdimm_security_unlock(struct device *dev); |
| 255 | 256 | #else |
| @@ -545,8 +545,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) · 544 unmodified lines | ||
| 545 | 545 | timer_setup(&ctrl->anatt_timer, nvme_anatt_timeout, 0); |
| 546 | 546 | ctrl->ana_log_size = sizeof(struct nvme_ana_rsp_hdr) + |
| 547 | 547 | ctrl->nanagrpid * sizeof(struct nvme_ana_group_desc); |
| 548 | − if (!(ctrl->anacap & (1 << 6))) | |
| 549 | − ctrl->ana_log_size += ctrl->max_namespaces * sizeof(__le32); | |
| 548 | + ctrl->ana_log_size += ctrl->max_namespaces * sizeof(__le32); | |
| 550 | 549 | |
| 551 | 550 | if (ctrl->ana_log_size > ctrl->max_hw_sectors << SECTOR_SHIFT) { |
| 552 | 551 | dev_err(ctrl->device, |
| @@ -2041,14 +2041,18 @@ static int nvme_setup_host_mem(struct nvme_dev *dev) · 2040 unmodified lines | ||
| 2041 | 2041 | return ret; |
| 2042 | 2042 | } |
| 2043 | 2043 | |
| 2044 | +/* irq_queues covers admin queue */ | |
| 2044 | 2045 | static void nvme_calc_io_queues(struct nvme_dev *dev, unsigned int irq_queues) |
| 2045 | 2046 | { |
| 2046 | 2047 | unsigned int this_w_queues = write_queues; |
| 2047 | 2048 | |
| 2049 | + WARN_ON(!irq_queues); | |
| 2050 | + | |
| 2048 | 2051 | /* |
| 2049 | − * Setup read/write queue split | |
| 2052 | + * Setup read/write queue split, assign admin queue one independent | |
| 2053 | + * irq vector if irq_queues is > 1. | |
| 2050 | 2054 | */ |
| 2051 | − if (irq_queues == 1) { | |
| 2055 | + if (irq_queues <= 2) { | |
| 2052 | 2056 | dev->io_queues[HCTX_TYPE_DEFAULT] = 1; |
| 2053 | 2057 | dev->io_queues[HCTX_TYPE_READ] = 0; |
| 2054 | 2058 | return; |
| @@ -2056,21 +2060,21 @@ static void nvme_calc_io_queues(struct nvme_dev *dev, unsigned int irq_queues) · 1 unmodified line | ||
| 2056 | 2060 | |
| 2057 | 2061 | /* |
| 2058 | 2062 | * If 'write_queues' is set, ensure it leaves room for at least |
| 2059 | − * one read queue | |
| 2063 | + * one read queue and one admin queue | |
| 2060 | 2064 | */ |
| 2061 | 2065 | if (this_w_queues >= irq_queues) |
| 2062 | − this_w_queues = irq_queues - 1; | |
| 2066 | + this_w_queues = irq_queues - 2; | |
| 2063 | 2067 | |
| 2064 | 2068 | /* |
| 2065 | 2069 | * If 'write_queues' is set to zero, reads and writes will share |
| 2066 | 2070 | * a queue set. |
| 2067 | 2071 | */ |
| 2068 | 2072 | if (!this_w_queues) { |
| 2069 | − dev->io_queues[HCTX_TYPE_DEFAULT] = irq_queues; | |
| 2073 | + dev->io_queues[HCTX_TYPE_DEFAULT] = irq_queues - 1; | |
| 2070 | 2074 | dev->io_queues[HCTX_TYPE_READ] = 0; |
| 2071 | 2075 | } else { |
| 2072 | 2076 | dev->io_queues[HCTX_TYPE_DEFAULT] = this_w_queues; |
| 2073 | − dev->io_queues[HCTX_TYPE_READ] = irq_queues - this_w_queues; | |
| 2077 | + dev->io_queues[HCTX_TYPE_READ] = irq_queues - this_w_queues - 1; | |
| 2074 | 2078 | } |
| 2075 | 2079 | } |
| 2076 | 2080 | |
| @@ -2095,7 +2099,7 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues) · 18 unmodified lines | ||
| 2095 | 2099 | this_p_queues = nr_io_queues - 1; |
| 2096 | 2100 | irq_queues = 1; |
| 2097 | 2101 | } else { |
| 2098 | − irq_queues = nr_io_queues - this_p_queues; | |
| 2102 | + irq_queues = nr_io_queues - this_p_queues + 1; | |
| 2099 | 2103 | } |
| 2100 | 2104 | dev->io_queues[HCTX_TYPE_POLL] = this_p_queues; |
| 2101 | 2105 | |
| @@ -2115,8 +2119,9 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues) · 13 unmodified lines | ||
| 2115 | 2119 | * If we got a failure and we're down to asking for just |
| 2116 | 2120 | * 1 + 1 queues, just ask for a single vector. We'll share |
| 2117 | 2121 | * that between the single IO queue and the admin queue. |
| 2122 | + * Otherwise, we assign one independent vector to admin queue. | |
| 2118 | 2123 | */ |
| 2119 | − if (result >= 0 && irq_queues > 1) | |
| 2124 | + if (irq_queues > 1) | |
| 2120 | 2125 | irq_queues = irq_sets[0] + irq_sets[1] + 1; |
| 2121 | 2126 | |
| 2122 | 2127 | result = pci_alloc_irq_vectors_affinity(pdev, irq_queues, |
| @@ -119,6 +119,7 @@ struct nvme_rdma_ctrl { · 118 unmodified lines | ||
| 119 | 119 | |
| 120 | 120 | struct nvme_ctrl ctrl; |
| 121 | 121 | bool use_inline_data; |
| 122 | + u32 io_queues[HCTX_MAX_TYPES]; | |
| 122 | 123 | }; |
| 123 | 124 | |
| 124 | 125 | static inline struct nvme_rdma_ctrl *to_rdma_ctrl(struct nvme_ctrl *ctrl) |
| @@ -165,8 +166,8 @@ static inline int nvme_rdma_queue_idx(struct nvme_rdma_queue *queue) · 40 unmodified lines | ||
| 165 | 166 | static bool nvme_rdma_poll_queue(struct nvme_rdma_queue *queue) |
| 166 | 167 | { |
| 167 | 168 | return nvme_rdma_queue_idx(queue) > |
| 168 | − queue->ctrl->ctrl.opts->nr_io_queues + | |
| 169 | − queue->ctrl->ctrl.opts->nr_write_queues; | |
| 169 | + queue->ctrl->io_queues[HCTX_TYPE_DEFAULT] + | |
| 170 | + queue->ctrl->io_queues[HCTX_TYPE_READ]; | |
| 170 | 171 | } |
| 171 | 172 | |
| 172 | 173 | static inline size_t nvme_rdma_inline_data_size(struct nvme_rdma_queue *queue) |
| @@ -661,8 +662,21 @@ static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl) · 488 unmodified lines | ||
| 661 | 662 | nr_io_queues = min_t(unsigned int, nr_io_queues, |
| 662 | 663 | ibdev->num_comp_vectors); |
| 663 | 664 | |
| 664 | − nr_io_queues += min(opts->nr_write_queues, num_online_cpus()); | |
| 665 | − nr_io_queues += min(opts->nr_poll_queues, num_online_cpus()); | |
| 665 | + if (opts->nr_write_queues) { | |
| 666 | + ctrl->io_queues[HCTX_TYPE_DEFAULT] = | |
| 667 | + min(opts->nr_write_queues, nr_io_queues); | |
| 668 | + nr_io_queues += ctrl->io_queues[HCTX_TYPE_DEFAULT]; | |
| 669 | + } else { | |
| 670 | + ctrl->io_queues[HCTX_TYPE_DEFAULT] = nr_io_queues; | |
| 671 | + } | |
| 672 | + | |
| 673 | + ctrl->io_queues[HCTX_TYPE_READ] = nr_io_queues; | |
| 674 | + | |
| 675 | + if (opts->nr_poll_queues) { | |
| 676 | + ctrl->io_queues[HCTX_TYPE_POLL] = | |
| 677 | + min(opts->nr_poll_queues, num_online_cpus()); | |
| 678 | + nr_io_queues += ctrl->io_queues[HCTX_TYPE_POLL]; | |
| 679 | + } | |
| 666 | 680 | |
| 667 | 681 | ret = nvme_set_queue_count(&ctrl->ctrl, &nr_io_queues); |
| 668 | 682 | if (ret) |
| @@ -1689,18 +1703,28 @@ static enum blk_eh_timer_return · 1020 unmodified lines | ||
| 1689 | 1703 | nvme_rdma_timeout(struct request *rq, bool reserved) |
| 1690 | 1704 | { |
| 1691 | 1705 | struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq); |
| 1706 | + struct nvme_rdma_queue *queue = req->queue; | |
| 1707 | + struct nvme_rdma_ctrl *ctrl = queue->ctrl; | |
| 1692 | 1708 | |
| 1693 | − dev_warn(req->queue->ctrl->ctrl.device, | |
| 1694 | − "I/O %d QID %d timeout, reset controller\n", | |
| 1695 | − rq->tag, nvme_rdma_queue_idx(req->queue)); | |
| 1709 | + dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n", | |
| 1710 | + rq->tag, nvme_rdma_queue_idx(queue)); | |
| 1696 | 1711 | |
| 1697 | − /* queue error recovery */ | |
| 1698 | − nvme_rdma_error_recovery(req->queue->ctrl); | |
| 1712 | + if (ctrl->ctrl.state != NVME_CTRL_LIVE) { | |
| 1713 | + /* | |
| 1714 | + * Teardown immediately if controller times out while starting | |
| 1715 | + * or we are already started error recovery. all outstanding | |
| 1716 | + * requests are completed on shutdown, so we return BLK_EH_DONE. | |
| 1717 | + */ | |
| 1718 | + flush_work(&ctrl->err_work); | |
| 1719 | + nvme_rdma_teardown_io_queues(ctrl, false); | |
| 1720 | + nvme_rdma_teardown_admin_queue(ctrl, false); | |
| 1721 | + return BLK_EH_DONE; | |
| 1722 | + } | |
| 1699 | 1723 | |
| 1700 | − /* fail with DNR on cmd timeout */ | |
| 1701 | − nvme_req(rq)->status = NVME_SC_ABORT_REQ | NVME_SC_DNR; | |
| 1724 | + dev_warn(ctrl->ctrl.device, "starting error recovery\n"); | |
| 1725 | + nvme_rdma_error_recovery(ctrl); | |
| 1702 | 1726 | |
| 1703 | − return BLK_EH_DONE; | |
| 1727 | + return BLK_EH_RESET_TIMER; | |
| 1704 | 1728 | } |
| 1705 | 1729 | |
| 1706 | 1730 | static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx, |
| @@ -1779,17 +1803,15 @@ static int nvme_rdma_map_queues(struct blk_mq_tag_set *set) · 72 unmodified lines | ||
| 1779 | 1803 | struct nvme_rdma_ctrl *ctrl = set->driver_data; |
| 1780 | 1804 | |
| 1781 | 1805 | set->map[HCTX_TYPE_DEFAULT].queue_offset = 0; |
| 1782 | − set->map[HCTX_TYPE_READ].nr_queues = ctrl->ctrl.opts->nr_io_queues; | |
| 1806 | + set->map[HCTX_TYPE_DEFAULT].nr_queues = | |
| 1807 | + ctrl->io_queues[HCTX_TYPE_DEFAULT]; | |
| 1808 | + set->map[HCTX_TYPE_READ].nr_queues = ctrl->io_queues[HCTX_TYPE_READ]; | |
| 1783 | 1809 | if (ctrl->ctrl.opts->nr_write_queues) { |
| 1784 | 1810 | /* separate read/write queues */ |
| 1785 | − set->map[HCTX_TYPE_DEFAULT].nr_queues = | |
| 1786 | − ctrl->ctrl.opts->nr_write_queues; | |
| 1787 | 1811 | set->map[HCTX_TYPE_READ].queue_offset = |
| 1788 | − ctrl->ctrl.opts->nr_write_queues; | |
| 1812 | + ctrl->io_queues[HCTX_TYPE_DEFAULT]; | |
| 1789 | 1813 | } else { |
| 1790 | 1814 | /* mixed read/write queues */ |
| 1791 | − set->map[HCTX_TYPE_DEFAULT].nr_queues = | |
| 1792 | − ctrl->ctrl.opts->nr_io_queues; | |
| 1793 | 1815 | set->map[HCTX_TYPE_READ].queue_offset = 0; |
| 1794 | 1816 | } |
| 1795 | 1817 | blk_mq_rdma_map_queues(&set->map[HCTX_TYPE_DEFAULT], |
| @@ -1799,12 +1821,12 @@ static int nvme_rdma_map_queues(struct blk_mq_tag_set *set) · 3 unmodified lines | ||
| 1799 | 1821 | |
| 1800 | 1822 | if (ctrl->ctrl.opts->nr_poll_queues) { |
| 1801 | 1823 | set->map[HCTX_TYPE_POLL].nr_queues = |
| 1802 | − ctrl->ctrl.opts->nr_poll_queues; | |
| 1824 | + ctrl->io_queues[HCTX_TYPE_POLL]; | |
| 1803 | 1825 | set->map[HCTX_TYPE_POLL].queue_offset = |
| 1804 | − ctrl->ctrl.opts->nr_io_queues; | |
| 1826 | + ctrl->io_queues[HCTX_TYPE_DEFAULT]; | |
| 1805 | 1827 | if (ctrl->ctrl.opts->nr_write_queues) |
| 1806 | 1828 | set->map[HCTX_TYPE_POLL].queue_offset += |
| 1807 | − ctrl->ctrl.opts->nr_write_queues; | |
| 1829 | + ctrl->io_queues[HCTX_TYPE_READ]; | |
| 1808 | 1830 | blk_mq_map_queues(&set->map[HCTX_TYPE_POLL]); |
| 1809 | 1831 | } |
| 1810 | 1832 | return 0; |
| @@ -1948,20 +1948,23 @@ nvme_tcp_timeout(struct request *rq, bool reserved) · 1947 unmodified lines | ||
| 1948 | 1948 | struct nvme_tcp_ctrl *ctrl = req->queue->ctrl; |
| 1949 | 1949 | struct nvme_tcp_cmd_pdu *pdu = req->pdu; |
| 1950 | 1950 | |
| 1951 | − dev_dbg(ctrl->ctrl.device, | |
| 1951 | + dev_warn(ctrl->ctrl.device, | |
| 1952 | 1952 | "queue %d: timeout request %#x type %d\n", |
| 1953 | − nvme_tcp_queue_id(req->queue), rq->tag, | |
| 1954 | − pdu->hdr.type); | |
| 1953 | + nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type); | |
| 1955 | 1954 | |
| 1956 | 1955 | if (ctrl->ctrl.state != NVME_CTRL_LIVE) { |
| 1957 | − union nvme_result res = {}; | |
| 1958 | − | |
| 1959 | − nvme_req(rq)->flags |= NVME_REQ_CANCELLED; | |
| 1960 | − nvme_end_request(rq, cpu_to_le16(NVME_SC_ABORT_REQ), res); | |
| 1956 | + /* | |
| 1957 | + * Teardown immediately if controller times out while starting | |
| 1958 | + * or we are already started error recovery. all outstanding | |
| 1959 | + * requests are completed on shutdown, so we return BLK_EH_DONE. | |
| 1960 | + */ | |
| 1961 | + flush_work(&ctrl->err_work); | |
| 1962 | + nvme_tcp_teardown_io_queues(&ctrl->ctrl, false); | |
| 1963 | + nvme_tcp_teardown_admin_queue(&ctrl->ctrl, false); | |
| 1961 | 1964 | return BLK_EH_DONE; |
| 1962 | 1965 | } |
| 1963 | 1966 | |
| 1964 | − /* queue error recovery */ | |
| 1967 | + dev_warn(ctrl->ctrl.device, "starting error recovery\n"); | |
| 1965 | 1968 | nvme_tcp_error_recovery(&ctrl->ctrl); |
| 1966 | 1969 | |
| 1967 | 1970 | return BLK_EH_RESET_TIMER; |
| @@ -139,6 +139,10 @@ static void nvmet_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc); · 138 unmodified lines | ||
| 139 | 139 | static void nvmet_rdma_read_data_done(struct ib_cq *cq, struct ib_wc *wc); |
| 140 | 140 | static void nvmet_rdma_qp_event(struct ib_event *event, void *priv); |
| 141 | 141 | static void nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue); |
| 142 | +static void nvmet_rdma_free_rsp(struct nvmet_rdma_device *ndev, | |
| 143 | + struct nvmet_rdma_rsp *r); | |
| 144 | +static int nvmet_rdma_alloc_rsp(struct nvmet_rdma_device *ndev, | |
| 145 | + struct nvmet_rdma_rsp *r); | |
| 142 | 146 | |
| 143 | 147 | static const struct nvmet_fabrics_ops nvmet_rdma_ops; |
| 144 | 148 | |
| @@ -182,9 +186,17 @@ nvmet_rdma_get_rsp(struct nvmet_rdma_queue *queue) · 37 unmodified lines | ||
| 182 | 186 | spin_unlock_irqrestore(&queue->rsps_lock, flags); |
| 183 | 187 | |
| 184 | 188 | if (unlikely(!rsp)) { |
| 185 | − rsp = kmalloc(sizeof(*rsp), GFP_KERNEL); | |
| 189 | + int ret; | |
| 190 | + | |
| 191 | + rsp = kzalloc(sizeof(*rsp), GFP_KERNEL); | |
| 186 | 192 | if (unlikely(!rsp)) |
| 187 | 193 | return NULL; |
| 194 | + ret = nvmet_rdma_alloc_rsp(queue->dev, rsp); | |
| 195 | + if (unlikely(ret)) { | |
| 196 | + kfree(rsp); | |
| 197 | + return NULL; | |
| 198 | + } | |
| 199 | + | |
| 188 | 200 | rsp->allocated = true; |
| 189 | 201 | } |
| 190 | 202 | |
| @@ -197,6 +209,7 @@ nvmet_rdma_put_rsp(struct nvmet_rdma_rsp *rsp) · 6 unmodified lines | ||
| 197 | 209 | unsigned long flags; |
| 198 | 210 | |
| 199 | 211 | if (unlikely(rsp->allocated)) { |
| 212 | + nvmet_rdma_free_rsp(rsp->queue->dev, rsp); | |
| 200 | 213 | kfree(rsp); |
| 201 | 214 | return; |
| 202 | 215 | } |
| @@ -1089,7 +1089,7 @@ out: · 1088 unmodified lines | ||
| 1089 | 1089 | |
| 1090 | 1090 | static int nvmet_tcp_try_recv_one(struct nvmet_tcp_queue *queue) |
| 1091 | 1091 | { |
| 1092 | − int result; | |
| 1092 | + int result = 0; | |
| 1093 | 1093 | |
| 1094 | 1094 | if (unlikely(queue->rcv_state == NVMET_TCP_RECV_ERR)) |
| 1095 | 1095 | return 0; |
| @@ -207,11 +207,8 @@ static void __of_attach_node(struct device_node *np) · 206 unmodified lines | ||
| 207 | 207 | |
| 208 | 208 | if (!of_node_check_flag(np, OF_OVERLAY)) { |
| 209 | 209 | np->name = __of_get_property(np, "name", NULL); |
| 210 | − np->type = __of_get_property(np, "device_type", NULL); | |
| 211 | 210 | if (!np->name) |
| 212 | 211 | np->name = "<NULL>"; |
| 213 | − if (!np->type) | |
| 214 | − np->type = "<NULL>"; | |
| 215 | 212 | |
| 216 | 213 | phandle = __of_get_property(np, "phandle", &sz); |
| 217 | 214 | if (!phandle) |
| @@ -314,12 +314,8 @@ static bool populate_node(const void *blob, · 313 unmodified lines | ||
| 314 | 314 | populate_properties(blob, offset, mem, np, pathp, dryrun); |
| 315 | 315 | if (!dryrun) { |
| 316 | 316 | np->name = of_get_property(np, "name", NULL); |
| 317 | − np->type = of_get_property(np, "device_type", NULL); | |
| 318 | − | |
| 319 | 317 | if (!np->name) |
| 320 | 318 | np->name = "<NULL>"; |
| 321 | − if (!np->type) | |
| 322 | − np->type = "<NULL>"; | |
| 323 | 319 | } |
| 324 | 320 | |
| 325 | 321 | *pnp = np; |
| @@ -423,12 +423,9 @@ static int add_changeset_node(struct overlay_changeset *ovcs, · 422 unmodified lines | ||
| 423 | 423 | |
| 424 | 424 | tchild->parent = target->np; |
| 425 | 425 | tchild->name = __of_get_property(node, "name", NULL); |
| 426 | − tchild->type = __of_get_property(node, "device_type", NULL); | |
| 427 | 426 | |
| 428 | 427 | if (!tchild->name) |
| 429 | 428 | tchild->name = "<NULL>"; |
| 430 | − if (!tchild->type) | |
| 431 | − tchild->type = "<NULL>"; | |
| 432 | 429 | |
| 433 | 430 | /* ignore obsolete "linux,phandle" */ |
| 434 | 431 | phandle = __of_get_property(node, "phandle", &size); |
| @@ -155,7 +155,6 @@ static struct device_node * __init of_pdt_create_node(phandle node, · 154 unmodified lines | ||
| 155 | 155 | dp->parent = parent; |
| 156 | 156 | |
| 157 | 157 | dp->name = of_pdt_get_one_property(node, "name"); |
| 158 | − dp->type = of_pdt_get_one_property(node, "device_type"); | |
| 159 | 158 | dp->phandle = node; |
| 160 | 159 | |
| 161 | 160 | dp->properties = of_pdt_build_prop_list(node); |
| @@ -806,6 +806,7 @@ struct device_node *of_graph_get_remote_node(const struct device_node *node, · 805 unmodified lines | ||
| 806 | 806 | |
| 807 | 807 | if (!of_device_is_available(remote)) { |
| 808 | 808 | pr_debug("not available for remote node\n"); |
| 809 | + of_node_put(remote); | |
| 809 | 810 | return NULL; |
| 810 | 811 | } |
| 811 | 812 | |
| @@ -21,13 +21,14 @@ menuconfig PCI · 20 unmodified lines | ||
| 21 | 21 | support for PCI-X and the foundations for PCI Express support. |
| 22 | 22 | Say 'Y' here unless you know what you are doing. |
| 23 | 23 | |
| 24 | +if PCI | |
| 25 | + | |
| 24 | 26 | config PCI_DOMAINS |
| 25 | 27 | bool |
| 26 | 28 | depends on PCI |
| 27 | 29 | |
| 28 | 30 | config PCI_DOMAINS_GENERIC |
| 29 | 31 | bool |
| 30 | − depends on PCI | |
| 31 | 32 | select PCI_DOMAINS |
| 32 | 33 | |
| 33 | 34 | config PCI_SYSCALL |
| @@ -37,7 +38,6 @@ source "drivers/pci/pcie/Kconfig" · 3 unmodified lines | ||
| 37 | 38 | |
| 38 | 39 | config PCI_MSI |
| 39 | 40 | bool "Message Signaled Interrupts (MSI and MSI-X)" |
| 40 | − depends on PCI | |
| 41 | 41 | select GENERIC_MSI_IRQ |
| 42 | 42 | help |
| 43 | 43 | This allows device drivers to enable MSI (Message Signaled |
| @@ -59,7 +59,6 @@ config PCI_MSI_IRQ_DOMAIN · 15 unmodified lines | ||
| 59 | 59 | config PCI_QUIRKS |
| 60 | 60 | default y |
| 61 | 61 | bool "Enable PCI quirk workarounds" if EXPERT |
| 62 | − depends on PCI | |
| 63 | 62 | help |
| 64 | 63 | This enables workarounds for various PCI chipset bugs/quirks. |
| 65 | 64 | Disable this only if your target machine is unaffected by PCI |
| @@ -67,7 +66,7 @@ config PCI_QUIRKS · 1 unmodified line | ||
| 67 | 66 | |
| 68 | 67 | config PCI_DEBUG |
| 69 | 68 | bool "PCI Debugging" |
| 70 | − depends on PCI && DEBUG_KERNEL | |
| 69 | + depends on DEBUG_KERNEL | |
| 71 | 70 | help |
| 72 | 71 | Say Y here if you want the PCI core to produce a bunch of debug |
| 73 | 72 | messages to the system log. Select this if you are having a |
| @@ -77,7 +76,6 @@ config PCI_DEBUG · 3 unmodified lines | ||
| 77 | 76 | |
| 78 | 77 | config PCI_REALLOC_ENABLE_AUTO |
| 79 | 78 | bool "Enable PCI resource re-allocation detection" |
| 80 | − depends on PCI | |
| 81 | 79 | depends on PCI_IOV |
| 82 | 80 | help |
| 83 | 81 | Say Y here if you want the PCI core to detect if PCI resource |
| @@ -90,7 +88,6 @@ config PCI_REALLOC_ENABLE_AUTO · 6 unmodified lines | ||
| 90 | 88 | |
| 91 | 89 | config PCI_STUB |
| 92 | 90 | tristate "PCI Stub driver" |
| 93 | − depends on PCI | |
| 94 | 91 | help |
| 95 | 92 | Say Y or M here if you want be able to reserve a PCI device |
| 96 | 93 | when it is going to be assigned to a guest operating system. |
| @@ -99,7 +96,6 @@ config PCI_STUB · 2 unmodified lines | ||
| 99 | 96 | |
| 100 | 97 | config PCI_PF_STUB |
| 101 | 98 | tristate "PCI PF Stub driver" |
| 102 | − depends on PCI | |
| 103 | 99 | depends on PCI_IOV |
| 104 | 100 | help |
| 105 | 101 | Say Y or M here if you want to enable support for devices that |
| @@ -111,7 +107,7 @@ config PCI_PF_STUB · 5 unmodified lines | ||
| 111 | 107 | |
| 112 | 108 | config XEN_PCIDEV_FRONTEND |
| 113 | 109 | tristate "Xen PCI Frontend" |
| 114 | − depends on PCI && X86 && XEN | |
| 110 | + depends on X86 && XEN | |
| 115 | 111 | select PCI_XEN |
| 116 | 112 | select XEN_XENBUS_FRONTEND |
| 117 | 113 | default y |
| @@ -133,7 +129,6 @@ config PCI_BRIDGE_EMUL · 15 unmodified lines | ||
| 133 | 129 | |
| 134 | 130 | config PCI_IOV |
| 135 | 131 | bool "PCI IOV support" |
| 136 | − depends on PCI | |
| 137 | 132 | select PCI_ATS |
| 138 | 133 | help |
| 139 | 134 | I/O Virtualization is a PCI feature supported by some devices |
| @@ -144,7 +139,6 @@ config PCI_IOV · 4 unmodified lines | ||
| 144 | 139 | |
| 145 | 140 | config PCI_PRI |
| 146 | 141 | bool "PCI PRI support" |
| 147 | − depends on PCI | |
| 148 | 142 | select PCI_ATS |
| 149 | 143 | help |
| 150 | 144 | PRI is the PCI Page Request Interface. It allows PCI devices that are |
| @@ -154,7 +148,6 @@ config PCI_PRI · 3 unmodified lines | ||
| 154 | 148 | |
| 155 | 149 | config PCI_PASID |
| 156 | 150 | bool "PCI PASID support" |
| 157 | − depends on PCI | |
| 158 | 151 | select PCI_ATS |
| 159 | 152 | help |
| 160 | 153 | Process Address Space Identifiers (PASIDs) can be used by PCI devices |
| @@ -167,7 +160,7 @@ config PCI_PASID · 6 unmodified lines | ||
| 167 | 160 | |
| 168 | 161 | config PCI_P2PDMA |
| 169 | 162 | bool "PCI peer-to-peer transfer support" |
| 170 | − depends on PCI && ZONE_DEVICE | |
| 163 | + depends on ZONE_DEVICE | |
| 171 | 164 | select GENERIC_ALLOCATOR |
| 172 | 165 | help |
| 173 | 166 | Enableѕ drivers to do PCI peer-to-peer transactions to and from |
| @@ -184,12 +177,11 @@ config PCI_P2PDMA · 10 unmodified lines | ||
| 184 | 177 | |
| 185 | 178 | config PCI_LABEL |
| 186 | 179 | def_bool y if (DMI || ACPI) |
| 187 | − depends on PCI | |
| 188 | 180 | select NLS |
| 189 | 181 | |
| 190 | 182 | config PCI_HYPERV |
| 191 | 183 | tristate "Hyper-V PCI Frontend" |
| 192 | − depends on PCI && X86 && HYPERV && PCI_MSI && PCI_MSI_IRQ_DOMAIN && X86_64 | |
| 184 | + depends on X86 && HYPERV && PCI_MSI && PCI_MSI_IRQ_DOMAIN && X86_64 | |
| 193 | 185 | help |
| 194 | 186 | The PCI device frontend driver allows the kernel to import arbitrary |
| 195 | 187 | PCI devices from a PCI backend to support PCI driver domains. |
| @@ -198,3 +190,5 @@ source "drivers/pci/hotplug/Kconfig" · 2 unmodified lines | ||
| 198 | 190 | source "drivers/pci/controller/Kconfig" |
| 199 | 191 | source "drivers/pci/endpoint/Kconfig" |
| 200 | 192 | source "drivers/pci/switch/Kconfig" |
| 193 | + | |
| 194 | +endif | |
| @@ -310,6 +310,9 @@ static int imx6_pcie_attach_pd(struct device *dev) · 309 unmodified lines | ||
| 310 | 310 | imx6_pcie->pd_pcie = dev_pm_domain_attach_by_name(dev, "pcie"); |
| 311 | 311 | if (IS_ERR(imx6_pcie->pd_pcie)) |
| 312 | 312 | return PTR_ERR(imx6_pcie->pd_pcie); |
| 313 | + /* Do nothing when power domain missing */ | |
| 314 | + if (!imx6_pcie->pd_pcie) | |
| 315 | + return 0; | |
| 313 | 316 | link = device_link_add(dev, imx6_pcie->pd_pcie, |
| 314 | 317 | DL_FLAG_STATELESS | |
| 315 | 318 | DL_FLAG_PM_RUNTIME | |
| @@ -323,13 +326,13 @@ static int imx6_pcie_attach_pd(struct device *dev) · 7 unmodified lines | ||
| 323 | 326 | if (IS_ERR(imx6_pcie->pd_pcie_phy)) |
| 324 | 327 | return PTR_ERR(imx6_pcie->pd_pcie_phy); |
| 325 | 328 | |
| 326 | − device_link_add(dev, imx6_pcie->pd_pcie_phy, | |
| 329 | + link = device_link_add(dev, imx6_pcie->pd_pcie_phy, | |
| 327 | 330 | DL_FLAG_STATELESS | |
| 328 | 331 | DL_FLAG_PM_RUNTIME | |
| 329 | 332 | DL_FLAG_RPM_ACTIVE); |
| 330 | − if (IS_ERR(link)) { | |
| 331 | − dev_err(dev, "Failed to add device_link to pcie_phy pd: %ld\n", PTR_ERR(link)); | |
| 332 | − return PTR_ERR(link); | |
| 333 | + if (!link) { | |
| 334 | + dev_err(dev, "Failed to add device_link to pcie_phy pd.\n"); | |
| 335 | + return -EINVAL; | |
| 333 | 336 | } |
| 334 | 337 | |
| 335 | 338 | return 0; |
| @@ -22,7 +22,6 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/resource.h> |
| 23 | 23 | #include <linux/of_pci.h> |
| 24 | 24 | #include <linux/of_irq.h> |
| 25 | −#include <linux/gpio/consumer.h> | |
| 26 | 25 | |
| 27 | 26 | #include "pcie-designware.h" |
| 28 | 27 | |
| @@ -30,7 +29,6 @@ struct armada8k_pcie { · 1 unmodified line | ||
| 30 | 29 | struct dw_pcie *pci; |
| 31 | 30 | struct clk *clk; |
| 32 | 31 | struct clk *clk_reg; |
| 33 | − struct gpio_desc *reset_gpio; | |
| 34 | 32 | }; |
| 35 | 33 | |
| 36 | 34 | #define PCIE_VENDOR_REGS_OFFSET 0x8000 |
| @@ -139,12 +137,6 @@ static int armada8k_pcie_host_init(struct pcie_port *pp) · 102 unmodified lines | ||
| 139 | 137 | struct dw_pcie *pci = to_dw_pcie_from_pp(pp); |
| 140 | 138 | struct armada8k_pcie *pcie = to_armada8k_pcie(pci); |
| 141 | 139 | |
| 142 | − if (pcie->reset_gpio) { | |
| 143 | − /* assert and then deassert the reset signal */ | |
| 144 | − gpiod_set_value_cansleep(pcie->reset_gpio, 1); | |
| 145 | − msleep(100); | |
| 146 | − gpiod_set_value_cansleep(pcie->reset_gpio, 0); | |
| 147 | − } | |
| 148 | 140 | dw_pcie_setup_rc(pp); |
| 149 | 141 | armada8k_pcie_establish_link(pcie); |
| 150 | 142 | |
| @@ -257,14 +249,6 @@ static int armada8k_pcie_probe(struct platform_device *pdev) · 106 unmodified lines | ||
| 257 | 249 | goto fail_clkreg; |
| 258 | 250 | } |
| 259 | 251 | |
| 260 | − /* Get reset gpio signal and hold asserted (logically high) */ | |
| 261 | − pcie->reset_gpio = devm_gpiod_get_optional(dev, "reset", | |
| 262 | − GPIOD_OUT_HIGH); | |
| 263 | − if (IS_ERR(pcie->reset_gpio)) { | |
| 264 | − ret = PTR_ERR(pcie->reset_gpio); | |
| 265 | − goto fail_clkreg; | |
| 266 | − } | |
| 267 | − | |
| 268 | 252 | platform_set_drvdata(pdev, pcie); |
| 269 | 253 | |
| 270 | 254 | ret = armada8k_add_pcie_port(pcie, pdev); |
| @@ -1168,7 +1168,8 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, · 1167 unmodified lines | ||
| 1168 | 1168 | const struct irq_affinity *affd) |
| 1169 | 1169 | { |
| 1170 | 1170 | static const struct irq_affinity msi_default_affd; |
| 1171 | − int vecs = -ENOSPC; | |
| 1171 | + int msix_vecs = -ENOSPC; | |
| 1172 | + int msi_vecs = -ENOSPC; | |
| 1172 | 1173 | |
| 1173 | 1174 | if (flags & PCI_IRQ_AFFINITY) { |
| 1174 | 1175 | if (!affd) |
| @@ -1179,16 +1180,17 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, · 4 unmodified lines | ||
| 1179 | 1180 | } |
| 1180 | 1181 | |
| 1181 | 1182 | if (flags & PCI_IRQ_MSIX) { |
| 1182 | − vecs = __pci_enable_msix_range(dev, NULL, min_vecs, max_vecs, | |
| 1183 | − affd); | |
| 1184 | − if (vecs > 0) | |
| 1185 | − return vecs; | |
| 1183 | + msix_vecs = __pci_enable_msix_range(dev, NULL, min_vecs, | |
| 1184 | + max_vecs, affd); | |
| 1185 | + if (msix_vecs > 0) | |
| 1186 | + return msix_vecs; | |
| 1186 | 1187 | } |
| 1187 | 1188 | |
| 1188 | 1189 | if (flags & PCI_IRQ_MSI) { |
| 1189 | − vecs = __pci_enable_msi_range(dev, min_vecs, max_vecs, affd); | |
| 1190 | − if (vecs > 0) | |
| 1191 | − return vecs; | |
| 1190 | + msi_vecs = __pci_enable_msi_range(dev, min_vecs, max_vecs, | |
| 1191 | + affd); | |
| 1192 | + if (msi_vecs > 0) | |
| 1193 | + return msi_vecs; | |
| 1192 | 1194 | } |
| 1193 | 1195 | |
| 1194 | 1196 | /* use legacy irq if allowed */ |
| @@ -1199,7 +1201,9 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, · 4 unmodified lines | ||
| 1199 | 1201 | } |
| 1200 | 1202 | } |
| 1201 | 1203 | |
| 1202 | − return vecs; | |
| 1204 | + if (msix_vecs == -ENOSPC) | |
| 1205 | + return -ENOSPC; | |
| 1206 | + return msi_vecs; | |
| 1203 | 1207 | } |
| 1204 | 1208 | EXPORT_SYMBOL(pci_alloc_irq_vectors_affinity); |
| 1205 | 1209 | |
| @@ -6195,7 +6195,8 @@ static int __init pci_setup(char *str) · 6194 unmodified lines | ||
| 6195 | 6195 | } else if (!strncmp(str, "pcie_scan_all", 13)) { |
| 6196 | 6196 | pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS); |
| 6197 | 6197 | } else if (!strncmp(str, "disable_acs_redir=", 18)) { |
| 6198 | − disable_acs_redir_param = str + 18; | |
| 6198 | + disable_acs_redir_param = | |
| 6199 | + kstrdup(str + 18, GFP_KERNEL); | |
| 6199 | 6200 | } else { |
| 6200 | 6201 | printk(KERN_ERR "PCI: Unknown option `%s'\n", |
| 6201 | 6202 | str); |
| @@ -31,7 +31,7 @@ static int ath79_usb_phy_power_on(struct phy *phy) · 30 unmodified lines | ||
| 31 | 31 | |
| 32 | 32 | err = reset_control_deassert(priv->reset); |
| 33 | 33 | if (err && priv->no_suspend_override) |
| 34 | − reset_control_assert(priv->no_suspend_override); | |
| 34 | + reset_control_deassert(priv->no_suspend_override); | |
| 35 | 35 | |
| 36 | 36 | return err; |
| 37 | 37 | } |
| @@ -69,7 +69,7 @@ static int ath79_usb_phy_probe(struct platform_device *pdev) · 31 unmodified lines | ||
| 69 | 69 | if (!priv) |
| 70 | 70 | return -ENOMEM; |
| 71 | 71 | |
| 72 | − priv->reset = devm_reset_control_get(&pdev->dev, "usb-phy"); | |
| 72 | + priv->reset = devm_reset_control_get(&pdev->dev, "phy"); | |
| 73 | 73 | if (IS_ERR(priv->reset)) |
| 74 | 74 | return PTR_ERR(priv->reset); |
| 75 | 75 | |
| @@ -82,6 +82,7 @@ config PHY_TI_GMII_SEL · 81 unmodified lines | ||
| 82 | 82 | default y if TI_CPSW=y |
| 83 | 83 | depends on TI_CPSW || COMPILE_TEST |
| 84 | 84 | select GENERIC_PHY |
| 85 | + select REGMAP | |
| 85 | 86 | default m |
| 86 | 87 | help |
| 87 | 88 | This driver supports configuring of the TI CPSW Port mode depending on |
| @@ -204,11 +204,11 @@ static struct phy *phy_gmii_sel_of_xlate(struct device *dev, · 203 unmodified lines | ||
| 204 | 204 | |
| 205 | 205 | if (args->args_count < 1) |
| 206 | 206 | return ERR_PTR(-EINVAL); |
| 207 | + if (!priv || !priv->if_phys) | |
| 208 | + return ERR_PTR(-ENODEV); | |
| 207 | 209 | if (priv->soc_data->features & BIT(PHY_GMII_SEL_RMII_IO_CLK_EN) && |
| 208 | 210 | args->args_count < 2) |
| 209 | 211 | return ERR_PTR(-EINVAL); |
| 210 | − if (!priv || !priv->if_phys) | |
| 211 | − return ERR_PTR(-ENODEV); | |
| 212 | 212 | if (phy_id > priv->soc_data->num_ports) |
| 213 | 213 | return ERR_PTR(-EINVAL); |
| 214 | 214 | if (phy_id != priv->if_phys[phy_id - 1].id) |
| @@ -1513,7 +1513,7 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1512 unmodified lines | ||
| 1513 | 1513 | .matches = { |
| 1514 | 1514 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), |
| 1515 | 1515 | DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"), |
| 1516 | − DMI_MATCH(DMI_BOARD_VERSION, "1.0"), | |
| 1516 | + DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), | |
| 1517 | 1517 | }, |
| 1518 | 1518 | }, |
| 1519 | 1519 | { |
| @@ -1521,7 +1521,7 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1 unmodified line | ||
| 1521 | 1521 | .matches = { |
| 1522 | 1522 | DMI_MATCH(DMI_SYS_VENDOR, "HP"), |
| 1523 | 1523 | DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"), |
| 1524 | − DMI_MATCH(DMI_BOARD_VERSION, "1.0"), | |
| 1524 | + DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), | |
| 1525 | 1525 | }, |
| 1526 | 1526 | }, |
| 1527 | 1527 | { |
| @@ -1529,7 +1529,7 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1 unmodified line | ||
| 1529 | 1529 | .matches = { |
| 1530 | 1530 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), |
| 1531 | 1531 | DMI_MATCH(DMI_PRODUCT_NAME, "Cyan"), |
| 1532 | − DMI_MATCH(DMI_BOARD_VERSION, "1.0"), | |
| 1532 | + DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), | |
| 1533 | 1533 | }, |
| 1534 | 1534 | }, |
| 1535 | 1535 | { |
| @@ -1537,7 +1537,7 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1 unmodified line | ||
| 1537 | 1537 | .matches = { |
| 1538 | 1538 | DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), |
| 1539 | 1539 | DMI_MATCH(DMI_PRODUCT_NAME, "Celes"), |
| 1540 | − DMI_MATCH(DMI_BOARD_VERSION, "1.0"), | |
| 1540 | + DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"), | |
| 1541 | 1541 | }, |
| 1542 | 1542 | }, |
| 1543 | 1543 | {} |
| @@ -45,12 +45,14 @@ config PINCTRL_MT2701 · 44 unmodified lines | ||
| 45 | 45 | config PINCTRL_MT7623 |
| 46 | 46 | bool "Mediatek MT7623 pin control with generic binding" |
| 47 | 47 | depends on MACH_MT7623 || COMPILE_TEST |
| 48 | + depends on OF | |
| 48 | 49 | default MACH_MT7623 |
| 49 | 50 | select PINCTRL_MTK_MOORE |
| 50 | 51 | |
| 51 | 52 | config PINCTRL_MT7629 |
| 52 | 53 | bool "Mediatek MT7629 pin control" |
| 53 | 54 | depends on MACH_MT7629 || COMPILE_TEST |
| 55 | + depends on OF | |
| 54 | 56 | default MACH_MT7629 |
| 55 | 57 | select PINCTRL_MTK_MOORE |
| 56 | 58 | |
| @@ -92,6 +94,7 @@ config PINCTRL_MT6797 · 35 unmodified lines | ||
| 92 | 94 | |
| 93 | 95 | config PINCTRL_MT7622 |
| 94 | 96 | bool "MediaTek MT7622 pin control" |
| 97 | + depends on OF | |
| 95 | 98 | depends on ARM64 || COMPILE_TEST |
| 96 | 99 | default ARM64 && ARCH_MEDIATEK |
| 97 | 100 | select PINCTRL_MTK_MOORE |
| @@ -832,8 +832,13 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, · 831 unmodified lines | ||
| 832 | 832 | break; |
| 833 | 833 | |
| 834 | 834 | case MCP_TYPE_S18: |
| 835 | + one_regmap_config = | |
| 836 | + devm_kmemdup(dev, &mcp23x17_regmap, | |
| 837 | + sizeof(struct regmap_config), GFP_KERNEL); | |
| 838 | + if (!one_regmap_config) | |
| 839 | + return -ENOMEM; | |
| 835 | 840 | mcp->regmap = devm_regmap_init(dev, &mcp23sxx_spi_regmap, mcp, |
| 836 | − &mcp23x17_regmap); | |
| 841 | + one_regmap_config); | |
| 837 | 842 | mcp->reg_shift = 1; |
| 838 | 843 | mcp->chip.ngpio = 16; |
| 839 | 844 | mcp->chip.label = "mcp23s18"; |
| @@ -588,7 +588,7 @@ static const unsigned int h6_irq_bank_map[] = { 1, 5, 6, 7 }; · 587 unmodified lines | ||
| 588 | 588 | static const struct sunxi_pinctrl_desc h6_pinctrl_data = { |
| 589 | 589 | .pins = h6_pins, |
| 590 | 590 | .npins = ARRAY_SIZE(h6_pins), |
| 591 | − .irq_banks = 3, | |
| 591 | + .irq_banks = 4, | |
| 592 | 592 | .irq_bank_map = h6_irq_bank_map, |
| 593 | 593 | .irq_read_needs_mux = true, |
| 594 | 594 | }; |
| @@ -698,26 +698,24 @@ static int sunxi_pmx_request(struct pinctrl_dev *pctldev, unsigned offset) · 697 unmodified lines | ||
| 698 | 698 | { |
| 699 | 699 | struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); |
| 700 | 700 | unsigned short bank = offset / PINS_PER_BANK; |
| 701 | − struct sunxi_pinctrl_regulator *s_reg = &pctl->regulators[bank]; | |
| 702 | − struct regulator *reg; | |
| 701 | + unsigned short bank_offset = bank - pctl->desc->pin_base / | |
| 702 | + PINS_PER_BANK; | |
| 703 | + struct sunxi_pinctrl_regulator *s_reg = &pctl->regulators[bank_offset]; | |
| 704 | + struct regulator *reg = s_reg->regulator; | |
| 705 | + char supply[16]; | |
| 703 | 706 | int ret; |
| 704 | 707 | |
| 705 | − reg = s_reg->regulator; | |
| 706 | − if (!reg) { | |
| 707 | − char supply[16]; | |
| 708 | − | |
| 709 | − snprintf(supply, sizeof(supply), "vcc-p%c", 'a' + bank); | |
| 710 | − reg = regulator_get(pctl->dev, supply); | |
| 711 | − if (IS_ERR(reg)) { | |
| 712 | − dev_err(pctl->dev, "Couldn't get bank P%c regulator\n", | |
| 713 | − 'A' + bank); | |
| 714 | − return PTR_ERR(reg); | |
| 715 | − } | |
| 716 | − | |
| 717 | − s_reg->regulator = reg; | |
| 718 | − refcount_set(&s_reg->refcount, 1); | |
| 719 | − } else { | |
| 708 | + if (reg) { | |
| 720 | 709 | refcount_inc(&s_reg->refcount); |
| 710 | + return 0; | |
| 711 | + } | |
| 712 | + | |
| 713 | + snprintf(supply, sizeof(supply), "vcc-p%c", 'a' + bank); | |
| 714 | + reg = regulator_get(pctl->dev, supply); | |
| 715 | + if (IS_ERR(reg)) { | |
| 716 | + dev_err(pctl->dev, "Couldn't get bank P%c regulator\n", | |
| 717 | + 'A' + bank); | |
| 718 | + return PTR_ERR(reg); | |
| 721 | 719 | } |
| 722 | 720 | |
| 723 | 721 | ret = regulator_enable(reg); |
| @@ -727,13 +725,13 @@ static int sunxi_pmx_request(struct pinctrl_dev *pctldev, unsigned offset) · 3 unmodified lines | ||
| 727 | 725 | goto out; |
| 728 | 726 | } |
| 729 | 727 | |
| 728 | + s_reg->regulator = reg; | |
| 729 | + refcount_set(&s_reg->refcount, 1); | |
| 730 | + | |
| 730 | 731 | return 0; |
| 731 | 732 | |
| 732 | 733 | out: |
| 733 | − if (refcount_dec_and_test(&s_reg->refcount)) { | |
| 734 | − regulator_put(s_reg->regulator); | |
| 735 | − s_reg->regulator = NULL; | |
| 736 | − } | |
| 734 | + regulator_put(s_reg->regulator); | |
| 737 | 735 | |
| 738 | 736 | return ret; |
| 739 | 737 | } |
| @@ -742,7 +740,9 @@ static int sunxi_pmx_free(struct pinctrl_dev *pctldev, unsigned offset) · 2 unmodified lines | ||
| 742 | 740 | { |
| 743 | 741 | struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); |
| 744 | 742 | unsigned short bank = offset / PINS_PER_BANK; |
| 745 | − struct sunxi_pinctrl_regulator *s_reg = &pctl->regulators[bank]; | |
| 743 | + unsigned short bank_offset = bank - pctl->desc->pin_base / | |
| 744 | + PINS_PER_BANK; | |
| 745 | + struct sunxi_pinctrl_regulator *s_reg = &pctl->regulators[bank_offset]; | |
| 746 | 746 | |
| 747 | 747 | if (!refcount_dec_and_test(&s_reg->refcount)) |
| 748 | 748 | return 0; |
| @@ -136,7 +136,7 @@ struct sunxi_pinctrl { · 135 unmodified lines | ||
| 136 | 136 | struct gpio_chip *chip; |
| 137 | 137 | const struct sunxi_pinctrl_desc *desc; |
| 138 | 138 | struct device *dev; |
| 139 | − struct sunxi_pinctrl_regulator regulators[12]; | |
| 139 | + struct sunxi_pinctrl_regulator regulators[9]; | |
| 140 | 140 | struct irq_domain *domain; |
| 141 | 141 | struct sunxi_pinctrl_function *functions; |
| 142 | 142 | unsigned nfunctions; |
| @@ -905,6 +905,7 @@ config TOSHIBA_WMI · 904 unmodified lines | ||
| 905 | 905 | config ACPI_CMPC |
| 906 | 906 | tristate "CMPC Laptop Extras" |
| 907 | 907 | depends on ACPI && INPUT |
| 908 | + depends on BACKLIGHT_LCD_SUPPORT | |
| 908 | 909 | depends on RFKILL || RFKILL=n |
| 909 | 910 | select BACKLIGHT_CLASS_DEVICE |
| 910 | 911 | help |
| @@ -1009,7 +1010,7 @@ config INTEL_MFLD_THERMAL · 98 unmodified lines | ||
| 1009 | 1010 | |
| 1010 | 1011 | config INTEL_IPS |
| 1011 | 1012 | tristate "Intel Intelligent Power Sharing" |
| 1012 | − depends on ACPI | |
| 1013 | + depends on ACPI && PCI | |
| 1013 | 1014 | ---help--- |
| 1014 | 1015 | Intel Calpella platforms support dynamic power sharing between the |
| 1015 | 1016 | CPU and GPU, maximizing performance in a given TDP. This driver, |
| @@ -1128,6 +1129,7 @@ config INTEL_OAKTRAIL · 112 unmodified lines | ||
| 1128 | 1129 | config SAMSUNG_Q10 |
| 1129 | 1130 | tristate "Samsung Q10 Extras" |
| 1130 | 1131 | depends on ACPI |
| 1132 | + depends on BACKLIGHT_LCD_SUPPORT | |
| 1131 | 1133 | select BACKLIGHT_CLASS_DEVICE |
| 1132 | 1134 | ---help--- |
| 1133 | 1135 | This driver provides support for backlight control on Samsung Q10 |
| @@ -1135,7 +1137,7 @@ config SAMSUNG_Q10 · 1 unmodified line | ||
| 1135 | 1137 | |
| 1136 | 1138 | config APPLE_GMUX |
| 1137 | 1139 | tristate "Apple Gmux Driver" |
| 1138 | − depends on ACPI | |
| 1140 | + depends on ACPI && PCI | |
| 1139 | 1141 | depends on PNP |
| 1140 | 1142 | depends on BACKLIGHT_CLASS_DEVICE |
| 1141 | 1143 | depends on BACKLIGHT_APPLE=n || BACKLIGHT_APPLE |
| @@ -1174,7 +1176,7 @@ config INTEL_SMARTCONNECT · 32 unmodified lines | ||
| 1174 | 1176 | |
| 1175 | 1177 | config INTEL_PMC_IPC |
| 1176 | 1178 | tristate "Intel PMC IPC Driver" |
| 1177 | − depends on ACPI | |
| 1179 | + depends on ACPI && PCI | |
| 1178 | 1180 | ---help--- |
| 1179 | 1181 | This driver provides support for PMC control on some Intel platforms. |
| 1180 | 1182 | The PMC is an ARC processor which defines IPC commands for communication |
| @@ -224,7 +224,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) · 223 unmodified lines | ||
| 224 | 224 | extoff = NULL; |
| 225 | 225 | break; |
| 226 | 226 | } |
| 227 | − if (extoff->n_samples > PTP_MAX_SAMPLES) { | |
| 227 | + if (extoff->n_samples > PTP_MAX_SAMPLES | |
| 228 | + || extoff->rsv[0] || extoff->rsv[1] || extoff->rsv[2]) { | |
| 228 | 229 | err = -EINVAL; |
| 229 | 230 | break; |
| 230 | 231 | } |
| @@ -153,10 +153,15 @@ static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned int nvqs, · 152 unmodified lines | ||
| 153 | 153 | const bool * ctx, |
| 154 | 154 | struct irq_affinity *desc) |
| 155 | 155 | { |
| 156 | − int i, ret; | |
| 156 | + int i, ret, queue_idx = 0; | |
| 157 | 157 | |
| 158 | 158 | for (i = 0; i < nvqs; ++i) { |
| 159 | − vqs[i] = rp_find_vq(vdev, i, callbacks[i], names[i], | |
| 159 | + if (!names[i]) { | |
| 160 | + vqs[i] = NULL; | |
| 161 | + continue; | |
| 162 | + } | |
| 163 | + | |
| 164 | + vqs[i] = rp_find_vq(vdev, queue_idx++, callbacks[i], names[i], | |
| 160 | 165 | ctx ? ctx[i] : false); |
| 161 | 166 | if (IS_ERR(vqs[i])) { |
| 162 | 167 | ret = PTR_ERR(vqs[i]); |
| @@ -60,7 +60,9 @@ static void sclp_cpu_capability_notify(struct work_struct *work) · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | static void __ref sclp_cpu_change_notify(struct work_struct *work) |
| 62 | 62 | { |
| 63 | + lock_device_hotplug(); | |
| 63 | 64 | smp_rescan_cpus(); |
| 65 | + unlock_device_hotplug(); | |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | static void sclp_conf_receiver_fn(struct evbuf_header *evbuf) |
| @@ -403,7 +403,6 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device) · 402 unmodified lines | ||
| 403 | 403 | goto failed; |
| 404 | 404 | |
| 405 | 405 | /* report size limit per scatter-gather segment */ |
| 406 | − adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN; | |
| 407 | 406 | adapter->ccw_device->dev.dma_parms = &adapter->dma_parms; |
| 408 | 407 | |
| 409 | 408 | adapter->stat_read_buf_num = FSF_STATUS_READS_RECOM; |
| @@ -428,6 +428,8 @@ static struct scsi_host_template zfcp_scsi_host_template = { · 427 unmodified lines | ||
| 428 | 428 | .max_sectors = (((QDIO_MAX_ELEMENTS_PER_BUFFER - 1) |
| 429 | 429 | * ZFCP_QDIO_MAX_SBALS_PER_REQ) - 2) * 8, |
| 430 | 430 | /* GCD, adjusted later */ |
| 431 | + /* report size limit per scatter-gather segment */ | |
| 432 | + .max_segment_size = ZFCP_QDIO_SBALE_LEN, | |
| 431 | 433 | .dma_boundary = ZFCP_QDIO_SBALE_LEN - 1, |
| 432 | 434 | .shost_attrs = zfcp_sysfs_shost_attrs, |
| 433 | 435 | .sdev_attrs = zfcp_sysfs_sdev_attrs, |
| @@ -635,7 +635,7 @@ static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs, · 634 unmodified lines | ||
| 635 | 635 | { |
| 636 | 636 | struct virtio_ccw_device *vcdev = to_vc_device(vdev); |
| 637 | 637 | unsigned long *indicatorp = NULL; |
| 638 | − int ret, i; | |
| 638 | + int ret, i, queue_idx = 0; | |
| 639 | 639 | struct ccw1 *ccw; |
| 640 | 640 | |
| 641 | 641 | ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL); |
| @@ -643,8 +643,14 @@ static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs, · 1 unmodified line | ||
| 643 | 643 | return -ENOMEM; |
| 644 | 644 | |
| 645 | 645 | for (i = 0; i < nvqs; ++i) { |
| 646 | − vqs[i] = virtio_ccw_setup_vq(vdev, i, callbacks[i], names[i], | |
| 647 | − ctx ? ctx[i] : false, ccw); | |
| 646 | + if (!names[i]) { | |
| 647 | + vqs[i] = NULL; | |
| 648 | + continue; | |
| 649 | + } | |
| 650 | + | |
| 651 | + vqs[i] = virtio_ccw_setup_vq(vdev, queue_idx++, callbacks[i], | |
| 652 | + names[i], ctx ? ctx[i] : false, | |
| 653 | + ccw); | |
| 648 | 654 | if (IS_ERR(vqs[i])) { |
| 649 | 655 | ret = PTR_ERR(vqs[i]); |
| 650 | 656 | vqs[i] = NULL; |
| @@ -295,7 +295,7 @@ NCR_700_detect(struct scsi_host_template *tpnt, · 294 unmodified lines | ||
| 295 | 295 | if(tpnt->sdev_attrs == NULL) |
| 296 | 296 | tpnt->sdev_attrs = NCR_700_dev_attrs; |
| 297 | 297 | |
| 298 | − memory = dma_alloc_attrs(hostdata->dev, TOTAL_MEM_SIZE, &pScript, | |
| 298 | + memory = dma_alloc_attrs(dev, TOTAL_MEM_SIZE, &pScript, | |
| 299 | 299 | GFP_KERNEL, DMA_ATTR_NON_CONSISTENT); |
| 300 | 300 | if(memory == NULL) { |
| 301 | 301 | printk(KERN_ERR "53c700: Failed to allocate memory for driver, detaching\n"); |
| @@ -1747,11 +1747,10 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 1746 unmodified lines | ||
| 1747 | 1747 | shost->max_sectors = (shost->sg_tablesize * 8) + 112; |
| 1748 | 1748 | } |
| 1749 | 1749 | |
| 1750 | − error = dma_set_max_seg_size(&pdev->dev, | |
| 1751 | − (aac->adapter_info.options & AAC_OPT_NEW_COMM) ? | |
| 1752 | − (shost->max_sectors << 9) : 65536); | |
| 1753 | − if (error) | |
| 1754 | − goto out_deinit; | |
| 1750 | + if (aac->adapter_info.options & AAC_OPT_NEW_COMM) | |
| 1751 | + shost->max_segment_size = shost->max_sectors << 9; | |
| 1752 | + else | |
| 1753 | + shost->max_segment_size = 65536; | |
| 1755 | 1754 | |
| 1756 | 1755 | /* |
| 1757 | 1756 | * Firmware printf works only with older firmware. |
| @@ -240,6 +240,7 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba) · 239 unmodified lines | ||
| 240 | 240 | return NULL; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | + cmgr->hba = hba; | |
| 243 | 244 | cmgr->free_list = kcalloc(arr_sz, sizeof(*cmgr->free_list), |
| 244 | 245 | GFP_KERNEL); |
| 245 | 246 | if (!cmgr->free_list) { |
| @@ -256,7 +257,6 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba) · 10 unmodified lines | ||
| 256 | 257 | goto mem_err; |
| 257 | 258 | } |
| 258 | 259 | |
| 259 | − cmgr->hba = hba; | |
| 260 | 260 | cmgr->cmds = (struct bnx2fc_cmd **)(cmgr + 1); |
| 261 | 261 | |
| 262 | 262 | for (i = 0; i < arr_sz; i++) { |
| @@ -295,7 +295,7 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba) · 32 unmodified lines | ||
| 295 | 295 | |
| 296 | 296 | /* Allocate pool of io_bdts - one for each bnx2fc_cmd */ |
| 297 | 297 | mem_size = num_ios * sizeof(struct io_bdt *); |
| 298 | − cmgr->io_bdt_pool = kmalloc(mem_size, GFP_KERNEL); | |
| 298 | + cmgr->io_bdt_pool = kzalloc(mem_size, GFP_KERNEL); | |
| 299 | 299 | if (!cmgr->io_bdt_pool) { |
| 300 | 300 | printk(KERN_ERR PFX "failed to alloc io_bdt_pool\n"); |
| 301 | 301 | goto mem_err; |
| @@ -594,12 +594,12 @@ csio_vport_create(struct fc_vport *fc_vport, bool disable) · 593 unmodified lines | ||
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | fc_vport_set_state(fc_vport, FC_VPORT_INITIALIZING); |
| 597 | + ln->fc_vport = fc_vport; | |
| 597 | 598 | |
| 598 | 599 | if (csio_fcoe_alloc_vnp(hw, ln)) |
| 599 | 600 | goto error; |
| 600 | 601 | |
| 601 | 602 | *(struct csio_lnode **)fc_vport->dd_data = ln; |
| 602 | − ln->fc_vport = fc_vport; | |
| 603 | 603 | if (!fc_vport->node_name) |
| 604 | 604 | fc_vport->node_name = wwn_to_u64(csio_ln_wwnn(ln)); |
| 605 | 605 | if (!fc_vport->port_name) |
| @@ -1144,7 +1144,7 @@ static void ddp_clear_map(struct cxgbi_device *cdev, struct cxgbi_ppm *ppm, · 1143 unmodified lines | ||
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, |
| 1147 | − unsigned int tid, int pg_idx, bool reply) | |
| 1147 | + unsigned int tid, int pg_idx) | |
| 1148 | 1148 | { |
| 1149 | 1149 | struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0, |
| 1150 | 1150 | GFP_KERNEL); |
| @@ -1160,7 +1160,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, · 9 unmodified lines | ||
| 1160 | 1160 | req = (struct cpl_set_tcb_field *)skb->head; |
| 1161 | 1161 | req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); |
| 1162 | 1162 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); |
| 1163 | − req->reply = V_NO_REPLY(reply ? 0 : 1); | |
| 1163 | + req->reply = V_NO_REPLY(1); | |
| 1164 | 1164 | req->cpu_idx = 0; |
| 1165 | 1165 | req->word = htons(31); |
| 1166 | 1166 | req->mask = cpu_to_be64(0xF0000000); |
| @@ -1177,11 +1177,10 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, · 10 unmodified lines | ||
| 1177 | 1177 | * @tid: connection id |
| 1178 | 1178 | * @hcrc: header digest enabled |
| 1179 | 1179 | * @dcrc: data digest enabled |
| 1180 | − * @reply: request reply from h/w | |
| 1181 | 1180 | * set up the iscsi digest settings for a connection identified by tid |
| 1182 | 1181 | */ |
| 1183 | 1182 | static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, |
| 1184 | − int hcrc, int dcrc, int reply) | |
| 1183 | + int hcrc, int dcrc) | |
| 1185 | 1184 | { |
| 1186 | 1185 | struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0, |
| 1187 | 1186 | GFP_KERNEL); |
| @@ -1197,7 +1196,7 @@ static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, · 9 unmodified lines | ||
| 1197 | 1196 | req = (struct cpl_set_tcb_field *)skb->head; |
| 1198 | 1197 | req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); |
| 1199 | 1198 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); |
| 1200 | − req->reply = V_NO_REPLY(reply ? 0 : 1); | |
| 1199 | + req->reply = V_NO_REPLY(1); | |
| 1201 | 1200 | req->cpu_idx = 0; |
| 1202 | 1201 | req->word = htons(31); |
| 1203 | 1202 | req->mask = cpu_to_be64(0x0F000000); |
| @@ -1548,16 +1548,22 @@ static void do_set_tcb_rpl(struct cxgbi_device *cdev, struct sk_buff *skb) · 1547 unmodified lines | ||
| 1548 | 1548 | struct cxgbi_sock *csk; |
| 1549 | 1549 | |
| 1550 | 1550 | csk = lookup_tid(t, tid); |
| 1551 | − if (!csk) | |
| 1551 | + if (!csk) { | |
| 1552 | 1552 | pr_err("can't find conn. for tid %u.\n", tid); |
| 1553 | + return; | |
| 1554 | + } | |
| 1553 | 1555 | |
| 1554 | 1556 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, |
| 1555 | 1557 | "csk 0x%p,%u,%lx,%u, status 0x%x.\n", |
| 1556 | 1558 | csk, csk->state, csk->flags, csk->tid, rpl->status); |
| 1557 | 1559 | |
| 1558 | − if (rpl->status != CPL_ERR_NONE) | |
| 1560 | + if (rpl->status != CPL_ERR_NONE) { | |
| 1559 | 1561 | pr_err("csk 0x%p,%u, SET_TCB_RPL status %u.\n", |
| 1560 | 1562 | csk, tid, rpl->status); |
| 1563 | + csk->err = -EINVAL; | |
| 1564 | + } | |
| 1565 | + | |
| 1566 | + complete(&csk->cmpl); | |
| 1561 | 1567 | |
| 1562 | 1568 | __kfree_skb(skb); |
| 1563 | 1569 | } |
| @@ -1983,7 +1989,7 @@ static int ddp_set_map(struct cxgbi_ppm *ppm, struct cxgbi_sock *csk, · 419 unmodified lines | ||
| 1983 | 1989 | } |
| 1984 | 1990 | |
| 1985 | 1991 | static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid, |
| 1986 | − int pg_idx, bool reply) | |
| 1992 | + int pg_idx) | |
| 1987 | 1993 | { |
| 1988 | 1994 | struct sk_buff *skb; |
| 1989 | 1995 | struct cpl_set_tcb_field *req; |
| @@ -1999,7 +2005,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid, · 9 unmodified lines | ||
| 1999 | 2005 | req = (struct cpl_set_tcb_field *)skb->head; |
| 2000 | 2006 | INIT_TP_WR(req, csk->tid); |
| 2001 | 2007 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, csk->tid)); |
| 2002 | − req->reply_ctrl = htons(NO_REPLY_V(reply) | QUEUENO_V(csk->rss_qid)); | |
| 2008 | + req->reply_ctrl = htons(NO_REPLY_V(0) | QUEUENO_V(csk->rss_qid)); | |
| 2003 | 2009 | req->word_cookie = htons(0); |
| 2004 | 2010 | req->mask = cpu_to_be64(0x3 << 8); |
| 2005 | 2011 | req->val = cpu_to_be64(pg_idx << 8); |
| @@ -2008,12 +2014,15 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk, unsigned int tid, · 2 unmodified lines | ||
| 2008 | 2014 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, |
| 2009 | 2015 | "csk 0x%p, tid 0x%x, pg_idx %u.\n", csk, csk->tid, pg_idx); |
| 2010 | 2016 | |
| 2017 | + reinit_completion(&csk->cmpl); | |
| 2011 | 2018 | cxgb4_ofld_send(csk->cdev->ports[csk->port_id], skb); |
| 2012 | − return 0; | |
| 2019 | + wait_for_completion(&csk->cmpl); | |
| 2020 | + | |
| 2021 | + return csk->err; | |
| 2013 | 2022 | } |
| 2014 | 2023 | |
| 2015 | 2024 | static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, |
| 2016 | − int hcrc, int dcrc, int reply) | |
| 2025 | + int hcrc, int dcrc) | |
| 2017 | 2026 | { |
| 2018 | 2027 | struct sk_buff *skb; |
| 2019 | 2028 | struct cpl_set_tcb_field *req; |
| @@ -2031,7 +2040,7 @@ static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, · 11 unmodified lines | ||
| 2031 | 2040 | req = (struct cpl_set_tcb_field *)skb->head; |
| 2032 | 2041 | INIT_TP_WR(req, tid); |
| 2033 | 2042 | OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid)); |
| 2034 | − req->reply_ctrl = htons(NO_REPLY_V(reply) | QUEUENO_V(csk->rss_qid)); | |
| 2043 | + req->reply_ctrl = htons(NO_REPLY_V(0) | QUEUENO_V(csk->rss_qid)); | |
| 2035 | 2044 | req->word_cookie = htons(0); |
| 2036 | 2045 | req->mask = cpu_to_be64(0x3 << 4); |
| 2037 | 2046 | req->val = cpu_to_be64(((hcrc ? ULP_CRC_HEADER : 0) | |
| @@ -2041,8 +2050,11 @@ static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid, · 3 unmodified lines | ||
| 2041 | 2050 | log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, |
| 2042 | 2051 | "csk 0x%p, tid 0x%x, crc %d,%d.\n", csk, csk->tid, hcrc, dcrc); |
| 2043 | 2052 | |
| 2053 | + reinit_completion(&csk->cmpl); | |
| 2044 | 2054 | cxgb4_ofld_send(csk->cdev->ports[csk->port_id], skb); |
| 2045 | − return 0; | |
| 2055 | + wait_for_completion(&csk->cmpl); | |
| 2056 | + | |
| 2057 | + return csk->err; | |
| 2046 | 2058 | } |
| 2047 | 2059 | |
| 2048 | 2060 | static struct cxgbi_ppm *cdev2ppm(struct cxgbi_device *cdev) |
| @@ -573,6 +573,7 @@ static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev) · 572 unmodified lines | ||
| 573 | 573 | skb_queue_head_init(&csk->receive_queue); |
| 574 | 574 | skb_queue_head_init(&csk->write_queue); |
| 575 | 575 | timer_setup(&csk->retry_timer, NULL, 0); |
| 576 | + init_completion(&csk->cmpl); | |
| 576 | 577 | rwlock_init(&csk->callback_lock); |
| 577 | 578 | csk->cdev = cdev; |
| 578 | 579 | csk->flags = 0; |
| @@ -2251,14 +2252,14 @@ int cxgbi_set_conn_param(struct iscsi_cls_conn *cls_conn, · 1672 unmodified lines | ||
| 2251 | 2252 | if (!err && conn->hdrdgst_en) |
| 2252 | 2253 | err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, |
| 2253 | 2254 | conn->hdrdgst_en, |
| 2254 | − conn->datadgst_en, 0); | |
| 2255 | + conn->datadgst_en); | |
| 2255 | 2256 | break; |
| 2256 | 2257 | case ISCSI_PARAM_DATADGST_EN: |
| 2257 | 2258 | err = iscsi_set_param(cls_conn, param, buf, buflen); |
| 2258 | 2259 | if (!err && conn->datadgst_en) |
| 2259 | 2260 | err = csk->cdev->csk_ddp_setup_digest(csk, csk->tid, |
| 2260 | 2261 | conn->hdrdgst_en, |
| 2261 | − conn->datadgst_en, 0); | |
| 2262 | + conn->datadgst_en); | |
| 2262 | 2263 | break; |
| 2263 | 2264 | case ISCSI_PARAM_MAX_R2T: |
| 2264 | 2265 | return iscsi_tcp_set_max_r2t(conn, buf); |
| @@ -2384,7 +2385,7 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session, · 119 unmodified lines | ||
| 2384 | 2385 | |
| 2385 | 2386 | ppm = csk->cdev->cdev2ppm(csk->cdev); |
| 2386 | 2387 | err = csk->cdev->csk_ddp_setup_pgidx(csk, csk->tid, |
| 2387 | − ppm->tformat.pgsz_idx_dflt, 0); | |
| 2388 | + ppm->tformat.pgsz_idx_dflt); | |
| 2388 | 2389 | if (err < 0) |
| 2389 | 2390 | return err; |
| 2390 | 2391 | |
| @@ -149,6 +149,7 @@ struct cxgbi_sock { · 148 unmodified lines | ||
| 149 | 149 | struct sk_buff_head receive_queue; |
| 150 | 150 | struct sk_buff_head write_queue; |
| 151 | 151 | struct timer_list retry_timer; |
| 152 | + struct completion cmpl; | |
| 152 | 153 | int err; |
| 153 | 154 | rwlock_t callback_lock; |
| 154 | 155 | void *user_data; |
| @@ -490,9 +491,9 @@ struct cxgbi_device { · 335 unmodified lines | ||
| 490 | 491 | struct cxgbi_ppm *, |
| 491 | 492 | struct cxgbi_task_tag_info *); |
| 492 | 493 | int (*csk_ddp_setup_digest)(struct cxgbi_sock *, |
| 493 | − unsigned int, int, int, int); | |
| 494 | + unsigned int, int, int); | |
| 494 | 495 | int (*csk_ddp_setup_pgidx)(struct cxgbi_sock *, |
| 495 | − unsigned int, int, bool); | |
| 496 | + unsigned int, int); | |
| 496 | 497 | |
| 497 | 498 | void (*csk_release_offload_resources)(struct cxgbi_sock *); |
| 498 | 499 | int (*csk_rx_pdu_ready)(struct cxgbi_sock *, struct sk_buff *); |
| @@ -2507,6 +2507,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 2506 unmodified lines | ||
| 2507 | 2507 | sha->sas_port[i] = &hisi_hba->port[i].sas_port; |
| 2508 | 2508 | } |
| 2509 | 2509 | |
| 2510 | + if (hisi_hba->prot_mask) { | |
| 2511 | + dev_info(dev, "Registering for DIF/DIX prot_mask=0x%x\n", | |
| 2512 | + prot_mask); | |
| 2513 | + scsi_host_set_prot(hisi_hba->shost, prot_mask); | |
| 2514 | + } | |
| 2515 | + | |
| 2510 | 2516 | rc = scsi_add_host(shost, dev); |
| 2511 | 2517 | if (rc) |
| 2512 | 2518 | goto err_out_ha; |
| @@ -2519,12 +2525,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 6 unmodified lines | ||
| 2519 | 2525 | if (rc) |
| 2520 | 2526 | goto err_out_register_ha; |
| 2521 | 2527 | |
| 2522 | − if (hisi_hba->prot_mask) { | |
| 2523 | − dev_info(dev, "Registering for DIF/DIX prot_mask=0x%x\n", | |
| 2524 | − prot_mask); | |
| 2525 | − scsi_host_set_prot(hisi_hba->shost, prot_mask); | |
| 2526 | − } | |
| 2527 | − | |
| 2528 | 2528 | scsi_scan_host(shost); |
| 2529 | 2529 | |
| 2530 | 2530 | return 0; |
| @@ -576,6 +576,13 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id) · 575 unmodified lines | ||
| 576 | 576 | shost->max_lun = ~0; |
| 577 | 577 | shost->max_cmd_len = MAX_COMMAND_SIZE; |
| 578 | 578 | |
| 579 | + /* turn on DIF support */ | |
| 580 | + scsi_host_set_prot(shost, | |
| 581 | + SHOST_DIF_TYPE1_PROTECTION | | |
| 582 | + SHOST_DIF_TYPE2_PROTECTION | | |
| 583 | + SHOST_DIF_TYPE3_PROTECTION); | |
| 584 | + scsi_host_set_guard(shost, SHOST_DIX_GUARD_CRC); | |
| 585 | + | |
| 579 | 586 | err = scsi_add_host(shost, &pdev->dev); |
| 580 | 587 | if (err) |
| 581 | 588 | goto err_shost; |
| @@ -663,13 +670,6 @@ static int isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 81 unmodified lines | ||
| 663 | 670 | goto err_host_alloc; |
| 664 | 671 | } |
| 665 | 672 | pci_info->hosts[i] = h; |
| 666 | − | |
| 667 | − /* turn on DIF support */ | |
| 668 | − scsi_host_set_prot(to_shost(h), | |
| 669 | − SHOST_DIF_TYPE1_PROTECTION | | |
| 670 | − SHOST_DIF_TYPE2_PROTECTION | | |
| 671 | − SHOST_DIF_TYPE3_PROTECTION); | |
| 672 | − scsi_host_set_guard(to_shost(h), SHOST_DIX_GUARD_CRC); | |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | err = isci_setup_interrupts(pdev); |
| @@ -1726,14 +1726,14 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, · 1725 unmodified lines | ||
| 1726 | 1726 | fc_frame_payload_op(fp) != ELS_LS_ACC) { |
| 1727 | 1727 | FC_LPORT_DBG(lport, "FLOGI not accepted or bad response\n"); |
| 1728 | 1728 | fc_lport_error(lport, fp); |
| 1729 | − goto err; | |
| 1729 | + goto out; | |
| 1730 | 1730 | } |
| 1731 | 1731 | |
| 1732 | 1732 | flp = fc_frame_payload_get(fp, sizeof(*flp)); |
| 1733 | 1733 | if (!flp) { |
| 1734 | 1734 | FC_LPORT_DBG(lport, "FLOGI bad response\n"); |
| 1735 | 1735 | fc_lport_error(lport, fp); |
| 1736 | − goto err; | |
| 1736 | + goto out; | |
| 1737 | 1737 | } |
| 1738 | 1738 | |
| 1739 | 1739 | mfs = ntohs(flp->fl_csp.sp_bb_data) & |
| @@ -1743,7 +1743,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, · 3 unmodified lines | ||
| 1743 | 1743 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " |
| 1744 | 1744 | "lport->mfs:%hu\n", mfs, lport->mfs); |
| 1745 | 1745 | fc_lport_error(lport, fp); |
| 1746 | − goto err; | |
| 1746 | + goto out; | |
| 1747 | 1747 | } |
| 1748 | 1748 | |
| 1749 | 1749 | if (mfs <= lport->mfs) { |
| @@ -297,7 +297,8 @@ lpfc_nvme_localport_delete(struct nvme_fc_local_port *localport) · 296 unmodified lines | ||
| 297 | 297 | lport); |
| 298 | 298 | |
| 299 | 299 | /* release any threads waiting for the unreg to complete */ |
| 300 | − complete(&lport->lport_unreg_done); | |
| 300 | + if (lport->vport->localport) | |
| 301 | + complete(lport->lport_unreg_cmp); | |
| 301 | 302 | } |
| 302 | 303 | |
| 303 | 304 | /* lpfc_nvme_remoteport_delete |
| @@ -2545,7 +2546,8 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) · 2241 unmodified lines | ||
| 2545 | 2546 | */ |
| 2546 | 2547 | void |
| 2547 | 2548 | lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, |
| 2548 | − struct lpfc_nvme_lport *lport) | |
| 2549 | + struct lpfc_nvme_lport *lport, | |
| 2550 | + struct completion *lport_unreg_cmp) | |
| 2549 | 2551 | { |
| 2550 | 2552 | #if (IS_ENABLED(CONFIG_NVME_FC)) |
| 2551 | 2553 | u32 wait_tmo; |
| @@ -2557,8 +2559,7 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, · 5 unmodified lines | ||
| 2557 | 2559 | */ |
| 2558 | 2560 | wait_tmo = msecs_to_jiffies(LPFC_NVME_WAIT_TMO * 1000); |
| 2559 | 2561 | while (true) { |
| 2560 | − ret = wait_for_completion_timeout(&lport->lport_unreg_done, | |
| 2561 | − wait_tmo); | |
| 2562 | + ret = wait_for_completion_timeout(lport_unreg_cmp, wait_tmo); | |
| 2562 | 2563 | if (unlikely(!ret)) { |
| 2563 | 2564 | lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_IOERR, |
| 2564 | 2565 | "6176 Lport %p Localport %p wait " |
| @@ -2592,12 +2593,12 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) · 27 unmodified lines | ||
| 2592 | 2593 | struct lpfc_nvme_lport *lport; |
| 2593 | 2594 | struct lpfc_nvme_ctrl_stat *cstat; |
| 2594 | 2595 | int ret; |
| 2596 | + DECLARE_COMPLETION_ONSTACK(lport_unreg_cmp); | |
| 2595 | 2597 | |
| 2596 | 2598 | if (vport->nvmei_support == 0) |
| 2597 | 2599 | return; |
| 2598 | 2600 | |
| 2599 | 2601 | localport = vport->localport; |
| 2600 | − vport->localport = NULL; | |
| 2601 | 2602 | lport = (struct lpfc_nvme_lport *)localport->private; |
| 2602 | 2603 | cstat = lport->cstat; |
| 2603 | 2604 | |
| @@ -2608,13 +2609,14 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) · 4 unmodified lines | ||
| 2608 | 2609 | /* lport's rport list is clear. Unregister |
| 2609 | 2610 | * lport and release resources. |
| 2610 | 2611 | */ |
| 2611 | − init_completion(&lport->lport_unreg_done); | |
| 2612 | + lport->lport_unreg_cmp = &lport_unreg_cmp; | |
| 2612 | 2613 | ret = nvme_fc_unregister_localport(localport); |
| 2613 | 2614 | |
| 2614 | 2615 | /* Wait for completion. This either blocks |
| 2615 | 2616 | * indefinitely or succeeds |
| 2616 | 2617 | */ |
| 2617 | − lpfc_nvme_lport_unreg_wait(vport, lport); | |
| 2618 | + lpfc_nvme_lport_unreg_wait(vport, lport, &lport_unreg_cmp); | |
| 2619 | + vport->localport = NULL; | |
| 2618 | 2620 | kfree(cstat); |
| 2619 | 2621 | |
| 2620 | 2622 | /* Regardless of the unregister upcall response, clear |
| @@ -50,7 +50,7 @@ struct lpfc_nvme_ctrl_stat { · 49 unmodified lines | ||
| 50 | 50 | /* Declare nvme-based local and remote port definitions. */ |
| 51 | 51 | struct lpfc_nvme_lport { |
| 52 | 52 | struct lpfc_vport *vport; |
| 53 | − struct completion lport_unreg_done; | |
| 53 | + struct completion *lport_unreg_cmp; | |
| 54 | 54 | /* Add stats counters here */ |
| 55 | 55 | struct lpfc_nvme_ctrl_stat *cstat; |
| 56 | 56 | atomic_t fc4NvmeLsRequests; |
| @@ -1003,7 +1003,8 @@ lpfc_nvmet_targetport_delete(struct nvmet_fc_target_port *targetport) · 1002 unmodified lines | ||
| 1003 | 1003 | struct lpfc_nvmet_tgtport *tport = targetport->private; |
| 1004 | 1004 | |
| 1005 | 1005 | /* release any threads waiting for the unreg to complete */ |
| 1006 | − complete(&tport->tport_unreg_done); | |
| 1006 | + if (tport->phba->targetport) | |
| 1007 | + complete(tport->tport_unreg_cmp); | |
| 1007 | 1008 | } |
| 1008 | 1009 | |
| 1009 | 1010 | static void |
| @@ -1692,6 +1693,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba) · 682 unmodified lines | ||
| 1692 | 1693 | struct lpfc_nvmet_tgtport *tgtp; |
| 1693 | 1694 | struct lpfc_queue *wq; |
| 1694 | 1695 | uint32_t qidx; |
| 1696 | + DECLARE_COMPLETION_ONSTACK(tport_unreg_cmp); | |
| 1695 | 1697 | |
| 1696 | 1698 | if (phba->nvmet_support == 0) |
| 1697 | 1699 | return; |
| @@ -1701,9 +1703,9 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba) · 3 unmodified lines | ||
| 1701 | 1703 | wq = phba->sli4_hba.nvme_wq[qidx]; |
| 1702 | 1704 | lpfc_nvmet_wqfull_flush(phba, wq, NULL); |
| 1703 | 1705 | } |
| 1704 | − init_completion(&tgtp->tport_unreg_done); | |
| 1706 | + tgtp->tport_unreg_cmp = &tport_unreg_cmp; | |
| 1705 | 1707 | nvmet_fc_unregister_targetport(phba->targetport); |
| 1706 | − wait_for_completion_timeout(&tgtp->tport_unreg_done, 5); | |
| 1708 | + wait_for_completion_timeout(&tport_unreg_cmp, 5); | |
| 1707 | 1709 | lpfc_nvmet_cleanup_io_context(phba); |
| 1708 | 1710 | } |
| 1709 | 1711 | phba->targetport = NULL; |
| @@ -34,7 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | /* Used for NVME Target */ |
| 35 | 35 | struct lpfc_nvmet_tgtport { |
| 36 | 36 | struct lpfc_hba *phba; |
| 37 | − struct completion tport_unreg_done; | |
| 37 | + struct completion *tport_unreg_cmp; | |
| 38 | 38 | |
| 39 | 39 | /* Stats counters - lpfc_nvmet_unsol_ls_buffer */ |
| 40 | 40 | atomic_t rcv_ls_req_in; |
| @@ -9407,6 +9407,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq, · 9406 unmodified lines | ||
| 9407 | 9407 | cmnd = CMD_XMIT_SEQUENCE64_CR; |
| 9408 | 9408 | if (phba->link_flag & LS_LOOPBACK_MODE) |
| 9409 | 9409 | bf_set(wqe_xo, &wqe->xmit_sequence.wge_ctl, 1); |
| 9410 | + /* fall through */ | |
| 9410 | 9411 | case CMD_XMIT_SEQUENCE64_CR: |
| 9411 | 9412 | /* word3 iocb=io_tag32 wqe=reserved */ |
| 9412 | 9413 | wqe->xmit_sequence.rsvd3 = 0; |
| @@ -13528,6 +13529,7 @@ lpfc_sli4_sp_handle_rcqe(struct lpfc_hba *phba, struct lpfc_rcqe *rcqe) · 4115 unmodified lines | ||
| 13528 | 13529 | case FC_STATUS_RQ_BUF_LEN_EXCEEDED: |
| 13529 | 13530 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
| 13530 | 13531 | "2537 Receive Frame Truncated!!\n"); |
| 13532 | + /* fall through */ | |
| 13531 | 13533 | case FC_STATUS_RQ_SUCCESS: |
| 13532 | 13534 | spin_lock_irqsave(&phba->hbalock, iflags); |
| 13533 | 13535 | lpfc_sli4_rq_release(hrq, drq); |
| @@ -13937,7 +13939,7 @@ lpfc_sli4_nvmet_handle_rcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, · 403 unmodified lines | ||
| 13937 | 13939 | case FC_STATUS_RQ_BUF_LEN_EXCEEDED: |
| 13938 | 13940 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
| 13939 | 13941 | "6126 Receive Frame Truncated!!\n"); |
| 13940 | − /* Drop thru */ | |
| 13942 | + /* fall through */ | |
| 13941 | 13943 | case FC_STATUS_RQ_SUCCESS: |
| 13942 | 13944 | spin_lock_irqsave(&phba->hbalock, iflags); |
| 13943 | 13945 | lpfc_sli4_rq_release(hrq, drq); |
| @@ -14849,7 +14851,7 @@ lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax) · 905 unmodified lines | ||
| 14849 | 14851 | eq->entry_count); |
| 14850 | 14852 | if (eq->entry_count < 256) |
| 14851 | 14853 | return -EINVAL; |
| 14852 | − /* otherwise default to smallest count (drop through) */ | |
| 14854 | + /* fall through - otherwise default to smallest count */ | |
| 14853 | 14855 | case 256: |
| 14854 | 14856 | bf_set(lpfc_eq_context_count, &eq_create->u.request.context, |
| 14855 | 14857 | LPFC_EQ_CNT_256); |
| @@ -14980,7 +14982,7 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, · 124 unmodified lines | ||
| 14980 | 14982 | LPFC_CQ_CNT_WORD7); |
| 14981 | 14983 | break; |
| 14982 | 14984 | } |
| 14983 | − /* Fall Thru */ | |
| 14985 | + /* fall through */ | |
| 14984 | 14986 | default: |
| 14985 | 14987 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
| 14986 | 14988 | "0361 Unsupported CQ count: " |
| @@ -14991,7 +14993,7 @@ lpfc_cq_create(struct lpfc_hba *phba, struct lpfc_queue *cq, · 4 unmodified lines | ||
| 14991 | 14993 | status = -EINVAL; |
| 14992 | 14994 | goto out; |
| 14993 | 14995 | } |
| 14994 | − /* otherwise default to smallest count (drop through) */ | |
| 14996 | + /* fall through - otherwise default to smallest count */ | |
| 14995 | 14997 | case 256: |
| 14996 | 14998 | bf_set(lpfc_cq_context_count, &cq_create->u.request.context, |
| 14997 | 14999 | LPFC_CQ_CNT_256); |
| @@ -15151,7 +15153,7 @@ lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp, · 153 unmodified lines | ||
| 15151 | 15153 | LPFC_CQ_CNT_WORD7); |
| 15152 | 15154 | break; |
| 15153 | 15155 | } |
| 15154 | − /* Fall Thru */ | |
| 15156 | + /* fall through */ | |
| 15155 | 15157 | default: |
| 15156 | 15158 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
| 15157 | 15159 | "3118 Bad CQ count. (%d)\n", |
| @@ -15160,7 +15162,7 @@ lpfc_cq_create_set(struct lpfc_hba *phba, struct lpfc_queue **cqp, · 2 unmodified lines | ||
| 15160 | 15162 | status = -EINVAL; |
| 15161 | 15163 | goto out; |
| 15162 | 15164 | } |
| 15163 | − /* otherwise default to smallest (drop thru) */ | |
| 15165 | + /* fall through - otherwise default to smallest */ | |
| 15164 | 15166 | case 256: |
| 15165 | 15167 | bf_set(lpfc_mbx_cq_create_set_cqe_cnt, |
| 15166 | 15168 | &cq_set->u.request, LPFC_CQ_CNT_256); |
| @@ -15432,7 +15434,7 @@ lpfc_mq_create(struct lpfc_hba *phba, struct lpfc_queue *mq, · 265 unmodified lines | ||
| 15432 | 15434 | status = -EINVAL; |
| 15433 | 15435 | goto out; |
| 15434 | 15436 | } |
| 15435 | − /* otherwise default to smallest count (drop through) */ | |
| 15437 | + /* fall through - otherwise default to smallest count */ | |
| 15436 | 15438 | case 16: |
| 15437 | 15439 | bf_set(lpfc_mq_context_ring_size, |
| 15438 | 15440 | &mq_create_ext->u.request.context, |
| @@ -15851,7 +15853,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq, · 412 unmodified lines | ||
| 15851 | 15853 | status = -EINVAL; |
| 15852 | 15854 | goto out; |
| 15853 | 15855 | } |
| 15854 | − /* otherwise default to smallest count (drop through) */ | |
| 15856 | + /* fall through - otherwise default to smallest count */ | |
| 15855 | 15857 | case 512: |
| 15856 | 15858 | bf_set(lpfc_rq_context_rqe_count, |
| 15857 | 15859 | &rq_create->u.request.context, |
| @@ -15988,7 +15990,7 @@ lpfc_rq_create(struct lpfc_hba *phba, struct lpfc_queue *hrq, · 130 unmodified lines | ||
| 15988 | 15990 | status = -EINVAL; |
| 15989 | 15991 | goto out; |
| 15990 | 15992 | } |
| 15991 | − /* otherwise default to smallest count (drop through) */ | |
| 15993 | + /* fall through - otherwise default to smallest count */ | |
| 15992 | 15994 | case 512: |
| 15993 | 15995 | bf_set(lpfc_rq_context_rqe_count, |
| 15994 | 15996 | &rq_create->u.request.context, |
| @@ -6236,7 +6236,7 @@ megasas_set_dma_mask(struct megasas_instance *instance) · 6235 unmodified lines | ||
| 6236 | 6236 | instance->consistent_mask_64bit = true; |
| 6237 | 6237 | |
| 6238 | 6238 | dev_info(&pdev->dev, "%s bit DMA mask and %s bit consistent mask\n", |
| 6239 | − ((*pdev->dev.dma_mask == DMA_BIT_MASK(64)) ? "63" : "32"), | |
| 6239 | + ((*pdev->dev.dma_mask == DMA_BIT_MASK(63)) ? "63" : "32"), | |
| 6240 | 6240 | (instance->consistent_mask_64bit ? "63" : "32")); |
| 6241 | 6241 | |
| 6242 | 6242 | return 0; |
| @@ -175,7 +175,8 @@ megasas_clear_intr_fusion(struct megasas_instance *instance) · 174 unmodified lines | ||
| 175 | 175 | /* |
| 176 | 176 | * Check if it is our interrupt |
| 177 | 177 | */ |
| 178 | − status = readl(®s->outbound_intr_status); | |
| 178 | + status = megasas_readl(instance, | |
| 179 | + ®s->outbound_intr_status); | |
| 179 | 180 | |
| 180 | 181 | if (status & 1) { |
| 181 | 182 | writel(status, ®s->outbound_intr_status); |
| @@ -657,7 +657,7 @@ static int pm8001_dev_found_notify(struct domain_device *dev) · 656 unmodified lines | ||
| 657 | 657 | if (dev->dev_type == SAS_SATA_DEV) { |
| 658 | 658 | pm8001_device->attached_phy = |
| 659 | 659 | dev->rphy->identify.phy_identifier; |
| 660 | − flag = 1; /* directly sata*/ | |
| 660 | + flag = 1; /* directly sata */ | |
| 661 | 661 | } |
| 662 | 662 | } /*register this device to HBA*/ |
| 663 | 663 | PM8001_DISC_DBG(pm8001_ha, pm8001_printk("Found device\n")); |
| @@ -953,6 +953,7 @@ static int qedi_ep_poll(struct iscsi_endpoint *ep, int timeout_ms) · 952 unmodified lines | ||
| 953 | 953 | |
| 954 | 954 | qedi_ep = ep->dd_data; |
| 955 | 955 | if (qedi_ep->state == EP_STATE_IDLE || |
| 956 | + qedi_ep->state == EP_STATE_OFLDCONN_NONE || | |
| 956 | 957 | qedi_ep->state == EP_STATE_OFLDCONN_FAILED) |
| 957 | 958 | return -1; |
| 958 | 959 | |
| @@ -1035,6 +1036,7 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) · 76 unmodified lines | ||
| 1035 | 1036 | |
| 1036 | 1037 | switch (qedi_ep->state) { |
| 1037 | 1038 | case EP_STATE_OFLDCONN_START: |
| 1039 | + case EP_STATE_OFLDCONN_NONE: | |
| 1038 | 1040 | goto ep_release_conn; |
| 1039 | 1041 | case EP_STATE_OFLDCONN_FAILED: |
| 1040 | 1042 | break; |
| @@ -1225,6 +1227,7 @@ static int qedi_set_path(struct Scsi_Host *shost, struct iscsi_path *path_data) · 184 unmodified lines | ||
| 1225 | 1227 | |
| 1226 | 1228 | if (!is_valid_ether_addr(&path_data->mac_addr[0])) { |
| 1227 | 1229 | QEDI_NOTICE(&qedi->dbg_ctx, "dst mac NOT VALID\n"); |
| 1230 | + qedi_ep->state = EP_STATE_OFLDCONN_NONE; | |
| 1228 | 1231 | ret = -EIO; |
| 1229 | 1232 | goto set_path_exit; |
| 1230 | 1233 | } |
| @@ -59,6 +59,7 @@ enum { · 58 unmodified lines | ||
| 59 | 59 | EP_STATE_OFLDCONN_FAILED = 0x2000, |
| 60 | 60 | EP_STATE_CONNECT_FAILED = 0x4000, |
| 61 | 61 | EP_STATE_DISCONN_TIMEDOUT = 0x8000, |
| 62 | + EP_STATE_OFLDCONN_NONE = 0x10000, | |
| 62 | 63 | }; |
| 63 | 64 | |
| 64 | 65 | struct qedi_conn; |
| @@ -4248,7 +4248,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 4247 unmodified lines | ||
| 4248 | 4248 | ha->devnum = devnum; /* specifies microcode load address */ |
| 4249 | 4249 | |
| 4250 | 4250 | #ifdef QLA_64BIT_PTR |
| 4251 | − if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { | |
| 4251 | + if (dma_set_mask_and_coherent(&ha->pdev->dev, DMA_BIT_MASK(64))) { | |
| 4252 | 4252 | if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) { |
| 4253 | 4253 | printk(KERN_WARNING "scsi(%li): Unable to set a " |
| 4254 | 4254 | "suitable DMA mask - aborting\n", ha->host_no); |
| @@ -4394,6 +4394,8 @@ typedef struct scsi_qla_host { · 4393 unmodified lines | ||
| 4394 | 4394 | uint16_t n2n_id; |
| 4395 | 4395 | struct list_head gpnid_list; |
| 4396 | 4396 | struct fab_scan scan; |
| 4397 | + | |
| 4398 | + unsigned int irq_offset; | |
| 4397 | 4399 | } scsi_qla_host_t; |
| 4398 | 4400 | |
| 4399 | 4401 | struct qla27xx_image_status { |
| @@ -3446,6 +3446,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) · 3445 unmodified lines | ||
| 3446 | 3446 | "Adjusted Max no of queues pairs: %d.\n", ha->max_qpairs); |
| 3447 | 3447 | } |
| 3448 | 3448 | } |
| 3449 | + vha->irq_offset = desc.pre_vectors; | |
| 3449 | 3450 | ha->msix_entries = kcalloc(ha->msix_count, |
| 3450 | 3451 | sizeof(struct qla_msix_entry), |
| 3451 | 3452 | GFP_KERNEL); |
| @@ -6939,7 +6939,7 @@ static int qla2xxx_map_queues(struct Scsi_Host *shost) · 6938 unmodified lines | ||
| 6939 | 6939 | if (USER_CTRL_IRQ(vha->hw)) |
| 6940 | 6940 | rc = blk_mq_map_queues(qmap); |
| 6941 | 6941 | else |
| 6942 | − rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev, 0); | |
| 6942 | + rc = blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset); | |
| 6943 | 6943 | return rc; |
| 6944 | 6944 | } |
| 6945 | 6945 | |
| @@ -7232,6 +7232,8 @@ static int qla4xxx_sysfs_ddb_tgt_create(struct scsi_qla_host *ha, · 7231 unmodified lines | ||
| 7232 | 7232 | |
| 7233 | 7233 | rc = qla4xxx_copy_from_fwddb_param(fnode_sess, fnode_conn, |
| 7234 | 7234 | fw_ddb_entry); |
| 7235 | + if (rc) | |
| 7236 | + goto free_sess; | |
| 7235 | 7237 | |
| 7236 | 7238 | ql4_printk(KERN_INFO, ha, "%s: sysfs entry %s created\n", |
| 7237 | 7239 | __func__, fnode_sess->dev.kobj.name); |
| @@ -62,7 +62,7 @@ · 61 unmodified lines | ||
| 62 | 62 | |
| 63 | 63 | /* make sure inq_product_rev string corresponds to this version */ |
| 64 | 64 | #define SDEBUG_VERSION "0188" /* format to fit INQUIRY revision field */ |
| 65 | −static const char *sdebug_version_date = "20180128"; | |
| 65 | +static const char *sdebug_version_date = "20190125"; | |
| 66 | 66 | |
| 67 | 67 | #define MY_NAME "scsi_debug" |
| 68 | 68 | |
| @@ -735,7 +735,7 @@ static inline bool scsi_debug_lbp(void) · 666 unmodified lines | ||
| 735 | 735 | (sdebug_lbpu || sdebug_lbpws || sdebug_lbpws10); |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | −static void *fake_store(unsigned long long lba) | |
| 738 | +static void *lba2fake_store(unsigned long long lba) | |
| 739 | 739 | { |
| 740 | 740 | lba = do_div(lba, sdebug_store_sectors); |
| 741 | 741 | |
| @@ -2514,8 +2514,8 @@ static int do_device_access(struct scsi_cmnd *scmd, u32 sg_skip, u64 lba, · 1772 unmodified lines | ||
| 2514 | 2514 | return ret; |
| 2515 | 2515 | } |
| 2516 | 2516 | |
| 2517 | −/* If fake_store(lba,num) compares equal to arr(num), then copy top half of | |
| 2518 | − * arr into fake_store(lba,num) and return true. If comparison fails then | |
| 2517 | +/* If lba2fake_store(lba,num) compares equal to arr(num), then copy top half of | |
| 2518 | + * arr into lba2fake_store(lba,num) and return true. If comparison fails then | |
| 2519 | 2519 | * return false. */ |
| 2520 | 2520 | static bool comp_write_worker(u64 lba, u32 num, const u8 *arr) |
| 2521 | 2521 | { |
| @@ -2643,7 +2643,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec, · 121 unmodified lines | ||
| 2643 | 2643 | if (sdt->app_tag == cpu_to_be16(0xffff)) |
| 2644 | 2644 | continue; |
| 2645 | 2645 | |
| 2646 | − ret = dif_verify(sdt, fake_store(sector), sector, ei_lba); | |
| 2646 | + ret = dif_verify(sdt, lba2fake_store(sector), sector, ei_lba); | |
| 2647 | 2647 | if (ret) { |
| 2648 | 2648 | dif_errors++; |
| 2649 | 2649 | return ret; |
| @@ -3261,10 +3261,12 @@ err_out: · 611 unmodified lines | ||
| 3261 | 3261 | static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, |
| 3262 | 3262 | u32 ei_lba, bool unmap, bool ndob) |
| 3263 | 3263 | { |
| 3264 | + int ret; | |
| 3264 | 3265 | unsigned long iflags; |
| 3265 | 3266 | unsigned long long i; |
| 3266 | − int ret; | |
| 3267 | − u64 lba_off; | |
| 3267 | + u32 lb_size = sdebug_sector_size; | |
| 3268 | + u64 block, lbaa; | |
| 3269 | + u8 *fs1p; | |
| 3268 | 3270 | |
| 3269 | 3271 | ret = check_device_access_params(scp, lba, num); |
| 3270 | 3272 | if (ret) |
| @@ -3276,31 +3278,30 @@ static int resp_write_same(struct scsi_cmnd *scp, u64 lba, u32 num, · 5 unmodified lines | ||
| 3276 | 3278 | unmap_region(lba, num); |
| 3277 | 3279 | goto out; |
| 3278 | 3280 | } |
| 3279 | − | |
| 3280 | − lba_off = lba * sdebug_sector_size; | |
| 3281 | + lbaa = lba; | |
| 3282 | + block = do_div(lbaa, sdebug_store_sectors); | |
| 3281 | 3283 | /* if ndob then zero 1 logical block, else fetch 1 logical block */ |
| 3284 | + fs1p = fake_storep + (block * lb_size); | |
| 3282 | 3285 | if (ndob) { |
| 3283 | − memset(fake_storep + lba_off, 0, sdebug_sector_size); | |
| 3286 | + memset(fs1p, 0, lb_size); | |
| 3284 | 3287 | ret = 0; |
| 3285 | 3288 | } else |
| 3286 | − ret = fetch_to_dev_buffer(scp, fake_storep + lba_off, | |
| 3287 | − sdebug_sector_size); | |
| 3289 | + ret = fetch_to_dev_buffer(scp, fs1p, lb_size); | |
| 3288 | 3290 | |
| 3289 | 3291 | if (-1 == ret) { |
| 3290 | 3292 | write_unlock_irqrestore(&atomic_rw, iflags); |
| 3291 | 3293 | return DID_ERROR << 16; |
| 3292 | − } else if (sdebug_verbose && !ndob && (ret < sdebug_sector_size)) | |
| 3294 | + } else if (sdebug_verbose && !ndob && (ret < lb_size)) | |
| 3293 | 3295 | sdev_printk(KERN_INFO, scp->device, |
| 3294 | 3296 | "%s: %s: lb size=%u, IO sent=%d bytes\n", |
| 3295 | − my_name, "write same", | |
| 3296 | − sdebug_sector_size, ret); | |
| 3297 | + my_name, "write same", lb_size, ret); | |
| 3297 | 3298 | |
| 3298 | 3299 | /* Copy first sector to remaining blocks */ |
| 3299 | − for (i = 1 ; i < num ; i++) | |
| 3300 | − memcpy(fake_storep + ((lba + i) * sdebug_sector_size), | |
| 3301 | − fake_storep + lba_off, | |
| 3302 | − sdebug_sector_size); | |
| 3303 | − | |
| 3300 | + for (i = 1 ; i < num ; i++) { | |
| 3301 | + lbaa = lba + i; | |
| 3302 | + block = do_div(lbaa, sdebug_store_sectors); | |
| 3303 | + memmove(fake_storep + (block * lb_size), fs1p, lb_size); | |
| 3304 | + } | |
| 3304 | 3305 | if (scsi_debug_lbp()) |
| 3305 | 3306 | map_region(lba, num); |
| 3306 | 3307 | out: |
| @@ -1842,8 +1842,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) · 1841 unmodified lines | ||
| 1842 | 1842 | blk_queue_segment_boundary(q, shost->dma_boundary); |
| 1843 | 1843 | dma_set_seg_boundary(dev, shost->dma_boundary); |
| 1844 | 1844 | |
| 1845 | − blk_queue_max_segment_size(q, | |
| 1846 | − min(shost->max_segment_size, dma_get_max_seg_size(dev))); | |
| 1845 | + blk_queue_max_segment_size(q, shost->max_segment_size); | |
| 1846 | + dma_set_max_seg_size(dev, shost->max_segment_size); | |
| 1847 | 1847 | |
| 1848 | 1848 | /* |
| 1849 | 1849 | * Set a reasonable default alignment: The larger of 32-byte (dword), |
| @@ -80,8 +80,22 @@ static int scsi_dev_type_resume(struct device *dev, · 79 unmodified lines | ||
| 80 | 80 | |
| 81 | 81 | if (err == 0) { |
| 82 | 82 | pm_runtime_disable(dev); |
| 83 | − pm_runtime_set_active(dev); | |
| 83 | + err = pm_runtime_set_active(dev); | |
| 84 | 84 | pm_runtime_enable(dev); |
| 85 | + | |
| 86 | + /* | |
| 87 | + * Forcibly set runtime PM status of request queue to "active" | |
| 88 | + * to make sure we can again get requests from the queue | |
| 89 | + * (see also blk_pm_peek_request()). | |
| 90 | + * | |
| 91 | + * The resume hook will correct runtime PM status of the disk. | |
| 92 | + */ | |
| 93 | + if (!err && scsi_is_sdev_device(dev)) { | |
| 94 | + struct scsi_device *sdev = to_scsi_device(dev); | |
| 95 | + | |
| 96 | + if (sdev->request_queue->dev) | |
| 97 | + blk_set_runtime_active(sdev->request_queue); | |
| 98 | + } | |
| 85 | 99 | } |
| 86 | 100 | |
| 87 | 101 | return err; |
| @@ -140,16 +154,6 @@ static int scsi_bus_resume_common(struct device *dev, · 52 unmodified lines | ||
| 140 | 154 | else |
| 141 | 155 | fn = NULL; |
| 142 | 156 | |
| 143 | − /* | |
| 144 | − * Forcibly set runtime PM status of request queue to "active" to | |
| 145 | − * make sure we can again get requests from the queue (see also | |
| 146 | − * blk_pm_peek_request()). | |
| 147 | − * | |
| 148 | − * The resume hook will correct runtime PM status of the disk. | |
| 149 | − */ | |
| 150 | − if (scsi_is_sdev_device(dev) && pm_runtime_suspended(dev)) | |
| 151 | − blk_set_runtime_active(to_scsi_device(dev)->request_queue); | |
| 152 | − | |
| 153 | 157 | if (fn) { |
| 154 | 158 | async_schedule_domain(fn, dev, &scsi_sd_pm_domain); |
| 155 | 159 | |
| @@ -206,6 +206,12 @@ cache_type_store(struct device *dev, struct device_attribute *attr, · 205 unmodified lines | ||
| 206 | 206 | sp = buffer_data[0] & 0x80 ? 1 : 0; |
| 207 | 207 | buffer_data[0] &= ~0x80; |
| 208 | 208 | |
| 209 | + /* | |
| 210 | + * Ensure WP, DPOFUA, and RESERVED fields are cleared in | |
| 211 | + * received mode parameter buffer before doing MODE SELECT. | |
| 212 | + */ | |
| 213 | + data.device_specific = 0; | |
| 214 | + | |
| 209 | 215 | if (scsi_mode_select(sdp, 1, sp, 8, buffer_data, len, SD_TIMEOUT, |
| 210 | 216 | SD_MAX_RETRIES, &data, &sshdr)) { |
| 211 | 217 | if (scsi_sense_valid(&sshdr)) |
| @@ -323,7 +323,7 @@ static inline void pqi_device_remove_start(struct pqi_scsi_dev *device) · 322 unmodified lines | ||
| 323 | 323 | static inline bool pqi_device_in_remove(struct pqi_ctrl_info *ctrl_info, |
| 324 | 324 | struct pqi_scsi_dev *device) |
| 325 | 325 | { |
| 326 | − return device->in_remove & !ctrl_info->in_shutdown; | |
| 326 | + return device->in_remove && !ctrl_info->in_shutdown; | |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | static inline void pqi_schedule_rescan_worker_with_delay( |
| @@ -195,7 +195,7 @@ enum ufs_desc_def_size { · 194 unmodified lines | ||
| 195 | 195 | QUERY_DESC_CONFIGURATION_DEF_SIZE = 0x90, |
| 196 | 196 | QUERY_DESC_UNIT_DEF_SIZE = 0x23, |
| 197 | 197 | QUERY_DESC_INTERCONNECT_DEF_SIZE = 0x06, |
| 198 | − QUERY_DESC_GEOMETRY_DEF_SIZE = 0x44, | |
| 198 | + QUERY_DESC_GEOMETRY_DEF_SIZE = 0x48, | |
| 199 | 199 | QUERY_DESC_POWER_DEF_SIZE = 0x62, |
| 200 | 200 | QUERY_DESC_HEALTH_DEF_SIZE = 0x25, |
| 201 | 201 | }; |
| @@ -108,13 +108,19 @@ · 107 unmodified lines | ||
| 108 | 108 | int ufshcd_dump_regs(struct ufs_hba *hba, size_t offset, size_t len, |
| 109 | 109 | const char *prefix) |
| 110 | 110 | { |
| 111 | − u8 *regs; | |
| 111 | + u32 *regs; | |
| 112 | + size_t pos; | |
| 113 | + | |
| 114 | + if (offset % 4 != 0 || len % 4 != 0) /* keep readl happy */ | |
| 115 | + return -EINVAL; | |
| 112 | 116 | |
| 113 | 117 | regs = kzalloc(len, GFP_KERNEL); |
| 114 | 118 | if (!regs) |
| 115 | 119 | return -ENOMEM; |
| 116 | 120 | |
| 117 | − memcpy_fromio(regs, hba->mmio_base + offset, len); | |
| 121 | + for (pos = 0; pos < len; pos += 4) | |
| 122 | + regs[pos / 4] = ufshcd_readl(hba, offset + pos); | |
| 123 | + | |
| 118 | 124 | ufshcd_hex_dump(prefix, regs, len); |
| 119 | 125 | kfree(regs); |
| 120 | 126 | |
| @@ -8001,6 +8007,8 @@ out: · 7880 unmodified lines | ||
| 8001 | 8007 | trace_ufshcd_system_resume(dev_name(hba->dev), ret, |
| 8002 | 8008 | ktime_to_us(ktime_sub(ktime_get(), start)), |
| 8003 | 8009 | hba->curr_dev_pwr_mode, hba->uic_link_state); |
| 8010 | + if (!ret) | |
| 8011 | + hba->is_sys_suspended = false; | |
| 8004 | 8012 | return ret; |
| 8005 | 8013 | } |
| 8006 | 8014 | EXPORT_SYMBOL(ufshcd_system_resume); |
| @@ -44,10 +44,6 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm, · 43 unmodified lines | ||
| 44 | 44 | const char *sprop; |
| 45 | 45 | int ret = 0; |
| 46 | 46 | u32 val; |
| 47 | − struct resource *res; | |
| 48 | − struct device_node *np2; | |
| 49 | − static int siram_init_flag; | |
| 50 | − struct platform_device *pdev; | |
| 51 | 47 | |
| 52 | 48 | sprop = of_get_property(np, "fsl,rx-sync-clock", NULL); |
| 53 | 49 | if (sprop) { |
| @@ -124,57 +120,6 @@ int ucc_of_parse_tdm(struct device_node *np, struct ucc_tdm *utdm, · 70 unmodified lines | ||
| 124 | 120 | utdm->siram_entry_id = val; |
| 125 | 121 | |
| 126 | 122 | set_si_param(utdm, ut_info); |
| 127 | − | |
| 128 | − np2 = of_find_compatible_node(NULL, NULL, "fsl,t1040-qe-si"); | |
| 129 | − if (!np2) | |
| 130 | − return -EINVAL; | |
| 131 | − | |
| 132 | − pdev = of_find_device_by_node(np2); | |
| 133 | − if (!pdev) { | |
| 134 | − pr_err("%pOFn: failed to lookup pdev\n", np2); | |
| 135 | − of_node_put(np2); | |
| 136 | − return -EINVAL; | |
| 137 | − } | |
| 138 | − | |
| 139 | − of_node_put(np2); | |
| 140 | − res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
| 141 | − utdm->si_regs = devm_ioremap_resource(&pdev->dev, res); | |
| 142 | − if (IS_ERR(utdm->si_regs)) { | |
| 143 | − ret = PTR_ERR(utdm->si_regs); | |
| 144 | − goto err_miss_siram_property; | |
| 145 | − } | |
| 146 | − | |
| 147 | − np2 = of_find_compatible_node(NULL, NULL, "fsl,t1040-qe-siram"); | |
| 148 | − if (!np2) { | |
| 149 | − ret = -EINVAL; | |
| 150 | − goto err_miss_siram_property; | |
| 151 | − } | |
| 152 | − | |
| 153 | − pdev = of_find_device_by_node(np2); | |
| 154 | − if (!pdev) { | |
| 155 | − ret = -EINVAL; | |
| 156 | − pr_err("%pOFn: failed to lookup pdev\n", np2); | |
| 157 | − of_node_put(np2); | |
| 158 | − goto err_miss_siram_property; | |
| 159 | − } | |
| 160 | − | |
| 161 | − of_node_put(np2); | |
| 162 | − res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
| 163 | − utdm->siram = devm_ioremap_resource(&pdev->dev, res); | |
| 164 | − if (IS_ERR(utdm->siram)) { | |
| 165 | − ret = PTR_ERR(utdm->siram); | |
| 166 | − goto err_miss_siram_property; | |
| 167 | − } | |
| 168 | − | |
| 169 | − if (siram_init_flag == 0) { | |
| 170 | − memset_io(utdm->siram, 0, resource_size(res)); | |
| 171 | − siram_init_flag = 1; | |
| 172 | − } | |
| 173 | − | |
| 174 | − return ret; | |
| 175 | − | |
| 176 | −err_miss_siram_property: | |
| 177 | − devm_iounmap(&pdev->dev, utdm->si_regs); | |
| 178 | 123 | return ret; |
| 179 | 124 | } |
| 180 | 125 | EXPORT_SYMBOL(ucc_of_parse_tdm); |
| @@ -248,10 +248,10 @@ static void ion_dma_buf_detatch(struct dma_buf *dmabuf, · 247 unmodified lines | ||
| 248 | 248 | struct ion_dma_buf_attachment *a = attachment->priv; |
| 249 | 249 | struct ion_buffer *buffer = dmabuf->priv; |
| 250 | 250 | |
| 251 | − free_duped_table(a->table); | |
| 252 | 251 | mutex_lock(&buffer->lock); |
| 253 | 252 | list_del(&a->list); |
| 254 | 253 | mutex_unlock(&buffer->lock); |
| 254 | + free_duped_table(a->table); | |
| 255 | 255 | |
| 256 | 256 | kfree(a); |
| 257 | 257 | } |
| @@ -35,6 +35,7 @@ static const struct usb_device_id rtw_usb_id_tbl[] = { · 34 unmodified lines | ||
| 35 | 35 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
| 36 | 36 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ |
| 37 | 37 | {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ |
| 38 | + {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */ | |
| 38 | 39 | {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ |
| 39 | 40 | {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ |
| 40 | 41 | {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ |
| @@ -850,18 +850,18 @@ enum ieee80211_state { · 849 unmodified lines | ||
| 850 | 850 | #define IP_FMT "%pI4" |
| 851 | 851 | #define IP_ARG(x) (x) |
| 852 | 852 | |
| 853 | −extern __inline int is_multicast_mac_addr(const u8 *addr) | |
| 853 | +static inline int is_multicast_mac_addr(const u8 *addr) | |
| 854 | 854 | { |
| 855 | 855 | return ((addr[0] != 0xff) && (0x01 & addr[0])); |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | −extern __inline int is_broadcast_mac_addr(const u8 *addr) | |
| 858 | +static inline int is_broadcast_mac_addr(const u8 *addr) | |
| 859 | 859 | { |
| 860 | 860 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \ |
| 861 | 861 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 862 | 862 | } |
| 863 | 863 | |
| 864 | −extern __inline int is_zero_mac_addr(const u8 *addr) | |
| 864 | +static inline int is_zero_mac_addr(const u8 *addr) | |
| 865 | 865 | { |
| 866 | 866 | return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \ |
| 867 | 867 | (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00)); |
| @@ -446,6 +446,7 @@ remote_event_wait(wait_queue_head_t *wq, struct remote_event *event) · 445 unmodified lines | ||
| 446 | 446 | static inline void |
| 447 | 447 | remote_event_signal_local(wait_queue_head_t *wq, struct remote_event *event) |
| 448 | 448 | { |
| 449 | + event->fired = 1; | |
| 449 | 450 | event->armed = 0; |
| 450 | 451 | wake_up_all(wq); |
| 451 | 452 | } |
| @@ -36,7 +36,7 @@ struct wilc_op_mode { · 35 unmodified lines | ||
| 36 | 36 | struct wilc_reg_frame { |
| 37 | 37 | bool reg; |
| 38 | 38 | u8 reg_id; |
| 39 | − __le32 frame_type; | |
| 39 | + __le16 frame_type; | |
| 40 | 40 | } __packed; |
| 41 | 41 | |
| 42 | 42 | struct wilc_drv_handler { |
| @@ -1744,7 +1744,6 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, · 1701 unmodified lines | ||
| 1744 | 1744 | result = wilc_send_config_pkt(vif, WILC_SET_CFG, wid_list, |
| 1745 | 1745 | ARRAY_SIZE(wid_list), |
| 1746 | 1746 | wilc_get_vif_idx(vif)); |
| 1747 | − kfree(gtk_key); | |
| 1748 | 1747 | } else if (mode == WILC_STATION_MODE) { |
| 1749 | 1748 | struct wid wid; |
| 1750 | 1749 | |
| @@ -1754,9 +1753,9 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len, · 3 unmodified lines | ||
| 1754 | 1753 | wid.val = (u8 *)gtk_key; |
| 1755 | 1754 | result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1, |
| 1756 | 1755 | wilc_get_vif_idx(vif)); |
| 1757 | − kfree(gtk_key); | |
| 1758 | 1756 | } |
| 1759 | 1757 | |
| 1758 | + kfree(gtk_key); | |
| 1760 | 1759 | return result; |
| 1761 | 1760 | } |
| 1762 | 1761 | |
| @@ -1252,21 +1252,22 @@ static u32 init_chip(struct net_device *dev) · 1251 unmodified lines | ||
| 1252 | 1252 | ret = wilc->hif_func->hif_read_reg(wilc, 0x1118, ®); |
| 1253 | 1253 | if (!ret) { |
| 1254 | 1254 | netdev_err(dev, "fail read reg 0x1118\n"); |
| 1255 | − return ret; | |
| 1255 | + goto release; | |
| 1256 | 1256 | } |
| 1257 | 1257 | reg |= BIT(0); |
| 1258 | 1258 | ret = wilc->hif_func->hif_write_reg(wilc, 0x1118, reg); |
| 1259 | 1259 | if (!ret) { |
| 1260 | 1260 | netdev_err(dev, "fail write reg 0x1118\n"); |
| 1261 | − return ret; | |
| 1261 | + goto release; | |
| 1262 | 1262 | } |
| 1263 | 1263 | ret = wilc->hif_func->hif_write_reg(wilc, 0xc0000, 0x71); |
| 1264 | 1264 | if (!ret) { |
| 1265 | 1265 | netdev_err(dev, "fail write reg 0xc0000\n"); |
| 1266 | − return ret; | |
| 1266 | + goto release; | |
| 1267 | 1267 | } |
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | +release: | |
| 1270 | 1271 | release_bus(wilc, WILC_BUS_RELEASE_ONLY); |
| 1271 | 1272 | |
| 1272 | 1273 | return ret; |
| @@ -714,7 +714,7 @@ static int __init iscsi_target_init_module(void) · 713 unmodified lines | ||
| 714 | 714 | sizeof(struct iscsi_queue_req), |
| 715 | 715 | __alignof__(struct iscsi_queue_req), 0, NULL); |
| 716 | 716 | if (!lio_qr_cache) { |
| 717 | − pr_err("nable to kmem_cache_create() for" | |
| 717 | + pr_err("Unable to kmem_cache_create() for" | |
| 718 | 718 | " lio_qr_cache\n"); |
| 719 | 719 | goto bitmap_out; |
| 720 | 720 | } |
| @@ -148,7 +148,7 @@ struct tcmu_dev { · 147 unmodified lines | ||
| 148 | 148 | size_t ring_size; |
| 149 | 149 | |
| 150 | 150 | struct mutex cmdr_lock; |
| 151 | − struct list_head cmdr_queue; | |
| 151 | + struct list_head qfull_queue; | |
| 152 | 152 | |
| 153 | 153 | uint32_t dbi_max; |
| 154 | 154 | uint32_t dbi_thresh; |
| @@ -159,6 +159,7 @@ struct tcmu_dev { · 4 unmodified lines | ||
| 159 | 159 | |
| 160 | 160 | struct timer_list cmd_timer; |
| 161 | 161 | unsigned int cmd_time_out; |
| 162 | + struct list_head inflight_queue; | |
| 162 | 163 | |
| 163 | 164 | struct timer_list qfull_timer; |
| 164 | 165 | int qfull_time_out; |
| @@ -179,7 +180,7 @@ struct tcmu_dev { · 14 unmodified lines | ||
| 179 | 180 | struct tcmu_cmd { |
| 180 | 181 | struct se_cmd *se_cmd; |
| 181 | 182 | struct tcmu_dev *tcmu_dev; |
| 182 | − struct list_head cmdr_queue_entry; | |
| 183 | + struct list_head queue_entry; | |
| 183 | 184 | |
| 184 | 185 | uint16_t cmd_id; |
| 185 | 186 | |
| @@ -192,6 +193,7 @@ struct tcmu_cmd { · 6 unmodified lines | ||
| 192 | 193 | unsigned long deadline; |
| 193 | 194 | |
| 194 | 195 | #define TCMU_CMD_BIT_EXPIRED 0 |
| 196 | +#define TCMU_CMD_BIT_INFLIGHT 1 | |
| 195 | 197 | unsigned long flags; |
| 196 | 198 | }; |
| 197 | 199 | /* |
| @@ -586,7 +588,7 @@ static struct tcmu_cmd *tcmu_alloc_cmd(struct se_cmd *se_cmd) · 388 unmodified lines | ||
| 586 | 588 | if (!tcmu_cmd) |
| 587 | 589 | return NULL; |
| 588 | 590 | |
| 589 | − INIT_LIST_HEAD(&tcmu_cmd->cmdr_queue_entry); | |
| 591 | + INIT_LIST_HEAD(&tcmu_cmd->queue_entry); | |
| 590 | 592 | tcmu_cmd->se_cmd = se_cmd; |
| 591 | 593 | tcmu_cmd->tcmu_dev = udev; |
| 592 | 594 | |
| @@ -915,11 +917,13 @@ setup_timer: · 322 unmodified lines | ||
| 915 | 917 | return 0; |
| 916 | 918 | |
| 917 | 919 | tcmu_cmd->deadline = round_jiffies_up(jiffies + msecs_to_jiffies(tmo)); |
| 918 | − mod_timer(timer, tcmu_cmd->deadline); | |
| 920 | + if (!timer_pending(timer)) | |
| 921 | + mod_timer(timer, tcmu_cmd->deadline); | |
| 922 | + | |
| 919 | 923 | return 0; |
| 920 | 924 | } |
| 921 | 925 | |
| 922 | −static int add_to_cmdr_queue(struct tcmu_cmd *tcmu_cmd) | |
| 926 | +static int add_to_qfull_queue(struct tcmu_cmd *tcmu_cmd) | |
| 923 | 927 | { |
| 924 | 928 | struct tcmu_dev *udev = tcmu_cmd->tcmu_dev; |
| 925 | 929 | unsigned int tmo; |
| @@ -942,7 +946,7 @@ static int add_to_cmdr_queue(struct tcmu_cmd *tcmu_cmd) · 16 unmodified lines | ||
| 942 | 946 | if (ret) |
| 943 | 947 | return ret; |
| 944 | 948 | |
| 945 | − list_add_tail(&tcmu_cmd->cmdr_queue_entry, &udev->cmdr_queue); | |
| 949 | + list_add_tail(&tcmu_cmd->queue_entry, &udev->qfull_queue); | |
| 946 | 950 | pr_debug("adding cmd %u on dev %s to ring space wait queue\n", |
| 947 | 951 | tcmu_cmd->cmd_id, udev->name); |
| 948 | 952 | return 0; |
| @@ -999,7 +1003,7 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) · 50 unmodified lines | ||
| 999 | 1003 | base_command_size = tcmu_cmd_get_base_cmd_size(tcmu_cmd->dbi_cnt); |
| 1000 | 1004 | command_size = tcmu_cmd_get_cmd_size(tcmu_cmd, base_command_size); |
| 1001 | 1005 | |
| 1002 | − if (!list_empty(&udev->cmdr_queue)) | |
| 1006 | + if (!list_empty(&udev->qfull_queue)) | |
| 1003 | 1007 | goto queue; |
| 1004 | 1008 | |
| 1005 | 1009 | mb = udev->mb_addr; |
| @@ -1096,13 +1100,16 @@ static int queue_cmd_ring(struct tcmu_cmd *tcmu_cmd, sense_reason_t *scsi_err) · 90 unmodified lines | ||
| 1096 | 1100 | UPDATE_HEAD(mb->cmd_head, command_size, udev->cmdr_size); |
| 1097 | 1101 | tcmu_flush_dcache_range(mb, sizeof(*mb)); |
| 1098 | 1102 | |
| 1103 | + list_add_tail(&tcmu_cmd->queue_entry, &udev->inflight_queue); | |
| 1104 | + set_bit(TCMU_CMD_BIT_INFLIGHT, &tcmu_cmd->flags); | |
| 1105 | + | |
| 1099 | 1106 | /* TODO: only if FLUSH and FUA? */ |
| 1100 | 1107 | uio_event_notify(&udev->uio_info); |
| 1101 | 1108 | |
| 1102 | 1109 | return 0; |
| 1103 | 1110 | |
| 1104 | 1111 | queue: |
| 1105 | − if (add_to_cmdr_queue(tcmu_cmd)) { | |
| 1112 | + if (add_to_qfull_queue(tcmu_cmd)) { | |
| 1106 | 1113 | *scsi_err = TCM_OUT_OF_RESOURCES; |
| 1107 | 1114 | return -1; |
| 1108 | 1115 | } |
| @@ -1145,6 +1152,8 @@ static void tcmu_handle_completion(struct tcmu_cmd *cmd, struct tcmu_cmd_entry * · 36 unmodified lines | ||
| 1145 | 1152 | if (test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) |
| 1146 | 1153 | goto out; |
| 1147 | 1154 | |
| 1155 | + list_del_init(&cmd->queue_entry); | |
| 1156 | + | |
| 1148 | 1157 | tcmu_cmd_reset_dbi_cur(cmd); |
| 1149 | 1158 | |
| 1150 | 1159 | if (entry->hdr.uflags & TCMU_UFLAG_UNKNOWN_OP) { |
| @@ -1194,9 +1203,29 @@ out: · 43 unmodified lines | ||
| 1194 | 1203 | tcmu_free_cmd(cmd); |
| 1195 | 1204 | } |
| 1196 | 1205 | |
| 1206 | +static void tcmu_set_next_deadline(struct list_head *queue, | |
| 1207 | + struct timer_list *timer) | |
| 1208 | +{ | |
| 1209 | + struct tcmu_cmd *tcmu_cmd, *tmp_cmd; | |
| 1210 | + unsigned long deadline = 0; | |
| 1211 | + | |
| 1212 | + list_for_each_entry_safe(tcmu_cmd, tmp_cmd, queue, queue_entry) { | |
| 1213 | + if (!time_after(jiffies, tcmu_cmd->deadline)) { | |
| 1214 | + deadline = tcmu_cmd->deadline; | |
| 1215 | + break; | |
| 1216 | + } | |
| 1217 | + } | |
| 1218 | + | |
| 1219 | + if (deadline) | |
| 1220 | + mod_timer(timer, deadline); | |
| 1221 | + else | |
| 1222 | + del_timer(timer); | |
| 1223 | +} | |
| 1224 | + | |
| 1197 | 1225 | static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) |
| 1198 | 1226 | { |
| 1199 | 1227 | struct tcmu_mailbox *mb; |
| 1228 | + struct tcmu_cmd *cmd; | |
| 1200 | 1229 | int handled = 0; |
| 1201 | 1230 | |
| 1202 | 1231 | if (test_bit(TCMU_DEV_BIT_BROKEN, &udev->flags)) { |
| @@ -1210,7 +1239,6 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) · 7 unmodified lines | ||
| 1210 | 1239 | while (udev->cmdr_last_cleaned != READ_ONCE(mb->cmd_tail)) { |
| 1211 | 1240 | |
| 1212 | 1241 | struct tcmu_cmd_entry *entry = (void *) mb + CMDR_OFF + udev->cmdr_last_cleaned; |
| 1213 | − struct tcmu_cmd *cmd; | |
| 1214 | 1242 | |
| 1215 | 1243 | tcmu_flush_dcache_range(entry, sizeof(*entry)); |
| 1216 | 1244 | |
| @@ -1243,7 +1271,7 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) · 26 unmodified lines | ||
| 1243 | 1271 | /* no more pending commands */ |
| 1244 | 1272 | del_timer(&udev->cmd_timer); |
| 1245 | 1273 | |
| 1246 | − if (list_empty(&udev->cmdr_queue)) { | |
| 1274 | + if (list_empty(&udev->qfull_queue)) { | |
| 1247 | 1275 | /* |
| 1248 | 1276 | * no more pending or waiting commands so try to |
| 1249 | 1277 | * reclaim blocks if needed. |
| @@ -1252,6 +1280,8 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) · 2 unmodified lines | ||
| 1252 | 1280 | tcmu_global_max_blocks) |
| 1253 | 1281 | schedule_delayed_work(&tcmu_unmap_work, 0); |
| 1254 | 1282 | } |
| 1283 | + } else if (udev->cmd_time_out) { | |
| 1284 | + tcmu_set_next_deadline(&udev->inflight_queue, &udev->cmd_timer); | |
| 1255 | 1285 | } |
| 1256 | 1286 | |
| 1257 | 1287 | return handled; |
| @@ -1271,7 +1301,7 @@ static int tcmu_check_expired_cmd(int id, void *p, void *data) · 13 unmodified lines | ||
| 1271 | 1301 | if (!time_after(jiffies, cmd->deadline)) |
| 1272 | 1302 | return 0; |
| 1273 | 1303 | |
| 1274 | − is_running = list_empty(&cmd->cmdr_queue_entry); | |
| 1304 | + is_running = test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags); | |
| 1275 | 1305 | se_cmd = cmd->se_cmd; |
| 1276 | 1306 | |
| 1277 | 1307 | if (is_running) { |
| @@ -1287,9 +1317,9 @@ static int tcmu_check_expired_cmd(int id, void *p, void *data) · 9 unmodified lines | ||
| 1287 | 1317 | * target_complete_cmd will translate this to LUN COMM FAILURE |
| 1288 | 1318 | */ |
| 1289 | 1319 | scsi_status = SAM_STAT_CHECK_CONDITION; |
| 1320 | + list_del_init(&cmd->queue_entry); | |
| 1290 | 1321 | } else { |
| 1291 | − list_del_init(&cmd->cmdr_queue_entry); | |
| 1292 | − | |
| 1322 | + list_del_init(&cmd->queue_entry); | |
| 1293 | 1323 | idr_remove(&udev->commands, id); |
| 1294 | 1324 | tcmu_free_cmd(cmd); |
| 1295 | 1325 | scsi_status = SAM_STAT_TASK_SET_FULL; |
| @@ -1372,7 +1402,8 @@ static struct se_device *tcmu_alloc_device(struct se_hba *hba, const char *name) · 76 unmodified lines | ||
| 1372 | 1402 | |
| 1373 | 1403 | INIT_LIST_HEAD(&udev->node); |
| 1374 | 1404 | INIT_LIST_HEAD(&udev->timedout_entry); |
| 1375 | − INIT_LIST_HEAD(&udev->cmdr_queue); | |
| 1405 | + INIT_LIST_HEAD(&udev->qfull_queue); | |
| 1406 | + INIT_LIST_HEAD(&udev->inflight_queue); | |
| 1376 | 1407 | idr_init(&udev->commands); |
| 1377 | 1408 | |
| 1378 | 1409 | timer_setup(&udev->qfull_timer, tcmu_qfull_timedout, 0); |
| @@ -1383,7 +1414,7 @@ static struct se_device *tcmu_alloc_device(struct se_hba *hba, const char *name) · 4 unmodified lines | ||
| 1383 | 1414 | return &udev->se_dev; |
| 1384 | 1415 | } |
| 1385 | 1416 | |
| 1386 | −static bool run_cmdr_queue(struct tcmu_dev *udev, bool fail) | |
| 1417 | +static bool run_qfull_queue(struct tcmu_dev *udev, bool fail) | |
| 1387 | 1418 | { |
| 1388 | 1419 | struct tcmu_cmd *tcmu_cmd, *tmp_cmd; |
| 1389 | 1420 | LIST_HEAD(cmds); |
| @@ -1391,15 +1422,15 @@ static bool run_cmdr_queue(struct tcmu_dev *udev, bool fail) · 1 unmodified line | ||
| 1391 | 1422 | sense_reason_t scsi_ret; |
| 1392 | 1423 | int ret; |
| 1393 | 1424 | |
| 1394 | − if (list_empty(&udev->cmdr_queue)) | |
| 1425 | + if (list_empty(&udev->qfull_queue)) | |
| 1395 | 1426 | return true; |
| 1396 | 1427 | |
| 1397 | 1428 | pr_debug("running %s's cmdr queue forcefail %d\n", udev->name, fail); |
| 1398 | 1429 | |
| 1399 | − list_splice_init(&udev->cmdr_queue, &cmds); | |
| 1430 | + list_splice_init(&udev->qfull_queue, &cmds); | |
| 1400 | 1431 | |
| 1401 | − list_for_each_entry_safe(tcmu_cmd, tmp_cmd, &cmds, cmdr_queue_entry) { | |
| 1402 | − list_del_init(&tcmu_cmd->cmdr_queue_entry); | |
| 1432 | + list_for_each_entry_safe(tcmu_cmd, tmp_cmd, &cmds, queue_entry) { | |
| 1433 | + list_del_init(&tcmu_cmd->queue_entry); | |
| 1403 | 1434 | |
| 1404 | 1435 | pr_debug("removing cmd %u on dev %s from queue\n", |
| 1405 | 1436 | tcmu_cmd->cmd_id, udev->name); |
| @@ -1437,14 +1468,13 @@ static bool run_cmdr_queue(struct tcmu_dev *udev, bool fail) · 31 unmodified lines | ||
| 1437 | 1468 | * cmd was requeued, so just put all cmds back in |
| 1438 | 1469 | * the queue |
| 1439 | 1470 | */ |
| 1440 | − list_splice_tail(&cmds, &udev->cmdr_queue); | |
| 1471 | + list_splice_tail(&cmds, &udev->qfull_queue); | |
| 1441 | 1472 | drained = false; |
| 1442 | − goto done; | |
| 1473 | + break; | |
| 1443 | 1474 | } |
| 1444 | 1475 | } |
| 1445 | − if (list_empty(&udev->cmdr_queue)) | |
| 1446 | − del_timer(&udev->qfull_timer); | |
| 1447 | −done: | |
| 1476 | + | |
| 1477 | + tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); | |
| 1448 | 1478 | return drained; |
| 1449 | 1479 | } |
| 1450 | 1480 | |
| @@ -1454,7 +1484,7 @@ static int tcmu_irqcontrol(struct uio_info *info, s32 irq_on) · 3 unmodified lines | ||
| 1454 | 1484 | |
| 1455 | 1485 | mutex_lock(&udev->cmdr_lock); |
| 1456 | 1486 | tcmu_handle_completions(udev); |
| 1457 | − run_cmdr_queue(udev, false); | |
| 1487 | + run_qfull_queue(udev, false); | |
| 1458 | 1488 | mutex_unlock(&udev->cmdr_lock); |
| 1459 | 1489 | |
| 1460 | 1490 | return 0; |
| @@ -1982,7 +2012,7 @@ static void tcmu_block_dev(struct tcmu_dev *udev) · 521 unmodified lines | ||
| 1982 | 2012 | /* complete IO that has executed successfully */ |
| 1983 | 2013 | tcmu_handle_completions(udev); |
| 1984 | 2014 | /* fail IO waiting to be queued */ |
| 1985 | − run_cmdr_queue(udev, true); | |
| 2015 | + run_qfull_queue(udev, true); | |
| 1986 | 2016 | |
| 1987 | 2017 | unlock: |
| 1988 | 2018 | mutex_unlock(&udev->cmdr_lock); |
| @@ -1997,7 +2027,7 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) · 8 unmodified lines | ||
| 1997 | 2027 | mutex_lock(&udev->cmdr_lock); |
| 1998 | 2028 | |
| 1999 | 2029 | idr_for_each_entry(&udev->commands, cmd, i) { |
| 2000 | − if (!list_empty(&cmd->cmdr_queue_entry)) | |
| 2030 | + if (!test_bit(TCMU_CMD_BIT_INFLIGHT, &cmd->flags)) | |
| 2001 | 2031 | continue; |
| 2002 | 2032 | |
| 2003 | 2033 | pr_debug("removing cmd %u on dev %s from ring (is expired %d)\n", |
| @@ -2006,6 +2036,7 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level) · 2 unmodified lines | ||
| 2006 | 2036 | |
| 2007 | 2037 | idr_remove(&udev->commands, i); |
| 2008 | 2038 | if (!test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) { |
| 2039 | + list_del_init(&cmd->queue_entry); | |
| 2009 | 2040 | if (err_level == 1) { |
| 2010 | 2041 | /* |
| 2011 | 2042 | * Userspace was not able to start the |
| @@ -2666,6 +2697,10 @@ static void check_timedout_devices(void) · 654 unmodified lines | ||
| 2666 | 2697 | |
| 2667 | 2698 | mutex_lock(&udev->cmdr_lock); |
| 2668 | 2699 | idr_for_each(&udev->commands, tcmu_check_expired_cmd, NULL); |
| 2700 | + | |
| 2701 | + tcmu_set_next_deadline(&udev->inflight_queue, &udev->cmd_timer); | |
| 2702 | + tcmu_set_next_deadline(&udev->qfull_queue, &udev->qfull_timer); | |
| 2703 | + | |
| 2669 | 2704 | mutex_unlock(&udev->cmdr_lock); |
| 2670 | 2705 | |
| 2671 | 2706 | spin_lock_bh(&timed_out_udevs_lock); |
| @@ -4,7 +4,7 @@ · 3 unmodified lines | ||
| 4 | 4 | |
| 5 | 5 | config INT340X_THERMAL |
| 6 | 6 | tristate "ACPI INT340X thermal drivers" |
| 7 | − depends on X86 && ACPI | |
| 7 | + depends on X86 && ACPI && PCI | |
| 8 | 8 | select THERMAL_GOV_USER_SPACE |
| 9 | 9 | select ACPI_THERMAL_REL |
| 10 | 10 | select ACPI_FAN |
| @@ -84,7 +84,12 @@ static ssize_t power_limit_##index##_##suffix##_show(struct device *dev, \ · 83 unmodified lines | ||
| 84 | 84 | struct pci_dev *pci_dev; \ |
| 85 | 85 | struct platform_device *pdev; \ |
| 86 | 86 | struct proc_thermal_device *proc_dev; \ |
| 87 | −\ | |
| 87 | + \ | |
| 88 | + if (proc_thermal_emum_mode == PROC_THERMAL_NONE) { \ | |
| 89 | + dev_warn(dev, "Attempted to get power limit before device was initialized!\n"); \ | |
| 90 | + return 0; \ | |
| 91 | + } \ | |
| 92 | + \ | |
| 88 | 93 | if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { \ |
| 89 | 94 | pdev = to_platform_device(dev); \ |
| 90 | 95 | proc_dev = platform_get_drvdata(pdev); \ |
| @@ -298,11 +303,6 @@ static int proc_thermal_add(struct device *dev, · 207 unmodified lines | ||
| 298 | 303 | *priv = proc_priv; |
| 299 | 304 | |
| 300 | 305 | ret = proc_thermal_read_ppcc(proc_priv); |
| 301 | − if (!ret) { | |
| 302 | − ret = sysfs_create_group(&dev->kobj, | |
| 303 | − &power_limit_attribute_group); | |
| 304 | − | |
| 305 | − } | |
| 306 | 306 | if (ret) |
| 307 | 307 | return ret; |
| 308 | 308 | |
| @@ -316,8 +316,7 @@ static int proc_thermal_add(struct device *dev, · 7 unmodified lines | ||
| 316 | 316 | |
| 317 | 317 | proc_priv->int340x_zone = int340x_thermal_zone_add(adev, ops); |
| 318 | 318 | if (IS_ERR(proc_priv->int340x_zone)) { |
| 319 | − ret = PTR_ERR(proc_priv->int340x_zone); | |
| 320 | − goto remove_group; | |
| 319 | + return PTR_ERR(proc_priv->int340x_zone); | |
| 321 | 320 | } else |
| 322 | 321 | ret = 0; |
| 323 | 322 | |
| @@ -331,9 +330,6 @@ static int proc_thermal_add(struct device *dev, · 7 unmodified lines | ||
| 331 | 330 | |
| 332 | 331 | remove_zone: |
| 333 | 332 | int340x_thermal_zone_remove(proc_priv->int340x_zone); |
| 334 | −remove_group: | |
| 335 | − sysfs_remove_group(&proc_priv->dev->kobj, | |
| 336 | − &power_limit_attribute_group); | |
| 337 | 333 | |
| 338 | 334 | return ret; |
| 339 | 335 | } |
| @@ -364,7 +360,10 @@ static int int3401_add(struct platform_device *pdev) · 24 unmodified lines | ||
| 364 | 360 | platform_set_drvdata(pdev, proc_priv); |
| 365 | 361 | proc_thermal_emum_mode = PROC_THERMAL_PLATFORM_DEV; |
| 366 | 362 | |
| 367 | − return 0; | |
| 363 | + dev_info(&pdev->dev, "Creating sysfs group for PROC_THERMAL_PLATFORM_DEV\n"); | |
| 364 | + | |
| 365 | + return sysfs_create_group(&pdev->dev.kobj, | |
| 366 | + &power_limit_attribute_group); | |
| 368 | 367 | } |
| 369 | 368 | |
| 370 | 369 | static int int3401_remove(struct platform_device *pdev) |
| @@ -423,7 +422,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, · 52 unmodified lines | ||
| 423 | 422 | proc_priv->soc_dts = intel_soc_dts_iosf_init( |
| 424 | 423 | INTEL_SOC_DTS_INTERRUPT_MSI, 2, 0); |
| 425 | 424 | |
| 426 | − if (proc_priv->soc_dts && pdev->irq) { | |
| 425 | + if (!IS_ERR(proc_priv->soc_dts) && pdev->irq) { | |
| 427 | 426 | ret = pci_enable_msi(pdev); |
| 428 | 427 | if (!ret) { |
| 429 | 428 | ret = request_threaded_irq(pdev->irq, NULL, |
| @@ -441,7 +440,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, · 11 unmodified lines | ||
| 441 | 440 | dev_err(&pdev->dev, "No auxiliary DTSs enabled\n"); |
| 442 | 441 | } |
| 443 | 442 | |
| 444 | − return 0; | |
| 443 | + dev_info(&pdev->dev, "Creating sysfs group for PROC_THERMAL_PCI\n"); | |
| 444 | + | |
| 445 | + return sysfs_create_group(&pdev->dev.kobj, | |
| 446 | + &power_limit_attribute_group); | |
| 445 | 447 | } |
| 446 | 448 | |
| 447 | 449 | static void proc_thermal_pci_remove(struct pci_dev *pdev) |
| @@ -597,6 +597,7 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file, · 596 unmodified lines | ||
| 597 | 597 | /* too large for caller's buffer */ |
| 598 | 598 | ret = -EOVERFLOW; |
| 599 | 599 | } else { |
| 600 | + __set_current_state(TASK_RUNNING); | |
| 600 | 601 | if (copy_to_user(buf, rbuf->buf, rbuf->count)) |
| 601 | 602 | ret = -EFAULT; |
| 602 | 603 | else |
| @@ -1070,15 +1070,16 @@ int serial8250_register_8250_port(struct uart_8250_port *up) · 1069 unmodified lines | ||
| 1070 | 1070 | |
| 1071 | 1071 | ret = 0; |
| 1072 | 1072 | } |
| 1073 | − } | |
| 1074 | 1073 | |
| 1075 | − /* Initialise interrupt backoff work if required */ | |
| 1076 | − if (up->overrun_backoff_time_ms > 0) { | |
| 1077 | − uart->overrun_backoff_time_ms = up->overrun_backoff_time_ms; | |
| 1078 | − INIT_DELAYED_WORK(&uart->overrun_backoff, | |
| 1079 | − serial_8250_overrun_backoff_work); | |
| 1080 | − } else { | |
| 1081 | − uart->overrun_backoff_time_ms = 0; | |
| 1074 | + /* Initialise interrupt backoff work if required */ | |
| 1075 | + if (up->overrun_backoff_time_ms > 0) { | |
| 1076 | + uart->overrun_backoff_time_ms = | |
| 1077 | + up->overrun_backoff_time_ms; | |
| 1078 | + INIT_DELAYED_WORK(&uart->overrun_backoff, | |
| 1079 | + serial_8250_overrun_backoff_work); | |
| 1080 | + } else { | |
| 1081 | + uart->overrun_backoff_time_ms = 0; | |
| 1082 | + } | |
| 1082 | 1083 | } |
| 1083 | 1084 | |
| 1084 | 1085 | mutex_unlock(&serial_mutex); |
| @@ -10,13 +10,16 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <linux/serial_core.h> |
| 11 | 11 | #include <asm/sbi.h> |
| 12 | 12 | |
| 13 | −static void sbi_console_write(struct console *con, | |
| 14 | − const char *s, unsigned int n) | |
| 13 | +static void sbi_putc(struct uart_port *port, int c) | |
| 15 | 14 | { |
| 16 | − int i; | |
| 15 | + sbi_console_putchar(c); | |
| 16 | +} | |
| 17 | 17 | |
| 18 | − for (i = 0; i < n; ++i) | |
| 19 | − sbi_console_putchar(s[i]); | |
| 18 | +static void sbi_console_write(struct console *con, | |
| 19 | + const char *s, unsigned n) | |
| 20 | +{ | |
| 21 | + struct earlycon_device *dev = con->data; | |
| 22 | + uart_console_write(&dev->port, s, n, sbi_putc); | |
| 20 | 23 | } |
| 21 | 24 | |
| 22 | 25 | static int __init early_sbi_setup(struct earlycon_device *device, |
| @@ -1697,7 +1697,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios, · 1696 unmodified lines | ||
| 1697 | 1697 | } |
| 1698 | 1698 | |
| 1699 | 1699 | /* ask the core to calculate the divisor */ |
| 1700 | − baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16); | |
| 1700 | + baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 4); | |
| 1701 | 1701 | |
| 1702 | 1702 | spin_lock_irqsave(&sport->port.lock, flags); |
| 1703 | 1703 | |
| @@ -225,7 +225,7 @@ static unsigned int qcom_geni_serial_get_mctrl(struct uart_port *uport) · 224 unmodified lines | ||
| 225 | 225 | unsigned int mctrl = TIOCM_DSR | TIOCM_CAR; |
| 226 | 226 | u32 geni_ios; |
| 227 | 227 | |
| 228 | − if (uart_console(uport) || !uart_cts_enabled(uport)) { | |
| 228 | + if (uart_console(uport)) { | |
| 229 | 229 | mctrl |= TIOCM_CTS; |
| 230 | 230 | } else { |
| 231 | 231 | geni_ios = readl_relaxed(uport->membase + SE_GENI_IOS); |
| @@ -241,7 +241,7 @@ static void qcom_geni_serial_set_mctrl(struct uart_port *uport, · 9 unmodified lines | ||
| 241 | 241 | { |
| 242 | 242 | u32 uart_manual_rfr = 0; |
| 243 | 243 | |
| 244 | − if (uart_console(uport) || !uart_cts_enabled(uport)) | |
| 244 | + if (uart_console(uport)) | |
| 245 | 245 | return; |
| 246 | 246 | |
| 247 | 247 | if (!(mctrl & TIOCM_RTS)) |
| @@ -550,10 +550,12 @@ static int uart_put_char(struct tty_struct *tty, unsigned char c) · 549 unmodified lines | ||
| 550 | 550 | int ret = 0; |
| 551 | 551 | |
| 552 | 552 | circ = &state->xmit; |
| 553 | − if (!circ->buf) | |
| 553 | + port = uart_port_lock(state, flags); | |
| 554 | + if (!circ->buf) { | |
| 555 | + uart_port_unlock(port, flags); | |
| 554 | 556 | return 0; |
| 557 | + } | |
| 555 | 558 | |
| 556 | − port = uart_port_lock(state, flags); | |
| 557 | 559 | if (port && uart_circ_chars_free(circ) != 0) { |
| 558 | 560 | circ->buf[circ->head] = c; |
| 559 | 561 | circ->head = (circ->head + 1) & (UART_XMIT_SIZE - 1); |
| @@ -586,11 +588,13 @@ static int uart_write(struct tty_struct *tty, · 26 unmodified lines | ||
| 586 | 588 | return -EL3HLT; |
| 587 | 589 | } |
| 588 | 590 | |
| 591 | + port = uart_port_lock(state, flags); | |
| 589 | 592 | circ = &state->xmit; |
| 590 | − if (!circ->buf) | |
| 593 | + if (!circ->buf) { | |
| 594 | + uart_port_unlock(port, flags); | |
| 591 | 595 | return 0; |
| 596 | + } | |
| 592 | 597 | |
| 593 | − port = uart_port_lock(state, flags); | |
| 594 | 598 | while (port) { |
| 595 | 599 | c = CIRC_SPACE_TO_END(circ->head, circ->tail, UART_XMIT_SIZE); |
| 596 | 600 | if (count < c) |
| @@ -2189,7 +2189,8 @@ static int tiocsti(struct tty_struct *tty, char __user *p) · 2188 unmodified lines | ||
| 2189 | 2189 | ld = tty_ldisc_ref_wait(tty); |
| 2190 | 2190 | if (!ld) |
| 2191 | 2191 | return -EIO; |
| 2192 | − ld->ops->receive_buf(tty, &ch, &mbz, 1); | |
| 2192 | + if (ld->ops->receive_buf) | |
| 2193 | + ld->ops->receive_buf(tty, &ch, &mbz, 1); | |
| 2193 | 2194 | tty_ldisc_deref(ld); |
| 2194 | 2195 | return 0; |
| 2195 | 2196 | } |
| @@ -1272,6 +1272,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, · 1271 unmodified lines | ||
| 1272 | 1272 | if (con_is_visible(vc)) |
| 1273 | 1273 | update_screen(vc); |
| 1274 | 1274 | vt_event_post(VT_EVENT_RESIZE, vc->vc_num, vc->vc_num); |
| 1275 | + notify_update(vc); | |
| 1275 | 1276 | return err; |
| 1276 | 1277 | } |
| 1277 | 1278 | |
| @@ -2764,8 +2765,8 @@ rescan_last_byte: · 1486 unmodified lines | ||
| 2764 | 2765 | con_flush(vc, draw_from, draw_to, &draw_x); |
| 2765 | 2766 | vc_uniscr_debug_check(vc); |
| 2766 | 2767 | console_conditional_schedule(); |
| 2767 | − console_unlock(); | |
| 2768 | 2768 | notify_update(vc); |
| 2769 | + console_unlock(); | |
| 2769 | 2770 | return n; |
| 2770 | 2771 | } |
| 2771 | 2772 | |
| @@ -2884,8 +2885,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) · 112 unmodified lines | ||
| 2884 | 2885 | unsigned char c; |
| 2885 | 2886 | static DEFINE_SPINLOCK(printing_lock); |
| 2886 | 2887 | const ushort *start; |
| 2887 | − ushort cnt = 0; | |
| 2888 | − ushort myx; | |
| 2888 | + ushort start_x, cnt; | |
| 2889 | 2889 | int kmsg_console; |
| 2890 | 2890 | |
| 2891 | 2891 | /* console busy or not yet initialized */ |
| @@ -2898,10 +2898,6 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) · 6 unmodified lines | ||
| 2898 | 2898 | if (kmsg_console && vc_cons_allocated(kmsg_console - 1)) |
| 2899 | 2899 | vc = vc_cons[kmsg_console - 1].d; |
| 2900 | 2900 | |
| 2901 | − /* read `x' only after setting currcons properly (otherwise | |
| 2902 | − the `x' macro will read the x of the foreground console). */ | |
| 2903 | − myx = vc->vc_x; | |
| 2904 | − | |
| 2905 | 2901 | if (!vc_cons_allocated(fg_console)) { |
| 2906 | 2902 | /* impossible */ |
| 2907 | 2903 | /* printk("vt_console_print: tty %d not allocated ??\n", currcons+1); */ |
| @@ -2916,53 +2912,41 @@ static void vt_console_print(struct console *co, const char *b, unsigned count) · 8 unmodified lines | ||
| 2916 | 2912 | hide_cursor(vc); |
| 2917 | 2913 | |
| 2918 | 2914 | start = (ushort *)vc->vc_pos; |
| 2919 | − | |
| 2920 | − /* Contrived structure to try to emulate original need_wrap behaviour | |
| 2921 | − * Problems caused when we have need_wrap set on '\n' character */ | |
| 2915 | + start_x = vc->vc_x; | |
| 2916 | + cnt = 0; | |
| 2922 | 2917 | while (count--) { |
| 2923 | 2918 | c = *b++; |
| 2924 | 2919 | if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) { |
| 2925 | − if (cnt > 0) { | |
| 2926 | − if (con_is_visible(vc)) | |
| 2927 | − vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); | |
| 2928 | − vc->vc_x += cnt; | |
| 2929 | − if (vc->vc_need_wrap) | |
| 2930 | − vc->vc_x--; | |
| 2931 | − cnt = 0; | |
| 2932 | − } | |
| 2920 | + if (cnt && con_is_visible(vc)) | |
| 2921 | + vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); | |
| 2922 | + cnt = 0; | |
| 2933 | 2923 | if (c == 8) { /* backspace */ |
| 2934 | 2924 | bs(vc); |
| 2935 | 2925 | start = (ushort *)vc->vc_pos; |
| 2936 | − myx = vc->vc_x; | |
| 2926 | + start_x = vc->vc_x; | |
| 2937 | 2927 | continue; |
| 2938 | 2928 | } |
| 2939 | 2929 | if (c != 13) |
| 2940 | 2930 | lf(vc); |
| 2941 | 2931 | cr(vc); |
| 2942 | 2932 | start = (ushort *)vc->vc_pos; |
| 2943 | − myx = vc->vc_x; | |
| 2933 | + start_x = vc->vc_x; | |
| 2944 | 2934 | if (c == 10 || c == 13) |
| 2945 | 2935 | continue; |
| 2946 | 2936 | } |
| 2937 | + vc_uniscr_putc(vc, c); | |
| 2947 | 2938 | scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); |
| 2948 | 2939 | notify_write(vc, c); |
| 2949 | 2940 | cnt++; |
| 2950 | − if (myx == vc->vc_cols - 1) { | |
| 2951 | − vc->vc_need_wrap = 1; | |
| 2952 | − continue; | |
| 2953 | − } | |
| 2954 | − vc->vc_pos += 2; | |
| 2955 | − myx++; | |
| 2956 | − } | |
| 2957 | − if (cnt > 0) { | |
| 2958 | − if (con_is_visible(vc)) | |
| 2959 | − vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x); | |
| 2960 | − vc->vc_x += cnt; | |
| 2961 | − if (vc->vc_x == vc->vc_cols) { | |
| 2962 | − vc->vc_x--; | |
| 2941 | + if (vc->vc_x == vc->vc_cols - 1) { | |
| 2963 | 2942 | vc->vc_need_wrap = 1; |
| 2943 | + } else { | |
| 2944 | + vc->vc_pos += 2; | |
| 2945 | + vc->vc_x++; | |
| 2964 | 2946 | } |
| 2965 | 2947 | } |
| 2948 | + if (cnt && con_is_visible(vc)) | |
| 2949 | + vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, start_x); | |
| 2966 | 2950 | set_cursor(vc); |
| 2967 | 2951 | notify_update(vc); |
| 2968 | 2952 | |
| @@ -316,7 +316,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) · 315 unmodified lines | ||
| 316 | 316 | if (IS_ERR(data->usbmisc_data)) |
| 317 | 317 | return PTR_ERR(data->usbmisc_data); |
| 318 | 318 | |
| 319 | − if (of_usb_get_phy_mode(dev->of_node) == USBPHY_INTERFACE_MODE_HSIC) { | |
| 319 | + if ((of_usb_get_phy_mode(dev->of_node) == USBPHY_INTERFACE_MODE_HSIC) | |
| 320 | + && data->usbmisc_data) { | |
| 320 | 321 | pdata.flags |= CI_HDRC_IMX_IS_HSIC; |
| 321 | 322 | data->usbmisc_data->hsic = 1; |
| 322 | 323 | data->pinctrl = devm_pinctrl_get(dev); |
| @@ -119,11 +119,6 @@ static const struct attribute_group ports_group = { · 118 unmodified lines | ||
| 119 | 119 | .attrs = ports_attrs, |
| 120 | 120 | }; |
| 121 | 121 | |
| 122 | −static const struct attribute_group *ports_groups[] = { | |
| 123 | − &ports_group, | |
| 124 | − NULL | |
| 125 | −}; | |
| 126 | − | |
| 127 | 122 | /*************************************** |
| 128 | 123 | * Adding & removing ports |
| 129 | 124 | ***************************************/ |
| @@ -307,6 +302,7 @@ static int usbport_trig_notify(struct notifier_block *nb, unsigned long action, · 177 unmodified lines | ||
| 307 | 302 | static int usbport_trig_activate(struct led_classdev *led_cdev) |
| 308 | 303 | { |
| 309 | 304 | struct usbport_trig_data *usbport_data; |
| 305 | + int err; | |
| 310 | 306 | |
| 311 | 307 | usbport_data = kzalloc(sizeof(*usbport_data), GFP_KERNEL); |
| 312 | 308 | if (!usbport_data) |
| @@ -315,6 +311,9 @@ static int usbport_trig_activate(struct led_classdev *led_cdev) · 2 unmodified lines | ||
| 315 | 311 | |
| 316 | 312 | /* List of ports */ |
| 317 | 313 | INIT_LIST_HEAD(&usbport_data->ports); |
| 314 | + err = sysfs_create_group(&led_cdev->dev->kobj, &ports_group); | |
| 315 | + if (err) | |
| 316 | + goto err_free; | |
| 318 | 317 | usb_for_each_dev(usbport_data, usbport_trig_add_usb_dev_ports); |
| 319 | 318 | usbport_trig_update_count(usbport_data); |
| 320 | 319 | |
| @@ -322,8 +321,11 @@ static int usbport_trig_activate(struct led_classdev *led_cdev) · 1 unmodified line | ||
| 322 | 321 | usbport_data->nb.notifier_call = usbport_trig_notify; |
| 323 | 322 | led_set_trigger_data(led_cdev, usbport_data); |
| 324 | 323 | usb_register_notify(&usbport_data->nb); |
| 325 | − | |
| 326 | 324 | return 0; |
| 325 | + | |
| 326 | +err_free: | |
| 327 | + kfree(usbport_data); | |
| 328 | + return err; | |
| 327 | 329 | } |
| 328 | 330 | |
| 329 | 331 | static void usbport_trig_deactivate(struct led_classdev *led_cdev) |
| @@ -335,6 +337,8 @@ static void usbport_trig_deactivate(struct led_classdev *led_cdev) · 5 unmodified lines | ||
| 335 | 337 | usbport_trig_remove_port(usbport_data, port); |
| 336 | 338 | } |
| 337 | 339 | |
| 340 | + sysfs_remove_group(&led_cdev->dev->kobj, &ports_group); | |
| 341 | + | |
| 338 | 342 | usb_unregister_notify(&usbport_data->nb); |
| 339 | 343 | |
| 340 | 344 | kfree(usbport_data); |
| @@ -344,7 +348,6 @@ static struct led_trigger usbport_led_trigger = { · 3 unmodified lines | ||
| 344 | 348 | .name = "usbport", |
| 345 | 349 | .activate = usbport_trig_activate, |
| 346 | 350 | .deactivate = usbport_trig_deactivate, |
| 347 | − .groups = ports_groups, | |
| 348 | 351 | }; |
| 349 | 352 | |
| 350 | 353 | static int __init usbport_trig_init(void) |
| @@ -261,7 +261,7 @@ static void dwc2_gadget_wkup_alert_handler(struct dwc2_hsotg *hsotg) · 260 unmodified lines | ||
| 261 | 261 | |
| 262 | 262 | if (gintsts2 & GINTSTS2_WKUP_ALERT_INT) { |
| 263 | 263 | dev_dbg(hsotg->dev, "%s: Wkup_Alert_Int\n", __func__); |
| 264 | − dwc2_clear_bit(hsotg, GINTSTS2, GINTSTS2_WKUP_ALERT_INT); | |
| 264 | + dwc2_set_bit(hsotg, GINTSTS2, GINTSTS2_WKUP_ALERT_INT); | |
| 265 | 265 | dwc2_set_bit(hsotg, DCTL, DCTL_RMTWKUPSIG); |
| 266 | 266 | } |
| 267 | 267 | } |
| @@ -177,6 +177,7 @@ static void dwc3_gadget_del_and_unmap_request(struct dwc3_ep *dep, · 176 unmodified lines | ||
| 177 | 177 | req->started = false; |
| 178 | 178 | list_del(&req->list); |
| 179 | 179 | req->remaining = 0; |
| 180 | + req->needs_extra_trb = false; | |
| 180 | 181 | |
| 181 | 182 | if (req->request.status == -EINPROGRESS) |
| 182 | 183 | req->request.status = status; |
| @@ -1984,6 +1985,7 @@ static int __dwc3_gadget_start(struct dwc3 *dwc) · 1801 unmodified lines | ||
| 1984 | 1985 | |
| 1985 | 1986 | /* begin to receive SETUP packets */ |
| 1986 | 1987 | dwc->ep0state = EP0_SETUP_PHASE; |
| 1988 | + dwc->link_state = DWC3_LINK_STATE_SS_DIS; | |
| 1987 | 1989 | dwc3_ep0_out_start(dwc); |
| 1988 | 1990 | |
| 1989 | 1991 | dwc3_gadget_enable_irq(dwc); |
| @@ -3379,6 +3381,8 @@ int dwc3_gadget_suspend(struct dwc3 *dwc) · 1389 unmodified lines | ||
| 3379 | 3381 | dwc3_disconnect_gadget(dwc); |
| 3380 | 3382 | __dwc3_gadget_stop(dwc); |
| 3381 | 3383 | |
| 3384 | + synchronize_irq(dwc->irq_gadget); | |
| 3385 | + | |
| 3382 | 3386 | return 0; |
| 3383 | 3387 | } |
| 3384 | 3388 | |
| @@ -838,7 +838,7 @@ static struct usb_function *source_sink_alloc_func( · 837 unmodified lines | ||
| 838 | 838 | |
| 839 | 839 | ss = kzalloc(sizeof(*ss), GFP_KERNEL); |
| 840 | 840 | if (!ss) |
| 841 | − return NULL; | |
| 841 | + return ERR_PTR(-ENOMEM); | |
| 842 | 842 | |
| 843 | 843 | ss_opts = container_of(fi, struct f_ss_opts, func_inst); |
| 844 | 844 | |
| @@ -302,3 +302,4 @@ MODULE_AUTHOR("Chao Xie <chao.xie@marvell.com>"); · 301 unmodified lines | ||
| 302 | 302 | MODULE_AUTHOR("Neil Zhang <zhangwm@marvell.com>"); |
| 303 | 303 | MODULE_ALIAS("mv-ehci"); |
| 304 | 304 | MODULE_LICENSE("GPL"); |
| 305 | +MODULE_DEVICE_TABLE(of, ehci_mv_dt_ids); | |
| @@ -1783,6 +1783,10 @@ static int ftdi_set_bitmode(struct usb_serial_port *port, u8 mode) · 1782 unmodified lines | ||
| 1783 | 1783 | int result; |
| 1784 | 1784 | u16 val; |
| 1785 | 1785 | |
| 1786 | + result = usb_autopm_get_interface(serial->interface); | |
| 1787 | + if (result) | |
| 1788 | + return result; | |
| 1789 | + | |
| 1786 | 1790 | val = (mode << 8) | (priv->gpio_output << 4) | priv->gpio_value; |
| 1787 | 1791 | result = usb_control_msg(serial->dev, |
| 1788 | 1792 | usb_sndctrlpipe(serial->dev, 0), |
| @@ -1795,6 +1799,8 @@ static int ftdi_set_bitmode(struct usb_serial_port *port, u8 mode) · 6 unmodified lines | ||
| 1795 | 1799 | val, result); |
| 1796 | 1800 | } |
| 1797 | 1801 | |
| 1802 | + usb_autopm_put_interface(serial->interface); | |
| 1803 | + | |
| 1798 | 1804 | return result; |
| 1799 | 1805 | } |
| 1800 | 1806 | |
| @@ -1846,9 +1852,15 @@ static int ftdi_read_cbus_pins(struct usb_serial_port *port) · 45 unmodified lines | ||
| 1846 | 1852 | unsigned char *buf; |
| 1847 | 1853 | int result; |
| 1848 | 1854 | |
| 1855 | + result = usb_autopm_get_interface(serial->interface); | |
| 1856 | + if (result) | |
| 1857 | + return result; | |
| 1858 | + | |
| 1849 | 1859 | buf = kmalloc(1, GFP_KERNEL); |
| 1850 | − if (!buf) | |
| 1860 | + if (!buf) { | |
| 1861 | + usb_autopm_put_interface(serial->interface); | |
| 1851 | 1862 | return -ENOMEM; |
| 1863 | + } | |
| 1852 | 1864 | |
| 1853 | 1865 | result = usb_control_msg(serial->dev, |
| 1854 | 1866 | usb_rcvctrlpipe(serial->dev, 0), |
| @@ -1863,6 +1875,7 @@ static int ftdi_read_cbus_pins(struct usb_serial_port *port) · 8 unmodified lines | ||
| 1863 | 1875 | } |
| 1864 | 1876 | |
| 1865 | 1877 | kfree(buf); |
| 1878 | + usb_autopm_put_interface(serial->interface); | |
| 1866 | 1879 | |
| 1867 | 1880 | return result; |
| 1868 | 1881 | } |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: BSD-3-Clause */ | |
| 1 | 2 | /* |
| 2 | 3 | usa26msg.h |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: BSD-3-Clause */ | |
| 1 | 2 | /* |
| 2 | 3 | usa28msg.h |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: BSD-3-Clause */ | |
| 1 | 2 | /* |
| 2 | 3 | usa49msg.h |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: BSD-3-Clause */ | |
| 1 | 2 | /* |
| 2 | 3 | usa67msg.h |
| 3 | 4 | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: BSD-3-Clause */ | |
| 1 | 2 | /* |
| 2 | 3 | usa90msg.h |
| 3 | 4 | |
| @@ -46,6 +46,7 @@ static const struct usb_device_id id_table[] = { · 45 unmodified lines | ||
| 46 | 46 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
| 47 | 47 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, |
| 48 | 48 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ZTEK) }, |
| 49 | + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_TB) }, | |
| 49 | 50 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
| 50 | 51 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
| 51 | 52 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID), |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | #define PL2303_VENDOR_ID 0x067b |
| 10 | 10 | #define PL2303_PRODUCT_ID 0x2303 |
| 11 | +#define PL2303_PRODUCT_ID_TB 0x2304 | |
| 11 | 12 | #define PL2303_PRODUCT_ID_RSAQ2 0x04bb |
| 12 | 13 | #define PL2303_PRODUCT_ID_DCU11 0x1234 |
| 13 | 14 | #define PL2303_PRODUCT_ID_PHAROS 0xaaa0 |
| @@ -20,6 +21,7 @@ · 6 unmodified lines | ||
| 20 | 21 | #define PL2303_PRODUCT_ID_MOTOROLA 0x0307 |
| 21 | 22 | #define PL2303_PRODUCT_ID_ZTEK 0xe1f1 |
| 22 | 23 | |
| 24 | + | |
| 23 | 25 | #define ATEN_VENDOR_ID 0x0557 |
| 24 | 26 | #define ATEN_VENDOR_ID2 0x0547 |
| 25 | 27 | #define ATEN_PRODUCT_ID 0x2008 |
| @@ -85,7 +85,8 @@ DEVICE(moto_modem, MOTO_IDS); · 84 unmodified lines | ||
| 85 | 85 | /* Motorola Tetra driver */ |
| 86 | 86 | #define MOTOROLA_TETRA_IDS() \ |
| 87 | 87 | { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \ |
| 88 | − { USB_DEVICE(0x0cad, 0x9012) } /* MTP6550 */ | |
| 88 | + { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \ | |
| 89 | + { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */ | |
| 89 | 90 | DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); |
| 90 | 91 | |
| 91 | 92 | /* Novatel Wireless GPS driver */ |
| @@ -1,7 +0,0 @@ | ||
| 1 | −TODO: | |
| 2 | − - more discussion about the protocol | |
| 3 | − - testing | |
| 4 | − - review of the userspace interface | |
| 5 | − - document the protocol | |
| 6 | − | |
| 7 | −Please send patches for this code to Greg Kroah-Hartman <greg@kroah.com> | |
| @@ -1,13 +1,9 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0+ */ | |
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | 2 | /* |
| 3 | 3 | * VFIO PCI mmap/mmap_fault tracepoints |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2018 IBM Corp. All rights reserved. |
| 6 | 6 | * Author: Alexey Kardashevskiy <aik@ozlabs.ru> |
| 7 | − * | |
| 8 | − * This program is free software; you can redistribute it and/or modify | |
| 9 | − * it under the terms of the GNU General Public License version 2 as | |
| 10 | − * published by the Free Software Foundation. | |
| 11 | 7 | */ |
| 12 | 8 | |
| 13 | 9 | #undef TRACE_SYSTEM |
| @@ -1,14 +1,10 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0+ | |
| 1 | +// SPDX-License-Identifier: GPL-2.0-only | |
| 2 | 2 | /* |
| 3 | 3 | * VFIO PCI NVIDIA Whitherspoon GPU support a.k.a. NVLink2. |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2018 IBM Corp. All rights reserved. |
| 6 | 6 | * Author: Alexey Kardashevskiy <aik@ozlabs.ru> |
| 7 | 7 | * |
| 8 | − * This program is free software; you can redistribute it and/or modify | |
| 9 | − * it under the terms of the GNU General Public License version 2 as | |
| 10 | − * published by the Free Software Foundation. | |
| 11 | − * | |
| 12 | 8 | * Register an on-GPU RAM region for cacheable access. |
| 13 | 9 | * |
| 14 | 10 | * Derived from original vfio_pci_igd.c: |
| @@ -178,11 +174,11 @@ static int vfio_pci_nvgpu_add_capability(struct vfio_pci_device *vdev, · 163 unmodified lines | ||
| 178 | 174 | struct vfio_pci_region *region, struct vfio_info_cap *caps) |
| 179 | 175 | { |
| 180 | 176 | struct vfio_pci_nvgpu_data *data = region->data; |
| 181 | − struct vfio_region_info_cap_nvlink2_ssatgt cap = { 0 }; | |
| 182 | − | |
| 183 | − cap.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT; | |
| 184 | − cap.header.version = 1; | |
| 185 | − cap.tgt = data->gpu_tgt; | |
| 177 | + struct vfio_region_info_cap_nvlink2_ssatgt cap = { | |
| 178 | + .header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT, | |
| 179 | + .header.version = 1, | |
| 180 | + .tgt = data->gpu_tgt | |
| 181 | + }; | |
| 186 | 182 | |
| 187 | 183 | return vfio_info_add_capability(caps, &cap.header, sizeof(cap)); |
| 188 | 184 | } |
| @@ -365,18 +361,18 @@ static int vfio_pci_npu2_add_capability(struct vfio_pci_device *vdev, · 176 unmodified lines | ||
| 365 | 361 | struct vfio_pci_region *region, struct vfio_info_cap *caps) |
| 366 | 362 | { |
| 367 | 363 | struct vfio_pci_npu2_data *data = region->data; |
| 368 | − struct vfio_region_info_cap_nvlink2_ssatgt captgt = { 0 }; | |
| 369 | − struct vfio_region_info_cap_nvlink2_lnkspd capspd = { 0 }; | |
| 364 | + struct vfio_region_info_cap_nvlink2_ssatgt captgt = { | |
| 365 | + .header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT, | |
| 366 | + .header.version = 1, | |
| 367 | + .tgt = data->gpu_tgt | |
| 368 | + }; | |
| 369 | + struct vfio_region_info_cap_nvlink2_lnkspd capspd = { | |
| 370 | + .header.id = VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD, | |
| 371 | + .header.version = 1, | |
| 372 | + .link_speed = data->link_speed | |
| 373 | + }; | |
| 370 | 374 | int ret; |
| 371 | 375 | |
| 372 | − captgt.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT; | |
| 373 | − captgt.header.version = 1; | |
| 374 | − captgt.tgt = data->gpu_tgt; | |
| 375 | − | |
| 376 | − capspd.header.id = VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD; | |
| 377 | − capspd.header.version = 1; | |
| 378 | − capspd.link_speed = data->link_speed; | |
| 379 | − | |
| 380 | 376 | ret = vfio_info_add_capability(caps, &captgt.header, sizeof(captgt)); |
| 381 | 377 | if (ret) |
| 382 | 378 | return ret; |
| @@ -1236,7 +1236,8 @@ static void handle_rx(struct vhost_net *net) · 1235 unmodified lines | ||
| 1236 | 1236 | if (nvq->done_idx > VHOST_NET_BATCH) |
| 1237 | 1237 | vhost_net_signal_used(nvq); |
| 1238 | 1238 | if (unlikely(vq_log)) |
| 1239 | − vhost_log_write(vq, vq_log, log, vhost_len); | |
| 1239 | + vhost_log_write(vq, vq_log, log, vhost_len, | |
| 1240 | + vq->iov, in); | |
| 1240 | 1241 | total_len += vhost_len; |
| 1241 | 1242 | if (unlikely(vhost_exceeds_weight(++recv_pkts, total_len))) { |
| 1242 | 1243 | vhost_poll_queue(&vq->poll); |
| @@ -1336,7 +1337,8 @@ static int vhost_net_open(struct inode *inode, struct file *f) · 93 unmodified lines | ||
| 1336 | 1337 | n->vqs[i].rx_ring = NULL; |
| 1337 | 1338 | vhost_net_buf_init(&n->vqs[i].rxq); |
| 1338 | 1339 | } |
| 1339 | − vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX); | |
| 1340 | + vhost_dev_init(dev, vqs, VHOST_NET_VQ_MAX, | |
| 1341 | + UIO_MAXIOV + VHOST_NET_BATCH); | |
| 1340 | 1342 | |
| 1341 | 1343 | vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, EPOLLOUT, dev); |
| 1342 | 1344 | vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, EPOLLIN, dev); |
| @@ -1127,16 +1127,18 @@ vhost_scsi_send_tmf_reject(struct vhost_scsi *vs, · 1126 unmodified lines | ||
| 1127 | 1127 | struct vhost_virtqueue *vq, |
| 1128 | 1128 | struct vhost_scsi_ctx *vc) |
| 1129 | 1129 | { |
| 1130 | − struct virtio_scsi_ctrl_tmf_resp __user *resp; | |
| 1131 | 1130 | struct virtio_scsi_ctrl_tmf_resp rsp; |
| 1131 | + struct iov_iter iov_iter; | |
| 1132 | 1132 | int ret; |
| 1133 | 1133 | |
| 1134 | 1134 | pr_debug("%s\n", __func__); |
| 1135 | 1135 | memset(&rsp, 0, sizeof(rsp)); |
| 1136 | 1136 | rsp.response = VIRTIO_SCSI_S_FUNCTION_REJECTED; |
| 1137 | − resp = vq->iov[vc->out].iov_base; | |
| 1138 | − ret = __copy_to_user(resp, &rsp, sizeof(rsp)); | |
| 1139 | − if (!ret) | |
| 1137 | + | |
| 1138 | + iov_iter_init(&iov_iter, READ, &vq->iov[vc->out], vc->in, sizeof(rsp)); | |
| 1139 | + | |
| 1140 | + ret = copy_to_iter(&rsp, sizeof(rsp), &iov_iter); | |
| 1141 | + if (likely(ret == sizeof(rsp))) | |
| 1140 | 1142 | vhost_add_used_and_signal(&vs->dev, vq, vc->head, 0); |
| 1141 | 1143 | else |
| 1142 | 1144 | pr_err("Faulted on virtio_scsi_ctrl_tmf_resp\n"); |
| @@ -1147,16 +1149,18 @@ vhost_scsi_send_an_resp(struct vhost_scsi *vs, · 4 unmodified lines | ||
| 1147 | 1149 | struct vhost_virtqueue *vq, |
| 1148 | 1150 | struct vhost_scsi_ctx *vc) |
| 1149 | 1151 | { |
| 1150 | − struct virtio_scsi_ctrl_an_resp __user *resp; | |
| 1151 | 1152 | struct virtio_scsi_ctrl_an_resp rsp; |
| 1153 | + struct iov_iter iov_iter; | |
| 1152 | 1154 | int ret; |
| 1153 | 1155 | |
| 1154 | 1156 | pr_debug("%s\n", __func__); |
| 1155 | 1157 | memset(&rsp, 0, sizeof(rsp)); /* event_actual = 0 */ |
| 1156 | 1158 | rsp.response = VIRTIO_SCSI_S_OK; |
| 1157 | − resp = vq->iov[vc->out].iov_base; | |
| 1158 | − ret = __copy_to_user(resp, &rsp, sizeof(rsp)); | |
| 1159 | − if (!ret) | |
| 1159 | + | |
| 1160 | + iov_iter_init(&iov_iter, READ, &vq->iov[vc->out], vc->in, sizeof(rsp)); | |
| 1161 | + | |
| 1162 | + ret = copy_to_iter(&rsp, sizeof(rsp), &iov_iter); | |
| 1163 | + if (likely(ret == sizeof(rsp))) | |
| 1160 | 1164 | vhost_add_used_and_signal(&vs->dev, vq, vc->head, 0); |
| 1161 | 1165 | else |
| 1162 | 1166 | pr_err("Faulted on virtio_scsi_ctrl_an_resp\n"); |
| @@ -1623,7 +1627,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f) · 460 unmodified lines | ||
| 1623 | 1627 | vqs[i] = &vs->vqs[i].vq; |
| 1624 | 1628 | vs->vqs[i].vq.handle_kick = vhost_scsi_handle_kick; |
| 1625 | 1629 | } |
| 1626 | − vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ); | |
| 1630 | + vhost_dev_init(&vs->dev, vqs, VHOST_SCSI_MAX_VQ, UIO_MAXIOV); | |
| 1627 | 1631 | |
| 1628 | 1632 | vhost_scsi_init_inflight(vs, NULL); |
| 1629 | 1633 | |
| @@ -390,9 +390,9 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev) · 389 unmodified lines | ||
| 390 | 390 | vq->indirect = kmalloc_array(UIO_MAXIOV, |
| 391 | 391 | sizeof(*vq->indirect), |
| 392 | 392 | GFP_KERNEL); |
| 393 | − vq->log = kmalloc_array(UIO_MAXIOV, sizeof(*vq->log), | |
| 393 | + vq->log = kmalloc_array(dev->iov_limit, sizeof(*vq->log), | |
| 394 | 394 | GFP_KERNEL); |
| 395 | − vq->heads = kmalloc_array(UIO_MAXIOV, sizeof(*vq->heads), | |
| 395 | + vq->heads = kmalloc_array(dev->iov_limit, sizeof(*vq->heads), | |
| 396 | 396 | GFP_KERNEL); |
| 397 | 397 | if (!vq->indirect || !vq->log || !vq->heads) |
| 398 | 398 | goto err_nomem; |
| @@ -414,7 +414,7 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev) · 15 unmodified lines | ||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | void vhost_dev_init(struct vhost_dev *dev, |
| 417 | − struct vhost_virtqueue **vqs, int nvqs) | |
| 417 | + struct vhost_virtqueue **vqs, int nvqs, int iov_limit) | |
| 418 | 418 | { |
| 419 | 419 | struct vhost_virtqueue *vq; |
| 420 | 420 | int i; |
| @@ -427,6 +427,7 @@ void vhost_dev_init(struct vhost_dev *dev, · 6 unmodified lines | ||
| 427 | 427 | dev->iotlb = NULL; |
| 428 | 428 | dev->mm = NULL; |
| 429 | 429 | dev->worker = NULL; |
| 430 | + dev->iov_limit = iov_limit; | |
| 430 | 431 | init_llist_head(&dev->work_list); |
| 431 | 432 | init_waitqueue_head(&dev->wait); |
| 432 | 433 | INIT_LIST_HEAD(&dev->read_list); |
| @@ -1034,8 +1035,10 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev, · 601 unmodified lines | ||
| 1034 | 1035 | int type, ret; |
| 1035 | 1036 | |
| 1036 | 1037 | ret = copy_from_iter(&type, sizeof(type), from); |
| 1037 | − if (ret != sizeof(type)) | |
| 1038 | + if (ret != sizeof(type)) { | |
| 1039 | + ret = -EINVAL; | |
| 1038 | 1040 | goto done; |
| 1041 | + } | |
| 1039 | 1042 | |
| 1040 | 1043 | switch (type) { |
| 1041 | 1044 | case VHOST_IOTLB_MSG: |
| @@ -1054,8 +1057,10 @@ ssize_t vhost_chr_write_iter(struct vhost_dev *dev, · 12 unmodified lines | ||
| 1054 | 1057 | |
| 1055 | 1058 | iov_iter_advance(from, offset); |
| 1056 | 1059 | ret = copy_from_iter(&msg, sizeof(msg), from); |
| 1057 | − if (ret != sizeof(msg)) | |
| 1060 | + if (ret != sizeof(msg)) { | |
| 1061 | + ret = -EINVAL; | |
| 1058 | 1062 | goto done; |
| 1063 | + } | |
| 1059 | 1064 | if (vhost_process_iotlb_msg(dev, &msg)) { |
| 1060 | 1065 | ret = -EFAULT; |
| 1061 | 1066 | goto done; |
| @@ -1733,13 +1738,87 @@ static int log_write(void __user *log_base, · 671 unmodified lines | ||
| 1733 | 1738 | return r; |
| 1734 | 1739 | } |
| 1735 | 1740 | |
| 1741 | +static int log_write_hva(struct vhost_virtqueue *vq, u64 hva, u64 len) | |
| 1742 | +{ | |
| 1743 | + struct vhost_umem *umem = vq->umem; | |
| 1744 | + struct vhost_umem_node *u; | |
| 1745 | + u64 start, end, l, min; | |
| 1746 | + int r; | |
| 1747 | + bool hit = false; | |
| 1748 | + | |
| 1749 | + while (len) { | |
| 1750 | + min = len; | |
| 1751 | + /* More than one GPAs can be mapped into a single HVA. So | |
| 1752 | + * iterate all possible umems here to be safe. | |
| 1753 | + */ | |
| 1754 | + list_for_each_entry(u, &umem->umem_list, link) { | |
| 1755 | + if (u->userspace_addr > hva - 1 + len || | |
| 1756 | + u->userspace_addr - 1 + u->size < hva) | |
| 1757 | + continue; | |
| 1758 | + start = max(u->userspace_addr, hva); | |
| 1759 | + end = min(u->userspace_addr - 1 + u->size, | |
| 1760 | + hva - 1 + len); | |
| 1761 | + l = end - start + 1; | |
| 1762 | + r = log_write(vq->log_base, | |
| 1763 | + u->start + start - u->userspace_addr, | |
| 1764 | + l); | |
| 1765 | + if (r < 0) | |
| 1766 | + return r; | |
| 1767 | + hit = true; | |
| 1768 | + min = min(l, min); | |
| 1769 | + } | |
| 1770 | + | |
| 1771 | + if (!hit) | |
| 1772 | + return -EFAULT; | |
| 1773 | + | |
| 1774 | + len -= min; | |
| 1775 | + hva += min; | |
| 1776 | + } | |
| 1777 | + | |
| 1778 | + return 0; | |
| 1779 | +} | |
| 1780 | + | |
| 1781 | +static int log_used(struct vhost_virtqueue *vq, u64 used_offset, u64 len) | |
| 1782 | +{ | |
| 1783 | + struct iovec iov[64]; | |
| 1784 | + int i, ret; | |
| 1785 | + | |
| 1786 | + if (!vq->iotlb) | |
| 1787 | + return log_write(vq->log_base, vq->log_addr + used_offset, len); | |
| 1788 | + | |
| 1789 | + ret = translate_desc(vq, (uintptr_t)vq->used + used_offset, | |
| 1790 | + len, iov, 64, VHOST_ACCESS_WO); | |
| 1791 | + if (ret) | |
| 1792 | + return ret; | |
| 1793 | + | |
| 1794 | + for (i = 0; i < ret; i++) { | |
| 1795 | + ret = log_write_hva(vq, (uintptr_t)iov[i].iov_base, | |
| 1796 | + iov[i].iov_len); | |
| 1797 | + if (ret) | |
| 1798 | + return ret; | |
| 1799 | + } | |
| 1800 | + | |
| 1801 | + return 0; | |
| 1802 | +} | |
| 1803 | + | |
| 1736 | 1804 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, |
| 1737 | − unsigned int log_num, u64 len) | |
| 1805 | + unsigned int log_num, u64 len, struct iovec *iov, int count) | |
| 1738 | 1806 | { |
| 1739 | 1807 | int i, r; |
| 1740 | 1808 | |
| 1741 | 1809 | /* Make sure data written is seen before log. */ |
| 1742 | 1810 | smp_wmb(); |
| 1811 | + | |
| 1812 | + if (vq->iotlb) { | |
| 1813 | + for (i = 0; i < count; i++) { | |
| 1814 | + r = log_write_hva(vq, (uintptr_t)iov[i].iov_base, | |
| 1815 | + iov[i].iov_len); | |
| 1816 | + if (r < 0) | |
| 1817 | + return r; | |
| 1818 | + } | |
| 1819 | + return 0; | |
| 1820 | + } | |
| 1821 | + | |
| 1743 | 1822 | for (i = 0; i < log_num; ++i) { |
| 1744 | 1823 | u64 l = min(log[i].len, len); |
| 1745 | 1824 | r = log_write(vq->log_base, log[i].addr, l); |
| @@ -1769,9 +1848,8 @@ static int vhost_update_used_flags(struct vhost_virtqueue *vq) · 23 unmodified lines | ||
| 1769 | 1848 | smp_wmb(); |
| 1770 | 1849 | /* Log used flag write. */ |
| 1771 | 1850 | used = &vq->used->flags; |
| 1772 | − log_write(vq->log_base, vq->log_addr + | |
| 1773 | − (used - (void __user *)vq->used), | |
| 1774 | − sizeof vq->used->flags); | |
| 1851 | + log_used(vq, (used - (void __user *)vq->used), | |
| 1852 | + sizeof vq->used->flags); | |
| 1775 | 1853 | if (vq->log_ctx) |
| 1776 | 1854 | eventfd_signal(vq->log_ctx, 1); |
| 1777 | 1855 | } |
| @@ -1789,9 +1867,8 @@ static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event) · 11 unmodified lines | ||
| 1789 | 1867 | smp_wmb(); |
| 1790 | 1868 | /* Log avail event write */ |
| 1791 | 1869 | used = vhost_avail_event(vq); |
| 1792 | − log_write(vq->log_base, vq->log_addr + | |
| 1793 | − (used - (void __user *)vq->used), | |
| 1794 | − sizeof *vhost_avail_event(vq)); | |
| 1870 | + log_used(vq, (used - (void __user *)vq->used), | |
| 1871 | + sizeof *vhost_avail_event(vq)); | |
| 1795 | 1872 | if (vq->log_ctx) |
| 1796 | 1873 | eventfd_signal(vq->log_ctx, 1); |
| 1797 | 1874 | } |
| @@ -2191,10 +2268,8 @@ static int __vhost_add_used_n(struct vhost_virtqueue *vq, · 393 unmodified lines | ||
| 2191 | 2268 | /* Make sure data is seen before log. */ |
| 2192 | 2269 | smp_wmb(); |
| 2193 | 2270 | /* Log used ring entry write. */ |
| 2194 | − log_write(vq->log_base, | |
| 2195 | − vq->log_addr + | |
| 2196 | − ((void __user *)used - (void __user *)vq->used), | |
| 2197 | − count * sizeof *used); | |
| 2271 | + log_used(vq, ((void __user *)used - (void __user *)vq->used), | |
| 2272 | + count * sizeof *used); | |
| 2198 | 2273 | } |
| 2199 | 2274 | old = vq->last_used_idx; |
| 2200 | 2275 | new = (vq->last_used_idx += count); |
| @@ -2236,9 +2311,8 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads, · 35 unmodified lines | ||
| 2236 | 2311 | /* Make sure used idx is seen before log. */ |
| 2237 | 2312 | smp_wmb(); |
| 2238 | 2313 | /* Log used index update. */ |
| 2239 | − log_write(vq->log_base, | |
| 2240 | − vq->log_addr + offsetof(struct vring_used, idx), | |
| 2241 | − sizeof vq->used->idx); | |
| 2314 | + log_used(vq, offsetof(struct vring_used, idx), | |
| 2315 | + sizeof vq->used->idx); | |
| 2242 | 2316 | if (vq->log_ctx) |
| 2243 | 2317 | eventfd_signal(vq->log_ctx, 1); |
| 2244 | 2318 | } |
| @@ -170,9 +170,11 @@ struct vhost_dev { · 169 unmodified lines | ||
| 170 | 170 | struct list_head read_list; |
| 171 | 171 | struct list_head pending_list; |
| 172 | 172 | wait_queue_head_t wait; |
| 173 | + int iov_limit; | |
| 173 | 174 | }; |
| 174 | 175 | |
| 175 | −void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, int nvqs); | |
| 176 | +void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs, | |
| 177 | + int nvqs, int iov_limit); | |
| 176 | 178 | long vhost_dev_set_owner(struct vhost_dev *dev); |
| 177 | 179 | bool vhost_dev_has_owner(struct vhost_dev *dev); |
| 178 | 180 | long vhost_dev_check_owner(struct vhost_dev *); |
| @@ -205,7 +207,8 @@ bool vhost_vq_avail_empty(struct vhost_dev *, struct vhost_virtqueue *); · 26 unmodified lines | ||
| 205 | 207 | bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *); |
| 206 | 208 | |
| 207 | 209 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, |
| 208 | − unsigned int log_num, u64 len); | |
| 210 | + unsigned int log_num, u64 len, | |
| 211 | + struct iovec *iov, int count); | |
| 209 | 212 | int vq_iotlb_prefetch(struct vhost_virtqueue *vq); |
| 210 | 213 | |
| 211 | 214 | struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type); |
| @@ -531,7 +531,7 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) · 530 unmodified lines | ||
| 531 | 531 | vsock->vqs[VSOCK_VQ_TX].handle_kick = vhost_vsock_handle_tx_kick; |
| 532 | 532 | vsock->vqs[VSOCK_VQ_RX].handle_kick = vhost_vsock_handle_rx_kick; |
| 533 | 533 | |
| 534 | − vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs)); | |
| 534 | + vhost_dev_init(&vsock->dev, vqs, ARRAY_SIZE(vsock->vqs), UIO_MAXIOV); | |
| 535 | 535 | |
| 536 | 536 | file->private_data = vsock; |
| 537 | 537 | spin_lock_init(&vsock->send_pkt_list_lock); |
| @@ -642,7 +642,7 @@ static int vhost_vsock_set_cid(struct vhost_vsock *vsock, u64 guest_cid) · 104 unmodified lines | ||
| 642 | 642 | hash_del_rcu(&vsock->hash); |
| 643 | 643 | |
| 644 | 644 | vsock->guest_cid = guest_cid; |
| 645 | − hash_add_rcu(vhost_vsock_hash, &vsock->hash, guest_cid); | |
| 645 | + hash_add_rcu(vhost_vsock_hash, &vsock->hash, vsock->guest_cid); | |
| 646 | 646 | mutex_unlock(&vhost_vsock_mutex); |
| 647 | 647 | |
| 648 | 648 | return 0; |
| @@ -174,7 +174,7 @@ static int pm860x_backlight_dt_init(struct platform_device *pdev, · 173 unmodified lines | ||
| 174 | 174 | return -ENODEV; |
| 175 | 175 | } |
| 176 | 176 | for_each_child_of_node(nproot, np) { |
| 177 | − if (!of_node_cmp(np->name, name)) { | |
| 177 | + if (of_node_name_eq(np, name)) { | |
| 178 | 178 | of_property_read_u32(np, "marvell,88pm860x-iset", |
| 179 | 179 | &iset); |
| 180 | 180 | data->iset = PM8606_WLED_CURRENT(iset); |
| @@ -30,6 +30,7 @@ struct pwm_bl_data { · 29 unmodified lines | ||
| 30 | 30 | struct device *dev; |
| 31 | 31 | unsigned int lth_brightness; |
| 32 | 32 | unsigned int *levels; |
| 33 | + bool enabled; | |
| 33 | 34 | struct regulator *power_supply; |
| 34 | 35 | struct gpio_desc *enable_gpio; |
| 35 | 36 | unsigned int scale; |
| @@ -50,7 +51,7 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb) · 14 unmodified lines | ||
| 50 | 51 | int err; |
| 51 | 52 | |
| 52 | 53 | pwm_get_state(pb->pwm, &state); |
| 53 | − if (state.enabled) | |
| 54 | + if (pb->enabled) | |
| 54 | 55 | return; |
| 55 | 56 | |
| 56 | 57 | err = regulator_enable(pb->power_supply); |
| @@ -65,6 +66,8 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb) · 8 unmodified lines | ||
| 65 | 66 | |
| 66 | 67 | if (pb->enable_gpio) |
| 67 | 68 | gpiod_set_value_cansleep(pb->enable_gpio, 1); |
| 69 | + | |
| 70 | + pb->enabled = true; | |
| 68 | 71 | } |
| 69 | 72 | |
| 70 | 73 | static void pwm_backlight_power_off(struct pwm_bl_data *pb) |
| @@ -72,7 +75,7 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb) · 1 unmodified line | ||
| 72 | 75 | struct pwm_state state; |
| 73 | 76 | |
| 74 | 77 | pwm_get_state(pb->pwm, &state); |
| 75 | − if (!state.enabled) | |
| 78 | + if (!pb->enabled) | |
| 76 | 79 | return; |
| 77 | 80 | |
| 78 | 81 | if (pb->enable_gpio) |
| @@ -86,6 +89,7 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb) · 7 unmodified lines | ||
| 86 | 89 | pwm_apply_state(pb->pwm, &state); |
| 87 | 90 | |
| 88 | 91 | regulator_disable(pb->power_supply); |
| 92 | + pb->enabled = false; | |
| 89 | 93 | } |
| 90 | 94 | |
| 91 | 95 | static int compute_duty_cycle(struct pwm_bl_data *pb, int brightness) |
| @@ -268,6 +272,16 @@ static int pwm_backlight_parse_dt(struct device *dev, · 176 unmodified lines | ||
| 268 | 272 | |
| 269 | 273 | memset(data, 0, sizeof(*data)); |
| 270 | 274 | |
| 275 | + /* | |
| 276 | + * These values are optional and set as 0 by default, the out values | |
| 277 | + * are modified only if a valid u32 value can be decoded. | |
| 278 | + */ | |
| 279 | + of_property_read_u32(node, "post-pwm-on-delay-ms", | |
| 280 | + &data->post_pwm_on_delay); | |
| 281 | + of_property_read_u32(node, "pwm-off-delay-ms", &data->pwm_off_delay); | |
| 282 | + | |
| 283 | + data->enable_gpio = -EINVAL; | |
| 284 | + | |
| 271 | 285 | /* |
| 272 | 286 | * Determine the number of brightness levels, if this property is not |
| 273 | 287 | * set a default table of brightness levels will be used. |
| @@ -380,15 +394,6 @@ static int pwm_backlight_parse_dt(struct device *dev, · 106 unmodified lines | ||
| 380 | 394 | data->max_brightness--; |
| 381 | 395 | } |
| 382 | 396 | |
| 383 | − /* | |
| 384 | − * These values are optional and set as 0 by default, the out values | |
| 385 | − * are modified only if a valid u32 value can be decoded. | |
| 386 | − */ | |
| 387 | − of_property_read_u32(node, "post-pwm-on-delay-ms", | |
| 388 | − &data->post_pwm_on_delay); | |
| 389 | − of_property_read_u32(node, "pwm-off-delay-ms", &data->pwm_off_delay); | |
| 390 | − | |
| 391 | − data->enable_gpio = -EINVAL; | |
| 392 | 397 | return 0; |
| 393 | 398 | } |
| 394 | 399 | |
| @@ -483,6 +488,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) · 88 unmodified lines | ||
| 483 | 488 | pb->check_fb = data->check_fb; |
| 484 | 489 | pb->exit = data->exit; |
| 485 | 490 | pb->dev = &pdev->dev; |
| 491 | + pb->enabled = false; | |
| 486 | 492 | pb->post_pwm_on_delay = data->post_pwm_on_delay; |
| 487 | 493 | pb->pwm_off_delay = data->pwm_off_delay; |
| 488 | 494 | |
| @@ -271,6 +271,7 @@ static void vgacon_scrollback_update(struct vc_data *c, int t, int count) · 270 unmodified lines | ||
| 271 | 271 | |
| 272 | 272 | static void vgacon_restore_screen(struct vc_data *c) |
| 273 | 273 | { |
| 274 | + c->vc_origin = c->vc_visible_origin; | |
| 274 | 275 | vgacon_scrollback_cur->save = 0; |
| 275 | 276 | |
| 276 | 277 | if (!vga_is_gfx && !vgacon_scrollback_cur->restore) { |
| @@ -287,8 +288,7 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) · 10 unmodified lines | ||
| 287 | 288 | int start, end, count, soff; |
| 288 | 289 | |
| 289 | 290 | if (!lines) { |
| 290 | − c->vc_visible_origin = c->vc_origin; | |
| 291 | − vga_set_mem_top(c); | |
| 291 | + vgacon_restore_screen(c); | |
| 292 | 292 | return; |
| 293 | 293 | } |
| 294 | 294 | |
| @@ -298,6 +298,7 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) · 3 unmodified lines | ||
| 298 | 298 | if (!vgacon_scrollback_cur->save) { |
| 299 | 299 | vgacon_cursor(c, CM_ERASE); |
| 300 | 300 | vgacon_save_screen(c); |
| 301 | + c->vc_origin = (unsigned long)c->vc_screenbuf; | |
| 301 | 302 | vgacon_scrollback_cur->save = 1; |
| 302 | 303 | } |
| 303 | 304 | |
| @@ -335,7 +336,7 @@ static void vgacon_scrolldelta(struct vc_data *c, int lines) · 31 unmodified lines | ||
| 335 | 336 | int copysize; |
| 336 | 337 | |
| 337 | 338 | int diff = c->vc_rows - count; |
| 338 | − void *d = (void *) c->vc_origin; | |
| 339 | + void *d = (void *) c->vc_visible_origin; | |
| 339 | 340 | void *s = (void *) c->vc_screenbuf; |
| 340 | 341 | |
| 341 | 342 | count *= c->vc_size_row; |
| @@ -510,6 +510,13 @@ static int __init fb_console_setup(char *this_opt) · 509 unmodified lines | ||
| 510 | 510 | continue; |
| 511 | 511 | } |
| 512 | 512 | #endif |
| 513 | + | |
| 514 | + if (!strncmp(options, "logo-pos:", 9)) { | |
| 515 | + options += 9; | |
| 516 | + if (!strcmp(options, "center")) | |
| 517 | + fb_center_logo = true; | |
| 518 | + continue; | |
| 519 | + } | |
| 513 | 520 | } |
| 514 | 521 | return 1; |
| 515 | 522 | } |
| @@ -53,6 +53,9 @@ EXPORT_SYMBOL(registered_fb); · 52 unmodified lines | ||
| 53 | 53 | int num_registered_fb __read_mostly; |
| 54 | 54 | EXPORT_SYMBOL(num_registered_fb); |
| 55 | 55 | |
| 56 | +bool fb_center_logo __read_mostly; | |
| 57 | +EXPORT_SYMBOL(fb_center_logo); | |
| 58 | + | |
| 56 | 59 | static struct fb_info *get_fb_info(unsigned int idx) |
| 57 | 60 | { |
| 58 | 61 | struct fb_info *fb_info; |
| @@ -506,8 +509,7 @@ static int fb_show_logo_line(struct fb_info *info, int rotate, · 447 unmodified lines | ||
| 506 | 509 | fb_set_logo(info, logo, logo_new, fb_logo.depth); |
| 507 | 510 | } |
| 508 | 511 | |
| 509 | −#ifdef CONFIG_FB_LOGO_CENTER | |
| 510 | − { | |
| 512 | + if (fb_center_logo) { | |
| 511 | 513 | int xres = info->var.xres; |
| 512 | 514 | int yres = info->var.yres; |
| 513 | 515 | |
| @@ -520,11 +522,11 @@ static int fb_show_logo_line(struct fb_info *info, int rotate, · 6 unmodified lines | ||
| 520 | 522 | --n; |
| 521 | 523 | image.dx = (xres - n * (logo->width + 8) - 8) / 2; |
| 522 | 524 | image.dy = y ?: (yres - logo->height) / 2; |
| 525 | + } else { | |
| 526 | + image.dx = 0; | |
| 527 | + image.dy = y; | |
| 523 | 528 | } |
| 524 | −#else | |
| 525 | − image.dx = 0; | |
| 526 | − image.dy = y; | |
| 527 | −#endif | |
| 529 | + | |
| 528 | 530 | image.width = logo->width; |
| 529 | 531 | image.height = logo->height; |
| 530 | 532 | |
| @@ -684,9 +686,8 @@ int fb_prepare_logo(struct fb_info *info, int rotate) · 153 unmodified lines | ||
| 684 | 686 | } |
| 685 | 687 | |
| 686 | 688 | height = fb_logo.logo->height; |
| 687 | −#ifdef CONFIG_FB_LOGO_CENTER | |
| 688 | − height += (yres - fb_logo.logo->height) / 2; | |
| 689 | −#endif | |
| 689 | + if (fb_center_logo) | |
| 690 | + height += (yres - fb_logo.logo->height) / 2; | |
| 690 | 691 | |
| 691 | 692 | return fb_prepare_extra_logos(info, height, yres); |
| 692 | 693 | } |
| @@ -318,28 +318,28 @@ static void __iomem *offb_map_reg(struct device_node *np, int index, · 317 unmodified lines | ||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp, |
| 321 | − const char *name, unsigned long address) | |
| 321 | + unsigned long address) | |
| 322 | 322 | { |
| 323 | 323 | struct offb_par *par = (struct offb_par *) info->par; |
| 324 | 324 | |
| 325 | − if (dp && !strncmp(name, "ATY,Rage128", 11)) { | |
| 325 | + if (of_node_name_prefix(dp, "ATY,Rage128")) { | |
| 326 | 326 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); |
| 327 | 327 | if (par->cmap_adr) |
| 328 | 328 | par->cmap_type = cmap_r128; |
| 329 | − } else if (dp && (!strncmp(name, "ATY,RageM3pA", 12) | |
| 330 | − || !strncmp(name, "ATY,RageM3p12A", 14))) { | |
| 329 | + } else if (of_node_name_prefix(dp, "ATY,RageM3pA") || | |
| 330 | + of_node_name_prefix(dp, "ATY,RageM3p12A")) { | |
| 331 | 331 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); |
| 332 | 332 | if (par->cmap_adr) |
| 333 | 333 | par->cmap_type = cmap_M3A; |
| 334 | − } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) { | |
| 334 | + } else if (of_node_name_prefix(dp, "ATY,RageM3pB")) { | |
| 335 | 335 | par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff); |
| 336 | 336 | if (par->cmap_adr) |
| 337 | 337 | par->cmap_type = cmap_M3B; |
| 338 | − } else if (dp && !strncmp(name, "ATY,Rage6", 9)) { | |
| 338 | + } else if (of_node_name_prefix(dp, "ATY,Rage6")) { | |
| 339 | 339 | par->cmap_adr = offb_map_reg(dp, 1, 0, 0x1fff); |
| 340 | 340 | if (par->cmap_adr) |
| 341 | 341 | par->cmap_type = cmap_radeon; |
| 342 | − } else if (!strncmp(name, "ATY,", 4)) { | |
| 342 | + } else if (of_node_name_prefix(dp, "ATY,")) { | |
| 343 | 343 | unsigned long base = address & 0xff000000UL; |
| 344 | 344 | par->cmap_adr = |
| 345 | 345 | ioremap(base + 0x7ff000, 0x1000) + 0xcc0; |
| @@ -350,7 +350,7 @@ static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp · 4 unmodified lines | ||
| 350 | 350 | par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000); |
| 351 | 351 | if (par->cmap_adr) |
| 352 | 352 | par->cmap_type = cmap_gxt2000; |
| 353 | − } else if (dp && !strncmp(name, "vga,Display-", 12)) { | |
| 353 | + } else if (of_node_name_prefix(dp, "vga,Display-")) { | |
| 354 | 354 | /* Look for AVIVO initialized by SLOF */ |
| 355 | 355 | struct device_node *pciparent = of_get_parent(dp); |
| 356 | 356 | const u32 *vid, *did; |
| @@ -438,7 +438,7 @@ static void __init offb_init_fb(const char *name, · 81 unmodified lines | ||
| 438 | 438 | |
| 439 | 439 | par->cmap_type = cmap_unknown; |
| 440 | 440 | if (depth == 8) |
| 441 | − offb_init_palette_hacks(info, dp, name, address); | |
| 441 | + offb_init_palette_hacks(info, dp, address); | |
| 442 | 442 | else |
| 443 | 443 | fix->visual = FB_VISUAL_TRUECOLOR; |
| 444 | 444 | |
| @@ -609,6 +609,8 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) · 608 unmodified lines | ||
| 609 | 609 | |
| 610 | 610 | int r = 0; |
| 611 | 611 | |
| 612 | + memset(&p, 0, sizeof(p)); | |
| 613 | + | |
| 612 | 614 | switch (cmd) { |
| 613 | 615 | case OMAPFB_SYNC_GFX: |
| 614 | 616 | DBG("ioctl SYNC_GFX\n"); |
| @@ -10,15 +10,6 @@ menuconfig LOGO · 9 unmodified lines | ||
| 10 | 10 | |
| 11 | 11 | if LOGO |
| 12 | 12 | |
| 13 | −config FB_LOGO_CENTER | |
| 14 | − bool "Center the logo" | |
| 15 | − depends on FB=y | |
| 16 | − help | |
| 17 | − When this option is selected, the bootup logo is centered both | |
| 18 | − horizontally and vertically. If more than one logo is displayed | |
| 19 | − due to multiple CPUs, the collected line of logos is centered | |
| 20 | − as a whole. | |
| 21 | − | |
| 22 | 13 | config FB_LOGO_EXTRA |
| 23 | 14 | bool |
| 24 | 15 | depends on FB=y |
| @@ -61,6 +61,10 @@ enum virtio_balloon_vq { · 60 unmodified lines | ||
| 61 | 61 | VIRTIO_BALLOON_VQ_MAX |
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | +enum virtio_balloon_config_read { | |
| 65 | + VIRTIO_BALLOON_CONFIG_READ_CMD_ID = 0, | |
| 66 | +}; | |
| 67 | + | |
| 64 | 68 | struct virtio_balloon { |
| 65 | 69 | struct virtio_device *vdev; |
| 66 | 70 | struct virtqueue *inflate_vq, *deflate_vq, *stats_vq, *free_page_vq; |
| @@ -77,14 +81,20 @@ struct virtio_balloon { · 10 unmodified lines | ||
| 77 | 81 | /* Prevent updating balloon when it is being canceled. */ |
| 78 | 82 | spinlock_t stop_update_lock; |
| 79 | 83 | bool stop_update; |
| 84 | + /* Bitmap to indicate if reading the related config fields are needed */ | |
| 85 | + unsigned long config_read_bitmap; | |
| 80 | 86 | |
| 81 | 87 | /* The list of allocated free pages, waiting to be given back to mm */ |
| 82 | 88 | struct list_head free_page_list; |
| 83 | 89 | spinlock_t free_page_list_lock; |
| 84 | 90 | /* The number of free page blocks on the above list */ |
| 85 | 91 | unsigned long num_free_page_blocks; |
| 86 | − /* The cmd id received from host */ | |
| 87 | − u32 cmd_id_received; | |
| 92 | + /* | |
| 93 | + * The cmd id received from host. | |
| 94 | + * Read it via virtio_balloon_cmd_id_received to get the latest value | |
| 95 | + * sent from host. | |
| 96 | + */ | |
| 97 | + u32 cmd_id_received_cache; | |
| 88 | 98 | /* The cmd id that is actively in use */ |
| 89 | 99 | __virtio32 cmd_id_active; |
| 90 | 100 | /* Buffer to store the stop sign */ |
| @@ -390,37 +400,31 @@ static unsigned long return_free_pages_to_mm(struct virtio_balloon *vb, · 299 unmodified lines | ||
| 390 | 400 | return num_returned; |
| 391 | 401 | } |
| 392 | 402 | |
| 403 | +static void virtio_balloon_queue_free_page_work(struct virtio_balloon *vb) | |
| 404 | +{ | |
| 405 | + if (!virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) | |
| 406 | + return; | |
| 407 | + | |
| 408 | + /* No need to queue the work if the bit was already set. */ | |
| 409 | + if (test_and_set_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID, | |
| 410 | + &vb->config_read_bitmap)) | |
| 411 | + return; | |
| 412 | + | |
| 413 | + queue_work(vb->balloon_wq, &vb->report_free_page_work); | |
| 414 | +} | |
| 415 | + | |
| 393 | 416 | static void virtballoon_changed(struct virtio_device *vdev) |
| 394 | 417 | { |
| 395 | 418 | struct virtio_balloon *vb = vdev->priv; |
| 396 | 419 | unsigned long flags; |
| 397 | − s64 diff = towards_target(vb); | |
| 398 | − | |
| 399 | − if (diff) { | |
| 400 | − spin_lock_irqsave(&vb->stop_update_lock, flags); | |
| 401 | − if (!vb->stop_update) | |
| 402 | − queue_work(system_freezable_wq, | |
| 403 | − &vb->update_balloon_size_work); | |
| 404 | − spin_unlock_irqrestore(&vb->stop_update_lock, flags); | |
| 405 | − } | |
| 406 | 420 | |
| 407 | − if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) { | |
| 408 | − virtio_cread(vdev, struct virtio_balloon_config, | |
| 409 | − free_page_report_cmd_id, &vb->cmd_id_received); | |
| 410 | − if (vb->cmd_id_received == VIRTIO_BALLOON_CMD_ID_DONE) { | |
| 411 | − /* Pass ULONG_MAX to give back all the free pages */ | |
| 412 | − return_free_pages_to_mm(vb, ULONG_MAX); | |
| 413 | − } else if (vb->cmd_id_received != VIRTIO_BALLOON_CMD_ID_STOP && | |
| 414 | − vb->cmd_id_received != | |
| 415 | − virtio32_to_cpu(vdev, vb->cmd_id_active)) { | |
| 416 | − spin_lock_irqsave(&vb->stop_update_lock, flags); | |
| 417 | − if (!vb->stop_update) { | |
| 418 | − queue_work(vb->balloon_wq, | |
| 419 | − &vb->report_free_page_work); | |
| 420 | − } | |
| 421 | − spin_unlock_irqrestore(&vb->stop_update_lock, flags); | |
| 422 | − } | |
| 421 | + spin_lock_irqsave(&vb->stop_update_lock, flags); | |
| 422 | + if (!vb->stop_update) { | |
| 423 | + queue_work(system_freezable_wq, | |
| 424 | + &vb->update_balloon_size_work); | |
| 425 | + virtio_balloon_queue_free_page_work(vb); | |
| 423 | 426 | } |
| 427 | + spin_unlock_irqrestore(&vb->stop_update_lock, flags); | |
| 424 | 428 | } |
| 425 | 429 | |
| 426 | 430 | static void update_balloon_size(struct virtio_balloon *vb) |
| @@ -527,6 +531,17 @@ static int init_vqs(struct virtio_balloon *vb) · 100 unmodified lines | ||
| 527 | 531 | return 0; |
| 528 | 532 | } |
| 529 | 533 | |
| 534 | +static u32 virtio_balloon_cmd_id_received(struct virtio_balloon *vb) | |
| 535 | +{ | |
| 536 | + if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID, | |
| 537 | + &vb->config_read_bitmap)) | |
| 538 | + virtio_cread(vb->vdev, struct virtio_balloon_config, | |
| 539 | + free_page_report_cmd_id, | |
| 540 | + &vb->cmd_id_received_cache); | |
| 541 | + | |
| 542 | + return vb->cmd_id_received_cache; | |
| 543 | +} | |
| 544 | + | |
| 530 | 545 | static int send_cmd_id_start(struct virtio_balloon *vb) |
| 531 | 546 | { |
| 532 | 547 | struct scatterlist sg; |
| @@ -537,7 +552,8 @@ static int send_cmd_id_start(struct virtio_balloon *vb) · 4 unmodified lines | ||
| 537 | 552 | while (virtqueue_get_buf(vq, &unused)) |
| 538 | 553 | ; |
| 539 | 554 | |
| 540 | − vb->cmd_id_active = cpu_to_virtio32(vb->vdev, vb->cmd_id_received); | |
| 555 | + vb->cmd_id_active = virtio32_to_cpu(vb->vdev, | |
| 556 | + virtio_balloon_cmd_id_received(vb)); | |
| 541 | 557 | sg_init_one(&sg, &vb->cmd_id_active, sizeof(vb->cmd_id_active)); |
| 542 | 558 | err = virtqueue_add_outbuf(vq, &sg, 1, &vb->cmd_id_active, GFP_KERNEL); |
| 543 | 559 | if (!err) |
| @@ -620,7 +636,8 @@ static int send_free_pages(struct virtio_balloon *vb) · 76 unmodified lines | ||
| 620 | 636 | * stop the reporting. |
| 621 | 637 | */ |
| 622 | 638 | cmd_id_active = virtio32_to_cpu(vb->vdev, vb->cmd_id_active); |
| 623 | − if (cmd_id_active != vb->cmd_id_received) | |
| 639 | + if (unlikely(cmd_id_active != | |
| 640 | + virtio_balloon_cmd_id_received(vb))) | |
| 624 | 641 | break; |
| 625 | 642 | |
| 626 | 643 | /* |
| @@ -637,11 +654,9 @@ static int send_free_pages(struct virtio_balloon *vb) · 10 unmodified lines | ||
| 637 | 654 | return 0; |
| 638 | 655 | } |
| 639 | 656 | |
| 640 | −static void report_free_page_func(struct work_struct *work) | |
| 657 | +static void virtio_balloon_report_free_page(struct virtio_balloon *vb) | |
| 641 | 658 | { |
| 642 | 659 | int err; |
| 643 | − struct virtio_balloon *vb = container_of(work, struct virtio_balloon, | |
| 644 | − report_free_page_work); | |
| 645 | 660 | struct device *dev = &vb->vdev->dev; |
| 646 | 661 | |
| 647 | 662 | /* Start by sending the received cmd id to host with an outbuf. */ |
| @@ -659,6 +674,23 @@ static void report_free_page_func(struct work_struct *work) · 11 unmodified lines | ||
| 659 | 674 | dev_err(dev, "Failed to send a stop id, err = %d\n", err); |
| 660 | 675 | } |
| 661 | 676 | |
| 677 | +static void report_free_page_func(struct work_struct *work) | |
| 678 | +{ | |
| 679 | + struct virtio_balloon *vb = container_of(work, struct virtio_balloon, | |
| 680 | + report_free_page_work); | |
| 681 | + u32 cmd_id_received; | |
| 682 | + | |
| 683 | + cmd_id_received = virtio_balloon_cmd_id_received(vb); | |
| 684 | + if (cmd_id_received == VIRTIO_BALLOON_CMD_ID_DONE) { | |
| 685 | + /* Pass ULONG_MAX to give back all the free pages */ | |
| 686 | + return_free_pages_to_mm(vb, ULONG_MAX); | |
| 687 | + } else if (cmd_id_received != VIRTIO_BALLOON_CMD_ID_STOP && | |
| 688 | + cmd_id_received != | |
| 689 | + virtio32_to_cpu(vb->vdev, vb->cmd_id_active)) { | |
| 690 | + virtio_balloon_report_free_page(vb); | |
| 691 | + } | |
| 692 | +} | |
| 693 | + | |
| 662 | 694 | #ifdef CONFIG_BALLOON_COMPACTION |
| 663 | 695 | /* |
| 664 | 696 | * virtballoon_migratepage - perform the balloon page migration on behalf of |
| @@ -885,7 +917,7 @@ static int virtballoon_probe(struct virtio_device *vdev) · 220 unmodified lines | ||
| 885 | 917 | goto out_del_vqs; |
| 886 | 918 | } |
| 887 | 919 | INIT_WORK(&vb->report_free_page_work, report_free_page_func); |
| 888 | − vb->cmd_id_received = VIRTIO_BALLOON_CMD_ID_STOP; | |
| 920 | + vb->cmd_id_received_cache = VIRTIO_BALLOON_CMD_ID_STOP; | |
| 889 | 921 | vb->cmd_id_active = cpu_to_virtio32(vb->vdev, |
| 890 | 922 | VIRTIO_BALLOON_CMD_ID_STOP); |
| 891 | 923 | vb->cmd_id_stop = cpu_to_virtio32(vb->vdev, |
| @@ -468,7 +468,7 @@ static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs, · 467 unmodified lines | ||
| 468 | 468 | { |
| 469 | 469 | struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); |
| 470 | 470 | unsigned int irq = platform_get_irq(vm_dev->pdev, 0); |
| 471 | − int i, err; | |
| 471 | + int i, err, queue_idx = 0; | |
| 472 | 472 | |
| 473 | 473 | err = request_irq(irq, vm_interrupt, IRQF_SHARED, |
| 474 | 474 | dev_name(&vdev->dev), vm_dev); |
| @@ -476,7 +476,12 @@ static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs, · 1 unmodified line | ||
| 476 | 476 | return err; |
| 477 | 477 | |
| 478 | 478 | for (i = 0; i < nvqs; ++i) { |
| 479 | − vqs[i] = vm_setup_vq(vdev, i, callbacks[i], names[i], | |
| 479 | + if (!names[i]) { | |
| 480 | + vqs[i] = NULL; | |
| 481 | + continue; | |
| 482 | + } | |
| 483 | + | |
| 484 | + vqs[i] = vm_setup_vq(vdev, queue_idx++, callbacks[i], names[i], | |
| 480 | 485 | ctx ? ctx[i] : false); |
| 481 | 486 | if (IS_ERR(vqs[i])) { |
| 482 | 487 | vm_del_vqs(vdev); |
| @@ -285,7 +285,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs, · 284 unmodified lines | ||
| 285 | 285 | { |
| 286 | 286 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); |
| 287 | 287 | u16 msix_vec; |
| 288 | − int i, err, nvectors, allocated_vectors; | |
| 288 | + int i, err, nvectors, allocated_vectors, queue_idx = 0; | |
| 289 | 289 | |
| 290 | 290 | vp_dev->vqs = kcalloc(nvqs, sizeof(*vp_dev->vqs), GFP_KERNEL); |
| 291 | 291 | if (!vp_dev->vqs) |
| @@ -321,7 +321,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs, · 29 unmodified lines | ||
| 321 | 321 | msix_vec = allocated_vectors++; |
| 322 | 322 | else |
| 323 | 323 | msix_vec = VP_MSIX_VQ_VECTOR; |
| 324 | − vqs[i] = vp_setup_vq(vdev, i, callbacks[i], names[i], | |
| 324 | + vqs[i] = vp_setup_vq(vdev, queue_idx++, callbacks[i], names[i], | |
| 325 | 325 | ctx ? ctx[i] : false, |
| 326 | 326 | msix_vec); |
| 327 | 327 | if (IS_ERR(vqs[i])) { |
| @@ -356,7 +356,7 @@ static int vp_find_vqs_intx(struct virtio_device *vdev, unsigned nvqs, · 28 unmodified lines | ||
| 356 | 356 | const char * const names[], const bool *ctx) |
| 357 | 357 | { |
| 358 | 358 | struct virtio_pci_device *vp_dev = to_vp_device(vdev); |
| 359 | − int i, err; | |
| 359 | + int i, err, queue_idx = 0; | |
| 360 | 360 | |
| 361 | 361 | vp_dev->vqs = kcalloc(nvqs, sizeof(*vp_dev->vqs), GFP_KERNEL); |
| 362 | 362 | if (!vp_dev->vqs) |
| @@ -374,7 +374,7 @@ static int vp_find_vqs_intx(struct virtio_device *vdev, unsigned nvqs, · 11 unmodified lines | ||
| 374 | 374 | vqs[i] = NULL; |
| 375 | 375 | continue; |
| 376 | 376 | } |
| 377 | − vqs[i] = vp_setup_vq(vdev, i, callbacks[i], names[i], | |
| 377 | + vqs[i] = vp_setup_vq(vdev, queue_idx++, callbacks[i], names[i], | |
| 378 | 378 | ctx ? ctx[i] : false, |
| 379 | 379 | VIRTIO_MSI_NO_VECTOR); |
| 380 | 380 | if (IS_ERR(vqs[i])) { |
| @@ -152,7 +152,12 @@ struct vring_virtqueue { · 151 unmodified lines | ||
| 152 | 152 | /* Available for packed ring */ |
| 153 | 153 | struct { |
| 154 | 154 | /* Actual memory layout for this queue. */ |
| 155 | − struct vring_packed vring; | |
| 155 | + struct { | |
| 156 | + unsigned int num; | |
| 157 | + struct vring_packed_desc *desc; | |
| 158 | + struct vring_packed_desc_event *driver; | |
| 159 | + struct vring_packed_desc_event *device; | |
| 160 | + } vring; | |
| 156 | 161 | |
| 157 | 162 | /* Driver ring wrap counter. */ |
| 158 | 163 | bool avail_wrap_counter; |
| @@ -1609,6 +1614,9 @@ static struct virtqueue *vring_create_virtqueue_packed( · 1450 unmodified lines | ||
| 1609 | 1614 | !context; |
| 1610 | 1615 | vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); |
| 1611 | 1616 | |
| 1617 | + if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM)) | |
| 1618 | + vq->weak_barriers = false; | |
| 1619 | + | |
| 1612 | 1620 | vq->packed.ring_dma_addr = ring_dma_addr; |
| 1613 | 1621 | vq->packed.driver_event_dma_addr = driver_event_dma_addr; |
| 1614 | 1622 | vq->packed.device_event_dma_addr = device_event_dma_addr; |
| @@ -2079,6 +2087,9 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, · 464 unmodified lines | ||
| 2079 | 2087 | !context; |
| 2080 | 2088 | vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); |
| 2081 | 2089 | |
| 2090 | + if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM)) | |
| 2091 | + vq->weak_barriers = false; | |
| 2092 | + | |
| 2082 | 2093 | vq->split.queue_dma_addr = 0; |
| 2083 | 2094 | vq->split.queue_size_in_bytes = 0; |
| 2084 | 2095 | |
| @@ -2213,6 +2224,8 @@ void vring_transport_features(struct virtio_device *vdev) · 128 unmodified lines | ||
| 2213 | 2224 | break; |
| 2214 | 2225 | case VIRTIO_F_RING_PACKED: |
| 2215 | 2226 | break; |
| 2227 | + case VIRTIO_F_ORDER_PLATFORM: | |
| 2228 | + break; | |
| 2216 | 2229 | default: |
| 2217 | 2230 | /* We don't understand this bit. */ |
| 2218 | 2231 | __virtio_clear_bit(vdev, i); |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <linux/watchdog.h> |
| 18 | 18 | #include <linux/moduleparam.h> |
| 19 | 19 | #include <linux/platform_device.h> |
| 20 | +#include <linux/mod_devicetable.h> | |
| 20 | 21 | |
| 21 | 22 | #include <asm/mach-ralink/ralink_regs.h> |
| 22 | 23 | |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/watchdog.h> |
| 19 | 19 | #include <linux/moduleparam.h> |
| 20 | 20 | #include <linux/platform_device.h> |
| 21 | +#include <linux/mod_devicetable.h> | |
| 21 | 22 | |
| 22 | 23 | #include <asm/mach-ralink/ralink_regs.h> |
| 23 | 24 | |
| @@ -79,13 +79,13 @@ static int tqmx86_wdt_probe(struct platform_device *pdev) · 78 unmodified lines | ||
| 79 | 79 | return -ENOMEM; |
| 80 | 80 | |
| 81 | 81 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
| 82 | − if (IS_ERR(res)) | |
| 83 | − return PTR_ERR(res); | |
| 82 | + if (!res) | |
| 83 | + return -ENODEV; | |
| 84 | 84 | |
| 85 | 85 | priv->io_base = devm_ioport_map(&pdev->dev, res->start, |
| 86 | 86 | resource_size(res)); |
| 87 | − if (IS_ERR(priv->io_base)) | |
| 88 | − return PTR_ERR(priv->io_base); | |
| 87 | + if (!priv->io_base) | |
| 88 | + return -ENOMEM; | |
| 89 | 89 | |
| 90 | 90 | watchdog_set_drvdata(&priv->wdd, priv); |
| 91 | 91 | |
| @@ -1650,7 +1650,7 @@ void xen_callback_vector(void) · 1649 unmodified lines | ||
| 1650 | 1650 | xen_have_vector_callback = 0; |
| 1651 | 1651 | return; |
| 1652 | 1652 | } |
| 1653 | − pr_info("Xen HVM callback vector for event delivery is enabled\n"); | |
| 1653 | + pr_info_once("Xen HVM callback vector for event delivery is enabled\n"); | |
| 1654 | 1654 | alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, |
| 1655 | 1655 | xen_hvm_callback_vector); |
| 1656 | 1656 | } |
| @@ -160,9 +160,10 @@ static void pvcalls_conn_back_read(void *opaque) · 159 unmodified lines | ||
| 160 | 160 | |
| 161 | 161 | /* write the data, then modify the indexes */ |
| 162 | 162 | virt_wmb(); |
| 163 | − if (ret < 0) | |
| 163 | + if (ret < 0) { | |
| 164 | + atomic_set(&map->read, 0); | |
| 164 | 165 | intf->in_error = ret; |
| 165 | − else | |
| 166 | + } else | |
| 166 | 167 | intf->in_prod = prod + ret; |
| 167 | 168 | /* update the indexes, then notify the other end */ |
| 168 | 169 | virt_wmb(); |
| @@ -282,13 +283,11 @@ static int pvcalls_back_socket(struct xenbus_device *dev, · 113 unmodified lines | ||
| 282 | 283 | static void pvcalls_sk_state_change(struct sock *sock) |
| 283 | 284 | { |
| 284 | 285 | struct sock_mapping *map = sock->sk_user_data; |
| 285 | − struct pvcalls_data_intf *intf; | |
| 286 | 286 | |
| 287 | 287 | if (map == NULL) |
| 288 | 288 | return; |
| 289 | 289 | |
| 290 | − intf = map->ring; | |
| 291 | − intf->in_error = -ENOTCONN; | |
| 290 | + atomic_inc(&map->read); | |
| 292 | 291 | notify_remote_via_irq(map->irq); |
| 293 | 292 | } |
| 294 | 293 | |
| @@ -31,6 +31,12 @@ · 30 unmodified lines | ||
| 31 | 31 | #define PVCALLS_NR_RSP_PER_RING __CONST_RING_SIZE(xen_pvcalls, XEN_PAGE_SIZE) |
| 32 | 32 | #define PVCALLS_FRONT_MAX_SPIN 5000 |
| 33 | 33 | |
| 34 | +static struct proto pvcalls_proto = { | |
| 35 | + .name = "PVCalls", | |
| 36 | + .owner = THIS_MODULE, | |
| 37 | + .obj_size = sizeof(struct sock), | |
| 38 | +}; | |
| 39 | + | |
| 34 | 40 | struct pvcalls_bedata { |
| 35 | 41 | struct xen_pvcalls_front_ring ring; |
| 36 | 42 | grant_ref_t ref; |
| @@ -335,6 +341,42 @@ int pvcalls_front_socket(struct socket *sock) · 298 unmodified lines | ||
| 335 | 341 | return ret; |
| 336 | 342 | } |
| 337 | 343 | |
| 344 | +static void free_active_ring(struct sock_mapping *map) | |
| 345 | +{ | |
| 346 | + if (!map->active.ring) | |
| 347 | + return; | |
| 348 | + | |
| 349 | + free_pages((unsigned long)map->active.data.in, | |
| 350 | + map->active.ring->ring_order); | |
| 351 | + free_page((unsigned long)map->active.ring); | |
| 352 | +} | |
| 353 | + | |
| 354 | +static int alloc_active_ring(struct sock_mapping *map) | |
| 355 | +{ | |
| 356 | + void *bytes; | |
| 357 | + | |
| 358 | + map->active.ring = (struct pvcalls_data_intf *) | |
| 359 | + get_zeroed_page(GFP_KERNEL); | |
| 360 | + if (!map->active.ring) | |
| 361 | + goto out; | |
| 362 | + | |
| 363 | + map->active.ring->ring_order = PVCALLS_RING_ORDER; | |
| 364 | + bytes = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, | |
| 365 | + PVCALLS_RING_ORDER); | |
| 366 | + if (!bytes) | |
| 367 | + goto out; | |
| 368 | + | |
| 369 | + map->active.data.in = bytes; | |
| 370 | + map->active.data.out = bytes + | |
| 371 | + XEN_FLEX_RING_SIZE(PVCALLS_RING_ORDER); | |
| 372 | + | |
| 373 | + return 0; | |
| 374 | + | |
| 375 | +out: | |
| 376 | + free_active_ring(map); | |
| 377 | + return -ENOMEM; | |
| 378 | +} | |
| 379 | + | |
| 338 | 380 | static int create_active(struct sock_mapping *map, int *evtchn) |
| 339 | 381 | { |
| 340 | 382 | void *bytes; |
| @@ -343,15 +385,7 @@ static int create_active(struct sock_mapping *map, int *evtchn) · 2 unmodified lines | ||
| 343 | 385 | *evtchn = -1; |
| 344 | 386 | init_waitqueue_head(&map->active.inflight_conn_req); |
| 345 | 387 | |
| 346 | − map->active.ring = (struct pvcalls_data_intf *) | |
| 347 | − __get_free_page(GFP_KERNEL | __GFP_ZERO); | |
| 348 | − if (map->active.ring == NULL) | |
| 349 | − goto out_error; | |
| 350 | − map->active.ring->ring_order = PVCALLS_RING_ORDER; | |
| 351 | − bytes = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, | |
| 352 | − PVCALLS_RING_ORDER); | |
| 353 | − if (bytes == NULL) | |
| 354 | − goto out_error; | |
| 388 | + bytes = map->active.data.in; | |
| 355 | 389 | for (i = 0; i < (1 << PVCALLS_RING_ORDER); i++) |
| 356 | 390 | map->active.ring->ref[i] = gnttab_grant_foreign_access( |
| 357 | 391 | pvcalls_front_dev->otherend_id, |
| @@ -361,10 +395,6 @@ static int create_active(struct sock_mapping *map, int *evtchn) · 3 unmodified lines | ||
| 361 | 395 | pvcalls_front_dev->otherend_id, |
| 362 | 396 | pfn_to_gfn(virt_to_pfn((void *)map->active.ring)), 0); |
| 363 | 397 | |
| 364 | − map->active.data.in = bytes; | |
| 365 | − map->active.data.out = bytes + | |
| 366 | − XEN_FLEX_RING_SIZE(PVCALLS_RING_ORDER); | |
| 367 | − | |
| 368 | 398 | ret = xenbus_alloc_evtchn(pvcalls_front_dev, evtchn); |
| 369 | 399 | if (ret) |
| 370 | 400 | goto out_error; |
| @@ -385,8 +415,6 @@ static int create_active(struct sock_mapping *map, int *evtchn) · 14 unmodified lines | ||
| 385 | 415 | out_error: |
| 386 | 416 | if (*evtchn >= 0) |
| 387 | 417 | xenbus_free_evtchn(pvcalls_front_dev, *evtchn); |
| 388 | − free_pages((unsigned long)map->active.data.in, PVCALLS_RING_ORDER); | |
| 389 | − free_page((unsigned long)map->active.ring); | |
| 390 | 418 | return ret; |
| 391 | 419 | } |
| 392 | 420 | |
| @@ -406,17 +434,24 @@ int pvcalls_front_connect(struct socket *sock, struct sockaddr *addr, · 13 unmodified lines | ||
| 406 | 434 | return PTR_ERR(map); |
| 407 | 435 | |
| 408 | 436 | bedata = dev_get_drvdata(&pvcalls_front_dev->dev); |
| 437 | + ret = alloc_active_ring(map); | |
| 438 | + if (ret < 0) { | |
| 439 | + pvcalls_exit_sock(sock); | |
| 440 | + return ret; | |
| 441 | + } | |
| 409 | 442 | |
| 410 | 443 | spin_lock(&bedata->socket_lock); |
| 411 | 444 | ret = get_request(bedata, &req_id); |
| 412 | 445 | if (ret < 0) { |
| 413 | 446 | spin_unlock(&bedata->socket_lock); |
| 447 | + free_active_ring(map); | |
| 414 | 448 | pvcalls_exit_sock(sock); |
| 415 | 449 | return ret; |
| 416 | 450 | } |
| 417 | 451 | ret = create_active(map, &evtchn); |
| 418 | 452 | if (ret < 0) { |
| 419 | 453 | spin_unlock(&bedata->socket_lock); |
| 454 | + free_active_ring(map); | |
| 420 | 455 | pvcalls_exit_sock(sock); |
| 421 | 456 | return ret; |
| 422 | 457 | } |
| @@ -469,8 +504,10 @@ static int __write_ring(struct pvcalls_data_intf *intf, · 46 unmodified lines | ||
| 469 | 504 | virt_mb(); |
| 470 | 505 | |
| 471 | 506 | size = pvcalls_queued(prod, cons, array_size); |
| 472 | − if (size >= array_size) | |
| 507 | + if (size > array_size) | |
| 473 | 508 | return -EINVAL; |
| 509 | + if (size == array_size) | |
| 510 | + return 0; | |
| 474 | 511 | if (len > array_size - size) |
| 475 | 512 | len = array_size - size; |
| 476 | 513 | |
| @@ -560,15 +597,13 @@ static int __read_ring(struct pvcalls_data_intf *intf, · 83 unmodified lines | ||
| 560 | 597 | error = intf->in_error; |
| 561 | 598 | /* get pointers before reading from the ring */ |
| 562 | 599 | virt_rmb(); |
| 563 | − if (error < 0) | |
| 564 | − return error; | |
| 565 | 600 | |
| 566 | 601 | size = pvcalls_queued(prod, cons, array_size); |
| 567 | 602 | masked_prod = pvcalls_mask(prod, array_size); |
| 568 | 603 | masked_cons = pvcalls_mask(cons, array_size); |
| 569 | 604 | |
| 570 | 605 | if (size == 0) |
| 571 | − return 0; | |
| 606 | + return error ?: size; | |
| 572 | 607 | |
| 573 | 608 | if (len > size) |
| 574 | 609 | len = size; |
| @@ -780,25 +815,36 @@ int pvcalls_front_accept(struct socket *sock, struct socket *newsock, int flags) · 205 unmodified lines | ||
| 780 | 815 | } |
| 781 | 816 | } |
| 782 | 817 | |
| 783 | − spin_lock(&bedata->socket_lock); | |
| 784 | − ret = get_request(bedata, &req_id); | |
| 785 | − if (ret < 0) { | |
| 818 | + map2 = kzalloc(sizeof(*map2), GFP_KERNEL); | |
| 819 | + if (map2 == NULL) { | |
| 786 | 820 | clear_bit(PVCALLS_FLAG_ACCEPT_INFLIGHT, |
| 787 | 821 | (void *)&map->passive.flags); |
| 788 | − spin_unlock(&bedata->socket_lock); | |
| 822 | + pvcalls_exit_sock(sock); | |
| 823 | + return -ENOMEM; | |
| 824 | + } | |
| 825 | + ret = alloc_active_ring(map2); | |
| 826 | + if (ret < 0) { | |
| 827 | + clear_bit(PVCALLS_FLAG_ACCEPT_INFLIGHT, | |
| 828 | + (void *)&map->passive.flags); | |
| 829 | + kfree(map2); | |
| 789 | 830 | pvcalls_exit_sock(sock); |
| 790 | 831 | return ret; |
| 791 | 832 | } |
| 792 | − map2 = kzalloc(sizeof(*map2), GFP_ATOMIC); | |
| 793 | − if (map2 == NULL) { | |
| 833 | + spin_lock(&bedata->socket_lock); | |
| 834 | + ret = get_request(bedata, &req_id); | |
| 835 | + if (ret < 0) { | |
| 794 | 836 | clear_bit(PVCALLS_FLAG_ACCEPT_INFLIGHT, |
| 795 | 837 | (void *)&map->passive.flags); |
| 796 | 838 | spin_unlock(&bedata->socket_lock); |
| 839 | + free_active_ring(map2); | |
| 840 | + kfree(map2); | |
| 797 | 841 | pvcalls_exit_sock(sock); |
| 798 | − return -ENOMEM; | |
| 842 | + return ret; | |
| 799 | 843 | } |
| 844 | + | |
| 800 | 845 | ret = create_active(map2, &evtchn); |
| 801 | 846 | if (ret < 0) { |
| 847 | + free_active_ring(map2); | |
| 802 | 848 | kfree(map2); |
| 803 | 849 | clear_bit(PVCALLS_FLAG_ACCEPT_INFLIGHT, |
| 804 | 850 | (void *)&map->passive.flags); |
| @@ -839,7 +885,7 @@ int pvcalls_front_accept(struct socket *sock, struct socket *newsock, int flags) · 34 unmodified lines | ||
| 839 | 885 | |
| 840 | 886 | received: |
| 841 | 887 | map2->sock = newsock; |
| 842 | − newsock->sk = kzalloc(sizeof(*newsock->sk), GFP_KERNEL); | |
| 888 | + newsock->sk = sk_alloc(sock_net(sock->sk), PF_INET, GFP_KERNEL, &pvcalls_proto, false); | |
| 843 | 889 | if (!newsock->sk) { |
| 844 | 890 | bedata->rsp[req_id].req_id = PVCALLS_INVALID_ID; |
| 845 | 891 | map->passive.inflight_req_id = PVCALLS_INVALID_ID; |
| @@ -1032,8 +1078,8 @@ int pvcalls_front_release(struct socket *sock) · 186 unmodified lines | ||
| 1032 | 1078 | spin_lock(&bedata->socket_lock); |
| 1033 | 1079 | list_del(&map->list); |
| 1034 | 1080 | spin_unlock(&bedata->socket_lock); |
| 1035 | − if (READ_ONCE(map->passive.inflight_req_id) != | |
| 1036 | − PVCALLS_INVALID_ID) { | |
| 1081 | + if (READ_ONCE(map->passive.inflight_req_id) != PVCALLS_INVALID_ID && | |
| 1082 | + READ_ONCE(map->passive.inflight_req_id) != 0) { | |
| 1037 | 1083 | pvcalls_front_free_map(bedata, |
| 1038 | 1084 | map->passive.accept_map); |
| 1039 | 1085 | } |
| @@ -645,7 +645,7 @@ xen_swiotlb_dma_mmap(struct device *dev, struct vm_area_struct *vma, · 644 unmodified lines | ||
| 645 | 645 | void *cpu_addr, dma_addr_t dma_addr, size_t size, |
| 646 | 646 | unsigned long attrs) |
| 647 | 647 | { |
| 648 | −#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) | |
| 648 | +#ifdef CONFIG_ARM | |
| 649 | 649 | if (xen_get_dma_ops(dev)->mmap) |
| 650 | 650 | return xen_get_dma_ops(dev)->mmap(dev, vma, cpu_addr, |
| 651 | 651 | dma_addr, size, attrs); |
| @@ -662,7 +662,7 @@ xen_swiotlb_get_sgtable(struct device *dev, struct sg_table *sgt, · 10 unmodified lines | ||
| 662 | 662 | void *cpu_addr, dma_addr_t handle, size_t size, |
| 663 | 663 | unsigned long attrs) |
| 664 | 664 | { |
| 665 | −#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) | |
| 665 | +#ifdef CONFIG_ARM | |
| 666 | 666 | if (xen_get_dma_ops(dev)->get_sgtable) { |
| 667 | 667 | #if 0 |
| 668 | 668 | /* |
| @@ -208,7 +208,7 @@ again: · 207 unmodified lines | ||
| 208 | 208 | /* The new front of the queue now owns the state variables. */ |
| 209 | 209 | next = list_entry(vnode->pending_locks.next, |
| 210 | 210 | struct file_lock, fl_u.afs.link); |
| 211 | − vnode->lock_key = afs_file_key(next->fl_file); | |
| 211 | + vnode->lock_key = key_get(afs_file_key(next->fl_file)); | |
| 212 | 212 | vnode->lock_type = (next->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE; |
| 213 | 213 | vnode->lock_state = AFS_VNODE_LOCK_WAITING_FOR_CB; |
| 214 | 214 | goto again; |
| @@ -413,7 +413,7 @@ static void afs_dequeue_lock(struct afs_vnode *vnode, struct file_lock *fl) · 198 unmodified lines | ||
| 413 | 413 | /* The new front of the queue now owns the state variables. */ |
| 414 | 414 | next = list_entry(vnode->pending_locks.next, |
| 415 | 415 | struct file_lock, fl_u.afs.link); |
| 416 | − vnode->lock_key = afs_file_key(next->fl_file); | |
| 416 | + vnode->lock_key = key_get(afs_file_key(next->fl_file)); | |
| 417 | 417 | vnode->lock_type = (next->fl_type == F_RDLCK) ? AFS_LOCK_READ : AFS_LOCK_WRITE; |
| 418 | 418 | vnode->lock_state = AFS_VNODE_LOCK_WAITING_FOR_CB; |
| 419 | 419 | afs_lock_may_be_available(vnode); |
| @@ -414,7 +414,6 @@ int afs_validate(struct afs_vnode *vnode, struct key *key) · 413 unmodified lines | ||
| 414 | 414 | } else if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) { |
| 415 | 415 | valid = true; |
| 416 | 416 | } else { |
| 417 | − vnode->cb_s_break = vnode->cb_interest->server->cb_s_break; | |
| 418 | 417 | vnode->cb_v_break = vnode->volume->cb_v_break; |
| 419 | 418 | valid = false; |
| 420 | 419 | } |
| @@ -546,6 +545,8 @@ void afs_evict_inode(struct inode *inode) · 125 unmodified lines | ||
| 546 | 545 | #endif |
| 547 | 546 | |
| 548 | 547 | afs_put_permits(rcu_access_pointer(vnode->permit_cache)); |
| 548 | + key_put(vnode->lock_key); | |
| 549 | + vnode->lock_key = NULL; | |
| 549 | 550 | _leave(""); |
| 550 | 551 | } |
| 551 | 552 | |
| @@ -161,3 +161,14 @@ struct yfs_xdr_YFSStoreVolumeStatus { · 160 unmodified lines | ||
| 161 | 161 | struct yfs_xdr_u64 max_quota; |
| 162 | 162 | struct yfs_xdr_u64 file_quota; |
| 163 | 163 | } __packed; |
| 164 | + | |
| 165 | +enum yfs_lock_type { | |
| 166 | + yfs_LockNone = -1, | |
| 167 | + yfs_LockRead = 0, | |
| 168 | + yfs_LockWrite = 1, | |
| 169 | + yfs_LockExtend = 2, | |
| 170 | + yfs_LockRelease = 3, | |
| 171 | + yfs_LockMandatoryRead = 0x100, | |
| 172 | + yfs_LockMandatoryWrite = 0x101, | |
| 173 | + yfs_LockMandatoryExtend = 0x102, | |
| 174 | +}; | |
| @@ -23,6 +23,7 @@ struct workqueue_struct *afs_async_calls; · 22 unmodified lines | ||
| 23 | 23 | static void afs_wake_up_call_waiter(struct sock *, struct rxrpc_call *, unsigned long); |
| 24 | 24 | static long afs_wait_for_call_to_complete(struct afs_call *, struct afs_addr_cursor *); |
| 25 | 25 | static void afs_wake_up_async_call(struct sock *, struct rxrpc_call *, unsigned long); |
| 26 | +static void afs_delete_async_call(struct work_struct *); | |
| 26 | 27 | static void afs_process_async_call(struct work_struct *); |
| 27 | 28 | static void afs_rx_new_call(struct sock *, struct rxrpc_call *, unsigned long); |
| 28 | 29 | static void afs_rx_discard_new_call(struct rxrpc_call *, unsigned long); |
| @@ -203,20 +204,26 @@ void afs_put_call(struct afs_call *call) · 174 unmodified lines | ||
| 203 | 204 | } |
| 204 | 205 | } |
| 205 | 206 | |
| 207 | +static struct afs_call *afs_get_call(struct afs_call *call, | |
| 208 | + enum afs_call_trace why) | |
| 209 | +{ | |
| 210 | + int u = atomic_inc_return(&call->usage); | |
| 211 | + | |
| 212 | + trace_afs_call(call, why, u, | |
| 213 | + atomic_read(&call->net->nr_outstanding_calls), | |
| 214 | + __builtin_return_address(0)); | |
| 215 | + return call; | |
| 216 | +} | |
| 217 | + | |
| 206 | 218 | /* |
| 207 | 219 | * Queue the call for actual work. |
| 208 | 220 | */ |
| 209 | 221 | static void afs_queue_call_work(struct afs_call *call) |
| 210 | 222 | { |
| 211 | 223 | if (call->type->work) { |
| 212 | − int u = atomic_inc_return(&call->usage); | |
| 213 | − | |
| 214 | − trace_afs_call(call, afs_call_trace_work, u, | |
| 215 | − atomic_read(&call->net->nr_outstanding_calls), | |
| 216 | − __builtin_return_address(0)); | |
| 217 | − | |
| 218 | 224 | INIT_WORK(&call->work, call->type->work); |
| 219 | 225 | |
| 226 | + afs_get_call(call, afs_call_trace_work); | |
| 220 | 227 | if (!queue_work(afs_wq, &call->work)) |
| 221 | 228 | afs_put_call(call); |
| 222 | 229 | } |
| @@ -398,6 +405,12 @@ long afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, · 175 unmodified lines | ||
| 398 | 405 | } |
| 399 | 406 | } |
| 400 | 407 | |
| 408 | + /* If the call is going to be asynchronous, we need an extra ref for | |
| 409 | + * the call to hold itself so the caller need not hang on to its ref. | |
| 410 | + */ | |
| 411 | + if (call->async) | |
| 412 | + afs_get_call(call, afs_call_trace_get); | |
| 413 | + | |
| 401 | 414 | /* create a call */ |
| 402 | 415 | rxcall = rxrpc_kernel_begin_call(call->net->socket, srx, call->key, |
| 403 | 416 | (unsigned long)call, |
| @@ -438,15 +451,17 @@ long afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, · 34 unmodified lines | ||
| 438 | 451 | goto error_do_abort; |
| 439 | 452 | } |
| 440 | 453 | |
| 441 | − /* at this point, an async call may no longer exist as it may have | |
| 442 | − * already completed */ | |
| 443 | − if (call->async) | |
| 454 | + /* Note that at this point, we may have received the reply or an abort | |
| 455 | + * - and an asynchronous call may already have completed. | |
| 456 | + */ | |
| 457 | + if (call->async) { | |
| 458 | + afs_put_call(call); | |
| 444 | 459 | return -EINPROGRESS; |
| 460 | + } | |
| 445 | 461 | |
| 446 | 462 | return afs_wait_for_call_to_complete(call, ac); |
| 447 | 463 | |
| 448 | 464 | error_do_abort: |
| 449 | − call->state = AFS_CALL_COMPLETE; | |
| 450 | 465 | if (ret != -ECONNABORTED) { |
| 451 | 466 | rxrpc_kernel_abort_call(call->net->socket, rxcall, |
| 452 | 467 | RX_USER_ABORT, ret, "KSD"); |
| @@ -463,8 +478,24 @@ error_do_abort: · 10 unmodified lines | ||
| 463 | 478 | error_kill_call: |
| 464 | 479 | if (call->type->done) |
| 465 | 480 | call->type->done(call); |
| 466 | − afs_put_call(call); | |
| 481 | + | |
| 482 | + /* We need to dispose of the extra ref we grabbed for an async call. | |
| 483 | + * The call, however, might be queued on afs_async_calls and we need to | |
| 484 | + * make sure we don't get any more notifications that might requeue it. | |
| 485 | + */ | |
| 486 | + if (call->rxcall) { | |
| 487 | + rxrpc_kernel_end_call(call->net->socket, call->rxcall); | |
| 488 | + call->rxcall = NULL; | |
| 489 | + } | |
| 490 | + if (call->async) { | |
| 491 | + if (cancel_work_sync(&call->async_work)) | |
| 492 | + afs_put_call(call); | |
| 493 | + afs_put_call(call); | |
| 494 | + } | |
| 495 | + | |
| 467 | 496 | ac->error = ret; |
| 497 | + call->state = AFS_CALL_COMPLETE; | |
| 498 | + afs_put_call(call); | |
| 468 | 499 | _leave(" = %d", ret); |
| 469 | 500 | return ret; |
| 470 | 501 | } |
| @@ -42,9 +42,7 @@ struct afs_server_list *afs_alloc_server_list(struct afs_cell *cell, · 41 unmodified lines | ||
| 42 | 42 | if (vldb->fs_mask[i] & type_mask) |
| 43 | 43 | nr_servers++; |
| 44 | 44 | |
| 45 | − slist = kzalloc(sizeof(struct afs_server_list) + | |
| 46 | − sizeof(struct afs_server_entry) * nr_servers, | |
| 47 | − GFP_KERNEL); | |
| 45 | + slist = kzalloc(struct_size(slist, servers, nr_servers), GFP_KERNEL); | |
| 48 | 46 | if (!slist) |
| 49 | 47 | goto error; |
| 50 | 48 | |
| @@ -803,7 +803,7 @@ int yfs_fs_create_file(struct afs_fs_cursor *fc, · 802 unmodified lines | ||
| 803 | 803 | bp = xdr_encode_YFSFid(bp, &vnode->fid); |
| 804 | 804 | bp = xdr_encode_string(bp, name, namesz); |
| 805 | 805 | bp = xdr_encode_YFSStoreStatus_mode(bp, mode); |
| 806 | − bp = xdr_encode_u32(bp, 0); /* ViceLockType */ | |
| 806 | + bp = xdr_encode_u32(bp, yfs_LockNone); /* ViceLockType */ | |
| 807 | 807 | yfs_check_req(call, bp); |
| 808 | 808 | |
| 809 | 809 | afs_use_fs_server(call, fc->cbi); |
| @@ -596,7 +596,6 @@ int autofs_expire_run(struct super_block *sb, · 595 unmodified lines | ||
| 596 | 596 | pkt.len = dentry->d_name.len; |
| 597 | 597 | memcpy(pkt.name, dentry->d_name.name, pkt.len); |
| 598 | 598 | pkt.name[pkt.len] = '\0'; |
| 599 | − dput(dentry); | |
| 600 | 599 | |
| 601 | 600 | if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire))) |
| 602 | 601 | ret = -EFAULT; |
| @@ -609,6 +608,8 @@ int autofs_expire_run(struct super_block *sb, · 6 unmodified lines | ||
| 609 | 608 | complete_all(&ino->expire_complete); |
| 610 | 609 | spin_unlock(&sbi->fs_lock); |
| 611 | 610 | |
| 611 | + dput(dentry); | |
| 612 | + | |
| 612 | 613 | return ret; |
| 613 | 614 | } |
| 614 | 615 | |
| @@ -266,8 +266,10 @@ int autofs_fill_super(struct super_block *s, void *data, int silent) · 265 unmodified lines | ||
| 266 | 266 | } |
| 267 | 267 | root_inode = autofs_get_inode(s, S_IFDIR | 0755); |
| 268 | 268 | root = d_make_root(root_inode); |
| 269 | − if (!root) | |
| 269 | + if (!root) { | |
| 270 | + ret = -ENOMEM; | |
| 270 | 271 | goto fail_ino; |
| 272 | + } | |
| 271 | 273 | pipe = NULL; |
| 272 | 274 | |
| 273 | 275 | root->d_fsdata = ino; |
| @@ -104,6 +104,20 @@ void invalidate_bdev(struct block_device *bdev) · 103 unmodified lines | ||
| 104 | 104 | } |
| 105 | 105 | EXPORT_SYMBOL(invalidate_bdev); |
| 106 | 106 | |
| 107 | +static void set_init_blocksize(struct block_device *bdev) | |
| 108 | +{ | |
| 109 | + unsigned bsize = bdev_logical_block_size(bdev); | |
| 110 | + loff_t size = i_size_read(bdev->bd_inode); | |
| 111 | + | |
| 112 | + while (bsize < PAGE_SIZE) { | |
| 113 | + if (size & bsize) | |
| 114 | + break; | |
| 115 | + bsize <<= 1; | |
| 116 | + } | |
| 117 | + bdev->bd_block_size = bsize; | |
| 118 | + bdev->bd_inode->i_blkbits = blksize_bits(bsize); | |
| 119 | +} | |
| 120 | + | |
| 107 | 121 | int set_blocksize(struct block_device *bdev, int size) |
| 108 | 122 | { |
| 109 | 123 | /* Size must be a power of two, and between 512 and PAGE_SIZE */ |
| @@ -1431,18 +1445,9 @@ EXPORT_SYMBOL(check_disk_change); · 1321 unmodified lines | ||
| 1431 | 1445 | |
| 1432 | 1446 | void bd_set_size(struct block_device *bdev, loff_t size) |
| 1433 | 1447 | { |
| 1434 | − unsigned bsize = bdev_logical_block_size(bdev); | |
| 1435 | − | |
| 1436 | 1448 | inode_lock(bdev->bd_inode); |
| 1437 | 1449 | i_size_write(bdev->bd_inode, size); |
| 1438 | 1450 | inode_unlock(bdev->bd_inode); |
| 1439 | − while (bsize < PAGE_SIZE) { | |
| 1440 | − if (size & bsize) | |
| 1441 | − break; | |
| 1442 | − bsize <<= 1; | |
| 1443 | − } | |
| 1444 | − bdev->bd_block_size = bsize; | |
| 1445 | − bdev->bd_inode->i_blkbits = blksize_bits(bsize); | |
| 1446 | 1451 | } |
| 1447 | 1452 | EXPORT_SYMBOL(bd_set_size); |
| 1448 | 1453 | |
| @@ -1519,8 +1524,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) · 70 unmodified lines | ||
| 1519 | 1524 | } |
| 1520 | 1525 | } |
| 1521 | 1526 | |
| 1522 | − if (!ret) | |
| 1527 | + if (!ret) { | |
| 1523 | 1528 | bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); |
| 1529 | + set_init_blocksize(bdev); | |
| 1530 | + } | |
| 1524 | 1531 | |
| 1525 | 1532 | /* |
| 1526 | 1533 | * If the device is invalidated, rescan partition |
| @@ -1555,6 +1562,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) · 28 unmodified lines | ||
| 1555 | 1562 | goto out_clear; |
| 1556 | 1563 | } |
| 1557 | 1564 | bd_set_size(bdev, (loff_t)bdev->bd_part->nr_sects << 9); |
| 1565 | + set_init_blocksize(bdev); | |
| 1558 | 1566 | } |
| 1559 | 1567 | |
| 1560 | 1568 | if (bdev->bd_bdi == &noop_backing_dev_info) |
| @@ -968,6 +968,48 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, · 967 unmodified lines | ||
| 968 | 968 | return 0; |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | +static struct extent_buffer *alloc_tree_block_no_bg_flush( | |
| 972 | + struct btrfs_trans_handle *trans, | |
| 973 | + struct btrfs_root *root, | |
| 974 | + u64 parent_start, | |
| 975 | + const struct btrfs_disk_key *disk_key, | |
| 976 | + int level, | |
| 977 | + u64 hint, | |
| 978 | + u64 empty_size) | |
| 979 | +{ | |
| 980 | + struct btrfs_fs_info *fs_info = root->fs_info; | |
| 981 | + struct extent_buffer *ret; | |
| 982 | + | |
| 983 | + /* | |
| 984 | + * If we are COWing a node/leaf from the extent, chunk, device or free | |
| 985 | + * space trees, make sure that we do not finish block group creation of | |
| 986 | + * pending block groups. We do this to avoid a deadlock. | |
| 987 | + * COWing can result in allocation of a new chunk, and flushing pending | |
| 988 | + * block groups (btrfs_create_pending_block_groups()) can be triggered | |
| 989 | + * when finishing allocation of a new chunk. Creation of a pending block | |
| 990 | + * group modifies the extent, chunk, device and free space trees, | |
| 991 | + * therefore we could deadlock with ourselves since we are holding a | |
| 992 | + * lock on an extent buffer that btrfs_create_pending_block_groups() may | |
| 993 | + * try to COW later. | |
| 994 | + * For similar reasons, we also need to delay flushing pending block | |
| 995 | + * groups when splitting a leaf or node, from one of those trees, since | |
| 996 | + * we are holding a write lock on it and its parent or when inserting a | |
| 997 | + * new root node for one of those trees. | |
| 998 | + */ | |
| 999 | + if (root == fs_info->extent_root || | |
| 1000 | + root == fs_info->chunk_root || | |
| 1001 | + root == fs_info->dev_root || | |
| 1002 | + root == fs_info->free_space_root) | |
| 1003 | + trans->can_flush_pending_bgs = false; | |
| 1004 | + | |
| 1005 | + ret = btrfs_alloc_tree_block(trans, root, parent_start, | |
| 1006 | + root->root_key.objectid, disk_key, level, | |
| 1007 | + hint, empty_size); | |
| 1008 | + trans->can_flush_pending_bgs = true; | |
| 1009 | + | |
| 1010 | + return ret; | |
| 1011 | +} | |
| 1012 | + | |
| 971 | 1013 | /* |
| 972 | 1014 | * does the dirty work in cow of a single block. The parent block (if |
| 973 | 1015 | * supplied) is updated to point to the new cow copy. The new buffer is marked |
| @@ -1015,28 +1057,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, · 41 unmodified lines | ||
| 1015 | 1057 | if ((root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) && parent) |
| 1016 | 1058 | parent_start = parent->start; |
| 1017 | 1059 | |
| 1018 | − /* | |
| 1019 | − * If we are COWing a node/leaf from the extent, chunk, device or free | |
| 1020 | − * space trees, make sure that we do not finish block group creation of | |
| 1021 | − * pending block groups. We do this to avoid a deadlock. | |
| 1022 | − * COWing can result in allocation of a new chunk, and flushing pending | |
| 1023 | − * block groups (btrfs_create_pending_block_groups()) can be triggered | |
| 1024 | − * when finishing allocation of a new chunk. Creation of a pending block | |
| 1025 | − * group modifies the extent, chunk, device and free space trees, | |
| 1026 | − * therefore we could deadlock with ourselves since we are holding a | |
| 1027 | − * lock on an extent buffer that btrfs_create_pending_block_groups() may | |
| 1028 | − * try to COW later. | |
| 1029 | − */ | |
| 1030 | − if (root == fs_info->extent_root || | |
| 1031 | − root == fs_info->chunk_root || | |
| 1032 | − root == fs_info->dev_root || | |
| 1033 | − root == fs_info->free_space_root) | |
| 1034 | − trans->can_flush_pending_bgs = false; | |
| 1035 | − | |
| 1036 | − cow = btrfs_alloc_tree_block(trans, root, parent_start, | |
| 1037 | − root->root_key.objectid, &disk_key, level, | |
| 1038 | − search_start, empty_size); | |
| 1039 | − trans->can_flush_pending_bgs = true; | |
| 1060 | + cow = alloc_tree_block_no_bg_flush(trans, root, parent_start, &disk_key, | |
| 1061 | + level, search_start, empty_size); | |
| 1040 | 1062 | if (IS_ERR(cow)) |
| 1041 | 1063 | return PTR_ERR(cow); |
| 1042 | 1064 | |
| @@ -3345,8 +3367,8 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans, · 2302 unmodified lines | ||
| 3345 | 3367 | else |
| 3346 | 3368 | btrfs_node_key(lower, &lower_key, 0); |
| 3347 | 3369 | |
| 3348 | − c = btrfs_alloc_tree_block(trans, root, 0, root->root_key.objectid, | |
| 3349 | − &lower_key, level, root->node->start, 0); | |
| 3370 | + c = alloc_tree_block_no_bg_flush(trans, root, 0, &lower_key, level, | |
| 3371 | + root->node->start, 0); | |
| 3350 | 3372 | if (IS_ERR(c)) |
| 3351 | 3373 | return PTR_ERR(c); |
| 3352 | 3374 | |
| @@ -3475,8 +3497,8 @@ static noinline int split_node(struct btrfs_trans_handle *trans, · 122 unmodified lines | ||
| 3475 | 3497 | mid = (c_nritems + 1) / 2; |
| 3476 | 3498 | btrfs_node_key(c, &disk_key, mid); |
| 3477 | 3499 | |
| 3478 | − split = btrfs_alloc_tree_block(trans, root, 0, root->root_key.objectid, | |
| 3479 | − &disk_key, level, c->start, 0); | |
| 3500 | + split = alloc_tree_block_no_bg_flush(trans, root, 0, &disk_key, level, | |
| 3501 | + c->start, 0); | |
| 3480 | 3502 | if (IS_ERR(split)) |
| 3481 | 3503 | return PTR_ERR(split); |
| 3482 | 3504 | |
| @@ -4260,8 +4282,8 @@ again: · 777 unmodified lines | ||
| 4260 | 4282 | else |
| 4261 | 4283 | btrfs_item_key(l, &disk_key, mid); |
| 4262 | 4284 | |
| 4263 | − right = btrfs_alloc_tree_block(trans, root, 0, root->root_key.objectid, | |
| 4264 | − &disk_key, 0, l->start, 0); | |
| 4285 | + right = alloc_tree_block_no_bg_flush(trans, root, 0, &disk_key, 0, | |
| 4286 | + l->start, 0); | |
| 4265 | 4287 | if (IS_ERR(right)) |
| 4266 | 4288 | return PTR_ERR(right); |
| 4267 | 4289 | |
| @@ -35,6 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | struct btrfs_trans_handle; |
| 36 | 36 | struct btrfs_transaction; |
| 37 | 37 | struct btrfs_pending_snapshot; |
| 38 | +struct btrfs_delayed_ref_root; | |
| 38 | 39 | extern struct kmem_cache *btrfs_trans_handle_cachep; |
| 39 | 40 | extern struct kmem_cache *btrfs_bit_radix_cachep; |
| 40 | 41 | extern struct kmem_cache *btrfs_path_cachep; |
| @@ -786,6 +787,9 @@ enum { · 745 unmodified lines | ||
| 786 | 787 | * main phase. The fs_info::balance_ctl is initialized. |
| 787 | 788 | */ |
| 788 | 789 | BTRFS_FS_BALANCE_RUNNING, |
| 790 | + | |
| 791 | + /* Indicate that the cleaner thread is awake and doing something. */ | |
| 792 | + BTRFS_FS_CLEANER_RUNNING, | |
| 789 | 793 | }; |
| 790 | 794 | |
| 791 | 795 | struct btrfs_fs_info { |
| @@ -2661,6 +2665,9 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, · 1869 unmodified lines | ||
| 2661 | 2665 | unsigned long count); |
| 2662 | 2666 | int btrfs_async_run_delayed_refs(struct btrfs_fs_info *fs_info, |
| 2663 | 2667 | unsigned long count, u64 transid, int wait); |
| 2668 | +void btrfs_cleanup_ref_head_accounting(struct btrfs_fs_info *fs_info, | |
| 2669 | + struct btrfs_delayed_ref_root *delayed_refs, | |
| 2670 | + struct btrfs_delayed_ref_head *head); | |
| 2664 | 2671 | int btrfs_lookup_data_extent(struct btrfs_fs_info *fs_info, u64 start, u64 len); |
| 2665 | 2672 | int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, |
| 2666 | 2673 | struct btrfs_fs_info *fs_info, u64 bytenr, |
| @@ -1682,6 +1682,8 @@ static int cleaner_kthread(void *arg) · 1681 unmodified lines | ||
| 1682 | 1682 | while (1) { |
| 1683 | 1683 | again = 0; |
| 1684 | 1684 | |
| 1685 | + set_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags); | |
| 1686 | + | |
| 1685 | 1687 | /* Make the cleaner go to sleep early. */ |
| 1686 | 1688 | if (btrfs_need_cleaner_sleep(fs_info)) |
| 1687 | 1689 | goto sleep; |
| @@ -1728,6 +1730,7 @@ static int cleaner_kthread(void *arg) · 40 unmodified lines | ||
| 1728 | 1730 | */ |
| 1729 | 1731 | btrfs_delete_unused_bgs(fs_info); |
| 1730 | 1732 | sleep: |
| 1733 | + clear_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags); | |
| 1731 | 1734 | if (kthread_should_park()) |
| 1732 | 1735 | kthread_parkme(); |
| 1733 | 1736 | if (kthread_should_stop()) |
| @@ -4201,6 +4204,14 @@ static void btrfs_destroy_all_ordered_extents(struct btrfs_fs_info *fs_info) · 2467 unmodified lines | ||
| 4201 | 4204 | spin_lock(&fs_info->ordered_root_lock); |
| 4202 | 4205 | } |
| 4203 | 4206 | spin_unlock(&fs_info->ordered_root_lock); |
| 4207 | + | |
| 4208 | + /* | |
| 4209 | + * We need this here because if we've been flipped read-only we won't | |
| 4210 | + * get sync() from the umount, so we need to make sure any ordered | |
| 4211 | + * extents that haven't had their dirty pages IO start writeout yet | |
| 4212 | + * actually get run and error out properly. | |
| 4213 | + */ | |
| 4214 | + btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); | |
| 4204 | 4215 | } |
| 4205 | 4216 | |
| 4206 | 4217 | static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, |
| @@ -4265,6 +4276,7 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, · 58 unmodified lines | ||
| 4265 | 4276 | if (pin_bytes) |
| 4266 | 4277 | btrfs_pin_extent(fs_info, head->bytenr, |
| 4267 | 4278 | head->num_bytes, 1); |
| 4279 | + btrfs_cleanup_ref_head_accounting(fs_info, delayed_refs, head); | |
| 4268 | 4280 | btrfs_put_delayed_ref_head(head); |
| 4269 | 4281 | cond_resched(); |
| 4270 | 4282 | spin_lock(&delayed_refs->lock); |
| @@ -2456,12 +2456,10 @@ static int run_and_cleanup_extent_op(struct btrfs_trans_handle *trans, · 2455 unmodified lines | ||
| 2456 | 2456 | return ret ? ret : 1; |
| 2457 | 2457 | } |
| 2458 | 2458 | |
| 2459 | −static void cleanup_ref_head_accounting(struct btrfs_trans_handle *trans, | |
| 2460 | − struct btrfs_delayed_ref_head *head) | |
| 2459 | +void btrfs_cleanup_ref_head_accounting(struct btrfs_fs_info *fs_info, | |
| 2460 | + struct btrfs_delayed_ref_root *delayed_refs, | |
| 2461 | + struct btrfs_delayed_ref_head *head) | |
| 2461 | 2462 | { |
| 2462 | − struct btrfs_fs_info *fs_info = trans->fs_info; | |
| 2463 | − struct btrfs_delayed_ref_root *delayed_refs = | |
| 2464 | − &trans->transaction->delayed_refs; | |
| 2465 | 2463 | int nr_items = 1; /* Dropping this ref head update. */ |
| 2466 | 2464 | |
| 2467 | 2465 | if (head->total_ref_mod < 0) { |
| @@ -2544,7 +2542,7 @@ static int cleanup_ref_head(struct btrfs_trans_handle *trans, · 76 unmodified lines | ||
| 2544 | 2542 | } |
| 2545 | 2543 | } |
| 2546 | 2544 | |
| 2547 | − cleanup_ref_head_accounting(trans, head); | |
| 2545 | + btrfs_cleanup_ref_head_accounting(fs_info, delayed_refs, head); | |
| 2548 | 2546 | |
| 2549 | 2547 | trace_run_delayed_ref_head(fs_info, head, 0); |
| 2550 | 2548 | btrfs_delayed_ref_unlock(head); |
| @@ -4954,6 +4952,15 @@ static void flush_space(struct btrfs_fs_info *fs_info, · 2403 unmodified lines | ||
| 4954 | 4952 | ret = 0; |
| 4955 | 4953 | break; |
| 4956 | 4954 | case COMMIT_TRANS: |
| 4955 | + /* | |
| 4956 | + * If we have pending delayed iputs then we could free up a | |
| 4957 | + * bunch of pinned space, so make sure we run the iputs before | |
| 4958 | + * we do our pinned bytes check below. | |
| 4959 | + */ | |
| 4960 | + mutex_lock(&fs_info->cleaner_delayed_iput_mutex); | |
| 4961 | + btrfs_run_delayed_iputs(fs_info); | |
| 4962 | + mutex_unlock(&fs_info->cleaner_delayed_iput_mutex); | |
| 4963 | + | |
| 4957 | 4964 | ret = may_commit_transaction(fs_info, space_info); |
| 4958 | 4965 | break; |
| 4959 | 4966 | default: |
| @@ -7188,7 +7195,7 @@ static noinline int check_ref_cleanup(struct btrfs_trans_handle *trans, · 2228 unmodified lines | ||
| 7188 | 7195 | if (head->must_insert_reserved) |
| 7189 | 7196 | ret = 1; |
| 7190 | 7197 | |
| 7191 | − cleanup_ref_head_accounting(trans, head); | |
| 7198 | + btrfs_cleanup_ref_head_accounting(trans->fs_info, delayed_refs, head); | |
| 7192 | 7199 | mutex_unlock(&head->mutex); |
| 7193 | 7200 | btrfs_put_delayed_ref_head(head); |
| 7194 | 7201 | return ret; |
| @@ -3129,9 +3129,6 @@ out: · 3128 unmodified lines | ||
| 3129 | 3129 | /* once for the tree */ |
| 3130 | 3130 | btrfs_put_ordered_extent(ordered_extent); |
| 3131 | 3131 | |
| 3132 | − /* Try to release some metadata so we don't get an OOM but don't wait */ | |
| 3133 | − btrfs_btree_balance_dirty_nodelay(fs_info); | |
| 3134 | − | |
| 3135 | 3132 | return ret; |
| 3136 | 3133 | } |
| 3137 | 3134 | |
| @@ -3254,6 +3251,8 @@ void btrfs_add_delayed_iput(struct inode *inode) · 116 unmodified lines | ||
| 3254 | 3251 | ASSERT(list_empty(&binode->delayed_iput)); |
| 3255 | 3252 | list_add_tail(&binode->delayed_iput, &fs_info->delayed_iputs); |
| 3256 | 3253 | spin_unlock(&fs_info->delayed_iput_lock); |
| 3254 | + if (!test_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags)) | |
| 3255 | + wake_up_process(fs_info->cleaner_kthread); | |
| 3257 | 3256 | } |
| 3258 | 3257 | |
| 3259 | 3258 | void btrfs_run_delayed_iputs(struct btrfs_fs_info *fs_info) |
| @@ -1621,6 +1621,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, · 1620 unmodified lines | ||
| 1621 | 1621 | flags | SB_RDONLY, device_name, data); |
| 1622 | 1622 | if (IS_ERR(mnt_root)) { |
| 1623 | 1623 | root = ERR_CAST(mnt_root); |
| 1624 | + kfree(subvol_name); | |
| 1624 | 1625 | goto out; |
| 1625 | 1626 | } |
| 1626 | 1627 | |
| @@ -1630,12 +1631,14 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, · 3 unmodified lines | ||
| 1630 | 1631 | if (error < 0) { |
| 1631 | 1632 | root = ERR_PTR(error); |
| 1632 | 1633 | mntput(mnt_root); |
| 1634 | + kfree(subvol_name); | |
| 1633 | 1635 | goto out; |
| 1634 | 1636 | } |
| 1635 | 1637 | } |
| 1636 | 1638 | } |
| 1637 | 1639 | if (IS_ERR(mnt_root)) { |
| 1638 | 1640 | root = ERR_CAST(mnt_root); |
| 1641 | + kfree(subvol_name); | |
| 1639 | 1642 | goto out; |
| 1640 | 1643 | } |
| 1641 | 1644 | |
| @@ -850,14 +850,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, · 849 unmodified lines | ||
| 850 | 850 | |
| 851 | 851 | btrfs_trans_release_chunk_metadata(trans); |
| 852 | 852 | |
| 853 | − if (lock && should_end_transaction(trans) && | |
| 854 | − READ_ONCE(cur_trans->state) == TRANS_STATE_RUNNING) { | |
| 855 | − spin_lock(&info->trans_lock); | |
| 856 | − if (cur_trans->state == TRANS_STATE_RUNNING) | |
| 857 | − cur_trans->state = TRANS_STATE_BLOCKED; | |
| 858 | − spin_unlock(&info->trans_lock); | |
| 859 | − } | |
| 860 | − | |
| 861 | 853 | if (lock && READ_ONCE(cur_trans->state) == TRANS_STATE_BLOCKED) { |
| 862 | 854 | if (throttle) |
| 863 | 855 | return btrfs_commit_transaction(trans); |
| @@ -1879,6 +1871,21 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans, int err) · 1015 unmodified lines | ||
| 1879 | 1871 | kmem_cache_free(btrfs_trans_handle_cachep, trans); |
| 1880 | 1872 | } |
| 1881 | 1873 | |
| 1874 | +/* | |
| 1875 | + * Release reserved delayed ref space of all pending block groups of the | |
| 1876 | + * transaction and remove them from the list | |
| 1877 | + */ | |
| 1878 | +static void btrfs_cleanup_pending_block_groups(struct btrfs_trans_handle *trans) | |
| 1879 | +{ | |
| 1880 | + struct btrfs_fs_info *fs_info = trans->fs_info; | |
| 1881 | + struct btrfs_block_group_cache *block_group, *tmp; | |
| 1882 | + | |
| 1883 | + list_for_each_entry_safe(block_group, tmp, &trans->new_bgs, bg_list) { | |
| 1884 | + btrfs_delayed_refs_rsv_release(fs_info, 1); | |
| 1885 | + list_del_init(&block_group->bg_list); | |
| 1886 | + } | |
| 1887 | +} | |
| 1888 | + | |
| 1882 | 1889 | static inline int btrfs_start_delalloc_flush(struct btrfs_fs_info *fs_info) |
| 1883 | 1890 | { |
| 1884 | 1891 | /* |
| @@ -2270,6 +2277,7 @@ scrub_continue: · 385 unmodified lines | ||
| 2270 | 2277 | btrfs_scrub_continue(fs_info); |
| 2271 | 2278 | cleanup_transaction: |
| 2272 | 2279 | btrfs_trans_release_metadata(trans); |
| 2280 | + btrfs_cleanup_pending_block_groups(trans); | |
| 2273 | 2281 | btrfs_trans_release_chunk_metadata(trans); |
| 2274 | 2282 | trans->block_rsv = NULL; |
| 2275 | 2283 | btrfs_warn(fs_info, "Skipping commit of aborted transaction."); |
| @@ -957,11 +957,11 @@ static noinline struct btrfs_device *device_list_add(const char *path, · 956 unmodified lines | ||
| 957 | 957 | else |
| 958 | 958 | fs_devices = alloc_fs_devices(disk_super->fsid, NULL); |
| 959 | 959 | |
| 960 | − fs_devices->fsid_change = fsid_change_in_progress; | |
| 961 | − | |
| 962 | 960 | if (IS_ERR(fs_devices)) |
| 963 | 961 | return ERR_CAST(fs_devices); |
| 964 | 962 | |
| 963 | + fs_devices->fsid_change = fsid_change_in_progress; | |
| 964 | + | |
| 965 | 965 | mutex_lock(&fs_devices->device_list_mutex); |
| 966 | 966 | list_add(&fs_devices->fs_list, &fs_uuids); |
| 967 | 967 | |
| @@ -1035,6 +1035,8 @@ static void drop_inode_snap_realm(struct ceph_inode_info *ci) · 1034 unmodified lines | ||
| 1035 | 1035 | list_del_init(&ci->i_snap_realm_item); |
| 1036 | 1036 | ci->i_snap_realm_counter++; |
| 1037 | 1037 | ci->i_snap_realm = NULL; |
| 1038 | + if (realm->ino == ci->i_vino.ino) | |
| 1039 | + realm->inode = NULL; | |
| 1038 | 1040 | spin_unlock(&realm->inodes_with_caps_lock); |
| 1039 | 1041 | ceph_put_snap_realm(ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc, |
| 1040 | 1042 | realm); |
| @@ -3,19 +3,6 @@ · 2 unmodified lines | ||
| 3 | 3 | * quota.c - CephFS quota |
| 4 | 4 | * |
| 5 | 5 | * Copyright (C) 2017-2018 SUSE |
| 6 | − * | |
| 7 | − * This program is free software; you can redistribute it and/or | |
| 8 | − * modify it under the terms of the GNU General Public License | |
| 9 | − * as published by the Free Software Foundation; either version 2 | |
| 10 | − * of the License, or (at your option) any later version. | |
| 11 | − * | |
| 12 | − * This program is distributed in the hope that it will be useful, | |
| 13 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | − * GNU General Public License for more details. | |
| 16 | − * | |
| 17 | − * You should have received a copy of the GNU General Public License | |
| 18 | − * along with this program; if not, see <http://www.gnu.org/licenses/>. | |
| 19 | 6 | */ |
| 20 | 7 | |
| 21 | 8 | #include <linux/statfs.h> |
| @@ -252,6 +252,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) · 251 unmodified lines | ||
| 252 | 252 | seq_printf(m, ",ACL"); |
| 253 | 253 | #endif |
| 254 | 254 | seq_putc(m, '\n'); |
| 255 | + seq_printf(m, "CIFSMaxBufSize: %d\n", CIFSMaxBufSize); | |
| 255 | 256 | seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid); |
| 256 | 257 | seq_printf(m, "Servers:"); |
| 257 | 258 | |
| @@ -150,5 +150,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); · 149 unmodified lines | ||
| 150 | 150 | extern const struct export_operations cifs_export_ops; |
| 151 | 151 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ |
| 152 | 152 | |
| 153 | −#define CIFS_VERSION "2.16" | |
| 153 | +#define CIFS_VERSION "2.17" | |
| 154 | 154 | #endif /* _CIFSFS_H */ |
| @@ -1549,18 +1549,26 @@ cifs_discard_remaining_data(struct TCP_Server_Info *server) · 1548 unmodified lines | ||
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | 1551 | static int |
| 1552 | −cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid) | |
| 1552 | +__cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid, | |
| 1553 | + bool malformed) | |
| 1553 | 1554 | { |
| 1554 | 1555 | int length; |
| 1555 | − struct cifs_readdata *rdata = mid->callback_data; | |
| 1556 | 1556 | |
| 1557 | 1557 | length = cifs_discard_remaining_data(server); |
| 1558 | − dequeue_mid(mid, rdata->result); | |
| 1558 | + dequeue_mid(mid, malformed); | |
| 1559 | 1559 | mid->resp_buf = server->smallbuf; |
| 1560 | 1560 | server->smallbuf = NULL; |
| 1561 | 1561 | return length; |
| 1562 | 1562 | } |
| 1563 | 1563 | |
| 1564 | +static int | |
| 1565 | +cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid) | |
| 1566 | +{ | |
| 1567 | + struct cifs_readdata *rdata = mid->callback_data; | |
| 1568 | + | |
| 1569 | + return __cifs_readv_discard(server, mid, rdata->result); | |
| 1570 | +} | |
| 1571 | + | |
| 1564 | 1572 | int |
| 1565 | 1573 | cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) |
| 1566 | 1574 | { |
| @@ -1602,12 +1610,23 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) · 35 unmodified lines | ||
| 1602 | 1610 | return -1; |
| 1603 | 1611 | } |
| 1604 | 1612 | |
| 1613 | + /* set up first two iov for signature check and to get credits */ | |
| 1614 | + rdata->iov[0].iov_base = buf; | |
| 1615 | + rdata->iov[0].iov_len = 4; | |
| 1616 | + rdata->iov[1].iov_base = buf + 4; | |
| 1617 | + rdata->iov[1].iov_len = server->total_read - 4; | |
| 1618 | + cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n", | |
| 1619 | + rdata->iov[0].iov_base, rdata->iov[0].iov_len); | |
| 1620 | + cifs_dbg(FYI, "1: iov_base=%p iov_len=%zu\n", | |
| 1621 | + rdata->iov[1].iov_base, rdata->iov[1].iov_len); | |
| 1622 | + | |
| 1605 | 1623 | /* Was the SMB read successful? */ |
| 1606 | 1624 | rdata->result = server->ops->map_error(buf, false); |
| 1607 | 1625 | if (rdata->result != 0) { |
| 1608 | 1626 | cifs_dbg(FYI, "%s: server returned error %d\n", |
| 1609 | 1627 | __func__, rdata->result); |
| 1610 | − return cifs_readv_discard(server, mid); | |
| 1628 | + /* normal error on read response */ | |
| 1629 | + return __cifs_readv_discard(server, mid, false); | |
| 1611 | 1630 | } |
| 1612 | 1631 | |
| 1613 | 1632 | /* Is there enough to get to the rest of the READ_RSP header? */ |
| @@ -1651,14 +1670,6 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) · 37 unmodified lines | ||
| 1651 | 1670 | server->total_read += length; |
| 1652 | 1671 | } |
| 1653 | 1672 | |
| 1654 | − /* set up first iov for signature check */ | |
| 1655 | − rdata->iov[0].iov_base = buf; | |
| 1656 | − rdata->iov[0].iov_len = 4; | |
| 1657 | − rdata->iov[1].iov_base = buf + 4; | |
| 1658 | − rdata->iov[1].iov_len = server->total_read - 4; | |
| 1659 | − cifs_dbg(FYI, "0: iov_base=%p iov_len=%u\n", | |
| 1660 | − rdata->iov[0].iov_base, server->total_read); | |
| 1661 | − | |
| 1662 | 1673 | /* how much data is in the response? */ |
| 1663 | 1674 | #ifdef CONFIG_CIFS_SMB_DIRECT |
| 1664 | 1675 | use_rdma_mr = rdata->mr; |
| @@ -720,6 +720,21 @@ server_unresponsive(struct TCP_Server_Info *server) · 719 unmodified lines | ||
| 720 | 720 | return false; |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | +static inline bool | |
| 724 | +zero_credits(struct TCP_Server_Info *server) | |
| 725 | +{ | |
| 726 | + int val; | |
| 727 | + | |
| 728 | + spin_lock(&server->req_lock); | |
| 729 | + val = server->credits + server->echo_credits + server->oplock_credits; | |
| 730 | + if (server->in_flight == 0 && val == 0) { | |
| 731 | + spin_unlock(&server->req_lock); | |
| 732 | + return true; | |
| 733 | + } | |
| 734 | + spin_unlock(&server->req_lock); | |
| 735 | + return false; | |
| 736 | +} | |
| 737 | + | |
| 723 | 738 | static int |
| 724 | 739 | cifs_readv_from_socket(struct TCP_Server_Info *server, struct msghdr *smb_msg) |
| 725 | 740 | { |
| @@ -732,6 +747,12 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct msghdr *smb_msg) · 6 unmodified lines | ||
| 732 | 747 | for (total_read = 0; msg_data_left(smb_msg); total_read += length) { |
| 733 | 748 | try_to_freeze(); |
| 734 | 749 | |
| 750 | + /* reconnect if no credits and no requests in flight */ | |
| 751 | + if (zero_credits(server)) { | |
| 752 | + cifs_reconnect(server); | |
| 753 | + return -ECONNABORTED; | |
| 754 | + } | |
| 755 | + | |
| 735 | 756 | if (server_unresponsive(server)) |
| 736 | 757 | return -ECONNABORTED; |
| 737 | 758 | if (cifs_rdma_enabled(server) && server->smbd_conn) |
| @@ -2696,6 +2696,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, · 2695 unmodified lines | ||
| 2696 | 2696 | |
| 2697 | 2697 | rc = cifs_write_allocate_pages(wdata->pages, nr_pages); |
| 2698 | 2698 | if (rc) { |
| 2699 | + kvfree(wdata->pages); | |
| 2699 | 2700 | kfree(wdata); |
| 2700 | 2701 | add_credits_and_wake_if(server, credits, 0); |
| 2701 | 2702 | break; |
| @@ -2707,6 +2708,7 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, · 5 unmodified lines | ||
| 2707 | 2708 | if (rc) { |
| 2708 | 2709 | for (i = 0; i < nr_pages; i++) |
| 2709 | 2710 | put_page(wdata->pages[i]); |
| 2711 | + kvfree(wdata->pages); | |
| 2710 | 2712 | kfree(wdata); |
| 2711 | 2713 | add_credits_and_wake_if(server, credits, 0); |
| 2712 | 2714 | break; |
| @@ -3386,8 +3388,12 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file, · 673 unmodified lines | ||
| 3386 | 3388 | } |
| 3387 | 3389 | |
| 3388 | 3390 | rc = cifs_read_allocate_pages(rdata, npages); |
| 3389 | − if (rc) | |
| 3390 | − goto error; | |
| 3391 | + if (rc) { | |
| 3392 | + kvfree(rdata->pages); | |
| 3393 | + kfree(rdata); | |
| 3394 | + add_credits_and_wake_if(server, credits, 0); | |
| 3395 | + break; | |
| 3396 | + } | |
| 3391 | 3397 | |
| 3392 | 3398 | rdata->tailsz = PAGE_SIZE; |
| 3393 | 3399 | } |
| @@ -3407,7 +3413,6 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file, · 13 unmodified lines | ||
| 3407 | 3413 | if (!rdata->cfile->invalidHandle || |
| 3408 | 3414 | !(rc = cifs_reopen_file(rdata->cfile, true))) |
| 3409 | 3415 | rc = server->ops->async_readv(rdata); |
| 3410 | −error: | |
| 3411 | 3416 | if (rc) { |
| 3412 | 3417 | add_credits_and_wake_if(server, rdata->credits, 0); |
| 3413 | 3418 | kref_put(&rdata->refcount, |
| @@ -293,6 +293,8 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, · 292 unmodified lines | ||
| 293 | 293 | int rc; |
| 294 | 294 | struct smb2_file_all_info *smb2_data; |
| 295 | 295 | __u32 create_options = 0; |
| 296 | + struct cifs_fid fid; | |
| 297 | + bool no_cached_open = tcon->nohandlecache; | |
| 296 | 298 | |
| 297 | 299 | *adjust_tz = false; |
| 298 | 300 | *symlink = false; |
| @@ -301,6 +303,21 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, · 2 unmodified lines | ||
| 301 | 303 | GFP_KERNEL); |
| 302 | 304 | if (smb2_data == NULL) |
| 303 | 305 | return -ENOMEM; |
| 306 | + | |
| 307 | + /* If it is a root and its handle is cached then use it */ | |
| 308 | + if (!strlen(full_path) && !no_cached_open) { | |
| 309 | + rc = open_shroot(xid, tcon, &fid); | |
| 310 | + if (rc) | |
| 311 | + goto out; | |
| 312 | + rc = SMB2_query_info(xid, tcon, fid.persistent_fid, | |
| 313 | + fid.volatile_fid, smb2_data); | |
| 314 | + close_shroot(&tcon->crfid); | |
| 315 | + if (rc) | |
| 316 | + goto out; | |
| 317 | + move_smb2_info_to_cifs(data, smb2_data); | |
| 318 | + goto out; | |
| 319 | + } | |
| 320 | + | |
| 304 | 321 | if (backup_cred(cifs_sb)) |
| 305 | 322 | create_options |= CREATE_OPEN_BACKUP_INTENT; |
| 306 | 323 | |
| @@ -648,6 +648,13 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) · 647 unmodified lines | ||
| 648 | 648 | if (rsp->sync_hdr.Command != SMB2_OPLOCK_BREAK) |
| 649 | 649 | return false; |
| 650 | 650 | |
| 651 | + if (rsp->sync_hdr.CreditRequest) { | |
| 652 | + spin_lock(&server->req_lock); | |
| 653 | + server->credits += le16_to_cpu(rsp->sync_hdr.CreditRequest); | |
| 654 | + spin_unlock(&server->req_lock); | |
| 655 | + wake_up(&server->request_q); | |
| 656 | + } | |
| 657 | + | |
| 651 | 658 | if (rsp->StructureSize != |
| 652 | 659 | smb2_rsp_struct_sizes[SMB2_OPLOCK_BREAK_HE]) { |
| 653 | 660 | if (le16_to_cpu(rsp->StructureSize) == 44) |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include "cifs_ioctl.h" |
| 35 | 35 | #include "smbdirect.h" |
| 36 | 36 | |
| 37 | +/* Change credits for different ops and return the total number of credits */ | |
| 37 | 38 | static int |
| 38 | 39 | change_conf(struct TCP_Server_Info *server) |
| 39 | 40 | { |
| @@ -41,17 +42,15 @@ change_conf(struct TCP_Server_Info *server) · 1 unmodified line | ||
| 41 | 42 | server->oplock_credits = server->echo_credits = 0; |
| 42 | 43 | switch (server->credits) { |
| 43 | 44 | case 0: |
| 44 | − return -1; | |
| 45 | + return 0; | |
| 45 | 46 | case 1: |
| 46 | 47 | server->echoes = false; |
| 47 | 48 | server->oplocks = false; |
| 48 | − cifs_dbg(VFS, "disabling echoes and oplocks\n"); | |
| 49 | 49 | break; |
| 50 | 50 | case 2: |
| 51 | 51 | server->echoes = true; |
| 52 | 52 | server->oplocks = false; |
| 53 | 53 | server->echo_credits = 1; |
| 54 | − cifs_dbg(FYI, "disabling oplocks\n"); | |
| 55 | 54 | break; |
| 56 | 55 | default: |
| 57 | 56 | server->echoes = true; |
| @@ -64,14 +63,15 @@ change_conf(struct TCP_Server_Info *server) · 6 unmodified lines | ||
| 64 | 63 | server->echo_credits = 1; |
| 65 | 64 | } |
| 66 | 65 | server->credits -= server->echo_credits + server->oplock_credits; |
| 67 | − return 0; | |
| 66 | + return server->credits + server->echo_credits + server->oplock_credits; | |
| 68 | 67 | } |
| 69 | 68 | |
| 70 | 69 | static void |
| 71 | 70 | smb2_add_credits(struct TCP_Server_Info *server, const unsigned int add, |
| 72 | 71 | const int optype) |
| 73 | 72 | { |
| 74 | − int *val, rc = 0; | |
| 73 | + int *val, rc = -1; | |
| 74 | + | |
| 75 | 75 | spin_lock(&server->req_lock); |
| 76 | 76 | val = server->ops->get_credits_field(server, optype); |
| 77 | 77 | |
| @@ -101,8 +101,26 @@ smb2_add_credits(struct TCP_Server_Info *server, const unsigned int add, · 23 unmodified lines | ||
| 101 | 101 | } |
| 102 | 102 | spin_unlock(&server->req_lock); |
| 103 | 103 | wake_up(&server->request_q); |
| 104 | − if (rc) | |
| 105 | − cifs_reconnect(server); | |
| 104 | + | |
| 105 | + if (server->tcpStatus == CifsNeedReconnect) | |
| 106 | + return; | |
| 107 | + | |
| 108 | + switch (rc) { | |
| 109 | + case -1: | |
| 110 | + /* change_conf hasn't been executed */ | |
| 111 | + break; | |
| 112 | + case 0: | |
| 113 | + cifs_dbg(VFS, "Possible client or server bug - zero credits\n"); | |
| 114 | + break; | |
| 115 | + case 1: | |
| 116 | + cifs_dbg(VFS, "disabling echoes and oplocks\n"); | |
| 117 | + break; | |
| 118 | + case 2: | |
| 119 | + cifs_dbg(FYI, "disabling oplocks\n"); | |
| 120 | + break; | |
| 121 | + default: | |
| 122 | + cifs_dbg(FYI, "add %u credits total=%d\n", add, rc); | |
| 123 | + } | |
| 106 | 124 | } |
| 107 | 125 | |
| 108 | 126 | static void |
| @@ -136,7 +154,11 @@ smb2_get_credits(struct mid_q_entry *mid) · 27 unmodified lines | ||
| 136 | 154 | { |
| 137 | 155 | struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)mid->resp_buf; |
| 138 | 156 | |
| 139 | − return le16_to_cpu(shdr->CreditRequest); | |
| 157 | + if (mid->mid_state == MID_RESPONSE_RECEIVED | |
| 158 | + || mid->mid_state == MID_RESPONSE_MALFORMED) | |
| 159 | + return le16_to_cpu(shdr->CreditRequest); | |
| 160 | + | |
| 161 | + return 0; | |
| 140 | 162 | } |
| 141 | 163 | |
| 142 | 164 | static int |
| @@ -165,14 +187,14 @@ smb2_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size, · 22 unmodified lines | ||
| 165 | 187 | |
| 166 | 188 | scredits = server->credits; |
| 167 | 189 | /* can deadlock with reopen */ |
| 168 | − if (scredits == 1) { | |
| 190 | + if (scredits <= 8) { | |
| 169 | 191 | *num = SMB2_MAX_BUFFER_SIZE; |
| 170 | 192 | *credits = 0; |
| 171 | 193 | break; |
| 172 | 194 | } |
| 173 | 195 | |
| 174 | − /* leave one credit for a possible reopen */ | |
| 175 | − scredits--; | |
| 196 | + /* leave some credits for reopen and other ops */ | |
| 197 | + scredits -= 8; | |
| 176 | 198 | *num = min_t(unsigned int, size, |
| 177 | 199 | scredits * SMB2_MAX_BUFFER_SIZE); |
| 178 | 200 | |
| @@ -844,7 +866,9 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, · 665 unmodified lines | ||
| 844 | 866 | FILE_READ_EA, |
| 845 | 867 | FILE_FULL_EA_INFORMATION, |
| 846 | 868 | SMB2_O_INFO_FILE, |
| 847 | − SMB2_MAX_EA_BUF, | |
| 869 | + CIFSMaxBufSize - | |
| 870 | + MAX_SMB2_CREATE_RESPONSE_SIZE - | |
| 871 | + MAX_SMB2_CLOSE_RESPONSE_SIZE, | |
| 848 | 872 | &rsp_iov, &buftype, cifs_sb); |
| 849 | 873 | if (rc) { |
| 850 | 874 | /* |
| @@ -3189,11 +3213,23 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, · 2338 unmodified lines | ||
| 3189 | 3213 | server->ops->is_status_pending(buf, server, 0)) |
| 3190 | 3214 | return -1; |
| 3191 | 3215 | |
| 3192 | − rdata->result = server->ops->map_error(buf, false); | |
| 3216 | + /* set up first two iov to get credits */ | |
| 3217 | + rdata->iov[0].iov_base = buf; | |
| 3218 | + rdata->iov[0].iov_len = 4; | |
| 3219 | + rdata->iov[1].iov_base = buf + 4; | |
| 3220 | + rdata->iov[1].iov_len = | |
| 3221 | + min_t(unsigned int, buf_len, server->vals->read_rsp_size) - 4; | |
| 3222 | + cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n", | |
| 3223 | + rdata->iov[0].iov_base, rdata->iov[0].iov_len); | |
| 3224 | + cifs_dbg(FYI, "1: iov_base=%p iov_len=%zu\n", | |
| 3225 | + rdata->iov[1].iov_base, rdata->iov[1].iov_len); | |
| 3226 | + | |
| 3227 | + rdata->result = server->ops->map_error(buf, true); | |
| 3193 | 3228 | if (rdata->result != 0) { |
| 3194 | 3229 | cifs_dbg(FYI, "%s: server returned error %d\n", |
| 3195 | 3230 | __func__, rdata->result); |
| 3196 | − dequeue_mid(mid, rdata->result); | |
| 3231 | + /* normal error on read response */ | |
| 3232 | + dequeue_mid(mid, false); | |
| 3197 | 3233 | return 0; |
| 3198 | 3234 | } |
| 3199 | 3235 | |
| @@ -3266,14 +3302,6 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, · 66 unmodified lines | ||
| 3266 | 3302 | return 0; |
| 3267 | 3303 | } |
| 3268 | 3304 | |
| 3269 | − /* set up first iov for signature check */ | |
| 3270 | − rdata->iov[0].iov_base = buf; | |
| 3271 | − rdata->iov[0].iov_len = 4; | |
| 3272 | − rdata->iov[1].iov_base = buf + 4; | |
| 3273 | − rdata->iov[1].iov_len = server->vals->read_rsp_size - 4; | |
| 3274 | − cifs_dbg(FYI, "0: iov_base=%p iov_len=%zu\n", | |
| 3275 | − rdata->iov[0].iov_base, server->vals->read_rsp_size); | |
| 3276 | − | |
| 3277 | 3305 | length = rdata->copy_into_pages(server, rdata, &iter); |
| 3278 | 3306 | |
| 3279 | 3307 | kfree(bvec); |
| @@ -2816,6 +2816,7 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon, · 2815 unmodified lines | ||
| 2816 | 2816 | int resp_buftype = CIFS_NO_BUFFER; |
| 2817 | 2817 | struct cifs_ses *ses = tcon->ses; |
| 2818 | 2818 | int flags = 0; |
| 2819 | + bool allocated = false; | |
| 2819 | 2820 | |
| 2820 | 2821 | cifs_dbg(FYI, "Query Info\n"); |
| 2821 | 2822 | |
| @@ -2855,14 +2856,21 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon, · 33 unmodified lines | ||
| 2855 | 2856 | "Error %d allocating memory for acl\n", |
| 2856 | 2857 | rc); |
| 2857 | 2858 | *dlen = 0; |
| 2859 | + rc = -ENOMEM; | |
| 2858 | 2860 | goto qinf_exit; |
| 2859 | 2861 | } |
| 2862 | + allocated = true; | |
| 2860 | 2863 | } |
| 2861 | 2864 | } |
| 2862 | 2865 | |
| 2863 | 2866 | rc = smb2_validate_and_copy_iov(le16_to_cpu(rsp->OutputBufferOffset), |
| 2864 | 2867 | le32_to_cpu(rsp->OutputBufferLength), |
| 2865 | 2868 | &rsp_iov, min_len, *data); |
| 2869 | + if (rc && allocated) { | |
| 2870 | + kfree(*data); | |
| 2871 | + *data = NULL; | |
| 2872 | + *dlen = 0; | |
| 2873 | + } | |
| 2866 | 2874 | |
| 2867 | 2875 | qinf_exit: |
| 2868 | 2876 | SMB2_query_info_free(&rqst); |
| @@ -2916,9 +2924,10 @@ smb2_echo_callback(struct mid_q_entry *mid) · 47 unmodified lines | ||
| 2916 | 2924 | { |
| 2917 | 2925 | struct TCP_Server_Info *server = mid->callback_data; |
| 2918 | 2926 | struct smb2_echo_rsp *rsp = (struct smb2_echo_rsp *)mid->resp_buf; |
| 2919 | − unsigned int credits_received = 1; | |
| 2927 | + unsigned int credits_received = 0; | |
| 2920 | 2928 | |
| 2921 | − if (mid->mid_state == MID_RESPONSE_RECEIVED) | |
| 2929 | + if (mid->mid_state == MID_RESPONSE_RECEIVED | |
| 2930 | + || mid->mid_state == MID_RESPONSE_MALFORMED) | |
| 2922 | 2931 | credits_received = le16_to_cpu(rsp->sync_hdr.CreditRequest); |
| 2923 | 2932 | |
| 2924 | 2933 | DeleteMidQEntry(mid); |
| @@ -3175,7 +3184,7 @@ smb2_readv_callback(struct mid_q_entry *mid) · 250 unmodified lines | ||
| 3175 | 3184 | struct TCP_Server_Info *server = tcon->ses->server; |
| 3176 | 3185 | struct smb2_sync_hdr *shdr = |
| 3177 | 3186 | (struct smb2_sync_hdr *)rdata->iov[0].iov_base; |
| 3178 | − unsigned int credits_received = 1; | |
| 3187 | + unsigned int credits_received = 0; | |
| 3179 | 3188 | struct smb_rqst rqst = { .rq_iov = rdata->iov, |
| 3180 | 3189 | .rq_nvec = 2, |
| 3181 | 3190 | .rq_pages = rdata->pages, |
| @@ -3214,6 +3223,9 @@ smb2_readv_callback(struct mid_q_entry *mid) · 32 unmodified lines | ||
| 3214 | 3223 | task_io_account_read(rdata->got_bytes); |
| 3215 | 3224 | cifs_stats_bytes_read(tcon, rdata->got_bytes); |
| 3216 | 3225 | break; |
| 3226 | + case MID_RESPONSE_MALFORMED: | |
| 3227 | + credits_received = le16_to_cpu(shdr->CreditRequest); | |
| 3228 | + /* fall through */ | |
| 3217 | 3229 | default: |
| 3218 | 3230 | if (rdata->result != -ENODATA) |
| 3219 | 3231 | rdata->result = -EIO; |
| @@ -3229,8 +3241,17 @@ smb2_readv_callback(struct mid_q_entry *mid) · 9 unmodified lines | ||
| 3229 | 3241 | rdata->mr = NULL; |
| 3230 | 3242 | } |
| 3231 | 3243 | #endif |
| 3232 | − if (rdata->result) | |
| 3244 | + if (rdata->result && rdata->result != -ENODATA) { | |
| 3233 | 3245 | cifs_stats_fail_inc(tcon, SMB2_READ_HE); |
| 3246 | + trace_smb3_read_err(0 /* xid */, | |
| 3247 | + rdata->cfile->fid.persistent_fid, | |
| 3248 | + tcon->tid, tcon->ses->Suid, rdata->offset, | |
| 3249 | + rdata->bytes, rdata->result); | |
| 3250 | + } else | |
| 3251 | + trace_smb3_read_done(0 /* xid */, | |
| 3252 | + rdata->cfile->fid.persistent_fid, | |
| 3253 | + tcon->tid, tcon->ses->Suid, | |
| 3254 | + rdata->offset, rdata->got_bytes); | |
| 3234 | 3255 | |
| 3235 | 3256 | queue_work(cifsiod_wq, &rdata->work); |
| 3236 | 3257 | DeleteMidQEntry(mid); |
| @@ -3305,13 +3326,11 @@ smb2_async_readv(struct cifs_readdata *rdata) · 68 unmodified lines | ||
| 3305 | 3326 | if (rc) { |
| 3306 | 3327 | kref_put(&rdata->refcount, cifs_readdata_release); |
| 3307 | 3328 | cifs_stats_fail_inc(io_parms.tcon, SMB2_READ_HE); |
| 3308 | − trace_smb3_read_err(rc, 0 /* xid */, io_parms.persistent_fid, | |
| 3309 | − io_parms.tcon->tid, io_parms.tcon->ses->Suid, | |
| 3310 | − io_parms.offset, io_parms.length); | |
| 3311 | − } else | |
| 3312 | − trace_smb3_read_done(0 /* xid */, io_parms.persistent_fid, | |
| 3313 | − io_parms.tcon->tid, io_parms.tcon->ses->Suid, | |
| 3314 | − io_parms.offset, io_parms.length); | |
| 3329 | + trace_smb3_read_err(0 /* xid */, io_parms.persistent_fid, | |
| 3330 | + io_parms.tcon->tid, | |
| 3331 | + io_parms.tcon->ses->Suid, | |
| 3332 | + io_parms.offset, io_parms.length, rc); | |
| 3333 | + } | |
| 3315 | 3334 | |
| 3316 | 3335 | cifs_small_buf_release(buf); |
| 3317 | 3336 | return rc; |
| @@ -3355,10 +3374,11 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms, · 37 unmodified lines | ||
| 3355 | 3374 | if (rc != -ENODATA) { |
| 3356 | 3375 | cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE); |
| 3357 | 3376 | cifs_dbg(VFS, "Send error in read = %d\n", rc); |
| 3377 | + trace_smb3_read_err(xid, req->PersistentFileId, | |
| 3378 | + io_parms->tcon->tid, ses->Suid, | |
| 3379 | + io_parms->offset, io_parms->length, | |
| 3380 | + rc); | |
| 3358 | 3381 | } |
| 3359 | − trace_smb3_read_err(rc, xid, req->PersistentFileId, | |
| 3360 | − io_parms->tcon->tid, ses->Suid, | |
| 3361 | − io_parms->offset, io_parms->length); | |
| 3362 | 3382 | free_rsp_buf(resp_buftype, rsp_iov.iov_base); |
| 3363 | 3383 | return rc == -ENODATA ? 0 : rc; |
| 3364 | 3384 | } else |
| @@ -3399,7 +3419,7 @@ smb2_writev_callback(struct mid_q_entry *mid) · 34 unmodified lines | ||
| 3399 | 3419 | struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink); |
| 3400 | 3420 | unsigned int written; |
| 3401 | 3421 | struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf; |
| 3402 | − unsigned int credits_received = 1; | |
| 3422 | + unsigned int credits_received = 0; | |
| 3403 | 3423 | |
| 3404 | 3424 | switch (mid->mid_state) { |
| 3405 | 3425 | case MID_RESPONSE_RECEIVED: |
| @@ -3427,6 +3447,9 @@ smb2_writev_callback(struct mid_q_entry *mid) · 21 unmodified lines | ||
| 3427 | 3447 | case MID_RETRY_NEEDED: |
| 3428 | 3448 | wdata->result = -EAGAIN; |
| 3429 | 3449 | break; |
| 3450 | + case MID_RESPONSE_MALFORMED: | |
| 3451 | + credits_received = le16_to_cpu(rsp->sync_hdr.CreditRequest); | |
| 3452 | + /* fall through */ | |
| 3430 | 3453 | default: |
| 3431 | 3454 | wdata->result = -EIO; |
| 3432 | 3455 | break; |
| @@ -3444,8 +3467,17 @@ smb2_writev_callback(struct mid_q_entry *mid) · 11 unmodified lines | ||
| 3444 | 3467 | wdata->mr = NULL; |
| 3445 | 3468 | } |
| 3446 | 3469 | #endif |
| 3447 | − if (wdata->result) | |
| 3470 | + if (wdata->result) { | |
| 3448 | 3471 | cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); |
| 3472 | + trace_smb3_write_err(0 /* no xid */, | |
| 3473 | + wdata->cfile->fid.persistent_fid, | |
| 3474 | + tcon->tid, tcon->ses->Suid, wdata->offset, | |
| 3475 | + wdata->bytes, wdata->result); | |
| 3476 | + } else | |
| 3477 | + trace_smb3_write_done(0 /* no xid */, | |
| 3478 | + wdata->cfile->fid.persistent_fid, | |
| 3479 | + tcon->tid, tcon->ses->Suid, | |
| 3480 | + wdata->offset, wdata->bytes); | |
| 3449 | 3481 | |
| 3450 | 3482 | queue_work(cifsiod_wq, &wdata->work); |
| 3451 | 3483 | DeleteMidQEntry(mid); |
| @@ -3587,10 +3619,7 @@ smb2_async_writev(struct cifs_writedata *wdata, · 135 unmodified lines | ||
| 3587 | 3619 | wdata->bytes, rc); |
| 3588 | 3620 | kref_put(&wdata->refcount, release); |
| 3589 | 3621 | cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); |
| 3590 | − } else | |
| 3591 | − trace_smb3_write_done(0 /* no xid */, req->PersistentFileId, | |
| 3592 | − tcon->tid, tcon->ses->Suid, wdata->offset, | |
| 3593 | − wdata->bytes); | |
| 3622 | + } | |
| 3594 | 3623 | |
| 3595 | 3624 | async_writev_out: |
| 3596 | 3625 | cifs_small_buf_release(req); |
| @@ -3816,8 +3845,8 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, · 219 unmodified lines | ||
| 3816 | 3845 | rsp->sync_hdr.Status == STATUS_NO_MORE_FILES) { |
| 3817 | 3846 | srch_inf->endOfSearch = true; |
| 3818 | 3847 | rc = 0; |
| 3819 | − } | |
| 3820 | − cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); | |
| 3848 | + } else | |
| 3849 | + cifs_stats_fail_inc(tcon, SMB2_QUERY_DIRECTORY_HE); | |
| 3821 | 3850 | goto qdir_exit; |
| 3822 | 3851 | } |
| 3823 | 3852 | |
| @@ -4412,8 +4441,8 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon, · 588 unmodified lines | ||
| 4412 | 4441 | rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov); |
| 4413 | 4442 | cifs_small_buf_release(req); |
| 4414 | 4443 | |
| 4415 | − please_key_low = (__u64 *)req->LeaseKey; | |
| 4416 | − please_key_high = (__u64 *)(req->LeaseKey+8); | |
| 4444 | + please_key_low = (__u64 *)lease_key; | |
| 4445 | + please_key_high = (__u64 *)(lease_key+8); | |
| 4417 | 4446 | if (rc) { |
| 4418 | 4447 | cifs_stats_fail_inc(tcon, SMB2_OPLOCK_BREAK_HE); |
| 4419 | 4448 | trace_smb3_lease_err(le32_to_cpu(lease_state), tcon->tid, |
| @@ -84,8 +84,9 @@ · 83 unmodified lines | ||
| 84 | 84 | |
| 85 | 85 | #define NUMBER_OF_SMB2_COMMANDS 0x0013 |
| 86 | 86 | |
| 87 | −/* 4 len + 52 transform hdr + 64 hdr + 56 create rsp */ | |
| 88 | −#define MAX_SMB2_HDR_SIZE 0x00b0 | |
| 87 | +/* 52 transform hdr + 64 hdr + 88 create rsp */ | |
| 88 | +#define SMB2_TRANSFORM_HEADER_SIZE 52 | |
| 89 | +#define MAX_SMB2_HDR_SIZE 204 | |
| 89 | 90 | |
| 90 | 91 | #define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe) |
| 91 | 92 | #define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd) |
| @@ -648,6 +649,13 @@ struct smb2_create_req { · 556 unmodified lines | ||
| 648 | 649 | __u8 Buffer[0]; |
| 649 | 650 | } __packed; |
| 650 | 651 | |
| 652 | +/* | |
| 653 | + * Maximum size of a SMB2_CREATE response is 64 (smb2 header) + | |
| 654 | + * 88 (fixed part of create response) + 520 (path) + 150 (contexts) + | |
| 655 | + * 2 bytes of padding. | |
| 656 | + */ | |
| 657 | +#define MAX_SMB2_CREATE_RESPONSE_SIZE 824 | |
| 658 | + | |
| 651 | 659 | struct smb2_create_rsp { |
| 652 | 660 | struct smb2_sync_hdr sync_hdr; |
| 653 | 661 | __le16 StructureSize; /* Must be 89 */ |
| @@ -996,6 +1004,11 @@ struct smb2_close_req { · 342 unmodified lines | ||
| 996 | 1004 | __u64 VolatileFileId; /* opaque endianness */ |
| 997 | 1005 | } __packed; |
| 998 | 1006 | |
| 1007 | +/* | |
| 1008 | + * Maximum size of a SMB2_CLOSE response is 64 (smb2 header) + 60 (data) | |
| 1009 | + */ | |
| 1010 | +#define MAX_SMB2_CLOSE_RESPONSE_SIZE 124 | |
| 1011 | + | |
| 999 | 1012 | struct smb2_close_rsp { |
| 1000 | 1013 | struct smb2_sync_hdr sync_hdr; |
| 1001 | 1014 | __le16 StructureSize; /* 60 */ |
| @@ -1398,8 +1411,6 @@ struct smb2_file_link_info { /* encoding of request for level 11 */ · 396 unmodified lines | ||
| 1398 | 1411 | char FileName[0]; /* Name to be assigned to new link */ |
| 1399 | 1412 | } __packed; /* level 11 Set */ |
| 1400 | 1413 | |
| 1401 | −#define SMB2_MAX_EA_BUF 65536 | |
| 1402 | − | |
| 1403 | 1414 | struct smb2_file_full_ea_info { /* encoding of response for level 15 */ |
| 1404 | 1415 | __le32 next_entry_offset; |
| 1405 | 1416 | __u8 flags; |
| @@ -3,16 +3,6 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright (C) 2018, Microsoft Corporation. |
| 4 | 4 | * |
| 5 | 5 | * Author(s): Steve French <stfrench@microsoft.com> |
| 6 | − * | |
| 7 | − * This program is free software; you can redistribute it and/or modify | |
| 8 | − * it under the terms of the GNU General Public License as published by | |
| 9 | − * the Free Software Foundation; either version 2 of the License, or | |
| 10 | − * (at your option) any later version. | |
| 11 | − * | |
| 12 | − * This program is distributed in the hope that it will be useful, | |
| 13 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
| 15 | − * the GNU General Public License for more details. | |
| 16 | 6 | */ |
| 17 | 7 | #define CREATE_TRACE_POINTS |
| 18 | 8 | #include "trace.h" |
| @@ -3,16 +3,6 @@ · 2 unmodified lines | ||
| 3 | 3 | * Copyright (C) 2018, Microsoft Corporation. |
| 4 | 4 | * |
| 5 | 5 | * Author(s): Steve French <stfrench@microsoft.com> |
| 6 | − * | |
| 7 | − * This program is free software; you can redistribute it and/or modify | |
| 8 | − * it under the terms of the GNU General Public License as published by | |
| 9 | − * the Free Software Foundation; either version 2 of the License, or | |
| 10 | − * (at your option) any later version. | |
| 11 | − * | |
| 12 | − * This program is distributed in the hope that it will be useful, | |
| 13 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
| 15 | − * the GNU General Public License for more details. | |
| 16 | 6 | */ |
| 17 | 7 | #undef TRACE_SYSTEM |
| 18 | 8 | #define TRACE_SYSTEM cifs |
| @@ -786,17 +786,8 @@ static void · 785 unmodified lines | ||
| 786 | 786 | cifs_compound_callback(struct mid_q_entry *mid) |
| 787 | 787 | { |
| 788 | 788 | struct TCP_Server_Info *server = mid->server; |
| 789 | − unsigned int optype = mid->optype; | |
| 790 | − unsigned int credits_received = 0; | |
| 791 | 789 | |
| 792 | − if (mid->mid_state == MID_RESPONSE_RECEIVED) { | |
| 793 | − if (mid->resp_buf) | |
| 794 | − credits_received = server->ops->get_credits(mid); | |
| 795 | − else | |
| 796 | − cifs_dbg(FYI, "Bad state for cancelled MID\n"); | |
| 797 | − } | |
| 798 | − | |
| 799 | − add_credits(server, credits_received, optype); | |
| 790 | + add_credits(server, server->ops->get_credits(mid), mid->optype); | |
| 800 | 791 | } |
| 801 | 792 | |
| 802 | 793 | static void |
| @@ -119,6 +119,7 @@ struct dentry_stat_t dentry_stat = { · 118 unmodified lines | ||
| 119 | 119 | |
| 120 | 120 | static DEFINE_PER_CPU(long, nr_dentry); |
| 121 | 121 | static DEFINE_PER_CPU(long, nr_dentry_unused); |
| 122 | +static DEFINE_PER_CPU(long, nr_dentry_negative); | |
| 122 | 123 | |
| 123 | 124 | #if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS) |
| 124 | 125 | |
| @@ -152,11 +153,22 @@ static long get_nr_dentry_unused(void) · 27 unmodified lines | ||
| 152 | 153 | return sum < 0 ? 0 : sum; |
| 153 | 154 | } |
| 154 | 155 | |
| 156 | +static long get_nr_dentry_negative(void) | |
| 157 | +{ | |
| 158 | + int i; | |
| 159 | + long sum = 0; | |
| 160 | + | |
| 161 | + for_each_possible_cpu(i) | |
| 162 | + sum += per_cpu(nr_dentry_negative, i); | |
| 163 | + return sum < 0 ? 0 : sum; | |
| 164 | +} | |
| 165 | + | |
| 155 | 166 | int proc_nr_dentry(struct ctl_table *table, int write, void __user *buffer, |
| 156 | 167 | size_t *lenp, loff_t *ppos) |
| 157 | 168 | { |
| 158 | 169 | dentry_stat.nr_dentry = get_nr_dentry(); |
| 159 | 170 | dentry_stat.nr_unused = get_nr_dentry_unused(); |
| 171 | + dentry_stat.nr_negative = get_nr_dentry_negative(); | |
| 160 | 172 | return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); |
| 161 | 173 | } |
| 162 | 174 | #endif |
| @@ -317,6 +329,8 @@ static inline void __d_clear_type_and_inode(struct dentry *dentry) · 154 unmodified lines | ||
| 317 | 329 | flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU); |
| 318 | 330 | WRITE_ONCE(dentry->d_flags, flags); |
| 319 | 331 | dentry->d_inode = NULL; |
| 332 | + if (dentry->d_flags & DCACHE_LRU_LIST) | |
| 333 | + this_cpu_inc(nr_dentry_negative); | |
| 320 | 334 | } |
| 321 | 335 | |
| 322 | 336 | static void dentry_free(struct dentry *dentry) |
| @@ -371,6 +385,11 @@ static void dentry_unlink_inode(struct dentry * dentry) · 48 unmodified lines | ||
| 371 | 385 | * The per-cpu "nr_dentry_unused" counters are updated with |
| 372 | 386 | * the DCACHE_LRU_LIST bit. |
| 373 | 387 | * |
| 388 | + * The per-cpu "nr_dentry_negative" counters are only updated | |
| 389 | + * when deleted from or added to the per-superblock LRU list, not | |
| 390 | + * from/to the shrink list. That is to avoid an unneeded dec/inc | |
| 391 | + * pair when moving from LRU to shrink list in select_collect(). | |
| 392 | + * | |
| 374 | 393 | * These helper functions make sure we always follow the |
| 375 | 394 | * rules. d_lock must be held by the caller. |
| 376 | 395 | */ |
| @@ -380,6 +399,8 @@ static void d_lru_add(struct dentry *dentry) · 3 unmodified lines | ||
| 380 | 399 | D_FLAG_VERIFY(dentry, 0); |
| 381 | 400 | dentry->d_flags |= DCACHE_LRU_LIST; |
| 382 | 401 | this_cpu_inc(nr_dentry_unused); |
| 402 | + if (d_is_negative(dentry)) | |
| 403 | + this_cpu_inc(nr_dentry_negative); | |
| 383 | 404 | WARN_ON_ONCE(!list_lru_add(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); |
| 384 | 405 | } |
| 385 | 406 | |
| @@ -388,6 +409,8 @@ static void d_lru_del(struct dentry *dentry) · 2 unmodified lines | ||
| 388 | 409 | D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); |
| 389 | 410 | dentry->d_flags &= ~DCACHE_LRU_LIST; |
| 390 | 411 | this_cpu_dec(nr_dentry_unused); |
| 412 | + if (d_is_negative(dentry)) | |
| 413 | + this_cpu_dec(nr_dentry_negative); | |
| 391 | 414 | WARN_ON_ONCE(!list_lru_del(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); |
| 392 | 415 | } |
| 393 | 416 | |
| @@ -418,6 +441,8 @@ static void d_lru_isolate(struct list_lru_one *lru, struct dentry *dentry) · 24 unmodified lines | ||
| 418 | 441 | D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); |
| 419 | 442 | dentry->d_flags &= ~DCACHE_LRU_LIST; |
| 420 | 443 | this_cpu_dec(nr_dentry_unused); |
| 444 | + if (d_is_negative(dentry)) | |
| 445 | + this_cpu_dec(nr_dentry_negative); | |
| 421 | 446 | list_lru_isolate(lru, &dentry->d_lru); |
| 422 | 447 | } |
| 423 | 448 | |
| @@ -426,6 +451,8 @@ static void d_lru_shrink_move(struct list_lru_one *lru, struct dentry *dentry, · 2 unmodified lines | ||
| 426 | 451 | { |
| 427 | 452 | D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); |
| 428 | 453 | dentry->d_flags |= DCACHE_SHRINK_LIST; |
| 454 | + if (d_is_negative(dentry)) | |
| 455 | + this_cpu_dec(nr_dentry_negative); | |
| 429 | 456 | list_lru_isolate_move(lru, &dentry->d_lru, list); |
| 430 | 457 | } |
| 431 | 458 | |
| @@ -1188,15 +1215,11 @@ static enum lru_status dentry_lru_isolate_shrink(struct list_head *item, · 756 unmodified lines | ||
| 1188 | 1215 | */ |
| 1189 | 1216 | void shrink_dcache_sb(struct super_block *sb) |
| 1190 | 1217 | { |
| 1191 | − long freed; | |
| 1192 | − | |
| 1193 | 1218 | do { |
| 1194 | 1219 | LIST_HEAD(dispose); |
| 1195 | 1220 | |
| 1196 | − freed = list_lru_walk(&sb->s_dentry_lru, | |
| 1221 | + list_lru_walk(&sb->s_dentry_lru, | |
| 1197 | 1222 | dentry_lru_isolate_shrink, &dispose, 1024); |
| 1198 | − | |
| 1199 | − this_cpu_sub(nr_dentry_unused, freed); | |
| 1200 | 1223 | shrink_dentry_list(&dispose); |
| 1201 | 1224 | } while (list_lru_count(&sb->s_dentry_lru) > 0); |
| 1202 | 1225 | } |
| @@ -1820,6 +1843,11 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode) · 617 unmodified lines | ||
| 1820 | 1843 | WARN_ON(d_in_lookup(dentry)); |
| 1821 | 1844 | |
| 1822 | 1845 | spin_lock(&dentry->d_lock); |
| 1846 | + /* | |
| 1847 | + * Decrement negative dentry count if it was in the LRU list. | |
| 1848 | + */ | |
| 1849 | + if (dentry->d_flags & DCACHE_LRU_LIST) | |
| 1850 | + this_cpu_dec(nr_dentry_negative); | |
| 1823 | 1851 | hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); |
| 1824 | 1852 | raw_write_seqcount_begin(&dentry->d_seq); |
| 1825 | 1853 | __d_set_inode_and_type(dentry, inode, add_flags); |
| @@ -679,6 +679,7 @@ static int get_more_blocks(struct dio *dio, struct dio_submit *sdio, · 678 unmodified lines | ||
| 679 | 679 | unsigned long fs_count; /* Number of filesystem-sized blocks */ |
| 680 | 680 | int create; |
| 681 | 681 | unsigned int i_blkbits = sdio->blkbits + sdio->blkfactor; |
| 682 | + loff_t i_size; | |
| 682 | 683 | |
| 683 | 684 | /* |
| 684 | 685 | * If there was a memory error and we've overwritten all the |
| @@ -708,8 +709,8 @@ static int get_more_blocks(struct dio *dio, struct dio_submit *sdio, · 23 unmodified lines | ||
| 708 | 709 | */ |
| 709 | 710 | create = dio->op == REQ_OP_WRITE; |
| 710 | 711 | if (dio->flags & DIO_SKIP_HOLES) { |
| 711 | − if (fs_startblk <= ((i_size_read(dio->inode) - 1) >> | |
| 712 | − i_blkbits)) | |
| 712 | + i_size = i_size_read(dio->inode); | |
| 713 | + if (i_size && fs_startblk <= (i_size - 1) >> i_blkbits) | |
| 713 | 714 | create = 0; |
| 714 | 715 | } |
| 715 | 716 | |
| @@ -21,8 +21,13 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) · 20 unmodified lines | ||
| 21 | 21 | spin_lock(&sb->s_inode_list_lock); |
| 22 | 22 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
| 23 | 23 | spin_lock(&inode->i_lock); |
| 24 | + /* | |
| 25 | + * We must skip inodes in unusual state. We may also skip | |
| 26 | + * inodes without pages but we deliberately won't in case | |
| 27 | + * we need to reschedule to avoid softlockups. | |
| 28 | + */ | |
| 24 | 29 | if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) || |
| 25 | − (inode->i_mapping->nrpages == 0)) { | |
| 30 | + (inode->i_mapping->nrpages == 0 && !need_resched())) { | |
| 26 | 31 | spin_unlock(&inode->i_lock); |
| 27 | 32 | continue; |
| 28 | 33 | } |
| @@ -30,6 +35,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) · 1 unmodified line | ||
| 30 | 35 | spin_unlock(&inode->i_lock); |
| 31 | 36 | spin_unlock(&sb->s_inode_list_lock); |
| 32 | 37 | |
| 38 | + cond_resched(); | |
| 33 | 39 | invalidate_mapping_pages(inode->i_mapping, 0, -1); |
| 34 | 40 | iput(toput_inode); |
| 35 | 41 | toput_inode = inode; |
| @@ -331,11 +331,22 @@ struct inode_switch_wbs_context { · 330 unmodified lines | ||
| 331 | 331 | struct work_struct work; |
| 332 | 332 | }; |
| 333 | 333 | |
| 334 | +static void bdi_down_write_wb_switch_rwsem(struct backing_dev_info *bdi) | |
| 335 | +{ | |
| 336 | + down_write(&bdi->wb_switch_rwsem); | |
| 337 | +} | |
| 338 | + | |
| 339 | +static void bdi_up_write_wb_switch_rwsem(struct backing_dev_info *bdi) | |
| 340 | +{ | |
| 341 | + up_write(&bdi->wb_switch_rwsem); | |
| 342 | +} | |
| 343 | + | |
| 334 | 344 | static void inode_switch_wbs_work_fn(struct work_struct *work) |
| 335 | 345 | { |
| 336 | 346 | struct inode_switch_wbs_context *isw = |
| 337 | 347 | container_of(work, struct inode_switch_wbs_context, work); |
| 338 | 348 | struct inode *inode = isw->inode; |
| 349 | + struct backing_dev_info *bdi = inode_to_bdi(inode); | |
| 339 | 350 | struct address_space *mapping = inode->i_mapping; |
| 340 | 351 | struct bdi_writeback *old_wb = inode->i_wb; |
| 341 | 352 | struct bdi_writeback *new_wb = isw->new_wb; |
| @@ -343,6 +354,12 @@ static void inode_switch_wbs_work_fn(struct work_struct *work) · 1 unmodified line | ||
| 343 | 354 | struct page *page; |
| 344 | 355 | bool switched = false; |
| 345 | 356 | |
| 357 | + /* | |
| 358 | + * If @inode switches cgwb membership while sync_inodes_sb() is | |
| 359 | + * being issued, sync_inodes_sb() might miss it. Synchronize. | |
| 360 | + */ | |
| 361 | + down_read(&bdi->wb_switch_rwsem); | |
| 362 | + | |
| 346 | 363 | /* |
| 347 | 364 | * By the time control reaches here, RCU grace period has passed |
| 348 | 365 | * since I_WB_SWITCH assertion and all wb stat update transactions |
| @@ -428,6 +445,8 @@ skip_switch: · 79 unmodified lines | ||
| 428 | 445 | spin_unlock(&new_wb->list_lock); |
| 429 | 446 | spin_unlock(&old_wb->list_lock); |
| 430 | 447 | |
| 448 | + up_read(&bdi->wb_switch_rwsem); | |
| 449 | + | |
| 431 | 450 | if (switched) { |
| 432 | 451 | wb_wakeup(new_wb); |
| 433 | 452 | wb_put(old_wb); |
| @@ -468,9 +487,18 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id) · 34 unmodified lines | ||
| 468 | 487 | if (inode->i_state & I_WB_SWITCH) |
| 469 | 488 | return; |
| 470 | 489 | |
| 490 | + /* | |
| 491 | + * Avoid starting new switches while sync_inodes_sb() is in | |
| 492 | + * progress. Otherwise, if the down_write protected issue path | |
| 493 | + * blocks heavily, we might end up starting a large number of | |
| 494 | + * switches which will block on the rwsem. | |
| 495 | + */ | |
| 496 | + if (!down_read_trylock(&bdi->wb_switch_rwsem)) | |
| 497 | + return; | |
| 498 | + | |
| 471 | 499 | isw = kzalloc(sizeof(*isw), GFP_ATOMIC); |
| 472 | 500 | if (!isw) |
| 473 | − return; | |
| 501 | + goto out_unlock; | |
| 474 | 502 | |
| 475 | 503 | /* find and pin the new wb */ |
| 476 | 504 | rcu_read_lock(); |
| @@ -504,12 +532,14 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id) · 27 unmodified lines | ||
| 504 | 532 | * Let's continue after I_WB_SWITCH is guaranteed to be visible. |
| 505 | 533 | */ |
| 506 | 534 | call_rcu(&isw->rcu_head, inode_switch_wbs_rcu_fn); |
| 507 | − return; | |
| 535 | + goto out_unlock; | |
| 508 | 536 | |
| 509 | 537 | out_free: |
| 510 | 538 | if (isw->new_wb) |
| 511 | 539 | wb_put(isw->new_wb); |
| 512 | 540 | kfree(isw); |
| 541 | +out_unlock: | |
| 542 | + up_read(&bdi->wb_switch_rwsem); | |
| 513 | 543 | } |
| 514 | 544 | |
| 515 | 545 | /** |
| @@ -887,6 +917,9 @@ fs_initcall(cgroup_writeback_init); · 371 unmodified lines | ||
| 887 | 917 | |
| 888 | 918 | #else /* CONFIG_CGROUP_WRITEBACK */ |
| 889 | 919 | |
| 920 | +static void bdi_down_write_wb_switch_rwsem(struct backing_dev_info *bdi) { } | |
| 921 | +static void bdi_up_write_wb_switch_rwsem(struct backing_dev_info *bdi) { } | |
| 922 | + | |
| 890 | 923 | static struct bdi_writeback * |
| 891 | 924 | locked_inode_to_wb_and_lock_list(struct inode *inode) |
| 892 | 925 | __releases(&inode->i_lock) |
| @@ -2413,8 +2446,11 @@ void sync_inodes_sb(struct super_block *sb) · 1520 unmodified lines | ||
| 2413 | 2446 | return; |
| 2414 | 2447 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); |
| 2415 | 2448 | |
| 2449 | + /* protect against inode wb switch, see inode_switch_wbs_work_fn() */ | |
| 2450 | + bdi_down_write_wb_switch_rwsem(bdi); | |
| 2416 | 2451 | bdi_split_work_to_wbs(bdi, &work, false); |
| 2417 | 2452 | wb_wait_for_completion(bdi, &done); |
| 2453 | + bdi_up_write_wb_switch_rwsem(bdi); | |
| 2418 | 2454 | |
| 2419 | 2455 | wait_sb_inodes(sb); |
| 2420 | 2456 | } |
| @@ -1742,7 +1742,6 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, · 1741 unmodified lines | ||
| 1742 | 1742 | req->in.h.nodeid = outarg->nodeid; |
| 1743 | 1743 | req->in.numargs = 2; |
| 1744 | 1744 | req->in.argpages = 1; |
| 1745 | − req->page_descs[0].offset = offset; | |
| 1746 | 1745 | req->end = fuse_retrieve_end; |
| 1747 | 1746 | |
| 1748 | 1747 | index = outarg->offset >> PAGE_SHIFT; |
| @@ -1757,6 +1756,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, · 8 unmodified lines | ||
| 1757 | 1756 | |
| 1758 | 1757 | this_num = min_t(unsigned, num, PAGE_SIZE - offset); |
| 1759 | 1758 | req->pages[req->num_pages] = page; |
| 1759 | + req->page_descs[req->num_pages].offset = offset; | |
| 1760 | 1760 | req->page_descs[req->num_pages].length = this_num; |
| 1761 | 1761 | req->num_pages++; |
| 1762 | 1762 | |
| @@ -2077,8 +2077,10 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe, · 314 unmodified lines | ||
| 2077 | 2077 | |
| 2078 | 2078 | ret = fuse_dev_do_write(fud, &cs, len); |
| 2079 | 2079 | |
| 2080 | + pipe_lock(pipe); | |
| 2080 | 2081 | for (idx = 0; idx < nbuf; idx++) |
| 2081 | 2082 | pipe_buf_release(pipe, &bufs[idx]); |
| 2083 | + pipe_unlock(pipe); | |
| 2082 | 2084 | |
| 2083 | 2085 | out: |
| 2084 | 2086 | kvfree(bufs); |
| @@ -1782,7 +1782,7 @@ static bool fuse_writepage_in_flight(struct fuse_req *new_req, · 1781 unmodified lines | ||
| 1782 | 1782 | spin_unlock(&fc->lock); |
| 1783 | 1783 | |
| 1784 | 1784 | dec_wb_stat(&bdi->wb, WB_WRITEBACK); |
| 1785 | − dec_node_page_state(page, NR_WRITEBACK_TEMP); | |
| 1785 | + dec_node_page_state(new_req->pages[0], NR_WRITEBACK_TEMP); | |
| 1786 | 1786 | wb_writeout_inc(&bdi->wb); |
| 1787 | 1787 | fuse_writepage_free(fc, new_req); |
| 1788 | 1788 | fuse_request_free(new_req); |
| @@ -628,6 +628,7 @@ void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns) · 627 unmodified lines | ||
| 628 | 628 | get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); |
| 629 | 629 | fc->pid_ns = get_pid_ns(task_active_pid_ns(current)); |
| 630 | 630 | fc->user_ns = get_user_ns(user_ns); |
| 631 | + fc->max_pages = FUSE_DEFAULT_MAX_PAGES_PER_REQ; | |
| 631 | 632 | } |
| 632 | 633 | EXPORT_SYMBOL_GPL(fuse_conn_init); |
| 633 | 634 | |
| @@ -1162,7 +1163,6 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) · 528 unmodified lines | ||
| 1162 | 1163 | fc->user_id = d.user_id; |
| 1163 | 1164 | fc->group_id = d.group_id; |
| 1164 | 1165 | fc->max_read = max_t(unsigned, 4096, d.max_read); |
| 1165 | − fc->max_pages = FUSE_DEFAULT_MAX_PAGES_PER_REQ; | |
| 1166 | 1166 | |
| 1167 | 1167 | /* Used by get_root_inode() */ |
| 1168 | 1168 | sb->s_fs_info = fc; |
| @@ -1780,9 +1780,9 @@ static int gfs2_rbm_find(struct gfs2_rbm *rbm, u8 state, u32 *minext, · 1779 unmodified lines | ||
| 1780 | 1780 | goto next_iter; |
| 1781 | 1781 | } |
| 1782 | 1782 | if (ret == -E2BIG) { |
| 1783 | − n += rbm->bii - initial_bii; | |
| 1784 | 1783 | rbm->bii = 0; |
| 1785 | 1784 | rbm->offset = 0; |
| 1785 | + n += (rbm->bii - initial_bii); | |
| 1786 | 1786 | goto res_covered_end_of_rgrp; |
| 1787 | 1787 | } |
| 1788 | 1788 | return ret; |
| @@ -116,6 +116,12 @@ iomap_page_create(struct inode *inode, struct page *page) · 115 unmodified lines | ||
| 116 | 116 | atomic_set(&iop->read_count, 0); |
| 117 | 117 | atomic_set(&iop->write_count, 0); |
| 118 | 118 | bitmap_zero(iop->uptodate, PAGE_SIZE / SECTOR_SIZE); |
| 119 | + | |
| 120 | + /* | |
| 121 | + * migrate_page_move_mapping() assumes that pages with private data have | |
| 122 | + * their count elevated by 1. | |
| 123 | + */ | |
| 124 | + get_page(page); | |
| 119 | 125 | set_page_private(page, (unsigned long)iop); |
| 120 | 126 | SetPagePrivate(page); |
| 121 | 127 | return iop; |
| @@ -132,6 +138,7 @@ iomap_page_release(struct page *page) · 10 unmodified lines | ||
| 132 | 138 | WARN_ON_ONCE(atomic_read(&iop->write_count)); |
| 133 | 139 | ClearPagePrivate(page); |
| 134 | 140 | set_page_private(page, 0); |
| 141 | + put_page(page); | |
| 135 | 142 | kfree(iop); |
| 136 | 143 | } |
| 137 | 144 | |
| @@ -569,8 +576,10 @@ iomap_migrate_page(struct address_space *mapping, struct page *newpage, · 431 unmodified lines | ||
| 569 | 576 | |
| 570 | 577 | if (page_has_private(page)) { |
| 571 | 578 | ClearPagePrivate(page); |
| 579 | + get_page(newpage); | |
| 572 | 580 | set_page_private(newpage, page_private(page)); |
| 573 | 581 | set_page_private(page, 0); |
| 582 | + put_page(page); | |
| 574 | 583 | SetPagePrivate(newpage); |
| 575 | 584 | } |
| 576 | 585 | |
| @@ -1804,6 +1813,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 1227 unmodified lines | ||
| 1804 | 1813 | loff_t pos = iocb->ki_pos, start = pos; |
| 1805 | 1814 | loff_t end = iocb->ki_pos + count - 1, ret = 0; |
| 1806 | 1815 | unsigned int flags = IOMAP_DIRECT; |
| 1816 | + bool wait_for_completion = is_sync_kiocb(iocb); | |
| 1807 | 1817 | struct blk_plug plug; |
| 1808 | 1818 | struct iomap_dio *dio; |
| 1809 | 1819 | |
| @@ -1823,7 +1833,6 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 13 unmodified lines | ||
| 1823 | 1833 | dio->end_io = end_io; |
| 1824 | 1834 | dio->error = 0; |
| 1825 | 1835 | dio->flags = 0; |
| 1826 | − dio->wait_for_completion = is_sync_kiocb(iocb); | |
| 1827 | 1836 | |
| 1828 | 1837 | dio->submit.iter = iter; |
| 1829 | 1838 | dio->submit.waiter = current; |
| @@ -1878,7 +1887,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 48 unmodified lines | ||
| 1878 | 1887 | dio_warn_stale_pagecache(iocb->ki_filp); |
| 1879 | 1888 | ret = 0; |
| 1880 | 1889 | |
| 1881 | − if (iov_iter_rw(iter) == WRITE && !dio->wait_for_completion && | |
| 1890 | + if (iov_iter_rw(iter) == WRITE && !wait_for_completion && | |
| 1882 | 1891 | !inode->i_sb->s_dio_done_wq) { |
| 1883 | 1892 | ret = sb_init_dio_done_wq(inode->i_sb); |
| 1884 | 1893 | if (ret < 0) |
| @@ -1894,7 +1903,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 9 unmodified lines | ||
| 1894 | 1903 | if (ret <= 0) { |
| 1895 | 1904 | /* magic error code to fall back to buffered I/O */ |
| 1896 | 1905 | if (ret == -ENOTBLK) { |
| 1897 | − dio->wait_for_completion = true; | |
| 1906 | + wait_for_completion = true; | |
| 1898 | 1907 | ret = 0; |
| 1899 | 1908 | } |
| 1900 | 1909 | break; |
| @@ -1916,8 +1925,24 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 15 unmodified lines | ||
| 1916 | 1925 | if (dio->flags & IOMAP_DIO_WRITE_FUA) |
| 1917 | 1926 | dio->flags &= ~IOMAP_DIO_NEED_SYNC; |
| 1918 | 1927 | |
| 1928 | + /* | |
| 1929 | + * We are about to drop our additional submission reference, which | |
| 1930 | + * might be the last reference to the dio. There are three three | |
| 1931 | + * different ways we can progress here: | |
| 1932 | + * | |
| 1933 | + * (a) If this is the last reference we will always complete and free | |
| 1934 | + * the dio ourselves. | |
| 1935 | + * (b) If this is not the last reference, and we serve an asynchronous | |
| 1936 | + * iocb, we must never touch the dio after the decrement, the | |
| 1937 | + * I/O completion handler will complete and free it. | |
| 1938 | + * (c) If this is not the last reference, but we serve a synchronous | |
| 1939 | + * iocb, the I/O completion handler will wake us up on the drop | |
| 1940 | + * of the final reference, and we will complete and free it here | |
| 1941 | + * after we got woken by the I/O completion handler. | |
| 1942 | + */ | |
| 1943 | + dio->wait_for_completion = wait_for_completion; | |
| 1919 | 1944 | if (!atomic_dec_and_test(&dio->ref)) { |
| 1920 | − if (!dio->wait_for_completion) | |
| 1945 | + if (!wait_for_completion) | |
| 1921 | 1946 | return -EIOCBQUEUED; |
| 1922 | 1947 | |
| 1923 | 1948 | for (;;) { |
| @@ -1934,9 +1959,7 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, · 10 unmodified lines | ||
| 1934 | 1959 | __set_current_state(TASK_RUNNING); |
| 1935 | 1960 | } |
| 1936 | 1961 | |
| 1937 | − ret = iomap_dio_complete(dio); | |
| 1938 | − | |
| 1939 | − return ret; | |
| 1962 | + return iomap_dio_complete(dio); | |
| 1940 | 1963 | |
| 1941 | 1964 | out_free_dio: |
| 1942 | 1965 | kfree(dio); |
| @@ -133,15 +133,9 @@ static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in, · 132 unmodified lines | ||
| 133 | 133 | struct file *file_out, loff_t pos_out, |
| 134 | 134 | size_t count, unsigned int flags) |
| 135 | 135 | { |
| 136 | − ssize_t ret; | |
| 137 | − | |
| 138 | 136 | if (file_inode(file_in) == file_inode(file_out)) |
| 139 | 137 | return -EINVAL; |
| 140 | −retry: | |
| 141 | − ret = nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count); | |
| 142 | − if (ret == -EAGAIN) | |
| 143 | − goto retry; | |
| 144 | − return ret; | |
| 138 | + return nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count); | |
| 145 | 139 | } |
| 146 | 140 | |
| 147 | 141 | static loff_t nfs4_file_llseek(struct file *filep, loff_t offset, int whence) |
| @@ -1895,6 +1895,11 @@ static int nfs_parse_devname(const char *dev_name, · 1894 unmodified lines | ||
| 1895 | 1895 | size_t len; |
| 1896 | 1896 | char *end; |
| 1897 | 1897 | |
| 1898 | + if (unlikely(!dev_name || !*dev_name)) { | |
| 1899 | + dfprintk(MOUNT, "NFS: device name not specified\n"); | |
| 1900 | + return -EINVAL; | |
| 1901 | + } | |
| 1902 | + | |
| 1898 | 1903 | /* Is the host name protected with square brakcets? */ |
| 1899 | 1904 | if (*dev_name == '[') { |
| 1900 | 1905 | end = strchr(++dev_name, ']'); |
| @@ -621,11 +621,12 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, · 620 unmodified lines | ||
| 621 | 621 | nfs_set_page_writeback(page); |
| 622 | 622 | WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags)); |
| 623 | 623 | |
| 624 | − ret = 0; | |
| 624 | + ret = req->wb_context->error; | |
| 625 | 625 | /* If there is a fatal error that covers this write, just exit */ |
| 626 | − if (nfs_error_is_fatal_on_server(req->wb_context->error)) | |
| 626 | + if (nfs_error_is_fatal_on_server(ret)) | |
| 627 | 627 | goto out_launder; |
| 628 | 628 | |
| 629 | + ret = 0; | |
| 629 | 630 | if (!nfs_pageio_add_request(pgio, req)) { |
| 630 | 631 | ret = pgio->pg_error; |
| 631 | 632 | /* |
| @@ -635,9 +636,9 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, · 3 unmodified lines | ||
| 635 | 636 | nfs_context_set_write_error(req->wb_context, ret); |
| 636 | 637 | if (nfs_error_is_fatal_on_server(ret)) |
| 637 | 638 | goto out_launder; |
| 638 | − } | |
| 639 | + } else | |
| 640 | + ret = -EAGAIN; | |
| 639 | 641 | nfs_redirty_request(req); |
| 640 | − ret = -EAGAIN; | |
| 641 | 642 | } else |
| 642 | 643 | nfs_add_stats(page_file_mapping(page)->host, |
| 643 | 644 | NFSIOS_WRITEPAGES, 1); |
| @@ -557,9 +557,11 @@ __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst, · 556 unmodified lines | ||
| 557 | 557 | loff_t cloned; |
| 558 | 558 | |
| 559 | 559 | cloned = vfs_clone_file_range(src, src_pos, dst, dst_pos, count, 0); |
| 560 | + if (cloned < 0) | |
| 561 | + return nfserrno(cloned); | |
| 560 | 562 | if (count && cloned != count) |
| 561 | − cloned = -EINVAL; | |
| 562 | − return nfserrno(cloned < 0 ? cloned : 0); | |
| 563 | + return nfserrno(-EINVAL); | |
| 564 | + return 0; | |
| 563 | 565 | } |
| 564 | 566 | |
| 565 | 567 | ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst, |
| @@ -724,8 +724,10 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, · 723 unmodified lines | ||
| 724 | 724 | return -EBADF; |
11 more lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 313 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 190 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 139 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 342 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 169 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 312 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 150 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 176 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 1164 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 127 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 156 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 190 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 128 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 193 lines aren’t shown here.
This diff is large: its 396 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.